@feedmepos/mf-connect 0.1.115-prod → 0.1.117-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 (153) hide show
  1. package/README.md +64 -1
  2. package/dist/{App-CvtSY8ZO.js → App-BpcsgH7K.js} +444 -427
  3. package/dist/AuditLogs-BNnUiVnD.js +2016 -0
  4. package/dist/{Bin-B3gS9QVZ.js → Bin-Cm0wjQeR.js} +8 -8
  5. package/dist/{Broadcast-DAeb-HaN.js → Broadcast-BoJaHqnO.js} +22 -21
  6. package/dist/{CampaignAnalytic-BfTaHVem.js → CampaignAnalytic-Eg4xZW0B.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zsei4OfG.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BXylK6Ze.js} +9 -9
  8. package/dist/{Card-JFeVIwFs.js → Card-BfkMcFaG.js} +25 -24
  9. package/dist/{Collections-xcDpEhIm.js → Collections-RXmxQbII.js} +197 -185
  10. package/dist/{Credit-C9HJZjDS.js → Credit-CsRPM1jv.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-DSqVY91w.js → DateRangeChip.vue_vue_type_script_setup_true_lang-D2tvK7pw.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-BgPeHurN.js +4442 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-C3J0rCTt.js → EffectSheet.vue_vue_type_style_index_0_lang-CUx8UIIq.js} +32 -32
  14. package/dist/{Experience-DszS8gto.js → Experience-BC8Pj-v9.js} +32 -31
  15. package/dist/{FileSaver.min-CFVQKaC-.js → FileSaver.min-DzmoQFA0.js} +1 -1
  16. package/dist/{Game-DhgeN7E2.js → Game-DJXNHFBs.js} +19 -18
  17. package/dist/{GiftCardSetup-CWm6IhrS.js → GiftCardSetup-_0n8lU-t.js} +75 -75
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-BuKADvmK.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-C-AiJdui.js} +7 -7
  19. package/dist/{Goals-DtRVierH.js → Goals-DSZwKpds.js} +4 -4
  20. package/dist/Grab-DDc7e-AC.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DlEFyu6h.js → ImageInput.vue_vue_type_script_setup_true_lang-BZb-H4fM.js} +1 -1
  22. package/dist/{Index-DFRcu_qE.js → Index-Cbi0bquE.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-B3Br4Xvi.js → LocationPicker.vue_vue_type_script_setup_true_lang-GLhMtvzi.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CjNJj3qj.js → LottieAnimation.vue_vue_type_script_setup_true_lang-Bt9CO_QR.js} +1 -1
  25. package/dist/{LoyaltyDashboard-BWHKDPzk.js → LoyaltyDashboard-fK90c27A.js} +15 -15
  26. package/dist/MainLayout-Bf-l9yL4.js +4 -0
  27. package/dist/{MainLayout-BmpNNAiE.js → MainLayout.vue_vue_type_script_setup_true_lang-COR6YYYI.js} +5 -4
  28. package/dist/Marketing-B7cZGsO-.js +269 -0
  29. package/dist/MarketingMaterialEdit-5IcV2ct6.js +1037 -0
  30. package/dist/{Member-xEzrBW_p.js → Member-BGTrRVdq.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-DRoC-I0t.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-DJr2hV2W.js} +43 -50
  32. package/dist/{MemberImportHistory-CEQpBBF8.js → MemberImportHistory--FxkTJmu.js} +7 -7
  33. package/dist/{MemberList-CCvzkHv8.js → MemberList-EjY5dgwt.js} +103 -105
  34. package/dist/{MemberTransactions-Bmh39J2W.js → MemberTransactions-Oia7LIFK.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-D3Pmk80l.js → MessageInput.vue_vue_type_script_setup_true_lang-CLOQZCYy.js} +14 -14
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DIBKAwHP.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-Ev3bB8cg.js} +1 -1
  37. package/dist/{Mission-CpUo2Bgw.js → Mission-BFHYb4aT.js} +22 -21
  38. package/dist/{Overview-DcDZmDXA.js → Overview-BVNyQxFL.js} +23 -22
  39. package/dist/{Overview-CwQqQ1Tn.js → Overview-d5U37aot.js} +145 -144
  40. package/dist/{Point-CUNQsQIx.js → Point-CXkqH02Z.js} +22 -21
  41. package/dist/{Promotion-Cqdim7aW.js → Promotion-DdxNvlOO.js} +137 -131
  42. package/dist/{Queue-CNBVh1UG.js → Queue-C96oNKyP.js} +46 -45
  43. package/dist/{Record-BYwz4l4o.js → Record-Bj2e2Y4i.js} +9 -9
  44. package/dist/{Review-CqLcZFj8.js → Review-CJK5S1oI.js} +2 -2
  45. package/dist/ReviewFacebookCallback-ChG7TRy5.js +225 -0
  46. package/dist/{ReviewGoogleCallback-Dg8R7QlO.js → ReviewGoogleCallback-Dmk4VyGA.js} +5 -5
  47. package/dist/{Reward-M8GZ8eHq.js → Reward-Dh2YI0Xb.js} +29 -29
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-BkM9-Sx-.js → RewardGroup.vue_vue_type_script_setup_true_lang-U47m3AAn.js} +16 -15
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-2L6ZGMW7.js +1923 -0
  50. package/dist/{Segment-CrMi6xrp.js → Segment-FYvtCkqH.js} +304 -305
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DKH5_9db.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DPZZz2e0.js} +31 -30
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-CyeAQ-hg.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-D8wBgLlS.js} +4 -4
  53. package/dist/Setting-CUAWjCqa.js +574 -0
  54. package/dist/{SettingAdvertisements-Dh7v4c1D.js → SettingAdvertisements-COIQwUD6.js} +12 -12
  55. package/dist/Settings-D2gFPvmW.js +286 -0
  56. package/dist/{Store-CV-BmK5b.js → Store-BAXwiyvx.js} +31 -30
  57. package/dist/{StoreRewards-DPhSLvSZ.js → StoreRewards-2mUavtUg.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-5g3yIL1a.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-DHi4rdT1.js +7007 -0
  60. package/dist/{Tier-ChvYps23.js → Tier-BmAOzRHL.js} +2576 -687
  61. package/dist/{Title-v-Ivswr1.js → Title-DMxiUg30.js} +94 -92
  62. package/dist/{Transaction-CRqE1Ix0.js → Transaction-CF6hXEpN.js} +2 -2
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-B0Uh9iuj.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BON_t0dL.js} +26 -26
  64. package/dist/{Voucher-Bg8FOuzD.js → Voucher-DrtITxq-.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-HKxivQMF.js → VoucherEditor.vue_vue_type_script_setup_true_lang-1DZOzJKx.js} +16 -16
  66. package/dist/WhatsappAccount-Bb0Y7ikk.js +159 -0
  67. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-CPlyzkp4.js +39 -0
  68. package/dist/WhatsappBot-DNvvaPey.js +876 -0
  69. package/dist/WhatsappBotLogs-C8M-1pvv.js +372 -0
  70. package/dist/WhatsappBotSettings-D6egqUyU.js +705 -0
  71. package/dist/WhatsappLayout-DeQTPuF6.js +21 -0
  72. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DI0pcHcE.js +253 -0
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-8d290Dcp.js → ZodTextField.vue_vue_type_script_setup_true_lang-CKZscSjU.js} +2 -2
  74. package/dist/{app-DdNKsn2Q.js → app-BjdLqYQq.js} +8879 -7107
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-R97FrSQL.js → base.export-B68z5BF6.js} +2 -2
  77. package/dist/browser-BSAOEeIM.js +1478 -0
  78. package/dist/{business-Ce8vq3wQ.js → business-D9fgkHxb.js} +1 -1
  79. package/dist/{campaign-C19If7bW.js → campaign-Dw_ujovr.js} +121 -94
  80. package/dist/{campaign-BTllt2LH.js → campaign-eMaPX8r6.js} +31 -25
  81. package/dist/{campaign.enum-9CCbalR4.js → campaign.enum-Dx-Zo68Q.js} +3 -2
  82. package/dist/{campaign.fn-B4g03h0A.js → campaign.fn-DFjGNvmN.js} +78 -78
  83. package/dist/{collectible.enum-MvqF7mSg.js → collectible.enum-Liy2wH3s.js} +1 -1
  84. package/dist/{collection.fn-CR0bD33S.js → collection.fn-CCOWtB-c.js} +2 -2
  85. package/dist/{currency-DmlguGIM.js → currency-CTLKReFC.js} +1 -1
  86. package/dist/duplicateCampaign-BcpBfUGL.js +51 -0
  87. package/dist/{effect-Dx3zfl28.js → effect-CTI1ZH57.js} +1 -1
  88. package/dist/{email-addresses-De5PGOY4.js → email-addresses-B74e3bnB.js} +2 -2
  89. package/dist/{feature-flag-CD9V1V0h.js → feature-flag-DVdEaChJ.js} +182 -166
  90. package/dist/google-BQK68wbe.js +5 -0
  91. package/dist/{helper-CEiv7SaO.js → helper-as9K-piK.js} +1 -1
  92. package/dist/{index-CBJy9bxB.js → index-3LjKJhQa.js} +1 -1
  93. package/dist/{index-BW6eb3n6.js → index-8mBfDn3M.js} +611 -252
  94. package/dist/{index-D4d3l0gw.js → index-B0h0iYWP.js} +8 -7
  95. package/dist/{index-BAXKd9Gg.js → index-BEKMTiFb.js} +198 -198
  96. package/dist/{index-B8yWVB8P.js → index-BW7FoVEA.js} +4 -3
  97. package/dist/{index-BVdYxi3l.js → index-B_wRpO02.js} +29 -15
  98. package/dist/{index-B8meeQoD.js → index-Ba719MYq.js} +1 -1
  99. package/dist/{index-BDPnyro2.js → index-BbVbqe4Y.js} +19 -6
  100. package/dist/{index-CqOCJTeR.js → index-BhTrG89b.js} +390 -232
  101. package/dist/index-C-iwb2Ln.js +109 -0
  102. package/dist/{index-CPODug8b.js → index-C5V6u2Qd.js} +2700 -2613
  103. package/dist/{index-CWUrODxL.js → index-CHU3UePP.js} +1 -1
  104. package/dist/{index-IZRfmmde.js → index-CQxkDpX0.js} +683 -581
  105. package/dist/{index-DT3S00_Y.js → index-CWLOcQ6j.js} +11 -10
  106. package/dist/index-C_H8jFYf.js +2743 -0
  107. package/dist/{index-__UT3_Ey.js → index-Ckz6u3ac.js} +2 -2
  108. package/dist/{index-BYI9ttxy.js → index-Czg-2Ni0.js} +8028 -10767
  109. package/dist/{index-xct3mnu8.js → index-DKI8401o.js} +7 -7
  110. package/dist/{index-649OZ_e1.js → index-DcZiikOH.js} +2 -2
  111. package/dist/{index-BquSqx6K.js → index-QHqcSN2q.js} +4 -4
  112. package/dist/{index-BR9h5DTI.js → index-TAoQpeLQ.js} +1 -1
  113. package/dist/index-wsCCqwdr.js +74 -0
  114. package/dist/{index.esm2017-AVbZ9btd.js → index.esm2017-DL6rTGDW.js} +177 -177
  115. package/dist/{loading-BvHm1m3K.js → loading-x6IScY4K.js} +1 -1
  116. package/dist/{lodash-Dvrceo7x.js → lodash-nwnDizYo.js} +1 -1
  117. package/dist/{member-import-c9avpiSS.js → member-import-C-b01Tyd.js} +6 -5
  118. package/dist/{membership-D-pZS634.js → membership-DfarOMtO.js} +3 -3
  119. package/dist/{money-D4skwMkD.js → money-CFn-jR4W.js} +1 -1
  120. package/dist/{number-DJ6ncfT6.js → number-CSlyDL2x.js} +1 -1
  121. package/dist/objectid-zcT6ESET.js +145 -0
  122. package/dist/{onboarding-t7R1d3h-.js → onboarding-DyaFaaF2.js} +25 -25
  123. package/dist/{onboardingSetup-lTaJc0oT.js → onboardingSetup-DQt91O9f.js} +2 -2
  124. package/dist/{plugins-DQNOWwRC.js → plugins-DEHr0UOe.js} +3 -3
  125. package/dist/{MarketingMaterialEdit-x3c_N7Gs.js → remy-icon-BhUGu2NI.js} +2 -1031
  126. package/dist/{reward-BK150pjm.js → reward-Du_Pv-4p.js} +1 -1
  127. package/dist/{rule-COcdAnUu.js → rule-DfqmQTVK.js} +572 -492
  128. package/dist/style.css +1 -1
  129. package/dist/template-CcbNF4PF.js +188 -0
  130. package/dist/{timezone-BP6UC4KL.js → timezone-_4tabIaK.js} +1 -1
  131. package/dist/{transaction.fn-BY0hzon0.js → transaction.fn-C46PHwCV.js} +2 -2
  132. package/dist/{trigger-DVBjVPbN.js → trigger-Dipr6btC.js} +8 -8
  133. package/dist/useMarketingMaterialActions-BAw2ZjeF.js +125 -0
  134. package/dist/{usePagination-QT552XyF.js → usePagination-D6RZ18zS.js} +1 -1
  135. package/dist/{user-CmAxNc7T.js → user-BCexQj3Q.js} +1 -1
  136. package/dist/vue-i18n-DXvyTCZf.js +2365 -0
  137. package/dist/{xlsx-DAczoc8y.js → xlsx-BTxt_Jg6.js} +224 -224
  138. package/dist/{zod-Aj-GuVQL.js → zod-T4wMYjWT.js} +1 -1
  139. package/package.json +6 -2
  140. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D_jXVE2I.js +0 -3494
  141. package/dist/Marketing-BKK45Eve.js +0 -236
  142. package/dist/ReviewFacebookCallback-DbSCILNN.js +0 -238
  143. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CnaL93TF.js +0 -1883
  144. package/dist/Setting-BnFRI0Se.js +0 -2037
  145. package/dist/Settings-BvT8_tkQ.js +0 -179
  146. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CDu1QySl.js +0 -1264
  147. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Dqz6jTlH.js +0 -142
  148. package/dist/google-C3S8u0mT.js +0 -4
  149. package/dist/objectid-DEMM_jdR.js +0 -145
  150. package/dist/rule-builder-Deufb6h_.js +0 -102
  151. package/dist/template-DeebIqJ_.js +0 -236
  152. package/dist/useMarketingMaterialActions-DpQCQHFI.js +0 -96
  153. package/dist/vue-i18n-Cze706-f.js +0 -2365
