@feedmepos/mf-connect 0.1.127-prod → 0.1.128-prod

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 (137) hide show
  1. package/dist/{App-BMF6m0GU.js → App-DFXou0ZK.js} +10 -10
  2. package/dist/{Bin-Dkn-CjZE.js → Bin-ril4yEp7.js} +8 -8
  3. package/dist/{Broadcast-DqaP4ON2.js → Broadcast-CcseZmao.js} +11 -11
  4. package/dist/{CampaignAnalytic-2Iuxh8-x.js → CampaignAnalytic-DaJ5a6G1.js} +97 -97
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C8MlNehK.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CsmgbhtH.js} +10 -10
  6. package/dist/{Card-Cv9eldq8.js → Card-D7sTDXgf.js} +23 -23
  7. package/dist/{Collections-CK-hxHpa.js → Collections-C6d4vkox.js} +9 -9
  8. package/dist/{Credit-CDE4ACVm.js → Credit-B9JCYQYi.js} +11 -11
  9. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CTvIDOWy.js → DateRangeChip.vue_vue_type_script_setup_true_lang-CwD5dRnJ.js} +1 -1
  10. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-DUJKivXA.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-Cteezb57.js} +82 -82
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CuPhm1uG.js → EffectSheet.vue_vue_type_style_index_0_lang-BMxA26t5.js} +6 -6
  12. package/dist/{Experience-lLK_RR69.js → Experience-pBNjY5aC.js} +12 -12
  13. package/dist/{FileSaver.min-zDxJKfBO.js → FileSaver.min-BdA7jj3J.js} +1 -1
  14. package/dist/{Game-DCdfJkil.js → Game-Ba1LqaLj.js} +12 -12
  15. package/dist/{GiftCardSetup-DfF1OpFk.js → GiftCardSetup-DteySO0t.js} +10 -10
  16. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Dbx9bwJM.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-DxFGFA_U.js} +7 -7
  17. package/dist/{Goals-t0wbcWxG.js → Goals-D4rLwe3y.js} +4 -4
  18. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-Bur6iCYa.js → ImageInput.vue_vue_type_script_setup_true_lang-C-1uplPm.js} +1 -1
  19. package/dist/{Index-BUF8U-h8.js → Index-DZ9bEViq.js} +10 -10
  20. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-kIOc-Px5.js → LocationPicker.vue_vue_type_script_setup_true_lang-DS3y4uib.js} +1 -1
  21. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DRmLpXsg.js → LottieAnimation.vue_vue_type_script_setup_true_lang-BTHmofSe.js} +1 -1
  22. package/dist/{LoyaltyDashboard-8laUXBGQ.js → LoyaltyDashboard-CBMyLX7W.js} +82 -82
  23. package/dist/{MainLayout-BeuKKVNP.js → MainLayout-B3-DumYs.js} +1 -1
  24. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-C7E3h_Zr.js → MainLayout.vue_vue_type_script_setup_true_lang-BWOWZMYx.js} +3 -3
  25. package/dist/{Marketing-DZG0oIs-.js → Marketing-CJiu6eP4.js} +4 -4
  26. package/dist/{MarketingMaterialEdit--RDayaUN.js → MarketingMaterialEdit-BuHpXGwZ.js} +6 -6
  27. package/dist/{Member-DeEQr2ef.js → Member-AOxxLQ-x.js} +7 -7
  28. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-Dmf4WtSt.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-cGglvqwB.js} +25 -25
  29. package/dist/{MemberImportHistory-DMXVl1qI.js → MemberImportHistory-o-ruPMEe.js} +7 -7
  30. package/dist/{MemberList-zqeFDkEZ.js → MemberList-BkX_jgos.js} +14 -14
  31. package/dist/{MemberTransactions-BBQPNfFG.js → MemberTransactions-Bnc3BWr5.js} +1 -1
  32. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-C_8yL5GL.js → MessageInput.vue_vue_type_script_setup_true_lang-DoUw4U88.js} +10 -10
  33. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-9r-eGARm.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-BHprSEKu.js} +1 -1
  34. package/dist/{Mission-TO8w3ucB.js → Mission-D80DxR7z.js} +13 -13
  35. package/dist/{Overview-D6YBYVxK.js → Overview-9gdETQLU.js} +4 -4
  36. package/dist/{Overview-CPUpEzPd.js → Overview-jb3HWI09.js} +21 -21
  37. package/dist/{Point-BSq4CRcb.js → Point-Pf_s2Ggb.js} +13 -13
  38. package/dist/{Promotion-DgPNNfk7.js → Promotion-BjjugEKH.js} +13 -13
  39. package/dist/{Queue-CYyabVYT.js → Queue-CVWdBEvK.js} +13 -13
  40. package/dist/{Record-n7s29IZH.js → Record-BS9lp0Cs.js} +9 -9
  41. package/dist/{Review-DIYulCVl.js → Review-1MRQGLAX.js} +2 -2
  42. package/dist/{ReviewFacebookCallback-D07x5BnV.js → ReviewFacebookCallback-DuuQxEIK.js} +5 -5
  43. package/dist/{ReviewGoogleCallback-CnESXIH-.js → ReviewGoogleCallback-8kzG-TMh.js} +5 -5
  44. package/dist/{Reward-D_L2DgT9.js → Reward-UPonEShz.js} +16 -16
  45. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Dsk2VqB8.js → RewardGroup.vue_vue_type_script_setup_true_lang-CW-EEgDZ.js} +14 -14
  46. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BjyiiTSY.js → RuleGroup.vue_vue_type_script_setup_true_lang-BmTEULNC.js} +16 -16
  47. package/dist/{Segment-BbGE6AOZ.js → Segment-BsNstBo-.js} +28 -28
  48. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-xrdOyWX8.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-3uc5TjrH.js} +15 -15
  49. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-CTsORsDg.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CKc0Q7pK.js} +4 -4
  50. package/dist/{Setting-B9i2ufr7.js → Setting-BD-fl3v8.js} +15 -15
  51. package/dist/{SettingAdvertisements-Cuczz1wK.js → SettingAdvertisements-DG1btpAQ.js} +12 -12
  52. package/dist/{Settings-CCSXjpUC.js → Settings-LPdO0Djy.js} +5 -5
  53. package/dist/{Store-CoxREXJ-.js → Store-CQe1YA-D.js} +27 -27
  54. package/dist/{StoreRewards-CzkznvA1.js → StoreRewards-C7z5eJc4.js} +15 -15
  55. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BtwDM2Fr.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CvX_M1KW.js} +25 -25
  56. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-tSfwcDBG.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-DmeOGncB.js} +2 -2
  57. package/dist/{Tier-DyOlzjE0.js → Tier-BBb_E8_V.js} +26 -26
  58. package/dist/{Title-C3__B-bw.js → Title-CjJaca4P.js} +24 -24
  59. package/dist/{Transaction-B_v-lbed.js → Transaction-Dn-EPCom.js} +2 -2
  60. package/dist/{Upselling-D_5nBzIN.js → Upselling-DB8HU6B_.js} +3 -3
  61. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CE5eo992.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BG2o3Nip.js} +6 -6
  62. package/dist/{Voucher-KxXwge4O.js → Voucher-Cwg3WelV.js} +18 -18
  63. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-nbLXmJ5Q.js → VoucherEditor.vue_vue_type_script_setup_true_lang-CRz0wdSO.js} +12 -12
  64. package/dist/{WhatsappAccount-C8kinTmg.js → WhatsappAccount--SMCex1D.js} +6 -6
  65. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-ydBfMtzM.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BpZ0_NtK.js} +1 -1
  66. package/dist/WhatsappBot-2BTZU0cI.js +882 -0
  67. package/dist/{WhatsappBotLogs-Dm0HJh_f.js → WhatsappBotLogs-nGIYzZCU.js} +66 -66
  68. package/dist/{WhatsappBotSettings-BNZcj26j.js → WhatsappBotSettings-DBx7ezqA.js} +5 -5
  69. package/dist/{WhatsappLayout-BvBN7H-y.js → WhatsappLayout-DK2idBeB.js} +3 -3
  70. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BzKwTs9R.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-B-pAId0k.js} +3 -3
  71. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BY8t6jtW.js → ZodTextField.vue_vue_type_script_setup_true_lang-DYpCPJDx.js} +2 -2
  72. package/dist/{app-uud8OgB9.js → app-DjtVpjOD.js} +248 -248
  73. package/dist/app.js +1 -1
  74. package/dist/{base.export-Bfxt84QY.js → base.export-Dc9I7xbt.js} +2 -2
  75. package/dist/{business-77FEeeil.js → business-C0Ej4JRP.js} +1 -1
  76. package/dist/{campaign-CWyU-r8u.js → campaign-BNgMmhg6.js} +9 -9
  77. package/dist/{campaign-6WrFDF05.js → campaign-U8KBANd_.js} +2 -2
  78. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-mYG3oWwU.js} +1 -1
  79. package/dist/{campaign.fn-Ci_av9lZ.js → campaign.fn-BaBPV7He.js} +39 -39
  80. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-BtBBkbIB.js} +1 -1
  81. package/dist/{collection.fn-CO-YhhUM.js → collection.fn-lFr9HoHC.js} +2 -2
  82. package/dist/{currency-kWhKZnhN.js → currency-B6GBpIWb.js} +1 -1
  83. package/dist/{effect-CjSyUbur.js → effect-DmzU8TpX.js} +1 -1
  84. package/dist/{email-addresses-C_yrJd12.js → email-addresses-s_oiQY8W.js} +2 -2
  85. package/dist/{feature-flag-DcM82jeJ.js → feature-flag-CRbNgxfa.js} +1 -1
  86. package/dist/{helper-G8MwkrFo.js → helper-0o3cPptM.js} +1 -1
  87. package/dist/index-B6BmfoiZ.js +10767 -0
  88. package/dist/{index-6Ey495tl.js → index-BECZ4ORu.js} +1 -1
  89. package/dist/{index-DGrPvdRc.js → index-BMG5fllq.js} +4 -4
  90. package/dist/{index-CqvjZF-j.js → index-BXi5bQbd.js} +1 -1
  91. package/dist/{index-CxyO5j1a.js → index-Bql1JMH9.js} +2 -2
  92. package/dist/{index-h2p2DjKy.js → index-BvoYHJ0i.js} +2 -2
  93. package/dist/{index-DgT4P2_R.js → index-C9MKLJzw.js} +4 -4
  94. package/dist/{index-sPf1Rhez.js → index-CPByCjHI.js} +9 -9
  95. package/dist/{index-B3LCTMwV.js → index-CZWCtODZ.js} +68 -60
  96. package/dist/{index-ivVytFih.js → index-CigqpRCP.js} +9 -9
  97. package/dist/{index-BXSokNlS.js → index-Cnl3vaVR.js} +18 -18
  98. package/dist/{index-L_2hhvso.js → index-CxxWGkQz.js} +2 -2
  99. package/dist/{index-Dv5Ja20d.js → index-DLcl6mHQ.js} +1 -1
  100. package/dist/{index-Cj85mCmr.js → index-DMgSW1aH.js} +4 -4
  101. package/dist/{index-BNjHmUyd.js → index-DNx-iJd1.js} +2 -2
  102. package/dist/{index-RtamQHhy.js → index-DQLDjCeb.js} +1 -1
  103. package/dist/{index-3axft-Vz.js → index-DXV_Kdhp.js} +5 -5
  104. package/dist/index-Df5CnMjC.js +19528 -0
  105. package/dist/{index-Ba4Q_XWF.js → index-DphGTJkl.js} +1 -1
  106. package/dist/{index-CiFPNxgn.js → index-NOeUp1Wc.js} +6 -6
  107. package/dist/{index-CVVLKJj_.js → index-NhHbOATm.js} +6 -6
  108. package/dist/{index-Dkud56R0.js → index-iEzy3892.js} +1 -1
  109. package/dist/{index.esm2017-DiUbRDfz.js → index.esm2017-DpKkF6uX.js} +1 -1
  110. package/dist/{loading-BdpH3z-q.js → loading-nQaPRntd.js} +1 -1
  111. package/dist/{lodash-DcC4G06s.js → lodash-B6558zRv.js} +1 -1
  112. package/dist/{member-import-C99OxU-w.js → member-import-DWDpO4uU.js} +2 -2
  113. package/dist/{membership-O5EN0QMl.js → membership-BY1-idAv.js} +3 -3
  114. package/dist/{money-CYS7zoiT.js → money-DE62jPYV.js} +1 -1
  115. package/dist/{number-D_C66osx.js → number-C9mUt-Ac.js} +1 -1
  116. package/dist/{objectid-Dd0NRad7.js → objectid-DyUyXFvt.js} +10 -10
  117. package/dist/{onboarding-DGx34lkW.js → onboarding-OTAVtlNj.js} +3 -3
  118. package/dist/{onboardingSetup-ALOoxDHE.js → onboardingSetup-DhwhJk-r.js} +2 -2
  119. package/dist/{plugins-CVh8eTG-.js → plugins-CpxP-Bn_.js} +3 -3
  120. package/dist/{reward-8sP3d8ie.js → reward-yx-Ttob3.js} +1 -1
  121. package/dist/{rule-BGMBiCRZ.js → rule-C_T37PuL.js} +3 -3
  122. package/dist/{rule-builder-DcPK2oqo.js → rule-builder-WoEQdgK2.js} +1 -1
  123. package/dist/{template-Bku-aSPA.js → template-AnoXsK9Y.js} +7 -7
  124. package/dist/timezone-BxJDy-bY.js +19 -0
  125. package/dist/{transaction.fn-Dmla3R1q.js → transaction.fn-4IcKHgri.js} +2 -2
  126. package/dist/{trigger-CArDddXr.js → trigger-8zSNA5H1.js} +5 -5
  127. package/dist/{useMarketingMaterialActions-BX5Ynq8O.js → useMarketingMaterialActions-CXjA7dhm.js} +4 -4
  128. package/dist/{usePagination-BdgLVPuo.js → usePagination-BECgW_Yq.js} +1 -1
  129. package/dist/{user-BgTKHjea.js → user-Czn9R1f-.js} +1 -1
  130. package/dist/{vue-i18n-DMEbesBm.js → vue-i18n-BJWf_QrH.js} +162 -162
  131. package/dist/{xlsx-WIRNQZAx.js → xlsx-3kbv63FT.js} +584 -584
  132. package/dist/{zod-Dh_CVWJN.js → zod-DMdtnaR4.js} +1 -1
  133. package/package.json +1 -1
  134. package/dist/WhatsappBot-BuD45ou8.js +0 -878
  135. package/dist/index-BqHB3euS.js +0 -27551
  136. package/dist/index-C_H8jFYf.js +0 -2743
  137. package/dist/timezone-DML8BuIK.js +0 -20
