@feedmepos/mf-connect 0.0.18-prod → 0.0.20-prod

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 (64) hide show
  1. package/dist/Analytic-DuwMJh8c.js +759 -0
  2. package/dist/{Broadcast-SK3ik91V.js → Broadcast-BUgjgqv9.js} +7 -7
  3. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BGzuAEwI.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BDU9wbxY.js} +8 -8
  4. package/dist/{Card-0-hxxpiV.js → Card-CwohdmAQ.js} +86 -86
  5. package/dist/{Collections-pnUS2NUo.js → Collections-D-JKj4iC.js} +6 -6
  6. package/dist/{Credit-UcSstIA6.js → Credit-BdKekl3X.js} +7 -7
  7. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-Ck-cXc7h.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DA-7-Qi9.js} +20 -20
  8. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Dfw0Eph1.js → EffectSheet.vue_vue_type_style_index_0_lang-lDNh6GmQ.js} +5 -5
  9. package/dist/{Experience-D7682kjb.js → Experience-KoC4x_ae.js} +7 -7
  10. package/dist/{Game-ugwJfw5Z.js → Game-CTkr8R18.js} +7 -7
  11. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CQ1J_8U7.js → ImageInput.vue_vue_type_script_setup_true_lang-CDeQRYDy.js} +1 -1
  12. package/dist/{MainLayout-B_mALJzY.js → MainLayout-Du7UHyf3.js} +1 -1
  13. package/dist/{Marketing-C0H14x8-.js → Marketing-CTl2LqXi.js} +14 -14
  14. package/dist/{Member-CxVXoNzi.js → Member-hHIz1gGT.js} +2 -2
  15. package/dist/{MemberList-3XALU8N1.js → MemberList-Fs95BxUo.js} +11 -11
  16. package/dist/{MemberTransactions-Va--4_bi.js → MemberTransactions-nmURocbA.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DpK7c7Zu.js → MessageInput.vue_vue_type_script_setup_true_lang-Zk21rkMZ.js} +2 -2
  18. package/dist/{Mission-D9ASjTM_.js → Mission-B5YwPU71.js} +14 -14
  19. package/dist/{Point-DXllJyrF.js → Point-BiOgpyye.js} +7 -7
  20. package/dist/{Promotion-ByujYVZV.js → Promotion-Bpvuwixe.js} +8 -8
  21. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-D9uygHXu.js → RuleGroup.vue_vue_type_script_setup_true_lang-DZlxkB8D.js} +13 -13
  22. package/dist/{Segment-DzYLWnEx.js → Segment-DrEpmY4N.js} +9 -9
  23. package/dist/{Setting-3JrqJeay.js → Setting-D48p2snU.js} +126 -126
  24. package/dist/Store-CT1XE_Sn.js +1502 -0
  25. package/dist/{StoreRewards-BIyTKYQ7.js → StoreRewards-DsjyanOO.js} +9 -9
  26. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-Cd9ReYzL.js → StoreTransactions.vue_vue_type_script_setup_true_lang-DboIoW51.js} +82 -79
  27. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CtSi80Oy.js +139 -0
  28. package/dist/{Tier-DSOYEDpP.js → Tier-BzZX_Dki.js} +16 -16
  29. package/dist/{Title-Bwgpdw5W.js → Title-C2Ji-YGQ.js} +15 -15
  30. package/dist/{Transaction-BA1wqoKh.js → Transaction-BJGKndk-.js} +1 -1
  31. package/dist/{Voucher-ZMryMClH.js → Voucher-D2dpFJSA.js} +20 -20
  32. package/dist/{app-gMUoPAtF.js → app-BAgeAm1l.js} +39 -39
  33. package/dist/{app--QGN757T.js → app-D5_9RvMw.js} +1 -1
  34. package/dist/app.js +1 -1
  35. package/dist/{campaign-DWA08UtZ.js → campaign-BK6-HrgE.js} +2 -2
  36. package/dist/{dto-EdZglrpA.js → dto-E-AuMyEO.js} +41 -41
  37. package/dist/{effect-BGQxHIBT.js → effect-DOWJayPu.js} +1 -1
  38. package/dist/{export-CvoZ48Rq.js → export-DMZdMVnb.js} +3 -3
  39. package/dist/{helper-BTpTsE8-.js → helper-CmlX0eR1.js} +1 -1
  40. package/dist/{index-BFJS-YmL.js → index-BNy1wU-V.js} +1 -1
  41. package/dist/{index-D_vvblAz.js → index-BZbJpBo2.js} +2 -2
  42. package/dist/{index-Blh8vWHb.js → index-BhHZOSyO.js} +1 -1
  43. package/dist/{index-CY0A-Rfl.js → index-BkHtyaBf.js} +5 -5
  44. package/dist/{index-BVqa77Ch.js → index-Cj1rTpPK.js} +1 -1
  45. package/dist/index-DKCHICCa.js +291 -0
  46. package/dist/{index-0t3kF_Tg.js → index-QeG7EuE3.js} +1 -1
  47. package/dist/{index-HPSSJKsc.js → index-RcFvF7Y_.js} +6 -5
  48. package/dist/{index-D4KUQKKJ.js → index-gOVUv83Y.js} +3 -3
  49. package/dist/{index-BxMkJPP_.js → index-zAvZNHx0.js} +2 -2
  50. package/dist/{loading-Cgp9wWK3.js → loading-BIURYgSR.js} +4 -4
  51. package/dist/{lodash-m4OgMZ4R.js → lodash-CxofWkz4.js} +1 -1
  52. package/dist/{membership-VeQiYdQd.js → membership-DVEV926P.js} +63 -58
  53. package/dist/{money-DUtWOAkL.js → money-99JilzxX.js} +1 -1
  54. package/dist/{number-D-YjTFfa.js → number-BKGHLuLf.js} +2 -2
  55. package/dist/{rule-b2srzDD8.js → rule-Chwh9Y4B.js} +2 -2
  56. package/dist/{rule-builder-CsFDa4FH.js → rule-builder-JEF7ltcg.js} +1 -1
  57. package/dist/{template-B8msjWjA.js → template-B6lZdtyo.js} +5 -5
  58. package/dist/{usePagination-D1R6ZAK_.js → usePagination-4epNDLvW.js} +1 -1
  59. package/dist/{xlsx-DlpKgn7I.js → xlsx-DKkkHUS_.js} +1 -1
  60. package/package.json +1 -1
  61. package/dist/Analytic-uwlRSM7O.js +0 -612
  62. package/dist/Store-2dsgXsLe.js +0 -1442
  63. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BafQ0glH.js +0 -124
  64. package/dist/index-BTYqlJ9v.js +0 -244
