@picked/client 0.0.70-next.6 → 0.0.71-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/dist/.tsbuildinfo +1 -0
- package/dist/api-CH2FNa6S.cjs +1 -0
- package/dist/api-CgqRvuKL.js +38 -0
- package/dist/cjs/form/index.js +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/plugins/dom-observer/index.js +1 -1
- package/dist/cjs/plugins/dynamic-experiences/index.js +1 -1
- package/dist/cjs/server/index.js +1 -1
- package/dist/docs/actions.mdx +38 -18
- package/dist/docs/api/authentication.md +75 -48
- package/dist/docs/api/authorization-and-scopes.md +63 -47
- package/dist/docs/api/error-handling.md +70 -54
- package/dist/docs/api/index.md +41 -22
- package/dist/docs/api/pagination.md +30 -20
- package/dist/docs/api-keys.mdx +11 -6
- package/dist/docs/chrome-extension.md +22 -5
- package/dist/docs/conditions.mdx +32 -19
- package/dist/docs/content/asset-library.mdx +65 -34
- package/dist/docs/content/content-entries.mdx +8 -2
- package/dist/docs/content/layouts.mdx +45 -29
- package/dist/docs/content/pages.mdx +29 -14
- package/dist/docs/content/sections.mdx +19 -8
- package/dist/docs/delivery-api/experience-content.md +10 -5
- package/dist/docs/delivery-api/index.md +19 -12
- package/dist/docs/delivery-api/preview-caching-crawling.md +27 -14
- package/dist/docs/delivery-api/project-config.md +6 -4
- package/dist/docs/experiences.mdx +26 -10
- package/dist/docs/features.mdx +66 -25
- package/dist/docs/fields.mdx +42 -27
- package/dist/docs/flow-builder/building-flows.md +38 -20
- package/dist/docs/flow-builder/condition-builder.md +32 -21
- package/dist/docs/flow-builder/keyboard-shortcuts.md +18 -18
- package/dist/docs/flow-builder/nodes.md +26 -13
- package/dist/docs/flow-builder/overview.mdx +28 -15
- package/dist/docs/gtm-template.md +35 -26
- package/dist/docs/guides/build-a-personalized-page.mdx +36 -18
- package/dist/docs/image-optimisation-service.md +33 -17
- package/dist/docs/index.md +28 -17
- package/dist/docs/mcp.md +46 -38
- package/dist/docs/pickedql/data-sources.md +65 -43
- package/dist/docs/pickedql/dimensions.md +27 -12
- package/dist/docs/pickedql/examples.md +38 -26
- package/dist/docs/pickedql/filtering.md +10 -6
- package/dist/docs/pickedql/index.md +32 -14
- package/dist/docs/pickedql/schema.md +85 -76
- package/dist/docs/pickedql/virtual-functions.md +62 -36
- package/dist/docs/projects.mdx +14 -7
- package/dist/docs/reports.mdx +5 -3
- package/dist/docs/sdk/actions.md +33 -17
- package/dist/docs/sdk/conditions.md +8 -5
- package/dist/docs/sdk/content-security-policy.md +5 -4
- package/dist/docs/sdk/experiences.md +29 -11
- package/dist/docs/sdk/feature-allocation.md +79 -47
- package/dist/docs/sdk/features.md +130 -76
- package/dist/docs/sdk/fields.md +66 -42
- package/dist/docs/sdk/index.md +22 -13
- package/dist/docs/sdk/plugins/create-experience.md +18 -15
- package/dist/docs/sdk/plugins/dynamic-experiences.md +42 -16
- package/dist/docs/sdk/predicates.md +53 -37
- package/dist/docs/sdk/ssr/index.md +25 -8
- package/dist/docs/sdk/ssr/rendering-and-hydration.md +37 -16
- package/dist/docs/sdk/ssr/serialize.md +38 -20
- package/dist/docs/sdk/ssr/slots-and-placements.md +28 -10
- package/dist/docs/sdk/steps.md +100 -55
- package/dist/docs/steps.mdx +20 -11
- package/dist/docs/team-management.md +17 -11
- package/dist/docs/vite-plugin.md +26 -19
- package/dist/docs/workspace-versioning.mdx +14 -8
- package/dist/docs/workspaces.mdx +55 -24
- package/dist/{dom-BwmTHeT7.js → dom-BqcToNL0.js} +1 -3
- package/dist/{dom-CDrHc_j9.cjs → dom-DlLH3FxV.cjs} +1 -1
- package/dist/esm/form/index.js +2 -4
- package/dist/esm/index.js +50 -45
- package/dist/esm/plugins/dom-observer/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/preview/index.js +1 -1
- package/dist/esm/server/index.js +12 -10
- package/dist/{experience-instance-DOJShRk5.js → experience-instance-DGk11d8a.js} +3 -3
- package/dist/experience-instance-Dej3P1sE.cjs +1 -0
- package/dist/{plugin-BxMR7fOV.js → plugin-D2UqFikQ.js} +2 -2
- package/dist/plugin-DCW-tnjO.cjs +1 -0
- package/dist/{preview-channel-DW9J8t4B.js → preview-channel-CSr96XAo.js} +1 -1
- package/dist/{protocol-DSqOlW2r.js → protocol-C5KkkiZc.js} +1 -1
- package/dist/types/client.d.ts +7 -6
- package/dist/types/entities/action/action.d.ts +5 -4
- package/dist/types/entities/action/action.d.ts.map +1 -1
- package/dist/types/entities/component/component.d.ts +6 -5
- package/dist/types/entities/component/component.d.ts.map +1 -1
- package/dist/types/entities/condition/condition.d.ts +5 -5
- package/dist/types/entities/content/content.d.ts +4 -3
- package/dist/types/entities/experience/experience.d.ts +11 -10
- package/dist/types/entities/experience/experience.d.ts.map +1 -1
- package/dist/types/entities/experience-instance/experience-instance.d.ts +10 -9
- package/dist/types/entities/feature/feature.d.ts +3 -2
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/entities/field/field.d.ts +7 -6
- package/dist/types/entities/framework/framework.d.ts +7 -6
- 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/plugin/plugin.d.ts +3 -2
- package/dist/types/entities/plugin/plugin.d.ts.map +1 -1
- package/dist/types/entities/predicate/predicate.d.ts +4 -3
- package/dist/types/entities/predicate/predicate.d.ts.map +1 -1
- package/dist/types/entities/response/response-validation.d.ts +3 -2
- package/dist/types/entities/response/response.d.ts +12 -11
- package/dist/types/entities/session/session.d.ts +2 -1
- package/dist/types/entities/step/step.d.ts +6 -5
- package/dist/types/exports.d.ts +2 -1
- package/dist/types/exports.d.ts.map +1 -1
- package/dist/types/form/build-responses.d.ts +2 -1
- package/dist/types/form/create-field-evaluator.d.ts +4 -3
- package/dist/types/form/create-field-validation.d.ts +5 -4
- package/dist/types/form/create-form.d.ts +7 -6
- package/dist/types/form/create-submit-pipeline.d.ts +7 -6
- package/dist/types/form/get-step-fields.d.ts +3 -2
- package/dist/types/lifecycle/condition-selection.d.ts +14 -4
- package/dist/types/lifecycle/lifecycle.d.ts +4 -3
- package/dist/types/lifecycle/rules-logic.d.ts +4 -3
- package/dist/types/lifecycle/state-snapshot.d.ts +4 -3
- package/dist/types/picked.d.ts +64 -62
- package/dist/types/picked.d.ts.map +1 -1
- package/dist/types/ping.d.ts +1 -1
- package/dist/types/ping.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/create-experience.d.ts +9 -8
- package/dist/types/plugins/create-experience/create-experience.d.ts.map +1 -1
- package/dist/types/plugins/create-experience/plugin.d.ts +3 -2
- 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/dom-observer/plugin.d.ts +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts +3 -3
- package/dist/types/plugins/dynamic-experiences/types.d.ts +8 -5
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/experience-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/history-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts +1 -1
- package/dist/types/plugins/responses-browser-storage/plugin.d.ts.map +1 -1
- package/dist/types/plugins/responses-indexeddb/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts +1 -1
- package/dist/types/plugins/single-page-app/plugin.d.ts.map +1 -1
- package/dist/types/plugins/web-components/plugin.d.ts +2 -1
- package/dist/types/plugins/window-object/plugin.d.ts +2 -2
- package/dist/types/preview-channel.d.ts +5 -1
- package/dist/types/preview-receiver/index.d.ts +18 -1
- package/dist/types/preview-receiver/protocol.d.ts +10 -1
- package/dist/types/server/index.d.ts +3 -3
- package/dist/types/server/serialize.d.ts +2 -2
- package/dist/types/utils/dom.d.ts +2 -1
- package/dist/types/utils/events.d.ts +6 -6
- package/dist/types/utils/events.d.ts.map +1 -1
- package/dist/types/utils/global-obj.d.ts +1 -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/logger.d.ts +2 -1
- package/dist/types/utils/logger.d.ts.map +1 -1
- package/dist/types/utils/node-tree/get-next-node-from-action.d.ts +2 -1
- package/dist/types/utils/node-tree/get-next-node-from-condition.d.ts +2 -1
- 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 +1 -1
- package/dist/types/utils/picked-config.d.ts +2 -1
- package/dist/types/utils/rules-logic.d.ts +6 -2
- package/dist/types/utils/storage.d.ts +1 -1
- package/dist/types/utils/storage.d.ts.map +1 -1
- package/package.json +22 -23
- package/dist/api-CoUkIxIr.cjs +0 -1
- package/dist/api-ahdSBQ3Y.js +0 -40
- package/dist/experience-instance-DurC3pE-.cjs +0 -1
- package/dist/plugin-CASdGtTX.cjs +0 -1
package/dist/docs/vite-plugin.md
CHANGED
|
@@ -4,7 +4,11 @@ layout: docs
|
|
|
4
4
|
|
|
5
5
|
# Vite Plugin
|
|
6
6
|
|
|
7
|
-
`@picked/vite-plugin-picked`
|
|
7
|
+
`@picked/vite-plugin-picked` adds Picked to your Vite project. It reads the options
|
|
8
|
+
of your project at build time. It then injects them through the Vite `define`
|
|
9
|
+
option, so the SDK makes no API request at runtime. In development it also serves a
|
|
10
|
+
launcher page. On that page you can see a preview of an experience with your own
|
|
11
|
+
feature flag values.
|
|
8
12
|
|
|
9
13
|
## Installation
|
|
10
14
|
|
|
@@ -41,27 +45,28 @@ export default defineConfig({
|
|
|
41
45
|
})
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
## How
|
|
48
|
+
## How it works
|
|
45
49
|
|
|
46
|
-
### Build-
|
|
50
|
+
### Build-time config injection
|
|
47
51
|
|
|
48
|
-
When Vite starts
|
|
52
|
+
When Vite starts, in both `dev` and `build`, the plugin does this:
|
|
49
53
|
|
|
50
|
-
1.
|
|
51
|
-
2.
|
|
52
|
-
3. The SDK reads the embedded
|
|
54
|
+
1. It reads the options of your project from the Picked API.
|
|
55
|
+
2. It embeds those options in your bundle.
|
|
56
|
+
3. The SDK reads the embedded options at runtime and makes no network request.
|
|
53
57
|
|
|
54
|
-
When a preview token is
|
|
58
|
+
When a preview token is there at runtime, the SDK ignores the embedded options and
|
|
59
|
+
reads fresh data from the API.
|
|
55
60
|
|
|
56
|
-
### Dev
|
|
61
|
+
### Dev launcher
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
In development, the plugin serves an HTML page at `/`. On that page you can:
|
|
59
64
|
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
65
|
+
- see every feature flag in your project with its current state;
|
|
66
|
+
- turn a feature flag on or off for a local test;
|
|
67
|
+
- see a preview of an experience with your own feature flag values.
|
|
63
68
|
|
|
64
|
-
After the dev server starts, the launcher URL appears
|
|
69
|
+
After the dev server starts, the launcher URL appears next to the Vite output:
|
|
65
70
|
|
|
66
71
|
```
|
|
67
72
|
➜ Picked: http://localhost:5173/
|
|
@@ -73,10 +78,12 @@ After the dev server starts, the launcher URL appears alongside Vite's native ou
|
|
|
73
78
|
|
|
74
79
|
| Option | Type | Default | Description |
|
|
75
80
|
| ---------------- | --------- | ---------------------------- | -------------------------------------------------------- |
|
|
76
|
-
| `projectId` | `string` | — | **Required.**
|
|
77
|
-
| `apiUrl` | `string` | `https://api.picked.app` |
|
|
78
|
-
| `disableLauncher`| `boolean` | `false` |
|
|
81
|
+
| `projectId` | `string` | — | **Required.** The ID of your Picked project. |
|
|
82
|
+
| `apiUrl` | `string` | `https://api.picked.app` | Your own API URL, for a self-hosted or local API. |
|
|
83
|
+
| `disableLauncher`| `boolean` | `false` | Turns the launcher page off in both dev and build output.|
|
|
79
84
|
|
|
80
|
-
## Build
|
|
85
|
+
## Build output
|
|
81
86
|
|
|
82
|
-
|
|
87
|
+
For a production build, `vite build`, the plugin writes an `index.html` file that
|
|
88
|
+
holds the launcher page. Set `disableLauncher` to stop this. The file lets you deploy
|
|
89
|
+
the launcher next to your application, so that a stakeholder can see a preview.
|
|
@@ -6,23 +6,29 @@ import { Screenshot } from '../../components/Screenshot'
|
|
|
6
6
|
|
|
7
7
|
# Workspace versioning
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
When you publish, Picked makes an immutable snapshot of your workspace. A project
|
|
10
|
+
always serves exactly one version, the *live* version. A roll-back moves the live
|
|
11
|
+
pointer of the project to an earlier snapshot. It changes no data.
|
|
10
12
|
|
|
11
13
|
<Screenshot
|
|
12
14
|
route="/{orgSlug}/{projectId}/publish-history"
|
|
13
|
-
alt="The Publish history page
|
|
15
|
+
alt="The Publish history page with published workspace versions and the Live and Restore actions"
|
|
14
16
|
hide={['[data-testid="version-row-relative-time"]']}
|
|
15
17
|
/>
|
|
16
18
|
|
|
17
19
|
## Publish history
|
|
18
20
|
|
|
19
|
-
The **Publish history** page lists
|
|
21
|
+
The **Publish history** page lists each published version of every workspace in the
|
|
22
|
+
project, the newest first. The version that Picked serves now carries a **Live**
|
|
23
|
+
badge.
|
|
20
24
|
|
|
21
|
-
##
|
|
25
|
+
## Roll back to an earlier version
|
|
22
26
|
|
|
23
27
|
1. Open **Publish history** from the project sidebar.
|
|
24
|
-
2. Find the version you want to restore
|
|
25
|
-
3.
|
|
26
|
-
4.
|
|
28
|
+
2. Find the version that you want to restore.
|
|
29
|
+
3. Click **Restore**.
|
|
30
|
+
4. Read the diff preview. It shows what changes between the current live version and
|
|
31
|
+
the version that you chose.
|
|
32
|
+
5. Click **Restore this version** to confirm.
|
|
27
33
|
|
|
28
|
-
The restored version is immediately
|
|
34
|
+
The restored version is live immediately. Your current draft does not change.
|
package/dist/docs/workspaces.mdx
CHANGED
|
@@ -6,7 +6,8 @@ import { Screenshot } from '../../components/Screenshot'
|
|
|
6
6
|
|
|
7
7
|
# Workspaces
|
|
8
8
|
|
|
9
|
-
A workspace is
|
|
9
|
+
A workspace is one version of the options for your project. Use a workspace to hold
|
|
10
|
+
a change, to see a preview of it, and to publish it when it is ready.
|
|
10
11
|
|
|
11
12
|
<Screenshot
|
|
12
13
|
route="/{orgSlug}/{projectId}/workspaces"
|
|
@@ -16,42 +17,56 @@ A workspace is a version of your project's configuration. Use workspaces to stag
|
|
|
16
17
|
|
|
17
18
|
## How workspaces work
|
|
18
19
|
|
|
19
|
-
Each project has a workspace that holds your experiences, feature flags, and entity
|
|
20
|
+
Each project has a workspace that holds your experiences, feature flags, and entity
|
|
21
|
+
options. When you make a change in the dashboard, that change stays in the workspace
|
|
22
|
+
until you publish it. A change to a flow, to a feature flag, or to an entity all
|
|
23
|
+
behave the same way.
|
|
20
24
|
|
|
21
25
|
A workspace is in one of three states:
|
|
22
26
|
|
|
23
|
-
- **Live** — the workspace the SDK serves to visitors.
|
|
24
|
-
|
|
25
|
-
- **
|
|
27
|
+
- **Live** — the workspace that the SDK serves to your visitors. Each project has
|
|
28
|
+
exactly one live workspace.
|
|
29
|
+
- **Draft** — a workspace that no visitor sees. You can edit a draft, see a preview
|
|
30
|
+
of it, and publish it to make it live.
|
|
31
|
+
- **Archived** — a draft that you put to one side. An archived workspace is still
|
|
32
|
+
editable, but it does not appear in the default workspaces list.
|
|
26
33
|
|
|
27
34
|
## Preview
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
See a preview of your workspace to learn how a change looks before you publish it.
|
|
30
37
|
|
|
31
38
|
1. Click **Preview** in the workspace toolbar.
|
|
32
39
|
2. Enter the URL of your site.
|
|
33
|
-
3.
|
|
40
|
+
3. Set each feature flag to the **Default**, **On**, or **Off** value. This step is
|
|
41
|
+
optional.
|
|
34
42
|
4. Click **Open Preview**.
|
|
35
43
|
|
|
36
|
-
Your site opens in a new tab with the unpublished workspace applied.
|
|
44
|
+
Your site opens in a new tab with the unpublished workspace applied. The preview
|
|
45
|
+
sends the workspace state to the SDK in the query parameters, so the visitors on
|
|
46
|
+
your live site see no change.
|
|
37
47
|
|
|
38
48
|
## Publish
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
When you publish, Picked makes an immutable snapshot of your workspace. The SDK then
|
|
51
|
+
serves the new options to your visitors.
|
|
41
52
|
|
|
42
53
|
1. Click **Publish** in the workspace toolbar.
|
|
43
|
-
2.
|
|
54
|
+
2. Read the change preview in the publish modal.
|
|
44
55
|
3. Click **Publish** to confirm.
|
|
45
56
|
|
|
46
|
-
The publish button is only
|
|
57
|
+
The publish button is active only when the workspace has an unpublished change. A
|
|
58
|
+
status badge in the toolbar shows whether the workspace has an unpublished change or
|
|
59
|
+
is up to date.
|
|
47
60
|
|
|
48
61
|
## Change previews
|
|
49
62
|
|
|
50
|
-
The publish modal shows a side-by-side change preview
|
|
63
|
+
The publish modal shows a side-by-side change preview. It compares the current
|
|
64
|
+
workspace against the last published snapshot. Use it to see exactly what your
|
|
65
|
+
visitors get after you publish.
|
|
51
66
|
|
|
52
67
|
<Screenshot
|
|
53
68
|
route="/{orgSlug}/{projectId}/workspaces/{workspaceId}/experiences?action=publish"
|
|
54
|
-
alt="The publish modal
|
|
69
|
+
alt="The publish modal with a change preview of added experiences, steps, and conditions"
|
|
55
70
|
selector='[role="dialog"]'
|
|
56
71
|
wait='[role="dialog"]'
|
|
57
72
|
hide={['[data-testid="publish-diff-replaces-version"]']}
|
|
@@ -59,44 +74,60 @@ The publish modal shows a side-by-side change preview comparing the current work
|
|
|
59
74
|
renderHeight={579}
|
|
60
75
|
/>
|
|
61
76
|
|
|
62
|
-
The preview
|
|
77
|
+
The preview puts the changes into groups by entity type: experiences, feature flags,
|
|
78
|
+
steps, fields, actions, and conditions. Each row shows whether the entity was
|
|
79
|
+
**added**, **removed**, or **modified**. For a modified entity, expand the row to see
|
|
80
|
+
which properties changed.
|
|
63
81
|
|
|
64
|
-
|
|
82
|
+
Some changes break other records. An example is a field that you remove while other
|
|
83
|
+
steps still point at it. The change preview shows a banner above the diff for these
|
|
84
|
+
entries, so that you can look at them again before you publish.
|
|
65
85
|
|
|
66
|
-
The first publish of a workspace has no
|
|
86
|
+
The first publish of a workspace has no earlier snapshot to compare against. The
|
|
87
|
+
publish modal shows the contents of the workspace as the first publish, with no diff.
|
|
67
88
|
|
|
68
89
|
## Unpublished changes
|
|
69
90
|
|
|
70
|
-
The workspace
|
|
91
|
+
The workspace records whether anything changed since the last publish. If you create
|
|
92
|
+
or update an experience, a feature flag, or an entity after the last publish, the
|
|
93
|
+
toolbar shows a warning badge.
|
|
71
94
|
|
|
72
95
|
## Workspace settings
|
|
73
96
|
|
|
74
|
-
The workspace settings page (**Settings** in the workspace
|
|
97
|
+
The workspace settings page (**Settings** in the workspace navigation) covers how to
|
|
98
|
+
rename, archive, and delete a workspace.
|
|
75
99
|
|
|
76
100
|
### Rename
|
|
77
101
|
|
|
78
|
-
Change the workspace name in the **Name** field and click **Save**.
|
|
102
|
+
Change the workspace name in the **Name** field and click **Save**. A name is unique
|
|
103
|
+
inside a project. The dashboard rejects a duplicate name with a validation error.
|
|
79
104
|
|
|
80
105
|
### Archive
|
|
81
106
|
|
|
82
|
-
|
|
107
|
+
To archive a draft workspace is to move it out of the default workspaces list, but
|
|
108
|
+
not to delete it. Use it for a draft that you want to put to one side and keep.
|
|
83
109
|
|
|
84
110
|
1. Open the workspace settings page.
|
|
85
111
|
2. Click **Archive** in the page header.
|
|
86
112
|
3. Confirm in the modal.
|
|
87
113
|
|
|
88
|
-
|
|
114
|
+
You cannot archive a live workspace directly. Make a different workspace live first,
|
|
115
|
+
then archive the earlier one.
|
|
89
116
|
|
|
90
117
|
### Unarchive
|
|
91
118
|
|
|
92
|
-
|
|
119
|
+
You can unarchive a workspace from the same page to make it a draft again. The
|
|
120
|
+
settings page finds the archived state and changes the toolbar button to
|
|
121
|
+
**Unarchive**.
|
|
93
122
|
|
|
94
123
|
### Delete
|
|
95
124
|
|
|
96
|
-
|
|
125
|
+
To delete a workspace is to remove it and its entities permanently. This action is
|
|
126
|
+
destructive and you cannot reverse it. Archive the workspace instead when you are not
|
|
127
|
+
certain.
|
|
97
128
|
|
|
98
129
|
1. Open the workspace settings page.
|
|
99
130
|
2. In the **Danger zone** card at the bottom, click **Delete**.
|
|
100
131
|
3. Confirm in the modal.
|
|
101
132
|
|
|
102
|
-
|
|
133
|
+
You cannot delete a live workspace. Publish or archive a different workspace first.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./supports-DBzjGaWD.cjs");function t(t){return!e.f()||!e.i()?[]:Array.from(window.document.querySelectorAll(t)).filter(e=>e instanceof HTMLElement)}var n=`open`;function r(t){if(!e.u())throw Error(`Shadow DOM is not supported in this environment`);return t.attachShadow({mode:n})}function i(){return new Promise((t,n)=>{if(!e.i()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>t(),{once:!0}):t()})}function a(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var o=`picked-root`,s=`picked-target`,c=`picked-root`;function l(e,n){return[...e,{selector:`${c}[experience-id="${n}"]`,placement:`replace`}].flatMap(e=>{let r=t(e.selector).filter(e=>!f(e,n)&&!p(e,n));return{...e,elements:r}})}function u(e,t,n){return e.flatMap(e=>e.elements.map(r=>h(r,e.placement,t,n)))}function d(e,t){e.classList.add(s),e.classList.add(`${s}-${t}`)}function f(e,t){return t?e.classList.contains(`${s}-${t}`):e.classList.contains(`${s}`)}function p(e,t){return t?e.classList.contains(`${o}-${t}`):e.classList.contains(o)}function m(e,t){let n=document.createElement(`div`);return n.style.display=`block`,n.classList.add(o),n.classList.add(`${o}-${e}`),n.classList.add(`${o}-${t}`),n}function h(e,t,n,r){let i,a=m(n,r);if(e instanceof Document)i=e.body.appendChild(a);else{switch(t){case`replace`:e.replaceWith(a);break;case`before`:e.before(a);break;case`after`:e.after(a);break;case`prepend`:e.prepend(a);break;case`append`:e.append(a)
|
|
1
|
+
const e=require("./supports-DBzjGaWD.cjs");function t(t){return!e.f()||!e.i()?[]:Array.from(window.document.querySelectorAll(t)).filter(e=>e instanceof HTMLElement)}var n=`open`;function r(t){if(!e.u())throw Error(`Shadow DOM is not supported in this environment`);return t.attachShadow({mode:n})}function i(){return new Promise((t,n)=>{if(!e.i()){n();return}document.readyState===`loading`?document.addEventListener(`readystatechange`,()=>t(),{once:!0}):t()})}function a(e,t){let n=new MutationObserver(r=>{document.contains(e)||(n.disconnect(),t())});n.observe(document.body,{childList:!0,subtree:!0})}var o=`picked-root`,s=`picked-target`,c=`picked-root`;function l(e,n){return[...e,{selector:`${c}[experience-id="${n}"]`,placement:`replace`}].flatMap(e=>{let r=t(e.selector).filter(e=>!f(e,n)&&!p(e,n));return{...e,elements:r}})}function u(e,t,n){return e.flatMap(e=>e.elements.map(r=>h(r,e.placement,t,n)))}function d(e,t){e.classList.add(s),e.classList.add(`${s}-${t}`)}function f(e,t){return t?e.classList.contains(`${s}-${t}`):e.classList.contains(`${s}`)}function p(e,t){return t?e.classList.contains(`${o}-${t}`):e.classList.contains(o)}function m(e,t){let n=document.createElement(`div`);return n.style.display=`block`,n.classList.add(o),n.classList.add(`${o}-${e}`),n.classList.add(`${o}-${t}`),n}function h(e,t,n,r){let i,a=m(n,r);if(e instanceof Document)i=e.body.appendChild(a);else{switch(t){case`replace`:e.replaceWith(a);break;case`before`:e.before(a);break;case`after`:e.after(a);break;case`prepend`:e.prepend(a);break;case`append`:e.append(a)}i=a}return i}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return u}});
|
package/dist/esm/form/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function c(e, t, n) {
|
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
if (Array.isArray(r) && Array.isArray(n) && n.length > 0) {
|
|
12
|
-
typeof r[0] == "string" ?
|
|
12
|
+
e[t] = typeof r[0] == "string" ? [...r, ...n].map(String) : typeof r[0] == "number" ? [...r, ...n].map(Number) : typeof r[0] == "boolean" ? [...r, ...n].map((e) => !!e) : n;
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
e[t] = n;
|
|
@@ -31,9 +31,7 @@ function l(e, t) {
|
|
|
31
31
|
case "number":
|
|
32
32
|
c(r, e.key, e.multiple ? [Number(t)] : Number(t));
|
|
33
33
|
break;
|
|
34
|
-
case "boolean":
|
|
35
|
-
c(r, e.key, e.multiple ? [t === "true"] : t === "true");
|
|
36
|
-
break;
|
|
34
|
+
case "boolean": c(r, e.key, e.multiple ? [t === "true"] : t === "true");
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
37
|
}), r;
|
package/dist/esm/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import { t as e } from "../object-BUDGxEqy.js";
|
|
|
2
2
|
import { n as t, t as n } from "../rules-logic-HesIUCu6.js";
|
|
3
3
|
import { t as r } from "../logger-DMN6TxJJ.js";
|
|
4
4
|
import { a as i, c as a, d as o, f as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g } from "../supports-CO9bJGNl.js";
|
|
5
|
-
import { a as _, i as v, r as ee, s as y, t as b } from "../dom-
|
|
6
|
-
import { l as x, n as S, r as C, u as w } from "../experience-instance-
|
|
5
|
+
import { a as _, i as v, r as ee, s as y, t as b } from "../dom-BqcToNL0.js";
|
|
6
|
+
import { l as x, n as S, r as C, u as w } from "../experience-instance-DGk11d8a.js";
|
|
7
7
|
import { i as T, n as E, r as D, t as O } from "../storage-1MW3-_As.js";
|
|
8
|
-
import { n as te, r as ne } from "../api-
|
|
8
|
+
import { n as te, r as ne } from "../api-CgqRvuKL.js";
|
|
9
9
|
import { t as re } from "../id-Bo4RBeOs.js";
|
|
10
10
|
import { n as ie, r as ae, t as oe } from "../inert-script-report-B_bMPRzp.js";
|
|
11
11
|
import { attach as k, combine as A, createApi as j, createDomain as M, createEffect as N, createEvent as P, createStore as F, sample as I } from "effector";
|
|
@@ -38,18 +38,18 @@ var z = M("experience"), se = L(({ client: e, experience: r }) => {
|
|
|
38
38
|
n ? e.experienceInstances.spawn(u, t, n) : e.experienceInstances.spawn(u, t);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
}), f =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
}), f = A({
|
|
42
|
+
preconditionPassed: e.preconditionPassedStore,
|
|
43
|
+
isUser: e.session.store.map((e) => e.isUser, { skipVoid: !1 }),
|
|
44
|
+
config: o
|
|
45
|
+
}), p = k({
|
|
46
|
+
source: f,
|
|
47
47
|
effect: async ({ preconditionPassed: i, isUser: a, config: o }) => {
|
|
48
48
|
if (!i || !a) return !1;
|
|
49
49
|
let { decisionLogic: s, targetSelectors: c } = o;
|
|
50
|
-
return c.length === 0 || v(c, r.id).length < 1 ? !1 : s === void 0
|
|
50
|
+
return c.length === 0 || v(c, r.id).length < 1 ? !1 : s === void 0 || !t(s) || await n(e, s) === !0;
|
|
51
51
|
}
|
|
52
|
-
}),
|
|
52
|
+
}), m = N(async () => {
|
|
53
53
|
if (!e.contentLoader) return !0;
|
|
54
54
|
try {
|
|
55
55
|
await e.contentLoader({
|
|
@@ -60,28 +60,28 @@ var z = M("experience"), se = L(({ client: e, experience: r }) => {
|
|
|
60
60
|
`${r.id}`;
|
|
61
61
|
}
|
|
62
62
|
return !0;
|
|
63
|
-
}),
|
|
63
|
+
}), h = P(), g = P(), _ = z.createStore(void 0, { skipVoid: !1 }).on(h, (e, t) => t).on(g, (e, t) => t);
|
|
64
64
|
return I({
|
|
65
|
-
clock:
|
|
66
|
-
target:
|
|
65
|
+
clock: h,
|
|
66
|
+
target: p
|
|
67
67
|
}), I({
|
|
68
|
-
clock:
|
|
69
|
-
source:
|
|
68
|
+
clock: p.doneData,
|
|
69
|
+
source: _,
|
|
70
70
|
filter: (e, t) => t,
|
|
71
71
|
fn: (e) => e,
|
|
72
72
|
target: d
|
|
73
73
|
}), I({
|
|
74
|
-
clock:
|
|
74
|
+
clock: p.doneData,
|
|
75
75
|
filter: Boolean,
|
|
76
|
-
target:
|
|
76
|
+
target: m
|
|
77
77
|
}), I({
|
|
78
|
-
clock:
|
|
79
|
-
source:
|
|
78
|
+
clock: g,
|
|
79
|
+
source: _,
|
|
80
80
|
fn: (e) => e,
|
|
81
81
|
target: d
|
|
82
82
|
}), I({
|
|
83
|
-
clock:
|
|
84
|
-
target:
|
|
83
|
+
clock: g,
|
|
84
|
+
target: m
|
|
85
85
|
}), u = {
|
|
86
86
|
id: r.id,
|
|
87
87
|
key: r.key,
|
|
@@ -92,10 +92,10 @@ var z = M("experience"), se = L(({ client: e, experience: r }) => {
|
|
|
92
92
|
actions: l,
|
|
93
93
|
merge: a.merge,
|
|
94
94
|
initialiseFx: d,
|
|
95
|
-
shouldInitialiseFx:
|
|
96
|
-
initialiseRequested:
|
|
97
|
-
initialiseDirectly:
|
|
98
|
-
prepareExperienceContentFx:
|
|
95
|
+
shouldInitialiseFx: p,
|
|
96
|
+
initialiseRequested: h,
|
|
97
|
+
initialiseDirectly: g,
|
|
98
|
+
prepareExperienceContentFx: m
|
|
99
99
|
}, u;
|
|
100
100
|
});
|
|
101
101
|
function ce(e) {
|
|
@@ -169,7 +169,7 @@ var le = L(({ client: e }) => {
|
|
|
169
169
|
for (let e of i) e.open();
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
|
|
172
|
+
let a = "key" in n ? {
|
|
173
173
|
key: n.key,
|
|
174
174
|
options: {
|
|
175
175
|
...n.options,
|
|
@@ -181,7 +181,8 @@ var le = L(({ client: e }) => {
|
|
|
181
181
|
...n.options,
|
|
182
182
|
initialiseOpen: !0
|
|
183
183
|
}
|
|
184
|
-
}
|
|
184
|
+
};
|
|
185
|
+
await c(a);
|
|
185
186
|
}
|
|
186
187
|
}),
|
|
187
188
|
listStore: a,
|
|
@@ -513,7 +514,7 @@ function je(e, t, n) {
|
|
|
513
514
|
return new Proxy(Object.create(null), { get(r, i) {
|
|
514
515
|
if (typeof i != "string") return;
|
|
515
516
|
let a = e.find((e) => e.key === i);
|
|
516
|
-
if (a !== void 0) return async () => n.has(i)
|
|
517
|
+
if (a !== void 0) return async () => !n.has(i) && await W(a.logic, {
|
|
517
518
|
...t,
|
|
518
519
|
conditions: je(e, t, new Set(n).add(i))
|
|
519
520
|
}) === !0;
|
|
@@ -670,19 +671,23 @@ var Pe = 6e3, Fe = O("last_ping", "global"), Ie = async (e) => {
|
|
|
670
671
|
target: e.eventBus
|
|
671
672
|
});
|
|
672
673
|
let w = F(!1).on(_.done, () => !0), T = F(!1).on(f, () => !0), E = F(!1).on(y.done, () => !0), D = A(r, i, (e, t) => e === !0 && t === !0);
|
|
673
|
-
|
|
674
|
+
I({
|
|
674
675
|
clock: f,
|
|
675
676
|
source: D,
|
|
676
677
|
filter: (e) => e,
|
|
677
678
|
fn: () => void 0,
|
|
678
679
|
target: v
|
|
679
|
-
})
|
|
680
|
-
|
|
680
|
+
});
|
|
681
|
+
let O = A(w, T, D, (e, t, n) => e && t && n);
|
|
682
|
+
I({
|
|
683
|
+
clock: O,
|
|
681
684
|
filter: (e) => e,
|
|
682
685
|
fn: () => void 0,
|
|
683
686
|
target: y
|
|
684
|
-
})
|
|
685
|
-
|
|
687
|
+
});
|
|
688
|
+
let te = A(w, T, D, E, (e, t, n, r) => e && t && (!n || r));
|
|
689
|
+
return I({
|
|
690
|
+
clock: te,
|
|
686
691
|
filter: (e) => e,
|
|
687
692
|
fn: () => void 0,
|
|
688
693
|
target: d
|
|
@@ -937,7 +942,7 @@ var We = L(({ client: e }) => {
|
|
|
937
942
|
resolvedFeatures: n,
|
|
938
943
|
allFeatures: t
|
|
939
944
|
},
|
|
940
|
-
filter: ({ resolvedFeatures: e, allFeatures: t }, { id: n, key: r }) => q(t[n]?.feature)
|
|
945
|
+
filter: ({ resolvedFeatures: e, allFeatures: t }, { id: n, key: r }) => !q(t[n]?.feature) && !e.some((e) => e.id === n && e.key === r),
|
|
941
946
|
fn: (e, t) => t,
|
|
942
947
|
target: e.eventBus.prepend((e) => ({
|
|
943
948
|
type: "feature_decide",
|
|
@@ -1557,17 +1562,17 @@ var jt = L(() => {
|
|
|
1557
1562
|
let i = { id: e.id };
|
|
1558
1563
|
return e.isUser !== void 0 && (i.isUser = e.isUser), Object.keys(r).length > 0 && (i.identifiers = r), i;
|
|
1559
1564
|
}
|
|
1565
|
+
}), i = k({
|
|
1566
|
+
source: n,
|
|
1567
|
+
effect: (e) => {
|
|
1568
|
+
if (m()) try {
|
|
1569
|
+
E.get(Ot).set(e);
|
|
1570
|
+
} catch {}
|
|
1571
|
+
}
|
|
1560
1572
|
});
|
|
1561
1573
|
return I({
|
|
1562
1574
|
source: n,
|
|
1563
|
-
target:
|
|
1564
|
-
source: n,
|
|
1565
|
-
effect: (e) => {
|
|
1566
|
-
if (m()) try {
|
|
1567
|
-
E.get(Ot).set(e);
|
|
1568
|
-
} catch {}
|
|
1569
|
-
}
|
|
1570
|
-
})
|
|
1575
|
+
target: i
|
|
1571
1576
|
}), {
|
|
1572
1577
|
store: n,
|
|
1573
1578
|
setIsUser: r.setIsUser,
|
|
@@ -1721,7 +1726,7 @@ var Ut = class {
|
|
|
1721
1726
|
}), this.maybeStartPreviewChannel();
|
|
1722
1727
|
}
|
|
1723
1728
|
maybeStartPreviewChannel() {
|
|
1724
|
-
Ht() && import("../preview-channel-
|
|
1729
|
+
Ht() && import("../preview-channel-CSr96XAo.js").then((e) => e.initPreviewChannel(this)).catch(() => void 0);
|
|
1725
1730
|
}
|
|
1726
1731
|
registerFramework = (e) => {
|
|
1727
1732
|
Ce(e, this.frameworks);
|
|
@@ -1849,7 +1854,7 @@ async function $(e) {
|
|
|
1849
1854
|
try {
|
|
1850
1855
|
Function(e.textContent);
|
|
1851
1856
|
} catch (t) {
|
|
1852
|
-
return t instanceof SyntaxError
|
|
1857
|
+
return t instanceof SyntaxError && (console.error("[picked] Skipped a rehydrated inline script that failed to parse.", t), e.setAttribute(n, ""), !0);
|
|
1853
1858
|
}
|
|
1854
1859
|
return !1;
|
|
1855
1860
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../../logger-DMN6TxJJ.js";
|
|
2
2
|
import { f as e, i as t } from "../../../supports-CO9bJGNl.js";
|
|
3
|
-
import { r as n } from "../../../dom-
|
|
3
|
+
import { r as n } from "../../../dom-BqcToNL0.js";
|
|
4
4
|
import { createEffect as r, createEvent as i, createStore as a, sample as o } from "effector";
|
|
5
5
|
//#region src/plugins/dom-observer/plugin.ts
|
|
6
6
|
var s = /* @__PURE__ */ new WeakSet(), c = () => ({
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as e } from "../../../api-
|
|
2
|
-
import { n as t, r as n, t as r } from "../../../plugin-
|
|
1
|
+
import { i as e } from "../../../api-CgqRvuKL.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "../../../plugin-D2UqFikQ.js";
|
|
3
3
|
export { e as createClientHeaders, r as dynamicExperiencesPlugin, t as fetchExperienceContent, n as fetchProject };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, l as r, n as i, r as a, s as o, t as s } from "../../protocol-
|
|
1
|
+
import { a as e, c as t, i as n, l as r, n as i, r as a, s as o, t as s } from "../../protocol-C5KkkiZc.js";
|
|
2
2
|
export { s as PREVIEW_CONTENT_PATCH_MESSAGE, i as PREVIEW_INERT_SCRIPTS_MESSAGE, a as PREVIEW_PROTOCOL_VERSION, n as PREVIEW_READY_MESSAGE, e as PREVIEW_RESYNC_MESSAGE, o as applyContentOps, t as formatContentPath, r as parseContentPath };
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, o as r, s as i, t as a, u as o } from "../../experience-instance-
|
|
2
|
-
import { i as s, n as c } from "../../plugin-
|
|
1
|
+
import { a as e, c as t, i as n, o as r, s as i, t as a, u as o } from "../../experience-instance-DGk11d8a.js";
|
|
2
|
+
import { i as s, n as c } from "../../plugin-D2UqFikQ.js";
|
|
3
3
|
import { attach as l, createEffect as u, createEvent as d, createStore as f, sample as p } from "effector";
|
|
4
4
|
//#region src/server/serialize.ts
|
|
5
5
|
var m = 1e4;
|
|
@@ -77,7 +77,7 @@ function y(e, t) {
|
|
|
77
77
|
availableRenderers: t,
|
|
78
78
|
startRendererIndex: n
|
|
79
79
|
}) : null);
|
|
80
|
-
|
|
80
|
+
g.on(s, (e, t) => ({
|
|
81
81
|
...e,
|
|
82
82
|
renderedExperiences: [...e.renderedExperiences, t],
|
|
83
83
|
currentExperienceIndex: e.currentExperienceIndex + 1
|
|
@@ -130,14 +130,16 @@ function y(e, t) {
|
|
|
130
130
|
},
|
|
131
131
|
filter: ({ experiences: e, state: t }) => t.currentExperienceIndex >= e.length,
|
|
132
132
|
target: c
|
|
133
|
-
})
|
|
133
|
+
});
|
|
134
|
+
let b = l({
|
|
135
|
+
source: g,
|
|
136
|
+
effect: (e) => {
|
|
137
|
+
e.isComplete && r(e.renderedExperiences);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
return p({
|
|
134
141
|
clock: c,
|
|
135
|
-
target:
|
|
136
|
-
source: g,
|
|
137
|
-
effect: (e) => {
|
|
138
|
-
e.isComplete && r(e.renderedExperiences);
|
|
139
|
-
}
|
|
140
|
-
})
|
|
142
|
+
target: b
|
|
141
143
|
}), i(), n;
|
|
142
144
|
}
|
|
143
145
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as e, t } from "./rules-logic-HesIUCu6.js";
|
|
2
2
|
import "./logger-DMN6TxJJ.js";
|
|
3
|
-
import { n, o as r } from "./dom-
|
|
3
|
+
import { n, o as r } from "./dom-BqcToNL0.js";
|
|
4
4
|
import { attach as i, combine as a, createApi as o, createDomain as s, createEffect as c, createEvent as l, sample as u, split as d } from "effector";
|
|
5
5
|
import { createFactory as f, invoke as p } from "@withease/factories";
|
|
6
6
|
//#region src/utils/nodes.ts
|
|
@@ -80,7 +80,7 @@ function T() {
|
|
|
80
80
|
return p(w);
|
|
81
81
|
}
|
|
82
82
|
async function E(n, r, i) {
|
|
83
|
-
return r == null ? !0 : typeof r == "boolean" ? r : e(r)
|
|
83
|
+
return r == null ? !0 : typeof r == "boolean" ? r : !e(r) || await t(n, r, i) === !0;
|
|
84
84
|
}
|
|
85
85
|
function D(e) {
|
|
86
86
|
if (typeof e == "string") return e;
|
|
@@ -452,7 +452,7 @@ var z = s("experience-instance"), B = f(({ client: r, experience: s, target: f,
|
|
|
452
452
|
}), u({
|
|
453
453
|
source: A,
|
|
454
454
|
clock: y,
|
|
455
|
-
filter: (e) => e
|
|
455
|
+
filter: (e) => !e || _(e),
|
|
456
456
|
target: J
|
|
457
457
|
}), u({
|
|
458
458
|
source: B,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rules-logic-CGZIYgAI.cjs");require("./logger-CSTvAyyB.cjs");const t=require("./dom-DlLH3FxV.cjs");let n=require("effector"),r=require("@withease/factories");function i(e){return e.type===`condition`}function a(e){return e.type===`step`}function o(e){return e.type===`experience`}function s(e){return e.type===`origin`}function c(e){return e.type===`action`}var l=`conditions.`,u=(0,n.createDomain)(`condition-results`);function d(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function f(e){if(e===void 0)return null;if(Array.isArray(e))return e.map(e=>f(e));if(d(e)){let t=Object.keys(e).sort((e,t)=>e.localeCompare(t)),n={};for(let r of t)n[r]=f(e[r]);return n}return e}function p(e){return JSON.stringify(f(e))}var m=(0,r.createFactory)(()=>{let e=u.store({}),t=(0,n.createApi)(e,{set(e,t){return e[t.hash]===t.result?e:{...e,[t.hash]:t.result}},seed(e,t){return Object.keys(t).every(n=>e[n]===t[n])?e:{...e,...t}},clear(){return{}}});function r(e){t.set(e)}function i(e){t.seed(e)}function a(){t.clear()}function o(t){return e.getState()[t]}return{store:e,set:r,seed:i,peek:o,reset:a}});function h(){return(0,r.invoke)(m)}async function g(t,n,r){return n==null?!0:typeof n==`boolean`?n:!e.n(n)||await e.t(t,n,r)===!0}function _(e){if(typeof e==`string`)return e;if(Array.isArray(e)&&typeof e[0]==`string`)return e[0]}function v(e){if(Array.isArray(e))return e.some(v);if(d(e)){let t=_(e.var);return t!==void 0&&(t===`actions`||t.startsWith(`actions.`))?!0:Object.values(e).some(v)}return!1}function y(e){if(Array.isArray(e))return e.flatMap(y);if(d(e)){let t=_(e.var);return[...t!==void 0&&t.startsWith(l)?[t.slice(11)]:[],...Object.values(e).flatMap(y)]}return[]}function b(e,t,n=new Set){if(v(e))return!0;for(let r of y(e)){if(n.has(r))continue;n.add(r);let e=t[r];if(e!==void 0&&b(e.logic,t,n))return!0}return!1}async function x(e,t,n){let r={};for(let t of e.conditions.listStore.getState())r[t.key]=t;let i=b(t,r),a=p(t);if(!i){let t=e.conditionResults.peek(a);if(t!==void 0)return t}let o=await g(e,t,n?.context);return i||e.conditionResults.set({hash:a,result:o}),o}async function S(e,t,n){let r=n?.context,i=[n?.precondition,n?.condition,t.condition];for(let t of i)if(!await x(e,t,{context:r}))return!1;return!0}var C=(e,t,n,r,i=new Set)=>i.has(n.id)?[]:(i.add(n.id),a(n)&&!r?[n]:t.filter(e=>e.sourceNodeId===n.id).flatMap(n=>{let r=e.find(e=>e.id===n.destinationNodeId);return r?C(e,t,r,!1,i):[]})),w=(e,t,n)=>C(e,t,n,!0,new Set),T=(e,t,n,r,i=new Set)=>{if(i.has(n.id))return[-1,-1];i.add(n.id);let a=t.filter(e=>e.sourceNodeId===n.id);if(a.length===0)return[0,0];let o=1/0,s=-1/0;for(let n of a){let r=e.find(e=>e.id===n.destinationNodeId);if(!r)continue;let[a,c]=T(e,t,r,!1,new Set(i));a!==-1&&(o=Math.min(o,a+1),s=Math.max(s,c+1))}return o===1/0?[-1,-1]:[o,s]},E=(e,t,n)=>T(e,t,n,!0,new Set),D=(e,t,n,r=new Set)=>{if(r.has(n.id))return[-1,-1];if(r.add(n.id),n.type===`origin`)return[0,0];let i=t.filter(e=>e.destinationNodeId===n.id);if(i.length===0)return[-1,-1];let a=1/0,o=-1/0;for(let n of i){let i=e.find(e=>e.id===n.sourceNodeId);if(!i)continue;let[s,c]=D(e,t,i,new Set(r));s!==-1&&(a=Math.min(a,s+1),o=Math.max(o,c+1))}return a===1/0?[-1,-1]:[a,o]},ee=(e,t,n)=>D(e,t,n,new Set),O=e=>e.find(e=>e.type===`origin`)||null,k=(e,t,n)=>{if(!e)return O(t);let r=n.find(t=>t.sourceNodeId===e.id);return r&&t.find(e=>e.id===r.destinationNodeId)||null};async function A(e,t,n,r){let i=e?`true`:`false`,a=r.find(e=>e.sourceHandle===i&&e.sourceNodeId===t);return n.find(e=>e.id===a?.destinationNodeId)}function j(e,t,n,r){let i=r.filter(e=>e.sourceNodeId===t),a=e?`true`:`false`,o=i.find(e=>e.sourceHandle===a)??i.find(e=>e.sourceHandle==null);return n.find(e=>e.id===o?.destinationNodeId)}var M=(0,n.createDomain)(`experience-instance`),N=(0,r.createFactory)(({client:r,experience:l,target:u,options:d})=>{let f=(0,n.createEvent)(),p=(0,n.createEvent)(),m=(0,n.createEvent)(),h=(0,n.createEvent)(),g=(0,n.createEvent)(),_=(0,n.createEvent)(),v=(0,n.createEvent)(),y=l.componentStore,b=M.store(`transitioning`),x=r.history.entriesStore.map(e=>e.filter(e=>e.experienceId===l.id)),S=x.map(e=>e.filter(e=>a(e.node))),C=x.map(e=>e.at(-1)?.node||null),T=M.store(null);(0,n.sample)({clock:[C,r.steps.listStore,_],source:{steps:r.steps.listStore,node:C},filter:({node:e})=>e!==null&&a(e),fn:({steps:e,node:t})=>t&&a(t)?e.find(e=>e.id===t.stepId)??null:null,target:T});let D=(0,n.combine)(r.steps.listStore,S,(e,t)=>{let n=t.at(-2);if(!n||!a(n.node))return null;let r=n.node;return e.find(e=>e.id===r.stepId)||null}),N=(0,n.combine)(l.treeStore,C,({nodes:e,edges:t},n)=>n?w(e,t,n):[]),P=(0,n.combine)(l.treeStore,C,({nodes:e,edges:t},n)=>n?ee(e,t,n):[-1,-1]),F=(0,n.combine)(l.treeStore,C,({nodes:e,edges:t},n)=>n?E(e,t,n):[-1,-1]),I=M.store(!1),L=(0,n.createApi)(I,{open:()=>!0,close:()=>!1,toggle:e=>!e,set:(e,t)=>t}),R=(0,n.createEffect)(async()=>{r.history.back({experienceId:l.id})}),z=(0,n.attach)({source:l.treeStore,effect:async(e,t)=>{let n=e.nodes.find(e=>a(e)&&e.stepId===t);n&&r.history.push({experienceId:l.id,node:n})}}),B=(0,n.attach)({source:l.treeStore,effect:async(e,t)=>{let n=e.steps.find(e=>e.key===t);if(!n)return;let i=e.nodes.find(e=>a(e)&&e.stepId===n.id);i&&r.history.push({experienceId:l.id,node:i})}}),V=(0,n.attach)({source:C,effect:e=>{}}),H=(0,n.attach)({source:l.treeStore,effect:async({nodes:e})=>O(e)}),U=(0,n.attach)({source:l.treeStore,effect:async({nodes:e,edges:t},n)=>{if(s(n))return k(n,e,t)}}),W=(0,n.attach)({source:l.treeStore,effect:async({nodes:t,edges:n,conditions:a},o)=>{if(!i(o))return;let s=a.find(e=>e.id===o.conditionId)?.logic;return s?A(!!await e.t(r,s),o.id,t,n):void 0}}),G=(0,n.attach)({source:{tree:l.treeStore,actions:r.actions.listStore,snapshot:r.stateSnapshotStore},effect:async({tree:e,actions:t,snapshot:n},r)=>{let{nodes:i,edges:a}=e;if(!c(r))return;let o=r.actionKey;if(!o){`${r.id}`;return}let s=t.find(e=>e.key===o)?.action;if(typeof s!=`function`)return`${o}`,j(!1,r.id,i,a)??null;let l=!0;try{`${o}`,await s({...n,args:[]},{experience:Z})}catch{`${o}`,l=!1}let u=j(l,r.id,i,a);if(!u){let e=a.some(e=>e.sourceNodeId===r.id)?`no edge for its outcome`:`no outgoing edge`;return`${r.id}${e}`,null}return`${o}${u.id}`,u}}),K=(0,n.createEffect)(e=>{o(e)&&r.experiences.launch({key:e.experienceKey})}),q=(0,n.attach)({source:[C,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>k(e,t,n)}),J=(0,n.attach)({source:[C,l.treeStore],effect:async([e,{nodes:t,edges:n}])=>k(e,t,n)}),te=(0,n.createEffect)(e=>{r.history.push({experienceId:l.id,node:e})}),Y=(0,n.attach)({source:l.configStore,effect:async({initializeOpenLogic:t})=>d?.initialiseOpen===void 0?e.n(t)?!!await e.t(r,t):t??!1:d.initialiseOpen}),X=(0,n.combine)(y,r.frameworks.listStore,(e,t)=>{if(!e)return null;let n=t.find(t=>t.name===e.component.frameworkName);return n?{component:e,framework:n}:null},{skipVoid:!1}),Z,ne=(0,n.attach)({source:X,effect:e=>{if(!e)return;if(!u){`${l.id}`;return}let n=t.n(u);try{e.framework.render(n,e.component.component,r,Z)}catch{}}});Z=Object.freeze({id:Math.random().toString(36).substring(7),experienceKey:l.key,experienceId:l.id,experienceName:l.name,configStore:l.configStore,target:u,componentStore:y,componentAndFrameworkStore:X,stateStore:b,isOpenStore:I,open:L.open,close:L.close,toggleOpen:L.toggle,setOpen:L.set,treeStore:l.treeStore,currentNodeStore:C,currentStepStore:T,previousStepStore:D,nextReachableStepNodesStore:N,stepsToOriginStore:P,stepsToLeafStore:F,goToNextStep:p,goToPreviousStep:m,goToStepById:h,goToStepByKey:g,stepsHistoryStore:S,mountFx:ne});let Q=(0,n.createEvent)(),$=(0,n.createEvent)();return(0,n.sample)({clock:C,target:Q}),(0,n.sample)({clock:Q,filter:e=>e===null,target:H}),(0,n.sample)({clock:Q,filter:e=>e!==null,target:$}),(0,n.split)({source:$,match:e=>i(e)?`condition`:a(e)?`step`:o(e)?`launchExperience`:s(e)?`origin`:c(e)?`action`:`other`,cases:{origin:U,condition:W,step:V,launchExperience:K,action:G,__:(0,n.createEvent)()}}),(0,n.sample)({clock:[W.doneData,U.doneData,H.doneData,J.doneData,q.doneData,G.doneData],filter:Boolean,target:te}),(0,n.sample)({clock:p,target:J}),(0,n.sample)({clock:p,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit`,step:e,experience:Z}))}),(0,n.sample)({clock:J.done,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_success`,step:e,experience:Z}))}),(0,n.sample)({clock:J.fail,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_submit_error`,step:e,experience:Z}))}),(0,n.sample)({clock:m,target:R}),(0,n.sample)({clock:h,target:z}),(0,n.sample)({clock:g,target:B}),(0,n.sample)({source:(0,n.combine)([W.pending,U.pending,H.pending,J.pending,q.pending,G.pending]),fn:e=>e.some(Boolean)?`transitioning`:`ready`,target:b}),(0,n.sample)({clock:V.doneData,source:T,filter:Boolean,target:r.eventBus.prepend(e=>({type:`step_enter`,step:e,experience:Z}))}),(0,n.sample)({clock:v,target:Y}),(0,n.sample)({source:Y.doneData,fn:Boolean,target:I}),(0,n.sample)({source:C,clock:f,filter:e=>!e||s(e),target:q}),(0,n.sample)({source:I,filter:Boolean,target:f}),(0,n.sample)({source:I,filter:Boolean,target:r.eventBus.prepend(()=>({type:`experience_open`,experience:Z}))}),(0,n.sample)({source:I,filter:e=>!e,target:r.eventBus.prepend(()=>({type:`experience_close`,experience:Z}))}),(0,n.sample)({clock:_,target:[v]}),_(),Z});function P(e){return(0,r.invoke)(N,e)}var F=(0,r.createFactory)(({client:e})=>{let r=M.store({}),i=(0,n.createEvent)(),a=(0,n.createEvent)(),o=(0,n.createEvent)(),s=(0,n.createApi)(r,{register(e,t){let n=[...e[t.experienceId]??[]];return n.push(t),{...e,[t.experienceId]:n}},unregister(e,t){let n=t.experienceId,r=e[n]?.filter(e=>e!==t);return{...e,[n]:r??[]}}}),c=(0,n.createEffect)(({experience:t,target:n,options:r})=>P({client:e,experience:t,target:n,options:r})),l=(0,n.createEffect)(e=>{s.register(e)}),u=(0,n.createEffect)(e=>{e.target&&t.o(e.target,()=>{o(e)})}),d=(0,n.createEffect)(e=>{s.unregister(e)}),f=(0,n.createEffect)(async e=>{await e.mountFx()});(0,n.sample)({clock:i,target:c}),(0,n.sample)({clock:o,target:d}),(0,n.sample)({clock:c.doneData,target:[l,u,a]}),(0,n.sample)({clock:c.doneData,target:e.eventBus.prepend(e=>({type:`experience_initialize`,experience:e}))}),(0,n.sample)({clock:a,target:f});function p(e,t,n){i({experience:e,target:t,options:n})}let m=r.map(e=>Object.values(e).flat());function h(e){return m.map(t=>t.filter(t=>t.experienceKey===e),{skipVoid:!1})}function g(e){return r.map(t=>t[e]||[],{skipVoid:!1})}return{spawn:p,getByExperienceKey:h,getByExperienceId:g,listStore:m}});function I(e){return(0,r.invoke)(F,e)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return a}});
|