@rxova/journey-react 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.
package/README.md CHANGED
@@ -1,75 +1,107 @@
1
1
  # @rxova/journey-react
2
2
 
3
- React bindings for Journey. This package includes the core state machine and provides hooks and provider components.
3
+ <p>
4
+ <a href="https://www.npmjs.com/package/@rxova/journey-react">
5
+ <img src="https://img.shields.io/badge/npm-%40rxova%2Fjourney--react-CB3837?logo=npm&logoColor=white" alt="npm package @rxova/journey-react" />
6
+ </a>
7
+ <a href="https://rxova.org/docs/react/quickstart">
8
+ <img src="https://img.shields.io/badge/docs-react-0f8f6a" alt="React docs" />
9
+ </a>
10
+ <a href="https://github.com/rxova/journey/actions/workflows/ci.yml">
11
+ <img src="https://github.com/rxova/journey/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI" />
12
+ </a>
13
+ <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?logo=typescript&logoColor=white" alt="TypeScript" />
14
+ <img src="https://img.shields.io/badge/coverage%20(react)-100%25-brightgreen" alt="React coverage" />
15
+ <a href="https://www.npmjs.com/package/@rxova/journey-react">
16
+ <img src="https://img.shields.io/npm/v/@rxova/journey-react" alt="npm version" />
17
+ </a>
18
+ <a href="https://www.npmjs.com/package/@rxova/journey-react">
19
+ <img src="https://img.shields.io/npm/dm/@rxova/journey-react" alt="npm downloads" />
20
+ </a>
21
+ <a href="https://bundlephobia.com/package/@rxova/journey-react">
22
+ <img src="https://img.shields.io/bundlephobia/minzip/%40rxova%2Fjourney-react" alt="Bundlephobia" />
23
+ </a>
24
+ </p>
25
+
26
+ React bindings for Journey (`JourneyProvider`, hooks, renderer).
27
+
28
+ Use this package when you want Journey flow logic directly inside React components.
29
+
30
+ `[OVERVIEW](https://rxova.org/docs/react/overview) | [QUICKSTART](https://rxova.org/docs/react/quickstart) | [PROVIDER + HOOKS](https://rxova.org/docs/react/provider-and-hooks) | [PATTERNS](https://rxova.org/docs/react/patterns) | [ASYNC UI](https://rxova.org/docs/react/async-ui) | [EXAMPLES](https://rxova.org/docs/react/examples) | [DEVTOOL](https://rxova.org/docs/devtool/overview)`
4
31
 
5
32
  ## Install
6
33
 
7
34
  ```bash
8
- pnpm add @rxova/journey-react
9
- npm install @rxova/journey-react
10
- yarn add @rxova/journey-react
35
+ npm i @rxova/journey-react
11
36
  ```
12
37
 
13
- ## Basic usage
38
+ ## What You Get
14
39
 
15
- ```tsx
16
- import React from "react";
40
+ - `JourneyProvider` to scope one flow instance.
41
+ - `useJourney()` hooks to read state and send actions.
42
+ - `JourneyStepRenderer` to render the active step component.
43
+ - Full access to the underlying machine when needed.
44
+
45
+ ## Quickstart
17
46
 
47
+ ```tsx
18
48
  import {
19
- JOURNEY_TERMINAL,
20
- type JourneyReactDefinition,
21
49
  JourneyProvider,
22
50
  JourneyStepRenderer,
23
- useJourney
51
+ useJourney,
52
+ JOURNEY_TERMINAL,
53
+ type JourneyReactDefinition
24
54
  } from "@rxova/journey-react";
25
55
 
26
- type StepId = "one" | "two" | "three";
27
- type Ctx = { name: string };
56
+ type StepId = "start" | "review";
28
57
 
29
- const One = () => {
30
- const { api } = useJourney<Ctx, StepId>();
31
- return <button onClick={() => api.next()}>Next</button>;
32
- };
58
+ type Ctx = { name: string };
33
59
 
