@declarion/embed 0.26.4 → 0.28.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 +2 -2
- package/dist/server.js +24 -24
- package/package.json +5 -5
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 =
|
|
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
|
|
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
|
|
15
|
-
let
|
|
16
|
-
tenant_code:
|
|
17
|
-
user_email:
|
|
18
|
-
screen_code:
|
|
19
|
-
ttl_seconds:
|
|
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
|
-
|
|
22
|
-
let
|
|
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:
|
|
26
|
+
authorization: n.apiKey
|
|
27
27
|
},
|
|
28
|
-
body: JSON.stringify(
|
|
29
|
-
signal:
|
|
30
|
-
}),
|
|
28
|
+
body: JSON.stringify(i),
|
|
29
|
+
signal: n.signal
|
|
30
|
+
}), o;
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
o = await a.json();
|
|
33
33
|
} catch {
|
|
34
|
-
throw new
|
|
34
|
+
throw new e(`auth.create_embed_session returned a non-JSON response (HTTP ${a.status}).`, a.status, null);
|
|
35
35
|
}
|
|
36
|
-
if (!
|
|
37
|
-
let
|
|
38
|
-
throw new
|
|
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
|
|
41
|
-
if (!
|
|
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:
|
|
44
|
-
expires_at:
|
|
43
|
+
token: s.token,
|
|
44
|
+
expires_at: s.expires_at
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
48
|
-
export {
|
|
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.
|
|
3
|
+
"version": "0.28.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.
|
|
56
|
-
"eslint": "^10.
|
|
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.
|
|
63
|
-
"vite": "^8.0
|
|
62
|
+
"typescript-eslint": "^8.62.1",
|
|
63
|
+
"vite": "^8.1.0",
|
|
64
64
|
"vitest": "^4.1.9"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|