@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,905 +0,0 @@
1
- import { defineComponent as Z, ref as y, computed as E, watch as fe, onMounted as X, resolveComponent as v, openBlock as m, createBlock as F, unref as e, isRef as G, withCtx as _, createElementVNode as d, createVNode as i, createElementBlock as $, Fragment as z, renderList as H, createCommentVNode as k, normalizeClass as ue, createSlots as ge, h as K, toDisplayString as te, withModifiers as be } from "vue";
2
- import { _ as ve } from "./campaign-CpzFl8Vr.js";
3
- import { h as ne } from "./moment-BWErdI6_.js";
4
- import { useDialog as ye, components as oe } from "@feedmepos/ui-library";
5
- import "./index-Dkmn0jmX.js";
6
- import { u as J } from "./loading-MEQuW9Xa.js";
7
- import { u as me } from "./app-wDQR6dpb.js";
8
- import { u as W } from "./membership-Du79A0Pl.js";
9
- import { _ as Q } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
10
- import { p as ce, f as se, n as xe } from "./plugins-KiMuDTPp.js";
11
- import { m as L } from "./index-DJwQICyC.js";
12
- import { z as ie } from "./app-DuUxQ1ZP.js";
13
- import { Z as re } from "./zod-Bg2FbC-D.js";
14
- import { _ as de } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
15
- import "./index-DaEQgaiW.js";
16
- import { k as Ce } from "./index-BCPBmANe.js";
17
- import "./index-CrbnfAk8.js";
18
- import "./index-BCGDOgxb.js";
19
- import "./index-BkySejFg.js";
20
- import { O as Se } from "./objectid-BeZTZYqi.js";
21
- import { a as _e, c as he } from "./object-qECH92oz.js";
22
- import { u as we } from "./business-B65OtB5B.js";
23
- import { w as ke } from "./xlsx-Be4bARvl.js";
24
- import { a as Fe, C as Ve } from "./export-BLf2dhFd.js";
25
- import { u as $e, _ as Me } from "./usePagination-BeF5K3M7.js";
26
- import { u as Be } from "./vue-i18n-COzqUgQy.js";
27
- import { o as Ue } from "./objectId-dwaoBfJX.js";
28
- const De = { class: "space-y-16" }, Ae = { class: "gap-16 grid grid-cols-2" }, Ie = { class: "space-y-16" }, Ne = {
29
- key: 0,
30
- class: "flex flex-col gap-[16px] w-full"
31
- }, Pe = { class: "flex flex-col gap-[8px]" }, Re = ["src"], qe = { class: "flex pt-[24px] gap-[24px]" }, ze = ["src", "onClick", "alt"], Ee = { class: "flex items-center gap-8" }, je = /* @__PURE__ */ Z({
32
- __name: "CreateCardSheet",
33
- emits: ["success", "export"],
34
- setup(ee, { expose: j, emit: T }) {
35
- const { minor: A } = J, g = W(), M = y(), x = y(!1), w = T, o = y(!1);
36
- function B(c) {
37
- o.value = c, c && (s.value = {
38
- quantity: 1,
39
- code: "",
40
- codeConfig: {
41
- length: 12,
42
- charset: "1234567890",
43
- prefix: "",
44
- suffix: "",
45
- pattern: "####-####-####-####"
46
- }
47
- });
48
- }
49
- const s = y({
50
- quantity: 1,
51
- code: "",
52
- codeConfig: {
53
- length: 12,
54
- charset: "1234567890",
55
- prefix: "",
56
- suffix: "",
57
- pattern: "####-####-####-####"
58
- },
59
- setCardOnBind: !1,
60
- bundle: void 0
61
- }), p = [
62
- {
63
- label: "Bulk number",
64
- value: "bulk",
65
- sublabel: "Bulk generate unique number"
66
- },
67
- {
68
- label: "Custom number",
69
- value: "single",
70
- sublabel: "Enter your own custom number"
71
- }
72
- ], D = [
73
- {
74
- label: "Alphanumeric",
75
- value: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
76
- },
77
- {
78
- label: "Alphabetic",
79
- value: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
80
- },
81
- { label: "Alphabetic Lowercase", value: "abcdefghijklmnopqrstuvwxyz" },
82
- { label: "Alphabetic Uppercase", value: "ABCDEFGHIJKLMNOPQRSTUVWXYZ" },
83
- { label: "Numbers", value: "0123456789" },
84
- { label: "Custom", value: "" }
85
- ], I = y(D[0].value), h = y("bulk"), C = y(0), n = E(
86
- () => {
87
- var c;
88
- return (c = g.membership.design) == null ? void 0 : c[C.value];
89
- }
90
- ), u = y(!1), r = E(
91
- () => g.sortedStoreCategories.flatMap((c) => c.bundles)
92
- );
93
- async function b(c) {
94
- var l, V;
95
- if (await ((l = M.value) == null ? void 0 : l.validateInputs()), !x.value) return;
96
- c.design = (V = n.value) == null ? void 0 : V.image;
97
- const t = await ce.confirm(
98
- "",
99
- "Do you want to export generated card(s)?",
100
- "Export",
101
- "Generate and without export"
102
- );
103
- console.log(t), await A(
104
- async () => {
105
- const U = await L.createCards(c);
106
- console.log(U), await w("success"), t && await w("export", U);
107
- },
108
- {
109
- message: "Creating card(s)",
110
- successMessage: "Card(s) created"
111
- }
112
- );
113
- }
114
- return j({
115
- showSheet: B
116
- }), fe(
117
- () => s.value.codeConfig.length,
118
- (c, t) => {
119
- c != t && (s.value.codeConfig.pattern = "#".repeat(Number(c)));
120
- }
121
- ), X(async () => {
122
- await g.readMemberStore();
123
- }), (c, t) => {
124
- const l = v("FmRadio"), V = v("FmRadioGroup"), U = v("FmSwitch"), f = v("FmStepperField"), N = v("FmSelect"), q = v("FmTextField"), S = v("FmTextarea"), P = v("FmButton"), O = v("FmForm"), pe = v("FmSideSheet");
125
- return m(), F(pe, {
126
- "max-width": 560,
127
- "dismiss-away": !0,
128
- header: "Create collection",
129
- modelValue: e(o),
130
- "onUpdate:modelValue": [
131
- t[19] || (t[19] = (R) => G(o) ? o.value = R : null),
132
- t[20] || (t[20] = (R) => o.value = R)
133
- ]
134
- }, {
135
- "side-sheet-footer": _(() => [
136
- d("div", Ee, [
137
- i(P, {
138
- label: "Save",
139
- onClick: t[17] || (t[17] = (R) => b(e(s))),
140
- loading: e(me)().isLoading
141
- }, null, 8, ["loading"]),
142
- i(P, {
143
- label: "Cancel",
144
- type: "button",
145
- variant: "tertiary",
146
- onClick: t[18] || (t[18] = (R) => o.value = !1)
147
- })
148
- ])
149
- ]),
150
- default: _(() => [
151
- i(O, {
152
- ref_key: "form",
153
- ref: M,
154
- class: "space-y-40",
155
- onValidationSuccess: t[15] || (t[15] = (R) => x.value = !0),
156
- onValidationFailed: t[16] || (t[16] = (R) => x.value = !1)
157
- }, {
158
- default: _(() => {
159
- var R, le, ae;
160
- return [
161
- d("div", null, [
162
- t[21] || (t[21] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
163
- i(V, {
164
- modelValue: e(h),
165
- "onUpdate:modelValue": t[0] || (t[0] = (a) => G(h) ? h.value = a : null),
166
- inline: !1
167
- }, {
168
- default: _(() => [
169
- (m(), $(z, null, H(p, (a) => i(l, {
170
- key: a.value,
171
- value: a.value,
172
- label: a.label,
173
- sublabel: a.sublabel
174
- }, null, 8, ["value", "label", "sublabel"])), 64))
175
- ]),
176
- _: 1
177
- }, 8, ["modelValue"])
178
- ]),
179
- d("div", De, [
180
- t[22] || (t[22] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
181
- e(h) === "bulk" ? (m(), $(z, { key: 0 }, [
182
- i(U, {
183
- "model-value": e(u),
184
- "label-placement": "right",
185
- value: "true",
186
- label: "Advance number setting",
187
- required: !0,
188
- "onUpdate:modelValue": t[1] || (t[1] = () => u.value = !e(u))
189
- }, null, 8, ["model-value"]),
190
- e(u) ? (m(), $(z, { key: 0 }, [
191
- i(f, {
192
- "model-value": e(s).codeConfig.length || null,
193
- "onUpdate:modelValue": t[2] || (t[2] = (a) => e(s).codeConfig.length = a),
194
- label: "Code length",
195
- rules: [(a) => Number(a) >= 1 || "Code length must at least 1"],
196
- required: !0
197
- }, null, 8, ["model-value", "rules"]),
198
- i(N, {
199
- label: "Charset",
200
- "model-value": e(I),
201
- items: D,
202
- "helper-text": e(s).codeConfig.charset.length > 62 ? `${e(s).codeConfig.charset.substring(0, 62)}...` : e(s).codeConfig.charset,
203
- "onUpdate:modelValue": t[3] || (t[3] = (a) => {
204
- I.value = a, e(s).codeConfig.charset = a;
205
- })
206
- }, null, 8, ["model-value", "helper-text"]),
207
- e(I) === "" ? (m(), F(q, {
208
- key: 0,
209
- modelValue: e(s).codeConfig.charset,
210
- "onUpdate:modelValue": t[4] || (t[4] = (a) => e(s).codeConfig.charset = a),
211
- label: "Custom Charset",
212
- required: ""
213
- }, null, 8, ["modelValue"])) : k("", !0),
214
- d("div", Ae, [
215
- i(q, {
216
- modelValue: e(s).codeConfig.prefix,
217
- "onUpdate:modelValue": t[5] || (t[5] = (a) => e(s).codeConfig.prefix = a),
218
- label: "Prefix (Optional)"
219
- }, null, 8, ["modelValue"]),
220
- i(q, {
221
- modelValue: e(s).codeConfig.suffix,
222
- "onUpdate:modelValue": t[6] || (t[6] = (a) => e(s).codeConfig.suffix = a),
223
- label: "Suffix (Optional)"
224
- }, null, 8, ["modelValue"])
225
- ]),
226
- i(q, {
227
- modelValue: e(s).codeConfig.pattern,
228
- "onUpdate:modelValue": t[7] || (t[7] = (a) => e(s).codeConfig.pattern = a),
229
- label: "Pattern",
230
- required: !0
231
- }, null, 8, ["modelValue"])
232
- ], 64)) : k("", !0),
233
- i(q, {
234
- modelValue: e(s).quantity,
235
- "onUpdate:modelValue": t[8] || (t[8] = (a) => e(s).quantity = a),
236
- label: "Number of code",
237
- rules: [
238
- (a) => a >= 1 || "Quantity cannot be less than 1",
239
- (a) => a <= 1e4 || "Quantity cannot more than 10,000"
240
- ],
241
- required: !0,
242
- "helper-text": `${e(s).quantity} card will be created`
243
- }, null, 8, ["modelValue", "rules", "helper-text"])
244
- ], 64)) : k("", !0),
245
- e(h) !== "bulk" ? (m(), F(S, {
246
- key: 1,
247
- modelValue: e(s).code,
248
- "onUpdate:modelValue": t[9] || (t[9] = (a) => e(s).code = a),
249
- label: "Custom Card Number",
250
- rules: [(a) => e(h) != "single" || !!a || "Custom code is required"],
251
- placeholder: "(For multiple numbers, please enter in the new row.)"
252
- }, null, 8, ["modelValue", "rules"])) : k("", !0)
253
- ]),
254
- d("div", Ie, [
255
- t[23] || (t[23] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
256
- i(U, {
257
- "label-placement": "right",
258
- label: "Set card number on bind",
259
- "model-value": e(s).setCardOnBind || !1,
260
- "onUpdate:modelValue": t[10] || (t[10] = (a) => e(s).setCardOnBind = a)
261
- }, null, 8, ["model-value"]),
262
- i(Q, {
263
- label: "Activate bundle on bind",
264
- placeholder: "Select bundle",
265
- items: e(r).filter((a) => !a.stripePriceId).map((a) => ({ label: a.name, value: a._id })),
266
- modelValue: e(s).bundle,
267
- "onUpdate:modelValue": t[12] || (t[12] = (a) => e(s).bundle = a)
268
- }, {
269
- append: _(() => [
270
- e(s).bundle ? (m(), F(P, {
271
- key: 0,
272
- icon: "link_off",
273
- variant: "plain",
274
- onClick: t[11] || (t[11] = (a) => e(s).bundle = void 0)
275
- })) : k("", !0)
276
- ]),
277
- _: 1
278
- }, 8, ["items", "modelValue"]),
279
- (le = (R = e(g).store) == null ? void 0 : R.stripe) != null && le.apiKey ? (m(), F(Q, {
280
- key: 0,
281
- label: "Linked subscription bundle",
282
- placeholder: "Select bundle",
283
- items: e(r).filter((a) => a.stripePriceId).map((a) => ({ label: a.name, value: a._id })),
284
- modelValue: e(s).subscriptionBundle,
285
- "onUpdate:modelValue": t[14] || (t[14] = (a) => e(s).subscriptionBundle = a)
286
- }, {
287
- append: _(() => [
288
- e(s).subscriptionBundle ? (m(), F(P, {
289
- key: 0,
290
- icon: "link_off",
291
- variant: "plain",
292
- onClick: t[13] || (t[13] = (a) => e(s).subscriptionBundle = void 0)
293
- })) : k("", !0)
294
- ]),
295
- _: 1
296
- }, 8, ["items", "modelValue"])) : k("", !0)
297
- ]),
298
- e(g).membership.design ? (m(), $("div", Ne, [
299
- d("div", Pe, [
300
- t[24] || (t[24] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
301
- d("img", {
302
- src: (ae = e(n)) == null ? void 0 : ae.image,
303
- class: "aspect-[16/9]"
304
- }, null, 8, Re),
305
- d("div", qe, [
306
- (m(!0), $(z, null, H(e(g).membership.design, (a, Y) => (m(), $("img", {
307
- src: a.image,
308
- key: `image_${Y}`,
309
- class: ue(["w-[112px] h-[63px] cursor-pointer", `${e(C) === Y ? "border-[2px] border-fm-color-primary" : ""}`]),
310
- onClick: (dt) => C.value = Y,
311
- alt: `ai_image_predict_${Y}`,
312
- style: { objectFit: "cover" }
313
- }, null, 10, ze))), 128))
314
- ])
315
- ])
316
- ])) : k("", !0)
317
- ];
318
- }),
319
- _: 1
320
- }, 512)
321
- ]),
322
- _: 1
323
- }, 8, ["modelValue"]);
324
- };
325
- }
326
- }), Te = { class: "space-y-16" }, Le = {
327
- key: 0,
328
- class: "flex flex-col gap-[16px] w-full"
329
- }, Oe = { class: "flex flex-col gap-[8px]" }, Ye = ["src"], Ke = { class: "flex pt-[24px] gap-[24px]" }, Ge = ["src", "onClick", "alt"], He = { class: "flex items-center gap-8" }, Qe = /* @__PURE__ */ Z({
330
- __name: "EditCardSheet",
331
- emits: ["success"],
332
- setup(ee, { expose: j, emit: T }) {
333
- const { minor: A } = J, g = W(), M = y(), x = y(!1), w = T, o = y({
334
- _id: "",
335
- business: "",
336
- serialNumber: ""
337
- }), B = y(!1);
338
- function s(C, n) {
339
- var u;
340
- B.value = C, C && n && (o.value = n, p.value = (u = g.membership.design) == null ? void 0 : u.findIndex(
341
- (r) => r.image === n.design
342
- ));
343
- }
344
- const p = y(0), D = E(
345
- () => {
346
- var C;
347
- return (C = g.membership.design) == null ? void 0 : C[p.value];
348
- }
349
- ), I = E(
350
- () => g.sortedStoreCategories.flatMap(
351
- (C) => C.bundles
352
- )
353
- );
354
- async function h(C) {
355
- var n, u;
356
- await ((n = M.value) == null ? void 0 : n.validateInputs()), x.value && (C.design = (u = D.value) == null ? void 0 : u.image, await A(
357
- async () => {
358
- await L.updateCard(C), await w("success");
359
- },
360
- {
361
- message: "Updating card",
362
- successMessage: "Card updated"
363
- }
364
- ));
365
- }
366
- return j({
367
- showSheet: s
368
- }), X(async () => {
369
- await g.readMemberStore();
370
- }), (C, n) => {
371
- const u = v("FmTextField"), r = v("FmSwitch"), b = v("FmButton"), c = v("FmForm"), t = v("FmSideSheet");
372
- return m(), F(t, {
373
- "max-width": 560,
374
- "dismiss-away": !0,
375
- header: "Edit card",
376
- modelValue: e(B),
377
- "onUpdate:modelValue": [
378
- n[10] || (n[10] = (l) => G(B) ? B.value = l : null),
379
- n[11] || (n[11] = (l) => B.value = l)
380
- ]
381
- }, {
382
- "side-sheet-footer": _(() => [
383
- d("div", He, [
384
- i(b, {
385
- label: "Save",
386
- disabled: !!e(o).redeemedAt,
387
- onClick: n[8] || (n[8] = (l) => h(e(o))),
388
- loading: e(me)().isLoading
389
- }, null, 8, ["disabled", "loading"]),
390
- i(b, {
391
- label: "Cancel",
392
- type: "button",
393
- variant: "tertiary",
394
- onClick: n[9] || (n[9] = (l) => B.value = !1)
395
- })
396
- ])
397
- ]),
398
- default: _(() => [
399
- i(c, {
400
- ref_key: "form",
401
- ref: M,
402
- class: "space-y-40",
403
- onValidationSuccess: n[6] || (n[6] = (l) => x.value = !0),
404
- onValidationFailed: n[7] || (n[7] = (l) => x.value = !1)
405
- }, {
406
- default: _(() => {
407
- var l, V, U;
408
- return [
409
- d("div", Te, [
410
- i(u, {
411
- modelValue: e(o).serialNumber,
412
- "onUpdate:modelValue": n[0] || (n[0] = (f) => e(o).serialNumber = f),
413
- label: "Card Number",
414
- rules: [
415
- e(re).toRule(e(ie).string().min(1, "Card number is required")),
416
- e(re).toRule(
417
- e(ie).string().max(50, "Card number must be less than 50 characters")
418
- )
419
- ],
420
- required: !0
421
- }, null, 8, ["modelValue", "rules"]),
422
- n[12] || (n[12] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
423
- i(r, {
424
- "label-placement": "right",
425
- label: "Set card number on bind",
426
- "model-value": e(o).setCardOnBind || !1,
427
- "onUpdate:modelValue": n[1] || (n[1] = (f) => e(o).setCardOnBind = f)
428
- }, null, 8, ["model-value"]),
429
- i(Q, {
430
- label: "Activate bundle on bind",
431
- placeholder: "Select bundle",
432
- items: e(I).filter((f) => !f.stripePriceId).map((f) => ({ label: f.name, value: f._id })),
433
- modelValue: e(o).bundle,
434
- "onUpdate:modelValue": n[3] || (n[3] = (f) => e(o).bundle = f)
435
- }, {
436
- append: _(() => [
437
- e(o).bundle ? (m(), F(b, {
438
- key: 0,
439
- icon: "link_off",
440
- variant: "plain",
441
- onClick: n[2] || (n[2] = (f) => e(o).bundle = null)
442
- })) : k("", !0)
443
- ]),
444
- _: 1
445
- }, 8, ["items", "modelValue"]),
446
- (V = (l = e(g).store) == null ? void 0 : l.stripe) != null && V.apiKey ? (m(), F(Q, {
447
- key: 0,
448
- label: "Linked subscription bundle",
449
- placeholder: "Select bundle",
450
- items: e(I).filter((f) => f.stripePriceId).map((f) => ({ label: f.name, value: f._id })),
451
- modelValue: e(o).subscriptionBundle,
452
- "onUpdate:modelValue": n[5] || (n[5] = (f) => e(o).subscriptionBundle = f)
453
- }, {
454
- append: _(() => [
455
- e(o).subscriptionBundle ? (m(), F(b, {
456
- key: 0,
457
- icon: "link_off",
458
- variant: "plain",
459
- onClick: n[4] || (n[4] = (f) => e(o).subscriptionBundle = null)
460
- })) : k("", !0)
461
- ]),
462
- _: 1
463
- }, 8, ["items", "modelValue"])) : k("", !0)
464
- ]),
465
- e(g).membership.design ? (m(), $("div", Le, [
466
- d("div", Oe, [
467
- n[13] || (n[13] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
468
- d("img", {
469
- src: (U = e(D)) == null ? void 0 : U.image,
470
- class: "aspect-[16/9]"
471
- }, null, 8, Ye),
472
- d("div", Ke, [
473
- (m(!0), $(z, null, H(e(g).membership.design, (f, N) => (m(), $("img", {
474
- src: f.image,
475
- key: `image_${N}`,
476
- class: ue(["w-[112px] h-[63px] cursor-pointer", `${e(p) === N ? "border-[2px] border-fm-color-primary" : ""}`]),
477
- onClick: (q) => p.value = N,
478
- alt: `ai_image_predict_${N}`,
479
- style: { objectFit: "cover" }
480
- }, null, 10, Ge))), 128))
481
- ])
482
- ])
483
- ])) : k("", !0)
484
- ];
485
- }),
486
- _: 1
487
- }, 512)
488
- ]),
489
- _: 1
490
- }, 8, ["modelValue"]);
491
- };
492
- }
493
- }), Ze = {
494
- key: 0,
495
- class: "grid grid-cols-1 gap-8"
496
- }, Xe = { class: "flex items-center gap-8" }, Je = { class: "flex items-center gap-8" }, We = 5, et = /* @__PURE__ */ Z({
497
- __name: "CardDesignSheet",
498
- emits: ["success"],
499
- setup(ee, { expose: j, emit: T }) {
500
- const { minor: A } = J, g = W(), M = ye(), x = y(!1);
501
- y(), y(!1);
502
- const w = y(), o = y(null);
503
- E(() => {
504
- var u, r;
505
- return Math.min((((r = (u = w.value) == null ? void 0 : u.design) == null ? void 0 : r.length) ?? 0) + 1, We);
506
- });
507
- const B = T, s = E(() => {
508
- var u, r;
509
- return ((r = (u = g.membership) == null ? void 0 : u.design) == null ? void 0 : r.filter((b) => b.image)) || [];
510
- }), p = y(!1);
511
- function D(u) {
512
- p.value = u;
513
- }
514
- function I() {
515
- x.value = !0;
516
- }
517
- async function h() {
518
- await A(
519
- async () => {
520
- var b;
521
- const u = _e(w.value), r = Ce.parse(u);
522
- if (r.design = (r == null ? void 0 : r.design) || [], o.value) {
523
- const c = Se().toHexString(), t = await se.update(
524
- se.designPath(c, o.value),
525
- o.value
526
- );
527
- (b = r.design) == null || b.push({
528
- _id: c,
529
- image: t
530
- });
531
- }
532
- await L.update(r), await n(), await B("success"), o.value = null, x.value = !1;
533
- },
534
- {
535
- message: "Saving card design",
536
- successMessage: "Card design saved"
537
- }
538
- );
539
- }
540
- async function C(u, r) {
541
- u ? o.value = u : r && M.open({
542
- title: "Delete Design",
543
- message: "Are you sure you want to delete this design?",
544
- primaryActions: { text: "Delete", close: !0 },
545
- secondaryActions: { text: "Cancel", close: !1 }
546
- }).onPrimary(async () => {
547
- var c, t;
548
- const b = (c = w.value.design) == null ? void 0 : c.findIndex((l) => l._id == r);
549
- console.log(b), b !== -1 && ((t = w.value.design) == null || t.splice(b, 1)), await h();
550
- }).onSecondary(() => {
551
- M.close();
552
- });
553
- }
554
- async function n() {
555
- await g.readMembership(), w.value = g.membership;
556
- }
557
- return j({
558
- showSheet: D
559
- }), X(async () => {
560
- await n(), s.value.length || (x.value = !0);
561
- }), (u, r) => {
562
- const b = v("FmButton"), c = v("FmSideSheet");
563
- return m(), F(c, {
564
- "max-width": 560,
565
- "dismiss-away": !0,
566
- header: "Manage Design",
567
- modelValue: e(p),
568
- "onUpdate:modelValue": [
569
- r[2] || (r[2] = (t) => G(p) ? p.value = t : null),
570
- r[3] || (r[3] = (t) => p.value = t)
571
- ]
572
- }, ge({
573
- default: _(() => [
574
- e(x) ? k("", !0) : (m(), $("div", Ze, [
575
- (m(!0), $(z, null, H(e(s), (t) => (m(), F(de, {
576
- key: String(t._id),
577
- "image-fit": "cover",
578
- label: "",
579
- "aspect-ratio": "16/9",
580
- thumbnail: t.image,
581
- accept: ".png, .jpg, .jpeg, .gif",
582
- "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
583
- file: void 0,
584
- "delete-button": !1
585
- }, {
586
- "delete-button": _(() => [
587
- i(b, {
588
- class: "!text-neutral-50 !bg-neutral-700",
589
- icon: "delete",
590
- variant: "tertiary",
591
- onClick: (l) => C(null, t._id)
592
- }, null, 8, ["onClick"])
593
- ]),
594
- _: 2
595
- }, 1032, ["thumbnail"]))), 128))
596
- ])),
597
- e(x) ? (m(), F(de, {
598
- key: 1,
599
- "image-fit": "cover",
600
- label: "",
601
- "aspect-ratio": "16/9",
602
- accept: ".png, .jpg, .jpeg, .gif",
603
- "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
604
- "onUpdate:file": C
605
- })) : k("", !0)
606
- ]),
607
- _: 2
608
- }, [
609
- e(x) ? {
610
- name: "side-sheet-footer",
611
- fn: _(() => [
612
- d("div", Je, [
613
- i(b, {
614
- label: "Save",
615
- onClick: h,
616
- disabled: !e(o)
617
- }, null, 8, ["disabled"]),
618
- i(b, {
619
- label: "Cancel",
620
- type: "button",
621
- variant: "tertiary",
622
- onClick: r[1] || (r[1] = (t) => x.value = !1)
623
- })
624
- ])
625
- ]),
626
- key: "1"
627
- } : {
628
- name: "side-sheet-footer",
629
- fn: _(() => [
630
- d("div", Xe, [
631
- i(b, {
632
- label: "Add Design",
633
- onClick: I
634
- }),
635
- i(b, {
636
- label: "Cancel",
637
- type: "button",
638
- variant: "tertiary",
639
- onClick: r[0] || (r[0] = (t) => p.value = !1)
640
- })
641
- ])
642
- ]),
643
- key: "0"
644
- }
645
- ]), 1032, ["modelValue"]);
646
- };
647
- }
648
- }), tt = { class: "flex items-center" }, lt = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, at = { class: "px-24 flex flex-col pb-24 gap-y-16" }, nt = { class: "flex items-center justify-end" }, ot = { class: "flex flex-col gap-16 text-center" }, st = { class: "fm-typo-en-title-sm-800" }, it = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, rt = { class: "flex gap-x-8" }, Rt = /* @__PURE__ */ Z({
649
- __name: "Card",
650
- setup(ee) {
651
- const { minor: j, global: T } = J, A = y(), g = y(), M = y(), x = we(), w = W(), { t: o } = Be(), B = E(
652
- () => w.sortedStoreCategories.flatMap((t) => t.bundles)
653
- ), s = [
654
- {
655
- header: o("connect.loyalty.card.table.card_number"),
656
- accessorFn: (t) => t.serialNumber
657
- },
658
- {
659
- header: o("connect.loyalty.card.table.redeemed_by"),
660
- accessorKey: "user",
661
- enableSorting: !1,
662
- cell(t) {
663
- const l = t.row.original.pf_member;
664
- return K(
665
- "div",
666
- {
667
- class: "flex items-center gap-x-8"
668
- },
669
- [
670
- K(oe.FmAvatar, {
671
- name: l != null && l.photoUrl || l == null ? void 0 : l.name,
672
- src: (l == null ? void 0 : l.photoUrl) ?? void 0,
673
- size: "sm"
674
- }),
675
- K("span", { class: "fm-typo-en-body-sm-400" }, l == null ? void 0 : l.name)
676
- ]
677
- );
678
- }
679
- },
680
- {
681
- header: o("connect.loyalty.card.table.phone"),
682
- accessorFn: (t) => {
683
- var l;
684
- return ((l = t.pf_member) == null ? void 0 : l.phoneNumber) || "-";
685
- },
686
- accessorKey: "pf_member.phoneNumber"
687
- },
688
- {
689
- header: o("connect.loyalty.card.table.created_at"),
690
- accessorKey: "_id",
691
- accessorFn: (t) => ne(Ue(t._id.toString())).format("DD MMM YYYY hh:mmA")
692
- },
693
- {
694
- header: o("connect.loyalty.card.table.bundle"),
695
- accessorFn: (t) => {
696
- var l;
697
- return ((l = B.value.find((V) => V._id === t.bundle)) == null ? void 0 : l.name) || "-";
698
- }
699
- },
700
- {
701
- header: o("connect.loyalty.card.table.redeemed_at"),
702
- accessorKey: "redeemedAt",
703
- accessorFn: (t) => t.redeemedAt ? ne(t.redeemedAt).format("DD MMM YYYY hh:mmA") : "-"
704
- },
705
- {
706
- header: o("connect.loyalty.card.table.actions"),
707
- cell(t) {
708
- return K(oe.FmButton, {
709
- variant: "tertiary",
710
- icon: "delete",
711
- iconColor: "neutral-gray-400",
712
- disabled: !!t.row.original.redeemedAt,
713
- onClick: (l) => {
714
- l.stopPropagation(), r(t.row.original);
715
- }
716
- });
717
- }
718
- }
719
- ], { tableMeta: p, rowData: D, onSort: I, debouncedFetchData: h, onSearch: C } = $e(L.readCards);
720
- async function n(t) {
721
- var l;
722
- await h(t), (l = A.value) == null || l.showSheet(!1);
723
- }
724
- const u = E(() => x.isPremium ? [
725
- {
726
- label: o("connect.loyalty.card.actions.create"),
727
- value: "create",
728
- isPrimary: !0
729
- },
730
- {
731
- label: o("connect.loyalty.card.actions.manage_design"),
732
- value: "design",
733
- isPrimary: !0
734
- }
735
- ] : []);
736
- async function r(t) {
737
- await ce.remove(
738
- `Are you sure you want to remove card ${t.serialNumber}?`
739
- ) && await j(
740
- async () => {
741
- await L.deleteCard(t._id.toString()), await h({ pageSize: 10, pageIndex: 0 });
742
- },
743
- {
744
- message: `Removing card ${t.serialNumber}`,
745
- successMessage: `Removed card ${t.serialNumber} successfully`
746
- }
747
- );
748
- }
749
- async function b(t) {
750
- if (!t || t.length === 0)
751
- return;
752
- const l = new Ve(), V = t.map((U) => ({
753
- CardNumber: U
754
- }));
755
- l.addRecords(V), await ke(
756
- l.buildExcel(),
757
- `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
758
- {
759
- bookType: "xlsx",
760
- bookSST: !1,
761
- type: "array"
762
- }
763
- );
764
- }
765
- const c = (t) => {
766
- var l;
767
- if (t.redeemedAt) {
768
- xe.error("Update not permitted", 2e3);
769
- return;
770
- }
771
- (l = g == null ? void 0 : g.value) == null || l.showSheet(!0, t);
772
- };
773
- return X(async () => {
774
- await T(async () => {
775
- await x.readPremium(), await w.readMemberStore(), await w.readMembership(), await n();
776
- });
777
- }), (t, l) => {
778
- const V = v("FmPill"), U = v("FmPageHead"), f = v("FmSearch"), N = v("FmButton"), q = v("FmCard");
779
- return m(), $(z, null, [
780
- i(U, {
781
- title: e(o)("connect.loyalty.card.title"),
782
- actions: e(u),
783
- "onClick:action": l[0] || (l[0] = (S) => {
784
- var P, O;
785
- console.log(S), S === "design" && ((P = e(M)) == null || P.showSheet(!0)), S === "create" && ((O = e(A)) == null || O.showSheet(!0));
786
- })
787
- }, {
788
- title: _(() => [
789
- d("div", tt, [
790
- d("span", lt, te(e(o)("connect.loyalty.card.title")), 1),
791
- i(V, {
792
- class: "ml-8",
793
- variant: "premium"
794
- })
795
- ])
796
- ]),
797
- _: 1
798
- }, 8, ["title", "actions"]),
799
- d("div", at, [
800
- e(D).length > 0 || e(D).length <= 0 && e(p).searchValue || e(p).pageCount > 0 ? (m(), $(z, { key: 0 }, [
801
- d("div", nt, [
802
- i(f, {
803
- class: "mt-4",
804
- modelValue: e(p).searchValue,
805
- "onUpdate:modelValue": [
806
- l[1] || (l[1] = (S) => e(p).searchValue = S),
807
- e(C)
808
- ],
809
- placeholder: "Search",
810
- collapsible: ""
811
- }, null, 8, ["modelValue", "onUpdate:modelValue"]),
812
- i(N, {
813
- icon: "ios_share",
814
- variant: "tertiary",
815
- onClick: be(e(Fe), ["prevent"])
816
- }, null, 8, ["onClick"])
817
- ]),
818
- i(Me, {
819
- loading: e(p).isLoading,
820
- "row-data": e(D),
821
- "row-count": e(p).totalRows,
822
- "column-defs": s,
823
- "shrink-at": !1,
824
- "page-count": e(p).pageCount,
825
- "page-index": e(p).pageIndex,
826
- "page-size": e(p).pageSize,
827
- onSortChange: e(I),
828
- onPageChange: l[2] || (l[2] = (S) => {
829
- e(h)({
830
- pageSize: S.pageSize,
831
- pageIndex: S.pageIndex
832
- });
833
- }),
834
- onRowClick: l[3] || (l[3] = (S) => {
835
- c(e(he)(S.original));
836
- })
837
- }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
838
- ], 64)) : (m(), F(q, {
839
- key: 1,
840
- variant: "outlined",
841
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
842
- }, {
843
- default: _(() => [
844
- l[8] || (l[8] = d("img", {
845
- src: ve,
846
- class: "aspect-square w-[150px]"
847
- }, null, -1)),
848
- d("div", ot, [
849
- d("div", st, te(e(o)("connect.loyalty.card.empty_state.title")), 1),
850
- d("div", it, te(e(o)("connect.loyalty.card.empty_state.description")), 1)
851
- ]),
852
- d("div", rt, [
853
- i(N, {
854
- variant: "primary",
855
- label: e(o)("connect.loyalty.card.actions.add"),
856
- icon: "add",
857
- disabled: !e(x).isPremium,
858
- onClick: l[4] || (l[4] = () => {
859
- var S;
860
- return (S = e(A)) == null ? void 0 : S.showSheet(!0);
861
- })
862
- }, null, 8, ["label", "disabled"]),
863
- i(N, {
864
- variant: "secondary",
865
- label: e(o)("connect.loyalty.card.actions.manage_design"),
866
- disabled: !e(x).isPremium,
867
- onClick: l[5] || (l[5] = () => {
868
- var S;
869
- return (S = e(M)) == null ? void 0 : S.showSheet(!0);
870
- })
871
- }, null, 8, ["label", "disabled"])
872
- ])
873
- ]),
874
- _: 1
875
- })),
876
- i(je, {
877
- ref_key: "sheetRef",
878
- ref: A,
879
- onSuccess: l[6] || (l[6] = (S) => n()),
880
- onExport: b
881
- }, null, 512),
882
- i(et, {
883
- ref_key: "designSheetRef",
884
- ref: M,
885
- onSuccess: n
886
- }, null, 512),
887
- i(Qe, {
888
- ref_key: "editSheetRef",
889
- ref: g,
890
- onSuccess: l[7] || (l[7] = (S) => {
891
- var P;
892
- n({
893
- pageSize: e(p).pageSize,
894
- pageIndex: e(p).pageIndex
895
- }), (P = e(g)) == null || P.showSheet(!1);
896
- })
897
- }, null, 512)
898
- ])
899
- ], 64);
900
- };
901
- }
902
- });
903
- export {
904
- Rt as default
905
- };