feat: Multiple Private links per Event Type (#15896)
* feat: Change hashedLink field to array Signed-off-by: Souptik Datta <[email protected]> * feat: Implement core single-use links logic Signed-off-by: Souptik Datta <[email protected]> * fix: Get private link from list of hashedLinks on event list page Signed-off-by: Souptik Datta <[email protected]> * fix: Fix defalut single-use links form field value Signed-off-by: Souptik Datta <[email protected]> * fix: Fix some type errors while compiling Signed-off-by: Souptik Datta <[email protected]> * fix: Use onChange callback instead of setting form values directly Signed-off-by: Souptik Datta <[email protected]> * feat: Add e2e tests for single-use links Signed-off-by: Souptik Datta <[email protected]> * refactor: Refactor single-use-links admin interface Signed-off-by: Souptik Datta <[email protected]> * fix: Fix settings toggle bugs Signed-off-by: Souptik Datta <[email protected]> * chore: Remove redundant inline comments Signed-off-by: Souptik Datta <[email protected]> * fix: Remove debug statements Signed-off-by: Souptik Datta <[email protected]> * chore: Remove single-use links e2e tests Signed-off-by: Souptik Datta <[email protected]> * feat: Remove private-link feature and override with single-use-links Signed-off-by: Souptik Datta <[email protected]> * fix: Fix type errors Signed-off-by: Souptik Datta <[email protected]> * refactor: Remove redundant migrations Signed-off-by: Souptik Datta <[email protected]> * fix: Add managedEvents restriction Signed-off-by: Souptik Datta <[email protected]> * fix: Fix single-use-links for org Signed-off-by: Souptik Datta <[email protected]> * fix: Fix recommended UI changes Signed-off-by: Souptik Datta <[email protected]> * fix: Fix duration not respected for private links Signed-off-by: Souptik Datta <[email protected]> * fix: Fix team event page title Signed-off-by: Souptik Datta <[email protected]> * feat: Add logic to copy each single-use-links from event listing page Signed-off-by: Souptik Datta <[email protected]> * feat: Add single-use links support for managed event types Signed-off-by: Souptik Datta <[email protected]> * fix: Fix some type errors Signed-off-by: Souptik Datta <[email protected]> * fix: Fix type errors Signed-off-by: Souptik Datta <[email protected]> * refactor: Disable adding new single-use links when field is locked Signed-off-by: Souptik Datta <[email protected]> * fix: Address feedbacks Signed-off-by: Souptik Datta <[email protected]> * refactor: Hide add new link button for locked single-use link field Signed-off-by: Souptik Datta <[email protected]> * chore: Use empty string for single-use link fallback value condition Signed-off-by: Souptik Datta <[email protected]> * fix: Fix org single-use links in listing page Signed-off-by: Souptik Datta <[email protected]> * feat: Auto toggle unlock button for managed event's single-use links option Signed-off-by: Souptik Datta <[email protected]> * Revert "feat: Auto toggle unlock button for managed event's single-use links option" This reverts commit 5a2ed6f0bf428d52de153335499f02f42ccdf18f. * chore: Disable parent toggle for single-use-links Signed-off-by: Souptik Datta <[email protected]> * feat: Remove tooltip and give info message below field Signed-off-by: Souptik Datta <[email protected]> * add tooltip * tooltip message * fix: Fix typo Signed-off-by: Souptik Datta <[email protected]> * fix: Fix typescript type errors Signed-off-by: Souptik Datta <[email protected]> * fix: Fix few unit tests Signed-off-by: Souptik Datta <[email protected]> * refactor: Remove redundant query Signed-off-by: Souptik Datta <[email protected]> * merge conflict fix * More merge conflict fix and refactor * fix tests, code refactor * fix: type check * fix: duration config and keep links when updating event type * fix: e2e * refactor: Replace single-use-links with multiple-private-links Signed-off-by: Souptik Datta <[email protected]> --------- Signed-off-by: Souptik Datta <[email protected]> Co-authored-by: Anik Dhabal Babu <[email protected]> Co-authored-by: Amit91848 <[email protected]>
This commit is contained in:
20 files changed
+245
-178
No files matched your search
@@ -16,6 +16,7 @@ export default function Type({
|
||||
entity,
|
||||
duration,
|
||||
hashedLink,
|
||||
durationConfig,
|
||||
}: PageProps) {
|
||||
return (
|
||||
<main className={getBookerWrapperClasses({ isEmbed: !!isEmbed })}>
|
||||
@@ -35,6 +36,7 @@ export default function Type({
|
||||
entity={entity}
|
||||
duration={duration}
|
||||
hashedLink={hashedLink}
|
||||
durationConfig={durationConfig}
|
||||
/>
|
||||
</main>
|
||||
);
|
||||
|
||||
@@ -19,7 +19,6 @@ import { getTeamsFiltersFromQuery } from "@calcom/features/filters/lib/getTeamsF
|
||||
import Shell from "@calcom/features/shell/Shell";
|
||||
import { parseEventTypeColor } from "@calcom/lib";
|
||||
import { APP_NAME } from "@calcom/lib/constants";
|
||||
import { WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery";
|
||||
@@ -250,6 +249,7 @@ export const InfiniteEventTypeList = ({
|
||||
const [deleteDialogTypeSchedulingType, setDeleteDialogSchedulingType] = useState<SchedulingType | null>(
|
||||
null
|
||||
);
|
||||
const [privateLinkCopyIndices, setPrivateLinkCopyIndices] = useState<Record<string, number>>({});
|
||||
|
||||
const utils = trpc.useUtils();
|
||||
const mutation = trpc.viewer.eventTypeOrder.useMutation({
|
||||
@@ -443,8 +443,11 @@ export const InfiniteEventTypeList = ({
|
||||
return page?.eventTypes?.map((type, index) => {
|
||||
const embedLink = `${group.profile.slug}/${type.slug}`;
|
||||
const calLink = `${bookerUrl}/${embedLink}`;
|
||||
const isPrivateURLEnabled = type.hashedLink?.link;
|
||||
const placeholderHashedLink = `${WEBSITE_URL}/d/${type.hashedLink?.link}/${type.slug}`;
|
||||
const isPrivateURLEnabled =
|
||||
type.hashedLink && type.hashedLink.length > 0
|
||||
? type.hashedLink[privateLinkCopyIndices[type.slug] ?? 0]?.link
|
||||
: "";
|
||||
const placeholderHashedLink = `${bookerUrl}/d/${isPrivateURLEnabled}/${type.slug}`;
|
||||
const isManagedEventType = type.schedulingType === SchedulingType.MANAGED;
|
||||
const isChildrenManagedEventType =
|
||||
type.metadata?.managedEventConfig !== undefined &&
|
||||
@@ -544,6 +547,11 @@ export const InfiniteEventTypeList = ({
|
||||
onClick={() => {
|
||||
showToast(t("private_link_copied"), "success");
|
||||
navigator.clipboard.writeText(placeholderHashedLink);
|
||||
setPrivateLinkCopyIndices((prev) => {
|
||||
const prevIndex = prev[type.slug] ?? 0;
|
||||
prev[type.slug] = (prevIndex + 1) % type.hashedLink.length;
|
||||
return prev;
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
|
||||
Reference in new issue
Block a user