@flowsterix/react 0.10.1 → 0.11.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/chunk-AJZMUYBN.mjs +21 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/devtools/DevToolsContext.d.ts +31 -0
- package/dist/devtools/DevToolsContext.d.ts.map +1 -0
- package/dist/devtools/DevToolsProvider.d.ts +9 -0
- package/dist/devtools/DevToolsProvider.d.ts.map +1 -0
- package/dist/devtools/components/FlowEditModal.d.ts +11 -0
- package/dist/devtools/components/FlowEditModal.d.ts.map +1 -0
- package/dist/devtools/components/FlowItem.d.ts +8 -0
- package/dist/devtools/components/FlowItem.d.ts.map +1 -0
- package/dist/devtools/components/FlowsTab.d.ts +5 -0
- package/dist/devtools/components/FlowsTab.d.ts.map +1 -0
- package/dist/devtools/components/GrabberOverlay.d.ts +8 -0
- package/dist/devtools/components/GrabberOverlay.d.ts.map +1 -0
- package/dist/devtools/components/ShadowRoot.d.ts +7 -0
- package/dist/devtools/components/ShadowRoot.d.ts.map +1 -0
- package/dist/devtools/components/StepItem.d.ts +16 -0
- package/dist/devtools/components/StepItem.d.ts.map +1 -0
- package/dist/devtools/components/StepList.d.ts +17 -0
- package/dist/devtools/components/StepList.d.ts.map +1 -0
- package/dist/devtools/components/TabNav.d.ts +9 -0
- package/dist/devtools/components/TabNav.d.ts.map +1 -0
- package/dist/devtools/components/Toolbar.d.ts +11 -0
- package/dist/devtools/components/Toolbar.d.ts.map +1 -0
- package/dist/devtools/hooks/useElementInfo.d.ts +7 -0
- package/dist/devtools/hooks/useElementInfo.d.ts.map +1 -0
- package/dist/devtools/hooks/useFlowsData.d.ts +16 -0
- package/dist/devtools/hooks/useFlowsData.d.ts.map +1 -0
- package/dist/devtools/hooks/useGrabMode.d.ts +16 -0
- package/dist/devtools/hooks/useGrabMode.d.ts.map +1 -0
- package/dist/devtools/hooks/useStepStore.d.ts +22 -0
- package/dist/devtools/hooks/useStepStore.d.ts.map +1 -0
- package/dist/devtools/index.cjs +2736 -0
- package/dist/devtools/index.d.ts +32 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.mjs +2684 -0
- package/dist/devtools/types.d.ts +66 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools/utils/selectorGenerator.d.ts +11 -0
- package/dist/devtools/utils/selectorGenerator.d.ts.map +1 -0
- package/dist/devtools/utils/sourceExtractor.d.ts +45 -0
- package/dist/devtools/utils/sourceExtractor.d.ts.map +1 -0
- package/dist/devtools/utils/storage.d.ts +5 -0
- package/dist/devtools/utils/storage.d.ts.map +1 -0
- package/dist/index.cjs +287 -229
- package/dist/index.mjs +62 -7
- package/package.json +10 -1
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DevToolsContext
|
|
3
|
+
} from "./chunk-AJZMUYBN.mjs";
|
|
1
4
|
import "./chunk-Y5EAQSU3.mjs";
|
|
2
5
|
import {
|
|
3
6
|
createPathString,
|
|
@@ -432,9 +435,9 @@ var TourProvider = ({
|
|
|
432
435
|
if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
|
|
433
436
|
fallbackStorageRef.current = createLocalStorageAdapter();
|
|
434
437
|
}
|
|
435
|
-
const
|
|
438
|
+
const resolvedStorageAdapter2 = storageAdapter ? storageAdapter : fallbackStorageRef.current;
|
|
436
439
|
const store = createFlowStore(definition, {
|
|
437
|
-
storageAdapter:
|
|
440
|
+
storageAdapter: resolvedStorageAdapter2,
|
|
438
441
|
storageKey: storageNamespace ? `${storageNamespace}:${definition.id}` : void 0,
|
|
439
442
|
persistOnChange,
|
|
440
443
|
analytics,
|
|
@@ -588,8 +591,8 @@ var TourProvider = ({
|
|
|
588
591
|
if (!storageAdapter && !fallbackStorageRef.current && isBrowser) {
|
|
589
592
|
fallbackStorageRef.current = createLocalStorageAdapter();
|
|
590
593
|
}
|
|
591
|
-
const
|
|
592
|
-
if (!
|
|
594
|
+
const resolvedStorageAdapter2 = storageAdapter ?? fallbackStorageRef.current;
|
|
595
|
+
if (!resolvedStorageAdapter2) {
|
|
593
596
|
setEligibleFlows(
|
|
594
597
|
autoStartFlows.map((flow) => ({
|
|
595
598
|
flow,
|
|
@@ -606,7 +609,7 @@ var TourProvider = ({
|
|
|
606
609
|
);
|
|
607
610
|
const snapshots = await Promise.all(
|
|
608
611
|
storageKeys.map(
|
|
609
|
-
(key) => resolveMaybePromise(
|
|
612
|
+
(key) => resolveMaybePromise(resolvedStorageAdapter2.get(key))
|
|
610
613
|
)
|
|
611
614
|
);
|
|
612
615
|
if (cancelled) return;
|
|
@@ -797,7 +800,59 @@ var TourProvider = ({
|
|
|
797
800
|
reducedMotionAdapter,
|
|
798
801
|
enabled: autoDetectReducedMotion
|
|
799
802
|
});
|
|
800
|
-
|
|
803
|
+
const resolvedStorageAdapter = useMemo3(() => {
|
|
804
|
+
if (storageAdapter) return storageAdapter;
|
|
805
|
+
return fallbackStorageRef.current ?? null;
|
|
806
|
+
}, [storageAdapter]);
|
|
807
|
+
const devToolsContextValue = useMemo3(() => {
|
|
808
|
+
const getStorageKey = (flowId) => storageNamespace ? `${storageNamespace}:${flowId}` : `${DEFAULT_STORAGE_PREFIX}:${flowId}`;
|
|
809
|
+
return {
|
|
810
|
+
flows: flowMap,
|
|
811
|
+
activeFlowId,
|
|
812
|
+
state,
|
|
813
|
+
storageAdapter: resolvedStorageAdapter,
|
|
814
|
+
storageNamespace: storageNamespace ?? DEFAULT_STORAGE_PREFIX,
|
|
815
|
+
cancelFlow: (flowId) => {
|
|
816
|
+
if (activeFlowId === flowId && storeRef.current) {
|
|
817
|
+
storeRef.current.cancel();
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
deleteFlowStorage: async (flowId) => {
|
|
821
|
+
if (!resolvedStorageAdapter) return;
|
|
822
|
+
const key = getStorageKey(flowId);
|
|
823
|
+
await resolveMaybePromise(resolvedStorageAdapter.remove(key));
|
|
824
|
+
},
|
|
825
|
+
updateFlowStorage: async (flowId, newState) => {
|
|
826
|
+
if (!resolvedStorageAdapter) return;
|
|
827
|
+
const key = getStorageKey(flowId);
|
|
828
|
+
const definition = flowMap.get(flowId);
|
|
829
|
+
if (!definition) return;
|
|
830
|
+
await resolveMaybePromise(
|
|
831
|
+
resolvedStorageAdapter.set(key, {
|
|
832
|
+
version: newState.version,
|
|
833
|
+
value: newState,
|
|
834
|
+
updatedAt: Date.now()
|
|
835
|
+
})
|
|
836
|
+
);
|
|
837
|
+
},
|
|
838
|
+
getFlowState: async (flowId) => {
|
|
839
|
+
if (!resolvedStorageAdapter) return null;
|
|
840
|
+
const key = getStorageKey(flowId);
|
|
841
|
+
const snapshot = await resolveMaybePromise(
|
|
842
|
+
resolvedStorageAdapter.get(key)
|
|
843
|
+
);
|
|
844
|
+
if (!snapshot) return null;
|
|
845
|
+
return snapshot.value;
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
}, [
|
|
849
|
+
flowMap,
|
|
850
|
+
activeFlowId,
|
|
851
|
+
state,
|
|
852
|
+
resolvedStorageAdapter,
|
|
853
|
+
storageNamespace
|
|
854
|
+
]);
|
|
855
|
+
return /* @__PURE__ */ jsx3(AnimationAdapterProvider, { adapter: resolvedAnimationAdapter, children: /* @__PURE__ */ jsx3(LabelsProvider, { value: mergedLabels, children: /* @__PURE__ */ jsx3(DialogRegistryProvider, { children: /* @__PURE__ */ jsx3(TourContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(DevToolsContext.Provider, { value: devToolsContextValue, children: [
|
|
801
856
|
/* @__PURE__ */ jsx3(
|
|
802
857
|
DialogAutomationBridge,
|
|
803
858
|
{
|
|
@@ -807,7 +862,7 @@ var TourProvider = ({
|
|
|
807
862
|
}
|
|
808
863
|
),
|
|
809
864
|
children
|
|
810
|
-
] }) }) }) });
|
|
865
|
+
] }) }) }) }) });
|
|
811
866
|
};
|
|
812
867
|
var DialogAutomationBridge = ({
|
|
813
868
|
flow,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowsterix/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "React bindings for Flowsterix - guided tours and onboarding flows",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -57,12 +57,21 @@
|
|
|
57
57
|
"import": "./dist/router/nextPagesRouterAdapter.mjs",
|
|
58
58
|
"require": "./dist/router/nextPagesRouterAdapter.cjs",
|
|
59
59
|
"default": "./dist/router/nextPagesRouterAdapter.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./devtools": {
|
|
62
|
+
"types": "./dist/devtools/index.d.ts",
|
|
63
|
+
"import": "./dist/devtools/index.mjs",
|
|
64
|
+
"require": "./dist/devtools/index.cjs",
|
|
65
|
+
"default": "./dist/devtools/index.mjs"
|
|
60
66
|
}
|
|
61
67
|
},
|
|
62
68
|
"files": [
|
|
63
69
|
"dist"
|
|
64
70
|
],
|
|
65
71
|
"dependencies": {
|
|
72
|
+
"@dnd-kit/core": "^6.3.1",
|
|
73
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
74
|
+
"@dnd-kit/utilities": "^3.2.2",
|
|
66
75
|
"@floating-ui/dom": "^1.7.4",
|
|
67
76
|
"@flowsterix/core": "0.10.0"
|
|
68
77
|
},
|