@feedmepos/mf-report 5.28.0 → 5.28.1

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 (29) hide show
  1. package/dist/{App-BDhSFQX_.js → App-BQcj7ZgK.js} +4 -4
  2. package/dist/{DateRangeSelect-CRsKMi0U.js → DateRangeSelect-TQA-9XXm.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-WGOOX2b8.js → Default.vue_vue_type_script_setup_true_lang-2PkkRpW_.js} +1 -1
  4. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-CQM-l5Rk.js → DynamicWidget.vue_vue_type_script_setup_true_lang-BpZh4FDA.js} +4 -4
  5. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CMioHpn1.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-Ddimiuh3.js} +3 -3
  6. package/dist/{InsightView-lnOobZAr.js → InsightView-BG5IeWD1.js} +5 -5
  7. package/dist/{Integration-D5ssimUg.js → Integration-DUBg0wiX.js} +3 -3
  8. package/dist/{Integrations-CaqGvkzI.js → Integrations-CerT8IlU.js} +2 -2
  9. package/dist/{Layout-DS0XCT_E.js → Layout-Rr16bUkn.js} +1 -1
  10. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-DC9QYJk-.js → LocationSelect.vue_vue_type_script_setup_true_lang-BEUDpozo.js} +2 -2
  11. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-nOukNXp3.js → MenuTab.vue_vue_type_script_setup_true_lang-Ca-Vlwmm.js} +5 -5
  12. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-DXNbt08D.js → NavigationTab.vue_vue_type_script_setup_true_lang-IJ7NUGbC.js} +5 -5
  13. package/dist/{OverviewView-BkIozvMs.js → OverviewView-D5q_5KwX.js} +4 -4
  14. package/dist/{Report-HiSGRNhn.js → Report-CDk8BkDF.js} +3 -3
  15. package/dist/{report-canvas-frame.html → ReportCanvasView-BNy6YAj6.js} +465 -17
  16. package/dist/{ReportEditor-B4tyVB8s.js → ReportEditor-JAgqGYhA.js} +7 -7
  17. package/dist/{ReportView-CIQQHvWT.js → ReportView-C3LFd5yk.js} +6 -6
  18. package/dist/{ReportViewRoute-B3KwVB0v.js → ReportViewRoute-NmDrsao2.js} +2 -2
  19. package/dist/{Setting-CvToMUKq.js → Setting-BCBWGuMP.js} +3 -3
  20. package/dist/{Template-BBQEaHrM.js → Template-B0Z7IA2P.js} +3 -3
  21. package/dist/{TileEditor-Cqy98LmJ.js → TileEditor-CUUIrvVX.js} +6 -6
  22. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-CzggUdfI.js → TilePageStack.vue_vue_type_script_setup_true_lang-ByOoDTHP.js} +2 -2
  23. package/dist/{TransitionFade-D-8BYs6T.js → TransitionFade-DVVKEBlH.js} +5 -5
  24. package/dist/{app-Bjt_JuJi.js → app-CVVEOyIu.js} +12 -12
  25. package/dist/app.js +1 -1
  26. package/dist/{report-DjGDWvm3.js → report-35Rm6TvO.js} +1 -1
  27. package/dist/{useRestaurantPermission-Dkbh_cv8.js → useRestaurantPermission-BAkRCzWY.js} +1 -1
  28. package/package.json +1 -1
  29. package/dist/ReportCanvasView-ILVhB1KL.js +0 -448
