@picked/client 0.0.70-next.6 → 0.0.70
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/{api-ahdSBQ3Y.js → api-CPy9G49C.js} +1 -1
- package/dist/api-Ce6xYI--.cjs +1 -0
- package/dist/cjs/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/esm/index.js +1 -1
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +1 -1
- package/dist/{plugin-BxMR7fOV.js → plugin-ChPkTj__.js} +1 -1
- package/dist/{plugin-CASdGtTX.cjs → plugin-DHn11gn6.cjs} +1 -1
- package/package.json +1 -1
- package/dist/api-CoUkIxIr.cjs +0 -1
package/dist/docs/steps.mdx
CHANGED
|
@@ -6,7 +6,8 @@ import { Screenshot } from '../../components/Screenshot'
|
|
|
6
6
|
|
|
7
7
|
# Steps
|
|
8
8
|
|
|
9
|
-
A step is
|
|
9
|
+
A step is one screen or card that a visitor sees during an experience. Each step
|
|
10
|
+
holds one or more fields. A field collects data or shows content.
|
|
10
11
|
|
|
11
12
|
<Screenshot
|
|
12
13
|
route="/{orgSlug}/{projectId}/workspaces/{workspaceId}/steps"
|
|
@@ -18,27 +19,35 @@ A step is a visual screen or card shown to visitors during an experience. Each s
|
|
|
18
19
|
1. Open your project.
|
|
19
20
|
2. Click **Steps** in the sidebar.
|
|
20
21
|
3. Click **New Step**.
|
|
21
|
-
4. Enter a name and key.
|
|
22
|
+
4. Enter a name and a key.
|
|
22
23
|
5. Click **Create**.
|
|
23
24
|
|
|
24
|
-
The key is a unique identifier
|
|
25
|
+
The key is a unique identifier for your application. You set it once, and you cannot
|
|
26
|
+
change it later.
|
|
25
27
|
|
|
26
|
-
##
|
|
28
|
+
## Set up a step
|
|
27
29
|
|
|
28
|
-
**Name**: The
|
|
30
|
+
**Name**: The name that the dashboard shows. Your visitors do not see it.
|
|
29
31
|
|
|
30
|
-
**Key**: The
|
|
32
|
+
**Key**: The identifier that your application uses for this step. Your
|
|
33
|
+
visitors do not see it.
|
|
31
34
|
|
|
32
|
-
**Layout Name**: The name of the component layout
|
|
35
|
+
**Layout Name**: The name of the component layout that renders this step. Examples
|
|
36
|
+
are `card`, `modal`, and `fullscreen`.
|
|
33
37
|
|
|
34
|
-
A step can also carry a **Step Layout
|
|
38
|
+
A step can also carry a **Step Layout**. A step layout is a reusable CMS schema, and
|
|
39
|
+
it gives the step a Content Entry. See [Page and Step Layouts](/content/layouts).
|
|
35
40
|
|
|
36
41
|
## Assign fields
|
|
37
42
|
|
|
38
|
-
In the flow builder, drag a field from the entity browser onto a step node. The field
|
|
43
|
+
In the flow builder, drag a field from the entity browser onto a step node. The field
|
|
44
|
+
appears in the **Assigned Fields** list of the step, in the inspector.
|
|
39
45
|
|
|
40
|
-
You can also
|
|
46
|
+
You can also choose the step node and expand the **Assigned Fields** section to see
|
|
47
|
+
and control the assigned fields. Click a field to open its inspector.
|
|
41
48
|
|
|
42
49
|
## Reuse steps
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
A step is a project-level entity. You can drag the same step into more than one
|
|
52
|
+
experience flow. A change to the options of a step applies at every place that uses
|
|
53
|
+
it.
|
|
@@ -4,13 +4,16 @@ layout: docs
|
|
|
4
4
|
|
|
5
5
|
# Team management
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Control who can reach your organization and what each person can do. An organization
|
|
8
|
+
is the top-level container for your projects and members.
|
|
8
9
|
|
|
9
10
|
## Organizations
|
|
10
11
|
|
|
11
|
-
An organization groups your projects, members, and settings. You can belong
|
|
12
|
+
An organization groups your projects, your members, and your settings. You can belong
|
|
13
|
+
to more than one organization.
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
To move between organizations, use the organization control at the top of the
|
|
16
|
+
sidebar.
|
|
14
17
|
|
|
15
18
|
## Invite members
|
|
16
19
|
|
|
@@ -18,23 +21,26 @@ Switch between organizations using the organization selector in the top of the s
|
|
|
18
21
|
2. Click **Members**.
|
|
19
22
|
3. Click **Invite**.
|
|
20
23
|
4. Enter an email address.
|
|
21
|
-
5.
|
|
24
|
+
5. Choose a role.
|
|
22
25
|
6. Click **Send Invite**.
|
|
23
26
|
|
|
24
|
-
The
|
|
27
|
+
The person that you invite receives an email with a link to join your organization.
|
|
28
|
+
A person without a Picked account must create one first.
|
|
25
29
|
|
|
26
30
|
## Remove members
|
|
27
31
|
|
|
28
32
|
1. Open your organization.
|
|
29
33
|
2. Click **Members**.
|
|
30
|
-
3. Find the member you want to remove.
|
|
31
|
-
4. Click **Remove** next to
|
|
32
|
-
5. Confirm
|
|
34
|
+
3. Find the member that you want to remove.
|
|
35
|
+
4. Click **Remove** next to the name of the member.
|
|
36
|
+
5. Confirm.
|
|
33
37
|
|
|
34
|
-
The member
|
|
38
|
+
The member loses access to every project in the organization immediately.
|
|
35
39
|
|
|
36
40
|
## Roles and permissions
|
|
37
41
|
|
|
38
|
-
|
|
42
|
+
Each member holds a role, and the role controls what the member can reach. A role
|
|
43
|
+
decides whether a member can create a project, edit an experience, control other
|
|
44
|
+
members, or read a report.
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
Give each member the smallest role that the work of that member needs.
|
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.
|
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,7 @@ 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
|
|
|
5
5
|
import { a as _, i as v, r as ee, s as y, t as b } from "../dom-BwmTHeT7.js";
|
|
6
6
|
import { l as x, n as S, r as C, u as w } from "../experience-instance-DOJShRk5.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-CPy9G49C.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";
|
|
@@ -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-CPy9G49C.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "../../../plugin-ChPkTj__.js";
|
|
3
3
|
export { e as createClientHeaders, r as dynamicExperiencesPlugin, t as fetchExperienceContent, n as fetchProject };
|
package/dist/esm/server/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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-DOJShRk5.js";
|
|
2
|
-
import { i as s, n as c } from "../../plugin-
|
|
2
|
+
import { i as s, n as c } from "../../plugin-ChPkTj__.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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require("./logger-CSTvAyyB.cjs");const e=require("./api-
|
|
1
|
+
require("./logger-CSTvAyyB.cjs");const e=require("./api-Ce6xYI--.cjs");let t=require("effector");function n(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return t>>>0}function r(e){let t=e;return t^=t>>>16,t=Math.imul(t,2246822507),t^=t>>>13,t=Math.imul(t,3266489909),t^=t>>>16,t>>>0}function i(e,t){return r(n(`${e}:${t}`))%100}function a(e,t){return t<=0?!1:t>=100?!0:e<t}function o(e){return typeof e==`object`&&!!e&&`features`in e&&Array.isArray(e.features)}function s(e,t){if(Array.isArray(t.conditions))for(let n of t.conditions)e.registerCondition(n)}function c(e,t){e.registerExperience({id:t.id,key:t.key,name:t.name,targets:t.targets,nodes:t.nodes,edges:t.edges,condition:t.condition,initializeOpen:t.initializeOpen,componentName:t.componentName})}function l(e,t){if(Array.isArray(t.fields))for(let n of t.fields)e.registerField(n)}function u(e,t){if(!Array.isArray(t.steps))return;let n=new Map(t.fields.map(e=>[e.id,e.key]));for(let r of t.steps){let t=[];for(let e of r.fieldIds??[]){let i=n.get(e);if(i===void 0){`${r.key}${e}`;continue}t.push(i)}let i=r.layoutContentId?e.contents.getById(r.layoutContentId):null;e.registerStep({id:r.id,key:r.key,name:r.name,fieldKeys:t,layoutName:r.layoutName,...r.layoutContentId!==void 0&&{layoutContentId:r.layoutContentId,layoutContentStore:i}})}}function d(e,t){if(Array.isArray(t.experiences))for(let n of t.experiences)c(e,n)}function f(e,t,n){h(e,t,n.isPreview,n.sessionId),s(e,t),l(e,t),u(e,t),d(e,t)}function p(e){let t=e.searchParams[`preview-token`];if(t&&t.length>0)return t[0]}function m(e){let t=new Set,n=e.searchParams.feature;if(!n)return t;for(let e of n){let n=e.indexOf(`:`);n>0&&t.add(e.substring(0,n))}return t}function h(e,t,n,r){let i=m(e);for(let a of t.features)i.has(a.id)||g(e,a,n,r)}function g(e,t,n,r){let o=i(r,t.id);e.registerFeature(t.id,{key:`v${t.version}`,name:t.name,enabled:t.enabled,weight:t.weight,storage:n?`session`:`local`,decide:()=>a(o,t.weight)})}function _(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`127.0.0.1`||t===`::1`}catch{return!1}}function v(e){if(typeof e!=`object`||!e||!(`cause`in e))return!1;let{cause:t}=e;return typeof t!=`object`||!t||!(`code`in t)?!1:t.code===`ECONNREFUSED`}async function y(t,n,r){let i=r?.previewToken?`projects/${n}?preview_token=${encodeURIComponent(r.previewToken)}`:`projects/${n}`,a;try{a=await e.t(t,i,r?.headers)}catch(e){return _(t)&&v(e),null}if(!a.ok)return`${a.status.toString()}`,null;let s;try{s=await a.json()}catch{return null}return o(s)?s:null}function b(e){return typeof e!=`object`||!e||!(`experienceId`in e)||!(`content`in e)?!1:Array.isArray(e.content)}async function x(t,n,r,i){let a=i?.previewToken?`projects/${n}/experiences/${r}/content?preview_token=${encodeURIComponent(i.previewToken)}`:`projects/${n}/experiences/${r}/content`,o;try{o=await e.t(t,a,i?.headers,i?.signal)}catch(e){return _(t)&&v(e)||`${r}`,null}if(!o.ok)return`${r}${o.status.toString()}`,null;let s;try{s=await o.json()}catch{return`${r}`,null}return b(s)?s:(`${r}`,null)}function S(e,t){for(let n of t.content)e.registerContent({id:n.id,contentModelKey:n.contentModelKey,data:n.data})}function C(e){if(typeof e!=`object`||!e||!(`projectConfig`in e)||!(`experienceContent`in e)||!(`manifestMetadata`in e))return!1;let{experienceContent:t}=e;return typeof t==`function`}async function w(){try{let e=await import(`virtual:picked/data`);return C(e)?e:null}catch{return null}}function T(e,t,n){return r=>x(e,t,r.id,n?{previewToken:n}:void 0)}function E(e,t){return n=>e(n,t?{previewToken:t}:void 0)}function D(e){return(t,n)=>e.experienceContent(t,n)}function O(e,t){let n=new Map;return(r,i)=>{let a=n.get(r.id);if(a)return a;let o=(async()=>{try{let n=await t(r,i);return n&&S(e,n),n}finally{n.delete(r.id)}})();return n.set(r.id,o),o}}function k(e,t){let n=new Set(t&&Array.isArray(t.experiences)?t.experiences.map(e=>e.id):[]);return(t,r)=>n.has(t.id)?e(t,r):Promise.resolve(null)}async function A(e){let{client:t,apiUrl:n,options:r}=e,i=p(t),a=!!i,o=r?.projectConfig??null,s=r?.getContent?E(r.getContent,i):null,c=null;if(i)return o??=await y(n,t.projectId,{previewToken:i}),s??=T(n,t.projectId,i),{config:o,contentLoader:s,dataSource:c,isPreview:a};if(o&&s)return{config:o,contentLoader:s,dataSource:c,isPreview:a};let l=await w();return l?(o??=l.projectConfig,s??=D(l),c=l.manifestMetadata,{config:o,contentLoader:s,dataSource:c,isPreview:a}):(o??=await y(n,t.projectId),s??=T(n,t.projectId),{config:o,contentLoader:s,dataSource:c,isPreview:a})}function j(e){return{name:`dynamic-experiences`,setup:n=>{let r=e?.apiUrl??n.apiUrl;return{onStart:(0,t.attach)({source:n.session.store.map(e=>e.id),effect:async t=>{let{config:i,contentLoader:a,dataSource:o,isPreview:s}=await A({client:n,apiUrl:r,options:e});a&&(n.contentLoader=O(n,k(a,i))),n.dataSource=o,i&&(n.previewEmbedderOrigins=i.previewEmbedderOrigins??null,f(n,i,{isPreview:s,sessionId:t}))}})}}}}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return j}});
|
package/package.json
CHANGED
package/dist/api-CoUkIxIr.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`Picked-Client`,t=`Picked-Version`;function n(n,r){return{[e]:n,[t]:r}}var r=()=>`0.0.70-next.6`,i=`v1`;function a(e,t){return new URL(`/api/${i}/${t}`,e).toString()}function o(e){return{...n(`sdk`,r()),...e}}async function s(e,t,n,r){let i=a(e,t);return fetch(i,{headers:o(n),signal:r})}async function c(e,t,n,r){let i=a(e,t);return fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,...o(r)},body:JSON.stringify(n)})}Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|