@feedmepos/mf-connect 0.1.98-beta.39 → 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 (151) hide show
  1. package/package.json +1 -1
  2. package/dist/App-DwjQisFZ.js +0 -4785
  3. package/dist/AuditLogs-DMGqmriL.js +0 -2014
  4. package/dist/Bin-4wvIqogM.js +0 -166
  5. package/dist/Broadcast-DPpuSZ8_.js +0 -269
  6. package/dist/CampaignAnalytic-CXFDo2X_.js +0 -1826
  7. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-SLoy1-Kd.js +0 -122
  8. package/dist/Card-C8SA6un0.js +0 -911
  9. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  10. package/dist/Collections-BCpSiM_4.js +0 -541
  11. package/dist/Credit-C8RTBpP7.js +0 -286
  12. package/dist/CustomSelect.vue_vue_type_script_setup_true_lang-Du7fRSZC.js +0 -128
  13. package/dist/DateRangeChip.vue_vue_type_script_setup_true_lang-eIoPtgO5.js +0 -58
  14. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-0OI5QzpR.js +0 -3382
  15. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CJTduNh3.js +0 -351
  16. package/dist/Experience-Bg3kFQQE.js +0 -285
  17. package/dist/FileSaver.min-DMUuMi9w.js +0 -74
  18. package/dist/FilterChip.vue_vue_type_script_setup_true_lang-DaU-9GzO.js +0 -129
  19. package/dist/FmTableSelection.vue_vue_type_script_setup_true_lang-DzcUc0_w.js +0 -52
  20. package/dist/Game-D3DbkRUj.js +0 -356
  21. package/dist/GiftCardSetup-CxlMM4up.js +0 -542
  22. package/dist/Grab-DvEK8ixP.js +0 -301
  23. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBK-UrEe.js +0 -145
  24. package/dist/Index-Do_9DXuY.js +0 -259
  25. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  26. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-BKPGBYiU.js +0 -48
  27. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-D6wJN9Gj.js +0 -18737
  28. package/dist/LoyaltyDashboard-B4WqycGN.js +0 -1345
  29. package/dist/MainLayout-DdxLaufS.js +0 -143
  30. package/dist/Marketing-CcFEMwKB.js +0 -236
  31. package/dist/MarketingMaterialEdit-DoYFaMf7.js +0 -1036
  32. package/dist/Member-BussgBln.js +0 -281
  33. package/dist/MemberList-BXJxSsjo.js +0 -1603
  34. package/dist/MemberOverview-wL_ailso.js +0 -58
  35. package/dist/MemberTransactions-O-XY5nz3.js +0 -45
  36. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-DsxrIO0r.js +0 -60957
  37. package/dist/MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Bg_0YlwG.js +0 -38
  38. package/dist/Mission-CPkM-8Ns.js +0 -360
  39. package/dist/Overview-BJjpYUJN.js +0 -1080
  40. package/dist/Overview-C5KF_Jxj.js +0 -1316
  41. package/dist/Point-FDFwR3Hk.js +0 -288
  42. package/dist/Promotion-qtucKxn0.js +0 -423
  43. package/dist/Queue-d91tocPX.js +0 -261
  44. package/dist/Record-CvkK2iLq.js +0 -342
  45. package/dist/Review-C_zLGtzU.js +0 -45
  46. package/dist/ReviewFacebookCallback-Bidg3P76.js +0 -238
  47. package/dist/ReviewGoogleCallback-DL0lxMBL.js +0 -213
  48. package/dist/Reward-BTsQaI-J.js +0 -442
  49. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-BjxA4eMX.js +0 -150
  50. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-D4NIDc-C.js +0 -1913
  51. package/dist/Segment-BgFyB3BK.js +0 -1017
  52. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-CkhjFNvZ.js +0 -181
  53. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-HYbRyACe.js +0 -189
  54. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-7dv3cAW3.js +0 -226
  55. package/dist/Setting-BxHoCSxw.js +0 -2047
  56. package/dist/SettingAdvertisements-WfvuE4fA.js +0 -264
  57. package/dist/Settings-B42SAvEx.js +0 -179
  58. package/dist/Store-BnvWfCy-.js +0 -2413
  59. package/dist/StoreRewards-BRzAMqR-.js +0 -540
  60. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-C3FJr1L5.js +0 -1075
  61. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-UZYzUcif.js +0 -7007
  62. package/dist/Tier-BrzLNat2.js +0 -972
  63. package/dist/Title-EnlaNXld.js +0 -569
  64. package/dist/Transaction-BiXNxUGX.js +0 -39
  65. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-Db5_DKQ0.js +0 -130
  66. package/dist/Voucher-C2dyk-jj.js +0 -444
  67. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-DPE24a-J.js +0 -421
  68. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js +0 -56
  69. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  70. package/dist/app-Bt8HrAEr.js +0 -60740
  71. package/dist/app-wDQR6dpb.js +0 -39
  72. package/dist/app.js +0 -7
  73. package/dist/business-BwtQpfUr.js +0 -82
  74. package/dist/campaign-B6U9lwKi.js +0 -255
  75. package/dist/campaign-C6Cb9s3C.js +0 -100
  76. package/dist/campaign-CpzFl8Vr.js +0 -4
  77. package/dist/campaign.enum-Dx-Zo68Q.js +0 -26
  78. package/dist/campaign.fn-B0x2EGhw.js +0 -776
  79. package/dist/collectible.enum-Liy2wH3s.js +0 -19
  80. package/dist/collection.fn-DfoA9sJV.js +0 -26
  81. package/dist/duplicateCampaign-Cnq5N-V8.js +0 -51
  82. package/dist/effect-B2REbrv8.js +0 -89
  83. package/dist/email-addresses-BzmOsxLn.js +0 -705
  84. package/dist/export-jHpRhPQu.js +0 -97
  85. package/dist/feedme.ico +0 -0
  86. package/dist/google-C3S8u0mT.js +0 -4
  87. package/dist/helper-DQAHX1kX.js +0 -86
  88. package/dist/index-4GG-yjdN.js +0 -2963
  89. package/dist/index-BWgMbKOB.js +0 -85
  90. package/dist/index-BccUpf0U.js +0 -3
  91. package/dist/index-BkgkJkVs.js +0 -8919
  92. package/dist/index-C0PKVTf9.js +0 -32
  93. package/dist/index-C8cXXcLk.js +0 -45
  94. package/dist/index-CTTGf4TM.js +0 -151
  95. package/dist/index-C_H8jFYf.js +0 -2743
  96. package/dist/index-CuvNtC_M.js +0 -61
  97. package/dist/index-DJN4auwx.js +0 -146
  98. package/dist/index-DMr9ohGV.js +0 -1139
  99. package/dist/index-DQTo_ytu.js +0 -31
  100. package/dist/index-DW7-0rf_.js +0 -53
  101. package/dist/index-Da7J83jM.js +0 -2706
  102. package/dist/index-Di1Z4vLS.js +0 -27550
  103. package/dist/index-FoKZGh7Z.js +0 -67
  104. package/dist/index-N25Px7RQ.js +0 -72
  105. package/dist/index-PgblELTo.js +0 -897
  106. package/dist/index-STBMTK1u.js +0 -28900
  107. package/dist/index-hP3Mgc0u.js +0 -55
  108. package/dist/index-vh86FiIQ.js +0 -10
  109. package/dist/index.esm2017-DV56jzfJ.js +0 -3069
  110. package/dist/loading-D__sDcq1.js +0 -72
  111. package/dist/lodash-DgkDIHoV.js +0 -3678
  112. package/dist/membership-CBjt1MGx.js +0 -255
  113. package/dist/moment-D7p2TMB-.js +0 -2583
  114. package/dist/money-BFUbPKDM.js +0 -15
  115. package/dist/number-CJb8OUa3.js +0 -12
  116. package/dist/object-BYyQ0PZp.js +0 -18
  117. package/dist/objectId-dwaoBfJX.js +0 -7
  118. package/dist/objectid-BMUFNR9T.js +0 -145
  119. package/dist/plugins-D95ZeD-9.js +0 -1788
  120. package/dist/remy-Qz_pNsUS.js +0 -13
  121. package/dist/reward-CSfV_XFK.js +0 -36
  122. package/dist/rule-DIzVHy2z.js +0 -1969
  123. package/dist/rule-builder-DF7fCvec.js +0 -126
  124. package/dist/string-Gcy5IM_H.js +0 -32
  125. package/dist/style.css +0 -4
  126. package/dist/template-r3lAQP1B.js +0 -188
  127. package/dist/tier-BJDhpH6X.js +0 -4
  128. package/dist/tiers/tier=1.png +0 -0
  129. package/dist/tiers/tier=2.png +0 -0
  130. package/dist/tiers/tier=3.png +0 -0
  131. package/dist/tiers/tier=4.png +0 -0
  132. package/dist/timezone-D40qRUoz.js +0 -20
  133. package/dist/titles/type=diamond.png +0 -0
  134. package/dist/titles/type=drinks.png +0 -0
  135. package/dist/titles/type=food.png +0 -0
  136. package/dist/titles/type=heart.png +0 -0
  137. package/dist/titles/type=medal.png +0 -0
  138. package/dist/titles/type=spend.png +0 -0
  139. package/dist/titles/type=thank-you.png +0 -0
  140. package/dist/titles/type=thumbs-up.png +0 -0
  141. package/dist/titles/type=years.png +0 -0
  142. package/dist/transaction.fn-DV-cpfOj.js +0 -64
  143. package/dist/trigger-BEJaSv5R.js +0 -213
  144. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  145. package/dist/type_drinks-D6jnpvwV.js +0 -4
  146. package/dist/useMarketingMaterialActions-Bd5BDfE1.js +0 -96
  147. package/dist/usePagination-DLIo76-X.js +0 -220
  148. package/dist/user-DtEjuhyM.js +0 -55
  149. package/dist/vue-i18n-dQ1XCaUv.js +0 -2365
  150. package/dist/xlsx-BUMZsTov.js +0 -15491
  151. package/dist/zod-B_pVZhsV.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-BccUpf0U.js";
5
- import { u as ae } from "./loading-D__sDcq1.js";
6
- import { C as Q, u as ne } from "./membership-CBjt1MGx.js";
7
- import { p as B, f as K } from "./plugins-D95ZeD-9.js";
8
- import { useCoreStore as X } from "@feedmepos/mf-common";
9
- import { u as se } from "./vue-i18n-dQ1XCaUv.js";
10
- import { F as ie } from "./index-BkgkJkVs.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-BwtQpfUr.js";
14
- import { Z as h } from "./zod-B_pVZhsV.js";
15
- import { _ as de } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js";
16
- import { _ as ce } from "./ImageInput.vue_vue_type_script_setup_true_lang-BBK-UrEe.js";
17
- import { _ as me } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-UZYzUcif.js";
18
- import { _ as pe, a as ue } from "./EffectSheet.vue_vue_type_style_index_0_lang-CJTduNh3.js";
19
- import { i as fe, F as ye, h as j, t as we } from "./helper-DQAHX1kX.js";
20
- import { useRouter as ge } from "vue-router";
21
- import { m as G } from "./index-CTTGf4TM.js";
22
- import { R as L } from "./app-Bt8HrAEr.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
- };