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

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 (148) hide show
  1. package/dist/{Analytic-NBx32reB.js → Analytic-CM7mh-iO.js} +16 -16
  2. package/dist/{App-CaK9PvMd.js → App-CeCzzsDu.js} +625 -619
  3. package/dist/AuditLogs-VWx8DFKA.js +1991 -0
  4. package/dist/{Bin-CL6o1JSs.js → Bin-vUuol_I9.js} +10 -10
  5. package/dist/Broadcast-6VXz4-IG.js +233 -0
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BIySMYGP.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CV-zhJ15.js} +6 -6
  7. package/dist/{Card-DNdEjt6s.js → Card-CeIeGET1.js} +144 -140
  8. package/dist/Collections-CF_OcAL3.js +540 -0
  9. package/dist/Credit-BUqGOyp_.js +226 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BUzUIIUW.js → DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0DMFuBoG.js +3150 -0
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-BZfchHlT.js +347 -0
  14. package/dist/Experience-BxiFH_uV.js +225 -0
  15. package/dist/{FileSaver.min-NlMItPOc.js → FileSaver.min-lgg_oBvT.js} +1 -1
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  17. package/dist/Game-BzYW0LfY.js +300 -0
  18. package/dist/GenerateMaterial-B5A7mx2y.js +589 -0
  19. package/dist/Grab-BgiMqwvj.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js → ImageInput.vue_vue_type_script_setup_true_lang-DZ8DHrQ_.js} +49 -48
  21. package/dist/{Index-2wokhhFB.js → Index-B85ops8K.js} +54 -54
  22. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js → LottieAnimation.vue_vue_type_script_setup_true_lang-B5rIjxYd.js} +1 -1
  23. package/dist/{MainLayout-B1aJoR95.js → MainLayout-CXGVkD-W.js} +1 -1
  24. package/dist/Marketing-Bnijl7lA.js +145 -0
  25. package/dist/MarketingMaterialEdit-BlUKwSoP.js +746 -0
  26. package/dist/{Member-2xV4Izwa.js → Member-sT853g51.js} +38 -37
  27. package/dist/{MemberList-CYgBdyJt.js → MemberList-DYT5_fSP.js} +158 -159
  28. package/dist/{MemberTransactions-DWDV01N4.js → MemberTransactions-Cqce5ebe.js} +1 -1
  29. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Becsw31k.js → MessageInput.vue_vue_type_script_setup_true_lang-Dq0Hswj8.js} +5940 -5668
  30. package/dist/Mission-Q5_sGgrm.js +304 -0
  31. package/dist/{Overview-BZjto86d.js → Overview-B0rwrHR1.js} +24 -25
  32. package/dist/Point-BGYFMvev.js +228 -0
  33. package/dist/Promotion-0acd63nA.js +364 -0
  34. package/dist/{Queue-D62r2qjy.js → Queue-SVqRUlD_.js} +14 -15
  35. package/dist/{Record-0iF3dG7y.js → Record-BTjg4ihy.js} +10 -10
  36. package/dist/{Reward-C5IEJYu6.js → Reward-DW58VMRO.js} +16 -16
  37. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-S2Fd0qO8.js → RewardGroup.vue_vue_type_script_setup_true_lang-s1RI55Rc.js} +13 -14
  38. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Os17lXBX.js +1766 -0
  39. package/dist/{Segment-BknjBrUP.js → Segment-Dny8pxP1.js} +273 -274
  40. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-BLQlkp-j.js → SelectItems.vue_vue_type_script_setup_true_lang-Czx7rqiq.js} +12 -12
  41. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CaPi4hYB.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-EgVxUG_N.js} +12 -12
  42. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BoZ0ZpNZ.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CO0fgI3K.js} +4 -4
  43. package/dist/Setting-CjcnxK34.js +1992 -0
  44. package/dist/SettingAdvertisements-CIyDF4C8.js +263 -0
  45. package/dist/Store-B8k5YVqU.js +1934 -0
  46. package/dist/StoreRewards-BW08rwpL.js +534 -0
  47. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BfFSfE2H.js +1034 -0
  48. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CZkKjUNQ.js +8093 -0
  49. package/dist/{Tier-B168DtFj.js → Tier-DKzu4tYw.js} +561 -480
  50. package/dist/{Title-uH0RI1N3.js → Title-BK-TXatJ.js} +149 -147
  51. package/dist/{Transaction-Bx-pmLrJ.js → Transaction-Duayg1jd.js} +2 -2
  52. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Ce_55V7l.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BAR9h1TV.js} +7 -7
  53. package/dist/{Voucher-Dzpz2AEB.js → Voucher-BEVAkNeJ.js} +140 -124
  54. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DvFy9Z6X.js +421 -0
  55. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CfLiUj9f.js → ZodTextField.vue_vue_type_script_setup_true_lang-CU_Sx2PM.js} +2 -2
  56. package/dist/app-IvbII0ql.js +45026 -0
  57. package/dist/app.js +1 -1
  58. package/dist/{business-B65OtB5B.js → business-BFIwFfkq.js} +11 -8
  59. package/dist/campaign-RuIwxc4y.js +253 -0
  60. package/dist/{campaign-qGy6uzrC.js → campaign-w9j4I4jn.js} +29 -25
  61. package/dist/{campaign.enum-CZp2DmXI.js → campaign.enum-IHLsfdik.js} +3 -2
  62. package/dist/campaign.fn-B_P1MkRV.js +776 -0
  63. package/dist/{collectible.enum-CN-lnG1m.js → collectible.enum-CUgSjO08.js} +1 -1
  64. package/dist/{collection.fn-mMwGQWce.js → collection.fn-CrfnNb41.js} +2 -2
  65. package/dist/dto-jwO_sX9I.js +222 -0
  66. package/dist/{effect-Bg3yb9T6.js → effect--0g8PNyt.js} +1 -1
  67. package/dist/{email-addresses-CQsN724N.js → email-addresses-HtsxvXw9.js} +2 -2
  68. package/dist/{export-BLf2dhFd.js → export-CFEwMRmd.js} +9 -10
  69. package/dist/{helper-CFaph16Q.js → helper-CCfb24PO.js} +22 -7
  70. package/dist/index-B-AMMFfT.js +3419 -0
  71. package/dist/{index-BPyac0fq.js → index-BR3UbZ0F.js} +1 -1
  72. package/dist/{index-Dy5p_b1S.js → index-BZEM0T2A.js} +1 -1
  73. package/dist/index-Bflu4Rft.js +8884 -0
  74. package/dist/{index-Dkmn0jmX.js → index-CR3f3BXQ.js} +2552 -2356
  75. package/dist/{index-BkySejFg.js → index-CZPcwcUo.js} +3 -3
  76. package/dist/{index-BPZtjcTm.js → index-CkuPY85X.js} +1 -1
  77. package/dist/index-CppLPpqB.js +30933 -0
  78. package/dist/index-CuvNtC_M.js +61 -0
  79. package/dist/{index-BKOgzVx6.js → index-DDYH-IEX.js} +1 -1
  80. package/dist/{index-DaEQgaiW.js → index-DdZdHioZ.js} +455 -245
  81. package/dist/{index-BBPIZjw6.js → index-Dic_WcAL.js} +3 -3
  82. package/dist/{index-CH2d_B8c.js → index-DpjYgKTN.js} +4 -1
  83. package/dist/index-wzSeRJAd.js +36 -0
  84. package/dist/{index.esm2017-B9vJTKYg.js → index.esm2017-CUnjzfU-.js} +89 -89
  85. package/dist/loading-CivgDw5C.js +215 -0
  86. package/dist/{lodash-B5I3zXaY.js → lodash-BSbv_9TG.js} +1 -1
  87. package/dist/{membership-Du79A0Pl.js → membership-j2w1YUO-.js} +3 -3
  88. package/dist/{moment-BWErdI6_.js → moment-D7p2TMB-.js} +6 -1
  89. package/dist/{money-DXgYs2-R.js → money-DL-x8hiT.js} +1 -1
  90. package/dist/{number-CBMkNZvH.js → number-D1yoFGEr.js} +1 -1
  91. package/dist/objectid-CHab6j3r.js +145 -0
  92. package/dist/{campaign-iKI-L84v.js → plugins-P-V4XWmW.js} +784 -777
  93. package/dist/remy-D_Deb3ue.js +13 -0
  94. package/dist/{reward-ClX_lWcQ.js → reward-BqMlBQRu.js} +1 -1
  95. package/dist/{rule-BfidJ75Y.js → rule-CztsLdki.js} +4 -4
  96. package/dist/rule-builder-DANv7Rmz.js +102 -0
  97. package/dist/style.css +11 -2
  98. package/dist/template-Dbz3FhHK.js +188 -0
  99. package/dist/timezone-BgVqObBq.js +1151 -0
  100. package/dist/trigger-CbriUibd.js +213 -0
  101. package/dist/usePagination-DtNK7W0U.js +223 -0
  102. package/dist/user-CVapqHfr.js +55 -0
  103. package/dist/vue-i18n-tpDAnnmD.js +2365 -0
  104. package/dist/{xlsx-Be4bARvl.js → xlsx-EewcN2uY.js} +1 -1
  105. package/dist/{zod-Bg2FbC-D.js → zod-D-wiCQRJ.js} +32 -31
  106. package/package.json +13 -5
  107. package/dist/AuditLogs-C-gCCPvF.js +0 -1887
  108. package/dist/Broadcast-B2-itjvZ.js +0 -227
  109. package/dist/Collections-DepGq6WJ.js +0 -465
  110. package/dist/Credit-D7K0gFwc.js +0 -222
  111. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js +0 -108
  112. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-HMjbuy2C.js +0 -2185
  113. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-DrbMJlm5.js +0 -347
  114. package/dist/Experience-FlBX3eyN.js +0 -223
  115. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-d8rh38tD.js +0 -114
  116. package/dist/Game-Cc3D7lKV.js +0 -278
  117. package/dist/Marketing-D7PXYloN.js +0 -20073
  118. package/dist/Mission-BSGc9822.js +0 -296
  119. package/dist/Point-0U4TTdPW.js +0 -226
  120. package/dist/Promotion-DiUa0GcV.js +0 -289
  121. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CxlamGFP.js +0 -1751
  122. package/dist/Setting-RLI7RgmN.js +0 -1936
  123. package/dist/Store-gxmv8hWJ.js +0 -1842
  124. package/dist/StoreRewards-C_6gY_Nk.js +0 -423
  125. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B5uzSYM4.js +0 -1029
  126. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-yjI96ZL0.js +0 -139
  127. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-dbA6_6b9.js +0 -419
  128. package/dist/_commonjsHelpers-BkfeUUK-.js +0 -28
  129. package/dist/app-B90wINOO.js +0 -33357
  130. package/dist/app-DuUxQ1ZP.js +0 -7086
  131. package/dist/campaign.fn-DKScnmjX.js +0 -758
  132. package/dist/dto-C5ri8Nws.js +0 -214
  133. package/dist/index-BCGDOgxb.js +0 -38
  134. package/dist/index-BCPBmANe.js +0 -3120
  135. package/dist/index-BN2Uyvj4.js +0 -30038
  136. package/dist/index-CrbnfAk8.js +0 -8861
  137. package/dist/index-CsaQJMAR.js +0 -66
  138. package/dist/index-DJwQICyC.js +0 -146
  139. package/dist/loading-MEQuW9Xa.js +0 -71
  140. package/dist/objectid-BeZTZYqi.js +0 -145
  141. package/dist/plugins-KiMuDTPp.js +0 -208
  142. package/dist/remy-vue-client-Cpppk9h-.js +0 -1693
  143. package/dist/rule-builder-BTcZx77a.js +0 -89
  144. package/dist/template-DPpMK30W.js +0 -190
  145. package/dist/trigger-DLp1bkZP.js +0 -144
  146. package/dist/usePagination-BeF5K3M7.js +0 -223
  147. package/dist/user-Cq9CGBHZ.js +0 -54
  148. package/dist/vue-i18n-COzqUgQy.js +0 -2365
