@picked/client 0.0.1-dev.1789541668638 → 0.0.1-next.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.
Files changed (443) hide show
  1. package/README.md +8 -0
  2. package/dist/cjs/index.js +1 -4
  3. package/dist/cjs/plugins/create-experience/index.js +1 -1
  4. package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +1 -0
  5. package/dist/cjs/plugins/history-browserstorage-plugin/index.js +1 -0
  6. package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +1 -0
  7. package/dist/cjs/plugins/responses-indexeddb-plugin/index.js +1 -0
  8. package/dist/cjs/plugins/shopify/index.js +1 -0
  9. package/dist/cjs/plugins/single-page-app/index.js +1 -1
  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 +732 -1814
  13. package/dist/esm/plugins/create-experience/index.js +398 -490
  14. package/dist/esm/plugins/experience-browserstorage-plugin/index.js +38 -0
  15. package/dist/esm/plugins/history-browserstorage-plugin/index.js +26 -0
  16. package/dist/esm/plugins/responses-browserstorage-plugin/index.js +36 -0
  17. package/dist/esm/plugins/responses-indexeddb-plugin/index.js +101 -0
  18. package/dist/esm/plugins/shopify/index.js +59 -0
  19. package/dist/esm/plugins/single-page-app/index.js +35 -31
  20. package/dist/esm/plugins/window-object/index.js +9 -9
  21. package/dist/esm/server/index.js +89 -141
  22. package/dist/experience-instance-6ZKZS7dF.cjs +1 -0
  23. package/dist/experience-instance-BA0EXYg5.js +712 -0
  24. package/dist/id-BKIWbSTy.cjs +1 -0
  25. package/dist/id-BW-g3y32.js +6 -0
  26. package/dist/logger-BsmHUUw1.cjs +1 -0
  27. package/dist/logger-C9a75KZn.js +5 -0
  28. package/dist/object-BbFTsGh3.cjs +1 -0
  29. package/dist/object-JwZ58NOH.js +28 -0
  30. package/dist/storage-BPJwmlva.cjs +1 -0
  31. package/dist/storage-D87xFySf.js +85 -0
  32. package/dist/supports-BvrzQAVk.js +79 -0
  33. package/dist/supports-C0y3-V5V.cjs +1 -0
  34. package/dist/types/client.d.ts +23 -119
  35. package/dist/types/client.d.ts.map +1 -1
  36. package/dist/types/entities/component/component.d.ts +6 -45
  37. package/dist/types/entities/component/component.d.ts.map +1 -1
  38. package/dist/types/entities/experience/experience.d.ts +99 -160
  39. package/dist/types/entities/experience/experience.d.ts.map +1 -1
  40. package/dist/types/entities/experience-instance/experience-instance.d.ts +113 -83
  41. package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
  42. package/dist/types/entities/feature/feature.d.ts +8 -118
  43. package/dist/types/entities/feature/feature.d.ts.map +1 -1
  44. package/dist/types/entities/field/field.d.ts +64 -96
  45. package/dist/types/entities/field/field.d.ts.map +1 -1
  46. package/dist/types/entities/framework/framework.d.ts +7 -32
  47. package/dist/types/entities/framework/framework.d.ts.map +1 -1
  48. package/dist/types/entities/history/history.d.ts +6 -6
  49. package/dist/types/entities/history/history.d.ts.map +1 -1
  50. package/dist/types/entities/plugin/plugin.d.ts +2 -41
  51. package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
  52. package/dist/types/entities/predicate/predicate.d.ts +7 -30
  53. package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
  54. package/dist/types/entities/project/project.d.ts +9 -0
  55. package/dist/types/entities/project/project.d.ts.map +1 -0
  56. package/dist/types/entities/response/response.d.ts +21 -57
  57. package/dist/types/entities/response/response.d.ts.map +1 -1
  58. package/dist/types/exports.d.ts +4 -22
  59. package/dist/types/exports.d.ts.map +1 -1
  60. package/dist/types/index.d.ts +3 -12
  61. package/dist/types/index.d.ts.map +1 -1
  62. package/dist/types/logic-engine.d.ts +11 -13
  63. package/dist/types/logic-engine.d.ts.map +1 -1
  64. package/dist/types/picked.d.ts +184 -381
  65. package/dist/types/picked.d.ts.map +1 -1
  66. package/dist/types/ping.d.ts +10 -0
  67. package/dist/types/ping.d.ts.map +1 -0
  68. package/dist/types/plugins/create-experience/create-experience.d.ts +44 -119
  69. package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
  70. package/dist/types/plugins/create-experience/index.d.ts +2 -2
  71. package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
  72. package/dist/types/plugins/create-experience/plugin.d.ts +2 -3
  73. package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
  74. package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -1
  75. package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +1 -0
  76. package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts +6 -0
  77. package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +1 -0
  78. package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +1 -0
  79. package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/plugin.d.ts +1 -2
  80. package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +1 -0
  81. package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +1 -0
  82. package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts +6 -0
  83. package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +1 -0
  84. package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +1 -0
  85. package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts +3 -0
  86. package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +1 -0
  87. package/dist/types/plugins/shopify/index.d.ts +2 -0
  88. package/dist/types/plugins/shopify/index.d.ts.map +1 -0
  89. package/dist/types/plugins/shopify/plugin.d.ts +3 -0
  90. package/dist/types/plugins/shopify/plugin.d.ts.map +1 -0
  91. package/dist/types/plugins/shopify/shopify.d.ts +28 -0
  92. package/dist/types/plugins/shopify/shopify.d.ts.map +1 -0
  93. package/dist/types/plugins/single-page-app/plugin.d.ts +2 -2
  94. package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
  95. package/dist/types/plugins/window-object/plugin.d.ts +2 -2
  96. package/dist/types/server/index.d.ts +3 -18
  97. package/dist/types/server/index.d.ts.map +1 -1
  98. package/dist/types/utils/dom.d.ts +6 -4
  99. package/dist/types/utils/dom.d.ts.map +1 -1
  100. package/dist/types/utils/events.d.ts +38 -83
  101. package/dist/types/utils/events.d.ts.map +1 -1
  102. package/dist/types/utils/global-obj.d.ts +2 -1
  103. package/dist/types/utils/global-obj.d.ts.map +1 -1
  104. package/dist/types/utils/id.d.ts.map +1 -1
  105. package/dist/types/utils/indexed-db.d.ts +1 -2
  106. package/dist/types/utils/indexed-db.d.ts.map +1 -1
  107. package/dist/types/utils/logger.d.ts +1 -2
  108. package/dist/types/utils/logger.d.ts.map +1 -1
  109. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +3 -0
  110. package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +1 -0
  111. package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
  112. package/dist/types/utils/node-tree/get-next-node.d.ts.map +1 -1
  113. package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
  114. package/dist/types/utils/node-tree/get-origin-node.d.ts.map +1 -1
  115. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +7 -17
  116. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
  117. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +8 -19
  118. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
  119. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +7 -31
  120. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
  121. package/dist/types/utils/nodes.d.ts +2 -3
  122. package/dist/types/utils/nodes.d.ts.map +1 -1
  123. package/dist/types/utils/object.d.ts +8 -0
  124. package/dist/types/utils/object.d.ts.map +1 -1
  125. package/dist/types/utils/rules-logic.d.ts +3 -33
  126. package/dist/types/utils/rules-logic.d.ts.map +1 -1
  127. package/dist/types/utils/search-params.d.ts.map +1 -1
  128. package/dist/types/utils/state-snaphot.d.ts +16 -0
  129. package/dist/types/utils/state-snaphot.d.ts.map +1 -0
  130. package/dist/types/utils/storage.d.ts +11 -374
  131. package/dist/types/utils/storage.d.ts.map +1 -1
  132. package/dist/types/utils/supports.d.ts +0 -87
  133. package/dist/types/utils/supports.d.ts.map +1 -1
  134. package/package.json +49 -182
  135. package/dist/.tsbuildinfo +0 -1
  136. package/dist/api-C7q_7vxn.js +0 -22
  137. package/dist/api-Ctvh1qkk.cjs +0 -1
  138. package/dist/cjs/form/index.js +0 -1
  139. package/dist/cjs/plugins/dom-observer/index.js +0 -1
  140. package/dist/cjs/plugins/dynamic-experiences/index.js +0 -1
  141. package/dist/cjs/plugins/experience-browser-storage/index.js +0 -1
  142. package/dist/cjs/plugins/history-browser-storage/index.js +0 -1
  143. package/dist/cjs/plugins/responses-browser-storage/index.js +0 -1
  144. package/dist/cjs/plugins/responses-indexeddb/index.js +0 -1
  145. package/dist/cjs/plugins/telemetry/index.js +0 -1
  146. package/dist/cjs/plugins/web-components/index.js +0 -1
  147. package/dist/cjs/preview/index.js +0 -1
  148. package/dist/docs/_root.css +0 -101
  149. package/dist/docs/explanation/conditions-and-the-logic-engine.md +0 -94
  150. package/dist/docs/explanation/content-references.md +0 -99
  151. package/dist/docs/explanation/feature-flag-allocation.md +0 -218
  152. package/dist/docs/explanation/how-picked-works.md +0 -124
  153. package/dist/docs/explanation/how-pickedql-works.md +0 -76
  154. package/dist/docs/explanation/pages-and-flows.md +0 -64
  155. package/dist/docs/explanation/the-content-model.md +0 -87
  156. package/dist/docs/explanation/the-two-apis.md +0 -68
  157. package/dist/docs/explanation/why-server-side-rendering.md +0 -76
  158. package/dist/docs/explanation/workspaces-and-versions.md +0 -71
  159. package/dist/docs/how-to/add-a-step-field-or-action.md +0 -43
  160. package/dist/docs/how-to/analytics/index.md +0 -316
  161. package/dist/docs/how-to/archive-or-delete-a-workspace.md +0 -46
  162. package/dist/docs/how-to/authenticate-the-cli.md +0 -97
  163. package/dist/docs/how-to/authenticate-with-a-magic-link.md +0 -40
  164. package/dist/docs/how-to/authenticate-with-a-password.md +0 -51
  165. package/dist/docs/how-to/authenticate-with-an-api-key.md +0 -51
  166. package/dist/docs/how-to/authenticate-with-oauth.md +0 -40
  167. package/dist/docs/how-to/build-a-flow.md +0 -83
  168. package/dist/docs/how-to/connect-the-mcp-server.md +0 -38
  169. package/dist/docs/how-to/create-a-content-entry.md +0 -48
  170. package/dist/docs/how-to/create-a-project.md +0 -29
  171. package/dist/docs/how-to/create-an-experience.md +0 -42
  172. package/dist/docs/how-to/create-and-revoke-an-api-key.md +0 -42
  173. package/dist/docs/how-to/debug-with-the-chrome-extension.md +0 -57
  174. package/dist/docs/how-to/define-a-page-layout.md +0 -46
  175. package/dist/docs/how-to/fill-and-publish-a-page.md +0 -66
  176. package/dist/docs/how-to/install-the-gtm-template.md +0 -84
  177. package/dist/docs/how-to/install-the-sdk.md +0 -93
  178. package/dist/docs/how-to/install-the-vite-plugin.md +0 -69
  179. package/dist/docs/how-to/invite-and-remove-members.md +0 -35
  180. package/dist/docs/how-to/point-one-entry-at-another.md +0 -61
  181. package/dist/docs/how-to/preview-a-workspace.md +0 -28
  182. package/dist/docs/how-to/publish-a-workspace.md +0 -30
  183. package/dist/docs/how-to/read-a-feature-flag.md +0 -113
  184. package/dist/docs/how-to/read-a-referenced-entry.md +0 -109
  185. package/dist/docs/how-to/register-a-component.md +0 -55
  186. package/dist/docs/how-to/register-an-action-handler.md +0 -67
  187. package/dist/docs/how-to/render-a-step-form.md +0 -131
  188. package/dist/docs/how-to/render-an-unpublished-preview.md +0 -41
  189. package/dist/docs/how-to/reuse-a-section.md +0 -53
  190. package/dist/docs/how-to/reuse-a-step-field-or-action.md +0 -28
  191. package/dist/docs/how-to/roll-back-a-published-version.md +0 -26
  192. package/dist/docs/how-to/run-an-ab-test.md +0 -49
  193. package/dist/docs/how-to/run-code-on-a-form-submission.md +0 -125
  194. package/dist/docs/how-to/server-render-a-page.md +0 -81
  195. package/dist/docs/how-to/set-a-content-security-policy.md +0 -32
  196. package/dist/docs/how-to/set-up-mfa.md +0 -69
  197. package/dist/docs/how-to/switch-workspaces.md +0 -122
  198. package/dist/docs/how-to/upload-and-use-an-asset.mdx +0 -73
  199. package/dist/docs/how-to/validate-a-field.md +0 -52
  200. package/dist/docs/how-to/write-a-condition.md +0 -45
  201. package/dist/docs/how-to/write-a-predicate.md +0 -60
  202. package/dist/docs/index.md +0 -59
  203. package/dist/docs/reference/dashboard/actions.mdx +0 -53
  204. package/dist/docs/reference/dashboard/api-keys.mdx +0 -38
  205. package/dist/docs/reference/dashboard/conditions.mdx +0 -42
  206. package/dist/docs/reference/dashboard/content/asset-library.mdx +0 -63
  207. package/dist/docs/reference/dashboard/content/blocks.mdx +0 -57
  208. package/dist/docs/reference/dashboard/content/content-entries.mdx +0 -95
  209. package/dist/docs/reference/dashboard/content/models.mdx +0 -108
  210. package/dist/docs/reference/dashboard/content/pages.mdx +0 -61
  211. package/dist/docs/reference/dashboard/experiences.mdx +0 -51
  212. package/dist/docs/reference/dashboard/features.mdx +0 -154
  213. package/dist/docs/reference/dashboard/fields.mdx +0 -106
  214. package/dist/docs/reference/dashboard/flow-builder/canvas.mdx +0 -58
  215. package/dist/docs/reference/dashboard/flow-builder/condition-builder.md +0 -57
  216. package/dist/docs/reference/dashboard/flow-builder/keyboard-shortcuts.md +0 -72
  217. package/dist/docs/reference/dashboard/flow-builder/nodes.md +0 -63
  218. package/dist/docs/reference/dashboard/projects.mdx +0 -44
  219. package/dist/docs/reference/dashboard/reports.mdx +0 -43
  220. package/dist/docs/reference/dashboard/steps.mdx +0 -37
  221. package/dist/docs/reference/dashboard/team-management.md +0 -29
  222. package/dist/docs/reference/dashboard/workspace-versioning.mdx +0 -30
  223. package/dist/docs/reference/dashboard/workspaces.mdx +0 -76
  224. package/dist/docs/reference/delivery-api/experience-content.md +0 -152
  225. package/dist/docs/reference/delivery-api/index.md +0 -45
  226. package/dist/docs/reference/delivery-api/preview-caching-crawling.md +0 -79
  227. package/dist/docs/reference/delivery-api/project-config.md +0 -65
  228. package/dist/docs/reference/delivery-api/workspace-schema.md +0 -85
  229. package/dist/docs/reference/glossary.md +0 -181
  230. package/dist/docs/reference/management-api/authentication.md +0 -74
  231. package/dist/docs/reference/management-api/authorization-and-scopes.md +0 -285
  232. package/dist/docs/reference/management-api/error-handling.md +0 -233
  233. package/dist/docs/reference/management-api/pagination.md +0 -192
  234. package/dist/docs/reference/pickedql/data-sources.md +0 -174
  235. package/dist/docs/reference/pickedql/dimensions.md +0 -103
  236. package/dist/docs/reference/pickedql/filtering.md +0 -64
  237. package/dist/docs/reference/pickedql/index.md +0 -18
  238. package/dist/docs/reference/pickedql/schema.md +0 -172
  239. package/dist/docs/reference/pickedql/virtual-functions.md +0 -248
  240. package/dist/docs/reference/sdk/actions.md +0 -30
  241. package/dist/docs/reference/sdk/analytics-events.md +0 -445
  242. package/dist/docs/reference/sdk/conditions.md +0 -147
  243. package/dist/docs/reference/sdk/content-security-policy.md +0 -21
  244. package/dist/docs/reference/sdk/content.md +0 -213
  245. package/dist/docs/reference/sdk/experiences.md +0 -51
  246. package/dist/docs/reference/sdk/features.md +0 -256
  247. package/dist/docs/reference/sdk/fields.md +0 -255
  248. package/dist/docs/reference/sdk/index.md +0 -68
  249. package/dist/docs/reference/sdk/plugins/create-experience.md +0 -123
  250. package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +0 -74
  251. package/dist/docs/reference/sdk/plugins/index.md +0 -29
  252. package/dist/docs/reference/sdk/plugins/window-object.md +0 -25
  253. package/dist/docs/reference/sdk/predicates.md +0 -43
  254. package/dist/docs/reference/sdk/ssr/index.md +0 -33
  255. package/dist/docs/reference/sdk/ssr/rendering-and-hydration.md +0 -103
  256. package/dist/docs/reference/sdk/ssr/serialize.md +0 -80
  257. package/dist/docs/reference/sdk/ssr/slots-and-placements.md +0 -59
  258. package/dist/docs/reference/sdk/steps.md +0 -86
  259. package/dist/docs/reference/sdk/type-generation.md +0 -196
  260. package/dist/docs/reference/tools/chrome-extension.md +0 -16
  261. package/dist/docs/reference/tools/cli.md +0 -146
  262. package/dist/docs/reference/tools/image-optimisation-service.md +0 -104
  263. package/dist/docs/reference/tools/mcp.md +0 -90
  264. package/dist/docs/reference/tools/vite-plugin.md +0 -163
  265. package/dist/docs/tutorials/first-api-call.md +0 -228
  266. package/dist/docs/tutorials/first-experience-in-the-dashboard.mdx +0 -143
  267. package/dist/docs/tutorials/first-experience.mdx +0 -254
  268. package/dist/docs/tutorials/first-server-rendered-page.mdx +0 -186
  269. package/dist/dom-BqcToNL0.js +0 -82
  270. package/dist/dom-DlLH3FxV.cjs +0 -1
  271. package/dist/emit-D-tLiWL1.cjs +0 -1
  272. package/dist/emit-Ds2EG7CB.js +0 -14
  273. package/dist/esm/form/index.js +0 -565
  274. package/dist/esm/plugins/dom-observer/index.js +0 -87
  275. package/dist/esm/plugins/dynamic-experiences/index.js +0 -5
  276. package/dist/esm/plugins/experience-browser-storage/index.js +0 -38
  277. package/dist/esm/plugins/history-browser-storage/index.js +0 -26
  278. package/dist/esm/plugins/responses-browser-storage/index.js +0 -71
  279. package/dist/esm/plugins/responses-indexeddb/index.js +0 -89
  280. package/dist/esm/plugins/telemetry/index.js +0 -100
  281. package/dist/esm/plugins/web-components/index.js +0 -19
  282. package/dist/esm/preview/index.js +0 -2
  283. package/dist/experience-instance-B9S6Yf0N.js +0 -711
  284. package/dist/experience-instance-D8rOg6We.cjs +0 -1
  285. package/dist/id-Bo4RBeOs.js +0 -4
  286. package/dist/id-Js-62re-.cjs +0 -1
  287. package/dist/inert-script-report-B_bMPRzp.js +0 -18
  288. package/dist/inert-script-report-ijRHPtcY.cjs +0 -1
  289. package/dist/logger-CSTvAyyB.cjs +0 -1
  290. package/dist/logger-DMN6TxJJ.js +0 -4
  291. package/dist/object-BUDGxEqy.js +0 -25
  292. package/dist/object-CIkt7Fkr.cjs +0 -1
  293. package/dist/plugin-ChafFq6S.js +0 -194
  294. package/dist/plugin-Dn25Gffy.cjs +0 -1
  295. package/dist/preview-channel-CSr96XAo.js +0 -98
  296. package/dist/preview-channel-Cx0e6fye.cjs +0 -1
  297. package/dist/protocol-Bb_vpLKE.cjs +0 -1
  298. package/dist/protocol-C5KkkiZc.js +0 -84
  299. package/dist/provider-B8wvmeC8.js +0 -98
  300. package/dist/provider-BBLlQOjV.cjs +0 -1
  301. package/dist/registry-C1t8l3t9.cjs +0 -1
  302. package/dist/registry-CXZv0uLg.js +0 -18
  303. package/dist/rules-logic-CGZIYgAI.cjs +0 -1
  304. package/dist/rules-logic-HesIUCu6.js +0 -13
  305. package/dist/storage-1MW3-_As.js +0 -103
  306. package/dist/storage-DUw9UJ2h.cjs +0 -1
  307. package/dist/supports-CO9bJGNl.js +0 -92
  308. package/dist/supports-DBzjGaWD.cjs +0 -1
  309. package/dist/types/data-source/api.d.ts +0 -60
  310. package/dist/types/data-source/api.d.ts.map +0 -1
  311. package/dist/types/data-source/provider.d.ts +0 -103
  312. package/dist/types/data-source/provider.d.ts.map +0 -1
  313. package/dist/types/data-source/registry.d.ts +0 -26
  314. package/dist/types/data-source/registry.d.ts.map +0 -1
  315. package/dist/types/data-source/request-observer.d.ts +0 -62
  316. package/dist/types/data-source/request-observer.d.ts.map +0 -1
  317. package/dist/types/data-source/virtual-data.d.ts +0 -19
  318. package/dist/types/data-source/virtual-data.d.ts.map +0 -1
  319. package/dist/types/entities/action/action.d.ts +0 -85
  320. package/dist/types/entities/action/action.d.ts.map +0 -1
  321. package/dist/types/entities/component/lazyComponent.d.ts +0 -11
  322. package/dist/types/entities/component/lazyComponent.d.ts.map +0 -1
  323. package/dist/types/entities/condition/condition.d.ts +0 -29
  324. package/dist/types/entities/condition/condition.d.ts.map +0 -1
  325. package/dist/types/entities/content/content.d.ts +0 -53
  326. package/dist/types/entities/content/content.d.ts.map +0 -1
  327. package/dist/types/entities/content/reference.d.ts +0 -101
  328. package/dist/types/entities/content/reference.d.ts.map +0 -1
  329. package/dist/types/entities/field/policies.d.ts +0 -35
  330. package/dist/types/entities/field/policies.d.ts.map +0 -1
  331. package/dist/types/entities/response/response-validation.d.ts +0 -75
  332. package/dist/types/entities/response/response-validation.d.ts.map +0 -1
  333. package/dist/types/entities/session/session.d.ts +0 -46
  334. package/dist/types/entities/session/session.d.ts.map +0 -1
  335. package/dist/types/entities/step/step.d.ts +0 -56
  336. package/dist/types/entities/step/step.d.ts.map +0 -1
  337. package/dist/types/form/build-responses.d.ts +0 -18
  338. package/dist/types/form/build-responses.d.ts.map +0 -1
  339. package/dist/types/form/create-field-evaluator.d.ts +0 -28
  340. package/dist/types/form/create-field-evaluator.d.ts.map +0 -1
  341. package/dist/types/form/create-field-validation.d.ts +0 -60
  342. package/dist/types/form/create-field-validation.d.ts.map +0 -1
  343. package/dist/types/form/create-form.d.ts +0 -153
  344. package/dist/types/form/create-form.d.ts.map +0 -1
  345. package/dist/types/form/create-submit-pipeline.d.ts +0 -116
  346. package/dist/types/form/create-submit-pipeline.d.ts.map +0 -1
  347. package/dist/types/form/get-step-fields.d.ts +0 -19
  348. package/dist/types/form/get-step-fields.d.ts.map +0 -1
  349. package/dist/types/form/index.d.ts +0 -11
  350. package/dist/types/form/index.d.ts.map +0 -1
  351. package/dist/types/lifecycle/condition-selection.d.ts +0 -146
  352. package/dist/types/lifecycle/condition-selection.d.ts.map +0 -1
  353. package/dist/types/lifecycle/lifecycle.d.ts +0 -48
  354. package/dist/types/lifecycle/lifecycle.d.ts.map +0 -1
  355. package/dist/types/lifecycle/rules-logic.d.ts +0 -25
  356. package/dist/types/lifecycle/rules-logic.d.ts.map +0 -1
  357. package/dist/types/lifecycle/state-snapshot.d.ts +0 -38
  358. package/dist/types/lifecycle/state-snapshot.d.ts.map +0 -1
  359. package/dist/types/plugins/dom-observer/index.d.ts +0 -3
  360. package/dist/types/plugins/dom-observer/index.d.ts.map +0 -1
  361. package/dist/types/plugins/dom-observer/plugin.d.ts +0 -50
  362. package/dist/types/plugins/dom-observer/plugin.d.ts.map +0 -1
  363. package/dist/types/plugins/dynamic-experiences/hash.d.ts +0 -105
  364. package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +0 -1
  365. package/dist/types/plugins/dynamic-experiences/index.d.ts +0 -7
  366. package/dist/types/plugins/dynamic-experiences/index.d.ts.map +0 -1
  367. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +0 -49
  368. package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +0 -1
  369. package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -45
  370. package/dist/types/plugins/dynamic-experiences/types.d.ts.map +0 -1
  371. package/dist/types/plugins/experience-browser-storage/index.d.ts.map +0 -1
  372. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +0 -7
  373. package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +0 -1
  374. package/dist/types/plugins/history-browser-storage/index.d.ts.map +0 -1
  375. package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +0 -1
  376. package/dist/types/plugins/responses-browser-storage/index.d.ts.map +0 -1
  377. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +0 -18
  378. package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +0 -1
  379. package/dist/types/plugins/responses-indexeddb/index.d.ts.map +0 -1
  380. package/dist/types/plugins/responses-indexeddb/plugin.d.ts +0 -3
  381. package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +0 -1
  382. package/dist/types/plugins/telemetry/emit.d.ts +0 -18
  383. package/dist/types/plugins/telemetry/emit.d.ts.map +0 -1
  384. package/dist/types/plugins/telemetry/index.d.ts +0 -4
  385. package/dist/types/plugins/telemetry/index.d.ts.map +0 -1
  386. package/dist/types/plugins/telemetry/plugin-summary.d.ts +0 -10
  387. package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +0 -1
  388. package/dist/types/plugins/telemetry/plugin.d.ts +0 -45
  389. package/dist/types/plugins/telemetry/plugin.d.ts.map +0 -1
  390. package/dist/types/plugins/web-components/index.d.ts +0 -2
  391. package/dist/types/plugins/web-components/index.d.ts.map +0 -1
  392. package/dist/types/plugins/web-components/plugin.d.ts +0 -4
  393. package/dist/types/plugins/web-components/plugin.d.ts.map +0 -1
  394. package/dist/types/preview/index.d.ts +0 -18
  395. package/dist/types/preview/index.d.ts.map +0 -1
  396. package/dist/types/preview-bridge/index.d.ts +0 -14
  397. package/dist/types/preview-bridge/index.d.ts.map +0 -1
  398. package/dist/types/preview-channel.d.ts +0 -16
  399. package/dist/types/preview-channel.d.ts.map +0 -1
  400. package/dist/types/preview-receiver/apply-ops.d.ts +0 -32
  401. package/dist/types/preview-receiver/apply-ops.d.ts.map +0 -1
  402. package/dist/types/preview-receiver/index.d.ts +0 -32
  403. package/dist/types/preview-receiver/index.d.ts.map +0 -1
  404. package/dist/types/preview-receiver/protocol.d.ts +0 -69
  405. package/dist/types/preview-receiver/protocol.d.ts.map +0 -1
  406. package/dist/types/schema-registry.d.ts +0 -206
  407. package/dist/types/schema-registry.d.ts.map +0 -1
  408. package/dist/types/server/serialize.d.ts +0 -87
  409. package/dist/types/server/serialize.d.ts.map +0 -1
  410. package/dist/types/typed-content.d.ts +0 -17
  411. package/dist/types/typed-content.d.ts.map +0 -1
  412. package/dist/types/utils/client-telemetry.d.ts +0 -25
  413. package/dist/types/utils/client-telemetry.d.ts.map +0 -1
  414. package/dist/types/utils/content-path.d.ts +0 -37
  415. package/dist/types/utils/content-path.d.ts.map +0 -1
  416. package/dist/types/utils/html-asset-value.d.ts +0 -20
  417. package/dist/types/utils/html-asset-value.d.ts.map +0 -1
  418. package/dist/types/utils/inert-script-report.d.ts +0 -40
  419. package/dist/types/utils/inert-script-report.d.ts.map +0 -1
  420. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +0 -25
  421. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts.map +0 -1
  422. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +0 -17
  423. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +0 -1
  424. package/dist/types/utils/node-tree/node-adjacency.d.ts +0 -50
  425. package/dist/types/utils/node-tree/node-adjacency.d.ts.map +0 -1
  426. package/dist/types/utils/node-tree/node-tree-index.d.ts +0 -57
  427. package/dist/types/utils/node-tree/node-tree-index.d.ts.map +0 -1
  428. package/dist/types/utils/picked-config.d.ts +0 -39
  429. package/dist/types/utils/picked-config.d.ts.map +0 -1
  430. package/dist/types/utils/preview-session.d.ts +0 -12
  431. package/dist/types/utils/preview-session.d.ts.map +0 -1
  432. package/dist/types/utils/rehydrate-scripts.d.ts +0 -50
  433. package/dist/types/utils/rehydrate-scripts.d.ts.map +0 -1
  434. package/dist/types/utils/render-string.d.ts +0 -24
  435. package/dist/types/utils/render-string.d.ts.map +0 -1
  436. package/dist/types/utils/user-timing.d.ts +0 -21
  437. package/dist/types/utils/user-timing.d.ts.map +0 -1
  438. package/dist/version-CLjPfmxk.cjs +0 -1
  439. package/dist/version-CPKulHMH.js +0 -256
  440. /package/dist/types/plugins/{experience-browser-storage → experience-browserstorage-plugin}/index.d.ts +0 -0
  441. /package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/index.d.ts +0 -0
  442. /package/dist/types/plugins/{responses-browser-storage → responses-browserstorage-plugin}/index.d.ts +0 -0
  443. /package/dist/types/plugins/{responses-indexeddb → responses-indexeddb-plugin}/index.d.ts +0 -0
