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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/{App-B_Yp6cvN.js → App-DRHHPaMz.js} +216 -224
  2. package/dist/{Bin-CmIpEIwe.js → Bin-FkcYLSTm.js} +8 -8
  3. package/dist/{Broadcast-DkV4BdU_.js → Broadcast-Cgqp_BMa.js} +21 -22
  4. package/dist/{CampaignAnalytic-Dkwo_lpB.js → CampaignAnalytic-kKZ_BwW0.js} +7 -7
  5. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Ch8Gblw6.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-CX0mWLjO.js} +10 -9
  6. package/dist/{Card-DXCkG34M.js → Card-Bu1y37hV.js} +23 -23
  7. package/dist/{Collections-CybPfSO4.js → Collections-B3mJkBCT.js} +185 -197
  8. package/dist/{Credit-B-KUzWsX.js → Credit-Bn-2EcVy.js} +20 -21
  9. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CWHYeYVD.js → DateRangeChip.vue_vue_type_script_setup_true_lang-Cz7pZ7LD.js} +1 -1
  10. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-DIUEjCFW.js +3638 -0
  11. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-nMcH6y5e.js → EffectSheet.vue_vue_type_style_index_0_lang-B7XBiv4l.js} +33 -33
  12. package/dist/{Experience-Q2NHpa-V.js → Experience-CunbmoAu.js} +31 -32
  13. package/dist/{FileSaver.min-CKw2rn-J.js → FileSaver.min-ChFSxYyS.js} +1 -1
  14. package/dist/{Game-lZvkg04z.js → Game-dFDwx_UJ.js} +18 -19
  15. package/dist/{GiftCardSetup-CPRju80_.js → GiftCardSetup-DYpEqqX0.js} +31 -31
  16. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-Ci686UoB.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-DxJdI6gc.js} +7 -7
  17. package/dist/{Goals-asGsUeVv.js → Goals-DuZzgM_K.js} +4 -4
  18. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-nk87zPWH.js → ImageInput.vue_vue_type_script_setup_true_lang-lDulspkF.js} +1 -1
  19. package/dist/{Index-DIasPS4Y.js → Index-BxB2ohT0.js} +10 -10
  20. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-DkOn8p1v.js → LocationPicker.vue_vue_type_script_setup_true_lang-9sKJE1A5.js} +1 -1
  21. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-BdSkxiP-.js → LottieAnimation.vue_vue_type_script_setup_true_lang-CxBNYzcz.js} +1 -1
  22. package/dist/{LoyaltyDashboard-DlCsZ3YX.js → LoyaltyDashboard-DQzGvQ7j.js} +15 -15
  23. package/dist/{MainLayout-DLObnTAA.js → MainLayout-MAZ1S06H.js} +1 -1
  24. package/dist/{MainLayout.vue_vue_type_script_setup_true_lang-DigSZKt1.js → MainLayout.vue_vue_type_script_setup_true_lang-CeF3LU-N.js} +3 -3
  25. package/dist/{Marketing-JflPW-w9.js → Marketing-ACF6F7be.js} +4 -4
  26. package/dist/{MarketingMaterialEdit-fSAB3YVb.js → MarketingMaterialEdit-B8NfkoHg.js} +211 -214
  27. package/dist/{Member-CzNahXTj.js → Member-rLxDUOr8.js} +7 -7
  28. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-bqWUIbMG.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-Bq3UKX7v.js} +48 -40
  29. package/dist/{MemberImportHistory--r_A_2Es.js → MemberImportHistory-BuG6DmdV.js} +7 -7
  30. package/dist/{MemberList-CQZQ4sN8.js → MemberList-CC6zm_I6.js} +105 -103
  31. package/dist/{MemberTransactions-BPg9JaUA.js → MemberTransactions-Bw2xu6jZ.js} +1 -1
  32. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BhIFChx-.js → MessageInput.vue_vue_type_script_setup_true_lang-Cav8gQUK.js} +12 -12
  33. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CdGSNqEp.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-8wdY4FnI.js} +1 -1
  34. package/dist/{Mission-CYCB3YQc.js → Mission-DnEcbALs.js} +21 -22
  35. package/dist/{Overview-DuNuUYYq.js → Overview-COytI5xN.js} +21 -21
  36. package/dist/{Overview-B5ylMBHT.js → Overview-DShFohlk.js} +144 -145
  37. package/dist/{Point-DG-Uwj25.js → Point-CWYwlx0i.js} +21 -22
  38. package/dist/{Promotion-DqxBQ1yO.js → Promotion-LBrQYtad.js} +131 -137
  39. package/dist/{Queue-Cy8LGt_Y.js → Queue-DKg5EvDM.js} +46 -46
  40. package/dist/{Record-CzXbu41w.js → Record--lYpawLN.js} +9 -9
  41. package/dist/{Review-7VL6gIqp.js → Review-C4pNmJ7n.js} +2 -2
  42. package/dist/ReviewFacebookCallback-BYXwKQNG.js +238 -0
  43. package/dist/{ReviewGoogleCallback-1JXR_f5O.js → ReviewGoogleCallback-ge8fL_A-.js} +5 -5
  44. package/dist/{Reward-BKhUDEu3.js → Reward-B67r1Bpz.js} +16 -16
  45. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DjjCytWF.js → RewardGroup.vue_vue_type_script_setup_true_lang-Bt0Kx2--.js} +14 -14
  46. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-fLtn32Rw.js +1884 -0
  47. package/dist/{Segment-DdHDJhaS.js → Segment-DeSC3z5G.js} +307 -304
  48. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-9kGUkHMi.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-DdjC7X1V.js} +15 -15
  49. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-DeFw0px7.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-Crys59UO.js} +4 -4
  50. package/dist/{Setting-DZKGXw-i.js → Setting-DiDcMU5E.js} +17 -17
  51. package/dist/{SettingAdvertisements-BBNs8tCw.js → SettingAdvertisements-3wMI9egH.js} +12 -12
  52. package/dist/Settings-BR6Y1DBZ.js +179 -0
  53. package/dist/{Store-C8IlE4IH.js → Store-DgefqByH.js} +29 -29
  54. package/dist/{StoreRewards-DWygRLR1.js → StoreRewards-CS2h5RVB.js} +15 -15
  55. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-CeYYws6P.js → StoreTransactions.vue_vue_type_script_setup_true_lang-gPR8sn4k.js} +25 -25
  56. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-Cjnkpd1j.js +142 -0
  57. package/dist/{Tier-7RoxGHsP.js → Tier-Cye6888q.js} +688 -2583
  58. package/dist/{Title-0q2Z4HIe.js → Title-B1eJh5oy.js} +95 -96
  59. package/dist/{Transaction-CFasERdg.js → Transaction-ouzdsBUx.js} +2 -2
  60. package/dist/{Upselling-DM9R6pYw.js → Upselling-CdQd2Fuk.js} +3 -3
  61. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-BDjwcgnc.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-BSlxe1Hf.js} +26 -26
  62. package/dist/{Voucher-BkzW2hVV.js → Voucher-CJJt8VlJ.js} +19 -19
  63. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DaE4xa3x.js → VoucherEditor.vue_vue_type_script_setup_true_lang-BzbNaK6H.js} +12 -12
  64. package/dist/{WhatsappAccount-C3WpDF9O.js → WhatsappAccount-DIxSP6Tp.js} +6 -6
  65. package/dist/{WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-BxC_3h52.js → WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-L9Y5lAft.js} +1 -1
  66. package/dist/{WhatsappBot-DZb-Dn3s.js → WhatsappBot-BXxoaz7-.js} +6 -6
  67. package/dist/{WhatsappBotLogs--KskC32Z.js → WhatsappBotLogs-D8IfLHk3.js} +6 -6
  68. package/dist/WhatsappBotSettings-Bq9C7pNZ.js +704 -0
  69. package/dist/{WhatsappLayout-NIrFGbId.js → WhatsappLayout-3rWwmGRd.js} +3 -3
  70. package/dist/{WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-BfD5hHc7.js → WhatsappNotificationGroupDialog.vue_vue_type_script_setup_true_lang-C3N-loYJ.js} +3 -3
  71. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-CJGxy7gf.js → ZodTextField.vue_vue_type_script_setup_true_lang-D1dORvMi.js} +2 -2
  72. package/dist/{app-B9nLnoBt.js → app-BXqas0p1.js} +3386 -4174
  73. package/dist/app.js +3 -4
  74. package/dist/{base.export-CBzNea0v.js → base.export-DQCZiS2E.js} +2 -2
  75. package/dist/{business-aT2zslwu.js → business-RsRhXSh8.js} +1 -1
  76. package/dist/{campaign-BDCLKFwN.js → campaign-C2X6aa7B.js} +25 -31
  77. package/dist/{campaign-B6nTwt17.js → campaign-DASPASQ0.js} +113 -126
  78. package/dist/{campaign.enum-Dx-Zo68Q.js → campaign.enum-BqekIiiN.js} +1 -2
  79. package/dist/campaign.fn-BEX99lsa.js +776 -0
  80. package/dist/{collection.fn-CDna_VLD.js → collection.fn-C7jNdh0A.js} +2 -2
  81. package/dist/{currency-Baum67Wz.js → currency-BvBM_Io9.js} +1 -1
  82. package/dist/{effect-CeJbflOK.js → effect-BA1yh6Mj.js} +1 -1
  83. package/dist/{email-addresses-Y3vF73J0.js → email-addresses-haS5P7hq.js} +2 -2
  84. package/dist/{feature-flag-zn6Ql9tv.js → feature-flag-B4bJnuei.js} +84 -84
  85. package/dist/google-C3S8u0mT.js +4 -0
  86. package/dist/{helper-DZvnn-yx.js → helper-BtTBvFuA.js} +1 -1
  87. package/dist/{index-CMs3aIA6.js → index-B1dAoOWi.js} +6 -19
  88. package/dist/{index-DXyOBtgF.js → index-B6A6sHpy.js} +1 -1
  89. package/dist/{index-B22ojkMy.js → index-BRTy6G9c.js} +2 -2
  90. package/dist/{index-r_T5o_hF.js → index-BV-YiCDM.js} +2 -2
  91. package/dist/{index-DJIt5tXC.js → index-BvFq5REc.js} +7 -7
  92. package/dist/{index-FgM7b2Sw.js → index-C2rjmdar.js} +2 -2
  93. package/dist/{index-DXKJsqgW.js → index-C7UBk5gq.js} +13 -31
  94. package/dist/{index-BqniSMV6.js → index-CBfVFFME.js} +197 -197
  95. package/dist/{index-B3LCTMwV.js → index-CH-uRaZH.js} +41 -52
  96. package/dist/{index-juXxYQ_a.js → index-CJ-BZCvB.js} +1242 -1314
  97. package/dist/{index-B5H4znfe.js → index-CXznvd79.js} +4 -4
  98. package/dist/{index-Da0-7h2j.js → index-ChGZ_S3V.js} +1 -1
  99. package/dist/{index-DCR1GFCA.js → index-D-D0s8PB.js} +234 -380
  100. package/dist/{index-BL2zQnXK.js → index-D9zjHXFU.js} +3 -3
  101. package/dist/{index-CPi3Qwmj.js → index-DAtVp1NI.js} +2613 -2699
  102. package/dist/{index-DkBOM8za.js → index-DeomfIu9.js} +251 -608
  103. package/dist/{index-DHNhIloU.js → index-Dg972Dfv.js} +1 -1
  104. package/dist/{index-BYUEPfbP.js → index-Dm2Dvxph.js} +23 -23
  105. package/dist/{index-njg4JLa-.js → index-DtbR7I4C.js} +9 -9
  106. package/dist/{index-B20FfbEE.js → index-Q-iHraJ3.js} +1 -1
  107. package/dist/{index-CDRTiAEu.js → index-g_SHjVWE.js} +1 -1
  108. package/dist/{index.esm2017-Dtk7BscN.js → index.esm2017-B7iE1Ggr.js} +93 -93
  109. package/dist/{loading-PoODMkQD.js → loading-BvlSfSVK.js} +1 -1
  110. package/dist/{lodash-TthNgH98.js → lodash-Daey2k0N.js} +1 -1
  111. package/dist/{member-import-D7zs0Jvh.js → member-import-CF9aym_y.js} +1 -1
  112. package/dist/{membership-Cab-iWQ1.js → membership-DfG-fl80.js} +2 -2
  113. package/dist/{money-9Q306M3g.js → money-SBIQhxqf.js} +1 -1
  114. package/dist/{number-D9M3D435.js → number-Cp1bFK9U.js} +1 -1
  115. package/dist/objectid-BMRA1fIL.js +145 -0
  116. package/dist/{onboarding-D5LKUHVI.js → onboarding-bjc7C8O-.js} +25 -25
  117. package/dist/{onboardingSetup-D0jsS6w5.js → onboardingSetup-BAu9TDI6.js} +2 -2
  118. package/dist/{plugins-CDTKQ1Pg.js → plugins-Def73Eyk.js} +3 -3
  119. package/dist/{reward-De3e9vYS.js → reward-KecVeztH.js} +1 -1
  120. package/dist/rule-builder-DgU6P24U.js +102 -0
  121. package/dist/{rule-trVJgEOe.js → rule-kMIC0vOi.js} +492 -572
  122. package/dist/style.css +1 -1
  123. package/dist/template-BH9vS8A9.js +275 -0
  124. package/dist/{timezone-DkuByUmb.js → timezone-CMX1sJ0a.js} +1 -1
  125. package/dist/{transaction.fn-CPE-oQhA.js → transaction.fn-Bjy5utxD.js} +2 -2
  126. package/dist/{trigger-C6oM-8pe.js → trigger-DnnOJVUi.js} +9 -9
  127. package/dist/{useMarketingMaterialActions-C5scdJQp.js → useMarketingMaterialActions-DMrNOpok.js} +4 -4
  128. package/dist/{usePagination-CIuTHSSG.js → usePagination-BCY4a-dh.js} +1 -1
  129. package/dist/{user-Bdlgn2yo.js → user-BTc0S1Vx.js} +1 -1
  130. package/dist/vue-i18n-7BKLPLxj.js +2365 -0
  131. package/dist/{xlsx-CvecxUOG.js → xlsx-DR5oLrEs.js} +1 -1
  132. package/dist/{zod-bniyeWdY.js → zod-CMq39HWn.js} +1 -1
  133. package/package.json +2 -6
  134. package/dist/AuditLogs-C1U17evK.js +0 -2016
  135. package/dist/EditCampaignSheet.vue_vue_type_script_setup_true_lang-C86llTFR.js +0 -4439
  136. package/dist/Grab-BjFLSMpE.js +0 -301
  137. package/dist/ReviewFacebookCallback-BwzuPmrz.js +0 -225
  138. package/dist/RuleGroup.vue_vue_type_script_setup_true_lang-Vg7pRGIz.js +0 -1923
  139. package/dist/Settings-9v0hnBJZ.js +0 -286
  140. package/dist/TargetLocationInput.vue_vue_type_script_setup_true_lang-BiN3uRJ_.js +0 -7007
  141. package/dist/WhatsappBotSettings-Dns_PqVE.js +0 -945
  142. package/dist/campaign.fn-Ck1t5C1T.js +0 -776
  143. package/dist/duplicateCampaign-BwrMZgaV.js +0 -51
  144. package/dist/google-BQK68wbe.js +0 -5
  145. package/dist/objectid-DKvQl6FD.js +0 -145
  146. package/dist/template-Bj3Tb6bP.js +0 -227
  147. package/dist/vue-i18n-DEpDI-dt.js +0 -2365
@@ -1,945 +0,0 @@
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
- };