@feedmepos/mf-connect 0.1.117-prod → 0.1.118-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 (154) hide show
  1. package/README.md +68 -1
  2. package/dist/{App-CAo1izHr.js → App-CBFNBDb2.js} +435 -418
  3. package/dist/AuditLogs-BtSA8b08.js +2016 -0
  4. package/dist/{Bin-DDDfjisJ.js → Bin-CjmS_Tfn.js} +8 -8
  5. package/dist/{Broadcast-BsCulZhE.js → Broadcast-BeePmZa1.js} +22 -21
  6. package/dist/{CampaignAnalytic-CnVYFSkT.js → CampaignAnalytic-CZlnyvOi.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-ZTHyZ_0y.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Du3Ah4HP.js} +9 -9
  8. package/dist/{Card-DPyQH9qZ.js → Card-C8SzQQ0z.js} +25 -24
  9. package/dist/{Collections-CZCVA969.js → Collections-BXNWTSZH.js} +197 -185
  10. package/dist/{Credit-BTg364-i.js → Credit-CK0-0yD1.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BJx8K6Ja.js → DateRangeChip.vue_vue_type_script_setup_true_lang-BXYpYC7Y.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CdpnNDzR.js +4439 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-CfEnSXzg.js → EffectSheet.vue_vue_type_style_index_0_lang--Oyj3KYg.js} +32 -32
  14. package/dist/{Experience-Bk_eUcSX.js → Experience-CWJaj62g.js} +32 -31
  15. package/dist/{FileSaver.min-CXFiZAp7.js → FileSaver.min-lV9H82L5.js} +1 -1
  16. package/dist/{Game-CBnKpFdl.js → Game-zBV1LYAg.js} +19 -18
  17. package/dist/{GiftCardSetup-q75wNV_F.js → GiftCardSetup-Cnq9353j.js} +75 -75
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Cga0Th2O.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-CdgSBdrX.js} +7 -7
  19. package/dist/{Goals-Bbbgurfd.js → Goals-Utk08egN.js} +4 -4
  20. package/dist/Grab-DwMmWmbT.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CZS05h1r.js → ImageInput.vue_vue_type_script_setup_true_lang-CNPeU9xm.js} +1 -1
  22. package/dist/{Index-C8_OWllb.js → Index-Bjgs18xf.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-BlCg-jI7.js → LocationPicker.vue_vue_type_script_setup_true_lang-DWnf4lXH.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CACxChIo.js → LottieAnimation.vue_vue_type_script_setup_true_lang-Dy_oWJaZ.js} +1 -1
  25. package/dist/{LoyaltyDashboard-DJlE0371.js → LoyaltyDashboard-DmUfujX_.js} +15 -15
  26. package/dist/MainLayout-DlDZQJfy.js +4 -0
  27. package/dist/{MainLayout-Bs2UPvFx.js → MainLayout.vue_vue_type_script_setup_true_lang-yAflY70k.js} +5 -4
  28. package/dist/Marketing-B0iKlHP-.js +269 -0
  29. package/dist/MarketingMaterialEdit-BNHxVb8A.js +1037 -0
  30. package/dist/{Member-C4yqwsMH.js → Member-Bcm3_pWB.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-BbumjyC_.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-CPp4OpOx.js} +43 -50
  32. package/dist/{MemberImportHistory-CbuXCdxC.js → MemberImportHistory-AQgLzB3g.js} +7 -7
  33. package/dist/{MemberList-CpAepPBe.js → MemberList-CkMTo2uD.js} +103 -105
  34. package/dist/{MemberTransactions-BbpXvsSk.js → MemberTransactions-CxLCVjvw.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BaWgxbad.js → MessageInput.vue_vue_type_script_setup_true_lang-4N20f8Sj.js} +14 -14
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CEgMElLo.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DghbYpSQ.js} +1 -1
  37. package/dist/{Mission-Bdb9KVeP.js → Mission-CQS1CoDN.js} +22 -21
  38. package/dist/{Overview-CEiyGMcf.js → Overview-NQ287sgq.js} +23 -22
  39. package/dist/{Overview-D_9JwnFU.js → Overview-UG1IjY7-.js} +145 -144
  40. package/dist/{Point-Bd5cMXQx.js → Point-krMa_mb1.js} +22 -21
  41. package/dist/{Promotion-D9gZDvgR.js → Promotion-vFBmJSti.js} +137 -131
  42. package/dist/{Queue-BnAOL_rp.js → Queue-BusxSPt-.js} +46 -45
  43. package/dist/{Record-D6TWFKe0.js → Record-DjKqn0za.js} +9 -9
  44. package/dist/{Review-DLEgvnc-.js → Review-CqLp8l7U.js} +2 -2
  45. package/dist/ReviewFacebookCallback-D2kMSVFC.js +225 -0
  46. package/dist/{ReviewGoogleCallback-BgAbO3pI.js → ReviewGoogleCallback-B1cHR-o2.js} +5 -5
  47. package/dist/Reward-FeSxgzuS.js +444 -0
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Bt-EqsiH.js → RewardGroup.vue_vue_type_script_setup_true_lang-CCxVjBsO.js} +16 -15
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-U403emCF.js +1923 -0
  50. package/dist/{Segment-B9Se5FFw.js → Segment-Nj59F9Nr.js} +304 -305
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-f7AS5vwv.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-Kg9m-0DS.js} +31 -30
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-3BKA0UFI.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BLbDApPL.js} +4 -4
  53. package/dist/Setting-CCIzNxv-.js +574 -0
  54. package/dist/{SettingAdvertisements-CLw-dqiA.js → SettingAdvertisements-CkPyAg5y.js} +12 -12
  55. package/dist/Settings-CYjKGCpa.js +286 -0
  56. package/dist/{Store-B5PPP5zM.js → Store-Bp8Zkzi2.js} +31 -30
  57. package/dist/{StoreRewards-DllyaVBY.js → StoreRewards-DXW5nVyW.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-BYVezFI2.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CS6b1cM3.js +7007 -0
  60. package/dist/{Tier-M_TApfju.js → Tier-B8Utn9Qb.js} +2576 -687
  61. package/dist/{Title-Cpltm-I2.js → Title-CwaNSFer.js} +94 -92
  62. package/dist/{Transaction-BYfAYRpv.js → Transaction-ieciAdXP.js} +2 -2
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BOhfGxVj.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-CMwZl4E6.js} +26 -26
  64. package/dist/{Voucher-DHoyg0YZ.js → Voucher-BKfujj6r.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DWHwM6AJ.js → VoucherEditor.vue_vue_type_script_setup_true_lang-CkH-rNqZ.js} +16 -16
  66. package/dist/WhatsappAccount-D73WDP7a.js +161 -0
  67. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-C3L7vWZE.js +39 -0
  68. package/dist/WhatsappBot-DTWZAXhi.js +878 -0
  69. package/dist/WhatsappBotLogs-DtDcrjs9.js +372 -0
  70. package/dist/WhatsappBotSettings-7_mH9U4y.js +704 -0
  71. package/dist/WhatsappLayout-BVpaFJ8H.js +21 -0
  72. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-CMeaNKJt.js +261 -0
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B6tTjLAZ.js → ZodTextField.vue_vue_type_script_setup_true_lang-BO1zA9AR.js} +2 -2
  74. package/dist/{app-B_doYklh.js → app-DX7OWVY2.js} +9159 -7383
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-DmbnT_bp.js → base.export-bamzzexi.js} +2 -2
  77. package/dist/browser-BSAOEeIM.js +1478 -0
  78. package/dist/{business-DdVGtTvx.js → business-D3U9HSu9.js} +1 -1
  79. package/dist/{campaign-jEhKmpKg.js → campaign-BqRf2VUO.js} +121 -94
  80. package/dist/{campaign-CVkA08zl.js → campaign-CKfeN2xN.js} +31 -25
  81. package/dist/{campaign.enum-DWu6-kOo.js → campaign.enum-Dx-Zo68Q.js} +3 -2
  82. package/dist/{campaign.fn-BlgEyeFz.js → campaign.fn-DQe5LZuT.js} +82 -82
  83. package/dist/{collectible.enum-CVLkXKml.js → collectible.enum-Liy2wH3s.js} +1 -1
  84. package/dist/{collection.fn-DLNGTrPf.js → collection.fn-BcGqExuE.js} +2 -2
  85. package/dist/{currency-DKS1md4e.js → currency-sjMYWoI8.js} +1 -1
  86. package/dist/duplicateCampaign-CJF3ZLNd.js +51 -0
  87. package/dist/{effect-Bk-zYexf.js → effect-Cv8ugBR3.js} +1 -1
  88. package/dist/{email-addresses-I9A5iLzf.js → email-addresses-CWqtseTn.js} +2 -2
  89. package/dist/{feature-flag-DQti61iR.js → feature-flag-BIh6MM4i.js} +152 -136
  90. package/dist/google-BQK68wbe.js +5 -0
  91. package/dist/{helper-9cPlo6ae.js → helper-WnxOxoRK.js} +1 -1
  92. package/dist/{index-DuvnRxeo.js → index-5TTGGDnF.js} +1 -1
  93. package/dist/{index-CuyzSc1l.js → index-B3CkAr-6.js} +1 -1
  94. package/dist/{index-cgtAlOl9.js → index-B9XVyhtC.js} +8028 -10767
  95. package/dist/{index-ClYX4COd.js → index-BGguMtc0.js} +4 -3
  96. package/dist/{index-CNUXbXvG.js → index-Bdg48Cus.js} +19 -6
  97. package/dist/{index-fHiFL1dW.js → index-BoAmM8QH.js} +29 -15
  98. package/dist/{index-C-OnJpT8.js → index-BtmVXdRR.js} +1 -1
  99. package/dist/{index-1Cdj34z1.js → index-CDTETsXQ.js} +1 -1
  100. package/dist/index-C_H8jFYf.js +2743 -0
  101. package/dist/{index-BxpbI0GH.js → index-CeafUn1o.js} +7 -7
  102. package/dist/{index-Dj51vqab.js → index-CiSTQhs9.js} +4 -4
  103. package/dist/{index-CIwdXphn.js → index-ClvaVYkG.js} +2700 -2613
  104. package/dist/{index-Cj6oxbl0.js → index-CnsSd5Dg.js} +11 -10
  105. package/dist/{index-oNMFyOGe.js → index-D3yYjyaj.js} +8 -7
  106. package/dist/{index-BRm0LMTo.js → index-DDzi_-Lu.js} +611 -252
  107. package/dist/{index-3V8E9GaZ.js → index-DOgDR_QH.js} +2 -2
  108. package/dist/{index-DOE2VR99.js → index-DqZX-A6e.js} +198 -198
  109. package/dist/{index-vKvGJ4Ve.js → index-DxhNNZ-a.js} +2 -2
  110. package/dist/index-DzYFQGSw.js +74 -0
  111. package/dist/index-I9lmcd2w.js +109 -0
  112. package/dist/{index-728mP6kW.js → index-iiWxryxo.js} +683 -581
  113. package/dist/{index-DWkuIfHy.js → index-qI1yx02a.js} +390 -232
  114. package/dist/{index.esm2017-CsF37oA-.js → index.esm2017-GI2alVO5.js} +177 -177
  115. package/dist/{loading-BJJmTFoe.js → loading-Qx5K2WL0.js} +1 -1
  116. package/dist/{lodash-BMJ6_hsa.js → lodash-CeSjJptg.js} +1 -1
  117. package/dist/{member-import-DrGxVJt9.js → member-import-Cq8G7SsW.js} +6 -5
  118. package/dist/{membership-CAqKihwy.js → membership-BbeavSNs.js} +3 -3
  119. package/dist/{money-Bf9d2ZUH.js → money-D8YIFaGA.js} +1 -1
  120. package/dist/{number-CWXlGZa5.js → number-DAubZ5bt.js} +1 -1
  121. package/dist/objectid-DeXFWDMh.js +145 -0
  122. package/dist/{onboarding-Dn9O7r3a.js → onboarding-SyFxaTJY.js} +25 -25
  123. package/dist/{onboardingSetup-BMkDoGy-.js → onboardingSetup-CLpHlBn8.js} +2 -2
  124. package/dist/{plugins-KDgceFWV.js → plugins-BHuaMEYA.js} +3 -3
  125. package/dist/{MarketingMaterialEdit-o88sdvTM.js → remy-icon-BhUGu2NI.js} +2 -1031
  126. package/dist/{reward-eilGRaXi.js → reward-dYWnmAC8.js} +1 -1
  127. package/dist/{rule-Dr9Zjg_o.js → rule-BVsfOP2h.js} +572 -492
  128. package/dist/style.css +1 -1
  129. package/dist/template-BcdtbhUJ.js +188 -0
  130. package/dist/{timezone-C5CIfvHs.js → timezone-CUc7q5Ii.js} +1 -1
  131. package/dist/{transaction.fn-Cr-FLjh0.js → transaction.fn-jF9u_cBy.js} +2 -2
  132. package/dist/{trigger-B0Fv6wbN.js → trigger-COlbQlaB.js} +8 -8
  133. package/dist/useMarketingMaterialActions-Dq6-gsOW.js +125 -0
  134. package/dist/{usePagination-BcA-imTr.js → usePagination-BYZB6ORK.js} +1 -1
  135. package/dist/{user-DRvLwlBE.js → user-DK7L8VFR.js} +1 -1
  136. package/dist/vue-i18n-CDSTH7g5.js +2365 -0
  137. package/dist/{xlsx-CBObn76o.js → xlsx-CKxXlDzD.js} +224 -224
  138. package/dist/{zod-DWU5EdQV.js → zod-DjtAaF0U.js} +1 -1
  139. package/package.json +6 -2
  140. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-Ijya9Cho.js +0 -3494
  141. package/dist/Marketing-BvRYzFV8.js +0 -236
  142. package/dist/ReviewFacebookCallback-jVlm2O8f.js +0 -238
  143. package/dist/Reward-DBheQiFu.js +0 -442
  144. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CKL8MEld.js +0 -1883
  145. package/dist/Setting-B92JT_Y4.js +0 -2037
  146. package/dist/Settings-BmmM8ZnR.js +0 -179
  147. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-3Vvqf6_H.js +0 -1264
  148. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-7ZZ0e5tQ.js +0 -142
  149. package/dist/google-C3S8u0mT.js +0 -4
  150. package/dist/objectid-2DN5a9sY.js +0 -145
  151. package/dist/rule-builder-cz6Dy-no.js +0 -102
  152. package/dist/template-DwbazO8p.js +0 -236
  153. package/dist/useMarketingMaterialActions-CNk3LR9M.js +0 -96
  154. package/dist/vue-i18n-y7bHQpNx.js +0 -2365
