@feedmepos/mf-connect 0.1.21-prod → 0.1.23-prod

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/{Analytic-BQiGib08.js → Analytic-DfTQmuSa.js} +10 -10
  2. package/dist/{App-B8e7d2pF.js → App-C5AMrBM2.js} +7 -7
  3. package/dist/{Bin-BLlnEux-.js → Bin-nZv2ZrAD.js} +7 -7
  4. package/dist/{Broadcast-BGw646-m.js → Broadcast-1ViZILw6.js} +8 -8
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BT5rtjPA.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Nuj7G5E1.js} +6 -6
  6. package/dist/{Card-I9YI4BlJ.js → Card-CUAfRl0P.js} +14 -14
  7. package/dist/{Collections-BV8_G7vd.js → Collections-DNlV8CiV.js} +5 -5
  8. package/dist/{Credit-nrEbKUWc.js → Credit-C8WVgeKO.js} +8 -8
  9. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-BTkAiIvO.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CZmd7K3H.js} +28 -27
  10. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-C-dcVww-.js → EffectSheet.vue_vue_type_style_index_0_lang-Crakwwgo.js} +6 -6
  11. package/dist/{Experience-Cj6yrQ-5.js → Experience-C0ZrJ-rU.js} +8 -8
  12. package/dist/{Game-C57UeXHH.js → Game-KiwAxjQX.js} +8 -8
  13. package/dist/{Index-C_m0ldjU.js → Index-C_mvHa_E.js} +9 -9
  14. package/dist/{MainLayout-DpZC6o3R.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CyGJxUol.js} +19 -53
  15. package/dist/MainLayout-B1aJoR95.js +41 -0
  16. package/dist/{Marketing-CH1DN3VY.js → Marketing-7lvR6gR_.js} +12 -12
  17. package/dist/{Member-BcORjsqn.js → Member-DR406GTr.js} +4 -4
  18. package/dist/{MemberList-Ca75OWm_.js → MemberList-BDsVY1bB.js} +23 -23
  19. package/dist/{MemberTransactions-B0Oa15-s.js → MemberTransactions-DXgJ8Tua.js} +1 -1
  20. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BbiWEoQQ.js +447 -0
  21. package/dist/{Mission-o0TjmbH_.js → Mission-CJnySjh4.js} +8 -8
  22. package/dist/{Overview-EiAhGzV6.js → Overview-ZENHKQhC.js} +16 -16
  23. package/dist/{Point-qan2Ihfu.js → Point-DvYLQNmg.js} +8 -8
  24. package/dist/{Promotion-COVNuE2t.js → Promotion-CE6Mqev4.js} +9 -9
  25. package/dist/{Record-Cyd2x4RU.js → Record-Cl4o08E4.js} +6 -6
  26. package/dist/{Reward-k-AweK42.js → Reward-C1hZ9c6y.js} +14 -14
  27. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CFhyLvSA.js → RewardGroup.vue_vue_type_script_setup_true_lang-Co1mzeQA.js} +10 -10
  28. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-tcfaWFK4.js → RuleGroup.vue_vue_type_script_setup_true_lang-CDEiSeqW.js} +181 -178
  29. package/dist/{Segment-DIb21-Ns.js → Segment-1RH6jUyt.js} +13 -13
  30. package/dist/{SelectItems.vue_vue_type_script_setup_true_lang-D7r3NMJu.js → SelectItems.vue_vue_type_script_setup_true_lang-CJTZZ4EH.js} +2 -2
  31. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-B5IaCgiU.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-DL2A84oN.js} +3 -3
  32. package/dist/Setting-DK9lsogh.js +1930 -0
  33. package/dist/{Store-DLEcQWU_.js → Store-DSeXriUy.js} +145 -143
  34. package/dist/StoreRewards-DFUg0n5g.js +422 -0
  35. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BpNYA-xj.js → StoreTransactions.vue_vue_type_script_setup_true_lang-D_F7zaEl.js} +82 -82
  36. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BlEfnhii.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-hR4OBTrC.js} +1 -1
  37. package/dist/{Tier-jmOeJ9BB.js → Tier-Yq3BNKGq.js} +19 -19
  38. package/dist/{Title-CsV4jem5.js → Title-CwWan9gL.js} +100 -100
  39. package/dist/{Transaction-Bf8PWUc6.js → Transaction-BgO5EYZB.js} +2 -2
  40. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-bFnBW5gb.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-CyUXbl30.js} +6 -6
  41. package/dist/{Voucher-eayylhcc.js → Voucher-C2w8z86e.js} +34 -34
  42. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DjlgbRZ4.js → VoucherEditor.vue_vue_type_script_setup_true_lang-dEgiWiLL.js} +10 -10
  43. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DMh6Q2iI.js → ZodTextField.vue_vue_type_script_setup_true_lang-BME260O1.js} +1 -1
  44. package/dist/{app-NqEzL0OT.js → app-BVIgk6aa.js} +1 -1
  45. package/dist/{app-bxGFzJpn.js → app-BVsQcG_m.js} +40 -40
  46. package/dist/app.js +1 -1
  47. package/dist/{business-D6C_7bDy.js → business-CdvE-WIp.js} +1 -1
  48. package/dist/{campaign-BGzVYFng.js → campaign-WGLWFuCK.js} +9 -9
  49. package/dist/{campaign-yLK6vWS8.js → campaign-gunNEZhU.js} +2 -2
  50. package/dist/{campaign.enum-Dbmht5_i.js → campaign.enum-O82qvpU2.js} +1 -1
  51. package/dist/{campaign.fn-Dj2_FuER.js → campaign.fn-Bzr9Jc5X.js} +22 -22
  52. package/dist/{collectible.enum-Dnn_Aj65.js → collectible.enum-CzUCHExj.js} +1 -1
  53. package/dist/{collection.fn-CoMxWCc1.js → collection.fn-Czs8Mpdz.js} +2 -2
  54. package/dist/{dto-ClZmLiV_.js → dto-Czd638gm.js} +7 -7
  55. package/dist/{effect-BDMkCpDf.js → effect-D8Km5OHX.js} +1 -1
  56. package/dist/{email-addresses-B3uFvya7.js → email-addresses-2-RgQal8.js} +1 -1
  57. package/dist/{export-v3KwUDUd.js → export--jJWZuJy.js} +3 -3
  58. package/dist/{helper-CBL7LpuD.js → helper-BOwvTpT_.js} +1 -1
  59. package/dist/{index-DP6beo56.js → index-7SYnV8B2.js} +4 -4
  60. package/dist/{index-Cqzz3NCP.js → index-BMPlc7it.js} +225 -218
  61. package/dist/{index-DUJOEcLO.js → index-Bg8Lqk3s.js} +1 -1
  62. package/dist/{index-CQAOZuRz.js → index-C6j2uVRJ.js} +1 -1
  63. package/dist/{index-CyJqTXt8.js → index-CFxA9VYh.js} +91 -73
  64. package/dist/{index-TyHupXxP.js → index-CKSGfZ62.js} +21 -16
  65. package/dist/{index-MMYQth2d.js → index-CpsX7fKq.js} +1 -1
  66. package/dist/{index-DHbi29uw.js → index-DExfBo0i.js} +3 -3
  67. package/dist/{index-DAk26zCe.js → index-DGi6aLjD.js} +1 -1
  68. package/dist/{index-g-PCtD2d.js → index-DRVIuG-G.js} +1 -1
  69. package/dist/{index-C3-pSb8M.js → index-DllRE4Xv.js} +1 -1
  70. package/dist/{index-RwV8duB6.js → index-FBWWEOV0.js} +12 -5
  71. package/dist/{index.esm2017-B9fqtwTI.js → index.esm2017-CkIJgInI.js} +38 -38
  72. package/dist/{loading-DasBRvHo.js → loading-C-HOw2p9.js} +4 -4
  73. package/dist/{membership-CxFyoQ-0.js → membership-ByveC1Cs.js} +3 -3
  74. package/dist/{money-CVZMau41.js → money-C_wAhRJ4.js} +1 -1
  75. package/dist/{number-q8W5mWjg.js → number-B1OxEx_j.js} +1 -1
  76. package/dist/{objectid-wDM4YS-R.js → objectid-CtnWn6lG.js} +6 -6
  77. package/dist/{reward-DvTNcjsB.js → reward-BOA1fyrM.js} +1 -1
  78. package/dist/{rule-Cy2u2C6N.js → rule-CfePtJap.js} +8 -4
  79. package/dist/{rule-builder-DQavAK_J.js → rule-builder-B7wNFPfi.js} +1 -1
  80. package/dist/style.css +1 -1
  81. package/dist/{template-Be8bixKI.js → template-CvIL9Pex.js} +4 -4
  82. package/dist/{trigger-Nhtu-Pr4.js → trigger-D7uzmrxE.js} +4 -4
  83. package/dist/{usePagination-Djq5Hy-n.js → usePagination-BFzJ3YC7.js} +1 -1
  84. package/dist/{user-B36pyi6C.js → user-NlenrMEw.js} +1 -1
  85. package/dist/{vue-i18n-DaIhSEbY.js → vue-i18n-BjInRP6b.js} +2 -2
  86. package/package.json +1 -1
  87. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DDBXmzd5.js +0 -215
  88. package/dist/Setting-ZTPL9b35.js +0 -1877
  89. package/dist/StoreRewards-B5txZ3P9.js +0 -401
