@feedmepos/mf-connect 0.1.38-beta.74 → 0.1.38-beta.75

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 (140) hide show
  1. package/dist/Analytic-9B27Q-I3.js +761 -0
  2. package/dist/App-isiE4pjM.js +4642 -0
  3. package/dist/AuditLogs-BmHr7pNI.js +1991 -0
  4. package/dist/Bin-BR06pDbx.js +166 -0
  5. package/dist/Broadcast-D_t80J2I.js +267 -0
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C5IuPCTB.js +121 -0
  7. package/dist/Card-Zs-1lcSr.js +910 -0
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  9. package/dist/Collections-BjeTJSHo.js +541 -0
  10. package/dist/Credit-DdmdsxOF.js +261 -0
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  12. package/dist/DateInput.vue_vue_type_script_setup_true_lang-BN4Q5Y3l.js +54 -0
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DkOfrONH.js +3120 -0
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-kzk3iEKA.js +351 -0
  16. package/dist/Experience-WxtE9ZIT.js +260 -0
  17. package/dist/FileSaver.min-Vgxo4jNi.js +74 -0
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  19. package/dist/Game-Cc0mZ3y4.js +331 -0
  20. package/dist/GenerateMaterial-Dsvnpz4o.js +589 -0
  21. package/dist/Grab-CcaXToD-.js +301 -0
  22. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-D0yJMgs9.js +145 -0
  23. package/dist/Index-C0TcFJJY.js +259 -0
  24. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  25. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-CXFtSS9_.js +48 -0
  26. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-Ca7hKpcD.js +18737 -0
  27. package/dist/MainLayout-DPpjvWwq.js +41 -0
  28. package/dist/Marketing-DfXuNM7X.js +145 -0
  29. package/dist/MarketingMaterialEdit-C63qyQSd.js +746 -0
  30. package/dist/Member-LTYVn-80.js +280 -0
  31. package/dist/MemberList-Gqr6ha5p.js +1601 -0
  32. package/dist/MemberOverview-wL_ailso.js +58 -0
  33. package/dist/MemberTransactions-CVZ-SPhm.js +45 -0
  34. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BGooFTgg.js +60799 -0
  35. package/dist/Mission-CLQdNsOe.js +335 -0
  36. package/dist/Overview-BluyLBRI.js +1078 -0
  37. package/dist/Point-DQLQxJG1.js +263 -0
  38. package/dist/Promotion-BG0xL1ed.js +397 -0
  39. package/dist/Queue-BR7TrLI8.js +259 -0
  40. package/dist/Record-2WFpDhAb.js +341 -0
  41. package/dist/Review-Bu9SGftr.js +617 -0
  42. package/dist/ReviewFacebookCallback-CV99Udei.js +243 -0
  43. package/dist/ReviewGoogleCallback-DiqgQzOt.js +213 -0
  44. package/dist/Reward-CPhM3ChT.js +442 -0
  45. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Q9pVq11w.js +149 -0
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-BRUQtqjv.js +1912 -0
  47. package/dist/Segment-D6V8FKUY.js +881 -0
  48. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BrE1gGHP.js +181 -0
  49. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-DQhO9k7V.js +188 -0
  50. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-CyHx6m95.js +147 -0
  51. package/dist/Setting-Bh5bB75w.js +2000 -0
  52. package/dist/SettingAdvertisements-CFUjq6s1.js +264 -0
  53. package/dist/Store-DiVaUn7w.js +1996 -0
  54. package/dist/StoreRewards-Bb9iW3Yz.js +535 -0
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DVFsPzLK.js +1129 -0
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-D9uZR0si.js +7005 -0
  57. package/dist/Tier-BYxLjqAB.js +970 -0
  58. package/dist/Title-D3cdNE2O.js +568 -0
  59. package/dist/Transaction-D7ItbBra.js +39 -0
  60. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-UXSlpEM0.js +130 -0
  61. package/dist/Voucher-DNQz_ujN.js +422 -0
  62. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-CztGuaCV.js +421 -0
  63. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-RI0mY3Nx.js +56 -0
  64. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  65. package/dist/app-wDQR6dpb.js +39 -0
  66. package/dist/app-zPef9Uzl.js +59396 -0
  67. package/dist/app.js +7 -0
  68. package/dist/business-DKEB57Mf.js +82 -0
  69. package/dist/campaign-BD_s6pW4.js +100 -0
  70. package/dist/campaign-CpzFl8Vr.js +4 -0
  71. package/dist/campaign-D9IfNIPI.js +253 -0
  72. package/dist/campaign.enum-gPz5hWSW.js +26 -0
  73. package/dist/campaign.fn-Csxad3W7.js +776 -0
  74. package/dist/collectible.enum-CA-QbTP-.js +19 -0
  75. package/dist/collection.fn-tFxG0UiA.js +26 -0
  76. package/dist/dto-CdvywxS_.js +222 -0
  77. package/dist/duplicateCampaign-Cj68m0Ti.js +51 -0
  78. package/dist/effect-KecOJIEK.js +89 -0
  79. package/dist/email-addresses-Ske7sY-s.js +705 -0
  80. package/dist/export-17vDh5vq.js +97 -0
  81. package/dist/feedme.ico +0 -0
  82. package/dist/helper-B-ZDFjy7.js +86 -0
  83. package/dist/index-BRZC-Cy5.js +85 -0
  84. package/dist/index-BV_G-XzK.js +30289 -0
  85. package/dist/index-BwLCkOIF.js +36 -0
  86. package/dist/index-C1Z4oibL.js +48 -0
  87. package/dist/index-CNLqZu6_.js +2639 -0
  88. package/dist/index-CdByBgmF.js +32 -0
  89. package/dist/index-CkqQGjg1.js +8912 -0
  90. package/dist/index-CuvNtC_M.js +61 -0
  91. package/dist/index-D05Pcg0E.js +124 -0
  92. package/dist/index-D58_aTiN.js +28897 -0
  93. package/dist/index-DCzjjZgV.js +67 -0
  94. package/dist/index-DY3_9zbY.js +3431 -0
  95. package/dist/index-Dc2JsMD2.js +54 -0
  96. package/dist/index-Dh78uGTl.js +146 -0
  97. package/dist/index-DnrSd_o_.js +3 -0
  98. package/dist/index-vh86FiIQ.js +10 -0
  99. package/dist/index-woXH3LmA.js +31 -0
  100. package/dist/index.esm2017-DxQe1gCt.js +3069 -0
  101. package/dist/loading-B1ymwDT_.js +71 -0
  102. package/dist/lodash-BiGSPE0G.js +3678 -0
  103. package/dist/membership-GnNCDGBk.js +235 -0
  104. package/dist/moment-D7p2TMB-.js +2583 -0
  105. package/dist/money-CG6LGklW.js +15 -0
  106. package/dist/number-p19we-YD.js +12 -0
  107. package/dist/object-qECH92oz.js +26 -0
  108. package/dist/objectId-dwaoBfJX.js +7 -0
  109. package/dist/objectid-XhaZoPQl.js +145 -0
  110. package/dist/plugins-cxSxZO0d.js +1817 -0
  111. package/dist/remy-D_Deb3ue.js +13 -0
  112. package/dist/reward-siULTu5h.js +36 -0
  113. package/dist/rule-GD9oMCPH.js +1969 -0
  114. package/dist/rule-builder-DWFem4d5.js +102 -0
  115. package/dist/style.css +13 -0
  116. package/dist/template-o23nw6e2.js +188 -0
  117. package/dist/tier-BJDhpH6X.js +4 -0
  118. package/dist/tiers/tier=1.png +0 -0
  119. package/dist/tiers/tier=2.png +0 -0
  120. package/dist/tiers/tier=3.png +0 -0
  121. package/dist/tiers/tier=4.png +0 -0
  122. package/dist/timezone-BVwygiRH.js +1154 -0
  123. package/dist/titles/type=diamond.png +0 -0
  124. package/dist/titles/type=drinks.png +0 -0
  125. package/dist/titles/type=food.png +0 -0
  126. package/dist/titles/type=heart.png +0 -0
  127. package/dist/titles/type=medal.png +0 -0
  128. package/dist/titles/type=spend.png +0 -0
  129. package/dist/titles/type=thank-you.png +0 -0
  130. package/dist/titles/type=thumbs-up.png +0 -0
  131. package/dist/titles/type=years.png +0 -0
  132. package/dist/trigger-CrEBP1aZ.js +213 -0
  133. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  134. package/dist/type_drinks-D6jnpvwV.js +4 -0
  135. package/dist/usePagination-BbTCnhtY.js +266 -0
  136. package/dist/user-DcMEufQ6.js +55 -0
  137. package/dist/vue-i18n-BxV_u4BZ.js +2365 -0
  138. package/dist/xlsx-BnJDxONa.js +15491 -0
  139. package/dist/zod-CUN5LrI6.js +91 -0
  140. 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,541 @@
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-BV_G-XzK.js";
8
+ import { J as me } from "./JsonViewer-v8_C7l5N.js";
9
+ import { u as le } from "./loading-B1ymwDT_.js";
10
+ import { u as pe } from "./app-wDQR6dpb.js";
11
+ import { useRoute as ne, useRouter as fe } from "vue-router";
12
+ import { c as re } from "./index-D05Pcg0E.js";
13
+ import { e as b } from "./index-vh86FiIQ.js";
14
+ import { u as J, w as ge } from "./xlsx-BnJDxONa.js";
15
+ import { u as ve, _ as he } from "./usePagination-BbTCnhtY.js";
16
+ import { a as te } from "./plugins-cxSxZO0d.js";
17
+ import { u as be } from "./campaign-BD_s6pW4.js";
18
+ import { m as Ce } from "./index-Dh78uGTl.js";
19
+ import { o as oe } from "./objectId-dwaoBfJX.js";
20
+ const ye = { class: "space-y-16" }, xe = { class: "gap-16 grid grid-cols-2" }, Se = { class: "flex items-center gap-8" }, Ve = /* @__PURE__ */ ae({
21
+ __name: "CreateCollectionSheet",
22
+ emits: ["success"],
23
+ setup(y, { expose: u, emit: v }) {
24
+ const { minor: M } = le, P = ne(), F = C(), k = C(!1), $ = v, x = C(!1);
25
+ function R(r) {
26
+ x.value = r, r && (n.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 n = C({
39
+ quantity: 1,
40
+ code: "",
41
+ codeConfig: {
42
+ length: 8,
43
+ charset: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
44
+ prefix: "",
45
+ suffix: "",
46
+ pattern: "########"
47
+ }
48
+ }), z = [
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
+ ], A = [
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
+ ], U = C(A[0].value), f = C("bulk"), _ = C(!1), K = D(() => P.params.id);
73
+ async function N(r) {
74
+ var t;
75
+ await ((t = F.value) == null ? void 0 : t.validateInputs()), k.value && await M(
76
+ async () => {
77
+ await re.createCollectionByCampaignId(K.value, r), await $("success");
78
+ },
79
+ {
80
+ message: "Creating claim(s)",
81
+ successMessage: "Claim(s) created"
82
+ }
83
+ );
84
+ }
85
+ u({
86
+ showSheet: R
87
+ }), W(
88
+ () => f.value,
89
+ (r, t) => {
90
+ 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 = "########");
91
+ }
92
+ );
93
+ function g(r) {
94
+ if (f.value !== "single") return !1;
95
+ const t = r.split(`
96
+ `).map((B) => B.trim()).filter(Boolean);
97
+ return new Set(t).size !== t.length;
98
+ }
99
+ function j(r) {
100
+ return /[ \t]/.test(r);
101
+ }
102
+ return W(
103
+ () => n.value.codeConfig.length,
104
+ (r, t) => {
105
+ r != t && (n.value.codeConfig.pattern = "#".repeat(Math.min(16, Number(r))));
106
+ }
107
+ ), W(
108
+ () => n.value.codeConfig.pattern,
109
+ (r, t) => {
110
+ r != t && (n.value.codeConfig.length = (n.value.codeConfig.pattern.match(/#/g) || []).length);
111
+ }
112
+ ), (r, t) => {
113
+ 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");
114
+ return w(), Q(G, {
115
+ "max-width": 560,
116
+ "dismiss-away": !0,
117
+ header: "Create collection",
118
+ modelValue: o(x),
119
+ "onUpdate:modelValue": [
120
+ t[14] || (t[14] = (a) => ee(x) ? x.value = a : null),
121
+ t[15] || (t[15] = (a) => x.value = a)
122
+ ]
123
+ }, {
124
+ "side-sheet-footer": Y(() => [
125
+ V("div", Se, [
126
+ i(S, {
127
+ label: "Save",
128
+ onClick: t[12] || (t[12] = (a) => N(o(n))),
129
+ loading: o(pe)().isLoading
130
+ }, null, 8, ["loading"]),
131
+ i(S, {
132
+ label: "Cancel",
133
+ type: "button",
134
+ variant: "tertiary",
135
+ onClick: t[13] || (t[13] = (a) => x.value = !1)
136
+ })
137
+ ])
138
+ ]),
139
+ default: Y(() => [
140
+ i(me, { json: o(n) }, null, 8, ["json"]),
141
+ i(s, {
142
+ ref_key: "form",
143
+ ref: F,
144
+ class: "space-y-40",
145
+ onValidationSuccess: t[10] || (t[10] = (a) => k.value = !0),
146
+ onValidationFailed: t[11] || (t[11] = (a) => k.value = !1)
147
+ }, {
148
+ default: Y(() => [
149
+ V("div", null, [
150
+ t[16] || (t[16] = V("div", { class: "fm-typo-en-body-lg-600" }, "Code type", -1)),
151
+ i(O, {
152
+ modelValue: o(f),
153
+ "onUpdate:modelValue": t[0] || (t[0] = (a) => ee(f) ? f.value = a : null),
154
+ inline: !1
155
+ }, {
156
+ default: Y(() => [
157
+ (w(), T(L, null, ce(z, (a) => i(B, {
158
+ key: a.value,
159
+ value: a.value,
160
+ label: a.label,
161
+ sublabel: a.sublabel
162
+ }, null, 8, ["value", "label", "sublabel"])), 64))
163
+ ]),
164
+ _: 1
165
+ }, 8, ["modelValue"])
166
+ ]),
167
+ V("div", ye, [
168
+ t[17] || (t[17] = V("div", { class: "fm-typo-en-body-lg-600" }, "Settings", -1)),
169
+ o(f) === "bulk" ? (w(), T(L, { key: 0 }, [
170
+ i(H, {
171
+ "model-value": o(_),
172
+ "label-placement": "right",
173
+ value: "true",
174
+ label: "Advance code setting",
175
+ required: !0,
176
+ "onUpdate:modelValue": t[1] || (t[1] = () => _.value = !o(_))
177
+ }, null, 8, ["model-value"]),
178
+ o(_) ? (w(), T(L, { key: 0 }, [
179
+ i(l, {
180
+ modelValue: o(n).codeConfig.length,
181
+ "onUpdate:modelValue": t[2] || (t[2] = (a) => o(n).codeConfig.length = a),
182
+ label: "Code length",
183
+ max: 16,
184
+ min: 1,
185
+ rules: [
186
+ (a) => Number(a) >= 1 || "Code length must at least 1",
187
+ (a) => Number(a) <= 16 || "Code length must less than 16"
188
+ ],
189
+ required: !0
190
+ }, null, 8, ["modelValue", "rules"]),
191
+ i(e, {
192
+ label: "Charset",
193
+ "model-value": o(U),
194
+ items: A,
195
+ "helper-text": o(n).codeConfig.charset.length > 62 ? `${o(n).codeConfig.charset.substring(0, 62)}...` : o(n).codeConfig.charset,
196
+ "onUpdate:modelValue": t[3] || (t[3] = (a) => {
197
+ U.value = a, o(n).codeConfig.charset = a;
198
+ })
199
+ }, null, 8, ["model-value", "helper-text"]),
200
+ o(U) === "" ? (w(), Q(c, {
201
+ key: 0,
202
+ modelValue: o(n).codeConfig.charset,
203
+ "onUpdate:modelValue": t[4] || (t[4] = (a) => o(n).codeConfig.charset = a),
204
+ label: "Custom Charset",
205
+ required: ""
206
+ }, null, 8, ["modelValue"])) : q("", !0),
207
+ V("div", xe, [
208
+ i(c, {
209
+ modelValue: o(n).codeConfig.prefix,
210
+ "onUpdate:modelValue": t[5] || (t[5] = (a) => o(n).codeConfig.prefix = a),
211
+ label: "Prefix (Optional)"
212
+ }, null, 8, ["modelValue"]),
213
+ i(c, {
214
+ modelValue: o(n).codeConfig.suffix,
215
+ "onUpdate:modelValue": t[6] || (t[6] = (a) => o(n).codeConfig.suffix = a),
216
+ label: "Suffix (Optional)"
217
+ }, null, 8, ["modelValue"])
218
+ ]),
219
+ i(c, {
220
+ modelValue: o(n).codeConfig.pattern,
221
+ "onUpdate:modelValue": t[7] || (t[7] = (a) => o(n).codeConfig.pattern = a),
222
+ label: "Pattern",
223
+ required: !0
224
+ }, null, 8, ["modelValue"])
225
+ ], 64)) : q("", !0),
226
+ i(c, {
227
+ modelValue: o(n).quantity,
228
+ "onUpdate:modelValue": t[8] || (t[8] = (a) => o(n).quantity = a),
229
+ label: "Number of code",
230
+ rules: [
231
+ (a) => a >= 1 || "Quantity cannot be less than 1",
232
+ (a) => a <= 1e4 || "Quantity cannot more than 10,000"
233
+ ],
234
+ required: !0,
235
+ "helper-text": `${o(n).quantity} claim will be created`
236
+ }, null, 8, ["modelValue", "rules", "helper-text"])
237
+ ], 64)) : q("", !0),
238
+ o(f) !== "bulk" ? (w(), Q(d, {
239
+ key: 1,
240
+ modelValue: o(n).code,
241
+ "onUpdate:modelValue": t[9] || (t[9] = (a) => o(n).code = a),
242
+ label: "Custom Code",
243
+ rules: [
244
+ (a) => o(f) != "single" || !!a || "Custom code is required",
245
+ (a) => !g(a) || "Custom code must be unique",
246
+ (a) => !j(a) || "Custom code must not contain space"
247
+ ],
248
+ placeholder: "(For multiple codes, please enter in the new row.)"
249
+ }, null, 8, ["modelValue", "rules"])) : q("", !0)
250
+ ])
251
+ ]),
252
+ _: 1
253
+ }, 512)
254
+ ]),
255
+ _: 1
256
+ }, 8, ["modelValue"]);
257
+ };
258
+ }
259
+ });
260
+ class we {
261
+ constructor() {
262
+ Z(this, "data", []);
263
+ }
264
+ addRecord(u) {
265
+ this.data.push(u);
266
+ }
267
+ buildExcel() {
268
+ const u = J.book_new(), v = J.json_to_sheet(this.data);
269
+ return J.book_append_sheet(u, v, "Collection"), u;
270
+ }
271
+ }
272
+ 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/" };
273
+ const ke = { class: "px-24 flex flex-col gap-y-32 pb-24" }, Ue = { class: "flex items-center justify-end py-4 xs:hidden" }, je = /* @__PURE__ */ ae({
274
+ __name: "Collections",
275
+ setup(y) {
276
+ function u(l) {
277
+ return l.hideInApp === !1;
278
+ }
279
+ const v = fe(), M = ne(), P = C(), F = D(() => M.params.id), k = C(!1), { custom: $ } = le;
280
+ function x(l) {
281
+ var e;
282
+ return (e = l._id) == null ? void 0 : e.toString();
283
+ }
284
+ function R(l) {
285
+ var d;
286
+ const e = (d = Fe.voucherAppUrl) == null ? void 0 : d.replace(/\/$/, ""), c = x(l);
287
+ return !e || !c ? "" : `${e}/c/${c}`;
288
+ }
289
+ function n(l) {
290
+ var d, s;
291
+ const e = (d = l.user) == null ? void 0 : d.toString(), c = (s = l.business) == null ? void 0 : s.toString();
292
+ return (l.balance || 0) > 0 && (!e || e === c);
293
+ }
294
+ async function z(l) {
295
+ const e = R(l);
296
+ e && await te(e, {
297
+ successMessage: "Collection link copied to clipboard"
298
+ });
299
+ }
300
+ const A = be(), U = D(
301
+ () => A.campaigns.voucher.find(
302
+ (l) => {
303
+ var e;
304
+ return ((e = l._id) == null ? void 0 : e.toString()) === F.value;
305
+ }
306
+ )
307
+ ), f = D(
308
+ () => !!U.value && !u(U.value)
309
+ ), _ = D(() => [
310
+ {
311
+ header: "ID/Code",
312
+ accessorKey: "_id",
313
+ cell(l) {
314
+ return h("div", { class: "flex items-center" }, [
315
+ h(X.FmIcon, {
316
+ name: "content_copy",
317
+ outline: !0,
318
+ size: "sm",
319
+ class: "cursor-pointer mr-4",
320
+ onClick: (e) => {
321
+ e.preventDefault(), e.stopPropagation(), te(
322
+ l.row.original.code || l.row.original._id.toString()
323
+ );
324
+ }
325
+ }),
326
+ h(
327
+ "div",
328
+ { class: "pr-2 text-ellipsis overflow-hidden" },
329
+ l.row.original.code || l.row.original._id.toString()
330
+ )
331
+ ]);
332
+ }
333
+ },
334
+ {
335
+ header: "User",
336
+ accessorKey: "user",
337
+ enableSorting: !1,
338
+ cell(l) {
339
+ const e = l.row.original.pf_user;
340
+ return h(
341
+ "div",
342
+ {
343
+ class: "flex items-center gap-x-8"
344
+ },
345
+ [
346
+ h(X.FmAvatar, {
347
+ name: e != null && e.photoUrl || e == null ? void 0 : e.name,
348
+ src: (e == null ? void 0 : e.photoUrl) ?? void 0,
349
+ size: "sm"
350
+ }),
351
+ h("span", e == null ? void 0 : e.name)
352
+ ]
353
+ );
354
+ }
355
+ },
356
+ {
357
+ header: "Phone",
358
+ accessorFn: (l) => {
359
+ var e;
360
+ return ((e = l.pf_user) == null ? void 0 : e.phoneNumber) || "-";
361
+ },
362
+ accessorKey: "pf_user.phoneNumber"
363
+ },
364
+ {
365
+ header: "Balance",
366
+ accessorKey: "balance"
367
+ },
368
+ {
369
+ header: "Created at",
370
+ accessorKey: "_id",
371
+ accessorFn: (l) => E(oe(l._id.toString())).format("DD MMM YYYY")
372
+ },
373
+ {
374
+ header: "Nearest expired at",
375
+ accessorKey: "expiryBalance",
376
+ accessorFn: (l) => {
377
+ var e;
378
+ return l.expiryBalance && l.expiryBalance.length ? E((e = l.expiryBalance) == null ? void 0 : e[0].expiredAt).format("DD MMM YYYY") : "Never expires";
379
+ }
380
+ },
381
+ ...f.value ? [
382
+ {
383
+ header: "Actions",
384
+ accessorKey: "actions",
385
+ enableSorting: !1,
386
+ meta: {
387
+ maxWidth: "72px"
388
+ },
389
+ cell(l) {
390
+ return n(l.row.original) ? h("div", { class: "flex items-center justify-center" }, [
391
+ h(X.FmButton, {
392
+ icon: "share",
393
+ variant: "tertiary",
394
+ iconColor: "neutral-gray-400",
395
+ onClick: async (e) => {
396
+ e.preventDefault(), e.stopPropagation(), await z(l.row.original);
397
+ }
398
+ })
399
+ ]) : h(
400
+ "div",
401
+ {
402
+ class: "flex items-center justify-center text-fm-color-typo-disabled"
403
+ },
404
+ "-"
405
+ );
406
+ }
407
+ }
408
+ ] : []
409
+ ]), K = {
410
+ "$connect-STORE_REWARD_COLLECTIONS": Ce.readCollectionsByRewardId,
411
+ "$connect-CAMPAIGN_VOUCHER_COLLECTIONS": re.readCollectionsByCampaignId
412
+ }, N = (l) => {
413
+ const e = K[M.name];
414
+ return (c) => e(l, c);
415
+ }, { tableMeta: g, rowData: j, onSort: r, debouncedFetchData: t, onSearch: B } = ve(N(F.value));
416
+ async function O() {
417
+ var l;
418
+ await t(), (l = P.value) == null || l.showSheet(!1);
419
+ }
420
+ async function H() {
421
+ k.value || $(
422
+ async () => {
423
+ var s;
424
+ const l = new we(), e = N(F.value), c = (await e({
425
+ limit: 1,
426
+ skip: 0,
427
+ sortBy: b.sortBy,
428
+ descending: b.descending
429
+ })).meta.totalResources ?? 0, d = b.rowsPerPage;
430
+ for (let S = 0; S < c; S += d) {
431
+ const G = {
432
+ ...b,
433
+ limit: d,
434
+ skip: b.page - 1,
435
+ sortBy: b.sortBy,
436
+ descending: b.descending
437
+ }, a = await e(G);
438
+ for await (const m of a.resources) {
439
+ const I = m.pf_user, se = {
440
+ "ID/Code": (m == null ? void 0 : m.code) || ((s = m._id) == null ? void 0 : s.toString()),
441
+ User: (I == null ? void 0 : I.name) || "-",
442
+ Phone: (I == null ? void 0 : I.phoneNumber) || "-",
443
+ Balance: (m == null ? void 0 : m.balance) || 0,
444
+ "Created at": E(
445
+ oe(m._id.toString())
446
+ ).format("DD MMM YYYY"),
447
+ "Nearest expired at": m.expiryBalance && m.expiryBalance.length ? E(m.expiryBalance[0].expiredAt).format(
448
+ "DD MMM YYYY"
449
+ ) : "Never expires",
450
+ Url: R(m)
451
+ };
452
+ l.addRecord(se);
453
+ }
454
+ b.page++;
455
+ }
456
+ await ge(
457
+ l.buildExcel(),
458
+ `vouchers-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
459
+ {
460
+ bookType: "xlsx",
461
+ bookSST: !1,
462
+ type: "array"
463
+ }
464
+ ), b.page = 1;
465
+ },
466
+ {
467
+ isLoading: k
468
+ }
469
+ );
470
+ }
471
+ return de(async () => {
472
+ await t();
473
+ }), (l, e) => {
474
+ const c = p("FmPageHead"), d = p("FmSearch");
475
+ return w(), T(L, null, [
476
+ i(c, {
477
+ title: "Collections",
478
+ "back-button": !0,
479
+ actions: [
480
+ { label: "Export", value: "export", isPrimary: !1 },
481
+ ...o(f) ? [
482
+ {
483
+ label: "Create collection",
484
+ value: "create",
485
+ isPrimary: !0
486
+ }
487
+ ] : []
488
+ ],
489
+ "onClick:back": e[0] || (e[0] = (s) => o(v).back()),
490
+ "onClick:action": e[1] || (e[1] = (s) => {
491
+ var S;
492
+ s === "create" && ((S = o(P)) == null || S.showSheet(!0)), s === "export" && H();
493
+ })
494
+ }, null, 8, ["actions"]),
495
+ V("div", ke, [
496
+ i(d, {
497
+ class: "hidden xs:!flex border-b border-fm-color-neutral-gray-100",
498
+ modelValue: o(g).searchValue,
499
+ "onUpdate:modelValue": [
500
+ e[2] || (e[2] = (s) => o(g).searchValue = s),
501
+ o(B)
502
+ ],
503
+ placeholder: "Search",
504
+ collapsible: ""
505
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
506
+ V("div", Ue, [
507
+ i(d, {
508
+ modelValue: o(g).searchValue,
509
+ "onUpdate:modelValue": [
510
+ e[3] || (e[3] = (s) => o(g).searchValue = s),
511
+ o(B)
512
+ ],
513
+ placeholder: "Search",
514
+ collapsible: ""
515
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
516
+ ]),
517
+ i(he, {
518
+ loading: o(g).isLoading,
519
+ "row-data": o(j),
520
+ "column-defs": o(_),
521
+ "row-count": o(g).totalRows,
522
+ "page-count": o(g).pageCount,
523
+ "page-index": o(g).pageIndex,
524
+ "page-size": o(g).pageSize,
525
+ "shrink-at": !1,
526
+ onSortChange: o(r),
527
+ onPageChange: e[4] || (e[4] = (s) => o(t)({ pageSize: s.pageSize, pageIndex: s.pageIndex }))
528
+ }, null, 8, ["loading", "row-data", "column-defs", "row-count", "page-count", "page-index", "page-size", "onSortChange"]),
529
+ i(Ve, {
530
+ ref_key: "sheetRef",
531
+ ref: P,
532
+ onSuccess: O
533
+ }, null, 512)
534
+ ])
535
+ ], 64);
536
+ };
537
+ }
538
+ });
539
+ export {
540
+ je as default
541
+ };