@salla.sa/embedded-sdk 0.1.0-beta.10 → 0.1.0-beta.12
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/cjs/index.js +3 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +259 -251
- package/dist/esm/index.js.map +1 -1
- package/dist/system/index.js +3 -3
- package/dist/system/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/umd/index.js +3 -3
- package/dist/umd/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
const
|
|
1
|
+
const s = "embedded::", y = {
|
|
2
2
|
/** Initialize handshake - iframe signals it's ready to receive context */
|
|
3
|
-
INIT: `${
|
|
3
|
+
INIT: `${s}iframe.ready`,
|
|
4
4
|
/** Request iframe resize */
|
|
5
|
-
RESIZE: `${
|
|
5
|
+
RESIZE: `${s}iframe.resize`,
|
|
6
6
|
/** App signals it's fully loaded and ready */
|
|
7
|
-
READY: `${
|
|
7
|
+
READY: `${s}ready`,
|
|
8
8
|
/** App requests to be destroyed and navigate away */
|
|
9
|
-
DESTROY: `${
|
|
10
|
-
},
|
|
9
|
+
DESTROY: `${s}destroy`
|
|
10
|
+
}, k = {
|
|
11
11
|
/** Context data provision */
|
|
12
|
-
PROVIDE: `${
|
|
12
|
+
PROVIDE: `${s}context.provide`,
|
|
13
13
|
/** Theme change notification */
|
|
14
|
-
THEME_CHANGE: `${
|
|
14
|
+
THEME_CHANGE: `${s}theme.change`
|
|
15
15
|
}, j = {
|
|
16
16
|
/** Send log message to host */
|
|
17
|
-
LOG: `${
|
|
17
|
+
LOG: `${s}log`
|
|
18
18
|
}, d = {
|
|
19
19
|
/** Set loading state */
|
|
20
|
-
LOADING: `${
|
|
20
|
+
LOADING: `${s}ui.loading`,
|
|
21
21
|
/** Show toast notification */
|
|
22
|
-
TOAST: `${
|
|
22
|
+
TOAST: `${s}ui.toast`,
|
|
23
23
|
/** Control modal state */
|
|
24
|
-
MODAL: `${
|
|
24
|
+
MODAL: `${s}ui.modal`,
|
|
25
25
|
/** Show confirm dialog (async request) */
|
|
26
|
-
CONFIRM: `${
|
|
26
|
+
CONFIRM: `${s}ui.confirm`,
|
|
27
27
|
/** Confirm dialog response (from host) */
|
|
28
|
-
CONFIRM_RESPONSE: `${
|
|
28
|
+
CONFIRM_RESPONSE: `${s}ui.confirm.response`,
|
|
29
29
|
/** Modal response (from host) */
|
|
30
|
-
MODAL_RESPONSE: `${
|
|
31
|
-
}, G = "0.1.0-beta.
|
|
30
|
+
MODAL_RESPONSE: `${s}ui.modal.response`
|
|
31
|
+
}, G = "0.1.0-beta.12", H = {
|
|
32
32
|
version: G
|
|
33
|
-
},
|
|
33
|
+
}, z = {
|
|
34
34
|
/** Request token refresh (re-renders iframe with new token) */
|
|
35
|
-
REFRESH: `${
|
|
35
|
+
REFRESH: `${s}auth.refresh`
|
|
36
36
|
}, m = {
|
|
37
37
|
/** Navigate using React Router (SPA navigation) */
|
|
38
|
-
NAVIGATE: `${
|
|
38
|
+
NAVIGATE: `${s}page.navigate`,
|
|
39
39
|
/** Redirect using window.location (full page reload) */
|
|
40
|
-
REDIRECT: `${
|
|
40
|
+
REDIRECT: `${s}page.redirect`,
|
|
41
41
|
/** Set page title */
|
|
42
|
-
SET_TITLE: `${
|
|
43
|
-
},
|
|
42
|
+
SET_TITLE: `${s}page.setTitle`
|
|
43
|
+
}, w = {
|
|
44
44
|
/** Set primary action button in navbar */
|
|
45
|
-
SET_ACTION: `${
|
|
45
|
+
SET_ACTION: `${s}nav.setAction`,
|
|
46
46
|
/** Notification when action button is clicked (host → iframe) */
|
|
47
|
-
ACTION_CLICK: `${
|
|
48
|
-
},
|
|
47
|
+
ACTION_CLICK: `${s}nav.actionClick`
|
|
48
|
+
}, $ = {
|
|
49
49
|
/** Initialize checkout flow */
|
|
50
|
-
CREATE: `${
|
|
51
|
-
},
|
|
50
|
+
CREATE: `${s}checkout.create`
|
|
51
|
+
}, L = H.version, K = 1e4, X = [
|
|
52
52
|
"localhost",
|
|
53
53
|
"merchants.workers.dev",
|
|
54
54
|
"s.salla.sa",
|
|
55
55
|
".salla.group",
|
|
56
56
|
".salla.sa"
|
|
57
57
|
];
|
|
58
|
-
let
|
|
58
|
+
let A = {
|
|
59
59
|
showVersion: !0,
|
|
60
60
|
debug: !1
|
|
61
61
|
};
|
|
62
62
|
function W(e) {
|
|
63
|
-
|
|
63
|
+
A = { ...A, ...e };
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function O(e) {
|
|
66
66
|
return `%c${e}`;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function _(e, t = "#fff") {
|
|
69
69
|
return `background-color: ${e}; color: ${t}; padding: 2px 6px; border-radius: 3px; font-weight: 500; font-size: 11px;`;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
if (e === "debug" && !
|
|
71
|
+
function b(e, ...t) {
|
|
72
|
+
if (e === "debug" && !A.debug)
|
|
73
73
|
return;
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const n =
|
|
77
|
-
(console[e] || console.log)(n, ...
|
|
74
|
+
const i = [], r = [];
|
|
75
|
+
i.push(O("EmbeddedSDK")), r.push(_("#10b981", "#fff")), A.showVersion && (i.push(O(`v${L}`)), r.push(_("#6b7280", "#fff")));
|
|
76
|
+
const n = i.join("").trim();
|
|
77
|
+
(console[e] || console.log)(n, ...r, ...t);
|
|
78
78
|
}
|
|
79
79
|
const u = {
|
|
80
80
|
log: (...e) => {
|
|
81
|
-
|
|
81
|
+
b("log", ...e);
|
|
82
82
|
},
|
|
83
83
|
warn: (...e) => {
|
|
84
|
-
|
|
84
|
+
b("warn", ...e);
|
|
85
85
|
},
|
|
86
86
|
error: (...e) => {
|
|
87
|
-
|
|
87
|
+
b("error", ...e);
|
|
88
88
|
},
|
|
89
89
|
info: (...e) => {
|
|
90
|
-
|
|
90
|
+
b("info", ...e);
|
|
91
91
|
},
|
|
92
92
|
debug: (...e) => {
|
|
93
|
-
|
|
93
|
+
b("debug", ...e);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
function Y(e) {
|
|
97
97
|
try {
|
|
98
|
-
const
|
|
99
|
-
return X.some((
|
|
98
|
+
const i = new URL(e).hostname;
|
|
99
|
+
return X.some((r) => r.startsWith(".") ? i.endsWith(r) || i === r.slice(1) : i === r || i.startsWith(`${r}:`));
|
|
100
100
|
} catch {
|
|
101
101
|
return !1;
|
|
102
102
|
}
|
|
@@ -104,64 +104,72 @@ function Y(e) {
|
|
|
104
104
|
function B() {
|
|
105
105
|
return typeof window > "u" || window.parent === window ? null : window.parent;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
107
|
+
function o(e, t, i = "*", r, n) {
|
|
108
|
+
const a = B();
|
|
109
|
+
if (!a) {
|
|
110
110
|
u.warn("Not running in an iframe, cannot post to host");
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const l = {
|
|
114
114
|
event: e,
|
|
115
|
-
|
|
115
|
+
payload: t || {},
|
|
116
|
+
timestamp: Date.now(),
|
|
117
|
+
source: "embedded-app",
|
|
118
|
+
...r && { requestId: r },
|
|
119
|
+
metadata: {
|
|
120
|
+
version: L
|
|
121
|
+
}
|
|
116
122
|
};
|
|
117
|
-
|
|
123
|
+
a.postMessage(l, i);
|
|
118
124
|
}
|
|
119
125
|
const h = /* @__PURE__ */ new Map();
|
|
120
|
-
let
|
|
126
|
+
let S = !1;
|
|
121
127
|
function P(e) {
|
|
122
128
|
if (process.env.NODE_ENV === "production" && !Y(e.origin))
|
|
123
129
|
return;
|
|
124
130
|
const t = e.data;
|
|
125
|
-
if (!t || typeof t.event != "string")
|
|
131
|
+
if (!t || typeof t.event != "string" || !t.payload || typeof t.timestamp != "number" || !t.source) {
|
|
132
|
+
u.warn("Invalid message structure received:", t);
|
|
126
133
|
return;
|
|
127
|
-
|
|
128
|
-
|
|
134
|
+
}
|
|
135
|
+
const i = h.get(t.event);
|
|
136
|
+
i && i.forEach((n) => {
|
|
129
137
|
try {
|
|
130
138
|
n(t);
|
|
131
|
-
} catch (
|
|
132
|
-
u.error("Error in message handler:",
|
|
139
|
+
} catch (a) {
|
|
140
|
+
u.error("Error in message handler:", a);
|
|
133
141
|
}
|
|
134
142
|
});
|
|
135
|
-
const
|
|
136
|
-
|
|
143
|
+
const r = h.get("*");
|
|
144
|
+
r && r.forEach((n) => {
|
|
137
145
|
try {
|
|
138
146
|
n(t);
|
|
139
|
-
} catch (
|
|
140
|
-
u.error("Error in wildcard handler:",
|
|
147
|
+
} catch (a) {
|
|
148
|
+
u.error("Error in wildcard handler:", a);
|
|
141
149
|
}
|
|
142
150
|
});
|
|
143
151
|
}
|
|
144
152
|
function Z() {
|
|
145
|
-
|
|
153
|
+
S || typeof window > "u" || (window.addEventListener("message", P), S = !0);
|
|
146
154
|
}
|
|
147
|
-
function
|
|
155
|
+
function T(e, t) {
|
|
148
156
|
Z(), h.has(e) || h.set(e, /* @__PURE__ */ new Set());
|
|
149
|
-
const
|
|
150
|
-
return
|
|
151
|
-
|
|
157
|
+
const i = h.get(e);
|
|
158
|
+
return i.add(t), () => {
|
|
159
|
+
i.delete(t), i.size === 0 && h.delete(e);
|
|
152
160
|
};
|
|
153
161
|
}
|
|
154
162
|
function J(e, t = K) {
|
|
155
|
-
return new Promise((
|
|
163
|
+
return new Promise((i, r) => {
|
|
156
164
|
const n = setTimeout(() => {
|
|
157
|
-
|
|
158
|
-
}, t),
|
|
159
|
-
clearTimeout(n),
|
|
165
|
+
a(), r(new Error(`[EmbeddedSDK] Timeout waiting for "${e}" message`));
|
|
166
|
+
}, t), a = T(e, (l) => {
|
|
167
|
+
clearTimeout(n), a(), i(l);
|
|
160
168
|
});
|
|
161
169
|
});
|
|
162
170
|
}
|
|
163
171
|
function Q() {
|
|
164
|
-
h.clear(),
|
|
172
|
+
h.clear(), S && typeof window < "u" && (window.removeEventListener("message", P), S = !1);
|
|
165
173
|
}
|
|
166
174
|
function ee() {
|
|
167
175
|
return typeof window > "u" ? !1 : window.parent !== window;
|
|
@@ -171,74 +179,74 @@ function re() {
|
|
|
171
179
|
const e = Date.now(), t = Math.random().toString(36).slice(2, 9);
|
|
172
180
|
return `req_${e}_${t}`;
|
|
173
181
|
}
|
|
174
|
-
function ie(e, t = {},
|
|
175
|
-
const
|
|
176
|
-
return new Promise((n,
|
|
177
|
-
const
|
|
178
|
-
g.get(
|
|
182
|
+
function ie(e, t = {}, i = te) {
|
|
183
|
+
const r = re();
|
|
184
|
+
return new Promise((n, a) => {
|
|
185
|
+
const l = setTimeout(() => {
|
|
186
|
+
g.get(r) && (g.delete(r), a(
|
|
179
187
|
new Error(
|
|
180
|
-
`[EmbeddedSDK] Request "${e}" timed out after ${
|
|
188
|
+
`[EmbeddedSDK] Request "${e}" timed out after ${i}ms`
|
|
181
189
|
)
|
|
182
190
|
));
|
|
183
|
-
},
|
|
184
|
-
g.set(
|
|
191
|
+
}, i);
|
|
192
|
+
g.set(r, {
|
|
185
193
|
resolve: n,
|
|
186
|
-
reject:
|
|
187
|
-
timeout:
|
|
194
|
+
reject: a,
|
|
195
|
+
timeout: l,
|
|
188
196
|
event: e
|
|
189
|
-
}),
|
|
197
|
+
}), o(e, t, "*", r);
|
|
190
198
|
});
|
|
191
199
|
}
|
|
192
|
-
function
|
|
193
|
-
const
|
|
194
|
-
if (!
|
|
200
|
+
function D(e, t, i) {
|
|
201
|
+
const r = g.get(e);
|
|
202
|
+
if (!r) {
|
|
195
203
|
u.warn(`Received response for unknown request: ${e}`);
|
|
196
204
|
return;
|
|
197
205
|
}
|
|
198
|
-
clearTimeout(
|
|
206
|
+
clearTimeout(r.timeout), g.delete(e), i ? r.reject(new Error(i)) : r.resolve(t);
|
|
199
207
|
}
|
|
200
208
|
function ne(e = "SDK cleanup") {
|
|
201
|
-
g.forEach((t,
|
|
209
|
+
g.forEach((t, i) => {
|
|
202
210
|
clearTimeout(t.timeout), t.reject(
|
|
203
|
-
new Error(`[EmbeddedSDK] Request ${
|
|
211
|
+
new Error(`[EmbeddedSDK] Request ${i} cancelled: ${e}`)
|
|
204
212
|
);
|
|
205
213
|
}), g.clear();
|
|
206
214
|
}
|
|
207
|
-
const
|
|
208
|
-
class
|
|
209
|
-
constructor(t,
|
|
210
|
-
super(t), this.status =
|
|
215
|
+
const ae = "https://api.salla.dev";
|
|
216
|
+
class E extends Error {
|
|
217
|
+
constructor(t, i, r) {
|
|
218
|
+
super(t), this.status = i, this.response = r, this.name = "ApiError";
|
|
211
219
|
}
|
|
212
220
|
}
|
|
213
|
-
async function
|
|
214
|
-
const { method:
|
|
215
|
-
|
|
216
|
-
},
|
|
221
|
+
async function se(e, t = {}) {
|
|
222
|
+
const { method: i = "GET", headers: r = {}, body: n, timeout: a = 3e4 } = t, l = `${ae}${e}`, R = new AbortController(), N = setTimeout(() => {
|
|
223
|
+
R.abort();
|
|
224
|
+
}, a);
|
|
217
225
|
try {
|
|
218
|
-
const c = await fetch(
|
|
219
|
-
method:
|
|
226
|
+
const c = await fetch(l, {
|
|
227
|
+
method: i,
|
|
220
228
|
headers: {
|
|
221
229
|
"Content-Type": "application/json",
|
|
222
|
-
...
|
|
230
|
+
...r
|
|
223
231
|
},
|
|
224
232
|
body: n ? JSON.stringify(n) : void 0,
|
|
225
|
-
signal:
|
|
233
|
+
signal: R.signal
|
|
226
234
|
});
|
|
227
|
-
clearTimeout(
|
|
228
|
-
let
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
throw new
|
|
235
|
+
clearTimeout(N);
|
|
236
|
+
let v;
|
|
237
|
+
const C = c.headers.get("content-type");
|
|
238
|
+
if (C != null && C.includes("application/json") ? v = await c.json() : v = await c.text(), !c.ok)
|
|
239
|
+
throw new E(
|
|
232
240
|
`API request failed: ${c.statusText}`,
|
|
233
241
|
c.status,
|
|
234
|
-
|
|
242
|
+
v
|
|
235
243
|
);
|
|
236
|
-
return
|
|
244
|
+
return v;
|
|
237
245
|
} catch (c) {
|
|
238
|
-
throw clearTimeout(
|
|
246
|
+
throw clearTimeout(N), c instanceof E ? c : c instanceof Error ? c.name === "AbortError" ? new E(`Request timeout after ${a}ms`) : new E(`Request failed: ${c.message}`) : new E("Unknown error occurred");
|
|
239
247
|
}
|
|
240
248
|
}
|
|
241
|
-
function
|
|
249
|
+
function I(e) {
|
|
242
250
|
return {
|
|
243
251
|
isVerified: !1,
|
|
244
252
|
isError: !0,
|
|
@@ -247,22 +255,22 @@ function L(e) {
|
|
|
247
255
|
};
|
|
248
256
|
}
|
|
249
257
|
async function oe(e) {
|
|
250
|
-
const { token: t, appId:
|
|
258
|
+
const { token: t, appId: i, refreshOnError: r = !0 } = e;
|
|
251
259
|
if (!t) {
|
|
252
260
|
const n = "Token is required. Provide it as a parameter or in URL as ?token=XXX";
|
|
253
|
-
return u.error("Error in introspect:", n),
|
|
261
|
+
return u.error("Error in introspect:", n), I(n);
|
|
254
262
|
}
|
|
255
|
-
if (!
|
|
263
|
+
if (!i) {
|
|
256
264
|
const n = "App ID is required. Provide it as a parameter or in URL as ?app_id=XXX";
|
|
257
|
-
return u.error("Error in introspect:", n),
|
|
265
|
+
return u.error("Error in introspect:", n), I(n);
|
|
258
266
|
}
|
|
259
267
|
try {
|
|
260
|
-
const n = await
|
|
268
|
+
const n = await se(
|
|
261
269
|
"/exchange-authority/v1/introspect",
|
|
262
270
|
{
|
|
263
271
|
method: "POST",
|
|
264
272
|
headers: {
|
|
265
|
-
"S-Source":
|
|
273
|
+
"S-Source": i,
|
|
266
274
|
"Content-Type": "application/json"
|
|
267
275
|
},
|
|
268
276
|
body: {
|
|
@@ -272,17 +280,17 @@ async function oe(e) {
|
|
|
272
280
|
subject: "embedded-page"
|
|
273
281
|
}
|
|
274
282
|
}
|
|
275
|
-
),
|
|
283
|
+
), a = n.success;
|
|
276
284
|
return {
|
|
277
|
-
isVerified:
|
|
278
|
-
isError: !
|
|
279
|
-
error:
|
|
280
|
-
data:
|
|
285
|
+
isVerified: a,
|
|
286
|
+
isError: !a,
|
|
287
|
+
error: a ? void 0 : "API request failed",
|
|
288
|
+
data: a ? n.data : null
|
|
281
289
|
};
|
|
282
290
|
} catch (n) {
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
return
|
|
291
|
+
r && (F().ui.toast.error((n == null ? void 0 : n.toString()) ?? "Introspect error"), o(z.REFRESH, {})), u.error("Error in introspect:", n);
|
|
292
|
+
const a = n instanceof Error ? n.message : n;
|
|
293
|
+
return I(a);
|
|
286
294
|
}
|
|
287
295
|
}
|
|
288
296
|
function le(e) {
|
|
@@ -320,7 +328,7 @@ function le(e) {
|
|
|
320
328
|
* ```
|
|
321
329
|
*/
|
|
322
330
|
refresh() {
|
|
323
|
-
|
|
331
|
+
o(z.REFRESH, {});
|
|
324
332
|
},
|
|
325
333
|
/**
|
|
326
334
|
* Introspect (verify) a short-lived token with Salla's API.
|
|
@@ -330,10 +338,10 @@ function le(e) {
|
|
|
330
338
|
* @returns Promise that resolves with the introspect response. On API error, resolves with isVerified: false, isError: true, and empty data.
|
|
331
339
|
*/
|
|
332
340
|
async introspect(t = {}) {
|
|
333
|
-
const
|
|
341
|
+
const i = t.token ?? this.getToken() ?? "", r = t.appId ?? this.getAppId() ?? "";
|
|
334
342
|
return oe({
|
|
335
|
-
token:
|
|
336
|
-
appId:
|
|
343
|
+
token: i,
|
|
344
|
+
appId: r,
|
|
337
345
|
refreshOnError: t.refreshOnError
|
|
338
346
|
});
|
|
339
347
|
}
|
|
@@ -372,36 +380,36 @@ function fe(e) {
|
|
|
372
380
|
}
|
|
373
381
|
function he(e) {
|
|
374
382
|
const t = [];
|
|
375
|
-
return e.title === void 0 || e.title === null ? t.push("Nav action title is required") : typeof e.title != "string" && t.push("Nav action title must be a string"), e.onClick !== void 0 && e.onClick !== null && typeof e.onClick != "function" && t.push("Nav action onClick must be a function"), e.value !== void 0 && e.value !== null && typeof e.value != "string" && t.push("Nav action value must be a string"), e.subTitle !== void 0 && e.subTitle !== null && typeof e.subTitle != "string" && t.push("Nav action subTitle must be a string"), e.icon !== void 0 && e.icon !== null && typeof e.icon != "string" && t.push("Nav action icon must be a string"), e.disabled !== void 0 && e.disabled !== null && typeof e.disabled != "boolean" && t.push("Nav action disabled must be a boolean"), e.extendedActions !== void 0 && e.extendedActions !== null && (Array.isArray(e.extendedActions) ? e.extendedActions.forEach((
|
|
376
|
-
if (typeof
|
|
377
|
-
t.push(`Extended action at index ${
|
|
383
|
+
return e.title === void 0 || e.title === null ? t.push("Nav action title is required") : typeof e.title != "string" && t.push("Nav action title must be a string"), e.onClick !== void 0 && e.onClick !== null && typeof e.onClick != "function" && t.push("Nav action onClick must be a function"), e.value !== void 0 && e.value !== null && typeof e.value != "string" && t.push("Nav action value must be a string"), e.subTitle !== void 0 && e.subTitle !== null && typeof e.subTitle != "string" && t.push("Nav action subTitle must be a string"), e.icon !== void 0 && e.icon !== null && typeof e.icon != "string" && t.push("Nav action icon must be a string"), e.disabled !== void 0 && e.disabled !== null && typeof e.disabled != "boolean" && t.push("Nav action disabled must be a boolean"), e.extendedActions !== void 0 && e.extendedActions !== null && (Array.isArray(e.extendedActions) ? e.extendedActions.forEach((i, r) => {
|
|
384
|
+
if (typeof i != "object" || i === null) {
|
|
385
|
+
t.push(`Extended action at index ${r} must be an object`);
|
|
378
386
|
return;
|
|
379
387
|
}
|
|
380
|
-
const n =
|
|
388
|
+
const n = i;
|
|
381
389
|
(!n.title || typeof n.title != "string") && t.push(
|
|
382
|
-
`Extended action at index ${
|
|
390
|
+
`Extended action at index ${r} is missing required "title" property`
|
|
383
391
|
), n.subTitle !== void 0 && typeof n.subTitle != "string" && t.push(
|
|
384
|
-
`Extended action at index ${
|
|
385
|
-
), n.url !== void 0 && typeof n.url != "string" && t.push(`Extended action at index ${
|
|
386
|
-
`Extended action at index ${
|
|
392
|
+
`Extended action at index ${r} subTitle must be a string`
|
|
393
|
+
), n.url !== void 0 && typeof n.url != "string" && t.push(`Extended action at index ${r} url must be a string`), n.value !== void 0 && typeof n.value != "string" && t.push(
|
|
394
|
+
`Extended action at index ${r} value must be a string`
|
|
387
395
|
), n.icon !== void 0 && typeof n.icon != "string" && t.push(
|
|
388
|
-
`Extended action at index ${
|
|
396
|
+
`Extended action at index ${r} icon must be a string`
|
|
389
397
|
), n.disabled !== void 0 && typeof n.disabled != "boolean" && t.push(
|
|
390
|
-
`Extended action at index ${
|
|
398
|
+
`Extended action at index ${r} disabled must be a boolean`
|
|
391
399
|
);
|
|
392
400
|
}) : t.push("Nav action extendedActions must be an array")), { valid: t.length === 0, errors: t };
|
|
393
401
|
}
|
|
394
|
-
const
|
|
402
|
+
const x = ["danger", "warning", "info"];
|
|
395
403
|
function ge(e) {
|
|
396
404
|
const t = [];
|
|
397
|
-
return e.title === void 0 || e.title === null ? t.push("Confirm dialog title is required") : typeof e.title != "string" ? t.push("Confirm dialog title must be a string") : e.title.trim() === "" && t.push("Confirm dialog title cannot be empty"), e.message === void 0 || e.message === null ? t.push("Confirm dialog message is required") : typeof e.message != "string" ? t.push("Confirm dialog message must be a string") : e.message.trim() === "" && t.push("Confirm dialog message cannot be empty"), e.confirmText !== void 0 && e.confirmText !== null && typeof e.confirmText != "string" && t.push("Confirm dialog confirmText must be a string"), e.cancelText !== void 0 && e.cancelText !== null && typeof e.cancelText != "string" && t.push("Confirm dialog cancelText must be a string"), e.variant !== void 0 && e.variant !== null && (typeof e.variant != "string" || !
|
|
398
|
-
`Invalid confirm variant "${e.variant}". Expected: ${
|
|
405
|
+
return e.title === void 0 || e.title === null ? t.push("Confirm dialog title is required") : typeof e.title != "string" ? t.push("Confirm dialog title must be a string") : e.title.trim() === "" && t.push("Confirm dialog title cannot be empty"), e.message === void 0 || e.message === null ? t.push("Confirm dialog message is required") : typeof e.message != "string" ? t.push("Confirm dialog message must be a string") : e.message.trim() === "" && t.push("Confirm dialog message cannot be empty"), e.confirmText !== void 0 && e.confirmText !== null && typeof e.confirmText != "string" && t.push("Confirm dialog confirmText must be a string"), e.cancelText !== void 0 && e.cancelText !== null && typeof e.cancelText != "string" && t.push("Confirm dialog cancelText must be a string"), e.variant !== void 0 && e.variant !== null && (typeof e.variant != "string" || !x.includes(e.variant)) && t.push(
|
|
406
|
+
`Invalid confirm variant "${e.variant}". Expected: ${x.join(" | ")}`
|
|
399
407
|
), { valid: t.length === 0, errors: t };
|
|
400
408
|
}
|
|
401
409
|
function f(e, t) {
|
|
402
410
|
u.error(
|
|
403
411
|
`Validation failed for ${e}:
|
|
404
|
-
` + t.map((
|
|
412
|
+
` + t.map((i) => ` • ${i}`).join(`
|
|
405
413
|
`)
|
|
406
414
|
);
|
|
407
415
|
}
|
|
@@ -411,12 +419,12 @@ function me() {
|
|
|
411
419
|
* Navigate to a path using React Router (SPA navigation).
|
|
412
420
|
*/
|
|
413
421
|
navigate(e, t) {
|
|
414
|
-
const
|
|
415
|
-
if (!
|
|
416
|
-
f(m.NAVIGATE,
|
|
422
|
+
const i = de({ path: e, ...t });
|
|
423
|
+
if (!i.valid) {
|
|
424
|
+
f(m.NAVIGATE, i.errors);
|
|
417
425
|
return;
|
|
418
426
|
}
|
|
419
|
-
|
|
427
|
+
o(m.NAVIGATE, {
|
|
420
428
|
path: e,
|
|
421
429
|
state: t == null ? void 0 : t.state,
|
|
422
430
|
replace: t == null ? void 0 : t.replace
|
|
@@ -431,7 +439,7 @@ function me() {
|
|
|
431
439
|
f(m.REDIRECT, t.errors);
|
|
432
440
|
return;
|
|
433
441
|
}
|
|
434
|
-
|
|
442
|
+
o(m.REDIRECT, { url: e });
|
|
435
443
|
},
|
|
436
444
|
/**
|
|
437
445
|
* Navigate to a path - auto-detects internal vs external.
|
|
@@ -448,12 +456,12 @@ function me() {
|
|
|
448
456
|
*/
|
|
449
457
|
resize(e) {
|
|
450
458
|
if (typeof e != "number" || e < 0) {
|
|
451
|
-
f(
|
|
459
|
+
f(y.RESIZE, [
|
|
452
460
|
"Height must be a non-negative number"
|
|
453
461
|
]);
|
|
454
462
|
return;
|
|
455
463
|
}
|
|
456
|
-
|
|
464
|
+
o(y.RESIZE, { height: e });
|
|
457
465
|
},
|
|
458
466
|
/**
|
|
459
467
|
* Auto-resize iframe to content height.
|
|
@@ -472,14 +480,14 @@ function me() {
|
|
|
472
480
|
]);
|
|
473
481
|
return;
|
|
474
482
|
}
|
|
475
|
-
|
|
483
|
+
o(m.SET_TITLE, { title: e });
|
|
476
484
|
}
|
|
477
485
|
};
|
|
478
486
|
}
|
|
479
|
-
function
|
|
487
|
+
function pe() {
|
|
480
488
|
const e = /* @__PURE__ */ new Set();
|
|
481
489
|
let t = null;
|
|
482
|
-
return
|
|
490
|
+
return T(w.ACTION_CLICK, (r) => {
|
|
483
491
|
if (t)
|
|
484
492
|
try {
|
|
485
493
|
t();
|
|
@@ -488,36 +496,36 @@ function be() {
|
|
|
488
496
|
}
|
|
489
497
|
e.forEach((n) => {
|
|
490
498
|
try {
|
|
491
|
-
n(
|
|
492
|
-
} catch (
|
|
493
|
-
u.error("Error in action click callback:",
|
|
499
|
+
n(r.payload.url, r.payload.value);
|
|
500
|
+
} catch (a) {
|
|
501
|
+
u.error("Error in action click callback:", a);
|
|
494
502
|
}
|
|
495
503
|
});
|
|
496
504
|
}), {
|
|
497
505
|
/**
|
|
498
506
|
* Set the primary action button.
|
|
499
507
|
*/
|
|
500
|
-
setAction(
|
|
501
|
-
var
|
|
502
|
-
const n = he(
|
|
508
|
+
setAction(r) {
|
|
509
|
+
var a;
|
|
510
|
+
const n = he(r);
|
|
503
511
|
if (!n.valid) {
|
|
504
|
-
f(
|
|
512
|
+
f(w.SET_ACTION, n.errors);
|
|
505
513
|
return;
|
|
506
514
|
}
|
|
507
|
-
|
|
508
|
-
title:
|
|
509
|
-
onClick:
|
|
510
|
-
value:
|
|
511
|
-
subTitle:
|
|
512
|
-
icon:
|
|
513
|
-
disabled:
|
|
514
|
-
extendedActions: (
|
|
515
|
-
title:
|
|
516
|
-
subTitle:
|
|
517
|
-
url:
|
|
518
|
-
value:
|
|
519
|
-
icon:
|
|
520
|
-
disabled:
|
|
515
|
+
r.onClick ? t = r.onClick : t = null, o(w.SET_ACTION, {
|
|
516
|
+
title: r.title,
|
|
517
|
+
onClick: r.onClick ? !0 : void 0,
|
|
518
|
+
value: r.value,
|
|
519
|
+
subTitle: r.subTitle,
|
|
520
|
+
icon: r.icon,
|
|
521
|
+
disabled: r.disabled,
|
|
522
|
+
extendedActions: (a = r.extendedActions) == null ? void 0 : a.map((l) => ({
|
|
523
|
+
title: l.title,
|
|
524
|
+
subTitle: l.subTitle,
|
|
525
|
+
url: l.url,
|
|
526
|
+
value: l.value,
|
|
527
|
+
icon: l.icon,
|
|
528
|
+
disabled: l.disabled
|
|
521
529
|
}))
|
|
522
530
|
});
|
|
523
531
|
},
|
|
@@ -525,52 +533,51 @@ function be() {
|
|
|
525
533
|
* Clear the primary action button.
|
|
526
534
|
*/
|
|
527
535
|
clearAction() {
|
|
528
|
-
t = null,
|
|
536
|
+
t = null, o(w.SET_ACTION, {
|
|
529
537
|
title: ""
|
|
530
538
|
});
|
|
531
539
|
},
|
|
532
540
|
/**
|
|
533
541
|
* Subscribe to action button clicks.
|
|
534
542
|
*/
|
|
535
|
-
onActionClick(
|
|
536
|
-
return e.add(
|
|
537
|
-
e.delete(
|
|
543
|
+
onActionClick(r) {
|
|
544
|
+
return e.add(r), () => {
|
|
545
|
+
e.delete(r);
|
|
538
546
|
};
|
|
539
547
|
},
|
|
540
548
|
// Legacy aliases
|
|
541
|
-
primaryAction(
|
|
542
|
-
this.setAction(
|
|
549
|
+
primaryAction(r) {
|
|
550
|
+
this.setAction(r);
|
|
543
551
|
},
|
|
544
552
|
clearPrimaryAction() {
|
|
545
553
|
this.clearAction();
|
|
546
554
|
}
|
|
547
555
|
};
|
|
548
556
|
}
|
|
549
|
-
function
|
|
557
|
+
function be() {
|
|
550
558
|
return {
|
|
551
559
|
/**
|
|
552
560
|
* Show loading indicator.
|
|
553
|
-
* @param mode - Display mode ('full' for full page, 'component' for inline)
|
|
554
561
|
*/
|
|
555
|
-
show(
|
|
556
|
-
|
|
562
|
+
show() {
|
|
563
|
+
o(d.LOADING, { action: "show" });
|
|
557
564
|
},
|
|
558
565
|
/**
|
|
559
566
|
* Hide loading indicator.
|
|
560
567
|
*/
|
|
561
568
|
hide() {
|
|
562
|
-
|
|
569
|
+
o(d.LOADING, { action: "hide" });
|
|
563
570
|
}
|
|
564
571
|
};
|
|
565
572
|
}
|
|
566
|
-
function
|
|
573
|
+
function Ee() {
|
|
567
574
|
const e = (t) => {
|
|
568
|
-
const
|
|
569
|
-
if (!
|
|
570
|
-
f(d.TOAST,
|
|
575
|
+
const i = ue(t);
|
|
576
|
+
if (!i.valid) {
|
|
577
|
+
f(d.TOAST, i.errors);
|
|
571
578
|
return;
|
|
572
579
|
}
|
|
573
|
-
|
|
580
|
+
o(d.TOAST, {
|
|
574
581
|
type: t.type,
|
|
575
582
|
message: t.message,
|
|
576
583
|
duration: t.duration
|
|
@@ -584,26 +591,26 @@ function pe() {
|
|
|
584
591
|
/**
|
|
585
592
|
* Show success toast.
|
|
586
593
|
*/
|
|
587
|
-
success(t,
|
|
588
|
-
e({ type: "success", message: t, duration:
|
|
594
|
+
success(t, i) {
|
|
595
|
+
e({ type: "success", message: t, duration: i });
|
|
589
596
|
},
|
|
590
597
|
/**
|
|
591
598
|
* Show error toast.
|
|
592
599
|
*/
|
|
593
|
-
error(t,
|
|
594
|
-
e({ type: "error", message: t, duration:
|
|
600
|
+
error(t, i) {
|
|
601
|
+
e({ type: "error", message: t, duration: i });
|
|
595
602
|
},
|
|
596
603
|
/**
|
|
597
604
|
* Show warning toast.
|
|
598
605
|
*/
|
|
599
|
-
warning(t,
|
|
600
|
-
e({ type: "warning", message: t, duration:
|
|
606
|
+
warning(t, i) {
|
|
607
|
+
e({ type: "warning", message: t, duration: i });
|
|
601
608
|
},
|
|
602
609
|
/**
|
|
603
610
|
* Show info toast.
|
|
604
611
|
*/
|
|
605
|
-
info(t,
|
|
606
|
-
e({ type: "info", message: t, duration:
|
|
612
|
+
info(t, i) {
|
|
613
|
+
e({ type: "info", message: t, duration: i });
|
|
607
614
|
}
|
|
608
615
|
};
|
|
609
616
|
}
|
|
@@ -613,7 +620,7 @@ function ye() {
|
|
|
613
620
|
* Open a modal.
|
|
614
621
|
*/
|
|
615
622
|
open(e, t) {
|
|
616
|
-
|
|
623
|
+
o(d.MODAL, {
|
|
617
624
|
action: "open",
|
|
618
625
|
id: e,
|
|
619
626
|
content: t
|
|
@@ -623,7 +630,7 @@ function ye() {
|
|
|
623
630
|
* Close a modal.
|
|
624
631
|
*/
|
|
625
632
|
close(e) {
|
|
626
|
-
|
|
633
|
+
o(d.MODAL, {
|
|
627
634
|
action: "close",
|
|
628
635
|
id: e
|
|
629
636
|
});
|
|
@@ -644,8 +651,8 @@ function Te() {
|
|
|
644
651
|
}
|
|
645
652
|
function ve() {
|
|
646
653
|
return {
|
|
647
|
-
loading:
|
|
648
|
-
toast:
|
|
654
|
+
loading: be(),
|
|
655
|
+
toast: Ee(),
|
|
649
656
|
modal: ye(),
|
|
650
657
|
confirm: Te()
|
|
651
658
|
};
|
|
@@ -658,14 +665,14 @@ function we() {
|
|
|
658
665
|
create(e) {
|
|
659
666
|
const t = ce(e);
|
|
660
667
|
if (!t.valid) {
|
|
661
|
-
f(
|
|
668
|
+
f($.CREATE, t.errors);
|
|
662
669
|
return;
|
|
663
670
|
}
|
|
664
|
-
|
|
671
|
+
o($.CREATE, e);
|
|
665
672
|
}
|
|
666
673
|
};
|
|
667
674
|
}
|
|
668
|
-
const
|
|
675
|
+
const U = {
|
|
669
676
|
debug: !1,
|
|
670
677
|
initialized: !1
|
|
671
678
|
}, Ae = {
|
|
@@ -673,14 +680,14 @@ const x = {
|
|
|
673
680
|
width: 0,
|
|
674
681
|
locale: "ar",
|
|
675
682
|
currency: "SAR"
|
|
676
|
-
},
|
|
683
|
+
}, V = {
|
|
677
684
|
ready: !1,
|
|
678
685
|
initializing: !1,
|
|
679
686
|
layout: { ...Ae }
|
|
680
687
|
};
|
|
681
688
|
class Se {
|
|
682
689
|
constructor() {
|
|
683
|
-
this.config = { ...
|
|
690
|
+
this.config = { ...U }, this.state = { ...V }, this.themeCallbacks = /* @__PURE__ */ new Set(), this.initCallbacks = /* @__PURE__ */ new Set(), this.appReady = !1, this.auth = le(), this.page = me(), this.nav = pe(), this.ui = ve(), this.checkout = we(), this.setupThemeListener(), this.setupResponseListeners();
|
|
684
691
|
}
|
|
685
692
|
/**
|
|
686
693
|
* Get current SDK state (layout info only, no token).
|
|
@@ -710,22 +717,22 @@ class Se {
|
|
|
710
717
|
* @param type - Log type (log, warn, error, info, debug)
|
|
711
718
|
* @param args - Arguments to log
|
|
712
719
|
*/
|
|
713
|
-
internalLog(t, ...
|
|
720
|
+
internalLog(t, ...i) {
|
|
714
721
|
switch (t) {
|
|
715
722
|
case "log":
|
|
716
|
-
u.log(...
|
|
723
|
+
u.log(...i);
|
|
717
724
|
break;
|
|
718
725
|
case "warn":
|
|
719
|
-
u.warn(...
|
|
726
|
+
u.warn(...i);
|
|
720
727
|
break;
|
|
721
728
|
case "error":
|
|
722
|
-
u.error(...
|
|
729
|
+
u.error(...i);
|
|
723
730
|
break;
|
|
724
731
|
case "info":
|
|
725
|
-
u.info(...
|
|
732
|
+
u.info(...i);
|
|
726
733
|
break;
|
|
727
734
|
case "debug":
|
|
728
|
-
u.debug(...
|
|
735
|
+
u.debug(...i);
|
|
729
736
|
break;
|
|
730
737
|
}
|
|
731
738
|
}
|
|
@@ -733,12 +740,12 @@ class Se {
|
|
|
733
740
|
* Set up listener for theme changes from host.
|
|
734
741
|
*/
|
|
735
742
|
setupThemeListener() {
|
|
736
|
-
|
|
737
|
-
this.state.layout.theme = t.theme, this.internalLog("debug", "Theme changed:", t.theme), this.themeCallbacks.forEach((
|
|
743
|
+
T(k.THEME_CHANGE, (t) => {
|
|
744
|
+
this.state.layout.theme = t.payload.theme, this.internalLog("debug", "Theme changed:", t.payload.theme), this.themeCallbacks.forEach((i) => {
|
|
738
745
|
try {
|
|
739
|
-
|
|
740
|
-
} catch (
|
|
741
|
-
this.internalLog("error", "Error in theme callback:",
|
|
746
|
+
i(t.payload.theme);
|
|
747
|
+
} catch (r) {
|
|
748
|
+
this.internalLog("error", "Error in theme callback:", r);
|
|
742
749
|
}
|
|
743
750
|
});
|
|
744
751
|
});
|
|
@@ -747,10 +754,10 @@ class Se {
|
|
|
747
754
|
* Set up listeners for async response events from host.
|
|
748
755
|
*/
|
|
749
756
|
setupResponseListeners() {
|
|
750
|
-
|
|
751
|
-
this.internalLog("debug", "Received confirm response:", t),
|
|
752
|
-
}),
|
|
753
|
-
this.internalLog("debug", "Received modal response:", t),
|
|
757
|
+
T(d.CONFIRM_RESPONSE, (t) => {
|
|
758
|
+
this.internalLog("debug", "Received confirm response:", t), t.requestId && D(t.requestId, { confirmed: t.payload.confirmed });
|
|
759
|
+
}), T(d.MODAL_RESPONSE, (t) => {
|
|
760
|
+
this.internalLog("debug", "Received modal response:", t), t.requestId && D(t.requestId, t.payload.result, t.payload.error);
|
|
754
761
|
});
|
|
755
762
|
}
|
|
756
763
|
/**
|
|
@@ -788,8 +795,8 @@ class Se {
|
|
|
788
795
|
if (this.config.initialized)
|
|
789
796
|
try {
|
|
790
797
|
t(this.getState());
|
|
791
|
-
} catch (
|
|
792
|
-
this.internalLog("error", "Error in init callback:",
|
|
798
|
+
} catch (i) {
|
|
799
|
+
this.internalLog("error", "Error in init callback:", i);
|
|
793
800
|
}
|
|
794
801
|
return this.initCallbacks.add(t), () => {
|
|
795
802
|
this.initCallbacks.delete(t);
|
|
@@ -807,11 +814,11 @@ class Se {
|
|
|
807
814
|
* embedded.log('error', 'Failed to load data', { endpoint: '/api/data' });
|
|
808
815
|
* ```
|
|
809
816
|
*/
|
|
810
|
-
log(t,
|
|
811
|
-
|
|
817
|
+
log(t, i, r) {
|
|
818
|
+
o(j.LOG, {
|
|
812
819
|
level: t,
|
|
813
|
-
message:
|
|
814
|
-
context:
|
|
820
|
+
message: i,
|
|
821
|
+
context: r
|
|
815
822
|
});
|
|
816
823
|
}
|
|
817
824
|
/**
|
|
@@ -833,7 +840,7 @@ class Se {
|
|
|
833
840
|
this.internalLog("warn", "Cannot signal ready before init() is called");
|
|
834
841
|
return;
|
|
835
842
|
}
|
|
836
|
-
this.appReady = !0,
|
|
843
|
+
this.appReady = !0, o(y.READY, {}), this.internalLog("debug", "Sent ready signal to host");
|
|
837
844
|
}
|
|
838
845
|
/**
|
|
839
846
|
* Initialize the SDK and establish connection with the host.
|
|
@@ -849,7 +856,6 @@ class Se {
|
|
|
849
856
|
* ```
|
|
850
857
|
*/
|
|
851
858
|
async init(t = {}) {
|
|
852
|
-
var r, i, n, s;
|
|
853
859
|
if (this.config.initialized)
|
|
854
860
|
return this.internalLog(
|
|
855
861
|
"debug",
|
|
@@ -867,39 +873,41 @@ class Se {
|
|
|
867
873
|
debug: this.config.debug
|
|
868
874
|
}), this.state.initializing = !0, this.internalLog("debug", "Initializing SDK...");
|
|
869
875
|
try {
|
|
870
|
-
|
|
876
|
+
o(y.INIT, {
|
|
871
877
|
height: document.documentElement.scrollHeight
|
|
872
878
|
}), this.internalLog(
|
|
873
879
|
"debug",
|
|
874
880
|
"Sent iframe.ready message, waiting for context..."
|
|
875
881
|
);
|
|
876
|
-
const
|
|
877
|
-
|
|
882
|
+
const i = await J(
|
|
883
|
+
k.PROVIDE
|
|
878
884
|
);
|
|
879
|
-
this.internalLog("debug", "Received context from host:",
|
|
885
|
+
this.internalLog("debug", "Received context from host:", i);
|
|
886
|
+
const r = i.payload.layout;
|
|
887
|
+
this.state = {
|
|
880
888
|
ready: !0,
|
|
881
889
|
initializing: !1,
|
|
882
890
|
layout: {
|
|
883
|
-
theme: (
|
|
884
|
-
width: (
|
|
885
|
-
locale: (
|
|
886
|
-
currency: (
|
|
891
|
+
theme: (r == null ? void 0 : r.theme) ?? "light",
|
|
892
|
+
width: (r == null ? void 0 : r.width) ?? 0,
|
|
893
|
+
locale: (r == null ? void 0 : r.locale) ?? "ar",
|
|
894
|
+
currency: (r == null ? void 0 : r.currency) ?? "SAR"
|
|
887
895
|
}
|
|
888
896
|
}, this.config.initialized = !0, this.internalLog(
|
|
889
897
|
"debug",
|
|
890
898
|
"Initialization complete. Layout:",
|
|
891
899
|
this.state.layout
|
|
892
900
|
);
|
|
893
|
-
const
|
|
894
|
-
return this.initCallbacks.forEach((
|
|
901
|
+
const n = this.getState();
|
|
902
|
+
return this.initCallbacks.forEach((a) => {
|
|
895
903
|
try {
|
|
896
|
-
|
|
897
|
-
} catch (
|
|
898
|
-
this.internalLog("error", "Error in init callback:",
|
|
904
|
+
a(n);
|
|
905
|
+
} catch (l) {
|
|
906
|
+
this.internalLog("error", "Error in init callback:", l);
|
|
899
907
|
}
|
|
900
908
|
}), { layout: { ...this.state.layout } };
|
|
901
|
-
} catch (
|
|
902
|
-
throw this.state.initializing = !1, this.state.ready = !1,
|
|
909
|
+
} catch (i) {
|
|
910
|
+
throw this.state.initializing = !1, this.state.ready = !1, i;
|
|
903
911
|
}
|
|
904
912
|
}
|
|
905
913
|
/**
|
|
@@ -908,8 +916,8 @@ class Se {
|
|
|
908
916
|
*/
|
|
909
917
|
waitForInit() {
|
|
910
918
|
return new Promise((t) => {
|
|
911
|
-
const
|
|
912
|
-
|
|
919
|
+
const i = this.onInit((r) => {
|
|
920
|
+
i(), t({ layout: { ...r.layout } });
|
|
913
921
|
});
|
|
914
922
|
});
|
|
915
923
|
}
|
|
@@ -924,21 +932,21 @@ class Se {
|
|
|
924
932
|
* ```
|
|
925
933
|
*/
|
|
926
934
|
destroy() {
|
|
927
|
-
this.internalLog("debug", "Destroying SDK instance"), this.config.initialized && (
|
|
935
|
+
this.internalLog("debug", "Destroying SDK instance"), this.config.initialized && (o(y.DESTROY, {}), this.internalLog("debug", "Sent destroy event to host")), ne("SDK destroyed"), Q(), this.themeCallbacks.clear(), this.initCallbacks.clear(), this.config = { ...U }, this.state = { ...V }, this.appReady = !1;
|
|
928
936
|
}
|
|
929
937
|
}
|
|
930
|
-
let
|
|
938
|
+
let p = null;
|
|
931
939
|
function F() {
|
|
932
|
-
return
|
|
940
|
+
return p || (p = new Se()), p;
|
|
933
941
|
}
|
|
934
942
|
function Re() {
|
|
935
|
-
|
|
943
|
+
p && (p.destroy(), p = null);
|
|
936
944
|
}
|
|
937
|
-
const
|
|
938
|
-
typeof window < "u" && (window.salla = window.salla || window.Salla || {}, window.Salla = window.salla, window.salla.embedded || (window.salla.embedded =
|
|
945
|
+
const q = F(), Ce = L;
|
|
946
|
+
typeof window < "u" && (window.salla = window.salla || window.Salla || {}, window.Salla = window.salla, window.salla.embedded || (window.salla.embedded = q), window.Salla.embedded || (window.Salla.embedded = q));
|
|
939
947
|
export {
|
|
940
948
|
Se as EmbeddedApp,
|
|
941
|
-
|
|
949
|
+
q as embedded,
|
|
942
950
|
F as getEmbeddedApp,
|
|
943
951
|
Re as resetEmbeddedApp,
|
|
944
952
|
Ce as version
|