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