@tesouro/embedded-components-react 0.8.0 → 0.8.4

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 (97) hide show
  1. package/dist/index.css +0 -61
  2. package/dist/index.d.ts +1 -3
  3. package/dist/lib/ProductsWidget.d.ts +1 -3
  4. package/dist/lib/ReceivablesWidget.d.ts +1 -3
  5. package/dist/lib/monite-sdk.d.ts +6 -59
  6. package/dist/lib/monite-sdk.js +9 -13
  7. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index.js +10 -14
  8. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index112.js +2 -12
  9. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index113.js +19 -26
  10. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index151.js +4 -78
  11. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index17.js +4 -23
  12. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index187.js +24 -1
  13. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index188.js +73 -35
  14. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index189.js +19 -1
  15. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index190.js +19 -16
  16. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index191.js +5 -17
  17. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index192.js +8 -4
  18. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index193.js +11 -16
  19. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index194.js +129 -20
  20. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index195.js +5 -21
  21. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index196.js +2 -2
  22. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index197.js +5 -8
  23. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index198.js +218 -13
  24. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index199.js +31 -17
  25. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index200.js +14 -9
  26. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index201.js +33 -24
  27. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index202.js +19 -12
  28. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index203.js +73 -8
  29. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index204.js +180 -23
  30. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index205.js +13 -13
  31. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index206.js +203 -80
  32. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index207.js +100 -14
  33. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index208.js +61 -97
  34. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index209.js +53 -42
  35. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index210.js +89 -25
  36. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index211.js +43 -1
  37. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index212.js +75 -102
  38. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index213.js +82 -34
  39. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index214.js +12 -171
  40. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index215.js +24 -12
  41. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index216.js +17 -4
  42. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index217.js +4 -69
  43. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index218.js +20 -23
  44. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index219.js +1 -212
  45. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index220.js +17 -92
  46. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index221.js +30 -20
  47. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index222.js +4 -1
  48. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index223.js +21 -17
  49. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index224.js +15 -157
  50. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index225.js +28 -99
  51. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index226.js +28 -43
  52. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index227.js +2 -4
  53. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  54. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +3 -4
  55. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +3 -3
  56. package/package.json +1 -3
  57. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index228.js +0 -24
  58. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index229.js +0 -77
  59. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index230.js +0 -19
  60. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index231.js +0 -22
  61. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index232.js +0 -8
  62. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index233.js +0 -12
  63. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index234.js +0 -13
  64. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index235.js +0 -133
  65. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index236.js +0 -8
  66. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index237.js +0 -8
  67. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index238.js +0 -5
  68. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index239.js +0 -222
  69. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index240.js +0 -34
  70. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index241.js +0 -14
  71. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index242.js +0 -36
  72. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index243.js +0 -22
  73. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index244.js +0 -76
  74. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index245.js +0 -184
  75. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index246.js +0 -16
  76. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index247.js +0 -206
  77. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index248.js +0 -102
  78. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index249.js +0 -66
  79. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index250.js +0 -57
  80. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index251.js +0 -94
  81. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index252.js +0 -43
  82. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index253.js +0 -79
  83. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index254.js +0 -87
  84. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index255.js +0 -14
  85. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index256.js +0 -26
  86. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index257.js +0 -17
  87. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index258.js +0 -5
  88. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index259.js +0 -24
  89. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index260.js +0 -1
  90. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index261.js +0 -22
  91. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index262.js +0 -32
  92. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index263.js +0 -4
  93. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index264.js +0 -23
  94. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index265.js +0 -18
  95. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index266.js +0 -33
  96. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index267.js +0 -31
  97. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index268.js +0 -2
