@feedmepos/mf-connect 0.1.0-beta.8 → 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-SRz4257n.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-CZXSxA9u.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-Cuklmxur.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-BwT3zE2a.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-BkFm7tXq.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-BqpsMcl1.js → StoreTransactions.vue_vue_type_script_setup_true_lang-RTfozD01.js} +10 -10
  29. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DrzmjYmU.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BGI78ycg.js} +1 -1
  30. package/dist/{Tier-CJ9-d8Zg.js → Tier-BnQRujpX.js} +453 -481
  31. package/dist/{Title-DZCpvg4q.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-Cg2pTZJK.js → app-DHE61XdR.js} +1 -1
  37. package/dist/app.js +3 -5
  38. package/dist/{business-Cw_qGw8y.js → business-BSo7EPan.js} +1 -1
  39. package/dist/{campaign-winsqufa.js → campaign-CsOje3Ap.js} +3 -5
  40. package/dist/{collection.fn-CI5Llblg.js → collection.fn-BYQfFJOr.js} +2 -2
  41. package/dist/dto-CfEXSCq6.js +1145 -0
  42. package/dist/{effect-CdkrIYgX.js → effect-Bn_ofYS3.js} +9 -9
  43. package/dist/{export-DGxfief1.js → export-CMR243CF.js} +3 -3
  44. package/dist/{helper-B8RqcTNu.js → helper-BqOQRtvW.js} +1 -1
  45. package/dist/index-BLDYTxnc.js +28058 -0
  46. package/dist/{index-Cw_aXFH6.js → index-BWnFs-Cb.js} +281 -299
  47. package/dist/{index-wzdbEEcZ.js → index-BaBNmzUb.js} +1 -1
  48. package/dist/{index-CjVmULNd.js → index-Boo5np6l.js} +1 -1
  49. package/dist/{index-HZC9LLAX.js → index-CC1GV8OW.js} +1 -1
  50. package/dist/{index-OzicErwL.js → index-CHO4_zsT.js} +1 -1
  51. package/dist/{index-DAEmawcj.js → index-DEZsrQ2f.js} +3 -3
  52. package/dist/{index-9w43_U1v.js → index-D_f2lmK2.js} +1 -1
  53. package/dist/{index-BaozRfWB.js → index-Da142OER.js} +66 -78
  54. package/dist/index-DbP04yeg.js +11 -0
  55. package/dist/{index-A34xEz20.js → index-DtPe-TEm.js} +3 -3
  56. package/dist/{index-BLACZ3-L.js → index-FvlaxwGB.js} +20 -20
  57. package/dist/{index.esm2017-CppSMh_U.js → index.esm2017-ePm--Atp.js} +55 -55
  58. package/dist/{loading-DuEFUCwF.js → loading-KNmEMBUB.js} +460 -469
  59. package/dist/{membership-nsMtWeTC.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-CPIMqt1h.js → rule-CzamI50_.js} +2 -2
  63. package/dist/{rule-builder-CSs5XRKP.js → rule-builder-DHf6wfaQ.js} +1 -1
  64. package/dist/style.css +1 -1
  65. package/dist/{template-CJZoYavu.js → template-CFAIPoD7.js} +63 -63
  66. package/dist/{usePagination-BeF5K3M7.js → usePagination-JoYaROkV.js} +85 -85
  67. package/dist/{xlsx-BZlnYinX.js → xlsx-BDJMaozs.js} +517 -517
  68. package/package.json +4 -7
  69. package/dist/Analytic-5QztrYSp.js +0 -622
  70. package/dist/Broadcast-DmkrJGp2.js +0 -223
  71. package/dist/Card-BsjFTVsH.js +0 -825
  72. package/dist/Collections-7wqZHOax.js +0 -453
  73. package/dist/Credit-CcNrq9qk.js +0 -220
  74. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BIZDiLns.js +0 -345
  75. package/dist/Experience-DNsQLzDH.js +0 -221
  76. package/dist/Game-DlzDerT7.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-BqhpaG4o.js +0 -316
  80. package/dist/Member-AFgZcdtz.js +0 -69
  81. package/dist/MemberList-BKgrLz2C.js +0 -1733
  82. package/dist/MemberOverview-wL_ailso.js +0 -58
  83. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-GCEQCVOt.js +0 -432
  84. package/dist/Mission-BTAia7AS.js +0 -261
  85. package/dist/Point-Ck8EG_3k.js +0 -222
  86. package/dist/Promotion-0v3kvsK3.js +0 -247
  87. package/dist/Segment-BenLupqV.js +0 -437
  88. package/dist/Setting-0fpREqpJ.js +0 -1901
  89. package/dist/Store-BDGwe4ar.js +0 -1511
  90. package/dist/StoreRewards-TDZt9H1V.js +0 -401
  91. package/dist/Transaction-DpnTxlbf.js +0 -39
  92. package/dist/Voucher-DsP_rh8I.js +0 -490
  93. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-SukfoJpU.js +0 -56
  94. package/dist/app-DzAexOqx.js +0 -5639
  95. package/dist/dto-ozu1smC3.js +0 -2770
  96. package/dist/index-CZgQVRsm.js +0 -3
  97. package/dist/index-Oxr-mU6h.js +0 -29193
  98. package/dist/money-BGZPFtUc.js +0 -15
  99. package/dist/number-4J0xvXP9.js +0 -12
  100. package/dist/vue-i18n-CCyiVzOE.js +0 -2365
  101. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -0,0 +1,441 @@
