@feedmepos/mf-report 5.18.2-beta.5 → 5.18.2-beta.6

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,38 +1,38 @@
1
- import { defineComponent as X, resolveComponent as B, createBlock as Y, openBlock as I, unref as u, isRef as fe, withCtx as F, createElementVNode as V, createVNode as x, toDisplayString as W, createTextVNode as pe, onMounted as Z, watch as h, ref as A, computed as G, onBeforeMount as ge, onBeforeUnmount as ye, createElementBlock as $, Fragment as ve } from "vue";
2
- import { detectLocale as C, useCoreStore as J } from "@feedmepos/mf-common";
3
- import { u as Se, d as i, a as De, b as K, c as Ie, e as he, f as Re, s as qe, g as Oe } from "./vue-i18n-Cjs2Btd-.js";
1
+ import { defineComponent as Y, resolveComponent as x, createBlock as Z, openBlock as h, unref as u, isRef as pe, withCtx as F, createElementVNode as W, createVNode as J, toDisplayString as G, createTextVNode as ge, onMounted as M, watch as R, ref as A, computed as K, onBeforeMount as ye, onBeforeUnmount as ve, createElementBlock as $, Fragment as Se } from "vue";
2
+ import { detectLocale as C, useCoreStore as B } from "@feedmepos/mf-common";
3
+ import { u as De, d as i, a as Ie, b as P, c as he, e as Re, f as qe, s as Oe, g as _e } from "./vue-i18n-Cjs2Btd-.js";
4
4
  import { storeToRefs as b } from "pinia";
