@founderhq/journeys 0.3.61 → 0.3.63
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/README.md +20 -1
- package/dist/index.cjs +172 -23
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +172 -23
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,9 +63,28 @@ In the journey config, reference the injected value with a whole-value template:
|
|
|
63
63
|
|
|
64
64
|
Keys declared in `computedVariables` are ignored in `initialAnswers`; computed values always come from their formulas.
|
|
65
65
|
|
|
66
|
+
## Injecting Runtime Options (`initialOptions`)
|
|
67
|
+
|
|
68
|
+
Pass `initialOptions` to override option lists at render time without storing large dynamic lists in the journey config. Keys are answer keys: top-level steps use `step.variable ?? step.id`, and `single_select` / `multi_select` blocks use `props.variable`.
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Journey
|
|
72
|
+
apiKey="fos_..."
|
|
73
|
+
journeyId="abc-123"
|
|
74
|
+
initialOptions={{
|
|
75
|
+
country: countries.map((country) => ({
|
|
76
|
+
id: country.code,
|
|
77
|
+
label: country.name,
|
|
78
|
+
})),
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
When a key is present in `initialOptions`, that list is used even if it is empty. When no key is present, the inspector-configured options remain the fallback.
|
|
84
|
+
|
|
66
85
|
## Event Payloads
|
|
67
86
|
|
|
68
|
-
`onEvent` payloads keep user-provided answers and computed values separate
|
|
87
|
+
`onEvent` payloads keep user-provided answers and computed values separate. `step_submit` and `navigate` events include the rendered step config, but option arrays are omitted from those event configs so large `initialOptions` lists are not copied into every payload.
|
|
69
88
|
|
|
70
89
|
```ts
|
|
71
90
|
onEvent={(event) => {
|
package/dist/index.cjs
CHANGED
|
@@ -537,6 +537,131 @@ function normalizeStepOrder(config) {
|
|
|
537
537
|
}
|
|
538
538
|
return __spreadProps(__spreadValues({}, config), { steps: ordered });
|
|
539
539
|
}
|
|
540
|
+
function getRuntimeOptionOverride(overrides, key) {
|
|
541
|
+
if (!overrides || !key) return void 0;
|
|
542
|
+
if (!Object.prototype.hasOwnProperty.call(overrides, key)) return void 0;
|
|
543
|
+
return overrides[key];
|
|
544
|
+
}
|
|
545
|
+
function applyRuntimeOptionOverridesToBlocks(blocks, overrides) {
|
|
546
|
+
if (!overrides) return blocks;
|
|
547
|
+
let changed = false;
|
|
548
|
+
const nextBlocks = blocks.map((block) => {
|
|
549
|
+
let next = block;
|
|
550
|
+
if (block.type === "single_select" || block.type === "multi_select") {
|
|
551
|
+
const options = getRuntimeOptionOverride(overrides, block.props.variable);
|
|
552
|
+
if (options !== void 0) {
|
|
553
|
+
next = __spreadProps(__spreadValues({}, block), {
|
|
554
|
+
props: __spreadProps(__spreadValues({}, block.props), { options })
|
|
555
|
+
});
|
|
556
|
+
changed = true;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (block.type === "columns") {
|
|
560
|
+
let columnsChanged = false;
|
|
561
|
+
const columns = block.props.columns.map((column) => {
|
|
562
|
+
const columnBlocks = applyRuntimeOptionOverridesToBlocks(
|
|
563
|
+
column.blocks,
|
|
564
|
+
overrides
|
|
565
|
+
);
|
|
566
|
+
if (columnBlocks === column.blocks) return column;
|
|
567
|
+
columnsChanged = true;
|
|
568
|
+
return __spreadProps(__spreadValues({}, column), { blocks: columnBlocks });
|
|
569
|
+
});
|
|
570
|
+
if (columnsChanged) {
|
|
571
|
+
next = __spreadProps(__spreadValues({}, block), {
|
|
572
|
+
props: __spreadProps(__spreadValues({}, block.props), { columns })
|
|
573
|
+
});
|
|
574
|
+
changed = true;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return next;
|
|
578
|
+
});
|
|
579
|
+
return changed ? nextBlocks : blocks;
|
|
580
|
+
}
|
|
581
|
+
function applyRuntimeOptionOverrides(config, overrides) {
|
|
582
|
+
if (!overrides || Object.keys(overrides).length === 0) return config;
|
|
583
|
+
let changed = false;
|
|
584
|
+
const steps = config.steps.map((step) => {
|
|
585
|
+
var _a;
|
|
586
|
+
let next = step;
|
|
587
|
+
const stepUsesOptions = step.type === "single_select" || step.type === "multi_select" || step.type === "counter_select";
|
|
588
|
+
const options = stepUsesOptions ? getRuntimeOptionOverride(overrides, (_a = step.variable) != null ? _a : step.id) : void 0;
|
|
589
|
+
if (options !== void 0) {
|
|
590
|
+
next = __spreadProps(__spreadValues({}, step), { options });
|
|
591
|
+
changed = true;
|
|
592
|
+
}
|
|
593
|
+
if (step.blocks) {
|
|
594
|
+
const blocks = applyRuntimeOptionOverridesToBlocks(
|
|
595
|
+
step.blocks,
|
|
596
|
+
overrides
|
|
597
|
+
);
|
|
598
|
+
if (blocks !== step.blocks) {
|
|
599
|
+
next = __spreadProps(__spreadValues({}, next), { blocks });
|
|
600
|
+
changed = true;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return next;
|
|
604
|
+
});
|
|
605
|
+
return changed ? __spreadProps(__spreadValues({}, config), { steps }) : config;
|
|
606
|
+
}
|
|
607
|
+
function stripOptionsFromEventBlocks(blocks) {
|
|
608
|
+
let changed = false;
|
|
609
|
+
const nextBlocks = blocks.map((block) => {
|
|
610
|
+
let next = block;
|
|
611
|
+
if (block.type === "single_select" || block.type === "multi_select") {
|
|
612
|
+
const props = __spreadValues({}, block.props);
|
|
613
|
+
delete props.options;
|
|
614
|
+
next = __spreadProps(__spreadValues({}, block), { props });
|
|
615
|
+
changed = true;
|
|
616
|
+
}
|
|
617
|
+
if (block.type === "columns") {
|
|
618
|
+
let columnsChanged = false;
|
|
619
|
+
const columns = block.props.columns.map((column) => {
|
|
620
|
+
const columnBlocks = stripOptionsFromEventBlocks(column.blocks);
|
|
621
|
+
if (columnBlocks === column.blocks) return column;
|
|
622
|
+
columnsChanged = true;
|
|
623
|
+
return __spreadProps(__spreadValues({}, column), { blocks: columnBlocks });
|
|
624
|
+
});
|
|
625
|
+
if (columnsChanged) {
|
|
626
|
+
next = __spreadProps(__spreadValues({}, block), {
|
|
627
|
+
props: __spreadProps(__spreadValues({}, block.props), { columns })
|
|
628
|
+
});
|
|
629
|
+
changed = true;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
return next;
|
|
633
|
+
});
|
|
634
|
+
return changed ? nextBlocks : blocks;
|
|
635
|
+
}
|
|
636
|
+
function stripOptionsFromEventStep(step) {
|
|
637
|
+
var _a;
|
|
638
|
+
let changed = false;
|
|
639
|
+
let next = step;
|
|
640
|
+
if (step.options !== void 0) {
|
|
641
|
+
next = __spreadValues({}, next);
|
|
642
|
+
delete next.options;
|
|
643
|
+
changed = true;
|
|
644
|
+
}
|
|
645
|
+
if ((_a = step.fields) == null ? void 0 : _a.some((field) => field.options !== void 0)) {
|
|
646
|
+
next = __spreadProps(__spreadValues({}, next), {
|
|
647
|
+
fields: step.fields.map((field) => {
|
|
648
|
+
if (field.options === void 0) return field;
|
|
649
|
+
const nextField = __spreadValues({}, field);
|
|
650
|
+
delete nextField.options;
|
|
651
|
+
return nextField;
|
|
652
|
+
})
|
|
653
|
+
});
|
|
654
|
+
changed = true;
|
|
655
|
+
}
|
|
656
|
+
if (step.blocks) {
|
|
657
|
+
const blocks = stripOptionsFromEventBlocks(step.blocks);
|
|
658
|
+
if (blocks !== step.blocks) {
|
|
659
|
+
next = __spreadProps(__spreadValues({}, next), { blocks });
|
|
660
|
+
changed = true;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
return changed ? next : step;
|
|
664
|
+
}
|
|
540
665
|
var JourneyContext = React.createContext(null);
|
|
541
666
|
function JourneyProvider({
|
|
542
667
|
config: rawConfig,
|
|
@@ -544,6 +669,7 @@ function JourneyProvider({
|
|
|
544
669
|
theme,
|
|
545
670
|
onEvent,
|
|
546
671
|
initialAnswers,
|
|
672
|
+
initialOptions,
|
|
547
673
|
onDiscountCodeApply,
|
|
548
674
|
children
|
|
549
675
|
}) {
|
|
@@ -554,7 +680,14 @@ function JourneyProvider({
|
|
|
554
680
|
React.useEffect(() => {
|
|
555
681
|
onEventRef.current = onEvent;
|
|
556
682
|
}, [onEvent]);
|
|
557
|
-
const
|
|
683
|
+
const normalizedConfig = React.useMemo(
|
|
684
|
+
() => normalizeStepOrder(rawConfig),
|
|
685
|
+
[rawConfig]
|
|
686
|
+
);
|
|
687
|
+
const config = React.useMemo(
|
|
688
|
+
() => applyRuntimeOptionOverrides(normalizedConfig, initialOptions),
|
|
689
|
+
[normalizedConfig, initialOptions]
|
|
690
|
+
);
|
|
558
691
|
const computedVariableIds = React.useMemo(
|
|
559
692
|
() => getComputedVariableIds(config.computedVariables),
|
|
560
693
|
[config.computedVariables]
|
|
@@ -599,8 +732,8 @@ function JourneyProvider({
|
|
|
599
732
|
rawAnswersRef.current = rawAnswers;
|
|
600
733
|
}, [rawAnswers]);
|
|
601
734
|
const allVariables = React.useMemo(
|
|
602
|
-
() =>
|
|
603
|
-
[
|
|
735
|
+
() => normalizedConfig.steps.flatMap(getStepVariables),
|
|
736
|
+
[normalizedConfig.steps]
|
|
604
737
|
);
|
|
605
738
|
const setAnswer = React.useCallback((stepId, answer) => {
|
|
606
739
|
if (computedVariableIds.has(stepId)) return;
|
|
@@ -669,7 +802,7 @@ function JourneyProvider({
|
|
|
669
802
|
const submitted = getSubmittedAnswer(currentStep, latestAnswers);
|
|
670
803
|
(_c = onEventRef.current) == null ? void 0 : _c.call(onEventRef, __spreadProps(__spreadValues({
|
|
671
804
|
type: "step_submit",
|
|
672
|
-
step: currentStep,
|
|
805
|
+
step: stripOptionsFromEventStep(currentStep),
|
|
673
806
|
submitted
|
|
674
807
|
}, eventAnswers), {
|
|
675
808
|
variables: allVariables
|
|
@@ -679,8 +812,8 @@ function JourneyProvider({
|
|
|
679
812
|
navigateToIndex(nextIndex);
|
|
680
813
|
(_d = onEventRef.current) == null ? void 0 : _d.call(onEventRef, __spreadValues({
|
|
681
814
|
type: "navigate",
|
|
682
|
-
from: currentStep,
|
|
683
|
-
to: config.steps[nextIndex],
|
|
815
|
+
from: stripOptionsFromEventStep(currentStep),
|
|
816
|
+
to: stripOptionsFromEventStep(config.steps[nextIndex]),
|
|
684
817
|
direction: "forward"
|
|
685
818
|
}, eventAnswers));
|
|
686
819
|
} else {
|
|
@@ -712,13 +845,18 @@ function JourneyProvider({
|
|
|
712
845
|
navigateToIndex(idx);
|
|
713
846
|
(_a = onEventRef.current) == null ? void 0 : _a.call(onEventRef, __spreadValues({
|
|
714
847
|
type: "navigate",
|
|
715
|
-
from: fromStep,
|
|
716
|
-
to: config.steps[idx],
|
|
848
|
+
from: stripOptionsFromEventStep(fromStep),
|
|
849
|
+
to: stripOptionsFromEventStep(config.steps[idx]),
|
|
717
850
|
direction: idx > currentStepIndex ? "forward" : "backward"
|
|
718
851
|
}, getEventAnswers(config.computedVariables, rawAnswersRef.current)));
|
|
719
852
|
}
|
|
720
853
|
},
|
|
721
|
-
[
|
|
854
|
+
[
|
|
855
|
+
config.computedVariables,
|
|
856
|
+
config.steps,
|
|
857
|
+
currentStepIndex,
|
|
858
|
+
navigateToIndex
|
|
859
|
+
]
|
|
722
860
|
);
|
|
723
861
|
const goBack = React.useCallback(() => {
|
|
724
862
|
var _a;
|
|
@@ -754,8 +892,8 @@ function JourneyProvider({
|
|
|
754
892
|
setDirection(dir);
|
|
755
893
|
(_b2 = onEventRef.current) == null ? void 0 : _b2.call(onEventRef, __spreadValues({
|
|
756
894
|
type: "navigate",
|
|
757
|
-
from: config.steps[prev],
|
|
758
|
-
to: config.steps[step],
|
|
895
|
+
from: stripOptionsFromEventStep(config.steps[prev]),
|
|
896
|
+
to: stripOptionsFromEventStep(config.steps[step]),
|
|
759
897
|
direction: dir
|
|
760
898
|
}, getEventAnswers(config.computedVariables, rawAnswersRef.current)));
|
|
761
899
|
return step;
|
|
@@ -763,7 +901,11 @@ function JourneyProvider({
|
|
|
763
901
|
};
|
|
764
902
|
window.addEventListener("popstate", handlePopState);
|
|
765
903
|
return () => window.removeEventListener("popstate", handlePopState);
|
|
766
|
-
}, [
|
|
904
|
+
}, [
|
|
905
|
+
config.allowBackNavigation,
|
|
906
|
+
config.computedVariables,
|
|
907
|
+
config.steps
|
|
908
|
+
]);
|
|
767
909
|
const getStepAnswer = React.useCallback(
|
|
768
910
|
(stepId) => {
|
|
769
911
|
var _a;
|
|
@@ -783,17 +925,22 @@ function JourneyProvider({
|
|
|
783
925
|
);
|
|
784
926
|
const firePurchaseIntent = React.useCallback(
|
|
785
927
|
(variable, plan, discount) => {
|
|
786
|
-
var _a, _b;
|
|
787
|
-
const currentStep = config.steps[currentStepIndex];
|
|
788
|
-
(
|
|
928
|
+
var _a, _b, _c;
|
|
929
|
+
const currentStep = (_a = normalizedConfig.steps[currentStepIndex]) != null ? _a : config.steps[currentStepIndex];
|
|
930
|
+
(_c = onEventRef.current) == null ? void 0 : _c.call(onEventRef, __spreadValues(__spreadProps(__spreadValues({
|
|
789
931
|
type: "purchase_intent",
|
|
790
932
|
variable,
|
|
791
933
|
plan
|
|
792
934
|
}, discount ? { discount } : {}), {
|
|
793
|
-
stepId: (
|
|
935
|
+
stepId: (_b = currentStep == null ? void 0 : currentStep.id) != null ? _b : ""
|
|
794
936
|
}), getEventAnswers(config.computedVariables, rawAnswersRef.current)));
|
|
795
937
|
},
|
|
796
|
-
[
|
|
938
|
+
[
|
|
939
|
+
config.computedVariables,
|
|
940
|
+
config.steps,
|
|
941
|
+
currentStepIndex,
|
|
942
|
+
normalizedConfig.steps
|
|
943
|
+
]
|
|
797
944
|
);
|
|
798
945
|
const openDiscountCodeDialog = React.useCallback(
|
|
799
946
|
(state2) => {
|
|
@@ -3815,13 +3962,11 @@ function ColumnsBlock({
|
|
|
3815
3962
|
onBack,
|
|
3816
3963
|
onGoToStep
|
|
3817
3964
|
}) {
|
|
3818
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3965
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "jy-columns-container", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3819
3966
|
"div",
|
|
3820
3967
|
{
|
|
3821
|
-
className: cn(
|
|
3822
|
-
|
|
3823
|
-
className
|
|
3824
|
-
),
|
|
3968
|
+
className: cn("jy-columns", className),
|
|
3969
|
+
"data-responsive": responsive ? "true" : "false",
|
|
3825
3970
|
style: { gap: `${gap}rem` },
|
|
3826
3971
|
children: columns.map((col, i) => {
|
|
3827
3972
|
var _a;
|
|
@@ -3849,7 +3994,7 @@ function ColumnsBlock({
|
|
|
3849
3994
|
);
|
|
3850
3995
|
})
|
|
3851
3996
|
}
|
|
3852
|
-
);
|
|
3997
|
+
) });
|
|
3853
3998
|
}
|
|
3854
3999
|
function easeInOutCubic(t) {
|
|
3855
4000
|
return t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2;
|
|
@@ -9301,6 +9446,7 @@ function JourneyRemote({
|
|
|
9301
9446
|
className,
|
|
9302
9447
|
theme,
|
|
9303
9448
|
initialAnswers,
|
|
9449
|
+
initialOptions,
|
|
9304
9450
|
onDiscountCodeApply,
|
|
9305
9451
|
loadingComponent,
|
|
9306
9452
|
errorComponent
|
|
@@ -9320,6 +9466,7 @@ function JourneyRemote({
|
|
|
9320
9466
|
theme,
|
|
9321
9467
|
onEvent,
|
|
9322
9468
|
initialAnswers,
|
|
9469
|
+
initialOptions,
|
|
9323
9470
|
onDiscountCodeApply,
|
|
9324
9471
|
children: /* @__PURE__ */ jsxRuntime.jsx(JourneyShell, { className, theme })
|
|
9325
9472
|
}
|
|
@@ -9336,6 +9483,7 @@ function Journey(props) {
|
|
|
9336
9483
|
className,
|
|
9337
9484
|
theme,
|
|
9338
9485
|
initialAnswers,
|
|
9486
|
+
initialOptions,
|
|
9339
9487
|
onDiscountCodeApply
|
|
9340
9488
|
} = props;
|
|
9341
9489
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -9346,6 +9494,7 @@ function Journey(props) {
|
|
|
9346
9494
|
theme,
|
|
9347
9495
|
onEvent,
|
|
9348
9496
|
initialAnswers,
|
|
9497
|
+
initialOptions,
|
|
9349
9498
|
onDiscountCodeApply,
|
|
9350
9499
|
children: /* @__PURE__ */ jsxRuntime.jsx(JourneyShell, { className, theme })
|
|
9351
9500
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,7 @@ type StepOption = {
|
|
|
11
11
|
/** Optional image URL used in gravity bin physics visualization */
|
|
12
12
|
image?: string;
|
|
13
13
|
};
|
|
14
|
+
type JourneyOptionOverrides = Record<string, StepOption[]>;
|
|
14
15
|
type SwipeCardItem = {
|
|
15
16
|
variable: string;
|
|
16
17
|
text: string;
|
|
@@ -1257,6 +1258,8 @@ type JourneyCommonProps = {
|
|
|
1257
1258
|
theme?: string;
|
|
1258
1259
|
/** Seed answers available at first render. Useful for runtime-injected data (e.g. live pricing plans referenced via `"${pricingPlans}"` templates). Keys declared in `computedVariables` are ignored because formulas own those values. */
|
|
1259
1260
|
initialAnswers?: JourneyAnswers;
|
|
1261
|
+
/** Runtime option lists keyed by answer key (`step.variable ?? step.id`, or select block `props.variable`). Values override inspector-configured options for rendering only. */
|
|
1262
|
+
initialOptions?: JourneyOptionOverrides;
|
|
1260
1263
|
/** Consumer-owned discount validation/repricing callback. Journeys only handles UI/state. */
|
|
1261
1264
|
onDiscountCodeApply?: (request: DiscountCodeApplyRequest) => Promise<DiscountCodeApplyResult> | DiscountCodeApplyResult;
|
|
1262
1265
|
/** Custom loading component shown while fetching config */
|
|
@@ -1343,11 +1346,15 @@ type JourneyProviderProps = {
|
|
|
1343
1346
|
* `computedVariables` are ignored here because formulas own those values. Refreshed prices
|
|
1344
1347
|
* always win over a stale snapshot in storage. */
|
|
1345
1348
|
initialAnswers?: JourneyAnswers;
|
|
1349
|
+
/** Runtime option lists keyed by answer key (`step.variable ?? step.id`, or select block
|
|
1350
|
+
* `props.variable`). These override editor-configured options in the rendered journey only;
|
|
1351
|
+
* they are not persisted in answers. Event step configs omit option arrays. */
|
|
1352
|
+
initialOptions?: JourneyOptionOverrides;
|
|
1346
1353
|
/** Consumer-owned discount validation/repricing callback. Journeys only handles UI/state. */
|
|
1347
1354
|
onDiscountCodeApply?: (request: DiscountCodeApplyRequest) => Promise<DiscountCodeApplyResult> | DiscountCodeApplyResult;
|
|
1348
1355
|
children: ReactNode;
|
|
1349
1356
|
};
|
|
1350
|
-
declare function JourneyProvider({ config: rawConfig, storageKey, theme, onEvent, initialAnswers, onDiscountCodeApply, children, }: JourneyProviderProps): react_jsx_runtime.JSX.Element;
|
|
1357
|
+
declare function JourneyProvider({ config: rawConfig, storageKey, theme, onEvent, initialAnswers, initialOptions, onDiscountCodeApply, children, }: JourneyProviderProps): react_jsx_runtime.JSX.Element;
|
|
1351
1358
|
declare function useJourneyState(): JourneyState;
|
|
1352
1359
|
declare function useJourneyActions(): JourneyActions;
|
|
1353
1360
|
|
|
@@ -1427,4 +1434,4 @@ declare function GravityBin({ items, height, gravity, restitution, friction, ico
|
|
|
1427
1434
|
|
|
1428
1435
|
declare function TimelineBlock({ items, iconPlacement, labelPlacement, nodeSize, lineThickness, itemSpacing, titleDescGap, lineStyle, lineColor, lineOpacity, startLine, endLine, animated, entryAnimation, staggerDelay, className, }: TimelineBlockProps): react_jsx_runtime.JSX.Element;
|
|
1429
1436
|
|
|
1430
|
-
export { type AccordionBlockProps, type AccordionItem, type AnimationPreset, type AppliedDiscountAnswer, type AppliedDiscountPricing, type Arc, type AvatarGroupBlockProps, type AvatarItem, BLOCK_META, type BadgeBlockProps, type BadgeItem, type BadgeVariant, type BeforeAfterBlockProps, type BeforeAfterSide, type BlobConfig, type BlockAnimation, type BlockCondition, type BlockConfig, type BlockExitAnimation, type BlockPropsMap, type BlockType, type ButtonAction, type ButtonBlockProps, type CalloutBlockProps, type CardBlockProps, type CarouselBlockProps, type CarouselSlide, type ChartLine, type ChartLineEndDot, type ChecklistBlockProps, type ChecklistItem, type CircularProgressBlockProps, type ColumnConfig, type ColumnsBlockProps, type ComparisonBar, type ComparisonBarBlockProps, type ComputedVariable, type ContinuousScrollTimelineEvent, type CounterBlockProps, type CounterStyle, type DecoratedTextBlockProps, type DeviceFrameBlockProps, type DiscountCodeApplyRequest, type DiscountCodeApplyResult, DiscountCodeDialog, type DiscountCodeDialogState, type DiscountCodeSummaryLine, type DividerBlockProps, type ExitAnimationPreset, type FeatureRowBlockProps, type FeatureRowIconBg, type FetchState, type FloatingLabelBlockProps, GravityBin, type GravityBinBlockProps, type GravityBinItem, type GravityBinProps, type HeadingBlockProps, type IconBlockProps, type ImageBlockProps, Journey, type JourneyAnswers, type JourneyConfig, JourneyContext, type JourneyEvent, type JourneyEventComputedVariables, type JourneyProps, JourneyProvider, type JourneyProviderProps, JourneyShell, type LineChartBlockProps, type ListBlockProps, type LottieBlockProps, type MediaSlide, type MetricBlockProps, type MetricVariant, type MultiSelectBlockProps, type NavigationDirection, type NotificationColor, type NotificationItem, type NotificationStackBlockProps, type PageLayout, type PauseScrollTimelineEvent, type PricingPlan, type PricingPlanFeature, type PricingPlanPeriod, type PricingPlansBlockProps, type PricingStyle, type ProgressBarBlockProps, type ProgressSegment, type QuoteBlockProps, type QuoteSlide, type RoutingRule, type ScrollTimelineBehavior, type ScrollTimelineEvent, type ScrollToTimelineEvent, SegmentedProgress, type SelectedPlanAnswer, type SingleSelectBlockProps, type SliderStyle, type SpacerBlockProps, type StatBlockProps, type StepAnswer, type StepBackground, type StepComponentProps, type StepConfig, type StepField, type StepOption, StepRenderer, type StepRouting, type StepScrollTimeline, type StepType, type StepValidation, type SwipeCardAlign, type SwipeCardItem, type SwipeIconStyle, type SwipeLabels, type TableBlockProps, type TableCell, type TableColumn, type TableRowLabel, type TextBlockProps, type TextSegment, TimelineBlock, type TimelineBlockProps, type TimelineColor, type TimelineItem, type VideoBlockProps, type WidgetStyle, arePageInputsValid, evaluateCondition, hasVisibleProgress, normalizeStepOrder, resolveComputedVariableValues, resolveComputedVariables, useJourneyActions, useJourneyConfig, useJourneyState };
|
|
1437
|
+
export { type AccordionBlockProps, type AccordionItem, type AnimationPreset, type AppliedDiscountAnswer, type AppliedDiscountPricing, type Arc, type AvatarGroupBlockProps, type AvatarItem, BLOCK_META, type BadgeBlockProps, type BadgeItem, type BadgeVariant, type BeforeAfterBlockProps, type BeforeAfterSide, type BlobConfig, type BlockAnimation, type BlockCondition, type BlockConfig, type BlockExitAnimation, type BlockPropsMap, type BlockType, type ButtonAction, type ButtonBlockProps, type CalloutBlockProps, type CardBlockProps, type CarouselBlockProps, type CarouselSlide, type ChartLine, type ChartLineEndDot, type ChecklistBlockProps, type ChecklistItem, type CircularProgressBlockProps, type ColumnConfig, type ColumnsBlockProps, type ComparisonBar, type ComparisonBarBlockProps, type ComputedVariable, type ContinuousScrollTimelineEvent, type CounterBlockProps, type CounterStyle, type DecoratedTextBlockProps, type DeviceFrameBlockProps, type DiscountCodeApplyRequest, type DiscountCodeApplyResult, DiscountCodeDialog, type DiscountCodeDialogState, type DiscountCodeSummaryLine, type DividerBlockProps, type ExitAnimationPreset, type FeatureRowBlockProps, type FeatureRowIconBg, type FetchState, type FloatingLabelBlockProps, GravityBin, type GravityBinBlockProps, type GravityBinItem, type GravityBinProps, type HeadingBlockProps, type IconBlockProps, type ImageBlockProps, Journey, type JourneyAnswers, type JourneyConfig, JourneyContext, type JourneyEvent, type JourneyEventComputedVariables, type JourneyOptionOverrides, type JourneyProps, JourneyProvider, type JourneyProviderProps, JourneyShell, type LineChartBlockProps, type ListBlockProps, type LottieBlockProps, type MediaSlide, type MetricBlockProps, type MetricVariant, type MultiSelectBlockProps, type NavigationDirection, type NotificationColor, type NotificationItem, type NotificationStackBlockProps, type PageLayout, type PauseScrollTimelineEvent, type PricingPlan, type PricingPlanFeature, type PricingPlanPeriod, type PricingPlansBlockProps, type PricingStyle, type ProgressBarBlockProps, type ProgressSegment, type QuoteBlockProps, type QuoteSlide, type RoutingRule, type ScrollTimelineBehavior, type ScrollTimelineEvent, type ScrollToTimelineEvent, SegmentedProgress, type SelectedPlanAnswer, type SingleSelectBlockProps, type SliderStyle, type SpacerBlockProps, type StatBlockProps, type StepAnswer, type StepBackground, type StepComponentProps, type StepConfig, type StepField, type StepOption, StepRenderer, type StepRouting, type StepScrollTimeline, type StepType, type StepValidation, type SwipeCardAlign, type SwipeCardItem, type SwipeIconStyle, type SwipeLabels, type TableBlockProps, type TableCell, type TableColumn, type TableRowLabel, type TextBlockProps, type TextSegment, TimelineBlock, type TimelineBlockProps, type TimelineColor, type TimelineItem, type VideoBlockProps, type WidgetStyle, arePageInputsValid, evaluateCondition, hasVisibleProgress, normalizeStepOrder, resolveComputedVariableValues, resolveComputedVariables, useJourneyActions, useJourneyConfig, useJourneyState };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ type StepOption = {
|
|
|
11
11
|
/** Optional image URL used in gravity bin physics visualization */
|
|
12
12
|
image?: string;
|
|
13
13
|
};
|
|
14
|
+
type JourneyOptionOverrides = Record<string, StepOption[]>;
|
|
14
15
|
type SwipeCardItem = {
|
|
15
16
|
variable: string;
|
|
16
17
|
text: string;
|
|
@@ -1257,6 +1258,8 @@ type JourneyCommonProps = {
|
|
|
1257
1258
|
theme?: string;
|
|
1258
1259
|
/** Seed answers available at first render. Useful for runtime-injected data (e.g. live pricing plans referenced via `"${pricingPlans}"` templates). Keys declared in `computedVariables` are ignored because formulas own those values. */
|
|
1259
1260
|
initialAnswers?: JourneyAnswers;
|
|
1261
|
+
/** Runtime option lists keyed by answer key (`step.variable ?? step.id`, or select block `props.variable`). Values override inspector-configured options for rendering only. */
|
|
1262
|
+
initialOptions?: JourneyOptionOverrides;
|
|
1260
1263
|
/** Consumer-owned discount validation/repricing callback. Journeys only handles UI/state. */
|
|
1261
1264
|
onDiscountCodeApply?: (request: DiscountCodeApplyRequest) => Promise<DiscountCodeApplyResult> | DiscountCodeApplyResult;
|
|
1262
1265
|
/** Custom loading component shown while fetching config */
|
|
@@ -1343,11 +1346,15 @@ type JourneyProviderProps = {
|
|
|
1343
1346
|
* `computedVariables` are ignored here because formulas own those values. Refreshed prices
|
|
1344
1347
|
* always win over a stale snapshot in storage. */
|
|
1345
1348
|
initialAnswers?: JourneyAnswers;
|
|
1349
|
+
/** Runtime option lists keyed by answer key (`step.variable ?? step.id`, or select block
|
|
1350
|
+
* `props.variable`). These override editor-configured options in the rendered journey only;
|
|
1351
|
+
* they are not persisted in answers. Event step configs omit option arrays. */
|
|
1352
|
+
initialOptions?: JourneyOptionOverrides;
|
|
1346
1353
|
/** Consumer-owned discount validation/repricing callback. Journeys only handles UI/state. */
|
|
1347
1354
|
onDiscountCodeApply?: (request: DiscountCodeApplyRequest) => Promise<DiscountCodeApplyResult> | DiscountCodeApplyResult;
|
|
1348
1355
|
children: ReactNode;
|
|
1349
1356
|
};
|
|
1350
|
-
declare function JourneyProvider({ config: rawConfig, storageKey, theme, onEvent, initialAnswers, onDiscountCodeApply, children, }: JourneyProviderProps): react_jsx_runtime.JSX.Element;
|
|
1357
|
+
declare function JourneyProvider({ config: rawConfig, storageKey, theme, onEvent, initialAnswers, initialOptions, onDiscountCodeApply, children, }: JourneyProviderProps): react_jsx_runtime.JSX.Element;
|
|
1351
1358
|
declare function useJourneyState(): JourneyState;
|
|
1352
1359
|
declare function useJourneyActions(): JourneyActions;
|
|
1353
1360
|
|
|
@@ -1427,4 +1434,4 @@ declare function GravityBin({ items, height, gravity, restitution, friction, ico
|
|
|
1427
1434
|
|
|
1428
1435
|
declare function TimelineBlock({ items, iconPlacement, labelPlacement, nodeSize, lineThickness, itemSpacing, titleDescGap, lineStyle, lineColor, lineOpacity, startLine, endLine, animated, entryAnimation, staggerDelay, className, }: TimelineBlockProps): react_jsx_runtime.JSX.Element;
|
|
1429
1436
|
|
|
1430
|
-
export { type AccordionBlockProps, type AccordionItem, type AnimationPreset, type AppliedDiscountAnswer, type AppliedDiscountPricing, type Arc, type AvatarGroupBlockProps, type AvatarItem, BLOCK_META, type BadgeBlockProps, type BadgeItem, type BadgeVariant, type BeforeAfterBlockProps, type BeforeAfterSide, type BlobConfig, type BlockAnimation, type BlockCondition, type BlockConfig, type BlockExitAnimation, type BlockPropsMap, type BlockType, type ButtonAction, type ButtonBlockProps, type CalloutBlockProps, type CardBlockProps, type CarouselBlockProps, type CarouselSlide, type ChartLine, type ChartLineEndDot, type ChecklistBlockProps, type ChecklistItem, type CircularProgressBlockProps, type ColumnConfig, type ColumnsBlockProps, type ComparisonBar, type ComparisonBarBlockProps, type ComputedVariable, type ContinuousScrollTimelineEvent, type CounterBlockProps, type CounterStyle, type DecoratedTextBlockProps, type DeviceFrameBlockProps, type DiscountCodeApplyRequest, type DiscountCodeApplyResult, DiscountCodeDialog, type DiscountCodeDialogState, type DiscountCodeSummaryLine, type DividerBlockProps, type ExitAnimationPreset, type FeatureRowBlockProps, type FeatureRowIconBg, type FetchState, type FloatingLabelBlockProps, GravityBin, type GravityBinBlockProps, type GravityBinItem, type GravityBinProps, type HeadingBlockProps, type IconBlockProps, type ImageBlockProps, Journey, type JourneyAnswers, type JourneyConfig, JourneyContext, type JourneyEvent, type JourneyEventComputedVariables, type JourneyProps, JourneyProvider, type JourneyProviderProps, JourneyShell, type LineChartBlockProps, type ListBlockProps, type LottieBlockProps, type MediaSlide, type MetricBlockProps, type MetricVariant, type MultiSelectBlockProps, type NavigationDirection, type NotificationColor, type NotificationItem, type NotificationStackBlockProps, type PageLayout, type PauseScrollTimelineEvent, type PricingPlan, type PricingPlanFeature, type PricingPlanPeriod, type PricingPlansBlockProps, type PricingStyle, type ProgressBarBlockProps, type ProgressSegment, type QuoteBlockProps, type QuoteSlide, type RoutingRule, type ScrollTimelineBehavior, type ScrollTimelineEvent, type ScrollToTimelineEvent, SegmentedProgress, type SelectedPlanAnswer, type SingleSelectBlockProps, type SliderStyle, type SpacerBlockProps, type StatBlockProps, type StepAnswer, type StepBackground, type StepComponentProps, type StepConfig, type StepField, type StepOption, StepRenderer, type StepRouting, type StepScrollTimeline, type StepType, type StepValidation, type SwipeCardAlign, type SwipeCardItem, type SwipeIconStyle, type SwipeLabels, type TableBlockProps, type TableCell, type TableColumn, type TableRowLabel, type TextBlockProps, type TextSegment, TimelineBlock, type TimelineBlockProps, type TimelineColor, type TimelineItem, type VideoBlockProps, type WidgetStyle, arePageInputsValid, evaluateCondition, hasVisibleProgress, normalizeStepOrder, resolveComputedVariableValues, resolveComputedVariables, useJourneyActions, useJourneyConfig, useJourneyState };
|
|
1437
|
+
export { type AccordionBlockProps, type AccordionItem, type AnimationPreset, type AppliedDiscountAnswer, type AppliedDiscountPricing, type Arc, type AvatarGroupBlockProps, type AvatarItem, BLOCK_META, type BadgeBlockProps, type BadgeItem, type BadgeVariant, type BeforeAfterBlockProps, type BeforeAfterSide, type BlobConfig, type BlockAnimation, type BlockCondition, type BlockConfig, type BlockExitAnimation, type BlockPropsMap, type BlockType, type ButtonAction, type ButtonBlockProps, type CalloutBlockProps, type CardBlockProps, type CarouselBlockProps, type CarouselSlide, type ChartLine, type ChartLineEndDot, type ChecklistBlockProps, type ChecklistItem, type CircularProgressBlockProps, type ColumnConfig, type ColumnsBlockProps, type ComparisonBar, type ComparisonBarBlockProps, type ComputedVariable, type ContinuousScrollTimelineEvent, type CounterBlockProps, type CounterStyle, type DecoratedTextBlockProps, type DeviceFrameBlockProps, type DiscountCodeApplyRequest, type DiscountCodeApplyResult, DiscountCodeDialog, type DiscountCodeDialogState, type DiscountCodeSummaryLine, type DividerBlockProps, type ExitAnimationPreset, type FeatureRowBlockProps, type FeatureRowIconBg, type FetchState, type FloatingLabelBlockProps, GravityBin, type GravityBinBlockProps, type GravityBinItem, type GravityBinProps, type HeadingBlockProps, type IconBlockProps, type ImageBlockProps, Journey, type JourneyAnswers, type JourneyConfig, JourneyContext, type JourneyEvent, type JourneyEventComputedVariables, type JourneyOptionOverrides, type JourneyProps, JourneyProvider, type JourneyProviderProps, JourneyShell, type LineChartBlockProps, type ListBlockProps, type LottieBlockProps, type MediaSlide, type MetricBlockProps, type MetricVariant, type MultiSelectBlockProps, type NavigationDirection, type NotificationColor, type NotificationItem, type NotificationStackBlockProps, type PageLayout, type PauseScrollTimelineEvent, type PricingPlan, type PricingPlanFeature, type PricingPlanPeriod, type PricingPlansBlockProps, type PricingStyle, type ProgressBarBlockProps, type ProgressSegment, type QuoteBlockProps, type QuoteSlide, type RoutingRule, type ScrollTimelineBehavior, type ScrollTimelineEvent, type ScrollToTimelineEvent, SegmentedProgress, type SelectedPlanAnswer, type SingleSelectBlockProps, type SliderStyle, type SpacerBlockProps, type StatBlockProps, type StepAnswer, type StepBackground, type StepComponentProps, type StepConfig, type StepField, type StepOption, StepRenderer, type StepRouting, type StepScrollTimeline, type StepType, type StepValidation, type SwipeCardAlign, type SwipeCardItem, type SwipeIconStyle, type SwipeLabels, type TableBlockProps, type TableCell, type TableColumn, type TableRowLabel, type TextBlockProps, type TextSegment, TimelineBlock, type TimelineBlockProps, type TimelineColor, type TimelineItem, type VideoBlockProps, type WidgetStyle, arePageInputsValid, evaluateCondition, hasVisibleProgress, normalizeStepOrder, resolveComputedVariableValues, resolveComputedVariables, useJourneyActions, useJourneyConfig, useJourneyState };
|