@@ -0,0 +1,540 @@
1
+ var ie = Object.defineProperty;
2
+ var ue = (y, u, v) => u in y ? ie(y, u, { enumerable: !0, configurable: !0, writable: !0, value: v }) : y[u] = v;
3
+ var Z = (y, u, v) => ue(y, typeof u != "symbol" ? u + "" : u, v);
4
+ import { defineComponent as ae, ref as C, computed as D, watch as W, resolveComponent as p, openBlock as w, createBlock as Q, unref as o, isRef as ee, withCtx as Y, createElementVNode as V, createVNode as i, createElementBlock as T, Fragment as L, renderList as ce, createCommentVNode as q, h, onMounted as de } from "vue";
5
+ import { h as E } from "./moment-D7p2TMB-.js";
6
+ import { components as X } from "@feedmepos/ui-library";
7
+ import "./index-CR3f3BXQ.js";
8
+ import { J as me } from "./JsonViewer-v8_C7l5N.js";
9
+ import { u as le, m as pe } from "./loading-CivgDw5C.js";
10
+ import { u as fe } from "./app-wDQR6dpb.js";
11
+ import { useRoute as ne, useRouter as ge } from "vue-router";
12
+ import { c as re } from "./index-DpjYgKTN.js";
13
+ import { e as b } from "./index-vh86FiIQ.js";
14
+ import { u as J, w as ve } from "./xlsx-EewcN2uY.js";
15
+ import { u as he, _ as be } from "./usePagination-DtNK7W0U.js";
16
+ import { a as te } from "./plugins-P-V4XWmW.js";
17
+ import { u as Ce } from "./campaign-w9j4I4jn.js";
18
+ import { o as oe } from "./objectId-dwaoBfJX.js";
19
+ const ye = { class: "space-y-16" }, xe = { class: "gap-16 grid grid-cols-2" }, Se = { class: "flex items-center gap-8" }, Ve = /* @__PURE__ */ ae({
20
+ __name: "CreateCollectionSheet",
21
+ emits: ["success"],
22
+ setup(y, { expose: u, emit: v }) {
23
+ const { minor: M } = le, P = ne(), F = C(), k = C(!1), $ = v, x = C(!1);
24
+ function R(r) {
25
+ x.value = r, r && (n.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 n = C({
38
+ quantity: 1,
39
+ code: "",
40
+ codeConfig: {
41
+ length: 8,
42
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
43
+ prefix: "",
44
+ suffix: "",
45
+ pattern: "########"
46
+ }
47
+ }), z = [
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
+ ], A = [
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
+ ], U = C(A[0].value), f = C("bulk"), _ = C(!1), K = D(() => P.params.id);
72
+ async function N(r) {
73
+ var t;
74
+ await ((t = F.value) == null ? void 0 : t.validateInputs()), k.value && await M(
75
+ async () => {
76
+ await re.createCollectionByCampaignId(K.value, r), await $("success");
77
+ },
78
+ {
79
+ message: "Creating claim(s)",
80
+ successMessage: "Claim(s) created"
81
+ }
82
+ );
83
+ }
84
+ u({
85
+ showSheet: R
86
+ }), W(
87
+ () => f.value,
88
+ (r, t) => {
89
+ t != r && (n.value.code = "", n.value.codeConfig.length = 8, n.value.codeConfig.charset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", n.value.codeConfig.prefix = "", n.value.codeConfig.suffix = "", n.value.codeConfig.pattern = "########");
90
+ }
91
+ );
92
+ function g(r) {
93
+ if (f.value !== "single") return !1;
94
+ const t = r.split(`
95
+ `).map((B) => B.trim()).filter(Boolean);
96
+ return new Set(t).size !== t.length;
97
+ }
98
+ function j(r) {
99
+ return /[ \t]/.test(r);
100
+ }
101
+ return W(
102
+ () => n.value.codeConfig.length,
103
+ (r, t) => {
104
+ r != t && (n.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(r))));
105
+ }
106
+ ), W(
107
+ () => n.value.codeConfig.pattern,
108
+ (r, t) => {
109
+ r != t && (n.value.codeConfig.length = (n.value.codeConfig.pattern.match(/#/g) || []).length);
110
+ }
111
+ ), (r, t) => {
112
+ const B = p("FmRadio"), O = p("FmRadioGroup"), H = p("FmSwitch"), l = p("FmStepperField"), e = p("FmSelect"), c = p("FmTextField"), d = p("FmTextarea"), s = p("FmForm"), S = p("FmButton"), G = p("FmSideSheet");
113
+ return w(), Q(G, {
114
+ "max-width": 560,
115
+ "dismiss-away": !0,
116
+ header: "Create collection",
117
+ modelValue: o(x),
118
+ "onUpdate:modelValue": [
119
+ t[14] || (t[14] = (a) => ee(x) ? x.value = a : null),
120
+ t[15] || (t[15] = (a) => x.value = a)
121
+ ]
122
+ }, {
123
+ "side-sheet-footer": Y(() => [
124
+ V("div", Se, [
125
+ i(S, {
126
+ label: "Save",
127
+ onClick: t[12] || (t[12] = (a) => N(o(n))),
128
+ loading: o(fe)().isLoading
129
+ }, null, 8, ["loading"]),
130
+ i(S, {
131
+ label: "Cancel",
132
+ type: "button",
133
+ variant: "tertiary",
134
+ onClick: t[13] || (t[13] = (a) => x.value = !1)
135
+ })
136
+ ])
137
+ ]),
138
+ default: Y(() => [
139
+ i(me, { json: o(n) }, null, 8, ["json"]),
140
+ i(s, {
141
+ ref_key: "form",
142
+ ref: F,
143
+ class: "space-y-40",
144
+ onValidationSuccess: t[10] || (t[10] = (a) => k.value = !0),
145
+ onValidationFailed: t[11] || (t[11] = (a) => k.value = !1)
146
+ }, {
147
+ default: Y(() => [
148
+ V("div", null, [
149
+ t[16] || (t[16] = V("div", { class: "fm-typo-en-body-lg-600" }, "Code type", -1)),
150
+ i(O, {
151
+ modelValue: o(f),
152
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => ee(f) ? f.value = a : null),
153
+ inline: !1
154
+ }, {
155
+ default: Y(() => [
156
+ (w(), T(L, null, ce(z, (a) => i(B, {
157
+ key: a.value,
158
+ value: a.value,
159
+ label: a.label,
160
+ sublabel: a.sublabel
161
+ }, null, 8, ["value", "label", "sublabel"])), 64))
162
+ ]),
163
+ _: 1
164
+ }, 8, ["modelValue"])
165
+ ]),
166
+ V("div", ye, [
167
+ t[17] || (t[17] = V("div", { class: "fm-typo-en-body-lg-600" }, "Settings", -1)),
168
+ o(f) === "bulk" ? (w(), T(L, { key: 0 }, [
169
+ i(H, {
170
+ "model-value": o(_),
171
+ "label-placement": "right",
172
+ value: "true",
173
+ label: "Advance code setting",
174
+ required: !0,
175
+ "onUpdate:modelValue": t[1] || (t[1] = () => _.value = !o(_))
176
+ }, null, 8, ["model-value"]),
177
+ o(_) ? (w(), T(L, { key: 0 }, [
178
+ i(l, {
179
+ modelValue: o(n).codeConfig.length,
180
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => o(n).codeConfig.length = a),
181
+ label: "Code length",
182
+ max: 16,
183
+ min: 1,
184
+ rules: [
185
+ (a) => Number(a) >= 1 || "Code length must at least 1",
186
+ (a) => Number(a) <= 16 || "Code length must less than 16"
187
+ ],
188
+ required: !0
189
+ }, null, 8, ["modelValue", "rules"]),
190
+ i(e, {
191
+ label: "Charset",
192
+ "model-value": o(U),
193
+ items: A,
194
+ "helper-text": o(n).codeConfig.charset.length > 62 ? `${o(n).codeConfig.charset.substring(0, 62)}...` : o(n).codeConfig.charset,
195
+ "onUpdate:modelValue": t[3] || (t[3] = (a) => {
196
+ U.value = a, o(n).codeConfig.charset = a;
197
+ })
198
+ }, null, 8, ["model-value", "helper-text"]),
199
+ o(U) === "" ? (w(), Q(c, {
200
+ key: 0,
201
+ modelValue: o(n).codeConfig.charset,
202
+ "onUpdate:modelValue": t[4] || (t[4] = (a) => o(n).codeConfig.charset = a),
203
+ label: "Custom Charset",
204
+ required: ""
205
+ }, null, 8, ["modelValue"])) : q("", !0),
206
+ V("div", xe, [
207
+ i(c, {
208
+ modelValue: o(n).codeConfig.prefix,
209
+ "onUpdate:modelValue": t[5] || (t[5] = (a) => o(n).codeConfig.prefix = a),
210
+ label: "Prefix (Optional)"
211
+ }, null, 8, ["modelValue"]),
212
+ i(c, {
213
+ modelValue: o(n).codeConfig.suffix,
214
+ "onUpdate:modelValue": t[6] || (t[6] = (a) => o(n).codeConfig.suffix = a),
215
+ label: "Suffix (Optional)"
216
+ }, null, 8, ["modelValue"])
217
+ ]),
218
+ i(c, {
219
+ modelValue: o(n).codeConfig.pattern,
220
+ "onUpdate:modelValue": t[7] || (t[7] = (a) => o(n).codeConfig.pattern = a),
221
+ label: "Pattern",
222
+ required: !0
223
+ }, null, 8, ["modelValue"])
224
+ ], 64)) : q("", !0),
225
+ i(c, {
226
+ modelValue: o(n).quantity,
227
+ "onUpdate:modelValue": t[8] || (t[8] = (a) => o(n).quantity = a),
228
+ label: "Number of code",
229
+ rules: [
230
+ (a) => a >= 1 || "Quantity cannot be less than 1",
231
+ (a) => a <= 1e4 || "Quantity cannot more than 10,000"
232
+ ],
233
+ required: !0,
234
+ "helper-text": `${o(n).quantity} claim will be created`
235
+ }, null, 8, ["modelValue", "rules", "helper-text"])
236
+ ], 64)) : q("", !0),
237
+ o(f) !== "bulk" ? (w(), Q(d, {
238
+ key: 1,
239
+ modelValue: o(n).code,
240
+ "onUpdate:modelValue": t[9] || (t[9] = (a) => o(n).code = a),
241
+ label: "Custom Code",
242
+ rules: [
243
+ (a) => o(f) != "single" || !!a || "Custom code is required",
244
+ (a) => !g(a) || "Custom code must be unique",
245
+ (a) => !j(a) || "Custom code must not contain space"
246
+ ],
247
+ placeholder: "(For multiple codes, please enter in the new row.)"
248
+ }, null, 8, ["modelValue", "rules"])) : q("", !0)
249
+ ])
250
+ ]),
251
+ _: 1
252
+ }, 512)
253
+ ]),
254
+ _: 1
255
+ }, 8, ["modelValue"]);
256
+ };
257
+ }
258
+ });
259
+ class we {
260
+ constructor() {
261
+ Z(this, "data", []);
262
+ }
263
+ addRecord(u) {
264
+ this.data.push(u);
265
+ }
266
+ buildExcel() {
267
+ const u = J.book_new(), v = J.json_to_sheet(this.data);
268
+ return J.book_append_sheet(u, v, "Collection"), u;
269
+ }
270
+ }
271
+ var Fe = { authUrl: "https://portal-v2-dev.feedmeapi.com/", slackWebhookUrl: "https://hooks.slack.com/services/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", appUrl: "feedmedev.vip", crmUrl: "crm.feedmedev.cc", paymentPortalUrl: "https://portal.feedmedev.cc/payment/payout-account", licensePortalUrl: "https://license.feedmedev.cc/", marketingV1Portal: "https://marketing-v1.feedmedev.cc", voucherAppUrl: "https://voucher.feedmedev.cc/" };
272
+ const ke = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Ue = { class: "flex items-center justify-end py-4 xs:hidden" }, Ke = /* @__PURE__ */ ae({
273
+ __name: "Collections",
274
+ setup(y) {
275
+ function u(l) {
276
+ return l.hideInApp === !1;
277
+ }
278
+ const v = ge(), M = ne(), P = C(), F = D(() => M.params.id), k = C(!1), { custom: $ } = le;
279
+ function x(l) {
280
+ var e;
281
+ return (e = l._id) == null ? void 0 : e.toString();
282
+ }
283
+ function R(l) {
284
+ var d;
285
+ const e = (d = Fe.voucherAppUrl) == null ? void 0 : d.replace(/\/$/, ""), c = x(l);
286
+ return !e || !c ? "" : `${e}/c/${c}`;
287
+ }
288
+ function n(l) {
289
+ var d, s;
290
+ const e = (d = l.user) == null ? void 0 : d.toString(), c = (s = l.business) == null ? void 0 : s.toString();
291
+ return (l.balance || 0) > 0 && (!e || e === c);
292
+ }
293
+ async function z(l) {
294
+ const e = R(l);
295
+ e && await te(e, {
296
+ successMessage: "Collection link copied to clipboard"
297
+ });
298
+ }
299
+ const A = Ce(), U = D(
300
+ () => A.campaigns.voucher.find(
301
+ (l) => {
302
+ var e;
303
+ return ((e = l._id) == null ? void 0 : e.toString()) === F.value;
304
+ }
305
+ )
306
+ ), f = D(
307
+ () => !!U.value && !u(U.value)
308
+ ), _ = D(() => [
309
+ {
310
+ header: "ID/Code",
311
+ accessorKey: "_id",
312
+ cell(l) {
313
+ return h("div", { class: "flex items-center" }, [
314
+ h(X.FmIcon, {
315
+ name: "content_copy",
316
+ outline: !0,
317
+ size: "sm",
318
+ class: "cursor-pointer mr-4",
319
+ onClick: (e) => {
320
+ e.preventDefault(), e.stopPropagation(), te(
321
+ l.row.original.code || l.row.original._id.toString()
322
+ );
323
+ }
324
+ }),
325
+ h(
326
+ "div",
327
+ { class: "pr-2 text-ellipsis overflow-hidden" },
328
+ l.row.original.code || l.row.original._id.toString()
329
+ )
330
+ ]);
331
+ }
332
+ },
333
+ {
334
+ header: "User",
335
+ accessorKey: "user",
336
+ enableSorting: !1,
337
+ cell(l) {
338
+ const e = l.row.original.pf_user;
339
+ return h(
340
+ "div",
341
+ {
342
+ class: "flex items-center gap-x-8"
343
+ },
344
+ [
345
+ h(X.FmAvatar, {
346
+ name: e != null && e.photoUrl || e == null ? void 0 : e.name,
347
+ src: (e == null ? void 0 : e.photoUrl) ?? void 0,
348
+ size: "sm"
349
+ }),
350
+ h("span", e == null ? void 0 : e.name)
351
+ ]
352
+ );
353
+ }
354
+ },
355
+ {
356
+ header: "Phone",
357
+ accessorFn: (l) => {
358
+ var e;
359
+ return ((e = l.pf_user) == null ? void 0 : e.phoneNumber) || "-";
360
+ },
361
+ accessorKey: "pf_user.phoneNumber"
362
+ },
363
+ {
364
+ header: "Balance",
365
+ accessorKey: "balance"
366
+ },
367
+ {
368
+ header: "Created at",
369
+ accessorKey: "_id",
370
+ accessorFn: (l) => E(oe(l._id.toString())).format("DD MMM YYYY")
371
+ },
372
+ {
373
+ header: "Nearest expired at",
374
+ accessorKey: "expiryBalance",
375
+ accessorFn: (l) => {
376
+ var e;
377
+ return l.expiryBalance && l.expiryBalance.length ? E((e = l.expiryBalance) == null ? void 0 : e[0].expiredAt).format("DD MMM YYYY") : "Never expires";
378
+ }
379
+ },
380
+ ...f.value ? [
381
+ {
382
+ header: "Actions",
383
+ accessorKey: "actions",
384
+ enableSorting: !1,
385
+ meta: {
386
+ maxWidth: "72px"
387
+ },
388
+ cell(l) {
389
+ return n(l.row.original) ? h("div", { class: "flex items-center justify-center" }, [
390
+ h(X.FmButton, {
391
+ icon: "share",
392
+ variant: "tertiary",
393
+ iconColor: "neutral-gray-400",
394
+ onClick: async (e) => {
395
+ e.preventDefault(), e.stopPropagation(), await z(l.row.original);
396
+ }
397
+ })
398
+ ]) : h(
399
+ "div",
400
+ {
401
+ class: "flex items-center justify-center text-fm-color-typo-disabled"
402
+ },
403
+ "-"
404
+ );
405
+ }
406
+ }
407
+ ] : []
408
+ ]), K = {
409
+ "$connect-STORE_REWARD_COLLECTIONS": pe.readCollectionsByRewardId,
410
+ "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": re.readCollectionsByCampaignId
411
+ }, N = (l) => {
412
+ const e = K[M.name];
413
+ return (c) => e(l, c);
414
+ }, { tableMeta: g, rowData: j, onSort: r, debouncedFetchData: t, onSearch: B } = he(N(F.value));
415
+ async function O() {
416
+ var l;
417
+ await t(), (l = P.value) == null || l.showSheet(!1);
418
+ }
419
+ async function H() {
420
+ k.value || $(
421
+ async () => {
422
+ var s;
423
+ const l = new we(), e = N(F.value), c = (await e({
424
+ limit: 1,
425
+ skip: 0,
426
+ sortBy: b.sortBy,
427
+ descending: b.descending
428
+ })).meta.totalResources ?? 0, d = b.rowsPerPage;
429
+ for (let S = 0; S < c; S += d) {
430
+ const G = {
431
+ ...b,
432
+ limit: d,
433
+ skip: b.page - 1,
434
+ sortBy: b.sortBy,
435
+ descending: b.descending
436
+ }, a = await e(G);
437
+ for await (const m of a.resources) {
438
+ const I = m.pf_user, se = {
439
+ "ID/Code": (m == null ? void 0 : m.code) || ((s = m._id) == null ? void 0 : s.toString()),
440
+ User: (I == null ? void 0 : I.name) || "-",
441
+ Phone: (I == null ? void 0 : I.phoneNumber) || "-",
442
+ Balance: (m == null ? void 0 : m.balance) || 0,
443
+ "Created at": E(
444
+ oe(m._id.toString())
445
+ ).format("DD MMM YYYY"),
446
+ "Nearest expired at": m.expiryBalance && m.expiryBalance.length ? E(m.expiryBalance[0].expiredAt).format(
447
+ "DD MMM YYYY"
448
+ ) : "Never expires",
449
+ Url: R(m)
450
+ };
451
+ l.addRecord(se);
452
+ }
453
+ b.page++;
454
+ }
455
+ await ve(
456
+ l.buildExcel(),
457
+ `vouchers-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
458
+ {
459
+ bookType: "xlsx",
460
+ bookSST: !1,
461
+ type: "array"
462
+ }
463
+ ), b.page = 1;
464
+ },
465
+ {
466
+ isLoading: k
467
+ }
468
+ );
469
+ }
470
+ return de(async () => {
471
+ await t();
472
+ }), (l, e) => {
473
+ const c = p("FmPageHead"), d = p("FmSearch");
474
+ return w(), T(L, null, [
475
+ i(c, {
476
+ title: "Collections",
477
+ "back-button": !0,
478
+ actions: [
479
+ { label: "Export", value: "export", isPrimary: !1 },
480
+ ...o(f) ? [
481
+ {
482
+ label: "Create collection",
483
+ value: "create",
484
+ isPrimary: !0
485
+ }
486
+ ] : []
487
+ ],
488
+ "onClick:back": e[0] || (e[0] = (s) => o(v).back()),
489
+ "onClick:action": e[1] || (e[1] = (s) => {
490
+ var S;
491
+ s === "create" && ((S = o(P)) == null || S.showSheet(!0)), s === "export" && H();
492
+ })
493
+ }, null, 8, ["actions"]),
494
+ V("div", ke, [
495
+ i(d, {
496
+ class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
497
+ modelValue: o(g).searchValue,
498
+ "onUpdate:modelValue": [
499
+ e[2] || (e[2] = (s) => o(g).searchValue = s),
500
+ o(B)
501
+ ],
502
+ placeholder: "Search",
503
+ collapsible: ""
504
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
505
+ V("div", Ue, [
506
+ i(d, {
507
+ modelValue: o(g).searchValue,
508
+ "onUpdate:modelValue": [
509
+ e[3] || (e[3] = (s) => o(g).searchValue = s),
510
+ o(B)
511
+ ],
512
+ placeholder: "Search",
513
+ collapsible: ""
514
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
515
+ ]),
516
+ i(be, {
517
+ loading: o(g).isLoading,
518
+ "row-data": o(j),
519
+ "column-defs": o(_),
520
+ "row-count": o(g).totalRows,
521
+ "page-count": o(g).pageCount,
522
+ "page-index": o(g).pageIndex,
523
+ "page-size": o(g).pageSize,
524
+ "shrink-at": !1,
525
+ onSortChange: o(r),
526
+ onPageChange: e[4] || (e[4] = (s) => o(t)({ pageSize: s.pageSize, pageIndex: s.pageIndex }))
527
+ }, null, 8, ["loading", "row-data", "column-defs", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
528
+ i(Ve, {
529
+ ref_key: "sheetRef",
530
+ ref: P,
531
+ onSuccess: O
532
+ }, null, 512)
533
+ ])
534
+ ], 64);
535
+ };
536
+ }
537
+ });
538
+ export {
539
+ Ke as default
540
+ };