@appfunnel-dev/sdk 2.0.0-canary.11 → 2.0.0-canary.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-RKPRMTSU.cjs → chunk-7HDZVHIT.cjs} +2 -2
- package/dist/chunk-7HDZVHIT.cjs.map +1 -0
- package/dist/{chunk-SXENKZ4U.js → chunk-UAQV22UK.js} +2 -2
- package/dist/chunk-UAQV22UK.js.map +1 -0
- package/dist/index.cjs +330 -291
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +106 -84
- package/dist/index.js.map +1 -1
- package/dist/{manifest-C2mDXWNU.d.cts → manifest-CTt2LlUV.d.cts} +13 -2
- package/dist/{manifest-C2mDXWNU.d.ts → manifest-CTt2LlUV.d.ts} +13 -2
- package/dist/manifest-entry.cjs +20 -20
- package/dist/manifest-entry.d.cts +2 -2
- package/dist/manifest-entry.d.ts +2 -2
- package/dist/manifest-entry.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-RKPRMTSU.cjs.map +0 -1
- package/dist/chunk-SXENKZ4U.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk7HDZVHIT_cjs = require('./chunk-7HDZVHIT.cjs');
|
|
4
4
|
var chunkWYUDL4FI_cjs = require('./chunk-WYUDL4FI.cjs');
|
|
5
5
|
var chunk7JLOF6CJ_cjs = require('./chunk-7JLOF6CJ.cjs');
|
|
6
6
|
require('./chunk-EMMSS5I5.cjs');
|
|
7
|
-
var
|
|
7
|
+
var React2 = require('react');
|
|
8
8
|
var ReactDOM = require('react-dom');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
|
|
11
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n.default = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var React2__namespace = /*#__PURE__*/_interopNamespace(React2);
|
|
14
32
|
var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
|
|
15
33
|
|
|
16
34
|
// src/state/variableStore.ts
|
|
@@ -337,20 +355,20 @@ function createConsoleTracker(opts = {}) {
|
|
|
337
355
|
setAcquisition: (acq) => log("acquisition", acq)
|
|
338
356
|
};
|
|
339
357
|
}
|
|
340
|
-
var TrackerContext =
|
|
358
|
+
var TrackerContext = React2.createContext(null);
|
|
341
359
|
function TrackerProvider({
|
|
342
360
|
tracker,
|
|
343
361
|
children
|
|
344
362
|
}) {
|
|
345
|
-
return
|
|
363
|
+
return React2.createElement(TrackerContext.Provider, { value: tracker }, children);
|
|
346
364
|
}
|
|
347
365
|
function useTrackerRef() {
|
|
348
|
-
return
|
|
366
|
+
return React2.useContext(TrackerContext) ?? FALLBACK;
|
|
349
367
|
}
|
|
350
368
|
var FALLBACK = createConsoleTracker({ silent: true });
|
|
351
369
|
function useTracker() {
|
|
352
370
|
const tracker = useTrackerRef();
|
|
353
|
-
const track =
|
|
371
|
+
const track = React2.useCallback(
|
|
354
372
|
(event, data, userData) => tracker.track(event, data, userData),
|
|
355
373
|
[tracker]
|
|
356
374
|
);
|
|
@@ -496,7 +514,7 @@ function devWarn(message) {
|
|
|
496
514
|
} catch {
|
|
497
515
|
}
|
|
498
516
|
}
|
|
499
|
-
var LocaleContext =
|
|
517
|
+
var LocaleContext = React2.createContext(null);
|
|
500
518
|
function LocaleProvider({
|
|
501
519
|
config,
|
|
502
520
|
catalog = {},
|
|
@@ -504,29 +522,29 @@ function LocaleProvider({
|
|
|
504
522
|
override,
|
|
505
523
|
children
|
|
506
524
|
}) {
|
|
507
|
-
const [locale, setLocale] =
|
|
508
|
-
|
|
509
|
-
setLocale(
|
|
525
|
+
const [locale, setLocale] = React2.useState(() => chunk7HDZVHIT_cjs.resolveLocale(config, detected, override));
|
|
526
|
+
React2.useEffect(() => {
|
|
527
|
+
setLocale(chunk7HDZVHIT_cjs.resolveLocale(config, detected, override));
|
|
510
528
|
}, [config, detected, override]);
|
|
511
|
-
const value =
|
|
529
|
+
const value = React2.useMemo(
|
|
512
530
|
() => ({ locale, setLocale, config, catalog }),
|
|
513
531
|
[locale, config, catalog]
|
|
514
532
|
);
|
|
515
|
-
return
|
|
533
|
+
return React2.createElement(LocaleContext.Provider, { value }, children);
|
|
516
534
|
}
|
|
517
535
|
function useActiveLocale() {
|
|
518
|
-
return
|
|
536
|
+
return React2.useContext(LocaleContext)?.locale ?? "en";
|
|
519
537
|
}
|
|
520
538
|
function useTranslation() {
|
|
521
|
-
const ctx =
|
|
539
|
+
const ctx = React2.useContext(LocaleContext);
|
|
522
540
|
if (!ctx) throw new Error("useTranslation must be used inside <FunnelProvider>");
|
|
523
541
|
const { locale, setLocale, config, catalog } = ctx;
|
|
524
|
-
const chain =
|
|
542
|
+
const chain = React2.useMemo(() => {
|
|
525
543
|
const def = config?.default;
|
|
526
544
|
const fb = config?.fallback;
|
|
527
545
|
return Array.from(new Set([locale, fb, def].filter(Boolean)));
|
|
528
546
|
}, [locale, config]);
|
|
529
|
-
const t =
|
|
547
|
+
const t = React2.useMemo(() => {
|
|
530
548
|
const fn = ((key, params) => {
|
|
531
549
|
const raw = lookup(catalog, chain, key);
|
|
532
550
|
if (raw === void 0) {
|
|
@@ -547,7 +565,7 @@ function useTranslation() {
|
|
|
547
565
|
};
|
|
548
566
|
return fn;
|
|
549
567
|
}, [catalog, chain, locale]);
|
|
550
|
-
const fmt =
|
|
568
|
+
const fmt = React2.useMemo(
|
|
551
569
|
() => ({
|
|
552
570
|
number: (n, opts) => {
|
|
553
571
|
try {
|
|
@@ -578,37 +596,37 @@ function useTranslation() {
|
|
|
578
596
|
fmt,
|
|
579
597
|
locale,
|
|
580
598
|
setLocale,
|
|
581
|
-
dir:
|
|
599
|
+
dir: chunk7HDZVHIT_cjs.isRtl(locale) ? "rtl" : "ltr",
|
|
582
600
|
locales: config?.supported ?? [locale]
|
|
583
601
|
};
|
|
584
602
|
}
|
|
585
603
|
|
|
586
604
|
// src/commerce/catalog.ts
|
|
587
|
-
var CatalogContext =
|
|
605
|
+
var CatalogContext = React2.createContext(null);
|
|
588
606
|
function CatalogProvider({
|
|
589
607
|
catalog,
|
|
590
608
|
children
|
|
591
609
|
}) {
|
|
592
|
-
return
|
|
610
|
+
return React2.createElement(CatalogContext.Provider, { value: catalog }, children);
|
|
593
611
|
}
|
|
594
612
|
function useCatalog() {
|
|
595
|
-
return
|
|
613
|
+
return React2.useContext(CatalogContext) ?? EMPTY;
|
|
596
614
|
}
|
|
597
615
|
var EMPTY = /* @__PURE__ */ new Map();
|
|
598
616
|
function useOffering(id) {
|
|
599
617
|
const catalog = useCatalog();
|
|
600
618
|
const locale = useActiveLocale();
|
|
601
619
|
const resolved = id ? catalog.get(id) : void 0;
|
|
602
|
-
return
|
|
603
|
-
() => resolved ?
|
|
620
|
+
return React2.useMemo(
|
|
621
|
+
() => resolved ? chunk7HDZVHIT_cjs.formatOffering(resolved, locale) : void 0,
|
|
604
622
|
[resolved, locale]
|
|
605
623
|
);
|
|
606
624
|
}
|
|
607
625
|
function useOfferings() {
|
|
608
626
|
const catalog = useCatalog();
|
|
609
627
|
const locale = useActiveLocale();
|
|
610
|
-
return
|
|
611
|
-
() => Array.from(catalog.values()).map((r) =>
|
|
628
|
+
return React2.useMemo(
|
|
629
|
+
() => Array.from(catalog.values()).map((r) => chunk7HDZVHIT_cjs.formatOffering(r, locale)),
|
|
612
630
|
[catalog, locale]
|
|
613
631
|
);
|
|
614
632
|
}
|
|
@@ -708,11 +726,13 @@ async function captureScreenshot(params = {}) {
|
|
|
708
726
|
}
|
|
709
727
|
|
|
710
728
|
// src/flow/flow.tsx
|
|
711
|
-
var
|
|
712
|
-
var
|
|
713
|
-
var
|
|
729
|
+
var Activity2 = React2__namespace.Activity ?? React2__namespace.unstable_Activity;
|
|
730
|
+
var HIDDEN_CANDIDATE_CAP = 2;
|
|
731
|
+
var NavContext = React2.createContext(null);
|
|
732
|
+
var GroupProgressContext = React2.createContext(null);
|
|
733
|
+
var ExperimentContext = React2.createContext({});
|
|
714
734
|
function useExperiment(id) {
|
|
715
|
-
return
|
|
735
|
+
return React2.useContext(ExperimentContext)[id];
|
|
716
736
|
}
|
|
717
737
|
function pageContextFor(currentKey, slug, group, index, total, startedAt) {
|
|
718
738
|
const denom = Math.max(total, index + 1);
|
|
@@ -728,8 +748,8 @@ function pageContextFor(currentKey, slug, group, index, total, startedAt) {
|
|
|
728
748
|
}
|
|
729
749
|
var now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
730
750
|
function usePageExitTimer(tracker, currentKey) {
|
|
731
|
-
const timer =
|
|
732
|
-
const emitExit =
|
|
751
|
+
const timer = React2.useRef(null);
|
|
752
|
+
const emitExit = React2.useCallback(() => {
|
|
733
753
|
const t = timer.current;
|
|
734
754
|
if (!t) return;
|
|
735
755
|
const at = now();
|
|
@@ -737,7 +757,7 @@ function usePageExitTimer(tracker, currentKey) {
|
|
|
737
757
|
const durationMs = Math.round(at - t.enteredAt);
|
|
738
758
|
tracker.track("page.exit", { pageId: t.key, durationMs, activeMs: Math.max(0, Math.round(durationMs - hidden)) });
|
|
739
759
|
}, [tracker]);
|
|
740
|
-
|
|
760
|
+
React2.useEffect(() => {
|
|
741
761
|
if (typeof document === "undefined") return;
|
|
742
762
|
const onVis = () => {
|
|
743
763
|
const t = timer.current;
|
|
@@ -751,13 +771,13 @@ function usePageExitTimer(tracker, currentKey) {
|
|
|
751
771
|
document.addEventListener("visibilitychange", onVis);
|
|
752
772
|
return () => document.removeEventListener("visibilitychange", onVis);
|
|
753
773
|
}, []);
|
|
754
|
-
|
|
774
|
+
React2.useEffect(() => {
|
|
755
775
|
if (!currentKey) return;
|
|
756
776
|
if (timer.current && timer.current.key !== currentKey) emitExit();
|
|
757
777
|
const hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
758
778
|
timer.current = { key: currentKey, enteredAt: now(), hidden: 0, hiddenSince: hidden ? now() : null };
|
|
759
779
|
}, [currentKey, emitExit]);
|
|
760
|
-
|
|
780
|
+
React2.useEffect(() => () => emitExit(), [emitExit]);
|
|
761
781
|
}
|
|
762
782
|
function FunnelView({
|
|
763
783
|
pages,
|
|
@@ -770,38 +790,38 @@ function FunnelView({
|
|
|
770
790
|
}) {
|
|
771
791
|
const funnel = useFunnel();
|
|
772
792
|
const tracker = useTrackerRef();
|
|
773
|
-
const components =
|
|
793
|
+
const components = React2.useMemo(() => {
|
|
774
794
|
const map = /* @__PURE__ */ new Map();
|
|
775
795
|
for (const p of pages) {
|
|
776
796
|
if (p.Component) map.set(p.key, p.Component);
|
|
777
797
|
else if (p.load) {
|
|
778
798
|
const load = p.load;
|
|
779
|
-
map.set(p.key,
|
|
799
|
+
map.set(p.key, React2.lazy(() => Promise.resolve(load()).then(
|
|
780
800
|
(m) => typeof m === "function" ? { default: m } : m
|
|
781
801
|
)));
|
|
782
802
|
}
|
|
783
803
|
}
|
|
784
804
|
return map;
|
|
785
805
|
}, [pages]);
|
|
786
|
-
const loaders =
|
|
806
|
+
const loaders = React2.useMemo(
|
|
787
807
|
() => new Map(pages.filter((p) => p.load).map((p) => [p.key, p.load])),
|
|
788
808
|
[pages]
|
|
789
809
|
);
|
|
790
|
-
const seedRef =
|
|
791
|
-
if (seedRef.current === null) seedRef.current =
|
|
810
|
+
const seedRef = React2.useRef(null);
|
|
811
|
+
if (seedRef.current === null) seedRef.current = chunk7HDZVHIT_cjs.bucketingSeed(funnel.context);
|
|
792
812
|
const seed = seedRef.current;
|
|
793
|
-
const experiments =
|
|
794
|
-
() =>
|
|
813
|
+
const experiments = React2.useMemo(
|
|
814
|
+
() => chunk7HDZVHIT_cjs.resolveExperiments(pages, funnel.experiments, seed),
|
|
795
815
|
[pages, funnel.experiments, seed]
|
|
796
816
|
);
|
|
797
|
-
const toSlot =
|
|
798
|
-
const toRenderKey =
|
|
799
|
-
const pageByKey =
|
|
800
|
-
const flowPages =
|
|
817
|
+
const toSlot = React2.useCallback((k) => experiments.slotOf[k] ?? k, [experiments]);
|
|
818
|
+
const toRenderKey = React2.useCallback((k) => experiments.render[k] ?? k, [experiments]);
|
|
819
|
+
const pageByKey = React2.useMemo(() => new Map(pages.map((p) => [p.key, p])), [pages]);
|
|
820
|
+
const flowPages = React2.useMemo(
|
|
801
821
|
() => experiments.activeKeys.map((k) => pageByKey.get(k)).filter((p) => p !== void 0),
|
|
802
822
|
[experiments, pageByKey]
|
|
803
823
|
);
|
|
804
|
-
const flow =
|
|
824
|
+
const flow = React2.useMemo(
|
|
805
825
|
() => flowPages.map((p) => {
|
|
806
826
|
const servedVariant = experiments.render[p.key];
|
|
807
827
|
const variantNext = servedVariant ? pageByKey.get(servedVariant)?.meta?.next : void 0;
|
|
@@ -809,93 +829,106 @@ function FunnelView({
|
|
|
809
829
|
}),
|
|
810
830
|
[flowPages, experiments, pageByKey]
|
|
811
831
|
);
|
|
812
|
-
const [history, setHistory] =
|
|
832
|
+
const [history, setHistory] = React2.useState(() => {
|
|
813
833
|
const start = flowPages[0]?.key;
|
|
814
834
|
if (!initialKey || initialKey === start) return start ? [start] : [];
|
|
815
835
|
const target = toSlot(initialKey);
|
|
816
836
|
const page2 = flowPages.find((p) => p.key === target);
|
|
817
837
|
if (trustInitialKey) return page2 ? [target] : start ? [start] : [];
|
|
818
|
-
const guard =
|
|
819
|
-
const ok = page2 && (!guard ||
|
|
838
|
+
const guard = chunk7HDZVHIT_cjs.entryGuard(page2?.meta);
|
|
839
|
+
const ok = page2 && (!guard || chunk7HDZVHIT_cjs.evaluateGate(guard, funnel.snapshot()));
|
|
820
840
|
const first = ok ? target : start;
|
|
821
841
|
return first ? [first] : [];
|
|
822
842
|
});
|
|
823
843
|
const currentKey = history[history.length - 1];
|
|
824
844
|
const index = history.length - 1;
|
|
825
845
|
const startKey = history[0];
|
|
826
|
-
const total =
|
|
827
|
-
() =>
|
|
846
|
+
const total = React2.useMemo(
|
|
847
|
+
() => chunk7HDZVHIT_cjs.expectedPathLength(flow, startKey, funnel.snapshot()),
|
|
828
848
|
// currentKey in deps: re-trace as each step's answers settle the branch.
|
|
829
849
|
[flow, startKey, currentKey, funnel]
|
|
830
850
|
);
|
|
831
851
|
const slug = pageByKey.get(currentKey)?.meta?.slug ?? currentKey;
|
|
832
852
|
const group = pageByKey.get(currentKey)?.meta?.group;
|
|
833
|
-
const page =
|
|
853
|
+
const page = React2.useMemo(
|
|
834
854
|
() => pageContextFor(currentKey, slug, group, index, total, funnel.context.system.now),
|
|
835
855
|
[currentKey, slug, group, index, total, funnel.context.system.now]
|
|
836
856
|
);
|
|
837
|
-
const groups =
|
|
838
|
-
() =>
|
|
857
|
+
const groups = React2.useMemo(
|
|
858
|
+
() => chunk7HDZVHIT_cjs.groupProgress(flow, startKey, currentKey, funnel.snapshot()),
|
|
839
859
|
// currentKey in deps: re-trace as each step's answers settle the branch.
|
|
840
860
|
[flow, startKey, currentKey, funnel]
|
|
841
861
|
);
|
|
842
|
-
|
|
862
|
+
React2.useEffect(() => {
|
|
843
863
|
funnel.context.page = page;
|
|
844
864
|
}, [funnel, page]);
|
|
845
|
-
const started =
|
|
846
|
-
|
|
865
|
+
const started = React2.useRef(false);
|
|
866
|
+
React2.useEffect(() => {
|
|
847
867
|
if (started.current) return;
|
|
848
868
|
started.current = true;
|
|
849
869
|
tracker.track("funnel.start", {});
|
|
850
870
|
}, [tracker]);
|
|
851
|
-
|
|
871
|
+
React2.useEffect(() => {
|
|
852
872
|
if (!currentKey) return;
|
|
853
873
|
tracker.track("page.view", { pageId: currentKey, pageKey: currentKey, isInitial: index === 0, eventId: newEventId() });
|
|
854
874
|
}, [tracker, currentKey, index]);
|
|
855
|
-
|
|
875
|
+
React2.useEffect(() => {
|
|
856
876
|
if (currentKey && onNavigate) onNavigate(currentKey, slug);
|
|
857
877
|
}, [onNavigate, currentKey, slug]);
|
|
858
|
-
const exposed =
|
|
859
|
-
|
|
878
|
+
const exposed = React2.useRef(/* @__PURE__ */ new Set());
|
|
879
|
+
React2.useEffect(() => {
|
|
860
880
|
const expId = experiments.experimentOf[currentKey];
|
|
861
881
|
if (!expId || exposed.current.has(expId)) return;
|
|
862
882
|
exposed.current.add(expId);
|
|
863
883
|
tracker.track("experiment.exposure", exposurePayload(expId, experiments.assignments[expId], experiments.versionOf[expId]));
|
|
864
884
|
}, [tracker, currentKey, experiments]);
|
|
865
885
|
usePageExitTimer(tracker, currentKey);
|
|
866
|
-
const [isNavigating, startNav] =
|
|
867
|
-
const next =
|
|
868
|
-
const target =
|
|
886
|
+
const [isNavigating, startNav] = React2.useTransition();
|
|
887
|
+
const next = React2.useCallback(() => {
|
|
888
|
+
const target = chunk7HDZVHIT_cjs.nextPage(flow, currentKey, funnel.snapshot());
|
|
869
889
|
const resolved = target ? toSlot(target) : target;
|
|
870
890
|
if (resolved) startNav(() => setHistory((h) => [...h, resolved]));
|
|
871
891
|
}, [flow, currentKey, funnel, toSlot]);
|
|
872
|
-
const back =
|
|
892
|
+
const back = React2.useCallback(
|
|
873
893
|
() => startNav(() => setHistory((h) => h.length > 1 ? h.slice(0, -1) : h)),
|
|
874
894
|
[]
|
|
875
895
|
);
|
|
876
|
-
const go =
|
|
896
|
+
const go = React2.useCallback(
|
|
877
897
|
(key) => startNav(() => setHistory((h) => [...h, toSlot(key)])),
|
|
878
898
|
[toSlot]
|
|
879
899
|
);
|
|
880
|
-
const
|
|
881
|
-
const
|
|
900
|
+
const [loadedComps, setLoadedComps] = React2.useState(() => /* @__PURE__ */ new Map());
|
|
901
|
+
const prefetched = React2.useRef(/* @__PURE__ */ new Set());
|
|
902
|
+
const prefetch = React2.useCallback(
|
|
882
903
|
(key) => {
|
|
883
904
|
const target = toRenderKey(key);
|
|
884
905
|
const load = loaders.get(target);
|
|
885
906
|
if (!load || prefetched.current.has(target)) return;
|
|
886
907
|
prefetched.current.add(target);
|
|
887
|
-
load().
|
|
908
|
+
load().then((m) => {
|
|
909
|
+
const Comp = typeof m === "function" ? m : m.default;
|
|
910
|
+
setLoadedComps((prev) => prev.has(target) ? prev : new Map(prev).set(target, Comp));
|
|
911
|
+
}).catch(() => prefetched.current.delete(target));
|
|
888
912
|
},
|
|
889
913
|
[loaders, toRenderKey]
|
|
890
914
|
);
|
|
891
|
-
const nextCandidates =
|
|
892
|
-
() => [...new Set(
|
|
915
|
+
const nextCandidates = React2.useMemo(
|
|
916
|
+
() => [...new Set(chunk7HDZVHIT_cjs.outgoingKeys(flow, currentKey).map(toRenderKey))],
|
|
893
917
|
[flow, currentKey, toRenderKey]
|
|
894
918
|
);
|
|
895
|
-
|
|
919
|
+
React2.useEffect(() => {
|
|
896
920
|
if (prefetchMode !== "auto") return;
|
|
897
921
|
for (const key of nextCandidates) prefetch(key);
|
|
898
922
|
}, [prefetchMode, nextCandidates, prefetch]);
|
|
923
|
+
React2.useEffect(() => {
|
|
924
|
+
if (prefetchMode !== "off") return;
|
|
925
|
+
for (const key of nextCandidates) prefetch(key);
|
|
926
|
+
}, [prefetchMode, nextCandidates, prefetch]);
|
|
927
|
+
const [preMountReady, setPreMountReady] = React2.useState(false);
|
|
928
|
+
React2.useEffect(() => {
|
|
929
|
+
const saveData = typeof navigator !== "undefined" && navigator.connection?.saveData === true;
|
|
930
|
+
if (!saveData) setPreMountReady(true);
|
|
931
|
+
}, []);
|
|
899
932
|
const value = {
|
|
900
933
|
page,
|
|
901
934
|
next,
|
|
@@ -907,9 +940,9 @@ function FunnelView({
|
|
|
907
940
|
isNavigating
|
|
908
941
|
};
|
|
909
942
|
const bus = useBusInternal();
|
|
910
|
-
const navRef =
|
|
943
|
+
const navRef = React2.useRef(value);
|
|
911
944
|
navRef.current = value;
|
|
912
|
-
|
|
945
|
+
React2.useEffect(() => {
|
|
913
946
|
if (!bus) return;
|
|
914
947
|
const control = {
|
|
915
948
|
goTo: (key) => {
|
|
@@ -933,7 +966,7 @@ function FunnelView({
|
|
|
933
966
|
};
|
|
934
967
|
return bus.registerNavigation(control);
|
|
935
968
|
}, [bus]);
|
|
936
|
-
|
|
969
|
+
React2.useEffect(() => {
|
|
937
970
|
const v = navRef.current;
|
|
938
971
|
bus?.emit("navigation", {
|
|
939
972
|
key: v.page.key,
|
|
@@ -946,20 +979,26 @@ function FunnelView({
|
|
|
946
979
|
}, [bus, currentKey]);
|
|
947
980
|
const renderKey = toRenderKey(currentKey);
|
|
948
981
|
const Current = components.get(renderKey);
|
|
949
|
-
const pageEl =
|
|
950
|
-
const
|
|
951
|
-
|
|
982
|
+
const pageEl = React2.createElement(React2.Suspense, { fallback: fallback ?? null }, Current ? React2.createElement(Current) : null);
|
|
983
|
+
const visible = layout ? React2.createElement(layout, null, pageEl) : pageEl;
|
|
984
|
+
const hiddenKeys = preMountReady && Activity2 ? nextCandidates.filter((k) => k !== renderKey && (pageByKey.get(k)?.Component !== void 0 || loadedComps.has(k))).slice(0, HIDDEN_CANDIDATE_CAP) : [];
|
|
985
|
+
const hiddenEls = hiddenKeys.map((k) => {
|
|
986
|
+
const C = pageByKey.get(k)?.Component ?? loadedComps.get(k);
|
|
987
|
+
return C ? React2.createElement(Activity2, { key: k, mode: "hidden" }, React2.createElement(C)) : null;
|
|
988
|
+
});
|
|
989
|
+
const content = hiddenEls.length > 0 ? React2.createElement(React2.Fragment, null, visible, ...hiddenEls) : visible;
|
|
990
|
+
return React2.createElement(
|
|
952
991
|
ExperimentContext.Provider,
|
|
953
992
|
{ value: experiments.assignments },
|
|
954
|
-
|
|
993
|
+
React2.createElement(
|
|
955
994
|
NavContext.Provider,
|
|
956
995
|
{ value },
|
|
957
|
-
|
|
996
|
+
React2.createElement(GroupProgressContext.Provider, { value: groups }, content)
|
|
958
997
|
)
|
|
959
998
|
);
|
|
960
999
|
}
|
|
961
1000
|
function useNavigation() {
|
|
962
|
-
const ctx =
|
|
1001
|
+
const ctx = React2.useContext(NavContext);
|
|
963
1002
|
if (!ctx) throw new Error("useNavigation must be used inside <FunnelView>");
|
|
964
1003
|
return ctx;
|
|
965
1004
|
}
|
|
@@ -969,7 +1008,7 @@ var EMBED_CAPABILITIES = {
|
|
|
969
1008
|
};
|
|
970
1009
|
function EmbedBridge() {
|
|
971
1010
|
const bus = useBusInternal();
|
|
972
|
-
|
|
1011
|
+
React2.useEffect(() => {
|
|
973
1012
|
if (!bus || typeof window === "undefined" || window.parent === window) return;
|
|
974
1013
|
const parent = window.parent;
|
|
975
1014
|
let disposed = false;
|
|
@@ -1042,15 +1081,15 @@ function usePage() {
|
|
|
1042
1081
|
return useNavigation().page;
|
|
1043
1082
|
}
|
|
1044
1083
|
function useGroupProgress() {
|
|
1045
|
-
const ctx =
|
|
1084
|
+
const ctx = React2.useContext(GroupProgressContext);
|
|
1046
1085
|
if (!ctx) throw new Error("useGroupProgress must be used inside <FunnelView>");
|
|
1047
1086
|
return ctx;
|
|
1048
1087
|
}
|
|
1049
1088
|
var symModalId = /* @__PURE__ */ Symbol("AppfunnelModalId");
|
|
1050
1089
|
var initialState = {};
|
|
1051
|
-
var ModalStateContext =
|
|
1052
|
-
var ModalIdContext =
|
|
1053
|
-
var ModalDispatchContext =
|
|
1090
|
+
var ModalStateContext = React2.createContext(initialState);
|
|
1091
|
+
var ModalIdContext = React2.createContext(null);
|
|
1092
|
+
var ModalDispatchContext = React2.createContext(null);
|
|
1054
1093
|
var REGISTRY = {};
|
|
1055
1094
|
var ALREADY_MOUNTED = {};
|
|
1056
1095
|
var modalCallbacks = {};
|
|
@@ -1157,48 +1196,48 @@ function setFlags(d, id, flags) {
|
|
|
1157
1196
|
d({ type: "set-flags", payload: { modalId: id, flags } });
|
|
1158
1197
|
}
|
|
1159
1198
|
function useModal(modal, args) {
|
|
1160
|
-
const modals =
|
|
1161
|
-
const contextId =
|
|
1162
|
-
const d =
|
|
1199
|
+
const modals = React2.useContext(ModalStateContext);
|
|
1200
|
+
const contextId = React2.useContext(ModalIdContext);
|
|
1201
|
+
const d = React2.useContext(ModalDispatchContext) ?? dispatch;
|
|
1163
1202
|
const isComponent = !!modal && typeof modal !== "string";
|
|
1164
1203
|
const id = modal ? idOf(modal) : contextId;
|
|
1165
1204
|
if (!id)
|
|
1166
1205
|
throw new Error(
|
|
1167
1206
|
"useModal: no modal id (call inside a defineModal component, or pass an id/component)."
|
|
1168
1207
|
);
|
|
1169
|
-
|
|
1208
|
+
React2.useEffect(() => {
|
|
1170
1209
|
if (isComponent && !REGISTRY[id])
|
|
1171
1210
|
registerModal(id, modal, args);
|
|
1172
1211
|
}, [isComponent, id, modal, args]);
|
|
1173
1212
|
const info = modals[id];
|
|
1174
|
-
const show =
|
|
1213
|
+
const show = React2.useCallback(
|
|
1175
1214
|
(a) => showModalVia(d, id, a),
|
|
1176
1215
|
[d, id]
|
|
1177
1216
|
);
|
|
1178
|
-
const hide =
|
|
1179
|
-
const remove =
|
|
1180
|
-
const resolve =
|
|
1217
|
+
const hide = React2.useCallback(() => hideModalVia(d, id), [d, id]);
|
|
1218
|
+
const remove = React2.useCallback(() => removeModalVia(d, id), [d, id]);
|
|
1219
|
+
const resolve = React2.useCallback(
|
|
1181
1220
|
(v) => {
|
|
1182
1221
|
modalCallbacks[id]?.resolve(v);
|
|
1183
1222
|
delete modalCallbacks[id];
|
|
1184
1223
|
},
|
|
1185
1224
|
[id]
|
|
1186
1225
|
);
|
|
1187
|
-
const reject =
|
|
1226
|
+
const reject = React2.useCallback(
|
|
1188
1227
|
(v) => {
|
|
1189
1228
|
modalCallbacks[id]?.reject(v);
|
|
1190
1229
|
delete modalCallbacks[id];
|
|
1191
1230
|
},
|
|
1192
1231
|
[id]
|
|
1193
1232
|
);
|
|
1194
|
-
const resolveHide =
|
|
1233
|
+
const resolveHide = React2.useCallback(
|
|
1195
1234
|
(v) => {
|
|
1196
1235
|
hideCallbacks[id]?.resolve(v);
|
|
1197
1236
|
delete hideCallbacks[id];
|
|
1198
1237
|
},
|
|
1199
1238
|
[id]
|
|
1200
1239
|
);
|
|
1201
|
-
return
|
|
1240
|
+
return React2.useMemo(
|
|
1202
1241
|
() => ({
|
|
1203
1242
|
id,
|
|
1204
1243
|
args: info?.args,
|
|
@@ -1233,45 +1272,45 @@ function defineModal(Comp) {
|
|
|
1233
1272
|
...props
|
|
1234
1273
|
}) {
|
|
1235
1274
|
const { args, show } = useModal(id);
|
|
1236
|
-
const modals =
|
|
1237
|
-
const d =
|
|
1275
|
+
const modals = React2.useContext(ModalStateContext);
|
|
1276
|
+
const d = React2.useContext(ModalDispatchContext) ?? dispatch;
|
|
1238
1277
|
const shouldMount = !!modals[id];
|
|
1239
|
-
|
|
1278
|
+
React2.useEffect(() => {
|
|
1240
1279
|
if (defaultVisible) show();
|
|
1241
1280
|
ALREADY_MOUNTED[id] = true;
|
|
1242
1281
|
return () => {
|
|
1243
1282
|
delete ALREADY_MOUNTED[id];
|
|
1244
1283
|
};
|
|
1245
1284
|
}, [id, show, defaultVisible]);
|
|
1246
|
-
|
|
1285
|
+
React2.useEffect(() => {
|
|
1247
1286
|
if (keepMounted) setFlags(d, id, { keepMounted: true });
|
|
1248
1287
|
}, [d, id, keepMounted]);
|
|
1249
1288
|
const delayVisible = modals[id]?.delayVisible;
|
|
1250
|
-
|
|
1289
|
+
React2.useEffect(() => {
|
|
1251
1290
|
if (delayVisible) show(args);
|
|
1252
1291
|
}, [delayVisible, args, show]);
|
|
1253
1292
|
if (!shouldMount) return null;
|
|
1254
|
-
return
|
|
1293
|
+
return React2.createElement(
|
|
1255
1294
|
ModalIdContext.Provider,
|
|
1256
1295
|
{ value: id },
|
|
1257
|
-
|
|
1296
|
+
React2.createElement(Comp, { ...props, ...args })
|
|
1258
1297
|
);
|
|
1259
1298
|
};
|
|
1260
1299
|
}
|
|
1261
1300
|
function ModalRoot() {
|
|
1262
|
-
const modals =
|
|
1301
|
+
const modals = React2.useContext(ModalStateContext);
|
|
1263
1302
|
const toRender = Object.keys(modals).filter((id) => REGISTRY[id]).map((id) => ({ id, ...REGISTRY[id] }));
|
|
1264
|
-
return
|
|
1303
|
+
return React2.createElement(
|
|
1265
1304
|
"div",
|
|
1266
1305
|
{ "data-appfunnel-modal-root": "" },
|
|
1267
1306
|
...toRender.map(
|
|
1268
|
-
(t) =>
|
|
1307
|
+
(t) => React2.createElement(t.comp, { key: t.id, id: t.id, ...t.props })
|
|
1269
1308
|
)
|
|
1270
1309
|
);
|
|
1271
1310
|
}
|
|
1272
1311
|
function ModalRuntime({ children }) {
|
|
1273
|
-
const [state, localDispatch] =
|
|
1274
|
-
|
|
1312
|
+
const [state, localDispatch] = React2.useReducer(modalReducer, initialState);
|
|
1313
|
+
React2.useEffect(() => {
|
|
1275
1314
|
runtimeStack.push(localDispatch);
|
|
1276
1315
|
if (runtimeStack.length > 1) {
|
|
1277
1316
|
try {
|
|
@@ -1286,14 +1325,14 @@ function ModalRuntime({ children }) {
|
|
|
1286
1325
|
if (i !== -1) runtimeStack.splice(i, 1);
|
|
1287
1326
|
};
|
|
1288
1327
|
}, []);
|
|
1289
|
-
return
|
|
1328
|
+
return React2.createElement(
|
|
1290
1329
|
ModalDispatchContext.Provider,
|
|
1291
1330
|
{ value: localDispatch },
|
|
1292
|
-
|
|
1331
|
+
React2.createElement(
|
|
1293
1332
|
ModalStateContext.Provider,
|
|
1294
1333
|
{ value: state },
|
|
1295
1334
|
children,
|
|
1296
|
-
|
|
1335
|
+
React2.createElement(ModalRoot, null)
|
|
1297
1336
|
)
|
|
1298
1337
|
);
|
|
1299
1338
|
}
|
|
@@ -1321,7 +1360,7 @@ function OverlayShell({
|
|
|
1321
1360
|
panel,
|
|
1322
1361
|
children
|
|
1323
1362
|
}) {
|
|
1324
|
-
|
|
1363
|
+
React2.useEffect(() => {
|
|
1325
1364
|
if (!open || typeof document === "undefined") return;
|
|
1326
1365
|
const onKey = (e) => {
|
|
1327
1366
|
if (e.key === "Escape") onClose();
|
|
@@ -1335,7 +1374,7 @@ function OverlayShell({
|
|
|
1335
1374
|
};
|
|
1336
1375
|
}, [open, onClose]);
|
|
1337
1376
|
if (!open || typeof document === "undefined") return null;
|
|
1338
|
-
const overlay =
|
|
1377
|
+
const overlay = React2.createElement(
|
|
1339
1378
|
"div",
|
|
1340
1379
|
{
|
|
1341
1380
|
role: "dialog",
|
|
@@ -1344,13 +1383,13 @@ function OverlayShell({
|
|
|
1344
1383
|
"data-appfunnel-overlay": "",
|
|
1345
1384
|
style: { position: "fixed", inset: 0, zIndex: 1e3, display: "flex", ...container }
|
|
1346
1385
|
},
|
|
1347
|
-
|
|
1386
|
+
React2.createElement("div", {
|
|
1348
1387
|
"data-appfunnel-overlay-backdrop": "",
|
|
1349
1388
|
className: backdropClassName,
|
|
1350
1389
|
onClick: dismissOnBackdrop ? onClose : void 0,
|
|
1351
1390
|
style: { position: "absolute", inset: 0, background: "rgba(0,0,0,0.5)" }
|
|
1352
1391
|
}),
|
|
1353
|
-
|
|
1392
|
+
React2.createElement(
|
|
1354
1393
|
"div",
|
|
1355
1394
|
{ "data-appfunnel-overlay-panel": "", className, style: { position: "relative", background: "#fff", ...panel } },
|
|
1356
1395
|
children
|
|
@@ -1367,7 +1406,7 @@ var SHEET_LAYOUT = {
|
|
|
1367
1406
|
function Sheet(props) {
|
|
1368
1407
|
const control = useModalControl();
|
|
1369
1408
|
const layout = SHEET_LAYOUT[props.side ?? "bottom"];
|
|
1370
|
-
return
|
|
1409
|
+
return React2.createElement(OverlayShell, {
|
|
1371
1410
|
...control,
|
|
1372
1411
|
className: props.className,
|
|
1373
1412
|
backdropClassName: props.backdropClassName,
|
|
@@ -1380,7 +1419,7 @@ function Sheet(props) {
|
|
|
1380
1419
|
}
|
|
1381
1420
|
function Modal(props) {
|
|
1382
1421
|
const control = useModalControl();
|
|
1383
|
-
return
|
|
1422
|
+
return React2.createElement(OverlayShell, {
|
|
1384
1423
|
...control,
|
|
1385
1424
|
className: props.className,
|
|
1386
1425
|
backdropClassName: props.backdropClassName,
|
|
@@ -1410,7 +1449,7 @@ function createMockDriver(provider = "stripe", options = {}) {
|
|
|
1410
1449
|
return Promise.resolve({ ok: false, error: offError });
|
|
1411
1450
|
return Promise.resolve(success);
|
|
1412
1451
|
},
|
|
1413
|
-
renderInline: (req, cb) =>
|
|
1452
|
+
renderInline: (req, cb) => React2.createElement(
|
|
1414
1453
|
"button",
|
|
1415
1454
|
{
|
|
1416
1455
|
type: "button",
|
|
@@ -1448,15 +1487,15 @@ function driverWithCatalog(driver, catalog) {
|
|
|
1448
1487
|
renderInline: driver.renderInline ? (req, cb) => driver.renderInline(enrich(req), cb) : void 0
|
|
1449
1488
|
};
|
|
1450
1489
|
}
|
|
1451
|
-
var DriverContext =
|
|
1490
|
+
var DriverContext = React2.createContext(null);
|
|
1452
1491
|
function CheckoutDriverProvider({
|
|
1453
1492
|
driver,
|
|
1454
1493
|
children
|
|
1455
1494
|
}) {
|
|
1456
|
-
return
|
|
1495
|
+
return React2.createElement(DriverContext.Provider, { value: driver }, children);
|
|
1457
1496
|
}
|
|
1458
1497
|
function useDriver() {
|
|
1459
|
-
return
|
|
1498
|
+
return React2.useContext(DriverContext) ?? FALLBACK_DRIVER;
|
|
1460
1499
|
}
|
|
1461
1500
|
var FALLBACK_DRIVER = createMockDriver();
|
|
1462
1501
|
function useCheckout(opts = {}) {
|
|
@@ -1464,12 +1503,12 @@ function useCheckout(opts = {}) {
|
|
|
1464
1503
|
const tracker = useTrackerRef();
|
|
1465
1504
|
const catalog = useCatalog();
|
|
1466
1505
|
const nav = useNavigation();
|
|
1467
|
-
const [status, setStatus] =
|
|
1468
|
-
const [error, setError] =
|
|
1506
|
+
const [status, setStatus] = React2.useState("idle");
|
|
1507
|
+
const [error, setError] = React2.useState(null);
|
|
1469
1508
|
const intent = opts.intent ?? "purchase";
|
|
1470
1509
|
const kind = opts.kind;
|
|
1471
1510
|
const advance = opts.advanceOnSuccess ?? true;
|
|
1472
|
-
const productFacts =
|
|
1511
|
+
const productFacts = React2.useCallback(
|
|
1473
1512
|
(product) => {
|
|
1474
1513
|
const resolved = product ? catalog.get(product) : void 0;
|
|
1475
1514
|
return {
|
|
@@ -1481,13 +1520,13 @@ function useCheckout(opts = {}) {
|
|
|
1481
1520
|
},
|
|
1482
1521
|
[catalog, kind]
|
|
1483
1522
|
);
|
|
1484
|
-
const recovering =
|
|
1485
|
-
const failRef =
|
|
1523
|
+
const recovering = React2.useRef(false);
|
|
1524
|
+
const failRef = React2.useRef(
|
|
1486
1525
|
() => {
|
|
1487
1526
|
}
|
|
1488
1527
|
);
|
|
1489
|
-
const attemptRef =
|
|
1490
|
-
const succeed =
|
|
1528
|
+
const attemptRef = React2.useRef(async () => ({ ok: false }));
|
|
1529
|
+
const succeed = React2.useCallback(
|
|
1491
1530
|
(result, product) => {
|
|
1492
1531
|
setStatus("success");
|
|
1493
1532
|
const { productId, isSubscription } = productFacts(product);
|
|
@@ -1512,9 +1551,9 @@ function useCheckout(opts = {}) {
|
|
|
1512
1551
|
},
|
|
1513
1552
|
[tracker, nav, advance, opts, productFacts]
|
|
1514
1553
|
);
|
|
1515
|
-
const succeedRef =
|
|
1554
|
+
const succeedRef = React2.useRef(succeed);
|
|
1516
1555
|
succeedRef.current = succeed;
|
|
1517
|
-
const begin =
|
|
1556
|
+
const begin = React2.useCallback(
|
|
1518
1557
|
(product, surface) => {
|
|
1519
1558
|
setStatus("loading");
|
|
1520
1559
|
setError(null);
|
|
@@ -1529,7 +1568,7 @@ function useCheckout(opts = {}) {
|
|
|
1529
1568
|
},
|
|
1530
1569
|
[tracker, productFacts]
|
|
1531
1570
|
);
|
|
1532
|
-
const paymentAdded =
|
|
1571
|
+
const paymentAdded = React2.useCallback(
|
|
1533
1572
|
(product) => {
|
|
1534
1573
|
const { productId, amount, currency } = productFacts(product);
|
|
1535
1574
|
tracker.track("checkout.payment_added", {
|
|
@@ -1639,14 +1678,14 @@ function useCheckout(opts = {}) {
|
|
|
1639
1678
|
return { ok: false, error: err };
|
|
1640
1679
|
}
|
|
1641
1680
|
};
|
|
1642
|
-
const open =
|
|
1681
|
+
const open = React2.useCallback(
|
|
1643
1682
|
async (product, surface) => {
|
|
1644
1683
|
recovering.current = false;
|
|
1645
1684
|
return attemptRef.current(product, surface);
|
|
1646
1685
|
},
|
|
1647
1686
|
[]
|
|
1648
1687
|
);
|
|
1649
|
-
const callbacksFor =
|
|
1688
|
+
const callbacksFor = React2.useCallback(
|
|
1650
1689
|
(product, surface) => ({
|
|
1651
1690
|
onStart: () => {
|
|
1652
1691
|
recovering.current = false;
|
|
@@ -1658,7 +1697,7 @@ function useCheckout(opts = {}) {
|
|
|
1658
1697
|
}),
|
|
1659
1698
|
[begin, paymentAdded]
|
|
1660
1699
|
);
|
|
1661
|
-
const reset =
|
|
1700
|
+
const reset = React2.useCallback(() => {
|
|
1662
1701
|
recovering.current = false;
|
|
1663
1702
|
setStatus("idle");
|
|
1664
1703
|
setError(null);
|
|
@@ -1675,11 +1714,11 @@ function useCheckout(opts = {}) {
|
|
|
1675
1714
|
var CheckoutSheet = defineModal(({ product, surface, intent, kind, onSuccess, onError, onPaymentAdded }) => {
|
|
1676
1715
|
const driver = useDriver();
|
|
1677
1716
|
const modal = useModal();
|
|
1678
|
-
const resolved =
|
|
1679
|
-
const onErrorRef =
|
|
1717
|
+
const resolved = React2.useRef(false);
|
|
1718
|
+
const onErrorRef = React2.useRef(onError);
|
|
1680
1719
|
onErrorRef.current = onError;
|
|
1681
1720
|
const hostable = !!driver.renderInline;
|
|
1682
|
-
|
|
1721
|
+
React2.useEffect(() => {
|
|
1683
1722
|
if (!hostable) {
|
|
1684
1723
|
resolved.current = true;
|
|
1685
1724
|
onErrorRef.current(
|
|
@@ -1709,7 +1748,7 @@ var CheckoutSheet = defineModal(({ product, surface, intent, kind, onSuccess, on
|
|
|
1709
1748
|
void modal.hide();
|
|
1710
1749
|
modal.remove();
|
|
1711
1750
|
};
|
|
1712
|
-
return
|
|
1751
|
+
return React2.createElement(Sheet, {
|
|
1713
1752
|
children: driver.renderInline(
|
|
1714
1753
|
{ product, intent, surface, kind },
|
|
1715
1754
|
{
|
|
@@ -1732,11 +1771,11 @@ function trigger(onClick, {
|
|
|
1732
1771
|
className,
|
|
1733
1772
|
disabled
|
|
1734
1773
|
}) {
|
|
1735
|
-
if (asChild &&
|
|
1774
|
+
if (asChild && React2.isValidElement(children)) {
|
|
1736
1775
|
const child = children;
|
|
1737
|
-
return
|
|
1776
|
+
return React2.cloneElement(child, { onClick });
|
|
1738
1777
|
}
|
|
1739
|
-
return
|
|
1778
|
+
return React2.createElement(
|
|
1740
1779
|
"button",
|
|
1741
1780
|
{ type: "button", className, disabled, onClick },
|
|
1742
1781
|
children ?? "Continue"
|
|
@@ -1764,13 +1803,13 @@ function Checkout({
|
|
|
1764
1803
|
}) {
|
|
1765
1804
|
const product = offering;
|
|
1766
1805
|
const driver = useDriver();
|
|
1767
|
-
const [surface] =
|
|
1806
|
+
const [surface] = React2.useState(
|
|
1768
1807
|
() => chunk7JLOF6CJ_cjs.resolveSurface(driver.provider, surfacePreference, detectDeviceClass())
|
|
1769
1808
|
);
|
|
1770
1809
|
const checkout = useCheckout(options);
|
|
1771
1810
|
const intent = options.intent ?? "purchase";
|
|
1772
1811
|
if (chunk7JLOF6CJ_cjs.isInlineSurface(surface)) {
|
|
1773
|
-
return driver.renderInline ?
|
|
1812
|
+
return driver.renderInline ? React2.createElement(
|
|
1774
1813
|
"div",
|
|
1775
1814
|
{ key: product, className },
|
|
1776
1815
|
driver.renderInline(
|
|
@@ -1835,9 +1874,9 @@ var consumedResumes = /* @__PURE__ */ new Set();
|
|
|
1835
1874
|
function CheckoutResume(options = {}) {
|
|
1836
1875
|
const driver = useDriver();
|
|
1837
1876
|
const checkout = useCheckout(options);
|
|
1838
|
-
const callbacksRef =
|
|
1877
|
+
const callbacksRef = React2.useRef(checkout.callbacksFor);
|
|
1839
1878
|
callbacksRef.current = checkout.callbacksFor;
|
|
1840
|
-
|
|
1879
|
+
React2.useEffect(() => {
|
|
1841
1880
|
if (typeof window === "undefined" || !driver.resume) return;
|
|
1842
1881
|
const url = new URL(window.location.href);
|
|
1843
1882
|
const correlationId = url.searchParams.get("af_checkout");
|
|
@@ -1889,64 +1928,64 @@ var getAsset = (type) => {
|
|
|
1889
1928
|
};
|
|
1890
1929
|
var bars = Array(12).fill(0);
|
|
1891
1930
|
var Loader = ({ visible, className }) => {
|
|
1892
|
-
return /* @__PURE__ */
|
|
1931
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
1893
1932
|
className: [
|
|
1894
1933
|
"sonner-loading-wrapper",
|
|
1895
1934
|
className
|
|
1896
1935
|
].filter(Boolean).join(" "),
|
|
1897
1936
|
"data-visible": visible
|
|
1898
|
-
}, /* @__PURE__ */
|
|
1937
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
1899
1938
|
className: "sonner-spinner"
|
|
1900
|
-
}, bars.map((_, i) => /* @__PURE__ */
|
|
1939
|
+
}, bars.map((_, i) => /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
1901
1940
|
className: "sonner-loading-bar",
|
|
1902
1941
|
key: `spinner-bar-${i}`
|
|
1903
1942
|
}))));
|
|
1904
1943
|
};
|
|
1905
|
-
var SuccessIcon = /* @__PURE__ */
|
|
1944
|
+
var SuccessIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1906
1945
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1907
1946
|
viewBox: "0 0 20 20",
|
|
1908
1947
|
fill: "currentColor",
|
|
1909
1948
|
height: "20",
|
|
1910
1949
|
width: "20"
|
|
1911
|
-
}, /* @__PURE__ */
|
|
1950
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1912
1951
|
fillRule: "evenodd",
|
|
1913
1952
|
d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
|
|
1914
1953
|
clipRule: "evenodd"
|
|
1915
1954
|
}));
|
|
1916
|
-
var WarningIcon = /* @__PURE__ */
|
|
1955
|
+
var WarningIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1917
1956
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1918
1957
|
viewBox: "0 0 24 24",
|
|
1919
1958
|
fill: "currentColor",
|
|
1920
1959
|
height: "20",
|
|
1921
1960
|
width: "20"
|
|
1922
|
-
}, /* @__PURE__ */
|
|
1961
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1923
1962
|
fillRule: "evenodd",
|
|
1924
1963
|
d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
|
|
1925
1964
|
clipRule: "evenodd"
|
|
1926
1965
|
}));
|
|
1927
|
-
var InfoIcon = /* @__PURE__ */
|
|
1966
|
+
var InfoIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1928
1967
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1929
1968
|
viewBox: "0 0 20 20",
|
|
1930
1969
|
fill: "currentColor",
|
|
1931
1970
|
height: "20",
|
|
1932
1971
|
width: "20"
|
|
1933
|
-
}, /* @__PURE__ */
|
|
1972
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1934
1973
|
fillRule: "evenodd",
|
|
1935
1974
|
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
|
|
1936
1975
|
clipRule: "evenodd"
|
|
1937
1976
|
}));
|
|
1938
|
-
var ErrorIcon = /* @__PURE__ */
|
|
1977
|
+
var ErrorIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1939
1978
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1940
1979
|
viewBox: "0 0 20 20",
|
|
1941
1980
|
fill: "currentColor",
|
|
1942
1981
|
height: "20",
|
|
1943
1982
|
width: "20"
|
|
1944
|
-
}, /* @__PURE__ */
|
|
1983
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1945
1984
|
fillRule: "evenodd",
|
|
1946
1985
|
d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
|
|
1947
1986
|
clipRule: "evenodd"
|
|
1948
1987
|
}));
|
|
1949
|
-
var CloseIcon = /* @__PURE__ */
|
|
1988
|
+
var CloseIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1950
1989
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1951
1990
|
width: "12",
|
|
1952
1991
|
height: "12",
|
|
@@ -1956,20 +1995,20 @@ var CloseIcon = /* @__PURE__ */ React__default.default.createElement("svg", {
|
|
|
1956
1995
|
strokeWidth: "1.5",
|
|
1957
1996
|
strokeLinecap: "round",
|
|
1958
1997
|
strokeLinejoin: "round"
|
|
1959
|
-
}, /* @__PURE__ */
|
|
1998
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("line", {
|
|
1960
1999
|
x1: "18",
|
|
1961
2000
|
y1: "6",
|
|
1962
2001
|
x2: "6",
|
|
1963
2002
|
y2: "18"
|
|
1964
|
-
}), /* @__PURE__ */
|
|
2003
|
+
}), /* @__PURE__ */ React2__namespace.default.createElement("line", {
|
|
1965
2004
|
x1: "6",
|
|
1966
2005
|
y1: "6",
|
|
1967
2006
|
x2: "18",
|
|
1968
2007
|
y2: "18"
|
|
1969
2008
|
}));
|
|
1970
2009
|
var useIsDocumentHidden = () => {
|
|
1971
|
-
const [isDocumentHidden, setIsDocumentHidden] =
|
|
1972
|
-
|
|
2010
|
+
const [isDocumentHidden, setIsDocumentHidden] = React2__namespace.default.useState(document.hidden);
|
|
2011
|
+
React2__namespace.default.useEffect(() => {
|
|
1973
2012
|
const callback = () => {
|
|
1974
2013
|
setIsDocumentHidden(document.hidden);
|
|
1975
2014
|
};
|
|
@@ -2118,7 +2157,7 @@ var Observer = class {
|
|
|
2118
2157
|
"resolve",
|
|
2119
2158
|
response
|
|
2120
2159
|
];
|
|
2121
|
-
const isReactElementResponse =
|
|
2160
|
+
const isReactElementResponse = React2__namespace.default.isValidElement(response);
|
|
2122
2161
|
if (isReactElementResponse) {
|
|
2123
2162
|
shouldDismiss = false;
|
|
2124
2163
|
this.create({
|
|
@@ -2130,7 +2169,7 @@ var Observer = class {
|
|
|
2130
2169
|
shouldDismiss = false;
|
|
2131
2170
|
const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
2132
2171
|
const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
2133
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2172
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2134
2173
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2135
2174
|
message: promiseData
|
|
2136
2175
|
};
|
|
@@ -2144,7 +2183,7 @@ var Observer = class {
|
|
|
2144
2183
|
shouldDismiss = false;
|
|
2145
2184
|
const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
2146
2185
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2147
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2186
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2148
2187
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2149
2188
|
message: promiseData
|
|
2150
2189
|
};
|
|
@@ -2158,7 +2197,7 @@ var Observer = class {
|
|
|
2158
2197
|
shouldDismiss = false;
|
|
2159
2198
|
const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
2160
2199
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2161
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2200
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2162
2201
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2163
2202
|
message: promiseData
|
|
2164
2203
|
};
|
|
@@ -2178,7 +2217,7 @@ var Observer = class {
|
|
|
2178
2217
|
shouldDismiss = false;
|
|
2179
2218
|
const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
2180
2219
|
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
2181
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2220
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2182
2221
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2183
2222
|
message: promiseData
|
|
2184
2223
|
};
|
|
@@ -2283,45 +2322,45 @@ function getDefaultSwipeDirections(position) {
|
|
|
2283
2322
|
var Toast = (props) => {
|
|
2284
2323
|
var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
|
|
2285
2324
|
const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
|
|
2286
|
-
const [swipeDirection, setSwipeDirection] =
|
|
2287
|
-
const [swipeOutDirection, setSwipeOutDirection] =
|
|
2288
|
-
const [mounted, setMounted] =
|
|
2289
|
-
const [removed, setRemoved] =
|
|
2290
|
-
const [swiping, setSwiping] =
|
|
2291
|
-
const [swipeOut, setSwipeOut] =
|
|
2292
|
-
const [isSwiped, setIsSwiped] =
|
|
2293
|
-
const [offsetBeforeRemove, setOffsetBeforeRemove] =
|
|
2294
|
-
const [initialHeight, setInitialHeight] =
|
|
2295
|
-
const remainingTime =
|
|
2296
|
-
const dragStartTime =
|
|
2297
|
-
const toastRef =
|
|
2325
|
+
const [swipeDirection, setSwipeDirection] = React2__namespace.default.useState(null);
|
|
2326
|
+
const [swipeOutDirection, setSwipeOutDirection] = React2__namespace.default.useState(null);
|
|
2327
|
+
const [mounted, setMounted] = React2__namespace.default.useState(false);
|
|
2328
|
+
const [removed, setRemoved] = React2__namespace.default.useState(false);
|
|
2329
|
+
const [swiping, setSwiping] = React2__namespace.default.useState(false);
|
|
2330
|
+
const [swipeOut, setSwipeOut] = React2__namespace.default.useState(false);
|
|
2331
|
+
const [isSwiped, setIsSwiped] = React2__namespace.default.useState(false);
|
|
2332
|
+
const [offsetBeforeRemove, setOffsetBeforeRemove] = React2__namespace.default.useState(0);
|
|
2333
|
+
const [initialHeight, setInitialHeight] = React2__namespace.default.useState(0);
|
|
2334
|
+
const remainingTime = React2__namespace.default.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
|
|
2335
|
+
const dragStartTime = React2__namespace.default.useRef(null);
|
|
2336
|
+
const toastRef = React2__namespace.default.useRef(null);
|
|
2298
2337
|
const isFront = index === 0;
|
|
2299
2338
|
const isVisible = index + 1 <= visibleToasts;
|
|
2300
2339
|
const toastType = toast2.type;
|
|
2301
2340
|
const dismissible = toast2.dismissible !== false;
|
|
2302
2341
|
const toastClassname = toast2.className || "";
|
|
2303
2342
|
const toastDescriptionClassname = toast2.descriptionClassName || "";
|
|
2304
|
-
const heightIndex =
|
|
2343
|
+
const heightIndex = React2__namespace.default.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
|
|
2305
2344
|
heights,
|
|
2306
2345
|
toast2.id
|
|
2307
2346
|
]);
|
|
2308
|
-
const closeButton =
|
|
2347
|
+
const closeButton = React2__namespace.default.useMemo(() => {
|
|
2309
2348
|
var _toast_closeButton;
|
|
2310
2349
|
return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
|
|
2311
2350
|
}, [
|
|
2312
2351
|
toast2.closeButton,
|
|
2313
2352
|
closeButtonFromToaster
|
|
2314
2353
|
]);
|
|
2315
|
-
const duration =
|
|
2354
|
+
const duration = React2__namespace.default.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
|
|
2316
2355
|
toast2.duration,
|
|
2317
2356
|
durationFromToaster
|
|
2318
2357
|
]);
|
|
2319
|
-
const closeTimerStartTimeRef =
|
|
2320
|
-
const offset =
|
|
2321
|
-
const lastCloseTimerStartTimeRef =
|
|
2322
|
-
const pointerStartRef =
|
|
2358
|
+
const closeTimerStartTimeRef = React2__namespace.default.useRef(0);
|
|
2359
|
+
const offset = React2__namespace.default.useRef(0);
|
|
2360
|
+
const lastCloseTimerStartTimeRef = React2__namespace.default.useRef(0);
|
|
2361
|
+
const pointerStartRef = React2__namespace.default.useRef(null);
|
|
2323
2362
|
const [y, x] = position.split("-");
|
|
2324
|
-
const toastsHeightBefore =
|
|
2363
|
+
const toastsHeightBefore = React2__namespace.default.useMemo(() => {
|
|
2325
2364
|
return heights.reduce((prev, curr, reducerIndex) => {
|
|
2326
2365
|
if (reducerIndex >= heightIndex) {
|
|
2327
2366
|
return prev;
|
|
@@ -2335,19 +2374,19 @@ var Toast = (props) => {
|
|
|
2335
2374
|
const isDocumentHidden = useIsDocumentHidden();
|
|
2336
2375
|
const invert = toast2.invert || ToasterInvert;
|
|
2337
2376
|
const disabled = toastType === "loading";
|
|
2338
|
-
offset.current =
|
|
2377
|
+
offset.current = React2__namespace.default.useMemo(() => heightIndex * gap + toastsHeightBefore, [
|
|
2339
2378
|
heightIndex,
|
|
2340
2379
|
toastsHeightBefore
|
|
2341
2380
|
]);
|
|
2342
|
-
|
|
2381
|
+
React2__namespace.default.useEffect(() => {
|
|
2343
2382
|
remainingTime.current = duration;
|
|
2344
2383
|
}, [
|
|
2345
2384
|
duration
|
|
2346
2385
|
]);
|
|
2347
|
-
|
|
2386
|
+
React2__namespace.default.useEffect(() => {
|
|
2348
2387
|
setMounted(true);
|
|
2349
2388
|
}, []);
|
|
2350
|
-
|
|
2389
|
+
React2__namespace.default.useEffect(() => {
|
|
2351
2390
|
const toastNode = toastRef.current;
|
|
2352
2391
|
if (toastNode) {
|
|
2353
2392
|
const height = toastNode.getBoundingClientRect().height;
|
|
@@ -2366,7 +2405,7 @@ var Toast = (props) => {
|
|
|
2366
2405
|
setHeights,
|
|
2367
2406
|
toast2.id
|
|
2368
2407
|
]);
|
|
2369
|
-
|
|
2408
|
+
React2__namespace.default.useLayoutEffect(() => {
|
|
2370
2409
|
if (!mounted) return;
|
|
2371
2410
|
const toastNode = toastRef.current;
|
|
2372
2411
|
const originalHeight = toastNode.style.height;
|
|
@@ -2402,7 +2441,7 @@ var Toast = (props) => {
|
|
|
2402
2441
|
toast2.action,
|
|
2403
2442
|
toast2.cancel
|
|
2404
2443
|
]);
|
|
2405
|
-
const deleteToast =
|
|
2444
|
+
const deleteToast = React2__namespace.default.useCallback(() => {
|
|
2406
2445
|
setRemoved(true);
|
|
2407
2446
|
setOffsetBeforeRemove(offset.current);
|
|
2408
2447
|
setHeights((h) => h.filter((height) => height.toastId !== toast2.id));
|
|
@@ -2415,7 +2454,7 @@ var Toast = (props) => {
|
|
|
2415
2454
|
setHeights,
|
|
2416
2455
|
offset
|
|
2417
2456
|
]);
|
|
2418
|
-
|
|
2457
|
+
React2__namespace.default.useEffect(() => {
|
|
2419
2458
|
if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
|
|
2420
2459
|
let timeoutId;
|
|
2421
2460
|
const pauseTimer = () => {
|
|
@@ -2447,7 +2486,7 @@ var Toast = (props) => {
|
|
|
2447
2486
|
isDocumentHidden,
|
|
2448
2487
|
deleteToast
|
|
2449
2488
|
]);
|
|
2450
|
-
|
|
2489
|
+
React2__namespace.default.useEffect(() => {
|
|
2451
2490
|
if (toast2.delete) {
|
|
2452
2491
|
deleteToast();
|
|
2453
2492
|
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
@@ -2460,19 +2499,19 @@ var Toast = (props) => {
|
|
|
2460
2499
|
var _toast_classNames9;
|
|
2461
2500
|
if (icons == null ? void 0 : icons.loading) {
|
|
2462
2501
|
var _toast_classNames12;
|
|
2463
|
-
return /* @__PURE__ */
|
|
2502
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
2464
2503
|
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
|
|
2465
2504
|
"data-visible": toastType === "loading"
|
|
2466
2505
|
}, icons.loading);
|
|
2467
2506
|
}
|
|
2468
|
-
return /* @__PURE__ */
|
|
2507
|
+
return /* @__PURE__ */ React2__namespace.default.createElement(Loader, {
|
|
2469
2508
|
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
|
|
2470
2509
|
visible: toastType === "loading"
|
|
2471
2510
|
});
|
|
2472
2511
|
}
|
|
2473
2512
|
const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
|
|
2474
2513
|
var _toast_richColors, _icons_close;
|
|
2475
|
-
return /* @__PURE__ */
|
|
2514
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("li", {
|
|
2476
2515
|
tabIndex: 0,
|
|
2477
2516
|
ref: toastRef,
|
|
2478
2517
|
className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
|
|
@@ -2597,7 +2636,7 @@ var Toast = (props) => {
|
|
|
2597
2636
|
(_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
|
|
2598
2637
|
(_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
|
|
2599
2638
|
}
|
|
2600
|
-
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */
|
|
2639
|
+
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ React2__namespace.default.createElement("button", {
|
|
2601
2640
|
"aria-label": closeButtonAriaLabel,
|
|
2602
2641
|
"data-disabled": disabled,
|
|
2603
2642
|
"data-close-button": true,
|
|
@@ -2607,19 +2646,19 @@ var Toast = (props) => {
|
|
|
2607
2646
|
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
2608
2647
|
},
|
|
2609
2648
|
className: cn(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
|
|
2610
|
-
}, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */
|
|
2649
|
+
}, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
2611
2650
|
"data-icon": "",
|
|
2612
2651
|
className: cn(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
|
|
2613
|
-
}, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */
|
|
2652
|
+
}, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
2614
2653
|
"data-content": "",
|
|
2615
2654
|
className: cn(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
|
|
2616
|
-
}, /* @__PURE__ */
|
|
2655
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
2617
2656
|
"data-title": "",
|
|
2618
2657
|
className: cn(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
|
|
2619
|
-
}, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */
|
|
2658
|
+
}, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
2620
2659
|
"data-description": "",
|
|
2621
2660
|
className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
|
|
2622
|
-
}, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */
|
|
2661
|
+
}, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ React2__namespace.default.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ React2__namespace.default.createElement("button", {
|
|
2623
2662
|
"data-button": true,
|
|
2624
2663
|
"data-cancel": true,
|
|
2625
2664
|
style: toast2.cancelButtonStyle || cancelButtonStyle,
|
|
@@ -2630,7 +2669,7 @@ var Toast = (props) => {
|
|
|
2630
2669
|
deleteToast();
|
|
2631
2670
|
},
|
|
2632
2671
|
className: cn(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
|
|
2633
|
-
}, toast2.cancel.label) : null, /* @__PURE__ */
|
|
2672
|
+
}, toast2.cancel.label) : null, /* @__PURE__ */ React2__namespace.default.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ React2__namespace.default.createElement("button", {
|
|
2634
2673
|
"data-button": true,
|
|
2635
2674
|
"data-action": true,
|
|
2636
2675
|
style: toast2.actionButtonStyle || actionButtonStyle,
|
|
@@ -2692,13 +2731,13 @@ function assignOffset(defaultOffset, mobileOffset) {
|
|
|
2692
2731
|
});
|
|
2693
2732
|
return styles;
|
|
2694
2733
|
}
|
|
2695
|
-
var Toaster = /* @__PURE__ */
|
|
2734
|
+
var Toaster = /* @__PURE__ */ React2__namespace.default.forwardRef(function Toaster2(props, ref) {
|
|
2696
2735
|
const { id, invert, position = "bottom-right", hotkey = [
|
|
2697
2736
|
"altKey",
|
|
2698
2737
|
"KeyT"
|
|
2699
2738
|
], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
|
|
2700
|
-
const [toasts, setToasts] =
|
|
2701
|
-
const filteredToasts =
|
|
2739
|
+
const [toasts, setToasts] = React2__namespace.default.useState([]);
|
|
2740
|
+
const filteredToasts = React2__namespace.default.useMemo(() => {
|
|
2702
2741
|
if (id) {
|
|
2703
2742
|
return toasts.filter((toast2) => toast2.toasterId === id);
|
|
2704
2743
|
}
|
|
@@ -2707,7 +2746,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2707
2746
|
toasts,
|
|
2708
2747
|
id
|
|
2709
2748
|
]);
|
|
2710
|
-
const possiblePositions =
|
|
2749
|
+
const possiblePositions = React2__namespace.default.useMemo(() => {
|
|
2711
2750
|
return Array.from(new Set([
|
|
2712
2751
|
position
|
|
2713
2752
|
].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
|
|
@@ -2715,15 +2754,15 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2715
2754
|
filteredToasts,
|
|
2716
2755
|
position
|
|
2717
2756
|
]);
|
|
2718
|
-
const [heights, setHeights] =
|
|
2719
|
-
const [expanded, setExpanded] =
|
|
2720
|
-
const [interacting, setInteracting] =
|
|
2721
|
-
const [actualTheme, setActualTheme] =
|
|
2722
|
-
const listRef =
|
|
2757
|
+
const [heights, setHeights] = React2__namespace.default.useState([]);
|
|
2758
|
+
const [expanded, setExpanded] = React2__namespace.default.useState(false);
|
|
2759
|
+
const [interacting, setInteracting] = React2__namespace.default.useState(false);
|
|
2760
|
+
const [actualTheme, setActualTheme] = React2__namespace.default.useState(theme !== "system" ? theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
|
|
2761
|
+
const listRef = React2__namespace.default.useRef(null);
|
|
2723
2762
|
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
2724
|
-
const lastFocusedElementRef =
|
|
2725
|
-
const isFocusWithinRef =
|
|
2726
|
-
const removeToast =
|
|
2763
|
+
const lastFocusedElementRef = React2__namespace.default.useRef(null);
|
|
2764
|
+
const isFocusWithinRef = React2__namespace.default.useRef(false);
|
|
2765
|
+
const removeToast = React2__namespace.default.useCallback((toastToRemove) => {
|
|
2727
2766
|
setToasts((toasts2) => {
|
|
2728
2767
|
var _toasts_find;
|
|
2729
2768
|
if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
|
|
@@ -2732,7 +2771,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2732
2771
|
return toasts2.filter(({ id: id2 }) => id2 !== toastToRemove.id);
|
|
2733
2772
|
});
|
|
2734
2773
|
}, []);
|
|
2735
|
-
|
|
2774
|
+
React2__namespace.default.useEffect(() => {
|
|
2736
2775
|
return ToastState.subscribe((toast2) => {
|
|
2737
2776
|
if (toast2.dismiss) {
|
|
2738
2777
|
requestAnimationFrame(() => {
|
|
@@ -2768,7 +2807,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2768
2807
|
}, [
|
|
2769
2808
|
toasts
|
|
2770
2809
|
]);
|
|
2771
|
-
|
|
2810
|
+
React2__namespace.default.useEffect(() => {
|
|
2772
2811
|
if (theme !== "system") {
|
|
2773
2812
|
setActualTheme(theme);
|
|
2774
2813
|
return;
|
|
@@ -2806,14 +2845,14 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2806
2845
|
}, [
|
|
2807
2846
|
theme
|
|
2808
2847
|
]);
|
|
2809
|
-
|
|
2848
|
+
React2__namespace.default.useEffect(() => {
|
|
2810
2849
|
if (toasts.length <= 1) {
|
|
2811
2850
|
setExpanded(false);
|
|
2812
2851
|
}
|
|
2813
2852
|
}, [
|
|
2814
2853
|
toasts
|
|
2815
2854
|
]);
|
|
2816
|
-
|
|
2855
|
+
React2__namespace.default.useEffect(() => {
|
|
2817
2856
|
const handleKeyDown = (event) => {
|
|
2818
2857
|
var _listRef_current;
|
|
2819
2858
|
const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
|
|
@@ -2831,7 +2870,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2831
2870
|
}, [
|
|
2832
2871
|
hotkey
|
|
2833
2872
|
]);
|
|
2834
|
-
|
|
2873
|
+
React2__namespace.default.useEffect(() => {
|
|
2835
2874
|
if (listRef.current) {
|
|
2836
2875
|
return () => {
|
|
2837
2876
|
if (lastFocusedElementRef.current) {
|
|
@@ -2848,7 +2887,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2848
2887
|
]);
|
|
2849
2888
|
return (
|
|
2850
2889
|
// Remove item from normal navigation flow, only available via hotkey
|
|
2851
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ React2__namespace.default.createElement("section", {
|
|
2852
2891
|
ref,
|
|
2853
2892
|
"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
|
|
2854
2893
|
tabIndex: -1,
|
|
@@ -2860,7 +2899,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2860
2899
|
var _heights_;
|
|
2861
2900
|
const [y, x] = position2.split("-");
|
|
2862
2901
|
if (!filteredToasts.length) return null;
|
|
2863
|
-
return /* @__PURE__ */
|
|
2902
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("ol", {
|
|
2864
2903
|
key: position2,
|
|
2865
2904
|
dir: dir === "auto" ? getDocumentDirection() : dir,
|
|
2866
2905
|
tabIndex: -1,
|
|
@@ -2912,7 +2951,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2912
2951
|
onPointerUp: () => setInteracting(false)
|
|
2913
2952
|
}, filteredToasts.filter((toast2) => !toast2.position && index === 0 || toast2.position === position2).map((toast2, index2) => {
|
|
2914
2953
|
var _toastOptions_duration, _toastOptions_closeButton;
|
|
2915
|
-
return /* @__PURE__ */
|
|
2954
|
+
return /* @__PURE__ */ React2__namespace.default.createElement(Toast, {
|
|
2916
2955
|
key: toast2.id,
|
|
2917
2956
|
icons,
|
|
2918
2957
|
index: index2,
|
|
@@ -2946,7 +2985,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2946
2985
|
);
|
|
2947
2986
|
});
|
|
2948
2987
|
function FunnelToaster(props = {}) {
|
|
2949
|
-
return
|
|
2988
|
+
return React2.createElement(Toaster, { position: "top-center", ...props });
|
|
2950
2989
|
}
|
|
2951
2990
|
function renderToaster(toaster) {
|
|
2952
2991
|
if (toaster === false) return null;
|
|
@@ -3017,7 +3056,7 @@ function createFunnel(store, context, tracker, experiments = []) {
|
|
|
3017
3056
|
})
|
|
3018
3057
|
};
|
|
3019
3058
|
}
|
|
3020
|
-
var FunnelCtx =
|
|
3059
|
+
var FunnelCtx = React2.createContext(null);
|
|
3021
3060
|
function FunnelProvider({
|
|
3022
3061
|
config,
|
|
3023
3062
|
sessionValues,
|
|
@@ -3034,7 +3073,7 @@ function FunnelProvider({
|
|
|
3034
3073
|
children
|
|
3035
3074
|
}) {
|
|
3036
3075
|
const resolvedTracker = tracker ?? FALLBACK_TRACKER;
|
|
3037
|
-
const [value] =
|
|
3076
|
+
const [value] = React2.useState(() => {
|
|
3038
3077
|
const s = store ?? createFunnelStore(
|
|
3039
3078
|
{ responses: config?.responses, data: config?.data },
|
|
3040
3079
|
// FLASH-FREE HYDRATION: with deferSessionValues the initial render is seeded with
|
|
@@ -3060,7 +3099,7 @@ function FunnelProvider({
|
|
|
3060
3099
|
const value2 = s.get("user.email");
|
|
3061
3100
|
return typeof value2 === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value2) ? value2 : void 0;
|
|
3062
3101
|
};
|
|
3063
|
-
const catalog =
|
|
3102
|
+
const catalog = chunk7HDZVHIT_cjs.buildCatalog(offerings ?? []);
|
|
3064
3103
|
return {
|
|
3065
3104
|
funnel: createFunnel(s, ctx, busTracker, experiments ?? []),
|
|
3066
3105
|
store: s,
|
|
@@ -3079,41 +3118,41 @@ function FunnelProvider({
|
|
|
3079
3118
|
bus
|
|
3080
3119
|
};
|
|
3081
3120
|
});
|
|
3082
|
-
|
|
3083
|
-
|
|
3121
|
+
React2.useEffect(() => attachBus(value.bus), [value.bus]);
|
|
3122
|
+
React2.useEffect(() => {
|
|
3084
3123
|
if (!deferSessionValues || !sessionValues) return;
|
|
3085
3124
|
const updates = {};
|
|
3086
3125
|
for (const [key, v] of Object.entries(sessionValues))
|
|
3087
3126
|
if (v !== void 0) updates[key] = v;
|
|
3088
3127
|
if (Object.keys(updates).length > 0) value.store.setMany(updates);
|
|
3089
3128
|
}, []);
|
|
3090
|
-
|
|
3129
|
+
React2.useEffect(() => {
|
|
3091
3130
|
value.tracker.setAcquisition?.(buildAcquisition(value.context));
|
|
3092
3131
|
}, [value]);
|
|
3093
|
-
const tree =
|
|
3132
|
+
const tree = React2.createElement(TrackerProvider, {
|
|
3094
3133
|
tracker: value.tracker,
|
|
3095
|
-
children:
|
|
3134
|
+
children: React2.createElement(CheckoutDriverProvider, {
|
|
3096
3135
|
driver: value.driver,
|
|
3097
|
-
children:
|
|
3136
|
+
children: React2.createElement(CatalogProvider, {
|
|
3098
3137
|
catalog: value.catalog,
|
|
3099
|
-
children:
|
|
3138
|
+
children: React2.createElement(FunnelCtx.Provider, {
|
|
3100
3139
|
value,
|
|
3101
|
-
children:
|
|
3140
|
+
children: React2.createElement(LocaleProvider, {
|
|
3102
3141
|
config: config?.locales,
|
|
3103
3142
|
catalog: messages,
|
|
3104
3143
|
detected: value.context.locale.locale,
|
|
3105
3144
|
override: localeOverride,
|
|
3106
|
-
children:
|
|
3145
|
+
children: React2.createElement(ModalRuntime, { children })
|
|
3107
3146
|
})
|
|
3108
3147
|
})
|
|
3109
3148
|
})
|
|
3110
3149
|
})
|
|
3111
3150
|
});
|
|
3112
|
-
return
|
|
3151
|
+
return React2.createElement(React2.Fragment, null, tree, renderToaster(toaster));
|
|
3113
3152
|
}
|
|
3114
3153
|
var FALLBACK_TRACKER = createConsoleTracker({ silent: true });
|
|
3115
3154
|
function useFunnelCtx() {
|
|
3116
|
-
const ctx =
|
|
3155
|
+
const ctx = React2.useContext(FunnelCtx);
|
|
3117
3156
|
if (!ctx) {
|
|
3118
3157
|
throw new Error(
|
|
3119
3158
|
"useFunnel/useResponse/\u2026 must be used inside <FunnelProvider>"
|
|
@@ -3125,21 +3164,21 @@ function useFunnel() {
|
|
|
3125
3164
|
return useFunnelCtx().funnel;
|
|
3126
3165
|
}
|
|
3127
3166
|
function useBusInternal() {
|
|
3128
|
-
return
|
|
3167
|
+
return React2.useContext(FunnelCtx)?.bus ?? null;
|
|
3129
3168
|
}
|
|
3130
3169
|
function useStoreKey(store, key) {
|
|
3131
|
-
const subscribe =
|
|
3170
|
+
const subscribe = React2.useCallback(
|
|
3132
3171
|
(cb) => store.subscribe(cb, { keys: [key] }),
|
|
3133
3172
|
[store, key]
|
|
3134
3173
|
);
|
|
3135
|
-
const getSnapshot =
|
|
3136
|
-
return
|
|
3174
|
+
const getSnapshot = React2.useCallback(() => store.get(key), [store, key]);
|
|
3175
|
+
return React2.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
3137
3176
|
}
|
|
3138
3177
|
function makeFieldHook(ns) {
|
|
3139
3178
|
return function useNamespaceField(key) {
|
|
3140
3179
|
const { funnel, store } = useFunnelCtx();
|
|
3141
3180
|
const value = useStoreKey(store, `${NAMESPACE_PREFIX[ns]}.${key}`);
|
|
3142
|
-
const set =
|
|
3181
|
+
const set = React2.useCallback(
|
|
3143
3182
|
(v) => funnel[ns].set({ [key]: v }),
|
|
3144
3183
|
[funnel, key]
|
|
3145
3184
|
);
|
|
@@ -3160,7 +3199,7 @@ function useField(path) {
|
|
|
3160
3199
|
);
|
|
3161
3200
|
}
|
|
3162
3201
|
const value = useStoreKey(store, `${NAMESPACE_PREFIX[ns]}.${key}`);
|
|
3163
|
-
const set =
|
|
3202
|
+
const set = React2.useCallback(
|
|
3164
3203
|
(v) => funnel[ns].set({ [key]: v }),
|
|
3165
3204
|
[funnel, ns, key]
|
|
3166
3205
|
);
|
|
@@ -3186,7 +3225,7 @@ function useSystem() {
|
|
|
3186
3225
|
}
|
|
3187
3226
|
function useContextValue(path) {
|
|
3188
3227
|
const ctx = useContextObject();
|
|
3189
|
-
return
|
|
3228
|
+
return React2.useMemo(
|
|
3190
3229
|
() => path.split(".").reduce(
|
|
3191
3230
|
(acc, k) => acc?.[k],
|
|
3192
3231
|
ctx
|
|
@@ -3500,18 +3539,18 @@ function createPlatformTracker(cfg) {
|
|
|
3500
3539
|
}
|
|
3501
3540
|
|
|
3502
3541
|
// src/flow/mount.tsx
|
|
3503
|
-
var AssetsContext =
|
|
3542
|
+
var AssetsContext = React2.createContext({});
|
|
3504
3543
|
function AssetsProvider({
|
|
3505
3544
|
assets,
|
|
3506
3545
|
children
|
|
3507
3546
|
}) {
|
|
3508
|
-
return
|
|
3547
|
+
return React2.createElement(AssetsContext.Provider, { value: assets ?? {} }, children);
|
|
3509
3548
|
}
|
|
3510
3549
|
function useAssets() {
|
|
3511
|
-
return
|
|
3550
|
+
return React2.useContext(AssetsContext);
|
|
3512
3551
|
}
|
|
3513
3552
|
function useAsset(name) {
|
|
3514
|
-
return
|
|
3553
|
+
return React2.useContext(AssetsContext)[name];
|
|
3515
3554
|
}
|
|
3516
3555
|
function createFunnelTree({
|
|
3517
3556
|
config,
|
|
@@ -3540,17 +3579,17 @@ function createFunnelTree({
|
|
|
3540
3579
|
const layoutWithResume = function LayoutWithCheckoutResume({
|
|
3541
3580
|
children
|
|
3542
3581
|
}) {
|
|
3543
|
-
return
|
|
3544
|
-
|
|
3582
|
+
return React2.createElement(
|
|
3583
|
+
React2.Fragment,
|
|
3545
3584
|
null,
|
|
3546
|
-
|
|
3547
|
-
embedEnabled ?
|
|
3548
|
-
layout ?
|
|
3585
|
+
React2.createElement(CheckoutResume, null),
|
|
3586
|
+
embedEnabled ? React2.createElement(EmbedBridge, null) : null,
|
|
3587
|
+
layout ? React2.createElement(layout, null, children) : children
|
|
3549
3588
|
);
|
|
3550
3589
|
};
|
|
3551
|
-
return
|
|
3590
|
+
return React2.createElement(AssetsProvider, {
|
|
3552
3591
|
assets: opts.assets,
|
|
3553
|
-
children:
|
|
3592
|
+
children: React2.createElement(FunnelProvider, {
|
|
3554
3593
|
config,
|
|
3555
3594
|
offerings: opts.offerings ?? [],
|
|
3556
3595
|
messages: opts.messages ?? messages,
|
|
@@ -3566,7 +3605,7 @@ function createFunnelTree({
|
|
|
3566
3605
|
customerId: opts.customerId ?? null,
|
|
3567
3606
|
sessionId: opts.sessionId ?? null
|
|
3568
3607
|
},
|
|
3569
|
-
children:
|
|
3608
|
+
children: React2.createElement(FunnelView, {
|
|
3570
3609
|
pages,
|
|
3571
3610
|
layout: layoutWithResume,
|
|
3572
3611
|
initialKey: opts.initialKey,
|
|
@@ -3596,7 +3635,7 @@ function Choice({
|
|
|
3596
3635
|
return options.map((opt) => {
|
|
3597
3636
|
const o = typeof opt === "string" ? { value: opt } : opt;
|
|
3598
3637
|
const selected = value === o.value;
|
|
3599
|
-
return
|
|
3638
|
+
return React2.createElement(
|
|
3600
3639
|
"button",
|
|
3601
3640
|
{
|
|
3602
3641
|
key: o.value,
|
|
@@ -3615,7 +3654,7 @@ function Choice({
|
|
|
3615
3654
|
}
|
|
3616
3655
|
function Next({ children, onClick, ...rest }) {
|
|
3617
3656
|
const { next } = useNavigation();
|
|
3618
|
-
return
|
|
3657
|
+
return React2.createElement(
|
|
3619
3658
|
"button",
|
|
3620
3659
|
{
|
|
3621
3660
|
type: "button",
|
|
@@ -3631,7 +3670,7 @@ function Next({ children, onClick, ...rest }) {
|
|
|
3631
3670
|
function Back({ children, onClick, ...rest }) {
|
|
3632
3671
|
const { back, canGoBack } = useNavigation();
|
|
3633
3672
|
if (!canGoBack) return null;
|
|
3634
|
-
return
|
|
3673
|
+
return React2.createElement(
|
|
3635
3674
|
"button",
|
|
3636
3675
|
{
|
|
3637
3676
|
type: "button",
|
|
@@ -3684,7 +3723,7 @@ function Script({
|
|
|
3684
3723
|
onLoad,
|
|
3685
3724
|
onError
|
|
3686
3725
|
}) {
|
|
3687
|
-
|
|
3726
|
+
React2.useEffect(() => {
|
|
3688
3727
|
if (typeof document === "undefined") return;
|
|
3689
3728
|
const key = id ?? src;
|
|
3690
3729
|
if (injected.has(key)) {
|
|
@@ -3725,111 +3764,111 @@ function Script({
|
|
|
3725
3764
|
|
|
3726
3765
|
Object.defineProperty(exports, "assignVariant", {
|
|
3727
3766
|
enumerable: true,
|
|
3728
|
-
get: function () { return
|
|
3767
|
+
get: function () { return chunk7HDZVHIT_cjs.assignVariant; }
|
|
3729
3768
|
});
|
|
3730
3769
|
Object.defineProperty(exports, "bucketingSeed", {
|
|
3731
3770
|
enumerable: true,
|
|
3732
|
-
get: function () { return
|
|
3771
|
+
get: function () { return chunk7HDZVHIT_cjs.bucketingSeed; }
|
|
3733
3772
|
});
|
|
3734
3773
|
Object.defineProperty(exports, "buildCatalog", {
|
|
3735
3774
|
enumerable: true,
|
|
3736
|
-
get: function () { return
|
|
3775
|
+
get: function () { return chunk7HDZVHIT_cjs.buildCatalog; }
|
|
3737
3776
|
});
|
|
3738
3777
|
Object.defineProperty(exports, "compileManifest", {
|
|
3739
3778
|
enumerable: true,
|
|
3740
|
-
get: function () { return
|
|
3779
|
+
get: function () { return chunk7HDZVHIT_cjs.compileManifest; }
|
|
3741
3780
|
});
|
|
3742
3781
|
Object.defineProperty(exports, "currencyExponent", {
|
|
3743
3782
|
enumerable: true,
|
|
3744
|
-
get: function () { return
|
|
3783
|
+
get: function () { return chunk7HDZVHIT_cjs.currencyExponent; }
|
|
3745
3784
|
});
|
|
3746
3785
|
Object.defineProperty(exports, "defineFunnel", {
|
|
3747
3786
|
enumerable: true,
|
|
3748
|
-
get: function () { return
|
|
3787
|
+
get: function () { return chunk7HDZVHIT_cjs.defineFunnel; }
|
|
3749
3788
|
});
|
|
3750
3789
|
Object.defineProperty(exports, "definePage", {
|
|
3751
3790
|
enumerable: true,
|
|
3752
|
-
get: function () { return
|
|
3791
|
+
get: function () { return chunk7HDZVHIT_cjs.definePage; }
|
|
3753
3792
|
});
|
|
3754
3793
|
Object.defineProperty(exports, "entryGuard", {
|
|
3755
3794
|
enumerable: true,
|
|
3756
|
-
get: function () { return
|
|
3795
|
+
get: function () { return chunk7HDZVHIT_cjs.entryGuard; }
|
|
3757
3796
|
});
|
|
3758
3797
|
Object.defineProperty(exports, "evaluateCondition", {
|
|
3759
3798
|
enumerable: true,
|
|
3760
|
-
get: function () { return
|
|
3799
|
+
get: function () { return chunk7HDZVHIT_cjs.evaluateCondition; }
|
|
3761
3800
|
});
|
|
3762
3801
|
Object.defineProperty(exports, "evaluateGate", {
|
|
3763
3802
|
enumerable: true,
|
|
3764
|
-
get: function () { return
|
|
3803
|
+
get: function () { return chunk7HDZVHIT_cjs.evaluateGate; }
|
|
3765
3804
|
});
|
|
3766
3805
|
Object.defineProperty(exports, "expectedPathLength", {
|
|
3767
3806
|
enumerable: true,
|
|
3768
|
-
get: function () { return
|
|
3807
|
+
get: function () { return chunk7HDZVHIT_cjs.expectedPathLength; }
|
|
3769
3808
|
});
|
|
3770
3809
|
Object.defineProperty(exports, "fnv1a", {
|
|
3771
3810
|
enumerable: true,
|
|
3772
|
-
get: function () { return
|
|
3811
|
+
get: function () { return chunk7HDZVHIT_cjs.fnv1a; }
|
|
3773
3812
|
});
|
|
3774
3813
|
Object.defineProperty(exports, "formatMoney", {
|
|
3775
3814
|
enumerable: true,
|
|
3776
|
-
get: function () { return
|
|
3815
|
+
get: function () { return chunk7HDZVHIT_cjs.formatMoney; }
|
|
3777
3816
|
});
|
|
3778
3817
|
Object.defineProperty(exports, "formatOffering", {
|
|
3779
3818
|
enumerable: true,
|
|
3780
|
-
get: function () { return
|
|
3819
|
+
get: function () { return chunk7HDZVHIT_cjs.formatOffering; }
|
|
3781
3820
|
});
|
|
3782
3821
|
Object.defineProperty(exports, "groupProgress", {
|
|
3783
3822
|
enumerable: true,
|
|
3784
|
-
get: function () { return
|
|
3823
|
+
get: function () { return chunk7HDZVHIT_cjs.groupProgress; }
|
|
3785
3824
|
});
|
|
3786
3825
|
Object.defineProperty(exports, "hashToUnit", {
|
|
3787
3826
|
enumerable: true,
|
|
3788
|
-
get: function () { return
|
|
3827
|
+
get: function () { return chunk7HDZVHIT_cjs.hashToUnit; }
|
|
3789
3828
|
});
|
|
3790
3829
|
Object.defineProperty(exports, "isRtl", {
|
|
3791
3830
|
enumerable: true,
|
|
3792
|
-
get: function () { return
|
|
3831
|
+
get: function () { return chunk7HDZVHIT_cjs.isRtl; }
|
|
3793
3832
|
});
|
|
3794
3833
|
Object.defineProperty(exports, "isVariantKey", {
|
|
3795
3834
|
enumerable: true,
|
|
3796
|
-
get: function () { return
|
|
3835
|
+
get: function () { return chunk7HDZVHIT_cjs.isVariantKey; }
|
|
3797
3836
|
});
|
|
3798
3837
|
Object.defineProperty(exports, "nextPage", {
|
|
3799
3838
|
enumerable: true,
|
|
3800
|
-
get: function () { return
|
|
3839
|
+
get: function () { return chunk7HDZVHIT_cjs.nextPage; }
|
|
3801
3840
|
});
|
|
3802
3841
|
Object.defineProperty(exports, "outgoingKeys", {
|
|
3803
3842
|
enumerable: true,
|
|
3804
|
-
get: function () { return
|
|
3843
|
+
get: function () { return chunk7HDZVHIT_cjs.outgoingKeys; }
|
|
3805
3844
|
});
|
|
3806
3845
|
Object.defineProperty(exports, "pageMeta", {
|
|
3807
3846
|
enumerable: true,
|
|
3808
|
-
get: function () { return
|
|
3847
|
+
get: function () { return chunk7HDZVHIT_cjs.pageMeta; }
|
|
3809
3848
|
});
|
|
3810
3849
|
Object.defineProperty(exports, "parseSlotKey", {
|
|
3811
3850
|
enumerable: true,
|
|
3812
|
-
get: function () { return
|
|
3851
|
+
get: function () { return chunk7HDZVHIT_cjs.parseSlotKey; }
|
|
3813
3852
|
});
|
|
3814
3853
|
Object.defineProperty(exports, "pickByWeight", {
|
|
3815
3854
|
enumerable: true,
|
|
3816
|
-
get: function () { return
|
|
3855
|
+
get: function () { return chunk7HDZVHIT_cjs.pickByWeight; }
|
|
3817
3856
|
});
|
|
3818
3857
|
Object.defineProperty(exports, "resolveExperiments", {
|
|
3819
3858
|
enumerable: true,
|
|
3820
|
-
get: function () { return
|
|
3859
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveExperiments; }
|
|
3821
3860
|
});
|
|
3822
3861
|
Object.defineProperty(exports, "resolveLocale", {
|
|
3823
3862
|
enumerable: true,
|
|
3824
|
-
get: function () { return
|
|
3863
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveLocale; }
|
|
3825
3864
|
});
|
|
3826
3865
|
Object.defineProperty(exports, "resolveOffering", {
|
|
3827
3866
|
enumerable: true,
|
|
3828
|
-
get: function () { return
|
|
3867
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveOffering; }
|
|
3829
3868
|
});
|
|
3830
3869
|
Object.defineProperty(exports, "resolveRoute", {
|
|
3831
3870
|
enumerable: true,
|
|
3832
|
-
get: function () { return
|
|
3871
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveRoute; }
|
|
3833
3872
|
});
|
|
3834
3873
|
Object.defineProperty(exports, "INLINE_SURFACES", {
|
|
3835
3874
|
enumerable: true,
|