@flamingo-stack/openframe-frontend-core 0.0.595 → 0.0.596-2034.5670.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-U4QRK4MX.js → chunk-27U3NNFR.js} +4 -4
- package/dist/{chunk-OGE4GSLZ.cjs → chunk-2EPDTX4M.cjs} +84 -84
- package/dist/{chunk-OGE4GSLZ.cjs.map → chunk-2EPDTX4M.cjs.map} +1 -1
- package/dist/{chunk-BKMSI2AW.js → chunk-2KQO7OMB.js} +2 -2
- package/dist/{chunk-A57HKYLY.js → chunk-2NZKBKO6.js} +6 -6
- package/dist/{chunk-CPWX46TL.cjs → chunk-53HSPYKM.cjs} +6 -6
- package/dist/{chunk-CPWX46TL.cjs.map → chunk-53HSPYKM.cjs.map} +1 -1
- package/dist/{chunk-FHEN27GM.cjs → chunk-5K6GZANU.cjs} +11 -11
- package/dist/{chunk-FHEN27GM.cjs.map → chunk-5K6GZANU.cjs.map} +1 -1
- package/dist/{chunk-23UJ4EBJ.cjs → chunk-7CKSLZT6.cjs} +12 -12
- package/dist/{chunk-23UJ4EBJ.cjs.map → chunk-7CKSLZT6.cjs.map} +1 -1
- package/dist/{chunk-T2JAJ7MR.js → chunk-7YUFH47E.js} +26 -13
- package/dist/chunk-7YUFH47E.js.map +1 -0
- package/dist/{chunk-OWWICTQR.cjs → chunk-AN4CB7U3.cjs} +24 -24
- package/dist/{chunk-OWWICTQR.cjs.map → chunk-AN4CB7U3.cjs.map} +1 -1
- package/dist/{chunk-3WZLPCJ7.js → chunk-BDLFPDAW.js} +4 -4
- package/dist/{chunk-QLJMXCB5.js → chunk-BHIJ5OGK.js} +5 -5
- package/dist/{chunk-AQ65NLGJ.js → chunk-E7MTTLKC.js} +3 -3
- package/dist/{chunk-MUNVPRT2.js → chunk-EVMHJB6X.js} +2 -2
- package/dist/{chunk-MOHSA65M.js → chunk-EZM5DNII.js} +2 -2
- package/dist/{chunk-7N2NJPUK.js → chunk-FPG4S3X4.js} +4 -4
- package/dist/{chunk-HGWC7ABT.cjs → chunk-FUHYCQLO.cjs} +63 -63
- package/dist/{chunk-HGWC7ABT.cjs.map → chunk-FUHYCQLO.cjs.map} +1 -1
- package/dist/{chunk-MHORK6KM.cjs → chunk-IIWB7VEC.cjs} +3 -3
- package/dist/{chunk-MHORK6KM.cjs.map → chunk-IIWB7VEC.cjs.map} +1 -1
- package/dist/{chunk-ZY3Z3F4X.cjs → chunk-IJY6E2YO.cjs} +49 -49
- package/dist/{chunk-ZY3Z3F4X.cjs.map → chunk-IJY6E2YO.cjs.map} +1 -1
- package/dist/{chunk-5EM6NGBK.cjs → chunk-KOQCA5X5.cjs} +17 -27
- package/dist/chunk-KOQCA5X5.cjs.map +1 -0
- package/dist/{chunk-YYHYCQD6.cjs → chunk-L7GNBUXF.cjs} +168 -168
- package/dist/{chunk-YYHYCQD6.cjs.map → chunk-L7GNBUXF.cjs.map} +1 -1
- package/dist/{chunk-A5AKGC4S.js → chunk-LPMDCQLL.js} +17 -27
- package/dist/chunk-LPMDCQLL.js.map +1 -0
- package/dist/{chunk-4ZY5MP46.cjs → chunk-LPWTGNNP.cjs} +15 -15
- package/dist/{chunk-4ZY5MP46.cjs.map → chunk-LPWTGNNP.cjs.map} +1 -1
- package/dist/{chunk-FKXDDJEQ.cjs → chunk-M4YQUHOR.cjs} +5 -5
- package/dist/{chunk-FKXDDJEQ.cjs.map → chunk-M4YQUHOR.cjs.map} +1 -1
- package/dist/{chunk-PYEJL2UG.js → chunk-MOKMFLKB.js} +3 -3
- package/dist/{chunk-ZRXJX3JK.js → chunk-NRGBR3SN.js} +6 -6
- package/dist/{chunk-DYXVQ24Q.js → chunk-ONZCED5F.js} +3 -3
- package/dist/{chunk-UPKN5CYH.js → chunk-P367JZLK.js} +8 -8
- package/dist/{chunk-63PXZXCT.js → chunk-PPY2IRJP.js} +4 -4
- package/dist/{chunk-CZM2H5F5.cjs → chunk-QBXD4KOR.cjs} +5 -5
- package/dist/{chunk-CZM2H5F5.cjs.map → chunk-QBXD4KOR.cjs.map} +1 -1
- package/dist/{chunk-JGDDPNSC.cjs → chunk-QW663C35.cjs} +298 -285
- package/dist/chunk-QW663C35.cjs.map +1 -0
- package/dist/{chunk-6PEFK4UH.cjs → chunk-QX6GS6Y3.cjs} +9 -9
- package/dist/{chunk-6PEFK4UH.cjs.map → chunk-QX6GS6Y3.cjs.map} +1 -1
- package/dist/{chunk-SEVD4AST.js → chunk-RY2MDY6G.js} +7 -7
- package/dist/{chunk-4R6AZFNU.cjs → chunk-SAEJGTCI.cjs} +30 -30
- package/dist/{chunk-4R6AZFNU.cjs.map → chunk-SAEJGTCI.cjs.map} +1 -1
- package/dist/{chunk-TDEQ26A2.js → chunk-UAAXUFK6.js} +1 -1
- package/dist/chunk-UAAXUFK6.js.map +1 -0
- package/dist/{chunk-EO5GYWIX.cjs → chunk-V7SYWH7D.cjs} +40 -40
- package/dist/{chunk-EO5GYWIX.cjs.map → chunk-V7SYWH7D.cjs.map} +1 -1
- package/dist/{chunk-MX7DNV7X.cjs → chunk-VZMA3IUV.cjs} +33 -33
- package/dist/{chunk-MX7DNV7X.cjs.map → chunk-VZMA3IUV.cjs.map} +1 -1
- package/dist/{chunk-NNMAMTA5.js → chunk-WC3M4XJ2.js} +3 -3
- package/dist/{chunk-SK4IVCSI.cjs → chunk-WCBRZCU4.cjs} +1 -1
- package/dist/chunk-WCBRZCU4.cjs.map +1 -0
- package/dist/{chunk-2WLW5HDU.js → chunk-WE4OW4XP.js} +8 -8
- package/dist/{chunk-MDUAU74C.cjs → chunk-WKZ3JYMP.cjs} +28 -28
- package/dist/{chunk-MDUAU74C.cjs.map → chunk-WKZ3JYMP.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +16 -16
- package/dist/components/case-studies/index.js +6 -6
- package/dist/components/chat/index.cjs +4 -4
- package/dist/components/chat/index.js +3 -3
- package/dist/components/contact/index.cjs +7 -7
- package/dist/components/contact/index.js +6 -6
- package/dist/components/docs/index.cjs +10 -10
- package/dist/components/docs/index.js +9 -9
- package/dist/components/embeds/index.cjs +7 -7
- package/dist/components/embeds/index.js +6 -6
- package/dist/components/faq/index.cjs +7 -7
- package/dist/components/faq/index.js +6 -6
- package/dist/components/features/index.cjs +6 -6
- package/dist/components/features/index.js +5 -5
- package/dist/components/help-center-pages/index.cjs +26 -26
- package/dist/components/help-center-pages/index.js +17 -17
- package/dist/components/icons/index.cjs +2 -2
- package/dist/components/icons/index.js +1 -1
- package/dist/components/icons/mlg-logo.d.ts.map +1 -1
- package/dist/components/index.cjs +56 -56
- package/dist/components/index.js +17 -17
- package/dist/components/meeting-scheduler/booking-form.d.ts +70 -6
- package/dist/components/meeting-scheduler/booking-form.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/context-panel.d.ts +9 -1
- package/dist/components/meeting-scheduler/context-panel.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/index.cjs +395 -188
- package/dist/components/meeting-scheduler/index.cjs.map +1 -1
- package/dist/components/meeting-scheduler/index.d.ts +55 -1
- package/dist/components/meeting-scheduler/index.d.ts.map +1 -1
- package/dist/components/meeting-scheduler/index.js +381 -174
- package/dist/components/meeting-scheduler/index.js.map +1 -1
- package/dist/components/meeting-scheduler/slot-picker.d.ts +8 -1
- package/dist/components/meeting-scheduler/slot-picker.d.ts.map +1 -1
- package/dist/components/navigation/index.cjs +9 -9
- package/dist/components/navigation/index.js +8 -8
- package/dist/components/onboarding-guides/index.cjs +9 -9
- package/dist/components/onboarding-guides/index.js +8 -8
- package/dist/components/related-content/index.cjs +3 -3
- package/dist/components/related-content/index.js +2 -2
- package/dist/components/tickets/index.cjs +10 -10
- package/dist/components/tickets/index.js +9 -9
- package/dist/components/ui/benefit-card.d.ts.map +1 -1
- package/dist/components/ui/index.cjs +6 -6
- package/dist/components/ui/index.js +5 -5
- package/dist/hooks/index.cjs +3 -3
- package/dist/hooks/index.js +2 -2
- package/dist/index.cjs +10 -10
- package/dist/index.js +9 -9
- package/dist/schemas/meeting-booking-schema.cjs +19 -4
- package/dist/schemas/meeting-booking-schema.cjs.map +1 -1
- package/dist/schemas/meeting-booking-schema.d.ts +41 -16
- package/dist/schemas/meeting-booking-schema.d.ts.map +1 -1
- package/dist/schemas/meeting-booking-schema.js +19 -5
- package/dist/schemas/meeting-booking-schema.js.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/index.cjs +16 -26
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +16 -26
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/icons/mlg-logo.tsx +1 -7
- package/src/components/meeting-scheduler/booking-form.tsx +425 -154
- package/src/components/meeting-scheduler/context-panel.tsx +13 -3
- package/src/components/meeting-scheduler/index.tsx +317 -69
- package/src/components/meeting-scheduler/slot-picker.tsx +17 -1
- package/src/components/ui/benefit-card.tsx +30 -9
- package/src/schemas/meeting-booking-schema.ts +58 -4
- package/src/types/tmcg.ts +0 -2
- package/src/utils/format.ts +1 -1
- package/dist/chunk-5EM6NGBK.cjs.map +0 -1
- package/dist/chunk-A5AKGC4S.js.map +0 -1
- package/dist/chunk-JGDDPNSC.cjs.map +0 -1
- package/dist/chunk-SK4IVCSI.cjs.map +0 -1
- package/dist/chunk-T2JAJ7MR.js.map +0 -1
- package/dist/chunk-TDEQ26A2.js.map +0 -1
- /package/dist/{chunk-U4QRK4MX.js.map → chunk-27U3NNFR.js.map} +0 -0
- /package/dist/{chunk-BKMSI2AW.js.map → chunk-2KQO7OMB.js.map} +0 -0
- /package/dist/{chunk-A57HKYLY.js.map → chunk-2NZKBKO6.js.map} +0 -0
- /package/dist/{chunk-3WZLPCJ7.js.map → chunk-BDLFPDAW.js.map} +0 -0
- /package/dist/{chunk-QLJMXCB5.js.map → chunk-BHIJ5OGK.js.map} +0 -0
- /package/dist/{chunk-AQ65NLGJ.js.map → chunk-E7MTTLKC.js.map} +0 -0
- /package/dist/{chunk-MUNVPRT2.js.map → chunk-EVMHJB6X.js.map} +0 -0
- /package/dist/{chunk-MOHSA65M.js.map → chunk-EZM5DNII.js.map} +0 -0
- /package/dist/{chunk-7N2NJPUK.js.map → chunk-FPG4S3X4.js.map} +0 -0
- /package/dist/{chunk-PYEJL2UG.js.map → chunk-MOKMFLKB.js.map} +0 -0
- /package/dist/{chunk-ZRXJX3JK.js.map → chunk-NRGBR3SN.js.map} +0 -0
- /package/dist/{chunk-DYXVQ24Q.js.map → chunk-ONZCED5F.js.map} +0 -0
- /package/dist/{chunk-UPKN5CYH.js.map → chunk-P367JZLK.js.map} +0 -0
- /package/dist/{chunk-63PXZXCT.js.map → chunk-PPY2IRJP.js.map} +0 -0
- /package/dist/{chunk-SEVD4AST.js.map → chunk-RY2MDY6G.js.map} +0 -0
- /package/dist/{chunk-NNMAMTA5.js.map → chunk-WC3M4XJ2.js.map} +0 -0
- /package/dist/{chunk-2WLW5HDU.js.map → chunk-WE4OW4XP.js.map} +0 -0
|
@@ -22,13 +22,14 @@ var _chunkO4VZOA2Qcjs = require('../../chunk-O4VZOA2Q.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
var _chunkQW663C35cjs = require('../../chunk-QW663C35.cjs');
|
|
26
27
|
require('../../chunk-GQWM3ECA.cjs');
|
|
27
28
|
require('../../chunk-TON3YCCW.cjs');
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
31
|
-
var
|
|
32
|
+
var _chunkM4YQUHORcjs = require('../../chunk-M4YQUHOR.cjs');
|
|
32
33
|
require('../../chunk-D55IENZJ.cjs');
|
|
33
34
|
require('../../chunk-N6CULJYR.cjs');
|
|
34
35
|
|
|
@@ -42,10 +43,10 @@ var _chunkH64ZHSYRcjs = require('../../chunk-H64ZHSYR.cjs');
|
|
|
42
43
|
var _chunkY7ITKISQcjs = require('../../chunk-Y7ITKISQ.cjs');
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
var
|
|
46
|
+
var _chunkL7GNBUXFcjs = require('../../chunk-L7GNBUXF.cjs');
|
|
46
47
|
require('../../chunk-YXWGSDK4.cjs');
|
|
47
48
|
require('../../chunk-SADRZ4YI.cjs');
|
|
48
|
-
require('../../chunk-
|
|
49
|
+
require('../../chunk-KOQCA5X5.cjs');
|
|
49
50
|
require('../../chunk-GSQM4PDR.cjs');
|
|
50
51
|
require('../../chunk-XQFFGR6U.cjs');
|
|
51
52
|
|
|
@@ -53,7 +54,7 @@ require('../../chunk-XQFFGR6U.cjs');
|
|
|
53
54
|
|
|
54
55
|
|
|
55
56
|
|
|
56
|
-
var
|
|
57
|
+
var _chunkWCBRZCU4cjs = require('../../chunk-WCBRZCU4.cjs');
|
|
57
58
|
require('../../chunk-WLSFBRT5.cjs');
|
|
58
59
|
require('../../chunk-YH6IQTPI.cjs');
|
|
59
60
|
require('../../chunk-63QUMV72.cjs');
|
|
@@ -113,7 +114,7 @@ function isValidBcp47Locale(locale) {
|
|
|
113
114
|
return false;
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
|
-
function
|
|
117
|
+
function buildBookingSchema(formFields, legalConsent, slot) {
|
|
117
118
|
const answers = {};
|
|
118
119
|
for (const field of formFields) {
|
|
119
120
|
if (!isSupportedFormField(field)) continue;
|
|
@@ -150,12 +151,12 @@ function makeBookingSchema(formFields, legalConsent) {
|
|
|
150
151
|
const answersObject = _zod.z.object(answers);
|
|
151
152
|
return _zod.z.object({
|
|
152
153
|
meetingId: _zod.z.string().min(1),
|
|
153
|
-
startTimeMs:
|
|
154
|
-
durationMs:
|
|
154
|
+
startTimeMs: slot.startTimeMs,
|
|
155
|
+
durationMs: slot.durationMs,
|
|
155
156
|
firstName: _zod.z.string().min(1, { message: "First name is required" }).max(255),
|
|
156
157
|
lastName: _zod.z.string().min(1, { message: "Last name is required" }).max(255),
|
|
157
158
|
email: _zod.z.string().email({ message: "Please enter a valid email address" }).max(255),
|
|
158
|
-
timezone:
|
|
159
|
+
timezone: slot.timezone,
|
|
159
160
|
locale: _zod.z.string().refine(isValidBcp47Locale, { message: "Invalid locale" }).optional(),
|
|
160
161
|
// Plain `.optional()` (no `.default()`) so zod's input and output types
|
|
161
162
|
// match — react-hook-form's zodResolver needs them identical, and the
|
|
@@ -177,6 +178,13 @@ function makeBookingSchema(formFields, legalConsent) {
|
|
|
177
178
|
}
|
|
178
179
|
});
|
|
179
180
|
}
|
|
181
|
+
function makeDeferredBookingSchema(formFields, legalConsent) {
|
|
182
|
+
return buildBookingSchema(formFields, legalConsent, {
|
|
183
|
+
startTimeMs: _zod.z.number().int().positive().nullish(),
|
|
184
|
+
durationMs: _zod.z.number().int().positive().nullish(),
|
|
185
|
+
timezone: _zod.z.string().refine(isValidIanaTimezone, { message: "Invalid timezone" }).nullish()
|
|
186
|
+
});
|
|
187
|
+
}
|
|
180
188
|
|
|
181
189
|
// src/hooks/use-meeting-booking.ts
|
|
182
190
|
var AVAILABILITY_STALE_MS = 0;
|
|
@@ -189,7 +197,7 @@ function useMeetingBooking(options) {
|
|
|
189
197
|
const seededOffset = _optionalChain([initialAvailability, 'optionalAccess', _3 => _3.meetingId]) === meetingId ? initialAvailability.monthOffset : void 0;
|
|
190
198
|
const [monthOffset, setMonthOffsetState] = _react.useState.call(void 0, _nullishCoalesce(seededOffset, () => ( 0)));
|
|
191
199
|
const setMonthOffset = _react.useCallback.call(void 0, (offset) => {
|
|
192
|
-
setMonthOffsetState(Math.max(0, Math.min(
|
|
200
|
+
setMonthOffsetState(Math.max(0, Math.min(_chunkQW663C35cjs.MAX_MONTH_OFFSET, offset)));
|
|
193
201
|
}, []);
|
|
194
202
|
const prevMeetingIdRef = _react.useRef.call(void 0, meetingId);
|
|
195
203
|
_react.useLayoutEffect.call(void 0, () => {
|
|
@@ -271,12 +279,25 @@ var _zod3 = require('@hookform/resolvers/zod');
|
|
|
271
279
|
|
|
272
280
|
var _reacthookform = require('react-hook-form');
|
|
273
281
|
var _jsxruntime = require('react/jsx-runtime');
|
|
282
|
+
var SPAN_CLASS = {
|
|
283
|
+
1: "md:col-span-1",
|
|
284
|
+
2: "md:col-span-2",
|
|
285
|
+
3: "md:col-span-3",
|
|
286
|
+
4: "md:col-span-4"
|
|
287
|
+
};
|
|
288
|
+
var evenSpan = (count) => Math.min(4, Math.max(1, Math.floor(4 / Math.max(1, count))));
|
|
274
289
|
function BookingForm({
|
|
275
290
|
availability,
|
|
276
291
|
meetingId,
|
|
277
292
|
startTimeMs,
|
|
278
293
|
durationMs,
|
|
279
294
|
timezone,
|
|
295
|
+
deferSlot = false,
|
|
296
|
+
initialValues,
|
|
297
|
+
submitLabel,
|
|
298
|
+
footerNote,
|
|
299
|
+
fieldRows,
|
|
300
|
+
consent,
|
|
280
301
|
isSubmitting,
|
|
281
302
|
onSubmit,
|
|
282
303
|
honeypotInputProps,
|
|
@@ -284,42 +305,75 @@ function BookingForm({
|
|
|
284
305
|
}) {
|
|
285
306
|
const { formFields, legalConsent } = availability;
|
|
286
307
|
const supportedFields = _react.useMemo.call(void 0, () => formFields.filter(isSupportedFormField), [formFields]);
|
|
287
|
-
const schema = _react.useMemo.call(void 0,
|
|
308
|
+
const schema = _react.useMemo.call(void 0,
|
|
309
|
+
() => makeDeferredBookingSchema(supportedFields, legalConsent),
|
|
310
|
+
[supportedFields, legalConsent]
|
|
311
|
+
);
|
|
312
|
+
const consentDefaults = _react.useMemo.call(void 0,
|
|
313
|
+
() => (_nullishCoalesce(_optionalChain([legalConsent, 'optionalAccess', _5 => _5.communicationConsentCheckboxes]), () => ( []))).map((c) => ({
|
|
314
|
+
communicationTypeId: c.communicationTypeId,
|
|
315
|
+
consented: false
|
|
316
|
+
})),
|
|
317
|
+
[legalConsent]
|
|
318
|
+
);
|
|
288
319
|
const {
|
|
289
320
|
register,
|
|
290
321
|
control,
|
|
291
322
|
handleSubmit,
|
|
323
|
+
setValue,
|
|
292
324
|
formState: { errors }
|
|
293
325
|
} = _reacthookform.useForm.call(void 0, {
|
|
294
326
|
resolver: _zod3.zodResolver.call(void 0, schema),
|
|
295
327
|
defaultValues: {
|
|
296
328
|
meetingId,
|
|
297
|
-
|
|
298
|
-
durationMs,
|
|
329
|
+
// Genuinely OMITTED, not present-as-undefined, when the slot is deferred.
|
|
330
|
+
...deferSlot ? {} : { startTimeMs, durationMs },
|
|
299
331
|
timezone,
|
|
300
332
|
locale: typeof navigator !== "undefined" ? navigator.language : void 0,
|
|
301
333
|
firstName: "",
|
|
302
334
|
lastName: "",
|
|
303
335
|
email: "",
|
|
304
336
|
formFields: {},
|
|
305
|
-
legalConsentResponses:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}))
|
|
337
|
+
legalConsentResponses: consentDefaults,
|
|
338
|
+
// A remount (back edge, or an error return) would otherwise lose every
|
|
339
|
+
// answer — `defaultValues` is snapshotted once and never re-read.
|
|
340
|
+
..._nullishCoalesce(initialValues, () => ( {}))
|
|
309
341
|
}
|
|
310
342
|
});
|
|
311
|
-
const
|
|
312
|
-
|
|
343
|
+
const priorConsents = _optionalChain([initialValues, 'optionalAccess', _6 => _6.legalConsentResponses]);
|
|
344
|
+
const [consented, setConsented] = _react.useState.call(void 0, _optionalChain([initialValues, 'optionalAccess', _7 => _7.hostConsent]) === true);
|
|
345
|
+
const [consentError, setConsentError] = _react.useState.call(void 0, null);
|
|
346
|
+
const consentMissing = Boolean(consent) && !consented;
|
|
347
|
+
_react.useEffect.call(void 0, () => {
|
|
348
|
+
setValue(
|
|
349
|
+
"legalConsentResponses",
|
|
350
|
+
consentDefaults.map((next) => ({
|
|
351
|
+
...next,
|
|
352
|
+
consented: _nullishCoalesce(_optionalChain([priorConsents, 'optionalAccess', _8 => _8.find, 'call', _9 => _9((r) => r.communicationTypeId === next.communicationTypeId), 'optionalAccess', _10 => _10.consented]), () => ( false))
|
|
353
|
+
})),
|
|
354
|
+
{ shouldDirty: false }
|
|
355
|
+
);
|
|
356
|
+
}, [consentDefaults, priorConsents, setValue]);
|
|
357
|
+
const submitValid = handleSubmit(async (data) => {
|
|
358
|
+
if (consentMissing) return;
|
|
359
|
+
if (deferSlot) {
|
|
360
|
+
await onSubmit({ ...data, meetingId, hostConsent: consented });
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
await onSubmit({ ...data, meetingId, hostConsent: consented, startTimeMs, durationMs, timezone, ...getSignals() });
|
|
313
364
|
});
|
|
365
|
+
const submit = (event) => {
|
|
366
|
+
if (consentMissing) setConsentError(_nullishCoalesce(_optionalChain([consent, 'optionalAccess', _11 => _11.errorMessage]), () => ( "Please agree to continue.")));
|
|
367
|
+
return submitValid(event);
|
|
368
|
+
};
|
|
314
369
|
const fieldError = (name) => {
|
|
315
|
-
const err = _optionalChain([errors, 'access',
|
|
316
|
-
return _optionalChain([err, 'optionalAccess',
|
|
370
|
+
const err = _optionalChain([errors, 'access', _12 => _12.formFields, 'optionalAccess', _13 => _13[name]]);
|
|
371
|
+
return _optionalChain([err, 'optionalAccess', _14 => _14.message]);
|
|
317
372
|
};
|
|
318
373
|
const inputClass = "bg-ods-card border-ods-border text-ods-text-primary placeholder-ods-text-secondary px-3 h-11 md:h-12";
|
|
319
374
|
const FORM_STACK = "flex flex-col gap-[var(--spacing-system-l)]";
|
|
320
|
-
|
|
321
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
322
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { label: "Email", htmlFor: "ms-email", error: _optionalChain([errors, 'access', _9 => _9.email, 'optionalAccess', _10 => _10.message]), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
375
|
+
const builtInFields = {
|
|
376
|
+
email: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { label: "Email", htmlFor: "ms-email", error: _optionalChain([errors, 'access', _15 => _15.email, 'optionalAccess', _16 => _16.message]), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
323
377
|
_chunkY7ITKISQcjs.Input,
|
|
324
378
|
{
|
|
325
379
|
id: "ms-email",
|
|
@@ -332,129 +386,210 @@ function BookingForm({
|
|
|
332
386
|
...register("email")
|
|
333
387
|
}
|
|
334
388
|
) }),
|
|
335
|
-
/* @__PURE__ */ _jsxruntime.
|
|
336
|
-
|
|
337
|
-
_chunkY7ITKISQcjs.Input,
|
|
338
|
-
{
|
|
339
|
-
id: "ms-first-name",
|
|
340
|
-
required: true,
|
|
341
|
-
autoComplete: "given-name",
|
|
342
|
-
placeholder: "Jane",
|
|
343
|
-
"aria-invalid": !!errors.firstName,
|
|
344
|
-
className: inputClass,
|
|
345
|
-
...register("firstName")
|
|
346
|
-
}
|
|
347
|
-
) }),
|
|
348
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { label: "Last Name", htmlFor: "ms-last-name", error: _optionalChain([errors, 'access', _13 => _13.lastName, 'optionalAccess', _14 => _14.message]), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
349
|
-
_chunkY7ITKISQcjs.Input,
|
|
350
|
-
{
|
|
351
|
-
id: "ms-last-name",
|
|
352
|
-
required: true,
|
|
353
|
-
autoComplete: "family-name",
|
|
354
|
-
placeholder: "Doe",
|
|
355
|
-
"aria-invalid": !!errors.lastName,
|
|
356
|
-
className: inputClass,
|
|
357
|
-
...register("lastName")
|
|
358
|
-
}
|
|
359
|
-
) })
|
|
360
|
-
] }),
|
|
361
|
-
supportedFields.map((field) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
362
|
-
_chunkY7ITKISQcjs.FieldWrapper,
|
|
389
|
+
firstName: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { label: "First Name", htmlFor: "ms-first-name", error: _optionalChain([errors, 'access', _17 => _17.firstName, 'optionalAccess', _18 => _18.message]), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
390
|
+
_chunkY7ITKISQcjs.Input,
|
|
363
391
|
{
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
392
|
+
id: "ms-first-name",
|
|
393
|
+
required: true,
|
|
394
|
+
autoComplete: "given-name",
|
|
395
|
+
placeholder: "Jane",
|
|
396
|
+
"aria-invalid": !!errors.firstName,
|
|
397
|
+
className: inputClass,
|
|
398
|
+
...register("firstName")
|
|
399
|
+
}
|
|
400
|
+
) }),
|
|
401
|
+
lastName: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { label: "Last Name", htmlFor: "ms-last-name", error: _optionalChain([errors, 'access', _19 => _19.lastName, 'optionalAccess', _20 => _20.message]), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
402
|
+
_chunkY7ITKISQcjs.Input,
|
|
403
|
+
{
|
|
404
|
+
id: "ms-last-name",
|
|
405
|
+
required: true,
|
|
406
|
+
autoComplete: "family-name",
|
|
407
|
+
placeholder: "Doe",
|
|
408
|
+
"aria-invalid": !!errors.lastName,
|
|
409
|
+
className: inputClass,
|
|
410
|
+
...register("lastName")
|
|
411
|
+
}
|
|
412
|
+
) })
|
|
413
|
+
};
|
|
414
|
+
const renderDeclaredField = (field) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { label: field.label, htmlFor: `ms-q-${field.name}`, error: fieldError(field.name), children: [
|
|
415
|
+
field.type === "textarea" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
416
|
+
_chunkQW663C35cjs.Textarea,
|
|
417
|
+
{
|
|
418
|
+
id: `ms-q-${field.name}`,
|
|
419
|
+
className: "border-ods-border bg-ods-card px-3 text-ods-text-primary placeholder-ods-text-secondary",
|
|
420
|
+
...register(`formFields.${field.name}`)
|
|
421
|
+
}
|
|
422
|
+
),
|
|
423
|
+
field.type === "text" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
424
|
+
_chunkY7ITKISQcjs.Input,
|
|
425
|
+
{
|
|
426
|
+
id: `ms-q-${field.name}`,
|
|
427
|
+
className: "h-11 border-ods-border bg-ods-card px-3 text-ods-text-primary placeholder-ods-text-secondary md:h-12",
|
|
428
|
+
...register(`formFields.${field.name}`)
|
|
429
|
+
}
|
|
430
|
+
),
|
|
431
|
+
(field.type === "select" || field.type === "radio") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
432
|
+
_reacthookform.Controller,
|
|
433
|
+
{
|
|
434
|
+
control,
|
|
435
|
+
name: `formFields.${field.name}`,
|
|
436
|
+
render: ({ field: rhf }) => field.type === "select" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkQW663C35cjs.Select, { value: _nullishCoalesce(rhf.value, () => ( "")), onValueChange: rhf.onChange, children: [
|
|
437
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.SelectTrigger, { id: `ms-q-${field.name}`, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.SelectValue, { placeholder: "Select\u2026" }) }),
|
|
438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.SelectContent, { children: (_nullishCoalesce(field.options, () => ( []))).map((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.SelectItem, { value: opt, children: opt }, opt)) })
|
|
439
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.RadioGroup, { value: _nullishCoalesce(rhf.value, () => ( "")), onValueChange: rhf.onChange, children: (_nullishCoalesce(field.options, () => ( []))).map((opt) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-[var(--spacing-system-xs)]", children: [
|
|
440
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.RadioGroupItem, { id: `ms-q-${field.name}-${opt}`, value: opt }),
|
|
441
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCHIHYC7Qcjs.Label, { htmlFor: `ms-q-${field.name}-${opt}`, children: opt })
|
|
442
|
+
] }, opt)) })
|
|
443
|
+
}
|
|
444
|
+
),
|
|
445
|
+
field.type === "checkbox" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
446
|
+
_reacthookform.Controller,
|
|
447
|
+
{
|
|
448
|
+
control,
|
|
449
|
+
name: `formFields.${field.name}`,
|
|
450
|
+
render: ({ field: rhf }) => (
|
|
451
|
+
// The question's Label above already carries the text and
|
|
452
|
+
// binds to this id — a second inline label would double the
|
|
453
|
+
// visible text AND the accessible name.
|
|
454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center gap-[var(--spacing-system-xs)]", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
455
|
+
_chunkY7ITKISQcjs.Checkbox,
|
|
378
456
|
{
|
|
379
457
|
id: `ms-q-${field.name}`,
|
|
380
|
-
|
|
381
|
-
|
|
458
|
+
checked: Boolean(rhf.value),
|
|
459
|
+
onCheckedChange: (v) => rhf.onChange(v === true)
|
|
382
460
|
}
|
|
383
|
-
)
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
461
|
+
) })
|
|
462
|
+
)
|
|
463
|
+
}
|
|
464
|
+
)
|
|
465
|
+
] }, field.name);
|
|
466
|
+
const declaredByName = new Map(supportedFields.map((f) => [f.name, f]));
|
|
467
|
+
const slotResolves = (name) => Boolean(builtInFields[name] || declaredByName.has(name));
|
|
468
|
+
const slotNode = (name) => {
|
|
469
|
+
const builtIn = builtInFields[name];
|
|
470
|
+
if (builtIn) return builtIn;
|
|
471
|
+
const declared = declaredByName.get(name);
|
|
472
|
+
return declared ? renderDeclaredField(declared) : null;
|
|
473
|
+
};
|
|
474
|
+
const unplacedFields = fieldRows ? supportedFields.filter((f) => !fieldRows.some((row) => row.some((slot) => slot.name === f.name))) : [];
|
|
475
|
+
const placedRows = (_nullishCoalesce(fieldRows, () => ( []))).map((row) => row.filter((slot) => slotResolves(slot.name))).filter((row) => row.length > 0);
|
|
476
|
+
const submitButton = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
477
|
+
_chunkCJBSU3XBcjs.Button,
|
|
478
|
+
{
|
|
479
|
+
type: "submit",
|
|
480
|
+
loading: isSubmitting,
|
|
481
|
+
disabled: isSubmitting,
|
|
482
|
+
className: footerNote ? "md:w-60" : void 0,
|
|
483
|
+
children: _nullishCoalesce(submitLabel, () => ( "Confirm Booking"))
|
|
484
|
+
}
|
|
485
|
+
);
|
|
486
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: submit, className: FORM_STACK, noValidate: true, children: [
|
|
487
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.HoneypotField, { ...honeypotInputProps }),
|
|
488
|
+
fieldRows ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
489
|
+
placedRows.map((row, rowIndex) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
490
|
+
"div",
|
|
491
|
+
{
|
|
492
|
+
className: "grid grid-cols-2 gap-[var(--spacing-system-m)] md:grid-cols-4",
|
|
493
|
+
children: row.map((slot) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
494
|
+
"div",
|
|
400
495
|
{
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
//
|
|
405
|
-
//
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
496
|
+
className: _chunk23V5BSHDcjs.cn.call(void 0,
|
|
497
|
+
// A two-field row stays side by side on a phone — the rule
|
|
498
|
+
// the built-in name pair has always followed: two short
|
|
499
|
+
// fields cost one line instead of two on the layout that can
|
|
500
|
+
// least afford them.
|
|
501
|
+
row.length === 2 ? "col-span-1" : "col-span-2",
|
|
502
|
+
SPAN_CLASS[_nullishCoalesce(slot.span, () => ( evenSpan(row.length)))]
|
|
503
|
+
),
|
|
504
|
+
children: slotNode(slot.name)
|
|
505
|
+
},
|
|
506
|
+
slot.name
|
|
507
|
+
))
|
|
508
|
+
},
|
|
509
|
+
row.map((s) => s.name).join("|") || rowIndex
|
|
510
|
+
)),
|
|
511
|
+
unplacedFields.map((field) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: renderDeclaredField(field) }, field.name))
|
|
512
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
513
|
+
builtInFields.email,
|
|
514
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-2 gap-[var(--spacing-system-m)]", children: [
|
|
515
|
+
builtInFields.firstName,
|
|
516
|
+
builtInFields.lastName
|
|
517
|
+
] }),
|
|
518
|
+
supportedFields.map((field) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Fragment, { children: renderDeclaredField(field) }, field.name))
|
|
519
|
+
] }),
|
|
520
|
+
consent && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
521
|
+
_chunkQW663C35cjs.CheckboxBlock,
|
|
522
|
+
{
|
|
523
|
+
id: "ms-host-consent",
|
|
524
|
+
checked: consented,
|
|
525
|
+
onCheckedChange: (v) => {
|
|
526
|
+
setConsented(v);
|
|
527
|
+
if (v) setConsentError(null);
|
|
528
|
+
},
|
|
529
|
+
disabled: isSubmitting,
|
|
530
|
+
error: _nullishCoalesce(consentError, () => ( void 0)),
|
|
531
|
+
label: consent.label,
|
|
532
|
+
description: consent.description
|
|
533
|
+
}
|
|
534
|
+
),
|
|
422
535
|
legalConsent && // Same out-of-flow message as the fields above, so a missed consent
|
|
423
536
|
// box doesn't shove the submit button down the card. With no error the
|
|
424
537
|
// wrapper is `display:contents` and the panel below is the flex item,
|
|
425
538
|
// exactly as it was.
|
|
426
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { error: _optionalChain([errors, 'access',
|
|
427
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: legalConsent.processingConsentText }),
|
|
428
|
-
legalConsent.communicationConsentText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: legalConsent.communicationConsentText }),
|
|
539
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkY7ITKISQcjs.FieldWrapper, { error: _optionalChain([errors, 'access', _21 => _21.legalConsentResponses, 'optionalAccess', _22 => _22.message]), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-[var(--spacing-system-xs)]", children: [
|
|
429
540
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
430
541
|
_reacthookform.Controller,
|
|
431
542
|
{
|
|
432
543
|
control,
|
|
433
544
|
name: "legalConsentResponses",
|
|
434
|
-
render: ({ field: rhf }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: legalConsent.communicationConsentCheckboxes.map((box) => {
|
|
545
|
+
render: ({ field: rhf }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: legalConsent.communicationConsentCheckboxes.map((box, index) => {
|
|
435
546
|
const responses = _nullishCoalesce(rhf.value, () => ( []));
|
|
436
547
|
const current = responses.find((r) => r.communicationTypeId === box.communicationTypeId);
|
|
437
|
-
return
|
|
548
|
+
return (
|
|
549
|
+
// The design system's consent row (`checkbox-block`, the
|
|
550
|
+
// same block the waitlist form uses): box, label, caption
|
|
551
|
+
// in one bordered row. GDPR surface — HubSpot's copy is
|
|
552
|
+
// rendered VERBATIM, never edited. The processing statement
|
|
553
|
+
// rides as the caption of the FIRST row, once: it describes
|
|
554
|
+
// the consent as a whole, not each channel.
|
|
438
555
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
439
|
-
|
|
556
|
+
_chunkQW663C35cjs.CheckboxBlock,
|
|
440
557
|
{
|
|
441
558
|
id: `ms-consent-${box.communicationTypeId}`,
|
|
442
|
-
checked: _nullishCoalesce(_optionalChain([current, 'optionalAccess',
|
|
559
|
+
checked: _nullishCoalesce(_optionalChain([current, 'optionalAccess', _23 => _23.consented]), () => ( false)),
|
|
443
560
|
onCheckedChange: (v) => rhf.onChange(
|
|
444
561
|
responses.map(
|
|
445
|
-
(r) => r.communicationTypeId === box.communicationTypeId ? { ...r, consented: v
|
|
562
|
+
(r) => r.communicationTypeId === box.communicationTypeId ? { ...r, consented: v } : r
|
|
446
563
|
)
|
|
447
|
-
)
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
564
|
+
),
|
|
565
|
+
label: box.label,
|
|
566
|
+
description: index === 0 ? legalConsent.processingConsentText : void 0
|
|
567
|
+
},
|
|
568
|
+
box.communicationTypeId
|
|
569
|
+
)
|
|
570
|
+
);
|
|
452
571
|
}) })
|
|
453
572
|
}
|
|
454
573
|
),
|
|
574
|
+
legalConsent.communicationConsentText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: legalConsent.communicationConsentText }),
|
|
455
575
|
legalConsent.privacyPolicyText && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: legalConsent.privacyPolicyText })
|
|
456
576
|
] }) }),
|
|
457
|
-
/* @__PURE__ */ _jsxruntime.
|
|
577
|
+
footerNote ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center justify-between gap-[var(--spacing-system-m)]", children: [
|
|
578
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: footerNote }),
|
|
579
|
+
submitButton
|
|
580
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex", children: submitButton })
|
|
581
|
+
] });
|
|
582
|
+
}
|
|
583
|
+
function BookingFormSkeleton() {
|
|
584
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-1 flex-col gap-[var(--spacing-system-l)] p-[var(--spacing-system-l)] lg:p-0", children: [
|
|
585
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "grid grid-cols-1 gap-[var(--spacing-system-m)] md:grid-cols-2", children: [
|
|
586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCHIHYC7Qcjs.Skeleton, { className: "h-[4.75rem] w-full" }),
|
|
587
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCHIHYC7Qcjs.Skeleton, { className: "h-[4.75rem] w-full" })
|
|
588
|
+
] }),
|
|
589
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCHIHYC7Qcjs.Skeleton, { className: "h-[4.75rem] w-full" }),
|
|
590
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCHIHYC7Qcjs.Skeleton, { className: "h-[7.75rem] w-full" }),
|
|
591
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCHIHYC7Qcjs.Skeleton, { className: "h-[4.25rem] w-full" }),
|
|
592
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex justify-end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCHIHYC7Qcjs.Skeleton, { className: "h-12 w-40" }) })
|
|
458
593
|
] });
|
|
459
594
|
}
|
|
460
595
|
|
|
@@ -477,7 +612,7 @@ function Confirmation({ confirmation, timezone }) {
|
|
|
477
612
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: [
|
|
478
613
|
when,
|
|
479
614
|
" \xB7 ",
|
|
480
|
-
|
|
615
|
+
_chunkWCBRZCU4cjs.formatDurationCompact.call(void 0, confirmation.durationMs / 1e3)
|
|
481
616
|
] }),
|
|
482
617
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: "A calendar invite is on its way to your email." })
|
|
483
618
|
] });
|
|
@@ -499,7 +634,7 @@ function zoneLabel(tz) {
|
|
|
499
634
|
timeZone: tz,
|
|
500
635
|
timeZoneName: "shortOffset"
|
|
501
636
|
}).formatToParts(/* @__PURE__ */ new Date());
|
|
502
|
-
const offset = _nullishCoalesce(_optionalChain([parts, 'access',
|
|
637
|
+
const offset = _nullishCoalesce(_optionalChain([parts, 'access', _24 => _24.find, 'call', _25 => _25((p) => p.type === "timeZoneName"), 'optionalAccess', _26 => _26.value]), () => ( ""));
|
|
503
638
|
return offset ? `${tz.replace(/_/g, " ")} (${offset})` : tz.replace(/_/g, " ");
|
|
504
639
|
} catch (e4) {
|
|
505
640
|
return tz.replace(/_/g, " ");
|
|
@@ -511,7 +646,7 @@ function ContextPanelSkeleton({
|
|
|
511
646
|
backLabel = "Back"
|
|
512
647
|
}) {
|
|
513
648
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, PANEL_STACK, className), children: [
|
|
514
|
-
onBack && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
649
|
+
onBack && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.BackButton, { label: backLabel, onClick: onBack, className: BACK_BUTTON_CLASS }),
|
|
515
650
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: STRIP_BODY, children: [
|
|
516
651
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: STRIP_MAIN, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: IDENTITY_ROW, children: [
|
|
517
652
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex min-w-0 flex-1 items-center gap-[var(--spacing-system-xs)] lg:flex-none", children: [
|
|
@@ -542,6 +677,7 @@ function SchedulerContextPanel({
|
|
|
542
677
|
onBack,
|
|
543
678
|
backLabel = "Back",
|
|
544
679
|
locked = false,
|
|
680
|
+
fixedDuration = false,
|
|
545
681
|
showTimezone = true,
|
|
546
682
|
className
|
|
547
683
|
}) {
|
|
@@ -558,13 +694,13 @@ function SchedulerContextPanel({
|
|
|
558
694
|
return zones.map((tz) => ({ value: tz, label: zoneLabel(tz) }));
|
|
559
695
|
}, [timezone]);
|
|
560
696
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, PANEL_STACK, className), children: [
|
|
561
|
-
onBack && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
697
|
+
onBack && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.BackButton, { label: backLabel, onClick: onBack, className: BACK_BUTTON_CLASS }),
|
|
562
698
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: STRIP_BODY, children: [
|
|
563
699
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: STRIP_MAIN, children: [
|
|
564
700
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: IDENTITY_ROW, children: [
|
|
565
701
|
hosts.length > 0 && hosts.length <= 3 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-col gap-[var(--spacing-system-s)]", children: hosts.map((host) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-[var(--spacing-system-xs)]", children: [
|
|
566
702
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
567
|
-
|
|
703
|
+
_chunkWCBRZCU4cjs.SquareAvatar,
|
|
568
704
|
{
|
|
569
705
|
variant: "round",
|
|
570
706
|
size: "sm",
|
|
@@ -579,24 +715,25 @@ function SchedulerContextPanel({
|
|
|
579
715
|
] })
|
|
580
716
|
] }, host.name)) }),
|
|
581
717
|
hosts.length > 3 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-[var(--spacing-system-xs)]", children: [
|
|
582
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
718
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWCBRZCU4cjs.AvatarStack, { people: hosts, max: 4, size: "lg" }),
|
|
583
719
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: [
|
|
584
720
|
hosts.length,
|
|
585
721
|
" hosts on this calendar"
|
|
586
722
|
] })
|
|
587
723
|
] }),
|
|
588
|
-
locked || durationsMs.length <= 1 ? (
|
|
589
|
-
// Post-selection, or a link that offers one
|
|
724
|
+
locked || fixedDuration || durationsMs.length <= 1 ? (
|
|
725
|
+
// Post-selection, a fixed-length flow, or a link that offers one
|
|
726
|
+
// length: a static line,
|
|
590
727
|
// which is what sits beside the host on the header-strip layouts.
|
|
591
728
|
selectedDurationMs != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "shrink-0 text-ods-text-secondary text-h6", children: [
|
|
592
|
-
|
|
729
|
+
_chunkWCBRZCU4cjs.formatDurationCompact.call(void 0, selectedDurationMs / 1e3),
|
|
593
730
|
" call"
|
|
594
731
|
] })
|
|
595
732
|
) : null
|
|
596
733
|
] }),
|
|
597
734
|
title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-primary text-h3", children: title }),
|
|
598
735
|
description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: description }),
|
|
599
|
-
!locked && durationsMs.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-[var(--spacing-system-xxs)]", children: [
|
|
736
|
+
!locked && !fixedDuration && durationsMs.length > 1 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-[var(--spacing-system-xxs)]", children: [
|
|
600
737
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: FIELD_LABEL_CLASS, children: "Duration" }),
|
|
601
738
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex flex-wrap gap-[var(--spacing-system-xs)]", children: durationsMs.map((ms) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
602
739
|
_chunkCJBSU3XBcjs.Button,
|
|
@@ -604,7 +741,7 @@ function SchedulerContextPanel({
|
|
|
604
741
|
variant: selectedDurationMs === ms ? void 0 : "outline",
|
|
605
742
|
size: "small-legacy",
|
|
606
743
|
onClick: () => onSelectDuration(ms),
|
|
607
|
-
children:
|
|
744
|
+
children: _chunkWCBRZCU4cjs.formatDurationCompact.call(void 0, ms / 1e3)
|
|
608
745
|
},
|
|
609
746
|
ms
|
|
610
747
|
)) })
|
|
@@ -619,11 +756,11 @@ function SchedulerContextPanel({
|
|
|
619
756
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, STRIP_ASIDE, locked && "max-lg:hidden"), children: [
|
|
620
757
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: FIELD_LABEL_CLASS, children: "Timezone" }),
|
|
621
758
|
timezone ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
622
|
-
|
|
759
|
+
_chunkQW663C35cjs.Autocomplete,
|
|
623
760
|
{
|
|
624
761
|
value: timezone,
|
|
625
762
|
onChange: (tz) => {
|
|
626
|
-
if (tz) _optionalChain([onTimezoneChange, 'optionalCall',
|
|
763
|
+
if (tz) _optionalChain([onTimezoneChange, 'optionalCall', _27 => _27(tz)]);
|
|
627
764
|
},
|
|
628
765
|
options: zoneOptions,
|
|
629
766
|
placeholder: "Search timezone\u2026",
|
|
@@ -705,18 +842,18 @@ var NOOP = () => void 0;
|
|
|
705
842
|
function DayCalendar({ monthOffset, onMonthOffsetChange, selectedDay, onSelectDay, slotsByDay }) {
|
|
706
843
|
const now = /* @__PURE__ */ new Date();
|
|
707
844
|
const startMonth = new Date(now.getFullYear(), now.getMonth(), 1);
|
|
708
|
-
const endMonth = new Date(now.getFullYear(), now.getMonth() +
|
|
845
|
+
const endMonth = new Date(now.getFullYear(), now.getMonth() + _chunkQW663C35cjs.MAX_MONTH_OFFSET + 1, 0);
|
|
709
846
|
const visibleMonth = new Date(now.getFullYear(), now.getMonth() + monthOffset, 1);
|
|
710
|
-
const dayHasNoSlots = _react.useCallback.call(void 0, (day) => !_optionalChain([slotsByDay, 'optionalAccess',
|
|
847
|
+
const dayHasNoSlots = _react.useCallback.call(void 0, (day) => !_optionalChain([slotsByDay, 'optionalAccess', _28 => _28.has, 'call', _29 => _29(calendarDayKey(day))]), [slotsByDay]);
|
|
711
848
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex min-h-0 flex-1 flex-col", "aria-busy": slotsByDay === null, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
712
|
-
|
|
849
|
+
_chunkQW663C35cjs.DatePickerCalendar,
|
|
713
850
|
{
|
|
714
851
|
mode: "single",
|
|
715
852
|
bare: true,
|
|
716
853
|
month: visibleMonth,
|
|
717
854
|
onMonthChange: (month) => {
|
|
718
855
|
const offset = (month.getFullYear() - now.getFullYear()) * 12 + (month.getMonth() - now.getMonth());
|
|
719
|
-
onMonthOffsetChange(Math.max(0, Math.min(
|
|
856
|
+
onMonthOffsetChange(Math.max(0, Math.min(_chunkQW663C35cjs.MAX_MONTH_OFFSET, offset)));
|
|
720
857
|
},
|
|
721
858
|
fromDate: startMonth,
|
|
722
859
|
toDate: endMonth,
|
|
@@ -725,7 +862,7 @@ function DayCalendar({ monthOffset, onMonthOffsetChange, selectedDay, onSelectDa
|
|
|
725
862
|
const day = value;
|
|
726
863
|
if (!day) return;
|
|
727
864
|
const key = calendarDayKey(day);
|
|
728
|
-
if (_optionalChain([slotsByDay, 'optionalAccess',
|
|
865
|
+
if (_optionalChain([slotsByDay, 'optionalAccess', _30 => _30.has, 'call', _31 => _31(key)])) onSelectDay(key);
|
|
729
866
|
},
|
|
730
867
|
disabledDays: slotsByDay === null ? DISABLE_EVERY_DAY : dayHasNoSlots
|
|
731
868
|
}
|
|
@@ -767,7 +904,8 @@ function SlotPicker({
|
|
|
767
904
|
onSelectSlot,
|
|
768
905
|
selectedDay,
|
|
769
906
|
onSelectDay,
|
|
770
|
-
isLoading = false
|
|
907
|
+
isLoading = false,
|
|
908
|
+
isSubmitting = false
|
|
771
909
|
}) {
|
|
772
910
|
const slotsByDay = _react.useMemo.call(void 0, () => {
|
|
773
911
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -813,7 +951,12 @@ function SlotPicker({
|
|
|
813
951
|
_chunkCJBSU3XBcjs.Button,
|
|
814
952
|
{
|
|
815
953
|
variant: isSelected ? void 0 : "outline",
|
|
816
|
-
|
|
954
|
+
disabled: isSubmitting,
|
|
955
|
+
loading: isSubmitting && isSelected,
|
|
956
|
+
onClick: () => {
|
|
957
|
+
if (isSubmitting) return;
|
|
958
|
+
onSelectSlot(ms);
|
|
959
|
+
},
|
|
817
960
|
className: CHIP_CLASS,
|
|
818
961
|
children: timeLabelInZone(ms, timezone)
|
|
819
962
|
},
|
|
@@ -830,7 +973,7 @@ function SlotPicker({
|
|
|
830
973
|
monthLabelFor(monthOffset),
|
|
831
974
|
"."
|
|
832
975
|
] }),
|
|
833
|
-
monthOffset <
|
|
976
|
+
monthOffset < _chunkQW663C35cjs.MAX_MONTH_OFFSET && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
834
977
|
_chunkCJBSU3XBcjs.Button,
|
|
835
978
|
{
|
|
836
979
|
variant: "outline",
|
|
@@ -852,7 +995,7 @@ function SlotPicker({
|
|
|
852
995
|
|
|
853
996
|
|
|
854
997
|
function useNextAvailableLabel(ms) {
|
|
855
|
-
const hydrated =
|
|
998
|
+
const hydrated = _chunkL7GNBUXFcjs.useIsHydrated.call(void 0, );
|
|
856
999
|
return _react.useMemo.call(void 0, () => {
|
|
857
1000
|
if (!hydrated || ms == null) return null;
|
|
858
1001
|
try {
|
|
@@ -876,7 +1019,7 @@ function DirectoryRow({
|
|
|
876
1019
|
const nextLabel = useNextAvailableLabel(link.nextAvailableMs);
|
|
877
1020
|
const subtitle = [
|
|
878
1021
|
link.description,
|
|
879
|
-
link.durationsMinutes.length > 0 ? link.durationsMinutes.map((m) =>
|
|
1022
|
+
link.durationsMinutes.length > 0 ? link.durationsMinutes.map((m) => _chunkWCBRZCU4cjs.formatDurationCompact.call(void 0, m * 60)).join(" / ") : null,
|
|
880
1023
|
link.kind === "team" ? "Team" : null
|
|
881
1024
|
].filter(Boolean).join(" \u2022 ");
|
|
882
1025
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -890,8 +1033,8 @@ function DirectoryRow({
|
|
|
890
1033
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "truncate text-ods-text-primary text-h3", children: link.title }),
|
|
891
1034
|
subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "truncate text-ods-text-secondary text-h6", children: subtitle })
|
|
892
1035
|
] }),
|
|
893
|
-
audienceLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
894
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1036
|
+
audienceLabel && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWCBRZCU4cjs.StatusBadge, { text: `For ${audienceLabel}`, singleLine: true, className: "hidden shrink-0 sm:inline-flex" }),
|
|
1037
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWCBRZCU4cjs.AvatarStack, { people: link.hosts, max: 3, size: "md", className: "flex shrink-0" }),
|
|
895
1038
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "hidden w-44 shrink-0 flex-col items-end justify-center md:flex", children: [
|
|
896
1039
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: "Next available" }),
|
|
897
1040
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "min-h-5 text-ods-text-primary text-h6", children: link.nextAvailableMs == null ? "No times published" : _nullishCoalesce(nextLabel, () => ( " ")) })
|
|
@@ -957,7 +1100,7 @@ function MeetingSchedulerDirectory({
|
|
|
957
1100
|
};
|
|
958
1101
|
}, [initialData, includeAll, apiBaseUrl]);
|
|
959
1102
|
const rows = _react.useMemo.call(void 0, () => {
|
|
960
|
-
const purposes = _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1103
|
+
const purposes = _nullishCoalesce(_optionalChain([data, 'optionalAccess', _32 => _32.purposes]), () => ( []));
|
|
961
1104
|
return purposes.flatMap((p) => p.links.map((link) => ({ link, audienceLabel: p.label })));
|
|
962
1105
|
}, [data]);
|
|
963
1106
|
const totalPages = _chunkH64ZHSYRcjs.pageCount.call(void 0, rows.length, pageSize);
|
|
@@ -1019,16 +1162,18 @@ var CONTEXT_PANEL_CLASS = "p-[var(--spacing-system-l)] shrink-0 lg:w-[280px] bor
|
|
|
1019
1162
|
var ACTION_PANEL_CLASS = "flex-1 min-w-0 flex flex-col md:min-h-0 lg:p-[var(--spacing-system-l)]";
|
|
1020
1163
|
var PANEL_STEP_CLASS = "p-[var(--spacing-system-l)] md:min-h-0 md:overflow-y-auto lg:p-0";
|
|
1021
1164
|
var MEETING_SCHEDULER_H = "md:h-[34.375rem] lg:h-[23.75rem]";
|
|
1165
|
+
var MEETING_SCHEDULER_DETAILS_FIRST_H = "md:h-[39.875rem]";
|
|
1022
1166
|
var CARD_CLASS = _chunk23V5BSHDcjs.cn.call(void 0,
|
|
1023
1167
|
"overflow-hidden rounded-md border border-ods-border bg-ods-card",
|
|
1024
|
-
"md:flex md:flex-col"
|
|
1025
|
-
|
|
1168
|
+
"md:flex md:flex-col"
|
|
1169
|
+
// The height is NOT baked in any more: it is chosen per flow at each render
|
|
1170
|
+
// site (`flowHeight`), because details-first needs a taller box and both
|
|
1171
|
+
// constants are module scope.
|
|
1026
1172
|
);
|
|
1027
1173
|
var CARD_INNER_CLASS = "flex flex-col md:min-h-0 md:flex-1 lg:h-full lg:flex-row";
|
|
1028
1174
|
var CARD_DEGRADED_CLASS = _chunk23V5BSHDcjs.cn.call(void 0,
|
|
1029
1175
|
"flex flex-col items-start gap-[var(--spacing-system-m)] rounded-md border border-ods-border bg-ods-card p-[var(--spacing-system-lf)]",
|
|
1030
|
-
"md:justify-center md:overflow-y-auto"
|
|
1031
|
-
MEETING_SCHEDULER_H
|
|
1176
|
+
"md:justify-center md:overflow-y-auto"
|
|
1032
1177
|
);
|
|
1033
1178
|
function isNativelyBookable(availability) {
|
|
1034
1179
|
if (!availability.formFields.every(isSupportedFormField)) return false;
|
|
@@ -1050,7 +1195,9 @@ function HubSpotMeetingScheduler({
|
|
|
1050
1195
|
fallbackUrl,
|
|
1051
1196
|
onBack,
|
|
1052
1197
|
onBooked,
|
|
1053
|
-
className
|
|
1198
|
+
className,
|
|
1199
|
+
flow = "slot-first",
|
|
1200
|
+
detailsForm: DetailsForm = BookingForm
|
|
1054
1201
|
}) {
|
|
1055
1202
|
const {
|
|
1056
1203
|
availability,
|
|
@@ -1063,7 +1210,8 @@ function HubSpotMeetingScheduler({
|
|
|
1063
1210
|
book,
|
|
1064
1211
|
isSubmitting
|
|
1065
1212
|
} = useMeetingBooking({ meetingId, apiBaseUrl, initialAvailability });
|
|
1066
|
-
const
|
|
1213
|
+
const detailsFirst = flow === "details-first";
|
|
1214
|
+
const hydrated = _chunkL7GNBUXFcjs.useIsHydrated.call(void 0, );
|
|
1067
1215
|
const [pickedTimezone, setTimezone] = _react.useState.call(void 0, null);
|
|
1068
1216
|
const resolvedLocalTimezone = _react.useMemo.call(void 0, () => {
|
|
1069
1217
|
if (!hydrated) return null;
|
|
@@ -1074,30 +1222,33 @@ function HubSpotMeetingScheduler({
|
|
|
1074
1222
|
}
|
|
1075
1223
|
}, [hydrated]);
|
|
1076
1224
|
const timezone = _nullishCoalesce(_nullishCoalesce(pickedTimezone, () => ( displayTimezone)), () => ( resolvedLocalTimezone));
|
|
1077
|
-
const [step, setStep] = _react.useState.call(void 0, "slot");
|
|
1225
|
+
const [step, setStep] = _react.useState.call(void 0, detailsFirst ? "details" : "slot");
|
|
1226
|
+
const [stash, setStash] = _react.useState.call(void 0, null);
|
|
1227
|
+
const formOnly = detailsFirst && step === "details";
|
|
1078
1228
|
const [pickedDurationMs, setDurationMs] = _react.useState.call(void 0, null);
|
|
1079
1229
|
const [pickedDay, setSelectedDay] = _react.useState.call(void 0, null);
|
|
1080
1230
|
const [selectedSlot, setSelectedSlot] = _react.useState.call(void 0, null);
|
|
1081
1231
|
const [confirmation, setConfirmation] = _react.useState.call(void 0, null);
|
|
1082
1232
|
const [bookingError, setBookingError] = _react.useState.call(void 0, null);
|
|
1083
|
-
const { honeypotInputProps, getSignals, resetSignals } =
|
|
1084
|
-
const { toast } =
|
|
1233
|
+
const { honeypotInputProps, getSignals, resetSignals } = _chunkM4YQUHORcjs.useHumanitySignals.call(void 0, );
|
|
1234
|
+
const { toast } = _chunkM4YQUHORcjs.useToast.call(void 0, );
|
|
1085
1235
|
const autoAdvanceCount = _react.useRef.call(void 0, 0);
|
|
1086
1236
|
const [machineFor, setMachineFor] = _react.useState.call(void 0, meetingId);
|
|
1087
1237
|
if (machineFor !== meetingId) {
|
|
1088
1238
|
setMachineFor(meetingId);
|
|
1089
|
-
setStep("slot");
|
|
1239
|
+
setStep(detailsFirst ? "details" : "slot");
|
|
1090
1240
|
setDurationMs(null);
|
|
1091
1241
|
setSelectedDay(null);
|
|
1092
1242
|
setSelectedSlot(null);
|
|
1093
1243
|
setConfirmation(null);
|
|
1094
1244
|
setBookingError(null);
|
|
1245
|
+
setStash(null);
|
|
1095
1246
|
}
|
|
1096
1247
|
_react.useEffect.call(void 0, () => {
|
|
1097
1248
|
autoAdvanceCount.current = 0;
|
|
1098
1249
|
}, [meetingId]);
|
|
1099
|
-
const durations = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([availability, 'optionalAccess',
|
|
1100
|
-
const shownHosts = _nullishCoalesce(_nullishCoalesce(hosts, () => ( _optionalChain([availability, 'optionalAccess',
|
|
1250
|
+
const durations = _react.useMemo.call(void 0, () => _nullishCoalesce(_optionalChain([availability, 'optionalAccess', _33 => _33.durationsMs]), () => ( [])), [_optionalChain([availability, 'optionalAccess', _34 => _34.durationsMs])]);
|
|
1251
|
+
const shownHosts = _nullishCoalesce(_nullishCoalesce(hosts, () => ( _optionalChain([availability, 'optionalAccess', _35 => _35.hosts]))), () => ( []));
|
|
1101
1252
|
const durationMs = _nullishCoalesce(_nullishCoalesce(pickedDurationMs, () => ( durations[0])), () => ( null));
|
|
1102
1253
|
const slots = _react.useMemo.call(void 0, () => {
|
|
1103
1254
|
if (!availability || durationMs == null) return [];
|
|
@@ -1126,14 +1277,34 @@ function HubSpotMeetingScheduler({
|
|
|
1126
1277
|
setStep("slot");
|
|
1127
1278
|
setBookingError(null);
|
|
1128
1279
|
}, []);
|
|
1280
|
+
const backToDetails = _react.useCallback.call(void 0, () => {
|
|
1281
|
+
setStep("details");
|
|
1282
|
+
setBookingError(null);
|
|
1283
|
+
}, []);
|
|
1284
|
+
const stashDetails = _react.useCallback.call(void 0,
|
|
1285
|
+
(payload) => {
|
|
1286
|
+
setBookingError(null);
|
|
1287
|
+
setStash({ payload, signals: getSignals() });
|
|
1288
|
+
setStep("slot");
|
|
1289
|
+
autoAdvanceCount.current = 0;
|
|
1290
|
+
void refetchAvailability();
|
|
1291
|
+
return Promise.resolve();
|
|
1292
|
+
},
|
|
1293
|
+
[getSignals, refetchAvailability]
|
|
1294
|
+
);
|
|
1129
1295
|
const handleSubmit = _react.useCallback.call(void 0,
|
|
1130
1296
|
async (payload) => {
|
|
1297
|
+
const priorError = bookingError;
|
|
1131
1298
|
setBookingError(null);
|
|
1132
1299
|
const result = await book(payload);
|
|
1300
|
+
if (!result.ok && result.message === "Already submitting") {
|
|
1301
|
+
setBookingError(priorError);
|
|
1302
|
+
return;
|
|
1303
|
+
}
|
|
1133
1304
|
if (result.ok && result.confirmation) {
|
|
1134
1305
|
setConfirmation(result.confirmation);
|
|
1135
1306
|
setStep("confirmed");
|
|
1136
|
-
_optionalChain([onBooked, 'optionalCall',
|
|
1307
|
+
_optionalChain([onBooked, 'optionalCall', _36 => _36(result.confirmation)]);
|
|
1137
1308
|
return;
|
|
1138
1309
|
}
|
|
1139
1310
|
const code = _nullishCoalesce(result.code, () => ( "TEMPORARILY_UNAVAILABLE"));
|
|
@@ -1141,8 +1312,10 @@ function HubSpotMeetingScheduler({
|
|
|
1141
1312
|
if (code === "SLOT_TAKEN") {
|
|
1142
1313
|
setSelectedSlot(null);
|
|
1143
1314
|
setStep("slot");
|
|
1144
|
-
resetSignals();
|
|
1315
|
+
if (!detailsFirst) resetSignals();
|
|
1145
1316
|
void refetchAvailability();
|
|
1317
|
+
} else if (detailsFirst && (code === "VALIDATION" || code === "INVALID_EMAIL")) {
|
|
1318
|
+
setStep("details");
|
|
1146
1319
|
} else {
|
|
1147
1320
|
toast({
|
|
1148
1321
|
variant: "error",
|
|
@@ -1151,29 +1324,31 @@ function HubSpotMeetingScheduler({
|
|
|
1151
1324
|
});
|
|
1152
1325
|
}
|
|
1153
1326
|
},
|
|
1154
|
-
[book, onBooked, refetchAvailability, resetSignals, toast]
|
|
1327
|
+
[book, bookingError, detailsFirst, onBooked, refetchAvailability, resetSignals, toast]
|
|
1155
1328
|
);
|
|
1156
1329
|
const escapeHatch = fallbackUrl ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkCJBSU3XBcjs.Button, { variant: "outline", size: "small-legacy", href: fallbackUrl, openInNewTab: true, children: "Open in HubSpot" }) : null;
|
|
1330
|
+
const flowHeight = detailsFirst ? MEETING_SCHEDULER_DETAILS_FIRST_H : MEETING_SCHEDULER_H;
|
|
1331
|
+
const unseededDetailsFirstFailure = detailsFirst && step === "details" && !availability && !initialAvailability && !hydrated;
|
|
1332
|
+
const degradedCard = /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_DEGRADED_CLASS, flowHeight, className), children: [
|
|
1333
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: "We couldn't load available call times. Please try again shortly." }),
|
|
1334
|
+
escapeHatch
|
|
1335
|
+
] });
|
|
1336
|
+
if (unseededDetailsFirstFailure) return degradedCard;
|
|
1157
1337
|
if (isLoadingAvailability && !availability) {
|
|
1158
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_CLASS, className), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: CARD_INNER_CLASS, children: [
|
|
1159
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContextPanelSkeleton, { onBack, className: CONTEXT_PANEL_CLASS }),
|
|
1160
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: ACTION_PANEL_CLASS, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SlotPickerSkeleton, { monthOffset }) })
|
|
1338
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_CLASS, flowHeight, formOnly && "bg-ods-bg", className), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: CARD_INNER_CLASS, children: [
|
|
1339
|
+
!formOnly && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContextPanelSkeleton, { onBack, className: CONTEXT_PANEL_CLASS }),
|
|
1340
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: ACTION_PANEL_CLASS, children: detailsFirst && step === "details" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BookingFormSkeleton, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, SlotPickerSkeleton, { monthOffset }) })
|
|
1161
1341
|
] }) });
|
|
1162
1342
|
}
|
|
1163
|
-
if (availabilityError || !availability)
|
|
1164
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_DEGRADED_CLASS, className), children: [
|
|
1165
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: "We couldn't load available call times. Please try again shortly." }),
|
|
1166
|
-
escapeHatch
|
|
1167
|
-
] });
|
|
1168
|
-
}
|
|
1343
|
+
if (availabilityError || !availability) return degradedCard;
|
|
1169
1344
|
if (!isNativelyBookable(availability)) {
|
|
1170
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_DEGRADED_CLASS, className), children: [
|
|
1345
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_DEGRADED_CLASS, flowHeight, className), children: [
|
|
1171
1346
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-ods-text-secondary text-h6", children: "This meeting type is booked directly on HubSpot." }),
|
|
1172
1347
|
escapeHatch
|
|
1173
1348
|
] });
|
|
1174
1349
|
}
|
|
1175
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_CLASS, className), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: CARD_INNER_CLASS, children: [
|
|
1176
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1350
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, CARD_CLASS, flowHeight, formOnly && "bg-ods-bg", className), children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: CARD_INNER_CLASS, children: [
|
|
1351
|
+
!formOnly && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1177
1352
|
SchedulerContextPanel,
|
|
1178
1353
|
{
|
|
1179
1354
|
hosts: shownHosts,
|
|
@@ -1185,18 +1360,24 @@ function HubSpotMeetingScheduler({
|
|
|
1185
1360
|
setDurationMs(ms);
|
|
1186
1361
|
setSelectedDay(null);
|
|
1187
1362
|
setSelectedSlot(null);
|
|
1188
|
-
if (step === "details") setStep("slot");
|
|
1363
|
+
if (!detailsFirst && step === "details") setStep("slot");
|
|
1189
1364
|
},
|
|
1190
1365
|
timezone,
|
|
1191
1366
|
onTimezoneChange: setTimezone,
|
|
1192
|
-
onBack: step === "details" ? backToSlot : onBack,
|
|
1193
|
-
locked: step !== "slot",
|
|
1367
|
+
onBack: detailsFirst ? step === "slot" ? backToDetails : onBack : step === "details" ? backToSlot : onBack,
|
|
1368
|
+
locked: detailsFirst ? step === "confirmed" || isSubmitting : step !== "slot",
|
|
1194
1369
|
showTimezone: step !== "confirmed",
|
|
1370
|
+
fixedDuration: detailsFirst,
|
|
1195
1371
|
className: CONTEXT_PANEL_CLASS
|
|
1196
1372
|
}
|
|
1197
1373
|
),
|
|
1198
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: ACTION_PANEL_CLASS, children: step === "confirmed" && confirmation && timezone ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, "flex flex-1 flex-col", PANEL_STEP_CLASS), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Confirmation, { confirmation, timezone }) }) : step === "details" &&
|
|
1199
|
-
|
|
1374
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: ACTION_PANEL_CLASS, children: step === "confirmed" && confirmation && timezone ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, "flex flex-1 flex-col", PANEL_STEP_CLASS), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Confirmation, { confirmation, timezone }) }) : step === "details" && (detailsFirst ? (
|
|
1375
|
+
// The form is step ONE here: no slot yet, and `timezone` is null
|
|
1376
|
+
// on the server render, so neither may gate the PANEL. A link
|
|
1377
|
+
// publishing no durations has no form worth showing.
|
|
1378
|
+
durations.length > 0
|
|
1379
|
+
) : durationMs != null && selectedSlot != null && timezone) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunk23V5BSHDcjs.cn.call(void 0, "flex flex-1 flex-col gap-[var(--spacing-system-m)]", PANEL_STEP_CLASS), children: [
|
|
1380
|
+
selectedSlot != null && durationMs != null && timezone != null && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-ods-text-primary text-h4", children: [
|
|
1200
1381
|
new Intl.DateTimeFormat(void 0, {
|
|
1201
1382
|
timeZone: timezone,
|
|
1202
1383
|
weekday: "long",
|
|
@@ -1208,29 +1389,33 @@ function HubSpotMeetingScheduler({
|
|
|
1208
1389
|
}).format(new Date(selectedSlot)),
|
|
1209
1390
|
" ",
|
|
1210
1391
|
"\xB7 ",
|
|
1211
|
-
|
|
1392
|
+
_chunkWCBRZCU4cjs.formatDurationCompact.call(void 0, durationMs / 1e3)
|
|
1212
1393
|
] }),
|
|
1213
1394
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1214
|
-
|
|
1395
|
+
DetailsForm,
|
|
1215
1396
|
{
|
|
1216
1397
|
availability,
|
|
1217
1398
|
meetingId,
|
|
1218
|
-
startTimeMs: selectedSlot,
|
|
1219
|
-
durationMs,
|
|
1399
|
+
startTimeMs: _nullishCoalesce(selectedSlot, () => ( void 0)),
|
|
1400
|
+
durationMs: _nullishCoalesce(durationMs, () => ( void 0)),
|
|
1220
1401
|
timezone,
|
|
1402
|
+
deferSlot: detailsFirst,
|
|
1403
|
+
submitLabel: detailsFirst ? "Continue" : void 0,
|
|
1404
|
+
footerNote: detailsFirst ? "Next step: pick a slot that works. Calendar invite lands right after." : void 0,
|
|
1405
|
+
initialValues: detailsFirst ? _optionalChain([stash, 'optionalAccess', _37 => _37.payload]) : void 0,
|
|
1221
1406
|
isSubmitting,
|
|
1222
|
-
onSubmit: handleSubmit,
|
|
1407
|
+
onSubmit: detailsFirst ? stashDetails : handleSubmit,
|
|
1223
1408
|
honeypotInputProps,
|
|
1224
1409
|
getSignals
|
|
1225
1410
|
}
|
|
1226
1411
|
)
|
|
1227
1412
|
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col gap-[var(--spacing-system-m)] md:min-h-0 md:flex-1", children: [
|
|
1228
1413
|
bookingError === "SLOT_TAKEN" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1229
|
-
|
|
1414
|
+
_chunkQW663C35cjs.Alert,
|
|
1230
1415
|
{
|
|
1231
1416
|
variant: "warning",
|
|
1232
1417
|
className: "mx-[var(--spacing-system-l)] mt-[var(--spacing-system-l)] w-auto lg:m-0 lg:w-full",
|
|
1233
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1418
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQW663C35cjs.AlertDescription, { children: "That time was just taken \u2014 pick another slot below. (If you already submitted, check your email for a confirmation before rebooking.)" })
|
|
1234
1419
|
}
|
|
1235
1420
|
),
|
|
1236
1421
|
timezone && durationMs != null ? (
|
|
@@ -1250,12 +1435,31 @@ function HubSpotMeetingScheduler({
|
|
|
1250
1435
|
},
|
|
1251
1436
|
selectedSlot,
|
|
1252
1437
|
onSelectSlot: (ms) => {
|
|
1438
|
+
if (!detailsFirst) {
|
|
1439
|
+
setSelectedSlot(ms);
|
|
1440
|
+
setStep("details");
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
if (isSubmitting || !stash) return;
|
|
1253
1444
|
setSelectedSlot(ms);
|
|
1254
|
-
|
|
1445
|
+
void handleSubmit({
|
|
1446
|
+
...stash.payload,
|
|
1447
|
+
...stash.signals,
|
|
1448
|
+
meetingId,
|
|
1449
|
+
// `ms`, NOT `selectedSlot` — the setState above has not
|
|
1450
|
+
// committed inside this handler, so state holds null on
|
|
1451
|
+
// the first booking and the PREVIOUS slot on a retry.
|
|
1452
|
+
startTimeMs: ms,
|
|
1453
|
+
// Live values: both stay editable after Continue, so the
|
|
1454
|
+
// copies frozen at that point can be stale.
|
|
1455
|
+
durationMs,
|
|
1456
|
+
timezone
|
|
1457
|
+
});
|
|
1255
1458
|
},
|
|
1256
1459
|
selectedDay,
|
|
1257
1460
|
onSelectDay: setSelectedDay,
|
|
1258
|
-
isLoading: isLoadingAvailability
|
|
1461
|
+
isLoading: isLoadingAvailability,
|
|
1462
|
+
isSubmitting: detailsFirst ? isSubmitting : void 0
|
|
1259
1463
|
}
|
|
1260
1464
|
)
|
|
1261
1465
|
) : durations.length === 0 && !isFetchingAvailability ? (
|
|
@@ -1280,5 +1484,8 @@ function HubSpotMeetingScheduler({
|
|
|
1280
1484
|
|
|
1281
1485
|
|
|
1282
1486
|
|
|
1283
|
-
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
|
|
1490
|
+
exports.BookingForm = BookingForm; exports.BookingFormSkeleton = BookingFormSkeleton; exports.HubSpotMeetingScheduler = HubSpotMeetingScheduler; exports.MEETING_SCHEDULER_DETAILS_FIRST_H = MEETING_SCHEDULER_DETAILS_FIRST_H; exports.MEETING_SCHEDULER_H = MEETING_SCHEDULER_H; exports.MeetingSchedulerDirectory = MeetingSchedulerDirectory; exports.MeetingSchedulerDirectoryRowSkeleton = MeetingSchedulerDirectoryRowSkeleton;
|
|
1284
1491
|
//# sourceMappingURL=index.cjs.map
|