@feedmepos/mf-connect 0.1.98-beta.76 → 0.1.98-beta.78

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 (127) hide show
  1. package/dist/{App-BpNFuouR.js → App-Ddo6B0cR.js} +9 -9
  2. package/dist/{AuditLogs-D7vTaaiU.js → AuditLogs-CTW4pKS6.js} +13 -13
  3. package/dist/{Bin-BDo0Vi0U.js → Bin-54ynGToX.js} +8 -8
  4. package/dist/{Broadcast-Ctz8bCnt.js → Broadcast-Bwnrmqhh.js} +12 -12
  5. package/dist/{CampaignAnalytic-BnxmzdYI.js → CampaignAnalytic-Q_IRT5AD.js} +7 -7
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-Bt2T2jVi.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-BioWaVBq.js} +8 -8
  7. package/dist/{Card-D9pYLwUX.js → Card-DVfhElpd.js} +23 -23
  8. package/dist/{Collections-BP7_jYJY.js → Collections-D1ncD8Mx.js} +8 -8
  9. package/dist/{Credit-D-3Ri1fe.js → Credit-DXPNdUJ_.js} +12 -12
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-D2k77nhT.js → DateRangeChip.vue_vue_type_script_setup_true_lang-DiR_5MgW.js} +1 -1
  11. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-FjKUID8K.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-wfV6zhMB.js} +35 -35
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-tfDnADgu.js → EffectSheet.vue_vue_type_style_index_0_lang-NqbdAsJM.js} +6 -6
  13. package/dist/{Experience-CZMQLMe1.js → Experience-B-ksR_d_.js} +13 -13
  14. package/dist/{FileSaver.min-_0SQsF4z.js → FileSaver.min-DcsYCTzs.js} +1 -1
  15. package/dist/{Game-Oy1ys3Vc.js → Game-CPgjDM23.js} +13 -13
  16. package/dist/{GiftCardSetup-DIzgr6Ew.js → GiftCardSetup-DdH3wEOH.js} +10 -10
  17. package/dist/GoalPickerPanel.vue_vue_type_script_setup_true_lang-BmskpBdL.js +424 -0
  18. package/dist/Goals-xDLeFx_e.js +247 -0
  19. package/dist/{Grab-2mznKLou.js → Grab-CggkOy8j.js} +9 -9
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-BaA6OJW8.js → ImageInput.vue_vue_type_script_setup_true_lang-Cm-g1p_m.js} +1 -1
  21. package/dist/{Index-BRiQjotA.js → Index-DcJNte9-.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-RnhLgDQA.js → LocationPicker.vue_vue_type_script_setup_true_lang-Ba2mtWTj.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-DcHERHsz.js → LottieAnimation.vue_vue_type_script_setup_true_lang-xQYvmoY2.js} +1 -1
  24. package/dist/{LoyaltyDashboard-A0dEiZD0.js → LoyaltyDashboard-BMmC9kTo.js} +19 -16
  25. package/dist/{MainLayout-CAeP3Geb.js → MainLayout-5V9aP_OW.js} +3 -3
  26. package/dist/{Marketing-iXJhsmSi.js → Marketing-C-7HoFsr.js} +4 -4
  27. package/dist/{MarketingMaterialEdit-1s-wm1Sq.js → MarketingMaterialEdit-DKQrW2w-.js} +6 -6
  28. package/dist/{Member-Dn-yYonX.js → Member-BT-tGIGu.js} +7 -7
  29. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-W3-KGb8L.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-CMc423yy.js} +24 -24
  30. package/dist/{MemberImportHistory-DKNbehJf.js → MemberImportHistory-4hgNWaYG.js} +7 -7
  31. package/dist/{MemberList-BCYfSkeY.js → MemberList-CHToXvvZ.js} +14 -14
  32. package/dist/{MemberTransactions-0W1jYGG_.js → MemberTransactions-sF8tlSLx.js} +1 -1
  33. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-DTBxNZgb.js → MessageInput.vue_vue_type_script_setup_true_lang-CX5N4HN8.js} +10 -10
  34. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-DBfJciw7.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-B9xthwp-.js} +1 -1
  35. package/dist/{Mission-CDZLGBOq.js → Mission-DeRwazDk.js} +14 -14
  36. package/dist/{Overview-DfPfT1jl.js → Overview-CGHc1dGA.js} +21 -21
  37. package/dist/{Overview-CNNlp-sj.js → Overview-D1BfB0go.js} +4 -4
  38. package/dist/{Point-CFYSW-kx.js → Point-DLbz1o1i.js} +14 -14
  39. package/dist/{Promotion-E1MiG5Lb.js → Promotion-ND7k0GAt.js} +14 -14
  40. package/dist/{Queue-BlHxfV4T.js → Queue-DSZ6SHw8.js} +13 -13
  41. package/dist/{Record-6EVmRgo2.js → Record-Cgl4Okdd.js} +9 -9
  42. package/dist/{Review-BePSVC45.js → Review-CQYHHkrB.js} +2 -2
  43. package/dist/{ReviewFacebookCallback-BJ-jdMEF.js → ReviewFacebookCallback-D-5cP6tF.js} +5 -5
  44. package/dist/{ReviewGoogleCallback-DxJD3of9.js → ReviewGoogleCallback-BqS0lbMq.js} +5 -5
  45. package/dist/{Reward-Xzyb9DNA.js → Reward-CEP9NauM.js} +16 -16
  46. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-ZKTIxMz2.js → RewardGroup.vue_vue_type_script_setup_true_lang-B3A5Vl9M.js} +14 -14
  47. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-BIO78oG3.js → RuleGroup.vue_vue_type_script_setup_true_lang-Dx4fbmfw.js} +15 -15
  48. package/dist/{Segment-Cagj_3Sq.js → Segment-DVptqzgz.js} +26 -26
  49. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-Dh_ajamB.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-oGVnY7GQ.js} +15 -15
  50. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-Bd0GtFww.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BTAWB1BA.js} +4 -4
  51. package/dist/{Setting-DHPCKzLm.js → Setting-Cz0VvOFH.js} +14 -14
  52. package/dist/{SettingAdvertisements-bfXYN1hv.js → SettingAdvertisements-D60yC83d.js} +12 -12
  53. package/dist/{Settings-CpFEG6Dd.js → Settings-BrfX54vL.js} +5 -5
  54. package/dist/{Store-CIIIti42.js → Store-9RdTlgUo.js} +27 -27
  55. package/dist/{StoreRewards-CR4zi9ux.js → StoreRewards-Cutn32ZD.js} +15 -15
  56. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-BpXk51-h.js → StoreTransactions.vue_vue_type_script_setup_true_lang-CJKQBlfI.js} +25 -25
  57. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CTfox5KD.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-I-fIH-8N.js} +2 -2
  58. package/dist/{Tier-f_UEiHYS.js → Tier-DQBr9R7i.js} +27 -27
  59. package/dist/{Title-7XWLideF.js → Title-Ci9aPFLz.js} +23 -23
  60. package/dist/{Transaction-LRL7sbDu.js → Transaction-DqbHdcPo.js} +2 -2
  61. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CWtm4qIy.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-CTmiqIwm.js} +6 -6
  62. package/dist/{Voucher-BqVEkMiW.js → Voucher-4lhxhd9C.js} +18 -18
  63. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DiDpsXqP.js → VoucherEditor.vue_vue_type_script_setup_true_lang-CFi6-VKK.js} +12 -12
  64. package/dist/WhatsappBot-D38goJxM.js +604 -0
  65. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-ByA_M7mT.js → ZodTextField.vue_vue_type_script_setup_true_lang-Dgge7-H4.js} +2 -2
  66. package/dist/{app-DCe_VQSq.js → app-Bb2tSOqF.js} +323 -318
  67. package/dist/app.js +1 -1
  68. package/dist/{base.export-gNtvqhh6.js → base.export-BBOmcZxx.js} +2 -2
  69. package/dist/{business-CvopE1wJ.js → business-CjXvFAZn.js} +1 -1
  70. package/dist/{campaign-D87mJcvH.js → campaign-D2R8I06-.js} +2 -2
  71. package/dist/{campaign-CRQDvYX-.js → campaign-G0f6ljXi.js} +8 -8
  72. package/dist/{campaign.fn-DWNcsYr9.js → campaign.fn-D-rMF_4s.js} +64 -64
  73. package/dist/{collection.fn-CDPBajL8.js → collection.fn-Bvg6FCJb.js} +2 -2
  74. package/dist/{currency-oSov4t8f.js → currency-BeiHwq_q.js} +1 -1
  75. package/dist/{duplicateCampaign-CPMPIPg1.js → duplicateCampaign-Byxy6FXH.js} +2 -2
  76. package/dist/{effect-CeQ-vqGq.js → effect-DqYtqvaw.js} +1 -1
  77. package/dist/{email-addresses-GNLhUzgZ.js → email-addresses-xIlBl9IU.js} +2 -2
  78. package/dist/{helper-CdGkmdxL.js → helper-TqUK4r0b.js} +1 -1
  79. package/dist/{index-CwOnVt6n.js → index-7guDU5qb.js} +7 -7
  80. package/dist/{index-CbzWLlC9.js → index-9FJqvQeE.js} +3 -3
  81. package/dist/{index-CkHztow_.js → index-B1L4q1L0.js} +29 -24
  82. package/dist/{index-CaMlQSvW.js → index-B44CZDQD.js} +2 -2
  83. package/dist/{index-CzvnWHo6.js → index-BDt914jM.js} +1 -1
  84. package/dist/{index-CHLqP0Ec.js → index-BFHYshPb.js} +1 -1
  85. package/dist/{index-Cp2qabkb.js → index-BgECjFM0.js} +5 -5
  86. package/dist/{index-CK2gvgpm.js → index-BvHzJVnj.js} +1 -1
  87. package/dist/{index-V4Fej0RK.js → index-BvjcosEc.js} +3 -3
  88. package/dist/{index-BFsnFZkK.js → index-BxEshHrE.js} +9 -9
  89. package/dist/{index-Ch9ZZ90e.js → index-C7V7AtVf.js} +2 -2
  90. package/dist/{index-DXGfSYbL.js → index-CSI31fuh.js} +4 -4
  91. package/dist/{index-BhcW_yBW.js → index-DG8fSuaM.js} +1 -1
  92. package/dist/{index-CqUDkK17.js → index-DMWHB3Zu.js} +2 -2
  93. package/dist/{index-JSRHjm1v.js → index-DNcisv5D.js} +1 -1
  94. package/dist/{index-DtxAUayi.js → index-D_ix7k3A.js} +2 -2
  95. package/dist/{index-CfsnVMZ5.js → index-Dt8H5FKD.js} +4 -4
  96. package/dist/{index-ShdxYCbF.js → index-XqDLmdvl.js} +2 -2
  97. package/dist/{index-P6H0Nj1-.js → index-nuIbpzmL.js} +1 -1
  98. package/dist/{index-CCDx-XqV.js → index-t-aeCJQI.js} +2 -2
  99. package/dist/{index.esm2017-a1JYIQui.js → index.esm2017-Byww7zVy.js} +37 -37
  100. package/dist/{loading-DBX3vfS4.js → loading-pAf2o94t.js} +1 -1
  101. package/dist/{lodash-BQQbr-v0.js → lodash-CnCxUFbR.js} +1 -1
  102. package/dist/{member-import-CM-7fvI2.js → member-import-D5RxoWpQ.js} +1 -1
  103. package/dist/{membership-DhCbt2tn.js → membership--1r5zMgb.js} +2 -2
  104. package/dist/{money-CqQin-8P.js → money-YS0nj9Vy.js} +1 -1
  105. package/dist/{number-VtG8ZWak.js → number-DpfYNS77.js} +1 -1
  106. package/dist/{objectid-ByBBguim.js → objectid-CzMdDxLC.js} +9 -9
  107. package/dist/onboarding-XAuEF8Fv.js +131 -0
  108. package/dist/{onboardingSetup-B-9izpMN.js → onboardingSetup-CKQDFlu9.js} +2 -2
  109. package/dist/{plugins-B2TWkTg5.js → plugins-CO0TBKil.js} +3 -3
  110. package/dist/{reward-B4QDE-hp.js → reward-CfKDiCkk.js} +1 -1
  111. package/dist/{rule-CzZo6Z5G.js → rule-BuuHD_-S.js} +10 -10
  112. package/dist/style.css +1 -1
  113. package/dist/{template-Co9GIfDK.js → template-DYbZtKQg.js} +6 -6
  114. package/dist/{timezone-CXb1Of5W.js → timezone-C64owf7o.js} +1 -1
  115. package/dist/{transaction.fn-D1shYDAp.js → transaction.fn-ClQ1jH9V.js} +2 -2
  116. package/dist/{trigger-D1iPqyua.js → trigger-DUkCFrPG.js} +5 -5
  117. package/dist/{useMarketingMaterialActions-BWrHG4u3.js → useMarketingMaterialActions-CA2iWa32.js} +3 -3
  118. package/dist/{usePagination-vGg6slc_.js → usePagination-BZmMaVcI.js} +1 -1
  119. package/dist/{user-BL1FGfP0.js → user-beTdsIEQ.js} +1 -1
  120. package/dist/{vue-i18n-GqQ0e2Uh.js → vue-i18n-Cfu8S_JC.js} +357 -357
  121. package/dist/{xlsx-No9Jac5G.js → xlsx-BMeHM9By.js} +651 -651
  122. package/dist/{zod-DCljEP8S.js → zod-DTSByurx.js} +1 -1
  123. package/package.json +1 -1
  124. package/dist/GoalPickerPanel.vue_vue_type_script_setup_true_lang-gdvTQM25.js +0 -417
  125. package/dist/Goals-CO8hZIU2.js +0 -244
  126. package/dist/WhatsappBot-Cu1oY_1Y.js +0 -577
  127. package/dist/onboarding-CK20C51K.js +0 -129
