@feedmepos/mf-connect 0.1.0-beta.9 → 0.1.0-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 (101) hide show
  1. package/dist/Analytic-D1vIDmhJ.js +620 -0
  2. package/dist/{App-DQUbRsdA.js → App-DHrfWG8l.js} +249 -250
  3. package/dist/Broadcast-B2rxZAZi.js +216 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D-BFllvG.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D2a9rcXK.js} +20 -20
  5. package/dist/Card-Dr6pTTM0.js +824 -0
  6. package/dist/Collections-0tbg0MFt.js +441 -0
  7. package/dist/Credit-KbB_7Jq-.js +214 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-C_ZKNWzb.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.js} +999 -1018
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-VBNyvZCJ.js +344 -0
  10. package/dist/Experience-C_Q9Iml8.js +211 -0
  11. package/dist/Game-BwODw7M6.js +250 -0
  12. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +144 -0
  13. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → MainLayout-DpZC6o3R.js} +53 -19
  14. package/dist/Marketing-QOKTAS_T.js +309 -0
  15. package/dist/Member-d7RIGRm1.js +92 -0
  16. package/dist/MemberList-CK9629ew.js +1737 -0
  17. package/dist/MemberOverview-C2n9oJZh.js +58 -0
  18. package/dist/{MemberTransactions-zSxSnUkK.js → MemberTransactions-D-pnlXiP.js} +1 -1
  19. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-3VS7JnK6.js +203 -0
  20. package/dist/Mission-BAKDm4VZ.js +248 -0
  21. package/dist/Point-Puu0jKz0.js +220 -0
  22. package/dist/Promotion-DRIaUvJi.js +244 -0
  23. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CTKKhH-r.js → RuleGroup.vue_vue_type_script_setup_true_lang-DTdfYGya.js} +557 -557
  24. package/dist/Segment-DpBxGuuu.js +435 -0
  25. package/dist/Setting-DLB2ywCp.js +1870 -0
  26. package/dist/Store-8DO6ITWc.js +1513 -0
  27. package/dist/StoreRewards-DZfqUeYR.js +429 -0
  28. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-2Jqj_rKv.js → StoreTransactions.vue_vue_type_script_setup_true_lang-RTfozD01.js} +10 -10
  29. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BkdSj0cX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BGI78ycg.js} +1 -1
  30. package/dist/{Tier-Cpl0FV8L.js → Tier-BnQRujpX.js} +453 -481
  31. package/dist/{Title-CbMDd1Et.js → Title-BPf1tUFx.js} +295 -314
  32. package/dist/Transaction-ese0oNrz.js +36 -0
  33. package/dist/Voucher--gtOZQx1.js +485 -0
  34. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +140 -0
  35. package/dist/app-Bt59niI-.js +2974 -0
  36. package/dist/{app-VxaUCtgl.js → app-DHE61XdR.js} +1 -1
  37. package/dist/app.js +3 -5
  38. package/dist/{business-DR7jpnLz.js → business-BSo7EPan.js} +1 -1
  39. package/dist/{campaign-MqcTb329.js → campaign-CsOje3Ap.js} +3 -5
  40. package/dist/{collection.fn-CvEoe61K.js → collection.fn-BYQfFJOr.js} +2 -2
  41. package/dist/dto-CfEXSCq6.js +1145 -0
  42. package/dist/{effect-BjjQeiQg.js → effect-Bn_ofYS3.js} +9 -9
  43. package/dist/{export-B8cvWh5n.js → export-CMR243CF.js} +3 -3
  44. package/dist/{helper-DfgVNY7B.js → helper-BqOQRtvW.js} +1 -1
  45. package/dist/index-BLDYTxnc.js +28058 -0
  46. package/dist/{index-C2JNcGc-.js → index-BWnFs-Cb.js} +281 -299
  47. package/dist/{index-B5NufbUt.js → index-BaBNmzUb.js} +1 -1
  48. package/dist/{index-CWR3qYjb.js → index-Boo5np6l.js} +1 -1
  49. package/dist/{index-BsfWRB8R.js → index-CC1GV8OW.js} +1 -1
  50. package/dist/{index-0UYoh1-7.js → index-CHO4_zsT.js} +1 -1
  51. package/dist/{index-2P9w5u3m.js → index-DEZsrQ2f.js} +3 -3
  52. package/dist/{index-C7zMfUgy.js → index-D_f2lmK2.js} +1 -1
  53. package/dist/{index-Dap5R3vr.js → index-Da142OER.js} +66 -78
  54. package/dist/index-DbP04yeg.js +11 -0
  55. package/dist/{index-DBy30v8N.js → index-DtPe-TEm.js} +3 -3
  56. package/dist/{index-CJ8Uh2Ja.js → index-FvlaxwGB.js} +3 -3
  57. package/dist/{index.esm2017-D1X3PgpO.js → index.esm2017-ePm--Atp.js} +55 -55
  58. package/dist/{loading-CJ3nOovJ.js → loading-KNmEMBUB.js} +460 -469
  59. package/dist/{membership-B1cmSRyk.js → membership-DKoVIS1a.js} +3 -3
  60. package/dist/money-CkD3zl5C.js +15 -0
  61. package/dist/number-BDsGpOXm.js +12 -0
  62. package/dist/{rule-ChWyR-0j.js → rule-CzamI50_.js} +2 -2
  63. package/dist/{rule-builder-CSmOONdb.js → rule-builder-DHf6wfaQ.js} +1 -1
  64. package/dist/style.css +1 -1
  65. package/dist/{template-Cug7aRK0.js → template-CFAIPoD7.js} +63 -63
  66. package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
  67. package/dist/{xlsx-CfgPFFvp.js → xlsx-BDJMaozs.js} +517 -517
  68. package/package.json +4 -7
  69. package/dist/Analytic-CMXUjK_F.js +0 -622
  70. package/dist/Broadcast-DowFtHv6.js +0 -223
  71. package/dist/Card-C7rhL0pV.js +0 -825
  72. package/dist/Collections-B-1wlk3r.js +0 -453
  73. package/dist/Credit-DDjozmoF.js +0 -220
  74. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-pwMuIgs5.js +0 -345
  75. package/dist/Experience-BbE-c1Op.js +0 -221
  76. package/dist/Game-DQdRpaN-.js +0 -255
  77. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
  78. package/dist/MainLayout-B1aJoR95.js +0 -41
  79. package/dist/Marketing-Dgmxzg4h.js +0 -316
  80. package/dist/Member-w23oRVwN.js +0 -69
  81. package/dist/MemberList-BLIdjznQ.js +0 -1735
  82. package/dist/MemberOverview-wL_ailso.js +0 -58
  83. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Dy_lMdZA.js +0 -432
  84. package/dist/Mission-Cjt0E083.js +0 -261
  85. package/dist/Point-CQJL3Ewu.js +0 -222
  86. package/dist/Promotion-BYViH3bu.js +0 -247
  87. package/dist/Segment-B9Jj1ak0.js +0 -437
  88. package/dist/Setting-DXWbgRxs.js +0 -1901
  89. package/dist/Store-Dswk2e_z.js +0 -1511
  90. package/dist/StoreRewards-CNUhG_Ue.js +0 -401
  91. package/dist/Transaction-BB-kk-84.js +0 -39
  92. package/dist/Voucher-b1_Jlm6X.js +0 -490
  93. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-pG-SrXp9.js +0 -56
  94. package/dist/app-DCHKJoql.js +0 -5639
  95. package/dist/dto-jcK3TGB7.js +0 -2770
  96. package/dist/index-Cv7pLAYq.js +0 -3
  97. package/dist/index-LrSSauN2.js +0 -29193
  98. package/dist/money-BEATdGS6.js +0 -15
  99. package/dist/number-CeAYAKCp.js +0 -12
  100. package/dist/vue-i18n-BRhKDHdF.js +0 -2365
  101. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -0,0 +1,620 @@
