@feedmepos/mf-report 5.32.2-beta.0 → 5.32.3-beta.0

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 (40) hide show
  1. package/dist/{App-BP79-pGe.js → App-BNQfnOS8.js} +4 -4
  2. package/dist/{DateRangeSelect-BQeTCYj3.js → DateRangeSelect-BS73I-EY.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-BOeoaMo1.js → Default.vue_vue_type_script_setup_true_lang-D0mOTzcw.js} +1 -1
  4. package/dist/DigestListView-C8FI4P9l.js +876 -0
  5. package/dist/DigestReaderView-uYimDn1a.js +526 -0
  6. package/dist/{DynamicWidget.vue_vue_type_script_setup_true_lang-D8QF3uYf.js → DynamicWidget.vue_vue_type_script_setup_true_lang-g0wq9TN7.js} +6 -6
  7. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-qJU3Lajn.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-C6Kk1Oc6.js} +4 -4
  8. package/dist/{InsightView-BdFa7Puu.js → InsightView-CYY3JR4R.js} +5 -5
  9. package/dist/{Integration-BYVJWVVm.js → Integration-CV75SnmP.js} +179 -179
  10. package/dist/{Integrations-C2C3ZTZE.js → Integrations-CtE730pa.js} +2 -2
  11. package/dist/{Layout-DA6Ea_fd.js → Layout-DjQ9AR4L.js} +1 -1
  12. package/dist/{LocationSelect.vue_vue_type_script_setup_true_lang-BWIv2bXa.js → LocationSelect.vue_vue_type_script_setup_true_lang-CLZJZtaS.js} +2 -2
  13. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-qZ20899_.js → MenuTab.vue_vue_type_script_setup_true_lang-BkCwTEZ8.js} +5 -5
  14. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-gUs7SED3.js → NavigationTab.vue_vue_type_script_setup_true_lang-BnbjdkWg.js} +5 -5
  15. package/dist/{OverviewView-DxEdvcVU.js → OverviewView-DrLXEnyQ.js} +5 -5
  16. package/dist/{Report-Cwt1I1WF.js → Report-BFeedwld.js} +3 -3
  17. package/dist/ReportCanvasView-uSPSmxoS.js +1035 -0
  18. package/dist/{ReportEditor-DHEZfsbo.js → ReportEditor-DdmeWp-N.js} +7 -7
  19. package/dist/{ReportView-BJsozRvM.js → ReportView-DP-3aapL.js} +6 -6
  20. package/dist/{ReportViewRoute-D8SmSqK6.js → ReportViewRoute-Djtc4rpu.js} +2 -2
  21. package/dist/{Setting-Cz23FN6Y.js → Setting-Co0Fv5PF.js} +3 -3
  22. package/dist/{Template-FymPP-MH.js → Template-Dmfdlx_-.js} +3 -3
  23. package/dist/{TileEditor-B6qWtJyl.js → TileEditor-lbcwAmG7.js} +6 -6
  24. package/dist/{TilePageStack.vue_vue_type_script_setup_true_lang-DrWGT9_C.js → TilePageStack.vue_vue_type_script_setup_true_lang-Bewf5Mwf.js} +2 -2
  25. package/dist/{TransitionFade-D7B83Dif.js → TransitionFade-BvzD7CKL.js} +5 -5
  26. package/dist/{app-D_dN5Wt5.js → app-Bvy-gTq7.js} +14 -14
  27. package/dist/app.js +1 -1
  28. package/dist/{currency-DqVpMeDl.js → currency-CAUD27u3.js} +1 -1
  29. package/dist/{index-C4HXhNGH.js → index-D9j1ly8Z.js} +1 -1
  30. package/dist/{report-BU89xSvp.js → report-B4jAut5H.js} +1 -1
  31. package/dist/report-canvas-libs/components-1.js +57 -15
  32. package/dist/report-canvas-libs-CNx4fuqd.js +40 -0
  33. package/dist/style.css +1 -1
  34. package/dist/{useDigestFont-BEucXChN.js → useDigestFont-6hcS7_aG.js} +1 -1
  35. package/dist/{useReportCanvasPanel-DS-t5Qo6.js → useReportCanvasPanel-C2iiBQZf.js} +356 -393
  36. package/dist/{useRestaurantPermission-DCN49TLJ.js → useRestaurantPermission-D6WmoPR2.js} +1 -1
  37. package/package.json +1 -1
  38. package/dist/DigestListView-BzBiyKDg.js +0 -637
  39. package/dist/DigestReaderView-D7XQFPuA.js +0 -507
  40. package/dist/ReportCanvasView-wHRaYc3f.js +0 -966