@@ -1,39 +1,77 @@
1
- import { Button as e } from "./index110.js";
2
- import { LoadingSpinner as t } from "./index52.js";
3
- import { Dialog as n, DialogContent as r, DialogDescription as i, DialogFooter as a, DialogHeader as o, DialogTitle as s } from "./index151.js";
4
- import "./index187.js";
5
- import { jsx as c, jsxs as l } from "@emotion/react/jsx-runtime";
6
- import { useLingui as u } from "@lingui/react";
1
+ import { jsx as e, jsxs as t } from "@emotion/react/jsx-runtime";
2
+ import { Box as n, Link as r, Typography as i } from "@mui/material";
3
+ import { useLingui as a } from "@lingui/react";
7
4
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index188.js
8
- var d = ({ open: d, title: f, message: p, children: m, confirmLabel: h, cancelLabel: g, onClose: _, onConfirm: v, container: y, isLoading: b = !1 }) => {
9
- let { i18n: x } = u();
10
- return /* @__PURE__ */ c(n, {
11
- open: d,
12
- onOpenChange: _,
13
- "aria-label": x._("Confirmation dialog"),
14
- children: /* @__PURE__ */ l(r, {
15
- container: y,
16
- showCloseButton: !1,
17
- children: [
18
- /* @__PURE__ */ c(o, { children: /* @__PURE__ */ c(s, { children: f }) }),
19
- /* @__PURE__ */ c(i, { children: p || m }),
20
- /* @__PURE__ */ l(a, { children: [/* @__PURE__ */ c(e, {
21
- onClick: (e) => {
22
- e.stopPropagation(), _();
23
- },
24
- variant: "outline",
25
- children: g
26
- }), /* @__PURE__ */ l(e, {
27
- onClick: (e) => {
28
- e.stopPropagation(), v();
29
- },
30
- disabled: b,
31
- variant: "destructive",
32
- children: [b && /* @__PURE__ */ c(t, { className: "ttw:w-5 ttw:h-5 ttw:border-inherit ttw:border-t-transparent" }), h]
33
- })] })
34
- ]
35
- })
5
+ var o = [
6
+ {
7
+ id: 1,
8
+ question: "Does enrolling in the program affect my credit score?",
9
+ answer: "Nope! During the onboarding process we will only conduct a soft pull on your credit report, which will not affect your personal credit score."
10
+ },
11
+ {
12
+ id: 2,
13
+ question: "Why do I need to provide my bank connection details?",
14
+ answer: "Securely connecting your business bank account allows us to review your cashflow and determine your best loan offers."
15
+ },
16
+ {
17
+ id: 3,
18
+ question: "When should I expect to receive a loan offer?",
19
+ answer: "Once you are enrolled into the program, we will be actively analyzing your financials and creating pre-approved offers that work best for your business needs. We do this to help you avoid debt trap. Loan offers are usually provided within less than 48 hours."
20
+ },
21
+ {
22
+ id: 4,
23
+ question: "How do I repay the loan?",
24
+ answer: "At the moment we support monthly loan repayment once you agree to the loan payment schedule. A fixed amount will be automatically deducted from the bank you linked during the onboarding.In the near future, you can also choose to pay back the loan as a fixed percentage of your daily sales until the loan is fully repaid."
25
+ }
26
+ ], s = () => {
27
+ let { i18n: s } = a();
28
+ return /* @__PURE__ */ t(n, {
29
+ p: 4,
30
+ children: [
31
+ /* @__PURE__ */ t(n, { children: [/* @__PURE__ */ e(i, {
32
+ variant: "h3",
33
+ children: s._("Simplified, fast funding for your growing business")
34
+ }), /* @__PURE__ */ e(i, {
35
+ variant: "subtitle2",
36
+ mt: 2,
37
+ children: s._("Get your business moving and accelerate growth with quick and easy access to funding. Multiple options available.")
38
+ })] }),
39
+ /* @__PURE__ */ t(n, {
40
+ mt: 5,
41
+ children: [/* @__PURE__ */ e(i, {
42
+ mb: 1,
43
+ variant: "h3",
44
+ children: s._("FAQ")
45
+ }), o.map((r) => /* @__PURE__ */ t(n, {
46
+ mt: 3,
47
+ children: [/* @__PURE__ */ e(i, {
48
+ variant: "subtitle2",
49
+ children: s._("{faqQuestion}", { faqQuestion: r.question })
50
+ }), /* @__PURE__ */ e(i, {
51
+ variant: "body1",
52
+ mt: 1,
53
+ children: s._("{faqAnswer}", { faqAnswer: r.answer })
54
+ })]
55
+ }, r.id))]
56
+ }),
57
+ /* @__PURE__ */ e(n, {
58
+ mt: 5,
59
+ children: /* @__PURE__ */ t(i, {
60
+ variant: "body2",
61
+ children: [
62
+ s._("All loans are subject to credit approval. Your terms may vary. Flourish Capital loans are issued by Kanmon. California Loans are made pursuant to a Department of Financial Protection and Innovation California Lenders Law License. Read more about Kanmon"),
63
+ " ",
64
+ /* @__PURE__ */ e(r, {
65
+ target: "_blank",
66
+ rel: "noopener noreferrer",
67
+ href: "https://kanmon.com",
68
+ children: s._("here.")
69
+ })
70
+ ]
71
+ })
72
+ })
73
+ ]
36
74
  });
37
75
  };
38
76
  //#endregion
39
- export { d as ConfirmationModal };
77
+ export { s as FinanceFaqDetails };
@@ -1 +1,19 @@
1
- import "./index188.js";
1
+ import { Dialog as e } from "./index117.js";
2
+ import "./index118.js";
3
+ import { FinanceFaqDetails as t } from "./index188.js";
4
+ import { useState as n } from "react";
5
+ import { Fragment as r, jsx as i, jsxs as a } from "@emotion/react/jsx-runtime";
6
+ //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index189.js
7
+ var o = ({ children: o }) => {
8
+ let [s, c] = n(!1);
9
+ return /* @__PURE__ */ a(r, { children: [o({ openModal: () => {
10
+ c(!0);
11
+ } }), /* @__PURE__ */ i(e, {
12
+ open: s,
13
+ onClose: () => c(!1),
14
+ alignDialog: "right",
15
+ children: /* @__PURE__ */ i(t, {})
16
+ })] });
17
+ };
18
+ //#endregion
19
+ export { o as FinanceFaqWrapper };
@@ -1,19 +1,22 @@
1
- import { Fragment as e } from "react";
2
- import { jsx as t, jsxs as n } from "@emotion/react/jsx-runtime";
1
+ import { jsx as e } from "@emotion/react/jsx-runtime";
2
+ import { Box as t, useTheme as n } from "@mui/material";
3
3
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index190.js
4
- function r(r, i) {
5
- let a = r.split("\0");
6
- return a.length === 1 ? /* @__PURE__ */ t("span", { children: r }) : /* @__PURE__ */ t("span", {
7
- className: "ttw:flex ttw:min-w-0",
8
- children: a.map((r, o) => /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("span", {
9
- className: "ttw:whitespace-pre-wrap",
10
- children: r
11
- }), o < a.length - 1 && /* @__PURE__ */ t("span", {
12
- className: "ttw:min-w-[4ch] ttw:shrink-[9999] ttw:truncate",
13
- title: i,
14
- children: i
15
- })] }, o))
4
+ var r = ({ progress: r }) => {
5
+ let i = n();
6
+ return /* @__PURE__ */ e(t, {
7
+ sx: {
8
+ backgroundColor: i.palette.divider,
9
+ width: "100%",
10
+ height: "6px",
11
+ borderRadius: .5
12
+ },
13
+ children: /* @__PURE__ */ e(t, { sx: {
14
+ backgroundColor: i.palette.primary.main,
15
+ width: `${r}%`,
16
+ height: "6px",
17
+ borderRadius: .5
18
+ } })
16
19
  });
17
- }
20
+ };
18
21
  //#endregion
19
- export { r as messageWithTruncatedName };
22
+ export { r as FinanceProgressBar };
@@ -1,20 +1,8 @@
1
- import { getAPIErrorMessage as e } from "./index18.js";
2
- import { useMoniteContext as t } from "./index36.js";
3
- import { messageWithTruncatedName as n } from "./index190.js";
4
- import { toast as r } from "react-hot-toast";
5
- import { useLingui as i } from "@lingui/react";
1
+ import { useMoniteContext as e } from "./index36.js";
6
2
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index191.js
7
- var a = (a) => {
8
- let { api: o, queryClient: s } = t(), { i18n: c } = i();
9
- return o.finops.postProducts.useMutation(void 0, {
10
- onSuccess: async (e) => {
11
- a?.(e), await o.finops.getProducts.invalidateQueries(s), r.success(n(c._("{name} has been added to the list.", { name: "\0" }), e.name));
12
- },
13
- onError: (t) => {
14
- let n = e(c, t, { defaultMessage: "" });
15
- r.error(n ? c._("Failed to create: {reason}", { reason: n }) : c._("Failed to create"));
16
- }
17
- });
3
+ var t = () => {
4
+ let { api: t } = e();
5
+ return t.finops.getFinancingOffers.useQuery();
18
6
  };
19
7
  //#endregion
20
- export { a as useCreateProduct };
8
+ export { t as useGetFinanceOffers };
@@ -1,8 +1,12 @@
1
1
  import { useMoniteContext as e } from "./index36.js";
2
+ import { toast as t } from "react-hot-toast";
3
+ import { useLingui as n } from "@lingui/react";
2
4
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index192.js
3
- var t = () => {
4
- let { api: t } = e();
5
- return t.finops.getMeasureUnits.useQuery();
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
+ } });
6
10
  };
