@feedmepos/mf-report 5.22.25 → 5.22.26

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 (34) hide show
  1. package/dist/App-3HFmWp7u.js +298 -0
  2. package/dist/{BaseDialog.vue_vue_type_script_setup_true_lang-CD7LSCLM.js → BaseDialog.vue_vue_type_script_setup_true_lang-B2CdeeFj.js} +1128 -1292
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-BP474uxj.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-DlpbyWWd.js} +5 -5
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-C55xh4bx.js → Default.vue_vue_type_script_setup_true_lang-BUIcdcLn.js} +2 -2
  5. package/dist/{FilterSelector.vue_vue_type_script_setup_true_lang-D2K2ghV_.js → FilterSelector.vue_vue_type_script_setup_true_lang-jDZZAdUQ.js} +19 -19
  6. package/dist/InsightView-B8Wrd2SX.js +664 -0
  7. package/dist/{Integration-CAsNSCR4.js → Integration-D_jZxPMn.js} +40 -40
  8. package/dist/{Integrations-CIeyn0dF.js → Integrations-B1igzxZG.js} +14 -13
  9. package/dist/Layout-Dt6yE5XC.js +19 -0
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-CBY5Meyc.js → MenuTab.vue_vue_type_script_setup_true_lang-Dtv5xe0O.js} +13 -13
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-DsOmTqFV.js → NavigationTab.vue_vue_type_script_setup_true_lang-lfncwvdP.js} +24 -24
  12. package/dist/{NoData.vue_vue_type_script_setup_true_lang-BcdcgnzD.js → NoData.vue_vue_type_script_setup_true_lang-CDKHIlF2.js} +1 -1
  13. package/dist/OverviewView-hz2kZmm7.js +62 -0
  14. package/dist/{Report-CMYhrVbI.js → Report-nrJWlkN-.js} +15 -14
  15. package/dist/{ReportEditor-BU6Hq9yx.js → ReportEditor-YV-2UXDU.js} +24 -23
  16. package/dist/{ReportView-8F14F_jz.js → ReportView-CM1PfMk6.js} +18 -17
  17. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-SWjNNZ_J.js → SelectComponent.vue_vue_type_script_setup_true_lang-Df40itH5.js} +1 -1
  18. package/dist/Setting-B1Xrl09c.js +326 -0
  19. package/dist/{TileEditor-BRHXTLEK.js → TileEditor-CF0aNTKV.js} +131 -131
  20. package/dist/{TransitionFade-DbsPAg2T.js → TransitionFade-D2bsz2iV.js} +12 -12
  21. package/dist/app-C2vt2B-i.js +11540 -0
  22. package/dist/app.js +1 -1
  23. package/dist/useRestaurantPermission-DRvKGVtO.js +65 -0
  24. package/dist/vue-i18n-DVWuTfed.js +2727 -0
  25. package/package.json +1 -1
  26. package/dist/App-C5_KJN8G.js +0 -294
  27. package/dist/InsightView-BCZKzqRM.js +0 -670
  28. package/dist/Layout-BFvrEBq5.js +0 -29
  29. package/dist/NoPermission.vue_vue_type_script_setup_true_lang-obph7BUZ.js +0 -25
  30. package/dist/OverviewView-gvsp6532.js +0 -63
  31. package/dist/Setting-BtWmZpk0.js +0 -328
  32. package/dist/app-WBPZfxon.js +0 -6658
  33. package/dist/useRestaurantPermission-BtPLwoC9.js +0 -64
  34. package/dist/vue-i18n-CvU0g5WR.js +0 -7253
