@feedmepos/mf-connect 0.1.98-beta.4 → 0.1.98-beta.40

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 (135) hide show
  1. package/package.json +3 -3
  2. package/dist/App-BGv_JihW.js +0 -4642
  3. package/dist/AuditLogs-53rnjCmD.js +0 -2013
  4. package/dist/Bin-B0Q_WpuY.js +0 -166
  5. package/dist/Broadcast-PiJE1Syl.js +0 -266
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Dz2KsBZl.js +0 -120
  7. package/dist/Card-DlqMu3Sl.js +0 -910
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  9. package/dist/Collections-BWcBlDDR.js +0 -540
  10. package/dist/Credit-CMfcuj5n.js +0 -260
  11. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  12. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  13. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DCvH0lGA.js +0 -3377
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-B_FyeWq4.js +0 -351
  15. package/dist/Experience-DacFmPYy.js +0 -259
  16. package/dist/FileSaver.min-CMZKiGkX.js +0 -74
  17. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  18. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
  19. package/dist/Game-DXKnGuhR.js +0 -330
  20. package/dist/Grab-DaBL5y3H.js +0 -300
  21. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BaY_nQio.js +0 -145
  22. package/dist/Index-2UrjF35w.js +0 -259
  23. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  24. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-BuVBZsCN.js +0 -48
  25. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-6wUxYqWe.js +0 -18737
  26. package/dist/LoyaltyDashboard-DIArPp71.js +0 -1082
  27. package/dist/MainLayout-BjvTxTPG.js +0 -41
  28. package/dist/Marketing-DEp--hFd.js +0 -235
  29. package/dist/MarketingMaterialEdit-BHL8Ptsu.js +0 -1035
  30. package/dist/Member-BU1YxoEV.js +0 -280
  31. package/dist/MemberList-zjvJBYf0.js +0 -1601
  32. package/dist/MemberOverview-wL_ailso.js +0 -58
  33. package/dist/MemberTransactions-BvyLV69V.js +0 -45
  34. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-_YOM1SlS.js +0 -60802
  35. package/dist/Mission-BNYk_aPM.js +0 -334
  36. package/dist/Overview-BToUlbsH.js +0 -1079
  37. package/dist/Point-B-L2326L.js +0 -262
  38. package/dist/Promotion-sMKGkL4w.js +0 -397
  39. package/dist/Queue-D3vUkKN9.js +0 -260
  40. package/dist/Record-BViEbZZ8.js +0 -342
  41. package/dist/Review-CMBAk-Qu.js +0 -1067
  42. package/dist/ReviewFacebookCallback-BCJTFy3b.js +0 -243
  43. package/dist/ReviewGoogleCallback-DKUG075r.js +0 -208
  44. package/dist/Reward-CZsvsYW_.js +0 -442
  45. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BASPLoRa.js +0 -149
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-B90meAnV.js +0 -1911
  47. package/dist/Segment-CN8NEg8w.js +0 -1014
  48. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-BGyYQST4.js +0 -181
  49. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BxW-Kc6t.js +0 -188
  50. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-C9dwcEr5.js +0 -226
  51. package/dist/Setting-DLPbZW11.js +0 -2047
  52. package/dist/SettingAdvertisements-BIq8gS5g.js +0 -264
  53. package/dist/Store-DNB3gUIR.js +0 -1996
  54. package/dist/StoreRewards-BoEjVFk6.js +0 -540
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Bv9ABH1K.js +0 -1130
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DNHgSfIg.js +0 -7007
  57. package/dist/Tier-kQ6X9h-t.js +0 -969
  58. package/dist/Title-XosVAF2Y.js +0 -566
  59. package/dist/Transaction-CO6oLPKR.js +0 -39
  60. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-McMR2Y7Y.js +0 -130
  61. package/dist/Voucher-CogaCxx2.js +0 -421
  62. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DjHwHFBq.js +0 -421
  63. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-Dor9klZ8.js +0 -56
  64. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  65. package/dist/app-C9UPXbDs.js +0 -59737
  66. package/dist/app-wDQR6dpb.js +0 -39
  67. package/dist/app.js +0 -7
  68. package/dist/business-CYpW6-Ls.js +0 -82
  69. package/dist/campaign-BtLa7KeF.js +0 -277
  70. package/dist/campaign-CpzFl8Vr.js +0 -4
  71. package/dist/campaign-CtoHyXVT.js +0 -219
  72. package/dist/campaign.enum-DiLhS5il.js +0 -26
  73. package/dist/campaign.fn-CLB9gBHo.js +0 -776
  74. package/dist/collectible.enum-CmwWcfBh.js +0 -19
  75. package/dist/duplicateCampaign-DGhOBd5l.js +0 -51
  76. package/dist/effect-CY5Y6sxy.js +0 -89
  77. package/dist/email-addresses-BEnOHWj_.js +0 -705
  78. package/dist/export-BgYu7SCd.js +0 -97
  79. package/dist/feedme.ico +0 -0
  80. package/dist/helper-DTDgoyEh.js +0 -86
  81. package/dist/index-B4IAURA_.js +0 -3684
  82. package/dist/index-BZVhi3ZG.js +0 -28900
  83. package/dist/index-C8ehLvXG.js +0 -31
  84. package/dist/index-CDk0Itu1.js +0 -32
  85. package/dist/index-CLZnH782.js +0 -54
  86. package/dist/index-CNKP1_IW.js +0 -30289
  87. package/dist/index-CP-7qATP.js +0 -67
  88. package/dist/index-Ck3PeOQ5.js +0 -1157
  89. package/dist/index-CuvNtC_M.js +0 -61
  90. package/dist/index-DntoqWT_.js +0 -85
  91. package/dist/index-DtyWsBgg.js +0 -3
  92. package/dist/index-P8Qh2yIP.js +0 -52
  93. package/dist/index-goRooQn5.js +0 -2802
  94. package/dist/index-kS20rM5m.js +0 -8910
  95. package/dist/index-vh86FiIQ.js +0 -10
  96. package/dist/index-zF0gIg9H.js +0 -151
  97. package/dist/index.esm2017-C79fd6cz.js +0 -3069
  98. package/dist/loading-Dfr_97Ri.js +0 -72
  99. package/dist/lodash-BX2mJOxF.js +0 -3678
  100. package/dist/membership-ncNOUJwj.js +0 -255
  101. package/dist/moment-D7p2TMB-.js +0 -2583
  102. package/dist/money-vEtTzt04.js +0 -15
  103. package/dist/number-BjgTlMsp.js +0 -12
  104. package/dist/object-BYyQ0PZp.js +0 -18
  105. package/dist/objectId-dwaoBfJX.js +0 -7
  106. package/dist/objectid-C9DiLwge.js +0 -145
  107. package/dist/plugins-BVGqEmE1.js +0 -1788
  108. package/dist/reward-BGTLhhzT.js +0 -36
  109. package/dist/rule-BB2VX3Gy.js +0 -1969
  110. package/dist/string-Gcy5IM_H.js +0 -32
  111. package/dist/style.css +0 -4
  112. package/dist/template-DLiHnpjK.js +0 -188
  113. package/dist/tier-BJDhpH6X.js +0 -4
  114. package/dist/tiers/tier=1.png +0 -0
  115. package/dist/tiers/tier=2.png +0 -0
  116. package/dist/tiers/tier=3.png +0 -0
  117. package/dist/tiers/tier=4.png +0 -0
  118. package/dist/titles/type=diamond.png +0 -0
  119. package/dist/titles/type=drinks.png +0 -0
  120. package/dist/titles/type=food.png +0 -0
  121. package/dist/titles/type=heart.png +0 -0
  122. package/dist/titles/type=medal.png +0 -0
  123. package/dist/titles/type=spend.png +0 -0
  124. package/dist/titles/type=thank-you.png +0 -0
  125. package/dist/titles/type=thumbs-up.png +0 -0
  126. package/dist/titles/type=years.png +0 -0
  127. package/dist/trigger-DrKnfSoi.js +0 -213
  128. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  129. package/dist/type_drinks-D6jnpvwV.js +0 -4
  130. package/dist/useMarketingMaterialActions-B6zaDbNE.js +0 -107
  131. package/dist/usePagination-Dgd-onzU.js +0 -220
  132. package/dist/user-BcDUmNrZ.js +0 -55
  133. package/dist/vue-i18n-DNBGmwox.js +0 -2365
  134. package/dist/xlsx-BX-U0_Au.js +0 -15491
  135. package/dist/zod-Mx51GBPY.js +0 -91
