@tesouro/embedded-components-react 0.5.152 → 0.5.153

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 (62) hide show
  1. package/dist/lib/monite-sdk.d.ts +2 -44
  2. package/dist/lib/monite-sdk.js +9 -12
  3. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index.js +10 -13
  4. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index21.js +0 -7
  5. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index22.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index353.js +1 -2
  7. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index373.js +8 -12
  8. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index379.js +1 -5
  9. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index413.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index552.js +21 -13
  11. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index553.js +72 -22
  12. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index554.js +19 -1
  13. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index555.js +20 -21
  14. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index556.js +5 -51
  15. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index557.js +10 -64
  16. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index558.js +11 -167
  17. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index559.js +133 -1
  18. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index560.js +5 -184
  19. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index561.js +8 -1
  20. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index562.js +3 -41
  21. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index563.js +221 -4
  22. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index564.js +11 -21
  23. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index565.js +33 -74
  24. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index566.js +180 -15
  25. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index567.js +201 -17
  26. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index568.js +98 -4
  27. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index569.js +63 -9
  28. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index570.js +55 -11
  29. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index571.js +89 -128
  30. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index572.js +40 -5
  31. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index573.js +75 -4
  32. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index574.js +87 -5
  33. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index575.js +12 -220
  34. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index576.js +23 -11
  35. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index577.js +17 -36
  36. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index578.js +5 -184
  37. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index579.js +20 -202
  38. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index580.js +1 -102
  39. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index581.js +60 -66
  40. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index582.js +28 -53
  41. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index583.js +2 -92
  42. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index584.js +33 -40
  43. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index585.js +14 -75
  44. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index586.js +28 -82
  45. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index587.js +28 -11
  46. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index588.js +2 -26
  47. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index589.js +97 -17
  48. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  49. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js +1 -1
  50. package/package.json +1 -1
  51. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index590.js +0 -5
  52. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index591.js +0 -24
  53. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index592.js +0 -1
  54. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index593.js +0 -64
  55. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index594.js +0 -32
  56. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index595.js +0 -4
  57. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index596.js +0 -36
  58. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index597.js +0 -18
  59. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index598.js +0 -33
  60. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index599.js +0 -31
  61. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index600.js +0 -2
  62. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index601.js +0 -97
@@ -1,12 +1,66 @@
1
- import { useMoniteContext as e } from "./index46.js";
2
- import { toast as t } from "react-hot-toast";
3
- import { useLingui as n } from "@lingui/react";
1
+ import { FinanceFaqWrapper as e } from "./index554.js";
2
+ import { useKanmonContext as t } from "./index558.js";
3
+ import { useFinancing as n } from "./index559.js";
4
+ import "./index562.js";
5
+ import { jsx as r, jsxs as i } from "@emotion/react/jsx-runtime";
6
+ import { Box as a, Button as o, Stack as s, Typography as c, lighten as l, useTheme as u } from "@mui/material";
7
+ import { useLingui as d } from "@lingui/react";
8
+ import f from "@mui/icons-material/Money";
4
9
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index569.js
5
- var r = () => {
6
- let { api: r } = e(), { i18n: i } = n();
7
- return r.finops.postFinancingTokens.useMutation({}, { onError: () => {
8
- t.error(i._("The financing service is currently unavailable. Please reload the page or try again later."));
9
- } });
10
+ var p = () => {
11
+ let { i18n: p } = d(), { startFinanceSession: m } = t(), h = u(), { isLoading: g, isEnabled: _ } = n();
12
+ return _ ? /* @__PURE__ */ i(s, {
13
+ gap: 4,
14
+ sx: { border: `1px solid ${h.palette.divider}` },
15
+ borderRadius: "16px",
16
+ p: 3,
17
+ children: [
18
+ /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(a, {
19
+ sx: {
20
+ backgroundColor: l(h.palette.primary.main, .9),
21
+ borderRadius: "100%",
22
+ width: "40px",
23
+ height: "40px",
24
+ display: "flex",
25
+ justifyContent: "center",
26
+ alignItems: "center",
27
+ p: 2
28
+ },
29
+ children: /* @__PURE__ */ r(f, { sx: {
30
+ color: h.palette.primary.main,
31
+ width: 20,
32
+ height: 20
33
+ } })
34
+ }) }),
35
+ /* @__PURE__ */ i(s, {
36
+ gap: 1,
37
+ children: [/* @__PURE__ */ r(c, {
38
+ variant: "subtitle1",
39
+ children: p._("Invoice financing")
40
+ }), /* @__PURE__ */ r(c, {
41
+ variant: "body1",
42
+ fontWeight: 400,
43
+ children: p._("Apply for a monthly plan loans to manage your business more efficiently")
44
+ })]
45
+ }),
46
+ /* @__PURE__ */ i(s, {
47
+ direction: "row",
48
+ gap: 1,
49
+ alignItems: "center",
50
+ children: [/* @__PURE__ */ r(o, {
51
+ disabled: g,
52
+ onClick: () => m(),
53
+ variant: "outlined",
54
+ sx: { px: 2 },
55
+ children: p._("Apply for loans")
56
+ }), /* @__PURE__ */ r(e, { children: ({ openModal: e }) => /* @__PURE__ */ r(o, {
57
+ onClick: e,
58
+ variant: "text",
59
+ children: p._("Read more")
60
+ }) })]
61
+ })
62
+ ]
63
+ }) : null;
10
64
  };
