@feedmepos/mf-report 5.21.27 → 5.21.28

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,28 +1,28 @@
1
- import { defineComponent as ee, resolveComponent as U, createBlock as te, openBlock as h, unref as u, isRef as Ie, withCtx as J, createElementVNode as W, createVNode as z, toDisplayString as H, createTextVNode as he, onMounted as ae, watch as R, ref as k, computed as K, onBeforeMount as Re, onBeforeUnmount as qe, createElementBlock as A, Fragment as Oe } from "vue";
1
+ import { defineComponent as ee, resolveComponent as U, createBlock as te, openBlock as q, unref as u, isRef as Ie, withCtx as J, createElementVNode as W, createVNode as z, toDisplayString as H, createTextVNode as he, onMounted as ae, watch as S, ref as C, computed as K, onBeforeMount as Re, onBeforeUnmount as qe, createElementBlock as A, Fragment as Le } from "vue";
2
2
  import { detectLocale as E, useCoreStore as T } from "@feedmepos/mf-common";
3
- import { u as Le, d as i, a as _e, b as X, c as we, e as be, f as Ce, s as ke, g as Ee } from "./vue-i18n-D1iec8Wy.js";
4
- import { storeToRefs as q } from "pinia";
3
+ import { u as Oe, d as i, a as _e, b as X, c as be, e as we, f as ke, s as Ce, g as Ee } from "./vue-i18n-D1iec8Wy.js";
4
+ import { storeToRefs as L } from "pinia";
5
5
  import { u as Y, a as Ne, b as Be } from "./BaseDialog.vue_vue_type_script_setup_true_lang-QzLGWBvd.js";
6
- import { _ as Fe, u as $e } from "./NavigationTab.vue_vue_type_script_setup_true_lang-M3kgeSAQ.js";
6
+ import { u as Fe, _ as $e } from "./NavigationTab.vue_vue_type_script_setup_true_lang-M3kgeSAQ.js";
7
7
  import { u as Z } from "./message-dialog-UoMWOnil.js";
8
8
  import { useRoute as xe, useRouter as Je } from "vue-router";
