@feedmepos/mf-connect 0.1.0-beta.3 → 0.1.0-beta.31

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 (99) hide show
  1. package/dist/Analytic-C-QC9ivZ.js +424 -0
  2. package/dist/{App-gzbM97vW.js → App-NASVRSh2.js} +397 -384
  3. package/dist/{Broadcast-BwYZkTs0.js → Broadcast-Cffg7nbY.js} +32 -32
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DIh9rz6T.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CA4kVwMl.js} +8 -8
  5. package/dist/Card-CmYFb1_Y.js +897 -0
  6. package/dist/{Collections-Df6tlo8S.js → Collections-CibvGIpU.js} +4 -4
  7. package/dist/{Credit-BPel8vA9.js → Credit-Ck6i9ySs.js} +14 -14
  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-B35zbHHI.js +2198 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BT8ucS5G.js → EffectSheet.vue_vue_type_style_index_0_lang-CQV77_cx.js} +8 -8
  11. package/dist/{Experience-CPpz1Zwx.js → Experience-CWUX2QvS.js} +8 -8
  12. package/dist/{Game-ByLblISC.js → Game-D3cdZrlc.js} +15 -15
  13. package/dist/Index-CWLZiYXT.js +255 -0
  14. package/dist/Marketing-Bol8eY5d.js +20070 -0
  15. package/dist/{Member-CCc_FEZY.js → Member-Cso-T2Xk.js} +4 -4
  16. package/dist/MemberList-Bqns9wko.js +1045 -0
  17. package/dist/{MemberTransactions-DD5ahSbY.js → MemberTransactions-zNw-30Xu.js} +1 -1
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DSPvWk4C.js → MessageInput.vue_vue_type_script_setup_true_lang-BLS5fNr6.js} +2 -2
  19. package/dist/{Mission-VH4057I-.js → Mission-C0-K0A_5.js} +98 -86
  20. package/dist/Overview-fZ9NvFKz.js +1024 -0
  21. package/dist/{Point-Bu3IlpH4.js → Point-D3gGhQlP.js} +23 -23
  22. package/dist/{Promotion-B45AOHis.js → Promotion-COCJIfu-.js} +53 -47
  23. package/dist/Record-C0a4Cn1U.js +209 -0
  24. package/dist/Reward-D0G4CBYd.js +411 -0
  25. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-zSOwxAcS.js +151 -0
  26. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-AmIdaAeX.js +1639 -0
  27. package/dist/Segment-eBM3aveX.js +567 -0
  28. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BgMuKAjE.js +181 -0
  29. package/dist/{Setting-CF09eRQJ.js → Setting-Dfye6fs5.js} +8 -8
  30. package/dist/Store-rQfwc8d6.js +1745 -0
  31. package/dist/{StoreRewards-0iGExjqQ.js → StoreRewards-DVTNMWdG.js} +12 -12
  32. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-3dvBoXz2.js +957 -0
  33. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BEfxin47.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DxGIUrmO.js} +1 -1
  34. package/dist/{Tier-IaeWe7rM.js → Tier-DekrYu5l.js} +327 -317
  35. package/dist/{Title-DD67Zxh5.js → Title-oAWsBqoM.js} +199 -183
  36. package/dist/{Transaction-BsPDnLzB.js → Transaction-Ss2XCksi.js} +2 -2
  37. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-BMIqnBts.js +130 -0
  38. package/dist/{Voucher-M7JfcKo0.js → Voucher-CjPJxdw8.js} +31 -31
  39. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DlWCpoOp.js +419 -0
  40. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-k0lprU2i.js → ZodTextField.vue_vue_type_script_setup_true_lang-FXQNhMrv.js} +1 -1
  41. package/dist/{app-HFICF0vL.js → app-C_zlbFNe.js} +1285 -1283
  42. package/dist/{app-DwujUNP-.js → app-WUJQRyEM.js} +1 -1
  43. package/dist/app.js +1 -1
  44. package/dist/{business-BaF1QJXa.js → business-C0e_E2xp.js} +1 -1
  45. package/dist/{campaign-CTDtmAE9.js → campaign-iWzbtNA5.js} +2 -2
  46. package/dist/collectible.enum-QITAo8Jg.js +19 -0
  47. package/dist/{collection.fn-DMW03W4R.js → collection.fn-R3hvasuZ.js} +2 -2
  48. package/dist/{dto-gpaNZHzQ.js → dto-D_tjJ72q.js} +78 -86
  49. package/dist/{effect-CBUmtwet.js → effect-_bpW5fmr.js} +9 -9
  50. package/dist/email-addresses-DUKn8uD0.js +705 -0
  51. package/dist/{export-Bdh_PbsW.js → export-CEBWZ8ko.js} +3 -3
  52. package/dist/{helper-Cu9elRvl.js → helper-CuF45pbY.js} +1 -1
  53. package/dist/{index-NXiDu42U.js → index-BO8RnVxy.js} +1 -1
  54. package/dist/{index-CArqG03W.js → index-BPc3wxOE.js} +39 -35
  55. package/dist/index-BXTQ6onZ.js +1067 -0
  56. package/dist/index-C4aPU80a.js +38 -0
  57. package/dist/{index-At6yms5t.js → index-CBzSPD25.js} +30 -26
  58. package/dist/{index-Ch6XwPzF.js → index-CR0ZVZQG.js} +1 -1
  59. package/dist/{index-DrGrOgZB.js → index-CXFwMV0s.js} +13 -1
  60. package/dist/index-CsaQJMAR.js +66 -0
  61. package/dist/{index-Dfdg2Q3E.js → index-Dh6xIUXJ.js} +1 -1
  62. package/dist/{index-ogzk-Mj4.js → index-LMvyNoHf.js} +1 -1
  63. package/dist/{index-Crw-Vgo5.js → index-S6sFiBxK.js} +1500 -1479
  64. package/dist/index-SpDFfOz_.js +54 -0
  65. package/dist/{index-CtH2S49l.js → index-Urbp7cdO.js} +203 -195
  66. package/dist/index-pHbs1GrF.js +29000 -0
  67. package/dist/{index.esm2017-CeJpvUbA.js → index.esm2017-BunOalUj.js} +33 -33
  68. package/dist/{loading-Cn8ml_vy.js → loading-CYFsZ9UB.js} +591 -597
  69. package/dist/{membership-CX4AKMlH.js → membership-C9089j0H.js} +51 -43
  70. package/dist/money-D-zGFohv.js +15 -0
  71. package/dist/number-UFl4zW6h.js +12 -0
  72. package/dist/objectid-BKIyQ5iE.js +145 -0
  73. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  74. package/dist/reward-LYKGLzXz.js +36 -0
  75. package/dist/{rule-Cv83Y59R.js → rule-BUUKmR4_.js} +180 -177
  76. package/dist/{rule-builder-Dew4yB5Q.js → rule-builder-9JUuOcMH.js} +1 -1
  77. package/dist/style.css +1 -1
  78. package/dist/{template-CSnbgM1o.js → template-CkXuF0cN.js} +5 -5
  79. package/dist/trigger-DjAx9efN.js +114 -0
  80. package/dist/user-DbsZta3D.js +54 -0
  81. package/dist/{vue-i18n-CNH_IhVd.js → vue-i18n-yYO72Mbp.js} +2 -2
  82. package/dist/{xlsx-D4DUZHix.js → xlsx-Dagi6ArS.js} +1 -1
  83. package/package.json +8 -7
  84. package/dist/Analytic-BC5BA6pN.js +0 -622
  85. package/dist/Card-CBYQGKwY.js +0 -825
  86. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-PsrS7I0r.js +0 -2809
  87. package/dist/Marketing-D0vm80e_.js +0 -316
  88. package/dist/MemberList-CrnipE9y.js +0 -1733
  89. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Ijc2OYh9.js +0 -1753
  90. package/dist/Segment-ZWsp48aC.js +0 -437
  91. package/dist/Store-B_G6Dhmq.js +0 -1511
  92. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CaxUr9zl.js +0 -890
  93. package/dist/index-8MaN7rez.js +0 -762
  94. package/dist/index-BjdHxGDn.js +0 -298
  95. package/dist/index-CuvNtC_M.js +0 -61
  96. package/dist/index-RP0XOPRL.js +0 -29193
  97. package/dist/money-BTejgvKu.js +0 -15
  98. package/dist/number-Cen5TucC.js +0 -12
  99. package/dist/user-Bm4KttFq.js +0 -37
