@feedmepos/mf-connect 0.1.126-prod → 0.1.127-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/{App-DRHHPaMz.js → App-CLrxVFgX.js} +224 -216
  2. package/dist/AuditLogs-DYlfToAk.js +2016 -0
  3. package/dist/{Bin-FkcYLSTm.js → Bin-C0CugBW4.js} +8 -8
  4. package/dist/{Broadcast-Cgqp_BMa.js → Broadcast-DhVQa_WW.js} +22 -21
  5. package/dist/{CampaignAnalytic-kKZ_BwW0.js → CampaignAnalytic-6jeG5U90.js} +97 -97
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CX0mWLjO.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Cxydrkof.js} +9 -10
  7. package/dist/{Card-Bu1y37hV.js → Card-cpLj34Oy.js} +23 -23
  8. package/dist/{Collections-B3mJkBCT.js → Collections-CdRpJuHO.js} +197 -185
  9. package/dist/{Credit-Bn-2EcVy.js → Credit-E_N_yfnJ.js} +21 -20
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-Cz7pZ7LD.js → DateRangeChip.vue_vue_type_script_setup_true_lang-Dq-2vUqT.js} +1 -1
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-CSXO2bYC.js +4584 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-B7XBiv4l.js → EffectSheet.vue_vue_type_style_index_0_lang-BeQZjLIw.js} +33 -33
  13. package/dist/{Experience-CunbmoAu.js → Experience-D9i0ax4C.js} +32 -31
  14. package/dist/{FileSaver.min-ChFSxYyS.js → FileSaver.min-BOE2RBne.js} +1 -1
  15. package/dist/{Game-dFDwx_UJ.js → Game-CirwX_l1.js} +19 -18
  16. package/dist/{GiftCardSetup-DYpEqqX0.js → GiftCardSetup-DpJb_azW.js} +31 -31
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-DxJdI6gc.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-ff6Nfvxe.js} +140 -128
  18. package/dist/{Goals-DuZzgM_K.js → Goals-TejbPs-I.js} +4 -4
  19. package/dist/Grab-CeUX-LlF.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-lDulspkF.js → ImageInput.vue_vue_type_script_setup_true_lang-CnZzRDGS.js} +1 -1
  21. package/dist/{Index-BxB2ohT0.js → Index-gqWBDZBN.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-9sKJE1A5.js → LocationPicker.vue_vue_type_script_setup_true_lang-CzobgD7L.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CxBNYzcz.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DgeD1RQq.js} +1 -1
  24. package/dist/{LoyaltyDashboard-DQzGvQ7j.js → LoyaltyDashboard-R22oQHTd.js} +82 -82
  25. package/dist/{MainLayout-MAZ1S06H.js → MainLayout-pJBEBaM-.js} +1 -1
  26. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-CeF3LU-N.js → MainLayout.vue_vue_type_script_setup_true_lang-IX_utv2Z.js} +3 -3
  27. package/dist/{Marketing-ACF6F7be.js → Marketing-5gMwO1jV.js} +4 -4
  28. package/dist/{MarketingMaterialEdit-B8NfkoHg.js → MarketingMaterialEdit-BaHNX_qE.js} +214 -211
  29. package/dist/{Member-rLxDUOr8.js → Member-Cd0oraEq.js} +7 -7
  30. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-DzyM1fW_.js +1322 -0
  31. package/dist/{MemberImportHistory-BuG6DmdV.js → MemberImportHistory-C_RkY3fg.js} +7 -7
  32. package/dist/{MemberList-CC6zm_I6.js → MemberList-CJK1akUC.js} +103 -105
  33. package/dist/{MemberTransactions-Bw2xu6jZ.js → MemberTransactions-DP6schuy.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-Cav8gQUK.js → MessageInput.vue_vue_type_script_setup_true_lang-BaivunRx.js} +12 -12
  35. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-8wdY4FnI.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DOdYyPp2.js} +1 -1
  36. package/dist/{Mission-DnEcbALs.js → Mission-DJ40IcG9.js} +22 -21
  37. package/dist/{Overview-DShFohlk.js → Overview-CaQlLSBg.js} +145 -144
  38. package/dist/{Overview-COytI5xN.js → Overview-DXHjNmIO.js} +21 -21
  39. package/dist/{Point-CWYwlx0i.js → Point-D0Qqmgai.js} +22 -21
  40. package/dist/{Promotion-LBrQYtad.js → Promotion-CQU2-tpG.js} +137 -131
  41. package/dist/{Queue-DKg5EvDM.js → Queue-B-Uki3qh.js} +46 -46
  42. package/dist/{Record--lYpawLN.js → Record-BvQ0nVja.js} +9 -9
  43. package/dist/{Review-C4pNmJ7n.js → Review-DMfBPU_D.js} +2 -2
  44. package/dist/ReviewFacebookCallback-Bq6JQ7LR.js +225 -0
  45. package/dist/{ReviewGoogleCallback-ge8fL_A-.js → ReviewGoogleCallback-Bg9PFxog.js} +5 -5
  46. package/dist/{Reward-B67r1Bpz.js → Reward-CNC0z98e.js} +16 -16
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-Bt0Kx2--.js → RewardGroup.vue_vue_type_script_setup_true_lang-DXr-5wJE.js} +14 -14
  48. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-OznhirAU.js +1923 -0
  49. package/dist/{Segment-DeSC3z5G.js → Segment-V0ZQJkN-.js} +304 -307
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DdjC7X1V.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BmFp2pst.js} +15 -15
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Crys59UO.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-C0IbEZMG.js} +4 -4
  52. package/dist/{Setting-DiDcMU5E.js → Setting-DCb6IIrk.js} +17 -17
  53. package/dist/{SettingAdvertisements-3wMI9egH.js → SettingAdvertisements-Dc9XfzVl.js} +12 -12
  54. package/dist/Settings-BIjIfmFI.js +286 -0
  55. package/dist/{Store-DgefqByH.js → Store-DkoB_5IF.js} +29 -29
  56. package/dist/{StoreRewards-CS2h5RVB.js → StoreRewards-a4ujLMfY.js} +15 -15
  57. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-gPR8sn4k.js → StoreTransactions.vue_vue_type_script_setup_true_lang-UbMY0RzG.js} +25 -25
  58. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BWjb1wHV.js +7007 -0
  59. package/dist/{Tier-Cye6888q.js → Tier-1WKuUirS.js} +2583 -688
  60. package/dist/{Title-B1eJh5oy.js → Title-CznZg4jL.js} +96 -95
  61. package/dist/{Transaction-ouzdsBUx.js → Transaction-DBRQDmA3.js} +2 -2
  62. package/dist/{Upselling-CdQd2Fuk.js → Upselling-CjZvUUqn.js} +3 -3
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BSlxe1Hf.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-DS4hdSE9.js} +26 -26
  64. package/dist/{Voucher-CJJt8VlJ.js → Voucher-Di6VhoSM.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-BzbNaK6H.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BjSzCnBw.js} +12 -12
  66. package/dist/{WhatsappAccount-DIxSP6Tp.js → WhatsappAccount-DdXadlHI.js} +6 -6
  67. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-L9Y5lAft.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-Cnlvi-GG.js} +1 -1
  68. package/dist/WhatsappBot-DwhQmZLJ.js +882 -0
  69. package/dist/{WhatsappBotLogs-D8IfLHk3.js → WhatsappBotLogs-BAglKUAZ.js} +66 -66
  70. package/dist/WhatsappBotSettings-DslJTj2X.js +945 -0
  71. package/dist/{WhatsappLayout-3rWwmGRd.js → WhatsappLayout-14847AOz.js} +3 -3
  72. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-C3N-loYJ.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-otzgv6Jh.js} +3 -3
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-D1dORvMi.js → ZodTextField.vue_vue_type_script_setup_true_lang-BEY-LOVu.js} +2 -2
  74. package/dist/{app-BXqas0p1.js → app-KbxCI4gY.js} +4204 -3400
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-DQCZiS2E.js → base.export-DH8OxNrx.js} +2 -2
  77. package/dist/business-DuKNr9P7.js +83 -0
  78. package/dist/{campaign-C2X6aa7B.js → campaign-DR5xHhgA.js} +31 -25
  79. package/dist/{campaign-DASPASQ0.js → campaign-Ddv-RZgo.js} +121 -94
  80. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-DsaSpHDQ.js} +3 -2
  81. package/dist/campaign.fn-CJlEovlZ.js +776 -0
  82. package/dist/{collectible.enum-Liy2wH3s.js → collectible.enum-CDHT9uk3.js} +1 -1
  83. package/dist/{collection.fn-C7jNdh0A.js → collection.fn-DTZs-hUX.js} +2 -2
  84. package/dist/{currency-BvBM_Io9.js → currency-1-Yhpyv5.js} +1 -1
  85. package/dist/duplicateCampaign-BncSxYSg.js +51 -0
  86. package/dist/{effect-BA1yh6Mj.js → effect-TTD5--LN.js} +1 -1
  87. package/dist/{email-addresses-haS5P7hq.js → email-addresses-pxXp67Al.js} +2 -2
  88. package/dist/{feature-flag-B4bJnuei.js → feature-flag-CFVZl4ed.js} +84 -84
  89. package/dist/google-BQK68wbe.js +5 -0
  90. package/dist/{helper-BtTBvFuA.js → helper-BC_Cl5VR.js} +1 -1
  91. package/dist/{index-ChGZ_S3V.js → index-42Wl_5UE.js} +1 -1
  92. package/dist/{index-Dm2Dvxph.js → index-BRl7Besd.js} +23 -23
  93. package/dist/{index-DAtVp1NI.js → index-BxUMqeaY.js} +2700 -2614
  94. package/dist/{index-Dg972Dfv.js → index-ByFFDLTo.js} +1 -1
  95. package/dist/{index-DtbR7I4C.js → index-CBKbnJRo.js} +9 -9
  96. package/dist/index-CGtlXLTG.js +10767 -0
  97. package/dist/{index-CH-uRaZH.js → index-CRKdLbXL.js} +71 -52
  98. package/dist/{index-B1dAoOWi.js → index-CaHkqz0W.js} +19 -6
  99. package/dist/{index-DeomfIu9.js → index-CcXMYJxc.js} +609 -252
  100. package/dist/{index-B6A6sHpy.js → index-CkiP4iG6.js} +1 -1
  101. package/dist/{index-g_SHjVWE.js → index-D1iOPNg3.js} +1 -1
  102. package/dist/{index-D-D0s8PB.js → index-D2Nq0UoL.js} +381 -235
  103. package/dist/index-D4nA0Z7e.js +19528 -0
  104. package/dist/{index-BV-YiCDM.js → index-DHw8wo7T.js} +2 -2
  105. package/dist/{index-C2rjmdar.js → index-DKOoRHPf.js} +4 -4
  106. package/dist/{index-Q-iHraJ3.js → index-DcbPYZkw.js} +26 -19
  107. package/dist/{index-C7UBk5gq.js → index-DjwrfZk3.js} +35 -17
  108. package/dist/{index-BvFq5REc.js → index-EuZfRdBT.js} +10 -10
  109. package/dist/{index-CJ-BZCvB.js → index-H4XJDOoT.js} +1315 -1243
  110. package/dist/{index-CXznvd79.js → index-ImU7YXN7.js} +4 -4
  111. package/dist/{index-BRTy6G9c.js → index-N4EzkcEu.js} +2 -2
  112. package/dist/{index-CBfVFFME.js → index-j7eLKJK3.js} +198 -198
  113. package/dist/{index.esm2017-B7iE1Ggr.js → index.esm2017-CBo4j3U1.js} +93 -93
  114. package/dist/{loading-BvlSfSVK.js → loading-COAu2l7W.js} +1 -1
  115. package/dist/{lodash-Daey2k0N.js → lodash-Bu1ipIkR.js} +1 -1
  116. package/dist/{member-import-CF9aym_y.js → member-import-CkiTJIqy.js} +2 -2
  117. package/dist/{membership-DfG-fl80.js → membership-BSEeYyiz.js} +3 -3
  118. package/dist/{money-SBIQhxqf.js → money-BOaGQSGa.js} +1 -1
  119. package/dist/{number-Cp1bFK9U.js → number-B2AC2EMT.js} +1 -1
  120. package/dist/objectid-BKw48v5L.js +145 -0
  121. package/dist/{onboarding-bjc7C8O-.js → onboarding-ClA8xAnH.js} +25 -25
  122. package/dist/{onboardingSetup-BAu9TDI6.js → onboardingSetup-DHjnq0H1.js} +2 -2
  123. package/dist/{plugins-Def73Eyk.js → plugins-DewN43sP.js} +3 -3
  124. package/dist/{reward-KecVeztH.js → reward-deDdPQiR.js} +1 -1
  125. package/dist/{rule-kMIC0vOi.js → rule-B8ifutnO.js} +572 -492
  126. package/dist/style.css +1 -1
  127. package/dist/template-z3VMmWei.js +227 -0
  128. package/dist/timezone-BxJDy-bY.js +19 -0
  129. package/dist/{transaction.fn-Bjy5utxD.js → transaction.fn-CBBhq01K.js} +2 -2
  130. package/dist/{trigger-DnnOJVUi.js → trigger-B_quLwWr.js} +9 -9
  131. package/dist/{useMarketingMaterialActions-DMrNOpok.js → useMarketingMaterialActions-DqoRLx1M.js} +4 -4
  132. package/dist/{usePagination-BCY4a-dh.js → usePagination-Q1fPttcp.js} +1 -1
  133. package/dist/{user-BTc0S1Vx.js → user-Bw6h9xn-.js} +1 -1
  134. package/dist/vue-i18n-DpCS1FnK.js +2365 -0
  135. package/dist/{xlsx-DR5oLrEs.js → xlsx--toeD6hC.js} +1 -1
  136. package/dist/{zod-CMq39HWn.js → zod-BkNAcpay.js} +1 -1
  137. package/package.json +6 -2
  138. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DIUEjCFW.js +0 -3638
  139. package/dist/MemberDetailSheet.vue_vue_type_script_setup_true_lang-Bq3UKX7v.js +0 -1308
  140. package/dist/ReviewFacebookCallback-BYXwKQNG.js +0 -238
  141. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-fLtn32Rw.js +0 -1884
  142. package/dist/Settings-BR6Y1DBZ.js +0 -179
  143. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Cjnkpd1j.js +0 -142
  144. package/dist/WhatsappBot-BXxoaz7-.js +0 -878
  145. package/dist/WhatsappBotSettings-Bq9C7pNZ.js +0 -704
  146. package/dist/business-RsRhXSh8.js +0 -82
  147. package/dist/campaign.fn-BEX99lsa.js +0 -776
  148. package/dist/google-C3S8u0mT.js +0 -4
  149. package/dist/index-C_H8jFYf.js +0 -2743
  150. package/dist/index-D9zjHXFU.js +0 -27551
  151. package/dist/objectid-BMRA1fIL.js +0 -145
  152. package/dist/rule-builder-DgU6P24U.js +0 -102
  153. package/dist/template-BH9vS8A9.js +0 -275
  154. package/dist/timezone-CMX1sJ0a.js +0 -20
  155. package/dist/vue-i18n-7BKLPLxj.js +0 -2365
@@ -1,878 +0,0 @@
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-7BKLPLxj.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-BvFq5REc.js";
6
- import { w as J } from "./index-C7UBk5gq.js";
7
- import { u as ue, _ as de, w as me } from "./WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-C3N-loYJ.js";
8
- import { R as N } from "./app-BXqas0p1.js";
9
- import { _ as fe } from "./WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-L9Y5lAft.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
- };