@feedmepos/mf-report 5.27.44 → 5.27.45-beta.0

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 (28) hide show
  1. package/dist/App-BDN_oCWD.js +334 -0
  2. package/dist/{DateRangeSelect-CGnROjSA.js → DateRangeSelect-Cg1VmOTP.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-B0E17Ovn.js → Default.vue_vue_type_script_setup_true_lang-CqEWKcEI.js} +1 -1
  4. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-DeajLQvr.js → DynamicWidget.vue_vue_type_script_setup_true_lang-yPSAIoY4.js} +808 -807
  5. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CqKnPfjr.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-TDuMyvpD.js} +2234 -2227
  6. package/dist/{InsightView-DLi1JKj-.js → InsightView-DwcchpMl.js} +4 -4
  7. package/dist/{Integration-DcpEli4G.js → Integration-CCTAv2GE.js} +3 -3
  8. package/dist/{Integrations-FqE3NGWW.js → Integrations-H6r5l4n8.js} +2 -2
  9. package/dist/{Layout-B3w9ncrY.js → Layout-CHHE19a9.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-DEZ9szG8.js → MenuTab.vue_vue_type_script_setup_true_lang-Bp0NNmvl.js} +4 -4
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-hq2_fG5m.js → NavigationTab.vue_vue_type_script_setup_true_lang-PJl70Kps.js} +3 -3
  12. package/dist/{OverviewView-C2q5HVfG.js → OverviewView-BCopzhD8.js} +4 -4
  13. package/dist/{Report-CpD-PQMF.js → Report-vzjmZsgz.js} +34 -34
  14. package/dist/{ReportEditor-DY8bRLmi.js → ReportEditor-RFtyQYz9.js} +6 -6
  15. package/dist/{ReportView-kvAnnQQX.js → ReportView-Dw7Pyrof.js} +6 -6
  16. package/dist/Setting-CVCBXpgH.js +368 -0
  17. package/dist/{Template-C-whg_Qs.js → Template-D55ImnjL.js} +3 -3
  18. package/dist/{TileEditor-MvSW8uIv.js → TileEditor-UeAySh58.js} +5 -5
  19. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-cNbphYz8.js → TilePageStack.vue_vue_type_script_setup_true_lang-B-1x9lDM.js} +2 -2
  20. package/dist/{TransitionFade-DqK-1YJF.js → TransitionFade-D9bY1-O3.js} +4 -4
  21. package/dist/{app-Dpk_iYcH.js → app-be5FSDOt.js} +9264 -9269
  22. package/dist/app.js +1 -1
  23. package/dist/assets/{formatChartData.worker-NxArcyZE.js → formatChartData.worker-C93JSHxi.js} +5 -5
  24. package/dist/assets/{processTableData.worker-typkqQfh.js → processTableData.worker-BsZijJg_.js} +5 -5
  25. package/dist/{useRestaurantPermission-B5HIst3o.js → useRestaurantPermission-DSmmokEm.js} +1 -1
  26. package/package.json +2 -1
  27. package/dist/App-B-0VHXM1.js +0 -336
  28. package/dist/Setting-DIfsQKq7.js +0 -366
