@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,264 @@
1
+ import { defineComponent as J, ref as y, computed as z, onMounted as K, resolveComponent as A, openBlock as u, createElementBlock as b, createElementVNode as s, createVNode as d, createTextVNode as W, toDisplayString as v, unref as e, withCtx as k, createBlock as B, Fragment as Y, renderList as Z, createCommentVNode as N, isRef as ee } from "vue";
2
+ import { u as te } from "./loading-D-RglDMV.js";
3
+ import { u as ne } from "./app-wDQR6dpb.js";
4
+ import { u as se } from "./business-o_sAO_33.js";
5
+ import { u as oe } from "./membership-DTfMyKwP.js";
6
+ import "./index-pjXQwa0j.js";
7
+ import { l as ae } from "./index-COXmoOd1.js";
8
+ import "./index-CtJ0MQQ1.js";
9
+ import { _ as le } from "./ImageInput.vue_vue_type_script_setup_true_lang-n1r2bgOE.js";
10
+ import { f as D, p as ie } from "./plugins-CbpvMMOJ.js";
11
+ import { _ as re } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-DKGCmk5y.js";
12
+ import { u as ce } from "./vue-i18n-Dn9zxRuv.js";
13
+ import { useRouter as de } from "vue-router";
14
+ import { m as me } from "./index-CT6uJJ9y.js";
15
+ import { R as ue } from "./app-CyNzTZOx.js";
16
+ import { a as ve } from "./object-BYyQ0PZp.js";
17
+ const pe = { class: "min-h-screen bg-fm-color-neutral-gray-50" }, fe = { class: "bg-white border-b border-fm-color-neutral-gray-100 sticky top-0 z-10" }, ge = { class: "px-24 py-16 flex items-center justify-between" }, _e = { class: "flex items-center gap-16" }, he = { class: "fm-typo-en-title-md-800 flex items-center gap-8" }, ye = { class: "fm-typo-en-body-sm-400 text-fm-color-typo-secondary" }, be = {
18
+ key: 0,
19
+ class: "px-24 py-24"
20
+ }, we = { class: "flex items-center gap-24 mb-24" }, xe = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary" }, Se = { class: "fm-typo-en-body-lg-600" }, ke = { class: "fm-typo-en-title-sm-800 mb-8" }, Ae = { class: "fm-typo-en-body-md-400 text-fm-color-typo-secondary mb-16" }, Ce = {
21
+ key: 1,
22
+ class: "grid grid-cols-5 gap-16 lg:grid-cols-4 md:grid-cols-3 sm:grid-cols-2"
23
+ }, Fe = { class: "absolute top-8 right-8 z-10" }, je = { class: "aspect-[3/4] bg-fm-color-neutral-gray-100" }, Le = ["src"], Me = ["src", "alt"], Ve = {
24
+ key: 2,
25
+ class: "w-full h-full flex items-center justify-center text-fm-color-typo-disabled"
26
+ }, $e = { class: "w-48 h-48 rounded-full bg-fm-color-neutral-gray-100 flex items-center justify-center mb-8" }, Be = { class: "fm-typo-en-body-md-600 mb-4" }, Ie = { class: "fm-typo-en-body-xs-400 text-fm-color-typo-secondary" }, Pe = { class: "space-y-[40px]" }, Ee = { class: "flex" }, Te = { class: "flex flex-wrap" }, ze = { class: "flex items-center gap-8" }, I = 20, nt = /* @__PURE__ */ J({
27
+ __name: "SettingAdvertisements",
28
+ setup(Ne) {
29
+ const U = de(), C = ne(), M = se(), F = oe(), { global: Q, minor: R } = te, { t: o } = ce(), c = y(), f = y([]), _ = y([]), w = y(!1), g = y(null), j = y(null), L = y(null), V = z(() => {
30
+ var n, t;
31
+ return ((t = (n = c.value) == null ? void 0 : n.advertisements) == null ? void 0 : t.length) ?? 0;
32
+ }), P = z(() => V.value < I);
33
+ function x(n) {
34
+ var a, p;
35
+ const t = (p = (a = c.value) == null ? void 0 : a.advertisements) == null ? void 0 : p[n];
36
+ if (t)
37
+ return typeof t == "string" ? t : t.url;
38
+ }
39
+ function O(n) {
40
+ return n ? [".mp4", ".webm", ".ogg", ".mov"].some((a) => n.toLowerCase().includes(a)) : !1;
41
+ }
42
+ async function $() {
43
+ await R(
44
+ async () => {
45
+ const n = ve(c.value), t = ae.parse(n), a = Date.now(), p = (m) => `${a}-${m}-${Math.random().toString(36).substring(2, 15)}`, S = await Promise.all(
46
+ f.value.map(async (m, h) => {
47
+ var r;
48
+ const i = (r = t.advertisements) == null ? void 0 : r[h];
49
+ let l;
50
+ return m ? l = await D.update(
51
+ D.advertisementPath(h, m),
52
+ m
53
+ ) : typeof i == "string" ? l = i : i && typeof i == "object" && (l = i.url), l ? {
54
+ _id: typeof i == "object" && (i == null ? void 0 : i._id) || p(h),
55
+ url: l,
56
+ targetLocation: _.value[h] || null,
57
+ order: h
58
+ } : null;
59
+ })
60
+ );
61
+ t.advertisements = S.filter((m) => m), await me.update(t), await F.readMembership(), c.value = F.membership;
62
+ },
63
+ {
64
+ message: o("connect.advertisements.saving"),
65
+ successMessage: o("connect.advertisements.savedSuccessfully")
66
+ }
67
+ );
68
+ }
69
+ function E(n) {
70
+ g.value = n, j.value = f.value[n], L.value = _.value[n], w.value = !0;
71
+ }
72
+ function q() {
73
+ if (!P.value) return;
74
+ const n = f.value.length;
75
+ f.value.push(null), _.value.push(null), E(n);
76
+ }
77
+ async function G() {
78
+ g.value !== null && (f.value[g.value] = j.value, _.value[g.value] = L.value, await $(), w.value = !1);
79
+ }
80
+ async function H(n, t) {
81
+ var a, p;
82
+ n.stopPropagation(), await ie.remove(
83
+ o("connect.setting.advertisement.deleteConfirm"),
84
+ o("connect.setting.advertisement.delete"),
85
+ o("connect.setting.advertisement.delete")
86
+ ) && ((p = (a = c.value) == null ? void 0 : a.advertisements) == null || p.splice(t, 1), f.value.splice(t, 1), _.value.splice(t, 1), await $());
87
+ }
88
+ function X() {
89
+ U.push({ name: ue["$connect-SETTING"] });
90
+ }
91
+ return K(async () => {
92
+ await Q(async () => {
93
+ var n, t;
94
+ await M.readPremium(), await M.readLocations(), await F.readMembership(), c.value = F.membership, (t = (n = c.value) == null ? void 0 : n.advertisements) != null && t.length ? (f.value = c.value.advertisements.map(() => null), _.value = c.value.advertisements.map(
95
+ (a) => typeof a == "string" ? null : a.targetLocation || null
96
+ )) : (f.value = [], _.value = []);
97
+ });
98
+ }), (n, t) => {
99
+ var i;
100
+ const a = A("FmButton"), p = A("FmPill"), S = A("FmCard"), m = A("FmIcon"), h = A("FmSideSheet");
101
+ return u(), b("div", pe, [
102
+ s("div", fe, [
103
+ s("div", ge, [
104
+ s("div", _e, [
105
+ d(a, {
106
+ icon: "arrow_back",
107
+ variant: "tertiary",
108
+ onClick: X
109
+ }),
110
+ s("div", null, [
111
+ s("div", he, [
112
+ W(v(e(o)("connect.setting.advertisement.title")) + " ", 1),
113
+ d(p, { variant: "premium" })
114
+ ]),
115
+ s("div", ye, v(e(o)("connect.setting.advertisement.subtitle")), 1)
116
+ ])
117
+ ]),
118
+ d(a, {
119
+ label: e(o)("connect.setting.advertisement.saveChanges"),
120
+ onClick: $,
121
+ disabled: !!e(C).loadingQueue.length,
122
+ loading: !!e(C).loadingQueue.length
123
+ }, null, 8, ["label", "disabled", "loading"])
124
+ ])
125
+ ]),
126
+ e(c) ? (u(), b("div", be, [
127
+ s("div", we, [
128
+ d(S, {
129
+ variant: "outlined",
130
+ class: "px-16 py-12 flex items-center gap-8"
131
+ }, {
132
+ default: k(() => [
133
+ s("span", xe, v(e(o)("connect.setting.advertisement.activeAds")), 1),
134
+ s("span", Se, v(e(V)) + " / " + v(I), 1)
135
+ ]),
136
+ _: 1
137
+ })
138
+ ]),
139
+ e(M).isPremium ? (u(), b("div", Ce, [
140
+ (u(!0), b(Y, null, Z(((i = e(c).advertisements) == null ? void 0 : i.length) || 0, (l, r) => (u(), B(S, {
141
+ key: r,
142
+ variant: "outlined",
143
+ class: "cursor-pointer hover:shadow-lg transition-shadow overflow-hidden relative",
144
+ onClick: (T) => E(r)
145
+ }, {
146
+ default: k(() => [
147
+ s("div", Fe, [
148
+ d(a, {
149
+ icon: "delete",
150
+ variant: "tertiary",
151
+ size: "sm",
152
+ class: "bg-white/90 hover:bg-white shadow-sm",
153
+ onClick: (T) => H(T, r)
154
+ }, null, 8, ["onClick"])
155
+ ]),
156
+ s("div", je, [
157
+ x(r) && O(x(r)) ? (u(), b("video", {
158
+ key: 0,
159
+ src: x(r),
160
+ class: "w-full h-full object-cover",
161
+ muted: "",
162
+ loop: "",
163
+ autoplay: "",
164
+ playsinline: ""
165
+ }, null, 8, Le)) : x(r) ? (u(), b("img", {
166
+ key: 1,
167
+ src: x(r),
168
+ class: "w-full h-full object-cover",
169
+ alt: `Ad ${r + 1}`
170
+ }, null, 8, Me)) : (u(), b("div", Ve, [
171
+ d(m, {
172
+ name: "image",
173
+ size: "48"
174
+ })
175
+ ]))
176
+ ])
177
+ ]),
178
+ _: 2
179
+ }, 1032, ["onClick"]))), 128)),
180
+ e(P) ? (u(), B(S, {
181
+ key: 0,
182
+ variant: "outlined",
183
+ class: "cursor-pointer hover:bg-fm-color-neutral-gray-50 transition-colors border-dashed aspect-[3/4] flex flex-col items-center justify-center",
184
+ onClick: q
185
+ }, {
186
+ default: k(() => [
187
+ s("div", $e, [
188
+ d(m, {
189
+ name: "add",
190
+ size: "24",
191
+ class: "text-fm-color-typo-secondary"
192
+ })
193
+ ]),
194
+ s("div", Be, v(e(o)("connect.setting.advertisement.addAd")), 1),
195
+ s("div", Ie, v(I - e(V)) + " " + v(e(o)("connect.setting.advertisement.left")), 1)
196
+ ]),
197
+ _: 1
198
+ })) : N("", !0)
199
+ ])) : (u(), B(S, {
200
+ key: 0,
201
+ variant: "outlined",
202
+ class: "p-24 text-center mb-24 bg-fm-color-warning-50"
203
+ }, {
204
+ default: k(() => [
205
+ s("div", ke, v(e(o)("connect.setting.advertisement.premiumFeatureTitle")), 1),
206
+ s("div", Ae, v(e(o)("connect.setting.advertisement.premiumFeatureDescription")), 1)
207
+ ]),
208
+ _: 1
209
+ }))
210
+ ])) : N("", !0),
211
+ d(h, {
212
+ modelValue: e(w),
213
+ "onUpdate:modelValue": [
214
+ t[2] || (t[2] = (l) => ee(w) ? w.value = l : null),
215
+ t[3] || (t[3] = (l) => w.value = l)
216
+ ],
217
+ "max-width": 560,
218
+ header: e(g) !== null ? `${e(o)("connect.setting.advertisement.manageAd")} #${e(g) + 1}` : e(o)("connect.setting.advertisement.addAdvertisement")
219
+ }, {
220
+ "side-sheet-footer": k(() => [
221
+ s("div", ze, [
222
+ d(a, {
223
+ label: e(o)("connect.setting.advertisement.save"),
224
+ onClick: G,
225
+ loading: !!e(C).loadingQueue.length,
226
+ disabled: !!e(C).loadingQueue.length
227
+ }, null, 8, ["label", "loading", "disabled"])
228
+ ])
229
+ ]),
230
+ default: k(() => [
231
+ s("div", Pe, [
232
+ s("div", Ee, [
233
+ s("div", Te, [
234
+ d(le, {
235
+ label: e(o)("connect.setting.advertisement.advertisementImage"),
236
+ "image-fit": "cover",
237
+ "aspect-ratio": "4/5",
238
+ thumbnail: e(g) !== null ? x(e(g)) : void 0,
239
+ accept: ".png, .jpg, .jpeg, .mp4, .gif",
240
+ "recommended-size": "1080px x 1350px (4:5)",
241
+ file: e(j) ?? void 0,
242
+ "onUpdate:file": t[0] || (t[0] = (l) => j.value = l)
243
+ }, null, 8, ["label", "thumbnail", "file"])
244
+ ])
245
+ ]),
246
+ s("div", null, [
247
+ d(re, {
248
+ label: e(o)("connect.setting.advertisement.targetLocations"),
249
+ "helper-text": e(o)("connect.setting.advertisement.targetLocationsHelper"),
250
+ "model-value": e(L) ?? null,
251
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => L.value = l)
252
+ }, null, 8, ["label", "helper-text", "model-value"])
253
+ ])
254
+ ])
255
+ ]),
256
+ _: 1
257
+ }, 8, ["modelValue", "header"])
258
+ ]);
259
+ };
260
+ }
261
+ });
262
+ export {
263
+ nt as default
264
+ };
@@ -0,0 +1,228 @@
1
+ import { defineComponent as U, useSlots as z, openBlock as t, createElementBlock as a, createElementVNode as l, normalizeClass as A, unref as o, toDisplayString as g, createCommentVNode as _, Fragment as k, createBlock as w, createVNode as x, renderSlot as M, ref as S, computed as B, onMounted as W, withCtx as C, renderList as E, createStaticVNode as D } from "vue";
2
+ import { u as q } from "./loading-D-RglDMV.js";
3
+ import { u as H } from "./business-o_sAO_33.js";
4
+ import { components as y, useSnackbar as J } from "@feedmepos/ui-library";
5
+ import { u as R } from "./vue-i18n-Dn9zxRuv.js";
6
+ import { g as K, f as Q } from "./google-BQK68wbe.js";
7
+ import { R as X } from "./app-CyNzTZOx.js";
8
+ import { useRouter as Y } from "vue-router";
9
+ import { r as b } from "./index-Ci2gFCfD.js";
10
+ const Z = { class: "rounded-lg border border-fm-color-neutral-gray-200 bg-white overflow-hidden" }, ee = ["src"], oe = { class: "flex flex-col flex-1 min-w-0" }, ne = { class: "fm-typo-en-body-md-600 capitalize" }, te = {
11
+ key: 0,
12
+ class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400 truncate"
13
+ }, N = /* @__PURE__ */ U({
14
+ __name: "ReviewSource",
15
+ props: {
16
+ icon: {},
17
+ name: {},
18
+ connected: { type: Boolean },
19
+ subtitle: {},
20
+ syncing: { type: Boolean },
21
+ tokenExpired: { type: Boolean }
22
+ },
23
+ emits: ["connect", "sync"],
24
+ setup(i, { emit: p }) {
25
+ const u = p, { t: f } = R(), v = z();
26
+ return (c, s) => (t(), a("div", Z, [
27
+ l("div", {
28
+ class: A(["flex items-center gap-12 p-16", o(v).default ? "border-b border-fm-color-neutral-gray-100" : ""])
29
+ }, [
30
+ l("img", {
31
+ src: i.icon,
32
+ class: "w-10 h-10 shrink-0"
33
+ }, null, 8, ee),
34
+ l("div", oe, [
35
+ l("span", ne, g(i.name), 1),
36
+ i.subtitle ? (t(), a("span", te, g(i.subtitle), 1)) : _("", !0)
37
+ ]),
38
+ i.connected ? (t(), a(k, { key: 0 }, [
39
+ i.tokenExpired ? (t(), w(o(y).FmChip, {
40
+ key: 0,
41
+ label: o(f)("connect.review.expired"),
42
+ variant: "critical"
43
+ }, null, 8, ["label"])) : _("", !0),
44
+ x(o(y).FmButton, {
45
+ variant: "secondary",
46
+ "prepend-icon": "refresh",
47
+ label: o(f)("connect.review.reconnect"),
48
+ onClick: s[0] || (s[0] = (m) => u("connect"))
49
+ }, null, 8, ["label"]),
50
+ i.tokenExpired ? _("", !0) : (t(), w(o(y).FmButton, {
51
+ key: 1,
52
+ variant: "primary",
53
+ "prepend-icon": "sync",
54
+ label: o(f)("connect.review.sync"),
55
+ loading: i.syncing,
56
+ onClick: s[1] || (s[1] = (m) => u("sync"))
57
+ }, null, 8, ["label", "loading"]))
58
+ ], 64)) : (t(), w(o(y).FmButton, {
59
+ key: 1,
60
+ "prepend-icon": "add",
61
+ label: o(f)("connect.review.connect"),
62
+ onClick: s[2] || (s[2] = (m) => u("connect"))
63
+ }, null, 8, ["label"]))
64
+ ], 2),
65
+ M(c.$slots, "default")
66
+ ]));
67
+ }
68
+ }), ce = { class: "p-24 flex flex-col gap-8" }, re = { class: "flex flex-col flex-1 min-w-0" }, ae = { class: "fm-typo-en-body-lg-600 truncate" }, le = { class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400 truncate" }, se = ["src"], ie = { class: "flex flex-col flex-1 min-w-0" }, de = { class: "fm-typo-en-body-lg-600 truncate" }, ue = { class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400 truncate" }, xe = /* @__PURE__ */ U({
69
+ __name: "Settings",
70
+ setup(i) {
71
+ const { t: p } = R(), u = J(), f = Y(), v = H(), c = S(null), s = S(!1), m = S(!1), V = B(
72
+ () => {
73
+ var e;
74
+ return c.value ? ((e = c.value.google) == null ? void 0 : e.accessToken) === null : !1;
75
+ }
76
+ ), L = B(
77
+ () => {
78
+ var e;
79
+ return c.value ? ((e = c.value.facebook) == null ? void 0 : e.token) === null : !1;
80
+ }
81
+ );
82
+ function $(e) {
83
+ const n = window.location.pathname.replace(/\/review(?:\/.*)?$/, "");
84
+ return `${window.location.origin}${n}${e}`;
85
+ }
86
+ async function h() {
87
+ await q.minor(async () => {
88
+ c.value = await b.getSource();
89
+ });
90
+ }
91
+ function I(e) {
92
+ var n;
93
+ return (n = v.locations.find(
94
+ (r) => r._id.toString() === e
95
+ )) == null ? void 0 : n.name;
96
+ }
97
+ function T(e) {
98
+ return e.map((n) => I(n)).filter((n) => n !== void 0).join(", ");
99
+ }
100
+ function F() {
101
+ u.open({
102
+ message: p("connect.review.syncSuccess"),
103
+ type: "success"
104
+ }), f.push({ name: X["$connect-REVIEW_OVERVIEW"] });
105
+ }
106
+ async function O() {
107
+ var e, n;
108
+ s.value = !0;
109
+ try {
110
+ await b.syncGoogleReviews(), F();
111
+ } catch (r) {
112
+ if (await h(), ((n = (e = c.value) == null ? void 0 : e.google) == null ? void 0 : n.accessToken) === null) {
113
+ u.open({
114
+ message: p("connect.review.tokenExpired"),
115
+ type: "error"
116
+ });
117
+ return;
118
+ }
119
+ throw r;
120
+ } finally {
121
+ s.value = !1;
122
+ }
123
+ }
124
+ async function P() {
125
+ var e, n;
126
+ m.value = !0;
127
+ try {
128
+ await b.syncFacebookReviews(), F();
129
+ } catch (r) {
130
+ if (await h(), ((n = (e = c.value) == null ? void 0 : e.facebook) == null ? void 0 : n.token) === null) {
131
+ u.open({
132
+ message: p("connect.review.tokenExpired"),
133
+ type: "error"
134
+ });
135
+ return;
136
+ }
137
+ throw r;
138
+ } finally {
139
+ m.value = !1;
140
+ }
141
+ }
142
+ async function G() {
143
+ const e = $("/review/google/callback"), { callbackUrl: n } = await b.getOauthUrl("google", e);
144
+ window.location.href = n;
145
+ }
146
+ async function j() {
147
+ const e = $("/review/facebook/callback"), { callbackUrl: n } = await b.getOauthUrl("facebook", e);
148
+ window.location.href = n;
149
+ }
150
+ return W(() => {
151
+ h(), v.readLocations();
152
+ }), (e, n) => (t(), a("div", ce, [
153
+ o(c) ? (t(), a(k, { key: 0 }, [
154
+ x(N, {
155
+ icon: o(K),
156
+ name: "google",
157
+ connected: !!o(c).google,
158
+ syncing: o(s),
159
+ "token-expired": o(V),
160
+ onConnect: G,
161
+ onSync: O
162
+ }, {
163
+ default: C(() => {
164
+ var r;
165
+ return [
166
+ (t(!0), a(k, null, E((r = o(c).google) == null ? void 0 : r.locations, (d) => (t(), a("div", {
167
+ key: d.googleLocationName,
168
+ class: "flex items-center gap-12 px-16 py-12 border-b border-fm-color-neutral-gray-100 last:border-b-0"
169
+ }, [
170
+ x(o(y).FmIcon, {
171
+ name: "location_on",
172
+ class: "text-fm-color-neutral-gray-300 shrink-0"
173
+ }),
174
+ l("div", re, [
175
+ l("span", ae, g(d.displayName), 1),
176
+ l("span", le, g(I(d.locationId)), 1)
177
+ ])
178
+ ]))), 128))
179
+ ];
180
+ }),
181
+ _: 1
182
+ }, 8, ["icon", "connected", "syncing", "token-expired"]),
183
+ x(N, {
184
+ icon: o(Q),
185
+ name: "facebook",
186
+ connected: !!o(c).facebook,
187
+ syncing: o(m),
188
+ "token-expired": o(L),
189
+ onConnect: j,
190
+ onSync: P
191
+ }, {
192
+ default: C(() => {
193
+ var r;
194
+ return [
195
+ (t(!0), a(k, null, E((r = o(c).facebook) == null ? void 0 : r.pages, (d) => (t(), a("div", {
196
+ key: d.facebookPageId,
197
+ class: "flex items-center gap-12 px-16 py-12 border-b border-fm-color-neutral-gray-100 last:border-b-0"
198
+ }, [
199
+ d.pageProfileImageUrl ? (t(), a("img", {
200
+ key: 0,
201
+ src: d.pageProfileImageUrl,
202
+ class: "w-10 h-10 rounded-full shrink-0 object-cover"
203
+ }, null, 8, se)) : (t(), w(o(y).FmIcon, {
204
+ key: 1,
205
+ name: "person",
206
+ class: "text-fm-color-neutral-gray-300 shrink-0"
207
+ })),
208
+ l("div", ie, [
209
+ l("span", de, g(d.pageName), 1),
210
+ l("span", ue, g(T(d.locationIds)), 1)
211
+ ])
212
+ ]))), 128))
213
+ ];
214
+ }),
215
+ _: 1
216
+ }, 8, ["icon", "connected", "syncing", "token-expired"])
217
+ ], 64)) : (t(), a(k, { key: 1 }, E(["google", "facebook"], (r) => l("div", {
218
+ key: r,
219
+ class: "rounded-lg border border-fm-color-neutral-gray-200 bg-white p-16"
220
+ }, [...n[0] || (n[0] = [
221
+ D('<div class="animate-pulse flex items-center gap-12"><div class="w-10 h-10 rounded-full bg-fm-color-neutral-gray-100 shrink-0"></div><div class="flex-1 min-w-0 space-y-8"><div class="h-16 w-20 rounded bg-fm-color-neutral-gray-100"></div><div class="h-12 w-full max-w-[160px] rounded bg-fm-color-neutral-gray-100"></div></div><div class="h-32 w-24 rounded bg-fm-color-neutral-gray-100 shrink-0"></div></div>', 1)
222
+ ])])), 64))
223
+ ]));
224
+ }
225
+ });
226
+ export {
227
+ xe as default
228
+ };