@feedmepos/mf-connect 0.1.0-beta.9 → 0.1.1-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 (102) hide show
  1. package/dist/Analytic-C2etD-eu.js +620 -0
  2. package/dist/{App-DQUbRsdA.js → App-DlRvkDpN.js} +58 -59
  3. package/dist/Broadcast-DpCGUS6r.js +216 -0
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-D-BFllvG.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cj4IcH5D.js} +20 -20
  5. package/dist/Card-DjGC6jmq.js +823 -0
  6. package/dist/Collections-Q2pYWnJF.js +440 -0
  7. package/dist/Credit-DOIq2VYW.js +214 -0
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-C_ZKNWzb.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-D7ML8ePp.js} +1010 -1026
  9. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CyxWG5I7.js +344 -0
  10. package/dist/Experience-DUst4I0H.js +211 -0
  11. package/dist/Game-CXnQR-wV.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-CZfHsMFC.js +309 -0
  15. package/dist/Member-CX5Ohgeg.js +92 -0
  16. package/dist/MemberList-D8I3SaAs.js +1040 -0
  17. package/dist/MemberOverview-C2n9oJZh.js +58 -0
  18. package/dist/{MemberTransactions-zSxSnUkK.js → MemberTransactions-DfZNbCHD.js} +1 -1
  19. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BxFVEoBX.js +203 -0
  20. package/dist/Mission-S1pwDbqp.js +248 -0
  21. package/dist/Point-BdLUcGZy.js +220 -0
  22. package/dist/Promotion-DWAeQGkU.js +244 -0
  23. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-CTKKhH-r.js → RuleGroup.vue_vue_type_script_setup_true_lang-Dux_NMO5.js} +577 -568
  24. package/dist/Segment-CXSE8Bzf.js +560 -0
  25. package/dist/Setting-CLuXuEId.js +1870 -0
  26. package/dist/Store-Be3cui0S.js +1533 -0
  27. package/dist/StoreRewards-zFy_w8p4.js +429 -0
  28. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-2Jqj_rKv.js → StoreTransactions.vue_vue_type_script_setup_true_lang-DxGJKgbc.js} +10 -10
  29. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BkdSj0cX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-Dreo45H1.js} +1 -1
  30. package/dist/{Tier-Cpl0FV8L.js → Tier-ChzcISYF.js} +453 -481
  31. package/dist/{Title-CbMDd1Et.js → Title-DQSjhBkT.js} +295 -314
  32. package/dist/Transaction-CeWmWpN_.js +36 -0
  33. package/dist/Voucher-BkLIxiZN.js +485 -0
  34. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-3LlSDiq0.js +140 -0
  35. package/dist/app-CLNirPsB.js +2974 -0
  36. package/dist/{app-VxaUCtgl.js → app-DuNsy0aC.js} +1 -1
  37. package/dist/app.js +3 -5
  38. package/dist/{business-DR7jpnLz.js → business-COGiTmLD.js} +1 -1
  39. package/dist/{campaign-MqcTb329.js → campaign-BHZMjQi5.js} +3 -5
  40. package/dist/{collection.fn-CvEoe61K.js → collection.fn-sAxtYO_r.js} +2 -2
  41. package/dist/dto-ndeeV_nc.js +1145 -0
  42. package/dist/{effect-BjjQeiQg.js → effect-BQt0rkdT.js} +9 -9
  43. package/dist/email-addresses-B3PazwKs.js +705 -0
  44. package/dist/{export-B8cvWh5n.js → export-D6r-xNji.js} +3 -3
  45. package/dist/{helper-DfgVNY7B.js → helper-CrjQw_Et.js} +1 -1
  46. package/dist/{index-CWR3qYjb.js → index-Btlj28Vg.js} +1 -1
  47. package/dist/{index-C7zMfUgy.js → index-Buy-yvAZ.js} +319 -304
  48. package/dist/{index-0UYoh1-7.js → index-C3AAy__p.js} +1 -1
  49. package/dist/index-CHAaFSD2.js +11 -0
  50. package/dist/{index-Dap5R3vr.js → index-Cg3RFxc9.js} +91 -102
  51. package/dist/{index-2P9w5u3m.js → index-CqpEhMr6.js} +4 -4
  52. package/dist/{index-BsfWRB8R.js → index-CvHj-wYi.js} +1 -1
  53. package/dist/index-DGLmbBnE.js +28997 -0
  54. package/dist/{index-CJ8Uh2Ja.js → index-DXpd07G3.js} +3 -3
  55. package/dist/{index-B5NufbUt.js → index-Daax_BQa.js} +1 -1
  56. package/dist/{index-C2JNcGc-.js → index-DrLEuIe1.js} +281 -299
  57. package/dist/{index-DBy30v8N.js → index-tSEYvA-2.js} +3 -3
  58. package/dist/{index.esm2017-D1X3PgpO.js → index.esm2017-a5BlZ76G.js} +55 -55
  59. package/dist/{loading-CJ3nOovJ.js → loading-B3XGyQ8W.js} +460 -469
  60. package/dist/{membership-B1cmSRyk.js → membership-GIOJ1ptN.js} +3 -3
  61. package/dist/money-z7VwzhZP.js +15 -0
  62. package/dist/number-DHYb2ua_.js +12 -0
  63. package/dist/{rule-builder-CSmOONdb.js → rule-builder-CcsWd5r9.js} +1 -1
  64. package/dist/{rule-ChWyR-0j.js → rule-iIEblTE4.js} +179 -177
  65. package/dist/style.css +1 -1
  66. package/dist/{template-Cug7aRK0.js → template-DMRMDZOW.js} +63 -63
  67. package/dist/{xlsx-CfgPFFvp.js → usePagination-CNFe0T2B.js} +3176 -2955
  68. package/package.json +5 -8
  69. package/dist/Analytic-CMXUjK_F.js +0 -622
  70. package/dist/Broadcast-DowFtHv6.js +0 -223
  71. package/dist/Card-C7rhL0pV.js +0 -825
  72. package/dist/Collections-B-1wlk3r.js +0 -453
  73. package/dist/Credit-DDjozmoF.js +0 -220
  74. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-pwMuIgs5.js +0 -345
  75. package/dist/Experience-BbE-c1Op.js +0 -221
  76. package/dist/Game-DQdRpaN-.js +0 -255
  77. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
  78. package/dist/MainLayout-B1aJoR95.js +0 -41
  79. package/dist/Marketing-Dgmxzg4h.js +0 -316
  80. package/dist/Member-w23oRVwN.js +0 -69
  81. package/dist/MemberList-BLIdjznQ.js +0 -1735
  82. package/dist/MemberOverview-wL_ailso.js +0 -58
  83. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Dy_lMdZA.js +0 -432
  84. package/dist/Mission-Cjt0E083.js +0 -261
  85. package/dist/Point-CQJL3Ewu.js +0 -222
  86. package/dist/Promotion-BYViH3bu.js +0 -247
  87. package/dist/Segment-B9Jj1ak0.js +0 -437
  88. package/dist/Setting-DXWbgRxs.js +0 -1901
  89. package/dist/Store-Dswk2e_z.js +0 -1511
  90. package/dist/StoreRewards-CNUhG_Ue.js +0 -401
  91. package/dist/Transaction-BB-kk-84.js +0 -39
  92. package/dist/Voucher-b1_Jlm6X.js +0 -490
  93. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-pG-SrXp9.js +0 -56
  94. package/dist/app-DCHKJoql.js +0 -5639
  95. package/dist/dto-jcK3TGB7.js +0 -2770
  96. package/dist/index-Cv7pLAYq.js +0 -3
  97. package/dist/index-LrSSauN2.js +0 -29193
  98. package/dist/money-BEATdGS6.js +0 -15
  99. package/dist/number-CeAYAKCp.js +0 -12
  100. package/dist/usePagination-BeF5K3M7.js +0 -223
  101. package/dist/vue-i18n-BRhKDHdF.js +0 -2365
  102. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -0,0 +1,440 @@
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-B3XGyQ8W.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-Btlj28Vg.js";
12
+ import { u as Y, a as ue, _ as de, w as ce } from "./usePagination-CNFe0T2B.js";
13
+ import { g as me } from "./user-Bm4KttFq.js";
14
+ import { m as pe } from "./index-CvHj-wYi.js";
15
+ import { o as fe } from "./objectId-dwaoBfJX.js";
16
+ 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({
17
+ __name: "CreateCollectionSheet",
18
+ emits: ["success"],
19
+ setup(f, { expose: r, emit: d }) {
20
+ const { minor: S } = J, F = Q(), k = p(), _ = p(!1), E = d, g = p(!1);
21
+ function q(l) {
22
+ g.value = l, l && (a.value = {
23
+ quantity: 1,
24
+ code: "",
25
+ codeConfig: {
26
+ length: 8,
27
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
28
+ prefix: "",
29
+ suffix: "",
30
+ pattern: "########"
31
+ }
32
+ });
33
+ }
34
+ const a = p({
35
+ quantity: 1,
36
+ code: "",
37
+ codeConfig: {
38
+ length: 8,
39
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
40
+ prefix: "",
41
+ suffix: "",
42
+ pattern: "########"
43
+ }
44
+ }), A = [
45
+ {
46
+ label: "Bulk codes",
47
+ value: "bulk",
48
+ sublabel: "Bulk generate unique codes"
49
+ },
50
+ {
51
+ label: "Custom code",
52
+ value: "single",
53
+ sublabel: "Enter your own custom codes"
54
+ }
55
+ ], B = [
56
+ {
57
+ label: "Alphanumeric",
58
+ value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
59
+ },
60
+ {
61
+ label: "Alphabetic",
62
+ value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
63
+ },
64
+ { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
65
+ { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
66
+ { label: "Numbers", value: "0123456789" },
67
+ { label: "Custom", value: "" }
68
+ ], C = p(B[0].value), c = p("bulk"), x = p(!1), D = H(() => F.params.id);
69
+ async function n(l) {
70
+ var o;
71
+ await ((o = k.value) == null ? void 0 : o.validateInputs()), _.value && await S(
72
+ async () => {
73
+ await N.createCollectionByCampaignId(D.value, l), await E("success");
74
+ },
75
+ {
76
+ message: "Creating claim(s)",
77
+ successMessage: "Claim(s) created"
78
+ }
79
+ );
80
+ }
81
+ return r({
82
+ showSheet: q
83
+ }), O(
84
+ () => c.value,
85
+ (l, o) => {
86
+ 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 = "########");
87
+ }
88
+ ), O(
89
+ () => a.value.codeConfig.length,
90
+ (l, o) => {
91
+ l != o && (a.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(l))));
92
+ }
93
+ ), (l, o) => {
94
+ 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");
95
+ return y(), L(Z, {
96
+ "max-width": 560,
97
+ "dismiss-away": !0,
98
+ header: "Create collection",
99
+ modelValue: e(g),
100
+ "onUpdate:modelValue": [
101
+ o[14] || (o[14] = (t) => K(g) ? g.value = t : null),
102
+ o[15] || (o[15] = (t) => g.value = t)
103
+ ]
104
+ }, {
105
+ "side-sheet-footer": I(() => [
106
+ b("div", he, [
107
+ s($, {
108
+ label: "Save",
109
+ onClick: o[12] || (o[12] = (t) => n(e(a))),
110
+ loading: e(re)().isLoading
111
+ }, null, 8, ["loading"]),
112
+ s($, {
113
+ label: "Cancel",
114
+ type: "button",
115
+ variant: "tertiary",
116
+ onClick: o[13] || (o[13] = (t) => g.value = !1)
117
+ })
118
+ ])
119
+ ]),
120
+ default: I(() => [
121
+ s(se, { json: e(a) }, null, 8, ["json"]),
122
+ s(X, {
123
+ ref_key: "form",
124
+ ref: k,
125
+ class: "space-y-40",
126
+ onValidationSuccess: o[10] || (o[10] = (t) => _.value = !0),
127
+ onValidationFailed: o[11] || (o[11] = (t) => _.value = !1)
128
+ }, {
129
+ default: I(() => [
130
+ b("div", null, [
131
+ ge,
132
+ s(i, {
133
+ modelValue: e(c),
134
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => K(c) ? c.value = t : null),
135
+ inline: !1
136
+ }, {
137
+ default: I(() => [
138
+ (y(), P(R, null, te(A, (t) => s(v, {
139
+ key: t.value,
140
+ value: t.value,
141
+ label: t.label,
142
+ sublabel: t.sublabel
143
+ }, null, 8, ["value", "label", "sublabel"])), 64))
144
+ ]),
145
+ _: 1
146
+ }, 8, ["modelValue"])
147
+ ]),
148
+ b("div", be, [
149
+ Ce,
150
+ e(c) === "bulk" ? (y(), P(R, { key: 0 }, [
151
+ s(V, {
152
+ "model-value": e(x),
153
+ "label-placement": "right",
154
+ value: "true",
155
+ label: "Advance code setting",
156
+ required: !0,
157
+ "onUpdate:modelValue": o[1] || (o[1] = () => x.value = !e(x))
158
+ }, null, 8, ["model-value"]),
159
+ e(x) ? (y(), P(R, { key: 0 }, [
160
+ s(M, {
161
+ modelValue: e(a).codeConfig.length,
162
+ "onUpdate:modelValue": o[2] || (o[2] = (t) => e(a).codeConfig.length = t),
163
+ label: "Code length",
164
+ max: 16,
165
+ min: 1,
166
+ rules: [
167
+ (t) => Number(t) >= 1 || "Code length must at least 1",
168
+ (t) => Number(t) <= 16 || "Code length must less than 16"
169
+ ],
170
+ required: !0
171
+ }, null, 8, ["modelValue", "rules"]),
172
+ s(w, {
173
+ label: "Charset",
174
+ "model-value": e(C),
175
+ items: B,
176
+ "helper-text": e(a).codeConfig.charset.length > 62 ? `${e(a).codeConfig.charset.substring(0, 62)}...` : e(a).codeConfig.charset,
177
+ "onUpdate:modelValue": o[3] || (o[3] = (t) => {
178
+ C.value = t, e(a).codeConfig.charset = t;
179
+ })
180
+ }, null, 8, ["model-value", "helper-text"]),
181
+ e(C) === "" ? (y(), L(h, {
182
+ key: 0,
183
+ modelValue: e(a).codeConfig.charset,
184
+ "onUpdate:modelValue": o[4] || (o[4] = (t) => e(a).codeConfig.charset = t),
185
+ label: "Custom Charset",
186
+ required: ""
187
+ }, null, 8, ["modelValue"])) : U("", !0),
188
+ b("div", ve, [
189
+ s(h, {
190
+ modelValue: e(a).codeConfig.prefix,
191
+ "onUpdate:modelValue": o[5] || (o[5] = (t) => e(a).codeConfig.prefix = t),
192
+ label: "Prefix (Optional)"
193
+ }, null, 8, ["modelValue"]),
194
+ s(h, {
195
+ modelValue: e(a).codeConfig.suffix,
196
+ "onUpdate:modelValue": o[6] || (o[6] = (t) => e(a).codeConfig.suffix = t),
197
+ label: "Suffix (Optional)"
198
+ }, null, 8, ["modelValue"])
199
+ ]),
200
+ s(h, {
201
+ modelValue: e(a).codeConfig.pattern,
202
+ "onUpdate:modelValue": o[7] || (o[7] = (t) => e(a).codeConfig.pattern = t),
203
+ label: "Pattern",
204
+ required: !0
205
+ }, null, 8, ["modelValue"])
206
+ ], 64)) : U("", !0),
207
+ s(h, {
208
+ modelValue: e(a).quantity,
209
+ "onUpdate:modelValue": o[8] || (o[8] = (t) => e(a).quantity = t),
210
+ label: "Number of code",
211
+ rules: [
212
+ (t) => t >= 1 || "Quantity cannot be less than 1",
213
+ (t) => t <= 1e4 || "Quantity cannot more than 10,000"
214
+ ],
215
+ required: !0,
216
+ "helper-text": `${e(a).quantity} claim will be created`
217
+ }, null, 8, ["modelValue", "rules", "helper-text"])
218
+ ], 64)) : U("", !0),
219
+ e(c) !== "bulk" ? (y(), L(W, {
220
+ key: 1,
221
+ modelValue: e(a).code,
222
+ "onUpdate:modelValue": o[9] || (o[9] = (t) => e(a).code = t),
223
+ label: "Custom Code",
224
+ rules: [(t) => e(c) != "single" || !!t || "Custom code is required"],
225
+ placeholder: "(For multiple codes, please enter in the new row.)"
226
+ }, null, 8, ["modelValue", "rules"])) : U("", !0)
227
+ ])
228
+ ]),
229
+ _: 1
230
+ }, 512)
231
+ ]),
232
+ _: 1
233
+ }, 8, ["modelValue"]);
234
+ };
235
+ }
236
+ });
237
+ class xe {
238
+ constructor() {
239
+ z(this, "data", []);
240
+ }
241
+ addRecord(r) {
242
+ this.data.push(r);
243
+ }
244
+ buildExcel() {
245
+ const r = Y.book_new(), d = Y.json_to_sheet(this.data);
246
+ return Y.book_append_sheet(r, d, "Collection"), r;
247
+ }
248
+ }
249
+ const m = {
250
+ sortBy: "_id",
251
+ descending: !1,
252
+ rowsPerPage: 1e3,
253
+ page: 1,
254
+ rowsNumber: 0
255
+ }, Ve = { class: "px-24 flex flex-col gap-y-32 pb-24" }, we = { class: "flex items-center justify-end py-4 xs:hidden" }, De = /* @__PURE__ */ G({
256
+ __name: "Collections",
257
+ setup(f) {
258
+ const r = ie(), d = Q(), S = p(), F = H(() => d.params.id), k = p(!1), { custom: _ } = J, E = [
259
+ {
260
+ header: "ID/Code",
261
+ accessorKey: "_id",
262
+ cell(n) {
263
+ return T("div", { class: "flex items-center" }, [
264
+ T(le.FmIcon, {
265
+ name: "content_copy",
266
+ outline: !0,
267
+ size: "sm",
268
+ class: "cursor-pointer mr-4",
269
+ onClick: (l) => {
270
+ l.preventDefault(), l.stopPropagation(), ne(
271
+ n.row.original.code || n.row.original._id.toString()
272
+ );
273
+ }
274
+ }),
275
+ T(
276
+ "div",
277
+ { class: "pr-2 text-ellipsis overflow-hidden" },
278
+ n.row.original.code || n.row.original._id.toString()
279
+ )
280
+ ]);
281
+ }
282
+ },
283
+ {
284
+ header: "User",
285
+ accessorKey: "user",
286
+ enableSorting: !1,
287
+ cell(n) {
288
+ const l = n.row.original.pf_user;
289
+ return me(l);
290
+ }
291
+ },
292
+ {
293
+ header: "Phone",
294
+ accessorFn: (n) => {
295
+ var l;
296
+ return ((l = n.pf_user) == null ? void 0 : l.phoneNumber) || "-";
297
+ },
298
+ accessorKey: "pf_user.phoneNumber"
299
+ },
300
+ {
301
+ header: "Balance",
302
+ accessorKey: "balance"
303
+ },
304
+ {
305
+ header: "Created at",
306
+ accessorKey: "_id",
307
+ accessorFn: (n) => j(fe(n._id.toString())).format("DD MMM YYYY")
308
+ },
309
+ {
310
+ header: "Nearest expired at",
311
+ accessorKey: "expiryBalance",
312
+ accessorFn: (n) => {
313
+ var l;
314
+ return n.expiryBalance && n.expiryBalance.length ? j((l = n.expiryBalance) == null ? void 0 : l[0].expiredAt).format("DD MMM YYYY") : "Never expires";
315
+ }
316
+ }
317
+ ], g = {
318
+ "$connect-STORE_REWARD_COLLECTIONS": pe.readCollectionsByRewardId,
319
+ "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": N.readCollectionsByCampaignId
320
+ }, q = (n) => {
321
+ const l = g[d.name];
322
+ return (o) => l(n, o);
323
+ }, { tableMeta: a, rowData: A, onSort: B, debouncedFetchData: C, onSearch: c } = ue(q(F.value));
324
+ async function x() {
325
+ var n;
326
+ await C(), (n = S.value) == null || n.showSheet(!1);
327
+ }
328
+ async function D() {
329
+ k.value || _(
330
+ async () => {
331
+ var v;
332
+ const n = new xe(), l = (await N.readCollectionsByCampaignId(F.value, {
333
+ limit: 1,
334
+ skip: 0,
335
+ sortBy: m.sortBy,
336
+ descending: m.descending
337
+ })).meta.totalResources ?? 0, o = m.rowsPerPage;
338
+ for (let i = 0; i < l; i += o) {
339
+ const V = {
340
+ ...m,
341
+ limit: o,
342
+ skip: (m.page - 1) * m.rowsPerPage,
343
+ sortBy: m.sortBy,
344
+ descending: m.descending
345
+ }, M = await N.readCollectionsByCampaignId(
346
+ F.value,
347
+ V
348
+ );
349
+ for await (const w of M.resources) {
350
+ const h = {
351
+ Id: (w == null ? void 0 : w.code) || ((v = w._id) == null ? void 0 : v.toString()) || ""
352
+ };
353
+ n.addRecord(h);
354
+ }
355
+ m.page++;
356
+ }
357
+ await ce(
358
+ n.buildExcel(),
359
+ `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
360
+ {
361
+ bookType: "xlsx",
362
+ bookSST: !1,
363
+ type: "array"
364
+ }
365
+ ), m.page = 1;
366
+ },
367
+ {
368
+ isLoading: k
369
+ }
370
+ );
371
+ }
372
+ return ae(async () => {
373
+ await C();
374
+ }), (n, l) => {
375
+ const o = u("FmPageHead"), v = u("FmSearch");
376
+ return y(), P(R, null, [
377
+ s(o, {
378
+ title: "Collections",
379
+ "back-button": !0,
380
+ actions: [
381
+ { label: "Export", value: "export", isPrimary: !1 },
382
+ {
383
+ label: "Create collection",
384
+ value: "create",
385
+ isPrimary: !0
386
+ }
387
+ ],
388
+ "onClick:back": l[0] || (l[0] = (i) => e(r).back()),
389
+ "onClick:action": l[1] || (l[1] = (i) => {
390
+ var V;
391
+ i === "create" && ((V = e(S)) == null || V.showSheet(!0)), i === "export" && D();
392
+ })
393
+ }),
394
+ b("div", Ve, [
395
+ s(v, {
396
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
397
+ modelValue: e(a).searchValue,
398
+ "onUpdate:modelValue": [
399
+ l[2] || (l[2] = (i) => e(a).searchValue = i),
400
+ e(c)
401
+ ],
402
+ placeholder: "Search",
403
+ collapsible: ""
404
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
405
+ b("div", we, [
406
+ s(v, {
407
+ modelValue: e(a).searchValue,
408
+ "onUpdate:modelValue": [
409
+ l[3] || (l[3] = (i) => e(a).searchValue = i),
410
+ e(c)
411
+ ],
412
+ placeholder: "Search",
413
+ collapsible: ""
414
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
415
+ ]),
416
+ s(de, {
417
+ loading: e(a).isLoading,
418
+ "row-data": e(A),
419
+ "column-defs": E,
420
+ "row-count": e(a).totalRows,
421
+ "page-count": e(a).pageCount,
422
+ "page-index": e(a).pageIndex,
423
+ "page-size": e(a).pageSize,
424
+ "shrink-at": !1,
425
+ onSortChange: e(B),
426
+ onPageChange: l[4] || (l[4] = (i) => e(C)({ pageSize: i.pageSize, pageIndex: i.pageIndex }))
427
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
428
+ s(ye, {
429
+ ref_key: "sheetRef",
430
+ ref: S,
431
+ onSuccess: x
432
+ }, null, 512)
433
+ ])
434
+ ], 64);
435
+ };
436
+ }
437
+ });
438
+ export {
439
+ De as default
440
+ };
@@ -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-B3XGyQ8W.js";
5
+ import { u as W } from "./business-COGiTmLD.js";
6
+ import { u as X } from "./campaign-BHZMjQi5.js";
7
+ import { g as S, b as V } from "./dto-ndeeV_nc.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-D7ML8ePp.js";
10
+ import { u as ee } from "./template-DMRMDZOW.js";
11
+ import { c as _ } from "./index-Btlj28Vg.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
+ };