@picked/client 0.0.1-dev.1788925875333 → 0.0.1-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/cjs/index.js +1 -4
- package/dist/cjs/plugins/create-experience/index.js +1 -1
- package/dist/cjs/plugins/experience-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/history-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/responses-browserstorage-plugin/index.js +1 -0
- package/dist/cjs/plugins/responses-indexeddb-plugin/index.js +1 -0
- package/dist/cjs/plugins/shopify/index.js +1 -0
- package/dist/cjs/plugins/single-page-app/index.js +1 -1
- package/dist/cjs/plugins/window-object/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/esm/index.js +733 -1814
- package/dist/esm/plugins/create-experience/index.js +398 -490
- package/dist/esm/plugins/experience-browserstorage-plugin/index.js +38 -0
- package/dist/esm/plugins/history-browserstorage-plugin/index.js +26 -0
- package/dist/esm/plugins/responses-browserstorage-plugin/index.js +36 -0
- package/dist/esm/plugins/responses-indexeddb-plugin/index.js +101 -0
- package/dist/esm/plugins/shopify/index.js +59 -0
- package/dist/esm/plugins/single-page-app/index.js +35 -31
- package/dist/esm/plugins/window-object/index.js +9 -9
- package/dist/esm/server/index.js +89 -141
- package/dist/experience-instance-6ZKZS7dF.cjs +1 -0
- package/dist/experience-instance-BA0EXYg5.js +712 -0
- package/dist/id-BKIWbSTy.cjs +1 -0
- package/dist/id-BW-g3y32.js +6 -0
- package/dist/logger-BsmHUUw1.cjs +1 -0
- package/dist/logger-C9a75KZn.js +5 -0
- package/dist/object-BbFTsGh3.cjs +1 -0
- package/dist/object-JwZ58NOH.js +28 -0
- package/dist/storage-BPJwmlva.cjs +1 -0
- package/dist/storage-D87xFySf.js +85 -0
- package/dist/supports-BvrzQAVk.js +79 -0
- package/dist/supports-C0y3-V5V.cjs +1 -0
- package/dist/types/client.d.ts +23 -119
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/entities/component/component.d.ts +6 -45
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/experience/experience.d.ts +99 -152
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +113 -83
- package/dist/types/entities/experience-instance/experience-instance.d.ts.map +1 -1
- package/dist/types/entities/feature/feature.d.ts +8 -118
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +64 -96
- package/dist/types/entities/field/field.d.ts.map +1 -1
- package/dist/types/entities/framework/framework.d.ts +7 -32
- package/dist/types/entities/framework/framework.d.ts.map +1 -1
- package/dist/types/entities/history/history.d.ts +6 -6
- package/dist/types/entities/history/history.d.ts.map +1 -1
- package/dist/types/entities/plugin/plugin.d.ts +2 -41
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +7 -30
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/project/project.d.ts +9 -0
- package/dist/types/entities/project/project.d.ts.map +1 -0
- package/dist/types/entities/response/response.d.ts +21 -57
- package/dist/types/entities/response/response.d.ts.map +1 -1
- package/dist/types/exports.d.ts +4 -22
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -12
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logic-engine.d.ts +11 -13
- package/dist/types/logic-engine.d.ts.map +1 -1
- package/dist/types/picked.d.ts +184 -381
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/ping.d.ts +10 -0
- package/dist/types/ping.d.ts.map +1 -0
- package/dist/types/plugins/create-experience/create-experience.d.ts +44 -119
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/index.d.ts +2 -2
- package/dist/types/plugins/create-experience/index.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts +2 -3
- package/dist/types/plugins/create-experience/plugin.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/serialization.d.ts.map +1 -1
- package/dist/types/plugins/experience-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts +6 -0
- package/dist/types/plugins/experience-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/history-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/plugin.d.ts +1 -2
- package/dist/types/plugins/history-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-browserstorage-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts +6 -0
- package/dist/types/plugins/responses-browserstorage-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb-plugin/index.d.ts.map +1 -0
- package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts +3 -0
- package/dist/types/plugins/responses-indexeddb-plugin/plugin.d.ts.map +1 -0
- package/dist/types/plugins/shopify/index.d.ts +2 -0
- package/dist/types/plugins/shopify/index.d.ts.map +1 -0
- package/dist/types/plugins/shopify/plugin.d.ts +3 -0
- package/dist/types/plugins/shopify/plugin.d.ts.map +1 -0
- package/dist/types/plugins/shopify/shopify.d.ts +28 -0
- package/dist/types/plugins/shopify/shopify.d.ts.map +1 -0
- package/dist/types/plugins/single-page-app/plugin.d.ts +2 -2
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/plugins/window-object/plugin.d.ts +2 -2
- package/dist/types/server/index.d.ts +3 -18
- package/dist/types/server/index.d.ts.map +1 -1
- package/dist/types/utils/dom.d.ts +6 -4
- package/dist/types/utils/dom.d.ts.map +1 -1
- package/dist/types/utils/events.d.ts +38 -83
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +2 -1
- package/dist/types/utils/global-obj.d.ts.map +1 -1
- package/dist/types/utils/id.d.ts.map +1 -1
- package/dist/types/utils/indexed-db.d.ts +1 -2
- package/dist/types/utils/indexed-db.d.ts.map +1 -1
- package/dist/types/utils/logger.d.ts +1 -2
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts +3 -0
- package/dist/types/utils/node-tree/get-next-node-from-conditional.d.ts.map +1 -0
- package/dist/types/utils/node-tree/get-next-node.d.ts +1 -1
- package/dist/types/utils/node-tree/get-next-node.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-origin-node.d.ts +1 -1
- package/dist/types/utils/node-tree/get-origin-node.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-leaf.d.ts.map +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts +1 -1
- package/dist/types/utils/node-tree/min-max-steps-to-origin.d.ts.map +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts +1 -1
- package/dist/types/utils/node-tree/next-reachable-step-nodes.d.ts.map +1 -1
- package/dist/types/utils/nodes.d.ts +2 -3
- package/dist/types/utils/nodes.d.ts.map +1 -1
- package/dist/types/utils/object.d.ts +8 -0
- package/dist/types/utils/object.d.ts.map +1 -1
- package/dist/types/utils/rules-logic.d.ts +3 -33
- package/dist/types/utils/rules-logic.d.ts.map +1 -1
- package/dist/types/utils/search-params.d.ts.map +1 -1
- package/dist/types/utils/state-snaphot.d.ts +16 -0
- package/dist/types/utils/state-snaphot.d.ts.map +1 -0
- package/dist/types/utils/storage.d.ts +11 -374
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/dist/types/utils/supports.d.ts +0 -87
- package/dist/types/utils/supports.d.ts.map +1 -1
- package/package.json +49 -182
- package/dist/.tsbuildinfo +0 -1
- package/dist/api-DbMJli3H.js +0 -22
- package/dist/api-qiqq8lgz.cjs +0 -1
- package/dist/cjs/form/index.js +0 -1
- package/dist/cjs/plugins/dom-observer/index.js +0 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +0 -1
- package/dist/cjs/plugins/experience-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/history-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/responses-browser-storage/index.js +0 -1
- package/dist/cjs/plugins/responses-indexeddb/index.js +0 -1
- package/dist/cjs/plugins/telemetry/index.js +0 -1
- package/dist/cjs/plugins/web-components/index.js +0 -1
- package/dist/cjs/preview/index.js +0 -1
- package/dist/docs/_root.css +0 -101
- package/dist/docs/explanation/conditions-and-the-logic-engine.md +0 -94
- package/dist/docs/explanation/content-references.md +0 -99
- package/dist/docs/explanation/feature-flag-allocation.md +0 -218
- package/dist/docs/explanation/how-picked-works.md +0 -124
- package/dist/docs/explanation/how-pickedql-works.md +0 -76
- package/dist/docs/explanation/pages-and-flows.md +0 -64
- package/dist/docs/explanation/the-content-model.md +0 -87
- package/dist/docs/explanation/the-two-apis.md +0 -68
- package/dist/docs/explanation/why-server-side-rendering.md +0 -76
- package/dist/docs/explanation/workspaces-and-versions.md +0 -71
- package/dist/docs/how-to/add-a-step-field-or-action.md +0 -43
- package/dist/docs/how-to/analytics/index.md +0 -316
- package/dist/docs/how-to/archive-or-delete-a-workspace.md +0 -46
- package/dist/docs/how-to/authenticate-the-cli.md +0 -97
- package/dist/docs/how-to/authenticate-with-a-magic-link.md +0 -40
- package/dist/docs/how-to/authenticate-with-a-password.md +0 -51
- package/dist/docs/how-to/authenticate-with-an-api-key.md +0 -51
- package/dist/docs/how-to/authenticate-with-oauth.md +0 -40
- package/dist/docs/how-to/build-a-flow.md +0 -83
- package/dist/docs/how-to/connect-the-mcp-server.md +0 -38
- package/dist/docs/how-to/create-a-content-entry.md +0 -48
- package/dist/docs/how-to/create-a-project.md +0 -29
- package/dist/docs/how-to/create-an-experience.md +0 -42
- package/dist/docs/how-to/create-and-revoke-an-api-key.md +0 -42
- package/dist/docs/how-to/debug-with-the-chrome-extension.md +0 -57
- package/dist/docs/how-to/define-a-page-layout.md +0 -46
- package/dist/docs/how-to/fill-and-publish-a-page.md +0 -66
- package/dist/docs/how-to/install-the-gtm-template.md +0 -84
- package/dist/docs/how-to/install-the-sdk.md +0 -93
- package/dist/docs/how-to/install-the-vite-plugin.md +0 -69
- package/dist/docs/how-to/invite-and-remove-members.md +0 -34
- package/dist/docs/how-to/point-one-entry-at-another.md +0 -61
- package/dist/docs/how-to/preview-a-workspace.md +0 -28
- package/dist/docs/how-to/publish-a-workspace.md +0 -30
- package/dist/docs/how-to/read-a-feature-flag.md +0 -113
- package/dist/docs/how-to/read-a-referenced-entry.md +0 -109
- package/dist/docs/how-to/register-a-component.md +0 -55
- package/dist/docs/how-to/register-an-action-handler.md +0 -67
- package/dist/docs/how-to/render-a-step-form.md +0 -131
- package/dist/docs/how-to/render-an-unpublished-preview.md +0 -41
- package/dist/docs/how-to/reuse-a-section.md +0 -53
- package/dist/docs/how-to/reuse-a-step-field-or-action.md +0 -28
- package/dist/docs/how-to/roll-back-a-published-version.md +0 -26
- package/dist/docs/how-to/run-an-ab-test.md +0 -49
- package/dist/docs/how-to/run-code-on-a-form-submission.md +0 -125
- package/dist/docs/how-to/server-render-a-page.md +0 -81
- package/dist/docs/how-to/set-a-content-security-policy.md +0 -32
- package/dist/docs/how-to/set-up-mfa.md +0 -69
- package/dist/docs/how-to/switch-workspaces.md +0 -122
- package/dist/docs/how-to/upload-and-use-an-asset.mdx +0 -73
- package/dist/docs/how-to/validate-a-field.md +0 -52
- package/dist/docs/how-to/write-a-condition.md +0 -45
- package/dist/docs/how-to/write-a-predicate.md +0 -60
- package/dist/docs/index.md +0 -59
- package/dist/docs/reference/dashboard/actions.mdx +0 -53
- package/dist/docs/reference/dashboard/api-keys.mdx +0 -38
- package/dist/docs/reference/dashboard/conditions.mdx +0 -42
- package/dist/docs/reference/dashboard/content/asset-library.mdx +0 -63
- package/dist/docs/reference/dashboard/content/blocks.mdx +0 -57
- package/dist/docs/reference/dashboard/content/content-entries.mdx +0 -95
- package/dist/docs/reference/dashboard/content/models.mdx +0 -108
- package/dist/docs/reference/dashboard/content/pages.mdx +0 -61
- package/dist/docs/reference/dashboard/experiences.mdx +0 -51
- package/dist/docs/reference/dashboard/features.mdx +0 -154
- package/dist/docs/reference/dashboard/fields.mdx +0 -106
- package/dist/docs/reference/dashboard/flow-builder/canvas.mdx +0 -58
- package/dist/docs/reference/dashboard/flow-builder/condition-builder.md +0 -57
- package/dist/docs/reference/dashboard/flow-builder/keyboard-shortcuts.md +0 -72
- package/dist/docs/reference/dashboard/flow-builder/nodes.md +0 -63
- package/dist/docs/reference/dashboard/projects.mdx +0 -44
- package/dist/docs/reference/dashboard/reports.mdx +0 -43
- package/dist/docs/reference/dashboard/steps.mdx +0 -37
- package/dist/docs/reference/dashboard/team-management.md +0 -29
- package/dist/docs/reference/dashboard/workspace-versioning.mdx +0 -30
- package/dist/docs/reference/dashboard/workspaces.mdx +0 -76
- package/dist/docs/reference/delivery-api/experience-content.md +0 -152
- package/dist/docs/reference/delivery-api/index.md +0 -45
- package/dist/docs/reference/delivery-api/preview-caching-crawling.md +0 -79
- package/dist/docs/reference/delivery-api/project-config.md +0 -65
- package/dist/docs/reference/delivery-api/workspace-schema.md +0 -85
- package/dist/docs/reference/glossary.md +0 -181
- package/dist/docs/reference/management-api/authentication.md +0 -74
- package/dist/docs/reference/management-api/authorization-and-scopes.md +0 -285
- package/dist/docs/reference/management-api/error-handling.md +0 -233
- package/dist/docs/reference/management-api/pagination.md +0 -192
- package/dist/docs/reference/pickedql/data-sources.md +0 -174
- package/dist/docs/reference/pickedql/dimensions.md +0 -103
- package/dist/docs/reference/pickedql/filtering.md +0 -64
- package/dist/docs/reference/pickedql/index.md +0 -18
- package/dist/docs/reference/pickedql/schema.md +0 -172
- package/dist/docs/reference/pickedql/virtual-functions.md +0 -248
- package/dist/docs/reference/sdk/actions.md +0 -30
- package/dist/docs/reference/sdk/analytics-events.md +0 -445
- package/dist/docs/reference/sdk/conditions.md +0 -147
- package/dist/docs/reference/sdk/content-security-policy.md +0 -21
- package/dist/docs/reference/sdk/content.md +0 -213
- package/dist/docs/reference/sdk/experiences.md +0 -51
- package/dist/docs/reference/sdk/features.md +0 -256
- package/dist/docs/reference/sdk/fields.md +0 -255
- package/dist/docs/reference/sdk/index.md +0 -68
- package/dist/docs/reference/sdk/plugins/create-experience.md +0 -123
- package/dist/docs/reference/sdk/plugins/dynamic-experiences.md +0 -74
- package/dist/docs/reference/sdk/plugins/index.md +0 -29
- package/dist/docs/reference/sdk/plugins/window-object.md +0 -25
- package/dist/docs/reference/sdk/predicates.md +0 -43
- package/dist/docs/reference/sdk/ssr/index.md +0 -33
- package/dist/docs/reference/sdk/ssr/rendering-and-hydration.md +0 -103
- package/dist/docs/reference/sdk/ssr/serialize.md +0 -80
- package/dist/docs/reference/sdk/ssr/slots-and-placements.md +0 -59
- package/dist/docs/reference/sdk/steps.md +0 -86
- package/dist/docs/reference/sdk/type-generation.md +0 -196
- package/dist/docs/reference/tools/chrome-extension.md +0 -16
- package/dist/docs/reference/tools/cli.md +0 -146
- package/dist/docs/reference/tools/image-optimisation-service.md +0 -104
- package/dist/docs/reference/tools/mcp.md +0 -90
- package/dist/docs/reference/tools/vite-plugin.md +0 -163
- package/dist/docs/tutorials/first-api-call.md +0 -228
- package/dist/docs/tutorials/first-experience-in-the-dashboard.mdx +0 -143
- package/dist/docs/tutorials/first-experience.mdx +0 -254
- package/dist/docs/tutorials/first-server-rendered-page.mdx +0 -186
- package/dist/dom-BqcToNL0.js +0 -82
- package/dist/dom-DlLH3FxV.cjs +0 -1
- package/dist/emit-D-tLiWL1.cjs +0 -1
- package/dist/emit-Ds2EG7CB.js +0 -14
- package/dist/esm/form/index.js +0 -565
- package/dist/esm/plugins/dom-observer/index.js +0 -87
- package/dist/esm/plugins/dynamic-experiences/index.js +0 -5
- package/dist/esm/plugins/experience-browser-storage/index.js +0 -38
- package/dist/esm/plugins/history-browser-storage/index.js +0 -26
- package/dist/esm/plugins/responses-browser-storage/index.js +0 -71
- package/dist/esm/plugins/responses-indexeddb/index.js +0 -89
- package/dist/esm/plugins/telemetry/index.js +0 -100
- package/dist/esm/plugins/web-components/index.js +0 -19
- package/dist/esm/preview/index.js +0 -2
- package/dist/experience-instance-DGk11d8a.js +0 -563
- package/dist/experience-instance-Dej3P1sE.cjs +0 -1
- package/dist/id-Bo4RBeOs.js +0 -4
- package/dist/id-Js-62re-.cjs +0 -1
- package/dist/inert-script-report-B_bMPRzp.js +0 -18
- package/dist/inert-script-report-ijRHPtcY.cjs +0 -1
- package/dist/logger-CSTvAyyB.cjs +0 -1
- package/dist/logger-DMN6TxJJ.js +0 -4
- package/dist/object-BUDGxEqy.js +0 -25
- package/dist/object-CIkt7Fkr.cjs +0 -1
- package/dist/plugin-BcLaCLm1.cjs +0 -1
- package/dist/plugin-De_BJSwE.js +0 -194
- package/dist/preview-channel-CSr96XAo.js +0 -98
- package/dist/preview-channel-Cx0e6fye.cjs +0 -1
- package/dist/protocol-Bb_vpLKE.cjs +0 -1
- package/dist/protocol-C5KkkiZc.js +0 -84
- package/dist/provider-C_9u0yGJ.cjs +0 -1
- package/dist/provider-ovM-CBX_.js +0 -98
- package/dist/registry-C1t8l3t9.cjs +0 -1
- package/dist/registry-CXZv0uLg.js +0 -18
- package/dist/rules-logic-CGZIYgAI.cjs +0 -1
- package/dist/rules-logic-HesIUCu6.js +0 -13
- package/dist/storage-1MW3-_As.js +0 -103
- package/dist/storage-DUw9UJ2h.cjs +0 -1
- package/dist/supports-CO9bJGNl.js +0 -92
- package/dist/supports-DBzjGaWD.cjs +0 -1
- package/dist/types/data-source/api.d.ts +0 -60
- package/dist/types/data-source/api.d.ts.map +0 -1
- package/dist/types/data-source/provider.d.ts +0 -103
- package/dist/types/data-source/provider.d.ts.map +0 -1
- package/dist/types/data-source/registry.d.ts +0 -26
- package/dist/types/data-source/registry.d.ts.map +0 -1
- package/dist/types/data-source/request-observer.d.ts +0 -62
- package/dist/types/data-source/request-observer.d.ts.map +0 -1
- package/dist/types/data-source/virtual-data.d.ts +0 -19
- package/dist/types/data-source/virtual-data.d.ts.map +0 -1
- package/dist/types/entities/action/action.d.ts +0 -85
- package/dist/types/entities/action/action.d.ts.map +0 -1
- package/dist/types/entities/component/lazyComponent.d.ts +0 -11
- package/dist/types/entities/component/lazyComponent.d.ts.map +0 -1
- package/dist/types/entities/condition/condition.d.ts +0 -29
- package/dist/types/entities/condition/condition.d.ts.map +0 -1
- package/dist/types/entities/content/content.d.ts +0 -53
- package/dist/types/entities/content/content.d.ts.map +0 -1
- package/dist/types/entities/content/reference.d.ts +0 -101
- package/dist/types/entities/content/reference.d.ts.map +0 -1
- package/dist/types/entities/field/policies.d.ts +0 -35
- package/dist/types/entities/field/policies.d.ts.map +0 -1
- package/dist/types/entities/response/response-validation.d.ts +0 -75
- package/dist/types/entities/response/response-validation.d.ts.map +0 -1
- package/dist/types/entities/session/session.d.ts +0 -46
- package/dist/types/entities/session/session.d.ts.map +0 -1
- package/dist/types/entities/step/step.d.ts +0 -56
- package/dist/types/entities/step/step.d.ts.map +0 -1
- package/dist/types/form/build-responses.d.ts +0 -18
- package/dist/types/form/build-responses.d.ts.map +0 -1
- package/dist/types/form/create-field-evaluator.d.ts +0 -28
- package/dist/types/form/create-field-evaluator.d.ts.map +0 -1
- package/dist/types/form/create-field-validation.d.ts +0 -60
- package/dist/types/form/create-field-validation.d.ts.map +0 -1
- package/dist/types/form/create-form.d.ts +0 -153
- package/dist/types/form/create-form.d.ts.map +0 -1
- package/dist/types/form/create-submit-pipeline.d.ts +0 -116
- package/dist/types/form/create-submit-pipeline.d.ts.map +0 -1
- package/dist/types/form/get-step-fields.d.ts +0 -19
- package/dist/types/form/get-step-fields.d.ts.map +0 -1
- package/dist/types/form/index.d.ts +0 -11
- package/dist/types/form/index.d.ts.map +0 -1
- package/dist/types/lifecycle/condition-selection.d.ts +0 -146
- package/dist/types/lifecycle/condition-selection.d.ts.map +0 -1
- package/dist/types/lifecycle/lifecycle.d.ts +0 -48
- package/dist/types/lifecycle/lifecycle.d.ts.map +0 -1
- package/dist/types/lifecycle/rules-logic.d.ts +0 -25
- package/dist/types/lifecycle/rules-logic.d.ts.map +0 -1
- package/dist/types/lifecycle/state-snapshot.d.ts +0 -38
- package/dist/types/lifecycle/state-snapshot.d.ts.map +0 -1
- package/dist/types/plugins/dom-observer/index.d.ts +0 -3
- package/dist/types/plugins/dom-observer/index.d.ts.map +0 -1
- package/dist/types/plugins/dom-observer/plugin.d.ts +0 -50
- package/dist/types/plugins/dom-observer/plugin.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +0 -105
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/index.d.ts +0 -7
- package/dist/types/plugins/dynamic-experiences/index.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +0 -49
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +0 -1
- package/dist/types/plugins/dynamic-experiences/types.d.ts +0 -45
- package/dist/types/plugins/dynamic-experiences/types.d.ts.map +0 -1
- package/dist/types/plugins/experience-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +0 -7
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/history-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-browser-storage/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +0 -18
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb/index.d.ts.map +0 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts +0 -3
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/emit.d.ts +0 -18
- package/dist/types/plugins/telemetry/emit.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/index.d.ts +0 -4
- package/dist/types/plugins/telemetry/index.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/plugin-summary.d.ts +0 -10
- package/dist/types/plugins/telemetry/plugin-summary.d.ts.map +0 -1
- package/dist/types/plugins/telemetry/plugin.d.ts +0 -45
- package/dist/types/plugins/telemetry/plugin.d.ts.map +0 -1
- package/dist/types/plugins/web-components/index.d.ts +0 -2
- package/dist/types/plugins/web-components/index.d.ts.map +0 -1
- package/dist/types/plugins/web-components/plugin.d.ts +0 -4
- package/dist/types/plugins/web-components/plugin.d.ts.map +0 -1
- package/dist/types/preview/index.d.ts +0 -18
- package/dist/types/preview/index.d.ts.map +0 -1
- package/dist/types/preview-bridge/index.d.ts +0 -14
- package/dist/types/preview-bridge/index.d.ts.map +0 -1
- package/dist/types/preview-channel.d.ts +0 -16
- package/dist/types/preview-channel.d.ts.map +0 -1
- package/dist/types/preview-receiver/apply-ops.d.ts +0 -32
- package/dist/types/preview-receiver/apply-ops.d.ts.map +0 -1
- package/dist/types/preview-receiver/index.d.ts +0 -32
- package/dist/types/preview-receiver/index.d.ts.map +0 -1
- package/dist/types/preview-receiver/protocol.d.ts +0 -69
- package/dist/types/preview-receiver/protocol.d.ts.map +0 -1
- package/dist/types/schema-registry.d.ts +0 -206
- package/dist/types/schema-registry.d.ts.map +0 -1
- package/dist/types/server/serialize.d.ts +0 -87
- package/dist/types/server/serialize.d.ts.map +0 -1
- package/dist/types/typed-content.d.ts +0 -17
- package/dist/types/typed-content.d.ts.map +0 -1
- package/dist/types/utils/client-telemetry.d.ts +0 -25
- package/dist/types/utils/client-telemetry.d.ts.map +0 -1
- package/dist/types/utils/content-path.d.ts +0 -37
- package/dist/types/utils/content-path.d.ts.map +0 -1
- package/dist/types/utils/html-asset-value.d.ts +0 -20
- package/dist/types/utils/html-asset-value.d.ts.map +0 -1
- package/dist/types/utils/inert-script-report.d.ts +0 -40
- package/dist/types/utils/inert-script-report.d.ts.map +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +0 -25
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts.map +0 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +0 -17
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts.map +0 -1
- package/dist/types/utils/picked-config.d.ts +0 -39
- package/dist/types/utils/picked-config.d.ts.map +0 -1
- package/dist/types/utils/preview-session.d.ts +0 -12
- package/dist/types/utils/preview-session.d.ts.map +0 -1
- package/dist/types/utils/rehydrate-scripts.d.ts +0 -50
- package/dist/types/utils/rehydrate-scripts.d.ts.map +0 -1
- package/dist/types/utils/render-string.d.ts +0 -24
- package/dist/types/utils/render-string.d.ts.map +0 -1
- package/dist/types/utils/user-timing.d.ts +0 -21
- package/dist/types/utils/user-timing.d.ts.map +0 -1
- package/dist/version-BvLZaTMC.cjs +0 -1
- package/dist/version-VvasRUfR.js +0 -256
- /package/dist/types/plugins/{experience-browser-storage → experience-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{history-browser-storage → history-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-browser-storage → responses-browserstorage-plugin}/index.d.ts +0 -0
- /package/dist/types/plugins/{responses-indexeddb → responses-indexeddb-plugin}/index.d.ts +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -1,1825 +1,744 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}), L({
|
|
78
|
-
clock: g,
|
|
79
|
-
source: _,
|
|
80
|
-
fn: (e) => e,
|
|
81
|
-
target: d
|
|
82
|
-
}), L({
|
|
83
|
-
clock: g,
|
|
84
|
-
target: m
|
|
85
|
-
}), u = {
|
|
86
|
-
id: r.id,
|
|
87
|
-
key: r.key,
|
|
88
|
-
name: r.name,
|
|
89
|
-
configStore: o,
|
|
90
|
-
treeStore: c,
|
|
91
|
-
componentStore: s,
|
|
92
|
-
actions: l,
|
|
93
|
-
merge: a.merge,
|
|
94
|
-
initialiseFx: d,
|
|
95
|
-
shouldInitialiseFx: p,
|
|
96
|
-
initialiseRequested: h,
|
|
97
|
-
initialiseDirectly: g,
|
|
98
|
-
prepareExperienceContentFx: m
|
|
99
|
-
}, u;
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var q = (t, e, s) => e in t ? K(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var y = (t, e, s) => q(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { createDomain as k, createApi as x, createEffect as $, attach as G, sample as b, combine as j, createEvent as A } from "effector";
|
|
5
|
+
import { createFactory as v, invoke as w } from "@withease/factories";
|
|
6
|
+
import { g as L, t as W, c as J, e as R, i as Y, a as Q, b as X, d as Z } from "../experience-instance-BA0EXYg5.js";
|
|
7
|
+
import { f as rt } from "../experience-instance-BA0EXYg5.js";
|
|
8
|
+
import { l as S } from "../logger-C9a75KZn.js";
|
|
9
|
+
import { c as E, s as P, l as O } from "../storage-D87xFySf.js";
|
|
10
|
+
import { a as nt } from "../storage-D87xFySf.js";
|
|
11
|
+
import { g as ee } from "../id-BW-g3y32.js";
|
|
12
|
+
import { i as te } from "../object-JwZ58NOH.js";
|
|
13
|
+
import { s as M, a as re, b as se } from "../supports-BvrzQAVk.js";
|
|
14
|
+
import { g as it, d as at, i as ct, e as ut, c as lt, f as dt, h as pt } from "../supports-BvrzQAVk.js";
|
|
15
|
+
const z = k("experience"), ne = v(
|
|
16
|
+
({ client: t, experience: e }) => {
|
|
17
|
+
const s = z.store(e), o = x(s, {
|
|
18
|
+
merge(n, f) {
|
|
19
|
+
return {
|
|
20
|
+
...n,
|
|
21
|
+
...f.experience
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}), i = s.map((n) => ({
|
|
25
|
+
type: n.type,
|
|
26
|
+
name: n.name,
|
|
27
|
+
decisionLogic: n.decide,
|
|
28
|
+
targetSelectors: n.targets
|
|
29
|
+
})), u = t.components.listStore.map(
|
|
30
|
+
(n) => n.find((f) => f.name === `experience:${e.id}`) || n.find((f) => f.name === "experience"),
|
|
31
|
+
{ skipVoid: !1 }
|
|
32
|
+
), r = s.map((n) => ({
|
|
33
|
+
steps: n.steps,
|
|
34
|
+
nodes: n.nodes,
|
|
35
|
+
edges: n.edges,
|
|
36
|
+
conditionals: n.conditionals
|
|
37
|
+
}));
|
|
38
|
+
return {
|
|
39
|
+
id: e.id,
|
|
40
|
+
configStore: i,
|
|
41
|
+
treeStore: r,
|
|
42
|
+
componentStore: u,
|
|
43
|
+
merge: o.merge
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
function oe(t) {
|
|
48
|
+
return w(ne, t);
|
|
49
|
+
}
|
|
50
|
+
const ie = v(({ client: t }) => {
|
|
51
|
+
const e = z.store({}), s = x(e, {
|
|
52
|
+
register(r, n) {
|
|
53
|
+
return {
|
|
54
|
+
...r,
|
|
55
|
+
[n.id]: n
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
function o(r) {
|
|
60
|
+
const n = e.getState()[r.id];
|
|
61
|
+
if (n) {
|
|
62
|
+
n.merge({ experience: r, strategy: "override" });
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const f = oe({ client: t, experience: r });
|
|
66
|
+
s.register(f);
|
|
67
|
+
}
|
|
68
|
+
const i = e.map((r) => Object.values(r));
|
|
69
|
+
function u(r) {
|
|
70
|
+
return e.map((n) => n[r], { skipVoid: !1 });
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
register: o,
|
|
74
|
+
getById: u,
|
|
75
|
+
listStore: i
|
|
76
|
+
};
|
|
100
77
|
});
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
let r = "key" in n ? Object.values(e).find((e) => e.key === n.key) : e[n.id], i = t.filter((e) => e.experienceId === r?.id);
|
|
168
|
-
if (i.length > 0) {
|
|
169
|
-
for (let e of i) e.open();
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
let a = "key" in n ? {
|
|
173
|
-
key: n.key,
|
|
174
|
-
options: {
|
|
175
|
-
...n.options,
|
|
176
|
-
initialiseOpen: !0
|
|
177
|
-
}
|
|
178
|
-
} : {
|
|
179
|
-
id: n.id,
|
|
180
|
-
options: {
|
|
181
|
-
...n.options,
|
|
182
|
-
initialiseOpen: !0
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
await c(a);
|
|
186
|
-
}
|
|
187
|
-
}),
|
|
188
|
-
listStore: a,
|
|
189
|
-
initialiseExperiencesFx: A({
|
|
190
|
-
source: a,
|
|
191
|
-
effect: (e) => {
|
|
192
|
-
for (let t of e) t.initialiseRequested(void 0);
|
|
193
|
-
}
|
|
194
|
-
})
|
|
195
|
-
};
|
|
78
|
+
function ae(t) {
|
|
79
|
+
return w(ie, t);
|
|
80
|
+
}
|
|
81
|
+
const ce = (t, e) => {
|
|
82
|
+
e.register(t);
|
|
83
|
+
}, _ = (t, e) => {
|
|
84
|
+
const { targetSelectors: s } = e.configStore.getState(), o = L(s, e.id);
|
|
85
|
+
o.forEach(
|
|
86
|
+
({ elements: u }) => u.forEach((r) => W(r, e.id))
|
|
87
|
+
), J(o).forEach((u) => {
|
|
88
|
+
t.experienceInstances.spawn(e, u);
|
|
89
|
+
});
|
|
90
|
+
}, D = async (t) => {
|
|
91
|
+
await Promise.all(
|
|
92
|
+
t.experiences.listStore.getState().map(async (e) => {
|
|
93
|
+
await ue(t, e) && _(t, e);
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
}, ue = async (t, e) => {
|
|
97
|
+
const { type: s, decisionLogic: o, targetSelectors: i } = e.configStore.getState();
|
|
98
|
+
return L(i, e.id).length < 1 ? !1 : s === "funnel" ? o ? await R(t, o) === !0 : !1 : i.length === 0 ? !1 : Y(o) ? await R(t, o) === !0 : !0;
|
|
99
|
+
}, le = (t, e, s) => {
|
|
100
|
+
const o = e.name, i = e.setup(t);
|
|
101
|
+
if (i) {
|
|
102
|
+
const u = s[o] ?? {};
|
|
103
|
+
s[o] = Object.freeze({ ...u, ...i });
|
|
104
|
+
}
|
|
105
|
+
}, de = k("component"), pe = v(
|
|
106
|
+
({ client: t, component: e, name: s }) => {
|
|
107
|
+
const o = t.frameworks.getByName(e.frameworkName);
|
|
108
|
+
return {
|
|
109
|
+
name: s,
|
|
110
|
+
component: e,
|
|
111
|
+
frameworkStore: o
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
function ge(t) {
|
|
116
|
+
return w(pe, t);
|
|
117
|
+
}
|
|
118
|
+
const fe = v(({ client: t }) => {
|
|
119
|
+
const e = de.store({}), s = x(e, {
|
|
120
|
+
register(r, n) {
|
|
121
|
+
return {
|
|
122
|
+
...r,
|
|
123
|
+
[n.name]: n
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
function o(r, n) {
|
|
128
|
+
e.getState()[r] && S(
|
|
129
|
+
"warn",
|
|
130
|
+
`Component '${r}' already registered. Registering again will override the previous registration.`
|
|
131
|
+
);
|
|
132
|
+
const c = ge({ client: t, name: r, component: n });
|
|
133
|
+
s.register(c);
|
|
134
|
+
}
|
|
135
|
+
const i = e.map((r) => Object.values(r));
|
|
136
|
+
function u(r) {
|
|
137
|
+
return e.map((n) => n[r], { skipVoid: !1 });
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
register: o,
|
|
141
|
+
getByName: u,
|
|
142
|
+
listStore: i
|
|
143
|
+
};
|
|
196
144
|
});
|
|
197
|
-
function
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
return {
|
|
227
|
-
...e,
|
|
228
|
-
[t.name]: t
|
|
229
|
-
};
|
|
230
|
-
} }), i = F();
|
|
231
|
-
L({
|
|
232
|
-
clock: i,
|
|
233
|
-
source: t,
|
|
234
|
-
filter: (e, { name: t }) => e[t] !== void 0,
|
|
235
|
-
fn: (e, { name: t }) => `Component '${t}' already registered. Registering again will override the previous registration.`
|
|
236
|
-
}).watch((e) => /* @__PURE__ */ r("warn", e)), L({
|
|
237
|
-
clock: i,
|
|
238
|
-
fn: ({ name: t, component: n }) => ye({
|
|
239
|
-
client: e,
|
|
240
|
-
name: t,
|
|
241
|
-
component: n
|
|
242
|
-
}),
|
|
243
|
-
target: n.register
|
|
244
|
-
});
|
|
245
|
-
let a = t.map((e) => Object.values(e));
|
|
246
|
-
function o(e) {
|
|
247
|
-
return t.map((t) => t[e], { skipVoid: !1 });
|
|
248
|
-
}
|
|
249
|
-
return {
|
|
250
|
-
register: i,
|
|
251
|
-
getByName: o,
|
|
252
|
-
listStore: a
|
|
253
|
-
};
|
|
145
|
+
function me(t) {
|
|
146
|
+
return w(fe, t);
|
|
147
|
+
}
|
|
148
|
+
const V = (t, e, s) => {
|
|
149
|
+
s.register(t, e);
|
|
150
|
+
}, ye = k("framework"), he = v(({ client: t }) => {
|
|
151
|
+
const e = ye.store({}), s = x(e, {
|
|
152
|
+
register(r, n) {
|
|
153
|
+
return {
|
|
154
|
+
...r,
|
|
155
|
+
[n.name]: n.framework
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
function o(r, n) {
|
|
160
|
+
e.getState()[r] && S(
|
|
161
|
+
"warn",
|
|
162
|
+
`Framework '${r}' already registered. Registering again will override the previous registration.`
|
|
163
|
+
), s.register({ name: r, framework: n });
|
|
164
|
+
}
|
|
165
|
+
const i = e.map((r) => Object.values(r));
|
|
166
|
+
function u(r) {
|
|
167
|
+
return e.map((n) => n[r], { skipVoid: !1 });
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
register: o,
|
|
171
|
+
getByName: u,
|
|
172
|
+
listStore: i
|
|
173
|
+
};
|
|
254
174
|
});
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return t.map((t) => t[e], { skipVoid: !1 });
|
|
282
|
-
}
|
|
283
|
-
return {
|
|
284
|
-
register: i,
|
|
285
|
-
getByName: o,
|
|
286
|
-
listStore: a
|
|
287
|
-
};
|
|
288
|
-
});
|
|
289
|
-
function Te(e) {
|
|
290
|
-
return z(we, e);
|
|
291
|
-
}
|
|
292
|
-
var Ee = (e, t) => {
|
|
293
|
-
t.register({
|
|
294
|
-
name: e.name,
|
|
295
|
-
framework: e
|
|
296
|
-
});
|
|
297
|
-
}, De = R(({ client: e }) => {
|
|
298
|
-
let t = "window" in globalThis, n = {
|
|
299
|
-
location: t ? globalThis.location : void 0,
|
|
300
|
-
document: t ? globalThis.document : void 0,
|
|
301
|
-
sessionStorage: t ? globalThis.sessionStorage : void 0,
|
|
302
|
-
localStorage: t ? globalThis.localStorage : void 0
|
|
303
|
-
};
|
|
304
|
-
return j(e.responses.listStore, e.fields.listStore, (t, r) => Object.freeze({
|
|
305
|
-
client: e,
|
|
306
|
-
responses: t,
|
|
307
|
-
fields: r,
|
|
308
|
-
...n
|
|
309
|
-
}));
|
|
310
|
-
});
|
|
311
|
-
function Oe(e) {
|
|
312
|
-
return z(De, e);
|
|
313
|
-
}
|
|
314
|
-
//#endregion
|
|
315
|
-
//#region src/logic-engine.ts
|
|
316
|
-
function ke(e) {
|
|
317
|
-
return typeof e == "number" && !isNaN(e);
|
|
318
|
-
}
|
|
319
|
-
function V(e) {
|
|
320
|
-
return typeof e == "string";
|
|
321
|
-
}
|
|
322
|
-
function H(e) {
|
|
323
|
-
return Array.isArray(e);
|
|
324
|
-
}
|
|
325
|
-
function Ae(e) {
|
|
326
|
-
return e instanceof Promise;
|
|
327
|
-
}
|
|
328
|
-
function je(e) {
|
|
329
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && Object.keys(e).length === 1;
|
|
330
|
-
}
|
|
331
|
-
function U(e) {
|
|
332
|
-
if (ke(e)) return e;
|
|
333
|
-
let t = parseFloat(`${e}`);
|
|
334
|
-
return isNaN(t) ? 0 : t;
|
|
335
|
-
}
|
|
336
|
-
function W(e) {
|
|
337
|
-
return `${e}`;
|
|
338
|
-
}
|
|
339
|
-
var Me = {
|
|
340
|
-
"==": (e, t) => e == t,
|
|
341
|
-
"===": (e, t) => e === t,
|
|
342
|
-
"!=": (e, t) => e != t,
|
|
343
|
-
"!==": (e, t) => e !== t,
|
|
344
|
-
">": (e, t) => U(e) > U(t),
|
|
345
|
-
">=": (e, t) => U(e) >= U(t),
|
|
346
|
-
"<": (e, t, n) => {
|
|
347
|
-
let r = U(e), i = U(t);
|
|
348
|
-
if (n === void 0) return r < i;
|
|
349
|
-
let a = U(n);
|
|
350
|
-
return r < i && i < a;
|
|
351
|
-
},
|
|
352
|
-
"<=": (e, t, n) => {
|
|
353
|
-
let r = U(e), i = U(t);
|
|
354
|
-
if (n === void 0) return r <= i;
|
|
355
|
-
let a = U(n);
|
|
356
|
-
return r <= i && i <= a;
|
|
357
|
-
},
|
|
358
|
-
"!!": async (e) => await K(e),
|
|
359
|
-
"!": async (e) => !await K(e),
|
|
360
|
-
"%": (e, t) => U(e) % U(t),
|
|
361
|
-
log: (e) => (console.log(e), e),
|
|
362
|
-
in: (e, t) => t ? V(t) ? t.indexOf(W(e)) !== -1 : H(t) ? t.includes(e) : !1 : !1,
|
|
363
|
-
cat: (...e) => e.map(W).join(""),
|
|
364
|
-
substr: (e, t, n) => {
|
|
365
|
-
let r = W(e), i = U(t);
|
|
366
|
-
if (n === void 0) return r.substr(i);
|
|
367
|
-
let a = U(n);
|
|
368
|
-
if (a < 0) {
|
|
369
|
-
let e = r.substr(i);
|
|
370
|
-
return e.substr(0, e.length + a);
|
|
371
|
-
}
|
|
372
|
-
return r.substr(i, a);
|
|
373
|
-
},
|
|
374
|
-
"+": (...e) => e.reduce((e, t) => U(e) + U(t), 0),
|
|
375
|
-
"*": (...e) => e.reduce((e, t) => U(e) * U(t), 1),
|
|
376
|
-
"-": (e, t) => {
|
|
377
|
-
let n = U(e);
|
|
378
|
-
return t === void 0 ? -n : n - U(t);
|
|
379
|
-
},
|
|
380
|
-
"/": (e, t) => U(e) / U(t),
|
|
381
|
-
min: (...e) => Math.min(...e.map(U)),
|
|
382
|
-
max: (...e) => Math.max(...e.map(U)),
|
|
383
|
-
merge: (...e) => e.reduce((e, t) => H(t) ? e.concat(t) : e.concat([t]), []),
|
|
384
|
-
var(e, t) {
|
|
385
|
-
let n = arguments.length > 1 ? t : null;
|
|
386
|
-
if (e === "" || e === "." || e == null) return this;
|
|
387
|
-
if (typeof e == "number" && Array.isArray(this)) return e >= 0 && e < this.length ? this[e] : n;
|
|
388
|
-
let r = W(e);
|
|
389
|
-
if (r === "" || r === ".") return this;
|
|
390
|
-
let i = r.split("."), a = this;
|
|
391
|
-
for (let e of i) {
|
|
392
|
-
if (a == null) return n;
|
|
393
|
-
if (Array.isArray(a)) {
|
|
394
|
-
let t = parseInt(e, 10);
|
|
395
|
-
a = isNaN(t) ? a[e] : a[t];
|
|
396
|
-
} else a = a[e];
|
|
397
|
-
}
|
|
398
|
-
return a === void 0 ? n : a;
|
|
399
|
-
},
|
|
400
|
-
async missing(...e) {
|
|
401
|
-
let t = H(e[0]) ? e[0] : e, n = [];
|
|
402
|
-
for (let e of t) {
|
|
403
|
-
let t = await G({ var: e }, this);
|
|
404
|
-
(t === null || t === "") && n.push(`${e}`);
|
|
405
|
-
}
|
|
406
|
-
return n;
|
|
407
|
-
},
|
|
408
|
-
async missing_some(e, t) {
|
|
409
|
-
let n = await G({ missing: t }, this);
|
|
410
|
-
if (!H(n) || !H(t)) return [];
|
|
411
|
-
let r = n.filter(V);
|
|
412
|
-
return t.filter(V).length - r.length >= U(e) ? [] : r;
|
|
413
|
-
},
|
|
414
|
-
invoke(...e) {
|
|
415
|
-
let [t, ...n] = e;
|
|
416
|
-
return typeof t == "function" ? Reflect.apply(t, null, n) : null;
|
|
417
|
-
},
|
|
418
|
-
startsWith: (e, t) => V(e) && V(t) && e.startsWith(t),
|
|
419
|
-
endsWith: (e, t) => V(e) && V(t) && e.endsWith(t),
|
|
420
|
-
regexp_matches(e, t) {
|
|
421
|
-
let n = e, r = "";
|
|
422
|
-
if (H(e)) {
|
|
423
|
-
let [t, i] = e;
|
|
424
|
-
n = t, r = i;
|
|
425
|
-
}
|
|
426
|
-
return !V(n) || !V(r) ? !1 : new RegExp(n, r).test(W(t));
|
|
427
|
-
},
|
|
428
|
-
throw(e) {
|
|
429
|
-
throw Error(W(e));
|
|
430
|
-
}
|
|
175
|
+
function Se(t) {
|
|
176
|
+
return w(he, t);
|
|
177
|
+
}
|
|
178
|
+
const ve = (t, e) => {
|
|
179
|
+
e.register(t.name, t);
|
|
180
|
+
}, we = 6e3, C = E("last_ping", "global"), ke = (t) => `${t}/api/v1/ping`, xe = async (t) => {
|
|
181
|
+
try {
|
|
182
|
+
const e = Date.now(), s = localStorage.getItem(C);
|
|
183
|
+
if (s && e - parseInt(s) < we)
|
|
184
|
+
return !0;
|
|
185
|
+
const o = ke(t.apiUrl), i = {
|
|
186
|
+
projectId: t.projectId,
|
|
187
|
+
path: window.location.pathname
|
|
188
|
+
}, u = JSON.stringify(i), r = {
|
|
189
|
+
"Content-Type": "application/json"
|
|
190
|
+
}, n = document.getElementById("picked_script"), f = n == null ? void 0 : n.dataset.verceltoken;
|
|
191
|
+
f && (r["x-vercel-protection-bypass"] = f);
|
|
192
|
+
const l = (await fetch(o, {
|
|
193
|
+
method: "POST",
|
|
194
|
+
headers: r,
|
|
195
|
+
body: u
|
|
196
|
+
})).ok;
|
|
197
|
+
return l && localStorage.setItem(C, e.toString()), l;
|
|
198
|
+
} catch (e) {
|
|
199
|
+
return S("error", e), !1;
|
|
200
|
+
}
|
|
431
201
|
};
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
});
|
|
472
|
-
return i;
|
|
473
|
-
}
|
|
474
|
-
case "all": {
|
|
475
|
-
let e = await G(r[0], t);
|
|
476
|
-
if (!H(e) || e.length === 0) return !1;
|
|
477
|
-
for (let t of e) if (!await K(await G(r[1], t))) return !1;
|
|
478
|
-
return !0;
|
|
479
|
-
}
|
|
480
|
-
case "some": {
|
|
481
|
-
let e = await G(r[0], t);
|
|
482
|
-
if (!H(e)) return !1;
|
|
483
|
-
for (let t of e) if (await K(await G(r[1], t))) return !0;
|
|
484
|
-
return !1;
|
|
485
|
-
}
|
|
486
|
-
case "none": {
|
|
487
|
-
let e = await G(r[0], t);
|
|
488
|
-
if (!H(e)) return !0;
|
|
489
|
-
for (let t of e) if (await K(await G(r[1], t))) return !1;
|
|
490
|
-
return !0;
|
|
491
|
-
}
|
|
492
|
-
case "catch": try {
|
|
493
|
-
return await G(r[0], t);
|
|
494
|
-
} catch (e) {
|
|
495
|
-
return je(e) ? await G(e, t) : r[1] ? await G(r[1], e) : e instanceof Error ? e.message : e;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
let i = await Promise.all(r.map((e) => G(e, t))), a = n ? Me[n] : void 0;
|
|
499
|
-
if (!a) throw Error(`Unrecognized operation ${n}`);
|
|
500
|
-
return a.apply(t, i);
|
|
501
|
-
}
|
|
502
|
-
async function K(e) {
|
|
503
|
-
return Ae(e) ? K(await e) : !(Array.isArray(e) && e.length === 0) && !!e;
|
|
504
|
-
}
|
|
505
|
-
function Ne(e) {
|
|
506
|
-
return Object.keys(e)[0];
|
|
507
|
-
}
|
|
508
|
-
//#endregion
|
|
509
|
-
//#region src/lifecycle/rules-logic.ts
|
|
510
|
-
function Pe(e, t, n) {
|
|
511
|
-
return new Proxy(Object.create(null), { get(r, i) {
|
|
512
|
-
if (typeof i != "string") return;
|
|
513
|
-
let a = e.find((e) => e.key === i);
|
|
514
|
-
if (a !== void 0) return async () => !n.has(i) && await G(a.logic, {
|
|
515
|
-
...t,
|
|
516
|
-
conditions: Pe(e, t, new Set(n).add(i))
|
|
517
|
-
}) === !0;
|
|
518
|
-
} });
|
|
519
|
-
}
|
|
520
|
-
var Fe = R(({ client: e }) => A({
|
|
521
|
-
source: {
|
|
522
|
-
stateSnapshot: e.stateSnapshotStore,
|
|
523
|
-
predicates: e.predicates.listStore,
|
|
524
|
-
actions: e.actions.listStore,
|
|
525
|
-
features: e.features.listStore,
|
|
526
|
-
responses: e.responses.getAllStore,
|
|
527
|
-
conditions: e.conditions.listStore
|
|
528
|
-
},
|
|
529
|
-
effect: async ({ stateSnapshot: e, predicates: t, actions: n, features: r, responses: i, conditions: a }, { rule: o, context: s }) => {
|
|
530
|
-
let c = t.reduce((t, n) => (t[n.name] = async (...t) => await n.predicate({
|
|
531
|
-
...e,
|
|
532
|
-
args: t
|
|
533
|
-
}), t), {}), l = n.reduce((t, n) => (t[n.key] = async (...t) => await n.action({
|
|
534
|
-
...e,
|
|
535
|
-
args: t
|
|
536
|
-
}, null) ?? void 0, t), {}), u = r.reduce((e, t) => (e[t.id] = async () => {
|
|
537
|
-
let { bucket: e } = await t.getBucket();
|
|
538
|
-
return e;
|
|
539
|
-
}, e), {}), d = {
|
|
540
|
-
responses: i,
|
|
541
|
-
location: typeof e.location == "object" ? {
|
|
542
|
-
hash: e.location.hash,
|
|
543
|
-
host: e.location.host,
|
|
544
|
-
hostname: e.location.hostname,
|
|
545
|
-
href: e.location.href,
|
|
546
|
-
origin: e.location.origin,
|
|
547
|
-
pathname: e.location.pathname,
|
|
548
|
-
port: e.location.port,
|
|
549
|
-
protocol: e.location.protocol,
|
|
550
|
-
search: e.location.search
|
|
551
|
-
} : void 0,
|
|
552
|
-
predicates: c,
|
|
553
|
-
actions: l,
|
|
554
|
-
features: u,
|
|
555
|
-
...s
|
|
556
|
-
};
|
|
557
|
-
return await G(o, {
|
|
558
|
-
...d,
|
|
559
|
-
conditions: Pe(a, d, /* @__PURE__ */ new Set())
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
}));
|
|
563
|
-
function Ie(e) {
|
|
564
|
-
return z(Fe, e);
|
|
565
|
-
}
|
|
566
|
-
//#endregion
|
|
567
|
-
//#region src/lifecycle/lifecycle.ts
|
|
568
|
-
var q = N("lifecycle"), Le = R(({ client: e }) => {
|
|
569
|
-
let t = q.store(!1), r = I(void 0, {
|
|
570
|
-
skipVoid: !1,
|
|
571
|
-
domain: q
|
|
572
|
-
}), i = I(void 0, {
|
|
573
|
-
skipVoid: !1,
|
|
574
|
-
domain: q
|
|
575
|
-
}), a = q.store("idle"), o = q.store([]), s = I(void 0, {
|
|
576
|
-
skipVoid: !1,
|
|
577
|
-
domain: q
|
|
578
|
-
}), l = I(void 0, {
|
|
579
|
-
skipVoid: !1,
|
|
580
|
-
domain: q
|
|
581
|
-
}), u = F(), d = F(), f = F(), p = F(), m = F(), h = F();
|
|
582
|
-
o.on(p, (e, t) => [...e, t]), s.on(m, (e, t) => t), l.on(h, (e, t) => t), t.on(d, () => !0);
|
|
583
|
-
let g = P(async () => {
|
|
584
|
-
await ee();
|
|
585
|
-
}), _ = P(async () => {
|
|
586
|
-
await me(e);
|
|
587
|
-
}), v = A({ effect: _ }), y = A({
|
|
588
|
-
source: o,
|
|
589
|
-
effect: async (e) => {
|
|
590
|
-
for (let t of e) await t();
|
|
591
|
-
}
|
|
592
|
-
}), b = A({
|
|
593
|
-
source: s,
|
|
594
|
-
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
595
|
-
}), x = A({
|
|
596
|
-
source: l,
|
|
597
|
-
effect: async (t) => t === void 0 ? !0 : typeof t == "boolean" ? t : await n(e, t) === !0
|
|
598
|
-
}), S = L({
|
|
599
|
-
clock: u,
|
|
600
|
-
source: a,
|
|
601
|
-
filter: (e) => e === "idle" && c(),
|
|
602
|
-
fn: () => void 0
|
|
603
|
-
});
|
|
604
|
-
L({
|
|
605
|
-
clock: S,
|
|
606
|
-
fn: () => "starting",
|
|
607
|
-
target: a
|
|
608
|
-
}), S.watch(e.performance.markBegin), d.watch(e.performance.measure), L({
|
|
609
|
-
clock: S,
|
|
610
|
-
target: y
|
|
611
|
-
}), L({
|
|
612
|
-
clock: S,
|
|
613
|
-
target: g
|
|
614
|
-
}), L({
|
|
615
|
-
clock: y.done,
|
|
616
|
-
target: b
|
|
617
|
-
}), L({
|
|
618
|
-
clock: b.doneData,
|
|
619
|
-
target: r
|
|
620
|
-
}), L({
|
|
621
|
-
clock: x.doneData,
|
|
622
|
-
target: i
|
|
623
|
-
}), L({
|
|
624
|
-
clock: b.doneData,
|
|
625
|
-
filter: (e) => e,
|
|
626
|
-
target: x
|
|
627
|
-
}), L({
|
|
628
|
-
clock: x.doneData,
|
|
629
|
-
target: e.session.setIsUser
|
|
630
|
-
}), L({
|
|
631
|
-
clock: x.doneData,
|
|
632
|
-
fn: (e) => ({
|
|
633
|
-
type: "user_decide",
|
|
634
|
-
value: e
|
|
635
|
-
}),
|
|
636
|
-
target: e.eventBus
|
|
637
|
-
}), L({
|
|
638
|
-
clock: b.doneData,
|
|
639
|
-
filter: (e) => !e,
|
|
640
|
-
fn: () => void 0,
|
|
641
|
-
target: f
|
|
642
|
-
}), L({
|
|
643
|
-
clock: x.doneData,
|
|
644
|
-
fn: () => void 0,
|
|
645
|
-
target: f
|
|
646
|
-
}), L({
|
|
647
|
-
clock: f,
|
|
648
|
-
fn: () => ({ type: "initialize" }),
|
|
649
|
-
target: e.eventBus
|
|
650
|
-
});
|
|
651
|
-
let C = I(!1).on(g.done, () => !0), w = I(!1).on(f, () => !0), T = I(!1).on(v.done, () => !0), E = j(r, i, (e, t) => e === !0 && t === !0);
|
|
652
|
-
L({
|
|
653
|
-
clock: f,
|
|
654
|
-
source: E,
|
|
655
|
-
filter: (e) => e,
|
|
656
|
-
fn: () => void 0,
|
|
657
|
-
target: _
|
|
658
|
-
});
|
|
659
|
-
let D = j(C, w, E, (e, t, n) => e && t && n);
|
|
660
|
-
L({
|
|
661
|
-
clock: D,
|
|
662
|
-
filter: (e) => e,
|
|
663
|
-
fn: () => void 0,
|
|
664
|
-
target: v
|
|
665
|
-
});
|
|
666
|
-
let O = j(C, w, E, T, (e, t, n, r) => e && t && (!n || r));
|
|
667
|
-
return L({
|
|
668
|
-
clock: O,
|
|
669
|
-
filter: (e) => e,
|
|
670
|
-
fn: () => void 0,
|
|
671
|
-
target: d
|
|
672
|
-
}), L({
|
|
673
|
-
clock: d,
|
|
674
|
-
fn: () => "ready",
|
|
675
|
-
target: a
|
|
676
|
-
}), L({
|
|
677
|
-
clock: d,
|
|
678
|
-
fn: () => ({ type: "ready" }),
|
|
679
|
-
target: e.eventBus
|
|
680
|
-
}), L({
|
|
681
|
-
clock: d,
|
|
682
|
-
source: e.session.store,
|
|
683
|
-
fn: ({ id: e, isUser: t, identifiers: n }) => ({
|
|
684
|
-
type: "session",
|
|
685
|
-
id: e,
|
|
686
|
-
isUser: t,
|
|
687
|
-
identifiers: n
|
|
688
|
-
}),
|
|
689
|
-
target: e.eventBus
|
|
690
|
-
}), L({
|
|
691
|
-
clock: [
|
|
692
|
-
y.fail,
|
|
693
|
-
b.fail,
|
|
694
|
-
x.fail,
|
|
695
|
-
_.fail,
|
|
696
|
-
v.fail,
|
|
697
|
-
g.fail
|
|
698
|
-
],
|
|
699
|
-
fn: () => "failed",
|
|
700
|
-
target: a
|
|
701
|
-
}), {
|
|
702
|
-
start: u,
|
|
703
|
-
readyStore: t,
|
|
704
|
-
preconditionPassedStore: r,
|
|
705
|
-
conditionPassedStore: i,
|
|
706
|
-
lifecycleStageStore: a,
|
|
707
|
-
registerPluginStartHook: p,
|
|
708
|
-
setPrecondition: m,
|
|
709
|
-
setCondition: h
|
|
710
|
-
};
|
|
202
|
+
function Ie(t) {
|
|
203
|
+
const e = typeof window < "u", s = {
|
|
204
|
+
client: t,
|
|
205
|
+
responses: t.responses.listStore.getState(),
|
|
206
|
+
fields: t.fields.listStore.getState(),
|
|
207
|
+
location: e ? window.location : void 0,
|
|
208
|
+
document: e ? window.document : void 0,
|
|
209
|
+
sessionStorage: e ? window.sessionStorage : void 0,
|
|
210
|
+
localStorage: e ? window.localStorage : void 0
|
|
211
|
+
};
|
|
212
|
+
return Object.freeze(s);
|
|
213
|
+
}
|
|
214
|
+
const Fe = k("predicate"), be = v(({ client: t }) => {
|
|
215
|
+
const e = Fe.store({}), s = x(e, {
|
|
216
|
+
register(r, n) {
|
|
217
|
+
return {
|
|
218
|
+
...r,
|
|
219
|
+
[n.name]: {
|
|
220
|
+
name: n.name,
|
|
221
|
+
predicate: n.predicate
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
function o(r, n) {
|
|
227
|
+
e.getState()[r] && S(
|
|
228
|
+
"warn",
|
|
229
|
+
`Predicate '${r}' already registered. Registering again will override the previous registration.`
|
|
230
|
+
), s.register(Object.freeze({ name: r, predicate: n }));
|
|
231
|
+
}
|
|
232
|
+
const i = e.map((r) => Object.values(r));
|
|
233
|
+
function u(r) {
|
|
234
|
+
return e.map((n) => n[r], { skipVoid: !1 });
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
register: o,
|
|
238
|
+
getByName: u,
|
|
239
|
+
listStore: i
|
|
240
|
+
};
|
|
711
241
|
});
|
|
712
|
-
function
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
242
|
+
function Ee(t) {
|
|
243
|
+
return w(be, t);
|
|
244
|
+
}
|
|
245
|
+
const Pe = (t, e, s) => {
|
|
246
|
+
s.register(t, e);
|
|
247
|
+
}, N = k("feature"), Be = v(() => {
|
|
248
|
+
const t = N.store({}), e = N.store([]), s = x(t, {
|
|
249
|
+
register(c, l) {
|
|
250
|
+
return {
|
|
251
|
+
...c,
|
|
252
|
+
[l.id]: l.feature
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
function o(c, l) {
|
|
257
|
+
t.getState()[c] && S(
|
|
258
|
+
"warn",
|
|
259
|
+
`Feature '${c}' already registered. Registering again will override the previous registration.`
|
|
260
|
+
);
|
|
261
|
+
const g = {
|
|
262
|
+
id: c,
|
|
263
|
+
feature: {
|
|
264
|
+
...l,
|
|
265
|
+
id: c
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
s.register(
|
|
269
|
+
Object.freeze({
|
|
270
|
+
id: c,
|
|
271
|
+
feature: g
|
|
272
|
+
})
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
const i = $(
|
|
276
|
+
async ({
|
|
277
|
+
id: c,
|
|
278
|
+
key: l,
|
|
279
|
+
storage: a = "local"
|
|
280
|
+
}) => {
|
|
281
|
+
const g = E(`feature:${c}:${l}`, "global"), m = (a === "session" ? P : O).get(g).boolean();
|
|
282
|
+
if (m !== null)
|
|
283
|
+
return { id: c, bucket: m };
|
|
284
|
+
}
|
|
285
|
+
), u = $((c) => {
|
|
286
|
+
if (!c)
|
|
287
|
+
return null;
|
|
288
|
+
const l = E(`feature:${c.id}:${c.key}`, "global");
|
|
289
|
+
(c.storage === "session" ? P : O).set(l, c.bucket);
|
|
290
|
+
}), r = G({
|
|
291
|
+
source: { allFeaturesStore: t, resolvedFeaturesStore: e },
|
|
292
|
+
effect: async ({ allFeaturesStore: c, resolvedFeaturesStore: l }, { id: a, decide: g }) => {
|
|
293
|
+
const p = l.find((h) => h.id === a);
|
|
294
|
+
if (p)
|
|
295
|
+
return p;
|
|
296
|
+
const m = c[a];
|
|
297
|
+
if (!m)
|
|
298
|
+
throw new Error(`Feature with id '${a}' not found`);
|
|
299
|
+
const d = await g();
|
|
300
|
+
return { id: m.id, bucket: d, storage: m.feature.storage };
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
b({
|
|
304
|
+
clock: s.register,
|
|
305
|
+
fn: (c) => {
|
|
306
|
+
const { id: l, feature: a } = c;
|
|
307
|
+
return { id: l, key: a.feature.key, storage: a.feature.storage };
|
|
308
|
+
},
|
|
309
|
+
target: i
|
|
310
|
+
}), b({
|
|
311
|
+
source: e,
|
|
312
|
+
clock: [i.doneData, r.doneData],
|
|
313
|
+
fn: (c, l) => !l || c.some((a) => a.id === l.id) ? c : [...c, l],
|
|
314
|
+
target: e
|
|
315
|
+
}), b({
|
|
316
|
+
source: t,
|
|
317
|
+
clock: r.doneData,
|
|
318
|
+
fn: (c, l) => {
|
|
319
|
+
var d;
|
|
320
|
+
const { id: a, bucket: g, storage: p } = l, m = (d = c[a]) == null ? void 0 : d.feature.key;
|
|
321
|
+
return m ? { key: m, id: a, bucket: g, storage: p } : null;
|
|
322
|
+
},
|
|
323
|
+
target: u
|
|
324
|
+
});
|
|
325
|
+
const n = j({ allFeaturesStore: t, resolvedFeaturesStore: e }).map(
|
|
326
|
+
({
|
|
327
|
+
allFeaturesStore: c,
|
|
328
|
+
resolvedFeaturesStore: l
|
|
329
|
+
}) => Object.values(c).map((a) => {
|
|
330
|
+
const g = l.find((p) => p.id === a.id);
|
|
331
|
+
return g ? {
|
|
332
|
+
id: a.id,
|
|
333
|
+
name: a.feature.name,
|
|
334
|
+
key: a.feature.key,
|
|
335
|
+
getBucket: () => ({ id: a.id, bucket: g.bucket }),
|
|
336
|
+
isResolved: !0
|
|
337
|
+
} : {
|
|
338
|
+
id: a.id,
|
|
339
|
+
name: a.feature.name,
|
|
340
|
+
key: a.feature.key,
|
|
341
|
+
getBucket: async () => await r(a.feature),
|
|
342
|
+
isResolved: !1
|
|
343
|
+
};
|
|
344
|
+
})
|
|
345
|
+
);
|
|
346
|
+
function f(c) {
|
|
347
|
+
return t.map((l) => l[c], { skipVoid: !1 });
|
|
348
|
+
}
|
|
349
|
+
return {
|
|
350
|
+
register: o,
|
|
351
|
+
getByName: f,
|
|
352
|
+
listStore: n
|
|
353
|
+
};
|
|
775
354
|
});
|
|
776
|
-
function
|
|
777
|
-
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
355
|
+
function je() {
|
|
356
|
+
return w(Be);
|
|
357
|
+
}
|
|
358
|
+
const Ae = (t, e, s) => {
|
|
359
|
+
s.register(t, e);
|
|
360
|
+
}, F = k("history");
|
|
361
|
+
function T(t, e) {
|
|
362
|
+
return {
|
|
363
|
+
id: ee("history-entry"),
|
|
364
|
+
node: e,
|
|
365
|
+
at: Date.now(),
|
|
366
|
+
experienceId: t
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
const Re = v(() => {
|
|
370
|
+
const t = F.store({ entries: [] }), e = F.event(), s = F.event(), o = F.event(), i = F.event();
|
|
371
|
+
t.on(e, (r, n) => ({
|
|
372
|
+
entries: [...r.entries, T(n.experienceId, n.node)]
|
|
373
|
+
})), t.on(s, (r, n) => ({
|
|
374
|
+
entries: [
|
|
375
|
+
...r.entries.slice(0, -1),
|
|
376
|
+
T(n.experienceId, n.node)
|
|
377
|
+
]
|
|
378
|
+
})), t.on(i, (r, n) => n);
|
|
379
|
+
function u(r, n) {
|
|
380
|
+
const f = { lastStepIndex: -1, secondLastStepIndex: -1 };
|
|
381
|
+
for (let c = r.length - 1; c >= 0; c--) {
|
|
382
|
+
const l = r[c], a = l == null ? void 0 : l.node;
|
|
383
|
+
if (!(!a || !Q(a)) && !(n && (l == null ? void 0 : l.experienceId) !== n))
|
|
384
|
+
if (f.lastStepIndex === -1)
|
|
385
|
+
f.lastStepIndex = c;
|
|
386
|
+
else {
|
|
387
|
+
f.secondLastStepIndex = c;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
return f;
|
|
392
|
+
}
|
|
393
|
+
return t.on(o, (r, n) => {
|
|
394
|
+
const { secondLastStepIndex: f } = u(r.entries, n.experienceId), c = f !== -1 ? r.entries.slice(0, f + 1) : r.entries;
|
|
395
|
+
return {
|
|
396
|
+
...r,
|
|
397
|
+
entries: c
|
|
398
|
+
};
|
|
399
|
+
}), {
|
|
400
|
+
push: e,
|
|
401
|
+
replace: s,
|
|
402
|
+
back: o,
|
|
403
|
+
restore: i,
|
|
404
|
+
entriesStore: t.map((r) => r.entries)
|
|
405
|
+
};
|
|
824
406
|
});
|
|
825
|
-
function
|
|
826
|
-
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
register(e, t) {
|
|
854
|
-
let n = Object.assign({}, t.field, { policies: Je(t.field.policies) });
|
|
855
|
-
return {
|
|
856
|
-
...e,
|
|
857
|
-
[n.id]: n
|
|
858
|
-
};
|
|
859
|
-
},
|
|
860
|
-
updateByKey(e, t) {
|
|
861
|
-
let n = Object.values(e).find((e) => e.key === t.fieldKey);
|
|
862
|
-
if (!n) return e;
|
|
863
|
-
let r = Object.assign({}, n, t.updates);
|
|
864
|
-
return {
|
|
865
|
-
...e,
|
|
866
|
-
[n.id]: Object.assign({}, r, { policies: Je(r.policies) })
|
|
867
|
-
};
|
|
868
|
-
}
|
|
869
|
-
});
|
|
870
|
-
function n(e) {
|
|
871
|
-
t.register({ field: e });
|
|
872
|
-
}
|
|
873
|
-
let r = {};
|
|
874
|
-
e.watch((e) => {
|
|
875
|
-
r = e;
|
|
876
|
-
});
|
|
877
|
-
function i(e, n) {
|
|
878
|
-
let i = Object.values(r).find((t) => t.key === e)?.key;
|
|
879
|
-
i && t.updateByKey({
|
|
880
|
-
fieldKey: i,
|
|
881
|
-
updates: n
|
|
882
|
-
});
|
|
883
|
-
}
|
|
884
|
-
let a = e.map((e) => Object.values(e));
|
|
885
|
-
function o(t) {
|
|
886
|
-
return e.map((e) => e[t] ?? null, { skipVoid: !1 });
|
|
887
|
-
}
|
|
888
|
-
function s(t) {
|
|
889
|
-
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null, { skipVoid: !1 });
|
|
890
|
-
}
|
|
891
|
-
function c(t) {
|
|
892
|
-
return e.map((e) => Object.values(e).find((e) => e.name === t) ?? null, { skipVoid: !1 });
|
|
893
|
-
}
|
|
894
|
-
return {
|
|
895
|
-
register: n,
|
|
896
|
-
update: i,
|
|
897
|
-
getById: o,
|
|
898
|
-
getByKey: s,
|
|
899
|
-
listStore: a,
|
|
900
|
-
getByName: c
|
|
901
|
-
};
|
|
902
|
-
});
|
|
903
|
-
function Ze() {
|
|
904
|
-
return z(Xe);
|
|
905
|
-
}
|
|
906
|
-
//#endregion
|
|
907
|
-
//#region src/entities/step/step.ts
|
|
908
|
-
var Qe = N("step"), $e = R(() => {
|
|
909
|
-
let e = Qe.store({}), t = M(e, { register(e, t) {
|
|
910
|
-
return {
|
|
911
|
-
...e,
|
|
912
|
-
[t.step.id]: t.step
|
|
913
|
-
};
|
|
914
|
-
} });
|
|
915
|
-
function n(e) {
|
|
916
|
-
t.register({ step: e });
|
|
917
|
-
}
|
|
918
|
-
let r = e.map((e) => Object.values(e));
|
|
919
|
-
function i(t) {
|
|
920
|
-
return e.map((e) => e[t] ?? null, { skipVoid: !1 });
|
|
921
|
-
}
|
|
922
|
-
function a(t) {
|
|
923
|
-
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null, { skipVoid: !1 });
|
|
924
|
-
}
|
|
925
|
-
return {
|
|
926
|
-
register: n,
|
|
927
|
-
getById: i,
|
|
928
|
-
getByKey: a,
|
|
929
|
-
listStore: r,
|
|
930
|
-
indexStore: e
|
|
931
|
-
};
|
|
407
|
+
function $e() {
|
|
408
|
+
return w(Re);
|
|
409
|
+
}
|
|
410
|
+
const Oe = () => A(), De = k("field"), Ve = v(() => {
|
|
411
|
+
const t = De.store({}), e = x(t, {
|
|
412
|
+
register(r, n) {
|
|
413
|
+
return {
|
|
414
|
+
...r,
|
|
415
|
+
[n.field.id]: n.field
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
function s(r) {
|
|
420
|
+
e.register({ field: r });
|
|
421
|
+
}
|
|
422
|
+
const o = t.map((r) => Object.values(r));
|
|
423
|
+
function i(r) {
|
|
424
|
+
return t.map((n) => n[r] || null);
|
|
425
|
+
}
|
|
426
|
+
function u(r) {
|
|
427
|
+
return t.map((n) => Object.values(n).find((f) => f.name === r) || null);
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
register: s,
|
|
431
|
+
getById: i,
|
|
432
|
+
listStore: o,
|
|
433
|
+
getByName: u
|
|
434
|
+
};
|
|
932
435
|
});
|
|
933
|
-
function
|
|
934
|
-
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
436
|
+
function Ce() {
|
|
437
|
+
return w(Ve);
|
|
438
|
+
}
|
|
439
|
+
const Ne = (t, e) => {
|
|
440
|
+
e.register(t);
|
|
441
|
+
}, Te = k("response"), Le = v(({ client: t }) => {
|
|
442
|
+
const e = Te.store({}), s = A(), o = A(), i = x(e, {
|
|
443
|
+
register(a, g) {
|
|
444
|
+
return {
|
|
445
|
+
...a,
|
|
446
|
+
[g.fieldId]: g.response
|
|
447
|
+
};
|
|
448
|
+
},
|
|
449
|
+
clear(a, g) {
|
|
450
|
+
const { [g]: p, ...m } = a;
|
|
451
|
+
return m;
|
|
452
|
+
},
|
|
453
|
+
clearAll() {
|
|
454
|
+
return {};
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
function u(a, g) {
|
|
458
|
+
i.register({ fieldId: a, response: g });
|
|
459
|
+
}
|
|
460
|
+
async function r(a) {
|
|
461
|
+
const g = [];
|
|
462
|
+
return await Promise.allSettled(
|
|
463
|
+
Object.entries(a).map(async ([p, m]) => {
|
|
464
|
+
let d = m;
|
|
465
|
+
const h = t.fields.getById(p).getState();
|
|
466
|
+
if (!h) {
|
|
467
|
+
g.push({
|
|
468
|
+
fieldId: p,
|
|
469
|
+
userMessage: `Field '${p}' not found`,
|
|
470
|
+
systemMessage: `No field with ID '${p}' exists. Available field IDs are: ${Object.keys(t.fields.listStore.getState()).join(",")}.`,
|
|
471
|
+
value: d
|
|
472
|
+
});
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
if (h.multiple && (typeof d == "string" || typeof d == "number" || typeof d == "boolean") && (d = [d]), !te(h.validation)) {
|
|
476
|
+
const I = await R(t, h.validation, {
|
|
477
|
+
$input: d
|
|
478
|
+
});
|
|
479
|
+
if (typeof I == "string") {
|
|
480
|
+
g.push({
|
|
481
|
+
fieldId: p,
|
|
482
|
+
userMessage: I,
|
|
483
|
+
systemMessage: `Field validation resulted in an error: ${I}.`,
|
|
484
|
+
value: d
|
|
485
|
+
});
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
if (I === !1) {
|
|
489
|
+
g.push({
|
|
490
|
+
fieldId: p,
|
|
491
|
+
userMessage: "This field is invalid",
|
|
492
|
+
systemMessage: "Field validation resulted in an unspecified error.",
|
|
493
|
+
value: d
|
|
494
|
+
});
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
if (h.required && (typeof d > "u" || d === null || d === "" || Array.isArray(d) && !d.length)) {
|
|
499
|
+
g.push({
|
|
500
|
+
fieldId: p,
|
|
501
|
+
userMessage: "This field is required",
|
|
502
|
+
systemMessage: "Field is required.",
|
|
503
|
+
value: d
|
|
504
|
+
});
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
if (!h.multiple && Array.isArray(d) && d.length > 1) {
|
|
508
|
+
g.push({
|
|
509
|
+
fieldId: p,
|
|
510
|
+
userMessage: "This field expects a single response",
|
|
511
|
+
systemMessage: "Field expects a single response.",
|
|
512
|
+
value: d
|
|
513
|
+
});
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
if (h.options) {
|
|
517
|
+
const I = h.options.map((B) => B.value), H = Array.isArray(d) ? d : [d];
|
|
518
|
+
Array.isArray(d) && (H.every((B) => I.includes(B)) || g.push({
|
|
519
|
+
fieldId: p,
|
|
520
|
+
userMessage: "This field expects a valid option",
|
|
521
|
+
systemMessage: `Field expects a valid option. Valid options are: ${I.join(", ")}`,
|
|
522
|
+
value: d
|
|
523
|
+
}));
|
|
524
|
+
}
|
|
525
|
+
})
|
|
526
|
+
), g.length ? { errors: g } : (Object.entries(a).forEach(([p, m]) => {
|
|
527
|
+
u(p, m);
|
|
528
|
+
}), { errors: [] });
|
|
529
|
+
}
|
|
530
|
+
const n = e.map((a) => a), f = e.map((a) => Object.keys(a).map((p) => ({
|
|
531
|
+
fieldId: p,
|
|
532
|
+
value: a[p]
|
|
533
|
+
})));
|
|
534
|
+
function c(a) {
|
|
535
|
+
const g = t.fields.getById(a), p = e.map((m) => m[a] || null);
|
|
536
|
+
return j({ f: g, r: p }, ({ f: m, r: d }) => d || (m != null && m.defaultValue ? m.defaultValue : null));
|
|
537
|
+
}
|
|
538
|
+
function l(a) {
|
|
539
|
+
const g = t.fields.getByName(a);
|
|
540
|
+
return j({ f: g, s: e }, ({ f: p, s: m }) => {
|
|
541
|
+
const d = p && m[p.id] || null;
|
|
542
|
+
return d || (p != null && p.defaultValue ? p.defaultValue : null);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
return b({
|
|
546
|
+
clock: s,
|
|
547
|
+
target: i.clearAll
|
|
548
|
+
}), b({
|
|
549
|
+
clock: o,
|
|
550
|
+
target: i.clear
|
|
551
|
+
}), {
|
|
552
|
+
register: u,
|
|
553
|
+
clearAll: s,
|
|
554
|
+
clear: o,
|
|
555
|
+
commit: r,
|
|
556
|
+
listStore: f,
|
|
557
|
+
getAllStore: n,
|
|
558
|
+
getByFieldId: c,
|
|
559
|
+
getByFieldName: l
|
|
560
|
+
};
|
|
982
561
|
});
|
|
983
|
-
function
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
562
|
+
function Me(t) {
|
|
563
|
+
return w(Le, t);
|
|
564
|
+
}
|
|
565
|
+
const ze = () => "0.0.1-next.1";
|
|
566
|
+
function _e() {
|
|
567
|
+
if (M()) {
|
|
568
|
+
const t = [
|
|
569
|
+
document.currentScript,
|
|
570
|
+
document.getElementById("picked_script"),
|
|
571
|
+
document.getElementById("picked"),
|
|
572
|
+
document.getElementById("cvly"),
|
|
573
|
+
document.getElementById("cvly-x")
|
|
574
|
+
];
|
|
575
|
+
for (const e of t)
|
|
576
|
+
if (e != null && e.dataset.api)
|
|
577
|
+
return e.dataset.api;
|
|
578
|
+
}
|
|
579
|
+
return "https://api.picked.app";
|
|
580
|
+
}
|
|
581
|
+
function Ue() {
|
|
582
|
+
if (!re())
|
|
583
|
+
return {};
|
|
584
|
+
const t = new URLSearchParams(window.location.search), e = {}, s = /* @__PURE__ */ new Set();
|
|
585
|
+
for (const [i] of t.entries())
|
|
586
|
+
i.startsWith("picked-") && s.add(i);
|
|
587
|
+
for (const i of s) {
|
|
588
|
+
const u = i.replace("picked-", "");
|
|
589
|
+
e[u] = t.getAll(i);
|
|
590
|
+
}
|
|
591
|
+
const o = E("s");
|
|
592
|
+
if (s.size > 0)
|
|
593
|
+
P.set(o, e);
|
|
594
|
+
else {
|
|
595
|
+
const i = P.get(o);
|
|
596
|
+
if (i)
|
|
597
|
+
return i.json() || {};
|
|
598
|
+
}
|
|
599
|
+
return e;
|
|
600
|
+
}
|
|
601
|
+
class U {
|
|
602
|
+
constructor(e) {
|
|
603
|
+
y(this, "options");
|
|
604
|
+
y(this, "isReady", !1);
|
|
605
|
+
y(this, "project");
|
|
606
|
+
y(this, "plugins", {});
|
|
607
|
+
y(this, "eventBus", Oe());
|
|
608
|
+
y(this, "organizationId");
|
|
609
|
+
y(this, "projectId");
|
|
610
|
+
y(this, "apiUrl");
|
|
611
|
+
y(this, "searchParams", Ue());
|
|
612
|
+
y(this, "history", $e());
|
|
613
|
+
y(this, "components", me({ client: this }));
|
|
614
|
+
y(this, "experienceInstances", X({ client: this }));
|
|
615
|
+
y(this, "experiences", ae({ client: this }));
|
|
616
|
+
y(this, "frameworks", Se({ client: this }));
|
|
617
|
+
y(this, "predicates", Ee({ client: this }));
|
|
618
|
+
y(this, "features", je());
|
|
619
|
+
y(this, "fields", Ce());
|
|
620
|
+
y(this, "responses", Me({ client: this }));
|
|
621
|
+
S("info", "Picked client initializing."), this.organizationId = e.organizationId, this.projectId = e.projectId, this.options = Object.freeze(e), this.apiUrl = e.apiUrl || _e(), this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.eventBus({ type: "initialized", version: ze() }), S("info", "Picked client initialized.");
|
|
622
|
+
}
|
|
623
|
+
start() {
|
|
624
|
+
xe(this), (async () => {
|
|
625
|
+
M() && (document.body && await D(this), await Z(), await D(this), this.eventBus({ type: "ready" }), this.isReady = !0);
|
|
626
|
+
})();
|
|
627
|
+
}
|
|
628
|
+
registerFramework(e) {
|
|
629
|
+
ve(e, this.frameworks);
|
|
630
|
+
}
|
|
631
|
+
registerComponent(e, s) {
|
|
632
|
+
V(e, s, this.components);
|
|
633
|
+
}
|
|
634
|
+
registerPlugin(e) {
|
|
635
|
+
le(this, e, this.plugins);
|
|
636
|
+
}
|
|
637
|
+
registerFeature(e, s) {
|
|
638
|
+
Ae(e, s, this.features);
|
|
639
|
+
}
|
|
640
|
+
registerPredicate(e, s) {
|
|
641
|
+
Pe(e, s, this.predicates);
|
|
642
|
+
}
|
|
643
|
+
registerField(e) {
|
|
644
|
+
Ne(e, this.fields);
|
|
645
|
+
}
|
|
646
|
+
registerExperience(e) {
|
|
647
|
+
e.component && V(`experience:${e.id}`, e.component, this.components), ce(e, this.experiences);
|
|
648
|
+
}
|
|
649
|
+
getStateSnapshot() {
|
|
650
|
+
return Ie(this);
|
|
651
|
+
}
|
|
652
|
+
async launchExperienceById(e) {
|
|
653
|
+
const s = this.experiences.getById(e).getState();
|
|
654
|
+
if (!s) {
|
|
655
|
+
S("warn", `Experience with id '${e}' not found.`);
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
_(this, s);
|
|
659
|
+
}
|
|
660
|
+
// private async fetchProject() {
|
|
661
|
+
// if (this.project) {
|
|
662
|
+
// return
|
|
663
|
+
// }
|
|
664
|
+
//
|
|
665
|
+
// // todo: fetch project
|
|
666
|
+
//
|
|
667
|
+
// this.project.experiences.forEach((experience) => setupExperience(experience, this.experiences))
|
|
668
|
+
// }
|
|
669
|
+
setupPlugins() {
|
|
670
|
+
var e;
|
|
671
|
+
(e = this.options.plugins) == null || e.forEach((s) => {
|
|
672
|
+
if (Array.isArray(s)) {
|
|
673
|
+
s.forEach((i) => {
|
|
674
|
+
this.registerPlugin(i);
|
|
675
|
+
});
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const o = typeof s == "function" ? s() : s;
|
|
679
|
+
if (Array.isArray(o)) {
|
|
680
|
+
o.forEach((i) => this.registerPlugin(i));
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
this.registerPlugin(o);
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
setupFeatures() {
|
|
687
|
+
const e = this.options.features;
|
|
688
|
+
e && (Object.entries(e).forEach(([s, o]) => {
|
|
689
|
+
const i = typeof o == "function" ? o() : o;
|
|
690
|
+
this.registerFeature(s, i);
|
|
691
|
+
}), this.searchParams.feature && this.searchParams.feature.forEach((s) => {
|
|
692
|
+
try {
|
|
693
|
+
const [o, i] = s.split(":");
|
|
694
|
+
if (!o || !i)
|
|
695
|
+
return;
|
|
696
|
+
let u = i;
|
|
697
|
+
(u === "true" || u === "false") && (u = !!u), this.registerFeature(o, {
|
|
698
|
+
key: "*",
|
|
699
|
+
name: o,
|
|
700
|
+
// eslint-disable-next-line sonarjs/function-return-type
|
|
701
|
+
decide: () => u,
|
|
702
|
+
storage: "session"
|
|
703
|
+
});
|
|
704
|
+
} catch {
|
|
705
|
+
}
|
|
706
|
+
}));
|
|
707
|
+
}
|
|
708
|
+
setupPredicates() {
|
|
709
|
+
const e = this.options.predicates;
|
|
710
|
+
e && Object.entries(e).forEach(([s, o]) => {
|
|
711
|
+
if (typeof o != "function") {
|
|
712
|
+
S("warn", `Predicate "${s}" is not a function.`);
|
|
713
|
+
return;
|
|
714
|
+
}
|
|
715
|
+
this.registerPredicate(s, o);
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
getPluginConfig(e) {
|
|
719
|
+
return this.plugins[e] ?? {};
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
y(U, "logger", S);
|
|
723
|
+
const Ze = (t) => {
|
|
724
|
+
const e = new U(t);
|
|
725
|
+
return se(e), e;
|
|
1058
726
|
};
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
try {
|
|
1077
|
-
return JSON.stringify(e), !0;
|
|
1078
|
-
} catch {
|
|
1079
|
-
return !1;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
function ft(e, t) {
|
|
1083
|
-
return t.find((t) => t.key === e) ?? null;
|
|
1084
|
-
}
|
|
1085
|
-
function pt(e, t) {
|
|
1086
|
-
return e.multiple && (typeof t == "string" || typeof t == "number" || typeof t == "boolean") ? [t] : t;
|
|
1087
|
-
}
|
|
1088
|
-
function mt(e, t) {
|
|
1089
|
-
if (e.type !== "object" || X(t)) return null;
|
|
1090
|
-
if (e.multiple) {
|
|
1091
|
-
if (!Array.isArray(t)) return Y(e, t, "This field expects multiple values", "Field expects an array of objects.");
|
|
1092
|
-
for (let n of t) {
|
|
1093
|
-
if (typeof n != "object" || !n) return Y(e, t, "This field expects object values", "Field expects an array of objects, but received non-object value.");
|
|
1094
|
-
if (!dt(n)) return Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1095
|
-
}
|
|
1096
|
-
return null;
|
|
1097
|
-
}
|
|
1098
|
-
return Array.isArray(t) ? Y(e, t, "This field expects a single value", "Field expects a single object, not an array.") : typeof t != "object" || !t ? Y(e, t, "This field expects an object value", "Field expects an object value.") : dt(t) ? null : Y(e, t, "This field contains non-serializable data", "Field value contains non-JSON-serializable data (functions, circular references, etc.).");
|
|
1099
|
-
}
|
|
1100
|
-
function ht(e, t) {
|
|
1101
|
-
if (X(t) || !Array.isArray(e.options) || e.options.length === 0) return null;
|
|
1102
|
-
let n = Array.isArray(t) ? t : [t];
|
|
1103
|
-
if (e.type === "object") {
|
|
1104
|
-
let r = new Set(e.options.map((e) => JSON.stringify(e.value)));
|
|
1105
|
-
return n.every((e) => r.has(JSON.stringify(e))) ? null : Y(e, t, "This field expects a valid option", "Field expects a valid option from the defined choices.");
|
|
1106
|
-
}
|
|
1107
|
-
let r = e.options.map((e) => e.value);
|
|
1108
|
-
return n.every((e) => !ut(e) || e === null ? !1 : r.includes(e)) ? null : Y(e, t, "This field expects a valid option", `Field expects a valid option. Valid options are: ${r.join(", ")}`);
|
|
1109
|
-
}
|
|
1110
|
-
async function gt(t, n, r, i) {
|
|
1111
|
-
if (n.validation && !e(n.validation) && !X(r)) {
|
|
1112
|
-
let e = i ? {
|
|
1113
|
-
$input: r,
|
|
1114
|
-
responses: i
|
|
1115
|
-
} : { $input: r }, a = await t(n.validation, e);
|
|
1116
|
-
if (typeof a == "string") return Y(n, r, a, `Field validation resulted in an error: ${a}.`);
|
|
1117
|
-
if (a === !1) return Y(n, r, "This field is invalid", "Field validation resulted in an unspecified error.");
|
|
1118
|
-
}
|
|
1119
|
-
return n.required && X(r) ? Y(n, r, "This field is required", "Field is required.") : !n.multiple && Array.isArray(r) && r.length > 1 ? Y(n, r, "This field expects a single response", "Field expects a single response.") : null;
|
|
1120
|
-
}
|
|
1121
|
-
//#endregion
|
|
1122
|
-
//#region src/entities/response/response.ts
|
|
1123
|
-
var _t = N("response"), vt = R(({ client: e }) => {
|
|
1124
|
-
let t = _t.store({}), r = F(), i = F(), a = M(t, {
|
|
1125
|
-
register(e, t) {
|
|
1126
|
-
return {
|
|
1127
|
-
...e,
|
|
1128
|
-
[t.fieldKey]: t.response
|
|
1129
|
-
};
|
|
1130
|
-
},
|
|
1131
|
-
registerBatch(e, t) {
|
|
1132
|
-
return {
|
|
1133
|
-
...e,
|
|
1134
|
-
...t
|
|
1135
|
-
};
|
|
1136
|
-
},
|
|
1137
|
-
clear(e, t) {
|
|
1138
|
-
return Object.fromEntries(Object.entries(e).filter(([e]) => e !== t));
|
|
1139
|
-
},
|
|
1140
|
-
clearAll() {
|
|
1141
|
-
return {};
|
|
1142
|
-
}
|
|
1143
|
-
});
|
|
1144
|
-
function o(e, t) {
|
|
1145
|
-
if (typeof e == "string") {
|
|
1146
|
-
if (t === void 0) throw Error("Response is required when registering a single field");
|
|
1147
|
-
a.register({
|
|
1148
|
-
fieldKey: e,
|
|
1149
|
-
response: t
|
|
1150
|
-
});
|
|
1151
|
-
} else a.registerBatch(e);
|
|
1152
|
-
}
|
|
1153
|
-
let s = (t, r) => n(e, t, r), c = A({
|
|
1154
|
-
source: {
|
|
1155
|
-
allFields: e.fields.listStore,
|
|
1156
|
-
existingResponses: t
|
|
1157
|
-
},
|
|
1158
|
-
effect: async ({ allFields: e, existingResponses: t }, n) => {
|
|
1159
|
-
let r = [], i = {}, a = {
|
|
1160
|
-
...t,
|
|
1161
|
-
...n
|
|
1162
|
-
}, o = Object.entries(n), c = await Promise.allSettled(o.map(async ([t, n]) => {
|
|
1163
|
-
let o = ft(t, e);
|
|
1164
|
-
if (!o) {
|
|
1165
|
-
r.push({
|
|
1166
|
-
fieldKey: t,
|
|
1167
|
-
userMessage: `Field '${t}' not found`,
|
|
1168
|
-
systemMessage: `No field with key '${t}' exists. Available field keys are: ${e.map((e) => e.key).join(",")}.`,
|
|
1169
|
-
value: n
|
|
1170
|
-
});
|
|
1171
|
-
return;
|
|
1172
|
-
}
|
|
1173
|
-
let c = pt(o, n), l = await gt(s, o, c, a);
|
|
1174
|
-
if (l) {
|
|
1175
|
-
r.push(l);
|
|
1176
|
-
return;
|
|
1177
|
-
}
|
|
1178
|
-
let u = mt(o, c);
|
|
1179
|
-
if (u) {
|
|
1180
|
-
r.push(u);
|
|
1181
|
-
return;
|
|
1182
|
-
}
|
|
1183
|
-
let d = ht(o, c);
|
|
1184
|
-
if (d) {
|
|
1185
|
-
r.push(d);
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
i[o.key] = n;
|
|
1189
|
-
}));
|
|
1190
|
-
for (let [e, t] of c.entries()) {
|
|
1191
|
-
if (t.status !== "rejected") continue;
|
|
1192
|
-
let n = o[e];
|
|
1193
|
-
if (!n) continue;
|
|
1194
|
-
let [i, a] = n, s = t.reason instanceof Error ? t.reason.message : String(t.reason);
|
|
1195
|
-
r.push({
|
|
1196
|
-
fieldKey: i,
|
|
1197
|
-
userMessage: "An unexpected error occurred validating this field",
|
|
1198
|
-
systemMessage: `Validation threw for field '${i}': ${s}`,
|
|
1199
|
-
value: a
|
|
1200
|
-
});
|
|
1201
|
-
}
|
|
1202
|
-
return {
|
|
1203
|
-
responsesToCommit: i,
|
|
1204
|
-
validationErrors: r
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
async function l(e) {
|
|
1209
|
-
return c(e);
|
|
1210
|
-
}
|
|
1211
|
-
let u = A({
|
|
1212
|
-
source: t,
|
|
1213
|
-
effect: async (e, t) => {
|
|
1214
|
-
let { responsesToCommit: n, validationErrors: r } = await c(t);
|
|
1215
|
-
return r.length ? { errors: r } : (a.registerBatch(n), { errors: [] });
|
|
1216
|
-
}
|
|
1217
|
-
});
|
|
1218
|
-
async function d(e) {
|
|
1219
|
-
return u(e);
|
|
1220
|
-
}
|
|
1221
|
-
let f = t.map((e) => e), p = t.map((e) => Object.entries(e).map(([e, t]) => ({
|
|
1222
|
-
fieldKey: e,
|
|
1223
|
-
value: t
|
|
1224
|
-
})));
|
|
1225
|
-
function m(e) {
|
|
1226
|
-
return j({
|
|
1227
|
-
f: e,
|
|
1228
|
-
s: t
|
|
1229
|
-
}, ({ f: e, s: t }) => {
|
|
1230
|
-
let n = e ? t[e.key] ?? null : null;
|
|
1231
|
-
return n === null ? e?.defaultValue !== void 0 && e.defaultValue !== null ? e.defaultValue : null : n;
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
function h(t) {
|
|
1235
|
-
return m(e.fields.getById(t));
|
|
1236
|
-
}
|
|
1237
|
-
function g(t) {
|
|
1238
|
-
return m(e.fields.getByKey(t));
|
|
1239
|
-
}
|
|
1240
|
-
function _(t) {
|
|
1241
|
-
return m(e.fields.getByName(t));
|
|
1242
|
-
}
|
|
1243
|
-
return L({
|
|
1244
|
-
clock: r,
|
|
1245
|
-
target: a.clearAll
|
|
1246
|
-
}), L({
|
|
1247
|
-
clock: i,
|
|
1248
|
-
target: a.clear
|
|
1249
|
-
}), {
|
|
1250
|
-
register: o,
|
|
1251
|
-
clearAll: r,
|
|
1252
|
-
clear: i,
|
|
1253
|
-
commit: d,
|
|
1254
|
-
getResponsesToCommit: l,
|
|
1255
|
-
listStore: p,
|
|
1256
|
-
getAllStore: f,
|
|
1257
|
-
getByFieldId: h,
|
|
1258
|
-
getByFieldKey: g,
|
|
1259
|
-
getByFieldName: _
|
|
1260
|
-
};
|
|
1261
|
-
});
|
|
1262
|
-
function yt(e) {
|
|
1263
|
-
return z(vt, e);
|
|
1264
|
-
}
|
|
1265
|
-
//#endregion
|
|
1266
|
-
//#region src/entities/condition/condition.ts
|
|
1267
|
-
var bt = N("condition"), xt = R(() => {
|
|
1268
|
-
let e = bt.store({}), t = M(e, { register(e, t) {
|
|
1269
|
-
return {
|
|
1270
|
-
...e,
|
|
1271
|
-
[t.condition.id]: t.condition
|
|
1272
|
-
};
|
|
1273
|
-
} });
|
|
1274
|
-
function n(e) {
|
|
1275
|
-
t.register({ condition: e });
|
|
1276
|
-
}
|
|
1277
|
-
let r = e.map((e) => Object.values(e));
|
|
1278
|
-
function i(t) {
|
|
1279
|
-
return e.map((e) => e[t] ?? null, { skipVoid: !1 });
|
|
1280
|
-
}
|
|
1281
|
-
function a(t) {
|
|
1282
|
-
return e.map((e) => Object.values(e).find((e) => e.key === t) ?? null, { skipVoid: !1 });
|
|
1283
|
-
}
|
|
1284
|
-
return {
|
|
1285
|
-
register: n,
|
|
1286
|
-
getById: i,
|
|
1287
|
-
getByKey: a,
|
|
1288
|
-
listStore: r,
|
|
1289
|
-
indexStore: e
|
|
1290
|
-
};
|
|
1291
|
-
});
|
|
1292
|
-
function St() {
|
|
1293
|
-
return z(xt);
|
|
1294
|
-
}
|
|
1295
|
-
//#endregion
|
|
1296
|
-
//#region src/utils/api-url.ts
|
|
1297
|
-
function Ct() {
|
|
1298
|
-
if (c()) {
|
|
1299
|
-
let e = [
|
|
1300
|
-
document.currentScript,
|
|
1301
|
-
document.getElementById("picked_script"),
|
|
1302
|
-
document.getElementById("picked"),
|
|
1303
|
-
document.getElementById("cvly"),
|
|
1304
|
-
document.getElementById("cvly-x")
|
|
1305
|
-
];
|
|
1306
|
-
for (let t of e) if (t?.dataset.api) return t.dataset.api;
|
|
1307
|
-
}
|
|
1308
|
-
return "https://api.picked.app";
|
|
1309
|
-
}
|
|
1310
|
-
//#endregion
|
|
1311
|
-
//#region src/utils/search-params.ts
|
|
1312
|
-
function wt() {
|
|
1313
|
-
if (!s()) return {};
|
|
1314
|
-
let e = new URLSearchParams(window.location.search), t = {}, n = /* @__PURE__ */ new Set();
|
|
1315
|
-
for (let [t] of e.entries()) t.startsWith("picked-") && n.add(t);
|
|
1316
|
-
for (let r of n) {
|
|
1317
|
-
let n = r.replace("picked-", "");
|
|
1318
|
-
t[n] = e.getAll(r);
|
|
1319
|
-
}
|
|
1320
|
-
let r = k("s");
|
|
1321
|
-
if (n.size > 0) O.set(r, t);
|
|
1322
|
-
else {
|
|
1323
|
-
let e = O.get(r);
|
|
1324
|
-
if (e) return e.json() || {};
|
|
1325
|
-
}
|
|
1326
|
-
return t;
|
|
1327
|
-
}
|
|
1328
|
-
//#endregion
|
|
1329
|
-
//#region src/utils/user-timing.ts
|
|
1330
|
-
var Tt = "picked:start:begin", Et = "picked:start";
|
|
1331
|
-
function Dt() {
|
|
1332
|
-
try {
|
|
1333
|
-
return s() && !!p.window && "performance" in p;
|
|
1334
|
-
} catch {
|
|
1335
|
-
return !1;
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
function Ot() {
|
|
1339
|
-
let e = null, t = null;
|
|
1340
|
-
return {
|
|
1341
|
-
markBegin: () => {
|
|
1342
|
-
if (Dt()) try {
|
|
1343
|
-
e = performance.mark(Tt).startTime;
|
|
1344
|
-
} catch {}
|
|
1345
|
-
},
|
|
1346
|
-
measure: () => {
|
|
1347
|
-
if (!(!Dt() || e === null)) try {
|
|
1348
|
-
t = performance.measure(Et, { start: e });
|
|
1349
|
-
} catch {}
|
|
1350
|
-
},
|
|
1351
|
-
get startMeasure() {
|
|
1352
|
-
return t;
|
|
1353
|
-
}
|
|
1354
|
-
};
|
|
1355
|
-
}
|
|
1356
|
-
//#endregion
|
|
1357
|
-
//#region src/utils/client-telemetry.ts
|
|
1358
|
-
function kt() {
|
|
1359
|
-
let e = null;
|
|
1360
|
-
return {
|
|
1361
|
-
observeDeliveryAPIRequests: (t) => {
|
|
1362
|
-
e = t;
|
|
1363
|
-
},
|
|
1364
|
-
get deliveryAPIRequestObserver() {
|
|
1365
|
-
return e;
|
|
1366
|
-
}
|
|
1367
|
-
};
|
|
1368
|
-
}
|
|
1369
|
-
//#endregion
|
|
1370
|
-
//#region src/entities/session/session.ts
|
|
1371
|
-
var At = k("session", "global");
|
|
1372
|
-
function jt() {
|
|
1373
|
-
return m() ? crypto.randomUUID() : `${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}-${Math.random().toString(36).substring(2, 15)}`;
|
|
1374
|
-
}
|
|
1375
|
-
function Mt() {
|
|
1376
|
-
if (!h()) return null;
|
|
1377
|
-
let e = D.get(At);
|
|
1378
|
-
if (!e.isSet()) return null;
|
|
1379
|
-
try {
|
|
1380
|
-
return e.json();
|
|
1381
|
-
} catch {
|
|
1382
|
-
return null;
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
var Nt = R(() => {
|
|
1386
|
-
let e = Mt(), t = { id: e?.id ?? jt() };
|
|
1387
|
-
e?.isUser !== void 0 && (t.isUser = e.isUser), e?.identifiers && Object.keys(e.identifiers).length > 0 && (t.identifiers = e.identifiers);
|
|
1388
|
-
let n = I(t), r = M(n, {
|
|
1389
|
-
setIsUser: (e, t) => ({
|
|
1390
|
-
...e,
|
|
1391
|
-
isUser: t
|
|
1392
|
-
}),
|
|
1393
|
-
setIdentifier: (e, { key: t, value: n }) => ({
|
|
1394
|
-
...e,
|
|
1395
|
-
identifiers: {
|
|
1396
|
-
...e.identifiers ?? {},
|
|
1397
|
-
[t]: n
|
|
1398
|
-
}
|
|
1399
|
-
}),
|
|
1400
|
-
removeIdentifier: (e, t) => {
|
|
1401
|
-
let n = e.identifiers;
|
|
1402
|
-
if (!n || !(t in n)) return e;
|
|
1403
|
-
let r = {};
|
|
1404
|
-
for (let [e, i] of Object.entries(n)) e !== t && (r[e] = i);
|
|
1405
|
-
let i = { id: e.id };
|
|
1406
|
-
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
1407
|
-
}
|
|
1408
|
-
}), i = A({
|
|
1409
|
-
source: n,
|
|
1410
|
-
effect: (e) => {
|
|
1411
|
-
if (h()) try {
|
|
1412
|
-
D.get(At).set(e);
|
|
1413
|
-
} catch {}
|
|
1414
|
-
}
|
|
1415
|
-
});
|
|
1416
|
-
return L({
|
|
1417
|
-
source: n,
|
|
1418
|
-
target: i
|
|
1419
|
-
}), {
|
|
1420
|
-
store: n,
|
|
1421
|
-
setIsUser: r.setIsUser,
|
|
1422
|
-
setIdentifier: r.setIdentifier,
|
|
1423
|
-
removeIdentifier: r.removeIdentifier
|
|
1424
|
-
};
|
|
1425
|
-
});
|
|
1426
|
-
function Pt() {
|
|
1427
|
-
return z(Nt, void 0);
|
|
1428
|
-
}
|
|
1429
|
-
//#endregion
|
|
1430
|
-
//#region src/utils/picked-config.ts
|
|
1431
|
-
function Ft() {
|
|
1432
|
-
if (s()) return globalThis.window.pickedConfig;
|
|
1433
|
-
}
|
|
1434
|
-
function It() {
|
|
1435
|
-
if (s()) return Ft()?.projectId;
|
|
1436
|
-
}
|
|
1437
|
-
function Lt() {
|
|
1438
|
-
if (!c()) return;
|
|
1439
|
-
let e = document.getElementById("picked_script") || document.querySelector("script#picked") || document.getElementById("cvly");
|
|
1440
|
-
if (e) return e.dataset.projectid || e.getAttribute("project-id") || void 0;
|
|
1441
|
-
}
|
|
1442
|
-
function Rt(e) {
|
|
1443
|
-
if (e.projectId) return e.projectId;
|
|
1444
|
-
let t = It();
|
|
1445
|
-
if (t) return t;
|
|
1446
|
-
let n = Lt();
|
|
1447
|
-
if (n) return n;
|
|
1448
|
-
throw Error("projectId is required. You can provide it via one of:\n (1) createClient({ projectId }) options;\n (2) window.pickedConfig = { projectId };\n (3) a <script> tag with id 'picked_script', 'picked', or 'cvly' that includes a data-projectid (or project-id) attribute.");
|
|
1449
|
-
}
|
|
1450
|
-
//#endregion
|
|
1451
|
-
//#region src/utils/render-string.ts
|
|
1452
|
-
function Z(e) {
|
|
1453
|
-
return e == null || e === "" || Number.isNaN(e);
|
|
1454
|
-
}
|
|
1455
|
-
var zt = {
|
|
1456
|
-
default: (e, t) => Z(e) ? String(t ?? "") : String(e),
|
|
1457
|
-
append: (e, t) => t && !Z(e) ? `${e} ${t}` : e,
|
|
1458
|
-
prepend: (e, t) => t && !Z(e) ? `${t} ${e}` : e,
|
|
1459
|
-
upper: (e) => typeof e == "string" ? e.toUpperCase() : e,
|
|
1460
|
-
lower: (e) => typeof e == "string" ? e.toLowerCase() : e,
|
|
1461
|
-
capitalize: (e) => typeof e == "string" ? e.charAt(0).toUpperCase() + e.slice(1) : e,
|
|
1462
|
-
list: (e) => {
|
|
1463
|
-
if (!e || typeof e != "object") return e;
|
|
1464
|
-
let t = new Intl.ListFormat("en", {
|
|
1465
|
-
style: "long",
|
|
1466
|
-
type: "conjunction"
|
|
1467
|
-
});
|
|
1468
|
-
if (Array.isArray(e)) return t.format(e.map(String));
|
|
1469
|
-
if (e instanceof Map) {
|
|
1470
|
-
let n = Array.from(e.entries()).map(([e, t]) => `${e}: ${t}`);
|
|
1471
|
-
return t.format(n);
|
|
1472
|
-
}
|
|
1473
|
-
return e instanceof Set ? t.format(Array.from(e).map(String)) : e;
|
|
1474
|
-
}
|
|
727
|
+
export {
|
|
728
|
+
U as Picked,
|
|
729
|
+
Ze as createClient,
|
|
730
|
+
E as createStorageKey,
|
|
731
|
+
rt as isPickedRoot,
|
|
732
|
+
O as localStore,
|
|
733
|
+
P as sessionStore,
|
|
734
|
+
nt as subscribe,
|
|
735
|
+
it as supportsCookies,
|
|
736
|
+
M as supportsDocument,
|
|
737
|
+
at as supportsHistory,
|
|
738
|
+
ct as supportsIntersectionObserver,
|
|
739
|
+
ut as supportsLocalStorage,
|
|
740
|
+
lt as supportsLocation,
|
|
741
|
+
dt as supportsSessionStorage,
|
|
742
|
+
pt as supportsShadowRoot,
|
|
743
|
+
re as supportsWindow
|
|
1475
744
|
};
|
|
1476
|
-
function Bt(e) {
|
|
1477
|
-
return typeof e == "object" && !!e;
|
|
1478
|
-
}
|
|
1479
|
-
function Vt(e, t) {
|
|
1480
|
-
let n = t;
|
|
1481
|
-
for (let t of e.split(".")) if (Bt(n) && t in n) n = n[t];
|
|
1482
|
-
else return;
|
|
1483
|
-
return typeof n == "function" ? n() : n;
|
|
1484
|
-
}
|
|
1485
|
-
function Ht(e, t) {
|
|
1486
|
-
let n = e.split("|").map((e) => e.trim()), r = Vt(n.shift() ?? "", t);
|
|
1487
|
-
for (let e of n) {
|
|
1488
|
-
let [t, ...n] = e.split(":"), i = t?.trim() ?? "", a = n.join(":").trim().replaceAll(/(?:^['"]|['"]$)/g, ""), o = zt[i];
|
|
1489
|
-
o && (r = o(r, a));
|
|
1490
|
-
}
|
|
1491
|
-
return Z(r) ? "" : typeof r == "object" ? JSON.stringify(r) : String(r);
|
|
1492
|
-
}
|
|
1493
|
-
function Ut(e, t) {
|
|
1494
|
-
let n = "", r = 0;
|
|
1495
|
-
for (; r < e.length;) if (e[r] === "{" && e[r + 1] === "{") {
|
|
1496
|
-
r += 2;
|
|
1497
|
-
let i = "";
|
|
1498
|
-
for (; r < e.length;) {
|
|
1499
|
-
if (e[r] === "}" && e[r + 1] === "}") {
|
|
1500
|
-
r += 2;
|
|
1501
|
-
break;
|
|
1502
|
-
}
|
|
1503
|
-
i += e[r++];
|
|
1504
|
-
}
|
|
1505
|
-
n += Ht(i.trim(), t);
|
|
1506
|
-
} else n += e[r++];
|
|
1507
|
-
return n;
|
|
1508
|
-
}
|
|
1509
|
-
//#endregion
|
|
1510
|
-
//#region src/utils/preview-session.ts
|
|
1511
|
-
var Wt = "preview-token";
|
|
1512
|
-
function Gt() {
|
|
1513
|
-
return !s() || !g() ? !1 : !!wt()[Wt]?.[0];
|
|
1514
|
-
}
|
|
1515
|
-
//#endregion
|
|
1516
|
-
//#region src/picked.ts
|
|
1517
|
-
var Kt = class {
|
|
1518
|
-
static logger = r;
|
|
1519
|
-
options;
|
|
1520
|
-
dataSource = null;
|
|
1521
|
-
seededVersionId = null;
|
|
1522
|
-
versionSkew = null;
|
|
1523
|
-
contentLoader;
|
|
1524
|
-
previewEmbedderOrigins = null;
|
|
1525
|
-
plugins = {};
|
|
1526
|
-
telemetry = kt();
|
|
1527
|
-
dataProviders = /* @__PURE__ */ new Map();
|
|
1528
|
-
eventBus = F();
|
|
1529
|
-
events;
|
|
1530
|
-
projectId;
|
|
1531
|
-
apiUrl;
|
|
1532
|
-
dashboardUrl;
|
|
1533
|
-
documentationSiteUrl;
|
|
1534
|
-
session = Pt();
|
|
1535
|
-
performance = Ot();
|
|
1536
|
-
searchParams = wt();
|
|
1537
|
-
history = Ge();
|
|
1538
|
-
components = xe({ client: this });
|
|
1539
|
-
experienceInstances = C({ client: this });
|
|
1540
|
-
experiences = pe({ client: this });
|
|
1541
|
-
frameworks = Te({ client: this });
|
|
1542
|
-
predicates = Ve({ client: this });
|
|
1543
|
-
features = ne({ client: this });
|
|
1544
|
-
conditions = St();
|
|
1545
|
-
fields = Ze();
|
|
1546
|
-
responses = yt({ client: this });
|
|
1547
|
-
steps = et();
|
|
1548
|
-
contents = it();
|
|
1549
|
-
actions = ct({ client: this });
|
|
1550
|
-
conditionResults = w();
|
|
1551
|
-
stateSnapshotStore = Oe({ client: this });
|
|
1552
|
-
evaluateRuleLogicFx = Ie({ client: this });
|
|
1553
|
-
start;
|
|
1554
|
-
readyStore;
|
|
1555
|
-
preconditionPassedStore;
|
|
1556
|
-
conditionPassedStore;
|
|
1557
|
-
lifecycleStageStore;
|
|
1558
|
-
lifecycle = Re({ client: this });
|
|
1559
|
-
renderStringFx = A({
|
|
1560
|
-
source: this.responses.listStore,
|
|
1561
|
-
effect: (e, { template: t, context: n }) => {
|
|
1562
|
-
let r = {};
|
|
1563
|
-
for (let t of e) r[t.fieldKey] = t.value;
|
|
1564
|
-
return Ut(t, {
|
|
1565
|
-
...n,
|
|
1566
|
-
responses: r
|
|
1567
|
-
});
|
|
1568
|
-
}
|
|
1569
|
-
});
|
|
1570
|
-
constructor(e) {
|
|
1571
|
-
this.events = qe(this.eventBus), this.projectId = Rt(e), this.options = Object.freeze(e), this.apiUrl = e.apiUrl || Ct(), this.dashboardUrl = e.dashboardUrl ?? "https://dashboard.picked.app", this.documentationSiteUrl = e.documentationSiteUrl ?? "https://docs.picked.app", this.start = this.lifecycle.start, this.readyStore = this.lifecycle.readyStore, this.preconditionPassedStore = this.lifecycle.preconditionPassedStore, this.conditionPassedStore = this.lifecycle.conditionPassedStore, this.lifecycleStageStore = this.lifecycle.lifecycleStageStore, this.setupPlugins(), this.setupFeatures(), this.setupPredicates(), this.setupActions(), this.setupFields(), this.setupComponents(), this.lifecycle.setPrecondition(e.precondition), this.lifecycle.setCondition(e.condition), this.eventBus({
|
|
1572
|
-
type: "load",
|
|
1573
|
-
version: ie()
|
|
1574
|
-
}), this.maybeStartPreviewChannel();
|
|
1575
|
-
}
|
|
1576
|
-
dataProviderFor(e) {
|
|
1577
|
-
let t = e ?? "", n = this.dataProviders.get(t);
|
|
1578
|
-
if (n) return n;
|
|
1579
|
-
let r = import("../provider-ovM-CBX_.js").then((t) => t.createPickedDataProvider({
|
|
1580
|
-
apiUrl: this.apiUrl,
|
|
1581
|
-
projectId: this.projectId,
|
|
1582
|
-
getRequestObserver: () => this.telemetry.deliveryAPIRequestObserver,
|
|
1583
|
-
...e !== void 0 && { previewToken: e }
|
|
1584
|
-
}));
|
|
1585
|
-
return this.dataProviders.set(t, r), r;
|
|
1586
|
-
}
|
|
1587
|
-
async getProjectConfig(e) {
|
|
1588
|
-
let t = await this.dataProviderFor(e?.previewToken), n = await t.getProjectConfig();
|
|
1589
|
-
if (this.dataSource = t.meta.manifest, n === null) throw Error(`Picked could not resolve the configuration for project "${this.projectId}" from ${this.apiUrl}.`);
|
|
1590
|
-
return n;
|
|
1591
|
-
}
|
|
1592
|
-
async getExperienceContent(e, t) {
|
|
1593
|
-
return (await this.dataProviderFor(t?.previewToken)).getContent(e, t?.signal === void 0 ? void 0 : { signal: t.signal });
|
|
1594
|
-
}
|
|
1595
|
-
maybeStartPreviewChannel() {
|
|
1596
|
-
Gt() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1597
|
-
}
|
|
1598
|
-
registerFramework = (e) => {
|
|
1599
|
-
Ee(e, this.frameworks);
|
|
1600
|
-
};
|
|
1601
|
-
registerComponent = (e, t) => {
|
|
1602
|
-
Se(e, t, this.components);
|
|
1603
|
-
};
|
|
1604
|
-
registerPlugin = (e) => {
|
|
1605
|
-
ge(this, e, this.plugins);
|
|
1606
|
-
let t = this.plugins[e.name];
|
|
1607
|
-
t?.onStart && this.lifecycle.registerPluginStartHook(t.onStart);
|
|
1608
|
-
};
|
|
1609
|
-
registerFeature = (e, t) => {
|
|
1610
|
-
te(e, t, this.features);
|
|
1611
|
-
};
|
|
1612
|
-
registerPredicate = (e, t) => {
|
|
1613
|
-
He(e, t, this.predicates);
|
|
1614
|
-
};
|
|
1615
|
-
registerCondition = (e) => {
|
|
1616
|
-
this.conditions.register(e);
|
|
1617
|
-
};
|
|
1618
|
-
registerField = (e) => {
|
|
1619
|
-
this.fields.register(e);
|
|
1620
|
-
};
|
|
1621
|
-
registerStep = (e) => {
|
|
1622
|
-
tt(e, this.steps);
|
|
1623
|
-
};
|
|
1624
|
-
registerContent = (e) => {
|
|
1625
|
-
at(e, this.contents);
|
|
1626
|
-
};
|
|
1627
|
-
patchContent = (e, t) => {
|
|
1628
|
-
this.contents.patch(e, t);
|
|
1629
|
-
};
|
|
1630
|
-
registerAction = (e, t) => {
|
|
1631
|
-
lt(e, t, this.actions);
|
|
1632
|
-
};
|
|
1633
|
-
registerExperience = (e) => {
|
|
1634
|
-
e.component && Se(`experience:${e.id}`, e.component, this.components), this.experiences.register(e);
|
|
1635
|
-
};
|
|
1636
|
-
launchExperienceById = async (e, t) => {
|
|
1637
|
-
this.experiences.launch({
|
|
1638
|
-
id: e,
|
|
1639
|
-
options: t
|
|
1640
|
-
});
|
|
1641
|
-
};
|
|
1642
|
-
launchExperienceByKey = async (e, t) => {
|
|
1643
|
-
this.experiences.launch({
|
|
1644
|
-
key: e,
|
|
1645
|
-
options: t
|
|
1646
|
-
});
|
|
1647
|
-
};
|
|
1648
|
-
openExperienceById = async (e) => {
|
|
1649
|
-
this.experiences.open({ id: e });
|
|
1650
|
-
};
|
|
1651
|
-
openExperienceByKey = async (e) => {
|
|
1652
|
-
this.experiences.open({ key: e });
|
|
1653
|
-
};
|
|
1654
|
-
setupPlugins() {
|
|
1655
|
-
this.options.plugins?.forEach((e) => {
|
|
1656
|
-
if (Array.isArray(e)) {
|
|
1657
|
-
e.forEach((e) => {
|
|
1658
|
-
this.registerPlugin(e);
|
|
1659
|
-
});
|
|
1660
|
-
return;
|
|
1661
|
-
}
|
|
1662
|
-
let t = typeof e == "function" ? e() : e;
|
|
1663
|
-
if (Array.isArray(t)) {
|
|
1664
|
-
t.forEach((e) => this.registerPlugin(e));
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1667
|
-
this.registerPlugin(t);
|
|
1668
|
-
});
|
|
1669
|
-
}
|
|
1670
|
-
setupFeatures() {
|
|
1671
|
-
let e = this.options.features;
|
|
1672
|
-
e && Object.entries(e).forEach(([e, t]) => {
|
|
1673
|
-
let n = typeof t == "function" ? t() : t;
|
|
1674
|
-
this.registerFeature(e, n);
|
|
1675
|
-
}), this.searchParams.feature && this.searchParams.feature.forEach((e) => {
|
|
1676
|
-
try {
|
|
1677
|
-
let t = re(e);
|
|
1678
|
-
if (!t) return;
|
|
1679
|
-
let { id: n, bucket: r } = t;
|
|
1680
|
-
this.registerFeature(n, {
|
|
1681
|
-
key: `${r}`,
|
|
1682
|
-
name: n,
|
|
1683
|
-
enabled: !0,
|
|
1684
|
-
decide: () => r,
|
|
1685
|
-
storage: "session"
|
|
1686
|
-
});
|
|
1687
|
-
} catch {}
|
|
1688
|
-
});
|
|
1689
|
-
}
|
|
1690
|
-
setupPredicates() {
|
|
1691
|
-
let e = this.options.predicates;
|
|
1692
|
-
e && Object.entries(e).forEach(([e, t]) => {
|
|
1693
|
-
if (typeof t != "function") {
|
|
1694
|
-
`${e}`;
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
|
-
this.registerPredicate(e, t);
|
|
1698
|
-
});
|
|
1699
|
-
}
|
|
1700
|
-
setupActions() {
|
|
1701
|
-
let e = this.options.actions;
|
|
1702
|
-
e && Object.entries(e).forEach(([e, t]) => {
|
|
1703
|
-
if (typeof t != "function") {
|
|
1704
|
-
`${e}`;
|
|
1705
|
-
return;
|
|
1706
|
-
}
|
|
1707
|
-
this.registerAction(e, t);
|
|
1708
|
-
});
|
|
1709
|
-
}
|
|
1710
|
-
setupFields() {
|
|
1711
|
-
let e = this.options.fields;
|
|
1712
|
-
e && Object.entries(e).forEach(([e, t]) => {
|
|
1713
|
-
let n = typeof t == "function" ? t() : t;
|
|
1714
|
-
this.registerField({
|
|
1715
|
-
...n,
|
|
1716
|
-
key: n.key ?? e
|
|
1717
|
-
});
|
|
1718
|
-
});
|
|
1719
|
-
}
|
|
1720
|
-
setupComponents() {
|
|
1721
|
-
let e = this.options.components;
|
|
1722
|
-
e && Object.entries(e).forEach(([e, t]) => {
|
|
1723
|
-
this.registerComponent(e, t);
|
|
1724
|
-
});
|
|
1725
|
-
}
|
|
1726
|
-
getPluginConfig = (e) => this.plugins[e] ?? {};
|
|
1727
|
-
}, qt = "application/picked-javascript", Jt = "application/picked-module", Yt = "data-picked-hydrated";
|
|
1728
|
-
async function Xt(e) {
|
|
1729
|
-
if (!("document" in globalThis)) return;
|
|
1730
|
-
let t = "application/picked-module", n = "data-picked-hydrated";
|
|
1731
|
-
function r(e) {
|
|
1732
|
-
try {
|
|
1733
|
-
Function(e.textContent);
|
|
1734
|
-
} catch (t) {
|
|
1735
|
-
return t instanceof SyntaxError && (console.error("[picked] Skipped a rehydrated inline script that failed to parse.", t), e.setAttribute(n, ""), !0);
|
|
1736
|
-
}
|
|
1737
|
-
return !1;
|
|
1738
|
-
}
|
|
1739
|
-
function i(e, t) {
|
|
1740
|
-
let r = document.createElement("script");
|
|
1741
|
-
for (let t of Array.from(e.attributes)) t.name !== "type" && r.setAttribute(t.name, t.value);
|
|
1742
|
-
t && r.setAttribute("type", t), r.setAttribute(n, ""), e.src ? r.async = !1 : r.textContent = e.textContent;
|
|
1743
|
-
let i = e.src ? new Promise((e) => {
|
|
1744
|
-
r.addEventListener("load", () => e(), { once: !0 }), r.addEventListener("error", () => e(), { once: !0 });
|
|
1745
|
-
}) : null;
|
|
1746
|
-
return e.src ? e.replaceWith(r) : (globalThis.__pickedEmbedScriptRoot = e.getRootNode(), e.replaceWith(r), globalThis.__pickedEmbedScriptRoot = null), i;
|
|
1747
|
-
}
|
|
1748
|
-
let a = Array.from(e.querySelectorAll(`script[type="application/picked-javascript"]:not([${n}]), script[type="${t}"]:not([${n}])`)).filter((e) => e instanceof HTMLScriptElement);
|
|
1749
|
-
for (let e of a) {
|
|
1750
|
-
if (!e.isConnected) continue;
|
|
1751
|
-
let n = e.getAttribute("type") === t ? "module" : null;
|
|
1752
|
-
if (!e.src && n === null && r(e)) continue;
|
|
1753
|
-
let a = i(e, n);
|
|
1754
|
-
a && await a;
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
function Zt() {
|
|
1758
|
-
return `<script>(${Xt.toString()})(document)<\/script>`;
|
|
1759
|
-
}
|
|
1760
|
-
//#endregion
|
|
1761
|
-
//#region src/utils/html-asset-value.ts
|
|
1762
|
-
function Qt(e) {
|
|
1763
|
-
return typeof e == "object" && !!e && "id" in e && typeof e.id == "string" && "content" in e && (typeof e.content == "string" || e.content === null);
|
|
1764
|
-
}
|
|
1765
|
-
//#endregion
|
|
1766
|
-
//#region src/entities/component/lazyComponent.ts
|
|
1767
|
-
function $t(e) {
|
|
1768
|
-
return {
|
|
1769
|
-
$$type: "lazy-component",
|
|
1770
|
-
load: e
|
|
1771
|
-
};
|
|
1772
|
-
}
|
|
1773
|
-
function en(e) {
|
|
1774
|
-
return typeof e == "object" && !!e && "$$type" in e && e.$$type === "lazy-component";
|
|
1775
|
-
}
|
|
1776
|
-
//#endregion
|
|
1777
|
-
//#region src/entities/content/reference.ts
|
|
1778
|
-
function Q(e) {
|
|
1779
|
-
return typeof e == "object" && !!e && !Array.isArray(e) && "contentEntryId" in e && typeof e.contentEntryId == "string";
|
|
1780
|
-
}
|
|
1781
|
-
function $(e) {
|
|
1782
|
-
return Q(e) ? e.contentEntryId : null;
|
|
1783
|
-
}
|
|
1784
|
-
function tn(e) {
|
|
1785
|
-
let t = Array.isArray(e) ? e : [e], n = [];
|
|
1786
|
-
for (let e of t) Q(e) && n.push(e.contentEntryId);
|
|
1787
|
-
return n;
|
|
1788
|
-
}
|
|
1789
|
-
function nn(e, t) {
|
|
1790
|
-
return t === null ? null : e[t] ?? null;
|
|
1791
|
-
}
|
|
1792
|
-
function rn(e, t) {
|
|
1793
|
-
let n = [];
|
|
1794
|
-
for (let r of t) {
|
|
1795
|
-
let t = e[r];
|
|
1796
|
-
t !== void 0 && n.push(t);
|
|
1797
|
-
}
|
|
1798
|
-
return n;
|
|
1799
|
-
}
|
|
1800
|
-
function an(e, t) {
|
|
1801
|
-
if (le.store(t)) return j(t, e.indexStore, (e, t) => nn(t, $(e)));
|
|
1802
|
-
let n = $(t);
|
|
1803
|
-
return e.indexStore.map((e) => nn(e, n), { skipVoid: !1 });
|
|
1804
|
-
}
|
|
1805
|
-
function on(e, t) {
|
|
1806
|
-
if (le.store(t)) return j(t, e.indexStore, (e, t) => rn(t, tn(e)));
|
|
1807
|
-
let n = tn(t);
|
|
1808
|
-
return e.indexStore.map((e) => rn(e, n), { skipVoid: !1 });
|
|
1809
|
-
}
|
|
1810
|
-
//#endregion
|
|
1811
|
-
//#region src/exports.ts
|
|
1812
|
-
var sn = (e) => {
|
|
1813
|
-
let t = new Kt(e);
|
|
1814
|
-
return u(t), t;
|
|
1815
|
-
};
|
|
1816
|
-
//#endregion
|
|
1817
|
-
//#region src/typed-content.ts
|
|
1818
|
-
function cn(e) {
|
|
1819
|
-
return typeof e.data == "object";
|
|
1820
|
-
}
|
|
1821
|
-
function ln(e) {
|
|
1822
|
-
return e.map((e) => !e || !cn(e) ? null : e, { skipVoid: !1 });
|
|
1823
|
-
}
|
|
1824
|
-
//#endregion
|
|
1825
|
-
export { Yt as PICKED_HYDRATED_ATTR, Jt as PICKED_MODULE_SCRIPT_TYPE, qt as PICKED_SCRIPT_TYPE, Wt as PREVIEW_TOKEN_PARAM, Kt as Picked, Zt as buildRehydrateBootstrap, sn as createClient, he as createPluginEffect, k as createStorageKey, an as deriveReference, on as deriveReferences, n as evaluateRuleLogic, Ft as getPickedConfig, Q as isContentReference, Qt as isHtmlAssetValue, g as isInsideIframe, en as isLazyLoader, v as isPickedRoot, Gt as isPreviewSession, $t as lazyComponent, D as localStore, ce as onInertScriptSubtrees, $ as readReferenceId, tn as readReferenceIds, Xt as rehydrateScripts, oe as reportInertScriptSubtrees, se as resetInertScriptReport, O as sessionStore, E as subscribe, d as supportsCookies, m as supportsCryptoRandomUUID, c as supportsDocument, i as supportsHistory, f as supportsIntersectionObserver, h as supportsLocalStorage, a as supportsLocation, l as supportsSessionStorage, _ as supportsShadowRoot, o as supportsWebComponents, s as supportsWindow, ln as toTypedContentStore };
|