@tesouro/embedded-components-react 0.11.8 → 0.11.10
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/core.d.ts +7 -0
- package/dist/index.css +12 -49
- package/dist/index.d.ts +7 -0
- package/dist/lib/WidgetProvider.d.ts +7 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index3.js +8 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +99 -94
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index14.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index33.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index36.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index37.js +110 -100
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index48.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index49.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-upload/ui/dist/index4.js +45 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +259 -210
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +190 -165
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index8.js +7 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +151 -143
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index3.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js +13 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index11.js +52 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +2 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +39 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +2 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +77 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +2 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +25 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +28 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +2 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +33 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index6.js +9 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index8.js +29 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index9.js +1 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/util/dist/index.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/util/dist/lib/groupCollapse.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +48 -45
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +119 -116
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/useTokenRefreshRef.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/client.js +11 -8
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/expectedApiNotFound.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/interceptor.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/widgetTokenManager.js +65 -53
- package/dist/packages/shared-ui-shadcn/dist/index.js +1637 -1507
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +0 -28
package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/widgetTokenManager.js
CHANGED
|
@@ -1,89 +1,101 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/shared/util/dist/lib/widgetTokenManager.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
var e = 3e4, t = 3e5;
|
|
3
|
+
function n(n) {
|
|
4
|
+
let { fetcher: r } = n, i = n.leadSeconds ?? 60, a = { status: "loading" }, o = /* @__PURE__ */ new Set(), s = 0, c = 0, l = 0, u = !1, d = !1, f = !1, p, m, h, g, _ = null, v = null, y = 0, b = 0, x = () => {
|
|
5
|
+
o.forEach((e) => e());
|
|
6
|
+
}, S = (e) => {
|
|
7
|
+
a = e, x();
|
|
8
|
+
}, C = () => {
|
|
9
|
+
p !== void 0 && (clearTimeout(p), p = void 0), m !== void 0 && (clearTimeout(m), m = void 0), h !== void 0 && (clearTimeout(h), h = void 0);
|
|
10
|
+
}, w = (e) => {
|
|
11
|
+
let t = Math.max(0, e * 1e3 - Date.now() - i * 1e3);
|
|
12
|
+
p = setTimeout(() => {
|
|
13
|
+
p = void 0, D({ manual: !1 });
|
|
13
14
|
}, t);
|
|
14
|
-
},
|
|
15
|
+
}, T = (e) => {
|
|
15
16
|
let t = Math.max(0, e * 1e3 - Date.now());
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
h = setTimeout(() => {
|
|
18
|
+
h = void 0, a.status === "ready" && a.lastError !== void 0 && S({
|
|
18
19
|
status: "error",
|
|
19
|
-
error:
|
|
20
|
+
error: a.lastError
|
|
20
21
|
});
|
|
21
22
|
}, t);
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
|
|
26
|
-
...
|
|
23
|
+
}, E = async ({ manual: e, gen: t, myId: n }) => {
|
|
24
|
+
C();
|
|
25
|
+
let i = a;
|
|
26
|
+
i.status === "ready" && S({
|
|
27
|
+
...i,
|
|
27
28
|
isRefreshing: !0
|
|
28
29
|
});
|
|
29
|
-
let
|
|
30
|
+
let o, u, d = !1;
|
|
30
31
|
try {
|
|
31
|
-
|
|
32
|
+
o = await r();
|
|
32
33
|
} catch (e) {
|
|
33
34
|
d = !0, u = e;
|
|
34
35
|
}
|
|
35
|
-
if (
|
|
36
|
-
if (!d &&
|
|
37
|
-
|
|
36
|
+
if (t !== s || n !== c) return;
|
|
37
|
+
if (!d && o !== void 0 && o.exp !== void 0 && o.exp * 1e3 <= Date.now() && (d = !0, u = /* @__PURE__ */ Error("Fetched widget token is already expired")), !d && o !== void 0) {
|
|
38
|
+
S({
|
|
38
39
|
status: "ready",
|
|
39
|
-
widgetToken:
|
|
40
|
-
exp:
|
|
40
|
+
widgetToken: o.widgetToken,
|
|
41
|
+
exp: o.exp,
|
|
41
42
|
isRefreshing: !1
|
|
42
|
-
}),
|
|
43
|
+
}), l = 0, o.exp !== void 0 && w(o.exp);
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
|
-
|
|
46
|
+
i.status === "ready" && (i.exp === void 0 || i.exp * 1e3 > Date.now()) ? (S({
|
|
46
47
|
status: "ready",
|
|
47
|
-
widgetToken:
|
|
48
|
-
exp:
|
|
48
|
+
widgetToken: i.widgetToken,
|
|
49
|
+
exp: i.exp,
|
|
49
50
|
isRefreshing: !1,
|
|
50
51
|
lastError: u
|
|
51
|
-
}),
|
|
52
|
+
}), i.exp !== void 0 && T(i.exp)) : S({
|
|
52
53
|
status: "error",
|
|
53
54
|
error: u
|
|
54
55
|
});
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
let t =
|
|
61
|
-
return
|
|
56
|
+
let f = Math.max(50, Math.random() * Math.min(3e4, 1e3 * 2 ** l));
|
|
57
|
+
l++, m = setTimeout(() => {
|
|
58
|
+
m = void 0, D({ manual: !1 });
|
|
59
|
+
}, f);
|
|
60
|
+
}, D = ({ manual: e }) => {
|
|
61
|
+
let t = s, n = ++c;
|
|
62
|
+
return f = !0, E({
|
|
62
63
|
manual: e,
|
|
63
64
|
gen: t,
|
|
64
65
|
myId: n
|
|
65
66
|
}).finally(() => {
|
|
66
|
-
n ===
|
|
67
|
+
n === c && (f = !1);
|
|
67
68
|
});
|
|
68
|
-
},
|
|
69
|
-
(e.type !== "visibilitychange" || document.visibilityState === "visible") &&
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
},
|
|
73
|
-
|
|
69
|
+
}, O = (e) => {
|
|
70
|
+
(e.type !== "visibilitychange" || document.visibilityState === "visible") && u && !f && a.status !== "loading" && (a.status === "error" || !a.isRefreshing && a.exp !== void 0 && a.exp * 1e3 - Date.now() < i * 1e3) && D({ manual: !1 });
|
|
71
|
+
}, k = () => {
|
|
72
|
+
d || typeof window > "u" || typeof document > "u" || (d = !0, document.addEventListener("visibilitychange", O), window.addEventListener("focus", O), window.addEventListener("online", O));
|
|
73
|
+
}, A = () => {
|
|
74
|
+
d && (d = !1, document.removeEventListener("visibilitychange", O), window.removeEventListener("focus", O), window.removeEventListener("online", O));
|
|
75
|
+
}, j = () => {
|
|
76
|
+
g !== void 0 && (clearTimeout(g), g = void 0);
|
|
77
|
+
}, M = (n) => {
|
|
78
|
+
if (!u || a.status !== "ready" || a.widgetToken !== n || a.isRefreshing || _ === n) return Promise.resolve();
|
|
79
|
+
let r = n === v ? y + 1 : 0, i = r === 0 ? 0 : Math.min(e * 2 ** (r - 1), t), o = Date.now(), s = i - (o - b);
|
|
80
|
+
return j(), s > 0 ? (g = setTimeout(() => {
|
|
81
|
+
g = void 0, M(n);
|
|
82
|
+
}, s), Promise.resolve()) : (_ = n, y = r, b = o, D({ manual: !0 }).finally(() => {
|
|
83
|
+
a.status === "ready" ? (v = a.widgetToken, a.widgetToken === n && (_ = null)) : v = null;
|
|
84
|
+
}));
|
|
74
85
|
};
|
|
75
86
|
return {
|
|
76
87
|
start: () => {
|
|
77
|
-
|
|
88
|
+
u || (u = !0, k(), D({ manual: !1 }));
|
|
78
89
|
},
|
|
79
90
|
stop: () => {
|
|
80
|
-
|
|
91
|
+
u = !1, s++, C(), j(), A();
|
|
81
92
|
},
|
|
82
|
-
refresh: () => (
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
refresh: () => (u = !0, k(), D({ manual: !0 })),
|
|
94
|
+
reportRejectedToken: M,
|
|
95
|
+
getState: () => a,
|
|
96
|
+
subscribe: (e) => (o.add(e), () => {
|
|
97
|
+
o.delete(e);
|
|
86
98
|
})
|
|
87
99
|
};
|
|
88
100
|
}
|
|
89
|
-
export { e as createWidgetTokenManager };
|
|
101
|
+
export { t as MAX_REJECTED_REFRESH_BACKOFF_MS, e as REJECTED_REFRESH_BACKOFF_MS, n as createWidgetTokenManager };
|