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