7
11
  //#endregion
8
- export { t as useGetMeasureUnits };
12
+ export { r as useGetFinancingConnectToken };
@@ -1,18 +1,13 @@
1
- import { useMoniteContext as e } from "./index36.js";
2
- import { messageWithTruncatedName as t } from "./index190.js";
3
- import { toast as n } from "react-hot-toast";
4
- import { useLingui as r } from "@lingui/react";
1
+ import "./index143.js";
2
+ import { createContext as e, useContext as t } from "react";
3
+ import "@emotion/react/jsx-runtime";
4
+ import "@lingui/react";
5
5
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index193.js
6
- var i = (i) => {
7
- let { api: a, queryClient: o } = e(), { i18n: s } = r();
8
- return a.finops.deleteMeasureUnitsId.useMutation(void 0, {
9
- onSuccess: async () => {
10
- i && (await a.finops.getMeasureUnits.invalidateQueries(o), n.success(t(s._("Unit {name} was deleted from the list.", { name: "\0" }), i)));
11
- },
12
- onError: (e) => {
13
- console.error(e), n.error(s._("Failed to delete Unit."));
14
- }
15
- });
16
- };
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
+ }
17
12
  //#endregion
18
- export { i as useDeleteMeasureUnit };
13
+ export { n as KanmonContext, r as useKanmonContext };
@@ -1,24 +1,133 @@
1
- import { getAPIErrorMessage as e } from "./index18.js";
2
- import { useMoniteContext as t } from "./index36.js";
3
- import { messageWithTruncatedName as n } from "./index190.js";
4
- import { toast as r } from "react-hot-toast";
5
- import { useLingui as i } from "@lingui/react";
1
+ import { useMoniteContext as e } from "./index36.js";
2
+ import { useMyEntity as t } from "./index45.js";
3
+ import "./index48.js";
4
+ import { useComponentSettings as n } from "./index71.js";
5
+ import "./index73.js";
6
+ import { useKanmonContext as r } from "./index193.js";
7
+ import { useGetFinanceOffers as i } from "./index191.js";
8
+ import { useGetFinancingConnectToken as a } from "./index192.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";
6
12
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index194.js
7
- var a = (a, o) => {
8
- let { api: s, queryClient: c } = t(), { i18n: l } = i();
9
- return s.finops.postMeasureUnits.useMutation({}, {
10
- onSuccess: async (e) => {
11
- await s.finops.getMeasureUnits.invalidateQueries(c), r.success(n(l._("Unit {name} was added to the list", { name: "\0" }), e.name)), a?.();
12
- },
13
- onError: async (t) => {
14
- let n = e(l, t);
15
- if (n.includes("already exists")) {
16
- o?.(n);
17
- return;
18
- }
19
- r.error(n);
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;
20
36
  }
21
- });
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"));
104
+ }
105
+ m.finops.getFinancingOffers.invalidateQueries(h);
106
+ }
107
+ }
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
+ };
22
131
  };
