@feedmepos/mf-connect 0.1.98-beta.15 → 0.1.98-beta.16

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 (138) hide show
  1. package/dist/App-DNXDhULP.js +4782 -0
  2. package/dist/AuditLogs-BNS27IJT.js +2013 -0
  3. package/dist/Bin-Dkjyrbz-.js +166 -0
  4. package/dist/Broadcast-B-fpjVzY.js +266 -0
  5. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-qBcG-vPM.js +120 -0
  6. package/dist/Card-BvVHO8kN.js +910 -0
  7. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +97 -0
  8. package/dist/Collections-BLxPSOJl.js +540 -0
  9. package/dist/Credit-DU-stilH.js +260 -0
  10. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +128 -0
  11. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +58 -0
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Bqnb00zk.js +3377 -0
  13. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CTSfEq5N.js +351 -0
  14. package/dist/Experience-C3tB8hTp.js +259 -0
  15. package/dist/FileSaver.min-EIworvUf.js +74 -0
  16. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +129 -0
  17. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +52 -0
  18. package/dist/Game-Dq1ms2fA.js +330 -0
  19. package/dist/Grab-DnSO2oLx.js +300 -0
  20. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-n1r2bgOE.js +145 -0
  21. package/dist/Index-BFIHgW9W.js +259 -0
  22. package/dist/JsonViewer-v8_C7l5N.js +87 -0
  23. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-Do7CJZuh.js +48 -0
  24. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-vpJmHgKM.js +18737 -0
  25. package/dist/LoyaltyDashboard-CcBogXzl.js +1082 -0
  26. package/dist/MainLayout-CPNiL_et.js +41 -0
  27. package/dist/Marketing-Bzb1VaVA.js +235 -0
  28. package/dist/MarketingMaterialEdit-8UQNx3mV.js +1035 -0
  29. package/dist/Member-Drb_NVrb.js +280 -0
  30. package/dist/MemberList-wa3JxCVr.js +1601 -0
  31. package/dist/MemberOverview-wL_ailso.js +58 -0
  32. package/dist/MemberTransactions-8qlm-T67.js +45 -0
  33. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BHicaUXs.js +60802 -0
  34. package/dist/Mission-DmWbQmOv.js +334 -0
  35. package/dist/Overview-COEFtf12.js +1079 -0
  36. package/dist/Overview-D7ki-aBA.js +969 -0
  37. package/dist/Point-B0W-BcPA.js +262 -0
  38. package/dist/Promotion-CY16SjmK.js +397 -0
  39. package/dist/Queue-hMur40Xc.js +260 -0
  40. package/dist/Record-Bj7GQP1r.js +342 -0
  41. package/dist/Review-Z1XD6bJK.js +45 -0
  42. package/dist/ReviewFacebookCallback-DirGtKLX.js +248 -0
  43. package/dist/ReviewGoogleCallback-CVC6741e.js +213 -0
  44. package/dist/Reward-DDB5Usau.js +442 -0
  45. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-B-OnKAbx.js +149 -0
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-DDHM8NLi.js +1911 -0
  47. package/dist/Segment-Bl0k9fvJ.js +1014 -0
  48. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-C33DPiN6.js +181 -0
  49. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-YMpQ-IiW.js +188 -0
  50. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang--Rtf3gRa.js +226 -0
  51. package/dist/Setting-CpD98E2N.js +2047 -0
  52. package/dist/SettingAdvertisements-BZFQu_HI.js +264 -0
  53. package/dist/Settings-CRqlKNsc.js +228 -0
  54. package/dist/Store-CDG2_iqc.js +1996 -0
  55. package/dist/StoreRewards-DIU5hPXv.js +540 -0
  56. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-B82RH_ZC.js +1133 -0
  57. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DKGCmk5y.js +7007 -0
  58. package/dist/Tier-BXgIdYDa.js +969 -0
  59. package/dist/Title-DgHxyV8p.js +566 -0
  60. package/dist/Transaction-iDacnm6Y.js +39 -0
  61. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-RUbR6pdK.js +130 -0
  62. package/dist/Voucher-C-I8JK4F.js +421 -0
  63. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-BUpYZxij.js +421 -0
  64. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-LhG5jJq3.js +56 -0
  65. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  66. package/dist/app-CyNzTZOx.js +59950 -0
  67. package/dist/app-wDQR6dpb.js +39 -0
  68. package/dist/app.js +7 -0
  69. package/dist/business-o_sAO_33.js +82 -0
  70. package/dist/campaign--IUcyI8h.js +219 -0
  71. package/dist/campaign-CpzFl8Vr.js +4 -0
  72. package/dist/campaign-zLKyql03.js +277 -0
  73. package/dist/campaign.enum-CEbNgaGZ.js +26 -0
  74. package/dist/campaign.fn-BVT0m6Uy.js +776 -0
  75. package/dist/collectible.enum-2y8KIQLL.js +19 -0
  76. package/dist/duplicateCampaign-DIzdQf0e.js +51 -0
  77. package/dist/effect-B6gKaH4T.js +89 -0
  78. package/dist/email-addresses-CO9GNnUN.js +705 -0
  79. package/dist/export-DdDpRFVg.js +97 -0
  80. package/dist/feedme.ico +0 -0
  81. package/dist/google-BQK68wbe.js +5 -0
  82. package/dist/helper-DqypCsTm.js +86 -0
  83. package/dist/index-BK0OmX3R.js +85 -0
  84. package/dist/index-Bc7JXl59.js +54 -0
  85. package/dist/index-BgiIGrLb.js +32 -0
  86. package/dist/index-C-TiT9bf.js +1157 -0
  87. package/dist/index-COXmoOd1.js +3678 -0
  88. package/dist/index-CT6uJJ9y.js +151 -0
  89. package/dist/index-Ci2gFCfD.js +61 -0
  90. package/dist/index-CtJ0MQQ1.js +3 -0
  91. package/dist/index-CuvNtC_M.js +61 -0
  92. package/dist/index-D41Xq5qY.js +8910 -0
  93. package/dist/index-DBD_e_yR.js +31 -0
  94. package/dist/index-DDpz9LmI.js +67 -0
  95. package/dist/index-Dh2apeby.js +2819 -0
  96. package/dist/index-DiDmMG_M.js +28900 -0
  97. package/dist/index-pjXQwa0j.js +30289 -0
  98. package/dist/index-vh86FiIQ.js +10 -0
  99. package/dist/index.esm2017-Cd4FhecE.js +3069 -0
  100. package/dist/loading-D-RglDMV.js +72 -0
  101. package/dist/lodash-cggYhL9V.js +3678 -0
  102. package/dist/membership-DTfMyKwP.js +255 -0
  103. package/dist/moment-D7p2TMB-.js +2583 -0
  104. package/dist/money-fGZfbdgV.js +15 -0
  105. package/dist/number-BOalh3ZH.js +12 -0
  106. package/dist/object-BYyQ0PZp.js +18 -0
  107. package/dist/objectId-dwaoBfJX.js +7 -0
  108. package/dist/objectid-zPJFVngY.js +145 -0
  109. package/dist/plugins-CbpvMMOJ.js +1788 -0
  110. package/dist/reward-DkVAHEq2.js +36 -0
  111. package/dist/rule-EzWg2u8d.js +1969 -0
  112. package/dist/string-Gcy5IM_H.js +32 -0
  113. package/dist/style.css +4 -0
  114. package/dist/template-BfVFq4on.js +188 -0
  115. package/dist/tier-BJDhpH6X.js +4 -0
  116. package/dist/tiers/tier=1.png +0 -0
  117. package/dist/tiers/tier=2.png +0 -0
  118. package/dist/tiers/tier=3.png +0 -0
  119. package/dist/tiers/tier=4.png +0 -0
  120. package/dist/titles/type=diamond.png +0 -0
  121. package/dist/titles/type=drinks.png +0 -0
  122. package/dist/titles/type=food.png +0 -0
  123. package/dist/titles/type=heart.png +0 -0
  124. package/dist/titles/type=medal.png +0 -0
  125. package/dist/titles/type=spend.png +0 -0
  126. package/dist/titles/type=thank-you.png +0 -0
  127. package/dist/titles/type=thumbs-up.png +0 -0
  128. package/dist/titles/type=years.png +0 -0
  129. package/dist/trigger-es-_uiSg.js +213 -0
  130. package/dist/tslib.es6-BCqqvLQ_.js +44 -0
  131. package/dist/type_drinks-D6jnpvwV.js +4 -0
  132. package/dist/useMarketingMaterialActions-CpiIKMmG.js +107 -0
  133. package/dist/usePagination-SYsXgU6x.js +220 -0
  134. package/dist/user-DUe40u3g.js +55 -0
  135. package/dist/vue-i18n-Dn9zxRuv.js +2365 -0
  136. package/dist/xlsx-DugGi7dB.js +15491 -0
  137. package/dist/zod-Dw8_B6RC.js +91 -0
  138. package/package.json +1 -1
