@feedmepos/mf-report 5.25.7 → 5.25.8

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