@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,705 +0,0 @@
1
- import { defineComponent as L, mergeModels as Z, useModel as H, openBlock as a, createElementBlock as c, createElementVNode as e, toDisplayString as l, unref as t, withDirectives as q, vModelText as re, resolveComponent as $, Fragment as O, renderList as ee, createBlock as N, ref as y, computed as V, watch as ce, onBeforeUnmount as ie, createCommentVNode as _, createVNode as k, createTextVNode as D, withCtx as ae, normalizeClass as X, vModelRadio as xe } from "vue";
2
- import { u as U } from "./vue-i18n-DWGiC_vs.js";
3
- import { useSnackbar as de } from "@feedmepos/ui-library";
4
- import { F as J, a as W, b as fe, c as se, d as ve, e as z, f as be } from "./index-C-iwb2Ln.js";
5
- import { S as Q } from "./index-CCEXSPxk.js";
6
- import { w as Y } from "./index-DQ8JJhxs.js";
7
- import { p as ge } from "./plugins-CUsr9vB0.js";
8
- const he = { class: "flex flex-col gap-[10px]" }, ye = { class: "flex flex-col gap-[2px]" }, _e = {
9
- id: "whatsapp-bot-instructions-title",
10
- class: "text-[16px] leading-[24px] font-semibold"
11
- }, we = {
12
- id: "whatsapp-bot-instructions-description",
13
- class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]"
14
- }, Be = { class: "flex flex-col gap-[6px]" }, ke = ["placeholder", "maxlength", "disabled"], Se = {
15
- id: "whatsapp-bot-instructions-count",
16
- class: "text-right text-[12px] leading-[16px] text-fm-color-typo-tertiary tabular-nums"
17
- }, $e = /* @__PURE__ */ L({
18
- __name: "BotInstructions",
19
- props: /* @__PURE__ */ Z({
20
- disabled: { type: Boolean }
21
- }, {
22
- modelValue: { required: !0 },
23
- modelModifiers: {}
24
- }),
25
- emits: ["update:modelValue"],
26
- setup(i) {
27
- const n = H(i, "modelValue"), { t: u } = U();
28
- return (s, o) => (a(), c("div", he, [
29
- e("div", ye, [
30
- e("h2", _e, l(t(u)("connect.whatsappBot.botSettings.instructions")), 1),
31
- e("p", we, l(t(u)("connect.whatsappBot.botSettings.description")), 1)
32
- ]),
33
- e("div", Be, [
34
- q(e("textarea", {
35
- "onUpdate:modelValue": o[0] || (o[0] = (v) => n.value = v),
36
- "aria-labelledby": "whatsapp-bot-instructions-title",
37
- "aria-describedby": "whatsapp-bot-instructions-description whatsapp-bot-instructions-count",
38
- placeholder: t(u)("connect.whatsappBot.botSettings.placeholder"),
39
- maxlength: t(J),
40
- disabled: i.disabled,
41
- rows: "6",
42
- class: "block w-full min-h-[136px] resize-y rounded-[8px] border border-fm-color-neutral-gray-200 bg-fm-color-neutral-white p-[12px] text-[14px] leading-[20px] text-fm-color-typo-primary placeholder:text-fm-color-typo-tertiary transition-[border-color,box-shadow] focus:border-fm-color-primary focus:outline-none focus:ring-[4px] focus:ring-fm-color-primary/30 disabled:cursor-not-allowed disabled:bg-fm-color-neutral-gray-100 disabled:text-fm-color-typo-disabled"
43
- }, null, 8, ke), [
44
- [re, n.value]
45
- ]),
46
- e("p", Se, l(n.value.length) + " / " + l(t(J)), 1)
47
- ])
48
- ]));
49
- }
50
- }), Ae = { class: "overflow-x-auto" }, Te = ["aria-label"], Ie = { class: "border-b border-fm-color-neutral-gray-100 bg-fm-color-neutral-gray-100/30 text-[12px] leading-[16px] text-fm-color-typo-tertiary" }, Fe = {
51
- scope: "col",
52
- class: "py-[10px] pl-[16px] pr-[8px] font-semibold"
53
- }, Ce = {
54
- scope: "col",
55
- class: "px-[8px] py-[10px] font-semibold"
56
- }, Ee = {
57
- scope: "col",
58
- class: "px-[8px] py-[10px] font-semibold"
59
- }, Ve = {
60
- scope: "col",
61
- class: "py-[10px] pl-[8px] pr-[16px]"
62
- }, Pe = { class: "sr-only" }, Ne = { class: "text-[14px] leading-[20px]" }, De = { class: "py-[8px] pl-[16px] pr-[8px] font-medium" }, Oe = ["title"], Le = { class: "px-[8px] py-[8px] text-fm-color-typo-secondary tabular-nums" }, Ue = ["title"], Me = { class: "px-[8px] py-[8px] text-fm-color-typo-tertiary tabular-nums" }, Re = ["datetime", "title"], We = { class: "py-[8px] pl-[8px] pr-[16px]" }, ze = ["aria-label", "disabled", "aria-busy", "onClick"], He = { key: 1 }, ne = /* @__PURE__ */ L({
63
- __name: "ExcludedAccountsTable",
64
- props: {
65
- accounts: {},
66
- removingId: {}
67
- },
68
- emits: ["remove"],
69
- setup(i, { emit: n }) {
70
- const u = n, { t: s, locale: o } = U();
71
- function v(f) {
72
- return f.customerName || f.phoneNumber || f.customerLid;
73
- }
74
- function d(f) {
75
- return new Intl.DateTimeFormat(o.value, {
76
- dateStyle: "medium",
77
- timeStyle: "short"
78
- }).format(new Date(f));
79
- }
80
- return (f, h) => {
81
- const w = $("FmCircularProgress");
82
- return a(), c("div", Ae, [
83
- e("table", {
84
- "aria-label": t(s)("connect.whatsappBot.excludedAccounts.title"),
85
- class: "w-full min-w-[600px] table-fixed border-collapse text-left"
86
- }, [
87
- h[0] || (h[0] = e("colgroup", null, [
88
- e("col", { class: "w-[30%]" }),
89
- e("col", { class: "w-[25%]" }),
90
- e("col"),
91
- e("col", { class: "w-[116px]" })
92
- ], -1)),
93
- e("thead", Ie, [
94
- e("tr", null, [
95
- e("th", Fe, l(t(s)("connect.whatsappBot.excludedAccounts.name")), 1),
96
- e("th", Ce, l(t(s)("connect.whatsappBot.excludedAccounts.phoneNumber")), 1),
97
- e("th", Ee, l(t(s)("connect.whatsappBot.excludedAccounts.excludedOn")), 1),
98
- e("th", Ve, [
99
- e("span", Pe, l(t(s)("connect.whatsappBot.excludedAccounts.actions")), 1)
100
- ])
101
- ])
102
- ]),
103
- e("tbody", Ne, [
104
- (a(!0), c(O, null, ee(i.accounts, (r) => (a(), c("tr", {
105
- key: r.id,
106
- class: "border-b border-fm-color-neutral-gray-100 last:border-b-0"
107
- }, [
108
- e("td", De, [
109
- e("span", {
110
- class: "block truncate",
111
- title: v(r)
112
- }, l(v(r)), 9, Oe)
113
- ]),
114
- e("td", Le, [
115
- e("span", {
116
- class: "block truncate",
117
- title: r.phoneNumber || t(s)("connect.whatsappBot.phoneUnavailable")
118
- }, l(r.phoneNumber || t(s)("connect.whatsappBot.phoneUnavailable")), 9, Ue)
119
- ]),
120
- e("td", Me, [
121
- e("time", {
122
- datetime: r.updatedAt,
123
- title: d(r.updatedAt),
124
- class: "block truncate"
125
- }, l(d(r.updatedAt)), 9, Re)
126
- ]),
127
- e("td", We, [
128
- e("button", {
129
- type: "button",
130
- "aria-label": t(s)("connect.whatsappBot.excludedAccounts.removeAccount", {
131
- name: v(r)
132
- }),
133
- disabled: !!i.removingId,
134
- "aria-busy": i.removingId === r.id,
135
- class: "flex h-[32px] w-[84px] items-center justify-center rounded-[8px] text-[14px] font-semibold text-fm-color-typo-secondary transition-colors hover:bg-fm-color-system-error-100 hover:text-fm-color-typo-error focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-fm-color-primary disabled:cursor-wait disabled:opacity-50",
136
- onClick: (T) => u("remove", r)
137
- }, [
138
- i.removingId === r.id ? (a(), N(w, {
139
- key: 0,
140
- size: "md",
141
- "aria-hidden": "true"
142
- })) : (a(), c("span", He, l(t(s)("connect.common.remove")), 1))
143
- ], 8, ze)
144
- ])
145
- ]))), 128))
146
- ])
147
- ], 8, Te)
148
- ]);
149
- };
150
- }
151
- }), Ge = {
152
- id: "whatsapp-excluded-accounts",
153
- "aria-labelledby": "whatsapp-excluded-accounts-title",
154
- class: "flex min-w-0 flex-col gap-[12px]"
155
- }, Ke = { class: "flex flex-col gap-[2px]" }, je = {
156
- id: "whatsapp-excluded-accounts-title",
157
- class: "text-[16px] leading-[24px] font-semibold"
158
- }, Xe = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, Je = {
159
- key: 0,
160
- role: "alert",
161
- class: "text-[14px] text-fm-color-typo-error"
162
- }, Qe = {
163
- key: 1,
164
- role: "status",
165
- class: "flex flex-col items-center gap-[12px] py-[32px] text-[14px] text-fm-color-typo-secondary"
166
- }, Ye = {
167
- key: 0,
168
- class: "flex flex-wrap items-center gap-[12px]"
169
- }, Ze = {
170
- role: "alert",
171
- class: "text-[14px] text-fm-color-typo-error"
172
- }, qe = {
173
- key: 1,
174
- class: "flex flex-col items-center gap-[6px] rounded-[16px] border border-fm-color-neutral-gray-200 px-[24px] py-[32px] text-center"
175
- }, et = { class: "text-[16px] leading-[24px] font-semibold" }, tt = { class: "max-w-[420px] text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, ot = {
176
- key: 2,
177
- class: "overflow-hidden rounded-[16px] border border-fm-color-neutral-gray-100 bg-fm-color-neutral-white"
178
- }, lt = { class: "flex min-w-0 flex-col" }, at = { class: "text-[18px] leading-[24px] font-semibold" }, st = { class: "text-[14px] leading-[20px] text-fm-color-typo-tertiary" }, nt = {
179
- key: 0,
180
- role: "alert",
181
- class: "mb-[12px] text-[14px] text-fm-color-typo-error"
182
- }, rt = {
183
- key: 1,
184
- class: "px-[24px] py-[40px] text-center text-[14px] text-fm-color-typo-secondary"
185
- }, ct = /* @__PURE__ */ L({
186
- __name: "ExcludedAccounts",
187
- props: {
188
- accounts: {},
189
- loading: { type: Boolean },
190
- error: {}
191
- },
192
- emits: ["retry", "removed"],
193
- setup(i, { emit: n }) {
194
- const u = i, s = n, { t: o } = U(), v = de(), d = y(""), f = y(""), h = y(!1);
195
- let w;
196
- const r = V(
197
- () => [...u.accounts].sort((m, b) => b.updatedAt.localeCompare(m.updatedAt))
198
- ), T = V(() => r.value.slice(0, 3));
199
- async function E(m) {
200
- if (d.value) return;
201
- const b = Q.getBusinessId();
202
- if (!b || m.businessId !== b) return;
203
- const B = new AbortController();
204
- w = B, d.value = m.id, f.value = "";
205
- try {
206
- if (await Y.removeExcludedAccount(
207
- b,
208
- m.id,
209
- B.signal
210
- ), B.signal.aborted) return;
211
- s("removed", m.id), v.open({
212
- type: "success",
213
- message: o("connect.whatsappBot.excludedAccounts.removed", {
214
- name: m.customerName || m.phoneNumber || m.customerLid
215
- })
216
- });
217
- } catch (I) {
218
- B.signal.aborted || (f.value = I instanceof Error ? I.message : o("connect.whatsappBot.excludedAccounts.removeError"), v.open({ type: "error", message: f.value }));
219
- } finally {
220
- B.signal.aborted || (d.value = "");
221
- }
222
- }
223
- function g() {
224
- w == null || w.abort(), d.value = "", f.value = "", h.value = !1;
225
- }
226
- return ce(() => Q.getBusinessId(), g), ie(g), (m, b) => {
227
- const B = $("FmCircularProgress"), I = $("FmButton"), G = $("FmIcon"), K = $("FmDialog");
228
- return a(), c(O, null, [
229
- e("section", Ge, [
230
- e("div", Ke, [
231
- e("h2", je, l(t(o)("connect.whatsappBot.excludedAccounts.title")), 1),
232
- e("p", Xe, l(t(o)("connect.whatsappBot.excludedAccounts.description")), 1)
233
- ]),
234
- f.value ? (a(), c("p", Je, l(f.value), 1)) : _("", !0),
235
- i.loading ? (a(), c("div", Qe, [
236
- k(B),
237
- D(" " + l(t(o)("connect.whatsappBot.excludedAccounts.loading")), 1)
238
- ])) : (a(), c(O, { key: 2 }, [
239
- i.error ? (a(), c("div", Ye, [
240
- e("p", Ze, l(i.error), 1),
241
- k(I, {
242
- variant: "secondary",
243
- "border-color": "neutral-gray-200",
244
- label: t(o)("connect.whatsappBot.tryAgain"),
245
- "prepend-icon": "refresh",
246
- class: "!rounded-full [&_.label]:text-[14px]",
247
- onClick: b[0] || (b[0] = (P) => s("retry"))
248
- }, null, 8, ["label"])
249
- ])) : _("", !0),
250
- !r.value.length && !i.error ? (a(), c("div", qe, [
251
- e("h3", et, l(t(o)("connect.whatsappBot.excludedAccounts.emptyTitle")), 1),
252
- e("p", tt, l(t(o)("connect.whatsappBot.excludedAccounts.emptyDescription")), 1)
253
- ])) : r.value.length ? (a(), c("div", ot, [
254
- k(ne, {
255
- accounts: T.value,
256
- "removing-id": d.value,
257
- onRemove: E
258
- }, null, 8, ["accounts", "removing-id"]),
259
- r.value.length > T.value.length ? (a(), c("button", {
260
- key: 0,
261
- type: "button",
262
- class: "flex min-h-[44px] w-full items-center justify-center gap-[6px] border-t border-fm-color-neutral-gray-100 px-[16px] py-[8px] text-[14px] font-semibold text-fm-color-primary transition-colors hover:bg-fm-color-primary-oats focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-inset focus-visible:ring-fm-color-primary",
263
- onClick: b[1] || (b[1] = (P) => h.value = !0)
264
- }, [
265
- D(l(t(o)("connect.whatsappBot.excludedAccounts.showAll", {
266
- count: r.value.length
267
- })) + " ", 1),
268
- k(G, {
269
- name: "chevron_right",
270
- size: "sm",
271
- "aria-hidden": "true"
272
- })
273
- ])) : _("", !0)
274
- ])) : _("", !0)
275
- ], 64))
276
- ]),
277
- k(K, {
278
- modelValue: h.value,
279
- "onUpdate:modelValue": b[2] || (b[2] = (P) => h.value = P),
280
- "min-width": "min(720px, calc(100% - 32px))",
281
- "max-width": "720px",
282
- "max-height": "90vh",
283
- "dismiss-away": ""
284
- }, {
285
- "dialog-header": ae(() => [
286
- e("div", lt, [
287
- e("h2", at, l(t(o)("connect.whatsappBot.excludedAccounts.title")), 1),
288
- e("p", st, l(t(o)("connect.whatsappBot.accountCount", r.value.length)), 1)
289
- ])
290
- ]),
291
- default: ae(() => [
292
- f.value ? (a(), c("p", nt, l(f.value), 1)) : _("", !0),
293
- r.value.length ? (a(), N(ne, {
294
- key: 2,
295
- accounts: r.value,
296
- "removing-id": d.value,
297
- onRemove: E
298
- }, null, 8, ["accounts", "removing-id"])) : (a(), c("p", rt, l(t(o)("connect.whatsappBot.excludedAccounts.emptyTitle")), 1))
299
- ]),
300
- _: 1
301
- }, 8, ["modelValue"])
302
- ], 64);
303
- };
304
- }
305
- }), it = {
306
- "aria-labelledby": "knowledge-base-title",
307
- class: "flex flex-col gap-[10px]"
308
- }, dt = { class: "flex flex-col gap-[2px]" }, pt = {
309
- id: "knowledge-base-title",
310
- class: "text-[16px] leading-[24px] font-semibold"
311
- }, ut = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, mt = { class: "flex flex-wrap gap-[8px]" }, xt = ["title", "aria-expanded", "disabled", "onClick"], ft = ["disabled"], vt = {
312
- key: 0,
313
- class: "text-[14px] text-fm-color-typo-tertiary"
314
- }, bt = {
315
- key: 1,
316
- class: "text-[14px] text-fm-color-typo-secondary"
317
- }, gt = { class: "flex flex-col gap-[6px]" }, ht = {
318
- for: "whatsapp-knowledge-topic-description",
319
- class: "text-[14px] leading-[20px] font-medium text-fm-color-typo-secondary"
320
- }, yt = ["placeholder", "maxlength", "disabled"], _t = {
321
- id: "whatsapp-knowledge-topic-description-count",
322
- class: "text-right text-[12px] leading-[16px] text-fm-color-typo-tertiary tabular-nums"
323
- }, wt = /* @__PURE__ */ L({
324
- __name: "KnowledgeBase",
325
- props: /* @__PURE__ */ Z({
326
- disabled: { type: Boolean }
327
- }, {
328
- modelValue: {
329
- required: !0
330
- },
331
- modelModifiers: {},
332
- activeTopicIndex: {
333
- required: !0
334
- },
335
- activeTopicIndexModifiers: {}
336
- }),
337
- emits: ["update:modelValue", "update:activeTopicIndex"],
338
- setup(i) {
339
- const n = i, u = H(i, "modelValue"), s = H(i, "activeTopicIndex"), { t: o } = U(), v = V(
340
- () => s.value === null ? null : u.value[s.value]
341
- );
342
- function d() {
343
- n.disabled || u.value.length >= W || (u.value.push({ title: "", description: "" }), s.value = u.value.length - 1);
344
- }
345
- function f() {
346
- n.disabled || s.value === null || (u.value.splice(s.value, 1), s.value = null);
347
- }
348
- return (h, w) => {
349
- const r = $("FmIcon"), T = $("FmTextField"), E = $("FmButton");
350
- return a(), c("section", it, [
351
- e("div", dt, [
352
- e("h2", pt, l(t(o)("connect.whatsappBot.botSettings.knowledgeBase.title")), 1),
353
- e("p", ut, l(t(o)("connect.whatsappBot.botSettings.knowledgeBase.description")), 1)
354
- ]),
355
- e("div", mt, [
356
- (a(!0), c(O, null, ee(u.value, (g, m) => (a(), c("button", {
357
- key: m,
358
- type: "button",
359
- title: g.title.trim() || t(o)("connect.whatsappBot.botSettings.knowledgeBase.untitled"),
360
- "aria-expanded": s.value === m,
361
- "aria-controls": "knowledge-topic-editor",
362
- disabled: i.disabled,
363
- class: X(["h-[32px] max-w-[240px] rounded-[8px] border-[1px] px-[12px] truncate text-[14px] font-medium transition-colors focus-visible:ring-2 focus-visible:ring-fm-color-primary disabled:opacity-60", [
364
- s.value === m ? "border-fm-color-primary bg-fm-color-primary-oats text-fm-color-primary" : "border-fm-color-neutral-gray-200 bg-fm-color-neutral-white",
365
- i.disabled ? "cursor-default" : "cursor-pointer hover:border-fm-color-primary"
366
- ]]),
367
- onClick: (b) => s.value = s.value === m ? null : m
368
- }, l(g.title.trim() || t(o)("connect.whatsappBot.botSettings.knowledgeBase.untitled")), 11, xt))), 128)),
369
- e("button", {
370
- type: "button",
371
- disabled: i.disabled || u.value.length >= t(W),
372
- class: "h-[32px] rounded-[8px] border-[1px] border-dashed border-fm-color-neutral-gray-200 bg-fm-color-neutral-white px-[12px] flex items-center gap-[6px] text-[14px] font-semibold text-fm-color-primary hover:border-fm-color-primary focus-visible:ring-2 focus-visible:ring-fm-color-primary disabled:opacity-60 disabled:cursor-default",
373
- onClick: d
374
- }, [
375
- k(r, {
376
- name: "add",
377
- size: "sm"
378
- }),
379
- D(" " + l(t(o)("connect.whatsappBot.botSettings.knowledgeBase.addTopic")), 1)
380
- ], 8, ft)
381
- ]),
382
- u.value.length === 0 ? (a(), c("p", vt, l(t(o)("connect.whatsappBot.botSettings.knowledgeBase.empty")), 1)) : _("", !0),
383
- u.value.length >= t(W) ? (a(), c("p", bt, l(t(o)("connect.whatsappBot.botSettings.knowledgeBase.topicLimit", {
384
- count: t(W)
385
- })), 1)) : _("", !0),
386
- v.value ? (a(), c("div", {
387
- id: "knowledge-topic-editor",
388
- key: s.value ?? void 0,
389
- class: "rounded-[8px] border-[1px] border-fm-color-neutral-gray-100 p-[16px] flex flex-col gap-[10px]"
390
- }, [
391
- k(T, {
392
- modelValue: v.value.title,
393
- "onUpdate:modelValue": w[0] || (w[0] = (g) => v.value.title = g),
394
- label: t(o)("connect.whatsappBot.botSettings.knowledgeBase.titleLabel"),
395
- placeholder: t(o)("connect.whatsappBot.botSettings.knowledgeBase.titlePlaceholder"),
396
- "max-length": t(fe),
397
- disabled: i.disabled
398
- }, null, 8, ["modelValue", "label", "placeholder", "max-length", "disabled"]),
399
- e("div", gt, [
400
- e("label", ht, l(t(o)("connect.whatsappBot.botSettings.knowledgeBase.descriptionLabel")), 1),
401
- q(e("textarea", {
402
- id: "whatsapp-knowledge-topic-description",
403
- "onUpdate:modelValue": w[1] || (w[1] = (g) => v.value.description = g),
404
- "aria-describedby": "whatsapp-knowledge-topic-description-count",
405
- placeholder: t(o)(
406
- "connect.whatsappBot.botSettings.knowledgeBase.descriptionPlaceholder"
407
- ),
408
- maxlength: t(se),
409
- disabled: i.disabled,
410
- rows: "5",
411
- class: "block w-full min-h-[116px] resize-y rounded-[8px] border border-fm-color-neutral-gray-200 bg-fm-color-neutral-white px-[12px] py-[8px] text-[14px] leading-[20px] text-fm-color-typo-primary placeholder:text-fm-color-typo-tertiary transition-[border-color,box-shadow] focus:border-fm-color-primary focus:outline-none focus:ring-[4px] focus:ring-fm-color-primary/30 disabled:cursor-not-allowed disabled:bg-fm-color-neutral-gray-100 disabled:text-fm-color-typo-disabled"
412
- }, null, 8, yt), [
413
- [re, v.value.description]
414
- ]),
415
- e("p", _t, l(v.value.description.length) + " / " + l(t(se)), 1)
416
- ]),
417
- k(E, {
418
- variant: "plain",
419
- size: "sm",
420
- "prepend-icon": "delete",
421
- "text-color": "typo-error",
422
- label: t(o)("connect.whatsappBot.botSettings.knowledgeBase.removeTopic"),
423
- disabled: i.disabled,
424
- class: "self-start",
425
- onClick: f
426
- }, null, 8, ["label", "disabled"])
427
- ])) : _("", !0)
428
- ]);
429
- };
430
- }
431
- }), Bt = {
432
- "aria-labelledby": "response-speed-title",
433
- class: "flex flex-col gap-[12px]"
434
- }, kt = { class: "flex flex-col gap-[2px]" }, St = {
435
- id: "response-speed-title",
436
- class: "text-[16px] leading-[24px] font-semibold"
437
- }, $t = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, At = {
438
- role: "radiogroup",
439
- "aria-labelledby": "response-speed-title",
440
- "aria-describedby": "response-speed-detail",
441
- class: "grid grid-cols-[repeat(auto-fit,minmax(150px,1fr))] gap-[8px]"
442
- }, Tt = ["value", "disabled"], It = { class: "flex items-center gap-[8px] text-[14px] leading-[20px] font-semibold" }, Ft = {
443
- key: 0,
444
- class: "w-[8px] h-[8px] rounded-full bg-fm-color-primary"
445
- }, Ct = { class: "text-[12px] leading-[16px] text-fm-color-typo-secondary" }, Et = {
446
- id: "response-speed-detail",
447
- "aria-live": "polite",
448
- class: "text-[14px] leading-[20px] text-fm-color-typo-secondary"
449
- }, Vt = {
450
- key: 0,
451
- class: "rounded-[8px] bg-fm-color-system-warning-100 px-[12px] py-[10px] flex items-start gap-[10px] text-[14px] leading-[20px]"
452
- }, Pt = /* @__PURE__ */ L({
453
- __name: "ResponseSpeed",
454
- props: /* @__PURE__ */ Z({
455
- disabled: { type: Boolean }
456
- }, {
457
- modelValue: {
458
- required: !0
459
- },
460
- modelModifiers: {}
461
- }),
462
- emits: ["update:modelValue"],
463
- setup(i) {
464
- const n = H(i, "modelValue"), { t: u } = U();
465
- return (s, o) => {
466
- const v = $("FmIcon");
467
- return a(), c("section", Bt, [
468
- e("div", kt, [
469
- e("h2", St, l(t(u)("connect.whatsappBot.botSettings.responseSpeed.title")), 1),
470
- e("p", $t, l(t(u)("connect.whatsappBot.botSettings.responseSpeed.description")), 1)
471
- ]),
472
- e("div", At, [
473
- (a(!0), c(O, null, ee(t(ve), (d) => (a(), c("label", { key: d }, [
474
- q(e("input", {
475
- "onUpdate:modelValue": o[0] || (o[0] = (f) => n.value = f),
476
- type: "radio",
477
- name: "response-speed",
478
- value: d,
479
- disabled: i.disabled,
480
- class: "sr-only peer"
481
- }, null, 8, Tt), [
482
- [xe, n.value]
483
- ]),
484
- e("span", {
485
- class: X(["h-full border-[1px] rounded-[8px] p-[12px] flex flex-col gap-[4px] transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-fm-color-primary", [
486
- n.value === d ? "border-fm-color-primary bg-fm-color-primary-oats" : "border-fm-color-neutral-gray-200 bg-fm-color-neutral-white",
487
- i.disabled ? "cursor-default opacity-60" : "cursor-pointer hover:border-fm-color-primary"
488
- ]])
489
- }, [
490
- e("span", It, [
491
- e("span", {
492
- "aria-hidden": "true",
493
- class: X([
494
- "w-[16px] h-[16px] shrink-0 rounded-full border-[1.5px] bg-fm-color-neutral-white flex items-center justify-center",
495
- n.value === d ? "border-fm-color-primary" : "border-fm-color-neutral-gray-300"
496
- ])
497
- }, [
498
- n.value === d ? (a(), c("span", Ft)) : _("", !0)
499
- ], 2),
500
- D(" " + l(t(u)(`connect.whatsappBot.botSettings.responseSpeed.${d}.label`)), 1)
501
- ]),
502
- e("span", Ct, l(t(u)(`connect.whatsappBot.botSettings.responseSpeed.${d}.hint`)), 1)
503
- ], 2)
504
- ]))), 128))
505
- ]),
506
- e("p", Et, l(t(u)(
507
- `connect.whatsappBot.botSettings.responseSpeed.${n.value}.detail`
508
- )), 1),
509
- n.value === "immediate" ? (a(), c("div", Vt, [
510
- k(v, {
511
- name: "warning",
512
- size: "sm",
513
- class: "mt-[2px] shrink-0 text-fm-color-typo-warning"
514
- }),
515
- D(" " + l(t(u)("connect.whatsappBot.botSettings.responseSpeed.immediateWarning")), 1)
516
- ])) : _("", !0)
517
- ]);
518
- };
519
- }
520
- }), Nt = { class: "mt-[20px] mx-auto w-full min-w-0 flex flex-col gap-[20px]" }, Dt = {
521
- key: 0,
522
- role: "status",
523
- class: "py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
524
- }, Ot = { class: "border-t border-fm-color-neutral-gray-100 pt-[20px]" }, Lt = { class: "group border-t border-fm-color-neutral-gray-100 pt-[12px]" }, Ut = { class: "flex h-[36px] w-fit cursor-pointer list-none items-center gap-[8px] rounded-[8px] px-[8px] -ml-[8px] text-[16px] font-semibold transition-colors hover:bg-fm-color-neutral-gray-100 focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-fm-color-primary [&::-webkit-details-marker]:hidden" }, Mt = { class: "mt-[20px] flex flex-col gap-[20px]" }, Rt = {
525
- key: 1,
526
- role: "alert",
527
- class: "text-[14px] text-fm-color-typo-error"
528
- }, Wt = { class: "flex items-center justify-end gap-[12px] flex-wrap" }, Qt = /* @__PURE__ */ L({
529
- __name: "WhatsappBotSettings",
530
- setup(i) {
531
- const { t: n } = U(), u = de(), s = V(() => Q.getBusinessId() ?? ""), o = y(""), v = y(""), d = y([]), f = y([]), h = y(null), w = V(
532
- () => d.value.filter(
533
- (x) => x.title.trim() || x.description.trim()
534
- )
535
- ), r = y(
536
- z
537
- ), T = y(
538
- z
539
- ), E = y(!0), g = y(!1), m = y(!1), b = y(""), B = y([]), I = y(""), G = J, K = V(
540
- () => o.value !== v.value || r.value !== T.value || JSON.stringify(d.value) !== JSON.stringify(f.value)
541
- ), P = V(
542
- () => !g.value || m.value || !K.value
543
- ), te = V(
544
- () => !g.value || m.value || o.value.length > G || !be.safeParse(w.value).success
545
- );
546
- let A, M;
547
- function oe(x) {
548
- B.value = x.excludedAccounts, o.value = x.botInstructions, v.value = x.botInstructions, r.value = x.responseSpeed, T.value = x.responseSpeed, d.value = x.knowledgeBase.map((p) => ({ ...p })), f.value = x.knowledgeBase.map((p) => ({
549
- ...p
550
- }));
551
- }
552
- async function R(x = !1) {
553
- if (x && m.value) return;
554
- clearTimeout(M), A == null || A.abort();
555
- const p = new AbortController();
556
- A = p, x || (E.value = !0, g.value = !1, m.value = !1, b.value = "", o.value = "", v.value = "", r.value = z, T.value = z, d.value = [], f.value = [], h.value = null, B.value = [], I.value = "");
557
- try {
558
- if (!s.value)
559
- throw new Error(n("connect.whatsappBot.errors.selectBusiness"));
560
- const S = await Y.getSettings(
561
- s.value,
562
- p.signal
563
- );
564
- if (p.signal.aborted) return;
565
- B.value = S.excludedAccounts, I.value = "", x || (oe(S), g.value = !0);
566
- } catch (S) {
567
- if (!p.signal.aborted) {
568
- const F = S instanceof Error ? S.message : n("connect.whatsappBot.errors.loadSettings");
569
- x ? I.value = F : b.value = F;
570
- }
571
- } finally {
572
- p.signal.aborted || (E.value = !1, g.value && le());
573
- }
574
- }
575
- function le() {
576
- clearTimeout(M), M = setTimeout(() => void R(!0), 1e4);
577
- }
578
- function pe(x) {
579
- B.value = B.value.filter(
580
- (p) => p.id !== x
581
- ), R(!0);
582
- }
583
- async function ue() {
584
- if (te.value) return;
585
- clearTimeout(M), A == null || A.abort();
586
- const x = new AbortController();
587
- A = x, m.value = !0, b.value = "";
588
- const p = h.value === null ? void 0 : d.value[h.value], S = p ? w.value.indexOf(p) : -1;
589
- try {
590
- const F = await Y.saveSettings(
591
- s.value,
592
- {
593
- botInstructions: o.value,
594
- responseSpeed: r.value,
595
- knowledgeBase: w.value
596
- },
597
- x.signal
598
- );
599
- if (x.signal.aborted) return;
600
- oe(F), h.value = S < 0 ? null : S, u.open({
601
- type: "success",
602
- message: n("connect.whatsappBot.botSettings.saved")
603
- });
604
- } catch (F) {
605
- x.signal.aborted || (b.value = F instanceof Error ? F.message : n("connect.whatsappBot.errors.saveSettings"), u.open({ type: "error", message: b.value }));
606
- } finally {
607
- x.signal.aborted || (m.value = !1, le());
608
- }
609
- }
610
- async function me() {
611
- if (P.value) return;
612
- const x = s.value;
613
- !await ge.confirm(
614
- n("connect.whatsappBot.botSettings.discardChangesMessage"),
615
- n("connect.whatsappBot.botSettings.discardChangesTitle"),
616
- n("connect.common.confirm"),
617
- n("connect.common.cancel")
618
- ) || P.value || s.value !== x || (o.value = v.value, r.value = T.value, d.value = f.value.map((S) => ({ ...S })), h.value = null);
619
- }
620
- return ce(s, () => void R(), { immediate: !0 }), ie(() => {
621
- A == null || A.abort(), clearTimeout(M);
622
- }), (x, p) => {
623
- const S = $("FmCircularProgress"), F = $("FmIcon"), j = $("FmButton");
624
- return a(), c("div", Nt, [
625
- E.value ? (a(), c("div", Dt, [
626
- k(S),
627
- D(" " + l(t(n)("connect.whatsappBot.botSettings.loading")), 1)
628
- ])) : (a(), c(O, { key: 1 }, [
629
- g.value ? (a(), N($e, {
630
- key: 0,
631
- modelValue: o.value,
632
- "onUpdate:modelValue": p[0] || (p[0] = (C) => o.value = C),
633
- disabled: m.value
634
- }, null, 8, ["modelValue", "disabled"])) : _("", !0),
635
- e("div", Ot, [
636
- g.value ? (a(), N(ct, {
637
- key: 0,
638
- accounts: B.value,
639
- loading: !1,
640
- error: I.value,
641
- onRetry: p[1] || (p[1] = (C) => R(!0)),
642
- onRemoved: pe
643
- }, null, 8, ["accounts", "error"])) : _("", !0)
644
- ]),
645
- e("details", Lt, [
646
- e("summary", Ut, [
647
- D(l(t(n)("connect.whatsappBot.botSettings.advancedSettings")) + " ", 1),
648
- k(F, {
649
- name: "keyboard_arrow_down",
650
- size: "sm",
651
- class: "transition-transform group-open:rotate-180 motion-reduce:transition-none",
652
- "aria-hidden": "true"
653
- })
654
- ]),
655
- e("div", Mt, [
656
- g.value ? (a(), N(wt, {
657
- key: 0,
658
- modelValue: d.value,
659
- "onUpdate:modelValue": p[2] || (p[2] = (C) => d.value = C),
660
- "active-topic-index": h.value,
661
- "onUpdate:activeTopicIndex": p[3] || (p[3] = (C) => h.value = C),
662
- disabled: m.value
663
- }, null, 8, ["modelValue", "active-topic-index", "disabled"])) : _("", !0),
664
- g.value ? (a(), N(Pt, {
665
- key: 1,
666
- modelValue: r.value,
667
- "onUpdate:modelValue": p[4] || (p[4] = (C) => r.value = C),
668
- disabled: m.value,
669
- class: "border-t border-fm-color-neutral-gray-100 pt-[20px]"
670
- }, null, 8, ["modelValue", "disabled"])) : _("", !0)
671
- ])
672
- ]),
673
- b.value ? (a(), c("p", Rt, l(b.value), 1)) : _("", !0),
674
- g.value ? _("", !0) : (a(), N(j, {
675
- key: 2,
676
- class: "self-start !rounded-full [&_.label]:text-[14px]",
677
- label: t(n)("connect.whatsappBot.tryAgain"),
678
- "prepend-icon": "refresh",
679
- onClick: p[5] || (p[5] = (C) => R())
680
- }, null, 8, ["label"])),
681
- e("div", Wt, [
682
- k(j, {
683
- variant: "secondary",
684
- "border-color": "neutral-gray-200",
685
- label: t(n)("connect.common.cancel"),
686
- disabled: P.value,
687
- class: "!rounded-full !px-[20px] [&_.label]:text-[14px]",
688
- onClick: me
689
- }, null, 8, ["label", "disabled"]),
690
- k(j, {
691
- label: t(n)("connect.common.save"),
692
- disabled: te.value,
693
- loading: m.value,
694
- class: "!rounded-full !px-[20px] [&_.label]:text-[14px]",
695
- onClick: ue
696
- }, null, 8, ["label", "disabled", "loading"])
697
- ])
698
- ], 64))
699
- ]);
700
- };
701
- }
702
- });
703
- export {
704
- Qt as default
705
- };