@plitzi/sdk-interactions 0.38.23 → 0.39.0
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/CHANGELOG.md +174 -1
- package/dist/InteractionsHelper.mjs +71 -70
- package/dist/sources/ActionsSource/ActionInteractions.mjs +4 -2
- package/dist/sources/ActionsSource/callbacks.mjs +2 -1
- package/dist/sources/AuthSource/AuthInteractions.mjs +7 -5
- package/dist/sources/AuthSource/callbacks.mjs +17 -0
- package/dist/sources/NavigationSource/NavigationInteractions.mjs +24 -24
- package/dist/sources/NavigationSource/callbacks.mjs +6 -0
- package/dist/sources/NavigationSource/navigateHow.d.ts +6 -0
- package/dist/sources/NavigationSource/navigateHow.mjs +7 -0
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,178 @@
|
|
|
1
1
|
# @plitzi/sdk-interactions
|
|
2
2
|
|
|
3
|
+
## 0.39.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 587c35b: A team of agents on one project (`plitzi run`, `plitzi task`), the page tools those agents measure with, tests kept in
|
|
8
|
+
the space, and what authoring and the elements learnt from the runs. Each command and option is in the CLI's README;
|
|
9
|
+
how the runs work, in `docs/en/agent-runs.md`.
|
|
10
|
+
|
|
11
|
+
## To do when you upgrade
|
|
12
|
+
- **Node 24.** `engines` is `^24.22.1 || >=26.12.1`; Node 22 is no longer supported (`plitzi doctor` says it,
|
|
13
|
+
`doctor --fix` raises an older project's `engines`).
|
|
14
|
+
- **`createServer({ outbound: { privateOrigins } })` replaces `allowPrivatePluginHosts`:** a space's requests reach no
|
|
15
|
+
private address but the origins named (`privateOrigins: ['http://localhost:9000']`).
|
|
16
|
+
- **Job queues from 0.38.20 or before are recreated, not upgraded:** `createMongoJobQueue` / `createMysqlJobQueue` empty
|
|
17
|
+
or drop the old `action_jobs` / `action_kv` and make them again; `mysqlJobSchemaUpgrades` is gone.
|
|
18
|
+
- **`PLITZI_KV_FILE` is `PLITZI_STATE_DIR`**, a folder holding the server's `kv` and job queue.
|
|
19
|
+
- **A social provider's `fetchProfile` takes `{ accessToken, idToken, nonce }`**, and `createSocialAuth(...).start` is
|
|
20
|
+
async.
|
|
21
|
+
- **A `DraftStore` of a deployment's own keeps `inspected`** beside `reusable`, or a test session renders without the
|
|
22
|
+
state bridge.
|
|
23
|
+
- **`navigation.navigate(url, { external, replace })`** takes an object where it took `navigate(url, true)`.
|
|
24
|
+
- **`window.__plitzi.setSource` / `setAttribute` may answer `{ refused }`**: read it before treating the answer as written.
|
|
25
|
+
- **Renamed:** `stepText` → `e2eStepText` (a run's `said` is the step in words); `OverQuotaNotice` → `QuotaNotice` and
|
|
26
|
+
its classes `plitzi-quota-notice…`; `sightOf` / `sightText` come from `@plitzi/sdk-shared/devTools/sight`.
|
|
27
|
+
- **`SchemaVariables` and `StyleVariables` draw no add button of their own:** the holder passes `adding`, `onAddingEnd`
|
|
28
|
+
and optionally `empty`.
|
|
29
|
+
- **A page handed to `runE2eTest`** has `selectOption`, `position` in `click`/`hover` and `evaluate(fn, arg)`, as a
|
|
30
|
+
Playwright locator: a hand-written page adds them.
|
|
31
|
+
- **Journey steps play as the page commands do:** `scroll` with `dx`/`dy` scrolls the element's content, `waitFor`
|
|
32
|
+
waits 10 s, `type` replaces a field's value.
|
|
33
|
+
- **Authoring refuses more:** two flows of one element naming a step alike (`step-duplicate`), `visible` written as an
|
|
34
|
+
expression (`visible-expression`), a step condition naming a source by id alone (`condition-short-source`).
|
|
35
|
+
`navbar` / `navbarItem` are no longer read by `specFromSpace`.
|
|
36
|
+
- **`/robots.txt` ends naming its sitemap** unless the space's own text does.
|
|
37
|
+
- **The CLI's part of a project is `.plitzi/`** (it was split with `plitzi/`): `plitzi doctor --fix` moves it, and a
|
|
38
|
+
tsconfig names `.plitzi/**/*`.
|
|
39
|
+
- **`plitzi upgrade`** brings the new scripts (`start:preview`, the visual suite's server on 8400, `test`), the ignores
|
|
40
|
+
for `.plitzi/plitzi-reports/` and the skills. `test` runs the project's own tests, so red tests now fail
|
|
41
|
+
`plitzi verify` and a run's checks.
|
|
42
|
+
- **Reports to Plitzi live in `.plitzi/plitzi-reports/`**, committed: a run's in `runs/<run>/`, an agent's in
|
|
43
|
+
`agents/<date>/`. The old files are read no more.
|
|
44
|
+
- **The CLI's surface is smaller — one command for each thing.** Old names and flags are refused naming the new one;
|
|
45
|
+
`plitzi upgrade skills --write` updates the agents' skills. The main moves: `run plan` / `run rehearse` →
|
|
46
|
+
`run open --dry-run [--rehearse]`; `run extend` → `run open <stage>`; `run purge` → `run abort`; `task take` →
|
|
47
|
+
`task next <task>`; `task ask` / `block` / `note` → `task tell --ask | --blocked | --handoff`; `task wait` / `release`
|
|
48
|
+
→ `task claim --wait | --release`; `task request` → `task propose --file`; `task check --before | --mutate` →
|
|
49
|
+
`task prove`; `run feedback` → `run report --plitzi`; `functions pull|push` → `space pull|push functions`;
|
|
50
|
+
`runtime push` → `space push runtime`; `page shot --live` / `--clip` → `--fresh` / `--within`; `PLITZI_TASK_TOKEN` →
|
|
51
|
+
`PLITZI_TOKEN`.
|
|
52
|
+
- **Research and reviews are cards on one board:** `task spike` and the separate UI review are gone; a card's `review`
|
|
53
|
+
names its roles in order. Runs opened before keep working.
|
|
54
|
+
- **Page commands:** `page check --expect` fails only on what it expects; every page command reads at 900 px tall
|
|
55
|
+
(`--height`); a page that sends a guest away is read signed in as the project's account (`--as`, `--guest`).
|
|
56
|
+
- **`create --from`** names page files by the page's name; a space's functions are pushed without their tests.
|
|
57
|
+
|
|
58
|
+
## A space's tests (`@plitzi/sdk-authoring`, `@plitzi/sdk-shared`, `@plitzi/plitzi-builder`, `@plitzi/sdk-mcp`)
|
|
59
|
+
- **Tests are part of the space's document** (`Schema.tests`): unit tests (element checks) and journeys (what a visitor
|
|
60
|
+
does), authored in code, edited in the builder's Tests area, played on the canvas or the server. See
|
|
61
|
+
`docs/en/space-tests.md`.
|
|
62
|
+
- **Journeys play signed in as test accounts** (`tests.accounts`), carry tags, can be held and stopped
|
|
63
|
+
(`runE2eTest`'s `beforeStep`), and hold element checks (`e2e.expectCheck`).
|
|
64
|
+
- **`plitzi test [id…]`** runs a project's tests; **`plitzi_test`** lets an agent run them over the MCP. What a plan
|
|
65
|
+
allows (`journeysPerSpace`, `serverRunsPerMonth`) is in its entitlements; a `canTest` grant writes tests alone.
|
|
66
|
+
|
|
67
|
+
## Several agents on one project (`@plitzi/cli`)
|
|
68
|
+
- **A run is a kanban:** a lead plans, reviews and closes; developers, testers, designers and scouts take cards with
|
|
69
|
+
`task next`, each in its own copy of the project; every card is reviewed by the roles it names, step by step.
|
|
70
|
+
Nothing reaches the project until a person applies the run (`run finish --apply`).
|
|
71
|
+
- **Files are owned by imports:** one agent per file, shared files taken by turns or changed by agreement
|
|
72
|
+
(`task propose`), merged line by line, checked on the whole result.
|
|
73
|
+
- **The run keeps itself going:** a keeper starts the agents work is waiting for, and holds
|
|
74
|
+
starts after the harness's limit or repeated quick exits until the lead allows them (`run hold`, `run allow`).
|
|
75
|
+
- **`run monitor`:** the run live in a terminal — board, flow, agents, spend, activity — with an emergency panel (`!`)
|
|
76
|
+
to pause, resume, hold or allow agents.
|
|
77
|
+
- **A change mid-run says what it reaches:** `run open <stage> --dry-run` and `run amend --dry-run` name the approved
|
|
78
|
+
tasks, tasks at work and tests each change touches, read off the import graph.
|
|
79
|
+
- **Reviews see what goes in:** a review taken says whether the task merges with the run's newer work and, if not, the
|
|
80
|
+
failing lines; `task show <file> --merged` and `task look --merged` read and serve the merge;
|
|
81
|
+
`task look --alone <element> --with '{…}'` draws a component or plugin no page places yet. A step's time stops while
|
|
82
|
+
its reviewer proves or looks.
|
|
83
|
+
- **Proofs:** `task prove --before` (what each acceptance line proves against the run before the task) and
|
|
84
|
+
`--mutate` (whether a task's tests catch a broken change, with a control run).
|
|
85
|
+
- **The finish:** `run finish` checks the whole result and stops at the first failing line; `--every-line` reports
|
|
86
|
+
them all. The run then leaves its reports in `.plitzi/plitzi-reports/runs/<run>/`.
|
|
87
|
+
- **A report to Plitzi holds nothing of the person or the project:** a run's `feedback.md` writes over names, emails,
|
|
88
|
+
addresses, IPs, the project's files, tasks and elements, leaves out what was said of the project alone, and lists
|
|
89
|
+
quoted passages for the person to read before sending. `plitzi feedback` carries no project name, asks the developer
|
|
90
|
+
before anything of the project goes in, and `plitzi feedback --check <file>` names what a filled report still holds.
|
|
91
|
+
|
|
92
|
+
## Page tools (`@plitzi/cli`, `@plitzi/sdk-authoring`)
|
|
93
|
+
- **`page measure`** reads what an element draws (`--only drawn`, `box-*`, `attr:<name>`, `accessible-name`,
|
|
94
|
+
`scroll-*`, custom properties) and holds bounds and positions (`--expect "width<=44px"`, `"a.bottom + 8 <= b.top"`).
|
|
95
|
+
- **`page play`** plays steps — `drag … hold`, `scroll page 1500`, `click <el> 30%,60%` — reads what is drawn, not
|
|
96
|
+
what is in the DOM, and `--motion` plays animations moving. A press is made once and waits for the page to take it.
|
|
97
|
+
- **`page check`** says what a visitor cannot reach, text cut or spilling, canvases left blank, the server's error page
|
|
98
|
+
when the space does not author, and holds a text whole (`=`) or in part (`~`).
|
|
99
|
+
- **`page shot`** waits for canvases, pictures hovers (`--hover`, `--frames`) and parts (`--within`), and says what it
|
|
100
|
+
could not picture.
|
|
101
|
+
- **Every page command reads a page as one visitor from the same flags** (`--as`, `--guest`, `--width`, `--height`,
|
|
102
|
+
`--fresh`), with a browser driver of the CLI's own.
|
|
103
|
+
|
|
104
|
+
## Authoring (`@plitzi/sdk-authoring`)
|
|
105
|
+
- **New checks:** a server provider the page server cannot read (`server-query-unresolved`) or that reads browser state
|
|
106
|
+
(`server-when-unknown`), an action without `runtime: 'server'` (`server-source-in-browser`), class overrides,
|
|
107
|
+
messages arriving while a flow runs, unused plugins.
|
|
108
|
+
- **New authoring:** `focus('field')`, a factory for every trigger, the scroll family's sides, `pagesIn(...)` to
|
|
109
|
+
register pages by folder, channel topics with a choice, a plugin's imported stylesheets read for its tokens.
|
|
110
|
+
- **An element drawn alone:** a server started with `PLITZI_PREVIEW_FILE` gets a page for one element at
|
|
111
|
+
`/plitzi-preview` (`withPreview`, `SpacePreviewError`) — what `task look --alone` uses.
|
|
112
|
+
|
|
113
|
+
## Elements and the SDK (`@plitzi/sdk-elements`, `@plitzi/plitzi-sdk`, `@plitzi/sdk-shared`)
|
|
114
|
+
- **Navigation:** `navigate` can replace the address, and a navigation inside the site leaves the scroll as a page
|
|
115
|
+
load would.
|
|
116
|
+
- **Providers:** a `when` holds the same in the browser and on the page server; a server provider can read another
|
|
117
|
+
site's address while the page is built.
|
|
118
|
+
- **Plans and roles in the contract:** entitlements (`TSpaceEntitlements`), the space role (`TSpaceAccess`), the quota
|
|
119
|
+
warning at 80% (`render.quotaNear`) and the "Made with Plitzi" badge (`PlitziBadge`).
|
|
120
|
+
- **Fixes:** a binding's `sourceTo` is the previous value; an element with no tag and no `visible` draws nothing;
|
|
121
|
+
placeholder words never reach a page; notifications stay open for a visitor who asked for less motion.
|
|
122
|
+
|
|
123
|
+
## Server (`@plitzi/sdk-server`, `@plitzi/sdk-auth`, `@plitzi/sdk-mcp`)
|
|
124
|
+
- **`/sitemap.xml`** for every space, and `/robots.txt` naming it.
|
|
125
|
+
- **Accounts:** terms accepted at sign-up (MySQL schema version 7), single sign-on with any OpenID Connect issuer
|
|
126
|
+
(`createOidcProvider`), providers resolved at run time, a password that may not sign in, `/auth/continue` with a step
|
|
127
|
+
of the deployment's own, a signed-out visitor never signed back in by a stale answer.
|
|
128
|
+
- **Policy adapters:** metering can hold a page back (503), decide the badge and `noindex`; the MCP can cap tool calls
|
|
129
|
+
and names the space's plan; realtime admits spaces per deployment.
|
|
130
|
+
- **Dev server:** a removed plugin folder is unregistered (`PluginRegistry.unregister`), and a space that does not
|
|
131
|
+
author is said whole, with no stack.
|
|
132
|
+
|
|
133
|
+
## The builder (`@plitzi/plitzi-builder`)
|
|
134
|
+
- **A Tests area** with journeys played beside the page at the journey's device, and element checks.
|
|
135
|
+
- **One way to build a panel**, a header grouped by what its controls do, and the layout's mask dimming only what the
|
|
136
|
+
layout draws.
|
|
137
|
+
- **Plans and roles shown:** what the role allows (`useSpaceAccess`), what the plan leaves out shown locked, the plan
|
|
138
|
+
and its spend in the header; pages left out of the sitemap marked.
|
|
139
|
+
|
|
140
|
+
## Dev tools (`@plitzi/sdk-dev-tools`)
|
|
141
|
+
- **`element(id).visible` is what a visitor sees** (`sightOf`), with why not; `element(id).resolved` says what each
|
|
142
|
+
binding gave; a refused server action is a `refused` step.
|
|
143
|
+
- **Report what you see** in the Run tab of a run's preview, and the panel docks at the bottom under 900 px.
|
|
144
|
+
|
|
145
|
+
## The workspace
|
|
146
|
+
- **No file past 600 lines of code** (`max-lines`), and ESLint's `quotes` rule is gone — Prettier writes them.
|
|
147
|
+
|
|
148
|
+
### Patch Changes
|
|
149
|
+
|
|
150
|
+
- Updated dependencies [587c35b]
|
|
151
|
+
- @plitzi/sdk-auth@0.39.0
|
|
152
|
+
- @plitzi/sdk-event-bridge@0.39.0
|
|
153
|
+
- @plitzi/sdk-shared@0.39.0
|
|
154
|
+
|
|
155
|
+
## 0.38.24
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- 5858b9f: ## Server
|
|
160
|
+
|
|
161
|
+
- **`ctx.oauth.callbackUrl()`** (`@plitzi/sdk-server`) — PZ-161. The address providers send a visitor back to, as this
|
|
162
|
+
run's `connect` hands it to them: for a page that shows whoever sets up the app what to register, instead of
|
|
163
|
+
rebuilding the platform's rule. Refused in a run no visitor's request started when the deployment fixed no
|
|
164
|
+
`functions.oauth.callbackOrigin`.
|
|
165
|
+
- **In production the project's server fixes no OAuth callback** (`@plitzi/sdk-server`). 0.38.23's loopback default
|
|
166
|
+
applied wherever `PUBLIC_URL` was not HTTPS — a container behind a proxy sent providers to its own
|
|
167
|
+
`http://127.0.0.1:8080`. Now loopback is the default while developing only; in production the callback is on the
|
|
168
|
+
address each visitor's request came on (the site's domain, from `Host` and `X-Forwarded-Proto`), and the server says
|
|
169
|
+
to register that domain's `/fn/oauth/callback`.
|
|
170
|
+
|
|
171
|
+
- Updated dependencies [5858b9f]
|
|
172
|
+
- @plitzi/sdk-auth@0.38.24
|
|
173
|
+
- @plitzi/sdk-event-bridge@0.38.24
|
|
174
|
+
- @plitzi/sdk-shared@0.38.24
|
|
175
|
+
|
|
3
176
|
## 0.38.23
|
|
4
177
|
|
|
5
178
|
### Patch Changes
|
|
@@ -3656,7 +3829,7 @@ author`, `plitzi_validate`/`plitzi_apply`, `plitzi explain` and the builder's pr
|
|
|
3656
3829
|
- **Devices are listed by device, not by session.** `GET /devices/sessions` groups sessions by what they were created
|
|
3657
3830
|
from and answers this device apart; a browser that signed in forty times is one row saying "40 sessions". The list
|
|
3658
3831
|
had shipped and drawn every session — 1,218 for one account a test suite signs in as — inside a box that scrolled.
|
|
3659
|
-
- **Every device is named for what it is**: the application as it registered over OAuth (`Plitzi CLI on
|
|
3832
|
+
- **Every device is named for what it is**: the application as it registered over OAuth (`Plitzi CLI on dev-laptop`,
|
|
3660
3833
|
`Plitzi Desktop on studio`), a browser and its system, an automated client (Playwright, headless Chrome) — never a
|
|
3661
3834
|
raw user agent. Sessions record their address and **when they were last used** (at most every five minutes, on the
|
|
3662
3835
|
lookup a request already makes). A sign-in deletes the account's dead sessions.
|
|
@@ -1,109 +1,110 @@
|
|
|
1
1
|
import { coerceDeclaredParams as e } from "./helpers/coerceDeclaredParams.mjs";
|
|
2
2
|
import t from "./utility/index.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { ruleValuesOf as n } from "@plitzi/sdk-shared/helpers";
|
|
4
|
+
import { get as r, omit as i } from "@plitzi/plitzi-ui/helpers";
|
|
5
|
+
import { QueryBuilderEvaluator as a } from "@plitzi/plitzi-ui/QueryBuilder/evaluator";
|
|
6
|
+
import { pConsole as o } from "@plitzi/sdk-shared/devTools";
|
|
7
|
+
import { MAX_PARAM_PASSES as s, resolveStepParam as c } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
8
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
9
|
//#region src/InteractionsHelper.tsx
|
|
9
|
-
var
|
|
10
|
+
var f = 5, p = (e, t, n, r, i) => {
|
|
10
11
|
if (e === "utility" && i === "twigTemplate") return t;
|
|
11
|
-
let
|
|
12
|
+
let a = {
|
|
12
13
|
...n,
|
|
13
14
|
...r
|
|
14
|
-
},
|
|
15
|
+
}, l = (e, t, n) => {
|
|
15
16
|
if (typeof e == "string") {
|
|
16
|
-
let { value: n, unresolved: r } =
|
|
17
|
-
return r &&
|
|
17
|
+
let { value: n, unresolved: r } = c(e, a);
|
|
18
|
+
return r && o.warning("interactions", /* @__PURE__ */ d("span", { children: [
|
|
18
19
|
"Twig token resolution exceeded ",
|
|
19
|
-
|
|
20
|
+
s,
|
|
20
21
|
" passes for ",
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
+
/* @__PURE__ */ u("b", { children: t }),
|
|
22
23
|
", leaving unresolved tokens"
|
|
23
24
|
] }), {
|
|
24
25
|
param: t,
|
|
25
26
|
value: n
|
|
26
27
|
}), n;
|
|
27
28
|
}
|
|
28
|
-
return n >=
|
|
29
|
+
return n >= f || typeof e != "object" || !e ? e : Array.isArray(e) ? e.map((e) => l(e, t, n + 1)) : Object.fromEntries(Object.entries(e).map(([e, r]) => [e, l(r, t, n + 1)]));
|
|
29
30
|
};
|
|
30
31
|
return Object.keys(t).reduce((n, r) => {
|
|
31
|
-
let i = e === "trigger" ? t[r] :
|
|
32
|
+
let i = e === "trigger" ? t[r] : l(t[r], r, 0);
|
|
32
33
|
return {
|
|
33
34
|
...n,
|
|
34
35
|
[r]: i
|
|
35
36
|
};
|
|
36
37
|
}, {});
|
|
37
|
-
},
|
|
38
|
-
let
|
|
38
|
+
}, m = (e) => typeof e == "object" && !!e && "then" in e && typeof e.then == "function", h = (i, s = {}, c = {}, l = {}, f = {}) => {
|
|
39
|
+
let h = [], { id: g, action: _, enabled: v, params: y, elementId: b, type: x, when: S } = i;
|
|
39
40
|
if (!_ || !v) return {
|
|
40
41
|
status: "disabled",
|
|
41
42
|
result: {},
|
|
42
|
-
postCallbacks:
|
|
43
|
+
postCallbacks: h
|
|
43
44
|
};
|
|
44
|
-
let C =
|
|
45
|
+
let C = n({
|
|
46
|
+
...l,
|
|
45
47
|
...c,
|
|
46
|
-
...s,
|
|
47
48
|
[g]: y
|
|
48
49
|
});
|
|
49
|
-
if (S && !
|
|
50
|
+
if (S && !a(S, C)) return {
|
|
50
51
|
status: "skipped",
|
|
51
52
|
result: {},
|
|
52
|
-
postCallbacks:
|
|
53
|
+
postCallbacks: h,
|
|
53
54
|
whenParams: C
|
|
54
55
|
};
|
|
55
|
-
let w = (e) => (
|
|
56
|
+
let w = (e) => (o.danger("interactions", /* @__PURE__ */ d("span", { children: ["Interaction node failed ", /* @__PURE__ */ u("b", { children: _ })] }), {
|
|
56
57
|
error: e instanceof Error ? e.message : String(e),
|
|
57
|
-
node:
|
|
58
|
+
node: i
|
|
58
59
|
}), {
|
|
59
60
|
status: "failed",
|
|
60
61
|
result: {},
|
|
61
|
-
postCallbacks:
|
|
62
|
+
postCallbacks: h,
|
|
62
63
|
whenParams: C
|
|
63
64
|
}), T;
|
|
64
65
|
switch (x) {
|
|
65
66
|
case "callback":
|
|
66
67
|
case "globalCallback":
|
|
67
|
-
if (!b) return
|
|
68
|
+
if (!b) return o.warning("interactions", /* @__PURE__ */ d("span", { children: [
|
|
68
69
|
"Step ",
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ u("b", { children: _ }),
|
|
70
71
|
" names no element, so there is nothing to run it on"
|
|
71
|
-
] }), { node:
|
|
72
|
+
] }), { node: i }), {
|
|
72
73
|
status: "failed",
|
|
73
74
|
result: {},
|
|
74
|
-
postCallbacks:
|
|
75
|
+
postCallbacks: h,
|
|
75
76
|
whenParams: C
|
|
76
77
|
};
|
|
77
|
-
if (T =
|
|
78
|
+
if (T = r(s, `${b}.${_}`), !T) return o.warning("interactions", /* @__PURE__ */ d("span", { children: [
|
|
78
79
|
"Nothing is registered as ",
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ u("b", { children: `${b}.${_}` }),
|
|
80
81
|
", so this step did nothing"
|
|
81
82
|
] }), {
|
|
82
|
-
node:
|
|
83
|
-
available: Object.keys(
|
|
83
|
+
node: i,
|
|
84
|
+
available: Object.keys(r(s, b, {}))
|
|
84
85
|
}), {
|
|
85
86
|
status: "failed",
|
|
86
87
|
result: {},
|
|
87
|
-
postCallbacks:
|
|
88
|
+
postCallbacks: h,
|
|
88
89
|
whenParams: C
|
|
89
90
|
};
|
|
90
91
|
break;
|
|
91
92
|
case "utility":
|
|
92
|
-
T =
|
|
93
|
+
T = r(t, _, {});
|
|
93
94
|
break;
|
|
94
95
|
default: return {
|
|
95
96
|
status: "success",
|
|
96
97
|
result: {},
|
|
97
|
-
postCallbacks:
|
|
98
|
+
postCallbacks: h,
|
|
98
99
|
whenParams: C
|
|
99
100
|
};
|
|
100
101
|
}
|
|
101
102
|
try {
|
|
102
103
|
let t = {
|
|
103
|
-
...s,
|
|
104
104
|
...c,
|
|
105
|
-
...
|
|
106
|
-
|
|
105
|
+
...l,
|
|
106
|
+
...e(T.params, p(x, y, c, l, _))
|
|
107
|
+
}, { callback: n, postCallback: r } = T, i = (e) => (r && h.push({
|
|
107
108
|
id: g,
|
|
108
109
|
callback: r,
|
|
109
110
|
params: {
|
|
@@ -113,44 +114,44 @@ var d = 5, f = (e, t, n, r, i) => {
|
|
|
113
114
|
}), {
|
|
114
115
|
status: "success",
|
|
115
116
|
result: e,
|
|
116
|
-
postCallbacks:
|
|
117
|
+
postCallbacks: h,
|
|
117
118
|
whenParams: C
|
|
118
|
-
}), a = n ? n(t,
|
|
119
|
-
return
|
|
119
|
+
}), a = n ? n(t, f) : {};
|
|
120
|
+
return m(a) ? Promise.resolve(a).then(i, w) : i(a);
|
|
120
121
|
} catch (e) {
|
|
121
122
|
return w(e);
|
|
122
123
|
}
|
|
123
|
-
},
|
|
124
|
+
}, g = async (e = []) => {
|
|
124
125
|
let t = {};
|
|
125
|
-
return await Promise.all(e.reverse().map(async ({ id: e, callback: n, params:
|
|
126
|
-
t[e] = await n?.(r
|
|
126
|
+
return await Promise.all(e.reverse().map(async ({ id: e, callback: n, params: r }) => {
|
|
127
|
+
t[e] = await n?.(i(r, [e]), r[e]);
|
|
127
128
|
})), t;
|
|
128
|
-
},
|
|
129
|
+
}, _ = () => ({}), v = async (e, t = {}, n = {}, i = {}, a = _, s = [], c = {}, l = {}) => {
|
|
129
130
|
let u = e, d = i;
|
|
130
131
|
for (; u;) {
|
|
131
132
|
if (l.signal?.aborted) return c;
|
|
132
|
-
let e =
|
|
133
|
-
if (!e) return s.length > 0 && await
|
|
134
|
-
let i =
|
|
133
|
+
let e = r(t, u.afterNode);
|
|
134
|
+
if (!e) return s.length > 0 && await g(s), c;
|
|
135
|
+
let i = o.getTime().valueOf(), f = h(e, n, d, a(), l), p = m(f) ? await f : f, { result: _, postCallbacks: v, whenParams: y } = p, b = p.status === "failed" && l.signal?.aborted ? "skipped" : p.status;
|
|
135
136
|
c[e.id] = {
|
|
136
137
|
node: e,
|
|
137
138
|
status: b,
|
|
138
|
-
result:
|
|
139
|
+
result: _,
|
|
139
140
|
postCallbacks: v,
|
|
140
141
|
whenParams: y,
|
|
141
142
|
startTime: i,
|
|
142
|
-
endTime:
|
|
143
|
+
endTime: o.getTime().valueOf()
|
|
143
144
|
}, s.push(...v), d = {
|
|
144
145
|
...d,
|
|
145
|
-
[e.id]:
|
|
146
|
+
[e.id]: _
|
|
146
147
|
}, u = e;
|
|
147
148
|
}
|
|
148
149
|
return c;
|
|
149
|
-
},
|
|
150
|
-
let
|
|
150
|
+
}, y = (e, t, n = {}, r, i) => {
|
|
151
|
+
let a = o.getTime().valueOf(), s = r === "skipped" ? "skipped" : "success", c = /* @__PURE__ */ d("span", { children: [
|
|
151
152
|
"Interaction triggered ",
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
i ? /* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ u("b", { children: `${e.title} [${e.action}]` }),
|
|
154
|
+
i ? /* @__PURE__ */ d(l, { children: [" on ", /* @__PURE__ */ u("b", { children: i })] }) : null
|
|
154
155
|
] }), f = {
|
|
155
156
|
status: r,
|
|
156
157
|
node: e,
|
|
@@ -164,27 +165,27 @@ var d = 5, f = (e, t, n, r, i) => {
|
|
|
164
165
|
result: void 0,
|
|
165
166
|
postCallbacks: [],
|
|
166
167
|
startTime: t,
|
|
167
|
-
endTime:
|
|
168
|
+
endTime: a
|
|
168
169
|
}
|
|
169
170
|
},
|
|
170
171
|
startTime: t,
|
|
171
|
-
endTime:
|
|
172
|
+
endTime: a
|
|
172
173
|
};
|
|
173
|
-
r === "failed" ?
|
|
174
|
-
},
|
|
175
|
-
let
|
|
176
|
-
if (!
|
|
177
|
-
...
|
|
178
|
-
...
|
|
174
|
+
r === "failed" ? o.danger("interactions", c, f) : o.info("interactions", c, f);
|
|
175
|
+
}, b = (e) => Object.values(e).some(({ status: e }) => e === "failed") ? "failed" : "completed", x = async (e, t = {}, r = {}, i = {}, s = _, c, l, u = []) => {
|
|
176
|
+
let d = o.getTime().valueOf(), { action: f, enabled: p, when: m } = e;
|
|
177
|
+
if (!f || !p || m && !a(m, n({
|
|
178
|
+
...s(),
|
|
179
|
+
...i
|
|
179
180
|
}))) {
|
|
180
|
-
|
|
181
|
+
y(e, d, {}, "skipped", c);
|
|
181
182
|
return;
|
|
182
183
|
}
|
|
183
|
-
let h = await
|
|
184
|
-
hostElementId:
|
|
185
|
-
...
|
|
184
|
+
let h = await v(e, t, r, i, s, u, {}, {
|
|
185
|
+
hostElementId: c,
|
|
186
|
+
...l ? { signal: l } : {}
|
|
186
187
|
});
|
|
187
|
-
|
|
188
|
-
},
|
|
188
|
+
y(e, d, h, b(h), c);
|
|
189
|
+
}, S = { flowTrigger: x };
|
|
189
190
|
//#endregion
|
|
190
|
-
export {
|
|
191
|
+
export { S as default, x as flowTrigger };
|
|
@@ -67,7 +67,8 @@ var x = (e) => Array.isArray(e) ? e : void 0, S = async (e, t) => {
|
|
|
67
67
|
actionId: e,
|
|
68
68
|
runId: t.runId ?? "",
|
|
69
69
|
error: t.error ?? "",
|
|
70
|
-
reason: t.reason ?? "failed"
|
|
70
|
+
reason: t.reason ?? "failed",
|
|
71
|
+
...t.code ? { code: t.code } : {}
|
|
71
72
|
}), k = ({ children: y }) => {
|
|
72
73
|
let { useInteractions: b, interactionsManager: k } = i(e), [A] = v("actions.endpoint"), [[j, M]] = v(["actions.catalog", "actions.available"]), N = a((e, t, n) => {
|
|
73
74
|
e && k.interactionTrigger(e, t, n);
|
|
@@ -339,7 +340,8 @@ var x = (e) => Array.isArray(e) ? e : void 0, S = async (e, t) => {
|
|
|
339
340
|
status: r(P.status),
|
|
340
341
|
runId: P.runId ?? "",
|
|
341
342
|
output: P.output ?? {},
|
|
342
|
-
...P.error ? { error: P.error } : {}
|
|
343
|
+
...P.error ? { error: P.error } : {},
|
|
344
|
+
...P.code ? { code: P.code } : {}
|
|
343
345
|
}) : (E(M.status, P, A), j(D(P)), N(t?.hostElementId, "onFlowError", O(n, P)), s.warning("actions", /* @__PURE__ */ f("span", { children: [
|
|
344
346
|
"Server action ",
|
|
345
347
|
/* @__PURE__ */ d("b", { children: n }),
|
|
@@ -5,18 +5,20 @@ import { toInteractionCallbacks as i } from "@plitzi/sdk-shared/authoring";
|
|
|
5
5
|
import { AuthContext as a } from "@plitzi/sdk-auth";
|
|
6
6
|
//#region src/sources/AuthSource/AuthInteractions.tsx
|
|
7
7
|
var o = ({ children: o }) => {
|
|
8
|
-
let { login: s, refresh: c, logout: l,
|
|
9
|
-
return
|
|
8
|
+
let { login: s, refresh: c, logout: l, logoutEverywhere: u, provider: d } = n(a), { useInteractions: f } = n(e);
|
|
9
|
+
return f({
|
|
10
10
|
id: "auth",
|
|
11
|
-
callbacks: r(() => !
|
|
11
|
+
callbacks: r(() => !d || !s || !c || !l ? {} : i(t, {
|
|
12
12
|
login: (e) => s(e),
|
|
13
13
|
refreshDetails: (e) => c(e),
|
|
14
|
-
logout: () => l()
|
|
14
|
+
logout: () => l(),
|
|
15
|
+
logoutEverywhere: (e) => u ? u(e.scope === "all" ? "all" : "site").then(() => ({ ok: !0 })) : Promise.reject(/* @__PURE__ */ Error(`The ${d} sign-in has no way to sign out everywhere`))
|
|
15
16
|
}), [
|
|
16
17
|
s,
|
|
17
18
|
l,
|
|
19
|
+
u,
|
|
18
20
|
c,
|
|
19
|
-
|
|
21
|
+
d
|
|
20
22
|
])
|
|
21
23
|
}), o;
|
|
22
24
|
};
|
|
@@ -83,6 +83,23 @@ var e = {
|
|
|
83
83
|
title: "Auth Logout",
|
|
84
84
|
strictParams: !0,
|
|
85
85
|
params: {}
|
|
86
|
+
},
|
|
87
|
+
logoutEverywhere: {
|
|
88
|
+
source: "auth",
|
|
89
|
+
title: "Auth Sign Out Everywhere",
|
|
90
|
+
strictParams: !0,
|
|
91
|
+
preview: { ok: !1 },
|
|
92
|
+
params: { scope: {
|
|
93
|
+
type: "select",
|
|
94
|
+
description: "Which sessions end: this site’s, or every one of the account.",
|
|
95
|
+
default: "site",
|
|
96
|
+
options: ["site", "all"],
|
|
97
|
+
optionLabels: {
|
|
98
|
+
site: "This site, on every device",
|
|
99
|
+
all: "Every session of the account"
|
|
100
|
+
},
|
|
101
|
+
canBind: !1
|
|
102
|
+
} }
|
|
86
103
|
}
|
|
87
104
|
};
|
|
88
105
|
//#endregion
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import e from "../../InteractionsContext.mjs";
|
|
2
2
|
import { navigationCallbacks as t } from "./callbacks.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { navigateHow as n } from "./navigateHow.mjs";
|
|
4
|
+
import { use as r, useCallback as i, useMemo as a } from "react";
|
|
5
|
+
import { get as o, pick as s } from "@plitzi/plitzi-ui/helpers";
|
|
6
|
+
import { toBuilderParams as c, toInteractionCallbacks as l } from "@plitzi/sdk-shared/authoring";
|
|
7
|
+
import { useSdkStore as u } from "@plitzi/sdk-shared/store";
|
|
7
8
|
//#region src/sources/NavigationSource/NavigationInteractions.tsx
|
|
8
|
-
var
|
|
9
|
-
let { useInteractions:
|
|
9
|
+
var d = ({ children: d, previewMode: f = !1 }) => {
|
|
10
|
+
let { useInteractions: p } = r(e), [[m, h, g]] = u([
|
|
10
11
|
"schema.pages",
|
|
11
12
|
"pageDefinitions",
|
|
12
13
|
"navigation.navigate"
|
|
13
|
-
]),
|
|
14
|
-
let e =
|
|
14
|
+
]), _ = a(() => {
|
|
15
|
+
let e = s(h, m);
|
|
15
16
|
return Object.keys(e).reduce((t, n) => {
|
|
16
|
-
let r = e[n], i =
|
|
17
|
+
let r = e[n], i = o(r, "attributes.name", n), a = o(r, "attributes.default", !1);
|
|
17
18
|
return [...t, {
|
|
18
19
|
key: n,
|
|
19
20
|
label: i,
|
|
20
|
-
defaultPage:
|
|
21
|
+
defaultPage: a
|
|
21
22
|
}];
|
|
22
23
|
}, []);
|
|
23
|
-
}, [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, [h, d]);
|
|
28
|
-
return f({
|
|
24
|
+
}, [h, m]), v = i((e) => {
|
|
25
|
+
f && g(e.url, n(e));
|
|
26
|
+
}, [g, f]);
|
|
27
|
+
return p({
|
|
29
28
|
id: "navigation",
|
|
30
|
-
callbacks:
|
|
31
|
-
let { urlType: e, url: n } =
|
|
32
|
-
return
|
|
29
|
+
callbacks: a(() => {
|
|
30
|
+
let { urlType: e, url: n, replace: r } = c(t.navigate.params);
|
|
31
|
+
return l(t, { navigate: v }, { navigate: { params: {
|
|
33
32
|
urlType: e,
|
|
33
|
+
replace: r,
|
|
34
34
|
url: {
|
|
35
35
|
...n,
|
|
36
|
-
defaultValue:
|
|
37
|
-
options:
|
|
36
|
+
defaultValue: _.find((e) => e.defaultPage)?.key ?? "",
|
|
37
|
+
options: _.map((e) => ({
|
|
38
38
|
value: e.key,
|
|
39
39
|
label: e.label
|
|
40
40
|
}))
|
|
41
41
|
}
|
|
42
42
|
} } });
|
|
43
|
-
}, [
|
|
44
|
-
}),
|
|
43
|
+
}, [v, _])
|
|
44
|
+
}), d;
|
|
45
45
|
};
|
|
46
46
|
//#endregion
|
|
47
|
-
export {
|
|
47
|
+
export { d as default };
|
|
@@ -23,6 +23,12 @@ var e = { navigate: {
|
|
|
23
23
|
description: "Destination — a page id when urlType is \"page\", otherwise a URL/path.",
|
|
24
24
|
when: (e) => !!e.urlType,
|
|
25
25
|
builderType: (e) => e.urlType === "page" ? "select" : "text"
|
|
26
|
+
},
|
|
27
|
+
replace: {
|
|
28
|
+
type: "boolean",
|
|
29
|
+
description: "Take the place of the address the visitor is on, so Back skips it — closing a sheet a query opened (`?stats=1`), a filter cleared.",
|
|
30
|
+
default: !1,
|
|
31
|
+
label: "Replace the address"
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
} };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NavigateHow } from '@plitzi/sdk-shared';
|
|
2
|
+
/** How a `navigate` step goes: a whole address leaves the space, and either may take the place of the one it is on. */
|
|
3
|
+
export declare const navigateHow: ({ urlType, replace }: {
|
|
4
|
+
urlType: string;
|
|
5
|
+
replace?: boolean;
|
|
6
|
+
}) => NavigateHow;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-interactions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"vitest": "^5.0.5"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@plitzi/plitzi-ui": "^1.6.
|
|
40
|
-
"@plitzi/sdk-auth": "0.
|
|
41
|
-
"@plitzi/sdk-event-bridge": "0.
|
|
42
|
-
"@plitzi/sdk-shared": "0.
|
|
39
|
+
"@plitzi/plitzi-ui": "^1.6.36",
|
|
40
|
+
"@plitzi/sdk-auth": "0.39.0",
|
|
41
|
+
"@plitzi/sdk-event-bridge": "0.39.0",
|
|
42
|
+
"@plitzi/sdk-shared": "0.39.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "^19"
|