@skyservice-developers/vue-dev-kit 1.5.12 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -15
- package/dist/api-BOvdjB3h.js +266 -0
- package/dist/api-D5C6FvTr.cjs +1 -0
- package/dist/components/BaseTeleport.vue.d.ts +14 -0
- package/dist/components/Dialog.vue.d.ts +28 -0
- package/dist/components/DialogModal.vue.d.ts +28 -0
- package/dist/components/DialogNext.vue.d.ts +28 -0
- package/dist/components/Header.vue.d.ts +37 -0
- package/dist/components/Modal.vue.d.ts +30 -0
- package/dist/components/SkyButton.vue.d.ts +22 -0
- package/dist/components/SkySelect.vue.d.ts +16 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/index.d.ts +3 -0
- package/dist/sdk/api.d.ts +54 -0
- package/dist/sdk/bridge.d.ts +43 -0
- package/dist/sdk/index.d.ts +6 -0
- package/dist/sdk/types.d.ts +73 -0
- package/dist/sdk/webview.d.ts +16 -0
- package/dist/sdk.cjs +1 -0
- package/dist/sdk.js +33 -0
- package/dist/style.css +1 -0
- package/dist/vue-dev-kit.cjs +1 -0
- package/dist/vue-dev-kit.js +903 -0
- package/package.json +32 -43
- package/dist/vue2/style.css +0 -1
- package/dist/vue2/vue-dev-kit.cjs +0 -1
- package/dist/vue2/vue-dev-kit.js +0 -2622
- package/dist/vue3/style.css +0 -1
- package/dist/vue3/vue-dev-kit.cjs +0 -1
- package/dist/vue3/vue-dev-kit.js +0 -2277
- package/src/index.js +0 -9
- package/src/shared/index.js +0 -1
- package/src/shared/types/index.d.ts +0 -72
- package/src/shared/utils/index.js +0 -2
- package/src/shared/utils/parentBridge.js +0 -84
- package/src/shared/utils/webviewCheck.js +0 -54
- package/src/styles/scrollbar.css +0 -17
- package/src/vue2/components/BaseTeleport.vue +0 -16
- package/src/vue2/components/Dialog.vue +0 -106
- package/src/vue2/components/DialogModal.vue +0 -439
- package/src/vue2/components/DialogNext.vue +0 -379
- package/src/vue2/components/Header.vue +0 -466
- package/src/vue2/components/Modal.vue +0 -252
- package/src/vue2/components/SkyButton.vue +0 -144
- package/src/vue2/components/SkySelect.vue +0 -327
- package/src/vue2/components/index.js +0 -6
- package/src/vue2/index.js +0 -2
- package/src/vue3/components/BaseTeleport.vue +0 -16
- package/src/vue3/components/Dialog.vue +0 -97
- package/src/vue3/components/DialogModal.vue +0 -458
- package/src/vue3/components/DialogNext.vue +0 -427
- package/src/vue3/components/Header.vue +0 -505
- package/src/vue3/components/Modal.vue +0 -253
- package/src/vue3/components/SkyButton.vue +0 -140
- package/src/vue3/components/SkySelect.vue +0 -266
- package/src/vue3/components/index.js +0 -8
- package/src/vue3/index.js +0 -2
package/README.md
CHANGED
|
@@ -1,33 +1,99 @@
|
|
|
1
1
|
# @skyservice-developers/vue-dev-kit
|
|
2
2
|
|
|
3
|
-
Vue developer toolkit
|
|
3
|
+
Vue 3 developer toolkit для Skyservice mini-apps: UI компоненти + TypeScript SDK (iframe bridge + HTTP API клієнт).
|
|
4
|
+
|
|
5
|
+
> **v2.0.0 breaking changes:**
|
|
6
|
+
> - Vue 2 більше не підтримується (тільки Vue 3.4+).
|
|
7
|
+
> - Додано повноцінний SDK (`bridge` + `SkyserviceAPI`), раніше опублікований як окремий пакет `skyservice-sdk` (задепрекейтнутий).
|
|
8
|
+
> - Старі utils `shared/utils/parentBridge` та `shared/utils/webviewCheck` замінені типізованим SDK. Якщо ви імпортували їх напряму — переходьте на `@skyservice-developers/vue-dev-kit/sdk`.
|
|
4
9
|
|
|
5
10
|
## Встановлення
|
|
6
11
|
|
|
7
12
|
```bash
|
|
8
|
-
npm install @skyservice-developers/vue-dev-kit
|
|
13
|
+
npm install @skyservice-developers/vue-dev-kit
|
|
9
14
|
```
|
|
10
15
|
|
|
11
16
|
## Підключення
|
|
12
17
|
|
|
13
|
-
###
|
|
18
|
+
### Компоненти + SDK (разом)
|
|
14
19
|
|
|
15
20
|
```js
|
|
16
|
-
import '@skyservice-developers/vue-dev-kit/
|
|
17
|
-
import {
|
|
21
|
+
import '@skyservice-developers/vue-dev-kit/style.css'
|
|
22
|
+
import {
|
|
23
|
+
Header, Modal, Dialog, SkyButton, SkySelect,
|
|
24
|
+
navigate, SkyserviceAPI, isInsideIframe,
|
|
25
|
+
} from '@skyservice-developers/vue-dev-kit'
|
|
18
26
|
```
|
|
19
27
|
|
|
20
|
-
### Vue
|
|
28
|
+
### Тільки SDK (без Vue залежностей)
|
|
21
29
|
|
|
22
|
-
```
|
|
23
|
-
import
|
|
24
|
-
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
navigate, exit, getToken, getCompany,
|
|
33
|
+
setRocketMode, notify, SkyserviceAPI,
|
|
34
|
+
isInsideIframe, webviewCheck,
|
|
35
|
+
} from '@skyservice-developers/vue-dev-kit/sdk'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> Шлях `/vue3` залишено як alias на корінь для зворотної сумісності з v1.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## SDK
|
|
43
|
+
|
|
44
|
+
### Bridge — комунікація з Dashboard через iframe
|
|
45
|
+
|
|
46
|
+
Mini-app працює в iframe всередині Dashboard. Bridge обгортає `window.postMessage` типізованими функціями.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import {
|
|
50
|
+
navigate, exit, getBack,
|
|
51
|
+
getStoreData, getLocalStorageData, getWindowData,
|
|
52
|
+
getCompany, getUser, getToken, getLang, getProductCategories,
|
|
53
|
+
setLocalStorage, setRocketMode,
|
|
54
|
+
trackVisit, openExternalLink, openCrispChat,
|
|
55
|
+
notify, notifyError, notifyWarn,
|
|
56
|
+
isInsideIframe, onMessage,
|
|
57
|
+
setSenderId, getSenderId,
|
|
58
|
+
} from '@skyservice-developers/vue-dev-kit/sdk'
|
|
59
|
+
|
|
60
|
+
const token = await getToken() // → string | null
|
|
61
|
+
const company = await getCompany() // → об'єкт з Vuex store
|
|
62
|
+
setLocalStorage('userPref', { theme: 'dark' })
|
|
63
|
+
notify('Збережено')
|
|
64
|
+
navigate('/products/42')
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Всі гетери повертають `Promise<T | null>` — `null` при таймауті або якщо додаток відкритий поза iframe. `null` не ламає `await` — просто треба перевірити результат.
|
|
68
|
+
|
|
69
|
+
### SkyserviceAPI — HTTP клієнт
|
|
70
|
+
|
|
71
|
+
Прямі запити до Skyservice API. Працює всюди (браузер, Node, edge), не потребує iframe.
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { SkyserviceAPI, getToken } from '@skyservice-developers/vue-dev-kit/sdk'
|
|
75
|
+
|
|
76
|
+
const token = await getToken()
|
|
77
|
+
const api = new SkyserviceAPI({
|
|
78
|
+
token,
|
|
79
|
+
domain: 'api.skyservice.online',
|
|
80
|
+
// companyId: 'optional',
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const tradepoints = await api.getTradepoints()
|
|
84
|
+
const categories = await api.getCategoryTree(tradepointId)
|
|
85
|
+
const products = await api.getProducts({ tradepointId })
|
|
25
86
|
```
|
|
26
87
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
88
|
+
### Webview detection
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import {
|
|
92
|
+
isInsideIframe, isWebview,
|
|
93
|
+
isIosWebview, isAndroidWebview, isCefWebview,
|
|
94
|
+
webviewCheck,
|
|
95
|
+
} from '@skyservice-developers/vue-dev-kit/sdk'
|
|
96
|
+
```
|
|
31
97
|
|
|
32
98
|
---
|
|
33
99
|
|
|
@@ -296,15 +362,30 @@ import { Header, Modal, Dialog, SkyButton, SkySelect } from '@skyservice-develop
|
|
|
296
362
|
## Розробка
|
|
297
363
|
|
|
298
364
|
```bash
|
|
299
|
-
npm install
|
|
365
|
+
npm install
|
|
300
366
|
|
|
301
367
|
# Playground (live preview компонентів)
|
|
302
368
|
npm run playground
|
|
303
369
|
|
|
304
|
-
# Білд
|
|
370
|
+
# Білд (компоненти + SDK → dist/)
|
|
305
371
|
npm run build
|
|
306
372
|
```
|
|
307
373
|
|
|
374
|
+
## Структура проекту
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
src/
|
|
378
|
+
├── index.ts # публічний API (компоненти + SDK)
|
|
379
|
+
├── components/ # Vue 3 компоненти (.vue + index.ts)
|
|
380
|
+
├── sdk/ # TypeScript SDK
|
|
381
|
+
│ ├── bridge.ts # iframe postMessage API
|
|
382
|
+
│ ├── api.ts # SkyserviceAPI HTTP клієнт
|
|
383
|
+
│ ├── webview.ts # детекція webview/iframe
|
|
384
|
+
│ ├── types.ts # DTO типи (Tradepoint, Category, Product)
|
|
385
|
+
│ └── index.ts
|
|
386
|
+
└── styles/
|
|
387
|
+
```
|
|
388
|
+
|
|
308
389
|
## Ліцензія
|
|
309
390
|
|
|
310
391
|
MIT © Skyservice-POS
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import I from "ua-parser-js";
|
|
2
|
+
const l = "DASHBOARD", b = 5e3;
|
|
3
|
+
let S = 0, d = null;
|
|
4
|
+
function k() {
|
|
5
|
+
return `sdk_${Date.now()}_${++S}`;
|
|
6
|
+
}
|
|
7
|
+
function E() {
|
|
8
|
+
return "APP_" + Math.random().toString(36).slice(2, 10);
|
|
9
|
+
}
|
|
10
|
+
function T(e) {
|
|
11
|
+
d = e;
|
|
12
|
+
}
|
|
13
|
+
function m() {
|
|
14
|
+
return d || (d = E()), d;
|
|
15
|
+
}
|
|
16
|
+
function a(e) {
|
|
17
|
+
window.parent.postMessage(
|
|
18
|
+
{
|
|
19
|
+
...e,
|
|
20
|
+
sender: m(),
|
|
21
|
+
target: e.target || l
|
|
22
|
+
},
|
|
23
|
+
"*"
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function w(e, t, r = b) {
|
|
27
|
+
return y() ? new Promise((n) => {
|
|
28
|
+
const o = k(), i = m(), c = setTimeout(() => {
|
|
29
|
+
window.removeEventListener("message", u), n(null);
|
|
30
|
+
}, r);
|
|
31
|
+
function u(v) {
|
|
32
|
+
const s = v.data;
|
|
33
|
+
(s == null ? void 0 : s.type) === "DATA_RESPONSE" && (s == null ? void 0 : s.requestId) === o && (!s.target || s.target === i) && (clearTimeout(c), window.removeEventListener("message", u), n(s.data ?? null));
|
|
34
|
+
}
|
|
35
|
+
window.addEventListener("message", u), a({ type: "DATA_REQUEST", requestId: o, source: e, key: t });
|
|
36
|
+
}) : Promise.resolve(null);
|
|
37
|
+
}
|
|
38
|
+
function D(e) {
|
|
39
|
+
a({ type: "navigate", path: e });
|
|
40
|
+
}
|
|
41
|
+
function A() {
|
|
42
|
+
a({ type: "exit" });
|
|
43
|
+
}
|
|
44
|
+
const q = A;
|
|
45
|
+
function g(e) {
|
|
46
|
+
return w("store", e);
|
|
47
|
+
}
|
|
48
|
+
function p(e) {
|
|
49
|
+
return w("localStorage", e);
|
|
50
|
+
}
|
|
51
|
+
function U(e) {
|
|
52
|
+
return w("window", e);
|
|
53
|
+
}
|
|
54
|
+
function R() {
|
|
55
|
+
return g("company");
|
|
56
|
+
}
|
|
57
|
+
function W() {
|
|
58
|
+
return g("user");
|
|
59
|
+
}
|
|
60
|
+
function $() {
|
|
61
|
+
return p("token");
|
|
62
|
+
}
|
|
63
|
+
function x() {
|
|
64
|
+
return p("lang");
|
|
65
|
+
}
|
|
66
|
+
function M() {
|
|
67
|
+
return g("productCategories");
|
|
68
|
+
}
|
|
69
|
+
function B(e, t) {
|
|
70
|
+
a({ type: "setLocalStorage", key: e, value: t });
|
|
71
|
+
}
|
|
72
|
+
function O(e) {
|
|
73
|
+
a({ type: "setRocketMode", value: e });
|
|
74
|
+
}
|
|
75
|
+
function j(e, t) {
|
|
76
|
+
a({ type: "trackVisit", name: e, path: t });
|
|
77
|
+
}
|
|
78
|
+
function N(e) {
|
|
79
|
+
a({ type: "openExternalLink", url: e });
|
|
80
|
+
}
|
|
81
|
+
function z() {
|
|
82
|
+
a({ type: "openCrispChat" });
|
|
83
|
+
}
|
|
84
|
+
function F(e) {
|
|
85
|
+
a({ type: "notification", text: e });
|
|
86
|
+
}
|
|
87
|
+
function G(e) {
|
|
88
|
+
a({ type: "notification", text: e, variant: "error" });
|
|
89
|
+
}
|
|
90
|
+
function H(e) {
|
|
91
|
+
a({ type: "notification", text: e, variant: "warn" });
|
|
92
|
+
}
|
|
93
|
+
function y() {
|
|
94
|
+
try {
|
|
95
|
+
return window.self !== window.top;
|
|
96
|
+
} catch {
|
|
97
|
+
return !0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const Q = y;
|
|
101
|
+
function V(e) {
|
|
102
|
+
function t(r) {
|
|
103
|
+
var n;
|
|
104
|
+
((n = r.data) == null ? void 0 : n.sender) === l && e(r.data);
|
|
105
|
+
}
|
|
106
|
+
return window.addEventListener("message", t), () => window.removeEventListener("message", t);
|
|
107
|
+
}
|
|
108
|
+
function f() {
|
|
109
|
+
if (typeof window > "u") return "browser";
|
|
110
|
+
if (window.webkit != null && window.webkit.messageHandlers !== void 0)
|
|
111
|
+
try {
|
|
112
|
+
if (I(navigator.userAgent).browser.name === "WebKit") return "ios_webview";
|
|
113
|
+
} catch (e) {
|
|
114
|
+
console.error(e);
|
|
115
|
+
}
|
|
116
|
+
return typeof Android < "u" ? "android_webview" : typeof window.cefQuery < "u" ? "cef_webview" : "browser";
|
|
117
|
+
}
|
|
118
|
+
function K() {
|
|
119
|
+
return f() === "ios_webview";
|
|
120
|
+
}
|
|
121
|
+
function Y() {
|
|
122
|
+
return f() === "android_webview";
|
|
123
|
+
}
|
|
124
|
+
function J() {
|
|
125
|
+
return f() === "cef_webview";
|
|
126
|
+
}
|
|
127
|
+
function X() {
|
|
128
|
+
return f() !== "browser";
|
|
129
|
+
}
|
|
130
|
+
class Z {
|
|
131
|
+
constructor(t) {
|
|
132
|
+
this.token = t.token, this.companyId = t.companyId;
|
|
133
|
+
const r = t.domain.replace("dashboard", "api");
|
|
134
|
+
this.baseUrl = r.startsWith("http") ? r : `https://${r}`;
|
|
135
|
+
}
|
|
136
|
+
// --- Low-level ---
|
|
137
|
+
async request(t) {
|
|
138
|
+
const r = new URLSearchParams({
|
|
139
|
+
token: this.token,
|
|
140
|
+
...this.companyId ? { companyId: this.companyId } : {},
|
|
141
|
+
...t
|
|
142
|
+
}), n = await fetch(`${this.baseUrl}/?${r}`);
|
|
143
|
+
if (!n.ok)
|
|
144
|
+
throw new Error(`Skyservice API error: ${n.status}`);
|
|
145
|
+
const o = await n.json();
|
|
146
|
+
if (o.status !== "done")
|
|
147
|
+
throw new Error(`Skyservice API returned status: ${o.status}`);
|
|
148
|
+
return o.data;
|
|
149
|
+
}
|
|
150
|
+
// --- Tradepoints ---
|
|
151
|
+
/**
|
|
152
|
+
* Get all tradepoints for the current company.
|
|
153
|
+
* Filters out deleted and frozen by default.
|
|
154
|
+
*/
|
|
155
|
+
async getTradepoints(t) {
|
|
156
|
+
const r = await this.request({
|
|
157
|
+
section: "tradepoints",
|
|
158
|
+
action: "getTradepoints"
|
|
159
|
+
});
|
|
160
|
+
return t != null && t.includeDeleted ? r.items : r.items.filter((n) => !n.deleted && !n.frozen);
|
|
161
|
+
}
|
|
162
|
+
// --- Categories ---
|
|
163
|
+
/**
|
|
164
|
+
* Get the full category tree, cleaned from POS-specific bloat.
|
|
165
|
+
*
|
|
166
|
+
* Returns only fields relevant for menu building:
|
|
167
|
+
* `id`, `pid`, `name`, `active`, `background`, `show`, `img`, `children`.
|
|
168
|
+
*
|
|
169
|
+
* If `tradepointId` is provided, filters to categories visible for that tradepoint.
|
|
170
|
+
*/
|
|
171
|
+
async getCategoryTree(t) {
|
|
172
|
+
const r = await this.request({
|
|
173
|
+
section: "productCategory",
|
|
174
|
+
action: "getCategories",
|
|
175
|
+
...t ? { tradepointId: String(t) } : {}
|
|
176
|
+
});
|
|
177
|
+
return h(r, t);
|
|
178
|
+
}
|
|
179
|
+
// --- Products ---
|
|
180
|
+
/**
|
|
181
|
+
* Get products, cleaned from POS-specific fields.
|
|
182
|
+
*
|
|
183
|
+
* Filters out ingredients by default — returns only sellable items
|
|
184
|
+
* (type `product` or `techcard`).
|
|
185
|
+
*
|
|
186
|
+
* If `tradepointId` is provided, scopes to that tradepoint.
|
|
187
|
+
*/
|
|
188
|
+
async getProducts(t) {
|
|
189
|
+
const r = await this.request({
|
|
190
|
+
section: "products",
|
|
191
|
+
action: "getProducts",
|
|
192
|
+
pagelimit: "9999",
|
|
193
|
+
ot: "desc",
|
|
194
|
+
of: "nomenclatureId",
|
|
195
|
+
...t != null && t.tradepointId ? { tradepointId: String(t.tradepointId) } : {}
|
|
196
|
+
});
|
|
197
|
+
return _(r.items, t == null ? void 0 : t.includeInactive);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function h(e, t) {
|
|
201
|
+
var n, o;
|
|
202
|
+
const r = [];
|
|
203
|
+
for (const i of e) {
|
|
204
|
+
if (t != null && !((n = i.tradepointShow) == null ? void 0 : n[String(t)]))
|
|
205
|
+
continue;
|
|
206
|
+
const c = {
|
|
207
|
+
id: i.id,
|
|
208
|
+
pid: i.pid,
|
|
209
|
+
name: i.name,
|
|
210
|
+
active: i.active,
|
|
211
|
+
background: i.background,
|
|
212
|
+
show: i.show
|
|
213
|
+
};
|
|
214
|
+
i.img && (c.img = i.img), (o = i.children) != null && o.length && (c.children = h(i.children, t)), r.push(c);
|
|
215
|
+
}
|
|
216
|
+
return r;
|
|
217
|
+
}
|
|
218
|
+
const L = /* @__PURE__ */ new Set(["product", "techcard"]), P = "/img/no.png";
|
|
219
|
+
function _(e, t) {
|
|
220
|
+
const r = [];
|
|
221
|
+
for (const n of e)
|
|
222
|
+
L.has(n.type) && (!t && !n.active || r.push({
|
|
223
|
+
id: n.id,
|
|
224
|
+
name: n.nomenclatureName,
|
|
225
|
+
price: n.price,
|
|
226
|
+
categoryId: n.categoryId,
|
|
227
|
+
categoryName: n.categoryTitle || "",
|
|
228
|
+
active: n.active,
|
|
229
|
+
type: n.type,
|
|
230
|
+
unit: n.unit,
|
|
231
|
+
logo: n.logo && n.logo !== P ? n.logo : ""
|
|
232
|
+
}));
|
|
233
|
+
return r;
|
|
234
|
+
}
|
|
235
|
+
export {
|
|
236
|
+
T as A,
|
|
237
|
+
j as B,
|
|
238
|
+
f as C,
|
|
239
|
+
Z as S,
|
|
240
|
+
R as a,
|
|
241
|
+
x as b,
|
|
242
|
+
p as c,
|
|
243
|
+
M as d,
|
|
244
|
+
A as e,
|
|
245
|
+
m as f,
|
|
246
|
+
q as g,
|
|
247
|
+
g as h,
|
|
248
|
+
$ as i,
|
|
249
|
+
W as j,
|
|
250
|
+
U as k,
|
|
251
|
+
Y as l,
|
|
252
|
+
J as m,
|
|
253
|
+
Q as n,
|
|
254
|
+
y as o,
|
|
255
|
+
K as p,
|
|
256
|
+
X as q,
|
|
257
|
+
D as r,
|
|
258
|
+
F as s,
|
|
259
|
+
G as t,
|
|
260
|
+
H as u,
|
|
261
|
+
V as v,
|
|
262
|
+
z as w,
|
|
263
|
+
N as x,
|
|
264
|
+
B as y,
|
|
265
|
+
O as z
|
|
266
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const b=require("ua-parser-js"),m="DASHBOARD",k=5e3;let S=0,f=null;function E(){return`sdk_${Date.now()}_${++S}`}function L(){return"APP_"+Math.random().toString(36).slice(2,10)}function A(e){f=e}function w(){return f||(f=L()),f}function o(e){window.parent.postMessage({...e,sender:w(),target:e.target||m},"*")}function l(e,t,r=k){return p()?new Promise(n=>{const a=E(),i=w(),c=setTimeout(()=>{window.removeEventListener("message",d),n(null)},r);function d(I){const s=I.data;(s==null?void 0:s.type)==="DATA_RESPONSE"&&(s==null?void 0:s.requestId)===a&&(!s.target||s.target===i)&&(clearTimeout(c),window.removeEventListener("message",d),n(s.data??null))}window.addEventListener("message",d),o({type:"DATA_REQUEST",requestId:a,source:e,key:t})}):Promise.resolve(null)}function C(e){o({type:"navigate",path:e})}function v(){o({type:"exit"})}const P=v;function g(e){return l("store",e)}function y(e){return l("localStorage",e)}function D(e){return l("window",e)}function T(){return g("company")}function _(){return g("user")}function W(){return y("token")}function q(){return y("lang")}function U(){return g("productCategories")}function R(e,t){o({type:"setLocalStorage",key:e,value:t})}function M(e){o({type:"setRocketMode",value:e})}function $(e,t){o({type:"trackVisit",name:e,path:t})}function x(e){o({type:"openExternalLink",url:e})}function B(){o({type:"openCrispChat"})}function O(e){o({type:"notification",text:e})}function N(e){o({type:"notification",text:e,variant:"error"})}function V(e){o({type:"notification",text:e,variant:"warn"})}function p(){try{return window.self!==window.top}catch{return!0}}const j=p;function F(e){function t(r){var n;((n=r.data)==null?void 0:n.sender)===m&&e(r.data)}return window.addEventListener("message",t),()=>window.removeEventListener("message",t)}function u(){if(typeof window>"u")return"browser";if(window.webkit!=null&&window.webkit.messageHandlers!==void 0)try{if(b(navigator.userAgent).browser.name==="WebKit")return"ios_webview"}catch(e){console.error(e)}return typeof Android<"u"?"android_webview":typeof window.cefQuery<"u"?"cef_webview":"browser"}function G(){return u()==="ios_webview"}function H(){return u()==="android_webview"}function Q(){return u()==="cef_webview"}function z(){return u()!=="browser"}class K{constructor(t){this.token=t.token,this.companyId=t.companyId;const r=t.domain.replace("dashboard","api");this.baseUrl=r.startsWith("http")?r:`https://${r}`}async request(t){const r=new URLSearchParams({token:this.token,...this.companyId?{companyId:this.companyId}:{},...t}),n=await fetch(`${this.baseUrl}/?${r}`);if(!n.ok)throw new Error(`Skyservice API error: ${n.status}`);const a=await n.json();if(a.status!=="done")throw new Error(`Skyservice API returned status: ${a.status}`);return a.data}async getTradepoints(t){const r=await this.request({section:"tradepoints",action:"getTradepoints"});return t!=null&&t.includeDeleted?r.items:r.items.filter(n=>!n.deleted&&!n.frozen)}async getCategoryTree(t){const r=await this.request({section:"productCategory",action:"getCategories",...t?{tradepointId:String(t)}:{}});return h(r,t)}async getProducts(t){const r=await this.request({section:"products",action:"getProducts",pagelimit:"9999",ot:"desc",of:"nomenclatureId",...t!=null&&t.tradepointId?{tradepointId:String(t.tradepointId)}:{}});return X(r.items,t==null?void 0:t.includeInactive)}}function h(e,t){var n,a;const r=[];for(const i of e){if(t!=null&&!((n=i.tradepointShow)==null?void 0:n[String(t)]))continue;const c={id:i.id,pid:i.pid,name:i.name,active:i.active,background:i.background,show:i.show};i.img&&(c.img=i.img),(a=i.children)!=null&&a.length&&(c.children=h(i.children,t)),r.push(c)}return r}const Y=new Set(["product","techcard"]),J="/img/no.png";function X(e,t){const r=[];for(const n of e)Y.has(n.type)&&(!t&&!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!==J?n.logo:""}));return r}exports.SkyserviceAPI=K;exports.exit=v;exports.getBack=P;exports.getCompany=T;exports.getLang=q;exports.getLocalStorageData=y;exports.getProductCategories=U;exports.getSenderId=w;exports.getStoreData=g;exports.getToken=W;exports.getUser=_;exports.getWindowData=D;exports.isAndroidWebview=H;exports.isCefWebview=Q;exports.isInIframe=j;exports.isInsideIframe=p;exports.isIosWebview=G;exports.isWebview=z;exports.navigate=C;exports.notify=O;exports.notifyError=N;exports.notifyWarn=V;exports.onMessage=F;exports.openCrispChat=B;exports.openExternalLink=x;exports.setLocalStorage=R;exports.setRocketMode=M;exports.setSenderId=A;exports.trackVisit=$;exports.webviewCheck=u;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
to: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
}>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
7
|
+
to: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
}>> & Readonly<{}>, {
|
|
12
|
+
to: string;
|
|
13
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithTemplateSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
7
|
+
$emit: (event: "close" | "update:modelValue" | "save", ...args: any[]) => void;
|
|
8
|
+
modelValue: boolean;
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle: string;
|
|
11
|
+
zIndex: string | number;
|
|
12
|
+
closeText: string;
|
|
13
|
+
closeOnEsc: boolean;
|
|
14
|
+
mode: string;
|
|
15
|
+
$props: {
|
|
16
|
+
readonly modelValue?: boolean | undefined;
|
|
17
|
+
readonly title?: string | undefined;
|
|
18
|
+
readonly subtitle?: string | undefined;
|
|
19
|
+
readonly zIndex?: string | number | undefined;
|
|
20
|
+
readonly closeText?: string | undefined;
|
|
21
|
+
readonly closeOnEsc?: boolean | undefined;
|
|
22
|
+
readonly mode?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
declare function __VLS_template(): {
|
|
26
|
+
default?(_: {}): any;
|
|
27
|
+
buttons?(_: {}): any;
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithTemplateSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
7
|
+
$emit: (event: "close" | "update:modelValue" | "save", ...args: any[]) => void;
|
|
8
|
+
modelValue: boolean;
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle: string;
|
|
11
|
+
zIndex: string | number;
|
|
12
|
+
closeText: string;
|
|
13
|
+
closeOnEsc: boolean;
|
|
14
|
+
hasButtons: boolean;
|
|
15
|
+
$props: {
|
|
16
|
+
readonly modelValue?: boolean | undefined;
|
|
17
|
+
readonly title?: string | undefined;
|
|
18
|
+
readonly subtitle?: string | undefined;
|
|
19
|
+
readonly zIndex?: string | number | undefined;
|
|
20
|
+
readonly closeText?: string | undefined;
|
|
21
|
+
readonly closeOnEsc?: boolean | undefined;
|
|
22
|
+
readonly hasButtons?: boolean | undefined;
|
|
23
|
+
};
|
|
24
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
declare function __VLS_template(): {
|
|
26
|
+
default?(_: {}): any;
|
|
27
|
+
buttons?(_: {}): any;
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithTemplateSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
7
|
+
$emit: (event: "close" | "update:modelValue" | "save", ...args: any[]) => void;
|
|
8
|
+
modelValue: boolean;
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle: string;
|
|
11
|
+
zIndex: string | number;
|
|
12
|
+
closeText: string;
|
|
13
|
+
closeOnEsc: boolean;
|
|
14
|
+
hasButtons: boolean;
|
|
15
|
+
$props: {
|
|
16
|
+
readonly modelValue?: boolean | undefined;
|
|
17
|
+
readonly title?: string | undefined;
|
|
18
|
+
readonly subtitle?: string | undefined;
|
|
19
|
+
readonly zIndex?: string | number | undefined;
|
|
20
|
+
readonly closeText?: string | undefined;
|
|
21
|
+
readonly closeOnEsc?: boolean | undefined;
|
|
22
|
+
readonly hasButtons?: boolean | undefined;
|
|
23
|
+
};
|
|
24
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
declare function __VLS_template(): {
|
|
26
|
+
default?(_: {}): any;
|
|
27
|
+
buttons?(_: {}): any;
|
|
28
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithTemplateSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
7
|
+
$emit: (event: "navigate" | "back", ...args: any[]) => void;
|
|
8
|
+
title: string;
|
|
9
|
+
subtitle: string;
|
|
10
|
+
showBackButton: boolean;
|
|
11
|
+
backButtonTitle: string;
|
|
12
|
+
backEvent: Function;
|
|
13
|
+
dropdownItems: unknown[];
|
|
14
|
+
dropdownTitle: string;
|
|
15
|
+
visitLabel: string;
|
|
16
|
+
trackPageName: string;
|
|
17
|
+
trackPagePath: string;
|
|
18
|
+
appId: string;
|
|
19
|
+
$props: {
|
|
20
|
+
readonly title?: string | undefined;
|
|
21
|
+
readonly subtitle?: string | undefined;
|
|
22
|
+
readonly showBackButton?: boolean | undefined;
|
|
23
|
+
readonly backButtonTitle?: string | undefined;
|
|
24
|
+
readonly backEvent?: Function | undefined;
|
|
25
|
+
readonly dropdownItems?: unknown[] | undefined;
|
|
26
|
+
readonly dropdownTitle?: string | undefined;
|
|
27
|
+
readonly visitLabel?: string | undefined;
|
|
28
|
+
readonly trackPageName?: string | undefined;
|
|
29
|
+
readonly trackPagePath?: string | undefined;
|
|
30
|
+
readonly appId?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
33
|
+
declare function __VLS_template(): {
|
|
34
|
+
title?(_: {}): any;
|
|
35
|
+
subtitle?(_: {}): any;
|
|
36
|
+
default?(_: {}): any;
|
|
37
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithTemplateSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
7
|
+
$emit: (event: "close" | "update:modelValue", ...args: any[]) => void;
|
|
8
|
+
modelValue: boolean;
|
|
9
|
+
title: string;
|
|
10
|
+
subtitle: string;
|
|
11
|
+
closeOnEsc: boolean;
|
|
12
|
+
closeTitle: string;
|
|
13
|
+
closeOnOverlay: boolean;
|
|
14
|
+
width: string;
|
|
15
|
+
height: string;
|
|
16
|
+
$props: {
|
|
17
|
+
readonly modelValue?: boolean | undefined;
|
|
18
|
+
readonly title?: string | undefined;
|
|
19
|
+
readonly subtitle?: string | undefined;
|
|
20
|
+
readonly closeOnEsc?: boolean | undefined;
|
|
21
|
+
readonly closeTitle?: string | undefined;
|
|
22
|
+
readonly closeOnOverlay?: boolean | undefined;
|
|
23
|
+
readonly width?: string | undefined;
|
|
24
|
+
readonly height?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
27
|
+
declare function __VLS_template(): {
|
|
28
|
+
default?(_: {}): any;
|
|
29
|
+
footer?(_: {}): any;
|
|
30
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
|
|
2
|
+
export default _default;
|
|
3
|
+
type __VLS_WithTemplateSlots<T, S> = T & (new () => {
|
|
4
|
+
$slots: S;
|
|
5
|
+
});
|
|
6
|
+
declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
7
|
+
variant: string;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
block: boolean;
|
|
11
|
+
icon: boolean;
|
|
12
|
+
$props: {
|
|
13
|
+
readonly variant?: string | undefined;
|
|
14
|
+
readonly loading?: boolean | undefined;
|
|
15
|
+
readonly disabled?: boolean | undefined;
|
|
16
|
+
readonly block?: boolean | undefined;
|
|
17
|
+
readonly icon?: boolean | undefined;
|
|
18
|
+
};
|
|
19
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
20
|
+
declare function __VLS_template(): {
|
|
21
|
+
default?(_: {}): any;
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, {
|
|
2
|
+
$emit: (event: "update:modelValue", ...args: any[]) => void;
|
|
3
|
+
modelValue: null;
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
block: boolean;
|
|
6
|
+
options: unknown[];
|
|
7
|
+
placeholder: string;
|
|
8
|
+
$props: {
|
|
9
|
+
readonly modelValue?: null | undefined;
|
|
10
|
+
readonly disabled?: boolean | undefined;
|
|
11
|
+
readonly block?: boolean | undefined;
|
|
12
|
+
readonly options?: unknown[] | undefined;
|
|
13
|
+
readonly placeholder?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as Header } from './Header.vue';
|
|
2
|
+
export { default as Dialog } from './Dialog.vue';
|
|
3
|
+
export { default as DialogModal } from './DialogModal.vue';
|
|
4
|
+
export { default as DialogNext } from './DialogNext.vue';
|
|
5
|
+
export { default as Modal } from './Modal.vue';
|
|
6
|
+
export { default as SkyButton } from './SkyButton.vue';
|
|
7
|
+
export { default as SkySelect } from './SkySelect.vue';
|
|
8
|
+
export { default as BaseTeleport } from './BaseTeleport.vue';
|
package/dist/index.d.ts
ADDED