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