@feedmepos/mf-connect 0.1.38-beta.6 → 0.1.38-beta.60

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 (130) hide show
  1. package/package.json +13 -5
  2. package/dist/Analytic-NBx32reB.js +0 -761
  3. package/dist/App-CaK9PvMd.js +0 -4632
  4. package/dist/AuditLogs-C-gCCPvF.js +0 -1887
  5. package/dist/Bin-CL6o1JSs.js +0 -166
  6. package/dist/Broadcast-B2-itjvZ.js +0 -227
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BIySMYGP.js +0 -121
  8. package/dist/Card-DNdEjt6s.js +0 -905
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-DepGq6WJ.js +0 -465
  11. package/dist/Credit-D7K0gFwc.js +0 -222
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-HMjbuy2C.js +0 -2185
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DrbMJlm5.js +0 -347
  16. package/dist/Experience-FlBX3eyN.js +0 -223
  17. package/dist/FileSaver.min-NlMItPOc.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  19. package/dist/Game-Cc3D7lKV.js +0 -278
  20. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js +0 -144
  21. package/dist/Index-2wokhhFB.js +0 -259
  22. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  23. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js +0 -18737
  24. package/dist/MainLayout-B1aJoR95.js +0 -41
  25. package/dist/Marketing-D7PXYloN.js +0 -20073
  26. package/dist/Member-2xV4Izwa.js +0 -279
  27. package/dist/MemberList-CYgBdyJt.js +0 -1606
  28. package/dist/MemberOverview-wL_ailso.js +0 -58
  29. package/dist/MemberTransactions-DWDV01N4.js +0 -45
  30. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-Becsw31k.js +0 -60343
  31. package/dist/Mission-BSGc9822.js +0 -296
  32. package/dist/Overview-BZjto86d.js +0 -1079
  33. package/dist/Point-0U4TTdPW.js +0 -226
  34. package/dist/Promotion-DiUa0GcV.js +0 -289
  35. package/dist/Queue-D62r2qjy.js +0 -260
  36. package/dist/Record-0iF3dG7y.js +0 -341
  37. package/dist/Reward-C5IEJYu6.js +0 -442
  38. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-S2Fd0qO8.js +0 -150
  39. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CxlamGFP.js +0 -1751
  40. package/dist/Segment-BknjBrUP.js +0 -882
  41. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BLQlkp-j.js +0 -181
  42. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-CaPi4hYB.js +0 -188
  43. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-BoZ0ZpNZ.js +0 -147
  44. package/dist/Setting-RLI7RgmN.js +0 -1936
  45. package/dist/Store-gxmv8hWJ.js +0 -1842
  46. package/dist/StoreRewards-C_6gY_Nk.js +0 -423
  47. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B5uzSYM4.js +0 -1029
  48. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-yjI96ZL0.js +0 -139
  49. package/dist/Tier-B168DtFj.js +0 -888
  50. package/dist/Title-uH0RI1N3.js +0 -565
  51. package/dist/Transaction-Bx-pmLrJ.js +0 -39
  52. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Ce_55V7l.js +0 -130
  53. package/dist/Voucher-Dzpz2AEB.js +0 -384
  54. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-dbA6_6b9.js +0 -419
  55. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CfLiUj9f.js +0 -56
  56. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  57. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  58. package/dist/app-B90wINOO.js +0 -33357
  59. package/dist/app-DuUxQ1ZP.js +0 -7086
  60. package/dist/app-wDQR6dpb.js +0 -39
  61. package/dist/app.js +0 -7
  62. package/dist/business-B65OtB5B.js +0 -79
  63. package/dist/campaign-CpzFl8Vr.js +0 -4
  64. package/dist/campaign-iKI-L84v.js +0 -1810
  65. package/dist/campaign-qGy6uzrC.js +0 -96
  66. package/dist/campaign.enum-CZp2DmXI.js +0 -20
  67. package/dist/campaign.fn-DKScnmjX.js +0 -758
  68. package/dist/collectible.enum-CN-lnG1m.js +0 -19
  69. package/dist/collection.fn-mMwGQWce.js +0 -26
  70. package/dist/dto-C5ri8Nws.js +0 -214
  71. package/dist/effect-Bg3yb9T6.js +0 -78
  72. package/dist/email-addresses-CQsN724N.js +0 -705
  73. package/dist/export-BLf2dhFd.js +0 -97
  74. package/dist/feedme.ico +0 -0
  75. package/dist/helper-CFaph16Q.js +0 -71
  76. package/dist/index-BBPIZjw6.js +0 -31
  77. package/dist/index-BCGDOgxb.js +0 -38
  78. package/dist/index-BCPBmANe.js +0 -3120
  79. package/dist/index-BKOgzVx6.js +0 -32
  80. package/dist/index-BN2Uyvj4.js +0 -30038
  81. package/dist/index-BPZtjcTm.js +0 -76
  82. package/dist/index-BPyac0fq.js +0 -56
  83. package/dist/index-BkySejFg.js +0 -54
  84. package/dist/index-CH2d_B8c.js +0 -121
  85. package/dist/index-CrbnfAk8.js +0 -8861
  86. package/dist/index-CsaQJMAR.js +0 -66
  87. package/dist/index-DJwQICyC.js +0 -146
  88. package/dist/index-DaEQgaiW.js +0 -2213
  89. package/dist/index-Dkmn0jmX.js +0 -32260
  90. package/dist/index-Dy5p_b1S.js +0 -3
  91. package/dist/index-vh86FiIQ.js +0 -10
  92. package/dist/index.esm2017-B9vJTKYg.js +0 -3069
  93. package/dist/loading-MEQuW9Xa.js +0 -71
  94. package/dist/lodash-B5I3zXaY.js +0 -3678
  95. package/dist/membership-Du79A0Pl.js +0 -235
  96. package/dist/moment-BWErdI6_.js +0 -2578
  97. package/dist/money-DXgYs2-R.js +0 -15
  98. package/dist/number-CBMkNZvH.js +0 -12
  99. package/dist/object-qECH92oz.js +0 -26
  100. package/dist/objectId-dwaoBfJX.js +0 -7
  101. package/dist/objectid-BeZTZYqi.js +0 -145
  102. package/dist/plugins-KiMuDTPp.js +0 -208
  103. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  104. package/dist/reward-ClX_lWcQ.js +0 -36
  105. package/dist/rule-BfidJ75Y.js +0 -1951
  106. package/dist/rule-builder-BTcZx77a.js +0 -89
  107. package/dist/style.css +0 -4
  108. package/dist/template-DPpMK30W.js +0 -190
  109. package/dist/tier-BJDhpH6X.js +0 -4
  110. package/dist/tiers/tier=1.png +0 -0
  111. package/dist/tiers/tier=2.png +0 -0
  112. package/dist/tiers/tier=3.png +0 -0
  113. package/dist/tiers/tier=4.png +0 -0
  114. package/dist/titles/type=diamond.png +0 -0
  115. package/dist/titles/type=drinks.png +0 -0
  116. package/dist/titles/type=food.png +0 -0
  117. package/dist/titles/type=heart.png +0 -0
  118. package/dist/titles/type=medal.png +0 -0
  119. package/dist/titles/type=spend.png +0 -0
  120. package/dist/titles/type=thank-you.png +0 -0
  121. package/dist/titles/type=thumbs-up.png +0 -0
  122. package/dist/titles/type=years.png +0 -0
  123. package/dist/trigger-DLp1bkZP.js +0 -144
  124. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  125. package/dist/type_drinks-D6jnpvwV.js +0 -4
  126. package/dist/usePagination-BeF5K3M7.js +0 -223
  127. package/dist/user-Cq9CGBHZ.js +0 -54
  128. package/dist/vue-i18n-COzqUgQy.js +0 -2365
  129. package/dist/xlsx-Be4bARvl.js +0 -15491
  130. package/dist/zod-Bg2FbC-D.js +0 -90