@@ -0,0 +1,897 @@
1
+ import { defineComponent as Z, ref as y, computed as E, watch as ce, 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 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 ne } from "./moment-BWErdI6_.js";
4
+ import { useDialog as ge, components as oe } from "@feedmepos/ui-library";
5
+ import { p as de, u as J, f as se, n as ve } from "./loading-CYFsZ9UB.js";
6
+ import { u as ue } from "./app-wDQR6dpb.js";
7
+ import { u as W } from "./membership-C9089j0H.js";
8
+ import { _ as Q } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
9
+ import { m as L } from "./index-CXFwMV0s.js";
10
+ import { z as ye } from "./app-C_zlbFNe.js";
11
+ import { Z as xe } from "./zod-Bg2FbC-D.js";
12
+ import { _ as ie } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
13
+ import "./index-CBzSPD25.js";
14
+ import "./index-S6sFiBxK.js";
15
+ import { k as Ce } from "./index-BXTQ6onZ.js";
16
+ import "./index-BPc3wxOE.js";
17
+ import "./index-Urbp7cdO.js";
18
+ import "./index-LMvyNoHf.js";
19
+ import "./index-SpDFfOz_.js";
20
+ import { O as Se } from "./objectid-BKIyQ5iE.js";
21
+ import { a as _e, c as he } from "./object-qECH92oz.js";
22
+ import { u as we } from "./business-C0e_E2xp.js";
23
+ import { w as ke } from "./xlsx-Dagi6ArS.js";
24
+ import { e as Fe, C as Ve } from "./export-CEBWZ8ko.js";
25
+ import { u as $e, _ as Me } from "./usePagination-BeF5K3M7.js";
26
+ import { u as Be } from "./vue-i18n-yYO72Mbp.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" }, Ne = { class: "space-y-16" }, Pe = {
29
+ key: 0,
30
+ class: "flex flex-col gap-[16px] w-full"
31
+ }, Ie = { 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, f = 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
+ }), b = [
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
+ ], N = y(D[0].value), h = y("bulk"), C = y(0), n = E(
86
+ () => {
87
+ var c;
88
+ return (c = f.membership.design) == null ? void 0 : c[C.value];
89
+ }
90
+ ), u = y(!1), r = E(
91
+ () => f.sortedStoreCategories.flatMap((c) => c.bundles)
92
+ );
93
+ async function g(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 de.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
+ }), ce(
117
+ () => s.value.codeConfig.length,
118
+ (c, t) => {
119
+ c != t && (s.value.codeConfig.pattern = "#".repeat(Number(c)));
120
+ }
121
+ ), X(async () => {
122
+ await f.readMemberStore();
123
+ }), (c, t) => {
124
+ const l = v("FmRadio"), V = v("FmRadioGroup"), U = v("FmSwitch"), p = v("FmStepperField"), P = v("FmSelect"), q = v("FmTextField"), S = v("FmTextarea"), I = v("FmButton"), O = v("FmForm"), me = v("FmSideSheet");
125
+ return m(), F(me, {
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(I, {
138
+ label: "Save",
139
+ onClick: t[17] || (t[17] = (R) => g(e(s))),
140
+ loading: e(ue)().isLoading
141
+ }, null, 8, ["loading"]),
142
+ i(I, {
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(b, (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(p, {
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(P, {
199
+ label: "Charset",
200
+ "model-value": e(N),
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
+ N.value = a, e(s).codeConfig.charset = a;
205
+ })
206
+ }, null, 8, ["model-value", "helper-text"]),
207
+ e(N) === "" ? (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", Ne, [
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(I, {
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(f).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(I, {
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(f).membership.design ? (m(), $("div", Pe, [
299
+ d("div", Ie, [
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(f).membership.design, (a, Y) => (m(), $("img", {
307
+ src: a.image,
308
+ key: `image_${Y}`,
309
+ class: re(["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, f = 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, b.value = (u = f.membership.design) == null ? void 0 : u.findIndex(
341
+ (r) => r.image === n.design
342
+ ));
343
+ }
344
+ const b = y(0), D = E(
345
+ () => {
346
+ var C;
347
+ return (C = f.membership.design) == null ? void 0 : C[b.value];
348
+ }
349
+ ), N = E(
350
+ () => f.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 f.readMemberStore();
370
+ }), (C, n) => {
371
+ const u = v("FmTextField"), r = v("FmSwitch"), g = 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(g, {
385
+ label: "Save",
386
+ disabled: !!e(o).redeemedAt,
387
+ onClick: n[8] || (n[8] = (l) => h(e(o))),
388
+ loading: e(ue)().isLoading
389
+ }, null, 8, ["disabled", "loading"]),
390
+ i(g, {
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] = (p) => e(o).serialNumber = p),
413
+ label: "Card Number",
414
+ rules: [
415
+ e(xe).toRule(e(ye).string().min(1, "Card number is required"))
416
+ ],
417
+ required: !0
418
+ }, null, 8, ["modelValue", "rules"]),
419
+ n[12] || (n[12] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
420
+ i(r, {
421
+ "label-placement": "right",
422
+ label: "Set card number on bind",
423
+ "model-value": e(o).setCardOnBind || !1,
424
+ "onUpdate:modelValue": n[1] || (n[1] = (p) => e(o).setCardOnBind = p)
425
+ }, null, 8, ["model-value"]),
426
+ i(Q, {
427
+ label: "Activate bundle on bind",
428
+ placeholder: "Select bundle",
429
+ items: e(N).filter((p) => !p.stripePriceId).map((p) => ({ label: p.name, value: p._id })),
430
+ modelValue: e(o).bundle,
431
+ "onUpdate:modelValue": n[3] || (n[3] = (p) => e(o).bundle = p)
432
+ }, {
433
+ append: _(() => [
434
+ e(o).bundle ? (m(), F(g, {
435
+ key: 0,
436
+ icon: "link_off",
437
+ variant: "plain",
438
+ onClick: n[2] || (n[2] = (p) => e(o).bundle = null)
439
+ })) : k("", !0)
440
+ ]),
441
+ _: 1
442
+ }, 8, ["items", "modelValue"]),
443
+ (V = (l = e(f).store) == null ? void 0 : l.stripe) != null && V.apiKey ? (m(), F(Q, {
444
+ key: 0,
445
+ label: "Linked subscription bundle",
446
+ placeholder: "Select bundle",
447
+ items: e(N).filter((p) => p.stripePriceId).map((p) => ({ label: p.name, value: p._id })),
448
+ modelValue: e(o).subscriptionBundle,
449
+ "onUpdate:modelValue": n[5] || (n[5] = (p) => e(o).subscriptionBundle = p)
450
+ }, {
451
+ append: _(() => [
452
+ e(o).subscriptionBundle ? (m(), F(g, {
453
+ key: 0,
454
+ icon: "link_off",
455
+ variant: "plain",
456
+ onClick: n[4] || (n[4] = (p) => e(o).subscriptionBundle = null)
457
+ })) : k("", !0)
458
+ ]),
459
+ _: 1
460
+ }, 8, ["items", "modelValue"])) : k("", !0)
461
+ ]),
462
+ e(f).membership.design ? (m(), $("div", Le, [
463
+ d("div", Oe, [
464
+ n[13] || (n[13] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
465
+ d("img", {
466
+ src: (U = e(D)) == null ? void 0 : U.image,
467
+ class: "aspect-[16/9]"
468
+ }, null, 8, Ye),
469
+ d("div", Ke, [
470
+ (m(!0), $(z, null, H(e(f).membership.design, (p, P) => (m(), $("img", {
471
+ src: p.image,
472
+ key: `image_${P}`,
473
+ class: re(["w-[112px] h-[63px] cursor-pointer", `${e(b) === P ? "border-[2px] border-fm-color-primary" : ""}`]),
474
+ onClick: (q) => b.value = P,
475
+ alt: `ai_image_predict_${P}`,
476
+ style: { objectFit: "cover" }
477
+ }, null, 10, Ge))), 128))
478
+ ])
479
+ ])
480
+ ])) : k("", !0)
481
+ ];
482
+ }),
483
+ _: 1
484
+ }, 512)
485
+ ]),
486
+ _: 1
487
+ }, 8, ["modelValue"]);
488
+ };
489
+ }
490
+ }), Ze = {
491
+ key: 0,
492
+ class: "grid grid-cols-1 gap-8"
493
+ }, Xe = { class: "flex items-center gap-8" }, Je = { class: "flex items-center gap-8" }, We = 5, et = /* @__PURE__ */ Z({
494
+ __name: "CardDesignSheet",
495
+ emits: ["success"],
496
+ setup(ee, { expose: j, emit: T }) {
497
+ const { minor: A } = J, f = W(), M = ge(), x = y(!1);
498
+ y(), y(!1);
499
+ const w = y(), o = y(null);
500
+ E(() => {
501
+ var u, r;
502
+ return Math.min((((r = (u = w.value) == null ? void 0 : u.design) == null ? void 0 : r.length) ?? 0) + 1, We);
503
+ });
504
+ const B = T, s = E(() => {
505
+ var u, r;
506
+ return ((r = (u = f.membership) == null ? void 0 : u.design) == null ? void 0 : r.filter((g) => g.image)) || [];
507
+ }), b = y(!1);
508
+ function D(u) {
509
+ b.value = u;
510
+ }
511
+ function N() {
512
+ x.value = !0;
513
+ }
514
+ async function h() {
515
+ await A(
516
+ async () => {
517
+ var g;
518
+ const u = _e(w.value), r = Ce.parse(u);
519
+ if (r.design = (r == null ? void 0 : r.design) || [], o.value) {
520
+ const c = Se().toHexString(), t = await se.update(
521
+ se.designPath(c, o.value),
522
+ o.value
523
+ );
524
+ (g = r.design) == null || g.push({
525
+ _id: c,
526
+ image: t
527
+ });
528
+ }
529
+ await L.update(r), await n(), await B("success"), o.value = null, x.value = !1;
530
+ },
531
+ {
532
+ message: "Saving card design",
533
+ successMessage: "Card design saved"
534
+ }
535
+ );
536
+ }
537
+ async function C(u, r) {
538
+ u ? o.value = u : r && M.open({
539
+ title: "Delete Design",
540
+ message: "Are you sure you want to delete this design?",
541
+ primaryActions: { text: "Delete", close: !0 },
542
+ secondaryActions: { text: "Cancel", close: !1 }
543
+ }).onPrimary(async () => {
544
+ var c, t;
545
+ const g = (c = w.value.design) == null ? void 0 : c.findIndex((l) => l._id == r);
546
+ console.log(g), g !== -1 && ((t = w.value.design) == null || t.splice(g, 1)), await h();
547
+ }).onSecondary(() => {
548
+ M.close();
549
+ });
550
+ }
551
+ async function n() {
552
+ await f.readMembership(), w.value = f.membership;
553
+ }
554
+ return j({
555
+ showSheet: D
556
+ }), X(async () => {
557
+ await n(), s.value.length || (x.value = !0);
558
+ }), (u, r) => {
559
+ const g = v("FmButton"), c = v("FmSideSheet");
560
+ return m(), F(c, {
561
+ "max-width": 560,
562
+ "dismiss-away": !0,
563
+ header: "Manage Design",
564
+ modelValue: e(b),
565
+ "onUpdate:modelValue": [
566
+ r[2] || (r[2] = (t) => G(b) ? b.value = t : null),
567
+ r[3] || (r[3] = (t) => b.value = t)
568
+ ]
569
+ }, pe({
570
+ default: _(() => [
571
+ e(x) ? k("", !0) : (m(), $("div", Ze, [
572
+ (m(!0), $(z, null, H(e(s), (t) => (m(), F(ie, {
573
+ key: String(t._id),
574
+ "image-fit": "cover",
575
+ label: "",
576
+ "aspect-ratio": "16/9",
577
+ thumbnail: t.image,
578
+ accept: ".png, .jpg, .jpeg, .gif",
579
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
580
+ file: void 0,
581
+ "delete-button": !1
582
+ }, {
583
+ "delete-button": _(() => [
584
+ i(g, {
585
+ class: "!text-neutral-50 !bg-neutral-700",
586
+ icon: "delete",
587
+ variant: "tertiary",
588
+ onClick: (l) => C(null, t._id)
589
+ }, null, 8, ["onClick"])
590
+ ]),
591
+ _: 2
592
+ }, 1032, ["thumbnail"]))), 128))
593
+ ])),
594
+ e(x) ? (m(), F(ie, {
595
+ key: 1,
596
+ "image-fit": "cover",
597
+ label: "",
598
+ "aspect-ratio": "16/9",
599
+ accept: ".png, .jpg, .jpeg, .gif",
600
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
601
+ "onUpdate:file": C
602
+ })) : k("", !0)
603
+ ]),
604
+ _: 2
605
+ }, [
606
+ e(x) ? {
607
+ name: "side-sheet-footer",
608
+ fn: _(() => [
609
+ d("div", Je, [
610
+ i(g, {
611
+ label: "Save",
612
+ onClick: h,
613
+ disabled: !e(o)
614
+ }, null, 8, ["disabled"]),
615
+ i(g, {
616
+ label: "Cancel",
617
+ type: "button",
618
+ variant: "tertiary",
619
+ onClick: r[1] || (r[1] = (t) => x.value = !1)
620
+ })
621
+ ])
622
+ ]),
623
+ key: "1"
624
+ } : {
625
+ name: "side-sheet-footer",
626
+ fn: _(() => [
627
+ d("div", Xe, [
628
+ i(g, {
629
+ label: "Add Design",
630
+ onClick: N
631
+ }),
632
+ i(g, {
633
+ label: "Cancel",
634
+ type: "button",
635
+ variant: "tertiary",
636
+ onClick: r[0] || (r[0] = (t) => b.value = !1)
637
+ })
638
+ ])
639
+ ]),
640
+ key: "0"
641
+ }
642
+ ]), 1032, ["modelValue"]);
643
+ };
644
+ }
645
+ }), 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({
646
+ __name: "Card",
647
+ setup(ee) {
648
+ const { minor: j, global: T } = J, A = y(), f = y(), M = y(), x = we(), w = W(), { t: o } = Be(), B = E(
649
+ () => w.sortedStoreCategories.flatMap((t) => t.bundles)
650
+ ), s = [
651
+ {
652
+ header: o("connect.loyalty.card.table.card_number"),
653
+ accessorFn: (t) => t.serialNumber
654
+ },
655
+ {
656
+ header: o("connect.loyalty.card.table.redeemed_by"),
657
+ accessorKey: "user",
658
+ enableSorting: !1,
659
+ cell(t) {
660
+ const l = t.row.original.pf_member;
661
+ return K(
662
+ "div",
663
+ {
664
+ class: "flex items-center gap-x-8"
665
+ },
666
+ [
667
+ K(oe.FmAvatar, {
668
+ name: l != null && l.photoUrl || l == null ? void 0 : l.name,
669
+ src: (l == null ? void 0 : l.photoUrl) ?? void 0,
670
+ size: "sm"
671
+ }),
672
+ K("span", { class: "fm-typo-en-body-sm-400" }, l == null ? void 0 : l.name)
673
+ ]
674
+ );
675
+ }
676
+ },
677
+ {
678
+ header: o("connect.loyalty.card.table.phone"),
679
+ accessorFn: (t) => {
680
+ var l;
681
+ return ((l = t.pf_member) == null ? void 0 : l.phoneNumber) || "-";
682
+ },
683
+ accessorKey: "pf_member.phoneNumber"
684
+ },
685
+ {
686
+ header: o("connect.loyalty.card.table.created_at"),
687
+ accessorKey: "_id",
688
+ accessorFn: (t) => ne(Ue(t._id.toString())).format("DD MMM YYYY hh:mmA")
689
+ },
690
+ {
691
+ header: o("connect.loyalty.card.table.bundle"),
692
+ accessorFn: (t) => {
693
+ var l;
694
+ return ((l = B.value.find((V) => V._id === t.bundle)) == null ? void 0 : l.name) || "-";
695
+ }
696
+ },
697
+ {
698
+ header: o("connect.loyalty.card.table.redeemed_at"),
699
+ accessorKey: "redeemedAt",
700
+ accessorFn: (t) => t.redeemedAt ? ne(t.redeemedAt).format("DD MMM YYYY hh:mmA") : "-"
701
+ },
702
+ {
703
+ header: o("connect.loyalty.card.table.actions"),
704
+ cell(t) {
705
+ return K(oe.FmButton, {
706
+ variant: "tertiary",
707
+ icon: "delete",
708
+ iconColor: "neutral-gray-400",
709
+ disabled: !!t.row.original.redeemedAt,
710
+ onClick: (l) => {
711
+ l.stopPropagation(), r(t.row.original);
712
+ }
713
+ });
714
+ }
715
+ }
716
+ ], { tableMeta: b, rowData: D, onSort: N, debouncedFetchData: h, onSearch: C } = $e(L.readCards);
717
+ async function n() {
718
+ var t;
719
+ await h(), (t = A.value) == null || t.showSheet(!1);
720
+ }
721
+ const u = E(() => x.isPremium ? [
722
+ {
723
+ label: o("connect.loyalty.card.actions.create"),
724
+ value: "create",
725
+ isPrimary: !0
726
+ },
727
+ {
728
+ label: o("connect.loyalty.card.actions.manage_design"),
729
+ value: "design",
730
+ isPrimary: !0
731
+ }
732
+ ] : []);
733
+ async function r(t) {
734
+ await de.remove(
735
+ `Are you sure you want to remove card ${t.serialNumber}?`
736
+ ) && await j(
737
+ async () => {
738
+ await L.deleteCard(t._id.toString()), await h({ pageSize: 10, pageIndex: 0 });
739
+ },
740
+ {
741
+ message: `Removing card ${t.serialNumber}`,
742
+ successMessage: `Removed card ${t.serialNumber} successfully`
743
+ }
744
+ );
745
+ }
746
+ async function g(t) {
747
+ const l = new Ve(), V = t.map((U) => ({
748
+ CardNumber: U
749
+ }));
750
+ l.addRecords(V), await ke(
751
+ l.buildExcel(),
752
+ `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
753
+ {
754
+ bookType: "xlsx",
755
+ bookSST: !1,
756
+ type: "array"
757
+ }
758
+ );
759
+ }
760
+ const c = (t) => {
761
+ var l;
762
+ if (t.redeemedAt) {
763
+ ve.error("Update not permitted", 2e3);
764
+ return;
765
+ }
766
+ (l = f == null ? void 0 : f.value) == null || l.showSheet(!0, t);
767
+ };
768
+ return X(async () => {
769
+ await T(async () => {
770
+ await x.readPremium(), await w.readMemberStore(), await w.readMembership(), await n();
771
+ });
772
+ }), (t, l) => {
773
+ const V = v("FmPill"), U = v("FmPageHead"), p = v("FmSearch"), P = v("FmButton"), q = v("FmCard");
774
+ return m(), $(z, null, [
775
+ i(U, {
776
+ title: e(o)("connect.loyalty.card.title"),
777
+ actions: e(u),
778
+ "onClick:action": l[0] || (l[0] = (S) => {
779
+ var I, O;
780
+ console.log(S), S === "design" && ((I = e(M)) == null || I.showSheet(!0)), S === "create" && ((O = e(A)) == null || O.showSheet(!0));
781
+ })
782
+ }, {
783
+ title: _(() => [
784
+ d("div", tt, [
785
+ d("span", lt, te(e(o)("connect.loyalty.card.title")), 1),
786
+ i(V, {
787
+ class: "ml-8",
788
+ variant: "premium"
789
+ })
790
+ ])
791
+ ]),
792
+ _: 1
793
+ }, 8, ["title", "actions"]),
794
+ d("div", at, [
795
+ e(D).length > 0 || e(D).length <= 0 && e(b).searchValue || e(b).pageCount > 0 ? (m(), $(z, { key: 0 }, [
796
+ d("div", nt, [
797
+ i(p, {
798
+ class: "mt-4",
799
+ modelValue: e(b).searchValue,
800
+ "onUpdate:modelValue": [
801
+ l[1] || (l[1] = (S) => e(b).searchValue = S),
802
+ e(C)
803
+ ],
804
+ placeholder: "Search",
805
+ collapsible: ""
806
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
807
+ i(P, {
808
+ icon: "ios_share",
809
+ variant: "tertiary",
810
+ onClick: fe(e(Fe), ["prevent"])
811
+ }, null, 8, ["onClick"])
812
+ ]),
813
+ i(Me, {
814
+ loading: e(b).isLoading,
815
+ "row-data": e(D),
816
+ "row-count": e(b).totalRows,
817
+ "column-defs": s,
818
+ "shrink-at": !1,
819
+ "page-count": e(b).pageCount,
820
+ "page-index": e(b).pageIndex,
821
+ "page-size": e(b).pageSize,
822
+ onSortChange: e(N),
823
+ onPageChange: l[2] || (l[2] = (S) => {
824
+ e(h)({
825
+ pageSize: S.pageSize,
826
+ pageIndex: S.pageIndex
827
+ });
828
+ }),
829
+ onRowClick: l[3] || (l[3] = (S) => {
830
+ c(e(he)(S.original));
831
+ })
832
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
833
+ ], 64)) : (m(), F(q, {
834
+ key: 1,
835
+ variant: "outlined",
836
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
837
+ }, {
838
+ default: _(() => [
839
+ l[7] || (l[7] = d("img", {
840
+ src: be,
841
+ class: "aspect-square w-[150px]"
842
+ }, null, -1)),
843
+ d("div", ot, [
844
+ d("div", st, te(e(o)("connect.loyalty.card.empty_state.title")), 1),
845
+ d("div", it, te(e(o)("connect.loyalty.card.empty_state.description")), 1)
846
+ ]),
847
+ d("div", rt, [
848
+ i(P, {
849
+ variant: "primary",
850
+ label: e(o)("connect.loyalty.card.actions.add"),
851
+ icon: "add",
852
+ disabled: !e(x).isPremium,
853
+ onClick: l[4] || (l[4] = () => {
854
+ var S;
855
+ return (S = e(A)) == null ? void 0 : S.showSheet(!0);
856
+ })
857
+ }, null, 8, ["label", "disabled"]),
858
+ i(P, {
859
+ variant: "secondary",
860
+ label: e(o)("connect.loyalty.card.actions.manage_design"),
861
+ disabled: !e(x).isPremium,
862
+ onClick: l[5] || (l[5] = () => {
863
+ var S;
864
+ return (S = e(M)) == null ? void 0 : S.showSheet(!0);
865
+ })
866
+ }, null, 8, ["label", "disabled"])
867
+ ])
868
+ ]),
869
+ _: 1
870
+ })),
871
+ i(je, {
872
+ ref_key: "sheetRef",
873
+ ref: A,
874
+ onSuccess: n,
875
+ onExport: g
876
+ }, null, 512),
877
+ i(et, {
878
+ ref_key: "designSheetRef",
879
+ ref: M,
880
+ onSuccess: n
881
+ }, null, 512),
882
+ i(Qe, {
883
+ ref_key: "editSheetRef",
884
+ ref: f,
885
+ onSuccess: l[6] || (l[6] = (S) => {
886
+ var I;
887
+ n(), (I = e(f)) == null || I.showSheet(!1);
888
+ })
889
+ }, null, 512)
890
+ ])
891
+ ], 64);
892
+ };
893
+ }
894
+ });
895
+ export {
896
+ Rt as default
897
+ };