@@ -2,7 +2,7 @@ import { computed as u } from "vue";
2
2
  import { u as c } from "./_plugin-vue_export-helper-C6QDExPN.js";
3
3
  import { useSnackbar as f } from "@feedmepos/ui-library";
4
4
  import { useCoreStore as d } from "@feedmepos/mf-common";
5
- import { a2 as l, a3 as i } from "./app-D_dN5Wt5.js";
5
+ import { a2 as l, a3 as i } from "./app-Bvy-gTq7.js";
6
6
  function g(t) {
7
7
  return Array.isArray(t) ? t : [];
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-report",
3
- "version": "5.32.2-beta.0",
3
+ "version": "5.32.3-beta.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -1,637 +0,0 @@
1
- import { defineComponent as ve, ref as C, watch as Le, onBeforeUnmount as Ce, computed as u, createElementBlock as r, openBlock as o, normalizeClass as H, createElementVNode as v, createCommentVNode as m, renderSlot as Re, createTextVNode as Te, toDisplayString as y, unref as x, Fragment as w, renderList as q, resolveComponent as he, createBlock as oe, withCtx as le, createVNode as Z, createSlots as je, onMounted as Ee, onUnmounted as qe } from "vue";
2
- import { storeToRefs as Ie } from "pinia";
3
- import { useI18n as fe } from "@feedmepos/mf-common";
4
- import { useBreakpoints as Se } from "@feedmepos/ui-library";
5
- import { _ as Oe } from "./Default.vue_vue_type_script_setup_true_lang-BOeoaMo1.js";
6
- import { _ as we } from "./SelectComponent.vue_vue_type_script_setup_true_lang-DW7Dk7iQ.js";
7
- import { useRoute as Ne } from "vue-router";
8
- import { c as Pe, d as Be, u as Ae, a as He, n as Xe, _ as ze, D as Ye } from "./useDigestFont-BEucXChN.js";
9
- import { _ as ge } from "./_plugin-vue_export-helper-C6QDExPN.js";
10
- import { j as Ue, f as We, A as Ze, k as be, r as Ge, l as Ke } from "./app-D_dN5Wt5.js";
11
- const Je = { class: "flex items-center justify-between gap-8" }, Qe = { class: "digest-kind" }, et = ["viewBox", "height", "aria-label"], tt = ["x2", "y1", "y2"], st = ["d"], at = ["d"], ot = ["d"], nt = ["x", "y", "width", "height"], rt = ["x", "y"], lt = ["x", "y", "width", "height"], it = ["x1", "x2", "y1", "y2"], ut = ["cx", "cy"], dt = ["x", "y", "text-anchor"], ct = ["x"], ht = ["x", "y"], vt = {
12
- key: 1,
13
- class: "flex items-start gap-8",
14
- "data-testid": "digest-cover-quote"
15
- }, ft = { class: "digest-quote" }, gt = ["title"], ae = 28, W = 12, mt = 12, pt = /* @__PURE__ */ ve({
16
- __name: "DigestCover",
17
- props: {
18
- cover: {},
19
- quote: {},
20
- dark: { type: Boolean },
21
- hero: { type: Boolean }
22
- },
23
- setup(ne) {
24
- const n = ne, { t: p, locale: N } = fe(), I = C(), P = C(0);
25
- let M;
26
- Le(I, (e) => {
27
- M == null || M.disconnect(), !(!e || typeof ResizeObserver > "u") && (M = new ResizeObserver(([s]) => {
28
- const { width: t, height: i } = s.contentRect;
29
- t && (P.value = i / t);
30
- }), M.observe(e));
31
- }), Ce(() => M == null ? void 0 : M.disconnect());
32
- const B = u(() => n.hero ? 520 : 340), _ = u(
33
- () => n.hero ? 26 + (se.value.some((e) => e.lines.length > 1) ? 12 : 0) : 6
34
- ), k = u(
35
- () => P.value ? Math.max(ae + _.value + 40, Math.round(B.value * P.value)) : n.hero ? 168 : 110
36
- ), O = u(() => {
37
- const e = n.cover;
38
- return e ? [e.title, e.takeaway].filter(Boolean).join(" · ") : p("reportV5.digest.card.leadStory");
39
- }), f = u(
40
- () => {
41
- var e, s;
42
- return [(e = n.cover) == null ? void 0 : e.title, ...(((s = n.cover) == null ? void 0 : s.marks) ?? []).map((t) => t.label)].filter(Boolean).join(" · ");
43
- }
44
- ), F = u(
45
- () => {
46
- var e;
47
- return (((e = n.cover) == null ? void 0 : e.series) ?? []).flatMap((s) => s.values).filter((s) => s !== null);
48
- }
49
- ), R = u(() => {
50
- var i;
51
- const e = n.cover;
52
- if ((e == null ? void 0 : e.kind) !== "waterfall") return [];
53
- const s = ((i = e.series[0]) == null ? void 0 : i.values) ?? [];
54
- let t = 0;
55
- return s.map((a, c) => {
56
- const d = a ?? 0, h = c === 0 || c === s.length - 1, g = h ? 0 : t;
57
- return t = h ? d : t + d, { from: g, to: t, change: d, total: h };
58
- });
59
- }), b = u(
60
- () => R.value.flatMap((e) => e.total ? [e.to] : [e.from, e.to])
61
- ), V = u(() => {
62
- const e = b.value;
63
- if (!e.length) return 0;
64
- const s = Math.min(...e), t = Math.max(...e);
65
- return !(s > 0) || s === t || (t - s) * 4 >= t ? 0 : s - (t - s);
66
- }), D = u(() => {
67
- var h, g;
68
- const e = k.value - ae - _.value, s = ($, z) => (Y) => ae + e - (Y - $) / (z - $ || 1) * e;
69
- if (((h = n.cover) == null ? void 0 : h.kind) === "waterfall") {
70
- const $ = b.value;
71
- return $.length ? s(Math.min(V.value, ...$), Math.max(...$)) : s(0, 1);
72
- }
73
- const t = F.value;
74
- if (!t.length) return ($) => k.value - _.value;
75
- const i = ((g = n.cover) == null ? void 0 : g.kind) === "bar", a = i ? Math.min(0, ...t) : Math.min(...t), c = Math.max(...t), d = c - a || Math.abs(c) || 1;
76
- return i ? s(a, c) : s(a - d * 0.15, c + d * 0.05);
77
- }), T = u(() => {
78
- var e;
79
- return ((e = n.cover) == null ? void 0 : e.x.length) ?? 0;
80
- }), G = u(() => T.value > 1 ? (B.value - W * 2) / (T.value - 1) : 0), j = (e) => T.value > 1 ? W + e * G.value : B.value / 2;
81
- function K(e) {
82
- let s = "M";
83
- return e.map((t, i) => {
84
- if (t === null)
85
- return s = "M", "";
86
- const a = `${s}${j(i).toFixed(1)},${D.value(t).toFixed(1)}`;
87
- return s = "L", a;
88
- }).join(" ");
89
- }
90
- const J = u(
91
- () => {
92
- var e;
93
- return ((e = n.cover) == null ? void 0 : e.kind) === "line" ? n.cover.series.map((s) => K(s.values)) : [];
94
- }
95
- ), re = u(() => {
96
- var t, i;
97
- const e = ((t = n.cover) == null ? void 0 : t.kind) === "line" ? (i = n.cover.series[0]) == null ? void 0 : i.values : void 0;
98
- if (!e || e.some((a) => a === null) || e.length < 2) return "";
99
- const s = (k.value - _.value).toFixed(1);
100
- return `${K(e)} L${j(e.length - 1).toFixed(1)},${s} L${j(0).toFixed(1)},${s} Z`;
101
- }), S = u(() => (B.value - W * 2) / Math.max(T.value, 1)), X = u(() => {
102
- var e;
103
- return Math.min(((e = n.cover) == null ? void 0 : e.series.length) ?? 0, 2);
104
- }), Q = u(() => S.value * 0.72 / Math.max(X.value, 1)), ee = (e, s) => W + e * S.value + S.value * 0.14 + s * Q.value, me = u(() => {
105
- const e = n.cover;
106
- if ((e == null ? void 0 : e.kind) !== "bar") return [];
107
- const s = D.value(0), t = e.marks ?? [];
108
- return e.series.slice(0, X.value).flatMap(
109
- (i, a) => i.values.map((c, d) => {
110
- const h = c === null ? s : D.value(c), g = t.some(($) => $.at === d && $.series === a);
111
- return {
112
- key: `${a}-${d}`,
113
- x: ee(d, a),
114
- y: Math.min(h, s),
115
- width: Math.max(Q.value - 1.5, 1.5),
116
- height: Math.max(Math.abs(s - h), c === null ? 0 : 1.5),
117
- faint: a > 0,
118
- marked: g,
119
- // a noted bar stands out against the bars it is compared with
120
- muted: t.length > 0 && !g && a === 0
121
- };
122
- })
123
- );
124
- });
125
- function l(e, s) {
126
- var d;
127
- const t = (d = n.cover) == null ? void 0 : d.format, i = Math.abs(t === "ratio" ? e * 100 : e), a = new Intl.NumberFormat(N.value, {
128
- maximumFractionDigits: i >= 100 ? 0 : 1
129
- }).format(i), c = t === "ratio" || t === "percent" ? "%" : "";
130
- return `${s ? "" : e < 0 ? "−" : "+"}${a}${c}`;
131
- }
132
- const E = u(() => {
133
- const e = V.value, s = S.value * 0.6, t = R.value.map((a, c) => {
134
- const d = D.value(a.total ? e : a.from), h = D.value(a.to), g = W + c * S.value + (S.value - s) / 2;
135
- return {
136
- key: c,
137
- x: g,
138
- y: Math.min(d, h),
139
- width: s,
140
- height: Math.max(Math.abs(d - h), 1.5),
141
- total: a.total,
142
- figure: l(a.change, a.total),
143
- figureX: g + s / 2
144
- };
145
- }), i = n.hero && t.every((a) => a.figure.length * 6.5 <= S.value);
146
- return t.map((a) => ({ ...a, figure: i ? a.figure : "" }));
147
- }), te = (e) => e.length * (n.hero ? 7.5 : 7), ie = u(() => {
148
- const e = n.cover;
149
- if ((e == null ? void 0 : e.kind) !== "line" && (e == null ? void 0 : e.kind) !== "bar") return [];
150
- const s = e.kind === "line", t = [], i = (e.marks ?? []).flatMap((a, c) => {
151
- var xe;
152
- const d = (xe = e.series[a.series]) == null ? void 0 : xe.values[a.at];
153
- if (d == null || !s && a.series >= X.value) return [];
154
- const h = s ? j(a.at) : ee(a.at, a.series) + Q.value / 2, g = D.value(d), $ = h > B.value * 0.8 ? "end" : h < B.value * 0.2 ? "start" : "middle", z = te(a.label), Y = $ === "end" ? h - z : $ === "start" ? h : h - z / 2, ue = !s && d < 0, U = s ? Math.max(g - 12, 16) : ue ? g + 14 : g - 6, pe = ue ? 14 : -14, De = (de) => de >= 12 && de <= k.value - _.value && !t.some((ce) => Y < ce.x1 && Y + z > ce.x0 && Math.abs(de - ce.y) < 14), ye = [U, U + pe, U + pe * 2], _e = D.value(0) + (ue ? -6 : 14), L = (s ? n.hero ? [...ye, g + 22, g + 36] : [U] : [...n.hero ? ye : [U], _e]).find(De);
155
- L !== void 0 && t.push({ x0: Y, x1: Y + z, y: L });
156
- const ke = s ? 6 : 2, Fe = L === void 0 || L === U || !s && L === _e ? void 0 : L < g ? [g - ke, L + 3] : [g + ke, L - 11];
157
- return [
158
- {
159
- key: c,
160
- x: h,
161
- y: g,
162
- anchor: $,
163
- dot: s,
164
- labelY: L ?? 0,
165
- label: L === void 0 ? "" : a.label,
166
- leader: Fe
167
- }
168
- ];
169
- });
170
- return n.hero || i.every((a) => a.label) ? i : i.map((a) => ({ ...a, label: "", leader: void 0 }));
171
- });
172
- function A(e, s, t) {
173
- const i = (c) => c.length * 6.5 <= s;
174
- if (i(e)) return [e];
175
- if (!t) return;
176
- const a = e.split(" ");
177
- for (let c = a.length - 1; c > 0; c--) {
178
- const d = [a.slice(0, c).join(" "), a.slice(c).join(" ")];
179
- if (d.every(i)) return d;
180
- }
181
- }
182
- const se = u(() => {
183
- const e = n.cover;
184
- if (!n.hero || !e) return [];
185
- const s = e.kind !== "line", t = Math.ceil(e.x.length / mt), i = e.x.length - 1, a = (s ? S.value : G.value) * t, c = e.x.map((d, h) => ({
186
- x: s ? W + h * S.value + S.value / 2 : j(h),
187
- lines: A(Pe(e, h, N.value), a, s),
188
- marked: (e.marks ?? []).some((g) => g.at === h)
189
- })).filter((d, h) => (i - h) % t === 0);
190
- return c.every((d) => d.lines) ? c.map((d) => ({ ...d, lines: d.lines })) : [];
191
- }), Ve = u(() => {
192
- if (!n.hero) return [];
193
- const e = k.value - _.value;
194
- return [e, (e + ae) / 2, ae];
195
- });
196
- return (e, s) => (o(), r("div", {
197
- class: H(["digest-vis", { dark: e.dark, hero: e.hero }])
198
- }, [
199
- v("div", Je, [
200
- v("span", Qe, [
201
- s[0] || (s[0] = v("svg", {
202
- width: "13",
203
- height: "13",
204
- viewBox: "0 0 24 24",
205
- fill: "none",
206
- stroke: "currentColor",
207
- "stroke-width": "2.4",
208
- "stroke-linecap": "round",
209
- "stroke-linejoin": "round",
210
- "aria-hidden": "true"
211
- }, [
212
- v("path", { d: "M4 17l5-5 4 4 7-7" }),
213
- v("path", { d: "M15 9h5v5" })
214
- ], -1)),
215
- Te(" " + y(x(p)("reportV5.digest.card.weekly")), 1)
216
- ]),
217
- Re(e.$slots, "badge", {}, void 0, !0)
218
- ]),
219
- e.cover ? (o(), r("svg", {
220
- key: 0,
221
- ref_key: "chart",
222
- ref: I,
223
- "data-testid": "digest-cover",
224
- class: "digest-chart",
225
- viewBox: `0 0 ${B.value} ${k.value}`,
226
- width: "100%",
227
- height: e.hero ? 200 : 110,
228
- role: "img",
229
- "aria-label": f.value
230
- }, [
231
- (o(!0), r(w, null, q(Ve.value, (t) => (o(), r("line", {
232
- key: `grid-${t}`,
233
- x1: "0",
234
- x2: B.value,
235
- y1: t,
236
- y2: t,
237
- class: "grid"
238
- }, null, 8, tt))), 128)),
239
- e.cover.kind === "line" ? (o(), r(w, { key: 0 }, [
240
- re.value ? (o(), r("path", {
241
- key: 0,
242
- d: re.value,
243
- class: "area"
244
- }, null, 8, st)) : m("", !0),
245
- (o(!0), r(w, null, q(J.value.slice(1), (t, i) => (o(), r("path", {
246
- key: `base-${i}`,
247
- d: t,
248
- class: "baseline"
249
- }, null, 8, at))), 128)),
250
- J.value[0] ? (o(), r("path", {
251
- key: 1,
252
- d: J.value[0],
253
- class: "line"
254
- }, null, 8, ot)) : m("", !0)
255
- ], 64)) : e.cover.kind === "waterfall" ? (o(!0), r(w, { key: 1 }, q(E.value, (t) => (o(), r(w, {
256
- key: t.key
257
- }, [
258
- v("rect", {
259
- x: t.x,
260
- y: t.y,
261
- width: t.width,
262
- height: t.height,
263
- rx: "2",
264
- class: H(["bar", t.total ? "total" : "step"])
265
- }, null, 10, nt),
266
- t.figure ? (o(), r("text", {
267
- key: 0,
268
- "data-testid": "digest-cover-figure",
269
- x: t.figureX,
270
- y: t.y - 5,
271
- "text-anchor": "middle",
272
- class: "figure"
273
- }, y(t.figure), 9, rt)) : m("", !0)
274
- ], 64))), 128)) : (o(!0), r(w, { key: 2 }, q(me.value, (t) => (o(), r("rect", {
275
- key: t.key,
276
- x: t.x,
277
- y: t.y,
278
- width: t.width,
279
- height: t.height,
280
- rx: "2",
281
- class: H(["bar", { faint: t.faint, marked: t.marked, muted: t.muted }])
282
- }, null, 10, lt))), 128)),
283
- (o(!0), r(w, null, q(ie.value, (t) => (o(), r(w, {
284
- key: t.key
285
- }, [
286
- t.leader ? (o(), r("line", {
287
- key: 0,
288
- x1: t.x,
289
- x2: t.x,
290
- y1: t.leader[0],
291
- y2: t.leader[1],
292
- class: "leader"
293
- }, null, 8, it)) : m("", !0),
294
- t.dot ? (o(), r("circle", {
295
- key: 1,
296
- cx: t.x,
297
- cy: t.y,
298
- r: "5",
299
- class: "dot"
300
- }, null, 8, ut)) : m("", !0),
301
- t.label ? (o(), r("text", {
302
- key: 2,
303
- "data-testid": "digest-cover-mark",
304
- x: t.x,
305
- y: t.labelY,
306
- "text-anchor": t.anchor,
307
- class: "mark"
308
- }, y(t.label), 9, dt)) : m("", !0)
309
- ], 64))), 128)),
310
- (o(!0), r(w, null, q(se.value, (t) => (o(), r("text", {
311
- key: t.x,
312
- x: t.x,
313
- "text-anchor": "middle",
314
- class: H(["tick", { marked: t.marked }])
315
- }, [
316
- (o(!0), r(w, null, q(t.lines, (i, a) => (o(), r("tspan", {
317
- key: a,
318
- x: t.x,
319
- y: k.value - 6 - (t.lines.length - 1 - a) * 12
320
- }, y(i), 9, ht))), 128))
321
- ], 10, ct))), 128))
322
- ], 8, et)) : m("", !0),
323
- !e.cover && e.quote ? (o(), r("div", vt, [
324
- s[1] || (s[1] = v("span", {
325
- class: "digest-quote-mark",
326
- "aria-hidden": "true"
327
- }, "“", -1)),
328
- v("p", ft, y(e.quote), 1)
329
- ])) : m("", !0),
330
- v("p", {
331
- class: "digest-take",
332
- title: O.value
333
- }, y(O.value), 9, gt)
334
- ], 2));
335
- }
336
- }), yt = /* @__PURE__ */ ge(pt, [["__scopeId", "data-v-fe5a40c9"]]), _t = {
337
- class: "digest-new",
338
- "data-testid": "digest-unread"
339
- }, kt = { class: "digest-card-body" }, xt = { class: "fm-typo-en-body-md-600 text-fm-color-typo-secondary" }, wt = {
340
- class: "digest-headline",
341
- "data-testid": "digest-card-headline"
342
- }, bt = {
343
- key: 0,
344
- class: "digest-lead"
345
- }, $t = {
346
- key: 1,
347
- class: "flex flex-col gap-8"
348
- }, Mt = { class: "digest-story-number" }, St = { class: "digest-card-foot" }, Bt = {
349
- key: 0,
350
- class: "digest-read"
351
- }, Vt = {
352
- key: 1,
353
- class: "digest-go",
354
- "aria-hidden": "true"
355
- }, Dt = 3, Ft = /* @__PURE__ */ ve({
356
- __name: "DigestListCard",
357
- props: {
358
- card: {},
359
- hero: { type: Boolean }
360
- },
361
- setup(ne) {
362
- const n = ne, { t: p, locale: N } = fe(), { breakpoints: I } = Se(), P = Ne(), M = u(() => n.hero && (I.value.lg || I.value.md)), B = u(
363
- () => Be(n.card.weekStart, n.card.weekEnd, N.value)
364
- ), _ = u(
365
- () => [
366
- n.card.stories.length ? p(
367
- "reportV5.digest.card.stories",
368
- { count: n.card.stories.length },
369
- n.card.stories.length
370
- ) : "",
371
- n.card.charts ? p("reportV5.digest.card.charts", { count: n.card.charts }, n.card.charts) : ""
372
- ].filter(Boolean).join(" · ")
373
- ), k = u(() => n.card.stories[0] ?? n.card.headline), O = u(() => ({
374
- name: "digestReader",
375
- params: { weekStart: n.card.weekStart },
376
- query: P.query
377
- }));
378
- return (f, F) => {
379
- const R = he("RouterLink");
380
- return o(), oe(R, {
381
- to: O.value,
382
- class: H(["digest-card", { hero: f.hero }]),
383
- "data-testid": f.hero ? "digest-hero" : "digest-list-card",
384
- "data-week": f.card.weekStart
385
- }, {
386
- default: le(() => [
387
- Z(yt, {
388
- class: "digest-card-vis",
389
- cover: f.card.cover,
390
- quote: k.value,
391
- dark: f.hero || !f.card.read,
392
- hero: M.value
393
- }, je({ _: 2 }, [
394
- f.card.read ? void 0 : {
395
- name: "badge",
396
- fn: le(() => [
397
- v("span", _t, y(x(p)("reportV5.digest.card.new")), 1)
398
- ]),
399
- key: "0"
400
- }
401
- ]), 1032, ["cover", "quote", "dark", "hero"]),
402
- v("div", kt, [
403
- v("span", xt, y(B.value), 1),
404
- v("p", wt, y(f.card.headline), 1),
405
- f.hero ? (o(), r(w, { key: 0 }, [
406
- f.card.lead ? (o(), r("p", bt, y(f.card.lead), 1)) : m("", !0),
407
- f.card.stories.length ? (o(), r("ol", $t, [
408
- (o(!0), r(w, null, q(f.card.stories.slice(0, Dt), (b, V) => (o(), r("li", {
409
- key: V,
410
- class: "digest-story"
411
- }, [
412
- v("span", Mt, y(V + 1), 1),
413
- v("span", null, y(b), 1)
414
- ]))), 128))
415
- ])) : m("", !0)
416
- ], 64)) : m("", !0),
417
- v("div", St, [
418
- f.hero ? (o(), r("span", Bt, y(x(p)("reportV5.digest.card.read")), 1)) : m("", !0),
419
- v("span", {
420
- class: H(["fm-typo-en-body-md-400 text-fm-color-typo-secondary", { "ml-auto": f.hero }])
421
- }, y(_.value), 3),
422
- f.hero ? m("", !0) : (o(), r("span", Vt, F[0] || (F[0] = [
423
- v("svg", {
424
- width: "16",
425
- height: "16",
426
- viewBox: "0 0 24 24",
427
- fill: "none",
428
- stroke: "currentColor",
429
- "stroke-width": "2.2",
430
- "stroke-linecap": "round",
431
- "stroke-linejoin": "round"
432
- }, [
433
- v("path", { d: "M5 12h14" }),
434
- v("path", { d: "M13 6l6 6-6 6" })
435
- ], -1)
436
- ])))
437
- ])
438
- ])
439
- ]),
440
- _: 1
441
- }, 8, ["to", "class", "data-testid", "data-week"]);
442
- };
443
- }
444
- }), $e = /* @__PURE__ */ ge(Ft, [["__scopeId", "data-v-3933c9b3"]]), Lt = {
445
- key: 0,
446
- class: "flex flex-wrap items-center justify-end gap-8"
447
- }, Ct = {
448
- class: "min-h-0 flex-1 overflow-y-auto pb-32",
449
- "data-testid": "digest-list"
450
- }, Rt = {
451
- key: 0,
452
- class: "fm-typo-en-body-sm-400 px-24 py-16 text-fm-color-typo-error",
453
- "data-testid": "digest-error"
454
- }, Tt = {
455
- key: 0,
456
- class: "mx-24 mt-24 flex flex-col gap-12",
457
- "aria-labelledby": "digest-new-heading"
458
- }, jt = {
459
- id: "digest-new-heading",
460
- class: "fm-typo-en-title-sm-600"
461
- }, Et = {
462
- key: 1,
463
- class: "mx-24 mt-[40px] flex flex-col gap-12",
464
- "aria-labelledby": "digest-earlier-heading"
465
- }, qt = {
466
- id: "digest-earlier-heading",
467
- class: "fm-typo-en-title-sm-600"
468
- }, It = { class: "digest-grid" }, Ot = {
469
- key: 2,
470
- class: "mt-24 flex justify-center"
471
- }, Me = 5e3, Nt = /* @__PURE__ */ ve({
472
- __name: "DigestListView",
473
- setup(ne) {
474
- const { t: p, locale: N } = fe(), { breakpoints: I } = Se(), { isFeedmeAdmin: P } = Ue(), M = We(), { subscription: B } = Ie(M);
475
- Ae();
476
- const _ = C([]), k = C(), O = C(!0), f = C(!1), F = C(""), R = C(!1), b = C(), V = C("");
477
- let D;
478
- const T = (l) => l instanceof Error ? l.message : String(l), G = (l) => l instanceof Ze && l.status === 403, j = u(() => _.value[0]), K = u(() => _.value.slice(1)), J = u(
479
- () => {
480
- var l;
481
- return (l = B.value) != null && l.scheduled ? He(Xe(/* @__PURE__ */ new Date()), N.value) : "";
482
- }
483
- ), re = u(
484
- () => {
485
- var l, E;
486
- return ((l = b.value) == null ? void 0 : l.status) === "requested" || ((E = b.value) == null ? void 0 : E.status) === "running";
487
- }
488
- ), S = u(() => {
489
- const l = b.value;
490
- if (!l) return "";
491
- const E = new Date(Date.parse(`${l.weekStart}T00:00:00Z`) + 6 * 864e5).toISOString().slice(0, 10), te = {
492
- week: Be(l.weekStart, E, N.value),
493
- failure: (l.failure ?? "").split(`
494
- `)[0].slice(0, 160)
495
- };
496
- return p(`reportV5.digest.build.${l.status}`, te);
497
- });
498
- async function X() {
499
- O.value = !0, F.value = "";
500
- try {
501
- const l = await be();
502
- _.value = l.digests, k.value = l.next;
503
- } catch (l) {
504
- G(l) ? R.value = !0 : F.value = T(l);
505
- } finally {
506
- O.value = !1;
507
- }
508
- }
509
- async function Q() {
510
- if (k.value) {
511
- f.value = !0;
512
- try {
513
- const l = await be(k.value);
514
- _.value = [..._.value, ...l.digests], k.value = l.next;
515
- } catch (l) {
516
- F.value = T(l);
517
- } finally {
518
- f.value = !1;
519
- }
520
- }
521
- }
522
- Ee(async () => {
523
- await Promise.all([
524
- X(),
525
- M.loadSubscription().catch((l) => {
526
- G(l) && (R.value = !0);
527
- })
528
- ]);
529
- });
530
- async function ee() {
531
- const l = b.value;
532
- if (l) {
533
- try {
534
- b.value = await Ke(l.id);
535
- } catch (E) {
536
- V.value = T(E);
537
- return;
538
- }
539
- if (re.value) {
540
- D = setTimeout(ee, Me);
541
- return;
542
- }
543
- b.value.status === "saved" && await X();
544
- }
545
- }
546
- async function me() {
547
- V.value = "";
548
- try {
549
- b.value = (await Ge()).run, D = setTimeout(ee, Me);
550
- } catch (l) {
551
- V.value = T(l);
552
- }
553
- }
554
- return qe(() => {
555
- D && clearTimeout(D);
556
- }), (l, E) => {
557
- const te = he("FmButton"), ie = he("FmPageHead");
558
- return o(), oe(Oe, null, {
559
- default: le(() => [
560
- Z(ie, {
561
- title: x(p)("reportV5.digest.title"),
562
- description: x(I).lg || x(I).md ? x(p)("reportV5.digest.subtitle") : "",
563
- class: "shrink-0"
564
- }, {
565
- append: le(() => {
566
- var A, se;
567
- return [
568
- R.value ? m("", !0) : (o(), r("div", Lt, [
569
- S.value || V.value ? (o(), r("span", {
570
- key: 0,
571
- class: H([
572
- "fm-typo-en-body-sm-400 max-w-[360px]",
573
- V.value || ((A = b.value) == null ? void 0 : A.status) === "failed" || ((se = b.value) == null ? void 0 : se.status) === "rejected" ? "text-fm-color-typo-error" : "text-fm-color-typo-secondary"
574
- ]),
575
- "data-testid": "digest-build-status"
576
- }, y(V.value || S.value), 3)) : m("", !0),
577
- (x(P), m("", !0)),
578
- Z(ze)
579
- ]))
580
- ];
581
- }),
582
- _: 1
583
- }, 8, ["title", "description"]),
584
- v("div", Ct, [
585
- R.value ? (o(), oe(we, {
586
- key: 0,
587
- "data-testid": "digest-refused",
588
- title: x(p)("reportV5.digest.refusedTitle"),
589
- "sub-title": x(p)("reportV5.digest.refusedBody")
590
- }, null, 8, ["title", "sub-title"])) : (o(), r(w, { key: 1 }, [
591
- Z(Ye, {
592
- class: "mx-24",
593
- "next-digest": J.value
594
- }, null, 8, ["next-digest"]),
595
- F.value ? (o(), r("p", Rt, y(F.value), 1)) : m("", !0),
596
- !O.value && !F.value && !_.value.length ? (o(), oe(we, {
597
- key: 1,
598
- title: x(p)("reportV5.digest.emptyTitle"),
599
- "sub-title": x(p)("reportV5.digest.emptyBody")
600
- }, null, 8, ["title", "sub-title"])) : _.value.length ? (o(), r(w, { key: 2 }, [
601
- j.value ? (o(), r("section", Tt, [
602
- v("h2", jt, y(x(p)(j.value.read ? "reportV5.digest.latest" : "reportV5.digest.newForYou")), 1),
603
- Z($e, {
604
- card: j.value,
605
- hero: ""
606
- }, null, 8, ["card"])
607
- ])) : m("", !0),
608
- K.value.length ? (o(), r("section", Et, [
609
- v("h2", qt, y(x(p)("reportV5.digest.earlier")), 1),
610
- v("div", It, [
611
- (o(!0), r(w, null, q(K.value, (A) => (o(), oe($e, {
612
- key: A.weekStart,
613
- card: A
614
- }, null, 8, ["card"]))), 128))
615
- ])
616
- ])) : m("", !0),
617
- k.value ? (o(), r("div", Ot, [
618
- Z(te, {
619
- "data-testid": "digest-show-more",
620
- variant: "secondary",
621
- label: x(p)("reportV5.digest.showMore"),
622
- disabled: f.value,
623
- onClick: Q
624
- }, null, 8, ["label", "disabled"])
625
- ])) : m("", !0)
626
- ], 64)) : m("", !0)
627
- ], 64))
628
- ])
629
- ]),
630
- _: 1
631
- });
632
- };
633
- }
634
- }), Jt = /* @__PURE__ */ ge(Nt, [["__scopeId", "data-v-f81c3f4a"]]);
635
- export {
636
- Jt as default
637
- };