@appfunnel-dev/sdk 2.0.0-canary.10 → 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-Y4YNJ2EX.cjs → chunk-7HDZVHIT.cjs} +43 -2
- package/dist/chunk-7HDZVHIT.cjs.map +1 -0
- package/dist/{chunk-VW2HVPR4.js → chunk-UAQV22UK.js} +43 -3
- package/dist/chunk-UAQV22UK.js.map +1 -0
- package/dist/index.cjs +349 -288
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +128 -89
- package/dist/index.js.map +1 -1
- package/dist/{manifest-B3Tdab0M.d.cts → manifest-CTt2LlUV.d.cts} +89 -2
- package/dist/{manifest-B3Tdab0M.d.ts → manifest-CTt2LlUV.d.ts} +89 -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-VW2HVPR4.js.map +0 -1
- package/dist/chunk-Y4YNJ2EX.cjs.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,16 +726,20 @@ async function captureScreenshot(params = {}) {
|
|
|
708
726
|
}
|
|
709
727
|
|
|
710
728
|
// src/flow/flow.tsx
|
|
711
|
-
var
|
|
712
|
-
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({});
|
|
713
734
|
function useExperiment(id) {
|
|
714
|
-
return
|
|
735
|
+
return React2.useContext(ExperimentContext)[id];
|
|
715
736
|
}
|
|
716
|
-
function pageContextFor(currentKey, slug, index, total, startedAt) {
|
|
737
|
+
function pageContextFor(currentKey, slug, group, index, total, startedAt) {
|
|
717
738
|
const denom = Math.max(total, index + 1);
|
|
718
739
|
return {
|
|
719
740
|
key: currentKey,
|
|
720
741
|
slug,
|
|
742
|
+
group,
|
|
721
743
|
index,
|
|
722
744
|
total: denom,
|
|
723
745
|
progressPercentage: denom > 0 ? Math.min(100, Math.round((index + 1) / denom * 100)) : 0,
|
|
@@ -726,8 +748,8 @@ function pageContextFor(currentKey, slug, index, total, startedAt) {
|
|
|
726
748
|
}
|
|
727
749
|
var now = () => typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
728
750
|
function usePageExitTimer(tracker, currentKey) {
|
|
729
|
-
const timer =
|
|
730
|
-
const emitExit =
|
|
751
|
+
const timer = React2.useRef(null);
|
|
752
|
+
const emitExit = React2.useCallback(() => {
|
|
731
753
|
const t = timer.current;
|
|
732
754
|
if (!t) return;
|
|
733
755
|
const at = now();
|
|
@@ -735,7 +757,7 @@ function usePageExitTimer(tracker, currentKey) {
|
|
|
735
757
|
const durationMs = Math.round(at - t.enteredAt);
|
|
736
758
|
tracker.track("page.exit", { pageId: t.key, durationMs, activeMs: Math.max(0, Math.round(durationMs - hidden)) });
|
|
737
759
|
}, [tracker]);
|
|
738
|
-
|
|
760
|
+
React2.useEffect(() => {
|
|
739
761
|
if (typeof document === "undefined") return;
|
|
740
762
|
const onVis = () => {
|
|
741
763
|
const t = timer.current;
|
|
@@ -749,13 +771,13 @@ function usePageExitTimer(tracker, currentKey) {
|
|
|
749
771
|
document.addEventListener("visibilitychange", onVis);
|
|
750
772
|
return () => document.removeEventListener("visibilitychange", onVis);
|
|
751
773
|
}, []);
|
|
752
|
-
|
|
774
|
+
React2.useEffect(() => {
|
|
753
775
|
if (!currentKey) return;
|
|
754
776
|
if (timer.current && timer.current.key !== currentKey) emitExit();
|
|
755
777
|
const hidden = typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
756
778
|
timer.current = { key: currentKey, enteredAt: now(), hidden: 0, hiddenSince: hidden ? now() : null };
|
|
757
779
|
}, [currentKey, emitExit]);
|
|
758
|
-
|
|
780
|
+
React2.useEffect(() => () => emitExit(), [emitExit]);
|
|
759
781
|
}
|
|
760
782
|
function FunnelView({
|
|
761
783
|
pages,
|
|
@@ -768,38 +790,38 @@ function FunnelView({
|
|
|
768
790
|
}) {
|
|
769
791
|
const funnel = useFunnel();
|
|
770
792
|
const tracker = useTrackerRef();
|
|
771
|
-
const components =
|
|
793
|
+
const components = React2.useMemo(() => {
|
|
772
794
|
const map = /* @__PURE__ */ new Map();
|
|
773
795
|
for (const p of pages) {
|
|
774
796
|
if (p.Component) map.set(p.key, p.Component);
|
|
775
797
|
else if (p.load) {
|
|
776
798
|
const load = p.load;
|
|
777
|
-
map.set(p.key,
|
|
799
|
+
map.set(p.key, React2.lazy(() => Promise.resolve(load()).then(
|
|
778
800
|
(m) => typeof m === "function" ? { default: m } : m
|
|
779
801
|
)));
|
|
780
802
|
}
|
|
781
803
|
}
|
|
782
804
|
return map;
|
|
783
805
|
}, [pages]);
|
|
784
|
-
const loaders =
|
|
806
|
+
const loaders = React2.useMemo(
|
|
785
807
|
() => new Map(pages.filter((p) => p.load).map((p) => [p.key, p.load])),
|
|
786
808
|
[pages]
|
|
787
809
|
);
|
|
788
|
-
const seedRef =
|
|
789
|
-
if (seedRef.current === null) seedRef.current =
|
|
810
|
+
const seedRef = React2.useRef(null);
|
|
811
|
+
if (seedRef.current === null) seedRef.current = chunk7HDZVHIT_cjs.bucketingSeed(funnel.context);
|
|
790
812
|
const seed = seedRef.current;
|
|
791
|
-
const experiments =
|
|
792
|
-
() =>
|
|
813
|
+
const experiments = React2.useMemo(
|
|
814
|
+
() => chunk7HDZVHIT_cjs.resolveExperiments(pages, funnel.experiments, seed),
|
|
793
815
|
[pages, funnel.experiments, seed]
|
|
794
816
|
);
|
|
795
|
-
const toSlot =
|
|
796
|
-
const toRenderKey =
|
|
797
|
-
const pageByKey =
|
|
798
|
-
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(
|
|
799
821
|
() => experiments.activeKeys.map((k) => pageByKey.get(k)).filter((p) => p !== void 0),
|
|
800
822
|
[experiments, pageByKey]
|
|
801
823
|
);
|
|
802
|
-
const flow =
|
|
824
|
+
const flow = React2.useMemo(
|
|
803
825
|
() => flowPages.map((p) => {
|
|
804
826
|
const servedVariant = experiments.render[p.key];
|
|
805
827
|
const variantNext = servedVariant ? pageByKey.get(servedVariant)?.meta?.next : void 0;
|
|
@@ -807,87 +829,106 @@ function FunnelView({
|
|
|
807
829
|
}),
|
|
808
830
|
[flowPages, experiments, pageByKey]
|
|
809
831
|
);
|
|
810
|
-
const [history, setHistory] =
|
|
832
|
+
const [history, setHistory] = React2.useState(() => {
|
|
811
833
|
const start = flowPages[0]?.key;
|
|
812
834
|
if (!initialKey || initialKey === start) return start ? [start] : [];
|
|
813
835
|
const target = toSlot(initialKey);
|
|
814
836
|
const page2 = flowPages.find((p) => p.key === target);
|
|
815
837
|
if (trustInitialKey) return page2 ? [target] : start ? [start] : [];
|
|
816
|
-
const guard =
|
|
817
|
-
const ok = page2 && (!guard ||
|
|
838
|
+
const guard = chunk7HDZVHIT_cjs.entryGuard(page2?.meta);
|
|
839
|
+
const ok = page2 && (!guard || chunk7HDZVHIT_cjs.evaluateGate(guard, funnel.snapshot()));
|
|
818
840
|
const first = ok ? target : start;
|
|
819
841
|
return first ? [first] : [];
|
|
820
842
|
});
|
|
821
843
|
const currentKey = history[history.length - 1];
|
|
822
844
|
const index = history.length - 1;
|
|
823
845
|
const startKey = history[0];
|
|
824
|
-
const total =
|
|
825
|
-
() =>
|
|
846
|
+
const total = React2.useMemo(
|
|
847
|
+
() => chunk7HDZVHIT_cjs.expectedPathLength(flow, startKey, funnel.snapshot()),
|
|
826
848
|
// currentKey in deps: re-trace as each step's answers settle the branch.
|
|
827
849
|
[flow, startKey, currentKey, funnel]
|
|
828
850
|
);
|
|
829
851
|
const slug = pageByKey.get(currentKey)?.meta?.slug ?? currentKey;
|
|
830
|
-
const
|
|
831
|
-
|
|
832
|
-
|
|
852
|
+
const group = pageByKey.get(currentKey)?.meta?.group;
|
|
853
|
+
const page = React2.useMemo(
|
|
854
|
+
() => pageContextFor(currentKey, slug, group, index, total, funnel.context.system.now),
|
|
855
|
+
[currentKey, slug, group, index, total, funnel.context.system.now]
|
|
856
|
+
);
|
|
857
|
+
const groups = React2.useMemo(
|
|
858
|
+
() => chunk7HDZVHIT_cjs.groupProgress(flow, startKey, currentKey, funnel.snapshot()),
|
|
859
|
+
// currentKey in deps: re-trace as each step's answers settle the branch.
|
|
860
|
+
[flow, startKey, currentKey, funnel]
|
|
833
861
|
);
|
|
834
|
-
|
|
862
|
+
React2.useEffect(() => {
|
|
835
863
|
funnel.context.page = page;
|
|
836
864
|
}, [funnel, page]);
|
|
837
|
-
const started =
|
|
838
|
-
|
|
865
|
+
const started = React2.useRef(false);
|
|
866
|
+
React2.useEffect(() => {
|
|
839
867
|
if (started.current) return;
|
|
840
868
|
started.current = true;
|
|
841
869
|
tracker.track("funnel.start", {});
|
|
842
870
|
}, [tracker]);
|
|
843
|
-
|
|
871
|
+
React2.useEffect(() => {
|
|
844
872
|
if (!currentKey) return;
|
|
845
873
|
tracker.track("page.view", { pageId: currentKey, pageKey: currentKey, isInitial: index === 0, eventId: newEventId() });
|
|
846
874
|
}, [tracker, currentKey, index]);
|
|
847
|
-
|
|
875
|
+
React2.useEffect(() => {
|
|
848
876
|
if (currentKey && onNavigate) onNavigate(currentKey, slug);
|
|
849
877
|
}, [onNavigate, currentKey, slug]);
|
|
850
|
-
const exposed =
|
|
851
|
-
|
|
878
|
+
const exposed = React2.useRef(/* @__PURE__ */ new Set());
|
|
879
|
+
React2.useEffect(() => {
|
|
852
880
|
const expId = experiments.experimentOf[currentKey];
|
|
853
881
|
if (!expId || exposed.current.has(expId)) return;
|
|
854
882
|
exposed.current.add(expId);
|
|
855
883
|
tracker.track("experiment.exposure", exposurePayload(expId, experiments.assignments[expId], experiments.versionOf[expId]));
|
|
856
884
|
}, [tracker, currentKey, experiments]);
|
|
857
885
|
usePageExitTimer(tracker, currentKey);
|
|
858
|
-
const [isNavigating, startNav] =
|
|
859
|
-
const next =
|
|
860
|
-
const target =
|
|
886
|
+
const [isNavigating, startNav] = React2.useTransition();
|
|
887
|
+
const next = React2.useCallback(() => {
|
|
888
|
+
const target = chunk7HDZVHIT_cjs.nextPage(flow, currentKey, funnel.snapshot());
|
|
861
889
|
const resolved = target ? toSlot(target) : target;
|
|
862
890
|
if (resolved) startNav(() => setHistory((h) => [...h, resolved]));
|
|
863
891
|
}, [flow, currentKey, funnel, toSlot]);
|
|
864
|
-
const back =
|
|
892
|
+
const back = React2.useCallback(
|
|
865
893
|
() => startNav(() => setHistory((h) => h.length > 1 ? h.slice(0, -1) : h)),
|
|
866
894
|
[]
|
|
867
895
|
);
|
|
868
|
-
const go =
|
|
896
|
+
const go = React2.useCallback(
|
|
869
897
|
(key) => startNav(() => setHistory((h) => [...h, toSlot(key)])),
|
|
870
898
|
[toSlot]
|
|
871
899
|
);
|
|
872
|
-
const
|
|
873
|
-
const
|
|
900
|
+
const [loadedComps, setLoadedComps] = React2.useState(() => /* @__PURE__ */ new Map());
|
|
901
|
+
const prefetched = React2.useRef(/* @__PURE__ */ new Set());
|
|
902
|
+
const prefetch = React2.useCallback(
|
|
874
903
|
(key) => {
|
|
875
904
|
const target = toRenderKey(key);
|
|
876
905
|
const load = loaders.get(target);
|
|
877
906
|
if (!load || prefetched.current.has(target)) return;
|
|
878
907
|
prefetched.current.add(target);
|
|
879
|
-
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));
|
|
880
912
|
},
|
|
881
913
|
[loaders, toRenderKey]
|
|
882
914
|
);
|
|
883
|
-
const nextCandidates =
|
|
884
|
-
() => [...new Set(
|
|
915
|
+
const nextCandidates = React2.useMemo(
|
|
916
|
+
() => [...new Set(chunk7HDZVHIT_cjs.outgoingKeys(flow, currentKey).map(toRenderKey))],
|
|
885
917
|
[flow, currentKey, toRenderKey]
|
|
886
918
|
);
|
|
887
|
-
|
|
919
|
+
React2.useEffect(() => {
|
|
888
920
|
if (prefetchMode !== "auto") return;
|
|
889
921
|
for (const key of nextCandidates) prefetch(key);
|
|
890
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
|
+
}, []);
|
|
891
932
|
const value = {
|
|
892
933
|
page,
|
|
893
934
|
next,
|
|
@@ -899,9 +940,9 @@ function FunnelView({
|
|
|
899
940
|
isNavigating
|
|
900
941
|
};
|
|
901
942
|
const bus = useBusInternal();
|
|
902
|
-
const navRef =
|
|
943
|
+
const navRef = React2.useRef(value);
|
|
903
944
|
navRef.current = value;
|
|
904
|
-
|
|
945
|
+
React2.useEffect(() => {
|
|
905
946
|
if (!bus) return;
|
|
906
947
|
const control = {
|
|
907
948
|
goTo: (key) => {
|
|
@@ -925,7 +966,7 @@ function FunnelView({
|
|
|
925
966
|
};
|
|
926
967
|
return bus.registerNavigation(control);
|
|
927
968
|
}, [bus]);
|
|
928
|
-
|
|
969
|
+
React2.useEffect(() => {
|
|
929
970
|
const v = navRef.current;
|
|
930
971
|
bus?.emit("navigation", {
|
|
931
972
|
key: v.page.key,
|
|
@@ -938,16 +979,26 @@ function FunnelView({
|
|
|
938
979
|
}, [bus, currentKey]);
|
|
939
980
|
const renderKey = toRenderKey(currentKey);
|
|
940
981
|
const Current = components.get(renderKey);
|
|
941
|
-
const pageEl =
|
|
942
|
-
const
|
|
943
|
-
|
|
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(
|
|
944
991
|
ExperimentContext.Provider,
|
|
945
992
|
{ value: experiments.assignments },
|
|
946
|
-
|
|
993
|
+
React2.createElement(
|
|
994
|
+
NavContext.Provider,
|
|
995
|
+
{ value },
|
|
996
|
+
React2.createElement(GroupProgressContext.Provider, { value: groups }, content)
|
|
997
|
+
)
|
|
947
998
|
);
|
|
948
999
|
}
|
|
949
1000
|
function useNavigation() {
|
|
950
|
-
const ctx =
|
|
1001
|
+
const ctx = React2.useContext(NavContext);
|
|
951
1002
|
if (!ctx) throw new Error("useNavigation must be used inside <FunnelView>");
|
|
952
1003
|
return ctx;
|
|
953
1004
|
}
|
|
@@ -957,7 +1008,7 @@ var EMBED_CAPABILITIES = {
|
|
|
957
1008
|
};
|
|
958
1009
|
function EmbedBridge() {
|
|
959
1010
|
const bus = useBusInternal();
|
|
960
|
-
|
|
1011
|
+
React2.useEffect(() => {
|
|
961
1012
|
if (!bus || typeof window === "undefined" || window.parent === window) return;
|
|
962
1013
|
const parent = window.parent;
|
|
963
1014
|
let disposed = false;
|
|
@@ -1029,11 +1080,16 @@ function EmbedBridge() {
|
|
|
1029
1080
|
function usePage() {
|
|
1030
1081
|
return useNavigation().page;
|
|
1031
1082
|
}
|
|
1083
|
+
function useGroupProgress() {
|
|
1084
|
+
const ctx = React2.useContext(GroupProgressContext);
|
|
1085
|
+
if (!ctx) throw new Error("useGroupProgress must be used inside <FunnelView>");
|
|
1086
|
+
return ctx;
|
|
1087
|
+
}
|
|
1032
1088
|
var symModalId = /* @__PURE__ */ Symbol("AppfunnelModalId");
|
|
1033
1089
|
var initialState = {};
|
|
1034
|
-
var ModalStateContext =
|
|
1035
|
-
var ModalIdContext =
|
|
1036
|
-
var ModalDispatchContext =
|
|
1090
|
+
var ModalStateContext = React2.createContext(initialState);
|
|
1091
|
+
var ModalIdContext = React2.createContext(null);
|
|
1092
|
+
var ModalDispatchContext = React2.createContext(null);
|
|
1037
1093
|
var REGISTRY = {};
|
|
1038
1094
|
var ALREADY_MOUNTED = {};
|
|
1039
1095
|
var modalCallbacks = {};
|
|
@@ -1140,48 +1196,48 @@ function setFlags(d, id, flags) {
|
|
|
1140
1196
|
d({ type: "set-flags", payload: { modalId: id, flags } });
|
|
1141
1197
|
}
|
|
1142
1198
|
function useModal(modal, args) {
|
|
1143
|
-
const modals =
|
|
1144
|
-
const contextId =
|
|
1145
|
-
const d =
|
|
1199
|
+
const modals = React2.useContext(ModalStateContext);
|
|
1200
|
+
const contextId = React2.useContext(ModalIdContext);
|
|
1201
|
+
const d = React2.useContext(ModalDispatchContext) ?? dispatch;
|
|
1146
1202
|
const isComponent = !!modal && typeof modal !== "string";
|
|
1147
1203
|
const id = modal ? idOf(modal) : contextId;
|
|
1148
1204
|
if (!id)
|
|
1149
1205
|
throw new Error(
|
|
1150
1206
|
"useModal: no modal id (call inside a defineModal component, or pass an id/component)."
|
|
1151
1207
|
);
|
|
1152
|
-
|
|
1208
|
+
React2.useEffect(() => {
|
|
1153
1209
|
if (isComponent && !REGISTRY[id])
|
|
1154
1210
|
registerModal(id, modal, args);
|
|
1155
1211
|
}, [isComponent, id, modal, args]);
|
|
1156
1212
|
const info = modals[id];
|
|
1157
|
-
const show =
|
|
1213
|
+
const show = React2.useCallback(
|
|
1158
1214
|
(a) => showModalVia(d, id, a),
|
|
1159
1215
|
[d, id]
|
|
1160
1216
|
);
|
|
1161
|
-
const hide =
|
|
1162
|
-
const remove =
|
|
1163
|
-
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(
|
|
1164
1220
|
(v) => {
|
|
1165
1221
|
modalCallbacks[id]?.resolve(v);
|
|
1166
1222
|
delete modalCallbacks[id];
|
|
1167
1223
|
},
|
|
1168
1224
|
[id]
|
|
1169
1225
|
);
|
|
1170
|
-
const reject =
|
|
1226
|
+
const reject = React2.useCallback(
|
|
1171
1227
|
(v) => {
|
|
1172
1228
|
modalCallbacks[id]?.reject(v);
|
|
1173
1229
|
delete modalCallbacks[id];
|
|
1174
1230
|
},
|
|
1175
1231
|
[id]
|
|
1176
1232
|
);
|
|
1177
|
-
const resolveHide =
|
|
1233
|
+
const resolveHide = React2.useCallback(
|
|
1178
1234
|
(v) => {
|
|
1179
1235
|
hideCallbacks[id]?.resolve(v);
|
|
1180
1236
|
delete hideCallbacks[id];
|
|
1181
1237
|
},
|
|
1182
1238
|
[id]
|
|
1183
1239
|
);
|
|
1184
|
-
return
|
|
1240
|
+
return React2.useMemo(
|
|
1185
1241
|
() => ({
|
|
1186
1242
|
id,
|
|
1187
1243
|
args: info?.args,
|
|
@@ -1216,45 +1272,45 @@ function defineModal(Comp) {
|
|
|
1216
1272
|
...props
|
|
1217
1273
|
}) {
|
|
1218
1274
|
const { args, show } = useModal(id);
|
|
1219
|
-
const modals =
|
|
1220
|
-
const d =
|
|
1275
|
+
const modals = React2.useContext(ModalStateContext);
|
|
1276
|
+
const d = React2.useContext(ModalDispatchContext) ?? dispatch;
|
|
1221
1277
|
const shouldMount = !!modals[id];
|
|
1222
|
-
|
|
1278
|
+
React2.useEffect(() => {
|
|
1223
1279
|
if (defaultVisible) show();
|
|
1224
1280
|
ALREADY_MOUNTED[id] = true;
|
|
1225
1281
|
return () => {
|
|
1226
1282
|
delete ALREADY_MOUNTED[id];
|
|
1227
1283
|
};
|
|
1228
1284
|
}, [id, show, defaultVisible]);
|
|
1229
|
-
|
|
1285
|
+
React2.useEffect(() => {
|
|
1230
1286
|
if (keepMounted) setFlags(d, id, { keepMounted: true });
|
|
1231
1287
|
}, [d, id, keepMounted]);
|
|
1232
1288
|
const delayVisible = modals[id]?.delayVisible;
|
|
1233
|
-
|
|
1289
|
+
React2.useEffect(() => {
|
|
1234
1290
|
if (delayVisible) show(args);
|
|
1235
1291
|
}, [delayVisible, args, show]);
|
|
1236
1292
|
if (!shouldMount) return null;
|
|
1237
|
-
return
|
|
1293
|
+
return React2.createElement(
|
|
1238
1294
|
ModalIdContext.Provider,
|
|
1239
1295
|
{ value: id },
|
|
1240
|
-
|
|
1296
|
+
React2.createElement(Comp, { ...props, ...args })
|
|
1241
1297
|
);
|
|
1242
1298
|
};
|
|
1243
1299
|
}
|
|
1244
1300
|
function ModalRoot() {
|
|
1245
|
-
const modals =
|
|
1301
|
+
const modals = React2.useContext(ModalStateContext);
|
|
1246
1302
|
const toRender = Object.keys(modals).filter((id) => REGISTRY[id]).map((id) => ({ id, ...REGISTRY[id] }));
|
|
1247
|
-
return
|
|
1303
|
+
return React2.createElement(
|
|
1248
1304
|
"div",
|
|
1249
1305
|
{ "data-appfunnel-modal-root": "" },
|
|
1250
1306
|
...toRender.map(
|
|
1251
|
-
(t) =>
|
|
1307
|
+
(t) => React2.createElement(t.comp, { key: t.id, id: t.id, ...t.props })
|
|
1252
1308
|
)
|
|
1253
1309
|
);
|
|
1254
1310
|
}
|
|
1255
1311
|
function ModalRuntime({ children }) {
|
|
1256
|
-
const [state, localDispatch] =
|
|
1257
|
-
|
|
1312
|
+
const [state, localDispatch] = React2.useReducer(modalReducer, initialState);
|
|
1313
|
+
React2.useEffect(() => {
|
|
1258
1314
|
runtimeStack.push(localDispatch);
|
|
1259
1315
|
if (runtimeStack.length > 1) {
|
|
1260
1316
|
try {
|
|
@@ -1269,14 +1325,14 @@ function ModalRuntime({ children }) {
|
|
|
1269
1325
|
if (i !== -1) runtimeStack.splice(i, 1);
|
|
1270
1326
|
};
|
|
1271
1327
|
}, []);
|
|
1272
|
-
return
|
|
1328
|
+
return React2.createElement(
|
|
1273
1329
|
ModalDispatchContext.Provider,
|
|
1274
1330
|
{ value: localDispatch },
|
|
1275
|
-
|
|
1331
|
+
React2.createElement(
|
|
1276
1332
|
ModalStateContext.Provider,
|
|
1277
1333
|
{ value: state },
|
|
1278
1334
|
children,
|
|
1279
|
-
|
|
1335
|
+
React2.createElement(ModalRoot, null)
|
|
1280
1336
|
)
|
|
1281
1337
|
);
|
|
1282
1338
|
}
|
|
@@ -1304,7 +1360,7 @@ function OverlayShell({
|
|
|
1304
1360
|
panel,
|
|
1305
1361
|
children
|
|
1306
1362
|
}) {
|
|
1307
|
-
|
|
1363
|
+
React2.useEffect(() => {
|
|
1308
1364
|
if (!open || typeof document === "undefined") return;
|
|
1309
1365
|
const onKey = (e) => {
|
|
1310
1366
|
if (e.key === "Escape") onClose();
|
|
@@ -1318,7 +1374,7 @@ function OverlayShell({
|
|
|
1318
1374
|
};
|
|
1319
1375
|
}, [open, onClose]);
|
|
1320
1376
|
if (!open || typeof document === "undefined") return null;
|
|
1321
|
-
const overlay =
|
|
1377
|
+
const overlay = React2.createElement(
|
|
1322
1378
|
"div",
|
|
1323
1379
|
{
|
|
1324
1380
|
role: "dialog",
|
|
@@ -1327,13 +1383,13 @@ function OverlayShell({
|
|
|
1327
1383
|
"data-appfunnel-overlay": "",
|
|
1328
1384
|
style: { position: "fixed", inset: 0, zIndex: 1e3, display: "flex", ...container }
|
|
1329
1385
|
},
|
|
1330
|
-
|
|
1386
|
+
React2.createElement("div", {
|
|
1331
1387
|
"data-appfunnel-overlay-backdrop": "",
|
|
1332
1388
|
className: backdropClassName,
|
|
1333
1389
|
onClick: dismissOnBackdrop ? onClose : void 0,
|
|
1334
1390
|
style: { position: "absolute", inset: 0, background: "rgba(0,0,0,0.5)" }
|
|
1335
1391
|
}),
|
|
1336
|
-
|
|
1392
|
+
React2.createElement(
|
|
1337
1393
|
"div",
|
|
1338
1394
|
{ "data-appfunnel-overlay-panel": "", className, style: { position: "relative", background: "#fff", ...panel } },
|
|
1339
1395
|
children
|
|
@@ -1350,7 +1406,7 @@ var SHEET_LAYOUT = {
|
|
|
1350
1406
|
function Sheet(props) {
|
|
1351
1407
|
const control = useModalControl();
|
|
1352
1408
|
const layout = SHEET_LAYOUT[props.side ?? "bottom"];
|
|
1353
|
-
return
|
|
1409
|
+
return React2.createElement(OverlayShell, {
|
|
1354
1410
|
...control,
|
|
1355
1411
|
className: props.className,
|
|
1356
1412
|
backdropClassName: props.backdropClassName,
|
|
@@ -1363,7 +1419,7 @@ function Sheet(props) {
|
|
|
1363
1419
|
}
|
|
1364
1420
|
function Modal(props) {
|
|
1365
1421
|
const control = useModalControl();
|
|
1366
|
-
return
|
|
1422
|
+
return React2.createElement(OverlayShell, {
|
|
1367
1423
|
...control,
|
|
1368
1424
|
className: props.className,
|
|
1369
1425
|
backdropClassName: props.backdropClassName,
|
|
@@ -1393,7 +1449,7 @@ function createMockDriver(provider = "stripe", options = {}) {
|
|
|
1393
1449
|
return Promise.resolve({ ok: false, error: offError });
|
|
1394
1450
|
return Promise.resolve(success);
|
|
1395
1451
|
},
|
|
1396
|
-
renderInline: (req, cb) =>
|
|
1452
|
+
renderInline: (req, cb) => React2.createElement(
|
|
1397
1453
|
"button",
|
|
1398
1454
|
{
|
|
1399
1455
|
type: "button",
|
|
@@ -1431,15 +1487,15 @@ function driverWithCatalog(driver, catalog) {
|
|
|
1431
1487
|
renderInline: driver.renderInline ? (req, cb) => driver.renderInline(enrich(req), cb) : void 0
|
|
1432
1488
|
};
|
|
1433
1489
|
}
|
|
1434
|
-
var DriverContext =
|
|
1490
|
+
var DriverContext = React2.createContext(null);
|
|
1435
1491
|
function CheckoutDriverProvider({
|
|
1436
1492
|
driver,
|
|
1437
1493
|
children
|
|
1438
1494
|
}) {
|
|
1439
|
-
return
|
|
1495
|
+
return React2.createElement(DriverContext.Provider, { value: driver }, children);
|
|
1440
1496
|
}
|
|
1441
1497
|
function useDriver() {
|
|
1442
|
-
return
|
|
1498
|
+
return React2.useContext(DriverContext) ?? FALLBACK_DRIVER;
|
|
1443
1499
|
}
|
|
1444
1500
|
var FALLBACK_DRIVER = createMockDriver();
|
|
1445
1501
|
function useCheckout(opts = {}) {
|
|
@@ -1447,12 +1503,12 @@ function useCheckout(opts = {}) {
|
|
|
1447
1503
|
const tracker = useTrackerRef();
|
|
1448
1504
|
const catalog = useCatalog();
|
|
1449
1505
|
const nav = useNavigation();
|
|
1450
|
-
const [status, setStatus] =
|
|
1451
|
-
const [error, setError] =
|
|
1506
|
+
const [status, setStatus] = React2.useState("idle");
|
|
1507
|
+
const [error, setError] = React2.useState(null);
|
|
1452
1508
|
const intent = opts.intent ?? "purchase";
|
|
1453
1509
|
const kind = opts.kind;
|
|
1454
1510
|
const advance = opts.advanceOnSuccess ?? true;
|
|
1455
|
-
const productFacts =
|
|
1511
|
+
const productFacts = React2.useCallback(
|
|
1456
1512
|
(product) => {
|
|
1457
1513
|
const resolved = product ? catalog.get(product) : void 0;
|
|
1458
1514
|
return {
|
|
@@ -1464,13 +1520,13 @@ function useCheckout(opts = {}) {
|
|
|
1464
1520
|
},
|
|
1465
1521
|
[catalog, kind]
|
|
1466
1522
|
);
|
|
1467
|
-
const recovering =
|
|
1468
|
-
const failRef =
|
|
1523
|
+
const recovering = React2.useRef(false);
|
|
1524
|
+
const failRef = React2.useRef(
|
|
1469
1525
|
() => {
|
|
1470
1526
|
}
|
|
1471
1527
|
);
|
|
1472
|
-
const attemptRef =
|
|
1473
|
-
const succeed =
|
|
1528
|
+
const attemptRef = React2.useRef(async () => ({ ok: false }));
|
|
1529
|
+
const succeed = React2.useCallback(
|
|
1474
1530
|
(result, product) => {
|
|
1475
1531
|
setStatus("success");
|
|
1476
1532
|
const { productId, isSubscription } = productFacts(product);
|
|
@@ -1495,9 +1551,9 @@ function useCheckout(opts = {}) {
|
|
|
1495
1551
|
},
|
|
1496
1552
|
[tracker, nav, advance, opts, productFacts]
|
|
1497
1553
|
);
|
|
1498
|
-
const succeedRef =
|
|
1554
|
+
const succeedRef = React2.useRef(succeed);
|
|
1499
1555
|
succeedRef.current = succeed;
|
|
1500
|
-
const begin =
|
|
1556
|
+
const begin = React2.useCallback(
|
|
1501
1557
|
(product, surface) => {
|
|
1502
1558
|
setStatus("loading");
|
|
1503
1559
|
setError(null);
|
|
@@ -1512,7 +1568,7 @@ function useCheckout(opts = {}) {
|
|
|
1512
1568
|
},
|
|
1513
1569
|
[tracker, productFacts]
|
|
1514
1570
|
);
|
|
1515
|
-
const paymentAdded =
|
|
1571
|
+
const paymentAdded = React2.useCallback(
|
|
1516
1572
|
(product) => {
|
|
1517
1573
|
const { productId, amount, currency } = productFacts(product);
|
|
1518
1574
|
tracker.track("checkout.payment_added", {
|
|
@@ -1622,14 +1678,14 @@ function useCheckout(opts = {}) {
|
|
|
1622
1678
|
return { ok: false, error: err };
|
|
1623
1679
|
}
|
|
1624
1680
|
};
|
|
1625
|
-
const open =
|
|
1681
|
+
const open = React2.useCallback(
|
|
1626
1682
|
async (product, surface) => {
|
|
1627
1683
|
recovering.current = false;
|
|
1628
1684
|
return attemptRef.current(product, surface);
|
|
1629
1685
|
},
|
|
1630
1686
|
[]
|
|
1631
1687
|
);
|
|
1632
|
-
const callbacksFor =
|
|
1688
|
+
const callbacksFor = React2.useCallback(
|
|
1633
1689
|
(product, surface) => ({
|
|
1634
1690
|
onStart: () => {
|
|
1635
1691
|
recovering.current = false;
|
|
@@ -1641,7 +1697,7 @@ function useCheckout(opts = {}) {
|
|
|
1641
1697
|
}),
|
|
1642
1698
|
[begin, paymentAdded]
|
|
1643
1699
|
);
|
|
1644
|
-
const reset =
|
|
1700
|
+
const reset = React2.useCallback(() => {
|
|
1645
1701
|
recovering.current = false;
|
|
1646
1702
|
setStatus("idle");
|
|
1647
1703
|
setError(null);
|
|
@@ -1658,11 +1714,11 @@ function useCheckout(opts = {}) {
|
|
|
1658
1714
|
var CheckoutSheet = defineModal(({ product, surface, intent, kind, onSuccess, onError, onPaymentAdded }) => {
|
|
1659
1715
|
const driver = useDriver();
|
|
1660
1716
|
const modal = useModal();
|
|
1661
|
-
const resolved =
|
|
1662
|
-
const onErrorRef =
|
|
1717
|
+
const resolved = React2.useRef(false);
|
|
1718
|
+
const onErrorRef = React2.useRef(onError);
|
|
1663
1719
|
onErrorRef.current = onError;
|
|
1664
1720
|
const hostable = !!driver.renderInline;
|
|
1665
|
-
|
|
1721
|
+
React2.useEffect(() => {
|
|
1666
1722
|
if (!hostable) {
|
|
1667
1723
|
resolved.current = true;
|
|
1668
1724
|
onErrorRef.current(
|
|
@@ -1692,7 +1748,7 @@ var CheckoutSheet = defineModal(({ product, surface, intent, kind, onSuccess, on
|
|
|
1692
1748
|
void modal.hide();
|
|
1693
1749
|
modal.remove();
|
|
1694
1750
|
};
|
|
1695
|
-
return
|
|
1751
|
+
return React2.createElement(Sheet, {
|
|
1696
1752
|
children: driver.renderInline(
|
|
1697
1753
|
{ product, intent, surface, kind },
|
|
1698
1754
|
{
|
|
@@ -1715,11 +1771,11 @@ function trigger(onClick, {
|
|
|
1715
1771
|
className,
|
|
1716
1772
|
disabled
|
|
1717
1773
|
}) {
|
|
1718
|
-
if (asChild &&
|
|
1774
|
+
if (asChild && React2.isValidElement(children)) {
|
|
1719
1775
|
const child = children;
|
|
1720
|
-
return
|
|
1776
|
+
return React2.cloneElement(child, { onClick });
|
|
1721
1777
|
}
|
|
1722
|
-
return
|
|
1778
|
+
return React2.createElement(
|
|
1723
1779
|
"button",
|
|
1724
1780
|
{ type: "button", className, disabled, onClick },
|
|
1725
1781
|
children ?? "Continue"
|
|
@@ -1747,13 +1803,13 @@ function Checkout({
|
|
|
1747
1803
|
}) {
|
|
1748
1804
|
const product = offering;
|
|
1749
1805
|
const driver = useDriver();
|
|
1750
|
-
const [surface] =
|
|
1806
|
+
const [surface] = React2.useState(
|
|
1751
1807
|
() => chunk7JLOF6CJ_cjs.resolveSurface(driver.provider, surfacePreference, detectDeviceClass())
|
|
1752
1808
|
);
|
|
1753
1809
|
const checkout = useCheckout(options);
|
|
1754
1810
|
const intent = options.intent ?? "purchase";
|
|
1755
1811
|
if (chunk7JLOF6CJ_cjs.isInlineSurface(surface)) {
|
|
1756
|
-
return driver.renderInline ?
|
|
1812
|
+
return driver.renderInline ? React2.createElement(
|
|
1757
1813
|
"div",
|
|
1758
1814
|
{ key: product, className },
|
|
1759
1815
|
driver.renderInline(
|
|
@@ -1818,9 +1874,9 @@ var consumedResumes = /* @__PURE__ */ new Set();
|
|
|
1818
1874
|
function CheckoutResume(options = {}) {
|
|
1819
1875
|
const driver = useDriver();
|
|
1820
1876
|
const checkout = useCheckout(options);
|
|
1821
|
-
const callbacksRef =
|
|
1877
|
+
const callbacksRef = React2.useRef(checkout.callbacksFor);
|
|
1822
1878
|
callbacksRef.current = checkout.callbacksFor;
|
|
1823
|
-
|
|
1879
|
+
React2.useEffect(() => {
|
|
1824
1880
|
if (typeof window === "undefined" || !driver.resume) return;
|
|
1825
1881
|
const url = new URL(window.location.href);
|
|
1826
1882
|
const correlationId = url.searchParams.get("af_checkout");
|
|
@@ -1872,64 +1928,64 @@ var getAsset = (type) => {
|
|
|
1872
1928
|
};
|
|
1873
1929
|
var bars = Array(12).fill(0);
|
|
1874
1930
|
var Loader = ({ visible, className }) => {
|
|
1875
|
-
return /* @__PURE__ */
|
|
1931
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
1876
1932
|
className: [
|
|
1877
1933
|
"sonner-loading-wrapper",
|
|
1878
1934
|
className
|
|
1879
1935
|
].filter(Boolean).join(" "),
|
|
1880
1936
|
"data-visible": visible
|
|
1881
|
-
}, /* @__PURE__ */
|
|
1937
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
1882
1938
|
className: "sonner-spinner"
|
|
1883
|
-
}, bars.map((_, i) => /* @__PURE__ */
|
|
1939
|
+
}, bars.map((_, i) => /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
1884
1940
|
className: "sonner-loading-bar",
|
|
1885
1941
|
key: `spinner-bar-${i}`
|
|
1886
1942
|
}))));
|
|
1887
1943
|
};
|
|
1888
|
-
var SuccessIcon = /* @__PURE__ */
|
|
1944
|
+
var SuccessIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1889
1945
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1890
1946
|
viewBox: "0 0 20 20",
|
|
1891
1947
|
fill: "currentColor",
|
|
1892
1948
|
height: "20",
|
|
1893
1949
|
width: "20"
|
|
1894
|
-
}, /* @__PURE__ */
|
|
1950
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1895
1951
|
fillRule: "evenodd",
|
|
1896
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",
|
|
1897
1953
|
clipRule: "evenodd"
|
|
1898
1954
|
}));
|
|
1899
|
-
var WarningIcon = /* @__PURE__ */
|
|
1955
|
+
var WarningIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1900
1956
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1901
1957
|
viewBox: "0 0 24 24",
|
|
1902
1958
|
fill: "currentColor",
|
|
1903
1959
|
height: "20",
|
|
1904
1960
|
width: "20"
|
|
1905
|
-
}, /* @__PURE__ */
|
|
1961
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1906
1962
|
fillRule: "evenodd",
|
|
1907
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",
|
|
1908
1964
|
clipRule: "evenodd"
|
|
1909
1965
|
}));
|
|
1910
|
-
var InfoIcon = /* @__PURE__ */
|
|
1966
|
+
var InfoIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1911
1967
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1912
1968
|
viewBox: "0 0 20 20",
|
|
1913
1969
|
fill: "currentColor",
|
|
1914
1970
|
height: "20",
|
|
1915
1971
|
width: "20"
|
|
1916
|
-
}, /* @__PURE__ */
|
|
1972
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1917
1973
|
fillRule: "evenodd",
|
|
1918
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",
|
|
1919
1975
|
clipRule: "evenodd"
|
|
1920
1976
|
}));
|
|
1921
|
-
var ErrorIcon = /* @__PURE__ */
|
|
1977
|
+
var ErrorIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1922
1978
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1923
1979
|
viewBox: "0 0 20 20",
|
|
1924
1980
|
fill: "currentColor",
|
|
1925
1981
|
height: "20",
|
|
1926
1982
|
width: "20"
|
|
1927
|
-
}, /* @__PURE__ */
|
|
1983
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("path", {
|
|
1928
1984
|
fillRule: "evenodd",
|
|
1929
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",
|
|
1930
1986
|
clipRule: "evenodd"
|
|
1931
1987
|
}));
|
|
1932
|
-
var CloseIcon = /* @__PURE__ */
|
|
1988
|
+
var CloseIcon = /* @__PURE__ */ React2__namespace.default.createElement("svg", {
|
|
1933
1989
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1934
1990
|
width: "12",
|
|
1935
1991
|
height: "12",
|
|
@@ -1939,20 +1995,20 @@ var CloseIcon = /* @__PURE__ */ React__default.default.createElement("svg", {
|
|
|
1939
1995
|
strokeWidth: "1.5",
|
|
1940
1996
|
strokeLinecap: "round",
|
|
1941
1997
|
strokeLinejoin: "round"
|
|
1942
|
-
}, /* @__PURE__ */
|
|
1998
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("line", {
|
|
1943
1999
|
x1: "18",
|
|
1944
2000
|
y1: "6",
|
|
1945
2001
|
x2: "6",
|
|
1946
2002
|
y2: "18"
|
|
1947
|
-
}), /* @__PURE__ */
|
|
2003
|
+
}), /* @__PURE__ */ React2__namespace.default.createElement("line", {
|
|
1948
2004
|
x1: "6",
|
|
1949
2005
|
y1: "6",
|
|
1950
2006
|
x2: "18",
|
|
1951
2007
|
y2: "18"
|
|
1952
2008
|
}));
|
|
1953
2009
|
var useIsDocumentHidden = () => {
|
|
1954
|
-
const [isDocumentHidden, setIsDocumentHidden] =
|
|
1955
|
-
|
|
2010
|
+
const [isDocumentHidden, setIsDocumentHidden] = React2__namespace.default.useState(document.hidden);
|
|
2011
|
+
React2__namespace.default.useEffect(() => {
|
|
1956
2012
|
const callback = () => {
|
|
1957
2013
|
setIsDocumentHidden(document.hidden);
|
|
1958
2014
|
};
|
|
@@ -2101,7 +2157,7 @@ var Observer = class {
|
|
|
2101
2157
|
"resolve",
|
|
2102
2158
|
response
|
|
2103
2159
|
];
|
|
2104
|
-
const isReactElementResponse =
|
|
2160
|
+
const isReactElementResponse = React2__namespace.default.isValidElement(response);
|
|
2105
2161
|
if (isReactElementResponse) {
|
|
2106
2162
|
shouldDismiss = false;
|
|
2107
2163
|
this.create({
|
|
@@ -2113,7 +2169,7 @@ var Observer = class {
|
|
|
2113
2169
|
shouldDismiss = false;
|
|
2114
2170
|
const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
2115
2171
|
const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
2116
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2172
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2117
2173
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2118
2174
|
message: promiseData
|
|
2119
2175
|
};
|
|
@@ -2127,7 +2183,7 @@ var Observer = class {
|
|
|
2127
2183
|
shouldDismiss = false;
|
|
2128
2184
|
const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
|
|
2129
2185
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2130
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2186
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2131
2187
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2132
2188
|
message: promiseData
|
|
2133
2189
|
};
|
|
@@ -2141,7 +2197,7 @@ var Observer = class {
|
|
|
2141
2197
|
shouldDismiss = false;
|
|
2142
2198
|
const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
|
|
2143
2199
|
const description = typeof data.description === "function" ? await data.description(response) : data.description;
|
|
2144
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2200
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2145
2201
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2146
2202
|
message: promiseData
|
|
2147
2203
|
};
|
|
@@ -2161,7 +2217,7 @@ var Observer = class {
|
|
|
2161
2217
|
shouldDismiss = false;
|
|
2162
2218
|
const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
|
|
2163
2219
|
const description = typeof data.description === "function" ? await data.description(error) : data.description;
|
|
2164
|
-
const isExtendedResult = typeof promiseData === "object" && !
|
|
2220
|
+
const isExtendedResult = typeof promiseData === "object" && !React2__namespace.default.isValidElement(promiseData);
|
|
2165
2221
|
const toastSettings = isExtendedResult ? promiseData : {
|
|
2166
2222
|
message: promiseData
|
|
2167
2223
|
};
|
|
@@ -2266,45 +2322,45 @@ function getDefaultSwipeDirections(position) {
|
|
|
2266
2322
|
var Toast = (props) => {
|
|
2267
2323
|
var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
|
|
2268
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;
|
|
2269
|
-
const [swipeDirection, setSwipeDirection] =
|
|
2270
|
-
const [swipeOutDirection, setSwipeOutDirection] =
|
|
2271
|
-
const [mounted, setMounted] =
|
|
2272
|
-
const [removed, setRemoved] =
|
|
2273
|
-
const [swiping, setSwiping] =
|
|
2274
|
-
const [swipeOut, setSwipeOut] =
|
|
2275
|
-
const [isSwiped, setIsSwiped] =
|
|
2276
|
-
const [offsetBeforeRemove, setOffsetBeforeRemove] =
|
|
2277
|
-
const [initialHeight, setInitialHeight] =
|
|
2278
|
-
const remainingTime =
|
|
2279
|
-
const dragStartTime =
|
|
2280
|
-
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);
|
|
2281
2337
|
const isFront = index === 0;
|
|
2282
2338
|
const isVisible = index + 1 <= visibleToasts;
|
|
2283
2339
|
const toastType = toast2.type;
|
|
2284
2340
|
const dismissible = toast2.dismissible !== false;
|
|
2285
2341
|
const toastClassname = toast2.className || "";
|
|
2286
2342
|
const toastDescriptionClassname = toast2.descriptionClassName || "";
|
|
2287
|
-
const heightIndex =
|
|
2343
|
+
const heightIndex = React2__namespace.default.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
|
|
2288
2344
|
heights,
|
|
2289
2345
|
toast2.id
|
|
2290
2346
|
]);
|
|
2291
|
-
const closeButton =
|
|
2347
|
+
const closeButton = React2__namespace.default.useMemo(() => {
|
|
2292
2348
|
var _toast_closeButton;
|
|
2293
2349
|
return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
|
|
2294
2350
|
}, [
|
|
2295
2351
|
toast2.closeButton,
|
|
2296
2352
|
closeButtonFromToaster
|
|
2297
2353
|
]);
|
|
2298
|
-
const duration =
|
|
2354
|
+
const duration = React2__namespace.default.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
|
|
2299
2355
|
toast2.duration,
|
|
2300
2356
|
durationFromToaster
|
|
2301
2357
|
]);
|
|
2302
|
-
const closeTimerStartTimeRef =
|
|
2303
|
-
const offset =
|
|
2304
|
-
const lastCloseTimerStartTimeRef =
|
|
2305
|
-
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);
|
|
2306
2362
|
const [y, x] = position.split("-");
|
|
2307
|
-
const toastsHeightBefore =
|
|
2363
|
+
const toastsHeightBefore = React2__namespace.default.useMemo(() => {
|
|
2308
2364
|
return heights.reduce((prev, curr, reducerIndex) => {
|
|
2309
2365
|
if (reducerIndex >= heightIndex) {
|
|
2310
2366
|
return prev;
|
|
@@ -2318,19 +2374,19 @@ var Toast = (props) => {
|
|
|
2318
2374
|
const isDocumentHidden = useIsDocumentHidden();
|
|
2319
2375
|
const invert = toast2.invert || ToasterInvert;
|
|
2320
2376
|
const disabled = toastType === "loading";
|
|
2321
|
-
offset.current =
|
|
2377
|
+
offset.current = React2__namespace.default.useMemo(() => heightIndex * gap + toastsHeightBefore, [
|
|
2322
2378
|
heightIndex,
|
|
2323
2379
|
toastsHeightBefore
|
|
2324
2380
|
]);
|
|
2325
|
-
|
|
2381
|
+
React2__namespace.default.useEffect(() => {
|
|
2326
2382
|
remainingTime.current = duration;
|
|
2327
2383
|
}, [
|
|
2328
2384
|
duration
|
|
2329
2385
|
]);
|
|
2330
|
-
|
|
2386
|
+
React2__namespace.default.useEffect(() => {
|
|
2331
2387
|
setMounted(true);
|
|
2332
2388
|
}, []);
|
|
2333
|
-
|
|
2389
|
+
React2__namespace.default.useEffect(() => {
|
|
2334
2390
|
const toastNode = toastRef.current;
|
|
2335
2391
|
if (toastNode) {
|
|
2336
2392
|
const height = toastNode.getBoundingClientRect().height;
|
|
@@ -2349,7 +2405,7 @@ var Toast = (props) => {
|
|
|
2349
2405
|
setHeights,
|
|
2350
2406
|
toast2.id
|
|
2351
2407
|
]);
|
|
2352
|
-
|
|
2408
|
+
React2__namespace.default.useLayoutEffect(() => {
|
|
2353
2409
|
if (!mounted) return;
|
|
2354
2410
|
const toastNode = toastRef.current;
|
|
2355
2411
|
const originalHeight = toastNode.style.height;
|
|
@@ -2385,7 +2441,7 @@ var Toast = (props) => {
|
|
|
2385
2441
|
toast2.action,
|
|
2386
2442
|
toast2.cancel
|
|
2387
2443
|
]);
|
|
2388
|
-
const deleteToast =
|
|
2444
|
+
const deleteToast = React2__namespace.default.useCallback(() => {
|
|
2389
2445
|
setRemoved(true);
|
|
2390
2446
|
setOffsetBeforeRemove(offset.current);
|
|
2391
2447
|
setHeights((h) => h.filter((height) => height.toastId !== toast2.id));
|
|
@@ -2398,7 +2454,7 @@ var Toast = (props) => {
|
|
|
2398
2454
|
setHeights,
|
|
2399
2455
|
offset
|
|
2400
2456
|
]);
|
|
2401
|
-
|
|
2457
|
+
React2__namespace.default.useEffect(() => {
|
|
2402
2458
|
if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
|
|
2403
2459
|
let timeoutId;
|
|
2404
2460
|
const pauseTimer = () => {
|
|
@@ -2430,7 +2486,7 @@ var Toast = (props) => {
|
|
|
2430
2486
|
isDocumentHidden,
|
|
2431
2487
|
deleteToast
|
|
2432
2488
|
]);
|
|
2433
|
-
|
|
2489
|
+
React2__namespace.default.useEffect(() => {
|
|
2434
2490
|
if (toast2.delete) {
|
|
2435
2491
|
deleteToast();
|
|
2436
2492
|
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
@@ -2443,19 +2499,19 @@ var Toast = (props) => {
|
|
|
2443
2499
|
var _toast_classNames9;
|
|
2444
2500
|
if (icons == null ? void 0 : icons.loading) {
|
|
2445
2501
|
var _toast_classNames12;
|
|
2446
|
-
return /* @__PURE__ */
|
|
2502
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
2447
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"),
|
|
2448
2504
|
"data-visible": toastType === "loading"
|
|
2449
2505
|
}, icons.loading);
|
|
2450
2506
|
}
|
|
2451
|
-
return /* @__PURE__ */
|
|
2507
|
+
return /* @__PURE__ */ React2__namespace.default.createElement(Loader, {
|
|
2452
2508
|
className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
|
|
2453
2509
|
visible: toastType === "loading"
|
|
2454
2510
|
});
|
|
2455
2511
|
}
|
|
2456
2512
|
const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
|
|
2457
2513
|
var _toast_richColors, _icons_close;
|
|
2458
|
-
return /* @__PURE__ */
|
|
2514
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("li", {
|
|
2459
2515
|
tabIndex: 0,
|
|
2460
2516
|
ref: toastRef,
|
|
2461
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]),
|
|
@@ -2580,7 +2636,7 @@ var Toast = (props) => {
|
|
|
2580
2636
|
(_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
|
|
2581
2637
|
(_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
|
|
2582
2638
|
}
|
|
2583
|
-
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */
|
|
2639
|
+
}, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ React2__namespace.default.createElement("button", {
|
|
2584
2640
|
"aria-label": closeButtonAriaLabel,
|
|
2585
2641
|
"data-disabled": disabled,
|
|
2586
2642
|
"data-close-button": true,
|
|
@@ -2590,19 +2646,19 @@ var Toast = (props) => {
|
|
|
2590
2646
|
toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
|
|
2591
2647
|
},
|
|
2592
2648
|
className: cn(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
|
|
2593
|
-
}, (_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", {
|
|
2594
2650
|
"data-icon": "",
|
|
2595
2651
|
className: cn(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
|
|
2596
|
-
}, 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", {
|
|
2597
2653
|
"data-content": "",
|
|
2598
2654
|
className: cn(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
|
|
2599
|
-
}, /* @__PURE__ */
|
|
2655
|
+
}, /* @__PURE__ */ React2__namespace.default.createElement("div", {
|
|
2600
2656
|
"data-title": "",
|
|
2601
2657
|
className: cn(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
|
|
2602
|
-
}, 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", {
|
|
2603
2659
|
"data-description": "",
|
|
2604
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)
|
|
2605
|
-
}, 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", {
|
|
2606
2662
|
"data-button": true,
|
|
2607
2663
|
"data-cancel": true,
|
|
2608
2664
|
style: toast2.cancelButtonStyle || cancelButtonStyle,
|
|
@@ -2613,7 +2669,7 @@ var Toast = (props) => {
|
|
|
2613
2669
|
deleteToast();
|
|
2614
2670
|
},
|
|
2615
2671
|
className: cn(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
|
|
2616
|
-
}, 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", {
|
|
2617
2673
|
"data-button": true,
|
|
2618
2674
|
"data-action": true,
|
|
2619
2675
|
style: toast2.actionButtonStyle || actionButtonStyle,
|
|
@@ -2675,13 +2731,13 @@ function assignOffset(defaultOffset, mobileOffset) {
|
|
|
2675
2731
|
});
|
|
2676
2732
|
return styles;
|
|
2677
2733
|
}
|
|
2678
|
-
var Toaster = /* @__PURE__ */
|
|
2734
|
+
var Toaster = /* @__PURE__ */ React2__namespace.default.forwardRef(function Toaster2(props, ref) {
|
|
2679
2735
|
const { id, invert, position = "bottom-right", hotkey = [
|
|
2680
2736
|
"altKey",
|
|
2681
2737
|
"KeyT"
|
|
2682
2738
|
], expand, closeButton, className, offset, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
|
|
2683
|
-
const [toasts, setToasts] =
|
|
2684
|
-
const filteredToasts =
|
|
2739
|
+
const [toasts, setToasts] = React2__namespace.default.useState([]);
|
|
2740
|
+
const filteredToasts = React2__namespace.default.useMemo(() => {
|
|
2685
2741
|
if (id) {
|
|
2686
2742
|
return toasts.filter((toast2) => toast2.toasterId === id);
|
|
2687
2743
|
}
|
|
@@ -2690,7 +2746,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2690
2746
|
toasts,
|
|
2691
2747
|
id
|
|
2692
2748
|
]);
|
|
2693
|
-
const possiblePositions =
|
|
2749
|
+
const possiblePositions = React2__namespace.default.useMemo(() => {
|
|
2694
2750
|
return Array.from(new Set([
|
|
2695
2751
|
position
|
|
2696
2752
|
].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
|
|
@@ -2698,15 +2754,15 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2698
2754
|
filteredToasts,
|
|
2699
2755
|
position
|
|
2700
2756
|
]);
|
|
2701
|
-
const [heights, setHeights] =
|
|
2702
|
-
const [expanded, setExpanded] =
|
|
2703
|
-
const [interacting, setInteracting] =
|
|
2704
|
-
const [actualTheme, setActualTheme] =
|
|
2705
|
-
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);
|
|
2706
2762
|
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
2707
|
-
const lastFocusedElementRef =
|
|
2708
|
-
const isFocusWithinRef =
|
|
2709
|
-
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) => {
|
|
2710
2766
|
setToasts((toasts2) => {
|
|
2711
2767
|
var _toasts_find;
|
|
2712
2768
|
if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
|
|
@@ -2715,7 +2771,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2715
2771
|
return toasts2.filter(({ id: id2 }) => id2 !== toastToRemove.id);
|
|
2716
2772
|
});
|
|
2717
2773
|
}, []);
|
|
2718
|
-
|
|
2774
|
+
React2__namespace.default.useEffect(() => {
|
|
2719
2775
|
return ToastState.subscribe((toast2) => {
|
|
2720
2776
|
if (toast2.dismiss) {
|
|
2721
2777
|
requestAnimationFrame(() => {
|
|
@@ -2751,7 +2807,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2751
2807
|
}, [
|
|
2752
2808
|
toasts
|
|
2753
2809
|
]);
|
|
2754
|
-
|
|
2810
|
+
React2__namespace.default.useEffect(() => {
|
|
2755
2811
|
if (theme !== "system") {
|
|
2756
2812
|
setActualTheme(theme);
|
|
2757
2813
|
return;
|
|
@@ -2789,14 +2845,14 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2789
2845
|
}, [
|
|
2790
2846
|
theme
|
|
2791
2847
|
]);
|
|
2792
|
-
|
|
2848
|
+
React2__namespace.default.useEffect(() => {
|
|
2793
2849
|
if (toasts.length <= 1) {
|
|
2794
2850
|
setExpanded(false);
|
|
2795
2851
|
}
|
|
2796
2852
|
}, [
|
|
2797
2853
|
toasts
|
|
2798
2854
|
]);
|
|
2799
|
-
|
|
2855
|
+
React2__namespace.default.useEffect(() => {
|
|
2800
2856
|
const handleKeyDown = (event) => {
|
|
2801
2857
|
var _listRef_current;
|
|
2802
2858
|
const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
|
|
@@ -2814,7 +2870,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2814
2870
|
}, [
|
|
2815
2871
|
hotkey
|
|
2816
2872
|
]);
|
|
2817
|
-
|
|
2873
|
+
React2__namespace.default.useEffect(() => {
|
|
2818
2874
|
if (listRef.current) {
|
|
2819
2875
|
return () => {
|
|
2820
2876
|
if (lastFocusedElementRef.current) {
|
|
@@ -2831,7 +2887,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2831
2887
|
]);
|
|
2832
2888
|
return (
|
|
2833
2889
|
// Remove item from normal navigation flow, only available via hotkey
|
|
2834
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ React2__namespace.default.createElement("section", {
|
|
2835
2891
|
ref,
|
|
2836
2892
|
"aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
|
|
2837
2893
|
tabIndex: -1,
|
|
@@ -2843,7 +2899,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2843
2899
|
var _heights_;
|
|
2844
2900
|
const [y, x] = position2.split("-");
|
|
2845
2901
|
if (!filteredToasts.length) return null;
|
|
2846
|
-
return /* @__PURE__ */
|
|
2902
|
+
return /* @__PURE__ */ React2__namespace.default.createElement("ol", {
|
|
2847
2903
|
key: position2,
|
|
2848
2904
|
dir: dir === "auto" ? getDocumentDirection() : dir,
|
|
2849
2905
|
tabIndex: -1,
|
|
@@ -2895,7 +2951,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2895
2951
|
onPointerUp: () => setInteracting(false)
|
|
2896
2952
|
}, filteredToasts.filter((toast2) => !toast2.position && index === 0 || toast2.position === position2).map((toast2, index2) => {
|
|
2897
2953
|
var _toastOptions_duration, _toastOptions_closeButton;
|
|
2898
|
-
return /* @__PURE__ */
|
|
2954
|
+
return /* @__PURE__ */ React2__namespace.default.createElement(Toast, {
|
|
2899
2955
|
key: toast2.id,
|
|
2900
2956
|
icons,
|
|
2901
2957
|
index: index2,
|
|
@@ -2929,7 +2985,7 @@ var Toaster = /* @__PURE__ */ React__default.default.forwardRef(function Toaster
|
|
|
2929
2985
|
);
|
|
2930
2986
|
});
|
|
2931
2987
|
function FunnelToaster(props = {}) {
|
|
2932
|
-
return
|
|
2988
|
+
return React2.createElement(Toaster, { position: "top-center", ...props });
|
|
2933
2989
|
}
|
|
2934
2990
|
function renderToaster(toaster) {
|
|
2935
2991
|
if (toaster === false) return null;
|
|
@@ -3000,7 +3056,7 @@ function createFunnel(store, context, tracker, experiments = []) {
|
|
|
3000
3056
|
})
|
|
3001
3057
|
};
|
|
3002
3058
|
}
|
|
3003
|
-
var FunnelCtx =
|
|
3059
|
+
var FunnelCtx = React2.createContext(null);
|
|
3004
3060
|
function FunnelProvider({
|
|
3005
3061
|
config,
|
|
3006
3062
|
sessionValues,
|
|
@@ -3017,7 +3073,7 @@ function FunnelProvider({
|
|
|
3017
3073
|
children
|
|
3018
3074
|
}) {
|
|
3019
3075
|
const resolvedTracker = tracker ?? FALLBACK_TRACKER;
|
|
3020
|
-
const [value] =
|
|
3076
|
+
const [value] = React2.useState(() => {
|
|
3021
3077
|
const s = store ?? createFunnelStore(
|
|
3022
3078
|
{ responses: config?.responses, data: config?.data },
|
|
3023
3079
|
// FLASH-FREE HYDRATION: with deferSessionValues the initial render is seeded with
|
|
@@ -3043,7 +3099,7 @@ function FunnelProvider({
|
|
|
3043
3099
|
const value2 = s.get("user.email");
|
|
3044
3100
|
return typeof value2 === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value2) ? value2 : void 0;
|
|
3045
3101
|
};
|
|
3046
|
-
const catalog =
|
|
3102
|
+
const catalog = chunk7HDZVHIT_cjs.buildCatalog(offerings ?? []);
|
|
3047
3103
|
return {
|
|
3048
3104
|
funnel: createFunnel(s, ctx, busTracker, experiments ?? []),
|
|
3049
3105
|
store: s,
|
|
@@ -3062,41 +3118,41 @@ function FunnelProvider({
|
|
|
3062
3118
|
bus
|
|
3063
3119
|
};
|
|
3064
3120
|
});
|
|
3065
|
-
|
|
3066
|
-
|
|
3121
|
+
React2.useEffect(() => attachBus(value.bus), [value.bus]);
|
|
3122
|
+
React2.useEffect(() => {
|
|
3067
3123
|
if (!deferSessionValues || !sessionValues) return;
|
|
3068
3124
|
const updates = {};
|
|
3069
3125
|
for (const [key, v] of Object.entries(sessionValues))
|
|
3070
3126
|
if (v !== void 0) updates[key] = v;
|
|
3071
3127
|
if (Object.keys(updates).length > 0) value.store.setMany(updates);
|
|
3072
3128
|
}, []);
|
|
3073
|
-
|
|
3129
|
+
React2.useEffect(() => {
|
|
3074
3130
|
value.tracker.setAcquisition?.(buildAcquisition(value.context));
|
|
3075
3131
|
}, [value]);
|
|
3076
|
-
const tree =
|
|
3132
|
+
const tree = React2.createElement(TrackerProvider, {
|
|
3077
3133
|
tracker: value.tracker,
|
|
3078
|
-
children:
|
|
3134
|
+
children: React2.createElement(CheckoutDriverProvider, {
|
|
3079
3135
|
driver: value.driver,
|
|
3080
|
-
children:
|
|
3136
|
+
children: React2.createElement(CatalogProvider, {
|
|
3081
3137
|
catalog: value.catalog,
|
|
3082
|
-
children:
|
|
3138
|
+
children: React2.createElement(FunnelCtx.Provider, {
|
|
3083
3139
|
value,
|
|
3084
|
-
children:
|
|
3140
|
+
children: React2.createElement(LocaleProvider, {
|
|
3085
3141
|
config: config?.locales,
|
|
3086
3142
|
catalog: messages,
|
|
3087
3143
|
detected: value.context.locale.locale,
|
|
3088
3144
|
override: localeOverride,
|
|
3089
|
-
children:
|
|
3145
|
+
children: React2.createElement(ModalRuntime, { children })
|
|
3090
3146
|
})
|
|
3091
3147
|
})
|
|
3092
3148
|
})
|
|
3093
3149
|
})
|
|
3094
3150
|
});
|
|
3095
|
-
return
|
|
3151
|
+
return React2.createElement(React2.Fragment, null, tree, renderToaster(toaster));
|
|
3096
3152
|
}
|
|
3097
3153
|
var FALLBACK_TRACKER = createConsoleTracker({ silent: true });
|
|
3098
3154
|
function useFunnelCtx() {
|
|
3099
|
-
const ctx =
|
|
3155
|
+
const ctx = React2.useContext(FunnelCtx);
|
|
3100
3156
|
if (!ctx) {
|
|
3101
3157
|
throw new Error(
|
|
3102
3158
|
"useFunnel/useResponse/\u2026 must be used inside <FunnelProvider>"
|
|
@@ -3108,21 +3164,21 @@ function useFunnel() {
|
|
|
3108
3164
|
return useFunnelCtx().funnel;
|
|
3109
3165
|
}
|
|
3110
3166
|
function useBusInternal() {
|
|
3111
|
-
return
|
|
3167
|
+
return React2.useContext(FunnelCtx)?.bus ?? null;
|
|
3112
3168
|
}
|
|
3113
3169
|
function useStoreKey(store, key) {
|
|
3114
|
-
const subscribe =
|
|
3170
|
+
const subscribe = React2.useCallback(
|
|
3115
3171
|
(cb) => store.subscribe(cb, { keys: [key] }),
|
|
3116
3172
|
[store, key]
|
|
3117
3173
|
);
|
|
3118
|
-
const getSnapshot =
|
|
3119
|
-
return
|
|
3174
|
+
const getSnapshot = React2.useCallback(() => store.get(key), [store, key]);
|
|
3175
|
+
return React2.useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
3120
3176
|
}
|
|
3121
3177
|
function makeFieldHook(ns) {
|
|
3122
3178
|
return function useNamespaceField(key) {
|
|
3123
3179
|
const { funnel, store } = useFunnelCtx();
|
|
3124
3180
|
const value = useStoreKey(store, `${NAMESPACE_PREFIX[ns]}.${key}`);
|
|
3125
|
-
const set =
|
|
3181
|
+
const set = React2.useCallback(
|
|
3126
3182
|
(v) => funnel[ns].set({ [key]: v }),
|
|
3127
3183
|
[funnel, key]
|
|
3128
3184
|
);
|
|
@@ -3143,7 +3199,7 @@ function useField(path) {
|
|
|
3143
3199
|
);
|
|
3144
3200
|
}
|
|
3145
3201
|
const value = useStoreKey(store, `${NAMESPACE_PREFIX[ns]}.${key}`);
|
|
3146
|
-
const set =
|
|
3202
|
+
const set = React2.useCallback(
|
|
3147
3203
|
(v) => funnel[ns].set({ [key]: v }),
|
|
3148
3204
|
[funnel, ns, key]
|
|
3149
3205
|
);
|
|
@@ -3169,7 +3225,7 @@ function useSystem() {
|
|
|
3169
3225
|
}
|
|
3170
3226
|
function useContextValue(path) {
|
|
3171
3227
|
const ctx = useContextObject();
|
|
3172
|
-
return
|
|
3228
|
+
return React2.useMemo(
|
|
3173
3229
|
() => path.split(".").reduce(
|
|
3174
3230
|
(acc, k) => acc?.[k],
|
|
3175
3231
|
ctx
|
|
@@ -3483,18 +3539,18 @@ function createPlatformTracker(cfg) {
|
|
|
3483
3539
|
}
|
|
3484
3540
|
|
|
3485
3541
|
// src/flow/mount.tsx
|
|
3486
|
-
var AssetsContext =
|
|
3542
|
+
var AssetsContext = React2.createContext({});
|
|
3487
3543
|
function AssetsProvider({
|
|
3488
3544
|
assets,
|
|
3489
3545
|
children
|
|
3490
3546
|
}) {
|
|
3491
|
-
return
|
|
3547
|
+
return React2.createElement(AssetsContext.Provider, { value: assets ?? {} }, children);
|
|
3492
3548
|
}
|
|
3493
3549
|
function useAssets() {
|
|
3494
|
-
return
|
|
3550
|
+
return React2.useContext(AssetsContext);
|
|
3495
3551
|
}
|
|
3496
3552
|
function useAsset(name) {
|
|
3497
|
-
return
|
|
3553
|
+
return React2.useContext(AssetsContext)[name];
|
|
3498
3554
|
}
|
|
3499
3555
|
function createFunnelTree({
|
|
3500
3556
|
config,
|
|
@@ -3523,17 +3579,17 @@ function createFunnelTree({
|
|
|
3523
3579
|
const layoutWithResume = function LayoutWithCheckoutResume({
|
|
3524
3580
|
children
|
|
3525
3581
|
}) {
|
|
3526
|
-
return
|
|
3527
|
-
|
|
3582
|
+
return React2.createElement(
|
|
3583
|
+
React2.Fragment,
|
|
3528
3584
|
null,
|
|
3529
|
-
|
|
3530
|
-
embedEnabled ?
|
|
3531
|
-
layout ?
|
|
3585
|
+
React2.createElement(CheckoutResume, null),
|
|
3586
|
+
embedEnabled ? React2.createElement(EmbedBridge, null) : null,
|
|
3587
|
+
layout ? React2.createElement(layout, null, children) : children
|
|
3532
3588
|
);
|
|
3533
3589
|
};
|
|
3534
|
-
return
|
|
3590
|
+
return React2.createElement(AssetsProvider, {
|
|
3535
3591
|
assets: opts.assets,
|
|
3536
|
-
children:
|
|
3592
|
+
children: React2.createElement(FunnelProvider, {
|
|
3537
3593
|
config,
|
|
3538
3594
|
offerings: opts.offerings ?? [],
|
|
3539
3595
|
messages: opts.messages ?? messages,
|
|
@@ -3549,7 +3605,7 @@ function createFunnelTree({
|
|
|
3549
3605
|
customerId: opts.customerId ?? null,
|
|
3550
3606
|
sessionId: opts.sessionId ?? null
|
|
3551
3607
|
},
|
|
3552
|
-
children:
|
|
3608
|
+
children: React2.createElement(FunnelView, {
|
|
3553
3609
|
pages,
|
|
3554
3610
|
layout: layoutWithResume,
|
|
3555
3611
|
initialKey: opts.initialKey,
|
|
@@ -3579,7 +3635,7 @@ function Choice({
|
|
|
3579
3635
|
return options.map((opt) => {
|
|
3580
3636
|
const o = typeof opt === "string" ? { value: opt } : opt;
|
|
3581
3637
|
const selected = value === o.value;
|
|
3582
|
-
return
|
|
3638
|
+
return React2.createElement(
|
|
3583
3639
|
"button",
|
|
3584
3640
|
{
|
|
3585
3641
|
key: o.value,
|
|
@@ -3598,7 +3654,7 @@ function Choice({
|
|
|
3598
3654
|
}
|
|
3599
3655
|
function Next({ children, onClick, ...rest }) {
|
|
3600
3656
|
const { next } = useNavigation();
|
|
3601
|
-
return
|
|
3657
|
+
return React2.createElement(
|
|
3602
3658
|
"button",
|
|
3603
3659
|
{
|
|
3604
3660
|
type: "button",
|
|
@@ -3614,7 +3670,7 @@ function Next({ children, onClick, ...rest }) {
|
|
|
3614
3670
|
function Back({ children, onClick, ...rest }) {
|
|
3615
3671
|
const { back, canGoBack } = useNavigation();
|
|
3616
3672
|
if (!canGoBack) return null;
|
|
3617
|
-
return
|
|
3673
|
+
return React2.createElement(
|
|
3618
3674
|
"button",
|
|
3619
3675
|
{
|
|
3620
3676
|
type: "button",
|
|
@@ -3667,7 +3723,7 @@ function Script({
|
|
|
3667
3723
|
onLoad,
|
|
3668
3724
|
onError
|
|
3669
3725
|
}) {
|
|
3670
|
-
|
|
3726
|
+
React2.useEffect(() => {
|
|
3671
3727
|
if (typeof document === "undefined") return;
|
|
3672
3728
|
const key = id ?? src;
|
|
3673
3729
|
if (injected.has(key)) {
|
|
@@ -3708,107 +3764,111 @@ function Script({
|
|
|
3708
3764
|
|
|
3709
3765
|
Object.defineProperty(exports, "assignVariant", {
|
|
3710
3766
|
enumerable: true,
|
|
3711
|
-
get: function () { return
|
|
3767
|
+
get: function () { return chunk7HDZVHIT_cjs.assignVariant; }
|
|
3712
3768
|
});
|
|
3713
3769
|
Object.defineProperty(exports, "bucketingSeed", {
|
|
3714
3770
|
enumerable: true,
|
|
3715
|
-
get: function () { return
|
|
3771
|
+
get: function () { return chunk7HDZVHIT_cjs.bucketingSeed; }
|
|
3716
3772
|
});
|
|
3717
3773
|
Object.defineProperty(exports, "buildCatalog", {
|
|
3718
3774
|
enumerable: true,
|
|
3719
|
-
get: function () { return
|
|
3775
|
+
get: function () { return chunk7HDZVHIT_cjs.buildCatalog; }
|
|
3720
3776
|
});
|
|
3721
3777
|
Object.defineProperty(exports, "compileManifest", {
|
|
3722
3778
|
enumerable: true,
|
|
3723
|
-
get: function () { return
|
|
3779
|
+
get: function () { return chunk7HDZVHIT_cjs.compileManifest; }
|
|
3724
3780
|
});
|
|
3725
3781
|
Object.defineProperty(exports, "currencyExponent", {
|
|
3726
3782
|
enumerable: true,
|
|
3727
|
-
get: function () { return
|
|
3783
|
+
get: function () { return chunk7HDZVHIT_cjs.currencyExponent; }
|
|
3728
3784
|
});
|
|
3729
3785
|
Object.defineProperty(exports, "defineFunnel", {
|
|
3730
3786
|
enumerable: true,
|
|
3731
|
-
get: function () { return
|
|
3787
|
+
get: function () { return chunk7HDZVHIT_cjs.defineFunnel; }
|
|
3732
3788
|
});
|
|
3733
3789
|
Object.defineProperty(exports, "definePage", {
|
|
3734
3790
|
enumerable: true,
|
|
3735
|
-
get: function () { return
|
|
3791
|
+
get: function () { return chunk7HDZVHIT_cjs.definePage; }
|
|
3736
3792
|
});
|
|
3737
3793
|
Object.defineProperty(exports, "entryGuard", {
|
|
3738
3794
|
enumerable: true,
|
|
3739
|
-
get: function () { return
|
|
3795
|
+
get: function () { return chunk7HDZVHIT_cjs.entryGuard; }
|
|
3740
3796
|
});
|
|
3741
3797
|
Object.defineProperty(exports, "evaluateCondition", {
|
|
3742
3798
|
enumerable: true,
|
|
3743
|
-
get: function () { return
|
|
3799
|
+
get: function () { return chunk7HDZVHIT_cjs.evaluateCondition; }
|
|
3744
3800
|
});
|
|
3745
3801
|
Object.defineProperty(exports, "evaluateGate", {
|
|
3746
3802
|
enumerable: true,
|
|
3747
|
-
get: function () { return
|
|
3803
|
+
get: function () { return chunk7HDZVHIT_cjs.evaluateGate; }
|
|
3748
3804
|
});
|
|
3749
3805
|
Object.defineProperty(exports, "expectedPathLength", {
|
|
3750
3806
|
enumerable: true,
|
|
3751
|
-
get: function () { return
|
|
3807
|
+
get: function () { return chunk7HDZVHIT_cjs.expectedPathLength; }
|
|
3752
3808
|
});
|
|
3753
3809
|
Object.defineProperty(exports, "fnv1a", {
|
|
3754
3810
|
enumerable: true,
|
|
3755
|
-
get: function () { return
|
|
3811
|
+
get: function () { return chunk7HDZVHIT_cjs.fnv1a; }
|
|
3756
3812
|
});
|
|
3757
3813
|
Object.defineProperty(exports, "formatMoney", {
|
|
3758
3814
|
enumerable: true,
|
|
3759
|
-
get: function () { return
|
|
3815
|
+
get: function () { return chunk7HDZVHIT_cjs.formatMoney; }
|
|
3760
3816
|
});
|
|
3761
3817
|
Object.defineProperty(exports, "formatOffering", {
|
|
3762
3818
|
enumerable: true,
|
|
3763
|
-
get: function () { return
|
|
3819
|
+
get: function () { return chunk7HDZVHIT_cjs.formatOffering; }
|
|
3820
|
+
});
|
|
3821
|
+
Object.defineProperty(exports, "groupProgress", {
|
|
3822
|
+
enumerable: true,
|
|
3823
|
+
get: function () { return chunk7HDZVHIT_cjs.groupProgress; }
|
|
3764
3824
|
});
|
|
3765
3825
|
Object.defineProperty(exports, "hashToUnit", {
|
|
3766
3826
|
enumerable: true,
|
|
3767
|
-
get: function () { return
|
|
3827
|
+
get: function () { return chunk7HDZVHIT_cjs.hashToUnit; }
|
|
3768
3828
|
});
|
|
3769
3829
|
Object.defineProperty(exports, "isRtl", {
|
|
3770
3830
|
enumerable: true,
|
|
3771
|
-
get: function () { return
|
|
3831
|
+
get: function () { return chunk7HDZVHIT_cjs.isRtl; }
|
|
3772
3832
|
});
|
|
3773
3833
|
Object.defineProperty(exports, "isVariantKey", {
|
|
3774
3834
|
enumerable: true,
|
|
3775
|
-
get: function () { return
|
|
3835
|
+
get: function () { return chunk7HDZVHIT_cjs.isVariantKey; }
|
|
3776
3836
|
});
|
|
3777
3837
|
Object.defineProperty(exports, "nextPage", {
|
|
3778
3838
|
enumerable: true,
|
|
3779
|
-
get: function () { return
|
|
3839
|
+
get: function () { return chunk7HDZVHIT_cjs.nextPage; }
|
|
3780
3840
|
});
|
|
3781
3841
|
Object.defineProperty(exports, "outgoingKeys", {
|
|
3782
3842
|
enumerable: true,
|
|
3783
|
-
get: function () { return
|
|
3843
|
+
get: function () { return chunk7HDZVHIT_cjs.outgoingKeys; }
|
|
3784
3844
|
});
|
|
3785
3845
|
Object.defineProperty(exports, "pageMeta", {
|
|
3786
3846
|
enumerable: true,
|
|
3787
|
-
get: function () { return
|
|
3847
|
+
get: function () { return chunk7HDZVHIT_cjs.pageMeta; }
|
|
3788
3848
|
});
|
|
3789
3849
|
Object.defineProperty(exports, "parseSlotKey", {
|
|
3790
3850
|
enumerable: true,
|
|
3791
|
-
get: function () { return
|
|
3851
|
+
get: function () { return chunk7HDZVHIT_cjs.parseSlotKey; }
|
|
3792
3852
|
});
|
|
3793
3853
|
Object.defineProperty(exports, "pickByWeight", {
|
|
3794
3854
|
enumerable: true,
|
|
3795
|
-
get: function () { return
|
|
3855
|
+
get: function () { return chunk7HDZVHIT_cjs.pickByWeight; }
|
|
3796
3856
|
});
|
|
3797
3857
|
Object.defineProperty(exports, "resolveExperiments", {
|
|
3798
3858
|
enumerable: true,
|
|
3799
|
-
get: function () { return
|
|
3859
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveExperiments; }
|
|
3800
3860
|
});
|
|
3801
3861
|
Object.defineProperty(exports, "resolveLocale", {
|
|
3802
3862
|
enumerable: true,
|
|
3803
|
-
get: function () { return
|
|
3863
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveLocale; }
|
|
3804
3864
|
});
|
|
3805
3865
|
Object.defineProperty(exports, "resolveOffering", {
|
|
3806
3866
|
enumerable: true,
|
|
3807
|
-
get: function () { return
|
|
3867
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveOffering; }
|
|
3808
3868
|
});
|
|
3809
3869
|
Object.defineProperty(exports, "resolveRoute", {
|
|
3810
3870
|
enumerable: true,
|
|
3811
|
-
get: function () { return
|
|
3871
|
+
get: function () { return chunk7HDZVHIT_cjs.resolveRoute; }
|
|
3812
3872
|
});
|
|
3813
3873
|
Object.defineProperty(exports, "INLINE_SURFACES", {
|
|
3814
3874
|
enumerable: true,
|
|
@@ -3906,6 +3966,7 @@ exports.useDevice = useDevice;
|
|
|
3906
3966
|
exports.useExperiment = useExperiment;
|
|
3907
3967
|
exports.useField = useField;
|
|
3908
3968
|
exports.useFunnel = useFunnel;
|
|
3969
|
+
exports.useGroupProgress = useGroupProgress;
|
|
3909
3970
|
exports.useLocale = useLocale;
|
|
3910
3971
|
exports.useModal = useModal;
|
|
3911
3972
|
exports.useNavigation = useNavigation;
|