@feedmepos/mf-connect 0.0.5-beta.1 → 0.0.5-beta.10

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 (145) hide show
  1. package/dist/Analytic-BjQuph91.js +614 -0
  2. package/dist/Broadcast-DZyCgFgu.js +216 -0
  3. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BvicadXr.js +117 -0
  4. package/dist/Card-FFvz-XtJ.js +775 -0
  5. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  6. package/dist/Collections-rI6PWFfS.js +437 -0
  7. package/dist/Credit-BMIUsOes.js +214 -0
  8. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DzYCw7jw.js +1952 -0
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BlRo7L57.js +30142 -0
  10. package/dist/Experience-Dywvf6mV.js +211 -0
  11. package/dist/Game-Cv_2d3mW.js +242 -0
  12. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-DMsxZkxf.js +144 -0
  13. package/dist/JsonViewer-CVV7Vaqf.js +87 -0
  14. package/dist/MainLayout-BiBbtL5G.js +18771 -0
  15. package/dist/Marketing-BAnnQapA.js +309 -0
  16. package/dist/Member-Xijr68gQ.js +90 -0
  17. package/dist/MemberList-BSjgaPD8.js +1752 -0
  18. package/dist/MemberOverview-C2n9oJZh.js +58 -0
  19. package/dist/MemberTransactions-wJb7tSn4.js +38 -0
  20. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-CxPm5T8t.js +163 -0
  21. package/dist/Point-D20YJU6z.js +211 -0
  22. package/dist/Promotion-B57bGU0_.js +219 -0
  23. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-6_cDsiZZ.js +1461 -0
  24. package/dist/Segment-BPMXHAJn.js +392 -0
  25. package/dist/Setting-_NAaxV3X.js +1862 -0
  26. package/dist/Store-CX-ZJyyo.js +1415 -0
  27. package/dist/StoreRewards-BIZEdIJA.js +432 -0
  28. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BD70W4yD.js +640 -0
  29. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-MvfZwdn2.js +124 -0
  30. package/dist/Tier-DRjG2PvW.js +821 -0
  31. package/dist/Title-DaB3n9Xg.js +496 -0
  32. package/dist/Transaction-BxU8i96W.js +34 -0
  33. package/dist/Voucher-CvWfWjRe.js +448 -0
  34. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +140 -0
  35. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  36. package/dist/app-C6hWZNZj.js +31287 -0
  37. package/dist/app.js +5 -0
  38. package/dist/campaign-1_vNFjFO.js +93 -0
  39. package/dist/campaign-CpzFl8Vr.js +4 -0
  40. package/dist/collection.fn-DHlfGYAC.js +24 -0
  41. package/dist/dto-CqgUeB85.js +353 -0
  42. package/dist/effect-hA55Rg8G.js +61 -0
  43. package/dist/helper-6CFI6LJl.js +58 -0
  44. package/dist/index-4yy16DJ5.js +29565 -0
  45. package/dist/index-B3tqy20_.js +190 -0
  46. package/dist/index-Biwk9slT.js +64 -0
  47. package/dist/index-BsnVfgkS.js +674 -0
  48. package/dist/index-CCP0AKPB.js +99 -0
  49. package/dist/index-CpXFbtr_.js +104 -0
  50. package/dist/index-CuvNtC_M.js +61 -0
  51. package/dist/index-CvtHOKIC.js +1742 -0
  52. package/dist/index-DDvVcasQ.js +8796 -0
  53. package/dist/index-Dbd4WA4r.js +61 -0
  54. package/dist/index-DsLUCI9T.js +1757 -0
  55. package/dist/index-UCI0tzcc.js +234 -0
  56. package/dist/index-rWqxLpt-.js +38 -0
  57. package/dist/loading-BBLfgVD_.js +3131 -0
  58. package/dist/lodash-CZmLXyej.js +3678 -0
  59. package/dist/membership-NslDxQcA.js +213 -0
  60. package/dist/moment-BWErdI6_.js +2578 -0
  61. package/dist/money-DrDmTG72.js +15 -0
  62. package/dist/number-JronyDuC.js +12 -0
  63. package/dist/object-qECH92oz.js +26 -0
  64. package/dist/objectId-dwaoBfJX.js +7 -0
  65. package/dist/rule-Bd1N1vP1.js +1966 -0
  66. package/dist/rule-builder-BFz5tpBM.js +89 -0
  67. package/dist/style.css +1 -0
  68. package/dist/template-DA_IfTG9.js +190 -0
  69. package/dist/tier-BJDhpH6X.js +4 -0
  70. package/dist/xlsx-BybFqthH.js +15491 -0
  71. package/package.json +1 -1
  72. package/dist/assets/Analytic-CL42I3Gv.js +0 -1
  73. package/dist/assets/Broadcast-94D_po76.js +0 -1
  74. package/dist/assets/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-dRFgRvzu.js +0 -1
  75. package/dist/assets/Card-CQ3q3D5q.js +0 -1
  76. package/dist/assets/ChipMenu.vue_vue_type_script_setup_true_lang-CRGl74Zc.js +0 -1
  77. package/dist/assets/Collections-B-AmBC_f.js +0 -1
  78. package/dist/assets/Credit-CvLBWQlX.js +0 -1
  79. package/dist/assets/EditCampaignSheet.vue_vue_type_script_setup_true_lang-x3UxUtq6.js +0 -2
  80. package/dist/assets/EffectSheet-BGbGarYC.css +0 -1
  81. package/dist/assets/EffectSheet.vue_vue_type_style_index_0_lang-D4TnAo61.js +0 -84
  82. package/dist/assets/Experience-DgeKBrgN.js +0 -1
  83. package/dist/assets/Game-DueLqcId.js +0 -1
  84. package/dist/assets/ImageInput.vue_vue_type_script_setup_true_lang-Dd6VBS6s.js +0 -1
  85. package/dist/assets/JsonViewer-CYUiWkF5.js +0 -1
  86. package/dist/assets/JsonViewer-TCQu3aHR.css +0 -1
  87. package/dist/assets/MainLayout-DHyMbmMC.js +0 -9
  88. package/dist/assets/Marketing-NXbrJWXV.js +0 -1
  89. package/dist/assets/Member-C5ionJKA.js +0 -1
  90. package/dist/assets/MemberList-DwOFDA8D.js +0 -2
  91. package/dist/assets/MemberOverview-DmhB4DTi.js +0 -1
  92. package/dist/assets/MemberTransactions-CdRKMJpk.js +0 -1
  93. package/dist/assets/MessageInput.vue_vue_type_script_setup_true_lang-DaTr5V8E.js +0 -1
  94. package/dist/assets/Point-DZHOrXBm.js +0 -1
  95. package/dist/assets/Promotion-CCeNP-ZF.js +0 -1
  96. package/dist/assets/RuleGroup.vue_vue_type_script_setup_true_lang-DHfOtYsl.js +0 -1
  97. package/dist/assets/Segment-DMcRnSt2.js +0 -1
  98. package/dist/assets/Setting-CGnptoY_.js +0 -8
  99. package/dist/assets/Store-CU424SCC.js +0 -3
  100. package/dist/assets/StoreRewards-CzRNBkys.js +0 -1
  101. package/dist/assets/StoreTransactions.vue_vue_type_script_setup_true_lang-CIQ7eIQG.js +0 -1
  102. package/dist/assets/TargetLocationInput.vue_vue_type_script_setup_true_lang-CchDbD40.js +0 -1
  103. package/dist/assets/Tier-DyJl4CNe.js +0 -7
  104. package/dist/assets/Title-DlVHMOtK.js +0 -1
  105. package/dist/assets/Transaction-DU31rcNe.js +0 -1
  106. package/dist/assets/Voucher-CujjbQ--.js +0 -1
  107. package/dist/assets/ZodTextField.vue_vue_type_script_setup_true_lang-BSimZqI8.js +0 -1
  108. package/dist/assets/campaign-BwyOLFOA.js +0 -1
  109. package/dist/assets/campaign-DFKsTujB.js +0 -1
  110. package/dist/assets/campaign-RaA2how_.png +0 -0
  111. package/dist/assets/collection.fn-XeAQiy2e.js +0 -1
  112. package/dist/assets/dto-BkogOWKv.js +0 -1
  113. package/dist/assets/effect-GgqasWgN.js +0 -1
  114. package/dist/assets/helper-DsPbVlYw.js +0 -1
  115. package/dist/assets/index-BCbWWyGB.js +0 -1
  116. package/dist/assets/index-BEI3lgZI.js +0 -42
  117. package/dist/assets/index-BeQzC2Hy.css +0 -1
  118. package/dist/assets/index-Becw0wmE.js +0 -6
  119. package/dist/assets/index-BkekSjg2.js +0 -1
  120. package/dist/assets/index-Bq1Pjica.js +0 -1
  121. package/dist/assets/index-BvELDCSH.js +0 -1
  122. package/dist/assets/index-CNTp-_rh.js +0 -1
  123. package/dist/assets/index-CyJxf_lH.js +0 -2455
  124. package/dist/assets/index-DGQ0xPs2.js +0 -1
  125. package/dist/assets/index-DLmGTZ8t.js +0 -1
  126. package/dist/assets/index-DUKDZuyN.js +0 -16
  127. package/dist/assets/index-DUMovq9u.js +0 -1
  128. package/dist/assets/index-Dey7BWyK.js +0 -1
  129. package/dist/assets/index-MsDDYIUQ.js +0 -1
  130. package/dist/assets/loading-DiarcE5v.js +0 -1
  131. package/dist/assets/lodash-B171TvDP.js +0 -27
  132. package/dist/assets/membership-DKsdNYVP.js +0 -1
  133. package/dist/assets/moment-G82_0lEo.js +0 -10
  134. package/dist/assets/money-ClbBk71I.js +0 -1
  135. package/dist/assets/number-CBl4oUm8.js +0 -1
  136. package/dist/assets/object-BR0mMUJk.js +0 -1
  137. package/dist/assets/objectId-CjGgm01l.js +0 -1
  138. package/dist/assets/rule-D_xDYxGU.js +0 -7
  139. package/dist/assets/rule-builder-neYtnx5c.js +0 -1
  140. package/dist/assets/template-J1Sr4rPH.js +0 -1
  141. package/dist/assets/tier-Ckw3--LB.png +0 -0
  142. package/dist/assets/tier-zcR_G9_e.js +0 -1
  143. package/dist/assets/title-DnaKpu2C.png +0 -0
  144. package/dist/assets/xlsx-crgDO9Iy.js +0 -95
  145. package/dist/index.html +0 -18
