@feedmepos/mf-connect 0.1.113-prod → 0.1.114-dev
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.
- package/README.md +66 -1
- package/dist/{App-2J4yDonr.js → App-CIWTDYuZ.js} +700 -654
- package/dist/AuditLogs-BluLDXu9.js +2016 -0
- package/dist/{Bin-BU_hVuxJ.js → Bin-jS6pM4L3.js} +8 -8
- package/dist/Broadcast-DBqsSZ0S.js +306 -0
- package/dist/{CampaignAnalytic-DUUmFMvy.js → CampaignAnalytic-DJrjXD4H.js} +7 -7
- package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BZirReIy.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CzwigRLi.js} +9 -9
- package/dist/{Card-DS2K_LFv.js → Card-B10nLilL.js} +25 -24
- package/dist/{Collections-BFdRdPHR.js → Collections-BN42A73p.js} +197 -185
- package/dist/{Credit-CODfiox3.js → Credit-0SS26HGE.js} +21 -20
- package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-B2T5G1hZ.js → DateRangeChip.vue_vue_type_script_setup_true_lang-B3wozBFs.js} +1 -1
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BRd5RVYe.js +4442 -0
- package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-KvZebiOu.js → EffectSheet.vue_vue_type_style_index_0_lang-zV9dLCWp.js} +32 -32
- package/dist/{Experience-BGBWc8Ep.js → Experience-D7qPzsrc.js} +32 -31
- package/dist/{FileSaver.min-DJAN3Eu0.js → FileSaver.min-BKWoklMK.js} +1 -1
- package/dist/{Game-6yyn0uAd.js → Game-BoYMwfog.js} +19 -18
- package/dist/{GiftCardSetup-B096bTm0.js → GiftCardSetup-B87O0xzo.js} +75 -75
- package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-ChvUXdF-.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-B3uGbEFY.js} +7 -7
- package/dist/{Goals-Db2mwbRo.js → Goals-CVxf3xCA.js} +4 -4
- package/dist/Grab-mGL1Mue_.js +301 -0
- package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-xdEzwMcS.js → ImageInput.vue_vue_type_script_setup_true_lang-HipBZ1_T.js} +1 -1
- package/dist/{Index-580WNkG2.js → Index-Dptuy-6c.js} +10 -10
- package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-BkAQXKNJ.js → LocationPicker.vue_vue_type_script_setup_true_lang-Cjc4UeKz.js} +1 -1
- package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CR6sSnx4.js → LottieAnimation.vue_vue_type_script_setup_true_lang-Bh0ari3f.js} +1 -1
- package/dist/{LoyaltyDashboard-Clr2aiUP.js → LoyaltyDashboard-BxhI6RAE.js} +15 -15
- package/dist/MainLayout-YfDxvZXl.js +4 -0
- package/dist/{MainLayout-_iCyT5mw.js → MainLayout.vue_vue_type_script_setup_true_lang-BgXpznbi.js} +5 -4
- package/dist/{Marketing-fq1wxANq.js → Marketing-C2cVJacf.js} +4 -4
- package/dist/MarketingMaterialEdit-DkOEy_L-.js +1037 -0
- package/dist/{Member-BfRy196y.js → Member-DufbKDOh.js} +7 -7
- package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-BAR44Qcp.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-CU8EmBxy.js} +43 -50
- package/dist/{MemberImportHistory-C4622Ivs.js → MemberImportHistory-DlFN-uQl.js} +7 -7
- package/dist/{MemberList-DqtsMN_N.js → MemberList-B344n8I4.js} +103 -105
- package/dist/{MemberTransactions-DsUoFg3z.js → MemberTransactions-BS7H640M.js} +1 -1
- package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CzFMUgXM.js → MessageInput.vue_vue_type_script_setup_true_lang-CxDtXvwd.js} +4228 -4176
- package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CVQYcuQ6.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-lY0jlyOG.js} +1 -1
- package/dist/{Mission-B0GO4LiM.js → Mission-D2ed_oKn.js} +22 -21
- package/dist/{Overview-XpJJmHqs.js → Overview-CLh_T6YY.js} +145 -144
- package/dist/{Overview-CVITimwN.js → Overview-DJa-hXDC.js} +23 -22
- package/dist/{Point-B7aCrMkI.js → Point-DAPeg1VD.js} +22 -21
- package/dist/{Promotion-DfVcuXHy.js → Promotion-CPPCMMFl.js} +137 -131
- package/dist/{Queue-BT7O2cvj.js → Queue-BcPwCRcM.js} +47 -46
- package/dist/{Record-CAc030dz.js → Record-C5XKn--g.js} +9 -9
- package/dist/{Review-CyXo4GTY.js → Review-Cc51luIv.js} +2 -2
- package/dist/ReviewFacebookCallback-BSGInFB8.js +225 -0
- package/dist/{ReviewGoogleCallback-BxiFOl0B.js → ReviewGoogleCallback-C1gY4vcP.js} +5 -5
- package/dist/{Reward-ChfNtdwX.js → Reward-k1R3hLiF.js} +29 -29
- package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-CpQu_QBQ.js → RewardGroup.vue_vue_type_script_setup_true_lang-BGbbGVK4.js} +16 -15
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Coh3L11L.js +1923 -0
- package/dist/{Segment-H2zBDZeh.js → Segment-DsBnIvje.js} +290 -291
- package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B0jCJ-Xq.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-CMKpvXN-.js} +31 -30
- package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DW_ViNZM.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-LyAtRMs8.js} +4 -4
- package/dist/Setting-BRueNgc4.js +574 -0
- package/dist/{SettingAdvertisements-DPQHP3-B.js → SettingAdvertisements-BrVcQyhF.js} +12 -12
- package/dist/Settings-fOvXd29Z.js +286 -0
- package/dist/{Store-B2f5HVQc.js → Store-rrh2pIHH.js} +661 -654
- package/dist/{StoreRewards-QxfaEt9f.js → StoreRewards-D-jivVKr.js} +15 -15
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CvQXsZbH.js +1319 -0
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DbnY9VE9.js +7007 -0
- package/dist/{Tier-BSk4rBm8.js → Tier-DJiLtw3M.js} +2576 -687
- package/dist/{Title-CIzpB8TT.js → Title-s0bzA7yZ.js} +94 -92
- package/dist/{Transaction-BjxxNEHa.js → Transaction-CQ-CJ_eh.js} +2 -2
- package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BMutYxOU.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Bfy8SZH1.js} +26 -26
- package/dist/{Voucher-B2lFq21Y.js → Voucher-9vydRET7.js} +19 -19
- package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BWV631It.js → VoucherEditor.vue_vue_type_script_setup_true_lang-Dq7veRL5.js} +16 -16
- package/dist/WhatsappAccount-D12Hvzfl.js +159 -0
- package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BrZEDi6O.js +39 -0
- package/dist/WhatsappBot-o5b_0CnB.js +629 -0
- package/dist/WhatsappBotLogs-CK_V_iT5.js +372 -0
- package/dist/WhatsappBotSettings-BooibLUg.js +694 -0
- package/dist/WhatsappLayout-bOyNHGUI.js +21 -0
- package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-Cytrffdh.js +253 -0
- package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BCoB0Fsa.js → ZodTextField.vue_vue_type_script_setup_true_lang-96t_eUzk.js} +2 -2
- package/dist/{app-DgFVWdhA.js → app-DV3e2LkD.js} +10610 -8223
- package/dist/app.js +4 -3
- package/dist/{base.export-B6Rojjek.js → base.export-DQUUtGmy.js} +2 -2
- package/dist/browser-BSAOEeIM.js +1478 -0
- package/dist/{business-C6ID0exl.js → business-BZ0boE-5.js} +1 -1
- package/dist/campaign-CsfFq2S-.js +400 -0
- package/dist/{campaign-BgSJXWdU.js → campaign-DMrtYWcs.js} +31 -25
- package/dist/{campaign.enum-CVvm0LMm.js → campaign.enum-Dx-Zo68Q.js} +3 -2
- package/dist/campaign.fn-C-CdNNdR.js +776 -0
- package/dist/{collectible.enum-DGQVW464.js → collectible.enum-Liy2wH3s.js} +1 -1
- package/dist/{collection.fn-dV4F8R-j.js → collection.fn-C-rryKSc.js} +2 -2
- package/dist/{currency-DlHi_3WN.js → currency-BOd9iVZV.js} +1 -1
- package/dist/duplicateCampaign-ey_rW0Bz.js +51 -0
- package/dist/{effect-BJgmiWY4.js → effect-BP6Hkxmj.js} +1 -1
- package/dist/{email-addresses-3GTx_xTh.js → email-addresses-CO61QAq0.js} +2 -2
- package/dist/feature-flag-Bq1SgbYC.js +868 -0
- package/dist/feature-flag-lvPP0ED-.js +50 -0
- package/dist/google-BQK68wbe.js +5 -0
- package/dist/{helper-BX0JQP06.js → helper-BRpts-M-.js} +1 -1
- package/dist/{index-BIpAzktM.js → index-03WIXl-H.js} +8 -7
- package/dist/{index-BeCKw7Y3.js → index-B0RavybO.js} +19 -6
- package/dist/{index-DeNbsrQx.js → index-BDNkoALK.js} +1 -1
- package/dist/{index-Bl5aHABH.js → index-BV5aPSYo.js} +11 -10
- package/dist/{index-Cnw0B8Lc.js → index-Bk20uvPY.js} +1 -1
- package/dist/index-Bn19rfby.js +14571 -0
- package/dist/index-C_H8jFYf.js +2743 -0
- package/dist/{index-nmw7_9ZE.js → index-Cj-eugzc.js} +1 -1
- package/dist/{index-uXgPJlic.js → index-CoROn5OA.js} +2700 -2613
- package/dist/{index-DdMVrWZy.js → index-CrBhcMaL.js} +8028 -10767
- package/dist/{index-2xed2K8D.js → index-CsBjAM3E.js} +4 -3
- package/dist/{index-CiFReW-F.js → index-D1t4_KaG.js} +1 -1
- package/dist/{index-DRNdJ_KC.js → index-D3wGTCWf.js} +8 -7
- package/dist/{index-CtBLnWVG.js → index-D41kjcrZ.js} +683 -581
- package/dist/{index-CNULhBPM.js → index-DIZLkVe0.js} +691 -230
- package/dist/{index-QaWLGgEC.js → index-DucKyzrD.js} +2 -2
- package/dist/{index-o2OQljHs.js → index-R5WS21OL.js} +4 -4
- package/dist/index-RwNlbTO8.js +115 -0
- package/dist/{index-R0qlOO6J.js → index-VYI0zWNC.js} +29 -15
- package/dist/index-ZRE89TKq.js +80 -0
- package/dist/{index-BHT6cvWA.js → index-_Cj-bsd_.js} +396 -232
- package/dist/{index-Y2Pu1YkB.js → index-mToWKHVs.js} +2 -2
- package/dist/{index.esm2017-Dum0onrS.js → index.esm2017-B_Sag8Pg.js} +209 -209
- package/dist/{loading-B2mSdkfy.js → loading-C5fVI0ry.js} +1 -1
- package/dist/{lodash-DtOypaKt.js → lodash-COo8_xCU.js} +1 -1
- package/dist/{member-import-C2pLnh44.js → member-import-I_pKwUfF.js} +6 -5
- package/dist/{membership-BWyBGF4n.js → membership-BgfH9Kva.js} +3 -3
- package/dist/{money-3lCCVCeP.js → money-Cr07YDlV.js} +1 -1
- package/dist/{number-zlqy2MLG.js → number-DFsj0dkh.js} +1 -1
- package/dist/objectid-Cu89BzwI.js +145 -0
- package/dist/{onboarding-BqD3B4M1.js → onboarding-DlkJCm-5.js} +25 -25
- package/dist/{onboardingSetup-CCQ90jg7.js → onboardingSetup-BEhVj613.js} +2 -2
- package/dist/{plugins-Bj3npYnL.js → plugins-CPTtiKqf.js} +3 -3
- package/dist/{MarketingMaterialEdit-0h7E0n5e.js → remy-icon-BhUGu2NI.js} +2 -1031
- package/dist/{reward-5dDuZEb7.js → reward-DqY0mQ_5.js} +1 -1
- package/dist/{rule-NqLeSyoO.js → rule-mJJ48eKw.js} +572 -492
- package/dist/style.css +1 -1
- package/dist/template-C1QftpDG.js +188 -0
- package/dist/{timezone-B0lkgvh-.js → timezone-BBgBHels.js} +1 -1
- package/dist/{transaction.fn-CACuVUBe.js → transaction.fn-Sr0hj3kY.js} +2 -2
- package/dist/{trigger-BKJwKTJx.js → trigger-PUP0mwKM.js} +8 -8
- package/dist/{useMarketingMaterialActions-DERvOmen.js → useMarketingMaterialActions-faslwaHd.js} +3 -3
- package/dist/{usePagination-FkjroUq2.js → usePagination-Be6nIQ9y.js} +1 -1
- package/dist/{user-H9MnsLbu.js → user-DBSYzG_9.js} +1 -1
- package/dist/vue-i18n-C6c2jsH3.js +2365 -0
- package/dist/{xlsx-BVmtIl_i.js → xlsx-Bfo19lFv.js} +786 -786
- package/dist/{zod-DI7OBdxu.js → zod-CihbDg3N.js} +1 -1
- package/package.json +12 -3
- package/dist/Broadcast-CoirZUyr.js +0 -271
- package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DyIOw_HH.js +0 -2431
- package/dist/ReviewFacebookCallback--IcyheQA.js +0 -238
- package/dist/RuleGroup.vue_vue_type_script_setup_true_lang--5K-qagY.js +0 -1883
- package/dist/Setting-D4XOHSHT.js +0 -2036
- package/dist/Settings-Dt_oLoGl.js +0 -179
- package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-Db2cd6ny.js +0 -1264
- package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-D9L-AayN.js +0 -142
- package/dist/campaign-DDfFBFye.js +0 -228
- package/dist/campaign.fn-DRabv93K.js +0 -776
- package/dist/google-C3S8u0mT.js +0 -4
- package/dist/index-CmhDYsk6.js +0 -51
- package/dist/objectid-b2KGvMA7.js +0 -145
- package/dist/rule-builder-BzYwbbj4.js +0 -102
- package/dist/template-fjUz6xrU.js +0 -236
- package/dist/vue-i18n-DbJO6sZW.js +0 -2365
|
@@ -0,0 +1,629 @@
|
|
|
1
|
+
import { defineComponent as Q, ref as b, computed as j, watch as Z, onBeforeUnmount as Y, resolveComponent as B, openBlock as n, createElementBlock as u, createElementVNode as o, normalizeClass as O, unref as t, toDisplayString as s, createBlock as k, withCtx as C, createTextVNode as z, createVNode as T, createCommentVNode as D, Fragment as J, renderList as q, useModel as ee } from "vue";
|
|
2
|
+
import { u as K } from "./vue-i18n-C6c2jsH3.js";
|
|
3
|
+
import { useRouter as te } from "vue-router";
|
|
4
|
+
import { useCoreStore as oe } from "@feedmepos/mf-common";
|
|
5
|
+
import { S as N, a as ne } from "./index-03WIXl-H.js";
|
|
6
|
+
import { w as G } from "./index-ZRE89TKq.js";
|
|
7
|
+
import { u as ae, _ as se, w as le } from "./WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-Cytrffdh.js";
|
|
8
|
+
import { R as M } from "./app-DV3e2LkD.js";
|
|
9
|
+
import { _ as re } from "./WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BrZEDi6O.js";
|
|
10
|
+
import { b as ce } from "./browser-BSAOEeIM.js";
|
|
11
|
+
const ie = { class: "min-w-0" }, ue = { class: "flex items-center gap-[12px]" }, pe = ["src"], de = { key: 1 }, me = { class: "min-w-0 flex-1" }, fe = ["title"], xe = { key: 1 }, ve = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary break-all" }, he = { class: "relative z-10 shrink-0" }, _e = ["aria-label", "title", "aria-expanded", "disabled", "aria-busy"], ge = { class: "text-[14px] text-fm-color-typo-error" }, ye = { class: "flex items-center justify-between flex-wrap gap-[8px] border-t border-fm-color-neutral-gray-100 pt-[12px]" }, be = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "text-[12px] text-fm-color-typo-tertiary"
|
|
14
|
+
}, we = {
|
|
15
|
+
key: 0,
|
|
16
|
+
role: "alert",
|
|
17
|
+
class: "text-[14px] text-fm-color-typo-error"
|
|
18
|
+
}, ke = /* @__PURE__ */ Q({
|
|
19
|
+
__name: "WhatsappAccountCard",
|
|
20
|
+
props: {
|
|
21
|
+
account: {}
|
|
22
|
+
},
|
|
23
|
+
emits: ["removed"],
|
|
24
|
+
setup(E, { emit: i }) {
|
|
25
|
+
const l = E, w = i, { t: _, locale: d } = K(), r = b(!1), x = b(""), y = b(!1), A = b(!1);
|
|
26
|
+
let g;
|
|
27
|
+
const {
|
|
28
|
+
name: $,
|
|
29
|
+
phoneNumber: V,
|
|
30
|
+
initials: P,
|
|
31
|
+
state: v,
|
|
32
|
+
avatarColor: p,
|
|
33
|
+
profilePictureUrl: h,
|
|
34
|
+
profilePictureFailed: c
|
|
35
|
+
} = ae(() => l.account), I = j(() => v.value === "connected"), R = j(() => ({
|
|
36
|
+
name: M["$connect-WHATSAPP_ACCOUNT"],
|
|
37
|
+
params: { clientId: l.account.clientId }
|
|
38
|
+
}));
|
|
39
|
+
function S(a) {
|
|
40
|
+
return new Intl.DateTimeFormat(d.value, {
|
|
41
|
+
year: "numeric",
|
|
42
|
+
month: "short",
|
|
43
|
+
day: "numeric"
|
|
44
|
+
}).format(new Date(a));
|
|
45
|
+
}
|
|
46
|
+
async function W() {
|
|
47
|
+
if (r.value) return;
|
|
48
|
+
const a = N.getBusinessId();
|
|
49
|
+
if (!a) {
|
|
50
|
+
x.value = _("connect.whatsappBot.errors.selectBusiness");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const e = l.account.clientId, m = new AbortController();
|
|
54
|
+
g = m, r.value = !0, x.value = "";
|
|
55
|
+
try {
|
|
56
|
+
await G.deleteClient(a, e, m.signal), m.signal.aborted || w("removed", e);
|
|
57
|
+
} catch {
|
|
58
|
+
m.signal.aborted || (x.value = _("connect.whatsappBot.errors.removeAccount"));
|
|
59
|
+
} finally {
|
|
60
|
+
g === m && (g = void 0, r.value = !1);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function F() {
|
|
64
|
+
g == null || g.abort(), g = void 0, r.value = !1, x.value = "";
|
|
65
|
+
}
|
|
66
|
+
return Z(
|
|
67
|
+
() => N.getBusinessId(),
|
|
68
|
+
() => {
|
|
69
|
+
F(), A.value = !1;
|
|
70
|
+
}
|
|
71
|
+
), Y(F), (a, e) => {
|
|
72
|
+
const m = B("RouterLink"), L = B("FmCircularProgress"), U = B("FmIcon"), H = B("FmMenuItem"), X = B("FmMenu");
|
|
73
|
+
return n(), u("li", ie, [
|
|
74
|
+
o("div", {
|
|
75
|
+
class: O(["relative h-full border border-fm-color-neutral-gray-100 rounded-[16px] p-[20px] flex flex-col gap-[16px] bg-fm-color-neutral-white text-fm-color-typo-primary", {
|
|
76
|
+
"cursor-pointer transition-shadow hover:border-fm-color-neutral-gray-200 hover:fm-shadow-light-100": I.value
|
|
77
|
+
}])
|
|
78
|
+
}, [
|
|
79
|
+
o("div", ue, [
|
|
80
|
+
o("div", {
|
|
81
|
+
"aria-hidden": "true",
|
|
82
|
+
class: O(["w-[48px] h-[48px] rounded-full overflow-hidden shrink-0 flex items-center justify-center text-[16px] font-semibold text-fm-color-typo-white", t(p)])
|
|
83
|
+
}, [
|
|
84
|
+
t(h) && !t(c) ? (n(), u("img", {
|
|
85
|
+
key: 0,
|
|
86
|
+
src: t(h),
|
|
87
|
+
alt: "",
|
|
88
|
+
class: "w-full h-full object-cover",
|
|
89
|
+
referrerpolicy: "no-referrer",
|
|
90
|
+
onError: e[0] || (e[0] = (f) => c.value = !0)
|
|
91
|
+
}, null, 40, pe)) : (n(), u("span", de, s(t(P)), 1))
|
|
92
|
+
], 2),
|
|
93
|
+
o("div", me, [
|
|
94
|
+
o("h2", {
|
|
95
|
+
class: "text-[16px] leading-[24px] font-semibold truncate",
|
|
96
|
+
title: t($)
|
|
97
|
+
}, [
|
|
98
|
+
I.value ? (n(), k(m, {
|
|
99
|
+
key: 0,
|
|
100
|
+
to: R.value,
|
|
101
|
+
class: "text-inherit no-underline after:absolute after:inset-0 after:rounded-[16px] focus-visible:outline-none focus-visible:after:ring-[2px] focus-visible:after:ring-fm-color-primary focus-visible:after:ring-offset-[2px]"
|
|
102
|
+
}, {
|
|
103
|
+
default: C(() => [
|
|
104
|
+
z(s(t($)), 1)
|
|
105
|
+
]),
|
|
106
|
+
_: 1
|
|
107
|
+
}, 8, ["to"])) : (n(), u("span", xe, s(t($)), 1))
|
|
108
|
+
], 8, fe),
|
|
109
|
+
o("p", ve, s(t(V)), 1)
|
|
110
|
+
]),
|
|
111
|
+
o("div", he, [
|
|
112
|
+
T(X, {
|
|
113
|
+
placement: "bottom-end",
|
|
114
|
+
width: 220,
|
|
115
|
+
disabled: r.value,
|
|
116
|
+
"stop-click-propagation": "",
|
|
117
|
+
onMenuChanged: e[3] || (e[3] = (f) => y.value = f)
|
|
118
|
+
}, {
|
|
119
|
+
"menu-button": C(() => [
|
|
120
|
+
o("button", {
|
|
121
|
+
type: "button",
|
|
122
|
+
"aria-label": t(_)("connect.whatsappBot.moreActions"),
|
|
123
|
+
title: t(_)("connect.whatsappBot.moreActions"),
|
|
124
|
+
"aria-haspopup": "menu",
|
|
125
|
+
"aria-expanded": y.value,
|
|
126
|
+
disabled: r.value,
|
|
127
|
+
"aria-busy": r.value,
|
|
128
|
+
class: O(["w-[32px] h-[32px] flex items-center justify-center rounded-[8px] text-fm-color-typo-tertiary transition-colors hover:bg-fm-color-neutral-gray-100 hover:text-fm-color-typo-primary focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-fm-color-primary disabled:cursor-wait disabled:opacity-50", { "bg-fm-color-neutral-gray-100": y.value }])
|
|
129
|
+
}, [
|
|
130
|
+
r.value ? (n(), k(L, {
|
|
131
|
+
key: 0,
|
|
132
|
+
size: "md",
|
|
133
|
+
"aria-hidden": "true"
|
|
134
|
+
})) : (n(), k(U, {
|
|
135
|
+
key: 1,
|
|
136
|
+
name: "more_vert",
|
|
137
|
+
size: "sm",
|
|
138
|
+
"aria-hidden": "true"
|
|
139
|
+
}))
|
|
140
|
+
], 10, _e)
|
|
141
|
+
]),
|
|
142
|
+
default: C(() => [
|
|
143
|
+
I.value ? (n(), k(H, {
|
|
144
|
+
key: 0,
|
|
145
|
+
label: t(_)("connect.whatsappBot.notificationGroup.title"),
|
|
146
|
+
disabled: r.value,
|
|
147
|
+
"onUpdate:modelValue": e[1] || (e[1] = (f) => A.value = !0)
|
|
148
|
+
}, {
|
|
149
|
+
prepend: C(() => [
|
|
150
|
+
T(U, {
|
|
151
|
+
name: "notifications",
|
|
152
|
+
size: "sm",
|
|
153
|
+
outline: "",
|
|
154
|
+
"aria-hidden": "true"
|
|
155
|
+
})
|
|
156
|
+
]),
|
|
157
|
+
_: 1
|
|
158
|
+
}, 8, ["label", "disabled"])) : D("", !0),
|
|
159
|
+
T(H, {
|
|
160
|
+
disabled: r.value,
|
|
161
|
+
"onUpdate:modelValue": e[2] || (e[2] = (f) => W())
|
|
162
|
+
}, {
|
|
163
|
+
prepend: C(() => [
|
|
164
|
+
T(U, {
|
|
165
|
+
name: "delete",
|
|
166
|
+
size: "sm",
|
|
167
|
+
outline: "",
|
|
168
|
+
class: "text-fm-color-typo-error",
|
|
169
|
+
"aria-hidden": "true"
|
|
170
|
+
})
|
|
171
|
+
]),
|
|
172
|
+
label: C(() => [
|
|
173
|
+
o("span", ge, s(t(_)("connect.common.delete")), 1)
|
|
174
|
+
]),
|
|
175
|
+
_: 1
|
|
176
|
+
}, 8, ["disabled"])
|
|
177
|
+
]),
|
|
178
|
+
_: 1
|
|
179
|
+
}, 8, ["disabled"])
|
|
180
|
+
])
|
|
181
|
+
]),
|
|
182
|
+
o("div", ye, [
|
|
183
|
+
T(re, { state: t(v) }, null, 8, ["state"]),
|
|
184
|
+
I.value && E.account.connectedAt ? (n(), u("span", be, s(t(_)("connect.whatsappBot.connectedSince", {
|
|
185
|
+
date: S(E.account.connectedAt)
|
|
186
|
+
})), 1)) : D("", !0)
|
|
187
|
+
]),
|
|
188
|
+
x.value ? (n(), u("p", we, s(x.value), 1)) : D("", !0)
|
|
189
|
+
], 2),
|
|
190
|
+
A.value ? (n(), k(se, {
|
|
191
|
+
key: 0,
|
|
192
|
+
modelValue: A.value,
|
|
193
|
+
"onUpdate:modelValue": e[4] || (e[4] = (f) => A.value = f),
|
|
194
|
+
account: E.account
|
|
195
|
+
}, null, 8, ["modelValue", "account"])) : D("", !0)
|
|
196
|
+
]);
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}), Be = { class: "mt-[24px] grid grid-cols-[repeat(auto-fill,minmax(min(300px,100%),1fr))] gap-[16px]" }, $e = /* @__PURE__ */ Q({
|
|
200
|
+
__name: "WhatsappAccountList",
|
|
201
|
+
props: {
|
|
202
|
+
accounts: {}
|
|
203
|
+
},
|
|
204
|
+
emits: ["removed"],
|
|
205
|
+
setup(E, { emit: i }) {
|
|
206
|
+
const l = i;
|
|
207
|
+
return (w, _) => (n(), u("ul", Be, [
|
|
208
|
+
(n(!0), u(J, null, q(E.accounts, (d) => (n(), k(ke, {
|
|
209
|
+
key: d.clientId,
|
|
210
|
+
account: d,
|
|
211
|
+
onRemoved: _[0] || (_[0] = (r) => l("removed", r))
|
|
212
|
+
}, null, 8, ["account"]))), 128))
|
|
213
|
+
]));
|
|
214
|
+
}
|
|
215
|
+
}), Ae = { class: "text-[18px] font-semibold" }, Ce = {
|
|
216
|
+
key: 0,
|
|
217
|
+
role: "status",
|
|
218
|
+
class: "flex flex-col items-center text-center gap-[8px] px-[8px] py-[40px]"
|
|
219
|
+
}, Te = { class: "text-[18px] font-semibold" }, Pe = { class: "text-[14px] text-fm-color-typo-secondary break-all" }, Se = {
|
|
220
|
+
key: 1,
|
|
221
|
+
class: "grid grid-cols-[minmax(0,1fr)_232px] xs:grid-cols-1 gap-[32px] p-[8px] xs:p-[0px]"
|
|
222
|
+
}, Fe = { class: "flex flex-col gap-[20px] text-[14px] leading-[20px]" }, Ie = { class: "text-fm-color-typo-secondary" }, Ee = { class: "flex flex-col gap-[14px]" }, Ve = { class: "w-[22px] h-[22px] shrink-0 rounded-full bg-fm-color-neutral-gray-100 flex items-center justify-center text-[12px] font-semibold" }, De = { key: 0 }, Le = { class: "font-semibold" }, Me = { class: "font-semibold" }, We = { class: "font-semibold" }, je = { class: "font-semibold" }, Oe = { key: 3 }, Ne = { class: "text-[12px] leading-[16px] text-fm-color-typo-tertiary" }, Re = { class: "relative w-[232px] h-[232px] xs:justify-self-center border border-fm-color-neutral-gray-100 rounded-[12px] flex items-center justify-center overflow-hidden" }, Ue = {
|
|
223
|
+
key: 0,
|
|
224
|
+
role: "status",
|
|
225
|
+
class: "flex flex-col items-center gap-[12px] text-[13px]"
|
|
226
|
+
}, He = {
|
|
227
|
+
key: 1,
|
|
228
|
+
class: "flex flex-col items-center text-center gap-[12px] p-[12px]"
|
|
229
|
+
}, ze = {
|
|
230
|
+
role: "alert",
|
|
231
|
+
class: "text-[14px] text-fm-color-typo-error"
|
|
232
|
+
}, Ge = ["src", "alt"], Qe = {
|
|
233
|
+
key: 3,
|
|
234
|
+
role: "status",
|
|
235
|
+
"aria-live": "polite",
|
|
236
|
+
class: "absolute inset-0 bg-fm-color-neutral-white/90 flex flex-col items-center justify-center gap-[10px] text-[13px] font-medium"
|
|
237
|
+
}, Ze = /* @__PURE__ */ Q({
|
|
238
|
+
__name: "WhatsappConnectDialog",
|
|
239
|
+
props: {
|
|
240
|
+
modelValue: { type: Boolean, required: !0 },
|
|
241
|
+
modelModifiers: {}
|
|
242
|
+
},
|
|
243
|
+
emits: ["update:modelValue"],
|
|
244
|
+
setup(E) {
|
|
245
|
+
const i = ee(E, "modelValue"), { t: l } = K(), w = b(""), _ = b(!1), d = b(""), r = b(!1), x = b();
|
|
246
|
+
let y, A, g;
|
|
247
|
+
function $() {
|
|
248
|
+
y == null || y.abort(), clearTimeout(A), A = void 0, clearTimeout(g), g = void 0;
|
|
249
|
+
}
|
|
250
|
+
async function V(v, p, h) {
|
|
251
|
+
if (!h.aborted) {
|
|
252
|
+
try {
|
|
253
|
+
const c = await G.getClient(v, p, h);
|
|
254
|
+
if (h.aborted) return;
|
|
255
|
+
if (r.value = c.status === "connected" || c.status === "connecting" && c.connectedAt !== null, c.status === "connected" && c.connectedAt !== null && c.profileStatus === "ready") {
|
|
256
|
+
$(), r.value = !1, x.value = c, g = setTimeout(() => {
|
|
257
|
+
i.value = !1;
|
|
258
|
+
}, 1800);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
if (c.status === "disconnected") {
|
|
262
|
+
$(), r.value = !1, w.value = "", d.value = l("connect.whatsappBot.errors.qrExpired");
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
} catch (c) {
|
|
266
|
+
if (h.aborted) return;
|
|
267
|
+
if (c instanceof ne && c.status === 409) {
|
|
268
|
+
$(), r.value = !1, w.value = "", d.value = l("connect.whatsappBot.errors.accountAlreadyLinked");
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
h.aborted || (A = setTimeout(() => {
|
|
273
|
+
V(v, p, h);
|
|
274
|
+
}, 2e3));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
async function P() {
|
|
278
|
+
$();
|
|
279
|
+
const v = new AbortController();
|
|
280
|
+
y = v, w.value = "", d.value = "", r.value = !1, x.value = void 0, _.value = !0;
|
|
281
|
+
try {
|
|
282
|
+
const p = N.getBusinessId();
|
|
283
|
+
if (!p)
|
|
284
|
+
throw new Error(l("connect.whatsappBot.errors.selectBusiness"));
|
|
285
|
+
const h = await G.createClient(
|
|
286
|
+
p,
|
|
287
|
+
v.signal
|
|
288
|
+
), c = await ce.toDataURL(h.qr, {
|
|
289
|
+
width: 224,
|
|
290
|
+
margin: 2,
|
|
291
|
+
errorCorrectionLevel: "M"
|
|
292
|
+
});
|
|
293
|
+
v.signal.aborted || (w.value = c, V(p, h.clientId, v.signal));
|
|
294
|
+
} catch (p) {
|
|
295
|
+
v.signal.aborted || (d.value = p instanceof Error ? p.message : l("connect.whatsappBot.errors.loadQr"));
|
|
296
|
+
} finally {
|
|
297
|
+
v.signal.aborted || (_.value = !1);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return Z(
|
|
301
|
+
i,
|
|
302
|
+
(v) => {
|
|
303
|
+
v ? P() : $();
|
|
304
|
+
},
|
|
305
|
+
{ immediate: !0 }
|
|
306
|
+
), Y($), (v, p) => {
|
|
307
|
+
const h = B("i18n-t"), c = B("FmCircularProgress"), I = B("FmButton"), R = B("FmDialog");
|
|
308
|
+
return n(), k(R, {
|
|
309
|
+
modelValue: i.value,
|
|
310
|
+
"onUpdate:modelValue": p[0] || (p[0] = (S) => i.value = S),
|
|
311
|
+
"min-width": "min(720px, calc(100% - 32px))",
|
|
312
|
+
"max-width": "720px",
|
|
313
|
+
"max-height": "90vh",
|
|
314
|
+
"dismiss-away": ""
|
|
315
|
+
}, {
|
|
316
|
+
"dialog-header": C(() => [
|
|
317
|
+
o("h2", Ae, s(t(l)("connect.whatsappBot.connectAccount")), 1)
|
|
318
|
+
]),
|
|
319
|
+
default: C(() => {
|
|
320
|
+
var S, W, F;
|
|
321
|
+
return [
|
|
322
|
+
x.value ? (n(), u("div", Ce, [
|
|
323
|
+
p[1] || (p[1] = o("div", {
|
|
324
|
+
"aria-hidden": "true",
|
|
325
|
+
class: "w-[64px] h-[64px] rounded-full bg-fm-color-system-success-100 text-fm-color-typo-success flex items-center justify-center mb-[8px]"
|
|
326
|
+
}, [
|
|
327
|
+
o("svg", {
|
|
328
|
+
width: "32",
|
|
329
|
+
height: "32",
|
|
330
|
+
viewBox: "0 0 24 24",
|
|
331
|
+
fill: "none",
|
|
332
|
+
stroke: "currentColor",
|
|
333
|
+
"stroke-width": "2.2",
|
|
334
|
+
"stroke-linecap": "round",
|
|
335
|
+
"stroke-linejoin": "round"
|
|
336
|
+
}, [
|
|
337
|
+
o("path", { d: "M20 6 9 17l-5-5" })
|
|
338
|
+
])
|
|
339
|
+
], -1)),
|
|
340
|
+
o("h3", Te, s(t(l)("connect.whatsappBot.accountConnected")), 1),
|
|
341
|
+
o("p", Pe, s(((S = x.value.account) == null ? void 0 : S.businessName) || ((W = x.value.account) == null ? void 0 : W.name) || t(l)("connect.whatsappBot.unnamedAccount")) + " · " + s(((F = x.value.account) == null ? void 0 : F.phoneNumber) || t(l)("connect.whatsappBot.phoneUnavailable")), 1)
|
|
342
|
+
])) : (n(), u("div", Se, [
|
|
343
|
+
o("div", Fe, [
|
|
344
|
+
o("p", Ie, s(t(l)("connect.whatsappBot.scanDescription")), 1),
|
|
345
|
+
o("ol", Ee, [
|
|
346
|
+
(n(), u(J, null, q(4, (a) => o("li", {
|
|
347
|
+
key: a,
|
|
348
|
+
class: "flex gap-[12px]"
|
|
349
|
+
}, [
|
|
350
|
+
o("span", Ve, s(a), 1),
|
|
351
|
+
a === 1 ? (n(), u("span", De, s(t(l)("connect.whatsappBot.steps.openApp")), 1)) : a === 2 ? (n(), k(h, {
|
|
352
|
+
key: 1,
|
|
353
|
+
keypath: "connect.whatsappBot.steps.openSettings",
|
|
354
|
+
tag: "span",
|
|
355
|
+
scope: "global"
|
|
356
|
+
}, {
|
|
357
|
+
menu: C(() => [
|
|
358
|
+
o("b", Le, s(t(l)("connect.whatsappBot.menu")), 1)
|
|
359
|
+
]),
|
|
360
|
+
settings: C(() => [
|
|
361
|
+
o("b", Me, s(t(l)("connect.whatsappBot.settings")), 1)
|
|
362
|
+
]),
|
|
363
|
+
_: 1
|
|
364
|
+
})) : a === 3 ? (n(), k(h, {
|
|
365
|
+
key: 2,
|
|
366
|
+
keypath: "connect.whatsappBot.steps.linkDevice",
|
|
367
|
+
tag: "span",
|
|
368
|
+
scope: "global"
|
|
369
|
+
}, {
|
|
370
|
+
linkedDevices: C(() => [
|
|
371
|
+
o("b", We, s(t(l)("connect.whatsappBot.linkedDevices")), 1)
|
|
372
|
+
]),
|
|
373
|
+
linkDevice: C(() => [
|
|
374
|
+
o("b", je, s(t(l)("connect.whatsappBot.linkDevice")), 1)
|
|
375
|
+
]),
|
|
376
|
+
_: 1
|
|
377
|
+
})) : (n(), u("span", Oe, s(t(l)("connect.whatsappBot.steps.scanQr")), 1))
|
|
378
|
+
])), 64))
|
|
379
|
+
]),
|
|
380
|
+
o("p", Ne, s(t(l)("connect.whatsappBot.connectionNote")), 1)
|
|
381
|
+
]),
|
|
382
|
+
o("div", Re, [
|
|
383
|
+
_.value ? (n(), u("div", Ue, [
|
|
384
|
+
T(c),
|
|
385
|
+
z(s(t(l)("connect.whatsappBot.generatingQr")), 1)
|
|
386
|
+
])) : d.value ? (n(), u("div", He, [
|
|
387
|
+
o("p", ze, s(d.value), 1),
|
|
388
|
+
T(I, {
|
|
389
|
+
label: t(l)("connect.whatsappBot.tryAgain"),
|
|
390
|
+
"prepend-icon": "refresh",
|
|
391
|
+
class: "!rounded-full [&_.label]:text-[14px]",
|
|
392
|
+
onClick: P
|
|
393
|
+
}, null, 8, ["label"])
|
|
394
|
+
])) : w.value ? (n(), u("img", {
|
|
395
|
+
key: 2,
|
|
396
|
+
src: w.value,
|
|
397
|
+
alt: t(l)("connect.whatsappBot.qrAlt"),
|
|
398
|
+
width: "224",
|
|
399
|
+
height: "224",
|
|
400
|
+
class: O({ "opacity-20": r.value })
|
|
401
|
+
}, null, 10, Ge)) : D("", !0),
|
|
402
|
+
r.value ? (n(), u("div", Qe, [
|
|
403
|
+
T(c),
|
|
404
|
+
z(" " + s(t(l)("connect.whatsappBot.connecting")), 1)
|
|
405
|
+
])) : D("", !0)
|
|
406
|
+
])
|
|
407
|
+
]))
|
|
408
|
+
];
|
|
409
|
+
}),
|
|
410
|
+
_: 1
|
|
411
|
+
}, 8, ["modelValue"]);
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
}), Je = { class: "mt-[24px] border border-fm-color-neutral-gray-200 rounded-[16px] px-[24px] py-[56px] flex flex-col items-center text-center gap-[8px]" }, Ke = { class: "text-[20px] leading-[28px] font-bold" }, Xe = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary max-w-[420px] [text-wrap:pretty]" }, Ye = /* @__PURE__ */ Q({
|
|
415
|
+
__name: "WhatsappEmptyState",
|
|
416
|
+
emits: ["connect"],
|
|
417
|
+
setup(E, { emit: i }) {
|
|
418
|
+
const l = i, { t: w } = K();
|
|
419
|
+
return (_, d) => {
|
|
420
|
+
const r = B("FmButton");
|
|
421
|
+
return n(), u("div", Je, [
|
|
422
|
+
d[1] || (d[1] = o("div", { class: "w-[72px] h-[72px] rounded-full bg-fm-color-primary-oats text-fm-color-primary flex items-center justify-center mb-[12px]" }, [
|
|
423
|
+
o("svg", {
|
|
424
|
+
width: "34",
|
|
425
|
+
height: "34",
|
|
426
|
+
viewBox: "0 0 24 24",
|
|
427
|
+
fill: "none",
|
|
428
|
+
stroke: "currentColor",
|
|
429
|
+
"stroke-width": "1.6",
|
|
430
|
+
"stroke-linecap": "round",
|
|
431
|
+
"stroke-linejoin": "round",
|
|
432
|
+
"aria-hidden": "true"
|
|
433
|
+
}, [
|
|
434
|
+
o("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
|
|
435
|
+
o("path", { d: "M9 10h.01M12 10h.01M15 10h.01" })
|
|
436
|
+
])
|
|
437
|
+
], -1)),
|
|
438
|
+
o("h2", Ke, s(t(w)("connect.whatsappBot.emptyTitle")), 1),
|
|
439
|
+
o("p", Xe, s(t(w)("connect.whatsappBot.emptyDescription")), 1),
|
|
440
|
+
T(r, {
|
|
441
|
+
class: "mt-[16px] !rounded-full !px-[20px] [&_.label]:text-[14px]",
|
|
442
|
+
label: t(w)("connect.whatsappBot.connectAccount"),
|
|
443
|
+
"prepend-icon": "add",
|
|
444
|
+
onClick: d[0] || (d[0] = (x) => l("connect"))
|
|
445
|
+
}, null, 8, ["label"])
|
|
446
|
+
]);
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
}), qe = { class: "px-[24px] xs:px-[12px] pt-[20px] pb-[40px] text-fm-color-typo-primary" }, et = { class: "flex items-center justify-between gap-[16px] flex-wrap min-h-[40px]" }, tt = { class: "flex items-center gap-8" }, ot = { class: "text-[24px] leading-[32px] font-semibold tracking-[-0.01em]" }, nt = {
|
|
450
|
+
key: 0,
|
|
451
|
+
class: "mt-[8px] w-full text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]"
|
|
452
|
+
}, at = ["aria-label"], st = {
|
|
453
|
+
key: 3,
|
|
454
|
+
role: "status",
|
|
455
|
+
class: "mt-[24px] py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
|
|
456
|
+
}, lt = {
|
|
457
|
+
key: 4,
|
|
458
|
+
class: "mt-[24px] border border-fm-color-neutral-gray-200 rounded-[16px] px-[24px] py-[56px] flex flex-col items-center text-center gap-[16px]"
|
|
459
|
+
}, rt = {
|
|
460
|
+
role: "alert",
|
|
461
|
+
class: "text-[14px] text-fm-color-typo-error"
|
|
462
|
+
}, _t = /* @__PURE__ */ Q({
|
|
463
|
+
__name: "WhatsappBot",
|
|
464
|
+
setup(E) {
|
|
465
|
+
const { t: i } = K(), l = te(), w = oe(), _ = j(() => {
|
|
466
|
+
var a, e;
|
|
467
|
+
return !!((e = (a = w.sessionUser.value) == null ? void 0 : a.role) != null && e.isAdmin);
|
|
468
|
+
}), d = b([]), r = b(!0), x = b("");
|
|
469
|
+
let y, A;
|
|
470
|
+
const g = b([]), $ = b(!0), V = b("");
|
|
471
|
+
let P, v;
|
|
472
|
+
const p = j(
|
|
473
|
+
() => d.value.filter((a) => le(a) !== void 0)
|
|
474
|
+
), h = j(() => [
|
|
475
|
+
{
|
|
476
|
+
label: i("connect.whatsappBot.accounts"),
|
|
477
|
+
value: M["$connect-WHATSAPP_BOT"],
|
|
478
|
+
badge: p.value.length
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
label: i("connect.whatsappBot.settings"),
|
|
482
|
+
value: M["$connect-WHATSAPP_BOT_SETTINGS"]
|
|
483
|
+
},
|
|
484
|
+
..._.value ? [
|
|
485
|
+
{
|
|
486
|
+
label: i("connect.whatsappBot.logs.title"),
|
|
487
|
+
value: M["$connect-WHATSAPP_BOT_LOGS"]
|
|
488
|
+
}
|
|
489
|
+
] : []
|
|
490
|
+
]), c = j(() => {
|
|
491
|
+
const a = l.currentRoute.value.name;
|
|
492
|
+
return h.value.some((e) => e.value === a) ? a : M["$connect-WHATSAPP_BOT"];
|
|
493
|
+
});
|
|
494
|
+
async function I(a = !1) {
|
|
495
|
+
clearTimeout(v), P == null || P.abort();
|
|
496
|
+
const e = new AbortController();
|
|
497
|
+
P = e, a || ($.value = !0, V.value = "");
|
|
498
|
+
try {
|
|
499
|
+
const m = N.getBusinessId();
|
|
500
|
+
if (!m)
|
|
501
|
+
throw new Error(i("connect.whatsappBot.errors.selectBusiness"));
|
|
502
|
+
const L = await G.listTickets(m, e.signal);
|
|
503
|
+
e.signal.aborted || (g.value = L, V.value = "");
|
|
504
|
+
} catch (m) {
|
|
505
|
+
e.signal.aborted || (V.value = m instanceof Error ? m.message : i("connect.whatsappBot.excludedAccounts.loadError"));
|
|
506
|
+
} finally {
|
|
507
|
+
e.signal.aborted || ($.value = !1, v = setTimeout(() => void I(!0), 1e4));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
function R(a) {
|
|
511
|
+
g.value = g.value.filter((e) => e.id !== a), I(!0);
|
|
512
|
+
}
|
|
513
|
+
async function S(a = !1) {
|
|
514
|
+
clearTimeout(A), y == null || y.abort();
|
|
515
|
+
const e = new AbortController();
|
|
516
|
+
y = e, a || (r.value = !0, x.value = "");
|
|
517
|
+
try {
|
|
518
|
+
const m = N.getBusinessId();
|
|
519
|
+
if (!m)
|
|
520
|
+
throw new Error(i("connect.whatsappBot.errors.selectBusiness"));
|
|
521
|
+
const L = await G.listClients(m, e.signal);
|
|
522
|
+
e.signal.aborted || (d.value = L, x.value = "");
|
|
523
|
+
} catch (m) {
|
|
524
|
+
!e.signal.aborted && !a && (x.value = m instanceof Error ? m.message : i("connect.whatsappBot.errors.loadSessions"));
|
|
525
|
+
} finally {
|
|
526
|
+
e.signal.aborted || (r.value = !1, A = setTimeout(() => void S(!0), 1e4));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function W(a) {
|
|
530
|
+
d.value = d.value.filter(
|
|
531
|
+
(e) => e.clientId !== a
|
|
532
|
+
), S(!0);
|
|
533
|
+
}
|
|
534
|
+
const F = b(!1);
|
|
535
|
+
return Z(F, (a) => {
|
|
536
|
+
a || S();
|
|
537
|
+
}), Z(
|
|
538
|
+
() => N.getBusinessId(),
|
|
539
|
+
() => {
|
|
540
|
+
F.value = !1, d.value = [], g.value = [], S(), I();
|
|
541
|
+
},
|
|
542
|
+
{ immediate: !0 }
|
|
543
|
+
), Y(() => {
|
|
544
|
+
y == null || y.abort(), clearTimeout(A), P == null || P.abort(), clearTimeout(v);
|
|
545
|
+
}), (a, e) => {
|
|
546
|
+
const m = B("FmPill"), L = B("FmButton"), U = B("RouterLink"), H = B("RouterView"), X = B("FmCircularProgress");
|
|
547
|
+
return n(), u(J, null, [
|
|
548
|
+
o("div", qe, [
|
|
549
|
+
o("div", et, [
|
|
550
|
+
o("div", tt, [
|
|
551
|
+
o("h1", ot, s(t(i)("connect.navigation.whatsappBot")), 1),
|
|
552
|
+
T(m, { variant: "beta" })
|
|
553
|
+
]),
|
|
554
|
+
c.value === t(M)["$connect-WHATSAPP_BOT"] && p.value.length ? (n(), k(L, {
|
|
555
|
+
key: 0,
|
|
556
|
+
label: t(i)("connect.whatsappBot.connectAccountCta"),
|
|
557
|
+
"prepend-icon": "add",
|
|
558
|
+
class: "!h-[36px] !rounded-full !px-[16px] [&_.label]:text-[14px]",
|
|
559
|
+
onClick: e[0] || (e[0] = (f) => F.value = !0)
|
|
560
|
+
}, null, 8, ["label"])) : D("", !0)
|
|
561
|
+
]),
|
|
562
|
+
p.value.length ? (n(), u("p", nt, s(t(i)("connect.whatsappBot.description")), 1)) : D("", !0),
|
|
563
|
+
o("nav", {
|
|
564
|
+
"aria-label": t(i)("connect.navigation.whatsappBot"),
|
|
565
|
+
class: "mt-[16px] flex gap-[24px] overflow-x-auto border-b border-fm-color-neutral-gray-100"
|
|
566
|
+
}, [
|
|
567
|
+
(n(!0), u(J, null, q(h.value, (f) => (n(), k(U, {
|
|
568
|
+
key: f.value,
|
|
569
|
+
to: { name: f.value },
|
|
570
|
+
"aria-current": c.value === f.value ? "page" : void 0,
|
|
571
|
+
class: O([
|
|
572
|
+
"flex h-[40px] shrink-0 items-center gap-[6px] whitespace-nowrap border-b-[2px] px-[2px] text-[14px] leading-[20px] font-medium no-underline transition-colors hover:text-fm-color-primary focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-inset focus-visible:ring-fm-color-primary",
|
|
573
|
+
c.value === f.value ? "border-fm-color-primary text-fm-color-primary" : "border-transparent text-fm-color-typo-secondary"
|
|
574
|
+
])
|
|
575
|
+
}, {
|
|
576
|
+
default: C(() => [
|
|
577
|
+
z(s(f.label) + " ", 1),
|
|
578
|
+
f.badge ? (n(), u("span", {
|
|
579
|
+
key: 0,
|
|
580
|
+
class: O([
|
|
581
|
+
"min-w-[20px] rounded-full px-[6px] text-center text-[12px] leading-[20px] font-semibold tabular-nums",
|
|
582
|
+
c.value === f.value ? "bg-fm-color-primary-oats text-fm-color-primary" : "bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
|
|
583
|
+
])
|
|
584
|
+
}, s(f.badge), 3)) : D("", !0)
|
|
585
|
+
]),
|
|
586
|
+
_: 2
|
|
587
|
+
}, 1032, ["to", "aria-current", "class"]))), 128))
|
|
588
|
+
], 8, at),
|
|
589
|
+
c.value === t(M)["$connect-WHATSAPP_BOT_SETTINGS"] ? (n(), k(H, {
|
|
590
|
+
key: 1,
|
|
591
|
+
tickets: g.value,
|
|
592
|
+
"tickets-loading": $.value,
|
|
593
|
+
"tickets-error": V.value,
|
|
594
|
+
onRetryExclusions: e[1] || (e[1] = (f) => I()),
|
|
595
|
+
onExcludedAccountRemoved: R
|
|
596
|
+
}, null, 8, ["tickets", "tickets-loading", "tickets-error"])) : c.value === t(M)["$connect-WHATSAPP_BOT_LOGS"] ? (n(), k(H, {
|
|
597
|
+
key: 2,
|
|
598
|
+
accounts: p.value
|
|
599
|
+
}, null, 8, ["accounts"])) : r.value ? (n(), u("div", st, [
|
|
600
|
+
T(X),
|
|
601
|
+
z(" " + s(t(i)("connect.whatsappBot.loadingSessions")), 1)
|
|
602
|
+
])) : x.value ? (n(), u("div", lt, [
|
|
603
|
+
o("p", rt, s(x.value), 1),
|
|
604
|
+
T(L, {
|
|
605
|
+
label: t(i)("connect.whatsappBot.tryAgain"),
|
|
606
|
+
"prepend-icon": "refresh",
|
|
607
|
+
class: "!rounded-full [&_.label]:text-[14px]",
|
|
608
|
+
onClick: e[2] || (e[2] = (f) => S())
|
|
609
|
+
}, null, 8, ["label"])
|
|
610
|
+
])) : p.value.length ? (n(), k($e, {
|
|
611
|
+
key: 5,
|
|
612
|
+
accounts: p.value,
|
|
613
|
+
onRemoved: W
|
|
614
|
+
}, null, 8, ["accounts"])) : (n(), k(Ye, {
|
|
615
|
+
key: 6,
|
|
616
|
+
onConnect: e[3] || (e[3] = (f) => F.value = !0)
|
|
617
|
+
}))
|
|
618
|
+
]),
|
|
619
|
+
T(Ze, {
|
|
620
|
+
modelValue: F.value,
|
|
621
|
+
"onUpdate:modelValue": e[4] || (e[4] = (f) => F.value = f)
|
|
622
|
+
}, null, 8, ["modelValue"])
|
|
623
|
+
], 64);
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
});
|
|
627
|
+
export {
|
|
628
|
+
_t as default
|
|
629
|
+
};
|