@feedmepos/mf-connect 0.0.12-beta.5 → 0.0.13-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 (72) hide show
  1. package/dist/Analytic-DMbCeTaO.js +612 -0
  2. package/dist/{Broadcast-BFHQPSXL.js → Broadcast-bVaOzrys.js} +7 -7
  3. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B1DYJDOy.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cd2midth.js} +8 -8
  4. package/dist/{Card-rOJ8yJg_.js → Card-CdCTfDuP.js} +127 -127
  5. package/dist/{Collections-BT8ihCOa.js → Collections-CQIHkJ4W.js} +129 -141
  6. package/dist/{Credit-D83Jsn7v.js → Credit-DuIm1c4_.js} +7 -7
  7. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang--L-LP0DV.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-DljWmOEP.js} +258 -242
  8. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-HLzZirO_.js → EffectSheet.vue_vue_type_style_index_0_lang-BuJL01zR.js} +6 -6
  9. package/dist/{Experience-C6uBhQod.js → Experience-DEnMLbsA.js} +7 -7
  10. package/dist/{Game-5P5HWqAL.js → Game-BYS0nrH6.js} +7 -7
  11. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DTDcpMpW.js → ImageInput.vue_vue_type_script_setup_true_lang-DW2tVaY0.js} +1 -1
  12. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CQIJ54m1.js → MainLayout-BkFJubzZ.js} +53 -20
  13. package/dist/{Marketing-ONuItJ_B.js → Marketing-Da0HTlaz.js} +25 -25
  14. package/dist/{Member-SB2IySXY.js → Member-CVe_bRGx.js} +2 -2
  15. package/dist/MemberList-DpUy4gFd.js +1718 -0
  16. package/dist/{MemberTransactions-DPQ6M7eR.js → MemberTransactions-DWdTDUIJ.js} +2 -2
  17. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-1KjmvWsp.js +203 -0
  18. package/dist/{Mission-rdnU6erJ.js → Mission-0eSMWCls.js} +7 -7
  19. package/dist/{Point-C2M66ORj.js → Point-ju1eHI9Z.js} +7 -7
  20. package/dist/{Promotion-DixbjmMJ.js → Promotion-DZjWvnQa.js} +8 -8
  21. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CJsIBnGp.js → RuleGroup.vue_vue_type_script_setup_true_lang-CDPvpj10.js} +14 -14
  22. package/dist/{Segment-j_zQSV7O.js → Segment-Da_kMLWC.js} +18 -19
  23. package/dist/{Setting-ClhkF-bT.js → Setting-CxX35f3G.js} +541 -571
  24. package/dist/Store-DjUI3S8V.js +1442 -0
  25. package/dist/{StoreRewards-Bh90Ml4z.js → StoreRewards-92k0Bvp_.js} +74 -75
  26. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-DlbNMiw9.js → StoreTransactions.vue_vue_type_script_setup_true_lang-Bsrz-oMi.js} +79 -82
  27. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DNkJ-pFL.js +124 -0
  28. package/dist/{Tier-vxsDt3Kj.js → Tier-2J4GN90t.js} +68 -71
  29. package/dist/{Title-IFyz9vfW.js → Title-B3Dw3w_5.js} +75 -78
  30. package/dist/{Transaction-ETa-y_H9.js → Transaction-Dz6WT5Hb.js} +1 -1
  31. package/dist/{Voucher-BMYcuaPn.js → Voucher-Bf3oSOKc.js} +37 -37
  32. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +140 -0
  33. package/dist/{app-Bl9KwQq5.js → app-BSmDH0M7.js} +46 -46
  34. package/dist/{app-BqWTxQI-.js → app-C7I-jK_l.js} +1 -1
  35. package/dist/app.js +1 -1
  36. package/dist/{campaign-DI8CmTo2.js → campaign-CmvlWUoI.js} +11 -13
  37. package/dist/{collection.fn-CTEuol1r.js → collection.fn-DHlfGYAC.js} +2 -4
  38. package/dist/{dto-Bdlgo-8k.js → dto-rs6D-mtj.js} +239 -239
  39. package/dist/{effect-BdgYZfgW.js → effect-D8eQcTDU.js} +1 -1
  40. package/dist/{export-Dr_7YvBE.js → export-Bf2h8rMP.js} +3 -3
  41. package/dist/{helper-BygQ4tND.js → helper-BSlBLPdy.js} +1 -1
  42. package/dist/{index-CstgquVp.js → index-B64Y4rdW.js} +2 -2
  43. package/dist/{index-Djv3w5gV.js → index-BVSAl8E2.js} +37 -46
  44. package/dist/{index-DzQwND7p.js → index-CdMMIVsr.js} +217 -232
  45. package/dist/index-CuW8ePVX.js +244 -0
  46. package/dist/{index-DPYzF8No.js → index-D0nFU6ln.js} +1 -1
  47. package/dist/{index-Cv0dYoWA.js → index-fFL3EyTx.js} +68 -105
  48. package/dist/{index-Dhl0c4JQ.js → index-jqxAE4Rp.js} +1 -1
  49. package/dist/{index-BPdhkx4l.js → index-sIR31szI.js} +1 -1
  50. package/dist/{index-BtG8YOzi.js → index-wIa5WSXJ.js} +27 -28
  51. package/dist/{index-CpxxO2-G.js → index-x9e-DyDf.js} +1 -1
  52. package/dist/{loading-DlPkAkzK.js → loading-BxJj39Hj.js} +3156 -3156
  53. package/dist/{lodash-Cjf6EG_s.js → lodash-CrYvSLZb.js} +1 -1
  54. package/dist/{membership-B4-9J74r.js → membership-DKQL_Qp9.js} +73 -84
  55. package/dist/{money-il542E4J.js → money-B1P0wtzb.js} +1 -1
  56. package/dist/{number-WhKft9Yv.js → number-Bc1eguaq.js} +3 -3
  57. package/dist/{rule-XS2i1LKt.js → rule-BblG87FW.js} +2 -2
  58. package/dist/{rule-builder-CdK4IIT9.js → rule-builder-BQdKD4Gy.js} +1 -1
  59. package/dist/style.css +1 -1
  60. package/dist/{template-owB8rrou.js → template-o2RQUsfw.js} +6 -6
  61. package/dist/{usePagination-CxpwPyMW.js → usePagination-BaqNzQhm.js} +1 -1
  62. package/dist/{xlsx-CbJTFamj.js → xlsx-DqRMXFBK.js} +309 -309
  63. package/package.json +1 -1
  64. package/dist/Analytic-CCtweUZA.js +0 -757
  65. package/dist/MainLayout-CWfQ53Qr.js +0 -41
  66. package/dist/MemberList-C2X8fM7F.js +0 -1729
  67. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-CE03Mh2P.js +0 -432
  68. package/dist/Store-CaWIsSZ3.js +0 -1506
  69. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DkpguWBa.js +0 -136
  70. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CWt4tVdk.js +0 -55
  71. package/dist/index-_8VUWoAN.js +0 -245
  72. package/dist/zod-W_PvIofQ.js +0 -90