@@ -1,612 +0,0 @@
1
- import { defineComponent as I, openBlock as o, createElementBlock as h, Fragment as V, renderList as P, createElementVNode as a, toDisplayString as U, createCommentVNode as B, resolveComponent as S, createBlock as F, withCtx as O, createVNode as p, unref as n, ref as C, computed as G, onMounted as q, watch as X, isRef as N, createSlots as Y, createTextVNode as ee, reactive as te, onBeforeMount as ae, normalizeClass as ne } from "vue";
2
- import { _ as le } from "./campaign-CpzFl8Vr.js";
3
- import { f as oe } from "./number-D-YjTFfa.js";
4
- import { C as se, F as ie, a as re } from "./dto-EdZglrpA.js";
5
- import { useRouter as ce } from "vue-router";
6
- import { c as T } from "./index-0t3kF_Tg.js";
7
- import { _ as ue, Z as de } from "./ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js";
8
- import { J as me, u as pe } from "./app-gMUoPAtF.js";
9
- import { u as fe } from "./loading-Cgp9wWK3.js";
10
- import { useSnackbar as ve } from "@feedmepos/ui-library";
11
- import { g as ye } from "./object-qECH92oz.js";
12
- import { u as _e } from "./campaign-DWA08UtZ.js";
13
- import { m as ge } from "./index-BFJS-YmL.js";
14
- const he = { class: "divide-x flex flex-wrap" }, be = { class: "fm-typo-en-body-md-400 mb-2 text-fm-color-typo-secondary" }, xe = { class: "fm-typo-en-title-sm-800" }, Ce = /* @__PURE__ */ I({
15
- __name: "CampaignStat",
16
- props: {
17
- data: {
18
- type: Object,
19
- required: !0
20
- }
21
- },
22
- setup(m) {
23
- const R = m, i = [
24
- { label: "Credit Received", key: "CREDIT" },
25
- { label: "EXP Received", key: "POINT" },
26
- { label: "Points Received", key: "COIN" },
27
- { label: "Message Sent", key: "BROADCAST" },
28
- { label: "Vouchers Claimed", key: "VOUCHER" },
29
- { label: "Users Joined", key: "UNIQUE_USER" }
30
- ];
31
- function u(_) {
32
- var r;
33
- return oe((r = R.data) == null ? void 0 : r[_], 2, !0) || 0;
34
- }
35
- return (_, r) => (o(), h("div", he, [
36
- (o(), h(V, null, P(i, (e) => (o(), h(V, null, [
37
- e.key in m.data ? (o(), h("div", {
38
- key: e.key,
39
- class: "px-16"
40
- }, [
41
- a("div", be, U(e.label), 1),
42
- a("div", xe, U(u(e.key)), 1)
43
- ])) : B("", !0)
44
- ], 64))), 64))
45
- ]));
46
- }
47
- }), ke = { 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" }, Se = { class: "fm-typo-en-body-md-600 overflow-hidden select-none text-ellipsis text-fm-color-typo-secondary whitespace-nowrap" }, we = /* @__PURE__ */ I({
48
- __name: "CampaignChip",
49
- props: {
50
- type: { type: String, required: !0 },
51
- icon: {
52
- type: Object,
53
- default: () => ({ icon: "circle", color: "typo-sucess" })
54
- },
55
- label: {
56
- type: String,
57
- default: ""
58
- }
59
- },
60
- setup(m) {
61
- const i = se[m.type];
62
- return (u, _) => {
63
- const r = S("FmIcon"), e = S("FmTooltip");
64
- return o(), F(e, {
65
- variant: "plain",
66
- placement: "top",
67
- content: m.label
68
- }, {
69
- default: O(() => [
70
- a("div", ke, [
71
- p(r, {
72
- name: n(i).icon,
73
- outline: "",
74
- size: "sm"
75
- }, null, 8, ["name"]),
76
- a("div", Se, U(m.label), 1),
77
- p(r, {
78
- name: m.icon.name,
79
- color: m.icon.color,
80
- size: "sm"
81
- }, null, 8, ["name", "color"])
82
- ])
83
- ]),
84
- _: 1
85
- }, 8, ["content"]);
86
- };
87
- }
88
- }), $e = { class: "flex flex-col" }, Fe = { class: "flex flex-nowrap items-center justify-between mb-12" }, Ve = { class: "flex gap-4 items-center justify-start" }, Re = { class: "fm-typo-en-title-sm-800" }, Ae = { class: "flex flex-wrap gap-4 items-center mb-16 overflow-y-hidden" }, Ue = /* @__PURE__ */ I({
89
- __name: "CampaignGroup",
90
- props: {
91
- group: {
92
- type: Object,
93
- required: !0
94
- },
95
- onEdit: {
96
- type: Function,
97
- required: !0
98
- }
99
- },
100
- emits: ["changed"],
101
- setup(m, { emit: R }) {
102
- ce(), C(!1);
103
- const i = m, u = C([]), _ = G(
104
- () => u.value.reduce(
105
- (e, c) => ({ ...e, [c.type]: c.totalAmount }),
106
- {}
107
- )
108
- ), r = G(() => {
109
- var e;
110
- return ((e = i.group.pf_campaigns) == null ? void 0 : e.map((c) => ({
111
- campaign: c,
112
- label: c.name
113
- }))) || [];
114
- });
115
- return q(async () => {
116
- u.value = await T.readStats({
117
- groupId: i.group._id.toString()
118
- });
119
- }), (e, c) => {
120
- const s = S("FmButton"), l = S("FmCard");
121
- return o(), F(l, {
122
- class: "mb-24 p-24",
123
- variant: "outlined"
124
- }, {
125
- default: O(() => [
126
- a("div", $e, [
127
- a("div", Fe, [
128
- a("div", Ve, [
129
- a("div", Re, U(m.group.name), 1),
130
- p(s, {
131
- icon: "edit",
132
- variant: "tertiary",
133
- onClick: c[0] || (c[0] = (f) => m.onEdit(m.group))
134
- })
135
- ])
136
- ]),
137
- a("div", Ae, [
138
- (o(!0), h(V, null, P(n(r), (f) => (o(), F(we, {
139
- key: e.index,
140
- type: f.campaign.type,
141
- label: f.label
142
- }, null, 8, ["type", "label"]))), 128))
143
- ]),
144
- p(Ce, { data: n(_) }, null, 8, ["data"])
145
- ])
146
- ]),
147
- _: 1
148
- });
149
- };
150
- }
151
- }), Oe = { class: "ml-32 flex flex-col" }, Ee = /* @__PURE__ */ I({
152
- __name: "CampaignCard",
153
- props: {
154
- title: {},
155
- items: {},
156
- modelValue: {}
157
- },
158
- emits: ["update:model-value"],
159
- setup(m, { emit: R }) {
160
- const i = m, u = R, _ = (s) => {
161
- s ? c.value = i.items.map((l) => l.value) : c.value = [], e.value = s, u("update:model-value", c.value);
162
- }, r = (s) => {
163
- c.value = s, e.value = s.length === i.items.length, u("update:model-value", s);
164
- }, e = C(!1), c = C([]);
165
- return X(
166
- () => i.modelValue,
167
- () => {
168
- c.value = i.modelValue.filter(
169
- (s) => i.items.find((l) => l.value === s)
170
- );
171
- }
172
- ), q(() => {
173
- c.value = i.modelValue.filter(
174
- (s) => i.items.find((l) => l.value === s)
175
- );
176
- }), (s, l) => {
177
- const f = S("FmCheckbox"), b = S("FmCard");
178
- return o(), F(b, {
179
- variant: "outlined",
180
- class: "p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3"
181
- }, {
182
- default: O(() => [
183
- p(f, {
184
- "model-value": n(e),
185
- value: "1",
186
- label: i.title,
187
- indeterminate: n(c).length > 0,
188
- "onUpdate:modelValue": _
189
- }, null, 8, ["model-value", "label", "indeterminate"]),
190
- a("div", Oe, [
191
- (o(!0), h(V, null, P(i.items, (g, w) => (o(), F(f, {
192
- key: w,
193
- "model-value": n(c),
194
- label: g.label,
195
- value: g.value,
196
- "onUpdate:modelValue": r
197
- }, null, 8, ["model-value", "label", "value"]))), 128))
198
- ])
199
- ]),
200
- _: 1
201
- });
202
- };
203
- }
204
- }), Be = { class: "space-y-16" }, Pe = { class: "flex items-center" }, Te = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary w-[300px]" }, Ge = { class: "space-y-[40px]" }, Ie = /* @__PURE__ */ I({
205
- __name: "LinkCampaign",
206
- props: {
207
- modelValue: {
208
- type: Array,
209
- required: !0
210
- },
211
- campaigns: {
212
- type: Object,
213
- required: !0
214
- }
215
- },
216
- emits: ["update:model-value"],
217
- setup(m, { emit: R }) {
218
- const i = C(""), u = C([]), _ = m, r = R, e = G(() => Object.entries(_.campaigns).reduce((s, [l, f]) => {
219
- const b = f.filter(
220
- (g) => g.label.toLowerCase().includes(i.value.toLowerCase())
221
- );
222
- return b.length > 0 && (s[l] = b), s;
223
- }, {}));
224
- function c(s, l) {
225
- u.value = u.value.filter(
226
- (f) => !l.map((b) => b.value).includes(f)
227
- ), u.value = [.../* @__PURE__ */ new Set([...u.value, ...s])], r("update:model-value", u.value);
228
- }
229
- return q(() => {
230
- u.value = _.modelValue;
231
- }), (s, l) => {
232
- const f = S("FmTextField");
233
- return o(), h(V, null, [
234
- p(me, { json: m.campaigns }, null, 8, ["json"]),
235
- a("div", Be, [
236
- a("div", Pe, [
237
- a("div", Te, U(n(u).length) + " campaign(s) linked ", 1),
238
- p(f, {
239
- modelValue: n(i),
240
- "onUpdate:modelValue": l[0] || (l[0] = (b) => N(i) ? i.value = b : null),
241
- "prepend-icon": "search",
242
- placeholder: "Search",
243
- class: "w-full"
244
- }, null, 8, ["modelValue"])
245
- ]),
246
- a("div", Ge, [
247
- (o(!0), h(V, null, P(n(e), (b, g) => (o(), F(Ee, {
248
- "model-value": n(u),
249
- title: g,
250
- items: b,
251
- "onUpdate:modelValue": (w) => c(w, b)
252
- }, null, 8, ["model-value", "title", "items", "onUpdate:modelValue"]))), 256))
253
- ])
254
- ])
255
- ], 64);
256
- };
257
- }
258
- }), Le = { class: "flex items-center gap-x-8" }, je = {
259
- key: 0,
260
- class: "space-y-16 pr-12"
261
- }, Me = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800" }, "Group detail", -1), De = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800" }, "Link campaign", -1), 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" }, ze = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600 py-8 px-16 bg-gray-100" }, Ke = { class: "flex justify-between items-center py-8 px-16 border-b-1" }, Je = { class: "flex items-center gap-8" }, We = /* @__PURE__ */ I({
262
- __name: "AnalyticSheet",
263
- emits: ["success"],
264
- setup(m, { expose: R, emit: i }) {
265
- const u = i, _ = pe();
266
- ve();
267
- const r = C(!1), e = C(!1), c = {
268
- name: "",
269
- campaigns: []
270
- }, s = C(""), l = C({ ...c }), f = ie.superRefine((d, t) => {
271
- }), b = C([]), g = C(null), { global: w, minor: v } = fe, E = G(() => {
272
- const d = f.safeParse(l.value);
273
- return d.success ? [] : d.error.errors;
274
- });
275
- function L(d) {
276
- var t;
277
- r.value = !0, d ? (g.value = { ...d }, l.value = { ...d, campaigns: (t = d.pf_campaigns) == null ? void 0 : t.map((y) => y._id) }) : (g.value = null, l.value = { ...c });
278
- }
279
- function k() {
280
- r.value = !1, g.value = null;
281
- }
282
- function H() {
283
- e.value = !0;
284
- }
285
- async function $() {
286
- const d = await T.readAll({
287
- limit: 1e3,
288
- skip: 0,
289
- sortBy: "_id",
290
- search: "",
291
- descending: !0
292
- });
293
- b.value = d.resources.filter(
294
- (t) => !["MEMBERSHIP", "REWARD_POOL"].includes(t.type) && !["ISSUE_REWARD"].includes("event" in t ? t == null ? void 0 : t.event.type : "")
295
- );
296
- }
297
- const M = G(() => {
298
- const d = (y) => y.map((A) => ({
299
- label: A.name,
300
- value: A._id
301
- }));
302
- return ye(
303
- b.value,
304
- (y) => re.formattedType(y.type),
305
- d
306
- );
307
- }), K = G(() => Object.entries(M.value).reduce(
308
- (d, [t, y]) => {
309
- const A = y.filter((j) => {
310
- var D, x;
311
- return (x = (D = l.value) == null ? void 0 : D.campaigns) == null ? void 0 : x.includes(j.value);
312
- }).filter(
313
- (j) => j.label.toLowerCase().includes(s.value.toLowerCase())
314
- );
315
- return A.length > 0 && (d[t] = A), d;
316
- },
317
- {}
318
- ));
319
- function J(d) {
320
- var y, A;
321
- const t = (y = l.value.campaigns) == null ? void 0 : y.indexOf(d);
322
- t != null && t > -1 && ((A = l.value.campaigns) == null || A.splice(t, 1));
323
- }
324
- async function W() {
325
- f.safeParse(l.value).success && await v(
326
- async () => {
327
- var t;
328
- g.value ? await T.updateGroup(
329
- (t = g.value) == null ? void 0 : t._id,
330
- l.value
331
- ) : await T.createGroup(l.value), u("success"), k();
332
- },
333
- {
334
- message: "Saving group",
335
- successMessage: "Group saved"
336
- }
337
- );
338
- }
339
- async function Z() {
340
- await v(
341
- async () => {
342
- var d;
343
- await T.deleteGroup((d = g.value) == null ? void 0 : d._id), u("success"), k();
344
- },
345
- {
346
- message: "Deleting group",
347
- successMessage: "Group deleted"
348
- }
349
- );
350
- }
351
- return q(async () => {
352
- await $();
353
- }), R({
354
- showSheet: L,
355
- hideSheet: k
356
- }), (d, t) => {
357
- const y = S("FmButton"), A = S("FmTextField"), j = S("FmList"), D = S("FmSideSheet");
358
- return o(), F(D, {
359
- modelValue: n(r),
360
- "onUpdate:modelValue": t[7] || (t[7] = (x) => N(r) ? r.value = x : null),
361
- header: n(g) ? "Edit group" : "Add group",
362
- "dismiss-away": "",
363
- "close-button": !0,
364
- "max-width": 550
365
- }, Y({
366
- "side-sheet-footer": O(() => [
367
- a("div", Je, [
368
- n(e) ? B("", !0) : (o(), h(V, { key: 0 }, [
369
- p(y, {
370
- label: "Submit",
371
- onClick: W,
372
- disabled: n(E).length > 0 || n(_).isLoading
373
- }, null, 8, ["disabled"]),
374
- p(y, {
375
- label: "Cancel",
376
- onClick: t[4] || (t[4] = (x) => k()),
377
- variant: "tertiary"
378
- }),
379
- n(g) ? (o(), F(y, {
380
- key: 0,
381
- label: "Delete",
382
- variant: "plain",
383
- class: "ml-auto fm-color-system-error-300",
384
- onClick: t[5] || (t[5] = (x) => Z())
385
- })) : B("", !0)
386
- ], 64)),
387
- n(e) ? (o(), F(y, {
388
- key: 1,
389
- label: "Confirm",
390
- onClick: t[6] || (t[6] = (x) => e.value = !1)
391
- })) : B("", !0)
392
- ])
393
- ]),
394
- default: O(() => [
395
- n(e) ? B("", !0) : (o(), h("div", je, [
396
- Me,
397
- p(ue, {
398
- modelValue: n(l).name,
399
- "onUpdate:modelValue": t[1] || (t[1] = (x) => n(l).name = x),
400
- label: "Name",
401
- schema: n(de).typeAtPath(n(f), "name")
402
- }, null, 8, ["modelValue", "schema"]),
403
- De,
404
- a("div", Ne, [
405
- a("div", qe, U(n(l).campaigns.length) + " campaign(s) linked ", 1),
406
- p(A, {
407
- modelValue: n(s),
408
- "onUpdate:modelValue": t[2] || (t[2] = (x) => N(s) ? s.value = x : null),
409
- "prepend-icon": "search",
410
- placeholder: "Search",
411
- class: "w-auto"
412
- }, null, 8, ["modelValue"])
413
- ]),
414
- p(y, {
415
- variant: "plain",
416
- icon: "link",
417
- label: "Link Campaign",
418
- onClick: H
419
- })
420
- ])),
421
- n(e) ? (o(), F(Ie, {
422
- key: 1,
423
- modelValue: n(l).campaigns,
424
- "onUpdate:modelValue": t[3] || (t[3] = (x) => n(l).campaigns = x),
425
- campaigns: n(M)
426
- }, null, 8, ["modelValue", "campaigns"])) : B("", !0),
427
- a("div", He, [
428
- n(e) ? B("", !0) : (o(!0), h(V, { key: 0 }, P(n(K), (x, Q) => (o(), h("div", null, [
429
- a("div", ze, U(Q), 1),
430
- p(j, { separator: !0 }, {
431
- default: O(() => [
432
- (o(!0), h(V, null, P(x, (z) => (o(), h("div", Ke, [
433
- a("div", null, U(z.label), 1),
434
- a("div", null, [
435
- p(y, {
436
- icon: "delete",
437
- onClick: (it) => J(z.value),
438
- variant: "tertiary"
439
- }, null, 8, ["onClick"])
440
- ])
441
- ]))), 256))
442
- ]),
443
- _: 2
444
- }, 1024)
445
- ]))), 256))
446
- ])
447
- ]),
448
- _: 2
449
- }, [
450
- n(e) ? {
451
- name: "side-sheet-header",
452
- fn: O(() => [
453
- a("div", Le, [
454
- p(y, {
455
- icon: "arrow_back",
456
- variant: "tertiary",
457
- onClick: t[0] || (t[0] = (x) => e.value = !1)
458
- }),
459
- ee("Link campaign ")
460
- ])
461
- ]),
462
- key: "0"
463
- } : void 0
464
- ]), 1032, ["modelValue", "header"]);
465
- };
466
- }
467
- }), 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 = /* @__PURE__ */ a("div", { class: "fm-typo-en-body-lg-600" }, "Connect summary", -1), 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 = /* @__PURE__ */ a("img", {
468
- src: le,
469
- class: "w-[150px]"
470
- }, null, -1), lt = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800 text-center" }, " Create campaign group to track performance ", -1), ot = /* @__PURE__ */ a("div", { class: "fm-typo-body-en-md-400 text-center text-fm-color-typo-secondary" }, " Start organizing your campaigns and promotions by creating groups. Groups allow you to aggregate performance metrics across multiple vouchers, promotions, or other rewards. ", -1), st = { class: "flex gap-16 items-center" }, xt = /* @__PURE__ */ I({
471
- __name: "Analytic",
472
- setup(m) {
473
- const R = {
474
- label: "Add group",
475
- value: "create",
476
- isPrimary: !0,
477
- prependIcon: "add"
478
- }, i = _e(), u = C(), _ = C([]), r = C(""), e = te({
479
- totalCampaign: 0,
480
- totalProgram: 0,
481
- totalMember: 0
482
- }), c = C("1"), s = [
483
- {
484
- key: "Total campaign",
485
- value: () => e.totalCampaign
486
- },
487
- {
488
- key: "Total Program",
489
- value: () => e.totalProgram
490
- },
491
- {
492
- key: "Total Member",
493
- value: () => e.totalMember
494
- }
495
- ];
496
- function l(w) {
497
- var v;
498
- c.value = (/* @__PURE__ */ new Date()).toISOString(), (v = u.value) == null || v.showSheet(w);
499
- }
500
- async function f() {
501
- await i.readGroups();
502
- const w = await T.readAllGrouped({
503
- limit: 100,
504
- skip: 0,
505
- sortBy: "_id",
506
- search: "",
507
- descending: !0
508
- });
509
- _.value = w.resources;
510
- }
511
- async function b() {
512
- var E, L;
513
- const w = await ge.read({
514
- limit: 1,
515
- skip: 0,
516
- sortBy: "_id",
517
- search: "",
518
- descending: !1
519
- }), v = await T.readAll({
520
- limit: 1e3,
521
- skip: 0,
522
- sortBy: "_id",
523
- search: "",
524
- descending: !1
525
- });
526
- e.totalCampaign = ((E = v.resources) == null ? void 0 : E.filter(
527
- (k) => ["PROMOTION", "VOUCHER", "BROADCAST"].includes(k.type) && !["ISSUE_REWARD"].includes("event" in k ? k == null ? void 0 : k.event.type : "")
528
- ).length) ?? 0, e.totalProgram = ((L = v.resources) == null ? void 0 : L.filter(
529
- (k) => ["POINT", "COIN", "CREDIT", "GAME"].includes(k.type)
530
- ).length) ?? 0, e.totalMember = w.meta.totalResources ?? 0;
531
- }
532
- const g = G(() => _.value.filter((w) => {
533
- var v;
534
- return w.name.includes(r.value) || ((v = w.pf_campaigns) == null ? void 0 : v.filter((E) => E.name.includes(r.value)).length);
535
- }));
536
- return ae(async () => {
537
- await f(), await b();
538
- }), (w, v) => {
539
- const E = S("FmPageHead"), L = S("FmSearch"), k = S("FmCard"), H = S("FmButton");
540
- return o(), h(V, null, [
541
- p(E, {
542
- title: "Analytic",
543
- actions: n(_).length > 0 ? [R] : [],
544
- "onClick:action": v[0] || (v[0] = ($) => l())
545
- }, null, 8, ["actions"]),
546
- a("div", Ze, [
547
- a("div", Qe, [
548
- a("div", Xe, [
549
- p(L, {
550
- class: "xs:hidden",
551
- modelValue: n(r),
552
- "onUpdate:modelValue": v[1] || (v[1] = ($) => N(r) ? r.value = $ : null),
553
- placeholder: "Search",
554
- collapsible: ""
555
- }, null, 8, ["modelValue"])
556
- ]),
557
- p(k, {
558
- variant: "outlined",
559
- class: "flex flex-col gap-16 p-16"
560
- }, {
561
- default: O(() => [
562
- Ye,
563
- a("div", et, [
564
- (o(), h(V, null, P(s, ($, M) => a("div", {
565
- key: $.key,
566
- class: ne(["px-8", { "xs:!border-r": M % 2 == 0 }])
567
- }, [
568
- a("div", tt, U($.key), 1),
569
- a("div", at, U($.value()), 1)
570
- ], 2)), 64))
571
- ])
572
- ]),
573
- _: 1
574
- })
575
- ]),
576
- n(_).length ? B("", !0) : (o(), F(k, {
577
- key: 0,
578
- variant: "outlined",
579
- class: "flex flex-col gap-y-24 items-center p-16"
580
- }, {
581
- default: O(() => [
582
- nt,
583
- lt,
584
- ot,
585
- a("div", st, [
586
- p(H, {
587
- label: "Create group",
588
- icon: "add",
589
- onClick: v[2] || (v[2] = ($) => l())
590
- })
591
- ])
592
- ]),
593
- _: 1
594
- })),
595
- (o(!0), h(V, null, P(n(g), ($) => (o(), F(Ue, {
596
- key: $._id.toString(),
597
- group: $,
598
- "on-edit": l
599
- }, null, 8, ["group"]))), 128)),
600
- p(We, {
601
- ref_key: "sheetRef",
602
- ref: u,
603
- onSuccess: f
604
- }, null, 512)
605
- ])
606
- ], 64);
607
- };
608
- }
609
- });
610
- export {
611
- xt as default
612
- };