@feedmepos/mf-report 5.21.29-beta.7 → 5.21.29-beta.9
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-BbSxqObQ.js +278 -0
- package/dist/app.js +1 -1
- package/package.json +1 -1
- package/dist/App-BFFm-mBy.js +0 -280
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { defineComponent as se, resolveComponent as V, createBlock as ie, openBlock as R, unref as c, isRef as Oe, withCtx as z, createElementVNode as M, createVNode as W, toDisplayString as ee, createTextVNode as we, onMounted as ue, watch as q, ref as A, computed as te, onBeforeMount as Ce, onBeforeUnmount as Ee, createElementBlock as Q, Fragment as ke } from "vue";
|
|
2
|
+
import { detectLocale as N, useCoreStore as j } from "@feedmepos/mf-common";
|
|
3
|
+
import { u as Ae, d as u, a as Ne, b as ne, c as Te, e as Be, f as Fe, s as $e, g as xe } from "./vue-i18n-BdbYuMnB.js";
|
|
4
|
+
import { storeToRefs as L } from "pinia";
|
|
5
|
+
import { u as re, a as Je, b as Ue } from "./BaseDialog.vue_vue_type_script_setup_true_lang-BHDUNZTW.js";
|
|
6
|
+
import { u as ze, _ as Qe } from "./NavigationTab.vue_vue_type_script_setup_true_lang-CW6iYOsZ.js";
|
|
7
|
+
import { u as ae } from "./message-dialog-UoMWOnil.js";
|
|
8
|
+
import { useRoute as je, useRouter as Ve } from "vue-router";
|
|
9
|
+
const We = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, Pe = /* @__PURE__ */ se({
|
|
10
|
+
__name: "Dialog",
|
|
11
|
+
setup(_) {
|
|
12
|
+
const { t: i } = Ae(), l = ae(), { isOpened: d, message: S, title: D } = L(ae());
|
|
13
|
+
return (f, g) => {
|
|
14
|
+
const b = V("FmButton"), T = V("FmDialog");
|
|
15
|
+
return R(), ie(T, {
|
|
16
|
+
modelValue: c(d),
|
|
17
|
+
"onUpdate:modelValue": g[0] || (g[0] = (B) => Oe(d) ? d.value = B : null),
|
|
18
|
+
overlay: "",
|
|
19
|
+
"close-button": !1
|
|
20
|
+
}, {
|
|
21
|
+
"dialog-header": z(() => [
|
|
22
|
+
we(ee(c(D)), 1)
|
|
23
|
+
]),
|
|
24
|
+
default: z(() => [
|
|
25
|
+
M("p", We, ee(c(S)), 1)
|
|
26
|
+
]),
|
|
27
|
+
"dialog-footer": z(() => [
|
|
28
|
+
g[1] || (g[1] = M("div", { class: "grow" }, null, -1)),
|
|
29
|
+
W(b, {
|
|
30
|
+
label: c(i)("report.common.cancel"),
|
|
31
|
+
variant: "tertiary",
|
|
32
|
+
onClick: c(l).dismiss
|
|
33
|
+
}, null, 8, ["label", "onClick"]),
|
|
34
|
+
W(b, {
|
|
35
|
+
label: c(i)("report.common.confirm"),
|
|
36
|
+
onClick: c(l).confirm
|
|
37
|
+
}, null, 8, ["label", "onClick"])
|
|
38
|
+
]),
|
|
39
|
+
_: 1
|
|
40
|
+
}, 8, ["modelValue"]);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}), oe = A(N());
|
|
44
|
+
function Ge() {
|
|
45
|
+
const _ = (i) => {
|
|
46
|
+
switch (oe.value = i, i) {
|
|
47
|
+
case "zh-CN":
|
|
48
|
+
u.locale("zh-cn");
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
u.locale("en");
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return ue(() => {
|
|
56
|
+
_(N());
|
|
57
|
+
}), q(() => N(), _, { deep: !0, immediate: !0 }), {
|
|
58
|
+
currentLocale: oe
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
u.locale(N() === "zh-CN" ? "zh-cn" : "en");
|
|
62
|
+
const Ke = ["src"], He = ["src"], it = /* @__PURE__ */ se({
|
|
63
|
+
__name: "App",
|
|
64
|
+
setup(_) {
|
|
65
|
+
const { businessId: i, token: l, country: d } = L(Ne()), { sessionUser: S, currentBusiness: D, currentCountry: f, registerSidebarComponent: g } = j(), { getRestaurantAndWarehouse: b, getBusinessSetting: T, beginBusinessLoad: B, completeBusinessLoad: ce } = ne(), { getFeatureFlags: de } = Te(), { version: m } = L(re()), { getSettings: le } = Be(), { promptLoader: fe } = Fe(), e = je(), F = Ve(), I = Je(), P = ze(), r = ne(), me = re(), { suppressReportRouteSync: O } = L(me), pe = te(() => `https://portal-v1.feedmedev.cc/b/${i.value}/report/CLOSE_UP?showHeader=false&country=${d.value.toUpperCase()}&menuOption=business-report&token=${l.value}&v2=true&reportV5Button=true`), ge = te(() => `https://report-v4.feedmedev.cc?businessId=${i.value}&country=${d.value}&token=${l.value}&reportV3Button=true`);
|
|
66
|
+
q(
|
|
67
|
+
[() => D.value, () => S.value, () => f.value],
|
|
68
|
+
() => {
|
|
69
|
+
var n, a;
|
|
70
|
+
const t = ((n = D.value) == null ? void 0 : n.id) ?? "";
|
|
71
|
+
if (D.value && S.value && f.value) {
|
|
72
|
+
$e(f.value), i.value !== t && (i.value = t);
|
|
73
|
+
let o = !1;
|
|
74
|
+
d.value !== f.value && (o = !0), l.value = ((a = S.value) == null ? void 0 : a.token) ?? "", d.value = f.value ?? "", (e.query.businessId !== i.value || o) && F.replace({
|
|
75
|
+
name: e.name,
|
|
76
|
+
params: e.params,
|
|
77
|
+
query: {
|
|
78
|
+
...e.query,
|
|
79
|
+
businessId: i.value,
|
|
80
|
+
country: f.value,
|
|
81
|
+
isAllLocation: o ? "true" : e.query.isAllLocation,
|
|
82
|
+
locationIds: o ? void 0 : e.query.locationIds
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{ immediate: !0 }
|
|
88
|
+
);
|
|
89
|
+
function G(t) {
|
|
90
|
+
if (typeof t.data == "string")
|
|
91
|
+
try {
|
|
92
|
+
const n = JSON.parse(t.data);
|
|
93
|
+
(n == null ? void 0 : n.token) !== "" && (n == null ? void 0 : n.token) !== void 0 && (l.value = n.token);
|
|
94
|
+
} catch (n) {
|
|
95
|
+
console.error(n);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function K(t) {
|
|
99
|
+
if (typeof t.data == "string")
|
|
100
|
+
try {
|
|
101
|
+
const n = JSON.parse(t.data);
|
|
102
|
+
(n == null ? void 0 : n.v5) === !0 ? m.value = $.value : (n == null ? void 0 : n.v3) === !0 && (m.value = "v3");
|
|
103
|
+
} catch (n) {
|
|
104
|
+
console.error(n);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
q(m, () => {
|
|
108
|
+
["v3", "v4"].includes(m.value) ? j().hideSidebarToggle(!0) : j().hideSidebarToggle(!1);
|
|
109
|
+
}), Ce(() => {
|
|
110
|
+
g(Qe);
|
|
111
|
+
}), ue(() => {
|
|
112
|
+
console.log("5.21.29-beta.9", !0), window.addEventListener("message", G), window.addEventListener("message", K);
|
|
113
|
+
}), Ee(() => {
|
|
114
|
+
window.removeEventListener("message", G), window.removeEventListener("message", K), I.$dispose(), P.$dispose();
|
|
115
|
+
});
|
|
116
|
+
const { getReports: ye, getOverviewReport: ve, getReportConfig: H, currentReportId: X } = I, { currentReportId: Se, reports: De } = L(I), { getSchema: Ie } = Ue(), { fetchSchedules: he } = P, { init: Re } = xe(), $ = A("v5"), w = A(!1), x = A(!0);
|
|
117
|
+
function qe(t) {
|
|
118
|
+
try {
|
|
119
|
+
return decodeURIComponent(t);
|
|
120
|
+
} catch {
|
|
121
|
+
return t;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function C(t) {
|
|
125
|
+
if (typeof t != "string" || t.length === 0) return;
|
|
126
|
+
const n = t.includes("%") ? [t, qe(t)] : [t];
|
|
127
|
+
for (const a of n)
|
|
128
|
+
try {
|
|
129
|
+
const o = JSON.parse(a);
|
|
130
|
+
if (typeof o == "string")
|
|
131
|
+
try {
|
|
132
|
+
return JSON.parse(o);
|
|
133
|
+
} catch {
|
|
134
|
+
return o;
|
|
135
|
+
}
|
|
136
|
+
return o;
|
|
137
|
+
} catch {
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function Y(t) {
|
|
141
|
+
if (!t || typeof t != "object") return !1;
|
|
142
|
+
const n = t;
|
|
143
|
+
return typeof n.hour == "number" && typeof n.minute == "number";
|
|
144
|
+
}
|
|
145
|
+
function Le() {
|
|
146
|
+
const t = e.query.startDate ? u(e.query.startDate).startOf("day").toISOString() : void 0, n = e.query.endDate ? u(e.query.endDate).endOf("day").toISOString() : void 0, a = typeof e.query.timeStart == "string", o = typeof e.query.timeEnd == "string", p = C(e.query.timeStart), h = C(e.query.timeEnd), E = Y(p) ? p : null, k = Y(h) ? h : null, J = e.query.compareStartDate ? u(e.query.compareStartDate).startOf("day").toISOString() : void 0, U = e.query.compareEndDate ? u(e.query.compareEndDate).endOf("day").toISOString() : void 0, Z = e.query.isAllLocation === "true";
|
|
147
|
+
let y = [];
|
|
148
|
+
if (Z)
|
|
149
|
+
y = r.selectedLocationIds;
|
|
150
|
+
else {
|
|
151
|
+
const s = C(e.query.locationIds);
|
|
152
|
+
y = Array.isArray(s) ? s : [];
|
|
153
|
+
}
|
|
154
|
+
let v = e.query.reportId || X;
|
|
155
|
+
if (De.value.find((s) => s.id === v) || (v = X), v && v !== I.currentReportId && I.updateCurrentReportId(v), t || n) {
|
|
156
|
+
const s = r.dateRange;
|
|
157
|
+
(s.startDate !== t || s.endDate !== n) && r.setDateRange({ startDate: t, endDate: n });
|
|
158
|
+
}
|
|
159
|
+
if (a || o) {
|
|
160
|
+
const s = r.timeRange;
|
|
161
|
+
(s.start !== E || s.end !== k) && r.setTimeRange({ start: E, end: k });
|
|
162
|
+
}
|
|
163
|
+
if (J || U) {
|
|
164
|
+
const s = r.compareDateRange;
|
|
165
|
+
(s.startDate !== J || s.endDate !== U) && r.setCompareDateRange({
|
|
166
|
+
startDate: J,
|
|
167
|
+
endDate: U
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
if (!Z && Array.isArray(y)) {
|
|
171
|
+
const s = r.selectedLocationIds;
|
|
172
|
+
s.length === y.length && s.every((_e, be) => _e === y[be]) || r.setSelectedLocationIds(y);
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
// TODO: this returned value can used for getBusinessSetting
|
|
176
|
+
reportId: v,
|
|
177
|
+
startDate: e.query.startDate,
|
|
178
|
+
endDate: e.query.endDate,
|
|
179
|
+
timeStart: e.query.timeStart,
|
|
180
|
+
timeEnd: e.query.timeEnd,
|
|
181
|
+
compareStartDate: e.query.compareStartDate,
|
|
182
|
+
compareEndDate: e.query.compareEndDate,
|
|
183
|
+
locationIds: typeof e.query.locationIds == "string" ? e.query.locationIds : void 0,
|
|
184
|
+
isAllLocation: e.query.isAllLocation
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
return q(
|
|
188
|
+
() => i.value,
|
|
189
|
+
async (t) => {
|
|
190
|
+
t !== "" && (w.value = !1, B(t), x.value || (r.setSelectedLocationIds([]), F.replace({
|
|
191
|
+
name: e.name,
|
|
192
|
+
params: e.params,
|
|
193
|
+
query: {
|
|
194
|
+
...e.query,
|
|
195
|
+
locationIds: void 0,
|
|
196
|
+
isAllLocation: "true"
|
|
197
|
+
}
|
|
198
|
+
})), O.value !== void 0 && (O.value = !0), await fe(async () => {
|
|
199
|
+
await Re({
|
|
200
|
+
apiKey: "MaGoXrEWuEJNpWgKTqseee",
|
|
201
|
+
url: "https://flag.feedme.farm/api/v1/",
|
|
202
|
+
enableAnalytics: !1,
|
|
203
|
+
cacheFlags: !1
|
|
204
|
+
});
|
|
205
|
+
const n = await H();
|
|
206
|
+
$.value = n.version, m.value = $.value, await Promise.all([
|
|
207
|
+
de(),
|
|
208
|
+
H(),
|
|
209
|
+
ve(),
|
|
210
|
+
ye(),
|
|
211
|
+
Ie(),
|
|
212
|
+
he(),
|
|
213
|
+
b(
|
|
214
|
+
(() => {
|
|
215
|
+
const a = C(e.query.locationIds);
|
|
216
|
+
return Array.isArray(a) ? a : void 0;
|
|
217
|
+
})()
|
|
218
|
+
),
|
|
219
|
+
le()
|
|
220
|
+
]), await T(), Le(), ce(t);
|
|
221
|
+
}), w.value = !0, x.value && (x.value = !1));
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
immediate: !0
|
|
225
|
+
}
|
|
226
|
+
), q(
|
|
227
|
+
() => (w.value, {
|
|
228
|
+
reportId: Se.value,
|
|
229
|
+
selectedLocationIds: r.selectedLocationIds,
|
|
230
|
+
dateRange: r.dateRange,
|
|
231
|
+
timeRange: r.timeRange,
|
|
232
|
+
compareDateRange: r.compareDateRange
|
|
233
|
+
}),
|
|
234
|
+
(t) => {
|
|
235
|
+
if (!w.value || !t.reportId) return;
|
|
236
|
+
if (O.value) {
|
|
237
|
+
O.value = !1;
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const n = t.selectedLocationIds, a = t.dateRange, o = t.timeRange, p = t.compareDateRange, h = {
|
|
241
|
+
...e.query,
|
|
242
|
+
reportId: t.reportId,
|
|
243
|
+
startDate: a.startDate ? u(a.startDate).startOf("day").toISOString() : void 0,
|
|
244
|
+
endDate: a.endDate ? u(a.endDate).endOf("day").toISOString() : void 0,
|
|
245
|
+
compareStartDate: p.startDate ? u(p.startDate).startOf("day").toISOString() : void 0,
|
|
246
|
+
compareEndDate: p.endDate ? u(p.endDate).endOf("day").toISOString() : void 0,
|
|
247
|
+
timeStart: o.start ? JSON.stringify(o.start) : void 0,
|
|
248
|
+
timeEnd: o.end ? JSON.stringify(o.end) : void 0,
|
|
249
|
+
locationIds: n.length === r.locations.length ? void 0 : n.length > 0 ? JSON.stringify(n) : void 0,
|
|
250
|
+
isAllLocation: String(n.length === r.locations.length)
|
|
251
|
+
}, E = JSON.stringify(e.query), k = JSON.stringify(h);
|
|
252
|
+
E !== k && F.replace({
|
|
253
|
+
name: e.name,
|
|
254
|
+
params: e.params,
|
|
255
|
+
query: h
|
|
256
|
+
});
|
|
257
|
+
},
|
|
258
|
+
{ deep: !0 }
|
|
259
|
+
), Ge(), (t, n) => {
|
|
260
|
+
const a = V("router-view");
|
|
261
|
+
return R(), Q(ke, null, [
|
|
262
|
+
W(Pe),
|
|
263
|
+
c(m) === "v3" ? (R(), Q("iframe", {
|
|
264
|
+
key: 0,
|
|
265
|
+
class: "bg-white h-full w-full",
|
|
266
|
+
src: pe.value
|
|
267
|
+
}, null, 8, Ke)) : c(m) === "v4" ? (R(), Q("iframe", {
|
|
268
|
+
key: 1,
|
|
269
|
+
class: "bg-white h-full w-full",
|
|
270
|
+
src: ge.value
|
|
271
|
+
}, null, 8, He)) : (R(), ie(a, { key: 2 }))
|
|
272
|
+
], 64);
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
export {
|
|
277
|
+
it as default
|
|
278
|
+
};
|
package/dist/app.js
CHANGED
package/package.json
CHANGED
package/dist/App-BFFm-mBy.js
DELETED
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
import { defineComponent as se, resolveComponent as V, createBlock as ie, openBlock as L, unref as c, isRef as Oe, withCtx as z, createElementVNode as M, createVNode as W, toDisplayString as ee, createTextVNode as we, onMounted as ue, watch as D, ref as A, computed as te, onBeforeMount as Ee, onBeforeUnmount as Ce, createElementBlock as Q, Fragment as ke } from "vue";
|
|
2
|
-
import { detectLocale as T, useCoreStore as j } from "@feedmepos/mf-common";
|
|
3
|
-
import { u as Ne, d as u, a as Ae, b as ne, c as Te, e as Be, f as Fe, s as $e, g as xe } from "./vue-i18n-BdbYuMnB.js";
|
|
4
|
-
import { storeToRefs as _ } from "pinia";
|
|
5
|
-
import { u as re, a as Je, b as Ue } from "./BaseDialog.vue_vue_type_script_setup_true_lang-BHDUNZTW.js";
|
|
6
|
-
import { u as ze, _ as Qe } from "./NavigationTab.vue_vue_type_script_setup_true_lang-CW6iYOsZ.js";
|
|
7
|
-
import { u as ae } from "./message-dialog-UoMWOnil.js";
|
|
8
|
-
import { useRoute as je, useRouter as Ve } from "vue-router";
|
|
9
|
-
const We = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, Pe = /* @__PURE__ */ se({
|
|
10
|
-
__name: "Dialog",
|
|
11
|
-
setup(b) {
|
|
12
|
-
const { t: s } = Ne(), d = ae(), { isOpened: l, message: I, title: h } = _(ae());
|
|
13
|
-
return (p, g) => {
|
|
14
|
-
const O = V("FmButton"), B = V("FmDialog");
|
|
15
|
-
return L(), ie(B, {
|
|
16
|
-
modelValue: c(l),
|
|
17
|
-
"onUpdate:modelValue": g[0] || (g[0] = (F) => Oe(l) ? l.value = F : null),
|
|
18
|
-
overlay: "",
|
|
19
|
-
"close-button": !1
|
|
20
|
-
}, {
|
|
21
|
-
"dialog-header": z(() => [
|
|
22
|
-
we(ee(c(h)), 1)
|
|
23
|
-
]),
|
|
24
|
-
default: z(() => [
|
|
25
|
-
M("p", We, ee(c(I)), 1)
|
|
26
|
-
]),
|
|
27
|
-
"dialog-footer": z(() => [
|
|
28
|
-
g[1] || (g[1] = M("div", { class: "grow" }, null, -1)),
|
|
29
|
-
W(O, {
|
|
30
|
-
label: c(s)("report.common.cancel"),
|
|
31
|
-
variant: "tertiary",
|
|
32
|
-
onClick: c(d).dismiss
|
|
33
|
-
}, null, 8, ["label", "onClick"]),
|
|
34
|
-
W(O, {
|
|
35
|
-
label: c(s)("report.common.confirm"),
|
|
36
|
-
onClick: c(d).confirm
|
|
37
|
-
}, null, 8, ["label", "onClick"])
|
|
38
|
-
]),
|
|
39
|
-
_: 1
|
|
40
|
-
}, 8, ["modelValue"]);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}), oe = A(T());
|
|
44
|
-
function Ge() {
|
|
45
|
-
const b = (s) => {
|
|
46
|
-
switch (oe.value = s, s) {
|
|
47
|
-
case "zh-CN":
|
|
48
|
-
u.locale("zh-cn");
|
|
49
|
-
break;
|
|
50
|
-
default:
|
|
51
|
-
u.locale("en");
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
return ue(() => {
|
|
56
|
-
b(T());
|
|
57
|
-
}), D(() => T(), b, { deep: !0, immediate: !0 }), {
|
|
58
|
-
currentLocale: oe
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
u.locale(T() === "zh-CN" ? "zh-cn" : "en");
|
|
62
|
-
const Ke = ["src"], He = ["src"], it = /* @__PURE__ */ se({
|
|
63
|
-
__name: "App",
|
|
64
|
-
setup(b) {
|
|
65
|
-
const { businessId: s, token: d, country: l } = _(Ae()), { sessionUser: I, currentBusiness: h, currentCountry: p, registerSidebarComponent: g } = j(), { getRestaurantAndWarehouse: O, getBusinessSetting: B, beginBusinessLoad: F, completeBusinessLoad: ce } = ne(), { getFeatureFlags: de } = Te(), { version: m } = _(re()), { getSettings: le } = Be(), { promptLoader: me } = Fe(), n = je(), w = Ve(), R = Je(), P = ze(), r = ne(), fe = re(), { suppressReportRouteSync: y } = _(fe), pe = te(() => `https://portal-v1.feedmedev.cc/b/${s.value}/report/CLOSE_UP?showHeader=false&country=${l.value.toUpperCase()}&menuOption=business-report&token=${d.value}&v2=true&reportV5Button=true`), ge = te(() => `https://report-v4.feedmedev.cc?businessId=${s.value}&country=${l.value}&token=${d.value}&reportV3Button=true`);
|
|
66
|
-
D(
|
|
67
|
-
[() => h.value, () => I.value, () => p.value],
|
|
68
|
-
() => {
|
|
69
|
-
var t, a;
|
|
70
|
-
const e = ((t = h.value) == null ? void 0 : t.id) ?? "";
|
|
71
|
-
h.value && I.value && p.value && ($e(p.value), s.value !== e && (s.value = e), d.value = ((a = I.value) == null ? void 0 : a.token) ?? "", l.value = p.value ?? "", n.query.businessId !== s.value && w.replace({
|
|
72
|
-
name: n.name,
|
|
73
|
-
params: n.params,
|
|
74
|
-
query: { ...n.query, businessId: s.value }
|
|
75
|
-
}));
|
|
76
|
-
},
|
|
77
|
-
{ immediate: !0 }
|
|
78
|
-
);
|
|
79
|
-
function G(e) {
|
|
80
|
-
if (typeof e.data == "string")
|
|
81
|
-
try {
|
|
82
|
-
const t = JSON.parse(e.data);
|
|
83
|
-
(t == null ? void 0 : t.token) !== "" && (t == null ? void 0 : t.token) !== void 0 && (d.value = t.token);
|
|
84
|
-
} catch (t) {
|
|
85
|
-
console.error(t);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
function K(e) {
|
|
89
|
-
if (typeof e.data == "string")
|
|
90
|
-
try {
|
|
91
|
-
const t = JSON.parse(e.data);
|
|
92
|
-
(t == null ? void 0 : t.v5) === !0 ? m.value = $.value : (t == null ? void 0 : t.v3) === !0 && (m.value = "v3");
|
|
93
|
-
} catch (t) {
|
|
94
|
-
console.error(t);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
D(m, () => {
|
|
98
|
-
["v3", "v4"].includes(m.value) ? j().hideSidebarToggle(!0) : j().hideSidebarToggle(!1);
|
|
99
|
-
}), Ee(() => {
|
|
100
|
-
g(Qe);
|
|
101
|
-
}), ue(() => {
|
|
102
|
-
console.log("5.21.29-beta.7", !0), window.addEventListener("message", G), window.addEventListener("message", K);
|
|
103
|
-
}), Ce(() => {
|
|
104
|
-
window.removeEventListener("message", G), window.removeEventListener("message", K), R.$dispose(), P.$dispose();
|
|
105
|
-
});
|
|
106
|
-
const { getReports: ye, getOverviewReport: ve, getReportConfig: H, currentReportId: X } = R, { currentReportId: Se, reports: De } = _(R), { getSchema: Ie } = Ue(), { fetchSchedules: he } = P, { init: Re } = xe(), $ = A("v5"), E = A(!1), x = A(!0);
|
|
107
|
-
function qe(e) {
|
|
108
|
-
try {
|
|
109
|
-
return decodeURIComponent(e);
|
|
110
|
-
} catch {
|
|
111
|
-
return e;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
function C(e) {
|
|
115
|
-
if (typeof e != "string" || e.length === 0) return;
|
|
116
|
-
const t = e.includes("%") ? [e, qe(e)] : [e];
|
|
117
|
-
for (const a of t)
|
|
118
|
-
try {
|
|
119
|
-
const i = JSON.parse(a);
|
|
120
|
-
if (typeof i == "string")
|
|
121
|
-
try {
|
|
122
|
-
return JSON.parse(i);
|
|
123
|
-
} catch {
|
|
124
|
-
return i;
|
|
125
|
-
}
|
|
126
|
-
return i;
|
|
127
|
-
} catch {
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function Y(e) {
|
|
131
|
-
if (!e || typeof e != "object") return !1;
|
|
132
|
-
const t = e;
|
|
133
|
-
return typeof t.hour == "number" && typeof t.minute == "number";
|
|
134
|
-
}
|
|
135
|
-
function Le() {
|
|
136
|
-
const e = n.query.startDate ? u(n.query.startDate).startOf("day").toISOString() : void 0, t = n.query.endDate ? u(n.query.endDate).endOf("day").toISOString() : void 0, a = typeof n.query.timeStart == "string", i = typeof n.query.timeEnd == "string", f = C(n.query.timeStart), q = C(n.query.timeEnd), k = Y(f) ? f : null, N = Y(q) ? q : null, J = n.query.compareStartDate ? u(n.query.compareStartDate).startOf("day").toISOString() : void 0, U = n.query.compareEndDate ? u(n.query.compareEndDate).endOf("day").toISOString() : void 0, Z = n.query.isAllLocation === "true";
|
|
137
|
-
let v = [];
|
|
138
|
-
if (Z)
|
|
139
|
-
v = r.selectedLocationIds;
|
|
140
|
-
else {
|
|
141
|
-
const o = C(n.query.locationIds);
|
|
142
|
-
v = Array.isArray(o) ? o : [];
|
|
143
|
-
}
|
|
144
|
-
let S = n.query.reportId || X;
|
|
145
|
-
if (De.value.find((o) => o.id === S) || (S = X), S && S !== R.currentReportId && R.updateCurrentReportId(S), e || t) {
|
|
146
|
-
const o = r.dateRange;
|
|
147
|
-
(o.startDate !== e || o.endDate !== t) && r.setDateRange({ startDate: e, endDate: t });
|
|
148
|
-
}
|
|
149
|
-
if (a || i) {
|
|
150
|
-
const o = r.timeRange;
|
|
151
|
-
(o.start !== k || o.end !== N) && r.setTimeRange({ start: k, end: N });
|
|
152
|
-
}
|
|
153
|
-
if (J || U) {
|
|
154
|
-
const o = r.compareDateRange;
|
|
155
|
-
(o.startDate !== J || o.endDate !== U) && r.setCompareDateRange({
|
|
156
|
-
startDate: J,
|
|
157
|
-
endDate: U
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
if (!Z && Array.isArray(v)) {
|
|
161
|
-
const o = r.selectedLocationIds;
|
|
162
|
-
o.length === v.length && o.every((_e, be) => _e === v[be]) || r.setSelectedLocationIds(v);
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
// TODO: this returned value can used for getBusinessSetting
|
|
166
|
-
reportId: S,
|
|
167
|
-
startDate: n.query.startDate,
|
|
168
|
-
endDate: n.query.endDate,
|
|
169
|
-
timeStart: n.query.timeStart,
|
|
170
|
-
timeEnd: n.query.timeEnd,
|
|
171
|
-
compareStartDate: n.query.compareStartDate,
|
|
172
|
-
compareEndDate: n.query.compareEndDate,
|
|
173
|
-
locationIds: typeof n.query.locationIds == "string" ? n.query.locationIds : void 0,
|
|
174
|
-
isAllLocation: n.query.isAllLocation
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
return D(
|
|
178
|
-
() => p.value,
|
|
179
|
-
async (e, t) => {
|
|
180
|
-
!e || e === t || (r.setSelectedLocationIds([]), y.value !== void 0 && (y.value = !0), await w.replace({
|
|
181
|
-
name: n.name,
|
|
182
|
-
params: n.params,
|
|
183
|
-
query: {
|
|
184
|
-
...n.query,
|
|
185
|
-
country: e
|
|
186
|
-
}
|
|
187
|
-
}));
|
|
188
|
-
}
|
|
189
|
-
), D(
|
|
190
|
-
() => s.value,
|
|
191
|
-
async (e) => {
|
|
192
|
-
e !== "" && (E.value = !1, F(e), x.value || (r.setSelectedLocationIds([]), w.replace({
|
|
193
|
-
name: n.name,
|
|
194
|
-
params: n.params,
|
|
195
|
-
query: {
|
|
196
|
-
...n.query,
|
|
197
|
-
locationIds: void 0,
|
|
198
|
-
isAllLocation: "true"
|
|
199
|
-
}
|
|
200
|
-
})), y.value !== void 0 && (y.value = !0), await me(async () => {
|
|
201
|
-
await Re({
|
|
202
|
-
apiKey: "MaGoXrEWuEJNpWgKTqseee",
|
|
203
|
-
url: "https://flag.feedme.farm/api/v1/",
|
|
204
|
-
enableAnalytics: !1,
|
|
205
|
-
cacheFlags: !1
|
|
206
|
-
});
|
|
207
|
-
const t = await H();
|
|
208
|
-
$.value = t.version, m.value = $.value, await Promise.all([
|
|
209
|
-
de(),
|
|
210
|
-
H(),
|
|
211
|
-
ve(),
|
|
212
|
-
ye(),
|
|
213
|
-
Ie(),
|
|
214
|
-
he(),
|
|
215
|
-
O(
|
|
216
|
-
(() => {
|
|
217
|
-
const a = C(n.query.locationIds);
|
|
218
|
-
return Array.isArray(a) ? a : void 0;
|
|
219
|
-
})()
|
|
220
|
-
),
|
|
221
|
-
le()
|
|
222
|
-
]), await B(), Le(), ce(e);
|
|
223
|
-
}), E.value = !0, x.value && (x.value = !1));
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
immediate: !0
|
|
227
|
-
}
|
|
228
|
-
), D(
|
|
229
|
-
() => (E.value, {
|
|
230
|
-
reportId: Se.value,
|
|
231
|
-
selectedLocationIds: r.selectedLocationIds,
|
|
232
|
-
dateRange: r.dateRange,
|
|
233
|
-
timeRange: r.timeRange,
|
|
234
|
-
compareDateRange: r.compareDateRange
|
|
235
|
-
}),
|
|
236
|
-
(e) => {
|
|
237
|
-
if (!E.value || !e.reportId) return;
|
|
238
|
-
if (y.value) {
|
|
239
|
-
y.value = !1;
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
const t = e.selectedLocationIds, a = e.dateRange, i = e.timeRange, f = e.compareDateRange, q = {
|
|
243
|
-
...n.query,
|
|
244
|
-
reportId: e.reportId,
|
|
245
|
-
startDate: a.startDate ? u(a.startDate).startOf("day").toISOString() : void 0,
|
|
246
|
-
endDate: a.endDate ? u(a.endDate).endOf("day").toISOString() : void 0,
|
|
247
|
-
compareStartDate: f.startDate ? u(f.startDate).startOf("day").toISOString() : void 0,
|
|
248
|
-
compareEndDate: f.endDate ? u(f.endDate).endOf("day").toISOString() : void 0,
|
|
249
|
-
timeStart: i.start ? JSON.stringify(i.start) : void 0,
|
|
250
|
-
timeEnd: i.end ? JSON.stringify(i.end) : void 0,
|
|
251
|
-
locationIds: t.length === r.locations.length ? void 0 : t.length > 0 ? JSON.stringify(t) : void 0,
|
|
252
|
-
isAllLocation: String(t.length === r.locations.length)
|
|
253
|
-
}, k = JSON.stringify(n.query), N = JSON.stringify(q);
|
|
254
|
-
k !== N && w.replace({
|
|
255
|
-
name: n.name,
|
|
256
|
-
params: n.params,
|
|
257
|
-
query: q
|
|
258
|
-
});
|
|
259
|
-
},
|
|
260
|
-
{ deep: !0 }
|
|
261
|
-
), Ge(), (e, t) => {
|
|
262
|
-
const a = V("router-view");
|
|
263
|
-
return L(), Q(ke, null, [
|
|
264
|
-
W(Pe),
|
|
265
|
-
c(m) === "v3" ? (L(), Q("iframe", {
|
|
266
|
-
key: 0,
|
|
267
|
-
class: "bg-white h-full w-full",
|
|
268
|
-
src: pe.value
|
|
269
|
-
}, null, 8, Ke)) : c(m) === "v4" ? (L(), Q("iframe", {
|
|
270
|
-
key: 1,
|
|
271
|
-
class: "bg-white h-full w-full",
|
|
272
|
-
src: ge.value
|
|
273
|
-
}, null, 8, He)) : (L(), ie(a, { key: 2 }))
|
|
274
|
-
], 64);
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
export {
|
|
279
|
-
it as default
|
|
280
|
-
};
|