@tesouro/embedded-components-react 0.8.1 → 0.8.5

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 (98) hide show
  1. package/dist/index.css +21 -120
  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 +1 -2
  55. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +1 -1
  56. package/dist/packages/shared-ui-shadcn/dist/index.js +19 -21
  57. package/package.json +1 -3
  58. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index228.js +0 -24
  59. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index229.js +0 -77
  60. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index230.js +0 -19
  61. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index231.js +0 -22
  62. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index232.js +0 -8
  63. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index233.js +0 -12
  64. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index234.js +0 -13
  65. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index235.js +0 -133
  66. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index236.js +0 -8
  67. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index237.js +0 -8
  68. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index238.js +0 -5
  69. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index239.js +0 -222
  70. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index240.js +0 -34
  71. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index241.js +0 -14
  72. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index242.js +0 -36
  73. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index243.js +0 -22
  74. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index244.js +0 -76
  75. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index245.js +0 -184
  76. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index246.js +0 -16
  77. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index247.js +0 -206
  78. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index248.js +0 -102
  79. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index249.js +0 -66
  80. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index250.js +0 -57
  81. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index251.js +0 -94
  82. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index252.js +0 -43
  83. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index253.js +0 -79
  84. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index254.js +0 -87
  85. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index255.js +0 -14
  86. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index256.js +0 -26
  87. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index257.js +0 -17
  88. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index258.js +0 -5
  89. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index259.js +0 -24
  90. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index260.js +0 -1
  91. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index261.js +0 -22
  92. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index262.js +0 -32
  93. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index263.js +0 -4
  94. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index264.js +0 -23
  95. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index265.js +0 -18
  96. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index266.js +0 -33
  97. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index267.js +0 -31
  98. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index268.js +0 -2
@@ -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";
@@ -1,17 +1,222 @@
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";
1
+ import { useCurrencies as e } from "./index62.js";
2
+ import "./index73.js";
3
+ import { MoniteScopedProviders as t } from "./index143.js";
4
+ import { FinanceBannerWrapper as n } from "./index187.js";
5
+ import { FinanceFaqWrapper as r } from "./index189.js";
6
+ import { FinanceProgressBar as i } from "./index190.js";
7
+ import { useKanmonContext as a } from "./index193.js";
8
+ import { FinancialApplicationState as o, useFinancing as s } from "./index194.js";
9
+ import "./index197.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";
4
14
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index198.js
5
- var r = (r, i) => {
6
- let { i18n: a } = n(), { api: o, queryClient: s } = e();
7
- return o.finops.deleteProductsId.useMutation({ path: { product_id: r } }, {
8
- onSuccess: async () => {
9
- await o.finops.getProducts.invalidateQueries(s), t.success(a._("Product was deleted.")), i?.();
10
- },
11
- onError: () => {
12
- t.error(a._("Failed to delete product."));
13
- }
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
+ ] })]
14
219
  });
15
220
  };
16
221
  //#endregion