1
+ var ee = Object.defineProperty;
2
+ var oe = (f, r, d) => r in f ? ee(f, r, { enumerable: !0, configurable: !0, writable: !0, value: d }) : f[r] = d;
3
+ var z = (f, r, d) => oe(f, typeof r != "symbol" ? r + "" : r, d);
4
+ import { defineComponent as G, ref as p, computed as H, watch as O, resolveComponent as u, openBlock as y, createBlock as L, unref as e, isRef as K, withCtx as I, createElementVNode as b, createVNode as s, createElementBlock as P, Fragment as R, renderList as te, createCommentVNode as U, onMounted as ae, h as T } from "vue";
5
+ import { h as j } from "./moment-BWErdI6_.js";
6
+ import { components as le } from "@feedmepos/ui-library";
7
+ import { u as J, a as ne } from "./loading-KNmEMBUB.js";
8
+ import { J as se } from "./JsonViewer-v8_C7l5N.js";
9
+ import { u as re } from "./app-wDQR6dpb.js";
10
+ import { useRoute as Q, useRouter as ie } from "vue-router";
11
+ import { c as N } from "./index-Boo5np6l.js";
12
+ import { u as Y, w as ue } from "./xlsx-BDJMaozs.js";
13
+ import { g as de } from "./user-Bm4KttFq.js";
14
+ import { u as ce, _ as me } from "./usePagination-JoYaROkV.js";
15
+ import { m as pe } from "./index-CC1GV8OW.js";
16
+ import { o as fe } from "./objectId-dwaoBfJX.js";
17
+ const ge = /* @__PURE__ */ b("div", { class: "fm-typo-en-body-lg-600" }, "Code type", -1), be = { class: "space-y-16" }, Ce = /* @__PURE__ */ b("div", { class: "fm-typo-en-body-lg-600" }, "Settings", -1), ve = { class: "gap-16 grid grid-cols-2" }, he = { class: "flex items-center gap-8" }, ye = /* @__PURE__ */ G({
18
+ __name: "CreateCollectionSheet",
19
+ emits: ["success"],
20
+ setup(f, { expose: r, emit: d }) {
21
+ const { minor: S } = J, F = Q(), k = p(), _ = p(!1), E = d, g = p(!1);
22
+ function q(l) {
23
+ g.value = l, l && (a.value = {
24
+ quantity: 1,
25
+ code: "",
26
+ codeConfig: {
27
+ length: 8,
28
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
29
+ prefix: "",
30
+ suffix: "",
31
+ pattern: "########"
32
+ }
33
+ });
34
+ }
35
+ const a = p({
36
+ quantity: 1,
37
+ code: "",
38
+ codeConfig: {
39
+ length: 8,
40
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
41
+ prefix: "",
42
+ suffix: "",
43
+ pattern: "########"
44
+ }
45
+ }), A = [
46
+ {
47
+ label: "Bulk codes",
48
+ value: "bulk",
49
+ sublabel: "Bulk generate unique codes"
50
+ },
51
+ {
52
+ label: "Custom code",
53
+ value: "single",
54
+ sublabel: "Enter your own custom codes"
55
+ }
56
+ ], B = [
57
+ {
58
+ label: "Alphanumeric",
59
+ value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
60
+ },
61
+ {
62
+ label: "Alphabetic",
63
+ value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
64
+ },
65
+ { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
66
+ { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
67
+ { label: "Numbers", value: "0123456789" },
68
+ { label: "Custom", value: "" }
69
+ ], C = p(B[0].value), c = p("bulk"), x = p(!1), D = H(() => F.params.id);
70
+ async function n(l) {
71
+ var o;
72
+ await ((o = k.value) == null ? void 0 : o.validateInputs()), _.value && await S(
73
+ async () => {
74
+ await N.createCollectionByCampaignId(D.value, l), await E("success");
75
+ },
76
+ {
77
+ message: "Creating claim(s)",
78
+ successMessage: "Claim(s) created"
79
+ }
80
+ );
81
+ }
82
+ return r({
83
+ showSheet: q
84
+ }), O(
85
+ () => c.value,
86
+ (l, o) => {
87
+ o != l && (a.value.code = "", a.value.codeConfig.length = 8, a.value.codeConfig.charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", a.value.codeConfig.prefix = "", a.value.codeConfig.suffix = "", a.value.codeConfig.pattern = "########");
88
+ }
89
+ ), O(
90
+ () => a.value.codeConfig.length,
91
+ (l, o) => {
92
+ l != o && (a.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(l))));
93
+ }
94
+ ), (l, o) => {
95
+ const v = u("FmRadio"), i = u("FmRadioGroup"), V = u("FmSwitch"), M = u("FmStepperField"), w = u("FmSelect"), h = u("FmTextField"), W = u("FmTextarea"), X = u("FmForm"), $ = u("FmButton"), Z = u("FmSideSheet");
96
+ return y(), L(Z, {
97
+ "max-width": 560,
98
+ "dismiss-away": !0,
99
+ header: "Create collection",
100
+ modelValue: e(g),
101
+ "onUpdate:modelValue": [
102
+ o[14] || (o[14] = (t) => K(g) ? g.value = t : null),
103
+ o[15] || (o[15] = (t) => g.value = t)
104
+ ]
105
+ }, {
106
+ "side-sheet-footer": I(() => [
107
+ b("div", he, [
108
+ s($, {
109
+ label: "Save",
110
+ onClick: o[12] || (o[12] = (t) => n(e(a))),
111
+ loading: e(re)().isLoading
112
+ }, null, 8, ["loading"]),
113
+ s($, {
114
+ label: "Cancel",
115
+ type: "button",
116
+ variant: "tertiary",
117
+ onClick: o[13] || (o[13] = (t) => g.value = !1)
118
+ })
119
+ ])
120
+ ]),
121
+ default: I(() => [
122
+ s(se, { json: e(a) }, null, 8, ["json"]),
123
+ s(X, {
124
+ ref_key: "form",
125
+ ref: k,
126
+ class: "space-y-40",
127
+ onValidationSuccess: o[10] || (o[10] = (t) => _.value = !0),
128
+ onValidationFailed: o[11] || (o[11] = (t) => _.value = !1)
129
+ }, {
130
+ default: I(() => [
131
+ b("div", null, [
132
+ ge,
133
+ s(i, {
134
+ modelValue: e(c),
135
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => K(c) ? c.value = t : null),
136
+ inline: !1
137
+ }, {
138
+ default: I(() => [
139
+ (y(), P(R, null, te(A, (t) => s(v, {
140
+ key: t.value,
141
+ value: t.value,
142
+ label: t.label,
143
+ sublabel: t.sublabel
144
+ }, null, 8, ["value", "label", "sublabel"])), 64))
145
+ ]),
146
+ _: 1
147
+ }, 8, ["modelValue"])
148
+ ]),
149
+ b("div", be, [
150
+ Ce,
151
+ e(c) === "bulk" ? (y(), P(R, { key: 0 }, [
152
+ s(V, {
153
+ "model-value": e(x),
154
+ "label-placement": "right",
155
+ value: "true",
156
+ label: "Advance code setting",
157
+ required: !0,
158
+ "onUpdate:modelValue": o[1] || (o[1] = () => x.value = !e(x))
159
+ }, null, 8, ["model-value"]),
160
+ e(x) ? (y(), P(R, { key: 0 }, [
161
+ s(M, {
162
+ modelValue: e(a).codeConfig.length,
163
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => e(a).codeConfig.length = t),
164
+ label: "Code length",
165
+ max: 16,
166
+ min: 1,
167
+ rules: [
168
+ (t) => Number(t) >= 1 || "Code length must at least 1",
169
+ (t) => Number(t) <= 16 || "Code length must less than 16"
170
+ ],
171
+ required: !0
172
+ }, null, 8, ["modelValue", "rules"]),
173
+ s(w, {
174
+ label: "Charset",
175
+ "model-value": e(C),
176
+ items: B,
177
+ "helper-text": e(a).codeConfig.charset.length > 62 ? `${e(a).codeConfig.charset.substring(0, 62)}...` : e(a).codeConfig.charset,
178
+ "onUpdate:modelValue": o[3] || (o[3] = (t) => {
179
+ C.value = t, e(a).codeConfig.charset = t;
180
+ })
181
+ }, null, 8, ["model-value", "helper-text"]),
182
+ e(C) === "" ? (y(), L(h, {
183
+ key: 0,
184
+ modelValue: e(a).codeConfig.charset,
185
+ "onUpdate:modelValue": o[4] || (o[4] = (t) => e(a).codeConfig.charset = t),
186
+ label: "Custom Charset",
187
+ required: ""
188
+ }, null, 8, ["modelValue"])) : U("", !0),
189
+ b("div", ve, [
190
+ s(h, {
191
+ modelValue: e(a).codeConfig.prefix,
192
+ "onUpdate:modelValue": o[5] || (o[5] = (t) => e(a).codeConfig.prefix = t),
193
+ label: "Prefix (Optional)"
194
+ }, null, 8, ["modelValue"]),
195
+ s(h, {
196
+ modelValue: e(a).codeConfig.suffix,
197
+ "onUpdate:modelValue": o[6] || (o[6] = (t) => e(a).codeConfig.suffix = t),
198
+ label: "Suffix (Optional)"
199
+ }, null, 8, ["modelValue"])
200
+ ]),
201
+ s(h, {
202
+ modelValue: e(a).codeConfig.pattern,
203
+ "onUpdate:modelValue": o[7] || (o[7] = (t) => e(a).codeConfig.pattern = t),
204
+ label: "Pattern",
205
+ required: !0
206
+ }, null, 8, ["modelValue"])
207
+ ], 64)) : U("", !0),
208
+ s(h, {
209
+ modelValue: e(a).quantity,
210
+ "onUpdate:modelValue": o[8] || (o[8] = (t) => e(a).quantity = t),
211
+ label: "Number of code",
212
+ rules: [
213
+ (t) => t >= 1 || "Quantity cannot be less than 1",
214
+ (t) => t <= 1e4 || "Quantity cannot more than 10,000"
215
+ ],
216
+ required: !0,
217
+ "helper-text": `${e(a).quantity} claim will be created`
218
+ }, null, 8, ["modelValue", "rules", "helper-text"])
219
+ ], 64)) : U("", !0),
220
+ e(c) !== "bulk" ? (y(), L(W, {
221
+ key: 1,
222
+ modelValue: e(a).code,
223
+ "onUpdate:modelValue": o[9] || (o[9] = (t) => e(a).code = t),
224
+ label: "Custom Code",
225
+ rules: [(t) => e(c) != "single" || !!t || "Custom code is required"],
226
+ placeholder: "(For multiple codes, please enter in the new row.)"
227
+ }, null, 8, ["modelValue", "rules"])) : U("", !0)
228
+ ])
229
+ ]),
230
+ _: 1
231
+ }, 512)
232
+ ]),
233
+ _: 1
234
+ }, 8, ["modelValue"]);
235
+ };
236
+ }
237
+ });
238
+ class xe {
239
+ constructor() {
240
+ z(this, "data", []);
241
+ }
242
+ addRecord(r) {
243
+ this.data.push(r);
244
+ }
245
+ buildExcel() {
246
+ const r = Y.book_new(), d = Y.json_to_sheet(this.data);
247
+ return Y.book_append_sheet(r, d, "Collection"), r;
248
+ }
249
+ }
250
+ const m = {
251
+ sortBy: "_id",
252
+ descending: !1,
253
+ rowsPerPage: 1e3,
254
+ page: 1,
255
+ rowsNumber: 0
256
+ }, Ve = { class: "px-24 flex flex-col gap-y-32 pb-24" }, we = { class: "flex items-center justify-end py-4 xs:hidden" }, Me = /* @__PURE__ */ G({
257
+ __name: "Collections",
258
+ setup(f) {
259
+ const r = ie(), d = Q(), S = p(), F = H(() => d.params.id), k = p(!1), { custom: _ } = J, E = [
260
+ {
261
+ header: "ID/Code",
262
+ accessorKey: "_id",
263
+ cell(n) {
264
+ return T("div", { class: "flex items-center" }, [
265
+ T(le.FmIcon, {
266
+ name: "content_copy",
267
+ outline: !0,
268
+ size: "sm",
269
+ class: "cursor-pointer mr-4",
270
+ onClick: (l) => {
271
+ l.preventDefault(), l.stopPropagation(), ne(
272
+ n.row.original.code || n.row.original._id.toString()
273
+ );
274
+ }
275
+ }),
276
+ T(
277
+ "div",
278
+ { class: "pr-2 text-ellipsis overflow-hidden" },
279
+ n.row.original.code || n.row.original._id.toString()
280
+ )
281
+ ]);
282
+ }
283
+ },
284
+ {
285
+ header: "User",
286
+ accessorKey: "user",
287
+ enableSorting: !1,
288
+ cell(n) {
289
+ const l = n.row.original.pf_user;
290
+ return de(l);
291
+ }
292
+ },
293
+ {
294
+ header: "Phone",
295
+ accessorFn: (n) => {
296
+ var l;
297
+ return ((l = n.pf_user) == null ? void 0 : l.phoneNumber) || "-";
298
+ },
299
+ accessorKey: "pf_user.phoneNumber"
300
+ },
301
+ {
302
+ header: "Balance",
303
+ accessorKey: "balance"
304
+ },
305
+ {
306
+ header: "Created at",
307
+ accessorKey: "_id",
308
+ accessorFn: (n) => j(fe(n._id.toString())).format("DD MMM YYYY")
309
+ },
310
+ {
311
+ header: "Nearest expired at",
312
+ accessorKey: "expiryBalance",
313
+ accessorFn: (n) => {
314
+ var l;
315
+ return n.expiryBalance && n.expiryBalance.length ? j((l = n.expiryBalance) == null ? void 0 : l[0].expiredAt).format("DD MMM YYYY") : "Never expires";
316
+ }
317
+ }
318
+ ], g = {
319
+ "$connect-STORE_REWARD_COLLECTIONS": pe.readCollectionsByRewardId,
320
+ "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": N.readCollectionsByCampaignId
321
+ }, q = (n) => {
322
+ const l = g[d.name];
323
+ return (o) => l(n, o);
324
+ }, { tableMeta: a, rowData: A, onSort: B, debouncedFetchData: C, onSearch: c } = ce(q(F.value));
325
+ async function x() {
326
+ var n;
327
+ await C(), (n = S.value) == null || n.showSheet(!1);
328
+ }
329
+ async function D() {
330
+ k.value || _(
331
+ async () => {
332
+ var v;
333
+ const n = new xe(), l = (await N.readCollectionsByCampaignId(F.value, {
334
+ limit: 1,
335
+ skip: 0,
336
+ sortBy: m.sortBy,
337
+ descending: m.descending
338
+ })).meta.totalResources ?? 0, o = m.rowsPerPage;
339
+ for (let i = 0; i < l; i += o) {
340
+ const V = {
341
+ ...m,
342
+ limit: o,
343
+ skip: (m.page - 1) * m.rowsPerPage,
344
+ sortBy: m.sortBy,
345
+ descending: m.descending
346
+ }, M = await N.readCollectionsByCampaignId(
347
+ F.value,
348
+ V
349
+ );
350
+ for await (const w of M.resources) {
351
+ const h = {
352
+ Id: (w == null ? void 0 : w.code) || ((v = w._id) == null ? void 0 : v.toString()) || ""
353
+ };
354
+ n.addRecord(h);
355
+ }
356
+ m.page++;
357
+ }
358
+ await ue(
359
+ n.buildExcel(),
360
+ `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
361
+ {
362
+ bookType: "xlsx",
363
+ bookSST: !1,
364
+ type: "array"
365
+ }
366
+ ), m.page = 1;
367
+ },
368
+ {
369
+ isLoading: k
370
+ }
371
+ );
372
+ }
373
+ return ae(async () => {
374
+ await C();
375
+ }), (n, l) => {
376
+ const o = u("FmPageHead"), v = u("FmSearch");
377
+ return y(), P(R, null, [
378
+ s(o, {
379
+ title: "Collections",
380
+ "back-button": !0,
381
+ actions: [
382
+ { label: "Export", value: "export", isPrimary: !1 },
383
+ {
384
+ label: "Create collection",
385
+ value: "create",
386
+ isPrimary: !0
387
+ }
388
+ ],
389
+ "onClick:back": l[0] || (l[0] = (i) => e(r).back()),
390
+ "onClick:action": l[1] || (l[1] = (i) => {
391
+ var V;
392
+ i === "create" && ((V = e(S)) == null || V.showSheet(!0)), i === "export" && D();
393
+ })
394
+ }),
395
+ b("div", Ve, [
396
+ s(v, {
397
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
398
+ modelValue: e(a).searchValue,
399
+ "onUpdate:modelValue": [
400
+ l[2] || (l[2] = (i) => e(a).searchValue = i),
401
+ e(c)
402
+ ],
403
+ placeholder: "Search",
404
+ collapsible: ""
405
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
406
+ b("div", we, [
407
+ s(v, {
408
+ modelValue: e(a).searchValue,
409
+ "onUpdate:modelValue": [
410
+ l[3] || (l[3] = (i) => e(a).searchValue = i),
411
+ e(c)
412
+ ],
413
+ placeholder: "Search",
414
+ collapsible: ""
415
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
416
+ ]),
417
+ s(me, {
418
+ loading: e(a).isLoading,
419
+ "row-data": e(A),
420
+ "column-defs": E,
421
+ "row-count": e(a).totalRows,
422
+ "page-count": e(a).pageCount,
423
+ "page-index": e(a).pageIndex,
424
+ "page-size": e(a).pageSize,
425
+ "shrink-at": !1,
426
+ onSortChange: e(B),
427
+ onPageChange: l[4] || (l[4] = (i) => e(C)({ pageSize: i.pageSize, pageIndex: i.pageIndex }))
428
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
429
+ s(ye, {
430
+ ref_key: "sheetRef",
431
+ ref: S,
432
+ onSuccess: x
433
+ }, null, 512)
434
+ ])
435
+ ], 64);
436
+ };
437
+ }
438
+ });
439
+ export {
440
+ Me as default
441
+ };
@@ -0,0 +1,214 @@
1
+ import { defineComponent as U, ref as k, computed as A, onMounted as N, resolveComponent as i, openBlock as l, createElementBlock as f, Fragment as g, createVNode as r, unref as o, createElementVNode as s, withCtx as h, renderList as j, createBlock as C, resolveDynamicComponent as M, toDisplayString as y, createCommentVNode as H, h as q } from "vue";
2
+ import { _ as z } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as G, components as J } from "@feedmepos/ui-library";
4
+ import { u as O, p as Q } from "./loading-KNmEMBUB.js";
5
+ import { u as W } from "./business-BSo7EPan.js";
6
+ import { u as X } from "./campaign-CsOje3Ap.js";
7
+ import { g as S, b as V } from "./dto-CfEXSCq6.js";
8
+ import { _ as Y } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
9
+ import { _ as Z } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-we7ADwFk.js";
10
+ import { u as ee } from "./template-CFAIPoD7.js";
11
+ import { c as _ } from "./index-Boo5np6l.js";
12
+ const te = { class: "px-24 flex flex-col gap-y-16" }, oe = { class: "flex items-center justify-between w-full" }, ae = { class: "flex gap-8 overflow-x-auto" }, se = { class: "space-y-8" }, ne = { class: "flex w-full gap-4 items-center" }, re = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ie = { class: "space-y-4" }, le = { class: "fm-typo-en-body-lg-600" }, ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, de = { key: 0 }, ue = /* @__PURE__ */ s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600" }, " No results found ", -1), pe = [
13
+ ue
14
+ ], fe = /* @__PURE__ */ s("img", {
15
+ src: z,
16
+ class: "aspect-square w-[150px]"
17
+ }, null, -1), ye = /* @__PURE__ */ s("div", { class: "flex flex-col gap-16 text-center" }, [
18
+ /* @__PURE__ */ s("div", { class: "fm-typo-en-title-sm-800" }, "Create your credit program"),
19
+ /* @__PURE__ */ s("div", { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, " Credits are virtual money that customers can use to pay for their purchases, similar to cash within your store. ")
20
+ ], -1), Re = /* @__PURE__ */ U({
21
+ __name: "Credit",
22
+ setup(_e) {
23
+ const R = {
24
+ label: "Create program",
25
+ value: "create",
26
+ isPrimary: !0,
27
+ prependIcon: "add"
28
+ }, L = ee("CREDIT", G()), I = W(), c = X(), { global: B, minor: w } = O, n = k({
29
+ searchKey: "",
30
+ location: null
31
+ }), m = A(
32
+ () => c.campaigns.credit.filter(
33
+ (e) => !n.value.location || !e.targetLocation || e.targetLocation.includes(n.value.location)
34
+ )
35
+ ), D = [
36
+ {
37
+ header: "Program title",
38
+ accessorFn: (e) => e.name
39
+ },
40
+ {
41
+ header: "Status",
42
+ cell(e) {
43
+ return S(e.row.original);
44
+ }
45
+ },
46
+ {
47
+ header: "Summary",
48
+ accessorFn: (e) => V(e)
49
+ //v.effect,
50
+ },
51
+ {
52
+ header: "Actions",
53
+ cell(e) {
54
+ return q(J.FmButton, {
55
+ variant: "tertiary",
56
+ icon: "delete",
57
+ iconColor: "neutral-gray-400",
58
+ onClick: (a) => {
59
+ a.stopPropagation(), x(e.row.original);
60
+ }
61
+ });
62
+ }
63
+ }
64
+ ], v = k();
65
+ async function x(e) {
66
+ await Q.remove(`Are you sure you want to remove ${e.name}?`) && await w(
67
+ async () => {
68
+ await _.delete(e._id), await c.read("CREDIT");
69
+ },
70
+ {
71
+ message: `Removing ${e.name}`,
72
+ successMessage: `Removed ${e.name} successfully`
73
+ }
74
+ );
75
+ }
76
+ async function p(e) {
77
+ e ? await a() : L.open(async (d) => {
78
+ await a(d);
79
+ });
80
+ async function a(d) {
81
+ var u;
82
+ (u = v.value) == null || u.showSheet(
83
+ !0,
84
+ "CREDIT",
85
+ e ? await _.readById(e._id) : void 0,
86
+ d
87
+ );
88
+ }
89
+ }
90
+ async function T(e) {
91
+ await w(
92
+ async () => {
93
+ e.campaign._id ? await _.update(e.campaign._id, e) : await _.create(e), await c.read("CREDIT");
94
+ },
95
+ {
96
+ message: `${e.campaign._id ? "Updating" : "Creating"} credit program`,
97
+ successMessage: `Credit program ${e.campaign._id ? "updated" : "created"} successfully`
98
+ }
99
+ );
100
+ }
101
+ return N(async () => {
102
+ await B(async () => {
103
+ await c.read("CREDIT");
104
+ });
105
+ }), (e, a) => {
106
+ const d = i("FmPageHead"), u = i("FmSearch"), $ = i("FmTable"), b = i("FmButton"), E = i("FmListItem"), K = i("FmList"), P = i("FmCard");
107
+ return l(), f(g, null, [
108
+ r(d, {
109
+ title: "Credit",
110
+ actions: o(m).length > 0 ? [R] : [],
111
+ "onClick:action": a[0] || (a[0] = () => p())
112
+ }, null, 8, ["actions"]),
113
+ s("div", te, [
114
+ r(u, {
115
+ modelValue: o(n).searchKey,
116
+ "onUpdate:modelValue": a[1] || (a[1] = (t) => o(n).searchKey = t),
117
+ class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
118
+ placeholder: "search",
119
+ collapsible: ""
120
+ }, null, 8, ["modelValue"]),
121
+ o(c).campaigns.credit && o(c).campaigns.credit.length > 0 ? (l(), f(g, { key: 0 }, [
122
+ s("div", oe, [
123
+ s("div", ae, [
124
+ r(Y, {
125
+ modelValue: o(n).location,
126
+ "onUpdate:modelValue": a[2] || (a[2] = (t) => o(n).location = t),
127
+ label: "Location: ",
128
+ "show-item-label": !0,
129
+ icon: "storefront",
130
+ placement: "bottom-start",
131
+ items: o(I).locationItems
132
+ }, null, 8, ["modelValue", "items"])
133
+ ]),
134
+ r(u, {
135
+ modelValue: o(n).searchKey,
136
+ "onUpdate:modelValue": a[3] || (a[3] = (t) => o(n).searchKey = t),
137
+ class: "xs:hidden",
138
+ placeholder: "search",
139
+ collapsible: ""
140
+ }, null, 8, ["modelValue"])
141
+ ]),
142
+ r($, {
143
+ class: "xs:hidden",
144
+ "row-data": o(m),
145
+ "column-defs": D,
146
+ "search-value": o(n).searchKey,
147
+ "column-filter": [],
148
+ onRowClick: a[4] || (a[4] = (t) => p(t.original)),
149
+ "hide-footer": o(m).length < 10
150
+ }, null, 8, ["row-data", "search-value", "hide-footer"]),
151
+ r(K, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
152
+ default: h(() => [
153
+ (l(!0), f(g, null, j(o(m).filter(
154
+ (t) => t.name.toLowerCase().includes(o(n).searchKey.toLowerCase())
155
+ ), (t) => (l(), C(E, {
156
+ key: t._id.toString(),
157
+ onClick: (F) => p(t),
158
+ class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
159
+ }, {
160
+ default: h(() => [
161
+ s("div", se, [
162
+ s("div", ne, [
163
+ (l(), C(M(o(S)(t)))),
164
+ s("div", re, y(t.currentReceive ?? 0) + " used ", 1)
165
+ ]),
166
+ s("div", ie, [
167
+ s("div", le, y(t.name), 1),
168
+ s("div", ce, y(o(V)(t)), 1)
169
+ ]),
170
+ s("div", me, " Credit received: " + y(t.currentReceive ?? 0), 1)
171
+ ]),
172
+ r(b, {
173
+ icon: "delete",
174
+ "icon-color": "neutral-gray-400",
175
+ variant: "tertiary",
176
+ onClick: (F) => (F.stopPropagation(), x(t))
177
+ }, null, 8, ["onClick"])
178
+ ]),
179
+ _: 2
180
+ }, 1032, ["onClick"]))), 128))
181
+ ]),
182
+ _: 1
183
+ }),
184
+ o(m).length == 0 ? (l(), f("div", de, pe)) : H("", !0)
185
+ ], 64)) : (l(), C(P, {
186
+ key: 1,
187
+ variant: "outlined",
188
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
189
+ }, {
190
+ default: h(() => [
191
+ fe,
192
+ ye,
193
+ r(b, {
194
+ variant: "primary",
195
+ label: "Create credit program",
196
+ icon: "add",
197
+ onClick: a[5] || (a[5] = (t) => p())
198
+ })
199
+ ]),
200
+ _: 1
201
+ })),
202
+ r(Z, {
203
+ ref_key: "sheetRef",
204
+ ref: v,
205
+ "onSubmit:modelValue": T
206
+ }, null, 512)
207
+ ])
208
+ ], 64);
209
+ };
210
+ }
211
+ });
212
+ export {
213
+ Re as default
214
+ };