@feedmepos/mf-report 5.22.25 → 5.22.26

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