@feedmepos/mf-connect 0.1.0-beta.2 → 0.1.0-beta.21

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 (97) hide show
  1. package/dist/Analytic-CZ8gfj2V.js +424 -0
  2. package/dist/{App-D8a5eW51.js → App-Da9h7lhI.js} +397 -384
  3. package/dist/{Broadcast-C8jgMe6g.js → Broadcast-m6ehTw7F.js} +32 -32
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-pG8WvV4I.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BTKA2Ygl.js} +8 -8
  5. package/dist/Card-DqZveZ44.js +685 -0
  6. package/dist/{Collections-lMrdPUuM.js → Collections-XIY6SLgQ.js} +4 -4
  7. package/dist/{Credit-CJfU5tP4.js → Credit-B6Yg3_al.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-D1gub9ZP.js +2198 -0
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CzEtOmp0.js → EffectSheet.vue_vue_type_style_index_0_lang-tRUwA8zh.js} +8 -8
  11. package/dist/{Experience-Bp2ki8gU.js → Experience-CsoneWLZ.js} +8 -8
  12. package/dist/{Game-BpTf6ebE.js → Game-B029f9yE.js} +15 -15
  13. package/dist/Index-B2LvLfrR.js +226 -0
  14. package/dist/Marketing-DUTyDRXu.js +20070 -0
  15. package/dist/{Member-BSWyy32a.js → Member-CATybMaC.js} +4 -4
  16. package/dist/MemberList-DxvQ7DnC.js +1045 -0
  17. package/dist/{MemberTransactions-BzHiXCnp.js → MemberTransactions-fEZyBY9P.js} +1 -1
  18. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-e-zWg08J.js → MessageInput.vue_vue_type_script_setup_true_lang-BCCEsJZj.js} +2 -2
  19. package/dist/{Mission-8IGT3T2C.js → Mission-Cl3O0ULj.js} +16 -16
  20. package/dist/Overview-BVI2xGvT.js +1014 -0
  21. package/dist/{Point-CbbJ6ohd.js → Point-DSVn47pK.js} +23 -23
  22. package/dist/{Promotion-BYXCJa_S.js → Promotion-C4HyMpPg.js} +53 -47
  23. package/dist/Record-BSKXwUu2.js +187 -0
  24. package/dist/Reward-Cus20Wq5.js +399 -0
  25. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Dm6Vgx8-.js +151 -0
  26. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CqMCdTsv.js +1597 -0
  27. package/dist/Segment-DAHJ2FYV.js +567 -0
  28. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DpkIgpqy.js +181 -0
  29. package/dist/{Setting-CLpvvZTv.js → Setting-D7dKlTiZ.js} +8 -8
  30. package/dist/Store-DQdWn1Dw.js +1745 -0
  31. package/dist/{StoreRewards-CUM2irXK.js → StoreRewards-Cut9mJGn.js} +12 -12
  32. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BQscw_Di.js +957 -0
  33. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-DEb4OBcX.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BVzz2Zkl.js} +1 -1
  34. package/dist/{Tier-DZTDxWBo.js → Tier-DGpNybHO.js} +15 -15
  35. package/dist/{Title-C2Dr5ceK.js → Title-D5y8GEwE.js} +15 -15
  36. package/dist/{Transaction-BL4mS29d.js → Transaction-CCnZouEv.js} +2 -2
  37. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Cr9DV7hr.js +130 -0
  38. package/dist/{Voucher-Cx0r2-df.js → Voucher-BJ6RC4SS.js} +31 -31
  39. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-6751WdaT.js +419 -0
  40. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DWuAODUF.js → ZodTextField.vue_vue_type_script_setup_true_lang-aq-9V3Gc.js} +1 -1
  41. package/dist/{app-wE5HTF_Y.js → app-D3chCumI.js} +1279 -1282
  42. package/dist/{app-B_xuZ5HB.js → app-PfWyqx7U.js} +1 -1
  43. package/dist/app.js +1 -1
  44. package/dist/{business-DSv8zM8C.js → business-trsrJyHK.js} +1 -1
  45. package/dist/{campaign-7y5qquHZ.js → campaign-B1rgdv77.js} +2 -2
  46. package/dist/collectible.enum-ZoD0ya1M.js +19 -0
  47. package/dist/{collection.fn-BxVZQAx0.js → collection.fn-CnQjdokW.js} +2 -2
  48. package/dist/{dto-Ew1QwLci.js → dto-DuJumvC2.js} +12 -20
  49. package/dist/{effect-BzPh8fRI.js → effect-CFYktLyZ.js} +9 -9
  50. package/dist/email-addresses-BocLAqLt.js +705 -0
  51. package/dist/{export-C9tDplkA.js → export-BDxbvd3c.js} +3 -3
  52. package/dist/{helper-Sz7oQ0F4.js → helper-Bx6u7f_W.js} +1 -1
  53. package/dist/{index-DH_1nOJ_.js → index-7QsBQpBM.js} +39 -35
  54. package/dist/{index-z0IfdrZk.js → index-AcoIUTDS.js} +203 -195
  55. package/dist/{index-C3_4GUiI.js → index-BAUe6Mqp.js} +7 -1
  56. package/dist/{index-C0lpADCo.js → index-C20tnKDo.js} +1 -1
  57. package/dist/{index-C-SOz7jt.js → index-CDgSJNKm.js} +1 -1
  58. package/dist/{index-DBMaUGYI.js → index-CTnZ9dt0.js} +30 -26
  59. package/dist/index-CUMB0mpB.js +28997 -0
  60. package/dist/index-CsF6BSZU.js +1067 -0
  61. package/dist/index-CsaQJMAR.js +66 -0
  62. package/dist/{index-tv4t0Pnh.js → index-DwXHEi0X.js} +1 -1
  63. package/dist/{index-_3qBsogG.js → index-ZXWgygOr.js} +1500 -1479
  64. package/dist/index-_v_LQTuR.js +53 -0
  65. package/dist/index-kLMiwwB-.js +38 -0
  66. package/dist/{index-gIRszcHf.js → index-pRpTA8Kd.js} +1 -1
  67. package/dist/{index.esm2017-BnKJDxUo.js → index.esm2017-DuOZ7nuk.js} +33 -33
  68. package/dist/{loading-Ds-yFYhc.js → loading-BTEwnG5-.js} +591 -597
  69. package/dist/{membership-DaiVw9qF.js → membership-DkH7qw6W.js} +51 -43
  70. package/dist/money-BfCdj0Ts.js +15 -0
  71. package/dist/number-BKHcstZb.js +12 -0
  72. package/dist/objectid-CumRza_j.js +145 -0
  73. package/dist/remy-vue-client-Cpppk9h-.js +1693 -0
  74. package/dist/reward-DpR3xoxT.js +36 -0
  75. package/dist/{rule-Cd2M6Ri2.js → rule-Hb9_sJvP.js} +180 -177
  76. package/dist/{rule-builder-B6og27Q1.js → rule-builder-BhwlX4fv.js} +1 -1
  77. package/dist/style.css +1 -1
  78. package/dist/{template-DouRWBpv.js → template-PkDFDppy.js} +5 -5
  79. package/dist/trigger-vLHrldAH.js +114 -0
  80. package/dist/{vue-i18n-BTlOChXs.js → vue-i18n-ComnFt3O.js} +2 -2
  81. package/dist/{xlsx-SahfXQ70.js → xlsx-CsUJ1mq4.js} +1 -1
  82. package/package.json +8 -7
  83. package/dist/Analytic-DSD9TsKr.js +0 -622
  84. package/dist/Card-C1K7ULPo.js +0 -825
  85. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BYoaa_-x.js +0 -2809
  86. package/dist/Marketing-BiKE2gxA.js +0 -316
  87. package/dist/MemberList-CHlGREyR.js +0 -1733
  88. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Bruh-umZ.js +0 -1753
  89. package/dist/Segment-DXDNM0yd.js +0 -437
  90. package/dist/Store-C6-P6bwc.js +0 -1511
  91. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-JaRdmqif.js +0 -890
  92. package/dist/index-BQm0C3Jm.js +0 -298
  93. package/dist/index-CuvNtC_M.js +0 -61
  94. package/dist/index-D-2nFLsg.js +0 -762
  95. package/dist/index-Dy4pmQpt.js +0 -29193
  96. package/dist/money-BHtBdZoz.js +0 -15
  97. package/dist/number-CZhcB8ef.js +0 -12