@@ -0,0 +1,422 @@
1
+ import { defineComponent as G, ref as F, computed as N, onMounted as q, resolveComponent as v, openBlock as d, createBlock as x, unref as e, isRef as Y, withCtx as S, createElementVNode as l, createVNode as m, createElementBlock as O, createTextVNode as z, resolveDynamicComponent as H, toDisplayString as P, Fragment as j, createCommentVNode as U, h as C } from "vue";
2
+ import { _ as J } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as Q, components as $ } from "@feedmepos/ui-library";
4
+ import "./index-C6j2uVRJ.js";
5
+ import { p as M, u as X, f as B } from "./loading-C-HOw2p9.js";
6
+ import { C as Z, u as ee } from "./membership-ByveC1Cs.js";
7
+ import { u as te } from "./vue-i18n-BjInRP6b.js";
8
+ import { F as oe } from "./index-CKSGfZ62.js";
9
+ import { c as ae } from "./object-qECH92oz.js";
10
+ import { u as K } from "./app-wDQR6dpb.js";
11
+ import { u as ne } from "./business-CdvE-WIp.js";
12
+ import { useCoreStore as se } from "@feedmepos/mf-common";
13
+ import { Z as R } from "./zod-Bg2FbC-D.js";
14
+ import { _ as ie } from "./ZodTextField.vue_vue_type_script_setup_true_lang-BME260O1.js";
15
+ import { _ as re } from "./ImageInput.vue_vue_type_script_setup_true_lang-ByhTB9Ie.js";
16
+ import { _ as le } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-hR4OBTrC.js";
17
+ import { _ as ce, a as me } from "./EffectSheet.vue_vue_type_style_index_0_lang-Crakwwgo.js";
18
+ import { i as de, t as ue } from "./helper-BOwvTpT_.js";
19
+ import { useRouter as pe } from "vue-router";
20
+ import { m as D } from "./index-FBWWEOV0.js";
21
+ import { R as k } from "./app-BVsQcG_m.js";
22
+ const fe = {
23
+ key: 0,
24
+ class: "flex flex-col space-y-16 pr-12"
25
+ }, ye = { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, ge = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center justify-between" }, we = /* @__PURE__ */ l("div", { class: "fm-typo-en-title-sm-800" }, "Discount", -1), _e = /* @__PURE__ */ l("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, " Usage configuration ", -1), ve = /* @__PURE__ */ l("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Availability", -1), Re = { class: "flex items-center gap-8" }, be = /* @__PURE__ */ G({
26
+ __name: "EditRewardSheet",
27
+ emits: ["update"],
28
+ setup(W, { expose: n, emit: T }) {
29
+ const A = T, y = ne(), I = se(), b = F(!1), o = F(), g = F(), u = oe, p = N(
30
+ () => {
31
+ var r;
32
+ return Z[((r = o.value) == null ? void 0 : r.type) || "VOUCHER"];
33
+ }
34
+ ), w = N(() => {
35
+ const r = u.safeParse(o.value);
36
+ return r.success ? [] : r.error.errors;
37
+ });
38
+ function L() {
39
+ const r = u.safeParse(o.value);
40
+ r.success && A("update", r.data);
41
+ }
42
+ function V(r, s, t = {
43
+ isStoreReward: !1,
44
+ type: "VOUCHER"
45
+ }) {
46
+ b.value = r, r && (g.value = void 0, o.value = s || de(t.type, {
47
+ business: I.currentBusiness.value._id,
48
+ noCampaign: t.isStoreReward == !0
49
+ }));
50
+ }
51
+ return q(async () => {
52
+ await y.readLocations();
53
+ }), n({
54
+ showSheet: V,
55
+ data: o,
56
+ rewardImage: g
57
+ }), (r, s) => {
58
+ const t = v("FmTextarea"), a = v("FmHelperText"), c = v("FmButton"), _ = v("FmSideSheet");
59
+ return d(), x(_, {
60
+ "max-width": 560,
61
+ modelValue: e(b),
62
+ "onUpdate:modelValue": s[7] || (s[7] = (f) => Y(b) ? b.value = f : null),
63
+ header: "Store setting"
64
+ }, {
65
+ "side-sheet-footer": S(() => [
66
+ l("div", Re, [
67
+ m(c, {
68
+ label: "Submit",
69
+ onClick: L,
70
+ disabled: e(w).length > 0 || e(K)().isLoading,
71
+ loading: e(K)().isLoading
72
+ }, null, 8, ["disabled", "loading"]),
73
+ m(c, {
74
+ label: "Cancel",
75
+ onClick: s[6] || (s[6] = (f) => V(!1)),
76
+ variant: "tertiary"
77
+ })
78
+ ])
79
+ ]),
80
+ default: S(() => {
81
+ var f, h, E;
82
+ return [
83
+ e(o) ? (d(), O("div", fe, [
84
+ l("div", ye, [
85
+ z(" Reward information "),
86
+ (d(), x(H(e(p).chip())))
87
+ ]),
88
+ m(ie, {
89
+ modelValue: e(o).name,
90
+ "onUpdate:modelValue": s[0] || (s[0] = (i) => e(o).name = i),
91
+ label: `${e(p).name} name`,
92
+ schema: e(R).typeAtPath(e(u), "name", [e(o).type])
93
+ }, null, 8, ["modelValue", "label", "schema"]),
94
+ m(t, {
95
+ class: "!mb-[-16px]",
96
+ modelValue: e(o).description,
97
+ "onUpdate:modelValue": s[1] || (s[1] = (i) => e(o).description = i),
98
+ rules: [e(R).ruleAtPath(e(u), "description", [e(o).type])]
99
+ }, {
100
+ label: S(() => [
101
+ (d(), x(H(
102
+ e(R).toInputLabel(
103
+ e(R).typeAtPath(e(u), "description", [e(o).type]),
104
+ `${e(p).name} description`
105
+ )
106
+ )))
107
+ ]),
108
+ _: 1
109
+ }, 8, ["modelValue", "rules"]),
110
+ l("div", ge, [
111
+ l("div", null, P(e(p).name) + " description should not exceed 200 characters. ", 1),
112
+ l("div", null, P(((f = e(o).description) == null ? void 0 : f.length) ?? 0) + "/200", 1)
113
+ ]),
114
+ m(re, {
115
+ class: "w-1/2 xs:w-2/3",
116
+ "aspect-ratio": "16/9",
117
+ file: e(g) ?? void 0,
118
+ thumbnail: e(o).image ?? void 0,
119
+ "onUpdate:file": s[2] || (s[2] = async (i) => {
120
+ g.value = i, i || (e(o).image = null);
121
+ })
122
+ }, {
123
+ label: S(() => [
124
+ (d(), x(H(
125
+ e(R).toInputLabel(
126
+ e(R).typeAtPath(e(u), "image", [e(o).type]),
127
+ `${e(p).name} image`
128
+ )
129
+ )))
130
+ ]),
131
+ _: 1
132
+ }, 8, ["file", "thumbnail"]),
133
+ e(o).type === "VOUCHER" ? (d(), O(j, { key: 0 }, [
134
+ we,
135
+ m(ce, {
136
+ "model-value": e(o).extras.effect,
137
+ "onUpdate:modelValue": s[3] || (s[3] = (i) => {
138
+ e(o).extras.effect = i;
139
+ })
140
+ }, null, 8, ["model-value"]),
141
+ e(o).extras.effect == null ? (d(), x(a, {
142
+ key: 0,
143
+ class: "!mt-8",
144
+ text: "Effect is required",
145
+ state: "error"
146
+ })) : U("", !0),
147
+ _e,
148
+ m(me, {
149
+ "model-value": e(o).options,
150
+ "no-campaign": e(o).noCampaign,
151
+ "onUpdate:modelValue": s[4] || (s[4] = (i) => e(o).options = i),
152
+ schema: e(R).typeAtPath(e(u), "options", ["VOUCHER"])
153
+ }, null, 8, ["model-value", "no-campaign", "schema"])
154
+ ], 64)) : U("", !0),
155
+ ve,
156
+ e(o).type === "VOUCHER" ? (d(), x(le, {
157
+ key: 1,
158
+ "model-value": ((E = (h = e(o).extras) == null ? void 0 : h.targetLocation) == null ? void 0 : E.map(String)) ?? null,
159
+ type: "select",
160
+ "onUpdate:modelValue": s[5] || (s[5] = (i) => {
161
+ e(o).extras.targetLocation = i;
162
+ }),
163
+ rules: [
164
+ e(R).ruleAtPath(e(u), "extras.targetLocation", ["VOUCHER"])
165
+ ]
166
+ }, null, 8, ["model-value", "rules"])) : U("", !0)
167
+ ])) : U("", !0)
168
+ ];
169
+ }),
170
+ _: 1
171
+ }, 8, ["modelValue"]);
172
+ };
173
+ }
174
+ }), he = { class: "px-24 flex flex-col gap-y-16" }, xe = { class: "flex items-center justify-between w-full" }, Ce = /* @__PURE__ */ l("div", { class: "flex gap-8" }, null, -1), Se = /* @__PURE__ */ l("img", {
175
+ src: J,
176
+ class: "aspect-square w-[150px]"
177
+ }, null, -1), Fe = { class: "flex flex-col gap-16 text-center" }, Ve = { class: "fm-typo-en-title-sm-800" }, Ee = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ze = /* @__PURE__ */ G({
178
+ __name: "StoreRewards",
179
+ setup(W) {
180
+ const { t: n } = te(), T = Q(), A = {
181
+ label: n("connect.storeRewards.create"),
182
+ value: "create",
183
+ isPrimary: !0,
184
+ prependIcon: "add"
185
+ }, y = ee(), { global: I, minor: b } = X, o = pe(), g = F({
186
+ searchKey: "",
187
+ columnFilters: []
188
+ }), u = [
189
+ {
190
+ header: n("connect.storeRewards.table.name"),
191
+ accessorFn: (t) => t.name
192
+ },
193
+ {
194
+ id: "type",
195
+ header: n("connect.storeRewards.table.type"),
196
+ accessorFn: (t) => t.type,
197
+ cell(t) {
198
+ return Z[t.row.original.type].chip();
199
+ }
200
+ },
201
+ {
202
+ header: n("connect.storeRewards.table.validity"),
203
+ accessorFn: (t) => ue(
204
+ "validityOption" in t.options ? t.options.validityOption || {} : {}
205
+ )
206
+ },
207
+ {
208
+ header: n("connect.storeRewards.table.used"),
209
+ meta: {
210
+ textAlign: "left"
211
+ },
212
+ accessorFn: (t) => t.currentReceive ?? 0
213
+ },
214
+ {
215
+ header: n("connect.storeRewards.table.actions"),
216
+ cell(t) {
217
+ return C("div", { class: "flex items-center justify-end gap-4" }, [
218
+ C(
219
+ $.FmMenu,
220
+ {
221
+ placement: "bottom-end",
222
+ onClick: (a) => {
223
+ a.stopPropagation();
224
+ }
225
+ },
226
+ {
227
+ "menu-button": () => C($.FmButton, {
228
+ icon: "more_vert",
229
+ iconColor: "neutral-gray-400",
230
+ variant: "tertiary"
231
+ }),
232
+ default: () => [
233
+ C($.FmMenuItem, {
234
+ label: "View collections",
235
+ onClick: async (a) => {
236
+ a.stopPropagation(), L(t.row.original._id);
237
+ }
238
+ }),
239
+ // h(components.FmMenuItem, {
240
+ // label: 'View transactions',
241
+ // onClick: async (event: Event) => {
242
+ // event.stopPropagation();
243
+ // onViewTransactions(props.row.original._id as string);
244
+ // },
245
+ // }),
246
+ C(
247
+ $.FmMenuItem,
248
+ {
249
+ onClick: async (a) => {
250
+ a.stopPropagation(), V(t.row.original);
251
+ }
252
+ },
253
+ {
254
+ label: C(
255
+ "div",
256
+ {
257
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
258
+ },
259
+ "Remove"
260
+ )
261
+ }
262
+ )
263
+ ]
264
+ }
265
+ )
266
+ ]);
267
+ }
268
+ }
269
+ ], p = N(
270
+ () => y.bundleRewards.filter((t) => t.type == "VOUCHER")
271
+ ), w = F();
272
+ function L(t) {
273
+ o.push({
274
+ name: k["$connect-STORE_REWARD_COLLECTIONS"],
275
+ params: { id: t }
276
+ });
277
+ }
278
+ async function V(t) {
279
+ if (t.type === "TITLE") {
280
+ await M.confirm(
281
+ n("connect.storeRewards.remove.message"),
282
+ n("connect.storeRewards.remove.title"),
283
+ n("connect.storeRewards.remove.action")
284
+ ) && await o.push({ name: k["$connect-PROGRAM_TITLE"] });
285
+ return;
286
+ }
287
+ await M.remove(
288
+ n("connect.storeRewards.delete.confirm"),
289
+ n("connect.storeRewards.delete.title")
290
+ ) && await b(
291
+ async () => {
292
+ await D.deleteReward(t._id), await y.readMembership(), await y.readRewards();
293
+ },
294
+ {
295
+ message: n("connect.storeRewards.delete.message"),
296
+ successMessage: n("connect.storeRewards.delete.success")
297
+ }
298
+ );
299
+ }
300
+ async function r(t) {
301
+ var c;
302
+ const a = t ? ae(y.bundleRewards.find((_) => _._id === t)) : void 0;
303
+ if ((a == null ? void 0 : a.type) === "TITLE") {
304
+ await M.confirm(
305
+ "You cannot edit a title here, please edit it at the Program > Title section.",
306
+ "Update reward",
307
+ "Go to title section"
308
+ ) && await o.push({ name: k["$connect-PROGRAM_TITLE"] });
309
+ return;
310
+ }
311
+ (c = w.value) == null || c.showSheet(!0, a, {
312
+ isStoreReward: !0,
313
+ type: "VOUCHER"
314
+ });
315
+ }
316
+ async function s(t) {
317
+ let a = !1;
318
+ t._id && t.type === "VOUCHER" && await new Promise((c) => {
319
+ T.open({
320
+ title: "Confirmation",
321
+ message: n("connect.campaign.voucher.updateConfirm"),
322
+ primaryActions: {
323
+ text: n("connect.campaign.voucher.updateConfirm.updateAll"),
324
+ close: !0
325
+ },
326
+ secondaryActions: {
327
+ text: n("connect.campaign.voucher.updateConfirm.updateFuture"),
328
+ close: !0
329
+ }
330
+ }).onPrimary(async () => {
331
+ a = !0, c();
332
+ }).onSecondary(async () => {
333
+ c();
334
+ });
335
+ }), await b(
336
+ async () => {
337
+ var c, _, f, h;
338
+ (c = w.value) != null && c.rewardImage && t.image ? await B.delete(t.image) : (_ = w.value) != null && _.rewardImage && (t.image = await B.update(
339
+ t.image || B.collectibleImagePath(
340
+ void 0,
341
+ w.value.rewardImage
342
+ ),
343
+ (f = w.value) == null ? void 0 : f.rewardImage
344
+ )), t._id ? await D.updateReward(t._id, {
345
+ ...t,
346
+ updateCollection: a
347
+ }) : await D.createReward(t), await y.readRewards(), (h = w.value) == null || h.showSheet(!1);
348
+ },
349
+ {
350
+ message: "Updating reward",
351
+ successMessage: "Reward updated successfully"
352
+ }
353
+ );
354
+ }
355
+ return q(async () => {
356
+ await I(async () => {
357
+ await y.readMembership(), await y.readRewards();
358
+ });
359
+ }), (t, a) => {
360
+ const c = v("FmPageHead"), _ = v("FmSearch"), f = v("FmTable"), h = v("FmButton"), E = v("FmCard");
361
+ return d(), O(j, null, [
362
+ m(c, {
363
+ title: e(n)("connect.storeRewards.title"),
364
+ description: e(n)("connect.storeRewards.description"),
365
+ actions: [A],
366
+ "back-button": !0,
367
+ "onClick:action": a[0] || (a[0] = () => r()),
368
+ "onClick:back": a[1] || (a[1] = () => e(o).push({ name: e(k)["$connect-STORE"] }))
369
+ }, null, 8, ["title", "description", "actions"]),
370
+ l("div", he, [
371
+ e(p) && e(p).length > 0 ? (d(), O(j, { key: 0 }, [
372
+ l("div", xe, [
373
+ Ce,
374
+ m(_, {
375
+ modelValue: e(g).searchKey,
376
+ "onUpdate:modelValue": a[2] || (a[2] = (i) => e(g).searchKey = i),
377
+ class: "",
378
+ placeholder: "search",
379
+ collapsible: ""
380
+ }, null, 8, ["modelValue"])
381
+ ]),
382
+ m(f, {
383
+ "row-data": e(p),
384
+ "column-defs": u,
385
+ "search-value": e(g).searchKey,
386
+ "column-filter": e(g).columnFilters,
387
+ onRowClick: a[3] || (a[3] = (i) => r(i.original._id)),
388
+ "hide-footer": e(p).length < 10
389
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
390
+ ], 64)) : (d(), x(E, {
391
+ key: 1,
392
+ variant: "outlined",
393
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
394
+ }, {
395
+ default: S(() => [
396
+ Se,
397
+ l("div", Fe, [
398
+ l("div", Ve, P(e(n)("connect.storeRewards.empty.title")), 1),
399
+ l("div", Ee, P(e(n)("connect.storeRewards.empty.description")), 1)
400
+ ]),
401
+ m(h, {
402
+ variant: "primary",
403
+ label: e(n)("connect.storeRewards.empty.action"),
404
+ onClick: a[4] || (a[4] = (i) => r()),
405
+ icon: "add"
406
+ }, null, 8, ["label"])
407
+ ]),
408
+ _: 1
409
+ })),
410
+ m(be, {
411
+ ref_key: "rewardSheetRef",
412
+ ref: w,
413
+ onUpdate: a[5] || (a[5] = (i) => s(i))
414
+ }, null, 512)
415
+ ])
416
+ ], 64);
417
+ };
418
+ }
419
+ });
420
+ export {
421
+ ze as default
422
+ };