11
65
  //#endregion
12
- export { r as useGetFinancingConnectToken };
66
+ export { p as FinanceIntegrationCard };
@@ -1,13 +1,57 @@
1
- import "./index241.js";
2
- import { createContext as e, useContext as t } from "react";
3
- import "@emotion/react/jsx-runtime";
4
- import "@lingui/react";
1
+ import { useMoniteContext as e } from "./index46.js";
2
+ import { useCurrencies as t } from "./index62.js";
3
+ import "./index222.js";
4
+ import { Dialog as n } from "./index234.js";
5
+ import "./index235.js";
6
+ import { useGetFinancedInvoices as r } from "./index561.js";
7
+ import "./index562.js";
8
+ import { FinancedInvoiceStatusChip as i } from "./index565.js";
9
+ import { FinanceDetails as a } from "./index566.js";
10
+ import { useState as o } from "react";
11
+ import { Fragment as s, jsx as c, jsxs as l } from "@emotion/react/jsx-runtime";
12
+ import { Box as u, Skeleton as d, Typography as f, useTheme as p } from "@mui/material";
13
+ import { useLingui as m } from "@lingui/react";
5
14
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index570.js
6
- var n = e(null);
7
- function r() {
8
- let e = t(n);
9
- if (!e) throw Error("Could not find KanmonContext. Make sure that you are using \"MoniteProvider\" component before calling this hook.");
10
- return e;
11
- }
15
+ var h = ({ invoice: h, offers: g }) => {
16
+ let { i18n: _ } = m(), v = p(), { locale: y } = e(), [b, x] = o(!1), { formatCurrencyToDisplay: S } = t(), { isLoading: C, data: w } = r({
17
+ invoice_id: h.id,
18
+ type: "receivable"
19
+ }), T = w?.data?.[0] ?? null, E = y.dateFormat, D = T ? S(T.repayment_schedule?.repayment_amount ?? 0, h.currency) : "—", O = T?.repayment_schedule?.repayment_date ? _.date(T?.repayment_schedule?.repayment_date, E) : "—", k = T?.status;
20
+ return C ? /* @__PURE__ */ c(d, {
21
+ variant: "rounded",
22
+ height: 80
23
+ }) : /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l(u, {
24
+ onClick: () => x(!0),
25
+ sx: {
26
+ borderRadius: "16px",
27
+ px: 3,
28
+ py: 2.5,
29
+ display: "flex",
30
+ alignItems: "center",
31
+ justifyContent: "space-between",
32
+ border: `1px solid ${v.palette.divider}`,
33
+ cursor: "pointer"
34
+ },
35
+ children: [/* @__PURE__ */ l(u, { children: [/* @__PURE__ */ c(f, {
36
+ variant: "subtitle2",
37
+ children: _._("Funding for {repaymentAmount}", { repaymentAmount: D })
38
+ }), /* @__PURE__ */ c(f, {
39
+ variant: "body1",
40
+ children: _._("Repayment on {repaymentDate}", { repaymentDate: O })
41
+ })] }), /* @__PURE__ */ c(u, { children: /* @__PURE__ */ c(i, {
42
+ icon: !0,
43
+ status: k ?? "DEFAULTED"
44
+ }) })]
45
+ }), /* @__PURE__ */ c(n, {
46
+ open: b,
47
+ onClose: () => x(!1),
48
+ alignDialog: "right",
49
+ children: /* @__PURE__ */ c(a, {
50
+ invoice: h,
51
+ offers: g?.offers,
52
+ financedInvoice: T
53
+ })
54
+ })] });
55
+ };
12
56
  //#endregion
