@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
@@ -0,0 +1,604 @@
1
+ import { defineComponent as j, computed as V, openBlock as s, createElementBlock as p, normalizeClass as O, createElementVNode as t, createTextVNode as W, toDisplayString as a, unref as o, createVNode as C, createCommentVNode as I, Fragment as E, renderList as J, createBlock as A, useModel as R, ref as y, watch as U, onBeforeUnmount as X, resolveComponent as F, withCtx as P } from "vue";
2
+ import { u as N } from "./vue-i18n-Cfu8S_JC.js";
3
+ import { g as Q, b as Y, S as H } from "./index-D_ix7k3A.js";
4
+ import { F as Z, a as q, b as tt, c as et, d as ot } from "./index-BgECjFM0.js";
5
+ import { b as st } from "./browser-BSAOEeIM.js";
6
+ import { _ as nt } from "./_plugin-vue_export-helper-CHgC5LLL.js";
7
+ const z = (i) => Y(`businesses/${encodeURIComponent(i)}/whatsapp`), L = {
8
+ async getSettings(i, n) {
9
+ return Z.parse(
10
+ Q(await z(i).get("/settings", { signal: n }))
11
+ );
12
+ },
13
+ async saveSettings(i, n, e) {
14
+ const m = q.parse(n);
15
+ return Z.parse(
16
+ Q(await z(i).put("/settings", m, { signal: e }))
17
+ );
18
+ },
19
+ async listClients(i, n) {
20
+ return tt.array().parse(
21
+ Q(await z(i).get("/clients", { signal: n }))
22
+ );
23
+ },
24
+ async createClient(i, n) {
25
+ return et.parse(
26
+ Q(
27
+ await z(i).post(
28
+ "/clients",
29
+ {},
30
+ { signal: n, timeout: 5e4 }
31
+ )
32
+ )
33
+ );
34
+ }
35
+ }, at = /* @__PURE__ */ j({
36
+ __name: "WhatsappAccountStatusLabel",
37
+ props: {
38
+ status: {}
39
+ },
40
+ setup(i) {
41
+ const n = i, { t: e } = N(), m = V(() => n.status === "disconnected");
42
+ return (r, c) => (s(), p("span", {
43
+ class: O([
44
+ "flex items-center gap-[6px] text-[12px] font-semibold px-[8px] py-[3px] rounded-[6px]",
45
+ m.value ? "text-fm-color-typo-error bg-fm-color-system-error-100" : "text-fm-color-typo-success bg-fm-color-system-success-100"
46
+ ])
47
+ }, [
48
+ t("span", {
49
+ "aria-hidden": "true",
50
+ class: O([
51
+ "w-[6px] h-[6px] rounded-full",
52
+ m.value ? "bg-fm-color-system-error-400" : "bg-fm-color-system-success-400"
53
+ ])
54
+ }, null, 2),
55
+ W(" " + a(o(e)(
56
+ m.value ? "connect.whatsappBot.disconnected" : "connect.whatsappBot.connected"
57
+ )), 1)
58
+ ], 2));
59
+ }
60
+ }), lt = { class: "border border-fm-color-neutral-gray-100 rounded-[16px] p-[20px] flex flex-col gap-[16px] bg-fm-color-neutral-white" }, ct = { class: "flex items-center gap-[12px]" }, rt = { class: "min-w-0 flex-1" }, it = ["title"], pt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary break-all" }, ut = { class: "flex items-center justify-between flex-wrap gap-[8px] border-t border-fm-color-neutral-gray-100 pt-[12px]" }, dt = {
61
+ key: 0,
62
+ class: "text-[12px] text-fm-color-typo-secondary"
63
+ }, mt = /* @__PURE__ */ j({
64
+ __name: "WhatsappAccountCard",
65
+ props: {
66
+ account: {},
67
+ index: {}
68
+ },
69
+ setup(i) {
70
+ const n = i, { t: e, locale: m } = N(), r = V(() => n.account.status === "disconnected"), c = V(
71
+ () => {
72
+ var u, _, v;
73
+ return ((u = n.account.account) == null ? void 0 : u.businessName) || ((_ = n.account.account) == null ? void 0 : _.name) || ((v = n.account.account) == null ? void 0 : v.phoneNumber) || e("connect.whatsappBot.unnamedAccount");
74
+ }
75
+ ), g = V(
76
+ () => c.value.trim().split(/\s+/).slice(0, 2).map((u) => Array.from(u)[0]).join("").toLocaleUpperCase(m.value)
77
+ ), h = [
78
+ "bg-fm-color-primary",
79
+ "bg-fm-color-secondary-plum",
80
+ "bg-fm-color-system-success-400"
81
+ ];
82
+ function w(u) {
83
+ return new Intl.DateTimeFormat(m.value, {
84
+ year: "numeric",
85
+ month: "short",
86
+ day: "numeric"
87
+ }).format(new Date(u));
88
+ }
89
+ return (u, _) => {
90
+ var v;
91
+ return s(), p("li", lt, [
92
+ t("div", ct, [
93
+ t("div", {
94
+ "aria-hidden": "true",
95
+ class: O(["w-[48px] h-[48px] rounded-full shrink-0 flex items-center justify-center text-[16px] font-semibold text-fm-color-typo-white", h[i.index % h.length]])
96
+ }, a(g.value), 3),
97
+ t("div", rt, [
98
+ t("h2", {
99
+ class: "text-[16px] leading-[24px] font-semibold truncate",
100
+ title: c.value
101
+ }, a(c.value), 9, it),
102
+ t("p", pt, a(((v = i.account.account) == null ? void 0 : v.phoneNumber) || o(e)("connect.whatsappBot.phoneUnavailable")), 1)
103
+ ])
104
+ ]),
105
+ t("div", ut, [
106
+ C(at, {
107
+ status: i.account.status
108
+ }, null, 8, ["status"]),
109
+ !r.value && i.account.connectedAt ? (s(), p("span", dt, a(o(e)("connect.whatsappBot.connectedSince", {
110
+ date: w(i.account.connectedAt)
111
+ })), 1)) : I("", !0)
112
+ ])
113
+ ]);
114
+ };
115
+ }
116
+ }), xt = { class: "mt-[4px] text-[14px] text-fm-color-typo-secondary" }, ft = { class: "mt-[20px] grid grid-cols-[repeat(auto-fill,minmax(280px,1fr))] xs:grid-cols-1 gap-[16px]" }, ht = /* @__PURE__ */ j({
117
+ __name: "WhatsappAccountList",
118
+ props: {
119
+ accounts: {}
120
+ },
121
+ setup(i) {
122
+ const { t: n } = N();
123
+ return (e, m) => (s(), p(E, null, [
124
+ t("p", xt, a(o(n)("connect.whatsappBot.accountCount", i.accounts.length)), 1),
125
+ t("ul", ft, [
126
+ (s(!0), p(E, null, J(i.accounts, (r, c) => (s(), A(mt, {
127
+ key: r.clientId,
128
+ account: r,
129
+ index: c
130
+ }, null, 8, ["account", "index"]))), 128))
131
+ ])
132
+ ], 64));
133
+ }
134
+ }), vt = { class: "text-[18px] font-semibold" }, gt = {
135
+ key: 0,
136
+ role: "status",
137
+ class: "flex flex-col items-center text-center gap-[8px] px-[8px] py-[40px]"
138
+ }, _t = { class: "text-[18px] font-semibold" }, bt = { class: "text-[14px] text-fm-color-typo-secondary break-all" }, yt = {
139
+ key: 1,
140
+ class: "grid grid-cols-[minmax(0,1fr)_232px] xs:grid-cols-1 gap-[32px] p-[8px] xs:p-[0px]"
141
+ }, wt = { class: "flex flex-col gap-[20px] text-[14px] leading-[20px]" }, Bt = { class: "text-fm-color-typo-secondary" }, kt = { class: "flex flex-col gap-[14px]" }, Ct = { class: "w-[22px] h-[22px] shrink-0 rounded-full bg-fm-color-neutral-gray-100 flex items-center justify-center text-[12px] font-semibold" }, $t = { key: 0 }, St = { class: "font-semibold" }, Ft = { class: "font-semibold" }, It = { class: "font-semibold" }, At = { class: "font-semibold" }, Tt = { key: 3 }, Dt = { class: "text-[12px] leading-[16px] text-fm-color-typo-secondary" }, Vt = { 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" }, jt = {
142
+ key: 0,
143
+ role: "status",
144
+ class: "flex flex-col items-center gap-[12px] text-[13px]"
145
+ }, Nt = {
146
+ key: 1,
147
+ class: "flex flex-col items-center text-center gap-[12px] p-[12px]"
148
+ }, Pt = {
149
+ role: "alert",
150
+ class: "text-[14px] text-fm-color-typo-error"
151
+ }, Wt = ["src", "alt"], Et = {
152
+ key: 3,
153
+ role: "status",
154
+ "aria-live": "polite",
155
+ class: "absolute inset-0 bg-fm-color-neutral-white/90 flex flex-col items-center justify-center gap-[10px] text-[13px] font-medium"
156
+ }, Ut = /* @__PURE__ */ j({
157
+ __name: "WhatsappConnectDialog",
158
+ props: {
159
+ modelValue: { type: Boolean, required: !0 },
160
+ modelModifiers: {}
161
+ },
162
+ emits: ["update:modelValue"],
163
+ setup(i) {
164
+ const n = R(i, "modelValue"), { t: e } = N(), m = y(""), r = y(!1), c = y(""), g = y(!1), h = y();
165
+ let w, u, _;
166
+ function v() {
167
+ w == null || w.abort(), clearTimeout(u), u = void 0, clearTimeout(_), _ = void 0;
168
+ }
169
+ async function $(l, x, b) {
170
+ if (!b.aborted) {
171
+ try {
172
+ const B = await L.listClients(l, b);
173
+ if (b.aborted) return;
174
+ const S = B.find((k) => k.clientId === x);
175
+ if ((S == null ? void 0 : S.status) === "connected" && (g.value = !0), (S == null ? void 0 : S.status) === "connected" && S.profileStatus === "ready") {
176
+ v(), g.value = !1, h.value = S, _ = setTimeout(() => {
177
+ n.value = !1;
178
+ }, 1800);
179
+ return;
180
+ }
181
+ } catch {
182
+ }
183
+ b.aborted || (u = setTimeout(() => {
184
+ $(l, x, b);
185
+ }, 3e3));
186
+ }
187
+ }
188
+ async function d() {
189
+ v();
190
+ const l = new AbortController();
191
+ w = l, m.value = "", c.value = "", g.value = !1, h.value = void 0, r.value = !0;
192
+ try {
193
+ const x = H.getBusinessId();
194
+ if (!x)
195
+ throw new Error(e("connect.whatsappBot.errors.selectBusiness"));
196
+ const b = await L.createClient(
197
+ x,
198
+ l.signal
199
+ ), B = await st.toDataURL(b.qr, {
200
+ width: 224,
201
+ margin: 2,
202
+ errorCorrectionLevel: "M"
203
+ });
204
+ l.signal.aborted || (m.value = B, $(x, b.clientId, l.signal));
205
+ } catch (x) {
206
+ l.signal.aborted || (c.value = x instanceof Error ? x.message : e("connect.whatsappBot.errors.loadQr"));
207
+ } finally {
208
+ l.signal.aborted || (r.value = !1);
209
+ }
210
+ }
211
+ return U(
212
+ n,
213
+ (l) => {
214
+ l ? d() : v();
215
+ },
216
+ { immediate: !0 }
217
+ ), X(v), (l, x) => {
218
+ const b = F("i18n-t"), B = F("FmCircularProgress"), S = F("FmButton"), k = F("FmDialog");
219
+ return s(), A(k, {
220
+ modelValue: n.value,
221
+ "onUpdate:modelValue": x[0] || (x[0] = (f) => n.value = f),
222
+ "min-width": "min(720px, calc(100% - 32px))",
223
+ "max-width": "720px",
224
+ "max-height": "90vh",
225
+ "dismiss-away": ""
226
+ }, {
227
+ "dialog-header": P(() => [
228
+ t("h2", vt, a(o(e)("connect.whatsappBot.connectAccount")), 1)
229
+ ]),
230
+ default: P(() => {
231
+ var f, T, M;
232
+ return [
233
+ h.value ? (s(), p("div", gt, [
234
+ x[1] || (x[1] = t("div", {
235
+ "aria-hidden": "true",
236
+ 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]"
237
+ }, [
238
+ t("svg", {
239
+ width: "32",
240
+ height: "32",
241
+ viewBox: "0 0 24 24",
242
+ fill: "none",
243
+ stroke: "currentColor",
244
+ "stroke-width": "2.2",
245
+ "stroke-linecap": "round",
246
+ "stroke-linejoin": "round"
247
+ }, [
248
+ t("path", { d: "M20 6 9 17l-5-5" })
249
+ ])
250
+ ], -1)),
251
+ t("h3", _t, a(o(e)("connect.whatsappBot.accountConnected")), 1),
252
+ t("p", bt, a(((f = h.value.account) == null ? void 0 : f.businessName) || ((T = h.value.account) == null ? void 0 : T.name) || o(e)("connect.whatsappBot.unnamedAccount")) + " · " + a(((M = h.value.account) == null ? void 0 : M.phoneNumber) || o(e)("connect.whatsappBot.phoneUnavailable")), 1)
253
+ ])) : (s(), p("div", yt, [
254
+ t("div", wt, [
255
+ t("p", Bt, a(o(e)("connect.whatsappBot.scanDescription")), 1),
256
+ t("ol", kt, [
257
+ (s(), p(E, null, J(4, (D) => t("li", {
258
+ key: D,
259
+ class: "flex gap-[12px]"
260
+ }, [
261
+ t("span", Ct, a(D), 1),
262
+ D === 1 ? (s(), p("span", $t, a(o(e)("connect.whatsappBot.steps.openApp")), 1)) : D === 2 ? (s(), A(b, {
263
+ key: 1,
264
+ keypath: "connect.whatsappBot.steps.openSettings",
265
+ tag: "span",
266
+ scope: "global"
267
+ }, {
268
+ menu: P(() => [
269
+ t("b", St, a(o(e)("connect.whatsappBot.menu")), 1)
270
+ ]),
271
+ settings: P(() => [
272
+ t("b", Ft, a(o(e)("connect.whatsappBot.settings")), 1)
273
+ ]),
274
+ _: 1
275
+ })) : D === 3 ? (s(), A(b, {
276
+ key: 2,
277
+ keypath: "connect.whatsappBot.steps.linkDevice",
278
+ tag: "span",
279
+ scope: "global"
280
+ }, {
281
+ linkedDevices: P(() => [
282
+ t("b", It, a(o(e)("connect.whatsappBot.linkedDevices")), 1)
283
+ ]),
284
+ linkDevice: P(() => [
285
+ t("b", At, a(o(e)("connect.whatsappBot.linkDevice")), 1)
286
+ ]),
287
+ _: 1
288
+ })) : (s(), p("span", Tt, a(o(e)("connect.whatsappBot.steps.scanQr")), 1))
289
+ ])), 64))
290
+ ]),
291
+ t("p", Dt, a(o(e)("connect.whatsappBot.connectionNote")), 1)
292
+ ]),
293
+ t("div", Vt, [
294
+ r.value ? (s(), p("div", jt, [
295
+ C(B),
296
+ W(a(o(e)("connect.whatsappBot.generatingQr")), 1)
297
+ ])) : c.value ? (s(), p("div", Nt, [
298
+ t("p", Pt, a(c.value), 1),
299
+ C(S, {
300
+ label: o(e)("connect.whatsappBot.tryAgain"),
301
+ "prepend-icon": "refresh",
302
+ onClick: d
303
+ }, null, 8, ["label"])
304
+ ])) : m.value ? (s(), p("img", {
305
+ key: 2,
306
+ src: m.value,
307
+ alt: o(e)("connect.whatsappBot.qrAlt"),
308
+ width: "224",
309
+ height: "224",
310
+ class: O({ "opacity-20": g.value })
311
+ }, null, 10, Wt)) : I("", !0),
312
+ g.value ? (s(), p("div", Et, [
313
+ C(B),
314
+ W(" " + a(o(e)("connect.whatsappBot.connecting")), 1)
315
+ ])) : I("", !0)
316
+ ])
317
+ ]))
318
+ ];
319
+ }),
320
+ _: 1
321
+ }, 8, ["modelValue"]);
322
+ };
323
+ }
324
+ }), Lt = { 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]" }, Mt = { class: "text-[20px] leading-[28px] font-bold" }, Qt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary max-w-[420px]" }, zt = /* @__PURE__ */ j({
325
+ __name: "WhatsappEmptyState",
326
+ emits: ["connect"],
327
+ setup(i, { emit: n }) {
328
+ const e = n, { t: m } = N();
329
+ return (r, c) => {
330
+ const g = F("FmButton");
331
+ return s(), p("div", Lt, [
332
+ c[1] || (c[1] = t("div", { class: "w-[72px] h-[72px] rounded-full bg-fm-color-primary-oats text-fm-color-primary flex items-center justify-center mb-[12px]" }, [
333
+ t("svg", {
334
+ width: "34",
335
+ height: "34",
336
+ viewBox: "0 0 24 24",
337
+ fill: "none",
338
+ stroke: "currentColor",
339
+ "stroke-width": "1.6",
340
+ "stroke-linecap": "round",
341
+ "stroke-linejoin": "round",
342
+ "aria-hidden": "true"
343
+ }, [
344
+ t("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
345
+ t("path", { d: "M9 10h.01M12 10h.01M15 10h.01" })
346
+ ])
347
+ ], -1)),
348
+ t("h2", Mt, a(o(m)("connect.whatsappBot.emptyTitle")), 1),
349
+ t("p", Qt, a(o(m)("connect.whatsappBot.emptyDescription")), 1),
350
+ C(g, {
351
+ class: "mt-[16px]",
352
+ label: o(m)("connect.whatsappBot.connectAccount"),
353
+ "prepend-icon": "add",
354
+ onClick: c[0] || (c[0] = (h) => e("connect"))
355
+ }, null, 8, ["label"])
356
+ ]);
357
+ };
358
+ }
359
+ }), Ht = { class: "max-w-[720px] flex flex-col gap-[20px]" }, Ot = { class: "flex flex-col items-start gap-[8px]" }, Gt = { class: "text-[24px] leading-[32px] font-semibold tracking-[-0.24px]" }, Xt = {
360
+ key: 0,
361
+ role: "status",
362
+ class: "py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
363
+ }, Zt = {
364
+ key: 0,
365
+ class: "border-[1px] border-fm-color-neutral-gray-100 rounded-[16px] p-[24px] flex flex-col gap-[16px]"
366
+ }, Jt = { class: "flex flex-col gap-[4px]" }, Kt = { class: "text-[16px] leading-[24px] font-semibold" }, Rt = { class: "text-[14px] leading-[20px] text-fm-color-typo-secondary" }, Yt = {
367
+ key: 1,
368
+ role: "alert",
369
+ class: "text-[14px] text-fm-color-typo-error"
370
+ }, qt = { class: "flex items-center justify-end gap-[12px] flex-wrap" }, te = {
371
+ key: 0,
372
+ role: "status",
373
+ class: "mr-auto flex items-center gap-[6px] text-[14px] text-fm-color-typo-success"
374
+ }, ee = /* @__PURE__ */ j({
375
+ __name: "WhatsappBotSettings",
376
+ props: {
377
+ businessId: {}
378
+ },
379
+ emits: ["close"],
380
+ setup(i, { emit: n }) {
381
+ const e = i, m = n, { t: r } = N(), c = y(""), g = y(""), h = y(!0), w = y(!1), u = y(!1), _ = y(""), v = y(!1), $ = ot, d = V(
382
+ () => !w.value || u.value || c.value === g.value || c.value.length > $
383
+ );
384
+ let l, x;
385
+ function b() {
386
+ clearTimeout(x), v.value = !1;
387
+ }
388
+ async function B() {
389
+ l == null || l.abort(), b();
390
+ const k = new AbortController();
391
+ l = k, h.value = !0, w.value = !1, u.value = !1, _.value = "", c.value = "", g.value = "";
392
+ try {
393
+ if (!e.businessId)
394
+ throw new Error(r("connect.whatsappBot.errors.selectBusiness"));
395
+ const f = await L.getSettings(
396
+ e.businessId,
397
+ k.signal
398
+ );
399
+ if (k.signal.aborted) return;
400
+ c.value = f.botInstructions, g.value = f.botInstructions, w.value = !0;
401
+ } catch (f) {
402
+ k.signal.aborted || (_.value = f instanceof Error ? f.message : r("connect.whatsappBot.errors.loadSettings"));
403
+ } finally {
404
+ k.signal.aborted || (h.value = !1);
405
+ }
406
+ }
407
+ async function S() {
408
+ if (d.value) return;
409
+ l == null || l.abort();
410
+ const k = new AbortController();
411
+ l = k, u.value = !0, _.value = "", b();
412
+ try {
413
+ const f = await L.saveSettings(
414
+ e.businessId,
415
+ { botInstructions: c.value },
416
+ k.signal
417
+ );
418
+ if (k.signal.aborted) return;
419
+ g.value = f.botInstructions, c.value = f.botInstructions, v.value = !0, x = setTimeout(() => {
420
+ v.value = !1;
421
+ }, 2500);
422
+ } catch (f) {
423
+ k.signal.aborted || (_.value = f instanceof Error ? f.message : r("connect.whatsappBot.errors.saveSettings"));
424
+ } finally {
425
+ k.signal.aborted || (u.value = !1);
426
+ }
427
+ }
428
+ return U(c, b, { flush: "sync" }), U(() => e.businessId, B, { immediate: !0 }), X(() => {
429
+ l == null || l.abort(), b();
430
+ }), (k, f) => {
431
+ const T = F("FmButton"), M = F("FmCircularProgress"), D = F("FmTextarea"), K = F("FmIcon");
432
+ return s(), p("div", Ht, [
433
+ t("div", Ot, [
434
+ C(T, {
435
+ variant: "plain",
436
+ "prepend-icon": "chevron_left",
437
+ label: o(r)("connect.navigation.whatsappBot"),
438
+ disabled: u.value,
439
+ onClick: f[0] || (f[0] = (G) => m("close"))
440
+ }, null, 8, ["label", "disabled"]),
441
+ t("h1", Gt, a(o(r)("connect.whatsappBot.botSettings.title")), 1)
442
+ ]),
443
+ h.value ? (s(), p("div", Xt, [
444
+ C(M),
445
+ W(" " + a(o(r)("connect.whatsappBot.botSettings.loading")), 1)
446
+ ])) : (s(), p(E, { key: 1 }, [
447
+ w.value ? (s(), p("div", Zt, [
448
+ t("div", Jt, [
449
+ t("h2", Kt, a(o(r)("connect.whatsappBot.botSettings.instructions")), 1),
450
+ t("p", Rt, a(o(r)("connect.whatsappBot.botSettings.description")), 1)
451
+ ]),
452
+ C(D, {
453
+ modelValue: c.value,
454
+ "onUpdate:modelValue": f[1] || (f[1] = (G) => c.value = G),
455
+ "aria-label": o(r)("connect.whatsappBot.botSettings.instructions"),
456
+ placeholder: o(r)("connect.whatsappBot.botSettings.placeholder"),
457
+ "max-length": o($),
458
+ disabled: u.value,
459
+ "show-word-count": "",
460
+ class: "bot-instructions-textarea"
461
+ }, null, 8, ["modelValue", "aria-label", "placeholder", "max-length", "disabled"])
462
+ ])) : I("", !0),
463
+ _.value ? (s(), p("p", Yt, a(_.value), 1)) : I("", !0),
464
+ w.value ? I("", !0) : (s(), A(T, {
465
+ key: 2,
466
+ class: "self-start",
467
+ label: o(r)("connect.whatsappBot.tryAgain"),
468
+ "prepend-icon": "refresh",
469
+ onClick: B
470
+ }, null, 8, ["label"])),
471
+ t("div", qt, [
472
+ v.value ? (s(), p("span", te, [
473
+ C(K, {
474
+ name: "check",
475
+ size: "sm"
476
+ }),
477
+ W(" " + a(o(r)("connect.whatsappBot.botSettings.saved")), 1)
478
+ ])) : I("", !0),
479
+ C(T, {
480
+ variant: "secondary",
481
+ label: o(r)("connect.common.cancel"),
482
+ disabled: u.value,
483
+ onClick: f[2] || (f[2] = (G) => m("close"))
484
+ }, null, 8, ["label", "disabled"]),
485
+ C(T, {
486
+ label: o(r)("connect.common.save"),
487
+ disabled: d.value,
488
+ loading: u.value,
489
+ onClick: S
490
+ }, null, 8, ["label", "disabled", "loading"])
491
+ ])
492
+ ], 64))
493
+ ]);
494
+ };
495
+ }
496
+ }), oe = /* @__PURE__ */ nt(ee, [["__scopeId", "data-v-71900bd1"]]), se = { class: "px-[24px] xs:px-[12px] pt-[20px] pb-[40px] text-fm-color-typo-primary" }, ne = {
497
+ key: 0,
498
+ class: "flex items-center justify-between gap-[16px] flex-wrap min-h-[40px]"
499
+ }, ae = { class: "flex items-center gap-8" }, le = { class: "text-[24px] leading-[32px] font-semibold tracking-[-0.01em]" }, ce = { class: "flex items-center gap-[8px]" }, re = {
500
+ key: 0,
501
+ role: "status",
502
+ class: "mt-[24px] py-[56px] flex flex-col items-center gap-[12px] text-[14px] text-fm-color-typo-secondary"
503
+ }, ie = {
504
+ key: 1,
505
+ 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]"
506
+ }, pe = {
507
+ role: "alert",
508
+ class: "text-[14px] text-fm-color-typo-error"
509
+ }, ve = /* @__PURE__ */ j({
510
+ __name: "WhatsappBot",
511
+ setup(i) {
512
+ const { t: n } = N(), e = y(!1), m = V(() => H.getBusinessId() ?? ""), r = y([]), c = y(!0), g = y("");
513
+ let h, w;
514
+ const u = V(
515
+ () => r.value.filter(
516
+ ($) => $.status === "connected" || $.status === "disconnected"
517
+ )
518
+ );
519
+ async function _($ = !1) {
520
+ clearTimeout(w), h == null || h.abort();
521
+ const d = new AbortController();
522
+ h = d, $ || (c.value = !0, g.value = "");
523
+ try {
524
+ const l = H.getBusinessId();
525
+ if (!l)
526
+ throw new Error(n("connect.whatsappBot.errors.selectBusiness"));
527
+ const x = await L.listClients(l, d.signal);
528
+ d.signal.aborted || (r.value = x, g.value = "");
529
+ } catch (l) {
530
+ !d.signal.aborted && !$ && (g.value = l instanceof Error ? l.message : n("connect.whatsappBot.errors.loadSessions"));
531
+ } finally {
532
+ d.signal.aborted || (c.value = !1, w = setTimeout(() => void _(!0), 1e4));
533
+ }
534
+ }
535
+ const v = y(!1);
536
+ return U(v, ($) => {
537
+ $ || _();
538
+ }), U(
539
+ () => H.getBusinessId(),
540
+ () => {
541
+ v.value = !1, e.value = !1, r.value = [], _();
542
+ },
543
+ { immediate: !0 }
544
+ ), X(() => {
545
+ h == null || h.abort(), clearTimeout(w);
546
+ }), ($, d) => {
547
+ const l = F("FmPill"), x = F("FmButton"), b = F("FmCircularProgress");
548
+ return s(), p(E, null, [
549
+ t("div", se, [
550
+ e.value ? I("", !0) : (s(), p("div", ne, [
551
+ t("div", ae, [
552
+ t("h1", le, a(o(n)("connect.navigation.whatsappBot")), 1),
553
+ C(l, { variant: "beta" })
554
+ ]),
555
+ t("div", ce, [
556
+ C(x, {
557
+ variant: "secondary",
558
+ label: o(n)("connect.whatsappBot.settings"),
559
+ "prepend-icon": "settings",
560
+ onClick: d[0] || (d[0] = (B) => e.value = !0)
561
+ }, null, 8, ["label"]),
562
+ u.value.length ? (s(), A(x, {
563
+ key: 0,
564
+ label: o(n)("connect.whatsappBot.connectAccount"),
565
+ "prepend-icon": "add",
566
+ onClick: d[1] || (d[1] = (B) => v.value = !0)
567
+ }, null, 8, ["label"])) : I("", !0)
568
+ ])
569
+ ])),
570
+ e.value ? (s(), A(oe, {
571
+ key: 1,
572
+ "business-id": m.value,
573
+ onClose: d[2] || (d[2] = (B) => e.value = !1)
574
+ }, null, 8, ["business-id"])) : (s(), p(E, { key: 2 }, [
575
+ c.value ? (s(), p("div", re, [
576
+ C(b),
577
+ W(" " + a(o(n)("connect.whatsappBot.loadingSessions")), 1)
578
+ ])) : g.value ? (s(), p("div", ie, [
579
+ t("p", pe, a(g.value), 1),
580
+ C(x, {
581
+ label: o(n)("connect.whatsappBot.tryAgain"),
582
+ "prepend-icon": "refresh",
583
+ onClick: d[3] || (d[3] = (B) => _())
584
+ }, null, 8, ["label"])
585
+ ])) : u.value.length ? (s(), A(ht, {
586
+ key: 2,
587
+ accounts: u.value
588
+ }, null, 8, ["accounts"])) : (s(), A(zt, {
589
+ key: 3,
590
+ onConnect: d[4] || (d[4] = (B) => v.value = !0)
591
+ }))
592
+ ], 64))
593
+ ]),
594
+ C(Ut, {
595
+ modelValue: v.value,
596
+ "onUpdate:modelValue": d[5] || (d[5] = (B) => v.value = B)
597
+ }, null, 8, ["modelValue"])
598
+ ], 64);
599
+ };
600
+ }
601
+ });
602
+ export {
603
+ ve as default
604
+ };
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as f, useAttrs as y, resolveComponent as b, openBlock as l, createBlock as v, mergeProps as x, unref as t, createSlots as g, withCtx as h, createElementVNode as a, toDisplayString as n, renderSlot as k, createElementBlock as F, createCommentVNode as S } from "vue";
2
- import { Z as d } from "./zod-DCljEP8S.js";
3
- import { u as V } from "./vue-i18n-GqQ0e2Uh.js";
2
+ import { Z as d } from "./zod-DTSByurx.js";
3
+ import { u as V } from "./vue-i18n-Cfu8S_JC.js";
4
4
  const B = { class: "fm-typo-en-body-lg-400 flex gap-4 text-fm-color-typo-primary items-center" }, C = {
5
5
  key: 0,
6
6
  class: "text-fm-color-typo-tertiary"