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

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/package.json +1 -1
  2. package/dist/App-DQqZfak3.js +0 -4782
  3. package/dist/AuditLogs-C19m85wp.js +0 -2013
  4. package/dist/Bin-GjJ5Q2ae.js +0 -166
  5. package/dist/Broadcast-CVTBL0T0.js +0 -266
  6. package/dist/CampaignTypeDialog.vue_vue_type_script_setup_true_lang-B6BYvVmq.js +0 -120
  7. package/dist/Card-DzYit3v6.js +0 -910
  8. package/dist/ChipMenu.vue_vue_type_script_setup_true_lang-BPpZZNkr.js +0 -97
  9. package/dist/Collections-CaU7auvn.js +0 -540
  10. package/dist/Credit-B_eUMV0R.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-Bgcm1S_g.js +0 -3377
  14. package/dist/EffectSheet.vue_vue_type_style_index_0_lang-CZLoCJM4.js +0 -351
  15. package/dist/Experience-B7kxE07l.js +0 -259
  16. package/dist/FileSaver.min-BBvy4uPh.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-B98hcWvR.js +0 -330
  20. package/dist/Grab-RdxV7xhM.js +0 -300
  21. package/dist/ImageInput.vue_vue_type_script_setup_true_lang-BBYekrJp.js +0 -145
  22. package/dist/Index-CvMVxCY5.js +0 -259
  23. package/dist/JsonViewer-v8_C7l5N.js +0 -87
  24. package/dist/LocationPicker.vue_vue_type_script_setup_true_lang-D4-wjMg6.js +0 -48
  25. package/dist/LottieAnimation.vue_vue_type_script_setup_true_lang-Jir8zY8e.js +0 -18737
  26. package/dist/LoyaltyDashboard-B1OzFT4q.js +0 -1082
  27. package/dist/MainLayout-De_edc-D.js +0 -41
  28. package/dist/Marketing-B7-To3XF.js +0 -235
  29. package/dist/MarketingMaterialEdit-DGONncxn.js +0 -1035
  30. package/dist/Member-DEGCrqnh.js +0 -280
  31. package/dist/MemberList-vKYbpLVu.js +0 -1601
  32. package/dist/MemberOverview-wL_ailso.js +0 -58
  33. package/dist/MemberTransactions-CGC3vYKC.js +0 -45
  34. package/dist/MessageInput.vue_vue_type_script_setup_true_lang-BP9YtuPA.js +0 -60802
  35. package/dist/Mission-hxf_AIGL.js +0 -334
  36. package/dist/Overview-NvgUuMYp.js +0 -949
  37. package/dist/Overview-iRLMLoAo.js +0 -1079
  38. package/dist/Point-tkUTXOCe.js +0 -262
  39. package/dist/Promotion-DNUcMKJQ.js +0 -397
  40. package/dist/Queue-5XYiIuG8.js +0 -260
  41. package/dist/Record-B5aYp7eF.js +0 -342
  42. package/dist/Review-BqaHlzXV.js +0 -45
  43. package/dist/ReviewFacebookCallback-BqlFkSB7.js +0 -248
  44. package/dist/ReviewGoogleCallback-ssKL4jh4.js +0 -213
  45. package/dist/Reward-1xOMowTW.js +0 -442
  46. package/dist/RewardGroup.vue_vue_type_script_setup_true_lang-Db3FSfIc.js +0 -149
  47. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Cmrp2Tia.js +0 -1911
  48. package/dist/Segment-BMBwsUug.js +0 -1014
  49. package/dist/SelectItems.vue_vue_type_script_setup_true_lang-DSfdei-h.js +0 -181
  50. package/dist/SendCollectionSheet.vue_vue_type_script_setup_true_lang-BJVeGJ5J.js +0 -188
  51. package/dist/SendVoucherSheet.vue_vue_type_script_setup_true_lang-OBZubKUy.js +0 -226
  52. package/dist/Setting-DWygYkHW.js +0 -2047
  53. package/dist/SettingAdvertisements-TYB1b7dB.js +0 -264
  54. package/dist/Settings-DynjmCPL.js +0 -220
  55. package/dist/Store-DRYkmigC.js +0 -1996
  56. package/dist/StoreRewards-DU8eWbXE.js +0 -540
  57. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BkqBjEFm.js +0 -1130
  58. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-l6KmXVBZ.js +0 -7007
  59. package/dist/Tier-4k8SxKtl.js +0 -969
  60. package/dist/Title-B9lWQ_jl.js +0 -566
  61. package/dist/Transaction-C38Yd0tf.js +0 -39
  62. package/dist/UserRuleGroup.vue_vue_type_script_setup_true_lang-D6tgpKpc.js +0 -130
  63. package/dist/Voucher-BQbqC7RV.js +0 -421
  64. package/dist/VoucherEditor.vue_vue_type_script_setup_true_lang-erwpbvYi.js +0 -421
  65. package/dist/ZodTextField.vue_vue_type_script_setup_true_lang-Dt05b7fU.js +0 -56
  66. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  67. package/dist/app-BTm9mz0r.js +0 -59940
  68. package/dist/app-wDQR6dpb.js +0 -39
  69. package/dist/app.js +0 -7
  70. package/dist/business-B7GwHLce.js +0 -82
  71. package/dist/campaign-BCdKDHgz.js +0 -277
  72. package/dist/campaign-CpzFl8Vr.js +0 -4
  73. package/dist/campaign-DWlsbsKQ.js +0 -219
  74. package/dist/campaign.enum-BgK4maXz.js +0 -26
  75. package/dist/campaign.fn-DxnwGCB2.js +0 -776
  76. package/dist/collectible.enum-CdOSUDwG.js +0 -19
  77. package/dist/duplicateCampaign-BSHe0P-g.js +0 -51
  78. package/dist/effect-C7wkN_13.js +0 -89
  79. package/dist/email-addresses-DJycNI7L.js +0 -705
  80. package/dist/export-uIHWDxuh.js +0 -97
  81. package/dist/feedme.ico +0 -0
  82. package/dist/google-BQK68wbe.js +0 -5
  83. package/dist/helper-czpAhAIw.js +0 -86
  84. package/dist/index-5Sa4xS2m.js +0 -151
  85. package/dist/index-5WGEWCcI.js +0 -3
  86. package/dist/index-B2C7kc4z.js +0 -31
  87. package/dist/index-B5eb6_bi.js +0 -3678
  88. package/dist/index-B7nE1Pb2.js +0 -67
  89. package/dist/index-BFAHLexA.js +0 -32
  90. package/dist/index-BanxlNli.js +0 -8910
  91. package/dist/index-ByHoFriu.js +0 -85
  92. package/dist/index-Ca2bBJuR.js +0 -54
  93. package/dist/index-CuvNtC_M.js +0 -61
  94. package/dist/index-D-kYrDAi.js +0 -30289
  95. package/dist/index-D2gAYMIp.js +0 -28900
  96. package/dist/index-DWxmK2NJ.js +0 -61
  97. package/dist/index-U_rwkNKU.js +0 -2819
  98. package/dist/index-knizSLfz.js +0 -1157
  99. package/dist/index-vh86FiIQ.js +0 -10
  100. package/dist/index.esm2017-DFVkiPjd.js +0 -3069
  101. package/dist/loading-B3OgwEC8.js +0 -72
  102. package/dist/lodash-CiRTkvui.js +0 -3678
  103. package/dist/membership-s2VKnu_8.js +0 -255
  104. package/dist/moment-D7p2TMB-.js +0 -2583
  105. package/dist/money-DqxOXYd0.js +0 -15
  106. package/dist/number-Bt4sacaM.js +0 -12
  107. package/dist/object-BYyQ0PZp.js +0 -18
  108. package/dist/objectId-dwaoBfJX.js +0 -7
  109. package/dist/objectid-CxCupSWP.js +0 -145
  110. package/dist/plugins-CQ1JAqJB.js +0 -1788
  111. package/dist/reward-pjbal-XX.js +0 -36
  112. package/dist/rule-CzU2GAur.js +0 -1969
  113. package/dist/string-Gcy5IM_H.js +0 -32
  114. package/dist/style.css +0 -4
  115. package/dist/template-7yiMSL1f.js +0 -188
  116. package/dist/tier-BJDhpH6X.js +0 -4
  117. package/dist/tiers/tier=1.png +0 -0
  118. package/dist/tiers/tier=2.png +0 -0
  119. package/dist/tiers/tier=3.png +0 -0
  120. package/dist/tiers/tier=4.png +0 -0
  121. package/dist/titles/type=diamond.png +0 -0
  122. package/dist/titles/type=drinks.png +0 -0
  123. package/dist/titles/type=food.png +0 -0
  124. package/dist/titles/type=heart.png +0 -0
  125. package/dist/titles/type=medal.png +0 -0
  126. package/dist/titles/type=spend.png +0 -0
  127. package/dist/titles/type=thank-you.png +0 -0
  128. package/dist/titles/type=thumbs-up.png +0 -0
  129. package/dist/titles/type=years.png +0 -0
  130. package/dist/trigger-C5bqlYHn.js +0 -213
  131. package/dist/tslib.es6-BCqqvLQ_.js +0 -44
  132. package/dist/type_drinks-D6jnpvwV.js +0 -4
  133. package/dist/useMarketingMaterialActions-CW_QRtQb.js +0 -107
  134. package/dist/usePagination-D2pke4vy.js +0 -220
  135. package/dist/user-BcXrT_t5.js +0 -55
  136. package/dist/vue-i18n-CFNkj6JK.js +0 -2365
  137. package/dist/xlsx-DyVY5_Qx.js +0 -15491
  138. package/dist/zod-BD_8DRqQ.js +0 -91