@@ -1,577 +0,0 @@
1
- import { defineComponent as E, computed as U, openBlock as s, createElementBlock as i, createElementVNode as e, normalizeClass as Z, toDisplayString as n, unref as t, createTextVNode as j, createCommentVNode as I, Fragment as N, renderList as J, createBlock as A, useModel as R, ref as w, watch as W, onBeforeUnmount as G, resolveComponent as $, withCtx as V, createVNode as k } from "vue";
2
- import { u as P } from "./vue-i18n-GqQ0e2Uh.js";
3
- import { g as Q, b as Y, S as H } from "./index-DtxAUayi.js";
4
- import { F as X, a as q, b as ee, c as te, d as oe } from "./index-Cp2qabkb.js";
5
- import { b as se } from "./browser-BSAOEeIM.js";
6
- const z = (p) => Y(`businesses/${encodeURIComponent(p)}/whatsapp`), L = {
7
- async getSettings(p, a) {
8
- return X.parse(
9
- Q(await z(p).get("/settings", { signal: a }))
10
- );
11
- },
12
- async saveSettings(p, a, o) {
13
- const b = q.parse(a);
14
- return X.parse(
15
- Q(await z(p).put("/settings", b, { signal: o }))
16
- );
17
- },
18
- async listClients(p, a) {
19
- return ee.array().parse(
20
- Q(await z(p).get("/clients", { signal: a }))
21
- );
22
- },
23
- async createClient(p, a) {
24
- return te.parse(
25
- Q(
26
- await z(p).post(
27
- "/clients",
28
- {},
29
- { signal: a, timeout: 5e4 }
30
- )
31
- )
32
- );
33
- }
34
- }, ne = { class: "border border-fm-color-neutral-gray-100 rounded-[16px] p-[20px] flex flex-col gap-[16px] bg-fm-color-neutral-white" }, ae = { class: "flex items-center gap-[12px]" }, le = { class: "min-w-0 flex-1" }, ce = ["title"], re = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary break-all" }, ie = { class: "flex items-center justify-between flex-wrap gap-[8px] border-t border-fm-color-neutral-gray-100 pt-[12px]" }, pe = { class: "flex items-center gap-[6px] text-[12px] font-semibold text-fm-color-typo-success bg-fm-color-system-success-100 px-[8px] py-[3px] rounded-[6px]" }, ue = {
35
- key: 0,
36
- class: "text-[12px] text-fm-color-typo-secondary"
37
- }, de = /* @__PURE__ */ E({
38
- __name: "WhatsappAccountCard",
39
- props: {
40
- account: {},
41
- index: {}
42
- },
43
- setup(p) {
44
- const a = p, { t: o, locale: b } = P(), l = U(
45
- () => {
46
- var x, m, u;
47
- return ((x = a.account.account) == null ? void 0 : x.businessName) || ((m = a.account.account) == null ? void 0 : m.name) || ((u = a.account.account) == null ? void 0 : u.phoneNumber) || o("connect.whatsappBot.unnamedAccount");
48
- }
49
- ), r = U(
50
- () => l.value.trim().split(/\s+/).slice(0, 2).map((x) => Array.from(x)[0]).join("").toLocaleUpperCase(b.value)
51
- ), g = [
52
- "bg-fm-color-primary",
53
- "bg-fm-color-secondary-plum",
54
- "bg-fm-color-system-success-400"
55
- ];
56
- function v(x) {
57
- return new Intl.DateTimeFormat(b.value, {
58
- year: "numeric",
59
- month: "short",
60
- day: "numeric"
61
- }).format(new Date(x));
62
- }
63
- return (x, m) => {
64
- var u;
65
- return s(), i("li", ne, [
66
- e("div", ae, [
67
- e("div", {
68
- "aria-hidden": "true",
69
- class: Z(["w-[48px] h-[48px] rounded-full shrink-0 flex items-center justify-center text-[16px] font-semibold text-fm-color-typo-white", g[p.index % g.length]])
70
- }, n(r.value), 3),
71
- e("div", le, [
72
- e("h2", {
73
- class: "text-[16px] leading-[24px] font-semibold truncate",
74
- title: l.value
75
- }, n(l.value), 9, ce),
76
- e("p", re, n(((u = p.account.account) == null ? void 0 : u.phoneNumber) || t(o)("connect.whatsappBot.phoneUnavailable")), 1)
77
- ])
78
- ]),
79
- e("div", ie, [
80
- e("span", pe, [
81
- m[0] || (m[0] = e("span", { class: "w-[6px] h-[6px] rounded-full bg-fm-color-system-success-400" }, null, -1)),
82
- j(" " + n(t(o)("connect.whatsappBot.connected")), 1)
83
- ]),
84
- p.account.connectedAt ? (s(), i("span", ue, n(t(o)("connect.whatsappBot.connectedSince", {
85
- date: v(p.account.connectedAt)
86
- })), 1)) : I("", !0)
87
- ])
88
- ]);
89
- };
90
- }
91
- }), xe = { class: "mt-[4px] text-[14px] text-fm-color-typo-secondary" }, me = { class: "mt-[20px] grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] xs:grid-cols-1 gap-[16px]" }, fe = /* @__PURE__ */ E({
92
- __name: "WhatsappAccountList",
93
- props: {
94
- accounts: {}
95
- },
96
- setup(p) {
97
- const { t: a } = P();
98
- return (o, b) => (s(), i(N, null, [
99
- e("p", xe, n(t(a)("connect.whatsappBot.accountCount", p.accounts.length)), 1),
100
- e("ul", me, [
101
- (s(!0), i(N, null, J(p.accounts, (l, r) => (s(), A(de, {
102
- key: l.clientId,
103
- account: l,
104
- index: r
105
- }, null, 8, ["account", "index"]))), 128))
106
- ])
107
- ], 64));
108
- }
109
- }), he = { class: "text-[18px] font-semibold" }, ve = {
110
- key: 0,
111
- role: "status",
112
- class: "flex flex-col items-center text-center gap-[8px] px-[8px] py-[40px]"
113
- }, ge = { class: "text-[18px] font-semibold" }, _e = { class: "text-[14px] text-fm-color-typo-secondary break-all" }, be = {
114
- key: 1,
115
- class: "grid grid-cols-[minmax(0,1fr)_232px] xs:grid-cols-1 gap-[32px] p-[8px] xs:p-[0px]"
116
- }, ye = { class: "flex flex-col gap-[20px] text-[14px] leading-[20px]" }, we = { class: "text-fm-color-typo-secondary" }, Be = { class: "flex flex-col gap-[14px]" }, ke = { class: "w-[22px] h-[22px] shrink-0 rounded-full bg-fm-color-neutral-gray-100 flex items-center justify-center text-[12px] font-semibold" }, Ce = { key: 0 }, $e = { class: "font-semibold" }, Se = { class: "font-semibold" }, Fe = { class: "font-semibold" }, Ie = { class: "font-semibold" }, Ae = { key: 3 }, Te = { class: "text-[12px] leading-[16px] text-fm-color-typo-secondary" }, De = { class: "relative w-[232px] h-[232px] xs:justify-self-center border border-fm-color-neutral-gray-100 rounded-xl flex items-center justify-center overflow-hidden" }, Ve = {
117
- key: 0,
118
- role: "status",
119
- class: "flex flex-col items-center gap-[12px] text-[13px]"
120
- }, je = {
121
- key: 1,
122
- class: "flex flex-col items-center text-center gap-[12px] p-[12px]"
123
- }, Ne = {
124
- role: "alert",
125
- class: "text-[14px] text-fm-color-typo-error"
126
- }, Ee = ["src", "alt"], Pe = {
127
- key: 3,
128
- role: "status",
129
- "aria-live": "polite",
130
- class: "absolute inset-0 bg-fm-color-neutral-white/90 flex flex-col items-center justify-center gap-[10px] text-[13px] font-medium"
131
- }, Ue = /* @__PURE__ */ E({
132
- __name: "WhatsappConnectDialog",
133
- props: {
134
- modelValue: { type: Boolean, required: !0 },
135
- modelModifiers: {}
136
- },
137
- emits: ["update:modelValue"],
138
- setup(p) {
139
- const a = R(p, "modelValue"), { t: o } = P(), b = w(""), l = w(!1), r = w(""), g = w(!1), v = w();
140
- let x, m, u;
141
- function _() {
142
- x == null || x.abort(), clearTimeout(m), m = void 0, clearTimeout(u), u = void 0;
143
- }
144
- async function f(c, y, h) {
145
- if (!h.aborted) {
146
- try {
147
- const F = await L.listClients(c, h);
148
- if (h.aborted) return;
149
- const C = F.find((B) => B.clientId === y);
150
- if ((C == null ? void 0 : C.status) === "connected" && (g.value = !0), (C == null ? void 0 : C.status) === "connected" && C.profileStatus === "ready") {
151
- _(), g.value = !1, v.value = C, u = setTimeout(() => {
152
- a.value = !1;
153
- }, 1800);
154
- return;
155
- }
156
- } catch {
157
- }
158
- h.aborted || (m = setTimeout(() => {
159
- f(c, y, h);
160
- }, 3e3));
161
- }
162
- }
163
- async function S() {
164
- _();
165
- const c = new AbortController();
166
- x = c, b.value = "", r.value = "", g.value = !1, v.value = void 0, l.value = !0;
167
- try {
168
- const y = H.getBusinessId();
169
- if (!y)
170
- throw new Error(o("connect.whatsappBot.errors.selectBusiness"));
171
- const h = await L.createClient(
172
- y,
173
- c.signal
174
- ), F = await se.toDataURL(h.qr, {
175
- width: 224,
176
- margin: 2,
177
- errorCorrectionLevel: "M"
178
- });
179
- c.signal.aborted || (b.value = F, f(y, h.clientId, c.signal));
180
- } catch (y) {
181
- c.signal.aborted || (r.value = y instanceof Error ? y.message : o("connect.whatsappBot.errors.loadQr"));
182
- } finally {
183
- c.signal.aborted || (l.value = !1);
184
- }
185
- }
186
- return W(
187
- a,
188
- (c) => {
189
- c ? S() : _();
190
- },
191
- { immediate: !0 }
192
- ), G(_), (c, y) => {
193
- const h = $("i18n-t"), F = $("FmCircularProgress"), C = $("FmButton"), B = $("FmDialog");
194
- return s(), A(B, {
195
- modelValue: a.value,
196
- "onUpdate:modelValue": y[0] || (y[0] = (d) => a.value = d),
197
- "min-width": "min(720px, calc(100% - 32px))",
198
- "max-width": "720px",
199
- "max-height": "90vh",
200
- "dismiss-away": ""
201
- }, {
202
- "dialog-header": V(() => [
203
- e("h2", he, n(t(o)("connect.whatsappBot.connectAccount")), 1)
204
- ]),
205
- default: V(() => {
206
- var d, T, M;
207
- return [
208
- v.value ? (s(), i("div", ve, [
209
- y[1] || (y[1] = e("div", {
210
- "aria-hidden": "true",
211
- class: "w-[64px] h-[64px] rounded-full bg-fm-color-system-success-100 text-fm-color-typo-success flex items-center justify-center mb-[8px]"
212
- }, [
213
- e("svg", {
214
- width: "32",
215
- height: "32",
216
- viewBox: "0 0 24 24",
217
- fill: "none",
218
- stroke: "currentColor",
219
- "stroke-width": "2.2",
220
- "stroke-linecap": "round",
221
- "stroke-linejoin": "round"
222
- }, [
223
- e("path", { d: "M20 6 9 17l-5-5" })
224
- ])
225
- ], -1)),
226
- e("h3", ge, n(t(o)("connect.whatsappBot.accountConnected")), 1),
227
- e("p", _e, n(((d = v.value.account) == null ? void 0 : d.businessName) || ((T = v.value.account) == null ? void 0 : T.name) || t(o)("connect.whatsappBot.unnamedAccount")) + " · " + n(((M = v.value.account) == null ? void 0 : M.phoneNumber) || t(o)("connect.whatsappBot.phoneUnavailable")), 1)
228
- ])) : (s(), i("div", be, [
229
- e("div", ye, [
230
- e("p", we, n(t(o)("connect.whatsappBot.scanDescription")), 1),
231
- e("ol", Be, [
232
- (s(), i(N, null, J(4, (D) => e("li", {
233
- key: D,
234
- class: "flex gap-[12px]"
235
- }, [
236
- e("span", ke, n(D), 1),
237
- D === 1 ? (s(), i("span", Ce, n(t(o)("connect.whatsappBot.steps.openApp")), 1)) : D === 2 ? (s(), A(h, {
238
- key: 1,
239
- keypath: "connect.whatsappBot.steps.openSettings",
240
- tag: "span",
241
- scope: "global"
242
- }, {
243
- menu: V(() => [
244
- e("b", $e, n(t(o)("connect.whatsappBot.menu")), 1)
245
- ]),
246
- settings: V(() => [
247
- e("b", Se, n(t(o)("connect.whatsappBot.settings")), 1)
248
- ]),
249
- _: 1
250
- })) : D === 3 ? (s(), A(h, {
251
- key: 2,
252
- keypath: "connect.whatsappBot.steps.linkDevice",
253
- tag: "span",
254
- scope: "global"
255
- }, {
256
- linkedDevices: V(() => [
257
- e("b", Fe, n(t(o)("connect.whatsappBot.linkedDevices")), 1)
258
- ]),
259
- linkDevice: V(() => [
260
- e("b", Ie, n(t(o)("connect.whatsappBot.linkDevice")), 1)
261
- ]),
262
- _: 1
263
- })) : (s(), i("span", Ae, n(t(o)("connect.whatsappBot.steps.scanQr")), 1))
264
- ])), 64))
265
- ]),
266
- e("p", Te, n(t(o)("connect.whatsappBot.connectionNote")), 1)
267
- ]),
268
- e("div", De, [
269
- l.value ? (s(), i("div", Ve, [
270
- k(F),
271
- j(n(t(o)("connect.whatsappBot.generatingQr")), 1)
272
- ])) : r.value ? (s(), i("div", je, [
273
- e("p", Ne, n(r.value), 1),
274
- k(C, {
275
- label: t(o)("connect.whatsappBot.tryAgain"),
276
- "prepend-icon": "refresh",
277
- onClick: S
278
- }, null, 8, ["label"])
279
- ])) : b.value ? (s(), i("img", {
280
- key: 2,
281
- src: b.value,
282
- alt: t(o)("connect.whatsappBot.qrAlt"),
283
- width: "224",
284
- height: "224",
285
- class: Z({ "opacity-20": g.value })
286
- }, null, 10, Ee)) : I("", !0),
287
- g.value ? (s(), i("div", Pe, [
288
- k(F),
289
- j(" " + n(t(o)("connect.whatsappBot.connecting")), 1)
290
- ])) : I("", !0)
291
- ])
292
- ]))
293
- ];
294
- }),
295
- _: 1
296
- }, 8, ["modelValue"]);
297
- };
298
- }
299
- }), We = { class: "mt-[24px] border border-fm-color-neutral-gray-200 rounded-[16px] px-[24px] py-[56px] flex flex-col items-center text-center gap-[8px]" }, Le = { class: "text-[20px] leading-[28px] font-bold" }, Me = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary max-w-[420px]" }, Qe = /* @__PURE__ */ E({
300
- __name: "WhatsappEmptyState",
301
- emits: ["connect"],
302
- setup(p, { emit: a }) {
303
- const o = a, { t: b } = P();
304
- return (l, r) => {
305
- const g = $("FmButton");
306
- return s(), i("div", We, [
307
- r[1] || (r[1] = e("div", { class: "w-[72px] h-[72px] rounded-full bg-fm-color-primary-oats text-fm-color-primary flex items-center justify-center mb-[12px]" }, [
308
- e("svg", {
309
- width: "34",
310
- height: "34",
311
- viewBox: "0 0 24 24",
312
- fill: "none",
313
- stroke: "currentColor",
314
- "stroke-width": "1.6",
315
- "stroke-linecap": "round",
316
- "stroke-linejoin": "round",
317
- "aria-hidden": "true"
318
- }, [
319
- e("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
320
- e("path", { d: "M9 10h.01M12 10h.01M15 10h.01" })
321
- ])
322
- ], -1)),
323
- e("h2", Le, n(t(b)("connect.whatsappBot.emptyTitle")), 1),
324
- e("p", Me, n(t(b)("connect.whatsappBot.emptyDescription")), 1),
325
- k(g, {
326
- class: "mt-[16px]",
327
- label: t(b)("connect.whatsappBot.connectAccount"),
328
- "prepend-icon": "add",
329
- onClick: r[0] || (r[0] = (v) => o("connect"))
330
- }, null, 8, ["label"])
331
- ]);
332
- };
333
- }
334
- }), ze = { class: "max-w-[720px] flex flex-col gap-[20px]" }, He = { class: "flex flex-col items-start gap-[8px]" }, Oe = { class: "text-[24px] leading-[32px] font-semibold tracking-[-0.24px]" }, Ge = {
335
- key: 0,
336
- role: "status",
337
- class: "py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
338
- }, Xe = {
339
- key: 0,
340
- class: "border-[1px] border-fm-color-neutral-gray-100 rounded-[16px] p-[24px] flex flex-col gap-[16px]"
341
- }, Ze = { class: "flex flex-col gap-[4px]" }, Je = { class: "text-[16px] leading-[24px] font-semibold" }, Ke = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary" }, Re = {
342
- key: 1,
343
- role: "alert",
344
- class: "text-[14px] text-fm-color-typo-error"
345
- }, Ye = { class: "flex items-center justify-end gap-[12px] flex-wrap" }, qe = {
346
- key: 0,
347
- role: "status",
348
- class: "mr-auto flex items-center gap-[6px] text-[14px] text-fm-color-typo-success"
349
- }, et = /* @__PURE__ */ E({
350
- __name: "WhatsappBotSettings",
351
- props: {
352
- businessId: {}
353
- },
354
- emits: ["close"],
355
- setup(p, { emit: a }) {
356
- const o = p, b = a, { t: l } = P(), r = w(""), g = w(""), v = w(!0), x = w(!1), m = w(!1), u = w(""), _ = w(!1), f = oe, S = U(
357
- () => !x.value || m.value || r.value === g.value || r.value.length > f
358
- );
359
- let c, y;
360
- function h() {
361
- clearTimeout(y), _.value = !1;
362
- }
363
- async function F() {
364
- c == null || c.abort(), h();
365
- const B = new AbortController();
366
- c = B, v.value = !0, x.value = !1, m.value = !1, u.value = "", r.value = "", g.value = "";
367
- try {
368
- if (!o.businessId)
369
- throw new Error(l("connect.whatsappBot.errors.selectBusiness"));
370
- const d = await L.getSettings(
371
- o.businessId,
372
- B.signal
373
- );
374
- if (B.signal.aborted) return;
375
- r.value = d.botInstructions, g.value = d.botInstructions, x.value = !0;
376
- } catch (d) {
377
- B.signal.aborted || (u.value = d instanceof Error ? d.message : l("connect.whatsappBot.errors.loadSettings"));
378
- } finally {
379
- B.signal.aborted || (v.value = !1);
380
- }
381
- }
382
- async function C() {
383
- if (S.value) return;
384
- c == null || c.abort();
385
- const B = new AbortController();
386
- c = B, m.value = !0, u.value = "", h();
387
- try {
388
- const d = await L.saveSettings(
389
- o.businessId,
390
- { botInstructions: r.value },
391
- B.signal
392
- );
393
- if (B.signal.aborted) return;
394
- g.value = d.botInstructions, r.value = d.botInstructions, _.value = !0, y = setTimeout(() => {
395
- _.value = !1;
396
- }, 2500);
397
- } catch (d) {
398
- B.signal.aborted || (u.value = d instanceof Error ? d.message : l("connect.whatsappBot.errors.saveSettings"));
399
- } finally {
400
- B.signal.aborted || (m.value = !1);
401
- }
402
- }
403
- return W(r, h, { flush: "sync" }), W(() => o.businessId, F, { immediate: !0 }), G(() => {
404
- c == null || c.abort(), h();
405
- }), (B, d) => {
406
- const T = $("FmButton"), M = $("FmCircularProgress"), D = $("FmTextarea"), K = $("FmIcon");
407
- return s(), i("div", ze, [
408
- e("div", He, [
409
- k(T, {
410
- variant: "plain",
411
- "prepend-icon": "chevron_left",
412
- label: t(l)("connect.navigation.whatsappBot"),
413
- disabled: m.value,
414
- onClick: d[0] || (d[0] = (O) => b("close"))
415
- }, null, 8, ["label", "disabled"]),
416
- e("h1", Oe, n(t(l)("connect.whatsappBot.botSettings.title")), 1)
417
- ]),
418
- v.value ? (s(), i("div", Ge, [
419
- k(M),
420
- j(" " + n(t(l)("connect.whatsappBot.botSettings.loading")), 1)
421
- ])) : (s(), i(N, { key: 1 }, [
422
- x.value ? (s(), i("div", Xe, [
423
- e("div", Ze, [
424
- e("h2", Je, n(t(l)("connect.whatsappBot.botSettings.instructions")), 1),
425
- e("p", Ke, n(t(l)("connect.whatsappBot.botSettings.description")), 1)
426
- ]),
427
- k(D, {
428
- modelValue: r.value,
429
- "onUpdate:modelValue": d[1] || (d[1] = (O) => r.value = O),
430
- "aria-label": t(l)("connect.whatsappBot.botSettings.instructions"),
431
- placeholder: t(l)("connect.whatsappBot.botSettings.placeholder"),
432
- "max-length": t(f),
433
- disabled: m.value,
434
- "show-word-count": "",
435
- class: "[&_.fm-textarea\\_\\_container]:!h-auto [&_textarea]:min-h-[200px] [&_textarea]:!resize-y"
436
- }, null, 8, ["modelValue", "aria-label", "placeholder", "max-length", "disabled"])
437
- ])) : I("", !0),
438
- u.value ? (s(), i("p", Re, n(u.value), 1)) : I("", !0),
439
- x.value ? I("", !0) : (s(), A(T, {
440
- key: 2,
441
- class: "self-start",
442
- label: t(l)("connect.whatsappBot.tryAgain"),
443
- "prepend-icon": "refresh",
444
- onClick: F
445
- }, null, 8, ["label"])),
446
- e("div", Ye, [
447
- _.value ? (s(), i("span", qe, [
448
- k(K, {
449
- name: "check",
450
- size: "sm"
451
- }),
452
- j(" " + n(t(l)("connect.whatsappBot.botSettings.saved")), 1)
453
- ])) : I("", !0),
454
- k(T, {
455
- variant: "secondary",
456
- label: t(l)("connect.common.cancel"),
457
- disabled: m.value,
458
- onClick: d[2] || (d[2] = (O) => b("close"))
459
- }, null, 8, ["label", "disabled"]),
460
- k(T, {
461
- label: t(l)("connect.common.save"),
462
- disabled: S.value,
463
- loading: m.value,
464
- onClick: C
465
- }, null, 8, ["label", "disabled", "loading"])
466
- ])
467
- ], 64))
468
- ]);
469
- };
470
- }
471
- }), tt = { class: "px-[24px] xs:px-[12px] pt-[20px] pb-[40px] text-fm-color-typo-primary" }, ot = {
472
- key: 0,
473
- class: "flex items-center justify-between gap-[16px] flex-wrap min-h-[40px]"
474
- }, st = { class: "flex items-center gap-8" }, nt = { class: "text-[24px] leading-[32px] font-semibold tracking-[-0.01em]" }, at = { class: "flex items-center gap-[8px]" }, lt = {
475
- key: 0,
476
- role: "status",
477
- class: "mt-[24px] py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
478
- }, ct = {
479
- key: 1,
480
- class: "mt-[24px] border border-fm-color-neutral-gray-200 rounded-[16px] px-[24px] py-[56px] flex flex-col items-center text-center gap-[16px]"
481
- }, rt = {
482
- role: "alert",
483
- class: "text-[14px] text-fm-color-typo-error"
484
- }, mt = /* @__PURE__ */ E({
485
- __name: "WhatsappBot",
486
- setup(p) {
487
- const { t: a } = P(), o = w(!1), b = U(() => H.getBusinessId() ?? ""), l = w([]), r = w(!0), g = w("");
488
- let v;
489
- const x = U(
490
- () => l.value.filter((_) => _.status === "connected")
491
- );
492
- async function m() {
493
- v == null || v.abort();
494
- const _ = new AbortController();
495
- v = _, r.value = !0, g.value = "";
496
- try {
497
- const f = H.getBusinessId();
498
- if (!f)
499
- throw new Error(a("connect.whatsappBot.errors.selectBusiness"));
500
- const S = await L.listClients(f, _.signal);
501
- _.signal.aborted || (l.value = S);
502
- } catch (f) {
503
- _.signal.aborted || (g.value = f instanceof Error ? f.message : a("connect.whatsappBot.errors.loadSessions"));
504
- } finally {
505
- _.signal.aborted || (r.value = !1);
506
- }
507
- }
508
- const u = w(!1);
509
- return W(u, (_) => {
510
- _ || m();
511
- }), W(
512
- () => H.getBusinessId(),
513
- () => {
514
- u.value = !1, o.value = !1, l.value = [], m();
515
- },
516
- { immediate: !0 }
517
- ), G(() => {
518
- v == null || v.abort();
519
- }), (_, f) => {
520
- const S = $("FmPill"), c = $("FmButton"), y = $("FmCircularProgress");
521
- return s(), i(N, null, [
522
- e("div", tt, [
523
- o.value ? I("", !0) : (s(), i("div", ot, [
524
- e("div", st, [
525
- e("h1", nt, n(t(a)("connect.navigation.whatsappBot")), 1),
526
- k(S, { variant: "beta" })
527
- ]),
528
- e("div", at, [
529
- k(c, {
530
- variant: "secondary",
531
- label: t(a)("connect.whatsappBot.settings"),
532
- "prepend-icon": "settings",
533
- onClick: f[0] || (f[0] = (h) => o.value = !0)
534
- }, null, 8, ["label"]),
535
- x.value.length ? (s(), A(c, {
536
- key: 0,
537
- label: t(a)("connect.whatsappBot.connectAccount"),
538
- "prepend-icon": "add",
539
- onClick: f[1] || (f[1] = (h) => u.value = !0)
540
- }, null, 8, ["label"])) : I("", !0)
541
- ])
542
- ])),
543
- o.value ? (s(), A(et, {
544
- key: 1,
545
- "business-id": b.value,
546
- onClose: f[2] || (f[2] = (h) => o.value = !1)
547
- }, null, 8, ["business-id"])) : (s(), i(N, { key: 2 }, [
548
- r.value ? (s(), i("div", lt, [
549
- k(y),
550
- j(" " + n(t(a)("connect.whatsappBot.loadingSessions")), 1)
551
- ])) : g.value ? (s(), i("div", ct, [
552
- e("p", rt, n(g.value), 1),
553
- k(c, {
554
- label: t(a)("connect.whatsappBot.tryAgain"),
555
- "prepend-icon": "refresh",
556
- onClick: m
557
- }, null, 8, ["label"])
558
- ])) : x.value.length ? (s(), A(fe, {
559
- key: 2,
560
- accounts: x.value
561
- }, null, 8, ["accounts"])) : (s(), A(Qe, {
562
- key: 3,
563
- onConnect: f[3] || (f[3] = (h) => u.value = !0)
564
- }))
565
- ], 64))
566
- ]),
567
- k(Ue, {
568
- modelValue: u.value,
569
- "onUpdate:modelValue": f[4] || (f[4] = (h) => u.value = h)
570
- }, null, 8, ["modelValue"])
571
- ], 64);
572
- };
573
- }
574
- });
575
- export {
576
- mt as default
577
- };