@picked/client 0.0.1-dev.1788925875333 → 0.0.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/cjs/index.js +1 -4
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/history-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/responses-indexeddb-plugin/index.js +1 -0
- package/dist/cjs/plugins/shopify/index.js +1 -0
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +733 -1814
- package/dist/esm/plugins/create-experience/index.js +398 -490
- package/dist/esm/plugins/experience-browserstorage-plugin/index.js +38 -0
- package/dist/esm/plugins/history-browserstorage-plugin/index.js +26 -0
- package/dist/esm/plugins/responses-browserstorage-plugin/index.js +36 -0
- package/dist/esm/plugins/responses-indexeddb-plugin/index.js +101 -0
- package/dist/esm/plugins/shopify/index.js +59 -0
- package/dist/esm/plugins/single-page-app/index.js +35 -31
- package/dist/esm/plugins/window-object/index.js +9 -9
- package/dist/esm/server/index.js +89 -141
- package/dist/experience-instance-6ZKZS7dF.cjs +1 -0
- package/dist/experience-instance-BA0EXYg5.js +712 -0
- package/dist/id-BKIWbSTy.cjs +1 -0
- package/dist/id-BW-g3y32.js +6 -0
- package/dist/logger-BsmHUUw1.cjs +1 -0
- package/dist/logger-C9a75KZn.js +5 -0
- package/dist/object-BbFTsGh3.cjs +1 -0
- package/dist/object-JwZ58NOH.js +28 -0
- package/dist/storage-BPJwmlva.cjs +1 -0
- package/dist/storage-D87xFySf.js +85 -0
- package/dist/supports-BvrzQAVk.js +79 -0
- package/dist/supports-C0y3-V5V.cjs +1 -0
- package/dist/types/client.d.ts +23 -119
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/component/component.d.ts +6 -45
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +99 -152
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +113 -83
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +8 -118
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +64 -96
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +7 -32
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts +6 -6
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +2 -41
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +7 -30
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/project/project.d.ts +9 -0
- package/dist/types/entities/project/project.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +21 -57
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/exports.d.ts +4 -22
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +11 -13
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +184 -381
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/ping.d.ts +10 -0
- package/dist/types/ping.d.ts.map +1 -0
- package/dist/types/plugins/create-experience/create-experience.d.ts +44 -119
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +2 -2
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts +2 -3
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -1
- package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts +6 -0
- package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/plugin.d.ts +1 -2
- package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts +6 -0
- package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts +3 -0
- package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/shopify/index.d.ts +2 -0
- package/dist/types/plugins/shopify/index.d.ts.map +1 -0
- package/dist/types/plugins/shopify/plugin.d.ts +3 -0
- package/dist/types/plugins/shopify/plugin.d.ts.map +1 -0
- package/dist/types/plugins/shopify/shopify.d.ts +28 -0
- package/dist/types/plugins/shopify/shopify.d.ts.map +1 -0
- package/dist/types/plugins/single-page-app/plugin.d.ts +2 -2
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/plugins/window-object/plugin.d.ts +2 -2
- package/dist/types/server/index.d.ts +3 -18
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +6 -4
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +38 -83
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +2 -1
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/id.d.ts.map +1 -1
- package/dist/types/utils/indexed-db.d.ts +1 -2
- package/dist/types/utils/indexed-db.d.ts.map +1 -1
- package/dist/types/utils/logger.d.ts +1 -2
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +3 -0
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +1 -0
- package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
- package/dist/types/utils/node-tree/get-origin-node.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +2 -3
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/object.d.ts +8 -0
- package/dist/types/utils/object.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +3 -33
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/dist/types/utils/state-snaphot.d.ts +16 -0
- package/dist/types/utils/state-snaphot.d.ts.map +1 -0
- package/dist/types/utils/storage.d.ts +11 -374
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +0 -87
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/package.json +49 -182
- package/dist/.tsbuildinfo +0 -1
- package/dist/api-DbMJli3H.js +0 -22
- package/dist/api-qiqq8lgz.cjs +0 -1
- package/dist/cjs/form/index.js +0 -1
- package/dist/cjs/plugins/dom-observer/index.js +0 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +0 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +0 -1
- package/dist/cjs/plugins/telemetry/index.js +0 -1
- package/dist/cjs/plugins/web-components/index.js +0 -1
- package/dist/cjs/preview/index.js +0 -1
- package/dist/docs/_root.css +0 -101
- package/dist/docs/explanation/conditions-and-the-logic-engine.md +0 -94
- package/dist/docs/explanation/content-references.md +0 -99
- package/dist/docs/explanation/feature-flag-allocation.md +0 -218
- package/dist/docs/explanation/how-picked-works.md +0 -124
- package/dist/docs/explanation/how-pickedql-works.md +0 -76
- package/dist/docs/explanation/pages-and-flows.md +0 -64
- package/dist/docs/explanation/the-content-model.md +0 -87
- package/dist/docs/explanation/the-two-apis.md +0 -68
- package/dist/docs/explanation/why-server-side-rendering.md +0 -76
- package/dist/docs/explanation/workspaces-and-versions.md +0 -71
- package/dist/docs/how-to/add-a-step-field-or-action.md +0 -43
- package/dist/docs/how-to/analytics/index.md +0 -316
- package/dist/docs/how-to/archive-or-delete-a-workspace.md +0 -46
- package/dist/docs/how-to/authenticate-the-cli.md +0 -97
- package/dist/docs/how-to/authenticate-with-a-magic-link.md +0 -40
- package/dist/docs/how-to/authenticate-with-a-password.md +0 -51
- package/dist/docs/how-to/authenticate-with-an-api-key.md +0 -51
- package/dist/docs/how-to/authenticate-with-oauth.md +0 -40
- package/dist/docs/how-to/build-a-flow.md +0 -83
- package/dist/docs/how-to/connect-the-mcp-server.md +0 -38
- package/dist/docs/how-to/create-a-content-entry.md +0 -48
- package/dist/docs/how-to/create-a-project.md +0 -29
- package/dist/docs/how-to/create-an-experience.md +0 -42
- package/dist/docs/how-to/create-and-revoke-an-api-key.md +0 -42
- package/dist/docs/how-to/debug-with-the-chrome-extension.md +0 -57
- package/dist/docs/how-to/define-a-page-layout.md +0 -46
- package/dist/docs/how-to/fill-and-publish-a-page.md +0 -66
- package/dist/docs/how-to/install-the-gtm-template.md +0 -84
- package/dist/docs/how-to/install-the-sdk.md +0 -93
- package/dist/docs/how-to/install-the-vite-plugin.md +0 -69
- package/dist/docs/how-to/invite-and-remove-members.md +0 -34
- package/dist/docs/how-to/point-one-entry-at-another.md +0 -61
- package/dist/docs/how-to/preview-a-workspace.md +0 -28
- package/dist/docs/how-to/publish-a-workspace.md +0 -30
- package/dist/docs/how-to/read-a-feature-flag.md +0 -113
- package/dist/docs/how-to/read-a-referenced-entry.md +0 -109
- package/dist/docs/how-to/register-a-component.md +0 -55
- package/dist/docs/how-to/register-an-action-handler.md +0 -67
- package/dist/docs/how-to/render-a-step-form.md +0 -131
- package/dist/docs/how-to/render-an-unpublished-preview.md +0 -41
- package/dist/docs/how-to/reuse-a-section.md +0 -53
- package/dist/docs/how-to/reuse-a-step-field-or-action.md +0 -28
- package/dist/docs/how-to/roll-back-a-published-version.md +0 -26
- package/dist/docs/how-to/run-an-ab-test.md +0 -49
- package/dist/docs/how-to/run-code-on-a-form-submission.md +0 -125
- package/dist/docs/how-to/server-render-a-page.md +0 -81
- package/dist/docs/how-to/set-a-content-security-policy.md +0 -32
- package/dist/docs/how-to/set-up-mfa.md +0 -69
- package/dist/docs/how-to/switch-workspaces.md +0 -122
- package/dist/docs/how-to/upload-and-use-an-asset.mdx +0 -73
- package/dist/docs/how-to/validate-a-field.md +0 -52
- package/dist/docs/how-to/write-a-condition.md +0 -45
- package/dist/docs/how-to/write-a-predicate.md +0 -60
- package/dist/docs/index.md +0 -59
- package/dist/docs/reference/dashboard/actions.mdx +0 -53
- package/dist/docs/reference/dashboard/api-keys.mdx +0 -38
- package/dist/docs/reference/dashboard/conditions.mdx +0 -42
- package/dist/docs/reference/dashboard/content/asset-library.mdx +0 -63
- package/dist/docs/reference/dashboard/content/blocks.mdx +0 -57
- package/dist/docs/reference/dashboard/content/content-entries.mdx +0 -95
- package/dist/docs/reference/dashboard/content/models.mdx +0 -108
- package/dist/docs/reference/dashboard/content/pages.mdx +0 -61
- package/dist/docs/reference/dashboard/experiences.mdx +0 -51
- package/dist/docs/reference/dashboard/features.mdx +0 -154
- package/dist/docs/reference/dashboard/fields.mdx +0 -106
- package/dist/docs/reference/dashboard/flow-builder/canvas.mdx +0 -58
- package/dist/docs/reference/dashboard/flow-builder/condition-builder.md +0 -57
- package/dist/docs/reference/dashboard/flow-builder/keyboard-shortcuts.md +0 -72
- package/dist/docs/reference/dashboard/flow-builder/nodes.md +0 -63
- package/dist/docs/reference/dashboard/projects.mdx +0 -44
- package/dist/docs/reference/dashboard/reports.mdx +0 -43
- package/dist/docs/reference/dashboard/steps.mdx +0 -37
- package/dist/docs/reference/dashboard/team-management.md +0 -29
- package/dist/docs/reference/dashboard/workspace-versioning.mdx +0 -30
- package/dist/docs/reference/dashboard/workspaces.mdx +0 -76
- package/dist/docs/reference/delivery-api/experience-content.md +0 -152
- package/dist/docs/reference/delivery-api/index.md +0 -45
- package/dist/docs/reference/delivery-api/preview-caching-crawling.md +0 -79
- package/dist/docs/reference/delivery-api/project-config.md +0 -65
- package/dist/docs/reference/delivery-api/workspace-schema.md +0 -85
- package/dist/docs/reference/glossary.md +0 -181
- package/dist/docs/reference/management-api/authentication.md +0 -74
- package/dist/docs/reference/management-api/authorization-and-scopes.md +0 -285
- package/dist/docs/reference/management-api/error-handling.md +0 -233
- package/dist/docs/reference/management-api/pagination.md +0 -192
- package/dist/docs/reference/pickedql/data-sources.md +0 -174
- package/dist/docs/reference/pickedql/dimensions.md +0 -103
- package/dist/docs/reference/pickedql/filtering.md +0 -64
- package/dist/docs/reference/pickedql/index.md +0 -18
- package/dist/docs/reference/pickedql/schema.md +0 -172
- package/dist/docs/reference/pickedql/virtual-functions.md +0 -248
- package/dist/docs/reference/sdk/actions.md +0 -30
- package/dist/docs/reference/sdk/analytics-events.md +0 -445
- package/dist/docs/reference/sdk/conditions.md +0 -147
- package/dist/docs/reference/sdk/content-security-policy.md +0 -21
- package/dist/docs/reference/sdk/content.md +0 -213
- package/dist/docs/reference/sdk/experiences.md +0 -51
- package/dist/docs/reference/sdk/features.md +0 -256
- package/dist/docs/reference/sdk/fields.md +0 -255
- package/dist/docs/reference/sdk/index.md +0 -68
- package/dist/docs/reference/sdk/plugins/create-experience.md +0 -123
- package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +0 -74
- package/dist/docs/reference/sdk/plugins/index.md +0 -29
- package/dist/docs/reference/sdk/plugins/window-object.md +0 -25
- package/dist/docs/reference/sdk/predicates.md +0 -43
- package/dist/docs/reference/sdk/ssr/index.md +0 -33
- package/dist/docs/reference/sdk/ssr/rendering-and-hydration.md +0 -103
- package/dist/docs/reference/sdk/ssr/serialize.md +0 -80
- package/dist/docs/reference/sdk/ssr/slots-and-placements.md +0 -59
- package/dist/docs/reference/sdk/steps.md +0 -86
- package/dist/docs/reference/sdk/type-generation.md +0 -196
- package/dist/docs/reference/tools/chrome-extension.md +0 -16
- package/dist/docs/reference/tools/cli.md +0 -146
- package/dist/docs/reference/tools/image-optimisation-service.md +0 -104
- package/dist/docs/reference/tools/mcp.md +0 -90
- package/dist/docs/reference/tools/vite-plugin.md +0 -163
- package/dist/docs/tutorials/first-api-call.md +0 -228
- package/dist/docs/tutorials/first-experience-in-the-dashboard.mdx +0 -143
- package/dist/docs/tutorials/first-experience.mdx +0 -254
- package/dist/docs/tutorials/first-server-rendered-page.mdx +0 -186
- package/dist/dom-BqcToNL0.js +0 -82
- package/dist/dom-DlLH3FxV.cjs +0 -1
- package/dist/emit-D-tLiWL1.cjs +0 -1
- package/dist/emit-Ds2EG7CB.js +0 -14
- package/dist/esm/form/index.js +0 -565
- package/dist/esm/plugins/dom-observer/index.js +0 -87
- package/dist/esm/plugins/dynamic-experiences/index.js +0 -5
- package/dist/esm/plugins/experience-browser-storage/index.js +0 -38
- package/dist/esm/plugins/history-browser-storage/index.js +0 -26
- package/dist/esm/plugins/responses-browser-storage/index.js +0 -71
- package/dist/esm/plugins/responses-indexeddb/index.js +0 -89
- package/dist/esm/plugins/telemetry/index.js +0 -100
- package/dist/esm/plugins/web-components/index.js +0 -19
- package/dist/esm/preview/index.js +0 -2
- package/dist/experience-instance-DGk11d8a.js +0 -563
- package/dist/experience-instance-Dej3P1sE.cjs +0 -1
- package/dist/id-Bo4RBeOs.js +0 -4
- package/dist/id-Js-62re-.cjs +0 -1
- package/dist/inert-script-report-B_bMPRzp.js +0 -18
- package/dist/inert-script-report-ijRHPtcY.cjs +0 -1
- package/dist/logger-CSTvAyyB.cjs +0 -1
- package/dist/logger-DMN6TxJJ.js +0 -4
- package/dist/object-BUDGxEqy.js +0 -25
- package/dist/object-CIkt7Fkr.cjs +0 -1
- package/dist/plugin-BcLaCLm1.cjs +0 -1
- package/dist/plugin-De_BJSwE.js +0 -194
- package/dist/preview-channel-CSr96XAo.js +0 -98
- package/dist/preview-channel-Cx0e6fye.cjs +0 -1
- package/dist/protocol-Bb_vpLKE.cjs +0 -1
- package/dist/protocol-C5KkkiZc.js +0 -84
- package/dist/provider-C_9u0yGJ.cjs +0 -1
- package/dist/provider-ovM-CBX_.js +0 -98
- package/dist/registry-C1t8l3t9.cjs +0 -1
- package/dist/registry-CXZv0uLg.js +0 -18
- package/dist/rules-logic-CGZIYgAI.cjs +0 -1
- package/dist/rules-logic-HesIUCu6.js +0 -13
- package/dist/storage-1MW3-_As.js +0 -103
- package/dist/storage-DUw9UJ2h.cjs +0 -1
- package/dist/supports-CO9bJGNl.js +0 -92
- package/dist/supports-DBzjGaWD.cjs +0 -1
- package/dist/types/data-source/api.d.ts +0 -60
- package/dist/types/data-source/api.d.ts.map +0 -1
- package/dist/types/data-source/provider.d.ts +0 -103
- package/dist/types/data-source/provider.d.ts.map +0 -1
- package/dist/types/data-source/registry.d.ts +0 -26
- package/dist/types/data-source/registry.d.ts.map +0 -1
- package/dist/types/data-source/request-observer.d.ts +0 -62
- package/dist/types/data-source/request-observer.d.ts.map +0 -1
- package/dist/types/data-source/virtual-data.d.ts +0 -19
- package/dist/types/data-source/virtual-data.d.ts.map +0 -1
- package/dist/types/entities/action/action.d.ts +0 -85
- package/dist/types/entities/action/action.d.ts.map +0 -1
- package/dist/types/entities/component/lazyComponent.d.ts +0 -11
- package/dist/types/entities/component/lazyComponent.d.ts.map +0 -1
- package/dist/types/entities/condition/condition.d.ts +0 -29
- package/dist/types/entities/condition/condition.d.ts.map +0 -1
- package/dist/types/entities/content/content.d.ts +0 -53
- package/dist/types/entities/content/content.d.ts.map +0 -1
- package/dist/types/entities/content/reference.d.ts +0 -101
- package/dist/types/entities/content/reference.d.ts.map +0 -1
- package/dist/types/entities/field/policies.d.ts +0 -35
- package/dist/types/entities/field/policies.d.ts.map +0 -1
- package/dist/types/entities/response/response-validation.d.ts +0 -75
- package/dist/types/entities/response/response-validation.d.ts.map +0 -1
- package/dist/types/entities/session/session.d.ts +0 -46
- package/dist/types/entities/session/session.d.ts.map +0 -1
- package/dist/types/entities/step/step.d.ts +0 -56
- package/dist/types/entities/step/step.d.ts.map +0 -1
- package/dist/types/form/build-responses.d.ts +0 -18
- package/dist/types/form/build-responses.d.ts.map +0 -1
- package/dist/types/form/create-field-evaluator.d.ts +0 -28
- package/dist/types/form/create-field-evaluator.d.ts.map +0 -1
- package/dist/types/form/create-field-validation.d.ts +0 -60
- package/dist/types/form/create-field-validation.d.ts.map +0 -1
- package/dist/types/form/create-form.d.ts +0 -153
- package/dist/types/form/create-form.d.ts.map +0 -1
- package/dist/types/form/create-submit-pipeline.d.ts +0 -116
- package/dist/types/form/create-submit-pipeline.d.ts.map +0 -1
- package/dist/types/form/get-step-fields.d.ts +0 -19
- package/dist/types/form/get-step-fields.d.ts.map +0 -1
- package/dist/types/form/index.d.ts +0 -11
- package/dist/types/form/index.d.ts.map +0 -1
- package/dist/types/lifecycle/condition-selection.d.ts +0 -146
- package/dist/types/lifecycle/condition-selection.d.ts.map +0 -1
- package/dist/types/lifecycle/lifecycle.d.ts +0 -48
- package/dist/types/lifecycle/lifecycle.d.ts.map +0 -1
- package/dist/types/lifecycle/rules-logic.d.ts +0 -25
- package/dist/types/lifecycle/rules-logic.d.ts.map +0 -1
- package/dist/types/lifecycle/state-snapshot.d.ts +0 -38
- package/dist/types/lifecycle/state-snapshot.d.ts.map +0 -1
- package/dist/types/plugins/dom-observer/index.d.ts +0 -3
- package/dist/types/plugins/dom-observer/index.d.ts.map +0 -1
- package/dist/types/plugins/dom-observer/plugin.d.ts +0 -50
- package/dist/types/plugins/dom-observer/plugin.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +0 -105
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +0 -7
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +0 -49
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -45
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +0 -1
- package/dist/types/plugins/experience-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +0 -7
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/history-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +0 -18
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts +0 -3
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/emit.d.ts +0 -18
- package/dist/types/plugins/telemetry/emit.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/index.d.ts +0 -4
- package/dist/types/plugins/telemetry/index.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/plugin-summary.d.ts +0 -10
- package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/plugin.d.ts +0 -45
- package/dist/types/plugins/telemetry/plugin.d.ts.map +0 -1
- package/dist/types/plugins/web-components/index.d.ts +0 -2
- package/dist/types/plugins/web-components/index.d.ts.map +0 -1
- package/dist/types/plugins/web-components/plugin.d.ts +0 -4
- package/dist/types/plugins/web-components/plugin.d.ts.map +0 -1
- package/dist/types/preview/index.d.ts +0 -18
- package/dist/types/preview/index.d.ts.map +0 -1
- package/dist/types/preview-bridge/index.d.ts +0 -14
- package/dist/types/preview-bridge/index.d.ts.map +0 -1
- package/dist/types/preview-channel.d.ts +0 -16
- package/dist/types/preview-channel.d.ts.map +0 -1
- package/dist/types/preview-receiver/apply-ops.d.ts +0 -32
- package/dist/types/preview-receiver/apply-ops.d.ts.map +0 -1
- package/dist/types/preview-receiver/index.d.ts +0 -32
- package/dist/types/preview-receiver/index.d.ts.map +0 -1
- package/dist/types/preview-receiver/protocol.d.ts +0 -69
- package/dist/types/preview-receiver/protocol.d.ts.map +0 -1
- package/dist/types/schema-registry.d.ts +0 -206
- package/dist/types/schema-registry.d.ts.map +0 -1
- package/dist/types/server/serialize.d.ts +0 -87
- package/dist/types/server/serialize.d.ts.map +0 -1
- package/dist/types/typed-content.d.ts +0 -17
- package/dist/types/typed-content.d.ts.map +0 -1
- package/dist/types/utils/client-telemetry.d.ts +0 -25
- package/dist/types/utils/client-telemetry.d.ts.map +0 -1
- package/dist/types/utils/content-path.d.ts +0 -37
- package/dist/types/utils/content-path.d.ts.map +0 -1
- package/dist/types/utils/html-asset-value.d.ts +0 -20
- package/dist/types/utils/html-asset-value.d.ts.map +0 -1
- package/dist/types/utils/inert-script-report.d.ts +0 -40
- package/dist/types/utils/inert-script-report.d.ts.map +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +0 -25
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts.map +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +0 -17
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +0 -1
- package/dist/types/utils/picked-config.d.ts +0 -39
- package/dist/types/utils/picked-config.d.ts.map +0 -1
- package/dist/types/utils/preview-session.d.ts +0 -12
- package/dist/types/utils/preview-session.d.ts.map +0 -1
- package/dist/types/utils/rehydrate-scripts.d.ts +0 -50
- package/dist/types/utils/rehydrate-scripts.d.ts.map +0 -1
- package/dist/types/utils/render-string.d.ts +0 -24
- package/dist/types/utils/render-string.d.ts.map +0 -1
- package/dist/types/utils/user-timing.d.ts +0 -21
- package/dist/types/utils/user-timing.d.ts.map +0 -1
- package/dist/version-BvLZaTMC.cjs +0 -1
- package/dist/version-VvasRUfR.js +0 -256
- /package/dist/types/plugins/{experience-browser-storage → experience-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-browser-storage → responses-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb → responses-indexeddb-plugin}/index.d.ts +0 -0
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Reading `reference` field values out of a delivered content blob.
|
|
3
|
-
*
|
|
4
|
-
* A `reference` field arrives as a pointer at another Content record rather than
|
|
5
|
-
* as the record itself. The referenced record travels separately and is
|
|
6
|
-
* registered into the content index under its own id, so resolving a pointer is
|
|
7
|
-
* a registry lookup — see `useReference` (`@picked/react`) and `getReference`
|
|
8
|
-
* (`@picked/svelte`), which is what most consumers should reach for.
|
|
9
|
-
*
|
|
10
|
-
* This module is the framework-agnostic half: readers that turn a raw field
|
|
11
|
-
* value into the id (or ids) to look up, tolerating both a single value and the
|
|
12
|
-
* array a repeatable field delivers, plus the store derivations the framework
|
|
13
|
-
* bindings wrap.
|
|
14
|
-
*/
|
|
15
|
-
import { type Store } from 'effector';
|
|
16
|
-
import type { Content, ContentsStore } from './content';
|
|
17
|
-
/** A pointer at another Content record, as delivered inside a `reference` field. */
|
|
18
|
-
export interface ContentReference {
|
|
19
|
-
/** Id of the referenced Content record, to look up in the content index. */
|
|
20
|
-
contentEntryId: string;
|
|
21
|
-
/** The `key` of the Content Model the target belongs to, or `null` when unresolved. */
|
|
22
|
-
contentModelKey?: string | null;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Narrows an arbitrary field value to a {@link ContentReference}.
|
|
26
|
-
*
|
|
27
|
-
* A pointer that still carries inline `data` matches: the delivery surface emits
|
|
28
|
-
* inline data alongside the separate record while that format is retired, and
|
|
29
|
-
* both shapes address the same record.
|
|
30
|
-
*
|
|
31
|
-
* @param {unknown} value - The raw value read from a content blob's `data`.
|
|
32
|
-
* @returns {boolean} Whether `value` is a reference pointer.
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* if (isContentReference(content.author)) { content.author.contentEntryId }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare function isContentReference(value: unknown): value is ContentReference;
|
|
39
|
-
/**
|
|
40
|
-
* Reads the referenced Content record id from a single `reference` field value.
|
|
41
|
-
*
|
|
42
|
-
* @param {unknown} value - The raw value read from a content blob's `data`.
|
|
43
|
-
* @returns {string | null} The referenced id, or `null` when the field is unset or not a reference.
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const authorId = readReferenceId(content.author)
|
|
47
|
-
* ```
|
|
48
|
-
*/
|
|
49
|
-
export declare function readReferenceId(value: unknown): string | null;
|
|
50
|
-
/**
|
|
51
|
-
* Reads every referenced Content record id from a `reference` field, whether it
|
|
52
|
-
* was authored as repeatable or not. Values that are not references are dropped,
|
|
53
|
-
* so the result is always a list of ids that can be looked up.
|
|
54
|
-
*
|
|
55
|
-
* @param {unknown} value - The raw value read from a content blob's `data`.
|
|
56
|
-
* @returns {string[]} The referenced ids, in field order.
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* const authorIds = readReferenceIds(content.authors)
|
|
60
|
-
* ```
|
|
61
|
-
*/
|
|
62
|
-
export declare function readReferenceIds(value: unknown): string[];
|
|
63
|
-
/**
|
|
64
|
-
* Derives a store resolving a single `reference` field value against the content
|
|
65
|
-
* registry.
|
|
66
|
-
*
|
|
67
|
-
* Reads the registry index rather than a per-id store so an unset field, an
|
|
68
|
-
* unregistered target, and a target registered after first paint all flow
|
|
69
|
-
* through one reactive path. The framework bindings (`useReference`,
|
|
70
|
-
* `getReference`) wrap this; call it directly only outside React and Svelte.
|
|
71
|
-
*
|
|
72
|
-
* @param {ContentsStore} contents - The client's content registry.
|
|
73
|
-
* @param {unknown} value - The raw `reference` value, or an Effector store carrying one. A
|
|
74
|
-
* store keeps the lookup live when the field arrives after this call.
|
|
75
|
-
* @returns {Store<Content | null>} The referenced record, or `null` when the field is unset or its target is not registered.
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* const author = deriveReference(client.contents, content.author)
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export declare function deriveReference(contents: ContentsStore, value: unknown): Store<Content | null>;
|
|
82
|
-
/**
|
|
83
|
-
* Derives a store resolving a repeatable `reference` field against the content
|
|
84
|
-
* registry, in field order. A single (non-repeatable) value resolves to a
|
|
85
|
-
* one-element list.
|
|
86
|
-
*
|
|
87
|
-
* The list is dense: a pointer whose target is not registered — deleted, cut off
|
|
88
|
-
* by the reference depth cap, or belonging to another workspace — is skipped
|
|
89
|
-
* rather than held as a hole, so consumers can iterate without a null check.
|
|
90
|
-
*
|
|
91
|
-
* @param {ContentsStore} contents - The client's content registry.
|
|
92
|
-
* @param {unknown} value - The raw `reference` value, or an Effector store carrying one. A
|
|
93
|
-
* store keeps the lookup live when the field arrives after this call.
|
|
94
|
-
* @returns {Store<Content[]>} The referenced records that resolved.
|
|
95
|
-
* @example
|
|
96
|
-
* ```typescript
|
|
97
|
-
* const authors = deriveReferences(client.contents, content.authors)
|
|
98
|
-
* ```
|
|
99
|
-
*/
|
|
100
|
-
export declare function deriveReferences(contents: ContentsStore, value: unknown): Store<Content[]>;
|
|
101
|
-
//# sourceMappingURL=reference.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reference.d.ts","sourceRoot":"","sources":["../../../../src/entities/content/reference.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAe,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAEvD,oFAAoF;AACpF,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAA;IACtB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAChC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAQ5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAE7D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAUzD;AAiCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAS9F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC,CAS1F"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/** @file Field privacy policies — the policy shape and the normalisation applied at registration. */
|
|
2
|
-
/**
|
|
3
|
-
* Privacy policies governing what leaves the page. Both are opt-in, and neither affects
|
|
4
|
-
* the in-memory response store.
|
|
5
|
-
*/
|
|
6
|
-
export interface FieldPolicies {
|
|
7
|
-
/** Sends the captured value to analytics. */
|
|
8
|
-
trackValue?: boolean;
|
|
9
|
-
/** Persists the captured value in browser storage. */
|
|
10
|
-
storeValue?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Use `trackValue`. `doNotTrackValue: false` will be removed in a future version.
|
|
13
|
-
*/
|
|
14
|
-
doNotTrackValue?: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Use `storeValue`. `doNotStoreValue: false` will be removed in a future version.
|
|
17
|
-
*/
|
|
18
|
-
doNotStoreValue?: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Resolves the policies a field states into all four flags, so every reader downstream
|
|
22
|
-
* consults `trackValue` and `storeValue` alone. The positive flag decides whenever the
|
|
23
|
-
* field states it; otherwise the deprecated flag grants capture at an explicit `false`.
|
|
24
|
-
* An absent `policies` object and an absent flag both withhold the value.
|
|
25
|
-
*
|
|
26
|
-
* @param {FieldPolicies | undefined} policies - The policies as the field states them.
|
|
27
|
-
* @returns {Required<FieldPolicies>} All four flags, each deprecated flag the inverse of its replacement.
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* normaliseFieldPolicies({ doNotTrackValue: false })
|
|
31
|
-
* // { trackValue: true, storeValue: false, doNotTrackValue: false, doNotStoreValue: true }
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function normaliseFieldPolicies(policies?: FieldPolicies): Required<FieldPolicies>;
|
|
35
|
-
//# sourceMappingURL=policies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policies.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/policies.ts"],"names":[],"mappings":"AAAA,qGAAqG;AAErG;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAQD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,QAAQ,CAAC,aAAa,CAAC,CAWxF"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/** @file Validation utilities for response values — type checks, coercion, and field-level validation. */
|
|
2
|
-
import type { Field, FieldValue } from '../field/field';
|
|
3
|
-
import type { LogicObject, LogicRule } from '../../logic-engine';
|
|
4
|
-
export interface ValidationError {
|
|
5
|
-
fieldKey: Field['key'];
|
|
6
|
-
userMessage: string;
|
|
7
|
-
systemMessage: string;
|
|
8
|
-
value: FieldValue;
|
|
9
|
-
}
|
|
10
|
-
/** Callback signature for evaluating rule-based validation logic. */
|
|
11
|
-
type RuleEvaluator = (logic: LogicRule, context?: LogicObject) => Promise<unknown>;
|
|
12
|
-
/**
|
|
13
|
-
* Resolves a field from an array by id or key.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} inputKey - The field id or key to look up.
|
|
16
|
-
* @param {Field[]} allFields - All registered fields.
|
|
17
|
-
* @returns {Field | null} The matching field, or null if not found.
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* resolveField('email', allFields) // Field | null
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function resolveField(inputKey: string, allFields: Field[]): Field | null;
|
|
24
|
-
/**
|
|
25
|
-
* Coerces a scalar value into a single-element array when the field expects multiple values.
|
|
26
|
-
*
|
|
27
|
-
* @param {Field} field - The field definition.
|
|
28
|
-
* @param {FieldValue} value - The response value to coerce.
|
|
29
|
-
* @returns {FieldValue} The original or coerced value.
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* coerceToArray(multipleField, 'hello') // ['hello']
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function coerceToArray(field: Field, value: FieldValue): FieldValue;
|
|
36
|
-
/**
|
|
37
|
-
* Validates that an object field value has the correct shape and is JSON-serializable.
|
|
38
|
-
*
|
|
39
|
-
* @param {Field} field - The field definition.
|
|
40
|
-
* @param {FieldValue} value - The response value to validate.
|
|
41
|
-
* @returns {ValidationError | null} A validation error if the value is invalid, or null if valid.
|
|
42
|
-
* @example
|
|
43
|
-
* ```typescript
|
|
44
|
-
* getObjectValueError(objectField, { key: 'val' }) // null
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare function getObjectValueError(field: Field, value: FieldValue): ValidationError | null;
|
|
48
|
-
/**
|
|
49
|
-
* Validates that a response value matches one of the field's allowed options.
|
|
50
|
-
*
|
|
51
|
-
* @param {Field} field - The field definition with options.
|
|
52
|
-
* @param {FieldValue} value - The response value to validate.
|
|
53
|
-
* @returns {ValidationError | null} A validation error if the value is not a valid option, or null if valid.
|
|
54
|
-
* @example
|
|
55
|
-
* ```typescript
|
|
56
|
-
* getOptionsError(fieldWithOptions, 'valid-option') // null
|
|
57
|
-
* ```
|
|
58
|
-
*/
|
|
59
|
-
export declare function getOptionsError(field: Field, value: FieldValue): ValidationError | null;
|
|
60
|
-
/**
|
|
61
|
-
* Runs field-level validation including rule-based validation, required checks, and multiplicity checks.
|
|
62
|
-
*
|
|
63
|
-
* @param {RuleEvaluator} evaluateRule - Callback to evaluate rule-based validation logic.
|
|
64
|
-
* @param {Field} field - The field definition.
|
|
65
|
-
* @param {FieldValue} value - The response value to validate.
|
|
66
|
-
* @param {Record<string, FieldValue>} [responses] - All current responses for cross-field validation.
|
|
67
|
-
* @returns {Promise<ValidationError | null>} A validation error if the field fails validation, or null if valid.
|
|
68
|
-
* @example
|
|
69
|
-
* ```typescript
|
|
70
|
-
* await getFieldValidationError(evaluate, field, 'hello') // null
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare function getFieldValidationError(evaluateRule: RuleEvaluator, field: Field, value: FieldValue, responses?: Record<string, FieldValue>): Promise<ValidationError | null>;
|
|
74
|
-
export {};
|
|
75
|
-
//# sourceMappingURL=response-validation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response-validation.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response-validation.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAGhE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,qEAAqE;AACrE,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;AA+ElF;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,IAAI,CAE/E;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CASzE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CAgE3F;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,GAAG,IAAI,CAuCvF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,uBAAuB,CAC3C,YAAY,EAAE,aAAa,EAC3B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,EACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GACrC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAsCjC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/** @file Session entity — single Effector store for the visitor session (id, isUser flag, identifiers) plus mutator events generated via `createApi`. Persists to localStorage when available. */
|
|
2
|
-
import { type EventCallable, type Store } from 'effector';
|
|
3
|
-
/** Plain shape of a persisted session — id, optional isUser flag, optional identifiers map. */
|
|
4
|
-
export interface Session {
|
|
5
|
-
id: string;
|
|
6
|
-
isUser?: boolean;
|
|
7
|
-
identifiers?: Record<string, string>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Session entity exposing the reactive `Session` store and mutator events. Field reads
|
|
11
|
-
* derive from the store via `.map`, which is reference-equality memoised so per-field
|
|
12
|
-
* subscribers only re-emit when their slice actually changes.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const session = createSession()
|
|
17
|
-
* session.store.map((s) => s.id).watch((id) => console.log('Session id:', id))
|
|
18
|
-
* session.setIsUser(true)
|
|
19
|
-
* session.setIdentifier({ key: 'fp_id', value: 'abc' })
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export interface SessionEntity {
|
|
23
|
-
/** Reactive store of the full session. Hydrated synchronously from localStorage when available; otherwise minted fresh in memory. */
|
|
24
|
-
store: Store<Session>;
|
|
25
|
-
/** Event — sets the isUser flag. */
|
|
26
|
-
setIsUser: EventCallable<boolean>;
|
|
27
|
-
/** Event — adds or replaces an identifier in the identifiers map. */
|
|
28
|
-
setIdentifier: EventCallable<{
|
|
29
|
-
key: string;
|
|
30
|
-
value: string;
|
|
31
|
-
}>;
|
|
32
|
-
/** Event — removes an identifier from the identifiers map. */
|
|
33
|
-
removeIdentifier: EventCallable<string>;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Initialises a session entity. Always succeeds — persistence is gated internally on `supportsLocalStorage()`, so callers do not need to null-check the result.
|
|
37
|
-
*
|
|
38
|
-
* @returns {SessionEntity} A ready-to-use session entity.
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* const session = initialiseSession()
|
|
42
|
-
* console.log(session.store.getState().id)
|
|
43
|
-
* ```
|
|
44
|
-
*/
|
|
45
|
-
export declare function initialiseSession(): SessionEntity;
|
|
46
|
-
//# sourceMappingURL=session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/entities/session/session.ts"],"names":[],"mappings":"AAAA,kMAAkM;AAClM,OAAO,EAAkC,KAAK,aAAa,EAAU,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAKjG,+FAA+F;AAC/F,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B,qIAAqI;IACrI,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAErB,oCAAoC;IACpC,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;IACjC,qEAAqE;IACrE,aAAa,EAAE,aAAa,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC5D,8DAA8D;IAC9D,gBAAgB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACxC;AA+GD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAEjD"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/** @file Step entity — Effector stores, types, and lifecycle helpers for experience steps. */
|
|
2
|
-
import { type Store } from 'effector';
|
|
3
|
-
import type { Content } from '../content/content';
|
|
4
|
-
export type StepsStore = ReturnType<typeof createStepIndex>;
|
|
5
|
-
export interface ExperienceStep {
|
|
6
|
-
id: string;
|
|
7
|
-
key: string;
|
|
8
|
-
name: string;
|
|
9
|
-
fieldKeys: string[];
|
|
10
|
-
layoutName?: string | null;
|
|
11
|
-
/**
|
|
12
|
-
* Optional reference to a CMS Content record that supplies the step's layout data.
|
|
13
|
-
* The actual content is registered separately via `client.registerContent` and
|
|
14
|
-
* resolved at render time through `layoutContentStore` against the global content registry.
|
|
15
|
-
*/
|
|
16
|
-
layoutContentId?: string | null;
|
|
17
|
-
/**
|
|
18
|
-
* Reactive store of the content record this step references. Composed at registration
|
|
19
|
-
* time against `client.contents.getById(layoutContentId)`. `null` when the step has no
|
|
20
|
-
* `layoutContentId`. Reads stay reactive — content registered after the step
|
|
21
|
-
* (or updated mid-session) flows through automatically.
|
|
22
|
-
*/
|
|
23
|
-
layoutContentStore?: Store<Content | null> | null;
|
|
24
|
-
}
|
|
25
|
-
declare const createStepIndexFactory: () => {
|
|
26
|
-
register: (step: ExperienceStep) => void;
|
|
27
|
-
getById: (id: ExperienceStep['id']) => Store<ExperienceStep | null>;
|
|
28
|
-
getByKey: (key: ExperienceStep['key']) => Store<ExperienceStep | null>;
|
|
29
|
-
listStore: Store<ExperienceStep[]>;
|
|
30
|
-
indexStore: import("effector").StoreWritable<{
|
|
31
|
-
[id: string]: ExperienceStep;
|
|
32
|
-
}>;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Creates an Effector-based index for registering and retrieving steps.
|
|
36
|
-
*
|
|
37
|
-
* @returns {ReturnType<typeof createStepIndexFactory>} A step index with register, getById, getByKey, listStore, and indexStore.
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* const steps = createStepIndex()
|
|
41
|
-
* ```
|
|
42
|
-
*/
|
|
43
|
-
export declare function createStepIndex(): ReturnType<typeof createStepIndexFactory>;
|
|
44
|
-
/**
|
|
45
|
-
* Registers a step with the given index via the helper function.
|
|
46
|
-
*
|
|
47
|
-
* @param {ExperienceStep} step - The step definition to register.
|
|
48
|
-
* @param {ReturnType<typeof createStepIndex>} index - The step index to register the step with.
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* setupStep(step, index)
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
export declare function setupStep(step: ExperienceStep, index: ReturnType<typeof createStepIndex>): void;
|
|
55
|
-
export {};
|
|
56
|
-
//# sourceMappingURL=step.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/entities/step/step.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAA2B,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA;AAI3D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,IAAI,CAAA;CAClD;AAED,QAAA,MAAM,sBAAsB;qBAuBF,cAAc,KAAG,IAAI;kBAkBxB,cAAc,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;oBAcjD,cAAc,CAAC,KAAK,CAAC,KAAG,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC;;;;;CAa3E,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,IAAI,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAE3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,GAAG,IAAI,CAE/F"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** @file Parses FormData snapshots into typed field-response records keyed by field key. */
|
|
2
|
-
import type { FieldBase, FieldValue } from '../entities/field/field';
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,28 +0,0 @@
|
|
|
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';
|
|
4
|
-
import type { Picked } from '../picked';
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,60 +0,0 @@
|
|
|
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';
|
|
4
|
-
import type { ValidationError } from '../entities/response/response';
|
|
5
|
-
import type { Picked } from '../picked';
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/** @file Creates form instances that wire field evaluation, validation, and submission. */
|
|
2
|
-
import { type EventCallable, type Store } from 'effector';
|
|
3
|
-
import type { Field, FieldValue } from '../entities/field/field';
|
|
4
|
-
import type { ExperienceInstance } from '../entities/experience-instance/experience-instance';
|
|
5
|
-
import type { ValidationError } from '../entities/response/response';
|
|
6
|
-
import type { Picked } from '../picked';
|
|
7
|
-
import { type ErrorCallback, type SubmitCallback, type SubmitEventWithCurrentTarget, type SuccessCallback } from './create-submit-pipeline';
|
|
8
|
-
export type FormField = Field & {
|
|
9
|
-
value: FieldValue | undefined;
|
|
10
|
-
/** Validation error for this field, or undefined if valid. */
|
|
11
|
-
error: ValidationError | undefined;
|
|
12
|
-
touched: boolean;
|
|
13
|
-
/** HTML-safe attributes to spread onto an input element. */
|
|
14
|
-
props: {
|
|
15
|
-
id: string;
|
|
16
|
-
name: string;
|
|
17
|
-
key: string;
|
|
18
|
-
value: FieldValue | undefined;
|
|
19
|
-
type: 'text' | 'number' | 'checkbox';
|
|
20
|
-
required: boolean;
|
|
21
|
-
placeholder: string | undefined;
|
|
22
|
-
oninput: (e: Event) => void;
|
|
23
|
-
onchange: (e: Event) => void;
|
|
24
|
-
onblur: (e: Event) => void;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Dependencies that framework wrappers inject into createForm.
|
|
29
|
-
* Replaces Svelte's getPicked()/getExperience() context calls.
|
|
30
|
-
*/
|
|
31
|
-
export interface CreateFormDeps {
|
|
32
|
-
client: Picked;
|
|
33
|
-
experienceInstance: ExperienceInstance;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Return type for createForm().
|
|
37
|
-
* Provides form handlers, reactive stores, and callback registration.
|
|
38
|
-
*/
|
|
39
|
-
export interface FormInstance<TFieldKeys extends string = string> {
|
|
40
|
-
/** Form element props (bind to a form element). */
|
|
41
|
-
form: {
|
|
42
|
-
/** HTML-safe attributes to spread onto a form element. */
|
|
43
|
-
props: {
|
|
44
|
-
onsubmit: EventCallable<SubmitEventWithCurrentTarget>;
|
|
45
|
-
};
|
|
46
|
-
/** Flat list of all current validation errors — derived from fieldErrors. */
|
|
47
|
-
errors: Store<ValidationError[]>;
|
|
48
|
-
/** Reactive store indicating if form is currently submitting. */
|
|
49
|
-
submitting: Store<boolean>;
|
|
50
|
-
/** Register callbacks to transform/validate data before submission. Returns unsubscribe. */
|
|
51
|
-
onBeforeSubmit: (callback: SubmitCallback<TFieldKeys>) => () => void;
|
|
52
|
-
/** Register callbacks to run on successful form submission. Returns unsubscribe. */
|
|
53
|
-
onSuccess: (callback: SuccessCallback<TFieldKeys>) => () => void;
|
|
54
|
-
/** Register callbacks to run on form validation errors. Returns unsubscribe. */
|
|
55
|
-
onError: (callback: ErrorCallback) => () => void;
|
|
56
|
-
};
|
|
57
|
-
/** Reactive store of fields with current values, errors, touched state, and event handlers. */
|
|
58
|
-
fields: Store<FormField[]>;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Extracts the current value from a form input event.
|
|
62
|
-
*
|
|
63
|
-
* @param {Event} e - The DOM event from an input, select, or textarea element.
|
|
64
|
-
* @returns {FieldValue | undefined} The field value, or undefined if the event target is not a recognised form element.
|
|
65
|
-
* @example
|
|
66
|
-
* ```ts
|
|
67
|
-
* input.addEventListener('input', (e) => {
|
|
68
|
-
* const value = getEventValue(e)
|
|
69
|
-
* })
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
export declare function getEventValue(e: Event): FieldValue | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* Extracts the staged value for a field from a form event. For a multi-value
|
|
75
|
-
* checkbox group, toggles the clicked option's value into or out of
|
|
76
|
-
* `currentValue` rather than reading the DOM — under React-controlled
|
|
77
|
-
* checkboxes, reconciliation reverts `el.checked` to match the prop before
|
|
78
|
-
* the change event fires, so any DOM-based read returns the pre-toggle
|
|
79
|
-
* state. For `<select multiple>`, reads `el.selectedOptions` (React does
|
|
80
|
-
* not race the change event there). Falls back to {@link getEventValue}
|
|
81
|
-
* for single-value fields and unrelated targets.
|
|
82
|
-
*
|
|
83
|
-
* For multi-checkbox events other than `change`: returns `undefined` for
|
|
84
|
-
* `input` so the caller skips dispatch (both `input` and `change` fire on a
|
|
85
|
-
* single click; only `change` should toggle, otherwise the toggle would run
|
|
86
|
-
* twice and cancel out). Returns `currentValue` (coerced to an array) for
|
|
87
|
-
* any non-change event so the caller can still dispatch — keeping
|
|
88
|
-
* touched-tracking and required-validation on `blur` working.
|
|
89
|
-
*
|
|
90
|
-
* Not re-exported from the form barrel; intended for use by the form's own
|
|
91
|
-
* field handlers and for direct unit testing.
|
|
92
|
-
*
|
|
93
|
-
* @param {Event} e - The DOM event from a form input.
|
|
94
|
-
* @param {Field} field - The field whose handler received the event.
|
|
95
|
-
* @param {FieldValue | undefined} currentValue - The field's currently staged or committed value.
|
|
96
|
-
* @returns {FieldValue | undefined} The value to stage, or undefined if the caller should skip dispatch.
|
|
97
|
-
* @example
|
|
98
|
-
* ```ts
|
|
99
|
-
* input.addEventListener('change', (e) => {
|
|
100
|
-
* const value = getStagedEventValue(e, field, field.value)
|
|
101
|
-
* })
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
export declare function getStagedEventValue(e: Event, field: Field, currentValue: FieldValue | undefined): FieldValue | undefined;
|
|
105
|
-
/**
|
|
106
|
-
* Builds a DOM event handler that derives the next staged value via
|
|
107
|
-
* {@link getStagedEventValue} and dispatches the given event-callable when
|
|
108
|
-
* the helper returns a defined value. Skips dispatch if the helper returns
|
|
109
|
-
* undefined (e.g. `input` events on multi-select checkboxes, where dispatch
|
|
110
|
-
* is owned by the change event to avoid double-toggling).
|
|
111
|
-
*
|
|
112
|
-
* Not re-exported from the form barrel; intended for use by `createForm`
|
|
113
|
-
* and for direct unit testing.
|
|
114
|
-
*
|
|
115
|
-
* @param {Field} field - The field bound to the handler.
|
|
116
|
-
* @param {FieldValue | undefined} value - The field's currently staged or committed value.
|
|
117
|
-
* @param {EventCallable<{ fieldKey: string; value: FieldValue }>} dispatch - The event-callable to fire when the helper returns a value.
|
|
118
|
-
* @returns {(e: Event) => void} The handler to attach to a DOM event.
|
|
119
|
-
* @example
|
|
120
|
-
* ```ts
|
|
121
|
-
* const onChange = createFieldHandler(field, value, fieldChangeEvent)
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export declare function createFieldHandler(field: Field, value: FieldValue | undefined, dispatch: EventCallable<{
|
|
125
|
-
fieldKey: string;
|
|
126
|
-
value: FieldValue;
|
|
127
|
-
}>): (e: Event) => void;
|
|
128
|
-
/**
|
|
129
|
-
* Creates a form instance tied to a set of field keys.
|
|
130
|
-
* Handles field evaluation, form submission, data transformation,
|
|
131
|
-
* validation, event bus tracking, and step navigation.
|
|
132
|
-
*
|
|
133
|
-
* Framework-agnostic — framework wrappers (Svelte, React) inject
|
|
134
|
-
* client and experienceInstance via the deps parameter and handle
|
|
135
|
-
* callback cleanup lifecycle.
|
|
136
|
-
*
|
|
137
|
-
* @param {CreateFormDeps} deps - Client and experience instance injected by the framework wrapper.
|
|
138
|
-
* @param {string} formId - Unique identifier for this form instance.
|
|
139
|
-
* @param {Store<string>} title - Reactive store holding the form/step title.
|
|
140
|
-
* @param {Store<string[]>} fieldKeys - Reactive store of field keys that belong to this form.
|
|
141
|
-
* @returns {FormInstance} A form instance with reactive field stores, submission handlers, and callback registration.
|
|
142
|
-
* @example
|
|
143
|
-
* ```ts
|
|
144
|
-
* const form = createForm(
|
|
145
|
-
* { client, experienceInstance },
|
|
146
|
-
* 'lead-capture',
|
|
147
|
-
* $title,
|
|
148
|
-
* $fieldKeys,
|
|
149
|
-
* )
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
export declare function createForm(deps: CreateFormDeps, formId: string, title: Store<string>, fieldKeys: Store<string[]>): FormInstance;
|
|
153
|
-
//# sourceMappingURL=create-form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-form.d.ts","sourceRoot":"","sources":["../../../src/form/create-form.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,KAAK,EAEX,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,4BAA4B,EACjC,KAAK,eAAe,EACrB,MAAM,0BAA0B,CAAA;AAEjC,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG;IAC9B,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;IAC7B,8DAA8D;IAC9D,KAAK,EAAE,eAAe,GAAG,SAAS,CAAA;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,4DAA4D;IAC5D,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;QAC7B,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAA;QACpC,QAAQ,EAAE,OAAO,CAAA;QACjB,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;QAC/B,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;QAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;QAC5B,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;KAC3B,CAAA;CACF,CAAA;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,kBAAkB,EAAE,kBAAkB,CAAA;CACvC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,UAAU,SAAS,MAAM,GAAG,MAAM;IAC9D,mDAAmD;IACnD,IAAI,EAAE;QACJ,0DAA0D;QAC1D,KAAK,EAAE;YACL,QAAQ,EAAE,aAAa,CAAC,4BAA4B,CAAC,CAAA;SACtD,CAAA;QACD,6EAA6E;QAC7E,MAAM,EAAE,KAAK,CAAC,eAAe,EAAE,CAAC,CAAA;QAChC,iEAAiE;QACjE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;QAC1B,4FAA4F;QAC5F,cAAc,EAAE,CAAC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,KAAK,MAAM,IAAI,CAAA;QACpE,oFAAoF;QACpF,SAAS,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,KAAK,MAAM,IAAI,CAAA;QAChE,gFAAgF;QAChF,OAAO,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,MAAM,IAAI,CAAA;KACjD,CAAA;IACD,+FAA+F;IAC/F,MAAM,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAA;CAC3B;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,SAAS,CAW9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,KAAK,EACR,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,UAAU,GAAG,SAAS,GACnC,UAAU,GAAG,SAAS,CAaxB;AAyCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,UAAU,GAAG,SAAS,EAC7B,QAAQ,EAAE,aAAa,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAE,CAAC,GAC/D,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAOpB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,GACzB,YAAY,CAoKd"}
|