@picked/client 0.0.1-dev.1794460939512 → 0.0.1-dev.1794524488993
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-DpESrsVW.js → api-BPgIOr9M.js} +1 -1
- package/dist/{api-CwgMIHfV.cjs → api-CPcoVcOk.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 +228 -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 +135 -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 +34 -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 +155 -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/devtools-experience.d.ts +4 -0
- package/dist/cjs/utils/devtools-experience.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-UA4qhlvs.cjs → plugin-C-4rIh44.cjs} +1 -1
- package/dist/{plugin-C7lY7wA0.js → plugin-C9tjxmv9.js} +2 -2
- package/dist/{preview-unavailable-D5JVXP6H.js → preview-unavailable-7lhCKSQG.js} +1 -1
- package/dist/{preview-unavailable-DcA7cGAO.cjs → preview-unavailable-CG-i-Ish.cjs} +1 -1
- package/dist/{provider-ZrjYdXty.cjs → provider-BA1KvzJM.cjs} +1 -1
- package/dist/{provider-B3lHhG5v.js → provider-CAsL7WcN.js} +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 +20 -20
- 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,135 @@
|
|
|
1
|
+
/** @file Field entity — Effector stores, types, and CRUD helpers for experience fields. */
|
|
2
|
+
import { type Store } from 'effector';
|
|
3
|
+
import type { LogicRule } from '../../logic-engine.js';
|
|
4
|
+
import { type FieldPolicies } from './policies.js';
|
|
5
|
+
export type FieldsStore = ReturnType<typeof createFieldIndex>;
|
|
6
|
+
export type PrimitiveFieldValue = string | number | boolean | null;
|
|
7
|
+
export type FieldOptionValue = string | number | boolean;
|
|
8
|
+
export interface FieldOption<T = FieldOptionValue> {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
value: T;
|
|
13
|
+
condition?: LogicRule;
|
|
14
|
+
}
|
|
15
|
+
export type FieldOptionArray<T = FieldOptionValue> = FieldOption<T>[];
|
|
16
|
+
/**
|
|
17
|
+
* JSON-serializable value type for object fields.
|
|
18
|
+
* Recursively defines all valid JSON-serializable structures.
|
|
19
|
+
*/
|
|
20
|
+
export type JsonValue = string | number | boolean | null | {
|
|
21
|
+
[key: string]: JsonValue;
|
|
22
|
+
} | JsonValue[];
|
|
23
|
+
export type FieldValue = PrimitiveFieldValue | PrimitiveFieldValue[] | JsonValue | JsonValue[];
|
|
24
|
+
export interface FieldBase<TOptionValue = JsonValue> {
|
|
25
|
+
id: string;
|
|
26
|
+
/** Stable identifier used for lookups across API versions. */
|
|
27
|
+
key: string;
|
|
28
|
+
name: string;
|
|
29
|
+
label: string;
|
|
30
|
+
type: 'text' | 'number' | 'object' | 'boolean';
|
|
31
|
+
multiple: boolean;
|
|
32
|
+
required: boolean;
|
|
33
|
+
defaultValue?: FieldValue;
|
|
34
|
+
/**
|
|
35
|
+
* `true` while `defaultValue` holds a value a review tool put in for a reviewer, such as a
|
|
36
|
+
* devtools preset's response. A component can mark that value, so the reviewer can tell the
|
|
37
|
+
* preset's choice from one the site preselects.
|
|
38
|
+
*/
|
|
39
|
+
prefilled?: boolean;
|
|
40
|
+
condition?: LogicRule;
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
helpText?: string;
|
|
44
|
+
validation?: LogicRule;
|
|
45
|
+
/**
|
|
46
|
+
* Privacy policies governing what leaves the page. Both are opt-in: a value is
|
|
47
|
+
* tracked only under `trackValue: true` and persisted only under `storeValue: true`,
|
|
48
|
+
* so an absent policy captures nothing. Registration resolves whatever the field
|
|
49
|
+
* states into all four flags, so a registered field always answers on `trackValue`
|
|
50
|
+
* and `storeValue`.
|
|
51
|
+
*/
|
|
52
|
+
policies?: FieldPolicies;
|
|
53
|
+
options?: FieldOptionArray<TOptionValue> | null;
|
|
54
|
+
}
|
|
55
|
+
export interface FieldTextSingular extends FieldBase<string> {
|
|
56
|
+
type: 'text';
|
|
57
|
+
multiple: false;
|
|
58
|
+
defaultValue?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface FieldTextMultiple extends FieldBase<string> {
|
|
61
|
+
type: 'text';
|
|
62
|
+
multiple: true;
|
|
63
|
+
defaultValue?: string[];
|
|
64
|
+
}
|
|
65
|
+
export interface FieldNumberSingular extends FieldBase<number> {
|
|
66
|
+
type: 'number';
|
|
67
|
+
multiple: false;
|
|
68
|
+
defaultValue?: number;
|
|
69
|
+
}
|
|
70
|
+
export interface FieldNumberMultiple extends FieldBase<number> {
|
|
71
|
+
type: 'number';
|
|
72
|
+
multiple: true;
|
|
73
|
+
defaultValue?: number[];
|
|
74
|
+
}
|
|
75
|
+
export interface FieldObjectSingular extends FieldBase<JsonValue> {
|
|
76
|
+
type: 'object';
|
|
77
|
+
multiple: false;
|
|
78
|
+
defaultValue?: JsonValue;
|
|
79
|
+
}
|
|
80
|
+
export interface FieldObjectMultiple extends FieldBase<JsonValue> {
|
|
81
|
+
type: 'object';
|
|
82
|
+
multiple: true;
|
|
83
|
+
defaultValue?: JsonValue[];
|
|
84
|
+
}
|
|
85
|
+
export interface FieldBooleanSingular extends FieldBase<boolean> {
|
|
86
|
+
type: 'boolean';
|
|
87
|
+
multiple: false;
|
|
88
|
+
defaultValue?: boolean;
|
|
89
|
+
}
|
|
90
|
+
export interface FieldBooleanMultiple extends FieldBase<boolean> {
|
|
91
|
+
type: 'boolean';
|
|
92
|
+
multiple: true;
|
|
93
|
+
defaultValue?: boolean[];
|
|
94
|
+
}
|
|
95
|
+
export type Field = FieldTextSingular | FieldTextMultiple | FieldNumberSingular | FieldNumberMultiple | FieldObjectSingular | FieldObjectMultiple | FieldBooleanSingular | FieldBooleanMultiple;
|
|
96
|
+
type FieldWithOptionalKey<T> = T extends Field ? Omit<T, 'key'> & {
|
|
97
|
+
key?: string;
|
|
98
|
+
} : never;
|
|
99
|
+
/**
|
|
100
|
+
* A {@link Field} whose `key` is optional. A registration site that accepts one supplies
|
|
101
|
+
* the key from its own context — `createClient({ fields })` uses the record key.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const email: FieldDefinition = {
|
|
106
|
+
* id: 'email',
|
|
107
|
+
* name: 'email',
|
|
108
|
+
* label: 'Email',
|
|
109
|
+
* type: 'text',
|
|
110
|
+
* multiple: false,
|
|
111
|
+
* required: true,
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export type FieldDefinition = FieldWithOptionalKey<Field>;
|
|
116
|
+
declare const createFieldIndexFactory: () => {
|
|
117
|
+
register: (field: Field) => void;
|
|
118
|
+
update: (key: FieldBase['key'], updates: Partial<Field>) => void;
|
|
119
|
+
getById: (id: FieldBase['id']) => Store<Field | null>;
|
|
120
|
+
getByKey: (key: FieldBase['key']) => Store<Field | null>;
|
|
121
|
+
listStore: Store<Field[]>;
|
|
122
|
+
getByName: (name: FieldBase['name']) => Store<Field | null>;
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* Creates an Effector-based index for registering and retrieving fields.
|
|
126
|
+
*
|
|
127
|
+
* @returns {FieldsStore} A field index with register, update, getById, getByKey, and list methods.
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const fields = createFieldIndex()
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export declare function createFieldIndex(): ReturnType<typeof createFieldIndexFactory>;
|
|
134
|
+
export {};
|
|
135
|
+
//# sourceMappingURL=field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/entities/field/field.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** @file Framework entity — Effector stores and registry for UI framework integrations (React, Svelte, etc). */
|
|
2
|
+
import { type EventCallable } from 'effector';
|
|
3
|
+
import type { AdaptedComponent } from '../component/component.js';
|
|
4
|
+
import type { ExperienceInstance } from '../experience-instance/experience-instance.js';
|
|
5
|
+
import type { Picked } from '../../picked.js';
|
|
6
|
+
export type FrameworksStore = ReturnType<typeof createFrameworkIndex>;
|
|
7
|
+
export interface Framework {
|
|
8
|
+
name: string;
|
|
9
|
+
render: FrameworkRender;
|
|
10
|
+
/** Optional teardown for a previously rendered component, keyed by the shadow root it was rendered into. */
|
|
11
|
+
unmount?: FrameworkUnmount;
|
|
12
|
+
}
|
|
13
|
+
declare const createFrameworkIndexFactory: (_params: {
|
|
14
|
+
client: Picked;
|
|
15
|
+
}) => {
|
|
16
|
+
register: EventCallable<{
|
|
17
|
+
name: string;
|
|
18
|
+
framework: Framework;
|
|
19
|
+
}>;
|
|
20
|
+
getByName: (name: string) => import("effector").Store<Framework | undefined>;
|
|
21
|
+
listStore: import("effector").Store<Framework[]>;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Creates a framework index with stores and registration logic.
|
|
25
|
+
*
|
|
26
|
+
* @template T - Factory parameter type.
|
|
27
|
+
* @param {T} params - Factory parameters including the client.
|
|
28
|
+
* @returns {ReturnType<typeof createFrameworkIndexFactory>} The framework index.
|
|
29
|
+
* @example
|
|
30
|
+
* const frameworks = createFrameworkIndex({ client })
|
|
31
|
+
*/
|
|
32
|
+
export declare function createFrameworkIndex<T extends Parameters<typeof createFrameworkIndexFactory>[0]>(params: T): ReturnType<typeof createFrameworkIndexFactory>;
|
|
33
|
+
export type FrameworkRender = (shadowRoot: ShadowRoot, component: AdaptedComponent, client: Picked, experience: ExperienceInstance) => void;
|
|
34
|
+
export type FrameworkUnmount = (target: ShadowRoot) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Convenience helper that dispatches `frameworks.register` with object-payload shape.
|
|
37
|
+
*
|
|
38
|
+
* @param {Framework} framework - The framework to register.
|
|
39
|
+
* @param {FrameworksStore} frameworks - The frameworks index.
|
|
40
|
+
* @example
|
|
41
|
+
* setupFramework({ name: 'react', render: renderFn }, frameworksIndex)
|
|
42
|
+
*/
|
|
43
|
+
export declare const setupFramework: (framework: Framework, frameworks: FrameworksStore) => void;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=framework.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../../../../src/entities/framework/framework.ts"],"names":[],"mappings":"AAAA,gHAAgH;AAChH,OAAO,EAAwC,KAAK,aAAa,EAAU,MAAM,UAAU,CAAA;AAG3F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAA;AACpF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAIrE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,eAAe,CAAA;IACvB,4GAA4G;IAC5G,OAAO,CAAC,EAAE,gBAAgB,CAAA;CAC3B;AAED,QAAA,MAAM,2BAA2B,YAA2B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;cAkBtC,MAAM;mBAAa,SAAS;;sBA6BzC,MAAM;;CAS/B,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,gBAAgB,EAC3B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,IAAI,CAAA;AAET,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;AAE3D;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,cAAe,SAAS,cAAc,eAAe,KAAG,IAElF,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ExperienceNode } from '../experience/experience.js';
|
|
2
|
+
export interface HistoryEntry {
|
|
3
|
+
id: string;
|
|
4
|
+
node: ExperienceNode;
|
|
5
|
+
at: number;
|
|
6
|
+
experienceId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createHistory(): {
|
|
9
|
+
push: import("effector").EventCallable<{
|
|
10
|
+
experienceId: string;
|
|
11
|
+
node: ExperienceNode;
|
|
12
|
+
}>;
|
|
13
|
+
replace: import("effector").EventCallable<{
|
|
14
|
+
experienceId: string;
|
|
15
|
+
node: ExperienceNode;
|
|
16
|
+
}>;
|
|
17
|
+
back: import("effector").EventCallable<{
|
|
18
|
+
experienceId?: string;
|
|
19
|
+
}>;
|
|
20
|
+
restore: import("effector").EventCallable<{
|
|
21
|
+
entries: HistoryEntry[];
|
|
22
|
+
}>;
|
|
23
|
+
entriesStore: import("effector").Store<HistoryEntry[]>;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../../src/entities/history/history.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAM9D,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,cAAc,CAAA;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,YAAY,EAAE,MAAM,CAAA;CACrB;AA4FD,wBAAgB,aAAa;;sBA3EsB,MAAM;cAAQ,cAAc;;;sBACzB,MAAM;cAAQ,cAAc;;;uBAC9B,MAAM;;;iBACT,YAAY,EAAE;;;EA0E9D"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** @file Plugin contract for the Picked SDK. Plugins extend the client via setup-time registration and effector-based onStart hooks. */
|
|
2
|
+
import { type Effect } from 'effector';
|
|
3
|
+
import type { Picked } from '../../picked.js';
|
|
4
|
+
export interface Plugin {
|
|
5
|
+
name: string;
|
|
6
|
+
setup: (client: Picked) => void | PluginConfig;
|
|
7
|
+
}
|
|
8
|
+
export interface PluginConfig {
|
|
9
|
+
/** Effector effect invoked sequentially during the start chain. Use `createPluginEffect(handler)` to wrap a plain async function. */
|
|
10
|
+
onStart?: Effect<void, void, Error>;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface PluginConfigIndex {
|
|
14
|
+
[key: string]: PluginConfig;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Wraps a plain async handler as an effector Effect for use as a plugin onStart hook.
|
|
18
|
+
*
|
|
19
|
+
* @param {() => void | Promise<void>} handler - The function to execute when the plugin starts. May be sync or return a Promise.
|
|
20
|
+
* @returns {Effect<void, void, Error>} An Effect that runs the handler.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const myPlugin: Plugin = {
|
|
24
|
+
* name: 'my-plugin',
|
|
25
|
+
* setup: () => ({
|
|
26
|
+
* onStart: createPluginEffect(async () => {
|
|
27
|
+
* await fetch('/init')
|
|
28
|
+
* }),
|
|
29
|
+
* }),
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function createPluginEffect(handler: () => void | Promise<void>): Effect<void, void, Error>;
|
|
34
|
+
/**
|
|
35
|
+
* Registers a plugin with the client by calling its setup hook and merging any returned config into the plugin index.
|
|
36
|
+
*
|
|
37
|
+
* Every plugin takes an entry, so the index is the roster of what is registered. A plugin
|
|
38
|
+
* that returns no config gets an empty one, which is what `getPluginConfig` already
|
|
39
|
+
* answers for a name it does not hold.
|
|
40
|
+
*
|
|
41
|
+
* @param {Picked} client - The Picked client instance.
|
|
42
|
+
* @param {Plugin} plugin - The plugin to register.
|
|
43
|
+
* @param {PluginConfigIndex} plugins - The plugin config index to mutate.
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* setupPlugin(client, myPlugin, this.plugins)
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare const setupPlugin: (client: Picked, plugin: Plugin, plugins: PluginConfigIndex) => void;
|
|
50
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../src/entities/plugin/plugin.ts"],"names":[],"mappings":"AAAA,wIAAwI;AACxI,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,UAAU,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,GAAG,YAAY,CAAA;CAC/C;AAED,MAAM,WAAW,YAAY;IAC3B,qIAAqI;IACrI,OAAO,CAAC,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAIjG;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,WAAY,MAAM,UAAU,MAAM,WAAW,iBAAiB,KAAG,IAOxF,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/** @file Predicate entity — Effector stores and registry for condition evaluation functions. */
|
|
2
|
+
import { type EventCallable, type Store } from 'effector';
|
|
3
|
+
import type { StateSnapshot } from '../../lifecycle/state-snapshot.js';
|
|
4
|
+
import type { Picked } from '../../picked.js';
|
|
5
|
+
export type Predicate = (snapshot: StateSnapshot & {
|
|
6
|
+
args: unknown[];
|
|
7
|
+
}) => boolean | Promise<boolean> | string | Promise<string> | string[] | Promise<string[]> | undefined;
|
|
8
|
+
export type PredicatesStore = ReturnType<typeof createPredicateIndex>;
|
|
9
|
+
export interface PredicateIndexItem {
|
|
10
|
+
name: string;
|
|
11
|
+
predicate: Predicate;
|
|
12
|
+
}
|
|
13
|
+
declare const createPredicateIndexFactory: ({ client }: {
|
|
14
|
+
client: Picked;
|
|
15
|
+
}) => {
|
|
16
|
+
register: EventCallable<{
|
|
17
|
+
name: string;
|
|
18
|
+
predicate: Predicate;
|
|
19
|
+
}>;
|
|
20
|
+
getByName: (name: string) => Store<Predicate | undefined>;
|
|
21
|
+
listStore: Store<{
|
|
22
|
+
name: string;
|
|
23
|
+
predicate: Predicate;
|
|
24
|
+
}[]>;
|
|
25
|
+
getEvokablePredicate: (predicateName: string) => Store<() => ReturnType<Predicate>>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Creates a predicate index with stores and registration logic.
|
|
29
|
+
*
|
|
30
|
+
* @template T - Factory parameter type.
|
|
31
|
+
* @param {T} params - Factory parameters including the client.
|
|
32
|
+
* @returns {ReturnType<typeof createPredicateIndexFactory>} The predicate index.
|
|
33
|
+
* @example
|
|
34
|
+
* const predicates = createPredicateIndex({ client })
|
|
35
|
+
*/
|
|
36
|
+
export declare function createPredicateIndex<T extends Parameters<typeof createPredicateIndexFactory>[0]>(params: T): ReturnType<typeof createPredicateIndexFactory>;
|
|
37
|
+
/**
|
|
38
|
+
* Convenience helper that dispatches `predicates.register` with object-payload shape.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} name - Predicate name.
|
|
41
|
+
* @param {Predicate} predicate - The predicate function.
|
|
42
|
+
* @param {PredicatesStore} predicates - The predicates index.
|
|
43
|
+
* @example
|
|
44
|
+
* setupPredicate('isAdmin', ({ user }) => user.isAdmin === true, predicatesIndex)
|
|
45
|
+
*/
|
|
46
|
+
export declare const setupPredicate: (name: string, predicate: Predicate, predicates: PredicatesStore) => void;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=predicate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../../../src/entities/predicate/predicate.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,OAAO,EAML,KAAK,aAAa,EAElB,KAAK,KAAK,EACX,MAAM,UAAU,CAAA;AAGjB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,SAAS,GAAG,CACtB,QAAQ,EAAE,aAAa,GAAG;IAAE,IAAI,EAAE,OAAO,EAAE,CAAA;CAAE,KAE3C,OAAO,GACP,OAAO,CAAC,OAAO,CAAC,GAChB,MAAM,GACN,OAAO,CAAC,MAAM,CAAC,GACf,MAAM,EAAE,GACR,OAAO,CAAC,MAAM,EAAE,CAAC,GACjB,SAAS,CAAA;AAEb,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAErE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,SAAS,CAAA;CACrB;AAID,QAAA,MAAM,2BAA2B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;cAwBzC,MAAM;mBAAa,SAAS;;sBAiCzC,MAAM;;cAtDrB,MAAM;mBACD,SAAS;;0CAiEqB,MAAM,KAAG,KAAK,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC;CA0CxF,CAAA;AAEF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAC9F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAEhD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,SAAU,MAAM,aAAa,SAAS,cAAc,eAAe,SAE7F,CAAA"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** @file Validation utilities for response values — type checks, coercion, and field-level validation. */
|
|
2
|
+
import type { Field, FieldValue } from '../field/field.js';
|
|
3
|
+
import type { LogicObject, LogicRule } from '../../logic-engine.js';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/** @file Response entity — Effector stores, commit/validation flow, and field-response lookups. */
|
|
2
|
+
import { type Store } from 'effector';
|
|
3
|
+
import type { Picked } from '../../picked.js';
|
|
4
|
+
import type { Field, FieldValue } from '../field/field.js';
|
|
5
|
+
import type { FieldKeys, FieldValueFor } from '../../schema-registry.js';
|
|
6
|
+
import { type ValidationError } from './response-validation.js';
|
|
7
|
+
export type { ValidationError } from './response-validation.js';
|
|
8
|
+
export type ResponsesStore = ReturnType<typeof createResponseIndex>;
|
|
9
|
+
export type Response = FieldValue;
|
|
10
|
+
export interface ResponseListItem {
|
|
11
|
+
fieldKey: string;
|
|
12
|
+
value: Response;
|
|
13
|
+
}
|
|
14
|
+
declare const createResponseIndexFactory: ({ client }: {
|
|
15
|
+
client: Picked;
|
|
16
|
+
}) => {
|
|
17
|
+
register: {
|
|
18
|
+
(fieldKey: Field['key'], response: Response): void;
|
|
19
|
+
(payload: Record<Field['key'], Response>, response?: never): void;
|
|
20
|
+
};
|
|
21
|
+
clearAll: import("effector").EventCallable<void>;
|
|
22
|
+
clear: import("effector").EventCallable<string>;
|
|
23
|
+
commit: <T extends CommitResponses>(responsesToCommit: T & ValidateResponses<T>) => Promise<{
|
|
24
|
+
errors: ValidationError[];
|
|
25
|
+
}>;
|
|
26
|
+
getResponsesToCommit: <T extends CommitResponses>(responsesToCommit: T & ValidateResponses<T>) => Promise<{
|
|
27
|
+
responsesToCommit: CommitResponses;
|
|
28
|
+
validationErrors: ValidationError[];
|
|
29
|
+
}>;
|
|
30
|
+
listStore: Store<{
|
|
31
|
+
fieldKey: string;
|
|
32
|
+
value: FieldValue;
|
|
33
|
+
}[]>;
|
|
34
|
+
getAllStore: Store<{
|
|
35
|
+
[fieldKey: string]: FieldValue;
|
|
36
|
+
}>;
|
|
37
|
+
getByFieldId: (id: Field['id']) => Store<FieldValue>;
|
|
38
|
+
getByFieldKey: <K extends string>(key: K) => Store<FieldValueFor<K>>;
|
|
39
|
+
getByFieldName: (fieldName: Field['name']) => Store<FieldValue>;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Creates a response index instance bound to the given client.
|
|
43
|
+
*
|
|
44
|
+
* @template T
|
|
45
|
+
* @param {T} params - Configuration including the Picked client instance.
|
|
46
|
+
* @returns {ReturnType<typeof createResponseIndexFactory>} The response index with register, commit, and lookup methods.
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const responses = createResponseIndex({ client })
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export declare function createResponseIndex<T extends Parameters<typeof createResponseIndexFactory>[0]>(params: T): ReturnType<typeof createResponseIndexFactory>;
|
|
53
|
+
/** Loose transport shape: a record keyed by field `key`. Used internally and by the form bridge. */
|
|
54
|
+
export type CommitResponses = Record<string, FieldValue>;
|
|
55
|
+
/**
|
|
56
|
+
* Validates a response payload against the generated schema. For each key the caller actually
|
|
57
|
+
* provides, a workspace-known field key is narrowed to its schema value type while any other key
|
|
58
|
+
* stays a permissive `FieldValue`. Mapping over the caller's own keys (rather than requiring the
|
|
59
|
+
* full field set) is what lets typed literals be checked without breaking dynamic, out-of-schema
|
|
60
|
+
* payloads built by the form bridge.
|
|
61
|
+
*
|
|
62
|
+
* @template T - The inferred payload type.
|
|
63
|
+
* @example
|
|
64
|
+
* type Checked = ValidateResponses<{ 'email-address': string }>
|
|
65
|
+
*/
|
|
66
|
+
export type ValidateResponses<T> = {
|
|
67
|
+
[K in keyof T]: K extends FieldKeys ? FieldValueFor<K> : FieldValue;
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../../src/entities/response/response.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,OAAO,EAAiE,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAEpG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAGrE,OAAO,EAML,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAA;AAE9B,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE5D,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAInE,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAA;AAGjC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,QAAQ,CAAA;CAChB;AAED,QAAA,MAAM,0BAA0B,eAA8B;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;mBA6BlD,KAAK,CAAC,KAAK,CAAC,YAAY,QAAQ,GAAG,IAAI;kBACxC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,KAAK,GAAG,IAAI;;;;aA4K5D,CAAC,SAAS,eAAe,qBAC1B,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,KAC1C,OAAO,CAAC;QAAE,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;2BA5CL,CAAC,SAAS,eAAe,qBACxC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,KAC1C,OAAO,CAAC;QAAE,iBAAiB,EAAE,eAAe,CAAC;QAAC,gBAAgB,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;;;;;;;;uBA0F7D,KAAK,CAAC,IAAI,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;oBAiBlC,CAAC,SAAS,MAAM,OAAO,CAAC,KAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;gCAetC,KAAK,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,UAAU,CAAC;CA2BpE,CAAA;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC,EAC5F,MAAM,EAAE,CAAC,GACR,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAE/C;AAED,oGAAoG;AACpG,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;AAExD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,SAAS,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,UAAU;CACpE,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @file Session entity — single Effector store for the visitor session (Picked ID, isUser flag, identifiers) plus mutator events generated via `createApi`. Persists to localStorage when available. */
|
|
2
|
+
import { type EventCallable, type Store } from 'effector';
|
|
3
|
+
/** The session as the store holds it. */
|
|
4
|
+
export interface Session {
|
|
5
|
+
/** The Picked ID: the id the SDK generates for this browser, stable across page loads. */
|
|
6
|
+
pickedId: string;
|
|
7
|
+
/** @deprecated Use `pickedId`. */
|
|
8
|
+
id: string;
|
|
9
|
+
isUser?: boolean;
|
|
10
|
+
identifiers?: Record<string, string>;
|
|
11
|
+
}
|
|
12
|
+
/** The session as localStorage holds it, which names the Picked ID `id`. */
|
|
13
|
+
export interface PersistedSession {
|
|
14
|
+
id: string;
|
|
15
|
+
isUser?: boolean;
|
|
16
|
+
identifiers?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Session entity exposing the reactive `Session` store and mutator events. Field reads
|
|
20
|
+
* derive from the store via `.map`, which is reference-equality memoised so per-field
|
|
21
|
+
* subscribers only re-emit when their slice actually changes.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const session = initialiseSession()
|
|
26
|
+
* session.store.map((s) => s.pickedId).watch((pickedId) => console.log('Picked ID:', pickedId))
|
|
27
|
+
* session.setIsUser(true)
|
|
28
|
+
* session.setIdentifier({ key: 'fp_id', value: 'abc' })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export interface SessionEntity {
|
|
32
|
+
/** Reactive store of the full session. Hydrated synchronously from localStorage when available; otherwise minted fresh in memory. */
|
|
33
|
+
store: Store<Session>;
|
|
34
|
+
/** Event — sets the isUser flag. */
|
|
35
|
+
setIsUser: EventCallable<boolean>;
|
|
36
|
+
/** Event — adds or replaces an identifier in the identifiers map. */
|
|
37
|
+
setIdentifier: EventCallable<{
|
|
38
|
+
key: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}>;
|
|
41
|
+
/** Event — removes an identifier from the identifiers map. */
|
|
42
|
+
removeIdentifier: EventCallable<string>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Initialises a session entity. Always succeeds — persistence is gated internally on `supportsLocalStorage()`, so callers do not need to null-check the result.
|
|
46
|
+
*
|
|
47
|
+
* @returns {SessionEntity} A ready-to-use session entity.
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const session = initialiseSession()
|
|
51
|
+
* console.log(session.store.getState().pickedId)
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function initialiseSession(): SessionEntity;
|
|
55
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../../src/entities/session/session.ts"],"names":[],"mappings":"AAAA,yMAAyM;AACzM,OAAO,EAAkC,KAAK,aAAa,EAAU,KAAK,KAAK,EAAE,MAAM,UAAU,CAAA;AAKjG,yCAAyC;AACzC,MAAM,WAAW,OAAO;IACtB,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACrC;AAED,4EAA4E;AAC5E,MAAM,WAAW,gBAAgB;IAC/B,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;AAwID;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,aAAa,CAEjD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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.js';
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|