@feedmepos/mf-connect 0.1.8-prod → 0.1.9-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 (70) hide show
  1. package/dist/{Analytic-C5DiiAlc.js → Analytic-8Ew7y5t9.js} +11 -10
  2. package/dist/{App-B3pHa-zu.js → App-3BVNH3r-.js} +6 -6
  3. package/dist/{Broadcast-BbKiYeZC.js → Broadcast-CrsPUhLT.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CusmGpDT.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DE300Y56.js} +7 -8
  5. package/dist/Card-DndggRLr.js +1036 -0
  6. package/dist/{Collections-DvZEXknp.js → Collections-djS9hLI8.js} +4 -4
  7. package/dist/{Credit-CqjSUWeG.js → Credit-D4KEvIov.js} +8 -8
  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-Bzd-9d8d.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-BjM81fmS.js} +25 -24
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-C73wNCE4.js → EffectSheet.vue_vue_type_style_index_0_lang-aEWfdpCg.js} +7 -7
  11. package/dist/{Experience-BmCrc4-K.js → Experience-2FPLO7aV.js} +8 -8
  12. package/dist/{Game-CU4AHASb.js → Game-e_UjVJgU.js} +8 -8
  13. package/dist/{Marketing-PJO3M5Xy.js → Marketing-B2hCjZ2r.js} +5 -5
  14. package/dist/{Member-DChbb26Z.js → Member-D_ykRIBb.js} +4 -4
  15. package/dist/{MemberList-Ckvxgme7.js → MemberList-LmzzYxEn.js} +17 -18
  16. package/dist/{MemberTransactions-KNlKr1DE.js → MemberTransactions-B2vqlKaP.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CDX1qdOw.js → MessageInput.vue_vue_type_script_setup_true_lang-DQ2ubF0N.js} +2 -2
  18. package/dist/{Mission-B215NI_F.js → Mission-CsLdMq1M.js} +8 -8
  19. package/dist/{Point-B-Ot-ZXU.js → Point-DFriwWWY.js} +8 -8
  20. package/dist/{Promotion-CKEfuwo0.js → Promotion-Db3IEs2F.js} +9 -9
  21. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-C03bKqvg.js → RuleGroup.vue_vue_type_script_setup_true_lang-_P2yImhi.js} +15 -15
  22. package/dist/{Segment-B8JKn5_y.js → Segment-CE8q9JV2.js} +22 -21
  23. package/dist/{Setting-BcWDJ-63.js → Setting-Vcz1S27V.js} +8 -8
  24. package/dist/{Store-ada-EZLR.js → Store-C8kT7JN5.js} +16 -15
  25. package/dist/{StoreRewards-DyfFecSH.js → StoreRewards-Dt30AkWo.js} +15 -14
  26. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cc2F_06x.js +1065 -0
  27. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CHrZ7pit.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-f59onlgt.js} +1 -1
  28. package/dist/{Tier-iKOv9e2Y.js → Tier-a6yXEtLd.js} +185 -185
  29. package/dist/{Title-BRWnLlHd.js → Title-A3-2EI0w.js} +20 -20
  30. package/dist/{Transaction-BMnxATxc.js → Transaction-DswABr2P.js} +2 -2
  31. package/dist/{Voucher-B_IwtXLW.js → Voucher-DEoVgZYa.js} +11 -11
  32. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-ccc1vxjS.js +56 -0
  33. package/dist/{app-Bs8TZeMP.js → app-C23GfQGq.js} +1 -1
  34. package/dist/{app-CLPpu6jA.js → app-C66C2KLW.js} +30 -27
  35. package/dist/app.js +1 -1
  36. package/dist/{business-Dg5T3krT.js → business-DNAVZOSH.js} +1 -1
  37. package/dist/{campaign-BMLeXfnZ.js → campaign-Cv0HaUD1.js} +2 -2
  38. package/dist/{collection.fn-D4QJRMAS.js → collection.fn-Dxzr2oPt.js} +2 -2
  39. package/dist/{dto-CQy53qRe.js → dto-CcrufW2j.js} +9 -9
  40. package/dist/{effect-BT6zDeUe.js → effect-CUuL8Tci.js} +1 -1
  41. package/dist/{email-addresses-DeUE8GFC.js → email-addresses-Yt3s7i2b.js} +1 -1
  42. package/dist/{export-DWzBynN8.js → export-CNg5YWMm.js} +3 -3
  43. package/dist/{helper-Cs4YpYv9.js → helper-DzmKNFue.js} +1 -1
  44. package/dist/{index-xCMvgFRa.js → index-9CXt2kbQ.js} +983 -783
  45. package/dist/{index-B3GqF_vh.js → index-B88e_9YI.js} +1 -1
  46. package/dist/{index-n-_5f43h.js → index-BK8X9RF6.js} +3 -3
  47. package/dist/{index-QAuJWbpX.js → index-C7745kXl.js} +20 -21
  48. package/dist/{index-CvJ_6M8U.js → index-CZ28ywyB.js} +2 -2
  49. package/dist/{index-CiwzD983.js → index-CsCgQ8gt.js} +1 -1
  50. package/dist/{index-CjF0scjl.js → index-D0obMrAS.js} +63 -168
  51. package/dist/{index-aFNPEkUz.js → index-Dnf7j71V.js} +9 -3
  52. package/dist/{index-BUXB-qmB.js → index-O9lB54LY.js} +5 -5
  53. package/dist/{index-DfhJOhMY.js → index-QuBsnXgx.js} +1 -1
  54. package/dist/{index-BXs-tqST.js → index-yzH5eyKW.js} +1 -1
  55. package/dist/{index.esm2017-cme_1dHU.js → index.esm2017-TpBElhnN.js} +1 -1
  56. package/dist/{loading-zw44FQ6v.js → loading-ChoC5E9d.js} +4 -4
  57. package/dist/{membership-Bg77E5Sx.js → membership-CU-k0-Tf.js} +3 -3
  58. package/dist/{money-BepQPzrc.js → money-DANmyTBj.js} +1 -1
  59. package/dist/{number-BJ4XIfGj.js → number-DrocTWDD.js} +1 -1
  60. package/dist/{rule-oDZ1Kic9.js → rule-BQLmpER9.js} +3 -3
  61. package/dist/{rule-builder-C1Jwhs7N.js → rule-builder-3YRdr18A.js} +1 -1
  62. package/dist/{template-CSeRj8B2.js → template-DOKU1QkY.js} +4 -4
  63. package/dist/{usePagination-DUaGlE2s.js → usePagination-JGI7x0W7.js} +1 -1
  64. package/dist/{vue-i18n-4eZqYBzI.js → vue-i18n-Bch1JmhI.js} +158 -158
  65. package/dist/zod-Bg2FbC-D.js +90 -0
  66. package/package.json +1 -1
  67. package/dist/Card--Q4OMSRz.js +0 -824
  68. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Ra4nMKvT.js +0 -890
  69. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-vsgeD3mK.js +0 -141
  70. package/dist/index-sGtk4oiO.js +0 -207
