@picked/client 0.0.1-dev.1756875690387 → 0.0.1-dev.1762908210565

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.
Files changed (107) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/plugins/create-experience/index.js +1 -1
  3. package/dist/cjs/plugins/experience-browser-storage/index.js +1 -0
  4. package/dist/cjs/plugins/history-browser-storage/index.js +1 -0
  5. package/dist/cjs/plugins/responses-browser-storage/index.js +1 -0
  6. package/dist/cjs/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +1 -1
  7. package/dist/cjs/plugins/shopify/index.js +1 -1
  8. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  9. package/dist/cjs/plugins/web-components/index.js +1 -0
  10. package/dist/cjs/plugins/window-object/index.js +1 -1
  11. package/dist/cjs/server/index.js +1 -1
  12. package/dist/esm/index.js +555 -443
  13. package/dist/esm/plugins/create-experience/index.js +172 -103
  14. package/dist/esm/plugins/experience-browser-storage/index.js +39 -0
  15. package/dist/esm/plugins/{history-browserstorage-plugin → history-browser-storage}/index.js +2 -2
  16. package/dist/esm/plugins/responses-browser-storage/index.js +41 -0
  17. package/dist/esm/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.js +24 -21
  18. package/dist/esm/plugins/shopify/index.js +38 -28
  19. package/dist/esm/plugins/single-page-app/index.js +3 -3
  20. package/dist/esm/plugins/web-components/index.js +21 -0
  21. package/dist/esm/plugins/window-object/index.js +1 -1
  22. package/dist/esm/server/index.js +1 -1
  23. package/dist/experience-instance-CF6m7G83.cjs +1 -0
  24. package/dist/experience-instance-CKru5var.js +781 -0
  25. package/dist/storage-Cb_71y48.js +94 -0
  26. package/dist/storage-DuRlyFaY.cjs +1 -0
  27. package/dist/{supports-BvrzQAVk.js → supports-BjhuLJ8z.js} +27 -11
  28. package/dist/supports-YvpQZxbh.cjs +1 -0
  29. package/dist/types/client.d.ts +26 -0
  30. package/dist/types/client.d.ts.map +1 -1
  31. package/dist/types/entities/action/action.d.ts +15 -0
  32. package/dist/types/entities/action/action.d.ts.map +1 -0
  33. package/dist/types/entities/experience/experience.d.ts +19 -6
  34. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  35. package/dist/types/entities/experience-instance/experience-instance.d.ts +13 -10
  36. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  37. package/dist/types/entities/feature/feature.d.ts +5 -2
  38. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  39. package/dist/types/entities/field/field.d.ts +27 -19
  40. package/dist/types/entities/field/field.d.ts.map +1 -1
  41. package/dist/types/entities/history/history.d.ts.map +1 -1
  42. package/dist/types/entities/predicate/predicate.d.ts +1 -1
  43. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  44. package/dist/types/entities/response/response.d.ts +8 -0
  45. package/dist/types/entities/response/response.d.ts.map +1 -1
  46. package/dist/types/exports.d.ts +2 -0
  47. package/dist/types/exports.d.ts.map +1 -1
  48. package/dist/types/picked.d.ts +28 -10
  49. package/dist/types/picked.d.ts.map +1 -1
  50. package/dist/types/plugins/create-experience/create-experience.d.ts +48 -13
  51. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  52. package/dist/types/plugins/experience-browser-storage/index.d.ts.map +1 -0
  53. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
  54. package/dist/types/plugins/history-browser-storage/index.d.ts.map +1 -0
  55. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -0
  56. package/dist/types/plugins/responses-browser-storage/index.d.ts.map +1 -0
  57. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
  58. package/dist/types/plugins/responses-indexeddb/index.d.ts.map +1 -0
  59. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
  60. package/dist/types/plugins/shopify/plugin.d.ts.map +1 -1
  61. package/dist/types/plugins/shopify/utils.d.ts +21 -0
  62. package/dist/types/plugins/shopify/utils.d.ts.map +1 -0
  63. package/dist/types/plugins/web-components/index.d.ts +2 -0
  64. package/dist/types/plugins/web-components/index.d.ts.map +1 -0
  65. package/dist/types/plugins/web-components/plugin.d.ts +3 -0
  66. package/dist/types/plugins/web-components/plugin.d.ts.map +1 -0
  67. package/dist/types/utils/dom.d.ts +5 -5
  68. package/dist/types/utils/dom.d.ts.map +1 -1
  69. package/dist/types/utils/events.d.ts +29 -24
  70. package/dist/types/utils/events.d.ts.map +1 -1
  71. package/dist/types/utils/get-step-fields.d.ts +4 -0
  72. package/dist/types/utils/get-step-fields.d.ts.map +1 -0
  73. package/dist/types/utils/nodes.d.ts +2 -1
  74. package/dist/types/utils/nodes.d.ts.map +1 -1
  75. package/dist/types/utils/storage.d.ts +3 -0
  76. package/dist/types/utils/storage.d.ts.map +1 -1
  77. package/dist/types/utils/supports.d.ts +2 -0
  78. package/dist/types/utils/supports.d.ts.map +1 -1
  79. package/dist/types/utils/user-session.d.ts +5 -0
  80. package/dist/types/utils/user-session.d.ts.map +1 -0
  81. package/package.json +32 -26
  82. package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +0 -1
  83. package/dist/cjs/plugins/history-browserstorage-plugin/index.js +0 -1
  84. package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +0 -1
  85. package/dist/esm/plugins/experience-browserstorage-plugin/index.js +0 -38
  86. package/dist/esm/plugins/responses-browserstorage-plugin/index.js +0 -36
  87. package/dist/experience-instance-6ZKZS7dF.cjs +0 -1
  88. package/dist/experience-instance-BA0EXYg5.js +0 -712
  89. package/dist/storage-BPJwmlva.cjs +0 -1
  90. package/dist/storage-D87xFySf.js +0 -85
  91. package/dist/supports-C0y3-V5V.cjs +0 -1
  92. package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +0 -1
  93. package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +0 -1
  94. package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +0 -1
  95. package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +0 -1
  96. package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +0 -1
  97. package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +0 -1
  98. package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +0 -1
  99. package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +0 -1
  100. /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/index.d.ts +0 -0
  101. /package/dist/types/plugins/{experience-browserstorage-plugin → experience-browser-storage}/plugin.d.ts +0 -0
  102. /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/index.d.ts +0 -0
  103. /package/dist/types/plugins/{history-browserstorage-plugin → history-browser-storage}/plugin.d.ts +0 -0
  104. /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/index.d.ts +0 -0
  105. /package/dist/types/plugins/{responses-browserstorage-plugin → responses-browser-storage}/plugin.d.ts +0 -0
  106. /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/index.d.ts +0 -0
  107. /package/dist/types/plugins/{responses-indexeddb-plugin → responses-indexeddb}/plugin.d.ts +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/utils/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,CAAA;AAGlD,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,IAAI,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;IACzB,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,OAAO,GAAG,IAAI,CAAA;CAC9B;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,YAAuB,EAC9B,kBAAkB,CAAC,EAAE,kBAAkB,UAaxC;AAqDD,wBAAgB,SAAS,CAAC,CAAC,GAAG,OAAO,EACnC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,EACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,cAc1C;AAED,eAAO,MAAM,YAAY;QACnB,CAAC,iBAAiB,MAAM;aAGnB,MAAM,SAAS,OAAO,cAAc,MAAM;gBAGvC,MAAM;cAGR,CAAC,iBAAiB,MAAM,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI;CAG9E,CAAA;AAED,eAAO,MAAM,UAAU;QACjB,CAAC,iBAAiB,MAAM;aAGnB,MAAM,SAAS,OAAO,cAAc,MAAM;gBAGvC,MAAM;cAGR,CAAC,iBAAiB,MAAM,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI;CAG9E,CAAA"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/utils/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,CAAA;AAElD,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,KAAK,EAAE,MAAM,OAAO,CAAA;IACpB,IAAI,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;IACzB,IAAI,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,OAAO,GAAG,IAAI,CAAA;IAC7B,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAQD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,KAAK,GAAE,YAAuB,EAC9B,kBAAkB,CAAC,EAAE,kBAAkB,UAcxC;AAoBD,wBAAgB,SAAS,CAAC,CAAC,GAAG,OAAO,EACnC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,EACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,cAc1C;AAmDD,eAAO,MAAM,YAAY;QACnB,CAAC,iBAAiB,MAAM;aAGnB,MAAM,SAAS,OAAO,cAAc,MAAM;gBAGvC,MAAM;cAGR,CAAC,iBAAiB,MAAM,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI;CAG9E,CAAA;AAED,eAAO,MAAM,UAAU;QACjB,CAAC,iBAAiB,MAAM;aAGnB,MAAM,SAAS,OAAO,cAAc,MAAM;gBAGvC,MAAM;cAGR,CAAC,iBAAiB,MAAM,YAAY,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI;CAG9E,CAAA"}