13
- export { n as KanmonContext, r as useKanmonContext };
57
+ export { h as FinanceOverviewCard };
@@ -1,133 +1,94 @@
1
- import { useMoniteContext as e } from "./index46.js";
2
- import { useMyEntity as t } from "./index139.js";
3
- import "./index144.js";
4
- import { useComponentSettings as n } from "./index220.js";
5
- import "./index222.js";
6
- import { useKanmonContext as r } from "./index570.js";
7
- import { useGetFinanceOffers as i } from "./index568.js";
8
- import { useGetFinancingConnectToken as a } from "./index569.js";
9
- import { useEffect as o, useState as s } from "react";
10
- import { useLingui as c } from "@lingui/react";
11
- import l from "react-script-hook";
1
+ import { FinanceBannerWrapper as e } from "./index552.js";
2
+ import { useKanmonContext as t } from "./index558.js";
3
+ import { useGetFinanceOffers as n } from "./index556.js";
4
+ import { useFinancing as r } from "./index559.js";
5
+ import { useFinanceAnInvoice as i } from "./index560.js";
6
+ import { useGetFinancedInvoices as a } from "./index561.js";
7
+ import "./index562.js";
8
+ import { FinanceOverviewCard as o } from "./index570.js";
9
+ import { useState as s } from "react";
10
+ import { jsx as c, jsxs as l } from "@emotion/react/jsx-runtime";
11
+ import { Box as u, Button as d, Tooltip as f, Typography as p } from "@mui/material";
12
+ import { useLingui as m } from "@lingui/react";
12
13
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index571.js
13
- var u = "https://cdn.sandbox.kanmon.dev/scripts/v2/kanmon-connect.js", d = "https://cdn.kanmon.dev/scripts/v2/kanmon-connect.js", f = {
14
- INIT: "init",
15
- IN_PROGRESS: "in_progress",
16
- PENDING_APPROVAL: "pending_approval",
17
- NO_OFFERS_AVAILABLE: "no_offers",
18
- SERVICING: "servicing",
19
- APPROVED: "approved",
20
- OFFER_ACCEPTED: "offer_accepted",
21
- OFFERS_EXPIRED: "offers_expired"
22
- }, p = () => {
23
- let { apiUrl: p, api: m, queryClient: h, entityId: g } = e(), { isKanmonInitialized: _, toggleKanmon: v, handleButtonText: y, buttonText: b } = r(), { onboardingCallbacks: x } = n(), { i18n: S } = c(), C = a(), { data: w } = i(), { isUSEntity: T } = t(), E = (() => {
24
- switch (w?.business_status) {
25
- case "NEW":
26
- default: return f.INIT;
27
- case "INPUT_REQUIRED": return f.IN_PROGRESS;
28
- case "ONBOARDED": return w?.offers?.length === 0 ? f.PENDING_APPROVAL : w?.offers?.[0]?.status === "NEW" ? f.APPROVED : w?.offers?.[0]?.status === "EXPIRED" ? f.OFFERS_EXPIRED : w?.offers?.[0]?.status === "ACCEPTED" ? f.OFFER_ACCEPTED : f.SERVICING;
29
- }
30
- })(), D = (() => {
31
- try {
32
- let e = new URL(p);
33
- return !["api.dev.monite.com", "api.sandbox.monite.com"].includes(e.hostname);
34
- } catch {
35
- return !0;
36
- }
37
- })() ? d : u, [O] = l({ src: D }), [k, A] = s(!1), j = (e) => {
38
- let t = {
39
- type: "receivable",
40
- status: "NEW",
41
- invoice_id: e?.platformInvoiceId,
42
- document_id: e?.platformInvoiceNumber,
43
- due_date: e?.invoiceDueDate,
44
- issue_date: e?.invoiceIssuedDate,
45
- total_amount: e?.invoiceAmountCents,
46
- currency: "USD",
47
- payer_type: e?.payorType,
48
- payer_business_name: e?.payorBusinessName,
49
- payer_first_name: e?.payorFirstName,
50
- payer_last_name: e?.payorLastName,
51
- requested_amount: e?.amountRequestedForFinancingCents,
52
- principal_amount: e?.principalAmountCents,
53
- repayment_amount: e?.repaymentAmountCents,
54
- advance_amount: e?.invoiceAdvanceAmountCents,
55
- advance_rate_percentage: e?.advanceRatePercentage * 100,
56
- fee_amount: e?.feeAmountCents,
57
- fee_percentage: e?.transactionFeePercentage * 100,
58
- repayment_schedule: {
59
- repayment_date: e?.repaymentSchedule?.schedule?.[0]?.repaymentDate,
60
- repayment_amount: e?.repaymentSchedule?.schedule?.[0]?.repaymentAmountCents,
61
- repayment_fee_amount: e?.repaymentSchedule?.schedule?.[0]?.repaymentFeeAmountCents,
62
- repayment_principal_amount: e?.repaymentSchedule?.schedule?.[0]?.repaymentPrincipalAmountCents
63
- }
64
- };
65
- m.finops.getFinancingInvoices.setQueryData(m.finops.getFinancingInvoices.getQueryKey({ query: {
66
- type: "receivable",
67
- invoice_id: e?.platformInvoiceId
68
- } }), (e) => ({
69
- ...e,
70
- data: [t]
71
- }), h), m.finops.getFinancingInvoices.setQueryData(m.finops.getFinancingInvoices.getQueryKey({ query: {} }), (e) => {
72
- let n = e?.data ? e.data : [];
73
- return {
74
- ...e,
75
- data: [t, ...n]
76
- };
77
- }, h);
78
- }, M = ({ connectToken: e }) => {
79
- window?.KANMON_CONNECT?.start({
80
- connectToken: e,
81
- onEvent: (e) => {
82
- if (e.eventType === "USER_STATE_CHANGED" || e.eventType === "USER_CONFIRMED_INVOICE") {
83
- if (e.eventType === "USER_CONFIRMED_INVOICE") j(e.data.invoice);
84
- else {
85
- switch (e.data.userState) {
86
- case "START_FLOW":
87
- y(S._("Apply for financing"));
88
- break;
89
- case "USER_INPUT_REQUIRED":
90
- e.data.section === "OFFER" ? y(S._("Review terms and sign")) : y(S._("Resume application"));
91
- break;
92
- case "WAITING_FOR_OFFERS":
93
- y(""), (w?.business_status === "INPUT_REQUIRED" || w?.business_status === "NEW") && x.onWorkingCapitalOnboardingComplete?.(g);
94
- break;
95
- case "OFFERS_EXPIRED":
96
- case "NO_OFFERS_EXTENDED":
97
- y("");
98
- break;
99
- case "SERVICING":
100
- y(S._("Financing menu")), w?.business_status === "ONBOARDED" && w?.offers?.[0]?.status === "NEW" && window.localStorage.setItem("isFinanceTabNew", "true");
101
- break;
102
- case "VIEW_OFFERS":
103
- case "OFFER_ACCEPTED": y(S._("Review terms and sign"));
14
+ var h = 5184e5, g = ({ invoice: g }) => {
15
+ let { i18n: _ } = m(), { startFinanceSession: v } = t(), [y, b] = s(!1), x = i(), { isLoading: S, data: C } = a({
16
+ invoice_id: g.id,
17
+ type: "receivable"
18
+ }), { isLoading: w, isEnabled: T, isServicing: E } = r(), { isLoading: D, data: O } = n(), k = !!C?.data?.find((e) => e?.invoice_id === g.id), A = w || S || D, j = ["issued", "partially_paid"].includes(g.status), M = g.due_date ? new Date(g.due_date).getTime() - ((/* @__PURE__ */ new Date()).getTime() + h) > 0 : !1;
19
+ return !T || !E ? null : k ? /* @__PURE__ */ c(u, { children: /* @__PURE__ */ c(o, {
20
+ invoice: g,
21
+ offers: O ?? null
22
+ }) }) : j && M ? /* @__PURE__ */ c(e, { children: /* @__PURE__ */ l(u, {
23
+ sx: {
24
+ display: "flex",
25
+ alignItems: "center",
26
+ gap: 2,
27
+ justifyContent: "space-between"
28
+ },
29
+ children: [/* @__PURE__ */ l(u, {
30
+ sx: { flex: "1 1 0%" },
31
+ children: [/* @__PURE__ */ c(p, {
32
+ variant: "subtitle2",
33
+ children: _._("Don't wait for your client to pay")
34
+ }), /* @__PURE__ */ l(p, {
35
+ variant: "body1",
36
+ children: [
37
+ _._("This invoice can be financed"),
38
+ ".",
39
+ " ",
40
+ /* @__PURE__ */ c(f, {
41
+ arrow: !0,
42
+ title: _._("Invoices that are due within 7 days cannot be financed. Overdue invoices cannot be financed. The loan sum must be within your remaining limit."),
43
+ children: /* @__PURE__ */ c(p, {
44
+ variant: "body1",
45
+ sx: { textDecoration: "underline" },
46
+ component: "span",
47
+ children: _._("Why?")
48
+ })
49
+ })
50
+ ]
51
+ })]
52
+ }), /* @__PURE__ */ c(d, {
53
+ onClick: async () => {
54
+ try {
55
+ b(!0), x.mutate({ invoices: [{
56
+ id: g.id,
57
+ type: "receivable"
58
+ }] }, {
59
+ onError: () => {
60
+ b(!1);
61
+ },
62
+ onSuccess: ({ session_token: e }) => {
63
+ v({
64
+ sessionToken: e,
65
+ component: "SESSION_INVOICE_FLOW_WITH_INVOICE_FILE"
66
+ }), b(!1);
104
67
  }
105
- m.finops.getFinancingOffers.invalidateQueries(h);
106
- }
68
+ });
69
+ } catch {
70
+ b(!1);
107
71
  }
108
- }
109
- });
110
- };
111
- o(() => {
112
- !_ && !O && T && (async () => {
113
- A(!0);
114
- try {
115
- let e = await C.mutateAsync();
116
- M({ connectToken: e.connect_token }), v(!0);
117
- } catch {} finally {
118
- A(!1);
119
- }
120
- })();
121
- }, [O, T]);
122
- let N = O || k, P = T, F = w?.business_status === "ONBOARDED" && w?.offers?.[0]?.status === "CURRENT";
123
- return {
124
- buttonText: b,
125
- applicationState: E,
126
- offer: w?.offers?.[0],
127
- isLoading: N,
128
- isEnabled: P,
129
- isServicing: F
130
- };
72
+ },
73
+ disabled: y || A,
74
+ color: "primary",
75
+ variant: "contained",
76
+ sx: {
77
+ px: 2.5,
78
+ py: 1.5
79
+ },
80
+ children: y ? _._("Loading...") : _._("Get paid now")
81
+ })]
82
+ }) }) : /* @__PURE__ */ c(e, { children: /* @__PURE__ */ l(u, {
83
+ sx: { flex: "1 1 0%" },
84
+ children: [/* @__PURE__ */ c(p, {
85
+ variant: "subtitle2",
86
+ children: _._("This invoice can't be financed")
87
+ }), /* @__PURE__ */ c(p, {
88
+ variant: "body1",
89
+ children: _._("It must be in the “Issued” or “Partially paid” statuses and have more than 7 days till overdue.")
90
+ })]
91
+ }) });
131
92
  };
132
93
  //#endregion
133
- export { f as FinancialApplicationState, p as useFinancing };
94
+ export { g as FinanceInvoice };
@@ -1,8 +1,43 @@
1
- import { useMoniteContext as e } from "./index46.js";
1
+ import { Dialog as e } from "./index234.js";
2
+ import "./index235.js";
3
+ import { useKanmonContext as t } from "./index558.js";
4
+ import { FinanceHowItWorks as n } from "./index568.js";
5
+ import { useState as r } from "react";
6
+ import { jsx as i, jsxs as a } from "@emotion/react/jsx-runtime";
7
+ import { Button as o, Stack as s } from "@mui/material";
8
+ import { useLingui as c } from "@lingui/react";
2
9
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index572.js
3
- var t = () => {
4
- let { api: t } = e();
5
- return t.finops.postFinancingInvoices.useMutation({}, { onError: () => {} });
10
+ var l = () => {
11
+ let { i18n: l } = c(), { startFinanceSession: u } = t(), [d, f] = r(!1);
12
+ return /* @__PURE__ */ a(s, {
13
+ direction: "row",
14
+ gap: 1,
15
+ alignItems: "center",
16
+ children: [
17
+ /* @__PURE__ */ i(o, {
18
+ variant: "text",
19
+ onClick: () => f(!0),
20
+ children: l._("How does invoice financing work?")
21
+ }),
22
+ /* @__PURE__ */ i(o, {
23
+ onClick: () => u(),
24
+ variant: "contained",
25
+ color: "primary",
26
+ sx: {
27
+ px: 2.5,
28
+ py: 1.5,
29
+ height: 40
30
+ },
31
+ children: l._("Financing menu")
32
+ }),
33
+ /* @__PURE__ */ i(e, {
34
+ open: d,
35
+ onClose: () => f(!1),
36
+ alignDialog: "right",
37
+ children: /* @__PURE__ */ i(n, {})
38
+ })
39
+ ]
40
+ });
6
41
  };
7
42
  //#endregion
8
- export { t as useFinanceAnInvoice };
43
+ export { l as FinanceMenuButtons };
@@ -1,8 +1,79 @@
1
1
  import { useMoniteContext as e } from "./index46.js";
2
+ import { useCurrencies as t } from "./index62.js";
3
+ import "./index222.js";
4
+ import { FinanceBannerWrapper as n } from "./index552.js";
5
+ import { FinanceProgressBar as r } from "./index555.js";
6
+ import { FinanceMenuButtons as i } from "./index572.js";
7
+ import { Fragment as a, jsx as o, jsxs as s } from "@emotion/react/jsx-runtime";
8
+ import { Box as c, Typography as l, useTheme as u } from "@mui/material";
9
+ import { useLingui as d } from "@lingui/react";
2
10
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index573.js
3
- var t = (t, n = !0) => {
4
- let { api: r } = e();
5
- return r.finops.getFinancingInvoices.useQuery({ query: t }, { enabled: n });
11
+ var f = ({ offers: f = [] }) => {
12
+ let { componentSettings: p } = e(), { i18n: m } = d(), h = u(), { formatCurrencyToDisplay: g } = t(), _ = f?.[0]?.total_amount ?? 0, v = (f?.[0]?.status === "LATE" ? 0 : f?.[0]?.available_amount) ?? 0, y = v / _ * 100, b = f?.[0]?.status !== "CLOSED" && f?.[0]?.status !== "DEFAULTED";
13
+ return !f || f.length === 0 ? null : /* @__PURE__ */ s(c, {
14
+ maxWidth: "440px",
15
+ width: "100%",
16
+ children: [/* @__PURE__ */ o(l, {
17
+ variant: "subtitle1",
18
+ sx: {
19
+ mb: 3,
20
+ display: "inline-block"
21
+ },
22
+ children: m._("My financing")
23
+ }), /* @__PURE__ */ o(n, { children: /* @__PURE__ */ s(c, {
24
+ sx: {
25
+ display: "flex",
26
+ flexDirection: "column",
27
+ gap: 1.25
28
+ },
29
+ children: [
30
+ /* @__PURE__ */ o(c, { children: b ? /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o(l, {
31
+ variant: "body1",
32
+ children: m._("Remaining limit")
33
+ }), /* @__PURE__ */ s(c, {
34
+ display: "flex",
35
+ alignItems: "center",
36
+ gap: 1,
37
+ children: [/* @__PURE__ */ o(l, {
38
+ variant: "h2",
39
+ fontSize: 24,
40
+ lineHeight: "32px",
41
+ children: g(v, "USD")
42
+ }), /* @__PURE__ */ s(l, {
43
+ component: "span",
44
+ variant: "subtitle1",
45
+ fontSize: 18,
46
+ color: h.palette.grey[400],
47
+ children: ["/ ", g(_, "USD")]
48
+ })]
49
+ })] }) : /* @__PURE__ */ o(l, {
50
+ variant: "h2",
51
+ fontSize: 24,
52
+ children: m._("Not available")
53
+ }) }),
54
+ /* @__PURE__ */ s(c, {
55
+ display: "flex",
56
+ flexDirection: "column",
57
+ gap: 1.5,
58
+ children: [b && /* @__PURE__ */ o(r, { progress: y }), /* @__PURE__ */ o(l, {
59
+ variant: "body1",
60
+ fontSize: 14,
61
+ lineHeight: "22px",
62
+ fontWeight: 400,
63
+ children: (() => {
64
+ switch (f?.[0]?.status) {
65
+ case "DEFAULTED": return m._("Financing is blocked due to a violation of the agreed-upon terms. Please, contact the provider for further details.");
66
+ case "CLOSED": return m._("Financing is not available for your business anymore. Please, contact the provider for further details.");
67
+ case "LATE": return m._("Due to late payment your financing is currently on hold. Please, contact the provider for further details.");
68
+ default: return m._("Your amount available for financing additional invoices.");
69
+ }
70
+ })()
71
+ })]
72
+ }),
73
+ p?.financing?.enableFinanceWidgetButton && /* @__PURE__ */ o(i, {})
74
+ ]
75
+ }) })]
76
+ });
6
77
  };
7
78
  //#endregion
8
- export { t as useGetFinancedInvoices };
79
+ export { f as FinanceLimits };
@@ -1,5 +1,87 @@
1
- import "./index568.js";
2
- import "./index569.js";
3
- import "./index571.js";
4
- import "./index572.js";
5
- import "./index573.js";
1
+ import { Fragment as e } from "react";
2
+ import { jsx as t, jsxs as n } from "@emotion/react/jsx-runtime";
3
+ import { Box as r, List as i, ListItem as a, Typography as o, lighten as s, useTheme as c } from "@mui/material";
4
+ import { useLingui as l } from "@lingui/react";
5
+ import u from "@mui/icons-material/MonetizationOnOutlined";
6
+ //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index574.js
7
+ var d = ({ offers: d }) => {
8
+ let { i18n: f } = l(), p = c();
9
+ return !d || d.length === 0 ? null : /* @__PURE__ */ n(r, {
10
+ width: "100%",
11
+ children: [/* @__PURE__ */ t(o, {
12
+ variant: "subtitle1",
13
+ sx: {
14
+ mb: 3,
15
+ display: "inline-block"
16
+ },
17
+ children: f._("Current offer")
18
+ }), /* @__PURE__ */ t(r, {
19
+ sx: {
20
+ display: "flex",
21
+ gap: 2,
22
+ flexWrap: "wrap"
23
+ },
24
+ children: d.map((c, l) => c?.pricing_plans?.map((d, m) => /* @__PURE__ */ n(r, {
25
+ width: 232,
26
+ height: 148,
27
+ px: 3,
28
+ py: 2.5,
29
+ sx: {
30
+ backgroundColor: p.palette.background.paper,
31
+ borderRadius: "16px",
32
+ border: `1px solid ${p.palette.divider}`
33
+ },
34
+ children: [/* @__PURE__ */ n(r, {
35
+ sx: {
36
+ display: "flex",
37
+ alignItems: "center",
38
+ gap: 1,
39
+ mb: 2
40
+ },
41
+ children: [/* @__PURE__ */ t(u, { sx: {
42
+ fontSize: 24,
43
+ color: s(p.palette.primary.main, .6)
44
+ } }), /* @__PURE__ */ t(o, {
45
+ variant: "body1",
46
+ fontWeight: 500,
47
+ sx: {
48
+ flex: "1 1 0%",
49
+ width: "100%"
50
+ },
51
+ children: f._("Financing plan")
52
+ })]
53
+ }), /* @__PURE__ */ t(i, {
54
+ sx: { p: 0 },
55
+ children: /* @__PURE__ */ n(e, { children: [
56
+ /* @__PURE__ */ t(a, {
57
+ sx: { p: 0 },
58
+ children: /* @__PURE__ */ t(o, {
59
+ variant: "body1",
60
+ fontWeight: 400,
61
+ children: f._("{itemAdvance_rate_percentage}% advance rate", { itemAdvance_rate_percentage: d.advance_rate_percentage / 100 })
62
+ })
63
+ }),
64
+ /* @__PURE__ */ t(a, {
65
+ sx: { p: 0 },
66
+ children: /* @__PURE__ */ t(o, {
67
+ variant: "body1",
68
+ fontWeight: 400,
69
+ children: f._("Pay in {itemRepayment_duration_days} days", { itemRepayment_duration_days: d.repayment_duration_days })
70
+ })
71
+ }),
72
+ /* @__PURE__ */ t(a, {
73
+ sx: { p: 0 },
74
+ children: /* @__PURE__ */ t(o, {
75
+ variant: "body1",
76
+ fontWeight: 400,
77
+ children: f._("{itemFee_percentage}% fee", { itemFee_percentage: d.fee_percentage / 100 })
78
+ })
79
+ })
80
+ ] }, d.advance_rate_percentage)
81
+ })]
82
+ }, `${c.available_amount}-${l}-${c.total_amount}-${m}`)))
83
+ })]
84
+ });
85
+ };
86
+ //#endregion
87
+ export { d as FinanceOffers };