@plitzi/sdk-interactions 0.38.24 → 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 CHANGED
@@ -1,5 +1,157 @@
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
+
3
155
  ## 0.38.24
4
156
 
5
157
  ### Patch Changes
@@ -3677,7 +3829,7 @@ author`, `plitzi_validate`/`plitzi_apply`, `plitzi explain` and the builder's pr
3677
3829
  - **Devices are listed by device, not by session.** `GET /devices/sessions` groups sessions by what they were created
3678
3830
  from and answers this device apart; a browser that signed in forty times is one row saying "40 sessions". The list
3679
3831
  had shipped and drawn every session — 1,218 for one account a test suite signs in as — inside a box that scrolled.
3680
- - **Every device is named for what it is**: the application as it registered over OAuth (`Plitzi CLI on carlos-mbp`,
3832
+ - **Every device is named for what it is**: the application as it registered over OAuth (`Plitzi CLI on dev-laptop`,
3681
3833
  `Plitzi Desktop on studio`), a browser and its system, an automated client (Playwright, headless Chrome) — never a
3682
3834
  raw user agent. Sessions record their address and **when they were last used** (at most every five minutes, on the
3683
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 { get as n, omit as r } from "@plitzi/plitzi-ui/helpers";
4
- import { QueryBuilderEvaluator as i } from "@plitzi/plitzi-ui/QueryBuilder/evaluator";
5
- import { pConsole as a } from "@plitzi/sdk-shared/devTools";
6
- import { MAX_PARAM_PASSES as o, resolveStepParam as s } from "@plitzi/sdk-shared/helpers/twigWrapper";
7
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
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 d = 5, f = (e, t, n, r, i) => {
10
+ var f = 5, p = (e, t, n, r, i) => {
10
11
  if (e === "utility" && i === "twigTemplate") return t;
11
- let c = {
12
+ let a = {
12
13
  ...n,
13
14
  ...r
14
- }, f = (e, t, n) => {
15
+ }, l = (e, t, n) => {
15
16
  if (typeof e == "string") {
16
- let { value: n, unresolved: r } = s(e, c);
17
- return r && a.warning("interactions", /* @__PURE__ */ u("span", { children: [
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
- o,
20
+ s,
20
21
  " passes for ",
21
- /* @__PURE__ */ l("b", { children: t }),
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 >= d || typeof e != "object" || !e ? e : Array.isArray(e) ? e.map((e) => f(e, t, n + 1)) : Object.fromEntries(Object.entries(e).map(([e, r]) => [e, f(r, t, n + 1)]));
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] : f(t[r], r, 0);
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
- }, p = (e) => typeof e != "function" && typeof e != "symbol" && typeof e != "bigint", m = (e) => Object.fromEntries(Object.entries(e).filter((e) => p(e[1]))), h = (e) => typeof e == "object" && !!e && "then" in e && typeof e.then == "function", g = (r, o = {}, s = {}, c = {}, d = {}) => {
38
- let p = [], { id: g, action: _, enabled: v, params: y, elementId: b, type: x, when: S } = r;
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: p
43
+ postCallbacks: h
43
44
  };
44
- let C = m({
45
+ let C = n({
46
+ ...l,
45
47
  ...c,
46
- ...s,
47
48
  [g]: y
48
49
  });
49
- if (S && !i(S, C)) return {
50
+ if (S && !a(S, C)) return {
50
51
  status: "skipped",
51
52
  result: {},
52
- postCallbacks: p,
53
+ postCallbacks: h,
53
54
  whenParams: C
54
55
  };
55
- let w = (e) => (a.danger("interactions", /* @__PURE__ */ u("span", { children: ["Interaction node failed ", /* @__PURE__ */ l("b", { children: _ })] }), {
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: r
58
+ node: i
58
59
  }), {
59
60
  status: "failed",
60
61
  result: {},
61
- postCallbacks: p,
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 a.warning("interactions", /* @__PURE__ */ u("span", { children: [
68
+ if (!b) return o.warning("interactions", /* @__PURE__ */ d("span", { children: [
68
69
  "Step ",
69
- /* @__PURE__ */ l("b", { children: _ }),
70
+ /* @__PURE__ */ u("b", { children: _ }),
70
71
  " names no element, so there is nothing to run it on"
71
- ] }), { node: r }), {
72
+ ] }), { node: i }), {
72
73
  status: "failed",
73
74
  result: {},
74
- postCallbacks: p,
75
+ postCallbacks: h,
75
76
  whenParams: C
76
77
  };
77
- if (T = n(o, `${b}.${_}`), !T) return a.warning("interactions", /* @__PURE__ */ u("span", { children: [
78
+ if (T = r(s, `${b}.${_}`), !T) return o.warning("interactions", /* @__PURE__ */ d("span", { children: [
78
79
  "Nothing is registered as ",
79
- /* @__PURE__ */ l("b", { children: `${b}.${_}` }),
80
+ /* @__PURE__ */ u("b", { children: `${b}.${_}` }),
80
81
  ", so this step did nothing"
81
82
  ] }), {
82
- node: r,
83
- available: Object.keys(n(o, b, {}))
83
+ node: i,
84
+ available: Object.keys(r(s, b, {}))
84
85
  }), {
85
86
  status: "failed",
86
87
  result: {},
87
- postCallbacks: p,
88
+ postCallbacks: h,
88
89
  whenParams: C
89
90
  };
90
91
  break;
91
92
  case "utility":
92
- T = n(t, _, {});
93
+ T = r(t, _, {});
93
94
  break;
94
95
  default: return {
95
96
  status: "success",
96
97
  result: {},
97
- postCallbacks: p,
98
+ postCallbacks: h,
98
99
  whenParams: C
99
100
  };
100
101
  }
101
102
  try {
102
103
  let t = {
103
- ...s,
104
104
  ...c,
105
- ...e(T.params, f(x, y, s, c, _))
106
- }, { callback: n, postCallback: r } = T, i = (e) => (r && p.push({
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: p,
117
+ postCallbacks: h,
117
118
  whenParams: C
118
- }), a = n ? n(t, d) : {};
119
- return h(a) ? Promise.resolve(a).then(i, w) : i(a);
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
- }, _ = async (e = []) => {
124
+ }, g = async (e = []) => {
124
125
  let t = {};
125
- return await Promise.all(e.reverse().map(async ({ id: e, callback: n, params: i }) => {
126
- t[e] = await n?.(r(i, [e]), i[e]);
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
- }, v = () => ({}), y = async (e, t = {}, r = {}, i = {}, o = v, s = [], c = {}, l = {}) => {
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 = n(t, u.afterNode);
133
- if (!e) return s.length > 0 && await _(s), c;
134
- let i = a.getTime().valueOf(), f = g(e, r, d, o(), l), p = h(f) ? await f : f, { result: m, postCallbacks: v, whenParams: y } = p, b = p.status === "failed" && l.signal?.aborted ? "skipped" : p.status;
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: m,
139
+ result: _,
139
140
  postCallbacks: v,
140
141
  whenParams: y,
141
142
  startTime: i,
142
- endTime: a.getTime().valueOf()
143
+ endTime: o.getTime().valueOf()
143
144
  }, s.push(...v), d = {
144
145
  ...d,
145
- [e.id]: m
146
+ [e.id]: _
146
147
  }, u = e;
147
148
  }
148
149
  return c;
149
- }, b = (e, t, n = {}, r, i) => {
150
- let o = a.getTime().valueOf(), s = r === "skipped" ? "skipped" : "success", d = /* @__PURE__ */ u("span", { children: [
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__ */ l("b", { children: `${e.title} [${e.action}]` }),
153
- i ? /* @__PURE__ */ u(c, { children: [" on ", /* @__PURE__ */ l("b", { children: i })] }) : null
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: o
168
+ endTime: a
168
169
  }
169
170
  },
170
171
  startTime: t,
171
- endTime: o
172
+ endTime: a
172
173
  };
173
- r === "failed" ? a.danger("interactions", d, f) : a.info("interactions", d, f);
174
- }, x = (e) => Object.values(e).some(({ status: e }) => e === "failed") ? "failed" : "completed", S = async (e, t = {}, n = {}, r = {}, o = v, s, c, l = []) => {
175
- let u = a.getTime().valueOf(), { action: d, enabled: f, when: p } = e;
176
- if (!d || !f || p && !i(p, m({
177
- ...o(),
178
- ...r
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
- b(e, u, {}, "skipped", s);
181
+ y(e, d, {}, "skipped", c);
181
182
  return;
182
183
  }
183
- let h = await y(e, t, n, r, o, l, {}, {
184
- hostElementId: s,
185
- ...c ? { signal: c } : {}
184
+ let h = await v(e, t, r, i, s, u, {}, {
185
+ hostElementId: c,
186
+ ...l ? { signal: l } : {}
186
187
  });
187
- b(e, u, h, x(h), s);
188
- }, C = { flowTrigger: S };
188
+ y(e, d, h, b(h), c);
189
+ }, S = { flowTrigger: x };
189
190
  //#endregion
190
- export { C as default, S as flowTrigger };
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 }),
@@ -51,7 +51,8 @@ var t = {
51
51
  status: "",
52
52
  output: {},
53
53
  reason: "",
54
- error: ""
54
+ error: "",
55
+ code: ""
55
56
  }
56
57
  },
57
58
  cancelServerAction: {
@@ -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, provider: u } = n(a), { useInteractions: d } = n(e);
9
- return d({
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(() => !u || !s || !c || !l ? {} : i(t, {
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
- u
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 { use as n, useCallback as r, useMemo as i } from "react";
4
- import { get as a, pick as o } from "@plitzi/plitzi-ui/helpers";
5
- import { toBuilderParams as s, toInteractionCallbacks as c } from "@plitzi/sdk-shared/authoring";
6
- import { useSdkStore as l } from "@plitzi/sdk-shared/store";
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 u = ({ children: u, previewMode: d = !1 }) => {
9
- let { useInteractions: f } = n(e), [[p, m, h]] = l([
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
- ]), g = i(() => {
14
- let e = o(m, p);
14
+ ]), _ = a(() => {
15
+ let e = s(h, m);
15
16
  return Object.keys(e).reduce((t, n) => {
16
- let r = e[n], i = a(r, "attributes.name", n), o = a(r, "attributes.default", !1);
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: o
21
+ defaultPage: a
21
22
  }];
22
23
  }, []);
23
- }, [m, p]), _ = r((e) => {
24
- if (!d) return;
25
- let { url: t, urlType: n } = e;
26
- n === "page" || n === "internal" ? h(t) : h(t, !0);
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: i(() => {
31
- let { urlType: e, url: n } = s(t.navigate.params);
32
- return c(t, { navigate: _ }, { navigate: { params: {
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: g.find((e) => e.defaultPage)?.key ?? "",
37
- options: g.map((e) => ({
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
- }, [_, g])
44
- }), u;
43
+ }, [v, _])
44
+ }), d;
45
45
  };
46
46
  //#endregion
47
- export { u as default };
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;
@@ -0,0 +1,7 @@
1
+ //#region src/sources/NavigationSource/navigateHow.ts
2
+ var e = ({ urlType: e, replace: t = !1 }) => ({
3
+ external: e === "external",
4
+ replace: t
5
+ });
6
+ //#endregion
7
+ export { e as navigateHow };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-interactions",
3
- "version": "0.38.24",
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.34",
40
- "@plitzi/sdk-auth": "0.38.24",
41
- "@plitzi/sdk-event-bridge": "0.38.24",
42
- "@plitzi/sdk-shared": "0.38.24"
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"