@@ -7,4 +7,6 @@ export declare function supportsShadowRoot(): boolean;
7
7
  export declare function supportsWindow(): boolean;
8
8
  export declare function supportsDocument(): boolean;
9
9
  export declare function supportsIntersectionObserver(): boolean;
10
+ export declare function supportsWebComponents(): boolean;
11
+ export declare function supportsCryptoRandomUUID(): boolean;
10
12
  //# sourceMappingURL=supports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"supports.d.ts","sourceRoot":"","sources":["../../../src/utils/supports.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAU5C;AAED,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,4BAA4B,IAAI,OAAO,CAMtD"}
1
+ {"version":3,"file":"supports.d.ts","sourceRoot":"","sources":["../../../src/utils/supports.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,oBAAoB,IAAI,OAAO,CAM9C;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED,wBAAgB,eAAe,IAAI,OAAO,CAMzC;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAU5C;AAED,wBAAgB,cAAc,IAAI,OAAO,CAMxC;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAM1C;AAED,wBAAgB,4BAA4B,IAAI,OAAO,CAMtD;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAM/C;AAED,wBAAgB,wBAAwB,IAAI,OAAO,CAMlD"}
@@ -0,0 +1,5 @@
1
+ export interface Session {
2
+ id: string;
3
+ }
4
+ export declare const initialiseSession: () => Session | null;
5
+ //# sourceMappingURL=user-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-session.d.ts","sourceRoot":"","sources":["../../../src/utils/user-session.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;CACX;AAwCD,eAAO,MAAM,iBAAiB,sBAE7B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@picked/client",
3
- "version": "0.0.1-dev.1756875690387",
3
+ "version": "0.0.1-dev.1762908210565",
4
4
  "dependencies": {
5
5
  "@withease/factories": "^1.0.5"
6
6
  },
@@ -9,16 +9,16 @@
9
9
  "@repo/typescript-config": "workspace:*",
10
10
  "@rollup/plugin-replace": "^6.0.2",
11
11
  "@testing-library/dom": "^10.4.0",
12
- "@vitest/browser": "^3.2.2",
13
- "@vitest/coverage-istanbul": "^3.2.2",
12
+ "@vitest/browser": "^3.2.4",
13
+ "@vitest/coverage-istanbul": "^3.2.4",
14
14
  "effector": "^23.3.0",
15
- "happy-dom": "^18.0.1",
15
+ "happy-dom": "^20.0.2",
16
16
  "tslib": "^2.8.1",
17
17
  "typedoc": "^0.28.5",
18
18
  "typedoc-plugin-markdown": "^4.6.3",
19
- "vite": "^6.3.5",
19
+ "vite": "^6.4.1",
20
20
  "vite-plugin-dts": "^4.5.4",
21
- "vitest": "^3.2.2"
21
+ "vitest": "^3.2.4"
22
22
  },
