@feedmepos/mf-mdm 1.5.4-beta.178 → 1.5.4-beta.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{App-44d70250.js → App-266e8166.js} +1 -1
- package/dist/DeviceList-76041b96.js +3523 -0
- package/dist/api/index.d.ts +12 -1
- package/dist/app.js +2 -2
- package/dist/components/DownloadLogDialog.vue.d.ts +12 -0
- package/dist/{index-939169c1.js → index-2f369770.js} +1443 -1423
- package/dist/utils/types.d.ts +24 -0
- package/package.json +1 -1
- package/dist/DeviceList-18849de9.js +0 -3285
|
@@ -0,0 +1,3523 @@
|
|
|
1
|
+
import { defineComponent as Se, resolveComponent as E, openBlock as f, createElementBlock as g, createElementVNode as r, toDisplayString as h, unref as i, createVNode as m, computed as Q, ref as x, watch as $e, onMounted as pt, createBlock as M, isRef as nn, createSlots as On, withCtx as F, createCommentVNode as k, Fragment as ie, renderList as ue, normalizeClass as on, withModifiers as Dt, nextTick as sn, createTextVNode as kt, Teleport as An, h as X } from "vue";
|
|
2
|
+
import { b as zn, C as Sn, r as Gt, h as tt, c as Nn, w as Pn, e as xn, S as Ln, x as Un, F as Mn, u as an, y as Z, z as ne, A as It, B as Te, D as ft, G as ln, H as rt, v as Bn } from "./index-2f369770.js";
|
|
3
|
+
import { useI18n as Ne, useCoreStore as ht } from "@feedmepos/mf-common";
|
|
4
|
+
import { useProxiedModel as mt, useSnackbar as nt, SnackbarPosition as ee, useBreakpoints as Ot, useDialogChild as rn, useDialog as cn, components as Me } from "@feedmepos/ui-library";
|
|
5
|
+
import { storeToRefs as Vn } from "pinia";
|
|
6
|
+
const $n = { class: "flex flex-col gap-16" }, jn = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qn = {
|
|
7
|
+
key: 0,
|
|
8
|
+
class: "flex gap-5 flex-col"
|
|
9
|
+
}, Hn = {
|
|
10
|
+
key: 1,
|
|
11
|
+
class: "flex justify-start"
|
|
12
|
+
}, Gn = /* @__PURE__ */ Se({
|
|
13
|
+
__name: "BindOtpDialog",
|
|
14
|
+
props: {
|
|
15
|
+
restaurantId: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: !0
|
|
18
|
+
},
|
|
19
|
+
otp: {
|
|
20
|
+
type: String,
|
|
21
|
+
required: !0
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
setup(e) {
|
|
25
|
+
const { t } = Ne(), o = mt(e, "otp"), s = nt(), l = async (c) => {
|
|
26
|
+
const p = "text/plain", v = new Blob([c], { type: p }), y = [new ClipboardItem({ [p]: v })];
|
|
27
|
+
await navigator.clipboard.write(y).then(() => {
|
|
28
|
+
s.open({
|
|
29
|
+
message: t("device.otp.otpCopiedMessage"),
|
|
30
|
+
type: "success",
|
|
31
|
+
position: ee.BOTTOM
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return (c, p) => {
|
|
36
|
+
const v = E("FmCircularProgress");
|
|
37
|
+
return f(), g("div", $n, [
|
|
38
|
+
r("div", jn, h(i(t)("device.otp.otpExpiryMessage")), 1),
|
|
39
|
+
i(o) ? (f(), g("div", qn, [
|
|
40
|
+
r("div", {
|
|
41
|
+
class: "fm-typo-en-title-md-800 tracking-[0.3rem] cursor-pointer hover:text-fm-color-neutral-gray-300",
|
|
42
|
+
onClick: p[0] || (p[0] = (y) => l(i(o)))
|
|
43
|
+
}, h(i(o)), 1)
|
|
44
|
+
])) : (f(), g("div", Hn, [
|
|
45
|
+
m(v, { size: "lg" })
|
|
46
|
+
]))
|
|
47
|
+
]);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* @license
|
|
53
|
+
* Copyright 2017 Google LLC
|
|
54
|
+
*
|
|
55
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
56
|
+
* you may not use this file except in compliance with the License.
|
|
57
|
+
* You may obtain a copy of the License at
|
|
58
|
+
*
|
|
59
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
60
|
+
*
|
|
61
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
62
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
63
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
64
|
+
* See the License for the specific language governing permissions and
|
|
65
|
+
* limitations under the License.
|
|
66
|
+
*/
|
|
67
|
+
const un = "firebasestorage.googleapis.com", dn = "storageBucket", Wn = 2 * 60 * 1e3, Yn = 10 * 60 * 1e3;
|
|
68
|
+
/**
|
|
69
|
+
* @license
|
|
70
|
+
* Copyright 2017 Google LLC
|
|
71
|
+
*
|
|
72
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
73
|
+
* you may not use this file except in compliance with the License.
|
|
74
|
+
* You may obtain a copy of the License at
|
|
75
|
+
*
|
|
76
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
77
|
+
*
|
|
78
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
79
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
80
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
81
|
+
* See the License for the specific language governing permissions and
|
|
82
|
+
* limitations under the License.
|
|
83
|
+
*/
|
|
84
|
+
class H extends Mn {
|
|
85
|
+
/**
|
|
86
|
+
* @param code - A `StorageErrorCode` string to be prefixed with 'storage/' and
|
|
87
|
+
* added to the end of the message.
|
|
88
|
+
* @param message - Error message.
|
|
89
|
+
* @param status_ - Corresponding HTTP Status Code
|
|
90
|
+
*/
|
|
91
|
+
constructor(t, n, o = 0) {
|
|
92
|
+
super(Et(t), `Firebase Storage: ${n} (${Et(t)})`), this.status_ = o, this.customData = { serverResponse: null }, this._baseMessage = this.message, Object.setPrototypeOf(this, H.prototype);
|
|
93
|
+
}
|
|
94
|
+
get status() {
|
|
95
|
+
return this.status_;
|
|
96
|
+
}
|
|
97
|
+
set status(t) {
|
|
98
|
+
this.status_ = t;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Compares a `StorageErrorCode` against this error's code, filtering out the prefix.
|
|
102
|
+
*/
|
|
103
|
+
_codeEquals(t) {
|
|
104
|
+
return Et(t) === this.code;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Optional response message that was added by the server.
|
|
108
|
+
*/
|
|
109
|
+
get serverResponse() {
|
|
110
|
+
return this.customData.serverResponse;
|
|
111
|
+
}
|
|
112
|
+
set serverResponse(t) {
|
|
113
|
+
this.customData.serverResponse = t, this.customData.serverResponse ? this.message = `${this._baseMessage}
|
|
114
|
+
${this.customData.serverResponse}` : this.message = this._baseMessage;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
var q;
|
|
118
|
+
(function(e) {
|
|
119
|
+
e.UNKNOWN = "unknown", e.OBJECT_NOT_FOUND = "object-not-found", e.BUCKET_NOT_FOUND = "bucket-not-found", e.PROJECT_NOT_FOUND = "project-not-found", e.QUOTA_EXCEEDED = "quota-exceeded", e.UNAUTHENTICATED = "unauthenticated", e.UNAUTHORIZED = "unauthorized", e.UNAUTHORIZED_APP = "unauthorized-app", e.RETRY_LIMIT_EXCEEDED = "retry-limit-exceeded", e.INVALID_CHECKSUM = "invalid-checksum", e.CANCELED = "canceled", e.INVALID_EVENT_NAME = "invalid-event-name", e.INVALID_URL = "invalid-url", e.INVALID_DEFAULT_BUCKET = "invalid-default-bucket", e.NO_DEFAULT_BUCKET = "no-default-bucket", e.CANNOT_SLICE_BLOB = "cannot-slice-blob", e.SERVER_FILE_WRONG_SIZE = "server-file-wrong-size", e.NO_DOWNLOAD_URL = "no-download-url", e.INVALID_ARGUMENT = "invalid-argument", e.INVALID_ARGUMENT_COUNT = "invalid-argument-count", e.APP_DELETED = "app-deleted", e.INVALID_ROOT_OPERATION = "invalid-root-operation", e.INVALID_FORMAT = "invalid-format", e.INTERNAL_ERROR = "internal-error", e.UNSUPPORTED_ENVIRONMENT = "unsupported-environment";
|
|
120
|
+
})(q || (q = {}));
|
|
121
|
+
function Et(e) {
|
|
122
|
+
return "storage/" + e;
|
|
123
|
+
}
|
|
124
|
+
function At() {
|
|
125
|
+
const e = "An unknown error occurred, please check the error payload for server response.";
|
|
126
|
+
return new H(q.UNKNOWN, e);
|
|
127
|
+
}
|
|
128
|
+
function Kn(e) {
|
|
129
|
+
return new H(q.OBJECT_NOT_FOUND, "Object '" + e + "' does not exist.");
|
|
130
|
+
}
|
|
131
|
+
function Xn(e) {
|
|
132
|
+
return new H(q.QUOTA_EXCEEDED, "Quota for bucket '" + e + "' exceeded, please view quota on https://firebase.google.com/pricing/.");
|
|
133
|
+
}
|
|
134
|
+
function Zn() {
|
|
135
|
+
const e = "User is not authenticated, please authenticate using Firebase Authentication and try again.";
|
|
136
|
+
return new H(q.UNAUTHENTICATED, e);
|
|
137
|
+
}
|
|
138
|
+
function Qn() {
|
|
139
|
+
return new H(q.UNAUTHORIZED_APP, "This app does not have permission to access Firebase Storage on this project.");
|
|
140
|
+
}
|
|
141
|
+
function Jn(e) {
|
|
142
|
+
return new H(q.UNAUTHORIZED, "User does not have permission to access '" + e + "'.");
|
|
143
|
+
}
|
|
144
|
+
function eo() {
|
|
145
|
+
return new H(q.RETRY_LIMIT_EXCEEDED, "Max retry time for operation exceeded, please try again.");
|
|
146
|
+
}
|
|
147
|
+
function to() {
|
|
148
|
+
return new H(q.CANCELED, "User canceled the upload/download.");
|
|
149
|
+
}
|
|
150
|
+
function no(e) {
|
|
151
|
+
return new H(q.INVALID_URL, "Invalid URL '" + e + "'.");
|
|
152
|
+
}
|
|
153
|
+
function oo(e) {
|
|
154
|
+
return new H(q.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + e + "'.");
|
|
155
|
+
}
|
|
156
|
+
function so() {
|
|
157
|
+
return new H(q.NO_DEFAULT_BUCKET, "No default bucket found. Did you set the '" + dn + "' property when initializing the app?");
|
|
158
|
+
}
|
|
159
|
+
function io() {
|
|
160
|
+
return new H(q.CANNOT_SLICE_BLOB, "Cannot slice blob for upload. Please retry the upload.");
|
|
161
|
+
}
|
|
162
|
+
function ao() {
|
|
163
|
+
return new H(q.NO_DOWNLOAD_URL, "The given file does not have any download URLs.");
|
|
164
|
+
}
|
|
165
|
+
function lo(e) {
|
|
166
|
+
return new H(q.UNSUPPORTED_ENVIRONMENT, `${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);
|
|
167
|
+
}
|
|
168
|
+
function Rt(e) {
|
|
169
|
+
return new H(q.INVALID_ARGUMENT, e);
|
|
170
|
+
}
|
|
171
|
+
function mn() {
|
|
172
|
+
return new H(q.APP_DELETED, "The Firebase app was deleted.");
|
|
173
|
+
}
|
|
174
|
+
function ro(e) {
|
|
175
|
+
return new H(q.INVALID_ROOT_OPERATION, "The operation '" + e + "' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");
|
|
176
|
+
}
|
|
177
|
+
function et(e, t) {
|
|
178
|
+
return new H(q.INVALID_FORMAT, "String does not match format '" + e + "': " + t);
|
|
179
|
+
}
|
|
180
|
+
function Je(e) {
|
|
181
|
+
throw new H(q.INTERNAL_ERROR, "Internal error: " + e);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* @license
|
|
185
|
+
* Copyright 2017 Google LLC
|
|
186
|
+
*
|
|
187
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
188
|
+
* you may not use this file except in compliance with the License.
|
|
189
|
+
* You may obtain a copy of the License at
|
|
190
|
+
*
|
|
191
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
192
|
+
*
|
|
193
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
194
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
195
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
196
|
+
* See the License for the specific language governing permissions and
|
|
197
|
+
* limitations under the License.
|
|
198
|
+
*/
|
|
199
|
+
class re {
|
|
200
|
+
constructor(t, n) {
|
|
201
|
+
this.bucket = t, this.path_ = n;
|
|
202
|
+
}
|
|
203
|
+
get path() {
|
|
204
|
+
return this.path_;
|
|
205
|
+
}
|
|
206
|
+
get isRoot() {
|
|
207
|
+
return this.path.length === 0;
|
|
208
|
+
}
|
|
209
|
+
fullServerUrl() {
|
|
210
|
+
const t = encodeURIComponent;
|
|
211
|
+
return "/b/" + t(this.bucket) + "/o/" + t(this.path);
|
|
212
|
+
}
|
|
213
|
+
bucketOnlyServerUrl() {
|
|
214
|
+
return "/b/" + encodeURIComponent(this.bucket) + "/o";
|
|
215
|
+
}
|
|
216
|
+
static makeFromBucketSpec(t, n) {
|
|
217
|
+
let o;
|
|
218
|
+
try {
|
|
219
|
+
o = re.makeFromUrl(t, n);
|
|
220
|
+
} catch {
|
|
221
|
+
return new re(t, "");
|
|
222
|
+
}
|
|
223
|
+
if (o.path === "")
|
|
224
|
+
return o;
|
|
225
|
+
throw oo(t);
|
|
226
|
+
}
|
|
227
|
+
static makeFromUrl(t, n) {
|
|
228
|
+
let o = null;
|
|
229
|
+
const s = "([A-Za-z0-9.\\-_]+)";
|
|
230
|
+
function l(w) {
|
|
231
|
+
w.path.charAt(w.path.length - 1) === "/" && (w.path_ = w.path_.slice(0, -1));
|
|
232
|
+
}
|
|
233
|
+
const c = "(/(.*))?$", p = new RegExp("^gs://" + s + c, "i"), v = { bucket: 1, path: 3 };
|
|
234
|
+
function y(w) {
|
|
235
|
+
w.path_ = decodeURIComponent(w.path);
|
|
236
|
+
}
|
|
237
|
+
const R = "v[A-Za-z0-9_]+", A = n.replace(/[.]/g, "\\."), N = "(/([^?#]*).*)?$", b = new RegExp(`^https?://${A}/${R}/b/${s}/o${N}`, "i"), I = { bucket: 1, path: 3 }, z = n === un ? "(?:storage.googleapis.com|storage.cloud.google.com)" : n, P = "([^?#]*)", V = new RegExp(`^https?://${z}/${s}/${P}`, "i"), O = [
|
|
238
|
+
{ regex: p, indices: v, postModify: l },
|
|
239
|
+
{
|
|
240
|
+
regex: b,
|
|
241
|
+
indices: I,
|
|
242
|
+
postModify: y
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
regex: V,
|
|
246
|
+
indices: { bucket: 1, path: 2 },
|
|
247
|
+
postModify: y
|
|
248
|
+
}
|
|
249
|
+
];
|
|
250
|
+
for (let w = 0; w < O.length; w++) {
|
|
251
|
+
const G = O[w], J = G.regex.exec(t);
|
|
252
|
+
if (J) {
|
|
253
|
+
const ae = J[G.indices.bucket];
|
|
254
|
+
let j = J[G.indices.path];
|
|
255
|
+
j || (j = ""), o = new re(ae, j), G.postModify(o);
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
if (o == null)
|
|
260
|
+
throw no(t);
|
|
261
|
+
return o;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
class co {
|
|
265
|
+
constructor(t) {
|
|
266
|
+
this.promise_ = Promise.reject(t);
|
|
267
|
+
}
|
|
268
|
+
/** @inheritDoc */
|
|
269
|
+
getPromise() {
|
|
270
|
+
return this.promise_;
|
|
271
|
+
}
|
|
272
|
+
/** @inheritDoc */
|
|
273
|
+
cancel(t = !1) {
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @license
|
|
278
|
+
* Copyright 2017 Google LLC
|
|
279
|
+
*
|
|
280
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
281
|
+
* you may not use this file except in compliance with the License.
|
|
282
|
+
* You may obtain a copy of the License at
|
|
283
|
+
*
|
|
284
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
285
|
+
*
|
|
286
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
287
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
288
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
289
|
+
* See the License for the specific language governing permissions and
|
|
290
|
+
* limitations under the License.
|
|
291
|
+
*/
|
|
292
|
+
function uo(e, t, n) {
|
|
293
|
+
let o = 1, s = null, l = null, c = !1, p = 0;
|
|
294
|
+
function v() {
|
|
295
|
+
return p === 2;
|
|
296
|
+
}
|
|
297
|
+
let y = !1;
|
|
298
|
+
function R(...P) {
|
|
299
|
+
y || (y = !0, t.apply(null, P));
|
|
300
|
+
}
|
|
301
|
+
function A(P) {
|
|
302
|
+
s = setTimeout(() => {
|
|
303
|
+
s = null, e(b, v());
|
|
304
|
+
}, P);
|
|
305
|
+
}
|
|
306
|
+
function N() {
|
|
307
|
+
l && clearTimeout(l);
|
|
308
|
+
}
|
|
309
|
+
function b(P, ...V) {
|
|
310
|
+
if (y) {
|
|
311
|
+
N();
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (P) {
|
|
315
|
+
N(), R.call(null, P, ...V);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
if (v() || c) {
|
|
319
|
+
N(), R.call(null, P, ...V);
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
o < 64 && (o *= 2);
|
|
323
|
+
let O;
|
|
324
|
+
p === 1 ? (p = 2, O = 0) : O = (o + Math.random()) * 1e3, A(O);
|
|
325
|
+
}
|
|
326
|
+
let I = !1;
|
|
327
|
+
function z(P) {
|
|
328
|
+
I || (I = !0, N(), !y && (s !== null ? (P || (p = 2), clearTimeout(s), A(0)) : P || (p = 1)));
|
|
329
|
+
}
|
|
330
|
+
return A(0), l = setTimeout(() => {
|
|
331
|
+
c = !0, z(!0);
|
|
332
|
+
}, n), z;
|
|
333
|
+
}
|
|
334
|
+
function mo(e) {
|
|
335
|
+
e(!1);
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* @license
|
|
339
|
+
* Copyright 2017 Google LLC
|
|
340
|
+
*
|
|
341
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
342
|
+
* you may not use this file except in compliance with the License.
|
|
343
|
+
* You may obtain a copy of the License at
|
|
344
|
+
*
|
|
345
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
346
|
+
*
|
|
347
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
348
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
349
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
350
|
+
* See the License for the specific language governing permissions and
|
|
351
|
+
* limitations under the License.
|
|
352
|
+
*/
|
|
353
|
+
function po(e) {
|
|
354
|
+
return e !== void 0;
|
|
355
|
+
}
|
|
356
|
+
function fo(e) {
|
|
357
|
+
return typeof e == "object" && !Array.isArray(e);
|
|
358
|
+
}
|
|
359
|
+
function zt(e) {
|
|
360
|
+
return typeof e == "string" || e instanceof String;
|
|
361
|
+
}
|
|
362
|
+
function Wt(e) {
|
|
363
|
+
return St() && e instanceof Blob;
|
|
364
|
+
}
|
|
365
|
+
function St() {
|
|
366
|
+
return typeof Blob < "u";
|
|
367
|
+
}
|
|
368
|
+
function Yt(e, t, n, o) {
|
|
369
|
+
if (o < t)
|
|
370
|
+
throw Rt(`Invalid value for '${e}'. Expected ${t} or greater.`);
|
|
371
|
+
if (o > n)
|
|
372
|
+
throw Rt(`Invalid value for '${e}'. Expected ${n} or less.`);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* @license
|
|
376
|
+
* Copyright 2017 Google LLC
|
|
377
|
+
*
|
|
378
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
379
|
+
* you may not use this file except in compliance with the License.
|
|
380
|
+
* You may obtain a copy of the License at
|
|
381
|
+
*
|
|
382
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
383
|
+
*
|
|
384
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
385
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
386
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
387
|
+
* See the License for the specific language governing permissions and
|
|
388
|
+
* limitations under the License.
|
|
389
|
+
*/
|
|
390
|
+
function vt(e, t, n) {
|
|
391
|
+
let o = t;
|
|
392
|
+
return n == null && (o = `https://${t}`), `${n}://${o}/v0${e}`;
|
|
393
|
+
}
|
|
394
|
+
function pn(e) {
|
|
395
|
+
const t = encodeURIComponent;
|
|
396
|
+
let n = "?";
|
|
397
|
+
for (const o in e)
|
|
398
|
+
if (e.hasOwnProperty(o)) {
|
|
399
|
+
const s = t(o) + "=" + t(e[o]);
|
|
400
|
+
n = n + s + "&";
|
|
401
|
+
}
|
|
402
|
+
return n = n.slice(0, -1), n;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* @license
|
|
406
|
+
* Copyright 2017 Google LLC
|
|
407
|
+
*
|
|
408
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
409
|
+
* you may not use this file except in compliance with the License.
|
|
410
|
+
* You may obtain a copy of the License at
|
|
411
|
+
*
|
|
412
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
413
|
+
*
|
|
414
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
415
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
416
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
417
|
+
* See the License for the specific language governing permissions and
|
|
418
|
+
* limitations under the License.
|
|
419
|
+
*/
|
|
420
|
+
var Ae;
|
|
421
|
+
(function(e) {
|
|
422
|
+
e[e.NO_ERROR = 0] = "NO_ERROR", e[e.NETWORK_ERROR = 1] = "NETWORK_ERROR", e[e.ABORT = 2] = "ABORT";
|
|
423
|
+
})(Ae || (Ae = {}));
|
|
424
|
+
/**
|
|
425
|
+
* @license
|
|
426
|
+
* Copyright 2022 Google LLC
|
|
427
|
+
*
|
|
428
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
429
|
+
* you may not use this file except in compliance with the License.
|
|
430
|
+
* You may obtain a copy of the License at
|
|
431
|
+
*
|
|
432
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
433
|
+
*
|
|
434
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
435
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
436
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
437
|
+
* See the License for the specific language governing permissions and
|
|
438
|
+
* limitations under the License.
|
|
439
|
+
*/
|
|
440
|
+
function ho(e, t) {
|
|
441
|
+
const n = e >= 500 && e < 600, s = [
|
|
442
|
+
// Request Timeout: web server didn't receive full request in time.
|
|
443
|
+
408,
|
|
444
|
+
// Too Many Requests: you're getting rate-limited, basically.
|
|
445
|
+
429
|
|
446
|
+
].indexOf(e) !== -1, l = t.indexOf(e) !== -1;
|
|
447
|
+
return n || s || l;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* @license
|
|
451
|
+
* Copyright 2017 Google LLC
|
|
452
|
+
*
|
|
453
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
454
|
+
* you may not use this file except in compliance with the License.
|
|
455
|
+
* You may obtain a copy of the License at
|
|
456
|
+
*
|
|
457
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
458
|
+
*
|
|
459
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
460
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
461
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
462
|
+
* See the License for the specific language governing permissions and
|
|
463
|
+
* limitations under the License.
|
|
464
|
+
*/
|
|
465
|
+
class vo {
|
|
466
|
+
constructor(t, n, o, s, l, c, p, v, y, R, A, N = !0) {
|
|
467
|
+
this.url_ = t, this.method_ = n, this.headers_ = o, this.body_ = s, this.successCodes_ = l, this.additionalRetryCodes_ = c, this.callback_ = p, this.errorCallback_ = v, this.timeout_ = y, this.progressCallback_ = R, this.connectionFactory_ = A, this.retry = N, this.pendingConnection_ = null, this.backoffId_ = null, this.canceled_ = !1, this.appDelete_ = !1, this.promise_ = new Promise((b, I) => {
|
|
468
|
+
this.resolve_ = b, this.reject_ = I, this.start_();
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Actually starts the retry loop.
|
|
473
|
+
*/
|
|
474
|
+
start_() {
|
|
475
|
+
const t = (o, s) => {
|
|
476
|
+
if (s) {
|
|
477
|
+
o(!1, new ct(!1, null, !0));
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
const l = this.connectionFactory_();
|
|
481
|
+
this.pendingConnection_ = l;
|
|
482
|
+
const c = (p) => {
|
|
483
|
+
const v = p.loaded, y = p.lengthComputable ? p.total : -1;
|
|
484
|
+
this.progressCallback_ !== null && this.progressCallback_(v, y);
|
|
485
|
+
};
|
|
486
|
+
this.progressCallback_ !== null && l.addUploadProgressListener(c), l.send(this.url_, this.method_, this.body_, this.headers_).then(() => {
|
|
487
|
+
this.progressCallback_ !== null && l.removeUploadProgressListener(c), this.pendingConnection_ = null;
|
|
488
|
+
const p = l.getErrorCode() === Ae.NO_ERROR, v = l.getStatus();
|
|
489
|
+
if (!p || ho(v, this.additionalRetryCodes_) && this.retry) {
|
|
490
|
+
const R = l.getErrorCode() === Ae.ABORT;
|
|
491
|
+
o(!1, new ct(!1, null, R));
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
const y = this.successCodes_.indexOf(v) !== -1;
|
|
495
|
+
o(!0, new ct(y, l));
|
|
496
|
+
});
|
|
497
|
+
}, n = (o, s) => {
|
|
498
|
+
const l = this.resolve_, c = this.reject_, p = s.connection;
|
|
499
|
+
if (s.wasSuccessCode)
|
|
500
|
+
try {
|
|
501
|
+
const v = this.callback_(p, p.getResponse());
|
|
502
|
+
po(v) ? l(v) : l();
|
|
503
|
+
} catch (v) {
|
|
504
|
+
c(v);
|
|
505
|
+
}
|
|
506
|
+
else if (p !== null) {
|
|
507
|
+
const v = At();
|
|
508
|
+
v.serverResponse = p.getErrorText(), this.errorCallback_ ? c(this.errorCallback_(p, v)) : c(v);
|
|
509
|
+
} else if (s.canceled) {
|
|
510
|
+
const v = this.appDelete_ ? mn() : to();
|
|
511
|
+
c(v);
|
|
512
|
+
} else {
|
|
513
|
+
const v = eo();
|
|
514
|
+
c(v);
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
this.canceled_ ? n(!1, new ct(!1, null, !0)) : this.backoffId_ = uo(t, n, this.timeout_);
|
|
518
|
+
}
|
|
519
|
+
/** @inheritDoc */
|
|
520
|
+
getPromise() {
|
|
521
|
+
return this.promise_;
|
|
522
|
+
}
|
|
523
|
+
/** @inheritDoc */
|
|
524
|
+
cancel(t) {
|
|
525
|
+
this.canceled_ = !0, this.appDelete_ = t || !1, this.backoffId_ !== null && mo(this.backoffId_), this.pendingConnection_ !== null && this.pendingConnection_.abort();
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
class ct {
|
|
529
|
+
constructor(t, n, o) {
|
|
530
|
+
this.wasSuccessCode = t, this.connection = n, this.canceled = !!o;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function _o(e, t) {
|
|
534
|
+
t !== null && t.length > 0 && (e.Authorization = "Firebase " + t);
|
|
535
|
+
}
|
|
536
|
+
function go(e, t) {
|
|
537
|
+
e["X-Firebase-Storage-Version"] = "webjs/" + (t ?? "AppManager");
|
|
538
|
+
}
|
|
539
|
+
function bo(e, t) {
|
|
540
|
+
t && (e["X-Firebase-GMPID"] = t);
|
|
541
|
+
}
|
|
542
|
+
function yo(e, t) {
|
|
543
|
+
t !== null && (e["X-Firebase-AppCheck"] = t);
|
|
544
|
+
}
|
|
545
|
+
function To(e, t, n, o, s, l, c = !0) {
|
|
546
|
+
const p = pn(e.urlParams), v = e.url + p, y = Object.assign({}, e.headers);
|
|
547
|
+
return bo(y, t), _o(y, n), go(y, l), yo(y, o), new vo(v, e.method, y, e.body, e.successCodes, e.additionalRetryCodes, e.handler, e.errorHandler, e.timeout, e.progressCallback, s, c);
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* @license
|
|
551
|
+
* Copyright 2017 Google LLC
|
|
552
|
+
*
|
|
553
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
554
|
+
* you may not use this file except in compliance with the License.
|
|
555
|
+
* You may obtain a copy of the License at
|
|
556
|
+
*
|
|
557
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
558
|
+
*
|
|
559
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
560
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
561
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
562
|
+
* See the License for the specific language governing permissions and
|
|
563
|
+
* limitations under the License.
|
|
564
|
+
*/
|
|
565
|
+
function Io() {
|
|
566
|
+
return typeof BlobBuilder < "u" ? BlobBuilder : typeof WebKitBlobBuilder < "u" ? WebKitBlobBuilder : void 0;
|
|
567
|
+
}
|
|
568
|
+
function Eo(...e) {
|
|
569
|
+
const t = Io();
|
|
570
|
+
if (t !== void 0) {
|
|
571
|
+
const n = new t();
|
|
572
|
+
for (let o = 0; o < e.length; o++)
|
|
573
|
+
n.append(e[o]);
|
|
574
|
+
return n.getBlob();
|
|
575
|
+
} else {
|
|
576
|
+
if (St())
|
|
577
|
+
return new Blob(e);
|
|
578
|
+
throw new H(q.UNSUPPORTED_ENVIRONMENT, "This browser doesn't seem to support creating Blobs");
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
function wo(e, t, n) {
|
|
582
|
+
return e.webkitSlice ? e.webkitSlice(t, n) : e.mozSlice ? e.mozSlice(t, n) : e.slice ? e.slice(t, n) : null;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* @license
|
|
586
|
+
* Copyright 2021 Google LLC
|
|
587
|
+
*
|
|
588
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
589
|
+
* you may not use this file except in compliance with the License.
|
|
590
|
+
* You may obtain a copy of the License at
|
|
591
|
+
*
|
|
592
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
593
|
+
*
|
|
594
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
595
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
596
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
597
|
+
* See the License for the specific language governing permissions and
|
|
598
|
+
* limitations under the License.
|
|
599
|
+
*/
|
|
600
|
+
function Fo(e) {
|
|
601
|
+
if (typeof atob > "u")
|
|
602
|
+
throw lo("base-64");
|
|
603
|
+
return atob(e);
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* @license
|
|
607
|
+
* Copyright 2017 Google LLC
|
|
608
|
+
*
|
|
609
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
610
|
+
* you may not use this file except in compliance with the License.
|
|
611
|
+
* You may obtain a copy of the License at
|
|
612
|
+
*
|
|
613
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
614
|
+
*
|
|
615
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
616
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
617
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
618
|
+
* See the License for the specific language governing permissions and
|
|
619
|
+
* limitations under the License.
|
|
620
|
+
*/
|
|
621
|
+
const _e = {
|
|
622
|
+
/**
|
|
623
|
+
* Indicates the string should be interpreted "raw", that is, as normal text.
|
|
624
|
+
* The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte
|
|
625
|
+
* sequence.
|
|
626
|
+
* Example: The string 'Hello! \\ud83d\\ude0a' becomes the byte sequence
|
|
627
|
+
* 48 65 6c 6c 6f 21 20 f0 9f 98 8a
|
|
628
|
+
*/
|
|
629
|
+
RAW: "raw",
|
|
630
|
+
/**
|
|
631
|
+
* Indicates the string should be interpreted as base64-encoded data.
|
|
632
|
+
* Padding characters (trailing '='s) are optional.
|
|
633
|
+
* Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence
|
|
634
|
+
* ad 69 8e fb e1 3a b7 bf eb 97
|
|
635
|
+
*/
|
|
636
|
+
BASE64: "base64",
|
|
637
|
+
/**
|
|
638
|
+
* Indicates the string should be interpreted as base64url-encoded data.
|
|
639
|
+
* Padding characters (trailing '='s) are optional.
|
|
640
|
+
* Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence
|
|
641
|
+
* ad 69 8e fb e1 3a b7 bf eb 97
|
|
642
|
+
*/
|
|
643
|
+
BASE64URL: "base64url",
|
|
644
|
+
/**
|
|
645
|
+
* Indicates the string is a data URL, such as one obtained from
|
|
646
|
+
* canvas.toDataURL().
|
|
647
|
+
* Example: the string 'data:application/octet-stream;base64,aaaa'
|
|
648
|
+
* becomes the byte sequence
|
|
649
|
+
* 69 a6 9a
|
|
650
|
+
* (the content-type "application/octet-stream" is also applied, but can
|
|
651
|
+
* be overridden in the metadata object).
|
|
652
|
+
*/
|
|
653
|
+
DATA_URL: "data_url"
|
|
654
|
+
};
|
|
655
|
+
class wt {
|
|
656
|
+
constructor(t, n) {
|
|
657
|
+
this.data = t, this.contentType = n || null;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
function Co(e, t) {
|
|
661
|
+
switch (e) {
|
|
662
|
+
case _e.RAW:
|
|
663
|
+
return new wt(fn(t));
|
|
664
|
+
case _e.BASE64:
|
|
665
|
+
case _e.BASE64URL:
|
|
666
|
+
return new wt(hn(e, t));
|
|
667
|
+
case _e.DATA_URL:
|
|
668
|
+
return new wt(Ro(t), Do(t));
|
|
669
|
+
}
|
|
670
|
+
throw At();
|
|
671
|
+
}
|
|
672
|
+
function fn(e) {
|
|
673
|
+
const t = [];
|
|
674
|
+
for (let n = 0; n < e.length; n++) {
|
|
675
|
+
let o = e.charCodeAt(n);
|
|
676
|
+
if (o <= 127)
|
|
677
|
+
t.push(o);
|
|
678
|
+
else if (o <= 2047)
|
|
679
|
+
t.push(192 | o >> 6, 128 | o & 63);
|
|
680
|
+
else if ((o & 64512) === 55296)
|
|
681
|
+
if (!(n < e.length - 1 && (e.charCodeAt(n + 1) & 64512) === 56320))
|
|
682
|
+
t.push(239, 191, 189);
|
|
683
|
+
else {
|
|
684
|
+
const l = o, c = e.charCodeAt(++n);
|
|
685
|
+
o = 65536 | (l & 1023) << 10 | c & 1023, t.push(240 | o >> 18, 128 | o >> 12 & 63, 128 | o >> 6 & 63, 128 | o & 63);
|
|
686
|
+
}
|
|
687
|
+
else
|
|
688
|
+
(o & 64512) === 56320 ? t.push(239, 191, 189) : t.push(224 | o >> 12, 128 | o >> 6 & 63, 128 | o & 63);
|
|
689
|
+
}
|
|
690
|
+
return new Uint8Array(t);
|
|
691
|
+
}
|
|
692
|
+
function ko(e) {
|
|
693
|
+
let t;
|
|
694
|
+
try {
|
|
695
|
+
t = decodeURIComponent(e);
|
|
696
|
+
} catch {
|
|
697
|
+
throw et(_e.DATA_URL, "Malformed data URL.");
|
|
698
|
+
}
|
|
699
|
+
return fn(t);
|
|
700
|
+
}
|
|
701
|
+
function hn(e, t) {
|
|
702
|
+
switch (e) {
|
|
703
|
+
case _e.BASE64: {
|
|
704
|
+
const s = t.indexOf("-") !== -1, l = t.indexOf("_") !== -1;
|
|
705
|
+
if (s || l)
|
|
706
|
+
throw et(e, "Invalid character '" + (s ? "-" : "_") + "' found: is it base64url encoded?");
|
|
707
|
+
break;
|
|
708
|
+
}
|
|
709
|
+
case _e.BASE64URL: {
|
|
710
|
+
const s = t.indexOf("+") !== -1, l = t.indexOf("/") !== -1;
|
|
711
|
+
if (s || l)
|
|
712
|
+
throw et(e, "Invalid character '" + (s ? "+" : "/") + "' found: is it base64 encoded?");
|
|
713
|
+
t = t.replace(/-/g, "+").replace(/_/g, "/");
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
let n;
|
|
718
|
+
try {
|
|
719
|
+
n = Fo(t);
|
|
720
|
+
} catch (s) {
|
|
721
|
+
throw s.message.includes("polyfill") ? s : et(e, "Invalid character found");
|
|
722
|
+
}
|
|
723
|
+
const o = new Uint8Array(n.length);
|
|
724
|
+
for (let s = 0; s < n.length; s++)
|
|
725
|
+
o[s] = n.charCodeAt(s);
|
|
726
|
+
return o;
|
|
727
|
+
}
|
|
728
|
+
class vn {
|
|
729
|
+
constructor(t) {
|
|
730
|
+
this.base64 = !1, this.contentType = null;
|
|
731
|
+
const n = t.match(/^data:([^,]+)?,/);
|
|
732
|
+
if (n === null)
|
|
733
|
+
throw et(_e.DATA_URL, "Must be formatted 'data:[<mediatype>][;base64],<data>");
|
|
734
|
+
const o = n[1] || null;
|
|
735
|
+
o != null && (this.base64 = Oo(o, ";base64"), this.contentType = this.base64 ? o.substring(0, o.length - 7) : o), this.rest = t.substring(t.indexOf(",") + 1);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
function Ro(e) {
|
|
739
|
+
const t = new vn(e);
|
|
740
|
+
return t.base64 ? hn(_e.BASE64, t.rest) : ko(t.rest);
|
|
741
|
+
}
|
|
742
|
+
function Do(e) {
|
|
743
|
+
return new vn(e).contentType;
|
|
744
|
+
}
|
|
745
|
+
function Oo(e, t) {
|
|
746
|
+
return e.length >= t.length ? e.substring(e.length - t.length) === t : !1;
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* @license
|
|
750
|
+
* Copyright 2017 Google LLC
|
|
751
|
+
*
|
|
752
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
753
|
+
* you may not use this file except in compliance with the License.
|
|
754
|
+
* You may obtain a copy of the License at
|
|
755
|
+
*
|
|
756
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
757
|
+
*
|
|
758
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
759
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
760
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
761
|
+
* See the License for the specific language governing permissions and
|
|
762
|
+
* limitations under the License.
|
|
763
|
+
*/
|
|
764
|
+
class ke {
|
|
765
|
+
constructor(t, n) {
|
|
766
|
+
let o = 0, s = "";
|
|
767
|
+
Wt(t) ? (this.data_ = t, o = t.size, s = t.type) : t instanceof ArrayBuffer ? (n ? this.data_ = new Uint8Array(t) : (this.data_ = new Uint8Array(t.byteLength), this.data_.set(new Uint8Array(t))), o = this.data_.length) : t instanceof Uint8Array && (n ? this.data_ = t : (this.data_ = new Uint8Array(t.length), this.data_.set(t)), o = t.length), this.size_ = o, this.type_ = s;
|
|
768
|
+
}
|
|
769
|
+
size() {
|
|
770
|
+
return this.size_;
|
|
771
|
+
}
|
|
772
|
+
type() {
|
|
773
|
+
return this.type_;
|
|
774
|
+
}
|
|
775
|
+
slice(t, n) {
|
|
776
|
+
if (Wt(this.data_)) {
|
|
777
|
+
const o = this.data_, s = wo(o, t, n);
|
|
778
|
+
return s === null ? null : new ke(s);
|
|
779
|
+
} else {
|
|
780
|
+
const o = new Uint8Array(this.data_.buffer, t, n - t);
|
|
781
|
+
return new ke(o, !0);
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
static getBlob(...t) {
|
|
785
|
+
if (St()) {
|
|
786
|
+
const n = t.map((o) => o instanceof ke ? o.data_ : o);
|
|
787
|
+
return new ke(Eo.apply(null, n));
|
|
788
|
+
} else {
|
|
789
|
+
const n = t.map((c) => zt(c) ? Co(_e.RAW, c).data : c.data_);
|
|
790
|
+
let o = 0;
|
|
791
|
+
n.forEach((c) => {
|
|
792
|
+
o += c.byteLength;
|
|
793
|
+
});
|
|
794
|
+
const s = new Uint8Array(o);
|
|
795
|
+
let l = 0;
|
|
796
|
+
return n.forEach((c) => {
|
|
797
|
+
for (let p = 0; p < c.length; p++)
|
|
798
|
+
s[l++] = c[p];
|
|
799
|
+
}), new ke(s, !0);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
uploadData() {
|
|
803
|
+
return this.data_;
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* @license
|
|
808
|
+
* Copyright 2017 Google LLC
|
|
809
|
+
*
|
|
810
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
811
|
+
* you may not use this file except in compliance with the License.
|
|
812
|
+
* You may obtain a copy of the License at
|
|
813
|
+
*
|
|
814
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
815
|
+
*
|
|
816
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
817
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
818
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
819
|
+
* See the License for the specific language governing permissions and
|
|
820
|
+
* limitations under the License.
|
|
821
|
+
*/
|
|
822
|
+
function _n(e) {
|
|
823
|
+
let t;
|
|
824
|
+
try {
|
|
825
|
+
t = JSON.parse(e);
|
|
826
|
+
} catch {
|
|
827
|
+
return null;
|
|
828
|
+
}
|
|
829
|
+
return fo(t) ? t : null;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* @license
|
|
833
|
+
* Copyright 2017 Google LLC
|
|
834
|
+
*
|
|
835
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
836
|
+
* you may not use this file except in compliance with the License.
|
|
837
|
+
* You may obtain a copy of the License at
|
|
838
|
+
*
|
|
839
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
840
|
+
*
|
|
841
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
842
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
843
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
844
|
+
* See the License for the specific language governing permissions and
|
|
845
|
+
* limitations under the License.
|
|
846
|
+
*/
|
|
847
|
+
function Ao(e) {
|
|
848
|
+
if (e.length === 0)
|
|
849
|
+
return null;
|
|
850
|
+
const t = e.lastIndexOf("/");
|
|
851
|
+
return t === -1 ? "" : e.slice(0, t);
|
|
852
|
+
}
|
|
853
|
+
function zo(e, t) {
|
|
854
|
+
const n = t.split("/").filter((o) => o.length > 0).join("/");
|
|
855
|
+
return e.length === 0 ? n : e + "/" + n;
|
|
856
|
+
}
|
|
857
|
+
function gn(e) {
|
|
858
|
+
const t = e.lastIndexOf("/", e.length - 2);
|
|
859
|
+
return t === -1 ? e : e.slice(t + 1);
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* @license
|
|
863
|
+
* Copyright 2017 Google LLC
|
|
864
|
+
*
|
|
865
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
866
|
+
* you may not use this file except in compliance with the License.
|
|
867
|
+
* You may obtain a copy of the License at
|
|
868
|
+
*
|
|
869
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
870
|
+
*
|
|
871
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
872
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
873
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
874
|
+
* See the License for the specific language governing permissions and
|
|
875
|
+
* limitations under the License.
|
|
876
|
+
*/
|
|
877
|
+
function So(e, t) {
|
|
878
|
+
return t;
|
|
879
|
+
}
|
|
880
|
+
class se {
|
|
881
|
+
constructor(t, n, o, s) {
|
|
882
|
+
this.server = t, this.local = n || t, this.writable = !!o, this.xform = s || So;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
let ut = null;
|
|
886
|
+
function No(e) {
|
|
887
|
+
return !zt(e) || e.length < 2 ? e : gn(e);
|
|
888
|
+
}
|
|
889
|
+
function bn() {
|
|
890
|
+
if (ut)
|
|
891
|
+
return ut;
|
|
892
|
+
const e = [];
|
|
893
|
+
e.push(new se("bucket")), e.push(new se("generation")), e.push(new se("metageneration")), e.push(new se("name", "fullPath", !0));
|
|
894
|
+
function t(l, c) {
|
|
895
|
+
return No(c);
|
|
896
|
+
}
|
|
897
|
+
const n = new se("name");
|
|
898
|
+
n.xform = t, e.push(n);
|
|
899
|
+
function o(l, c) {
|
|
900
|
+
return c !== void 0 ? Number(c) : c;
|
|
901
|
+
}
|
|
902
|
+
const s = new se("size");
|
|
903
|
+
return s.xform = o, e.push(s), e.push(new se("timeCreated")), e.push(new se("updated")), e.push(new se("md5Hash", null, !0)), e.push(new se("cacheControl", null, !0)), e.push(new se("contentDisposition", null, !0)), e.push(new se("contentEncoding", null, !0)), e.push(new se("contentLanguage", null, !0)), e.push(new se("contentType", null, !0)), e.push(new se("metadata", "customMetadata", !0)), ut = e, ut;
|
|
904
|
+
}
|
|
905
|
+
function Po(e, t) {
|
|
906
|
+
function n() {
|
|
907
|
+
const o = e.bucket, s = e.fullPath, l = new re(o, s);
|
|
908
|
+
return t._makeStorageReference(l);
|
|
909
|
+
}
|
|
910
|
+
Object.defineProperty(e, "ref", { get: n });
|
|
911
|
+
}
|
|
912
|
+
function xo(e, t, n) {
|
|
913
|
+
const o = {};
|
|
914
|
+
o.type = "file";
|
|
915
|
+
const s = n.length;
|
|
916
|
+
for (let l = 0; l < s; l++) {
|
|
917
|
+
const c = n[l];
|
|
918
|
+
o[c.local] = c.xform(o, t[c.server]);
|
|
919
|
+
}
|
|
920
|
+
return Po(o, e), o;
|
|
921
|
+
}
|
|
922
|
+
function yn(e, t, n) {
|
|
923
|
+
const o = _n(t);
|
|
924
|
+
return o === null ? null : xo(e, o, n);
|
|
925
|
+
}
|
|
926
|
+
function Lo(e, t, n, o) {
|
|
927
|
+
const s = _n(t);
|
|
928
|
+
if (s === null || !zt(s.downloadTokens))
|
|
929
|
+
return null;
|
|
930
|
+
const l = s.downloadTokens;
|
|
931
|
+
if (l.length === 0)
|
|
932
|
+
return null;
|
|
933
|
+
const c = encodeURIComponent;
|
|
934
|
+
return l.split(",").map((y) => {
|
|
935
|
+
const R = e.bucket, A = e.fullPath, N = "/b/" + c(R) + "/o/" + c(A), b = vt(N, n, o), I = pn({
|
|
936
|
+
alt: "media",
|
|
937
|
+
token: y
|
|
938
|
+
});
|
|
939
|
+
return b + I;
|
|
940
|
+
})[0];
|
|
941
|
+
}
|
|
942
|
+
function Uo(e, t) {
|
|
943
|
+
const n = {}, o = t.length;
|
|
944
|
+
for (let s = 0; s < o; s++) {
|
|
945
|
+
const l = t[s];
|
|
946
|
+
l.writable && (n[l.server] = e[l.local]);
|
|
947
|
+
}
|
|
948
|
+
return JSON.stringify(n);
|
|
949
|
+
}
|
|
950
|
+
class Nt {
|
|
951
|
+
constructor(t, n, o, s) {
|
|
952
|
+
this.url = t, this.method = n, this.handler = o, this.timeout = s, this.urlParams = {}, this.headers = {}, this.body = null, this.errorHandler = null, this.progressCallback = null, this.successCodes = [200], this.additionalRetryCodes = [];
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* @license
|
|
957
|
+
* Copyright 2017 Google LLC
|
|
958
|
+
*
|
|
959
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
960
|
+
* you may not use this file except in compliance with the License.
|
|
961
|
+
* You may obtain a copy of the License at
|
|
962
|
+
*
|
|
963
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
964
|
+
*
|
|
965
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
966
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
967
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
968
|
+
* See the License for the specific language governing permissions and
|
|
969
|
+
* limitations under the License.
|
|
970
|
+
*/
|
|
971
|
+
function Tn(e) {
|
|
972
|
+
if (!e)
|
|
973
|
+
throw At();
|
|
974
|
+
}
|
|
975
|
+
function Mo(e, t) {
|
|
976
|
+
function n(o, s) {
|
|
977
|
+
const l = yn(e, s, t);
|
|
978
|
+
return Tn(l !== null), l;
|
|
979
|
+
}
|
|
980
|
+
return n;
|
|
981
|
+
}
|
|
982
|
+
function Bo(e, t) {
|
|
983
|
+
function n(o, s) {
|
|
984
|
+
const l = yn(e, s, t);
|
|
985
|
+
return Tn(l !== null), Lo(l, s, e.host, e._protocol);
|
|
986
|
+
}
|
|
987
|
+
return n;
|
|
988
|
+
}
|
|
989
|
+
function In(e) {
|
|
990
|
+
function t(n, o) {
|
|
991
|
+
let s;
|
|
992
|
+
return n.getStatus() === 401 ? /* This exact message string is the only consistent part of the */ /* server's error response that identifies it as an App Check error. */ n.getErrorText().includes("Firebase App Check token is invalid") ? s = Qn() : s = Zn() : n.getStatus() === 402 ? s = Xn(e.bucket) : n.getStatus() === 403 ? s = Jn(e.path) : s = o, s.status = n.getStatus(), s.serverResponse = o.serverResponse, s;
|
|
993
|
+
}
|
|
994
|
+
return t;
|
|
995
|
+
}
|
|
996
|
+
function En(e) {
|
|
997
|
+
const t = In(e);
|
|
998
|
+
function n(o, s) {
|
|
999
|
+
let l = t(o, s);
|
|
1000
|
+
return o.getStatus() === 404 && (l = Kn(e.path)), l.serverResponse = s.serverResponse, l;
|
|
1001
|
+
}
|
|
1002
|
+
return n;
|
|
1003
|
+
}
|
|
1004
|
+
function Vo(e, t, n) {
|
|
1005
|
+
const o = t.fullServerUrl(), s = vt(o, e.host, e._protocol), l = "GET", c = e.maxOperationRetryTime, p = new Nt(s, l, Bo(e, n), c);
|
|
1006
|
+
return p.errorHandler = En(t), p;
|
|
1007
|
+
}
|
|
1008
|
+
function $o(e, t) {
|
|
1009
|
+
const n = t.fullServerUrl(), o = vt(n, e.host, e._protocol), s = "DELETE", l = e.maxOperationRetryTime;
|
|
1010
|
+
function c(v, y) {
|
|
1011
|
+
}
|
|
1012
|
+
const p = new Nt(o, s, c, l);
|
|
1013
|
+
return p.successCodes = [200, 204], p.errorHandler = En(t), p;
|
|
1014
|
+
}
|
|
1015
|
+
function jo(e, t) {
|
|
1016
|
+
return e && e.contentType || t && t.type() || "application/octet-stream";
|
|
1017
|
+
}
|
|
1018
|
+
function qo(e, t, n) {
|
|
1019
|
+
const o = Object.assign({}, n);
|
|
1020
|
+
return o.fullPath = e.path, o.size = t.size(), o.contentType || (o.contentType = jo(null, t)), o;
|
|
1021
|
+
}
|
|
1022
|
+
function Ho(e, t, n, o, s) {
|
|
1023
|
+
const l = t.bucketOnlyServerUrl(), c = {
|
|
1024
|
+
"X-Goog-Upload-Protocol": "multipart"
|
|
1025
|
+
};
|
|
1026
|
+
function p() {
|
|
1027
|
+
let O = "";
|
|
1028
|
+
for (let w = 0; w < 2; w++)
|
|
1029
|
+
O = O + Math.random().toString().slice(2);
|
|
1030
|
+
return O;
|
|
1031
|
+
}
|
|
1032
|
+
const v = p();
|
|
1033
|
+
c["Content-Type"] = "multipart/related; boundary=" + v;
|
|
1034
|
+
const y = qo(t, o, s), R = Uo(y, n), A = "--" + v + `\r
|
|
1035
|
+
Content-Type: application/json; charset=utf-8\r
|
|
1036
|
+
\r
|
|
1037
|
+
` + R + `\r
|
|
1038
|
+
--` + v + `\r
|
|
1039
|
+
Content-Type: ` + y.contentType + `\r
|
|
1040
|
+
\r
|
|
1041
|
+
`, N = `\r
|
|
1042
|
+
--` + v + "--", b = ke.getBlob(A, o, N);
|
|
1043
|
+
if (b === null)
|
|
1044
|
+
throw io();
|
|
1045
|
+
const I = { name: y.fullPath }, z = vt(l, e.host, e._protocol), P = "POST", V = e.maxUploadRetryTime, $ = new Nt(z, P, Mo(e, n), V);
|
|
1046
|
+
return $.urlParams = I, $.headers = c, $.body = b.uploadData(), $.errorHandler = In(t), $;
|
|
1047
|
+
}
|
|
1048
|
+
class Go {
|
|
1049
|
+
constructor() {
|
|
1050
|
+
this.sent_ = !1, this.xhr_ = new XMLHttpRequest(), this.initXhr(), this.errorCode_ = Ae.NO_ERROR, this.sendPromise_ = new Promise((t) => {
|
|
1051
|
+
this.xhr_.addEventListener("abort", () => {
|
|
1052
|
+
this.errorCode_ = Ae.ABORT, t();
|
|
1053
|
+
}), this.xhr_.addEventListener("error", () => {
|
|
1054
|
+
this.errorCode_ = Ae.NETWORK_ERROR, t();
|
|
1055
|
+
}), this.xhr_.addEventListener("load", () => {
|
|
1056
|
+
t();
|
|
1057
|
+
});
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
send(t, n, o, s) {
|
|
1061
|
+
if (this.sent_)
|
|
1062
|
+
throw Je("cannot .send() more than once");
|
|
1063
|
+
if (this.sent_ = !0, this.xhr_.open(n, t, !0), s !== void 0)
|
|
1064
|
+
for (const l in s)
|
|
1065
|
+
s.hasOwnProperty(l) && this.xhr_.setRequestHeader(l, s[l].toString());
|
|
1066
|
+
return o !== void 0 ? this.xhr_.send(o) : this.xhr_.send(), this.sendPromise_;
|
|
1067
|
+
}
|
|
1068
|
+
getErrorCode() {
|
|
1069
|
+
if (!this.sent_)
|
|
1070
|
+
throw Je("cannot .getErrorCode() before sending");
|
|
1071
|
+
return this.errorCode_;
|
|
1072
|
+
}
|
|
1073
|
+
getStatus() {
|
|
1074
|
+
if (!this.sent_)
|
|
1075
|
+
throw Je("cannot .getStatus() before sending");
|
|
1076
|
+
try {
|
|
1077
|
+
return this.xhr_.status;
|
|
1078
|
+
} catch {
|
|
1079
|
+
return -1;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
getResponse() {
|
|
1083
|
+
if (!this.sent_)
|
|
1084
|
+
throw Je("cannot .getResponse() before sending");
|
|
1085
|
+
return this.xhr_.response;
|
|
1086
|
+
}
|
|
1087
|
+
getErrorText() {
|
|
1088
|
+
if (!this.sent_)
|
|
1089
|
+
throw Je("cannot .getErrorText() before sending");
|
|
1090
|
+
return this.xhr_.statusText;
|
|
1091
|
+
}
|
|
1092
|
+
/** Aborts the request. */
|
|
1093
|
+
abort() {
|
|
1094
|
+
this.xhr_.abort();
|
|
1095
|
+
}
|
|
1096
|
+
getResponseHeader(t) {
|
|
1097
|
+
return this.xhr_.getResponseHeader(t);
|
|
1098
|
+
}
|
|
1099
|
+
addUploadProgressListener(t) {
|
|
1100
|
+
this.xhr_.upload != null && this.xhr_.upload.addEventListener("progress", t);
|
|
1101
|
+
}
|
|
1102
|
+
removeUploadProgressListener(t) {
|
|
1103
|
+
this.xhr_.upload != null && this.xhr_.upload.removeEventListener("progress", t);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
class Wo extends Go {
|
|
1107
|
+
initXhr() {
|
|
1108
|
+
this.xhr_.responseType = "text";
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
function Pt() {
|
|
1112
|
+
return new Wo();
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* @license
|
|
1116
|
+
* Copyright 2019 Google LLC
|
|
1117
|
+
*
|
|
1118
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1119
|
+
* you may not use this file except in compliance with the License.
|
|
1120
|
+
* You may obtain a copy of the License at
|
|
1121
|
+
*
|
|
1122
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1123
|
+
*
|
|
1124
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1125
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1126
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1127
|
+
* See the License for the specific language governing permissions and
|
|
1128
|
+
* limitations under the License.
|
|
1129
|
+
*/
|
|
1130
|
+
class ze {
|
|
1131
|
+
constructor(t, n) {
|
|
1132
|
+
this._service = t, n instanceof re ? this._location = n : this._location = re.makeFromUrl(n, t.host);
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Returns the URL for the bucket and path this object references,
|
|
1136
|
+
* in the form gs://<bucket>/<object-path>
|
|
1137
|
+
* @override
|
|
1138
|
+
*/
|
|
1139
|
+
toString() {
|
|
1140
|
+
return "gs://" + this._location.bucket + "/" + this._location.path;
|
|
1141
|
+
}
|
|
1142
|
+
_newRef(t, n) {
|
|
1143
|
+
return new ze(t, n);
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* A reference to the root of this object's bucket.
|
|
1147
|
+
*/
|
|
1148
|
+
get root() {
|
|
1149
|
+
const t = new re(this._location.bucket, "");
|
|
1150
|
+
return this._newRef(this._service, t);
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* The name of the bucket containing this reference's object.
|
|
1154
|
+
*/
|
|
1155
|
+
get bucket() {
|
|
1156
|
+
return this._location.bucket;
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* The full path of this object.
|
|
1160
|
+
*/
|
|
1161
|
+
get fullPath() {
|
|
1162
|
+
return this._location.path;
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* The short name of this object, which is the last component of the full path.
|
|
1166
|
+
* For example, if fullPath is 'full/path/image.png', name is 'image.png'.
|
|
1167
|
+
*/
|
|
1168
|
+
get name() {
|
|
1169
|
+
return gn(this._location.path);
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* The `StorageService` instance this `StorageReference` is associated with.
|
|
1173
|
+
*/
|
|
1174
|
+
get storage() {
|
|
1175
|
+
return this._service;
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* A `StorageReference` pointing to the parent location of this `StorageReference`, or null if
|
|
1179
|
+
* this reference is the root.
|
|
1180
|
+
*/
|
|
1181
|
+
get parent() {
|
|
1182
|
+
const t = Ao(this._location.path);
|
|
1183
|
+
if (t === null)
|
|
1184
|
+
return null;
|
|
1185
|
+
const n = new re(this._location.bucket, t);
|
|
1186
|
+
return new ze(this._service, n);
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Utility function to throw an error in methods that do not accept a root reference.
|
|
1190
|
+
*/
|
|
1191
|
+
_throwIfRoot(t) {
|
|
1192
|
+
if (this._location.path === "")
|
|
1193
|
+
throw ro(t);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
function Yo(e, t, n) {
|
|
1197
|
+
e._throwIfRoot("uploadBytes");
|
|
1198
|
+
const o = Ho(e.storage, e._location, bn(), new ke(t, !0), n);
|
|
1199
|
+
return e.storage.makeRequestWithTokens(o, Pt).then((s) => ({
|
|
1200
|
+
metadata: s,
|
|
1201
|
+
ref: e
|
|
1202
|
+
}));
|
|
1203
|
+
}
|
|
1204
|
+
function Ko(e) {
|
|
1205
|
+
e._throwIfRoot("getDownloadURL");
|
|
1206
|
+
const t = Vo(e.storage, e._location, bn());
|
|
1207
|
+
return e.storage.makeRequestWithTokens(t, Pt).then((n) => {
|
|
1208
|
+
if (n === null)
|
|
1209
|
+
throw ao();
|
|
1210
|
+
return n;
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
function Xo(e) {
|
|
1214
|
+
e._throwIfRoot("deleteObject");
|
|
1215
|
+
const t = $o(e.storage, e._location);
|
|
1216
|
+
return e.storage.makeRequestWithTokens(t, Pt);
|
|
1217
|
+
}
|
|
1218
|
+
function Zo(e, t) {
|
|
1219
|
+
const n = zo(e._location.path, t), o = new re(e._location.bucket, n);
|
|
1220
|
+
return new ze(e.storage, o);
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* @license
|
|
1224
|
+
* Copyright 2017 Google LLC
|
|
1225
|
+
*
|
|
1226
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1227
|
+
* you may not use this file except in compliance with the License.
|
|
1228
|
+
* You may obtain a copy of the License at
|
|
1229
|
+
*
|
|
1230
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1231
|
+
*
|
|
1232
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1233
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1234
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1235
|
+
* See the License for the specific language governing permissions and
|
|
1236
|
+
* limitations under the License.
|
|
1237
|
+
*/
|
|
1238
|
+
function Qo(e) {
|
|
1239
|
+
return /^[A-Za-z]+:\/\//.test(e);
|
|
1240
|
+
}
|
|
1241
|
+
function Jo(e, t) {
|
|
1242
|
+
return new ze(e, t);
|
|
1243
|
+
}
|
|
1244
|
+
function wn(e, t) {
|
|
1245
|
+
if (e instanceof xt) {
|
|
1246
|
+
const n = e;
|
|
1247
|
+
if (n._bucket == null)
|
|
1248
|
+
throw so();
|
|
1249
|
+
const o = new ze(n, n._bucket);
|
|
1250
|
+
return t != null ? wn(o, t) : o;
|
|
1251
|
+
} else
|
|
1252
|
+
return t !== void 0 ? Zo(e, t) : e;
|
|
1253
|
+
}
|
|
1254
|
+
function es(e, t) {
|
|
1255
|
+
if (t && Qo(t)) {
|
|
1256
|
+
if (e instanceof xt)
|
|
1257
|
+
return Jo(e, t);
|
|
1258
|
+
throw Rt("To use ref(service, url), the first argument must be a Storage instance.");
|
|
1259
|
+
} else
|
|
1260
|
+
return wn(e, t);
|
|
1261
|
+
}
|
|
1262
|
+
function Kt(e, t) {
|
|
1263
|
+
const n = t == null ? void 0 : t[dn];
|
|
1264
|
+
return n == null ? null : re.makeFromBucketSpec(n, e);
|
|
1265
|
+
}
|
|
1266
|
+
function ts(e, t, n, o = {}) {
|
|
1267
|
+
e.host = `${t}:${n}`, e._protocol = "http";
|
|
1268
|
+
const { mockUserToken: s } = o;
|
|
1269
|
+
s && (e._overrideAuthToken = typeof s == "string" ? s : Un(s, e.app.options.projectId));
|
|
1270
|
+
}
|
|
1271
|
+
class xt {
|
|
1272
|
+
constructor(t, n, o, s, l) {
|
|
1273
|
+
this.app = t, this._authProvider = n, this._appCheckProvider = o, this._url = s, this._firebaseVersion = l, this._bucket = null, this._host = un, this._protocol = "https", this._appId = null, this._deleted = !1, this._maxOperationRetryTime = Wn, this._maxUploadRetryTime = Yn, this._requests = /* @__PURE__ */ new Set(), s != null ? this._bucket = re.makeFromBucketSpec(s, this._host) : this._bucket = Kt(this._host, this.app.options);
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* The host string for this service, in the form of `host` or
|
|
1277
|
+
* `host:port`.
|
|
1278
|
+
*/
|
|
1279
|
+
get host() {
|
|
1280
|
+
return this._host;
|
|
1281
|
+
}
|
|
1282
|
+
set host(t) {
|
|
1283
|
+
this._host = t, this._url != null ? this._bucket = re.makeFromBucketSpec(this._url, t) : this._bucket = Kt(t, this.app.options);
|
|
1284
|
+
}
|
|
1285
|
+
/**
|
|
1286
|
+
* The maximum time to retry uploads in milliseconds.
|
|
1287
|
+
*/
|
|
1288
|
+
get maxUploadRetryTime() {
|
|
1289
|
+
return this._maxUploadRetryTime;
|
|
1290
|
+
}
|
|
1291
|
+
set maxUploadRetryTime(t) {
|
|
1292
|
+
Yt(
|
|
1293
|
+
"time",
|
|
1294
|
+
/* minValue=*/
|
|
1295
|
+
0,
|
|
1296
|
+
/* maxValue= */
|
|
1297
|
+
Number.POSITIVE_INFINITY,
|
|
1298
|
+
t
|
|
1299
|
+
), this._maxUploadRetryTime = t;
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1302
|
+
* The maximum time to retry operations other than uploads or downloads in
|
|
1303
|
+
* milliseconds.
|
|
1304
|
+
*/
|
|
1305
|
+
get maxOperationRetryTime() {
|
|
1306
|
+
return this._maxOperationRetryTime;
|
|
1307
|
+
}
|
|
1308
|
+
set maxOperationRetryTime(t) {
|
|
1309
|
+
Yt(
|
|
1310
|
+
"time",
|
|
1311
|
+
/* minValue=*/
|
|
1312
|
+
0,
|
|
1313
|
+
/* maxValue= */
|
|
1314
|
+
Number.POSITIVE_INFINITY,
|
|
1315
|
+
t
|
|
1316
|
+
), this._maxOperationRetryTime = t;
|
|
1317
|
+
}
|
|
1318
|
+
async _getAuthToken() {
|
|
1319
|
+
if (this._overrideAuthToken)
|
|
1320
|
+
return this._overrideAuthToken;
|
|
1321
|
+
const t = this._authProvider.getImmediate({ optional: !0 });
|
|
1322
|
+
if (t) {
|
|
1323
|
+
const n = await t.getToken();
|
|
1324
|
+
if (n !== null)
|
|
1325
|
+
return n.accessToken;
|
|
1326
|
+
}
|
|
1327
|
+
return null;
|
|
1328
|
+
}
|
|
1329
|
+
async _getAppCheckToken() {
|
|
1330
|
+
const t = this._appCheckProvider.getImmediate({ optional: !0 });
|
|
1331
|
+
return t ? (await t.getToken()).token : null;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Stop running requests and prevent more from being created.
|
|
1335
|
+
*/
|
|
1336
|
+
_delete() {
|
|
1337
|
+
return this._deleted || (this._deleted = !0, this._requests.forEach((t) => t.cancel()), this._requests.clear()), Promise.resolve();
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Returns a new firebaseStorage.Reference object referencing this StorageService
|
|
1341
|
+
* at the given Location.
|
|
1342
|
+
*/
|
|
1343
|
+
_makeStorageReference(t) {
|
|
1344
|
+
return new ze(this, t);
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* @param requestInfo - HTTP RequestInfo object
|
|
1348
|
+
* @param authToken - Firebase auth token
|
|
1349
|
+
*/
|
|
1350
|
+
_makeRequest(t, n, o, s, l = !0) {
|
|
1351
|
+
if (this._deleted)
|
|
1352
|
+
return new co(mn());
|
|
1353
|
+
{
|
|
1354
|
+
const c = To(t, this._appId, o, s, n, this._firebaseVersion, l);
|
|
1355
|
+
return this._requests.add(c), c.getPromise().then(() => this._requests.delete(c), () => this._requests.delete(c)), c;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
async makeRequestWithTokens(t, n) {
|
|
1359
|
+
const [o, s] = await Promise.all([
|
|
1360
|
+
this._getAuthToken(),
|
|
1361
|
+
this._getAppCheckToken()
|
|
1362
|
+
]);
|
|
1363
|
+
return this._makeRequest(t, n, o, s).getPromise();
|
|
1364
|
+
}
|
|
1365
|
+
}
|
|
1366
|
+
const Xt = "@firebase/storage", Zt = "0.12.5";
|
|
1367
|
+
/**
|
|
1368
|
+
* @license
|
|
1369
|
+
* Copyright 2020 Google LLC
|
|
1370
|
+
*
|
|
1371
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1372
|
+
* you may not use this file except in compliance with the License.
|
|
1373
|
+
* You may obtain a copy of the License at
|
|
1374
|
+
*
|
|
1375
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1376
|
+
*
|
|
1377
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1378
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1379
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1380
|
+
* See the License for the specific language governing permissions and
|
|
1381
|
+
* limitations under the License.
|
|
1382
|
+
*/
|
|
1383
|
+
const Fn = "storage";
|
|
1384
|
+
function ns(e, t, n) {
|
|
1385
|
+
return e = tt(e), Yo(e, t, n);
|
|
1386
|
+
}
|
|
1387
|
+
function os(e) {
|
|
1388
|
+
return e = tt(e), Ko(e);
|
|
1389
|
+
}
|
|
1390
|
+
function ss(e) {
|
|
1391
|
+
return e = tt(e), Xo(e);
|
|
1392
|
+
}
|
|
1393
|
+
function Qt(e, t) {
|
|
1394
|
+
return e = tt(e), es(e, t);
|
|
1395
|
+
}
|
|
1396
|
+
function Jt(e = xn(), t) {
|
|
1397
|
+
e = tt(e);
|
|
1398
|
+
const o = Nn(e, Fn).getImmediate({
|
|
1399
|
+
identifier: t
|
|
1400
|
+
}), s = Pn("storage");
|
|
1401
|
+
return s && is(o, ...s), o;
|
|
1402
|
+
}
|
|
1403
|
+
function is(e, t, n, o = {}) {
|
|
1404
|
+
ts(e, t, n, o);
|
|
1405
|
+
}
|
|
1406
|
+
function as(e, { instanceIdentifier: t }) {
|
|
1407
|
+
const n = e.getProvider("app").getImmediate(), o = e.getProvider("auth-internal"), s = e.getProvider("app-check-internal");
|
|
1408
|
+
return new xt(n, o, s, t, Ln);
|
|
1409
|
+
}
|
|
1410
|
+
function ls() {
|
|
1411
|
+
zn(new Sn(
|
|
1412
|
+
Fn,
|
|
1413
|
+
as,
|
|
1414
|
+
"PUBLIC"
|
|
1415
|
+
/* ComponentType.PUBLIC */
|
|
1416
|
+
).setMultipleInstances(!0)), Gt(Xt, Zt, ""), Gt(Xt, Zt, "esm2017");
|
|
1417
|
+
}
|
|
1418
|
+
ls();
|
|
1419
|
+
const en = {
|
|
1420
|
+
async update(e, t) {
|
|
1421
|
+
const n = Jt(), o = Qt(n, e);
|
|
1422
|
+
return await ns(o, t), await os(o);
|
|
1423
|
+
},
|
|
1424
|
+
async delete(e) {
|
|
1425
|
+
const t = Jt(), n = Qt(t, e);
|
|
1426
|
+
await ss(n);
|
|
1427
|
+
}
|
|
1428
|
+
}, rs = { class: "w-full flex flex-col gap-5" }, cs = { class: "flex flex-col gap-4" }, us = { class: "fm-typo-en-body-lg-400" }, ds = { class: "fm-typo-en-body-lg-600" }, ms = { class: "flex flex-col gap-4" }, ps = { class: "fm-typo-en-body-lg-400" }, fs = { class: "fm-typo-en-body-lg-600" }, hs = { class: "flex flex-col gap-4" }, vs = { class: "fm-typo-en-body-lg-400" }, _s = { class: "fm-typo-en-body-lg-600" }, gs = { class: "flex flex-col gap-4" }, bs = { class: "fm-typo-en-body-lg-400" }, ys = { class: "fm-typo-en-body-lg-600" }, Ts = { class: "flex flex-col gap-4" }, Is = { class: "fm-typo-en-body-lg-400" }, Es = { class: "flex flex-row items-center gap-1" }, ws = { class: "fm-typo-en-body-lg-600" }, Fs = {
|
|
1429
|
+
key: 0,
|
|
1430
|
+
class: "flex flex-col gap-4"
|
|
1431
|
+
}, Cs = { class: "fm-typo-en-body-lg-400" }, ks = { class: "fm-typo-en-body-lg-600" }, Rs = {
|
|
1432
|
+
key: 1,
|
|
1433
|
+
class: "flex flex-col gap-4"
|
|
1434
|
+
}, Ds = { class: "fm-typo-en-body-lg-400" }, Os = { class: "fm-typo-en-body-lg-600" }, As = {
|
|
1435
|
+
key: 2,
|
|
1436
|
+
class: "flex flex-col gap-4"
|
|
1437
|
+
}, zs = { class: "fm-typo-en-body-lg-400" }, Ss = { class: "fm-typo-en-body-lg-600" }, Ns = {
|
|
1438
|
+
key: 3,
|
|
1439
|
+
class: "flex flex-col gap-4"
|
|
1440
|
+
}, Ps = { class: "fm-typo-en-body-lg-400" }, xs = { class: "fm-typo-en-body-lg-600" }, Ls = {
|
|
1441
|
+
key: 4,
|
|
1442
|
+
class: "flex flex-col gap-4"
|
|
1443
|
+
}, Us = { class: "fm-typo-en-body-lg-400" }, Ms = { class: "fm-typo-en-body-lg-600" }, Bs = { class: "flex flex-col gap-4" }, Vs = {
|
|
1444
|
+
key: 0,
|
|
1445
|
+
class: "fm-typo-en-body-lg-400"
|
|
1446
|
+
}, $s = { class: "fm-typo-en-body-lg-600" }, js = {
|
|
1447
|
+
key: 0,
|
|
1448
|
+
class: "flex flex-col gap-4"
|
|
1449
|
+
}, qs = { class: "fm-typo-en-body-lg-400" }, Hs = { class: "fm-typo-en-body-lg-600" }, Gs = {
|
|
1450
|
+
key: 1,
|
|
1451
|
+
class: "flex flex-col gap-4"
|
|
1452
|
+
}, Ws = { class: "fm-typo-en-body-lg-400" }, Ys = { class: "fm-typo-en-body-lg-600 break-words" }, Ks = {
|
|
1453
|
+
key: 2,
|
|
1454
|
+
class: "flex flex-col gap-4"
|
|
1455
|
+
}, Xs = { class: "fm-typo-en-body-lg-400" }, Zs = { class: "fm-typo-en-body-lg-600" }, Qs = {
|
|
1456
|
+
key: 3,
|
|
1457
|
+
class: "flex flex-col gap-4"
|
|
1458
|
+
}, Js = { class: "fm-typo-en-body-lg-400" }, ei = { class: "fm-typo-en-body-lg-600" }, ti = {
|
|
1459
|
+
key: 4,
|
|
1460
|
+
class: "flex flex-col gap-4"
|
|
1461
|
+
}, ni = { class: "fm-typo-en-body-lg-400" }, oi = { class: "fm-typo-en-body-lg-600" }, si = {
|
|
1462
|
+
key: 0,
|
|
1463
|
+
class: "flex flex-col gap-4"
|
|
1464
|
+
}, ii = { class: "fm-typo-en-body-lg-400" }, ai = { class: "fm-typo-en-body-lg-600 break-words" }, li = {
|
|
1465
|
+
key: 0,
|
|
1466
|
+
class: "flex flex-col gap-4"
|
|
1467
|
+
}, ri = { class: "fm-typo-en-body-lg-400" }, ci = { class: "fm-typo-en-body-lg-600 break-words" }, ui = {
|
|
1468
|
+
key: 0,
|
|
1469
|
+
class: "flex flex-col gap-4"
|
|
1470
|
+
}, di = { class: "fm-typo-en-body-lg-400" }, mi = { class: "fm-typo-en-body-lg-600 break-words" }, pi = {
|
|
1471
|
+
key: 0,
|
|
1472
|
+
class: "flex flex-col gap-4"
|
|
1473
|
+
}, fi = { class: "fm-typo-en-body-lg-400" }, hi = { class: "fm-typo-en-body-lg-600" }, vi = {
|
|
1474
|
+
key: 6,
|
|
1475
|
+
class: "flex flex-col gap-8"
|
|
1476
|
+
}, _i = { class: "fm-typo-en-title-sm-800" }, gi = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, bi = {
|
|
1477
|
+
key: 0,
|
|
1478
|
+
class: "flex h-full justify-center items-center"
|
|
1479
|
+
}, yi = {
|
|
1480
|
+
key: 1,
|
|
1481
|
+
class: "flex flex-col gap-3 flex-wrap"
|
|
1482
|
+
}, Ti = {
|
|
1483
|
+
key: 0,
|
|
1484
|
+
class: "relative"
|
|
1485
|
+
}, Ii = ["src"], Ei = { class: "absolute top-0 right-0 cursor-pointer mt-1 mr-1" }, wi = { class: "flex w-full overflow-x-hidden flex-col gap-24" }, Fi = {
|
|
1486
|
+
key: 0,
|
|
1487
|
+
class: "flex flex-wrap grow-0 w-auto gap-24"
|
|
1488
|
+
}, Ci = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, ki = {
|
|
1489
|
+
key: 7,
|
|
1490
|
+
class: "flex flex-col gap-8"
|
|
1491
|
+
}, Ri = { class: "fm-typo-en-title-sm-600" }, Di = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Oi = { class: "flex flex-col gap-3" }, Ai = { class: "flex gap-8 items-center justify-start" }, zi = /* @__PURE__ */ Se({
|
|
1492
|
+
__name: "DeviceInformationSideSheet",
|
|
1493
|
+
props: {
|
|
1494
|
+
visible: { type: Boolean },
|
|
1495
|
+
device: {},
|
|
1496
|
+
devices: {},
|
|
1497
|
+
formUpdated: { type: Boolean }
|
|
1498
|
+
},
|
|
1499
|
+
setup(e) {
|
|
1500
|
+
const { t } = Ne(), { isAtMost: n } = Ot(), o = e, s = mt(o, "visible"), l = mt(o, "formUpdated"), c = ht(), p = Q(() => c.restaurants.value), v = Q(() => c.currentBusiness.value), y = (d) => {
|
|
1501
|
+
var S, Y;
|
|
1502
|
+
return d ? d.name ?? ((S = p.value.find((K) => K._id === d.restaurantId)) == null ? void 0 : S.profile.name) : o.device.name ?? ((Y = p.value.find((K) => K._id === o.device.restaurantId)) == null ? void 0 : Y.profile.name);
|
|
1503
|
+
}, R = x({}), A = Q(() => Object.entries(R.value).filter(([, { deleted: d }]) => !d).map(([d]) => d)), N = an(), b = Q(() => N.getCustomerDisplayImages()), I = () => {
|
|
1504
|
+
var d;
|
|
1505
|
+
R.value = b.value.reduce((S, Y) => (S[Y.url] = {
|
|
1506
|
+
restaurantIds: Y.restaurantIds,
|
|
1507
|
+
deleted: !1
|
|
1508
|
+
}, S), {}), z.value = (d = b.value) != null && d.length ? b.value[0].url : "";
|
|
1509
|
+
}, z = x(A.value.length > 0 ? A.value[0] : "");
|
|
1510
|
+
function P(d) {
|
|
1511
|
+
z.value = d;
|
|
1512
|
+
}
|
|
1513
|
+
function V() {
|
|
1514
|
+
const d = A.value;
|
|
1515
|
+
R.value[z.value].deleted = !0;
|
|
1516
|
+
const S = d.findIndex((Y) => Y === z.value);
|
|
1517
|
+
S >= 0 && (z.value = d[S - 1] || d[S + 1] || "");
|
|
1518
|
+
}
|
|
1519
|
+
const $ = Q(
|
|
1520
|
+
() => p.value.map((d) => d._id).every((d) => w.value.includes(d))
|
|
1521
|
+
), O = (d) => {
|
|
1522
|
+
d ? R.value[z.value].restaurantIds = p.value.map((S) => S._id) : R.value[z.value].restaurantIds = [];
|
|
1523
|
+
}, w = Q(() => R.value[z.value].restaurantIds), G = (d) => {
|
|
1524
|
+
R.value[z.value].restaurantIds = d;
|
|
1525
|
+
}, J = x(null), ae = x(!1);
|
|
1526
|
+
async function j(d) {
|
|
1527
|
+
var K;
|
|
1528
|
+
const S = `business/${(K = v.value) == null ? void 0 : K._id}/customer-display/${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
1529
|
+
ae.value = !0, await en.update(S, d).then((ce) => {
|
|
1530
|
+
R.value[ce] = {
|
|
1531
|
+
restaurantIds: [],
|
|
1532
|
+
deleted: !1
|
|
1533
|
+
}, z.value = ce;
|
|
1534
|
+
}), ae.value = !1, await sn(), J.value.scrollIntoView(!1);
|
|
1535
|
+
}
|
|
1536
|
+
const oe = x(!1), W = nt();
|
|
1537
|
+
async function B() {
|
|
1538
|
+
oe.value = !0;
|
|
1539
|
+
const d = Re();
|
|
1540
|
+
await N.updateCustomerDisplay(d).then(async () => {
|
|
1541
|
+
W.open({
|
|
1542
|
+
message: t("device.customerDisplay.update.success", { name: y() }),
|
|
1543
|
+
type: "success",
|
|
1544
|
+
position: ee.BOTTOM
|
|
1545
|
+
});
|
|
1546
|
+
}).catch((S) => {
|
|
1547
|
+
W.open({
|
|
1548
|
+
message: t("device.error.general"),
|
|
1549
|
+
type: "error",
|
|
1550
|
+
position: ee.BOTTOM
|
|
1551
|
+
});
|
|
1552
|
+
}), l.value = !0, s.value = !1, await st(), oe.value = !1;
|
|
1553
|
+
}
|
|
1554
|
+
function Re() {
|
|
1555
|
+
return {
|
|
1556
|
+
images: A.value.map((d) => ({
|
|
1557
|
+
url: d,
|
|
1558
|
+
restaurantIds: R.value[d].restaurantIds
|
|
1559
|
+
})),
|
|
1560
|
+
publishRestaurants: p.value.map((d) => d._id)
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
async function st() {
|
|
1564
|
+
const d = Object.entries(R.value).filter(([, { deleted: S }]) => S).map(([S]) => S);
|
|
1565
|
+
await Promise.all(
|
|
1566
|
+
d.map(async (S) => {
|
|
1567
|
+
await en.delete(S);
|
|
1568
|
+
})
|
|
1569
|
+
);
|
|
1570
|
+
}
|
|
1571
|
+
const je = (d) => new Date(d).toLocaleDateString("en-GB", {
|
|
1572
|
+
day: "2-digit",
|
|
1573
|
+
month: "short",
|
|
1574
|
+
year: "numeric",
|
|
1575
|
+
hour: "2-digit",
|
|
1576
|
+
minute: "2-digit",
|
|
1577
|
+
hour12: !0
|
|
1578
|
+
}).replace(",", "").toUpperCase(), Ie = (d) => {
|
|
1579
|
+
const S = d.replace(/([A-Z])/g, " $1").toLowerCase();
|
|
1580
|
+
return S.charAt(0).toUpperCase() + S.slice(1);
|
|
1581
|
+
}, Ee = (d) => Date.now() - new Date(d).getTime() < 6e5;
|
|
1582
|
+
return $e(s, (d) => {
|
|
1583
|
+
d && I();
|
|
1584
|
+
}), pt(() => {
|
|
1585
|
+
I();
|
|
1586
|
+
}), (d, S) => {
|
|
1587
|
+
const Y = E("FmCardHeader"), K = E("FmCardSection"), ce = E("FmCard"), it = E("FmIcon"), Pe = E("FmCircularProgress"), we = E("FmButton"), Fe = E("FmThumbnail"), me = E("FmDropField"), at = E("FmCheckbox"), Tt = E("FmForm"), De = E("FmSideSheet");
|
|
1588
|
+
return f(), M(De, {
|
|
1589
|
+
header: i(t)("device.information.title"),
|
|
1590
|
+
"max-width": 560,
|
|
1591
|
+
modelValue: i(s),
|
|
1592
|
+
"onUpdate:modelValue": S[2] || (S[2] = (pe) => nn(s) ? s.value = pe : null),
|
|
1593
|
+
"close-button": !oe.value,
|
|
1594
|
+
"dismiss-away": !0
|
|
1595
|
+
}, On({
|
|
1596
|
+
default: F(() => [
|
|
1597
|
+
m(Tt, null, {
|
|
1598
|
+
default: F(() => {
|
|
1599
|
+
var pe, a, u, _, U, fe, qe, lt, xe, Le, Ue, Ce;
|
|
1600
|
+
return [
|
|
1601
|
+
r("div", rs, [
|
|
1602
|
+
m(ce, { variant: "outlined" }, {
|
|
1603
|
+
default: F(() => [
|
|
1604
|
+
m(Y, {
|
|
1605
|
+
title: i(t)("device.information.sections.deviceInfo"),
|
|
1606
|
+
class: "pb-8 px-16"
|
|
1607
|
+
}, null, 8, ["title"]),
|
|
1608
|
+
m(K, { class: "pt-0 flex flex-col gap-8" }, {
|
|
1609
|
+
default: F(() => {
|
|
1610
|
+
var D, L, he, ve;
|
|
1611
|
+
return [
|
|
1612
|
+
r("div", cs, [
|
|
1613
|
+
r("div", us, h(i(t)("device.information.main.id")), 1),
|
|
1614
|
+
r("div", ds, h(((D = d.device) == null ? void 0 : D.machineId) ?? "-"), 1)
|
|
1615
|
+
]),
|
|
1616
|
+
r("div", ms, [
|
|
1617
|
+
r("div", ps, h(i(t)("device.information.main.name")), 1),
|
|
1618
|
+
r("div", fs, h(y()), 1)
|
|
1619
|
+
]),
|
|
1620
|
+
r("div", hs, [
|
|
1621
|
+
r("div", vs, h(i(t)("device.information.main.type")), 1),
|
|
1622
|
+
r("div", _s, h((L = d.device) == null ? void 0 : L.type), 1)
|
|
1623
|
+
]),
|
|
1624
|
+
r("div", gs, [
|
|
1625
|
+
r("div", bs, h(i(t)("device.information.main.bindingAt")), 1),
|
|
1626
|
+
r("div", ys, h((he = d.device) != null && he.bindAt ? je((ve = d.device) == null ? void 0 : ve.bindAt) : "-"), 1)
|
|
1627
|
+
])
|
|
1628
|
+
];
|
|
1629
|
+
}),
|
|
1630
|
+
_: 1
|
|
1631
|
+
})
|
|
1632
|
+
]),
|
|
1633
|
+
_: 1
|
|
1634
|
+
}),
|
|
1635
|
+
(pe = d.device.heartbeatInfo) != null && pe.updatedAt ? (f(), M(ce, {
|
|
1636
|
+
key: 0,
|
|
1637
|
+
variant: "outlined"
|
|
1638
|
+
}, {
|
|
1639
|
+
default: F(() => [
|
|
1640
|
+
m(Y, {
|
|
1641
|
+
title: i(t)("device.information.sections.heartbeatStatus"),
|
|
1642
|
+
class: "pb-8 px-16"
|
|
1643
|
+
}, null, 8, ["title"]),
|
|
1644
|
+
m(K, { class: "pt-0 flex flex-col gap-8" }, {
|
|
1645
|
+
default: F(() => {
|
|
1646
|
+
var D, L, he, ve, Oe, T, te, ge, He, Ge, We, Ye, Ke, Xe, Ze, Qe;
|
|
1647
|
+
return [
|
|
1648
|
+
r("div", Ts, [
|
|
1649
|
+
r("div", Is, h(i(t)("device.information.heartbeat.lastSyncAt")), 1),
|
|
1650
|
+
r("div", Es, [
|
|
1651
|
+
m(it, {
|
|
1652
|
+
class: "motion-safe:animate-pulse",
|
|
1653
|
+
name: "radio_button_unchecked",
|
|
1654
|
+
size: "sm",
|
|
1655
|
+
color: Ee((L = (D = d.device) == null ? void 0 : D.heartbeatInfo) == null ? void 0 : L.updatedAt) ? "system-success-300" : "system-error-300"
|
|
1656
|
+
}, null, 8, ["color"]),
|
|
1657
|
+
r("div", ws, h(je((ve = (he = d.device) == null ? void 0 : he.heartbeatInfo) == null ? void 0 : ve.updatedAt)), 1)
|
|
1658
|
+
])
|
|
1659
|
+
]),
|
|
1660
|
+
(T = (Oe = d.device) == null ? void 0 : Oe.heartbeatInfo) != null && T.freeMemory ? (f(), g("div", Fs, [
|
|
1661
|
+
r("div", Cs, h(i(t)("device.information.heartbeat.freeMemory")), 1),
|
|
1662
|
+
r("div", ks, h((ge = (te = d.device) == null ? void 0 : te.heartbeatInfo) == null ? void 0 : ge.freeMemory.toFixed(2)) + " MB", 1)
|
|
1663
|
+
])) : k("", !0),
|
|
1664
|
+
(He = d.device.heartbeatInfo) != null && He.appMemory ? (f(), g("div", Rs, [
|
|
1665
|
+
r("div", Ds, h(i(t)("device.information.heartbeat.appMemory")), 1),
|
|
1666
|
+
r("div", Os, h((Ge = d.device.heartbeatInfo) == null ? void 0 : Ge.appMemory.toFixed(2)) + " MB", 1)
|
|
1667
|
+
])) : k("", !0),
|
|
1668
|
+
(We = d.device.heartbeatInfo) != null && We.totalMemory ? (f(), g("div", As, [
|
|
1669
|
+
r("div", zs, h(i(t)("device.information.heartbeat.totalMemory")), 1),
|
|
1670
|
+
r("div", Ss, h((Ye = d.device.heartbeatInfo) == null ? void 0 : Ye.totalMemory.toFixed(2)) + " MB", 1)
|
|
1671
|
+
])) : k("", !0),
|
|
1672
|
+
(Ke = d.device.heartbeatInfo) != null && Ke.freeSpace ? (f(), g("div", Ns, [
|
|
1673
|
+
r("div", Ps, h(i(t)("device.information.heartbeat.freeSpace")), 1),
|
|
1674
|
+
r("div", xs, h((Xe = d.device.heartbeatInfo) == null ? void 0 : Xe.freeSpace.toFixed(2)) + " MB", 1)
|
|
1675
|
+
])) : k("", !0),
|
|
1676
|
+
(Ze = d.device.heartbeatInfo) != null && Ze.totalSpace ? (f(), g("div", Ls, [
|
|
1677
|
+
r("div", Us, h(i(t)("device.information.heartbeat.totalSpace")), 1),
|
|
1678
|
+
r("div", Ms, h((Qe = d.device.heartbeatInfo) == null ? void 0 : Qe.totalSpace.toFixed(2)) + " MB", 1)
|
|
1679
|
+
])) : k("", !0)
|
|
1680
|
+
];
|
|
1681
|
+
}),
|
|
1682
|
+
_: 1
|
|
1683
|
+
})
|
|
1684
|
+
]),
|
|
1685
|
+
_: 1
|
|
1686
|
+
})) : k("", !0),
|
|
1687
|
+
(a = d.device) != null && a.appVersion && Object.values((u = d.device) == null ? void 0 : u.appVersion).some((D) => D) ? (f(), M(ce, {
|
|
1688
|
+
key: 1,
|
|
1689
|
+
variant: "outlined"
|
|
1690
|
+
}, {
|
|
1691
|
+
default: F(() => [
|
|
1692
|
+
m(Y, {
|
|
1693
|
+
title: i(t)("device.information.sections.applicationInfo"),
|
|
1694
|
+
class: "pb-8 px-16"
|
|
1695
|
+
}, null, 8, ["title"]),
|
|
1696
|
+
m(K, { class: "pt-0 flex flex-col gap-8" }, {
|
|
1697
|
+
default: F(() => {
|
|
1698
|
+
var D, L, he, ve, Oe, T, te, ge, He, Ge, We, Ye, Ke, Xe, Ze, Qe, Ut, Mt, Bt, Vt, $t, jt, qt, Ht;
|
|
1699
|
+
return [
|
|
1700
|
+
r("div", Bs, [
|
|
1701
|
+
(L = (D = d.device) == null ? void 0 : D.appVersion) != null && L.appName ? (f(), g("div", Vs, h(i(t)("device.information.app.name")), 1)) : k("", !0),
|
|
1702
|
+
r("div", $s, h((ve = (he = d.device) == null ? void 0 : he.appVersion) == null ? void 0 : ve.appName), 1)
|
|
1703
|
+
]),
|
|
1704
|
+
(T = (Oe = d.device) == null ? void 0 : Oe.appVersion) != null && T.buildNumber ? (f(), g("div", js, [
|
|
1705
|
+
r("div", qs, h(i(t)("device.information.app.buildNumber")), 1),
|
|
1706
|
+
r("div", Hs, h((ge = (te = d.device) == null ? void 0 : te.appVersion) == null ? void 0 : ge.buildNumber), 1)
|
|
1707
|
+
])) : k("", !0),
|
|
1708
|
+
(Ge = (He = d.device) == null ? void 0 : He.appVersion) != null && Ge.buildSignature ? (f(), g("div", Gs, [
|
|
1709
|
+
r("div", Ws, h(i(t)("device.information.app.buildSignature")), 1),
|
|
1710
|
+
r("div", Ys, h((Ye = (We = d.device) == null ? void 0 : We.appVersion) == null ? void 0 : Ye.buildSignature), 1)
|
|
1711
|
+
])) : k("", !0),
|
|
1712
|
+
(Xe = (Ke = d.device) == null ? void 0 : Ke.appVersion) != null && Xe.installerStore ? (f(), g("div", Ks, [
|
|
1713
|
+
r("div", Xs, h(i(t)("device.information.app.installerStore")), 1),
|
|
1714
|
+
r("div", Zs, h((Qe = (Ze = d.device) == null ? void 0 : Ze.appVersion) == null ? void 0 : Qe.installerStore), 1)
|
|
1715
|
+
])) : k("", !0),
|
|
1716
|
+
(Mt = (Ut = d.device) == null ? void 0 : Ut.appVersion) != null && Mt.packageName ? (f(), g("div", Qs, [
|
|
1717
|
+
r("div", Js, h(i(t)("device.information.app.packageName")), 1),
|
|
1718
|
+
r("div", ei, h((Vt = (Bt = d.device) == null ? void 0 : Bt.appVersion) == null ? void 0 : Vt.packageName), 1)
|
|
1719
|
+
])) : k("", !0),
|
|
1720
|
+
(jt = ($t = d.device) == null ? void 0 : $t.appVersion) != null && jt.version ? (f(), g("div", ti, [
|
|
1721
|
+
r("div", ni, h(i(t)("device.information.app.version")), 1),
|
|
1722
|
+
r("div", oi, h((Ht = (qt = d.device) == null ? void 0 : qt.appVersion) == null ? void 0 : Ht.version), 1)
|
|
1723
|
+
])) : k("", !0)
|
|
1724
|
+
];
|
|
1725
|
+
}),
|
|
1726
|
+
_: 1
|
|
1727
|
+
})
|
|
1728
|
+
]),
|
|
1729
|
+
_: 1
|
|
1730
|
+
})) : k("", !0),
|
|
1731
|
+
(_ = d.device.os) != null && _.system ? (f(), M(ce, {
|
|
1732
|
+
key: 2,
|
|
1733
|
+
variant: "outlined"
|
|
1734
|
+
}, {
|
|
1735
|
+
default: F(() => [
|
|
1736
|
+
m(Y, {
|
|
1737
|
+
title: i(t)("device.information.sections.systemInfo"),
|
|
1738
|
+
class: "pb-8 px-16"
|
|
1739
|
+
}, null, 8, ["title"]),
|
|
1740
|
+
m(K, { class: "pt-0 flex flex-col gap-8" }, {
|
|
1741
|
+
default: F(() => [
|
|
1742
|
+
(f(!0), g(ie, null, ue(d.device.os.system, (D, L) => (f(), g(ie, { key: L }, [
|
|
1743
|
+
D && !(D instanceof Object) ? (f(), g("div", si, [
|
|
1744
|
+
r("div", ii, h(i(t)(`device.information.system.${L}`) || Ie(L)), 1),
|
|
1745
|
+
r("div", null, [
|
|
1746
|
+
r("div", ai, h(D), 1)
|
|
1747
|
+
])
|
|
1748
|
+
])) : k("", !0)
|
|
1749
|
+
], 64))), 128))
|
|
1750
|
+
]),
|
|
1751
|
+
_: 1
|
|
1752
|
+
})
|
|
1753
|
+
]),
|
|
1754
|
+
_: 1
|
|
1755
|
+
})) : k("", !0),
|
|
1756
|
+
(fe = (U = d.device) == null ? void 0 : U.os) != null && fe.android ? (f(), M(ce, {
|
|
1757
|
+
key: 3,
|
|
1758
|
+
variant: "outlined"
|
|
1759
|
+
}, {
|
|
1760
|
+
default: F(() => [
|
|
1761
|
+
m(Y, {
|
|
1762
|
+
title: i(t)("device.information.sections.androidOS"),
|
|
1763
|
+
class: "pb-8 px-16"
|
|
1764
|
+
}, null, 8, ["title"]),
|
|
1765
|
+
m(K, { class: "pt-0 flex flex-col gap-8" }, {
|
|
1766
|
+
default: F(() => [
|
|
1767
|
+
(f(!0), g(ie, null, ue(d.device.os.android, (D, L) => (f(), g(ie, { key: L }, [
|
|
1768
|
+
D && !(D instanceof Object) ? (f(), g("div", li, [
|
|
1769
|
+
r("div", ri, h(i(t)(`device.information.android.${L}`) || Ie(L)), 1),
|
|
1770
|
+
r("div", null, [
|
|
1771
|
+
r("div", ci, h(D), 1)
|
|
1772
|
+
])
|
|
1773
|
+
])) : k("", !0)
|
|
1774
|
+
], 64))), 128))
|
|
1775
|
+
]),
|
|
1776
|
+
_: 1
|
|
1777
|
+
})
|
|
1778
|
+
]),
|
|
1779
|
+
_: 1
|
|
1780
|
+
})) : k("", !0),
|
|
1781
|
+
(qe = d.device.os) != null && qe.iOS ? (f(), M(ce, {
|
|
1782
|
+
key: 4,
|
|
1783
|
+
variant: "outlined"
|
|
1784
|
+
}, {
|
|
1785
|
+
default: F(() => [
|
|
1786
|
+
m(Y, {
|
|
1787
|
+
title: i(t)("device.information.sections.iOSOS"),
|
|
1788
|
+
class: "pb-8 px-16"
|
|
1789
|
+
}, null, 8, ["title"]),
|
|
1790
|
+
m(K, { class: "pt-0 flex flex-col gap-8" }, {
|
|
1791
|
+
default: F(() => [
|
|
1792
|
+
(f(!0), g(ie, null, ue(d.device.os.iOS, (D, L) => (f(), g(ie, { key: L }, [
|
|
1793
|
+
D && !(D instanceof Object) ? (f(), g("div", ui, [
|
|
1794
|
+
r("div", di, h(i(t)(`device.information.ios.${L}`) || Ie(L)), 1),
|
|
1795
|
+
r("div", null, [
|
|
1796
|
+
r("div", mi, h(D), 1)
|
|
1797
|
+
])
|
|
1798
|
+
])) : k("", !0)
|
|
1799
|
+
], 64))), 128))
|
|
1800
|
+
]),
|
|
1801
|
+
_: 1
|
|
1802
|
+
})
|
|
1803
|
+
]),
|
|
1804
|
+
_: 1
|
|
1805
|
+
})) : k("", !0),
|
|
1806
|
+
(lt = d.device.os) != null && lt.windows ? (f(), M(ce, {
|
|
1807
|
+
key: 5,
|
|
1808
|
+
variant: "outlined"
|
|
1809
|
+
}, {
|
|
1810
|
+
default: F(() => [
|
|
1811
|
+
m(Y, {
|
|
1812
|
+
title: i(t)("device.information.sections.windowsOS"),
|
|
1813
|
+
class: "pb-8 px-16"
|
|
1814
|
+
}, null, 8, ["title"]),
|
|
1815
|
+
m(K, { class: "pt-0 flex flex-col gap-8" }, {
|
|
1816
|
+
default: F(() => [
|
|
1817
|
+
(f(!0), g(ie, null, ue(d.device.os.windows, (D, L) => (f(), g(ie, { key: L }, [
|
|
1818
|
+
D && !(D instanceof Object) ? (f(), g("div", pi, [
|
|
1819
|
+
r("div", fi, h(i(t)(`device.information.windows.${L}`) || Ie(L)), 1),
|
|
1820
|
+
r("div", null, [
|
|
1821
|
+
r("div", hi, h(D), 1)
|
|
1822
|
+
])
|
|
1823
|
+
])) : k("", !0)
|
|
1824
|
+
], 64))), 128))
|
|
1825
|
+
]),
|
|
1826
|
+
_: 1
|
|
1827
|
+
})
|
|
1828
|
+
]),
|
|
1829
|
+
_: 1
|
|
1830
|
+
})) : k("", !0),
|
|
1831
|
+
d.device.type === i(Z).Enum.MAIN ? (f(), g("div", vi, [
|
|
1832
|
+
r("div", _i, h(i(t)("device.customerDisplay.title")), 1),
|
|
1833
|
+
r("div", gi, h(i(t)("device.customerDisplay.description")), 1),
|
|
1834
|
+
ae.value ? (f(), g("div", bi, [
|
|
1835
|
+
m(Pe, { size: "lg" })
|
|
1836
|
+
])) : (f(), g("div", yi, [
|
|
1837
|
+
(xe = A.value) != null && xe.length ? (f(), g("div", Ti, [
|
|
1838
|
+
r("img", {
|
|
1839
|
+
class: "object-cover w-full h-[264px] xs:h-[175px]",
|
|
1840
|
+
src: z.value
|
|
1841
|
+
}, null, 8, Ii),
|
|
1842
|
+
r("div", Ei, [
|
|
1843
|
+
m(we, {
|
|
1844
|
+
class: "h-[36px] w-[36px]",
|
|
1845
|
+
icon: "close",
|
|
1846
|
+
onClick: V,
|
|
1847
|
+
variant: "secondary",
|
|
1848
|
+
"bg-color": "neutral-white"
|
|
1849
|
+
})
|
|
1850
|
+
])
|
|
1851
|
+
])) : k("", !0),
|
|
1852
|
+
r("div", wi, [
|
|
1853
|
+
(Le = A.value) != null && Le.length ? (f(), g("div", Fi, [
|
|
1854
|
+
(f(!0), g(ie, null, ue(A.value, (D) => (f(), M(Fe, {
|
|
1855
|
+
key: D,
|
|
1856
|
+
src: D,
|
|
1857
|
+
size: i(n)("xs") ? "lg" : "xl",
|
|
1858
|
+
class: on(["cursor-pointer mr-1", z.value == D ? "border-fm-color-primary border-[2px]" : ""]),
|
|
1859
|
+
onClick: (L) => P(D)
|
|
1860
|
+
}, null, 8, ["src", "size", "class", "onClick"]))), 128))
|
|
1861
|
+
])) : k("", !0),
|
|
1862
|
+
m(me, {
|
|
1863
|
+
class: "w-[200px] h-[170px]",
|
|
1864
|
+
onFileUpload: S[0] || (S[0] = (D) => j(D)),
|
|
1865
|
+
accept: "image/*"
|
|
1866
|
+
}, {
|
|
1867
|
+
"accept-text": F(() => S[3] || (S[3] = [
|
|
1868
|
+
r("div", null, null, -1)
|
|
1869
|
+
])),
|
|
1870
|
+
"helper-text": F(() => [
|
|
1871
|
+
r("div", Ci, [
|
|
1872
|
+
r("div", null, h(i(t)("device.customerDisplay.imageSize.recommendation")), 1),
|
|
1873
|
+
r("div", null, h(i(t)("device.customerDisplay.imageSize.dimensions")), 1)
|
|
1874
|
+
])
|
|
1875
|
+
]),
|
|
1876
|
+
_: 1
|
|
1877
|
+
})
|
|
1878
|
+
])
|
|
1879
|
+
]))
|
|
1880
|
+
])) : k("", !0),
|
|
1881
|
+
r("div", {
|
|
1882
|
+
ref_key: "bottomDiv",
|
|
1883
|
+
ref: J
|
|
1884
|
+
}, null, 512),
|
|
1885
|
+
(Ue = A.value) != null && Ue.length && d.device.type === i(Z).Enum.MAIN ? (f(), g("div", ki, [
|
|
1886
|
+
r("div", Ri, h(i(t)("device.customerDisplay.selection.title")), 1),
|
|
1887
|
+
r("div", Di, h(i(t)("device.customerDisplay.selection.description")), 1),
|
|
1888
|
+
r("div", Oi, [
|
|
1889
|
+
m(at, {
|
|
1890
|
+
"model-value": $.value,
|
|
1891
|
+
label: i(t)("device.filters.all"),
|
|
1892
|
+
value: "1",
|
|
1893
|
+
indeterminate: ((Ce = w.value) == null ? void 0 : Ce.length) > 0,
|
|
1894
|
+
"onUpdate:modelValue": O
|
|
1895
|
+
}, null, 8, ["model-value", "label", "indeterminate"]),
|
|
1896
|
+
(f(!0), g(ie, null, ue(d.devices.filter((D) => D.restaurantId && D.type === i(Z).Enum.MAIN), (D, L) => (f(), M(at, {
|
|
1897
|
+
key: L,
|
|
1898
|
+
"model-value": w.value,
|
|
1899
|
+
label: y(D),
|
|
1900
|
+
value: D.restaurantId,
|
|
1901
|
+
"onUpdate:modelValue": G
|
|
1902
|
+
}, null, 8, ["model-value", "label", "value"]))), 128))
|
|
1903
|
+
])
|
|
1904
|
+
])) : k("", !0)
|
|
1905
|
+
])
|
|
1906
|
+
];
|
|
1907
|
+
}),
|
|
1908
|
+
_: 1
|
|
1909
|
+
})
|
|
1910
|
+
]),
|
|
1911
|
+
_: 2
|
|
1912
|
+
}, [
|
|
1913
|
+
d.device.type === i(Z).Enum.MAIN ? {
|
|
1914
|
+
name: "side-sheet-footer",
|
|
1915
|
+
fn: F(() => [
|
|
1916
|
+
r("div", Ai, [
|
|
1917
|
+
m(we, {
|
|
1918
|
+
loading: oe.value,
|
|
1919
|
+
disabled: oe.value,
|
|
1920
|
+
variant: "primary",
|
|
1921
|
+
label: i(t)("device.actions.update"),
|
|
1922
|
+
onClick: Dt(B, ["prevent"])
|
|
1923
|
+
}, null, 8, ["loading", "disabled", "label"]),
|
|
1924
|
+
m(we, {
|
|
1925
|
+
disabled: oe.value,
|
|
1926
|
+
variant: "secondary",
|
|
1927
|
+
label: i(t)("device.actions.cancel"),
|
|
1928
|
+
onClick: S[1] || (S[1] = (pe) => s.value = !1)
|
|
1929
|
+
}, null, 8, ["disabled", "label"])
|
|
1930
|
+
])
|
|
1931
|
+
]),
|
|
1932
|
+
key: "0"
|
|
1933
|
+
} : void 0
|
|
1934
|
+
]), 1032, ["header", "modelValue", "close-button"]);
|
|
1935
|
+
};
|
|
1936
|
+
}
|
|
1937
|
+
});
|
|
1938
|
+
var Cn = /* @__PURE__ */ ((e) => (e.licensePosCreateSubPos = "license_pos_create_subpos", e))(Cn || {}), Ve = /* @__PURE__ */ ((e) => (e.PENDING = "pending", e.PROCESSING = "processing", e.COMPLETED = "completed", e.FAILED = "failed", e))(Ve || {});
|
|
1939
|
+
const Si = { class: "flex flex-col gap-8" }, Ni = { class: "flex justify-end items-center" }, Pi = {
|
|
1940
|
+
key: 0,
|
|
1941
|
+
class: "flex justify-center"
|
|
1942
|
+
}, xi = {
|
|
1943
|
+
key: 1,
|
|
1944
|
+
class: "flex flex-col gap-5"
|
|
1945
|
+
}, Li = {
|
|
1946
|
+
key: 2,
|
|
1947
|
+
class: "flex flex-col gap-8"
|
|
1948
|
+
}, Ui = { key: 0 }, Mi = {
|
|
1949
|
+
key: 3,
|
|
1950
|
+
class: "flex flex-col gap-8"
|
|
1951
|
+
}, Bi = { key: 0 }, Vi = { key: 4 }, $i = /* @__PURE__ */ Se({
|
|
1952
|
+
__name: "DownloadLogDialog",
|
|
1953
|
+
props: {
|
|
1954
|
+
machineId: {
|
|
1955
|
+
type: String,
|
|
1956
|
+
required: !0
|
|
1957
|
+
}
|
|
1958
|
+
},
|
|
1959
|
+
setup(e) {
|
|
1960
|
+
const t = e, n = x(), o = x(!1), s = x(!1), l = x(!1), c = async () => {
|
|
1961
|
+
var P;
|
|
1962
|
+
const I = (P = ht().sessionUser.value) == null ? void 0 : P.id;
|
|
1963
|
+
return {
|
|
1964
|
+
machineId: t.machineId,
|
|
1965
|
+
userId: I ?? ""
|
|
1966
|
+
};
|
|
1967
|
+
}, p = async () => {
|
|
1968
|
+
o.value = !0, n.value = void 0;
|
|
1969
|
+
try {
|
|
1970
|
+
const b = await c(), I = await ne.getLogRequest(b);
|
|
1971
|
+
n.value = I;
|
|
1972
|
+
} catch (b) {
|
|
1973
|
+
console.error("Failed to fetch log request:", b);
|
|
1974
|
+
} finally {
|
|
1975
|
+
o.value = !1;
|
|
1976
|
+
}
|
|
1977
|
+
}, v = async () => {
|
|
1978
|
+
l.value = !0;
|
|
1979
|
+
try {
|
|
1980
|
+
const b = await c(), I = await ne.getLogRequest(b);
|
|
1981
|
+
n.value = I;
|
|
1982
|
+
} catch (b) {
|
|
1983
|
+
console.error("Failed to refresh log request:", b);
|
|
1984
|
+
} finally {
|
|
1985
|
+
l.value = !1;
|
|
1986
|
+
}
|
|
1987
|
+
}, y = async () => {
|
|
1988
|
+
o.value = !0, n.value = void 0;
|
|
1989
|
+
try {
|
|
1990
|
+
const b = await c(), I = await ne.createLogRequest(b);
|
|
1991
|
+
n.value = I;
|
|
1992
|
+
} catch (b) {
|
|
1993
|
+
console.error("Failed to create log request:", b);
|
|
1994
|
+
} finally {
|
|
1995
|
+
o.value = !1;
|
|
1996
|
+
}
|
|
1997
|
+
}, R = async () => {
|
|
1998
|
+
var b;
|
|
1999
|
+
if ((b = n.value) != null && b.requestId) {
|
|
2000
|
+
s.value = !0;
|
|
2001
|
+
try {
|
|
2002
|
+
await ne.deleteLogRequest(n.value.requestId), await p();
|
|
2003
|
+
} catch (I) {
|
|
2004
|
+
console.error("Failed to delete log request:", I);
|
|
2005
|
+
} finally {
|
|
2006
|
+
s.value = !1;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}, A = (b) => new Date(b).toLocaleDateString("en-GB", {
|
|
2010
|
+
day: "2-digit",
|
|
2011
|
+
month: "short",
|
|
2012
|
+
year: "numeric",
|
|
2013
|
+
hour: "2-digit",
|
|
2014
|
+
minute: "2-digit",
|
|
2015
|
+
hour12: !0
|
|
2016
|
+
}).toUpperCase(), N = (b) => {
|
|
2017
|
+
window.open(b, "_blank"), setTimeout(() => R(), 500);
|
|
2018
|
+
};
|
|
2019
|
+
return pt(async () => {
|
|
2020
|
+
await p();
|
|
2021
|
+
}), (b, I) => {
|
|
2022
|
+
var J, ae, j, oe;
|
|
2023
|
+
const z = E("FmButton"), P = E("FmCircularProgress"), V = E("FmSnackbar"), $ = E("FmCardHeader"), O = E("FmCardSection"), w = E("FmCard"), G = E("FmCardActions");
|
|
2024
|
+
return f(), g("div", Si, [
|
|
2025
|
+
r("div", Ni, [
|
|
2026
|
+
o.value ? k("", !0) : (f(), M(z, {
|
|
2027
|
+
key: 0,
|
|
2028
|
+
variant: "secondary",
|
|
2029
|
+
size: "md",
|
|
2030
|
+
"prepend-icon": "refresh",
|
|
2031
|
+
onClick: v
|
|
2032
|
+
}))
|
|
2033
|
+
]),
|
|
2034
|
+
o.value ? (f(), g("div", Pi, [
|
|
2035
|
+
m(P, { size: "lg" })
|
|
2036
|
+
])) : k("", !0),
|
|
2037
|
+
!o.value && !n.value ? (f(), g("div", xi, [
|
|
2038
|
+
m(V, {
|
|
2039
|
+
description: "Device is online",
|
|
2040
|
+
variant: "info"
|
|
2041
|
+
}),
|
|
2042
|
+
m(z, {
|
|
2043
|
+
label: "Create download log request",
|
|
2044
|
+
onClick: y,
|
|
2045
|
+
loading: o.value
|
|
2046
|
+
}, null, 8, ["loading"])
|
|
2047
|
+
])) : k("", !0),
|
|
2048
|
+
!o.value && (((J = n.value) == null ? void 0 : J.status) === i(Ve).PENDING || ((ae = n.value) == null ? void 0 : ae.status) === i(Ve).PROCESSING) ? (f(), g("div", Li, [
|
|
2049
|
+
m(V, {
|
|
2050
|
+
description: "Your in progress downloads need to finish before you can request a new download.",
|
|
2051
|
+
variant: "info"
|
|
2052
|
+
}),
|
|
2053
|
+
m(z, {
|
|
2054
|
+
label: "Create download log request",
|
|
2055
|
+
onClick: y,
|
|
2056
|
+
disabled: ""
|
|
2057
|
+
}),
|
|
2058
|
+
m(w, { variant: "outlined" }, {
|
|
2059
|
+
default: F(() => [
|
|
2060
|
+
m($, {
|
|
2061
|
+
title: n.value.status === i(Ve).PENDING ? "Pending" : "Processing"
|
|
2062
|
+
}, null, 8, ["title"]),
|
|
2063
|
+
m(O, { class: "pt-0" }, {
|
|
2064
|
+
default: F(() => {
|
|
2065
|
+
var W, B;
|
|
2066
|
+
return [
|
|
2067
|
+
r("div", null, "Request ID: " + h(n.value.requestId), 1),
|
|
2068
|
+
r("div", null, "Requested at: " + h(A((W = n.value) == null ? void 0 : W.createdAt)), 1),
|
|
2069
|
+
n.value.expiresAt ? (f(), g("div", Ui, "Expires at: " + h(A((B = n.value) == null ? void 0 : B.expiresAt)), 1)) : k("", !0)
|
|
2070
|
+
];
|
|
2071
|
+
}),
|
|
2072
|
+
_: 1
|
|
2073
|
+
})
|
|
2074
|
+
]),
|
|
2075
|
+
_: 1
|
|
2076
|
+
})
|
|
2077
|
+
])) : k("", !0),
|
|
2078
|
+
!o.value && ((j = n.value) == null ? void 0 : j.status) === i(Ve).COMPLETED ? (f(), g("div", Mi, [
|
|
2079
|
+
m(z, {
|
|
2080
|
+
label: "Create new log request",
|
|
2081
|
+
onClick: y
|
|
2082
|
+
}),
|
|
2083
|
+
m(V, {
|
|
2084
|
+
description: `Please download this file before it expires. Once expired, the file will no longer be available for
|
|
2085
|
+
download.`,
|
|
2086
|
+
variant: "info"
|
|
2087
|
+
}),
|
|
2088
|
+
m(w, { variant: "outlined" }, {
|
|
2089
|
+
default: F(() => [
|
|
2090
|
+
m($, { title: "Completed" }),
|
|
2091
|
+
m(O, { class: "pt-0" }, {
|
|
2092
|
+
default: F(() => {
|
|
2093
|
+
var W, B, Re;
|
|
2094
|
+
return [
|
|
2095
|
+
r("div", null, "Request ID: " + h(n.value.requestId), 1),
|
|
2096
|
+
r("div", null, "Requested at: " + h(A((W = n.value) == null ? void 0 : W.createdAt)), 1),
|
|
2097
|
+
r("div", null, "File name: " + h(n.value.fileName || "logs.zip"), 1),
|
|
2098
|
+
r("div", null, " File size: " + h(n.value.fileSize ? Math.round(n.value.fileSize / 1024 / 1024 * 100) / 100 + " MB" : "Unknown"), 1),
|
|
2099
|
+
r("div", null, "Completed at: " + h(A((B = n.value) == null ? void 0 : B.completedAt)), 1),
|
|
2100
|
+
n.value.expiresAt ? (f(), g("div", Bi, "Expires at: " + h(A((Re = n.value) == null ? void 0 : Re.expiresAt)), 1)) : k("", !0)
|
|
2101
|
+
];
|
|
2102
|
+
}),
|
|
2103
|
+
_: 1
|
|
2104
|
+
}),
|
|
2105
|
+
m(G, { class: "flex justify-center w-full pt-0" }, {
|
|
2106
|
+
default: F(() => [
|
|
2107
|
+
m(z, {
|
|
2108
|
+
class: "w-60",
|
|
2109
|
+
label: "Download",
|
|
2110
|
+
size: "md",
|
|
2111
|
+
variant: "primary",
|
|
2112
|
+
onClick: I[0] || (I[0] = (W) => N(n.value.downloadUrl)),
|
|
2113
|
+
loading: s.value
|
|
2114
|
+
}, null, 8, ["loading"]),
|
|
2115
|
+
m(z, {
|
|
2116
|
+
class: "w-60",
|
|
2117
|
+
label: "Delete",
|
|
2118
|
+
size: "md",
|
|
2119
|
+
variant: "destructive",
|
|
2120
|
+
onClick: R,
|
|
2121
|
+
loading: s.value
|
|
2122
|
+
}, null, 8, ["loading"])
|
|
2123
|
+
]),
|
|
2124
|
+
_: 1
|
|
2125
|
+
})
|
|
2126
|
+
]),
|
|
2127
|
+
_: 1
|
|
2128
|
+
})
|
|
2129
|
+
])) : k("", !0),
|
|
2130
|
+
!o.value && ((oe = n.value) == null ? void 0 : oe.status) === i(Ve).FAILED ? (f(), g("div", Vi, [
|
|
2131
|
+
m(z, {
|
|
2132
|
+
label: "Create download log request",
|
|
2133
|
+
onClick: y
|
|
2134
|
+
}),
|
|
2135
|
+
m(w, { variant: "outlined" }, {
|
|
2136
|
+
default: F(() => [
|
|
2137
|
+
m($, { title: "Error" }),
|
|
2138
|
+
m(O, { class: "pt-0" }, {
|
|
2139
|
+
default: F(() => {
|
|
2140
|
+
var W, B;
|
|
2141
|
+
return [
|
|
2142
|
+
r("div", null, "Request ID: " + h(n.value.requestId), 1),
|
|
2143
|
+
r("div", null, "Requested at: " + h(A((W = n.value) == null ? void 0 : W.createdAt)), 1),
|
|
2144
|
+
r("div", null, "Error: " + h(((B = n.value) == null ? void 0 : B.error) || "Unknown error"), 1)
|
|
2145
|
+
];
|
|
2146
|
+
}),
|
|
2147
|
+
_: 1
|
|
2148
|
+
})
|
|
2149
|
+
]),
|
|
2150
|
+
_: 1
|
|
2151
|
+
})
|
|
2152
|
+
])) : k("", !0)
|
|
2153
|
+
]);
|
|
2154
|
+
};
|
|
2155
|
+
}
|
|
2156
|
+
});
|
|
2157
|
+
function ji(e) {
|
|
2158
|
+
return e || {};
|
|
2159
|
+
}
|
|
2160
|
+
function qi(e) {
|
|
2161
|
+
if (e == null || e === "" || typeof e == "boolean" || Array.isArray(e) || typeof e == "object")
|
|
2162
|
+
return !1;
|
|
2163
|
+
const t = Number(e);
|
|
2164
|
+
return !isNaN(t) && isFinite(t);
|
|
2165
|
+
}
|
|
2166
|
+
function Be(e, t, n) {
|
|
2167
|
+
const { t: o } = Ne();
|
|
2168
|
+
return (s) => e(s) || o(t, ji(n));
|
|
2169
|
+
}
|
|
2170
|
+
const be = {
|
|
2171
|
+
required() {
|
|
2172
|
+
return Be((e) => {
|
|
2173
|
+
var t;
|
|
2174
|
+
return !!((t = e == null ? void 0 : e.toString()) != null && t.length);
|
|
2175
|
+
}, "device.validation.required", {});
|
|
2176
|
+
},
|
|
2177
|
+
nonEmpty() {
|
|
2178
|
+
return Be((e) => {
|
|
2179
|
+
var t;
|
|
2180
|
+
return !!((t = e == null ? void 0 : e.trim()) != null && t.length);
|
|
2181
|
+
}, "device.validation.required", {});
|
|
2182
|
+
},
|
|
2183
|
+
matches(e) {
|
|
2184
|
+
return Be((t) => t === e, "device.validation.invalid", {});
|
|
2185
|
+
},
|
|
2186
|
+
min(e) {
|
|
2187
|
+
return Be((t) => t >= e, "device.validation.min", { min: e });
|
|
2188
|
+
},
|
|
2189
|
+
max(e) {
|
|
2190
|
+
return Be((t) => t <= e, "device.validation.max", { max: e });
|
|
2191
|
+
},
|
|
2192
|
+
number() {
|
|
2193
|
+
return Be(qi, "device.validation.number", {});
|
|
2194
|
+
}
|
|
2195
|
+
}, Hi = { class: "flex gap-8 items-center justify-start" }, Gi = /* @__PURE__ */ Se({
|
|
2196
|
+
__name: "ManageConfigurationSideSheet",
|
|
2197
|
+
props: {
|
|
2198
|
+
device: {},
|
|
2199
|
+
visible: { type: Boolean }
|
|
2200
|
+
},
|
|
2201
|
+
setup(e) {
|
|
2202
|
+
const { t } = Ne(), { isAtMost: n } = Ot(), o = e, s = mt(o, "visible"), l = x(), c = x(), p = x(), v = x(), y = Q(
|
|
2203
|
+
() => Object.values(It.enum).map((b) => ({
|
|
2204
|
+
label: b,
|
|
2205
|
+
value: b
|
|
2206
|
+
}))
|
|
2207
|
+
), R = nt(), A = async () => {
|
|
2208
|
+
if (!p.value || p.value > 30 || p.value < 5)
|
|
2209
|
+
return;
|
|
2210
|
+
const b = {
|
|
2211
|
+
logging: {
|
|
2212
|
+
enable: l.value,
|
|
2213
|
+
level: c.value,
|
|
2214
|
+
ttl: p.value
|
|
2215
|
+
},
|
|
2216
|
+
telemetry: {
|
|
2217
|
+
enable: v.value
|
|
2218
|
+
}
|
|
2219
|
+
};
|
|
2220
|
+
await ne.updateDeviceConfig(o.device.deviceId, b).then(async () => {
|
|
2221
|
+
N(), setTimeout(() => {
|
|
2222
|
+
R.open({
|
|
2223
|
+
message: t("device.status.config.success", { deviceName: o.device.name ?? o.device.restaurantName }),
|
|
2224
|
+
type: "success",
|
|
2225
|
+
position: ee.BOTTOM
|
|
2226
|
+
});
|
|
2227
|
+
}, 100);
|
|
2228
|
+
}).catch((I) => {
|
|
2229
|
+
R.open({
|
|
2230
|
+
message: t("device.status.config.error", { error: I }),
|
|
2231
|
+
type: "error",
|
|
2232
|
+
position: ee.BOTTOM
|
|
2233
|
+
});
|
|
2234
|
+
});
|
|
2235
|
+
}, N = () => {
|
|
2236
|
+
s.value = !1;
|
|
2237
|
+
};
|
|
2238
|
+
return pt(async () => {
|
|
2239
|
+
await ne.getDeviceConfig(o.device.deviceId).then((b) => {
|
|
2240
|
+
var I, z, P, V;
|
|
2241
|
+
l.value = ((I = b.logging) == null ? void 0 : I.enable) ?? !0, c.value = ((z = b.logging) == null ? void 0 : z.level) ?? It.Enum.ALL, p.value = ((P = b.logging) == null ? void 0 : P.ttl) ?? 30, v.value = ((V = b.telemetry) == null ? void 0 : V.enable) ?? !1;
|
|
2242
|
+
}).catch(() => {
|
|
2243
|
+
l.value = !0, c.value = It.Enum.ALL, p.value = 30, v.value = !1;
|
|
2244
|
+
});
|
|
2245
|
+
}), (b, I) => {
|
|
2246
|
+
const z = E("FmCardHeader"), P = E("FmSwitch"), V = E("FmSelect"), $ = E("FmStepperField"), O = E("FmCardSection"), w = E("FmCard"), G = E("FmForm"), J = E("FmButton"), ae = E("FmSideSheet");
|
|
2247
|
+
return f(), M(ae, {
|
|
2248
|
+
header: i(t)("device.config.title"),
|
|
2249
|
+
modelValue: i(s),
|
|
2250
|
+
"onUpdate:modelValue": I[4] || (I[4] = (j) => nn(s) ? s.value = j : null),
|
|
2251
|
+
"max-width": i(n)("xs") ? 560 : 470
|
|
2252
|
+
}, {
|
|
2253
|
+
"side-sheet-footer": F(() => [
|
|
2254
|
+
r("div", Hi, [
|
|
2255
|
+
m(J, {
|
|
2256
|
+
variant: "primary",
|
|
2257
|
+
label: i(t)("device.actions.update"),
|
|
2258
|
+
onClick: Dt(A, ["prevent"])
|
|
2259
|
+
}, null, 8, ["label"]),
|
|
2260
|
+
m(J, {
|
|
2261
|
+
variant: "secondary",
|
|
2262
|
+
label: i(t)("device.actions.cancel"),
|
|
2263
|
+
onClick: N
|
|
2264
|
+
}, null, 8, ["label"])
|
|
2265
|
+
])
|
|
2266
|
+
]),
|
|
2267
|
+
default: F(() => [
|
|
2268
|
+
m(G, null, {
|
|
2269
|
+
default: F(() => [
|
|
2270
|
+
m(w, { variant: "flat" }, {
|
|
2271
|
+
default: F(() => [
|
|
2272
|
+
m(z, {
|
|
2273
|
+
title: i(t)("device.config.logging.title"),
|
|
2274
|
+
class: "p-1"
|
|
2275
|
+
}, null, 8, ["title"]),
|
|
2276
|
+
m(O, { class: "p-1 flex gap-6 flex-col" }, {
|
|
2277
|
+
default: F(() => [
|
|
2278
|
+
m(P, {
|
|
2279
|
+
modelValue: l.value,
|
|
2280
|
+
"onUpdate:modelValue": I[0] || (I[0] = (j) => l.value = j),
|
|
2281
|
+
value: "first",
|
|
2282
|
+
label: i(t)("device.config.logging.enable.label"),
|
|
2283
|
+
sublabel: i(t)("device.config.logging.enable.sublabel"),
|
|
2284
|
+
"label-placement": "right"
|
|
2285
|
+
}, null, 8, ["modelValue", "label", "sublabel"]),
|
|
2286
|
+
m(V, {
|
|
2287
|
+
width: 150,
|
|
2288
|
+
modelValue: c.value,
|
|
2289
|
+
"onUpdate:modelValue": I[1] || (I[1] = (j) => c.value = j),
|
|
2290
|
+
label: i(t)("device.config.logging.logLevel"),
|
|
2291
|
+
items: y.value
|
|
2292
|
+
}, null, 8, ["modelValue", "label", "items"]),
|
|
2293
|
+
m($, {
|
|
2294
|
+
modelValue: p.value,
|
|
2295
|
+
"onUpdate:modelValue": I[2] || (I[2] = (j) => p.value = j),
|
|
2296
|
+
label: i(t)("device.config.logging.ttl.label"),
|
|
2297
|
+
placeholder: "5",
|
|
2298
|
+
step: 1,
|
|
2299
|
+
min: 5,
|
|
2300
|
+
max: 30,
|
|
2301
|
+
rules: [i(be).required(), i(be).number(), i(be).min(5), i(be).max(30)],
|
|
2302
|
+
"append-text": i(t)("device.config.logging.ttl.unit")
|
|
2303
|
+
}, null, 8, ["modelValue", "label", "rules", "append-text"])
|
|
2304
|
+
]),
|
|
2305
|
+
_: 1
|
|
2306
|
+
})
|
|
2307
|
+
]),
|
|
2308
|
+
_: 1
|
|
2309
|
+
}),
|
|
2310
|
+
m(w, { variant: "flat" }, {
|
|
2311
|
+
default: F(() => [
|
|
2312
|
+
m(z, {
|
|
2313
|
+
title: i(t)("device.config.telemetry.title"),
|
|
2314
|
+
class: "p-1"
|
|
2315
|
+
}, null, 8, ["title"]),
|
|
2316
|
+
m(O, { class: "p-1 flex gap-6 flex-col" }, {
|
|
2317
|
+
default: F(() => [
|
|
2318
|
+
m(P, {
|
|
2319
|
+
modelValue: v.value,
|
|
2320
|
+
"onUpdate:modelValue": I[3] || (I[3] = (j) => v.value = j),
|
|
2321
|
+
value: "first",
|
|
2322
|
+
label: i(t)("device.config.telemetry.enable.label"),
|
|
2323
|
+
sublabel: i(t)("device.config.telemetry.enable.sublabel"),
|
|
2324
|
+
"label-placement": "right"
|
|
2325
|
+
}, null, 8, ["modelValue", "label", "sublabel"])
|
|
2326
|
+
]),
|
|
2327
|
+
_: 1
|
|
2328
|
+
})
|
|
2329
|
+
]),
|
|
2330
|
+
_: 1
|
|
2331
|
+
})
|
|
2332
|
+
]),
|
|
2333
|
+
_: 1
|
|
2334
|
+
})
|
|
2335
|
+
]),
|
|
2336
|
+
_: 1
|
|
2337
|
+
}, 8, ["header", "modelValue", "max-width"]);
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2340
|
+
}), Wi = { class: "flex flex-col gap-24 fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Yi = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, Ki = /* @__PURE__ */ Se({
|
|
2341
|
+
__name: "UnbindDeviceDialog",
|
|
2342
|
+
props: {
|
|
2343
|
+
restaurantName: {
|
|
2344
|
+
type: String,
|
|
2345
|
+
required: !0
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
setup(e) {
|
|
2349
|
+
const { t } = Ne(), { emitData: n } = rn(), o = x(), s = Q({
|
|
2350
|
+
get() {
|
|
2351
|
+
return o.value;
|
|
2352
|
+
},
|
|
2353
|
+
set(l) {
|
|
2354
|
+
o.value = l, n(o.value);
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
return (l, c) => {
|
|
2358
|
+
const p = E("FmTextField"), v = E("FmForm");
|
|
2359
|
+
return f(), g("div", Wi, [
|
|
2360
|
+
r("div", null, h(i(t)("device.unbindDevice.unbindConfirmationMessage")), 1),
|
|
2361
|
+
r("div", null, [
|
|
2362
|
+
kt(h(i(t)("device.unbindDevice.confirmationInstructionPart1")) + " ", 1),
|
|
2363
|
+
r("span", Yi, h(e.restaurantName), 1),
|
|
2364
|
+
kt(" " + h(i(t)("device.unbindDevice.confirmationInstructionPart2")), 1)
|
|
2365
|
+
]),
|
|
2366
|
+
m(v, null, {
|
|
2367
|
+
default: F(() => [
|
|
2368
|
+
m(p, {
|
|
2369
|
+
modelValue: s.value,
|
|
2370
|
+
"onUpdate:modelValue": c[0] || (c[0] = (y) => s.value = y),
|
|
2371
|
+
rules: [i(be).required(), i(be).matches(e.restaurantName)],
|
|
2372
|
+
required: ""
|
|
2373
|
+
}, null, 8, ["modelValue", "rules"])
|
|
2374
|
+
]),
|
|
2375
|
+
_: 1
|
|
2376
|
+
})
|
|
2377
|
+
]);
|
|
2378
|
+
};
|
|
2379
|
+
}
|
|
2380
|
+
});
|
|
2381
|
+
function Ft(e) {
|
|
2382
|
+
return e && (e = e.replace(/_/g, " ").toLowerCase(), e.split(" ").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join(" "));
|
|
2383
|
+
}
|
|
2384
|
+
var Xi = {}, ye = {};
|
|
2385
|
+
Object.defineProperty(ye, "__esModule", { value: !0 });
|
|
2386
|
+
ye.F_DISPLAY_NOTIFICATION_TYPE = ye.F_DISPLAY_ACTION_EVENT = ye.F_DISPLAY_SYSTEM_EVENT = void 0;
|
|
2387
|
+
const Lt = Te;
|
|
2388
|
+
ye.F_DISPLAY_SYSTEM_EVENT = Lt.z.enum([
|
|
2389
|
+
"restaurantInfo",
|
|
2390
|
+
"order",
|
|
2391
|
+
"orders",
|
|
2392
|
+
"action",
|
|
2393
|
+
"notification"
|
|
2394
|
+
]);
|
|
2395
|
+
ye.F_DISPLAY_ACTION_EVENT = Lt.z.enum([
|
|
2396
|
+
"Serve",
|
|
2397
|
+
"StartCook",
|
|
2398
|
+
"FinishCook",
|
|
2399
|
+
"Close",
|
|
2400
|
+
"bind",
|
|
2401
|
+
"unbind"
|
|
2402
|
+
]);
|
|
2403
|
+
ye.F_DISPLAY_NOTIFICATION_TYPE = Lt.z.enum([
|
|
2404
|
+
"Information",
|
|
2405
|
+
"Warning",
|
|
2406
|
+
"Error"
|
|
2407
|
+
]);
|
|
2408
|
+
var _t = {}, le = {};
|
|
2409
|
+
Object.defineProperty(le, "__esModule", { value: !0 });
|
|
2410
|
+
le.F_PRINTER_PRINT_CUSTOMIZE = le.F_PAPER_DIRECTION = le.F_PRINTER_TYPE = le.F_PRINTER_CONNECTOR = le.F_STAR_EMULATION_MODE = void 0;
|
|
2411
|
+
const ot = Te;
|
|
2412
|
+
le.F_STAR_EMULATION_MODE = ot.z.enum([
|
|
2413
|
+
"StarPRNT",
|
|
2414
|
+
"StarLine",
|
|
2415
|
+
"StarGraphic"
|
|
2416
|
+
]);
|
|
2417
|
+
le.F_PRINTER_CONNECTOR = ot.z.enum([
|
|
2418
|
+
"IP",
|
|
2419
|
+
"USB",
|
|
2420
|
+
"BLUETOOTH",
|
|
2421
|
+
"STAR"
|
|
2422
|
+
]);
|
|
2423
|
+
le.F_PRINTER_TYPE = ot.z.enum([
|
|
2424
|
+
"ESCPOS",
|
|
2425
|
+
"TSPL",
|
|
2426
|
+
"STAR",
|
|
2427
|
+
"KITCHEN_KDS",
|
|
2428
|
+
"WINDOW_KDS"
|
|
2429
|
+
]);
|
|
2430
|
+
le.F_PAPER_DIRECTION = ot.z.nativeEnum({
|
|
2431
|
+
NORMAL: "0",
|
|
2432
|
+
REVERSE: "1"
|
|
2433
|
+
});
|
|
2434
|
+
le.F_PRINTER_PRINT_CUSTOMIZE = ot.z.enum([
|
|
2435
|
+
"ALL",
|
|
2436
|
+
"ITEMS",
|
|
2437
|
+
"DEPARTMENTS"
|
|
2438
|
+
]);
|
|
2439
|
+
Object.defineProperty(_t, "__esModule", { value: !0 });
|
|
2440
|
+
_t.FdoPrinterInfo = void 0;
|
|
2441
|
+
const C = Te, Zi = ft, dt = le;
|
|
2442
|
+
_t.FdoPrinterInfo = C.z.object({
|
|
2443
|
+
_id: C.z.string(),
|
|
2444
|
+
connector: dt.F_PRINTER_CONNECTOR,
|
|
2445
|
+
type: dt.F_PRINTER_TYPE,
|
|
2446
|
+
emulationMode: dt.F_STAR_EMULATION_MODE.nullish(),
|
|
2447
|
+
machineId: C.z.string().nullish(),
|
|
2448
|
+
billPrintTemplateId: C.z.string(),
|
|
2449
|
+
orderPrintTemplateId: C.z.string(),
|
|
2450
|
+
voidPrintTemplateId: C.z.string(),
|
|
2451
|
+
name: C.z.string(),
|
|
2452
|
+
path: C.z.string(),
|
|
2453
|
+
paperWidth: C.z.number(),
|
|
2454
|
+
paperHeight: C.z.number(),
|
|
2455
|
+
paperGapDistance: C.z.number(),
|
|
2456
|
+
paperGapOffset: C.z.number(),
|
|
2457
|
+
paperXReference: C.z.number(),
|
|
2458
|
+
paperYReference: C.z.number(),
|
|
2459
|
+
paperDirection: C.z.string(),
|
|
2460
|
+
dpi: C.z.number(),
|
|
2461
|
+
splitProduct: C.z.number().nullish(),
|
|
2462
|
+
splitQuantity: C.z.number().nullish(),
|
|
2463
|
+
printBill: C.z.boolean(),
|
|
2464
|
+
printCustomItem: C.z.boolean().nullish(),
|
|
2465
|
+
printDineInItem: C.z.boolean().nullish(),
|
|
2466
|
+
printTakeawayItem: C.z.boolean().nullish(),
|
|
2467
|
+
printChangeTable: C.z.boolean().nullish(),
|
|
2468
|
+
printReport: C.z.boolean(),
|
|
2469
|
+
printOrder: C.z.boolean(),
|
|
2470
|
+
printOrderCombine: C.z.boolean().nullish(),
|
|
2471
|
+
printVoid: C.z.boolean(),
|
|
2472
|
+
strikeThroughItem: C.z.boolean().nullish(),
|
|
2473
|
+
printAllProduct: C.z.boolean(),
|
|
2474
|
+
binded: C.z.boolean().nullish(),
|
|
2475
|
+
backupToUsb: C.z.boolean().nullish(),
|
|
2476
|
+
backupPrinterId: C.z.string(),
|
|
2477
|
+
printCustomize: dt.F_PRINTER_PRINT_CUSTOMIZE.nullish(),
|
|
2478
|
+
printingDepartments: C.z.array(C.z.string()).nullish(),
|
|
2479
|
+
printingProducts: C.z.array(C.z.string()),
|
|
2480
|
+
filterSlot: C.z.array(C.z.string()).nullish(),
|
|
2481
|
+
useInternalName: C.z.boolean().nullish(),
|
|
2482
|
+
beepAfterPrint: C.z.boolean().nullish(),
|
|
2483
|
+
chunkSize: C.z.number().nullish(),
|
|
2484
|
+
chunkDelay: C.z.number().nullish(),
|
|
2485
|
+
maxRetry: C.z.number().nullish(),
|
|
2486
|
+
sleepDelay: C.z.number().nullish(),
|
|
2487
|
+
waitForStatus: C.z.boolean().nullish(),
|
|
2488
|
+
printFinishCook: C.z.boolean().nullish(),
|
|
2489
|
+
isTextEncoding: C.z.boolean().nullish()
|
|
2490
|
+
}).describe(Zi.ZodMeta.couch().repo("printerInfo").build());
|
|
2491
|
+
var gt = {};
|
|
2492
|
+
Object.defineProperty(gt, "__esModule", { value: !0 });
|
|
2493
|
+
gt.FdtoFlatItem = void 0;
|
|
2494
|
+
const tn = ln, Ct = Te;
|
|
2495
|
+
gt.FdtoFlatItem = Ct.z.object({
|
|
2496
|
+
itemKey: Ct.z.string(),
|
|
2497
|
+
item: tn.FdoBillItem,
|
|
2498
|
+
parentKey: Ct.z.string().nullish(),
|
|
2499
|
+
parent: tn.FdoBillItem.nullish()
|
|
2500
|
+
});
|
|
2501
|
+
var de = {};
|
|
2502
|
+
Object.defineProperty(de, "__esModule", { value: !0 });
|
|
2503
|
+
de.F_CELL_WIDTH_TYPE = de.F_TEXT_ALIGN = de.F_WIDGET_ALIGNMENT = de.F_WIDGET_TEMPLATE_TYPE = void 0;
|
|
2504
|
+
const bt = Te;
|
|
2505
|
+
de.F_WIDGET_TEMPLATE_TYPE = bt.z.enum([
|
|
2506
|
+
"TEXT",
|
|
2507
|
+
"CHECKBOX",
|
|
2508
|
+
"DIVIDER",
|
|
2509
|
+
"EMPTY",
|
|
2510
|
+
"IMAGE",
|
|
2511
|
+
"QR"
|
|
2512
|
+
]);
|
|
2513
|
+
de.F_WIDGET_ALIGNMENT = bt.z.enum([
|
|
2514
|
+
"TOP_LEFT",
|
|
2515
|
+
"TOP_CENTER",
|
|
2516
|
+
"TOP_RIGHT",
|
|
2517
|
+
"CENTER_LEFT",
|
|
2518
|
+
"CENTER",
|
|
2519
|
+
"CENTER_RIGHT",
|
|
2520
|
+
"BOTTOM_LEFT",
|
|
2521
|
+
"BOTTOM_CENTER",
|
|
2522
|
+
"BOTTOM_RIGHT"
|
|
2523
|
+
]);
|
|
2524
|
+
de.F_TEXT_ALIGN = bt.z.enum([
|
|
2525
|
+
"LEFT",
|
|
2526
|
+
"CENTER",
|
|
2527
|
+
"RIGHT"
|
|
2528
|
+
]);
|
|
2529
|
+
de.F_CELL_WIDTH_TYPE = bt.z.enum([
|
|
2530
|
+
"FLEX",
|
|
2531
|
+
"FIXED"
|
|
2532
|
+
]);
|
|
2533
|
+
var kn = {};
|
|
2534
|
+
(function(e) {
|
|
2535
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.FdtoTicketItem = e.FdtoTicketSubItem = e.FdtoDisplayOrder = e.FdtoDisplayOrderConfig = e.FdtoDisplayNotification = e.FdtoDisplayAction = void 0;
|
|
2536
|
+
const t = ln, n = Te, o = ye;
|
|
2537
|
+
e.FdtoDisplayAction = n.z.object({
|
|
2538
|
+
type: o.F_DISPLAY_ACTION_EVENT,
|
|
2539
|
+
id: n.z.string(),
|
|
2540
|
+
stationName: n.z.string().nullish(),
|
|
2541
|
+
targetIds: n.z.array(n.z.string()).nullish(),
|
|
2542
|
+
undo: n.z.boolean().nullish(),
|
|
2543
|
+
isoDate: n.z.string().nullish()
|
|
2544
|
+
}), e.FdtoDisplayNotification = n.z.object({
|
|
2545
|
+
type: o.F_DISPLAY_NOTIFICATION_TYPE,
|
|
2546
|
+
id: n.z.string(),
|
|
2547
|
+
title: n.z.string().nullish(),
|
|
2548
|
+
header: n.z.string().nullish(),
|
|
2549
|
+
message: n.z.string().nullish(),
|
|
2550
|
+
billId: n.z.string().nullish(),
|
|
2551
|
+
requireAcknowledge: n.z.boolean().nullish()
|
|
2552
|
+
}), e.FdtoDisplayOrderConfig = n.z.object({
|
|
2553
|
+
removeIfExist: n.z.boolean()
|
|
2554
|
+
}), e.FdtoDisplayOrder = n.z.object({
|
|
2555
|
+
config: e.FdtoDisplayOrderConfig,
|
|
2556
|
+
bill: t.FdoBill
|
|
2557
|
+
});
|
|
2558
|
+
const s = n.z.object({
|
|
2559
|
+
id: n.z.string(),
|
|
2560
|
+
label: n.z.string()
|
|
2561
|
+
});
|
|
2562
|
+
e.FdtoTicketSubItem = s.extend({
|
|
2563
|
+
subItems: n.z.array(n.z.lazy(() => e.FdtoTicketSubItem)).optional()
|
|
2564
|
+
}), e.FdtoTicketItem = n.z.object({
|
|
2565
|
+
productId: n.z.string(),
|
|
2566
|
+
itemKey: n.z.string(),
|
|
2567
|
+
subItemKeys: n.z.array(n.z.string()),
|
|
2568
|
+
status: n.z.string(),
|
|
2569
|
+
label: n.z.string(),
|
|
2570
|
+
code: n.z.string(),
|
|
2571
|
+
quantity: n.z.number(),
|
|
2572
|
+
remark: n.z.string(),
|
|
2573
|
+
currency: n.z.string().nullish(),
|
|
2574
|
+
sentAt: n.z.string().nullish(),
|
|
2575
|
+
sentBy: n.z.string().nullish(),
|
|
2576
|
+
startAt: n.z.string().nullish(),
|
|
2577
|
+
finishAt: n.z.string().nullish(),
|
|
2578
|
+
stationFinishAt: n.z.string().nullish(),
|
|
2579
|
+
completedAt: n.z.string().nullish(),
|
|
2580
|
+
servedAt: n.z.string().nullish(),
|
|
2581
|
+
voidReason: n.z.string().nullish(),
|
|
2582
|
+
subItems: n.z.array(e.FdtoTicketSubItem).nullish()
|
|
2583
|
+
});
|
|
2584
|
+
})(kn);
|
|
2585
|
+
var yt = {};
|
|
2586
|
+
(function(e) {
|
|
2587
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.FdoEditorGroup = e.FdoAdvanceEditorRow = e.FdoAdvanceEditorColumn = e.FdoFixedCellWidth = e.FdoFlexCellWidth = e.FdoBaseCellWidth = e.FdoEditorConfig = e.FdoQrEditorConfig = e.FdoImageEditorConfig = e.FdoCheckboxEditorConfig = e.FdoDividerEditorConfig = e.FdoTextEditorConfig = e.FdoEmptyEditorConfig = e.FdoBaseEditorConfig = e.FdoCellEdgeInset = void 0;
|
|
2588
|
+
const t = ft, n = Te, o = de;
|
|
2589
|
+
e.FdoCellEdgeInset = n.z.object({
|
|
2590
|
+
top: n.z.number(),
|
|
2591
|
+
right: n.z.number(),
|
|
2592
|
+
bottom: n.z.number(),
|
|
2593
|
+
left: n.z.number()
|
|
2594
|
+
}), e.FdoBaseEditorConfig = n.z.object({
|
|
2595
|
+
type: o.F_WIDGET_TEMPLATE_TYPE,
|
|
2596
|
+
alignment: o.F_WIDGET_ALIGNMENT,
|
|
2597
|
+
padding: e.FdoCellEdgeInset,
|
|
2598
|
+
height: n.z.number().nullish()
|
|
2599
|
+
}).describe(t.ZodMeta.dart().baseUnion({
|
|
2600
|
+
isBaseUnion: !0,
|
|
2601
|
+
unionKey: "type",
|
|
2602
|
+
baseType: "FdoBaseEditorConfig"
|
|
2603
|
+
}).build()), e.FdoEmptyEditorConfig = e.FdoBaseEditorConfig.extend({
|
|
2604
|
+
type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.EMPTY)
|
|
2605
|
+
}), e.FdoTextEditorConfig = e.FdoBaseEditorConfig.extend({
|
|
2606
|
+
type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.TEXT),
|
|
2607
|
+
textAlign: o.F_TEXT_ALIGN,
|
|
2608
|
+
value: n.z.string(),
|
|
2609
|
+
factor: n.z.number(),
|
|
2610
|
+
isBold: n.z.boolean(),
|
|
2611
|
+
isItalic: n.z.boolean(),
|
|
2612
|
+
isUnderline: n.z.boolean(),
|
|
2613
|
+
isStrikeThrough: n.z.boolean().nullish()
|
|
2614
|
+
}), e.FdoDividerEditorConfig = e.FdoBaseEditorConfig.extend({
|
|
2615
|
+
type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.DIVIDER),
|
|
2616
|
+
spacing: n.z.number(),
|
|
2617
|
+
thickness: n.z.number()
|
|
2618
|
+
}), e.FdoCheckboxEditorConfig = e.FdoBaseEditorConfig.extend({
|
|
2619
|
+
type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.CHECKBOX),
|
|
2620
|
+
size: n.z.number(),
|
|
2621
|
+
height: n.z.number().nullish()
|
|
2622
|
+
}), e.FdoImageEditorConfig = e.FdoBaseEditorConfig.extend({
|
|
2623
|
+
type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.IMAGE),
|
|
2624
|
+
width: n.z.number().nullish(),
|
|
2625
|
+
height: n.z.number().nullish(),
|
|
2626
|
+
imgData: n.z.string()
|
|
2627
|
+
}), e.FdoQrEditorConfig = e.FdoBaseEditorConfig.extend({
|
|
2628
|
+
type: n.z.literal(o.F_WIDGET_TEMPLATE_TYPE.enum.QR),
|
|
2629
|
+
size: n.z.number(),
|
|
2630
|
+
link: n.z.string()
|
|
2631
|
+
}), e.FdoEditorConfig = n.z.object({
|
|
2632
|
+
data: n.z.discriminatedUnion("type", [
|
|
2633
|
+
e.FdoEmptyEditorConfig,
|
|
2634
|
+
e.FdoTextEditorConfig,
|
|
2635
|
+
e.FdoDividerEditorConfig,
|
|
2636
|
+
e.FdoCheckboxEditorConfig,
|
|
2637
|
+
e.FdoImageEditorConfig,
|
|
2638
|
+
e.FdoQrEditorConfig
|
|
2639
|
+
]).describe(t.ZodMeta.dart().discriminatedUnion({ baseType: "FdoBaseEditorConfig" }).build())
|
|
2640
|
+
}), e.FdoBaseCellWidth = n.z.object({
|
|
2641
|
+
type: o.F_CELL_WIDTH_TYPE
|
|
2642
|
+
}).describe(t.ZodMeta.dart().baseUnion({
|
|
2643
|
+
isBaseUnion: !0,
|
|
2644
|
+
unionKey: "type",
|
|
2645
|
+
baseType: "FdoBaseCellWidth"
|
|
2646
|
+
}).build()), e.FdoFlexCellWidth = e.FdoBaseCellWidth.extend({
|
|
2647
|
+
type: n.z.literal(o.F_CELL_WIDTH_TYPE.enum.FLEX),
|
|
2648
|
+
value: n.z.number()
|
|
2649
|
+
}), e.FdoFixedCellWidth = e.FdoBaseCellWidth.extend({
|
|
2650
|
+
type: n.z.literal(o.F_CELL_WIDTH_TYPE.enum.FIXED),
|
|
2651
|
+
value: n.z.number()
|
|
2652
|
+
}), e.FdoAdvanceEditorColumn = n.z.object({
|
|
2653
|
+
cells: n.z.array(e.FdoEditorConfig),
|
|
2654
|
+
width: n.z.discriminatedUnion("type", [e.FdoFixedCellWidth, e.FdoFlexCellWidth]).describe(t.ZodMeta.dart().discriminatedUnion({ baseType: "FdoBaseCellWidth" }).build()).nullish()
|
|
2655
|
+
}), e.FdoAdvanceEditorRow = n.z.object({
|
|
2656
|
+
columns: n.z.array(e.FdoAdvanceEditorColumn)
|
|
2657
|
+
}), e.FdoEditorGroup = n.z.object({
|
|
2658
|
+
rows: n.z.array(e.FdoAdvanceEditorRow)
|
|
2659
|
+
});
|
|
2660
|
+
})(yt);
|
|
2661
|
+
var Rn = {};
|
|
2662
|
+
(function(e) {
|
|
2663
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.FdoOrderTemplateV4 = e.FdoOrderTemplateData = void 0;
|
|
2664
|
+
const t = ft, n = Te, o = yt;
|
|
2665
|
+
e.FdoOrderTemplateData = n.z.object({
|
|
2666
|
+
header: o.FdoEditorGroup,
|
|
2667
|
+
body: o.FdoEditorGroup,
|
|
2668
|
+
footer: o.FdoEditorGroup
|
|
2669
|
+
}), e.FdoOrderTemplateV4 = n.z.object({
|
|
2670
|
+
template: e.FdoOrderTemplateData,
|
|
2671
|
+
fmDefaultVersion: n.z.number().nullish(),
|
|
2672
|
+
_id: n.z.string(),
|
|
2673
|
+
name: n.z.string(),
|
|
2674
|
+
fontSize: n.z.number(),
|
|
2675
|
+
stickerMode: n.z.boolean().nullish()
|
|
2676
|
+
}).describe(t.ZodMeta.couch().repo("printTemplateV4").build());
|
|
2677
|
+
})(Rn);
|
|
2678
|
+
var Dn = {};
|
|
2679
|
+
(function(e) {
|
|
2680
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.FdoReceiptTemplate = e.FdoTemplateSection = e.F_RECEIPT_SECTION = e.FdoReceiptInfo = void 0;
|
|
2681
|
+
const t = ft, n = Te, o = yt;
|
|
2682
|
+
e.FdoReceiptInfo = n.z.object({
|
|
2683
|
+
_id: n.z.string(),
|
|
2684
|
+
imgData: n.z.string(),
|
|
2685
|
+
headerText: n.z.string(),
|
|
2686
|
+
needAddress: n.z.boolean(),
|
|
2687
|
+
needPhoneNo: n.z.boolean(),
|
|
2688
|
+
needEmail: n.z.boolean(),
|
|
2689
|
+
invoicePrefix: n.z.string().nullish(),
|
|
2690
|
+
footerText: n.z.string(),
|
|
2691
|
+
footerQr: n.z.string().nullish(),
|
|
2692
|
+
fontSize: n.z.number().nullish(),
|
|
2693
|
+
hideZeroPriceAddon: n.z.boolean().nullish(),
|
|
2694
|
+
hideZeroPriceItem: n.z.boolean().nullish(),
|
|
2695
|
+
hideProductCode: n.z.boolean().nullish(),
|
|
2696
|
+
imgHeight: n.z.number().nullish(),
|
|
2697
|
+
imgWidth: n.z.number().nullish()
|
|
2698
|
+
}).describe(t.ZodMeta.couch().repo("receiptInfo").isSingleDoc().build()), e.F_RECEIPT_SECTION = n.z.enum([
|
|
2699
|
+
"GENERAL",
|
|
2700
|
+
"ITEM",
|
|
2701
|
+
"CALCULATION",
|
|
2702
|
+
"PAYMENT"
|
|
2703
|
+
]), e.FdoTemplateSection = n.z.object({
|
|
2704
|
+
name: n.z.string(),
|
|
2705
|
+
type: e.F_RECEIPT_SECTION,
|
|
2706
|
+
group: o.FdoEditorGroup
|
|
2707
|
+
}), e.FdoReceiptTemplate = n.z.object({
|
|
2708
|
+
_id: n.z.string(),
|
|
2709
|
+
name: n.z.string(),
|
|
2710
|
+
fontSize: n.z.number(),
|
|
2711
|
+
template: n.z.array(e.FdoTemplateSection)
|
|
2712
|
+
}).describe(t.ZodMeta.couch().repo("receiptTemplate").build());
|
|
2713
|
+
})(Dn);
|
|
2714
|
+
(function(e) {
|
|
2715
|
+
var t = rt && rt.__createBinding || (Object.create ? function(o, s, l, c) {
|
|
2716
|
+
c === void 0 && (c = l);
|
|
2717
|
+
var p = Object.getOwnPropertyDescriptor(s, l);
|
|
2718
|
+
(!p || ("get" in p ? !s.__esModule : p.writable || p.configurable)) && (p = { enumerable: !0, get: function() {
|
|
2719
|
+
return s[l];
|
|
2720
|
+
} }), Object.defineProperty(o, c, p);
|
|
2721
|
+
} : function(o, s, l, c) {
|
|
2722
|
+
c === void 0 && (c = l), o[c] = s[l];
|
|
2723
|
+
}), n = rt && rt.__exportStar || function(o, s) {
|
|
2724
|
+
for (var l in o)
|
|
2725
|
+
l !== "default" && !Object.prototype.hasOwnProperty.call(s, l) && t(s, o, l);
|
|
2726
|
+
};
|
|
2727
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), n(ye, e), n(_t, e), n(gt, e), n(le, e), n(de, e), n(kn, e), n(yt, e), n(Rn, e), n(Dn, e);
|
|
2728
|
+
})(Xi);
|
|
2729
|
+
const Qi = { class: "fm-typo-en-body-md-400" }, Ji = { class: "xs:flex-col-reverse flex items-center justify-end gap-8 sm:flex-col-reverse" }, ea = /* @__PURE__ */ Se({
|
|
2730
|
+
__name: "CreateDeviceDialog",
|
|
2731
|
+
setup(e) {
|
|
2732
|
+
const { t } = Ne(), n = ht(), o = Q(
|
|
2733
|
+
() => n.restaurants.value.map((O) => ({
|
|
2734
|
+
label: O.profile.name,
|
|
2735
|
+
value: O._id
|
|
2736
|
+
})).sort((O, w) => O.label.toLowerCase().localeCompare(w.label.toLowerCase()))
|
|
2737
|
+
), s = x([]), l = async () => {
|
|
2738
|
+
p.value && (s.value = await ne.getPrinters(p.value), R.value = []);
|
|
2739
|
+
}, c = Q(
|
|
2740
|
+
() => s.value.map((O) => ({
|
|
2741
|
+
label: O.name,
|
|
2742
|
+
value: O._id
|
|
2743
|
+
}))
|
|
2744
|
+
), p = x(o.value.length === 1 ? o.value[0].value : ""), v = x(""), y = x(Z.Enum.COUNTER), R = x([]), { emitData: A } = rn(), N = Q(() => ({
|
|
2745
|
+
restaurantId: p.value,
|
|
2746
|
+
name: v.value,
|
|
2747
|
+
type: y.value,
|
|
2748
|
+
printers: R.value
|
|
2749
|
+
}));
|
|
2750
|
+
$e(
|
|
2751
|
+
[p, v, y, R],
|
|
2752
|
+
() => {
|
|
2753
|
+
A(N.value);
|
|
2754
|
+
},
|
|
2755
|
+
{ deep: !0 }
|
|
2756
|
+
);
|
|
2757
|
+
const b = x();
|
|
2758
|
+
function I(O) {
|
|
2759
|
+
R.value = O ? c.value.map((w) => w.value) : [];
|
|
2760
|
+
}
|
|
2761
|
+
const z = nt(), P = cn(), { getUserFlagValue: V } = Bn(), $ = async () => {
|
|
2762
|
+
try {
|
|
2763
|
+
const O = (await ne.getDevices(p.value)).filter((G) => G.type != Z.Enum.MAIN), w = await V(p.value, Cn.licensePosCreateSubPos, 3);
|
|
2764
|
+
if (w && O.length >= w) {
|
|
2765
|
+
z.open({
|
|
2766
|
+
message: t("device.status.creation.limitError", { limit: w }),
|
|
2767
|
+
type: "error",
|
|
2768
|
+
position: ee.BOTTOM
|
|
2769
|
+
});
|
|
2770
|
+
return;
|
|
2771
|
+
}
|
|
2772
|
+
await ne.createSubDevice(N.value).then(() => {
|
|
2773
|
+
z.open({
|
|
2774
|
+
message: t("device.status.creation.success", { name: N.value.name }),
|
|
2775
|
+
type: "success",
|
|
2776
|
+
position: ee.BOTTOM
|
|
2777
|
+
});
|
|
2778
|
+
});
|
|
2779
|
+
} catch (O) {
|
|
2780
|
+
z.open({
|
|
2781
|
+
message: t("device.status.creation.error", { error: O }),
|
|
2782
|
+
type: "error",
|
|
2783
|
+
position: ee.BOTTOM
|
|
2784
|
+
});
|
|
2785
|
+
} finally {
|
|
2786
|
+
P.close();
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2789
|
+
return $e(R, (O) => {
|
|
2790
|
+
b.value = O.length === c.value.length;
|
|
2791
|
+
}), $e(p, l), (O, w) => {
|
|
2792
|
+
const G = E("FmSelect"), J = E("FmTextField"), ae = E("FmCheckbox"), j = E("FmSpacer"), oe = E("FmButton"), W = E("FmForm");
|
|
2793
|
+
return f(), M(W, {
|
|
2794
|
+
onValidationSuccess: $,
|
|
2795
|
+
class: "flex flex-col gap-5 py-2"
|
|
2796
|
+
}, {
|
|
2797
|
+
default: F(() => [
|
|
2798
|
+
m(G, {
|
|
2799
|
+
modelValue: p.value,
|
|
2800
|
+
"onUpdate:modelValue": w[0] || (w[0] = (B) => p.value = B),
|
|
2801
|
+
label: i(t)("device.creation.fields.restaurant.label"),
|
|
2802
|
+
items: o.value,
|
|
2803
|
+
placeholder: i(t)("device.creation.fields.restaurant.label"),
|
|
2804
|
+
rules: [i(be).required()]
|
|
2805
|
+
}, null, 8, ["modelValue", "label", "items", "placeholder", "rules"]),
|
|
2806
|
+
m(J, {
|
|
2807
|
+
modelValue: v.value,
|
|
2808
|
+
"onUpdate:modelValue": w[1] || (w[1] = (B) => v.value = B),
|
|
2809
|
+
label: i(t)("device.creation.fields.name.label"),
|
|
2810
|
+
placeholder: i(t)("device.creation.fields.name.placeholder"),
|
|
2811
|
+
rules: [i(be).nonEmpty()]
|
|
2812
|
+
}, null, 8, ["modelValue", "label", "placeholder", "rules"]),
|
|
2813
|
+
m(G, {
|
|
2814
|
+
modelValue: y.value,
|
|
2815
|
+
"onUpdate:modelValue": w[2] || (w[2] = (B) => y.value = B),
|
|
2816
|
+
items: [
|
|
2817
|
+
{
|
|
2818
|
+
label: i(t)("device.creation.fields.type.options.counter"),
|
|
2819
|
+
value: i(Z).Enum.COUNTER
|
|
2820
|
+
},
|
|
2821
|
+
{
|
|
2822
|
+
label: i(t)("device.creation.fields.type.options.orderStation"),
|
|
2823
|
+
value: i(Z).Enum.ORDER_STATION
|
|
2824
|
+
}
|
|
2825
|
+
],
|
|
2826
|
+
label: i(t)("device.creation.fields.type.label"),
|
|
2827
|
+
placeholder: i(t)("device.creation.fields.type.placeholder"),
|
|
2828
|
+
rules: [i(be).required()]
|
|
2829
|
+
}, null, 8, ["modelValue", "items", "label", "placeholder", "rules"]),
|
|
2830
|
+
p.value && c.value.length ? (f(), M(G, {
|
|
2831
|
+
key: 0,
|
|
2832
|
+
multiselect: "",
|
|
2833
|
+
modelValue: R.value,
|
|
2834
|
+
"onUpdate:modelValue": w[4] || (w[4] = (B) => R.value = B),
|
|
2835
|
+
items: c.value,
|
|
2836
|
+
label: i(t)("device.creation.fields.printer.label"),
|
|
2837
|
+
placeholder: i(t)("device.creation.fields.printer.placeholder")
|
|
2838
|
+
}, {
|
|
2839
|
+
"prepend-menu": F(() => [
|
|
2840
|
+
m(ae, {
|
|
2841
|
+
class: "ml-1",
|
|
2842
|
+
indeterminate: R.value.length > 0,
|
|
2843
|
+
"model-value": b.value,
|
|
2844
|
+
"onUpdate:modelValue": w[3] || (w[3] = (B) => I(B)),
|
|
2845
|
+
label: " ",
|
|
2846
|
+
value: !0
|
|
2847
|
+
}, {
|
|
2848
|
+
label: F(() => [
|
|
2849
|
+
r("div", Qi, h(i(t)("device.filters.all")), 1)
|
|
2850
|
+
]),
|
|
2851
|
+
_: 1
|
|
2852
|
+
}, 8, ["indeterminate", "model-value"])
|
|
2853
|
+
]),
|
|
2854
|
+
_: 1
|
|
2855
|
+
}, 8, ["modelValue", "items", "label", "placeholder"])) : k("", !0),
|
|
2856
|
+
r("div", Ji, [
|
|
2857
|
+
m(j, { class: "xs:hidden sm:hidden" }),
|
|
2858
|
+
m(oe, {
|
|
2859
|
+
class: "xs:w-full sm:w-full",
|
|
2860
|
+
variant: "secondary",
|
|
2861
|
+
label: i(t)("device.actions.cancel"),
|
|
2862
|
+
size: "md",
|
|
2863
|
+
onClick: w[5] || (w[5] = (B) => i(P).close())
|
|
2864
|
+
}, null, 8, ["label"]),
|
|
2865
|
+
m(oe, {
|
|
2866
|
+
class: "xs:w-full sm:w-full",
|
|
2867
|
+
variant: "primary",
|
|
2868
|
+
label: i(t)("device.actions.create"),
|
|
2869
|
+
size: "md",
|
|
2870
|
+
type: "submit"
|
|
2871
|
+
}, null, 8, ["label"])
|
|
2872
|
+
])
|
|
2873
|
+
]),
|
|
2874
|
+
_: 1
|
|
2875
|
+
});
|
|
2876
|
+
};
|
|
2877
|
+
}
|
|
2878
|
+
}), ta = { class: "flex flex-col p-5 bg-white gap-5" }, na = { class: "flex items-center" }, oa = { class: "fm-typo-en-title-md-600" }, sa = {
|
|
2879
|
+
key: 0,
|
|
2880
|
+
class: "flex gap-8"
|
|
2881
|
+
}, ia = { class: "flex gap-4 pb-5" }, aa = { key: 0 }, la = { class: "flex flex-col gap-1 overflow-y-auto h-full" }, ra = { class: "flex w-full justify-between" }, ca = { class: "w-full" }, ua = { class: "max-w-[250px]" }, da = { class: "max-h-[310px] overflow-y-auto" }, ma = { class: "w-full" }, pa = { class: "w-[200px]" }, fa = { class: "grow flex flex-col gap-8" }, ha = { class: "flex flex-row gap-4 flex-wrap items-center" }, va = { class: "fm-typo-en-body-lg-600" }, _a = { key: 0 }, ga = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ba = {
|
|
2882
|
+
key: 0,
|
|
2883
|
+
class: "flex gap-8"
|
|
2884
|
+
}, ya = {
|
|
2885
|
+
key: 0,
|
|
2886
|
+
class: "flex items-center"
|
|
2887
|
+
}, Ta = { class: "flex flex-row gap-4" }, Ia = {
|
|
2888
|
+
key: 3,
|
|
2889
|
+
class: "fixed bottom-72 right-16"
|
|
2890
|
+
}, Ra = /* @__PURE__ */ Se({
|
|
2891
|
+
__name: "DeviceList",
|
|
2892
|
+
setup(e) {
|
|
2893
|
+
const { t } = Ne(), { isAtMost: n } = Ot(), o = ht(), s = an(), l = cn(), c = nt(), p = Q(() => {
|
|
2894
|
+
var a;
|
|
2895
|
+
return (a = o.restaurants.value) == null ? void 0 : a.filter((u) => u.managable);
|
|
2896
|
+
}), v = Q(() => s.getCustomerDisplayImages()), y = x(!1), R = x([]), A = x([]), N = x([]), b = x(""), I = x(!0), z = async () => {
|
|
2897
|
+
var a;
|
|
2898
|
+
try {
|
|
2899
|
+
const u = await ne.getDevicesFromRestaurants();
|
|
2900
|
+
R.value = u.map((_) => ({
|
|
2901
|
+
..._,
|
|
2902
|
+
type: _.type ?? "UNASSIGNED",
|
|
2903
|
+
restaurantName: je(_.restaurantId),
|
|
2904
|
+
images: _.type === Z.Enum.MAIN ? Ee(_.restaurantId) : []
|
|
2905
|
+
})), A.value = (a = p.value) == null ? void 0 : a.map((_) => _._id), N.value = O.value.map((_) => _.value);
|
|
2906
|
+
} catch (u) {
|
|
2907
|
+
console.error("Failed to get restaurants devices:", u);
|
|
2908
|
+
}
|
|
2909
|
+
}, P = (a, u) => a.type === Z.Enum.MAIN ? -1 : u.type === Z.Enum.MAIN ? 1 : a.type.toLowerCase() !== u.type.toLowerCase() ? a.type.toLowerCase() > u.type.toLowerCase() ? 1 : -1 : a.createdAt && u.createdAt ? a.createdAt < u.createdAt ? 1 : -1 : 0, V = Q(() => {
|
|
2910
|
+
if (I.value)
|
|
2911
|
+
return [];
|
|
2912
|
+
const a = b.value.toLowerCase(), u = R.value.filter((_) => {
|
|
2913
|
+
const U = A.value.includes(_.restaurantId), fe = N.value.includes(_.type);
|
|
2914
|
+
return U && fe;
|
|
2915
|
+
});
|
|
2916
|
+
return a ? u.filter(
|
|
2917
|
+
(_) => JSON.stringify({ ..._ }).toLowerCase().includes(a)
|
|
2918
|
+
).sort(P) : u.sort(P);
|
|
2919
|
+
}), $ = Q(
|
|
2920
|
+
() => p.value.map((a) => ({
|
|
2921
|
+
label: a.profile.name,
|
|
2922
|
+
value: a._id
|
|
2923
|
+
}))
|
|
2924
|
+
), O = Q(
|
|
2925
|
+
() => R.value.map((a) => ({
|
|
2926
|
+
label: a.type ? Ft(a.type) : a.type,
|
|
2927
|
+
value: a.type
|
|
2928
|
+
})).filter((a, u) => u === R.value.findIndex((_) => a.value === _.type))
|
|
2929
|
+
), w = (a, u) => {
|
|
2930
|
+
const _ = a.indexOf(u.value);
|
|
2931
|
+
_ === -1 ? a.push(u.value) : a.splice(_, 1);
|
|
2932
|
+
}, G = (a, u) => {
|
|
2933
|
+
a.splice(0, a.length, ...a.length ? [] : u.map((_) => _.value));
|
|
2934
|
+
}, J = (a, u, _) => {
|
|
2935
|
+
var U;
|
|
2936
|
+
return a.length === 0 ? "" : a.length === u.length ? `${_}: ${t("device.filters.all")}` : a.length === 1 && !n("sm") ? (U = u.find((fe) => fe.value === a[0])) == null ? void 0 : U.label : t("device.filters.selected", { count: a.length });
|
|
2937
|
+
}, ae = (a) => {
|
|
2938
|
+
if (!a.restaurantId)
|
|
2939
|
+
return;
|
|
2940
|
+
const _ = `https://grafana.feedme.farm/d/ee5tjb68adwjkb/pos-dashboard-quickwit?orgId=1&var-maxRows=1000&var-severity=All&var-env=dev&var-country=All&var-restaurantId=${a.restaurantId}`;
|
|
2941
|
+
c.open({
|
|
2942
|
+
message: t("device.logs.redirect", { name: a.name ?? je(a.restaurantId) }),
|
|
2943
|
+
type: "success",
|
|
2944
|
+
position: ee.BOTTOM
|
|
2945
|
+
}), setTimeout(() => window.open(_, "_blank"), 500);
|
|
2946
|
+
}, j = async (a) => {
|
|
2947
|
+
a.machineId && await ne.checkDeviceStatus(a.machineId).then(() => {
|
|
2948
|
+
l.open({
|
|
2949
|
+
title: "Download Logs",
|
|
2950
|
+
contentComponent: $i,
|
|
2951
|
+
contentComponentProps: {
|
|
2952
|
+
machineId: a.machineId
|
|
2953
|
+
}
|
|
2954
|
+
});
|
|
2955
|
+
}).catch((u) => {
|
|
2956
|
+
c.open({
|
|
2957
|
+
message: `${u}`,
|
|
2958
|
+
type: "error",
|
|
2959
|
+
position: ee.BOTTOM
|
|
2960
|
+
});
|
|
2961
|
+
});
|
|
2962
|
+
}, oe = (a) => {
|
|
2963
|
+
a.restaurantId && l.open({
|
|
2964
|
+
title: t("device.actions.unbindDevice"),
|
|
2965
|
+
contentComponent: Ki,
|
|
2966
|
+
contentComponentProps: {
|
|
2967
|
+
restaurantName: a.restaurantName
|
|
2968
|
+
},
|
|
2969
|
+
primaryActions: { text: t("device.actions.unbind"), close: !1, variant: "destructive" },
|
|
2970
|
+
secondaryActions: { text: t("device.actions.cancel"), close: !0 }
|
|
2971
|
+
}).onPrimary(async (u) => {
|
|
2972
|
+
u != a.restaurantName || !a.restaurantId || (await ne.unbindDevice(a.restaurantId).catch(async (_) => {
|
|
2973
|
+
if (_ === "Restaurant has no machine" && a.machineId)
|
|
2974
|
+
await ne.mdmUnbindDevice(a.machineId);
|
|
2975
|
+
else
|
|
2976
|
+
throw _;
|
|
2977
|
+
}).then(async () => {
|
|
2978
|
+
await me(), c.open({
|
|
2979
|
+
message: t("device.status.unbind.success", { name: u }),
|
|
2980
|
+
type: "success",
|
|
2981
|
+
position: ee.BOTTOM
|
|
2982
|
+
});
|
|
2983
|
+
}).catch((_) => {
|
|
2984
|
+
c.open({
|
|
2985
|
+
message: t("device.error.general", { error: _ }),
|
|
2986
|
+
type: "error",
|
|
2987
|
+
position: ee.BOTTOM
|
|
2988
|
+
});
|
|
2989
|
+
}), l.close());
|
|
2990
|
+
});
|
|
2991
|
+
}, W = x(""), B = async (a) => {
|
|
2992
|
+
W.value = "";
|
|
2993
|
+
const u = await ne.generateDeviceOtp(a);
|
|
2994
|
+
W.value = u.machineOtp ?? "";
|
|
2995
|
+
}, Re = async (a) => {
|
|
2996
|
+
a.restaurantId && await B(a.restaurantId).then(() => {
|
|
2997
|
+
l.open({
|
|
2998
|
+
title: t("device.actions.bindDevice"),
|
|
2999
|
+
contentComponent: Gn,
|
|
3000
|
+
contentComponentProps: {
|
|
3001
|
+
restaurantId: a.restaurantId,
|
|
3002
|
+
get otp() {
|
|
3003
|
+
return W.value;
|
|
3004
|
+
},
|
|
3005
|
+
"onUpdate:otp"(u) {
|
|
3006
|
+
W.value = u;
|
|
3007
|
+
}
|
|
3008
|
+
},
|
|
3009
|
+
primaryActions: { text: t("device.actions.regenerate"), close: !1 },
|
|
3010
|
+
secondaryActions: { text: t("device.actions.cancel"), close: !0 }
|
|
3011
|
+
}).onPrimary(async () => {
|
|
3012
|
+
a.restaurantId && await B(a.restaurantId);
|
|
3013
|
+
}).onClose(async () => {
|
|
3014
|
+
await me();
|
|
3015
|
+
let u = R.value.find(
|
|
3016
|
+
(_) => _.restaurantId === a.restaurantId && _.type === Z.Enum.MAIN && _.machineId
|
|
3017
|
+
);
|
|
3018
|
+
u && u.restaurantId && c.open({
|
|
3019
|
+
message: t("device.status.bind.success", { name: a.restaurantName }),
|
|
3020
|
+
type: "success",
|
|
3021
|
+
position: ee.BOTTOM
|
|
3022
|
+
});
|
|
3023
|
+
});
|
|
3024
|
+
}).catch((u) => {
|
|
3025
|
+
c.open({
|
|
3026
|
+
message: t("device.error.general", { error: u }),
|
|
3027
|
+
type: "error",
|
|
3028
|
+
position: ee.BOTTOM
|
|
3029
|
+
});
|
|
3030
|
+
});
|
|
3031
|
+
}, st = () => {
|
|
3032
|
+
l.open({
|
|
3033
|
+
title: t("device.actions.forceSync"),
|
|
3034
|
+
message: t("device.status.sync.confirmation"),
|
|
3035
|
+
primaryActions: { text: t("device.actions.confirm"), close: !0, variant: "destructive" },
|
|
3036
|
+
secondaryActions: { text: t("device.actions.cancel"), close: !0 }
|
|
3037
|
+
}).onPrimary(async () => {
|
|
3038
|
+
l.close();
|
|
3039
|
+
const a = c.open({
|
|
3040
|
+
message: t("device.status.sync.inProgress"),
|
|
3041
|
+
spinner: !0,
|
|
3042
|
+
type: "info",
|
|
3043
|
+
position: ee.BOTTOM
|
|
3044
|
+
});
|
|
3045
|
+
await ne.forceSync().then(async () => {
|
|
3046
|
+
await me(), setTimeout(() => {
|
|
3047
|
+
c.updateSnackbar(a, {
|
|
3048
|
+
message: t("device.status.sync.success"),
|
|
3049
|
+
spinner: !1,
|
|
3050
|
+
type: "success",
|
|
3051
|
+
position: ee.BOTTOM
|
|
3052
|
+
});
|
|
3053
|
+
}, 500);
|
|
3054
|
+
}).catch((u) => {
|
|
3055
|
+
c.updateSnackbar(a, {
|
|
3056
|
+
message: t("device.status.sync.error", { error: u }),
|
|
3057
|
+
spinner: !1,
|
|
3058
|
+
type: "error",
|
|
3059
|
+
position: ee.BOTTOM
|
|
3060
|
+
});
|
|
3061
|
+
});
|
|
3062
|
+
});
|
|
3063
|
+
}, je = (a) => {
|
|
3064
|
+
var u, _;
|
|
3065
|
+
return (_ = (u = p.value) == null ? void 0 : u.find((U) => U._id === a)) == null ? void 0 : _.profile.name;
|
|
3066
|
+
}, Ie = (a) => new Date(a).toLocaleDateString("en-GB", {
|
|
3067
|
+
day: "2-digit",
|
|
3068
|
+
month: "short",
|
|
3069
|
+
year: "numeric",
|
|
3070
|
+
hour: "2-digit",
|
|
3071
|
+
minute: "2-digit",
|
|
3072
|
+
hour12: !0
|
|
3073
|
+
}).toUpperCase().split(","), Ee = (a) => v.value.filter((u) => u.restaurantIds.includes(a)).map((u) => u.url), d = (a) => a.slice(0, 3), S = (a) => {
|
|
3074
|
+
const u = [
|
|
3075
|
+
{ label: t("device.menu.logs"), value: "logs", onClick: () => ae(a) },
|
|
3076
|
+
{ label: "Download logs", value: "download_logs", onClick: () => j(a) }
|
|
3077
|
+
];
|
|
3078
|
+
return a.deviceId && u.push({
|
|
3079
|
+
label: t("device.menu.configurations"),
|
|
3080
|
+
value: "configurations",
|
|
3081
|
+
onClick: () => {
|
|
3082
|
+
De.value = a, pe.value = !0;
|
|
3083
|
+
}
|
|
3084
|
+
}), u;
|
|
3085
|
+
}, Y = [
|
|
3086
|
+
{
|
|
3087
|
+
id: "deviceName",
|
|
3088
|
+
accessorKey: "name",
|
|
3089
|
+
header: () => t("device.table.columns.deviceName"),
|
|
3090
|
+
cell: (a) => {
|
|
3091
|
+
let u = a.row.original, _ = u.name;
|
|
3092
|
+
return a.row.original.type === Z.Enum.MAIN && (_ = u.restaurantName), X("div", { class: "text-ellipsis overflow-hidden text-balance" }, _ ?? "-");
|
|
3093
|
+
},
|
|
3094
|
+
meta: {
|
|
3095
|
+
width: "220px"
|
|
3096
|
+
}
|
|
3097
|
+
},
|
|
3098
|
+
{
|
|
3099
|
+
id: "displayImage",
|
|
3100
|
+
accessorKey: "images",
|
|
3101
|
+
header: () => t("device.table.columns.displayImage"),
|
|
3102
|
+
cell(a) {
|
|
3103
|
+
const u = d(a.getValue()), _ = a.getValue().length - u.length;
|
|
3104
|
+
return u.length > 0 ? X("div", { class: "flex gap-8" }, [
|
|
3105
|
+
...u.map(
|
|
3106
|
+
(U) => X(Me.FmThumbnail, {
|
|
3107
|
+
src: U,
|
|
3108
|
+
size: n("sm") ? "sm" : "md",
|
|
3109
|
+
key: U
|
|
3110
|
+
})
|
|
3111
|
+
),
|
|
3112
|
+
_ > 0 && X("span", { class: "flex items-center" }, `+${_}`)
|
|
3113
|
+
]) : X("div", "-");
|
|
3114
|
+
},
|
|
3115
|
+
meta: {
|
|
3116
|
+
width: "220px"
|
|
3117
|
+
}
|
|
3118
|
+
},
|
|
3119
|
+
{
|
|
3120
|
+
id: "restaurantName",
|
|
3121
|
+
accessorKey: "restaurantName",
|
|
3122
|
+
header: () => t("device.table.columns.restaurantName"),
|
|
3123
|
+
cell: (a) => X("div", { class: "text-ellipsis overflow-hidden text-balance" }, a.getValue()),
|
|
3124
|
+
meta: {
|
|
3125
|
+
width: "220px"
|
|
3126
|
+
}
|
|
3127
|
+
},
|
|
3128
|
+
{
|
|
3129
|
+
accessorKey: "type",
|
|
3130
|
+
header: () => t("device.table.columns.deviceType"),
|
|
3131
|
+
cell(a) {
|
|
3132
|
+
return X(
|
|
3133
|
+
"div",
|
|
3134
|
+
X(Me.FmChip, {
|
|
3135
|
+
variant: "plain",
|
|
3136
|
+
label: Ft(a.getValue()),
|
|
3137
|
+
compact: !0
|
|
3138
|
+
})
|
|
3139
|
+
);
|
|
3140
|
+
},
|
|
3141
|
+
meta: {
|
|
3142
|
+
width: "160px"
|
|
3143
|
+
}
|
|
3144
|
+
},
|
|
3145
|
+
{
|
|
3146
|
+
accessorKey: "bindAt",
|
|
3147
|
+
header: () => t("device.table.columns.bindingAt"),
|
|
3148
|
+
cell: (a) => {
|
|
3149
|
+
if (a.getValue()) {
|
|
3150
|
+
const [u, _] = Ie(a.getValue());
|
|
3151
|
+
return X("div", [X("div", u), X("div", _)]);
|
|
3152
|
+
}
|
|
3153
|
+
return X("div", "-");
|
|
3154
|
+
},
|
|
3155
|
+
meta: {
|
|
3156
|
+
width: "140px"
|
|
3157
|
+
}
|
|
3158
|
+
},
|
|
3159
|
+
{
|
|
3160
|
+
id: "bind-device",
|
|
3161
|
+
cell(a) {
|
|
3162
|
+
let u = a.row.original;
|
|
3163
|
+
const _ = !!u.machineId;
|
|
3164
|
+
if (u.type === Z.Enum.MAIN)
|
|
3165
|
+
return X(
|
|
3166
|
+
"div",
|
|
3167
|
+
{ class: "flex items-center justify-center" },
|
|
3168
|
+
X(Me.FmButton, {
|
|
3169
|
+
prependIcon: _ ? "link_off" : "link",
|
|
3170
|
+
variant: "secondary",
|
|
3171
|
+
label: n("sm") ? void 0 : t(_ ? "device.actions.unbindDevice" : "device.actions.bindDevice"),
|
|
3172
|
+
onClick(U) {
|
|
3173
|
+
U.stopPropagation(), _ ? oe(u) : Re(u);
|
|
3174
|
+
}
|
|
3175
|
+
})
|
|
3176
|
+
);
|
|
3177
|
+
},
|
|
3178
|
+
meta: {
|
|
3179
|
+
width: "235px"
|
|
3180
|
+
}
|
|
3181
|
+
},
|
|
3182
|
+
{
|
|
3183
|
+
id: "logs",
|
|
3184
|
+
cell(a) {
|
|
3185
|
+
var _;
|
|
3186
|
+
let u = a.row.original;
|
|
3187
|
+
return (_ = o.sessionUser.value) != null && _.role.isAdmin ? X(
|
|
3188
|
+
"div",
|
|
3189
|
+
X(
|
|
3190
|
+
Me.FmMenu,
|
|
3191
|
+
{
|
|
3192
|
+
stopClickPropagation: !0,
|
|
3193
|
+
shift: !0,
|
|
3194
|
+
placement: "bottom-end",
|
|
3195
|
+
width: 180,
|
|
3196
|
+
minHeight: 3e3
|
|
3197
|
+
},
|
|
3198
|
+
{
|
|
3199
|
+
default: () => S(u).map(
|
|
3200
|
+
(U) => X(Me.FmMenuItem, {
|
|
3201
|
+
key: U.value,
|
|
3202
|
+
label: U.label,
|
|
3203
|
+
onClick: U.onClick
|
|
3204
|
+
})
|
|
3205
|
+
),
|
|
3206
|
+
"menu-button": () => X(Me.FmButton, {
|
|
3207
|
+
variant: "tertiary",
|
|
3208
|
+
prependIcon: "more_vert"
|
|
3209
|
+
})
|
|
3210
|
+
}
|
|
3211
|
+
)
|
|
3212
|
+
) : null;
|
|
3213
|
+
},
|
|
3214
|
+
meta: {
|
|
3215
|
+
width: "1px"
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
], K = x(""), ce = Q(
|
|
3219
|
+
() => $.value.filter(
|
|
3220
|
+
(a) => K.value ? a.label.toLowerCase().includes(K.value.toLowerCase()) : !0
|
|
3221
|
+
)
|
|
3222
|
+
), it = () => {
|
|
3223
|
+
l.open({
|
|
3224
|
+
title: t("device.creation.title"),
|
|
3225
|
+
contentComponent: ea
|
|
3226
|
+
}).onClose(async () => {
|
|
3227
|
+
await me();
|
|
3228
|
+
});
|
|
3229
|
+
}, Pe = x(!1), we = x(!1), Fe = x(), me = async () => {
|
|
3230
|
+
I.value = !0, await o.readRestaurants(), await z(), await sn(), I.value = !1;
|
|
3231
|
+
}, { currentBusinessWithDisplayImages: at } = Vn(s), Tt = Q(() => o.currentBusiness.value);
|
|
3232
|
+
$e(we, async (a) => {
|
|
3233
|
+
var u;
|
|
3234
|
+
a && ((u = Fe.value) == null ? void 0 : u.type) === Z.Enum.MAIN && (Fe.value = void 0, await me()), we.value = !1;
|
|
3235
|
+
});
|
|
3236
|
+
const De = x(), pe = x(!1);
|
|
3237
|
+
return $e(pe, (a) => {
|
|
3238
|
+
a || (De.value = void 0);
|
|
3239
|
+
}), pt(async () => {
|
|
3240
|
+
at.value = Tt.value, await me(), await ne.forceSync();
|
|
3241
|
+
}), (a, u) => {
|
|
3242
|
+
const _ = E("FmSpacer"), U = E("FmButton"), fe = E("FmListItem"), qe = E("FmList"), lt = E("FmBottomSheet"), xe = E("FmMenuDivider"), Le = E("FmSearch"), Ue = E("FmChip"), Ce = E("FmMenuItem"), D = E("FmMenu"), L = E("FmTableToolbar"), he = E("FmTable"), ve = E("FmThumbnail"), Oe = E("FmCircularProgress");
|
|
3243
|
+
return f(), g("div", ta, [
|
|
3244
|
+
r("div", na, [
|
|
3245
|
+
r("div", oa, h(i(t)("device.title")), 1),
|
|
3246
|
+
m(_),
|
|
3247
|
+
i(n)("sm") ? k("", !0) : (f(), g("div", sa, [
|
|
3248
|
+
m(U, {
|
|
3249
|
+
bgColor: "neutral-gray-100",
|
|
3250
|
+
textColor: "typo-secondary",
|
|
3251
|
+
label: i(t)("device.actions.refresh"),
|
|
3252
|
+
variant: "tertiary",
|
|
3253
|
+
onClick: me
|
|
3254
|
+
}, null, 8, ["label"]),
|
|
3255
|
+
m(U, {
|
|
3256
|
+
bgColor: "neutral-gray-100",
|
|
3257
|
+
textColor: "typo-secondary",
|
|
3258
|
+
label: i(t)("device.actions.forceSync"),
|
|
3259
|
+
variant: "tertiary",
|
|
3260
|
+
onClick: st
|
|
3261
|
+
}, null, 8, ["label"]),
|
|
3262
|
+
m(U, {
|
|
3263
|
+
icon: "add",
|
|
3264
|
+
label: i(t)("device.actions.addDevice"),
|
|
3265
|
+
variant: "primary",
|
|
3266
|
+
onClick: it
|
|
3267
|
+
}, null, 8, ["label"])
|
|
3268
|
+
])),
|
|
3269
|
+
i(n)("sm") ? (f(), M(U, {
|
|
3270
|
+
key: 1,
|
|
3271
|
+
"prepend-icon": "more_vert",
|
|
3272
|
+
variant: "tertiary",
|
|
3273
|
+
onClick: u[0] || (u[0] = (T) => y.value = !0)
|
|
3274
|
+
})) : k("", !0),
|
|
3275
|
+
m(lt, {
|
|
3276
|
+
zIndex: 100,
|
|
3277
|
+
modelValue: y.value,
|
|
3278
|
+
"onUpdate:modelValue": u[1] || (u[1] = (T) => y.value = T),
|
|
3279
|
+
"dismiss-away": "",
|
|
3280
|
+
"no-header": ""
|
|
3281
|
+
}, {
|
|
3282
|
+
default: F(() => [
|
|
3283
|
+
r("div", ia, [
|
|
3284
|
+
m(qe, { class: "w-full" }, {
|
|
3285
|
+
default: F(() => [
|
|
3286
|
+
m(fe, {
|
|
3287
|
+
label: i(t)("device.actions.refresh"),
|
|
3288
|
+
onClick: me
|
|
3289
|
+
}, null, 8, ["label"]),
|
|
3290
|
+
m(fe, {
|
|
3291
|
+
label: i(t)("device.actions.forceSync"),
|
|
3292
|
+
onClick: st
|
|
3293
|
+
}, null, 8, ["label"])
|
|
3294
|
+
]),
|
|
3295
|
+
_: 1
|
|
3296
|
+
})
|
|
3297
|
+
])
|
|
3298
|
+
]),
|
|
3299
|
+
_: 1
|
|
3300
|
+
}, 8, ["modelValue"])
|
|
3301
|
+
]),
|
|
3302
|
+
i(n)("sm") ? (f(), g("div", aa, [
|
|
3303
|
+
m(xe),
|
|
3304
|
+
m(Le, {
|
|
3305
|
+
modelValue: b.value,
|
|
3306
|
+
"onUpdate:modelValue": u[2] || (u[2] = (T) => b.value = T),
|
|
3307
|
+
placeholder: i(t)("device.actions.search")
|
|
3308
|
+
}, null, 8, ["modelValue", "placeholder"]),
|
|
3309
|
+
m(xe)
|
|
3310
|
+
])) : k("", !0),
|
|
3311
|
+
r("div", la, [
|
|
3312
|
+
m(L, { class: "gap-x-0" }, {
|
|
3313
|
+
chips: F(() => [
|
|
3314
|
+
r("div", ra, [
|
|
3315
|
+
r("div", {
|
|
3316
|
+
class: on(["flex flex-row gap-2 mb-4 items-end", i(n)("sm") ? "w-full justify-between" : ""])
|
|
3317
|
+
}, [
|
|
3318
|
+
r("div", ca, [
|
|
3319
|
+
m(D, { "close-on-click": !1 }, {
|
|
3320
|
+
"menu-button": F(() => [
|
|
3321
|
+
m(Ue, {
|
|
3322
|
+
label: J(A.value, $.value, i(t)("device.filters.restaurant.label")),
|
|
3323
|
+
icon: "storefront",
|
|
3324
|
+
"right-icon": "keyboard_arrow_down",
|
|
3325
|
+
class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400 w-full"
|
|
3326
|
+
}, null, 8, ["label"])
|
|
3327
|
+
]),
|
|
3328
|
+
default: F(() => [
|
|
3329
|
+
r("div", ua, [
|
|
3330
|
+
m(Le, {
|
|
3331
|
+
"model-value": K.value,
|
|
3332
|
+
"onUpdate:modelValue": u[3] || (u[3] = (T) => K.value = T),
|
|
3333
|
+
placeholder: i(t)("device.filters.restaurant.search"),
|
|
3334
|
+
collapsible: !1
|
|
3335
|
+
}, null, 8, ["model-value", "placeholder"]),
|
|
3336
|
+
m(xe),
|
|
3337
|
+
r("div", da, [
|
|
3338
|
+
m(Ce, {
|
|
3339
|
+
"model-value": A.value.length === $.value.length,
|
|
3340
|
+
label: i(t)("device.filters.all"),
|
|
3341
|
+
"has-checkbox": !0,
|
|
3342
|
+
indeterminate: A.value.length > 0,
|
|
3343
|
+
onClick: u[4] || (u[4] = () => G(A.value, $.value))
|
|
3344
|
+
}, null, 8, ["model-value", "label", "indeterminate"]),
|
|
3345
|
+
(f(!0), g(ie, null, ue(ce.value, (T, te) => (f(), M(Ce, {
|
|
3346
|
+
key: te,
|
|
3347
|
+
"model-value": !!A.value.find((ge) => ge === T.value),
|
|
3348
|
+
label: T.label,
|
|
3349
|
+
"has-checkbox": !0,
|
|
3350
|
+
onClick: () => w(A.value, T)
|
|
3351
|
+
}, null, 8, ["model-value", "label", "onClick"]))), 128))
|
|
3352
|
+
])
|
|
3353
|
+
])
|
|
3354
|
+
]),
|
|
3355
|
+
_: 1
|
|
3356
|
+
})
|
|
3357
|
+
]),
|
|
3358
|
+
r("div", ma, [
|
|
3359
|
+
m(D, { "close-on-click": !1 }, {
|
|
3360
|
+
"menu-button": F(() => [
|
|
3361
|
+
m(Ue, {
|
|
3362
|
+
label: J(N.value, O.value, i(t)("device.filters.deviceType")),
|
|
3363
|
+
icon: "monitor",
|
|
3364
|
+
"right-icon": "keyboard_arrow_down",
|
|
3365
|
+
class: "fm-typo-en-body-md-600 text-fm-color-neutral-gray-400 w-full"
|
|
3366
|
+
}, null, 8, ["label"])
|
|
3367
|
+
]),
|
|
3368
|
+
default: F(() => [
|
|
3369
|
+
r("div", pa, [
|
|
3370
|
+
m(Ce, {
|
|
3371
|
+
"model-value": N.value.length === O.value.length,
|
|
3372
|
+
label: i(t)("device.filters.all"),
|
|
3373
|
+
"has-checkbox": !0,
|
|
3374
|
+
indeterminate: N.value.length > 0,
|
|
3375
|
+
onClick: u[5] || (u[5] = () => G(N.value, O.value))
|
|
3376
|
+
}, null, 8, ["model-value", "label", "indeterminate"]),
|
|
3377
|
+
(f(!0), g(ie, null, ue(O.value, (T, te) => (f(), M(Ce, {
|
|
3378
|
+
key: te,
|
|
3379
|
+
"model-value": !!N.value.find((ge) => ge === T.value),
|
|
3380
|
+
label: T.label ?? "",
|
|
3381
|
+
"has-checkbox": !0,
|
|
3382
|
+
onClick: () => w(N.value, T)
|
|
3383
|
+
}, null, 8, ["model-value", "label", "onClick"]))), 128))
|
|
3384
|
+
])
|
|
3385
|
+
]),
|
|
3386
|
+
_: 1
|
|
3387
|
+
})
|
|
3388
|
+
])
|
|
3389
|
+
], 2),
|
|
3390
|
+
i(n)("sm") ? k("", !0) : (f(), M(Le, {
|
|
3391
|
+
key: 0,
|
|
3392
|
+
"model-value": b.value,
|
|
3393
|
+
"onUpdate:modelValue": u[6] || (u[6] = (T) => b.value = T),
|
|
3394
|
+
placeholder: i(t)("device.actions.search"),
|
|
3395
|
+
collapsible: !1,
|
|
3396
|
+
class: "w-[343px]"
|
|
3397
|
+
}, null, 8, ["model-value", "placeholder"]))
|
|
3398
|
+
])
|
|
3399
|
+
]),
|
|
3400
|
+
_: 1
|
|
3401
|
+
}),
|
|
3402
|
+
i(n)("sm") ? k("", !0) : (f(), M(he, {
|
|
3403
|
+
key: 0,
|
|
3404
|
+
"shrink-at": !1,
|
|
3405
|
+
"auto-reset-page-index": !0,
|
|
3406
|
+
class: "flex-1 overflow-y-auto",
|
|
3407
|
+
"column-defs": Y,
|
|
3408
|
+
"row-data": V.value,
|
|
3409
|
+
loading: I.value,
|
|
3410
|
+
"hide-footer": V.value.length < 11,
|
|
3411
|
+
"on-row-click": (T) => {
|
|
3412
|
+
Fe.value = T.original, Pe.value = !0;
|
|
3413
|
+
}
|
|
3414
|
+
}, null, 8, ["row-data", "loading", "hide-footer", "on-row-click"])),
|
|
3415
|
+
i(n)("sm") && !I.value ? (f(), M(qe, {
|
|
3416
|
+
key: 1,
|
|
3417
|
+
class: "w-full",
|
|
3418
|
+
separator: ""
|
|
3419
|
+
}, {
|
|
3420
|
+
default: F(() => [
|
|
3421
|
+
(f(!0), g(ie, null, ue(V.value, (T) => (f(), M(fe, {
|
|
3422
|
+
key: T._id,
|
|
3423
|
+
style: { padding: "12px 0 !important" },
|
|
3424
|
+
onClick: () => {
|
|
3425
|
+
Fe.value = T, Pe.value = !0;
|
|
3426
|
+
}
|
|
3427
|
+
}, {
|
|
3428
|
+
default: F(() => [
|
|
3429
|
+
r("div", fa, [
|
|
3430
|
+
r("div", ha, [
|
|
3431
|
+
m(Ue, {
|
|
3432
|
+
label: i(Ft)(T.type),
|
|
3433
|
+
variant: "plain",
|
|
3434
|
+
compact: ""
|
|
3435
|
+
}, null, 8, ["label"])
|
|
3436
|
+
]),
|
|
3437
|
+
r("div", va, [
|
|
3438
|
+
kt(h(T.restaurantName) + " ", 1),
|
|
3439
|
+
T.type != i(Z).Enum.MAIN ? (f(), g("span", _a, " - " + h(T.name), 1)) : k("", !0)
|
|
3440
|
+
]),
|
|
3441
|
+
r("div", ga, h(Ie(T.createdAt)[0]) + " " + h(Ie(T.createdAt)[1]), 1),
|
|
3442
|
+
v.value.length && T.type === i(Z).Enum.MAIN ? (f(), g("div", ba, [
|
|
3443
|
+
(f(!0), g(ie, null, ue(d(Ee(T.restaurantId)), (te) => (f(), g("div", { key: te }, [
|
|
3444
|
+
m(ve, {
|
|
3445
|
+
src: te,
|
|
3446
|
+
size: "md"
|
|
3447
|
+
}, null, 8, ["src"])
|
|
3448
|
+
]))), 128)),
|
|
3449
|
+
Ee(T.restaurantId).length - d(Ee(T.restaurantId)).length > 0 ? (f(), g("span", ya, "+" + h(Ee(T.restaurantId).length - d(Ee(T.restaurantId)).length), 1)) : k("", !0)
|
|
3450
|
+
])) : k("", !0)
|
|
3451
|
+
]),
|
|
3452
|
+
r("div", Ta, [
|
|
3453
|
+
T.type === i(Z).Enum.MAIN ? (f(), M(U, {
|
|
3454
|
+
key: 0,
|
|
3455
|
+
"prepend-icon": T.machineId ? "link_off" : "link",
|
|
3456
|
+
variant: "tertiary",
|
|
3457
|
+
onClick: Dt(() => T.machineId ? oe(T) : Re(T), ["stop"])
|
|
3458
|
+
}, null, 8, ["prepend-icon", "onClick"])) : k("", !0),
|
|
3459
|
+
m(D, {
|
|
3460
|
+
stopClickPropagation: !0,
|
|
3461
|
+
shift: "",
|
|
3462
|
+
placement: "bottom-end",
|
|
3463
|
+
width: 180,
|
|
3464
|
+
minHeight: 3e3
|
|
3465
|
+
}, {
|
|
3466
|
+
"menu-button": F(() => [
|
|
3467
|
+
m(U, {
|
|
3468
|
+
variant: "tertiary",
|
|
3469
|
+
prependIcon: "more_vert"
|
|
3470
|
+
})
|
|
3471
|
+
]),
|
|
3472
|
+
default: F(() => [
|
|
3473
|
+
(f(!0), g(ie, null, ue(S(T), (te) => (f(), M(Ce, {
|
|
3474
|
+
key: te.value,
|
|
3475
|
+
label: te.label,
|
|
3476
|
+
onClick: te.onClick
|
|
3477
|
+
}, null, 8, ["label", "onClick"]))), 128))
|
|
3478
|
+
]),
|
|
3479
|
+
_: 2
|
|
3480
|
+
}, 1024)
|
|
3481
|
+
])
|
|
3482
|
+
]),
|
|
3483
|
+
_: 2
|
|
3484
|
+
}, 1032, ["onClick"]))), 128))
|
|
3485
|
+
]),
|
|
3486
|
+
_: 1
|
|
3487
|
+
})) : (f(), M(Oe, {
|
|
3488
|
+
key: 2,
|
|
3489
|
+
class: "hidden sm:block xs:block"
|
|
3490
|
+
})),
|
|
3491
|
+
i(n)("sm") ? (f(), g("div", Ia, [
|
|
3492
|
+
m(U, {
|
|
3493
|
+
icon: "add",
|
|
3494
|
+
label: i(t)("device.actions.addDevice"),
|
|
3495
|
+
onClick: it,
|
|
3496
|
+
size: "lg"
|
|
3497
|
+
}, null, 8, ["label"])
|
|
3498
|
+
])) : k("", !0)
|
|
3499
|
+
]),
|
|
3500
|
+
(f(), M(An, { to: "body" }, [
|
|
3501
|
+
Fe.value ? (f(), M(zi, {
|
|
3502
|
+
key: 0,
|
|
3503
|
+
visible: Pe.value,
|
|
3504
|
+
"onUpdate:visible": u[7] || (u[7] = (T) => Pe.value = T),
|
|
3505
|
+
device: Fe.value,
|
|
3506
|
+
devices: R.value,
|
|
3507
|
+
"form-updated": we.value,
|
|
3508
|
+
"onUpdate:formUpdated": u[8] || (u[8] = (T) => we.value = T)
|
|
3509
|
+
}, null, 8, ["visible", "device", "devices", "form-updated"])) : k("", !0),
|
|
3510
|
+
De.value && De.value.deviceId ? (f(), M(Gi, {
|
|
3511
|
+
key: 1,
|
|
3512
|
+
visible: pe.value,
|
|
3513
|
+
"onUpdate:visible": u[9] || (u[9] = (T) => pe.value = T),
|
|
3514
|
+
device: De.value
|
|
3515
|
+
}, null, 8, ["visible", "device"])) : k("", !0)
|
|
3516
|
+
]))
|
|
3517
|
+
]);
|
|
3518
|
+
};
|
|
3519
|
+
}
|
|
3520
|
+
});
|
|
3521
|
+
export {
|
|
3522
|
+
Ra as default
|
|
3523
|
+
};
|