@picked/client 0.0.70-next.5 → 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-DQ1DqG_F.js → api-CPy9G49C.js} +1 -1
- package/dist/api-Ce6xYI--.cjs +1 -0
- package/dist/cjs/index.js +2 -2
- 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 +75 -20
- 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 +257 -238
- package/dist/esm/plugins/dynamic-experiences/index.js +2 -2
- package/dist/esm/server/index.js +1 -1
- package/dist/{plugin-EPx6sE_l.js → plugin-ChPkTj__.js} +58 -53
- package/dist/plugin-DHn11gn6.cjs +1 -0
- package/dist/types/entities/feature/feature.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/hash.d.ts +40 -5
- package/dist/types/plugins/dynamic-experiences/hash.d.ts.map +1 -1
- package/dist/types/plugins/dynamic-experiences/plugin.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/api-B9koex39.cjs +0 -1
- package/dist/plugin-YbSSGrM7.cjs +0 -1
|
@@ -15,19 +15,30 @@ Sections are reusable schema fragments you embed inside layouts, so common struc
|
|
|
15
15
|
|
|
16
16
|
## What a section is
|
|
17
17
|
|
|
18
|
-
A Section is a reusable fragment
|
|
18
|
+
A Section is a reusable schema fragment with its own **Key**. A
|
|
19
|
+
[layout](/content/layouts) gives its shape to a whole Page or Step. A Section is a
|
|
20
|
+
part that you put into one or more layouts. Define the shape one time, then reuse it
|
|
21
|
+
everywhere.
|
|
19
22
|
|
|
20
23
|
## Create a section
|
|
21
24
|
|
|
22
|
-
1. Open your workspace
|
|
23
|
-
2. Click **
|
|
24
|
-
3.
|
|
25
|
-
4.
|
|
25
|
+
1. Open your workspace.
|
|
26
|
+
2. Click **Sections** in the sidebar.
|
|
27
|
+
3. Click **New Section**.
|
|
28
|
+
4. Enter a name and a **Key**. The Key is a unique, stable identifier. Your SDK code
|
|
29
|
+
and your API calls both use it.
|
|
30
|
+
5. Add your fields.
|
|
31
|
+
6. Save.
|
|
26
32
|
|
|
27
33
|
## Use a section in a layout
|
|
28
34
|
|
|
29
|
-
Add a **Section** field to a Page or Step Layout
|
|
35
|
+
Add a **Section** field to a Page Layout or a Step Layout. Point that field at the
|
|
36
|
+
Section that you want. The layout then carries the fields of the Section at every
|
|
37
|
+
place where that field appears. A Content Entry from the layout fills in the fields
|
|
38
|
+
of the Section in the same way as every other field.
|
|
30
39
|
|
|
31
|
-
##
|
|
40
|
+
## Change a section
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
An edit to a Section does not migrate the entries that use it. After you change a
|
|
43
|
+
Section, check each affected [Content Entry](/content/content-entries) again. Correct
|
|
44
|
+
every field error before you publish.
|
|
@@ -16,7 +16,7 @@ GET /api/v1/projects/:projectId/experiences/:id/content
|
|
|
16
16
|
| --- | --- | --- |
|
|
17
17
|
| `projectId` | path | The project the experience belongs to. |
|
|
18
18
|
| `id` | path | The experience to fetch content for. |
|
|
19
|
-
| `preview_token` | query | Optional.
|
|
19
|
+
| `preview_token` | query | Optional. With it, the endpoint returns preview content, which is unpublished. |
|
|
20
20
|
|
|
21
21
|
## Response
|
|
22
22
|
|
|
@@ -40,11 +40,14 @@ GET /api/v1/projects/:projectId/experiences/:id/content
|
|
|
40
40
|
| `versionId` | `string \| null` | The published version id, or `null` on preview. |
|
|
41
41
|
| `content[].id` | `string` | The Content Entry id. |
|
|
42
42
|
| `content[].contentModelKey` | `string \| null` | The layout's Key, or `null` when it cannot be resolved. |
|
|
43
|
-
| `content[].data` | `object` | The entry data
|
|
43
|
+
| `content[].data` | `object` | The entry data. It matches the layout schema. |
|
|
44
44
|
|
|
45
|
-
## HTML asset
|
|
45
|
+
## An HTML asset comes back in the response
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
A layout can have an [HTML asset](/content/asset-library) field. The value of that
|
|
48
|
+
field arrives inside the response. The endpoint changes the reference to
|
|
49
|
+
`{ id, content }`. There, `content` holds the HTML that you uploaded, as a string. It
|
|
50
|
+
is `null` when the endpoint cannot resolve it:
|
|
48
51
|
|
|
49
52
|
```json
|
|
50
53
|
{
|
|
@@ -82,4 +85,6 @@ curl https://api.picked.app/api/v1/projects/proj_123/experiences/exp_123/content
|
|
|
82
85
|
}
|
|
83
86
|
```
|
|
84
87
|
|
|
85
|
-
See [Project Config](/delivery-api/project-config) for the endpoint that links
|
|
88
|
+
See [Project Config](/delivery-api/project-config) for the endpoint that links a step
|
|
89
|
+
to an entry. See [Asset Library](/content/asset-library) for an HTML asset. See
|
|
90
|
+
[Server Snapshot](/sdk/ssr/serialize) for how the SDK reads this content.
|
|
@@ -4,20 +4,23 @@ layout: docs
|
|
|
4
4
|
|
|
5
5
|
# Delivery API
|
|
6
6
|
|
|
7
|
-
The Delivery API is a public
|
|
7
|
+
The Delivery API is a public REST API. It is read-only, and it serves the published
|
|
8
|
+
options of your project together with your page content. It is separate from the
|
|
9
|
+
GraphQL management API.
|
|
8
10
|
|
|
9
|
-
## Delivery API
|
|
11
|
+
## The Delivery API and the management API
|
|
10
12
|
|
|
11
|
-
Picked has two HTTP APIs. Use the one that fits
|
|
13
|
+
Picked has two HTTP APIs. Use the one that fits your work:
|
|
12
14
|
|
|
13
15
|
| | Delivery API | Management API |
|
|
14
16
|
| --- | --- | --- |
|
|
15
17
|
| Style | REST | GraphQL |
|
|
16
18
|
| Access | Public, anonymous | Authenticated |
|
|
17
19
|
| Operations | Read-only | Read and write |
|
|
18
|
-
| Use
|
|
20
|
+
| Use it to | Serve published options and content to your application | Control your projects, experiences, and content |
|
|
19
21
|
|
|
20
|
-
The
|
|
22
|
+
The [API Reference](/api) covers the management API. This section covers the Delivery
|
|
23
|
+
API.
|
|
21
24
|
|
|
22
25
|
## Base URL and versioning
|
|
23
26
|
|
|
@@ -27,20 +30,24 @@ All Delivery API routes are versioned under `/api/v1`:
|
|
|
27
30
|
https://api.picked.app/api/v1
|
|
28
31
|
```
|
|
29
32
|
|
|
30
|
-
## Published
|
|
33
|
+
## Published content and preview content
|
|
31
34
|
|
|
32
35
|
Each endpoint serves two surfaces:
|
|
33
36
|
|
|
34
|
-
- **Published** content is anonymous.
|
|
35
|
-
|
|
37
|
+
- **Published** content is anonymous. Anybody can read your published options and
|
|
38
|
+
your published content.
|
|
39
|
+
- **Preview** content needs a `preview_token` query parameter. With it you can render
|
|
40
|
+
an unpublished draft before you make it live.
|
|
36
41
|
|
|
37
|
-
|
|
42
|
+
The management API holds the preview token of a workspace in the `previewToken`
|
|
43
|
+
field. The preview action in the dashboard also makes one for you.
|
|
38
44
|
|
|
39
45
|
## Endpoints
|
|
40
46
|
|
|
41
47
|
| Endpoint | Description |
|
|
42
48
|
| --- | --- |
|
|
43
|
-
| [Project Config](/delivery-api/project-config) | `GET /api/v1/projects/:projectId` returns the published project
|
|
44
|
-
| [Experience Content](/delivery-api/experience-content) | `GET /api/v1/projects/:projectId/experiences/:id/content` returns the Content Entries
|
|
49
|
+
| [Project Config](/delivery-api/project-config) | `GET /api/v1/projects/:projectId` returns the published options of the project, with the content link of each step. |
|
|
50
|
+
| [Experience Content](/delivery-api/experience-content) | `GET /api/v1/projects/:projectId/experiences/:id/content` returns the Content Entries of an experience. |
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
Both endpoints share some behaviour. See
|
|
53
|
+
[Preview, cache, and crawlers](/delivery-api/preview-caching-crawling).
|
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
layout: docs
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Preview,
|
|
5
|
+
# Preview, cache, and crawlers
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Both Delivery API endpoints share this behaviour: the preview token, the cache, CORS,
|
|
8
|
+
and what a crawler can read.
|
|
8
9
|
|
|
9
10
|
## Preview tokens
|
|
10
11
|
|
|
11
|
-
Pass `?preview_token=<token>` to read unpublished content. Both endpoints
|
|
12
|
+
Pass `?preview_token=<token>` to read unpublished content. Both endpoints take it,
|
|
13
|
+
and both return `versionId: null` for a preview. An invalid token returns `401`.
|
|
12
14
|
|
|
13
15
|
```bash
|
|
14
16
|
curl "https://api.picked.app/api/v1/projects/proj_123?preview_token=<token>"
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
The [management API](/api) holds the preview token of a workspace in the
|
|
20
|
+
`previewToken` field. The preview action in the dashboard also makes one for you.
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
Use the same token for the project options request and for the experience content
|
|
23
|
+
request. Both then come from the same preview.
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
## Cache
|
|
26
|
+
|
|
27
|
+
The cache rules depend on the surface and on the client that makes the request. The
|
|
28
|
+
SDK sends a `Picked-Client: sdk` request header:
|
|
22
29
|
|
|
23
30
|
| Request | `Cache-Control` |
|
|
24
31
|
| --- | --- |
|
|
@@ -26,11 +33,14 @@ Caching depends on the surface and the requesting client. The SDK sends a `Picke
|
|
|
26
33
|
| Published, other clients | `private, no-store` |
|
|
27
34
|
| Preview | `no-store` |
|
|
28
35
|
|
|
29
|
-
|
|
36
|
+
A published response that a cache can hold also sends `Vary: Picked-Client`. A shared
|
|
37
|
+
cache therefore keys on the client header. It never gives a body that it cached for
|
|
38
|
+
the SDK to a request from another client.
|
|
30
39
|
|
|
31
40
|
## CORS
|
|
32
41
|
|
|
33
|
-
Both endpoints
|
|
42
|
+
Both endpoints can be read from another origin. An `OPTIONS` preflight returns `204`
|
|
43
|
+
with the CORS headers:
|
|
34
44
|
|
|
35
45
|
| Header | Value |
|
|
36
46
|
| --- | --- |
|
|
@@ -38,22 +48,25 @@ Both endpoints are cross-origin readable. An `OPTIONS` preflight returns `204` w
|
|
|
38
48
|
| `Access-Control-Allow-Methods` | `GET, OPTIONS` |
|
|
39
49
|
| `Access-Control-Allow-Headers` | `Content-Type, Picked-Client, Picked-Version, traceparent, tracestate` |
|
|
40
50
|
|
|
41
|
-
##
|
|
51
|
+
## Crawlers and search rank
|
|
42
52
|
|
|
43
|
-
|
|
53
|
+
A crawler can read both endpoints, so a search engine can read your published
|
|
54
|
+
content. A preview URL is disallowed, so a draft never reaches the index. These are
|
|
55
|
+
the `robots.txt` rules:
|
|
44
56
|
|
|
45
57
|
```
|
|
46
58
|
User-agent: *
|
|
47
59
|
|
|
48
|
-
#
|
|
60
|
+
# Let a crawler read the public project options and experience content.
|
|
49
61
|
Allow: /api/v1/projects
|
|
50
62
|
Allow: /api/v1/projects/*/experiences/*/content
|
|
51
63
|
|
|
52
|
-
# Keep preview
|
|
64
|
+
# Keep a preview response, which is a draft, away from a crawler.
|
|
53
65
|
Disallow: /api/v1/projects/*preview_token=
|
|
54
66
|
|
|
55
|
-
# Everything else
|
|
67
|
+
# Everything else stays disallowed: GraphQL, MCP, internal routes, and the ping.
|
|
56
68
|
Disallow: /
|
|
57
69
|
```
|
|
58
70
|
|
|
59
|
-
See [Project Config](/delivery-api/project-config) and
|
|
71
|
+
See [Project Config](/delivery-api/project-config) and
|
|
72
|
+
[Experience Content](/delivery-api/experience-content) for the endpoints.
|
|
@@ -15,7 +15,7 @@ GET /api/v1/projects/:projectId
|
|
|
15
15
|
| Parameter | In | Description |
|
|
16
16
|
| --- | --- | --- |
|
|
17
17
|
| `projectId` | path | The project to fetch config for. |
|
|
18
|
-
| `preview_token` | query | Optional.
|
|
18
|
+
| `preview_token` | query | Optional. With it, the endpoint returns the preview options, which are unpublished. |
|
|
19
19
|
|
|
20
20
|
## Response
|
|
21
21
|
|
|
@@ -25,11 +25,13 @@ The response carries the project's experiences and steps. Each step includes `la
|
|
|
25
25
|
| --- | --- | --- |
|
|
26
26
|
| `id` | `string` | The project id. |
|
|
27
27
|
| `versionId` | `string \| null` | The published version id, or `null` on preview. |
|
|
28
|
-
| `steps[].layoutContentId` | `string \| null` | The Content Entry
|
|
28
|
+
| `steps[].layoutContentId` | `string \| null` | The Content Entry of this step, or `null` when the step has no content. |
|
|
29
29
|
|
|
30
|
-
## Published
|
|
30
|
+
## Published content and preview content
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
For published content, `versionId` holds the ID of the published version. For preview
|
|
33
|
+
content, which you read with `?preview_token=...`, `versionId` is `null`, because
|
|
34
|
+
there is no published version. See [Preview, cache, and crawlers](/delivery-api/preview-caching-crawling).
|
|
33
35
|
|
|
34
36
|
## Example
|
|
35
37
|
|
|
@@ -6,9 +6,14 @@ import { Screenshot } from '../../components/Screenshot'
|
|
|
6
6
|
|
|
7
7
|
# Experiences
|
|
8
8
|
|
|
9
|
-
An experience is
|
|
9
|
+
An experience is personalized content that Picked serves to the visitors on your
|
|
10
|
+
site. Each experience points at a component that you register in your application.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
An experience is either a **Flow** or a **Page**. A **Flow** is an interactive
|
|
13
|
+
experience of more than one step, and the browser renders it. This page covers the
|
|
14
|
+
flow. A **Page** is a standalone experience that the server renders from CMS content,
|
|
15
|
+
for a landing page where the search rank matters. See [Pages](/content/pages) for
|
|
16
|
+
that kind.
|
|
12
17
|
|
|
13
18
|
<Screenshot
|
|
14
19
|
route="/{orgSlug}/{projectId}/workspaces/{workspaceId}/experiences"
|
|
@@ -20,23 +25,34 @@ Picked has two kinds of experience. A **Flow** is a multi-step, interactive expe
|
|
|
20
25
|
1. Open your project.
|
|
21
26
|
2. Click **Experiences** in the sidebar.
|
|
22
27
|
3. Click **New Experience**.
|
|
23
|
-
4. Enter a name and a component name. The component name must match a component
|
|
28
|
+
4. Enter a name and a component name. The component name must match a component that
|
|
29
|
+
you register in your application. See [SDK Experiences](/sdk/experiences) for how
|
|
30
|
+
to register a component.
|
|
24
31
|
5. Click **Create**.
|
|
25
32
|
|
|
26
|
-
The flow editor opens with an empty canvas. See
|
|
33
|
+
The flow editor opens with an empty canvas. See
|
|
34
|
+
[Build Flows](/flow-builder/building-flows) to add your first node.
|
|
27
35
|
|
|
28
36
|
## Experience settings
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
Choose no node on the canvas, or click the canvas background, to open the experience
|
|
39
|
+
inspector in the right panel.
|
|
31
40
|
|
|
32
|
-
**Name**: The
|
|
41
|
+
**Name**: The name that the dashboard shows. Your visitors do not see it.
|
|
33
42
|
|
|
34
|
-
**Component Name**: The identifier that
|
|
43
|
+
**Component Name**: The identifier that points this experience at a component in your
|
|
44
|
+
application.
|
|
35
45
|
|
|
36
|
-
**Condition**: An optional
|
|
46
|
+
**Condition**: An optional condition. When you set it, the experience starts only for
|
|
47
|
+
a visitor who matches the condition. See
|
|
48
|
+
[Condition Builder](/flow-builder/condition-builder) for how to write one. Keep it
|
|
49
|
+
blank to start the experience for every visitor.
|
|
37
50
|
|
|
38
|
-
**Initialize Open**: An optional condition that controls whether the experience opens
|
|
51
|
+
**Initialize Open**: An optional condition that controls whether the experience opens
|
|
52
|
+
by itself when the page loads. When it is blank, the experience loads but stays
|
|
53
|
+
closed until something opens it.
|
|
39
54
|
|
|
40
55
|
## Experience list
|
|
41
56
|
|
|
42
|
-
The experiences list shows
|
|
57
|
+
The experiences list shows every experience in the current project. Click an
|
|
58
|
+
experience to open it in the flow builder.
|
package/dist/docs/features.mdx
CHANGED
|
@@ -6,7 +6,8 @@ import { Screenshot } from '../../components/Screenshot'
|
|
|
6
6
|
|
|
7
7
|
# Feature flags
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
A feature flag lets you run an A/B test and roll a change out in stages. It controls
|
|
10
|
+
which visitors see a change to your site, and you deploy no code.
|
|
10
11
|
|
|
11
12
|
<Screenshot
|
|
12
13
|
route="/{orgSlug}/{projectId}/workspaces/{workspaceId}/features"
|
|
@@ -23,52 +24,106 @@ Feature flags let you run A/B tests and roll changes out gradually. Control whic
|
|
|
23
24
|
|
|
24
25
|
## Keys
|
|
25
26
|
|
|
26
|
-
Each feature flag has a unique key.
|
|
27
|
+
Each feature flag has a unique key. Your application uses this key to check whether
|
|
28
|
+
Picked allocates a visitor to the feature flag. You set the key when you create the
|
|
29
|
+
feature flag, and you cannot change it later.
|
|
27
30
|
|
|
28
31
|
## Configure allocation
|
|
29
32
|
|
|
30
|
-
Set allocation from the feature flag
|
|
33
|
+
Set the allocation from the detail page of the feature flag:
|
|
31
34
|
|
|
32
35
|
| Control | What it does |
|
|
33
36
|
| --- | --- |
|
|
34
|
-
| **Enabled** | Whether
|
|
35
|
-
| **Weight** | The percentage of visitors
|
|
36
|
-
| **Description** | An internal note
|
|
37
|
+
| **Enabled** | Whether Picked allocates a visitor to the feature flag. A feature flag that is off allocates nobody, and it records nothing. See [Turn a feature flag off](#turn-a-feature-flag-off). |
|
|
38
|
+
| **Weight** | The percentage of visitors that Picked allocates to the feature flag, from 0 to 100. |
|
|
39
|
+
| **Description** | An internal note about what the feature flag tests. |
|
|
37
40
|
|
|
38
|
-
A feature flag has one weight
|
|
41
|
+
A feature flag has one weight. For each visitor it gives one of two outcomes:
|
|
42
|
+
allocated, or not allocated. A weight of 30 allocates 30% of your visitors. The other
|
|
43
|
+
70% stay unallocated. A weight of 0 allocates nobody. A weight of 100 allocates
|
|
44
|
+
everybody.
|
|
39
45
|
|
|
40
46
|
## How visitors are allocated
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
The allocation is deterministic. Picked gives each visitor a stable value for each
|
|
49
|
+
feature flag. It derives that value from the visitor ID and from the ID of the feature
|
|
50
|
+
flag. It then compares the value against the weight. When the value is below the
|
|
51
|
+
weight, Picked allocates the visitor.
|
|
43
52
|
|
|
44
|
-
The same visitor always gets the same result, on every visit,
|
|
53
|
+
The same visitor always gets the same result for one feature flag, on every visit,
|
|
54
|
+
while the weight stays the same. The version is not part of that value. It controls
|
|
55
|
+
the cache only. See [Feature flag versions](#feature-flag-versions).
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
Each feature flag gets its own value, so tests that run at the same time are
|
|
58
|
+
independent. Two feature flags, both at weight 50, split your visitors into four equal
|
|
59
|
+
parts: allocated to both, to one, to the other, or to neither. Three feature flags at
|
|
60
|
+
weight 50 give eight groups of 12.5%.
|
|
48
61
|
|
|
49
|
-
|
|
62
|
+
:::note
|
|
63
|
+
Inside one feature flag, a larger weight only adds visitors. Everybody at weight 30 is
|
|
64
|
+
still allocated at weight 50, so you can make a release wider and move nobody who is
|
|
65
|
+
in it already. A smaller weight removes visitors from the top of the range.
|
|
66
|
+
:::
|
|
67
|
+
|
|
68
|
+
## Turn a feature flag off
|
|
69
|
+
|
|
70
|
+
A feature flag that is off allocates nobody, and it records nothing. The difference
|
|
71
|
+
from a weight of 0 matters for your reports. The visitor is **not in the test at
|
|
72
|
+
all**, and the visitor is not in the control group.
|
|
73
|
+
|
|
74
|
+
The SDK does not evaluate a feature flag that is off. It stores no decision in the
|
|
75
|
+
browser of the visitor, and it reports no decision to your analytics. Such a feature
|
|
76
|
+
flag is absent from the feature list on every analytics event.
|
|
50
77
|
|
|
51
|
-
|
|
78
|
+
An experience whose condition points at a feature flag that is off behaves as though
|
|
79
|
+
the visitor is not in the test. The condition reads as not allocated, and Picked
|
|
80
|
+
records no assignment.
|
|
81
|
+
|
|
82
|
+
This state is temporary, and it discards no decision that Picked made already. A
|
|
83
|
+
visitor who was allocated before keeps that decision in the browser. When you turn the
|
|
84
|
+
feature flag on again, Picked continues from that decision and does not allocate the
|
|
85
|
+
visitor again.
|
|
86
|
+
|
|
87
|
+
:::note
|
|
88
|
+
Expect a step change in your reports when you turn a feature flag off: fewer feature
|
|
89
|
+
flags for each visitor, and fewer decision events. That is the feature flag that drops
|
|
90
|
+
out, and you lose no data.
|
|
52
91
|
:::
|
|
53
92
|
|
|
93
|
+
A feature flag that is off stays visible in the developer tools, and a
|
|
94
|
+
[URL override](/sdk/features#overrides-in-the-url) still turns one on for QA.
|
|
95
|
+
|
|
54
96
|
## Feature flag versions
|
|
55
97
|
|
|
56
|
-
Each feature flag has a version number,
|
|
98
|
+
Each feature flag has a version number, and it starts at 1. The SDK caches an
|
|
99
|
+
allocation decision in the browser of the visitor under a key, and the version is part
|
|
100
|
+
of that key. The version does nothing else, and it is not an input to the allocation
|
|
101
|
+
value. When you increment the version, the SDK discards those cached decisions. It
|
|
102
|
+
then evaluates every visitor again on the next page load.
|
|
57
103
|
|
|
58
104
|
### What happens when you increment the version
|
|
59
105
|
|
|
60
|
-
- **
|
|
61
|
-
|
|
62
|
-
- **
|
|
106
|
+
- **The SDK invalidates the cached decisions.** The cache key holds the version, so the
|
|
107
|
+
old entry no longer matches and the feature flag counts as undecided.
|
|
108
|
+
- **Picked evaluates each visitor against the current weight.** The allocation is
|
|
109
|
+
deterministic and the version is not one of its inputs, so the same visitor against
|
|
110
|
+
an unchanged weight gives the same result.
|
|
111
|
+
- **You cannot reverse this.** There is no way to decrement a version.
|
|
63
112
|
|
|
64
113
|
:::note
|
|
65
|
-
|
|
114
|
+
The new version does not move your visitors between groups. It clears the cached
|
|
115
|
+
decisions and runs the allocation again. With an unchanged weight, everybody lands
|
|
116
|
+
where they were before. Change the weight to move your visitors.
|
|
66
117
|
:::
|
|
67
118
|
|
|
68
119
|
### When to increment
|
|
69
120
|
|
|
70
|
-
Increment the version after
|
|
121
|
+
Increment the version after you change the weight. Do this when you want Picked to
|
|
122
|
+
evaluate an allocated visitor again against the new weight, and not to use the cached
|
|
123
|
+
decision.
|
|
71
124
|
|
|
72
125
|
### When not to increment
|
|
73
126
|
|
|
74
|
-
|
|
127
|
+
To apply a weight change only to a visitor that Picked does not allocate yet, change
|
|
128
|
+
the weight and leave the version as it is. An allocated visitor keeps the current
|
|
129
|
+
allocation.
|
package/dist/docs/fields.mdx
CHANGED
|
@@ -6,9 +6,12 @@ import { Screenshot } from '../../components/Screenshot'
|
|
|
6
6
|
|
|
7
7
|
# Fields
|
|
8
8
|
|
|
9
|
-
A field is a data input
|
|
9
|
+
A field is a data input that a visitor sees inside a step. A field collects
|
|
10
|
+
information such as a name, an email address, a preference, or a choice.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
This page covers the experience field, which collects visitor input. An experience
|
|
13
|
+
field is not the same as a content field. A content field is part of the schema of a
|
|
14
|
+
CMS layout. See [Page and Step Layouts](/content/layouts) for those.
|
|
12
15
|
|
|
13
16
|
<Screenshot
|
|
14
17
|
route="/{orgSlug}/{projectId}/workspaces/{workspaceId}/fields"
|
|
@@ -20,60 +23,72 @@ These are experience Fields, which collect visitor input. They are distinct from
|
|
|
20
23
|
1. Open your project.
|
|
21
24
|
2. Click **Fields** in the sidebar.
|
|
22
25
|
3. Click **New Field**.
|
|
23
|
-
4. Enter a name, key, and label.
|
|
24
|
-
5.
|
|
26
|
+
4. Enter a name, a key, and a label.
|
|
27
|
+
5. Choose a type.
|
|
25
28
|
6. Click **Create**.
|
|
26
29
|
|
|
27
30
|
## Field types
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
A field has one of many types. These are the common ones:
|
|
30
33
|
|
|
31
|
-
`TEXT`: A string input. Use for
|
|
34
|
+
`TEXT`: A string input. Use it for a name, an email address, or free text.
|
|
32
35
|
|
|
33
|
-
`NUMBER`: A numeric input. Use for
|
|
36
|
+
`NUMBER`: A numeric input. Use it for a quantity, a rating, or an age.
|
|
34
37
|
|
|
35
|
-
`BOOLEAN`: A true
|
|
38
|
+
`BOOLEAN`: A true or false toggle. Use it for a checkbox or for consent.
|
|
36
39
|
|
|
37
|
-
`OBJECT`: A structured data input. Use for
|
|
40
|
+
`OBJECT`: A structured data input. Use it for data that holds other data.
|
|
38
41
|
|
|
39
|
-
##
|
|
42
|
+
## Options
|
|
40
43
|
|
|
41
|
-
**Name**:
|
|
44
|
+
**Name**: The name that the dashboard shows. Your visitors do not see it.
|
|
42
45
|
|
|
43
|
-
**Key**:
|
|
46
|
+
**Key**: The identifier for your application. You set it once and you cannot change
|
|
47
|
+
it. Your visitors do not see it.
|
|
44
48
|
|
|
45
|
-
**Label**: The label
|
|
49
|
+
**Label**: The label that a visitor sees next to the field.
|
|
46
50
|
|
|
47
|
-
**Placeholder**:
|
|
51
|
+
**Placeholder**: The hint text that the input shows while it is empty.
|
|
48
52
|
|
|
49
|
-
**Description**: A longer description of the field
|
|
53
|
+
**Description**: A longer description of what the field is for. The dashboard shows
|
|
54
|
+
it. Your visitors do not see it.
|
|
50
55
|
|
|
51
|
-
**Help Text**:
|
|
56
|
+
**Help Text**: Text below the field that helps your visitors.
|
|
52
57
|
|
|
53
|
-
**Default Value**: The
|
|
58
|
+
**Default Value**: The value that the field holds when it loads.
|
|
54
59
|
|
|
55
60
|
## Validation
|
|
56
61
|
|
|
57
|
-
**Required**: When
|
|
62
|
+
**Required**: When this is on, a visitor must fill in the field before the flow can
|
|
63
|
+
continue.
|
|
58
64
|
|
|
59
|
-
**Validation rules**:
|
|
65
|
+
**Validation rules**: Conditions for a constraint such as a smallest value, a largest
|
|
66
|
+
value, or a pattern. See [Condition Builder](/flow-builder/condition-builder) for how
|
|
67
|
+
to build a validation rule.
|
|
60
68
|
|
|
61
|
-
##
|
|
69
|
+
## More than one value
|
|
62
70
|
|
|
63
|
-
|
|
71
|
+
Turn on **Multiple** to let a visitor send more than one value for the field. This is
|
|
72
|
+
useful for an input that takes several choices, or for a field of tags.
|
|
64
73
|
|
|
65
|
-
##
|
|
74
|
+
## Choices
|
|
66
75
|
|
|
67
|
-
For
|
|
76
|
+
For a field with a fixed set of choices, such as a dropdown or a set of radio
|
|
77
|
+
buttons, add options. Each option has a value, and the response carries that value.
|
|
68
78
|
|
|
69
|
-
Each option can also
|
|
79
|
+
Each option can also carry a condition. When you set one, the option appears only to
|
|
80
|
+
a visitor who matches the condition. See
|
|
81
|
+
[Condition Builder](/flow-builder/condition-builder) for more detail.
|
|
70
82
|
|
|
71
83
|
## Privacy
|
|
72
84
|
|
|
73
|
-
**Do Not Track**: When
|
|
85
|
+
**Do Not Track**: When this is on, Picked keeps the data of this field out of your
|
|
86
|
+
analytics.
|
|
74
87
|
|
|
75
|
-
**Do Not Store**: When
|
|
88
|
+
**Do Not Store**: When this is on, Picked reads the data of this field but does not
|
|
89
|
+
keep it. Use it for sensitive information such as a password or payment detail.
|
|
76
90
|
|
|
77
91
|
## Reuse fields
|
|
78
92
|
|
|
79
|
-
|
|
93
|
+
A field is a project-level entity. Assign the same field to steps in more than one
|
|
94
|
+
experience. A change to the options of a field applies at every place that uses it.
|