@declarion/embed 0.26.3 → 0.27.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/dist/core.js CHANGED
@@ -62,7 +62,7 @@ var f = 2e4, p = "Declarion embedded screen", m = [
62
62
  "allow-downloads",
63
63
  "allow-popups",
64
64
  "allow-popups-to-escape-sandbox"
65
- ], h = new Set(["allow-top-navigation", "allow-top-navigation-by-user-activation"]);
65
+ ], h = /* @__PURE__ */ new Set(["allow-top-navigation", "allow-top-navigation-by-user-activation"]);
66
66
  function g(e) {
67
67
  let t = new Set(m);
68
68
  for (let n of e ?? []) {
@@ -159,7 +159,7 @@ function b(e) {
159
159
  recordId: r.recordId
160
160
  };
161
161
  e.onNavigate?.(i);
162
- }, j = new Set(["not_found", "unresolved"]), M = (t) => {
162
+ }, j = /* @__PURE__ */ new Set(["not_found", "unresolved"]), M = (t) => {
163
163
  if (typeof t?.route != "string" || t.route.length === 0 || !j.has(t.reason)) {
164
164
  b("<- iframe navigation-failed (dropped: invalid payload)", t);
165
165
  return;
package/dist/server.js CHANGED
@@ -1,48 +1,48 @@
1
1
  //#region src/server.ts
2
- var e = "auth.create_embed_session", t = "/api/actions", n = 600, r = class e extends Error {
2
+ var e = class e extends Error {
3
3
  code;
4
4
  status;
5
5
  constructor(t, n, r) {
6
6
  super(t), this.name = "EmbedSessionError", this.code = r, this.status = n, Object.setPrototypeOf(this, e.prototype);
7
7
  }
8
8
  };
9
- function i(e) {
9
+ function t(e) {
10
10
  if (typeof e != "object" || !e) return !1;
11
11
  let t = e;
12
12
  return typeof t.token == "string" && t.token !== "" && typeof t.expires_at == "string" && t.expires_at !== "";
13
13
  }
14
- async function a(a) {
15
- let o = `${new URL(a.declarionOrigin).origin}${t}/${e}`, s = {
16
- tenant_code: a.tenantCode,
17
- user_email: a.userEmail,
18
- screen_code: a.screenCode,
19
- ttl_seconds: a.ttlSeconds ?? n
14
+ async function n(n) {
15
+ let r = `${new URL(n.declarionOrigin).origin}/api/actions/auth.create_embed_session`, i = {
16
+ tenant_code: n.tenantCode,
17
+ user_email: n.userEmail,
18
+ screen_code: n.screenCode,
19
+ ttl_seconds: n.ttlSeconds ?? 600
20
20
  };
21
- a.permissions && a.permissions.length > 0 && (s.permissions = a.permissions);
22
- let c = await fetch(o, {
21
+ n.permissions && n.permissions.length > 0 && (i.permissions = n.permissions);
22
+ let a = await fetch(r, {
23
23
  method: "POST",
24
24
  headers: {
25
25
  "content-type": "application/json",
26
- authorization: a.apiKey
26
+ authorization: n.apiKey
27
27
  },
28
- body: JSON.stringify(s),
29
- signal: a.signal
30
- }), l;
28
+ body: JSON.stringify(i),
29
+ signal: n.signal
30
+ }), o;
31
31
  try {
32
- l = await c.json();
32
+ o = await a.json();
33
33
  } catch {
34
- throw new r(`auth.create_embed_session returned a non-JSON response (HTTP ${c.status}).`, c.status, null);
34
+ throw new e(`auth.create_embed_session returned a non-JSON response (HTTP ${a.status}).`, a.status, null);
35
35
  }
36
- if (!c.ok) {
37
- let e = l, t = e.error?.code ?? null;
38
- throw new r(e.error?.message ?? `auth.create_embed_session failed with HTTP ${c.status}.`, c.status, t);
36
+ if (!a.ok) {
37
+ let t = o, n = t.error?.code ?? null;
38
+ throw new e(t.error?.message ?? `auth.create_embed_session failed with HTTP ${a.status}.`, a.status, n);
39
39
  }
40
- let u = l.result;
41
- if (!i(u)) throw new r("auth.create_embed_session returned a malformed result: expected { token, expires_at }.", c.status, null);
40
+ let s = o.result;
41
+ if (!t(s)) throw new e("auth.create_embed_session returned a malformed result: expected { token, expires_at }.", a.status, null);
42
42
  return {
43
- token: u.token,
44
- expires_at: u.expires_at
43
+ token: s.token,
44
+ expires_at: s.expires_at
45
45
  };
46
46
  }
47
47
  //#endregion
48
- export { r as EmbedSessionError, a as createEmbedSession };
48
+ export { e as EmbedSessionError, n as createEmbedSession };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/embed",
3
- "version": "0.26.3",
3
+ "version": "0.27.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "Host integration SDK for embedding Declarion screens as white-label iframes.",
@@ -52,15 +52,15 @@
52
52
  "@testing-library/react": "^16.3.2",
53
53
  "@types/react": "^19.2.17",
54
54
  "@types/react-dom": "^19.2.3",
55
- "@vitejs/plugin-react": "^6.0.2",
56
- "eslint": "^10.5.0",
55
+ "@vitejs/plugin-react": "^6.0.3",
56
+ "eslint": "^10.6.0",
57
57
  "jsdom": "^29.1.1",
58
58
  "publint": "^0.3.0",
59
59
  "react": "^19.2.7",
60
60
  "react-dom": "^19.2.7",
61
61
  "typescript": "^6.0.3",
62
- "typescript-eslint": "^8.62.0",
63
- "vite": "^8.0.16",
62
+ "typescript-eslint": "^8.62.1",
63
+ "vite": "^8.1.0",
64
64
  "vitest": "^4.1.9"
65
65
  },
66
66
  "scripts": {