@tesouro/embedded-components-react 0.7.22 → 0.7.25
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.
- package/dist/index.css +0 -3
- package/dist/index.d.ts +20 -20
- package/dist/lib/CounterpartsWidget.d.ts +10 -2
- package/dist/lib/CounterpartsWidgetPublic.d.ts +10 -2
- package/dist/lib/CustomersWidget.d.ts +19 -19
- package/dist/lib/ExpenseManagementWidget.d.ts +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +9 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +50 -51
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +72 -128
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +183 -38
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +503 -193
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidget/CustomersWidget.js +33 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +57 -55
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +14 -14
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +114 -102
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +12 -11
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +534 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +7 -179
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +179 -6
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index14.js +4 -28
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +28 -4
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index16.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +140 -55
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +53 -47
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +51 -539
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +0 -520
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidgetMonite/CustomersWidgetMonite.js +0 -45
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/lib/CustomersWidgetNative/CustomersWidgetNative.js +0 -42
- package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/index.js +0 -4
- package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js +0 -21
- package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js +0 -134
- package/dist/libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/RefreshingMoniteWidgetProvider.js +0 -7
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { useEmbedApi as e } from "../../../../data-access/dist/lib/EmbedApiContext.js";
|
|
6
|
-
import "../../../../data-access/dist/index.js";
|
|
7
|
-
import { useOptionalWidgetToken as t } from "../../../../feature/dist/lib/WidgetProvider/useWidgetToken.js";
|
|
8
|
-
import { useWidgetConfig as n, useWidgetError as r, useWidgetInitStaleForToken as i } from "../../../../feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
|
-
import "../../../../feature/dist/index.js";
|
|
10
|
-
import { RootElementsProvider as a } from "../../../../../monite-sdk/dist/index47.js";
|
|
11
|
-
import { MoniteProvider as o } from "../../../../../monite-sdk/dist/index416.js";
|
|
12
|
-
import "../../../../../monite-sdk/dist/index.js";
|
|
13
|
-
import { useEffect as s, useLayoutEffect as c, useMemo as l, useState as u } from "react";
|
|
14
|
-
import { jsx as d } from "react/jsx-runtime";
|
|
15
|
-
//#region ../../libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js
|
|
16
|
-
var f = 0, p = "tesouro-embedded-light", m = `${p} ttw:[.dark_&]:bg-background`, h = { color: "var(--ttw-foreground)" }, g = "position: relative; z-index: calc(var(--tesouro-embedded-overlay-z-index, 2147483000) - 1); color: var(--ttw-foreground);", _ = typeof document > "u" ? s : c;
|
|
17
|
-
function v() {
|
|
18
|
-
let [e] = u(() => {
|
|
19
|
-
if (typeof document > "u") return;
|
|
20
|
-
let e = document.createElement("div");
|
|
21
|
-
return e.className = `tesouro-embedded ${p}`, e.setAttribute("style", g), e;
|
|
22
|
-
});
|
|
23
|
-
return _(() => {
|
|
24
|
-
if (e) return document.body.appendChild(e), () => e.remove();
|
|
25
|
-
}, [e]), e;
|
|
26
|
-
}
|
|
27
|
-
function y(e) {
|
|
28
|
-
return e instanceof Error ? e : Error(String(e));
|
|
29
|
-
}
|
|
30
|
-
function b({ finopsThemeColors: s, children: c }) {
|
|
31
|
-
let p = v(), { baseUrl: g, organizationId: _, initResponse: b, widgetToken: x } = n(), { client: S } = e(), C = t(), w = C !== null, T = C?.state, E = C?.refresh, D = C?.getState, O = w && T?.status === "ready" ? T.widgetToken : x ?? null, k = w && T?.status === "ready" ? T.exp : void 0, A = i(), [j, M] = u(() => ({
|
|
32
|
-
organizationId: _,
|
|
33
|
-
widgetToken: O,
|
|
34
|
-
widgetTokenExp: k
|
|
35
|
-
}));
|
|
36
|
-
!A && (j.organizationId !== _ || j.widgetToken !== O || j.widgetTokenExp !== k) && M({
|
|
37
|
-
organizationId: _,
|
|
38
|
-
widgetToken: O,
|
|
39
|
-
widgetTokenExp: k
|
|
40
|
-
});
|
|
41
|
-
let N = A ? j.organizationId : _, P = A ? j.widgetToken : O, F = A ? j.widgetTokenExp : k, I = r();
|
|
42
|
-
if (I) throw I;
|
|
43
|
-
if (T?.status === "error") throw T.error instanceof Error ? T.error : Error(String(T.error));
|
|
44
|
-
let L = b?.userId ?? null, R = w ? T?.status === "ready" : !!x, z = l(() => {
|
|
45
|
-
let e = S.getConfig();
|
|
46
|
-
return async (t, n) => {
|
|
47
|
-
let r = t instanceof Request ? t : new Request(t, n);
|
|
48
|
-
for (let t of S.interceptors.request.fns) t && (r = await t(r, e));
|
|
49
|
-
if (A) {
|
|
50
|
-
if (!P) throw Error("MoniteWrapper.fetch: widget token is not ready during init refresh");
|
|
51
|
-
r = new Request(r), r.headers.has("X-Client-Secret") ? (r.headers.delete("Authorization"), r.headers.set("X-Widget-Token", P)) : (r.headers.set("Authorization", `Bearer ${P}`), r.headers.has("X-Widget-Token") && r.headers.set("X-Widget-Token", P));
|
|
52
|
-
}
|
|
53
|
-
return (S.getConfig().fetch ?? globalThis.fetch)(r);
|
|
54
|
-
};
|
|
55
|
-
}, [
|
|
56
|
-
S,
|
|
57
|
-
A,
|
|
58
|
-
P
|
|
59
|
-
]), B = l(() => !g || !N ? null : {
|
|
60
|
-
apiUrl: g,
|
|
61
|
-
entityId: N,
|
|
62
|
-
fetch: z,
|
|
63
|
-
fetchToken: async () => {
|
|
64
|
-
if (A) {
|
|
65
|
-
if (!P) throw Error("MoniteWrapper.fetchToken: widget token is not ready during init refresh");
|
|
66
|
-
let e = Date.now() / 1e3;
|
|
67
|
-
return {
|
|
68
|
-
access_token: P,
|
|
69
|
-
expires_in: F === void 0 ? f : Math.max(0, F - e),
|
|
70
|
-
token_type: "Bearer"
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (!w) {
|
|
74
|
-
if (!x) throw Error("MoniteWrapper.fetchToken: widget token is not ready");
|
|
75
|
-
return {
|
|
76
|
-
access_token: x,
|
|
77
|
-
expires_in: f,
|
|
78
|
-
token_type: "Bearer"
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
if (!E || !D) throw Error("MoniteWrapper.fetchToken: token refresh provider is unavailable");
|
|
82
|
-
let e = !1, t = () => {
|
|
83
|
-
let e = D();
|
|
84
|
-
if (e.status === "error") throw y(e.error);
|
|
85
|
-
return e;
|
|
86
|
-
}, n = (e) => {
|
|
87
|
-
if (e.status !== "ready") throw Error("MoniteWrapper.fetchToken: widget token is not ready after refresh()");
|
|
88
|
-
return e;
|
|
89
|
-
}, r = D();
|
|
90
|
-
if (r.status === "error") throw y(r.error);
|
|
91
|
-
if (r.status !== "ready" && (await E(), e = !0, r = t()), r = n(r), r.exp === void 0 && !e && (await E(), r = n(t())), r.exp === void 0 && r.lastError !== void 0) throw y(r.lastError);
|
|
92
|
-
let i = Date.now() / 1e3, a = r.exp === void 0 ? f : Math.max(0, r.exp - i);
|
|
93
|
-
return {
|
|
94
|
-
access_token: r.widgetToken,
|
|
95
|
-
expires_in: a,
|
|
96
|
-
token_type: "Bearer"
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}, [
|
|
100
|
-
g,
|
|
101
|
-
D,
|
|
102
|
-
w,
|
|
103
|
-
A,
|
|
104
|
-
z,
|
|
105
|
-
P,
|
|
106
|
-
F,
|
|
107
|
-
N,
|
|
108
|
-
E,
|
|
109
|
-
x
|
|
110
|
-
]), V = l(() => new Set(b?.scopes ?? []), [b?.scopes]), H = l(() => {
|
|
111
|
-
if (!s) return;
|
|
112
|
-
let e = {};
|
|
113
|
-
return s.primary && (e.primary = s.primary), s.primaryForeground && (e.primaryForeground = s.primaryForeground), Object.keys(e).length > 0 ? { colors: e } : void 0;
|
|
114
|
-
}, [s]);
|
|
115
|
-
return !R || !B || !b || !g || !N ? null : /* @__PURE__ */ d(a, {
|
|
116
|
-
elements: p ? {
|
|
117
|
-
root: p,
|
|
118
|
-
styles: void 0
|
|
119
|
-
} : void 0,
|
|
120
|
-
children: /* @__PURE__ */ d(o, {
|
|
121
|
-
monite: B,
|
|
122
|
-
theme: H,
|
|
123
|
-
userPermissions: V,
|
|
124
|
-
componentSettings: { financing: { enableFinanceWidgetButton: !1 } },
|
|
125
|
-
children: /* @__PURE__ */ d("div", {
|
|
126
|
-
className: m,
|
|
127
|
-
style: h,
|
|
128
|
-
children: c
|
|
129
|
-
})
|
|
130
|
-
}, L ?? "no-user")
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
//#endregion
|
|
134
|
-
export { b as MoniteWrapper };
|