23
23
  "exports": {
24
24
  ".": {
@@ -57,29 +57,35 @@
57
57
  "require": "./dist/cjs/plugins/window-object/index.js",
58
58
  "default": "./dist/esm/plugins/window-object/index.js"
59
59
  },
60
- "./plugins/responses-indexeddb-plugin": {
61
- "types": "./dist/types/plugins/responses-indexeddb-plugin/index.d.ts",
62
- "import": "./dist/esm/plugins/responses-indexeddb-plugin/index.js",
63
- "require": "./dist/cjs/plugins/responses-indexeddb-plugin/index.js",
64
- "default": "./dist/esm/plugins/responses-indexeddb-plugin/index.js"
60
+ "./plugins/responses-indexeddb": {
61
+ "types": "./dist/types/plugins/responses-indexeddb/index.d.ts",
62
+ "import": "./dist/esm/plugins/responses-indexeddb/index.js",
63
+ "require": "./dist/cjs/plugins/responses-indexeddb/index.js",
64
+ "default": "./dist/esm/plugins/responses-indexeddb/index.js"
65
65
  },
66
- "./plugins/responses-browserstorage-plugin": {
67
- "types": "./dist/types/plugins/responses-browserstorage-plugin/index.d.ts",
68
- "import": "./dist/esm/plugins/responses-browserstorage-plugin/index.js",
69
- "require": "./dist/cjs/plugins/responses-browserstorage-plugin/index.js",
70
- "default": "./dist/esm/plugins/responses-browserstorage-plugin/index.js"
66
+ "./plugins/responses-browser-storage": {
67
+ "types": "./dist/types/plugins/responses-browser-storage/index.d.ts",
68
+ "import": "./dist/esm/plugins/responses-browser-storage/index.js",
69
+ "require": "./dist/cjs/plugins/responses-browser-storage/index.js",
70
+ "default": "./dist/esm/plugins/responses-browser-storage/index.js"
71
71
  },
72
- "./plugins/history-browserstorage-plugin": {
73
- "types": "./dist/types/plugins/history-browserstorage-plugin/index.d.ts",
74
- "import": "./dist/esm/plugins/history-browserstorage-plugin/index.js",
75
- "require": "./dist/cjs/plugins/history-browserstorage-plugin/index.js",
76
- "default": "./dist/esm/plugins/history-browserstorage-plugin/index.js"
72
+ "./plugins/history-browser-storage": {
73
+ "types": "./dist/types/plugins/history-browser-storage/index.d.ts",
74
+ "import": "./dist/esm/plugins/history-browser-storage/index.js",
75
+ "require": "./dist/cjs/plugins/history-browser-storage/index.js",
76
+ "default": "./dist/esm/plugins/history-browser-storage/index.js"
77
77
  },
78
- "./plugins/experience-browserstorage-plugin": {
79
- "types": "./dist/types/plugins/experience-browserstorage-plugin/index.d.ts",
80
- "import": "./dist/esm/plugins/experience-browserstorage-plugin/index.js",
81
- "require": "./dist/cjs/plugins/experience-browserstorage-plugin/index.js",
82
- "default": "./dist/esm/plugins/experience-browserstorage-plugin/index.js"
78
+ "./plugins/experience-browser-storage": {
79
+ "types": "./dist/types/plugins/experience-browser-storage/index.d.ts",
80
+ "import": "./dist/esm/plugins/experience-browser-storage/index.js",
81
+ "require": "./dist/cjs/plugins/experience-browser-storage/index.js",
82
+ "default": "./dist/esm/plugins/experience-browser-storage/index.js"
83
+ },
84
+ "./plugins/web-components": {
85
+ "types": "./dist/types/plugins/web-components/index.d.ts",
86
+ "import": "./dist/esm/plugins/web-components/index.js",
87
+ "require": "./dist/cjs/plugins/web-components/index.js",
88
+ "default": "./dist/esm/plugins/web-components/index.js"
83
89
  }
84
90
  },
85
91
  "files": [
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("effector"),o=require("../../../storage-BPJwmlva.cjs"),g=require("../../../logger-BsmHUUw1.cjs"),S=({storage:i="local"}={})=>({name:"experience-browserstorage-plugin",setup:n=>{const c=i==="local"?o.localStore:o.sessionStore,a=r.createEffect(async e=>{if(!e){g.logger("warn","No experience instance provided to loadExperienceVisiblityFx.");return}const t=o.createStorageKey("open-close","experience",e),s=c.get(t).boolean();e.setOpen(s??e.isOpenStore.getState())});r.sample({source:n.eventBus,filter:e=>e.type==="experience_initialized",fn:e=>e.experienceInstance,target:a});const l=r.createEffect(async e=>{const t=o.createStorageKey("open-close","experience",e),s=e.isOpenStore.getState();c.set(t,s)}),p=e=>r.sample({source:e.isOpenStore,fn:()=>e,target:l});n.experienceInstances.listStore.watch(e=>{e.forEach(t=>p(t))})}});exports.experienceBrowserStoragePlugin=S;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("effector"),o=require("../../../storage-BPJwmlva.cjs"),i=o.createStorageKey("history","global"),l=({storage:a="local"}={})=>({name:"history-browserstorage-plugin",setup:r=>{const s=a==="local"?o.localStore:o.sessionStore,n=t.createEffect(async()=>{const e=s.get(i).json();e&&r.history.restore({entries:e})}),c=t.createEffect(async e=>{s.set(i,e)});t.sample({source:r.eventBus,filter:e=>e.type==="initialized",target:n}),t.sample({source:r.history.entriesStore,target:c})}});exports.historyBrowserStoragePlugin=l;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("effector"),l=require("../../../storage-BPJwmlva.cjs"),c=l.createStorageKey("responses","global"),b=({storage:i="local"}={})=>({name:"responses-browserstorage-plugin",setup:s=>{const r=i==="local"?l.localStore:l.sessionStore,p=o.createEffect(async()=>{const e=r.get(c).json();if(!e)return null;Object.entries(e).forEach(([n,t])=>{s.responses.register(n,t)})}),u=o.createEffect(async e=>{const n=r.get(c).json(),t={};Object.entries(e).forEach(([g,S])=>{const a=s.fields.getById(g).getState();!(a!=null&&a.policies.doNotStoreValue)&&(t[g]=S)});const f={...n,...t};r.set(c,f)});o.sample({source:s.eventBus,filter:e=>e.type==="initialized",target:p}),o.sample({source:s.responses.getAllStore,target:u})}});exports.responsesBrowserStoragePlugin=b;
@@ -1,38 +0,0 @@
1
- import { createEffect as n, sample as i } from "effector";
2
- import { c, l as x, s as S } from "../../../storage-D87xFySf.js";
3
- import { l as f } from "../../../logger-C9a75KZn.js";
4
- const y = ({
5
- storage: a = "local"
6
- } = {}) => ({
7
- name: "experience-browserstorage-plugin",
8
- setup: (s) => {
9
- const r = a === "local" ? x : S, p = n(async (e) => {
10
- if (!e) {
11
- f("warn", "No experience instance provided to loadExperienceVisiblityFx.");
12
- return;
13
- }
14
- const t = c("open-close", "experience", e), o = r.get(t).boolean();
15
- e.setOpen(o ?? e.isOpenStore.getState());
16
- });
17
- i({
18
- source: s.eventBus,
19
- filter: (e) => e.type === "experience_initialized",
20
- fn: (e) => e.experienceInstance,
21
- target: p
22
- });
23
- const l = n(async (e) => {
24
- const t = c("open-close", "experience", e), o = e.isOpenStore.getState();
25
- r.set(t, o);
26
- }), g = (e) => i({
27
- source: e.isOpenStore,
28
- fn: () => e,
29
- target: l
30
- });
31
- s.experienceInstances.listStore.watch((e) => {
32
- e.forEach((t) => g(t));
33
- });
34
- }
35
- });
36
- export {
37
- y as experienceBrowserStoragePlugin
38
- };
@@ -1,36 +0,0 @@
1
- import { createEffect as l, sample as p } from "effector";
2
- import { c as m, l as b, s as d } from "../../../storage-D87xFySf.js";
3
- const a = m("responses", "global"), j = ({
4
- storage: i = "local"
5
- } = {}) => ({
6
- name: "responses-browserstorage-plugin",
7
- setup: (e) => {
8
- const t = i === "local" ? b : d, g = l(async () => {
9
- const s = t.get(a).json();
10
- if (!s)
11
- return null;
12
- Object.entries(s).forEach(([r, o]) => {
13
- e.responses.register(r, o);
14
- });
15
- }), u = l(async (s) => {
16
- const r = t.get(a).json(), o = {};
17
- Object.entries(s).forEach(([c, S]) => {
18
- const n = e.fields.getById(c).getState();
19
- !(n != null && n.policies.doNotStoreValue) && (o[c] = S);
20
- });
21
- const f = { ...r, ...o };
22
- t.set(a, f);
23
- });
24
- p({
25
- source: e.eventBus,
26
- filter: (s) => s.type === "initialized",
27
- target: g
28
- }), p({
29
- source: e.responses.getAllStore,
30
- target: u
31
- });
32
- }
33
- });
34
- export {
35
- j as responsesBrowserStoragePlugin
36
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("effector"),O=require("@withease/factories"),T=require("./supports-C0y3-V5V.cjs"),M=require("./logger-BsmHUUw1.cjs"),ie=require("./object-BbFTsGh3.cjs");function ce(e){return typeof e=="number"&&!isNaN(e)}function B(e){return typeof e=="string"}function w(e){return Array.isArray(e)}function K(e){return e instanceof Promise}function z(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.keys(e).length===1}function m(e){if(ce(e))return e;const t=parseFloat(`${e}`);return isNaN(t)?0:t}function A(e){return`${e}`}const ae={"==":(e,t)=>e==t,"===":(e,t)=>e===t,"!=":(e,t)=>e!=t,"!==":(e,t)=>e!==t,">":(e,t)=>m(e)>m(t),">=":(e,t)=>m(e)>=m(t),"<":(e,t,r)=>{const n=m(e),a=m(t);if(r===void 0)return n<a;const c=m(r);return n<a&&a<c},"<=":(e,t,r)=>{const n=m(e),a=m(t);if(r===void 0)return n<=a;const c=m(r);return n<=a&&a<=c},"!!":async e=>await k(e),"!":async e=>!await k(e),"%":(e,t)=>m(e)%m(t),log:e=>(console.log(e),e),in:(e,t)=>t?B(t)?t.indexOf(A(e))!==-1:w(t)?t.includes(e):!1:!1,cat:(...e)=>e.map(A).join(""),substr:(e,t,r)=>{const n=A(e),a=m(t);if(r===void 0)return n.substr(a);const c=m(r);if(c<0){const o=n.substr(a);return o.substr(0,o.length+c)}return n.substr(a,c)},"+":(...e)=>e.reduce((t,r)=>m(t)+m(r),0),"*":(...e)=>e.reduce((t,r)=>m(t)*m(r),1),"-":(e,t)=>{const r=m(e);return t===void 0?-r:r-m(t)},"/":(e,t)=>m(e)/m(t),min:(...e)=>Math.min(...e.map(m)),max:(...e)=>Math.max(...e.map(m)),merge:(...e)=>e.reduce((t,r)=>w(r)?t.concat(r):t.concat([r]),[]),var(e,t){const r=arguments.length>1?t:null;if(e===""||e==="."||e===null||e===void 0)return this;if(typeof e=="number"&&Array.isArray(this))return e>=0&&e<this.length?this[e]:r;const n=A(e);if(n===""||n===".")return this;const a=n.split(".");let c=this;for(const o of a){if(c==null)return r;if(Array.isArray(c)){const u=parseInt(o,10);isNaN(u)?c=c[o]:c=c[u]}else c=c[o]}return c!==void 0?c:r},async missing(...e){const t=w(e[0])?e[0]:e,r=[];for(const n of t){const a=await d({var:n},this);(a===null||a==="")&&r.push(`${n}`)}return r},async missing_some(e,t){const r=await d({missing:t},this);if(!w(r)||!w(t))return[];const n=r.filter(B);return t.filter(B).length-n.length>=m(e)?[]:n},invoke(e){return typeof e!="function"?null:e()},regexp_matches(e,t){let r=e,n="";if(w(e)){const[c,o]=e;r=c,n=o}return!B(r)||!B(n)?!1:new RegExp(r,n).test(A(t))},throw(e){throw new Error(A(e))}};async function d(e,t){if(!e)return e;if(K(e))return d(await e,t);if(w(e))return Promise.all(e.map(o=>d(o,t)));if(!z(e))return e;const r=ue(e);let n=r?e[r]??[]:[];switch(w(n)||(n=[n]),r){case"if":case"?:":for(let o=0;o<n.length-1;o+=2)if(await k(await d(n[o],t)))return d(n[o+1],t);return n.length%2===1?d(n[n.length-1],t):null;case"and":{let o=null;for(const u of n)if(o=await d(u,t),!await k(o))return o;return o}case"or":{let o=null;for(const u of n)if(o=await d(u,t),await k(o))return o;return o}case"map":{const o=await d(n[0],t);return w(o)?await Promise.all(o.map(u=>d(n[1],u))):[]}case"filter":{const o=await d(n[0],t);return w(o)?(await Promise.all(o.map(async f=>{const S=await k(await d(n[1],f));return{item:f,shouldInclude:S}}))).filter(({shouldInclude:f})=>f).map(({item:f})=>f):[]}case"reduce":{const o=await d(n[0],t);if(!w(o))return n.length>2?await d(n[2],t):null;const u=n[1];let S=n.length>2?await d(n[2],t):null;for(const x of o)S=await d(u,{current:x,accumulator:S});return S}case"all":{const o=await d(n[0],t);if(!w(o)||o.length===0)return!1;for(const u of o)if(!await k(await d(n[1],u)))return!1;return!0}case"some":{const o=await d(n[0],t);if(!w(o))return!1;for(const u of o)if(await k(await d(n[1],u)))return!0;return!1}case"none":{const o=await d(n[0],t);if(!w(o))return!0;for(const u of o)if(await k(await d(n[1],u)))return!1;return!0}case"catch":try{return await d(n[0],t)}catch(o){return z(o)?await d(o,t):n[1]?await d(n[1],o):o instanceof Error?o.message:o}}const a=await Promise.all(n.map(o=>d(o,t))),c=r?ae[r]:void 0;if(!c)throw new Error(`Unrecognized operation ${r}`);return c.apply(t,a)}async function k(e){return K(e)?k(await e):!(Array.isArray(e)&&e.length===0)&&!!e}function ue(e){return Object.keys(e)[0]}function fe(e){return!ie.isEmpty(e)}async function W(e,t,r){const n=e.getStateSnapshot(),a=e.predicates.listStore.getState().reduce((u,f)=>({...u,[f.name]:()=>f.predicate(n)}),{}),c=e.features.listStore.getState().reduce((u,f)=>({...u,[f.id]:async()=>{const{bucket:S}=await f.getBucket();return S}}),{}),o={...r,responses:e.responses.getAllStore.getState(),location:typeof n.location=="object"?{hash:n.location.hash,host:n.location.host,hostname:n.location.hostname,href:n.location.href,origin:n.location.origin,pathname:n.location.pathname,port:n.location.port,protocol:n.location.protocol,search:n.location.search}:void 0,predicates:a,features:c};return await d(t,o)}function pe(e){return!T.supportsWindow()||!T.supportsDocument()?[]:Array.from(window.document.querySelectorAll(e)).filter(t=>t instanceof HTMLElement)}function le(e){if(!T.supportsShadowRoot())throw new Error("Shadow DOM is not supported in this environment");return e.attachShadow({mode:"open"})}function de(){return new Promise((e,t)=>{if(!T.supportsDocument()){t();return}document.readyState!=="loading"?e():document.addEventListener("readystatechange",()=>e(),{once:!0})})}function me(e,t){const r=new MutationObserver(n=>{document.contains(e)||(r.disconnect(),t())});r.observe(document.body,{childList:!0,subtree:!0})}const J="picked-root",H="picked-target";function ge(e,t){return e.flatMap(r=>{const n=pe(r.selector).filter(a=>!ye(a,t));return{...r,elements:n}})}function he(e){return e.flatMap(t=>t.elements.map(r=>xe(r,t.placement)))}function Se(e,t){e.classList.add(H),e.classList.add(`${H}-${t}`)}function ye(e,t){return e.classList.contains(`${H}-${t}`)}function we(e){return e.classList.contains(J)}function Ee(){const e=document.createElement("div");return e.style.display="block",e.classList.add(J),e}function xe(e,t){let r;const n=Ee();if(e instanceof Document)r=e.body.appendChild(n);else{switch(t){case"replace":e.replaceWith(n);break;case"before":e.before(n);break;case"after":e.after(n);break;case"prepend":e.prepend(n);break;default:e.append(n);break}r=n}return r}function Ie(e){return e.type==="conditional"}function F(e){return e.type==="step"}function ke(e){return e.type==="experience"}function G(e){return e.type==="origin"}const Q=(e,t,r,n,a=new Set)=>a.has(r.id)?[]:(a.add(r.id),F(r)&&!n?[r]:t.filter(o=>o.sourceNodeId===r.id).flatMap(o=>{const u=e.find(f=>f.id===o.destinationNodeId);return u?Q(e,t,u,!1,a):[]})),ve=(e,t,r)=>Q(e,t,r,!0,new Set),X=(e,t,r,n,a=new Set)=>{if(a.has(r.id))return[-1,-1];a.add(r.id);const c=t.filter(f=>f.sourceNodeId===r.id);if(c.length===0)return[0,0];let o=1/0,u=-1/0;for(const f of c){const S=e.find(I=>I.id===f.destinationNodeId);if(!S)continue;const[x,y]=X(e,t,S,!1,new Set(a));x!==-1&&(o=Math.min(o,x+1),u=Math.max(u,y+1))}return o===1/0?[-1,-1]:[o,u]},Ne=(e,t,r)=>X(e,t,r,!0,new Set),Y=(e,t,r,n=new Set)=>{if(n.has(r.id))return[-1,-1];if(n.add(r.id),r.type==="origin")return[0,0];const a=t.filter(u=>u.destinationNodeId===r.id);if(a.length===0)return[-1,-1];let c=1/0,o=-1/0;for(const u of a){const f=e.find(y=>y.id===u.sourceNodeId);if(!f)continue;const[S,x]=Y(e,t,f,new Set(n));S!==-1&&(c=Math.min(c,S+1),o=Math.max(o,x+1))}return c===1/0?[-1,-1]:[c,o]},be=(e,t,r)=>Y(e,t,r,new Set),Z=e=>e.find(r=>r.type==="origin")||null,$=(e,t,r)=>{if(!e)return Z(t);const n=r.find(c=>c.sourceNodeId===e.id);if(!n)return null;const a=t.find(c=>c.id===n.destinationNodeId);return a||null};async function Ae(e,t,r,n){const a=e?"true":"false",c=n.find(o=>o.sourceNodeHandle===a&&o.sourceNodeId===t);return r.find(o=>o.id===(c==null?void 0:c.destinationNodeId))}const j=i.createDomain("experience-instance"),Fe=O.createFactory(({client:e,experience:t,target:r})=>{const n=i.createEvent(),a=i.createEvent(),c=i.createEvent(),o=i.createEvent(),u=t.componentStore,f=j.store("transitioning"),S=e.history.entriesStore.map(s=>s.filter(l=>l.experienceId===t.id)),x=S.map(s=>s.filter(l=>F(l.node))),y=S.map(s=>{var l;return((l=s[s.length-1])==null?void 0:l.node)||null}),I=i.combine(t.treeStore,y,({steps:s},l)=>s.find(g=>l&&F(l)&&g.id===l.stepId)||null),R=i.combine(t.treeStore,y,({nodes:s,edges:l},g)=>g?ve(s,l,g):[]),p=i.combine(t.treeStore,y,({nodes:s,edges:l},g)=>g?be(s,l,g):[-1,-1]),h=i.combine(t.treeStore,y,({nodes:s,edges:l},g)=>g?Ne(s,l,g):[-1,-1]),E=j.store(!0),v=i.createApi(E,{open:()=>!0,close:()=>!1,toggle:s=>!s,set:(s,l)=>l});i.sample({source:E,filter:Boolean,target:e.eventBus.prepend(()=>({type:"experience_open",experience:t}))}),i.sample({source:E,filter:s=>!s,target:e.eventBus.prepend(()=>({type:"experience_close",experience:t}))});const N=i.createEffect(async()=>{e.history.back({experienceId:t.id})}),L=i.attach({source:t.treeStore,effect:async(s,l)=>{const g=s.nodes.find(b=>F(b)&&b.stepId===l);g&&e.history.push({experienceId:t.id,node:g})}}),q=i.attach({source:y,effect:s=>{}}),D=i.attach({source:t.treeStore,effect:async({nodes:s})=>Z(s)}),P=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l},g)=>$(g,s,l)}),C=i.attach({source:t.treeStore,effect:async({nodes:s,edges:l,conditionals:g},b)=>{if(!b)return;const V=g.find(se=>se.id===b.conditionalId);if(!V)return;const re=b.id,oe=await W(e,V.condition);return Ae(!!oe,re,s,l)}}),te=i.createEffect(s=>{if(s)return e.launchExperienceById(s.experienceId)}),U=i.attach({source:[y,t.treeStore],effect:async([s,{nodes:l,edges:g}])=>$(s,l,g)}),_=i.attach({source:[y,t.treeStore],effect:async([s,{nodes:l,edges:g}])=>$(s,l,g)}),ne=i.createEffect(s=>{e.history.push({experienceId:t.id,node:s})});return i.split({source:y,match:s=>s?Ie(s)?"condition":F(s)?"step":ke(s)?"launchExperience":G(s)?"origin":"other":"none",cases:{none:D,origin:P,condition:C,step:q,launchExperience:te,__:i.createEvent()}}),i.sample({clock:[C.doneData,P.doneData,D.doneData,_.doneData,U.doneData],filter:Boolean,target:ne}),i.sample({clock:a,target:_}),i.sample({clock:a,source:I,target:e.eventBus.prepend(s=>({type:"step_submit",step:s??void 0,experience:t}))}),i.sample({clock:_.done,source:I,target:e.eventBus.prepend(s=>({type:"step_submit_success",step:s??void 0,experience:t}))}),i.sample({clock:_.fail,source:I,target:e.eventBus.prepend(s=>({type:"step_submit_error",step:s??void 0,experience:t}))}),i.sample({clock:c,target:N}),i.sample({clock:c,source:I,target:e.eventBus.prepend(s=>({type:"step_submit",step:s??void 0,experience:t}))}),i.sample({clock:o,target:L}),i.sample({source:i.combine([C.pending,P.pending,D.pending,_.pending]),fn:s=>s.some(Boolean)?"transitioning":"ready",target:f}),i.sample({clock:q.doneData,source:I,target:e.eventBus.prepend(s=>({type:"step_enter",step:s??void 0,experience:t}))}),i.sample({source:y,clock:n,filter:s=>s?G(s):!0,target:U}),n(),{experienceId:t.id,configStore:t.configStore,target:r,componentStore:u,stateStore:f,isOpenStore:E,open:v.open,close:v.close,toggleOpen:v.toggle,setOpen:v.set,treeStore:t.treeStore,currentNodeStore:y,currentStepStore:I,nextReachableStepNodesStore:R,stepsToOriginStore:p,stepsToLeafStore:h,goToNextStep:a,goToPreviousStep:c,goToStepById:o,stepsHistoryStore:x}});function ee(e){return O.invoke(Fe,e)}const Le=O.createFactory(({client:e})=>{const t=j.store({}),r=i.createEvent(),n=i.createEvent(),a=i.createEvent(),c=i.createApi(t,{register(p,h){const E=[...p[h.experienceId]??[]];return E.push(h),{...p,[h.experienceId]:E}},unregister(p,h){var N;const E=h.experienceId,v=(N=p[E])==null?void 0:N.filter(L=>L!==h);return{...p,[E]:v??[]}}}),o=i.createEffect(({experience:p,target:h})=>ee({client:e,experience:p,target:h})),u=i.createEffect(p=>{c.register(p)}),f=i.createEffect(p=>{p.target&&me(p.target,()=>{a(p)})}),S=i.createEffect(p=>{c.unregister(p)}),x=i.createEffect(p=>{const h=p.componentStore.getState();if(!h){M.logger("warn","No app component registered. Skipping init.");return}const E=h.frameworkStore.getState();if(!E){M.logger("error",`No framework registered for component '${h.name}'. Skipping rendering.`);return}const v=p.target;if(!v){M.logger("error",`No target element registered for experience '${p.experienceId}'. Skipping rendering.`);return}const N=le(v);try{E.render(N,h.component,e,p)}catch(L){M.logger("error",L)}});i.sample({clock:r,target:o}),i.sample({clock:a,target:S}),i.sample({clock:o.doneData,target:[u,f,n]}),i.sample({clock:o.doneData,target:e.eventBus.prepend(p=>({type:"experience_initialized",experienceInstance:p}))}),i.sample({clock:n,target:x});function y(p,h){r({experience:p,target:h})}const I=t.map(p=>Object.values(p).flat());function R(p){return t.map(h=>h[p]||[],{skipVoid:!1})}return{spawn:y,getByExperienceId:R,listStore:I}});function _e(e){return O.invoke(Le,e)}exports.createAppHosts=he;exports.createExperienceInstance=ee;exports.createExperienceInstanceIndex=_e;exports.domInteractive=de;exports.evaluateRuleLogic=W;exports.getTargetElements=ge;exports.isPickedRoot=we;exports.isRulesLogic=fe;exports.isStepNode=F;exports.tagTargetElement=Se;