@feedmepos/mf-connect 0.1.0-beta.1 → 0.1.0-beta.3

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 (66) hide show
  1. package/dist/Analytic-BC5BA6pN.js +622 -0
  2. package/dist/{App-B1uXIyTX.js → App-gzbM97vW.js} +6 -6
  3. package/dist/{Broadcast-CcpZLSnJ.js → Broadcast-BwYZkTs0.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-2C2AHwnM.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DIh9rz6T.js} +8 -8
  5. package/dist/{Card-DUCfFEOn.js → Card-CBYQGKwY.js} +15 -15
  6. package/dist/{Collections-a3-roNwC.js → Collections-Df6tlo8S.js} +4 -4
  7. package/dist/{Credit-xkoO4GA-.js → Credit-BPel8vA9.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bfe4jlcS.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-PsrS7I0r.js} +25 -25
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CXNpRyJu.js → EffectSheet.vue_vue_type_style_index_0_lang-BT8ucS5G.js} +6 -6
  10. package/dist/{Experience-En_4HpV5.js → Experience-CPpz1Zwx.js} +8 -8
  11. package/dist/{Game-CPIMY5Rx.js → Game-ByLblISC.js} +8 -8
  12. package/dist/{Marketing-BRojALh8.js → Marketing-D0vm80e_.js} +5 -5
  13. package/dist/{Member-HM92Pp4V.js → Member-CCc_FEZY.js} +4 -4
  14. package/dist/{MemberList-BthUMB4B.js → MemberList-CrnipE9y.js} +166 -165
  15. package/dist/{MemberTransactions-BGZTWPO5.js → MemberTransactions-DD5ahSbY.js} +1 -1
  16. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BhlQe_mh.js → MessageInput.vue_vue_type_script_setup_true_lang-DSPvWk4C.js} +2 -2
  17. package/dist/{Mission-iHEfJLwz.js → Mission-VH4057I-.js} +8 -8
  18. package/dist/{Point-CBmeOjue.js → Point-Bu3IlpH4.js} +8 -8
  19. package/dist/{Promotion-D3szKS2s.js → Promotion-B45AOHis.js} +9 -9
  20. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-ClahrluQ.js → RuleGroup.vue_vue_type_script_setup_true_lang-Ijc2OYh9.js} +14 -14
  21. package/dist/{Segment-LJyUhy6j.js → Segment-ZWsp48aC.js} +9 -9
  22. package/dist/{Setting-B89TXHBn.js → Setting-CF09eRQJ.js} +8 -8
  23. package/dist/{Store-GwzopXoP.js → Store-B_G6Dhmq.js} +13 -13
  24. package/dist/{StoreRewards-Bg6qPCMi.js → StoreRewards-0iGExjqQ.js} +12 -12
  25. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DNRDXAV9.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CaxUr9zl.js} +9 -9
  26. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-1m8hE_2Q.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BEfxin47.js} +1 -1
  27. package/dist/{Tier-CvgoQbzr.js → Tier-IaeWe7rM.js} +15 -15
  28. package/dist/{Title-zQ4E7pkb.js → Title-DD67Zxh5.js} +240 -239
  29. package/dist/{Transaction-Brg2Prn0.js → Transaction-BsPDnLzB.js} +2 -2
  30. package/dist/{Voucher-M4_C0xA_.js → Voucher-M7JfcKo0.js} +11 -11
  31. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Cg4OkAeV.js → ZodTextField.vue_vue_type_script_setup_true_lang-k0lprU2i.js} +1 -1
  32. package/dist/{app-hiS1HZ2Q.js → app-DwujUNP-.js} +2 -2
  33. package/dist/{app-BDO6B-dK.js → app-HFICF0vL.js} +27 -25
  34. package/dist/app.js +1 -1
  35. package/dist/{business-BU2rimiT.js → business-BaF1QJXa.js} +1 -1
  36. package/dist/{campaign-Cak59IlT.js → campaign-CTDtmAE9.js} +2 -2
  37. package/dist/{collection.fn-lmTn6OT-.js → collection.fn-DMW03W4R.js} +2 -2
  38. package/dist/{dto-EAvP09nY.js → dto-gpaNZHzQ.js} +9 -9
  39. package/dist/{effect-imx80Jez.js → effect-CBUmtwet.js} +1 -1
  40. package/dist/{export-I1QtSXHQ.js → export-Bdh_PbsW.js} +3 -3
  41. package/dist/{helper-B77FMKeg.js → helper-Cu9elRvl.js} +1 -1
  42. package/dist/{index-C7Lp9s7K.js → index-8MaN7rez.js} +5 -5
  43. package/dist/{index-DY3w0_ua.js → index-At6yms5t.js} +2 -2
  44. package/dist/{index-DSQpb_nd.js → index-BjdHxGDn.js} +2 -2
  45. package/dist/{index-DEQD6r-F.js → index-CArqG03W.js} +3 -3
  46. package/dist/{index-Bg5RKEF5.js → index-Ch6XwPzF.js} +1 -1
  47. package/dist/{index-DGu7q6pb.js → index-Crw-Vgo5.js} +1 -1
  48. package/dist/{index-DiS3ZJGm.js → index-CtH2S49l.js} +5 -5
  49. package/dist/{index-Cpont_pY.js → index-Dfdg2Q3E.js} +1 -1
  50. package/dist/{index-LRf1G2yC.js → index-DrGrOgZB.js} +1 -1
  51. package/dist/{index-QA2frxkp.js → index-NXiDu42U.js} +1 -1
  52. package/dist/{index-D2yy8eRo.js → index-RP0XOPRL.js} +3 -3
  53. package/dist/{index-C8_0ojX4.js → index-ogzk-Mj4.js} +1 -1
  54. package/dist/{index.esm2017-DhxrMX-Q.js → index.esm2017-CeJpvUbA.js} +1 -1
  55. package/dist/{loading-CMVcERFb.js → loading-Cn8ml_vy.js} +4 -4
  56. package/dist/{membership-DIp98t0S.js → membership-CX4AKMlH.js} +3 -3
  57. package/dist/{money-DFIWDnVe.js → money-BTejgvKu.js} +1 -1
  58. package/dist/{number-CoCEX2rq.js → number-Cen5TucC.js} +1 -1
  59. package/dist/{rule-Dkp0gq2R.js → rule-Cv83Y59R.js} +2 -2
  60. package/dist/{rule-builder-D87kQH2m.js → rule-builder-Dew4yB5Q.js} +1 -1
  61. package/dist/{template-BOtta_xY.js → template-CSnbgM1o.js} +4 -4
  62. package/dist/type_drinks-D6jnpvwV.js +4 -0
  63. package/dist/{vue-i18n-C1A0vrPS.js → vue-i18n-CNH_IhVd.js} +2 -2
  64. package/dist/{xlsx-BpU-uByi.js → xlsx-D4DUZHix.js} +1 -1
  65. package/package.json +2 -2
  66. package/dist/Analytic-Cz12ieSt.js +0 -763
