@picked/client 0.0.117-next.2 → 0.0.117-next.3

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 (331) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/{api-C5CZCjIM.js → api-CAMCri0i.js} +1 -1
  3. package/dist/{api-CLrjQCaV.cjs → api-CHD6Xo3F.cjs} +1 -1
  4. package/dist/cjs/client.d.ts +161 -0
  5. package/dist/cjs/client.d.ts.map +1 -0
  6. package/dist/cjs/data-source/api.d.ts +60 -0
  7. package/dist/cjs/data-source/api.d.ts.map +1 -0
  8. package/dist/cjs/data-source/preview-unavailable.d.ts +21 -0
  9. package/dist/cjs/data-source/preview-unavailable.d.ts.map +1 -0
  10. package/dist/cjs/data-source/provider.d.ts +108 -0
  11. package/dist/cjs/data-source/provider.d.ts.map +1 -0
  12. package/dist/cjs/data-source/registry.d.ts +26 -0
  13. package/dist/cjs/data-source/registry.d.ts.map +1 -0
  14. package/dist/cjs/data-source/request-observer.d.ts +75 -0
  15. package/dist/cjs/data-source/request-observer.d.ts.map +1 -0
  16. package/dist/cjs/data-source/virtual-data.d.ts +19 -0
  17. package/dist/cjs/data-source/virtual-data.d.ts.map +1 -0
  18. package/dist/cjs/entities/action/action.d.ts +156 -0
  19. package/dist/cjs/entities/action/action.d.ts.map +1 -0
  20. package/dist/cjs/entities/component/component.d.ts +91 -0
  21. package/dist/cjs/entities/component/component.d.ts.map +1 -0
  22. package/dist/cjs/entities/component/lazyComponent.d.ts +11 -0
  23. package/dist/cjs/entities/component/lazyComponent.d.ts.map +1 -0
  24. package/dist/cjs/entities/condition/condition.d.ts +29 -0
  25. package/dist/cjs/entities/condition/condition.d.ts.map +1 -0
  26. package/dist/cjs/entities/content/content.d.ts +53 -0
  27. package/dist/cjs/entities/content/content.d.ts.map +1 -0
  28. package/dist/cjs/entities/content/reference.d.ts +101 -0
  29. package/dist/cjs/entities/content/reference.d.ts.map +1 -0
  30. package/dist/cjs/entities/experience/experience.d.ts +224 -0
  31. package/dist/cjs/entities/experience/experience.d.ts.map +1 -0
  32. package/dist/cjs/entities/experience-instance/action-result.d.ts +69 -0
  33. package/dist/cjs/entities/experience-instance/action-result.d.ts.map +1 -0
  34. package/dist/cjs/entities/experience-instance/experience-instance.d.ts +112 -0
  35. package/dist/cjs/entities/experience-instance/experience-instance.d.ts.map +1 -0
  36. package/dist/cjs/entities/feature/feature.d.ts +158 -0
  37. package/dist/cjs/entities/feature/feature.d.ts.map +1 -0
  38. package/dist/cjs/entities/field/field.d.ts +129 -0
  39. package/dist/cjs/entities/field/field.d.ts.map +1 -0
  40. package/dist/cjs/entities/field/policies.d.ts +35 -0
  41. package/dist/cjs/entities/field/policies.d.ts.map +1 -0
  42. package/dist/cjs/entities/framework/framework.d.ts +45 -0
  43. package/dist/cjs/entities/framework/framework.d.ts.map +1 -0
  44. package/dist/cjs/entities/history/history.d.ts +25 -0
  45. package/dist/cjs/entities/history/history.d.ts.map +1 -0
  46. package/dist/cjs/entities/plugin/plugin.d.ts +50 -0
  47. package/dist/cjs/entities/plugin/plugin.d.ts.map +1 -0
  48. package/dist/cjs/entities/predicate/predicate.d.ts +48 -0
  49. package/dist/cjs/entities/predicate/predicate.d.ts.map +1 -0
  50. package/dist/cjs/entities/response/response-validation.d.ts +75 -0
  51. package/dist/cjs/entities/response/response-validation.d.ts.map +1 -0
  52. package/dist/cjs/entities/response/response.d.ts +69 -0
  53. package/dist/cjs/entities/response/response.d.ts.map +1 -0
  54. package/dist/cjs/entities/session/session.d.ts +55 -0
  55. package/dist/cjs/entities/session/session.d.ts.map +1 -0
  56. package/dist/cjs/entities/step/step.d.ts +56 -0
  57. package/dist/cjs/entities/step/step.d.ts.map +1 -0
  58. package/dist/cjs/entities/workspace/workspace.d.ts +37 -0
  59. package/dist/cjs/entities/workspace/workspace.d.ts.map +1 -0
  60. package/dist/cjs/exports.d.ts +33 -0
  61. package/dist/cjs/exports.d.ts.map +1 -0
  62. package/dist/cjs/form/build-responses.d.ts +18 -0
  63. package/dist/cjs/form/build-responses.d.ts.map +1 -0
  64. package/dist/cjs/form/create-field-evaluator.d.ts +28 -0
  65. package/dist/cjs/form/create-field-evaluator.d.ts.map +1 -0
  66. package/dist/cjs/form/create-field-validation.d.ts +60 -0
  67. package/dist/cjs/form/create-field-validation.d.ts.map +1 -0
  68. package/dist/cjs/form/create-form.d.ts +153 -0
  69. package/dist/cjs/form/create-form.d.ts.map +1 -0
  70. package/dist/cjs/form/create-submit-pipeline.d.ts +116 -0
  71. package/dist/cjs/form/create-submit-pipeline.d.ts.map +1 -0
  72. package/dist/cjs/form/get-step-fields.d.ts +19 -0
  73. package/dist/cjs/form/get-step-fields.d.ts.map +1 -0
  74. package/dist/cjs/form/index.d.ts +11 -0
  75. package/dist/cjs/form/index.d.ts.map +1 -0
  76. package/dist/cjs/index.d.ts +27 -0
  77. package/dist/cjs/index.d.ts.map +1 -0
  78. package/dist/cjs/index.js +2 -2
  79. package/dist/cjs/lifecycle/condition-selection.d.ts +146 -0
  80. package/dist/cjs/lifecycle/condition-selection.d.ts.map +1 -0
  81. package/dist/cjs/lifecycle/lifecycle.d.ts +48 -0
  82. package/dist/cjs/lifecycle/lifecycle.d.ts.map +1 -0
  83. package/dist/cjs/lifecycle/rules-logic.d.ts +25 -0
  84. package/dist/cjs/lifecycle/rules-logic.d.ts.map +1 -0
  85. package/dist/cjs/lifecycle/state-snapshot.d.ts +38 -0
  86. package/dist/cjs/lifecycle/state-snapshot.d.ts.map +1 -0
  87. package/dist/cjs/logic-engine.d.ts +38 -0
  88. package/dist/cjs/logic-engine.d.ts.map +1 -0
  89. package/dist/cjs/package.json +3 -0
  90. package/dist/cjs/picked.d.ts +468 -0
  91. package/dist/cjs/picked.d.ts.map +1 -0
  92. package/dist/cjs/plugins/create-experience/create-experience.d.ts +221 -0
  93. package/dist/cjs/plugins/create-experience/create-experience.d.ts.map +1 -0
  94. package/dist/cjs/plugins/create-experience/index.d.ts +6 -0
  95. package/dist/cjs/plugins/create-experience/index.d.ts.map +1 -0
  96. package/dist/cjs/plugins/create-experience/plugin.d.ts +9 -0
  97. package/dist/cjs/plugins/create-experience/plugin.d.ts.map +1 -0
  98. package/dist/cjs/plugins/create-experience/serialization.d.ts +6 -0
  99. package/dist/cjs/plugins/create-experience/serialization.d.ts.map +1 -0
  100. package/dist/cjs/plugins/dom-observer/index.d.ts +3 -0
  101. package/dist/cjs/plugins/dom-observer/index.d.ts.map +1 -0
  102. package/dist/cjs/plugins/dom-observer/plugin.d.ts +50 -0
  103. package/dist/cjs/plugins/dom-observer/plugin.d.ts.map +1 -0
  104. package/dist/cjs/plugins/dynamic-experiences/hash.d.ts +105 -0
  105. package/dist/cjs/plugins/dynamic-experiences/hash.d.ts.map +1 -0
  106. package/dist/cjs/plugins/dynamic-experiences/index.d.ts +8 -0
  107. package/dist/cjs/plugins/dynamic-experiences/index.d.ts.map +1 -0
  108. package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
  109. package/dist/cjs/plugins/dynamic-experiences/plugin.d.ts +53 -0
  110. package/dist/cjs/plugins/dynamic-experiences/plugin.d.ts.map +1 -0
  111. package/dist/cjs/plugins/dynamic-experiences/types.d.ts +48 -0
  112. package/dist/cjs/plugins/dynamic-experiences/types.d.ts.map +1 -0
  113. package/dist/cjs/plugins/experience-browser-storage/index.d.ts +2 -0
  114. package/dist/cjs/plugins/experience-browser-storage/index.d.ts.map +1 -0
  115. package/dist/cjs/plugins/experience-browser-storage/plugin.d.ts +7 -0
  116. package/dist/cjs/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
  117. package/dist/cjs/plugins/history-browser-storage/index.d.ts +2 -0
  118. package/dist/cjs/plugins/history-browser-storage/index.d.ts.map +1 -0
  119. package/dist/cjs/plugins/history-browser-storage/plugin.d.ts +7 -0
  120. package/dist/cjs/plugins/history-browser-storage/plugin.d.ts.map +1 -0
  121. package/dist/cjs/plugins/responses-browser-storage/index.d.ts +2 -0
  122. package/dist/cjs/plugins/responses-browser-storage/index.d.ts.map +1 -0
  123. package/dist/cjs/plugins/responses-browser-storage/plugin.d.ts +18 -0
  124. package/dist/cjs/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
  125. package/dist/cjs/plugins/responses-indexeddb/index.d.ts +2 -0
  126. package/dist/cjs/plugins/responses-indexeddb/index.d.ts.map +1 -0
  127. package/dist/cjs/plugins/responses-indexeddb/plugin.d.ts +3 -0
  128. package/dist/cjs/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
  129. package/dist/cjs/plugins/single-page-app/index.d.ts +3 -0
  130. package/dist/cjs/plugins/single-page-app/index.d.ts.map +1 -0
  131. package/dist/cjs/plugins/single-page-app/plugin.d.ts +32 -0
  132. package/dist/cjs/plugins/single-page-app/plugin.d.ts.map +1 -0
  133. package/dist/cjs/plugins/telemetry/emit.d.ts +18 -0
  134. package/dist/cjs/plugins/telemetry/emit.d.ts.map +1 -0
  135. package/dist/cjs/plugins/telemetry/index.d.ts +4 -0
  136. package/dist/cjs/plugins/telemetry/index.d.ts.map +1 -0
  137. package/dist/cjs/plugins/telemetry/plugin-summary.d.ts +10 -0
  138. package/dist/cjs/plugins/telemetry/plugin-summary.d.ts.map +1 -0
  139. package/dist/cjs/plugins/telemetry/plugin.d.ts +47 -0
  140. package/dist/cjs/plugins/telemetry/plugin.d.ts.map +1 -0
  141. package/dist/cjs/plugins/web-components/index.d.ts +2 -0
  142. package/dist/cjs/plugins/web-components/index.d.ts.map +1 -0
  143. package/dist/cjs/plugins/web-components/plugin.d.ts +4 -0
  144. package/dist/cjs/plugins/web-components/plugin.d.ts.map +1 -0
  145. package/dist/cjs/plugins/window-object/index.d.ts +2 -0
  146. package/dist/cjs/plugins/window-object/index.d.ts.map +1 -0
  147. package/dist/cjs/plugins/window-object/plugin.d.ts +9 -0
  148. package/dist/cjs/plugins/window-object/plugin.d.ts.map +1 -0
  149. package/dist/cjs/preview/index.d.ts +18 -0
  150. package/dist/cjs/preview/index.d.ts.map +1 -0
  151. package/dist/cjs/preview-bridge/index.d.ts +14 -0
  152. package/dist/cjs/preview-bridge/index.d.ts.map +1 -0
  153. package/dist/cjs/preview-channel.d.ts +16 -0
  154. package/dist/cjs/preview-channel.d.ts.map +1 -0
  155. package/dist/cjs/preview-receiver/apply-ops.d.ts +32 -0
  156. package/dist/cjs/preview-receiver/apply-ops.d.ts.map +1 -0
  157. package/dist/cjs/preview-receiver/index.d.ts +32 -0
  158. package/dist/cjs/preview-receiver/index.d.ts.map +1 -0
  159. package/dist/cjs/preview-receiver/protocol.d.ts +69 -0
  160. package/dist/cjs/preview-receiver/protocol.d.ts.map +1 -0
  161. package/dist/cjs/schema-registry.d.ts +240 -0
  162. package/dist/cjs/schema-registry.d.ts.map +1 -0
  163. package/dist/cjs/server/hydrate.d.ts +21 -0
  164. package/dist/cjs/server/hydrate.d.ts.map +1 -0
  165. package/dist/cjs/server/index.d.ts +28 -0
  166. package/dist/cjs/server/index.d.ts.map +1 -0
  167. package/dist/cjs/server/index.js +1 -1
  168. package/dist/cjs/server/serialize.d.ts +89 -0
  169. package/dist/cjs/server/serialize.d.ts.map +1 -0
  170. package/dist/cjs/storage.d.ts +6 -0
  171. package/dist/cjs/storage.d.ts.map +1 -0
  172. package/dist/cjs/typed-content.d.ts +30 -0
  173. package/dist/cjs/typed-content.d.ts.map +1 -0
  174. package/dist/cjs/utils/api-url.d.ts +2 -0
  175. package/dist/cjs/utils/api-url.d.ts.map +1 -0
  176. package/dist/cjs/utils/client-telemetry.d.ts +25 -0
  177. package/dist/cjs/utils/client-telemetry.d.ts.map +1 -0
  178. package/dist/cjs/utils/content-path.d.ts +37 -0
  179. package/dist/cjs/utils/content-path.d.ts.map +1 -0
  180. package/dist/cjs/utils/dom.d.ts +20 -0
  181. package/dist/cjs/utils/dom.d.ts.map +1 -0
  182. package/dist/cjs/utils/events.d.ts +129 -0
  183. package/dist/cjs/utils/events.d.ts.map +1 -0
  184. package/dist/cjs/utils/global-obj.d.ts +10 -0
  185. package/dist/cjs/utils/global-obj.d.ts.map +1 -0
  186. package/dist/cjs/utils/html-asset-value.d.ts +20 -0
  187. package/dist/cjs/utils/html-asset-value.d.ts.map +1 -0
  188. package/dist/cjs/utils/id.d.ts +11 -0
  189. package/dist/cjs/utils/id.d.ts.map +1 -0
  190. package/dist/cjs/utils/indexed-db.d.ts +12 -0
  191. package/dist/cjs/utils/indexed-db.d.ts.map +1 -0
  192. package/dist/cjs/utils/inert-script-report.d.ts +40 -0
  193. package/dist/cjs/utils/inert-script-report.d.ts.map +1 -0
  194. package/dist/cjs/utils/logger.d.ts +3 -0
  195. package/dist/cjs/utils/logger.d.ts.map +1 -0
  196. package/dist/cjs/utils/node-tree/get-next-node-from-action.d.ts +25 -0
  197. package/dist/cjs/utils/node-tree/get-next-node-from-action.d.ts.map +1 -0
  198. package/dist/cjs/utils/node-tree/get-next-node-from-condition.d.ts +17 -0
  199. package/dist/cjs/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
  200. package/dist/cjs/utils/node-tree/get-next-node.d.ts +3 -0
  201. package/dist/cjs/utils/node-tree/get-next-node.d.ts.map +1 -0
  202. package/dist/cjs/utils/node-tree/get-origin-node.d.ts +3 -0
  203. package/dist/cjs/utils/node-tree/get-origin-node.d.ts.map +1 -0
  204. package/dist/cjs/utils/node-tree/min-max-steps-to-leaf.d.ts +21 -0
  205. package/dist/cjs/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -0
  206. package/dist/cjs/utils/node-tree/min-max-steps-to-origin.d.ts +23 -0
  207. package/dist/cjs/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -0
  208. package/dist/cjs/utils/node-tree/next-reachable-step-nodes.d.ts +37 -0
  209. package/dist/cjs/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -0
  210. package/dist/cjs/utils/node-tree/node-adjacency.d.ts +50 -0
  211. package/dist/cjs/utils/node-tree/node-adjacency.d.ts.map +1 -0
  212. package/dist/cjs/utils/node-tree/node-tree-index.d.ts +57 -0
  213. package/dist/cjs/utils/node-tree/node-tree-index.d.ts.map +1 -0
  214. package/dist/cjs/utils/nodes.d.ts +7 -0
  215. package/dist/cjs/utils/nodes.d.ts.map +1 -0
  216. package/dist/cjs/utils/object.d.ts +49 -0
  217. package/dist/cjs/utils/object.d.ts.map +1 -0
  218. package/dist/cjs/utils/picked-config.d.ts +39 -0
  219. package/dist/cjs/utils/picked-config.d.ts.map +1 -0
  220. package/dist/cjs/utils/preview-session.d.ts +12 -0
  221. package/dist/cjs/utils/preview-session.d.ts.map +1 -0
  222. package/dist/cjs/utils/rehydrate-scripts.d.ts +50 -0
  223. package/dist/cjs/utils/rehydrate-scripts.d.ts.map +1 -0
  224. package/dist/cjs/utils/render-string.d.ts +24 -0
  225. package/dist/cjs/utils/render-string.d.ts.map +1 -0
  226. package/dist/cjs/utils/rules-logic.d.ts +36 -0
  227. package/dist/cjs/utils/rules-logic.d.ts.map +1 -0
  228. package/dist/cjs/utils/search-params.d.ts +26 -0
  229. package/dist/cjs/utils/search-params.d.ts.map +1 -0
  230. package/dist/cjs/utils/storage.d.ts +385 -0
  231. package/dist/cjs/utils/storage.d.ts.map +1 -0
  232. package/dist/cjs/utils/supports.d.ts +97 -0
  233. package/dist/cjs/utils/supports.d.ts.map +1 -0
  234. package/dist/cjs/utils/user-timing.d.ts +21 -0
  235. package/dist/cjs/utils/user-timing.d.ts.map +1 -0
  236. package/dist/cjs/utils/version.d.ts +2 -0
  237. package/dist/cjs/utils/version.d.ts.map +1 -0
  238. package/dist/esm/index.js +2 -2
  239. package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
  240. package/dist/esm/server/index.js +2 -2
  241. package/dist/{plugin-Dz0AK06x.cjs → plugin-DtnnNA8P.cjs} +1 -1
  242. package/dist/{plugin-CBPJLN1i.js → plugin-VMABGIme.js} +2 -2
  243. package/dist/{preview-unavailable-BY8kYUmt.cjs → preview-unavailable-BltZN6QC.cjs} +1 -1
  244. package/dist/{preview-unavailable-CO9Uzrse.js → preview-unavailable-DafuFhkR.js} +1 -1
  245. package/dist/{provider-CoBbEsiR.js → provider-7k5rARpK.js} +1 -1
  246. package/dist/{provider-Cy7W3XR9.cjs → provider-C7vI-t92.cjs} +1 -1
  247. package/dist/types/client.d.ts +7 -7
  248. package/dist/types/data-source/provider.d.ts +3 -3
  249. package/dist/types/data-source/registry.d.ts +1 -1
  250. package/dist/types/data-source/virtual-data.d.ts +1 -1
  251. package/dist/types/entities/action/action.d.ts +3 -3
  252. package/dist/types/entities/component/component.d.ts +4 -4
  253. package/dist/types/entities/condition/condition.d.ts +1 -1
  254. package/dist/types/entities/content/reference.d.ts +1 -1
  255. package/dist/types/entities/experience/experience.d.ts +7 -7
  256. package/dist/types/entities/experience-instance/action-result.d.ts +1 -1
  257. package/dist/types/entities/experience-instance/experience-instance.d.ts +6 -6
  258. package/dist/types/entities/feature/feature.d.ts +2 -2
  259. package/dist/types/entities/field/field.d.ts +2 -2
  260. package/dist/types/entities/framework/framework.d.ts +3 -3
  261. package/dist/types/entities/history/history.d.ts +1 -1
  262. package/dist/types/entities/plugin/plugin.d.ts +1 -1
  263. package/dist/types/entities/predicate/predicate.d.ts +2 -2
  264. package/dist/types/entities/response/response-validation.d.ts +2 -2
  265. package/dist/types/entities/response/response.d.ts +5 -5
  266. package/dist/types/entities/step/step.d.ts +1 -1
  267. package/dist/types/exports.d.ts +19 -19
  268. package/dist/types/form/build-responses.d.ts +1 -1
  269. package/dist/types/form/create-field-evaluator.d.ts +2 -2
  270. package/dist/types/form/create-field-validation.d.ts +3 -3
  271. package/dist/types/form/create-form.d.ts +5 -5
  272. package/dist/types/form/create-submit-pipeline.d.ts +6 -6
  273. package/dist/types/form/get-step-fields.d.ts +3 -3
  274. package/dist/types/form/index.d.ts +9 -9
  275. package/dist/types/index.d.ts +25 -25
  276. package/dist/types/lifecycle/condition-selection.d.ts +3 -3
  277. package/dist/types/lifecycle/lifecycle.d.ts +2 -2
  278. package/dist/types/lifecycle/rules-logic.d.ts +2 -2
  279. package/dist/types/lifecycle/state-snapshot.d.ts +2 -2
  280. package/dist/types/picked.d.ts +74 -74
  281. package/dist/types/plugins/create-experience/create-experience.d.ts +8 -8
  282. package/dist/types/plugins/create-experience/index.d.ts +4 -4
  283. package/dist/types/plugins/create-experience/plugin.d.ts +2 -2
  284. package/dist/types/plugins/dom-observer/index.d.ts +1 -1
  285. package/dist/types/plugins/dom-observer/plugin.d.ts +1 -1
  286. package/dist/types/plugins/dynamic-experiences/index.d.ts +3 -3
  287. package/dist/types/plugins/dynamic-experiences/plugin.d.ts +3 -3
  288. package/dist/types/plugins/experience-browser-storage/index.d.ts +1 -1
  289. package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -1
  290. package/dist/types/plugins/history-browser-storage/index.d.ts +1 -1
  291. package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -1
  292. package/dist/types/plugins/responses-browser-storage/index.d.ts +1 -1
  293. package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -1
  294. package/dist/types/plugins/responses-indexeddb/index.d.ts +1 -1
  295. package/dist/types/plugins/responses-indexeddb/plugin.d.ts +1 -1
  296. package/dist/types/plugins/single-page-app/index.d.ts +2 -2
  297. package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
  298. package/dist/types/plugins/telemetry/index.d.ts +2 -2
  299. package/dist/types/plugins/telemetry/plugin.d.ts +1 -1
  300. package/dist/types/plugins/web-components/index.d.ts +1 -1
  301. package/dist/types/plugins/web-components/plugin.d.ts +1 -1
  302. package/dist/types/plugins/window-object/index.d.ts +1 -1
  303. package/dist/types/plugins/window-object/plugin.d.ts +2 -2
  304. package/dist/types/preview/index.d.ts +6 -6
  305. package/dist/types/preview-channel.d.ts +1 -1
  306. package/dist/types/preview-receiver/index.d.ts +1 -1
  307. package/dist/types/preview-receiver/protocol.d.ts +1 -1
  308. package/dist/types/schema-registry.d.ts +2 -2
  309. package/dist/types/server/hydrate.d.ts +2 -2
  310. package/dist/types/server/index.d.ts +9 -9
  311. package/dist/types/server/serialize.d.ts +1 -1
  312. package/dist/types/storage.d.ts +1 -1
  313. package/dist/types/typed-content.d.ts +2 -2
  314. package/dist/types/utils/client-telemetry.d.ts +1 -1
  315. package/dist/types/utils/dom.d.ts +1 -1
  316. package/dist/types/utils/events.d.ts +5 -5
  317. package/dist/types/utils/global-obj.d.ts +1 -1
  318. package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +1 -1
  319. package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +1 -1
  320. package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
  321. package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
  322. package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +2 -2
  323. package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +2 -2
  324. package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +2 -2
  325. package/dist/types/utils/node-tree/node-adjacency.d.ts +1 -1
  326. package/dist/types/utils/node-tree/node-tree-index.d.ts +2 -2
  327. package/dist/types/utils/nodes.d.ts +1 -1
  328. package/dist/types/utils/picked-config.d.ts +1 -1
  329. package/dist/types/utils/rules-logic.d.ts +2 -2
  330. package/dist/types/utils/storage.d.ts +1 -1
  331. package/package.json +141 -56