@@ -1,448 +0,0 @@
1
- import { ref as N, shallowRef as ne, onMounted as G, onBeforeUnmount as oe, defineComponent as re, watch as L, computed as ae, createElementBlock as U, openBlock as A, createElementVNode as V, createCommentVNode as J, withDirectives as se, createVNode as F, unref as C, isRef as H, withCtx as ie, toDisplayString as Y, vShow as ue } from "vue";
2
- import { useRoute as ce } from "vue-router";
3
- import { u as le } from "./_plugin-vue_export-helper-C6QDExPN.js";
4
- import { storeToRefs as x } from "pinia";
5
- import { _ as de } from "./LocationSelect.vue_vue_type_script_setup_true_lang-DC9QYJk-.js";
6
- import { D as fe } from "./DateRangeSelect-CRsKMi0U.js";
7
- import { F as B, r as j, u as W, a as X, a0 as me } from "./app-Bjt_JuJi.js";
8
- function K(o) {
9
- const { businessId: c } = x(W());
10
- if (!c.value) throw new Error("Business Id is not defined");
11
- return `/${c.value}/report-canvas/${o}`;
12
- }
13
- const pe = (o) => {
14
- const c = {
15
- fetchType: B.Get,
16
- url: K(o)
17
- };
18
- return j.fetch(c);
19
- }, ve = (o, c, l, s) => {
20
- const p = {
21
- fetchType: B.Post,
22
- url: `${K(o)}/query/${c}`,
23
- data: { params: l, timezone: s }
24
- };
25
- return j.fetch(p);
26
- }, ye = (o, c, l) => {
27
- const s = {
28
- fetchType: B.Post,
29
- url: `${K(o)}/section/${c}/ack`,
30
- data: l
31
- };
32
- return j.fetch(s);
33
- }, he = ["@from", "@to", "@locationIds", "@timezone"], we = ["@from", "@to", "@locationIds"], ge = 1, Se = 1500;
34
- function Re(o) {
35
- if (!(!(o instanceof me) || o.status !== 429))
36
- return Math.min(Math.max(o.retryAfterMs ?? Se, 500), 5e3);
37
- }
38
- const be = {
39
- MY: "MYR",
40
- SG: "SGD",
41
- TH: "THB",
42
- ID: "IDR",
43
- PH: "PHP",
44
- VN: "VND",
45
- BN: "BND",
46
- KH: "KHR",
47
- MM: "MMK",
48
- AE: "AED",
49
- MO: "MOP",
50
- MV: "MVR",
51
- AU: "AUD",
52
- JP: "JPY",
53
- TW: "TWD",
54
- HK: "HKD"
55
- };
56
- function q(o) {
57
- return o == null ? !0 : Array.isArray(o) ? o.length === 0 : o === "";
58
- }
59
- function _e(o) {
60
- const c = X(), { dateRange: l, selectedLocationIds: s, locations: p, timezone: v } = x(c), { country: _ } = x(W()), r = N({}), i = ne({}), R = N([]), I = [], g = {}, y = {};
61
- function O(e) {
62
- I.push(e);
63
- }
64
- function k(e) {
65
- i.value = { ...i.value, [e.queryId]: e }, I.forEach((n) => n(e));
66
- }
67
- function T(e) {
68
- const n = {};
69
- for (const m of e.params)
70
- n[m.name] = m.default ?? null;
71
- n["@from"] = l.value.startDate ?? null, n["@to"] = l.value.endDate ?? null, n["@timezone"] = v.value, n["@locationIds"] = s.value.length ? [...s.value] : p.value.map((m) => m.id), r.value = n;
72
- }
73
- function a() {
74
- return {
75
- locations: p.value.map((e) => ({
76
- id: e.id,
77
- name: e.name || e.id,
78
- code: e.code
79
- })),
80
- timezone: v.value,
81
- locale: navigator.language || "en-US",
82
- currency: be[(_.value || "").toUpperCase()] ?? ""
83
- };
84
- }
85
- function h(e) {
86
- return JSON.stringify(e.dependsOn.map((n) => r.value[n] ?? null));
87
- }
88
- function S(e) {
89
- return !!e.lazy && e.dependsOn.some((n) => q(r.value[n] ?? null));
90
- }
91
- function D() {
92
- return !we.some((e) => e in r.value && q(r.value[e] ?? null));
93
- }
94
- async function E(e) {
95
- var m;
96
- const n = (g[e.id] ?? 0) + 1;
97
- g[e.id] = n, k({
98
- queryId: e.id,
99
- runId: n,
100
- status: "loading",
101
- rows: ((m = i.value[e.id]) == null ? void 0 : m.rows) ?? [],
102
- truncated: !1
103
- });
104
- for (let b = 0; ; b++)
105
- try {
106
- const w = await ve(
107
- o,
108
- e.id,
109
- r.value,
110
- v.value
111
- );
112
- if (g[e.id] !== n) return;
113
- k({
114
- queryId: e.id,
115
- runId: n,
116
- status: "ok",
117
- rows: w.rows ?? [],
118
- truncated: !!w.truncated
119
- });
120
- return;
121
- } catch (w) {
122
- if (g[e.id] !== n) return;
123
- const f = Re(w);
124
- if (f !== void 0 && b < ge) {
125
- if (await new Promise((u) => setTimeout(u, f)), g[e.id] !== n) return;
126
- continue;
127
- }
128
- k({
129
- queryId: e.id,
130
- runId: n,
131
- status: "error",
132
- rows: [],
133
- truncated: !1,
134
- error: w instanceof Error ? w.message : String(w)
135
- });
136
- return;
137
- }
138
- }
139
- function M(e = {}) {
140
- var m, b, w;
141
- const n = !D();
142
- for (const f of R.value) {
143
- if (S(f)) {
144
- delete y[f.id], ((m = i.value[f.id]) == null ? void 0 : m.status) !== "idle" && k({
145
- queryId: f.id,
146
- runId: g[f.id] ?? 0,
147
- status: "idle",
148
- rows: [],
149
- truncated: !1
150
- });
151
- continue;
152
- }
153
- if (n) {
154
- ((b = i.value[f.id]) == null ? void 0 : b.status) !== "loading" && k({
155
- queryId: f.id,
156
- runId: g[f.id] ?? 0,
157
- status: "loading",
158
- rows: ((w = i.value[f.id]) == null ? void 0 : w.rows) ?? [],
159
- truncated: !1
160
- });
161
- continue;
162
- }
163
- const u = h(f);
164
- !e.force && y[f.id] === u || (y[f.id] = u, E(f));
165
- }
166
- }
167
- function P(e) {
168
- const n = { ...r.value };
169
- let m = !1;
170
- for (const [b, w] of Object.entries(e))
171
- b in n && JSON.stringify(n[b] ?? null) !== JSON.stringify(w ?? null) && (n[b] = w, m = !0);
172
- return m ? (r.value = n, M(), !0) : !1;
173
- }
174
- function t(e) {
175
- R.value = e.queries, i.value = {};
176
- for (const n of Object.keys(g)) delete g[n];
177
- for (const n of Object.keys(y)) delete y[n];
178
- T(e), M();
179
- }
180
- function d(e, n = []) {
181
- R.value = e.queries;
182
- const m = JSON.stringify(r.value), b = {};
183
- for (const u of e.params)
184
- b[u.name] = u.name in r.value ? r.value[u.name] : u.default ?? null;
185
- r.value = b;
186
- const w = new Set(e.queries.map((u) => u.id));
187
- for (const u of Object.keys(g)) w.has(u) || delete g[u];
188
- for (const u of Object.keys(y)) w.has(u) || delete y[u];
189
- const f = Object.keys(i.value).filter((u) => !w.has(u));
190
- if (f.length) {
191
- const u = { ...i.value };
192
- for (const te of f) delete u[te];
193
- i.value = u;
194
- }
195
- for (const u of n) delete y[u];
196
- return M(), JSON.stringify(r.value) !== m;
197
- }
198
- return {
199
- params: r,
200
- results: i,
201
- queries: R,
202
- env: a,
203
- load: t,
204
- applyCanvas: d,
205
- run: M,
206
- setParams: P,
207
- onResult: O,
208
- RESERVED: he
209
- };
210
- }
211
- function Z(o) {
212
- const c = o.replace(/^\//, "");
213
- try {
214
- const l = new URL(import.meta.url);
215
- if (typeof location < "u" && location.hostname !== l.hostname)
216
- return new URL(c, l).href;
217
- } catch {
218
- }
219
- return `${"/".replace(/\/$/, "")}/${c}`;
220
- }
221
- const ee = {
222
- "chart.js@4": "chart.js-4.js",
223
- "fm-ui@1": "fm-ui-1.js"
224
- }, $ = /* @__PURE__ */ new Map();
225
- function Ee(o) {
226
- return Z(`report-canvas-libs/${ee[o]}`);
227
- }
228
- async function z(o) {
229
- const c = [...new Set(o)].filter((s) => ee[s]), l = {};
230
- return await Promise.all(
231
- c.map(async (s) => {
232
- if (!$.has(s)) {
233
- const v = await fetch(Ee(s));
234
- if (!v.ok) return;
235
- $.set(s, await v.text());
236
- }
237
- const p = $.get(s);
238
- p && (l[s] = p);
239
- })
240
- ), l;
241
- }
242
- const Ie = Z("report-canvas-frame.html"), Q = 8e3;
243
- function ke(o, c) {
244
- const l = N(!1);
245
- let s = null;
246
- const p = /* @__PURE__ */ new Map();
247
- let v;
248
- const _ = /* @__PURE__ */ new Map();
249
- function r() {
250
- var t;
251
- return ((t = o.value) == null ? void 0 : t.contentWindow) ?? null;
252
- }
253
- function i(t) {
254
- var d;
255
- (d = r()) == null || d.postMessage(JSON.parse(JSON.stringify(t)), "*");
256
- }
257
- function R(t) {
258
- const d = r();
259
- if (!d || t.source !== d) return;
260
- const e = t.data;
261
- if (!(!e || typeof e != "object"))
262
- switch (e.type) {
263
- case "ready":
264
- if (l.value) return;
265
- v = e.nonce, l.value = !0, s == null || s(), s = null, D();
266
- break;
267
- case "setParams":
268
- c.onSetParams(e.values ?? {});
269
- break;
270
- case "rendered":
271
- if (!I(e)) return;
272
- y(e.sectionId, e.version), c.onSectionRendered(e.sectionId, e.version);
273
- break;
274
- case "error":
275
- if (!I(e)) return;
276
- y(e.sectionId, e.version), c.onSectionError(e.sectionId, e.version, e.message);
277
- break;
278
- }
279
- }
280
- function I(t) {
281
- return !v || t.nonce === v ? !0 : (console.warn("[report-canvas] dropped a render outcome without the shell nonce"), !1);
282
- }
283
- function g(t, d) {
284
- return `${t}@${d}`;
285
- }
286
- function y(t, d) {
287
- if (d === void 0) return;
288
- const e = g(t, d), n = _.get(e);
289
- n !== void 0 && (clearTimeout(n), _.delete(e));
290
- }
291
- function O() {
292
- _.forEach((t) => clearTimeout(t)), _.clear();
293
- }
294
- function k(t) {
295
- for (const d of t) {
296
- const e = g(d.id, d.version);
297
- _.has(e) || _.set(
298
- e,
299
- setTimeout(() => {
300
- _.delete(e), c.onSectionError(
301
- d.id,
302
- d.version,
303
- `the section did not report a render within ${Q}ms`
304
- );
305
- }, Q)
306
- );
307
- }
308
- }
309
- async function T(t, d, e) {
310
- const n = await z(t.flatMap((b) => b.libs ?? [])), m = () => {
311
- i({ type: "init", sections: t, params: d, libs: n, env: e }), O(), k(t);
312
- };
313
- l.value ? m() : s = m;
314
- }
315
- async function a(t) {
316
- const d = await z(t.flatMap((e) => e.libs ?? []));
317
- i({ type: "sections", sections: t, libs: d }), k(t);
318
- }
319
- function h(t) {
320
- i({ type: "params", values: t });
321
- }
322
- function S(t) {
323
- i({ type: "env", env: t });
324
- }
325
- function D() {
326
- const t = [...p.values()];
327
- p.clear(), t.forEach(E);
328
- }
329
- function E(t) {
330
- i({
331
- type: "rows",
332
- queryId: t.queryId,
333
- runId: t.runId,
334
- rows: t.rows,
335
- status: t.status,
336
- truncated: t.truncated,
337
- error: t.error
338
- });
339
- }
340
- function M(t) {
341
- if (!l.value) {
342
- p.set(t.queryId, t);
343
- return;
344
- }
345
- E(t);
346
- }
347
- G(() => window.addEventListener("message", R)), oe(() => {
348
- window.removeEventListener("message", R), O();
349
- });
350
- function P() {
351
- l.value = !1, s = null, v = void 0, p.clear(), O();
352
- }
353
- return { ready: l, init: T, swapSections: a, pushParams: h, pushEnv: S, pushRows: M, reset: P };
354
- }
355
- const Me = { class: "flex h-full min-h-0 w-full" }, Oe = { class: "flex min-w-0 grow flex-col" }, Pe = { class: "flex items-start overflow-x-auto border-b border-fm-color-border-secondary px-16 py-8 scrollbar-hide" }, Ce = {
356
- key: 0,
357
- class: "fm-typo-en-body-xs-400 border-b border-fm-color-border-secondary bg-fm-color-system-warning-100 px-16 py-8"
358
- }, Ne = {
359
- key: 1,
360
- class: "fm-typo-en-body-sm-400 p-16 text-fm-color-typo-error"
361
- }, Te = ["src", "title"], je = /* @__PURE__ */ re({
362
- __name: "ReportCanvasView",
363
- setup(o) {
364
- const c = ce(), { t: l } = le(), s = String(c.query.reportId ?? ""), p = N(), v = N(""), _ = N(), r = _e(s), { dateRange: i, selectedLocationIds: R, locations: I, timezone: g } = x(X()), y = ke(_, {
365
- onSetParams: (a) => {
366
- r.setParams(a) && y.pushParams(r.params.value);
367
- },
368
- onSectionRendered: (a, h) => void O(a, h, "ok"),
369
- onSectionError: (a, h, S) => {
370
- console.warn("[report-canvas] section failed", { reportId: s, sectionId: a, message: S }), O(a, h, "error", S);
371
- }
372
- });
373
- r.onResult((a) => y.pushRows(a));
374
- async function O(a, h, S, D) {
375
- var P;
376
- const E = (P = p.value) == null ? void 0 : P.sections.find((t) => t.id === a);
377
- if (!E || h !== E.version) return;
378
- const M = S === "error" ? D ?? "the section failed to render" : void 0;
379
- if (!(E.status === S && E.error === M)) {
380
- E.status = S, E.error = M;
381
- try {
382
- await ye(s, a, { version: h, status: S, error: M });
383
- } catch (t) {
384
- console.warn("[report-canvas] ack failed", { reportId: s, sectionId: a, err: t });
385
- }
386
- }
387
- }
388
- async function k() {
389
- try {
390
- v.value = "";
391
- const a = await pe(s);
392
- p.value = a, r.load(a), await y.init(a.sections, r.params.value, r.env());
393
- } catch (a) {
394
- v.value = a instanceof Error ? a.message : String(a);
395
- }
396
- }
397
- L([i, R, I], () => {
398
- if (!p.value) return;
399
- r.setParams({
400
- "@from": i.value.startDate ?? null,
401
- "@to": i.value.endDate ?? null,
402
- "@locationIds": R.value.length ? [...R.value] : I.value.map((h) => h.id)
403
- }) && y.pushParams(r.params.value);
404
- }), L([I, g], () => {
405
- p.value && y.pushEnv(r.env());
406
- });
407
- const T = ae(
408
- () => Object.values(r.results.value).some((a) => a.truncated)
409
- );
410
- return G(async () => {
411
- await k();
412
- }), (a, h) => (A(), U("div", Me, [
413
- V("div", Oe, [
414
- V("div", Pe, [
415
- F(de, {
416
- modelValue: C(R),
417
- "onUpdate:modelValue": h[1] || (h[1] = (S) => H(R) ? R.value = S : null),
418
- options: C(I)
419
- }, {
420
- default: ie(() => [
421
- F(fe, {
422
- "date-range": C(i),
423
- "onUpdate:dateRange": h[0] || (h[0] = (S) => H(i) ? i.value = S : null)
424
- }, null, 8, ["date-range"])
425
- ]),
426
- _: 1
427
- }, 8, ["modelValue", "options"])
428
- ]),
429
- T.value ? (A(), U("div", Ce, Y(C(l)("reportV5.reportCanvas.canvas.truncated")), 1)) : J("", !0),
430
- v.value ? (A(), U("p", Ne, Y(v.value), 1)) : J("", !0),
431
- se(V("iframe", {
432
- ref_key: "frame",
433
- ref: _,
434
- "data-testid": "report-canvas-frame",
435
- class: "min-h-0 grow border-0",
436
- src: C(Ie),
437
- sandbox: "allow-scripts",
438
- title: C(l)("reportV5.reportCanvas.canvas.title")
439
- }, null, 8, Te), [
440
- [ue, !v.value]
441
- ])
442
- ])
443
- ]));
444
- }
445
- });
446
- export {
447
- je as default
448
- };