@feedmepos/mf-connect 0.1.58-prod → 0.1.60-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 (129) hide show
  1. package/dist/Analytic-CB0xAr9Q.js +427 -0
  2. package/dist/App-fp_3oll7.js +4630 -0
  3. package/dist/Bin-CPEbn14A.js +166 -0
  4. package/dist/Broadcast-jKp2iB8c.js +233 -0
  5. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CmJG893h.js +121 -0
  6. package/dist/Card-BaPJkgd2.js +911 -0
  7. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  8. package/dist/Collections-Bqsg-ON3.js +458 -0
  9. package/dist/Credit-C9zIva1h.js +228 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSMV8OwA.js +2194 -0
  12. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-Doyw0pvU.js +348 -0
  13. package/dist/Experience-CCI_oesa.js +229 -0
  14. package/dist/FileSaver.min-NlMItPOc.js +74 -0
  15. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  16. package/dist/Game-CRMVz1JP.js +284 -0
  17. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D1KQpDGg.js +144 -0
  18. package/dist/Index-szNiSnjR.js +259 -0
  19. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  20. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +18737 -0
  21. package/dist/MainLayout-B1aJoR95.js +41 -0
  22. package/dist/Marketing-AvEiNiD9.js +319 -0
  23. package/dist/Member-DIZwt6Hh.js +279 -0
  24. package/dist/MemberList-dxteIRWn.js +1607 -0
  25. package/dist/MemberOverview-wL_ailso.js +58 -0
  26. package/dist/MemberTransactions-Q3phmXfI.js +45 -0
  27. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BLk8rX-T.js +60553 -0
  28. package/dist/Mission-CZjySlcS.js +302 -0
  29. package/dist/Overview-BXbWEDy3.js +1079 -0
  30. package/dist/Point-CgjNc_Qn.js +232 -0
  31. package/dist/Promotion-COYo3qLi.js +289 -0
  32. package/dist/Queue-BLIStJth.js +260 -0
  33. package/dist/Record-BWoTvVEE.js +341 -0
  34. package/dist/Reward-Dq6GxHMP.js +442 -0
  35. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-CR1feHth.js +150 -0
  36. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DuYYfbOH.js +1763 -0
  37. package/dist/Segment-CUfn6k5R.js +882 -0
  38. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CxycOqNJ.js +181 -0
  39. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-C7jqrfEj.js +188 -0
  40. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CMmdbYH4.js +147 -0
  41. package/dist/Setting-CC5AiQSy.js +1928 -0
  42. package/dist/SettingAdvertisements-DHQTaMC1.js +262 -0
  43. package/dist/Store-CEgv5aOD.js +1842 -0
  44. package/dist/StoreRewards-Dtzk_YG2.js +423 -0
  45. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Cwt8pmoM.js +995 -0
  46. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BEU2u1-a.js +139 -0
  47. package/dist/Tier-1xqQvWzc.js +895 -0
  48. package/dist/Title-Da-G8plz.js +566 -0
  49. package/dist/Transaction-B0vuVZFZ.js +39 -0
  50. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-e4-wNfrg.js +130 -0
  51. package/dist/Voucher-DLFjkXLu.js +384 -0
  52. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-5X7dGFD9.js +419 -0
  53. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-BPTrvEwa.js +56 -0
  54. package/dist/_commonjsHelpers-BkfeUUK-.js +28 -0
  55. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  56. package/dist/app-Do_C3F_N.js +7094 -0
  57. package/dist/app-o7Kvv5aK.js +57962 -0
  58. package/dist/app-wDQR6dpb.js +39 -0
  59. package/dist/app.js +6 -0
  60. package/dist/business-BDi-QTa5.js +82 -0
  61. package/dist/campaign-BHqizYy6.js +1810 -0
  62. package/dist/campaign-CpzFl8Vr.js +4 -0
  63. package/dist/campaign-DNXI3K9c.js +94 -0
  64. package/dist/campaign.enum-BXDwYoeA.js +20 -0
  65. package/dist/campaign.fn-Rws4mJa5.js +758 -0
  66. package/dist/collectible.enum-cMc4fL1T.js +19 -0
  67. package/dist/collection.fn-F8FZ7Dnr.js +26 -0
  68. package/dist/dto-CAtf1jq0.js +216 -0
  69. package/dist/effect-Dhg1ZIrL.js +78 -0
  70. package/dist/email-addresses-BZJZwglQ.js +705 -0
  71. package/dist/export-B6yvRuct.js +97 -0
  72. package/dist/feedme.ico +0 -0
  73. package/dist/helper-VoErinsY.js +71 -0
  74. package/dist/index-B0Pzwzkd.js +31 -0
  75. package/dist/index-Bq6FwMwW.js +32 -0
  76. package/dist/index-BvE6Sbog.js +3 -0
  77. package/dist/index-BysJoGFD.js +146 -0
  78. package/dist/index-C8m_F_I4.js +121 -0
  79. package/dist/index-CQZinjc9.js +54 -0
  80. package/dist/index-Cq7s1Pk2.js +76 -0
  81. package/dist/index-CuvNtC_M.js +61 -0
  82. package/dist/index-DOGrOlB8.js +8859 -0
  83. package/dist/index-Di23nMJ7.js +38 -0
  84. package/dist/index-Dkyb4P6T.js +30076 -0
  85. package/dist/index-DvZiQOtl.js +3077 -0
  86. package/dist/index-Ved5V90A.js +2155 -0
  87. package/dist/index-d4A3r8kv.js +32269 -0
  88. package/dist/index-vh86FiIQ.js +10 -0
  89. package/dist/index-y7IqG-tl.js +44 -0
  90. package/dist/index.esm2017-CRTpUsW5.js +3069 -0
  91. package/dist/loading-CoUrS63J.js +71 -0
  92. package/dist/lodash-B5I3zXaY.js +3678 -0
  93. package/dist/membership-BiQwBHAA.js +235 -0
  94. package/dist/moment-D7p2TMB-.js +2583 -0
  95. package/dist/money-CA3gpWD3.js +15 -0
  96. package/dist/number-CgmVpwHm.js +12 -0
  97. package/dist/object-qECH92oz.js +26 -0
  98. package/dist/objectId-dwaoBfJX.js +7 -0
  99. package/dist/objectid-C80eoTvt.js +145 -0
  100. package/dist/plugins-BkWtR_R5.js +208 -0
  101. package/dist/reward-D7SKofYj.js +36 -0
  102. package/dist/rule-Cpxty5PH.js +1951 -0
  103. package/dist/rule-builder-d_TMgXEC.js +102 -0
  104. package/dist/style.css +4 -0
  105. package/dist/template-BB7bab5R.js +190 -0
  106. package/dist/tier-BJDhpH6X.js +4 -0
  107. package/dist/tiers/tier=1.png +0 -0
  108. package/dist/tiers/tier=2.png +0 -0
  109. package/dist/tiers/tier=3.png +0 -0
  110. package/dist/tiers/tier=4.png +0 -0
  111. package/dist/timezone-Dj3UaenF.js +1151 -0
  112. package/dist/titles/type=diamond.png +0 -0
  113. package/dist/titles/type=drinks.png +0 -0
  114. package/dist/titles/type=food.png +0 -0
  115. package/dist/titles/type=heart.png +0 -0
  116. package/dist/titles/type=medal.png +0 -0
  117. package/dist/titles/type=spend.png +0 -0
  118. package/dist/titles/type=thank-you.png +0 -0
  119. package/dist/titles/type=thumbs-up.png +0 -0
  120. package/dist/titles/type=years.png +0 -0
  121. package/dist/trigger-ZVR5eR1H.js +144 -0
  122. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  123. package/dist/type_drinks-D6jnpvwV.js +4 -0
  124. package/dist/usePagination-Ds-cuHop.js +223 -0
  125. package/dist/user-DjRqnFsC.js +54 -0
  126. package/dist/vue-i18n-BlCNfIcP.js +2365 -0
  127. package/dist/xlsx-CtNr_GAa.js +15491 -0
  128. package/dist/zod-Bg2FbC-D.js +90 -0
  129. package/package.json +1 -1