@@ -0,0 +1,612 @@
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-Bc1eguaq.js";
4
+ import { C as se, F as ie, a as re } from "./dto-rs6D-mtj.js";
5
+ import { useRouter as ce } from "vue-router";
6
+ import { c as T } from "./index-jqxAE4Rp.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-BSmDH0M7.js";
9
+ import { u as fe } from "./loading-BxJj39Hj.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-CmvlWUoI.js";
13
+ import { m as ge } from "./index-D0nFU6ln.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
+ };
@@ -1,14 +1,14 @@
1
1
  import { defineComponent as P, ref as g, computed as U, onMounted as M, resolveComponent as l, openBlock as i, createElementBlock as f, Fragment as _, createVNode as r, unref as a, createElementVNode as s, withCtx as h, renderList as j, createBlock as w, resolveDynamicComponent as E, toDisplayString as b, createCommentVNode as H, h as q } from "vue";
2
2
  import { _ as z } from "./campaign-CpzFl8Vr.js";
3
3
  import { useDialog as G, components as J } from "@feedmepos/ui-library";
4
- import { u as Q, p as W } from "./loading-DlPkAkzK.js";
5
- import { a as X } from "./app-Bl9KwQq5.js";
6
- import { u as Y } from "./campaign-DI8CmTo2.js";
7
- import { g as F, b as k } from "./dto-Bdlgo-8k.js";
4
+ import { u as Q, p as W } from "./loading-BxJj39Hj.js";
5
+ import { a as X } from "./app-BSmDH0M7.js";
6
+ import { u as Y } from "./campaign-CmvlWUoI.js";
7
+ import { g as F, b as k } from "./dto-rs6D-mtj.js";
8
8
  import { _ as Z } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
9
- import { _ as ee } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang--L-LP0DV.js";
10
- import { u as te } from "./template-owB8rrou.js";
11
- import { c as y } from "./index-Dhl0c4JQ.js";
9
+ import { _ as ee } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-DljWmOEP.js";
10
+ import { u as te } from "./template-o2RQUsfw.js";
11
+ import { c as y } from "./index-jqxAE4Rp.js";
12
12
  const oe = { class: "px-24 flex flex-col gap-y-16" }, ae = { class: "flex items-center justify-between w-full" }, se = { class: "flex gap-8 overflow-x-auto" }, ne = { 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" }, ie = { class: "space-y-4" }, ce = { class: "fm-typo-en-body-lg-600" }, me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, de = { key: 0 }, ue = /* @__PURE__ */ s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600" }, " No results found ", -1), pe = [
13
13
  ue
14
14
  ], fe = /* @__PURE__ */ s("img", {
@@ -1,13 +1,13 @@
1
- import { R as RuleOperator, _ } from "./index-DzQwND7p.js";
2
- import { i as isRuleGroup } from "./rule-builder-CdK4IIT9.js";
1
+ import { R as RuleOperator, _ } from "./index-CdMMIVsr.js";
2
+ import { i as isRuleGroup } from "./rule-builder-BQdKD4Gy.js";
3
3
  import { defineComponent, resolveComponent, openBlock, createBlock, withCtx, createElementVNode, createElementBlock, Fragment, renderList, createVNode, toDisplayString } from "vue";
4
4
  import { useDialog } from "@feedmepos/ui-library";
5
- import "./index-CstgquVp.js";
6
- import { a as F_RUNNABLE_CAMPAIGN_TYPE } from "./index-Djv3w5gV.js";
7
- import "./index-BtG8YOzi.js";
8
- import "./index-Cv0dYoWA.js";
9
- import "./index-_8VUWoAN.js";
10
- import "./index-BPdhkx4l.js";
5
+ import "./index-B64Y4rdW.js";
6
+ import { a as F_RUNNABLE_CAMPAIGN_TYPE } from "./index-BVSAl8E2.js";
7
+ import "./index-wIa5WSXJ.js";
8
+ import "./index-fFL3EyTx.js";
9
+ import "./index-CuW8ePVX.js";
10
+ import "./index-sIR31szI.js";
11
11
  function validateRule(data, r, date) {
12
12
  const rules = new RuleOperator(date ?? /* @__PURE__ */ new Date());
13
13
  function meetConditions(e) {