@rxova/journey-react 0.6.4 → 1.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -148
- package/dist/client.cjs +2 -0
- package/dist/client.cjs.map +7 -0
- package/dist/client.d.cts +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +2 -0
- package/dist/client.js.map +7 -0
- package/dist/createJourney.d.cts +15 -0
- package/dist/createJourney.d.ts +15 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/provider.d.cts +9 -0
- package/dist/provider.d.ts +9 -0
- package/dist/runtime-hooks.d.cts +17 -0
- package/dist/runtime-hooks.d.ts +17 -0
- package/dist/types.d.cts +58 -0
- package/dist/types.d.ts +49 -35
- package/package.json +19 -10
- package/dist/bindings/Provider.d.ts +0 -8
- package/dist/bindings/StepRenderer.d.ts +0 -13
- package/dist/bindings/index.d.ts +0 -6
- package/dist/bindings/useJourneyApi.d.ts +0 -17
- package/dist/bindings/useJourneyMachine.d.ts +0 -4
- package/dist/bindings/useJourneySnapshot.d.ts +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxova/journey-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-rc.1",
|
|
4
4
|
"description": "React bindings for journey.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -38,6 +38,14 @@
|
|
|
38
38
|
},
|
|
39
39
|
"import": "./dist/index.js",
|
|
40
40
|
"require": "./dist/index.cjs"
|
|
41
|
+
},
|
|
42
|
+
"./client": {
|
|
43
|
+
"types": {
|
|
44
|
+
"import": "./dist/client.d.ts",
|
|
45
|
+
"require": "./dist/client.d.cts"
|
|
46
|
+
},
|
|
47
|
+
"import": "./dist/client.js",
|
|
48
|
+
"require": "./dist/client.cjs"
|
|
41
49
|
}
|
|
42
50
|
},
|
|
43
51
|
"files": [
|
|
@@ -46,23 +54,24 @@
|
|
|
46
54
|
"LICENSE"
|
|
47
55
|
],
|
|
48
56
|
"sideEffects": false,
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"@rxova/journey-core": "^0.6.4"
|
|
51
|
-
},
|
|
52
57
|
"peerDependencies": {
|
|
53
|
-
"react": ">=18.2.0"
|
|
58
|
+
"react": ">=18.2.0",
|
|
59
|
+
"@rxova/journey-core": "^1.0.0-rc.1"
|
|
54
60
|
},
|
|
55
61
|
"peerDependenciesMeta": {
|
|
62
|
+
"@rxova/journey-core": {
|
|
63
|
+
"optional": false
|
|
64
|
+
},
|
|
56
65
|
"react": {
|
|
57
66
|
"optional": false
|
|
58
67
|
}
|
|
59
68
|
},
|
|
60
69
|
"size-limit": [
|
|
61
70
|
{
|
|
62
|
-
"name": "react/
|
|
71
|
+
"name": "react/createJourney",
|
|
63
72
|
"path": "dist/index.js",
|
|
64
|
-
"import": "{
|
|
65
|
-
"limit": "
|
|
73
|
+
"import": "{ createJourney }",
|
|
74
|
+
"limit": "2 kB"
|
|
66
75
|
}
|
|
67
76
|
],
|
|
68
77
|
"devDependencies": {
|
|
@@ -73,8 +82,8 @@
|
|
|
73
82
|
"react-dom": "^19.2.4"
|
|
74
83
|
},
|
|
75
84
|
"scripts": {
|
|
76
|
-
"build": "pnpm run clean && node ./scripts/build.
|
|
77
|
-
"clean": "node ../../scripts/clean-paths.
|
|
85
|
+
"build": "pnpm run clean && node --import tsx ./scripts/build.ts && tsc -p tsconfig.build.json && node --import tsx ../../scripts/copy-types.ts dist",
|
|
86
|
+
"clean": "node --import tsx ../../scripts/clean-paths.ts dist tsconfig.build.tsbuildinfo",
|
|
78
87
|
"coverage": "pnpm --workspace-root vitest run --coverage --coverage.include=packages/react/src/** --coverage.reporter=text-summary",
|
|
79
88
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
80
89
|
"publint": "publint",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { JourneyBindingsProviderProps, JourneyReactDefinition, JourneyReactEventPayloadMap, JourneyStoreValue } from "../types";
|
|
3
|
-
type ProviderFactoryProps<TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown> = {
|
|
4
|
-
JourneyContext: React.Context<JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta> | null>;
|
|
5
|
-
boundJourney: JourneyReactDefinition<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>;
|
|
6
|
-
};
|
|
7
|
-
export declare const createProvider: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown>({ JourneyContext, boundJourney }: ProviderFactoryProps<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>) => ({ journey, machine, persistence, resetOnJourneyChange, children }: JourneyBindingsProviderProps<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { JourneySnapshot } from "@rxova/journey-core";
|
|
3
|
-
import type { JourneyReactEventPayloadMap, JourneyStoreValue } from "../types";
|
|
4
|
-
type UseJourneyStore<TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown> = (hookName?: string) => JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>;
|
|
5
|
-
type UseJourneySnapshot<TContext, TStepId extends string, TStepMeta = unknown> = () => JourneySnapshot<TContext, TStepId, TStepMeta>;
|
|
6
|
-
type StepRendererFactoryProps<TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown> = {
|
|
7
|
-
useJourneySnapshot: UseJourneySnapshot<TContext, TStepId, TStepMeta>;
|
|
8
|
-
useJourneyStore: UseJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>;
|
|
9
|
-
};
|
|
10
|
-
export declare const createStepRenderer: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown>({ useJourneySnapshot, useJourneyStore }: StepRendererFactoryProps<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>) => ({ fallback }: {
|
|
11
|
-
fallback?: React.ReactNode;
|
|
12
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export {};
|
package/dist/bindings/index.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { JourneyBindings, JourneyReactDefinition, JourneyReactEventPayloadMap } from "../types";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a typed React integration bundle (Provider, StepRenderer, and hooks)
|
|
4
|
-
* bound to a specific journey definition.
|
|
5
|
-
*/
|
|
6
|
-
export declare const createJourneyBindings: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown>(boundJourney: JourneyReactDefinition<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>) => JourneyBindings<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { JourneyPayloadFor, JourneySendEvent } from "@rxova/journey-core";
|
|
2
|
-
import type { JourneyEventType, JourneyReactEventPayloadMap, JourneyStoreValue } from "../types";
|
|
3
|
-
type UseJourneyStore<TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown> = (hookName?: string) => JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>;
|
|
4
|
-
export declare const createUseJourneyApi: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown>(useJourneyStore: UseJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>) => () => {
|
|
5
|
-
send: (event: JourneySendEvent<TStepId, JourneyEventType<TCustomEvent>, TEventPayloadMap>) => Promise<void>;
|
|
6
|
-
goToNextStep: () => Promise<void>;
|
|
7
|
-
terminateJourney: (payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, "terminateJourney">) => Promise<void>;
|
|
8
|
-
completeJourney: (payload?: JourneyPayloadFor<JourneyEventType<TCustomEvent>, TEventPayloadMap, "completeJourney">) => Promise<void>;
|
|
9
|
-
goToPreviousStep: (steps?: number) => Promise<void>;
|
|
10
|
-
goToLastVisitedStep: () => Promise<void>;
|
|
11
|
-
clearStepError: (stepId?: TStepId) => void;
|
|
12
|
-
updateContext: (updater: (context: TContext) => TContext) => void;
|
|
13
|
-
updateStepMetadata: (stepId: TStepId, updater: (metadata: TStepMeta) => TStepMeta) => void;
|
|
14
|
-
updateComponentMetadata: (stepId: TStepId, updater: (metadata: TStepMeta) => TStepMeta) => void;
|
|
15
|
-
resetJourney: () => void;
|
|
16
|
-
};
|
|
17
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { JourneyReactEventPayloadMap, JourneyStoreValue } from "../types";
|
|
2
|
-
type UseJourneyStore<TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown> = (hookName?: string) => JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>;
|
|
3
|
-
export declare const createUseJourneyMachine: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown>(useJourneyStore: UseJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>) => () => import("packages/core/dist").JourneyMachine<TContext, TStepId, import("..").JourneyEventType<TCustomEvent>, TEventPayloadMap, TStepMeta>;
|
|
4
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { JourneySnapshot } from "@rxova/journey-core";
|
|
2
|
-
import type { JourneyReactEventPayloadMap, JourneyStoreValue } from "../types";
|
|
3
|
-
type UseJourneyStore<TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown> = (hookName?: string) => JourneyStoreValue<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>;
|
|
4
|
-
export declare const createUseJourneySnapshot: <TContext, TStepId extends string, TCustomEvent extends string = never, TEventPayloadMap extends JourneyReactEventPayloadMap<TCustomEvent> = Record<never, never>, TStepMeta = unknown>(useJourneyStore: UseJourneyStore<TContext, TStepId, TCustomEvent, TEventPayloadMap, TStepMeta>) => () => JourneySnapshot<TContext, TStepId, TStepMeta>;
|
|
5
|
-
export {};
|