@feedmepos/mf-connect 0.1.124-prod → 0.1.126-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 (149) hide show
  1. package/dist/{App-DMh2xABv.js → App-B_Yp6cvN.js} +224 -216
  2. package/dist/AuditLogs-C1U17evK.js +2016 -0
  3. package/dist/{Bin-C_pkPgIo.js → Bin-CmIpEIwe.js} +8 -8
  4. package/dist/{Broadcast-6ZJzdY0b.js → Broadcast-DkV4BdU_.js} +22 -21
  5. package/dist/{CampaignAnalytic-CLd5ecQe.js → CampaignAnalytic-Dkwo_lpB.js} +7 -7
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-C4OWhhAx.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Ch8Gblw6.js} +9 -10
  7. package/dist/{Card-CkS8F43U.js → Card-DXCkG34M.js} +23 -23
  8. package/dist/{Collections-BA9I-dDz.js → Collections-CybPfSO4.js} +197 -185
  9. package/dist/{Credit-CXm0A-qe.js → Credit-B-KUzWsX.js} +21 -20
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-DzsHTlrN.js → DateRangeChip.vue_vue_type_script_setup_true_lang-CWHYeYVD.js} +1 -1
  11. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C86llTFR.js +4439 -0
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-zSPUBUSz.js → EffectSheet.vue_vue_type_style_index_0_lang-nMcH6y5e.js} +33 -33
  13. package/dist/{Experience-Bq4ykqTJ.js → Experience-Q2NHpa-V.js} +32 -31
  14. package/dist/{FileSaver.min-BtBxrIBi.js → FileSaver.min-CKw2rn-J.js} +1 -1
  15. package/dist/{Game-DpLFmP-G.js → Game-lZvkg04z.js} +19 -18
  16. package/dist/{GiftCardSetup-BqOqEUim.js → GiftCardSetup-CPRju80_.js} +31 -31
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-B06xj5q7.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-Ci686UoB.js} +7 -7
  18. package/dist/{Goals-DMlNeiUc.js → Goals-asGsUeVv.js} +4 -4
  19. package/dist/Grab-BjFLSMpE.js +301 -0
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-DPWRgxG_.js → ImageInput.vue_vue_type_script_setup_true_lang-nk87zPWH.js} +1 -1
  21. package/dist/{Index-Cw07jj0k.js → Index-DIasPS4Y.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-CLjjquVP.js → LocationPicker.vue_vue_type_script_setup_true_lang-DkOn8p1v.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DHOShJQp.js → LottieAnimation.vue_vue_type_script_setup_true_lang-BdSkxiP-.js} +1 -1
  24. package/dist/{LoyaltyDashboard-DzSiK6M7.js → LoyaltyDashboard-DlCsZ3YX.js} +15 -15
  25. package/dist/{MainLayout-1EF680_j.js → MainLayout-DLObnTAA.js} +1 -1
  26. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-Df9pBgH9.js → MainLayout.vue_vue_type_script_setup_true_lang-DigSZKt1.js} +3 -3
  27. package/dist/{Marketing-T-epFsvG.js → Marketing-JflPW-w9.js} +4 -4
  28. package/dist/{MarketingMaterialEdit-CVhPfyEp.js → MarketingMaterialEdit-fSAB3YVb.js} +214 -211
  29. package/dist/{Member-BUZOPyQR.js → Member-CzNahXTj.js} +7 -7
  30. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-zURjtl1z.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-bqWUIbMG.js} +40 -48
  31. package/dist/{MemberImportHistory-DGz9i6L7.js → MemberImportHistory--r_A_2Es.js} +7 -7
  32. package/dist/{MemberList-CNdSrzBa.js → MemberList-CQZQ4sN8.js} +103 -105
  33. package/dist/{MemberTransactions-CdQMuQsd.js → MemberTransactions-BPg9JaUA.js} +1 -1
  34. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-CWKVXeCa.js → MessageInput.vue_vue_type_script_setup_true_lang-BhIFChx-.js} +12 -12
  35. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-xZitIoXE.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CdGSNqEp.js} +1 -1
  36. package/dist/{Mission-CYxgMBPt.js → Mission-CYCB3YQc.js} +22 -21
  37. package/dist/{Overview-qZ1KKw9D.js → Overview-B5ylMBHT.js} +145 -144
  38. package/dist/{Overview-DSm8AfDB.js → Overview-DuNuUYYq.js} +21 -21
  39. package/dist/{Point-BGlbT9OK.js → Point-DG-Uwj25.js} +22 -21
  40. package/dist/{Promotion-CtlrUFa8.js → Promotion-DqxBQ1yO.js} +137 -131
  41. package/dist/{Queue-Dc_z9MKc.js → Queue-Cy8LGt_Y.js} +46 -46
  42. package/dist/{Record-DVKrhFwJ.js → Record-CzXbu41w.js} +9 -9
  43. package/dist/{Review-Bh8Tw_QU.js → Review-7VL6gIqp.js} +2 -2
  44. package/dist/ReviewFacebookCallback-BwzuPmrz.js +225 -0
  45. package/dist/{ReviewGoogleCallback-CsSCz_C5.js → ReviewGoogleCallback-1JXR_f5O.js} +5 -5
  46. package/dist/{Reward-DY1Q3m1w.js → Reward-BKhUDEu3.js} +16 -16
  47. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-4A91EkSW.js → RewardGroup.vue_vue_type_script_setup_true_lang-DjjCytWF.js} +14 -14
  48. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Vg7pRGIz.js +1923 -0
  49. package/dist/{Segment-D6LchJFl.js → Segment-DdHDJhaS.js} +304 -307
  50. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-CSAtkMnJ.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-9kGUkHMi.js} +15 -15
  51. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Co1MQoVq.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-DeFw0px7.js} +4 -4
  52. package/dist/{Setting-UkdSKiUb.js → Setting-DZKGXw-i.js} +17 -17
  53. package/dist/{SettingAdvertisements-DK97gcus.js → SettingAdvertisements-BBNs8tCw.js} +12 -12
  54. package/dist/Settings-9v0hnBJZ.js +286 -0
  55. package/dist/{Store-2VVStL5_.js → Store-C8IlE4IH.js} +29 -29
  56. package/dist/{StoreRewards-f3Pyb9hu.js → StoreRewards-DWygRLR1.js} +15 -15
  57. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BmnyPSVT.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CeYYws6P.js} +25 -25
  58. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BiN3uRJ_.js +7007 -0
  59. package/dist/{Tier-D4Of9P17.js → Tier-7RoxGHsP.js} +2583 -688
  60. package/dist/{Title-Cg6X9UkB.js → Title-0q2Z4HIe.js} +96 -95
  61. package/dist/{Transaction-LJbjQnj_.js → Transaction-CFasERdg.js} +2 -2
  62. package/dist/{Upselling-B-VwbtjT.js → Upselling-DM9R6pYw.js} +3 -3
  63. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-DqH6Upx-.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BDjwcgnc.js} +26 -26
  64. package/dist/{Voucher-BJG6VKXt.js → Voucher-BkzW2hVV.js} +19 -19
  65. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-7kYeJthi.js → VoucherEditor.vue_vue_type_script_setup_true_lang-DaE4xa3x.js} +12 -12
  66. package/dist/{WhatsappAccount-Dc1fJWWj.js → WhatsappAccount-C3WpDF9O.js} +6 -6
  67. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BV0Bsl7a.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BxC_3h52.js} +1 -1
  68. package/dist/{WhatsappBot-Coq1WP96.js → WhatsappBot-DZb-Dn3s.js} +6 -6
  69. package/dist/WhatsappBotLogs--KskC32Z.js +509 -0
  70. package/dist/WhatsappBotSettings-Dns_PqVE.js +945 -0
  71. package/dist/{WhatsappLayout-x9Ovpu6e.js → WhatsappLayout-NIrFGbId.js} +3 -3
  72. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-DZlT0uLW.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BfD5hHc7.js} +3 -3
  73. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-DSJncfI_.js → ZodTextField.vue_vue_type_script_setup_true_lang-CJGxy7gf.js} +2 -2
  74. package/dist/{app-BMFxxLUm.js → app-B9nLnoBt.js} +4497 -3667
  75. package/dist/app.js +4 -3
  76. package/dist/{base.export-LmQ51u5f.js → base.export-CBzNea0v.js} +2 -2
  77. package/dist/{business-DZWViiMC.js → business-aT2zslwu.js} +1 -1
  78. package/dist/{campaign-DZDGbR4W.js → campaign-B6nTwt17.js} +121 -94
  79. package/dist/{campaign-C9xvGyrL.js → campaign-BDCLKFwN.js} +31 -25
  80. package/dist/{campaign.enum-BqekIiiN.js → campaign.enum-Dx-Zo68Q.js} +2 -1
  81. package/dist/campaign.fn-Ck1t5C1T.js +776 -0
  82. package/dist/{collection.fn-DrNrla0B.js → collection.fn-CDna_VLD.js} +2 -2
  83. package/dist/{currency-BZv2gSlF.js → currency-Baum67Wz.js} +1 -1
  84. package/dist/duplicateCampaign-BwrMZgaV.js +51 -0
  85. package/dist/{effect-CvumfBMY.js → effect-CeJbflOK.js} +1 -1
  86. package/dist/{email-addresses-79tPeI4j.js → email-addresses-Y3vF73J0.js} +2 -2
  87. package/dist/{feature-flag-CYXnrECh.js → feature-flag-zn6Ql9tv.js} +84 -84
  88. package/dist/google-BQK68wbe.js +5 -0
  89. package/dist/{helper-DFjsyjri.js → helper-DZvnn-yx.js} +1 -1
  90. package/dist/{index-CcCiEG6N.js → index-B20FfbEE.js} +1 -1
  91. package/dist/{index-DWZzsJHU.js → index-B22ojkMy.js} +2 -2
  92. package/dist/{index-I9lmcd2w.js → index-B3LCTMwV.js} +68 -54
  93. package/dist/{index-C43KoLej.js → index-B5H4znfe.js} +4 -4
  94. package/dist/{index-C5bC2n8X.js → index-BL2zQnXK.js} +3 -3
  95. package/dist/{index-MhAbTpBy.js → index-BYUEPfbP.js} +23 -23
  96. package/dist/{index-CA7oIW_T.js → index-BqniSMV6.js} +197 -197
  97. package/dist/{index-CAWnce4u.js → index-CDRTiAEu.js} +1 -1
  98. package/dist/{index-_-nCOZ1D.js → index-CMs3aIA6.js} +19 -6
  99. package/dist/{index-BiPRZRyE.js → index-CPi3Qwmj.js} +2699 -2613
  100. package/dist/{index-Ba1t5vQv.js → index-DCR1GFCA.js} +380 -234
  101. package/dist/{index-C6ZTa-eq.js → index-DHNhIloU.js} +1 -1
  102. package/dist/{index-CBd91xYU.js → index-DJIt5tXC.js} +7 -7
  103. package/dist/index-DXKJsqgW.js +104 -0
  104. package/dist/{index-CNzQ3FLi.js → index-DXyOBtgF.js} +1 -1
  105. package/dist/{index-Bnane9cm.js → index-Da0-7h2j.js} +1 -1
  106. package/dist/{index-C6Rx7pjc.js → index-DkBOM8za.js} +608 -251
  107. package/dist/{index-CW4rNV1_.js → index-FgM7b2Sw.js} +2 -2
  108. package/dist/{index-DZrX13oF.js → index-juXxYQ_a.js} +1314 -1242
  109. package/dist/{index-Bt-n8QuD.js → index-njg4JLa-.js} +9 -9
  110. package/dist/{index-B_8PAyia.js → index-r_T5o_hF.js} +2 -2
  111. package/dist/{index.esm2017-DtTjnHHc.js → index.esm2017-Dtk7BscN.js} +57 -57
  112. package/dist/{loading-DkqEFbrR.js → loading-PoODMkQD.js} +1 -1
  113. package/dist/{lodash-BxU_5gPB.js → lodash-TthNgH98.js} +1 -1
  114. package/dist/{member-import-B3NBqSF6.js → member-import-D7zs0Jvh.js} +22 -13
  115. package/dist/{membership-Dr5BxoL-.js → membership-Cab-iWQ1.js} +2 -2
  116. package/dist/{money-D58xuACG.js → money-9Q306M3g.js} +1 -1
  117. package/dist/{number-C9CiD5ci.js → number-D9M3D435.js} +1 -1
  118. package/dist/objectid-DKvQl6FD.js +145 -0
  119. package/dist/{onboarding-BssUSfGQ.js → onboarding-D5LKUHVI.js} +25 -25
  120. package/dist/{onboardingSetup-Dc_lD-K8.js → onboardingSetup-D0jsS6w5.js} +2 -2
  121. package/dist/{plugins-D7Xjefvk.js → plugins-CDTKQ1Pg.js} +3 -3
  122. package/dist/{reward-CACqYkQp.js → reward-De3e9vYS.js} +1 -1
  123. package/dist/{rule-BRaTrwKz.js → rule-trVJgEOe.js} +572 -492
  124. package/dist/style.css +1 -1
  125. package/dist/template-Bj3Tb6bP.js +227 -0
  126. package/dist/{timezone-CgVEOC5i.js → timezone-DkuByUmb.js} +1 -1
  127. package/dist/{transaction.fn-C64l_ja_.js → transaction.fn-CPE-oQhA.js} +2 -2
  128. package/dist/{trigger-d2RIqXLt.js → trigger-C6oM-8pe.js} +9 -9
  129. package/dist/{useMarketingMaterialActions-Drf2MY9h.js → useMarketingMaterialActions-C5scdJQp.js} +4 -4
  130. package/dist/{usePagination-IUw34YLE.js → usePagination-CIuTHSSG.js} +1 -1
  131. package/dist/{user-ClGyYHyS.js → user-Bdlgn2yo.js} +1 -1
  132. package/dist/vue-i18n-DEpDI-dt.js +2365 -0
  133. package/dist/{xlsx-HvtVSofi.js → xlsx-CvecxUOG.js} +1 -1
  134. package/dist/{zod-IPdjFU_b.js → zod-bniyeWdY.js} +1 -1
  135. package/package.json +6 -2
  136. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C5INV6R7.js +0 -3493
  137. package/dist/ReviewFacebookCallback-ZZ0pxplM.js +0 -238
  138. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-JA0XIgqb.js +0 -1884
  139. package/dist/Settings-BFcVswDS.js +0 -179
  140. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-CCWNzg4p.js +0 -142
  141. package/dist/WhatsappBotLogs-EH9PQVn9.js +0 -372
  142. package/dist/WhatsappBotSettings-fNRFecJX.js +0 -704
  143. package/dist/campaign.fn-OVkj0QLu.js +0 -776
  144. package/dist/google-C3S8u0mT.js +0 -4
  145. package/dist/index-C-pVo6PI.js +0 -74
  146. package/dist/objectid-CgTtbB6Q.js +0 -145
  147. package/dist/rule-builder-DZOASGFD.js +0 -102
  148. package/dist/template-DdeVPIBt.js +0 -275
  149. package/dist/vue-i18n-Cby9s0nj.js +0 -2365
