@feedmepos/mf-connect 0.1.126-dev → 0.1.127-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.
Files changed (141) hide show
  1. package/dist/{App-B_Yp6cvN.js → App-CLrxVFgX.js} +10 -10
  2. package/dist/{AuditLogs-C1U17evK.js → AuditLogs-DYlfToAk.js} +13 -13
  3. package/dist/{Bin-CmIpEIwe.js → Bin-C0CugBW4.js} +8 -8
  4. package/dist/{Broadcast-DkV4BdU_.js → Broadcast-DhVQa_WW.js} +12 -12
  5. package/dist/{CampaignAnalytic-Dkwo_lpB.js → CampaignAnalytic-6jeG5U90.js} +97 -97
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Ch8Gblw6.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cxydrkof.js} +9 -9
  7. package/dist/{Card-DXCkG34M.js → Card-cpLj34Oy.js} +23 -23
  8. package/dist/{Collections-CybPfSO4.js → Collections-CdRpJuHO.js} +8 -8
  9. package/dist/{Credit-B-KUzWsX.js → Credit-E_N_yfnJ.js} +12 -12
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CWHYeYVD.js → DateRangeChip.vue_vue_type_script_setup_true_lang-Dq-2vUqT.js} +1 -1
  11. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-C86llTFR.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSXO2bYC.js} +1285 -1140
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-nMcH6y5e.js → EffectSheet.vue_vue_type_style_index_0_lang-BeQZjLIw.js} +6 -6
  13. package/dist/{Experience-Q2NHpa-V.js → Experience-D9i0ax4C.js} +13 -13
  14. package/dist/{FileSaver.min-CKw2rn-J.js → FileSaver.min-BOE2RBne.js} +1 -1
  15. package/dist/{Game-lZvkg04z.js → Game-CirwX_l1.js} +13 -13
  16. package/dist/{GiftCardSetup-CPRju80_.js → GiftCardSetup-DpJb_azW.js} +10 -10
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Ci686UoB.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-ff6Nfvxe.js} +140 -128
  18. package/dist/{Goals-asGsUeVv.js → Goals-TejbPs-I.js} +4 -4
  19. package/dist/{Grab-BjFLSMpE.js → Grab-CeUX-LlF.js} +9 -9
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-nk87zPWH.js → ImageInput.vue_vue_type_script_setup_true_lang-CnZzRDGS.js} +1 -1
  21. package/dist/{Index-DIasPS4Y.js → Index-gqWBDZBN.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-DkOn8p1v.js → LocationPicker.vue_vue_type_script_setup_true_lang-CzobgD7L.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-BdSkxiP-.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DgeD1RQq.js} +1 -1
  24. package/dist/{LoyaltyDashboard-DlCsZ3YX.js → LoyaltyDashboard-R22oQHTd.js} +82 -82
  25. package/dist/{MainLayout-DLObnTAA.js → MainLayout-pJBEBaM-.js} +1 -1
  26. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-DigSZKt1.js → MainLayout.vue_vue_type_script_setup_true_lang-IX_utv2Z.js} +3 -3
  27. package/dist/{Marketing-JflPW-w9.js → Marketing-5gMwO1jV.js} +4 -4
  28. package/dist/{MarketingMaterialEdit-fSAB3YVb.js → MarketingMaterialEdit-BaHNX_qE.js} +6 -6
  29. package/dist/{Member-CzNahXTj.js → Member-Cd0oraEq.js} +7 -7
  30. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DzyM1fW_.js +1322 -0
  31. package/dist/{MemberImportHistory--r_A_2Es.js → MemberImportHistory-C_RkY3fg.js} +7 -7
  32. package/dist/{MemberList-CQZQ4sN8.js → MemberList-CJK1akUC.js} +14 -14
  33. package/dist/{MemberTransactions-BPg9JaUA.js → MemberTransactions-DP6schuy.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BhIFChx-.js → MessageInput.vue_vue_type_script_setup_true_lang-BaivunRx.js} +10 -10
  35. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CdGSNqEp.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DOdYyPp2.js} +1 -1
  36. package/dist/{Mission-CYCB3YQc.js → Mission-DJ40IcG9.js} +14 -14
  37. package/dist/{Overview-B5ylMBHT.js → Overview-CaQlLSBg.js} +4 -4
  38. package/dist/{Overview-DuNuUYYq.js → Overview-DXHjNmIO.js} +21 -21
  39. package/dist/{Point-DG-Uwj25.js → Point-D0Qqmgai.js} +14 -14
  40. package/dist/{Promotion-DqxBQ1yO.js → Promotion-CQU2-tpG.js} +14 -14
  41. package/dist/{Queue-Cy8LGt_Y.js → Queue-B-Uki3qh.js} +13 -13
  42. package/dist/{Record-CzXbu41w.js → Record-BvQ0nVja.js} +9 -9
  43. package/dist/{Review-7VL6gIqp.js → Review-DMfBPU_D.js} +2 -2
  44. package/dist/{ReviewFacebookCallback-BwzuPmrz.js → ReviewFacebookCallback-Bq6JQ7LR.js} +5 -5
  45. package/dist/{ReviewGoogleCallback-1JXR_f5O.js → ReviewGoogleCallback-Bg9PFxog.js} +5 -5
  46. package/dist/{Reward-BKhUDEu3.js → Reward-CNC0z98e.js} +16 -16
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DjjCytWF.js → RewardGroup.vue_vue_type_script_setup_true_lang-DXr-5wJE.js} +14 -14
  48. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-Vg7pRGIz.js → RuleGroup.vue_vue_type_script_setup_true_lang-OznhirAU.js} +15 -15
  49. package/dist/{Segment-DdHDJhaS.js → Segment-V0ZQJkN-.js} +27 -27
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-9kGUkHMi.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BmFp2pst.js} +15 -15
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DeFw0px7.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-C0IbEZMG.js} +4 -4
  52. package/dist/{Setting-DZKGXw-i.js → Setting-DCb6IIrk.js} +15 -15
  53. package/dist/{SettingAdvertisements-BBNs8tCw.js → SettingAdvertisements-Dc9XfzVl.js} +12 -12
  54. package/dist/{Settings-9v0hnBJZ.js → Settings-BIjIfmFI.js} +5 -5
  55. package/dist/{Store-C8IlE4IH.js → Store-DkoB_5IF.js} +27 -27
  56. package/dist/{StoreRewards-DWygRLR1.js → StoreRewards-a4ujLMfY.js} +15 -15
  57. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CeYYws6P.js → StoreTransactions.vue_vue_type_script_setup_true_lang-UbMY0RzG.js} +25 -25
  58. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-BiN3uRJ_.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BWjb1wHV.js} +2 -2
  59. package/dist/{Tier-7RoxGHsP.js → Tier-1WKuUirS.js} +28 -28
  60. package/dist/{Title-0q2Z4HIe.js → Title-CznZg4jL.js} +23 -23
  61. package/dist/{Transaction-CFasERdg.js → Transaction-DBRQDmA3.js} +2 -2
  62. package/dist/{Upselling-DM9R6pYw.js → Upselling-CjZvUUqn.js} +3 -3
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BDjwcgnc.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DS4hdSE9.js} +6 -6
  64. package/dist/{Voucher-BkzW2hVV.js → Voucher-Di6VhoSM.js} +18 -18
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DaE4xa3x.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BjSzCnBw.js} +12 -12
  66. package/dist/{WhatsappAccount-C3WpDF9O.js → WhatsappAccount-DdXadlHI.js} +6 -6
  67. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BxC_3h52.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-Cnlvi-GG.js} +1 -1
  68. package/dist/WhatsappBot-DwhQmZLJ.js +882 -0
  69. package/dist/{WhatsappBotLogs--KskC32Z.js → WhatsappBotLogs-BAglKUAZ.js} +66 -66
  70. package/dist/{WhatsappBotSettings-Dns_PqVE.js → WhatsappBotSettings-DslJTj2X.js} +5 -5
  71. package/dist/{WhatsappLayout-NIrFGbId.js → WhatsappLayout-14847AOz.js} +3 -3
  72. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BfD5hHc7.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-otzgv6Jh.js} +3 -3
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CJGxy7gf.js → ZodTextField.vue_vue_type_script_setup_true_lang-BEY-LOVu.js} +2 -2
  74. package/dist/{app-B9nLnoBt.js → app-KbxCI4gY.js} +107 -91
  75. package/dist/app.js +1 -1
  76. package/dist/{base.export-CBzNea0v.js → base.export-DH8OxNrx.js} +2 -2
  77. package/dist/business-DuKNr9P7.js +83 -0
  78. package/dist/{campaign-BDCLKFwN.js → campaign-DR5xHhgA.js} +2 -2
  79. package/dist/{campaign-B6nTwt17.js → campaign-Ddv-RZgo.js} +113 -99
  80. package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-DsaSpHDQ.js} +1 -1
  81. package/dist/{campaign.fn-Ck1t5C1T.js → campaign.fn-CJlEovlZ.js} +142 -142
  82. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-CDHT9uk3.js} +1 -1
  83. package/dist/{collection.fn-CDna_VLD.js → collection.fn-DTZs-hUX.js} +2 -2
  84. package/dist/{currency-Baum67Wz.js → currency-1-Yhpyv5.js} +1 -1
  85. package/dist/{duplicateCampaign-BwrMZgaV.js → duplicateCampaign-BncSxYSg.js} +2 -2
  86. package/dist/{effect-CeJbflOK.js → effect-TTD5--LN.js} +1 -1
  87. package/dist/{email-addresses-Y3vF73J0.js → email-addresses-pxXp67Al.js} +2 -2
  88. package/dist/{feature-flag-zn6Ql9tv.js → feature-flag-CFVZl4ed.js} +1 -1
  89. package/dist/{helper-DZvnn-yx.js → helper-BC_Cl5VR.js} +1 -1
  90. package/dist/{index-Da0-7h2j.js → index-42Wl_5UE.js} +1 -1
  91. package/dist/{index-BYUEPfbP.js → index-BRl7Besd.js} +2 -2
  92. package/dist/{index-CPi3Qwmj.js → index-BxUMqeaY.js} +4 -4
  93. package/dist/{index-DHNhIloU.js → index-ByFFDLTo.js} +1 -1
  94. package/dist/{index-njg4JLa-.js → index-CBKbnJRo.js} +9 -9
  95. package/dist/index-CGtlXLTG.js +10767 -0
  96. package/dist/{index-B3LCTMwV.js → index-CRKdLbXL.js} +68 -60
  97. package/dist/{index-CMs3aIA6.js → index-CaHkqz0W.js} +3 -3
  98. package/dist/{index-DkBOM8za.js → index-CcXMYJxc.js} +8 -8
  99. package/dist/{index-DXyOBtgF.js → index-CkiP4iG6.js} +1 -1
  100. package/dist/{index-CDRTiAEu.js → index-D1iOPNg3.js} +1 -1
  101. package/dist/{index-DCR1GFCA.js → index-D2Nq0UoL.js} +6 -6
  102. package/dist/index-D4nA0Z7e.js +19528 -0
  103. package/dist/{index-r_T5o_hF.js → index-DHw8wo7T.js} +2 -2
  104. package/dist/{index-FgM7b2Sw.js → index-DKOoRHPf.js} +4 -4
  105. package/dist/{index-B20FfbEE.js → index-DcbPYZkw.js} +26 -19
  106. package/dist/{index-DXKJsqgW.js → index-DjwrfZk3.js} +18 -18
  107. package/dist/{index-DJIt5tXC.js → index-EuZfRdBT.js} +5 -5
  108. package/dist/{index-juXxYQ_a.js → index-H4XJDOoT.js} +6 -6
  109. package/dist/{index-B5H4znfe.js → index-ImU7YXN7.js} +1 -1
  110. package/dist/{index-B22ojkMy.js → index-N4EzkcEu.js} +2 -2
  111. package/dist/{index-BqniSMV6.js → index-j7eLKJK3.js} +4 -4
  112. package/dist/{index.esm2017-Dtk7BscN.js → index.esm2017-CBo4j3U1.js} +1 -1
  113. package/dist/{loading-PoODMkQD.js → loading-COAu2l7W.js} +1 -1
  114. package/dist/{lodash-TthNgH98.js → lodash-Bu1ipIkR.js} +1 -1
  115. package/dist/{member-import-D7zs0Jvh.js → member-import-CkiTJIqy.js} +2 -2
  116. package/dist/{membership-Cab-iWQ1.js → membership-BSEeYyiz.js} +3 -3
  117. package/dist/{money-9Q306M3g.js → money-BOaGQSGa.js} +1 -1
  118. package/dist/{number-D9M3D435.js → number-B2AC2EMT.js} +1 -1
  119. package/dist/{objectid-DKvQl6FD.js → objectid-BKw48v5L.js} +2 -2
  120. package/dist/{onboarding-D5LKUHVI.js → onboarding-ClA8xAnH.js} +3 -3
  121. package/dist/{onboardingSetup-D0jsS6w5.js → onboardingSetup-DHjnq0H1.js} +2 -2
  122. package/dist/{plugins-CDTKQ1Pg.js → plugins-DewN43sP.js} +3 -3
  123. package/dist/{reward-De3e9vYS.js → reward-deDdPQiR.js} +1 -1
  124. package/dist/{rule-trVJgEOe.js → rule-B8ifutnO.js} +10 -10
  125. package/dist/{template-Bj3Tb6bP.js → template-z3VMmWei.js} +6 -6
  126. package/dist/timezone-BxJDy-bY.js +19 -0
  127. package/dist/{transaction.fn-CPE-oQhA.js → transaction.fn-CBBhq01K.js} +2 -2
  128. package/dist/{trigger-C6oM-8pe.js → trigger-B_quLwWr.js} +5 -5
  129. package/dist/{useMarketingMaterialActions-C5scdJQp.js → useMarketingMaterialActions-DqoRLx1M.js} +4 -4
  130. package/dist/{usePagination-CIuTHSSG.js → usePagination-Q1fPttcp.js} +1 -1
  131. package/dist/{user-Bdlgn2yo.js → user-Bw6h9xn-.js} +1 -1
  132. package/dist/{vue-i18n-DEpDI-dt.js → vue-i18n-DpCS1FnK.js} +109 -109
  133. package/dist/{xlsx-CvecxUOG.js → xlsx--toeD6hC.js} +1 -1
  134. package/dist/{zod-bniyeWdY.js → zod-BkNAcpay.js} +1 -1
  135. package/package.json +1 -1
  136. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-bqWUIbMG.js +0 -1300
  137. package/dist/WhatsappBot-DZb-Dn3s.js +0 -878
  138. package/dist/business-aT2zslwu.js +0 -82
  139. package/dist/index-BL2zQnXK.js +0 -27551
  140. package/dist/index-C_H8jFYf.js +0 -2743
  141. package/dist/timezone-DkuByUmb.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-DpCS1FnK.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-EuZfRdBT.js";
6
+ import { w as Z } from "./index-DjwrfZk3.js";
7
+ import { u as ue, _ as de, w as me } from "./WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-otzgv6Jh.js";
8
+ import { R as N } from "./app-KbxCI4gY.js";
9
+ import { _ as fe } from "./WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-Cnlvi-GG.js";
10
+ import { b as ce } from "./browser-BSAOEeIM.js";
11
+ import { F as xe } from "./index-CRKdLbXL.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
+ };