@flowsterix/react 0.4.0 → 0.4.1
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/context.d.ts.map +1 -1
- package/dist/index.cjs +34 -33
- package/dist/index.mjs +34 -33
- package/package.json +1 -1
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,SAAS,EAET,YAAY,EAEZ,gBAAgB,EAChB,IAAI,EACJ,cAAc,EAEd,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AAUzB,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,cAAc,EACf,MAAM,OAAO,CAAA;AAUd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAajE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAA;IACvC,QAAQ,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,oBAAoB,CAAC,EAAE,gBAAg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C,EAAE,gBAAgB,KAAK,YAAY,CAAC,SAAS,CAAC,CAAA;IAC9D,QAAQ,EAAE,MAAM,YAAY,CAAC,SAAS,CAAC,CAAA;IACvC,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAA;IAC9C,YAAY,EAAE,OAAO,CAAA;IACrB,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IACzC,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAClC,gBAAgB;IAChB,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC,CAAA;IAC/D,mBAAmB,EAAE,uBAAuB,CAAA;IAC5C,cAAc,EAAE,OAAO,CAAA;CACxB;AAeD,eAAO,MAAM,YAAY,GAAI,kTAe1B,iBAAiB,CAAC,iBAAiB,CAAC,4CAwkBtC,CAAA;AAED,eAAO,MAAM,OAAO,QAAO,gBAM1B,CAAA;AAED,eAAO,MAAM,aAAa,GACxB,SAAS,SAAS,OAAO,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,EAE9D,OAAO,SAAS,EAChB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,KAAK,IAAI,SAQ7D,CAAA"}
|
package/dist/index.cjs
CHANGED
|
@@ -473,7 +473,6 @@ var TourProvider = ({
|
|
|
473
473
|
);
|
|
474
474
|
const [debugEnabled, setDebugEnabled] = (0, import_react4.useState)(defaultDebug);
|
|
475
475
|
const [delayInfo, setDelayInfo] = (0, import_react4.useState)(null);
|
|
476
|
-
const [eligibleAutoStart, setEligibleAutoStart] = (0, import_react4.useState)(null);
|
|
477
476
|
const teardownStore = (0, import_react4.useCallback)(() => {
|
|
478
477
|
unsubscribeRef.current?.();
|
|
479
478
|
unsubscribeRef.current = null;
|
|
@@ -506,8 +505,7 @@ var TourProvider = ({
|
|
|
506
505
|
if (!hook) return;
|
|
507
506
|
try {
|
|
508
507
|
const result = hook(context);
|
|
509
|
-
if (
|
|
510
|
-
;
|
|
508
|
+
if (result instanceof Promise) {
|
|
511
509
|
result.catch((error) => {
|
|
512
510
|
console.warn(`[tour][step] ${phase} hook rejected`, error);
|
|
513
511
|
});
|
|
@@ -676,10 +674,11 @@ var TourProvider = ({
|
|
|
676
674
|
},
|
|
677
675
|
[ensureStore, resolveResumeStrategy, runResumeHooks]
|
|
678
676
|
);
|
|
677
|
+
const [eligibleFlows, setEligibleFlows] = (0, import_react4.useState)([]);
|
|
679
678
|
(0, import_react4.useEffect)(() => {
|
|
680
679
|
const autoStartFlows = flows.filter((f) => f.autoStart);
|
|
681
680
|
if (autoStartFlows.length === 0) {
|
|
682
|
-
|
|
681
|
+
setEligibleFlows([]);
|
|
683
682
|
return;
|
|
684
683
|
}
|
|
685
684
|
if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
|
|
@@ -687,11 +686,13 @@ var TourProvider = ({
|
|
|
687
686
|
}
|
|
688
687
|
const resolvedStorageAdapter = storageAdapter ?? fallbackStorageRef.current;
|
|
689
688
|
if (!resolvedStorageAdapter) {
|
|
690
|
-
|
|
691
|
-
flow
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
689
|
+
setEligibleFlows(
|
|
690
|
+
autoStartFlows.map((flow) => ({
|
|
691
|
+
flow,
|
|
692
|
+
resolvedState: null,
|
|
693
|
+
stepIndex: 0
|
|
694
|
+
}))
|
|
695
|
+
);
|
|
695
696
|
return;
|
|
696
697
|
}
|
|
697
698
|
let cancelled = false;
|
|
@@ -705,12 +706,13 @@ var TourProvider = ({
|
|
|
705
706
|
)
|
|
706
707
|
);
|
|
707
708
|
if (cancelled) return;
|
|
709
|
+
const eligible = [];
|
|
708
710
|
for (let i = 0; i < autoStartFlows.length; i++) {
|
|
709
711
|
const flow = autoStartFlows[i];
|
|
710
712
|
const snapshot = snapshots[i];
|
|
711
713
|
if (!snapshot) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
+
eligible.push({ flow, resolvedState: null, stepIndex: 0 });
|
|
715
|
+
continue;
|
|
714
716
|
}
|
|
715
717
|
const storedVersionStr = typeof snapshot.version === "number" ? (0, import_core.serializeVersion)({ major: snapshot.version, minor: 0 }) : snapshot.version;
|
|
716
718
|
const storedVersion = (0, import_core.parseVersion)(storedVersionStr);
|
|
@@ -728,10 +730,9 @@ var TourProvider = ({
|
|
|
728
730
|
continue;
|
|
729
731
|
}
|
|
730
732
|
const stepIndex = Math.max(0, resolvedState.stepIndex);
|
|
731
|
-
|
|
732
|
-
return;
|
|
733
|
+
eligible.push({ flow, resolvedState, stepIndex });
|
|
733
734
|
}
|
|
734
|
-
|
|
735
|
+
setEligibleFlows(eligible);
|
|
735
736
|
};
|
|
736
737
|
void findEligible();
|
|
737
738
|
return () => {
|
|
@@ -739,32 +740,32 @@ var TourProvider = ({
|
|
|
739
740
|
};
|
|
740
741
|
}, [flows, storageAdapter, storageNamespace]);
|
|
741
742
|
(0, import_react4.useEffect)(() => {
|
|
742
|
-
if (
|
|
743
|
+
if (eligibleFlows.length === 0) {
|
|
743
744
|
autoStartRequestedRef.current = null;
|
|
744
745
|
return;
|
|
745
746
|
}
|
|
746
747
|
if (activeFlowId) return;
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
autoStartRequestedRef.current = flow.id;
|
|
758
|
-
startFlow(flow.id, { resume: true });
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
const unsubscribe = subscribeToRouteChanges((path) => {
|
|
748
|
+
const findMatchingFlow = (path) => {
|
|
749
|
+
for (const { flow, stepIndex } of eligibleFlows) {
|
|
750
|
+
const step = flow.steps[stepIndex];
|
|
751
|
+
if (!step.route || matchRoute({ pattern: step.route, path })) {
|
|
752
|
+
return flow;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return null;
|
|
756
|
+
};
|
|
757
|
+
const tryStart = (path) => {
|
|
762
758
|
if (activeFlowId) return;
|
|
763
|
-
|
|
764
|
-
if (
|
|
759
|
+
const flow = findMatchingFlow(path);
|
|
760
|
+
if (flow && autoStartRequestedRef.current !== flow.id) {
|
|
765
761
|
autoStartRequestedRef.current = flow.id;
|
|
766
762
|
startFlow(flow.id, { resume: true });
|
|
767
763
|
}
|
|
764
|
+
};
|
|
765
|
+
const currentPath = getCurrentRoutePath();
|
|
766
|
+
tryStart(currentPath);
|
|
767
|
+
const unsubscribe = subscribeToRouteChanges((path) => {
|
|
768
|
+
tryStart(path);
|
|
768
769
|
});
|
|
769
770
|
return () => {
|
|
770
771
|
unsubscribe();
|
|
@@ -772,7 +773,7 @@ var TourProvider = ({
|
|
|
772
773
|
autoStartRequestedRef.current = null;
|
|
773
774
|
}
|
|
774
775
|
};
|
|
775
|
-
}, [activeFlowId,
|
|
776
|
+
}, [activeFlowId, eligibleFlows, startFlow]);
|
|
776
777
|
const next = (0, import_react4.useCallback)(() => getActiveStore().next(), [getActiveStore]);
|
|
777
778
|
const back = (0, import_react4.useCallback)(() => getActiveStore().back(), [getActiveStore]);
|
|
778
779
|
const goToStep = (0, import_react4.useCallback)(
|
package/dist/index.mjs
CHANGED
|
@@ -214,7 +214,6 @@ var TourProvider = ({
|
|
|
214
214
|
);
|
|
215
215
|
const [debugEnabled, setDebugEnabled] = useState2(defaultDebug);
|
|
216
216
|
const [delayInfo, setDelayInfo] = useState2(null);
|
|
217
|
-
const [eligibleAutoStart, setEligibleAutoStart] = useState2(null);
|
|
218
217
|
const teardownStore = useCallback(() => {
|
|
219
218
|
unsubscribeRef.current?.();
|
|
220
219
|
unsubscribeRef.current = null;
|
|
@@ -247,8 +246,7 @@ var TourProvider = ({
|
|
|
247
246
|
if (!hook) return;
|
|
248
247
|
try {
|
|
249
248
|
const result = hook(context);
|
|
250
|
-
if (
|
|
251
|
-
;
|
|
249
|
+
if (result instanceof Promise) {
|
|
252
250
|
result.catch((error) => {
|
|
253
251
|
console.warn(`[tour][step] ${phase} hook rejected`, error);
|
|
254
252
|
});
|
|
@@ -417,10 +415,11 @@ var TourProvider = ({
|
|
|
417
415
|
},
|
|
418
416
|
[ensureStore, resolveResumeStrategy, runResumeHooks]
|
|
419
417
|
);
|
|
418
|
+
const [eligibleFlows, setEligibleFlows] = useState2([]);
|
|
420
419
|
useEffect2(() => {
|
|
421
420
|
const autoStartFlows = flows.filter((f) => f.autoStart);
|
|
422
421
|
if (autoStartFlows.length === 0) {
|
|
423
|
-
|
|
422
|
+
setEligibleFlows([]);
|
|
424
423
|
return;
|
|
425
424
|
}
|
|
426
425
|
if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
|
|
@@ -428,11 +427,13 @@ var TourProvider = ({
|
|
|
428
427
|
}
|
|
429
428
|
const resolvedStorageAdapter = storageAdapter ?? fallbackStorageRef.current;
|
|
430
429
|
if (!resolvedStorageAdapter) {
|
|
431
|
-
|
|
432
|
-
flow
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
430
|
+
setEligibleFlows(
|
|
431
|
+
autoStartFlows.map((flow) => ({
|
|
432
|
+
flow,
|
|
433
|
+
resolvedState: null,
|
|
434
|
+
stepIndex: 0
|
|
435
|
+
}))
|
|
436
|
+
);
|
|
436
437
|
return;
|
|
437
438
|
}
|
|
438
439
|
let cancelled = false;
|
|
@@ -446,12 +447,13 @@ var TourProvider = ({
|
|
|
446
447
|
)
|
|
447
448
|
);
|
|
448
449
|
if (cancelled) return;
|
|
450
|
+
const eligible = [];
|
|
449
451
|
for (let i = 0; i < autoStartFlows.length; i++) {
|
|
450
452
|
const flow = autoStartFlows[i];
|
|
451
453
|
const snapshot = snapshots[i];
|
|
452
454
|
if (!snapshot) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
+
eligible.push({ flow, resolvedState: null, stepIndex: 0 });
|
|
456
|
+
continue;
|
|
455
457
|
}
|
|
456
458
|
const storedVersionStr = typeof snapshot.version === "number" ? serializeVersion({ major: snapshot.version, minor: 0 }) : snapshot.version;
|
|
457
459
|
const storedVersion = parseVersion(storedVersionStr);
|
|
@@ -469,10 +471,9 @@ var TourProvider = ({
|
|
|
469
471
|
continue;
|
|
470
472
|
}
|
|
471
473
|
const stepIndex = Math.max(0, resolvedState.stepIndex);
|
|
472
|
-
|
|
473
|
-
return;
|
|
474
|
+
eligible.push({ flow, resolvedState, stepIndex });
|
|
474
475
|
}
|
|
475
|
-
|
|
476
|
+
setEligibleFlows(eligible);
|
|
476
477
|
};
|
|
477
478
|
void findEligible();
|
|
478
479
|
return () => {
|
|
@@ -480,32 +481,32 @@ var TourProvider = ({
|
|
|
480
481
|
};
|
|
481
482
|
}, [flows, storageAdapter, storageNamespace]);
|
|
482
483
|
useEffect2(() => {
|
|
483
|
-
if (
|
|
484
|
+
if (eligibleFlows.length === 0) {
|
|
484
485
|
autoStartRequestedRef.current = null;
|
|
485
486
|
return;
|
|
486
487
|
}
|
|
487
488
|
if (activeFlowId) return;
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
autoStartRequestedRef.current = flow.id;
|
|
499
|
-
startFlow(flow.id, { resume: true });
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
const unsubscribe = subscribeToRouteChanges((path) => {
|
|
489
|
+
const findMatchingFlow = (path) => {
|
|
490
|
+
for (const { flow, stepIndex } of eligibleFlows) {
|
|
491
|
+
const step = flow.steps[stepIndex];
|
|
492
|
+
if (!step.route || matchRoute({ pattern: step.route, path })) {
|
|
493
|
+
return flow;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
return null;
|
|
497
|
+
};
|
|
498
|
+
const tryStart = (path) => {
|
|
503
499
|
if (activeFlowId) return;
|
|
504
|
-
|
|
505
|
-
if (
|
|
500
|
+
const flow = findMatchingFlow(path);
|
|
501
|
+
if (flow && autoStartRequestedRef.current !== flow.id) {
|
|
506
502
|
autoStartRequestedRef.current = flow.id;
|
|
507
503
|
startFlow(flow.id, { resume: true });
|
|
508
504
|
}
|
|
505
|
+
};
|
|
506
|
+
const currentPath = getCurrentRoutePath();
|
|
507
|
+
tryStart(currentPath);
|
|
508
|
+
const unsubscribe = subscribeToRouteChanges((path) => {
|
|
509
|
+
tryStart(path);
|
|
509
510
|
});
|
|
510
511
|
return () => {
|
|
511
512
|
unsubscribe();
|
|
@@ -513,7 +514,7 @@ var TourProvider = ({
|
|
|
513
514
|
autoStartRequestedRef.current = null;
|
|
514
515
|
}
|
|
515
516
|
};
|
|
516
|
-
}, [activeFlowId,
|
|
517
|
+
}, [activeFlowId, eligibleFlows, startFlow]);
|
|
517
518
|
const next = useCallback(() => getActiveStore().next(), [getActiveStore]);
|
|
518
519
|
const back = useCallback(() => getActiveStore().back(), [getActiveStore]);
|
|
519
520
|
const goToStep = useCallback(
|