@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,213 +0,0 @@
1
- import { defineComponent as E, onMounted as T, ref as w, computed as B, openBlock as d, createElementBlock as p, Fragment as F, renderList as j, normalizeClass as z, unref as e, createElementVNode as m, createVNode as u, toDisplayString as y, createCommentVNode as S, createBlock as P, resolveComponent as U, isRef as V } from "vue";
2
- import { u as A } from "./vue-i18n-dQ1XCaUv.js";
3
- import { components as v } from "@feedmepos/ui-library";
4
- import { r as C } from "./index-N25Px7RQ.js";
5
- import { u as H } from "./business-BwtQpfUr.js";
6
- import { _ as D } from "./LocationPicker.vue_vue_type_script_setup_true_lang-BKPGBYiU.js";
7
- import { R as O } from "./app-Bt8HrAEr.js";
8
- import { useRouter as W } from "vue-router";
9
- const q = { class: "flex flex-col gap-8" }, J = ["onClick"], K = { class: "fm-typo-en-body-md-600 flex-1 truncate" }, Q = {
10
- key: 0,
11
- class: "fm-typo-en-body-sm-400 text-fm-color-primary-500 shrink-0"
12
- }, X = /* @__PURE__ */ E({
13
- __name: "GoogleLocationMapping",
14
- props: {
15
- locations: {}
16
- },
17
- emits: ["update:locations"],
18
- setup(k, { emit: a }) {
19
- const N = k, b = a, i = H();
20
- T(() => i.readLocations());
21
- const g = w(null), h = B(() => {
22
- const l = /* @__PURE__ */ new Set();
23
- for (const r of N.locations)
24
- r.locationId && l.add(r.locationId);
25
- return l;
26
- });
27
- function L(l) {
28
- return i.locations.filter((r) => {
29
- const t = r._id.toString();
30
- return !h.value.has(t) || l.locationId === t;
31
- });
32
- }
33
- function f(l, r) {
34
- const t = r._id.toString(), _ = N.locations.map((n) => {
35
- if (n.googleLocationName !== l) return n;
36
- const o = n.locationId === t;
37
- return {
38
- ...n,
39
- locationId: o ? null : t,
40
- locationName: o ? null : r.name
41
- };
42
- });
43
- b("update:locations", _);
44
- }
45
- function I(l) {
46
- g.value = g.value === l ? null : l;
47
- }
48
- return (l, r) => (d(), p("div", q, [
49
- (d(!0), p(F, null, j(k.locations, (t) => (d(), p("div", {
50
- key: t.googleLocationName,
51
- class: z([
52
- "rounded-lg border overflow-hidden transition-colors",
53
- e(g) === t.googleLocationName ? "border-fm-color-primary-500" : "border-fm-color-neutral-gray-200"
54
- ])
55
- }, [
56
- m("button", {
57
- class: "w-full flex items-center gap-12 p-16 bg-white text-left hover:bg-fm-color-neutral-gray-50 transition-colors",
58
- onClick: (_) => I(t.googleLocationName)
59
- }, [
60
- u(e(v).FmIcon, {
61
- name: "storefront",
62
- class: "text-fm-color-neutral-gray-400 shrink-0"
63
- }),
64
- m("span", K, y(t.displayName || t.googleLocationName), 1),
65
- t.locationName ? (d(), p("span", Q, y(t.locationName), 1)) : S("", !0),
66
- u(e(v).FmIcon, {
67
- name: e(g) === t.googleLocationName ? "expand_less" : "expand_more",
68
- class: "text-fm-color-neutral-gray-400 shrink-0"
69
- }, null, 8, ["name"])
70
- ], 8, J),
71
- e(g) === t.googleLocationName ? (d(), P(D, {
72
- key: 0,
73
- locations: L(t),
74
- "selected-ids": t.locationId ? [t.locationId] : [],
75
- onToggle: (_) => f(t.googleLocationName, _)
76
- }, null, 8, ["locations", "selected-ids", "onToggle"])) : S("", !0)
77
- ], 2))), 128))
78
- ]));
79
- }
80
- }), Y = { class: "flex flex-col min-h-full gap-16 p-24" }, Z = {
81
- key: 0,
82
- class: "flex flex-col items-center justify-center flex-1 gap-16"
83
- }, ee = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, oe = {
84
- key: 1,
85
- class: "flex flex-col items-center justify-center flex-1 gap-16"
86
- }, te = { class: "fm-typo-en-body-lg-600" }, ne = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ae = {
87
- key: 2,
88
- class: "flex flex-col items-center justify-center flex-1 gap-16"
89
- }, le = { class: "fm-typo-en-body-lg-600" }, se = { class: "fm-typo-en-body-md-400 text-fm-color-neutral-gray-400" }, ce = { class: "fm-typo-en-body-lg-600" }, ie = { class: "flex gap-8 justify-end mt-auto pt-8" }, ve = /* @__PURE__ */ E({
90
- __name: "ReviewGoogleCallback",
91
- setup(k) {
92
- const { t: a } = A(), N = W();
93
- function b() {
94
- return N.replace({ name: O["$connect-REVIEW_SETTINGS"] });
95
- }
96
- const i = w([]), g = w(!1), h = w(!1), L = w(!1), f = w(null), I = B(
97
- () => i.value.some((n) => n.locationId !== null)
98
- );
99
- function l(n, o) {
100
- return n instanceof Error ? n.message : o;
101
- }
102
- function r(n, o) {
103
- const x = new Map(
104
- o.map((s) => [s.googleLocationName, s.location])
105
- );
106
- return n.map((s) => {
107
- const c = x.get(s.googleLocationName) ?? null;
108
- return {
109
- googleLocationName: s.googleLocationName,
110
- displayName: s.displayName,
111
- locationId: (c == null ? void 0 : c._id) ?? null,
112
- locationName: (c == null ? void 0 : c.name) ?? null
113
- };
114
- });
115
- }
116
- async function t() {
117
- var s;
118
- const n = new URLSearchParams(window.location.search), o = n.get("code"), x = n.get("state");
119
- if (!o || !x) {
120
- f.value = a("connect.review.noToken");
121
- return;
122
- }
123
- g.value = !0;
124
- try {
125
- const c = await C.getSource(), R = ((s = c == null ? void 0 : c.google) == null ? void 0 : s.locations) ?? [], M = window.location.pathname.replace(/\/review(?:\/.*)?$/, ""), G = `${window.location.origin}${M}/review/google/callback`, $ = await C.connectGoogle(o, G, x);
126
- i.value = r(($ == null ? void 0 : $.locations) ?? [], R), i.value.length === 0 && (f.value = a("connect.review.google.noLocations"));
127
- } catch (c) {
128
- f.value = l(c, a("connect.review.google.failed"));
129
- } finally {
130
- g.value = !1;
131
- }
132
- }
133
- async function _() {
134
- const n = i.value.map((o) => ({
135
- googleLocationName: o.googleLocationName,
136
- displayName: o.displayName,
137
- locationId: o.locationId
138
- }));
139
- if (n.length === 0) {
140
- f.value = a("connect.review.noMappings");
141
- return;
142
- }
143
- h.value = !0;
144
- try {
145
- await C.updateGoogleLocations(n), L.value = !0, setTimeout(b, 2e3);
146
- } catch (o) {
147
- f.value = l(o, a("connect.review.google.failed"));
148
- } finally {
149
- h.value = !1;
150
- }
151
- }
152
- return T(t), (n, o) => {
153
- const x = U("FmPageHead");
154
- return d(), p(F, null, [
155
- u(x, {
156
- title: e(a)("connect.navigation.review")
157
- }, null, 8, ["title"]),
158
- m("div", Y, [
159
- e(g) ? (d(), p("div", Z, [
160
- u(e(v).FmIcon, {
161
- name: "sync",
162
- size: "xl",
163
- class: "animate-spin text-fm-color-neutral-gray-400"
164
- }),
165
- m("p", ee, y(e(a)("connect.review.google.fetching")), 1)
166
- ])) : e(L) ? (d(), p("div", oe, [
167
- u(e(v).FmIcon, {
168
- name: "check_circle",
169
- size: "xl",
170
- class: "text-fm-color-typo-success"
171
- }),
172
- m("p", te, y(e(a)("connect.review.google.success")), 1),
173
- m("p", ne, y(e(a)("connect.review.redirecting")), 1)
174
- ])) : e(f) ? (d(), p("div", ae, [
175
- u(e(v).FmIcon, {
176
- name: "error",
177
- size: "xl",
178
- class: "text-fm-color-system-error-500"
179
- }),
180
- m("p", le, y(e(a)("connect.review.errorTitle")), 1),
181
- m("p", se, y(e(f)), 1),
182
- u(e(v).FmButton, {
183
- label: e(a)("connect.review.goBack"),
184
- onClick: o[0] || (o[0] = (s) => b())
185
- }, null, 8, ["label"])
186
- ])) : e(i).length > 0 ? (d(), p(F, { key: 3 }, [
187
- m("p", ce, y(e(a)("connect.review.google.selectLocation")), 1),
188
- u(X, {
189
- locations: e(i),
190
- "onUpdate:locations": o[1] || (o[1] = (s) => V(i) ? i.value = s : null)
191
- }, null, 8, ["locations"]),
192
- m("div", ie, [
193
- u(e(v).FmButton, {
194
- variant: "outlined",
195
- label: e(a)("connect.review.cancel"),
196
- onClick: o[2] || (o[2] = (s) => b())
197
- }, null, 8, ["label"]),
198
- u(e(v).FmButton, {
199
- label: e(a)("connect.review.connect"),
200
- disabled: !e(I),
201
- loading: e(h),
202
- onClick: _
203
- }, null, 8, ["label", "disabled", "loading"])
204
- ])
205
- ], 64)) : S("", !0)
206
- ])
207
- ], 64);
208
- };
209
- }
210
- });
211
- export {
212
- ve as default
213
- };
@@ -1,442 +0,0 @@
1
- import { defineComponent as X, ref as x, computed as H, resolveComponent as w, openBlock as b, createBlock as h, unref as t, isRef as Z, withCtx as A, createElementVNode as f, createVNode as d, createCommentVNode as k, createElementBlock as M, Fragment as Y, h as _, onMounted as q, toDisplayString as B } from "vue";
2
- import { _ as z } from "./campaign-CpzFl8Vr.js";
3
- import { useDialog as Q, components as L } from "@feedmepos/ui-library";
4
- import { u as G } from "./loading-D__sDcq1.js";
5
- import { u as J, C as ee } from "./membership-CBjt1MGx.js";
6
- import { f as j, p as te } from "./plugins-D95ZeD-9.js";
7
- import { u as oe } from "./vue-i18n-dQ1XCaUv.js";
8
- import { c as ae } from "./object-BYyQ0PZp.js";
9
- import { Z as F } from "./zod-B_pVZhsV.js";
10
- import "./index-BkgkJkVs.js";
11
- import { a as N } from "./index-hP3Mgc0u.js";
12
- import { useCoreStore as le } from "@feedmepos/mf-common";
13
- import { _ as ne, a as ie } from "./VoucherEditor.vue_vue_type_script_setup_true_lang-DPE24a-J.js";
14
- import { b as re } from "./EffectSheet.vue_vue_type_style_index_0_lang-CJTduNh3.js";
15
- import { J as K } from "./JsonViewer-v8_C7l5N.js";
16
- import { _ as se } from "./ZodTextField.vue_vue_type_script_setup_true_lang-CI1HM9HA.js";
17
- import { i as de } from "./helper-DQAHX1kX.js";
18
- import { u as pe, r as P } from "./reward-CSfV_XFK.js";
19
- import "./index-BccUpf0U.js";
20
- import { C as ce } from "./campaign.fn-B0x2EGhw.js";
21
- import { e as me } from "./effect-B2REbrv8.js";
22
- import { useRouter as ue } from "vue-router";
23
- import { R as ye } from "./app-Bt8HrAEr.js";
24
- const fe = { class: "flex gap-8 items-center justify-start" }, we = /* @__PURE__ */ X({
25
- __name: "EditRewardSheet",
26
- emits: ["update"],
27
- setup(W, { expose: n, emit: I }) {
28
- const p = J(), { minor: C } = G, v = x(!1), a = x({}), y = x(), R = H(() => {
29
- var l;
30
- return ((l = a.value.option) == null ? void 0 : l.collectibleType) === "CREDIT" ? N.superRefine((e, o) => {
31
- var i, m, g, r;
32
- !((m = (i = e.option) == null ? void 0 : i.validityOption) != null && m.validForDay) && !((r = (g = e.option) == null ? void 0 : g.validityOption) != null && r.validBefore) && o.addIssue({
33
- code: "custom",
34
- path: [],
35
- message: "Credit validity must be set"
36
- });
37
- }) : N;
38
- }), u = H(() => {
39
- const l = R.value.safeParse(a.value);
40
- return l.success ? [] : l.error.errors;
41
- });
42
- function O(l, e) {
43
- l && (y.value = void 0, a.value = e), v.value = l;
44
- }
45
- const D = I;
46
- async function S() {
47
- const l = R.value.safeParse(a.value);
48
- !l.success || !l.data || (await C(
49
- async () => {
50
- var e;
51
- l.data.option.type === "VOUCHER" && y.value && (l.data.option.collectibleConfig.image = await j.update(
52
- ((e = l.data.option.collectibleConfig) == null ? void 0 : e.image) || j.collectibleImagePath(void 0, y.value),
53
- y.value
54
- ));
55
- },
56
- {
57
- message: "Uploading reward image",
58
- successMessage: "Reward image updated"
59
- }
60
- ), D("update", l.data));
61
- }
62
- function T(l) {
63
- l === "VOUCHER" ? a.value.option = {
64
- collectible: null,
65
- type: "VOUCHER",
66
- collectibleConfig: de("VOUCHER", {
67
- business: le().currentBusiness.value._id
68
- }),
69
- earningOption: {
70
- amount: 1,
71
- type: "FIXED"
72
- },
73
- validityOption: {
74
- validForDay: 7
75
- }
76
- } : a.value.option = {
77
- collectible: p.loyaltyRewards.raw[0]._id,
78
- collectibleType: p.loyaltyRewards.raw[0].type,
79
- type: "LOYALTY",
80
- earningOption: {
81
- amount: 1,
82
- type: "FIXED"
83
- },
84
- validityOption: {
85
- validForDay: 7
86
- }
87
- };
88
- }
89
- function $(l) {
90
- a.value.option.collectible = l, a.value.option.collectibleType = p.loyaltyRewards.raw.find(
91
- (e) => e._id === l
92
- ).type;
93
- }
94
- const V = x();
95
- return n({
96
- showSheet: O
97
- }), (l, e) => {
98
- const o = w("FmSelect"), i = w("FmForm"), m = w("FmButton"), g = w("FmSideSheet");
99
- return b(), h(g, {
100
- "max-width": 560,
101
- modelValue: t(v),
102
- "onUpdate:modelValue": [
103
- e[8] || (e[8] = (r) => Z(v) ? v.value = r : null),
104
- e[9] || (e[9] = (r) => v.value = r)
105
- ],
106
- header: "Edit reward"
107
- }, {
108
- "side-sheet-footer": A(() => [
109
- f("div", fe, [
110
- d(m, {
111
- variant: "primary",
112
- type: "button",
113
- label: "Confirm",
114
- disabled: t(u).length > 0,
115
- onClick: e[6] || (e[6] = (r) => S())
116
- }, null, 8, ["disabled"]),
117
- d(m, {
118
- variant: "secondary",
119
- type: "button",
120
- label: "Cancel",
121
- onClick: e[7] || (e[7] = (r) => v.value = !1)
122
- })
123
- ])
124
- ]),
125
- default: A(() => [
126
- d(K, { json: t(a) }, null, 8, ["json"]),
127
- d(i, {
128
- class: "flex flex-col gap-y-24",
129
- ref_key: "formRef",
130
- ref: V,
131
- onValidationSuccess: e[5] || (e[5] = (r) => S())
132
- }, {
133
- default: A(() => {
134
- var r, E, c;
135
- return [
136
- d(se, {
137
- modelValue: t(a).name,
138
- "onUpdate:modelValue": e[0] || (e[0] = (s) => t(a).name = s),
139
- label: "Reward Name",
140
- schema: t(F).typeAtPath(t(R), "name", []),
141
- "error-text": t(F).helperText(t(u), "name")
142
- }, null, 8, ["modelValue", "schema", "error-text"]),
143
- d(o, {
144
- label: "Reward Type",
145
- disabled: !!t(a)._id,
146
- items: [
147
- { label: "Voucher", value: "VOUCHER" },
148
- { label: "Loyalty", value: "LOYALTY" }
149
- ],
150
- "model-value": t(a).option.type,
151
- "onUpdate:modelValue": T
152
- }, null, 8, ["disabled", "model-value"]),
153
- t(a).option.type == "LOYALTY" ? (b(), h(o, {
154
- key: 0,
155
- label: "Loyalty type",
156
- items: t(p).loyaltyRewards.items,
157
- "model-value": t(a).option.collectible,
158
- "onUpdate:modelValue": $
159
- }, null, 8, ["items", "model-value"])) : k("", !0),
160
- t(a).option.type === "LOYALTY" ? (b(), M(Y, { key: 1 }, [
161
- e[10] || (e[10] = f("div", { class: "fm-typo-en-title-sm-800" }, "Earning option", -1)),
162
- ((r = t(p).loyaltyRewards.items.find(
163
- (s) => {
164
- var U;
165
- return s.value === ((U = t(a)) == null ? void 0 : U.option.collectible);
166
- }
167
- )) == null ? void 0 : r.raw.type) !== "TITLE" ? (b(), h(ne, {
168
- key: 0,
169
- class: "mt-[-8px]",
170
- rules: [
171
- t(F).ruleAtPath(t(R), "option.earningOption", [
172
- t(a).option.type
173
- ])
174
- ],
175
- "helper-state": t(F).helperState(t(u), "option.earningOption"),
176
- "error-text": t(F).helperText(t(u), "option.earningOption"),
177
- "fixed-type": !0,
178
- "model-value": t(a).option.earningOption,
179
- "onUpdate:modelValue": e[1] || (e[1] = (s) => t(a).option.earningOption = s)
180
- }, null, 8, ["rules", "helper-state", "error-text", "model-value"])) : k("", !0),
181
- d(re, {
182
- class: "!gap-24",
183
- "for-credit": t(a).option.type === "LOYALTY" && ((E = t(p).loyaltyRewards.items.find(
184
- (s) => {
185
- var U;
186
- return s.value === ((U = t(a).option) == null ? void 0 : U.collectible);
187
- }
188
- )) == null ? void 0 : E.raw.type) === "CREDIT",
189
- type: t(a).option.type === "VOUCHER" ? "range" : "custom",
190
- rules: [
191
- t(F).ruleAtPath(t(R), "option.validityOption", [
192
- t(a).option.type
193
- ])
194
- ],
195
- "model-value": t(a).option.validityOption,
196
- "onUpdate:modelValue": e[2] || (e[2] = (s) => t(a).option.validityOption = s)
197
- }, null, 8, ["for-credit", "type", "rules", "model-value"])
198
- ], 64)) : k("", !0),
199
- t(a).option.type === "VOUCHER" ? (b(), h(ie, {
200
- key: 2,
201
- "reward-image": t(y),
202
- "model-value": ((c = t(a)) == null ? void 0 : c.option.collectibleConfig) ?? void 0,
203
- "onUpdate:modelValue": e[3] || (e[3] = (s) => t(a).option.collectibleConfig = s),
204
- "onUpdate:rewardImage": e[4] || (e[4] = (s) => y.value = s)
205
- }, null, 8, ["reward-image", "model-value"])) : k("", !0),
206
- d(K, { json: t(u) }, null, 8, ["json"])
207
- ];
208
- }),
209
- _: 1
210
- }, 512)
211
- ]),
212
- _: 1
213
- }, 8, ["modelValue"]);
214
- };
215
- }
216
- }), ve = { class: "px-24 flex flex-col gap-y-16" }, ge = { class: "flex items-center justify-between w-full" }, be = { class: "flex flex-col gap-16 text-center" }, Re = { class: "fm-typo-en-title-sm-800" }, Ce = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Ke = /* @__PURE__ */ X({
217
- __name: "Reward",
218
- setup(W) {
219
- const { t: n } = oe(), I = {
220
- label: n("connect.storeRewards.create"),
221
- value: "create",
222
- isPrimary: !0,
223
- prependIcon: "add"
224
- }, p = J(), C = pe(), { global: v, minor: a } = G, y = ue(), R = Q(), u = x({
225
- searchKey: "",
226
- columnFilters: []
227
- }), O = H(() => C.rewards);
228
- function D(e) {
229
- y.push({
230
- name: ye["$connect-STORE_REWARD_COLLECTIONS"],
231
- params: { id: e }
232
- });
233
- }
234
- const S = [
235
- {
236
- header: n("connect.storeRewards.table.name"),
237
- accessorFn: (e) => e.name
238
- },
239
- {
240
- header: n("connect.storeRewards.table.type"),
241
- cell(e) {
242
- return e.row.original.collectibleConfig ? ee[e.row.original.collectibleConfig.type].chip() : "N/A";
243
- }
244
- },
245
- {
246
- header: n("connect.storeRewards.table.summary"),
247
- accessorFn: (e) => {
248
- var o, i;
249
- if (e.option.type === "VOUCHER")
250
- return me((i = (o = e.option.collectibleConfig) == null ? void 0 : o.extras) == null ? void 0 : i.effect);
251
- if (e.option.collectibleType == "TITLE") {
252
- const m = p.sortedTitles.find(
253
- (g) => g._id == e.option.collectible
254
- );
255
- return `Get ${m == null ? void 0 : m.name} valid for ${e.option.validityOption.validForDay} days`;
256
- }
257
- return `Get ${e.option.earningOption.amount} ${ce.formattedType(e.option.collectibleType)}`;
258
- }
259
- },
260
- {
261
- header: n("connect.storeRewards.table.actions"),
262
- cell(e) {
263
- return _("div", { class: "flex items-center justify-end gap-4" }, [
264
- _(
265
- L.FmMenu,
266
- {
267
- placement: "bottom-end",
268
- onClick: (o) => {
269
- o.stopPropagation();
270
- }
271
- },
272
- {
273
- "menu-button": () => _(L.FmButton, {
274
- icon: "more_vert",
275
- iconColor: "neutral-gray-400",
276
- variant: "tertiary"
277
- }),
278
- default: () => [
279
- e.row.original.option.type === "VOUCHER" && _(L.FmMenuItem, {
280
- label: "View collections",
281
- onClick: async (o) => {
282
- o.stopPropagation(), D(
283
- e.row.original.option.collectible
284
- );
285
- }
286
- }),
287
- _(
288
- L.FmMenuItem,
289
- {
290
- onClick: async (o) => {
291
- o.stopPropagation(), $(e.row.original);
292
- }
293
- },
294
- {
295
- label: _(
296
- "div",
297
- {
298
- class: "text-fm-color-typo-error fm-typo-en-body-md-400"
299
- },
300
- "Delete"
301
- )
302
- }
303
- )
304
- ]
305
- }
306
- )
307
- ]);
308
- }
309
- }
310
- ], T = x();
311
- async function $(e) {
312
- await te.remove(
313
- n("connect.storeRewards.delete.confirm"),
314
- n("connect.storeRewards.delete.title")
315
- ) && await a(
316
- async () => {
317
- await P.deleteReward(e._id), await C.readRewards();
318
- },
319
- {
320
- message: n("connect.storeRewards.delete.message"),
321
- successMessage: n("connect.storeRewards.delete.success")
322
- }
323
- );
324
- }
325
- async function V(e) {
326
- var o;
327
- e || (e = {
328
- name: "",
329
- option: {
330
- type: "LOYALTY",
331
- collectible: p.loyaltyRewards.items[0].value,
332
- collectibleType: p.loyaltyRewards.items[0].raw.type,
333
- validityOption: {
334
- validForDay: 7
335
- },
336
- earningOption: {
337
- type: "FIXED",
338
- amount: 1
339
- }
340
- }
341
- }), (o = T.value) == null || o.showSheet(!0, ae(e));
342
- }
343
- async function l(e) {
344
- let o = !1;
345
- e._id && e.option.type === "VOUCHER" && await new Promise((i) => {
346
- R.open({
347
- title: "Confirmation",
348
- message: "This will change all future vouchers? Would you like to update previous claimed vouchers expiry date and discount?",
349
- primaryActions: { text: "Update all", close: !0 },
350
- secondaryActions: { text: "Update future only", close: !0 }
351
- }).onPrimary(async () => {
352
- o = !0, i();
353
- }).onSecondary(async () => {
354
- i();
355
- });
356
- }), await a(
357
- async () => {
358
- var i;
359
- e.collectibleConfig = void 0, e._id ? await P.updateReward(e._id, {
360
- ...e,
361
- updateCollection: o
362
- }) : await P.createReward(e), await C.readRewards(), (i = T.value) == null || i.showSheet(!1);
363
- },
364
- {
365
- message: "Updating reward",
366
- successMessage: "Reward updated successfully"
367
- }
368
- );
369
- }
370
- return q(async () => {
371
- await v(async () => {
372
- await p.readMembership(), await p.readRewards(), await C.readRewards();
373
- });
374
- }), (e, o) => {
375
- const i = w("FmPageHead"), m = w("FmSearch"), g = w("FmTable"), r = w("FmButton"), E = w("FmCard");
376
- return b(), M(Y, null, [
377
- d(i, {
378
- title: t(n)("connect.reward.title"),
379
- actions: [I],
380
- "back-button": !0,
381
- "onClick:action": o[0] || (o[0] = () => V()),
382
- "onClick:back": o[1] || (o[1] = () => {
383
- var c;
384
- return (c = t(y)) == null ? void 0 : c.back();
385
- })
386
- }, null, 8, ["title", "actions"]),
387
- f("div", ve, [
388
- t(O) && t(O).length > 0 ? (b(), M(Y, { key: 0 }, [
389
- f("div", ge, [
390
- o[6] || (o[6] = f("div", { class: "flex gap-8" }, null, -1)),
391
- d(m, {
392
- modelValue: t(u).searchKey,
393
- "onUpdate:modelValue": o[2] || (o[2] = (c) => t(u).searchKey = c),
394
- class: "",
395
- placeholder: "search",
396
- collapsible: ""
397
- }, null, 8, ["modelValue"])
398
- ]),
399
- d(g, {
400
- "row-data": t(O),
401
- "column-defs": S,
402
- "search-value": t(u).searchKey,
403
- "column-filter": t(u).columnFilters,
404
- onRowClick: o[3] || (o[3] = (c) => V(c.original)),
405
- "hide-footer": t(O).length < 10
406
- }, null, 8, ["row-data", "search-value", "column-filter", "hide-footer"])
407
- ], 64)) : (b(), h(E, {
408
- key: 1,
409
- variant: "outlined",
410
- class: "w-full flex flex-col items-center justify-center gap-y-24 p-24"
411
- }, {
412
- default: A(() => [
413
- o[7] || (o[7] = f("img", {
414
- src: z,
415
- class: "aspect-square w-[150px]"
416
- }, null, -1)),
417
- f("div", be, [
418
- f("div", Re, B(t(n)("connect.storeRewards.empty.title")), 1),
419
- f("div", Ce, B(t(n)("connect.storeRewards.empty.description")), 1)
420
- ]),
421
- d(r, {
422
- variant: "primary",
423
- label: t(n)("connect.storeRewards.empty.action"),
424
- onClick: o[4] || (o[4] = (c) => V()),
425
- icon: "add"
426
- }, null, 8, ["label"])
427
- ]),
428
- _: 1
429
- })),
430
- d(we, {
431
- ref_key: "rewardSheetRef",
432
- ref: T,
433
- onUpdate: o[5] || (o[5] = (c) => l(c))
434
- }, null, 512)
435
- ])
436
- ], 64);
437
- };
438
- }
439
- });
440
- export {
441
- Ke as default
442
- };