@feedmepos/mf-connect 0.1.0-beta.3 → 0.1.0-beta.31

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 (99) hide show
  1. package/dist/Analytic-C-QC9ivZ.js +424 -0
  2. package/dist/{App-gzbM97vW.js → App-NASVRSh2.js} +397 -384
  3. package/dist/{Broadcast-BwYZkTs0.js → Broadcast-Cffg7nbY.js} +32 -32
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DIh9rz6T.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CA4kVwMl.js} +8 -8
  5. package/dist/Card-CmYFb1_Y.js +897 -0
  6. package/dist/{Collections-Df6tlo8S.js → Collections-CibvGIpU.js} +4 -4
  7. package/dist/{Credit-BPel8vA9.js → Credit-Ck6i9ySs.js} +14 -14
  8. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +108 -0
  9. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-B35zbHHI.js +2198 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BT8ucS5G.js → EffectSheet.vue_vue_type_style_index_0_lang-CQV77_cx.js} +8 -8
  11. package/dist/{Experience-CPpz1Zwx.js → Experience-CWUX2QvS.js} +8 -8
  12. package/dist/{Game-ByLblISC.js → Game-D3cdZrlc.js} +15 -15
  13. package/dist/Index-CWLZiYXT.js +255 -0
  14. package/dist/Marketing-Bol8eY5d.js +20070 -0
  15. package/dist/{Member-CCc_FEZY.js → Member-Cso-T2Xk.js} +4 -4
  16. package/dist/MemberList-Bqns9wko.js +1045 -0
  17. package/dist/{MemberTransactions-DD5ahSbY.js → MemberTransactions-zNw-30Xu.js} +1 -1
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DSPvWk4C.js → MessageInput.vue_vue_type_script_setup_true_lang-BLS5fNr6.js} +2 -2
  19. package/dist/{Mission-VH4057I-.js → Mission-C0-K0A_5.js} +98 -86
  20. package/dist/Overview-fZ9NvFKz.js +1024 -0
  21. package/dist/{Point-Bu3IlpH4.js → Point-D3gGhQlP.js} +23 -23
  22. package/dist/{Promotion-B45AOHis.js → Promotion-COCJIfu-.js} +53 -47
  23. package/dist/Record-C0a4Cn1U.js +209 -0
  24. package/dist/Reward-D0G4CBYd.js +411 -0
  25. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-zSOwxAcS.js +151 -0
  26. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-AmIdaAeX.js +1639 -0
  27. package/dist/Segment-eBM3aveX.js +567 -0
  28. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BgMuKAjE.js +181 -0
  29. package/dist/{Setting-CF09eRQJ.js → Setting-Dfye6fs5.js} +8 -8
  30. package/dist/Store-rQfwc8d6.js +1745 -0
  31. package/dist/{StoreRewards-0iGExjqQ.js → StoreRewards-DVTNMWdG.js} +12 -12
  32. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-3dvBoXz2.js +957 -0
  33. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BEfxin47.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DxGIUrmO.js} +1 -1
  34. package/dist/{Tier-IaeWe7rM.js → Tier-DekrYu5l.js} +327 -317
  35. package/dist/{Title-DD67Zxh5.js → Title-oAWsBqoM.js} +199 -183
  36. package/dist/{Transaction-BsPDnLzB.js → Transaction-Ss2XCksi.js} +2 -2
  37. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-BMIqnBts.js +130 -0
  38. package/dist/{Voucher-M7JfcKo0.js → Voucher-CjPJxdw8.js} +31 -31
  39. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DlWCpoOp.js +419 -0
  40. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-k0lprU2i.js → ZodTextField.vue_vue_type_script_setup_true_lang-FXQNhMrv.js} +1 -1
  41. package/dist/{app-HFICF0vL.js → app-C_zlbFNe.js} +1285 -1283
  42. package/dist/{app-DwujUNP-.js → app-WUJQRyEM.js} +1 -1
  43. package/dist/app.js +1 -1
  44. package/dist/{business-BaF1QJXa.js → business-C0e_E2xp.js} +1 -1
  45. package/dist/{campaign-CTDtmAE9.js → campaign-iWzbtNA5.js} +2 -2
  46. package/dist/collectible.enum-QITAo8Jg.js +19 -0
  47. package/dist/{collection.fn-DMW03W4R.js → collection.fn-R3hvasuZ.js} +2 -2
  48. package/dist/{dto-gpaNZHzQ.js → dto-D_tjJ72q.js} +78 -86
  49. package/dist/{effect-CBUmtwet.js → effect-_bpW5fmr.js} +9 -9
  50. package/dist/email-addresses-DUKn8uD0.js +705 -0
  51. package/dist/{export-Bdh_PbsW.js → export-CEBWZ8ko.js} +3 -3
  52. package/dist/{helper-Cu9elRvl.js → helper-CuF45pbY.js} +1 -1
  53. package/dist/{index-NXiDu42U.js → index-BO8RnVxy.js} +1 -1
  54. package/dist/{index-CArqG03W.js → index-BPc3wxOE.js} +39 -35
  55. package/dist/index-BXTQ6onZ.js +1067 -0
  56. package/dist/index-C4aPU80a.js +38 -0
  57. package/dist/{index-At6yms5t.js → index-CBzSPD25.js} +30 -26
  58. package/dist/{index-Ch6XwPzF.js → index-CR0ZVZQG.js} +1 -1
  59. package/dist/{index-DrGrOgZB.js → index-CXFwMV0s.js} +13 -1
  60. package/dist/index-CsaQJMAR.js +66 -0
  61. package/dist/{index-Dfdg2Q3E.js → index-Dh6xIUXJ.js} +1 -1
  62. package/dist/{index-ogzk-Mj4.js → index-LMvyNoHf.js} +1 -1
  63. package/dist/{index-Crw-Vgo5.js → index-S6sFiBxK.js} +1500 -1479
  64. package/dist/index-SpDFfOz_.js +54 -0
  65. package/dist/{index-CtH2S49l.js → index-Urbp7cdO.js} +203 -195
  66. package/dist/index-pHbs1GrF.js +29000 -0
  67. package/dist/{index.esm2017-CeJpvUbA.js → index.esm2017-BunOalUj.js} +33 -33
  68. package/dist/{loading-Cn8ml_vy.js → loading-CYFsZ9UB.js} +591 -597
  69. package/dist/{membership-CX4AKMlH.js → membership-C9089j0H.js} +51 -43
  70. package/dist/money-D-zGFohv.js +15 -0
  71. package/dist/number-UFl4zW6h.js +12 -0
  72. package/dist/objectid-BKIyQ5iE.js +145 -0
  73. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  74. package/dist/reward-LYKGLzXz.js +36 -0
  75. package/dist/{rule-Cv83Y59R.js → rule-BUUKmR4_.js} +180 -177
  76. package/dist/{rule-builder-Dew4yB5Q.js → rule-builder-9JUuOcMH.js} +1 -1
  77. package/dist/style.css +1 -1
  78. package/dist/{template-CSnbgM1o.js → template-CkXuF0cN.js} +5 -5
  79. package/dist/trigger-DjAx9efN.js +114 -0
  80. package/dist/user-DbsZta3D.js +54 -0
  81. package/dist/{vue-i18n-CNH_IhVd.js → vue-i18n-yYO72Mbp.js} +2 -2
  82. package/dist/{xlsx-D4DUZHix.js → xlsx-Dagi6ArS.js} +1 -1
  83. package/package.json +8 -7
  84. package/dist/Analytic-BC5BA6pN.js +0 -622
  85. package/dist/Card-CBYQGKwY.js +0 -825
  86. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-PsrS7I0r.js +0 -2809
  87. package/dist/Marketing-D0vm80e_.js +0 -316
  88. package/dist/MemberList-CrnipE9y.js +0 -1733
  89. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Ijc2OYh9.js +0 -1753
  90. package/dist/Segment-ZWsp48aC.js +0 -437
  91. package/dist/Store-B_G6Dhmq.js +0 -1511
  92. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CaxUr9zl.js +0 -890
  93. package/dist/index-8MaN7rez.js +0 -762
  94. package/dist/index-BjdHxGDn.js +0 -298
  95. package/dist/index-CuvNtC_M.js +0 -61
  96. package/dist/index-RP0XOPRL.js +0 -29193
  97. package/dist/money-BTejgvKu.js +0 -15
  98. package/dist/number-Cen5TucC.js +0 -12
  99. package/dist/user-Bm4KttFq.js +0 -37
@@ -1,622 +0,0 @@
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-Cen5TucC.js";
4
- import { C as ie, F as re, a as ce } from "./dto-gpaNZHzQ.js";
5
- import { useRouter as W } from "vue-router";
6
- import { c as L } from "./index-NXiDu42U.js";
7
- import { _ as ue } from "./ZodTextField.vue_vue_type_script_setup_true_lang-k0lprU2i.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-Cn8ml_vy.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-CTDtmAE9.js";
15
- import { u as _e } from "./membership-CX4AKMlH.js";
16
- import { u as be } from "./vue-i18n-CNH_IhVd.js";
17
- import { m as he } from "./index-Ch6XwPzF.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
- };