@feedmepos/mf-report 5.22.14-beta.1 → 5.22.14-beta.2

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 (31) hide show
  1. package/dist/App-Cwppqefm.js +294 -0
  2. package/dist/{BaseDialog.vue_vue_type_script_setup_true_lang-y0a3M2lr.js → BaseDialog.vue_vue_type_script_setup_true_lang-CcKWqqNP.js} +471 -464
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-dgYQfqt3.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-CryPHoYr.js} +2 -2
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-vyGbLkA7.js → Default.vue_vue_type_script_setup_true_lang-DU3zkEF1.js} +2 -2
  5. package/dist/{FilterSelector.vue_vue_type_script_setup_true_lang-BeV_1pF8.js → FilterSelector.vue_vue_type_script_setup_true_lang-CyW-5xr4.js} +7 -7
  6. package/dist/{InsightView-B5_QE34m.js → InsightView-DAnaBH3D.js} +6 -6
  7. package/dist/{Integration-B2bgJdTE.js → Integration-DiNs52W5.js} +5 -5
  8. package/dist/{Integrations-C6YcY_Dg.js → Integrations-BvgLRF5N.js} +5 -5
  9. package/dist/{Layout-DLFGZDGB.js → Layout-BAYV4nCo.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-wfO2kt-1.js → MenuTab.vue_vue_type_script_setup_true_lang-BZphMQGv.js} +5 -5
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-CbE2APx_.js → NavigationTab.vue_vue_type_script_setup_true_lang-DSTG-gQ3.js} +5 -5
  12. package/dist/{NoData.vue_vue_type_script_setup_true_lang-0xe7g6GF.js → NoData.vue_vue_type_script_setup_true_lang-zS79GrjC.js} +1 -1
  13. package/dist/{OverviewView-CFdbAJ37.js → OverviewView-CvRMdLbB.js} +5 -5
  14. package/dist/{Report-DQ-h0U1V.js → Report-C6445626.js} +5 -5
  15. package/dist/{ReportEditor-C7LQ-dj9.js → ReportEditor-Cy8f2WFu.js} +6 -6
  16. package/dist/{ReportView-Cjy1IaQR.js → ReportView-D-T3b10U.js} +9 -9
  17. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-b6HH2Okb.js → SelectComponent.vue_vue_type_script_setup_true_lang-CYDZzbCU.js} +1 -1
  18. package/dist/{Setting-HJZyV4_h.js → Setting-DBzyuCx-.js} +5 -5
  19. package/dist/{TileEditor-X2xfvbVU.js → TileEditor-CWYE5X71.js} +275 -268
  20. package/dist/{TransitionFade-B8QLlvOD.js → TransitionFade-DwQjFIYA.js} +101 -99
  21. package/dist/{access-Dw5cDt65-CIFCooJk.js → access-Dw5cDt65-C2c0R9q4.js} +1 -1
  22. package/dist/{app-C0tWx-LR.js → app-BRv3iLF1.js} +11 -11
  23. package/dist/app.js +1 -1
  24. package/dist/assets/{formatChartData.worker-CtCG_oop.js → formatChartData.worker-Df5ziPQ2.js} +7 -7
  25. package/dist/assets/{processTableData.worker-BN2TZ-50.js → processTableData.worker-qpA30azs.js} +7 -7
  26. package/dist/style.css +1 -1
  27. package/dist/{useReportPermission-e_2_1--f.js → useReportPermission-CDWkdi6R.js} +2 -2
  28. package/dist/{useRestaurantPermission-B0BaYXp-.js → useRestaurantPermission-CjG_t7dK.js} +2 -2
  29. package/dist/{vue-i18n-C-KQ1kb-.js → vue-i18n-ComGWqEb.js} +1 -1
  30. package/package.json +1 -1
  31. package/dist/App-D23GxkV1.js +0 -264