9
9
  const Ae = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, Te = /* @__PURE__ */ ee({
10
10
  __name: "Dialog",
11
11
  setup(O) {
12
- const { t: r } = Le(), f = Z(), { isOpened: l, message: S, title: D } = q(Z());
13
- return (L, g) => {
12
+ const { t: r } = Oe(), f = Z(), { isOpened: l, message: D, title: I } = L(Z());
13
+ return (h, g) => {
14
14
  const _ = U("FmButton"), N = U("FmDialog");
15
- return h(), te(N, {
15
+ return q(), te(N, {
16
16
  modelValue: u(l),
17
17
  "onUpdate:modelValue": g[0] || (g[0] = (B) => Ie(l) ? l.value = B : null),
18
18
  overlay: "",
19
19
  "close-button": !1
20
20
  }, {
21
21
  "dialog-header": J(() => [
22
- he(H(u(D)), 1)
22
+ he(H(u(I)), 1)
23
23
  ]),
24
24
  default: J(() => [
25
- W("p", Ae, H(u(S)), 1)
25
+ W("p", Ae, H(u(D)), 1)
26
26
  ]),
27
27
  "dialog-footer": J(() => [
28
28
  g[1] || (g[1] = W("div", { class: "grow" }, null, -1)),
@@ -40,7 +40,7 @@ const Ae = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, Te
40
40
  }, 8, ["modelValue"]);
41
41
  };
42
42
  }
43
- }), M = k(E());
43
+ }), M = C(E());
44
44
  function Ue() {
45
45
  const O = (r) => {
46
46
  switch (M.value = r, r) {
@@ -54,7 +54,7 @@ function Ue() {
54
54
  };
55
55
  return ae(() => {
56
56
  O(E());
57
- }), R(() => E(), O, { deep: !0, immediate: !0 }), {
57
+ }), S(() => E(), O, { deep: !0, immediate: !0 }), {
58
58
  currentLocale: M
59
59
  };
60
60
  }
@@ -62,13 +62,13 @@ i.locale(E() === "zh-CN" ? "zh-cn" : "en");
62
62
  const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
63
63
  __name: "App",
64
64
  setup(O) {
65
- const { businessId: r, token: f, country: l } = q(_e()), { sessionUser: S, currentBusiness: D, currentCountry: L, registerSidebarComponent: g } = T(), { getRestaurantAndWarehouse: _, getBusinessSetting: N, beginBusinessLoad: B, completeBusinessLoad: ne } = X(), { getFeatureFlags: re } = we(), { version: p } = q(Y()), { getSettings: oe } = be(), { promptLoader: se } = Ce(), e = xe(), F = Je(), ie = Y(), { suppressReportRouteSync: w } = q(ie), ue = K(() => `https://portal-v1.feedme.cc/b/${r.value}/report/CLOSE_UP?showHeader=false&country=${l.value.toUpperCase()}&menuOption=business-report&token=${f.value}&v2=true&reportV5Button=true`), le = K(() => `https://report-v4.feedme.cc?businessId=${r.value}&country=${l.value}&token=${f.value}&reportV3Button=true`);
66
- R(
67
- [() => D.value, () => S.value, () => L.value],
65
+ const { businessId: r, token: f, country: l } = L(_e()), { sessionUser: D, currentBusiness: I, currentCountry: h, registerSidebarComponent: g } = T(), { getRestaurantAndWarehouse: _, getBusinessSetting: N, beginBusinessLoad: B, completeBusinessLoad: ne } = X(), { getFeatureFlags: re } = be(), { version: p } = L(Y()), { getSettings: oe } = we(), { promptLoader: se } = ke(), e = xe(), F = Je(), R = Ne(), Q = Fe(), n = X(), ie = Y(), { suppressReportRouteSync: b } = L(ie), ue = K(() => `https://portal-v1.feedme.cc/b/${r.value}/report/CLOSE_UP?showHeader=false&country=${l.value.toUpperCase()}&menuOption=business-report&token=${f.value}&v2=true&reportV5Button=true`), le = K(() => `https://report-v4.feedme.cc?businessId=${r.value}&country=${l.value}&token=${f.value}&reportV3Button=true`);
66
+ S(
67
+ [() => I.value, () => D.value, () => h.value],
68
68
  () => {
69
69
  var t, o;
70
- const a = ((t = D.value) == null ? void 0 : t.id) ?? "";
71
- D.value && S.value && L.value && (ke(l.value), r.value !== a && (r.value = a), f.value = ((o = S.value) == null ? void 0 : o.token) ?? "", l.value = L.value ?? "", e.query.businessId !== r.value && F.replace({
70
+ const a = ((t = I.value) == null ? void 0 : t.id) ?? "";
71
+ I.value && D.value && h.value && (Ce(l.value), r.value !== a && (r.value = a), f.value = ((o = D.value) == null ? void 0 : o.token) ?? "", l.value = h.value ?? "", e.query.businessId !== r.value && F.replace({
72
72
  name: e.name,
73
73
  params: e.params,
74
74
  query: { ...e.query, businessId: r.value }
@@ -76,7 +76,7 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
76
76
  },
77
77
  { immediate: !0 }
78
78
  );
79
- function Q(a) {
79
+ function j(a) {
80
80
  if (typeof a.data == "string")
81
81
  try {
82
82
  const t = JSON.parse(a.data);
@@ -85,7 +85,7 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
85
85
  console.error(t);
86
86
  }
87
87
  }
88
- function j(a) {
88
+ function V(a) {
89
89
  if (typeof a.data == "string")
90
90
  try {
91
91
  const t = JSON.parse(a.data);
@@ -94,24 +94,22 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
94
94
  console.error(t);
95
95
  }
96
96
  }
97
- R(p, () => {
97
+ S(p, () => {
98
98
  ["v3", "v4"].includes(p.value) ? T().hideSidebarToggle(!0) : T().hideSidebarToggle(!1);
99
99
  }), Re(() => {
100
- g(Fe);
100
+ g($e);
101
101
  }), ae(() => {
102
- console.log("5.21.27", !0), window.addEventListener("message", Q), window.addEventListener("message", j);
102
+ console.log("5.21.28", !0), window.addEventListener("message", j), window.addEventListener("message", V);
103
+ }), qe(() => {
104
+ window.removeEventListener("message", j), window.removeEventListener("message", V), R.$dispose(), Q.$dispose();
103
105
  });
104
- const I = Ne(), V = $e(), n = X();
105
- qe(() => {
106
- window.removeEventListener("message", Q), window.removeEventListener("message", j), I.$dispose(), V.$dispose();
107
- });
108
- const { getReports: ce, getOverviewReport: de, getReportConfig: G, currentReportId: P } = I, { currentReportId: me, reports: fe } = q(I), { getSchema: pe } = Be(), { fetchSchedules: ge } = V, { init: ve } = Ee(), $ = k("v5"), b = k(!1), x = k(!0);
106
+ const { getReports: ce, getOverviewReport: de, getReportConfig: G, currentReportId: P } = R, { currentReportId: me, reports: fe } = L(R), { getSchema: pe } = Be(), { fetchSchedules: ge } = Q, { init: ve } = Ee(), $ = C("v5"), w = C(!1), x = C(!0);
109
107
  function ye() {
110
- const a = e.query.startDate ? i(e.query.startDate).startOf("day").toISOString() : void 0, t = e.query.endDate ? i(e.query.endDate).endOf("day").toISOString() : void 0, o = e.query.timeStart ? JSON.parse(e.query.timeStart) : void 0, c = e.query.timeEnd ? JSON.parse(e.query.timeEnd) : void 0, d = e.query.compareStartDate ? i(e.query.compareStartDate).startOf("day").toISOString() : void 0, v = e.query.compareEndDate ? i(e.query.compareEndDate).endOf("day").toISOString() : void 0, C = e.query.isAllLocation === "true";
108
+ const a = e.query.startDate ? i(e.query.startDate).startOf("day").toISOString() : void 0, t = e.query.endDate ? i(e.query.endDate).endOf("day").toISOString() : void 0, o = e.query.timeStart ? JSON.parse(e.query.timeStart) : void 0, c = e.query.timeEnd ? JSON.parse(e.query.timeEnd) : void 0, d = e.query.compareStartDate ? i(e.query.compareStartDate).startOf("day").toISOString() : void 0, v = e.query.compareEndDate ? i(e.query.compareEndDate).endOf("day").toISOString() : void 0, k = e.query.isAllLocation === "true";
111
109
  let m = [];
112
- C ? m = n.selectedLocationIds : m = e.query.locationIds ? JSON.parse(e.query.locationIds) : void 0;
110
+ k ? m = n.selectedLocationIds : m = e.query.locationIds ? JSON.parse(e.query.locationIds) : void 0;
113
111
  let y = e.query.reportId || P;
114
- if (fe.value.find((s) => s.id === y) || (y = P), y && y !== I.currentReportId && I.updateCurrentReportId(y), a || t) {
112
+ if (fe.value.find((s) => s.id === y) || (y = P), y && y !== R.currentReportId && R.updateCurrentReportId(y), a || t) {
115
113
  const s = n.dateRange;
116
114
  (s.startDate !== a || s.endDate !== t) && n.setDateRange({ startDate: a, endDate: t });
117
115
  }
@@ -126,7 +124,7 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
126
124
  endDate: v
127
125
  });
128
126
  }
129
- if (!C && Array.isArray(m)) {
127
+ if (!k && Array.isArray(m)) {
130
128
  const s = n.selectedLocationIds;
131
129
  s.length === m.length && s.every((Se, De) => Se === m[De]) || n.setSelectedLocationIds(m);
132
130
  }
@@ -143,10 +141,15 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
143
141
  isAllLocation: e.query.isAllLocation
144
142
  };
145
143
  }
146
- return R(
144
+ return S(
145
+ () => h.value,
146
+ (a, t) => {
147
+ !a || a === t || n.setSelectedLocationIds([]);
148
+ }
149
+ ), S(
147
150
  () => r.value,
148
151
  async (a) => {
149
- a !== "" && (b.value = !1, B(a), x.value || (n.setSelectedLocationIds([]), F.replace({
152
+ a !== "" && (w.value = !1, B(a), x.value || (n.setSelectedLocationIds([]), F.replace({
150
153
  name: e.name,
151
154
  params: e.params,
152
155
  query: {
@@ -154,7 +157,7 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
154
157
  locationIds: void 0,
155
158
  isAllLocation: "true"
156
159
  }
157
- })), w.value !== void 0 && (w.value = !0), await se(async () => {
160
+ })), b.value !== void 0 && (b.value = !0), await se(async () => {
158
161
  await ve({
159
162
  apiKey: "6GhcttsJ9Rj9cTevcdrpin",
160
163
  url: "https://flag.feedme.farm/api/v1/",
@@ -174,13 +177,13 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
174
177
  ),
175
178
  oe()
176
179
  ]), await N(), ye(), ne(a);
177
- }), b.value = !0, x.value && (x.value = !1));
180
+ }), w.value = !0, x.value && (x.value = !1));
178
181
  },
179
182
  {
180
183
  immediate: !0
181
184
  }
182
- ), R(
183
- () => (b.value, {
185
+ ), S(
186
+ () => (w.value, {
184
187
  reportId: me.value,
185
188
  selectedLocationIds: n.selectedLocationIds,
186
189
  dateRange: n.dateRange,
@@ -188,9 +191,9 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
188
191
  compareDateRange: n.compareDateRange
189
192
  }),
190
193
  (a) => {
191
- if (!b.value || !a.reportId) return;
192
- if (w.value) {
193
- w.value = !1;
194
+ if (!w.value || !a.reportId) return;
195
+ if (b.value) {
196
+ b.value = !1;
194
197
  return;
195
198
  }
196
199
  const t = a.selectedLocationIds, o = a.dateRange, c = a.timeRange, d = a.compareDateRange, v = {
@@ -204,8 +207,8 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
204
207
  timeEnd: c.end ? JSON.stringify(c.end) : void 0,
205
208
  locationIds: t.length === n.locations.length ? null : t.length > 0 ? JSON.stringify(t) : void 0,
206
209
  isAllLocation: String(t.length === n.locations.length)
207
- }, C = JSON.stringify(e.query), m = JSON.stringify(v);
208
- C !== m && F.replace({
210
+ }, k = JSON.stringify(e.query), m = JSON.stringify(v);
211
+ k !== m && F.replace({
209
212
  name: e.name,
210
213
  params: e.params,
211
214
  query: v
@@ -214,17 +217,17 @@ const ze = ["src"], Qe = ["src"], et = /* @__PURE__ */ ee({
214
217
  { deep: !0 }
215
218
  ), Ue(), (a, t) => {
216
219
  const o = U("router-view");
217
- return h(), A(Oe, null, [
220
+ return q(), A(Le, null, [
218
221
  z(Te),
219
- u(p) === "v3" ? (h(), A("iframe", {
222
+ u(p) === "v3" ? (q(), A("iframe", {
220
223
  key: 0,
221
224
  class: "bg-white h-full w-full",
222
225
  src: ue.value
223
- }, null, 8, ze)) : u(p) === "v4" ? (h(), A("iframe", {
226
+ }, null, 8, ze)) : u(p) === "v4" ? (q(), A("iframe", {
224
227
  key: 1,
225
228
  class: "bg-white h-full w-full",
226
229
  src: le.value
227
- }, null, 8, Qe)) : (h(), te(o, { key: 2 }))
230
+ }, null, 8, Qe)) : (q(), te(o, { key: 2 }))
228
231
  ], 64);
229
232
  };
230
233
  }
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-B7pZn85d.js"));
5713
+ }, h = e(() => import("./App-DY46Ms3a.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.27",
3
+ "version": "5.21.28",
4
4
  "files": [
5
5
  "dist"
6
6
  ],