@appfunnel-dev/sdk 2.0.0-canary.10 → 2.0.0-canary.11
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-RKPRMTSU.cjs} +43 -2
- package/dist/chunk-RKPRMTSU.cjs.map +1 -0
- package/dist/{chunk-VW2HVPR4.js → chunk-SXENKZ4U.js} +43 -3
- package/dist/chunk-SXENKZ4U.js.map +1 -0
- package/dist/index.cjs +66 -44
- 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 +24 -7
- package/dist/index.js.map +1 -1
- package/dist/{manifest-B3Tdab0M.d.cts → manifest-C2mDXWNU.d.cts} +77 -1
- package/dist/{manifest-B3Tdab0M.d.ts → manifest-C2mDXWNU.d.ts} +77 -1
- 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,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRKPRMTSU_cjs = require('./chunk-RKPRMTSU.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');
|
|
@@ -504,9 +504,9 @@ function LocaleProvider({
|
|
|
504
504
|
override,
|
|
505
505
|
children
|
|
506
506
|
}) {
|
|
507
|
-
const [locale, setLocale] = React.useState(() =>
|
|
507
|
+
const [locale, setLocale] = React.useState(() => chunkRKPRMTSU_cjs.resolveLocale(config, detected, override));
|
|
508
508
|
React.useEffect(() => {
|
|
509
|
-
setLocale(
|
|
509
|
+
setLocale(chunkRKPRMTSU_cjs.resolveLocale(config, detected, override));
|
|
510
510
|
}, [config, detected, override]);
|
|
511
511
|
const value = React.useMemo(
|
|
512
512
|
() => ({ locale, setLocale, config, catalog }),
|
|
@@ -578,7 +578,7 @@ function useTranslation() {
|
|
|
578
578
|
fmt,
|
|
579
579
|
locale,
|
|
580
580
|
setLocale,
|
|
581
|
-
dir:
|
|
581
|
+
dir: chunkRKPRMTSU_cjs.isRtl(locale) ? "rtl" : "ltr",
|
|
582
582
|
locales: config?.supported ?? [locale]
|
|
583
583
|
};
|
|
584
584
|
}
|
|
@@ -600,7 +600,7 @@ function useOffering(id) {
|
|
|
600
600
|
const locale = useActiveLocale();
|
|
601
601
|
const resolved = id ? catalog.get(id) : void 0;
|
|
602
602
|
return React.useMemo(
|
|
603
|
-
() => resolved ?
|
|
603
|
+
() => resolved ? chunkRKPRMTSU_cjs.formatOffering(resolved, locale) : void 0,
|
|
604
604
|
[resolved, locale]
|
|
605
605
|
);
|
|
606
606
|
}
|
|
@@ -608,7 +608,7 @@ function useOfferings() {
|
|
|
608
608
|
const catalog = useCatalog();
|
|
609
609
|
const locale = useActiveLocale();
|
|
610
610
|
return React.useMemo(
|
|
611
|
-
() => Array.from(catalog.values()).map((r) =>
|
|
611
|
+
() => Array.from(catalog.values()).map((r) => chunkRKPRMTSU_cjs.formatOffering(r, locale)),
|
|
612
612
|
[catalog, locale]
|
|
613
613
|
);
|
|
614
614
|
}
|
|
@@ -709,15 +709,17 @@ async function captureScreenshot(params = {}) {
|
|
|
709
709
|
|
|
710
710
|
// src/flow/flow.tsx
|
|
711
711
|
var NavContext = React.createContext(null);
|
|
712
|
+
var GroupProgressContext = React.createContext(null);
|
|
712
713
|
var ExperimentContext = React.createContext({});
|
|
713
714
|
function useExperiment(id) {
|
|
714
715
|
return React.useContext(ExperimentContext)[id];
|
|
715
716
|
}
|
|
716
|
-
function pageContextFor(currentKey, slug, index, total, startedAt) {
|
|
717
|
+
function pageContextFor(currentKey, slug, group, index, total, startedAt) {
|
|
717
718
|
const denom = Math.max(total, index + 1);
|
|
718
719
|
return {
|
|
719
720
|
key: currentKey,
|
|
720
721
|
slug,
|
|
722
|
+
group,
|
|
721
723
|
index,
|
|
722
724
|
total: denom,
|
|
723
725
|
progressPercentage: denom > 0 ? Math.min(100, Math.round((index + 1) / denom * 100)) : 0,
|
|
@@ -786,10 +788,10 @@ function FunnelView({
|
|
|
786
788
|
[pages]
|
|
787
789
|
);
|
|
788
790
|
const seedRef = React.useRef(null);
|
|
789
|
-
if (seedRef.current === null) seedRef.current =
|
|
791
|
+
if (seedRef.current === null) seedRef.current = chunkRKPRMTSU_cjs.bucketingSeed(funnel.context);
|
|
790
792
|
const seed = seedRef.current;
|
|
791
793
|
const experiments = React.useMemo(
|
|
792
|
-
() =>
|
|
794
|
+
() => chunkRKPRMTSU_cjs.resolveExperiments(pages, funnel.experiments, seed),
|
|
793
795
|
[pages, funnel.experiments, seed]
|
|
794
796
|
);
|
|
795
797
|
const toSlot = React.useCallback((k) => experiments.slotOf[k] ?? k, [experiments]);
|
|
@@ -813,8 +815,8 @@ function FunnelView({
|
|
|
813
815
|
const target = toSlot(initialKey);
|
|
814
816
|
const page2 = flowPages.find((p) => p.key === target);
|
|
815
817
|
if (trustInitialKey) return page2 ? [target] : start ? [start] : [];
|
|
816
|
-
const guard =
|
|
817
|
-
const ok = page2 && (!guard ||
|
|
818
|
+
const guard = chunkRKPRMTSU_cjs.entryGuard(page2?.meta);
|
|
819
|
+
const ok = page2 && (!guard || chunkRKPRMTSU_cjs.evaluateGate(guard, funnel.snapshot()));
|
|
818
820
|
const first = ok ? target : start;
|
|
819
821
|
return first ? [first] : [];
|
|
820
822
|
});
|
|
@@ -822,14 +824,20 @@ function FunnelView({
|
|
|
822
824
|
const index = history.length - 1;
|
|
823
825
|
const startKey = history[0];
|
|
824
826
|
const total = React.useMemo(
|
|
825
|
-
() =>
|
|
827
|
+
() => chunkRKPRMTSU_cjs.expectedPathLength(flow, startKey, funnel.snapshot()),
|
|
826
828
|
// currentKey in deps: re-trace as each step's answers settle the branch.
|
|
827
829
|
[flow, startKey, currentKey, funnel]
|
|
828
830
|
);
|
|
829
831
|
const slug = pageByKey.get(currentKey)?.meta?.slug ?? currentKey;
|
|
832
|
+
const group = pageByKey.get(currentKey)?.meta?.group;
|
|
830
833
|
const page = React.useMemo(
|
|
831
|
-
() => pageContextFor(currentKey, slug, index, total, funnel.context.system.now),
|
|
832
|
-
[currentKey, slug, index, total, funnel.context.system.now]
|
|
834
|
+
() => pageContextFor(currentKey, slug, group, index, total, funnel.context.system.now),
|
|
835
|
+
[currentKey, slug, group, index, total, funnel.context.system.now]
|
|
836
|
+
);
|
|
837
|
+
const groups = React.useMemo(
|
|
838
|
+
() => chunkRKPRMTSU_cjs.groupProgress(flow, startKey, currentKey, funnel.snapshot()),
|
|
839
|
+
// currentKey in deps: re-trace as each step's answers settle the branch.
|
|
840
|
+
[flow, startKey, currentKey, funnel]
|
|
833
841
|
);
|
|
834
842
|
React.useEffect(() => {
|
|
835
843
|
funnel.context.page = page;
|
|
@@ -857,7 +865,7 @@ function FunnelView({
|
|
|
857
865
|
usePageExitTimer(tracker, currentKey);
|
|
858
866
|
const [isNavigating, startNav] = React.useTransition();
|
|
859
867
|
const next = React.useCallback(() => {
|
|
860
|
-
const target =
|
|
868
|
+
const target = chunkRKPRMTSU_cjs.nextPage(flow, currentKey, funnel.snapshot());
|
|
861
869
|
const resolved = target ? toSlot(target) : target;
|
|
862
870
|
if (resolved) startNav(() => setHistory((h) => [...h, resolved]));
|
|
863
871
|
}, [flow, currentKey, funnel, toSlot]);
|
|
@@ -881,7 +889,7 @@ function FunnelView({
|
|
|
881
889
|
[loaders, toRenderKey]
|
|
882
890
|
);
|
|
883
891
|
const nextCandidates = React.useMemo(
|
|
884
|
-
() => [...new Set(
|
|
892
|
+
() => [...new Set(chunkRKPRMTSU_cjs.outgoingKeys(flow, currentKey).map(toRenderKey))],
|
|
885
893
|
[flow, currentKey, toRenderKey]
|
|
886
894
|
);
|
|
887
895
|
React.useEffect(() => {
|
|
@@ -943,7 +951,11 @@ function FunnelView({
|
|
|
943
951
|
return React.createElement(
|
|
944
952
|
ExperimentContext.Provider,
|
|
945
953
|
{ value: experiments.assignments },
|
|
946
|
-
React.createElement(
|
|
954
|
+
React.createElement(
|
|
955
|
+
NavContext.Provider,
|
|
956
|
+
{ value },
|
|
957
|
+
React.createElement(GroupProgressContext.Provider, { value: groups }, content)
|
|
958
|
+
)
|
|
947
959
|
);
|
|
948
960
|
}
|
|
949
961
|
function useNavigation() {
|
|
@@ -1029,6 +1041,11 @@ function EmbedBridge() {
|
|
|
1029
1041
|
function usePage() {
|
|
1030
1042
|
return useNavigation().page;
|
|
1031
1043
|
}
|
|
1044
|
+
function useGroupProgress() {
|
|
1045
|
+
const ctx = React.useContext(GroupProgressContext);
|
|
1046
|
+
if (!ctx) throw new Error("useGroupProgress must be used inside <FunnelView>");
|
|
1047
|
+
return ctx;
|
|
1048
|
+
}
|
|
1032
1049
|
var symModalId = /* @__PURE__ */ Symbol("AppfunnelModalId");
|
|
1033
1050
|
var initialState = {};
|
|
1034
1051
|
var ModalStateContext = React.createContext(initialState);
|
|
@@ -3043,7 +3060,7 @@ function FunnelProvider({
|
|
|
3043
3060
|
const value2 = s.get("user.email");
|
|
3044
3061
|
return typeof value2 === "string" && /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(value2) ? value2 : void 0;
|
|
3045
3062
|
};
|
|
3046
|
-
const catalog =
|
|
3063
|
+
const catalog = chunkRKPRMTSU_cjs.buildCatalog(offerings ?? []);
|
|
3047
3064
|
return {
|
|
3048
3065
|
funnel: createFunnel(s, ctx, busTracker, experiments ?? []),
|
|
3049
3066
|
store: s,
|
|
@@ -3708,107 +3725,111 @@ function Script({
|
|
|
3708
3725
|
|
|
3709
3726
|
Object.defineProperty(exports, "assignVariant", {
|
|
3710
3727
|
enumerable: true,
|
|
3711
|
-
get: function () { return
|
|
3728
|
+
get: function () { return chunkRKPRMTSU_cjs.assignVariant; }
|
|
3712
3729
|
});
|
|
3713
3730
|
Object.defineProperty(exports, "bucketingSeed", {
|
|
3714
3731
|
enumerable: true,
|
|
3715
|
-
get: function () { return
|
|
3732
|
+
get: function () { return chunkRKPRMTSU_cjs.bucketingSeed; }
|
|
3716
3733
|
});
|
|
3717
3734
|
Object.defineProperty(exports, "buildCatalog", {
|
|
3718
3735
|
enumerable: true,
|
|
3719
|
-
get: function () { return
|
|
3736
|
+
get: function () { return chunkRKPRMTSU_cjs.buildCatalog; }
|
|
3720
3737
|
});
|
|
3721
3738
|
Object.defineProperty(exports, "compileManifest", {
|
|
3722
3739
|
enumerable: true,
|
|
3723
|
-
get: function () { return
|
|
3740
|
+
get: function () { return chunkRKPRMTSU_cjs.compileManifest; }
|
|
3724
3741
|
});
|
|
3725
3742
|
Object.defineProperty(exports, "currencyExponent", {
|
|
3726
3743
|
enumerable: true,
|
|
3727
|
-
get: function () { return
|
|
3744
|
+
get: function () { return chunkRKPRMTSU_cjs.currencyExponent; }
|
|
3728
3745
|
});
|
|
3729
3746
|
Object.defineProperty(exports, "defineFunnel", {
|
|
3730
3747
|
enumerable: true,
|
|
3731
|
-
get: function () { return
|
|
3748
|
+
get: function () { return chunkRKPRMTSU_cjs.defineFunnel; }
|
|
3732
3749
|
});
|
|
3733
3750
|
Object.defineProperty(exports, "definePage", {
|
|
3734
3751
|
enumerable: true,
|
|
3735
|
-
get: function () { return
|
|
3752
|
+
get: function () { return chunkRKPRMTSU_cjs.definePage; }
|
|
3736
3753
|
});
|
|
3737
3754
|
Object.defineProperty(exports, "entryGuard", {
|
|
3738
3755
|
enumerable: true,
|
|
3739
|
-
get: function () { return
|
|
3756
|
+
get: function () { return chunkRKPRMTSU_cjs.entryGuard; }
|
|
3740
3757
|
});
|
|
3741
3758
|
Object.defineProperty(exports, "evaluateCondition", {
|
|
3742
3759
|
enumerable: true,
|
|
3743
|
-
get: function () { return
|
|
3760
|
+
get: function () { return chunkRKPRMTSU_cjs.evaluateCondition; }
|
|
3744
3761
|
});
|
|
3745
3762
|
Object.defineProperty(exports, "evaluateGate", {
|
|
3746
3763
|
enumerable: true,
|
|
3747
|
-
get: function () { return
|
|
3764
|
+
get: function () { return chunkRKPRMTSU_cjs.evaluateGate; }
|
|
3748
3765
|
});
|
|
3749
3766
|
Object.defineProperty(exports, "expectedPathLength", {
|
|
3750
3767
|
enumerable: true,
|
|
3751
|
-
get: function () { return
|
|
3768
|
+
get: function () { return chunkRKPRMTSU_cjs.expectedPathLength; }
|
|
3752
3769
|
});
|
|
3753
3770
|
Object.defineProperty(exports, "fnv1a", {
|
|
3754
3771
|
enumerable: true,
|
|
3755
|
-
get: function () { return
|
|
3772
|
+
get: function () { return chunkRKPRMTSU_cjs.fnv1a; }
|
|
3756
3773
|
});
|
|
3757
3774
|
Object.defineProperty(exports, "formatMoney", {
|
|
3758
3775
|
enumerable: true,
|
|
3759
|
-
get: function () { return
|
|
3776
|
+
get: function () { return chunkRKPRMTSU_cjs.formatMoney; }
|
|
3760
3777
|
});
|
|
3761
3778
|
Object.defineProperty(exports, "formatOffering", {
|
|
3762
3779
|
enumerable: true,
|
|
3763
|
-
get: function () { return
|
|
3780
|
+
get: function () { return chunkRKPRMTSU_cjs.formatOffering; }
|
|
3781
|
+
});
|
|
3782
|
+
Object.defineProperty(exports, "groupProgress", {
|
|
3783
|
+
enumerable: true,
|
|
3784
|
+
get: function () { return chunkRKPRMTSU_cjs.groupProgress; }
|
|
3764
3785
|
});
|
|
3765
3786
|
Object.defineProperty(exports, "hashToUnit", {
|
|
3766
3787
|
enumerable: true,
|
|
3767
|
-
get: function () { return
|
|
3788
|
+
get: function () { return chunkRKPRMTSU_cjs.hashToUnit; }
|
|
3768
3789
|
});
|
|
3769
3790
|
Object.defineProperty(exports, "isRtl", {
|
|
3770
3791
|
enumerable: true,
|
|
3771
|
-
get: function () { return
|
|
3792
|
+
get: function () { return chunkRKPRMTSU_cjs.isRtl; }
|
|
3772
3793
|
});
|
|
3773
3794
|
Object.defineProperty(exports, "isVariantKey", {
|
|
3774
3795
|
enumerable: true,
|
|
3775
|
-
get: function () { return
|
|
3796
|
+
get: function () { return chunkRKPRMTSU_cjs.isVariantKey; }
|
|
3776
3797
|
});
|
|
3777
3798
|
Object.defineProperty(exports, "nextPage", {
|
|
3778
3799
|
enumerable: true,
|
|
3779
|
-
get: function () { return
|
|
3800
|
+
get: function () { return chunkRKPRMTSU_cjs.nextPage; }
|
|
3780
3801
|
});
|
|
3781
3802
|
Object.defineProperty(exports, "outgoingKeys", {
|
|
3782
3803
|
enumerable: true,
|
|
3783
|
-
get: function () { return
|
|
3804
|
+
get: function () { return chunkRKPRMTSU_cjs.outgoingKeys; }
|
|
3784
3805
|
});
|
|
3785
3806
|
Object.defineProperty(exports, "pageMeta", {
|
|
3786
3807
|
enumerable: true,
|
|
3787
|
-
get: function () { return
|
|
3808
|
+
get: function () { return chunkRKPRMTSU_cjs.pageMeta; }
|
|
3788
3809
|
});
|
|
3789
3810
|
Object.defineProperty(exports, "parseSlotKey", {
|
|
3790
3811
|
enumerable: true,
|
|
3791
|
-
get: function () { return
|
|
3812
|
+
get: function () { return chunkRKPRMTSU_cjs.parseSlotKey; }
|
|
3792
3813
|
});
|
|
3793
3814
|
Object.defineProperty(exports, "pickByWeight", {
|
|
3794
3815
|
enumerable: true,
|
|
3795
|
-
get: function () { return
|
|
3816
|
+
get: function () { return chunkRKPRMTSU_cjs.pickByWeight; }
|
|
3796
3817
|
});
|
|
3797
3818
|
Object.defineProperty(exports, "resolveExperiments", {
|
|
3798
3819
|
enumerable: true,
|
|
3799
|
-
get: function () { return
|
|
3820
|
+
get: function () { return chunkRKPRMTSU_cjs.resolveExperiments; }
|
|
3800
3821
|
});
|
|
3801
3822
|
Object.defineProperty(exports, "resolveLocale", {
|
|
3802
3823
|
enumerable: true,
|
|
3803
|
-
get: function () { return
|
|
3824
|
+
get: function () { return chunkRKPRMTSU_cjs.resolveLocale; }
|
|
3804
3825
|
});
|
|
3805
3826
|
Object.defineProperty(exports, "resolveOffering", {
|
|
3806
3827
|
enumerable: true,
|
|
3807
|
-
get: function () { return
|
|
3828
|
+
get: function () { return chunkRKPRMTSU_cjs.resolveOffering; }
|
|
3808
3829
|
});
|
|
3809
3830
|
Object.defineProperty(exports, "resolveRoute", {
|
|
3810
3831
|
enumerable: true,
|
|
3811
|
-
get: function () { return
|
|
3832
|
+
get: function () { return chunkRKPRMTSU_cjs.resolveRoute; }
|
|
3812
3833
|
});
|
|
3813
3834
|
Object.defineProperty(exports, "INLINE_SURFACES", {
|
|
3814
3835
|
enumerable: true,
|
|
@@ -3906,6 +3927,7 @@ exports.useDevice = useDevice;
|
|
|
3906
3927
|
exports.useExperiment = useExperiment;
|
|
3907
3928
|
exports.useField = useField;
|
|
3908
3929
|
exports.useFunnel = useFunnel;
|
|
3930
|
+
exports.useGroupProgress = useGroupProgress;
|
|
3909
3931
|
exports.useLocale = useLocale;
|
|
3910
3932
|
exports.useModal = useModal;
|
|
3911
3933
|
exports.useNavigation = useNavigation;
|