@skyservice-developers/vue-dev-kit 1.5.12 → 2.1.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 +105 -15
- package/dist/api-CZ2GQABL.js +309 -0
- package/dist/api-JFgUnzEe.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 +78 -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,108 @@
|
|
|
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 = SkyserviceAPI.create({
|
|
78
|
+
token,
|
|
79
|
+
domain: 'api.skyservice.online',
|
|
80
|
+
companyId,
|
|
81
|
+
appId,
|
|
82
|
+
// developerId: 'optional',
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const tradepoints = await api.getTradepoints()
|
|
86
|
+
const categories = await api.getCategoryTree(tradepointId)
|
|
87
|
+
const products = await api.getProducts({ tradepointId })
|
|
88
|
+
|
|
89
|
+
// Активація/деактивація міні-додатку
|
|
90
|
+
await api.setAppActive({ isActive: true, settings: { foo: 'bar' } })
|
|
91
|
+
await api.setAppActive({ isActive: false })
|
|
25
92
|
```
|
|
26
93
|
|
|
27
|
-
>
|
|
28
|
-
>
|
|
29
|
-
|
|
30
|
-
|
|
94
|
+
> `SkyserviceAPI.create()` — factory; прямий виклик `new SkyserviceAPI(...)` недоступний.
|
|
95
|
+
> `setAppActive` завжди ходить на `api.cabinet.developer.skyservice.online` (хардкод).
|
|
96
|
+
|
|
97
|
+
### Webview detection
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import {
|
|
101
|
+
isInsideIframe, isWebview,
|
|
102
|
+
isIosWebview, isAndroidWebview, isCefWebview,
|
|
103
|
+
webviewCheck,
|
|
104
|
+
} from '@skyservice-developers/vue-dev-kit/sdk'
|
|
105
|
+
```
|
|
31
106
|
|
|
32
107
|
---
|
|
33
108
|
|
|
@@ -296,15 +371,30 @@ import { Header, Modal, Dialog, SkyButton, SkySelect } from '@skyservice-develop
|
|
|
296
371
|
## Розробка
|
|
297
372
|
|
|
298
373
|
```bash
|
|
299
|
-
npm install
|
|
374
|
+
npm install
|
|
300
375
|
|
|
301
376
|
# Playground (live preview компонентів)
|
|
302
377
|
npm run playground
|
|
303
378
|
|
|
304
|
-
# Білд
|
|
379
|
+
# Білд (компоненти + SDK → dist/)
|
|
305
380
|
npm run build
|
|
306
381
|
```
|
|
307
382
|
|
|
383
|
+
## Структура проекту
|
|
384
|
+
|
|
385
|
+
```
|
|
386
|
+
src/
|
|
387
|
+
├── index.ts # публічний API (компоненти + SDK)
|
|
388
|
+
├── components/ # Vue 3 компоненти (.vue + index.ts)
|
|
389
|
+
├── sdk/ # TypeScript SDK
|
|
390
|
+
│ ├── bridge.ts # iframe postMessage API
|
|
391
|
+
│ ├── api.ts # SkyserviceAPI HTTP клієнт
|
|
392
|
+
│ ├── webview.ts # детекція webview/iframe
|
|
393
|
+
│ ├── types.ts # DTO типи (Tradepoint, Category, Product)
|
|
394
|
+
│ └── index.ts
|
|
395
|
+
└── styles/
|
|
396
|
+
```
|
|
397
|
+
|
|
308
398
|
## Ліцензія
|
|
309
399
|
|
|
310
400
|
MIT © Skyservice-POS
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import S from "ua-parser-js";
|
|
2
|
+
const g = "DASHBOARD", b = 5e3;
|
|
3
|
+
let k = 0, u = null;
|
|
4
|
+
function A() {
|
|
5
|
+
return `sdk_${Date.now()}_${++k}`;
|
|
6
|
+
}
|
|
7
|
+
function E() {
|
|
8
|
+
return "APP_" + Math.random().toString(36).slice(2, 10);
|
|
9
|
+
}
|
|
10
|
+
function R(t) {
|
|
11
|
+
u = t;
|
|
12
|
+
}
|
|
13
|
+
function l() {
|
|
14
|
+
return u || (u = E()), u;
|
|
15
|
+
}
|
|
16
|
+
function o(t) {
|
|
17
|
+
window.parent.postMessage(
|
|
18
|
+
{
|
|
19
|
+
...t,
|
|
20
|
+
sender: l(),
|
|
21
|
+
target: t.target || g
|
|
22
|
+
},
|
|
23
|
+
"*"
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function w(t, e, r = b) {
|
|
27
|
+
return h() ? new Promise((n) => {
|
|
28
|
+
const a = A(), i = l(), c = setTimeout(() => {
|
|
29
|
+
window.removeEventListener("message", d), n(null);
|
|
30
|
+
}, r);
|
|
31
|
+
function d(I) {
|
|
32
|
+
const s = I.data;
|
|
33
|
+
(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));
|
|
34
|
+
}
|
|
35
|
+
window.addEventListener("message", d), o({ type: "DATA_REQUEST", requestId: a, source: t, key: e });
|
|
36
|
+
}) : Promise.resolve(null);
|
|
37
|
+
}
|
|
38
|
+
function U(t) {
|
|
39
|
+
o({ type: "navigate", path: t });
|
|
40
|
+
}
|
|
41
|
+
function L() {
|
|
42
|
+
o({ type: "exit" });
|
|
43
|
+
}
|
|
44
|
+
const $ = L;
|
|
45
|
+
function p(t) {
|
|
46
|
+
return w("store", t);
|
|
47
|
+
}
|
|
48
|
+
function y(t) {
|
|
49
|
+
return w("localStorage", t);
|
|
50
|
+
}
|
|
51
|
+
function O(t) {
|
|
52
|
+
return w("window", t);
|
|
53
|
+
}
|
|
54
|
+
function W() {
|
|
55
|
+
return p("company");
|
|
56
|
+
}
|
|
57
|
+
function q() {
|
|
58
|
+
return p("user");
|
|
59
|
+
}
|
|
60
|
+
function x() {
|
|
61
|
+
return y("token");
|
|
62
|
+
}
|
|
63
|
+
function B() {
|
|
64
|
+
return y("lang");
|
|
65
|
+
}
|
|
66
|
+
function M() {
|
|
67
|
+
return p("productCategories");
|
|
68
|
+
}
|
|
69
|
+
function N(t, e) {
|
|
70
|
+
o({ type: "setLocalStorage", key: t, value: e });
|
|
71
|
+
}
|
|
72
|
+
function j(t) {
|
|
73
|
+
o({ type: "setRocketMode", value: t });
|
|
74
|
+
}
|
|
75
|
+
function G(t, e) {
|
|
76
|
+
o({ type: "trackVisit", name: t, path: e });
|
|
77
|
+
}
|
|
78
|
+
function z(t) {
|
|
79
|
+
o({ type: "openExternalLink", url: t });
|
|
80
|
+
}
|
|
81
|
+
function F() {
|
|
82
|
+
o({ type: "openCrispChat" });
|
|
83
|
+
}
|
|
84
|
+
function H(t) {
|
|
85
|
+
o({ type: "notification", text: t });
|
|
86
|
+
}
|
|
87
|
+
function Q(t) {
|
|
88
|
+
o({ type: "notification", text: t, variant: "error" });
|
|
89
|
+
}
|
|
90
|
+
function V(t) {
|
|
91
|
+
o({ type: "notification", text: t, variant: "warn" });
|
|
92
|
+
}
|
|
93
|
+
function h() {
|
|
94
|
+
try {
|
|
95
|
+
return window.self !== window.top;
|
|
96
|
+
} catch {
|
|
97
|
+
return !0;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const J = h;
|
|
101
|
+
function K(t) {
|
|
102
|
+
function e(r) {
|
|
103
|
+
var n;
|
|
104
|
+
((n = r.data) == null ? void 0 : n.sender) === g && t(r.data);
|
|
105
|
+
}
|
|
106
|
+
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
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 (S(navigator.userAgent).browser.name === "WebKit") return "ios_webview";
|
|
113
|
+
} catch (t) {
|
|
114
|
+
console.error(t);
|
|
115
|
+
}
|
|
116
|
+
return typeof Android < "u" ? "android_webview" : typeof window.cefQuery < "u" ? "cef_webview" : "browser";
|
|
117
|
+
}
|
|
118
|
+
function Y() {
|
|
119
|
+
return f() === "ios_webview";
|
|
120
|
+
}
|
|
121
|
+
function X() {
|
|
122
|
+
return f() === "android_webview";
|
|
123
|
+
}
|
|
124
|
+
function Z() {
|
|
125
|
+
return f() === "cef_webview";
|
|
126
|
+
}
|
|
127
|
+
function ee() {
|
|
128
|
+
return f() !== "browser";
|
|
129
|
+
}
|
|
130
|
+
const _ = "https://api.cabinet.developer.skyservice.online";
|
|
131
|
+
class m {
|
|
132
|
+
constructor(e) {
|
|
133
|
+
this.token = e.token, this.companyId = e.companyId, this.appId = e.appId, this.developerId = e.developerId;
|
|
134
|
+
const r = e.domain.replace("dashboard", "api");
|
|
135
|
+
this.baseUrl = r.startsWith("http") ? r : `https://${r}`;
|
|
136
|
+
}
|
|
137
|
+
/** Factory — create a new SkyserviceAPI instance. */
|
|
138
|
+
static create(e) {
|
|
139
|
+
return new m(e);
|
|
140
|
+
}
|
|
141
|
+
// --- Low-level ---
|
|
142
|
+
async get(e) {
|
|
143
|
+
const r = new URLSearchParams({
|
|
144
|
+
token: this.token,
|
|
145
|
+
companyId: this.companyId,
|
|
146
|
+
...e
|
|
147
|
+
}), n = await fetch(`${this.baseUrl}/?${r}`);
|
|
148
|
+
if (!n.ok)
|
|
149
|
+
throw new Error(`Skyservice API error: ${n.status}`);
|
|
150
|
+
const a = await n.json();
|
|
151
|
+
if (a.status !== "done")
|
|
152
|
+
throw new Error(`Skyservice API returned status: ${a.status}`);
|
|
153
|
+
return a.data;
|
|
154
|
+
}
|
|
155
|
+
async post(e, r, n) {
|
|
156
|
+
const a = new URLSearchParams({
|
|
157
|
+
token: this.token,
|
|
158
|
+
...r
|
|
159
|
+
}), i = await fetch(`${e}/?${a}`, {
|
|
160
|
+
method: "POST",
|
|
161
|
+
headers: { "Content-Type": "application/json" },
|
|
162
|
+
body: JSON.stringify(n)
|
|
163
|
+
});
|
|
164
|
+
if (!i.ok)
|
|
165
|
+
throw new Error(`Skyservice API error: ${i.status}`);
|
|
166
|
+
return i.json();
|
|
167
|
+
}
|
|
168
|
+
// --- Tradepoints ---
|
|
169
|
+
/**
|
|
170
|
+
* Get all tradepoints for the current company.
|
|
171
|
+
* Filters out deleted and frozen by default.
|
|
172
|
+
*/
|
|
173
|
+
async getTradepoints(e) {
|
|
174
|
+
const r = await this.get({
|
|
175
|
+
section: "tradepoints",
|
|
176
|
+
action: "getTradepoints"
|
|
177
|
+
});
|
|
178
|
+
return e != null && e.includeDeleted ? r.items : r.items.filter((n) => !n.deleted && !n.frozen);
|
|
179
|
+
}
|
|
180
|
+
// --- Categories ---
|
|
181
|
+
/**
|
|
182
|
+
* Get the full category tree, cleaned from POS-specific bloat.
|
|
183
|
+
*
|
|
184
|
+
* Returns only fields relevant for menu building:
|
|
185
|
+
* `id`, `pid`, `name`, `active`, `background`, `show`, `img`, `children`.
|
|
186
|
+
*
|
|
187
|
+
* If `tradepointId` is provided, filters to categories visible for that tradepoint.
|
|
188
|
+
*/
|
|
189
|
+
async getCategoryTree(e) {
|
|
190
|
+
const r = await this.get({
|
|
191
|
+
section: "productCategory",
|
|
192
|
+
action: "getCategories",
|
|
193
|
+
...e ? { tradepointId: String(e) } : {}
|
|
194
|
+
});
|
|
195
|
+
return v(r, e);
|
|
196
|
+
}
|
|
197
|
+
// --- Products ---
|
|
198
|
+
/**
|
|
199
|
+
* Get products, cleaned from POS-specific fields.
|
|
200
|
+
*
|
|
201
|
+
* Filters out ingredients by default — returns only sellable items
|
|
202
|
+
* (type `product` or `techcard`).
|
|
203
|
+
*
|
|
204
|
+
* If `tradepointId` is provided, scopes to that tradepoint.
|
|
205
|
+
*/
|
|
206
|
+
async getProducts(e) {
|
|
207
|
+
const r = await this.get({
|
|
208
|
+
section: "products",
|
|
209
|
+
action: "getProducts",
|
|
210
|
+
pagelimit: "9999",
|
|
211
|
+
ot: "desc",
|
|
212
|
+
of: "nomenclatureId",
|
|
213
|
+
...e != null && e.tradepointId ? { tradepointId: String(e.tradepointId) } : {}
|
|
214
|
+
});
|
|
215
|
+
return C(r.items, e == null ? void 0 : e.includeInactive);
|
|
216
|
+
}
|
|
217
|
+
// --- Integrations ---
|
|
218
|
+
/**
|
|
219
|
+
* Activate or deactivate the mini-app for the current company.
|
|
220
|
+
*
|
|
221
|
+
* Sends POST to `api.cabinet.developer.skyservice.online`:
|
|
222
|
+
* - `isActive: true` → `section=integrations&action=activateApp`
|
|
223
|
+
* - `isActive: false` → `section=integrations&action=deactivateApp`
|
|
224
|
+
*
|
|
225
|
+
* `settings` are sent only when activating.
|
|
226
|
+
*/
|
|
227
|
+
async setAppActive({
|
|
228
|
+
isActive: e,
|
|
229
|
+
settings: r
|
|
230
|
+
}) {
|
|
231
|
+
const n = e ? "activateApp" : "deactivateApp", a = {
|
|
232
|
+
company_id: this.companyId,
|
|
233
|
+
app_id: this.appId,
|
|
234
|
+
...this.developerId !== void 0 && { developer_id: this.developerId },
|
|
235
|
+
...e && r !== void 0 && { settings: r }
|
|
236
|
+
};
|
|
237
|
+
return this.post(_, {
|
|
238
|
+
section: "integrations",
|
|
239
|
+
action: n
|
|
240
|
+
}, a);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function v(t, e) {
|
|
244
|
+
var n, a;
|
|
245
|
+
const r = [];
|
|
246
|
+
for (const i of t) {
|
|
247
|
+
if (e != null && !((n = i.tradepointShow) == null ? void 0 : n[String(e)]))
|
|
248
|
+
continue;
|
|
249
|
+
const c = {
|
|
250
|
+
id: i.id,
|
|
251
|
+
pid: i.pid,
|
|
252
|
+
name: i.name,
|
|
253
|
+
active: i.active,
|
|
254
|
+
background: i.background,
|
|
255
|
+
show: i.show
|
|
256
|
+
};
|
|
257
|
+
i.img && (c.img = i.img), (a = i.children) != null && a.length && (c.children = v(i.children, e)), r.push(c);
|
|
258
|
+
}
|
|
259
|
+
return r;
|
|
260
|
+
}
|
|
261
|
+
const P = /* @__PURE__ */ new Set(["product", "techcard"]), T = "/img/no.png";
|
|
262
|
+
function C(t, e) {
|
|
263
|
+
const r = [];
|
|
264
|
+
for (const n of t)
|
|
265
|
+
P.has(n.type) && (!e && !n.active || r.push({
|
|
266
|
+
id: n.id,
|
|
267
|
+
name: n.nomenclatureName,
|
|
268
|
+
price: n.price,
|
|
269
|
+
categoryId: n.categoryId,
|
|
270
|
+
categoryName: n.categoryTitle || "",
|
|
271
|
+
active: n.active,
|
|
272
|
+
type: n.type,
|
|
273
|
+
unit: n.unit,
|
|
274
|
+
logo: n.logo && n.logo !== T ? n.logo : ""
|
|
275
|
+
}));
|
|
276
|
+
return r;
|
|
277
|
+
}
|
|
278
|
+
export {
|
|
279
|
+
R as A,
|
|
280
|
+
G as B,
|
|
281
|
+
f as C,
|
|
282
|
+
m as S,
|
|
283
|
+
W as a,
|
|
284
|
+
B as b,
|
|
285
|
+
y as c,
|
|
286
|
+
M as d,
|
|
287
|
+
L as e,
|
|
288
|
+
l as f,
|
|
289
|
+
$ as g,
|
|
290
|
+
p as h,
|
|
291
|
+
x as i,
|
|
292
|
+
q as j,
|
|
293
|
+
O as k,
|
|
294
|
+
X as l,
|
|
295
|
+
Z as m,
|
|
296
|
+
J as n,
|
|
297
|
+
h as o,
|
|
298
|
+
Y as p,
|
|
299
|
+
ee as q,
|
|
300
|
+
U as r,
|
|
301
|
+
H as s,
|
|
302
|
+
Q as t,
|
|
303
|
+
V as u,
|
|
304
|
+
K as v,
|
|
305
|
+
F as w,
|
|
306
|
+
z as x,
|
|
307
|
+
N as y,
|
|
308
|
+
j as z
|
|
309
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const k=require("ua-parser-js"),v="DASHBOARD",b=5e3;let E=0,f=null;function A(){return`sdk_${Date.now()}_${++E}`}function L(){return"APP_"+Math.random().toString(36).slice(2,10)}function C(t){f=t}function w(){return f||(f=L()),f}function a(t){window.parent.postMessage({...t,sender:w(),target:t.target||v},"*")}function p(t,e,r=b){return y()?new Promise(n=>{const o=A(),i=w(),c=setTimeout(()=>{window.removeEventListener("message",u),n(null)},r);function u(S){const s=S.data;(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))}window.addEventListener("message",u),a({type:"DATA_REQUEST",requestId:o,source:t,key:e})}):Promise.resolve(null)}function P(t){a({type:"navigate",path:t})}function m(){a({type:"exit"})}const T=m;function g(t){return p("store",t)}function l(t){return p("localStorage",t)}function _(t){return p("window",t)}function D(){return g("company")}function W(){return g("user")}function R(){return l("token")}function U(){return l("lang")}function $(){return g("productCategories")}function M(t,e){a({type:"setLocalStorage",key:t,value:e})}function O(t){a({type:"setRocketMode",value:t})}function q(t,e){a({type:"trackVisit",name:t,path:e})}function x(t){a({type:"openExternalLink",url:t})}function B(){a({type:"openCrispChat"})}function N(t){a({type:"notification",text:t})}function j(t){a({type:"notification",text:t,variant:"error"})}function G(t){a({type:"notification",text:t,variant:"warn"})}function y(){try{return window.self!==window.top}catch{return!0}}const V=y;function F(t){function e(r){var n;((n=r.data)==null?void 0:n.sender)===v&&t(r.data)}return window.addEventListener("message",e),()=>window.removeEventListener("message",e)}function d(){if(typeof window>"u")return"browser";if(window.webkit!=null&&window.webkit.messageHandlers!==void 0)try{if(k(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 H(){return d()==="ios_webview"}function Q(){return d()==="android_webview"}function z(){return d()==="cef_webview"}function J(){return d()!=="browser"}const K="https://api.cabinet.developer.skyservice.online";class h{constructor(e){this.token=e.token,this.companyId=e.companyId,this.appId=e.appId,this.developerId=e.developerId;const r=e.domain.replace("dashboard","api");this.baseUrl=r.startsWith("http")?r:`https://${r}`}static create(e){return new h(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 o=await n.json();if(o.status!=="done")throw new Error(`Skyservice API returned status: ${o.status}`);return o.data}async post(e,r,n){const o=new URLSearchParams({token:this.token,...r}),i=await fetch(`${e}/?${o}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!i.ok)throw new Error(`Skyservice API error: ${i.status}`);return i.json()}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 I(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 Z(r.items,e==null?void 0:e.includeInactive)}async setAppActive({isActive:e,settings:r}){const n=e?"activateApp":"deactivateApp",o={company_id:this.companyId,app_id:this.appId,...this.developerId!==void 0&&{developer_id:this.developerId},...e&&r!==void 0&&{settings:r}};return this.post(K,{section:"integrations",action:n},o)}}function I(t,e){var n,o;const r=[];for(const i of t){if(e!=null&&!((n=i.tradepointShow)==null?void 0:n[String(e)]))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),(o=i.children)!=null&&o.length&&(c.children=I(i.children,e)),r.push(c)}return r}const Y=new Set(["product","techcard"]),X="/img/no.png";function Z(t,e){const r=[];for(const n of t)Y.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!==X?n.logo:""}));return r}exports.SkyserviceAPI=h;exports.exit=m;exports.getBack=T;exports.getCompany=D;exports.getLang=U;exports.getLocalStorageData=l;exports.getProductCategories=$;exports.getSenderId=w;exports.getStoreData=g;exports.getToken=R;exports.getUser=W;exports.getWindowData=_;exports.isAndroidWebview=Q;exports.isCefWebview=z;exports.isInIframe=V;exports.isInsideIframe=y;exports.isIosWebview=H;exports.isWebview=J;exports.navigate=P;exports.notify=N;exports.notifyError=j;exports.notifyWarn=G;exports.onMessage=F;exports.openCrispChat=B;exports.openExternalLink=x;exports.setLocalStorage=M;exports.setRocketMode=O;exports.setSenderId=C;exports.trackVisit=q;exports.webviewCheck=d;
|
|
@@ -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
|
+
};
|