@@ -1,540 +0,0 @@
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-DtyWsBgg.js";
5
- import { u as ae } from "./loading-Dfr_97Ri.js";
6
- import { C as Q, u as ne } from "./membership-ncNOUJwj.js";
7
- import { p as B, f as K } from "./plugins-BVGqEmE1.js";
8
- import { useCoreStore as X } from "@feedmepos/mf-common";
9
- import { u as se } from "./vue-i18n-DNBGmwox.js";
10
- import { F as ie } from "./index-kS20rM5m.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-CYpW6-Ls.js";
14
- import { Z as h } from "./zod-Mx51GBPY.js";
15
- import { _ as de } from "./ZodTextField.vue_vue_type_script_setup_true_lang-Dor9klZ8.js";
16
- import { _ as ce } from "./ImageInput.vue_vue_type_script_setup_true_lang-BaY_nQio.js";
17
- import { _ as me } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-DNHgSfIg.js";
18
- import { _ as pe, a as ue } from "./EffectSheet.vue_vue_type_style_index_0_lang-B_FyeWq4.js";
19
- import { i as fe, F as ye, h as j, t as we } from "./helper-DTDgoyEh.js";
20
- import { useRouter as ge } from "vue-router";
21
- import { m as G } from "./index-zF0gIg9H.js";
22
- import { R as L } from "./app-C9UPXbDs.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
- };