journey-flow-editor 0.0.8 → 0.0.9

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,4 +1,4 @@
1
- # React + TypeScript + Vite
1
+ # React + ReactFlow Client Journey Editor
2
2
 
3
3
  This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
4
 
@@ -17,57 +17,57 @@ If you are developing a production application, we recommend updating the config
17
17
 
18
18
  ```js
19
19
  export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
20
+ globalIgnores(["dist"]),
21
+ {
22
+ files: ["**/*.{ts,tsx}"],
23
+ extends: [
24
+ // Other configs...
25
25
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
32
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ["./tsconfig.node.json", "./tsconfig.app.json"],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
39
41
  },
40
- // other options...
41
- },
42
- },
43
- ])
42
+ },
43
+ ]);
44
44
  ```
45
45
 
46
46
  You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
47
 
48
48
  ```js
49
49
  // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
50
+ import reactX from "eslint-plugin-react-x";
51
+ import reactDom from "eslint-plugin-react-dom";
52
52
 
53
53
  export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
54
+ globalIgnores(["dist"]),
55
+ {
56
+ files: ["**/*.{ts,tsx}"],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs["recommended-typescript"],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ["./tsconfig.node.json", "./tsconfig.app.json"],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
68
70
  },
69
- // other options...
70
- },
71
- },
72
- ])
71
+ },
72
+ ]);
73
73
  ```
@@ -1,8 +1,10 @@
1
1
  import "@xyflow/react/dist/style.css";
2
- import type { NodeDefinition } from "./flow/types";
2
+ import type { FlowEditorJson, NodeDefinition } from "./flow/types";
3
3
  export type FlowEditorProps = {
4
4
  nodeDefinitions?: NodeDefinition[];
5
5
  extendNodeDefinitions?: NodeDefinition[];
6
+ initialFlow?: Partial<FlowEditorJson> | null;
7
+ onExportJson?: (payload: FlowEditorJson) => void;
6
8
  };
7
- export default function FlowEditor({ nodeDefinitions, extendNodeDefinitions, }: FlowEditorProps): import("react/jsx-runtime").JSX.Element;
9
+ export default function FlowEditor({ nodeDefinitions, extendNodeDefinitions, initialFlow, onExportJson, }: FlowEditorProps): import("react/jsx-runtime").JSX.Element;
8
10
  //# sourceMappingURL=FlowEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlowEditor.d.ts","sourceRoot":"","sources":["../src/FlowEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,8BAA8B,CAAC;AAOtC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,MAAM,eAAe,GAAG;IAC3B,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,qBAAqB,CAAC,EAAE,cAAc,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAChC,eAAe,EACf,qBAA0B,GAC5B,EAAE,eAAe,2CAWjB"}
1
+ {"version":3,"file":"FlowEditor.d.ts","sourceRoot":"","sources":["../src/FlowEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,8BAA8B,CAAC;AAOtC,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnE,MAAM,MAAM,eAAe,GAAG;IAC3B,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,qBAAqB,CAAC,EAAE,cAAc,EAAE,CAAC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CACnD,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAChC,eAAe,EACf,qBAA0B,EAC1B,WAAW,EACX,YAAY,GACd,EAAE,eAAe,2CAejB"}
@@ -1,6 +1,8 @@
1
- import type { NodeDefinition } from "./types";
1
+ import type { FlowEditorJson, NodeDefinition } from "./types";
2
2
  /** -------------------- Editor -------------------- */
3
- export declare function FlowEditorInner({ nodeDefinitions, }: {
3
+ export declare function FlowEditorInner({ nodeDefinitions, initialFlow, onExportJson, }: {
4
4
  nodeDefinitions?: NodeDefinition[];
5
+ initialFlow?: Partial<FlowEditorJson> | null;
6
+ onExportJson?: (payload: FlowEditorJson) => void;
5
7
  }): import("react/jsx-runtime").JSX.Element;
6
8
  //# sourceMappingURL=FlowEditorInner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FlowEditorInner.d.ts","sourceRoot":"","sources":["../../src/flow/FlowEditorInner.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAIT,cAAc,EAKhB,MAAM,SAAS,CAAC;AAqFjB,uDAAuD;AAEvD,wBAAgB,eAAe,CAAC,EAC7B,eAA0C,GAC5C,EAAE;IACA,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACrC,2CA09BA"}
1
+ {"version":3,"file":"FlowEditorInner.d.ts","sourceRoot":"","sources":["../../src/flow/FlowEditorInner.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAGT,cAAc,EAEd,cAAc,EAKhB,MAAM,SAAS,CAAC;AAoIjB,uDAAuD;AAEvD,wBAAgB,eAAe,CAAC,EAC7B,eAA0C,EAC1C,WAAW,EACX,YAAY,GACd,EAAE;IACA,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAC7C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;CACnD,2CAk+BA"}
@@ -1,4 +1,4 @@
1
- import type { Edge, Node } from "@xyflow/react";
1
+ import type { Edge, Node, Viewport } from "@xyflow/react";
2
2
  import type { ComponentType, Dispatch, SetStateAction } from "react";
3
3
  export type NodeType = "start" | "end" | "conditional" | "action" | "multiChoice";
4
4
  export type NodeKind = "start" | "end" | "email" | "sms" | "push" | "tag" | "note" | "delay" | "smartFilter" | "waitForEvent" | "abTest" | "multiChoice";
@@ -24,6 +24,12 @@ export type EdgeData = {
24
24
  };
25
25
  export type RFNode = Node<NodeData, NodeType>;
26
26
  export type RFEdge = Edge<EdgeData>;
27
+ export type FlowEditorJson = {
28
+ version: number;
29
+ nodes: RFNode[];
30
+ edges: RFEdge[];
31
+ viewport: Viewport;
32
+ };
27
33
  export type NodeCategory = "Send Message" | "Update" | "Action" | "Event";
28
34
  export type NodeDrawerFormComponentProps = {
29
35
  node: RFNode;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/flow/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAErE,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,aAAa,GAAG,QAAQ,GAAG,aAAa,CAAC;AAElF,MAAM,MAAM,QAAQ,GAChB,OAAO,GACP,KAAK,GACL,OAAO,GACP,KAAK,GACL,MAAM,GACN,KAAK,GACL,MAAM,GACN,OAAO,GACP,aAAa,GACb,cAAc,GACd,QAAQ,GACR,aAAa,CAAC;AAElB,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC;AAC/B,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAElD,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC;AAE3D,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,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C,EAC9B,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,eAAe,GACjB,EAAE,4BAA4B,2CAqG9B"}
1
+ {"version":3,"file":"TrackedEventForm.d.ts","sourceRoot":"","sources":["../../src/forms/TrackedEventForm.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAElE,wBAAgB,gBAAgB,CAAC,EAC9B,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,eAAe,GACjB,EAAE,4BAA4B,2CAkG9B"}