@picked/client 0.0.1-dev.1789541668638 → 0.0.1-next.2

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 +739 -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,109 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to read a referenced entry
7
-
8
- This guide shows you how to read the content that a
9
- [Reference field](/reference/dashboard/content/models#reference-fields) points at. You
10
- need a component that renders a step first. See
11
- [How to render a step form](/how-to/render-a-step-form).
12
-
13
- A Reference field holds a pointer, and not the content. The entry travels beside the
14
- content of the step, so you resolve the pointer against the content of the client.
15
-
16
- ## 1. Resolve a single reference
17
-
18
- Pass the raw field value to `useReference()` in React, or to `getReference()` in Svelte.
19
-
20
- :::code-group
21
-
22
- ```tsx [React]
23
- import { useReference, useStepContent, useStoreGlobal } from '@picked/react/hooks'
24
-
25
- export function ProductCategory() {
26
- const content = useStepContent()
27
- const category = useStoreGlobal(useReference(content?.category))
28
-
29
- if (!category) return null
30
-
31
- return <span>{String(category.data.name ?? '')}</span>
32
- }
33
- ```
34
-
35
- ```svelte [Svelte]
36
- <script lang="ts">
37
- import { getStepContent, getReference } from '@picked/svelte/hooks'
38
-
39
- const content = getStepContent()
40
- const category = getReference(content.map((c) => c?.category ?? null, { skipVoid: false }))
41
- </script>
42
-
43
- {#if $category}
44
- <span>{$category.data.name ?? ''}</span>
45
- {/if}
46
- ```
47
-
48
- :::
49
-
50
- In Svelte, pass a store and not a plain value. Content arrives after the component
51
- starts. A plain value therefore holds the result at "not set".
52
-
53
- ## 2. Resolve a repeatable reference
54
-
55
- Use `useReferences()` or `getReferences()`. They give a list in field order.
56
-
57
- :::code-group
58
-
59
- ```tsx [React]
60
- import { useReferences, useStepContent, useStoreGlobal } from '@picked/react/hooks'
61
-
62
- export function ProductCategories() {
63
- const content = useStepContent()
64
- const categories = useStoreGlobal(useReferences(content?.categories))
65
-
66
- return (
67
- <ul>
68
- {categories.map((category) => (
69
- <li key={category.id}>{String(category.data.name ?? '')}</li>
70
- ))}
71
- </ul>
72
- )
73
- }
74
- ```
75
-
76
- ```svelte [Svelte]
77
- <script lang="ts">
78
- import { getStepContent, getReferences } from '@picked/svelte/hooks'
79
-
80
- const content = getStepContent()
81
- const categories = getReferences(content.map((c) => c?.categories ?? null, { skipVoid: false }))
82
- </script>
83
-
84
- <ul>
85
- {#each $categories as category (category.id)}
86
- <li>{category.data.name ?? ''}</li>
87
- {/each}
88
- </ul>
89
- ```
90
-
91
- :::
92
-
93
- The list holds no empty places, so you need no check for each item.
94
-
95
- ## Handle a target that does not resolve
96
-
97
- A single reference gives an empty result when Picked cannot resolve the target. A
98
- repeatable reference leaves the item out of the list.
99
-
100
- This happens when somebody deleted the target, when the target belongs to another
101
- workspace, or when the chain of references is deeper than the limit.
102
-
103
- Render something else for the empty case, as the React example above does.
104
-
105
- ## Related
106
-
107
- - [Content](/reference/sdk/content) — every hook and its return type.
108
- - [About content references](/explanation/content-references) — why the entry travels separately.
109
- - [How to point one entry at another](/how-to/point-one-entry-at-another) — the dashboard side.
@@ -1,55 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to register a component
7
-
8
- This guide shows you how to connect a component in your application to an experience in
9
- the dashboard.
10
-
11
- ## Steps
12
-
13
- 1. Wrap your component with the adapter for your framework.
14
- 2. Pass it in the `components` object of `createClient()`.
15
- 3. Use the same key as the component name of the experience.
16
-
17
- :::code-group
18
-
19
- ```tsx [React]
20
- import { createClient } from 'picked'
21
- import { adaptReactComponent } from '@picked/react'
22
- import { MyWidget } from './MyWidget'
23
-
24
- const picked = createClient({
25
- projectId: 'your-project-id',
26
- components: {
27
- MyWidget: adaptReactComponent(MyWidget),
28
- },
29
- })
30
- ```
31
-
32
- ```ts [Svelte]
33
- import { createClient } from 'picked'
34
- import { adaptSvelteComponent } from '@picked/svelte'
35
- import MyWidget from './MyWidget.svelte'
36
-
37
- const picked = createClient({
38
- projectId: 'your-project-id',
39
- components: {
40
- MyWidget: adaptSvelteComponent(MyWidget),
41
- },
42
- })
43
- ```
44
-
45
- :::
46
-
47
- :::warning
48
- `components` takes an adapted component. A plain React or Svelte component does not work
49
- without `adaptReactComponent` or `adaptSvelteComponent`.
50
- :::
51
-
52
- ## Related
53
-
54
- - [SDK experiences](/reference/sdk/experiences) — the experience shape.
55
- - [How to install the SDK](/how-to/install-the-sdk).
@@ -1,67 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to register an action handler
7
-
8
- This guide shows you how to connect an action node in a flow to a function in your
9
- application. You need an action in your project first, with a key. See
10
- [Actions](/reference/dashboard/actions).
11
-
12
- ## 1. Register the handler
13
-
14
- Pass an `actions` object to `createClient()`. Each key must match an action key from the
15
- dashboard:
16
-
17
- ```ts
18
- import { createClient } from 'picked'
19
-
20
- const picked = createClient({
21
- projectId: 'your-project-id',
22
- actions: {
23
- 'track-signup': () => {
24
- analytics.track('signup_completed')
25
- },
26
- notify: (params) => {
27
- sendNotification(params)
28
- },
29
- },
30
- })
31
- ```
32
-
33
- The SDK calls the function that matches when the flow reaches the action node.
34
-
35
- ## 2. Throw only for a true error
36
-
37
- The flow takes the failure branch when your handler throws or its promise rejects. Throw
38
- when the request itself did not complete:
39
-
40
- ```ts
41
- 'check-eligibility': async () => {
42
- const response = await fetch('/api/eligibility')
43
- // Throw only when the request itself fails. That takes the failure branch.
44
- if (!response.ok) throw new Error('Eligibility request failed')
45
- }
46
- ```
47
-
48
- ## 3. Record a negative answer as a response
49
-
50
- A valid negative result is not a failure. An endpoint can answer `200` with a "no". Store
51
- that value as a response and branch on it with a condition instead:
52
-
53
- ```ts
54
- 'check-serviced-area': async ({ client, responses }) => {
55
- const postcode = responses.find((r) => r.fieldKey === 'postcode')?.value
56
- const { serviced } = await fetch(`/api/serviced?postcode=${postcode}`).then((r) => r.json())
57
- // Store the outcome as a response. A later condition then takes the branch.
58
- client.responses.register('is-serviced', serviced)
59
- }
60
- ```
61
-
62
- ## Related
63
-
64
- - [About how Picked works](/explanation/how-picked-works#how-an-action-decides-which-way-to-go)
65
- — why a returned `false` is a success.
66
- - [SDK actions](/reference/sdk/actions) — what the handler receives and returns.
67
- - [Actions](/reference/dashboard/actions) — the dashboard options.
@@ -1,131 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to render a step form
7
-
8
- This guide shows you how to render the fields of the active step and let a visitor submit
9
- them.
10
-
11
- ## 1. Put the steps in a router
12
-
13
- `StepRouter` watches the step state and activates the `Step` whose `id` matches.
14
-
15
- :::code-group
16
-
17
- ```tsx [React]
18
- import { StepRouter, Step } from '@picked/react/router'
19
-
20
- function MyExperience() {
21
- return (
22
- <StepRouter>
23
- <Step id="welcome">
24
- <WelcomeScreen />
25
- </Step>
26
- <Step id="contact">
27
- <ContactForm />
28
- </Step>
29
- </StepRouter>
30
- )
31
- }
32
- ```
33
-
34
- ```svelte [Svelte]
35
- <script lang="ts">
36
- import { StepRouter, Step } from '@picked/svelte/router'
37
- </script>
38
-
39
- <StepRouter>
40
- <Step id="welcome">
41
- <WelcomeScreen />
42
- </Step>
43
- <Step id="contact">
44
- <ContactForm />
45
- </Step>
46
- </StepRouter>
47
- ```
48
-
49
- :::
50
-
51
- :::note
52
- A router must hold every Step, even when there is only one Step.
53
- :::
54
-
55
- ## 2. Render the fields
56
-
57
- Bind `form.props` to your `<form>` element and map over the fields.
58
-
59
- :::code-group
60
-
61
- ```tsx [React]
62
- import { useStep, useStoreGlobal } from '@picked/react/hooks'
63
-
64
- function StepForm() {
65
- const { fields, form } = useStep()
66
- const currentFields = useStoreGlobal(fields)
67
- const isSubmitting = useStoreGlobal(form.submitting)
68
-
69
- return (
70
- <form {...form.props}>
71
- {currentFields.map((field) => (
72
- <div key={field.id}>
73
- <label htmlFor={field.id}>{field.label}</label>
74
- <input
75
- id={field.id}
76
- name={field.id}
77
- value={field.value ?? ''}
78
- onChange={field.onChange}
79
- onBlur={field.onBlur}
80
- />
81
- {field.error && field.touched && <p className="error">{field.error.userMessage}</p>}
82
- </div>
83
- ))}
84
- <button type="submit" disabled={isSubmitting}>Continue</button>
85
- </form>
86
- )
87
- }
88
- ```
89
-
90
- ```svelte [Svelte]
91
- <script lang="ts">
92
- import { getStep } from '@picked/svelte/hooks'
93
-
94
- const { fields, form } = getStep()
95
- const isSubmitting = form.submitting
96
- </script>
97
-
98
- <form {...form.props}>
99
- {#each $fields as field}
100
- <div>
101
- <label for={field.id}>{field.label}</label>
102
- <input
103
- id={field.id}
104
- name={field.id}
105
- value={field.value ?? ''}
106
- onchange={field.onChange}
107
- onblur={field.onBlur}
108
- />
109
- {#if field.error && field.touched}
110
- <p class="error">{field.error.userMessage}</p>
111
- {/if}
112
- </div>
113
- {/each}
114
- <button type="submit" disabled={$isSubmitting}>Continue</button>
115
- </form>
116
- ```
117
-
118
- :::
119
-
120
- The SDK checks a field on blur, and not while the visitor types.
121
-
122
- ## 3. Load a large step lazily
123
-
124
- Pass a dynamic import to the `component` prop of `<Step>`. The SDK does not load the
125
- content until that step becomes active.
126
-
127
- ## Related
128
-
129
- - [How to run code on a form submission](/how-to/run-code-on-a-form-submission) — the
130
- callbacks.
131
- - [SDK steps](/reference/sdk/steps) — the `StepContext` shape.
@@ -1,41 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to render an unpublished preview
7
-
8
- This guide shows you how to render draft content on your server. Your server cannot read
9
- the query string of the browser, so you must pass the token yourself.
10
-
11
- ## 1. Get the token
12
-
13
- The management API holds the preview token of a workspace in the `previewToken` field. The
14
- preview action in the dashboard also makes one for you.
15
-
16
- ## 2. Read the config with the token
17
-
18
- ```bash
19
- curl "https://api.picked.app/api/v1/projects/proj_123?preview_token=<token>"
20
- ```
21
-
22
- A preview response returns `versionId: null`. An invalid token returns `401`.
23
-
24
- ## 3. Pass the same token to `serialize()`
25
-
26
- ```ts
27
- const snapshot = await serialize(client, {
28
- projectConfig,
29
- attributes: { location: { pathname: '/promo' } },
30
- previewToken,
31
- })
32
- ```
33
-
34
- Use the same token for both requests. The configuration and the content then come from the same
35
- preview.
36
-
37
- ## Related
38
-
39
- - [About the two APIs](/explanation/the-two-apis) — how a preview stays out of the search
40
- index.
41
- - [Preview, cache, and crawlers](/reference/delivery-api/preview-caching-crawling).
@@ -1,53 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to reuse a section
7
-
8
- This guide shows you how to define a common structure one time and use it in more than
9
- one Model.
10
-
11
- ## 1. Create the section
12
-
13
- 1. Click **Pages** in the sidebar.
14
- 2. Click **Page Sections**.
15
- 3. Click **New block**.
16
- 4. Enter a **Name** and a **Key**.
17
- 5. Add your fields.
18
- 6. Click **Create block**.
19
-
20
- The **Category** is **Section** already, because you opened the list from **Page
21
- Sections**.
22
-
23
- ## 2. Accept the section in a Model
24
-
25
- 1. Open a page layout or a step layout.
26
- 2. Add a **Page Sections** field to the schema.
27
- 3. Click **Save**.
28
-
29
- The field now accepts any Block of the Section category. Make the field repeatable to
30
- build a page from a list of sections.
31
-
32
- If you want one section at a fixed place instead of a list, add a **Content block** field.
33
- Set its **Block category** to the **Section** category.
34
-
35
- ## 3. Choose the section in an entry
36
-
37
- 1. Open a content entry that uses the Model.
38
- 2. Find the field that you added.
39
- 3. Choose your Block.
40
- 4. Fill in the fields of the Block.
41
- 5. Click **Save**.
42
-
43
- :::warning
44
- An edit to a Block does not migrate the entries that use it. Check each affected content
45
- entry again, and correct every field error before you publish.
46
- :::
47
-
48
- ## Related
49
-
50
- - [About the content model](/explanation/the-content-model) — why a schema change does not
51
- migrate your data.
52
- - [Blocks](/reference/dashboard/content/blocks) — the reference.
53
- - [Models](/reference/dashboard/content/models) — every field type.
@@ -1,28 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to reuse a step, a field, or an action
7
-
8
- This guide shows you how to use one step, field, action, or condition in more than one
9
- flow. All four belong to the project, and not to the experience that you made them in.
10
-
11
- ## Steps
12
-
13
- 1. Open the flow builder for the second experience.
14
- 2. Find the step, the action, or the condition in the library on the left.
15
- 3. Drag it onto the canvas, or onto a step node for a field.
16
-
17
- The same one now appears in both flows.
18
-
19
- :::warning
20
- A change to the options applies at every place that uses it. Check the other flows before
21
- you change a shared step, field, action, or condition.
22
- :::
23
-
24
- ## Related
25
-
26
- - [Steps](/reference/dashboard/steps) — the step options.
27
- - [Fields](/reference/dashboard/fields) — the field options.
28
- - [Actions](/reference/dashboard/actions) — the action options.
@@ -1,26 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to roll back a published version
7
-
8
- This guide shows you how to make an earlier published version live again. Your current
9
- draft does not change.
10
-
11
- ## Steps
12
-
13
- 1. Open **Publish history** from the project sidebar.
14
- 2. Find the version that you want to restore.
15
- 3. Click **Restore**.
16
- 4. Read the diff preview. It compares the current live version against the one that you
17
- chose.
18
- 5. Click **Restore this version** to confirm.
19
-
20
- The restored version is live immediately.
21
-
22
- ## Related
23
-
24
- - [About workspaces and versions](/explanation/workspaces-and-versions) — why a roll-back
25
- changes no data.
26
- - [Publish history](/reference/dashboard/workspace-versioning) — the version list.
@@ -1,49 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to run an A/B test
7
-
8
- This guide shows you how to split your traffic with a feature flag and read the result in
9
- your application.
10
-
11
- Read [About feature flag allocation](/explanation/feature-flag-allocation) first. The
12
- point at which you read the feature flag decides when a visitor enters the test.
13
-
14
- ## 1. Create the feature flag
15
-
16
- 1. Open your project.
17
- 2. Click **Feature flags** in the sidebar.
18
- 3. Click **New feature flag**.
19
- 4. Enter a name.
20
- 5. Click **Create feature flag**.
21
-
22
- You cannot change the key after you create the feature flag.
23
-
24
- ## 2. Set the allocation
25
-
26
- Open the detail page of the feature flag and set these controls:
27
-
28
- 1. Turn **Enabled** on. A feature flag that is off allocates nobody.
29
- 2. Set **Weight** to the percentage of visitors that you want in the test.
30
- 3. Enter a **Description** that says what the feature flag tests.
31
-
32
- ## 3. Read the feature flag in your application
33
-
34
- See [How to read a feature flag](/how-to/read-a-feature-flag). Read it at the point where
35
- the decision matters, and not at startup.
36
-
37
- ## 4. Change the weight later
38
-
39
- 1. Change **Weight** on the detail page.
40
- 2. Increment the version.
41
-
42
- The new weight then applies to a visitor with a cached decision. Leave the version as it
43
- is to apply the new weight only to a visitor who is not allocated yet.
44
-
45
- ## Related
46
-
47
- - [About feature flag allocation](/explanation/feature-flag-allocation) — why two feature
48
- flags at the same weight give four groups, not two.
49
- - [Feature flags](/reference/dashboard/features) — the controls.
@@ -1,125 +0,0 @@
1
- ---
2
- type: how-to
3
- layout: docs
4
- ---
5
-
6
- # How to run code on a form submission
7
-
8
- This guide shows you how to act on a step submission. Pass your callbacks to `useStep()`
9
- in React, or to `getStep()` in Svelte.
10
-
11
- ## What the SDK does on submit
12
-
13
- 1. It collects the field values from the HTML form.
14
- 2. It runs each `onBeforeSubmit` callback, one after another.
15
- 3. It checks each required field and each validation rule.
16
- 4. It commits the responses to the experience state.
17
- 5. It fires `form_submit_success` or `form_submit_error` on the event bus.
18
- 6. It runs your `onSuccess` or `onError` callback.
19
- 7. It moves to the next step.
20
-
21
- ## Change the data before it is stored
22
-
23
- :::code-group
24
-
25
- ```tsx [React]
26
- const { form } = useStep({
27
- onBeforeSubmit: async (data) => ({
28
- ...data,
29
- 'email-address': String(data['email-address']).toLowerCase(),
30
- }),
31
- })
32
- ```
33
-
34
- ```svelte [Svelte]
35
- <script lang="ts">
36
- const { form } = getStep({
37
- onBeforeSubmit: async (data) => ({
38
- ...data,
39
- 'email-address': String(data['email-address']).toLowerCase(),
40
- }),
41
- })
42
- </script>
43
- ```
44
-
45
- :::
46
-
47
- :::warning
48
- An `onBeforeSubmit` callback that throws aborts the submit before the SDK commits
49
- anything, and the step does not advance. Use it for a transform and for a check. Put a
50
- side effect, such as an analytics call, in `onSuccess`.
51
- :::
52
-
53
- ## Act on the outcome
54
-
55
- :::code-group
56
-
57
- ```tsx [React]
58
- const { form } = useStep({
59
- onSuccess: ({ data }) => analytics.track('lead_captured', data),
60
- onError: (errors) => console.error('Validation errors:', errors),
61
- })
62
- ```
63
-
64
- ```svelte [Svelte]
65
- <script lang="ts">
66
- const { form } = getStep({
67
- onSuccess: ({ data }) => analytics.track('lead_captured', data),
68
- onError: (errors) => console.error('Validation errors:', errors),
69
- })
70
- </script>
71
- ```
72
-
73
- :::
74
-
75
- A callback belongs to the component that passes it, and the SDK releases it when that
76
- component unmounts. An `onSuccess` callback that throws cannot stop the flow. The SDK
77
- reports the failure as `form_submit_callback_error`.
78
-
79
- ## Choose the next step yourself
80
-
81
- Call `stopNavigation()` inside `onSuccess`, then move where you want:
82
-
83
- :::code-group
84
-
85
- ```tsx [React]
86
- const experience = useExperience()
87
-
88
- const { form } = useStep({
89
- onSuccess: ({ data, stopNavigation }) => {
90
- stopNavigation()
91
- if (data['plan-type'] === 'enterprise') {
92
- experience.goToStepById('enterprise-contact')
93
- } else {
94
- experience.goToNextStep()
95
- }
96
- },
97
- })
98
- ```
99
-
100
- ```svelte [Svelte]
101
- <script lang="ts">
102
- const experience = getExperience()
103
-
104
- const { form } = getStep({
105
- onSuccess: ({ data, stopNavigation }) => {
106
- stopNavigation()
107
- if (data['plan-type'] === 'enterprise') {
108
- experience.goToStepById('enterprise-contact')
109
- } else {
110
- experience.goToNextStep()
111
- }
112
- },
113
- })
114
- </script>
115
- ```
116
-
117
- :::
118
-
119
- `goToStepById()` takes a step `id`. `goToStepByKey()` takes the key of the step. When no
120
- step matches, the call does nothing.
121
-
122
- ## Related
123
-
124
- - [How to render a step form](/how-to/render-a-step-form).
125
- - [SDK steps](/reference/sdk/steps) — the `form` object.