picked 0.0.1-dev.1795137316505 → 0.0.1-dev.1795567554153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/docs/how-to/debug-with-the-chrome-extension.md +2 -3
- package/docs/reference/apps/app-kit.md +5 -4
- package/docs/reference/dashboard/labels.md +90 -51
- package/docs/reference/dashboard/workflow-tools.md +20 -17
- package/docs/reference/management-api/error-handling.md +1 -0
- package/docs/reference/management-api/schema/auth.md +19 -17
- package/docs/reference/management-api/schema/common.md +24 -0
- package/docs/reference/management-api/schema/index.md +3 -3
- package/docs/reference/management-api/schema/label.md +23 -14
- package/docs/reference/management-api/schema/mcp-server.md +8 -1
- package/docs/reference/management-api/schema/organization.md +7 -0
- package/docs/reference/management-api/schema/project.md +5 -2
- package/docs/reference/sdk/actions.md +13 -8
- package/docs/reference/sdk/svelte.md +1 -3
- package/docs/reference/tools/admin-api-client.md +5 -0
- package/docs/reference/tools/cli.md +5 -4
- package/docs/reference/tools/mcp.md +5 -0
- package/package.json +5 -6
- package/docs/how-to/add-a-tool-to-the-devtools.md +0 -136
- package/docs/how-to/send-issues-to-your-tracker.md +0 -133
|
@@ -12,10 +12,9 @@ See [Management API schema](/reference/management-api/schema) for every domain,
|
|
|
12
12
|
|
|
13
13
|
### `labelsSet`
|
|
14
14
|
|
|
15
|
-
Creates or replaces labels on
|
|
16
|
-
|
|
17
|
-
`ORGANIZATION_PROJECTS_UPDATE`.
|
|
18
|
-
Scope: `ORGANIZATION_LEADS_UPDATE` or `ORGANIZATION_PROJECTS_UPDATE`.
|
|
15
|
+
Creates or replaces labels on an owner. Labels the call does not name are unchanged. Each owner
|
|
16
|
+
type needs the write scope `LabelOwnerType` lists for it.
|
|
17
|
+
Scope: `ORGANIZATION_LEADS_UPDATE`, `ORGANIZATION_PROJECTS_UPDATE`, `ORGANIZATION_APPS_UPDATE` or `ORGANIZATION_UPDATE`.
|
|
19
18
|
|
|
20
19
|
```graphql
|
|
21
20
|
labelsSet(input: LabelsSetInput!): LabelsSetPayload! @auth
|
|
@@ -23,10 +22,9 @@ labelsSet(input: LabelsSetInput!): LabelsSetPayload! @auth
|
|
|
23
22
|
|
|
24
23
|
### `labelsDelete`
|
|
25
24
|
|
|
26
|
-
Deletes labels from
|
|
27
|
-
|
|
28
|
-
`ORGANIZATION_PROJECTS_UPDATE`.
|
|
29
|
-
Scope: `ORGANIZATION_LEADS_UPDATE` or `ORGANIZATION_PROJECTS_UPDATE`.
|
|
25
|
+
Deletes labels from an owner. Deleting a label that is not set succeeds. Each owner type needs
|
|
26
|
+
the write scope `LabelOwnerType` lists for it.
|
|
27
|
+
Scope: `ORGANIZATION_LEADS_UPDATE`, `ORGANIZATION_PROJECTS_UPDATE`, `ORGANIZATION_APPS_UPDATE` or `ORGANIZATION_UPDATE`.
|
|
30
28
|
|
|
31
29
|
```graphql
|
|
32
30
|
labelsDelete(input: LabelsDeleteInput!): LabelsDeletePayload! @auth
|
|
@@ -62,9 +60,12 @@ The kind of entity a label is on. Each kind is read and written under its own sc
|
|
|
62
60
|
| `PROJECT` | `ORGANIZATION_PROJECTS_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
|
|
63
61
|
| `WORKFLOW_RUN` | `ORGANIZATION_WORKSPACE_READ` | `ORGANIZATION_PROJECTS_UPDATE` |
|
|
64
62
|
| `APP_INSTALLATION` | `ORGANIZATION_APPS_READ` | `ORGANIZATION_APPS_UPDATE` |
|
|
63
|
+
| `ORGANIZATION` | `ORGANIZATION_READ` | `ORGANIZATION_UPDATE` |
|
|
65
64
|
|
|
66
65
|
A workflow run reads and writes its own labels without a scope, and so does an app installation
|
|
67
|
-
calling with its own token.
|
|
66
|
+
calling with its own token. Every member of an organisation holds `ORGANIZATION_READ` on it and
|
|
67
|
+
reads its labels; writing them takes `ORGANIZATION_UPDATE` granted across the organisation. An
|
|
68
|
+
API key limited to one project reaches neither.
|
|
68
69
|
"""
|
|
69
70
|
enum LabelOwnerType {
|
|
70
71
|
"""A lead. Its labels are deleted with it."""
|
|
@@ -77,6 +78,11 @@ enum LabelOwnerType {
|
|
|
77
78
|
An app installation. Its labels are deleted when the app is uninstalled.
|
|
78
79
|
"""
|
|
79
80
|
APP_INSTALLATION
|
|
81
|
+
"""
|
|
82
|
+
An organisation. The owner ID is the organization ID, and every project in the organization
|
|
83
|
+
shares its labels.
|
|
84
|
+
"""
|
|
85
|
+
ORGANIZATION
|
|
80
86
|
}
|
|
81
87
|
```
|
|
82
88
|
|
|
@@ -84,8 +90,8 @@ enum LabelOwnerType {
|
|
|
84
90
|
|
|
85
91
|
```graphql
|
|
86
92
|
"""
|
|
87
|
-
A name and a value on a lead, a project, a workflow run
|
|
88
|
-
label per namespace and key, and an expired label reads as absent everywhere.
|
|
93
|
+
A name and a value on a lead, a project, a workflow run, an app installation or an organization.
|
|
94
|
+
An owner holds one label per namespace and key, and an expired label reads as absent everywhere.
|
|
89
95
|
"""
|
|
90
96
|
type Label {
|
|
91
97
|
"""The ID of the label."""
|
|
@@ -111,7 +117,9 @@ type Label {
|
|
|
111
117
|
updatedAt: DateTime!
|
|
112
118
|
"""When the label expires. Null when it does not expire."""
|
|
113
119
|
expiresAt: DateTime
|
|
114
|
-
"""
|
|
120
|
+
"""
|
|
121
|
+
The lead, project, workflow run, app installation or organization the label is on.
|
|
122
|
+
"""
|
|
115
123
|
owner: LabelOwner!
|
|
116
124
|
}
|
|
117
125
|
```
|
|
@@ -120,9 +128,10 @@ type Label {
|
|
|
120
128
|
|
|
121
129
|
```graphql
|
|
122
130
|
"""
|
|
123
|
-
The entity a label is on: a lead, a project, a workflow run
|
|
131
|
+
The entity a label is on: a lead, a project, a workflow run, an app installation or an
|
|
132
|
+
organization.
|
|
124
133
|
"""
|
|
125
|
-
union LabelOwner = Lead | Project | WorkflowRun | AppInstallation
|
|
134
|
+
union LabelOwner = Lead | Project | WorkflowRun | AppInstallation | Organization
|
|
126
135
|
```
|
|
127
136
|
|
|
128
137
|
### `LabelOperation`
|
|
@@ -41,7 +41,9 @@ mcpServerUpdate(input: McpServerUpdateInput!): McpServerUpdatePayload! @auth(onl
|
|
|
41
41
|
|
|
42
42
|
### `mcpServerUrlSet`
|
|
43
43
|
|
|
44
|
-
Replaces an MCP server's URL.
|
|
44
|
+
Replaces an MCP server's URL. Of the URL, the result shows only `urlDisplay`. A URL on another
|
|
45
|
+
origin (scheme, host and port) removes the auth header unless `authHeader` supplies one;
|
|
46
|
+
`hasAuthHeaderValue` in the result shows whether the server holds one.
|
|
45
47
|
Scope: `ORGANIZATION_INTEGRATIONS_UPDATE`.
|
|
46
48
|
|
|
47
49
|
```graphql
|
|
@@ -201,6 +203,11 @@ input McpServerUrlSetInput {
|
|
|
201
203
|
id: ID!
|
|
202
204
|
"""The new URL, held to the rules of `McpServerRegisterInput.url`."""
|
|
203
205
|
url: String!
|
|
206
|
+
"""
|
|
207
|
+
The auth header to store with the URL, replacing the server's current one. Null keeps the current
|
|
208
|
+
header when the URL stays on the same origin and removes it when the URL moves to another.
|
|
209
|
+
"""
|
|
210
|
+
authHeader: McpAuthHeaderInput
|
|
204
211
|
}
|
|
205
212
|
```
|
|
206
213
|
|
|
@@ -201,6 +201,13 @@ type Organization {
|
|
|
201
201
|
Scope: `ORGANIZATION_API_KEYS_READ`.
|
|
202
202
|
"""
|
|
203
203
|
apiKeys(first: Int, after: String): ApiKeyConnection!
|
|
204
|
+
"""
|
|
205
|
+
The organization's own labels, such as a counter or a lock that every project in it shares,
|
|
206
|
+
ordered by namespace then key. Expired labels are left out. Write them with `labelsSet` and
|
|
207
|
+
`ownerType: ORGANIZATION`.
|
|
208
|
+
Scope: `ORGANIZATION_READ`.
|
|
209
|
+
"""
|
|
210
|
+
labels: [Label!]! @auth
|
|
204
211
|
"""The scopes the viewer holds in the organization."""
|
|
205
212
|
viewerScopes: [Scope!]!
|
|
206
213
|
"""
|
|
@@ -368,8 +368,11 @@ type Project {
|
|
|
368
368
|
last: Int
|
|
369
369
|
before: String
|
|
370
370
|
): SavedViewConnection! @auth
|
|
371
|
-
"""
|
|
372
|
-
|
|
371
|
+
"""
|
|
372
|
+
The preview environments of the project, oldest first.
|
|
373
|
+
Scope: `ORGANIZATION_PROJECTS_READ`.
|
|
374
|
+
"""
|
|
375
|
+
previewEnvironments: [ProjectPreviewEnvironment!]! @auth
|
|
373
376
|
}
|
|
374
377
|
```
|
|
375
378
|
|
|
@@ -87,21 +87,26 @@ A published action waits for the response of its workflow. It stops after 30 sec
|
|
|
87
87
|
| Cause | The action rejects with |
|
|
88
88
|
| --- | --- |
|
|
89
89
|
| Picked refuses the request | An `Error` that names the HTTP status |
|
|
90
|
+
| Picked refuses the request with a `429` status 4 times | `RateLimitError` |
|
|
90
91
|
| Picked does not accept the request in 25 seconds | A `TimeoutError` |
|
|
91
92
|
| Picked accepts the request, but gives no run to wait for | An `Error` that says that no run is available |
|
|
92
93
|
| The workflow fails before it sends a response | `ActionRunFailedError` |
|
|
93
|
-
| Picked refuses a request for the response with a `4xx` status | An `Error` that names the HTTP status |
|
|
94
|
+
| Picked refuses a request for the response with a `4xx` status other than `429` | An `Error` that names the HTTP status |
|
|
94
95
|
| No response in 30 seconds | `ActionResponseTimeoutError` |
|
|
95
96
|
| Your code stops the wait with a signal | The reason of the signal |
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
the first failure, and two times longer after each failure that follows. If the requests
|
|
100
|
-
continue to fail, the 30-second limit stops the wait with `ActionResponseTimeoutError`.
|
|
98
|
+
When Picked refuses a request with a `429` status, the SDK waits about 1 second and sends the
|
|
99
|
+
request again. It does this 3 times at most. The time limit of the request includes these waits.
|
|
101
100
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
A request for the response can fail because of a network error or a timeout. It can also fail
|
|
102
|
+
because of a `429` or `5xx` status, or a body that the SDK cannot read. The SDK then sends the
|
|
103
|
+
request again. It waits 1 second after the first failure, and two times longer after each
|
|
104
|
+
failure that follows. If the requests continue to fail, the 30-second limit stops the wait with
|
|
105
|
+
`ActionResponseTimeoutError`.
|
|
106
|
+
|
|
107
|
+
To identify `ActionRunFailedError`, `ActionResponseTimeoutError` and `RateLimitError` with
|
|
108
|
+
`instanceof`, import them from `@picked/client/plugins/dynamic-experiences`. The `name` of each
|
|
109
|
+
error is the same as the name that you import.
|
|
105
110
|
|
|
106
111
|
## Run an action from code
|
|
107
112
|
|
|
@@ -54,9 +54,7 @@ const client = createClient({
|
|
|
54
54
|
| Option | Type | Default | Description |
|
|
55
55
|
| --- | --- | --- | --- |
|
|
56
56
|
| `enabled` | `boolean` | `false` | When `true`, the devtools open on page load. When `false`, the Chrome extension opens them. |
|
|
57
|
-
| `customTools` | `CustomTool[]` | `[]` | Your own tools
|
|
58
|
-
| `issues` | `IssueReportingOptions` | none | Where the **Report an issue** tab sends issues. See [How to send issues to your tracker](/how-to/send-issues-to-your-tracker). |
|
|
59
|
-
| `developerMode` | `boolean` | `false` | When `true`, the devtools open in developer mode. Developer mode also shows the SDK screens and **Custom Tools**. A viewer can change it in **Settings**. |
|
|
57
|
+
| `customTools` | `CustomTool[]` | `[]` | Your own tools, which show in the Custom Tools tab. |
|
|
60
58
|
|
|
61
59
|
When a preview token is there, the devtools launcher shows, even if `enabled` is `false`.
|
|
62
60
|
See [How to debug with the Chrome extension](/how-to/debug-with-the-chrome-extension).
|
|
@@ -60,9 +60,14 @@ The client does not check the shape of the response at runtime.
|
|
|
60
60
|
|
|
61
61
|
## Errors
|
|
62
62
|
|
|
63
|
+
When the API refuses a request with a `429` status, the client waits about 1 second and
|
|
64
|
+
sends the request again. It does this 3 times at most. `options.timeoutMs` includes these
|
|
65
|
+
waits.
|
|
66
|
+
|
|
63
67
|
| Case | Error |
|
|
64
68
|
| --- | --- |
|
|
65
69
|
| The API returns GraphQL errors | `AdminApiResponseError`. Its `codes` holds the `extensions.code` of each error. |
|
|
70
|
+
| The API refuses the request with a `429` status 4 times | `AdminApiRateLimitError` |
|
|
66
71
|
| A network failure, a timeout, or an HTTP error without GraphQL errors | `Error` |
|
|
67
72
|
|
|
68
73
|
See [Errors](/reference/management-api/error-handling) for each error code.
|
|
@@ -397,10 +397,11 @@ export default defineConfig({
|
|
|
397
397
|
})
|
|
398
398
|
```
|
|
399
399
|
|
|
400
|
-
| Key
|
|
401
|
-
|
|
|
402
|
-
| `app`
|
|
403
|
-
| `apiUrl`
|
|
400
|
+
| Key | Description |
|
|
401
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
402
|
+
| `app` | The manifest. See [App manifest](/reference/apps/manifest) for the fields. |
|
|
403
|
+
| `apiUrl` | The Picked API origin that the `app` commands use. `PICKED_API_URL` replaces it. The default is production. |
|
|
404
|
+
| `customHeaders` | More headers that the CLI sends with each API request. When a name is the same, the CLI sends its own header. |
|
|
404
405
|
|
|
405
406
|
A config with no `projectId` and no `app` section does not load. The CLI then stops with
|
|
406
407
|
status 1 and gives the reason. See
|
|
@@ -72,6 +72,11 @@ Gives the link to create an organization in the dashboard. The MCP server cannot
|
|
|
72
72
|
|
|
73
73
|
Gives the link to create a project in the dashboard. The MCP server cannot create a project.
|
|
74
74
|
|
|
75
|
+
#### `open_dashboard`
|
|
76
|
+
|
|
77
|
+
Opens the dashboard on a project, an organization, or your landing page. Claude shows this
|
|
78
|
+
tool as a start point for Picked, so you can open the dashboard in Claude without a prompt.
|
|
79
|
+
|
|
75
80
|
### Workspaces
|
|
76
81
|
|
|
77
82
|
#### `create_workspace`
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "picked",
|
|
3
3
|
"description": "The Picked SDK front door: the client, the picked.config helpers, and the picked CLI in one install",
|
|
4
|
-
"version": "0.0.1-dev.
|
|
4
|
+
"version": "0.0.1-dev.1795567554153",
|
|
5
5
|
"bin": {
|
|
6
6
|
"picked": "dist/esm/bin.js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@picked/cli": "0.0.1-dev.
|
|
10
|
-
"@picked/config": "0.0.1-dev.
|
|
9
|
+
"@picked/cli": "0.0.1-dev.1795567554153",
|
|
10
|
+
"@picked/config": "0.0.1-dev.1795567554153"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@picked/client": "workspace:*",
|
|
@@ -63,8 +63,7 @@
|
|
|
63
63
|
"@picked/config",
|
|
64
64
|
"@repo/eslint-config",
|
|
65
65
|
"@repo/typescript-config",
|
|
66
|
-
"@repo/vitest-config"
|
|
67
|
-
"@vitest/coverage-v8"
|
|
66
|
+
"@repo/vitest-config"
|
|
68
67
|
],
|
|
69
68
|
"ignore": [
|
|
70
69
|
"eslint.config.js"
|
|
@@ -74,7 +73,7 @@
|
|
|
74
73
|
"main": "./dist/cjs/index.js",
|
|
75
74
|
"module": "./dist/esm/index.js",
|
|
76
75
|
"peerDependencies": {
|
|
77
|
-
"@picked/client": "0.0.1-dev.
|
|
76
|
+
"@picked/client": "0.0.1-dev.1795567554153"
|
|
78
77
|
},
|
|
79
78
|
"private": false,
|
|
80
79
|
"publishConfig": {
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
type: how-to
|
|
3
|
-
layout: docs
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# How to add a tool to the devtools
|
|
7
|
-
|
|
8
|
-
This guide shows you how to add a tool of your own to the Picked devtools panel. Before you start,
|
|
9
|
-
add `svelteDevtoolsPlugin` to your client.
|
|
10
|
-
|
|
11
|
-
## 1. Write the tool as a component
|
|
12
|
-
|
|
13
|
-
Write the tool in the framework of your application. The tool gets the live Picked client, as an
|
|
14
|
-
experience component does. In React, use `usePicked()`. In Svelte, use `getPicked()`.
|
|
15
|
-
|
|
16
|
-
## 2. Add the tool to the plugin
|
|
17
|
-
|
|
18
|
-
Adapt the component for its framework, then add it to `customTools`. Each tool has a unique `id`
|
|
19
|
-
and a `label`.
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import { createClient } from 'picked'
|
|
23
|
-
import { adaptReactComponent } from '@picked/react'
|
|
24
|
-
import { reactFrameworkPlugin } from '@picked/react/plugins/framework'
|
|
25
|
-
import { svelteFrameworkPlugin } from '@picked/svelte/plugins/framework'
|
|
26
|
-
import { svelteDevtoolsPlugin } from '@picked/svelte/plugins/devtools'
|
|
27
|
-
import TestCustomers from './TestCustomers'
|
|
28
|
-
|
|
29
|
-
const picked = createClient({
|
|
30
|
-
projectId: 'your-project-id',
|
|
31
|
-
plugins: [
|
|
32
|
-
reactFrameworkPlugin({ components: {} }),
|
|
33
|
-
svelteFrameworkPlugin({ components: {} }),
|
|
34
|
-
svelteDevtoolsPlugin({
|
|
35
|
-
customTools: [
|
|
36
|
-
{
|
|
37
|
-
id: 'test-customers',
|
|
38
|
-
label: 'Test customers',
|
|
39
|
-
component: adaptReactComponent(TestCustomers),
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
}),
|
|
43
|
-
],
|
|
44
|
-
})
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
The devtools panel is a Svelte application. If your tool uses a different framework, also
|
|
48
|
-
register the framework plugin for that framework. If the framework is not registered, the tab
|
|
49
|
-
shows a warning in place of the tool.
|
|
50
|
-
|
|
51
|
-
## 3. Choose where the tool shows
|
|
52
|
-
|
|
53
|
-
By default, the tool is an entry of its own in the main list of the sidebar. To show it in a
|
|
54
|
-
different place, set `placement`.
|
|
55
|
-
|
|
56
|
-
| `placement` | Where the tool shows |
|
|
57
|
-
| --- | --- |
|
|
58
|
-
| Not set | An entry of its own in the main list, below the review tabs. |
|
|
59
|
-
| `'review'` | A tab of its own in the main list, below the review tabs. |
|
|
60
|
-
| `'responses'` | A section of **Responses**, below **Saved responses**. The label of the tool is the heading of the section. |
|
|
61
|
-
| `'create'` | An option of **Create**, in **Saved responses**. The label of the tool is the name of the option. When the tool saves responses, **Create** closes. |
|
|
62
|
-
| `'footer'` | An icon at the bottom of the menu, next to **Auto-hide button**. The label shows when the pointer is on the icon. |
|
|
63
|
-
|
|
64
|
-
Add a `description` to show a short text above the tool. Add a `guide` to give steps for the tool.
|
|
65
|
-
The steps show when you click the information icon next to the title of the tool. For a
|
|
66
|
-
`'responses'` tool or a `'create'` tool, the steps show when you click the information icon of
|
|
67
|
-
**Responses**, below the label of the tool.
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
{
|
|
71
|
-
id: 'test-customers',
|
|
72
|
-
label: 'Test customers',
|
|
73
|
-
component: adaptReactComponent(TestCustomers),
|
|
74
|
-
placement: 'review',
|
|
75
|
-
description: 'Pick a test customer, then walk the journey as that customer.',
|
|
76
|
-
guide: {
|
|
77
|
-
steps: ['Open **Test customers**.', 'Click **Show me** next to a customer.'],
|
|
78
|
-
notes: ['The customers are test data. Do not use real names.'],
|
|
79
|
-
},
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
For a `'footer'` tool, set `icon` to `'bug'` or `'wrench'`. The default is `'wrench'`.
|
|
84
|
-
|
|
85
|
-
## 4. Read the session
|
|
86
|
-
|
|
87
|
-
If your tool must know what the visitor did, call `getDevtoolsSession(client)`. It gives the
|
|
88
|
-
session record, and whether the session is read-only.
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
import { getDevtoolsSession } from '@picked/svelte/plugins/devtools'
|
|
92
|
-
|
|
93
|
-
const devtools = getDevtoolsSession(client)
|
|
94
|
-
const route = devtools?.session.routeStore.getState() ?? []
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
The session record holds the screens that the visitor entered, the answers on each screen, and
|
|
98
|
-
the route through the journey. If `devtools.posture.readOnly` is `true`, the tool must not write.
|
|
99
|
-
|
|
100
|
-
## 5. Save responses
|
|
101
|
-
|
|
102
|
-
A tool can save a set of responses. Do this when the code of your site sets the route, and the
|
|
103
|
-
panel cannot build the responses. **Saved responses**, in the **Responses** tab, shows them below
|
|
104
|
-
**Saved in this browser**.
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
import { getDevtoolsSession } from '@picked/svelte/plugins/devtools'
|
|
108
|
-
|
|
109
|
-
const result = getDevtoolsSession(client)?.savedResponses.save({
|
|
110
|
-
name: 'Mover with an account',
|
|
111
|
-
responses: { purpose: 'moving' },
|
|
112
|
-
entryUrl: '/moving-home',
|
|
113
|
-
site: { account: 'fixture-12' },
|
|
114
|
-
})
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
If `result.ok` is `false`, `result.error` tells why. The `site` object holds data that your code
|
|
118
|
-
reads when a walk-through starts. To read it, set `walkThrough.setup` on the plugin. If the panel
|
|
119
|
-
cannot build the responses for your site, set `buildFromFields` to `false`. Then **Create** does
|
|
120
|
-
not show the fields of each step. To show your tool in **Create**, set its `placement` to
|
|
121
|
-
`'create'`.
|
|
122
|
-
|
|
123
|
-
```typescript
|
|
124
|
-
svelteDevtoolsPlugin({
|
|
125
|
-
buildFromFields: false,
|
|
126
|
-
walkThrough: {
|
|
127
|
-
setup: (saved, client) => useFixtureAccount(client, saved.site.account),
|
|
128
|
-
},
|
|
129
|
-
})
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Related
|
|
133
|
-
|
|
134
|
-
- [Svelte SDK](/reference/sdk/svelte#devtools-plugin) — the options of the devtools plugin.
|
|
135
|
-
- [How to debug with the Chrome extension](/how-to/debug-with-the-chrome-extension)
|
|
136
|
-
- [How to register a component](/how-to/register-a-component)
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
type: how-to
|
|
3
|
-
layout: docs
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# How to send issues to your tracker
|
|
7
|
-
|
|
8
|
-
This guide shows you how to send issues from the devtools panel to your issue tracker.
|
|
9
|
-
Before you start, add `svelteDevtoolsPlugin` to your client.
|
|
10
|
-
|
|
11
|
-
Users write issues in the **Report an issue** tab. To open the tab, click the icon at the
|
|
12
|
-
bottom of the devtools menu. If you do not set up the tab, it shows a link to this guide.
|
|
13
|
-
|
|
14
|
-
## 1. Add an endpoint to your server
|
|
15
|
-
|
|
16
|
-
Add an endpoint that receives an issue from the devtools and creates it in your tracker. Keep the credentials
|
|
17
|
-
of your tracker on your server, not in the page.
|
|
18
|
-
|
|
19
|
-
The endpoint receives an `IssueReport` as JSON. Send the `title` and the `body` to your tracker.
|
|
20
|
-
The `body` is Markdown. It holds the description, then the context of the issue as lines and as
|
|
21
|
-
JSON.
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
import type { IssueReport } from '@picked/svelte/plugins/devtools'
|
|
25
|
-
|
|
26
|
-
export async function POST(request: Request): Promise<Response> {
|
|
27
|
-
const submitted: IssueReport = await request.json()
|
|
28
|
-
const issue = await createIssueInYourTracker({
|
|
29
|
-
title: submitted.title,
|
|
30
|
-
body: submitted.body,
|
|
31
|
-
labels: submitted.labels,
|
|
32
|
-
})
|
|
33
|
-
return Response.json({ reference: issue.key, url: issue.url })
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
The endpoint must return the reference of the issue and its URL. The devtools show both to the
|
|
38
|
-
user. If the endpoint returns an error status, the devtools tell the user that the issue
|
|
39
|
-
was not sent, and keep the form.
|
|
40
|
-
|
|
41
|
-
| Field | What it holds |
|
|
42
|
-
| --- | --- |
|
|
43
|
-
| `title` | The title of the issue. |
|
|
44
|
-
| `description` | The text that the user wrote. |
|
|
45
|
-
| `kind` | `'bug'`, `'improvement'` or `'feature'`. |
|
|
46
|
-
| `priority` | `'none'`, `'low'`, `'medium'`, `'high'` or `'urgent'`. |
|
|
47
|
-
| `labels` | The labels that the user kept. |
|
|
48
|
-
| `attachments` | The attached images and files. Each has a `filename`, a `contentType` and its `data` as `base64` text. |
|
|
49
|
-
| `context` | The experience, the step, the page, the route, the responses and the saved responses that the reviewer walks through, as JSON. |
|
|
50
|
-
| `reporter` | The name of the user who sent the issue, or `null`. See step 5. |
|
|
51
|
-
| `body` | The name of the reporter, the description and the context, as Markdown. |
|
|
52
|
-
|
|
53
|
-
## 2. Send the issues to your endpoint
|
|
54
|
-
|
|
55
|
-
Set the `issues` option of the devtools plugin. `siteEndpoint` sends each issue to your
|
|
56
|
-
endpoint.
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
import { siteEndpoint, svelteDevtoolsPlugin } from '@picked/svelte/plugins/devtools'
|
|
60
|
-
|
|
61
|
-
svelteDevtoolsPlugin({
|
|
62
|
-
issues: {
|
|
63
|
-
sink: siteEndpoint('/api/report-issue'),
|
|
64
|
-
},
|
|
65
|
-
})
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
To send a header with each issue, add `headers`:
|
|
69
|
-
`siteEndpoint('/api/report-issue', { headers: { 'x-site': 'staging' } })`.
|
|
70
|
-
|
|
71
|
-
## 3. Add labels and facts about your site
|
|
72
|
-
|
|
73
|
-
Each issue can start with labels. The user can remove a label before they send the issue.
|
|
74
|
-
To add facts about your site to each issue, set `context`. Each fact must be a JSON value.
|
|
75
|
-
|
|
76
|
-
```typescript
|
|
77
|
-
svelteDevtoolsPlugin({
|
|
78
|
-
issues: {
|
|
79
|
-
sink: siteEndpoint('/api/report-issue'),
|
|
80
|
-
labels: (context) => (context.experience ? [`exp/${context.experience.key}`] : []),
|
|
81
|
-
context: () => ({ release: '2026.11' }),
|
|
82
|
-
},
|
|
83
|
-
})
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
## 4. Hide personal data
|
|
87
|
-
|
|
88
|
-
By default, an issue keeps each response that is an option of its field, a number, or a short
|
|
89
|
-
number of seven digits or fewer. It hides all other text and each response that is an object.
|
|
90
|
-
Fields in `codeOwnedFields` are not sent.
|
|
91
|
-
Before the user sends the issue, they can remove each part of the context.
|
|
92
|
-
|
|
93
|
-
To decide the value of each response, set `redact`. Return the value to send. Return `undefined`
|
|
94
|
-
to remove the response from the issue.
|
|
95
|
-
|
|
96
|
-
```typescript
|
|
97
|
-
svelteDevtoolsPlugin({
|
|
98
|
-
issues: {
|
|
99
|
-
sink: siteEndpoint('/api/report-issue'),
|
|
100
|
-
redact: (key, value) => (key === 'medicare_number' ? undefined : value),
|
|
101
|
-
},
|
|
102
|
-
})
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## 5. Ask who sends the issue
|
|
106
|
-
|
|
107
|
-
If your tracker creates all issues with one account, ask each user for their name. Set
|
|
108
|
-
`reporter` to `'optional'` or `'required'`. The tab then shows a **Reporter** field. If you set
|
|
109
|
-
`'required'`, the user cannot send an issue without a name.
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
svelteDevtoolsPlugin({
|
|
113
|
-
issues: {
|
|
114
|
-
sink: siteEndpoint('/api/report-issue'),
|
|
115
|
-
reporter: 'required',
|
|
116
|
-
},
|
|
117
|
-
})
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
The browser keeps the name for the next issue. The `body` starts with the name.
|
|
121
|
-
|
|
122
|
-
## 6. Try an issue again
|
|
123
|
-
|
|
124
|
-
Each issue holds its context as a JSON block, so you can save its responses from each tracker.
|
|
125
|
-
Open **Responses** and click **Create**. Choose **Use context object**, paste the
|
|
126
|
-
description of the issue, then click **Save**. A walk-through of these responses starts on the page
|
|
127
|
-
of the issue. The responses that the issue hides are not saved.
|
|
128
|
-
|
|
129
|
-
## Related
|
|
130
|
-
|
|
131
|
-
- [Svelte SDK](/reference/sdk/svelte#devtools-plugin) — the options of the devtools plugin.
|
|
132
|
-
- [How to add a tool to the devtools](/how-to/add-a-tool-to-the-devtools)
|
|
133
|
-
- [How to debug with the Chrome extension](/how-to/debug-with-the-chrome-extension)
|