@@ -0,0 +1,334 @@
1
+ import { defineComponent as me, resolveComponent as V, createBlock as pe, openBlock as A, unref as u, isRef as Be, withCtx as G, createElementVNode as ae, createVNode as Y, toDisplayString as oe, createTextVNode as Fe, onMounted as fe, watch as C, ref as U, computed as se, onBeforeMount as $e, onBeforeUnmount as xe, createElementBlock as H, Fragment as Je } from "vue";
2
+ import { detectLocale as j, useCoreStore as X } from "@feedmepos/mf-common";
3
+ import { d as q, u as Qe, a as ie, b as Ue, c as ce, e as je, f as We, g as de } from "./app-be5FSDOt.js";
4
+ import { storeToRefs as k } from "pinia";
5
+ import { u as Ke, a as Pe } from "./_plugin-vue_export-helper-kkiiQoKl.js";
6
+ import { u as Ge, a as He } from "./GlobalFilterSelect.vue_vue_type_script_setup_true_lang-TDuMyvpD.js";
7
+ import { u as Xe, _ as Ve } from "./NavigationTab.vue_vue_type_script_setup_true_lang-PJl70Kps.js";
8
+ import { u as ue } from "./message-dialog-UoMWOnil.js";
9
+ import { useRoute as Ye, useRouter as Ze } from "vue-router";
10
+ const Me = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, et = /* @__PURE__ */ me({
11
+ __name: "Dialog",
12
+ setup(T) {
13
+ const { t: c } = Ke(), f = ue(), { isOpened: g, message: R, title: L } = k(ue());
14
+ return (O, _) => {
15
+ const z = V("FmButton"), W = V("FmDialog");
16
+ return A(), pe(W, {
17
+ modelValue: u(g),
18
+ "onUpdate:modelValue": _[0] || (_[0] = (K) => Be(g) ? g.value = K : null),
19
+ overlay: "",
20
+ "close-button": !1,
21
+ "z-index": 3e3
22
+ }, {
23
+ "dialog-header": G(() => [
24
+ Fe(oe(u(L)), 1)
25
+ ]),
26
+ default: G(() => [
27
+ ae("p", Me, oe(u(R)), 1)
28
+ ]),
29
+ "dialog-footer": G(() => [
30
+ _[1] || (_[1] = ae("div", { class: "grow" }, null, -1)),
31
+ Y(z, {
32
+ label: u(c)("report.common.cancel"),
33
+ variant: "tertiary",
34
+ onClick: u(f).dismiss
35
+ }, null, 8, ["label", "onClick"]),
36
+ Y(z, {
37
+ label: u(c)("report.common.confirm"),
38
+ onClick: u(f).confirm
39
+ }, null, 8, ["label", "onClick"])
40
+ ]),
41
+ _: 1
42
+ }, 8, ["modelValue"]);
43
+ };
44
+ }
45
+ }), le = U(j());
46
+ function tt() {
47
+ const T = (c) => {
48
+ switch (le.value = c, c) {
49
+ case "zh-CN":
50
+ q.locale("zh-cn");
51
+ break;
52
+ default:
53
+ q.locale("en");
54
+ break;
55
+ }
56
+ };
57
+ return fe(() => {
58
+ T(j());
59
+ }), C(() => j(), T, { deep: !0, immediate: !0 }), {
60
+ currentLocale: le
61
+ };
62
+ }
63
+ q.locale(j() === "zh-CN" ? "zh-cn" : "en");
64
+ const nt = ["src"], rt = ["src"], ft = /* @__PURE__ */ me({
65
+ __name: "App",
66
+ setup(T) {
67
+ const { businessId: c, token: f, country: g } = k(Qe()), { sessionUser: R, currentBusiness: L, currentCountry: O, registerSidebarComponent: _ } = X(), {
68
+ getRestaurantAndWarehouse: z,
69
+ getBusinessSetting: W,
70
+ beginBusinessLoad: K,
71
+ completeBusinessLoad: ge,
72
+ resetTimezoneContext: ye
73
+ } = ie(), ve = Ue(), { getFeatureFlags: Se } = ve, { version: y } = k(ce()), { getSettings: De } = je(), { promptLoader: he } = Pe(), n = Ye(), N = Ze(), E = Ge(), Z = Xe(), o = ie(), B = ce(), { suppressReportRouteSync: F } = k(B), { getReports: Ie, getOverviewReport: _e, getReportConfig: Re, currentReportId: M } = E, { currentReportId: Le, reports: Ee } = k(E), { getSchema: be } = He(), { fetchSchedules: we } = Z, { init: Ae } = We(), P = U("v5"), $ = U(!1), x = U(!0), Ce = se(() => `https://portal-v1.feedmedev.cc/b/${c.value}/report/CLOSE_UP?showHeader=false&country=${g.value.toUpperCase()}&menuOption=business-report&token=${f.value}&v2=true&reportV5Button=true`), ke = se(() => `https://report-v4.feedmedev.cc?businessId=${c.value}&country=${g.value}&token=${f.value}&reportV3Button=true`);
74
+ C(
75
+ [() => L.value, () => R.value, () => O.value],
76
+ () => {
77
+ var e, r;
78
+ const t = ((e = L.value) == null ? void 0 : e.id) ?? "";
79
+ L.value && R.value && O.value && (c.value !== t && (c.value = t), f.value = ((r = R.value) == null ? void 0 : r.token) ?? "", g.value = O.value ?? "");
80
+ },
81
+ { immediate: !0 }
82
+ );
83
+ function ee(t) {
84
+ if (typeof t.data == "string")
85
+ try {
86
+ const e = JSON.parse(t.data);
87
+ (e == null ? void 0 : e.token) !== "" && (e == null ? void 0 : e.token) !== void 0 && (f.value = e.token);
88
+ } catch (e) {
89
+ console.error(e);
90
+ }
91
+ }
92
+ function te(t) {
93
+ if (typeof t.data == "string")
94
+ try {
95
+ const e = JSON.parse(t.data);
96
+ (e == null ? void 0 : e.v5) === !0 ? y.value = P.value : (e == null ? void 0 : e.v3) === !0 && (y.value = "v3");
97
+ } catch (e) {
98
+ console.error(e);
99
+ }
100
+ }
101
+ C(y, () => {
102
+ ["v3", "v4"].includes(y.value) ? X().hideSidebarToggle(!0) : X().hideSidebarToggle(!1);
103
+ }), $e(() => {
104
+ _(Ve);
105
+ }), fe(() => {
106
+ console.log("5.27.45-beta.0", !0), window.addEventListener("message", ee), window.addEventListener("message", te);
107
+ }), xe(() => {
108
+ window.removeEventListener("message", ee), window.removeEventListener("message", te), E.$dispose(), Z.$dispose();
109
+ });
110
+ function qe(t) {
111
+ try {
112
+ return decodeURIComponent(t);
113
+ } catch {
114
+ return t;
115
+ }
116
+ }
117
+ function J(t) {
118
+ if (typeof t != "string" || t.length === 0) return;
119
+ const e = t.includes("%") ? [t, qe(t)] : [t];
120
+ for (const r of e)
121
+ try {
122
+ const a = JSON.parse(r);
123
+ if (typeof a == "string")
124
+ try {
125
+ return JSON.parse(a);
126
+ } catch {
127
+ return a;
128
+ }
129
+ return a;
130
+ } catch {
131
+ }
132
+ }
133
+ function ne(t) {
134
+ if (!t || typeof t != "object") return !1;
135
+ const e = t;
136
+ return typeof e.hour == "number" && typeof e.minute == "number";
137
+ }
138
+ function l(t, e, r) {
139
+ if (typeof t != "string" || t.length === 0) return;
140
+ const a = t.includes("T") ? q(t).tz(r) : q.tz(t, r);
141
+ return (e === "start" ? a.startOf("day") : a.endOf("day")).utc().toISOString();
142
+ }
143
+ function Te(t = n.query) {
144
+ const e = t, r = o.timezone, a = l(e.startDate, "start", r), d = l(e.endDate, "end", r), i = typeof e.timeStart == "string", v = typeof e.timeEnd == "string", S = J(e.timeStart), D = J(e.timeEnd), b = ne(S) ? S : null, h = ne(D) ? D : null, m = l(e.compareStartDate, "start", r), w = l(e.compareEndDate, "end", r), Q = e.isAllLocation === "true" || e.isAllLocation === void 0;
145
+ let p = [];
146
+ if (Q)
147
+ p = o.selectedLocationIds ?? [];
148
+ else {
149
+ const s = J(e.locationIds);
150
+ p = Array.isArray(s) ? s : [];
151
+ }
152
+ let I = e.reportId || M;
153
+ if (Ee.value.find((s) => s.id === I) || (I = M), I && I !== E.currentReportId && E.updateCurrentReportId(I), a || d) {
154
+ const s = o.dateRange;
155
+ (s.startDate !== a || s.endDate !== d) && o.setDateRange({ startDate: a, endDate: d });
156
+ }
157
+ if (i || v) {
158
+ const s = o.timeRange;
159
+ (s.start !== b || s.end !== h) && o.setTimeRange({ start: b, end: h });
160
+ }
161
+ if (m || w) {
162
+ const s = o.compareDateRange;
163
+ (s.startDate !== m || s.endDate !== w) && o.setCompareDateRange({
164
+ startDate: m,
165
+ endDate: w
166
+ });
167
+ }
168
+ if (!Q) {
169
+ const s = o.selectedLocationIds;
170
+ s.length === p.length && s.every((ze, Ne) => ze === p[Ne]) || o.setSelectedLocationIds(p);
171
+ }
172
+ return {
173
+ // TODO: this returned value can used for getBusinessSetting
174
+ reportId: I,
175
+ startDate: e.startDate,
176
+ endDate: e.endDate,
177
+ timeStart: e.timeStart,
178
+ timeEnd: e.timeEnd,
179
+ compareStartDate: e.compareStartDate,
180
+ compareEndDate: e.compareEndDate,
181
+ locationIds: typeof e.locationIds == "string" ? e.locationIds : void 0,
182
+ isAllLocation: e.isAllLocation
183
+ };
184
+ }
185
+ return C(
186
+ () => c.value,
187
+ async (t, e) => {
188
+ if (t !== "") {
189
+ $.value = !1, K(t);
190
+ const r = "mf-report-prev-business-id", a = (() => {
191
+ try {
192
+ return sessionStorage.getItem(r);
193
+ } catch {
194
+ return null;
195
+ }
196
+ })(), d = !!a && a !== t;
197
+ let i = { ...n.query }, v = !1;
198
+ if (!x.value || e !== void 0 || d) {
199
+ ye(), o.setSelectedLocationIds([]);
200
+ const {
201
+ locationIds: S,
202
+ startDate: D,
203
+ endDate: b,
204
+ timeStart: h,
205
+ timeEnd: m,
206
+ compareStartDate: w,
207
+ compareEndDate: Q,
208
+ ...p
209
+ } = n.query;
210
+ i = {
211
+ ...p,
212
+ isAllLocation: "true"
213
+ }, v = !0, await N.replace({
214
+ name: n.name,
215
+ params: n.params,
216
+ query: i
217
+ });
218
+ }
219
+ F.value !== void 0 && (F.value = !0), await he(async () => {
220
+ await Ae({
221
+ apiKey: "MaGoXrEWuEJNpWgKTqseee",
222
+ url: "https://flag.feedme.farm/api/v1/",
223
+ enableAnalytics: !1,
224
+ cacheFlags: !1
225
+ });
226
+ const S = await Re();
227
+ P.value = S.version, y.value = P.value, await Se(), n.name === "template" && !B.canAccessTemplate() && await N.replace({
228
+ name: "reports",
229
+ query: n.query
230
+ });
231
+ const D = B.canAccess(
232
+ de.report_accessOverview
233
+ ), b = B.canAccess(
234
+ de.report_accessIntegration
235
+ ), h = [
236
+ be(),
237
+ we(),
238
+ Ie(),
239
+ z(
240
+ (() => {
241
+ const m = J(i.locationIds);
242
+ return Array.isArray(m) ? m : void 0;
243
+ })()
244
+ )
245
+ ];
246
+ if (D && h.push(_e()), b && h.push(De()), await Promise.all(h), await W(), Te(i), v) {
247
+ const {
248
+ locationIds: m,
249
+ startDate: w,
250
+ endDate: Q,
251
+ timeStart: p,
252
+ timeEnd: I,
253
+ compareStartDate: Oe,
254
+ compareEndDate: s,
255
+ ...re
256
+ } = n.query;
257
+ (n.query.locationIds !== void 0 || n.query.startDate !== void 0 || n.query.endDate !== void 0 || n.query.timeStart !== void 0 || n.query.timeEnd !== void 0 || n.query.compareStartDate !== void 0 || n.query.compareEndDate !== void 0 || n.query.isAllLocation !== "true") && await N.replace({
258
+ name: n.name,
259
+ params: n.params,
260
+ query: {
261
+ ...re,
262
+ isAllLocation: "true"
263
+ }
264
+ });
265
+ }
266
+ ge(t);
267
+ try {
268
+ sessionStorage.setItem(r, t);
269
+ } catch {
270
+ }
271
+ }), $.value = !0, x.value && (x.value = !1);
272
+ }
273
+ },
274
+ {
275
+ immediate: !0
276
+ }
277
+ ), C(
278
+ () => ($.value, {
279
+ reportId: Le.value,
280
+ selectedLocationIds: o.selectedLocationIds,
281
+ dateRange: o.dateRange,
282
+ timeRange: o.timeRange,
283
+ compareDateRange: o.compareDateRange,
284
+ timezone: o.timezone
285
+ }),
286
+ (t) => {
287
+ if (!$.value || !t.reportId || x.value) return;
288
+ if (F.value) {
289
+ F.value = !1;
290
+ return;
291
+ }
292
+ const e = t.selectedLocationIds, r = t.dateRange, a = t.timeRange, d = t.compareDateRange, i = {
293
+ ...n.query,
294
+ reportId: t.reportId,
295
+ startDate: l(r.startDate, "start", t.timezone),
296
+ endDate: l(r.endDate, "end", t.timezone),
297
+ compareStartDate: l(
298
+ d.startDate,
299
+ "start",
300
+ t.timezone
301
+ ),
302
+ compareEndDate: l(d.endDate, "end", t.timezone),
303
+ timeStart: a.start ? JSON.stringify(a.start) : void 0,
304
+ timeEnd: a.end ? JSON.stringify(a.end) : void 0
305
+ }, v = e.length === o.locations.length;
306
+ i.isAllLocation = String(v), v ? delete i.locationIds : e.length > 0 ? i.locationIds = JSON.stringify(e) : delete i.locationIds;
307
+ const S = JSON.stringify(n.query), D = JSON.stringify(i);
308
+ S !== D && N.replace({
309
+ name: n.name,
310
+ params: n.params,
311
+ query: i
312
+ });
313
+ },
314
+ { deep: !0 }
315
+ ), tt(), (t, e) => {
316
+ const r = V("router-view");
317
+ return A(), H(Je, null, [
318
+ Y(et),
319
+ u(y) === "v3" ? (A(), H("iframe", {
320
+ key: 0,
321
+ class: "bg-white h-full w-full",
322
+ src: Ce.value
323
+ }, null, 8, nt)) : u(y) === "v4" ? (A(), H("iframe", {
324
+ key: 1,
325
+ class: "bg-white h-full w-full",
326
+ src: ke.value
327
+ }, null, 8, rt)) : (A(), pe(r, { key: 2 }))
328
+ ], 64);
329
+ };
330
+ }
331
+ });
332
+ export {
333
+ ft as default
334
+ };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as se, resolveComponent as Y, createBlock as R, openBlock as p, normalizeClass as Ce, withCtx as V, createCommentVNode as F, createElementVNode as N, toDisplayString as pe, renderSlot as Re, mergeModels as Q, useModel as j, ref as A, computed as B, watch as x, nextTick as Z, onMounted as Se, onBeforeUnmount as xe, createElementBlock as be, unref as P, createVNode as ee } from "vue";
2
- import { d as m, a as Pe, C as $, j as Ee } from "./app-Dpk_iYcH.js";
2
+ import { d as m, a as Pe, C as $, j as Ee } from "./app-be5FSDOt.js";
3
3
  import { detectLocale as te } from "@feedmepos/mf-common";
4
4
  import { u as Te, _ as we } from "./_plugin-vue_export-helper-kkiiQoKl.js";
5
5
  import { storeToRefs as Me } 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-hq2_fG5m.js";
2
+ import { _ as v } from "./NavigationTab.vue_vue_type_script_setup_true_lang-PJl70Kps.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 "./_plugin-vue_export-helper-kkiiQoKl.js";