@@ -0,0 +1,685 @@
1
+ import { defineComponent as K, ref as f, computed as I, watch as re, onMounted as H, resolveComponent as c, openBlock as m, createBlock as F, unref as e, isRef as O, withCtx as x, createElementVNode as d, createVNode as i, createElementBlock as k, Fragment as P, renderList as G, createCommentVNode as w, normalizeClass as de, createSlots as ue, h as T, toDisplayString as L, withModifiers as me } from "vue";
2
+ import { _ as ce } from "./campaign-CpzFl8Vr.js";
3
+ import { h as te } from "./moment-BWErdI6_.js";
4
+ import { useDialog as pe, components as fe } from "@feedmepos/ui-library";
5
+ import { p as ge, u as Q, f as ae } from "./loading-BTEwnG5-.js";
6
+ import { u as be } from "./app-wDQR6dpb.js";
7
+ import { u as X } from "./membership-DkH7qw6W.js";
8
+ import { _ as le } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
9
+ import { m as J } from "./index-BAUe6Mqp.js";
10
+ import { _ as oe } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
11
+ import "./index-CTnZ9dt0.js";
12
+ import "./index-ZXWgygOr.js";
13
+ import { k as ye } from "./index-CsF6BSZU.js";
14
+ import "./index-7QsBQpBM.js";
15
+ import "./index-AcoIUTDS.js";
16
+ import "./index-C20tnKDo.js";
17
+ import "./index-_v_LQTuR.js";
18
+ import { O as ve } from "./objectid-CumRza_j.js";
19
+ import { a as xe } from "./object-qECH92oz.js";
20
+ import { u as he } from "./business-trsrJyHK.js";
21
+ import { w as Ce } from "./xlsx-CsUJ1mq4.js";
22
+ import { e as _e, C as Se } from "./export-BDxbvd3c.js";
23
+ import { u as we, _ as Fe } from "./usePagination-BeF5K3M7.js";
24
+ import { u as ke } from "./vue-i18n-ComnFt3O.js";
25
+ import { o as Ve } from "./objectId-dwaoBfJX.js";
26
+ const $e = { class: "space-y-16" }, De = { class: "gap-16 grid grid-cols-2" }, Me = { class: "space-y-16" }, Ue = {
27
+ key: 0,
28
+ class: "flex flex-col gap-[16px] w-full"
29
+ }, Ae = { class: "flex flex-col gap-[8px]" }, Be = ["src"], Pe = { class: "flex pt-[24px] gap-[24px]" }, Ne = ["src", "onClick", "alt"], Ie = { class: "flex items-center gap-8" }, qe = /* @__PURE__ */ K({
30
+ __name: "CreateCardSheet",
31
+ emits: ["success", "export"],
32
+ setup(W, { expose: j, emit: q }) {
33
+ const { minor: $ } = Q, y = X(), C = f(), g = f(!1), r = q, b = f(!1);
34
+ function R(s) {
35
+ b.value = s, s && (n.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 n = f({
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
+ }), v = [
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
+ ], N = [
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
+ ], D = f(N[0].value), h = f("bulk"), _ = f(0), A = I(
84
+ () => {
85
+ var s;
86
+ return (s = y.membership.design) == null ? void 0 : s[_.value];
87
+ }
88
+ ), u = f(!1), o = I(
89
+ () => y.sortedStoreCategories.flatMap((s) => s.bundles)
90
+ );
91
+ async function a(s) {
92
+ var V, M;
93
+ if (await ((V = C.value) == null ? void 0 : V.validateInputs()), !g.value) return;
94
+ s.design = (M = A.value) == null ? void 0 : M.image;
95
+ const t = await ge.confirm(
96
+ "",
97
+ "Do you want to export generated card(s)?",
98
+ "Export",
99
+ "Generate and without export"
100
+ );
101
+ console.log(t), await $(
102
+ async () => {
103
+ const B = await J.createCards(s);
104
+ console.log(B), await r("success"), t && await r("export", B);
105
+ },
106
+ {
107
+ message: "Creating card(s)",
108
+ successMessage: "Card(s) created"
109
+ }
110
+ );
111
+ }
112
+ return j({
113
+ showSheet: R
114
+ }), re(
115
+ () => n.value.codeConfig.length,
116
+ (s, t) => {
117
+ s != t && (n.value.codeConfig.pattern = "#".repeat(Number(s)));
118
+ }
119
+ ), H(async () => {
120
+ await y.readMemberStore();
121
+ }), (s, t) => {
122
+ const V = c("FmRadio"), M = c("FmRadioGroup"), B = c("FmSwitch"), p = c("FmStepperField"), z = c("FmSelect"), U = c("FmTextField"), ne = c("FmTextarea"), E = c("FmButton"), se = c("FmForm"), ie = c("FmSideSheet");
123
+ return m(), F(ie, {
124
+ "max-width": 560,
125
+ "dismiss-away": !0,
126
+ header: "Create collection",
127
+ modelValue: e(b),
128
+ "onUpdate:modelValue": [
129
+ t[19] || (t[19] = (S) => O(b) ? b.value = S : null),
130
+ t[20] || (t[20] = (S) => b.value = S)
131
+ ]
132
+ }, {
133
+ "side-sheet-footer": x(() => [
134
+ d("div", Ie, [
135
+ i(E, {
136
+ label: "Save",
137
+ onClick: t[17] || (t[17] = (S) => a(e(n))),
138
+ loading: e(be)().isLoading
139
+ }, null, 8, ["loading"]),
140
+ i(E, {
141
+ label: "Cancel",
142
+ type: "button",
143
+ variant: "tertiary",
144
+ onClick: t[18] || (t[18] = (S) => b.value = !1)
145
+ })
146
+ ])
147
+ ]),
148
+ default: x(() => [
149
+ i(se, {
150
+ ref_key: "form",
151
+ ref: C,
152
+ class: "space-y-40",
153
+ onValidationSuccess: t[15] || (t[15] = (S) => g.value = !0),
154
+ onValidationFailed: t[16] || (t[16] = (S) => g.value = !1)
155
+ }, {
156
+ default: x(() => {
157
+ var S, Z, ee;
158
+ return [
159
+ d("div", null, [
160
+ t[21] || (t[21] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number type", -1)),
161
+ i(M, {
162
+ modelValue: e(h),
163
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => O(h) ? h.value = l : null),
164
+ inline: !1
165
+ }, {
166
+ default: x(() => [
167
+ (m(), k(P, null, G(v, (l) => i(V, {
168
+ key: l.value,
169
+ value: l.value,
170
+ label: l.label,
171
+ sublabel: l.sublabel
172
+ }, null, 8, ["value", "label", "sublabel"])), 64))
173
+ ]),
174
+ _: 1
175
+ }, 8, ["modelValue"])
176
+ ]),
177
+ d("div", $e, [
178
+ t[22] || (t[22] = d("div", { class: "fm-typo-en-body-lg-600" }, "Number Settings", -1)),
179
+ e(h) === "bulk" ? (m(), k(P, { key: 0 }, [
180
+ i(B, {
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(), k(P, { key: 0 }, [
189
+ i(p, {
190
+ "model-value": e(n).codeConfig.length || null,
191
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => e(n).codeConfig.length = l),
192
+ label: "Code length",
193
+ rules: [(l) => Number(l) >= 1 || "Code length must at least 1"],
194
+ required: !0
195
+ }, null, 8, ["model-value", "rules"]),
196
+ i(z, {
197
+ label: "Charset",
198
+ "model-value": e(D),
199
+ items: N,
200
+ "helper-text": e(n).codeConfig.charset.length > 62 ? `${e(n).codeConfig.charset.substring(0, 62)}...` : e(n).codeConfig.charset,
201
+ "onUpdate:modelValue": t[3] || (t[3] = (l) => {
202
+ D.value = l, e(n).codeConfig.charset = l;
203
+ })
204
+ }, null, 8, ["model-value", "helper-text"]),
205
+ e(D) === "" ? (m(), F(U, {
206
+ key: 0,
207
+ modelValue: e(n).codeConfig.charset,
208
+ "onUpdate:modelValue": t[4] || (t[4] = (l) => e(n).codeConfig.charset = l),
209
+ label: "Custom Charset",
210
+ required: ""
211
+ }, null, 8, ["modelValue"])) : w("", !0),
212
+ d("div", De, [
213
+ i(U, {
214
+ modelValue: e(n).codeConfig.prefix,
215
+ "onUpdate:modelValue": t[5] || (t[5] = (l) => e(n).codeConfig.prefix = l),
216
+ label: "Prefix (Optional)"
217
+ }, null, 8, ["modelValue"]),
218
+ i(U, {
219
+ modelValue: e(n).codeConfig.suffix,
220
+ "onUpdate:modelValue": t[6] || (t[6] = (l) => e(n).codeConfig.suffix = l),
221
+ label: "Suffix (Optional)"
222
+ }, null, 8, ["modelValue"])
223
+ ]),
224
+ i(U, {
225
+ modelValue: e(n).codeConfig.pattern,
226
+ "onUpdate:modelValue": t[7] || (t[7] = (l) => e(n).codeConfig.pattern = l),
227
+ label: "Pattern",
228
+ required: !0
229
+ }, null, 8, ["modelValue"])
230
+ ], 64)) : w("", !0),
231
+ i(U, {
232
+ modelValue: e(n).quantity,
233
+ "onUpdate:modelValue": t[8] || (t[8] = (l) => e(n).quantity = l),
234
+ label: "Number of code",
235
+ rules: [
236
+ (l) => l >= 1 || "Quantity cannot be less than 1",
237
+ (l) => l <= 1e4 || "Quantity cannot more than 10,000"
238
+ ],
239
+ required: !0,
240
+ "helper-text": `${e(n).quantity} card will be created`
241
+ }, null, 8, ["modelValue", "rules", "helper-text"])
242
+ ], 64)) : w("", !0),
243
+ e(h) !== "bulk" ? (m(), F(ne, {
244
+ key: 1,
245
+ modelValue: e(n).code,
246
+ "onUpdate:modelValue": t[9] || (t[9] = (l) => e(n).code = l),
247
+ label: "Custom Card Number",
248
+ rules: [(l) => e(h) != "single" || !!l || "Custom code is required"],
249
+ placeholder: "(For multiple numbers, please enter in the new row.)"
250
+ }, null, 8, ["modelValue", "rules"])) : w("", !0)
251
+ ]),
252
+ d("div", Me, [
253
+ t[23] || (t[23] = d("div", { class: "fm-typo-en-body-lg-600" }, "Card Settings", -1)),
254
+ i(B, {
255
+ "label-placement": "right",
256
+ label: "Set card number on bind",
257
+ "model-value": e(n).setCardOnBind || !1,
258
+ "onUpdate:modelValue": t[10] || (t[10] = (l) => e(n).setCardOnBind = l)
259
+ }, null, 8, ["model-value"]),
260
+ i(le, {
261
+ label: "Activate bundle on bind",
262
+ placeholder: "Select bundle",
263
+ items: e(o).filter((l) => !l.stripePriceId).map((l) => ({ label: l.name, value: l._id })),
264
+ modelValue: e(n).bundle,
265
+ "onUpdate:modelValue": t[12] || (t[12] = (l) => e(n).bundle = l)
266
+ }, {
267
+ append: x(() => [
268
+ e(n).bundle ? (m(), F(E, {
269
+ key: 0,
270
+ icon: "link_off",
271
+ variant: "plain",
272
+ onClick: t[11] || (t[11] = (l) => e(n).bundle = void 0)
273
+ })) : w("", !0)
274
+ ]),
275
+ _: 1
276
+ }, 8, ["items", "modelValue"]),
277
+ (Z = (S = e(y).store) == null ? void 0 : S.stripe) != null && Z.apiKey ? (m(), F(le, {
278
+ key: 0,
279
+ label: "Linked subscription bundle",
280
+ placeholder: "Select bundle",
281
+ items: e(o).filter((l) => l.stripePriceId).map((l) => ({ label: l.name, value: l._id })),
282
+ modelValue: e(n).subscriptionBundle,
283
+ "onUpdate:modelValue": t[14] || (t[14] = (l) => e(n).subscriptionBundle = l)
284
+ }, {
285
+ append: x(() => [
286
+ e(n).subscriptionBundle ? (m(), F(E, {
287
+ key: 0,
288
+ icon: "link_off",
289
+ variant: "plain",
290
+ onClick: t[13] || (t[13] = (l) => e(n).subscriptionBundle = void 0)
291
+ })) : w("", !0)
292
+ ]),
293
+ _: 1
294
+ }, 8, ["items", "modelValue"])) : w("", !0)
295
+ ]),
296
+ e(y).membership.design ? (m(), k("div", Ue, [
297
+ d("div", Ae, [
298
+ t[24] || (t[24] = d("p", { class: "fm-typo-en-title-sm-800" }, "Design preview", -1)),
299
+ d("img", {
300
+ src: (ee = e(A)) == null ? void 0 : ee.image,
301
+ class: "aspect-[16/9]"
302
+ }, null, 8, Be),
303
+ d("div", Pe, [
304
+ (m(!0), k(P, null, G(e(y).membership.design, (l, Y) => (m(), k("img", {
305
+ src: l.image,
306
+ key: `image_${Y}`,
307
+ class: de(["w-[112px] h-[63px] cursor-pointer", `${e(_) === Y ? "border-[2px] border-fm-color-primary" : ""}`]),
308
+ onClick: (Je) => _.value = Y,
309
+ alt: `ai_image_predict_${Y}`,
310
+ style: { objectFit: "cover" }
311
+ }, null, 10, Ne))), 128))
312
+ ])
313
+ ])
314
+ ])) : w("", !0)
315
+ ];
316
+ }),
317
+ _: 1
318
+ }, 512)
319
+ ]),
320
+ _: 1
321
+ }, 8, ["modelValue"]);
322
+ };
323
+ }
324
+ }), Re = {
325
+ key: 0,
326
+ class: "grid grid-cols-1 gap-8"
327
+ }, je = { class: "flex items-center gap-8" }, ze = { class: "flex items-center gap-8" }, Ee = 5, Ye = /* @__PURE__ */ K({
328
+ __name: "CardDesignSheet",
329
+ emits: ["success"],
330
+ setup(W, { expose: j, emit: q }) {
331
+ const { minor: $ } = Q, y = X(), C = pe(), g = f(!1);
332
+ f(), f(!1);
333
+ const r = f(), b = f(null);
334
+ I(() => {
335
+ var u, o;
336
+ return Math.min((((o = (u = r.value) == null ? void 0 : u.design) == null ? void 0 : o.length) ?? 0) + 1, Ee);
337
+ });
338
+ const R = q, n = I(() => {
339
+ var u, o;
340
+ return ((o = (u = y.membership) == null ? void 0 : u.design) == null ? void 0 : o.filter((a) => a.image)) || [];
341
+ }), v = f(!1);
342
+ function N(u) {
343
+ v.value = u;
344
+ }
345
+ function D() {
346
+ g.value = !0;
347
+ }
348
+ async function h() {
349
+ await $(
350
+ async () => {
351
+ var a;
352
+ const u = xe(r.value), o = ye.parse(u);
353
+ if (o.design = (o == null ? void 0 : o.design) || [], b.value) {
354
+ const s = ve().toHexString(), t = await ae.update(
355
+ ae.designPath(s, b.value),
356
+ b.value
357
+ );
358
+ (a = o.design) == null || a.push({
359
+ _id: s,
360
+ image: t
361
+ });
362
+ }
363
+ await J.update(o), await A(), await R("success"), b.value = null, g.value = !1;
364
+ },
365
+ {
366
+ message: "Saving card design",
367
+ successMessage: "Card design saved"
368
+ }
369
+ );
370
+ }
371
+ async function _(u, o) {
372
+ u ? b.value = u : o && C.open({
373
+ title: "Delete Design",
374
+ message: "Are you sure you want to delete this design?",
375
+ primaryActions: { text: "Delete", close: !0 },
376
+ secondaryActions: { text: "Cancel", close: !1 }
377
+ }).onPrimary(async () => {
378
+ var s, t;
379
+ const a = (s = r.value.design) == null ? void 0 : s.findIndex((V) => V._id == o);
380
+ console.log(a), a !== -1 && ((t = r.value.design) == null || t.splice(a, 1)), await h();
381
+ }).onSecondary(() => {
382
+ C.close();
383
+ });
384
+ }
385
+ async function A() {
386
+ await y.readMembership(), r.value = y.membership;
387
+ }
388
+ return j({
389
+ showSheet: N
390
+ }), H(async () => {
391
+ await A(), n.value.length || (g.value = !0);
392
+ }), (u, o) => {
393
+ const a = c("FmButton"), s = c("FmSideSheet");
394
+ return m(), F(s, {
395
+ "max-width": 560,
396
+ "dismiss-away": !0,
397
+ header: "Manage Design",
398
+ modelValue: e(v),
399
+ "onUpdate:modelValue": [
400
+ o[2] || (o[2] = (t) => O(v) ? v.value = t : null),
401
+ o[3] || (o[3] = (t) => v.value = t)
402
+ ]
403
+ }, ue({
404
+ default: x(() => [
405
+ e(g) ? w("", !0) : (m(), k("div", Re, [
406
+ (m(!0), k(P, null, G(e(n), (t) => (m(), F(oe, {
407
+ key: String(t._id),
408
+ "image-fit": "cover",
409
+ label: "",
410
+ "aspect-ratio": "16/9",
411
+ thumbnail: t.image,
412
+ accept: ".png, .jpg, .jpeg, .gif",
413
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
414
+ file: void 0,
415
+ "delete-button": !1
416
+ }, {
417
+ "delete-button": x(() => [
418
+ i(a, {
419
+ class: "!text-neutral-50 !bg-neutral-700",
420
+ icon: "delete",
421
+ variant: "tertiary",
422
+ onClick: (V) => _(null, t._id)
423
+ }, null, 8, ["onClick"])
424
+ ]),
425
+ _: 2
426
+ }, 1032, ["thumbnail"]))), 128))
427
+ ])),
428
+ e(g) ? (m(), F(oe, {
429
+ key: 1,
430
+ "image-fit": "cover",
431
+ label: "",
432
+ "aspect-ratio": "16/9",
433
+ accept: ".png, .jpg, .jpeg, .gif",
434
+ "recommended-size": "Recommended 16:9 ratio / 1280px x 720px",
435
+ "onUpdate:file": _
436
+ })) : w("", !0)
437
+ ]),
438
+ _: 2
439
+ }, [
440
+ e(g) ? {
441
+ name: "side-sheet-footer",
442
+ fn: x(() => [
443
+ d("div", ze, [
444
+ i(a, {
445
+ label: "Save",
446
+ onClick: h,
447
+ disabled: !e(b)
448
+ }, null, 8, ["disabled"]),
449
+ i(a, {
450
+ label: "Cancel",
451
+ type: "button",
452
+ variant: "tertiary",
453
+ onClick: o[1] || (o[1] = (t) => g.value = !1)
454
+ })
455
+ ])
456
+ ]),
457
+ key: "1"
458
+ } : {
459
+ name: "side-sheet-footer",
460
+ fn: x(() => [
461
+ d("div", je, [
462
+ i(a, {
463
+ label: "Add Design",
464
+ onClick: D
465
+ }),
466
+ i(a, {
467
+ label: "Cancel",
468
+ type: "button",
469
+ variant: "tertiary",
470
+ onClick: o[0] || (o[0] = (t) => v.value = !1)
471
+ })
472
+ ])
473
+ ]),
474
+ key: "0"
475
+ }
476
+ ]), 1032, ["modelValue"]);
477
+ };
478
+ }
479
+ }), Te = { class: "flex items-center" }, Le = { class: "fm-typo-en-title-md-600 fm-step-title line-clamp-2 mr-8" }, Oe = { class: "px-24 flex flex-col pb-24 gap-y-16" }, Ge = { class: "flex items-center justify-end" }, Ke = { class: "flex flex-col gap-16 text-center" }, He = { class: "fm-typo-en-title-sm-800" }, Qe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Xe = { class: "flex gap-x-8" }, St = /* @__PURE__ */ K({
480
+ __name: "Card",
481
+ setup(W) {
482
+ const { minor: j, global: q } = Q, $ = f(), y = f(), C = he(), g = X(), { t: r } = ke(), b = I(
483
+ () => g.sortedStoreCategories.flatMap((o) => o.bundles)
484
+ ), R = [
485
+ {
486
+ header: r("connect.loyalty.card.table.card_number"),
487
+ accessorFn: (o) => o.serialNumber
488
+ },
489
+ {
490
+ header: r("connect.loyalty.card.table.redeemed_by"),
491
+ accessorKey: "user",
492
+ enableSorting: !1,
493
+ cell(o) {
494
+ const a = o.row.original.pf_member;
495
+ return T(
496
+ "div",
497
+ {
498
+ class: "flex items-center gap-x-8"
499
+ },
500
+ [
501
+ T(fe.FmAvatar, {
502
+ name: a != null && a.photoUrl || a == null ? void 0 : a.name,
503
+ src: (a == null ? void 0 : a.photoUrl) ?? void 0,
504
+ size: "sm"
505
+ }),
506
+ T("span", { class: "fm-typo-en-body-sm-400" }, a == null ? void 0 : a.name)
507
+ ]
508
+ );
509
+ }
510
+ },
511
+ {
512
+ header: r("connect.loyalty.card.table.phone"),
513
+ accessorFn: (o) => {
514
+ var a;
515
+ return ((a = o.pf_member) == null ? void 0 : a.phoneNumber) || "-";
516
+ },
517
+ accessorKey: "pf_member.phoneNumber"
518
+ },
519
+ {
520
+ header: r("connect.loyalty.card.table.created_at"),
521
+ accessorKey: "_id",
522
+ accessorFn: (o) => te(Ve(o._id.toString())).format("DD MMM YYYY hh:mmA")
523
+ },
524
+ {
525
+ header: r("connect.loyalty.card.table.bundle"),
526
+ accessorFn: (o) => {
527
+ var a;
528
+ return ((a = b.value.find((s) => s._id === o.bundle)) == null ? void 0 : a.name) || "-";
529
+ }
530
+ },
531
+ {
532
+ header: r("connect.loyalty.card.table.redeemed_at"),
533
+ accessorKey: "redeemedAt",
534
+ accessorFn: (o) => o.redeemedAt ? te(o.redeemedAt).format("DD MMM YYYY hh:mmA") : "-"
535
+ }
536
+ ], { tableMeta: n, rowData: v, onSort: N, debouncedFetchData: D, onSearch: h } = we(J.readCards);
537
+ async function _() {
538
+ var o;
539
+ await D(), (o = $.value) == null || o.showSheet(!1);
540
+ }
541
+ const A = I(() => C.isPremium ? [
542
+ {
543
+ label: r("connect.loyalty.card.actions.create"),
544
+ value: "create",
545
+ isPrimary: !0
546
+ },
547
+ {
548
+ label: r("connect.loyalty.card.actions.manage_design"),
549
+ value: "design",
550
+ isPrimary: !0
551
+ }
552
+ ] : []);
553
+ async function u(o) {
554
+ const a = new Se(), s = o.map((t) => ({
555
+ CardNumber: t
556
+ }));
557
+ a.addRecords(s), await Ce(
558
+ a.buildExcel(),
559
+ `cards-${(/* @__PURE__ */ new Date()).toISOString()}.xlsx`,
560
+ {
561
+ bookType: "xlsx",
562
+ bookSST: !1,
563
+ type: "array"
564
+ }
565
+ );
566
+ }
567
+ return H(async () => {
568
+ await q(async () => {
569
+ await C.readPremium(), await g.readMemberStore(), await g.readMembership(), await _();
570
+ });
571
+ }), (o, a) => {
572
+ const s = c("FmPill"), t = c("FmPageHead"), V = c("FmSearch"), M = c("FmButton"), B = c("FmCard");
573
+ return m(), k(P, null, [
574
+ i(t, {
575
+ title: e(r)("connect.loyalty.card.title"),
576
+ actions: e(A),
577
+ "onClick:action": a[0] || (a[0] = (p) => {
578
+ var z, U;
579
+ console.log(p), p === "design" && ((z = e(y)) == null || z.showSheet(!0)), p === "create" && ((U = e($)) == null || U.showSheet(!0));
580
+ })
581
+ }, {
582
+ title: x(() => [
583
+ d("div", Te, [
584
+ d("span", Le, L(e(r)("connect.loyalty.card.title")), 1),
585
+ i(s, {
586
+ class: "ml-8",
587
+ variant: "premium"
588
+ })
589
+ ])
590
+ ]),
591
+ _: 1
592
+ }, 8, ["title", "actions"]),
593
+ d("div", Oe, [
594
+ e(v).length > 0 || e(v).length <= 0 && e(n).searchValue || e(n).pageCount > 0 ? (m(), k(P, { key: 0 }, [
595
+ d("div", Ge, [
596
+ i(V, {
597
+ class: "mt-4",
598
+ modelValue: e(n).searchValue,
599
+ "onUpdate:modelValue": [
600
+ a[1] || (a[1] = (p) => e(n).searchValue = p),
601
+ e(h)
602
+ ],
603
+ placeholder: "Search",
604
+ collapsible: ""
605
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
606
+ i(M, {
607
+ icon: "ios_share",
608
+ variant: "tertiary",
609
+ onClick: me(e(_e), ["prevent"])
610
+ }, null, 8, ["onClick"])
611
+ ]),
612
+ i(Fe, {
613
+ loading: e(n).isLoading,
614
+ "row-data": e(v),
615
+ "row-count": e(n).totalRows,
616
+ "column-defs": R,
617
+ "shrink-at": !1,
618
+ "page-count": e(n).pageCount,
619
+ "page-index": e(n).pageIndex,
620
+ "page-size": e(n).pageSize,
621
+ onSortChange: e(N),
622
+ onPageChange: a[2] || (a[2] = (p) => {
623
+ e(D)({
624
+ pageSize: p.pageSize,
625
+ pageIndex: p.pageIndex
626
+ });
627
+ })
628
+ }, null, 8, ["loading", "row-data", "row-count", "page-count", "page-index", "page-size", "onSortChange"])
629
+ ], 64)) : (m(), F(B, {
630
+ key: 1,
631
+ variant: "outlined",
632
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
633
+ }, {
634
+ default: x(() => [
635
+ a[5] || (a[5] = d("img", {
636
+ src: ce,
637
+ class: "aspect-square w-[150px]"
638
+ }, null, -1)),
639
+ d("div", Ke, [
640
+ d("div", He, L(e(r)("connect.loyalty.card.empty_state.title")), 1),
641
+ d("div", Qe, L(e(r)("connect.loyalty.card.empty_state.description")), 1)
642
+ ]),
643
+ d("div", Xe, [
644
+ i(M, {
645
+ variant: "primary",
646
+ label: e(r)("connect.loyalty.card.actions.add"),
647
+ icon: "add",
648
+ disabled: !e(C).isPremium,
649
+ onClick: a[3] || (a[3] = () => {
650
+ var p;
651
+ return (p = e($)) == null ? void 0 : p.showSheet(!0);
652
+ })
653
+ }, null, 8, ["label", "disabled"]),
654
+ i(M, {
655
+ variant: "secondary",
656
+ label: e(r)("connect.loyalty.card.actions.manage_design"),
657
+ disabled: !e(C).isPremium,
658
+ onClick: a[4] || (a[4] = () => {
659
+ var p;
660
+ return (p = e(y)) == null ? void 0 : p.showSheet(!0);
661
+ })
662
+ }, null, 8, ["label", "disabled"])
663
+ ])
664
+ ]),
665
+ _: 1
666
+ })),
667
+ i(qe, {
668
+ ref_key: "sheetRef",
669
+ ref: $,
670
+ onSuccess: _,
671
+ onExport: u
672
+ }, null, 512),
673
+ i(Ye, {
674
+ ref_key: "designSheetRef",
675
+ ref: y,
676
+ onSuccess: _
677
+ }, null, 512)
678
+ ])
679
+ ], 64);
680
+ };
681
+ }
682
+ });
683
+ export {
684
+ St as default
685
+ };