@feedmepos/mf-connect 0.1.115-dev → 0.1.115-prod

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +1 -66
  2. package/dist/{App-43mZfFAr.js → App-CvtSY8ZO.js} +618 -652
  3. package/dist/{Bin-CA7v180Y.js → Bin-B3gS9QVZ.js} +8 -8
  4. package/dist/{Broadcast-qmdifF2Y.js → Broadcast-DAeb-HaN.js} +21 -22
  5. package/dist/{CampaignAnalytic-xnrDxqaH.js → CampaignAnalytic-BfTaHVem.js} +7 -7
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zjk-QdtX.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zsei4OfG.js} +9 -9
  7. package/dist/{Card-D8icsk7L.js → Card-JFeVIwFs.js} +24 -25
  8. package/dist/{Collections--THcD-E_.js → Collections-xcDpEhIm.js} +185 -197
  9. package/dist/{Credit-JrbtVMBp.js → Credit-C9HJZjDS.js} +20 -21
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-DrwKtnE5.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DSqVY91w.js} +1 -1
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-D_jXVE2I.js +3494 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-hVgqWdD0.js → EffectSheet.vue_vue_type_style_index_0_lang-C3J0rCTt.js} +32 -32
  13. package/dist/{Experience-CFeRqBoj.js → Experience-DszS8gto.js} +31 -32
  14. package/dist/{FileSaver.min-CCXIBm58.js → FileSaver.min-CFVQKaC-.js} +1 -1
  15. package/dist/{Game-CPxq6Ex3.js → Game-DhgeN7E2.js} +18 -19
  16. package/dist/{GiftCardSetup-D0esVZDp.js → GiftCardSetup-CWm6IhrS.js} +75 -75
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-CJ1-vL-K.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-BuKADvmK.js} +7 -7
  18. package/dist/{Goals-DaKI6uXt.js → Goals-DtRVierH.js} +4 -4
  19. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BOnL0GxM.js → ImageInput.vue_vue_type_script_setup_true_lang-DlEFyu6h.js} +1 -1
  20. package/dist/{Index-2kENoaZm.js → Index-DFRcu_qE.js} +10 -10
  21. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-BtWnJKU_.js → LocationPicker.vue_vue_type_script_setup_true_lang-B3Br4Xvi.js} +1 -1
  22. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CX_Sspu5.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CjNJj3qj.js} +1 -1
  23. package/dist/{LoyaltyDashboard-CB93Fz8u.js → LoyaltyDashboard-BWHKDPzk.js} +15 -15
  24. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-Du8fw5v_.js → MainLayout-BmpNNAiE.js} +4 -5
  25. package/dist/Marketing-BKK45Eve.js +236 -0
  26. package/dist/{remy-icon-BhUGu2NI.js → MarketingMaterialEdit-x3c_N7Gs.js} +1031 -2
  27. package/dist/{Member-B--nYyr0.js → Member-xEzrBW_p.js} +7 -7
  28. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-BBlzO7Db.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-DRoC-I0t.js} +50 -43
  29. package/dist/{MemberImportHistory-D52Y4RTC.js → MemberImportHistory-CEQpBBF8.js} +7 -7
  30. package/dist/{MemberList-13Owa1fj.js → MemberList-CCvzkHv8.js} +105 -103
  31. package/dist/{MemberTransactions-CpXEWNbq.js → MemberTransactions-Bmh39J2W.js} +1 -1
  32. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DlELjFM0.js → MessageInput.vue_vue_type_script_setup_true_lang-D3Pmk80l.js} +14 -14
  33. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-C_y0rM8c.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DIBKAwHP.js} +1 -1
  34. package/dist/{Mission-Ci-UzXSu.js → Mission-CpUo2Bgw.js} +21 -22
  35. package/dist/{Overview-CKxSfAGF.js → Overview-CwQqQ1Tn.js} +144 -145
  36. package/dist/{Overview-CXen9Ram.js → Overview-DcDZmDXA.js} +22 -23
  37. package/dist/{Point-CR3YOaag.js → Point-CUNQsQIx.js} +21 -22
  38. package/dist/{Promotion-tw3J4ul-.js → Promotion-Cqdim7aW.js} +131 -137
  39. package/dist/{Queue-BZGA5ZXt.js → Queue-CNBVh1UG.js} +45 -46
  40. package/dist/{Record-BTevVXnT.js → Record-BYwz4l4o.js} +9 -9
  41. package/dist/{Review-BU7c8ZF0.js → Review-CqLcZFj8.js} +2 -2
  42. package/dist/ReviewFacebookCallback-DbSCILNN.js +238 -0
  43. package/dist/{ReviewGoogleCallback-xpdPHSdg.js → ReviewGoogleCallback-Dg8R7QlO.js} +5 -5
  44. package/dist/{Reward-jlA_7cxz.js → Reward-M8GZ8eHq.js} +29 -29
  45. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-D3z_n42G.js → RewardGroup.vue_vue_type_script_setup_true_lang-BkM9-Sx-.js} +15 -16
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CnaL93TF.js +1883 -0
  47. package/dist/{Segment-C1Bwm--Q.js → Segment-CrMi6xrp.js} +305 -304
  48. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-B6apgWTM.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DKH5_9db.js} +30 -31
  49. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-B7m2F9UV.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-CyeAQ-hg.js} +4 -4
  50. package/dist/Setting-BnFRI0Se.js +2037 -0
  51. package/dist/{SettingAdvertisements-4XEAJzlL.js → SettingAdvertisements-Dh7v4c1D.js} +12 -12
  52. package/dist/Settings-BvT8_tkQ.js +179 -0
  53. package/dist/{Store-C56dXtc4.js → Store-CV-BmK5b.js} +30 -31
  54. package/dist/{StoreRewards-DQ1Q6WS6.js → StoreRewards-DPhSLvSZ.js} +15 -15
  55. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-CDu1QySl.js +1264 -0
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Dqz6jTlH.js +142 -0
  57. package/dist/{Tier-D4CPZqw7.js → Tier-ChvYps23.js} +687 -2576
  58. package/dist/{Title-DCbwhUic.js → Title-v-Ivswr1.js} +92 -94
  59. package/dist/{Transaction-C5LrasXr.js → Transaction-CRqE1Ix0.js} +2 -2
  60. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-Cl9b4mrK.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-B0Uh9iuj.js} +26 -26
  61. package/dist/{Voucher-rrVbNZKR.js → Voucher-Bg8FOuzD.js} +19 -19
  62. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BIq227nz.js → VoucherEditor.vue_vue_type_script_setup_true_lang-HKxivQMF.js} +16 -16
  63. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-C39_95SZ.js → ZodTextField.vue_vue_type_script_setup_true_lang-8d290Dcp.js} +2 -2
  64. package/dist/{app-CgimGODl.js → app-DdNKsn2Q.js} +7107 -8874
  65. package/dist/app.js +3 -4
  66. package/dist/{base.export-D2P6HFvo.js → base.export-R97FrSQL.js} +2 -2
  67. package/dist/{business-Bu5TqSA0.js → business-Ce8vq3wQ.js} +1 -1
  68. package/dist/{campaign-zJxttSIk.js → campaign-BTllt2LH.js} +25 -31
  69. package/dist/{campaign-BFIXSgdJ.js → campaign-C19If7bW.js} +94 -121
  70. package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-9CCbalR4.js} +2 -3
  71. package/dist/{campaign.fn-gvjlcEfe.js → campaign.fn-B4g03h0A.js} +78 -78
  72. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-MvqF7mSg.js} +1 -1
  73. package/dist/{collection.fn-DOm0HsSh.js → collection.fn-CR0bD33S.js} +2 -2
  74. package/dist/{currency-BpbQvbm8.js → currency-DmlguGIM.js} +1 -1
  75. package/dist/{effect-D-GtNB3n.js → effect-Dx3zfl28.js} +1 -1
  76. package/dist/{email-addresses-BKMoAtMi.js → email-addresses-De5PGOY4.js} +2 -2
  77. package/dist/{feature-flag-BJ_eyKsq.js → feature-flag-CD9V1V0h.js} +74 -74
  78. package/dist/google-C3S8u0mT.js +4 -0
  79. package/dist/{helper-CkfjBgMM.js → helper-CEiv7SaO.js} +1 -1
  80. package/dist/{index-zTvr2GR4.js → index-649OZ_e1.js} +2 -2
  81. package/dist/{index-feCrYhi6.js → index-B8meeQoD.js} +1 -1
  82. package/dist/{index-CIej31pF.js → index-B8yWVB8P.js} +3 -4
  83. package/dist/{index-BKsxIwbi.js → index-BAXKd9Gg.js} +198 -198
  84. package/dist/{index-BAtUrtqM.js → index-BDPnyro2.js} +6 -19
  85. package/dist/{index-DUAZOMVJ.js → index-BR9h5DTI.js} +1 -1
  86. package/dist/{index-DwU3fsLW.js → index-BVdYxi3l.js} +15 -29
  87. package/dist/{index-D0JK99Ko.js → index-BW6eb3n6.js} +252 -611
  88. package/dist/{index-LygS9WsG.js → index-BYI9ttxy.js} +10767 -8028
  89. package/dist/{index-BdEXUNoG.js → index-BquSqx6K.js} +4 -4
  90. package/dist/{index-BpTIulTX.js → index-CBJy9bxB.js} +1 -1
  91. package/dist/{index-B6kU3PkV.js → index-CPODug8b.js} +2613 -2700
  92. package/dist/{index-CfQuYqXn.js → index-CWUrODxL.js} +1 -1
  93. package/dist/{index-DKxN1mMS.js → index-CqOCJTeR.js} +232 -390
  94. package/dist/{index-CuREApMc.js → index-D4d3l0gw.js} +7 -8
  95. package/dist/{index-Bhl5IRXy.js → index-DT3S00_Y.js} +10 -11
  96. package/dist/{index-DqGs6RJG.js → index-IZRfmmde.js} +581 -683
  97. package/dist/{index-CQ8XFbBk.js → index-__UT3_Ey.js} +2 -2
  98. package/dist/{index-CCEXSPxk.js → index-xct3mnu8.js} +7 -7
  99. package/dist/{index.esm2017-DZi9IQPS.js → index.esm2017-AVbZ9btd.js} +177 -177
  100. package/dist/{loading-Brid2wnu.js → loading-BvHm1m3K.js} +1 -1
  101. package/dist/{lodash-C1epw3Kv.js → lodash-Dvrceo7x.js} +1 -1
  102. package/dist/{member-import-DAIxTIiu.js → member-import-c9avpiSS.js} +5 -6
  103. package/dist/{membership-BZmljFhF.js → membership-D-pZS634.js} +3 -3
  104. package/dist/{money-cLcyGcSZ.js → money-D4skwMkD.js} +1 -1
  105. package/dist/{number-C2jPLJr2.js → number-DJ6ncfT6.js} +1 -1
  106. package/dist/objectid-DEMM_jdR.js +145 -0
  107. package/dist/{onboarding-oRfy_g05.js → onboarding-t7R1d3h-.js} +25 -25
  108. package/dist/{onboardingSetup-BLD6m8HY.js → onboardingSetup-lTaJc0oT.js} +2 -2
  109. package/dist/{plugins-CUsr9vB0.js → plugins-DQNOWwRC.js} +3 -3
  110. package/dist/{reward-UOT03odb.js → reward-BK150pjm.js} +1 -1
  111. package/dist/{rule-BgJnPjkI.js → rule-COcdAnUu.js} +492 -572
  112. package/dist/rule-builder-Deufb6h_.js +102 -0
  113. package/dist/style.css +1 -1
  114. package/dist/template-DeebIqJ_.js +236 -0
  115. package/dist/{timezone-BXA4wq7Y.js → timezone-BP6UC4KL.js} +1 -1
  116. package/dist/{transaction.fn-CQ4fpRt3.js → transaction.fn-BY0hzon0.js} +2 -2
  117. package/dist/{trigger-DXJCGT0q.js → trigger-DVBjVPbN.js} +8 -8
  118. package/dist/useMarketingMaterialActions-DpQCQHFI.js +96 -0
  119. package/dist/{usePagination-Pp4okWr8.js → usePagination-QT552XyF.js} +1 -1
  120. package/dist/{user-B3gXcAIy.js → user-CmAxNc7T.js} +1 -1
  121. package/dist/vue-i18n-Cze706-f.js +2365 -0
  122. package/dist/{xlsx-CCaDUTgW.js → xlsx-DAczoc8y.js} +224 -224
  123. package/dist/{zod-CPwjOxvW.js → zod-Aj-GuVQL.js} +1 -1
  124. package/package.json +2 -6
  125. package/dist/AuditLogs-BPpdm96t.js +0 -2016
  126. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DgdAlHU7.js +0 -4442
  127. package/dist/Grab-BWzdN_cd.js +0 -301
  128. package/dist/MainLayout-DwnjGXh6.js +0 -4
  129. package/dist/Marketing-DCco__2F.js +0 -273
  130. package/dist/MarketingMaterialEdit-BbgFtrYP.js +0 -1037
  131. package/dist/ReviewFacebookCallback-BnMF6Arh.js +0 -225
  132. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CsHxqH9h.js +0 -1923
  133. package/dist/Setting-CDM4RhLW.js +0 -574
  134. package/dist/Settings-D-0tvZRr.js +0 -286
  135. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-LLD91Rz6.js +0 -1319
  136. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Bvy4NJMd.js +0 -7007
  137. package/dist/WhatsappAccount-oJDo5zTr.js +0 -159
  138. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-aCQCYFYq.js +0 -39
  139. package/dist/WhatsappBot-Cl64wG_F.js +0 -876
  140. package/dist/WhatsappBotLogs-D3uT4EiB.js +0 -372
  141. package/dist/WhatsappBotSettings-Cs1lLxh-.js +0 -705
  142. package/dist/WhatsappLayout-C639d2HP.js +0 -21
  143. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DpPxWp2x.js +0 -253
  144. package/dist/browser-BSAOEeIM.js +0 -1478
  145. package/dist/duplicateCampaign-CvsvjRE9.js +0 -51
  146. package/dist/feature-flag-Bo-k5sIG.js +0 -50
  147. package/dist/google-BQK68wbe.js +0 -5
  148. package/dist/index-C-iwb2Ln.js +0 -109
  149. package/dist/index-C_H8jFYf.js +0 -2743
  150. package/dist/index-DQ8JJhxs.js +0 -74
  151. package/dist/objectid-C-wocWKI.js +0 -145
  152. package/dist/template-BZyFhr73.js +0 -188
  153. package/dist/useMarketingMaterialActions-B-Wib5ga.js +0 -125
  154. package/dist/vue-i18n-DWGiC_vs.js +0 -2365
@@ -1,876 +0,0 @@
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-DWGiC_vs.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-CCEXSPxk.js";
6
- import { w as J } from "./index-DQ8JJhxs.js";
7
- import { u as ue, _ as de, w as me } from "./WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DpPxWp2x.js";
8
- import { R as U } from "./app-CgimGODl.js";
9
- import { _ as fe } from "./WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-aCQCYFYq.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
- };