@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.
@@ -1,134 +1,145 @@
1
- import C from "ua-parser-js";
2
- const g = "DASHBOARD", P = 5e3;
3
- let A = 0, u = null;
4
- function R() {
5
- return `sdk_${Date.now()}_${++A}`;
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 k() {
7
+ function T() {
8
8
  return "APP_" + Math.random().toString(36).slice(2, 10);
9
9
  }
10
- function O(t) {
10
+ function K(t) {
11
11
  u = t;
12
12
  }
13
- function y() {
14
- return u || (u = k()), 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: y(),
20
+ sender: I(),
21
21
  target: t.target || g
22
22
  },
23
23
  "*"
24
24
  );
25
25
  }
26
- function l(t, e, r = P) {
27
- return S() ? new Promise((n) => {
28
- const s = R(), i = y(), o = setTimeout(() => {
29
- window.removeEventListener("message", d), n(null);
30
- }, r);
31
- function d(w) {
32
- const a = w.data;
33
- (a == null ? void 0 : a.type) === "DATA_RESPONSE" && (a == null ? void 0 : a.requestId) === s && (!a.target || a.target === i) && (clearTimeout(o), window.removeEventListener("message", d), n(a.data ?? null));
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", d), c({ type: "DATA_REQUEST", requestId: s, source: t, key: e });
36
- }) : Promise.resolve(null);
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 B(t) {
44
+ function F(t) {
39
45
  c({ type: "navigate", path: t });
40
46
  }
41
- function E() {
47
+ function L() {
42
48
  c({ type: "exit" });
43
49
  }
44
- const F = E;
45
- function p(t) {
46
- return l("store", t);
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 I(t) {
49
- return l("localStorage", t);
56
+ function d(t) {
57
+ return m("store", t);
50
58
  }
51
- function G(t) {
52
- return l("window", t);
59
+ function v(t) {
60
+ return m("localStorage", t);
53
61
  }
54
- function K() {
55
- return p("company");
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 I("lang");
66
+ return d("company");
67
+ }
68
+ function q() {
69
+ return d("user");
65
70
  }
66
71
  function H() {
67
- return p("productCategories");
72
+ return v("token");
68
73
  }
69
- function Z(t, e) {
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 q(t) {
83
+ function Q(t) {
73
84
  c({ type: "setRocketMode", value: t });
74
85
  }
75
- function Y(t, e) {
86
+ function V(t, e) {
76
87
  c({ type: "trackVisit", name: t, path: e });
77
88
  }
78
- function z(t) {
89
+ function X(t) {
79
90
  c({ type: "openExternalLink", url: t });
80
91
  }
81
- function Q() {
92
+ function J() {
82
93
  c({ type: "openCrispChat" });
83
94
  }
84
- function V(t) {
95
+ function ee(t) {
85
96
  c({ type: "notification", text: t });
86
97
  }
87
- function X(t) {
98
+ function te(t) {
88
99
  c({ type: "notification", text: t, variant: "error" });
89
100
  }
90
- function J(t) {
101
+ function ne(t) {
91
102
  c({ type: "notification", text: t, variant: "warn" });
92
103
  }
93
- function S() {
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 ee = S;
101
- function te(t) {
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 f() {
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 (C(navigator.userAgent).browser.name === "WebKit") return "ios_webview";
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 ne() {
119
- return f() === "ios_webview";
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 f() === "cef_webview";
133
+ return p() === "android_webview";
134
+ }
135
+ function ae() {
136
+ return p() === "cef_webview";
126
137
  }
127
- function se() {
128
- return f() !== "browser";
138
+ function ce() {
139
+ return p() !== "browser";
129
140
  }
130
- const T = "https://api.cabinet.developer.skyservice.online/index.php";
131
- class v {
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 v(e);
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 s = await n.json();
151
- if (s.status !== "done")
152
- throw new Error(`Skyservice API returned status: ${s.status}`);
153
- return s.data;
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 s = new URLSearchParams({
167
+ const o = new URLSearchParams({
157
168
  token: this.token,
158
169
  ...r
159
- }), i = await fetch(`${e}?${s}`, {
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 (!i.ok)
165
- throw new Error(`Skyservice API error: ${i.status}`);
166
- const o = await i.json();
167
- if (o.status !== "done")
168
- throw new Error(`Skyservice API returned status: ${o.status}`);
169
- return o.data;
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 $(r.items, e == null ? void 0 : e.includeInactive);
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 s = e ? "activateApp" : "deactivateApp", i = {
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
- }, o = await this.post(
244
- T,
245
- { section: "integrations", action: s },
246
- i
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: o.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
- ), o;
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 p("perms");
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, s;
304
+ var n, o;
294
305
  const r = [];
295
- for (const i of t) {
296
- if (e != null && !((n = i.tradepointShow) == null ? void 0 : n[String(e)]))
306
+ for (const s of t) {
307
+ if (e != null && !((n = s.tradepointShow) == null ? void 0 : n[String(e)]))
297
308
  continue;
298
- const o = {
299
- id: i.id,
300
- pid: i.pid,
301
- name: i.name,
302
- active: i.active,
303
- background: i.background,
304
- show: i.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
- i.img && (o.img = i.img), (s = i.children) != null && s.length && (o.children = b(i.children, e)), r.push(o);
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 L = /* @__PURE__ */ new Set(["product", "techcard"]), N = "/img/no.png";
311
- function $(t, e) {
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
- L.has(n.type) && (!e && !n.active || r.push({
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 !== N ? n.logo : ""
334
+ logo: n.logo && n.logo !== D ? n.logo : ""
324
335
  }));
325
336
  return r;
326
337
  }
327
- const D = {
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 U(t) {
385
- return t ? D[t.toUpperCase()] ?? t : "";
395
+ function M(t) {
396
+ return t ? U[t.toUpperCase()] ?? t : "";
386
397
  }
387
- function _(t, e) {
398
+ function B(t, e) {
388
399
  try {
389
- const r = new Intl.NumberFormat(e, { style: "currency", currency: t }).formatToParts(1), n = r.findIndex((i) => i.type === "currency"), s = r.findIndex((i) => i.type === "integer");
390
- return n !== -1 && s !== -1 && n < s;
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 oe(t, { currency: e = null, locale: r = "uk", decimals: n = 2 } = {}) {
406
+ function ue(t, { currency: e = null, locale: r = "uk", decimals: n = 2 } = {}) {
396
407
  if (t == null || t === "") return "";
397
- const s = typeof t == "number" ? t : Number(t);
398
- if (!Number.isFinite(s)) return String(t);
399
- const i = " ", [o, d] = Math.abs(s).toFixed(n).split("."), w = o.replace(/\B(?=(\d{3})+(?!\d))/g, i), a = `${s < 0 ? "-" : ""}${w}${d ? "." + d : ""}`, m = U(e);
400
- return m ? _(e, r) ? `${m}${a}` : `${a}${i}${m}` : a;
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
- Z as A,
404
- q as B,
405
- D as C,
406
- O as D,
407
- Y as E,
408
- f as F,
409
- v as S,
410
- K as a,
411
- j as b,
412
- U as c,
413
- I as d,
414
- E as e,
415
- oe as f,
416
- F as g,
417
- H as h,
418
- y as i,
419
- p as j,
420
- W as k,
421
- x as l,
422
- G as m,
423
- re as n,
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
- ee as p,
426
- S as q,
427
- ne as r,
428
- se as s,
429
- B as t,
430
- V as u,
431
- X as v,
432
- J as w,
433
- te as x,
434
- Q as y,
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;
@@ -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. */
@@ -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-dyX9wNiC.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.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;
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, D as R, E as B, F as N } from "./money-BCv6JlZu.js";
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 isAndroidWebview,
19
- S as isCefWebview,
20
- b as isInIframe,
21
- m as isInsideIframe,
22
- p as isIosWebview,
23
- W as isWebview,
24
- l as navigate,
25
- x as notify,
26
- D as notifyError,
27
- E as notifyWarn,
28
- L as onMessage,
29
- h as openCrispChat,
30
- u as openExternalLink,
31
- A as setLocalStorage,
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
- B as trackVisit,
35
- N as webviewCheck
35
+ N as trackVisit,
36
+ P as webviewCheck
36
37
  };