@@ -1,264 +0,0 @@
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-B3OgwEC8.js";
3
- import { u as ne } from "./app-wDQR6dpb.js";
4
- import { u as se } from "./business-B7GwHLce.js";
5
- import { u as oe } from "./membership-s2VKnu_8.js";
6
- import "./index-D-kYrDAi.js";
7
- import { l as ae } from "./index-B5eb6_bi.js";
8
- import "./index-5WGEWCcI.js";
9
- import { _ as le } from "./ImageInput.vue_vue_type_script_setup_true_lang-BBYekrJp.js";
10
- import { f as D, p as ie } from "./plugins-CQ1JAqJB.js";
11
- import { _ as re } from "./TargetLocationInput.vue_vue_type_script_setup_true_lang-l6KmXVBZ.js";
12
- import { u as ce } from "./vue-i18n-CFNkj6JK.js";
13
- import { useRouter as de } from "vue-router";
14
- import { m as me } from "./index-5Sa4xS2m.js";
15
- import { R as ue } from "./app-BTm9mz0r.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
- };
@@ -1,220 +0,0 @@
1
- import { defineComponent as N, useSlots as j, openBlock as t, createElementBlock as r, createElementVNode as l, normalizeClass as z, unref as o, toDisplayString as m, createCommentVNode as _, Fragment as b, createBlock as w, createVNode as x, renderSlot as O, ref as S, computed as C, onMounted as A, withCtx as I, renderList as $, createStaticVNode as D } from "vue";
2
- import { u as M } from "./loading-B3OgwEC8.js";
3
- import { u as q } from "./business-B7GwHLce.js";
4
- import { components as g, useSnackbar as H } from "@feedmepos/ui-library";
5
- import { u as U } from "./vue-i18n-CFNkj6JK.js";
6
- import { g as J, f as K } from "./google-BQK68wbe.js";
7
- import { r as p } from "./index-DWxmK2NJ.js";
8
- const Q = { class: "rounded-lg border border-fm-color-neutral-gray-200 bg-white overflow-hidden" }, W = ["src"], X = { class: "flex flex-col flex-1 min-w-0" }, Y = { class: "fm-typo-en-body-md-600 capitalize" }, Z = {
9
- key: 0,
10
- class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400 truncate"
11
- }, E = /* @__PURE__ */ N({
12
- __name: "ReviewSource",
13
- props: {
14
- icon: {},
15
- name: {},
16
- connected: { type: Boolean },
17
- subtitle: {},
18
- syncing: { type: Boolean },
19
- tokenExpired: { type: Boolean }
20
- },
21
- emits: ["connect", "sync"],
22
- setup(i, { emit: k }) {
23
- const f = k, { t: u } = U(), c = j();
24
- return (y, s) => (t(), r("div", Q, [
25
- l("div", {
26
- class: z(["flex items-center gap-12 p-16", o(c).default ? "border-b border-fm-color-neutral-gray-100" : ""])
27
- }, [
28
- l("img", {
29
- src: i.icon,
30
- class: "w-10 h-10 shrink-0"
31
- }, null, 8, W),
32
- l("div", X, [
33
- l("span", Y, m(i.name), 1),
34
- i.subtitle ? (t(), r("span", Z, m(i.subtitle), 1)) : _("", !0)
35
- ]),
36
- i.connected ? (t(), r(b, { key: 0 }, [
37
- i.tokenExpired ? (t(), w(o(g).FmChip, {
38
- key: 0,
39
- label: o(u)("connect.review.expired"),
40
- variant: "critical"
41
- }, null, 8, ["label"])) : _("", !0),
42
- x(o(g).FmButton, {
43
- variant: "secondary",
44
- "prepend-icon": "refresh",
45
- label: o(u)("connect.review.reconnect"),
46
- onClick: s[0] || (s[0] = (v) => f("connect"))
47
- }, null, 8, ["label"]),
48
- i.tokenExpired ? _("", !0) : (t(), w(o(g).FmButton, {
49
- key: 1,
50
- variant: "primary",
51
- "prepend-icon": "sync",
52
- label: o(u)("connect.review.sync"),
53
- loading: i.syncing,
54
- onClick: s[1] || (s[1] = (v) => f("sync"))
55
- }, null, 8, ["label", "loading"]))
56
- ], 64)) : (t(), w(o(g).FmButton, {
57
- key: 1,
58
- "prepend-icon": "add",
59
- label: o(u)("connect.review.connect"),
60
- onClick: s[2] || (s[2] = (v) => f("connect"))
61
- }, null, 8, ["label"]))
62
- ], 2),
63
- O(y.$slots, "default")
64
- ]));
65
- }
66
- }), ee = { class: "p-24 flex flex-col gap-8" }, oe = { class: "flex flex-col flex-1 min-w-0" }, ne = { class: "fm-typo-en-body-lg-600 truncate" }, te = { class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400 truncate" }, ce = ["src"], ae = { class: "flex flex-col flex-1 min-w-0" }, re = { class: "fm-typo-en-body-lg-600 truncate" }, le = { class: "fm-typo-en-body-sm-400 text-fm-color-neutral-gray-400 truncate" }, ye = /* @__PURE__ */ N({
67
- __name: "Settings",
68
- setup(i) {
69
- const { t: k } = U(), f = H(), u = q(), c = S(null), y = S(!1), s = S(!1), v = C(
70
- () => {
71
- var e;
72
- return c.value ? ((e = c.value.google) == null ? void 0 : e.accessToken) === null : !1;
73
- }
74
- ), L = C(
75
- () => {
76
- var e;
77
- return c.value ? ((e = c.value.facebook) == null ? void 0 : e.token) === null : !1;
78
- }
79
- );
80
- function F(e) {
81
- const n = window.location.pathname.replace(/\/review(?:\/.*)?$/, "");
82
- return `${window.location.origin}${n}${e}`;
83
- }
84
- async function h() {
85
- await M.minor(async () => {
86
- c.value = await p.getSource();
87
- });
88
- }
89
- function B(e) {
90
- var n;
91
- return (n = u.locations.find(
92
- (a) => a._id.toString() === e
93
- )) == null ? void 0 : n.name;
94
- }
95
- function P(e) {
96
- return e.map((n) => B(n)).filter((n) => n !== void 0).join(", ");
97
- }
98
- async function R() {
99
- var e, n;
100
- y.value = !0;
101
- try {
102
- await p.syncGoogleReviews();
103
- } catch (a) {
104
- if (await h(), ((n = (e = c.value) == null ? void 0 : e.google) == null ? void 0 : n.accessToken) === null) {
105
- f.open({
106
- message: k("connect.review.tokenExpired"),
107
- type: "error"
108
- });
109
- return;
110
- }
111
- throw a;
112
- } finally {
113
- y.value = !1;
114
- }
115
- }
116
- async function T() {
117
- var e, n;
118
- s.value = !0;
119
- try {
120
- await p.syncFacebookReviews();
121
- } catch (a) {
122
- if (await h(), ((n = (e = c.value) == null ? void 0 : e.facebook) == null ? void 0 : n.token) === null) {
123
- f.open({
124
- message: k("connect.review.tokenExpired"),
125
- type: "error"
126
- });
127
- return;
128
- }
129
- throw a;
130
- } finally {
131
- s.value = !1;
132
- }
133
- }
134
- async function V() {
135
- const e = F("/review/google/callback"), { callbackUrl: n } = await p.getOauthUrl("google", e);
136
- window.location.href = n;
137
- }
138
- async function G() {
139
- const e = F("/review/facebook/callback"), { callbackUrl: n } = await p.getOauthUrl("facebook", e);
140
- window.location.href = n;
141
- }
142
- return A(() => {
143
- h(), u.readLocations();
144
- }), (e, n) => (t(), r("div", ee, [
145
- o(c) ? (t(), r(b, { key: 0 }, [
146
- x(E, {
147
- icon: o(J),
148
- name: "google",
149
- connected: !!o(c).google,
150
- syncing: o(y),
151
- "token-expired": o(v),
152
- onConnect: V,
153
- onSync: R
154
- }, {
155
- default: I(() => {
156
- var a;
157
- return [
158
- (t(!0), r(b, null, $((a = o(c).google) == null ? void 0 : a.locations, (d) => (t(), r("div", {
159
- key: d.googleLocationName,
160
- class: "flex items-center gap-12 px-16 py-12 border-b border-fm-color-neutral-gray-100 last:border-b-0"
161
- }, [
162
- x(o(g).FmIcon, {
163
- name: "location_on",
164
- class: "text-fm-color-neutral-gray-300 shrink-0"
165
- }),
166
- l("div", oe, [
167
- l("span", ne, m(d.displayName), 1),
168
- l("span", te, m(B(d.locationId)), 1)
169
- ])
170
- ]))), 128))
171
- ];
172
- }),
173
- _: 1
174
- }, 8, ["icon", "connected", "syncing", "token-expired"]),
175
- x(E, {
176
- icon: o(K),
177
- name: "facebook",
178
- connected: !!o(c).facebook,
179
- syncing: o(s),
180
- "token-expired": o(L),
181
- onConnect: G,
182
- onSync: T
183
- }, {
184
- default: I(() => {
185
- var a;
186
- return [
187
- (t(!0), r(b, null, $((a = o(c).facebook) == null ? void 0 : a.pages, (d) => (t(), r("div", {
188
- key: d.facebookPageId,
189
- class: "flex items-center gap-12 px-16 py-12 border-b border-fm-color-neutral-gray-100 last:border-b-0"
190
- }, [
191
- d.pageProfileImageUrl ? (t(), r("img", {
192
- key: 0,
193
- src: d.pageProfileImageUrl,
194
- class: "w-10 h-10 rounded-full shrink-0 object-cover"
195
- }, null, 8, ce)) : (t(), w(o(g).FmIcon, {
196
- key: 1,
197
- name: "person",
198
- class: "text-fm-color-neutral-gray-300 shrink-0"
199
- })),
200
- l("div", ae, [
201
- l("span", re, m(d.pageName), 1),
202
- l("span", le, m(P(d.locationIds)), 1)
203
- ])
204
- ]))), 128))
205
- ];
206
- }),
207
- _: 1
208
- }, 8, ["icon", "connected", "syncing", "token-expired"])
209
- ], 64)) : (t(), r(b, { key: 1 }, $(["google", "facebook"], (a) => l("div", {
210
- key: a,
211
- class: "rounded-lg border border-fm-color-neutral-gray-200 bg-white p-16"
212
- }, [...n[0] || (n[0] = [
213
- 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)
214
- ])])), 64))
215
- ]));
216
- }
217
- });
218
- export {
219
- ye as default
220
- };