17
- export { r as useDeleteProduct };
222
+ export { S as FinanceBanner };
@@ -1,20 +1,34 @@
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 e from "@mui/icons-material/PaidOutlined";
2
+ import t from "@mui/icons-material/AccessTime";
3
+ import n from "@mui/icons-material/CheckCircleOutline";
4
+ import r from "@mui/icons-material/ErrorOutline";
5
+ import i from "@mui/icons-material/CancelOutlined";
6
+ import a from "@mui/icons-material/BlockOutlined";
6
7
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index199.js
7
- var a = (a) => {
8
- let { i18n: o } = i(), { api: s, queryClient: c } = t();
9
- return s.finops.patchProductsId.useMutation({ path: { product_id: a } }, {
10
- onSuccess: async (e) => {
11
- await s.finops.getProducts.invalidateQueries(c), await s.finops.getProductsId.invalidateQueries({ parameters: { path: { product_id: e.id } } }, c), r.success(n(e.type === "product" ? o._("Product {name} was updated.", { name: "\0" }) : o._("Service {name} was updated.", { name: "\0" }), e.name));
12
- },
13
- onError: (t) => {
14
- let n = e(o, t, { defaultMessage: "" });
15
- r.error(n ? o._("Failed to update: {reason}", { reason: n }) : o._("Failed to update"));
16
- }
17
- });
8
+ var o = {
9
+ NEW: "#292929",
10
+ DEFAULTED: "#CC394B",
11
+ PAID: "#0DAA8E",
12
+ FUNDED: "#3737FF",
13
+ LATE: "#E27E46",
14
+ REJECTED: "#CC394B",
15
+ DRAFT: ""
16
+ }, s = {
17
+ NEW: "#F2F2F2",
18
+ DEFAULTED: "#FFE0E4",
19
+ PAID: "#EEFBF9",
20
+ FUNDED: "#F4F4FE",
21
+ LATE: "#FFF3E9",
22
+ REJECTED: "#FFE0E4",
23
+ DRAFT: ""
24
+ }, c = {
25
+ NEW: t,
26
+ DEFAULTED: a,
27
+ PAID: e,
28
+ FUNDED: n,
29
+ LATE: r,
30
+ REJECTED: i,
31
+ DRAFT: t
18
32
  };
19
33
  //#endregion
20
- export { a as useUpdateProduct };
34
+ export { s as BACKGROUND_FINANCE_STATUS_MUI_MAP, c as FINANCE_INVOICE_STATUS_TO_MUI_ICON_MAP, o as ROW_TO_TAG_FINANCE_STATUS_MUI_MAP };
@@ -1,9 +1,14 @@
1
- import "./index196.js";
2
- import "./index191.js";
3
- import "./index192.js";
4
- import "./index193.js";
5
- import "./index194.js";
6
- import "./index195.js";
7
- import "./index197.js";
8
- import "./index198.js";
9
- import "./index199.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index200.js
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
+ }
12
+ };
13
+ //#endregion
14
+ export { e as getCommonStatusLabel };
@@ -1,27 +1,36 @@
1
- import { useGetProductById as e } from "./index197.js";
2
- import { useDeleteProduct as t } from "./index198.js";
3
- import "./index200.js";
4
- import { ConfirmationModal as n } from "./index188.js";
5
- import "./index189.js";
6
- import { jsx as r } from "@emotion/react/jsx-runtime";
7
- import { useLingui as i } from "@lingui/react";
1
+ import { BACKGROUND_FINANCE_STATUS_MUI_MAP as e, FINANCE_INVOICE_STATUS_TO_MUI_ICON_MAP as t, ROW_TO_TAG_FINANCE_STATUS_MUI_MAP as n } from "./index199.js";
2
+ import { getCommonStatusLabel as r } from "./index200.js";
3
+ import { jsx as i } from "@emotion/react/jsx-runtime";
4
+ import { Chip as a } from "@mui/material";
5
+ import { useLingui as o } from "@lingui/react";
6
+ import s from "@mui/icons-material/Circle";
7
+ import { styled as c, useThemeProps as l } from "@mui/material/styles";
8
8
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index201.js
9
- var a = ({ id: a, open: o, onClose: s, onDeleted: c }) => {
10
- let { i18n: l } = i(), { data: u } = e(a), d = t(a, () => {
11
- s(), c?.(a);
12
- });
13
- return u ? /* @__PURE__ */ r(n, {
14
- open: o && !!a,
15
- title: l._("Delete \"{name}\"?", { name: u.name }),
16
- message: l._("It will remain in all the documents where it is added. You can't undo this action."),
17
- confirmLabel: l._("Delete"),
18
- cancelLabel: l._("Cancel"),
19
- onClose: s,
20
- onConfirm: () => {
21
- d.mutate(void 0);
9
+ var u = ({ ref: a, ...c }) => {
10
+ let { status: u, variant: f, icon: p, size: m } = l({
11
+ props: c,
12
+ name: "MoniteFinancedInvoiceStatusChip"
13
+ }), { i18n: h } = o(), g = t[u];
14
+ return /* @__PURE__ */ i(d, {
15
+ ref: a,
16
+ sx: {
17
+ width: "auto",
18
+ color: n[u],
19
+ bgcolor: e[u]
22
20
  },
23
- isLoading: d.isPending
24
- }) : null;
25
- };
21
+ icon: p && g ? /* @__PURE__ */ i(g, { sx: {
22
+ fontSize: 16,
23
+ fill: n[u]
24
+ } }) : /* @__PURE__ */ i(s, { sx: { fontSize: "10px !important" } }),
25
+ label: r(h, u),
26
+ size: m,
27
+ status: u,
28
+ variant: f ?? "filled"
29
+ });
30
+ }, d = c(a, {
31
+ name: "MoniteFinancedInvoiceStatusChip",
32
+ slot: "root",
33
+ shouldForwardProp: () => !0
34
+ })({});
26
35
  //#endregion
27
- export { a as ProductDeleteModal };
36
+ export { u as FinancedInvoiceStatusChip };
@@ -1,15 +1,22 @@
1
- import { Badge as e } from "./index56.js";
2
- import { twMerge as t } from "tailwind-merge";
3
- import { jsx as n } from "@emotion/react/jsx-runtime";
4
- import { useLingui as r } from "@lingui/react";
5
1
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index202.js
6
- var i = ({ type: i }) => {
7
- let { i18n: a } = r(), o = i === "product", s = o ? a._("Product") : a._("Service");
8
- return /* @__PURE__ */ n(e, {
9
- variant: "secondary",
10
- className: t(o ? "ttw:bg-blue-100 ttw:text-blue-700" : "ttw:bg-pink-100 ttw:text-pink-700"),
11
- children: s
12
- });
2
+ var e = (e, t) => {
3
+ switch (t) {
4
+ case "draft": return e._("Draft");
5
+ case "issuing": return e._("Issuing");
6
+ case "issued": return e._("Issued");
7
+ case "failed": return e._("Failed");
8
+ case "accepted": return e._("Accepted");
9
+ case "expired": return e._("Expired");
10
+ case "declined": return e._("Declined");
11
+ case "recurring": return e._("Recurring");
12
+ case "partially_paid": return e._("Partially paid");
13
+ case "paid": return e._("Paid");
14
+ case "overdue": return e._("Overdue");
15
+ case "uncollectible": return e._("Uncollectible");
16
+ case "canceled": return e._("Canceled");
17
+ case "deleted": return e._("Deleted");
18
+ default: throw Error(`Unknown status ${JSON.stringify(t)}`);
19
+ }
13
20
  };
14
21
  //#endregion
15
- export { i as ProductType };
22
+ export { e as getCommonStatusLabel };
@@ -1,11 +1,76 @@
1
+ import { cn as e } from "./index49.js";
2
+ import { Badge as t } from "./index56.js";
3
+ import { getCommonStatusLabel as n } from "./index202.js";
4
+ import { jsxs as r } from "@emotion/react/jsx-runtime";
5
+ import { useLingui as i } from "@lingui/react";
6
+ import { cva as a } from "class-variance-authority";
1
7
  //#region ../../libs/tesouro-embedded-components-react/monite-sdk/dist/index203.js
2
- var e = "search", t = {
3
- name: "name",
4
- type: "type",
5
- description: "description",
6
- "price.value": "pricePerUnit",
7
- "price.currency": "currency",
8
- measure_unit_id: "measureUnitId"
8
+ var o = a("", { variants: {
9
+ variant: {
10
+ draft: "ttw:bg-zinc-100 ttw:text-zinc-700",
11
+ issuing: "ttw:bg-cyan-100 ttw:text-cyan-700",
12
+ issued: "ttw:bg-cyan-100 ttw:text-cyan-700",
13
+ failed: "ttw:bg-red-100 ttw:text-red-700",
14
+ accepted: "ttw:bg-green-100 ttw:text-green-700",
15
+ partially_paid: "ttw:bg-purple-100 ttw:text-purple-700",
16
+ paid: "ttw:bg-green-100 ttw:text-green-700",
17
+ expired: "ttw:bg-red-100 ttw:text-red-700",
18
+ uncollectible: "ttw:bg-red-100 ttw:text-red-700",
19
+ canceled: "ttw:bg-red-100 ttw:text-red-700",
20
+ recurring: "ttw:bg-zinc-100 ttw:text-zinc-700",
21
+ declined: "ttw:bg-red-100 ttw:text-red-700",
22
+ overdue: "ttw:bg-orange-100 ttw:text-orange-700",
23
+ deleted: "ttw:bg-red-100 ttw:text-red-700"
24
+ },
25
+ dotVariant: {
26
+ draft: "ttw:border-zinc-100 ttw:bg-zinc-700",
27
+ issuing: "ttw:border-cyan-100 ttw:bg-cyan-700",
28
+ issued: "ttw:border-cyan-100 ttw:bg-cyan-700",
29
+ failed: "ttw:border-red-100 ttw:bg-red-700",
30
+ accepted: "ttw:border-green-100 ttw:bg-green-700",
31
+ partially_paid: "ttw:border-purple-100 ttw:bg-purple-700",
32
+ paid: "ttw:border-green-100 ttw:bg-green-700",
33
+ expired: "ttw:border-red-100 ttw:bg-red-700",
34
+ uncollectible: "ttw:border-red-100 ttw:bg-red-700",
35
+ canceled: "ttw:border-red-100 ttw:bg-red-700",
36
+ recurring: "ttw:border-zinc-100 ttw:bg-zinc-700",
37
+ declined: "ttw:border-red-100 ttw:bg-red-700",
38
+ overdue: "ttw:border-orange-100 ttw:bg-orange-700",
39
+ deleted: "ttw:border-red-100 ttw:bg-red-700"
40
+ },
41
+ outlineVariant: {
42
+ draft: "ttw:border-zinc-200 ttw:bg-zinc-50 ttw:text-zinc-700 ttw:hover:bg-zinc-50",
43
+ issuing: "ttw:border-blue-200 ttw:bg-blue-50 ttw:text-blue-700 ttw:hover:bg-blue-50",
44
+ issued: "ttw:border-blue-200 ttw:bg-blue-50 ttw:text-blue-700 ttw:hover:bg-blue-50",
45
+ failed: "ttw:border-red-200 ttw:bg-red-50 ttw:text-red-700 ttw:hover:bg-red-50",
46
+ accepted: "ttw:border-emerald-200 ttw:bg-emerald-50 ttw:text-emerald-700 ttw:hover:bg-emerald-50",
47
+ partially_paid: "ttw:border-blue-200 ttw:bg-blue-50 ttw:text-blue-700 ttw:hover:bg-blue-50",
48
+ paid: "ttw:border-emerald-200 ttw:bg-emerald-50 ttw:text-emerald-700 ttw:hover:bg-emerald-50",
49
+ expired: "ttw:border-red-200 ttw:bg-red-50 ttw:text-red-700 ttw:hover:bg-red-50",
50
+ uncollectible: "ttw:border-zinc-200 ttw:bg-zinc-50 ttw:text-zinc-700 ttw:hover:bg-zinc-50",
51
+ canceled: "ttw:border-zinc-200 ttw:bg-zinc-50 ttw:text-zinc-700 ttw:hover:bg-zinc-50",
52
+ recurring: "ttw:border-zinc-200 ttw:bg-zinc-50 ttw:text-zinc-700 ttw:hover:bg-zinc-50",
53
+ declined: "ttw:border-red-200 ttw:bg-red-50 ttw:text-red-700 ttw:hover:bg-red-50",
54
+ overdue: "ttw:border-red-200 ttw:bg-red-50 ttw:text-red-700 ttw:hover:bg-red-50",
55
+ deleted: "ttw:border-zinc-200 ttw:bg-zinc-50 ttw:text-zinc-700 ttw:hover:bg-zinc-50"
56
+ }
57
+ } }), s = ({ status: a, variant: s = "filled", label: c, icon: l, className: u, showBadgeBackground: d = !0, dotSize: f, ref: p }) => {
58
+ let { i18n: m } = i();
59
+ return s === "outline" ? /* @__PURE__ */ r(t, {
60
+ ref: p,
61
+ variant: "outline",
62
+ className: e(o({ outlineVariant: a }), u),
63
+ children: [l, c ?? n(m, a)]
64
+ }) : /* @__PURE__ */ r(t, {
65
+ ref: p,
66
+ className: e("ttw:inline-flex ttw:items-center ttw:gap-1", o({ variant: a }), !d && "ttw:text-zinc-950!", u),
67
+ dotClassName: o({ dotVariant: a }),
68
+ showBadgeBackground: d,
69
+ showDotBorder: !d,
70
+ dotSize: f,
71
+ showDot: !1,
72
+ children: [l, c ?? n(m, a)]
73
+ });
9
74
  };
10
75
  //#endregion
11
- export { e as FILTER_TYPE_SEARCH, t as PRODUCT_API_FIELD_MAP };
76
+ export { s as InvoiceStatusChip };