@picked/client 0.0.117-next.2 → 0.0.117
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-CLrjQCaV.cjs → api-0LL6Rz9m.cjs} +1 -1
- package/dist/{api-C5CZCjIM.js → api-BndBn3hE.js} +1 -1
- package/dist/cjs/client.d.ts +161 -0
- package/dist/cjs/client.d.ts.map +1 -0
- package/dist/cjs/data-source/api.d.ts +60 -0
- package/dist/cjs/data-source/api.d.ts.map +1 -0
- package/dist/cjs/data-source/preview-unavailable.d.ts +21 -0
- package/dist/cjs/data-source/preview-unavailable.d.ts.map +1 -0
- package/dist/cjs/data-source/provider.d.ts +108 -0
- package/dist/cjs/data-source/provider.d.ts.map +1 -0
- package/dist/cjs/data-source/registry.d.ts +26 -0
- package/dist/cjs/data-source/registry.d.ts.map +1 -0
- package/dist/cjs/data-source/request-observer.d.ts +75 -0
- package/dist/cjs/data-source/request-observer.d.ts.map +1 -0
- package/dist/cjs/data-source/virtual-data.d.ts +19 -0
- package/dist/cjs/data-source/virtual-data.d.ts.map +1 -0
- package/dist/cjs/entities/action/action.d.ts +156 -0
- package/dist/cjs/entities/action/action.d.ts.map +1 -0
- package/dist/cjs/entities/component/component.d.ts +91 -0
- package/dist/cjs/entities/component/component.d.ts.map +1 -0
- package/dist/cjs/entities/component/lazyComponent.d.ts +11 -0
- package/dist/cjs/entities/component/lazyComponent.d.ts.map +1 -0
- package/dist/cjs/entities/condition/condition.d.ts +29 -0
- package/dist/cjs/entities/condition/condition.d.ts.map +1 -0
- package/dist/cjs/entities/content/content.d.ts +53 -0
- package/dist/cjs/entities/content/content.d.ts.map +1 -0
- package/dist/cjs/entities/content/reference.d.ts +101 -0
- package/dist/cjs/entities/content/reference.d.ts.map +1 -0
- package/dist/cjs/entities/experience/experience.d.ts +224 -0
- package/dist/cjs/entities/experience/experience.d.ts.map +1 -0
- package/dist/cjs/entities/experience-instance/action-result.d.ts +69 -0
- package/dist/cjs/entities/experience-instance/action-result.d.ts.map +1 -0
- package/dist/cjs/entities/experience-instance/experience-instance.d.ts +112 -0
- package/dist/cjs/entities/experience-instance/experience-instance.d.ts.map +1 -0
- package/dist/cjs/entities/feature/feature.d.ts +158 -0
- package/dist/cjs/entities/feature/feature.d.ts.map +1 -0
- package/dist/cjs/entities/field/field.d.ts +129 -0
- package/dist/cjs/entities/field/field.d.ts.map +1 -0
- package/dist/cjs/entities/field/policies.d.ts +35 -0
- package/dist/cjs/entities/field/policies.d.ts.map +1 -0
- package/dist/cjs/entities/framework/framework.d.ts +45 -0
- package/dist/cjs/entities/framework/framework.d.ts.map +1 -0
- package/dist/cjs/entities/history/history.d.ts +25 -0
- package/dist/cjs/entities/history/history.d.ts.map +1 -0
- package/dist/cjs/entities/plugin/plugin.d.ts +50 -0
- package/dist/cjs/entities/plugin/plugin.d.ts.map +1 -0
- package/dist/cjs/entities/predicate/predicate.d.ts +48 -0
- package/dist/cjs/entities/predicate/predicate.d.ts.map +1 -0
- package/dist/cjs/entities/response/response-validation.d.ts +75 -0
- package/dist/cjs/entities/response/response-validation.d.ts.map +1 -0
- package/dist/cjs/entities/response/response.d.ts +69 -0
- package/dist/cjs/entities/response/response.d.ts.map +1 -0
- package/dist/cjs/entities/session/session.d.ts +55 -0
- package/dist/cjs/entities/session/session.d.ts.map +1 -0
- package/dist/cjs/entities/step/step.d.ts +56 -0
- package/dist/cjs/entities/step/step.d.ts.map +1 -0
- package/dist/cjs/entities/workspace/workspace.d.ts +37 -0
- package/dist/cjs/entities/workspace/workspace.d.ts.map +1 -0
- package/dist/cjs/exports.d.ts +33 -0
- package/dist/cjs/exports.d.ts.map +1 -0
- package/dist/cjs/form/build-responses.d.ts +18 -0
- package/dist/cjs/form/build-responses.d.ts.map +1 -0
- package/dist/cjs/form/create-field-evaluator.d.ts +28 -0
- package/dist/cjs/form/create-field-evaluator.d.ts.map +1 -0
- package/dist/cjs/form/create-field-validation.d.ts +60 -0
- package/dist/cjs/form/create-field-validation.d.ts.map +1 -0
- package/dist/cjs/form/create-form.d.ts +153 -0
- package/dist/cjs/form/create-form.d.ts.map +1 -0
- package/dist/cjs/form/create-submit-pipeline.d.ts +116 -0
- package/dist/cjs/form/create-submit-pipeline.d.ts.map +1 -0
- package/dist/cjs/form/get-step-fields.d.ts +19 -0
- package/dist/cjs/form/get-step-fields.d.ts.map +1 -0
- package/dist/cjs/form/index.d.ts +11 -0
- package/dist/cjs/form/index.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +27 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/lifecycle/condition-selection.d.ts +146 -0
- package/dist/cjs/lifecycle/condition-selection.d.ts.map +1 -0
- package/dist/cjs/lifecycle/lifecycle.d.ts +48 -0
- package/dist/cjs/lifecycle/lifecycle.d.ts.map +1 -0
- package/dist/cjs/lifecycle/rules-logic.d.ts +25 -0
- package/dist/cjs/lifecycle/rules-logic.d.ts.map +1 -0
- package/dist/cjs/lifecycle/state-snapshot.d.ts +38 -0
- package/dist/cjs/lifecycle/state-snapshot.d.ts.map +1 -0
- package/dist/cjs/logic-engine.d.ts +38 -0
- package/dist/cjs/logic-engine.d.ts.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/picked.d.ts +468 -0
- package/dist/cjs/picked.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/create-experience.d.ts +221 -0
- package/dist/cjs/plugins/create-experience/create-experience.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/index.d.ts +6 -0
- package/dist/cjs/plugins/create-experience/index.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/plugin.d.ts +9 -0
- package/dist/cjs/plugins/create-experience/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/create-experience/serialization.d.ts +6 -0
- package/dist/cjs/plugins/create-experience/serialization.d.ts.map +1 -0
- package/dist/cjs/plugins/dom-observer/index.d.ts +3 -0
- package/dist/cjs/plugins/dom-observer/index.d.ts.map +1 -0
- package/dist/cjs/plugins/dom-observer/plugin.d.ts +50 -0
- package/dist/cjs/plugins/dom-observer/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/hash.d.ts +105 -0
- package/dist/cjs/plugins/dynamic-experiences/hash.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.d.ts +8 -0
- package/dist/cjs/plugins/dynamic-experiences/index.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/plugin.d.ts +53 -0
- package/dist/cjs/plugins/dynamic-experiences/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/dynamic-experiences/types.d.ts +48 -0
- package/dist/cjs/plugins/dynamic-experiences/types.d.ts.map +1 -0
- package/dist/cjs/plugins/experience-browser-storage/index.d.ts +2 -0
- package/dist/cjs/plugins/experience-browser-storage/index.d.ts.map +1 -0
- package/dist/cjs/plugins/experience-browser-storage/plugin.d.ts +7 -0
- package/dist/cjs/plugins/experience-browser-storage/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/history-browser-storage/index.d.ts +2 -0
- package/dist/cjs/plugins/history-browser-storage/index.d.ts.map +1 -0
- package/dist/cjs/plugins/history-browser-storage/plugin.d.ts +7 -0
- package/dist/cjs/plugins/history-browser-storage/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-browser-storage/index.d.ts +2 -0
- package/dist/cjs/plugins/responses-browser-storage/index.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-browser-storage/plugin.d.ts +18 -0
- package/dist/cjs/plugins/responses-browser-storage/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-indexeddb/index.d.ts +2 -0
- package/dist/cjs/plugins/responses-indexeddb/index.d.ts.map +1 -0
- package/dist/cjs/plugins/responses-indexeddb/plugin.d.ts +3 -0
- package/dist/cjs/plugins/responses-indexeddb/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/single-page-app/index.d.ts +3 -0
- package/dist/cjs/plugins/single-page-app/index.d.ts.map +1 -0
- package/dist/cjs/plugins/single-page-app/plugin.d.ts +32 -0
- package/dist/cjs/plugins/single-page-app/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/emit.d.ts +18 -0
- package/dist/cjs/plugins/telemetry/emit.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/index.d.ts +4 -0
- package/dist/cjs/plugins/telemetry/index.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/plugin-summary.d.ts +10 -0
- package/dist/cjs/plugins/telemetry/plugin-summary.d.ts.map +1 -0
- package/dist/cjs/plugins/telemetry/plugin.d.ts +47 -0
- package/dist/cjs/plugins/telemetry/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/web-components/index.d.ts +2 -0
- package/dist/cjs/plugins/web-components/index.d.ts.map +1 -0
- package/dist/cjs/plugins/web-components/plugin.d.ts +4 -0
- package/dist/cjs/plugins/web-components/plugin.d.ts.map +1 -0
- package/dist/cjs/plugins/window-object/index.d.ts +2 -0
- package/dist/cjs/plugins/window-object/index.d.ts.map +1 -0
- package/dist/cjs/plugins/window-object/plugin.d.ts +9 -0
- package/dist/cjs/plugins/window-object/plugin.d.ts.map +1 -0
- package/dist/cjs/preview/index.d.ts +18 -0
- package/dist/cjs/preview/index.d.ts.map +1 -0
- package/dist/cjs/preview-bridge/index.d.ts +14 -0
- package/dist/cjs/preview-bridge/index.d.ts.map +1 -0
- package/dist/cjs/preview-channel.d.ts +16 -0
- package/dist/cjs/preview-channel.d.ts.map +1 -0
- package/dist/cjs/preview-receiver/apply-ops.d.ts +32 -0
- package/dist/cjs/preview-receiver/apply-ops.d.ts.map +1 -0
- package/dist/cjs/preview-receiver/index.d.ts +32 -0
- package/dist/cjs/preview-receiver/index.d.ts.map +1 -0
- package/dist/cjs/preview-receiver/protocol.d.ts +69 -0
- package/dist/cjs/preview-receiver/protocol.d.ts.map +1 -0
- package/dist/cjs/schema-registry.d.ts +240 -0
- package/dist/cjs/schema-registry.d.ts.map +1 -0
- package/dist/cjs/server/hydrate.d.ts +21 -0
- package/dist/cjs/server/hydrate.d.ts.map +1 -0
- package/dist/cjs/server/index.d.ts +28 -0
- package/dist/cjs/server/index.d.ts.map +1 -0
- package/dist/cjs/server/index.js +1 -1
- package/dist/cjs/server/serialize.d.ts +89 -0
- package/dist/cjs/server/serialize.d.ts.map +1 -0
- package/dist/cjs/storage.d.ts +6 -0
- package/dist/cjs/storage.d.ts.map +1 -0
- package/dist/cjs/typed-content.d.ts +30 -0
- package/dist/cjs/typed-content.d.ts.map +1 -0
- package/dist/cjs/utils/api-url.d.ts +2 -0
- package/dist/cjs/utils/api-url.d.ts.map +1 -0
- package/dist/cjs/utils/client-telemetry.d.ts +25 -0
- package/dist/cjs/utils/client-telemetry.d.ts.map +1 -0
- package/dist/cjs/utils/content-path.d.ts +37 -0
- package/dist/cjs/utils/content-path.d.ts.map +1 -0
- package/dist/cjs/utils/dom.d.ts +20 -0
- package/dist/cjs/utils/dom.d.ts.map +1 -0
- package/dist/cjs/utils/events.d.ts +129 -0
- package/dist/cjs/utils/events.d.ts.map +1 -0
- package/dist/cjs/utils/global-obj.d.ts +10 -0
- package/dist/cjs/utils/global-obj.d.ts.map +1 -0
- package/dist/cjs/utils/html-asset-value.d.ts +20 -0
- package/dist/cjs/utils/html-asset-value.d.ts.map +1 -0
- package/dist/cjs/utils/id.d.ts +11 -0
- package/dist/cjs/utils/id.d.ts.map +1 -0
- package/dist/cjs/utils/indexed-db.d.ts +12 -0
- package/dist/cjs/utils/indexed-db.d.ts.map +1 -0
- package/dist/cjs/utils/inert-script-report.d.ts +40 -0
- package/dist/cjs/utils/inert-script-report.d.ts.map +1 -0
- package/dist/cjs/utils/logger.d.ts +3 -0
- package/dist/cjs/utils/logger.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-action.d.ts +25 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-action.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-condition.d.ts +17 -0
- package/dist/cjs/utils/node-tree/get-next-node-from-condition.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-next-node.d.ts +3 -0
- package/dist/cjs/utils/node-tree/get-next-node.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/get-origin-node.d.ts +3 -0
- package/dist/cjs/utils/node-tree/get-origin-node.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-leaf.d.ts +21 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-origin.d.ts +23 -0
- package/dist/cjs/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/next-reachable-step-nodes.d.ts +37 -0
- package/dist/cjs/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/node-adjacency.d.ts +50 -0
- package/dist/cjs/utils/node-tree/node-adjacency.d.ts.map +1 -0
- package/dist/cjs/utils/node-tree/node-tree-index.d.ts +57 -0
- package/dist/cjs/utils/node-tree/node-tree-index.d.ts.map +1 -0
- package/dist/cjs/utils/nodes.d.ts +7 -0
- package/dist/cjs/utils/nodes.d.ts.map +1 -0
- package/dist/cjs/utils/object.d.ts +49 -0
- package/dist/cjs/utils/object.d.ts.map +1 -0
- package/dist/cjs/utils/picked-config.d.ts +39 -0
- package/dist/cjs/utils/picked-config.d.ts.map +1 -0
- package/dist/cjs/utils/preview-session.d.ts +12 -0
- package/dist/cjs/utils/preview-session.d.ts.map +1 -0
- package/dist/cjs/utils/rehydrate-scripts.d.ts +50 -0
- package/dist/cjs/utils/rehydrate-scripts.d.ts.map +1 -0
- package/dist/cjs/utils/render-string.d.ts +24 -0
- package/dist/cjs/utils/render-string.d.ts.map +1 -0
- package/dist/cjs/utils/rules-logic.d.ts +36 -0
- package/dist/cjs/utils/rules-logic.d.ts.map +1 -0
- package/dist/cjs/utils/search-params.d.ts +26 -0
- package/dist/cjs/utils/search-params.d.ts.map +1 -0
- package/dist/cjs/utils/storage.d.ts +385 -0
- package/dist/cjs/utils/storage.d.ts.map +1 -0
- package/dist/cjs/utils/supports.d.ts +97 -0
- package/dist/cjs/utils/supports.d.ts.map +1 -0
- package/dist/cjs/utils/user-timing.d.ts +21 -0
- package/dist/cjs/utils/user-timing.d.ts.map +1 -0
- package/dist/cjs/utils/version.d.ts +2 -0
- package/dist/cjs/utils/version.d.ts.map +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +2 -2
- package/dist/{plugin-CBPJLN1i.js → plugin-BIOJJYWs.js} +2 -2
- package/dist/{plugin-Dz0AK06x.cjs → plugin-DGQi344H.cjs} +1 -1
- package/dist/{preview-unavailable-BY8kYUmt.cjs → preview-unavailable-BFCu2sLm.cjs} +1 -1
- package/dist/{preview-unavailable-CO9Uzrse.js → preview-unavailable-BIRQkLBt.js} +1 -1
- package/dist/{provider-CoBbEsiR.js → provider-BZoq9mSl.js} +1 -1
- package/dist/{provider-Cy7W3XR9.cjs → provider-DXVEp_ja.cjs} +1 -1
- package/dist/types/client.d.ts +7 -7
- package/dist/types/data-source/provider.d.ts +3 -3
- package/dist/types/data-source/registry.d.ts +1 -1
- package/dist/types/data-source/virtual-data.d.ts +1 -1
- package/dist/types/entities/action/action.d.ts +3 -3
- package/dist/types/entities/component/component.d.ts +4 -4
- package/dist/types/entities/condition/condition.d.ts +1 -1
- package/dist/types/entities/content/reference.d.ts +1 -1
- package/dist/types/entities/experience/experience.d.ts +7 -7
- package/dist/types/entities/experience-instance/action-result.d.ts +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +6 -6
- package/dist/types/entities/feature/feature.d.ts +2 -2
- package/dist/types/entities/field/field.d.ts +2 -2
- package/dist/types/entities/framework/framework.d.ts +3 -3
- package/dist/types/entities/history/history.d.ts +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +2 -2
- package/dist/types/entities/response/response-validation.d.ts +2 -2
- package/dist/types/entities/response/response.d.ts +5 -5
- package/dist/types/entities/step/step.d.ts +1 -1
- package/dist/types/exports.d.ts +19 -19
- package/dist/types/form/build-responses.d.ts +1 -1
- package/dist/types/form/create-field-evaluator.d.ts +2 -2
- package/dist/types/form/create-field-validation.d.ts +3 -3
- package/dist/types/form/create-form.d.ts +5 -5
- package/dist/types/form/create-submit-pipeline.d.ts +6 -6
- package/dist/types/form/get-step-fields.d.ts +3 -3
- package/dist/types/form/index.d.ts +9 -9
- package/dist/types/index.d.ts +25 -25
- package/dist/types/lifecycle/condition-selection.d.ts +3 -3
- package/dist/types/lifecycle/lifecycle.d.ts +2 -2
- package/dist/types/lifecycle/rules-logic.d.ts +2 -2
- package/dist/types/lifecycle/state-snapshot.d.ts +2 -2
- package/dist/types/picked.d.ts +74 -74
- package/dist/types/plugins/create-experience/create-experience.d.ts +8 -8
- package/dist/types/plugins/create-experience/index.d.ts +4 -4
- package/dist/types/plugins/create-experience/plugin.d.ts +2 -2
- package/dist/types/plugins/dom-observer/index.d.ts +1 -1
- package/dist/types/plugins/dom-observer/plugin.d.ts +1 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +3 -3
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +3 -3
- package/dist/types/plugins/experience-browser-storage/index.d.ts +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/history-browser-storage/index.d.ts +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/responses-browser-storage/index.d.ts +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/responses-indexeddb/index.d.ts +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/index.d.ts +2 -2
- package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
- package/dist/types/plugins/telemetry/index.d.ts +2 -2
- package/dist/types/plugins/telemetry/plugin.d.ts +1 -1
- package/dist/types/plugins/web-components/index.d.ts +1 -1
- package/dist/types/plugins/web-components/plugin.d.ts +1 -1
- package/dist/types/plugins/window-object/index.d.ts +1 -1
- package/dist/types/plugins/window-object/plugin.d.ts +2 -2
- package/dist/types/preview/index.d.ts +6 -6
- package/dist/types/preview-channel.d.ts +1 -1
- package/dist/types/preview-receiver/index.d.ts +1 -1
- package/dist/types/preview-receiver/protocol.d.ts +1 -1
- package/dist/types/schema-registry.d.ts +2 -2
- package/dist/types/server/hydrate.d.ts +2 -2
- package/dist/types/server/index.d.ts +9 -9
- package/dist/types/server/serialize.d.ts +1 -1
- package/dist/types/storage.d.ts +1 -1
- package/dist/types/typed-content.d.ts +2 -2
- package/dist/types/utils/client-telemetry.d.ts +1 -1
- package/dist/types/utils/dom.d.ts +1 -1
- package/dist/types/utils/events.d.ts +5 -5
- package/dist/types/utils/global-obj.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
- package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +2 -2
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +2 -2
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +2 -2
- package/dist/types/utils/node-tree/node-adjacency.d.ts +1 -1
- package/dist/types/utils/node-tree/node-tree-index.d.ts +2 -2
- package/dist/types/utils/nodes.d.ts +1 -1
- package/dist/types/utils/picked-config.d.ts +1 -1
- package/dist/types/utils/rules-logic.d.ts +2 -2
- package/dist/types/utils/storage.d.ts +1 -1
- package/package.json +141 -56
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/** @file Schema registry types augmented by generated `picked-env.d.ts`. */
|
|
2
|
+
import type { Content } from './entities/content/content.js';
|
|
3
|
+
import type { FieldValue as ResponseFieldValue } from './entities/field/field.js';
|
|
4
|
+
/**
|
|
5
|
+
* Augmented by generated `picked-env.d.ts`. Empty by default.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // After codegen:
|
|
9
|
+
* // interface PickedSchemaRegistry {
|
|
10
|
+
* // contentModels: { 'welcome-page': WelcomePageContent }
|
|
11
|
+
* // }
|
|
12
|
+
*/
|
|
13
|
+
export interface PickedSchemaRegistry {
|
|
14
|
+
}
|
|
15
|
+
type ContentModelsMap = PickedSchemaRegistry extends {
|
|
16
|
+
contentModels: infer M extends Record<string, unknown>;
|
|
17
|
+
} ? M : Record<string, Record<string, unknown>>;
|
|
18
|
+
type StepContentModelsMap = PickedSchemaRegistry extends {
|
|
19
|
+
stepContentModels: infer S extends Record<string, string>;
|
|
20
|
+
} ? S : Record<string, string>;
|
|
21
|
+
type StepFieldKeysMap = PickedSchemaRegistry extends {
|
|
22
|
+
stepFieldKeys: infer S extends Record<string, string>;
|
|
23
|
+
} ? S : Record<string, string>;
|
|
24
|
+
type FieldValuesMap = PickedSchemaRegistry extends {
|
|
25
|
+
fieldValues: infer F extends Record<string, unknown>;
|
|
26
|
+
} ? F : never;
|
|
27
|
+
type FeatureValuesMap = PickedSchemaRegistry extends {
|
|
28
|
+
featureValues: infer F extends Record<string, boolean | string>;
|
|
29
|
+
} ? F : never;
|
|
30
|
+
/**
|
|
31
|
+
* Widens a key union so it still accepts a key the workspace does not declare.
|
|
32
|
+
*
|
|
33
|
+
* Features, actions, fields, steps and experiences can all be defined in the application
|
|
34
|
+
* rather than the workspace — `createClient({ features })` and `client.registerField()`
|
|
35
|
+
* among them — and those keys are absent from the generated schema. Intersecting with an
|
|
36
|
+
* object type keeps TypeScript from collapsing `K | string` down to `string`, so an editor
|
|
37
|
+
* still suggests the workspace's keys while any other string is accepted.
|
|
38
|
+
*
|
|
39
|
+
* The `Known*` union beside each key type stays closed, for a caller that wants only what
|
|
40
|
+
* the workspace declares.
|
|
41
|
+
*/
|
|
42
|
+
type AnyString = string & Record<never, never>;
|
|
43
|
+
/**
|
|
44
|
+
* Feature keys the workspace declares. Closed: a locally-defined feature is not in it.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* type Keys = KnownFeatureKeys
|
|
48
|
+
*/
|
|
49
|
+
export type KnownFeatureKeys = PickedSchemaRegistry extends {
|
|
50
|
+
featureKeys: infer K extends string;
|
|
51
|
+
} ? K : string;
|
|
52
|
+
/**
|
|
53
|
+
* Value a feature key can resolve to.
|
|
54
|
+
*
|
|
55
|
+
* A text feature declares its arms in the schema, so its key narrows to that union. Every
|
|
56
|
+
* other key — a boolean feature, a feature registered in application code, a
|
|
57
|
+
* `?picked-feature=` override — reads as the general `boolean | string`, which is the
|
|
58
|
+
* documented contract for a key the workspace does not declare.
|
|
59
|
+
*
|
|
60
|
+
* @param {PropertyKey} K - Feature key from the workspace schema.
|
|
61
|
+
* @example
|
|
62
|
+
* type Hero = FeatureValueFor<'hero'>
|
|
63
|
+
*/
|
|
64
|
+
export type FeatureValueFor<K extends PropertyKey> = FeatureValuesMap extends never ? boolean | string : K extends keyof FeatureValuesMap ? FeatureValuesMap[K] : boolean | string;
|
|
65
|
+
/**
|
|
66
|
+
* Feature keys — the workspace union when augmented, plus any locally-defined key.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* type Keys = FeatureKeys
|
|
70
|
+
*/
|
|
71
|
+
export type FeatureKeys = PickedSchemaRegistry extends {
|
|
72
|
+
featureKeys: infer K extends string;
|
|
73
|
+
} ? K | AnyString : string;
|
|
74
|
+
/**
|
|
75
|
+
* Step keys the workspace declares. Closed: a locally-registered step is not in it.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* type Keys = KnownStepKeys
|
|
79
|
+
*/
|
|
80
|
+
export type KnownStepKeys = PickedSchemaRegistry extends {
|
|
81
|
+
stepKeys: infer K extends string;
|
|
82
|
+
} ? K : string;
|
|
83
|
+
/**
|
|
84
|
+
* Step keys — the workspace union when augmented, plus any locally-registered key.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* type Keys = StepKeys
|
|
88
|
+
*/
|
|
89
|
+
export type StepKeys = PickedSchemaRegistry extends {
|
|
90
|
+
stepKeys: infer K extends string;
|
|
91
|
+
} ? K | AnyString : string;
|
|
92
|
+
/**
|
|
93
|
+
* Action keys the workspace declares. Closed: an action the app registers on its own is
|
|
94
|
+
* not in it.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* type Keys = KnownActionKeys
|
|
98
|
+
*/
|
|
99
|
+
export type KnownActionKeys = PickedSchemaRegistry extends {
|
|
100
|
+
actionKeys: infer K extends string;
|
|
101
|
+
} ? K : string;
|
|
102
|
+
/**
|
|
103
|
+
* Keys of the actions a workflow is triggered by, which call the Picked API and answer with
|
|
104
|
+
* the workflow's response. Closed, and `never` when the registry is not augmented.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* type Keys = WorkflowActionKeys
|
|
108
|
+
*/
|
|
109
|
+
export type WorkflowActionKeys = PickedSchemaRegistry extends {
|
|
110
|
+
workflowActionKeys: infer K extends string;
|
|
111
|
+
} ? K : never;
|
|
112
|
+
/**
|
|
113
|
+
* Action keys — the workspace union when augmented, plus any key the app registers.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* type Keys = ActionKeys
|
|
117
|
+
*/
|
|
118
|
+
export type ActionKeys = PickedSchemaRegistry extends {
|
|
119
|
+
actionKeys: infer K extends string;
|
|
120
|
+
} ? K | AnyString : string;
|
|
121
|
+
/**
|
|
122
|
+
* Experience keys the workspace declares. Closed: a locally-registered experience is not
|
|
123
|
+
* in it.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* type Keys = KnownExperienceKeys
|
|
127
|
+
*/
|
|
128
|
+
export type KnownExperienceKeys = PickedSchemaRegistry extends {
|
|
129
|
+
experienceKeys: infer K extends string;
|
|
130
|
+
} ? K : string;
|
|
131
|
+
/**
|
|
132
|
+
* Experience keys — the workspace union when augmented, plus any locally-registered key.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* type Keys = ExperienceKeys
|
|
136
|
+
*/
|
|
137
|
+
export type ExperienceKeys = PickedSchemaRegistry extends {
|
|
138
|
+
experienceKeys: infer K extends string;
|
|
139
|
+
} ? K | AnyString : string;
|
|
140
|
+
/**
|
|
141
|
+
* Field keys the workspace declares. Closed: a locally-registered field is not in it.
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* type Keys = KnownFieldKeys
|
|
145
|
+
*/
|
|
146
|
+
export type KnownFieldKeys = FieldValuesMap extends never ? string : keyof FieldValuesMap & string;
|
|
147
|
+
/**
|
|
148
|
+
* Field keys — the workspace union when augmented, plus any locally-registered key.
|
|
149
|
+
*
|
|
150
|
+
* A key outside the workspace reads as the general {@link FieldValueFor} value type, which
|
|
151
|
+
* is how every value resolver here already treats one.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* type Keys = FieldKeys
|
|
155
|
+
*/
|
|
156
|
+
export type FieldKeys = FieldValuesMap extends never ? string : KnownFieldKeys | AnyString;
|
|
157
|
+
/**
|
|
158
|
+
* Union of every content model bound to a step layout.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* type Union = StepLayoutContent
|
|
162
|
+
*/
|
|
163
|
+
export type StepLayoutContent = ContentModelsMap[StepContentModelsMap[keyof StepContentModelsMap] & keyof ContentModelsMap];
|
|
164
|
+
/**
|
|
165
|
+
* Content type for a specific step key, via the step -> model map.
|
|
166
|
+
*
|
|
167
|
+
* @param {PropertyKey} K - Step key from the workspace schema.
|
|
168
|
+
* @example
|
|
169
|
+
* type Main = ContentForStep<'main'>
|
|
170
|
+
*/
|
|
171
|
+
export type ContentForStep<K extends PropertyKey> = K extends keyof StepContentModelsMap ? ContentModelsMap[StepContentModelsMap[K] & keyof ContentModelsMap] : StepLayoutContent;
|
|
172
|
+
/**
|
|
173
|
+
* Field keys bound to a specific step key, via the step → field-keys map.
|
|
174
|
+
* Falls back to all workspace {@link FieldKeys} when the registry has no
|
|
175
|
+
* `stepFieldKeys` entry for `K` (old snapshots / unaugmented clients).
|
|
176
|
+
*
|
|
177
|
+
* @param {PropertyKey} K - Step key from the workspace schema.
|
|
178
|
+
* @example
|
|
179
|
+
* type MainFields = FieldKeysForStep<'main'>
|
|
180
|
+
*/
|
|
181
|
+
export type FieldKeysForStep<K extends PropertyKey> = K extends keyof StepFieldKeysMap ? StepFieldKeysMap[K] & KnownFieldKeys : FieldKeys;
|
|
182
|
+
/**
|
|
183
|
+
* Value type for a field key (always optional at read time).
|
|
184
|
+
*
|
|
185
|
+
* @param {PropertyKey} K - Field key from the workspace schema.
|
|
186
|
+
* @example
|
|
187
|
+
* type Email = FieldValueFor<'email'>
|
|
188
|
+
*/
|
|
189
|
+
export type FieldValueFor<K extends PropertyKey> = FieldValuesMap extends never ? ResponseFieldValue : K extends keyof FieldValuesMap ? FieldValuesMap[K] | null : ResponseFieldValue;
|
|
190
|
+
/**
|
|
191
|
+
* Content model keys the workspace declares, or `string` when the registry is not augmented.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* type Keys = ContentModelKeys
|
|
195
|
+
*/
|
|
196
|
+
export type ContentModelKeys = keyof ContentModelsMap & string;
|
|
197
|
+
/**
|
|
198
|
+
* The generated `data` type of content model `K`, or a loose record for a model the registry
|
|
199
|
+
* does not declare.
|
|
200
|
+
*/
|
|
201
|
+
type ContentDataOf<K extends string> = K extends keyof ContentModelsMap ? Extract<ContentModelsMap[K], Record<string, unknown>> : Record<string, unknown>;
|
|
202
|
+
/**
|
|
203
|
+
* A Content record of content model `K`: its `contentModelKey` is `K` and its `data` is that
|
|
204
|
+
* model's generated type.
|
|
205
|
+
*
|
|
206
|
+
* @param {string} K - Content model key from the workspace schema.
|
|
207
|
+
* @example
|
|
208
|
+
* type Landing = ContentRecordOf<'landing-page'>
|
|
209
|
+
*/
|
|
210
|
+
export type ContentRecordOf<K extends string> = Omit<Content, 'contentModelKey' | 'data'> & {
|
|
211
|
+
contentModelKey: K;
|
|
212
|
+
data: ContentDataOf<K>;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* A `Content` record whose `data` is narrowed to `TData`.
|
|
216
|
+
*
|
|
217
|
+
* @param {unknown} TData - Explicit content model shape.
|
|
218
|
+
* @example
|
|
219
|
+
* type Typed = TypedContent<WelcomePageContent>
|
|
220
|
+
*/
|
|
221
|
+
export type TypedContent<TData> = Omit<Content, 'data'> & {
|
|
222
|
+
data: TData;
|
|
223
|
+
};
|
|
224
|
+
/**
|
|
225
|
+
* The Content record a `reference` field value points at.
|
|
226
|
+
*
|
|
227
|
+
* A generated pointer carries the target's shape on its optional `data` member, so the
|
|
228
|
+
* referenced record narrows to that shape. A value the generator knows nothing about —
|
|
229
|
+
* an unaugmented client, or a field that accepts any Content Model — falls back to the
|
|
230
|
+
* untyped {@link Content}. A repeatable field resolves through its element type.
|
|
231
|
+
*
|
|
232
|
+
* @param {unknown} TValue - The raw `reference` field value read from a content blob.
|
|
233
|
+
* @example
|
|
234
|
+
* type Author = ReferencedContent<WelcomePageContent['author']>
|
|
235
|
+
*/
|
|
236
|
+
export type ReferencedContent<TValue> = NonNullable<TValue> extends readonly (infer TElement)[] ? ReferencedContent<TElement> : NonNullable<TValue> extends {
|
|
237
|
+
data?: infer TData;
|
|
238
|
+
} ? [NonNullable<TData>] extends [never] ? Content : TypedContent<NonNullable<TData>> : Content;
|
|
239
|
+
export type { StepContentModelsMap };
|
|
240
|
+
//# sourceMappingURL=schema-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-registry.d.ts","sourceRoot":"","sources":["../../src/schema-registry.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @file `hydrateFromSnapshot`: applies a server snapshot to a client, synchronously. */
|
|
2
|
+
import type { Picked } from '../picked.js';
|
|
3
|
+
import type { PickedSnapshot } from './serialize.js';
|
|
4
|
+
/**
|
|
5
|
+
* Applies a server snapshot to a client: registers its project config, registers each content
|
|
6
|
+
* blob and seeds the condition results, all synchronously, so a render that follows shows what
|
|
7
|
+
* the server rendered.
|
|
8
|
+
*
|
|
9
|
+
* The client records the snapshot's `versionId` as `client.seededVersionId`. A later snapshot of
|
|
10
|
+
* that same version registers its content and seeds its condition results only: the config is
|
|
11
|
+
* already registered, so the registered experiences and their live instances stay, and the
|
|
12
|
+
* experience the new results select becomes the active one. A snapshot of another version, or of
|
|
13
|
+
* an unknown (`null`) version, registers its config again.
|
|
14
|
+
*
|
|
15
|
+
* @param {Picked} client - The client to apply the snapshot to.
|
|
16
|
+
* @param {PickedSnapshot} snapshot - A snapshot from `serialize`.
|
|
17
|
+
* @example
|
|
18
|
+
* hydrateFromSnapshot(client, snapshot)
|
|
19
|
+
*/
|
|
20
|
+
export declare function hydrateFromSnapshot(client: Picked, snapshot: PickedSnapshot): void;
|
|
21
|
+
//# sourceMappingURL=hydrate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate.d.ts","sourceRoot":"","sources":["../../../src/server/hydrate.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI,CAalF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Picked } from '../picked.js';
|
|
2
|
+
import type { ExperienceInstance } from '../entities/experience-instance/experience-instance.js';
|
|
3
|
+
import type { AdaptedComponent } from '../entities/component/component.js';
|
|
4
|
+
export { serialize, type PickedSnapshot, type SerializeParams, type SerializeAttributes, type SerializeLocation, } from './serialize.js';
|
|
5
|
+
export { hydrateFromSnapshot } from './hydrate.js';
|
|
6
|
+
export { createExperienceInstance } from '../entities/experience-instance/experience-instance.js';
|
|
7
|
+
export type { ExperienceInstance } from '../entities/experience-instance/experience-instance.js';
|
|
8
|
+
export { registerProjectConfig } from '../plugins/dynamic-experiences/plugin.js';
|
|
9
|
+
export { hashRule, evaluateConditionMemo, isExperienceActive, ruleReferencesAction, ruleReferencesActionDeep, } from '../lifecycle/condition-selection.js';
|
|
10
|
+
export type { ContentBlob, ExperienceContentResponse, ProjectConfig, ProjectConfigExperience, } from '@picked/delivery-api-client';
|
|
11
|
+
export interface Renderer<T = AdaptedComponent<string, unknown>> {
|
|
12
|
+
isValidComponent: (component: AdaptedComponent<string, unknown>) => boolean;
|
|
13
|
+
render: (component: T, client: Picked, experience: ExperienceInstance) => Promise<{
|
|
14
|
+
head: string;
|
|
15
|
+
body: string;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Renders all experiences in sequence using the provided renderers.
|
|
20
|
+
*
|
|
21
|
+
* @param {Picked} client - The Picked client instance.
|
|
22
|
+
* @param {Renderer[]} renderers - Array of available renderers to use.
|
|
23
|
+
* @returns {Promise<string[]>} A promise resolving to rendered experience HTML strings.
|
|
24
|
+
* @example
|
|
25
|
+
* const html = await render(client, [svelteRenderer])
|
|
26
|
+
*/
|
|
27
|
+
export declare function render(client: Picked, renderers: Renderer[]): Promise<string[]>;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAE7F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAEvE,OAAO,EACL,SAAS,EACT,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,YAAY,EAAE,kBAAkB,EAAE,MAAM,qDAAqD,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAA;AAC7E,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,kCAAkC,CAAA;AACzC,YAAY,EACV,WAAW,EACX,yBAAyB,EACzB,aAAa,EACb,uBAAuB,GACxB,MAAM,6BAA6B,CAAA;AA0BpC,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,gBAAgB,EAAE,CAAC,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAA;IAC3E,MAAM,EAAE,CACN,SAAS,EAAE,CAAC,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,kBAAkB,KAC3B,OAAO,CAAC;QACX,IAAI,EAAE,MAAM,CAAA;QACZ,IAAI,EAAE,MAAM,CAAA;KACb,CAAC,CAAA;CACH;AAmBD;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoJ/E"}
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../experience-instance-CQhrMm1w.cjs"),t=require("../../preview-unavailable-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../experience-instance-CQhrMm1w.cjs"),t=require("../../preview-unavailable-BFCu2sLm.cjs"),n=require("../../plugin-DGQi344H.cjs");let r=require("effector");var i=1e4;function a(e){if(e?.location!==void 0)return{location:e.location}}function o(t,n){return t.nodes.filter(e.d).some(e=>n.get(e.stepId)===!0)}async function s(r,s={}){let c=s.previewToken===void 0?void 0:{previewToken:s.previewToken},l=await r.getProjectConfig(c).catch(e=>{if(!(e instanceof t.t))throw e;return c=void 0,r.getProjectConfig()}),u=r.session.store.getState().pickedId;r.conditionResults.reset(),n.n(r,l,{isPreview:!1,pickedId:u});let d=a(s.attributes),f=s.timeoutMs??i,p=new Map(l.steps.map(e=>[e.id,e.layoutContentId!==void 0&&e.layoutContentId!==null])),m=Object.fromEntries(l.conditions.map(e=>[e.key,e])),h=l.experiences.filter(t=>!e.c(t.condition,m)),g=(await Promise.all(h.map(async t=>({experience:t,active:await e.o(r,{condition:t.condition},{context:d})})))).filter(e=>e.active).map(e=>e.experience),_=await Promise.all(g.filter(e=>o(e,p)).map(e=>r.getExperienceContent({id:e.id,key:e.key},{...c,signal:AbortSignal.timeout(f)}))),v=new Map;for(let e of _)if(e)for(let t of[...e.references??[],...e.content])v.set(t.id,t);return{versionId:l.versionId,projectConfig:l,content:Array.from(v.values()),conditionResults:r.conditionResults.store.getState()}}function c(e,t){(t.versionId===null||e.seededVersionId!==t.versionId)&&(e.seededVersionId=t.versionId,n.n(e,t.projectConfig,{isPreview:!1,pickedId:e.session.store.getState().pickedId})),t.content.forEach(t=>e.registerContent(t)),e.conditionResults.seed(t.conditionResults)}function l(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:t=>e(t),reject:e=>t(e)}}function u(t,n){let{promise:i,resolve:a}=l(),o=(0,r.createEvent)(),s=(0,r.createEvent)(),c=(0,r.createEvent)(),u=(0,r.createEvent)(),d=(0,r.createEvent)(),f=t.experiences.listStore.map(n=>n.map(n=>e.t({client:t,experience:n}))),p=(0,r.createStore)({currentExperienceIndex:0,renderedExperiences:[],isComplete:!1}),m=(0,r.createEffect)(async e=>{let n=(0,r.attach)({source:e.experience.componentStore,effect:async(n,r)=>{let i=e.availableRenderers[r];return n&&i?.isValidComponent(n.component)?{rendered:await i.render(n.component,t,e.experience),rendererIndex:r}:null}}),i=e.startRendererIndex??0;for(let t=i;t<e.availableRenderers.length;t++){let e=await n(t);if(e)return e}return null}),h=(0,r.createEffect)(async({experience:e,availableRenderers:t,startRendererIndex:n=0})=>e?m({experience:e,availableRenderers:t,startRendererIndex:n}):null);p.on(c,(e,t)=>({...e,renderedExperiences:[...e.renderedExperiences,t],currentExperienceIndex:e.currentExperienceIndex+1})).on(d,e=>({...e,currentExperienceIndex:e.currentExperienceIndex+1})).on(u,e=>({...e,isComplete:!0})).reset(o),(0,r.sample)({clock:o,target:s}),(0,r.sample)({clock:s,source:{experiences:f,state:p},filter:({experiences:e,state:t})=>t.currentExperienceIndex<e.length&&!t.isComplete,fn:({experiences:e,state:t})=>({experience:e[t.currentExperienceIndex],availableRenderers:n,startRendererIndex:0}),target:h}),(0,r.sample)({clock:h.doneData,filter:e=>e!==null,fn:e=>e.rendered.body,target:c}),(0,r.sample)({clock:c,target:s}),(0,r.sample)({clock:h.doneData,filter:e=>e===null,target:d}),(0,r.sample)({clock:d,target:s}),(0,r.sample)({clock:[s,d,c],source:{experiences:f,state:p},filter:({experiences:e,state:t})=>t.currentExperienceIndex>=e.length,target:u});let g=(0,r.attach)({source:p,effect:e=>{e.isComplete&&a(e.renderedExperiences)}});return(0,r.sample)({clock:u,target:g}),o(),i}exports.createExperienceInstance=e.t,exports.evaluateConditionMemo=e.i,exports.hashRule=e.a,exports.hydrateFromSnapshot=c,exports.isExperienceActive=e.o,exports.registerProjectConfig=n.n,exports.render=u,exports.ruleReferencesAction=e.s,exports.ruleReferencesActionDeep=e.c,exports.serialize=s;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Server-side `serialize` helper: synchronously registers a project config, selects the
|
|
3
|
+
* experiences whose conditions pass for a given URL, fetches content for the selected
|
|
4
|
+
* experiences that reference CMS layout content, and returns a plain-JSON snapshot for SSR
|
|
5
|
+
* hydration.
|
|
6
|
+
*
|
|
7
|
+
* The snapshot is plain JSON: `projectConfig` travels so the client renders against the exact
|
|
8
|
+
* config the server selected with (critical for preview), and `conditionResults` carries the
|
|
9
|
+
* memoized selection so the client's first paint reuses the server's results without re-evaluating.
|
|
10
|
+
*/
|
|
11
|
+
import type { ContentBlob, ProjectConfig } from '@picked/delivery-api-client';
|
|
12
|
+
import type { Picked } from '../picked.js';
|
|
13
|
+
/** Subset of `Location` fields that can be injected into the selection context. */
|
|
14
|
+
export interface SerializeLocation {
|
|
15
|
+
href: string;
|
|
16
|
+
pathname: string;
|
|
17
|
+
search: string;
|
|
18
|
+
hostname: string;
|
|
19
|
+
origin: string;
|
|
20
|
+
protocol: string;
|
|
21
|
+
port: string;
|
|
22
|
+
host: string;
|
|
23
|
+
hash: string;
|
|
24
|
+
}
|
|
25
|
+
/** Optional attributes injected into the selection context (currently the URL). */
|
|
26
|
+
export interface SerializeAttributes {
|
|
27
|
+
location?: Partial<SerializeLocation>;
|
|
28
|
+
}
|
|
29
|
+
/** Parameters for {@link serialize}. */
|
|
30
|
+
export interface SerializeParams {
|
|
31
|
+
/** URL attributes injected into the selection context. */
|
|
32
|
+
attributes?: SerializeAttributes;
|
|
33
|
+
/**
|
|
34
|
+
* Preview token for this request, so preview (unpublished) config and content resolve during
|
|
35
|
+
* preview SSR. The server has no `searchParams`, so the token cannot be recovered otherwise.
|
|
36
|
+
* A token whose workspace no longer exists, or belongs to another project, renders the published
|
|
37
|
+
* config and content.
|
|
38
|
+
*/
|
|
39
|
+
previewToken?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Per-content-fetch timeout in milliseconds for the API path, so a slow or hung upstream cannot
|
|
42
|
+
* stall the SSR render indefinitely. On timeout the blob is skipped and the render proceeds.
|
|
43
|
+
* Defaults to {@link DEFAULT_CONTENT_TIMEOUT_MS}.
|
|
44
|
+
*/
|
|
45
|
+
timeoutMs?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Plain-JSON SSR snapshot produced by {@link serialize} and consumed by the client provider.
|
|
49
|
+
*/
|
|
50
|
+
export interface PickedSnapshot {
|
|
51
|
+
/** The project version the snapshot was selected against, or `null` when unknown. */
|
|
52
|
+
versionId: string | null;
|
|
53
|
+
/** The project config the server selected with (travels for preview parity). */
|
|
54
|
+
projectConfig: ProjectConfig;
|
|
55
|
+
/**
|
|
56
|
+
* Deduped content blobs for the selected experiences — the steps' own layout
|
|
57
|
+
* content and every entry reached from it through a `reference` field. The
|
|
58
|
+
* client provider seeds the whole array into the content registry, so both
|
|
59
|
+
* resolve identically on the server render and the first client paint.
|
|
60
|
+
*/
|
|
61
|
+
content: ContentBlob[];
|
|
62
|
+
/** Memoized condition-evaluation results keyed by rule hash. */
|
|
63
|
+
conditionResults: Record<string, boolean>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Selects the experiences whose conditions pass for a URL and returns a plain-JSON snapshot for
|
|
67
|
+
* SSR hydration.
|
|
68
|
+
*
|
|
69
|
+
* Config and content both resolve through the client, which keeps them on one source: a bundled
|
|
70
|
+
* render cannot pair a bundled config with API-fetched content from a newer publish. Content is
|
|
71
|
+
* deduped by blob id, and each API read carries a deadline so a slow upstream cannot stall the
|
|
72
|
+
* render.
|
|
73
|
+
*
|
|
74
|
+
* Registration is synchronous (no `client.start()`), so the client's stores are populated before
|
|
75
|
+
* selection. The condition-results store is reset at entry, and `serialize` expects a per-request
|
|
76
|
+
* client — concurrent calls on one client are not supported. Each experience's own condition is
|
|
77
|
+
* evaluated through the memoized evaluator against the injected URL; client-level
|
|
78
|
+
* precondition/condition are not evaluated here in v1.
|
|
79
|
+
*
|
|
80
|
+
* @param {Picked} client - The Picked client to select with, and to resolve data through.
|
|
81
|
+
* @param {SerializeParams} [params] - URL attributes, preview token, and content timeout.
|
|
82
|
+
* @returns {Promise<PickedSnapshot>} The plain-JSON snapshot of config, content, and condition results.
|
|
83
|
+
* @example
|
|
84
|
+
* const snapshot = await serialize(client, {
|
|
85
|
+
* attributes: { location: { pathname: '/promo' } },
|
|
86
|
+
* })
|
|
87
|
+
*/
|
|
88
|
+
export declare function serialize(client: Picked, params?: SerializeParams): Promise<PickedSnapshot>;
|
|
89
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../../src/server/serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EAEd,MAAM,6BAA6B,CAAA;AAEpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAMvC,mFAAmF;AACnF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;CACtC;AAKD,wCAAwC;AACxC,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qFAAqF;IACrF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,gFAAgF;IAChF,aAAa,EAAE,aAAa,CAAA;IAC5B;;;;;OAKG;IACH,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB,gEAAgE;IAChE,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C;AAoCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,eAAoB,GAC3B,OAAO,CAAC,cAAc,CAAC,CAoFzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @file Bridges untyped content registry stores to codegen-narrowed consumer types. */
|
|
2
|
+
import type { Store } from 'effector';
|
|
3
|
+
import type { Content } from './entities/content/content.js';
|
|
4
|
+
import type { ContentModelKeys, ContentRecordOf, TypedContent } from './schema-registry.js';
|
|
5
|
+
/**
|
|
6
|
+
* Maps an untyped content store to a codegen-narrowed `TypedContent` store. The
|
|
7
|
+
* `TData` narrowing is compile-time only (no runtime shape check); records whose
|
|
8
|
+
* `data` is not an object map to `null`.
|
|
9
|
+
*
|
|
10
|
+
* @template {Record<string, unknown>} TData
|
|
11
|
+
* @param {Store<Content | null>} store - Registry store from `client.contents.getById`.
|
|
12
|
+
* @returns {Store<TypedContent<TData> | null>} Store whose `data` is narrowed to `TData`.
|
|
13
|
+
* @example
|
|
14
|
+
* const banner = toTypedContentStore<WelcomePage>(client.contents.getById('lc_banner'))
|
|
15
|
+
*/
|
|
16
|
+
export declare function toTypedContentStore<TData extends Record<string, unknown>>(store: Store<Content | null>): Store<TypedContent<TData> | null>;
|
|
17
|
+
/**
|
|
18
|
+
* Returns whether `content` is a record of content model `key`, narrowing its `data` to that
|
|
19
|
+
* model's generated type. The check reads `contentModelKey` only, and a record registered
|
|
20
|
+
* without one matches no model.
|
|
21
|
+
*
|
|
22
|
+
* @template {ContentModelKeys} K
|
|
23
|
+
* @param {Content} content - Registry content record.
|
|
24
|
+
* @param {K} key - Content model key from the workspace schema.
|
|
25
|
+
* @returns {content is ContentRecordOf<K>} Whether the record belongs to that model.
|
|
26
|
+
* @example
|
|
27
|
+
* if (isContentOfModel(record, 'landing-page')) render(record.data.hero_heading)
|
|
28
|
+
*/
|
|
29
|
+
export declare function isContentOfModel<K extends ContentModelKeys>(content: Content, key: K): content is ContentRecordOf<K>;
|
|
30
|
+
//# sourceMappingURL=typed-content.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-content.d.ts","sourceRoot":"","sources":["../../src/typed-content.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAoBxF;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,KAAK,EAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAC3B,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAWnC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,EACzD,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,CAAC,GACL,OAAO,IAAI,eAAe,CAAC,CAAC,CAAC,CAE/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-url.d.ts","sourceRoot":"","sources":["../../../src/utils/api-url.ts"],"names":[],"mappings":"AAEA,wBAAgB,oBAAoB,IAAI,MAAM,CAkB7C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file The telemetry hooks one client exposes.
|
|
3
|
+
*
|
|
4
|
+
* The observer belongs to the client that registered it, so several clients on
|
|
5
|
+
* one page observe only their own traffic.
|
|
6
|
+
*/
|
|
7
|
+
import type { DeliveryAPIRequestObserver } from '../data-source/request-observer.js';
|
|
8
|
+
/** One client's telemetry hooks. */
|
|
9
|
+
export interface ClientTelemetry {
|
|
10
|
+
/** Registers the observer wrapped around this client's delivery API requests, or clears it. */
|
|
11
|
+
observeDeliveryAPIRequests: (next: DeliveryAPIRequestObserver | null) => void;
|
|
12
|
+
/** The observer in force, or `null` while none is registered. */
|
|
13
|
+
readonly deliveryAPIRequestObserver: DeliveryAPIRequestObserver | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Creates the telemetry hooks for one client.
|
|
17
|
+
*
|
|
18
|
+
* The observer is read per request, so registering one after an earlier fetch
|
|
19
|
+
* still applies to the next.
|
|
20
|
+
*
|
|
21
|
+
* @returns {ClientTelemetry} The hooks to register through and read from.
|
|
22
|
+
* @example const telemetry = createClientTelemetry()
|
|
23
|
+
*/
|
|
24
|
+
export declare function createClientTelemetry(): ClientTelemetry;
|
|
25
|
+
//# sourceMappingURL=client-telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-telemetry.d.ts","sourceRoot":"","sources":["../../../src/utils/client-telemetry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAEjF,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,+FAA+F;IAC/F,0BAA0B,EAAE,CAAC,IAAI,EAAE,0BAA0B,GAAG,IAAI,KAAK,IAAI,CAAA;IAC7E,iEAAiE;IACjE,QAAQ,CAAC,0BAA0B,EAAE,0BAA0B,GAAG,IAAI,CAAA;CACvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAWvD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Content-path parsing for live-preview patches.
|
|
3
|
+
*
|
|
4
|
+
* Paths address a field inside a Content Entry's delivered `data` blob using the format the Picked
|
|
5
|
+
* API already emits for content-data validation errors — `$.sections[0].data.title`, rooted at `$`,
|
|
6
|
+
* with `.key` for object keys and `[n]` for array indices. Reusing that format keeps one convention
|
|
7
|
+
* across validation errors and preview patches instead of inventing a second.
|
|
8
|
+
*
|
|
9
|
+
* Content-model field keys are constrained to `/^[a-z][a-z0-9_]*$/` server-side, so no key can
|
|
10
|
+
* contain `.` or `[` and the string form needs no escaping.
|
|
11
|
+
*/
|
|
12
|
+
/** One step along a content path: an object key, or an array index. */
|
|
13
|
+
export type ContentPathSegment = string | number;
|
|
14
|
+
/**
|
|
15
|
+
* Parses a content path into its segments.
|
|
16
|
+
*
|
|
17
|
+
* Returns an empty list for the root path *and* for anything malformed. Callers treat an empty list
|
|
18
|
+
* as "no addressable target" and skip the operation, so a corrupt or hostile path from another
|
|
19
|
+
* frame degrades to a no-op instead of throwing inside a customer's page.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} path - The path to parse, for example `$.sections[0].data.title`.
|
|
22
|
+
* @returns {ContentPathSegment[]} The parsed segments, or `[]` for the root or an invalid path.
|
|
23
|
+
* @example
|
|
24
|
+
* parseContentPath('$.sections[0].data.title') // ['sections', 0, 'data', 'title']
|
|
25
|
+
*/
|
|
26
|
+
export declare function parseContentPath(path: string): ContentPathSegment[];
|
|
27
|
+
/**
|
|
28
|
+
* Formats segments back into a content path. Inverse of {@link parseContentPath} for every
|
|
29
|
+
* well-formed path.
|
|
30
|
+
*
|
|
31
|
+
* @param {readonly ContentPathSegment[]} segments - The segments to format.
|
|
32
|
+
* @returns {string} The path string, or `'$'` when there are no segments.
|
|
33
|
+
* @example
|
|
34
|
+
* formatContentPath(['sections', 0, 'data', 'title']) // '$.sections[0].data.title'
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatContentPath(segments: readonly ContentPathSegment[]): string;
|
|
37
|
+
//# sourceMappingURL=content-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-path.d.ts","sourceRoot":"","sources":["../../../src/utils/content-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,uEAAuE;AACvE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAAA;AA2ChD;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAYnE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,MAAM,CAOjF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** @file DOM utilities for experience target resolution, host element creation, and root management. */
|
|
2
|
+
import type { ExperienceTarget } from '../entities/experience/experience.js';
|
|
3
|
+
export declare function querySelector(selector: string): HTMLElement[];
|
|
4
|
+
export declare function createShadowRoot(target: HTMLElement): ShadowRoot;
|
|
5
|
+
export declare function domInteractive(): Promise<void>;
|
|
6
|
+
export declare function onElementRemoved(element: HTMLElement, callback: () => void): void;
|
|
7
|
+
type Placement = 'replace' | 'before' | 'after' | 'prepend' | 'append';
|
|
8
|
+
export declare function getTargetElements(targets: {
|
|
9
|
+
selector: string;
|
|
10
|
+
placement: Placement;
|
|
11
|
+
}[], experienceId: string): (ExperienceTarget & {
|
|
12
|
+
elements: HTMLElement[];
|
|
13
|
+
})[];
|
|
14
|
+
export declare function createAppHosts(targets: (ExperienceTarget & {
|
|
15
|
+
elements: HTMLElement[];
|
|
16
|
+
})[], experienceId: string, experienceKey: string): HTMLElement[];
|
|
17
|
+
export declare function tagTargetElement(element: HTMLElement, experienceId: string): void;
|
|
18
|
+
export declare function isPickedRoot(element: HTMLElement, experienceId?: string): boolean;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAGzE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,EAAE,CAQ7D;AAID,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAMhE;AAED,wBAAgB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAa9C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,QAS1E;AAED,KAAK,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAA;AAOtE,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,EAAE,EACrD,YAAY,EAAE,MAAM,GACnB,CAAC,gBAAgB,GAAG;IAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,EAAE,CAqBpD;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,CAAC,gBAAgB,GAAG;IAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC,EAAE,EAC3D,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,iBAOtB;AAGD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,QAG1E;AAUD,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,YAAY,CAAC,EAAE,MAAM,WAMvE"}
|