34
- const Two = () => {
60
+ // 1) Step components call the Journey API.
61
+ const Start = () => {
35
62
  const { api } = useJourney<Ctx, StepId>();
36
- return <button onClick={() => api.next()}>Next</button>;
63
+ return <button onClick={() => void api.next()}>Next</button>;
37
64
  };
38
65
 
39
- const Three = () => {
66
+ const Review = () => {
40
67
  const { api } = useJourney<Ctx, StepId>();
41
- return <button onClick={() => api.submit()}>Finish</button>;
68
+ return <button onClick={() => void api.submit()}>Submit</button>;
42
69
  };
43
70
 
71
+ // 2) Journey definition stays declarative and typed.
44
72
  const journey: JourneyReactDefinition<Ctx, StepId> = {
45
- initial: "one",
73
+ initial: "start",
46
74
  context: { name: "" },
47
75
  steps: {
48
- one: { component: One },
49
- two: { component: Two },
50
- three: { component: Three }
76
+ start: { component: Start },
77
+ review: { component: Review }
51
78
  },
52
79
  transitions: [
53
- { from: "one", event: "next", to: "two" },
54
- { from: "two", event: "next", to: "three" },
55
- { from: "three", event: "submit", to: JOURNEY_TERMINAL.COMPLETE }
80
+ { from: "start", event: "next", to: "review" },
81
+ { from: "review", event: "submit", to: JOURNEY_TERMINAL.COMPLETE }
56
82
  ]
57
83
  };
58
84
 
59
- export const Example = () => (
85
+ // 3) Provider + renderer handle active-step rendering.
86
+ export const App = () => (
60
87
  <JourneyProvider journey={journey}>
61
88
  <JourneyStepRenderer<Ctx, StepId> />
62
89
  </JourneyProvider>
63
90
  );
64
91
  ```
65
92
 
66
- ## Notes
93
+ ## Machine Access
94
+
95
+ ```tsx
96
+ import { useJourneyMachine } from "@rxova/journey-react";
67
97
 
68
- - Requires React as a peer dependency (React 18.2+).
98
+ const DebugBridge = () => {
99
+ // Useful for diagnostics, adapters, or custom dev tooling.
100
+ const machine = useJourneyMachine();
101
+ return <pre>{machine.getSnapshot().current}</pre>;
102
+ };
103
+ ```
69
104
 
70
- ## Links
105
+ ## Coverage Notes
71
106
 
72
- - Docs: ../../docs/GETTING_STARTED.md
73
- - API: ../../docs/API.md
74
- - Recipes: ../../docs/RECIPES.md
75
- - Core package: ../core
107
+ Coverage badge is package-specific (`packages/react/test` against `packages/react/src`), not monorepo-wide.
package/dist/hooks.d.ts CHANGED
@@ -1,10 +1,14 @@
1
1
  import { JOURNEY_EVENT } from "@rxova/journey-core";
2
- import type { JourneyEvent, JourneyPayloadFor, JourneySnapshot } from "@rxova/journey-core";
2
+ import type { JourneyEvent, JourneyMachine, JourneyPayloadFor, JourneySnapshot } from "@rxova/journey-core";
3
3
  import type { JourneyEventType, JourneyHookResult, JourneyReactEventPayloadMap } from "./types";
4
4
  /**
5
5
  * Reads the current journey snapshot and re-renders on changes.
6
6
  */
7
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 the underlying journey machine from provider context.
10
+ */
11
+ export declare const useJourneyMachine: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>>() => JourneyMachine<TContext, TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>;
8
12
  /**
9
13
  * Returns imperative journey actions (send, goTo, next, back, close, submit).
10
14
  */
@@ -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;;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,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S,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 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});
1
+ "use strict";"use client";var H=Object.create;var J=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty;var A=(e,t)=>{for(var r in t)J(e,r,{get:t[r],enumerable:!0})},R=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of F(t))!_.call(e,u)&&u!==r&&J(e,u,{get:()=>t[u],enumerable:!(o=O(t,u))||o.enumerable});return e};var f=(e,t,r)=>(r=e!=null?H(N(e)):{},R(t||!e||!e.__esModule?J(r,"default",{value:e,enumerable:!0}):r,e)),D=e=>R(J({},"__esModule",{value:!0}),e);var U={};A(U,{JourneyProvider:()=>b,JourneyStepRenderer:()=>V,useJourney:()=>w,useJourneyApi:()=>M,useJourneyMachine:()=>g,useJourneySnapshot:()=>v});module.exports=D(U);var y=f(require("react"),1),I=require("@rxova/journey-core"),h=require("react/jsx-runtime"),k=y.default.createContext(null),b=({journey:e,machine:t,persistence:r,history:o,resetOnJourneyChange:u=!1,children:C})=>{let p=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&&(!p.current||i||m||x)){let P=r||o?{...r?{persistence:r}:{},...o?{history:o}:{}}:void 0;p.current=(0,I.createJourneyMachine)(e,P),d.current=e,l.current=r,E.current=o}let n=t??p.current,s=t?e:d.current;return(0,h.jsx)(k.Provider,{value:{machine:n,journey:s},children:C})},T=(e="useJourney")=>{let t=y.default.useContext(k);if(!t)throw new Error(`${e} must be used within <JourneyProvider>.`);return t};var a=f(require("react"),1),S=require("@rxova/journey-core");var G=()=>{let{machine:e}=T("useJourneySnapshot");return a.default.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)},v=G,g=()=>{let{machine:e}=T("useJourneyMachine");return e},M=()=>{let{machine:e}=T("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]),p=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:p,submit:d,clearStepError:E,updateContext:l,reset:i,trimHistory:m,clearHistory:x}},w=()=>{T("useJourney");let e=v(),t=M();return{snapshot:e,api:t}};var c=require("react/jsx-runtime"),V=({fallback:e=null})=>{let t=v(),{journey:r}=T(),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,useJourneyMachine,useJourneySnapshot});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -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\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,EAAiB,EAAAC,QAAM,cAKnB,IAAI,EAKDC,EAAkB,CAK7B,CACA,QAAAC,EACA,QAAAC,EACA,YAAAC,EACA,QAAAC,EACA,qBAAAC,EAAuB,GACvB,SAAAC,CACF,IAA+E,CAC7E,IAAMC,EAAqB,EAAAR,QAAM,OAE/B,IAAI,EACAS,EAAa,EAAAT,QAAM,OAAOE,CAAO,EACjCQ,EAAiB,EAAAV,QAAM,OAAOI,CAAW,EACzCO,EA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,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"]
4
+ "sourcesContent": ["\"use client\";\n\nexport { JourneyProvider } from \"./context\";\nexport { JourneyStepRenderer } from \"./JourneyStepRenderer\";\nexport { useJourney, useJourneyApi, useJourneyMachine, 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 {\n JourneyEvent,\n JourneyMachine,\n JourneyPayloadFor,\n JourneySnapshot\n} 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 the underlying journey machine from provider context.\n */\nexport const useJourneyMachine = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(): JourneyMachine<TContext, TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap> => {\n const { machine } = useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\n \"useJourneyMachine\"\n );\n return machine;\n};\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,sBAAAC,EAAA,uBAAAC,IAAA,eAAAC,EAAAR,GCAA,IAAAS,EAAkB,sBAElBC,EAAqC,+BA6DjCC,EAAA,6BA1DEC,EAAiB,EAAAC,QAAM,cAKnB,IAAI,EAKDC,EAAkB,CAK7B,CACA,QAAAC,EACA,QAAAC,EACA,YAAAC,EACA,QAAAC,EACA,qBAAAC,EAAuB,GACvB,SAAAC,CACF,IAA+E,CAC7E,IAAMC,EAAqB,EAAAR,QAAM,OAE/B,IAAI,EACAS,EAAa,EAAAT,QAAM,OAAOE,CAAO,EACjCQ,EAAiB,EAAAV,QAAM,OAAOI,CAAW,EACzCO,EAAa,EAAAX,QAAM,OAAOK,CAAO,EAEjCO,EAAsBN,GAAwBG,EAAW,UAAYP,EACrEW,EAAyBH,EAAe,UAAYN,EACpDU,EAAqBH,EAAW,UAAYN,EAElD,GACE,CAACF,IACA,CAACK,EAAmB,SACnBI,GACAC,GACAC,GACF,CACA,IAAMC,EACJX,GAAeC,EACX,CACE,GAAID,EAAc,CAAE,YAAAA,CAAY,EAAI,CAAC,EACrC,GAAIC,EAAU,CAAE,QAAAA,CAAQ,EAAI,CAAC,CAC/B,EACA,OACNG,EAAmB,WAAU,wBAAqBN,EAASa,CAAO,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YAAY,EAC/E,IAAMwB,EAAWtB,EAAsE,EACjFuB,EAAMrB,EAAiE,EAE7E,MAAO,CACL,SAAAoB,EACA,IAAAC,CACF,CACF,ECjMW,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", "useJourneyMachine", "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", "useJourneyMachine", "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 CHANGED
@@ -1,5 +1,5 @@
1
1
  export { JourneyProvider } from "./context";
2
2
  export { JourneyStepRenderer } from "./JourneyStepRenderer";
3
- export { useJourney, useJourneyApi, useJourneySnapshot } from "./hooks";
3
+ export { useJourney, useJourneyApi, useJourneyMachine, useJourneySnapshot } from "./hooks";
4
4
  export type { JourneyApi, JourneyReactEventPayloadMap, JourneyHookResult, JourneyProviderProps, JourneyReactDefinition, JourneyReactStep, JourneyStoreValue } from "./types";
5
5
  //# sourceMappingURL=index.d.cts.map
@@ -1 +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"}
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,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC3F,YAAY,EACV,UAAU,EACV,2BAA2B,EAC3B,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { JourneyProvider } from "./context";
2
2
  export { JourneyStepRenderer } from "./JourneyStepRenderer";
3
- export { useJourney, useJourneyApi, useJourneySnapshot } from "./hooks";
3
+ export { useJourney, useJourneyApi, useJourneyMachine, useJourneySnapshot } from "./hooks";
4
4
  export type { JourneyApi, JourneyReactEventPayloadMap, JourneyHookResult, JourneyProviderProps, JourneyReactDefinition, JourneyReactStep, JourneyStoreValue } from "./types";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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"}
1
+ {"version":3,"file":"index.d.ts","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,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC3F,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 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};
1
+ "use client";import y from"react";import{createJourneyMachine as R}from"@rxova/journey-core";import{jsx as I}from"react/jsx-runtime";var x=y.createContext(null),f=({journey:e,machine:r,persistence:a,history:n,resetOnJourneyChange:l=!1,children:E})=>{let T=y.useRef(null),p=y.useRef(e),d=y.useRef(a),v=y.useRef(n),J=l&&p.current!==e,C=d.current!==a,i=v.current!==n;if(!r&&(!T.current||J||C||i)){let m=a||n?{...a?{persistence:a}:{},...n?{history:n}:{}}:void 0;T.current=R(e,m),p.current=e,d.current=a,v.current=n}let t=r??T.current,u=r?e:p.current;return I(x.Provider,{value:{machine:t,journey:u},children:E})},s=(e="useJourney")=>{let r=y.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}=s("useJourneySnapshot");return o.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)},c=k,b=()=>{let{machine:e}=s("useJourneyMachine");return e},S=()=>{let{machine:e}=s("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]),T=o.useCallback(async t=>{await n("close",t)},[n]),p=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:T,submit:p,clearStepError:v,updateContext:d,reset:J,trimHistory:C,clearHistory:i}},h=()=>{s("useJourney");let e=c(),r=S();return{snapshot:e,api:r}};import{Fragment as w,jsx as M}from"react/jsx-runtime";var g=({fallback:e=null})=>{let r=c(),{journey:a}=s(),n=a.steps[r.current]?.component;return n?M(n,{}):M(w,{children:e})};export{f as JourneyProvider,g as JourneyStepRenderer,h as useJourney,S as useJourneyApi,b as useJourneyMachine,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\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,sBA6DjC,cAAAC,MAAA,oBA1DJ,IAAMC,EAAiBH,EAAM,cAKnB,IA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ACpCF,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"]
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 {\n JourneyEvent,\n JourneyMachine,\n JourneyPayloadFor,\n JourneySnapshot\n} 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 the underlying journey machine from provider context.\n */\nexport const useJourneyMachine = <\n TContext,\n TStepId extends string,\n TCustomEvent extends string = never,\n TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>\n>(): JourneyMachine<TContext, TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap> => {\n const { machine } = useJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap>(\n \"useJourneyMachine\"\n );\n return machine;\n};\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,sBA6DjC,cAAAC,MAAA,oBA1DJ,IAAMC,EAAiBH,EAAM,cAKnB,IAAI,EAKDI,EAAkB,CAK7B,CACA,QAAAC,EACA,QAAAC,EACA,YAAAC,EACA,QAAAC,EACA,qBAAAC,EAAuB,GACvB,SAAAC,CACF,IAA+E,CAC7E,IAAMC,EAAqBX,EAAM,OAE/B,IAAI,EACAY,EAAaZ,EAAM,OAAOK,CAAO,EACjCQ,EAAiBb,EAAM,OAAOO,CAAW,EACzCO,EAAad,EAAM,OAAOQ,CAAO,EAEjCO,EAAsBN,GAAwBG,EAAW,UAAYP,EACrEW,EAAyBH,EAAe,UAAYN,EACpDU,EAAqBH,EAAW,UAAYN,EAElD,GACE,CAACF,IACA,CAACK,EAAmB,SACnBI,GACAC,GACAC,GACF,CACA,IAAMC,EACJX,GAAeC,EACX,CACE,GAAID,EAAc,CAAE,YAAAA,CAAY,EAAI,CAAC,EACrC,GAAIC,EAAU,CAAE,QAAAA,CAAQ,EAAI,CAAC,CAC/B,EACA,OACNG,EAAmB,QAAUV,EAAqBI,EAASa,CAAO,EAClEN,EAAW,QAAUP,EACrBQ,EAAe,QAAUN,EACzBO,EAAW,QAAUN,CACvB,CAEA,IAAMW,EAAkBb,GAAWK,EAAmB,QAChDS,EAAkBd,EAAUD,EAAUO,EAAW,QAEvD,OACEV,EAACC,EAAe,SAAf,CACC,MACE,CACE,QAASgB,EACT,QAASC,CACX,EAGD,SAAAV,EACH,CAEJ,EAEaW,EAAkB,CAM7BC,EAAW,eAC8D,CACzE,IAA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AAc,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", "useJourneyMachine", "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
  }
@@ -1 +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},"b9dc4534a8b8abf7a231fdee9aeba909fe6a5d9d8ffc64336eb662c28164af1c","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"}
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},"b9dc4534a8b8abf7a231fdee9aeba909fe6a5d9d8ffc64336eb662c28164af1c","3d3e7b4efbe8891f0b0f37b832ce6adf587b32c4de869b557c2e2613d5363a65","64a4320c603b4e6640d2813fd4817ab65f14fe57327373634a10ddc0016b6435","bdd8041fa7979a7f7a52eea92f4ecafc4155db4f964e0339b57ea05ca57afb8d",{"version":"02d77dd5cbe24de5fe14c11b8ac04e0c1a9971bb71c06bdde8f83d54b5a5cfcd","signature":"8d90beed710123affb4c8fced6f39799e0d28ff83bb68af57dff520b25f0fc77"},{"version":"344e2c28c496e1e5193afc3a0c6116c5f5f36a2888fe5788f17aba4190ecf63a","signature":"7cea91d1e9cc0a78df5e40b10d5418b4098d34fc14f0c711062f4aa6d4bcca7f"},{"version":"9134bb070f6546e65582ddf80610c952cebe66c1db9b7f9878fb91fa19b6806e","signature":"dab9c7f8c541b34a8e7d9624d40c0d08b82e62c41cd2c296565688c211baa044"},{"version":"3caab3cdd389088dd876858500019c74a424b632349b7aaa61032fecb6a02cd1","signature":"65bcb36a7c71005b0c8966e21479acbb88b7ba8603679c507227572580d52602"},{"version":"daf2a4a8734f0acefd6a2f66d36c105f279be0077b572c077833f7e52312abe7","signature":"6c39012dc4a41a4d7a3bc3b2f1a80d3aa6320c6f576ada894b4668b3d10f777d"},{"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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxova/journey-react",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "React bindings for journey.",
5
5
  "keywords": [
6
6
  "react",
@@ -18,7 +18,8 @@
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/rxova/journey.git"
21
+ "url": "git+https://github.com/rxova/journey.git",
22
+ "directory": "packages/react"
22
23
  },
23
24
  "publishConfig": {
24
25
  "access": "public"
@@ -46,7 +47,7 @@
46
47
  ],
47
48
  "sideEffects": false,
48
49
  "dependencies": {
49
- "@rxova/journey-core": "^0.3.0"
50
+ "@rxova/journey-core": "^0.4.0"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "react": ">=18.2.0"