@@ -0,0 +1,614 @@
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 T, resolveComponent as S, createBlock as F, withCtx as O, createVNode as p, unref as n, ref as C, computed as G, onMounted as D, watch as X, isRef as q, createSlots as Y, createTextVNode as ee, reactive as te, normalizeClass as ae } from "vue";
2
+ import { _ as ne } from "./campaign-CpzFl8Vr.js";
3
+ import { f as le } from "./number-JronyDuC.js";
4
+ import { C as oe, F as se, a as ie } from "./dto-CqgUeB85.js";
5
+ import { useRouter as re } from "vue-router";
6
+ import { c as B } from "./index-CpXFbtr_.js";
7
+ import { _ as ce, Z as ue } from "./ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js";
8
+ import { J as de } from "./JsonViewer-CVV7Vaqf.js";
9
+ import "./index-4yy16DJ5.js";
10
+ import { useSnackbar as me } from "@feedmepos/ui-library";
11
+ import { u as pe } from "./app-C6hWZNZj.js";
12
+ import { u as fe } from "./loading-BBLfgVD_.js";
13
+ import { g as ve } from "./object-qECH92oz.js";
14
+ import { u as ye } from "./campaign-1_vNFjFO.js";
15
+ import { m as _e } from "./index-Biwk9slT.js";
16
+ const ge = { class: "divide-x flex flex-wrap" }, he = { class: "fm-typo-en-body-md-400 mb-2 text-fm-color-typo-secondary" }, be = { class: "fm-typo-en-title-sm-800" }, xe = /* @__PURE__ */ I({
17
+ __name: "CampaignStat",
18
+ props: {
19
+ data: {
20
+ type: Object,
21
+ required: !0
22
+ }
23
+ },
24
+ setup(m) {
25
+ const R = 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(_) {
34
+ var r;
35
+ return le((r = R.data) == null ? void 0 : r[_], 2, !0) || 0;
36
+ }
37
+ return (_, r) => (o(), h("div", ge, [
38
+ (o(), h(V, null, P(i, (e) => (o(), h(V, null, [
39
+ e.key in m.data ? (o(), h("div", {
40
+ key: e.key,
41
+ class: "px-16"
42
+ }, [
43
+ a("div", he, U(e.label), 1),
44
+ a("div", be, U(u(e.key)), 1)
45
+ ])) : T("", !0)
46
+ ], 64))), 64))
47
+ ]));
48
+ }
49
+ }), Ce = { 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" }, ke = { class: "fm-typo-en-body-md-600 overflow-hidden select-none text-ellipsis text-fm-color-typo-secondary whitespace-nowrap" }, Se = /* @__PURE__ */ I({
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 = oe[m.type];
64
+ return (u, _) => {
65
+ const r = S("FmIcon"), e = S("FmTooltip");
66
+ return o(), F(e, {
67
+ variant: "plain",
68
+ placement: "top",
69
+ content: m.label
70
+ }, {
71
+ default: O(() => [
72
+ a("div", Ce, [
73
+ p(r, {
74
+ name: n(i).icon,
75
+ outline: "",
76
+ size: "sm"
77
+ }, null, 8, ["name"]),
78
+ a("div", ke, U(m.label), 1),
79
+ p(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
+ }), we = { class: "flex flex-col" }, $e = { class: "flex flex-nowrap items-center justify-between mb-12" }, Fe = { class: "flex gap-4 items-center justify-start" }, Ve = { class: "fm-typo-en-title-sm-800" }, Re = { class: "flex flex-wrap gap-4 items-center mb-16 overflow-y-hidden" }, Ae = /* @__PURE__ */ I({
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: R }) {
104
+ re(), C(!1);
105
+ const i = m, u = C([]), _ = 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 D(async () => {
118
+ u.value = await B.readStats({
119
+ groupId: i.group._id.toString()
120
+ });
121
+ }), (e, c) => {
122
+ const s = S("FmButton"), l = S("FmCard");
123
+ return o(), F(l, {
124
+ class: "mb-24 p-24",
125
+ variant: "outlined"
126
+ }, {
127
+ default: O(() => [
128
+ a("div", we, [
129
+ a("div", $e, [
130
+ a("div", Fe, [
131
+ a("div", Ve, U(m.group.name), 1),
132
+ p(s, {
133
+ icon: "edit",
134
+ variant: "tertiary",
135
+ onClick: c[0] || (c[0] = (f) => m.onEdit(m.group))
136
+ })
137
+ ])
138
+ ]),
139
+ a("div", Re, [
140
+ (o(!0), h(V, null, P(n(r), (f) => (o(), F(Se, {
141
+ key: e.index,
142
+ type: f.campaign.type,
143
+ label: f.label
144
+ }, null, 8, ["type", "label"]))), 128))
145
+ ]),
146
+ p(xe, { data: n(_) }, null, 8, ["data"])
147
+ ])
148
+ ]),
149
+ _: 1
150
+ });
151
+ };
152
+ }
153
+ }), Ue = { class: "ml-32 flex flex-col" }, Oe = /* @__PURE__ */ I({
154
+ __name: "CampaignCard",
155
+ props: {
156
+ title: {},
157
+ items: {},
158
+ modelValue: {}
159
+ },
160
+ emits: ["update:model-value"],
161
+ setup(m, { emit: R }) {
162
+ const i = m, u = R, _ = (s) => {
163
+ s ? c.value = i.items.map((l) => l.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 = C(!1), c = C([]);
167
+ return X(
168
+ () => i.modelValue,
169
+ () => {
170
+ c.value = i.modelValue.filter(
171
+ (s) => i.items.find((l) => l.value === s)
172
+ );
173
+ }
174
+ ), D(() => {
175
+ c.value = i.modelValue.filter(
176
+ (s) => i.items.find((l) => l.value === s)
177
+ );
178
+ }), (s, l) => {
179
+ const f = S("FmCheckbox"), b = S("FmCard");
180
+ return o(), F(b, {
181
+ variant: "outlined",
182
+ class: "p-16 space-y-8 h-full cursor-pointer select-none xs:col-span-3"
183
+ }, {
184
+ default: O(() => [
185
+ p(f, {
186
+ "model-value": n(e),
187
+ value: "1",
188
+ label: i.title,
189
+ indeterminate: n(c).length > 0,
190
+ "onUpdate:modelValue": _
191
+ }, null, 8, ["model-value", "label", "indeterminate"]),
192
+ a("div", Ue, [
193
+ (o(!0), h(V, null, P(i.items, (g, w) => (o(), F(f, {
194
+ key: w,
195
+ "model-value": n(c),
196
+ label: g.label,
197
+ value: g.value,
198
+ "onUpdate:modelValue": r
199
+ }, null, 8, ["model-value", "label", "value"]))), 128))
200
+ ])
201
+ ]),
202
+ _: 1
203
+ });
204
+ };
205
+ }
206
+ }), Ee = { class: "space-y-16" }, Te = { class: "flex items-center" }, Pe = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary w-[300px]" }, Be = { class: "space-y-[40px]" }, Ge = /* @__PURE__ */ I({
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: R }) {
220
+ const i = C(""), u = C([]), _ = m, r = R, e = G(() => Object.entries(_.campaigns).reduce((s, [l, f]) => {
221
+ const b = f.filter(
222
+ (g) => g.label.toLowerCase().includes(i.value.toLowerCase())
223
+ );
224
+ return b.length > 0 && (s[l] = b), s;
225
+ }, {}));
226
+ function c(s, l) {
227
+ u.value = u.value.filter(
228
+ (f) => !l.map((b) => b.value).includes(f)
229
+ ), u.value = [.../* @__PURE__ */ new Set([...u.value, ...s])], r("update:model-value", u.value);
230
+ }
231
+ return D(() => {
232
+ u.value = _.modelValue;
233
+ }), (s, l) => {
234
+ const f = S("FmTextField");
235
+ return o(), h(V, null, [
236
+ p(de, { json: m.campaigns }, null, 8, ["json"]),
237
+ a("div", Ee, [
238
+ a("div", Te, [
239
+ a("div", Pe, U(n(u).length) + " campaign(s) linked ", 1),
240
+ p(f, {
241
+ modelValue: n(i),
242
+ "onUpdate:modelValue": l[0] || (l[0] = (b) => q(i) ? i.value = b : null),
243
+ "prepend-icon": "search",
244
+ placeholder: "Search",
245
+ class: "w-full"
246
+ }, null, 8, ["modelValue"])
247
+ ]),
248
+ a("div", Be, [
249
+ (o(!0), h(V, null, P(n(e), (b, g) => (o(), F(Oe, {
250
+ "model-value": n(u),
251
+ title: g,
252
+ items: b,
253
+ "onUpdate:modelValue": (w) => c(w, b)
254
+ }, null, 8, ["model-value", "title", "items", "onUpdate:modelValue"]))), 256))
255
+ ])
256
+ ])
257
+ ], 64);
258
+ };
259
+ }
260
+ }), Ie = { class: "flex items-center gap-x-8" }, Le = {
261
+ key: 0,
262
+ class: "space-y-16 pr-12"
263
+ }, je = /* @__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), Me = { class: "flex items-center gap-x-16" }, Ne = { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, qe = { class: "mt-16" }, He = { 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" }, Ke = { class: "flex items-center gap-8" }, Je = /* @__PURE__ */ I({
264
+ __name: "AnalyticSheet",
265
+ emits: ["success"],
266
+ setup(m, { expose: R, emit: i }) {
267
+ const u = i, _ = pe();
268
+ me();
269
+ const r = C(!1), e = C(!1), c = {
270
+ name: "",
271
+ campaigns: []
272
+ }, s = C(""), l = C({ ...c }), f = se.superRefine((d, t) => {
273
+ }), b = C([]), g = C(null), { global: w, minor: v } = fe, E = G(() => {
274
+ const d = f.safeParse(l.value);
275
+ return d.success ? [] : d.error.errors;
276
+ });
277
+ function L(d) {
278
+ var t;
279
+ 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 });
280
+ }
281
+ function k() {
282
+ r.value = !1, g.value = null;
283
+ }
284
+ function H() {
285
+ e.value = !0;
286
+ }
287
+ async function $() {
288
+ const d = await B.readAll({
289
+ limit: 1e3,
290
+ skip: 0,
291
+ sortBy: "_id",
292
+ search: "",
293
+ descending: !0
294
+ });
295
+ b.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 M = G(() => {
300
+ const d = (y) => y.map((A) => ({
301
+ label: A.name,
302
+ value: A._id
303
+ }));
304
+ return ve(
305
+ b.value,
306
+ (y) => ie.formattedType(y.type),
307
+ d
308
+ );
309
+ }), K = G(() => Object.entries(M.value).reduce(
310
+ (d, [t, y]) => {
311
+ const A = y.filter((j) => {
312
+ var N, x;
313
+ return (x = (N = l.value) == null ? void 0 : N.campaigns) == null ? void 0 : x.includes(j.value);
314
+ }).filter(
315
+ (j) => j.label.toLowerCase().includes(s.value.toLowerCase())
316
+ );
317
+ return A.length > 0 && (d[t] = A), d;
318
+ },
319
+ {}
320
+ ));
321
+ function J(d) {
322
+ var y, A;
323
+ const t = (y = l.value.campaigns) == null ? void 0 : y.indexOf(d);
324
+ t != null && t > -1 && ((A = l.value.campaigns) == null || A.splice(t, 1));
325
+ }
326
+ async function W() {
327
+ f.safeParse(l.value).success && await v(
328
+ async () => {
329
+ var t;
330
+ g.value ? await B.updateGroup(
331
+ (t = g.value) == null ? void 0 : t._id,
332
+ l.value
333
+ ) : await B.createGroup(l.value), u("success"), k();
334
+ },
335
+ {
336
+ message: "Saving group",
337
+ successMessage: "Group saved"
338
+ }
339
+ );
340
+ }
341
+ async function Z() {
342
+ await v(
343
+ async () => {
344
+ var d;
345
+ await B.deleteGroup((d = g.value) == null ? void 0 : d._id), u("success"), k();
346
+ },
347
+ {
348
+ message: "Deleting group",
349
+ successMessage: "Group deleted"
350
+ }
351
+ );
352
+ }
353
+ return D(async () => {
354
+ await $();
355
+ }), R({
356
+ showSheet: L,
357
+ hideSheet: k
358
+ }), (d, t) => {
359
+ const y = S("FmButton"), A = S("FmTextField"), j = S("FmList"), N = S("FmSideSheet");
360
+ return o(), F(N, {
361
+ modelValue: n(r),
362
+ "onUpdate:modelValue": t[7] || (t[7] = (x) => q(r) ? r.value = x : null),
363
+ header: n(g) ? "Edit group" : "Add group",
364
+ "dismiss-away": "",
365
+ "close-button": !0,
366
+ "max-width": 550
367
+ }, Y({
368
+ "side-sheet-footer": O(() => [
369
+ a("div", Ke, [
370
+ n(e) ? T("", !0) : (o(), h(V, { key: 0 }, [
371
+ p(y, {
372
+ label: "Submit",
373
+ onClick: W,
374
+ disabled: n(E).length > 0 || n(_).isLoading
375
+ }, null, 8, ["disabled"]),
376
+ p(y, {
377
+ label: "Cancel",
378
+ onClick: t[4] || (t[4] = (x) => k()),
379
+ variant: "tertiary"
380
+ }),
381
+ n(g) ? (o(), F(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] = (x) => Z())
387
+ })) : T("", !0)
388
+ ], 64)),
389
+ n(e) ? (o(), F(y, {
390
+ key: 1,
391
+ label: "Confirm",
392
+ onClick: t[6] || (t[6] = (x) => e.value = !1)
393
+ })) : T("", !0)
394
+ ])
395
+ ]),
396
+ default: O(() => [
397
+ n(e) ? T("", !0) : (o(), h("div", Le, [
398
+ je,
399
+ p(ce, {
400
+ modelValue: n(l).name,
401
+ "onUpdate:modelValue": t[1] || (t[1] = (x) => n(l).name = x),
402
+ label: "Name",
403
+ schema: n(ue).typeAtPath(n(f), "name")
404
+ }, null, 8, ["modelValue", "schema"]),
405
+ De,
406
+ a("div", Me, [
407
+ a("div", Ne, U(n(l).campaigns.length) + " campaign(s) linked ", 1),
408
+ p(A, {
409
+ modelValue: n(s),
410
+ "onUpdate:modelValue": t[2] || (t[2] = (x) => q(s) ? s.value = x : null),
411
+ "prepend-icon": "search",
412
+ placeholder: "Search",
413
+ class: "w-auto"
414
+ }, null, 8, ["modelValue"])
415
+ ]),
416
+ p(y, {
417
+ variant: "plain",
418
+ icon: "link",
419
+ label: "Link Campaign",
420
+ onClick: H
421
+ })
422
+ ])),
423
+ n(e) ? (o(), F(Ge, {
424
+ key: 1,
425
+ modelValue: n(l).campaigns,
426
+ "onUpdate:modelValue": t[3] || (t[3] = (x) => n(l).campaigns = x),
427
+ campaigns: n(M)
428
+ }, null, 8, ["modelValue", "campaigns"])) : T("", !0),
429
+ a("div", qe, [
430
+ n(e) ? T("", !0) : (o(!0), h(V, { key: 0 }, P(n(K), (x, Q) => (o(), h("div", null, [
431
+ a("div", He, U(Q), 1),
432
+ p(j, { separator: !0 }, {
433
+ default: O(() => [
434
+ (o(!0), h(V, null, P(x, (z) => (o(), h("div", ze, [
435
+ a("div", null, U(z.label), 1),
436
+ a("div", null, [
437
+ p(y, {
438
+ icon: "delete",
439
+ onClick: (st) => J(z.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: O(() => [
455
+ a("div", Ie, [
456
+ p(y, {
457
+ icon: "arrow_back",
458
+ variant: "tertiary",
459
+ onClick: t[0] || (t[0] = (x) => e.value = !1)
460
+ }),
461
+ ee("Link campaign ")
462
+ ])
463
+ ]),
464
+ key: "0"
465
+ } : void 0
466
+ ]), 1032, ["modelValue", "header"]);
467
+ };
468
+ }
469
+ }), We = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Ze = { class: "space-y-16" }, Qe = { class: "flex items-center justify-end" }, Xe = /* @__PURE__ */ a("div", { class: "fm-typo-en-body-lg-600" }, "Connect summary", -1), Ye = { class: "grid grid-cols-4 xs:grid-cols-2 gap-4 divide-x xs:divide-x-0" }, et = { class: "fm-typo-body-md-400 fm-typo-en-body-md-400 mb-2 text-fm-color-typo-secondary" }, tt = { class: "fm-typo-en-title-sm-800" }, at = /* @__PURE__ */ a("img", {
470
+ src: ne,
471
+ class: "w-[150px]"
472
+ }, null, -1), nt = /* @__PURE__ */ a("div", { class: "fm-typo-en-title-sm-800 text-center" }, " Create campaign group to track performance ", -1), lt = /* @__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), ot = { class: "flex gap-16 items-center" }, Ct = /* @__PURE__ */ I({
473
+ __name: "Analytic",
474
+ setup(m) {
475
+ const R = {
476
+ label: "Add group",
477
+ value: "create",
478
+ isPrimary: !0,
479
+ prependIcon: "add"
480
+ }, i = ye(), u = C(), _ = C([]), r = C(""), e = te({
481
+ totalCampaign: 0,
482
+ totalProgram: 0,
483
+ totalMember: 0
484
+ }), c = C("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 l(w) {
499
+ var v;
500
+ c.value = (/* @__PURE__ */ new Date()).toISOString(), (v = u.value) == null || v.showSheet(w);
501
+ }
502
+ async function f() {
503
+ await i.readGroups();
504
+ const w = await B.readAllGrouped({
505
+ limit: 100,
506
+ skip: 0,
507
+ sortBy: "_id",
508
+ search: "",
509
+ descending: !0
510
+ });
511
+ _.value = w.resources;
512
+ }
513
+ async function b() {
514
+ var E, L;
515
+ const w = await _e.read({
516
+ limit: 1,
517
+ skip: 0,
518
+ sortBy: "_id",
519
+ search: "",
520
+ descending: !1
521
+ }), v = await B.readAll({
522
+ limit: 1e3,
523
+ skip: 0,
524
+ sortBy: "_id",
525
+ search: "",
526
+ descending: !1
527
+ });
528
+ e.totalCampaign = ((E = v.resources) == null ? void 0 : E.filter(
529
+ (k) => ["PROMOTION", "VOUCHER", "BROADCAST"].includes(k.type) && !["ISSUE_REWARD"].includes("event" in k ? k == null ? void 0 : k.event.type : "")
530
+ ).length) ?? 0, e.totalProgram = ((L = v.resources) == null ? void 0 : L.filter(
531
+ (k) => ["POINT", "COIN", "CREDIT", "GAME"].includes(k.type)
532
+ ).length) ?? 0, e.totalMember = w.meta.totalResources ?? 0;
533
+ }
534
+ const g = G(() => _.value.filter((w) => {
535
+ var v;
536
+ return w.name.includes(r.value) || ((v = w.pf_campaigns) == null ? void 0 : v.filter((E) => E.name.includes(r.value)).length);
537
+ }));
538
+ return D(async () => {
539
+ await f(), await b();
540
+ }), (w, v) => {
541
+ const E = S("FmPageHead"), L = S("FmSearch"), k = S("FmCard"), H = S("FmButton");
542
+ return o(), h(V, null, [
543
+ p(E, {
544
+ title: "Analytic",
545
+ actions: n(_).length > 0 ? [R] : [],
546
+ "onClick:action": v[0] || (v[0] = ($) => l())
547
+ }, null, 8, ["actions"]),
548
+ a("div", We, [
549
+ a("div", Ze, [
550
+ a("div", Qe, [
551
+ p(L, {
552
+ class: "xs:hidden",
553
+ modelValue: n(r),
554
+ "onUpdate:modelValue": v[1] || (v[1] = ($) => q(r) ? r.value = $ : null),
555
+ placeholder: "Search Table",
556
+ collapsible: ""
557
+ }, null, 8, ["modelValue"])
558
+ ]),
559
+ p(k, {
560
+ variant: "outlined",
561
+ class: "flex flex-col gap-16 p-16"
562
+ }, {
563
+ default: O(() => [
564
+ Xe,
565
+ a("div", Ye, [
566
+ (o(), h(V, null, P(s, ($, M) => a("div", {
567
+ key: $.key,
568
+ class: ae(["px-8", { "xs:!border-r": M % 2 == 0 }])
569
+ }, [
570
+ a("div", et, U($.key), 1),
571
+ a("div", tt, U($.value()), 1)
572
+ ], 2)), 64))
573
+ ])
574
+ ]),
575
+ _: 1
576
+ })
577
+ ]),
578
+ n(_).length ? T("", !0) : (o(), F(k, {
579
+ key: 0,
580
+ variant: "outlined",
581
+ class: "flex flex-col gap-y-24 items-center p-16"
582
+ }, {
583
+ default: O(() => [
584
+ at,
585
+ nt,
586
+ lt,
587
+ a("div", ot, [
588
+ p(H, {
589
+ label: "Create group",
590
+ icon: "add",
591
+ onClick: v[2] || (v[2] = ($) => l())
592
+ })
593
+ ])
594
+ ]),
595
+ _: 1
596
+ })),
597
+ (o(!0), h(V, null, P(n(g), ($) => (o(), F(Ae, {
598
+ key: $._id.toString(),
599
+ group: $,
600
+ "on-edit": l
601
+ }, null, 8, ["group"]))), 128)),
602
+ p(Je, {
603
+ ref_key: "sheetRef",
604
+ ref: u,
605
+ onSuccess: f
606
+ }, null, 512)
607
+ ])
608
+ ], 64);
609
+ };
610
+ }
611
+ });
612
+ export {
613
+ Ct as default
614
+ };