@@ -0,0 +1,1065 @@
1
+ import { defineComponent as B, ref as A, computed as V, onMounted as ee, resolveComponent as T, openBlock as I, createBlock as P, unref as o, withCtx as $, createVNode as _, normalizeClass as X, createCommentVNode as he, createElementVNode as x, toDisplayString as M, createElementBlock as N, Fragment as G, renderList as Q, mergeModels as ne, useModel as ye, watch as te, h as s, isRef as be, createTextVNode as _e, resolveDynamicComponent as xe, onBeforeMount as Se } from "vue";
2
+ import { components as D } from "@feedmepos/ui-library";
3
+ import { f as le } from "./index-9CXt2kbQ.js";
4
+ import { a as ae } from "./loading-ChoC5E9d.js";
5
+ import { s as we } from "./index-Dbd4WA4r.js";
6
+ import { h as S } from "./moment-BWErdI6_.js";
7
+ import { s as K } from "./index-CuvNtC_M.js";
8
+ import { f as Z } from "./number-DrocTWDD.js";
9
+ import { u as se } from "./business-DNAVZOSH.js";
10
+ import { a as ie, _ as ce } from "./usePagination-JGI7x0W7.js";
11
+ import { g as ue } from "./user-Bm4KttFq.js";
12
+ import { B as de, a as me } from "./export-CNg5YWMm.js";
13
+ import { u as pe } from "./campaign-Cv0HaUD1.js";
14
+ import "./index-yzH5eyKW.js";
15
+ import "./index-O9lB54LY.js";
16
+ import "./index-C7745kXl.js";
17
+ import "./index-D0obMrAS.js";
18
+ import "./index-CZ28ywyB.js";
19
+ import "./index-QuBsnXgx.js";
20
+ import { u as Ce } from "./vue-i18n-Bch1JmhI.js";
21
+ import { o as U } from "./objectId-dwaoBfJX.js";
22
+ import { useRouter as Re } from "vue-router";
23
+ import { R as j } from "./app-C66C2KLW.js";
24
+ import { g as oe, a as De, S as Ie, b as Te } from "./index-BK8X9RF6.js";
25
+ function Fe(l) {
26
+ let d = "";
27
+ switch (l) {
28
+ case "PORTAL":
29
+ d = "ADMIN";
30
+ break;
31
+ case "BENEFIT":
32
+ d = "MEMBERSHIP";
33
+ break;
34
+ case "ORDER":
35
+ d = "ORDER";
36
+ break;
37
+ case "BILL":
38
+ d = "SPENDING";
39
+ break;
40
+ case "CASHBACK":
41
+ d = "CASHBACK";
42
+ break;
43
+ case "CYCLE":
44
+ d = "EXPIRED";
45
+ break;
46
+ case "COUNTER_CONSUME":
47
+ d = "COUNTER REDEEM";
48
+ break;
49
+ default:
50
+ d = l;
51
+ break;
52
+ }
53
+ return d;
54
+ }
55
+ function ke(l) {
56
+ var d, i, c, m, f, w;
57
+ switch ((d = l == null ? void 0 : l.pf_collectible) == null ? void 0 : d.type) {
58
+ case "VOUCHER":
59
+ return `${(i = l.pf_collectible) == null ? void 0 : i.type} (${(c = l.pf_collectible) == null ? void 0 : c.name})`;
60
+ case "TITLE":
61
+ return `${(m = l.pf_collectible) == null ? void 0 : m.type} (${(f = l.pf_collectible) == null ? void 0 : f.name})`;
62
+ case "POINT":
63
+ return "Experience";
64
+ case "COIN":
65
+ return "Point";
66
+ default:
67
+ return we((w = l == null ? void 0 : l.pf_collectible) == null ? void 0 : w.type);
68
+ }
69
+ }
70
+ function Oe(l) {
71
+ switch (l) {
72
+ case "ONLINE":
73
+ return "Online";
74
+ case "COIN":
75
+ return "Point";
76
+ default:
77
+ return l;
78
+ }
79
+ }
80
+ const E = {
81
+ getReason: Fe,
82
+ formattedType: ke,
83
+ formattedPaymentType: Oe
84
+ }, Ae = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, J = /* @__PURE__ */ B({
85
+ __name: "FilterChip",
86
+ props: {
87
+ modelValue: {
88
+ type: Array,
89
+ required: !1
90
+ },
91
+ label: {
92
+ type: String,
93
+ required: !1,
94
+ default: ""
95
+ },
96
+ showItemLabel: {
97
+ type: Boolean,
98
+ default: !1
99
+ },
100
+ placement: {
101
+ type: String,
102
+ required: !1,
103
+ default: "bottom-end"
104
+ },
105
+ class: {
106
+ type: String,
107
+ required: !1
108
+ },
109
+ disabled: {
110
+ type: Boolean,
111
+ required: !1
112
+ },
113
+ items: {
114
+ type: Array,
115
+ required: !0
116
+ },
117
+ icon: {
118
+ type: String,
119
+ required: !1
120
+ }
121
+ },
122
+ emits: ["update:model-value"],
123
+ setup(l, { emit: d }) {
124
+ const i = l, c = d, m = A(!1), f = A({}), w = V(() => {
125
+ if (!f.value || Object.keys(f.value).length == i.items.length)
126
+ return "All";
127
+ {
128
+ const h = Object.keys(f.value).length;
129
+ return `${h > 0 ? h : "None"} selected`;
130
+ }
131
+ });
132
+ function p(h) {
133
+ f.value[h] ? delete f.value[h] : f.value[h] = !0, c("update:model-value", Object.keys(f.value));
134
+ }
135
+ function R() {
136
+ Object.keys(f.value).length > 0 ? f.value = {} : f.value = i.items.reduce((h, e) => (h[e.value] = !0, h), {}), c("update:model-value", Object.keys(f.value));
137
+ }
138
+ return ee(() => {
139
+ f.value = i.modelValue.reduce(
140
+ (h, e) => (h[e] = !0, h),
141
+ {}
142
+ ), i.modelValue.length == 0;
143
+ }), (h, e) => {
144
+ const t = T("FmIcon"), g = T("FmChip"), v = T("FmMenuItem"), r = T("FmMenu");
145
+ return I(), P(r, {
146
+ placement: l.placement || "bottom-end",
147
+ disabled: l.disabled == !0,
148
+ "model-value": o(m),
149
+ onMenuChanged: e[0] || (e[0] = (C) => m.value = C),
150
+ "close-on-click": !1
151
+ }, {
152
+ "menu-button": $(() => [
153
+ _(g, {
154
+ label: l.label,
155
+ class: X(i.class || "text-fm-color-neutral-gray-400 cursor-pointer")
156
+ }, {
157
+ default: $(() => [
158
+ i.icon ? (I(), P(t, {
159
+ key: 0,
160
+ name: i.icon,
161
+ class: X(i.class),
162
+ outline: "",
163
+ size: "sm"
164
+ }, null, 8, ["name", "class"])) : he("", !0),
165
+ x("div", Ae, M(i.label) + " " + M(l.showItemLabel ? o(w) : ""), 1),
166
+ _(t, {
167
+ name: o(m) ? "keyboard_arrow_up" : "keyboard_arrow_down",
168
+ class: X(i.class),
169
+ outline: "",
170
+ size: "sm"
171
+ }, null, 8, ["name", "class"])
172
+ ]),
173
+ _: 1
174
+ }, 8, ["label", "class"])
175
+ ]),
176
+ default: $(() => [
177
+ _(v, {
178
+ "model-value": Object.keys(o(f)).length === i.items.length,
179
+ label: "All",
180
+ "has-checkbox": !0,
181
+ indeterminate: !0,
182
+ onClick: R
183
+ }, null, 8, ["model-value"]),
184
+ (I(!0), N(G, null, Q(i.items ?? [], (C) => (I(), P(v, {
185
+ key: C.value,
186
+ value: C.value,
187
+ label: C.label,
188
+ "has-checkbox": !0,
189
+ "model-value": o(f)[C.value],
190
+ "onUpdate:modelValue": (O) => p(C.value)
191
+ }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"]))), 128))
192
+ ]),
193
+ _: 1
194
+ }, 8, ["placement", "disabled", "model-value"]);
195
+ };
196
+ }
197
+ }), q = "YYYY-MM-DD", fe = /* @__PURE__ */ B({
198
+ __name: "DateRangeChip",
199
+ props: /* @__PURE__ */ ne({
200
+ modelValue: {
201
+ type: Object,
202
+ required: !0
203
+ }
204
+ }, {
205
+ dateRange: {
206
+ type: Object,
207
+ default: () => ({
208
+ startDate: S().subtract(7, "day").format(q),
209
+ endDate: S().endOf("day").format(q)
210
+ })
211
+ },
212
+ dateRangeModifiers: {}
213
+ }),
214
+ emits: /* @__PURE__ */ ne(["update:model-value"], ["update:dateRange"]),
215
+ setup(l, { emit: d }) {
216
+ const i = l, c = d, m = ye(l, "dateRange"), f = V(() => m.value ? `${w.value.startDate ?? "Start"} - ${w.value.endDate ?? "End"}` : "No dates selected."), w = V(() => ({
217
+ startDate: m.value.startDate ? S(m.value.startDate).format(q) : void 0,
218
+ endDate: m.value.endDate ? S(m.value.endDate).format(q) : void 0
219
+ }));
220
+ return ee(() => {
221
+ m.value = i.modelValue;
222
+ }), te(
223
+ () => m.value,
224
+ () => {
225
+ c("update:model-value", w.value);
226
+ }
227
+ ), (p, R) => {
228
+ const h = T("FmChip"), e = T("FmDateRangePicker");
229
+ return I(), P(e, {
230
+ modelValue: m.value,
231
+ "onUpdate:modelValue": R[0] || (R[0] = (t) => m.value = t),
232
+ "show-predefined-range": ""
233
+ }, {
234
+ "trigger-button": $(() => [
235
+ _(h, {
236
+ label: o(f),
237
+ icon: "calendar_month",
238
+ "right-icon": "keyboard_arrow_down",
239
+ class: "text-fm-color-neutral-gray-400 cursor-pointer"
240
+ }, null, 8, ["label"])
241
+ ]),
242
+ _: 1
243
+ }, 8, ["modelValue"]);
244
+ };
245
+ }
246
+ });
247
+ class Ee extends de {
248
+ }
249
+ const Ne = { class: "space-y-24 pr-12" }, Me = { class: "w-full space-y-16" }, Ve = { class: "fm-typo-en-body-lg-600" }, Pe = ["onClick"], $e = /* @__PURE__ */ x("hr", { class: "mt-3" }, null, -1), Ye = { class: "fm-typo-en-body-lg-600" }, Ue = ["onClick"], Be = /* @__PURE__ */ x("hr", { class: "mt-3" }, null, -1), ze = { class: "flex items-center gap-8" }, Le = /* @__PURE__ */ B({
250
+ __name: "TransactionDetailSheet",
251
+ setup(l, { expose: d }) {
252
+ Ce();
253
+ const i = A(!1), c = A(), m = pe(), f = se();
254
+ function w(e, t) {
255
+ i.value = e, c.value = t ?? null;
256
+ }
257
+ const p = V(() => {
258
+ var e, t;
259
+ return Z(
260
+ ((t = c.value) == null ? void 0 : t.expiryAmount.reduce(
261
+ (g, v) => g + v.amount,
262
+ ((e = c.value) == null ? void 0 : e.amount) ?? 0
263
+ )) ?? 0,
264
+ 2
265
+ );
266
+ }), R = V(() => {
267
+ var e, t, g, v, r;
268
+ return c.value ? [
269
+ {
270
+ label: "Transaction ID",
271
+ value: (e = c.value) == null ? void 0 : e._id
272
+ },
273
+ {
274
+ label: "Date/Time",
275
+ value: S(U(c.value._id.toString())).format(
276
+ "D MMM YYYY, hh:mmA"
277
+ )
278
+ },
279
+ {
280
+ label: "Amount",
281
+ component: () => s(
282
+ "span",
283
+ {
284
+ class: [
285
+ "pr-2",
286
+ +p.value > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
287
+ ]
288
+ },
289
+ p.value
290
+ )
291
+ },
292
+ {
293
+ label: "Type",
294
+ value: E.formattedType(c.value)
295
+ },
296
+ {
297
+ label: "Source",
298
+ value: K(E.getReason(c.value.source))
299
+ },
300
+ {
301
+ label: "User",
302
+ value: (g = (t = c.value) == null ? void 0 : t.pf_user) == null ? void 0 : g.name
303
+ },
304
+ {
305
+ label: "Phone Number",
306
+ value: (r = (v = c.value) == null ? void 0 : v.pf_user) == null ? void 0 : r.phoneNumber
307
+ }
308
+ ] : [];
309
+ }), h = V(() => {
310
+ var v, r, C, O;
311
+ if (!c.value) return [];
312
+ const e = [], t = (v = c.value) == null ? void 0 : v.metadata, g = c.value;
313
+ if (t != null && t.campaign) {
314
+ const F = m.campaigns.all.find(
315
+ (W) => W._id === (t == null ? void 0 : t.campaign)
316
+ );
317
+ if (!F) return;
318
+ e.push({
319
+ label: "Campaign",
320
+ value: F.name
321
+ });
322
+ }
323
+ return t != null && t.remark && e.push({
324
+ label: "Remark",
325
+ value: t.remark
326
+ }), (r = c.value) != null && r.ref.startsWith("bill_") && e.push({
327
+ label: "Bill Number",
328
+ value: (C = c.value) == null ? void 0 : C.ref,
329
+ copy: () => {
330
+ var F;
331
+ return ae((F = c.value) == null ? void 0 : F.ref);
332
+ }
333
+ }), t != null && t.location && e.push({
334
+ label: "Location",
335
+ value: (O = f.locations.find(
336
+ (F) => F._id.toString() === (t == null ? void 0 : t.location)
337
+ )) == null ? void 0 : O.name
338
+ }), g.source === le.enum.STORE && e.push({
339
+ label: "Store Transaction",
340
+ value: g.ref
341
+ }), t != null && t.originTransaction && e.push({
342
+ label: "Parent Transaction",
343
+ value: t.originTransaction
344
+ }), t != null && t.referral_count && e.push({
345
+ label: "Referral Count",
346
+ value: t.referral_count
347
+ }), g.refunded && e.push({
348
+ label: "Refunded From",
349
+ value: g.refundedFrom
350
+ }), e;
351
+ });
352
+ return d({
353
+ showSheet: w
354
+ }), (e, t) => {
355
+ const g = T("FmButton"), v = T("FmSideSheet");
356
+ return I(), P(v, {
357
+ "max-width": 560,
358
+ modelValue: o(i),
359
+ "onUpdate:modelValue": t[1] || (t[1] = (r) => be(i) ? i.value = r : null),
360
+ header: "Transaction Details"
361
+ }, {
362
+ "side-sheet-footer": $(() => [
363
+ x("div", ze, [
364
+ _(g, {
365
+ label: "Close",
366
+ onClick: t[0] || (t[0] = (r) => w(!1)),
367
+ variant: "tertiary"
368
+ })
369
+ ])
370
+ ]),
371
+ default: $(() => [
372
+ x("div", Ne, [
373
+ x("div", Me, [
374
+ (I(!0), N(G, null, Q(o(R), (r) => (I(), N("div", {
375
+ key: r.label,
376
+ class: "flex flex-col gap-4"
377
+ }, [
378
+ x("div", Ve, M(r.label), 1),
379
+ x("div", {
380
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
381
+ onClick: r.copy
382
+ }, [
383
+ _e(M(r.accessorFn ? r.accessorFn() : r.value) + " ", 1),
384
+ (I(), P(xe(r.component)))
385
+ ], 8, Pe),
386
+ $e
387
+ ]))), 128)),
388
+ (I(!0), N(G, null, Q(o(h), (r) => (I(), N("div", {
389
+ key: r.label,
390
+ class: "flex flex-col gap-4"
391
+ }, [
392
+ x("div", Ye, M(r.label), 1),
393
+ x("div", {
394
+ class: "text-fm-color-typo-secondary fm-typo-en-body-md-400 hover:underline",
395
+ onClick: r.copy
396
+ }, M(r.accessorFn ? r.accessorFn() : r.value), 9, Ue),
397
+ Be
398
+ ]))), 128))
399
+ ])
400
+ ])
401
+ ]),
402
+ _: 1
403
+ }, 8, ["modelValue"]);
404
+ };
405
+ }
406
+ }), re = () => {
407
+ const l = Ie.getBusinessId();
408
+ if (!l) throw new Error("Invalid business ID");
409
+ return Te(`businesses/${l}/transactions`, {
410
+ noIdRequired: !0
411
+ });
412
+ }, H = {
413
+ async readAll(l, d) {
414
+ const i = oe(
415
+ await re().get("", {
416
+ params: { ...l, ...d }
417
+ })
418
+ );
419
+ return {
420
+ meta: i.meta,
421
+ resources: i.resources
422
+ };
423
+ },
424
+ async readStoreTransactions(l, d) {
425
+ const i = oe(
426
+ await re().get("/store", {
427
+ params: { ...l, ...d }
428
+ })
429
+ );
430
+ return {
431
+ meta: i.meta,
432
+ resources: i.resources
433
+ };
434
+ },
435
+ async readBills(l, d, i) {
436
+ return (await De("").get(`/restaurants/${l}/receipt?start=${d}&end=${i}`)).data;
437
+ }
438
+ }, je = { class: "hidden xs:flex items-center justify-end" }, qe = { class: "flex items-center justify-between" }, Ke = { class: "flex gap-8 items-center w-full overflow-x-scroll" }, Ge = { class: "xs:hidden" }, St = /* @__PURE__ */ B({
439
+ __name: "CollectionTransactions",
440
+ props: {
441
+ user: {
442
+ type: String
443
+ }
444
+ },
445
+ setup(l) {
446
+ const d = se(), i = pe(), c = Re(), m = l, f = A(!1), w = [
447
+ {
448
+ header: "Transaction ID",
449
+ accessorKey: "_id",
450
+ meta: {
451
+ maxWidth: "100px"
452
+ },
453
+ cell(n) {
454
+ return s("div", { class: "flex items-center" }, [
455
+ s(D.FmIcon, {
456
+ name: "content_copy",
457
+ outline: !0,
458
+ size: "sm",
459
+ class: "cursor-pointer mr-4",
460
+ onClick: (a) => {
461
+ a.preventDefault(), a.stopPropagation(), ae(n.row.original._id.toString());
462
+ }
463
+ }),
464
+ s(
465
+ "div",
466
+ { class: "pr-2 text-ellipsis overflow-hidden" },
467
+ n.row.original._id.toString()
468
+ )
469
+ ]);
470
+ },
471
+ enableSorting: !1
472
+ },
473
+ {
474
+ header: "Created at",
475
+ accessorKey: "_id",
476
+ accessorFn: (n) => S(U(n._id.toString())).format("D MMM YYYY, hh:mmA"),
477
+ enableSorting: !0
478
+ },
479
+ {
480
+ header: "Amount",
481
+ // accessorKey: 'totalAmount',
482
+ enableSorting: !1,
483
+ cell(n) {
484
+ var b, u, k, Y;
485
+ const a = Z(
486
+ n.row.original.expiryAmount.reduce(
487
+ (z, L) => z + L.amount,
488
+ n.row.original.amount ?? 0
489
+ ),
490
+ 2
491
+ ), y = (u = (b = n.row.original.expiryAmount) == null ? void 0 : b[0]) != null && u.expiredAt ? S((Y = (k = n.row.original.expiryAmount) == null ? void 0 : k[0]) == null ? void 0 : Y.expiredAt).format(
492
+ "D MMM YYYY"
493
+ ) : "";
494
+ return s("div", { class: "flex items-center" }, [
495
+ s(
496
+ "div",
497
+ {
498
+ class: [
499
+ "pr-2",
500
+ +a > 0 ? "text-fm-color-system-success-300" : "text-fm-color-system-error-300"
501
+ ]
502
+ },
503
+ a
504
+ ),
505
+ s("div", { class: "flex items-center" }, [
506
+ n.row.original.expiryAmount.length > 0 ? s(
507
+ D.FmTooltip,
508
+ {
509
+ content: `Expired on ${y}`
510
+ },
511
+ [
512
+ s(D.FmIcon, {
513
+ name: "info",
514
+ outline: !0,
515
+ size: "sm"
516
+ })
517
+ ]
518
+ ) : s("div")
519
+ ])
520
+ ]);
521
+ }
522
+ },
523
+ {
524
+ header: "Type",
525
+ accessorKey: "pf_collectible.type",
526
+ accessorFn: (n) => E.formattedType(n),
527
+ meta: {
528
+ maxWidth: "200px"
529
+ },
530
+ cell(n) {
531
+ const a = E.formattedType(n.row.original);
532
+ return s("div", { class: "flex items-center" }, [
533
+ s("div", { class: "truncate text-ellipsis" }, a),
534
+ a.length > 20 ? s(
535
+ D.FmTooltip,
536
+ {
537
+ content: a
538
+ },
539
+ [
540
+ s(D.FmIcon, {
541
+ name: "info",
542
+ outline: !0,
543
+ size: "sm"
544
+ })
545
+ ]
546
+ ) : null
547
+ ]);
548
+ }
549
+ },
550
+ {
551
+ header: "Source",
552
+ accessorKey: "source",
553
+ cell(n) {
554
+ var a;
555
+ return s("div", { class: "flex items-center gap-4" }, [
556
+ s(
557
+ "div",
558
+ { class: "truncate text-ellipsis" },
559
+ K(E.getReason(n.row.original.source))
560
+ ),
561
+ ...(a = n.row.original.metadata) != null && a.campaign ? [
562
+ s(
563
+ D.FmTooltip,
564
+ {
565
+ get content() {
566
+ var y;
567
+ return (y = i.campaigns.all.find(
568
+ (b) => {
569
+ var u;
570
+ return b._id === ((u = n.row.original.metadata) == null ? void 0 : u.campaign);
571
+ }
572
+ )) == null ? void 0 : y.name;
573
+ }
574
+ },
575
+ [
576
+ s(D.FmIcon, {
577
+ name: "info",
578
+ outline: !0,
579
+ size: "sm",
580
+ onClick: async (y) => {
581
+ y.preventDefault(), y.stopPropagation();
582
+ const b = i.campaigns.all.find(
583
+ (u) => {
584
+ var k;
585
+ return u._id === ((k = n.row.original.metadata) == null ? void 0 : k.campaign);
586
+ }
587
+ );
588
+ if (b)
589
+ switch (b.type) {
590
+ case "VOUCHER":
591
+ case "PROMOTION":
592
+ case "BROADCAST":
593
+ await c.push({
594
+ name: j[`$connect-CAMPAIGN_${b.type}`]
595
+ });
596
+ break;
597
+ case "GAME":
598
+ case "CREDIT":
599
+ case "MISSION":
600
+ await c.push({
601
+ name: j[`$connect-PROGRAM_${b.type}`]
602
+ });
603
+ break;
604
+ case "POINT":
605
+ await c.push({
606
+ name: j["$connect-PROGRAM_EXPERIENCE"]
607
+ });
608
+ break;
609
+ case "COIN":
610
+ await c.push({
611
+ name: j["$connect-PROGRAM_POINT"]
612
+ });
613
+ break;
614
+ }
615
+ }
616
+ })
617
+ ]
618
+ )
619
+ ] : []
620
+ ]);
621
+ }
622
+ },
623
+ {
624
+ header: "User",
625
+ accessorKey: "pf_user.name",
626
+ cell(n) {
627
+ return ue(n.row.original.pf_user);
628
+ }
629
+ },
630
+ {
631
+ header: "Phone No.",
632
+ accessorKey: "pf_user.phoneNumber",
633
+ accessorFn: (n) => {
634
+ var a;
635
+ return ((a = n == null ? void 0 : n.pf_user) == null ? void 0 : a.phoneNumber) || "";
636
+ }
637
+ },
638
+ {
639
+ accessorFn: (n) => n.ref,
640
+ header: "References",
641
+ accessorKey: "ref",
642
+ cell(n) {
643
+ var a, y;
644
+ return s("div", { class: "flex items-center justify-between gap-4" }, [
645
+ s("div", { class: "flex items-center" }, [
646
+ (a = n.row.original.metadata) != null && a.remark ? s(
647
+ D.FmTooltip,
648
+ {
649
+ content: (y = n.row.original.metadata) == null ? void 0 : y.remark
650
+ },
651
+ [
652
+ s(D.FmIcon, {
653
+ name: "info",
654
+ outline: !0,
655
+ size: "sm"
656
+ })
657
+ ]
658
+ ) : s("div")
659
+ ]),
660
+ s("div", { class: "flex-1" }, n.row.original.ref)
661
+ ]);
662
+ }
663
+ }
664
+ ], p = A({
665
+ search: "",
666
+ "pf_collectible.type": [],
667
+ "metadata.location": [],
668
+ dateRange: {
669
+ startDate: S().subtract(7, "day").toISOString(),
670
+ endDate: S().endOf("day").toISOString()
671
+ },
672
+ source: []
673
+ }), { tableMeta: R, rowData: h, onSort: e, debouncedFetchData: t, onSearch: g } = ie(async (n) => {
674
+ const a = {
675
+ ...p.value,
676
+ user: m.user,
677
+ dateRange: {
678
+ start: new Date(p.value.dateRange.startDate).toISOString(),
679
+ end: new Date(p.value.dateRange.endDate).toISOString()
680
+ }
681
+ }, y = await H.readAll(n, a);
682
+ return {
683
+ resources: y.resources.map((b) => {
684
+ const u = v.value.find((k) => k._id === b.ref);
685
+ return { ...b, ref: (u == null ? void 0 : u.seqNumber) || b.ref };
686
+ }),
687
+ meta: y.meta
688
+ };
689
+ }), v = A([]), r = le.options.map((n) => ({ label: K(E.getReason(n)), value: n })), C = d.locations.map((n) => ({ label: n.name, value: n._id }));
690
+ te(
691
+ p,
692
+ () => {
693
+ t();
694
+ },
695
+ { deep: !0 }
696
+ );
697
+ async function O() {
698
+ try {
699
+ f.value = !0;
700
+ const n = {
701
+ ...p.value,
702
+ user: m.user,
703
+ dateRange: {
704
+ start: new Date(p.value.dateRange.startDate).toISOString(),
705
+ end: new Date(p.value.dateRange.endDate).toISOString()
706
+ }
707
+ };
708
+ await me({
709
+ exporter: new Ee(),
710
+ readFunction: (a) => H.readAll(a, n),
711
+ transformRecord: (a) => {
712
+ var y, b, u, k, Y, z, L;
713
+ return {
714
+ TransactionID: a._id,
715
+ CreatedAt: S(U(a._id.toString())).format(
716
+ "D MMM YYYY, hh:mmA"
717
+ ),
718
+ Amount: Z(
719
+ a.expiryAmount.reduce(
720
+ (ge, ve) => ge + ve.amount,
721
+ a.amount ?? 0
722
+ ),
723
+ 2
724
+ ),
725
+ ExpiredAt: (b = (y = a.expiryAmount) == null ? void 0 : y[0]) != null && b.expiredAt ? S((k = (u = a.expiryAmount) == null ? void 0 : u[0]) == null ? void 0 : k.expiredAt).format("D MMM YYYY") : "",
726
+ Type: E.formattedType(a),
727
+ Source: K(E.getReason(a.source)),
728
+ User: ((Y = a.pf_user) == null ? void 0 : Y.name) || "",
729
+ "Phone No.": ((z = a.pf_user) == null ? void 0 : z.phoneNumber) || "",
730
+ References: a.ref,
731
+ Remark: ((L = a.metadata) == null ? void 0 : L.remark) || ""
732
+ };
733
+ },
734
+ filename: "transactions"
735
+ });
736
+ } catch (n) {
737
+ console.error(n);
738
+ } finally {
739
+ f.value = !1;
740
+ }
741
+ }
742
+ const F = A(null);
743
+ function W(n) {
744
+ var a;
745
+ console.log(n), (a = F.value) == null || a.showSheet(!0, n.original);
746
+ }
747
+ return Se(async () => {
748
+ await d.readLocations(), await i.read(), await t();
749
+ }), (n, a) => {
750
+ const y = T("FmSearch"), b = T("FmButton");
751
+ return I(), N(G, null, [
752
+ x("div", null, [
753
+ x("div", je, [
754
+ _(y, {
755
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
756
+ modelValue: o(p).search,
757
+ "onUpdate:modelValue": a[0] || (a[0] = (u) => o(p).search = u),
758
+ placeholder: "Search",
759
+ collapsible: ""
760
+ }, null, 8, ["modelValue"]),
761
+ _(b, {
762
+ icon: "ios_share",
763
+ variant: "tertiary",
764
+ onClick: O
765
+ })
766
+ ]),
767
+ x("div", qe, [
768
+ x("div", Ke, [
769
+ _(J, {
770
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
771
+ "right-icon": "keyboard_arrow_down",
772
+ modelValue: o(p)["metadata.location"],
773
+ "onUpdate:modelValue": a[1] || (a[1] = (u) => o(p)["metadata.location"] = u),
774
+ icon: "storefront",
775
+ "show-item-label": !0,
776
+ items: o(C)
777
+ }, null, 8, ["modelValue", "items"]),
778
+ _(J, {
779
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
780
+ "right-icon": "keyboard_arrow_down",
781
+ modelValue: o(p)["pf_collectible.type"],
782
+ "onUpdate:modelValue": a[2] || (a[2] = (u) => o(p)["pf_collectible.type"] = u),
783
+ label: "Type: ",
784
+ "show-item-label": !0,
785
+ items: [
786
+ { label: "Point", value: "COIN" },
787
+ { label: "Credit", value: "CREDIT" },
788
+ { label: "Voucher", value: "VOUCHER" },
789
+ { label: "Experience", value: "POINT" },
790
+ { label: "Tier", value: "TIER" },
791
+ { label: "Title", value: "TITLE" },
792
+ { label: "Game", value: "GAME" },
793
+ { label: "Stamp", value: "STAMP" }
794
+ ]
795
+ }, null, 8, ["modelValue"]),
796
+ _(J, {
797
+ class: "cursor-pointer text-fm-color-neutral-gray-400",
798
+ "right-icon": "keyboard_arrow_down",
799
+ modelValue: o(p).source,
800
+ "onUpdate:modelValue": a[3] || (a[3] = (u) => o(p).source = u),
801
+ label: "Source: ",
802
+ "show-item-label": !0,
803
+ items: o(r)
804
+ }, null, 8, ["modelValue", "items"]),
805
+ _(fe, {
806
+ "model-value": {
807
+ startDate: o(p).dateRange.startDate,
808
+ endDate: o(p).dateRange.endDate
809
+ },
810
+ "onUpdate:modelValue": a[4] || (a[4] = (u) => o(p).dateRange = {
811
+ startDate: o(S)(u.startDate).startOf("d").toISOString(),
812
+ endDate: o(S)(u.endDate).endOf("d").toISOString()
813
+ })
814
+ }, null, 8, ["model-value"])
815
+ ]),
816
+ _(y, {
817
+ class: "xs:hidden",
818
+ modelValue: o(p).search,
819
+ "onUpdate:modelValue": a[5] || (a[5] = (u) => o(p).search = u),
820
+ placeholder: "Search",
821
+ collapsible: ""
822
+ }, null, 8, ["modelValue"]),
823
+ x("div", Ge, [
824
+ _(b, {
825
+ icon: "ios_share",
826
+ variant: "tertiary",
827
+ onClick: O
828
+ })
829
+ ])
830
+ ]),
831
+ _(ce, {
832
+ loading: o(R).isLoading,
833
+ "row-data": o(h),
834
+ "row-count": o(R).totalRows,
835
+ "column-defs": w.filter(
836
+ (u) => !m.user || u.header !== "User" && u.header !== "Phone No."
837
+ ),
838
+ "page-count": o(R).pageCount,
839
+ "page-index": o(R).pageIndex,
840
+ "page-size": o(R).pageSize,
841
+ "shrink-at": !1,
842
+ onSortChange: o(e),
843
+ onPageChange: a[6] || (a[6] = (u) => o(t)({
844
+ pageSize: u.pageSize,
845
+ pageIndex: u.pageIndex
846
+ })),
847
+ onRowClick: W
848
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
849
+ ]),
850
+ _(Le, {
851
+ ref_key: "transactionDetailSheet",
852
+ ref: F
853
+ }, null, 512)
854
+ ], 64);
855
+ };
856
+ }
857
+ });
858
+ class He extends de {
859
+ }
860
+ const We = { class: "flex items-center justify-between" }, Xe = { class: "flex gap-8 items-center" }, Je = { class: "flex gap-8 items-center xs:hidden" }, wt = /* @__PURE__ */ B({
861
+ __name: "StoreTransactions",
862
+ props: {
863
+ user: {
864
+ type: String
865
+ }
866
+ },
867
+ setup(l) {
868
+ const d = l, i = [
869
+ {
870
+ header: "Transaction ID",
871
+ meta: {
872
+ maxWidth: "150px"
873
+ },
874
+ cell(e) {
875
+ return s("div", { class: "flex items-center" }, [
876
+ s(D.FmIcon, {
877
+ name: "content_copy",
878
+ outline: !0,
879
+ size: "sm",
880
+ class: "cursor-pointer mr-4 shrink-0",
881
+ onClick: (t) => {
882
+ t.preventDefault(), t.stopPropagation(), ae(e.row.original._id.toString());
883
+ }
884
+ }),
885
+ s("div", { class: "truncate" }, e.row.original._id.toString())
886
+ ]);
887
+ }
888
+ },
889
+ {
890
+ header: "Created at",
891
+ accessorFn: (e) => S(U(e._id.toString())).format("D MMM YYYY, hh:mmA"),
892
+ enableSorting: !0
893
+ },
894
+ {
895
+ header: "Bundle",
896
+ accessorFn: (e) => e.bundle.name
897
+ },
898
+ {
899
+ header: "Location",
900
+ accessorFn: (e) => e.location ? e.pf_location.name : "Online Store"
901
+ },
902
+ {
903
+ header: "Payment Type",
904
+ accessorFn: (e) => {
905
+ var t;
906
+ return ((t = e.paymentType) == null ? void 0 : t.type) ?? "N/A";
907
+ },
908
+ cell(e) {
909
+ var t, g;
910
+ return s("div", { class: "flex items-center gap-4" }, [
911
+ s("div", { class: "flex items-center" }, [
912
+ ((t = e.row.original.paymentType) == null ? void 0 : t.type) == "ONLINE" && e.row.original.paymentType.extra ? s(
913
+ D.FmTooltip,
914
+ {
915
+ content: e.row.original.paymentType.extra
916
+ },
917
+ [
918
+ s(D.FmIcon, {
919
+ name: "info",
920
+ outline: !0,
921
+ size: "sm"
922
+ })
923
+ ]
924
+ ) : s("div")
925
+ ]),
926
+ s(
927
+ "div",
928
+ { class: "flex-1" },
929
+ ((g = e.row.original.paymentType) == null ? void 0 : g.type) ?? "N/A"
930
+ )
931
+ ]);
932
+ }
933
+ },
934
+ {
935
+ header: "User",
936
+ cell: (e) => ue(e.row.original.pf_member)
937
+ },
938
+ {
939
+ header: "Phone No.",
940
+ accessorFn: (e) => e.pf_member.phoneNumber
941
+ },
942
+ {
943
+ header: "Status",
944
+ // accessorFn: (u) => u.status,
945
+ cell(e) {
946
+ var t, g, v, r;
947
+ return s("div", { class: "flex items-center" }, [
948
+ s("div", e.row.original.status),
949
+ s("div", { class: "flex items-center" }, [
950
+ (g = (t = e.row.original) == null ? void 0 : t.refund) != null && g.reason ? s(
951
+ D.FmTooltip,
952
+ {
953
+ content: (r = (v = e.row.original) == null ? void 0 : v.refund) == null ? void 0 : r.reason
954
+ },
955
+ [
956
+ s(D.FmIcon, {
957
+ name: "info",
958
+ outline: !0,
959
+ size: "sm"
960
+ })
961
+ ]
962
+ ) : s("div")
963
+ ])
964
+ ]);
965
+ }
966
+ }
967
+ ], c = A({
968
+ searchValue: "",
969
+ dateRange: {
970
+ startDate: S().subtract(7, "day").toISOString(),
971
+ endDate: S().toISOString()
972
+ }
973
+ }), { tableMeta: m, rowData: f, onSort: w, debouncedFetchData: p, onSearch: R } = ie(async (e) => {
974
+ const t = {
975
+ ...c.value.dateRange,
976
+ user: d.user
977
+ };
978
+ return await H.readStoreTransactions(e, t);
979
+ });
980
+ te(
981
+ c,
982
+ () => {
983
+ p();
984
+ },
985
+ { deep: !0 }
986
+ ), ee(async () => {
987
+ await p();
988
+ });
989
+ const h = async () => me({
990
+ exporter: new He(),
991
+ readFunction: (e) => H.readStoreTransactions(e, {
992
+ ...c.value.dateRange,
993
+ user: d.user
994
+ }),
995
+ transformRecord: (e) => {
996
+ var t, g, v, r, C, O;
997
+ return {
998
+ TransactionId: ((t = e._id) == null ? void 0 : t.toString()) || "",
999
+ CreatedAt: S(U(e._id.toString())).format(
1000
+ "DD/MM/YYYY HH:mm:ss"
1001
+ ),
1002
+ Bundle: e.bundle.name || "",
1003
+ Location: e.location ? e.pf_location.name : "Online Store",
1004
+ PaymentType: ((g = e.paymentType) == null ? void 0 : g.type) || "N/A",
1005
+ PaymentExtra: ((v = e.paymentType) == null ? void 0 : v.extra) || "",
1006
+ User: ((r = e.pf_member) == null ? void 0 : r.name) || "",
1007
+ PhoneNumber: ((C = e.pf_member) == null ? void 0 : C.phoneNumber) || "",
1008
+ Status: e.status || "",
1009
+ RefundReason: ((O = e == null ? void 0 : e.refund) == null ? void 0 : O.reason) || ""
1010
+ };
1011
+ },
1012
+ filename: "store-transactions"
1013
+ });
1014
+ return (e, t) => {
1015
+ const g = T("FmSearch"), v = T("FmButton");
1016
+ return I(), N("div", null, [
1017
+ x("div", We, [
1018
+ x("div", Xe, [
1019
+ _(fe, {
1020
+ modelValue: o(c).dateRange,
1021
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => o(c).dateRange = r)
1022
+ }, null, 8, ["modelValue"])
1023
+ ]),
1024
+ x("div", Je, [
1025
+ _(g, {
1026
+ modelValue: o(m).searchValue,
1027
+ "onUpdate:modelValue": [
1028
+ t[1] || (t[1] = (r) => o(m).searchValue = r),
1029
+ o(R)
1030
+ ],
1031
+ placeholder: "Search",
1032
+ collapsible: ""
1033
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
1034
+ _(v, {
1035
+ icon: "ios_share",
1036
+ variant: "tertiary",
1037
+ onClick: h
1038
+ })
1039
+ ])
1040
+ ]),
1041
+ _(ce, {
1042
+ loading: o(m).isLoading,
1043
+ "row-data": o(f),
1044
+ "row-count": o(m).totalRows,
1045
+ "column-defs": i.filter(
1046
+ (r) => !d.user || r.header !== "User" && r.header !== "Phone No."
1047
+ ),
1048
+ "page-count": o(m).pageCount,
1049
+ "page-index": o(m).pageIndex,
1050
+ "page-size": o(m).pageSize,
1051
+ "shrink-at": !1,
1052
+ onSortChange: o(w),
1053
+ onPageChange: t[2] || (t[2] = (r) => o(p)({
1054
+ pageSize: r.pageSize,
1055
+ pageIndex: r.pageIndex
1056
+ }))
1057
+ }, null, 8, ["loading", "row-data", "row-count", "column-defs", "page-count", "page-index", "page-size", "onSortChange"])
1058
+ ]);
1059
+ };
1060
+ }
1061
+ });
1062
+ export {
1063
+ St as _,
1064
+ wt as a
1065
+ };