@rxova/journey-react 0.1.0 → 0.2.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/README.md +2 -2
- package/dist/JourneyStepRenderer.d.ts +3 -0
- package/dist/JourneyStepRenderer.d.ts.map +1 -1
- package/dist/context.d.ts +4 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/hooks.d.ts +11 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.cts +5 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -5
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ import React from "react";
|
|
|
18
18
|
import {
|
|
19
19
|
JOURNEY_TERMINAL,
|
|
20
20
|
type JourneyReactDefinition,
|
|
21
|
-
useJourney,
|
|
22
21
|
JourneyProvider,
|
|
23
|
-
JourneyStepRenderer
|
|
22
|
+
JourneyStepRenderer,
|
|
23
|
+
useJourney
|
|
24
24
|
} from "@rxova/journey-react";
|
|
25
25
|
|
|
26
26
|
type StepId = "one" | "two" | "three";
|
|
@@ -2,6 +2,9 @@ import React from "react";
|
|
|
2
2
|
type JourneyStepRendererProps = {
|
|
3
3
|
fallback?: React.ReactNode;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Renders the active step component from the journey definition.
|
|
7
|
+
*/
|
|
5
8
|
export declare const JourneyStepRenderer: <TContext, TStepId extends string, TCustomEvent extends string = never>({ fallback }: JourneyStepRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
9
|
export {};
|
|
7
10
|
//# sourceMappingURL=JourneyStepRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JourneyStepRenderer.d.ts","sourceRoot":"","sources":["../src/JourneyStepRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,GAAG,KAAK,EACnC,cAEC,wBAAwB,4CAW1B,CAAC"}
|
|
1
|
+
{"version":3,"file":"JourneyStepRenderer.d.ts","sourceRoot":"","sources":["../src/JourneyStepRenderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,wBAAwB,GAAG;IAC9B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,GAAG,KAAK,EACnC,cAEC,wBAAwB,4CAW1B,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { JourneyProviderProps, JourneyReactEventPayloadMap, JourneyStoreValue } from "./types";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* React provider that supplies the journey machine and definition to hooks.
|
|
4
|
+
*/
|
|
5
|
+
export declare const JourneyProvider: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>>({ journey, machine, persistence, history, resetOnJourneyChange, children }: JourneyProviderProps<TContext, TStepId, TCustomEvent, TEventPayloadMap>) => import("react/jsx-runtime").JSX.Element;
|
|
3
6
|
export declare const useJourneyStore: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>>(hookName?: string) => JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap>;
|
|
4
7
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AASpG,eAAO,MAAM,eAAe,GAC1B,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,GAAG,KAAK,EACnC,gBAAgB,SAAS,2BAA2B,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACzF,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AASpG;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,GAAG,KAAK,EACnC,gBAAgB,SAAS,2BAA2B,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EACzF,4EAOC,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,CAAC,4CA+CzE,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,GAAG,KAAK,EACnC,gBAAgB,SAAS,2BAA2B,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAEzF,iBAAuB,KACtB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,CAOrE,CAAC"}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { JOURNEY_EVENT } from "@rxova/journey-core";
|
|
2
2
|
import type { JourneyEvent, JourneyPayloadFor, JourneySnapshot } from "@rxova/journey-core";
|
|
3
3
|
import type { JourneyEventType, JourneyHookResult, JourneyReactEventPayloadMap } from "./types";
|
|
4
|
+
/**
|
|
5
|
+
* Reads the current journey snapshot and re-renders on changes.
|
|
6
|
+
*/
|
|
4
7
|
export declare const useJourneySnapshot: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>>() => JourneySnapshot<TContext, TStepId>;
|
|
8
|
+
/**
|
|
9
|
+
* Returns imperative journey actions (send, goTo, next, back, close, submit).
|
|
10
|
+
*/
|
|
5
11
|
export declare const useJourneyApi: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>>() => {
|
|
6
12
|
send: (event: JourneyEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>) => Promise<void>;
|
|
7
13
|
goTo: (stepId: TStepId, payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, (typeof JOURNEY_EVENT)["GO_TO"]>) => Promise<void>;
|
|
@@ -12,6 +18,11 @@ export declare const useJourneyApi: <TContext, TStepId extends string, TCustomEv
|
|
|
12
18
|
clearStepError: (stepId?: TStepId) => void;
|
|
13
19
|
updateContext: (updater: (context: TContext) => TContext) => void;
|
|
14
20
|
reset: () => void;
|
|
21
|
+
trimHistory: (maxHistory?: number | null) => void;
|
|
22
|
+
clearHistory: () => void;
|
|
15
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Combined hook that returns both snapshot and API helpers.
|
|
26
|
+
*/
|
|
16
27
|
export declare const useJourney: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>>() => JourneyHookResult<TContext, TStepId, TCustomEvent, TEventPayloadMap>;
|
|
17
28
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE5F,OAAO,KAAK,EAEV,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAejB,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE5F,OAAO,KAAK,EAEV,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AAejB;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAf7B,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,UAC3B,gBAAgB,SAAS,2BAA2B,CAAC,YAAY,CAAC,8BAC/D,eAAe,CAAC,QAAQ,EAAE,OAAO,CAWO,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,GAAG,KAAK,EACnC,gBAAgB,SAAS,2BAA2B,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC;kBAOzE,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;mBAQ3E,OAAO,YACL,iBAAiB,CACzB,gBAAgB,CAAC,YAAY,CAAC,EAC9B,gBAAgB,EAChB,CAAC,OAAO,aAAa,EAAE,OAAO,CAAC,CAChC;qBA8CS,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC;qBAS3E,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC;sBAS3E,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC;uBAS5E,iBAAiB,CAAC,gBAAgB,CAAC,YAAY,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC;8BAe/E,OAAO;6BAPP,CAAC,OAAO,EAAE,QAAQ,KAAK,QAAQ;;+BAkB3B,MAAM,GAAG,IAAI;;CAuB9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GACrB,QAAQ,EACR,OAAO,SAAS,MAAM,EACtB,YAAY,SAAS,MAAM,GAAG,KAAK,EACnC,gBAAgB,SAAS,2BAA2B,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,OACtF,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,CASvE,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var V=Object.create;var J=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var O=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var _=(e,t)=>{for(var r in t)J(e,r,{get:t[r],enumerable:!0})},f=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of O(t))!N.call(e,u)&&u!==r&&J(e,u,{get:()=>t[u],enumerable:!(o=H(t,u))||o.enumerable});return e};var M=(e,t,r)=>(r=e!=null?V(F(e)):{},f(t||!e||!e.__esModule?J(r,"default",{value:e,enumerable:!0}):r,e)),A=e=>f(J({},"__esModule",{value:!0}),e);var G={};_(G,{JourneyProvider:()=>b,JourneyStepRenderer:()=>w,useJourney:()=>h,useJourneyApi:()=>R,useJourneySnapshot:()=>v});module.exports=A(G);var y=M(require("react"),1),I=require("@rxova/journey-core"),g=require("react/jsx-runtime"),k=y.default.createContext(null),b=({journey:e,machine:t,persistence:r,history:o,resetOnJourneyChange:u=!1,children:C})=>{let T=y.default.useRef(null),d=y.default.useRef(e),l=y.default.useRef(r),E=y.default.useRef(o),i=u&&d.current!==e,m=l.current!==r,x=E.current!==o;if(!t&&(!T.current||i||m||x)){let P=r||o?{...r?{persistence:r}:{},...o?{history:o}:{}}:void 0;T.current=(0,I.createJourneyMachine)(e,P),d.current=e,l.current=r,E.current=o}let n=t??T.current,s=t?e:d.current;return(0,g.jsx)(k.Provider,{value:{machine:n,journey:s},children:C})},p=(e="useJourney")=>{let t=y.default.useContext(k);if(!t)throw new Error(`${e} must be used within <JourneyProvider>.`);return t};var a=M(require("react"),1),S=require("@rxova/journey-core");var D=()=>{let{machine:e}=p("useJourneySnapshot");return a.default.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)},v=D,R=()=>{let{machine:e}=p("useJourneyApi"),t=a.default.useCallback(async n=>{await e.send(n)},[e]),r=a.default.useCallback(async(n,s)=>{if(s===void 0){await e.send({type:S.JOURNEY_EVENT.GO_TO,to:n});return}await e.send({type:S.JOURNEY_EVENT.GO_TO,to:n,payload:s})},[e]),o=a.default.useCallback(async(n,s)=>{let P=s===void 0?{type:n}:{type:n,payload:s};await e.send(P)},[e]),u=a.default.useCallback(async n=>{await o("next",n)},[o]),C=a.default.useCallback(async n=>{await o("back",n)},[o]),T=a.default.useCallback(async n=>{await o("close",n)},[o]),d=a.default.useCallback(async n=>{await o("submit",n)},[o]),l=a.default.useCallback(n=>{e.updateContext(n)},[e]),E=a.default.useCallback(n=>{e.clearStepError(n)},[e]),i=a.default.useCallback(()=>{e.reset()},[e]),m=a.default.useCallback(n=>{e.trimHistory(n)},[e]),x=a.default.useCallback(()=>{e.clearHistory()},[e]);return{send:t,goTo:r,next:u,back:C,close:T,submit:d,clearStepError:E,updateContext:l,reset:i,trimHistory:m,clearHistory:x}},h=()=>{p("useJourney");let e=v(),t=R();return{snapshot:e,api:t}};var c=require("react/jsx-runtime"),w=({fallback:e=null})=>{let t=v(),{journey:r}=p(),o=r.steps[t.current]?.component;return o?(0,c.jsx)(o,{}):(0,c.jsx)(c.Fragment,{children:e})};0&&(module.exports={JourneyProvider,JourneyStepRenderer,useJourney,useJourneyApi,useJourneySnapshot});
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/context.tsx", "../src/hooks.ts", "../src/JourneyStepRenderer.tsx"],
|
|
4
|
-
"sourcesContent": ["\"use client\";\n\nexport { JourneyProvider } from \"./context\";\nexport { JourneyStepRenderer } from \"./JourneyStepRenderer\";\nexport { useJourney, useJourneyApi, useJourneySnapshot } from \"./hooks\";\nexport type {\n JourneyApi,\n JourneyReactEventPayloadMap,\n JourneyHookResult,\n JourneyProviderProps,\n JourneyReactDefinition,\n JourneyReactStep,\n JourneyStoreValue\n} from \"./types\";\n", "import React from \"react\";\n\nimport { createJourneyMachine } from \"@rxova/journey-core\";\nimport type { JourneyProviderProps, JourneyReactEventPayloadMap, JourneyStoreValue } from \"./types\";\n\nconst JourneyContext = React.createContext<JourneyStoreValue<\n unknown,\n string,\n string,\n Record<never, never>\n> | null>(null);\n\nexport const JourneyProvider = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>({\n journey,\n machine,\n persistence,\n resetOnJourneyChange = false,\n children\n}: JourneyProviderProps<TContext, TStepId, TCustomEvent, TEventPayloadMap>) => {\n const internalMachineRef = React.useRef<\n JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap>[\"machine\"] | null\n >(null);\n const journeyRef = React.useRef(journey);\n const persistenceRef = React.useRef(persistence);\n\n const shouldResetInternal = resetOnJourneyChange && journeyRef.current !== journey;\n const shouldResetPersistence = persistenceRef.current !== persistence;\n\n if (!machine
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,wBAAAC,EAAA,eAAAC,EAAA,kBAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAP,GCAA,IAAAQ,EAAkB,sBAElBC,EAAqC,+
|
|
6
|
-
"names": ["index_exports", "__export", "JourneyProvider", "JourneyStepRenderer", "useJourney", "useJourneyApi", "useJourneySnapshot", "__toCommonJS", "import_react", "import_journey_core", "import_jsx_runtime", "JourneyContext", "React", "JourneyProvider", "journey", "machine", "persistence", "resetOnJourneyChange", "children", "internalMachineRef", "journeyRef", "persistenceRef", "shouldResetInternal", "shouldResetPersistence", "resolvedMachine", "resolvedJourney", "useJourneyStore", "hookName", "value", "import_react", "import_journey_core", "useSnapshot", "machine", "useJourneyStore", "React", "useJourneySnapshot", "useJourneyApi", "send", "event", "goTo", "stepId", "payload", "sendDefault", "type", "next", "back", "close", "submit", "updateContext", "updater", "clearStepError", "reset", "useJourney", "snapshot", "api", "import_jsx_runtime", "JourneyStepRenderer", "fallback", "snapshot", "useJourneySnapshot", "journey", "useJourneyStore", "StepComponent"]
|
|
4
|
+
"sourcesContent": ["\"use client\";\n\nexport { JourneyProvider } from \"./context\";\nexport { JourneyStepRenderer } from \"./JourneyStepRenderer\";\nexport { useJourney, useJourneyApi, useJourneySnapshot } from \"./hooks\";\nexport type {\n JourneyApi,\n JourneyReactEventPayloadMap,\n JourneyHookResult,\n JourneyProviderProps,\n JourneyReactDefinition,\n JourneyReactStep,\n JourneyStoreValue\n} from \"./types\";\n", "import React from \"react\";\n\nimport { createJourneyMachine } from \"@rxova/journey-core\";\nimport type { JourneyProviderProps, JourneyReactEventPayloadMap, JourneyStoreValue } from \"./types\";\n\nconst JourneyContext = React.createContext<JourneyStoreValue<\n unknown,\n string,\n string,\n Record<never, never>\n> | null>(null);\n\n/**\n * React provider that supplies the journey machine and definition to hooks.\n */\nexport const JourneyProvider = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>({\n journey,\n machine,\n persistence,\n history,\n resetOnJourneyChange = false,\n children\n}: JourneyProviderProps<TContext, TStepId, TCustomEvent, TEventPayloadMap>) => {\n const internalMachineRef = React.useRef<\n JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap>[\"machine\"] | null\n >(null);\n const journeyRef = React.useRef(journey);\n const persistenceRef = React.useRef(persistence);\n const historyRef = React.useRef(history);\n\n const shouldResetInternal = resetOnJourneyChange && journeyRef.current !== journey;\n const shouldResetPersistence = persistenceRef.current !== persistence;\n const shouldResetHistory = historyRef.current !== history;\n\n if (\n !machine &&\n (!internalMachineRef.current ||\n shouldResetInternal ||\n shouldResetPersistence ||\n shouldResetHistory)\n ) {\n const options =\n persistence || history\n ? {\n ...(persistence ? { persistence } : {}),\n ...(history ? { history } : {})\n }\n : undefined;\n internalMachineRef.current = createJourneyMachine(journey, options);\n journeyRef.current = journey;\n persistenceRef.current = persistence;\n historyRef.current = history;\n }\n\n const resolvedMachine = machine ?? internalMachineRef.current!;\n const resolvedJourney = machine ? journey : journeyRef.current;\n\n return (\n <JourneyContext.Provider\n value={\n {\n machine: resolvedMachine,\n journey: resolvedJourney\n } as unknown as JourneyStoreValue<unknown, string, string>\n }\n >\n {children}\n </JourneyContext.Provider>\n );\n};\n\nexport const useJourneyStore = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(\n hookName = \"useJourney\"\n): JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap> => {\n const value = React.useContext(JourneyContext);\n if (!value) {\n throw new Error(`${hookName} must be used within <JourneyProvider>.`);\n }\n\n return value as unknown as JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap>;\n};\n", "import React from \"react\";\n\nimport { JOURNEY_EVENT } from \"@rxova/journey-core\";\nimport type { JourneyEvent, JourneyPayloadFor, JourneySnapshot } from \"@rxova/journey-core\";\nimport { useJourneyStore } from \"./context\";\nimport type {\n JourneyDefaultEvent,\n JourneyEventType,\n JourneyHookResult,\n JourneyReactEventPayloadMap\n} from \"./types\";\n\nconst useSnapshot = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(): JourneySnapshot<TContext, TStepId> => {\n const { machine } = useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\n \"useJourneySnapshot\"\n );\n\n return React.useSyncExternalStore(machine.subscribe, machine.getSnapshot, machine.getSnapshot);\n};\n\n/**\n * Reads the current journey snapshot and re-renders on changes.\n */\nexport const useJourneySnapshot = useSnapshot;\n\n/**\n * Returns imperative journey actions (send, goTo, next, back, close, submit).\n */\nexport const useJourneyApi = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>() => {\n const { machine } = useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\n \"useJourneyApi\"\n );\n\n const send = React.useCallback(\n async (event: JourneyEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>) => {\n await machine.send(event);\n },\n [machine]\n );\n\n const goTo = React.useCallback(\n async (\n stepId: TStepId,\n payload?: JourneyPayloadFor<\n JourneyEventType<TCustomEvent>,\n TEventPayloadMap,\n (typeof JOURNEY_EVENT)[\"GO_TO\"]\n >\n ) => {\n if (payload === undefined) {\n await machine.send({\n type: JOURNEY_EVENT.GO_TO,\n to: stepId\n } as JourneyEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>);\n return;\n }\n\n await machine.send({\n type: JOURNEY_EVENT.GO_TO,\n to: stepId,\n payload\n } as JourneyEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>);\n },\n [machine]\n );\n\n const sendDefault = React.useCallback(\n async <TType extends JourneyDefaultEvent>(\n type: TType,\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, TType>\n ) => {\n const event =\n payload === undefined\n ? ({ type } as unknown as JourneyEvent<\n TStepId,\n JourneyEventType<TCustomEvent>,\n TEventPayloadMap\n >)\n : ({\n type,\n payload\n } as unknown as JourneyEvent<\n TStepId,\n JourneyEventType<TCustomEvent>,\n TEventPayloadMap\n >);\n await machine.send(event);\n },\n [machine]\n );\n\n const next = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"next\">\n ) => {\n await sendDefault(\"next\", payload);\n },\n [sendDefault]\n );\n\n const back = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"back\">\n ) => {\n await sendDefault(\"back\", payload);\n },\n [sendDefault]\n );\n\n const close = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"close\">\n ) => {\n await sendDefault(\"close\", payload);\n },\n [sendDefault]\n );\n\n const submit = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"submit\">\n ) => {\n await sendDefault(\"submit\", payload);\n },\n [sendDefault]\n );\n\n const updateContext = React.useCallback(\n (updater: (context: TContext) => TContext) => {\n machine.updateContext(updater);\n },\n [machine]\n );\n\n const clearStepError = React.useCallback(\n (stepId?: TStepId) => {\n machine.clearStepError(stepId);\n },\n [machine]\n );\n\n const reset = React.useCallback(() => {\n machine.reset();\n }, [machine]);\n\n const trimHistory = React.useCallback(\n (maxHistory?: number | null) => {\n machine.trimHistory(maxHistory);\n },\n [machine]\n );\n\n const clearHistory = React.useCallback(() => {\n machine.clearHistory();\n }, [machine]);\n\n return {\n send,\n goTo,\n next,\n back,\n close,\n submit,\n clearStepError,\n updateContext,\n reset,\n trimHistory,\n clearHistory\n };\n};\n\n/**\n * Combined hook that returns both snapshot and API helpers.\n */\nexport const useJourney = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(): JourneyHookResult<TContext, TStepId, TCustomEvent, TEventPayloadMap> => {\n useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\"useJourney\");\n const snapshot = useJourneySnapshot<TContext, TStepId, TCustomEvent, TEventPayloadMap>();\n const api = useJourneyApi<TContext, TStepId, TCustomEvent, TEventPayloadMap>();\n\n return {\n snapshot,\n api\n };\n};\n", "import React from \"react\";\n\nimport { useJourneyStore } from \"./context\";\nimport { useJourneySnapshot } from \"./hooks\";\n\ntype JourneyStepRendererProps = {\n fallback?: React.ReactNode;\n};\n\n/**\n * Renders the active step component from the journey definition.\n */\nexport const JourneyStepRenderer = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never\n>({\n fallback = null\n}: JourneyStepRendererProps) => {\n const snapshot = useJourneySnapshot<TContext, TStepId, TCustomEvent>();\n const { journey } = useJourneyStore<TContext, TStepId, TCustomEvent>();\n\n const StepComponent = journey.steps[snapshot.current]?.component;\n\n if (!StepComponent) {\n return <>{fallback}</>;\n }\n\n return <StepComponent />;\n};\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,EAAA,wBAAAC,EAAA,eAAAC,EAAA,kBAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAP,GCAA,IAAAQ,EAAkB,sBAElBC,EAAqC,+BA6DjCC,EAAA,6BA1DEC,EAAi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YAC1BM,GAAqB,CACpBR,EAAQ,eAAeQ,CAAM,CAC/B,EACA,CAACR,CAAO,CACV,EAEMmB,EAAQ,EAAAjB,QAAM,YAAY,IAAM,CACpCF,EAAQ,MAAM,CAChB,EAAG,CAACA,CAAO,CAAC,EAENoB,EAAc,EAAAlB,QAAM,YACvBmB,GAA+B,CAC9BrB,EAAQ,YAAYqB,CAAU,CAChC,EACA,CAACrB,CAAO,CACV,EAEMsB,EAAe,EAAApB,QAAM,YAAY,IAAM,CAC3CF,EAAQ,aAAa,CACvB,EAAG,CAACA,CAAO,CAAC,EAEZ,MAAO,CACL,KAAAK,EACA,KAAAE,EACA,KAAAK,EACA,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,eAAAG,EACA,cAAAF,EACA,MAAAG,EACA,YAAAC,EACA,aAAAE,CACF,CACF,EAKaC,EAAa,IAKmD,CAC3EtB,EAAmE,YAAY,EAC/E,IAAMuB,EAAWrB,EAAsE,EACjFsB,EAAMrB,EAAiE,EAE7E,MAAO,CACL,SAAAoB,EACA,IAAAC,CACF,CACF,EC7KW,IAAAC,EAAA,6BAbEC,EAAsB,CAIjC,CACA,SAAAC,EAAW,IACb,IAAgC,CAC9B,IAAMC,EAAWC,EAAoD,EAC/D,CAAE,QAAAC,CAAQ,EAAIC,EAAiD,EAE/DC,EAAgBF,EAAQ,MAAMF,EAAS,OAAO,GAAG,UAEvD,OAAKI,KAIE,OAACA,EAAA,EAAc,KAHb,mBAAG,SAAAL,EAAS,CAIvB",
|
|
6
|
+
"names": ["index_exports", "__export", "JourneyProvider", "JourneyStepRenderer", "useJourney", "useJourneyApi", "useJourneySnapshot", "__toCommonJS", "import_react", "import_journey_core", "import_jsx_runtime", "JourneyContext", "React", "JourneyProvider", "journey", "machine", "persistence", "history", "resetOnJourneyChange", "children", "internalMachineRef", "journeyRef", "persistenceRef", "historyRef", "shouldResetInternal", "shouldResetPersistence", "shouldResetHistory", "options", "resolvedMachine", "resolvedJourney", "useJourneyStore", "hookName", "value", "import_react", "import_journey_core", "useSnapshot", "machine", "useJourneyStore", "React", "useJourneySnapshot", "useJourneyApi", "send", "event", "goTo", "stepId", "payload", "sendDefault", "type", "next", "back", "close", "submit", "updateContext", "updater", "clearStepError", "reset", "trimHistory", "maxHistory", "clearHistory", "useJourney", "snapshot", "api", "import_jsx_runtime", "JourneyStepRenderer", "fallback", "snapshot", "useJourneySnapshot", "journey", "useJourneyStore", "StepComponent"]
|
|
7
7
|
}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { JourneyProvider } from "./context";
|
|
2
|
+
export { JourneyStepRenderer } from "./JourneyStepRenderer";
|
|
3
|
+
export { useJourney, useJourneyApi, useJourneySnapshot } from "./hooks";
|
|
4
|
+
export type { JourneyApi, JourneyReactEventPayloadMap, JourneyHookResult, JourneyProviderProps, JourneyReactDefinition, JourneyReactStep, JourneyStoreValue } from "./types";
|
|
5
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACxE,YAAY,EACV,UAAU,EACV,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import
|
|
1
|
+
"use client";import s from"react";import{createJourneyMachine as f}from"@rxova/journey-core";import{jsx as I}from"react/jsx-runtime";var x=s.createContext(null),M=({journey:e,machine:r,persistence:a,history:n,resetOnJourneyChange:l=!1,children:E})=>{let p=s.useRef(null),T=s.useRef(e),d=s.useRef(a),v=s.useRef(n),J=l&&T.current!==e,C=d.current!==a,i=v.current!==n;if(!r&&(!p.current||J||C||i)){let m=a||n?{...a?{persistence:a}:{},...n?{history:n}:{}}:void 0;p.current=f(e,m),T.current=e,d.current=a,v.current=n}let t=r??p.current,u=r?e:T.current;return I(x.Provider,{value:{machine:t,journey:u},children:E})},y=(e="useJourney")=>{let r=s.useContext(x);if(!r)throw new Error(`${e} must be used within <JourneyProvider>.`);return r};import o from"react";import{JOURNEY_EVENT as P}from"@rxova/journey-core";var k=()=>{let{machine:e}=y("useJourneySnapshot");return o.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)},c=k,S=()=>{let{machine:e}=y("useJourneyApi"),r=o.useCallback(async t=>{await e.send(t)},[e]),a=o.useCallback(async(t,u)=>{if(u===void 0){await e.send({type:P.GO_TO,to:t});return}await e.send({type:P.GO_TO,to:t,payload:u})},[e]),n=o.useCallback(async(t,u)=>{let m=u===void 0?{type:t}:{type:t,payload:u};await e.send(m)},[e]),l=o.useCallback(async t=>{await n("next",t)},[n]),E=o.useCallback(async t=>{await n("back",t)},[n]),p=o.useCallback(async t=>{await n("close",t)},[n]),T=o.useCallback(async t=>{await n("submit",t)},[n]),d=o.useCallback(t=>{e.updateContext(t)},[e]),v=o.useCallback(t=>{e.clearStepError(t)},[e]),J=o.useCallback(()=>{e.reset()},[e]),C=o.useCallback(t=>{e.trimHistory(t)},[e]),i=o.useCallback(()=>{e.clearHistory()},[e]);return{send:r,goTo:a,next:l,back:E,close:p,submit:T,clearStepError:v,updateContext:d,reset:J,trimHistory:C,clearHistory:i}},b=()=>{y("useJourney");let e=c(),r=S();return{snapshot:e,api:r}};import{Fragment as h,jsx as R}from"react/jsx-runtime";var g=({fallback:e=null})=>{let r=c(),{journey:a}=y(),n=a.steps[r.current]?.component;return n?R(n,{}):R(h,{children:e})};export{M as JourneyProvider,g as JourneyStepRenderer,b as useJourney,S as useJourneyApi,c as useJourneySnapshot};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/context.tsx", "../src/hooks.ts", "../src/JourneyStepRenderer.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\";\n\nimport { createJourneyMachine } from \"@rxova/journey-core\";\nimport type { JourneyProviderProps, JourneyReactEventPayloadMap, JourneyStoreValue } from \"./types\";\n\nconst JourneyContext = React.createContext<JourneyStoreValue<\n unknown,\n string,\n string,\n Record<never, never>\n> | null>(null);\n\nexport const JourneyProvider = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>({\n journey,\n machine,\n persistence,\n resetOnJourneyChange = false,\n children\n}: JourneyProviderProps<TContext, TStepId, TCustomEvent, TEventPayloadMap>) => {\n const internalMachineRef = React.useRef<\n JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap>[\"machine\"] | null\n >(null);\n const journeyRef = React.useRef(journey);\n const persistenceRef = React.useRef(persistence);\n\n const shouldResetInternal = resetOnJourneyChange && journeyRef.current !== journey;\n const shouldResetPersistence = persistenceRef.current !== persistence;\n\n if (!machine
|
|
5
|
-
"mappings": "aAAA,OAAOA,MAAW,QAElB,OAAS,wBAAAC,MAA4B,
|
|
6
|
-
"names": ["React", "createJourneyMachine", "jsx", "JourneyContext", "JourneyProvider", "journey", "machine", "persistence", "resetOnJourneyChange", "children", "internalMachineRef", "journeyRef", "persistenceRef", "shouldResetInternal", "shouldResetPersistence", "resolvedMachine", "resolvedJourney", "useJourneyStore", "hookName", "value", "React", "JOURNEY_EVENT", "useSnapshot", "machine", "useJourneyStore", "React", "useJourneySnapshot", "useJourneyApi", "send", "event", "goTo", "stepId", "payload", "JOURNEY_EVENT", "sendDefault", "type", "next", "back", "close", "submit", "updateContext", "updater", "clearStepError", "reset", "useJourney", "snapshot", "api", "Fragment", "jsx", "JourneyStepRenderer", "fallback", "snapshot", "useJourneySnapshot", "journey", "useJourneyStore", "StepComponent"]
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\n\nimport { createJourneyMachine } from \"@rxova/journey-core\";\nimport type { JourneyProviderProps, JourneyReactEventPayloadMap, JourneyStoreValue } from \"./types\";\n\nconst JourneyContext = React.createContext<JourneyStoreValue<\n unknown,\n string,\n string,\n Record<never, never>\n> | null>(null);\n\n/**\n * React provider that supplies the journey machine and definition to hooks.\n */\nexport const JourneyProvider = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>({\n journey,\n machine,\n persistence,\n history,\n resetOnJourneyChange = false,\n children\n}: JourneyProviderProps<TContext, TStepId, TCustomEvent, TEventPayloadMap>) => {\n const internalMachineRef = React.useRef<\n JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap>[\"machine\"] | null\n >(null);\n const journeyRef = React.useRef(journey);\n const persistenceRef = React.useRef(persistence);\n const historyRef = React.useRef(history);\n\n const shouldResetInternal = resetOnJourneyChange && journeyRef.current !== journey;\n const shouldResetPersistence = persistenceRef.current !== persistence;\n const shouldResetHistory = historyRef.current !== history;\n\n if (\n !machine &&\n (!internalMachineRef.current ||\n shouldResetInternal ||\n shouldResetPersistence ||\n shouldResetHistory)\n ) {\n const options =\n persistence || history\n ? {\n ...(persistence ? { persistence } : {}),\n ...(history ? { history } : {})\n }\n : undefined;\n internalMachineRef.current = createJourneyMachine(journey, options);\n journeyRef.current = journey;\n persistenceRef.current = persistence;\n historyRef.current = history;\n }\n\n const resolvedMachine = machine ?? internalMachineRef.current!;\n const resolvedJourney = machine ? journey : journeyRef.current;\n\n return (\n <JourneyContext.Provider\n value={\n {\n machine: resolvedMachine,\n journey: resolvedJourney\n } as unknown as JourneyStoreValue<unknown, string, string>\n }\n >\n {children}\n </JourneyContext.Provider>\n );\n};\n\nexport const useJourneyStore = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(\n hookName = \"useJourney\"\n): JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap> => {\n const value = React.useContext(JourneyContext);\n if (!value) {\n throw new Error(`${hookName} must be used within <JourneyProvider>.`);\n }\n\n return value as unknown as JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap>;\n};\n", "import React from \"react\";\n\nimport { JOURNEY_EVENT } from \"@rxova/journey-core\";\nimport type { JourneyEvent, JourneyPayloadFor, JourneySnapshot } from \"@rxova/journey-core\";\nimport { useJourneyStore } from \"./context\";\nimport type {\n JourneyDefaultEvent,\n JourneyEventType,\n JourneyHookResult,\n JourneyReactEventPayloadMap\n} from \"./types\";\n\nconst useSnapshot = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(): JourneySnapshot<TContext, TStepId> => {\n const { machine } = useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\n \"useJourneySnapshot\"\n );\n\n return React.useSyncExternalStore(machine.subscribe, machine.getSnapshot, machine.getSnapshot);\n};\n\n/**\n * Reads the current journey snapshot and re-renders on changes.\n */\nexport const useJourneySnapshot = useSnapshot;\n\n/**\n * Returns imperative journey actions (send, goTo, next, back, close, submit).\n */\nexport const useJourneyApi = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>() => {\n const { machine } = useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\n \"useJourneyApi\"\n );\n\n const send = React.useCallback(\n async (event: JourneyEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>) => {\n await machine.send(event);\n },\n [machine]\n );\n\n const goTo = React.useCallback(\n async (\n stepId: TStepId,\n payload?: JourneyPayloadFor<\n JourneyEventType<TCustomEvent>,\n TEventPayloadMap,\n (typeof JOURNEY_EVENT)[\"GO_TO\"]\n >\n ) => {\n if (payload === undefined) {\n await machine.send({\n type: JOURNEY_EVENT.GO_TO,\n to: stepId\n } as JourneyEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>);\n return;\n }\n\n await machine.send({\n type: JOURNEY_EVENT.GO_TO,\n to: stepId,\n payload\n } as JourneyEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>);\n },\n [machine]\n );\n\n const sendDefault = React.useCallback(\n async <TType extends JourneyDefaultEvent>(\n type: TType,\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, TType>\n ) => {\n const event =\n payload === undefined\n ? ({ type } as unknown as JourneyEvent<\n TStepId,\n JourneyEventType<TCustomEvent>,\n TEventPayloadMap\n >)\n : ({\n type,\n payload\n } as unknown as JourneyEvent<\n TStepId,\n JourneyEventType<TCustomEvent>,\n TEventPayloadMap\n >);\n await machine.send(event);\n },\n [machine]\n );\n\n const next = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"next\">\n ) => {\n await sendDefault(\"next\", payload);\n },\n [sendDefault]\n );\n\n const back = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"back\">\n ) => {\n await sendDefault(\"back\", payload);\n },\n [sendDefault]\n );\n\n const close = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"close\">\n ) => {\n await sendDefault(\"close\", payload);\n },\n [sendDefault]\n );\n\n const submit = React.useCallback(\n async (\n payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, \"submit\">\n ) => {\n await sendDefault(\"submit\", payload);\n },\n [sendDefault]\n );\n\n const updateContext = React.useCallback(\n (updater: (context: TContext) => TContext) => {\n machine.updateContext(updater);\n },\n [machine]\n );\n\n const clearStepError = React.useCallback(\n (stepId?: TStepId) => {\n machine.clearStepError(stepId);\n },\n [machine]\n );\n\n const reset = React.useCallback(() => {\n machine.reset();\n }, [machine]);\n\n const trimHistory = React.useCallback(\n (maxHistory?: number | null) => {\n machine.trimHistory(maxHistory);\n },\n [machine]\n );\n\n const clearHistory = React.useCallback(() => {\n machine.clearHistory();\n }, [machine]);\n\n return {\n send,\n goTo,\n next,\n back,\n close,\n submit,\n clearStepError,\n updateContext,\n reset,\n trimHistory,\n clearHistory\n };\n};\n\n/**\n * Combined hook that returns both snapshot and API helpers.\n */\nexport const useJourney = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(): JourneyHookResult<TContext, TStepId, TCustomEvent, TEventPayloadMap> => {\n useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\"useJourney\");\n const snapshot = useJourneySnapshot<TContext, TStepId, TCustomEvent, TEventPayloadMap>();\n const api = useJourneyApi<TContext, TStepId, TCustomEvent, TEventPayloadMap>();\n\n return {\n snapshot,\n api\n };\n};\n", "import React from \"react\";\n\nimport { useJourneyStore } from \"./context\";\nimport { useJourneySnapshot } from \"./hooks\";\n\ntype JourneyStepRendererProps = {\n fallback?: React.ReactNode;\n};\n\n/**\n * Renders the active step component from the journey definition.\n */\nexport const JourneyStepRenderer = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never\n>({\n fallback = null\n}: JourneyStepRendererProps) => {\n const snapshot = useJourneySnapshot<TContext, TStepId, TCustomEvent>();\n const { journey } = useJourneyStore<TContext, TStepId, TCustomEvent>();\n\n const StepComponent = journey.steps[snapshot.current]?.component;\n\n if (!StepComponent) {\n return <>{fallback}</>;\n }\n\n return <StepComponent />;\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAOA,MAAW,QAElB,OAAS,wBAAAC,MAA4B,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AC/B,EACA,CAACR,CAAO,CACV,EAEMoB,EAAQlB,EAAM,YAAY,IAAM,CACpCF,EAAQ,MAAM,CAChB,EAAG,CAACA,CAAO,CAAC,EAENqB,EAAcnB,EAAM,YACvBoB,GAA+B,CAC9BtB,EAAQ,YAAYsB,CAAU,CAChC,EACA,CAACtB,CAAO,CACV,EAEMuB,EAAerB,EAAM,YAAY,IAAM,CAC3CF,EAAQ,aAAa,CACvB,EAAG,CAACA,CAAO,CAAC,EAEZ,MAAO,CACL,KAAAK,EACA,KAAAE,EACA,KAAAM,EACA,KAAAC,EACA,MAAAC,EACA,OAAAC,EACA,eAAAG,EACA,cAAAF,EACA,MAAAG,EACA,YAAAC,EACA,aAAAE,CACF,CACF,EAKaC,EAAa,IAKmD,CAC3EvB,EAAmE,YAAY,EAC/E,IAAMwB,EAAWtB,EAAsE,EACjFuB,EAAMtB,EAAiE,EAE7E,MAAO,CACL,SAAAqB,EACA,IAAAC,CACF,CACF,EC7KW,mBAAAC,EAAA,OAAAC,MAAA,oBAbJ,IAAMC,EAAsB,CAIjC,CACA,SAAAC,EAAW,IACb,IAAgC,CAC9B,IAAMC,EAAWC,EAAoD,EAC/D,CAAE,QAAAC,CAAQ,EAAIC,EAAiD,EAE/DC,EAAgBF,EAAQ,MAAMF,EAAS,OAAO,GAAG,UAEvD,OAAKI,EAIEP,EAACO,EAAA,EAAc,EAHbP,EAAAD,EAAA,CAAG,SAAAG,EAAS,CAIvB",
|
|
6
|
+
"names": ["React", "createJourneyMachine", "jsx", "JourneyContext", "JourneyProvider", "journey", "machine", "persistence", "history", "resetOnJourneyChange", "children", "internalMachineRef", "journeyRef", "persistenceRef", "historyRef", "shouldResetInternal", "shouldResetPersistence", "shouldResetHistory", "options", "resolvedMachine", "resolvedJourney", "useJourneyStore", "hookName", "value", "React", "JOURNEY_EVENT", "useSnapshot", "machine", "useJourneyStore", "React", "useJourneySnapshot", "useJourneyApi", "send", "event", "goTo", "stepId", "payload", "JOURNEY_EVENT", "sendDefault", "type", "next", "back", "close", "submit", "updateContext", "updater", "clearStepError", "reset", "trimHistory", "maxHistory", "clearHistory", "useJourney", "snapshot", "api", "Fragment", "jsx", "JourneyStepRenderer", "fallback", "snapshot", "useJourneySnapshot", "journey", "useJourneyStore", "StepComponent"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.full.d.ts","../../../node_modules/.pnpm/@types+react@19.2.13/node_modules/@types/react/global.d.ts","../../../node_modules/.pnpm/csstype@3.2.3/node_modules/csstype/index.d.ts","../../../node_modules/.pnpm/@types+react@19.2.13/node_modules/@types/react/index.d.ts","../../../node_modules/.pnpm/@types+react@19.2.13/node_modules/@types/react/jsx-runtime.d.ts","../../core/dist/types.d.ts","../../core/dist/machine.d.ts","../../core/dist/persistence.d.ts","../../core/dist/index.d.ts","../src/types.ts","../src/context.tsx","../src/hooks.ts","../src/JourneyStepRenderer.tsx","../src/index.ts","../../../node_modules/.pnpm/@types+react-dom@19.2.3_@types+react@19.2.13/node_modules/@types/react-dom/index.d.ts"],"fileIdsList":[[54],[52,53],[56,57,58],[56],[54,55,61,62],[54,55,59,60],[54,55,59,60,61],[55,60,61,62,63],[54,55,59]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"1305d1e76ca44e30fb8b2b8075fa522b83f60c0bcf5d4326a9d2cf79b53724f8","impliedFormat":1},{"version":"7e29f41b158de217f94cb9676bf9cbd0cd9b5a46e1985141ed36e075c52bf6ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"f123246a7b6c04d80b9b57fadfc6c90959ec6d5c0d4c8e620e06e2811ae3a052","impliedFormat":1},{"version":"42c169fb8c2d42f4f668c624a9a11e719d5d07dacbebb63cbcf7ef365b0a75b3","impliedFormat":1},"3518fd87b0f1b2225d6e121f84794d75c0f9f2fc6ae4683ea0b2e96e0a6ef0f6","3d3e7b4efbe8891f0b0f37b832ce6adf587b32c4de869b557c2e2613d5363a65","64a4320c603b4e6640d2813fd4817ab65f14fe57327373634a10ddc0016b6435","bdd8041fa7979a7f7a52eea92f4ecafc4155db4f964e0339b57ea05ca57afb8d",{"version":"02d77dd5cbe24de5fe14c11b8ac04e0c1a9971bb71c06bdde8f83d54b5a5cfcd","signature":"8d90beed710123affb4c8fced6f39799e0d28ff83bb68af57dff520b25f0fc77"},{"version":"344e2c28c496e1e5193afc3a0c6116c5f5f36a2888fe5788f17aba4190ecf63a","signature":"7cea91d1e9cc0a78df5e40b10d5418b4098d34fc14f0c711062f4aa6d4bcca7f"},{"version":"908e7703ed1f8e755f04b0731105daf54455cb5f9c0a95c23c1ce6e24dcce91d","signature":"a06fd582b5a58d51c4eb50410cf8853efcddb44a7f7288eb65cad2dd7fc08341"},{"version":"3caab3cdd389088dd876858500019c74a424b632349b7aaa61032fecb6a02cd1","signature":"65bcb36a7c71005b0c8966e21479acbb88b7ba8603679c507227572580d52602"},{"version":"e242dc058cf9bb0a5e1986d13a22495a8a7dbd1f4da89b97848e0ec930637011","signature":"f20aa75ccd2ed53ec6185d6d0971f2dc16d8da989b21907bb5a9663a11901f42"},{"version":"be1cc4d94ea60cbe567bc29ed479d42587bf1e6cba490f123d329976b0fe4ee5","impliedFormat":1}],"root":[[60,64]],"options":{"composite":true,"declaration":true,"declarationDir":"./","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"exactOptionalPropertyTypes":true,"jsx":4,"module":99,"noFallthroughCasesInSwitch":true,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":7,"tsBuildInfoFile":"./tsconfig.build.tsbuildinfo"},"referencedMap":[[65,1],[54,2],[55,1],[59,3],[57,4],[58,4],[63,5],[61,6],[62,7],[64,8],[60,9]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
import type { JOURNEY_EVENT, JourneyEvent, JourneyEventPayloadMap as JourneyCoreEventPayloadMap, JourneyDefinition, JourneyMachine, JourneyPayloadFor, JourneyPersistenceOptions, JourneySnapshot } from "@rxova/journey-core";
|
|
2
|
+
import type { JOURNEY_EVENT, JourneyEvent, JourneyEventPayloadMap as JourneyCoreEventPayloadMap, JourneyDefinition, JourneyHistoryOptions, JourneyMachine, JourneyPayloadFor, JourneyPersistenceOptions, JourneySnapshot } from "@rxova/journey-core";
|
|
3
3
|
export type JourneyDefaultEvent = "next" | "back" | "close" | "submit";
|
|
4
4
|
export type JourneyEventType<TCustomEvent extends string = never> = JourneyDefaultEvent | TCustomEvent;
|
|
5
5
|
export type JourneyReactEventPayloadMap<TCustomEvent extends string = never> = JourneyCoreEventPayloadMap<JourneyEventType<TCustomEvent>>;
|
|
@@ -19,6 +19,8 @@ export type JourneyApi<TContext, TStepId extends string, TCustomEvent extends st
|
|
|
19
19
|
clearStepError: (stepId?: TStepId) => void;
|
|
20
20
|
updateContext: (updater: (context: TContext) => TContext) => void;
|
|
21
21
|
reset: () => void;
|
|
22
|
+
trimHistory: (maxHistory?: number | null) => void;
|
|
23
|
+
clearHistory: () => void;
|
|
22
24
|
};
|
|
23
25
|
export type JourneyHookResult<TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>> = {
|
|
24
26
|
snapshot: JourneySnapshot<TContext, TStepId>;
|
|
@@ -32,6 +34,7 @@ export type JourneyProviderProps<TContext, TStepId extends string, TCustomEvent
|
|
|
32
34
|
journey: JourneyReactDefinition<TContext, TStepId, TCustomEvent, TEventPayloadMap>;
|
|
33
35
|
machine?: JourneyMachine<TContext, TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>;
|
|
34
36
|
persistence?: JourneyPersistenceOptions<TContext, TStepId>;
|
|
37
|
+
history?: JourneyHistoryOptions<TStepId>;
|
|
35
38
|
resetOnJourneyChange?: boolean;
|
|
36
39
|
children: React.ReactNode;
|
|
37
40
|
};
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings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C,CAAC;IACzC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxova/journey-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "React bindings for journey.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -18,16 +18,23 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/rxova/journey.git"
|
|
21
|
+
"url": "git+https://github.com/rxova/journey.git"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
22
25
|
},
|
|
23
26
|
"license": "MIT",
|
|
27
|
+
"author": "Jonatan Kruszewski",
|
|
24
28
|
"type": "module",
|
|
25
29
|
"main": "./dist/index.cjs",
|
|
26
30
|
"module": "./dist/index.js",
|
|
27
31
|
"types": "./dist/index.d.ts",
|
|
28
32
|
"exports": {
|
|
29
33
|
".": {
|
|
30
|
-
"types":
|
|
34
|
+
"types": {
|
|
35
|
+
"import": "./dist/index.d.ts",
|
|
36
|
+
"require": "./dist/index.d.cts"
|
|
37
|
+
},
|
|
31
38
|
"import": "./dist/index.js",
|
|
32
39
|
"require": "./dist/index.cjs"
|
|
33
40
|
}
|
|
@@ -39,7 +46,7 @@
|
|
|
39
46
|
],
|
|
40
47
|
"sideEffects": false,
|
|
41
48
|
"dependencies": {
|
|
42
|
-
"@rxova/journey-core": "^0.
|
|
49
|
+
"@rxova/journey-core": "^0.2.0"
|
|
43
50
|
},
|
|
44
51
|
"peerDependencies": {
|
|
45
52
|
"react": ">=18.2.0"
|
|
@@ -65,9 +72,11 @@
|
|
|
65
72
|
"react-dom": "^19.0.0"
|
|
66
73
|
},
|
|
67
74
|
"scripts": {
|
|
68
|
-
"build": "pnpm run clean && node ./scripts/build.mjs && tsc -p tsconfig.build.json",
|
|
75
|
+
"build": "pnpm run clean && node ./scripts/build.mjs && tsc -p tsconfig.build.json && node ../../scripts/copy-types.mjs dist",
|
|
69
76
|
"clean": "rm -rf dist",
|
|
70
77
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
78
|
+
"publint": "publint",
|
|
79
|
+
"attw": "attw --pack .",
|
|
71
80
|
"size": "pnpm run size:check",
|
|
72
81
|
"size:check": "pnpm run build && size-limit"
|
|
73
82
|
}
|