@@ -0,0 +1,540 @@
1
+ import { defineComponent as Z, ref as A, computed as q, onMounted as z, resolveComponent as F, openBlock as y, createBlock as E, unref as e, isRef as ee, withCtx as V, createElementVNode as s, createVNode as c, createElementBlock as D, createTextVNode as te, resolveDynamicComponent as N, toDisplayString as H, Fragment as W, createCommentVNode as P, h as C } from "vue";
2
+ import { _ as oe } from "./campaign-CpzFl8Vr.js";
3
+ import { useDialog as J, components as $ } from "@feedmepos/ui-library";
4
+ import "./index-CtJ0MQQ1.js";
5
+ import { u as ae } from "./loading-D-RglDMV.js";
6
+ import { C as Q, u as ne } from "./membership-DTfMyKwP.js";
7
+ import { p as B, f as K } from "./plugins-CbpvMMOJ.js";
8
+ import { useCoreStore as X } from "@feedmepos/mf-common";
9
+ import { u as se } from "./vue-i18n-Dn9zxRuv.js";
10
+ import { F as ie } from "./index-D41Xq5qY.js";
11
+ import { c as re } from "./object-BYyQ0PZp.js";
12
+ import { u as Y } from "./app-wDQR6dpb.js";
13
+ import { u as le } from "./business-o_sAO_33.js";
14
+ import { Z as h } from "./zod-Dw8_B6RC.js";
15
+ import { _ as de } from "./ZodTextField.vue_vue_type_script_setup_true_lang-LhG5jJq3.js";
16
+ import { _ as ce } from "./ImageInput.vue_vue_type_script_setup_true_lang-n1r2bgOE.js";
17
+ import { _ as me } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-DKGCmk5y.js";
18
+ import { _ as pe, a as ue } from "./EffectSheet.vue_vue_type_style_index_0_lang-CTSfEq5N.js";
19
+ import { i as fe, F as ye, h as j, t as we } from "./helper-DqypCsTm.js";
20
+ import { useRouter as ge } from "vue-router";
21
+ import { m as G } from "./index-CT6uJJ9y.js";
22
+ import { R as L } from "./app-CyNzTZOx.js";
23
+ function ve(w) {
24
+ return !!(w != null && w.isAdmin) || !!(w != null && w.isStaff);
25
+ }
26
+ const be = {
27
+ key: 0,
28
+ class: "flex flex-col space-y-16 pr-12"
29
+ }, Re = { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, _e = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary flex items-center justify-between" }, xe = { class: "flex items-center gap-8" }, Ce = /* @__PURE__ */ Z({
30
+ __name: "EditRewardSheet",
31
+ emits: ["update"],
32
+ setup(w, { expose: i, emit: k }) {
33
+ const U = k, u = le(), l = X(), g = A(!1), n = A(), S = A(), O = A(!1), v = ie, b = q(
34
+ () => {
35
+ var d;
36
+ return Q[((d = n.value) == null ? void 0 : d.type) || "VOUCHER"];
37
+ }
38
+ ), R = q(() => {
39
+ const d = v.safeParse(n.value);
40
+ return d.success ? [] : d.error.errors;
41
+ });
42
+ function M() {
43
+ const d = v.safeParse(n.value);
44
+ if (d.success) {
45
+ const a = { ...d.data };
46
+ O.value && (a.capabilities = ye), U("update", a);
47
+ }
48
+ }
49
+ function I(d, a, T = {
50
+ isStoreReward: !1,
51
+ type: "VOUCHER"
52
+ }) {
53
+ g.value = d, d && (S.value = void 0, O.value = T.isFeedvibe ?? !1, n.value = a || fe(T.type, {
54
+ business: l.currentBusiness.value._id,
55
+ noCampaign: T.isStoreReward == !0
56
+ }));
57
+ }
58
+ return z(async () => {
59
+ await u.readLocations();
60
+ }), i({
61
+ showSheet: I,
62
+ data: n,
63
+ rewardImage: S
64
+ }), (d, a) => {
65
+ const T = F("FmTextarea"), t = F("FmHelperText"), o = F("FmButton"), m = F("FmSideSheet");
66
+ return y(), E(m, {
67
+ "max-width": 560,
68
+ modelValue: e(g),
69
+ "onUpdate:modelValue": a[7] || (a[7] = (p) => ee(g) ? g.value = p : null),
70
+ header: "Store setting"
71
+ }, {
72
+ "side-sheet-footer": V(() => [
73
+ s("div", xe, [
74
+ c(o, {
75
+ label: "Submit",
76
+ onClick: M,
77
+ disabled: e(R).length > 0 || e(Y)().isLoading,
78
+ loading: e(Y)().isLoading
79
+ }, null, 8, ["disabled", "loading"]),
80
+ c(o, {
81
+ label: "Cancel",
82
+ onClick: a[6] || (a[6] = (p) => I(!1)),
83
+ variant: "tertiary"
84
+ })
85
+ ])
86
+ ]),
87
+ default: V(() => {
88
+ var p, _, x;
89
+ return [
90
+ e(n) ? (y(), D("div", be, [
91
+ s("div", Re, [
92
+ a[8] || (a[8] = te(" Reward information ", -1)),
93
+ (y(), E(N(e(b).chip())))
94
+ ]),
95
+ c(de, {
96
+ modelValue: e(n).name,
97
+ "onUpdate:modelValue": a[0] || (a[0] = (r) => e(n).name = r),
98
+ label: `${e(b).name} name`,
99
+ schema: e(h).typeAtPath(e(v), "name", [e(n).type])
100
+ }, null, 8, ["modelValue", "label", "schema"]),
101
+ c(T, {
102
+ class: "!mb-[-16px]",
103
+ modelValue: e(n).description,
104
+ "onUpdate:modelValue": a[1] || (a[1] = (r) => e(n).description = r),
105
+ rules: [e(h).ruleAtPath(e(v), "description", [e(n).type])]
106
+ }, {
107
+ label: V(() => [
108
+ (y(), E(N(
109
+ e(h).toInputLabel(
110
+ e(h).typeAtPath(e(v), "description", [e(n).type]),
111
+ `${e(b).name} description`
112
+ )
113
+ )))
114
+ ]),
115
+ _: 1
116
+ }, 8, ["modelValue", "rules"]),
117
+ s("div", _e, [
118
+ s("div", null, H(e(b).name) + " description should not exceed 200 characters. ", 1),
119
+ s("div", null, H(((p = e(n).description) == null ? void 0 : p.length) ?? 0) + "/200", 1)
120
+ ]),
121
+ c(ce, {
122
+ class: "w-1/2 xs:w-2/3",
123
+ "aspect-ratio": "16/9",
124
+ file: e(S) ?? void 0,
125
+ thumbnail: e(n).image ?? void 0,
126
+ "onUpdate:file": a[2] || (a[2] = async (r) => {
127
+ S.value = r, r || (e(n).image = null);
128
+ })
129
+ }, {
130
+ label: V(() => [
131
+ (y(), E(N(
132
+ e(h).toInputLabel(
133
+ e(h).typeAtPath(e(v), "image", [e(n).type]),
134
+ `${e(b).name} image`
135
+ )
136
+ )))
137
+ ]),
138
+ _: 1
139
+ }, 8, ["file", "thumbnail"]),
140
+ e(n).type === "VOUCHER" ? (y(), D(W, { key: 0 }, [
141
+ a[9] || (a[9] = s("div", { class: "fm-typo-en-title-sm-800" }, "Discount", -1)),
142
+ c(pe, {
143
+ "model-value": e(n).extras.effect,
144
+ "onUpdate:modelValue": a[3] || (a[3] = (r) => {
145
+ e(n).extras.effect = r;
146
+ })
147
+ }, null, 8, ["model-value"]),
148
+ e(n).extras.effect == null ? (y(), E(t, {
149
+ key: 0,
150
+ class: "!mt-8",
151
+ text: "Effect is required",
152
+ state: "error"
153
+ })) : P("", !0),
154
+ a[10] || (a[10] = s("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, " Usage configuration ", -1)),
155
+ c(ue, {
156
+ "model-value": e(n).options,
157
+ "no-campaign": e(n).noCampaign,
158
+ "onUpdate:modelValue": a[4] || (a[4] = (r) => e(n).options = r),
159
+ schema: e(h).typeAtPath(e(v), "options", ["VOUCHER"])
160
+ }, null, 8, ["model-value", "no-campaign", "schema"])
161
+ ], 64)) : P("", !0),
162
+ a[11] || (a[11] = s("div", { class: "fm-typo-en-title-sm-800 !mb-[-8px]" }, "Availability", -1)),
163
+ e(n).type === "VOUCHER" ? (y(), E(me, {
164
+ key: 1,
165
+ "model-value": ((x = (_ = e(n).extras) == null ? void 0 : _.targetLocation) == null ? void 0 : x.map(String)) ?? null,
166
+ type: "select",
167
+ "onUpdate:modelValue": a[5] || (a[5] = (r) => {
168
+ e(n).extras.targetLocation = r;
169
+ }),
170
+ rules: [
171
+ e(h).ruleAtPath(e(v), "extras.targetLocation", ["VOUCHER"])
172
+ ]
173
+ }, null, 8, ["model-value", "rules"])) : P("", !0)
174
+ ])) : P("", !0)
175
+ ];
176
+ }),
177
+ _: 1
178
+ }, 8, ["modelValue"]);
179
+ };
180
+ }
181
+ }), Fe = { class: "flex flex-nowrap gap-x-2 grow h-full" }, Se = { class: "flex flex-col grow p-24" }, he = { class: "grow pb-16 pr-16 pt-6 w-full" }, Ee = { class: "gap-24 grid grid-cols-1 lg:grid-cols-2" }, Ve = /* @__PURE__ */ Z({
182
+ __name: "RewardTypeDialog",
183
+ props: {
184
+ onOk: {
185
+ type: Function,
186
+ required: !0
187
+ }
188
+ },
189
+ setup(w) {
190
+ const i = J(), k = w;
191
+ function U(u) {
192
+ k.onOk(u), i.close();
193
+ }
194
+ return (u, l) => {
195
+ const g = F("FmCard");
196
+ return y(), E(g, { class: "max-w-6xl" }, {
197
+ default: V(() => [
198
+ s("div", Fe, [
199
+ s("div", Se, [
200
+ l[4] || (l[4] = s("div", { class: "space-y-4" }, [
201
+ s("div", { class: "fm-typo-en-title-sm-800" }, "Store rewards"),
202
+ s("div", { class: "text-fm-color-typo-secondary fm-typo-en-body-md-400" }, " Select a reward type to get started. ")
203
+ ], -1)),
204
+ s("div", he, [
205
+ s("div", Ee, [
206
+ c(g, {
207
+ variant: "outlined",
208
+ class: "box-border cursor-pointer h-full p-16 scroll-p-4 space-y-8",
209
+ onClick: l[0] || (l[0] = (n) => U("general"))
210
+ }, {
211
+ default: V(() => [...l[2] || (l[2] = [
212
+ s("div", { class: "fm-typo-en-title-sm-800" }, "General Reward", -1),
213
+ s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " A standard voucher reward that can be freely edited and managed. ", -1)
214
+ ])]),
215
+ _: 1
216
+ }),
217
+ c(g, {
218
+ variant: "outlined",
219
+ class: "box-border cursor-pointer h-full p-16 scroll-p-4 space-y-8",
220
+ onClick: l[1] || (l[1] = (n) => U("feedvibe"))
221
+ }, {
222
+ default: V(() => [...l[3] || (l[3] = [
223
+ s("div", { class: "fm-typo-en-title-sm-800" }, "FeedVibe Reward", -1),
224
+ s("div", { class: "fm-typo-en-body-lg-400 text-fm-color-typo-secondary" }, " A locked reward for FeedVibe bundles. Cannot be edited or deleted after creation. ", -1)
225
+ ])]),
226
+ _: 1
227
+ })
228
+ ])
229
+ ])
230
+ ])
231
+ ])
232
+ ]),
233
+ _: 1
234
+ });
235
+ };
236
+ }
237
+ }), Oe = { class: "px-24 flex flex-col gap-y-16" }, Te = { class: "flex items-center justify-between w-full" }, ke = { class: "flex flex-col gap-16 text-center" }, Ue = { class: "fm-typo-en-title-sm-800" }, Ae = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, ot = /* @__PURE__ */ Z({
238
+ __name: "StoreRewards",
239
+ setup(w) {
240
+ const { t: i } = se(), k = J(), U = {
241
+ label: i("connect.storeRewards.create"),
242
+ value: "create",
243
+ isPrimary: !0,
244
+ prependIcon: "add"
245
+ }, u = ne(), l = X(), { global: g, minor: n } = ae, S = ge(), O = A({
246
+ searchKey: "",
247
+ columnFilters: []
248
+ }), v = [
249
+ {
250
+ header: i("connect.storeRewards.table.name"),
251
+ accessorFn: (t) => t.name,
252
+ cell(t) {
253
+ const o = t.row.original, m = j(
254
+ o.capabilities,
255
+ "STORE_BUNDLE:FEEDVIBE",
256
+ "selectable",
257
+ !1
258
+ );
259
+ return C("div", { class: "flex items-center gap-8" }, [
260
+ C("span", {}, o.name),
261
+ ...m ? [
262
+ C($.FmChip, {
263
+ label: "Feedvibe",
264
+ class: "text-fm-color-primary bg-fm-color-system-warning-100",
265
+ compact: !0
266
+ })
267
+ ] : []
268
+ ]);
269
+ }
270
+ },
271
+ {
272
+ id: "type",
273
+ header: i("connect.storeRewards.table.type"),
274
+ accessorFn: (t) => t.type,
275
+ cell(t) {
276
+ return Q[t.row.original.type].chip();
277
+ }
278
+ },
279
+ {
280
+ header: i("connect.storeRewards.table.validity"),
281
+ accessorFn: (t) => we(
282
+ "validityOption" in t.options ? t.options.validityOption || {} : {}
283
+ )
284
+ },
285
+ {
286
+ header: i("connect.storeRewards.table.used"),
287
+ meta: {
288
+ textAlign: "left"
289
+ },
290
+ accessorFn: (t) => t.currentReceive ?? 0
291
+ },
292
+ {
293
+ header: i("connect.storeRewards.table.actions"),
294
+ cell(t) {
295
+ return C("div", { class: "flex items-center justify-end gap-4" }, [
296
+ C(
297
+ $.FmMenu,
298
+ {
299
+ placement: "bottom-end",
300
+ onClick: (o) => {
301
+ o.stopPropagation();
302
+ }
303
+ },
304
+ {
305
+ "menu-button": () => C($.FmButton, {
306
+ icon: "more_vert",
307
+ iconColor: "neutral-gray-400",
308
+ variant: "tertiary"
309
+ }),
310
+ default: () => [
311
+ C($.FmMenuItem, {
312
+ label: "View collections",
313
+ onClick: async (o) => {
314
+ o.stopPropagation(), M(t.row.original._id);
315
+ }
316
+ }),
317
+ ...j(
318
+ t.row.original.capabilities,
319
+ "STORE_BUNDLE:FEEDVIBE",
320
+ "deletable"
321
+ ) ? [
322
+ C(
323
+ $.FmMenuItem,
324
+ {
325
+ onClick: async (o) => {
326
+ o.stopPropagation(), I(t.row.original);
327
+ }
328
+ },
329
+ {
330
+ label: C(
331
+ "div",
332
+ {
333
+ class: "text-fm-color-typo-error fm-typo-en-body-md-400"
334
+ },
335
+ "Remove"
336
+ )
337
+ }
338
+ )
339
+ ] : []
340
+ ]
341
+ }
342
+ )
343
+ ]);
344
+ }
345
+ }
346
+ ], b = q(
347
+ () => u.bundleRewards.filter((t) => t.type == "VOUCHER")
348
+ ), R = A();
349
+ function M(t) {
350
+ S.push({
351
+ name: L["$connect-STORE_REWARD_COLLECTIONS"],
352
+ params: { id: t }
353
+ });
354
+ }
355
+ async function I(t) {
356
+ if (t.type === "TITLE") {
357
+ await B.confirm(
358
+ i("connect.storeRewards.remove.message"),
359
+ i("connect.storeRewards.remove.title"),
360
+ i("connect.storeRewards.remove.action")
361
+ ) && await S.push({ name: L["$connect-PROGRAM_TITLE"] });
362
+ return;
363
+ }
364
+ await B.remove(
365
+ i("connect.storeRewards.delete.confirm"),
366
+ i("connect.storeRewards.delete.title")
367
+ ) && await n(
368
+ async () => {
369
+ await G.deleteReward(t._id), await u.readMembership(), await u.readRewards();
370
+ },
371
+ {
372
+ message: i("connect.storeRewards.delete.message"),
373
+ successMessage: i("connect.storeRewards.delete.success")
374
+ }
375
+ );
376
+ }
377
+ function d() {
378
+ return new Promise((t) => {
379
+ k.open({
380
+ title: "Create reward",
381
+ dialogComponent: C(Ve, {
382
+ onOk: (o) => {
383
+ t(o);
384
+ }
385
+ })
386
+ }).onClose(() => {
387
+ t(null);
388
+ });
389
+ });
390
+ }
391
+ async function a(t) {
392
+ var _, x, r;
393
+ const o = t ? re(u.bundleRewards.find((f) => f._id === t)) : void 0, m = ve((_ = l.sessionUser.value) == null ? void 0 : _.role), p = !!o && !j(
394
+ o.capabilities,
395
+ "STORE_BUNDLE:FEEDVIBE",
396
+ "editable"
397
+ );
398
+ if (p && !m) {
399
+ await B.confirm(
400
+ "This reward is managed by FeedVibe and cannot be edited.",
401
+ "Cannot edit reward",
402
+ "OK"
403
+ );
404
+ return;
405
+ }
406
+ if ((o == null ? void 0 : o.type) === "TITLE") {
407
+ await B.confirm(
408
+ "You cannot edit a title here, please edit it at the Program > Title section.",
409
+ "Update reward",
410
+ "Go to title section"
411
+ ) && await S.push({ name: L["$connect-PROGRAM_TITLE"] });
412
+ return;
413
+ }
414
+ if (!o) {
415
+ const f = await d();
416
+ if (!f) return;
417
+ (x = R.value) == null || x.showSheet(!0, void 0, {
418
+ isStoreReward: !0,
419
+ type: "VOUCHER",
420
+ isFeedvibe: f === "feedvibe"
421
+ });
422
+ return;
423
+ }
424
+ (r = R.value) == null || r.showSheet(!0, o, {
425
+ isStoreReward: !0,
426
+ type: "VOUCHER",
427
+ // Preserve the FeedVibe lock when an admin edits a locked reward.
428
+ isFeedvibe: p
429
+ });
430
+ }
431
+ async function T(t) {
432
+ let o = !1;
433
+ t._id && t.type === "VOUCHER" && await new Promise((m) => {
434
+ k.open({
435
+ title: "Confirmation",
436
+ message: i("connect.campaign.voucher.updateConfirm.message"),
437
+ primaryActions: {
438
+ text: i("connect.campaign.voucher.updateConfirm.updateAll"),
439
+ close: !0
440
+ },
441
+ secondaryActions: {
442
+ text: i("connect.campaign.voucher.updateConfirm.updateFuture"),
443
+ close: !0
444
+ }
445
+ }).onPrimary(async () => {
446
+ o = !0, m();
447
+ }).onSecondary(async () => {
448
+ m();
449
+ });
450
+ }), await n(
451
+ async () => {
452
+ var m, p, _, x;
453
+ (m = R.value) != null && m.rewardImage && t.image ? await K.delete(t.image) : (p = R.value) != null && p.rewardImage && (t.image = await K.update(
454
+ t.image || K.collectibleImagePath(
455
+ void 0,
456
+ R.value.rewardImage
457
+ ),
458
+ (_ = R.value) == null ? void 0 : _.rewardImage
459
+ )), t._id ? await G.updateReward(t._id, {
460
+ ...t,
461
+ updateCollection: o
462
+ }) : await G.createReward(t), await u.readRewards(), (x = R.value) == null || x.showSheet(!1);
463
+ },
464
+ {
465
+ message: "Updating reward",
466
+ successMessage: "Reward updated successfully"
467
+ }
468
+ );
469
+ }
470
+ return z(async () => {
471
+ await g(async () => {
472
+ await u.readMembership(), await u.readRewards();
473
+ });
474
+ }), (t, o) => {
475
+ const m = F("FmPageHead"), p = F("FmSearch"), _ = F("FmTable"), x = F("FmButton"), r = F("FmCard");
476
+ return y(), D(W, null, [
477
+ c(m, {
478
+ title: e(i)("connect.storeRewards.title"),
479
+ description: e(i)("connect.storeRewards.description"),
480
+ actions: [U],
481
+ "back-button": !0,
482
+ "onClick:action": o[0] || (o[0] = () => a()),
483
+ "onClick:back": o[1] || (o[1] = () => e(S).push({ name: e(L)["$connect-STORE"] }))
484
+ }, null, 8, ["title", "description", "actions"]),
485
+ s("div", Oe, [
486
+ e(b) && e(b).length > 0 ? (y(), D(W, { key: 0 }, [
487
+ s("div", Te, [
488
+ o[6] || (o[6] = s("div", { class: "flex gap-8" }, null, -1)),
489
+ c(p, {
490
+ modelValue: e(O).searchKey,
491
+ "onUpdate:modelValue": o[2] || (o[2] = (f) => e(O).searchKey = f),
492
+ class: "",
493
+ placeholder: "search",
494
+ collapsible: ""
495
+ }, null, 8, ["modelValue"])
496
+ ]),
497
+ c(_, {
498
+ "row-data": e(b),
499
+ "column-defs": v,
500
+ "search-value": e(O).searchKey,
501
+ "column-filter": e(O).columnFilters,
502
+ onRowClick: o[3] || (o[3] = (f) => a(f.original._id)),
503
+ "hide-footer": e(b).length < 10
504
+ }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
505
+ ], 64)) : (y(), E(r, {
506
+ key: 1,
507
+ variant: "outlined",
508
+ class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
509
+ }, {
510
+ default: V(() => [
511
+ o[7] || (o[7] = s("img", {
512
+ src: oe,
513
+ class: "aspect-square w-[150px]"
514
+ }, null, -1)),
515
+ s("div", ke, [
516
+ s("div", Ue, H(e(i)("connect.storeRewards.empty.title")), 1),
517
+ s("div", Ae, H(e(i)("connect.storeRewards.empty.description")), 1)
518
+ ]),
519
+ c(x, {
520
+ variant: "primary",
521
+ label: e(i)("connect.storeRewards.empty.action"),
522
+ onClick: o[4] || (o[4] = (f) => a()),
523
+ icon: "add"
524
+ }, null, 8, ["label"])
525
+ ]),
526
+ _: 1
527
+ })),
528
+ c(Ce, {
529
+ ref_key: "rewardSheetRef",
530
+ ref: R,
531
+ onUpdate: o[5] || (o[5] = (f) => T(f))
532
+ }, null, 512)
533
+ ])
534
+ ], 64);
535
+ };
536
+ }
537
+ });
538
+ export {
539
+ ot as default
540
+ };