@@ -0,0 +1,622 @@
1
+ import { defineComponent as T, openBlock as s, createElementBlock as h, Fragment as U, renderList as M, createElementVNode as a, toDisplayString as A, createCommentVNode as B, resolveComponent as k, createBlock as O, withCtx as I, createVNode as v, unref as t, ref as x, computed as G, onMounted as K, watch as Y, isRef as H, createSlots as ee, createTextVNode as te, reactive as ae, onBeforeMount as ne, normalizeClass as le } from "vue";
2
+ import { _ as oe } from "./campaign-CpzFl8Vr.js";
3
+ import { f as se } from "./number-Cen5TucC.js";
4
+ import { C as ie, F as re, a as ce } from "./dto-gpaNZHzQ.js";
5
+ import { useRouter as W } from "vue-router";
6
+ import { c as L } from "./index-NXiDu42U.js";
7
+ import { _ as ue } from "./ZodTextField.vue_vue_type_script_setup_true_lang-k0lprU2i.js";
8
+ import { Z as me } from "./zod-Bg2FbC-D.js";
9
+ import { J as de } from "./JsonViewer-v8_C7l5N.js";
10
+ import { u as pe } from "./loading-Cn8ml_vy.js";
11
+ import { useSnackbar as fe } from "@feedmepos/ui-library";
12
+ import { u as ye } from "./app-wDQR6dpb.js";
13
+ import { g as ve } from "./object-qECH92oz.js";
14
+ import { u as ge } from "./campaign-CTDtmAE9.js";
15
+ import { u as _e } from "./membership-CX4AKMlH.js";
16
+ import { u as be } from "./vue-i18n-CNH_IhVd.js";
17
+ import { m as he } from "./index-Ch6XwPzF.js";
18
+ const xe = { class: "divide-x flex flex-wrap" }, Ce = { class: "fm-typo-en-body-md-400 mb-2 text-fm-color-typo-secondary" }, ke = { class: "fm-typo-en-title-sm-800" }, Se = /* @__PURE__ */ T({
19
+ __name: "CampaignStat",
20
+ props: {
21
+ data: {
22
+ type: Object,
23
+ required: !0
24
+ }
25
+ },
26
+ setup(p) {
27
+ const f = p, r = [
28
+ { label: "Credit Received", key: "CREDIT" },
29
+ { label: "EXP Received", key: "POINT" },
30
+ { label: "Points Received", key: "COIN" },
31
+ { label: "Message Sent", key: "BROADCAST" },
32
+ { label: "Vouchers Claimed", key: "VOUCHER" },
33
+ { label: "Users Joined", key: "UNIQUE_USER" }
34
+ ];
35
+ function u(S) {
36
+ var c;
37
+ return se((c = f.data) == null ? void 0 : c[S], 2, !0) || 0;
38
+ }
39
+ return (S, c) => (s(), h("div", xe, [
40
+ (s(), h(U, null, M(r, (n) => (s(), h(U, null, [
41
+ n.key in p.data ? (s(), h("div", {
42
+ key: n.key,
43
+ class: "px-16"
44
+ }, [
45
+ a("div", Ce, A(n.label), 1),
46
+ a("div", ke, A(u(n.key)), 1)
47
+ ])) : B("", !0)
48
+ ], 64))), 64))
49
+ ]));
50
+ }
51
+ }), we = { class: "bg-fm-color-neutral-gray-100 gap-4 h-[30px] inline-flex items-center justify-center max-w-[250px] px-8 py-4 rounded-md" }, Fe = { class: "fm-typo-en-body-md-600 overflow-hidden select-none text-ellipsis text-fm-color-typo-secondary whitespace-nowrap" }, Ve = /* @__PURE__ */ T({
52
+ __name: "CampaignChip",
53
+ props: {
54
+ type: { type: String, required: !0 },
55
+ icon: {
56
+ type: Object,
57
+ default: () => ({ icon: "circle", color: "typo-sucess" })
58
+ },
59
+ label: {
60
+ type: String,
61
+ default: ""
62
+ }
63
+ },
64
+ setup(p) {
65
+ const r = ie[p.type];
66
+ return (u, S) => {
67
+ const c = k("FmIcon"), n = k("FmTooltip");
68
+ return s(), O(n, {
69
+ variant: "plain",
70
+ placement: "top",
71
+ content: p.label
72
+ }, {
73
+ default: I(() => [
74
+ a("div", we, [
75
+ v(c, {
76
+ name: t(r).icon,
77
+ outline: "",
78
+ size: "sm"
79
+ }, null, 8, ["name"]),
80
+ a("div", Fe, A(p.label), 1),
81
+ v(c, {
82
+ name: p.icon.name,
83
+ color: p.icon.color,
84
+ size: "sm"
85
+ }, null, 8, ["name", "color"])
86
+ ])
87
+ ]),
88
+ _: 1
89
+ }, 8, ["content"]);
90
+ };
91
+ }
92
+ }), $e = { class: "flex flex-col" }, Ae = { class: "flex flex-nowrap items-center justify-between mb-12" }, Re = { class: "flex gap-4 items-center justify-start" }, Oe = { class: "fm-typo-en-title-sm-800" }, Ue = { class: "flex flex-wrap gap-4 items-center mb-16 overflow-y-hidden" }, Ee = /* @__PURE__ */ T({
93
+ __name: "CampaignGroup",
94
+ props: {
95
+ group: {
96
+ type: Object,
97
+ required: !0
98
+ },
99
+ onEdit: {
100
+ type: Function,
101
+ required: !0
102
+ }
103
+ },
104
+ emits: ["changed"],
105
+ setup(p, { emit: f }) {
106
+ W(), x(!1);
107
+ const r = p, u = x([]), S = G(
108
+ () => u.value.reduce(
109
+ (n, o) => ({ ...n, [o.type]: o.totalAmount }),
110
+ {}
111
+ )
112
+ ), c = G(() => {
113
+ var n;
114
+ return ((n = r.group.pf_campaigns) == null ? void 0 : n.map((o) => ({
115
+ campaign: o,
116
+ label: o.name
117
+ }))) || [];
118
+ });
119
+ return K(async () => {
120
+ u.value = await L.readStats({
121
+ groupId: r.group._id.toString()
122
+ });
123
+ }), (n, o) => {
124
+ const i = k("FmButton"), l = k("FmCard");
125
+ return s(), O(l, {
126
+ class: "mb-24 p-24",
127
+ variant: "outlined"
128
+ }, {
129
+ default: I(() => [
130
+ a("div", $e, [
131
+ a("div", Ae, [
132
+ a("div", Re, [
133
+ a("div", Oe, A(p.group.name), 1),
134
+ v(i, {
135
+ icon: "edit",
136
+ variant: "tertiary",
137
+ onClick: o[0] || (o[0] = (y) => p.onEdit(p.group))
138
+ })
139
+ ])
140
+ ]),
141
+ a("div", Ue, [
142
+ (s(!0), h(U, null, M(t(c), (y) => (s(), O(Ve, {
143
+ key: n.index,
144
+ type: y.campaign.type,
145
+ label: y.label
146
+ }, null, 8, ["type", "label"]))), 128))
147
+ ]),
148
+ v(Se, { data: t(S) }, null, 8, ["data"])
149
+ ])
150
+ ]),
151
+ _: 1
152
+ });
153
+ };
154
+ }
155
+ }), Pe = { class: "ml-32 flex flex-col" }, Be = /* @__PURE__ */ T({
156
+ __name: "CampaignCard",
157
+ props: {
158
+ title: {},
159
+ items: {},
160
+ modelValue: {}
161
+ },
162
+ emits: ["update:model-value"],
163
+ setup(p, { emit: f }) {
164
+ const r = p, u = f, S = (i) => {
165
+ i ? o.value = r.items.map((l) => l.value) : o.value = [], n.value = i, u("update:model-value", o.value);
166
+ }, c = (i) => {
167
+ o.value = i, n.value = i.length === r.items.length, u("update:model-value", i);
168
+ }, n = x(!1), o = x([]);
169
+ return Y(
170
+ () => r.modelValue,
171
+ () => {
172
+ o.value = r.modelValue.filter(
173
+ (i) => r.items.find((l) => l.value === i)
174
+ );
175
+ }
176
+ ), K(() => {
177
+ o.value = r.modelValue.filter(
178
+ (i) => r.items.find((l) => l.value === i)
179
+ );
180
+ }), (i, l) => {
181
+ const y = k("FmCheckbox"), _ = k("FmCard");
182
+ return s(), O(_, {
183
+ variant: "outlined",
184
+ class: "p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3"
185
+ }, {
186
+ default: I(() => [
187
+ v(y, {
188
+ "model-value": t(n),
189
+ value: "1",
190
+ label: r.title,
191
+ indeterminate: t(o).length > 0,
192
+ "onUpdate:modelValue": S
193
+ }, null, 8, ["model-value", "label", "indeterminate"]),
194
+ a("div", Pe, [
195
+ (s(!0), h(U, null, M(r.items, (b, j) => (s(), O(y, {
196
+ key: j,
197
+ "model-value": t(o),
198
+ label: b.label,
199
+ value: b.value,
200
+ "onUpdate:modelValue": c
201
+ }, null, 8, ["model-value", "label", "value"]))), 128))
202
+ ])
203
+ ]),
204
+ _: 1
205
+ });
206
+ };
207
+ }
208
+ }), Ie = { class: "space-y-16" }, Ge = { class: "flex items-center" }, Me = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary w-[300px]" }, Le = { class: "space-y-[40px]" }, Te = /* @__PURE__ */ T({
209
+ __name: "LinkCampaign",
210
+ props: {
211
+ modelValue: {
212
+ type: Array,
213
+ required: !0
214
+ },
215
+ campaigns: {
216
+ type: Object,
217
+ required: !0
218
+ }
219
+ },
220
+ emits: ["update:model-value"],
221
+ setup(p, { emit: f }) {
222
+ const r = x(""), u = x([]), S = p, c = f, n = G(() => Object.entries(S.campaigns).reduce((i, [l, y]) => {
223
+ const _ = y.filter(
224
+ (b) => b.label.toLowerCase().includes(r.value.toLowerCase())
225
+ );
226
+ return _.length > 0 && (i[l] = _), i;
227
+ }, {}));
228
+ function o(i, l) {
229
+ u.value = u.value.filter(
230
+ (y) => !l.map((_) => _.value).includes(y)
231
+ ), u.value = [.../* @__PURE__ */ new Set([...u.value, ...i])], c("update:model-value", u.value);
232
+ }
233
+ return K(() => {
234
+ u.value = S.modelValue;
235
+ }), (i, l) => {
236
+ const y = k("FmTextField");
237
+ return s(), h(U, null, [
238
+ v(de, { json: p.campaigns }, null, 8, ["json"]),
239
+ a("div", Ie, [
240
+ a("div", Ge, [
241
+ a("div", Me, A(t(u).length) + " campaign(s) linked ", 1),
242
+ v(y, {
243
+ modelValue: t(r),
244
+ "onUpdate:modelValue": l[0] || (l[0] = (_) => H(r) ? r.value = _ : null),
245
+ "prepend-icon": "search",
246
+ placeholder: "Search",
247
+ class: "w-full"
248
+ }, null, 8, ["modelValue"])
249
+ ]),
250
+ a("div", Le, [
251
+ (s(!0), h(U, null, M(t(n), (_, b) => (s(), O(Be, {
252
+ "model-value": t(u),
253
+ title: b,
254
+ items: _,
255
+ "onUpdate:modelValue": (j) => o(j, _)
256
+ }, null, 8, ["model-value", "title", "items", "onUpdate:modelValue"]))), 256))
257
+ ])
258
+ ])
259
+ ], 64);
260
+ };
261
+ }
262
+ }), je = { class: "flex items-center gap-x-8" }, De = {
263
+ key: 0,
264
+ class: "space-y-16 pr-12"
265
+ }, Ne = { class: "flex items-center gap-x-16" }, qe = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, He = { class: "mt-16" }, Ke = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600 py-8 px-16 bg-gray-100" }, ze = { class: "flex justify-between items-center py-8 px-16 border-b-1" }, Je = { class: "flex items-center gap-8" }, We = /* @__PURE__ */ T({
266
+ __name: "AnalyticSheet",
267
+ emits: ["success"],
268
+ setup(p, { expose: f, emit: r }) {
269
+ const u = r, S = ye();
270
+ fe();
271
+ const c = x(!1), n = x(!1), o = {
272
+ name: "",
273
+ campaigns: []
274
+ }, i = x(""), l = x({ ...o }), y = re.superRefine((d, e) => {
275
+ }), _ = x([]), b = x(null), { global: j, minor: $ } = pe, w = G(() => {
276
+ const d = y.safeParse(l.value);
277
+ return d.success ? [] : d.error.errors;
278
+ });
279
+ function m(d) {
280
+ var e;
281
+ c.value = !0, d ? (b.value = { ...d }, l.value = { ...d, campaigns: (e = d.pf_campaigns) == null ? void 0 : e.map((g) => g._id) }) : (b.value = null, l.value = { ...o });
282
+ }
283
+ function F() {
284
+ c.value = !1, b.value = null;
285
+ }
286
+ function P() {
287
+ n.value = !0;
288
+ }
289
+ async function V() {
290
+ const d = await L.readAll({
291
+ limit: 1e3,
292
+ skip: 0,
293
+ sortBy: "_id",
294
+ search: "",
295
+ descending: !0
296
+ });
297
+ _.value = d.resources.filter(
298
+ (e) => !["MEMBERSHIP", "REWARD_POOL"].includes(e.type) && !["ISSUE_REWARD"].includes("event" in e ? e == null ? void 0 : e.event.type : "")
299
+ );
300
+ }
301
+ const D = G(() => {
302
+ const d = (g) => g.map((E) => ({
303
+ label: E.name,
304
+ value: E._id
305
+ }));
306
+ return ve(
307
+ _.value,
308
+ (g) => ce.formattedType(g.type),
309
+ d
310
+ );
311
+ }), R = G(() => Object.entries(D.value).reduce(
312
+ (d, [e, g]) => {
313
+ const E = g.filter((N) => {
314
+ var q, C;
315
+ return (C = (q = l.value) == null ? void 0 : q.campaigns) == null ? void 0 : C.includes(N.value);
316
+ }).filter(
317
+ (N) => N.label.toLowerCase().includes(i.value.toLowerCase())
318
+ );
319
+ return E.length > 0 && (d[e] = E), d;
320
+ },
321
+ {}
322
+ ));
323
+ function z(d) {
324
+ var g, E;
325
+ const e = (g = l.value.campaigns) == null ? void 0 : g.indexOf(d);
326
+ e != null && e > -1 && ((E = l.value.campaigns) == null || E.splice(e, 1));
327
+ }
328
+ async function Z() {
329
+ y.safeParse(l.value).success && await $(
330
+ async () => {
331
+ var e;
332
+ b.value ? await L.updateGroup(
333
+ (e = b.value) == null ? void 0 : e._id,
334
+ l.value
335
+ ) : await L.createGroup(l.value), u("success"), F();
336
+ },
337
+ {
338
+ message: "Saving group",
339
+ successMessage: "Group saved"
340
+ }
341
+ );
342
+ }
343
+ async function Q() {
344
+ await $(
345
+ async () => {
346
+ var d;
347
+ await L.deleteGroup((d = b.value) == null ? void 0 : d._id), u("success"), F();
348
+ },
349
+ {
350
+ message: "Deleting group",
351
+ successMessage: "Group deleted"
352
+ }
353
+ );
354
+ }
355
+ return K(async () => {
356
+ await V();
357
+ }), f({
358
+ showSheet: m,
359
+ hideSheet: F
360
+ }), (d, e) => {
361
+ const g = k("FmButton"), E = k("FmTextField"), N = k("FmList"), q = k("FmSideSheet");
362
+ return s(), O(q, {
363
+ modelValue: t(c),
364
+ "onUpdate:modelValue": e[7] || (e[7] = (C) => H(c) ? c.value = C : null),
365
+ header: t(b) ? "Edit group" : "Add group",
366
+ "dismiss-away": "",
367
+ "close-button": !0,
368
+ "max-width": 550
369
+ }, ee({
370
+ "side-sheet-footer": I(() => [
371
+ a("div", Je, [
372
+ t(n) ? B("", !0) : (s(), h(U, { key: 0 }, [
373
+ v(g, {
374
+ label: "Submit",
375
+ onClick: Z,
376
+ disabled: t(w).length > 0 || t(S).isLoading
377
+ }, null, 8, ["disabled"]),
378
+ v(g, {
379
+ label: "Cancel",
380
+ onClick: e[4] || (e[4] = (C) => F()),
381
+ variant: "tertiary"
382
+ }),
383
+ t(b) ? (s(), O(g, {
384
+ key: 0,
385
+ label: "Delete",
386
+ variant: "plain",
387
+ class: "ml-auto fm-color-system-error-300",
388
+ onClick: e[5] || (e[5] = (C) => Q())
389
+ })) : B("", !0)
390
+ ], 64)),
391
+ t(n) ? (s(), O(g, {
392
+ key: 1,
393
+ label: "Confirm",
394
+ onClick: e[6] || (e[6] = (C) => n.value = !1)
395
+ })) : B("", !0)
396
+ ])
397
+ ]),
398
+ default: I(() => [
399
+ t(n) ? B("", !0) : (s(), h("div", De, [
400
+ e[9] || (e[9] = a("div", { class: "fm-typo-en-title-sm-800" }, "Group detail", -1)),
401
+ v(ue, {
402
+ modelValue: t(l).name,
403
+ "onUpdate:modelValue": e[1] || (e[1] = (C) => t(l).name = C),
404
+ label: "Name",
405
+ schema: t(me).typeAtPath(t(y), "name")
406
+ }, null, 8, ["modelValue", "schema"]),
407
+ e[10] || (e[10] = a("div", { class: "fm-typo-en-title-sm-800" }, "Link campaign", -1)),
408
+ a("div", Ne, [
409
+ a("div", qe, A(t(l).campaigns.length) + " campaign(s) linked ", 1),
410
+ v(E, {
411
+ modelValue: t(i),
412
+ "onUpdate:modelValue": e[2] || (e[2] = (C) => H(i) ? i.value = C : null),
413
+ "prepend-icon": "search",
414
+ placeholder: "Search",
415
+ class: "w-auto"
416
+ }, null, 8, ["modelValue"])
417
+ ]),
418
+ v(g, {
419
+ variant: "plain",
420
+ icon: "link",
421
+ label: "Link Campaign",
422
+ onClick: P
423
+ })
424
+ ])),
425
+ t(n) ? (s(), O(Te, {
426
+ key: 1,
427
+ modelValue: t(l).campaigns,
428
+ "onUpdate:modelValue": e[3] || (e[3] = (C) => t(l).campaigns = C),
429
+ campaigns: t(D)
430
+ }, null, 8, ["modelValue", "campaigns"])) : B("", !0),
431
+ a("div", He, [
432
+ t(n) ? B("", !0) : (s(!0), h(U, { key: 0 }, M(t(R), (C, X) => (s(), h("div", null, [
433
+ a("div", Ke, A(X), 1),
434
+ v(N, { separator: !0 }, {
435
+ default: I(() => [
436
+ (s(!0), h(U, null, M(C, (J) => (s(), h("div", ze, [
437
+ a("div", null, A(J.label), 1),
438
+ a("div", null, [
439
+ v(g, {
440
+ icon: "delete",
441
+ onClick: (st) => z(J.value),
442
+ variant: "tertiary"
443
+ }, null, 8, ["onClick"])
444
+ ])
445
+ ]))), 256))
446
+ ]),
447
+ _: 2
448
+ }, 1024)
449
+ ]))), 256))
450
+ ])
451
+ ]),
452
+ _: 2
453
+ }, [
454
+ t(n) ? {
455
+ name: "side-sheet-header",
456
+ fn: I(() => [
457
+ a("div", je, [
458
+ v(g, {
459
+ icon: "arrow_back",
460
+ variant: "tertiary",
461
+ onClick: e[0] || (e[0] = (C) => n.value = !1)
462
+ }),
463
+ e[8] || (e[8] = te("Link campaign "))
464
+ ])
465
+ ]),
466
+ key: "0"
467
+ } : void 0
468
+ ]), 1032, ["modelValue", "header"]);
469
+ };
470
+ }
471
+ }), Ze = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Qe = { class: "space-y-16" }, Xe = { class: "flex items-center justify-end" }, Ye = { class: "fm-typo-en-body-lg-600" }, et = { class: "grid grid-cols-4 xs:grid-cols-2 gap-4 divide-x xs:divide-x-0" }, tt = { class: "fm-typo-body-md-400 fm-typo-en-body-md-400 mb-2 text-fm-color-typo-secondary" }, at = { class: "fm-typo-en-title-sm-800" }, nt = { class: "fm-typo-en-title-sm-800 text-center" }, lt = { class: "fm-typo-body-en-md-400 text-center text-fm-color-typo-secondary" }, ot = { class: "flex gap-16 items-center" }, St = /* @__PURE__ */ T({
472
+ __name: "Analytic",
473
+ setup(p) {
474
+ const { t: f } = be(), r = {
475
+ label: f("connect.analytic.addGroup"),
476
+ value: "create",
477
+ isPrimary: !0,
478
+ prependIcon: "add"
479
+ }, u = ge(), S = x(), c = x([]), n = x(""), o = ae({
480
+ totalCampaign: 0,
481
+ totalProgram: 0,
482
+ totalMember: 0
483
+ }), i = x("1"), l = [
484
+ {
485
+ key: f("connect.analytic.summary.totalCampaign"),
486
+ value: () => o.totalCampaign
487
+ },
488
+ {
489
+ key: f("connect.analytic.summary.totalProgram"),
490
+ value: () => o.totalProgram
491
+ },
492
+ {
493
+ key: f("connect.analytic.summary.totalMember"),
494
+ value: () => o.totalMember
495
+ }
496
+ ];
497
+ function y(w) {
498
+ var m;
499
+ i.value = (/* @__PURE__ */ new Date()).toISOString(), (m = S.value) == null || m.showSheet(w);
500
+ }
501
+ async function _() {
502
+ await u.readGroups();
503
+ const w = await L.readAllGrouped({
504
+ limit: 100,
505
+ skip: 0,
506
+ sortBy: "_id",
507
+ search: "",
508
+ descending: !0
509
+ });
510
+ c.value = w.resources;
511
+ }
512
+ async function b() {
513
+ var F, P;
514
+ const w = await he.read({
515
+ limit: 1,
516
+ skip: 0,
517
+ sortBy: "_id",
518
+ search: "",
519
+ descending: !1
520
+ }), m = await L.readAll({
521
+ limit: 1e3,
522
+ skip: 0,
523
+ sortBy: "_id",
524
+ search: "",
525
+ descending: !1
526
+ });
527
+ o.totalCampaign = ((F = m.resources) == null ? void 0 : F.filter(
528
+ (V) => ["PROMOTION", "VOUCHER", "BROADCAST"].includes(V.type) && !["ISSUE_REWARD"].includes("event" in V ? V == null ? void 0 : V.event.type : "")
529
+ ).length) ?? 0, o.totalProgram = ((P = m.resources) == null ? void 0 : P.filter(
530
+ (V) => ["POINT", "COIN", "CREDIT", "GAME"].includes(V.type)
531
+ ).length) ?? 0, o.totalMember = w.meta.totalResources ?? 0;
532
+ }
533
+ const j = G(() => c.value.filter((w) => {
534
+ var m;
535
+ return w.name.includes(n.value) || ((m = w.pf_campaigns) == null ? void 0 : m.filter((F) => F.name.includes(n.value)).length);
536
+ })), $ = _e();
537
+ return W(), x(!0), G(() => {
538
+ var w, m, F, P;
539
+ return !$.storeOption || !$.storeOption.company ? -1 : !$.payoutAccount || !$.payoutAccount.enable || $.payoutAccount.status != "APPROVED" ? 0 : (m = (w = $.store) == null ? void 0 : w.categories) != null && m.length ? (P = (F = $.store) == null ? void 0 : F.categories) != null && P.some(
540
+ (V) => V.bundles.some((D) => D.isFeedvibe)
541
+ ) ? 3 : 2 : 1;
542
+ }), ne(async () => {
543
+ await _(), await b(), await $.readMemberStore(), await $.readMembership(), await $.readPayoutAccount();
544
+ }), (w, m) => {
545
+ const F = k("FmPageHead"), P = k("FmSearch"), V = k("FmCard"), D = k("FmButton");
546
+ return k("FmIcon"), s(), h(U, null, [
547
+ v(F, {
548
+ title: t(f)("connect.analytic.title"),
549
+ actions: t(c).length > 0 ? [r] : [],
550
+ "onClick:action": m[0] || (m[0] = (R) => y())
551
+ }, null, 8, ["title", "actions"]),
552
+ a("div", Ze, [
553
+ a("div", Qe, [
554
+ a("div", Xe, [
555
+ v(P, {
556
+ class: "xs:hidden",
557
+ modelValue: t(n),
558
+ "onUpdate:modelValue": m[1] || (m[1] = (R) => H(n) ? n.value = R : null),
559
+ placeholder: t(f)("connect.analytic.search"),
560
+ collapsible: ""
561
+ }, null, 8, ["modelValue", "placeholder"])
562
+ ]),
563
+ v(V, {
564
+ variant: "outlined",
565
+ class: "flex flex-col gap-16 p-16"
566
+ }, {
567
+ default: I(() => [
568
+ a("div", Ye, A(t(f)("connect.analytic.summary.title")), 1),
569
+ a("div", et, [
570
+ (s(), h(U, null, M(l, (R, z) => a("div", {
571
+ key: R.key,
572
+ class: le(["px-8", { "xs:!border-r": z % 2 == 0 }])
573
+ }, [
574
+ a("div", tt, A(R.key), 1),
575
+ a("div", at, A(R.value()), 1)
576
+ ], 2)), 64))
577
+ ])
578
+ ]),
579
+ _: 1
580
+ })
581
+ ]),
582
+ B("", !0),
583
+ t(c).length ? B("", !0) : (s(), O(V, {
584
+ key: 1,
585
+ variant: "outlined",
586
+ class: "flex flex-col gap-y-24 items-center p-16"
587
+ }, {
588
+ default: I(() => [
589
+ m[8] || (m[8] = a("img", {
590
+ src: oe,
591
+ class: "w-[150px]"
592
+ }, null, -1)),
593
+ a("div", nt, A(t(f)("connect.analytic.emptyState.title")), 1),
594
+ a("div", lt, A(t(f)("connect.analytic.emptyState.description")), 1),
595
+ a("div", ot, [
596
+ v(D, {
597
+ label: t(f)("connect.analytic.emptyState.action"),
598
+ icon: "add",
599
+ onClick: m[3] || (m[3] = (R) => y())
600
+ }, null, 8, ["label"])
601
+ ])
602
+ ]),
603
+ _: 1
604
+ })),
605
+ (s(!0), h(U, null, M(t(j), (R) => (s(), O(Ee, {
606
+ key: R._id.toString(),
607
+ group: R,
608
+ "on-edit": y
609
+ }, null, 8, ["group"]))), 128)),
610
+ v(We, {
611
+ ref_key: "sheetRef",
612
+ ref: S,
613
+ onSuccess: _
614
+ }, null, 512)
615
+ ])
616
+ ], 64);
617
+ };
618
+ }
619
+ });
620
+ export {
621
+ St as default
622
+ };
@@ -2,15 +2,15 @@ import { defineComponent as lt, ref as te, h as Q, watch as ut, resolveComponent
2
2
  import { useRouter as nn, useRoute as ht, RouterView as rn } from "vue-router";
3
3
  import { useCoreStore as We, FeedMeAuth as sn } from "@feedmepos/mf-common";
4
4
  import { u as on } from "./app-wDQR6dpb.js";
5
- import { u as an } from "./business-BU2rimiT.js";
6
- import "./index-Cpont_pY.js";
5
+ import { u as an } from "./business-BaF1QJXa.js";
6
+ import "./index-Dfdg2Q3E.js";
7
7
  import { components as Z, useSnackbar as cn, useDialog as ln } from "@feedmepos/ui-library";
8
- import { u as un } from "./vue-i18n-C1A0vrPS.js";
9
- import { R as f } from "./app-BDO6B-dK.js";
8
+ import { u as un } from "./vue-i18n-CNH_IhVd.js";
9
+ import { R as f } from "./app-HFICF0vL.js";
10
10
  import { J as dn } from "./JsonViewer-v8_C7l5N.js";
11
- import { r as ye, L as hn, g as ft, i as fn, a as pn, _ as je, C as Ge, b as mn, S as z, c as w, d as j, E as be, e as gn, f as pt, h as _n, j as vn, k as mt, l as g, m as In, F as Re, n as Tn, q as K, o as wn, p as yn, s as En, t as kn, u as Sn } from "./index.esm2017-DhxrMX-Q.js";
11
+ import { r as ye, L as hn, g as ft, i as fn, a as pn, _ as je, C as Ge, b as mn, S as z, c as w, d as j, E as be, e as gn, f as pt, h as _n, j as vn, k as mt, l as g, m as In, F as Re, n as Tn, q as K, o as wn, p as yn, s as En, t as kn, u as Sn } from "./index.esm2017-CeJpvUbA.js";
12
12
  import { _ as Pe } from "./tslib.es6-BCqqvLQ_.js";
13
- import { S as Be } from "./index-D2yy8eRo.js";
13
+ import { S as Be } from "./index-RP0XOPRL.js";
14
14
  const bn = /* @__PURE__ */ lt({
15
15
  __name: "NavigationTab",
16
16
  setup(n) {
@@ -1,15 +1,15 @@
1
1
  import { defineComponent as N, ref as h, computed as U, onMounted as j, resolveComponent as r, openBlock as l, createElementBlock as y, Fragment as b, createVNode as i, unref as t, createElementVNode as n, withCtx as v, renderList as E, createBlock as w, resolveDynamicComponent as H, toDisplayString as d, createCommentVNode as q, h as z } from "vue";
2
2
  import { _ as G } from "./campaign-CpzFl8Vr.js";
3
3
  import { useDialog as J, components as Q } from "@feedmepos/ui-library";
4
- import { u as W, p as X } from "./loading-CMVcERFb.js";
5
- import { u as Y } from "./business-BU2rimiT.js";
6
- import { u as Z } from "./campaign-Cak59IlT.js";
7
- import { g as B, b as A } from "./dto-EAvP09nY.js";
8
- import { u as ee } from "./vue-i18n-C1A0vrPS.js";
4
+ import { u as W, p as X } from "./loading-Cn8ml_vy.js";
5
+ import { u as Y } from "./business-BaF1QJXa.js";
6
+ import { u as Z } from "./campaign-CTDtmAE9.js";
7
+ import { g as B, b as A } from "./dto-gpaNZHzQ.js";
8
+ import { u as ee } from "./vue-i18n-CNH_IhVd.js";
9
9
  import { _ as te } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
10
- import { _ as oe } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bfe4jlcS.js";
11
- import { u as ae } from "./template-BOtta_xY.js";
12
- import { c as _ } from "./index-QA2frxkp.js";
10
+ import { _ as oe } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-PsrS7I0r.js";
11
+ import { u as ae } from "./template-CSnbgM1o.js";
12
+ import { c as _ } from "./index-NXiDu42U.js";
13
13
  const ne = { class: "px-24 flex flex-col gap-y-16" }, se = { class: "flex items-center justify-between w-full" }, ce = { class: "flex gap-8 overflow-x-auto" }, ie = { class: "space-y-8" }, re = { class: "flex w-full gap-4 items-center" }, le = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, me = { class: "space-y-4" }, de = { class: "fm-typo-en-body-lg-600" }, pe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ue = { key: 0 }, fe = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600" }, ge = { class: "flex flex-col gap-16 text-center" }, ye = { class: "fm-typo-en-title-sm-800" }, _e = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Re = /* @__PURE__ */ N({
14
14
  __name: "Broadcast",
15
15
  setup(he) {