@feedmepos/mf-connect 0.1.114-prod → 0.1.115-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 (157) hide show
  1. package/README.md +66 -1
  2. package/dist/{App-DMYXrCc7.js → App-43mZfFAr.js} +700 -654
  3. package/dist/AuditLogs-BPpdm96t.js +2016 -0
  4. package/dist/{Bin-CHZolo56.js → Bin-CA7v180Y.js} +8 -8
  5. package/dist/Broadcast-qmdifF2Y.js +306 -0
  6. package/dist/{CampaignAnalytic-DgZvsUoF.js → CampaignAnalytic-xnrDxqaH.js} +7 -7
  7. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C42uL_JO.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-zjk-QdtX.js} +9 -9
  8. package/dist/{Card-wRFTJwJ9.js → Card-D8icsk7L.js} +25 -24
  9. package/dist/{Collections-9G-_9Etz.js → Collections--THcD-E_.js} +197 -185
  10. package/dist/{Credit-Bl7IDMCU.js → Credit-JrbtVMBp.js} +21 -20
  11. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-BVLJeofG.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DrwKtnE5.js} +1 -1
  12. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DgdAlHU7.js +4442 -0
  13. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-Q1f6EQW3.js → EffectSheet.vue_vue_type_style_index_0_lang-hVgqWdD0.js} +32 -32
  14. package/dist/{Experience-Cs2iViLv.js → Experience-CFeRqBoj.js} +32 -31
  15. package/dist/{FileSaver.min-B3Levdbu.js → FileSaver.min-CCXIBm58.js} +1 -1
  16. package/dist/{Game-oXURgzan.js → Game-CPxq6Ex3.js} +19 -18
  17. package/dist/{GiftCardSetup-C2Wu-dRl.js → GiftCardSetup-D0esVZDp.js} +75 -75
  18. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Da2e89Um.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-CJ1-vL-K.js} +7 -7
  19. package/dist/{Goals-B_xEM7gf.js → Goals-DaKI6uXt.js} +4 -4
  20. package/dist/Grab-BWzdN_cd.js +301 -0
  21. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BRJR1heE.js → ImageInput.vue_vue_type_script_setup_true_lang-BOnL0GxM.js} +1 -1
  22. package/dist/{Index-kuT6W6R_.js → Index-2kENoaZm.js} +10 -10
  23. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-7JqHfSk-.js → LocationPicker.vue_vue_type_script_setup_true_lang-BtWnJKU_.js} +1 -1
  24. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-CI_4S7tW.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CX_Sspu5.js} +1 -1
  25. package/dist/{LoyaltyDashboard-CqxHdZcm.js → LoyaltyDashboard-CB93Fz8u.js} +15 -15
  26. package/dist/MainLayout-DwnjGXh6.js +4 -0
  27. package/dist/{MainLayout-CAERFIms.js → MainLayout.vue_vue_type_script_setup_true_lang-Du8fw5v_.js} +5 -4
  28. package/dist/Marketing-DCco__2F.js +273 -0
  29. package/dist/MarketingMaterialEdit-BbgFtrYP.js +1037 -0
  30. package/dist/{Member-B8VZEn9t.js → Member-B--nYyr0.js} +7 -7
  31. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-B31lVLKh.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-BBlzO7Db.js} +43 -50
  32. package/dist/{MemberImportHistory-D9tgHnTS.js → MemberImportHistory-D52Y4RTC.js} +7 -7
  33. package/dist/{MemberList-Hw_xQY1i.js → MemberList-13Owa1fj.js} +103 -105
  34. package/dist/{MemberTransactions-DiBO4plw.js → MemberTransactions-CpXEWNbq.js} +1 -1
  35. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CbFt5X89.js → MessageInput.vue_vue_type_script_setup_true_lang-DlELjFM0.js} +4228 -4176
  36. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-BE_-Ed4z.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-C_y0rM8c.js} +1 -1
  37. package/dist/{Mission-DpYei3aF.js → Mission-Ci-UzXSu.js} +22 -21
  38. package/dist/{Overview-CARquJCS.js → Overview-CKxSfAGF.js} +145 -144
  39. package/dist/{Overview-BFQMmyT6.js → Overview-CXen9Ram.js} +23 -22
  40. package/dist/{Point-Dd2ykwNv.js → Point-CR3YOaag.js} +22 -21
  41. package/dist/{Promotion-DXl-W7np.js → Promotion-tw3J4ul-.js} +137 -131
  42. package/dist/{Queue-Cd3N-4iB.js → Queue-BZGA5ZXt.js} +47 -46
  43. package/dist/{Record-C3HdDsh5.js → Record-BTevVXnT.js} +9 -9
  44. package/dist/{Review-Bif3Ub9Z.js → Review-BU7c8ZF0.js} +2 -2
  45. package/dist/ReviewFacebookCallback-BnMF6Arh.js +225 -0
  46. package/dist/{ReviewGoogleCallback-i-RNLlLm.js → ReviewGoogleCallback-xpdPHSdg.js} +5 -5
  47. package/dist/{Reward-DHxzrR_7.js → Reward-jlA_7cxz.js} +29 -29
  48. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DcrFlcSo.js → RewardGroup.vue_vue_type_script_setup_true_lang-D3z_n42G.js} +16 -15
  49. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-CsHxqH9h.js +1923 -0
  50. package/dist/{Segment-Cjpxordk.js → Segment-C1Bwm--Q.js} +290 -291
  51. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-6u21xBu6.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-B6apgWTM.js} +31 -30
  52. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BOXVzfer.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-B7m2F9UV.js} +4 -4
  53. package/dist/Setting-CDM4RhLW.js +574 -0
  54. package/dist/{SettingAdvertisements-aog5fz32.js → SettingAdvertisements-4XEAJzlL.js} +12 -12
  55. package/dist/Settings-D-0tvZRr.js +286 -0
  56. package/dist/{Store-Bq3kw1l2.js → Store-C56dXtc4.js} +31 -30
  57. package/dist/{StoreRewards-ZGXKEM09.js → StoreRewards-DQ1Q6WS6.js} +15 -15
  58. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-LLD91Rz6.js +1319 -0
  59. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Bvy4NJMd.js +7007 -0
  60. package/dist/{Tier-CfgpEHY7.js → Tier-D4CPZqw7.js} +2576 -687
  61. package/dist/{Title-B2itYWeD.js → Title-DCbwhUic.js} +94 -92
  62. package/dist/{Transaction-hJ5ygIcf.js → Transaction-C5LrasXr.js} +2 -2
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-8BgGlpTh.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Cl9b4mrK.js} +26 -26
  64. package/dist/{Voucher-TG47pGR3.js → Voucher-rrVbNZKR.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-CjuXCTxg.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BIq227nz.js} +16 -16
  66. package/dist/WhatsappAccount-oJDo5zTr.js +159 -0
  67. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-aCQCYFYq.js +39 -0
  68. package/dist/WhatsappBot-Cl64wG_F.js +876 -0
  69. package/dist/WhatsappBotLogs-D3uT4EiB.js +372 -0
  70. package/dist/WhatsappBotSettings-Cs1lLxh-.js +705 -0
  71. package/dist/WhatsappLayout-C639d2HP.js +21 -0
  72. package/dist/WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DpPxWp2x.js +253 -0
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-BRs-gbP0.js → ZodTextField.vue_vue_type_script_setup_true_lang-C39_95SZ.js} +2 -2
  74. package/dist/{app-tPHYkJcQ.js → app-CgimGODl.js} +10610 -8223
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-BHDVnGj2.js → base.export-D2P6HFvo.js} +2 -2
  77. package/dist/browser-BSAOEeIM.js +1478 -0
  78. package/dist/{business-HLyWfrXY.js → business-Bu5TqSA0.js} +1 -1
  79. package/dist/campaign-BFIXSgdJ.js +400 -0
  80. package/dist/{campaign-5zFgUNLw.js → campaign-zJxttSIk.js} +31 -25
  81. package/dist/{campaign.enum-BOkDnP2g.js → campaign.enum-Dx-Zo68Q.js} +3 -2
  82. package/dist/{campaign.fn-BIAoVtJj.js → campaign.fn-gvjlcEfe.js} +78 -78
  83. package/dist/{collectible.enum-BbZSAfys.js → collectible.enum-Liy2wH3s.js} +1 -1
  84. package/dist/{collection.fn-DPSgBHnz.js → collection.fn-DOm0HsSh.js} +2 -2
  85. package/dist/{currency-BVrMqU6-.js → currency-BpbQvbm8.js} +1 -1
  86. package/dist/duplicateCampaign-CvsvjRE9.js +51 -0
  87. package/dist/{effect-BBifVx76.js → effect-D-GtNB3n.js} +1 -1
  88. package/dist/{email-addresses-9C7xHTNv.js → email-addresses-BKMoAtMi.js} +2 -2
  89. package/dist/feature-flag-BJ_eyKsq.js +868 -0
  90. package/dist/feature-flag-Bo-k5sIG.js +50 -0
  91. package/dist/google-BQK68wbe.js +5 -0
  92. package/dist/{helper-C08jyQNK.js → helper-CkfjBgMM.js} +1 -1
  93. package/dist/{index-Dhyqf1s8.js → index-B6kU3PkV.js} +2700 -2613
  94. package/dist/{index-BgwZGunW.js → index-BAtUrtqM.js} +19 -6
  95. package/dist/index-BKsxIwbi.js +14571 -0
  96. package/dist/{index-DZ-q5O-V.js → index-BdEXUNoG.js} +4 -4
  97. package/dist/{index-hIUtD2eY.js → index-Bhl5IRXy.js} +11 -10
  98. package/dist/{index-kCbkOivd.js → index-BpTIulTX.js} +1 -1
  99. package/dist/index-C-iwb2Ln.js +109 -0
  100. package/dist/{index-Ciw2TZxV.js → index-CCEXSPxk.js} +8 -7
  101. package/dist/{index-CUle4c2B.js → index-CIej31pF.js} +4 -3
  102. package/dist/{index-ihw-WFCa.js → index-CQ8XFbBk.js} +2 -2
  103. package/dist/index-C_H8jFYf.js +2743 -0
  104. package/dist/{index-CEe1kJ0T.js → index-CfQuYqXn.js} +1 -1
  105. package/dist/{index-C_WoO58V.js → index-CuREApMc.js} +8 -7
  106. package/dist/{index-NJSI4wX4.js → index-D0JK99Ko.js} +693 -231
  107. package/dist/{index-DnRMNmUA.js → index-DKxN1mMS.js} +396 -232
  108. package/dist/index-DQ8JJhxs.js +74 -0
  109. package/dist/{index-D24Q28cH.js → index-DUAZOMVJ.js} +1 -1
  110. package/dist/{index-Yo0tP8KJ.js → index-DqGs6RJG.js} +683 -581
  111. package/dist/{index-B_334Y_i.js → index-DwU3fsLW.js} +29 -15
  112. package/dist/{index-hSRM1smQ.js → index-LygS9WsG.js} +8028 -10767
  113. package/dist/{index-96ZiAKj_.js → index-feCrYhi6.js} +1 -1
  114. package/dist/{index-Dk-jg0wN.js → index-zTvr2GR4.js} +2 -2
  115. package/dist/{index.esm2017-hN99SQTb.js → index.esm2017-DZi9IQPS.js} +209 -209
  116. package/dist/{loading-CVuY4vQ4.js → loading-Brid2wnu.js} +1 -1
  117. package/dist/{lodash-GFl9_FMH.js → lodash-C1epw3Kv.js} +1 -1
  118. package/dist/{member-import-CshTzabx.js → member-import-DAIxTIiu.js} +6 -5
  119. package/dist/{membership-S0KES3Ex.js → membership-BZmljFhF.js} +3 -3
  120. package/dist/{money-JxdX8ru4.js → money-cLcyGcSZ.js} +1 -1
  121. package/dist/{number-BRLwa-mB.js → number-C2jPLJr2.js} +1 -1
  122. package/dist/objectid-C-wocWKI.js +145 -0
  123. package/dist/{onboarding-BSKYeyP7.js → onboarding-oRfy_g05.js} +25 -25
  124. package/dist/{onboardingSetup-BqT52VRm.js → onboardingSetup-BLD6m8HY.js} +2 -2
  125. package/dist/{plugins-BR_wmMFJ.js → plugins-CUsr9vB0.js} +3 -3
  126. package/dist/{MarketingMaterialEdit-BvIthCHG.js → remy-icon-BhUGu2NI.js} +2 -1031
  127. package/dist/{reward-CpCGg_W2.js → reward-UOT03odb.js} +1 -1
  128. package/dist/{rule-Dbg9e8MO.js → rule-BgJnPjkI.js} +572 -492
  129. package/dist/style.css +1 -1
  130. package/dist/template-BZyFhr73.js +188 -0
  131. package/dist/{timezone-CDVa-xPr.js → timezone-BXA4wq7Y.js} +1 -1
  132. package/dist/{transaction.fn-DrTBoF9T.js → transaction.fn-CQ4fpRt3.js} +2 -2
  133. package/dist/{trigger-wqGwQfB2.js → trigger-DXJCGT0q.js} +8 -8
  134. package/dist/useMarketingMaterialActions-B-Wib5ga.js +125 -0
  135. package/dist/{usePagination-fODgpZZ8.js → usePagination-Pp4okWr8.js} +1 -1
  136. package/dist/{user-DaLUK1dk.js → user-B3gXcAIy.js} +1 -1
  137. package/dist/vue-i18n-DWGiC_vs.js +2365 -0
  138. package/dist/{xlsx-Bl4_Dtrq.js → xlsx-CCaDUTgW.js} +651 -651
  139. package/dist/{zod-CAzWyVqj.js → zod-CPwjOxvW.js} +1 -1
  140. package/package.json +12 -3
  141. package/dist/Broadcast-ByWvxVhW.js +0 -271
  142. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DGpQfV5T.js +0 -2431
  143. package/dist/Marketing-KgcwGErU.js +0 -236
  144. package/dist/ReviewFacebookCallback-mJF54-9l.js +0 -238
  145. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-39f3I4BB.js +0 -1883
  146. package/dist/Setting-Dl9MelHz.js +0 -2036
  147. package/dist/Settings-DvCCClIP.js +0 -179
  148. package/dist/StoreTransactions.vue_vue_type_script_setup_true_lang-DscLAF0p.js +0 -1264
  149. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-l_v4FHO0.js +0 -142
  150. package/dist/campaign-awCRccgX.js +0 -228
  151. package/dist/google-C3S8u0mT.js +0 -4
  152. package/dist/index-CoNJdOx7.js +0 -51
  153. package/dist/objectid-CEHN25HN.js +0 -145
  154. package/dist/rule-builder-BEIjxsE0.js +0 -102
  155. package/dist/template-CS-lExgI.js +0 -236
  156. package/dist/useMarketingMaterialActions-DC0gIyIZ.js +0 -96
  157. package/dist/vue-i18n-Dx-KXojZ.js +0 -2365
@@ -0,0 +1,705 @@
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
+ };