@tesouro/embedded-components-react 0.3.32 → 0.3.34
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/README.md +11 -10
- package/dist/index.d.ts +38 -0
- package/dist/index.js +2 -2
- package/dist/lib/CardsWidget.d.ts +36 -0
- package/dist/lib/CreateCardWidget.d.ts +38 -0
- package/dist/lib/CreateCardWidget.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +17 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index3.js +9 -3
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js +19 -12
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index7.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +35 -30
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +52 -10
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +12 -31
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +25 -248
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index8.js +389 -0
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/CardControlRow.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/CardControls.js +13 -12
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/ui/dist/lib/CreateCardWidget/CardControls/MerchantCategoriesControl.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +19 -18
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/merchant-category-group/useAllMerchantCategoryGroupsQuery.js +53 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +224 -206
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +174 -146
- 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/create-card-widget/feature/dist/index6.js
CHANGED
|
@@ -1,37 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { Scope as e } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
6
|
-
import { useAllOrganizationUsersQuery as t } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
|
|
1
|
+
import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
2
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
7
3
|
import "../../../shared/data-access/dist/index.js";
|
|
8
|
-
import { useCallback as n, useMemo as r } from "react";
|
|
9
4
|
//#region ../../libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js
|
|
10
|
-
var
|
|
11
|
-
function
|
|
12
|
-
let
|
|
13
|
-
return t && n ? `${t} (${n})` : t || n || e.id;
|
|
14
|
-
}
|
|
15
|
-
function o({ enabled: e = !0 } = {}) {
|
|
16
|
-
let o = t({
|
|
17
|
-
enabled: e,
|
|
18
|
-
permissions: [i]
|
|
19
|
-
}), s = o.data?.data, c = r(() => !e || o.isResolving ? [] : [...s ?? []].sort((e, t) => e.name.localeCompare(t.name)).map((e) => ({
|
|
20
|
-
value: e.id,
|
|
21
|
-
label: a(e)
|
|
22
|
-
})), [
|
|
23
|
-
e,
|
|
24
|
-
s,
|
|
25
|
-
o.isResolving
|
|
26
|
-
]), l = o.refetch, u = n(() => {
|
|
27
|
-
l();
|
|
28
|
-
}, [l]);
|
|
5
|
+
var n = "authorization_control:write:org";
|
|
6
|
+
function r(r) {
|
|
7
|
+
let i = new Set(r ?? []);
|
|
29
8
|
return {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
canIssue: e(i, [t.DebitCardIssueOrg]),
|
|
10
|
+
canReadUsers: e(i, [t.UserReadOrg]),
|
|
11
|
+
canReadFundingAccounts: e(i, [t.BankAccountReadOrg]),
|
|
12
|
+
canReadOrganization: e(i, [t.OrganizationReadOrg]),
|
|
13
|
+
canWriteAuthorizationControls: e(i, [n]),
|
|
14
|
+
canReadMerchantCategoryGroups: e(i, [t.AuthorizationControlReadOrg])
|
|
34
15
|
};
|
|
35
16
|
}
|
|
36
17
|
//#endregion
|
|
37
|
-
export {
|
|
18
|
+
export { n as AUTHORIZATION_CONTROL_WRITE_ORG, r as getCreateCardPermissions };
|
package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js
CHANGED
|
@@ -2,259 +2,36 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { useAllBankAccountsQuery as n } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
|
|
8
|
-
import { useAllOrganizationUsersQuery as r } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
|
|
5
|
+
import { Scope as e } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
6
|
+
import { useAllOrganizationUsersQuery as t } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
|
|
9
7
|
import "../../../shared/data-access/dist/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import "../../../shared/ui/dist/index.js";
|
|
12
|
-
import { useAnalyticsTrack as a } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
13
|
-
import { WidgetProvider as o } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
14
|
-
import { getStateOptions as s } from "../../../shared/util/dist/lib/usStates.js";
|
|
15
|
-
import { useWidgetConfig as c } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
16
|
-
import "../../../shared/feature/dist/index.js";
|
|
17
|
-
import { CREATE_CARD_WIDGET_LABELS_EN as l } from "../../ui/dist/lib/CreateCardWidget/labels.js";
|
|
18
|
-
import { CreateCardView as u, MailingOptionValue as d } from "../../ui/dist/lib/CreateCardWidget/types.js";
|
|
19
|
-
import { CreateCardWidget as f } from "../../ui/dist/lib/CreateCardWidget/CreateCardWidget.js";
|
|
20
|
-
import "../../ui/dist/index.js";
|
|
21
|
-
import { CardFormatValue as p, buildCreateDebitCardRequest as m, createDebitCardReference as ee, formatBusinessAddress as te, isBusinessAddressComplete as ne, isManualAddressComplete as re } from "./index3.js";
|
|
22
|
-
import { resolveCreateCardFeatureLabels as ie } from "./index4.js";
|
|
23
|
-
import { CreateCardWidgetAnalyticsEvent as ae, WIDGET_NAME as oe } from "./index2.js";
|
|
24
|
-
import { getCreateCardPermissions as se } from "./index5.js";
|
|
25
|
-
import { useCreateCardCardholderOptions as ce } from "./index6.js";
|
|
26
|
-
import { useCreateCard as le } from "../../data-access/dist/index2.js";
|
|
27
|
-
import { useCreateDebitCardMutation as ue } from "../../data-access/dist/index4.js";
|
|
28
|
-
import { useManageDebitCardAccessMutation as de } from "../../data-access/dist/index5.js";
|
|
29
|
-
import { useCreateCardOrganizationQuery as fe } from "../../data-access/dist/index6.js";
|
|
30
|
-
import "../../data-access/dist/index.js";
|
|
31
|
-
import { useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
32
|
-
import { Fragment as pe, jsx as y, jsxs as me } from "react/jsx-runtime";
|
|
8
|
+
import { useCallback as n, useMemo as r } from "react";
|
|
33
9
|
//#region ../../libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
zip: ""
|
|
39
|
-
}, _e = 3e3, b = 5e3;
|
|
40
|
-
function ve(e, t) {
|
|
41
|
-
if (e === "PENDING_ACTIVATION") return {
|
|
42
|
-
title: t.success.pendingActivationTitle,
|
|
43
|
-
description: t.success.pendingActivationDescription
|
|
44
|
-
};
|
|
45
|
-
if (e !== null && e !== "ACTIVE") return {
|
|
46
|
-
title: t.success.createdTitle,
|
|
47
|
-
description: t.success.createdDescription
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function x(e) {
|
|
51
|
-
let t = e?.trim().slice(-4);
|
|
52
|
-
return t ? `••••${t}` : void 0;
|
|
10
|
+
var i = e.DebitCardReadOrg;
|
|
11
|
+
function a(e) {
|
|
12
|
+
let t = e.name?.trim(), n = e.email?.trim();
|
|
13
|
+
return t && n ? `${t} (${n})` : t || n || e.id;
|
|
53
14
|
}
|
|
54
|
-
function
|
|
55
|
-
let
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let E = a(), { isReady: D } = le(), { initResponse: O, organizationId: k } = c(), A = g(() => se(O?.scopes), [O?.scopes]), j = ie(oe), M = {
|
|
60
|
-
...l,
|
|
61
|
-
...o,
|
|
62
|
-
setup: {
|
|
63
|
-
...l.setup,
|
|
64
|
-
...o?.setup
|
|
65
|
-
}
|
|
66
|
-
}, ye = g(() => [{
|
|
67
|
-
value: p.Virtual,
|
|
68
|
-
label: M.setup.cardFormatVirtual
|
|
69
|
-
}, {
|
|
70
|
-
value: p.Physical,
|
|
71
|
-
label: M.setup.cardFormatPhysical
|
|
72
|
-
}], [M.setup.cardFormatPhysical, M.setup.cardFormatVirtual]), be = g(() => s(), []), [xe, N] = v(u.Setup), [P, F] = v(null), [I, L] = v(null), [Se, R] = v(null), [z, B] = v(null), [V, H] = v(ge), [Ce, we] = v(null), [Te, Ee] = v(null), De = () => {
|
|
73
|
-
F(null), L(null), R(null), B(null), H(ge), we(null), Ee(null), N(u.Setup);
|
|
74
|
-
}, Oe = _(k);
|
|
75
|
-
k && k !== Oe.current && (Oe.current = k, De());
|
|
76
|
-
let U = _(!0);
|
|
77
|
-
h(() => (U.current = !0, () => {
|
|
78
|
-
U.current = !1;
|
|
79
|
-
}), []), h(() => {
|
|
80
|
-
E(ae.Mounted);
|
|
81
|
-
}, [E]);
|
|
82
|
-
let { options: ke, isError: W, refetch: Ae } = ce({ enabled: D && A.canReadUsers }), G = r({
|
|
83
|
-
enabled: D && A.canReadUsers,
|
|
84
|
-
permissions: [he]
|
|
85
|
-
}), je = g(() => !D || !A.canReadUsers || G.isResolving || G.isError ? [] : (G.data?.data ?? []).filter((e) => e.organizationId === k).map((e) => e.id), [
|
|
86
|
-
G.data?.data,
|
|
87
|
-
G.isError,
|
|
88
|
-
G.isResolving,
|
|
89
|
-
D,
|
|
90
|
-
k,
|
|
91
|
-
A.canReadUsers
|
|
92
|
-
]), K = !!G.isError && D && A.canReadUsers, Me = D && A.canReadUsers && G.isResolving, q = _(null);
|
|
93
|
-
h(() => {
|
|
94
|
-
if (!K) {
|
|
95
|
-
q.current !== null && (e.dismiss(q.current), q.current = null);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
return q.current = e.error(j.toast.debitCardIssuersError, {
|
|
99
|
-
duration: Infinity,
|
|
100
|
-
action: {
|
|
101
|
-
label: j.toast.retry,
|
|
102
|
-
onClick: () => {
|
|
103
|
-
G.refetch();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}), () => {
|
|
107
|
-
q.current !== null && (e.dismiss(q.current), q.current = null);
|
|
108
|
-
};
|
|
109
|
-
}, [
|
|
110
|
-
G.refetch,
|
|
111
|
-
j.toast.debitCardIssuersError,
|
|
112
|
-
j.toast.retry,
|
|
113
|
-
K
|
|
114
|
-
]);
|
|
115
|
-
let Ne = fe({ enabled: D && A.canReadOrganization }), J = n({ enabled: D && A.canReadFundingAccounts }), Pe = ue(), Fe = de(), Y = !!J.isError && D && A.canReadFundingAccounts, X = g(() => Y ? [] : (J.data?.data ?? []).map((e) => ({
|
|
15
|
+
function o({ enabled: e = !0 } = {}) {
|
|
16
|
+
let o = t({
|
|
17
|
+
enabled: e,
|
|
18
|
+
permissions: [i]
|
|
19
|
+
}), s = o.data?.data, c = r(() => !e || o.isResolving ? [] : [...s ?? []].sort((e, t) => e.name.localeCompare(t.name)).map((e) => ({
|
|
116
20
|
value: e.id,
|
|
117
|
-
label:
|
|
21
|
+
label: a(e)
|
|
118
22
|
})), [
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
]),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
};
|
|
131
|
-
}, [
|
|
132
|
-
Te,
|
|
133
|
-
j,
|
|
134
|
-
o
|
|
135
|
-
]), Ue = async () => {
|
|
136
|
-
if (!D) return;
|
|
137
|
-
let t = ee(), n = m({
|
|
138
|
-
cardholderUserId: P,
|
|
139
|
-
format: I,
|
|
140
|
-
bankAccountId: Z,
|
|
141
|
-
reference: t,
|
|
142
|
-
mailingOption: z,
|
|
143
|
-
orgAddress: Q,
|
|
144
|
-
manualAddress: V
|
|
145
|
-
});
|
|
146
|
-
if (!n) return;
|
|
147
|
-
N(u.Preparing);
|
|
148
|
-
let r = e.loading(j.toast.creating);
|
|
149
|
-
try {
|
|
150
|
-
let t = await Pe.mutateAsync({ body: n });
|
|
151
|
-
if (!U.current) {
|
|
152
|
-
e.dismiss(r);
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
if (we(t.id), Ee(t.cardStatus), je.length > 0) try {
|
|
156
|
-
await Fe.mutateAsync({ body: {
|
|
157
|
-
debitCardIds: [t.id],
|
|
158
|
-
type: "GRANT",
|
|
159
|
-
userIds: je
|
|
160
|
-
} });
|
|
161
|
-
} catch {
|
|
162
|
-
if (!U.current) {
|
|
163
|
-
e.dismiss(r);
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
N(u.Success), e.warning(j.toast.companyAdminAccessWarning, {
|
|
167
|
-
id: r,
|
|
168
|
-
duration: b
|
|
169
|
-
});
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
if (!U.current) {
|
|
173
|
-
e.dismiss(r);
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
N(u.Success), e.success(j.toast.success, {
|
|
177
|
-
id: r,
|
|
178
|
-
duration: _e
|
|
179
|
-
});
|
|
180
|
-
} catch {
|
|
181
|
-
if (!U.current) {
|
|
182
|
-
e.dismiss(r);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
N(u.Setup), e.error(j.toast.error, {
|
|
186
|
-
id: r,
|
|
187
|
-
duration: b
|
|
188
|
-
});
|
|
189
|
-
}
|
|
23
|
+
e,
|
|
24
|
+
s,
|
|
25
|
+
o.isResolving
|
|
26
|
+
]), l = o.refetch, u = n(() => {
|
|
27
|
+
l();
|
|
28
|
+
}, [l]);
|
|
29
|
+
return {
|
|
30
|
+
options: c,
|
|
31
|
+
isResolving: e && o.isResolving,
|
|
32
|
+
isError: e && o.isError,
|
|
33
|
+
refetch: u
|
|
190
34
|
};
|
|
191
|
-
return /* @__PURE__ */ me(pe, { children: [/* @__PURE__ */ y(i, {}), /* @__PURE__ */ y(f, {
|
|
192
|
-
view: xe,
|
|
193
|
-
cardArtSrc: t,
|
|
194
|
-
labels: He,
|
|
195
|
-
className: x,
|
|
196
|
-
cardholderOptions: ke,
|
|
197
|
-
selectedCardholder: P,
|
|
198
|
-
onCardholderSelect: F,
|
|
199
|
-
isCardholderError: W,
|
|
200
|
-
onCardholderRetry: W ? Ae : void 0,
|
|
201
|
-
cardFormatOptions: ye,
|
|
202
|
-
selectedCardFormat: I,
|
|
203
|
-
onCardFormatSelect: (e) => {
|
|
204
|
-
L(e), B(null);
|
|
205
|
-
},
|
|
206
|
-
isFundingAccountVisible: Be,
|
|
207
|
-
fundingAccountOptions: X,
|
|
208
|
-
selectedFundingAccount: Z,
|
|
209
|
-
onFundingAccountSelect: R,
|
|
210
|
-
isFundingAccountError: Y,
|
|
211
|
-
onFundingAccountRetry: Y ? () => {
|
|
212
|
-
J.refetch();
|
|
213
|
-
} : void 0,
|
|
214
|
-
isMailingSectionVisible: $,
|
|
215
|
-
selectedMailingOption: z,
|
|
216
|
-
onMailingOptionSelect: B,
|
|
217
|
-
businessAddress: Ie,
|
|
218
|
-
isBusinessAddressVisible: Re,
|
|
219
|
-
isManualAddressVisible: ze,
|
|
220
|
-
manualAddress: V,
|
|
221
|
-
onManualAddressChange: (e) => H((t) => ({
|
|
222
|
-
...t,
|
|
223
|
-
...e
|
|
224
|
-
})),
|
|
225
|
-
stateOptions: be,
|
|
226
|
-
isCreateDisabled: Ve,
|
|
227
|
-
onCreateClick: () => {
|
|
228
|
-
Ue();
|
|
229
|
-
},
|
|
230
|
-
onCancelClick: () => {
|
|
231
|
-
w?.(), C?.();
|
|
232
|
-
},
|
|
233
|
-
onClose: C,
|
|
234
|
-
onCreateAnotherClick: De,
|
|
235
|
-
onViewCardClick: T && Ce ? () => {
|
|
236
|
-
T(Ce);
|
|
237
|
-
} : void 0
|
|
238
|
-
})] });
|
|
239
|
-
}
|
|
240
|
-
function w({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, providerLabels: p, ...m }) {
|
|
241
|
-
return /* @__PURE__ */ y(o, {
|
|
242
|
-
widgetName: oe,
|
|
243
|
-
baseUrl: e,
|
|
244
|
-
widgetToken: t,
|
|
245
|
-
organizationId: n,
|
|
246
|
-
configClient: r,
|
|
247
|
-
gatewayRouting: i,
|
|
248
|
-
linkComponent: a,
|
|
249
|
-
implementation: s,
|
|
250
|
-
uiFramework: c,
|
|
251
|
-
errorFallback: l,
|
|
252
|
-
onError: u,
|
|
253
|
-
analytics: d,
|
|
254
|
-
disclosuresAcceptance: f,
|
|
255
|
-
providerLabels: p,
|
|
256
|
-
children: /* @__PURE__ */ y(C, { ...m })
|
|
257
|
-
});
|
|
258
35
|
}
|
|
259
36
|
//#endregion
|
|
260
|
-
export {
|
|
37
|
+
export { i as CARDHOLDER_PERMISSION_KEY, a as formatCardholderOptionLabel, o as useCreateCardCardholderOptions };
|