@@ -0,0 +1,876 @@
1
+ import { defineComponent as Z, ref as B, computed as M, watch as H, onBeforeUnmount as te, resolveComponent as k, 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 $, createCommentVNode as D, Fragment as N, renderList as X, mergeModels as le, useModel as se, isRef as ce } from "vue";
2
+ import { u as Y } from "./vue-i18n-DXvyTCZf.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 oe } from "./index-DKI8401o.js";
6
+ import { w as J } from "./index-wsCCqwdr.js";
7
+ import { u as ue, _ as de, w as me } from "./WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DI0pcHcE.js";
8
+ import { R as U } from "./app-BjdLqYQq.js";
9
+ import { _ as fe } from "./WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-CPlyzkp4.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(C, { emit: m }) {
25
+ const h = C, c = m, { t: n, locale: p } = Y(), u = B(!1), _ = B(""), f = B(!1), y = B(!1);
26
+ let x;
27
+ const {
28
+ name: A,
29
+ phoneNumber: b,
30
+ initials: I,
31
+ state: P,
32
+ avatarColor: w,
33
+ profilePictureUrl: l,
34
+ profilePictureFailed: g
35
+ } = ue(() => h.account), v = M(() => P.value === "connected"), d = M(() => ({
36
+ name: U["$connect-WHATSAPP_ACCOUNT"],
37
+ params: { clientId: h.account.clientId }
38
+ }));
39
+ function G(E) {
40
+ return new Intl.DateTimeFormat(p.value, {
41
+ year: "numeric",
42
+ month: "short",
43
+ day: "numeric"
44
+ }).format(new Date(E));
45
+ }
46
+ async function V() {
47
+ if (u.value) return;
48
+ const E = K.getBusinessId();
49
+ if (!E) {
50
+ _.value = n("connect.whatsappBot.errors.selectBusiness");
51
+ return;
52
+ }
53
+ const r = h.account.clientId, s = new AbortController();
54
+ x = s, u.value = !0, _.value = "";
55
+ try {
56
+ await J.deleteClient(E, r, s.signal), s.signal.aborted || c("removed", r);
57
+ } catch {
58
+ s.signal.aborted || (_.value = n("connect.whatsappBot.errors.removeAccount"));
59
+ } finally {
60
+ x === s && (x = void 0, u.value = !1);
61
+ }
62
+ }
63
+ function L() {
64
+ x == null || x.abort(), x = void 0, u.value = !1, _.value = "";
65
+ }
66
+ return H(
67
+ () => K.getBusinessId(),
68
+ () => {
69
+ L(), y.value = !1;
70
+ }
71
+ ), te(L), (E, r) => {
72
+ const s = k("RouterLink"), W = k("FmCircularProgress"), j = k("FmIcon"), q = k("FmMenuItem"), ee = k("FmMenu");
73
+ return o(), i("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": v.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(w)])
83
+ }, [
84
+ e(l) && !e(g) ? (o(), i("img", {
85
+ key: 0,
86
+ src: e(l),
87
+ alt: "",
88
+ class: "w-full h-full object-cover",
89
+ referrerpolicy: "no-referrer",
90
+ onError: r[0] || (r[0] = (O) => g.value = !0)
91
+ }, null, 40, he)) : (o(), i("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(A)
97
+ }, [
98
+ v.value ? (o(), T(s, {
99
+ key: 0,
100
+ to: d.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(A)), 1)
105
+ ]),
106
+ _: 1
107
+ }, 8, ["to"])) : (o(), i("span", be, a(e(A)), 1))
108
+ ], 8, ye),
109
+ t("p", we, a(e(b)), 1)
110
+ ]),
111
+ t("div", Be, [
112
+ $(ee, {
113
+ placement: "bottom-end",
114
+ width: 220,
115
+ disabled: u.value,
116
+ "stop-click-propagation": "",
117
+ onMenuChanged: r[3] || (r[3] = (O) => f.value = O)
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": f.value,
126
+ disabled: u.value,
127
+ "aria-busy": u.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": f.value }])
129
+ }, [
130
+ u.value ? (o(), T(W, {
131
+ key: 0,
132
+ size: "md",
133
+ "aria-hidden": "true"
134
+ })) : (o(), T(j, {
135
+ key: 1,
136
+ name: "more_vert",
137
+ size: "sm",
138
+ "aria-hidden": "true"
139
+ }))
140
+ ], 10, ke)
141
+ ]),
142
+ default: S(() => [
143
+ v.value ? (o(), T(q, {
144
+ key: 0,
145
+ label: e(n)("connect.whatsappBot.notificationGroup.title"),
146
+ disabled: u.value,
147
+ "onUpdate:modelValue": r[1] || (r[1] = (O) => y.value = !0)
148
+ }, {
149
+ prepend: S(() => [
150
+ $(j, {
151
+ name: "notifications",
152
+ size: "sm",
153
+ outline: "",
154
+ "aria-hidden": "true"
155
+ })
156
+ ]),
157
+ _: 1
158
+ }, 8, ["label", "disabled"])) : D("", !0),
159
+ $(q, {
160
+ disabled: u.value,
161
+ "onUpdate:modelValue": r[2] || (r[2] = (O) => V())
162
+ }, {
163
+ prepend: S(() => [
164
+ $(j, {
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
+ $(fe, { state: e(P) }, null, 8, ["state"]),
184
+ v.value && C.account.connectedAt ? (o(), i("span", Ae, a(e(n)("connect.whatsappBot.connectedSince", {
185
+ date: G(C.account.connectedAt)
186
+ })), 1)) : D("", !0)
187
+ ]),
188
+ _.value ? (o(), i("p", Ie, a(_.value), 1)) : D("", !0)
189
+ ], 2),
190
+ y.value ? (o(), T(de, {
191
+ key: 0,
192
+ modelValue: y.value,
193
+ "onUpdate:modelValue": r[4] || (r[4] = (O) => y.value = O),
194
+ account: C.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(C, { emit: m }) {
206
+ const h = m;
207
+ return (c, n) => (o(), i("ul", Fe, [
208
+ (o(!0), i(N, null, X(C.accounts, (p) => (o(), T(Te, {
209
+ key: p.clientId,
210
+ account: p,
211
+ onRemoved: n[0] || (n[0] = (u) => h("removed", u))
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
+ role: "status",
236
+ class: "flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
237
+ }, He = {
238
+ role: "alert",
239
+ class: "text-[14px] text-fm-color-typo-error"
240
+ }, 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({
241
+ __name: "WhatsappBotTutorialDialog",
242
+ props: /* @__PURE__ */ le({
243
+ clientId: {}
244
+ }, {
245
+ modelValue: { type: Boolean, required: !0 },
246
+ modelModifiers: {}
247
+ }),
248
+ emits: ["update:modelValue"],
249
+ setup(C) {
250
+ const m = C, h = se(C, "modelValue"), { t: c } = Y(), n = B(0), p = M(() => z[n.value]), u = M(
251
+ () => n.value === z.length - 1
252
+ ), _ = M(() => K.getBusinessId()), f = B(""), y = B(""), x = B(!1), A = B("");
253
+ let b;
254
+ async function I() {
255
+ b == null || b.abort();
256
+ const w = new AbortController();
257
+ b = w, f.value = "", y.value = "", A.value = "", x.value = !0;
258
+ try {
259
+ if (!_.value || !m.clientId) {
260
+ A.value = c(
261
+ _.value ? "connect.whatsappBot.notificationGroup.notReady" : "connect.whatsappBot.errors.selectBusiness"
262
+ );
263
+ return;
264
+ }
265
+ const l = await J.getNotificationGroup(
266
+ _.value,
267
+ m.clientId,
268
+ w.signal
269
+ );
270
+ if (w.signal.aborted) return;
271
+ const g = await re.toDataURL(l.inviteLink, {
272
+ width: 224,
273
+ margin: 2,
274
+ errorCorrectionLevel: "M"
275
+ });
276
+ if (w.signal.aborted) return;
277
+ f.value = l.inviteLink, y.value = g;
278
+ } catch (l) {
279
+ if (w.signal.aborted) return;
280
+ A.value = c(
281
+ l instanceof oe && l.status === 409 ? "connect.whatsappBot.notificationGroup.notReady" : l instanceof oe && l.status === 404 ? "connect.whatsappBot.errors.accountNotFound" : "connect.whatsappBot.errors.loadGroup"
282
+ );
283
+ } finally {
284
+ w.signal.aborted || (x.value = !1);
285
+ }
286
+ }
287
+ H(
288
+ [h, () => p.value.key, _, () => m.clientId],
289
+ ([w, l]) => {
290
+ w && l === "escalations" ? I() : b == null || b.abort();
291
+ }
292
+ ), te(() => b == null ? void 0 : b.abort());
293
+ function P() {
294
+ u.value ? h.value = !1 : n.value += 1;
295
+ }
296
+ return H(h, (w) => {
297
+ w && (n.value = 0);
298
+ }), (w, l) => {
299
+ const g = k("FmIcon"), v = k("FmCircularProgress"), d = k("FmButton"), G = k("FmDialog");
300
+ return o(), T(G, {
301
+ modelValue: h.value,
302
+ "onUpdate:modelValue": l[1] || (l[1] = (V) => h.value = V),
303
+ "min-width": "min(600px, calc(100% - 32px))",
304
+ "max-width": "600px",
305
+ "max-height": "90vh",
306
+ "dismiss-away": ""
307
+ }, {
308
+ "dialog-header": S(() => [
309
+ t("h2", Pe, a(e(c)("connect.whatsappBot.tutorial.title")), 1)
310
+ ]),
311
+ "dialog-footer": S(() => [
312
+ t("div", Xe, [
313
+ $(d, {
314
+ variant: "secondary",
315
+ "border-color": "neutral-gray-200",
316
+ label: e(c)("connect.common.back"),
317
+ disabled: n.value === 0,
318
+ "prepend-icon": "chevron_left",
319
+ class: "!rounded-full [&_.label]:text-[14px]",
320
+ onClick: l[0] || (l[0] = (V) => n.value -= 1)
321
+ }, null, 8, ["label", "disabled"]),
322
+ $(d, {
323
+ label: u.value ? e(c)("connect.whatsappBot.tutorial.done") : e(c)("connect.common.next"),
324
+ "append-icon": u.value ? void 0 : "chevron_right",
325
+ class: "!rounded-full [&_.label]:text-[14px]",
326
+ onClick: P
327
+ }, null, 8, ["label", "append-icon"])
328
+ ])
329
+ ]),
330
+ default: S(() => [
331
+ t("div", Ve, [
332
+ t("div", Le, [
333
+ t("p", De, a(e(c)("connect.whatsappBot.tutorial.progress", {
334
+ current: n.value + 1,
335
+ total: e(z).length
336
+ })), 1),
337
+ t("div", Ee, [
338
+ (o(!0), i(N, null, X(e(z), (V, L) => (o(), i("span", {
339
+ key: L,
340
+ class: R([
341
+ "h-[4px] flex-1 rounded-full",
342
+ L <= n.value ? "bg-fm-color-primary" : "bg-fm-color-neutral-gray-100"
343
+ ])
344
+ }, null, 2))), 128))
345
+ ])
346
+ ]),
347
+ t("div", Me, [
348
+ t("span", We, a(e(c)("connect.whatsappBot.tutorial.progress", {
349
+ current: n.value + 1,
350
+ total: e(z).length
351
+ })), 1),
352
+ t("div", je, [
353
+ $(g, {
354
+ name: p.value.icon,
355
+ size: "lg"
356
+ }, null, 8, ["name"])
357
+ ]),
358
+ t("div", Oe, [
359
+ t("h3", Ue, a(e(c)(`connect.whatsappBot.tutorial.steps.${p.value.key}.title`)), 1),
360
+ t("p", Ne, a(e(c)(
361
+ `connect.whatsappBot.tutorial.steps.${p.value.key}.description`
362
+ )), 1)
363
+ ]),
364
+ p.value.key === "escalations" ? (o(), i("div", Ge, [
365
+ x.value ? (o(), i("div", Re, [
366
+ $(v),
367
+ Q(" " + a(e(c)("connect.whatsappBot.notificationGroup.loading")), 1)
368
+ ])) : A.value ? (o(), i(N, { key: 1 }, [
369
+ t("p", He, a(A.value), 1),
370
+ $(d, {
371
+ label: e(c)("connect.whatsappBot.tryAgain"),
372
+ "prepend-icon": "refresh",
373
+ class: "!rounded-full [&_.label]:text-[14px]",
374
+ onClick: I
375
+ }, null, 8, ["label"])
376
+ ], 64)) : f.value ? (o(), i(N, { key: 2 }, [
377
+ t("img", {
378
+ src: y.value,
379
+ alt: e(c)("connect.whatsappBot.notificationGroup.qrAlt"),
380
+ width: "224",
381
+ height: "224",
382
+ class: "rounded-[12px] border border-fm-color-neutral-gray-100"
383
+ }, null, 8, ze),
384
+ t("div", Qe, [
385
+ t("span", Ke, a(e(c)("connect.whatsappBot.notificationGroup.inviteLink")), 1),
386
+ t("a", {
387
+ href: f.value,
388
+ target: "_blank",
389
+ rel: "noopener noreferrer",
390
+ 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"
391
+ }, a(f.value), 9, Ze)
392
+ ])
393
+ ], 64)) : D("", !0)
394
+ ])) : D("", !0),
395
+ t("p", Je, a(e(c)(`connect.whatsappBot.tutorial.steps.${p.value.key}.hint`)), 1)
396
+ ])
397
+ ])
398
+ ]),
399
+ _: 1
400
+ }, 8, ["modelValue"]);
401
+ };
402
+ }
403
+ }), qe = { class: "text-[18px] font-semibold" }, et = {
404
+ key: 0,
405
+ role: "status",
406
+ class: "flex flex-col items-center text-center gap-[8px] px-[8px] py-[40px]"
407
+ }, tt = { class: "text-[18px] font-semibold" }, ot = { class: "text-[14px] text-fm-color-typo-secondary break-all" }, nt = {
408
+ key: 1,
409
+ class: "grid grid-cols-[minmax(0,1fr)_232px] xs:grid-cols-1 gap-[32px] p-[8px] xs:p-[0px]"
410
+ }, 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 = {
411
+ key: 0,
412
+ role: "status",
413
+ class: "flex flex-col items-center gap-[12px] text-[13px]"
414
+ }, ht = {
415
+ key: 1,
416
+ class: "flex flex-col items-center text-center gap-[12px] p-[12px]"
417
+ }, _t = {
418
+ role: "alert",
419
+ class: "text-[14px] text-fm-color-typo-error"
420
+ }, gt = ["src", "alt"], yt = {
421
+ key: 3,
422
+ role: "status",
423
+ "aria-live": "polite",
424
+ class: "absolute inset-0 bg-fm-color-neutral-white/90 flex flex-col items-center justify-center gap-[10px] text-[13px] font-medium"
425
+ }, bt = /* @__PURE__ */ Z({
426
+ __name: "WhatsappConnectDialog",
427
+ props: {
428
+ modelValue: { type: Boolean, required: !0 },
429
+ modelModifiers: {}
430
+ },
431
+ emits: /* @__PURE__ */ le(["connected"], ["update:modelValue"]),
432
+ setup(C, { emit: m }) {
433
+ const h = se(C, "modelValue"), c = m, { t: n } = Y(), p = B(""), u = B(!1), _ = B(""), f = B(!1), y = B();
434
+ let x, A, b;
435
+ function I() {
436
+ x == null || x.abort(), clearTimeout(A), A = void 0, clearTimeout(b), b = void 0;
437
+ }
438
+ async function P(l, g, v) {
439
+ if (!v.aborted) {
440
+ try {
441
+ const d = await J.getClient(l, g, v);
442
+ if (v.aborted) return;
443
+ if (f.value = d.status === "connected" || d.status === "connecting" && d.connectedAt !== null, d.status === "connected" && d.connectedAt !== null && d.profileStatus === "ready") {
444
+ I(), f.value = !1, y.value = d, c("connected", d), b = setTimeout(() => {
445
+ h.value = !1;
446
+ }, 1800);
447
+ return;
448
+ }
449
+ if (d.status === "disconnected") {
450
+ I(), f.value = !1, p.value = "", _.value = n("connect.whatsappBot.errors.qrExpired");
451
+ return;
452
+ }
453
+ } catch (d) {
454
+ if (v.aborted) return;
455
+ if (d instanceof oe && d.status === 409) {
456
+ I(), f.value = !1, p.value = "", _.value = n("connect.whatsappBot.errors.accountAlreadyLinked");
457
+ return;
458
+ }
459
+ }
460
+ v.aborted || (A = setTimeout(() => {
461
+ P(l, g, v);
462
+ }, 2e3));
463
+ }
464
+ }
465
+ async function w() {
466
+ I();
467
+ const l = new AbortController();
468
+ x = l, p.value = "", _.value = "", f.value = !1, y.value = void 0, u.value = !0;
469
+ try {
470
+ const g = K.getBusinessId();
471
+ if (!g)
472
+ throw new Error(n("connect.whatsappBot.errors.selectBusiness"));
473
+ const v = await J.createClient(
474
+ g,
475
+ l.signal
476
+ ), d = await re.toDataURL(v.qr, {
477
+ width: 224,
478
+ margin: 2,
479
+ errorCorrectionLevel: "M"
480
+ });
481
+ l.signal.aborted || (p.value = d, P(g, v.clientId, l.signal));
482
+ } catch (g) {
483
+ l.signal.aborted || (_.value = g instanceof Error ? g.message : n("connect.whatsappBot.errors.loadQr"));
484
+ } finally {
485
+ l.signal.aborted || (u.value = !1);
486
+ }
487
+ }
488
+ return H(
489
+ h,
490
+ (l) => {
491
+ l ? w() : I();
492
+ },
493
+ { immediate: !0 }
494
+ ), te(I), (l, g) => {
495
+ const v = k("i18n-t"), d = k("FmCircularProgress"), G = k("FmButton"), V = k("FmDialog");
496
+ return o(), T(V, {
497
+ modelValue: h.value,
498
+ "onUpdate:modelValue": g[0] || (g[0] = (L) => h.value = L),
499
+ "min-width": "min(720px, calc(100% - 32px))",
500
+ "max-width": "720px",
501
+ "max-height": "90vh",
502
+ "dismiss-away": ""
503
+ }, {
504
+ "dialog-header": S(() => [
505
+ t("h2", qe, a(e(n)("connect.whatsappBot.connectAccount")), 1)
506
+ ]),
507
+ default: S(() => {
508
+ var L, E, r;
509
+ return [
510
+ y.value ? (o(), i("div", et, [
511
+ g[1] || (g[1] = t("div", {
512
+ "aria-hidden": "true",
513
+ 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]"
514
+ }, [
515
+ t("svg", {
516
+ width: "32",
517
+ height: "32",
518
+ viewBox: "0 0 24 24",
519
+ fill: "none",
520
+ stroke: "currentColor",
521
+ "stroke-width": "2.2",
522
+ "stroke-linecap": "round",
523
+ "stroke-linejoin": "round"
524
+ }, [
525
+ t("path", { d: "M20 6 9 17l-5-5" })
526
+ ])
527
+ ], -1)),
528
+ t("h3", tt, a(e(n)("connect.whatsappBot.accountConnected")), 1),
529
+ t("p", ot, a(((L = y.value.account) == null ? void 0 : L.businessName) || ((E = y.value.account) == null ? void 0 : E.name) || e(n)("connect.whatsappBot.unnamedAccount")) + " · " + a(((r = y.value.account) == null ? void 0 : r.phoneNumber) || e(n)("connect.whatsappBot.phoneUnavailable")), 1)
530
+ ])) : (o(), i("div", nt, [
531
+ t("div", at, [
532
+ t("p", lt, a(e(n)("connect.whatsappBot.scanDescription")), 1),
533
+ t("ol", st, [
534
+ (o(), i(N, null, X(4, (s) => t("li", {
535
+ key: s,
536
+ class: "flex gap-[12px]"
537
+ }, [
538
+ t("span", rt, a(s), 1),
539
+ s === 1 ? (o(), i("span", ct, a(e(n)("connect.whatsappBot.steps.openApp")), 1)) : s === 2 ? (o(), T(v, {
540
+ key: 1,
541
+ keypath: "connect.whatsappBot.steps.openSettings",
542
+ tag: "span",
543
+ scope: "global"
544
+ }, {
545
+ menu: S(() => [
546
+ t("b", it, a(e(n)("connect.whatsappBot.menu")), 1)
547
+ ]),
548
+ settings: S(() => [
549
+ t("b", pt, a(e(n)("connect.whatsappBot.settings")), 1)
550
+ ]),
551
+ _: 1
552
+ })) : s === 3 ? (o(), T(v, {
553
+ key: 2,
554
+ keypath: "connect.whatsappBot.steps.linkDevice",
555
+ tag: "span",
556
+ scope: "global"
557
+ }, {
558
+ linkedDevices: S(() => [
559
+ t("b", ut, a(e(n)("connect.whatsappBot.linkedDevices")), 1)
560
+ ]),
561
+ linkDevice: S(() => [
562
+ t("b", dt, a(e(n)("connect.whatsappBot.linkDevice")), 1)
563
+ ]),
564
+ _: 1
565
+ })) : (o(), i("span", mt, a(e(n)("connect.whatsappBot.steps.scanQr")), 1))
566
+ ])), 64))
567
+ ]),
568
+ t("p", ft, a(e(n)("connect.whatsappBot.connectionNote")), 1)
569
+ ]),
570
+ t("div", xt, [
571
+ u.value ? (o(), i("div", vt, [
572
+ $(d),
573
+ Q(a(e(n)("connect.whatsappBot.generatingQr")), 1)
574
+ ])) : _.value ? (o(), i("div", ht, [
575
+ t("p", _t, a(_.value), 1),
576
+ $(G, {
577
+ label: e(n)("connect.whatsappBot.tryAgain"),
578
+ "prepend-icon": "refresh",
579
+ class: "!rounded-full [&_.label]:text-[14px]",
580
+ onClick: w
581
+ }, null, 8, ["label"])
582
+ ])) : p.value ? (o(), i("img", {
583
+ key: 2,
584
+ src: p.value,
585
+ alt: e(n)("connect.whatsappBot.qrAlt"),
586
+ width: "224",
587
+ height: "224",
588
+ class: R({ "opacity-20": f.value })
589
+ }, null, 10, gt)) : D("", !0),
590
+ f.value ? (o(), i("div", yt, [
591
+ $(d),
592
+ Q(" " + a(e(n)("connect.whatsappBot.connecting")), 1)
593
+ ])) : D("", !0)
594
+ ])
595
+ ]))
596
+ ];
597
+ }),
598
+ _: 1
599
+ }, 8, ["modelValue"]);
600
+ };
601
+ }
602
+ }), 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 = {
603
+ "aria-hidden": "true",
604
+ class: "flex h-[36px] w-[36px] shrink-0 items-center justify-center rounded-[10px] bg-fm-color-primary-oats text-fm-color-primary"
605
+ }, 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({
606
+ __name: "WhatsappEmptyState",
607
+ emits: ["connect"],
608
+ setup(C, { emit: m }) {
609
+ const h = m, { t: c } = Y();
610
+ return (n, p) => {
611
+ const u = k("FmIcon"), _ = k("FmButton");
612
+ return o(), i("div", wt, [
613
+ p[1] || (p[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]" }, [
614
+ t("svg", {
615
+ width: "34",
616
+ height: "34",
617
+ viewBox: "0 0 24 24",
618
+ fill: "none",
619
+ stroke: "currentColor",
620
+ "stroke-width": "1.6",
621
+ "stroke-linecap": "round",
622
+ "stroke-linejoin": "round",
623
+ "aria-hidden": "true"
624
+ }, [
625
+ t("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
626
+ t("path", { d: "M9 10h.01M12 10h.01M15 10h.01" })
627
+ ])
628
+ ], -1)),
629
+ t("h2", Bt, a(e(c)("connect.whatsappBot.emptyTitle")), 1),
630
+ t("p", kt, a(e(c)("connect.whatsappBot.emptyDescription")), 1),
631
+ t("ul", {
632
+ "aria-label": e(c)("connect.whatsappBot.tutorial.title"),
633
+ class: "mt-[24px] grid w-full max-w-[880px] grid-cols-2 xs:grid-cols-1 gap-[20px] text-left"
634
+ }, [
635
+ (o(!0), i(N, null, X(e(z), (f) => (o(), i("li", {
636
+ key: f.key,
637
+ class: "flex items-start gap-[12px]"
638
+ }, [
639
+ t("div", Ct, [
640
+ $(u, {
641
+ name: f.icon,
642
+ size: "sm"
643
+ }, null, 8, ["name"])
644
+ ]),
645
+ t("div", At, [
646
+ t("h3", It, a(e(c)(`connect.whatsappBot.tutorial.steps.${f.key}.title`)), 1),
647
+ t("p", Tt, a(e(c)(`connect.whatsappBot.tutorial.steps.${f.key}.description`)), 1)
648
+ ])
649
+ ]))), 128))
650
+ ], 8, $t),
651
+ $(_, {
652
+ class: "mt-[16px] !rounded-full !px-[20px] [&_.label]:text-[14px]",
653
+ label: e(c)("connect.whatsappBot.connectAccount"),
654
+ "prepend-icon": "add",
655
+ onClick: p[0] || (p[0] = (f) => h("connect"))
656
+ }, null, 8, ["label"])
657
+ ]);
658
+ };
659
+ }
660
+ });
661
+ function St(C) {
662
+ const m = B(!1);
663
+ let h = !1, c = !1, n = !1;
664
+ function p() {
665
+ return `feedme_connect_whatsapp_bot_tutorial:${C.value}`;
666
+ }
667
+ function u(y) {
668
+ let x = n;
669
+ try {
670
+ x || (x = localStorage.getItem(p()) === "1");
671
+ } catch {
672
+ }
673
+ h = !!C.value && !y && !x, c = !1;
674
+ }
675
+ function _() {
676
+ c = h;
677
+ }
678
+ function f() {
679
+ if (c) {
680
+ m.value = !0, n = !0;
681
+ try {
682
+ localStorage.setItem(p(), "1");
683
+ } catch {
684
+ }
685
+ }
686
+ h = !1, c = !1;
687
+ }
688
+ return H(
689
+ C,
690
+ () => {
691
+ m.value = !1, h = !1, c = !1, n = !1;
692
+ },
693
+ { flush: "sync" }
694
+ ), { tutorialOpen: m, startConnection: u, onConnected: _, onConnectionClosed: f };
695
+ }
696
+ 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 = {
697
+ key: 0,
698
+ class: "mt-[8px] w-full text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]"
699
+ }, Wt = ["aria-label"], jt = {
700
+ key: 3,
701
+ role: "status",
702
+ class: "mt-[24px] py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
703
+ }, Ot = {
704
+ key: 4,
705
+ 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]"
706
+ }, Ut = {
707
+ role: "alert",
708
+ class: "text-[14px] text-fm-color-typo-error"
709
+ }, Yt = /* @__PURE__ */ Z({
710
+ __name: "WhatsappBot",
711
+ setup(C) {
712
+ const { t: m } = Y(), h = ie(), c = pe(), n = M(() => {
713
+ var r, s;
714
+ return !!((s = (r = c.sessionUser.value) == null ? void 0 : r.role) != null && s.isAdmin);
715
+ }), p = M(() => K.getBusinessId()), { tutorialOpen: u, startConnection: _, onConnected: f, onConnectionClosed: y } = St(p), x = B([]), A = B(), b = B(!0), I = B("");
716
+ let P, w;
717
+ const l = M(
718
+ () => x.value.filter((r) => me(r) !== void 0)
719
+ ), g = M(
720
+ () => [
721
+ {
722
+ label: m("connect.whatsappBot.accounts"),
723
+ value: U["$connect-WHATSAPP_BOT"],
724
+ badge: l.value.length
725
+ },
726
+ {
727
+ label: m("connect.whatsappBot.settings"),
728
+ value: U["$connect-WHATSAPP_BOT_SETTINGS"]
729
+ },
730
+ ...n.value ? [
731
+ {
732
+ label: m("connect.whatsappBot.logs.title"),
733
+ value: U["$connect-WHATSAPP_BOT_LOGS"]
734
+ }
735
+ ] : []
736
+ ]
737
+ ), v = M(() => {
738
+ const r = h.currentRoute.value.name;
739
+ return g.value.some((s) => s.value === r) ? r : U["$connect-WHATSAPP_BOT"];
740
+ });
741
+ async function d(r = !1) {
742
+ clearTimeout(w), P == null || P.abort();
743
+ const s = new AbortController();
744
+ P = s, r || (b.value = !0, I.value = "");
745
+ try {
746
+ const W = K.getBusinessId();
747
+ if (!W)
748
+ throw new Error(m("connect.whatsappBot.errors.selectBusiness"));
749
+ const j = await J.listClients(W, s.signal);
750
+ s.signal.aborted || (x.value = j, I.value = "");
751
+ } catch (W) {
752
+ !s.signal.aborted && !r && (I.value = W instanceof Error ? W.message : m("connect.whatsappBot.errors.loadSessions"));
753
+ } finally {
754
+ s.signal.aborted || (b.value = !1, w = setTimeout(() => void d(!0), 1e4));
755
+ }
756
+ }
757
+ function G(r) {
758
+ x.value = x.value.filter(
759
+ (s) => s.clientId !== r
760
+ ), d(!0);
761
+ }
762
+ const V = B(!1);
763
+ function L() {
764
+ _(l.value.length > 0), V.value = !0;
765
+ }
766
+ function E(r) {
767
+ A.value = r.clientId, x.value = [
768
+ ...x.value.filter((s) => s.clientId !== r.clientId),
769
+ r
770
+ ], f();
771
+ }
772
+ return H(V, (r) => {
773
+ r || (y(), d());
774
+ }), H(
775
+ p,
776
+ () => {
777
+ V.value = !1, A.value = void 0, x.value = [], d();
778
+ },
779
+ { immediate: !0 }
780
+ ), te(() => {
781
+ P == null || P.abort(), clearTimeout(w);
782
+ }), (r, s) => {
783
+ var ne, ae;
784
+ const W = k("FmPill"), j = k("FmButton"), q = k("RouterLink"), ee = k("RouterView"), O = k("FmCircularProgress");
785
+ return o(), i(N, null, [
786
+ t("div", Pt, [
787
+ t("div", Vt, [
788
+ t("div", Lt, [
789
+ t("h1", Dt, a(e(m)("connect.navigation.whatsappBot")), 1),
790
+ $(W, { variant: "beta" })
791
+ ]),
792
+ t("div", Et, [
793
+ $(j, {
794
+ variant: "tertiary",
795
+ label: e(m)("connect.whatsappBot.tutorial.learnMore"),
796
+ "prepend-icon": "help_outline",
797
+ class: "!h-[36px] !rounded-full !px-[16px] [&_.label]:text-[14px]",
798
+ onClick: s[0] || (s[0] = (F) => u.value = !0)
799
+ }, null, 8, ["label"]),
800
+ v.value === e(U)["$connect-WHATSAPP_BOT"] && l.value.length ? (o(), T(j, {
801
+ key: 0,
802
+ label: e(m)("connect.whatsappBot.connectAccountCta"),
803
+ "prepend-icon": "add",
804
+ class: "!h-[36px] !rounded-full !px-[16px] [&_.label]:text-[14px]",
805
+ onClick: L
806
+ }, null, 8, ["label"])) : D("", !0)
807
+ ])
808
+ ]),
809
+ l.value.length ? (o(), i("p", Mt, a(e(m)("connect.whatsappBot.description")), 1)) : D("", !0),
810
+ t("nav", {
811
+ "aria-label": e(m)("connect.navigation.whatsappBot"),
812
+ class: "mt-[16px] flex gap-[24px] overflow-x-auto border-b border-fm-color-neutral-gray-100"
813
+ }, [
814
+ (o(!0), i(N, null, X(g.value, (F) => (o(), T(q, {
815
+ key: F.value,
816
+ to: { name: F.value },
817
+ "aria-current": v.value === F.value ? "page" : void 0,
818
+ class: R([
819
+ "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",
820
+ v.value === F.value ? "border-fm-color-primary text-fm-color-primary" : "border-transparent text-fm-color-typo-secondary"
821
+ ])
822
+ }, {
823
+ default: S(() => [
824
+ Q(a(F.label) + " ", 1),
825
+ F.badge ? (o(), i("span", {
826
+ key: 0,
827
+ class: R([
828
+ "min-w-[20px] rounded-full px-[6px] text-center text-[12px] leading-[20px] font-semibold tabular-nums",
829
+ v.value === F.value ? "bg-fm-color-primary-oats text-fm-color-primary" : "bg-fm-color-neutral-gray-100 text-fm-color-typo-secondary"
830
+ ])
831
+ }, a(F.badge), 3)) : D("", !0)
832
+ ]),
833
+ _: 2
834
+ }, 1032, ["to", "aria-current", "class"]))), 128))
835
+ ], 8, Wt),
836
+ v.value === e(U)["$connect-WHATSAPP_BOT_SETTINGS"] ? (o(), T(ee, { key: 1 })) : v.value === e(U)["$connect-WHATSAPP_BOT_LOGS"] ? (o(), T(ee, {
837
+ key: 2,
838
+ accounts: l.value
839
+ }, null, 8, ["accounts"])) : b.value ? (o(), i("div", jt, [
840
+ $(O),
841
+ Q(" " + a(e(m)("connect.whatsappBot.loadingSessions")), 1)
842
+ ])) : I.value ? (o(), i("div", Ot, [
843
+ t("p", Ut, a(I.value), 1),
844
+ $(j, {
845
+ label: e(m)("connect.whatsappBot.tryAgain"),
846
+ "prepend-icon": "refresh",
847
+ class: "!rounded-full [&_.label]:text-[14px]",
848
+ onClick: s[1] || (s[1] = (F) => d())
849
+ }, null, 8, ["label"])
850
+ ])) : l.value.length ? (o(), T(Se, {
851
+ key: 5,
852
+ accounts: l.value,
853
+ onRemoved: G
854
+ }, null, 8, ["accounts"])) : (o(), T(Ft, {
855
+ key: 6,
856
+ onConnect: L
857
+ }))
858
+ ]),
859
+ (o(), T(bt, {
860
+ key: p.value,
861
+ modelValue: V.value,
862
+ "onUpdate:modelValue": s[2] || (s[2] = (F) => V.value = F),
863
+ onConnected: E
864
+ }, null, 8, ["modelValue"])),
865
+ $(Ye, {
866
+ modelValue: e(u),
867
+ "onUpdate:modelValue": s[3] || (s[3] = (F) => ce(u) ? u.value = F : null),
868
+ "client-id": ((ne = l.value.find((F) => F.clientId === A.value)) == null ? void 0 : ne.clientId) ?? ((ae = l.value[0]) == null ? void 0 : ae.clientId)
869
+ }, null, 8, ["modelValue", "client-id"])
870
+ ], 64);
871
+ };
872
+ }
873
+ });
874
+ export {
875
+ Yt as default
876
+ };