@funnelsgrove/runtime 0.1.54 → 0.1.55

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.
@@ -189,22 +189,6 @@ export function useFunnelFlowController({ analytics, initialStepId, initialAttri
189
189
  }
190
190
  setActiveStepId(safeStepId);
191
191
  }, [getPathForStep, resolveRenderableStepId, safeInitialStepId, shouldLockToInitialStep]);
192
- useEffect(() => {
193
- if (!activeExperimentForStep ||
194
- renderSuspended ||
195
- shouldLockToInitialStep ||
196
- renderedStepId === safeActiveStepId) {
197
- return;
198
- }
199
- goToStep(renderedStepId);
200
- }, [
201
- activeExperimentForStep,
202
- goToStep,
203
- renderSuspended,
204
- renderedStepId,
205
- safeActiveStepId,
206
- shouldLockToInitialStep,
207
- ]);
208
192
  const setAnswer = useCallback((key, value) => {
209
193
  setAttributes((prev) => (Object.assign(Object.assign({}, prev), { [key]: value })));
210
194
  }, []);
@@ -512,7 +496,7 @@ export function useFunnelFlowController({ analytics, initialStepId, initialAttri
512
496
  safeActiveStepId,
513
497
  safeInitialStepId,
514
498
  ]);
515
- const choiceTargets = getChoiceTargetsForStep(safeActiveStepId);
499
+ const choiceTargets = getChoiceTargetsForStep(renderedStepId);
516
500
  const actionBar = (_a = renderedStepMeta === null || renderedStepMeta === void 0 ? void 0 : renderedStepMeta.actionBar) !== null && _a !== void 0 ? _a : activeStepMeta === null || activeStepMeta === void 0 ? void 0 : activeStepMeta.actionBar;
517
501
  const isAutoAdvanceStep = typeof (actionBar === null || actionBar === void 0 ? void 0 : actionBar.autoAdvanceMs) === 'number';
518
502
  const autoAdvanceMs = actionBar === null || actionBar === void 0 ? void 0 : actionBar.autoAdvanceMs;
@@ -551,12 +535,12 @@ export function useFunnelFlowController({ analytics, initialStepId, initialAttri
551
535
  }, [goToStep, isFunnelStepId]);
552
536
  const goChoice = useCallback((choice, stepId) => {
553
537
  var _a, _b;
554
- const sourceStepId = (_a = resolveRenderableStepId(stepId)) !== null && _a !== void 0 ? _a : safeActiveStepId;
538
+ const sourceStepId = (_a = resolveRenderableStepId(stepId)) !== null && _a !== void 0 ? _a : renderedStepId;
555
539
  setAttributes((prev) => writeStepChoice(prev, sourceStepId, choice));
556
540
  const sourceChoiceTargets = getChoiceTargetsForStep(sourceStepId);
557
541
  const choiceTarget = (_b = resolveRenderableStepId(sourceChoiceTargets === null || sourceChoiceTargets === void 0 ? void 0 : sourceChoiceTargets[choice])) !== null && _b !== void 0 ? _b : resolveNextStepId(sourceStepId);
558
542
  goToStep(choiceTarget);
559
- }, [getChoiceTargetsForStep, goToStep, resolveNextStepId, resolveRenderableStepId, safeActiveStepId]);
543
+ }, [getChoiceTargetsForStep, goToStep, renderedStepId, resolveNextStepId, resolveRenderableStepId]);
560
544
  usePreviewBridge({
561
545
  activeStepId: safeActiveStepId,
562
546
  onGoToStep: goToStepFromContext,
@@ -600,7 +584,7 @@ export function useFunnelFlowController({ analytics, initialStepId, initialAttri
600
584
  return ((_a = experiment.variants[0]) === null || _a === void 0 ? void 0 : _a.variantKey) || '';
601
585
  }, [editorVariantOverrides, postHogReady]);
602
586
  const contextValue = useMemo(() => ({
603
- activeStepId: safeActiveStepId,
587
+ activeStepId: renderedStepId,
604
588
  featureFlags: postHogFeatureFlags,
605
589
  isBuilder: isPreviewRuntime,
606
590
  goToStep: goToStepFromContext,
@@ -608,7 +592,7 @@ export function useFunnelFlowController({ analytics, initialStepId, initialAttri
608
592
  goChoice,
609
593
  getChoiceTargets: (stepId) => {
610
594
  var _a;
611
- const sourceStepId = (_a = resolveRenderableStepId(stepId)) !== null && _a !== void 0 ? _a : safeActiveStepId;
595
+ const sourceStepId = (_a = resolveRenderableStepId(stepId)) !== null && _a !== void 0 ? _a : renderedStepId;
612
596
  return getChoiceTargetsForStep(sourceStepId);
613
597
  },
614
598
  setAnswer,
@@ -630,8 +614,8 @@ export function useFunnelFlowController({ analytics, initialStepId, initialAttri
630
614
  goToStepFromContext,
631
615
  isPreviewRuntime,
632
616
  postHogFeatureFlags,
617
+ renderedStepId,
633
618
  resolveRenderableStepId,
634
- safeActiveStepId,
635
619
  setAnswer,
636
620
  setAttribute,
637
621
  user,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/runtime",
3
- "version": "0.1.54",
3
+ "version": "0.1.55",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",