@@ -0,0 +1,18 @@
1
+ import type { Plugin } from '../../entities/plugin/plugin.js';
2
+ interface ResponsesBrowserStoragePlugin {
3
+ storage?: 'local' | 'session';
4
+ }
5
+ /**
6
+ * Persists field responses to browser storage and restores them on the next page load.
7
+ *
8
+ * @param {ResponsesBrowserStoragePlugin} [options] - Plugin options.
9
+ * @param {'local' | 'session'} [options.storage] - Which browser store to persist to.
10
+ * @returns {Plugin} The plugin to pass to `createClient({ plugins })`.
11
+ * @example
12
+ * ```ts
13
+ * createClient({ plugins: [responsesBrowserStoragePlugin({ storage: 'local' })] })
14
+ * ```
15
+ */
16
+ export declare const responsesBrowserStoragePlugin: ({ storage, }?: ResponsesBrowserStoragePlugin) => Plugin;
17
+ export {};
18
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/responses-browser-storage/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,6BAA6B;IACrC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAC9B;AAsED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,6BAA6B,kBAEvC,6BAA6B,KAAQ,MA4FvC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { responsesIndexedDBPlugin } from './plugin.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/responses-indexeddb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Plugin } from '../../entities/plugin/plugin.js';
2
+ export declare const responsesIndexedDBPlugin: () => Plugin;
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/responses-indexeddb/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAO1D,eAAO,MAAM,wBAAwB,QAAO,MAyE3C,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { singlePageAppPlugin } from './plugin.js';
2
+ export type * from './plugin.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAC9C,mBAAmB,UAAU,CAAA"}
@@ -0,0 +1,32 @@
1
+ import type { Plugin } from '../../entities/plugin/plugin.js';
2
+ interface SinglePageAppPluginOptions {
3
+ /**
4
+ * Enables monitoring of browser history events (pushState, replaceState, popstate)
5
+ * to automatically restart the client when navigating in single-page applications.
6
+ * Only `true` is supported at this time.
7
+ */
8
+ instrumentHistory: true;
9
+ }
10
+ /**
11
+ * Enables compatibility with Single Page Applications (SPAs).
12
+ * This plugin monitors browser history events and automatically triggers client re-rendering
13
+ * when navigation occurs within the SPA.
14
+ *
15
+ * @param {SinglePageAppPluginOptions} options - Configuration options for the SPA plugin
16
+ * @returns {Plugin} The plugin.
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * createClient({
21
+ * plugins: [
22
+ * singlePageAppPlugin({
23
+ * instrumentHistory: true
24
+ * })
25
+ * ]
26
+ * })
27
+ * ```
28
+ */
29
+ export declare const singlePageAppPlugin: (_options: SinglePageAppPluginOptions) => Plugin;
30
+ export declare function instrumentHistory(callback: () => void): void;
31
+ export {};
32
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/single-page-app/plugin.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAM1D,UAAU,0BAA0B;IAClC;;;;OAIG;IACH,iBAAiB,EAAE,IAAI,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,mBAAmB,aAAc,0BAA0B,KAAG,MAa1E,CAAA;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAwC5D"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file The lazily-imported half of the telemetry plugin.
3
+ *
4
+ * This module holds the only import of the OTLP emitter, so bundlers give it
5
+ * its own chunk and the plugin can load it after first paint.
6
+ */
7
+ import { type SpanAttributes, type TelemetrySpan } from '@picked/telemetry';
8
+ /**
9
+ * Sends a batch of spans and resolves once the attempt has finished.
10
+ *
11
+ * @param {string} [endpoint] - OTLP HTTP trace endpoint. Defaults to Picked's collector.
12
+ * @param {SpanAttributes} resource - Resource attributes describing this SDK instance.
13
+ * @param {TelemetrySpan[]} spans - Spans to send.
14
+ * @returns {Promise<void>} Resolves when the batch has been attempted.
15
+ * @example await flushSpans(undefined, { 'service.name': 'picked-sdk' }, spans)
16
+ */
17
+ export declare function flushSpans(endpoint: string | undefined, resource: SpanAttributes, spans: TelemetrySpan[]): Promise<void>;
18
+ //# sourceMappingURL=emit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../../../src/plugins/telemetry/emit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA0B,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEnG;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,aAAa,EAAE,GACrB,OAAO,CAAC,IAAI,CAAC,CAYf"}
@@ -0,0 +1,4 @@
1
+ /** @file Public entry for the opt-in browser telemetry plugin. */
2
+ export { telemetryPlugin, TELEMETRY_PLUGIN_NAME } from './plugin.js';
3
+ export type * from './plugin.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/telemetry/index.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AACjE,mBAAmB,UAAU,CAAA"}
@@ -0,0 +1,10 @@
1
+ /** @file Summarises a client's registered plugin names for telemetry. */
2
+ /**
3
+ * Sorts and caps a client's registered plugin names for reporting.
4
+ *
5
+ * @param {string[]} registered - Every plugin name registered on the client.
6
+ * @returns {string[]} The names, sorted, capped at the reporting limit.
7
+ * @example summarisePlugins(['window', 'analytics']) // ['analytics', 'window']
8
+ */
9
+ export declare function summarisePlugins(registered: string[]): string[];
10
+ //# sourceMappingURL=plugin-summary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin-summary.d.ts","sourceRoot":"","sources":["../../../../src/plugins/telemetry/plugin-summary.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAKzE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE/D"}
@@ -0,0 +1,47 @@
1
+ import type { Plugin } from '../../entities/plugin/plugin.js';
2
+ /** Plugin name under which this plugin registers. */
3
+ export declare const TELEMETRY_PLUGIN_NAME = "telemetry";
4
+ /**
5
+ * Spans held before a flush is forced.
6
+ *
7
+ * A session buffers between flushes, so this is what bounds the buffer on a
8
+ * long-lived page that keeps making delivery API requests.
9
+ */
10
+ export declare const MAX_BUFFERED_SPANS = 50;
11
+ /**
12
+ * How long the batch waits after its first span for others to join it.
13
+ *
14
+ * The ready flush goes out before a delivery API request settles, and a session
15
+ * makes far fewer requests than {@link MAX_BUFFERED_SPANS} — so this timer is
16
+ * what sends a delivery span while the session is still running, leaving the
17
+ * page-hidden flush as the backstop for whatever the last few seconds hold.
18
+ */
19
+ export declare const FLUSH_DELAY_MS = 5000;
20
+ /** Longest error message kept on a span; a longer one is cut. */
21
+ export declare const MAX_ERROR_MESSAGE_LENGTH = 200;
22
+ /** Options for {@link telemetryPlugin}. */
23
+ export interface TelemetryPluginOptions {
24
+ /**
25
+ * Fraction of sessions to trace, between 0 and 1.
26
+ *
27
+ * Decided once per client, before the first request, since it also decides
28
+ * whether `traceparent` is sent.
29
+ *
30
+ * @default 1
31
+ */
32
+ sampleRate?: number;
33
+ /** OTLP HTTP trace endpoint. Defaults to Picked's collector. */
34
+ endpoint?: string;
35
+ }
36
+ /**
37
+ * Creates the browser telemetry plugin.
38
+ *
39
+ * @param {TelemetryPluginOptions} [options] - Sampling and endpoint overrides.
40
+ * @returns {Plugin} A plugin to register with the Picked client.
41
+ * @example
42
+ * ```typescript
43
+ * const client = createClient({ plugins: [telemetryPlugin({ sampleRate: 0.05 })] })
44
+ * ```
45
+ */
46
+ export declare function telemetryPlugin(options?: TelemetryPluginOptions): Plugin;
47
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/telemetry/plugin.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAK1D,qDAAqD;AACrD,eAAO,MAAM,qBAAqB,cAAc,CAAA;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,KAAK,CAAA;AAEpC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,OAAO,CAAA;AAElC,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAwDD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,MAAM,CAoFxE"}
@@ -0,0 +1,2 @@
1
+ export { webComponentsPlugin } from './plugin.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/web-components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,4 @@
1
+ /** @file Web Components plugin — registers a `<picked-root>` custom element that launches a Picked experience by id when connected to the DOM. */
2
+ import type { Plugin } from '../../entities/plugin/plugin.js';
3
+ export declare const webComponentsPlugin: () => Plugin;
4
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/web-components/plugin.ts"],"names":[],"mappings":"AAAA,kJAAkJ;AAClJ,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAG1D,eAAO,MAAM,mBAAmB,QAAO,MA2BtC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { windowObjectPlugin } from './plugin.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/window-object/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,9 @@
1
+ import type { Plugin } from '../../entities/plugin/plugin.js';
2
+ import type { Picked } from '../../picked.js';
3
+ declare global {
4
+ interface Window {
5
+ Picked: Picked;
6
+ }
7
+ }
8
+ export declare const windowObjectPlugin: () => Plugin;
9
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/plugins/window-object/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAG1C,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,MAAM,EAAE,MAAM,CAAA;KACf;CACF;AAED,eAAO,MAAM,kBAAkB,QAAO,MASrC,CAAA"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file Public entry for live-preview helpers.
3
+ *
4
+ * Separate from the root entry so the path parser and the ops applier never reach the bundle every
5
+ * customer page loads. Imported by the Picked dashboard, and by the SDK's own preview receiver.
6
+ *
7
+ * The wire protocol is exported from here so the embedder builds against the same declaration the
8
+ * receiver does — see `preview-receiver/protocol` for why that stays compatible with older SDKs.
9
+ * The receiver's own inbound guard is not exported: the embedder sends patches rather than
10
+ * receiving them, and leaving it out keeps this entry inside its `size-limit` budget.
11
+ */
12
+ export { formatContentPath, parseContentPath } from '../utils/content-path.js';
13
+ export type { ContentPathSegment } from '../utils/content-path.js';
14
+ export { applyContentOps } from '../preview-receiver/apply-ops.js';
15
+ export type { ContentPatchOp } from '../preview-receiver/apply-ops.js';
16
+ export { PREVIEW_CONTENT_PATCH_MESSAGE, PREVIEW_INERT_SCRIPTS_MESSAGE, PREVIEW_PROTOCOL_VERSION, PREVIEW_READY_MESSAGE, PREVIEW_RESYNC_MESSAGE, } from '../preview-receiver/protocol.js';
17
+ export type { PreviewInertScriptsMessage, PreviewReadyMessage, PreviewResyncMessage, } from '../preview-receiver/protocol.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/preview/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC3E,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,YAAY,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,8BAA8B,CAAA;AACrC,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,8BAA8B,CAAA"}
@@ -0,0 +1,14 @@
1
+ /** The `postMessage` `type` discriminator for navigation reports sent to the embedding parent frame. */
2
+ export declare const PREVIEW_NAVIGATION_MESSAGE = "picked-preview:navigation";
3
+ /**
4
+ * Starts reporting this frame's URL to the embedding parent frame: posts immediately, then again on
5
+ * every SPA navigation (`history.pushState`/`replaceState` and `popstate`). Listeners are wired at
6
+ * most once per frame, so multiple Picked clients on the same page do not double-report.
7
+ *
8
+ * @returns {() => void} A teardown function that detaches the `popstate` listener and re-arms the bridge.
9
+ * @example
10
+ * const stop = initPreviewBridge()
11
+ * // later, e.g. in a test: stop()
12
+ */
13
+ export declare function initPreviewBridge(): () => void;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/preview-bridge/index.ts"],"names":[],"mappings":"AAUA,wGAAwG;AACxG,eAAO,MAAM,0BAA0B,8BAA8B,CAAA;AAmErE;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,IAAI,CAwB9C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @file Single entry point for the live-preview channel, so the bridge and the receiver share one
3
+ * dynamic-import boundary and neither reaches production bundles.
4
+ */
5
+ import type { Picked } from './picked.js';
6
+ /**
7
+ * Starts both halves of the preview channel: the outbound bridge that reports this frame's URL to
8
+ * the dashboard, and the inbound receiver that applies the dashboard's content patches.
9
+ *
10
+ * @param {Picked} client - The Picked client whose content index receives the patches.
11
+ * @returns {() => void} Teardown that stops both halves.
12
+ * @example
13
+ * const stop = initPreviewChannel(client)
14
+ */
15
+ export declare function initPreviewChannel(client: Picked): () => void;
16
+ //# sourceMappingURL=preview-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preview-channel.d.ts","sourceRoot":"","sources":["../../src/preview-channel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAItC;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,CAQ7D"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A single path-addressed replacement inside a content record's `data`.
3
+ *
4
+ * `path` uses the format the Picked API already emits for content-data validation errors —
5
+ * `$.sections[0].data.title`. See `utils/content-path`.
6
+ */
7
+ export interface ContentPatchOp {
8
+ /** Path to the value being replaced, for example `$.sections[0].data.title`. */
9
+ path: string;
10
+ /** The replacement value. */
11
+ value: unknown;
12
+ }
13
+ /**
14
+ * Applies path-addressed replacements to a content `data` blob, returning a new blob that shares
15
+ * every untouched branch with the original.
16
+ *
17
+ * That structural sharing is the point of per-field patching: replacing the whole blob would mint a
18
+ * fresh object identity for every field on every keystroke, re-rendering every memoised consumer in
19
+ * the host app's tree. Here only the touched spine changes identity.
20
+ *
21
+ * Ops that cannot be applied — a malformed path, the root, a prototype-polluting key, an index into
22
+ * a non-array, an out-of-range index — are skipped. A patch arrives from another frame, so a bad op
23
+ * must degrade to a no-op rather than throw inside a customer's page.
24
+ *
25
+ * @param {Record<string, unknown>} data - The content `data` blob to patch.
26
+ * @param {readonly ContentPatchOp[]} ops - The replacements to apply, in order.
27
+ * @returns {Record<string, unknown>} The patched blob, or `data` unchanged when no op applied.
28
+ * @example
29
+ * applyContentOps({ headline: 'old' }, [{ path: '$.headline', value: 'new' }])
30
+ */
31
+ export declare function applyContentOps(data: Record<string, unknown>, ops: readonly ContentPatchOp[]): Record<string, unknown>;
32
+ //# sourceMappingURL=apply-ops.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-ops.d.ts","sourceRoot":"","sources":["../../../src/preview-receiver/apply-ops.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,KAAK,EAAE,OAAO,CAAA;CACf;AA4DD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,SAAS,cAAc,EAAE,GAC7B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAUzB"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file Live-preview receiver: applies content patches pushed by the Picked dashboard.
3
+ *
4
+ * Reached only through a dynamic `import()` the client performs when a preview session is detected,
5
+ * so it stays out of production bundles. It touches only `client.contents`, which is
6
+ * framework-agnostic, so React, Svelte and script-tag installs all get live preview without any
7
+ * per-binding code.
8
+ *
9
+ * Trust model: the customer's page does not opt in, so the origin check is the only defence and it
10
+ * cannot come from the page itself. The API issues `previewEmbedderOrigins` alongside the preview
11
+ * project config; every inbound message is validated against that list, and the handshake is posted
12
+ * only to those origins. Never `document.referrer` (it becomes this frame's own origin after an
13
+ * in-frame navigation) and never a wildcard target.
14
+ *
15
+ * The base blob is the SDK's own preview-token fetch, so the receiver announces readiness only once
16
+ * content is registered and patches always land on a server-projected base.
17
+ */
18
+ import type { Picked } from '../picked.js';
19
+ /**
20
+ * Starts the live-preview receiver: announces readiness to the allowlisted embedder origins once
21
+ * content is registered, then applies inbound content patches to the client's content index.
22
+ *
23
+ * Wired at most once per frame, so several Picked clients on one page cannot double-apply a patch.
24
+ *
25
+ * @param {Picked} client - The Picked client whose content index receives the patches.
26
+ * @returns {() => void} Teardown that detaches every listener and re-arms the receiver.
27
+ * @example
28
+ * const stop = initPreviewReceiver(client)
29
+ * // later, e.g. in a test: stop()
30
+ */
31
+ export declare function initPreviewReceiver(client: Picked): () => void;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/preview-receiver/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AA4CvC;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,CAgH9D"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * @file Wire protocol for the Picked live-preview channel.
3
+ *
4
+ * **Additive-only.** A message type is never removed, a field's meaning never changes, and an
5
+ * optional field is never promoted to required — new capability arrives as a new optional field or
6
+ * a new message type, and both ends ignore anything they do not recognise. That is what lets an old
7
+ * SDK in the wild degrade in capability rather than fail, and why there is no version floor to keep
8
+ * current. `protocolVersion` on the handshake is diagnostics, not a gate.
9
+ */
10
+ import type { ContentPatchOp } from './apply-ops.js';
11
+ /** Current protocol version. Reported on the handshake for support and telemetry only. */
12
+ export declare const PREVIEW_PROTOCOL_VERSION = 1;
13
+ /** Receiver → embedder: the frame is listening and content is registered. */
14
+ export declare const PREVIEW_READY_MESSAGE = "picked-preview:ready";
15
+ /** Embedder → receiver: path-addressed replacements for one content record. */
16
+ export declare const PREVIEW_CONTENT_PATCH_MESSAGE = "picked-preview:content-patch";
17
+ /** Receiver → embedder: a sequence gap was detected; resend the dirty paths. */
18
+ export declare const PREVIEW_RESYNC_MESSAGE = "picked-preview:resync";
19
+ /** Receiver → embedder: cumulative count of inserted subtrees whose scripts were neutralised. */
20
+ export declare const PREVIEW_INERT_SCRIPTS_MESSAGE = "picked-preview:inert-scripts";
21
+ /** Handshake posted by the receiver to each allowlisted origin. */
22
+ export interface PreviewReadyMessage {
23
+ /** Discriminator. */
24
+ type: typeof PREVIEW_READY_MESSAGE;
25
+ /** Protocol version this receiver speaks. Diagnostics only. */
26
+ protocolVersion: number;
27
+ /** Content record ids currently registered, so the embedder knows what it can patch. */
28
+ contentIds: string[];
29
+ }
30
+ /** Patch posted by the embedder for one content record. Narrowed to by {@link isContentPatchMessage}. */
31
+ interface PreviewContentPatchMessage {
32
+ /** Discriminator. */
33
+ type: typeof PREVIEW_CONTENT_PATCH_MESSAGE;
34
+ /** The content record to patch. */
35
+ contentId: string;
36
+ /** Path-addressed replacements, applied in order. */
37
+ ops: ContentPatchOp[];
38
+ /** Monotonic per-record sequence number, used only to detect a dropped message. */
39
+ seq: number;
40
+ }
41
+ /** Resync request posted by the receiver after a sequence gap. */
42
+ export interface PreviewResyncMessage {
43
+ /** Discriminator. */
44
+ type: typeof PREVIEW_RESYNC_MESSAGE;
45
+ /** The content record whose sequence broke. */
46
+ contentId: string;
47
+ /** The last sequence number successfully applied. */
48
+ lastSeq: number;
49
+ }
50
+ /** Inert-script report posted by the receiver. */
51
+ export interface PreviewInertScriptsMessage {
52
+ /** Discriminator. */
53
+ type: typeof PREVIEW_INERT_SCRIPTS_MESSAGE;
54
+ /** Cumulative count of inserted subtrees whose scripts were neutralised this session. */
55
+ total: number;
56
+ }
57
+ /**
58
+ * Type guard for an inbound content-patch message.
59
+ *
60
+ * Validates structurally rather than trusting the sender: the message crosses a frame boundary, and
61
+ * an unrecognised or malformed one is ignored rather than throwing inside a customer's page.
62
+ *
63
+ * @param {unknown} data - The `MessageEvent.data` payload.
64
+ * @returns {boolean} True when the payload is a well-formed content-patch message.
65
+ * @example isContentPatchMessage(event.data)
66
+ */
67
+ export declare function isContentPatchMessage(data: unknown): data is PreviewContentPatchMessage;
68
+ export {};
69
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/preview-receiver/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,0FAA0F;AAC1F,eAAO,MAAM,wBAAwB,IAAI,CAAA;AAEzC,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,yBAAyB,CAAA;AAC3D,+EAA+E;AAC/E,eAAO,MAAM,6BAA6B,iCAAiC,CAAA;AAC3E,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,0BAA0B,CAAA;AAC7D,iGAAiG;AACjG,eAAO,MAAM,6BAA6B,iCAAiC,CAAA;AAE3E,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,IAAI,EAAE,OAAO,qBAAqB,CAAA;IAClC,+DAA+D;IAC/D,eAAe,EAAE,MAAM,CAAA;IACvB,wFAAwF;IACxF,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB;AAED,yGAAyG;AACzG,UAAU,0BAA0B;IAClC,qBAAqB;IACrB,IAAI,EAAE,OAAO,6BAA6B,CAAA;IAC1C,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,qDAAqD;IACrD,GAAG,EAAE,cAAc,EAAE,CAAA;IACrB,mFAAmF;IACnF,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,qBAAqB;IACrB,IAAI,EAAE,OAAO,sBAAsB,CAAA;IACnC,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,kDAAkD;AAClD,MAAM,WAAW,0BAA0B;IACzC,qBAAqB;IACrB,IAAI,EAAE,OAAO,6BAA6B,CAAA;IAC1C,yFAAyF;IACzF,KAAK,EAAE,MAAM,CAAA;CACd;AA8BD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,0BAA0B,CAavF"}