@@ -0,0 +1,945 @@
1
+ import { defineComponent as M, mergeModels as le, useModel as Q, openBlock as s, createElementBlock as d, createElementVNode as t, toDisplayString as n, unref as e, withDirectives as Z, vModelText as ne, ref as B, watch as K, onBeforeUnmount as ae, resolveComponent as E, withKeys as ce, withModifiers as te, createVNode as S, Fragment as D, renderList as q, createBlock as O, normalizeClass as Y, createCommentVNode as A, computed as R, createTextVNode as L, withCtx as ie, vModelRadio as be } from "vue";
2
+ import { u as P } from "./vue-i18n-DEpDI-dt.js";
3
+ import { useSnackbar as ue } from "@feedmepos/ui-library";
4
+ import { F as oe, a as X, b as he, c as de, d as ye, e as J, f as we } from "./index-B3LCTMwV.js";
5
+ import { S as U } from "./index-DJIt5tXC.js";
6
+ import { w as j } from "./index-DXKJsqgW.js";
7
+ import { p as _e } from "./plugins-CDTKQ1Pg.js";
8
+ const Be = { class: "flex flex-col gap-[10px]" }, ke = { class: "flex flex-col gap-[2px]" }, $e = {
9
+ id: "whatsapp-bot-instructions-title",
10
+ class: "text-[16px] leading-[24px] font-semibold"
11
+ }, Ae = {
12
+ id: "whatsapp-bot-instructions-description",
13
+ class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]"
14
+ }, Se = { class: "flex flex-col gap-[6px]" }, Ie = ["placeholder", "maxlength", "disabled"], Ee = {
15
+ id: "whatsapp-bot-instructions-count",
16
+ class: "text-right text-[12px] leading-[16px] text-fm-color-typo-tertiary tabular-nums"
17
+ }, Te = /* @__PURE__ */ M({
18
+ __name: "BotInstructions",
19
+ props: /* @__PURE__ */ le({
20
+ disabled: { type: Boolean }
21
+ }, {
22
+ modelValue: { required: !0 },
23
+ modelModifiers: {}
24
+ }),
25
+ emits: ["update:modelValue"],
26
+ setup(l) {
27
+ const i = Q(l, "modelValue"), { t: u } = P();
28
+ return (a, o) => (s(), d("div", Be, [
29
+ t("div", ke, [
30
+ t("h2", $e, n(e(u)("connect.whatsappBot.botSettings.instructions")), 1),
31
+ t("p", Ae, n(e(u)("connect.whatsappBot.botSettings.description")), 1)
32
+ ]),
33
+ t("div", Se, [
34
+ Z(t("textarea", {
35
+ "onUpdate:modelValue": o[0] || (o[0] = (c) => i.value = c),
36
+ "aria-labelledby": "whatsapp-bot-instructions-title",
37
+ "aria-describedby": "whatsapp-bot-instructions-description whatsapp-bot-instructions-count",
38
+ placeholder: e(u)("connect.whatsappBot.botSettings.placeholder"),
39
+ maxlength: e(oe),
40
+ disabled: l.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, Ie), [
44
+ [ne, i.value]
45
+ ]),
46
+ t("p", Ee, n(i.value.length) + " / " + n(e(oe)), 1)
47
+ ])
48
+ ]));
49
+ }
50
+ });
51
+ function Fe(l) {
52
+ const { t: i } = P(), u = ue(), a = B(""), o = B(""), c = B("");
53
+ let r;
54
+ function g(v) {
55
+ return l.accounts().find((y) => y.conversationId === v);
56
+ }
57
+ async function w(v) {
58
+ if (a.value || o.value || g(v.id)) return;
59
+ const y = U.getBusinessId();
60
+ if (!y) return;
61
+ const p = new AbortController();
62
+ r = p, a.value = v.id, c.value = "";
63
+ try {
64
+ const m = await j.excludeAccount(
65
+ y,
66
+ { conversationId: v.id },
67
+ p.signal
68
+ );
69
+ if (p.signal.aborted) return;
70
+ l.onAdded(m.excludedAccounts), u.open({
71
+ type: "success",
72
+ message: i("connect.whatsappBot.excludedAccounts.added", {
73
+ name: v.customerName || v.phoneNumber || v.id
74
+ })
75
+ });
76
+ } catch (m) {
77
+ p.signal.aborted || (c.value = m instanceof Error ? m.message : i("connect.whatsappBot.excludedAccounts.addError"), u.open({ type: "error", message: c.value }));
78
+ } finally {
79
+ p.signal.aborted || (a.value = "");
80
+ }
81
+ }
82
+ async function x(v) {
83
+ if (o.value || a.value) return;
84
+ const y = U.getBusinessId();
85
+ if (!y || v.businessId !== y) return;
86
+ const p = new AbortController();
87
+ r = p, o.value = v.id, c.value = "";
88
+ try {
89
+ if (await j.removeExcludedAccount(
90
+ y,
91
+ v.id,
92
+ p.signal
93
+ ), p.signal.aborted) return;
94
+ l.onRemoved(v.id), u.open({
95
+ type: "success",
96
+ message: i("connect.whatsappBot.excludedAccounts.removed", {
97
+ name: v.customerName || v.phoneNumber || v.conversationId
98
+ })
99
+ });
100
+ } catch (m) {
101
+ p.signal.aborted || (c.value = m instanceof Error ? m.message : i("connect.whatsappBot.excludedAccounts.removeError"), u.open({ type: "error", message: c.value }));
102
+ } finally {
103
+ p.signal.aborted || (o.value = "");
104
+ }
105
+ }
106
+ function f() {
107
+ r == null || r.abort(), a.value = "", o.value = "", c.value = "";
108
+ }
109
+ return K(() => U.getBusinessId(), f), ae(f), {
110
+ addingId: a,
111
+ removingId: o,
112
+ actionError: c,
113
+ getExclusion: g,
114
+ excludeAccount: w,
115
+ removeExclusion: x
116
+ };
117
+ }
118
+ const Ce = { class: "relative flex items-center" }, Pe = ["aria-label", "placeholder", "disabled", "onKeydown"], Ve = {
119
+ key: 0,
120
+ class: "fm-shadow-light-300 absolute left-0 right-0 top-[48px] z-10 flex max-h-[320px] flex-col gap-[2px] overflow-y-auto rounded-[12px] border border-fm-color-neutral-gray-100 bg-fm-color-neutral-white p-[8px]"
121
+ }, Ne = {
122
+ key: 0,
123
+ role: "status",
124
+ class: "px-[8px] py-[10px] text-[13px] text-fm-color-typo-tertiary"
125
+ }, Oe = {
126
+ key: 1,
127
+ role: "alert",
128
+ class: "px-[8px] py-[10px] text-[13px] text-fm-color-typo-error"
129
+ }, Re = ["disabled", "onClick"], De = {
130
+ class: "flex h-[32px] w-[32px] shrink-0 items-center justify-center rounded-full bg-fm-color-neutral-gray-100 text-[12px] font-semibold text-fm-color-typo-secondary",
131
+ "aria-hidden": "true"
132
+ }, Me = { class: "flex min-w-0 flex-1 flex-col" }, Ue = { class: "truncate font-semibold leading-[20px]" }, Le = { class: "text-[12px] leading-[16px] text-fm-color-typo-tertiary" }, We = {
133
+ key: 0,
134
+ role: "status",
135
+ class: "px-[8px] py-[10px] text-[13px] leading-[18px] text-fm-color-typo-tertiary"
136
+ }, ze = /* @__PURE__ */ M({
137
+ __name: "ExcludedAccountSearch",
138
+ props: {
139
+ accounts: {},
140
+ loading: { type: Boolean },
141
+ addingId: {},
142
+ removingId: {}
143
+ },
144
+ emits: ["select"],
145
+ setup(l, { emit: i }) {
146
+ const u = l, a = i, { t: o } = P(), c = B(""), r = B([]), g = B(!1), w = B(""), x = B(!1);
147
+ let f;
148
+ function v(k) {
149
+ return u.accounts.find((_) => _.conversationId === k);
150
+ }
151
+ K(c, (k, _, V) => {
152
+ const N = k.trim();
153
+ r.value = [], w.value = "", x.value = !!N, g.value = !!N;
154
+ const $ = U.getBusinessId();
155
+ if (!N || !$) {
156
+ g.value = !1;
157
+ return;
158
+ }
159
+ const T = new AbortController();
160
+ f = T;
161
+ const H = setTimeout(async () => {
162
+ try {
163
+ const F = await j.searchAccounts(
164
+ $,
165
+ { search: N },
166
+ T.signal
167
+ );
168
+ T.signal.aborted || (r.value = F);
169
+ } catch {
170
+ T.signal.aborted || (w.value = o("connect.whatsappBot.excludedAccounts.searchError"));
171
+ } finally {
172
+ T.signal.aborted || (g.value = !1);
173
+ }
174
+ }, 250);
175
+ V(() => {
176
+ clearTimeout(H), T.abort();
177
+ });
178
+ }), K(
179
+ () => u.addingId,
180
+ (k, _) => {
181
+ !k && _ && v(_) && m();
182
+ }
183
+ );
184
+ function y() {
185
+ if (g.value || !x.value) return;
186
+ const k = r.value[0];
187
+ k && a("select", k);
188
+ }
189
+ function p(k) {
190
+ k.currentTarget.contains(k.relatedTarget) || (x.value = !1);
191
+ }
192
+ function m() {
193
+ f == null || f.abort(), c.value = "", r.value = [], g.value = !1, w.value = "", x.value = !1;
194
+ }
195
+ return K(() => U.getBusinessId(), m), ae(m), (k, _) => {
196
+ const V = E("FmIcon"), N = E("FmCircularProgress");
197
+ return s(), d("div", {
198
+ class: "relative w-full max-w-[480px]",
199
+ onFocusout: p,
200
+ onKeydown: _[3] || (_[3] = ce(te(($) => x.value = !1, ["stop"]), ["esc"]))
201
+ }, [
202
+ t("div", Ce, [
203
+ S(V, {
204
+ name: "search",
205
+ size: "sm",
206
+ class: "pointer-events-none absolute left-[12px] text-fm-color-typo-tertiary",
207
+ "aria-hidden": "true"
208
+ }),
209
+ Z(t("input", {
210
+ "onUpdate:modelValue": _[0] || (_[0] = ($) => c.value = $),
211
+ type: "search",
212
+ autocomplete: "off",
213
+ maxlength: "100",
214
+ "aria-label": e(o)("connect.whatsappBot.excludedAccounts.searchPlaceholder"),
215
+ placeholder: e(o)("connect.whatsappBot.excludedAccounts.searchPlaceholder"),
216
+ disabled: l.loading || !!l.addingId,
217
+ class: "h-[40px] w-full rounded-[8px] border border-fm-color-neutral-gray-200 bg-fm-color-neutral-white pl-[36px] pr-[12px] text-[14px] outline-none transition-colors placeholder:text-fm-color-typo-tertiary focus:border-fm-color-primary focus:ring-[2px] focus:ring-fm-color-primary/30 disabled:opacity-50",
218
+ onFocus: _[1] || (_[1] = ($) => x.value = !!c.value.trim()),
219
+ onKeydown: ce(te(y, ["prevent"]), ["enter"])
220
+ }, null, 40, Pe), [
221
+ [ne, c.value]
222
+ ])
223
+ ]),
224
+ x.value && c.value.trim() ? (s(), d("div", Ve, [
225
+ g.value ? (s(), d("p", Ne, n(e(o)("connect.whatsappBot.excludedAccounts.searching")), 1)) : w.value ? (s(), d("p", Oe, n(w.value), 1)) : (s(), d(D, { key: 2 }, [
226
+ (s(!0), d(D, null, q(r.value, ($) => {
227
+ var T;
228
+ return s(), d("button", {
229
+ key: $.id,
230
+ type: "button",
231
+ disabled: !!l.addingId || !!l.removingId,
232
+ class: "flex min-h-[44px] items-center gap-[10px] rounded-[8px] px-[8px] py-[6px] text-left text-[14px] transition-colors hover:bg-fm-color-neutral-gray-100 focus-visible:outline-none focus-visible:ring-[2px] focus-visible:ring-fm-color-primary disabled:cursor-default disabled:hover:bg-transparent",
233
+ onMousedown: _[2] || (_[2] = te(() => {
234
+ }, ["prevent"])),
235
+ onClick: (H) => a("select", $)
236
+ }, [
237
+ t("span", De, n($.customerName.trim().slice(0, 2).toUpperCase() || "#"), 1),
238
+ t("span", Me, [
239
+ t("span", Ue, n($.customerName || $.phoneNumber || $.id), 1),
240
+ t("span", Le, n($.phoneNumber || e(o)("connect.whatsappBot.phoneUnavailable")), 1)
241
+ ]),
242
+ l.addingId === $.id || l.removingId === ((T = v($.id)) == null ? void 0 : T.id) ? (s(), O(N, {
243
+ key: 0,
244
+ size: "md"
245
+ })) : (s(), d("span", {
246
+ key: 1,
247
+ class: Y([
248
+ "shrink-0 text-[13px] font-semibold",
249
+ v($.id) ? "text-fm-color-typo-error" : "text-fm-color-primary"
250
+ ])
251
+ }, n(e(o)(
252
+ v($.id) ? "connect.common.remove" : "connect.whatsappBot.excludedAccounts.exclude"
253
+ )), 3))
254
+ ], 40, Re);
255
+ }), 128)),
256
+ r.value.length ? A("", !0) : (s(), d("p", We, n(e(o)("connect.whatsappBot.excludedAccounts.noMatches")), 1))
257
+ ], 64))
258
+ ])) : A("", !0)
259
+ ], 32);
260
+ };
261
+ }
262
+ }), Ke = { class: "overflow-x-auto" }, He = ["aria-label"], Ge = { 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" }, je = {
263
+ scope: "col",
264
+ class: "py-[10px] pl-[16px] pr-[8px] font-semibold"
265
+ }, Xe = {
266
+ scope: "col",
267
+ class: "px-[8px] py-[10px] font-semibold"
268
+ }, Je = {
269
+ scope: "col",
270
+ class: "px-[8px] py-[10px] font-semibold"
271
+ }, Qe = {
272
+ scope: "col",
273
+ class: "py-[10px] pl-[8px] pr-[16px]"
274
+ }, Ye = { class: "sr-only" }, Ze = { class: "text-[14px] leading-[20px]" }, qe = { class: "py-[8px] pl-[16px] pr-[8px] font-medium" }, et = ["title"], tt = { class: "px-[8px] py-[8px] text-fm-color-typo-secondary tabular-nums" }, ot = ["title"], lt = { class: "px-[8px] py-[8px] text-fm-color-typo-tertiary tabular-nums" }, nt = ["datetime", "title"], at = { class: "py-[8px] pl-[8px] pr-[16px]" }, st = ["aria-label", "disabled", "aria-busy", "onClick"], rt = { key: 1 }, pe = /* @__PURE__ */ M({
275
+ __name: "ExcludedAccountsTable",
276
+ props: {
277
+ accounts: {},
278
+ removingId: {},
279
+ disabled: { type: Boolean }
280
+ },
281
+ emits: ["remove"],
282
+ setup(l, { emit: i }) {
283
+ const u = i, { t: a, locale: o } = P();
284
+ function c(g) {
285
+ return g.customerName || g.phoneNumber || g.conversationId;
286
+ }
287
+ function r(g) {
288
+ return new Intl.DateTimeFormat(o.value, {
289
+ dateStyle: "medium",
290
+ timeStyle: "short"
291
+ }).format(new Date(g));
292
+ }
293
+ return (g, w) => {
294
+ const x = E("FmCircularProgress");
295
+ return s(), d("div", Ke, [
296
+ t("table", {
297
+ "aria-label": e(a)("connect.whatsappBot.excludedAccounts.title"),
298
+ class: "w-full min-w-[600px] table-fixed border-collapse text-left"
299
+ }, [
300
+ w[0] || (w[0] = t("colgroup", null, [
301
+ t("col", { class: "w-[30%]" }),
302
+ t("col", { class: "w-[25%]" }),
303
+ t("col"),
304
+ t("col", { class: "w-[116px]" })
305
+ ], -1)),
306
+ t("thead", Ge, [
307
+ t("tr", null, [
308
+ t("th", je, n(e(a)("connect.whatsappBot.excludedAccounts.name")), 1),
309
+ t("th", Xe, n(e(a)("connect.whatsappBot.excludedAccounts.phoneNumber")), 1),
310
+ t("th", Je, n(e(a)("connect.whatsappBot.excludedAccounts.excludedOn")), 1),
311
+ t("th", Qe, [
312
+ t("span", Ye, n(e(a)("connect.whatsappBot.excludedAccounts.actions")), 1)
313
+ ])
314
+ ])
315
+ ]),
316
+ t("tbody", Ze, [
317
+ (s(!0), d(D, null, q(l.accounts, (f) => (s(), d("tr", {
318
+ key: f.id,
319
+ class: "border-b border-fm-color-neutral-gray-100 last:border-b-0"
320
+ }, [
321
+ t("td", qe, [
322
+ t("span", {
323
+ class: "block truncate",
324
+ title: c(f)
325
+ }, n(c(f)), 9, et)
326
+ ]),
327
+ t("td", tt, [
328
+ t("span", {
329
+ class: "block truncate",
330
+ title: f.phoneNumber || e(a)("connect.whatsappBot.phoneUnavailable")
331
+ }, n(f.phoneNumber || e(a)("connect.whatsappBot.phoneUnavailable")), 9, ot)
332
+ ]),
333
+ t("td", lt, [
334
+ t("time", {
335
+ datetime: f.updatedAt,
336
+ title: r(f.updatedAt),
337
+ class: "block truncate"
338
+ }, n(r(f.updatedAt)), 9, nt)
339
+ ]),
340
+ t("td", at, [
341
+ t("button", {
342
+ type: "button",
343
+ "aria-label": e(a)("connect.whatsappBot.excludedAccounts.removeAccount", {
344
+ name: c(f)
345
+ }),
346
+ disabled: !!l.removingId || l.disabled,
347
+ "aria-busy": l.removingId === f.id,
348
+ 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",
349
+ onClick: (v) => u("remove", f)
350
+ }, [
351
+ l.removingId === f.id ? (s(), O(x, {
352
+ key: 0,
353
+ size: "md",
354
+ "aria-hidden": "true"
355
+ })) : (s(), d("span", rt, n(e(a)("connect.common.remove")), 1))
356
+ ], 8, st)
357
+ ])
358
+ ]))), 128))
359
+ ])
360
+ ], 8, He)
361
+ ]);
362
+ };
363
+ }
364
+ }), ct = {
365
+ key: 0,
366
+ class: "flex flex-col items-center gap-[12px] py-[32px] text-[14px] text-fm-color-typo-secondary"
367
+ }, it = {
368
+ key: 0,
369
+ class: "flex flex-wrap items-center gap-[12px]"
370
+ }, dt = {
371
+ role: "alert",
372
+ class: "text-[14px] text-fm-color-typo-error"
373
+ }, pt = {
374
+ key: 1,
375
+ class: "flex flex-col items-center gap-[6px] rounded-[16px] border border-fm-color-neutral-gray-200 px-[24px] py-[32px] text-center"
376
+ }, ut = { class: "text-[16px] leading-[24px] font-semibold" }, mt = { class: "max-w-[420px] text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, xt = {
377
+ key: 2,
378
+ class: "overflow-hidden rounded-[16px] border border-fm-color-neutral-gray-100 bg-fm-color-neutral-white"
379
+ }, ft = { class: "flex min-w-0 flex-col" }, vt = { class: "text-[18px] leading-[24px] font-semibold" }, gt = { class: "text-[14px] leading-[20px] text-fm-color-typo-tertiary" }, bt = {
380
+ key: 0,
381
+ role: "alert",
382
+ class: "mb-[12px] text-[14px] text-fm-color-typo-error"
383
+ }, ht = {
384
+ key: 1,
385
+ class: "px-[24px] py-[40px] text-center text-[14px] text-fm-color-typo-secondary"
386
+ }, yt = /* @__PURE__ */ M({
387
+ __name: "ExcludedAccountsList",
388
+ props: {
389
+ accounts: {},
390
+ loading: { type: Boolean },
391
+ error: {},
392
+ actionError: {},
393
+ addingId: {},
394
+ removingId: {}
395
+ },
396
+ emits: ["retry", "remove"],
397
+ setup(l, { emit: i }) {
398
+ const u = l, a = i, { t: o } = P(), c = B(!1), r = R(
399
+ () => [...u.accounts].sort((w, x) => x.updatedAt.localeCompare(w.updatedAt))
400
+ ), g = R(() => r.value.slice(0, 3));
401
+ return K(
402
+ () => U.getBusinessId(),
403
+ () => {
404
+ c.value = !1;
405
+ }
406
+ ), (w, x) => {
407
+ const f = E("FmCircularProgress"), v = E("FmButton"), y = E("FmIcon"), p = E("FmDialog");
408
+ return s(), d(D, null, [
409
+ l.loading ? (s(), d("output", ct, [
410
+ S(f),
411
+ L(" " + n(e(o)("connect.whatsappBot.excludedAccounts.loading")), 1)
412
+ ])) : (s(), d(D, { key: 1 }, [
413
+ l.error ? (s(), d("div", it, [
414
+ t("p", dt, n(l.error), 1),
415
+ S(v, {
416
+ variant: "secondary",
417
+ "border-color": "neutral-gray-200",
418
+ label: e(o)("connect.whatsappBot.tryAgain"),
419
+ "prepend-icon": "refresh",
420
+ class: "!rounded-full [&_.label]:text-[14px]",
421
+ onClick: x[0] || (x[0] = (m) => a("retry"))
422
+ }, null, 8, ["label"])
423
+ ])) : A("", !0),
424
+ !r.value.length && !l.error ? (s(), d("div", pt, [
425
+ t("h3", ut, n(e(o)("connect.whatsappBot.excludedAccounts.emptyTitle")), 1),
426
+ t("p", mt, n(e(o)("connect.whatsappBot.excludedAccounts.emptyDescription")), 1)
427
+ ])) : r.value.length ? (s(), d("div", xt, [
428
+ S(pe, {
429
+ accounts: g.value,
430
+ "removing-id": l.removingId,
431
+ disabled: !!l.addingId,
432
+ onRemove: x[1] || (x[1] = (m) => a("remove", m))
433
+ }, null, 8, ["accounts", "removing-id", "disabled"]),
434
+ r.value.length > g.value.length ? (s(), d("button", {
435
+ key: 0,
436
+ type: "button",
437
+ 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",
438
+ onClick: x[2] || (x[2] = (m) => c.value = !0)
439
+ }, [
440
+ L(n(e(o)("connect.whatsappBot.excludedAccounts.showAll", {
441
+ count: r.value.length
442
+ })) + " ", 1),
443
+ S(y, {
444
+ name: "chevron_right",
445
+ size: "sm",
446
+ "aria-hidden": "true"
447
+ })
448
+ ])) : A("", !0)
449
+ ])) : A("", !0)
450
+ ], 64)),
451
+ S(p, {
452
+ modelValue: c.value,
453
+ "onUpdate:modelValue": x[4] || (x[4] = (m) => c.value = m),
454
+ "min-width": "min(720px, calc(100% - 32px))",
455
+ "max-width": "720px",
456
+ "max-height": "90vh",
457
+ "dismiss-away": ""
458
+ }, {
459
+ "dialog-header": ie(() => [
460
+ t("div", ft, [
461
+ t("h2", vt, n(e(o)("connect.whatsappBot.excludedAccounts.title")), 1),
462
+ t("p", gt, n(e(o)("connect.whatsappBot.accountCount", r.value.length)), 1)
463
+ ])
464
+ ]),
465
+ default: ie(() => [
466
+ l.actionError ? (s(), d("p", bt, n(l.actionError), 1)) : A("", !0),
467
+ r.value.length ? (s(), O(pe, {
468
+ key: 2,
469
+ accounts: r.value,
470
+ "removing-id": l.removingId,
471
+ disabled: !!l.addingId,
472
+ onRemove: x[3] || (x[3] = (m) => a("remove", m))
473
+ }, null, 8, ["accounts", "removing-id", "disabled"])) : (s(), d("p", ht, n(e(o)("connect.whatsappBot.excludedAccounts.emptyTitle")), 1))
474
+ ]),
475
+ _: 1
476
+ }, 8, ["modelValue"])
477
+ ], 64);
478
+ };
479
+ }
480
+ }), wt = {
481
+ id: "whatsapp-excluded-accounts",
482
+ "aria-labelledby": "whatsapp-excluded-accounts-title",
483
+ class: "flex min-w-0 flex-col gap-[12px]"
484
+ }, _t = { class: "flex flex-col gap-[2px]" }, Bt = {
485
+ id: "whatsapp-excluded-accounts-title",
486
+ class: "text-[16px] leading-[24px] font-semibold"
487
+ }, kt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, $t = {
488
+ key: 0,
489
+ role: "alert",
490
+ class: "text-[14px] text-fm-color-typo-error"
491
+ }, At = /* @__PURE__ */ M({
492
+ __name: "ExcludedAccounts",
493
+ props: {
494
+ accounts: {},
495
+ loading: { type: Boolean },
496
+ error: {}
497
+ },
498
+ emits: ["retry", "added", "removed"],
499
+ setup(l, { emit: i }) {
500
+ const u = l, a = i, { t: o } = P(), {
501
+ addingId: c,
502
+ removingId: r,
503
+ actionError: g,
504
+ getExclusion: w,
505
+ excludeAccount: x,
506
+ removeExclusion: f
507
+ } = Fe({
508
+ accounts: () => u.accounts,
509
+ onAdded: (y) => a("added", y),
510
+ onRemoved: (y) => a("removed", y)
511
+ });
512
+ function v(y) {
513
+ const p = w(y.id);
514
+ p ? f(p) : x(y);
515
+ }
516
+ return (y, p) => (s(), d("section", wt, [
517
+ t("div", _t, [
518
+ t("h2", Bt, n(e(o)("connect.whatsappBot.excludedAccounts.title")), 1),
519
+ t("p", kt, n(e(o)("connect.whatsappBot.excludedAccounts.description")), 1)
520
+ ]),
521
+ S(ze, {
522
+ accounts: l.accounts,
523
+ loading: l.loading,
524
+ "adding-id": e(c),
525
+ "removing-id": e(r),
526
+ onSelect: v
527
+ }, null, 8, ["accounts", "loading", "adding-id", "removing-id"]),
528
+ e(g) ? (s(), d("p", $t, n(e(g)), 1)) : A("", !0),
529
+ S(yt, {
530
+ accounts: l.accounts,
531
+ loading: l.loading,
532
+ error: l.error,
533
+ "action-error": e(g),
534
+ "adding-id": e(c),
535
+ "removing-id": e(r),
536
+ onRetry: p[0] || (p[0] = (m) => a("retry")),
537
+ onRemove: e(f)
538
+ }, null, 8, ["accounts", "loading", "error", "action-error", "adding-id", "removing-id", "onRemove"])
539
+ ]));
540
+ }
541
+ }), St = {
542
+ "aria-labelledby": "knowledge-base-title",
543
+ class: "flex flex-col gap-[10px]"
544
+ }, It = { class: "flex flex-col gap-[2px]" }, Et = {
545
+ id: "knowledge-base-title",
546
+ class: "text-[16px] leading-[24px] font-semibold"
547
+ }, Tt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, Ft = { class: "flex flex-wrap gap-[8px]" }, Ct = ["title", "aria-expanded", "disabled", "onClick"], Pt = ["disabled"], Vt = {
548
+ key: 0,
549
+ class: "text-[14px] text-fm-color-typo-tertiary"
550
+ }, Nt = {
551
+ key: 1,
552
+ class: "text-[14px] text-fm-color-typo-secondary"
553
+ }, Ot = { class: "flex flex-col gap-[6px]" }, Rt = {
554
+ for: "whatsapp-knowledge-topic-description",
555
+ class: "text-[14px] leading-[20px] font-medium text-fm-color-typo-secondary"
556
+ }, Dt = ["placeholder", "maxlength", "disabled"], Mt = {
557
+ id: "whatsapp-knowledge-topic-description-count",
558
+ class: "text-right text-[12px] leading-[16px] text-fm-color-typo-tertiary tabular-nums"
559
+ }, Ut = /* @__PURE__ */ M({
560
+ __name: "KnowledgeBase",
561
+ props: /* @__PURE__ */ le({
562
+ disabled: { type: Boolean }
563
+ }, {
564
+ modelValue: {
565
+ required: !0
566
+ },
567
+ modelModifiers: {},
568
+ activeTopicIndex: {
569
+ required: !0
570
+ },
571
+ activeTopicIndexModifiers: {}
572
+ }),
573
+ emits: ["update:modelValue", "update:activeTopicIndex"],
574
+ setup(l) {
575
+ const i = l, u = Q(l, "modelValue"), a = Q(l, "activeTopicIndex"), { t: o } = P(), c = R(
576
+ () => a.value === null ? null : u.value[a.value]
577
+ );
578
+ function r() {
579
+ i.disabled || u.value.length >= X || (u.value.push({ title: "", description: "" }), a.value = u.value.length - 1);
580
+ }
581
+ function g() {
582
+ i.disabled || a.value === null || (u.value.splice(a.value, 1), a.value = null);
583
+ }
584
+ return (w, x) => {
585
+ const f = E("FmIcon"), v = E("FmTextField"), y = E("FmButton");
586
+ return s(), d("section", St, [
587
+ t("div", It, [
588
+ t("h2", Et, n(e(o)("connect.whatsappBot.botSettings.knowledgeBase.title")), 1),
589
+ t("p", Tt, n(e(o)("connect.whatsappBot.botSettings.knowledgeBase.description")), 1)
590
+ ]),
591
+ t("div", Ft, [
592
+ (s(!0), d(D, null, q(u.value, (p, m) => (s(), d("button", {
593
+ key: m,
594
+ type: "button",
595
+ title: p.title.trim() || e(o)("connect.whatsappBot.botSettings.knowledgeBase.untitled"),
596
+ "aria-expanded": a.value === m,
597
+ "aria-controls": "knowledge-topic-editor",
598
+ disabled: l.disabled,
599
+ class: Y(["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", [
600
+ a.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",
601
+ l.disabled ? "cursor-default" : "cursor-pointer hover:border-fm-color-primary"
602
+ ]]),
603
+ onClick: (k) => a.value = a.value === m ? null : m
604
+ }, n(p.title.trim() || e(o)("connect.whatsappBot.botSettings.knowledgeBase.untitled")), 11, Ct))), 128)),
605
+ t("button", {
606
+ type: "button",
607
+ disabled: l.disabled || u.value.length >= e(X),
608
+ 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",
609
+ onClick: r
610
+ }, [
611
+ S(f, {
612
+ name: "add",
613
+ size: "sm"
614
+ }),
615
+ L(" " + n(e(o)("connect.whatsappBot.botSettings.knowledgeBase.addTopic")), 1)
616
+ ], 8, Pt)
617
+ ]),
618
+ u.value.length === 0 ? (s(), d("p", Vt, n(e(o)("connect.whatsappBot.botSettings.knowledgeBase.empty")), 1)) : A("", !0),
619
+ u.value.length >= e(X) ? (s(), d("p", Nt, n(e(o)("connect.whatsappBot.botSettings.knowledgeBase.topicLimit", {
620
+ count: e(X)
621
+ })), 1)) : A("", !0),
622
+ c.value ? (s(), d("div", {
623
+ id: "knowledge-topic-editor",
624
+ key: a.value ?? void 0,
625
+ class: "rounded-[8px] border-[1px] border-fm-color-neutral-gray-100 p-[16px] flex flex-col gap-[10px]"
626
+ }, [
627
+ S(v, {
628
+ modelValue: c.value.title,
629
+ "onUpdate:modelValue": x[0] || (x[0] = (p) => c.value.title = p),
630
+ label: e(o)("connect.whatsappBot.botSettings.knowledgeBase.titleLabel"),
631
+ placeholder: e(o)("connect.whatsappBot.botSettings.knowledgeBase.titlePlaceholder"),
632
+ "max-length": e(he),
633
+ disabled: l.disabled
634
+ }, null, 8, ["modelValue", "label", "placeholder", "max-length", "disabled"]),
635
+ t("div", Ot, [
636
+ t("label", Rt, n(e(o)("connect.whatsappBot.botSettings.knowledgeBase.descriptionLabel")), 1),
637
+ Z(t("textarea", {
638
+ id: "whatsapp-knowledge-topic-description",
639
+ "onUpdate:modelValue": x[1] || (x[1] = (p) => c.value.description = p),
640
+ "aria-describedby": "whatsapp-knowledge-topic-description-count",
641
+ placeholder: e(o)(
642
+ "connect.whatsappBot.botSettings.knowledgeBase.descriptionPlaceholder"
643
+ ),
644
+ maxlength: e(de),
645
+ disabled: l.disabled,
646
+ rows: "5",
647
+ 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"
648
+ }, null, 8, Dt), [
649
+ [ne, c.value.description]
650
+ ]),
651
+ t("p", Mt, n(c.value.description.length) + " / " + n(e(de)), 1)
652
+ ]),
653
+ S(y, {
654
+ variant: "plain",
655
+ size: "sm",
656
+ "prepend-icon": "delete",
657
+ "text-color": "typo-error",
658
+ label: e(o)("connect.whatsappBot.botSettings.knowledgeBase.removeTopic"),
659
+ disabled: l.disabled,
660
+ class: "self-start",
661
+ onClick: g
662
+ }, null, 8, ["label", "disabled"])
663
+ ])) : A("", !0)
664
+ ]);
665
+ };
666
+ }
667
+ }), Lt = {
668
+ "aria-labelledby": "response-speed-title",
669
+ class: "flex flex-col gap-[12px]"
670
+ }, Wt = { class: "flex flex-col gap-[2px]" }, zt = {
671
+ id: "response-speed-title",
672
+ class: "text-[16px] leading-[24px] font-semibold"
673
+ }, Kt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary [text-wrap:pretty]" }, Ht = {
674
+ role: "radiogroup",
675
+ "aria-labelledby": "response-speed-title",
676
+ "aria-describedby": "response-speed-detail",
677
+ class: "grid grid-cols-[repeat(auto-fit,minmax(150px,1fr))] gap-[8px]"
678
+ }, Gt = ["value", "disabled"], jt = { class: "flex items-center gap-[8px] text-[14px] leading-[20px] font-semibold" }, Xt = {
679
+ key: 0,
680
+ class: "w-[8px] h-[8px] rounded-full bg-fm-color-primary"
681
+ }, Jt = { class: "text-[12px] leading-[16px] text-fm-color-typo-secondary" }, Qt = {
682
+ id: "response-speed-detail",
683
+ "aria-live": "polite",
684
+ class: "text-[14px] leading-[20px] text-fm-color-typo-secondary"
685
+ }, Yt = {
686
+ key: 0,
687
+ class: "rounded-[8px] bg-fm-color-system-warning-100 px-[12px] py-[10px] flex items-start gap-[10px] text-[14px] leading-[20px]"
688
+ }, Zt = /* @__PURE__ */ M({
689
+ __name: "ResponseSpeed",
690
+ props: /* @__PURE__ */ le({
691
+ disabled: { type: Boolean }
692
+ }, {
693
+ modelValue: {
694
+ required: !0
695
+ },
696
+ modelModifiers: {}
697
+ }),
698
+ emits: ["update:modelValue"],
699
+ setup(l) {
700
+ const i = Q(l, "modelValue"), { t: u } = P();
701
+ return (a, o) => {
702
+ const c = E("FmIcon");
703
+ return s(), d("section", Lt, [
704
+ t("div", Wt, [
705
+ t("h2", zt, n(e(u)("connect.whatsappBot.botSettings.responseSpeed.title")), 1),
706
+ t("p", Kt, n(e(u)("connect.whatsappBot.botSettings.responseSpeed.description")), 1)
707
+ ]),
708
+ t("div", Ht, [
709
+ (s(!0), d(D, null, q(e(ye), (r) => (s(), d("label", { key: r }, [
710
+ Z(t("input", {
711
+ "onUpdate:modelValue": o[0] || (o[0] = (g) => i.value = g),
712
+ type: "radio",
713
+ name: "response-speed",
714
+ value: r,
715
+ disabled: l.disabled,
716
+ class: "sr-only peer"
717
+ }, null, 8, Gt), [
718
+ [be, i.value]
719
+ ]),
720
+ t("span", {
721
+ class: Y(["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", [
722
+ i.value === r ? "border-fm-color-primary bg-fm-color-primary-oats" : "border-fm-color-neutral-gray-200 bg-fm-color-neutral-white",
723
+ l.disabled ? "cursor-default opacity-60" : "cursor-pointer hover:border-fm-color-primary"
724
+ ]])
725
+ }, [
726
+ t("span", jt, [
727
+ t("span", {
728
+ "aria-hidden": "true",
729
+ class: Y([
730
+ "w-[16px] h-[16px] shrink-0 rounded-full border-[1.5px] bg-fm-color-neutral-white flex items-center justify-center",
731
+ i.value === r ? "border-fm-color-primary" : "border-fm-color-neutral-gray-300"
732
+ ])
733
+ }, [
734
+ i.value === r ? (s(), d("span", Xt)) : A("", !0)
735
+ ], 2),
736
+ L(" " + n(e(u)(`connect.whatsappBot.botSettings.responseSpeed.${r}.label`)), 1)
737
+ ]),
738
+ t("span", Jt, n(e(u)(`connect.whatsappBot.botSettings.responseSpeed.${r}.hint`)), 1)
739
+ ], 2)
740
+ ]))), 128))
741
+ ]),
742
+ t("p", Qt, n(e(u)(
743
+ `connect.whatsappBot.botSettings.responseSpeed.${i.value}.detail`
744
+ )), 1),
745
+ i.value === "immediate" ? (s(), d("div", Yt, [
746
+ S(c, {
747
+ name: "warning",
748
+ size: "sm",
749
+ class: "mt-[2px] shrink-0 text-fm-color-typo-warning"
750
+ }),
751
+ L(" " + n(e(u)("connect.whatsappBot.botSettings.responseSpeed.immediateWarning")), 1)
752
+ ])) : A("", !0)
753
+ ]);
754
+ };
755
+ }
756
+ }), qt = { class: "mt-[20px] mx-auto w-full min-w-0 flex flex-col gap-[20px]" }, eo = {
757
+ key: 0,
758
+ class: "py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
759
+ }, to = { class: "border-t border-fm-color-neutral-gray-100 pt-[20px]" }, oo = { class: "group border-t border-fm-color-neutral-gray-100 pt-[12px]" }, lo = { 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" }, no = { class: "mt-[20px] flex flex-col gap-[20px]" }, ao = {
760
+ key: 1,
761
+ role: "alert",
762
+ class: "text-[14px] text-fm-color-typo-error"
763
+ }, so = { class: "flex items-center justify-end gap-[12px] flex-wrap" }, fo = /* @__PURE__ */ M({
764
+ __name: "WhatsappBotSettings",
765
+ setup(l) {
766
+ const { t: i } = P(), u = ue(), a = R(() => U.getBusinessId() ?? ""), o = B(""), c = B(""), r = B([]), g = B([]), w = B(null), x = R(
767
+ () => r.value.filter(
768
+ (b) => b.title.trim() || b.description.trim()
769
+ )
770
+ ), f = B(
771
+ J
772
+ ), v = B(
773
+ J
774
+ ), y = B(!0), p = B(!1), m = B(!1), k = B(""), _ = B([]), V = B(""), N = oe, $ = R(
775
+ () => o.value !== c.value || f.value !== v.value || JSON.stringify(r.value) !== JSON.stringify(g.value)
776
+ ), T = R(
777
+ () => !p.value || m.value || !$.value
778
+ ), H = R(
779
+ () => !p.value || m.value || o.value.length > N || !we.safeParse(x.value).success
780
+ );
781
+ let F, G;
782
+ function se(b) {
783
+ _.value = b.excludedAccounts, o.value = b.botInstructions, c.value = b.botInstructions, f.value = b.responseSpeed, v.value = b.responseSpeed, r.value = b.knowledgeBase.map((h) => ({ ...h })), g.value = b.knowledgeBase.map((h) => ({
784
+ ...h
785
+ }));
786
+ }
787
+ function me(b, h) {
788
+ const I = b instanceof Error ? b.message : i("connect.whatsappBot.errors.loadSettings");
789
+ h ? V.value = I : k.value = I;
790
+ }
791
+ async function W(b = !1) {
792
+ if (b && m.value) return;
793
+ clearTimeout(G), F == null || F.abort();
794
+ const h = new AbortController();
795
+ F = h, b || (y.value = !0, p.value = !1, m.value = !1, k.value = "", o.value = "", c.value = "", f.value = J, v.value = J, r.value = [], g.value = [], w.value = null, _.value = [], V.value = "");
796
+ try {
797
+ if (!a.value)
798
+ throw new Error(i("connect.whatsappBot.errors.selectBusiness"));
799
+ const I = await j.getSettings(
800
+ a.value,
801
+ h.signal
802
+ );
803
+ if (h.signal.aborted) return;
804
+ _.value = I.excludedAccounts, V.value = "", b || (se(I), p.value = !0);
805
+ } catch (I) {
806
+ h.signal.aborted || me(I, b);
807
+ } finally {
808
+ h.signal.aborted || (y.value = !1, p.value && re());
809
+ }
810
+ }
811
+ function re() {
812
+ clearTimeout(G), G = setTimeout(() => void W(!0), 1e4);
813
+ }
814
+ function xe(b) {
815
+ _.value = _.value.filter(
816
+ (h) => h.id !== b
817
+ ), W(!0);
818
+ }
819
+ function fe(b) {
820
+ _.value = b, W(!0);
821
+ }
822
+ async function ve() {
823
+ if (H.value) return;
824
+ clearTimeout(G), F == null || F.abort();
825
+ const b = new AbortController();
826
+ F = b, m.value = !0, k.value = "";
827
+ const h = w.value === null ? void 0 : r.value[w.value], I = h ? x.value.indexOf(h) : -1;
828
+ try {
829
+ const z = await j.saveSettings(
830
+ a.value,
831
+ {
832
+ botInstructions: o.value,
833
+ responseSpeed: f.value,
834
+ knowledgeBase: x.value
835
+ },
836
+ b.signal
837
+ );
838
+ if (b.signal.aborted) return;
839
+ se(z), w.value = I < 0 ? null : I, u.open({
840
+ type: "success",
841
+ message: i("connect.whatsappBot.botSettings.saved")
842
+ });
843
+ } catch (z) {
844
+ b.signal.aborted || (k.value = z instanceof Error ? z.message : i("connect.whatsappBot.errors.saveSettings"), u.open({ type: "error", message: k.value }));
845
+ } finally {
846
+ b.signal.aborted || (m.value = !1, re());
847
+ }
848
+ }
849
+ async function ge() {
850
+ if (T.value) return;
851
+ const b = a.value;
852
+ !await _e.confirm(
853
+ i("connect.whatsappBot.botSettings.discardChangesMessage"),
854
+ i("connect.whatsappBot.botSettings.discardChangesTitle"),
855
+ i("connect.common.confirm"),
856
+ i("connect.common.cancel")
857
+ ) || T.value || a.value !== b || (o.value = c.value, f.value = v.value, r.value = g.value.map((I) => ({ ...I })), w.value = null);
858
+ }
859
+ return K(a, () => void W(), { immediate: !0 }), ae(() => {
860
+ F == null || F.abort(), clearTimeout(G);
861
+ }), (b, h) => {
862
+ const I = E("FmCircularProgress"), z = E("FmIcon"), ee = E("FmButton");
863
+ return s(), d("div", qt, [
864
+ y.value ? (s(), d("output", eo, [
865
+ S(I),
866
+ L(" " + n(e(i)("connect.whatsappBot.botSettings.loading")), 1)
867
+ ])) : (s(), d(D, { key: 1 }, [
868
+ p.value ? (s(), O(Te, {
869
+ key: 0,
870
+ modelValue: o.value,
871
+ "onUpdate:modelValue": h[0] || (h[0] = (C) => o.value = C),
872
+ disabled: m.value
873
+ }, null, 8, ["modelValue", "disabled"])) : A("", !0),
874
+ t("div", to, [
875
+ p.value ? (s(), O(At, {
876
+ key: 0,
877
+ accounts: _.value,
878
+ loading: !1,
879
+ error: V.value,
880
+ onRetry: h[1] || (h[1] = (C) => W(!0)),
881
+ onAdded: fe,
882
+ onRemoved: xe
883
+ }, null, 8, ["accounts", "error"])) : A("", !0)
884
+ ]),
885
+ t("details", oo, [
886
+ t("summary", lo, [
887
+ L(n(e(i)("connect.whatsappBot.botSettings.advancedSettings")) + " ", 1),
888
+ S(z, {
889
+ name: "keyboard_arrow_down",
890
+ size: "sm",
891
+ class: "transition-transform group-open:rotate-180 motion-reduce:transition-none",
892
+ "aria-hidden": "true"
893
+ })
894
+ ]),
895
+ t("div", no, [
896
+ p.value ? (s(), O(Ut, {
897
+ key: 0,
898
+ modelValue: r.value,
899
+ "onUpdate:modelValue": h[2] || (h[2] = (C) => r.value = C),
900
+ "active-topic-index": w.value,
901
+ "onUpdate:activeTopicIndex": h[3] || (h[3] = (C) => w.value = C),
902
+ disabled: m.value
903
+ }, null, 8, ["modelValue", "active-topic-index", "disabled"])) : A("", !0),
904
+ p.value ? (s(), O(Zt, {
905
+ key: 1,
906
+ modelValue: f.value,
907
+ "onUpdate:modelValue": h[4] || (h[4] = (C) => f.value = C),
908
+ disabled: m.value,
909
+ class: "border-t border-fm-color-neutral-gray-100 pt-[20px]"
910
+ }, null, 8, ["modelValue", "disabled"])) : A("", !0)
911
+ ])
912
+ ]),
913
+ k.value ? (s(), d("p", ao, n(k.value), 1)) : A("", !0),
914
+ p.value ? A("", !0) : (s(), O(ee, {
915
+ key: 2,
916
+ class: "self-start !rounded-full [&_.label]:text-[14px]",
917
+ label: e(i)("connect.whatsappBot.tryAgain"),
918
+ "prepend-icon": "refresh",
919
+ onClick: h[5] || (h[5] = (C) => W())
920
+ }, null, 8, ["label"])),
921
+ t("div", so, [
922
+ S(ee, {
923
+ variant: "secondary",
924
+ "border-color": "neutral-gray-200",
925
+ label: e(i)("connect.common.cancel"),
926
+ disabled: T.value,
927
+ class: "!rounded-full !px-[20px] [&_.label]:text-[14px]",
928
+ onClick: ge
929
+ }, null, 8, ["label", "disabled"]),
930
+ S(ee, {
931
+ label: e(i)("connect.common.save"),
932
+ disabled: H.value,
933
+ loading: m.value,
934
+ class: "!rounded-full !px-[20px] [&_.label]:text-[14px]",
935
+ onClick: ve
936
+ }, null, 8, ["label", "disabled", "loading"])
937
+ ])
938
+ ], 64))
939
+ ]);
940
+ };
941
+ }
942
+ });
943
+ export {
944
+ fo as default
945
+ };