@feedmepos/mf-connect 0.1.0-beta.29 → 0.1.0-beta.30

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 (80) hide show
  1. package/dist/{Analytic-B7H12ZTY.js → Analytic-DLez3H4H.js} +8 -8
  2. package/dist/{App-BJBZpXsi.js → App-dkNRyYLR.js} +6 -6
  3. package/dist/{Broadcast-D0svFToh.js → Broadcast-DlAaBitD.js} +8 -8
  4. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-V6dyJp-S.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BtpiGQEs.js} +8 -8
  5. package/dist/Card-JpWEjzjP.js +897 -0
  6. package/dist/{Collections-DpVQPZSJ.js → Collections-D5hUfDJo.js} +4 -4
  7. package/dist/{Credit-BhIu4jF4.js → Credit-v3KdCFwT.js} +8 -8
  8. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-pzOdN_tj.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CE2Ar-Ll.js} +27 -27
  9. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-P1FmEqVw.js → EffectSheet.vue_vue_type_style_index_0_lang-C12m8EXP.js} +6 -6
  10. package/dist/{Experience-B0UJSnfv.js → Experience-9A41fyZO.js} +8 -8
  11. package/dist/{Game-CjTZrcic.js → Game-l1tUsePJ.js} +8 -8
  12. package/dist/{Index-D3bjiL6r.js → Index-rF6OzGw_.js} +9 -9
  13. package/dist/{Marketing-BiydZ2KN.js → Marketing-6zS-6CS3.js} +5 -5
  14. package/dist/{Member-C_SndZD8.js → Member-B5jPh0DM.js} +4 -4
  15. package/dist/{MemberList-qWoogtFZ.js → MemberList-c2P1lToO.js} +15 -15
  16. package/dist/{MemberTransactions-DacRov_h.js → MemberTransactions-BiwAZyCP.js} +1 -1
  17. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-siVkENbo.js → MessageInput.vue_vue_type_script_setup_true_lang-CYVOCazs.js} +2 -2
  18. package/dist/{Mission-DgQD1GQh.js → Mission-BM7abR6J.js} +8 -8
  19. package/dist/{Overview-BivEfeMs.js → Overview-Drjb4oAW.js} +18 -18
  20. package/dist/{Point-CMBDCgG1.js → Point-BP9YezdW.js} +8 -8
  21. package/dist/{Promotion-Dlvz9906.js → Promotion-DiqlNOWk.js} +9 -9
  22. package/dist/{Record-B1eXPmYG.js → Record-DJ2A1L-C.js} +5 -5
  23. package/dist/{Reward-D_LnUiNr.js → Reward-DN6z6LXf.js} +12 -12
  24. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-906OJcQU.js → RewardGroup.vue_vue_type_script_setup_true_lang-CcbzCFUg.js} +12 -12
  25. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-3BpQJMYN.js → RuleGroup.vue_vue_type_script_setup_true_lang-CFD10xnG.js} +14 -14
  26. package/dist/{Segment-CZ1kkGzP.js → Segment-Cm48eZrS.js} +13 -13
  27. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-Dy6r1Z5L.js → SelectItems.vue_vue_type_script_setup_true_lang-6XokSm7W.js} +2 -2
  28. package/dist/{Setting-Cg_XklQe.js → Setting-3jXUi2cS.js} +8 -8
  29. package/dist/{Store-CvHwri9D.js → Store-Csditfe8.js} +19 -19
  30. package/dist/{StoreRewards-CWVlZBSc.js → StoreRewards-DOMxpeaj.js} +12 -12
  31. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CqWmuEwq.js → StoreTransactions.vue_vue_type_script_setup_true_lang-Csoobxol.js} +11 -11
  32. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-D3ZO5mV4.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-C8UhKTgD.js} +1 -1
  33. package/dist/{Tier-Qim06_JX.js → Tier-BmhQYaPz.js} +20 -20
  34. package/dist/{Title-DSoxdfi4.js → Title-BJV4yLCu.js} +20 -20
  35. package/dist/{Transaction-C39eH7OQ.js → Transaction-DB81PNYL.js} +2 -2
  36. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Lg4RcvDz.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-wyCBPQRj.js} +6 -6
  37. package/dist/{Voucher-4VuH_U33.js → Voucher-B8nnAIUZ.js} +11 -11
  38. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BFzAkZT7.js → VoucherEditor.vue_vue_type_script_setup_true_lang-B4zIOBh0.js} +10 -10
  39. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-Be7O95mu.js → ZodTextField.vue_vue_type_script_setup_true_lang-DvfcNsj9.js} +1 -1
  40. package/dist/{app-oaja6GAw.js → app-BYTkNtdY.js} +1 -1
  41. package/dist/{app-BU1nEmX2.js → app-sD3N1iqR.js} +34 -31
  42. package/dist/app.js +1 -1
  43. package/dist/{business-DRfPUryQ.js → business-B6OFKNz4.js} +1 -1
  44. package/dist/{campaign-EUg81J3m.js → campaign-DhumfBC6.js} +2 -2
  45. package/dist/{collectible.enum-DiyCwu7G.js → collectible.enum-4Gywgj__.js} +1 -1
  46. package/dist/{collection.fn-DkUNMAwp.js → collection.fn-D-uexOQL.js} +2 -2
  47. package/dist/{dto-DOU8rlC4.js → dto-b9jcbMWA.js} +75 -75
  48. package/dist/{effect-Btnss9MT.js → effect-CBN4vtSi.js} +1 -1
  49. package/dist/{email-addresses-3JHKorik.js → email-addresses-BqgJVUoG.js} +1 -1
  50. package/dist/{export-BxPBiupf.js → export-D1kS_vMc.js} +3 -3
  51. package/dist/{helper-DlbWOkH4.js → helper-SbkTJZDm.js} +1 -1
  52. package/dist/{index-CSWUy0du.js → index-BBBSm4kr.js} +3 -3
  53. package/dist/{index-CAthbo3G.js → index-BIs-Ed1-.js} +3 -3
  54. package/dist/{index-CL7xcNdG.js → index-CBwwTcb5.js} +1 -1
  55. package/dist/{index-C2BR29Vi.js → index-CHg2swyg.js} +3 -3
  56. package/dist/{index-Gukxl3XS.js → index-Cd94xjeo.js} +1 -1
  57. package/dist/{index-B47o3NfN.js → index-Cehc8dyz.js} +4 -4
  58. package/dist/{index-DhJ-NmuV.js → index-CxBG7i3n.js} +8 -8
  59. package/dist/{index-D14jHheQ.js → index-DgJVPeks.js} +7 -1
  60. package/dist/{index-D1U64Rfz.js → index-Dp-5hs3q.js} +1 -1
  61. package/dist/{index-CwTjIu6w.js → index-DtX7V_mF.js} +2 -2
  62. package/dist/{index-BRJIZklM.js → index-Hhxoo_Eg.js} +4 -4
  63. package/dist/{index-BhVNGG1a.js → index-OCIxZJKd.js} +1 -1
  64. package/dist/{index-C-x169Z5.js → index-wJ5e3mQa.js} +1 -1
  65. package/dist/{index.esm2017-BWiGGYVx.js → index.esm2017-Bl1OPd9N.js} +1 -1
  66. package/dist/{loading-DbE0TtP2.js → loading-BghJIv3w.js} +4 -4
  67. package/dist/{membership-uyBactAw.js → membership-D532uzUJ.js} +3 -3
  68. package/dist/{money-BsUvoufR.js → money-BJmDeENN.js} +1 -1
  69. package/dist/{number-DiPlxGL4.js → number-E_LdkU9a.js} +1 -1
  70. package/dist/{objectid-VjhETDeC.js → objectid-DSB8jlsT.js} +6 -6
  71. package/dist/{reward-D4YqBsKN.js → reward-CiTzAsCd.js} +1 -1
  72. package/dist/{rule-D2_VoqyD.js → rule-0MEHUef9.js} +3 -3
  73. package/dist/{rule-builder-TGGNw2iM.js → rule-builder-BQZN0Bi4.js} +1 -1
  74. package/dist/{template-Dovds0qm.js → template-2xDKWfij.js} +4 -4
  75. package/dist/{trigger-D5wtvsvc.js → trigger-BFmJQkCL.js} +4 -4
  76. package/dist/{user-PC0zQDCH.js → user-B_diJ-ER.js} +1 -1
  77. package/dist/{vue-i18n-CqmzEsDq.js → vue-i18n-D0S05G9j.js} +473 -473
  78. package/dist/{xlsx-9iUmZwLG.js → xlsx-9pjTnN_k.js} +1 -1
  79. package/package.json +1 -1
  80. package/dist/Card-Fc097UAX.js +0 -685
