@tesouro/embedded-components-react 0.2.255 → 0.2.256
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/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +117 -119
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js +6 -4
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js +6 -3
- 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/monite-wrapper/feature/dist/lib/MoniteWrapper.js +75 -45
- package/package.json +1 -1
|
@@ -3,40 +3,38 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { Dialog as e, DialogContent as t, DialogTitle as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import "../../../shared/data-access/dist/index.js";
|
|
8
|
-
import { OnboardingShell as i } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
|
|
6
|
+
import { OnboardingShell as r } from "../../../shared/ui/dist/lib/OnboardingShell/OnboardingShell.js";
|
|
9
7
|
import "../../../shared/ui/dist/index.js";
|
|
10
|
-
import { useAnalyticsTrack as
|
|
11
|
-
import { WidgetProvider as
|
|
8
|
+
import { useAnalyticsTrack as i } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
9
|
+
import { WidgetProvider as a } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
12
10
|
import { getStateOptions as o } from "../../../shared/util/dist/lib/usStates.js";
|
|
13
11
|
import { extractApiErrorMessage as s } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
14
|
-
import { useRefetchWidget as
|
|
15
|
-
import { getNaicsOptions as
|
|
12
|
+
import { useRefetchWidget as c, useWidgetConfig as l } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
13
|
+
import { getNaicsOptions as u } from "../../../shared/feature/dist/lib/naicsCodeMap.js";
|
|
16
14
|
import "../../../shared/feature/dist/index.js";
|
|
17
|
-
import { ADDITIONAL_OWNERS_LABELS_EN as
|
|
18
|
-
import { interpolateBankName as
|
|
19
|
-
import { ResultStep as
|
|
20
|
-
import { MarketingWidget as
|
|
15
|
+
import { ADDITIONAL_OWNERS_LABELS_EN as d } from "../../ui/dist/index4.js";
|
|
16
|
+
import { interpolateBankName as f } from "../../ui/dist/index6.js";
|
|
17
|
+
import { ResultStep as ee } from "../../ui/dist/index11.js";
|
|
18
|
+
import { MarketingWidget as te } from "../../ui/dist/index28.js";
|
|
21
19
|
import "../../ui/dist/index.js";
|
|
22
|
-
import { BusinessDetailsStep as
|
|
23
|
-
import { PersonalDetailsStep as
|
|
24
|
-
import { AdditionalOwnersStep as
|
|
25
|
-
import { buildCreateApplicationBody as
|
|
26
|
-
import { OnboardingAnalyticsEvent as
|
|
27
|
-
import { DEFAULT_LABELS as
|
|
28
|
-
import { ApplicationClientSecretProvider as
|
|
29
|
-
import { useCreateApplication as
|
|
30
|
-
import { useUpdateApplication as
|
|
31
|
-
import { useSubmitApplication as
|
|
32
|
-
import { usePollApplicationCompletion as
|
|
33
|
-
import { OnboardingSuppressionReason as
|
|
34
|
-
import { useOrganizationOnboardingSuppression as
|
|
20
|
+
import { BusinessDetailsStep as ne } from "./index9.js";
|
|
21
|
+
import { PersonalDetailsStep as re } from "./index11.js";
|
|
22
|
+
import { AdditionalOwnersStep as ie } from "./index13.js";
|
|
23
|
+
import { buildCreateApplicationBody as ae, buildUpdateApplicationBody as p } from "./index14.js";
|
|
24
|
+
import { OnboardingAnalyticsEvent as m, WIDGET_NAME as h } from "./index15.js";
|
|
25
|
+
import { DEFAULT_LABELS as g } from "./index16.js";
|
|
26
|
+
import { ApplicationClientSecretProvider as oe, useApplicationClientSecret as se } from "../../data-access/dist/index2.js";
|
|
27
|
+
import { useCreateApplication as ce } from "../../data-access/dist/index4.js";
|
|
28
|
+
import { useUpdateApplication as le } from "../../data-access/dist/index6.js";
|
|
29
|
+
import { useSubmitApplication as ue } from "../../data-access/dist/index7.js";
|
|
30
|
+
import { usePollApplicationCompletion as de } from "../../data-access/dist/index8.js";
|
|
31
|
+
import { OnboardingSuppressionReason as fe } from "../../data-access/dist/index9.js";
|
|
32
|
+
import { useOrganizationOnboardingSuppression as pe } from "../../data-access/dist/index10.js";
|
|
35
33
|
import "../../data-access/dist/index.js";
|
|
36
|
-
import { useCallback as
|
|
37
|
-
import { Fragment as
|
|
34
|
+
import { useCallback as _, useEffect as v, useMemo as y, useRef as me, useState as b } from "react";
|
|
35
|
+
import { Fragment as he, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
38
36
|
//#region ../../libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js
|
|
39
|
-
var
|
|
37
|
+
var ge = {
|
|
40
38
|
companyLegalName: "",
|
|
41
39
|
companyDbaName: "",
|
|
42
40
|
businessAddress: "",
|
|
@@ -50,7 +48,7 @@ var ve = {
|
|
|
50
48
|
naicsCode: "",
|
|
51
49
|
isAuthorized: null,
|
|
52
50
|
isCheckboxChecked: !1
|
|
53
|
-
},
|
|
51
|
+
}, _e = {
|
|
54
52
|
firstName: "",
|
|
55
53
|
lastName: "",
|
|
56
54
|
dateOfBirth: void 0,
|
|
@@ -64,7 +62,7 @@ var ve = {
|
|
|
64
62
|
ownsOver25Percent: null,
|
|
65
63
|
ownershipPercentage: null
|
|
66
64
|
};
|
|
67
|
-
function
|
|
65
|
+
function ve(e, t) {
|
|
68
66
|
if (e === 0) return {
|
|
69
67
|
title: t.businessReviewTitle,
|
|
70
68
|
subtitle: t.businessReviewSubtitle
|
|
@@ -74,7 +72,7 @@ function be(e, t) {
|
|
|
74
72
|
subtitle: t.personalReviewSubtitle
|
|
75
73
|
};
|
|
76
74
|
let n = {
|
|
77
|
-
...
|
|
75
|
+
...d,
|
|
78
76
|
...t.additionalOwners
|
|
79
77
|
};
|
|
80
78
|
return {
|
|
@@ -82,55 +80,55 @@ function be(e, t) {
|
|
|
82
80
|
subtitle: n.subheading
|
|
83
81
|
};
|
|
84
82
|
}
|
|
85
|
-
function
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}, [
|
|
90
|
-
let
|
|
91
|
-
...
|
|
92
|
-
...
|
|
83
|
+
function ye({ onEmbeddedOnboardingCompletedSuccessfully: a, onNavigateToDashboard: d, labels: h, initialBusinessDetails: oe, initialPersonalDetails: ye, initialAdditionalOwners: C, bankLogoSrc: be, disclosureLinks: xe, marketingContent: w = null, open: Se, defaultOpen: T, onOpenChange: Ce }) {
|
|
84
|
+
let E = i();
|
|
85
|
+
v(() => {
|
|
86
|
+
E(m.Mounted);
|
|
87
|
+
}, [E]);
|
|
88
|
+
let D = {
|
|
89
|
+
...g,
|
|
90
|
+
...h,
|
|
93
91
|
stepIndicator: {
|
|
94
|
-
...
|
|
95
|
-
...
|
|
92
|
+
...g.stepIndicator,
|
|
93
|
+
...h?.stepIndicator
|
|
96
94
|
},
|
|
97
|
-
businessDetails:
|
|
98
|
-
personalDetails:
|
|
99
|
-
additionalOwners:
|
|
95
|
+
businessDetails: h?.businessDetails ?? {},
|
|
96
|
+
personalDetails: h?.personalDetails ?? {},
|
|
97
|
+
additionalOwners: h?.additionalOwners ?? {},
|
|
100
98
|
result: {
|
|
101
|
-
...
|
|
102
|
-
...
|
|
99
|
+
...g.result,
|
|
100
|
+
...h?.result
|
|
103
101
|
}
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
}, [
|
|
107
|
-
|
|
108
|
-
}, [
|
|
109
|
-
|
|
110
|
-
}, []), ze =
|
|
111
|
-
|
|
112
|
-
}, [j,
|
|
113
|
-
|
|
114
|
-
}, [
|
|
115
|
-
...
|
|
116
|
-
...
|
|
117
|
-
})), [P, We] =
|
|
118
|
-
...
|
|
119
|
-
...
|
|
120
|
-
})), [Ge, Ke] =
|
|
121
|
-
|
|
122
|
-
let et =
|
|
123
|
-
if (
|
|
124
|
-
!Z || !Q || (
|
|
102
|
+
}, O = l().initResponse, { termsHref: we, privacyHref: Te, electronicCommunicationHref: Ee, patriotActHref: De } = xe ?? {}, Oe = w !== null, k = Se === void 0, [ke, A] = b(!1), [Ae, je] = b(!0), [Me, Ne] = b(() => T ?? !1), Pe = be ?? w?.bankLogoSrc ?? void 0, Fe = k ? Me : Se, Ie = T ?? !1, j = _((e) => {
|
|
103
|
+
k && Ne(e), Ce?.(e);
|
|
104
|
+
}, [Ce, k]), Le = _(() => {
|
|
105
|
+
E(m.OpenMarketing), A(!0);
|
|
106
|
+
}, [E]), Re = _(() => {
|
|
107
|
+
A(!1);
|
|
108
|
+
}, []), ze = _(() => {
|
|
109
|
+
E(m.BeginOnboarding), A(!1), j(!0);
|
|
110
|
+
}, [j, E]), Be = _(() => {
|
|
111
|
+
je(!1), a();
|
|
112
|
+
}, [a]), Ve = c(), [M, N] = b(0), [He, Ue] = b(() => ({
|
|
113
|
+
...ge,
|
|
114
|
+
...oe
|
|
115
|
+
})), [P, We] = b(() => ({
|
|
116
|
+
..._e,
|
|
117
|
+
...ye
|
|
118
|
+
})), [Ge, Ke] = b(() => C ?? []), [F, qe] = b(null), [I, Je] = b(null), [L, Ye] = b(null), [R, Xe] = b(null), [Ze, z] = b(null), [B, V] = b(!1), [H, U] = b(null), W = ce(), G = le(), K = ue(), Qe = de(), { setClientSecret: $e } = se(), q = pe(), J = me(null);
|
|
119
|
+
v(() => () => J.current?.abort(), []);
|
|
120
|
+
let et = y(() => u(D.businessDetails.naicsTitles), [D.businessDetails.naicsTitles]), tt = y(() => o(D.businessDetails.stateTitles), [D.businessDetails.stateTitles]), nt = y(() => o(D.personalDetails.stateTitles), [D.personalDetails.stateTitles]), rt = y(() => o(D.additionalOwners.stateTitles), [D.additionalOwners.stateTitles]), Y = B || H !== null, X = O?.status === "ACTIVE" || O?.status === "INACTIVE", it = O?.status === "INVITED", Z = !!O && !Y && (X || it || q.isSuppressed), Q = Z ? X ? fe.UserAlreadyOnboarded : it ? fe.UserInvitedToOrganization : q.reason : null;
|
|
121
|
+
if (v(() => {
|
|
122
|
+
!Z || !Q || (E(m.Suppressed, { reason: Q }), console.info(`[onboarding] not shown: ${Q}`));
|
|
125
123
|
}, [
|
|
126
124
|
Z,
|
|
127
125
|
Q,
|
|
128
|
-
|
|
129
|
-
]), !
|
|
126
|
+
E
|
|
127
|
+
]), !O || !Y && (Z || !q.isResolved)) return null;
|
|
130
128
|
let at = F?.companyStructure === "SOLE_PROPRIETORSHIP", ot = [
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
D.stepIndicator.business,
|
|
130
|
+
D.stepIndicator.personal,
|
|
131
|
+
D.stepIndicator.ownership
|
|
134
132
|
], st = M === 0 ? F : M === 1 ? I : M === 2 ? L : null, $ = W.isPending || G.isPending || K.isPending || B, ct = () => {
|
|
135
133
|
z(null), N((e) => e === 0 ? 0 : e - 1);
|
|
136
134
|
}, lt = () => {
|
|
@@ -143,7 +141,7 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
143
141
|
try {
|
|
144
142
|
let r = await K.mutateAsync({ path: { id: e } });
|
|
145
143
|
if (t.signal.aborted) return;
|
|
146
|
-
if (!r.id) throw Error(
|
|
144
|
+
if (!r.id) throw Error(D.submitFailedError);
|
|
147
145
|
n = !0, (await Qe(e, { signal: t.signal })).status === "complete" ? (U("success"), Ve(), Be()) : U("pending");
|
|
148
146
|
} catch (e) {
|
|
149
147
|
if (e instanceof DOMException && e.name === "AbortError") return;
|
|
@@ -159,7 +157,7 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
159
157
|
if (!F) return;
|
|
160
158
|
let e = R;
|
|
161
159
|
if (!e) {
|
|
162
|
-
let t = await W.mutateAsync({ body:
|
|
160
|
+
let t = await W.mutateAsync({ body: ae(F) });
|
|
163
161
|
e = t.id, Xe(e), t.clientSecret && $e(t.clientSecret);
|
|
164
162
|
}
|
|
165
163
|
N(1);
|
|
@@ -167,7 +165,7 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
167
165
|
if (!I || !F || !R) return;
|
|
168
166
|
await G.mutateAsync({
|
|
169
167
|
path: { id: R },
|
|
170
|
-
body:
|
|
168
|
+
body: p({
|
|
171
169
|
businessDetails: F,
|
|
172
170
|
applicant: I
|
|
173
171
|
})
|
|
@@ -176,28 +174,28 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
176
174
|
if (!L || !R) return;
|
|
177
175
|
await G.mutateAsync({
|
|
178
176
|
path: { id: R },
|
|
179
|
-
body:
|
|
177
|
+
body: p({ businessOwners: L })
|
|
180
178
|
}), await ut(R);
|
|
181
179
|
}
|
|
182
180
|
} catch (e) {
|
|
183
|
-
let t = s(e) ?? (e instanceof Error ? e.message : void 0) ??
|
|
181
|
+
let t = s(e) ?? (e instanceof Error ? e.message : void 0) ?? D.genericRetryError;
|
|
184
182
|
z(t);
|
|
185
183
|
}
|
|
186
|
-
}, ft =
|
|
184
|
+
}, ft = ve(Math.min(M, 2), D), pt = O.bankName?.trim() || D.fallbackBankName, mt = f(D.shellFdicDisclaimer, pt);
|
|
187
185
|
if (Y) {
|
|
188
|
-
let r = F?.companyLegalName ?? "", i =
|
|
189
|
-
...
|
|
190
|
-
...
|
|
186
|
+
let r = F?.companyLegalName ?? "", i = O.bankName?.trim() || D.fallbackBankName, a = H ?? "pending", o = a === "success", s = {
|
|
187
|
+
...g.result,
|
|
188
|
+
...D.result
|
|
191
189
|
};
|
|
192
|
-
return /* @__PURE__ */
|
|
193
|
-
open:
|
|
190
|
+
return /* @__PURE__ */ x(e, {
|
|
191
|
+
open: Fe,
|
|
194
192
|
onOpenChange: j,
|
|
195
|
-
children: /* @__PURE__ */
|
|
193
|
+
children: /* @__PURE__ */ S(t, {
|
|
196
194
|
className: "ttw:grid ttw:max-h-[95vh] ttw:w-[720px] ttw:max-w-[calc(100vw-2rem)] ttw:grid-rows-[1fr] ttw:gap-0 ttw:overflow-hidden ttw:rounded-2xl ttw:p-0",
|
|
197
|
-
children: [/* @__PURE__ */
|
|
195
|
+
children: [/* @__PURE__ */ x(n, {
|
|
198
196
|
className: "ttw:sr-only",
|
|
199
|
-
children:
|
|
200
|
-
}), /* @__PURE__ */
|
|
197
|
+
children: D.modalTitle
|
|
198
|
+
}), /* @__PURE__ */ x(ee, {
|
|
201
199
|
status: a,
|
|
202
200
|
isLoading: B,
|
|
203
201
|
loadingMessage: s.loadingMessage,
|
|
@@ -207,17 +205,17 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
207
205
|
followUpEmail: I?.workEmail ?? "",
|
|
208
206
|
emailBoxLead: s.pendingEmailBoxLead,
|
|
209
207
|
navigateToDashboardLabel: s.navigateToDashboard,
|
|
210
|
-
bankLogoSrc:
|
|
211
|
-
bankLogoAlt:
|
|
212
|
-
fdicDisclaimer:
|
|
213
|
-
onNavigateToDashboard:
|
|
208
|
+
bankLogoSrc: Pe,
|
|
209
|
+
bankLogoAlt: f(s.bankLogoAlt, i),
|
|
210
|
+
fdicDisclaimer: f(s.fdicDisclaimer, i),
|
|
211
|
+
onNavigateToDashboard: d
|
|
214
212
|
})]
|
|
215
213
|
})
|
|
216
214
|
});
|
|
217
215
|
}
|
|
218
|
-
let ht = M === 2 ?
|
|
219
|
-
return /* @__PURE__ */
|
|
220
|
-
open:
|
|
216
|
+
let ht = M === 2 ? D.submit : D.next, gt = st === null || $;
|
|
217
|
+
return /* @__PURE__ */ S(he, { children: [Oe && Ae && w ? /* @__PURE__ */ x(te, {
|
|
218
|
+
open: ke,
|
|
221
219
|
isVisible: !0,
|
|
222
220
|
vspLogo: w.vspLogo,
|
|
223
221
|
bankingText: w.bankingText,
|
|
@@ -231,8 +229,8 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
231
229
|
onOpenMarketingModal: Le,
|
|
232
230
|
onCloseMarketingModal: Re,
|
|
233
231
|
onPrimaryCtaClick: ze
|
|
234
|
-
}) : null, /* @__PURE__ */
|
|
235
|
-
open:
|
|
232
|
+
}) : null, /* @__PURE__ */ S(r, {
|
|
233
|
+
open: Fe,
|
|
236
234
|
defaultOpen: Ie,
|
|
237
235
|
onOpenChange: j,
|
|
238
236
|
title: ft.title,
|
|
@@ -250,33 +248,33 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
250
248
|
nextIcon: null,
|
|
251
249
|
errorMessage: Ze,
|
|
252
250
|
labels: {
|
|
253
|
-
backButton: M === 0 ?
|
|
254
|
-
cancelButton:
|
|
251
|
+
backButton: M === 0 ? D.cancel : D.back,
|
|
252
|
+
cancelButton: D.cancel
|
|
255
253
|
},
|
|
256
254
|
children: [
|
|
257
|
-
M === 0 ? /* @__PURE__ */
|
|
255
|
+
M === 0 ? /* @__PURE__ */ x(ne, {
|
|
258
256
|
value: He,
|
|
259
257
|
onValueChange: Ue,
|
|
260
258
|
onSnapshotChange: qe,
|
|
261
259
|
naicsOptions: et,
|
|
262
260
|
stateOptions: tt,
|
|
263
261
|
isSubmitting: $,
|
|
264
|
-
labels:
|
|
262
|
+
labels: D.businessDetails,
|
|
265
263
|
bankName: pt,
|
|
266
|
-
termsHref:
|
|
267
|
-
privacyHref:
|
|
268
|
-
electronicCommunicationHref:
|
|
269
|
-
patriotActHref:
|
|
264
|
+
termsHref: we,
|
|
265
|
+
privacyHref: Te,
|
|
266
|
+
electronicCommunicationHref: Ee,
|
|
267
|
+
patriotActHref: De
|
|
270
268
|
}, "business") : null,
|
|
271
|
-
M === 1 ? /* @__PURE__ */
|
|
269
|
+
M === 1 ? /* @__PURE__ */ x(re, {
|
|
272
270
|
value: P,
|
|
273
271
|
onValueChange: We,
|
|
274
272
|
onSnapshotChange: Je,
|
|
275
273
|
stateOptions: nt,
|
|
276
274
|
isSubmitting: $,
|
|
277
|
-
labels:
|
|
275
|
+
labels: D.personalDetails
|
|
278
276
|
}, "personal") : null,
|
|
279
|
-
M === 2 ? /* @__PURE__ */
|
|
277
|
+
M === 2 ? /* @__PURE__ */ x(ie, {
|
|
280
278
|
owners: Ge,
|
|
281
279
|
onOwnersChange: Ke,
|
|
282
280
|
primaryOwnerName: `${P.firstName} ${P.lastName}`.trim(),
|
|
@@ -284,30 +282,30 @@ function S({ onEmbeddedOnboardingCompletedSuccessfully: r, onNavigateToDashboard
|
|
|
284
282
|
stateOptions: rt,
|
|
285
283
|
onSnapshotChange: Ye,
|
|
286
284
|
isSubmitting: $,
|
|
287
|
-
labels:
|
|
285
|
+
labels: D.additionalOwners
|
|
288
286
|
}) : null
|
|
289
287
|
]
|
|
290
288
|
})] });
|
|
291
289
|
}
|
|
292
|
-
function C({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, linkComponent: i, implementation:
|
|
293
|
-
return /* @__PURE__ */
|
|
290
|
+
function C({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, linkComponent: i, implementation: o, uiFramework: s, errorFallback: c, onError: l, analytics: u, ...d }) {
|
|
291
|
+
return /* @__PURE__ */ x(a, {
|
|
294
292
|
baseUrl: e,
|
|
295
293
|
widgetToken: t,
|
|
296
294
|
organizationId: n,
|
|
297
295
|
configClient: r,
|
|
298
296
|
linkComponent: i,
|
|
299
|
-
implementation:
|
|
300
|
-
uiFramework:
|
|
301
|
-
errorFallback:
|
|
302
|
-
onError:
|
|
303
|
-
analytics:
|
|
304
|
-
widgetName:
|
|
305
|
-
children: /* @__PURE__ */
|
|
297
|
+
implementation: o,
|
|
298
|
+
uiFramework: s,
|
|
299
|
+
errorFallback: c,
|
|
300
|
+
onError: l,
|
|
301
|
+
analytics: u,
|
|
302
|
+
widgetName: h,
|
|
303
|
+
children: /* @__PURE__ */ x(be, { ...d })
|
|
306
304
|
});
|
|
307
305
|
}
|
|
308
|
-
function
|
|
309
|
-
let {
|
|
310
|
-
return /* @__PURE__ */
|
|
306
|
+
function be(e) {
|
|
307
|
+
let { initResponse: t } = l(), n = t?.userId ?? null, [r, i] = b(n), [a, o] = b(0);
|
|
308
|
+
return n !== r && (i(n), r !== null && n !== null && o((e) => e + 1)), /* @__PURE__ */ x(oe, { children: /* @__PURE__ */ x(ye, { ...e }, a) }, a);
|
|
311
309
|
}
|
|
312
310
|
//#endregion
|
|
313
311
|
export { C as BankAccountOnboardingWidget, C as default };
|
package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/data-access/dist/lib/withAuthEpoch.js
|
|
2
|
-
|
|
2
|
+
var e = (e) => e;
|
|
3
|
+
function t(t, n) {
|
|
3
4
|
return {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
placeholderData: e,
|
|
6
|
+
...t,
|
|
7
|
+
queryKey: [...t.queryKey, { authEpoch: n }]
|
|
6
8
|
};
|
|
7
9
|
}
|
|
8
10
|
//#endregion
|
|
9
|
-
export {
|
|
11
|
+
export { t as withAuthEpoch };
|
|
@@ -11,10 +11,10 @@ import { WidgetProvider as l } from "./lib/WidgetProvider/WidgetProvider.js";
|
|
|
11
11
|
import { WidgetTokenRefreshProvider as u } from "./lib/WidgetProvider/WidgetTokenRefreshProvider.js";
|
|
12
12
|
import { useOptionalWidgetToken as d, useWidgetToken as f } from "./lib/WidgetProvider/useWidgetToken.js";
|
|
13
13
|
import { RefreshingRootWidgetProvider as p } from "./lib/WidgetProvider/RefreshingRootWidgetProvider.js";
|
|
14
|
-
import { useOwnWidgetConfig as m, useRefetchWidget as h, useWidgetConfig as g, useWidgetError as _,
|
|
14
|
+
import { useOwnWidgetConfig as m, useRefetchWidget as h, useWidgetConfig as g, useWidgetError as _, useWidgetInitStaleForToken as v, useWidgetLoading as y } from "./lib/WidgetProvider/hooks.js";
|
|
15
15
|
import "./lib/WidgetProvider/index.js";
|
|
16
|
-
import { getNaicsOptions as
|
|
17
|
-
import { CardProgram as
|
|
18
|
-
import { CARD_STATUS_LABELS_EN as
|
|
16
|
+
import { getNaicsOptions as b } from "./lib/naicsCodeMap.js";
|
|
17
|
+
import { CardProgram as x } from "./lib/card/cardProgram.js";
|
|
18
|
+
import { CARD_STATUS_LABELS_EN as S, CARD_STATUS_TONE as C, CARD_TYPE_LABELS_EN as w } from "./lib/card/cardPresentation.js";
|
|
19
19
|
import "./lib/analytics/index.js";
|
|
20
|
-
export {
|
|
20
|
+
export { S as CARD_STATUS_LABELS_EN, C as CARD_STATUS_TONE, w as CARD_TYPE_LABELS_EN, x as CardProgram, t as Implementation, p as RefreshingRootWidgetProvider, s as RootWidgetProvider, l as WidgetProvider, u as WidgetTokenRefreshProvider, e as cloneEmbeddedClient, n as getGlobalWidgetConfig, a as getGlobalWidgetInitState, b as getNaicsOptions, r as setGlobalWidgetConfig, o as subscribeToGlobalWidgetInitState, i as updateGlobalWidgetConfig, c as useAnalyticsTrack, d as useOptionalWidgetToken, m as useOwnWidgetConfig, h as useRefetchWidget, g as useWidgetConfig, _ as useWidgetError, v as useWidgetInitStaleForToken, y as useWidgetLoading, f as useWidgetToken };
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js
CHANGED
|
@@ -12,13 +12,16 @@ function s() {
|
|
|
12
12
|
return i(n)?.own ?? null;
|
|
13
13
|
}
|
|
14
14
|
function c() {
|
|
15
|
-
return i(n)?.
|
|
15
|
+
return i(n)?.initResponseStaleForToken ?? !1;
|
|
16
16
|
}
|
|
17
17
|
function l() {
|
|
18
|
-
return i(n)?.
|
|
18
|
+
return i(n)?.refetch ?? r;
|
|
19
19
|
}
|
|
20
20
|
function u() {
|
|
21
|
+
return i(n)?.loading ?? !1;
|
|
22
|
+
}
|
|
23
|
+
function d() {
|
|
21
24
|
return i(n)?.error ?? null;
|
|
22
25
|
}
|
|
23
26
|
//#endregion
|
|
24
|
-
export { s as useOwnWidgetConfig,
|
|
27
|
+
export { s as useOwnWidgetConfig, l as useRefetchWidget, o as useWidgetConfig, d as useWidgetError, c as useWidgetInitStaleForToken, u as useWidgetLoading };
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.2.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.2.256", n = "92eb36f8b554b495b2b78067fa7b86326c571f92", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|
|
@@ -5,53 +5,80 @@
|
|
|
5
5
|
import { useEmbedApi as e } from "../../../../data-access/dist/lib/EmbedApiContext.js";
|
|
6
6
|
import "../../../../data-access/dist/index.js";
|
|
7
7
|
import { useOptionalWidgetToken as t } from "../../../../feature/dist/lib/WidgetProvider/useWidgetToken.js";
|
|
8
|
-
import { useWidgetConfig as n, useWidgetError as r } from "../../../../feature/dist/lib/WidgetProvider/hooks.js";
|
|
8
|
+
import { useWidgetConfig as n, useWidgetError as r, useWidgetInitStaleForToken as i } from "../../../../feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
9
|
import "../../../../feature/dist/index.js";
|
|
10
|
-
import { MoniteProvider as
|
|
10
|
+
import { MoniteProvider as a } from "../../../../../monite-sdk/dist/index605.js";
|
|
11
11
|
import "../../../../../monite-sdk/dist/index.js";
|
|
12
|
-
import { useMemo as
|
|
13
|
-
import { jsx as
|
|
12
|
+
import { useMemo as o, useState as s } from "react";
|
|
13
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
14
14
|
//#region ../../libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js
|
|
15
|
-
var
|
|
16
|
-
function
|
|
15
|
+
var l = 0;
|
|
16
|
+
function u(e) {
|
|
17
17
|
return e instanceof Error ? e : Error(String(e));
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
let { baseUrl:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
function d({ finopsThemeColors: d, children: f }) {
|
|
20
|
+
let { baseUrl: p, organizationId: m, initResponse: h, widgetToken: g } = n(), { client: _ } = e(), v = t(), y = v !== null, b = v?.state, x = v?.refresh, S = v?.getState, C = y && b?.status === "ready" ? b.widgetToken : g ?? null, w = y && b?.status === "ready" ? b.exp : void 0, T = i(), [E, D] = s(() => ({
|
|
21
|
+
organizationId: m,
|
|
22
|
+
widgetToken: C,
|
|
23
|
+
widgetTokenExp: w
|
|
24
|
+
}));
|
|
25
|
+
!T && (E.organizationId !== m || E.widgetToken !== C || E.widgetTokenExp !== w) && D({
|
|
26
|
+
organizationId: m,
|
|
27
|
+
widgetToken: C,
|
|
28
|
+
widgetTokenExp: w
|
|
29
|
+
});
|
|
30
|
+
let O = T ? E.organizationId : m, k = T ? E.widgetToken : C, A = T ? E.widgetTokenExp : w, j = r();
|
|
31
|
+
if (j) throw j;
|
|
32
|
+
if (b?.status === "error") throw b.error instanceof Error ? b.error : Error(String(b.error));
|
|
33
|
+
let M = h?.userId ?? null, N = y ? b?.status === "ready" : !!g, P = o(() => {
|
|
34
|
+
let e = _.getConfig();
|
|
25
35
|
return async (t, n) => {
|
|
26
36
|
let r = t instanceof Request ? t : new Request(t, n);
|
|
27
|
-
for (let t of
|
|
37
|
+
for (let t of _.interceptors.request.fns) t && (r = await t(r, e));
|
|
38
|
+
if (T) {
|
|
39
|
+
if (!k) throw Error("MoniteWrapper.fetch: widget token is not ready during init refresh");
|
|
40
|
+
r = new Request(r), r.headers.has("X-Client-Secret") ? (r.headers.delete("Authorization"), r.headers.set("X-Widget-Token", k)) : (r.headers.set("Authorization", `Bearer ${k}`), r.headers.has("X-Widget-Token") && r.headers.set("X-Widget-Token", k));
|
|
41
|
+
}
|
|
28
42
|
return globalThis.fetch(r);
|
|
29
43
|
};
|
|
30
|
-
}, [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
44
|
+
}, [
|
|
45
|
+
_,
|
|
46
|
+
T,
|
|
47
|
+
k
|
|
48
|
+
]), F = o(() => !p || !O ? null : {
|
|
49
|
+
apiUrl: p,
|
|
50
|
+
entityId: O,
|
|
51
|
+
fetch: P,
|
|
34
52
|
fetchToken: async () => {
|
|
35
|
-
if (
|
|
36
|
-
if (!
|
|
53
|
+
if (T) {
|
|
54
|
+
if (!k) throw Error("MoniteWrapper.fetchToken: widget token is not ready during init refresh");
|
|
55
|
+
let e = Date.now() / 1e3;
|
|
56
|
+
return {
|
|
57
|
+
access_token: k,
|
|
58
|
+
expires_in: A === void 0 ? l : Math.max(0, A - e),
|
|
59
|
+
token_type: "Bearer"
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (!y) {
|
|
63
|
+
if (!g) throw Error("MoniteWrapper.fetchToken: widget token is not ready");
|
|
37
64
|
return {
|
|
38
|
-
access_token:
|
|
39
|
-
expires_in:
|
|
65
|
+
access_token: g,
|
|
66
|
+
expires_in: l,
|
|
40
67
|
token_type: "Bearer"
|
|
41
68
|
};
|
|
42
69
|
}
|
|
43
|
-
if (!
|
|
70
|
+
if (!x || !S) throw Error("MoniteWrapper.fetchToken: token refresh provider is unavailable");
|
|
44
71
|
let e = !1, t = () => {
|
|
45
|
-
let e =
|
|
46
|
-
if (e.status === "error") throw
|
|
72
|
+
let e = S();
|
|
73
|
+
if (e.status === "error") throw u(e.error);
|
|
47
74
|
return e;
|
|
48
75
|
}, n = (e) => {
|
|
49
76
|
if (e.status !== "ready") throw Error("MoniteWrapper.fetchToken: widget token is not ready after refresh()");
|
|
50
77
|
return e;
|
|
51
|
-
}, r =
|
|
52
|
-
if (r.status === "error") throw
|
|
53
|
-
if (r.status !== "ready" && (await
|
|
54
|
-
let i = Date.now() / 1e3, a = r.exp === void 0 ?
|
|
78
|
+
}, r = S();
|
|
79
|
+
if (r.status === "error") throw u(r.error);
|
|
80
|
+
if (r.status !== "ready" && (await x(), e = !0, r = t()), r = n(r), r.exp === void 0 && !e && (await x(), r = n(t())), r.exp === void 0 && r.lastError !== void 0) throw u(r.lastError);
|
|
81
|
+
let i = Date.now() / 1e3, a = r.exp === void 0 ? l : Math.max(0, r.exp - i);
|
|
55
82
|
return {
|
|
56
83
|
access_token: r.widgetToken,
|
|
57
84
|
expires_in: a,
|
|
@@ -59,22 +86,25 @@ function l({ finopsThemeColors: l, children: u }) {
|
|
|
59
86
|
};
|
|
60
87
|
}
|
|
61
88
|
}, [
|
|
62
|
-
|
|
89
|
+
p,
|
|
90
|
+
S,
|
|
91
|
+
y,
|
|
92
|
+
T,
|
|
93
|
+
P,
|
|
94
|
+
k,
|
|
95
|
+
A,
|
|
96
|
+
O,
|
|
63
97
|
x,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
b,
|
|
68
|
-
m
|
|
69
|
-
]), E = a(() => new Set(p?.scopes ?? []), [p?.scopes]), D = a(() => {
|
|
70
|
-
if (!l) return;
|
|
98
|
+
g
|
|
99
|
+
]), I = o(() => new Set(h?.scopes ?? []), [h?.scopes]), L = o(() => {
|
|
100
|
+
if (!d) return;
|
|
71
101
|
let e = {};
|
|
72
|
-
return
|
|
73
|
-
}, [
|
|
74
|
-
return !
|
|
75
|
-
monite:
|
|
76
|
-
theme:
|
|
77
|
-
userPermissions:
|
|
102
|
+
return d.primary && (e.primary = d.primary), d.primaryForeground && (e.primaryForeground = d.primaryForeground), Object.keys(e).length > 0 ? { colors: e } : void 0;
|
|
103
|
+
}, [d]);
|
|
104
|
+
return !N || !F || !h || !p || !O ? null : /* @__PURE__ */ c(a, {
|
|
105
|
+
monite: F,
|
|
106
|
+
theme: L,
|
|
107
|
+
userPermissions: I,
|
|
78
108
|
componentSettings: {
|
|
79
109
|
receivables: {
|
|
80
110
|
bankAccountCountries: ["US"],
|
|
@@ -87,8 +117,8 @@ function l({ finopsThemeColors: l, children: u }) {
|
|
|
87
117
|
availableAPDocuments: []
|
|
88
118
|
}
|
|
89
119
|
},
|
|
90
|
-
children:
|
|
91
|
-
},
|
|
120
|
+
children: f
|
|
121
|
+
}, M ?? "no-user");
|
|
92
122
|
}
|
|
93
123
|
//#endregion
|
|
94
|
-
export {
|
|
124
|
+
export { d as MoniteWrapper };
|