@feedmepos/mf-connect 0.1.98-beta.79 → 0.1.98-beta.80

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 (128) hide show
  1. package/dist/{App-BffPZGzn.js → App-DievprEi.js} +49 -49
  2. package/dist/{AuditLogs-D3MEmFSx.js → AuditLogs-DrdqOhZL.js} +13 -13
  3. package/dist/{Bin-Jw_wcgsC.js → Bin-Ci2k3z77.js} +8 -8
  4. package/dist/{Broadcast-DOw7z6bn.js → Broadcast-CpDMAG1o.js} +12 -12
  5. package/dist/{CampaignAnalytic-XXjhRtfl.js → CampaignAnalytic-uRyGaLaN.js} +7 -7
  6. package/dist/{CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DkWeDf14.js → CampaignTypeDialog.vue_vue_type_script_setup_true_lang-DtGe2Og1.js} +8 -8
  7. package/dist/{Card-D_rB1X9o.js → Card-tb98Kyr-.js} +23 -23
  8. package/dist/{Collections-Da1I5--J.js → Collections-P1S5WjnJ.js} +8 -8
  9. package/dist/{Credit-DJuBjxVe.js → Credit-DwK7JYf-.js} +12 -12
  10. package/dist/{DateRangeChip.vue_vue_type_script_setup_true_lang-CowFIZ3q.js → DateRangeChip.vue_vue_type_script_setup_true_lang-Cyk0iIsd.js} +1 -1
  11. package/dist/{EditCampaignSheet.vue_vue_type_script_setup_true_lang-pI1jnJn4.js → EditCampaignSheet.vue_vue_type_script_setup_true_lang-8r29jKh9.js} +35 -35
  12. package/dist/{EffectSheet.vue_vue_type_style_index_0_lang-BrBy93g0.js → EffectSheet.vue_vue_type_style_index_0_lang-BML_-v8I.js} +8 -8
  13. package/dist/{Experience-F4_hPy4x.js → Experience-BejtRlOj.js} +13 -13
  14. package/dist/{FileSaver.min-C-nhkwVc.js → FileSaver.min-C-hmBaHm.js} +1 -1
  15. package/dist/{Game-Cfe5gux2.js → Game-n8qL896g.js} +13 -13
  16. package/dist/{GiftCardSetup-CGJCg8-o.js → GiftCardSetup-Bgsfcu7N.js} +57 -57
  17. package/dist/{GoalPickerPanel.vue_vue_type_script_setup_true_lang-DTHFJbl8.js → GoalPickerPanel.vue_vue_type_script_setup_true_lang-CzL68PPP.js} +7 -7
  18. package/dist/{Goals-WWe3kZ3W.js → Goals-BB8LJlq3.js} +4 -4
  19. package/dist/{Grab-Dr49Cz71.js → Grab-COq3Ujst.js} +9 -9
  20. package/dist/{ImageInput.vue_vue_type_script_setup_true_lang-CPB7kKVu.js → ImageInput.vue_vue_type_script_setup_true_lang-BmLclEyi.js} +1 -1
  21. package/dist/{Index-TsViXhvK.js → Index-BdkIinaE.js} +10 -10
  22. package/dist/{LocationPicker.vue_vue_type_script_setup_true_lang-DmXKvvvk.js → LocationPicker.vue_vue_type_script_setup_true_lang-DsWv3DVb.js} +1 -1
  23. package/dist/{LottieAnimation.vue_vue_type_script_setup_true_lang-BgRr2Bu5.js → LottieAnimation.vue_vue_type_script_setup_true_lang-DvOzGF8c.js} +1 -1
  24. package/dist/{LoyaltyDashboard-D-sVA0uB.js → LoyaltyDashboard-D4Jtpw0n.js} +15 -15
  25. package/dist/{MainLayout-gSvcU53G.js → MainLayout-Ca-Xm3eZ.js} +3 -3
  26. package/dist/{Marketing-BUsNL2jQ.js → Marketing-Cpe4s7NZ.js} +4 -4
  27. package/dist/{MarketingMaterialEdit-DtubIpnt.js → MarketingMaterialEdit-nTeS9VVx.js} +6 -6
  28. package/dist/{Member-9ng7QgMa.js → Member-DgGZ4Cdg.js} +7 -7
  29. package/dist/{MemberDetailSheet.vue_vue_type_script_setup_true_lang-qOMNiTrI.js → MemberDetailSheet.vue_vue_type_script_setup_true_lang-_O3B-FIA.js} +24 -24
  30. package/dist/{MemberImportHistory-BsW3XNAv.js → MemberImportHistory-rdlbDVWU.js} +7 -7
  31. package/dist/{MemberList-DUky4ceB.js → MemberList-BC4aRJTt.js} +14 -14
  32. package/dist/{MemberTransactions-Bu-la_J4.js → MemberTransactions-BFfdTttp.js} +1 -1
  33. package/dist/{MessageInput.vue_vue_type_script_setup_true_lang-BfLVofJG.js → MessageInput.vue_vue_type_script_setup_true_lang-DXajAQy9.js} +12 -12
  34. package/dist/{MetricInfoTooltip.vue_vue_type_script_setup_true_lang-CYqH-qT-.js → MetricInfoTooltip.vue_vue_type_script_setup_true_lang-8xVDzdO3.js} +1 -1
  35. package/dist/{Mission-47XKDAIr.js → Mission-BWCNKTjU.js} +14 -14
  36. package/dist/{Overview-fPy87ZWK.js → Overview--Q7vzhNK.js} +4 -4
  37. package/dist/{Overview-SDSNOe1_.js → Overview-i02Wnyjn.js} +21 -21
  38. package/dist/{Point-Biql3Qi5.js → Point-CiWxqny5.js} +14 -14
  39. package/dist/{Promotion-CBbBWtke.js → Promotion-B0G9qfBm.js} +14 -14
  40. package/dist/{Queue-DJgqg-cC.js → Queue-YfwgYmzH.js} +13 -13
  41. package/dist/{Record-C6Uzc6pD.js → Record-CCuwrPKW.js} +9 -9
  42. package/dist/{Review-C2pjn38Z.js → Review-ymsfdh7Q.js} +2 -2
  43. package/dist/{ReviewFacebookCallback-USPINa9z.js → ReviewFacebookCallback-DyDExWvP.js} +5 -5
  44. package/dist/{ReviewGoogleCallback-Br_CV3Pq.js → ReviewGoogleCallback-DNyg3n2S.js} +5 -5
  45. package/dist/{Reward-Bl6TyJoX.js → Reward-BKIb0ezH.js} +29 -29
  46. package/dist/{RewardGroup.vue_vue_type_script_setup_true_lang-DVu2-HRI.js → RewardGroup.vue_vue_type_script_setup_true_lang-DPaaNgpr.js} +14 -14
  47. package/dist/{RuleGroup.vue_vue_type_script_setup_true_lang-DqnvglII.js → RuleGroup.vue_vue_type_script_setup_true_lang-BLFLybFn.js} +15 -15
  48. package/dist/{Segment-BKBNrfz8.js → Segment-D5_pp7fh.js} +26 -26
  49. package/dist/{SendCollectionSheet.vue_vue_type_script_setup_true_lang-DLskCbGj.js → SendCollectionSheet.vue_vue_type_script_setup_true_lang-BLLjIA-D.js} +15 -15
  50. package/dist/{SendVoucherSheet.vue_vue_type_script_setup_true_lang-BT3-tDl-.js → SendVoucherSheet.vue_vue_type_script_setup_true_lang-BRIcZwnU.js} +4 -4
  51. package/dist/{Setting-BqbtEU61.js → Setting-CD78gIMU.js} +14 -14
  52. package/dist/{SettingAdvertisements-DoHnZG47.js → SettingAdvertisements-C2AIT4s4.js} +12 -12
  53. package/dist/{Settings-HlQyk7g8.js → Settings-DI_tryQV.js} +5 -5
  54. package/dist/{Store-uexWJZhp.js → Store-BV2JTRNZ.js} +27 -27
  55. package/dist/{StoreRewards-BbkTRt3c.js → StoreRewards-Bk55YXyO.js} +15 -15
  56. package/dist/{StoreTransactions.vue_vue_type_script_setup_true_lang-K6q2obBY.js → StoreTransactions.vue_vue_type_script_setup_true_lang-BZZ1fqwg.js} +40 -40
  57. package/dist/{TargetLocationInput.vue_vue_type_script_setup_true_lang-CRfwFvlQ.js → TargetLocationInput.vue_vue_type_script_setup_true_lang-BrEzWVrH.js} +2 -2
  58. package/dist/{Tier-DN6l1PvI.js → Tier-CO2K30Ew.js} +27 -27
  59. package/dist/{Title-4w7I9PNy.js → Title-qProQh3T.js} +23 -23
  60. package/dist/{Transaction-BypZ5Cbs.js → Transaction-qL5L-fE_.js} +2 -2
  61. package/dist/{UserRuleGroup.vue_vue_type_script_setup_true_lang-CVaOiG6q.js → UserRuleGroup.vue_vue_type_script_setup_true_lang-Co1BPScS.js} +6 -6
  62. package/dist/{Voucher-_kyZ6H17.js → Voucher-VFD1LY9Y.js} +19 -19
  63. package/dist/{VoucherEditor.vue_vue_type_script_setup_true_lang-DbrNDu2d.js → VoucherEditor.vue_vue_type_script_setup_true_lang-9QyTl7iq.js} +16 -16
  64. package/dist/WhatsappAccount-CxSGqm7H.js +325 -0
  65. package/dist/WhatsappAccountStatusLabel.vue_vue_type_script_setup_true_lang-D8L6izf0.js +96 -0
  66. package/dist/WhatsappBot-C4Oz7Xwv.js +441 -0
  67. package/dist/WhatsappBotSettings-CKqaWzwE.js +136 -0
  68. package/dist/{ZodTextField.vue_vue_type_script_setup_true_lang-B3BOd7wE.js → ZodTextField.vue_vue_type_script_setup_true_lang-Bcsi94dw.js} +2 -2
  69. package/dist/{app-BUdfgxte.js → app-BEYzXWZO.js} +3906 -3703
  70. package/dist/app.js +1 -1
  71. package/dist/{base.export-gSYuTgGq.js → base.export-S_82Elmg.js} +2 -2
  72. package/dist/{business-CjYxENvr.js → business-DH7djUl8.js} +1 -1
  73. package/dist/{campaign-CNYzUQiR.js → campaign-DlHDgoFX.js} +2 -2
  74. package/dist/{campaign-yvttY7Iz.js → campaign-k_WHxsOR.js} +8 -8
  75. package/dist/{campaign.fn-Bsb9ItkF.js → campaign.fn-B-4JRzft.js} +36 -36
  76. package/dist/{collection.fn-0klvp7AD.js → collection.fn-zQwWDzZT.js} +2 -2
  77. package/dist/{currency-UZt1QX64.js → currency-CQVHXBFe.js} +1 -1
  78. package/dist/{duplicateCampaign-CCr4vLrU.js → duplicateCampaign-YTXMbJTj.js} +2 -2
  79. package/dist/{effect-Dx3ZJxHs.js → effect-CQkVLHWi.js} +1 -1
  80. package/dist/{email-addresses-C0cqEsI0.js → email-addresses-BIoVbPGC.js} +2 -2
  81. package/dist/{helper-C_jOIHaL.js → helper-BCkTvF4m.js} +1 -1
  82. package/dist/{index-D3wRc-GN.js → index-B-bQnb0_.js} +467 -446
  83. package/dist/{index--qbL3r5K.js → index-BAJOC43K.js} +3 -3
  84. package/dist/{index-BWnVV310.js → index-BFIHEBnX.js} +3 -3
  85. package/dist/{index-tS9a8fVh.js → index-BJIQe3QJ.js} +1 -1
  86. package/dist/{index-Cb9hrU0J.js → index-BJkRTH5T.js} +1 -1
  87. package/dist/{index-BLn35ij4.js → index-BOJogkKQ.js} +1 -1
  88. package/dist/{index-9LJ75jOS.js → index-BRPajAkE.js} +7 -7
  89. package/dist/{index-kwMMiU8Z.js → index-BTkxgos0.js} +2 -2
  90. package/dist/{index-U9Y--r1N.js → index-BUP4aHq8.js} +2 -2
  91. package/dist/{index-DWdVixHn.js → index-BYvnqARr.js} +4 -4
  92. package/dist/{index-Bru3cF21.js → index-Bonq819P.js} +1 -1
  93. package/dist/{index-DyaRNZLw.js → index-C6mOI2Pp.js} +1 -1
  94. package/dist/{index-uNe9XFEK.js → index-CDIe15AY.js} +2 -2
  95. package/dist/{index-ChgrDBj1.js → index-CTrcdIkt.js} +2 -2
  96. package/dist/{index-BhP7DpQu.js → index-CpnchVe1.js} +9 -9
  97. package/dist/{index-Dwrv-CFH.js → index-D5AR7A5e.js} +2 -2
  98. package/dist/index-D7-Q86HI.js +54 -0
  99. package/dist/{index-D8i3eZnu.js → index-DdOj8Hew.js} +1 -1
  100. package/dist/{index-Dr0sT8uH.js → index-Dvqguh2B.js} +2 -2
  101. package/dist/{index-C4cDk-o7.js → index-hAKRfE-4.js} +1 -1
  102. package/dist/{index-BgECjFM0.js → index-o2Ga_qaX.js} +18 -7
  103. package/dist/{index.esm2017-DqDs52qt.js → index.esm2017-D0fhMMPG.js} +37 -37
  104. package/dist/{loading-DbSZrkUs.js → loading-C686AMVG.js} +1 -1
  105. package/dist/{lodash-DqWWo2-K.js → lodash-CANlWUWW.js} +1 -1
  106. package/dist/{member-import-CoVI5_0P.js → member-import-UzJ6ByIS.js} +1 -1
  107. package/dist/{membership-SQa4SZUq.js → membership-DCVzFaFy.js} +2 -2
  108. package/dist/{money-Cl_T-LaY.js → money-DuazwoX7.js} +1 -1
  109. package/dist/{number-BOrgnhwZ.js → number-B2HFiV0g.js} +1 -1
  110. package/dist/{objectid-CsDYQ9eX.js → objectid-Bq-oVMdP.js} +6 -6
  111. package/dist/{onboarding-BLU2SSrI.js → onboarding-BxvNxz-9.js} +3 -3
  112. package/dist/{onboardingSetup-jyeouaTv.js → onboardingSetup-CcvKmyx8.js} +2 -2
  113. package/dist/{plugins-t_9JTEIa.js → plugins-C39O5j42.js} +3 -3
  114. package/dist/{reward-BWunDF4U.js → reward-HYt-2nxt.js} +1 -1
  115. package/dist/{rule-DyUt0gcn.js → rule-3xNIYM7z.js} +10 -10
  116. package/dist/style.css +1 -1
  117. package/dist/{template-DNh14IvS.js → template-D37Z_b0m.js} +6 -6
  118. package/dist/{timezone-DpCfnolZ.js → timezone-JwnQgpaU.js} +1 -1
  119. package/dist/{transaction.fn-D8JhcKmt.js → transaction.fn-C5vswLI_.js} +2 -2
  120. package/dist/{trigger-DYyQ4d7Z.js → trigger-Bc6s2cvq.js} +5 -5
  121. package/dist/{useMarketingMaterialActions-BVzjD61l.js → useMarketingMaterialActions-DMGyAXcy.js} +3 -3
  122. package/dist/{usePagination-jqXEShKi.js → usePagination-DLOOwiiY.js} +1 -1
  123. package/dist/{user-Bb-YcUvV.js → user-CTIGugVF.js} +1 -1
  124. package/dist/{vue-i18n-Bud-ZmQ_.js → vue-i18n-Dpic36zz.js} +195 -195
  125. package/dist/{xlsx-NzYW6kUX.js → xlsx-CT9_1SFr.js} +379 -379
  126. package/dist/{zod-DK9AcJ_Q.js → zod-CGVrMcDl.js} +1 -1
  127. package/package.json +1 -1
  128. package/dist/WhatsappBot-CgLUjd8a.js +0 -604
@@ -1,4 +1,4 @@
1
- import { i as Z } from "./plugins-t_9JTEIa.js";
1
+ import { i as Z } from "./plugins-C39O5j42.js";
2
2
  import { h as f } from "vue";
3
3
  function u(e, o) {
4
4
  return e.path.join(".") === o;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedmepos/mf-connect",
3
- "version": "0.1.98-beta.79",
3
+ "version": "0.1.98-beta.80",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -1,604 +0,0 @@
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-Bud-ZmQ_.js";
3
- import { g as Q, b as Y, S as H } from "./index-U9Y--r1N.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
- };