@feedmepos/mf-connect 0.1.57-prod → 0.1.58-prod

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