@@ -0,0 +1,882 @@
1
+ import { defineComponent as Y, ref as k, computed as j, watch as H, onBeforeUnmount as te, resolveComponent as $, openBlock as o, createElementBlock as i, createElementVNode as t, normalizeClass as R, unref as e, toDisplayString as a, createBlock as T, withCtx as S, createTextVNode as Q, createVNode as C, createCommentVNode as E, Fragment as G, renderList as J, mergeModels as ae, useModel as le, isRef as ie } from "vue";
2
+ import { u as X } from "./vue-i18n-BJWf_QrH.js";
3
+ import { useRouter as pe } from "vue-router";
4
+ import { useCoreStore as se } from "@feedmepos/mf-common";
5
+ import { S as K, a as re } from "./index-DXV_Kdhp.js";
6
+ import { w as Z } from "./index-Cnl3vaVR.js";
7
+ import { u as ue, _ as de, w as me } from "./WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-B-pAId0k.js";
8
+ import { R as N } from "./app-DjtVpjOD.js";
9
+ import { _ as fe } from "./WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BpZ0_NtK.js";
10
+ import { b as ce } from "./browser-BSAOEeIM.js";
11
+ import { F as xe } from "./index-CZWCtODZ.js";
12
+ const ve = { class: "min-w-0" }, he = { class: "flex items-center gap-[12px]" }, _e = ["src"], ge = { key: 1 }, ye = { class: "min-w-0 flex-1" }, be = ["title"], we = { key: 1 }, Be = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary break-all" }, ke = { class: "relative z-10 shrink-0" }, $e = ["aria-label", "title", "aria-expanded", "disabled", "aria-busy"], Ce = { class: "text-[14px] text-fm-color-typo-error" }, Ae = { class: "flex items-center justify-between flex-wrap gap-[8px] border-t border-fm-color-neutral-gray-100 pt-[12px]" }, Ie = {
13
+ key: 0,
14
+ class: "text-[12px] text-fm-color-typo-tertiary"
15
+ }, Te = {
16
+ key: 0,
17
+ role: "alert",
18
+ class: "text-[14px] text-fm-color-typo-error"
19
+ }, Fe = /* @__PURE__ */ Y({
20
+ __name: "WhatsappAccountCard",
21
+ props: {
22
+ account: {}
23
+ },
24
+ emits: ["removed"],
25
+ setup(I, { emit: f }) {
26
+ const v = I, l = f, { t: n, locale: h } = X(), c = k(!1), y = k(""), x = k(!1), b = k(!1);
27
+ let m;
28
+ const {
29
+ name: A,
30
+ phoneNumber: w,
31
+ initials: L,
32
+ state: B,
33
+ avatarColor: W,
34
+ profilePictureUrl: p,
35
+ profilePictureFailed: u
36
+ } = ue(() => v.account), d = j(() => B.value === "connected"), g = j(() => ({
37
+ name: N["$connect-WHATSAPP_ACCOUNT"],
38
+ params: { clientId: v.account.clientId }
39
+ }));
40
+ function _(P) {
41
+ return new Intl.DateTimeFormat(h.value, {
42
+ year: "numeric",
43
+ month: "short",
44
+ day: "numeric"
45
+ }).format(new Date(P));
46
+ }
47
+ async function M() {
48
+ if (c.value) return;
49
+ const P = K.getBusinessId();
50
+ if (!P) {
51
+ y.value = n("connect.whatsappBot.errors.selectBusiness");
52
+ return;
53
+ }
54
+ const s = v.account.clientId, r = new AbortController();
55
+ m = r, c.value = !0, y.value = "";
56
+ try {
57
+ await Z.deleteClient(P, s, r.signal), r.signal.aborted || l("removed", s);
58
+ } catch {
59
+ r.signal.aborted || (y.value = n("connect.whatsappBot.errors.removeAccount"));
60
+ } finally {
61
+ m === r && (m = void 0, c.value = !1);
62
+ }
63
+ }
64
+ function D() {
65
+ m == null || m.abort(), m = void 0, c.value = !1, y.value = "";
66
+ }
67
+ return H(
68
+ () => K.getBusinessId(),
69
+ () => {
70
+ D(), b.value = !1;
71
+ }
72
+ ), te(D), (P, s) => {
73
+ const r = $("RouterLink"), V = $("FmCircularProgress"), O = $("FmIcon"), q = $("FmMenuItem"), ee = $("FmMenu");
74
+ return o(), i("li", ve, [
75
+ t("div", {
76
+ class: R(["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", {
77
+ "cursor-pointer transition-shadow hover:border-fm-color-neutral-gray-200 hover:fm-shadow-light-100": d.value
78
+ }])
79
+ }, [
80
+ t("div", he, [
81
+ t("div", {
82
+ "aria-hidden": "true",
83
+ class: R(["w-[48px] h-[48px] rounded-full overflow-hidden shrink-0 flex items-center justify-center text-[16px] font-semibold text-fm-color-typo-white", e(W)])
84
+ }, [
85
+ e(p) && !e(u) ? (o(), i("img", {
86
+ key: 0,
87
+ src: e(p),
88
+ alt: "",
89
+ class: "w-full h-full object-cover",
90
+ referrerpolicy: "no-referrer",
91
+ onError: s[0] || (s[0] = (U) => u.value = !0)
92
+ }, null, 40, _e)) : (o(), i("span", ge, a(e(L)), 1))
93
+ ], 2),
94
+ t("div", ye, [
95
+ t("h2", {
96
+ class: "text-[16px] leading-[24px] font-semibold truncate",
97
+ title: e(A)
98
+ }, [
99
+ d.value ? (o(), T(r, {
100
+ key: 0,
101
+ to: g.value,
102
+ 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]"
103
+ }, {
104
+ default: S(() => [
105
+ Q(a(e(A)), 1)
106
+ ]),
107
+ _: 1
108
+ }, 8, ["to"])) : (o(), i("span", we, a(e(A)), 1))
109
+ ], 8, be),
110
+ t("p", Be, a(e(w)), 1)
111
+ ]),
112
+ t("div", ke, [
113
+ C(ee, {
114
+ placement: "bottom-end",
115
+ width: 220,
116
+ disabled: c.value,
117
+ "stop-click-propagation": "",
118
+ onMenuChanged: s[3] || (s[3] = (U) => x.value = U)
119
+ }, {
120
+ "menu-button": S(() => [
121
+ t("button", {
122
+ type: "button",
123
+ "aria-label": e(n)("connect.whatsappBot.moreActions"),
124
+ title: e(n)("connect.whatsappBot.moreActions"),
125
+ "aria-haspopup": "menu",
126
+ "aria-expanded": x.value,
127
+ disabled: c.value,
128
+ "aria-busy": c.value,
129
+ class: R(["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": x.value }])
130
+ }, [
131
+ c.value ? (o(), T(V, {
132
+ key: 0,
133
+ size: "md",
134
+ "aria-hidden": "true"
135
+ })) : (o(), T(O, {
136
+ key: 1,
137
+ name: "more_vert",
138
+ size: "sm",
139
+ "aria-hidden": "true"
140
+ }))
141
+ ], 10, $e)
142
+ ]),
143
+ default: S(() => [
144
+ d.value ? (o(), T(q, {
145
+ key: 0,
146
+ label: e(n)("connect.whatsappBot.notificationGroup.title"),
147
+ disabled: c.value,
148
+ "onUpdate:modelValue": s[1] || (s[1] = (U) => b.value = !0)
149
+ }, {
150
+ prepend: S(() => [
151
+ C(O, {
152
+ name: "notifications",
153
+ size: "sm",
154
+ outline: "",
155
+ "aria-hidden": "true"
156
+ })
157
+ ]),
158
+ _: 1
159
+ }, 8, ["label", "disabled"])) : E("", !0),
160
+ C(q, {
161
+ disabled: c.value,
162
+ "onUpdate:modelValue": s[2] || (s[2] = (U) => M())
163
+ }, {
164
+ prepend: S(() => [
165
+ C(O, {
166
+ name: "delete",
167
+ size: "sm",
168
+ outline: "",
169
+ class: "text-fm-color-typo-error",
170
+ "aria-hidden": "true"
171
+ })
172
+ ]),
173
+ label: S(() => [
174
+ t("span", Ce, a(e(n)("connect.common.delete")), 1)
175
+ ]),
176
+ _: 1
177
+ }, 8, ["disabled"])
178
+ ]),
179
+ _: 1
180
+ }, 8, ["disabled"])
181
+ ])
182
+ ]),
183
+ t("div", Ae, [
184
+ C(fe, { state: e(B) }, null, 8, ["state"]),
185
+ d.value && I.account.connectedAt ? (o(), i("span", Ie, a(e(n)("connect.whatsappBot.connectedSince", {
186
+ date: _(I.account.connectedAt)
187
+ })), 1)) : E("", !0)
188
+ ]),
189
+ y.value ? (o(), i("p", Te, a(y.value), 1)) : E("", !0)
190
+ ], 2),
191
+ b.value ? (o(), T(de, {
192
+ key: 0,
193
+ modelValue: b.value,
194
+ "onUpdate:modelValue": s[4] || (s[4] = (U) => b.value = U),
195
+ account: I.account
196
+ }, null, 8, ["modelValue", "account"])) : E("", !0)
197
+ ]);
198
+ };
199
+ }
200
+ }), Se = { class: "mt-[24px] grid grid-cols-[repeat(auto-fill,minmax(min(300px,100%),1fr))] gap-[16px]" }, Pe = /* @__PURE__ */ Y({
201
+ __name: "WhatsappAccountList",
202
+ props: {
203
+ accounts: {}
204
+ },
205
+ emits: ["removed"],
206
+ setup(I, { emit: f }) {
207
+ const v = f;
208
+ return (l, n) => (o(), i("ul", Se, [
209
+ (o(!0), i(G, null, J(I.accounts, (h) => (o(), T(Fe, {
210
+ key: h.clientId,
211
+ account: h,
212
+ onRemoved: n[0] || (n[0] = (c) => v("removed", c))
213
+ }, null, 8, ["account"]))), 128))
214
+ ]));
215
+ }
216
+ }), z = [
217
+ { key: "autoReplies", icon: "chat" },
218
+ { key: "settings", icon: "menu_book" },
219
+ { key: "escalations", icon: "notifications" },
220
+ { key: "excludedAccounts", icon: "pause_circle" }
221
+ ], Ve = { class: "text-[18px] font-semibold" }, Le = { class: "flex flex-col gap-[24px] py-[8px]" }, Me = { class: "flex flex-col gap-[12px]" }, De = { class: "text-[13px] font-medium text-fm-color-typo-secondary" }, Ee = {
222
+ "aria-hidden": "true",
223
+ class: "flex gap-[8px]"
224
+ }, We = {
225
+ "aria-live": "polite",
226
+ "aria-atomic": "true",
227
+ class: "flex min-h-[260px] flex-col items-start gap-[16px]"
228
+ }, je = { class: "sr-only" }, Oe = {
229
+ "aria-hidden": "true",
230
+ class: "flex h-[56px] w-[56px] items-center justify-center rounded-[16px] bg-fm-color-primary-oats text-fm-color-primary"
231
+ }, Ue = { class: "flex flex-col gap-[8px]" }, Ne = { class: "text-[20px] leading-[28px] font-semibold" }, Ge = { class: "text-[14px] leading-[22px] text-fm-color-typo-secondary" }, Re = {
232
+ key: 0,
233
+ class: "flex w-full flex-col items-center gap-[12px]"
234
+ }, He = {
235
+ key: 0,
236
+ class: "flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
237
+ }, ze = {
238
+ role: "alert",
239
+ class: "text-[14px] text-fm-color-typo-error"
240
+ }, Qe = ["src", "alt"], Ke = { class: "flex w-full min-w-0 flex-col gap-[6px]" }, Ye = { class: "text-[13px] font-medium text-fm-color-typo-secondary" }, Ze = ["href"], Je = { class: "w-full rounded-[12px] bg-fm-color-neutral-gray-100 p-[16px] text-[14px] leading-[20px]" }, Xe = { class: "flex w-full items-center justify-between gap-[12px]" }, qe = /* @__PURE__ */ Y({
241
+ __name: "WhatsappBotTutorialDialog",
242
+ props: /* @__PURE__ */ ae({
243
+ clientId: {}
244
+ }, {
245
+ modelValue: { type: Boolean, required: !0 },
246
+ modelModifiers: {}
247
+ }),
248
+ emits: ["update:modelValue"],
249
+ setup(I) {
250
+ const f = I, v = le(I, "modelValue"), { t: l } = X(), n = k(0), h = j(() => z[n.value]), c = j(
251
+ () => n.value === z.length - 1
252
+ ), y = j(() => K.getBusinessId()), x = k(""), b = k(""), m = k(!1), A = k("");
253
+ let w;
254
+ function L(p) {
255
+ if (p instanceof re) {
256
+ if (p.status === 409)
257
+ return l("connect.whatsappBot.notificationGroup.notReady");
258
+ if (p.status === 404)
259
+ return l("connect.whatsappBot.errors.accountNotFound");
260
+ }
261
+ return l("connect.whatsappBot.errors.loadGroup");
262
+ }
263
+ async function B() {
264
+ w == null || w.abort();
265
+ const p = new AbortController();
266
+ w = p, x.value = "", b.value = "", A.value = "", m.value = !0;
267
+ try {
268
+ if (!y.value || !f.clientId) {
269
+ A.value = l(
270
+ y.value ? "connect.whatsappBot.notificationGroup.notReady" : "connect.whatsappBot.errors.selectBusiness"
271
+ );
272
+ return;
273
+ }
274
+ const u = await Z.getNotificationGroup(
275
+ y.value,
276
+ f.clientId,
277
+ p.signal
278
+ );
279
+ if (p.signal.aborted) return;
280
+ const d = await ce.toDataURL(u.inviteLink, {
281
+ width: 224,
282
+ margin: 2,
283
+ errorCorrectionLevel: "M"
284
+ });
285
+ if (p.signal.aborted) return;
286
+ x.value = u.inviteLink, b.value = d;
287
+ } catch (u) {
288
+ if (p.signal.aborted) return;
289
+ A.value = L(u);
290
+ } finally {
291
+ p.signal.aborted || (m.value = !1);
292
+ }
293
+ }
294
+ H(
295
+ [v, () => h.value.key, y, () => f.clientId],
296
+ ([p, u]) => {
297
+ p && u === "escalations" ? B() : w == null || w.abort();
298
+ }
299
+ ), te(() => w == null ? void 0 : w.abort());
300
+ function W() {
301
+ c.value ? v.value = !1 : n.value += 1;
302
+ }
303
+ return H(v, (p) => {
304
+ p && (n.value = 0);
305
+ }), (p, u) => {
306
+ const d = $("FmIcon"), g = $("FmCircularProgress"), _ = $("FmButton"), M = $("FmDialog");
307
+ return o(), T(M, {
308
+ modelValue: v.value,
309
+ "onUpdate:modelValue": u[1] || (u[1] = (D) => v.value = D),
310
+ "min-width": "min(600px, calc(100% - 32px))",
311
+ "max-width": "600px",
312
+ "max-height": "90vh",
313
+ "dismiss-away": ""
314
+ }, {
315
+ "dialog-header": S(() => [
316
+ t("h2", Ve, a(e(l)("connect.whatsappBot.tutorial.title")), 1)
317
+ ]),
318
+ "dialog-footer": S(() => [
319
+ t("div", Xe, [
320
+ C(_, {
321
+ variant: "secondary",
322
+ "border-color": "neutral-gray-200",
323
+ label: e(l)("connect.common.back"),
324
+ disabled: n.value === 0,
325
+ "prepend-icon": "chevron_left",
326
+ class: "!rounded-full [&_.label]:text-[14px]",
327
+ onClick: u[0] || (u[0] = (D) => n.value -= 1)
328
+ }, null, 8, ["label", "disabled"]),
329
+ C(_, {
330
+ label: c.value ? e(l)("connect.whatsappBot.tutorial.done") : e(l)("connect.common.next"),
331
+ "append-icon": c.value ? void 0 : "chevron_right",
332
+ class: "!rounded-full [&_.label]:text-[14px]",
333
+ onClick: W
334
+ }, null, 8, ["label", "append-icon"])
335
+ ])
336
+ ]),
337
+ default: S(() => [
338
+ t("div", Le, [
339
+ t("div", Me, [
340
+ t("p", De, a(e(l)("connect.whatsappBot.tutorial.progress", {
341
+ current: n.value + 1,
342
+ total: e(z).length
343
+ })), 1),
344
+ t("div", Ee, [
345
+ (o(!0), i(G, null, J(e(z), (D, P) => (o(), i("span", {
346
+ key: P,
347
+ class: R([
348
+ "h-[4px] flex-1 rounded-full",
349
+ P <= n.value ? "bg-fm-color-primary" : "bg-fm-color-neutral-gray-100"
350
+ ])
351
+ }, null, 2))), 128))
352
+ ])
353
+ ]),
354
+ t("div", We, [
355
+ t("span", je, a(e(l)("connect.whatsappBot.tutorial.progress", {
356
+ current: n.value + 1,
357
+ total: e(z).length
358
+ })), 1),
359
+ t("div", Oe, [
360
+ C(d, {
361
+ name: h.value.icon,
362
+ size: "lg"
363
+ }, null, 8, ["name"])
364
+ ]),
365
+ t("div", Ue, [
366
+ t("h3", Ne, a(e(l)(`connect.whatsappBot.tutorial.steps.${h.value.key}.title`)), 1),
367
+ t("p", Ge, a(e(l)(
368
+ `connect.whatsappBot.tutorial.steps.${h.value.key}.description`
369
+ )), 1)
370
+ ]),
371
+ h.value.key === "escalations" ? (o(), i("div", Re, [
372
+ m.value ? (o(), i("output", He, [
373
+ C(g),
374
+ Q(" " + a(e(l)("connect.whatsappBot.notificationGroup.loading")), 1)
375
+ ])) : A.value ? (o(), i(G, { key: 1 }, [
376
+ t("p", ze, a(A.value), 1),
377
+ C(_, {
378
+ label: e(l)("connect.whatsappBot.tryAgain"),
379
+ "prepend-icon": "refresh",
380
+ class: "!rounded-full [&_.label]:text-[14px]",
381
+ onClick: B
382
+ }, null, 8, ["label"])
383
+ ], 64)) : x.value ? (o(), i(G, { key: 2 }, [
384
+ t("img", {
385
+ src: b.value,
386
+ alt: e(l)("connect.whatsappBot.notificationGroup.qrAlt"),
387
+ width: "224",
388
+ height: "224",
389
+ class: "rounded-[12px] border border-fm-color-neutral-gray-100"
390
+ }, null, 8, Qe),
391
+ t("div", Ke, [
392
+ t("span", Ye, a(e(l)("connect.whatsappBot.notificationGroup.inviteLink")), 1),
393
+ t("a", {
394
+ href: x.value,
395
+ target: "_blank",
396
+ rel: "noopener noreferrer",
397
+ class: "break-all rounded-[8px] border border-fm-color-neutral-gray-200 p-[12px] font-mono text-[13px] text-fm-color-primary underline focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-fm-color-primary"
398
+ }, a(x.value), 9, Ze)
399
+ ])
400
+ ], 64)) : E("", !0)
401
+ ])) : E("", !0),
402
+ t("p", Je, a(e(l)(`connect.whatsappBot.tutorial.steps.${h.value.key}.hint`)), 1)
403
+ ])
404
+ ])
405
+ ]),
406
+ _: 1
407
+ }, 8, ["modelValue"]);
408
+ };
409
+ }
410
+ }), et = { class: "text-[18px] font-semibold" }, tt = {
411
+ key: 0,
412
+ class: "flex flex-col items-center text-center gap-[8px] px-[8px] py-[40px]"
413
+ }, ot = { class: "text-[18px] font-semibold" }, nt = { class: "text-[14px] text-fm-color-typo-secondary break-all" }, at = {
414
+ key: 1,
415
+ class: "grid grid-cols-[minmax(0,1fr)_232px] xs:grid-cols-1 gap-[32px] p-[8px] xs:p-[0px]"
416
+ }, lt = { class: "flex flex-col gap-[20px] text-[14px] leading-[20px]" }, st = { class: "text-fm-color-typo-secondary" }, rt = { class: "flex flex-col gap-[14px]" }, ct = { class: "w-[22px] h-[22px] shrink-0 rounded-full bg-fm-color-neutral-gray-100 flex items-center justify-center text-[12px] font-semibold" }, it = { key: 0 }, pt = { class: "font-semibold" }, ut = { class: "font-semibold" }, dt = { class: "font-semibold" }, mt = { class: "font-semibold" }, ft = { key: 3 }, xt = { class: "text-[12px] leading-[16px] text-fm-color-typo-tertiary" }, vt = { 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" }, ht = {
417
+ key: 0,
418
+ class: "flex flex-col items-center gap-[12px] text-[13px]"
419
+ }, _t = {
420
+ key: 1,
421
+ class: "flex flex-col items-center text-center gap-[12px] p-[12px]"
422
+ }, gt = {
423
+ role: "alert",
424
+ class: "text-[14px] text-fm-color-typo-error"
425
+ }, yt = ["src", "alt"], bt = {
426
+ key: 3,
427
+ "aria-live": "polite",
428
+ class: "absolute inset-0 bg-fm-color-neutral-white/90 flex flex-col items-center justify-center gap-[10px] text-[13px] font-medium"
429
+ }, wt = /* @__PURE__ */ Y({
430
+ __name: "WhatsappConnectDialog",
431
+ props: {
432
+ modelValue: { type: Boolean, required: !0 },
433
+ modelModifiers: {}
434
+ },
435
+ emits: /* @__PURE__ */ ae(["connected"], ["update:modelValue"]),
436
+ setup(I, { emit: f }) {
437
+ const v = le(I, "modelValue"), l = f, { t: n } = X(), h = se(), c = k(""), y = k(!1), x = k(""), b = k(!1), m = k();
438
+ let A, w, L;
439
+ function B() {
440
+ A == null || A.abort(), clearTimeout(w), w = void 0, clearTimeout(L), L = void 0;
441
+ }
442
+ async function W(u, d, g) {
443
+ if (!g.aborted) {
444
+ try {
445
+ const _ = await Z.getClient(u, d, g);
446
+ if (g.aborted) return;
447
+ if (b.value = _.status === "connected" || _.status === "connecting" && _.connectedAt !== null, _.status === "connected" && _.connectedAt !== null && _.profileStatus === "ready") {
448
+ B(), b.value = !1, m.value = _, l("connected", _), L = setTimeout(() => {
449
+ v.value = !1;
450
+ }, 1800);
451
+ return;
452
+ }
453
+ if (_.status === "disconnected") {
454
+ B(), b.value = !1, c.value = "", x.value = n("connect.whatsappBot.errors.qrExpired");
455
+ return;
456
+ }
457
+ } catch (_) {
458
+ if (g.aborted) return;
459
+ if (_ instanceof re && _.status === 409) {
460
+ B(), b.value = !1, c.value = "", x.value = n("connect.whatsappBot.errors.accountAlreadyLinked");
461
+ return;
462
+ }
463
+ }
464
+ g.aborted || (w = setTimeout(() => {
465
+ W(u, d, g);
466
+ }, 2e3));
467
+ }
468
+ }
469
+ async function p() {
470
+ B();
471
+ const u = new AbortController();
472
+ A = u, c.value = "", x.value = "", b.value = !1, m.value = void 0, y.value = !0;
473
+ try {
474
+ const d = K.getBusinessId();
475
+ if (!d)
476
+ throw new Error(n("connect.whatsappBot.errors.selectBusiness"));
477
+ const g = await Z.createClient(
478
+ d,
479
+ xe.parse({
480
+ country: h.currentCountry.value || "MY"
481
+ }),
482
+ u.signal
483
+ ), _ = await ce.toDataURL(g.qr, {
484
+ width: 224,
485
+ margin: 2,
486
+ errorCorrectionLevel: "M"
487
+ });
488
+ u.signal.aborted || (c.value = _, W(d, g.clientId, u.signal));
489
+ } catch (d) {
490
+ u.signal.aborted || (x.value = d instanceof Error ? d.message : n("connect.whatsappBot.errors.loadQr"));
491
+ } finally {
492
+ u.signal.aborted || (y.value = !1);
493
+ }
494
+ }
495
+ return H(
496
+ v,
497
+ (u) => {
498
+ u ? p() : B();
499
+ },
500
+ { immediate: !0 }
501
+ ), te(B), (u, d) => {
502
+ const g = $("i18n-t"), _ = $("FmCircularProgress"), M = $("FmButton"), D = $("FmDialog");
503
+ return o(), T(D, {
504
+ modelValue: v.value,
505
+ "onUpdate:modelValue": d[0] || (d[0] = (P) => v.value = P),
506
+ "min-width": "min(720px, calc(100% - 32px))",
507
+ "max-width": "720px",
508
+ "max-height": "90vh",
509
+ "dismiss-away": ""
510
+ }, {
511
+ "dialog-header": S(() => [
512
+ t("h2", et, a(e(n)("connect.whatsappBot.connectAccount")), 1)
513
+ ]),
514
+ default: S(() => {
515
+ var P, s, r;
516
+ return [
517
+ m.value ? (o(), i("output", tt, [
518
+ d[1] || (d[1] = t("div", {
519
+ "aria-hidden": "true",
520
+ 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]"
521
+ }, [
522
+ t("svg", {
523
+ width: "32",
524
+ height: "32",
525
+ viewBox: "0 0 24 24",
526
+ fill: "none",
527
+ stroke: "currentColor",
528
+ "stroke-width": "2.2",
529
+ "stroke-linecap": "round",
530
+ "stroke-linejoin": "round"
531
+ }, [
532
+ t("path", { d: "M20 6 9 17l-5-5" })
533
+ ])
534
+ ], -1)),
535
+ t("h3", ot, a(e(n)("connect.whatsappBot.accountConnected")), 1),
536
+ t("p", nt, a(((P = m.value.account) == null ? void 0 : P.businessName) || ((s = m.value.account) == null ? void 0 : s.name) || e(n)("connect.whatsappBot.unnamedAccount")) + " · " + a(((r = m.value.account) == null ? void 0 : r.phoneNumber) || e(n)("connect.whatsappBot.phoneUnavailable")), 1)
537
+ ])) : (o(), i("div", at, [
538
+ t("div", lt, [
539
+ t("p", st, a(e(n)("connect.whatsappBot.scanDescription")), 1),
540
+ t("ol", rt, [
541
+ (o(), i(G, null, J(4, (V) => t("li", {
542
+ key: V,
543
+ class: "flex gap-[12px]"
544
+ }, [
545
+ t("span", ct, a(V), 1),
546
+ V === 1 ? (o(), i("span", it, a(e(n)("connect.whatsappBot.steps.openApp")), 1)) : V === 2 ? (o(), T(g, {
547
+ key: 1,
548
+ keypath: "connect.whatsappBot.steps.openSettings",
549
+ tag: "span",
550
+ scope: "global"
551
+ }, {
552
+ menu: S(() => [
553
+ t("b", pt, a(e(n)("connect.whatsappBot.menu")), 1)
554
+ ]),
555
+ settings: S(() => [
556
+ t("b", ut, a(e(n)("connect.whatsappBot.settings")), 1)
557
+ ]),
558
+ _: 1
559
+ })) : V === 3 ? (o(), T(g, {
560
+ key: 2,
561
+ keypath: "connect.whatsappBot.steps.linkDevice",
562
+ tag: "span",
563
+ scope: "global"
564
+ }, {
565
+ linkedDevices: S(() => [
566
+ t("b", dt, a(e(n)("connect.whatsappBot.linkedDevices")), 1)
567
+ ]),
568
+ linkDevice: S(() => [
569
+ t("b", mt, a(e(n)("connect.whatsappBot.linkDevice")), 1)
570
+ ]),
571
+ _: 1
572
+ })) : (o(), i("span", ft, a(e(n)("connect.whatsappBot.steps.scanQr")), 1))
573
+ ])), 64))
574
+ ]),
575
+ t("p", xt, a(e(n)("connect.whatsappBot.connectionNote")), 1)
576
+ ]),
577
+ t("div", vt, [
578
+ y.value ? (o(), i("output", ht, [
579
+ C(_),
580
+ Q(a(e(n)("connect.whatsappBot.generatingQr")), 1)
581
+ ])) : x.value ? (o(), i("div", _t, [
582
+ t("p", gt, a(x.value), 1),
583
+ C(M, {
584
+ label: e(n)("connect.whatsappBot.tryAgain"),
585
+ "prepend-icon": "refresh",
586
+ class: "!rounded-full [&_.label]:text-[14px]",
587
+ onClick: p
588
+ }, null, 8, ["label"])
589
+ ])) : c.value ? (o(), i("img", {
590
+ key: 2,
591
+ src: c.value,
592
+ alt: e(n)("connect.whatsappBot.qrAlt"),
593
+ width: "224",
594
+ height: "224",
595
+ class: R({ "opacity-20": b.value })
596
+ }, null, 10, yt)) : E("", !0),
597
+ b.value ? (o(), i("output", bt, [
598
+ C(_),
599
+ Q(" " + a(e(n)("connect.whatsappBot.connecting")), 1)
600
+ ])) : E("", !0)
601
+ ])
602
+ ]))
603
+ ];
604
+ }),
605
+ _: 1
606
+ }, 8, ["modelValue"]);
607
+ };
608
+ }
609
+ }), Bt = { class: "mt-[24px] border border-fm-color-neutral-gray-200 rounded-[16px] px-[24px] xs:px-[16px] py-[32px] flex flex-col items-center text-center gap-[8px]" }, kt = { class: "text-[20px] leading-[28px] font-bold" }, $t = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary max-w-[420px] [text-wrap:pretty]" }, Ct = ["aria-label"], At = {
610
+ "aria-hidden": "true",
611
+ class: "flex h-[36px] w-[36px] shrink-0 items-center justify-center rounded-[10px] bg-fm-color-primary-oats text-fm-color-primary"
612
+ }, It = { class: "flex flex-col gap-[4px]" }, Tt = { class: "text-[14px] leading-[20px] font-semibold" }, Ft = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary" }, St = /* @__PURE__ */ Y({
613
+ __name: "WhatsappEmptyState",
614
+ emits: ["connect"],
615
+ setup(I, { emit: f }) {
616
+ const v = f, { t: l } = X();
617
+ return (n, h) => {
618
+ const c = $("FmIcon"), y = $("FmButton");
619
+ return o(), i("div", Bt, [
620
+ h[1] || (h[1] = t("div", { class: "w-[72px] h-[72px] rounded-full bg-fm-color-primary-oats text-fm-color-primary flex items-center justify-center mb-[12px]" }, [
621
+ t("svg", {
622
+ width: "34",
623
+ height: "34",
624
+ viewBox: "0 0 24 24",
625
+ fill: "none",
626
+ stroke: "currentColor",
627
+ "stroke-width": "1.6",
628
+ "stroke-linecap": "round",
629
+ "stroke-linejoin": "round",
630
+ "aria-hidden": "true"
631
+ }, [
632
+ t("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
633
+ t("path", { d: "M9 10h.01M12 10h.01M15 10h.01" })
634
+ ])
635
+ ], -1)),
636
+ t("h2", kt, a(e(l)("connect.whatsappBot.emptyTitle")), 1),
637
+ t("p", $t, a(e(l)("connect.whatsappBot.emptyDescription")), 1),
638
+ t("ul", {
639
+ "aria-label": e(l)("connect.whatsappBot.tutorial.title"),
640
+ class: "mt-[24px] grid w-full max-w-[880px] grid-cols-2 xs:grid-cols-1 gap-[20px] text-left"
641
+ }, [
642
+ (o(!0), i(G, null, J(e(z), (x) => (o(), i("li", {
643
+ key: x.key,
644
+ class: "flex items-start gap-[12px]"
645
+ }, [
646
+ t("div", At, [
647
+ C(c, {
648
+ name: x.icon,
649
+ size: "sm"
650
+ }, null, 8, ["name"])
651
+ ]),
652
+ t("div", It, [
653
+ t("h3", Tt, a(e(l)(`connect.whatsappBot.tutorial.steps.${x.key}.title`)), 1),
654
+ t("p", Ft, a(e(l)(`connect.whatsappBot.tutorial.steps.${x.key}.description`)), 1)
655
+ ])
656
+ ]))), 128))
657
+ ], 8, Ct),
658
+ C(y, {
659
+ class: "mt-[16px] !rounded-full !px-[20px] [&_.label]:text-[14px]",
660
+ label: e(l)("connect.whatsappBot.connectAccount"),
661
+ "prepend-icon": "add",
662
+ onClick: h[0] || (h[0] = (x) => v("connect"))
663
+ }, null, 8, ["label"])
664
+ ]);
665
+ };
666
+ }
667
+ });
668
+ function Pt(I) {
669
+ const f = k(!1);
670
+ let v = !1, l = !1, n = !1;
671
+ function h() {
672
+ return `feedme_connect_whatsapp_bot_tutorial:${I.value}`;
673
+ }
674
+ function c(b) {
675
+ let m = n;
676
+ try {
677
+ m || (m = localStorage.getItem(h()) === "1");
678
+ } catch {
679
+ }
680
+ v = !!I.value && !b && !m, l = !1;
681
+ }
682
+ function y() {
683
+ l = v;
684
+ }
685
+ function x() {
686
+ if (l) {
687
+ f.value = !0, n = !0;
688
+ try {
689
+ localStorage.setItem(h(), "1");
690
+ } catch {
691
+ }
692
+ }
693
+ v = !1, l = !1;
694
+ }
695
+ return H(
696
+ I,
697
+ () => {
698
+ f.value = !1, v = !1, l = !1, n = !1;
699
+ },
700
+ { flush: "sync" }
701
+ ), { tutorialOpen: f, startConnection: c, onConnected: y, onConnectionClosed: x };
702
+ }
703
+ const Vt = { class: "px-[24px] xs:px-[12px] pt-[20px] pb-[40px] text-fm-color-typo-primary" }, Lt = { class: "flex items-center justify-between gap-[16px] flex-wrap min-h-[40px]" }, Mt = { class: "flex items-center gap-8" }, Dt = { class: "text-[24px] leading-[32px] font-semibold tracking-[-0.01em]" }, Et = { class: "flex items-center gap-[8px] flex-wrap" }, Wt = {
704
+ key: 0,
705
+ class: "mt-[8px] w-full text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]"
706
+ }, jt = ["aria-label"], Ot = {
707
+ key: 3,
708
+ class: "mt-[24px] py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
709
+ }, Ut = {
710
+ key: 4,
711
+ 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]"
712
+ }, Nt = {
713
+ role: "alert",
714
+ class: "text-[14px] text-fm-color-typo-error"
715
+ }, eo = /* @__PURE__ */ Y({
716
+ __name: "WhatsappBot",
717
+ setup(I) {
718
+ const { t: f } = X(), v = pe(), l = se(), n = j(() => {
719
+ var s, r;
720
+ return !!((r = (s = l.sessionUser.value) == null ? void 0 : s.role) != null && r.isAdmin);
721
+ }), h = j(() => K.getBusinessId()), { tutorialOpen: c, startConnection: y, onConnected: x, onConnectionClosed: b } = Pt(h), m = k([]), A = k(), w = k(!0), L = k("");
722
+ let B, W;
723
+ const p = j(
724
+ () => m.value.filter((s) => me(s) !== void 0)
725
+ ), u = j(
726
+ () => [
727
+ {
728
+ label: f("connect.whatsappBot.accounts"),
729
+ value: N["$connect-WHATSAPP_BOT"],
730
+ badge: p.value.length
731
+ },
732
+ {
733
+ label: f("connect.whatsappBot.settings"),
734
+ value: N["$connect-WHATSAPP_BOT_SETTINGS"]
735
+ },
736
+ ...n.value ? [
737
+ {
738
+ label: f("connect.whatsappBot.logs.title"),
739
+ value: N["$connect-WHATSAPP_BOT_LOGS"]
740
+ }
741
+ ] : []
742
+ ]
743
+ ), d = j(() => {
744
+ const s = v.currentRoute.value.name;
745
+ return u.value.some((r) => r.value === s) ? s : N["$connect-WHATSAPP_BOT"];
746
+ });
747
+ async function g(s = !1) {
748
+ clearTimeout(W), B == null || B.abort();
749
+ const r = new AbortController();
750
+ B = r, s || (w.value = !0, L.value = "");
751
+ try {
752
+ const V = K.getBusinessId();
753
+ if (!V)
754
+ throw new Error(f("connect.whatsappBot.errors.selectBusiness"));
755
+ const O = await Z.listClients(V, r.signal);
756
+ r.signal.aborted || (m.value = O, L.value = "");
757
+ } catch (V) {
758
+ !r.signal.aborted && !s && (L.value = V instanceof Error ? V.message : f("connect.whatsappBot.errors.loadSessions"));
759
+ } finally {
760
+ r.signal.aborted || (w.value = !1, W = setTimeout(() => void g(!0), 1e4));
761
+ }
762
+ }
763
+ function _(s) {
764
+ m.value = m.value.filter(
765
+ (r) => r.clientId !== s
766
+ ), g(!0);
767
+ }
768
+ const M = k(!1);
769
+ function D() {
770
+ y(p.value.length > 0), M.value = !0;
771
+ }
772
+ function P(s) {
773
+ A.value = s.clientId, m.value = [
774
+ ...m.value.filter((r) => r.clientId !== s.clientId),
775
+ s
776
+ ], x();
777
+ }
778
+ return H(M, (s) => {
779
+ s || (b(), g());
780
+ }), H(
781
+ h,
782
+ () => {
783
+ M.value = !1, A.value = void 0, m.value = [], g();
784
+ },
785
+ { immediate: !0 }
786
+ ), te(() => {
787
+ B == null || B.abort(), clearTimeout(W);
788
+ }), (s, r) => {
789
+ var oe, ne;
790
+ const V = $("FmPill"), O = $("FmButton"), q = $("RouterLink"), ee = $("RouterView"), U = $("FmCircularProgress");
791
+ return o(), i(G, null, [
792
+ t("div", Vt, [
793
+ t("div", Lt, [
794
+ t("div", Mt, [
795
+ t("h1", Dt, a(e(f)("connect.navigation.whatsappBot")), 1),
796
+ C(V, { variant: "beta" })
797
+ ]),
798
+ t("div", Et, [
799
+ C(O, {
800
+ variant: "tertiary",
801
+ label: e(f)("connect.whatsappBot.tutorial.learnMore"),
802
+ "prepend-icon": "help_outline",
803
+ class: "!h-[36px] !rounded-full !px-[16px] [&_.label]:text-[14px]",
804
+ onClick: r[0] || (r[0] = (F) => c.value = !0)
805
+ }, null, 8, ["label"]),
806
+ d.value === e(N)["$connect-WHATSAPP_BOT"] && p.value.length ? (o(), T(O, {
807
+ key: 0,
808
+ label: e(f)("connect.whatsappBot.connectAccountCta"),
809
+ "prepend-icon": "add",
810
+ class: "!h-[36px] !rounded-full !px-[16px] [&_.label]:text-[14px]",
811
+ onClick: D
812
+ }, null, 8, ["label"])) : E("", !0)
813
+ ])
814
+ ]),
815
+ p.value.length ? (o(), i("p", Wt, a(e(f)("connect.whatsappBot.description")), 1)) : E("", !0),
816
+ t("nav", {
817
+ "aria-label": e(f)("connect.navigation.whatsappBot"),
818
+ class: "mt-[16px] flex gap-[24px] overflow-x-auto border-b border-fm-color-neutral-gray-100"
819
+ }, [
820
+ (o(!0), i(G, null, J(u.value, (F) => (o(), T(q, {
821
+ key: F.value,
822
+ to: { name: F.value },
823
+ "aria-current": d.value === F.value ? "page" : void 0,
824
+ class: R([
825
+ "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",
826
+ d.value === F.value ? "border-fm-color-primary text-fm-color-primary" : "border-transparent text-fm-color-typo-secondary"
827
+ ])
828
+ }, {
829
+ default: S(() => [
830
+ Q(a(F.label) + " ", 1),
831
+ F.badge ? (o(), i("span", {
832
+ key: 0,
833
+ class: R([
834
+ "min-w-[20px] rounded-full px-[6px] text-center text-[12px] leading-[20px] font-semibold tabular-nums",
835
+ d.value === F.value ? "bg-fm-color-primary-oats text-fm-color-primary" : "bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
836
+ ])
837
+ }, a(F.badge), 3)) : E("", !0)
838
+ ]),
839
+ _: 2
840
+ }, 1032, ["to", "aria-current", "class"]))), 128))
841
+ ], 8, jt),
842
+ d.value === e(N)["$connect-WHATSAPP_BOT_SETTINGS"] ? (o(), T(ee, { key: 1 })) : d.value === e(N)["$connect-WHATSAPP_BOT_LOGS"] ? (o(), T(ee, {
843
+ key: 2,
844
+ accounts: p.value
845
+ }, null, 8, ["accounts"])) : w.value ? (o(), i("output", Ot, [
846
+ C(U),
847
+ Q(" " + a(e(f)("connect.whatsappBot.loadingSessions")), 1)
848
+ ])) : L.value ? (o(), i("div", Ut, [
849
+ t("p", Nt, a(L.value), 1),
850
+ C(O, {
851
+ label: e(f)("connect.whatsappBot.tryAgain"),
852
+ "prepend-icon": "refresh",
853
+ class: "!rounded-full [&_.label]:text-[14px]",
854
+ onClick: r[1] || (r[1] = (F) => g())
855
+ }, null, 8, ["label"])
856
+ ])) : p.value.length ? (o(), T(Pe, {
857
+ key: 5,
858
+ accounts: p.value,
859
+ onRemoved: _
860
+ }, null, 8, ["accounts"])) : (o(), T(St, {
861
+ key: 6,
862
+ onConnect: D
863
+ }))
864
+ ]),
865
+ (o(), T(wt, {
866
+ key: h.value,
867
+ modelValue: M.value,
868
+ "onUpdate:modelValue": r[2] || (r[2] = (F) => M.value = F),
869
+ onConnected: P
870
+ }, null, 8, ["modelValue"])),
871
+ C(qe, {
872
+ modelValue: e(c),
873
+ "onUpdate:modelValue": r[3] || (r[3] = (F) => ie(c) ? c.value = F : null),
874
+ "client-id": ((oe = p.value.find((F) => F.clientId === A.value)) == null ? void 0 : oe.clientId) ?? ((ne = p.value[0]) == null ? void 0 : ne.clientId)
875
+ }, null, 8, ["modelValue", "client-id"])
876
+ ], 64);
877
+ };
878
+ }
879
+ });
880
+ export {
881
+ eo as default
882
+ };