@@ -0,0 +1,97 @@
1
+ import { defineComponent as C, ref as F, computed as g, resolveComponent as s, openBlock as u, createBlock as m, unref as d, withCtx as c, createVNode as p, normalizeClass as i, createCommentVNode as V, createElementVNode as k, toDisplayString as b, renderSlot as q, createElementBlock as S, Fragment as I, renderList as M } from "vue";
2
+ const B = { class: "fm-typo-en-body-md-600 select-none text-ellipsis overflow-hidden whitespace-nowrap" }, z = /* @__PURE__ */ C({
3
+ __name: "ChipMenu",
4
+ props: {
5
+ modelValue: {
6
+ type: Object,
7
+ required: !1
8
+ },
9
+ label: {
10
+ type: String,
11
+ required: !0
12
+ },
13
+ showItemLabel: {
14
+ type: Boolean,
15
+ default: !1
16
+ },
17
+ placement: {
18
+ type: String,
19
+ required: !1,
20
+ default: "bottom-end"
21
+ },
22
+ class: {
23
+ type: String,
24
+ required: !1
25
+ },
26
+ disabled: {
27
+ type: Boolean,
28
+ required: !1
29
+ },
30
+ items: {
31
+ type: Array,
32
+ required: !1
33
+ },
34
+ icon: {
35
+ type: String,
36
+ required: !1
37
+ }
38
+ },
39
+ emits: ["update:model-value"],
40
+ setup(a, { emit: f }) {
41
+ const e = a, v = f, r = F(!1), y = g(
42
+ () => {
43
+ var n, t;
44
+ return (t = (n = e.items) == null ? void 0 : n.find((o) => o.value === e.modelValue)) == null ? void 0 : t.label;
45
+ }
46
+ );
47
+ return (n, t) => {
48
+ const o = s("FmIcon"), _ = s("FmChip"), h = s("FmMenuItem"), w = s("FmMenu");
49
+ return u(), m(w, {
50
+ placement: a.placement || "bottom-end",
51
+ disabled: a.disabled == !0,
52
+ "model-value": d(r),
53
+ onMenuChanged: t[0] || (t[0] = (l) => r.value = l)
54
+ }, {
55
+ "menu-button": c(() => [
56
+ p(_, {
57
+ label: e.label,
58
+ class: i(e.class || "text-fm-color-neutral-gray-400 cursor-pointer")
59
+ }, {
60
+ default: c(() => [
61
+ e.icon ? (u(), m(o, {
62
+ key: 0,
63
+ name: e.icon,
64
+ class: i(e.class),
65
+ outline: "",
66
+ size: "sm"
67
+ }, null, 8, ["name", "class"])) : V("", !0),
68
+ k("div", B, b(e.label) + " " + b(a.showItemLabel ? d(y) : ""), 1),
69
+ p(o, {
70
+ name: d(r) ? "keyboard_arrow_up" : "keyboard_arrow_down",
71
+ class: i(e.class),
72
+ outline: "",
73
+ size: "sm"
74
+ }, null, 8, ["name", "class"])
75
+ ]),
76
+ _: 1
77
+ }, 8, ["label", "class"])
78
+ ]),
79
+ default: c(() => [
80
+ q(n.$slots, "default", {}, () => [
81
+ (u(!0), S(I, null, M(e.items ?? [], (l) => (u(), m(h, {
82
+ key: l.value,
83
+ value: l.value,
84
+ label: l.label,
85
+ "model-value": e.modelValue === l.value,
86
+ "onUpdate:modelValue": (x) => v("update:model-value", l.value)
87
+ }, null, 8, ["value", "label", "model-value", "onUpdate:modelValue"]))), 128))
88
+ ])
89
+ ]),
90
+ _: 3
91
+ }, 8, ["placement", "disabled", "model-value"]);
92
+ };
93
+ }
94
+ });
95
+ export {
96
+ z as _
97
+ };
@@ -0,0 +1,458 @@
1
+ var te = Object.defineProperty;
2
+ var ae = (g, i, d) => i in g ? te(g, i, { enumerable: !0, configurable: !0, writable: !0, value: d }) : g[i] = d;
3
+ var K = (g, i, d) => ae(g, typeof i != "symbol" ? i + "" : i, d);
4
+ import { defineComponent as H, ref as f, computed as J, watch as T, resolveComponent as u, openBlock as x, createBlock as z, unref as o, isRef as j, withCtx as I, createElementVNode as h, createVNode as r, createElementBlock as R, Fragment as N, renderList as le, createCommentVNode as U, onMounted as ne, h as Y } from "vue";
5
+ import { h as G } from "./moment-D7p2TMB-.js";
6
+ import { components as se } from "@feedmepos/ui-library";
7
+ import "./index-d4A3r8kv.js";
8
+ import { J as re } from "./JsonViewer-v8_C7l5N.js";
9
+ import { u as Q } from "./loading-CoUrS63J.js";
10
+ import { u as ie } from "./app-wDQR6dpb.js";
11
+ import { useRoute as W, useRouter as ue } from "vue-router";
12
+ import { c as P } from "./index-C8m_F_I4.js";
13
+ import { e as p } from "./index-vh86FiIQ.js";
14
+ import { u as $, w as de } from "./xlsx-CtNr_GAa.js";
15
+ import { g as ce } from "./user-DjRqnFsC.js";
16
+ import { u as me, _ as pe } from "./usePagination-Ds-cuHop.js";
17
+ import { a as fe } from "./plugins-BkWtR_R5.js";
18
+ import { m as ge } from "./index-BysJoGFD.js";
19
+ import { o as Ce } from "./objectId-dwaoBfJX.js";
20
+ const be = { class: "space-y-16" }, ve = { class: "gap-16 grid grid-cols-2" }, he = { class: "flex items-center gap-8" }, ye = /* @__PURE__ */ H({
21
+ __name: "CreateCollectionSheet",
22
+ emits: ["success"],
23
+ setup(g, { expose: i, emit: d }) {
24
+ const { minor: S } = Q, w = W(), F = f(), k = f(!1), q = d, C = f(!1);
25
+ function D(s) {
26
+ C.value = s, s && (a.value = {
27
+ quantity: 1,
28
+ code: "",
29
+ codeConfig: {
30
+ length: 8,
31
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
32
+ prefix: "",
33
+ suffix: "",
34
+ pattern: "########"
35
+ }
36
+ });
37
+ }
38
+ const a = f({
39
+ quantity: 1,
40
+ code: "",
41
+ codeConfig: {
42
+ length: 8,
43
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
44
+ prefix: "",
45
+ suffix: "",
46
+ pattern: "########"
47
+ }
48
+ }), E = [
49
+ {
50
+ label: "Bulk codes",
51
+ value: "bulk",
52
+ sublabel: "Bulk generate unique codes"
53
+ },
54
+ {
55
+ label: "Custom code",
56
+ value: "single",
57
+ sublabel: "Enter your own custom codes"
58
+ }
59
+ ], B = [
60
+ {
61
+ label: "Alphanumeric",
62
+ value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
63
+ },
64
+ {
65
+ label: "Alphabetic",
66
+ value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
67
+ },
68
+ { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
69
+ { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
70
+ { label: "Numbers", value: "0123456789" },
71
+ { label: "Custom", value: "" }
72
+ ], y = f(B[0].value), c = f("bulk"), V = f(!1), A = J(() => w.params.id);
73
+ async function n(s) {
74
+ var e;
75
+ await ((e = F.value) == null ? void 0 : e.validateInputs()), k.value && await S(
76
+ async () => {
77
+ await P.createCollectionByCampaignId(A.value, s), await q("success");
78
+ },
79
+ {
80
+ message: "Creating claim(s)",
81
+ successMessage: "Claim(s) created"
82
+ }
83
+ );
84
+ }
85
+ i({
86
+ showSheet: D
87
+ }), T(
88
+ () => c.value,
89
+ (s, e) => {
90
+ e != s && (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 = "########");
91
+ }
92
+ );
93
+ function l(s) {
94
+ if (c.value !== "single") return !1;
95
+ const e = s.split(`
96
+ `).map((v) => v.trim()).filter(Boolean);
97
+ return new Set(e).size !== e.length;
98
+ }
99
+ function b(s) {
100
+ return /[ \t]/.test(s);
101
+ }
102
+ return T(
103
+ () => a.value.codeConfig.length,
104
+ (s, e) => {
105
+ s != e && (a.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(s))));
106
+ }
107
+ ), T(
108
+ () => a.value.codeConfig.pattern,
109
+ (s, e) => {
110
+ s != e && (a.value.codeConfig.length = (a.value.codeConfig.pattern.match(/#/g) || []).length);
111
+ }
112
+ ), (s, e) => {
113
+ const v = u("FmRadio"), M = u("FmRadioGroup"), m = u("FmSwitch"), L = u("FmStepperField"), X = u("FmSelect"), _ = u("FmTextField"), Z = u("FmTextarea"), ee = u("FmForm"), O = u("FmButton"), oe = u("FmSideSheet");
114
+ return x(), z(oe, {
115
+ "max-width": 560,
116
+ "dismiss-away": !0,
117
+ header: "Create collection",
118
+ modelValue: o(C),
119
+ "onUpdate:modelValue": [
120
+ e[14] || (e[14] = (t) => j(C) ? C.value = t : null),
121
+ e[15] || (e[15] = (t) => C.value = t)
122
+ ]
123
+ }, {
124
+ "side-sheet-footer": I(() => [
125
+ h("div", he, [
126
+ r(O, {
127
+ label: "Save",
128
+ onClick: e[12] || (e[12] = (t) => n(o(a))),
129
+ loading: o(ie)().isLoading
130
+ }, null, 8, ["loading"]),
131
+ r(O, {
132
+ label: "Cancel",
133
+ type: "button",
134
+ variant: "tertiary",
135
+ onClick: e[13] || (e[13] = (t) => C.value = !1)
136
+ })
137
+ ])
138
+ ]),
139
+ default: I(() => [
140
+ r(re, { json: o(a) }, null, 8, ["json"]),
141
+ r(ee, {
142
+ ref_key: "form",
143
+ ref: F,
144
+ class: "space-y-40",
145
+ onValidationSuccess: e[10] || (e[10] = (t) => k.value = !0),
146
+ onValidationFailed: e[11] || (e[11] = (t) => k.value = !1)
147
+ }, {
148
+ default: I(() => [
149
+ h("div", null, [
150
+ e[16] || (e[16] = h("div", { class: "fm-typo-en-body-lg-600" }, "Code type", -1)),
151
+ r(M, {
152
+ modelValue: o(c),
153
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => j(c) ? c.value = t : null),
154
+ inline: !1
155
+ }, {
156
+ default: I(() => [
157
+ (x(), R(N, null, le(E, (t) => r(v, {
158
+ key: t.value,
159
+ value: t.value,
160
+ label: t.label,
161
+ sublabel: t.sublabel
162
+ }, null, 8, ["value", "label", "sublabel"])), 64))
163
+ ]),
164
+ _: 1
165
+ }, 8, ["modelValue"])
166
+ ]),
167
+ h("div", be, [
168
+ e[17] || (e[17] = h("div", { class: "fm-typo-en-body-lg-600" }, "Settings", -1)),
169
+ o(c) === "bulk" ? (x(), R(N, { key: 0 }, [
170
+ r(m, {
171
+ "model-value": o(V),
172
+ "label-placement": "right",
173
+ value: "true",
174
+ label: "Advance code setting",
175
+ required: !0,
176
+ "onUpdate:modelValue": e[1] || (e[1] = () => V.value = !o(V))
177
+ }, null, 8, ["model-value"]),
178
+ o(V) ? (x(), R(N, { key: 0 }, [
179
+ r(L, {
180
+ modelValue: o(a).codeConfig.length,
181
+ "onUpdate:modelValue": e[2] || (e[2] = (t) => o(a).codeConfig.length = t),
182
+ label: "Code length",
183
+ max: 16,
184
+ min: 1,
185
+ rules: [
186
+ (t) => Number(t) >= 1 || "Code length must at least 1",
187
+ (t) => Number(t) <= 16 || "Code length must less than 16"
188
+ ],
189
+ required: !0
190
+ }, null, 8, ["modelValue", "rules"]),
191
+ r(X, {
192
+ label: "Charset",
193
+ "model-value": o(y),
194
+ items: B,
195
+ "helper-text": o(a).codeConfig.charset.length > 62 ? `${o(a).codeConfig.charset.substring(0, 62)}...` : o(a).codeConfig.charset,
196
+ "onUpdate:modelValue": e[3] || (e[3] = (t) => {
197
+ y.value = t, o(a).codeConfig.charset = t;
198
+ })
199
+ }, null, 8, ["model-value", "helper-text"]),
200
+ o(y) === "" ? (x(), z(_, {
201
+ key: 0,
202
+ modelValue: o(a).codeConfig.charset,
203
+ "onUpdate:modelValue": e[4] || (e[4] = (t) => o(a).codeConfig.charset = t),
204
+ label: "Custom Charset",
205
+ required: ""
206
+ }, null, 8, ["modelValue"])) : U("", !0),
207
+ h("div", ve, [
208
+ r(_, {
209
+ modelValue: o(a).codeConfig.prefix,
210
+ "onUpdate:modelValue": e[5] || (e[5] = (t) => o(a).codeConfig.prefix = t),
211
+ label: "Prefix (Optional)"
212
+ }, null, 8, ["modelValue"]),
213
+ r(_, {
214
+ modelValue: o(a).codeConfig.suffix,
215
+ "onUpdate:modelValue": e[6] || (e[6] = (t) => o(a).codeConfig.suffix = t),
216
+ label: "Suffix (Optional)"
217
+ }, null, 8, ["modelValue"])
218
+ ]),
219
+ r(_, {
220
+ modelValue: o(a).codeConfig.pattern,
221
+ "onUpdate:modelValue": e[7] || (e[7] = (t) => o(a).codeConfig.pattern = t),
222
+ label: "Pattern",
223
+ required: !0
224
+ }, null, 8, ["modelValue"])
225
+ ], 64)) : U("", !0),
226
+ r(_, {
227
+ modelValue: o(a).quantity,
228
+ "onUpdate:modelValue": e[8] || (e[8] = (t) => o(a).quantity = t),
229
+ label: "Number of code",
230
+ rules: [
231
+ (t) => t >= 1 || "Quantity cannot be less than 1",
232
+ (t) => t <= 1e4 || "Quantity cannot more than 10,000"
233
+ ],
234
+ required: !0,
235
+ "helper-text": `${o(a).quantity} claim will be created`
236
+ }, null, 8, ["modelValue", "rules", "helper-text"])
237
+ ], 64)) : U("", !0),
238
+ o(c) !== "bulk" ? (x(), z(Z, {
239
+ key: 1,
240
+ modelValue: o(a).code,
241
+ "onUpdate:modelValue": e[9] || (e[9] = (t) => o(a).code = t),
242
+ label: "Custom Code",
243
+ rules: [
244
+ (t) => o(c) != "single" || !!t || "Custom code is required",
245
+ (t) => !l(t) || "Custom code must be unique",
246
+ (t) => !b(t) || "Custom code must not contain space"
247
+ ],
248
+ placeholder: "(For multiple codes, please enter in the new row.)"
249
+ }, null, 8, ["modelValue", "rules"])) : U("", !0)
250
+ ])
251
+ ]),
252
+ _: 1
253
+ }, 512)
254
+ ]),
255
+ _: 1
256
+ }, 8, ["modelValue"]);
257
+ };
258
+ }
259
+ });
260
+ class xe {
261
+ constructor() {
262
+ K(this, "data", []);
263
+ }
264
+ addRecord(i) {
265
+ this.data.push(i);
266
+ }
267
+ buildExcel() {
268
+ const i = $.book_new(), d = $.json_to_sheet(this.data);
269
+ return $.book_append_sheet(i, d, "Collection"), i;
270
+ }
271
+ }
272
+ const Ve = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Se = { class: "flex items-center justify-end py-4 xs:hidden" }, ze = /* @__PURE__ */ H({
273
+ __name: "Collections",
274
+ setup(g) {
275
+ const i = ue(), d = W(), S = f(), w = J(() => d.params.id), F = f(!1), { custom: k } = Q, q = [
276
+ {
277
+ header: "ID/Code",
278
+ accessorKey: "_id",
279
+ cell(n) {
280
+ return Y("div", { class: "flex items-center" }, [
281
+ Y(se.FmIcon, {
282
+ name: "content_copy",
283
+ outline: !0,
284
+ size: "sm",
285
+ class: "cursor-pointer mr-4",
286
+ onClick: (l) => {
287
+ l.preventDefault(), l.stopPropagation(), fe(
288
+ n.row.original.code || n.row.original._id.toString()
289
+ );
290
+ }
291
+ }),
292
+ Y(
293
+ "div",
294
+ { class: "pr-2 text-ellipsis overflow-hidden" },
295
+ n.row.original.code || n.row.original._id.toString()
296
+ )
297
+ ]);
298
+ }
299
+ },
300
+ {
301
+ header: "User",
302
+ accessorKey: "user",
303
+ enableSorting: !1,
304
+ cell(n) {
305
+ const l = n.row.original.pf_user;
306
+ return ce(l);
307
+ }
308
+ },
309
+ {
310
+ header: "Phone",
311
+ accessorFn: (n) => {
312
+ var l;
313
+ return ((l = n.pf_user) == null ? void 0 : l.phoneNumber) || "-";
314
+ },
315
+ accessorKey: "pf_user.phoneNumber"
316
+ },
317
+ {
318
+ header: "Balance",
319
+ accessorKey: "balance"
320
+ },
321
+ {
322
+ header: "Created at",
323
+ accessorKey: "_id",
324
+ accessorFn: (n) => G(Ce(n._id.toString())).format("DD MMM YYYY")
325
+ },
326
+ {
327
+ header: "Nearest expired at",
328
+ accessorKey: "expiryBalance",
329
+ accessorFn: (n) => {
330
+ var l;
331
+ return n.expiryBalance && n.expiryBalance.length ? G((l = n.expiryBalance) == null ? void 0 : l[0].expiredAt).format("DD MMM YYYY") : "Never expires";
332
+ }
333
+ }
334
+ ], C = {
335
+ "$connect-STORE_REWARD_COLLECTIONS": ge.readCollectionsByRewardId,
336
+ "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": P.readCollectionsByCampaignId
337
+ }, D = (n) => {
338
+ const l = C[d.name];
339
+ return (b) => l(n, b);
340
+ }, { tableMeta: a, rowData: E, onSort: B, debouncedFetchData: y, onSearch: c } = me(D(w.value));
341
+ async function V() {
342
+ var n;
343
+ await y(), (n = S.value) == null || n.showSheet(!1);
344
+ }
345
+ async function A() {
346
+ F.value || k(
347
+ async () => {
348
+ var s;
349
+ const n = new xe(), l = (await P.readCollectionsByCampaignId(w.value, {
350
+ limit: 1,
351
+ skip: 0,
352
+ sortBy: p.sortBy,
353
+ descending: p.descending
354
+ })).meta.totalResources ?? 0, b = p.rowsPerPage;
355
+ for (let e = 0; e < l; e += b) {
356
+ const v = {
357
+ ...p,
358
+ limit: b,
359
+ skip: p.page - 1,
360
+ sortBy: p.sortBy,
361
+ descending: p.descending
362
+ }, M = await P.readCollectionsByCampaignId(
363
+ w.value,
364
+ v
365
+ );
366
+ for await (const m of M.resources) {
367
+ const L = {
368
+ Id: (m == null ? void 0 : m.code) || ((s = m._id) == null ? void 0 : s.toString()) || "",
369
+ Balance: (m == null ? void 0 : m.balance) || 0
370
+ };
371
+ n.addRecord(L);
372
+ }
373
+ p.page++;
374
+ }
375
+ await de(
376
+ n.buildExcel(),
377
+ `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
378
+ {
379
+ bookType: "xlsx",
380
+ bookSST: !1,
381
+ type: "array"
382
+ }
383
+ ), p.page = 1;
384
+ },
385
+ {
386
+ isLoading: F
387
+ }
388
+ );
389
+ }
390
+ return ne(async () => {
391
+ await y();
392
+ }), (n, l) => {
393
+ const b = u("FmPageHead"), s = u("FmSearch");
394
+ return x(), R(N, null, [
395
+ r(b, {
396
+ title: "Collections",
397
+ "back-button": !0,
398
+ actions: [
399
+ { label: "Export", value: "export", isPrimary: !1 },
400
+ {
401
+ label: "Create collection",
402
+ value: "create",
403
+ isPrimary: !0
404
+ }
405
+ ],
406
+ "onClick:back": l[0] || (l[0] = (e) => o(i).back()),
407
+ "onClick:action": l[1] || (l[1] = (e) => {
408
+ var v;
409
+ e === "create" && ((v = o(S)) == null || v.showSheet(!0)), e === "export" && A();
410
+ })
411
+ }),
412
+ h("div", Ve, [
413
+ r(s, {
414
+ class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
415
+ modelValue: o(a).searchValue,
416
+ "onUpdate:modelValue": [
417
+ l[2] || (l[2] = (e) => o(a).searchValue = e),
418
+ o(c)
419
+ ],
420
+ placeholder: "Search",
421
+ collapsible: ""
422
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
423
+ h("div", Se, [
424
+ r(s, {
425
+ modelValue: o(a).searchValue,
426
+ "onUpdate:modelValue": [
427
+ l[3] || (l[3] = (e) => o(a).searchValue = e),
428
+ o(c)
429
+ ],
430
+ placeholder: "Search",
431
+ collapsible: ""
432
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
433
+ ]),
434
+ r(pe, {
435
+ loading: o(a).isLoading,
436
+ "row-data": o(E),
437
+ "column-defs": q,
438
+ "row-count": o(a).totalRows,
439
+ "page-count": o(a).pageCount,
440
+ "page-index": o(a).pageIndex,
441
+ "page-size": o(a).pageSize,
442
+ "shrink-at": !1,
443
+ onSortChange: o(B),
444
+ onPageChange: l[4] || (l[4] = (e) => o(y)({ pageSize: e.pageSize, pageIndex: e.pageIndex }))
445
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
446
+ r(ye, {
447
+ ref_key: "sheetRef",
448
+ ref: S,
449
+ onSuccess: V
450
+ }, null, 512)
451
+ ])
452
+ ], 64);
453
+ };
454
+ }
455
+ });
456
+ export {
457
+ ze as default
458
+ };