@fanfare-io/fanfare-sdk-react 0.7.2 → 0.9.0
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/index.js +399 -402
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as t, Fragment as Me, jsxs as u } from "react/jsx-runtime";
|
|
3
3
|
import lr from "@fanfare-io/fanfare-sdk-core";
|
|
4
4
|
import * as s from "react";
|
|
5
|
-
import { createContext as
|
|
5
|
+
import { createContext as zt, useMemo as X, useContext as jt, useState as ve, useRef as bt, useEffect as $e, useCallback as B, useSyncExternalStore as cr, forwardRef as kt, useLayoutEffect as dr } from "react";
|
|
6
6
|
import { getLocaleMessages as ur, mergeTranslations as aa, createTranslateFunction as ba, isRTLLocale as pr, en as gr, resolveLocaleMapValue as mr, normalizeLocale as hr } from "@fanfare-io/fanfare-sdk-i18n";
|
|
7
7
|
import { RTL_LOCALES as Zo, isRTLLocale as Yo } from "@fanfare-io/fanfare-sdk-i18n";
|
|
8
8
|
import { ensureFanfareError as mt, toDisplay as ra, classify as wr } from "@fanfare-io/fanfare-sdk-core/errors";
|
|
@@ -17,7 +17,7 @@ import Cr from "canvas-confetti";
|
|
|
17
17
|
import { atom as qe } from "nanostores";
|
|
18
18
|
import { bucketFromEtaSeconds as Dr, bucketI18nKey as Vr } from "@fanfare-io/fanfare-sdk-core/queues";
|
|
19
19
|
import { createPortal as Er } from "react-dom";
|
|
20
|
-
const ya =
|
|
20
|
+
const ya = zt(null), ka = gr, Mr = ba(ka, "en"), Tr = {
|
|
21
21
|
locale: "en",
|
|
22
22
|
messages: ka,
|
|
23
23
|
isRoot: !0,
|
|
@@ -26,9 +26,9 @@ const ya = jt(null), ka = gr, Mr = ba(ka, "en"), Tr = {
|
|
|
26
26
|
experienceTranslations: null,
|
|
27
27
|
setExperienceTranslations: () => {
|
|
28
28
|
}
|
|
29
|
-
}, _a =
|
|
29
|
+
}, _a = zt(Tr);
|
|
30
30
|
function Ft() {
|
|
31
|
-
return
|
|
31
|
+
return jt(_a);
|
|
32
32
|
}
|
|
33
33
|
function K() {
|
|
34
34
|
const { t: e, locale: a, dir: r } = Ft();
|
|
@@ -40,13 +40,13 @@ function Rr(e, a, r, n) {
|
|
|
40
40
|
const i = e ?? o.locale, f = e && e !== o.locale ? ur(e) : o.messages, c = aa(
|
|
41
41
|
f,
|
|
42
42
|
r ?? o.experienceTranslations ?? void 0
|
|
43
|
-
), g = aa(c, a), d = ba(g, i),
|
|
43
|
+
), g = aa(c, a), d = ba(g, i), b = pr(i) ? "rtl" : "ltr";
|
|
44
44
|
return {
|
|
45
45
|
locale: i,
|
|
46
46
|
messages: g,
|
|
47
47
|
isRoot: !1,
|
|
48
48
|
t: d,
|
|
49
|
-
dir:
|
|
49
|
+
dir: b,
|
|
50
50
|
experienceTranslations: r ?? o.experienceTranslations,
|
|
51
51
|
setExperienceTranslations: n ?? o.setExperienceTranslations
|
|
52
52
|
};
|
|
@@ -77,7 +77,7 @@ function $o({
|
|
|
77
77
|
publishableKey: c,
|
|
78
78
|
environment: g,
|
|
79
79
|
apiUrl: d,
|
|
80
|
-
credentials:
|
|
80
|
+
credentials: b,
|
|
81
81
|
debug: m,
|
|
82
82
|
auth: v,
|
|
83
83
|
logging: w,
|
|
@@ -85,13 +85,13 @@ function $o({
|
|
|
85
85
|
features: C,
|
|
86
86
|
beacon: l
|
|
87
87
|
}) {
|
|
88
|
-
const [h, p] = ve(null), [D,
|
|
88
|
+
const [h, p] = ve(null), [D, V] = ve(!0), T = bt(null), x = X(
|
|
89
89
|
() => ({
|
|
90
90
|
organizationId: f,
|
|
91
91
|
publishableKey: c,
|
|
92
92
|
environment: g,
|
|
93
93
|
apiUrl: d,
|
|
94
|
-
credentials:
|
|
94
|
+
credentials: b,
|
|
95
95
|
debug: m,
|
|
96
96
|
auth: v,
|
|
97
97
|
logging: w,
|
|
@@ -99,33 +99,33 @@ function $o({
|
|
|
99
99
|
features: C,
|
|
100
100
|
beacon: l
|
|
101
101
|
}),
|
|
102
|
-
[f, c, g, d,
|
|
102
|
+
[f, c, g, d, b, m, v, w, y, C, l]
|
|
103
103
|
);
|
|
104
104
|
return $e(() => {
|
|
105
105
|
let N = !0;
|
|
106
|
-
p(null),
|
|
106
|
+
p(null), V(!0);
|
|
107
107
|
async function S() {
|
|
108
108
|
if (N)
|
|
109
109
|
try {
|
|
110
|
-
const
|
|
110
|
+
const M = await lr({ ...x, autoResume: a && r });
|
|
111
111
|
if (!N) {
|
|
112
|
-
await
|
|
112
|
+
await M.destroy();
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
|
-
T.current =
|
|
116
|
-
} catch (
|
|
117
|
-
console.error("Failed to initialize Fanfare SDK:",
|
|
115
|
+
T.current = M, N && (p(M), V(!1));
|
|
116
|
+
} catch (M) {
|
|
117
|
+
console.error("Failed to initialize Fanfare SDK:", M), N && V(!1);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
return oa(S), () => {
|
|
121
121
|
N = !1;
|
|
122
|
-
const
|
|
123
|
-
T.current = null,
|
|
122
|
+
const M = T.current;
|
|
123
|
+
T.current = null, M && oa(() => M.destroy());
|
|
124
124
|
};
|
|
125
|
-
}, [
|
|
125
|
+
}, [x, a, r]), D ? /* @__PURE__ */ t(Me, { children: n }) : h ? /* @__PURE__ */ t(ya.Provider, { value: h, children: /* @__PURE__ */ t(Na, { locale: o, translations: i, children: e }) }) : (console.error("Fanfare SDK failed to initialize"), null);
|
|
126
126
|
}
|
|
127
127
|
function Nt() {
|
|
128
|
-
const e =
|
|
128
|
+
const e = jt(ya);
|
|
129
129
|
if (!e)
|
|
130
130
|
throw new Error(
|
|
131
131
|
"useFanfare must be used within a FanfareProvider. Make sure your component is wrapped with <FanfareProvider>"
|
|
@@ -165,23 +165,23 @@ function qo() {
|
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
167
|
function Sa(e, a) {
|
|
168
|
-
const r = Nt(), { locale: n, setExperienceTranslations: o } = Ft(), i = bt(null), f = bt(a), [c, g] = ve(null), [d,
|
|
168
|
+
const r = Nt(), { locale: n, setExperienceTranslations: o } = Ft(), i = bt(null), f = bt(a), [c, g] = ve(null), [d, b] = ve(null), [m, v] = ve(null), [w, y] = ve(null), [C, l] = ve(null);
|
|
169
169
|
$e(() => {
|
|
170
170
|
f.current = a;
|
|
171
171
|
}, [a]), $e(() => {
|
|
172
172
|
if (!e) {
|
|
173
|
-
i.current = null, g(null),
|
|
173
|
+
i.current = null, g(null), b(null), v(null), y(null), l(null);
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
176
|
const p = r.journeys.get(e);
|
|
177
|
-
i.current = p, g(p),
|
|
177
|
+
i.current = p, g(p), b(p.snapshot$.get()), v(p.view$.get());
|
|
178
178
|
const D = p.snapshot$.listen((T) => {
|
|
179
|
-
|
|
180
|
-
}),
|
|
179
|
+
b(T);
|
|
180
|
+
}), V = p.view$.listen((T) => {
|
|
181
181
|
v(T);
|
|
182
182
|
});
|
|
183
183
|
return () => {
|
|
184
|
-
D(),
|
|
184
|
+
D(), V();
|
|
185
185
|
};
|
|
186
186
|
}, [e, r]), $e(() => {
|
|
187
187
|
if (!e) {
|
|
@@ -191,8 +191,8 @@ function Sa(e, a) {
|
|
|
191
191
|
let p = !1;
|
|
192
192
|
const D = d?.experience?.experience?.i18n;
|
|
193
193
|
if (D) {
|
|
194
|
-
const
|
|
195
|
-
o(
|
|
194
|
+
const V = mr(D, n);
|
|
195
|
+
o(V ?? null);
|
|
196
196
|
} else p || o(null);
|
|
197
197
|
return () => {
|
|
198
198
|
p = !0, o(null);
|
|
@@ -204,23 +204,23 @@ function Sa(e, a) {
|
|
|
204
204
|
throw new Error("experienceId is required to start an experience journey");
|
|
205
205
|
const D = i.current ?? r.journeys.get(e);
|
|
206
206
|
i.current = D, g(D), y(null), l(null);
|
|
207
|
-
const
|
|
208
|
-
accessCode: p?.accessCode ??
|
|
209
|
-
autoEnterWaitlist: p?.autoEnterWaitlist ??
|
|
207
|
+
const V = f.current, T = {
|
|
208
|
+
accessCode: p?.accessCode ?? V?.accessCode,
|
|
209
|
+
autoEnterWaitlist: p?.autoEnterWaitlist ?? V?.autoEnterWaitlist
|
|
210
210
|
};
|
|
211
211
|
try {
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
212
|
+
const x = D.view$.get();
|
|
213
|
+
if (x.journeyStage === "ready") {
|
|
214
214
|
const N = T.accessCode ? { accessCode: T.accessCode } : void 0;
|
|
215
|
-
await
|
|
215
|
+
await x.start(N);
|
|
216
216
|
}
|
|
217
217
|
if (T.autoEnterWaitlist) {
|
|
218
218
|
const N = D.view$.get();
|
|
219
219
|
N.journeyStage === "routed" && N.sequence.phase === "scheduled" && N.sequence.waitlist?.status === "not_waitlisted" && await N.sequence.waitlist.join();
|
|
220
220
|
}
|
|
221
221
|
return D.view$.get();
|
|
222
|
-
} catch (
|
|
223
|
-
throw y(
|
|
222
|
+
} catch (x) {
|
|
223
|
+
throw y(x instanceof Error ? x.message : "Unknown error"), l(mt(x)), x;
|
|
224
224
|
}
|
|
225
225
|
},
|
|
226
226
|
[e, r]
|
|
@@ -236,12 +236,12 @@ function Sa(e, a) {
|
|
|
236
236
|
start: h
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function ze(e) {
|
|
240
240
|
const a = B((n) => e.listen(n), [e]), r = B(() => e.get(), [e]);
|
|
241
241
|
return cr(a, r, r);
|
|
242
242
|
}
|
|
243
243
|
function Wo(e) {
|
|
244
|
-
return
|
|
244
|
+
return ze(e.snapshot$);
|
|
245
245
|
}
|
|
246
246
|
function Lr({ experienceId: e, autoStart: a, children: r }) {
|
|
247
247
|
const n = Sa(e, {
|
|
@@ -257,7 +257,7 @@ function Uo({ experienceId: e, autoStart: a, renderHeader: r }) {
|
|
|
257
257
|
const v = o.sequence;
|
|
258
258
|
v.phase === "scheduled" && v.waitlist?.status === "not_waitlisted" && d.push("joinAttachment"), v.phase === "scheduled" && v.waitlist && v.waitlist.status !== "not_waitlisted" && d.push("leaveAttachment"), v.phase === "enterable" && d.push("enter"), v.phase === "participating" && "leave" in v && d.push("leave"), v.phase === "participating" && "complete" in v && d.push("complete"), "bid" in v && d.push("bid"), "book" in v && d.push("book"), "cancel" in v && d.push("cancel"), "reschedule" in v && d.push("reschedule"), "claim" in v && d.push("claim");
|
|
259
259
|
}
|
|
260
|
-
const
|
|
260
|
+
const b = i ? {
|
|
261
261
|
experienceId: i.experienceId,
|
|
262
262
|
accessCode: i.accessCode,
|
|
263
263
|
sequenceId: xr(i),
|
|
@@ -374,7 +374,7 @@ function Uo({ experienceId: e, autoStart: a, renderHeader: r }) {
|
|
|
374
374
|
d.includes("reschedule") && /* @__PURE__ */ t("button", { type: "button", onClick: () => m("reschedule"), children: "Reschedule" }),
|
|
375
375
|
d.includes("claim") && /* @__PURE__ */ t("button", { type: "button", onClick: () => m("claim"), children: "Claim" })
|
|
376
376
|
] }),
|
|
377
|
-
/* @__PURE__ */ t("pre", { children: JSON.stringify(
|
|
377
|
+
/* @__PURE__ */ t("pre", { children: JSON.stringify(b, null, 2) })
|
|
378
378
|
] })
|
|
379
379
|
] });
|
|
380
380
|
} });
|
|
@@ -413,22 +413,22 @@ function Ir(e) {
|
|
|
413
413
|
const a = e.replace(/\D/g, "");
|
|
414
414
|
return e.startsWith("+") ? a.length >= 10 && a.length <= 15 : a.length === 10;
|
|
415
415
|
}
|
|
416
|
-
const
|
|
416
|
+
const zr = _r({
|
|
417
417
|
extend: {
|
|
418
418
|
classGroups: {
|
|
419
419
|
"font-size": ["text-xxs"]
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
});
|
|
423
|
-
function
|
|
424
|
-
return
|
|
423
|
+
function E(...e) {
|
|
424
|
+
return zr(kr(e));
|
|
425
425
|
}
|
|
426
426
|
function fa(e, a) {
|
|
427
427
|
if (typeof e == "function")
|
|
428
428
|
return e(a);
|
|
429
429
|
e != null && (e.current = a);
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function jr(...e) {
|
|
432
432
|
return (a) => {
|
|
433
433
|
let r = !1;
|
|
434
434
|
const n = e.map((o) => {
|
|
@@ -458,8 +458,8 @@ function Br(e) {
|
|
|
458
458
|
Ca(i) && typeof xt == "function" && (i = xt(i._payload));
|
|
459
459
|
const c = s.Children.toArray(i), g = c.find(Wr);
|
|
460
460
|
if (g) {
|
|
461
|
-
const d = g.props.children,
|
|
462
|
-
return /* @__PURE__ */ t(a, { ...f, ref: o, children: s.isValidElement(d) ? s.cloneElement(d, void 0,
|
|
461
|
+
const d = g.props.children, b = c.map((m) => m === g ? s.Children.count(d) > 1 ? s.Children.only(null) : s.isValidElement(d) ? d.props.children : null : m);
|
|
462
|
+
return /* @__PURE__ */ t(a, { ...f, ref: o, children: s.isValidElement(d) ? s.cloneElement(d, void 0, b) : null });
|
|
463
463
|
}
|
|
464
464
|
return /* @__PURE__ */ t(a, { ...f, ref: o, children: i });
|
|
465
465
|
});
|
|
@@ -472,7 +472,7 @@ function $r(e) {
|
|
|
472
472
|
let { children: o, ...i } = r;
|
|
473
473
|
if (Ca(o) && typeof xt == "function" && (o = xt(o._payload)), s.isValidElement(o)) {
|
|
474
474
|
const f = Hr(o), c = Ur(i, o.props);
|
|
475
|
-
return o.type !== s.Fragment && (c.ref = n ?
|
|
475
|
+
return o.type !== s.Fragment && (c.ref = n ? jr(n, f) : f), s.cloneElement(o, c);
|
|
476
476
|
}
|
|
477
477
|
return s.Children.count(o) > 1 ? s.Children.only(null) : null;
|
|
478
478
|
});
|
|
@@ -536,9 +536,9 @@ const ot = () => typeof window > "u" ? !1 : window.matchMedia("(prefers-reduced-
|
|
|
536
536
|
theme: Sr,
|
|
537
537
|
variant: "default",
|
|
538
538
|
isRoot: !0
|
|
539
|
-
}, Tt =
|
|
539
|
+
}, Tt = zt(Yr);
|
|
540
540
|
function ft() {
|
|
541
|
-
return
|
|
541
|
+
return jt(Tt);
|
|
542
542
|
}
|
|
543
543
|
function Gr(e, a) {
|
|
544
544
|
const r = ft();
|
|
@@ -590,7 +590,7 @@ function Rt({ theme: e, variant: a, as: r = "div", className: n, children: o })
|
|
|
590
590
|
return e !== void 0 || a !== void 0 || i.isRoot ? /* @__PURE__ */ t(Tt.Provider, { value: f, children: /* @__PURE__ */ t(
|
|
591
591
|
r,
|
|
592
592
|
{
|
|
593
|
-
className:
|
|
593
|
+
className: E("fanfare-themed", n),
|
|
594
594
|
style: c,
|
|
595
595
|
"data-fanfare-themed": !0,
|
|
596
596
|
"data-fanfare-variant": f.variant,
|
|
@@ -627,7 +627,7 @@ const Jr = (e, a) => /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", width: "1.
|
|
|
627
627
|
ref: n,
|
|
628
628
|
viewBox: "0 0 24 24",
|
|
629
629
|
xmlns: "http://www.w3.org/2000/svg",
|
|
630
|
-
className:
|
|
630
|
+
className: E(tn({ size: a, styleVariant: o }), e),
|
|
631
631
|
"data-slot": "spinner",
|
|
632
632
|
"data-size": a,
|
|
633
633
|
"aria-hidden": "true",
|
|
@@ -790,7 +790,7 @@ const an = te(
|
|
|
790
790
|
styleVariant: "default"
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
),
|
|
793
|
+
), j = s.forwardRef(
|
|
794
794
|
({
|
|
795
795
|
className: e,
|
|
796
796
|
variant: a,
|
|
@@ -802,7 +802,7 @@ const an = te(
|
|
|
802
802
|
disabled: c,
|
|
803
803
|
children: g,
|
|
804
804
|
...d
|
|
805
|
-
},
|
|
805
|
+
}, b) => {
|
|
806
806
|
const m = o ? Or : "button", v = ge(), [w, y] = s.useState(void 0);
|
|
807
807
|
s.useImperativeHandle(i, () => ({
|
|
808
808
|
success: () => y("success"),
|
|
@@ -817,7 +817,7 @@ const an = te(
|
|
|
817
817
|
return /* @__PURE__ */ u(
|
|
818
818
|
m,
|
|
819
819
|
{
|
|
820
|
-
ref:
|
|
820
|
+
ref: b,
|
|
821
821
|
"data-slot": "button",
|
|
822
822
|
"data-variant": a,
|
|
823
823
|
"data-size": r,
|
|
@@ -825,7 +825,7 @@ const an = te(
|
|
|
825
825
|
"data-status": w || void 0,
|
|
826
826
|
"aria-busy": n || void 0,
|
|
827
827
|
"aria-disabled": C || void 0,
|
|
828
|
-
className:
|
|
828
|
+
className: E(an({ variant: a, size: r, styleVariant: v, className: e })),
|
|
829
829
|
disabled: C,
|
|
830
830
|
...d,
|
|
831
831
|
children: [
|
|
@@ -842,7 +842,7 @@ const an = te(
|
|
|
842
842
|
"span",
|
|
843
843
|
{
|
|
844
844
|
"data-slot": "button-content",
|
|
845
|
-
className:
|
|
845
|
+
className: E(
|
|
846
846
|
"ff:gap-inherit ff:flex ff:items-center",
|
|
847
847
|
(n || w) && "ff:opacity-0",
|
|
848
848
|
f
|
|
@@ -855,7 +855,7 @@ const an = te(
|
|
|
855
855
|
);
|
|
856
856
|
}
|
|
857
857
|
);
|
|
858
|
-
|
|
858
|
+
j.displayName = "Button";
|
|
859
859
|
const sa = ["default", "rounded"], rn = te(
|
|
860
860
|
[
|
|
861
861
|
"ff:flex ff:w-full ff:rounded-md ff:px-3 ff:py-2",
|
|
@@ -920,8 +920,8 @@ const sa = ["default", "rounded"], rn = te(
|
|
|
920
920
|
}
|
|
921
921
|
}), yt = s.forwardRef(
|
|
922
922
|
({ className: e, type: a = "text", label: r, error: n, hasError: o, inlineLabel: i, inlineError: f, ...c }, g) => {
|
|
923
|
-
const { variant: d } = ft(),
|
|
924
|
-
rn({ styleVariant:
|
|
923
|
+
const { variant: d } = ft(), b = ge(), m = c.id || c.name, v = i ?? sa.includes(d), w = f ?? sa.includes(d), y = o || !!n, C = !!n && !o, l = v && r, h = !v && r, p = w && C, D = !w && C, V = E(
|
|
924
|
+
rn({ styleVariant: b }),
|
|
925
925
|
y && "ff:border-danger ff:focus:border-danger ff:focus:ring-danger",
|
|
926
926
|
// Extra padding for floating label
|
|
927
927
|
l && "ff:pt-5 ff:pb-1",
|
|
@@ -945,8 +945,8 @@ const sa = ["default", "rounded"], rn = te(
|
|
|
945
945
|
"aria-invalid": y,
|
|
946
946
|
"aria-describedby": C ? `${m}-error` : void 0,
|
|
947
947
|
placeholder: c.placeholder || " ",
|
|
948
|
-
className:
|
|
949
|
-
|
|
948
|
+
className: E(
|
|
949
|
+
V,
|
|
950
950
|
// Placeholder shown state for label positioning
|
|
951
951
|
"ff:peer ff:placeholder:opacity-0 ff:placeholder:transition-opacity ff:placeholder:duration-200",
|
|
952
952
|
"ff:focus:placeholder:opacity-100"
|
|
@@ -959,7 +959,7 @@ const sa = ["default", "rounded"], rn = te(
|
|
|
959
959
|
{
|
|
960
960
|
htmlFor: m,
|
|
961
961
|
"data-slot": "input-label",
|
|
962
|
-
className:
|
|
962
|
+
className: E(
|
|
963
963
|
"ff:absolute ff:left-3 ff:top-3 ff:z-10 ff:origin-top-left ff:select-none",
|
|
964
964
|
"ff:text-sm ff:font-medium ff:transition-all ff:duration-150 ff:ease-out",
|
|
965
965
|
"ff:pointer-events-none",
|
|
@@ -974,7 +974,7 @@ const sa = ["default", "rounded"], rn = te(
|
|
|
974
974
|
// Error state
|
|
975
975
|
y && "ff:text-danger ff:peer-focus:text-danger",
|
|
976
976
|
// Style variant
|
|
977
|
-
la({ styleVariant:
|
|
977
|
+
la({ styleVariant: b })
|
|
978
978
|
),
|
|
979
979
|
children: r
|
|
980
980
|
}
|
|
@@ -1007,9 +1007,9 @@ const sa = ["default", "rounded"], rn = te(
|
|
|
1007
1007
|
{
|
|
1008
1008
|
htmlFor: m,
|
|
1009
1009
|
"data-slot": "input-label",
|
|
1010
|
-
className:
|
|
1010
|
+
className: E(
|
|
1011
1011
|
"ff:text-foreground ff:mb-1.5 ff:block ff:text-sm ff:font-medium",
|
|
1012
|
-
la({ styleVariant:
|
|
1012
|
+
la({ styleVariant: b })
|
|
1013
1013
|
),
|
|
1014
1014
|
children: r
|
|
1015
1015
|
}
|
|
@@ -1024,7 +1024,7 @@ const sa = ["default", "rounded"], rn = te(
|
|
|
1024
1024
|
"data-slot": "input-field",
|
|
1025
1025
|
"aria-invalid": y,
|
|
1026
1026
|
"aria-describedby": C ? `${m}-error` : void 0,
|
|
1027
|
-
className:
|
|
1027
|
+
className: V,
|
|
1028
1028
|
...c
|
|
1029
1029
|
}
|
|
1030
1030
|
),
|
|
@@ -1062,47 +1062,47 @@ const Ea = s.forwardRef(
|
|
|
1062
1062
|
hasError: c,
|
|
1063
1063
|
label: g,
|
|
1064
1064
|
disabled: d,
|
|
1065
|
-
...
|
|
1065
|
+
...b
|
|
1066
1066
|
}, m) => {
|
|
1067
|
-
const { t: v } = K(), [w, y] = s.useState(() => i === "auto" ? Va(a) : i), [C, l] = s.useState(!1), [h, p] = s.useState(null), [D,
|
|
1067
|
+
const { t: v } = K(), [w, y] = s.useState(() => i === "auto" ? Va(a) : i), [C, l] = s.useState(!1), [h, p] = s.useState(null), [D, V] = s.useState(!1), [T, x] = s.useState(
|
|
1068
1068
|
() => w === "phone" ? Dt(a) : a
|
|
1069
1069
|
), N = i === "auto";
|
|
1070
1070
|
s.useEffect(() => {
|
|
1071
1071
|
N || y(i);
|
|
1072
1072
|
}, [i, N]), s.useEffect(() => {
|
|
1073
|
-
|
|
1073
|
+
x(w === "phone" ? Dt(a) : a);
|
|
1074
1074
|
}, [a, w]);
|
|
1075
1075
|
const S = s.useCallback(
|
|
1076
1076
|
(L, J) => {
|
|
1077
1077
|
if (!L) {
|
|
1078
|
-
p(null),
|
|
1078
|
+
p(null), V(!1), n?.(!1);
|
|
1079
1079
|
return;
|
|
1080
1080
|
}
|
|
1081
|
-
J === "email" ? ht.safeParse(nn, L).success ? (p(null),
|
|
1081
|
+
J === "email" ? ht.safeParse(nn, L).success ? (p(null), V(!0), n?.(!0)) : (p(v("auth.invalidEmail")), V(!1), n?.(!1)) : Ir(L) ? (p(null), V(!0), n?.(!0)) : (p(v("auth.invalidPhone")), V(!1), n?.(!1));
|
|
1082
1082
|
},
|
|
1083
1083
|
[n]
|
|
1084
1084
|
);
|
|
1085
1085
|
s.useEffect(() => {
|
|
1086
1086
|
S(a, w);
|
|
1087
1087
|
}, [a, w, S]);
|
|
1088
|
-
const
|
|
1088
|
+
const M = (L) => {
|
|
1089
1089
|
const J = L.target.value;
|
|
1090
1090
|
if (w === "phone") {
|
|
1091
1091
|
const ne = Dt(J);
|
|
1092
|
-
|
|
1092
|
+
x(ne);
|
|
1093
1093
|
const se = Ar(J);
|
|
1094
1094
|
r(se || J, w);
|
|
1095
1095
|
} else
|
|
1096
|
-
|
|
1096
|
+
x(J), r(J, w);
|
|
1097
1097
|
}, A = (L) => {
|
|
1098
|
-
l(!0),
|
|
1098
|
+
l(!0), b.onBlur?.(L);
|
|
1099
1099
|
}, I = (L) => {
|
|
1100
|
-
L.key === "Enter" && o && (L.preventDefault(), o()),
|
|
1100
|
+
L.key === "Enter" && o && (L.preventDefault(), o()), b.onKeyDown?.(L);
|
|
1101
1101
|
}, O = () => {
|
|
1102
1102
|
const L = w === "email" ? "phone" : "email";
|
|
1103
|
-
y(L),
|
|
1104
|
-
}, $ = f || (C && !D ? h : null), fe =
|
|
1105
|
-
|
|
1103
|
+
y(L), x(""), p(null), l(!1), V(!1), r("", L), n?.(!1);
|
|
1104
|
+
}, $ = f || (C && !D ? h : null), fe = b.placeholder || v(w === "email" ? "auth.emailPlaceholder" : "auth.phonePlaceholder"), ce = N && /* @__PURE__ */ t(
|
|
1105
|
+
j,
|
|
1106
1106
|
{
|
|
1107
1107
|
type: "button",
|
|
1108
1108
|
variant: "link",
|
|
@@ -1116,7 +1116,7 @@ const Ea = s.forwardRef(
|
|
|
1116
1116
|
return N ? /* @__PURE__ */ u(
|
|
1117
1117
|
"div",
|
|
1118
1118
|
{
|
|
1119
|
-
className:
|
|
1119
|
+
className: E("fanfare-auth-input", e),
|
|
1120
1120
|
"data-slot": "auth-input",
|
|
1121
1121
|
"data-mode": w,
|
|
1122
1122
|
"data-valid": D || void 0,
|
|
@@ -1133,7 +1133,7 @@ const Ea = s.forwardRef(
|
|
|
1133
1133
|
inputMode: w === "email" ? "email" : "tel",
|
|
1134
1134
|
autoComplete: w === "email" ? "email" : "tel",
|
|
1135
1135
|
value: T,
|
|
1136
|
-
onChange:
|
|
1136
|
+
onChange: M,
|
|
1137
1137
|
onBlur: A,
|
|
1138
1138
|
onKeyDown: I,
|
|
1139
1139
|
placeholder: fe,
|
|
@@ -1143,7 +1143,7 @@ const Ea = s.forwardRef(
|
|
|
1143
1143
|
inlineLabel: !1,
|
|
1144
1144
|
inlineError: !1,
|
|
1145
1145
|
"data-slot": "auth-input-field",
|
|
1146
|
-
...
|
|
1146
|
+
...b
|
|
1147
1147
|
}
|
|
1148
1148
|
)
|
|
1149
1149
|
]
|
|
@@ -1156,7 +1156,7 @@ const Ea = s.forwardRef(
|
|
|
1156
1156
|
inputMode: w === "email" ? "email" : "tel",
|
|
1157
1157
|
autoComplete: w === "email" ? "email" : "tel",
|
|
1158
1158
|
value: T,
|
|
1159
|
-
onChange:
|
|
1159
|
+
onChange: M,
|
|
1160
1160
|
onBlur: A,
|
|
1161
1161
|
onKeyDown: I,
|
|
1162
1162
|
placeholder: fe,
|
|
@@ -1164,11 +1164,11 @@ const Ea = s.forwardRef(
|
|
|
1164
1164
|
label: g,
|
|
1165
1165
|
error: $ || void 0,
|
|
1166
1166
|
hasError: c,
|
|
1167
|
-
className:
|
|
1167
|
+
className: E("fanfare-auth-input", e),
|
|
1168
1168
|
"data-slot": "auth-input",
|
|
1169
1169
|
"data-mode": w,
|
|
1170
1170
|
"data-valid": D || void 0,
|
|
1171
|
-
...
|
|
1171
|
+
...b
|
|
1172
1172
|
}
|
|
1173
1173
|
);
|
|
1174
1174
|
}
|
|
@@ -1243,18 +1243,18 @@ const on = te(
|
|
|
1243
1243
|
}
|
|
1244
1244
|
}
|
|
1245
1245
|
), Ma = s.forwardRef(
|
|
1246
|
-
({ value: e = "", onChange: a, onComplete: r, length: n = 6, error: o, hasError: i, disabled: f, autoFocus: c, ariaDescribedBy: g, className: d },
|
|
1246
|
+
({ value: e = "", onChange: a, onComplete: r, length: n = 6, error: o, hasError: i, disabled: f, autoFocus: c, ariaDescribedBy: g, className: d }, b) => {
|
|
1247
1247
|
const m = ge(), v = s.useRef([]), [w, y] = s.useState(() => {
|
|
1248
|
-
const
|
|
1249
|
-
return [...
|
|
1248
|
+
const x = e.split("").slice(0, n);
|
|
1249
|
+
return [...x, ...Array(n - x.length).fill("")];
|
|
1250
1250
|
});
|
|
1251
1251
|
s.useEffect(() => {
|
|
1252
|
-
const
|
|
1253
|
-
y([...
|
|
1252
|
+
const x = e.split("").slice(0, n);
|
|
1253
|
+
y([...x, ...Array(n - x.length).fill("")]);
|
|
1254
1254
|
}, [e, n]);
|
|
1255
|
-
const C = (
|
|
1256
|
-
|
|
1257
|
-
}, l = (
|
|
1255
|
+
const C = (x) => {
|
|
1256
|
+
x >= 0 && x < n && v.current[x]?.focus();
|
|
1257
|
+
}, l = (x, N) => {
|
|
1258
1258
|
const S = N.replace(/\D/g, "");
|
|
1259
1259
|
if (S.length > 1) {
|
|
1260
1260
|
const O = S.slice(0, n).split(""), $ = [...O, ...Array(n - O.length).fill("")];
|
|
@@ -1263,44 +1263,44 @@ const on = te(
|
|
|
1263
1263
|
a?.(fe), fe.length === n ? (r?.(fe), C(n - 1)) : C(O.length);
|
|
1264
1264
|
return;
|
|
1265
1265
|
}
|
|
1266
|
-
const
|
|
1267
|
-
A[
|
|
1266
|
+
const M = S.slice(-1), A = [...w];
|
|
1267
|
+
A[x] = M, y(A);
|
|
1268
1268
|
const I = A.join("");
|
|
1269
|
-
a?.(I),
|
|
1270
|
-
}, h = (
|
|
1269
|
+
a?.(I), M && x < n - 1 && C(x + 1), I.length === n && !I.includes("") && r?.(I);
|
|
1270
|
+
}, h = (x, N) => {
|
|
1271
1271
|
switch (N.key) {
|
|
1272
1272
|
case "Backspace":
|
|
1273
|
-
N.preventDefault(), w[
|
|
1273
|
+
N.preventDefault(), w[x] ? l(x, "") : x > 0 && (C(x - 1), l(x - 1, ""));
|
|
1274
1274
|
break;
|
|
1275
1275
|
case "ArrowLeft":
|
|
1276
|
-
N.preventDefault(), C(
|
|
1276
|
+
N.preventDefault(), C(x - 1);
|
|
1277
1277
|
break;
|
|
1278
1278
|
case "ArrowRight":
|
|
1279
|
-
N.preventDefault(), C(
|
|
1279
|
+
N.preventDefault(), C(x + 1);
|
|
1280
1280
|
break;
|
|
1281
1281
|
case "Delete":
|
|
1282
|
-
N.preventDefault(), l(
|
|
1282
|
+
N.preventDefault(), l(x, "");
|
|
1283
1283
|
break;
|
|
1284
1284
|
}
|
|
1285
|
-
}, p = (
|
|
1286
|
-
|
|
1287
|
-
const N =
|
|
1285
|
+
}, p = (x) => {
|
|
1286
|
+
x.preventDefault();
|
|
1287
|
+
const N = x.clipboardData.getData("text").replace(/\D/g, "").slice(0, n);
|
|
1288
1288
|
if (N) {
|
|
1289
|
-
const S = N.split(""),
|
|
1290
|
-
y(
|
|
1291
|
-
const A =
|
|
1289
|
+
const S = N.split(""), M = [...S, ...Array(n - S.length).fill("")];
|
|
1290
|
+
y(M);
|
|
1291
|
+
const A = M.join("");
|
|
1292
1292
|
a?.(A), A.length === n ? (r?.(A), C(n - 1)) : C(S.length);
|
|
1293
1293
|
}
|
|
1294
|
-
}, D = (
|
|
1295
|
-
|
|
1296
|
-
},
|
|
1294
|
+
}, D = (x) => {
|
|
1295
|
+
x.target.select();
|
|
1296
|
+
}, V = i || !!o, T = !!o && !i;
|
|
1297
1297
|
return /* @__PURE__ */ u(
|
|
1298
1298
|
"div",
|
|
1299
1299
|
{
|
|
1300
|
-
ref:
|
|
1301
|
-
className:
|
|
1300
|
+
ref: b,
|
|
1301
|
+
className: E("fanfare-otp-input", "ff:space-y-1.5", d),
|
|
1302
1302
|
"data-slot": "otp-input",
|
|
1303
|
-
"data-error":
|
|
1303
|
+
"data-error": V || void 0,
|
|
1304
1304
|
children: [
|
|
1305
1305
|
/* @__PURE__ */ t(
|
|
1306
1306
|
"div",
|
|
@@ -1309,7 +1309,7 @@ const on = te(
|
|
|
1309
1309
|
className: "ff:grid ff:gap-2",
|
|
1310
1310
|
style: { gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` },
|
|
1311
1311
|
onPaste: p,
|
|
1312
|
-
children: Array.from({ length: n }).map((
|
|
1312
|
+
children: Array.from({ length: n }).map((x, N) => /* @__PURE__ */ t(
|
|
1313
1313
|
"input",
|
|
1314
1314
|
{
|
|
1315
1315
|
ref: (S) => {
|
|
@@ -1327,9 +1327,9 @@ const on = te(
|
|
|
1327
1327
|
disabled: f,
|
|
1328
1328
|
autoFocus: c && N === 0,
|
|
1329
1329
|
"aria-label": `Digit ${N + 1} of ${n}`,
|
|
1330
|
-
"aria-invalid":
|
|
1331
|
-
"aria-describedby":
|
|
1332
|
-
className: on({ styleVariant: m, hasError:
|
|
1330
|
+
"aria-invalid": V,
|
|
1331
|
+
"aria-describedby": V ? g : void 0,
|
|
1332
|
+
className: on({ styleVariant: m, hasError: V })
|
|
1333
1333
|
},
|
|
1334
1334
|
N
|
|
1335
1335
|
))
|
|
@@ -1380,20 +1380,20 @@ const fn = te(["ff:rounded-lg ff:p-6", "ff:bg-background", "ff:text-foreground"]
|
|
|
1380
1380
|
ref: n,
|
|
1381
1381
|
"data-slot": "card",
|
|
1382
1382
|
"data-variant": a,
|
|
1383
|
-
className:
|
|
1383
|
+
className: E(fn({ variant: a, styleVariant: o, className: e })),
|
|
1384
1384
|
...r
|
|
1385
1385
|
}
|
|
1386
1386
|
);
|
|
1387
1387
|
});
|
|
1388
1388
|
Ta.displayName = "Card";
|
|
1389
|
-
const sn = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, "data-slot": "card-header", className:
|
|
1389
|
+
const sn = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, "data-slot": "card-header", className: E("fanfare-card-header ff:mb-4", e), ...a }));
|
|
1390
1390
|
sn.displayName = "CardHeader";
|
|
1391
1391
|
const ln = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
1392
1392
|
"h3",
|
|
1393
1393
|
{
|
|
1394
1394
|
ref: r,
|
|
1395
1395
|
"data-slot": "card-title",
|
|
1396
|
-
className:
|
|
1396
|
+
className: E("ff:text-lg ff:font-heading ff:font-semibold ff:leading-none", "ff:text-foreground", e),
|
|
1397
1397
|
...a
|
|
1398
1398
|
}
|
|
1399
1399
|
));
|
|
@@ -1404,20 +1404,20 @@ const cn = s.forwardRef(
|
|
|
1404
1404
|
{
|
|
1405
1405
|
ref: r,
|
|
1406
1406
|
"data-slot": "card-description",
|
|
1407
|
-
className:
|
|
1407
|
+
className: E("ff:mt-1 ff:text-sm", "ff:text-muted", e),
|
|
1408
1408
|
...a
|
|
1409
1409
|
}
|
|
1410
1410
|
)
|
|
1411
1411
|
);
|
|
1412
1412
|
cn.displayName = "CardDescription";
|
|
1413
|
-
const dn = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, "data-slot": "card-content", className:
|
|
1413
|
+
const dn = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t("div", { ref: r, "data-slot": "card-content", className: E(e), ...a }));
|
|
1414
1414
|
dn.displayName = "CardContent";
|
|
1415
1415
|
const un = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
1416
1416
|
"div",
|
|
1417
1417
|
{
|
|
1418
1418
|
ref: r,
|
|
1419
1419
|
"data-slot": "card-footer",
|
|
1420
|
-
className:
|
|
1420
|
+
className: E("ff:mt-4 ff:flex ff:items-center ff:gap-2", e),
|
|
1421
1421
|
...a
|
|
1422
1422
|
}
|
|
1423
1423
|
));
|
|
@@ -1428,7 +1428,7 @@ const Ra = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ u(
|
|
|
1428
1428
|
ref: r,
|
|
1429
1429
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1430
1430
|
viewBox: "0 0 5647 2166",
|
|
1431
|
-
className:
|
|
1431
|
+
className: E("ff:h-5 ff:w-auto", e),
|
|
1432
1432
|
"data-slot": "fanfare-logo",
|
|
1433
1433
|
...a,
|
|
1434
1434
|
children: [
|
|
@@ -1558,7 +1558,7 @@ const Z = s.forwardRef(({ className: e, children: a, ...r }, n) => /* @__PURE__
|
|
|
1558
1558
|
{
|
|
1559
1559
|
ref: n,
|
|
1560
1560
|
"data-slot": "panel-body",
|
|
1561
|
-
className:
|
|
1561
|
+
className: E("ff:flex ff:flex-1 ff:flex-col ff:gap-5", e),
|
|
1562
1562
|
...r,
|
|
1563
1563
|
children: a
|
|
1564
1564
|
}
|
|
@@ -1572,7 +1572,7 @@ const H = s.forwardRef(
|
|
|
1572
1572
|
{
|
|
1573
1573
|
ref: n,
|
|
1574
1574
|
"data-slot": "panel-footer",
|
|
1575
|
-
className:
|
|
1575
|
+
className: E(
|
|
1576
1576
|
"ff:flex ff:items-center ff:justify-between ff:gap-2 ff:border-t ff:border-border-light ff:px-5 ff:py-2.5 ff:text-xxs ff:text-muted-foreground",
|
|
1577
1577
|
(i === "clean" || i === "retro") && "ff:font-mono",
|
|
1578
1578
|
e
|
|
@@ -1601,7 +1601,7 @@ const Y = s.forwardRef(
|
|
|
1601
1601
|
{
|
|
1602
1602
|
ref: n,
|
|
1603
1603
|
"data-slot": "panel-layout",
|
|
1604
|
-
className:
|
|
1604
|
+
className: E("ff:flex ff:flex-col ff:overflow-hidden ff:p-0 ff:max-h-[24rem]", e),
|
|
1605
1605
|
...r,
|
|
1606
1606
|
children: [
|
|
1607
1607
|
/* @__PURE__ */ t("div", { className: "ff:flex ff:flex-1 ff:flex-col ff:gap-5 ff:p-5", children: f }),
|
|
@@ -1734,7 +1734,7 @@ const pn = ["clean"], gn = te(["ff:inline-flex ff:items-center", "ff:text-xs ff:
|
|
|
1734
1734
|
outline: "ff:bg-foreground/40"
|
|
1735
1735
|
}, La = s.forwardRef(
|
|
1736
1736
|
({ className: e, variant: a = "default", solidBackground: r, children: n, ...o }, i) => {
|
|
1737
|
-
const { variant: f } = ft(), c = ge(), g = a ?? "default", d = r ?? !pn.includes(f),
|
|
1737
|
+
const { variant: f } = ft(), c = ge(), g = a ?? "default", d = r ?? !pn.includes(f), b = !d && ca[g];
|
|
1738
1738
|
return /* @__PURE__ */ u(
|
|
1739
1739
|
"span",
|
|
1740
1740
|
{
|
|
@@ -1742,13 +1742,13 @@ const pn = ["clean"], gn = te(["ff:inline-flex ff:items-center", "ff:text-xs ff:
|
|
|
1742
1742
|
"data-slot": "badge",
|
|
1743
1743
|
"data-variant": g,
|
|
1744
1744
|
"data-solid-background": d,
|
|
1745
|
-
className:
|
|
1745
|
+
className: E(gn({ variant: g, solid: d, styleVariant: c, className: e })),
|
|
1746
1746
|
...o,
|
|
1747
1747
|
children: [
|
|
1748
|
-
|
|
1748
|
+
b && /* @__PURE__ */ t(
|
|
1749
1749
|
"span",
|
|
1750
1750
|
{
|
|
1751
|
-
className:
|
|
1751
|
+
className: E("ff:size-1.5 ff:shrink-0 ff:rounded-full", ca[g]),
|
|
1752
1752
|
"aria-hidden": "true"
|
|
1753
1753
|
}
|
|
1754
1754
|
),
|
|
@@ -1760,7 +1760,7 @@ const pn = ["clean"], gn = te(["ff:inline-flex ff:items-center", "ff:text-xs ff:
|
|
|
1760
1760
|
);
|
|
1761
1761
|
La.displayName = "Badge";
|
|
1762
1762
|
const G = s.forwardRef(
|
|
1763
|
-
({ variant: e = "default", label: a, title: r, description: n, className: o, ...i }, f) => /* @__PURE__ */ u("div", { ref: f, "data-slot": "panel-header", className:
|
|
1763
|
+
({ variant: e = "default", label: a, title: r, description: n, className: o, ...i }, f) => /* @__PURE__ */ u("div", { ref: f, "data-slot": "panel-header", className: E("ff:flex ff:flex-col ff:gap-4", o), ...i, children: [
|
|
1764
1764
|
a ? /* @__PURE__ */ t("div", { className: "ff:flex", children: /* @__PURE__ */ t(La, { variant: e, solidBackground: !1, children: a }) }) : null,
|
|
1765
1765
|
r || n ? /* @__PURE__ */ u("div", { children: [
|
|
1766
1766
|
r ? /* @__PURE__ */ t("h2", { className: "ff:text-xl ff:font-semibold ff:text-foreground", children: r }) : null,
|
|
@@ -1783,7 +1783,7 @@ const mn = te(["ff:flex ff:flex-col ff:gap-2", "ff:p-4", "ff:text-xs ff:text-for
|
|
|
1783
1783
|
}
|
|
1784
1784
|
}), ie = s.forwardRef(({ className: e, children: a, ...r }, n) => {
|
|
1785
1785
|
const o = ge();
|
|
1786
|
-
return /* @__PURE__ */ t("div", { ref: n, "data-slot": "info-panel", className:
|
|
1786
|
+
return /* @__PURE__ */ t("div", { ref: n, "data-slot": "info-panel", className: E(mn({ styleVariant: o }), e), ...r, children: a });
|
|
1787
1787
|
});
|
|
1788
1788
|
ie.displayName = "InfoPanel";
|
|
1789
1789
|
const hn = te(["ff:flex ff:items-start ff:gap-3", "ff:rounded-lg ff:p-4"], {
|
|
@@ -1862,12 +1862,12 @@ const be = s.forwardRef(
|
|
|
1862
1862
|
"data-slot": "alert-panel",
|
|
1863
1863
|
"data-tone": e,
|
|
1864
1864
|
role: e === "success" ? "status" : "alert",
|
|
1865
|
-
className:
|
|
1865
|
+
className: E(hn({ tone: e }), o),
|
|
1866
1866
|
...i,
|
|
1867
1867
|
children: [
|
|
1868
|
-
/* @__PURE__ */ t("div", { className:
|
|
1868
|
+
/* @__PURE__ */ t("div", { className: E(wn({ tone: e })), "aria-hidden": "true", children: a ?? c }),
|
|
1869
1869
|
/* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:gap-1", children: [
|
|
1870
|
-
r ? /* @__PURE__ */ t("p", { className:
|
|
1870
|
+
r ? /* @__PURE__ */ t("p", { className: E(vn({ tone: e })), children: r }) : null,
|
|
1871
1871
|
n ? /* @__PURE__ */ t("p", { className: "ff:text-xs ff:text-foreground/80", children: n }) : null
|
|
1872
1872
|
] })
|
|
1873
1873
|
]
|
|
@@ -2114,13 +2114,13 @@ function pe({
|
|
|
2114
2114
|
showSeconds: c = !0,
|
|
2115
2115
|
layout: g = "swiss",
|
|
2116
2116
|
size: d = "default",
|
|
2117
|
-
tone:
|
|
2117
|
+
tone: b = "calm"
|
|
2118
2118
|
}) {
|
|
2119
2119
|
const { t: m } = K(), { timeRemaining: v, isClient: w, isPast: y } = Tn(e, a), C = ge();
|
|
2120
2120
|
if (!w)
|
|
2121
2121
|
return null;
|
|
2122
2122
|
if (y && r)
|
|
2123
|
-
return /* @__PURE__ */ t("span", { className:
|
|
2123
|
+
return /* @__PURE__ */ t("span", { className: E("ff:text-muted ff:font-heading", n), "data-slot": "countdown", "data-past": "", children: r });
|
|
2124
2124
|
const l = y ? "ff:opacity-50" : void 0, p = [
|
|
2125
2125
|
{
|
|
2126
2126
|
value: v.days,
|
|
@@ -2141,22 +2141,22 @@ function pe({
|
|
|
2141
2141
|
shortLabel: m("countdown.secondsShort"),
|
|
2142
2142
|
show: c
|
|
2143
2143
|
}
|
|
2144
|
-
].filter((
|
|
2144
|
+
].filter((V) => V.show), D = g === "swiss" ? p.slice(0, 3) : p;
|
|
2145
2145
|
if (g === "compact") {
|
|
2146
|
-
const
|
|
2146
|
+
const V = (T) => T.toString().padStart(2, "0");
|
|
2147
2147
|
return /* @__PURE__ */ t(
|
|
2148
2148
|
"span",
|
|
2149
2149
|
{
|
|
2150
|
-
className:
|
|
2150
|
+
className: E("ff:tabular-nums ff:font-heading", l, n),
|
|
2151
2151
|
"data-slot": "countdown",
|
|
2152
2152
|
"data-layout": "compact",
|
|
2153
2153
|
"data-past": y || void 0,
|
|
2154
2154
|
role: "timer",
|
|
2155
2155
|
"aria-live": y ? "off" : "polite",
|
|
2156
|
-
children: D.map((T,
|
|
2157
|
-
|
|
2156
|
+
children: D.map((T, x) => /* @__PURE__ */ u(s.Fragment, { children: [
|
|
2157
|
+
V(T.value),
|
|
2158
2158
|
T.shortLabel,
|
|
2159
|
-
|
|
2159
|
+
x < D.length - 1 && " "
|
|
2160
2160
|
] }, T.label))
|
|
2161
2161
|
}
|
|
2162
2162
|
);
|
|
@@ -2164,18 +2164,18 @@ function pe({
|
|
|
2164
2164
|
return /* @__PURE__ */ t(
|
|
2165
2165
|
"div",
|
|
2166
2166
|
{
|
|
2167
|
-
className:
|
|
2167
|
+
className: E(Dn({ styleVariant: C, size: d }), l, n),
|
|
2168
2168
|
"data-slot": "countdown",
|
|
2169
2169
|
"data-layout": "swiss",
|
|
2170
2170
|
"data-size": d,
|
|
2171
|
-
"data-tone":
|
|
2171
|
+
"data-tone": b,
|
|
2172
2172
|
"data-past": y || void 0,
|
|
2173
2173
|
role: "timer",
|
|
2174
2174
|
"aria-live": y ? "off" : "polite",
|
|
2175
|
-
children: D.map((
|
|
2176
|
-
/* @__PURE__ */ t(En, { value:
|
|
2175
|
+
children: D.map((V, T) => /* @__PURE__ */ u(s.Fragment, { children: [
|
|
2176
|
+
/* @__PURE__ */ t(En, { value: V.value, label: V.label, styleVariant: C, size: d, tone: b }),
|
|
2177
2177
|
T < D.length - 1 && /* @__PURE__ */ t(Mn, { styleVariant: C, size: d })
|
|
2178
|
-
] },
|
|
2178
|
+
] }, V.label))
|
|
2179
2179
|
}
|
|
2180
2180
|
);
|
|
2181
2181
|
}
|
|
@@ -2189,7 +2189,7 @@ function nt({ show: e, presenceKey: a, children: r, className: n }) {
|
|
|
2189
2189
|
animate: { opacity: 1, y: 0 },
|
|
2190
2190
|
exit: o ? { opacity: 0 } : { opacity: 0, y: -4 },
|
|
2191
2191
|
transition: { duration: 0.18, ease: "easeOut" },
|
|
2192
|
-
className:
|
|
2192
|
+
className: E(n),
|
|
2193
2193
|
children: r
|
|
2194
2194
|
},
|
|
2195
2195
|
a ?? "fade-presence"
|
|
@@ -2257,7 +2257,7 @@ function rt({ children: e, transitionKey: a, mode: r, layout: n = !0, className:
|
|
|
2257
2257
|
transition: d.transition,
|
|
2258
2258
|
layout: n && !f,
|
|
2259
2259
|
"data-slot": "transition",
|
|
2260
|
-
className:
|
|
2260
|
+
className: E(o),
|
|
2261
2261
|
children: e
|
|
2262
2262
|
},
|
|
2263
2263
|
a
|
|
@@ -2280,7 +2280,7 @@ function Aa({
|
|
|
2280
2280
|
description: c,
|
|
2281
2281
|
countdownTo: g,
|
|
2282
2282
|
submitLabel: d,
|
|
2283
|
-
verifyLabel:
|
|
2283
|
+
verifyLabel: b,
|
|
2284
2284
|
allowSkip: m = !1,
|
|
2285
2285
|
showBranding: v = !0,
|
|
2286
2286
|
defaultStep: w = "credential",
|
|
@@ -2289,23 +2289,23 @@ function Aa({
|
|
|
2289
2289
|
defaultError: l,
|
|
2290
2290
|
className: h
|
|
2291
2291
|
}) {
|
|
2292
|
-
const { t: p } = K(), D = s.useId(),
|
|
2292
|
+
const { t: p } = K(), D = s.useId(), V = i ?? p("auth.badgeLabel"), T = f ?? p("auth.title"), x = c ?? p("auth.description"), N = d ?? p("auth.submit"), S = b ?? p("auth.verify"), [M, A] = s.useState(w), [I, O] = s.useState(y ?? ""), [$, fe] = s.useState(
|
|
2293
2293
|
C ?? Va(y ?? "")
|
|
2294
2294
|
), [ce, L] = s.useState(!1), [J, ne] = s.useState(""), [se, de] = s.useState(!1), [ee, P] = s.useState(l ?? null), [ae, me] = s.useState(
|
|
2295
2295
|
w === "verify" && (y ?? "").length > 0 ? Date.now() + Et : null
|
|
2296
2296
|
), [ke, Re] = s.useState(() => Date.now()), [ue, q] = s.useState(!1), [_e, Ne] = s.useState(!1), st = p($ === "email" ? "auth.email" : "auth.phone");
|
|
2297
2297
|
s.useEffect(() => {
|
|
2298
|
-
if (
|
|
2298
|
+
if (M !== "verify") return;
|
|
2299
2299
|
const W = setInterval(() => Re(Date.now()), 1e3);
|
|
2300
2300
|
return () => clearInterval(W);
|
|
2301
|
-
}, [
|
|
2301
|
+
}, [M]), s.useEffect(() => {
|
|
2302
2302
|
if (!ue) return;
|
|
2303
2303
|
const W = setTimeout(() => q(!1), Ln);
|
|
2304
2304
|
return () => clearTimeout(W);
|
|
2305
2305
|
}, [ue]);
|
|
2306
2306
|
const Ue = ae ? Math.max(0, ae - ke) : 0, lt = Ue > 0, xe = s.useRef(null);
|
|
2307
2307
|
ee && (xe.current = ee);
|
|
2308
|
-
const F = ee ?? xe.current ?? "",
|
|
2308
|
+
const F = ee ?? xe.current ?? "", je = (W, Se) => {
|
|
2309
2309
|
O(W), fe(Se), P(null);
|
|
2310
2310
|
}, Fe = async (W) => {
|
|
2311
2311
|
if (W?.preventDefault(), !(!ce || !I)) {
|
|
@@ -2349,14 +2349,14 @@ function Aa({
|
|
|
2349
2349
|
}
|
|
2350
2350
|
}
|
|
2351
2351
|
};
|
|
2352
|
-
if (
|
|
2353
|
-
return /* @__PURE__ */ u(Y, { className:
|
|
2352
|
+
if (M === "success")
|
|
2353
|
+
return /* @__PURE__ */ u(Y, { className: E("fanfare-auth-form", h), "data-slot": "auth-form", "data-step": "success", children: [
|
|
2354
2354
|
/* @__PURE__ */ t(Z, { children: /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:items-center ff:gap-3 ff:py-4", children: [
|
|
2355
2355
|
/* @__PURE__ */ t(
|
|
2356
2356
|
"div",
|
|
2357
2357
|
{
|
|
2358
2358
|
"data-slot": "auth-form-success-icon",
|
|
2359
|
-
className:
|
|
2359
|
+
className: E(
|
|
2360
2360
|
"ff:flex ff:h-12 ff:w-12 ff:items-center ff:justify-center ff:rounded-full",
|
|
2361
2361
|
"ff:bg-success/10 ff:text-success"
|
|
2362
2362
|
),
|
|
@@ -2367,17 +2367,17 @@ function Aa({
|
|
|
2367
2367
|
] }) }),
|
|
2368
2368
|
v && /* @__PURE__ */ t(H, {})
|
|
2369
2369
|
] });
|
|
2370
|
-
const Ke =
|
|
2371
|
-
return /* @__PURE__ */ u(Y, { className:
|
|
2372
|
-
/* @__PURE__ */ t(G, { variant: o, label:
|
|
2370
|
+
const Ke = M === "credential" ? T : p("auth.verifyTitle");
|
|
2371
|
+
return /* @__PURE__ */ u(Y, { className: E("fanfare-auth-form", h), "data-slot": "auth-form", "data-step": M, children: [
|
|
2372
|
+
/* @__PURE__ */ t(G, { variant: o, label: V }),
|
|
2373
2373
|
/* @__PURE__ */ u(Z, { children: [
|
|
2374
2374
|
g ? /* @__PURE__ */ u("div", { "data-slot": "auth-form-countdown", className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
2375
2375
|
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: p("time.opensIn") }),
|
|
2376
2376
|
/* @__PURE__ */ t(pe, { targetDate: g, showDays: !1 })
|
|
2377
2377
|
] }) : null,
|
|
2378
|
-
/* @__PURE__ */ t("div", { "data-slot": "auth-form-heading", children: /* @__PURE__ */ t(rt, { transitionKey:
|
|
2378
|
+
/* @__PURE__ */ t("div", { "data-slot": "auth-form-heading", children: /* @__PURE__ */ t(rt, { transitionKey: M, mode: "fade", children: M === "credential" ? /* @__PURE__ */ u(Me, { children: [
|
|
2379
2379
|
/* @__PURE__ */ t("h2", { className: "ff:text-foreground ff:text-xl ff:font-semibold", children: Ke }),
|
|
2380
|
-
/* @__PURE__ */ t("p", { className: "ff:text-muted-foreground ff:text-xs", children:
|
|
2380
|
+
/* @__PURE__ */ t("p", { className: "ff:text-muted-foreground ff:text-xs", children: x })
|
|
2381
2381
|
] }) : /* @__PURE__ */ u(Me, { children: [
|
|
2382
2382
|
/* @__PURE__ */ t("h2", { className: "ff:text-foreground ff:text-xl ff:font-semibold", children: Ke }),
|
|
2383
2383
|
I ? /* @__PURE__ */ u("p", { className: "ff:text-muted-foreground ff:text-xxs", children: [
|
|
@@ -2385,7 +2385,7 @@ function Aa({
|
|
|
2385
2385
|
" ",
|
|
2386
2386
|
/* @__PURE__ */ t("strong", { className: "ff:text-foreground ff:font-semibold", children: I }),
|
|
2387
2387
|
" · ",
|
|
2388
|
-
/* @__PURE__ */ t(
|
|
2388
|
+
/* @__PURE__ */ t(j, { type: "button", variant: "link", size: "xs", onClick: ct, disabled: se, children: p("auth.change") })
|
|
2389
2389
|
] }) : /* @__PURE__ */ t("p", { className: "ff:text-muted-foreground ff:text-xs", children: p("auth.verifyDescription", { values: { type: st } }) })
|
|
2390
2390
|
] }) }) }),
|
|
2391
2391
|
/* @__PURE__ */ u(
|
|
@@ -2393,14 +2393,14 @@ function Aa({
|
|
|
2393
2393
|
{
|
|
2394
2394
|
className: "ff:flex ff:flex-1 ff:flex-col ff:gap-5",
|
|
2395
2395
|
onSubmit: (W) => {
|
|
2396
|
-
W.preventDefault(),
|
|
2396
|
+
W.preventDefault(), M === "credential" ? Fe(W) : He(W);
|
|
2397
2397
|
},
|
|
2398
2398
|
children: [
|
|
2399
|
-
/* @__PURE__ */ t(rt, { transitionKey:
|
|
2399
|
+
/* @__PURE__ */ t(rt, { transitionKey: M, children: M === "credential" ? /* @__PURE__ */ t(
|
|
2400
2400
|
Ea,
|
|
2401
2401
|
{
|
|
2402
2402
|
value: I,
|
|
2403
|
-
onValueChange:
|
|
2403
|
+
onValueChange: je,
|
|
2404
2404
|
onValidChange: L,
|
|
2405
2405
|
onSubmit: () => {
|
|
2406
2406
|
Fe();
|
|
@@ -2423,10 +2423,10 @@ function Aa({
|
|
|
2423
2423
|
disabled: se
|
|
2424
2424
|
}
|
|
2425
2425
|
) }),
|
|
2426
|
-
/* @__PURE__ */ t(nt, { show:
|
|
2426
|
+
/* @__PURE__ */ t(nt, { show: M === "verify", presenceKey: "resend-area", children: /* @__PURE__ */ t(rt, { transitionKey: ue ? "success" : "cooldown", mode: "fade", layout: !1, children: ue ? /* @__PURE__ */ t(be, { tone: "success", title: p("auth.newCodeSent") }) : /* @__PURE__ */ u("div", { "data-slot": "auth-form-resend", className: "ff:flex ff:items-center ff:justify-between", children: [
|
|
2427
2427
|
/* @__PURE__ */ t("span", { className: "ff:text-muted-foreground ff:text-xxs", children: p("auth.didntGetIt") }),
|
|
2428
2428
|
lt ? /* @__PURE__ */ t("span", { className: "ff:text-muted-foreground ff:text-xxs ff:tabular-nums", children: An(Ue) }) : /* @__PURE__ */ t(
|
|
2429
|
-
|
|
2429
|
+
j,
|
|
2430
2430
|
{
|
|
2431
2431
|
type: "button",
|
|
2432
2432
|
variant: "link",
|
|
@@ -2442,15 +2442,15 @@ function Aa({
|
|
|
2442
2442
|
/* @__PURE__ */ t(nt, { show: !!ee, presenceKey: "error-alert", children: /* @__PURE__ */ t(be, { id: D, tone: "danger", title: F }) }),
|
|
2443
2443
|
/* @__PURE__ */ u("div", { className: "ff:mt-auto ff:flex ff:flex-col ff:gap-2", children: [
|
|
2444
2444
|
/* @__PURE__ */ t(
|
|
2445
|
-
|
|
2445
|
+
j,
|
|
2446
2446
|
{
|
|
2447
2447
|
type: "submit",
|
|
2448
2448
|
className: "ff:w-full",
|
|
2449
|
-
disabled: se || _e || (
|
|
2450
|
-
children: se ? /* @__PURE__ */ t(Te, { size: "sm" }) :
|
|
2449
|
+
disabled: se || _e || (M === "credential" ? !ce : J.length < 6),
|
|
2450
|
+
children: se ? /* @__PURE__ */ t(Te, { size: "sm" }) : M === "credential" ? N : S
|
|
2451
2451
|
}
|
|
2452
2452
|
),
|
|
2453
|
-
m &&
|
|
2453
|
+
m && M === "credential" && /* @__PURE__ */ t(j, { type: "button", variant: "outline", className: "ff:w-full", onClick: r, disabled: se, children: p("common.skip") })
|
|
2454
2454
|
] })
|
|
2455
2455
|
]
|
|
2456
2456
|
}
|
|
@@ -2489,14 +2489,14 @@ const Ia = s.forwardRef(
|
|
|
2489
2489
|
placeholder: f,
|
|
2490
2490
|
error: o,
|
|
2491
2491
|
hasError: i,
|
|
2492
|
-
className:
|
|
2492
|
+
className: E("fanfare-access-code-input", e),
|
|
2493
2493
|
"data-slot": "access-code-input",
|
|
2494
2494
|
...g
|
|
2495
2495
|
}
|
|
2496
2496
|
)
|
|
2497
2497
|
);
|
|
2498
2498
|
Ia.displayName = "AccessCodeInput";
|
|
2499
|
-
function
|
|
2499
|
+
function za({
|
|
2500
2500
|
onSubmit: e,
|
|
2501
2501
|
onSkip: a,
|
|
2502
2502
|
variant: r = "secondary",
|
|
@@ -2507,22 +2507,22 @@ function ja({
|
|
|
2507
2507
|
submitLabel: c,
|
|
2508
2508
|
allowSkip: g = !1,
|
|
2509
2509
|
autoUppercase: d = !0,
|
|
2510
|
-
defaultError:
|
|
2510
|
+
defaultError: b,
|
|
2511
2511
|
className: m
|
|
2512
2512
|
}) {
|
|
2513
|
-
const { t: v } = K(), w = n ?? v("accessCode.badgeLabel"), y = o ?? v("accessCode.title"), C = i ?? v("accessCode.description"), l = c ?? v("accessCode.submit"), [h, p] = s.useState(""), [D,
|
|
2513
|
+
const { t: v } = K(), w = n ?? v("accessCode.badgeLabel"), y = o ?? v("accessCode.title"), C = i ?? v("accessCode.description"), l = c ?? v("accessCode.submit"), [h, p] = s.useState(""), [D, V] = s.useState(!1), [T, x] = s.useState(b ?? null), N = async (S) => {
|
|
2514
2514
|
if (S?.preventDefault(), !!h.trim()) {
|
|
2515
|
-
|
|
2515
|
+
V(!0), x(null);
|
|
2516
2516
|
try {
|
|
2517
2517
|
await e?.(h.trim());
|
|
2518
|
-
} catch (
|
|
2519
|
-
|
|
2518
|
+
} catch (M) {
|
|
2519
|
+
x(M instanceof Error ? M.message : v("accessCode.invalid"));
|
|
2520
2520
|
} finally {
|
|
2521
|
-
|
|
2521
|
+
V(!1);
|
|
2522
2522
|
}
|
|
2523
2523
|
}
|
|
2524
2524
|
};
|
|
2525
|
-
return /* @__PURE__ */ u(Y, { className:
|
|
2525
|
+
return /* @__PURE__ */ u(Y, { className: E("fanfare-access-code-form", m), "data-slot": "access-code-form", children: [
|
|
2526
2526
|
/* @__PURE__ */ t(G, { variant: r, label: w }),
|
|
2527
2527
|
/* @__PURE__ */ u(Z, { children: [
|
|
2528
2528
|
f ? /* @__PURE__ */ u("div", { "data-slot": "access-code-form-countdown", className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
@@ -2541,7 +2541,7 @@ function ja({
|
|
|
2541
2541
|
{
|
|
2542
2542
|
value: h,
|
|
2543
2543
|
onValueChange: (S) => {
|
|
2544
|
-
p(S),
|
|
2544
|
+
p(S), x(null);
|
|
2545
2545
|
},
|
|
2546
2546
|
onSubmit: () => {
|
|
2547
2547
|
N();
|
|
@@ -2555,27 +2555,27 @@ function ja({
|
|
|
2555
2555
|
),
|
|
2556
2556
|
T ? /* @__PURE__ */ t(be, { tone: "danger", title: T }) : null,
|
|
2557
2557
|
/* @__PURE__ */ u("div", { className: "ff:mt-auto ff:flex ff:flex-col ff:gap-2", children: [
|
|
2558
|
-
/* @__PURE__ */ t(
|
|
2559
|
-
g && /* @__PURE__ */ t(
|
|
2558
|
+
/* @__PURE__ */ t(j, { type: "submit", className: "ff:w-full", disabled: D || !h.trim(), children: D ? /* @__PURE__ */ t(Te, { size: "sm" }) : l }),
|
|
2559
|
+
g && /* @__PURE__ */ t(j, { type: "button", variant: "outline", className: "ff:w-full", onClick: a, disabled: D, children: v("common.skip") })
|
|
2560
2560
|
] })
|
|
2561
2561
|
] })
|
|
2562
2562
|
] }),
|
|
2563
2563
|
/* @__PURE__ */ t(H, {})
|
|
2564
2564
|
] });
|
|
2565
2565
|
}
|
|
2566
|
-
|
|
2566
|
+
za.displayName = "AccessCodeForm";
|
|
2567
2567
|
function In(e) {
|
|
2568
2568
|
if (!e || typeof e != "object") return !1;
|
|
2569
2569
|
const a = e;
|
|
2570
2570
|
return typeof a.kind != "string" || typeof a.challengeId != "string" ? !1 : a.kind === "fanfare:challenge:turnstile" ? typeof a.token == "string" && a.token.length > 0 : a.kind === "fanfare:challenge:turnstile_error" || a.kind === "fanfare:challenge:turnstile_expired";
|
|
2571
2571
|
}
|
|
2572
|
-
function
|
|
2572
|
+
function zn(e, a) {
|
|
2573
2573
|
const r = e?.blockedUntil;
|
|
2574
2574
|
if (!r) return { blocked: !1 };
|
|
2575
2575
|
const n = Date.parse(r);
|
|
2576
2576
|
return Number.isFinite(n) ? { blocked: a < n, blockedUntil: r } : { blocked: !1 };
|
|
2577
2577
|
}
|
|
2578
|
-
function
|
|
2578
|
+
function jn(e, a) {
|
|
2579
2579
|
const r = new Date(e);
|
|
2580
2580
|
try {
|
|
2581
2581
|
return r.toLocaleString(hr(a));
|
|
@@ -2583,7 +2583,7 @@ function zn(e, a) {
|
|
|
2583
2583
|
return r.toLocaleString();
|
|
2584
2584
|
}
|
|
2585
2585
|
}
|
|
2586
|
-
function
|
|
2586
|
+
function ja({
|
|
2587
2587
|
challenge: e,
|
|
2588
2588
|
botMitigation: a,
|
|
2589
2589
|
onVerifyToken: r,
|
|
@@ -2594,9 +2594,9 @@ function za({
|
|
|
2594
2594
|
description: c,
|
|
2595
2595
|
countdownTo: g,
|
|
2596
2596
|
retryLabel: d,
|
|
2597
|
-
className:
|
|
2597
|
+
className: b
|
|
2598
2598
|
}) {
|
|
2599
|
-
const { t: m, locale: v } = K(), [w, y] = s.useState(0), [C, l] = s.useState(!1), [h, p] = s.useState(!1), [D,
|
|
2599
|
+
const { t: m, locale: v } = K(), [w, y] = s.useState(0), [C, l] = s.useState(!1), [h, p] = s.useState(!1), [D, V] = s.useState(null), [T, x] = s.useState(!1), [N, S] = s.useState("reload"), [M, A] = s.useState(() => Date.now()), I = X(() => {
|
|
2600
2600
|
if (!e?.iframeUrl) return null;
|
|
2601
2601
|
try {
|
|
2602
2602
|
return new URL(e.iframeUrl).origin;
|
|
@@ -2623,43 +2623,43 @@ function za({
|
|
|
2623
2623
|
};
|
|
2624
2624
|
}, [a?.blockedUntil]);
|
|
2625
2625
|
const { blocked: $, blockedUntil: fe } = X(
|
|
2626
|
-
() =>
|
|
2627
|
-
[a,
|
|
2626
|
+
() => zn(a, M),
|
|
2627
|
+
[a, M]
|
|
2628
2628
|
), ce = typeof a?.attemptsRemaining == "number" ? a.attemptsRemaining : void 0;
|
|
2629
2629
|
s.useEffect(() => {
|
|
2630
|
-
y(0), l(!1), p(!1),
|
|
2630
|
+
y(0), l(!1), p(!1), V(null), x(!1), S("reload");
|
|
2631
2631
|
}, [e?.id]), s.useEffect(() => {
|
|
2632
|
-
T && a?.message &&
|
|
2632
|
+
T && a?.message && V(a.message);
|
|
2633
2633
|
}, [T, a?.message]), s.useEffect(() => {
|
|
2634
2634
|
if (!e?.id || !I) return;
|
|
2635
2635
|
const ee = (P) => {
|
|
2636
2636
|
if (P.origin !== I || !In(P.data) || P.data.challengeId !== e.id) return;
|
|
2637
2637
|
if (P.data.kind === "fanfare:challenge:turnstile") {
|
|
2638
2638
|
const ke = P.data.token;
|
|
2639
|
-
|
|
2639
|
+
x(!0), p(!0), V(null), (async () => {
|
|
2640
2640
|
try {
|
|
2641
2641
|
await r(ke);
|
|
2642
2642
|
} catch (Re) {
|
|
2643
|
-
|
|
2643
|
+
V(Re instanceof Error ? Re.message : m("challenge.verificationFailed"));
|
|
2644
2644
|
} finally {
|
|
2645
2645
|
p(!1);
|
|
2646
2646
|
}
|
|
2647
2647
|
})();
|
|
2648
2648
|
return;
|
|
2649
2649
|
}
|
|
2650
|
-
|
|
2650
|
+
x(!0);
|
|
2651
2651
|
const ae = typeof P.data.reason == "string" ? P.data.reason : void 0, me = typeof P.data.message == "string" ? P.data.message : void 0;
|
|
2652
2652
|
if (ae === "challenge_expired" || ae === "challenge_not_found") {
|
|
2653
|
-
S("reroute"),
|
|
2653
|
+
S("reroute"), V(
|
|
2654
2654
|
me ?? (P.data.kind === "fanfare:challenge:turnstile_expired" ? m("challenge.expiredRefresh") : m("challenge.errorRefresh"))
|
|
2655
2655
|
);
|
|
2656
2656
|
return;
|
|
2657
2657
|
}
|
|
2658
2658
|
if (S("reload"), P.data.kind === "fanfare:challenge:turnstile_expired") {
|
|
2659
|
-
|
|
2659
|
+
V(me ?? m("challenge.expiredRetry")), y((ke) => ke + 1), l(!1);
|
|
2660
2660
|
return;
|
|
2661
2661
|
}
|
|
2662
|
-
|
|
2662
|
+
V(me ?? m("challenge.errorRetry")), y((ke) => ke + 1), l(!1);
|
|
2663
2663
|
};
|
|
2664
2664
|
return window.addEventListener("message", ee), () => {
|
|
2665
2665
|
window.removeEventListener("message", ee);
|
|
@@ -2667,13 +2667,13 @@ function za({
|
|
|
2667
2667
|
}, [e?.id, I, r, m]);
|
|
2668
2668
|
const L = f ?? m("challenge.title"), J = c ?? m("challenge.description"), ne = d ?? m("challenge.retry"), se = i ?? m("challenge.badgeLabel"), de = () => {
|
|
2669
2669
|
const ee = N;
|
|
2670
|
-
if (
|
|
2670
|
+
if (V(null), x(!1), n && (ee === "reroute" || !O || typeof ce == "number" && ce <= 0)) {
|
|
2671
2671
|
S("reload"), n();
|
|
2672
2672
|
return;
|
|
2673
2673
|
}
|
|
2674
2674
|
S("reload"), y((P) => P + 1), l(!1);
|
|
2675
2675
|
};
|
|
2676
|
-
return /* @__PURE__ */ u(Y, { className:
|
|
2676
|
+
return /* @__PURE__ */ u(Y, { className: E("fanfare-challenge-gate", b), "data-slot": "challenge-gate", children: [
|
|
2677
2677
|
/* @__PURE__ */ t(G, { variant: o, label: se }),
|
|
2678
2678
|
/* @__PURE__ */ u(Z, { children: [
|
|
2679
2679
|
g ? /* @__PURE__ */ u("div", { "data-slot": "challenge-gate-countdown", className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
@@ -2689,7 +2689,7 @@ function za({
|
|
|
2689
2689
|
{
|
|
2690
2690
|
tone: "danger",
|
|
2691
2691
|
title: a?.message ?? m("challenge.blockedDefault"),
|
|
2692
|
-
description: fe ? m("challenge.blockedUntil", { values: { date:
|
|
2692
|
+
description: fe ? m("challenge.blockedUntil", { values: { date: jn(fe, v) } }) : void 0
|
|
2693
2693
|
}
|
|
2694
2694
|
) : O ? /* @__PURE__ */ u("div", { className: "ff:relative ff:w-full ff:rounded-md ff:border ff:border-border ff:bg-background ff:overflow-hidden", children: [
|
|
2695
2695
|
!C && /* @__PURE__ */ t("div", { className: "ff:absolute ff:inset-0 ff:flex ff:items-center ff:justify-center ff:bg-background/60", children: /* @__PURE__ */ t(Te, { size: "lg" }) }),
|
|
@@ -2716,33 +2716,33 @@ function za({
|
|
|
2716
2716
|
description: ce !== void 0 ? m("challenge.attemptsRemaining", { values: { count: ce } }) : void 0
|
|
2717
2717
|
}
|
|
2718
2718
|
),
|
|
2719
|
-
!$ && /* @__PURE__ */ t(
|
|
2719
|
+
!$ && /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", variant: "secondary", onClick: de, disabled: h, children: ne })
|
|
2720
2720
|
] }),
|
|
2721
2721
|
/* @__PURE__ */ t(H, {})
|
|
2722
2722
|
] });
|
|
2723
2723
|
}
|
|
2724
|
-
|
|
2724
|
+
ja.displayName = "ChallengeGate";
|
|
2725
2725
|
function Fa({ title: e, message: a, endedAt: r, ctaLabel: n, onCtaClick: o, className: i }) {
|
|
2726
|
-
const { t: f, locale: c } = K(), g = e ?? f("ended.title"), d = a ?? f("ended.message"),
|
|
2726
|
+
const { t: f, locale: c } = K(), g = e ?? f("ended.title"), d = a ?? f("ended.message"), b = s.useMemo(() => r ? (r instanceof Date ? r : new Date(r)).toLocaleDateString(c, {
|
|
2727
2727
|
month: "long",
|
|
2728
2728
|
day: "numeric",
|
|
2729
2729
|
year: "numeric"
|
|
2730
2730
|
}) : null, [r, c]), m = we();
|
|
2731
|
-
return /* @__PURE__ */ t(U.div, { ...m, children: /* @__PURE__ */ u(Y, { className:
|
|
2731
|
+
return /* @__PURE__ */ t(U.div, { ...m, children: /* @__PURE__ */ u(Y, { className: E("ff:w-full ff:max-w-sm", i), "data-slot": "ended-module", role: "status", children: [
|
|
2732
2732
|
/* @__PURE__ */ t(G, { variant: "outline", label: g }),
|
|
2733
2733
|
/* @__PURE__ */ u(Z, { children: [
|
|
2734
2734
|
/* @__PURE__ */ u(ie, { children: [
|
|
2735
2735
|
/* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: d }),
|
|
2736
|
-
|
|
2736
|
+
b && /* @__PURE__ */ t("p", { className: "ff:text-xs ff:text-muted", children: f("ended.endedOn", { values: { date: b } }) })
|
|
2737
2737
|
] }),
|
|
2738
|
-
n && o && /* @__PURE__ */ t(
|
|
2738
|
+
n && o && /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", variant: "outline", onClick: o, children: n })
|
|
2739
2739
|
] }),
|
|
2740
2740
|
/* @__PURE__ */ t(H, {})
|
|
2741
2741
|
] }) });
|
|
2742
2742
|
}
|
|
2743
2743
|
Fa.displayName = "EndedModule";
|
|
2744
2744
|
function et({ error: e, title: a, label: r, info: n, ctaLabel: o, onRetry: i, className: f }) {
|
|
2745
|
-
const { t: c } = K(), [g, d] = s.useState(!1),
|
|
2745
|
+
const { t: c } = K(), [g, d] = s.useState(!1), b = r ?? c("error.label"), m = a ?? c("error.title"), w = (e instanceof Error ? e.message : e) ?? c("error.description"), y = o ?? c("error.retry"), C = async () => {
|
|
2746
2746
|
if (i) {
|
|
2747
2747
|
d(!0);
|
|
2748
2748
|
try {
|
|
@@ -2752,13 +2752,13 @@ function et({ error: e, title: a, label: r, info: n, ctaLabel: o, onRetry: i, cl
|
|
|
2752
2752
|
}
|
|
2753
2753
|
}
|
|
2754
2754
|
}, l = we();
|
|
2755
|
-
return /* @__PURE__ */ t(U.div, { ...l, children: /* @__PURE__ */ u(Y, { className:
|
|
2756
|
-
/* @__PURE__ */ t(G, { variant: "danger", label:
|
|
2755
|
+
return /* @__PURE__ */ t(U.div, { ...l, children: /* @__PURE__ */ u(Y, { className: E("ff:w-full ff:max-w-sm", f), "data-slot": "error-view", role: "alert", children: [
|
|
2756
|
+
/* @__PURE__ */ t(G, { variant: "danger", label: b }),
|
|
2757
2757
|
/* @__PURE__ */ u(Z, { children: [
|
|
2758
2758
|
/* @__PURE__ */ t(be, { tone: "danger", title: m, description: w }),
|
|
2759
2759
|
n ? /* @__PURE__ */ t(ie, { children: n }) : null,
|
|
2760
2760
|
i ? /* @__PURE__ */ t(
|
|
2761
|
-
|
|
2761
|
+
j,
|
|
2762
2762
|
{
|
|
2763
2763
|
className: "ff:mt-auto",
|
|
2764
2764
|
onClick: () => {
|
|
@@ -2838,7 +2838,7 @@ function it({
|
|
|
2838
2838
|
return /* @__PURE__ */ t(U.div, { ...g, children: /* @__PURE__ */ u(
|
|
2839
2839
|
Y,
|
|
2840
2840
|
{
|
|
2841
|
-
className:
|
|
2841
|
+
className: E("ff:w-full ff:max-w-sm", i),
|
|
2842
2842
|
"data-slot": "granted-panel",
|
|
2843
2843
|
"data-stage": "granted",
|
|
2844
2844
|
role: "status",
|
|
@@ -2849,7 +2849,7 @@ function it({
|
|
|
2849
2849
|
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: f("granted.timeRemaining") }),
|
|
2850
2850
|
/* @__PURE__ */ t(pe, { targetDate: n, showDays: !1 })
|
|
2851
2851
|
] }) : /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: a }) }),
|
|
2852
|
-
/* @__PURE__ */ t(
|
|
2852
|
+
/* @__PURE__ */ t(j, { className: "ff:mt-auto", onClick: o, children: r })
|
|
2853
2853
|
] }),
|
|
2854
2854
|
/* @__PURE__ */ t(H, {})
|
|
2855
2855
|
]
|
|
@@ -2879,11 +2879,11 @@ function We({
|
|
|
2879
2879
|
isReentering: n,
|
|
2880
2880
|
className: o
|
|
2881
2881
|
}) {
|
|
2882
|
-
const { t: i } = K(), f = e === "expired", c = pa[e] ?? pa.ended, g = f && typeof r == "function", d = i(a ? On[a] : "expired.reenter"),
|
|
2883
|
-
return /* @__PURE__ */ t(U.div, { ...
|
|
2882
|
+
const { t: i } = K(), f = e === "expired", c = pa[e] ?? pa.ended, g = f && typeof r == "function", d = i(a ? On[a] : "expired.reenter"), b = we();
|
|
2883
|
+
return /* @__PURE__ */ t(U.div, { ...b, children: /* @__PURE__ */ u(
|
|
2884
2884
|
Y,
|
|
2885
2885
|
{
|
|
2886
|
-
className:
|
|
2886
|
+
className: E("ff:w-full ff:max-w-sm", o),
|
|
2887
2887
|
"data-slot": "outcome-panel",
|
|
2888
2888
|
"data-stage": "ended",
|
|
2889
2889
|
"data-reason": e,
|
|
@@ -2891,7 +2891,7 @@ function We({
|
|
|
2891
2891
|
/* @__PURE__ */ t(G, { variant: c.variant, label: i(c.title) }),
|
|
2892
2892
|
/* @__PURE__ */ u(Z, { children: [
|
|
2893
2893
|
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: i(c.body) }) }),
|
|
2894
|
-
g && /* @__PURE__ */ t(
|
|
2894
|
+
g && /* @__PURE__ */ t(j, { className: "ff:mt-auto", onClick: r, disabled: n, loading: n, children: d })
|
|
2895
2895
|
] }),
|
|
2896
2896
|
/* @__PURE__ */ t(H, {})
|
|
2897
2897
|
]
|
|
@@ -2910,7 +2910,7 @@ function Pa({
|
|
|
2910
2910
|
allowAuthSkip: c = !1,
|
|
2911
2911
|
allowAccessCodeSkip: g = !1,
|
|
2912
2912
|
authTitle: d,
|
|
2913
|
-
authDescription:
|
|
2913
|
+
authDescription: b,
|
|
2914
2914
|
accessCodeTitle: m,
|
|
2915
2915
|
accessCodeDescription: v,
|
|
2916
2916
|
startsAt: w,
|
|
@@ -2920,7 +2920,7 @@ function Pa({
|
|
|
2920
2920
|
return e === "none" ? /* @__PURE__ */ t(Me, { children: C }) : e === "loading" ? /* @__PURE__ */ t(
|
|
2921
2921
|
"div",
|
|
2922
2922
|
{
|
|
2923
|
-
className:
|
|
2923
|
+
className: E(
|
|
2924
2924
|
"fanfare-journey-gate",
|
|
2925
2925
|
"ff:flex ff:flex-col ff:items-center ff:justify-center ff:py-12",
|
|
2926
2926
|
y
|
|
@@ -2931,11 +2931,11 @@ function Pa({
|
|
|
2931
2931
|
"aria-busy": "true",
|
|
2932
2932
|
children: /* @__PURE__ */ t(Te, { size: "lg", className: "ff:text-primary" })
|
|
2933
2933
|
}
|
|
2934
|
-
) : e === "auth" ? /* @__PURE__ */ t("div", { className:
|
|
2934
|
+
) : e === "auth" ? /* @__PURE__ */ t("div", { className: E("fanfare-journey-gate", y), "data-slot": "journey-gate", children: /* @__PURE__ */ t(
|
|
2935
2935
|
Aa,
|
|
2936
2936
|
{
|
|
2937
2937
|
title: d,
|
|
2938
|
-
description:
|
|
2938
|
+
description: b,
|
|
2939
2939
|
countdownTo: w,
|
|
2940
2940
|
onSubmit: a,
|
|
2941
2941
|
onVerify: r,
|
|
@@ -2943,8 +2943,8 @@ function Pa({
|
|
|
2943
2943
|
onSuccess: o,
|
|
2944
2944
|
allowSkip: c
|
|
2945
2945
|
}
|
|
2946
|
-
) }) : e === "access_code" ? /* @__PURE__ */ t("div", { className:
|
|
2947
|
-
|
|
2946
|
+
) }) : e === "access_code" ? /* @__PURE__ */ t("div", { className: E("fanfare-journey-gate", y), "data-slot": "journey-gate", children: /* @__PURE__ */ t(
|
|
2947
|
+
za,
|
|
2948
2948
|
{
|
|
2949
2949
|
title: m,
|
|
2950
2950
|
description: v,
|
|
@@ -3051,7 +3051,7 @@ const Kn = te(["ff:animate-pulse ff:rounded-md", "ff:bg-secondary"], {
|
|
|
3051
3051
|
}
|
|
3052
3052
|
}), $a = s.forwardRef(({ className: e, ...a }, r) => {
|
|
3053
3053
|
const n = ge();
|
|
3054
|
-
return /* @__PURE__ */ t("div", { ref: r, "data-slot": "skeleton", className:
|
|
3054
|
+
return /* @__PURE__ */ t("div", { ref: r, "data-slot": "skeleton", className: E(Kn({ styleVariant: n }), e), ...a });
|
|
3055
3055
|
});
|
|
3056
3056
|
$a.displayName = "Skeleton";
|
|
3057
3057
|
const Zn = (e, a) => /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ref: a, ...e, children: /* @__PURE__ */ t("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5m-9-6h.008v.008H12zM12 15h.008v.008H12zm0 2.25h.008v.008H12zM9.75 15h.008v.008H9.75zm0 2.25h.008v.008H9.75zM7.5 15h.008v.008H7.5zm0 2.25h.008v.008H7.5zm6.75-4.5h.008v.008h-.008zm0 2.25h.008v.008h-.008zm0 2.25h.008v.008h-.008zm2.25-4.5h.008v.008H16.5zm0 2.25h.008v.008H16.5z" }) }), Yn = kt(Zn), Gn = (e, a) => /* @__PURE__ */ t("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ref: a, ...e, children: /* @__PURE__ */ t("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "m15.75 10.5l4.72-4.72a.75.75 0 0 1 1.28.53v11.38a.75.75 0 0 1-1.28.53l-4.72-4.72M4.5 18.75h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25h-9A2.25 2.25 0 0 0 2.25 7.5v9a2.25 2.25 0 0 0 2.25 2.25" }) }), qa = kt(Gn);
|
|
@@ -3066,7 +3066,7 @@ function Wa({
|
|
|
3066
3066
|
isCancelling: c,
|
|
3067
3067
|
cancelError: g
|
|
3068
3068
|
}) {
|
|
3069
|
-
const { t: d } = K(), [
|
|
3069
|
+
const { t: d } = K(), [b, m] = s.useState(!1), v = $n(e.startTime, a), w = qn(e.startTime, a), y = Bt(e.startTime, a), C = Ba(e.startTime, e.endTime), l = !e.locationName, h = l ? d("appointment.online") : e.locationName, p = l ? {
|
|
3070
3070
|
label: d("appointment.joinCall"),
|
|
3071
3071
|
onClick: () => {
|
|
3072
3072
|
f ? f() : e.joinUrl && window.open(e.joinUrl, "_blank", "noopener,noreferrer");
|
|
@@ -3099,16 +3099,16 @@ function Wa({
|
|
|
3099
3099
|
/* @__PURE__ */ t("span", { className: "ff:font-mono ff:font-semibold ff:text-foreground", children: e.confirmationCode })
|
|
3100
3100
|
] })
|
|
3101
3101
|
] }),
|
|
3102
|
-
!r && /* @__PURE__ */ t(
|
|
3102
|
+
!r && /* @__PURE__ */ t(j, { size: "md", className: "ff:w-full", onClick: p.onClick, disabled: p.disabled, children: /* @__PURE__ */ u("span", { className: "ff:flex ff:items-center ff:gap-1.5", children: [
|
|
3103
3103
|
p.icon,
|
|
3104
3104
|
p.label
|
|
3105
3105
|
] }) }),
|
|
3106
3106
|
/* @__PURE__ */ t(nt, { show: !!g, children: g && /* @__PURE__ */ t(be, { tone: "danger", description: g }) }),
|
|
3107
|
-
/* @__PURE__ */ t(nt, { show: !r &&
|
|
3107
|
+
/* @__PURE__ */ t(nt, { show: !r && b, children: !r && b && /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:gap-2", children: [
|
|
3108
3108
|
/* @__PURE__ */ t(be, { tone: "danger", title: d("appointment.cancelConfirm") }),
|
|
3109
3109
|
/* @__PURE__ */ u("div", { className: "ff:flex ff:gap-2", children: [
|
|
3110
3110
|
/* @__PURE__ */ t(
|
|
3111
|
-
|
|
3111
|
+
j,
|
|
3112
3112
|
{
|
|
3113
3113
|
size: "sm",
|
|
3114
3114
|
variant: "destructive",
|
|
@@ -3120,7 +3120,7 @@ function Wa({
|
|
|
3120
3120
|
}
|
|
3121
3121
|
),
|
|
3122
3122
|
/* @__PURE__ */ t(
|
|
3123
|
-
|
|
3123
|
+
j,
|
|
3124
3124
|
{
|
|
3125
3125
|
size: "sm",
|
|
3126
3126
|
variant: "outline",
|
|
@@ -3132,10 +3132,10 @@ function Wa({
|
|
|
3132
3132
|
)
|
|
3133
3133
|
] })
|
|
3134
3134
|
] }) }),
|
|
3135
|
-
!r && !
|
|
3136
|
-
/* @__PURE__ */ t(
|
|
3135
|
+
!r && !b && /* @__PURE__ */ u("div", { className: "ff:flex ff:items-center ff:justify-center ff:gap-3 ff:text-xs", children: [
|
|
3136
|
+
/* @__PURE__ */ t(j, { variant: "link", size: "xs", onClick: o, children: d("appointment.reschedule") }),
|
|
3137
3137
|
/* @__PURE__ */ t("span", { "aria-hidden": "true", className: "ff:text-muted", children: "·" }),
|
|
3138
|
-
/* @__PURE__ */ t(
|
|
3138
|
+
/* @__PURE__ */ t(j, { variant: "link", size: "xs", onClick: () => m(!0), disabled: c, children: d("appointment.cancel") })
|
|
3139
3139
|
] })
|
|
3140
3140
|
] });
|
|
3141
3141
|
}
|
|
@@ -3170,7 +3170,7 @@ function Ua({ booking: e, timezone: a, onJoinCall: r, onShowPass: n }) {
|
|
|
3170
3170
|
] })
|
|
3171
3171
|
] }),
|
|
3172
3172
|
i ? /* @__PURE__ */ t(
|
|
3173
|
-
|
|
3173
|
+
j,
|
|
3174
3174
|
{
|
|
3175
3175
|
size: "md",
|
|
3176
3176
|
className: "ff:w-full",
|
|
@@ -3183,7 +3183,7 @@ function Ua({ booking: e, timezone: a, onJoinCall: r, onShowPass: n }) {
|
|
|
3183
3183
|
o("appointment.joinCall")
|
|
3184
3184
|
] })
|
|
3185
3185
|
}
|
|
3186
|
-
) : /* @__PURE__ */ t(
|
|
3186
|
+
) : /* @__PURE__ */ t(j, { size: "md", variant: "outline", className: "ff:w-full", onClick: () => n?.(), disabled: !n, children: o("appointment.showPass") })
|
|
3187
3187
|
]
|
|
3188
3188
|
}
|
|
3189
3189
|
);
|
|
@@ -3194,7 +3194,7 @@ function ma(e, a, r, n) {
|
|
|
3194
3194
|
return `${e}:${a}:${r}:${n ?? ""}`;
|
|
3195
3195
|
}
|
|
3196
3196
|
function Qn(e, a) {
|
|
3197
|
-
const r = Nt(), [n, o] = s.useState([]), [i, f] = s.useState(!1), [c, g] = s.useState(null), [d,
|
|
3197
|
+
const r = Nt(), [n, o] = s.useState([]), [i, f] = s.useState(!1), [c, g] = s.useState(null), [d, b] = s.useState(0), { startDate: m, endDate: v, timezone: w } = a;
|
|
3198
3198
|
s.useEffect(() => {
|
|
3199
3199
|
if (!e || !m || !v) {
|
|
3200
3200
|
o([]), g(null), f(!1);
|
|
@@ -3217,7 +3217,7 @@ function Qn(e, a) {
|
|
|
3217
3217
|
};
|
|
3218
3218
|
}, [r, e, m, v, w, d]);
|
|
3219
3219
|
const y = s.useCallback(() => {
|
|
3220
|
-
e && m && v && Mt.delete(ma(e, m, v, w)),
|
|
3220
|
+
e && m && v && Mt.delete(ma(e, m, v, w)), b((C) => C + 1);
|
|
3221
3221
|
}, [e, m, v, w]);
|
|
3222
3222
|
return { slots: n, isLoading: i, error: c, refresh: y };
|
|
3223
3223
|
}
|
|
@@ -3325,13 +3325,13 @@ function Za({
|
|
|
3325
3325
|
className: "ff:grid ff:grid-cols-3 ff:gap-1 ff:overflow-y-auto ff:max-h-44",
|
|
3326
3326
|
"data-slot": "appointment-slot-grid",
|
|
3327
3327
|
children: e.map((f) => {
|
|
3328
|
-
const c = f.available <= 0, g = r === f.id, d = Oa(f),
|
|
3328
|
+
const c = f.available <= 0, g = r === f.id, d = Oa(f), b = c ? i("appointment.slotFullAriaLabel", { values: { time: d } }) : d;
|
|
3329
3329
|
return /* @__PURE__ */ t(
|
|
3330
3330
|
Ka,
|
|
3331
3331
|
{
|
|
3332
3332
|
slotId: f.id,
|
|
3333
3333
|
timeLabel: d,
|
|
3334
|
-
ariaLabel:
|
|
3334
|
+
ariaLabel: b,
|
|
3335
3335
|
isFull: c,
|
|
3336
3336
|
isSelected: g,
|
|
3337
3337
|
onSelect: n
|
|
@@ -3358,26 +3358,26 @@ function Ya({
|
|
|
3358
3358
|
), g = s.useMemo(
|
|
3359
3359
|
() => r ? gt(new Date(r), n) : void 0,
|
|
3360
3360
|
[r, n]
|
|
3361
|
-
), { startDate: d, endDate:
|
|
3362
|
-
const N = gt(/* @__PURE__ */ new Date(), n), S = c && c > N ? c : N,
|
|
3361
|
+
), { startDate: d, endDate: b } = s.useMemo(() => {
|
|
3362
|
+
const N = gt(/* @__PURE__ */ new Date(), n), S = c && c > N ? c : N, M = ga(S, ha - 1), A = g && g < M ? g : M;
|
|
3363
3363
|
return { startDate: S, endDate: A };
|
|
3364
|
-
}, [c, g, n]), { slots: m, isLoading: v, error: w } = Qn(e, { startDate: d, endDate:
|
|
3364
|
+
}, [c, g, n]), { slots: m, isLoading: v, error: w } = Qn(e, { startDate: d, endDate: b, timezone: n }), y = s.useMemo(() => {
|
|
3365
3365
|
const N = /* @__PURE__ */ new Map();
|
|
3366
3366
|
for (const S of m) {
|
|
3367
|
-
const
|
|
3368
|
-
A ? A.push(S) : N.set(
|
|
3367
|
+
const M = S.startTime ? gt(new Date(S.startTime), S.timezone ?? n) : S.id.slice(0, 10), A = N.get(M);
|
|
3368
|
+
A ? A.push(S) : N.set(M, [S]);
|
|
3369
3369
|
}
|
|
3370
3370
|
return N;
|
|
3371
3371
|
}, [m, n]), C = s.useMemo(() => {
|
|
3372
3372
|
const N = [];
|
|
3373
3373
|
for (let S = 0; S < ha; S += 1) {
|
|
3374
|
-
const
|
|
3375
|
-
if (g &&
|
|
3376
|
-
const A = y.get(
|
|
3374
|
+
const M = ga(d, S);
|
|
3375
|
+
if (g && M > g) break;
|
|
3376
|
+
const A = y.get(M) ?? [], I = A.some(($) => $.available > 0), O = !v && A.length === 0;
|
|
3377
3377
|
N.push({
|
|
3378
|
-
date:
|
|
3379
|
-
weekdayLabel: Un(
|
|
3380
|
-
dayNumber: Hn(
|
|
3378
|
+
date: M,
|
|
3379
|
+
weekdayLabel: Un(M),
|
|
3380
|
+
dayNumber: Hn(M),
|
|
3381
3381
|
hasAvailability: I,
|
|
3382
3382
|
isClosed: O
|
|
3383
3383
|
});
|
|
@@ -3389,15 +3389,15 @@ function Ya({
|
|
|
3389
3389
|
const N = C.find((S) => !S.isClosed);
|
|
3390
3390
|
N && (h(N.date), D(null));
|
|
3391
3391
|
}, [C, l]);
|
|
3392
|
-
const
|
|
3392
|
+
const V = s.useMemo(() => l ? y.get(l) ?? [] : [], [l, y]);
|
|
3393
3393
|
s.useEffect(() => {
|
|
3394
3394
|
if (!o) return;
|
|
3395
|
-
const N =
|
|
3395
|
+
const N = V.find((S) => S.id === p) ?? null;
|
|
3396
3396
|
o(N);
|
|
3397
|
-
}, [
|
|
3397
|
+
}, [V, p, o]);
|
|
3398
3398
|
const T = s.useCallback((N) => {
|
|
3399
3399
|
h(N), D(null);
|
|
3400
|
-
}, []),
|
|
3400
|
+
}, []), x = s.useCallback((N) => {
|
|
3401
3401
|
D((S) => S === N ? null : N);
|
|
3402
3402
|
}, []);
|
|
3403
3403
|
return /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:gap-2", children: [
|
|
@@ -3405,10 +3405,10 @@ function Ya({
|
|
|
3405
3405
|
/* @__PURE__ */ t(
|
|
3406
3406
|
Za,
|
|
3407
3407
|
{
|
|
3408
|
-
slots:
|
|
3408
|
+
slots: V,
|
|
3409
3409
|
isLoading: v,
|
|
3410
3410
|
selectedSlotId: p,
|
|
3411
|
-
onSelect:
|
|
3411
|
+
onSelect: x
|
|
3412
3412
|
}
|
|
3413
3413
|
),
|
|
3414
3414
|
(i || w) && /* @__PURE__ */ t(be, { tone: "danger", description: i ?? w?.message ?? f("appointment.bookingFailed") })
|
|
@@ -3427,7 +3427,7 @@ function At({
|
|
|
3427
3427
|
onBook: c,
|
|
3428
3428
|
onCancel: g,
|
|
3429
3429
|
onReschedule: d,
|
|
3430
|
-
isBooking:
|
|
3430
|
+
isBooking: b,
|
|
3431
3431
|
isCancelling: m,
|
|
3432
3432
|
isRescheduling: v,
|
|
3433
3433
|
bookError: w,
|
|
@@ -3437,7 +3437,7 @@ function At({
|
|
|
3437
3437
|
isReentering: h,
|
|
3438
3438
|
className: p
|
|
3439
3439
|
}) {
|
|
3440
|
-
const { t: D } = K(),
|
|
3440
|
+
const { t: D } = K(), V = ze(a ?? eo), [T, x] = s.useState(!1), N = we();
|
|
3441
3441
|
if (r === "ended")
|
|
3442
3442
|
return /* @__PURE__ */ t(We, { outcomeReason: C ?? "ended", participationType: "appointment", className: p });
|
|
3443
3443
|
if (r === "participating" && T)
|
|
@@ -3455,8 +3455,8 @@ function At({
|
|
|
3455
3455
|
idleLabelKey: "appointment.selectATime",
|
|
3456
3456
|
isPending: v,
|
|
3457
3457
|
error: w,
|
|
3458
|
-
onConfirm: async (S,
|
|
3459
|
-
await d(S,
|
|
3458
|
+
onConfirm: async (S, M) => {
|
|
3459
|
+
await d(S, M), x(!1);
|
|
3460
3460
|
},
|
|
3461
3461
|
className: p,
|
|
3462
3462
|
motionProps: N,
|
|
@@ -3465,11 +3465,11 @@ function At({
|
|
|
3465
3465
|
}
|
|
3466
3466
|
);
|
|
3467
3467
|
if (r === "participating") {
|
|
3468
|
-
const S =
|
|
3468
|
+
const S = V.booking, M = S?.consumerStatus, A = M === "checked_in", I = M === "completed", O = I ? "completed" : A ? "checked_in" : "booked", $ = D(I ? "appointment.completedTitle" : A ? "appointment.checkedIn" : "appointment.bookedTitle");
|
|
3469
3469
|
return /* @__PURE__ */ t(U.div, { ...N, children: /* @__PURE__ */ u(
|
|
3470
3470
|
Y,
|
|
3471
3471
|
{
|
|
3472
|
-
className:
|
|
3472
|
+
className: E("ff:w-full ff:max-w-sm", p),
|
|
3473
3473
|
"data-slot": "appointment-module",
|
|
3474
3474
|
"data-stage": "participating",
|
|
3475
3475
|
"data-substage": O,
|
|
@@ -3482,7 +3482,7 @@ function At({
|
|
|
3482
3482
|
timezone: i,
|
|
3483
3483
|
readOnly: I,
|
|
3484
3484
|
onCancel: () => g(),
|
|
3485
|
-
onStartReschedule: () =>
|
|
3485
|
+
onStartReschedule: () => x(!0),
|
|
3486
3486
|
isCancelling: m,
|
|
3487
3487
|
cancelError: y
|
|
3488
3488
|
}
|
|
@@ -3503,7 +3503,7 @@ function At({
|
|
|
3503
3503
|
headingVariant: "default",
|
|
3504
3504
|
confirmLabelKey: "appointment.continueWithTime",
|
|
3505
3505
|
idleLabelKey: "appointment.selectATime",
|
|
3506
|
-
isPending:
|
|
3506
|
+
isPending: b,
|
|
3507
3507
|
error: w,
|
|
3508
3508
|
onConfirm: c,
|
|
3509
3509
|
className: p,
|
|
@@ -3524,14 +3524,14 @@ function wa({
|
|
|
3524
3524
|
confirmLabelKey: c,
|
|
3525
3525
|
idleLabelKey: g,
|
|
3526
3526
|
isPending: d,
|
|
3527
|
-
error:
|
|
3527
|
+
error: b,
|
|
3528
3528
|
onConfirm: m,
|
|
3529
3529
|
className: v,
|
|
3530
3530
|
motionProps: w,
|
|
3531
3531
|
dataStage: y,
|
|
3532
3532
|
dataMode: C
|
|
3533
3533
|
}) {
|
|
3534
|
-
const { t: l } = K(), [h, p] = s.useState(null), D = h ? l(c, { values: { time: Oa(h) } }) : l(g),
|
|
3534
|
+
const { t: l } = K(), [h, p] = s.useState(null), D = h ? l(c, { values: { time: Oa(h) } }) : l(g), V = s.useCallback(async () => {
|
|
3535
3535
|
if (!h) return;
|
|
3536
3536
|
const T = h.locationId ?? o;
|
|
3537
3537
|
await m(h.id, T);
|
|
@@ -3539,7 +3539,7 @@ function wa({
|
|
|
3539
3539
|
return /* @__PURE__ */ t(U.div, { ...w, children: /* @__PURE__ */ u(
|
|
3540
3540
|
Y,
|
|
3541
3541
|
{
|
|
3542
|
-
className:
|
|
3542
|
+
className: E("ff:w-full ff:max-w-sm", v),
|
|
3543
3543
|
"data-slot": "appointment-module",
|
|
3544
3544
|
"data-stage": y,
|
|
3545
3545
|
"data-mode": C,
|
|
@@ -3553,15 +3553,15 @@ function wa({
|
|
|
3553
3553
|
bookingWindowCloseAt: r,
|
|
3554
3554
|
timezone: n,
|
|
3555
3555
|
onSlotChange: p,
|
|
3556
|
-
bookError:
|
|
3556
|
+
bookError: b
|
|
3557
3557
|
}
|
|
3558
3558
|
) }),
|
|
3559
3559
|
/* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(
|
|
3560
|
-
|
|
3560
|
+
j,
|
|
3561
3561
|
{
|
|
3562
3562
|
size: "sm",
|
|
3563
3563
|
className: "ff:w-full",
|
|
3564
|
-
onClick:
|
|
3564
|
+
onClick: V,
|
|
3565
3565
|
disabled: !h || d,
|
|
3566
3566
|
loading: d,
|
|
3567
3567
|
children: D
|
|
@@ -3621,7 +3621,7 @@ function tt({
|
|
|
3621
3621
|
onBid: c,
|
|
3622
3622
|
isEntering: g,
|
|
3623
3623
|
isLeaving: d,
|
|
3624
|
-
countdownTo:
|
|
3624
|
+
countdownTo: b,
|
|
3625
3625
|
defaultBidAmount: m,
|
|
3626
3626
|
currencyCode: v,
|
|
3627
3627
|
locale: w,
|
|
@@ -3631,16 +3631,13 @@ function tt({
|
|
|
3631
3631
|
onCheckoutClick: h,
|
|
3632
3632
|
outcomeReason: p,
|
|
3633
3633
|
onReenter: D,
|
|
3634
|
-
isReentering:
|
|
3634
|
+
isReentering: V,
|
|
3635
3635
|
className: T
|
|
3636
3636
|
}) {
|
|
3637
|
-
const { t:
|
|
3637
|
+
const { t: x } = K(), N = ze(e ?? ro), S = s.useMemo(
|
|
3638
3638
|
() => no(a, N),
|
|
3639
3639
|
[a, N]
|
|
3640
|
-
),
|
|
3641
|
-
() => x ?? (S.closeAt ? new Date(S.closeAt) : void 0),
|
|
3642
|
-
[x, S.closeAt]
|
|
3643
|
-
), A = s.useMemo(() => {
|
|
3640
|
+
), M = s.useMemo(() => S.settleAt ? new Date(S.settleAt) : b || (S.closeAt ? new Date(S.closeAt) : void 0), [b, S.settleAt, S.closeAt]), A = s.useMemo(() => {
|
|
3644
3641
|
if (C)
|
|
3645
3642
|
return C instanceof Date ? C : new Date(C);
|
|
3646
3643
|
}, [C]), I = S.currencyCode ?? v, O = s.useCallback(
|
|
@@ -3664,59 +3661,59 @@ function tt({
|
|
|
3664
3661
|
return /* @__PURE__ */ t(U.div, { ...$, children: /* @__PURE__ */ u(
|
|
3665
3662
|
Y,
|
|
3666
3663
|
{
|
|
3667
|
-
className:
|
|
3664
|
+
className: E("ff:w-full ff:max-w-sm", T),
|
|
3668
3665
|
"data-slot": "auction-module",
|
|
3669
3666
|
"data-stage": "enterable",
|
|
3670
3667
|
children: [
|
|
3671
|
-
/* @__PURE__ */ t(G, { variant: "default", label:
|
|
3668
|
+
/* @__PURE__ */ t(G, { variant: "default", label: x("auction.title") }),
|
|
3672
3669
|
/* @__PURE__ */ u(Z, { children: [
|
|
3673
|
-
|
|
3674
|
-
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children:
|
|
3675
|
-
/* @__PURE__ */ t(pe, { targetDate:
|
|
3670
|
+
M && /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
3671
|
+
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: x("auction.endsIn") }),
|
|
3672
|
+
/* @__PURE__ */ t(pe, { targetDate: M, showDays: !1 })
|
|
3676
3673
|
] }),
|
|
3677
|
-
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children:
|
|
3678
|
-
c ? /* @__PURE__ */ t(
|
|
3674
|
+
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: x("auction.description") }) }),
|
|
3675
|
+
c ? /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", onClick: ce, children: x("auction.bidAction") }) : n && /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", onClick: i, disabled: g, loading: g, children: x("auction.enter") })
|
|
3679
3676
|
] }),
|
|
3680
3677
|
/* @__PURE__ */ t(H, {})
|
|
3681
3678
|
]
|
|
3682
3679
|
}
|
|
3683
3680
|
) });
|
|
3684
3681
|
if (r === "participating") {
|
|
3685
|
-
const L = S.status === "winning", J = L ? "default" : "success", ne =
|
|
3682
|
+
const L = S.status === "winning", J = L ? "default" : "success", ne = x(L ? "auction.winningTitle" : "auction.title"), se = O(S.highestBid), de = O(S.currentBid);
|
|
3686
3683
|
return /* @__PURE__ */ t(U.div, { ...$, children: /* @__PURE__ */ u(
|
|
3687
3684
|
Y,
|
|
3688
3685
|
{
|
|
3689
|
-
className:
|
|
3686
|
+
className: E("ff:w-full ff:max-w-sm", T),
|
|
3690
3687
|
"data-slot": "auction-module",
|
|
3691
3688
|
"data-stage": "participating",
|
|
3692
3689
|
children: [
|
|
3693
3690
|
/* @__PURE__ */ t(G, { variant: J, label: ne }),
|
|
3694
3691
|
/* @__PURE__ */ u(Z, { children: [
|
|
3695
|
-
|
|
3696
|
-
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children:
|
|
3697
|
-
/* @__PURE__ */ t(pe, { targetDate:
|
|
3692
|
+
M && /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
3693
|
+
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: x("auction.endsIn") }),
|
|
3694
|
+
/* @__PURE__ */ t(pe, { targetDate: M, showDays: !1 })
|
|
3698
3695
|
] }),
|
|
3699
3696
|
/* @__PURE__ */ u(ie, { children: [
|
|
3700
3697
|
se !== void 0 && /* @__PURE__ */ u("div", { className: "ff:flex ff:items-center ff:justify-between", children: [
|
|
3701
|
-
/* @__PURE__ */ t("span", { className: "ff:text-muted", children:
|
|
3698
|
+
/* @__PURE__ */ t("span", { className: "ff:text-muted", children: x("auction.currentBid") }),
|
|
3702
3699
|
/* @__PURE__ */ t("span", { className: "ff:font-medium ff:tabular-nums", children: se })
|
|
3703
3700
|
] }),
|
|
3704
3701
|
de !== void 0 && /* @__PURE__ */ u("div", { className: "ff:flex ff:items-center ff:justify-between", children: [
|
|
3705
|
-
/* @__PURE__ */ t("span", { className: "ff:text-muted", children:
|
|
3702
|
+
/* @__PURE__ */ t("span", { className: "ff:text-muted", children: x(L ? "auction.yourWinningBid" : "auction.yourBidLabel") }),
|
|
3706
3703
|
/* @__PURE__ */ t("span", { className: "ff:font-medium ff:tabular-nums", children: de })
|
|
3707
3704
|
] })
|
|
3708
3705
|
] }),
|
|
3709
3706
|
/* @__PURE__ */ u("div", { className: "ff:mt-auto ff:flex ff:flex-col ff:gap-2", children: [
|
|
3710
|
-
c && /* @__PURE__ */ t(
|
|
3707
|
+
c && /* @__PURE__ */ t(j, { className: "ff:w-full", onClick: ce, children: x("auction.bidAction") }),
|
|
3711
3708
|
o && /* @__PURE__ */ t(
|
|
3712
|
-
|
|
3709
|
+
j,
|
|
3713
3710
|
{
|
|
3714
3711
|
className: "ff:w-full",
|
|
3715
3712
|
variant: "outline",
|
|
3716
3713
|
onClick: f,
|
|
3717
3714
|
disabled: d,
|
|
3718
3715
|
loading: d,
|
|
3719
|
-
children:
|
|
3716
|
+
children: x("common.leave")
|
|
3720
3717
|
}
|
|
3721
3718
|
)
|
|
3722
3719
|
] })
|
|
@@ -3731,15 +3728,15 @@ function tt({
|
|
|
3731
3728
|
return /* @__PURE__ */ t(U.div, { ...$, children: /* @__PURE__ */ u(
|
|
3732
3729
|
Y,
|
|
3733
3730
|
{
|
|
3734
|
-
className:
|
|
3731
|
+
className: E("ff:w-full ff:max-w-sm", T),
|
|
3735
3732
|
"data-slot": "auction-module",
|
|
3736
3733
|
"data-stage": "settling",
|
|
3737
3734
|
children: [
|
|
3738
|
-
/* @__PURE__ */ t(G, { variant: "default", label:
|
|
3735
|
+
/* @__PURE__ */ t(G, { variant: "default", label: x("auction.settlingTitle") }),
|
|
3739
3736
|
/* @__PURE__ */ t(Z, { children: /* @__PURE__ */ u(ie, { children: [
|
|
3740
|
-
/* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children:
|
|
3737
|
+
/* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: x("auction.settlingDescription") }),
|
|
3741
3738
|
L !== void 0 && /* @__PURE__ */ u("div", { className: "ff:mt-3 ff:flex ff:items-center ff:justify-between", children: [
|
|
3742
|
-
/* @__PURE__ */ t("span", { className: "ff:text-muted", children:
|
|
3739
|
+
/* @__PURE__ */ t("span", { className: "ff:text-muted", children: x("auction.currentBid") }),
|
|
3743
3740
|
/* @__PURE__ */ t("span", { className: "ff:font-medium ff:tabular-nums", children: L })
|
|
3744
3741
|
] })
|
|
3745
3742
|
] }) }),
|
|
@@ -3751,9 +3748,9 @@ function tt({
|
|
|
3751
3748
|
return r === "granted" ? /* @__PURE__ */ t(
|
|
3752
3749
|
it,
|
|
3753
3750
|
{
|
|
3754
|
-
label:
|
|
3755
|
-
fallbackMessage:
|
|
3756
|
-
ctaLabel:
|
|
3751
|
+
label: x("auction.wonTitle"),
|
|
3752
|
+
fallbackMessage: x("auction.wonDescription"),
|
|
3753
|
+
ctaLabel: x("auction.proceedToCheckout"),
|
|
3757
3754
|
expiresAt: A,
|
|
3758
3755
|
onCtaClick: fe,
|
|
3759
3756
|
className: T
|
|
@@ -3764,7 +3761,7 @@ function tt({
|
|
|
3764
3761
|
outcomeReason: p ?? "ended",
|
|
3765
3762
|
participationType: "auction",
|
|
3766
3763
|
onReenter: D,
|
|
3767
|
-
isReentering:
|
|
3764
|
+
isReentering: V,
|
|
3768
3765
|
className: T
|
|
3769
3766
|
}
|
|
3770
3767
|
) : null;
|
|
@@ -3782,7 +3779,7 @@ function at({
|
|
|
3782
3779
|
isLeaving: c,
|
|
3783
3780
|
countdownTo: g,
|
|
3784
3781
|
grant: d,
|
|
3785
|
-
expiresAt:
|
|
3782
|
+
expiresAt: b,
|
|
3786
3783
|
checkoutUrl: m,
|
|
3787
3784
|
onCheckoutClick: v,
|
|
3788
3785
|
outcomeReason: w,
|
|
@@ -3790,29 +3787,29 @@ function at({
|
|
|
3790
3787
|
isReentering: C,
|
|
3791
3788
|
className: l
|
|
3792
3789
|
}) {
|
|
3793
|
-
const { t: h } = K(), p =
|
|
3790
|
+
const { t: h } = K(), p = ze(e ?? oo), D = s.useMemo(
|
|
3794
3791
|
() => g ?? (p.drawTime ? new Date(p.drawTime) : void 0),
|
|
3795
3792
|
[g, p.drawTime]
|
|
3796
|
-
),
|
|
3797
|
-
if (
|
|
3798
|
-
return
|
|
3799
|
-
}, [
|
|
3793
|
+
), V = s.useMemo(() => {
|
|
3794
|
+
if (b)
|
|
3795
|
+
return b instanceof Date ? b : new Date(b);
|
|
3796
|
+
}, [b]), T = we(), x = () => {
|
|
3800
3797
|
v ? v() : m && window.open(m, "_blank", "noopener,noreferrer");
|
|
3801
3798
|
};
|
|
3802
|
-
return a === "enterable" ? /* @__PURE__ */ t(U.div, { ...T, children: /* @__PURE__ */ u(Y, { className:
|
|
3799
|
+
return a === "enterable" ? /* @__PURE__ */ t(U.div, { ...T, children: /* @__PURE__ */ u(Y, { className: E("ff:w-full ff:max-w-sm", l), "data-slot": "draw-module", "data-stage": "enterable", children: [
|
|
3803
3800
|
/* @__PURE__ */ t(G, { variant: "default", label: h("draw.title") }),
|
|
3804
3801
|
/* @__PURE__ */ u(Z, { children: [
|
|
3805
3802
|
D && /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
3806
3803
|
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: h("draw.drawClosesIn") }),
|
|
3807
3804
|
/* @__PURE__ */ t(pe, { targetDate: D, showDays: !1 })
|
|
3808
3805
|
] }),
|
|
3809
|
-
r && /* @__PURE__ */ t(
|
|
3806
|
+
r && /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", onClick: o, disabled: f, loading: f, children: h("draw.enter") })
|
|
3810
3807
|
] }),
|
|
3811
3808
|
/* @__PURE__ */ t(H, {})
|
|
3812
3809
|
] }) }) : a === "participating" ? /* @__PURE__ */ t(U.div, { ...T, children: /* @__PURE__ */ u(
|
|
3813
3810
|
Y,
|
|
3814
3811
|
{
|
|
3815
|
-
className:
|
|
3812
|
+
className: E("ff:w-full ff:max-w-sm", l),
|
|
3816
3813
|
"data-slot": "draw-module",
|
|
3817
3814
|
"data-stage": "participating",
|
|
3818
3815
|
children: [
|
|
@@ -3825,7 +3822,7 @@ function at({
|
|
|
3825
3822
|
] }) : null,
|
|
3826
3823
|
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: h(D ? "draw.goodLuck" : "draw.stayTuned") }) }),
|
|
3827
3824
|
n && /* @__PURE__ */ t(
|
|
3828
|
-
|
|
3825
|
+
j,
|
|
3829
3826
|
{
|
|
3830
3827
|
className: "ff:mt-auto ff:w-full",
|
|
3831
3828
|
variant: "outline",
|
|
@@ -3839,7 +3836,7 @@ function at({
|
|
|
3839
3836
|
/* @__PURE__ */ t(H, {})
|
|
3840
3837
|
]
|
|
3841
3838
|
}
|
|
3842
|
-
) }) : a === "settling" ? /* @__PURE__ */ t(U.div, { ...T, children: /* @__PURE__ */ u(Y, { className:
|
|
3839
|
+
) }) : a === "settling" ? /* @__PURE__ */ t(U.div, { ...T, children: /* @__PURE__ */ u(Y, { className: E("ff:w-full ff:max-w-sm", l), "data-slot": "draw-module", "data-stage": "settling", children: [
|
|
3843
3840
|
/* @__PURE__ */ t(G, { variant: "default", label: h("draw.settlingTitle") }),
|
|
3844
3841
|
/* @__PURE__ */ t(Z, { children: /* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: h("draw.settlingDescription") }) }) }),
|
|
3845
3842
|
/* @__PURE__ */ t(H, {})
|
|
@@ -3849,8 +3846,8 @@ function at({
|
|
|
3849
3846
|
label: h("draw.wonTitle"),
|
|
3850
3847
|
fallbackMessage: h("granted.description"),
|
|
3851
3848
|
ctaLabel: h("granted.cta"),
|
|
3852
|
-
expiresAt:
|
|
3853
|
-
onCtaClick:
|
|
3849
|
+
expiresAt: V,
|
|
3850
|
+
onCtaClick: x,
|
|
3854
3851
|
className: l
|
|
3855
3852
|
}
|
|
3856
3853
|
) : a === "ended" ? /* @__PURE__ */ t(
|
|
@@ -3877,7 +3874,7 @@ function wt({
|
|
|
3877
3874
|
isLeaving: c,
|
|
3878
3875
|
closeAt: g,
|
|
3879
3876
|
grant: d,
|
|
3880
|
-
expiresAt:
|
|
3877
|
+
expiresAt: b,
|
|
3881
3878
|
checkoutUrl: m,
|
|
3882
3879
|
onCheckoutClick: v,
|
|
3883
3880
|
outcomeReason: w,
|
|
@@ -3885,30 +3882,30 @@ function wt({
|
|
|
3885
3882
|
isReentering: C,
|
|
3886
3883
|
className: l
|
|
3887
3884
|
}) {
|
|
3888
|
-
const { t: h } = K(), p =
|
|
3889
|
-
if (
|
|
3890
|
-
return
|
|
3891
|
-
}, [
|
|
3885
|
+
const { t: h } = K(), p = ze(e ?? fo), D = s.useMemo(() => {
|
|
3886
|
+
if (b)
|
|
3887
|
+
return b instanceof Date ? b : new Date(b);
|
|
3888
|
+
}, [b]), V = we(), T = () => {
|
|
3892
3889
|
v ? v() : m && window.open(m, "_blank", "noopener,noreferrer");
|
|
3893
3890
|
};
|
|
3894
3891
|
if (a === "enterable")
|
|
3895
|
-
return /* @__PURE__ */ t(U.div, { ...
|
|
3892
|
+
return /* @__PURE__ */ t(U.div, { ...V, children: /* @__PURE__ */ u(Y, { className: E("ff:w-full ff:max-w-sm", l), "data-slot": "queue-module", "data-stage": "enterable", children: [
|
|
3896
3893
|
/* @__PURE__ */ t(G, { variant: "default", label: h("queue.openingSoon") }),
|
|
3897
3894
|
/* @__PURE__ */ u(Z, { children: [
|
|
3898
3895
|
g && /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
3899
3896
|
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: h("queue.queueClosesIn") }),
|
|
3900
3897
|
/* @__PURE__ */ t(pe, { targetDate: g, showDays: !1 })
|
|
3901
3898
|
] }),
|
|
3902
|
-
r && /* @__PURE__ */ t(
|
|
3899
|
+
r && /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", onClick: o, disabled: f, loading: f, children: h("queue.enter") })
|
|
3903
3900
|
] }),
|
|
3904
3901
|
/* @__PURE__ */ t(H, {})
|
|
3905
3902
|
] }) });
|
|
3906
3903
|
if (a === "participating") {
|
|
3907
|
-
const
|
|
3908
|
-
return /* @__PURE__ */ t(U.div, { ...
|
|
3904
|
+
const x = p.estimatedWaitTime, N = x != null ? Math.ceil(x / 60) : null, S = (O) => O < 1 ? h("queue.waitLessThanMinute") : O === 1 ? h("queue.waitOneMinute") : h("queue.waitMinutes", { values: { count: O } }), M = x != null ? Dr(x) : null, A = M ? h(Vr(M)) : null, I = N !== null ? S(N) : "...";
|
|
3905
|
+
return /* @__PURE__ */ t(U.div, { ...V, children: /* @__PURE__ */ u(
|
|
3909
3906
|
Y,
|
|
3910
3907
|
{
|
|
3911
|
-
className:
|
|
3908
|
+
className: E("ff:w-full ff:max-w-sm", l),
|
|
3912
3909
|
"data-slot": "queue-module",
|
|
3913
3910
|
"data-stage": "participating",
|
|
3914
3911
|
children: [
|
|
@@ -3921,7 +3918,7 @@ function wt({
|
|
|
3921
3918
|
] }),
|
|
3922
3919
|
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-muted ff:text-xs", children: h("queue.qualitativeReassurance") }) }),
|
|
3923
3920
|
n && /* @__PURE__ */ t(
|
|
3924
|
-
|
|
3921
|
+
j,
|
|
3925
3922
|
{
|
|
3926
3923
|
className: "ff:mt-auto ff:w-full",
|
|
3927
3924
|
variant: "outline",
|
|
@@ -3971,7 +3968,7 @@ function vt({
|
|
|
3971
3968
|
isEntering: c,
|
|
3972
3969
|
isLeaving: g,
|
|
3973
3970
|
countdownTo: d,
|
|
3974
|
-
checkoutUrl:
|
|
3971
|
+
checkoutUrl: b,
|
|
3975
3972
|
onCheckoutClick: m,
|
|
3976
3973
|
grant: v,
|
|
3977
3974
|
expiresAt: w,
|
|
@@ -3980,16 +3977,16 @@ function vt({
|
|
|
3980
3977
|
isReentering: l,
|
|
3981
3978
|
className: h
|
|
3982
3979
|
}) {
|
|
3983
|
-
const { t: p } = K(), D =
|
|
3980
|
+
const { t: p } = K(), D = ze(e ?? io), V = s.useMemo(() => {
|
|
3984
3981
|
if (w)
|
|
3985
3982
|
return w instanceof Date ? w : new Date(w);
|
|
3986
|
-
}, [w]), T =
|
|
3983
|
+
}, [w]), T = b ?? D.checkoutUrl, x = we(), N = () => {
|
|
3987
3984
|
m ? m() : T && window.open(T, "_blank", "noopener,noreferrer");
|
|
3988
3985
|
};
|
|
3989
|
-
return a === "enterable" ? /* @__PURE__ */ t(U.div, { ...
|
|
3986
|
+
return a === "enterable" ? /* @__PURE__ */ t(U.div, { ...x, children: /* @__PURE__ */ u(
|
|
3990
3987
|
Y,
|
|
3991
3988
|
{
|
|
3992
|
-
className:
|
|
3989
|
+
className: E("ff:w-full ff:max-w-sm", h),
|
|
3993
3990
|
"data-slot": "timed-release-module",
|
|
3994
3991
|
"data-stage": "enterable",
|
|
3995
3992
|
children: [
|
|
@@ -4000,15 +3997,15 @@ function vt({
|
|
|
4000
3997
|
/* @__PURE__ */ t(pe, { targetDate: d, showDays: !1 })
|
|
4001
3998
|
] }),
|
|
4002
3999
|
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: p("timedRelease.description") }) }),
|
|
4003
|
-
r && /* @__PURE__ */ t(
|
|
4000
|
+
r && /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", onClick: o, disabled: c, loading: c, children: p("timedRelease.enter") })
|
|
4004
4001
|
] }),
|
|
4005
4002
|
/* @__PURE__ */ t(H, {})
|
|
4006
4003
|
]
|
|
4007
4004
|
}
|
|
4008
|
-
) }) : a === "participating" ? /* @__PURE__ */ t(U.div, { ...
|
|
4005
|
+
) }) : a === "participating" ? /* @__PURE__ */ t(U.div, { ...x, children: /* @__PURE__ */ u(
|
|
4009
4006
|
Y,
|
|
4010
4007
|
{
|
|
4011
|
-
className:
|
|
4008
|
+
className: E("ff:w-full ff:max-w-sm", h),
|
|
4012
4009
|
"data-slot": "timed-release-module",
|
|
4013
4010
|
"data-stage": "participating",
|
|
4014
4011
|
children: [
|
|
@@ -4020,9 +4017,9 @@ function vt({
|
|
|
4020
4017
|
] }),
|
|
4021
4018
|
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: p("timedRelease.browseAndComplete") }) }),
|
|
4022
4019
|
/* @__PURE__ */ u("div", { className: "ff:mt-auto ff:flex ff:flex-col ff:gap-2", children: [
|
|
4023
|
-
T && /* @__PURE__ */ t(
|
|
4020
|
+
T && /* @__PURE__ */ t(j, { className: "ff:w-full", onClick: N, children: p("timedRelease.shop") }),
|
|
4024
4021
|
f && /* @__PURE__ */ t(
|
|
4025
|
-
|
|
4022
|
+
j,
|
|
4026
4023
|
{
|
|
4027
4024
|
className: "ff:w-full",
|
|
4028
4025
|
variant: T ? "secondary" : "primary",
|
|
@@ -4031,7 +4028,7 @@ function vt({
|
|
|
4031
4028
|
}
|
|
4032
4029
|
),
|
|
4033
4030
|
n && /* @__PURE__ */ t(
|
|
4034
|
-
|
|
4031
|
+
j,
|
|
4035
4032
|
{
|
|
4036
4033
|
className: "ff:w-full",
|
|
4037
4034
|
variant: "outline",
|
|
@@ -4052,7 +4049,7 @@ function vt({
|
|
|
4052
4049
|
label: p("timedRelease.granted"),
|
|
4053
4050
|
fallbackMessage: p("granted.description"),
|
|
4054
4051
|
ctaLabel: p("granted.cta"),
|
|
4055
|
-
expiresAt:
|
|
4052
|
+
expiresAt: V,
|
|
4056
4053
|
onCtaClick: N,
|
|
4057
4054
|
className: h
|
|
4058
4055
|
}
|
|
@@ -4079,9 +4076,9 @@ function Ga({
|
|
|
4079
4076
|
isEntering: c = !1,
|
|
4080
4077
|
className: g
|
|
4081
4078
|
}) {
|
|
4082
|
-
const { t: d } = K(),
|
|
4083
|
-
return /* @__PURE__ */ t(U.div, { ...w, children: /* @__PURE__ */ u(Y, { className:
|
|
4084
|
-
/* @__PURE__ */ t(G, { variant: "secondary", label:
|
|
4079
|
+
const { t: d } = K(), b = e ?? d("upcoming.title"), m = a ?? d("upcoming.description"), v = s.useMemo(() => r ? r instanceof Date ? r : new Date(r) : null, [r]), w = we();
|
|
4080
|
+
return /* @__PURE__ */ t(U.div, { ...w, children: /* @__PURE__ */ u(Y, { className: E("ff:w-full ff:max-w-sm", g), "data-slot": "upcoming-module", children: [
|
|
4081
|
+
/* @__PURE__ */ t(G, { variant: "secondary", label: b }),
|
|
4085
4082
|
/* @__PURE__ */ u(Z, { children: [
|
|
4086
4083
|
v && /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
4087
4084
|
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: d("countdown.startingSoon") }),
|
|
@@ -4095,7 +4092,7 @@ function Ga({
|
|
|
4095
4092
|
)
|
|
4096
4093
|
] }),
|
|
4097
4094
|
/* @__PURE__ */ t(ie, { children: /* @__PURE__ */ t("p", { className: "ff:text-foreground/80", children: m }) }),
|
|
4098
|
-
o && i && /* @__PURE__ */ t(
|
|
4095
|
+
o && i && /* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", onClick: i, disabled: c, loading: c, children: f ?? d("waitlist.enter") })
|
|
4099
4096
|
] }),
|
|
4100
4097
|
/* @__PURE__ */ t(H, {})
|
|
4101
4098
|
] }) });
|
|
@@ -4161,10 +4158,10 @@ function It({ message: e, className: a }) {
|
|
|
4161
4158
|
role: "status",
|
|
4162
4159
|
"aria-live": "polite",
|
|
4163
4160
|
"aria-busy": "true",
|
|
4164
|
-
className:
|
|
4161
|
+
className: E("ff:flex ff:flex-col ff:items-center ff:justify-center ff:py-12", a),
|
|
4165
4162
|
children: [
|
|
4166
|
-
/* @__PURE__ */ t("div", { className:
|
|
4167
|
-
e && /* @__PURE__ */ t("p", { className:
|
|
4163
|
+
/* @__PURE__ */ t("div", { className: E(co({ styleVariant: r })), children: /* @__PURE__ */ t(Te, { size: o }) }),
|
|
4164
|
+
e && /* @__PURE__ */ t("p", { className: E(uo({ styleVariant: r })), children: e })
|
|
4168
4165
|
]
|
|
4169
4166
|
}
|
|
4170
4167
|
);
|
|
@@ -4182,24 +4179,24 @@ function Ja({
|
|
|
4182
4179
|
isLoading: g = !1,
|
|
4183
4180
|
className: d
|
|
4184
4181
|
}) {
|
|
4185
|
-
const { t:
|
|
4186
|
-
return /* @__PURE__ */ t(U.div, { ...m, children: /* @__PURE__ */ u(Y, { className:
|
|
4182
|
+
const { t: b } = K(), m = we();
|
|
4183
|
+
return /* @__PURE__ */ t(U.div, { ...m, children: /* @__PURE__ */ u(Y, { className: E("fanfare-start-view", d), "data-slot": "start-view", children: [
|
|
4187
4184
|
/* @__PURE__ */ t(
|
|
4188
4185
|
G,
|
|
4189
4186
|
{
|
|
4190
4187
|
variant: e,
|
|
4191
4188
|
label: a,
|
|
4192
|
-
title: r ??
|
|
4193
|
-
description: n ??
|
|
4189
|
+
title: r ?? b("start.title"),
|
|
4190
|
+
description: n ?? b("start.description")
|
|
4194
4191
|
}
|
|
4195
4192
|
),
|
|
4196
4193
|
/* @__PURE__ */ u(Z, { children: [
|
|
4197
4194
|
o ? /* @__PURE__ */ u("div", { className: "ff:flex ff:flex-col ff:items-start ff:gap-1", children: [
|
|
4198
|
-
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children:
|
|
4195
|
+
/* @__PURE__ */ t("span", { className: "ff:text-xxs ff:font-medium ff:uppercase ff:tracking-widest ff:text-muted", children: b("time.opensIn") }),
|
|
4199
4196
|
/* @__PURE__ */ t(pe, { targetDate: o, showDays: !1 })
|
|
4200
4197
|
] }) : null,
|
|
4201
4198
|
i ? /* @__PURE__ */ t(ie, { children: i }) : null,
|
|
4202
|
-
/* @__PURE__ */ t(
|
|
4199
|
+
/* @__PURE__ */ t(j, { className: "ff:mt-auto ff:w-full", onClick: c, disabled: g, loading: g, children: f ?? b("start.cta") })
|
|
4203
4200
|
] }),
|
|
4204
4201
|
/* @__PURE__ */ t(H, {})
|
|
4205
4202
|
] }) });
|
|
@@ -4214,12 +4211,12 @@ function Qa({
|
|
|
4214
4211
|
isLeaving: i = !1,
|
|
4215
4212
|
className: f
|
|
4216
4213
|
}) {
|
|
4217
|
-
const { t: c } = K(), g = e ?? c("waitlist.enteredTitle"), d = a ?? c("waitlist.enteredDescription"),
|
|
4218
|
-
return /* @__PURE__ */ t(U.div, { ...v, children: /* @__PURE__ */ u(Y, { className:
|
|
4214
|
+
const { t: c } = K(), g = e ?? c("waitlist.enteredTitle"), d = a ?? c("waitlist.enteredDescription"), b = c("time.opensIn"), m = s.useMemo(() => r ? r instanceof Date ? r : new Date(r) : null, [r]), v = we();
|
|
4215
|
+
return /* @__PURE__ */ t(U.div, { ...v, children: /* @__PURE__ */ u(Y, { className: E("fanfare-waitlist-view", f), "data-slot": "waitlist-view", children: [
|
|
4219
4216
|
/* @__PURE__ */ t(G, { variant: "success", title: g, description: d }),
|
|
4220
4217
|
/* @__PURE__ */ u(Z, { children: [
|
|
4221
4218
|
m && /* @__PURE__ */ u(ie, { children: [
|
|
4222
|
-
/* @__PURE__ */ t("p", { className: "ff:text-muted ff:text-xxs ff:font-heading ff:uppercase ff:tracking-widest", children:
|
|
4219
|
+
/* @__PURE__ */ t("p", { className: "ff:text-muted ff:text-xxs ff:font-heading ff:uppercase ff:tracking-widest", children: b }),
|
|
4223
4220
|
/* @__PURE__ */ t(
|
|
4224
4221
|
pe,
|
|
4225
4222
|
{
|
|
@@ -4230,7 +4227,7 @@ function Qa({
|
|
|
4230
4227
|
)
|
|
4231
4228
|
] }),
|
|
4232
4229
|
o && /* @__PURE__ */ t(
|
|
4233
|
-
|
|
4230
|
+
j,
|
|
4234
4231
|
{
|
|
4235
4232
|
className: "ff:mt-auto ff:w-full",
|
|
4236
4233
|
variant: "outline",
|
|
@@ -4322,15 +4319,15 @@ function ko({
|
|
|
4322
4319
|
children: c,
|
|
4323
4320
|
checkoutUrl: g,
|
|
4324
4321
|
onJourneyChange: d,
|
|
4325
|
-
onGranted:
|
|
4322
|
+
onGranted: b,
|
|
4326
4323
|
onError: m,
|
|
4327
4324
|
className: v
|
|
4328
4325
|
}) {
|
|
4329
|
-
const w = Nt(), { t: y } = K(), C = B((k, _) => y(k, _), [y]), { journey: l, view: h, snapshot: p, fanfareError: D, start:
|
|
4326
|
+
const w = Nt(), { t: y } = K(), C = B((k, _) => y(k, _), [y]), { journey: l, view: h, snapshot: p, fanfareError: D, start: V } = Sa(e, {
|
|
4330
4327
|
autoStart: a,
|
|
4331
4328
|
accessCode: r,
|
|
4332
4329
|
autoEnterWaitlist: n
|
|
4333
|
-
}), [T,
|
|
4330
|
+
}), [T, x] = s.useState(!1), [N, S] = s.useState(!1), [M, A] = s.useState(!1), [I, O] = s.useState(!1), [$, fe] = s.useState(!1), [ce, L] = s.useState(null), [J, ne] = s.useState(!1), [se, de] = s.useState(!1), [ee, P] = s.useState(!1), ae = h?.journeyStage ?? null, me = h?.journeyStage === "routed" ? h : void 0, ke = me?.offers.some((k) => k.gates.some((_) => _.type === "access_code")) ?? !1, Re = h?.journeyStage === "routed" ? ke || J : h?.journeyStage === "routing" && J, ue = St(p), q = ue?.phase ?? me?.sequence.phase ?? null, _e = ce, Ne = _e ? ra(_e, C) : null, st = p?.experience?.experience?.theme, Ue = o ?? st, lt = i ?? o?.variant ?? st?.variant, xe = X(() => p ? xa(p) : [], [p]);
|
|
4334
4331
|
s.useEffect(() => {
|
|
4335
4332
|
p && d && d(p);
|
|
4336
4333
|
}, [p, d]), s.useEffect(() => {
|
|
@@ -4346,7 +4343,7 @@ function ko({
|
|
|
4346
4343
|
L(_);
|
|
4347
4344
|
},
|
|
4348
4345
|
[l, m]
|
|
4349
|
-
),
|
|
4346
|
+
), je = B(
|
|
4350
4347
|
(k) => {
|
|
4351
4348
|
const _ = mt(k), R = ra(_, C);
|
|
4352
4349
|
throw R.disposition === "INLINE" || R.disposition === "STEP_RESET" ? m?.(_) : F(_), new Error(R.description);
|
|
@@ -4361,23 +4358,23 @@ function ko({
|
|
|
4361
4358
|
D !== Fe.current && (Fe.current = D, F(D));
|
|
4362
4359
|
}, [D, F]);
|
|
4363
4360
|
const Le = B(async () => {
|
|
4364
|
-
|
|
4361
|
+
x(!0), L(null);
|
|
4365
4362
|
try {
|
|
4366
|
-
await
|
|
4363
|
+
await V();
|
|
4367
4364
|
} catch {
|
|
4368
4365
|
} finally {
|
|
4369
|
-
|
|
4366
|
+
x(!1);
|
|
4370
4367
|
}
|
|
4371
|
-
}, [
|
|
4368
|
+
}, [V]), [Ae, He] = s.useState(null), ct = B(
|
|
4372
4369
|
async (k, _) => {
|
|
4373
4370
|
L(null);
|
|
4374
4371
|
try {
|
|
4375
4372
|
_ === "email" ? await w.auth.requestOtp({ email: k }) : await w.auth.requestOtp({ phone: k }), He({ value: k, type: _ });
|
|
4376
4373
|
} catch (R) {
|
|
4377
|
-
|
|
4374
|
+
je(R);
|
|
4378
4375
|
}
|
|
4379
4376
|
},
|
|
4380
|
-
[
|
|
4377
|
+
[je, w]
|
|
4381
4378
|
), dt = B(
|
|
4382
4379
|
async (k) => {
|
|
4383
4380
|
if (!l || !Ae) return;
|
|
@@ -4385,7 +4382,7 @@ function ko({
|
|
|
4385
4382
|
try {
|
|
4386
4383
|
Ae.type === "email" ? await w.auth.verifyOtp({ email: Ae.value, code: k }) : await w.auth.verifyOtp({ phone: Ae.value, code: k });
|
|
4387
4384
|
} catch (R) {
|
|
4388
|
-
|
|
4385
|
+
je(R);
|
|
4389
4386
|
}
|
|
4390
4387
|
He(null);
|
|
4391
4388
|
const _ = l.view$.get();
|
|
@@ -4396,7 +4393,7 @@ function ko({
|
|
|
4396
4393
|
F(R);
|
|
4397
4394
|
}
|
|
4398
4395
|
},
|
|
4399
|
-
[
|
|
4396
|
+
[je, F, w, l, Ae]
|
|
4400
4397
|
), Ke = B(
|
|
4401
4398
|
async (k) => {
|
|
4402
4399
|
if (l) {
|
|
@@ -4575,10 +4572,10 @@ function ko({
|
|
|
4575
4572
|
L(null);
|
|
4576
4573
|
const k = l.view$.get();
|
|
4577
4574
|
k.journeyStage === "gated" && k.retry().catch(F);
|
|
4578
|
-
}, [F, l]),
|
|
4575
|
+
}, [F, l]), z = X(() => h?.journeyStage === "routed" && "sequence" in h ? h.sequence : void 0, [h]), Ge = X(() => z?.phase === "scheduled" ? z.waitlist : void 0, [z]), Ce = vo(p, z), oe = bo(p), nr = xo(p), Jt = yo(nr, oe?.id), Ie = ue && "grant" in ue && ue.grant ? ue.grant : void 0, Je = ue && "outcome" in ue && ue.outcome ? ue.outcome : void 0;
|
|
4579
4576
|
s.useEffect(() => {
|
|
4580
|
-
Ie?.token &&
|
|
4581
|
-
}, [Ie?.token,
|
|
4577
|
+
Ie?.token && b && b(Ie.token);
|
|
4578
|
+
}, [Ie?.token, b]);
|
|
4582
4579
|
const or = X(() => Ee(Ce) ? Ce : Ee(oe?.type) ? oe.type : null, [oe?.type, Ce]), Ct = X(() => Ee(Ce) ? Ce : null, [Ce]), Qt = X(() => Ee(Ce) ? Ce : Ee(oe?.type) ? oe.type : null, [oe?.type, Ce]), Xt = X(() => Ge?.status === "not_waitlisted" && typeof Ge.join == "function", [Ge]), Qe = X(() => {
|
|
4583
4580
|
if (ae === "routing") return "loading";
|
|
4584
4581
|
if (ae === "gated" && xe.length > 0) {
|
|
@@ -4590,10 +4587,10 @@ function ko({
|
|
|
4590
4587
|
}, [ae, xe]), ut = X(() => {
|
|
4591
4588
|
if (ae === "routing") return y("experience.findingPlace");
|
|
4592
4589
|
}, [ae, y]), Be = X(() => {
|
|
4593
|
-
if (!(!l || q !== "participating" || !
|
|
4594
|
-
return
|
|
4595
|
-
}, [l, q,
|
|
4596
|
-
const k = oe?.details?.type === "auction" ? oe.details : void 0, _ =
|
|
4590
|
+
if (!(!l || q !== "participating" || !z || z.phase !== "participating" || !("display$" in z)))
|
|
4591
|
+
return z.display$;
|
|
4592
|
+
}, [l, q, z]), pt = ze(Be ?? po), ea = X(() => {
|
|
4593
|
+
const k = oe?.details?.type === "auction" ? oe.details : void 0, _ = z?.phase === "participating" && z.mechanism === "auction" ? z.consumer : void 0, R = pt;
|
|
4597
4594
|
if (!(!k && !_ && !R))
|
|
4598
4595
|
return {
|
|
4599
4596
|
currentBid: R?.currentBid ?? _?.currentBid,
|
|
@@ -4605,12 +4602,12 @@ function ko({
|
|
|
4605
4602
|
minNextBid: R?.minNextBid ?? k?.minNextBid,
|
|
4606
4603
|
bidIncrement: R?.bidIncrement ?? k?.bidIncrement
|
|
4607
4604
|
};
|
|
4608
|
-
}, [pt,
|
|
4605
|
+
}, [pt, z, oe?.details]), Oe = X(() => z?.phase === "scheduled" && z.startsAt ? new Date(z.startsAt) : oe?.opensAt ? new Date(oe.opensAt) : void 0, [z, oe?.opensAt]), fr = X(() => {
|
|
4609
4606
|
if (!(q !== "participating" || Ct !== "queue"))
|
|
4610
4607
|
return pt?.position;
|
|
4611
4608
|
}, [pt, Ct, q]);
|
|
4612
4609
|
if (c)
|
|
4613
|
-
return /* @__PURE__ */ t(Rt, { theme: Ue, variant: lt, children: /* @__PURE__ */ t("div", { className:
|
|
4610
|
+
return /* @__PURE__ */ t(Rt, { theme: Ue, variant: lt, children: /* @__PURE__ */ t("div", { className: E("fanfare-experience-widget", v), "data-slot": "experience-widget", children: c({
|
|
4614
4611
|
journey: l,
|
|
4615
4612
|
view: h,
|
|
4616
4613
|
snapshot: p,
|
|
@@ -4650,7 +4647,7 @@ function ko({
|
|
|
4650
4647
|
onVerifyToken: Yt,
|
|
4651
4648
|
onRetry: Gt
|
|
4652
4649
|
}) : /* @__PURE__ */ t(
|
|
4653
|
-
|
|
4650
|
+
ja,
|
|
4654
4651
|
{
|
|
4655
4652
|
challenge: _,
|
|
4656
4653
|
botMitigation: R,
|
|
@@ -4664,15 +4661,15 @@ function ko({
|
|
|
4664
4661
|
if (q === "unavailable")
|
|
4665
4662
|
return f?.ended ? f.ended({
|
|
4666
4663
|
...le,
|
|
4667
|
-
reason:
|
|
4664
|
+
reason: z?.phase === "unavailable" ? z.reason ?? "unavailable" : "unavailable"
|
|
4668
4665
|
}) : /* @__PURE__ */ t(Fa, { title: y("experience.noSequenceTitle"), message: y("experience.noSequenceMessage") });
|
|
4669
4666
|
if (q === "scheduled")
|
|
4670
4667
|
return Ge && Ge.status !== "not_waitlisted" ? f?.waitlist ? f.waitlist({
|
|
4671
4668
|
...le,
|
|
4672
4669
|
startsAt: Oe,
|
|
4673
4670
|
onLeave: Pe,
|
|
4674
|
-
isLeaving:
|
|
4675
|
-
}) : /* @__PURE__ */ t(Qa, { startsAt: Oe, onLeave: Pe, isLeaving:
|
|
4671
|
+
isLeaving: M
|
|
4672
|
+
}) : /* @__PURE__ */ t(Qa, { startsAt: Oe, onLeave: Pe, isLeaving: M }) : f?.upcoming ? f.upcoming({
|
|
4676
4673
|
...le,
|
|
4677
4674
|
startsAt: Oe,
|
|
4678
4675
|
canEnter: Xt,
|
|
@@ -4688,18 +4685,18 @@ function ko({
|
|
|
4688
4685
|
}
|
|
4689
4686
|
);
|
|
4690
4687
|
if (q === "enterable" || q === "participating") {
|
|
4691
|
-
const k = q === "enterable" ? or : Ct, _ = q === "participating" ? Jt : oe?.id, R =
|
|
4692
|
-
if (q === "enterable" && f?.enterable && mo(
|
|
4688
|
+
const k = q === "enterable" ? or : Ct, _ = q === "participating" ? Jt : oe?.id, R = z?.phase === "enterable" && "enter" in z && typeof z.enter == "function", ye = z?.phase === "participating" && "leave" in z;
|
|
4689
|
+
if (q === "enterable" && f?.enterable && mo(z))
|
|
4693
4690
|
return f.enterable({
|
|
4694
4691
|
...le,
|
|
4695
|
-
sequence:
|
|
4696
|
-
participationType:
|
|
4692
|
+
sequence: z,
|
|
4693
|
+
participationType: z.mechanism
|
|
4697
4694
|
});
|
|
4698
|
-
if (q === "participating" && f?.participating && ho(
|
|
4695
|
+
if (q === "participating" && f?.participating && ho(z))
|
|
4699
4696
|
return f.participating({
|
|
4700
4697
|
...le,
|
|
4701
|
-
sequence:
|
|
4702
|
-
participationType:
|
|
4698
|
+
sequence: z,
|
|
4699
|
+
participationType: z.mechanism,
|
|
4703
4700
|
position: fr
|
|
4704
4701
|
});
|
|
4705
4702
|
const he = oe?.details;
|
|
@@ -4806,10 +4803,10 @@ function ko({
|
|
|
4806
4803
|
return /* @__PURE__ */ t(et, { error: y("experience.unsupportedDistribution"), onRetry: Ye });
|
|
4807
4804
|
}
|
|
4808
4805
|
if (q === "settling") {
|
|
4809
|
-
if (
|
|
4806
|
+
if (z?.phase !== "settling")
|
|
4810
4807
|
return /* @__PURE__ */ t(It, { message: ut });
|
|
4811
4808
|
const k = oe?.details;
|
|
4812
|
-
switch (
|
|
4809
|
+
switch (z.mechanism) {
|
|
4813
4810
|
case "draw": {
|
|
4814
4811
|
const _ = k?.type === "draw" ? k : void 0;
|
|
4815
4812
|
return /* @__PURE__ */ t(
|
|
@@ -4852,10 +4849,10 @@ function ko({
|
|
|
4852
4849
|
}
|
|
4853
4850
|
if (q === "granted") {
|
|
4854
4851
|
const k = Ie?.expiresAt ? new Date(Ie.expiresAt).getTime() : void 0;
|
|
4855
|
-
if (f?.granted && wo(
|
|
4852
|
+
if (f?.granted && wo(z))
|
|
4856
4853
|
return f.granted({
|
|
4857
4854
|
...le,
|
|
4858
|
-
sequence:
|
|
4855
|
+
sequence: z,
|
|
4859
4856
|
grant: Ie?.token,
|
|
4860
4857
|
expiresAt: k
|
|
4861
4858
|
});
|
|
@@ -4884,7 +4881,7 @@ function ko({
|
|
|
4884
4881
|
return /* @__PURE__ */ t(et, { error: y("experience.unsupportedDistribution"), onRetry: Ye });
|
|
4885
4882
|
}
|
|
4886
4883
|
if (q === "ended") {
|
|
4887
|
-
const k = Je?.type ?? (
|
|
4884
|
+
const k = Je?.type ?? (z?.phase === "ended" ? z.outcome.reason : void 0) ?? "unknown";
|
|
4888
4885
|
if (k === "expired" && f?.expired) {
|
|
4889
4886
|
const R = Je?.at ? new Date(Je.at) : void 0;
|
|
4890
4887
|
return f.expired({
|
|
@@ -4939,7 +4936,7 @@ function ko({
|
|
|
4939
4936
|
}
|
|
4940
4937
|
return f?.loading ? f.loading({ ...le, message: ut }) : /* @__PURE__ */ t(It, { message: ut });
|
|
4941
4938
|
}, sr = `${ae ?? "loading"}-${q ?? "unavailable"}`;
|
|
4942
|
-
return /* @__PURE__ */ t(Rt, { theme: Ue, variant: lt, children: /* @__PURE__ */ u("div", { className:
|
|
4939
|
+
return /* @__PURE__ */ t(Rt, { theme: Ue, variant: lt, children: /* @__PURE__ */ u("div", { className: E("fanfare-experience-widget", v), "data-slot": "experience-widget", children: [
|
|
4943
4940
|
/* @__PURE__ */ t(rt, { transitionKey: sr, children: ir() }),
|
|
4944
4941
|
Re ? /* @__PURE__ */ t(
|
|
4945
4942
|
Xa,
|
|
@@ -4976,32 +4973,32 @@ function So({
|
|
|
4976
4973
|
d(m);
|
|
4977
4974
|
}
|
|
4978
4975
|
}, []);
|
|
4979
|
-
const
|
|
4976
|
+
const b = X(() => a ? Da(a) : {}, [a]);
|
|
4980
4977
|
return /* @__PURE__ */ t("div", { ref: c, className: i, style: f, children: g && Er(
|
|
4981
4978
|
/* @__PURE__ */ u(Me, { children: [
|
|
4982
4979
|
/* @__PURE__ */ u("style", { "data-fanfare-styles": !0, children: [
|
|
4983
4980
|
_o,
|
|
4984
4981
|
No
|
|
4985
4982
|
] }),
|
|
4986
|
-
/* @__PURE__ */ t(Na, { locale: n, translations: o, children: /* @__PURE__ */ t(Rt, { theme: a, variant: r, className: "ff:h-full ff:w-full", children: /* @__PURE__ */ t("div", { className: "fanfare-root ff:h-full ff:w-full", style:
|
|
4983
|
+
/* @__PURE__ */ t(Na, { locale: n, translations: o, children: /* @__PURE__ */ t(Rt, { theme: a, variant: r, className: "ff:h-full ff:w-full", children: /* @__PURE__ */ t("div", { className: "fanfare-root ff:h-full ff:w-full", style: b, children: e }) }) })
|
|
4987
4984
|
] }),
|
|
4988
4985
|
g
|
|
4989
4986
|
) });
|
|
4990
4987
|
}
|
|
4991
4988
|
So.displayName = "ShadowDOMPreview";
|
|
4992
4989
|
export {
|
|
4993
|
-
|
|
4990
|
+
za as AccessCodeForm,
|
|
4994
4991
|
tt as AuctionModule,
|
|
4995
4992
|
Aa as AuthForm,
|
|
4996
4993
|
Ea as AuthInput,
|
|
4997
|
-
|
|
4994
|
+
j as Button,
|
|
4998
4995
|
Ta as Card,
|
|
4999
4996
|
dn as CardContent,
|
|
5000
4997
|
cn as CardDescription,
|
|
5001
4998
|
un as CardFooter,
|
|
5002
4999
|
sn as CardHeader,
|
|
5003
5000
|
ln as CardTitle,
|
|
5004
|
-
|
|
5001
|
+
ja as ChallengeGate,
|
|
5005
5002
|
at as DrawModule,
|
|
5006
5003
|
Fa as EndedModule,
|
|
5007
5004
|
et as ErrorView,
|
|
@@ -5038,6 +5035,6 @@ export {
|
|
|
5038
5035
|
Nt as useFanfare,
|
|
5039
5036
|
qo as useFanfareAuth,
|
|
5040
5037
|
Wo as useJourneySnapshot,
|
|
5041
|
-
|
|
5038
|
+
ze as useNanostore,
|
|
5042
5039
|
K as useTranslations
|
|
5043
5040
|
};
|