@scalio-cloud/ui 0.27.0 → 0.27.1

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/README.md CHANGED
@@ -306,7 +306,8 @@ that returns the view model described in `react/license.js`. Nexus does this: it
306
306
  add-ons and read-only notes (demo mode), and passes its trial notices as `statusExtra` and the reminder settings as `children`.
307
307
 
308
308
  Since 0.27.0 (ADR 0069) the panel shows three areas in the settings form (title and hint left, card right): «Status und
309
- Nutzung», «Add-ons», «Lizenzschlüssel». `children` with `extraTitle` (and `extraHint`) becomes a fourth area.
309
+ Nutzung», «Add-ons», «Lizenzschlüssel». `children` with `extraTitle` (and `extraHint`) becomes a fourth area. The panel passes its `lang` to every `client` call;
310
+ `licenseApi` sends it as `?lang=`, so scalio-license 0.4.0 renders warnings and errors in the language of the page.
310
311
 
311
312
  ## Gruppe System: Zurücksetzen and helpers (React)
312
313
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "private": false,
package/react/license.js CHANGED
@@ -25,14 +25,17 @@ function errorText(err) {
25
25
  }
26
26
 
27
27
  // api: axios instance with the app's base URL (/api). Every method resolves to the license as the backend sends it.
28
+ // lang ("de"/"en", last argument): scalio-license 0.4.0 renders its messages in that language (?lang=); older
29
+ // backends ignore it.
28
30
  function licenseApi(api) {
29
31
  const data = (p) => p.then((r) => r.data);
32
+ const q = (lang) => (lang === "de" || lang === "en" ? { params: { lang } } : undefined);
30
33
  return {
31
- get: () => data(api.get("/license")),
32
- activate: (key) => data(api.put("/license", { key })),
33
- removeKey: () => data(api.delete("/license")),
34
- addAddon: (key) => data(api.post("/license/addons", { key })),
35
- removeAddon: (addon) => data(api.delete(`/license/addons/${encodeURIComponent(addon.id)}`)),
34
+ get: (lang) => data(api.get("/license", q(lang))),
35
+ activate: (key, lang) => data(api.put("/license", { key }, q(lang))),
36
+ removeKey: (lang) => data(api.delete("/license", q(lang))),
37
+ addAddon: (key, lang) => data(api.post("/license/addons", { key }, q(lang))),
38
+ removeAddon: (addon, lang) => data(api.delete(`/license/addons/${encodeURIComponent(addon.id)}`, q(lang))),
36
39
  };
37
40
  }
38
41
 
@@ -121,9 +124,9 @@ function LicensePanel(props) {
121
124
 
122
125
  React.useEffect(() => {
123
126
  let alive = true;
124
- client.get().then((d) => alive && setLic(d)).catch((err) => alive && setLoadError(fmtErr(err)));
127
+ client.get(lang).then((d) => alive && setLic(d)).catch((err) => alive && setLoadError(fmtErr(err)));
125
128
  return () => { alive = false; };
126
- }, [client]);
129
+ }, [client, lang]);
127
130
 
128
131
  const say = (text, tone) => {
129
132
  if (notify) notify(text, tone || "success");
@@ -151,15 +154,15 @@ function LicensePanel(props) {
151
154
  }
152
155
  };
153
156
  const activate = async () => {
154
- if (await run(() => client.activate(key.trim()), L.activated)) setKey("");
157
+ if (await run(() => client.activate(key.trim(), lang), L.activated)) setKey("");
155
158
  };
156
159
  const remove = async () => {
157
160
  const title = fill(L.removeConfirm, { product: props.product || "Scalio" });
158
161
  const yes = confirm ? await confirm({ title, action: L.remove, danger: true }) : window.confirm(title);
159
- if (yes) run(() => client.removeKey(), L.removed);
162
+ if (yes) run(() => client.removeKey(lang), L.removed);
160
163
  };
161
164
  const addAddon = async () => {
162
- if (await run(() => client.addAddon(addon.trim()), L.addonActivated)) setAddon("");
165
+ if (await run(() => client.addAddon(addon.trim(), lang), L.addonActivated)) setAddon("");
163
166
  };
164
167
  const copy = async (value, copied) => {
165
168
  try {
@@ -243,7 +246,7 @@ function LicensePanel(props) {
243
246
  m.managed || m.addonsReadOnly || a.removable === false
244
247
  ? null
245
248
  : h("button", { type: "button", className: "scalio-btn is-ghost is-danger", disabled: busy, title: L.remove, "aria-label": L.remove,
246
- "data-testid": `addon-remove-${a.id}`, onClick: () => run(() => client.removeAddon(a), L.addonRemoved) },
249
+ "data-testid": `addon-remove-${a.id}`, onClick: () => run(() => client.removeAddon(a, lang), L.addonRemoved) },
247
250
  h(Icons.Trash, { className: "scalio-icon" }))
248
251
  )
249
252
  )
@@ -256,7 +259,7 @@ function LicensePanel(props) {
256
259
  h("span", null, e.error),
257
260
  e.addon && !m.managed && !m.addonsReadOnly
258
261
  ? h("button", { type: "button", className: "scalio-license-link", disabled: busy, "data-testid": `addon-remove-${e.addon.id}`,
259
- onClick: () => run(() => client.removeAddon(e.addon), L.addonRemoved) }, L.remove)
262
+ onClick: () => run(() => client.removeAddon(e.addon, lang), L.addonRemoved) }, L.remove)
260
263
  : null
261
264
  )
262
265
  ),