chore: salesforce for Router / Booker atoms and api v2 (#19217)

* wip

* small refactor

* small refactor

* fixup! Merge branch 'main' into enable-salesforce-router-apiv2-atom

* crm props

* fixup! crm props

* bump platform libraries

* bump platform libraries
This commit is contained in:
Morgan authored and GitHub committed 2025-02-12 15:04:38 +02:00
1 parent 3a29327761
commit 486e3a386e
14 files changed
+241 -122

No files matched your search

@@ -41,6 +41,9 @@ export const BookerEmbed = (
eventTypeSlug,
username,
defaultFormValues,
teamMemberEmail,
crmOwnerRecordType,
crmAppSlug,
...routingFormSearchParams
} = routingFormUrlProps;
const { onDryRunSuccess, ...rest } = props;
@@ -67,6 +70,9 @@ export const BookerEmbed = (
})}
routingFormSearchParams={routingFormSearchParams}
defaultFormValues={defaultFormValues}
teamMemberEmail={teamMemberEmail}
crmOwnerRecordType={crmOwnerRecordType}
crmAppSlug={crmAppSlug}
onDryRunSuccess={() => {
if (onDryRunSuccess) {
onDryRunSuccess();
@@ -81,6 +81,15 @@ export const useGetRoutingFormUrlProps = ({ routingFormUrl }: { routingFormUrl?:
["cal.salesforce.rrSkipToAccountLookupField"]:
routingSearchParams.get("cal.salesforce.rrSkipToAccountLookupField") ?? undefined,
}),
...(routingSearchParams.get("cal.teamMemberEmail") && {
teamMemberEmail: routingSearchParams.get("cal.teamMemberEmail") ?? undefined,
}),
...(routingSearchParams.get("cal.crmOwnerRecordType") && {
crmOwnerRecordType: routingSearchParams.get("cal.crmOwnerRecordType") ?? undefined,
}),
...(routingSearchParams.get("cal.crmAppSlug") && {
crmAppSlug: routingSearchParams.get("cal.crmAppSlug") ?? undefined,
}),
} satisfies RoutingFormSearchParamsForEmbed;
return { ...routingformProps, defaultFormValues };
}
@@ -102,7 +102,14 @@ export type BookerPlatformWrapperAtomPropsForTeam = BookerPlatformWrapperAtomPro
export const BookerPlatformWrapper = (
props: BookerPlatformWrapperAtomPropsForIndividual | BookerPlatformWrapperAtomPropsForTeam
) => {
const { view = "MONTH_VIEW", bannerUrl, routingFormSearchParams } = props;
const {
view = "MONTH_VIEW",
bannerUrl,
routingFormSearchParams,
teamMemberEmail,
crmAppSlug,
crmOwnerRecordType,
} = props;
const layout = BookerLayouts[view];
const { clientId } = useAtomsContext();
@@ -205,6 +212,9 @@ export const BookerPlatformWrapper = (
const bookerLayout = useBookerLayout(event.data);
useInitializeBookerStore({
...props,
teamMemberEmail,
crmAppSlug,
crmOwnerRecordType,
eventId: event.data?.id,
rescheduleUid: props.rescheduleUid ?? null,
bookingUid: props.bookingUid ?? null,
@@ -296,7 +306,6 @@ export const BookerPlatformWrapper = (
...(isBookingDryRun ? { isBookingDryRun } : {}),
});
}, [routingFormSearchParams]);
const schedule = useAvailableSlots({
usernameList: getUsernameList(username),
eventTypeId: event?.data?.id ?? 0,
@@ -305,6 +314,7 @@ export const BookerPlatformWrapper = (
timeZone: timezone,
duration: selectedDuration ?? undefined,
rescheduleUid: props.rescheduleUid,
teamMemberEmail: teamMemberEmail ?? undefined,
...(props.isTeamEvent
? {
isTeamEvent: props.isTeamEvent,
@@ -476,6 +486,9 @@ export const BookerPlatformWrapper = (
return (
<AtomsWrapper customClassName={props?.customClassNames?.atomsWrapper}>
<BookerComponent
teamMemberEmail={teamMemberEmail}
crmAppSlug={crmAppSlug}
crmOwnerRecordType={crmOwnerRecordType}
customClassNames={props.customClassNames}
eventSlug={props.eventSlug}
username={username}
@@ -25,6 +25,7 @@ export const useAvailableSlots = ({
rest.routedTeamMemberIds,
rest.skipContactOwner,
rest.shouldServeCache,
rest.teamMemberEmail,
],
queryFn: () => {
return http
+6
View File
@@ -3,6 +3,9 @@ export type RoutingFormSearchParamsForEmbed = {
teamId?: number;
eventTypeSlug: string;
username?: string;
crmAppSlug?: string;
crmOwnerRecordType?: string;
teamMemberEmail?: string;
} & RoutingFormSearchParams;
export type RoutingFormSearchParams = {
@@ -12,5 +15,8 @@ export type RoutingFormSearchParams = {
["cal.isBookingDryRun"]?: string;
["cal.cache"]?: string;
["cal.routingFormResponseId"]?: string;
["cal.crmAppSlug"]?: string;
["cal.crmOwnerRecordType"]?: string;
["cal.teamMemberEmail"]?: string;
["cal.salesforce.rrSkipToAccountLookupField"]?: string;
};
+5
View File
@@ -124,6 +124,11 @@ export class GetAvailableSlotsInput {
@IsNumber({}, { each: true })
@ApiHideProperty()
routedTeamMemberIds?: number[];
@IsString()
@IsOptional()
@ApiPropertyOptional()
teamMemberEmail?: string;
}
export class RemoveSelectedSlotInput {