5
- import { u as _e, a as Le, b as we } from "./BaseDialog.vue_vue_type_script_setup_true_lang-DLAmjLpT.js";
6
- import { _ as be, u as Ce } from "./NavigationTab.vue_vue_type_script_setup_true_lang-CbS3wT-Z.js";
7
- import { u as P } from "./message-dialog-UoMWOnil.js";
8
- import { useRoute as Ee, useRouter as ke } from "vue-router";
9
- const Ne = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, Fe = /* @__PURE__ */ X({
5
+ import { u as we, a as Le, b as be } from "./BaseDialog.vue_vue_type_script_setup_true_lang-DLAmjLpT.js";
6
+ import { _ as Ce, u as Ee } from "./NavigationTab.vue_vue_type_script_setup_true_lang-CbS3wT-Z.js";
7
+ import { u as H } from "./message-dialog-UoMWOnil.js";
8
+ import { useRoute as ke, useRouter as Ne } from "vue-router";
9
+ const Fe = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, $e = /* @__PURE__ */ Y({
10
10
  __name: "Dialog",
11
- setup(R) {
12
- const { t: o } = Se(), f = P(), { isOpened: c, message: v, title: S } = b(P());
13
- return (q, g) => {
14
- const O = B("FmButton"), E = B("FmDialog");
15
- return I(), Y(E, {
11
+ setup(q) {
12
+ const { t: r } = De(), f = H(), { isOpened: c, message: S, title: D } = b(H());
13
+ return (O, g) => {
14
+ const _ = x("FmButton"), E = x("FmDialog");
15
+ return h(), Z(E, {
16
16
  modelValue: u(c),
17
- "onUpdate:modelValue": g[0] || (g[0] = (k) => fe(c) ? c.value = k : null),
17
+ "onUpdate:modelValue": g[0] || (g[0] = (k) => pe(c) ? c.value = k : null),
18
18
  overlay: "",
19
19
  "close-button": !1
20
20
  }, {
21
21
  "dialog-header": F(() => [
22
- pe(W(u(S)), 1)
22
+ ge(G(u(D)), 1)
23
23
  ]),
24
24
  default: F(() => [
25
- V("p", Ne, W(u(v)), 1)
25
+ W("p", Fe, G(u(S)), 1)
26
26
  ]),
27
27
  "dialog-footer": F(() => [
28
- g[1] || (g[1] = V("div", { class: "grow" }, null, -1)),
29
- x(O, {
30
- label: u(o)("report.common.cancel"),
28
+ g[1] || (g[1] = W("div", { class: "grow" }, null, -1)),
29
+ J(_, {
30
+ label: u(r)("report.common.cancel"),
31
31
  variant: "tertiary",
32
32
  onClick: u(f).dismiss
33
33
  }, null, 8, ["label", "onClick"]),
34
- x(O, {
35
- label: u(o)("report.common.confirm"),
34
+ J(_, {
35
+ label: u(r)("report.common.confirm"),
36
36
  onClick: u(f).confirm
37
37
  }, null, 8, ["label", "onClick"])
38
38
  ]),
@@ -40,10 +40,10 @@ const Ne = { class: "fm-typo-en-body-md-400 text-ellipsis overflow-hidden" }, Fe
40
40
  }, 8, ["modelValue"]);
41
41
  };
42
42
  }
43
- }), H = A(C());
44
- function $e() {
45
- const R = (o) => {
46
- switch (H.value = o, o) {
43
+ }), X = A(C());
44
+ function Be() {
45
+ const q = (r) => {
46
+ switch (X.value = r, r) {
47
47
  case "zh-CN":
48
48
  i.locale("zh-cn");
49
49
  break;
@@ -52,26 +52,26 @@ function $e() {
52
52
  break;
53
53
  }
54
54
  };
55
- return Z(() => {
56
- R(C());
57
- }), h(() => C(), R, { deep: !0, immediate: !0 }), {
58
- currentLocale: H
55
+ return M(() => {
56
+ q(C());
57
+ }), R(() => C(), q, { deep: !0, immediate: !0 }), {
58
+ currentLocale: X
59
59
  };
60
60
  }
61
61
  i.locale(C() === "zh-CN" ? "zh-cn" : "en");
62
- const Je = ["src"], Be = ["src"], Ke = /* @__PURE__ */ X({
62
+ const xe = ["src"], Je = ["src"], He = /* @__PURE__ */ Y({
63
63
  __name: "App",
64
- setup(R) {
65
- const { businessId: o, token: f, country: c } = b(De()), { sessionUser: v, currentBusiness: S, currentCountry: q, registerSidebarComponent: g } = J(), { getRestaurantAndWarehouse: O, getBusinessSetting: E } = K(), { getFeatureFlags: k } = Ie(), { version: p } = b(_e()), { getSettings: M } = he(), { promptLoader: ee } = Re(), e = Ee(), T = ke(), te = G(() => `https://portal-v1.feedmedev.cc/b/${o.value}/report/CLOSE_UP?showHeader=false&country=${c.value.toUpperCase()}&menuOption=business-report&token=${f.value}&v2=true&reportV5Button=true`), ae = G(() => `https://report-v4.feedmedev.cc?businessId=${o.value}&country=${c.value}&token=${f.value}&reportV3Button=true`);
66
- h(
67
- [() => S.value, () => v.value, () => q.value],
64
+ setup(q) {
65
+ const { businessId: r, token: f, country: c } = b(Ie()), { sessionUser: S, currentBusiness: D, currentCountry: O, registerSidebarComponent: g } = B(), { getRestaurantAndWarehouse: _, getBusinessSetting: E } = P(), { getFeatureFlags: k } = he(), { version: p } = b(we()), { getSettings: ee } = Re(), { promptLoader: te } = qe(), e = ke(), T = Ne(), ae = K(() => `https://portal-v1.feedmedev.cc/b/${r.value}/report/CLOSE_UP?showHeader=false&country=${c.value.toUpperCase()}&menuOption=business-report&token=${f.value}&v2=true&reportV5Button=true`), ne = K(() => `https://report-v4.feedmedev.cc?businessId=${r.value}&country=${c.value}&token=${f.value}&reportV3Button=true`);
66
+ R(
67
+ [() => D.value, () => S.value, () => O.value],
68
68
  () => {
69
- var t, r;
70
- const a = ((t = S.value) == null ? void 0 : t.id) ?? "";
71
- S.value && v.value && q.value && (qe(c.value), o.value !== a && (o.value = a), f.value = ((r = v.value) == null ? void 0 : r.token) ?? "", c.value = q.value ?? "", e.query.businessId !== o.value && T.replace({
69
+ var t, o;
70
+ const a = ((t = D.value) == null ? void 0 : t.id) ?? "";
71
+ D.value && S.value && O.value && (Oe(c.value), r.value !== a && (r.value = a), f.value = ((o = S.value) == null ? void 0 : o.token) ?? "", c.value = O.value ?? "", e.query.businessId !== r.value && T.replace({
72
72
  name: e.name,
73
73
  params: e.params,
74
- query: { ...e.query, businessId: o.value }
74
+ query: { ...e.query, businessId: r.value }
75
75
  }));
76
76
  },
77
77
  { immediate: !0 }
@@ -94,30 +94,30 @@ const Je = ["src"], Be = ["src"], Ke = /* @__PURE__ */ X({
94
94
  console.error(t);
95
95
  }
96
96
  }
97
- h(p, () => {
98
- ["v3", "v4"].includes(p.value) ? J().hideSidebarToggle(!0) : J().hideSidebarToggle(!1);
99
- }), ge(() => {
100
- g(be);
101
- }), Z(() => {
102
- console.log("5.18.2-beta.5", !0), window.addEventListener("message", U), window.addEventListener("message", z);
97
+ R(p, () => {
98
+ ["v3", "v4"].includes(p.value) ? B().hideSidebarToggle(!0) : B().hideSidebarToggle(!1);
99
+ }), ye(() => {
100
+ g(Ce);
101
+ }), M(() => {
102
+ console.log("5.18.2-beta.6", !0), window.addEventListener("message", U), window.addEventListener("message", z);
103
103
  });
104
- const D = Le(), Q = Ce(), n = K();
105
- ye(() => {
106
- window.removeEventListener("message", U), window.removeEventListener("message", z), D.$dispose(), Q.$dispose();
104
+ const I = Le(), Q = Ee(), n = P();
105
+ ve(() => {
106
+ window.removeEventListener("message", U), window.removeEventListener("message", z), I.$dispose(), Q.$dispose();
107
107
  });
108
- const { getReports: ne, getOverviewReport: re, getReportConfig: j, currentReportId: oe } = D, { currentReportId: se } = b(D), { getSchema: ie } = we(), { fetchSchedules: ue } = Q, { init: ce } = Oe(), N = A("v5"), _ = A(!1);
109
- function le() {
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, r = e.query.timeStart ? JSON.parse(e.query.timeStart) : void 0, l = e.query.timeEnd ? JSON.parse(e.query.timeEnd) : void 0, d = e.query.compareStartDate ? i(e.query.compareStartDate).startOf("day").toISOString() : void 0, y = e.query.compareEndDate ? i(e.query.compareEndDate).endOf("day").toISOString() : void 0, L = e.query.isAllLocation === "true";
108
+ const { getReports: re, getOverviewReport: oe, getReportConfig: j, currentReportId: V } = I, { currentReportId: se, reports: ie } = b(I), { getSchema: ue } = be(), { fetchSchedules: ce } = Q, { init: le } = _e(), N = A("v5"), w = A(!1);
109
+ function de() {
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, l = e.query.timeEnd ? JSON.parse(e.query.timeEnd) : void 0, d = e.query.compareStartDate ? i(e.query.compareStartDate).startOf("day").toISOString() : void 0, y = e.query.compareEndDate ? i(e.query.compareEndDate).endOf("day").toISOString() : void 0, L = e.query.isAllLocation === "true";
111
111
  let m = [];
112
112
  L ? m = n.selectedLocationIds : m = e.query.locationIds ? JSON.parse(e.query.locationIds) : void 0;
113
- const w = e.query.reportId || oe;
114
- if (w && w !== D.currentReportId && D.updateCurrentReportId(w), a || t) {
113
+ let v = e.query.reportId || V;
114
+ if (ie.value.find((s) => s.id === v) || (v = V), v && v !== I.currentReportId && I.updateCurrentReportId(v), a || t) {
115
115
  const s = n.dateRange;
116
116
  (s.startDate !== a || s.endDate !== t) && n.setDateRange({ startDate: a, endDate: t });
117
117
  }
118
- if (r || l) {
118
+ if (o || l) {
119
119
  const s = n.timeRange;
120
- (s.start !== r || s.end !== l) && n.setTimeRange({ start: r, end: l });
120
+ (s.start !== o || s.end !== l) && n.setTimeRange({ start: o, end: l });
121
121
  }
122
122
  if (d || y) {
123
123
  const s = n.compareDateRange;
@@ -128,11 +128,11 @@ const Je = ["src"], Be = ["src"], Ke = /* @__PURE__ */ X({
128
128
  }
129
129
  if (!L && Array.isArray(m)) {
130
130
  const s = n.selectedLocationIds;
131
- s.length === m.length && s.every((de, me) => de === m[me]) || n.setSelectedLocationIds(m);
131
+ s.length === m.length && s.every((me, fe) => me === m[fe]) || n.setSelectedLocationIds(m);
132
132
  }
133
133
  return {
134
134
  // TODO: this returned value can used for getBusinessSetting
135
- reportId: w,
135
+ reportId: v,
136
136
  startDate: e.query.startDate,
137
137
  endDate: e.query.endDate,
138
138
  timeStart: e.query.timeStart,
@@ -143,36 +143,36 @@ const Je = ["src"], Be = ["src"], Ke = /* @__PURE__ */ X({
143
143
  isAllLocation: e.query.isAllLocation
144
144
  };
145
145
  }
146
- return h(
147
- () => o.value,
148
- async (a, t) => {
149
- a !== "" && (_.value = !1, await ee(async () => {
150
- await ce({
146
+ return R(
147
+ () => r.value,
148
+ async (a) => {
149
+ a !== "" && (w.value = !1, await te(async () => {
150
+ await le({
151
151
  apiKey: "MaGoXrEWuEJNpWgKTqseee",
152
152
  url: "https://flag.feedme.farm/api/v1/",
153
153
  enableAnalytics: !1,
154
154
  cacheFlags: !1
155
155
  });
156
- const r = await j();
157
- N.value = r.version, p.value = N.value, await Promise.all([
156
+ const t = await j();
157
+ N.value = t.version, p.value = N.value, await Promise.all([
158
158
  k(),
159
159
  j(),
160
+ oe(),
160
161
  re(),
161
- ne(),
162
- ie(),
163
162
  ue(),
164
- O(
163
+ ce(),
164
+ _(
165
165
  e.query.locationIds ? JSON.parse(e.query.locationIds) : null
166
166
  ),
167
- M()
168
- ]), await E(), (!t || t == a) && le();
169
- }), _.value = !0);
167
+ ee()
168
+ ]), await E(), de();
169
+ }), w.value = !0);
170
170
  },
171
171
  {
172
172
  immediate: !0
173
173
  }
174
- ), h(
175
- () => (_.value, {
174
+ ), R(
175
+ () => (w.value, {
176
176
  reportId: se.value,
177
177
  selectedLocationIds: n.selectedLocationIds,
178
178
  dateRange: n.dateRange,
@@ -180,13 +180,13 @@ const Je = ["src"], Be = ["src"], Ke = /* @__PURE__ */ X({
180
180
  compareDateRange: n.compareDateRange
181
181
  }),
182
182
  (a) => {
183
- if (!_.value || !a.reportId) return;
184
- console.log("loaded.."), console.log(a);
185
- const t = a.selectedLocationIds, r = a.dateRange, l = a.timeRange, d = a.compareDateRange, y = {
183
+ if (!w.value || !a.reportId) return;
184
+ console.log(a);
185
+ const t = a.selectedLocationIds, o = a.dateRange, l = a.timeRange, d = a.compareDateRange, y = {
186
186
  ...e.query,
187
187
  reportId: a.reportId,
188
- startDate: r.startDate ? i(r.startDate).startOf("day").toISOString() : void 0,
189
- endDate: r.endDate ? i(r.endDate).endOf("day").toISOString() : void 0,
188
+ startDate: o.startDate ? i(o.startDate).startOf("day").toISOString() : void 0,
189
+ endDate: o.endDate ? i(o.endDate).endOf("day").toISOString() : void 0,
190
190
  compareStartDate: d.startDate ? i(d.startDate).startOf("day").toISOString() : void 0,
191
191
  compareEndDate: d.endDate ? i(d.endDate).endOf("day").toISOString() : void 0,
192
192
  timeStart: l.start ? JSON.stringify(l.start) : void 0,
@@ -201,23 +201,23 @@ const Je = ["src"], Be = ["src"], Ke = /* @__PURE__ */ X({
201
201
  });
202
202
  },
203
203
  { deep: !0 }
204
- ), $e(), (a, t) => {
205
- const r = B("router-view");
206
- return I(), $(ve, null, [
207
- x(Fe),
208
- u(p) === "v3" ? (I(), $("iframe", {
204
+ ), Be(), (a, t) => {
205
+ const o = x("router-view");
206
+ return h(), $(Se, null, [
207
+ J($e),
208
+ u(p) === "v3" ? (h(), $("iframe", {
209
209
  key: 0,
210
210
  class: "bg-white h-full w-full",
211
- src: te.value
212
- }, null, 8, Je)) : u(p) === "v4" ? (I(), $("iframe", {
211
+ src: ae.value
212
+ }, null, 8, xe)) : u(p) === "v4" ? (h(), $("iframe", {
213
213
  key: 1,
214
214
  class: "bg-white h-full w-full",
215
- src: ae.value
216
- }, null, 8, Be)) : (I(), Y(r, { key: 2 }))
215
+ src: ne.value
216
+ }, null, 8, Je)) : (h(), Z(o, { key: 2 }))
217
217
  ], 64);
218
218
  };
219
219
  }
220
220
  });
221
221
  export {
222
- Ke as default
222
+ He as default
223
223
  };
package/dist/app.js CHANGED
@@ -5032,7 +5032,7 @@ const u = {
5032
5032
  "zh-CN": m,
5033
5033
  "th-TH": c,
5034
5034
  "zh-Hant": p
5035
- }, h = e(() => import("./App-0zRta0Xy.js"));
5035
+ }, h = e(() => import("./App-CMeRHKED.js"));
5036
5036
  export {
5037
5037
  h as FmApp,
5038
5038
  u as i18nMessages,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-report",
3
- "version": "5.18.2-beta.5",
3
+ "version": "5.18.2-beta.6",
4
4
  "files": [
5
5
  "dist"
6
6
  ],