@skyservice-developers/vue-dev-kit 3.0.0 → 3.1.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/dist/{money-BCv6JlZu.js → money-DS3eJE0W.js} +154 -142
- package/dist/money-DVXnJ7Ca.cjs +1 -0
- package/dist/sdk/bridge.d.ts +8 -0
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.js +18 -17
- package/dist/style.css +1 -1
- package/dist/vue-dev-kit.cjs +7 -7
- package/dist/vue-dev-kit.js +3244 -3248
- package/package.json +1 -1
- package/dist/money-dyX9wNiC.cjs +0 -1
|
@@ -1,134 +1,145 @@
|
|
|
1
|
-
import
|
|
2
|
-
const g = "DASHBOARD",
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return `sdk_${Date.now()}_${++
|
|
1
|
+
import A from "ua-parser-js";
|
|
2
|
+
const g = "DASHBOARD", k = 5e3, R = 700;
|
|
3
|
+
let E = 0, u = null;
|
|
4
|
+
function y() {
|
|
5
|
+
return `sdk_${Date.now()}_${++E}`;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function T() {
|
|
8
8
|
return "APP_" + Math.random().toString(36).slice(2, 10);
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function K(t) {
|
|
11
11
|
u = t;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
return u || (u =
|
|
13
|
+
function I() {
|
|
14
|
+
return u || (u = T()), u;
|
|
15
15
|
}
|
|
16
16
|
function c(t) {
|
|
17
17
|
window.parent.postMessage(
|
|
18
18
|
{
|
|
19
19
|
...t,
|
|
20
|
-
sender:
|
|
20
|
+
sender: I(),
|
|
21
21
|
target: t.target || g
|
|
22
22
|
},
|
|
23
23
|
"*"
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
function S(t, e) {
|
|
27
|
+
const r = I();
|
|
28
|
+
return new Promise((n) => {
|
|
29
|
+
const o = setTimeout(() => {
|
|
30
|
+
window.removeEventListener("message", s), n(null);
|
|
31
|
+
}, e);
|
|
32
|
+
function s(i) {
|
|
33
|
+
const a = i.data;
|
|
34
|
+
(a == null ? void 0 : a.type) === "DATA_RESPONSE" && (a == null ? void 0 : a.requestId) === t && (!a.target || a.target === r) && (clearTimeout(o), window.removeEventListener("message", s), n(a.data ?? null));
|
|
34
35
|
}
|
|
35
|
-
window.addEventListener("message",
|
|
36
|
-
})
|
|
36
|
+
window.addEventListener("message", s);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function m(t, e, r = k) {
|
|
40
|
+
if (!l()) return Promise.resolve(null);
|
|
41
|
+
const n = y(), o = S(n, r);
|
|
42
|
+
return c({ type: "DATA_REQUEST", requestId: n, source: t, key: e }), o;
|
|
37
43
|
}
|
|
38
|
-
function
|
|
44
|
+
function F(t) {
|
|
39
45
|
c({ type: "navigate", path: t });
|
|
40
46
|
}
|
|
41
|
-
function
|
|
47
|
+
function L() {
|
|
42
48
|
c({ type: "exit" });
|
|
43
49
|
}
|
|
44
|
-
const
|
|
45
|
-
function
|
|
46
|
-
|
|
50
|
+
const G = L;
|
|
51
|
+
function x(t = R) {
|
|
52
|
+
if (!l()) return Promise.resolve(!1);
|
|
53
|
+
const e = y(), r = S(e, t);
|
|
54
|
+
return c({ type: "back", requestId: e }), r.then((n) => (n == null ? void 0 : n.ok) === !0);
|
|
47
55
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
56
|
+
function d(t) {
|
|
57
|
+
return m("store", t);
|
|
50
58
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
59
|
+
function v(t) {
|
|
60
|
+
return m("localStorage", t);
|
|
53
61
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
function x() {
|
|
58
|
-
return p("user");
|
|
59
|
-
}
|
|
60
|
-
function W() {
|
|
61
|
-
return I("token");
|
|
62
|
+
function W(t) {
|
|
63
|
+
return m("window", t);
|
|
62
64
|
}
|
|
63
65
|
function j() {
|
|
64
|
-
return
|
|
66
|
+
return d("company");
|
|
67
|
+
}
|
|
68
|
+
function q() {
|
|
69
|
+
return d("user");
|
|
65
70
|
}
|
|
66
71
|
function H() {
|
|
67
|
-
return
|
|
72
|
+
return v("token");
|
|
68
73
|
}
|
|
69
|
-
function Z(
|
|
74
|
+
function Z() {
|
|
75
|
+
return v("lang");
|
|
76
|
+
}
|
|
77
|
+
function Y() {
|
|
78
|
+
return d("productCategories");
|
|
79
|
+
}
|
|
80
|
+
function z(t, e) {
|
|
70
81
|
c({ type: "setLocalStorage", key: t, value: e });
|
|
71
82
|
}
|
|
72
|
-
function
|
|
83
|
+
function Q(t) {
|
|
73
84
|
c({ type: "setRocketMode", value: t });
|
|
74
85
|
}
|
|
75
|
-
function
|
|
86
|
+
function V(t, e) {
|
|
76
87
|
c({ type: "trackVisit", name: t, path: e });
|
|
77
88
|
}
|
|
78
|
-
function
|
|
89
|
+
function X(t) {
|
|
79
90
|
c({ type: "openExternalLink", url: t });
|
|
80
91
|
}
|
|
81
|
-
function
|
|
92
|
+
function J() {
|
|
82
93
|
c({ type: "openCrispChat" });
|
|
83
94
|
}
|
|
84
|
-
function
|
|
95
|
+
function ee(t) {
|
|
85
96
|
c({ type: "notification", text: t });
|
|
86
97
|
}
|
|
87
|
-
function
|
|
98
|
+
function te(t) {
|
|
88
99
|
c({ type: "notification", text: t, variant: "error" });
|
|
89
100
|
}
|
|
90
|
-
function
|
|
101
|
+
function ne(t) {
|
|
91
102
|
c({ type: "notification", text: t, variant: "warn" });
|
|
92
103
|
}
|
|
93
|
-
function
|
|
104
|
+
function l() {
|
|
94
105
|
try {
|
|
95
106
|
return window.self !== window.top;
|
|
96
107
|
} catch {
|
|
97
108
|
return !0;
|
|
98
109
|
}
|
|
99
110
|
}
|
|
100
|
-
const
|
|
101
|
-
function
|
|
111
|
+
const re = l;
|
|
112
|
+
function se(t) {
|
|
102
113
|
function e(r) {
|
|
103
114
|
var n;
|
|
104
115
|
((n = r.data) == null ? void 0 : n.sender) === g && t(r.data);
|
|
105
116
|
}
|
|
106
117
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
107
118
|
}
|
|
108
|
-
function
|
|
119
|
+
function p() {
|
|
109
120
|
if (typeof window > "u") return "browser";
|
|
110
121
|
if (window.webkit != null && window.webkit.messageHandlers !== void 0)
|
|
111
122
|
try {
|
|
112
|
-
if (
|
|
123
|
+
if (A(navigator.userAgent).browser.name === "WebKit") return "ios_webview";
|
|
113
124
|
} catch (t) {
|
|
114
125
|
console.error(t);
|
|
115
126
|
}
|
|
116
127
|
return typeof Android < "u" ? "android_webview" : typeof window.cefQuery < "u" ? "cef_webview" : "browser";
|
|
117
128
|
}
|
|
118
|
-
function
|
|
119
|
-
return
|
|
120
|
-
}
|
|
121
|
-
function re() {
|
|
122
|
-
return f() === "android_webview";
|
|
129
|
+
function oe() {
|
|
130
|
+
return p() === "ios_webview";
|
|
123
131
|
}
|
|
124
132
|
function ie() {
|
|
125
|
-
return
|
|
133
|
+
return p() === "android_webview";
|
|
134
|
+
}
|
|
135
|
+
function ae() {
|
|
136
|
+
return p() === "cef_webview";
|
|
126
137
|
}
|
|
127
|
-
function
|
|
128
|
-
return
|
|
138
|
+
function ce() {
|
|
139
|
+
return p() !== "browser";
|
|
129
140
|
}
|
|
130
|
-
const
|
|
131
|
-
class
|
|
141
|
+
const N = "https://api.cabinet.developer.skyservice.online/index.php";
|
|
142
|
+
class C {
|
|
132
143
|
constructor(e) {
|
|
133
144
|
this.permsCache = null, this.token = e.token, this.companyId = e.companyId, this.appId = e.appId, this.developerId = e.developerId, this.deploymentId = e.deploymentId, this.appName = e.appName;
|
|
134
145
|
const r = e.domain.replace("dashboard", "api");
|
|
@@ -136,7 +147,7 @@ class v {
|
|
|
136
147
|
}
|
|
137
148
|
/** Factory — create a new SkyserviceAPI instance. */
|
|
138
149
|
static create(e) {
|
|
139
|
-
return new
|
|
150
|
+
return new C(e);
|
|
140
151
|
}
|
|
141
152
|
// --- Low-level ---
|
|
142
153
|
async get(e) {
|
|
@@ -147,26 +158,26 @@ class v {
|
|
|
147
158
|
}), n = await fetch(`${this.baseUrl}/?${r}`);
|
|
148
159
|
if (!n.ok)
|
|
149
160
|
throw new Error(`Skyservice API error: ${n.status}`);
|
|
150
|
-
const
|
|
151
|
-
if (
|
|
152
|
-
throw new Error(`Skyservice API returned status: ${
|
|
153
|
-
return
|
|
161
|
+
const o = await n.json();
|
|
162
|
+
if (o.status !== "done")
|
|
163
|
+
throw new Error(`Skyservice API returned status: ${o.status}`);
|
|
164
|
+
return o.data;
|
|
154
165
|
}
|
|
155
166
|
async post(e, r, n) {
|
|
156
|
-
const
|
|
167
|
+
const o = new URLSearchParams({
|
|
157
168
|
token: this.token,
|
|
158
169
|
...r
|
|
159
|
-
}),
|
|
170
|
+
}), s = await fetch(`${e}?${o}`, {
|
|
160
171
|
method: "POST",
|
|
161
172
|
headers: { "Content-Type": "application/json" },
|
|
162
173
|
body: JSON.stringify(n)
|
|
163
174
|
});
|
|
164
|
-
if (!
|
|
165
|
-
throw new Error(`Skyservice API error: ${
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
throw new Error(`Skyservice API returned status: ${
|
|
169
|
-
return
|
|
175
|
+
if (!s.ok)
|
|
176
|
+
throw new Error(`Skyservice API error: ${s.status}`);
|
|
177
|
+
const i = await s.json();
|
|
178
|
+
if (i.status !== "done")
|
|
179
|
+
throw new Error(`Skyservice API returned status: ${i.status}`);
|
|
180
|
+
return i.data;
|
|
170
181
|
}
|
|
171
182
|
// --- Tradepoints ---
|
|
172
183
|
/**
|
|
@@ -215,7 +226,7 @@ class v {
|
|
|
215
226
|
of: "nomenclatureId",
|
|
216
227
|
...e != null && e.tradepointId ? { tradepointId: String(e.tradepointId) } : {}
|
|
217
228
|
});
|
|
218
|
-
return
|
|
229
|
+
return _(r.items, e == null ? void 0 : e.includeInactive);
|
|
219
230
|
}
|
|
220
231
|
// --- Integrations ---
|
|
221
232
|
/**
|
|
@@ -235,27 +246,27 @@ class v {
|
|
|
235
246
|
title: r,
|
|
236
247
|
settings: n
|
|
237
248
|
}) {
|
|
238
|
-
const
|
|
249
|
+
const o = e ? "activateApp" : "deactivateApp", s = {
|
|
239
250
|
company_id: this.companyId,
|
|
240
251
|
app_id: this.appId,
|
|
241
252
|
...this.developerId !== void 0 && { developer_id: this.developerId },
|
|
242
253
|
...e && n !== void 0 && { settings: n }
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
{ section: "integrations", action:
|
|
246
|
-
|
|
254
|
+
}, i = await this.post(
|
|
255
|
+
N,
|
|
256
|
+
{ section: "integrations", action: o },
|
|
257
|
+
s
|
|
247
258
|
);
|
|
248
259
|
return this.deploymentId && this.appName && typeof window < "u" && window.self !== window.top && window.parent.postMessage(
|
|
249
260
|
{
|
|
250
261
|
type: "sendActiveApp",
|
|
251
|
-
id:
|
|
262
|
+
id: i.id,
|
|
252
263
|
is_active: e,
|
|
253
264
|
deploymentId: this.deploymentId,
|
|
254
265
|
appName: this.appName,
|
|
255
266
|
title: r
|
|
256
267
|
},
|
|
257
268
|
"*"
|
|
258
|
-
),
|
|
269
|
+
), i;
|
|
259
270
|
}
|
|
260
271
|
async getPerms(e) {
|
|
261
272
|
const r = await this.loadPerms();
|
|
@@ -270,7 +281,7 @@ class v {
|
|
|
270
281
|
if (this.permsCache) return this.permsCache;
|
|
271
282
|
if (typeof window < "u")
|
|
272
283
|
try {
|
|
273
|
-
const n = await
|
|
284
|
+
const n = await d("perms");
|
|
274
285
|
if (n && Object.keys(n).length > 0)
|
|
275
286
|
return this.permsCache = h(n), this.permsCache;
|
|
276
287
|
} catch {
|
|
@@ -290,28 +301,28 @@ function h(t) {
|
|
|
290
301
|
return e;
|
|
291
302
|
}
|
|
292
303
|
function b(t, e) {
|
|
293
|
-
var n,
|
|
304
|
+
var n, o;
|
|
294
305
|
const r = [];
|
|
295
|
-
for (const
|
|
296
|
-
if (e != null && !((n =
|
|
306
|
+
for (const s of t) {
|
|
307
|
+
if (e != null && !((n = s.tradepointShow) == null ? void 0 : n[String(e)]))
|
|
297
308
|
continue;
|
|
298
|
-
const
|
|
299
|
-
id:
|
|
300
|
-
pid:
|
|
301
|
-
name:
|
|
302
|
-
active:
|
|
303
|
-
background:
|
|
304
|
-
show:
|
|
309
|
+
const i = {
|
|
310
|
+
id: s.id,
|
|
311
|
+
pid: s.pid,
|
|
312
|
+
name: s.name,
|
|
313
|
+
active: s.active,
|
|
314
|
+
background: s.background,
|
|
315
|
+
show: s.show
|
|
305
316
|
};
|
|
306
|
-
|
|
317
|
+
s.img && (i.img = s.img), (o = s.children) != null && o.length && (i.children = b(s.children, e)), r.push(i);
|
|
307
318
|
}
|
|
308
319
|
return r;
|
|
309
320
|
}
|
|
310
|
-
const
|
|
311
|
-
function
|
|
321
|
+
const $ = /* @__PURE__ */ new Set(["product", "techcard"]), D = "/img/no.png";
|
|
322
|
+
function _(t, e) {
|
|
312
323
|
const r = [];
|
|
313
324
|
for (const n of t)
|
|
314
|
-
|
|
325
|
+
$.has(n.type) && (!e && !n.active || r.push({
|
|
315
326
|
id: n.id,
|
|
316
327
|
name: n.nomenclatureName,
|
|
317
328
|
price: n.price,
|
|
@@ -320,11 +331,11 @@ function $(t, e) {
|
|
|
320
331
|
active: n.active,
|
|
321
332
|
type: n.type,
|
|
322
333
|
unit: n.unit,
|
|
323
|
-
logo: n.logo && n.logo !==
|
|
334
|
+
logo: n.logo && n.logo !== D ? n.logo : ""
|
|
324
335
|
}));
|
|
325
336
|
return r;
|
|
326
337
|
}
|
|
327
|
-
const
|
|
338
|
+
const U = {
|
|
328
339
|
UAH: "₴",
|
|
329
340
|
USD: "$",
|
|
330
341
|
EUR: "€",
|
|
@@ -381,56 +392,57 @@ const D = {
|
|
|
381
392
|
RUR: "₽",
|
|
382
393
|
SAR: "SRls"
|
|
383
394
|
};
|
|
384
|
-
function
|
|
385
|
-
return t ?
|
|
395
|
+
function M(t) {
|
|
396
|
+
return t ? U[t.toUpperCase()] ?? t : "";
|
|
386
397
|
}
|
|
387
|
-
function
|
|
398
|
+
function B(t, e) {
|
|
388
399
|
try {
|
|
389
|
-
const r = new Intl.NumberFormat(e, { style: "currency", currency: t }).formatToParts(1), n = r.findIndex((
|
|
390
|
-
return n !== -1 &&
|
|
400
|
+
const r = new Intl.NumberFormat(e, { style: "currency", currency: t }).formatToParts(1), n = r.findIndex((s) => s.type === "currency"), o = r.findIndex((s) => s.type === "integer");
|
|
401
|
+
return n !== -1 && o !== -1 && n < o;
|
|
391
402
|
} catch {
|
|
392
403
|
return !1;
|
|
393
404
|
}
|
|
394
405
|
}
|
|
395
|
-
function
|
|
406
|
+
function ue(t, { currency: e = null, locale: r = "uk", decimals: n = 2 } = {}) {
|
|
396
407
|
if (t == null || t === "") return "";
|
|
397
|
-
const
|
|
398
|
-
if (!Number.isFinite(
|
|
399
|
-
const
|
|
400
|
-
return
|
|
408
|
+
const o = typeof t == "number" ? t : Number(t);
|
|
409
|
+
if (!Number.isFinite(o)) return String(t);
|
|
410
|
+
const s = " ", [i, a] = Math.abs(o).toFixed(n).split("."), P = i.replace(/\B(?=(\d{3})+(?!\d))/g, s), f = `${o < 0 ? "-" : ""}${P}${a ? "." + a : ""}`, w = M(e);
|
|
411
|
+
return w ? B(e, r) ? `${w}${f}` : `${f}${s}${w}` : f;
|
|
401
412
|
}
|
|
402
413
|
export {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
j as
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
414
|
+
X as A,
|
|
415
|
+
z as B,
|
|
416
|
+
U as C,
|
|
417
|
+
Q as D,
|
|
418
|
+
K as E,
|
|
419
|
+
V as F,
|
|
420
|
+
p as G,
|
|
421
|
+
C as S,
|
|
422
|
+
j as a,
|
|
423
|
+
Z as b,
|
|
424
|
+
M as c,
|
|
425
|
+
v as d,
|
|
426
|
+
L as e,
|
|
427
|
+
ue as f,
|
|
428
|
+
G as g,
|
|
429
|
+
Y as h,
|
|
430
|
+
I as i,
|
|
431
|
+
d as j,
|
|
432
|
+
H as k,
|
|
433
|
+
q as l,
|
|
434
|
+
W as m,
|
|
435
|
+
x as n,
|
|
424
436
|
ie as o,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
z
|
|
437
|
+
ae as p,
|
|
438
|
+
re as q,
|
|
439
|
+
l as r,
|
|
440
|
+
oe as s,
|
|
441
|
+
ce as t,
|
|
442
|
+
F as u,
|
|
443
|
+
ee as v,
|
|
444
|
+
te as w,
|
|
445
|
+
ne as x,
|
|
446
|
+
se as y,
|
|
447
|
+
J as z
|
|
436
448
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=require("ua-parser-js"),S="DASHBOARD",L=5e3,T=700;let N=0,p=null;function v(){return`sdk_${Date.now()}_${++N}`}function D(){return"APP_"+Math.random().toString(36).slice(2,10)}function $(t){p=t}function l(){return p||(p=D()),p}function c(t){window.parent.postMessage({...t,sender:l(),target:t.target||S},"*")}function C(t,e){const r=l();return new Promise(n=>{const i=setTimeout(()=>{window.removeEventListener("message",o),n(null)},e);function o(s){const a=s.data;(a==null?void 0:a.type)==="DATA_RESPONSE"&&(a==null?void 0:a.requestId)===t&&(!a.target||a.target===r)&&(clearTimeout(i),window.removeEventListener("message",o),n(a.data??null))}window.addEventListener("message",o)})}function m(t,e,r=L){if(!f())return Promise.resolve(null);const n=v(),i=C(n,r);return c({type:"DATA_REQUEST",requestId:n,source:t,key:e}),i}function U(t){c({type:"navigate",path:t})}function b(){c({type:"exit"})}const _=b;function M(t=T){if(!f())return Promise.resolve(!1);const e=v(),r=C(e,t);return c({type:"back",requestId:e}),r.then(n=>(n==null?void 0:n.ok)===!0)}function d(t){return m("store",t)}function h(t){return m("localStorage",t)}function B(t){return m("window",t)}function O(){return d("company")}function W(){return d("user")}function K(){return h("token")}function F(){return h("lang")}function G(){return d("productCategories")}function x(t,e){c({type:"setLocalStorage",key:t,value:e})}function j(t){c({type:"setRocketMode",value:t})}function q(t,e){c({type:"trackVisit",name:t,path:e})}function H(t){c({type:"openExternalLink",url:t})}function Y(){c({type:"openCrispChat"})}function Z(t){c({type:"notification",text:t})}function V(t){c({type:"notification",text:t,variant:"error"})}function Q(t){c({type:"notification",text:t,variant:"warn"})}function f(){try{return window.self!==window.top}catch{return!0}}const z=f;function X(t){function e(r){var n;((n=r.data)==null?void 0:n.sender)===S&&t(r.data)}return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}function u(){if(typeof window>"u")return"browser";if(window.webkit!=null&&window.webkit.messageHandlers!==void 0)try{if(E(navigator.userAgent).browser.name==="WebKit")return"ios_webview"}catch(t){console.error(t)}return typeof Android<"u"?"android_webview":typeof window.cefQuery<"u"?"cef_webview":"browser"}function J(){return u()==="ios_webview"}function ee(){return u()==="android_webview"}function te(){return u()==="cef_webview"}function ne(){return u()!=="browser"}const re="https://api.cabinet.developer.skyservice.online/index.php";class y{constructor(e){this.permsCache=null,this.token=e.token,this.companyId=e.companyId,this.appId=e.appId,this.developerId=e.developerId,this.deploymentId=e.deploymentId,this.appName=e.appName;const r=e.domain.replace("dashboard","api");this.baseUrl=r.startsWith("http")?r:`https://${r}`}static create(e){return new y(e)}async get(e){const r=new URLSearchParams({token:this.token,companyId:this.companyId,...e}),n=await fetch(`${this.baseUrl}/?${r}`);if(!n.ok)throw new Error(`Skyservice API error: ${n.status}`);const i=await n.json();if(i.status!=="done")throw new Error(`Skyservice API returned status: ${i.status}`);return i.data}async post(e,r,n){const i=new URLSearchParams({token:this.token,...r}),o=await fetch(`${e}?${i}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!o.ok)throw new Error(`Skyservice API error: ${o.status}`);const s=await o.json();if(s.status!=="done")throw new Error(`Skyservice API returned status: ${s.status}`);return s.data}async getTradepoints(e){const r=await this.get({section:"tradepoints",action:"getTradepoints"});return e!=null&&e.includeDeleted?r.items:r.items.filter(n=>!n.deleted&&!n.frozen)}async getCategoryTree(e){const r=await this.get({section:"productCategory",action:"getCategories",...e?{tradepointId:String(e)}:{}});return k(r,e)}async getProducts(e){const r=await this.get({section:"products",action:"getProducts",pagelimit:"9999",ot:"desc",of:"nomenclatureId",...e!=null&&e.tradepointId?{tradepointId:String(e.tradepointId)}:{}});return se(r.items,e==null?void 0:e.includeInactive)}async setAppActive({isActive:e,title:r,settings:n}){const i=e?"activateApp":"deactivateApp",o={company_id:this.companyId,app_id:this.appId,...this.developerId!==void 0&&{developer_id:this.developerId},...e&&n!==void 0&&{settings:n}},s=await this.post(re,{section:"integrations",action:i},o);return this.deploymentId&&this.appName&&typeof window<"u"&&window.self!==window.top&&window.parent.postMessage({type:"sendActiveApp",id:s.id,is_active:e,deploymentId:this.deploymentId,appName:this.appName,title:r},"*"),s}async getPerms(e){const r=await this.loadPerms();return e===void 0?r:!!r[String(e)]}clearPermsCache(){this.permsCache=null}async loadPerms(){var r;if(this.permsCache)return this.permsCache;if(typeof window<"u")try{const n=await d("perms");if(n&&Object.keys(n).length>0)return this.permsCache=I(n),this.permsCache}catch{}const e=await this.get({section:"adminPanel",action:"getStart"});return this.permsCache=I((r=e==null?void 0:e.settings)==null?void 0:r.perms),this.permsCache}}function I(t){const e={};if(!t||typeof t!="object")return e;for(const[r,n]of Object.entries(t))e[r]=!!n;return e}function k(t,e){var n,i;const r=[];for(const o of t){if(e!=null&&!((n=o.tradepointShow)==null?void 0:n[String(e)]))continue;const s={id:o.id,pid:o.pid,name:o.name,active:o.active,background:o.background,show:o.show};o.img&&(s.img=o.img),(i=o.children)!=null&&i.length&&(s.children=k(o.children,e)),r.push(s)}return r}const oe=new Set(["product","techcard"]),ie="/img/no.png";function se(t,e){const r=[];for(const n of t)oe.has(n.type)&&(!e&&!n.active||r.push({id:n.id,name:n.nomenclatureName,price:n.price,categoryId:n.categoryId,categoryName:n.categoryTitle||"",active:n.active,type:n.type,unit:n.unit,logo:n.logo&&n.logo!==ie?n.logo:""}));return r}const P={UAH:"₴",USD:"$",EUR:"€",KZT:"₸",GEL:"ლ",THB:"฿",AMD:"֏",BYN:"Br",AZN:"₼",GHS:"₵",KGS:"с",PLN:"zł",UZS:"soʻm",PHP:"₱",IDR:"Rp",TJS:"с",DOP:"$",NZD:"$",TRY:"₺",SGD:"$",NGN:"₦",MVR:"Rf",TMT:"m",MDL:"L",VND:"₫",CRC:"₡",INR:"₹",CNY:"¥",AED:".د.إ",LKR:"₨",RON:"L",GBP:"£",PKR:"₨",KRW:"₩",MYR:"RM",ILS:"₪",ZAR:"R",UGX:"USh",KES:"KSh",TZS:"TSh",RSD:"din",MXN:"$",VEF:"BsF",CUP:"$",COP:"$",KWD:".د.ك",CLP:"$",IQD:".د.ع",AOA:"Kz",GTQ:"Q",CZK:"Kč",XAF:"CFA",CHF:"Fr",RUR:"₽",SAR:"SRls"};function A(t){return t?P[t.toUpperCase()]??t:""}function ae(t,e){try{const r=new Intl.NumberFormat(e,{style:"currency",currency:t}).formatToParts(1),n=r.findIndex(o=>o.type==="currency"),i=r.findIndex(o=>o.type==="integer");return n!==-1&&i!==-1&&n<i}catch{return!1}}function ce(t,{currency:e=null,locale:r="uk",decimals:n=2}={}){if(t==null||t==="")return"";const i=typeof t=="number"?t:Number(t);if(!Number.isFinite(i))return String(t);const o=" ",[s,a]=Math.abs(i).toFixed(n).split("."),R=s.replace(/\B(?=(\d{3})+(?!\d))/g,o),w=`${i<0?"-":""}${R}${a?"."+a:""}`,g=A(e);return g?ae(e,r)?`${g}${w}`:`${w}${o}${g}`:w}exports.CURRENCY_ICONS=P;exports.SkyserviceAPI=y;exports.currencyIcon=A;exports.exit=b;exports.formatMoney=ce;exports.getBack=_;exports.getCompany=O;exports.getLang=F;exports.getLocalStorageData=h;exports.getProductCategories=G;exports.getSenderId=l;exports.getStoreData=d;exports.getToken=K;exports.getUser=W;exports.getWindowData=B;exports.goBack=M;exports.isAndroidWebview=ee;exports.isCefWebview=te;exports.isInIframe=z;exports.isInsideIframe=f;exports.isIosWebview=J;exports.isWebview=ne;exports.navigate=U;exports.notify=Z;exports.notifyError=V;exports.notifyWarn=Q;exports.onMessage=X;exports.openCrispChat=Y;exports.openExternalLink=H;exports.setLocalStorage=x;exports.setRocketMode=j;exports.setSenderId=$;exports.trackVisit=q;exports.webviewCheck=u;
|
package/dist/sdk/bridge.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ export declare function navigate(path: string): void;
|
|
|
8
8
|
export declare function exit(): void;
|
|
9
9
|
/** Alias for exit(). */
|
|
10
10
|
export declare const getBack: typeof exit;
|
|
11
|
+
/**
|
|
12
|
+
* Ask Dashboard to step one page back through its own navigation history.
|
|
13
|
+
*
|
|
14
|
+
* The app cannot see the host's URL, so it cannot know where "back" leads — the Dashboard can.
|
|
15
|
+
* Resolves to `true` once the host confirms it handled the step, `false` when it did not:
|
|
16
|
+
* not in an iframe, or a Dashboard too old to know the message. Fall back to `exit()` on `false`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function goBack(timeout?: number): Promise<boolean>;
|
|
11
19
|
/** Get a value from Dashboard's Vuex store by dot-notated key. Resolves to null on timeout or when not in iframe. */
|
|
12
20
|
export declare function getStoreData<T = unknown>(key: string): Promise<T | null>;
|
|
13
21
|
/** Get a value from Dashboard's localStorage. Resolves to null on timeout or when not in iframe. */
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { navigate, exit, getBack, getStoreData, getLocalStorageData, getWindowData, getCompany, getUser, getToken, getLang, getProductCategories, setLocalStorage, setRocketMode, trackVisit, openExternalLink, openCrispChat, notify, notifyError, notifyWarn, isInsideIframe, isInIframe, onMessage, setSenderId, getSenderId, } from './bridge';
|
|
1
|
+
export { navigate, exit, getBack, goBack, getStoreData, getLocalStorageData, getWindowData, getCompany, getUser, getToken, getLang, getProductCategories, setLocalStorage, setRocketMode, trackVisit, openExternalLink, openCrispChat, notify, notifyError, notifyWarn, isInsideIframe, isInIframe, onMessage, setSenderId, getSenderId, } from './bridge';
|
|
2
2
|
export { webviewCheck, isIosWebview, isAndroidWebview, isCefWebview, isWebview, } from './webview';
|
|
3
3
|
export type { WebviewType } from './webview';
|
|
4
4
|
export { SkyserviceAPI } from './api';
|
package/dist/sdk.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./money-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./money-DVXnJ7Ca.cjs");exports.CURRENCY_ICONS=e.CURRENCY_ICONS;exports.SkyserviceAPI=e.SkyserviceAPI;exports.currencyIcon=e.currencyIcon;exports.exit=e.exit;exports.formatMoney=e.formatMoney;exports.getBack=e.getBack;exports.getCompany=e.getCompany;exports.getLang=e.getLang;exports.getLocalStorageData=e.getLocalStorageData;exports.getProductCategories=e.getProductCategories;exports.getSenderId=e.getSenderId;exports.getStoreData=e.getStoreData;exports.getToken=e.getToken;exports.getUser=e.getUser;exports.getWindowData=e.getWindowData;exports.goBack=e.goBack;exports.isAndroidWebview=e.isAndroidWebview;exports.isCefWebview=e.isCefWebview;exports.isInIframe=e.isInIframe;exports.isInsideIframe=e.isInsideIframe;exports.isIosWebview=e.isIosWebview;exports.isWebview=e.isWebview;exports.navigate=e.navigate;exports.notify=e.notify;exports.notifyError=e.notifyError;exports.notifyWarn=e.notifyWarn;exports.onMessage=e.onMessage;exports.openCrispChat=e.openCrispChat;exports.openExternalLink=e.openExternalLink;exports.setLocalStorage=e.setLocalStorage;exports.setRocketMode=e.setRocketMode;exports.setSenderId=e.setSenderId;exports.trackVisit=e.trackVisit;exports.webviewCheck=e.webviewCheck;
|
package/dist/sdk.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as s, S as t, c as o, e as i, f as r, g as n, a as g, b as c, d, h as C, i as I, j as f, k, l as v, m as w, n as y, o as S, p as b, q as m, r as p, s as W, t as l, u as x, v as D, w as E, x as L, y as h, z as u, A, B as M,
|
|
1
|
+
import { C as s, S as t, c as o, e as i, f as r, g as n, a as g, b as c, d, h as C, i as I, j as f, k, l as v, m as w, n as y, o as S, p as b, q as m, r as p, s as W, t as l, u as x, v as D, w as E, x as L, y as h, z as u, A, B, D as M, E as R, F as N, G as P } from "./money-DS3eJE0W.js";
|
|
2
2
|
export {
|
|
3
3
|
s as CURRENCY_ICONS,
|
|
4
4
|
t as SkyserviceAPI,
|
|
@@ -15,22 +15,23 @@ export {
|
|
|
15
15
|
k as getToken,
|
|
16
16
|
v as getUser,
|
|
17
17
|
w as getWindowData,
|
|
18
|
-
y as
|
|
19
|
-
S as
|
|
20
|
-
b as
|
|
21
|
-
m as
|
|
22
|
-
p as
|
|
23
|
-
W as
|
|
24
|
-
l as
|
|
25
|
-
x as
|
|
26
|
-
D as
|
|
27
|
-
E as
|
|
28
|
-
L as
|
|
29
|
-
h as
|
|
30
|
-
u as
|
|
31
|
-
A as
|
|
18
|
+
y as goBack,
|
|
19
|
+
S as isAndroidWebview,
|
|
20
|
+
b as isCefWebview,
|
|
21
|
+
m as isInIframe,
|
|
22
|
+
p as isInsideIframe,
|
|
23
|
+
W as isIosWebview,
|
|
24
|
+
l as isWebview,
|
|
25
|
+
x as navigate,
|
|
26
|
+
D as notify,
|
|
27
|
+
E as notifyError,
|
|
28
|
+
L as notifyWarn,
|
|
29
|
+
h as onMessage,
|
|
30
|
+
u as openCrispChat,
|
|
31
|
+
A as openExternalLink,
|
|
32
|
+
B as setLocalStorage,
|
|
32
33
|
M as setRocketMode,
|
|
33
34
|
R as setSenderId,
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
N as trackVisit,
|
|
36
|
+
P as webviewCheck
|
|
36
37
|
};
|