@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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/{api-C5CZCjIM.js → api-CAMCri0i.js} +1 -1
- package/dist/{api-CLrjQCaV.cjs → api-CHD6Xo3F.cjs} +1 -1
- package/dist/cjs/client.d.ts +161 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/data-source/api.d.ts +60 -0
- package/dist/cjs/data-source/api.d.ts.map +1 -0
- package/dist/cjs/data-source/preview-unavailable.d.ts +21 -0
- package/dist/cjs/data-source/preview-unavailable.d.ts.map +1 -0
- package/dist/cjs/data-source/provider.d.ts +108 -0
- package/dist/cjs/data-source/provider.d.ts.map +1 -0
- package/dist/cjs/data-source/registry.d.ts +26 -0
- package/dist/cjs/data-source/registry.d.ts.map +1 -0
- package/dist/cjs/data-source/request-observer.d.ts +75 -0
- package/dist/cjs/data-source/request-observer.d.ts.map +1 -0
- package/dist/cjs/data-source/virtual-data.d.ts +19 -0
- package/dist/cjs/data-source/virtual-data.d.ts.map +1 -0
- package/dist/cjs/entities/action/action.d.ts +156 -0
- package/dist/cjs/entities/action/action.d.ts.map +1 -0
- package/dist/cjs/entities/component/component.d.ts +91 -0
- package/dist/cjs/entities/component/component.d.ts.map +1 -0
- package/dist/cjs/entities/component/lazyComponent.d.ts +11 -0
- package/dist/cjs/entities/component/lazyComponent.d.ts.map +1 -0
- package/dist/cjs/entities/condition/condition.d.ts +29 -0
- package/dist/cjs/entities/condition/condition.d.ts.map +1 -0
- package/dist/cjs/entities/content/content.d.ts +53 -0
- package/dist/cjs/entities/content/content.d.ts.map +1 -0
- package/dist/cjs/entities/content/reference.d.ts +101 -0
- package/dist/cjs/entities/content/reference.d.ts.map +1 -0
- package/dist/cjs/entities/experience/experience.d.ts +224 -0
- package/dist/cjs/entities/experience/experience.d.ts.map +1 -0
- package/dist/cjs/entities/experience-instance/action-result.d.ts +69 -0
- package/dist/cjs/entities/experience-instance/action-result.d.ts.map +1 -0
- package/dist/cjs/entities/experience-instance/experience-instance.d.ts +112 -0
- package/dist/cjs/entities/experience-instance/experience-instance.d.ts.map +1 -0
- package/dist/cjs/entities/feature/feature.d.ts +158 -0
- package/dist/cjs/entities/feature/feature.d.ts.map +1 -0
- package/dist/cjs/entities/field/field.d.ts +129 -0
- package/dist/cjs/entities/field/field.d.ts.map +1 -0
- package/dist/cjs/entities/field/policies.d.ts +35 -0
- package/dist/cjs/entities/field/policies.d.ts.map +1 -0
- package/dist/cjs/entities/framework/framework.d.ts +45 -0
- package/dist/cjs/entities/framework/framework.d.ts.map +1 -0
- package/dist/cjs/entities/history/history.d.ts +25 -0
- package/dist/cjs/entities/history/history.d.ts.map +1 -0
- package/dist/cjs/entities/plugin/plugin.d.ts +50 -0
- package/dist/cjs/entities/plugin/plugin.d.ts.map +1 -0
- package/dist/cjs/entities/predicate/predicate.d.ts +48 -0
- package/dist/cjs/entities/predicate/predicate.d.ts.map +1 -0
- package/dist/cjs/entities/response/response-validation.d.ts +75 -0
- package/dist/cjs/entities/response/response-validation.d.ts.map +1 -0
- package/dist/cjs/entities/response/response.d.ts +69 -0
- package/dist/cjs/entities/response/response.d.ts.map +1 -0
- package/dist/cjs/entities/session/session.d.ts +55 -0
- package/dist/cjs/entities/session/session.d.ts.map +1 -0
- package/dist/cjs/entities/step/step.d.ts +56 -0
- package/dist/cjs/entities/step/step.d.ts.map +1 -0
- package/dist/cjs/entities/workspace/workspace.d.ts +37 -0
- package/dist/cjs/entities/workspace/workspace.d.ts.map +1 -0
- package/dist/cjs/exports.d.ts +33 -0
- package/dist/cjs/exports.d.ts.map +1 -0
- package/dist/cjs/form/build-responses.d.ts +18 -0
- package/dist/cjs/form/build-responses.d.ts.map +1 -0
- package/dist/cjs/form/create-field-evaluator.d.ts +28 -0
- package/dist/cjs/form/create-field-evaluator.d.ts.map +1 -0
- package/dist/cjs/form/create-field-validation.d.ts +60 -0
- package/dist/cjs/form/create-field-validation.d.ts.map +1 -0
- package/dist/cjs/form/create-form.d.ts +153 -0
- package/dist/cjs/form/create-form.d.ts.map +1 -0
- package/dist/cjs/form/create-submit-pipeline.d.ts +116 -0
- package/dist/cjs/form/create-submit-pipeline.d.ts.map +1 -0
- package/dist/cjs/form/get-step-fields.d.ts +19 -0
- package/dist/cjs/form/get-step-fields.d.ts.map +1 -0
- package/dist/cjs/form/index.d.ts +11 -0
- package/dist/cjs/form/index.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +27 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/lifecycle/condition-selection.d.ts +146 -0
- package/dist/cjs/lifecycle/condition-selection.d.ts.map +1 -0
- package/dist/cjs/lifecycle/lifecycle.d.ts +48 -0
- package/dist/cjs/lifecycle/lifecycle.d.ts.map +1 -0
- package/dist/cjs/lifecycle/rules-logic.d.ts +25 -0
- package/dist/cjs/lifecycle/rules-logic.d.ts.map +1 -0
- package/dist/cjs/lifecycle/state-snapshot.d.ts +38 -0
- package/dist/cjs/lifecycle/state-snapshot.d.ts.map +1 -0
- package/dist/cjs/logic-engine.d.ts +38 -0
- package/dist/cjs/logic-engine.d.ts.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/picked.d.ts +468 -0
- package/dist/cjs/picked.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/create-experience.d.ts +221 -0
- package/dist/cjs/plugins/create-experience/create-experience.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/index.d.ts +6 -0
- package/dist/cjs/plugins/create-experience/index.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/plugin.d.ts +9 -0
- package/dist/cjs/plugins/create-experience/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/serialization.d.ts +6 -0
- package/dist/cjs/plugins/create-experience/serialization.d.ts.map +1 -0
- package/dist/cjs/plugins/dom-observer/index.d.ts +3 -0
- package/dist/cjs/plugins/dom-observer/index.d.ts.map +1 -0
- package/dist/cjs/plugins/dom-observer/plugin.d.ts +50 -0
- package/dist/cjs/plugins/dom-observer/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/hash.d.ts +105 -0
- package/dist/cjs/plugins/dynamic-experiences/hash.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.d.ts +8 -0
- package/dist/cjs/plugins/dynamic-experiences/index.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/plugin.d.ts +53 -0
- package/dist/cjs/plugins/dynamic-experiences/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/types.d.ts +48 -0
- package/dist/cjs/plugins/dynamic-experiences/types.d.ts.map +1 -0
- package/dist/cjs/plugins/experience-browser-storage/index.d.ts +2 -0
- package/dist/cjs/plugins/experience-browser-storage/index.d.ts.map +1 -0
- package/dist/cjs/plugins/experience-browser-storage/plugin.d.ts +7 -0
- package/dist/cjs/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/history-browser-storage/index.d.ts +2 -0
- package/dist/cjs/plugins/history-browser-storage/index.d.ts.map +1 -0
- package/dist/cjs/plugins/history-browser-storage/plugin.d.ts +7 -0
- package/dist/cjs/plugins/history-browser-storage/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-browser-storage/index.d.ts +2 -0
- package/dist/cjs/plugins/responses-browser-storage/index.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-browser-storage/plugin.d.ts +18 -0
- package/dist/cjs/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-indexeddb/index.d.ts +2 -0
- package/dist/cjs/plugins/responses-indexeddb/index.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-indexeddb/plugin.d.ts +3 -0
- package/dist/cjs/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/single-page-app/index.d.ts +3 -0
- package/dist/cjs/plugins/single-page-app/index.d.ts.map +1 -0
- package/dist/cjs/plugins/single-page-app/plugin.d.ts +32 -0
- package/dist/cjs/plugins/single-page-app/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/emit.d.ts +18 -0
- package/dist/cjs/plugins/telemetry/emit.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/index.d.ts +4 -0
- package/dist/cjs/plugins/telemetry/index.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/plugin-summary.d.ts +10 -0
- package/dist/cjs/plugins/telemetry/plugin-summary.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/plugin.d.ts +47 -0
- package/dist/cjs/plugins/telemetry/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/web-components/index.d.ts +2 -0
- package/dist/cjs/plugins/web-components/index.d.ts.map +1 -0
- package/dist/cjs/plugins/web-components/plugin.d.ts +4 -0
- package/dist/cjs/plugins/web-components/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/window-object/index.d.ts +2 -0
- package/dist/cjs/plugins/window-object/index.d.ts.map +1 -0
- package/dist/cjs/plugins/window-object/plugin.d.ts +9 -0
- package/dist/cjs/plugins/window-object/plugin.d.ts.map +1 -0
- package/dist/cjs/preview/index.d.ts +18 -0
- package/dist/cjs/preview/index.d.ts.map +1 -0
- package/dist/cjs/preview-bridge/index.d.ts +14 -0
- package/dist/cjs/preview-bridge/index.d.ts.map +1 -0
- package/dist/cjs/preview-channel.d.ts +16 -0
- package/dist/cjs/preview-channel.d.ts.map +1 -0
- package/dist/cjs/preview-receiver/apply-ops.d.ts +32 -0
- package/dist/cjs/preview-receiver/apply-ops.d.ts.map +1 -0
- package/dist/cjs/preview-receiver/index.d.ts +32 -0
- package/dist/cjs/preview-receiver/index.d.ts.map +1 -0
- package/dist/cjs/preview-receiver/protocol.d.ts +69 -0
- package/dist/cjs/preview-receiver/protocol.d.ts.map +1 -0
- package/dist/cjs/schema-registry.d.ts +240 -0
- package/dist/cjs/schema-registry.d.ts.map +1 -0
- package/dist/cjs/server/hydrate.d.ts +21 -0
- package/dist/cjs/server/hydrate.d.ts.map +1 -0
- package/dist/cjs/server/index.d.ts +28 -0
- package/dist/cjs/server/index.d.ts.map +1 -0
- package/dist/cjs/server/index.js +1 -1
- package/dist/cjs/server/serialize.d.ts +89 -0
- package/dist/cjs/server/serialize.d.ts.map +1 -0
- package/dist/cjs/storage.d.ts +6 -0
- package/dist/cjs/storage.d.ts.map +1 -0
- package/dist/cjs/typed-content.d.ts +30 -0
- package/dist/cjs/typed-content.d.ts.map +1 -0
- package/dist/cjs/utils/api-url.d.ts +2 -0
- package/dist/cjs/utils/api-url.d.ts.map +1 -0
- package/dist/cjs/utils/client-telemetry.d.ts +25 -0
- package/dist/cjs/utils/client-telemetry.d.ts.map +1 -0
- package/dist/cjs/utils/content-path.d.ts +37 -0
- package/dist/cjs/utils/content-path.d.ts.map +1 -0
- package/dist/cjs/utils/dom.d.ts +20 -0
- package/dist/cjs/utils/dom.d.ts.map +1 -0
- package/dist/cjs/utils/events.d.ts +129 -0
- package/dist/cjs/utils/events.d.ts.map +1 -0
- package/dist/cjs/utils/global-obj.d.ts +10 -0
- package/dist/cjs/utils/global-obj.d.ts.map +1 -0
- package/dist/cjs/utils/html-asset-value.d.ts +20 -0
- package/dist/cjs/utils/html-asset-value.d.ts.map +1 -0
- package/dist/cjs/utils/id.d.ts +11 -0
- package/dist/cjs/utils/id.d.ts.map +1 -0
- package/dist/cjs/utils/indexed-db.d.ts +12 -0
- package/dist/cjs/utils/indexed-db.d.ts.map +1 -0
- package/dist/cjs/utils/inert-script-report.d.ts +40 -0
- package/dist/cjs/utils/inert-script-report.d.ts.map +1 -0
- package/dist/cjs/utils/logger.d.ts +3 -0
- package/dist/cjs/utils/logger.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-action.d.ts +25 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-action.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-condition.d.ts +17 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-next-node.d.ts +3 -0
- package/dist/cjs/utils/node-tree/get-next-node.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-origin-node.d.ts +3 -0
- package/dist/cjs/utils/node-tree/get-origin-node.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-leaf.d.ts +21 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-origin.d.ts +23 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/next-reachable-step-nodes.d.ts +37 -0
- package/dist/cjs/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/node-adjacency.d.ts +50 -0
- package/dist/cjs/utils/node-tree/node-adjacency.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/node-tree-index.d.ts +57 -0
- package/dist/cjs/utils/node-tree/node-tree-index.d.ts.map +1 -0
- package/dist/cjs/utils/nodes.d.ts +7 -0
- package/dist/cjs/utils/nodes.d.ts.map +1 -0
- package/dist/cjs/utils/object.d.ts +49 -0
- package/dist/cjs/utils/object.d.ts.map +1 -0
- package/dist/cjs/utils/picked-config.d.ts +39 -0
- package/dist/cjs/utils/picked-config.d.ts.map +1 -0
- package/dist/cjs/utils/preview-session.d.ts +12 -0
- package/dist/cjs/utils/preview-session.d.ts.map +1 -0
- package/dist/cjs/utils/rehydrate-scripts.d.ts +50 -0
- package/dist/cjs/utils/rehydrate-scripts.d.ts.map +1 -0
- package/dist/cjs/utils/render-string.d.ts +24 -0
- package/dist/cjs/utils/render-string.d.ts.map +1 -0
- package/dist/cjs/utils/rules-logic.d.ts +36 -0
- package/dist/cjs/utils/rules-logic.d.ts.map +1 -0
- package/dist/cjs/utils/search-params.d.ts +26 -0
- package/dist/cjs/utils/search-params.d.ts.map +1 -0
- package/dist/cjs/utils/storage.d.ts +385 -0
- package/dist/cjs/utils/storage.d.ts.map +1 -0
- package/dist/cjs/utils/supports.d.ts +97 -0
- package/dist/cjs/utils/supports.d.ts.map +1 -0
- package/dist/cjs/utils/user-timing.d.ts +21 -0
- package/dist/cjs/utils/user-timing.d.ts.map +1 -0
- package/dist/cjs/utils/version.d.ts +2 -0
- package/dist/cjs/utils/version.d.ts.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +2 -2
- package/dist/{plugin-Dz0AK06x.cjs → plugin-DtnnNA8P.cjs} +1 -1
- package/dist/{plugin-CBPJLN1i.js → plugin-VMABGIme.js} +2 -2
- package/dist/{preview-unavailable-BY8kYUmt.cjs → preview-unavailable-BltZN6QC.cjs} +1 -1
- package/dist/{preview-unavailable-CO9Uzrse.js → preview-unavailable-DafuFhkR.js} +1 -1
- package/dist/{provider-CoBbEsiR.js → provider-7k5rARpK.js} +1 -1
- package/dist/{provider-Cy7W3XR9.cjs → provider-C7vI-t92.cjs} +1 -1
- package/dist/types/client.d.ts +7 -7
- package/dist/types/data-source/provider.d.ts +3 -3
- package/dist/types/data-source/registry.d.ts +1 -1
- package/dist/types/data-source/virtual-data.d.ts +1 -1
- package/dist/types/entities/action/action.d.ts +3 -3
- package/dist/types/entities/component/component.d.ts +4 -4
- package/dist/types/entities/condition/condition.d.ts +1 -1
- package/dist/types/entities/content/reference.d.ts +1 -1
- package/dist/types/entities/experience/experience.d.ts +7 -7
- package/dist/types/entities/experience-instance/action-result.d.ts +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +6 -6
- package/dist/types/entities/feature/feature.d.ts +2 -2
- package/dist/types/entities/field/field.d.ts +2 -2
- package/dist/types/entities/framework/framework.d.ts +3 -3
- package/dist/types/entities/history/history.d.ts +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +2 -2
- package/dist/types/entities/response/response-validation.d.ts +2 -2
- package/dist/types/entities/response/response.d.ts +5 -5
- package/dist/types/entities/step/step.d.ts +1 -1
- package/dist/types/exports.d.ts +19 -19
- package/dist/types/form/build-responses.d.ts +1 -1
- package/dist/types/form/create-field-evaluator.d.ts +2 -2
- package/dist/types/form/create-field-validation.d.ts +3 -3
- package/dist/types/form/create-form.d.ts +5 -5
- package/dist/types/form/create-submit-pipeline.d.ts +6 -6
- package/dist/types/form/get-step-fields.d.ts +3 -3
- package/dist/types/form/index.d.ts +9 -9
- package/dist/types/index.d.ts +25 -25
- package/dist/types/lifecycle/condition-selection.d.ts +3 -3
- package/dist/types/lifecycle/lifecycle.d.ts +2 -2
- package/dist/types/lifecycle/rules-logic.d.ts +2 -2
- package/dist/types/lifecycle/state-snapshot.d.ts +2 -2
- package/dist/types/picked.d.ts +74 -74
- package/dist/types/plugins/create-experience/create-experience.d.ts +8 -8
- package/dist/types/plugins/create-experience/index.d.ts +4 -4
- package/dist/types/plugins/create-experience/plugin.d.ts +2 -2
- package/dist/types/plugins/dom-observer/index.d.ts +1 -1
- package/dist/types/plugins/dom-observer/plugin.d.ts +1 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +3 -3
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +3 -3
- package/dist/types/plugins/experience-browser-storage/index.d.ts +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/history-browser-storage/index.d.ts +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/responses-browser-storage/index.d.ts +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/responses-indexeddb/index.d.ts +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/index.d.ts +2 -2
- package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
- package/dist/types/plugins/telemetry/index.d.ts +2 -2
- package/dist/types/plugins/telemetry/plugin.d.ts +1 -1
- package/dist/types/plugins/web-components/index.d.ts +1 -1
- package/dist/types/plugins/web-components/plugin.d.ts +1 -1
- package/dist/types/plugins/window-object/index.d.ts +1 -1
- package/dist/types/plugins/window-object/plugin.d.ts +2 -2
- package/dist/types/preview/index.d.ts +6 -6
- package/dist/types/preview-channel.d.ts +1 -1
- package/dist/types/preview-receiver/index.d.ts +1 -1
- package/dist/types/preview-receiver/protocol.d.ts +1 -1
- package/dist/types/schema-registry.d.ts +2 -2
- package/dist/types/server/hydrate.d.ts +2 -2
- package/dist/types/server/index.d.ts +9 -9
- package/dist/types/server/serialize.d.ts +1 -1
- package/dist/types/storage.d.ts +1 -1
- package/dist/types/typed-content.d.ts +2 -2
- package/dist/types/utils/client-telemetry.d.ts +1 -1
- package/dist/types/utils/dom.d.ts +1 -1
- package/dist/types/utils/events.d.ts +5 -5
- package/dist/types/utils/global-obj.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
- package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +2 -2
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +2 -2
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +2 -2
- package/dist/types/utils/node-tree/node-adjacency.d.ts +1 -1
- package/dist/types/utils/node-tree/node-tree-index.d.ts +2 -2
- package/dist/types/utils/nodes.d.ts +1 -1
- package/dist/types/utils/picked-config.d.ts +1 -1
- package/dist/types/utils/rules-logic.d.ts +2 -2
- package/dist/types/utils/storage.d.ts +1 -1
- package/package.json +141 -56
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @file Workspace entity — the Effector store of the workspace that served the registered project config, and the event that sets it. */
|
|
2
|
+
import { type EventCallable, type Store } from 'effector';
|
|
3
|
+
/** The workspace that served a project config. */
|
|
4
|
+
export interface Workspace {
|
|
5
|
+
id: string;
|
|
6
|
+
/** The published workspace version id; `null` when the workspace has no published version. */
|
|
7
|
+
versionId: string | null;
|
|
8
|
+
status: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Workspace entity exposing the reactive `Workspace` store and its setter.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const workspace = initialiseWorkspace()
|
|
16
|
+
* workspace.set({ id: 'wsp_1', versionId: 'wspv_1', status: 'live' })
|
|
17
|
+
* workspace.store.getState()?.versionId // 'wspv_1'
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export interface WorkspaceEntity {
|
|
21
|
+
/** Reactive store of the workspace; `null` until one is set. */
|
|
22
|
+
store: Store<Workspace | null>;
|
|
23
|
+
/** Event — sets the workspace. */
|
|
24
|
+
set: EventCallable<Workspace>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Initialises a workspace entity whose store starts empty.
|
|
28
|
+
*
|
|
29
|
+
* @returns {WorkspaceEntity} A ready-to-use workspace entity.
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const workspace = initialiseWorkspace()
|
|
33
|
+
* workspace.store.getState() // null
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function initialiseWorkspace(): WorkspaceEntity;
|
|
37
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../../src/entities/workspace/workspace.ts"],"names":[],"mappings":"AAAA,0IAA0I;AAC1I,OAAO,EAA4B,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAEnF,kDAAkD;AAClD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,8FAA8F;IAC9F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,CAAA;IAC9B,kCAAkC;IAClC,GAAG,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,eAAe,CAKrD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @file Public exports for the Picked SDK client package — surfaces the `Picked` class, `createClient` factory, and supporting utilities. */
|
|
2
|
+
import type { CreateClientOptions } from './client.js';
|
|
3
|
+
import { Picked } from './picked.js';
|
|
4
|
+
export { isPickedRoot } from './utils/dom.js';
|
|
5
|
+
export { rehydrateScripts, buildRehydrateBootstrap, PICKED_SCRIPT_TYPE, PICKED_MODULE_SCRIPT_TYPE, PICKED_HYDRATED_ATTR, } from './utils/rehydrate-scripts.js';
|
|
6
|
+
export { isHtmlAssetValue } from './utils/html-asset-value.js';
|
|
7
|
+
export type { HtmlAssetValue } from './utils/html-asset-value.js';
|
|
8
|
+
export { isPreviewSession, PREVIEW_TOKEN_PARAM } from './utils/preview-session.js';
|
|
9
|
+
export { PreviewUnavailableError } from './data-source/preview-unavailable.js';
|
|
10
|
+
export { onInertScriptSubtrees, reportInertScriptSubtrees, resetInertScriptReport, } from './utils/inert-script-report.js';
|
|
11
|
+
export * from './utils/supports.js';
|
|
12
|
+
export * from './utils/storage.js';
|
|
13
|
+
export type * from './utils/storage.js';
|
|
14
|
+
export { evaluateRuleLogic } from './utils/rules-logic.js';
|
|
15
|
+
export { getPickedConfig } from './utils/picked-config.js';
|
|
16
|
+
export { lazyComponent, isLazyLoader } from './entities/component/lazyComponent.js';
|
|
17
|
+
export { createPluginEffect } from './entities/plugin/plugin.js';
|
|
18
|
+
export { deriveReference, deriveReferences, isContentReference, readReferenceId, readReferenceIds, } from './entities/content/reference.js';
|
|
19
|
+
export type { ContentReference } from './entities/content/reference.js';
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new Picked client instance and binds it to the window object.
|
|
22
|
+
*
|
|
23
|
+
* @param {CreateClientOptions} options - The client context options including `organizationId` and `projectId`.
|
|
24
|
+
* @returns {Picked} The initialised Picked client instance.
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const client = createClient({ organizationId: 'org-1', projectId: 'proj-1' })
|
|
28
|
+
* client.start()
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const createClient: (options: CreateClientOptions) => Picked;
|
|
32
|
+
export type { LaunchExperienceOptions, OpenExperienceOptions, } from './entities/experience/experience.js';
|
|
33
|
+
//# sourceMappingURL=exports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAAA,8IAA8I;AAC9I,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAA;AAC3E,OAAO,EACL,qBAAqB,EACrB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,6BAA6B,CAAA;AAEpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,mBAAmB,iBAAiB,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAC7D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,GACjB,MAAM,8BAA8B,CAAA;AACrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY,YAAa,mBAAmB,KAAG,MAI3D,CAAA;AAED,YAAY,EACV,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,kCAAkC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @file Parses FormData snapshots into typed field-response records keyed by field key. */
|
|
2
|
+
import type { FieldBase, FieldValue } from '../entities/field/field.js';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a FormData snapshot into a typed record of field responses keyed by field key. Fields
|
|
5
|
+
* absent from FormData are mapped to `null`. Empty string values are mapped to `null`. Repeated
|
|
6
|
+
* entries for the same field (such as multi-select checkboxes) are merged into a typed array
|
|
7
|
+
* matching the field's declared element type. Values are coerced to the field's declared type.
|
|
8
|
+
*
|
|
9
|
+
* @param fields - The field definitions to parse against.
|
|
10
|
+
* @param formData - The FormData snapshot to parse.
|
|
11
|
+
* @returns A record of field keys to their parsed values.
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* buildResponsesFromFormData([field], new FormData(formElement))
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildResponsesFromFormData(fields: FieldBase[], formData: FormData): Record<string, FieldValue>;
|
|
18
|
+
//# sourceMappingURL=build-responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-responses.d.ts","sourceRoot":"","sources":["../../../src/form/build-responses.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAwCpE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,SAAS,EAAE,EACnB,QAAQ,EAAE,QAAQ,GACjB,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAsC5B"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** @file Reactive field evaluator — filters and re-evaluates fields when responses or step context change. */
|
|
2
|
+
import { type Store, type StoreWritable } from 'effector';
|
|
3
|
+
import type { Field, FieldValue } from '../entities/field/field.js';
|
|
4
|
+
import type { Picked } from '../picked.js';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a reactive store of evaluated fields for a given set of field keys.
|
|
7
|
+
*
|
|
8
|
+
* Fields are re-evaluated whenever:
|
|
9
|
+
* - The available field keys change (e.g. A step is entered)
|
|
10
|
+
* - Any response is committed (options may depend on prior answers)
|
|
11
|
+
* - The global field registry changes (fields registered after init)
|
|
12
|
+
* - Staged values change (field visibility conditions may reference responses.*).
|
|
13
|
+
*
|
|
14
|
+
* Evaluation runs `getStepFields` with effective responses (committed + staged) as context,
|
|
15
|
+
* so visibility conditions see live in-session values rather than only committed responses.
|
|
16
|
+
*
|
|
17
|
+
* @param client - The Picked client instance.
|
|
18
|
+
* @param fieldKeys - Store of field keys to evaluate.
|
|
19
|
+
* @param stagedValuesStore - Store of in-progress field values not yet committed.
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const { fieldsStore } = createFieldEvaluator(client, fieldKeysStore, stagedStore)
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function createFieldEvaluator(client: Picked, fieldKeys: Store<string[]>, stagedValuesStore: StoreWritable<Record<string, FieldValue>>): {
|
|
26
|
+
fieldsStore: Store<Field[]>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=create-field-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-field-evaluator.d.ts","sourceRoot":"","sources":["../../../src/form/create-field-evaluator.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,OAAO,EAA6C,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAA;AACpG,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,EAC1B,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC3D;IAAE,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CA8CjC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** @file Creates the client-side field validation slice (touched tracking, error stores, staged values). */
|
|
2
|
+
import { type EventCallable, type Store, type StoreWritable } from 'effector';
|
|
3
|
+
import type { Field, FieldValue } from '../entities/field/field.js';
|
|
4
|
+
import type { ValidationError } from '../entities/response/response.js';
|
|
5
|
+
import type { Picked } from '../picked.js';
|
|
6
|
+
export interface FieldValidation {
|
|
7
|
+
/** Dispatch on keyboard input — updates staged values and runs validation if the field has been touched. */
|
|
8
|
+
fieldInputEvent: EventCallable<{
|
|
9
|
+
fieldKey: string;
|
|
10
|
+
value: FieldValue;
|
|
11
|
+
}>;
|
|
12
|
+
/** Dispatch when a field value is committed (onchange) — updates staged values and runs validation if the field has been touched. */
|
|
13
|
+
fieldChangeEvent: EventCallable<{
|
|
14
|
+
fieldKey: string;
|
|
15
|
+
value: FieldValue;
|
|
16
|
+
}>;
|
|
17
|
+
/** Dispatch when a field loses focus — always runs full validation including required check. */
|
|
18
|
+
fieldBlurEvent: EventCallable<{
|
|
19
|
+
fieldKey: string;
|
|
20
|
+
value: FieldValue;
|
|
21
|
+
}>;
|
|
22
|
+
/** Which fields have been interacted with — used by formFieldsStore to show/hide errors. */
|
|
23
|
+
touchedStore: StoreWritable<Partial<Record<string, boolean>>>;
|
|
24
|
+
/**
|
|
25
|
+
* Per-field validation errors — written by client-side validation and overwritten
|
|
26
|
+
* by server errors on commit failure. Exposed as writable so the submit pipeline
|
|
27
|
+
* can populate server errors and reset state on new submit attempts.
|
|
28
|
+
*/
|
|
29
|
+
fieldErrorsStore: StoreWritable<Partial<Record<string, ValidationError>>>;
|
|
30
|
+
/** Flat list of all current validation errors — derived from fieldErrorsStore. */
|
|
31
|
+
formErrorsStore: Store<ValidationError[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Current in-session field values — updated on every onChange/onBlur before commit.
|
|
34
|
+
* Used as the responses context for condition evaluation so conditions react to
|
|
35
|
+
* live input without writing to client.responses prematurely.
|
|
36
|
+
*/
|
|
37
|
+
stagedValuesStore: StoreWritable<Record<string, FieldValue>>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates the client-side validation slice for a form.
|
|
41
|
+
*
|
|
42
|
+
* Responsibilities:
|
|
43
|
+
* - Tracks which fields have been touched (first blur = touched).
|
|
44
|
+
* - Validates on blur (full: includes required check) and on change (if already touched).
|
|
45
|
+
* - Uses the same json-logic evaluator the server uses, so client and server results match.
|
|
46
|
+
* - Maintains stagedValuesStore: current in-session values used as responses context for
|
|
47
|
+
* condition evaluation, avoiding premature writes to client.responses.
|
|
48
|
+
*
|
|
49
|
+
* @param {Picked} client - The Picked client instance providing responses and field registry.
|
|
50
|
+
* @param {Store<Field[]>} fieldsStore - Reactive store of the current field definitions.
|
|
51
|
+
* @param {StoreWritable<Record<string, FieldValue>>} stagedValuesStore - Writable store of in-session field values.
|
|
52
|
+
* @returns {FieldValidation} The validation slice containing events, stores, and wiring.
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const validation = createFieldValidation(client, fieldsStore, stagedValuesStore)
|
|
56
|
+
* validation.fieldInputEvent({ fieldKey: 'email', value: 'hi' })
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export declare function createFieldValidation(client: Picked, fieldsStore: Store<Field[]>, stagedValuesStore: StoreWritable<Record<string, FieldValue>>): FieldValidation;
|
|
60
|
+
//# sourceMappingURL=create-field-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-field-validation.d.ts","sourceRoot":"","sources":["../../../src/form/create-field-validation.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,KAAK,EACV,KAAK,aAAa,EACnB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAkBvC,MAAM,WAAW,eAAe;IAC9B,4GAA4G;IAC5G,eAAe,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC,CAAA;IACvE,qIAAqI;IACrI,gBAAgB,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC,CAAA;IACxE,gGAAgG;IAChG,cAAc,EAAE,aAAa,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE,CAAC,CAAA;IACtE,4FAA4F;IAC5F,YAAY,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA;IAC7D;;;;OAIG;IACH,gBAAgB,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IACzE,kFAAkF;IAClF,eAAe,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;IACzC;;;;OAIG;IACH,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAA;CAC7D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,EAC3B,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAC3D,eAAe,CA2KjB"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/** @file Creates form instances that wire field evaluation, validation, and submission. */
|
|
2
|
+
import { type EventCallable, type Store } from 'effector';
|
|
3
|
+
import type { Field, FieldValue } from '../entities/field/field.js';
|
|
4
|
+
import type { ExperienceInstance } from '../entities/experience-instance/experience-instance.js';
|
|
5
|
+
import type { ValidationError } from '../entities/response/response.js';
|
|
6
|
+
import type { Picked } from '../picked.js';
|
|
7
|
+
import { type ErrorCallback, type SubmitCallback, type SubmitEventWithCurrentTarget, type SuccessCallback } from './create-submit-pipeline.js';
|
|
8
|
+
export type FormField = Field & {
|
|
9
|
+
value: FieldValue | undefined;
|
|
10
|
+
/** Validation error for this field, or undefined if valid. */
|
|
11
|
+
error: ValidationError | undefined;
|
|
12
|
+
touched: boolean;
|
|
13
|
+
/** HTML-safe attributes to spread onto an input element. */
|
|
14
|
+
props: {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
key: string;
|
|
18
|
+
value: FieldValue | undefined;
|
|
19
|
+
type: 'text' | 'number' | 'checkbox';
|
|
20
|
+
required: boolean;
|
|
21
|
+
placeholder: string | undefined;
|
|
22
|
+
oninput: (e: Event) => void;
|
|
23
|
+
onchange: (e: Event) => void;
|
|
24
|
+
onblur: (e: Event) => void;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Dependencies that framework wrappers inject into createForm.
|
|
29
|
+
* Replaces Svelte's getPicked()/getExperience() context calls.
|
|
30
|
+
*/
|
|
31
|
+
export interface CreateFormDeps {
|
|
32
|
+
client: Picked;
|
|
33
|
+
experienceInstance: ExperienceInstance;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Return type for createForm().
|
|
37
|
+
* Provides form handlers, reactive stores, and callback registration.
|
|
38
|
+
*/
|
|
39
|
+
export interface FormInstance<TFieldKeys extends string = string> {
|
|
40
|
+
/** Form element props (bind to a form element). */
|
|
41
|
+
form: {
|
|
42
|
+
/** HTML-safe attributes to spread onto a form element. */
|
|
43
|
+
props: {
|
|
44
|
+
onsubmit: EventCallable<SubmitEventWithCurrentTarget>;
|
|
45
|
+
};
|
|
46
|
+
/** Flat list of all current validation errors — derived from fieldErrors. */
|
|
47
|
+
errors: Store<ValidationError[]>;
|
|
48
|
+
/** Reactive store indicating if form is currently submitting. */
|
|
49
|
+
submitting: Store<boolean>;
|
|
50
|
+
/** Register callbacks to transform/validate data before submission. Returns unsubscribe. */
|
|
51
|
+
onBeforeSubmit: (callback: SubmitCallback<TFieldKeys>) => () => void;
|
|
52
|
+
/** Register callbacks to run on successful form submission. Returns unsubscribe. */
|
|
53
|
+
onSuccess: (callback: SuccessCallback<TFieldKeys>) => () => void;
|
|
54
|
+
/** Register callbacks to run on form validation errors. Returns unsubscribe. */
|
|
55
|
+
onError: (callback: ErrorCallback) => () => void;
|
|
56
|
+
};
|
|
57
|
+
/** Reactive store of fields with current values, errors, touched state, and event handlers. */
|
|
58
|
+
fields: Store<FormField[]>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Extracts the current value from a form input event.
|
|
62
|
+
*
|
|
63
|
+
* @param {Event} e - The DOM event from an input, select, or textarea element.
|
|
64
|
+
* @returns {FieldValue | undefined} The field value, or undefined if the event target is not a recognised form element.
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* input.addEventListener('input', (e) => {
|
|
68
|
+
* const value = getEventValue(e)
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function getEventValue(e: Event): FieldValue | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Extracts the staged value for a field from a form event. For a multi-value
|
|
75
|
+
* checkbox group, toggles the clicked option's value into or out of
|
|
76
|
+
* `currentValue` rather than reading the DOM — under React-controlled
|
|
77
|
+
* checkboxes, reconciliation reverts `el.checked` to match the prop before
|
|
78
|
+
* the change event fires, so any DOM-based read returns the pre-toggle
|
|
79
|
+
* state. For `<select multiple>`, reads `el.selectedOptions` (React does
|
|
80
|
+
* not race the change event there). Falls back to {@link getEventValue}
|
|
81
|
+
* for single-value fields and unrelated targets.
|
|
82
|
+
*
|
|
83
|
+
* For multi-checkbox events other than `change`: returns `undefined` for
|
|
84
|
+
* `input` so the caller skips dispatch (both `input` and `change` fire on a
|
|
85
|
+
* single click; only `change` should toggle, otherwise the toggle would run
|
|
86
|
+
* twice and cancel out). Returns `currentValue` (coerced to an array) for
|
|
87
|
+
* any non-change event so the caller can still dispatch — keeping
|
|
88
|
+
* touched-tracking and required-validation on `blur` working.
|
|
89
|
+
*
|
|
90
|
+
* Not re-exported from the form barrel; intended for use by the form's own
|
|
91
|
+
* field handlers and for direct unit testing.
|
|
92
|
+
*
|
|
93
|
+
* @param {Event} e - The DOM event from a form input.
|
|
94
|
+
* @param {Field} field - The field whose handler received the event.
|
|
95
|
+
* @param {FieldValue | undefined} currentValue - The field's currently staged or committed value.
|
|
96
|
+
* @returns {FieldValue | undefined} The value to stage, or undefined if the caller should skip dispatch.
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* input.addEventListener('change', (e) => {
|
|
100
|
+
* const value = getStagedEventValue(e, field, field.value)
|
|
101
|
+
* })
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
export declare function getStagedEventValue(e: Event, field: Field, currentValue: FieldValue | undefined): FieldValue | undefined;
|
|
105
|
+
/**
|
|
106
|
+
* Builds a DOM event handler that derives the next staged value via
|
|
107
|
+
* {@link getStagedEventValue} and dispatches the given event-callable when
|
|
108
|
+
* the helper returns a defined value. Skips dispatch if the helper returns
|
|
109
|
+
* undefined (e.g. `input` events on multi-select checkboxes, where dispatch
|
|
110
|
+
* is owned by the change event to avoid double-toggling).
|
|
111
|
+
*
|
|
112
|
+
* Not re-exported from the form barrel; intended for use by `createForm`
|
|
113
|
+
* and for direct unit testing.
|
|
114
|
+
*
|
|
115
|
+
* @param {Field} field - The field bound to the handler.
|
|
116
|
+
* @param {FieldValue | undefined} value - The field's currently staged or committed value.
|
|
117
|
+
* @param {EventCallable<{ fieldKey: string; value: FieldValue }>} dispatch - The event-callable to fire when the helper returns a value.
|
|
118
|
+
* @returns {(e: Event) => void} The handler to attach to a DOM event.
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const onChange = createFieldHandler(field, value, fieldChangeEvent)
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
export declare function createFieldHandler(field: Field, value: FieldValue | undefined, dispatch: EventCallable<{
|
|
125
|
+
fieldKey: string;
|
|
126
|
+
value: FieldValue;
|
|
127
|
+
}>): (e: Event) => void;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a form instance tied to a set of field keys.
|
|
130
|
+
* Handles field evaluation, form submission, data transformation,
|
|
131
|
+
* validation, event bus tracking, and step navigation.
|
|
132
|
+
*
|
|
133
|
+
* Framework-agnostic — framework wrappers (Svelte, React) inject
|
|
134
|
+
* client and experienceInstance via the deps parameter and handle
|
|
135
|
+
* callback cleanup lifecycle.
|
|
136
|
+
*
|
|
137
|
+
* @param {CreateFormDeps} deps - Client and experience instance injected by the framework wrapper.
|
|
138
|
+
* @param {string} formId - Unique identifier for this form instance.
|
|
139
|
+
* @param {Store<string>} title - Reactive store holding the form/step title.
|
|
140
|
+
* @param {Store<string[]>} fieldKeys - Reactive store of field keys that belong to this form.
|
|
141
|
+
* @returns {FormInstance} A form instance with reactive field stores, submission handlers, and callback registration.
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const form = createForm(
|
|
145
|
+
* { client, experienceInstance },
|
|
146
|
+
* 'lead-capture',
|
|
147
|
+
* $title,
|
|
148
|
+
* $fieldKeys,
|
|
149
|
+
* )
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
export declare function createForm(deps: CreateFormDeps, formId: string, title: Store<string>, fieldKeys: Store<string[]>): FormInstance;
|
|
153
|
+
//# sourceMappingURL=create-form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-form.d.ts","sourceRoot":"","sources":["../../../src/form/create-form.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** @file Submit pipeline for form instances — manages lifecycle, validation, and navigation. */
|
|
2
|
+
import { type Event, type EventCallable, type Store } from 'effector';
|
|
3
|
+
import type { ExperienceInstance } from '../entities/experience-instance/experience-instance.js';
|
|
4
|
+
import type { ExperienceStep } from '../entities/step/step.js';
|
|
5
|
+
import type { Field } from '../entities/field/field.js';
|
|
6
|
+
import type { ValidationError } from '../entities/response/response.js';
|
|
7
|
+
import type { Picked } from '../picked.js';
|
|
8
|
+
import type { FieldValueFor } from '../schema-registry.js';
|
|
9
|
+
export type SubmitEventWithCurrentTarget = SubmitEvent & {
|
|
10
|
+
currentTarget: EventTarget & HTMLFormElement;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Callback fired after a successful commit, receiving the committed `data` keyed by
|
|
14
|
+
* the step's field ids.
|
|
15
|
+
*
|
|
16
|
+
* The `data` value type is a schema-typed *view* over runtime-`FieldValue` data — the
|
|
17
|
+
* same soundness posture as `getField`/`getByFieldKey`. The registry narrows each field
|
|
18
|
+
* id to its declared value type, but the values are not runtime-validated against it. The
|
|
19
|
+
* default `TFieldIds = string` resolves to `Record<string, FieldValue>`, so untyped
|
|
20
|
+
* consumers keep the broad value type.
|
|
21
|
+
*/
|
|
22
|
+
export type SuccessCallback<TFieldIds extends string = string> = (options: {
|
|
23
|
+
data: {
|
|
24
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
25
|
+
};
|
|
26
|
+
stopNavigation: EventCallable<void>;
|
|
27
|
+
}) => void | Promise<void>;
|
|
28
|
+
export type ErrorCallback = (errors: ValidationError[]) => void | Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Callback fired before commit, receiving the parsed `data` keyed by the step's field
|
|
31
|
+
* ids and optionally returning a transformed copy.
|
|
32
|
+
*
|
|
33
|
+
* The `data` value type is a schema-typed *view* over runtime-`FieldValue` data — the
|
|
34
|
+
* same soundness posture as `getField`/`getByFieldKey`. The registry narrows each field
|
|
35
|
+
* id to its declared value type, but the values are not runtime-validated against it. The
|
|
36
|
+
* default `TFieldIds = string` resolves to `Record<string, FieldValue>`, so untyped
|
|
37
|
+
* consumers keep the broad value type.
|
|
38
|
+
*/
|
|
39
|
+
export type SubmitCallback<TFieldIds extends string = string> = (data: {
|
|
40
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
41
|
+
}) => {
|
|
42
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
43
|
+
} | void | Promise<{
|
|
44
|
+
[P in TFieldIds]: FieldValueFor<P>;
|
|
45
|
+
} | void>;
|
|
46
|
+
/**
|
|
47
|
+
* Latest-wins submit callback slots accepted by the framework adapters.
|
|
48
|
+
*
|
|
49
|
+
* Declared here so `@picked/react` and `@picked/svelte` share one shape rather
|
|
50
|
+
* than each defining its own. Passing callbacks as options is the recommended
|
|
51
|
+
* style in both adapters: the callbacks arrive as arguments, so there is no
|
|
52
|
+
* registration lifecycle for a consumer to get wrong, and re-rendering with a new
|
|
53
|
+
* inline function simply replaces the previous one.
|
|
54
|
+
*
|
|
55
|
+
* @example createForm(id, title, keys, { onSuccess: ({ data }) => track(data) })
|
|
56
|
+
*/
|
|
57
|
+
export interface FormCallbackOptions<TFieldKeys extends string = string> {
|
|
58
|
+
onBeforeSubmit?: SubmitCallback<TFieldKeys>;
|
|
59
|
+
onSuccess?: SuccessCallback<TFieldKeys>;
|
|
60
|
+
onError?: ErrorCallback;
|
|
61
|
+
}
|
|
62
|
+
export interface SubmitPipelineConfig {
|
|
63
|
+
client: Picked;
|
|
64
|
+
experienceInstance: ExperienceInstance;
|
|
65
|
+
formId: string;
|
|
66
|
+
title: Store<string>;
|
|
67
|
+
stepStore: Store<ExperienceStep | null>;
|
|
68
|
+
fieldsStore: Store<Field[]>;
|
|
69
|
+
goToNextStep: EventCallable<void>;
|
|
70
|
+
}
|
|
71
|
+
export interface SubmitPipeline {
|
|
72
|
+
submitEvent: EventCallable<SubmitEventWithCurrentTarget>;
|
|
73
|
+
isFormSubmitting: Store<boolean>;
|
|
74
|
+
onBeforeSubmit: (callback: SubmitCallback) => () => void;
|
|
75
|
+
onSuccess: (callback: SuccessCallback) => () => void;
|
|
76
|
+
onError: (callback: ErrorCallback) => () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Fired when a submit attempt starts — callers use this to clear validation state.
|
|
79
|
+
* Separating this from `submitEvent` keeps the pipeline decoupled from the
|
|
80
|
+
* validation module's internal stores.
|
|
81
|
+
*/
|
|
82
|
+
submitStarted: Event<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Fired when commit returns validation errors — callers write these to
|
|
85
|
+
* `fieldErrorsStore` in the validation module.
|
|
86
|
+
*/
|
|
87
|
+
validationErrorsReceived: Event<ValidationError[]>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Creates the submit pipeline for a form instance.
|
|
91
|
+
*
|
|
92
|
+
* Manages the full lifecycle of a form submission, including emitting event bus
|
|
93
|
+
* calls, running data-transform callbacks, committing responses, running
|
|
94
|
+
* success/error callbacks, and navigating to the next step.
|
|
95
|
+
*
|
|
96
|
+
* Returns coordination events (`submitStarted`, `validationErrorsReceived`) that the
|
|
97
|
+
* caller wires to the validation module to keep validation state in sync without
|
|
98
|
+
* the pipeline needing direct access to validation stores.
|
|
99
|
+
*
|
|
100
|
+
* @param {SubmitPipelineConfig} config - The submit pipeline configuration.
|
|
101
|
+
* @param {Picked} config.client - The Picked client instance.
|
|
102
|
+
* @param {ExperienceInstance} config.experienceInstance - The experience instance.
|
|
103
|
+
* @param {string} config.formId - The form identifier.
|
|
104
|
+
* @param {Store<string>} config.title - Store containing the form title.
|
|
105
|
+
* @param {Store<ExperienceStep | null>} config.stepStore - Store containing the current step.
|
|
106
|
+
* @param {Store<Field[]>} config.fieldsStore - Store containing the form fields.
|
|
107
|
+
* @param {EventCallable<void>} config.goToNextStep - Event to trigger navigation to the next step.
|
|
108
|
+
* @returns {SubmitPipeline} The submit pipeline with events, stores, and callback registration.
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* const pipeline = createSubmitPipeline(config)
|
|
112
|
+
* pipeline.onSuccess(({ data }) => console.log(data))
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare function createSubmitPipeline({ client, experienceInstance, formId, title, stepStore, fieldsStore, goToNextStep, }: SubmitPipelineConfig): SubmitPipeline;
|
|
116
|
+
//# sourceMappingURL=create-submit-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-submit-pipeline.d.ts","sourceRoot":"","sources":["../../../src/form/create-submit-pipeline.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @file Step field evaluation — resolves field and option visibility conditions. */
|
|
2
|
+
import type { Field } from '../entities/field/field.js';
|
|
3
|
+
import type { Picked } from '../picked.js';
|
|
4
|
+
import { evaluateRuleLogic } from '../utils/rules-logic.js';
|
|
5
|
+
/**
|
|
6
|
+
* Evaluates field and option conditions, returning only the fields that should be visible.
|
|
7
|
+
*
|
|
8
|
+
* @template T
|
|
9
|
+
* @param {Picked} client - The Picked client instance for condition evaluation.
|
|
10
|
+
* @param {T[]} fields - The fields to filter by their conditions.
|
|
11
|
+
* @param {Parameters<typeof evaluateRuleLogic>[2]} [context] - Optional context object passed to the rule evaluator.
|
|
12
|
+
* @returns {Promise<T[]>} The filtered array of visible fields with conditional options resolved.
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const visibleFields = await getStepFields(client, step.fields, { cartTotal: 50 })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare function getStepFields<T extends Field>(client: Picked, fields: T[], context?: Parameters<typeof evaluateRuleLogic>[2]): Promise<T[]>;
|
|
19
|
+
//# sourceMappingURL=get-step-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-step-fields.d.ts","sourceRoot":"","sources":["../../../src/form/get-step-fields.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AA8CxD;;;;;;;;;;;;GAYG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,KAAK,EACjD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,CAAC,EAAE,EACX,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAChD,OAAO,CAAC,CAAC,EAAE,CAAC,CAoDd"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @file Public surface of `@picked/client/form`. */
|
|
2
|
+
export { buildResponsesFromFormData } from './build-responses.js';
|
|
3
|
+
export { getStepFields } from './get-step-fields.js';
|
|
4
|
+
export { createFieldEvaluator } from './create-field-evaluator.js';
|
|
5
|
+
export { createFieldValidation } from './create-field-validation.js';
|
|
6
|
+
export type { FieldValidation } from './create-field-validation.js';
|
|
7
|
+
export { createSubmitPipeline } from './create-submit-pipeline.js';
|
|
8
|
+
export type { SubmitPipelineConfig, SubmitPipeline, SubmitEventWithCurrentTarget, SuccessCallback, ErrorCallback, SubmitCallback, FormCallbackOptions, } from './create-submit-pipeline.js';
|
|
9
|
+
export { createForm, getEventValue } from './create-form.js';
|
|
10
|
+
export type { CreateFormDeps, FormField, FormInstance } from './create-form.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/form/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,YAAY,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,YAAY,EACV,oBAAoB,EACpB,cAAc,EACd,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AACzD,YAAY,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @file Top-level public entry point — re-exports the client class, public utilities, and entity types. */
|
|
2
|
+
export * from './exports.js';
|
|
3
|
+
export type * from './client.js';
|
|
4
|
+
export type * from './entities/action/action.js';
|
|
5
|
+
export type * from './entities/condition/condition.js';
|
|
6
|
+
export type * from './entities/content/content.js';
|
|
7
|
+
export type * from './entities/content/reference.js';
|
|
8
|
+
export type * from './entities/component/component.js';
|
|
9
|
+
export type * from './entities/component/lazyComponent.js';
|
|
10
|
+
export type * from './entities/experience-instance/experience-instance.js';
|
|
11
|
+
export type * from './entities/experience/experience.js';
|
|
12
|
+
export type * from './entities/step/step.js';
|
|
13
|
+
export type * from './entities/feature/feature.js';
|
|
14
|
+
export type * from './entities/field/field.js';
|
|
15
|
+
export type * from './entities/field/policies.js';
|
|
16
|
+
export type * from './entities/framework/framework.js';
|
|
17
|
+
export type * from './entities/history/history.js';
|
|
18
|
+
export type * from './entities/plugin/plugin.js';
|
|
19
|
+
export type * from './entities/predicate/predicate.js';
|
|
20
|
+
export type * from './lifecycle/state-snapshot.js';
|
|
21
|
+
export type * from './utils/events.js';
|
|
22
|
+
export type * from './utils/search-params.js';
|
|
23
|
+
export type * from './entities/response/response.js';
|
|
24
|
+
export { Picked } from './picked.js';
|
|
25
|
+
export type { ActionKeys, ContentForStep, ContentModelKeys, ContentRecordOf, ExperienceKeys, FeatureKeys, FeatureValueFor, FieldKeys, FieldKeysForStep, FieldValueFor, KnownActionKeys, KnownExperienceKeys, KnownFeatureKeys, KnownFieldKeys, KnownStepKeys, PickedSchemaRegistry, ReferencedContent, WorkflowActionKeys, StepContentModelsMap, StepKeys, StepLayoutContent, TypedContent, } from './schema-registry.js';
|
|
26
|
+
export { isContentOfModel, toTypedContentStore } from './typed-content.js';
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,cAAc,WAAW,CAAA;AACzB,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,8BAA8B,CAAA;AACjD,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,oCAAoC,CAAA;AACvD,mBAAmB,oDAAoD,CAAA;AACvE,mBAAmB,kCAAkC,CAAA;AACrD,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,wBAAwB,CAAA;AAC3C,mBAAmB,2BAA2B,CAAA;AAC9C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,0BAA0B,CAAA;AAC7C,mBAAmB,gCAAgC,CAAA;AACnD,mBAAmB,4BAA4B,CAAA;AAC/C,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,uBAAuB,CAAA;AAC1C,mBAAmB,8BAA8B,CAAA;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,WAAW,EACX,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,iBAAiB,EACjB,YAAY,GACb,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA"}
|