@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
@@ -1,227 +0,0 @@
1
- import { defineComponent as N, ref as h, computed as U, onMounted as j, resolveComponent as r, openBlock as l, createElementBlock as y, Fragment as b, createVNode as i, unref as t, createElementVNode as n, withCtx as v, renderList as E, createBlock as w, resolveDynamicComponent as H, toDisplayString as d, createCommentVNode as q, h as z } from "vue";
2
- import { _ as G } from "./campaign-CpzFl8Vr.js";
3
- import { useDialog as J, components as Q } from "@feedmepos/ui-library";
4
- import { p as W } from "./plugins-KiMuDTPp.js";
5
- import { u as X } from "./loading-MEQuW9Xa.js";
6
- import { u as Y } from "./business-B65OtB5B.js";
7
- import { u as Z } from "./campaign-qGy6uzrC.js";
8
- import { a as B, b as A, g as ee } from "./campaign-iKI-L84v.js";
9
- import { u as te } from "./vue-i18n-COzqUgQy.js";
10
- import { _ as oe } from "./ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js";
11
- import { _ as ae } from "./EditCampaignSheet.vue_vue_type_script_setup_true_lang-HMjbuy2C.js";
12
- import { u as ne } from "./template-DPpMK30W.js";
13
- import { c as _ } from "./index-CH2d_B8c.js";
14
- const se = { class: "px-24 flex flex-col gap-y-16" }, ce = { class: "flex items-center justify-between w-full" }, ie = { class: "flex gap-8 overflow-x-auto" }, re = { class: "space-y-8" }, le = { class: "flex w-full gap-4 items-center" }, me = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, de = { class: "space-y-4" }, pe = { class: "fm-typo-en-body-lg-600" }, ue = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, fe = { key: 0 }, ge = { class: "text-fm-color-typo-secondary fm-typo-en-body-md-600" }, ye = { class: "flex flex-col gap-16 text-center" }, _e = { class: "fm-typo-en-title-sm-800" }, he = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Te = /* @__PURE__ */ N({
15
- __name: "Broadcast",
16
- setup(be) {
17
- const { t: s } = te(), V = {
18
- label: s("connect.campaign.common.createCampaign"),
19
- value: "create",
20
- isPrimary: !0,
21
- prependIcon: "add"
22
- }, D = ne("BROADCAST", J()), R = Y(), m = Z(), { global: L, minor: C } = X, T = h((/* @__PURE__ */ new Date()).toISOString()), c = h({
23
- searchKey: "",
24
- location: null
25
- }), f = U(
26
- () => m.campaigns.broadcast.filter(
27
- (e) => !c.value.location || !e.targetLocation || e.targetLocation.includes(c.value.location)
28
- )
29
- ), I = [
30
- {
31
- header: "Broadcast title",
32
- accessorFn: (e) => e.name
33
- },
34
- {
35
- header: "Status",
36
- accessorFn: (e) => ee(e),
37
- cell(e) {
38
- return B(e.row.original);
39
- }
40
- },
41
- {
42
- header: "Summary",
43
- accessorFn: (e) => A(e)
44
- },
45
- {
46
- header: "Message sent",
47
- accessorFn: (e) => e.currentReceive ?? "N/A"
48
- },
49
- {
50
- header: "Actions",
51
- cell(e) {
52
- return z(Q.FmButton, {
53
- variant: "tertiary",
54
- icon: "delete",
55
- iconColor: "neutral-gray-400",
56
- onClick: (o) => {
57
- o.stopPropagation(), S(e.row.original);
58
- }
59
- });
60
- }
61
- }
62
- ], x = h();
63
- async function S(e) {
64
- await W.remove(
65
- s("connect.campaign.common.remove.confirm", { name: e.name })
66
- ) && await C(
67
- async () => {
68
- await _.delete(e._id), await m.read("BROADCAST");
69
- },
70
- {
71
- message: s("connect.campaign.common.remove.removing", { name: e.name }),
72
- successMessage: s("connect.campaign.common.remove.removed", {
73
- name: e.name
74
- })
75
- }
76
- );
77
- }
78
- async function g(e) {
79
- T.value = (/* @__PURE__ */ new Date()).toISOString(), e ? await o() : D.open(async (p) => {
80
- await o(p);
81
- });
82
- async function o(p) {
83
- var u;
84
- (u = x.value) == null || u.showSheet(
85
- !0,
86
- "BROADCAST",
87
- e ? await _.readById(e._id) : void 0,
88
- p
89
- );
90
- }
91
- }
92
- async function K(e) {
93
- await C(
94
- async () => {
95
- e.campaign._id ? await _.update(e.campaign._id, e) : await _.create(e), await m.read("BROADCAST");
96
- },
97
- {
98
- message: s(
99
- `connect.campaign.broadcast.update.${e.campaign._id ? "updating" : "creating"}`
100
- ),
101
- successMessage: s("connect.campaign.broadcast.update.success", {
102
- action: e.campaign._id ? "updated" : "created"
103
- })
104
- }
105
- );
106
- }
107
- return j(async () => {
108
- await L(async () => {
109
- await m.read("BROADCAST");
110
- });
111
- }), (e, o) => {
112
- const p = r("FmPageHead"), u = r("FmSearch"), O = r("FmTable"), F = r("FmButton"), $ = r("FmListItem"), P = r("FmList"), M = r("FmCard");
113
- return l(), y(b, null, [
114
- i(p, {
115
- title: t(s)("connect.campaign.broadcast.title"),
116
- actions: t(f).length > 0 ? [V] : [],
117
- "onClick:action": o[0] || (o[0] = () => g())
118
- }, null, 8, ["title", "actions"]),
119
- n("div", se, [
120
- i(u, {
121
- modelValue: t(c).searchKey,
122
- "onUpdate:modelValue": o[1] || (o[1] = (a) => t(c).searchKey = a),
123
- class: "hidden xs:block border-b-2 border-fm-color-neutral-gray-100",
124
- placeholder: t(s)("connect.campaign.common.search"),
125
- collapsible: ""
126
- }, null, 8, ["modelValue", "placeholder"]),
127
- t(m).campaigns.broadcast && t(m).campaigns.broadcast.length > 0 ? (l(), y(b, { key: 0 }, [
128
- n("div", ce, [
129
- n("div", ie, [
130
- i(oe, {
131
- modelValue: t(c).location,
132
- "onUpdate:modelValue": o[2] || (o[2] = (a) => t(c).location = a),
133
- label: `${t(s)("connect.campaign.common.location")}: `,
134
- "show-item-label": !0,
135
- icon: "storefront",
136
- placement: "bottom-start",
137
- items: t(R).locationItems
138
- }, null, 8, ["modelValue", "label", "items"])
139
- ]),
140
- i(u, {
141
- modelValue: t(c).searchKey,
142
- "onUpdate:modelValue": o[3] || (o[3] = (a) => t(c).searchKey = a),
143
- class: "xs:hidden",
144
- placeholder: "search",
145
- collapsible: ""
146
- }, null, 8, ["modelValue"])
147
- ]),
148
- i(O, {
149
- class: "xs:hidden",
150
- "row-data": t(f),
151
- "column-defs": I,
152
- "search-value": t(c).searchKey,
153
- "column-filter": [],
154
- onRowClick: o[4] || (o[4] = (a) => g(a.original)),
155
- "hide-footer": !0
156
- }, null, 8, ["row-data", "search-value"]),
157
- i(P, { class: "hidden xs:flex flex-col mx-[-24px]" }, {
158
- default: v(() => [
159
- (l(!0), y(b, null, E(t(f).filter(
160
- (a) => a.name.toLowerCase().includes(t(c).searchKey.toLowerCase())
161
- ), (a) => (l(), w($, {
162
- key: a._id.toString(),
163
- onClick: (k) => g(a),
164
- class: "py-12 px-16 flex items-center justify-between border-b border-fm-color-neutral-gray-100"
165
- }, {
166
- default: v(() => [
167
- n("div", re, [
168
- n("div", le, [
169
- (l(), w(H(t(B)(a)))),
170
- n("div", me, d(a.currentReceive ?? 0) + " sent ", 1)
171
- ]),
172
- n("div", de, [
173
- n("div", pe, d(a.name), 1),
174
- n("div", ue, d(t(A)(a)), 1)
175
- ])
176
- ]),
177
- i(F, {
178
- icon: "delete",
179
- "icon-color": "neutral-gray-400",
180
- variant: "tertiary",
181
- onClick: (k) => (k.stopPropagation(), S(a))
182
- }, null, 8, ["onClick"])
183
- ]),
184
- _: 2
185
- }, 1032, ["onClick"]))), 128))
186
- ]),
187
- _: 1
188
- }),
189
- t(f).length == 0 ? (l(), y("div", fe, [
190
- n("div", ge, d(t(s)("connect.campaign.common.noResults")), 1)
191
- ])) : q("", !0)
192
- ], 64)) : (l(), w(M, {
193
- key: 1,
194
- variant: "outlined",
195
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
196
- }, {
197
- default: v(() => [
198
- o[6] || (o[6] = n("img", {
199
- src: G,
200
- class: "aspect-square w-[150px]"
201
- }, null, -1)),
202
- n("div", ye, [
203
- n("div", _e, d(t(s)("connect.campaign.broadcast.create.title")), 1),
204
- n("div", he, d(t(s)("connect.campaign.broadcast.create.description")), 1)
205
- ]),
206
- i(F, {
207
- variant: "primary",
208
- label: t(s)("connect.campaign.broadcast.create.button"),
209
- icon: "add",
210
- onClick: o[5] || (o[5] = (a) => g())
211
- }, null, 8, ["label"])
212
- ]),
213
- _: 1
214
- })),
215
- i(ae, {
216
- ref_key: "sheetRef",
217
- ref: x,
218
- "onSubmit:modelValue": K
219
- }, null, 512)
220
- ])
221
- ], 64);
222
- };
223
- }
224
- });
225
- export {
226
- Te as default
227
- };
@@ -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
- };