@@ -0,0 +1,878 @@
1
+ import { defineComponent as Z, ref as w, computed as M, watch as H, onBeforeUnmount as te, resolveComponent as B, openBlock as o, createElementBlock as p, createElementVNode as t, normalizeClass as R, unref as e, toDisplayString as a, createBlock as A, withCtx as S, createTextVNode as Q, createVNode as k, createCommentVNode as D, Fragment as G, renderList as X, mergeModels as ae, useModel as le, isRef as ce } from "vue";
2
+ import { u as Y } from "./vue-i18n-CDSTH7g5.js";
3
+ import { useRouter as ie } from "vue-router";
4
+ import { useCoreStore as pe } from "@feedmepos/mf-common";
5
+ import { S as K, a as se } from "./index-CeafUn1o.js";
6
+ import { w as J } from "./index-DzYFQGSw.js";
7
+ import { u as ue, _ as de, w as me } from "./WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-CMeaNKJt.js";
8
+ import { R as N } from "./app-DX7OWVY2.js";
9
+ import { _ as fe } from "./WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-C3L7vWZE.js";
10
+ import { b as re } from "./browser-BSAOEeIM.js";
11
+ const xe = { class: "min-w-0" }, ve = { class: "flex items-center gap-[12px]" }, he = ["src"], _e = { key: 1 }, ge = { class: "min-w-0 flex-1" }, ye = ["title"], be = { key: 1 }, we = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary break-all" }, Be = { class: "relative z-10 shrink-0" }, ke = ["aria-label", "title", "aria-expanded", "disabled", "aria-busy"], $e = { class: "text-[14px] text-fm-color-typo-error" }, Ce = { class: "flex items-center justify-between flex-wrap gap-[8px] border-t border-fm-color-neutral-gray-100 pt-[12px]" }, Ae = {
12
+ key: 0,
13
+ class: "text-[12px] text-fm-color-typo-tertiary"
14
+ }, Ie = {
15
+ key: 0,
16
+ role: "alert",
17
+ class: "text-[14px] text-fm-color-typo-error"
18
+ }, Te = /* @__PURE__ */ Z({
19
+ __name: "WhatsappAccountCard",
20
+ props: {
21
+ account: {}
22
+ },
23
+ emits: ["removed"],
24
+ setup($, { emit: m }) {
25
+ const _ = $, s = m, { t: n, locale: u } = Y(), d = w(!1), g = w(""), x = w(!1), y = w(!1);
26
+ let v;
27
+ const {
28
+ name: C,
29
+ phoneNumber: b,
30
+ initials: I,
31
+ state: T,
32
+ avatarColor: E,
33
+ profilePictureUrl: l,
34
+ profilePictureFailed: i
35
+ } = ue(() => _.account), f = M(() => T.value === "connected"), h = M(() => ({
36
+ name: N["$connect-WHATSAPP_ACCOUNT"],
37
+ params: { clientId: _.account.clientId }
38
+ }));
39
+ function W(V) {
40
+ return new Intl.DateTimeFormat(u.value, {
41
+ year: "numeric",
42
+ month: "short",
43
+ day: "numeric"
44
+ }).format(new Date(V));
45
+ }
46
+ async function L() {
47
+ if (d.value) return;
48
+ const V = K.getBusinessId();
49
+ if (!V) {
50
+ g.value = n("connect.whatsappBot.errors.selectBusiness");
51
+ return;
52
+ }
53
+ const c = _.account.clientId, r = new AbortController();
54
+ v = r, d.value = !0, g.value = "";
55
+ try {
56
+ await J.deleteClient(V, c, r.signal), r.signal.aborted || s("removed", c);
57
+ } catch {
58
+ r.signal.aborted || (g.value = n("connect.whatsappBot.errors.removeAccount"));
59
+ } finally {
60
+ v === r && (v = void 0, d.value = !1);
61
+ }
62
+ }
63
+ function P() {
64
+ v == null || v.abort(), v = void 0, d.value = !1, g.value = "";
65
+ }
66
+ return H(
67
+ () => K.getBusinessId(),
68
+ () => {
69
+ P(), y.value = !1;
70
+ }
71
+ ), te(P), (V, c) => {
72
+ const r = B("RouterLink"), j = B("FmCircularProgress"), O = B("FmIcon"), q = B("FmMenuItem"), ee = B("FmMenu");
73
+ return o(), p("li", xe, [
74
+ t("div", {
75
+ 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", {
76
+ "cursor-pointer transition-shadow hover:border-fm-color-neutral-gray-200 hover:fm-shadow-light-100": f.value
77
+ }])
78
+ }, [
79
+ t("div", ve, [
80
+ t("div", {
81
+ "aria-hidden": "true",
82
+ 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(E)])
83
+ }, [
84
+ e(l) && !e(i) ? (o(), p("img", {
85
+ key: 0,
86
+ src: e(l),
87
+ alt: "",
88
+ class: "w-full h-full object-cover",
89
+ referrerpolicy: "no-referrer",
90
+ onError: c[0] || (c[0] = (U) => i.value = !0)
91
+ }, null, 40, he)) : (o(), p("span", _e, a(e(I)), 1))
92
+ ], 2),
93
+ t("div", ge, [
94
+ t("h2", {
95
+ class: "text-[16px] leading-[24px] font-semibold truncate",
96
+ title: e(C)
97
+ }, [
98
+ f.value ? (o(), A(r, {
99
+ key: 0,
100
+ to: h.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: S(() => [
104
+ Q(a(e(C)), 1)
105
+ ]),
106
+ _: 1
107
+ }, 8, ["to"])) : (o(), p("span", be, a(e(C)), 1))
108
+ ], 8, ye),
109
+ t("p", we, a(e(b)), 1)
110
+ ]),
111
+ t("div", Be, [
112
+ k(ee, {
113
+ placement: "bottom-end",
114
+ width: 220,
115
+ disabled: d.value,
116
+ "stop-click-propagation": "",
117
+ onMenuChanged: c[3] || (c[3] = (U) => x.value = U)
118
+ }, {
119
+ "menu-button": S(() => [
120
+ t("button", {
121
+ type: "button",
122
+ "aria-label": e(n)("connect.whatsappBot.moreActions"),
123
+ title: e(n)("connect.whatsappBot.moreActions"),
124
+ "aria-haspopup": "menu",
125
+ "aria-expanded": x.value,
126
+ disabled: d.value,
127
+ "aria-busy": d.value,
128
+ 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 }])
129
+ }, [
130
+ d.value ? (o(), A(j, {
131
+ key: 0,
132
+ size: "md",
133
+ "aria-hidden": "true"
134
+ })) : (o(), A(O, {
135
+ key: 1,
136
+ name: "more_vert",
137
+ size: "sm",
138
+ "aria-hidden": "true"
139
+ }))
140
+ ], 10, ke)
141
+ ]),
142
+ default: S(() => [
143
+ f.value ? (o(), A(q, {
144
+ key: 0,
145
+ label: e(n)("connect.whatsappBot.notificationGroup.title"),
146
+ disabled: d.value,
147
+ "onUpdate:modelValue": c[1] || (c[1] = (U) => y.value = !0)
148
+ }, {
149
+ prepend: S(() => [
150
+ k(O, {
151
+ name: "notifications",
152
+ size: "sm",
153
+ outline: "",
154
+ "aria-hidden": "true"
155
+ })
156
+ ]),
157
+ _: 1
158
+ }, 8, ["label", "disabled"])) : D("", !0),
159
+ k(q, {
160
+ disabled: d.value,
161
+ "onUpdate:modelValue": c[2] || (c[2] = (U) => L())
162
+ }, {
163
+ prepend: S(() => [
164
+ k(O, {
165
+ name: "delete",
166
+ size: "sm",
167
+ outline: "",
168
+ class: "text-fm-color-typo-error",
169
+ "aria-hidden": "true"
170
+ })
171
+ ]),
172
+ label: S(() => [
173
+ t("span", $e, a(e(n)("connect.common.delete")), 1)
174
+ ]),
175
+ _: 1
176
+ }, 8, ["disabled"])
177
+ ]),
178
+ _: 1
179
+ }, 8, ["disabled"])
180
+ ])
181
+ ]),
182
+ t("div", Ce, [
183
+ k(fe, { state: e(T) }, null, 8, ["state"]),
184
+ f.value && $.account.connectedAt ? (o(), p("span", Ae, a(e(n)("connect.whatsappBot.connectedSince", {
185
+ date: W($.account.connectedAt)
186
+ })), 1)) : D("", !0)
187
+ ]),
188
+ g.value ? (o(), p("p", Ie, a(g.value), 1)) : D("", !0)
189
+ ], 2),
190
+ y.value ? (o(), A(de, {
191
+ key: 0,
192
+ modelValue: y.value,
193
+ "onUpdate:modelValue": c[4] || (c[4] = (U) => y.value = U),
194
+ account: $.account
195
+ }, null, 8, ["modelValue", "account"])) : D("", !0)
196
+ ]);
197
+ };
198
+ }
199
+ }), Fe = { class: "mt-[24px] grid grid-cols-[repeat(auto-fill,minmax(min(300px,100%),1fr))] gap-[16px]" }, Se = /* @__PURE__ */ Z({
200
+ __name: "WhatsappAccountList",
201
+ props: {
202
+ accounts: {}
203
+ },
204
+ emits: ["removed"],
205
+ setup($, { emit: m }) {
206
+ const _ = m;
207
+ return (s, n) => (o(), p("ul", Fe, [
208
+ (o(!0), p(G, null, X($.accounts, (u) => (o(), A(Te, {
209
+ key: u.clientId,
210
+ account: u,
211
+ onRemoved: n[0] || (n[0] = (d) => _("removed", d))
212
+ }, null, 8, ["account"]))), 128))
213
+ ]));
214
+ }
215
+ }), z = [
216
+ { key: "autoReplies", icon: "chat" },
217
+ { key: "settings", icon: "menu_book" },
218
+ { key: "escalations", icon: "notifications" },
219
+ { key: "excludedAccounts", icon: "pause_circle" }
220
+ ], Pe = { class: "text-[18px] font-semibold" }, Ve = { class: "flex flex-col gap-[24px] py-[8px]" }, Le = { class: "flex flex-col gap-[12px]" }, De = { class: "text-[13px] font-medium text-fm-color-typo-secondary" }, Ee = {
221
+ "aria-hidden": "true",
222
+ class: "flex gap-[8px]"
223
+ }, Me = {
224
+ "aria-live": "polite",
225
+ "aria-atomic": "true",
226
+ class: "flex min-h-[260px] flex-col items-start gap-[16px]"
227
+ }, We = { class: "sr-only" }, je = {
228
+ "aria-hidden": "true",
229
+ class: "flex h-[56px] w-[56px] items-center justify-center rounded-[16px] bg-fm-color-primary-oats text-fm-color-primary"
230
+ }, Oe = { class: "flex flex-col gap-[8px]" }, Ue = { class: "text-[20px] leading-[28px] font-semibold" }, Ne = { class: "text-[14px] leading-[22px] text-fm-color-typo-secondary" }, Ge = {
231
+ key: 0,
232
+ class: "flex w-full flex-col items-center gap-[12px]"
233
+ }, Re = {
234
+ key: 0,
235
+ class: "flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
236
+ }, He = {
237
+ role: "alert",
238
+ class: "text-[14px] text-fm-color-typo-error"
239
+ }, ze = ["src", "alt"], Qe = { class: "flex w-full min-w-0 flex-col gap-[6px]" }, Ke = { 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]" }, Ye = /* @__PURE__ */ Z({
240
+ __name: "WhatsappBotTutorialDialog",
241
+ props: /* @__PURE__ */ ae({
242
+ clientId: {}
243
+ }, {
244
+ modelValue: { type: Boolean, required: !0 },
245
+ modelModifiers: {}
246
+ }),
247
+ emits: ["update:modelValue"],
248
+ setup($) {
249
+ const m = $, _ = le($, "modelValue"), { t: s } = Y(), n = w(0), u = M(() => z[n.value]), d = M(
250
+ () => n.value === z.length - 1
251
+ ), g = M(() => K.getBusinessId()), x = w(""), y = w(""), v = w(!1), C = w("");
252
+ let b;
253
+ function I(l) {
254
+ if (l instanceof se) {
255
+ if (l.status === 409)
256
+ return s("connect.whatsappBot.notificationGroup.notReady");
257
+ if (l.status === 404)
258
+ return s("connect.whatsappBot.errors.accountNotFound");
259
+ }
260
+ return s("connect.whatsappBot.errors.loadGroup");
261
+ }
262
+ async function T() {
263
+ b == null || b.abort();
264
+ const l = new AbortController();
265
+ b = l, x.value = "", y.value = "", C.value = "", v.value = !0;
266
+ try {
267
+ if (!g.value || !m.clientId) {
268
+ C.value = s(
269
+ g.value ? "connect.whatsappBot.notificationGroup.notReady" : "connect.whatsappBot.errors.selectBusiness"
270
+ );
271
+ return;
272
+ }
273
+ const i = await J.getNotificationGroup(
274
+ g.value,
275
+ m.clientId,
276
+ l.signal
277
+ );
278
+ if (l.signal.aborted) return;
279
+ const f = await re.toDataURL(i.inviteLink, {
280
+ width: 224,
281
+ margin: 2,
282
+ errorCorrectionLevel: "M"
283
+ });
284
+ if (l.signal.aborted) return;
285
+ x.value = i.inviteLink, y.value = f;
286
+ } catch (i) {
287
+ if (l.signal.aborted) return;
288
+ C.value = I(i);
289
+ } finally {
290
+ l.signal.aborted || (v.value = !1);
291
+ }
292
+ }
293
+ H(
294
+ [_, () => u.value.key, g, () => m.clientId],
295
+ ([l, i]) => {
296
+ l && i === "escalations" ? T() : b == null || b.abort();
297
+ }
298
+ ), te(() => b == null ? void 0 : b.abort());
299
+ function E() {
300
+ d.value ? _.value = !1 : n.value += 1;
301
+ }
302
+ return H(_, (l) => {
303
+ l && (n.value = 0);
304
+ }), (l, i) => {
305
+ const f = B("FmIcon"), h = B("FmCircularProgress"), W = B("FmButton"), L = B("FmDialog");
306
+ return o(), A(L, {
307
+ modelValue: _.value,
308
+ "onUpdate:modelValue": i[1] || (i[1] = (P) => _.value = P),
309
+ "min-width": "min(600px, calc(100% - 32px))",
310
+ "max-width": "600px",
311
+ "max-height": "90vh",
312
+ "dismiss-away": ""
313
+ }, {
314
+ "dialog-header": S(() => [
315
+ t("h2", Pe, a(e(s)("connect.whatsappBot.tutorial.title")), 1)
316
+ ]),
317
+ "dialog-footer": S(() => [
318
+ t("div", Xe, [
319
+ k(W, {
320
+ variant: "secondary",
321
+ "border-color": "neutral-gray-200",
322
+ label: e(s)("connect.common.back"),
323
+ disabled: n.value === 0,
324
+ "prepend-icon": "chevron_left",
325
+ class: "!rounded-full [&_.label]:text-[14px]",
326
+ onClick: i[0] || (i[0] = (P) => n.value -= 1)
327
+ }, null, 8, ["label", "disabled"]),
328
+ k(W, {
329
+ label: d.value ? e(s)("connect.whatsappBot.tutorial.done") : e(s)("connect.common.next"),
330
+ "append-icon": d.value ? void 0 : "chevron_right",
331
+ class: "!rounded-full [&_.label]:text-[14px]",
332
+ onClick: E
333
+ }, null, 8, ["label", "append-icon"])
334
+ ])
335
+ ]),
336
+ default: S(() => [
337
+ t("div", Ve, [
338
+ t("div", Le, [
339
+ t("p", De, a(e(s)("connect.whatsappBot.tutorial.progress", {
340
+ current: n.value + 1,
341
+ total: e(z).length
342
+ })), 1),
343
+ t("div", Ee, [
344
+ (o(!0), p(G, null, X(e(z), (P, V) => (o(), p("span", {
345
+ key: V,
346
+ class: R([
347
+ "h-[4px] flex-1 rounded-full",
348
+ V <= n.value ? "bg-fm-color-primary" : "bg-fm-color-neutral-gray-100"
349
+ ])
350
+ }, null, 2))), 128))
351
+ ])
352
+ ]),
353
+ t("div", Me, [
354
+ t("span", We, a(e(s)("connect.whatsappBot.tutorial.progress", {
355
+ current: n.value + 1,
356
+ total: e(z).length
357
+ })), 1),
358
+ t("div", je, [
359
+ k(f, {
360
+ name: u.value.icon,
361
+ size: "lg"
362
+ }, null, 8, ["name"])
363
+ ]),
364
+ t("div", Oe, [
365
+ t("h3", Ue, a(e(s)(`connect.whatsappBot.tutorial.steps.${u.value.key}.title`)), 1),
366
+ t("p", Ne, a(e(s)(
367
+ `connect.whatsappBot.tutorial.steps.${u.value.key}.description`
368
+ )), 1)
369
+ ]),
370
+ u.value.key === "escalations" ? (o(), p("div", Ge, [
371
+ v.value ? (o(), p("output", Re, [
372
+ k(h),
373
+ Q(" " + a(e(s)("connect.whatsappBot.notificationGroup.loading")), 1)
374
+ ])) : C.value ? (o(), p(G, { key: 1 }, [
375
+ t("p", He, a(C.value), 1),
376
+ k(W, {
377
+ label: e(s)("connect.whatsappBot.tryAgain"),
378
+ "prepend-icon": "refresh",
379
+ class: "!rounded-full [&_.label]:text-[14px]",
380
+ onClick: T
381
+ }, null, 8, ["label"])
382
+ ], 64)) : x.value ? (o(), p(G, { key: 2 }, [
383
+ t("img", {
384
+ src: y.value,
385
+ alt: e(s)("connect.whatsappBot.notificationGroup.qrAlt"),
386
+ width: "224",
387
+ height: "224",
388
+ class: "rounded-[12px] border border-fm-color-neutral-gray-100"
389
+ }, null, 8, ze),
390
+ t("div", Qe, [
391
+ t("span", Ke, a(e(s)("connect.whatsappBot.notificationGroup.inviteLink")), 1),
392
+ t("a", {
393
+ href: x.value,
394
+ target: "_blank",
395
+ rel: "noopener noreferrer",
396
+ 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"
397
+ }, a(x.value), 9, Ze)
398
+ ])
399
+ ], 64)) : D("", !0)
400
+ ])) : D("", !0),
401
+ t("p", Je, a(e(s)(`connect.whatsappBot.tutorial.steps.${u.value.key}.hint`)), 1)
402
+ ])
403
+ ])
404
+ ]),
405
+ _: 1
406
+ }, 8, ["modelValue"]);
407
+ };
408
+ }
409
+ }), qe = { class: "text-[18px] font-semibold" }, et = {
410
+ key: 0,
411
+ class: "flex flex-col items-center text-center gap-[8px] px-[8px] py-[40px]"
412
+ }, tt = { class: "text-[18px] font-semibold" }, ot = { class: "text-[14px] text-fm-color-typo-secondary break-all" }, nt = {
413
+ key: 1,
414
+ class: "grid grid-cols-[minmax(0,1fr)_232px] xs:grid-cols-1 gap-[32px] p-[8px] xs:p-[0px]"
415
+ }, at = { class: "flex flex-col gap-[20px] text-[14px] leading-[20px]" }, lt = { class: "text-fm-color-typo-secondary" }, st = { class: "flex flex-col gap-[14px]" }, rt = { class: "w-[22px] h-[22px] shrink-0 rounded-full bg-fm-color-neutral-gray-100 flex items-center justify-center text-[12px] font-semibold" }, ct = { key: 0 }, it = { class: "font-semibold" }, pt = { class: "font-semibold" }, ut = { class: "font-semibold" }, dt = { class: "font-semibold" }, mt = { key: 3 }, ft = { class: "text-[12px] leading-[16px] text-fm-color-typo-tertiary" }, xt = { 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" }, vt = {
416
+ key: 0,
417
+ class: "flex flex-col items-center gap-[12px] text-[13px]"
418
+ }, ht = {
419
+ key: 1,
420
+ class: "flex flex-col items-center text-center gap-[12px] p-[12px]"
421
+ }, _t = {
422
+ role: "alert",
423
+ class: "text-[14px] text-fm-color-typo-error"
424
+ }, gt = ["src", "alt"], yt = {
425
+ key: 3,
426
+ "aria-live": "polite",
427
+ class: "absolute inset-0 bg-fm-color-neutral-white/90 flex flex-col items-center justify-center gap-[10px] text-[13px] font-medium"
428
+ }, bt = /* @__PURE__ */ Z({
429
+ __name: "WhatsappConnectDialog",
430
+ props: {
431
+ modelValue: { type: Boolean, required: !0 },
432
+ modelModifiers: {}
433
+ },
434
+ emits: /* @__PURE__ */ ae(["connected"], ["update:modelValue"]),
435
+ setup($, { emit: m }) {
436
+ const _ = le($, "modelValue"), s = m, { t: n } = Y(), u = w(""), d = w(!1), g = w(""), x = w(!1), y = w();
437
+ let v, C, b;
438
+ function I() {
439
+ v == null || v.abort(), clearTimeout(C), C = void 0, clearTimeout(b), b = void 0;
440
+ }
441
+ async function T(l, i, f) {
442
+ if (!f.aborted) {
443
+ try {
444
+ const h = await J.getClient(l, i, f);
445
+ if (f.aborted) return;
446
+ if (x.value = h.status === "connected" || h.status === "connecting" && h.connectedAt !== null, h.status === "connected" && h.connectedAt !== null && h.profileStatus === "ready") {
447
+ I(), x.value = !1, y.value = h, s("connected", h), b = setTimeout(() => {
448
+ _.value = !1;
449
+ }, 1800);
450
+ return;
451
+ }
452
+ if (h.status === "disconnected") {
453
+ I(), x.value = !1, u.value = "", g.value = n("connect.whatsappBot.errors.qrExpired");
454
+ return;
455
+ }
456
+ } catch (h) {
457
+ if (f.aborted) return;
458
+ if (h instanceof se && h.status === 409) {
459
+ I(), x.value = !1, u.value = "", g.value = n("connect.whatsappBot.errors.accountAlreadyLinked");
460
+ return;
461
+ }
462
+ }
463
+ f.aborted || (C = setTimeout(() => {
464
+ T(l, i, f);
465
+ }, 2e3));
466
+ }
467
+ }
468
+ async function E() {
469
+ I();
470
+ const l = new AbortController();
471
+ v = l, u.value = "", g.value = "", x.value = !1, y.value = void 0, d.value = !0;
472
+ try {
473
+ const i = K.getBusinessId();
474
+ if (!i)
475
+ throw new Error(n("connect.whatsappBot.errors.selectBusiness"));
476
+ const f = await J.createClient(
477
+ i,
478
+ l.signal
479
+ ), h = await re.toDataURL(f.qr, {
480
+ width: 224,
481
+ margin: 2,
482
+ errorCorrectionLevel: "M"
483
+ });
484
+ l.signal.aborted || (u.value = h, T(i, f.clientId, l.signal));
485
+ } catch (i) {
486
+ l.signal.aborted || (g.value = i instanceof Error ? i.message : n("connect.whatsappBot.errors.loadQr"));
487
+ } finally {
488
+ l.signal.aborted || (d.value = !1);
489
+ }
490
+ }
491
+ return H(
492
+ _,
493
+ (l) => {
494
+ l ? E() : I();
495
+ },
496
+ { immediate: !0 }
497
+ ), te(I), (l, i) => {
498
+ const f = B("i18n-t"), h = B("FmCircularProgress"), W = B("FmButton"), L = B("FmDialog");
499
+ return o(), A(L, {
500
+ modelValue: _.value,
501
+ "onUpdate:modelValue": i[0] || (i[0] = (P) => _.value = P),
502
+ "min-width": "min(720px, calc(100% - 32px))",
503
+ "max-width": "720px",
504
+ "max-height": "90vh",
505
+ "dismiss-away": ""
506
+ }, {
507
+ "dialog-header": S(() => [
508
+ t("h2", qe, a(e(n)("connect.whatsappBot.connectAccount")), 1)
509
+ ]),
510
+ default: S(() => {
511
+ var P, V, c;
512
+ return [
513
+ y.value ? (o(), p("output", et, [
514
+ i[1] || (i[1] = t("div", {
515
+ "aria-hidden": "true",
516
+ 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]"
517
+ }, [
518
+ t("svg", {
519
+ width: "32",
520
+ height: "32",
521
+ viewBox: "0 0 24 24",
522
+ fill: "none",
523
+ stroke: "currentColor",
524
+ "stroke-width": "2.2",
525
+ "stroke-linecap": "round",
526
+ "stroke-linejoin": "round"
527
+ }, [
528
+ t("path", { d: "M20 6 9 17l-5-5" })
529
+ ])
530
+ ], -1)),
531
+ t("h3", tt, a(e(n)("connect.whatsappBot.accountConnected")), 1),
532
+ t("p", ot, a(((P = y.value.account) == null ? void 0 : P.businessName) || ((V = y.value.account) == null ? void 0 : V.name) || e(n)("connect.whatsappBot.unnamedAccount")) + " · " + a(((c = y.value.account) == null ? void 0 : c.phoneNumber) || e(n)("connect.whatsappBot.phoneUnavailable")), 1)
533
+ ])) : (o(), p("div", nt, [
534
+ t("div", at, [
535
+ t("p", lt, a(e(n)("connect.whatsappBot.scanDescription")), 1),
536
+ t("ol", st, [
537
+ (o(), p(G, null, X(4, (r) => t("li", {
538
+ key: r,
539
+ class: "flex gap-[12px]"
540
+ }, [
541
+ t("span", rt, a(r), 1),
542
+ r === 1 ? (o(), p("span", ct, a(e(n)("connect.whatsappBot.steps.openApp")), 1)) : r === 2 ? (o(), A(f, {
543
+ key: 1,
544
+ keypath: "connect.whatsappBot.steps.openSettings",
545
+ tag: "span",
546
+ scope: "global"
547
+ }, {
548
+ menu: S(() => [
549
+ t("b", it, a(e(n)("connect.whatsappBot.menu")), 1)
550
+ ]),
551
+ settings: S(() => [
552
+ t("b", pt, a(e(n)("connect.whatsappBot.settings")), 1)
553
+ ]),
554
+ _: 1
555
+ })) : r === 3 ? (o(), A(f, {
556
+ key: 2,
557
+ keypath: "connect.whatsappBot.steps.linkDevice",
558
+ tag: "span",
559
+ scope: "global"
560
+ }, {
561
+ linkedDevices: S(() => [
562
+ t("b", ut, a(e(n)("connect.whatsappBot.linkedDevices")), 1)
563
+ ]),
564
+ linkDevice: S(() => [
565
+ t("b", dt, a(e(n)("connect.whatsappBot.linkDevice")), 1)
566
+ ]),
567
+ _: 1
568
+ })) : (o(), p("span", mt, a(e(n)("connect.whatsappBot.steps.scanQr")), 1))
569
+ ])), 64))
570
+ ]),
571
+ t("p", ft, a(e(n)("connect.whatsappBot.connectionNote")), 1)
572
+ ]),
573
+ t("div", xt, [
574
+ d.value ? (o(), p("output", vt, [
575
+ k(h),
576
+ Q(a(e(n)("connect.whatsappBot.generatingQr")), 1)
577
+ ])) : g.value ? (o(), p("div", ht, [
578
+ t("p", _t, a(g.value), 1),
579
+ k(W, {
580
+ label: e(n)("connect.whatsappBot.tryAgain"),
581
+ "prepend-icon": "refresh",
582
+ class: "!rounded-full [&_.label]:text-[14px]",
583
+ onClick: E
584
+ }, null, 8, ["label"])
585
+ ])) : u.value ? (o(), p("img", {
586
+ key: 2,
587
+ src: u.value,
588
+ alt: e(n)("connect.whatsappBot.qrAlt"),
589
+ width: "224",
590
+ height: "224",
591
+ class: R({ "opacity-20": x.value })
592
+ }, null, 10, gt)) : D("", !0),
593
+ x.value ? (o(), p("output", yt, [
594
+ k(h),
595
+ Q(" " + a(e(n)("connect.whatsappBot.connecting")), 1)
596
+ ])) : D("", !0)
597
+ ])
598
+ ]))
599
+ ];
600
+ }),
601
+ _: 1
602
+ }, 8, ["modelValue"]);
603
+ };
604
+ }
605
+ }), wt = { 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]" }, Bt = { class: "text-[20px] leading-[28px] font-bold" }, kt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary max-w-[420px] [text-wrap:pretty]" }, $t = ["aria-label"], Ct = {
606
+ "aria-hidden": "true",
607
+ class: "flex h-[36px] w-[36px] shrink-0 items-center justify-center rounded-[10px] bg-fm-color-primary-oats text-fm-color-primary"
608
+ }, At = { class: "flex flex-col gap-[4px]" }, It = { class: "text-[14px] leading-[20px] font-semibold" }, Tt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary" }, Ft = /* @__PURE__ */ Z({
609
+ __name: "WhatsappEmptyState",
610
+ emits: ["connect"],
611
+ setup($, { emit: m }) {
612
+ const _ = m, { t: s } = Y();
613
+ return (n, u) => {
614
+ const d = B("FmIcon"), g = B("FmButton");
615
+ return o(), p("div", wt, [
616
+ u[1] || (u[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]" }, [
617
+ t("svg", {
618
+ width: "34",
619
+ height: "34",
620
+ viewBox: "0 0 24 24",
621
+ fill: "none",
622
+ stroke: "currentColor",
623
+ "stroke-width": "1.6",
624
+ "stroke-linecap": "round",
625
+ "stroke-linejoin": "round",
626
+ "aria-hidden": "true"
627
+ }, [
628
+ t("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
629
+ t("path", { d: "M9 10h.01M12 10h.01M15 10h.01" })
630
+ ])
631
+ ], -1)),
632
+ t("h2", Bt, a(e(s)("connect.whatsappBot.emptyTitle")), 1),
633
+ t("p", kt, a(e(s)("connect.whatsappBot.emptyDescription")), 1),
634
+ t("ul", {
635
+ "aria-label": e(s)("connect.whatsappBot.tutorial.title"),
636
+ class: "mt-[24px] grid w-full max-w-[880px] grid-cols-2 xs:grid-cols-1 gap-[20px] text-left"
637
+ }, [
638
+ (o(!0), p(G, null, X(e(z), (x) => (o(), p("li", {
639
+ key: x.key,
640
+ class: "flex items-start gap-[12px]"
641
+ }, [
642
+ t("div", Ct, [
643
+ k(d, {
644
+ name: x.icon,
645
+ size: "sm"
646
+ }, null, 8, ["name"])
647
+ ]),
648
+ t("div", At, [
649
+ t("h3", It, a(e(s)(`connect.whatsappBot.tutorial.steps.${x.key}.title`)), 1),
650
+ t("p", Tt, a(e(s)(`connect.whatsappBot.tutorial.steps.${x.key}.description`)), 1)
651
+ ])
652
+ ]))), 128))
653
+ ], 8, $t),
654
+ k(g, {
655
+ class: "mt-[16px] !rounded-full !px-[20px] [&_.label]:text-[14px]",
656
+ label: e(s)("connect.whatsappBot.connectAccount"),
657
+ "prepend-icon": "add",
658
+ onClick: u[0] || (u[0] = (x) => _("connect"))
659
+ }, null, 8, ["label"])
660
+ ]);
661
+ };
662
+ }
663
+ });
664
+ function St($) {
665
+ const m = w(!1);
666
+ let _ = !1, s = !1, n = !1;
667
+ function u() {
668
+ return `feedme_connect_whatsapp_bot_tutorial:${$.value}`;
669
+ }
670
+ function d(y) {
671
+ let v = n;
672
+ try {
673
+ v || (v = localStorage.getItem(u()) === "1");
674
+ } catch {
675
+ }
676
+ _ = !!$.value && !y && !v, s = !1;
677
+ }
678
+ function g() {
679
+ s = _;
680
+ }
681
+ function x() {
682
+ if (s) {
683
+ m.value = !0, n = !0;
684
+ try {
685
+ localStorage.setItem(u(), "1");
686
+ } catch {
687
+ }
688
+ }
689
+ _ = !1, s = !1;
690
+ }
691
+ return H(
692
+ $,
693
+ () => {
694
+ m.value = !1, _ = !1, s = !1, n = !1;
695
+ },
696
+ { flush: "sync" }
697
+ ), { tutorialOpen: m, startConnection: d, onConnected: g, onConnectionClosed: x };
698
+ }
699
+ const Pt = { class: "px-[24px] xs:px-[12px] pt-[20px] pb-[40px] text-fm-color-typo-primary" }, Vt = { class: "flex items-center justify-between gap-[16px] flex-wrap min-h-[40px]" }, Lt = { 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" }, Mt = {
700
+ key: 0,
701
+ class: "mt-[8px] w-full text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]"
702
+ }, Wt = ["aria-label"], jt = {
703
+ key: 3,
704
+ class: "mt-[24px] py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
705
+ }, Ot = {
706
+ key: 4,
707
+ 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]"
708
+ }, Ut = {
709
+ role: "alert",
710
+ class: "text-[14px] text-fm-color-typo-error"
711
+ }, Yt = /* @__PURE__ */ Z({
712
+ __name: "WhatsappBot",
713
+ setup($) {
714
+ const { t: m } = Y(), _ = ie(), s = pe(), n = M(() => {
715
+ var c, r;
716
+ return !!((r = (c = s.sessionUser.value) == null ? void 0 : c.role) != null && r.isAdmin);
717
+ }), u = M(() => K.getBusinessId()), { tutorialOpen: d, startConnection: g, onConnected: x, onConnectionClosed: y } = St(u), v = w([]), C = w(), b = w(!0), I = w("");
718
+ let T, E;
719
+ const l = M(
720
+ () => v.value.filter((c) => me(c) !== void 0)
721
+ ), i = M(
722
+ () => [
723
+ {
724
+ label: m("connect.whatsappBot.accounts"),
725
+ value: N["$connect-WHATSAPP_BOT"],
726
+ badge: l.value.length
727
+ },
728
+ {
729
+ label: m("connect.whatsappBot.settings"),
730
+ value: N["$connect-WHATSAPP_BOT_SETTINGS"]
731
+ },
732
+ ...n.value ? [
733
+ {
734
+ label: m("connect.whatsappBot.logs.title"),
735
+ value: N["$connect-WHATSAPP_BOT_LOGS"]
736
+ }
737
+ ] : []
738
+ ]
739
+ ), f = M(() => {
740
+ const c = _.currentRoute.value.name;
741
+ return i.value.some((r) => r.value === c) ? c : N["$connect-WHATSAPP_BOT"];
742
+ });
743
+ async function h(c = !1) {
744
+ clearTimeout(E), T == null || T.abort();
745
+ const r = new AbortController();
746
+ T = r, c || (b.value = !0, I.value = "");
747
+ try {
748
+ const j = K.getBusinessId();
749
+ if (!j)
750
+ throw new Error(m("connect.whatsappBot.errors.selectBusiness"));
751
+ const O = await J.listClients(j, r.signal);
752
+ r.signal.aborted || (v.value = O, I.value = "");
753
+ } catch (j) {
754
+ !r.signal.aborted && !c && (I.value = j instanceof Error ? j.message : m("connect.whatsappBot.errors.loadSessions"));
755
+ } finally {
756
+ r.signal.aborted || (b.value = !1, E = setTimeout(() => void h(!0), 1e4));
757
+ }
758
+ }
759
+ function W(c) {
760
+ v.value = v.value.filter(
761
+ (r) => r.clientId !== c
762
+ ), h(!0);
763
+ }
764
+ const L = w(!1);
765
+ function P() {
766
+ g(l.value.length > 0), L.value = !0;
767
+ }
768
+ function V(c) {
769
+ C.value = c.clientId, v.value = [
770
+ ...v.value.filter((r) => r.clientId !== c.clientId),
771
+ c
772
+ ], x();
773
+ }
774
+ return H(L, (c) => {
775
+ c || (y(), h());
776
+ }), H(
777
+ u,
778
+ () => {
779
+ L.value = !1, C.value = void 0, v.value = [], h();
780
+ },
781
+ { immediate: !0 }
782
+ ), te(() => {
783
+ T == null || T.abort(), clearTimeout(E);
784
+ }), (c, r) => {
785
+ var oe, ne;
786
+ const j = B("FmPill"), O = B("FmButton"), q = B("RouterLink"), ee = B("RouterView"), U = B("FmCircularProgress");
787
+ return o(), p(G, null, [
788
+ t("div", Pt, [
789
+ t("div", Vt, [
790
+ t("div", Lt, [
791
+ t("h1", Dt, a(e(m)("connect.navigation.whatsappBot")), 1),
792
+ k(j, { variant: "beta" })
793
+ ]),
794
+ t("div", Et, [
795
+ k(O, {
796
+ variant: "tertiary",
797
+ label: e(m)("connect.whatsappBot.tutorial.learnMore"),
798
+ "prepend-icon": "help_outline",
799
+ class: "!h-[36px] !rounded-full !px-[16px] [&_.label]:text-[14px]",
800
+ onClick: r[0] || (r[0] = (F) => d.value = !0)
801
+ }, null, 8, ["label"]),
802
+ f.value === e(N)["$connect-WHATSAPP_BOT"] && l.value.length ? (o(), A(O, {
803
+ key: 0,
804
+ label: e(m)("connect.whatsappBot.connectAccountCta"),
805
+ "prepend-icon": "add",
806
+ class: "!h-[36px] !rounded-full !px-[16px] [&_.label]:text-[14px]",
807
+ onClick: P
808
+ }, null, 8, ["label"])) : D("", !0)
809
+ ])
810
+ ]),
811
+ l.value.length ? (o(), p("p", Mt, a(e(m)("connect.whatsappBot.description")), 1)) : D("", !0),
812
+ t("nav", {
813
+ "aria-label": e(m)("connect.navigation.whatsappBot"),
814
+ class: "mt-[16px] flex gap-[24px] overflow-x-auto border-b border-fm-color-neutral-gray-100"
815
+ }, [
816
+ (o(!0), p(G, null, X(i.value, (F) => (o(), A(q, {
817
+ key: F.value,
818
+ to: { name: F.value },
819
+ "aria-current": f.value === F.value ? "page" : void 0,
820
+ class: R([
821
+ "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",
822
+ f.value === F.value ? "border-fm-color-primary text-fm-color-primary" : "border-transparent text-fm-color-typo-secondary"
823
+ ])
824
+ }, {
825
+ default: S(() => [
826
+ Q(a(F.label) + " ", 1),
827
+ F.badge ? (o(), p("span", {
828
+ key: 0,
829
+ class: R([
830
+ "min-w-[20px] rounded-full px-[6px] text-center text-[12px] leading-[20px] font-semibold tabular-nums",
831
+ f.value === F.value ? "bg-fm-color-primary-oats text-fm-color-primary" : "bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
832
+ ])
833
+ }, a(F.badge), 3)) : D("", !0)
834
+ ]),
835
+ _: 2
836
+ }, 1032, ["to", "aria-current", "class"]))), 128))
837
+ ], 8, Wt),
838
+ f.value === e(N)["$connect-WHATSAPP_BOT_SETTINGS"] ? (o(), A(ee, { key: 1 })) : f.value === e(N)["$connect-WHATSAPP_BOT_LOGS"] ? (o(), A(ee, {
839
+ key: 2,
840
+ accounts: l.value
841
+ }, null, 8, ["accounts"])) : b.value ? (o(), p("output", jt, [
842
+ k(U),
843
+ Q(" " + a(e(m)("connect.whatsappBot.loadingSessions")), 1)
844
+ ])) : I.value ? (o(), p("div", Ot, [
845
+ t("p", Ut, a(I.value), 1),
846
+ k(O, {
847
+ label: e(m)("connect.whatsappBot.tryAgain"),
848
+ "prepend-icon": "refresh",
849
+ class: "!rounded-full [&_.label]:text-[14px]",
850
+ onClick: r[1] || (r[1] = (F) => h())
851
+ }, null, 8, ["label"])
852
+ ])) : l.value.length ? (o(), A(Se, {
853
+ key: 5,
854
+ accounts: l.value,
855
+ onRemoved: W
856
+ }, null, 8, ["accounts"])) : (o(), A(Ft, {
857
+ key: 6,
858
+ onConnect: P
859
+ }))
860
+ ]),
861
+ (o(), A(bt, {
862
+ key: u.value,
863
+ modelValue: L.value,
864
+ "onUpdate:modelValue": r[2] || (r[2] = (F) => L.value = F),
865
+ onConnected: V
866
+ }, null, 8, ["modelValue"])),
867
+ k(Ye, {
868
+ modelValue: e(d),
869
+ "onUpdate:modelValue": r[3] || (r[3] = (F) => ce(d) ? d.value = F : null),
870
+ "client-id": ((oe = l.value.find((F) => F.clientId === C.value)) == null ? void 0 : oe.clientId) ?? ((ne = l.value[0]) == null ? void 0 : ne.clientId)
871
+ }, null, 8, ["modelValue", "client-id"])
872
+ ], 64);
873
+ };
874
+ }
875
+ });
876
+ export {
877
+ Yt as default
878
+ };