@flowsterix/react 0.2.1 → 0.3.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.
- package/dist/context.d.ts +9 -9
- package/dist/context.d.ts.map +1 -1
- package/dist/index.cjs +7 -5
- package/dist/index.mjs +7 -5
- package/package.json +2 -2
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BackdropInteractionMode, EventBus, FlowAnalyticsHandlers, FlowCancelReason, FlowDefinition, FlowEvents, FlowState, StartFlowOptions, Step, StorageAdapter, VersionMismatchInfo } from '@flowsterix/core';
|
|
1
|
+
import type { BackdropInteractionMode, EventBus, FlowAnalyticsHandlers, FlowCancelReason, FlowDefinition, FlowEvents, FlowState, MaybePromise, StartFlowOptions, Step, StorageAdapter, VersionMismatchInfo } from '@flowsterix/core';
|
|
2
2
|
import type { Dispatch, PropsWithChildren, ReactNode, SetStateAction } from 'react';
|
|
3
3
|
import type { TourLabels } from './labels';
|
|
4
4
|
import type { AnimationAdapter } from './motion/animationAdapter';
|
|
@@ -32,14 +32,14 @@ export interface TourContextValue {
|
|
|
32
32
|
activeFlowId: string | null;
|
|
33
33
|
state: FlowState | null;
|
|
34
34
|
activeStep: Step<ReactNode> | null;
|
|
35
|
-
startFlow: (flowId: string, options?: StartFlowOptions) => FlowState
|
|
36
|
-
next: () => FlowState
|
|
37
|
-
back: () => FlowState
|
|
38
|
-
goToStep: (step: number | string) => FlowState
|
|
39
|
-
pause: () => FlowState
|
|
40
|
-
resume: () => FlowState
|
|
41
|
-
cancel: (reason?: FlowCancelReason) => FlowState
|
|
42
|
-
complete: () => FlowState
|
|
35
|
+
startFlow: (flowId: string, options?: StartFlowOptions) => MaybePromise<FlowState>;
|
|
36
|
+
next: () => MaybePromise<FlowState>;
|
|
37
|
+
back: () => MaybePromise<FlowState>;
|
|
38
|
+
goToStep: (step: number | string) => MaybePromise<FlowState>;
|
|
39
|
+
pause: () => MaybePromise<FlowState>;
|
|
40
|
+
resume: () => MaybePromise<FlowState>;
|
|
41
|
+
cancel: (reason?: FlowCancelReason) => MaybePromise<FlowState>;
|
|
42
|
+
complete: () => MaybePromise<FlowState>;
|
|
43
43
|
events: EventBus<FlowEvents<ReactNode>> | null;
|
|
44
44
|
debugEnabled: boolean;
|
|
45
45
|
setDebugEnabled: (value: boolean) => void;
|
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,
|
|
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,EACd,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AAOzB,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;AAQjE,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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CAAC,CAAA;IACrC,MAAM,EAAE,CAAC,MAAM,CAAC,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,4CAuftC,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
|
@@ -554,9 +554,10 @@ var TourProvider = ({
|
|
|
554
554
|
} else {
|
|
555
555
|
pendingResumeRef.current.delete(flowId);
|
|
556
556
|
}
|
|
557
|
-
const
|
|
557
|
+
const result = store.start(options);
|
|
558
|
+
const nextState = store.getState();
|
|
558
559
|
if (!options?.resume) {
|
|
559
|
-
return
|
|
560
|
+
return result;
|
|
560
561
|
}
|
|
561
562
|
if (previousState.stepIndex >= 0 && nextState.status === "running") {
|
|
562
563
|
pendingResumeRef.current.delete(flowId);
|
|
@@ -568,7 +569,7 @@ var TourProvider = ({
|
|
|
568
569
|
} else if (nextState.status !== "idle" && nextState.stepIndex <= 0) {
|
|
569
570
|
pendingResumeRef.current.delete(flowId);
|
|
570
571
|
}
|
|
571
|
-
return
|
|
572
|
+
return result;
|
|
572
573
|
},
|
|
573
574
|
[ensureStore, resolveResumeStrategy, runResumeHooks]
|
|
574
575
|
);
|
|
@@ -628,7 +629,8 @@ var TourProvider = ({
|
|
|
628
629
|
if (previousState.status === "paused") {
|
|
629
630
|
pendingResumeRef.current.add(store.definition.id);
|
|
630
631
|
}
|
|
631
|
-
const
|
|
632
|
+
const result = store.resume();
|
|
633
|
+
const nextState = store.getState();
|
|
632
634
|
if (previousState.status === "paused" && nextState.status === "running" && nextState.stepIndex >= 0) {
|
|
633
635
|
pendingResumeRef.current.delete(store.definition.id);
|
|
634
636
|
const resumeStrategy = resolveResumeStrategy(store.definition);
|
|
@@ -637,7 +639,7 @@ var TourProvider = ({
|
|
|
637
639
|
void runResumeHooks(store.definition, nextState, resumeStrategy);
|
|
638
640
|
}
|
|
639
641
|
}
|
|
640
|
-
return
|
|
642
|
+
return result;
|
|
641
643
|
}, [getActiveStore, resolveResumeStrategy, runResumeHooks]);
|
|
642
644
|
const cancel = (0, import_react4.useCallback)(
|
|
643
645
|
(reason) => getActiveStore().cancel(reason),
|
package/dist/index.mjs
CHANGED
|
@@ -406,9 +406,10 @@ var TourProvider = ({
|
|
|
406
406
|
} else {
|
|
407
407
|
pendingResumeRef.current.delete(flowId);
|
|
408
408
|
}
|
|
409
|
-
const
|
|
409
|
+
const result = store.start(options);
|
|
410
|
+
const nextState = store.getState();
|
|
410
411
|
if (!options?.resume) {
|
|
411
|
-
return
|
|
412
|
+
return result;
|
|
412
413
|
}
|
|
413
414
|
if (previousState.stepIndex >= 0 && nextState.status === "running") {
|
|
414
415
|
pendingResumeRef.current.delete(flowId);
|
|
@@ -420,7 +421,7 @@ var TourProvider = ({
|
|
|
420
421
|
} else if (nextState.status !== "idle" && nextState.stepIndex <= 0) {
|
|
421
422
|
pendingResumeRef.current.delete(flowId);
|
|
422
423
|
}
|
|
423
|
-
return
|
|
424
|
+
return result;
|
|
424
425
|
},
|
|
425
426
|
[ensureStore, resolveResumeStrategy, runResumeHooks]
|
|
426
427
|
);
|
|
@@ -480,7 +481,8 @@ var TourProvider = ({
|
|
|
480
481
|
if (previousState.status === "paused") {
|
|
481
482
|
pendingResumeRef.current.add(store.definition.id);
|
|
482
483
|
}
|
|
483
|
-
const
|
|
484
|
+
const result = store.resume();
|
|
485
|
+
const nextState = store.getState();
|
|
484
486
|
if (previousState.status === "paused" && nextState.status === "running" && nextState.stepIndex >= 0) {
|
|
485
487
|
pendingResumeRef.current.delete(store.definition.id);
|
|
486
488
|
const resumeStrategy = resolveResumeStrategy(store.definition);
|
|
@@ -489,7 +491,7 @@ var TourProvider = ({
|
|
|
489
491
|
void runResumeHooks(store.definition, nextState, resumeStrategy);
|
|
490
492
|
}
|
|
491
493
|
}
|
|
492
|
-
return
|
|
494
|
+
return result;
|
|
493
495
|
}, [getActiveStore, resolveResumeStrategy, runResumeHooks]);
|
|
494
496
|
const cancel = useCallback(
|
|
495
497
|
(reason) => getActiveStore().cancel(reason),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowsterix/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React bindings for Flowsterix - guided tours and onboarding flows",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@floating-ui/dom": "^1.7.4",
|
|
67
|
-
"@flowsterix/core": "0.
|
|
67
|
+
"@flowsterix/core": "0.3.0"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"react": ">=18",
|