@@ -1,153 +0,0 @@
1
- /** @file Creates form instances that wire field evaluation, validation, and submission. */
2
- import { type EventCallable, type Store } from 'effector';
3
- import type { Field, FieldValue } from '../entities/field/field';
4
- import type { ExperienceInstance } from '../entities/experience-instance/experience-instance';
5
- import type { ValidationError } from '../entities/response/response';
6
- import type { Picked } from '../picked';
7
- import { type ErrorCallback, type SubmitCallback, type SubmitEventWithCurrentTarget, type SuccessCallback } from './create-submit-pipeline';
8
- export type FormField = Field & {
9
- value: FieldValue | undefined;
10
- /** Validation error for this field, or undefined if valid. */
11
- error: ValidationError | undefined;
12
- touched: boolean;
13
- /** HTML-safe attributes to spread onto an input element. */
14
- props: {
15
- id: string;
16
- name: string;
17
- key: string;
18
- value: FieldValue | undefined;
19
- type: 'text' | 'number' | 'checkbox';
20
- required: boolean;
21
- placeholder: string | undefined;
22
- oninput: (e: Event) => void;
23
- onchange: (e: Event) => void;
24
- onblur: (e: Event) => void;
25
- };
26
- };
27
- /**
28
- * Dependencies that framework wrappers inject into createForm.
29
- * Replaces Svelte's getPicked()/getExperience() context calls.
30
- */
31
- export interface CreateFormDeps {
32
- client: Picked;
33
- experienceInstance: ExperienceInstance;
34
- }
35
- /**
36
- * Return type for createForm().
37
- * Provides form handlers, reactive stores, and callback registration.
38
- */
39
- export interface FormInstance<TFieldKeys extends string = string> {
40
- /** Form element props (bind to a form element). */
41
- form: {
42
- /** HTML-safe attributes to spread onto a form element. */
43
- props: {
44
- onsubmit: EventCallable<SubmitEventWithCurrentTarget>;
45
- };
46
- /** Flat list of all current validation errors — derived from fieldErrors. */
47
- errors: Store<ValidationError[]>;
48
- /** Reactive store indicating if form is currently submitting. */
49
- submitting: Store<boolean>;
50
- /** Register callbacks to transform/validate data before submission. Returns unsubscribe. */
51
- onBeforeSubmit: (callback: SubmitCallback<TFieldKeys>) => () => void;
52
- /** Register callbacks to run on successful form submission. Returns unsubscribe. */
53
- onSuccess: (callback: SuccessCallback<TFieldKeys>) => () => void;
54
- /** Register callbacks to run on form validation errors. Returns unsubscribe. */
55
- onError: (callback: ErrorCallback) => () => void;
56
- };
57
- /** Reactive store of fields with current values, errors, touched state, and event handlers. */
58
- fields: Store<FormField[]>;
59
- }
60
- /**
61
- * Extracts the current value from a form input event.
62
- *
63
- * @param {Event} e - The DOM event from an input, select, or textarea element.
64
- * @returns {FieldValue | undefined} The field value, or undefined if the event target is not a recognised form element.
65
- * @example
66
- * ```ts
67
- * input.addEventListener('input', (e) => {
68
- * const value = getEventValue(e)
69
- * })
70
- * ```
71
- */
72
- export declare function getEventValue(e: Event): FieldValue | undefined;
73
- /**
74
- * Extracts the staged value for a field from a form event. For a multi-value
75
- * checkbox group, toggles the clicked option's value into or out of
76
- * `currentValue` rather than reading the DOM — under React-controlled
77
- * checkboxes, reconciliation reverts `el.checked` to match the prop before
78
- * the change event fires, so any DOM-based read returns the pre-toggle
79
- * state. For `<select multiple>`, reads `el.selectedOptions` (React does
80
- * not race the change event there). Falls back to {@link getEventValue}
81
- * for single-value fields and unrelated targets.
82
- *
83
- * For multi-checkbox events other than `change`: returns `undefined` for
84
- * `input` so the caller skips dispatch (both `input` and `change` fire on a
85
- * single click; only `change` should toggle, otherwise the toggle would run
86
- * twice and cancel out). Returns `currentValue` (coerced to an array) for
87
- * any non-change event so the caller can still dispatch — keeping
88
- * touched-tracking and required-validation on `blur` working.
89
- *
90
- * Not re-exported from the form barrel; intended for use by the form's own
91
- * field handlers and for direct unit testing.
92
- *
93
- * @param {Event} e - The DOM event from a form input.
94
- * @param {Field} field - The field whose handler received the event.
95
- * @param {FieldValue | undefined} currentValue - The field's currently staged or committed value.
96
- * @returns {FieldValue | undefined} The value to stage, or undefined if the caller should skip dispatch.
97
- * @example
98
- * ```ts
99
- * input.addEventListener('change', (e) => {
100
- * const value = getStagedEventValue(e, field, field.value)
101
- * })
102
- * ```
103
- */
104
- export declare function getStagedEventValue(e: Event, field: Field, currentValue: FieldValue | undefined): FieldValue | undefined;
105
- /**
106
- * Builds a DOM event handler that derives the next staged value via
107
- * {@link getStagedEventValue} and dispatches the given event-callable when
108
- * the helper returns a defined value. Skips dispatch if the helper returns
109
- * undefined (e.g. `input` events on multi-select checkboxes, where dispatch
110
- * is owned by the change event to avoid double-toggling).
111
- *
112
- * Not re-exported from the form barrel; intended for use by `createForm`
113
- * and for direct unit testing.
114
- *
115
- * @param {Field} field - The field bound to the handler.
116
- * @param {FieldValue | undefined} value - The field's currently staged or committed value.
117
- * @param {EventCallable<{ fieldKey: string; value: FieldValue }>} dispatch - The event-callable to fire when the helper returns a value.
118
- * @returns {(e: Event) => void} The handler to attach to a DOM event.
119
- * @example
120
- * ```ts
121
- * const onChange = createFieldHandler(field, value, fieldChangeEvent)
122
- * ```
123
- */
124
- export declare function createFieldHandler(field: Field, value: FieldValue | undefined, dispatch: EventCallable<{
125
- fieldKey: string;
126
- value: FieldValue;
127
- }>): (e: Event) => void;
128
- /**
129
- * Creates a form instance tied to a set of field keys.
130
- * Handles field evaluation, form submission, data transformation,
131
- * validation, event bus tracking, and step navigation.
132
- *
133
- * Framework-agnostic — framework wrappers (Svelte, React) inject
134
- * client and experienceInstance via the deps parameter and handle
135
- * callback cleanup lifecycle.
136
- *
137
- * @param {CreateFormDeps} deps - Client and experience instance injected by the framework wrapper.
138
- * @param {string} formId - Unique identifier for this form instance.
139
- * @param {Store<string>} title - Reactive store holding the form/step title.
140
- * @param {Store<string[]>} fieldKeys - Reactive store of field keys that belong to this form.
141
- * @returns {FormInstance} A form instance with reactive field stores, submission handlers, and callback registration.
142
- * @example
143
- * ```ts
144
- * const form = createForm(
145
- * { client, experienceInstance },
146
- * 'lead-capture',
147
- * $title,
148
- * $fieldKeys,
149
- * )
150
- * ```
151
- */
152
- export declare function createForm(deps: CreateFormDeps, formId: string, title: Store<string>, fieldKeys: Store<string[]>): FormInstance;
153
- //# sourceMappingURL=create-form.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-form.d.ts","sourceRoot":"","sources":["../../../src/form/create-form.ts"],"names":[],"mappings":"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"}
@@ -1,116 +0,0 @@
1
- /** @file Submit pipeline for form instances — manages lifecycle, validation, and navigation. */
2
- import { type Event, type EventCallable, type Store } from 'effector';
3
- import type { ExperienceInstance } from '../entities/experience-instance/experience-instance';
4
- import type { ExperienceStep } from '../entities/step/step';
5
- import type { Field } from '../entities/field/field';
6
- import type { ValidationError } from '../entities/response/response';
7
- import type { Picked } from '../picked';
8
- import type { FieldValueFor } from '../schema-registry';
9
- export type SubmitEventWithCurrentTarget = SubmitEvent & {
10
- currentTarget: EventTarget & HTMLFormElement;
11
- };
12
- /**
13
- * Callback fired after a successful commit, receiving the committed `data` keyed by
14
- * the step's field ids.
15
- *
16
- * The `data` value type is a schema-typed *view* over runtime-`FieldValue` data — the
17
- * same soundness posture as `getField`/`getByFieldKey`. The registry narrows each field
18
- * id to its declared value type, but the values are not runtime-validated against it. The
19
- * default `TFieldIds = string` resolves to `Record<string, FieldValue>`, so untyped
20
- * consumers keep the broad value type.
21
- */
22
- export type SuccessCallback<TFieldIds extends string = string> = (options: {
23
- data: {
24
- [P in TFieldIds]: FieldValueFor<P>;
25
- };
26
- stopNavigation: EventCallable<void>;
27
- }) => void | Promise<void>;
28
- export type ErrorCallback = (errors: ValidationError[]) => void | Promise<void>;
29
- /**
30
- * Callback fired before commit, receiving the parsed `data` keyed by the step's field
31
- * ids and optionally returning a transformed copy.
32
- *
33
- * The `data` value type is a schema-typed *view* over runtime-`FieldValue` data — the
34
- * same soundness posture as `getField`/`getByFieldKey`. The registry narrows each field
35
- * id to its declared value type, but the values are not runtime-validated against it. The
36
- * default `TFieldIds = string` resolves to `Record<string, FieldValue>`, so untyped
37
- * consumers keep the broad value type.
38
- */
39
- export type SubmitCallback<TFieldIds extends string = string> = (data: {
40
- [P in TFieldIds]: FieldValueFor<P>;
41
- }) => {
42
- [P in TFieldIds]: FieldValueFor<P>;
43
- } | void | Promise<{
44
- [P in TFieldIds]: FieldValueFor<P>;
45
- } | void>;
46
- /**
47
- * Latest-wins submit callback slots accepted by the framework adapters.
48
- *
49
- * Declared here so `@picked/react` and `@picked/svelte` share one shape rather
50
- * than each defining its own. Passing callbacks as options is the recommended
51
- * style in both adapters: the callbacks arrive as arguments, so there is no
52
- * registration lifecycle for a consumer to get wrong, and re-rendering with a new
53
- * inline function simply replaces the previous one.
54
- *
55
- * @example createForm(id, title, keys, { onSuccess: ({ data }) => track(data) })
56
- */
57
- export interface FormCallbackOptions<TFieldKeys extends string = string> {
58
- onBeforeSubmit?: SubmitCallback<TFieldKeys>;
59
- onSuccess?: SuccessCallback<TFieldKeys>;
60
- onError?: ErrorCallback;
61
- }
62
- export interface SubmitPipelineConfig {
63
- client: Picked;
64
- experienceInstance: ExperienceInstance;
65
- formId: string;
66
- title: Store<string>;
67
- stepStore: Store<ExperienceStep | null>;
68
- fieldsStore: Store<Field[]>;
69
- goToNextStep: EventCallable<void>;
70
- }
71
- export interface SubmitPipeline {
72
- submitEvent: EventCallable<SubmitEventWithCurrentTarget>;
73
- isFormSubmitting: Store<boolean>;
74
- onBeforeSubmit: (callback: SubmitCallback) => () => void;
75
- onSuccess: (callback: SuccessCallback) => () => void;
76
- onError: (callback: ErrorCallback) => () => void;
77
- /**
78
- * Fired when a submit attempt starts — callers use this to clear validation state.
79
- * Separating this from `submitEvent` keeps the pipeline decoupled from the
80
- * validation module's internal stores.
81
- */
82
- submitStarted: Event<void>;
83
- /**
84
- * Fired when commit returns validation errors — callers write these to
85
- * `fieldErrorsStore` in the validation module.
86
- */
87
- validationErrorsReceived: Event<ValidationError[]>;
88
- }
89
- /**
90
- * Creates the submit pipeline for a form instance.
91
- *
92
- * Manages the full lifecycle of a form submission, including emitting event bus
93
- * calls, running data-transform callbacks, committing responses, running
94
- * success/error callbacks, and navigating to the next step.
95
- *
96
- * Returns coordination events (`submitStarted`, `validationErrorsReceived`) that the
97
- * caller wires to the validation module to keep validation state in sync without
98
- * the pipeline needing direct access to validation stores.
99
- *
100
- * @param {SubmitPipelineConfig} config - The submit pipeline configuration.
101
- * @param {Picked} config.client - The Picked client instance.
102
- * @param {ExperienceInstance} config.experienceInstance - The experience instance.
103
- * @param {string} config.formId - The form identifier.
104
- * @param {Store<string>} config.title - Store containing the form title.
105
- * @param {Store<ExperienceStep | null>} config.stepStore - Store containing the current step.
106
- * @param {Store<Field[]>} config.fieldsStore - Store containing the form fields.
107
- * @param {EventCallable<void>} config.goToNextStep - Event to trigger navigation to the next step.
108
- * @returns {SubmitPipeline} The submit pipeline with events, stores, and callback registration.
109
- * @example
110
- * ```ts
111
- * const pipeline = createSubmitPipeline(config)
112
- * pipeline.onSuccess(({ data }) => console.log(data))
113
- * ```
114
- */
115
- export declare function createSubmitPipeline({ client, experienceInstance, formId, title, stepStore, fieldsStore, goToNextStep, }: SubmitPipelineConfig): SubmitPipeline;
116
- //# sourceMappingURL=create-submit-pipeline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"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"}
@@ -1,19 +0,0 @@
1
- /** @file Step field evaluation — resolves field and option visibility conditions. */
2
- import type { Field } from '../entities/field/field';
3
- import type { Picked } from '../picked';
4
- import { evaluateRuleLogic } from '../utils/rules-logic';
5
- /**
6
- * Evaluates field and option conditions, returning only the fields that should be visible.
7
- *
8
- * @template T
9
- * @param {Picked} client - The Picked client instance for condition evaluation.
10
- * @param {T[]} fields - The fields to filter by their conditions.
11
- * @param {Parameters<typeof evaluateRuleLogic>[2]} [context] - Optional context object passed to the rule evaluator.
12
- * @returns {Promise<T[]>} The filtered array of visible fields with conditional options resolved.
13
- * @example
14
- * ```typescript
15
- * const visibleFields = await getStepFields(client, step.fields, { cartTotal: 50 })
16
- * ```
17
- */
18
- export declare function getStepFields<T extends Field>(client: Picked, fields: T[], context?: Parameters<typeof evaluateRuleLogic>[2]): Promise<T[]>;
19
- //# sourceMappingURL=get-step-fields.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-step-fields.d.ts","sourceRoot":"","sources":["../../../src/form/get-step-fields.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AA8CxD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,KAAK,EACjD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAChD,OAAO,CAAC,CAAC,EAAE,CAAC,CAoDd"}
@@ -1,11 +0,0 @@
1
- /** @file Public surface of `@picked/client/form`. */
2
- export { buildResponsesFromFormData } from './build-responses';
3
- export { getStepFields } from './get-step-fields';
4
- export { createFieldEvaluator } from './create-field-evaluator';
5
- export { createFieldValidation } from './create-field-validation';
6
- export type { FieldValidation } from './create-field-validation';
7
- export { createSubmitPipeline } from './create-submit-pipeline';
8
- export type { SubmitPipelineConfig, SubmitPipeline, SubmitEventWithCurrentTarget, SuccessCallback, ErrorCallback, SubmitCallback, FormCallbackOptions, } from './create-submit-pipeline';
9
- export { createForm, getEventValue } from './create-form';
10
- export type { CreateFormDeps, FormField, FormInstance } from './create-form';
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/form/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,YAAY,EACV,oBAAoB,EACpB,cAAc,EACd,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACzD,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA"}
@@ -1,146 +0,0 @@
1
- /**
2
- * @file Memoized condition evaluator plus a reactive condition-results store.
3
- *
4
- * The results store is keyed by a stable, key-order-independent hash of the rule, so the
5
- * server's selection (`serialize`) and the client's hydration share results without
6
- * re-evaluating. A cache hit reads synchronously (driving SSR render and the first
7
- * client paint); a miss evaluates asynchronously and writes the result back, which
8
- * propagates reactively to subscribers. Conditions that reference an action are exempt from the
9
- * cache: they re-evaluate on every call so the action's side effect runs each time.
10
- */
11
- import { type Store } from 'effector';
12
- import type { Condition } from '../entities/condition/condition';
13
- import type { LogicObject, LogicRule, LogicValue } from '../logic-engine';
14
- import type { Picked } from '../picked';
15
- /** A condition rule that may be json-logic, a raw logic value, or unset. */
16
- type ConditionRule = LogicRule | LogicValue | undefined;
17
- /**
18
- * Produces a stable, key-order-independent string hash of a logic rule for use as a cache key.
19
- *
20
- * Object keys are sorted recursively, arrays preserve their order, and `undefined` is
21
- * normalised to `null`. Equivalent rules with reordered keys hash identically; rules that
22
- * differ in any value or array order hash differently.
23
- *
24
- * @param {ConditionRule} rule - The rule to hash.
25
- * @returns {string} A deterministic string key for the rule.
26
- * @example
27
- * hashRule({ '==': [1, 1] }) // '{"==":[1,1]}'
28
- */
29
- export declare function hashRule(rule: ConditionRule): string;
30
- /**
31
- * Reactive store of memoized condition-evaluation results, keyed by rule hash.
32
- */
33
- export interface ConditionResults {
34
- /** Reactive store mapping rule hashes to their boolean evaluation result. */
35
- store: Store<Record<string, boolean>>;
36
- /** Writes a single hash-to-result entry into the store. */
37
- set: (payload: {
38
- hash: string;
39
- result: boolean;
40
- }) => void;
41
- /** Bulk-seeds the store from a snapshot of hash-to-result entries, such as the server snapshot. */
42
- seed: (results: Record<string, boolean>) => void;
43
- /** Synchronously reads the current result for a key, or `undefined` when absent. */
44
- peek: (hash: string) => boolean | undefined;
45
- /** Clears every stored result (for example between server `serialize` calls on a reused client). */
46
- reset: () => void;
47
- }
48
- /**
49
- * Creates a reactive condition-results store keyed by rule hash, mirroring the entity-index
50
- * factory pattern.
51
- *
52
- * @returns {ConditionResults} A condition-results store with set, seed, peek, and reset.
53
- * @example
54
- * const results = createConditionResults()
55
- * results.set({ hash: 'h1', result: true })
56
- * results.peek('h1') // true
57
- */
58
- export declare function createConditionResults(): ConditionResults;
59
- /**
60
- * Determines whether a rule references an action anywhere in its tree.
61
- *
62
- * Actions are injected into the evaluation context under the `actions` namespace and invoked via
63
- * `{ invoke: [{ var: 'actions.<key>' }] }`. Because actions have side effects, a rule that
64
- * references one cannot be memoised: its result must be re-resolved on every evaluation so the
65
- * side effect re-runs.
66
- *
67
- * @param {unknown} value - The rule fragment to inspect.
68
- * @returns {boolean} True when the fragment references the `actions` namespace anywhere.
69
- * @example
70
- * ruleReferencesAction({ invoke: [{ var: 'actions.track' }] }) // true
71
- */
72
- export declare function ruleReferencesAction(value: unknown): boolean;
73
- /**
74
- * Extracts the keys of every composed condition reference (`{ var: 'conditions.<key>' }`) found
75
- * anywhere in a rule tree.
76
- *
77
- * @param {unknown} value - The rule fragment to inspect.
78
- * @returns {string[]} The referenced condition keys (duplicates possible; callers dedupe).
79
- * @example
80
- * extractConditionKeys({ invoke: [{ var: 'conditions.is-home' }] }) // ['is-home']
81
- */
82
- export declare function extractConditionKeys(value: unknown): string[];
83
- /**
84
- * Determines whether a rule references an action directly, or transitively through composed
85
- * condition references by walking into each referenced condition's logic. Rules that reach an action
86
- * must bypass the result cache so the action's side effect re-runs on every evaluation.
87
- *
88
- * @param {unknown} value - The rule fragment to inspect.
89
- * @param {Record<string, Condition>} conditionsByKey - All available conditions indexed by key.
90
- * @param {Set<string>} [visited] - Condition keys already inspected; guards against reference cycles.
91
- * @returns {boolean} True when an action is reachable directly or through a composed condition.
92
- * @example
93
- * ruleReferencesActionDeep({ invoke: [{ var: 'conditions.b' }] }, conditionsByKey)
94
- */
95
- export declare function ruleReferencesActionDeep(value: unknown, conditionsByKey: Record<string, Condition>, visited?: Set<string>): boolean;
96
- /**
97
- * Evaluates a condition rule with memoization against the client's `conditionResults` store.
98
- *
99
- * Every rule (including `undefined`/`null`, empty, and boolean gates) is hashed and its result
100
- * cached, so callers can read it synchronously via `conditionResults.peek(hashRule(rule))` (which
101
- * `<ExperienceSlot>` relies on for slot selection, such as an experience with no condition). A cache hit
102
- * returns the stored value; a miss resolves the gate (evaluating non-empty logic rules via
103
- * `evaluateRuleLogic`), writes the result back to the store (propagating reactively), and returns it.
104
- *
105
- * Rules that reference an action (a `var` under the `actions` namespace) are never read from or
106
- * written to the cache: actions have side effects that must re-run on every evaluation, so caching
107
- * their result would suppress those effects.
108
- *
109
- * @param {Picked} client - The Picked client providing the evaluation context and results store.
110
- * @param {ConditionRule} rule - The condition rule to evaluate.
111
- * @param {object} [options] - Optional evaluation options.
112
- * @param {LogicObject} [options.context] - Context overrides merged into the evaluation (e.g. URL location).
113
- * @returns {Promise<boolean>} Whether the condition resolves truthy.
114
- * @example
115
- * const active = await evaluateConditionMemo(client, { '==': [1, 1] })
116
- */
117
- export declare function evaluateConditionMemo(client: Picked, rule: ConditionRule, options?: {
118
- context?: LogicObject;
119
- }): Promise<boolean>;
120
- /**
121
- * Determines whether an experience is active by AND-ing the optional client precondition, the
122
- * optional client condition, and the experience's own condition through the memoized evaluator.
123
- *
124
- * This is the DOM-free analogue of `shouldInitialiseFx` used for slot-based and server-side
125
- * selection: each unset gate is treated as passing.
126
- *
127
- * @param {Picked} client - The Picked client providing the evaluation context and results store.
128
- * @param {object} experience - The experience to test.
129
- * @param {LogicRule | LogicValue} [experience.condition] - The experience's decision logic.
130
- * @param {object} [options] - Optional gate inputs.
131
- * @param {LogicObject} [options.context] - Context overrides merged into every evaluation.
132
- * @param {LogicRule | LogicValue} [options.precondition] - The client-level precondition gate.
133
- * @param {LogicRule | LogicValue} [options.condition] - The client-level condition gate.
134
- * @returns {Promise<boolean>} Whether the experience is active for the given context.
135
- * @example
136
- * const active = await isExperienceActive(client, { condition: exp.condition }, { context })
137
- */
138
- export declare function isExperienceActive(client: Picked, experience: {
139
- condition?: LogicRule | LogicValue;
140
- }, options?: {
141
- context?: LogicObject;
142
- precondition?: LogicRule | LogicValue;
143
- condition?: LogicRule | LogicValue;
144
- }): Promise<boolean>;
145
- export {};
146
- //# sourceMappingURL=condition-selection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"condition-selection.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/condition-selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAOvC,4EAA4E;AAC5E,KAAK,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAA;AA6CvD;;;;;;;;;;;GAWG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6EAA6E;IAC7E,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACrC,2DAA2D;IAC3D,GAAG,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;IACzD,mGAAmG;IACnG,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IAChD,oFAAoF;IACpF,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS,CAAA;IAC3C,oGAAoG;IACpG,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAmFD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,IAAI,gBAAgB,CAEzD;AAoDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAe5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAgB7D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,EACd,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAC1C,OAAO,GAAE,GAAG,CAAC,MAAM,CAAa,GAC/B,OAAO,CAqBT;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,aAAa,EACnB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,WAAW,CAAA;CAAE,GAClC,OAAO,CAAC,OAAO,CAAC,CAuBlB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE;IAAE,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CAAE,EAClD,OAAO,CAAC,EAAE;IACR,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACrC,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACnC,GACA,OAAO,CAAC,OAAO,CAAC,CAYlB"}
@@ -1,48 +0,0 @@
1
- /** @file Lifecycle module — owns the SDK start chain as an effector event graph. */
2
- import { type Effect, type EventCallable, type StoreWritable } from 'effector';
3
- import type { Picked } from '../picked';
4
- import type { LogicRule } from '../logic-engine';
5
- /** Discrete stages of the SDK lifecycle. */
6
- export type LifecycleStage = 'idle' | 'starting' | 'ready' | 'failed';
7
- /** A logic-engine gate rule, a literal boolean override, or `undefined` to indicate no gate is configured. */
8
- type GateConfig = LogicRule | boolean | undefined;
9
- /** Public effector units exposed by the lifecycle module. */
10
- interface Lifecycle {
11
- /** Public trigger — fires the start chain. `await allSettled(start, { scope })` resolves once the chain has fully settled. */
12
- start: EventCallable<void>;
13
- /** Reactive store of the readiness flag. */
14
- readyStore: StoreWritable<boolean>;
15
- /** Reactive store of the precondition-gate result (`undefined` until `start` is fired). */
16
- preconditionPassedStore: StoreWritable<boolean | undefined>;
17
- /** Reactive store of the condition-gate result (`undefined` until `start` is fired). */
18
- conditionPassedStore: StoreWritable<boolean | undefined>;
19
- /** Reactive store of the current lifecycle stage. */
20
- lifecycleStageStore: StoreWritable<LifecycleStage>;
21
- /** Event — registers a plugin onStart hook effect. */
22
- registerPluginStartHook: EventCallable<Effect<void, void, Error>>;
23
- /** Event — sets the precondition gate rule (called once during construction). */
24
- setPrecondition: EventCallable<GateConfig>;
25
- /** Event — sets the condition gate rule (called once during construction). */
26
- setCondition: EventCallable<GateConfig>;
27
- }
28
- /**
29
- * Creates the lifecycle module for a Picked client. Owns the start chain as an effector
30
- * event graph: `start` triggers a fan-out of effects (plugin hooks, domInteractive)
31
- * whose `.done` events drive the next phases via `sample`.
32
- *
33
- * @param {object} params - Factory params.
34
- * @param {Picked} params.client - The Picked client instance.
35
- * @returns {Lifecycle} The lifecycle module exposing public events and read-only reactive stores.
36
- * @example
37
- * ```typescript
38
- * const lifecycle = createLifecycle({ client })
39
- * lifecycle.setPrecondition(myRule)
40
- * lifecycle.start()
41
- * await allSettled(lifecycle.start, { scope })
42
- * ```
43
- */
44
- export declare function createLifecycle(params: {
45
- client: Picked;
46
- }): Lifecycle;
47
- export {};
48
- //# sourceMappingURL=lifecycle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/lifecycle.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,OAAO,EAOL,KAAK,MAAM,EACX,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AAEjB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAMhD,4CAA4C;AAC5C,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAA;AAErE,8GAA8G;AAC9G,KAAK,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAA;AAEjD,6DAA6D;AAC7D,UAAU,SAAS;IACjB,8HAA8H;IAC9H,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;IAE1B,4CAA4C;IAC5C,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IAClC,2FAA2F;IAC3F,uBAAuB,EAAE,aAAa,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IAC3D,wFAAwF;IACxF,oBAAoB,EAAE,aAAa,CAAC,OAAO,GAAG,SAAS,CAAC,CAAA;IACxD,qDAAqD;IACrD,mBAAmB,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAElD,sDAAsD;IACtD,uBAAuB,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;IAEjE,iFAAiF;IACjF,eAAe,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IAC1C,8EAA8E;IAC9E,YAAY,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;CACxC;AAuOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAErE"}
@@ -1,25 +0,0 @@
1
- /** @file Effector effect that evaluates a json-logic rule against the client's reactive state. */
2
- import { type Effect } from 'effector';
3
- import type { LogicObject, LogicRule } from '../logic-engine';
4
- import type { Picked } from '../picked';
5
- /** Parameters for `evaluateRuleLogicFx` — the rule to evaluate and an optional context override. */
6
- export interface EvaluateRuleLogicParams {
7
- rule: LogicRule;
8
- context?: LogicObject;
9
- }
10
- /**
11
- * Creates an effector effect that evaluates a json-logic rule against the client's reactive state. The effect uses `attach({ source })` so all reads are scope-aware and reactive — no `.getState()` calls.
12
- *
13
- * @param {object} params - Factory params.
14
- * @param {Picked} params.client - The Picked client instance whose stores back the evaluation context.
15
- * @returns {Effect<EvaluateRuleLogicParams, unknown, Error>} An effect that evaluates a rule and resolves to the result.
16
- * @example
17
- * ```typescript
18
- * const evaluateRuleLogicFx = createEvaluateRuleLogicFx({ client })
19
- * const result = await evaluateRuleLogicFx({ rule: someRule, context: { extra: 'data' } })
20
- * ```
21
- */
22
- export declare function createEvaluateRuleLogicFx(params: {
23
- client: Picked;
24
- }): Effect<EvaluateRuleLogicParams, unknown, Error>;
25
- //# sourceMappingURL=rules-logic.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules-logic.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/rules-logic.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,KAAK,EAAgB,WAAW,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAA;AAEvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,oGAAoG;AACpG,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,CAAA;IACf,OAAO,CAAC,EAAE,WAAW,CAAA;CACtB;AAyID;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,MAAM,EAAE,MAAM,CAAA;CACf,GAAG,MAAM,CAAC,uBAAuB,EAAE,OAAO,EAAE,KAAK,CAAC,CAElD"}
@@ -1,38 +0,0 @@
1
- /** @file State snapshot store — derives an immutable `StateSnapshot` from the client's reactive entity stores via `combine`. */
2
- import { type Store } from 'effector';
3
- import type { Picked } from '../picked';
4
- import type { Field, FieldValue } from '../entities/field/field';
5
- /** Immutable snapshot of the current client state, suitable for passing to user-supplied predicates, actions, and rule evaluators. */
6
- export interface StateSnapshot {
7
- client: Picked;
8
- location?: Window['location'];
9
- document?: Window['document'];
10
- sessionStorage?: Window['sessionStorage'];
11
- localStorage?: Window['localStorage'];
12
- responses: {
13
- fieldKey: string;
14
- value: FieldValue | undefined;
15
- }[];
16
- fields: Field[];
17
- }
18
- /**
19
- * Creates a reactive store that always reflects the current client state — responses, fields, browser globals, and the client reference.
20
- *
21
- * Consumers reading the snapshot inside an effect should use `attach({ source: stateSnapshotStore })` rather than `.getState()` so reads remain scope-aware and reactive.
22
- *
23
- * @param {object} params - Factory params.
24
- * @param {Picked} params.client - The Picked client instance to derive the snapshot from.
25
- * @returns {Store<StateSnapshot>} A derived store of the current state snapshot.
26
- * @example
27
- * ```typescript
28
- * const stateSnapshotStore = createStateSnapshotStore({ client })
29
- * const evaluateFx = attach({
30
- * source: stateSnapshotStore,
31
- * effect: (snapshot, rule) => evaluate(snapshot, rule),
32
- * })
33
- * ```
34
- */
35
- export declare function createStateSnapshotStore(params: {
36
- client: Picked;
37
- }): Store<StateSnapshot>;
38
- //# sourceMappingURL=state-snapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"state-snapshot.d.ts","sourceRoot":"","sources":["../../../src/lifecycle/state-snapshot.ts"],"names":[],"mappings":"AAAA,gIAAgI;AAChI,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEhE,sIAAsI;AACtI,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAA;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAA;IACrC,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM,CAAA;QAChB,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;KAC9B,EAAE,CAAA;IACH,MAAM,EAAE,KAAK,EAAE,CAAA;CAChB;AA4BD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,aAAa,CAAC,CAEzF"}
@@ -1,3 +0,0 @@
1
- /** @file Public entrypoint for the dom-observer plugin. */
2
- export { domObserverPlugin } from './plugin';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/dom-observer/index.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA"}