1
+ import { defineComponent as L, openBlock as l, createElementBlock as h, Fragment as R, renderList as I, createElementVNode as a, toDisplayString as P, createCommentVNode as B, resolveComponent as k, createBlock as A, withCtx as T, createVNode as f, unref as n, ref as b, computed as G, onMounted as H, watch as Y, isRef as q, createSlots as ee, createTextVNode as te, reactive as ae, onBeforeMount as ne, normalizeClass as oe } from "vue";
2
+ import { _ as le } from "./campaign-CpzFl8Vr.js";
3
+ import { f as se } from "./number-BDsGpOXm.js";
4
+ import { C as ie, F as re, a as ce } from "./dto-CfEXSCq6.js";
5
+ import { useRouter as J } from "vue-router";
6
+ import { c as M } from "./index-Boo5np6l.js";
7
+ import { _ as ue, Z as de } from "./ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js";
8
+ import { J as me } from "./JsonViewer-v8_C7l5N.js";
9
+ import { u as pe } from "./loading-KNmEMBUB.js";
10
+ import { useSnackbar as fe } from "@feedmepos/ui-library";
11
+ import { u as ve } from "./app-wDQR6dpb.js";
12
+ import { g as ye } from "./object-qECH92oz.js";
13
+ import { u as ge } from "./campaign-CsOje3Ap.js";
14
+ import { u as _e } from "./membership-DKoVIS1a.js";
15
+ import { m as he } from "./index-CHO4_zsT.js";
16
+ const be = { class: "divide-x flex flex-wrap" }, xe = { class: "fm-typo-en-body-md-400 mb-2 text-fm-color-typo-secondary" }, Ce = { class: "fm-typo-en-title-sm-800" }, ke = /* @__PURE__ */ L({
17
+ __name: "CampaignStat",
18
+ props: {
19
+ data: {
20
+ type: Object,
21
+ required: !0
22
+ }
23
+ },
24
+ setup(m) {
25
+ const O = m, i = [
26
+ { label: "Credit Received", key: "CREDIT" },
27
+ { label: "EXP Received", key: "POINT" },
28
+ { label: "Points Received", key: "COIN" },
29
+ { label: "Message Sent", key: "BROADCAST" },
30
+ { label: "Vouchers Claimed", key: "VOUCHER" },
31
+ { label: "Users Joined", key: "UNIQUE_USER" }
32
+ ];
33
+ function u(g) {
34
+ var r;
35
+ return se((r = O.data) == null ? void 0 : r[g], 2, !0) || 0;
36
+ }
37
+ return (g, r) => (l(), h("div", be, [
38
+ (l(), h(R, null, I(i, (e) => (l(), h(R, null, [
39
+ e.key in m.data ? (l(), h("div", {
40
+ key: e.key,
41
+ class: "px-16"
42
+ }, [
43
+ a("div", xe, P(e.label), 1),
44
+ a("div", Ce, P(u(e.key)), 1)
45
+ ])) : B("", !0)
46
+ ], 64))), 64))
47
+ ]));
48
+ }
49
+ }), Se = { 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" }, we = { class: "fm-typo-en-body-md-600 overflow-hidden select-none text-ellipsis text-fm-color-typo-secondary whitespace-nowrap" }, Fe = /* @__PURE__ */ L({
50
+ __name: "CampaignChip",
51
+ props: {
52
+ type: { type: String, required: !0 },
53
+ icon: {
54
+ type: Object,
55
+ default: () => ({ icon: "circle", color: "typo-sucess" })
56
+ },
57
+ label: {
58
+ type: String,
59
+ default: ""
60
+ }
61
+ },
62
+ setup(m) {
63
+ const i = ie[m.type];
64
+ return (u, g) => {
65
+ const r = k("FmIcon"), e = k("FmTooltip");
66
+ return l(), A(e, {
67
+ variant: "plain",
68
+ placement: "top",
69
+ content: m.label
70
+ }, {
71
+ default: T(() => [
72
+ a("div", Se, [
73
+ f(r, {
74
+ name: n(i).icon,
75
+ outline: "",
76
+ size: "sm"
77
+ }, null, 8, ["name"]),
78
+ a("div", we, P(m.label), 1),
79
+ f(r, {
80
+ name: m.icon.name,
81
+ color: m.icon.color,
82
+ size: "sm"
83
+ }, null, 8, ["name", "color"])
84
+ ])
85
+ ]),
86
+ _: 1
87
+ }, 8, ["content"]);
88
+ };
89
+ }
90
+ }), Ve = { class: "flex flex-col" }, $e = { class: "flex flex-nowrap items-center justify-between mb-12" }, Ae = { class: "flex gap-4 items-center justify-start" }, Re = { class: "fm-typo-en-title-sm-800" }, Oe = { class: "flex flex-wrap gap-4 items-center mb-16 overflow-y-hidden" }, Ue = /* @__PURE__ */ L({
91
+ __name: "CampaignGroup",
92
+ props: {
93
+ group: {
94
+ type: Object,
95
+ required: !0
96
+ },
97
+ onEdit: {
98
+ type: Function,
99
+ required: !0
100
+ }
101
+ },
102
+ emits: ["changed"],
103
+ setup(m, { emit: O }) {
104
+ J(), b(!1);
105
+ const i = m, u = b([]), g = G(
106
+ () => u.value.reduce(
107
+ (e, c) => ({ ...e, [c.type]: c.totalAmount }),
108
+ {}
109
+ )
110
+ ), r = G(() => {
111
+ var e;
112
+ return ((e = i.group.pf_campaigns) == null ? void 0 : e.map((c) => ({
113
+ campaign: c,
114
+ label: c.name
115
+ }))) || [];
116
+ });
117
+ return H(async () => {
118
+ u.value = await M.readStats({
119
+ groupId: i.group._id.toString()
120
+ });
121
+ }), (e, c) => {
122
+ const s = k("FmButton"), o = k("FmCard");
123
+ return l(), A(o, {
124
+ class: "mb-24 p-24",
125
+ variant: "outlined"
126
+ }, {
127
+ default: T(() => [
128
+ a("div", Ve, [
129
+ a("div", $e, [
130
+ a("div", Ae, [
131
+ a("div", Re, P(m.group.name), 1),
132
+ f(s, {
133
+ icon: "edit",
134
+ variant: "tertiary",
135
+ onClick: c[0] || (c[0] = (v) => m.onEdit(m.group))
136
+ })
137
+ ])
138
+ ]),
139
+ a("div", Oe, [
140
+ (l(!0), h(R, null, I(n(r), (v) => (l(), A(Fe, {
141
+ key: e.index,
142
+ type: v.campaign.type,
143
+ label: v.label
144
+ }, null, 8, ["type", "label"]))), 128))
145
+ ]),
146
+ f(ke, { data: n(g) }, null, 8, ["data"])
147
+ ])
148
+ ]),
149
+ _: 1
150
+ });
151
+ };
152
+ }
153
+ }), Ee = { class: "ml-32 flex flex-col" }, Pe = /* @__PURE__ */ L({
154
+ __name: "CampaignCard",
155
+ props: {
156
+ title: {},
157
+ items: {},
158
+ modelValue: {}
159
+ },
160
+ emits: ["update:model-value"],
161
+ setup(m, { emit: O }) {
162
+ const i = m, u = O, g = (s) => {
163
+ s ? c.value = i.items.map((o) => o.value) : c.value = [], e.value = s, u("update:model-value", c.value);
164
+ }, r = (s) => {
165
+ c.value = s, e.value = s.length === i.items.length, u("update:model-value", s);
166
+ }, e = b(!1), c = b([]);
167
+ return Y(
168
+ () => i.modelValue,
169
+ () => {
170
+ c.value = i.modelValue.filter(
171
+ (s) => i.items.find((o) => o.value === s)
172
+ );
173
+ }
174
+ ), H(() => {
175
+ c.value = i.modelValue.filter(
176
+ (s) => i.items.find((o) => o.value === s)
177
+ );
178
+ }), (s, o) => {
179
+ const v = k("FmCheckbox"), x = k("FmCard");
180
+ return l(), A(x, {
181
+ variant: "outlined",
182
+ class: "p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3"
183
+ }, {
184
+ default: T(() => [
185
+ f(v, {
186
+ "model-value": n(e),
187
+ value: "1",
188
+ label: i.title,
189
+ indeterminate: n(c).length > 0,
190
+ "onUpdate:modelValue": g
191
+ }, null, 8, ["model-value", "label", "indeterminate"]),
192
+ a("div", Ee, [
193
+ (l(!0), h(R, null, I(i.items, (_, S) => (l(), A(v, {
194
+ key: S,
195
+ "model-value": n(c),
196
+ label: _.label,
197
+ value: _.value,
198
+ "onUpdate:modelValue": r
199
+ }, null, 8, ["model-value", "label", "value"]))), 128))
200
+ ])
201
+ ]),
202
+ _: 1
203
+ });
204
+ };
205
+ }
206
+ }), Be = { class: "space-y-16" }, Te = { class: "flex items-center" }, Ge = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary w-[300px]" }, Ie = { class: "space-y-[40px]" }, Me = /* @__PURE__ */ L({
207
+ __name: "LinkCampaign",
208
+ props: {
209
+ modelValue: {
210
+ type: Array,
211
+ required: !0
212
+ },
213
+ campaigns: {
214
+ type: Object,
215
+ required: !0
216
+ }
217
+ },
218
+ emits: ["update:model-value"],
219
+ setup(m, { emit: O }) {
220
+ const i = b(""), u = b([]), g = m, r = O, e = G(() => Object.entries(g.campaigns).reduce((s, [o, v]) => {
221
+ const x = v.filter(
222
+ (_) => _.label.toLowerCase().includes(i.value.toLowerCase())
223
+ );
224
+ return x.length > 0 && (s[o] = x), s;
225
+ }, {}));
226
+ function c(s, o) {
227
+ u.value = u.value.filter(
228
+ (v) => !o.map((x) => x.value).includes(v)
229
+ ), u.value = [.../* @__PURE__ */ new Set([...u.value, ...s])], r("update:model-value", u.value);
230
+ }
231
+ return H(() => {
232
+ u.value = g.modelValue;
233
+ }), (s, o) => {
234
+ const v = k("FmTextField");
235
+ return l(), h(R, null, [
236
+ f(me, { json: m.campaigns }, null, 8, ["json"]),
237
+ a("div", Be, [
238
+ a("div", Te, [
239
+ a("div", Ge, P(n(u).length) + " campaign(s) linked ", 1),
240
+ f(v, {
241
+ modelValue: n(i),
242
+ "onUpdate:modelValue": o[0] || (o[0] = (x) => q(i) ? i.value = x : null),
243
+ "prepend-icon": "search",
244
+ placeholder: "Search",
245
+ class: "w-full"
246
+ }, null, 8, ["modelValue"])
247
+ ]),
248
+ a("div", Ie, [
249
+ (l(!0), h(R, null, I(n(e), (x, _) => (l(), A(Pe, {
250
+ "model-value": n(u),
251
+ title: _,
252
+ items: x,
253
+ "onUpdate:modelValue": (S) => c(S, x)
254
+ }, null, 8, ["model-value", "title", "items", "onUpdate:modelValue"]))), 256))
255
+ ])
256
+ ])
257
+ ], 64);
258
+ };
259
+ }
260
+ }), Le = { class: "flex items-center gap-x-8" }, je = {
261
+ key: 0,
262
+ class: "space-y-16 pr-12"
263
+ }, De = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800" }, "Group detail", -1), Ne = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800" }, "Link campaign", -1), qe = { class: "flex items-center gap-x-16" }, He = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, ze = { class: "mt-16" }, Ke = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600 py-8 px-16 bg-gray-100" }, Je = { class: "flex justify-between items-center py-8 px-16 border-b-1" }, We = { class: "flex items-center gap-8" }, Ze = /* @__PURE__ */ L({
264
+ __name: "AnalyticSheet",
265
+ emits: ["success"],
266
+ setup(m, { expose: O, emit: i }) {
267
+ const u = i, g = ve();
268
+ fe();
269
+ const r = b(!1), e = b(!1), c = {
270
+ name: "",
271
+ campaigns: []
272
+ }, s = b(""), o = b({ ...c }), v = re.superRefine((d, t) => {
273
+ }), x = b([]), _ = b(null), { global: S, minor: w } = pe, p = G(() => {
274
+ const d = v.safeParse(o.value);
275
+ return d.success ? [] : d.error.errors;
276
+ });
277
+ function U(d) {
278
+ var t;
279
+ r.value = !0, d ? (_.value = { ...d }, o.value = { ...d, campaigns: (t = d.pf_campaigns) == null ? void 0 : t.map((y) => y._id) }) : (_.value = null, o.value = { ...c });
280
+ }
281
+ function $() {
282
+ r.value = !1, _.value = null;
283
+ }
284
+ function F() {
285
+ e.value = !0;
286
+ }
287
+ async function j() {
288
+ const d = await M.readAll({
289
+ limit: 1e3,
290
+ skip: 0,
291
+ sortBy: "_id",
292
+ search: "",
293
+ descending: !0
294
+ });
295
+ x.value = d.resources.filter(
296
+ (t) => !["MEMBERSHIP", "REWARD_POOL"].includes(t.type) && !["ISSUE_REWARD"].includes("event" in t ? t == null ? void 0 : t.event.type : "")
297
+ );
298
+ }
299
+ const V = G(() => {
300
+ const d = (y) => y.map((E) => ({
301
+ label: E.name,
302
+ value: E._id
303
+ }));
304
+ return ye(
305
+ x.value,
306
+ (y) => ce.formattedType(y.type),
307
+ d
308
+ );
309
+ }), z = G(() => Object.entries(V.value).reduce(
310
+ (d, [t, y]) => {
311
+ const E = y.filter((D) => {
312
+ var N, C;
313
+ return (C = (N = o.value) == null ? void 0 : N.campaigns) == null ? void 0 : C.includes(D.value);
314
+ }).filter(
315
+ (D) => D.label.toLowerCase().includes(s.value.toLowerCase())
316
+ );
317
+ return E.length > 0 && (d[t] = E), d;
318
+ },
319
+ {}
320
+ ));
321
+ function W(d) {
322
+ var y, E;
323
+ const t = (y = o.value.campaigns) == null ? void 0 : y.indexOf(d);
324
+ t != null && t > -1 && ((E = o.value.campaigns) == null || E.splice(t, 1));
325
+ }
326
+ async function Z() {
327
+ v.safeParse(o.value).success && await w(
328
+ async () => {
329
+ var t;
330
+ _.value ? await M.updateGroup(
331
+ (t = _.value) == null ? void 0 : t._id,
332
+ o.value
333
+ ) : await M.createGroup(o.value), u("success"), $();
334
+ },
335
+ {
336
+ message: "Saving group",
337
+ successMessage: "Group saved"
338
+ }
339
+ );
340
+ }
341
+ async function Q() {
342
+ await w(
343
+ async () => {
344
+ var d;
345
+ await M.deleteGroup((d = _.value) == null ? void 0 : d._id), u("success"), $();
346
+ },
347
+ {
348
+ message: "Deleting group",
349
+ successMessage: "Group deleted"
350
+ }
351
+ );
352
+ }
353
+ return H(async () => {
354
+ await j();
355
+ }), O({
356
+ showSheet: U,
357
+ hideSheet: $
358
+ }), (d, t) => {
359
+ const y = k("FmButton"), E = k("FmTextField"), D = k("FmList"), N = k("FmSideSheet");
360
+ return l(), A(N, {
361
+ modelValue: n(r),
362
+ "onUpdate:modelValue": t[7] || (t[7] = (C) => q(r) ? r.value = C : null),
363
+ header: n(_) ? "Edit group" : "Add group",
364
+ "dismiss-away": "",
365
+ "close-button": !0,
366
+ "max-width": 550
367
+ }, ee({
368
+ "side-sheet-footer": T(() => [
369
+ a("div", We, [
370
+ n(e) ? B("", !0) : (l(), h(R, { key: 0 }, [
371
+ f(y, {
372
+ label: "Submit",
373
+ onClick: Z,
374
+ disabled: n(p).length > 0 || n(g).isLoading
375
+ }, null, 8, ["disabled"]),
376
+ f(y, {
377
+ label: "Cancel",
378
+ onClick: t[4] || (t[4] = (C) => $()),
379
+ variant: "tertiary"
380
+ }),
381
+ n(_) ? (l(), A(y, {
382
+ key: 0,
383
+ label: "Delete",
384
+ variant: "plain",
385
+ class: "ml-auto fm-color-system-error-300",
386
+ onClick: t[5] || (t[5] = (C) => Q())
387
+ })) : B("", !0)
388
+ ], 64)),
389
+ n(e) ? (l(), A(y, {
390
+ key: 1,
391
+ label: "Confirm",
392
+ onClick: t[6] || (t[6] = (C) => e.value = !1)
393
+ })) : B("", !0)
394
+ ])
395
+ ]),
396
+ default: T(() => [
397
+ n(e) ? B("", !0) : (l(), h("div", je, [
398
+ De,
399
+ f(ue, {
400
+ modelValue: n(o).name,
401
+ "onUpdate:modelValue": t[1] || (t[1] = (C) => n(o).name = C),
402
+ label: "Name",
403
+ schema: n(de).typeAtPath(n(v), "name")
404
+ }, null, 8, ["modelValue", "schema"]),
405
+ Ne,
406
+ a("div", qe, [
407
+ a("div", He, P(n(o).campaigns.length) + " campaign(s) linked ", 1),
408
+ f(E, {
409
+ modelValue: n(s),
410
+ "onUpdate:modelValue": t[2] || (t[2] = (C) => q(s) ? s.value = C : null),
411
+ "prepend-icon": "search",
412
+ placeholder: "Search",
413
+ class: "w-auto"
414
+ }, null, 8, ["modelValue"])
415
+ ]),
416
+ f(y, {
417
+ variant: "plain",
418
+ icon: "link",
419
+ label: "Link Campaign",
420
+ onClick: F
421
+ })
422
+ ])),
423
+ n(e) ? (l(), A(Me, {
424
+ key: 1,
425
+ modelValue: n(o).campaigns,
426
+ "onUpdate:modelValue": t[3] || (t[3] = (C) => n(o).campaigns = C),
427
+ campaigns: n(V)
428
+ }, null, 8, ["modelValue", "campaigns"])) : B("", !0),
429
+ a("div", ze, [
430
+ n(e) ? B("", !0) : (l(!0), h(R, { key: 0 }, I(n(z), (C, X) => (l(), h("div", null, [
431
+ a("div", Ke, P(X), 1),
432
+ f(D, { separator: !0 }, {
433
+ default: T(() => [
434
+ (l(!0), h(R, null, I(C, (K) => (l(), h("div", Je, [
435
+ a("div", null, P(K.label), 1),
436
+ a("div", null, [
437
+ f(y, {
438
+ icon: "delete",
439
+ onClick: (rt) => W(K.value),
440
+ variant: "tertiary"
441
+ }, null, 8, ["onClick"])
442
+ ])
443
+ ]))), 256))
444
+ ]),
445
+ _: 2
446
+ }, 1024)
447
+ ]))), 256))
448
+ ])
449
+ ]),
450
+ _: 2
451
+ }, [
452
+ n(e) ? {
453
+ name: "side-sheet-header",
454
+ fn: T(() => [
455
+ a("div", Le, [
456
+ f(y, {
457
+ icon: "arrow_back",
458
+ variant: "tertiary",
459
+ onClick: t[0] || (t[0] = (C) => e.value = !1)
460
+ }),
461
+ te("Link campaign ")
462
+ ])
463
+ ]),
464
+ key: "0"
465
+ } : void 0
466
+ ]), 1032, ["modelValue", "header"]);
467
+ };
468
+ }
469
+ }), Qe = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Xe = { class: "space-y-16" }, Ye = { class: "flex items-center justify-end" }, et = /* @__PURE__ */ a("div", { class: "fm-typo-en-body-lg-600" }, "Connect summary", -1), tt = { class: "grid grid-cols-4 xs:grid-cols-2 gap-4 divide-x xs:divide-x-0" }, at = { class: "fm-typo-body-md-400 fm-typo-en-body-md-400 mb-2 text-fm-color-typo-secondary" }, nt = { class: "fm-typo-en-title-sm-800" }, ot = /* @__PURE__ */ a("img", {
470
+ src: le,
471
+ class: "w-[150px]"
472
+ }, null, -1), lt = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800 text-center" }, " Create campaign group to track performance ", -1), st = /* @__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), it = { class: "flex gap-16 items-center" }, St = /* @__PURE__ */ L({
473
+ __name: "Analytic",
474
+ setup(m) {
475
+ const O = {
476
+ label: "Add group",
477
+ value: "create",
478
+ isPrimary: !0,
479
+ prependIcon: "add"
480
+ }, i = ge(), u = b(), g = b([]), r = b(""), e = ae({
481
+ totalCampaign: 0,
482
+ totalProgram: 0,
483
+ totalMember: 0
484
+ }), c = b("1"), s = [
485
+ {
486
+ key: "Total campaign",
487
+ value: () => e.totalCampaign
488
+ },
489
+ {
490
+ key: "Total Program",
491
+ value: () => e.totalProgram
492
+ },
493
+ {
494
+ key: "Total Member",
495
+ value: () => e.totalMember
496
+ }
497
+ ];
498
+ function o(w) {
499
+ var p;
500
+ c.value = (/* @__PURE__ */ new Date()).toISOString(), (p = u.value) == null || p.showSheet(w);
501
+ }
502
+ async function v() {
503
+ await i.readGroups();
504
+ const w = await M.readAllGrouped({
505
+ limit: 100,
506
+ skip: 0,
507
+ sortBy: "_id",
508
+ search: "",
509
+ descending: !0
510
+ });
511
+ g.value = w.resources;
512
+ }
513
+ async function x() {
514
+ var U, $;
515
+ const w = await he.read({
516
+ limit: 1,
517
+ skip: 0,
518
+ sortBy: "_id",
519
+ search: "",
520
+ descending: !1
521
+ }), p = await M.readAll({
522
+ limit: 1e3,
523
+ skip: 0,
524
+ sortBy: "_id",
525
+ search: "",
526
+ descending: !1
527
+ });
528
+ e.totalCampaign = ((U = p.resources) == null ? void 0 : U.filter(
529
+ (F) => ["PROMOTION", "VOUCHER", "BROADCAST"].includes(F.type) && !["ISSUE_REWARD"].includes("event" in F ? F == null ? void 0 : F.event.type : "")
530
+ ).length) ?? 0, e.totalProgram = (($ = p.resources) == null ? void 0 : $.filter(
531
+ (F) => ["POINT", "COIN", "CREDIT", "GAME"].includes(F.type)
532
+ ).length) ?? 0, e.totalMember = w.meta.totalResources ?? 0;
533
+ }
534
+ const _ = G(() => g.value.filter((w) => {
535
+ var p;
536
+ return w.name.includes(r.value) || ((p = w.pf_campaigns) == null ? void 0 : p.filter((U) => U.name.includes(r.value)).length);
537
+ })), S = _e();
538
+ return J(), b(!0), G(() => {
539
+ var w, p, U, $;
540
+ return !S.storeOption || !S.storeOption.company ? -1 : !S.payoutAccount || !S.payoutAccount.enable || S.payoutAccount.status != "APPROVED" ? 0 : (p = (w = S.store) == null ? void 0 : w.categories) != null && p.length ? ($ = (U = S.store) == null ? void 0 : U.categories) != null && $.some(
541
+ (F) => F.bundles.some((j) => j.isFeedvibe)
542
+ ) ? 3 : 2 : 1;
543
+ }), ne(async () => {
544
+ await v(), await x(), await S.readMemberStore(), await S.readMembership(), await S.readPayoutAccount();
545
+ }), (w, p) => {
546
+ const U = k("FmPageHead"), $ = k("FmSearch"), F = k("FmCard"), j = k("FmButton");
547
+ return k("FmIcon"), l(), h(R, null, [
548
+ f(U, {
549
+ title: "Analytic",
550
+ actions: n(g).length > 0 ? [O] : [],
551
+ "onClick:action": p[0] || (p[0] = (V) => o())
552
+ }, null, 8, ["actions"]),
553
+ a("div", Qe, [
554
+ a("div", Xe, [
555
+ a("div", Ye, [
556
+ f($, {
557
+ class: "xs:hidden",
558
+ modelValue: n(r),
559
+ "onUpdate:modelValue": p[1] || (p[1] = (V) => q(r) ? r.value = V : null),
560
+ placeholder: "Search",
561
+ collapsible: ""
562
+ }, null, 8, ["modelValue"])
563
+ ]),
564
+ f(F, {
565
+ variant: "outlined",
566
+ class: "flex flex-col gap-16 p-16"
567
+ }, {
568
+ default: T(() => [
569
+ et,
570
+ a("div", tt, [
571
+ (l(), h(R, null, I(s, (V, z) => a("div", {
572
+ key: V.key,
573
+ class: oe(["px-8", { "xs:!border-r": z % 2 == 0 }])
574
+ }, [
575
+ a("div", at, P(V.key), 1),
576
+ a("div", nt, P(V.value()), 1)
577
+ ], 2)), 64))
578
+ ])
579
+ ]),
580
+ _: 1
581
+ })
582
+ ]),
583
+ B("", !0),
584
+ n(g).length ? B("", !0) : (l(), A(F, {
585
+ key: 1,
586
+ variant: "outlined",
587
+ class: "flex flex-col gap-y-24 items-center p-16"
588
+ }, {
589
+ default: T(() => [
590
+ ot,
591
+ lt,
592
+ st,
593
+ a("div", it, [
594
+ f(j, {
595
+ label: "Create group",
596
+ icon: "add",
597
+ onClick: p[3] || (p[3] = (V) => o())
598
+ })
599
+ ])
600
+ ]),
601
+ _: 1
602
+ })),
603
+ (l(!0), h(R, null, I(n(_), (V) => (l(), A(Ue, {
604
+ key: V._id.toString(),
605
+ group: V,
606
+ "on-edit": o
607
+ }, null, 8, ["group"]))), 128)),
608
+ f(Ze, {
609
+ ref_key: "sheetRef",
610
+ ref: u,
611
+ onSuccess: v
612
+ }, null, 512)
613
+ ])
614
+ ], 64);
615
+ };
616
+ }
617
+ });
618
+ export {
619
+ St as default
620
+ };