@tesouro/embedded-components-react 0.5.150 → 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 (71) 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/settings-widget/tags/feature/dist/index10.js +39 -39
  49. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index11.js +32 -30
  50. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index12.js +77 -72
  51. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index5.js +9 -1
  52. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index6.js +27 -23
  53. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index7.js +21 -13
  54. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index8.js +64 -48
  55. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/feature/dist/index9.js +107 -92
  56. package/dist/libs/tesouro-embedded-components-react/settings-widget/tags/ui/dist/index4.js +23 -15
  57. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js +1 -1
  59. package/package.json +1 -1
  60. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index590.js +0 -5
  61. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index591.js +0 -24
  62. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index592.js +0 -1
  63. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index593.js +0 -64
  64. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index594.js +0 -32
  65. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index595.js +0 -4
  66. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index596.js +0 -36
  67. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index597.js +0 -18
  68. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index598.js +0 -33
  69. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index599.js +0 -31
  70. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index600.js +0 -2
  71. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index601.js +0 -97
@@ -1 +1,133 @@
1
- import "./index558.js";
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 "./index558.js";
7
+ import { useGetFinanceOffers as i } from "./index556.js";
8
+ import { useGetFinancingConnectToken as a } from "./index557.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";
12
+ //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index559.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"));
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
+ };
131
+ };
132
+ //#endregion
133
+ export { f as FinancialApplicationState, p as useFinancing };
@@ -1,187 +1,8 @@
1
- import { Scope as e } from "../../shared/data-access/dist/lib/scopes.js";
2
- import "../../shared/data-access/dist/index.js";
3
- import { useMoniteContext as t } from "./index46.js";
4
- import { Button as n } from "./index55.js";
5
- import { MoniteScopedProviders as r } from "./index241.js";
6
- import { DropdownMenu as i, DropdownMenuContent as a, DropdownMenuItem as o, DropdownMenuTrigger as s } from "./index54.js";
7
- import { useUserPermissions as c } from "./index118.js";
8
- import { GetNoRowsOverlay as l } from "./index250.js";
9
- import { DataTable as u } from "./index255.js";
10
- import { hasSelectedText as d } from "./index256.js";
11
- import { getTagCategoryLabel as f } from "./index555.js";
12
- import { useTags as p } from "./index556.js";
13
- import { TagFormModal as m } from "./index558.js";
14
- import { UserCell as h } from "./index552.js";
15
- import { ConfirmDeleteModal as g } from "./index553.js";
16
- import "./index554.js";
17
- import "./index559.js";
18
- import { useCallback as _, useMemo as v, useState as y } from "react";
19
- import { ArrowDown as b, ArrowUp as x, ArrowUpDown as S, MoreVertical as C, Trash as w } from "lucide-react";
20
- import { Fragment as ee, jsx as T, jsxs as E } from "@emotion/react/jsx-runtime";
21
- import { useLingui as D } from "@lingui/react";
1
+ import { useMoniteContext as e } from "./index46.js";
22
2
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index560.js
23
- var O = (e) => /* @__PURE__ */ T(r, { children: /* @__PURE__ */ T(k, { ...e }) }), k = ({ onChangeSort: r, showCreationModal: O }) => {
24
- let { i18n: k } = D(), { api: A, locale: j, componentSettings: M } = t(), [N, P] = y(void 0), [F, I] = y(M.tags.pageSizeOptions[0]), [L, R] = y({
25
- field: "created_at",
26
- sort: "desc"
27
- }), [z, B] = y(void 0), [V, H] = y(!1), [U, W] = y(!1), { tagsWithKeywords: G } = p({}), K = c().has(e.AccountingConfigWriteOrg), { data: q, isLoading: J, isError: Y, refetch: X } = A.finops.getTags.useQuery({ query: {
28
- sort: L.field,
29
- order: L.sort,
30
- limit: F,
31
- pagination_token: N
32
- } }), Z = _(() => {
33
- H(!1);
34
- }, []), Q = _(() => {
35
- B(void 0), H(!1), W(!1);
36
- }, []), $ = v(() => [{
37
- id: L.field,
38
- desc: L.sort === "desc"
39
- }], [L]), te = _((e) => {
40
- let t = typeof e == "function" ? e($) : e;
41
- if (t.length > 0) {
42
- let e = {
43
- field: t[0].id,
44
- sort: t[0].desc ? "desc" : "asc"
45
- };
46
- R(e), r?.(e);
47
- }
48
- P(void 0);
49
- }, [$, r]), ne = (q?.data ?? []).map((e) => ({
50
- ...e,
51
- keywords: G[e.id]?.join(", ")
52
- })), re = v(() => [
53
- {
54
- accessorKey: "name",
55
- header: ({ column: e }) => {
56
- let t = e.getIsSorted();
57
- return /* @__PURE__ */ E("div", {
58
- className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
59
- children: [k._("Name"), /* @__PURE__ */ T(n, {
60
- variant: "ghost",
61
- onClick: () => e.toggleSorting(t === "asc"),
62
- children: T(t === "asc" ? x : t === "desc" ? b : S, { className: "ttw:size-4" })
63
- })]
64
- });
65
- },
66
- cell: ({ row: e }) => /* @__PURE__ */ T("span", { children: e.original.name })
67
- },
68
- {
69
- accessorKey: "category",
70
- header: k._("Category"),
71
- cell: ({ row: e }) => /* @__PURE__ */ T("span", { children: f(e.original.category, k) })
72
- },
73
- {
74
- accessorKey: "keywords",
75
- header: k._("Keywords"),
76
- cell: ({ row: e }) => /* @__PURE__ */ T("span", { children: e.original.keywords })
77
- },
78
- {
79
- accessorKey: "created_at",
80
- header: ({ column: e }) => {
81
- let t = e.getIsSorted();
82
- return /* @__PURE__ */ E("div", {
83
- className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-inherit",
84
- children: [k._("Created at"), /* @__PURE__ */ T(n, {
85
- variant: "ghost",
86
- onClick: () => e.toggleSorting(t === "asc"),
87
- children: T(t === "asc" ? x : t === "desc" ? b : S, { className: "ttw:size-4" })
88
- })]
89
- });
90
- },
91
- cell: ({ row: e }) => /* @__PURE__ */ T("span", { children: k.date(e.original.created_at, j.dateFormat) })
92
- },
93
- {
94
- accessorKey: "updated_at",
95
- header: k._("Updated at"),
96
- cell: ({ row: e }) => /* @__PURE__ */ T("span", { children: k.date(e.original.updated_at, j.dateFormat) })
97
- },
98
- {
99
- accessorKey: "created_by_entity_user_id",
100
- header: k._("Created by"),
101
- cell: ({ row: e }) => e.original.created_by_entity_user_id ? /* @__PURE__ */ T(h, { id: e.original.created_by_entity_user_id }) : null
102
- },
103
- {
104
- id: "actions",
105
- header: () => /* @__PURE__ */ T("div", {
106
- className: "ttw:text-right",
107
- children: k._("Actions")
108
- }),
109
- cell: ({ row: e }) => K ? /* @__PURE__ */ E(i, { children: [/* @__PURE__ */ T(s, {
110
- asChild: !0,
111
- children: /* @__PURE__ */ T("div", {
112
- className: "ttw:flex ttw:justify-end ttw:gap-2",
113
- children: /* @__PURE__ */ E(n, {
114
- variant: "ghost",
115
- className: "ttw:size-5 ttw:p-2",
116
- children: [/* @__PURE__ */ T("span", {
117
- className: "ttw:sr-only",
118
- children: k._("Open actions menu")
119
- }), /* @__PURE__ */ T(C, { className: "ttw:size-4" })]
120
- })
121
- })
122
- }), /* @__PURE__ */ T(a, {
123
- align: "end",
124
- children: /* @__PURE__ */ E(o, {
125
- onClick: (t) => {
126
- t.stopPropagation(), B(e.original), W(!0);
127
- },
128
- children: [/* @__PURE__ */ T(w, { className: "ttw:text-red-700" }), k._("Delete")]
129
- })
130
- })] }) : null
131
- }
132
- ], [
133
- k,
134
- j.dateFormat,
135
- K
136
- ]);
137
- return /* @__PURE__ */ E(ee, { children: [
138
- /* @__PURE__ */ T("div", {
139
- className: "ttw:flex ttw:flex-col ttw:overflow-hidden ttw:min-h-125",
140
- children: /* @__PURE__ */ T(u, {
141
- columns: re,
142
- data: ne,
143
- sorting: $,
144
- onSortingChange: te,
145
- pageSize: F,
146
- onPageSizeChange: I,
147
- nextPaginationToken: q?.next_pagination_token ?? void 0,
148
- prevPaginationToken: q?.prev_pagination_token ?? void 0,
149
- onPaginationTokenChange: P,
150
- onRowClick: (e) => {
151
- d() || (B(e), H(!0));
152
- },
153
- children: /* @__PURE__ */ T(l, {
154
- isLoading: J,
155
- dataLength: q?.data.length || 0,
156
- isFiltering: !1,
157
- isSearching: !1,
158
- isError: Y,
159
- onCreate: O,
160
- refetch: X,
161
- entityName: k._("Tags"),
162
- noDataTitle: k._("No Tags"),
163
- noDataDescription1: k._("You don't have any tags yet."),
164
- actionButtonLabel: k._("Create new tag"),
165
- actionOptions: [k._("Tag")],
166
- type: "no-data"
167
- })
168
- })
169
- }),
170
- /* @__PURE__ */ T(m, {
171
- tag: z,
172
- open: V,
173
- onClose: Z,
174
- isDeleteAllowed: K ?? !1,
175
- onDelete: (e) => {
176
- K && (B(e), W(!0));
177
- }
178
- }),
179
- z && /* @__PURE__ */ T(g, {
180
- tag: z,
181
- modalOpened: U,
182
- onClose: Q
183
- })
184
- ] });
3
+ var t = () => {
4
+ let { api: t } = e();
5
+ return t.finops.postFinancingInvoices.useMutation({}, { onError: () => {} });
185
6
  };
186
7
  //#endregion
187
- export { O as TagsTable };
8
+ export { t as useFinanceAnInvoice };
@@ -1 +1,8 @@
1
- import "./index560.js";
1
+ import { useMoniteContext as e } from "./index46.js";
2
+ //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index561.js
3
+ var t = (t, n = !0) => {
4
+ let { api: r } = e();
5
+ return r.finops.getFinancingInvoices.useQuery({ query: t }, { enabled: n });
6
+ };
7
+ //#endregion
8
+ export { t as useGetFinancedInvoices };
@@ -1,43 +1,5 @@
1
- import { Scope as e } from "../../shared/data-access/dist/lib/scopes.js";
2
- import "../../shared/data-access/dist/index.js";
3
- import { Button as t } from "./index55.js";
4
- import { MoniteScopedProviders as n } from "./index241.js";
5
- import { useUserPermissions as r } from "./index118.js";
6
- import { AccessRestriction as i } from "./index251.js";
7
- import "./index253.js";
8
- import { PageHeader as a } from "./index330.js";
9
- import { TagFormModal as o } from "./index558.js";
1
+ import "./index556.js";
2
+ import "./index557.js";
10
3
  import "./index559.js";
11
- import { TagsTable as s } from "./index560.js";
4
+ import "./index560.js";
12
5
  import "./index561.js";
13
- import { useCallback as c, useState as l } from "react";
14
- import { Fragment as u, jsx as d, jsxs as f } from "@emotion/react/jsx-runtime";
15
- import { useLingui as p } from "@lingui/react";
16
- //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index562.js
17
- var m = () => /* @__PURE__ */ d(n, { children: /* @__PURE__ */ d(h, {}) }), h = () => {
18
- let { i18n: n } = p(), [m, h] = l(!1), g = c(() => {
19
- h(!0);
20
- }, []), _ = c(() => {
21
- h(!1);
22
- }, []), v = r(), y = v.has(e.AccountingConfigWriteOrg), b = v.has(e.AccountingConfigReadOrg), x = v.has(e.AccountingConfigWriteOrg);
23
- return /* @__PURE__ */ f(u, { children: [
24
- /* @__PURE__ */ d(a, {
25
- title: /* @__PURE__ */ d(u, { children: n._("Tags") }),
26
- extra: /* @__PURE__ */ d(t, {
27
- size: "lg",
28
- disabled: !y,
29
- onClick: g,
30
- children: n._("Create new")
31
- })
32
- }),
33
- !b && /* @__PURE__ */ d(i, {}),
34
- b && /* @__PURE__ */ d(s, { showCreationModal: g }),
35
- /* @__PURE__ */ d(o, {
36
- open: m,
37
- onClose: _,
38
- isDeleteAllowed: x
39
- })
40
- ] });
41
- };
42
- //#endregion
43
- export { m as Tags };
@@ -1,5 +1,222 @@
1
- import "./index558.js";
2
- import "./index559.js";
3
- import "./index560.js";
4
- import "./index561.js";
1
+ import { useCurrencies as e } from "./index62.js";
2
+ import "./index222.js";
3
+ import { MoniteScopedProviders as t } from "./index241.js";
4
+ import { FinanceBannerWrapper as n } from "./index552.js";
5
+ import { FinanceFaqWrapper as r } from "./index554.js";
6
+ import { FinanceProgressBar as i } from "./index555.js";
7
+ import { useKanmonContext as a } from "./index558.js";
8
+ import { FinancialApplicationState as o, useFinancing as s } from "./index559.js";
5
9
  import "./index562.js";
10
+ import { useState as c } from "react";
11
+ import { Fragment as l, jsx as u, jsxs as d } from "@emotion/react/jsx-runtime";
12
+ import { Box as f, Button as p, CircularProgress as m, Stack as h, Typography as g, useMediaQuery as _, useTheme as v } from "@mui/material";
13
+ import { useLingui as y } from "@lingui/react";
14
+ //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index563.js
15
+ var b = "financing_banner_hidden", x = 605800, S = (e) => /* @__PURE__ */ u(t, { children: /* @__PURE__ */ u(C, { ...e }) }), C = ({ enableServicingBanner: t = !1, handleViewDetails: S }) => {
16
+ let { i18n: C } = y(), { startFinanceSession: w } = a(), T = v(), E = _(T.breakpoints.down("lg")), { formatCurrencyToDisplay: D } = e(), { buttonText: O, isLoading: k, isEnabled: A, applicationState: j, isServicing: M, offer: N } = s(), P = N?.total_amount ?? 0, F = (N?.status === "LATE" ? 0 : N?.available_amount) ?? 0, I = F / P * 100, L = N?.status !== "CLOSED" && N?.status !== "DEFAULTED", [R, z] = c(() => {
17
+ let e = JSON.parse(JSON.parse(JSON.stringify(sessionStorage.getItem(b))));
18
+ if (e) return e.isHidden;
19
+ let t = JSON.parse(JSON.parse(JSON.stringify(localStorage.getItem(b))));
20
+ return t ? t.expires_at && (/* @__PURE__ */ new Date()).getTime() > t.expires_at ? (localStorage.removeItem(b), !1) : t.isHidden : !1;
21
+ }), B = t && M, V = j !== o.PENDING_APPROVAL && j !== o.NO_OFFERS_AVAILABLE && j !== o.OFFERS_EXPIRED;
22
+ return R || j === o.SERVICING && !t || !A ? null : /* @__PURE__ */ d(n, {
23
+ shouldApplyFinanceStyles: B,
24
+ children: [/* @__PURE__ */ d(f, {
25
+ display: "flex",
26
+ alignItems: E && !B ? "flex-end" : "center",
27
+ flexDirection: E && !B ? "column" : "row",
28
+ justifyContent: "space-between",
29
+ gap: 2,
30
+ width: "100%",
31
+ height: "100%",
32
+ children: [/* @__PURE__ */ u(f, {
33
+ sx: {
34
+ width: "100%",
35
+ display: "flex",
36
+ gap: 2,
37
+ flex: "1 1 0%",
38
+ alignItems: E && !B ? "flex-start" : "center"
39
+ },
40
+ children: /* @__PURE__ */ u(f, {
41
+ sx: { flex: "1 1 0%" },
42
+ children: (() => {
43
+ switch (j) {
44
+ case o.INIT:
45
+ case o.IN_PROGRESS:
46
+ default: return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(g, {
47
+ variant: "subtitle2",
48
+ sx: { fontSize: 20 },
49
+ children: C._("Fund your sales/purchases")
50
+ }), /* @__PURE__ */ d(g, {
51
+ variant: "body1",
52
+ children: [
53
+ C._("Get a small business loan plan to manage finances more efficiently."),
54
+ " ",
55
+ /* @__PURE__ */ u(r, { children: ({ openModal: e }) => /* @__PURE__ */ u(g, {
56
+ onClick: e,
57
+ variant: "body1",
58
+ sx: {
59
+ textDecoration: "underline",
60
+ cursor: "pointer"
61
+ },
62
+ component: "span",
63
+ children: C._("Read more >")
64
+ }) })
65
+ ]
66
+ })] });
67
+ case o.PENDING_APPROVAL: return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(g, {
68
+ variant: "subtitle2",
69
+ sx: { fontSize: 20 },
70
+ children: C._("Your application is in review")
71
+ }), /* @__PURE__ */ u(g, {
72
+ variant: "body1",
73
+ children: C._("It can take up to 48 hours. We'll notify you about the results.")
74
+ })] });
75
+ case o.APPROVED:
76
+ case o.OFFER_ACCEPTED: return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(g, {
77
+ variant: "subtitle2",
78
+ sx: { fontSize: 20 },
79
+ children: C._("Your application was approved")
80
+ }), /* @__PURE__ */ u(g, {
81
+ variant: "body1",
82
+ children: C._("Please, review the offered credit limit and approved financing plans.")
83
+ })] });
84
+ case o.NO_OFFERS_AVAILABLE: return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(g, {
85
+ variant: "subtitle2",
86
+ sx: { fontSize: 20 },
87
+ children: C._("A provider can’t offer you financing")
88
+ }), /* @__PURE__ */ u(g, {
89
+ variant: "body1",
90
+ children: C._("They will contact you if your credit score improves and you can reapply.")
91
+ })] });
92
+ case o.OFFERS_EXPIRED: return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(g, {
93
+ variant: "subtitle2",
94
+ sx: { fontSize: 20 },
95
+ children: C._("You haven’t accepted the offer and it has expired")
96
+ }), /* @__PURE__ */ u(g, {
97
+ variant: "body1",
98
+ children: C._("Please get in touch with the provider if you still wish to receive financing.")
99
+ })] });
100
+ case o.SERVICING: return /* @__PURE__ */ u(g, {
101
+ variant: "subtitle2",
102
+ sx: { fontSize: 20 },
103
+ children: C._("My financing")
104
+ });
105
+ }
106
+ })()
107
+ })
108
+ }), /* @__PURE__ */ d(h, {
109
+ width: E && !B ? "100%" : "auto",
110
+ direction: "row",
111
+ gap: 1,
112
+ alignItems: "center",
113
+ justifyContent: E && !B ? "flex-end" : "flex-start",
114
+ children: [B && S ? /* @__PURE__ */ u(p, {
115
+ onClick: S,
116
+ variant: "text",
117
+ children: C._("View details")
118
+ }) : /* @__PURE__ */ u(p, {
119
+ onClick: () => {
120
+ switch (z(!0), j) {
121
+ case o.IN_PROGRESS:
122
+ case o.APPROVED:
123
+ case o.PENDING_APPROVAL:
124
+ case o.OFFER_ACCEPTED:
125
+ sessionStorage.setItem(b, JSON.stringify({
126
+ isHidden: !0,
127
+ expires_at: null
128
+ }));
129
+ return;
130
+ case o.INIT:
131
+ localStorage.setItem(b, JSON.stringify({
132
+ isHidden: !0,
133
+ expires_at: (/* @__PURE__ */ new Date()).getTime() + x
134
+ }));
135
+ return;
136
+ case o.NO_OFFERS_AVAILABLE:
137
+ case o.OFFERS_EXPIRED:
138
+ default:
139
+ localStorage.setItem(b, JSON.stringify({
140
+ isHidden: !0,
141
+ expires_at: null
142
+ }));
143
+ return;
144
+ }
145
+ },
146
+ variant: "text",
147
+ children: V ? C._("Hide") : C._("Close")
148
+ }), V && O && /* @__PURE__ */ u(p, {
149
+ onClick: () => {
150
+ w();
151
+ },
152
+ disabled: k,
153
+ variant: "contained",
154
+ color: "primary",
155
+ sx: {
156
+ px: 2.5,
157
+ py: 1.5,
158
+ height: 40
159
+ },
160
+ children: k ? /* @__PURE__ */ u(m, { size: 20 }) : O
161
+ })]
162
+ })]
163
+ }), B && /* @__PURE__ */ d(f, { children: [
164
+ L ? /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(g, {
165
+ variant: "body1",
166
+ children: C._("Remaining limit")
167
+ }), /* @__PURE__ */ d(f, {
168
+ display: "flex",
169
+ alignItems: "center",
170
+ justifyContent: "space-between",
171
+ gap: 1,
172
+ mb: 1,
173
+ children: [/* @__PURE__ */ d(f, {
174
+ display: "flex",
175
+ alignItems: "center",
176
+ gap: 1,
177
+ flexShrink: 0,
178
+ children: [/* @__PURE__ */ u(g, {
179
+ variant: "h2",
180
+ fontSize: 32,
181
+ children: D(F, "USD")
182
+ }), /* @__PURE__ */ d(g, {
183
+ component: "span",
184
+ variant: "subtitle1",
185
+ sx: { color: T.palette.grey[400] },
186
+ children: ["/ ", D(P, "USD")]
187
+ })]
188
+ }), /* @__PURE__ */ d(g, {
189
+ variant: "body1",
190
+ sx: {
191
+ textOverflow: "ellipsis",
192
+ overflow: "hidden",
193
+ whiteSpace: "nowrap"
194
+ },
195
+ children: [
196
+ N?.pricing_plans?.length,
197
+ " ",
198
+ C._("financial plans enabled")
199
+ ]
200
+ })]
201
+ })] }) : /* @__PURE__ */ u(g, {
202
+ variant: "h2",
203
+ fontSize: 32,
204
+ mb: 1,
205
+ children: C._("Not available")
206
+ }),
207
+ /* @__PURE__ */ u(i, { progress: I }),
208
+ (!L || N?.status === "LATE") && /* @__PURE__ */ d(g, {
209
+ variant: "body1",
210
+ fontWeight: 400,
211
+ mt: 1,
212
+ children: [
213
+ N?.status === "CLOSED" && C._("Financing is not available for your business anymore. Please, contact the provider for further details."),
214
+ N?.status === "DEFAULTED" && C._("Financing is blocked due to a violation of the agreed-upon terms. Please, contact the provider for further details."),
215
+ N?.status === "LATE" && C._("Due to late payment your financing is currently on hold. Please, contact the provider for further details.")
216
+ ]
217
+ })
218
+ ] })]
219
+ });
220
+ };
221
+ //#endregion
222
+ export { S as FinanceBanner };
@@ -1,24 +1,14 @@
1
- import { jsx as e } from "@emotion/react/jsx-runtime";
2
- import { Box as t, useTheme as n } from "@mui/material";
3
1
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index564.js
4
- var r = ({ children: r, shouldApplyFinanceStyles: i = !1 }) => {
5
- let a = n();
6
- return /* @__PURE__ */ e(t, {
7
- sx: {
8
- background: `linear-gradient(180deg, ${a.palette.primary.light} 0%, ${a.palette.background.paper} 100%)`,
9
- display: "flex",
10
- flexDirection: "column",
11
- gap: 1,
12
- px: 3,
13
- py: i ? 3 : 2.5,
14
- width: "100%",
15
- minHeight: "auto",
16
- borderRadius: "16px",
17
- boxShadow: "0 16px 24px 0 rgba(0, 0, 0, 0.02)",
18
- border: i ? "none" : `1px solid ${a.palette.divider}`
19
- },
20
- children: r
21
- });
2
+ var e = (e, t) => {
3
+ switch (t) {
4
+ case "NEW": return e._("In review");
5
+ case "DEFAULTED": return e._("Uncollectible");
6
+ case "PAID": return e._("Paid in full");
7
+ case "FUNDED": return e._("Funded");
8
+ case "LATE": return e._("Late payment");
9
+ case "REJECTED": return e._("Rejected");
10
+ default: throw Error(`Unknown status ${JSON.stringify(t)}`);
11
+ }
22
12
  };
23
13
  //#endregion
24
- export { r as FinanceBannerWrapper };
14
+ export { e as getCommonStatusLabel };