@@ -0,0 +1,294 @@
1
+ import { defineComponent as ce, resolveComponent as K, createBlock as de, openBlock as O, unref as l, isRef as Ce, withCtx as j, createElementVNode as te, createVNode as P, toDisplayString as ne, createTextVNode as ke, onMounted as ue, watch as b, ref as B, computed as oe, onBeforeMount as Ae, onBeforeUnmount as Ne, createElementBlock as V, Fragment as Te } from "vue";
2
+ import { detectLocale as F, useCoreStore as W } from "@feedmepos/mf-common";
3
+ import { u as $e, a as Be, b as re, c as Fe, d as qe, e as xe, f as Je, s as Qe } from "./vue-i18n-ComGWqEb.js";
4
+ import { storeToRefs as w } from "pinia";
5
+ import { u as ae, a as Ue, b as ze } from "./BaseDialog.vue_vue_type_script_setup_true_lang-CcKWqqNP.js";
6
+ import { u as je, _ as Ve } from "./NavigationTab.vue_vue_type_script_setup_true_lang-DSTG-gQ3.js";
7
+ import { u as se } from "./message-dialog-UoMWOnil.js";
8
+ import { d } from "./app-BRv3iLF1.js";
9
+ import { useRoute as We, useRouter as Ke } from "vue-router";
10
+ const Pe = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, Ge = /* @__PURE__ */ ce({
11
+ __name: "Dialog",
12
+ setup(E) {
13
+ const { t: c } = $e(), p = se(), { isOpened: g, message: I, title: h } = w(se());
14
+ return (R, S) => {
15
+ const C = K("FmButton"), q = K("FmDialog");
16
+ return O(), de(q, {
17
+ modelValue: l(g),
18
+ "onUpdate:modelValue": S[0] || (S[0] = (x) => Ce(g) ? g.value = x : null),
19
+ overlay: "",
20
+ "close-button": !1
21
+ }, {
22
+ "dialog-header": j(() => [
23
+ ke(ne(l(h)), 1)
24
+ ]),
25
+ default: j(() => [
26
+ te("p", Pe, ne(l(I)), 1)
27
+ ]),
28
+ "dialog-footer": j(() => [
29
+ S[1] || (S[1] = te("div", { class: "grow" }, null, -1)),
30
+ P(C, {
31
+ label: l(c)("report.common.cancel"),
32
+ variant: "tertiary",
33
+ onClick: l(p).dismiss
34
+ }, null, 8, ["label", "onClick"]),
35
+ P(C, {
36
+ label: l(c)("report.common.confirm"),
37
+ onClick: l(p).confirm
38
+ }, null, 8, ["label", "onClick"])
39
+ ]),
40
+ _: 1
41
+ }, 8, ["modelValue"]);
42
+ };
43
+ }
44
+ }), ie = B(F());
45
+ function He() {
46
+ const E = (c) => {
47
+ switch (ie.value = c, c) {
48
+ case "zh-CN":
49
+ d.locale("zh-cn");
50
+ break;
51
+ default:
52
+ d.locale("en");
53
+ break;
54
+ }
55
+ };
56
+ return ue(() => {
57
+ E(F());
58
+ }), b(() => F(), E, { deep: !0, immediate: !0 }), {
59
+ currentLocale: ie
60
+ };
61
+ }
62
+ d.locale(F() === "zh-CN" ? "zh-cn" : "en");
63
+ const Xe = ["src"], Ye = ["src"], ut = /* @__PURE__ */ ce({
64
+ __name: "App",
65
+ setup(E) {
66
+ const { businessId: c, token: p, country: g } = w(Be()), { sessionUser: I, currentBusiness: h, currentCountry: R, registerSidebarComponent: S } = W(), { getRestaurantAndWarehouse: C, getBusinessSetting: q, beginBusinessLoad: x, completeBusinessLoad: le } = re(), { getFeatureFlags: fe } = Fe(), { version: y } = w(ae()), { getSettings: me } = qe(), { promptLoader: pe } = xe(), s = We(), J = Ke(), L = Ue(), G = je(), a = re(), ge = ae(), { suppressReportRouteSync: k } = w(ge), { getReports: ye, getOverviewReport: ve, getReportConfig: H, currentReportId: X } = L, { currentReportId: Se, reports: De } = w(L), { getSchema: Ie } = ze(), { fetchSchedules: he } = G, { init: Re } = Je(), Q = B("v5"), A = B(!1), N = B(!0), Le = oe(() => `https://portal-v1.feedmedev.cc/b/${c.value}/report/CLOSE_UP?showHeader=false&country=${g.value.toUpperCase()}&menuOption=business-report&token=${p.value}&v2=true&reportV5Button=true`), _e = oe(() => `https://report-v4.feedmedev.cc?businessId=${c.value}&country=${g.value}&token=${p.value}&reportV3Button=true`);
67
+ b(
68
+ [() => h.value, () => I.value, () => R.value],
69
+ () => {
70
+ var e, n;
71
+ const t = ((e = h.value) == null ? void 0 : e.id) ?? "";
72
+ h.value && I.value && R.value && (Qe(R.value), c.value !== t && (c.value = t), p.value = ((n = I.value) == null ? void 0 : n.token) ?? "", g.value = R.value ?? "");
73
+ },
74
+ { immediate: !0 }
75
+ );
76
+ function Y(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 Z(t) {
86
+ if (typeof t.data == "string")
87
+ try {
88
+ const e = JSON.parse(t.data);
89
+ (e == null ? void 0 : e.v5) === !0 ? y.value = Q.value : (e == null ? void 0 : e.v3) === !0 && (y.value = "v3");
90
+ } catch (e) {
91
+ console.error(e);
92
+ }
93
+ }
94
+ b(y, () => {
95
+ ["v3", "v4"].includes(y.value) ? W().hideSidebarToggle(!0) : W().hideSidebarToggle(!1);
96
+ }), Ae(() => {
97
+ S(Ve);
98
+ }), ue(() => {
99
+ console.log("5.22.14-beta.2", !0), window.addEventListener("message", Y), window.addEventListener("message", Z);
100
+ }), Ne(() => {
101
+ window.removeEventListener("message", Y), window.removeEventListener("message", Z), L.$dispose(), G.$dispose();
102
+ });
103
+ function Oe(t) {
104
+ try {
105
+ return decodeURIComponent(t);
106
+ } catch {
107
+ return t;
108
+ }
109
+ }
110
+ function T(t) {
111
+ if (typeof t != "string" || t.length === 0) return;
112
+ const e = t.includes("%") ? [t, Oe(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 M(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 ? d(e.startDate).startOf("day").toISOString() : void 0, o = e.endDate ? d(e.endDate).endOf("day").toISOString() : void 0, f = typeof e.timeStart == "string", i = typeof e.timeEnd == "string", m = T(e.timeStart), v = T(e.timeEnd), u = M(m) ? m : null, $ = M(v) ? v : null, U = e.compareStartDate ? d(e.compareStartDate).startOf("day").toISOString() : void 0, z = e.compareEndDate ? d(e.compareEndDate).endOf("day").toISOString() : void 0, ee = e.isAllLocation === "true" || e.isAllLocation === void 0;
133
+ let _ = [];
134
+ if (ee)
135
+ _ = a.selectedLocationIds ?? [];
136
+ else {
137
+ const r = T(e.locationIds);
138
+ _ = Array.isArray(r) ? r : [];
139
+ }
140
+ let D = e.reportId || X;
141
+ if (De.value.find((r) => r.id === D) || (D = X), D && D !== L.currentReportId && L.updateCurrentReportId(D), n || o) {
142
+ const r = a.dateRange;
143
+ (r.startDate !== n || r.endDate !== o) && a.setDateRange({ startDate: n, endDate: o });
144
+ }
145
+ if (f || i) {
146
+ const r = a.timeRange;
147
+ (r.start !== u || r.end !== $) && a.setTimeRange({ start: u, end: $ });
148
+ }
149
+ if (U || z) {
150
+ const r = a.compareDateRange;
151
+ (r.startDate !== U || r.endDate !== z) && a.setCompareDateRange({
152
+ startDate: U,
153
+ endDate: z
154
+ });
155
+ }
156
+ if (!ee) {
157
+ const r = a.selectedLocationIds;
158
+ r.length === _.length && r.every((we, Ee) => we === _[Ee]) || a.setSelectedLocationIds(_);
159
+ }
160
+ return {
161
+ // TODO: this returned value can used for getBusinessSetting
162
+ reportId: D,
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 b(
174
+ () => c.value,
175
+ async (t, e) => {
176
+ if (t !== "") {
177
+ A.value = !1, x(t);
178
+ const n = "mf-report-prev-business-id", o = (() => {
179
+ try {
180
+ return sessionStorage.getItem(n);
181
+ } catch {
182
+ return null;
183
+ }
184
+ })(), f = !!o && o !== t;
185
+ let i = { ...s.query }, m = !1;
186
+ if (!N.value || e !== void 0 || f) {
187
+ a.setSelectedLocationIds([]);
188
+ const { locationIds: v, ...u } = s.query;
189
+ i = {
190
+ ...u,
191
+ isAllLocation: "true"
192
+ }, m = !0, await J.replace({
193
+ name: s.name,
194
+ params: s.params,
195
+ query: i
196
+ });
197
+ }
198
+ k.value !== void 0 && (k.value = !0), await pe(async () => {
199
+ await Re({
200
+ apiKey: "MaGoXrEWuEJNpWgKTqseee",
201
+ url: "https://flag.feedme.farm/api/v1/",
202
+ enableAnalytics: !1,
203
+ cacheFlags: !1
204
+ });
205
+ const v = await H();
206
+ if (Q.value = v.version, y.value = Q.value, await Promise.all([
207
+ fe(),
208
+ H(),
209
+ ve(),
210
+ ye(),
211
+ Ie(),
212
+ he(),
213
+ C(
214
+ (() => {
215
+ const u = T(i.locationIds);
216
+ return Array.isArray(u) ? u : void 0;
217
+ })()
218
+ ),
219
+ me()
220
+ ]), await q(), be(i), m) {
221
+ const { locationIds: u, ...$ } = s.query;
222
+ (s.query.locationIds !== void 0 || s.query.isAllLocation !== "true") && await J.replace({
223
+ name: s.name,
224
+ params: s.params,
225
+ query: {
226
+ ...$,
227
+ isAllLocation: "true"
228
+ }
229
+ });
230
+ }
231
+ le(t);
232
+ try {
233
+ sessionStorage.setItem(n, t);
234
+ } catch {
235
+ }
236
+ }), A.value = !0, N.value && (N.value = !1);
237
+ }
238
+ },
239
+ {
240
+ immediate: !0
241
+ }
242
+ ), b(
243
+ () => (A.value, {
244
+ reportId: Se.value,
245
+ selectedLocationIds: a.selectedLocationIds,
246
+ dateRange: a.dateRange,
247
+ timeRange: a.timeRange,
248
+ compareDateRange: a.compareDateRange
249
+ }),
250
+ (t) => {
251
+ if (!A.value || !t.reportId || N.value) return;
252
+ if (k.value) {
253
+ k.value = !1;
254
+ return;
255
+ }
256
+ const e = t.selectedLocationIds, n = t.dateRange, o = t.timeRange, f = t.compareDateRange, i = {
257
+ ...s.query,
258
+ reportId: t.reportId,
259
+ startDate: n.startDate ? d(n.startDate).startOf("day").toISOString() : void 0,
260
+ endDate: n.endDate ? d(n.endDate).endOf("day").toISOString() : void 0,
261
+ compareStartDate: f.startDate ? d(f.startDate).startOf("day").toISOString() : void 0,
262
+ compareEndDate: f.endDate ? d(f.endDate).endOf("day").toISOString() : void 0,
263
+ timeStart: o.start ? JSON.stringify(o.start) : void 0,
264
+ timeEnd: o.end ? JSON.stringify(o.end) : void 0
265
+ }, m = e.length === a.locations.length;
266
+ i.isAllLocation = String(m), m ? delete i.locationIds : e.length > 0 ? i.locationIds = JSON.stringify(e) : delete i.locationIds;
267
+ const v = JSON.stringify(s.query), u = JSON.stringify(i);
268
+ v !== u && J.replace({
269
+ name: s.name,
270
+ params: s.params,
271
+ query: i
272
+ });
273
+ },
274
+ { deep: !0 }
275
+ ), He(), (t, e) => {
276
+ const n = K("router-view");
277
+ return O(), V(Te, null, [
278
+ P(Ge),
279
+ l(y) === "v3" ? (O(), V("iframe", {
280
+ key: 0,
281
+ class: "bg-white h-full w-full",
282
+ src: Le.value
283
+ }, null, 8, Xe)) : l(y) === "v4" ? (O(), V("iframe", {
284
+ key: 1,
285
+ class: "bg-white h-full w-full",
286
+ src: _e.value
287
+ }, null, 8, Ye)) : (O(), de(n, { key: 2 }))
288
+ ], 64);
289
+ };
290
+ }
291
+ });
292
+ export {
293
+ ut as default
294
+ };