@funnelsgrove/runtime 0.3.0 → 0.4.0
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.
|
@@ -324,8 +324,7 @@ export function useFunnelFlowController({ api = apiService, analytics, stepContr
|
|
|
324
324
|
const attributesRef = useRef(attributes);
|
|
325
325
|
const postHogFeatureFlagsRef = useRef({});
|
|
326
326
|
const prevStepIdRef = useRef(null);
|
|
327
|
-
const
|
|
328
|
-
const firstStepViewedVisitRef = useRef(null);
|
|
327
|
+
const firstStepViewedTrackedRef = useRef(false);
|
|
329
328
|
const firstStepClickedVisitRef = useRef(null);
|
|
330
329
|
// One controller mount is one funnel run. A full reload intentionally begins a new run.
|
|
331
330
|
const funnelCompletionClaimedRef = useRef(false);
|
|
@@ -968,7 +967,7 @@ export function useFunnelFlowController({ api = apiService, analytics, stepContr
|
|
|
968
967
|
safeActiveStepId,
|
|
969
968
|
]);
|
|
970
969
|
useEffect(() => {
|
|
971
|
-
var _a, _b
|
|
970
|
+
var _a, _b;
|
|
972
971
|
if (safeActiveStepId !== activeStepId) {
|
|
973
972
|
logger.warn(`[FunnelFlow] Unknown or non-renderable step "${activeStepId}", falling back to "${safeActiveStepId}".`);
|
|
974
973
|
claimCurrentVisit({ type: 'exit', reason: 'replace' });
|
|
@@ -1021,10 +1020,10 @@ export function useFunnelFlowController({ api = apiService, analytics, stepContr
|
|
|
1021
1020
|
featureFlags: postHogFeatureFlagsRef.current,
|
|
1022
1021
|
});
|
|
1023
1022
|
if (safeActiveStepId === defaultStepId) {
|
|
1024
|
-
const initialAttribution = takeInitialFunnelAttributionMetadata(
|
|
1025
|
-
|
|
1023
|
+
const initialAttribution = takeInitialFunnelAttributionMetadata(firstStepViewedTrackedRef.current, attributionReady, initialAttributionRef.current);
|
|
1024
|
+
firstStepViewedTrackedRef.current = initialAttribution.tracked;
|
|
1026
1025
|
if (initialAttribution.metadata) {
|
|
1027
|
-
(_b = analytics === null || analytics === void 0 ? void 0 : analytics.
|
|
1026
|
+
(_b = analytics === null || analytics === void 0 ? void 0 : analytics.trackFirstStepViewed) === null || _b === void 0 ? void 0 : _b.call(analytics, {
|
|
1028
1027
|
userId: currentUserIdRef.current,
|
|
1029
1028
|
environment: analyticsRuntimeMode,
|
|
1030
1029
|
stepId: renderedStepId,
|
|
@@ -1036,20 +1035,6 @@ export function useFunnelFlowController({ api = apiService, analytics, stepContr
|
|
|
1036
1035
|
featureFlags: postHogFeatureFlagsRef.current,
|
|
1037
1036
|
});
|
|
1038
1037
|
}
|
|
1039
|
-
if (firstStepViewedVisitRef.current !== startIntent.visit.visitId) {
|
|
1040
|
-
firstStepViewedVisitRef.current = startIntent.visit.visitId;
|
|
1041
|
-
(_c = analytics === null || analytics === void 0 ? void 0 : analytics.trackFirstStepViewed) === null || _c === void 0 ? void 0 : _c.call(analytics, {
|
|
1042
|
-
userId: currentUserIdRef.current,
|
|
1043
|
-
environment: analyticsRuntimeMode,
|
|
1044
|
-
stepId: renderedStepId,
|
|
1045
|
-
stepName,
|
|
1046
|
-
stepType,
|
|
1047
|
-
stepContractVersion,
|
|
1048
|
-
occurredAt: startedAt,
|
|
1049
|
-
metadata: attributionMetadata,
|
|
1050
|
-
featureFlags: postHogFeatureFlagsRef.current,
|
|
1051
|
-
});
|
|
1052
|
-
}
|
|
1053
1038
|
}
|
|
1054
1039
|
}
|
|
1055
1040
|
}, [
|