23
132
  //#endregion
24
- export { a as useCreateMeasureUnit };
133
+ export { f as FinancialApplicationState, p as useFinancing };
@@ -1,24 +1,8 @@
1
- import { getAPIErrorMessage as e } from "./index18.js";
2
- import { useMoniteContext as t } from "./index36.js";
3
- import { messageWithTruncatedName as n } from "./index190.js";
4
- import { toast as r } from "react-hot-toast";
5
- import { useLingui as i } from "@lingui/react";
1
+ import { useMoniteContext as e } from "./index36.js";
6
2
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index195.js
7
- var a = (a, o, s) => {
8
- let { api: c, queryClient: l } = t(), { i18n: u } = i();
9
- return c.finops.patchMeasureUnitsId.useMutation({ path: { unit_id: a } }, {
10
- onSuccess: async (e) => {
11
- await Promise.all([c.finops.getMeasureUnits.invalidateQueries(l), c.finops.getMeasureUnitsId.invalidateQueries({ parameters: { path: { unit_id: a } } }, l)]), r.success(n(u._("Unit {name} was updated", { name: "\0" }), e.name)), o?.();
12
- },
13
- onError: (t) => {
14
- let n = e(u, t);
15
- if (n.includes("already exists")) {
16
- s?.(n);
17
- return;
18
- }
19
- r.error(n);
20
- }
21
- });
3
+ var t = () => {
4
+ let { api: t } = e();
5
+ return t.finops.postFinancingInvoices.useMutation({}, { onError: () => {} });
22
6
  };
23
7
  //#endregion
24
- export { a as useUpdateMeasureUnit };
8
+ export { t as useFinanceAnInvoice };
@@ -2,7 +2,7 @@ import { useMoniteContext as e } from "./index36.js";
2
2
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index196.js
3
3
  var t = (t, n = !0) => {
4
4
  let { api: r } = e();
5
- return r.finops.getProducts.useQuery({ query: t }, { enabled: n });
5
+ return r.finops.getFinancingInvoices.useQuery({ query: t }, { enabled: n });
6
6
  };
7
7
  //#endregion
8
- export { t as useGetProducts };
8
+ export { t as useGetFinancedInvoices };
@@ -1,8 +1,5 @@
1
- import { useMoniteContext as e } from "./index36.js";
2
- //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index197.js
3
- var t = (t, n = !0) => {
4
- let { api: r } = e();
5
- return r.finops.getProductsId.useQuery({ path: { product_id: t } }, { enabled: n });
6
- };
7
- //#endregion
8
- export { t as useGetProductById };
1
+ import "./index191.js";
2
+ import "./index192.js";
3
+ import "./index194.js";
4
+ import "./index195.js";
5
+ import "./index196.js";