@@ -1,685 +0,0 @@
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-DbE0TtP2.js";
6
- import { u as be } from "./app-wDQR6dpb.js";
7
- import { u as X } from "./membership-uyBactAw.js";
8
- import { _ as le } from "./CustomSelect.vue_vue_type_script_setup_true_lang-DLnvDVgf.js";
9
- import { m as J } from "./index-D14jHheQ.js";
10
- import { _ as oe } from "./ImageInput.vue_vue_type_script_setup_true_lang-rWUkV9gn.js";
11
- import "./index-C2BR29Vi.js";
12
- import "./index-CwTjIu6w.js";
13
- import { k as ye } from "./index-BRJIZklM.js";
14
- import "./index-B47o3NfN.js";
15
- import "./index-DhJ-NmuV.js";
16
- import "./index-CL7xcNdG.js";
17
- import "./index-CSWUy0du.js";
18
- import { O as ve } from "./objectid-VjhETDeC.js";
19
- import { a as xe } from "./object-qECH92oz.js";
20
- import { u as he } from "./business-DRfPUryQ.js";
21
- import { w as Ce } from "./xlsx-9iUmZwLG.js";
22
- import { e as _e, C as Se } from "./export-BxPBiupf.js";
23
- import { u as we, _ as Fe } from "./usePagination-BeF5K3M7.js";
24
- import { u as ke } from "./vue-i18n-CqmzEsDq.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
- };