@@ -0,0 +1,664 @@
1
+ import { ref as B, defineComponent as S, watch as T, computed as _, onMounted as le, createElementBlock as d, openBlock as o, createElementVNode as a, renderSlot as H, toDisplayString as w, resolveDirective as X, createCommentVNode as A, Fragment as z, renderList as P, createBlock as V, withDirectives as M, resolveDynamicComponent as N, unref as m, withCtx as I, createVNode as y, normalizeClass as L, resolveComponent as R, useModel as ae, createTextVNode as oe, isRef as j, nextTick as se } from "vue";
2
+ import { _ as ne } from "./Default.vue_vue_type_script_setup_true_lang-BUIcdcLn.js";
3
+ import { _ as ie } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-DlpbyWWd.js";
4
+ import { d as W, u as G, F as O, q as J, h as Y, a as re } from "./app-C2vt2B-i.js";
5
+ import { storeToRefs as K } from "pinia";
6
+ import { C as Q, r as de } from "./chart-DDDh8zNk.js";
7
+ import { components as E, useSnackbar as ce } from "@feedmepos/ui-library";
8
+ import { u as ee } from "./vue-i18n-DVWuTfed.js";
9
+ import { _ as ue } from "./NoData.vue_vue_type_script_setup_true_lang-CDKHIlF2.js";
10
+ import { a as fe, G as me } from "./NavigationTab.vue_vue_type_script_setup_true_lang-lfncwvdP.js";
11
+ import { useCoreStore as ge } from "@feedmepos/mf-common";
12
+ function pe({ start: e, end: t }) {
13
+ return `${W(t).format("DD MMM")}, ${W(t).format("YYYY")}`;
14
+ }
15
+ B(!0);
16
+ const he = async (e) => {
17
+ const { businessId: t } = K(G());
18
+ if (t) {
19
+ const l = {
20
+ fetchType: O.Post,
21
+ url: `${t.value}/insights`,
22
+ data: {
23
+ ...e,
24
+ isAnomaly: !0
25
+ // isAnomaly: anomaly.value
26
+ }
27
+ };
28
+ return J.fetch(l);
29
+ } else
30
+ return Promise.reject(new Error("Business Id is not defined"));
31
+ }, ye = async (e) => {
32
+ const { businessId: t } = G(), l = {
33
+ fetchType: O.Post,
34
+ url: `${t}/insights/feedbacks`,
35
+ data: e
36
+ };
37
+ return J.fetch(l);
38
+ };
39
+ Q.register(...de);
40
+ const ve = { class: "flex flex-col h-full overflow-hidden" }, xe = { class: "flex flex-col gap-8" }, we = { class: "fm-color-typo-primary fm-typo-en-body-lg-400" }, be = { class: "fm-color-typo-secondary fm-typo-en-body-md-400" }, Ce = { class: "grow" }, ke = /* @__PURE__ */ S({
41
+ __name: "LineChart",
42
+ props: {
43
+ name: { default: void 0 },
44
+ paragraph: { default: void 0 },
45
+ datasets: {},
46
+ xAxis: {},
47
+ transpose: { type: Boolean, default: !1 },
48
+ stacked: { type: Boolean },
49
+ maintainAspectRatio: { type: Boolean },
50
+ hideXAxis: { type: Boolean, default: void 0 },
51
+ hideYAxis: { type: Boolean, default: void 0 },
52
+ legend: { default: void 0 }
53
+ },
54
+ setup(e) {
55
+ const t = e, l = B(null);
56
+ let s = null;
57
+ T(
58
+ [
59
+ () => t.transpose,
60
+ () => t.maintainAspectRatio,
61
+ () => t.hideXAxis,
62
+ () => t.hideYAxis,
63
+ () => t.legend
64
+ ],
65
+ () => {
66
+ s && s.config.options && (s.destroy(), u());
67
+ }
68
+ );
69
+ const i = _(() => t.transpose ? "y" : "x"), x = _(() => ({
70
+ labels: t.xAxis.categories,
71
+ datasets: t.datasets.map((r) => ({
72
+ ...r,
73
+ borderDash: r.dash ? [5, 5] : void 0,
74
+ tension: r.tension || 0.1
75
+ }))
76
+ }));
77
+ T(
78
+ x,
79
+ () => {
80
+ s && (s.data = x.value, s.update());
81
+ },
82
+ { deep: !0 }
83
+ );
84
+ function u() {
85
+ l.value && (s = new Q(l.value, {
86
+ type: "line",
87
+ data: x.value,
88
+ options: {
89
+ plugins: {
90
+ legend: t.legend || {
91
+ display: !0,
92
+ position: "bottom",
93
+ maxHeight: 60,
94
+ labels: {
95
+ usePointStyle: !0,
96
+ pointStyle: "line"
97
+ }
98
+ }
99
+ },
100
+ maintainAspectRatio: t.maintainAspectRatio,
101
+ responsive: !0,
102
+ indexAxis: i.value,
103
+ scales: {
104
+ x: {
105
+ display: !t.hideXAxis,
106
+ stacked: t.stacked,
107
+ grid: {
108
+ display: !1
109
+ },
110
+ beginAtZero: !0
111
+ },
112
+ y: {
113
+ display: !t.hideYAxis,
114
+ stacked: t.stacked,
115
+ grid: {
116
+ display: !0
117
+ },
118
+ position: "right",
119
+ beginAtZero: !0
120
+ }
121
+ },
122
+ elements: {
123
+ line: {
124
+ borderWidth: 1.5
125
+ },
126
+ point: {
127
+ radius: 0,
128
+ hitRadius: 30,
129
+ hoverRadius: 6,
130
+ hoverBackgroundColor: "#FFFFFF",
131
+ hoverBorderWidth: 3
132
+ }
133
+ }
134
+ }
135
+ }));
136
+ }
137
+ return le(() => {
138
+ u();
139
+ }), (r, b) => (o(), d("div", ve, [
140
+ a("div", xe, [
141
+ H(r.$slots, "title"),
142
+ a("div", we, w(r.name), 1),
143
+ a("div", be, w(r.paragraph), 1)
144
+ ]),
145
+ a("div", Ce, [
146
+ a("canvas", {
147
+ ref_key: "canvas",
148
+ ref: l
149
+ }, null, 512)
150
+ ])
151
+ ]));
152
+ }
153
+ }), _e = ["width", "height"], $e = ["fill"], Ae = ["fill"], Fe = ["stroke"], Ve = ["stroke"], te = /* @__PURE__ */ S({
154
+ __name: "SparkIcon",
155
+ props: {
156
+ size: {
157
+ type: Number,
158
+ default: 24
159
+ },
160
+ color: {
161
+ type: String,
162
+ default: "#6B6B6B"
163
+ }
164
+ },
165
+ setup(e) {
166
+ const t = e, l = _(() => `${t.size}px`);
167
+ return (s, i) => (o(), d("svg", {
168
+ width: l.value,
169
+ height: l.value,
170
+ viewBox: "0 0 24 24",
171
+ fill: "none",
172
+ xmlns: "http://www.w3.org/2000/svg"
173
+ }, [
174
+ a("path", {
175
+ d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
176
+ fill: t.color
177
+ }, null, 8, $e),
178
+ a("path", {
179
+ d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
180
+ fill: t.color
181
+ }, null, 8, Ae),
182
+ a("path", {
183
+ d: "M7.6 7.6C8.17076 6.94229 8.5 5.5 8.5 5.5C8.5 5.5 8.81356 6.87361 9.35714 7.5C9.92948 8.15953 11.5 8.5 11.5 8.5C11.5 8.5 9.92948 8.69761 9.35714 9.35714C8.81356 9.98354 8.5 11.5 8.5 11.5C8.5 11.5 8.32076 10.1888 7.75 9.59091C7.14905 8.96136 5.5 8.5 5.5 8.5C5.5 8.5 6.99905 8.29251 7.6 7.6Z",
184
+ stroke: t.color,
185
+ "stroke-width": "1.5",
186
+ "stroke-linecap": "round",
187
+ "stroke-linejoin": "round"
188
+ }, null, 8, Fe),
189
+ a("path", {
190
+ d: "M12.2 12.2C13.3415 10.8846 14 8 14 8C14 8 14.6271 10.7472 15.7143 12C16.859 13.3191 20 14 20 14C20 14 16.859 14.3952 15.7143 15.7143C14.6271 16.9671 14 20 14 20C14 20 13.6415 17.3777 12.5 16.1818C11.2981 14.9227 8 14 8 14C8 14 10.9981 13.585 12.2 12.2Z",
191
+ stroke: t.color,
192
+ "stroke-width": "1.5",
193
+ "stroke-linecap": "round",
194
+ "stroke-linejoin": "round"
195
+ }, null, 8, Ve)
196
+ ], 8, _e));
197
+ }
198
+ }), Be = { class: "flex flex-col gap-16" }, Ie = { class: "fm-typo-en-title-sm-600" }, Se = { class: "flex justify-center items-center" }, Re = { class: "fm-typo-en-body-lg-600 text-fm-color-typo-primary" }, De = {
199
+ key: 0,
200
+ class: "rounded-lg p-2"
201
+ }, Me = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary text-wrap" }, Le = { key: 0 }, Te = {
202
+ key: 0,
203
+ class: "flex justify-center w-full gap-8"
204
+ }, je = ["onClick"], Z = /* @__PURE__ */ S({
205
+ __name: "CarouselCard",
206
+ props: {
207
+ title: {
208
+ type: String,
209
+ default: ""
210
+ },
211
+ items: {
212
+ type: Array,
213
+ default: () => []
214
+ }
215
+ },
216
+ setup(e) {
217
+ const t = B(0), l = B(), s = e;
218
+ function i(u) {
219
+ var r;
220
+ if (l.value) {
221
+ const b = (((r = l.value) == null ? void 0 : r.scrollWidth) ?? 1) / s.items.length;
222
+ l.value.scrollLeft = b * u;
223
+ }
224
+ t.value = u;
225
+ }
226
+ T(
227
+ () => l.value,
228
+ () => {
229
+ var u;
230
+ if (l.value) {
231
+ const r = ((((u = l.value) == null ? void 0 : u.scrollWidth) ?? 1) - 400) / s.items.length;
232
+ l.value.addEventListener("scroll", () => {
233
+ var n;
234
+ const b = Math.floor((((n = l.value) == null ? void 0 : n.scrollLeft) ?? 1) / r);
235
+ t.value = b;
236
+ });
237
+ }
238
+ }
239
+ );
240
+ const { FmTooltip: x } = E;
241
+ return (u, r) => {
242
+ const b = X("wave");
243
+ return o(), d("div", Be, [
244
+ a("p", Ie, w(s.title), 1),
245
+ a("div", {
246
+ ref_key: "scroll",
247
+ ref: l,
248
+ class: "flex gap-8 overflow-x-scroll snap-x snap-mandatory w-full scrollbar-hide"
249
+ }, [
250
+ (o(!0), d(z, null, P(s.items, (n, g) => (o(), d("div", {
251
+ key: `reason_${g}`,
252
+ class: "min-w-[368px] border rounded-lg p-16 snap-always snap-center flex gap-8 flex-col"
253
+ }, [
254
+ a("div", Se, [
255
+ (o(), V(N(n.defination ? m(x) : "div"), {
256
+ content: n.defination,
257
+ "z-index": 100
258
+ }, {
259
+ default: I(() => [
260
+ a("p", Re, w(n.header), 1)
261
+ ]),
262
+ _: 2
263
+ }, 1032, ["content"])),
264
+ r[0] || (r[0] = a("div", { class: "grow" }, null, -1)),
265
+ n.header === "Introduce Kid-Friendly Menu Items" ? M((o(), d("button", De, [
266
+ y(te, { size: 22 })
267
+ ])), [
268
+ [b, !0]
269
+ ]) : A("", !0)
270
+ ]),
271
+ a("p", Me, w(n.subLabel), 1)
272
+ ]))), 128)),
273
+ s.items.length === 0 ? (o(), d("div", Le, [
274
+ a("p", null, "No " + w(s.title.toLowerCase()) + " at the moment", 1)
275
+ ])) : A("", !0)
276
+ ], 512),
277
+ e.items.length > 1 ? (o(), d("div", Te, [
278
+ (o(!0), d(z, null, P(e.items, (n, g) => (o(), d("span", {
279
+ key: `carousel_${g}`,
280
+ class: L([
281
+ "w-[11px] h-[11px] rounded-lg cursor-pointer",
282
+ g === t.value ? " bg-fm-color-neutral-gray-300" : "bg-fm-color-neutral-gray-100"
283
+ ]),
284
+ onClick: ($) => i(g)
285
+ }, null, 10, je))), 128))
286
+ ])) : A("", !0)
287
+ ]);
288
+ };
289
+ }
290
+ }), ze = { class: "flex flex-col flex-grow gap-16" }, Pe = { class: "flex flex-row items-center gap-2" }, We = { class: "flex flex-row items-center justify-center gap-1" }, Ne = { class: "text-fm-color-typo-secondary fm-typo-en-body-lg-400" }, Ee = { class: "flex flex-col fm-typo-en-body-lg-600" }, Ue = { class: "flex flex-col" }, Ye = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ze = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, qe = {
291
+ key: 0,
292
+ style: { height: "240px" }
293
+ }, He = {
294
+ key: 1,
295
+ class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary"
296
+ }, Xe = {
297
+ key: 0,
298
+ class: "flex flex-col gap-40"
299
+ }, Ge = {
300
+ key: 1,
301
+ class: "flex flex-row items-center justify-between"
302
+ }, Oe = { class: "fm-typo-en-body-lg-600" }, Je = { class: "flex flex-row items-center gap-8" }, q = /* @__PURE__ */ S({
303
+ __name: "InsightCard",
304
+ props: {
305
+ widget: {
306
+ type: Object,
307
+ default: () => null
308
+ },
309
+ detail: {
310
+ type: Boolean,
311
+ default: !1
312
+ }
313
+ },
314
+ emits: ["click-feedback"],
315
+ setup(e, { emit: t }) {
316
+ const { t: l } = ee(), s = _(() => e.widget.data.isAnomaly > 0 ? "bg-fm-color-system-success-100 text-fm-color-typo-success" : e.widget.data.isAnomaly < 0 ? "bg-fm-color-system-error-100 text-fm-color-typo-error" : ""), i = t;
317
+ function x(h) {
318
+ h === e.widget.feedback.reaction ? i("click-feedback", null) : i("click-feedback", h);
319
+ }
320
+ const u = _(() => {
321
+ const h = "rgb(66, 133, 244)";
322
+ let c = h;
323
+ return e.widget.data.isAnomaly > 0 ? c = "#1F7735" : e.widget.data.isAnomaly < 0 && (c = "#99231D"), [
324
+ {
325
+ label: "Anomaly",
326
+ data: e.widget.data.actualValues.map(
327
+ (v, p) => p >= e.widget.data.actualValues.length - 2 ? v : null
328
+ ),
329
+ fill: !1,
330
+ borderColor: c,
331
+ borderWidth: 2,
332
+ pointRadius: function(v) {
333
+ return v.dataIndex === e.widget.data.actualValues.length - 1 ? 5 : 0;
334
+ },
335
+ pointStyle: "circle",
336
+ pointBackgroundColor: c
337
+ },
338
+ {
339
+ label: "Actual",
340
+ data: e.widget.data.actualValues.map(
341
+ (v, p) => p !== e.widget.data.actualValues.length - 1 ? v : null
342
+ ),
343
+ fill: !1,
344
+ borderColor: h,
345
+ borderWidth: 2
346
+ },
347
+ {
348
+ label: "Expected",
349
+ data: e.widget.data.forecastValues,
350
+ fill: !1,
351
+ borderColor: "white",
352
+ borderWidth: 2
353
+ },
354
+ {
355
+ label: "Upper",
356
+ data: e.widget.data.upperBoundValues,
357
+ fill: 4,
358
+ backgroundColor: "rgba(66, 133, 244, 0.3)",
359
+ borderColor: "white"
360
+ },
361
+ {
362
+ label: "Lower",
363
+ legend: !1,
364
+ data: e.widget.data.lowerBoundValues,
365
+ color: "",
366
+ fill: !1,
367
+ borderColor: "white"
368
+ }
369
+ ];
370
+ }), r = _(
371
+ () => e.widget.data.labels.map((h) => {
372
+ const c = W(h), k = [c.format("DD MMM")], v = c.format("d");
373
+ return (v === "6" || v === "0") && k.push(c.format("ddd")), k;
374
+ })
375
+ ), b = {
376
+ display: !0,
377
+ position: "bottom",
378
+ maxHeight: 54,
379
+ onClick: (h) => h.stopPropagation(),
380
+ labels: {
381
+ usePointStyle: !0,
382
+ filter: function(h, c) {
383
+ return !["Upper", "Lower", "Actual"].includes(
384
+ c.datasets[h.datasetIndex].label
385
+ );
386
+ }
387
+ }
388
+ }, n = _(() => ({ categories: r.value }));
389
+ _(() => Y(e.widget.category));
390
+ const g = _(() => "The total money earned from all customer purchases, including sales, service charges, rounding, and delivery fees, minus any discounts. Revenue = gross sales - discounts + SST + service charge + rounding + delivery fee"), { FmTooltip: $ } = E;
391
+ return (h, c) => {
392
+ var f, D;
393
+ const k = R("FmChip"), v = R("FmIcon"), p = X("wave");
394
+ return o(), d("div", {
395
+ class: L(["flex flex-col gap-40 overflow-y-scroll relative scrollbar-hide", e.detail ? "max-w-[515px]" : "max-w-[368px]"])
396
+ }, [
397
+ M((o(), d("div", {
398
+ variant: "outlined",
399
+ class: L(["flex flex-col p-16 gap-16 relative border rounded-lg", e.detail ? "" : "cursor-pointer"])
400
+ }, [
401
+ a("div", ze, [
402
+ a("div", Pe, [
403
+ a("div", We, [
404
+ y(te, { size: 22 }),
405
+ a("div", Ne, w(m(l)("report.view.insight.title")), 1)
406
+ ]),
407
+ y(k, {
408
+ compact: "",
409
+ label: m(l)(`report.category.${m(Y)(e.widget.category)}`),
410
+ class: "bg-fm-color-system-info-100 text-fm-color-typo-info"
411
+ }, null, 8, ["label"]),
412
+ y(k, {
413
+ class: L(s.value),
414
+ compact: "",
415
+ label: e.widget.data.isAnomaly !== 0 ? m(l)("report.view.insight.status.abnormal") : m(l)("report.view.insight.status.normal")
416
+ }, null, 8, ["class", "label"])
417
+ ]),
418
+ (o(), V(N(e.detail ? m($) : "div"), {
419
+ content: g.value,
420
+ "z-index": 100
421
+ }, {
422
+ default: I(() => [
423
+ a("div", Ee, w(e.widget.title), 1)
424
+ ]),
425
+ _: 1
426
+ }, 8, ["content"])),
427
+ a("div", Ue, [
428
+ a("div", Ye, w(e.widget.restaurantName), 1),
429
+ a("div", Ze, w(m(pe)(e.widget.dateRange)), 1)
430
+ ])
431
+ ]),
432
+ e.detail ? (o(), d("div", qe, [
433
+ y(ke, {
434
+ datasets: u.value,
435
+ "x-axis": n.value,
436
+ legend: b,
437
+ "maintain-aspect-ratio": !1
438
+ }, null, 8, ["datasets", "x-axis"])
439
+ ])) : A("", !0),
440
+ e.detail ? (o(), d("div", He, w(e.widget.description), 1)) : A("", !0)
441
+ ], 2)), [
442
+ [p, !e.detail]
443
+ ]),
444
+ e.detail && e.widget.data.isAnomaly < 0 ? (o(), d("div", Xe, [
445
+ y(Z, {
446
+ title: m(l)("report.view.insight.reason"),
447
+ items: (f = e.widget.data.recommendations) == null ? void 0 : f.map((C) => ({
448
+ header: C.label,
449
+ subLabel: C.reason.replace(C.metric, C.label),
450
+ defination: C.definition
451
+ }))
452
+ }, null, 8, ["title", "items"]),
453
+ y(Z, {
454
+ title: m(l)("report.view.insight.recommendation"),
455
+ items: (D = e.widget.data.recommendations) == null ? void 0 : D.map((C) => ({
456
+ header: C.label,
457
+ subLabel: C.recommendation,
458
+ defination: C.definition
459
+ }))
460
+ }, null, 8, ["title", "items"])
461
+ ])) : A("", !0),
462
+ e.detail ? (o(), d("div", Ge, [
463
+ a("div", Oe, w(m(l)("report.view.insight.feedback.question")), 1),
464
+ a("div", Je, [
465
+ M(y(v, {
466
+ class: "cursor-pointer p-4 icon-btn",
467
+ name: "thumb_up",
468
+ size: "md",
469
+ outline: e.widget.feedback.reaction !== !0,
470
+ onClick: c[0] || (c[0] = () => x(!0))
471
+ }, null, 8, ["outline"]), [
472
+ [p, !0]
473
+ ]),
474
+ M(y(v, {
475
+ class: "cursor-pointer p-4 icon-btn",
476
+ name: "thumb_down",
477
+ size: "md",
478
+ outline: e.widget.feedback.reaction !== !1,
479
+ onClick: c[1] || (c[1] = () => x(!1))
480
+ }, null, 8, ["outline"]), [
481
+ [p, !0]
482
+ ])
483
+ ])
484
+ ])) : A("", !0)
485
+ ], 2);
486
+ };
487
+ }
488
+ }), Ke = { class: "flex w-full justify-between items-center" }, Qe = /* @__PURE__ */ S({
489
+ __name: "SidePanel",
490
+ props: {
491
+ modelValue: { type: Boolean, required: !0 },
492
+ modelModifiers: {}
493
+ },
494
+ emits: ["update:modelValue"],
495
+ setup(e) {
496
+ const t = ae(e, "modelValue"), { FmSideSheet: l } = E;
497
+ return (s, i) => {
498
+ const x = R("FmButton");
499
+ return o(), V(N(m(l)), {
500
+ modelValue: t.value,
501
+ "onUpdate:modelValue": i[1] || (i[1] = (u) => t.value = u),
502
+ "fullscreen-size": "sm",
503
+ "dismiss-away": !0,
504
+ "max-width": 512
505
+ }, {
506
+ "side-sheet-header": I(() => i[2] || (i[2] = [
507
+ oe("Insight")
508
+ ])),
509
+ "top-sheet-header": I(() => [
510
+ a("div", Ke, [
511
+ i[3] || (i[3] = a("p", null, "Insight", -1)),
512
+ y(x, {
513
+ icon: "close",
514
+ variant: "tertiary",
515
+ onClick: i[0] || (i[0] = (u) => t.value = !1)
516
+ })
517
+ ])
518
+ ]),
519
+ default: I(() => [
520
+ H(s.$slots, "default")
521
+ ]),
522
+ _: 3
523
+ }, 8, ["modelValue"]);
524
+ };
525
+ }
526
+ }), et = { class: "flex flex-row px-24 justify-between items-center" }, tt = { class: "flex flex-row items-center gap-2" }, lt = {
527
+ key: 0,
528
+ class: "h-full w-full flex items-center justify-center"
529
+ }, at = {
530
+ key: 1,
531
+ class: "h-full"
532
+ }, ot = {
533
+ key: 0,
534
+ class: "flex flex-row flex-wrap gap-24 px-24 py-16"
535
+ }, ht = /* @__PURE__ */ S({
536
+ __name: "InsightView",
537
+ setup(e) {
538
+ const { t } = ee(), l = ge(), {
539
+ dateRange: s,
540
+ compareDateRange: i,
541
+ locations: x,
542
+ selectedLocationIds: u,
543
+ selectedRestaurantIds: r,
544
+ business: b
545
+ } = K(re()), n = B([]), g = B(null), $ = B(!1), h = ce();
546
+ T(
547
+ b,
548
+ () => {
549
+ b.value && c();
550
+ },
551
+ { immediate: !0 }
552
+ );
553
+ async function c() {
554
+ try {
555
+ $.value = !0, r.value.length === 0 ? n.value = [] : n.value = await he({
556
+ start: s.value.startDate,
557
+ end: s.value.endDate,
558
+ restaurantIds: r.value
559
+ });
560
+ } catch (p) {
561
+ h.open({ message: p, type: "error" }), n.value = [];
562
+ } finally {
563
+ $.value = !1;
564
+ }
565
+ }
566
+ function k(p) {
567
+ if (p !== null) {
568
+ try {
569
+ l.pushDataLayer(
570
+ {
571
+ event: me.report_insight_click_insight_card,
572
+ insight: JSON.stringify(n.value[p])
573
+ },
574
+ "insight"
575
+ );
576
+ } catch (f) {
577
+ console.warn(f);
578
+ }
579
+ g.value = null;
580
+ }
581
+ se(() => {
582
+ g.value = p;
583
+ });
584
+ }
585
+ async function v(p) {
586
+ if (g.value !== null)
587
+ try {
588
+ $.value = !0;
589
+ const f = await ye({
590
+ ...n.value[g.value].feedback,
591
+ reaction: p
592
+ });
593
+ n.value[g.value].feedback = f;
594
+ } catch (f) {
595
+ h.open({ message: f, type: "error" });
596
+ } finally {
597
+ $.value = !1;
598
+ }
599
+ }
600
+ return (p, f) => {
601
+ const D = R("FmPageHead"), C = R("FmCircularProgress");
602
+ return o(), V(ne, null, {
603
+ default: I(() => [
604
+ y(D, {
605
+ title: m(t)("report.view.insight.title")
606
+ }, null, 8, ["title"]),
607
+ a("template", null, [
608
+ a("div", et, [
609
+ a("div", tt, [
610
+ y(fe, {
611
+ modelValue: m(u),
612
+ "onUpdate:modelValue": [
613
+ f[0] || (f[0] = (F) => j(u) ? u.value = F : null),
614
+ c
615
+ ],
616
+ options: m(x)
617
+ }, null, 8, ["modelValue", "options"]),
618
+ y(ie, {
619
+ "date-range": m(s),
620
+ "onUpdate:dateRange": [
621
+ f[1] || (f[1] = (F) => j(s) ? s.value = F : null),
622
+ c
623
+ ],
624
+ "compare-date-range": m(i),
625
+ "onUpdate:compareDateRange": f[2] || (f[2] = (F) => j(i) ? i.value = F : null),
626
+ compare: !1
627
+ }, null, 8, ["date-range", "compare-date-range"])
628
+ ])
629
+ ]),
630
+ $.value ? (o(), d("div", lt, [
631
+ y(C, { size: "xl" })
632
+ ])) : (o(), d("div", at, [
633
+ n.value.length > 0 ? (o(), d("div", ot, [
634
+ (o(!0), d(z, null, P(n.value, (F, U) => (o(), V(q, {
635
+ key: U,
636
+ widget: F,
637
+ onClick: () => k(U)
638
+ }, null, 8, ["widget", "onClick"]))), 128))
639
+ ])) : (o(), V(ue, { key: 1 }))
640
+ ])),
641
+ y(Qe, {
642
+ "model-value": g.value !== null,
643
+ onBack: f[3] || (f[3] = () => k(null))
644
+ }, {
645
+ default: I(() => [
646
+ g.value !== null ? (o(), V(q, {
647
+ key: 0,
648
+ widget: n.value[g.value],
649
+ detail: "",
650
+ onClickFeedback: v
651
+ }, null, 8, ["widget"])) : A("", !0)
652
+ ]),
653
+ _: 1
654
+ }, 8, ["model-value"])
655
+ ])
656
+ ]),
657
+ _: 1
658
+ });
659
+ };
660
+ }
661
+ });
662
+ export {
663
+ ht as default
664
+ };