@@ -1,97 +0,0 @@
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
- };
@@ -1,465 +0,0 @@
1
- var ae = Object.defineProperty;
2
- var le = (g, i, d) => i in g ? ae(g, i, { enumerable: !0, configurable: !0, writable: !0, value: d }) : g[i] = d;
3
- var O = (g, i, d) => le(g, typeof i != "symbol" ? i + "" : i, d);
4
- import { defineComponent as J, ref as f, computed as Q, watch as K, resolveComponent as u, openBlock as y, createBlock as z, unref as o, isRef as j, withCtx as I, createElementVNode as h, createVNode as r, createElementBlock as N, Fragment as P, renderList as ne, createCommentVNode as R, onMounted as se, h as S } from "vue";
5
- import { h as G } from "./moment-BWErdI6_.js";
6
- import { components as H } from "@feedmepos/ui-library";
7
- import "./index-Dkmn0jmX.js";
8
- import { J as re } from "./JsonViewer-v8_C7l5N.js";
9
- import { u as W } from "./loading-MEQuW9Xa.js";
10
- import { u as ie } from "./app-wDQR6dpb.js";
11
- import { useRoute as X, useRouter as ue } from "vue-router";
12
- import { c as q } from "./index-CH2d_B8c.js";
13
- import { e as p } from "./index-vh86FiIQ.js";
14
- import { u as Y, w as de } from "./xlsx-Be4bARvl.js";
15
- import { u as ce, _ as me } from "./usePagination-BeF5K3M7.js";
16
- import { a as pe } from "./plugins-KiMuDTPp.js";
17
- import { m as fe } from "./index-DJwQICyC.js";
18
- import { o as ge } from "./objectId-dwaoBfJX.js";
19
- const be = { class: "space-y-16" }, Ce = { class: "gap-16 grid grid-cols-2" }, ve = { class: "flex items-center gap-8" }, he = /* @__PURE__ */ J({
20
- __name: "CreateCollectionSheet",
21
- emits: ["success"],
22
- setup(g, { expose: i, emit: d }) {
23
- const { minor: w } = W, F = X(), k = f(), _ = f(!1), A = d, b = f(!1);
24
- function D(s) {
25
- b.value = s, s && (a.value = {
26
- quantity: 1,
27
- code: "",
28
- codeConfig: {
29
- length: 8,
30
- charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
31
- prefix: "",
32
- suffix: "",
33
- pattern: "########"
34
- }
35
- });
36
- }
37
- const a = f({
38
- quantity: 1,
39
- code: "",
40
- codeConfig: {
41
- length: 8,
42
- charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
43
- prefix: "",
44
- suffix: "",
45
- pattern: "########"
46
- }
47
- }), E = [
48
- {
49
- label: "Bulk codes",
50
- value: "bulk",
51
- sublabel: "Bulk generate unique codes"
52
- },
53
- {
54
- label: "Custom code",
55
- value: "single",
56
- sublabel: "Enter your own custom codes"
57
- }
58
- ], U = [
59
- {
60
- label: "Alphanumeric",
61
- value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
62
- },
63
- {
64
- label: "Alphabetic",
65
- value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
66
- },
67
- { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
68
- { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
69
- { label: "Numbers", value: "0123456789" },
70
- { label: "Custom", value: "" }
71
- ], x = f(U[0].value), c = f("bulk"), V = f(!1), M = Q(() => F.params.id);
72
- async function n(s) {
73
- var e;
74
- await ((e = k.value) == null ? void 0 : e.validateInputs()), _.value && await w(
75
- async () => {
76
- await q.createCollectionByCampaignId(M.value, s), await A("success");
77
- },
78
- {
79
- message: "Creating claim(s)",
80
- successMessage: "Claim(s) created"
81
- }
82
- );
83
- }
84
- i({
85
- showSheet: D
86
- }), K(
87
- () => c.value,
88
- (s, e) => {
89
- 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 = "########");
90
- }
91
- );
92
- function l(s) {
93
- if (c.value !== "single") return !1;
94
- const e = s.split(`
95
- `).map((v) => v.trim()).filter(Boolean);
96
- return new Set(e).size !== e.length;
97
- }
98
- function C(s) {
99
- return /[ \t]/.test(s);
100
- }
101
- return K(
102
- () => a.value.codeConfig.length,
103
- (s, e) => {
104
- s != e && (a.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(s))));
105
- }
106
- ), (s, e) => {
107
- const v = u("FmRadio"), L = u("FmRadioGroup"), m = u("FmSwitch"), T = u("FmStepperField"), Z = u("FmSelect"), B = u("FmTextField"), ee = u("FmTextarea"), oe = u("FmForm"), $ = u("FmButton"), te = u("FmSideSheet");
108
- return y(), z(te, {
109
- "max-width": 560,
110
- "dismiss-away": !0,
111
- header: "Create collection",
112
- modelValue: o(b),
113
- "onUpdate:modelValue": [
114
- e[14] || (e[14] = (t) => j(b) ? b.value = t : null),
115
- e[15] || (e[15] = (t) => b.value = t)
116
- ]
117
- }, {
118
- "side-sheet-footer": I(() => [
119
- h("div", ve, [
120
- r($, {
121
- label: "Save",
122
- onClick: e[12] || (e[12] = (t) => n(o(a))),
123
- loading: o(ie)().isLoading
124
- }, null, 8, ["loading"]),
125
- r($, {
126
- label: "Cancel",
127
- type: "button",
128
- variant: "tertiary",
129
- onClick: e[13] || (e[13] = (t) => b.value = !1)
130
- })
131
- ])
132
- ]),
133
- default: I(() => [
134
- r(re, { json: o(a) }, null, 8, ["json"]),
135
- r(oe, {
136
- ref_key: "form",
137
- ref: k,
138
- class: "space-y-40",
139
- onValidationSuccess: e[10] || (e[10] = (t) => _.value = !0),
140
- onValidationFailed: e[11] || (e[11] = (t) => _.value = !1)
141
- }, {
142
- default: I(() => [
143
- h("div", null, [
144
- e[16] || (e[16] = h("div", { class: "fm-typo-en-body-lg-600" }, "Code type", -1)),
145
- r(L, {
146
- modelValue: o(c),
147
- "onUpdate:modelValue": e[0] || (e[0] = (t) => j(c) ? c.value = t : null),
148
- inline: !1
149
- }, {
150
- default: I(() => [
151
- (y(), N(P, null, ne(E, (t) => r(v, {
152
- key: t.value,
153
- value: t.value,
154
- label: t.label,
155
- sublabel: t.sublabel
156
- }, null, 8, ["value", "label", "sublabel"])), 64))
157
- ]),
158
- _: 1
159
- }, 8, ["modelValue"])
160
- ]),
161
- h("div", be, [
162
- e[17] || (e[17] = h("div", { class: "fm-typo-en-body-lg-600" }, "Settings", -1)),
163
- o(c) === "bulk" ? (y(), N(P, { key: 0 }, [
164
- r(m, {
165
- "model-value": o(V),
166
- "label-placement": "right",
167
- value: "true",
168
- label: "Advance code setting",
169
- required: !0,
170
- "onUpdate:modelValue": e[1] || (e[1] = () => V.value = !o(V))
171
- }, null, 8, ["model-value"]),
172
- o(V) ? (y(), N(P, { key: 0 }, [
173
- r(T, {
174
- modelValue: o(a).codeConfig.length,
175
- "onUpdate:modelValue": e[2] || (e[2] = (t) => o(a).codeConfig.length = t),
176
- label: "Code length",
177
- max: 16,
178
- min: 1,
179
- rules: [
180
- (t) => Number(t) >= 1 || "Code length must at least 1",
181
- (t) => Number(t) <= 16 || "Code length must less than 16"
182
- ],
183
- required: !0
184
- }, null, 8, ["modelValue", "rules"]),
185
- r(Z, {
186
- label: "Charset",
187
- "model-value": o(x),
188
- items: U,
189
- "helper-text": o(a).codeConfig.charset.length > 62 ? `${o(a).codeConfig.charset.substring(0, 62)}...` : o(a).codeConfig.charset,
190
- "onUpdate:modelValue": e[3] || (e[3] = (t) => {
191
- x.value = t, o(a).codeConfig.charset = t;
192
- })
193
- }, null, 8, ["model-value", "helper-text"]),
194
- o(x) === "" ? (y(), z(B, {
195
- key: 0,
196
- modelValue: o(a).codeConfig.charset,
197
- "onUpdate:modelValue": e[4] || (e[4] = (t) => o(a).codeConfig.charset = t),
198
- label: "Custom Charset",
199
- required: ""
200
- }, null, 8, ["modelValue"])) : R("", !0),
201
- h("div", Ce, [
202
- r(B, {
203
- modelValue: o(a).codeConfig.prefix,
204
- "onUpdate:modelValue": e[5] || (e[5] = (t) => o(a).codeConfig.prefix = t),
205
- label: "Prefix (Optional)"
206
- }, null, 8, ["modelValue"]),
207
- r(B, {
208
- modelValue: o(a).codeConfig.suffix,
209
- "onUpdate:modelValue": e[6] || (e[6] = (t) => o(a).codeConfig.suffix = t),
210
- label: "Suffix (Optional)"
211
- }, null, 8, ["modelValue"])
212
- ]),
213
- r(B, {
214
- modelValue: o(a).codeConfig.pattern,
215
- "onUpdate:modelValue": e[7] || (e[7] = (t) => o(a).codeConfig.pattern = t),
216
- label: "Pattern",
217
- required: !0
218
- }, null, 8, ["modelValue"])
219
- ], 64)) : R("", !0),
220
- r(B, {
221
- modelValue: o(a).quantity,
222
- "onUpdate:modelValue": e[8] || (e[8] = (t) => o(a).quantity = t),
223
- label: "Number of code",
224
- rules: [
225
- (t) => t >= 1 || "Quantity cannot be less than 1",
226
- (t) => t <= 1e4 || "Quantity cannot more than 10,000"
227
- ],
228
- required: !0,
229
- "helper-text": `${o(a).quantity} claim will be created`
230
- }, null, 8, ["modelValue", "rules", "helper-text"])
231
- ], 64)) : R("", !0),
232
- o(c) !== "bulk" ? (y(), z(ee, {
233
- key: 1,
234
- modelValue: o(a).code,
235
- "onUpdate:modelValue": e[9] || (e[9] = (t) => o(a).code = t),
236
- label: "Custom Code",
237
- rules: [
238
- (t) => o(c) != "single" || !!t || "Custom code is required",
239
- (t) => !l(t) || "Custom code must be unique",
240
- (t) => !C(t) || "Custom code must not contain space"
241
- ],
242
- placeholder: "(For multiple codes, please enter in the new row.)"
243
- }, null, 8, ["modelValue", "rules"])) : R("", !0)
244
- ])
245
- ]),
246
- _: 1
247
- }, 512)
248
- ]),
249
- _: 1
250
- }, 8, ["modelValue"]);
251
- };
252
- }
253
- });
254
- class xe {
255
- constructor() {
256
- O(this, "data", []);
257
- }
258
- addRecord(i) {
259
- this.data.push(i);
260
- }
261
- buildExcel() {
262
- const i = Y.book_new(), d = Y.json_to_sheet(this.data);
263
- return Y.book_append_sheet(i, d, "Collection"), i;
264
- }
265
- }
266
- const ye = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Ve = { class: "flex items-center justify-end py-4 xs:hidden" }, Le = /* @__PURE__ */ J({
267
- __name: "Collections",
268
- setup(g) {
269
- const i = ue(), d = X(), w = f(), F = Q(() => d.params.id), k = f(!1), { custom: _ } = W, A = [
270
- {
271
- header: "ID/Code",
272
- accessorKey: "_id",
273
- cell(n) {
274
- return S("div", { class: "flex items-center" }, [
275
- S(H.FmIcon, {
276
- name: "content_copy",
277
- outline: !0,
278
- size: "sm",
279
- class: "cursor-pointer mr-4",
280
- onClick: (l) => {
281
- l.preventDefault(), l.stopPropagation(), pe(
282
- n.row.original.code || n.row.original._id.toString()
283
- );
284
- }
285
- }),
286
- S(
287
- "div",
288
- { class: "pr-2 text-ellipsis overflow-hidden" },
289
- n.row.original.code || n.row.original._id.toString()
290
- )
291
- ]);
292
- }
293
- },
294
- {
295
- header: "User",
296
- accessorKey: "user",
297
- enableSorting: !1,
298
- cell(n) {
299
- const l = n.row.original.pf_user;
300
- return S(
301
- "div",
302
- {
303
- class: "flex items-center gap-x-8"
304
- },
305
- [
306
- S(H.FmAvatar, {
307
- name: l != null && l.photoUrl || l == null ? void 0 : l.name,
308
- src: (l == null ? void 0 : l.photoUrl) ?? void 0,
309
- size: "sm"
310
- }),
311
- S("span", l == null ? void 0 : l.name)
312
- ]
313
- );
314
- }
315
- },
316
- {
317
- header: "Phone",
318
- accessorFn: (n) => {
319
- var l;
320
- return ((l = n.pf_user) == null ? void 0 : l.phoneNumber) || "-";
321
- },
322
- accessorKey: "pf_user.phoneNumber"
323
- },
324
- {
325
- header: "Balance",
326
- accessorKey: "balance"
327
- },
328
- {
329
- header: "Created at",
330
- accessorKey: "_id",
331
- accessorFn: (n) => G(ge(n._id.toString())).format("DD MMM YYYY")
332
- },
333
- {
334
- header: "Nearest expired at",
335
- accessorKey: "expiryBalance",
336
- accessorFn: (n) => {
337
- var l;
338
- return n.expiryBalance && n.expiryBalance.length ? G((l = n.expiryBalance) == null ? void 0 : l[0].expiredAt).format("DD MMM YYYY") : "Never expires";
339
- }
340
- }
341
- ], b = {
342
- "$connect-STORE_REWARD_COLLECTIONS": fe.readCollectionsByRewardId,
343
- "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": q.readCollectionsByCampaignId
344
- }, D = (n) => {
345
- const l = b[d.name];
346
- return (C) => l(n, C);
347
- }, { tableMeta: a, rowData: E, onSort: U, debouncedFetchData: x, onSearch: c } = ce(D(F.value));
348
- async function V() {
349
- var n;
350
- await x(), (n = w.value) == null || n.showSheet(!1);
351
- }
352
- async function M() {
353
- k.value || _(
354
- async () => {
355
- var s;
356
- const n = new xe(), l = (await q.readCollectionsByCampaignId(F.value, {
357
- limit: 1,
358
- skip: 0,
359
- sortBy: p.sortBy,
360
- descending: p.descending
361
- })).meta.totalResources ?? 0, C = p.rowsPerPage;
362
- for (let e = 0; e < l; e += C) {
363
- const v = {
364
- ...p,
365
- limit: C,
366
- skip: p.page - 1,
367
- sortBy: p.sortBy,
368
- descending: p.descending
369
- }, L = await q.readCollectionsByCampaignId(
370
- F.value,
371
- v
372
- );
373
- for await (const m of L.resources) {
374
- const T = {
375
- Id: (m == null ? void 0 : m.code) || ((s = m._id) == null ? void 0 : s.toString()) || "",
376
- Balance: (m == null ? void 0 : m.balance) || 0
377
- };
378
- n.addRecord(T);
379
- }
380
- p.page++;
381
- }
382
- await de(
383
- n.buildExcel(),
384
- `members-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
385
- {
386
- bookType: "xlsx",
387
- bookSST: !1,
388
- type: "array"
389
- }
390
- ), p.page = 1;
391
- },
392
- {
393
- isLoading: k
394
- }
395
- );
396
- }
397
- return se(async () => {
398
- await x();
399
- }), (n, l) => {
400
- const C = u("FmPageHead"), s = u("FmSearch");
401
- return y(), N(P, null, [
402
- r(C, {
403
- title: "Collections",
404
- "back-button": !0,
405
- actions: [
406
- { label: "Export", value: "export", isPrimary: !1 },
407
- {
408
- label: "Create collection",
409
- value: "create",
410
- isPrimary: !0
411
- }
412
- ],
413
- "onClick:back": l[0] || (l[0] = (e) => o(i).back()),
414
- "onClick:action": l[1] || (l[1] = (e) => {
415
- var v;
416
- e === "create" && ((v = o(w)) == null || v.showSheet(!0)), e === "export" && M();
417
- })
418
- }),
419
- h("div", ye, [
420
- r(s, {
421
- class: "hidden xs:flex border-b border-fm-color-neutral-gray-100",
422
- modelValue: o(a).searchValue,
423
- "onUpdate:modelValue": [
424
- l[2] || (l[2] = (e) => o(a).searchValue = e),
425
- o(c)
426
- ],
427
- placeholder: "Search",
428
- collapsible: ""
429
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
430
- h("div", Ve, [
431
- r(s, {
432
- modelValue: o(a).searchValue,
433
- "onUpdate:modelValue": [
434
- l[3] || (l[3] = (e) => o(a).searchValue = e),
435
- o(c)
436
- ],
437
- placeholder: "Search",
438
- collapsible: ""
439
- }, null, 8, ["modelValue", "onUpdate:modelValue"])
440
- ]),
441
- r(me, {
442
- loading: o(a).isLoading,
443
- "row-data": o(E),
444
- "column-defs": A,
445
- "row-count": o(a).totalRows,
446
- "page-count": o(a).pageCount,
447
- "page-index": o(a).pageIndex,
448
- "page-size": o(a).pageSize,
449
- "shrink-at": !1,
450
- onSortChange: o(U),
451
- onPageChange: l[4] || (l[4] = (e) => o(x)({ pageSize: e.pageSize, pageIndex: e.pageIndex }))
452
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
453
- r(he, {
454
- ref_key: "sheetRef",
455
- ref: w,
456
- onSuccess: V
457
- }, null, 512)
458
- ])
459
- ], 64);
460
- };
461
- }
462
- });
463
- export {
464
- Le as default
465
- };