@feedmepos/mf-connect 0.0.39-prod → 0.1.0-beta.2

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-DSD9TsKr.js +622 -0
  2. package/dist/{App-X3fNEBF3.js → App-D8a5eW51.js} +250 -249
  3. package/dist/Broadcast-C8jgMe6g.js +223 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CRYS_tzZ.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js} +20 -20
  5. package/dist/Card-C1K7ULPo.js +825 -0
  6. package/dist/Collections-lMrdPUuM.js +453 -0
  7. package/dist/Credit-CJfU5tP4.js +220 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DoZyevfa.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js} +1042 -1011
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js +345 -0
  10. package/dist/Experience-Bp2ki8gU.js +221 -0
  11. package/dist/Game-BpTf6ebE.js +255 -0
  12. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +144 -0
  13. package/dist/{MainLayout-DpZC6o3R.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js} +19 -53
  14. package/dist/MainLayout-B1aJoR95.js +41 -0
  15. package/dist/Marketing-BiKE2gxA.js +316 -0
  16. package/dist/Member-BSWyy32a.js +69 -0
  17. package/dist/MemberList-CHlGREyR.js +1733 -0
  18. package/dist/MemberOverview-wL_ailso.js +58 -0
  19. package/dist/{MemberTransactions-DueaXBCy.js → MemberTransactions-BzHiXCnp.js} +1 -1
  20. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js +432 -0
  21. package/dist/Mission-8IGT3T2C.js +261 -0
  22. package/dist/Point-CbbJ6ohd.js +222 -0
  23. package/dist/Promotion-BYXCJa_S.js +247 -0
  24. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-_RX1J0Br.js → RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js} +557 -557
  25. package/dist/Segment-DXDNM0yd.js +437 -0
  26. package/dist/Setting-CLpvvZTv.js +1901 -0
  27. package/dist/Store-C6-P6bwc.js +1511 -0
  28. package/dist/StoreRewards-CUM2irXK.js +401 -0
  29. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CLFiuO5k.js → StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js} +10 -10
  30. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CoMQBL4P.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js} +1 -1
  31. package/dist/{Tier-CftEoP_R.js → Tier-DZTDxWBo.js} +481 -453
  32. package/dist/{Title-BsavXbYh.js → Title-C2Dr5ceK.js} +314 -295
  33. package/dist/Transaction-BL4mS29d.js +39 -0
  34. package/dist/Voucher-Cx0r2-df.js +490 -0
  35. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js +56 -0
  36. package/dist/{app-BNmAx3zq.js → app-B_xuZ5HB.js} +1 -1
  37. package/dist/app-wE5HTF_Y.js +5762 -0
  38. package/dist/app.js +5 -3
  39. package/dist/{business-DGL4Ayx0.js → business-DSv8zM8C.js} +1 -1
  40. package/dist/{campaign-D94sS1kM.js → campaign-7y5qquHZ.js} +5 -3
  41. package/dist/{collection.fn-BHJ1ISqO.js → collection.fn-BxVZQAx0.js} +2 -2
  42. package/dist/dto-Ew1QwLci.js +2778 -0
  43. package/dist/{effect-CFRICzlM.js → effect-BzPh8fRI.js} +9 -9
  44. package/dist/{export-w2o9NYcy.js → export-C9tDplkA.js} +3 -3
  45. package/dist/{helper-CUDWQ8vq.js → helper-Sz7oQ0F4.js} +1 -1
  46. package/dist/{index-BGuLhEym.js → index-BQm0C3Jm.js} +3 -3
  47. package/dist/{index-BjwyxNSp.js → index-C-SOz7jt.js} +1 -1
  48. package/dist/{index-BcWJcD9f.js → index-C0lpADCo.js} +1 -1
  49. package/dist/{index-DIq2KVis.js → index-C3_4GUiI.js} +1 -1
  50. package/dist/{index-BPEV5Tzg.js → index-D-2nFLsg.js} +59 -47
  51. package/dist/{index-CFMBSL24.js → index-DBMaUGYI.js} +2 -2
  52. package/dist/{index-CpwFQFTV.js → index-DH_1nOJ_.js} +3 -3
  53. package/dist/index-Dy4pmQpt.js +29193 -0
  54. package/dist/{index-BQ6isIeo.js → index-_3qBsogG.js} +1 -1
  55. package/dist/index-gIRszcHf.js +3 -0
  56. package/dist/{index-VjUw31dN.js → index-tv4t0Pnh.js} +1 -1
  57. package/dist/{index-tZ1aqhks.js → index-z0IfdrZk.js} +319 -281
  58. package/dist/{index.esm2017-zciuPty-.js → index.esm2017-BnKJDxUo.js} +55 -55
  59. package/dist/{loading-GuXe5bYG.js → loading-Ds-yFYhc.js} +469 -460
  60. package/dist/{membership-BHWJVI3e.js → membership-DaiVw9qF.js} +3 -3
  61. package/dist/money-BHtBdZoz.js +15 -0
  62. package/dist/number-CZhcB8ef.js +12 -0
  63. package/dist/{rule-MgNa_8FF.js → rule-Cd2M6Ri2.js} +2 -2
  64. package/dist/{rule-builder-BsBCWzq_.js → rule-builder-B6og27Q1.js} +1 -1
  65. package/dist/style.css +1 -1
  66. package/dist/{template-D6k3lusq.js → template-DouRWBpv.js} +63 -63
  67. package/dist/{usePagination-JoYaROkV.js → usePagination-BeF5K3M7.js} +85 -85
  68. package/dist/vue-i18n-BTlOChXs.js +2365 -0
  69. package/dist/{xlsx-ClrA4KOh.js → xlsx-SahfXQ70.js} +517 -517
  70. package/dist/zod-Bg2FbC-D.js +90 -0
  71. package/package.json +7 -4
  72. package/dist/Analytic-DMFueUju.js +0 -620
  73. package/dist/Broadcast-YIfWIXeA.js +0 -216
  74. package/dist/Card-BIxlgQm7.js +0 -824
  75. package/dist/Collections-M6DaHM2W.js +0 -441
  76. package/dist/Credit-BtRy-xoY.js +0 -214
  77. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-D5DNTBSQ.js +0 -344
  78. package/dist/Experience-DGm1lnqj.js +0 -211
  79. package/dist/Game-B8-lG7qq.js +0 -250
  80. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js +0 -144
  81. package/dist/Marketing-DtG3AIWr.js +0 -309
  82. package/dist/Member-K443-9Vy.js +0 -92
  83. package/dist/MemberList-CYXHXFTL.js +0 -1735
  84. package/dist/MemberOverview-C2n9oJZh.js +0 -58
  85. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Bk2HLVmt.js +0 -203
  86. package/dist/Mission-CN5umXXA.js +0 -248
  87. package/dist/Point-XAm6H2p_.js +0 -220
  88. package/dist/Promotion-DsrA4KiE.js +0 -244
  89. package/dist/Segment-CZGGHoAu.js +0 -435
  90. package/dist/Setting-BjfxLKyp.js +0 -1870
  91. package/dist/Store-D_B-vhh3.js +0 -1513
  92. package/dist/StoreRewards-BjHffUKj.js +0 -429
  93. package/dist/Transaction-CdxzoKDG.js +0 -36
  94. package/dist/Voucher-B_9Nv1Mr.js +0 -485
  95. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +0 -140
  96. package/dist/app--1Ks5Hms.js +0 -2974
  97. package/dist/dto-X0Eeujxx.js +0 -1151
  98. package/dist/index-BPNG8N-w.js +0 -11
  99. package/dist/index-DWM9MWGj.js +0 -28058
  100. package/dist/money-CrttVpCp.js +0 -15
  101. package/dist/number-CIndGU4O.js +0 -12
@@ -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-CZhcB8ef.js";
4
+ import { C as ie, F as re, a as ce } from "./dto-Ew1QwLci.js";
5
+ import { useRouter as W } from "vue-router";
6
+ import { c as L } from "./index-C-SOz7jt.js";
7
+ import { _ as ue } from "./ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.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-Ds-yFYhc.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-7y5qquHZ.js";
15
+ import { u as _e } from "./membership-DaiVw9qF.js";
16
+ import { u as be } from "./vue-i18n-BTlOChXs.js";
17
+ import { m as he } from "./index-tv4t0Pnh.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
+ };