@tesouro/embedded-components-react 0.3.12 → 0.3.13
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.d.ts +12 -0
- package/dist/lib/CardsWidget.d.ts +12 -0
- package/dist/lib/CreateCardWidget.d.ts +12 -0
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +19 -12
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +22 -37
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +167 -110
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +18 -18
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +111 -104
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +144 -128
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +20 -18
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2310,6 +2310,18 @@ interface CreateCardFeatureLabels {
|
|
|
2310
2310
|
creating: string;
|
|
2311
2311
|
success: string;
|
|
2312
2312
|
error: string;
|
|
2313
|
+
/**
|
|
2314
|
+
* Card issued but granting company admins access to it failed. The card
|
|
2315
|
+
* already exists; this must not read as a create failure.
|
|
2316
|
+
*/
|
|
2317
|
+
companyAdminAccessWarning: string;
|
|
2318
|
+
/**
|
|
2319
|
+
* The roster of users to grant access to a new card failed to load.
|
|
2320
|
+
* Shown with a retry action; Create stays disabled until it resolves so
|
|
2321
|
+
* a card is never issued without its required admin grants.
|
|
2322
|
+
*/
|
|
2323
|
+
debitCardIssuersError: string;
|
|
2324
|
+
retry: string;
|
|
2313
2325
|
};
|
|
2314
2326
|
untitledFundingAccount: string;
|
|
2315
2327
|
/**
|
|
@@ -968,6 +968,18 @@ interface CreateCardFeatureLabels {
|
|
|
968
968
|
creating: string;
|
|
969
969
|
success: string;
|
|
970
970
|
error: string;
|
|
971
|
+
/**
|
|
972
|
+
* Card issued but granting company admins access to it failed. The card
|
|
973
|
+
* already exists; this must not read as a create failure.
|
|
974
|
+
*/
|
|
975
|
+
companyAdminAccessWarning: string;
|
|
976
|
+
/**
|
|
977
|
+
* The roster of users to grant access to a new card failed to load.
|
|
978
|
+
* Shown with a retry action; Create stays disabled until it resolves so
|
|
979
|
+
* a card is never issued without its required admin grants.
|
|
980
|
+
*/
|
|
981
|
+
debitCardIssuersError: string;
|
|
982
|
+
retry: string;
|
|
971
983
|
};
|
|
972
984
|
untitledFundingAccount: string;
|
|
973
985
|
/**
|
|
@@ -691,6 +691,18 @@ interface CreateCardFeatureLabels {
|
|
|
691
691
|
creating: string;
|
|
692
692
|
success: string;
|
|
693
693
|
error: string;
|
|
694
|
+
/**
|
|
695
|
+
* Card issued but granting company admins access to it failed. The card
|
|
696
|
+
* already exists; this must not read as a create failure.
|
|
697
|
+
*/
|
|
698
|
+
companyAdminAccessWarning: string;
|
|
699
|
+
/**
|
|
700
|
+
* The roster of users to grant access to a new card failed to load.
|
|
701
|
+
* Shown with a retry action; Create stays disabled until it resolves so
|
|
702
|
+
* a card is never issued without its required admin grants.
|
|
703
|
+
*/
|
|
704
|
+
debitCardIssuersError: string;
|
|
705
|
+
retry: string;
|
|
694
706
|
};
|
|
695
707
|
untitledFundingAccount: string;
|
|
696
708
|
/**
|
|
@@ -17,7 +17,6 @@ var r = {
|
|
|
17
17
|
}
|
|
18
18
|
}, i = [t.BankAccountReadOrg], a = {
|
|
19
19
|
users: [t.UserReadOrg],
|
|
20
|
-
roles: [t.RoleReadOrg],
|
|
21
20
|
funding: i
|
|
22
21
|
};
|
|
23
22
|
function o({ cardProgram: t, scopes: o }) {
|
|
@@ -27,7 +26,7 @@ function o({ cardProgram: t, scopes: o }) {
|
|
|
27
26
|
canActivate: e(s, c.activate),
|
|
28
27
|
canCreate: e(s, c.create),
|
|
29
28
|
canReadFundingAccounts: t === n.Debit && e(s, i),
|
|
30
|
-
canComposeDebitCreate: t === n.Debit && e(s, a.users) && e(s, a.
|
|
29
|
+
canComposeDebitCreate: t === n.Debit && e(s, a.users) && e(s, a.funding)
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
//#endregion
|
package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useCreateCard as e } from "./index2.js";
|
|
2
2
|
import "./index3.js";
|
|
3
3
|
import { useCreateDebitCardMutation as t } from "./index4.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { useManageDebitCardAccessMutation as n } from "./index5.js";
|
|
5
|
+
import { useCreateCardOrganizationQuery as r } from "./index6.js";
|
|
6
|
+
export { e as useCreateCard, r as useCreateCardOrganizationQuery, t as useCreateDebitCardMutation, n as useManageDebitCardAccessMutation };
|
package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js
CHANGED
|
@@ -2,21 +2,28 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { invalidateAllClients as e } from "../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
6
|
+
import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import { organizationHeaders as n } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
8
|
+
import { manageDebitCardAccessMutation as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
8
9
|
import "../../../shared/data-access/dist/index.js";
|
|
9
|
-
import {
|
|
10
|
+
import { debitCardsInvalidationKey as i } from "./index3.js";
|
|
11
|
+
import { useMutation as a } from "@tanstack/react-query";
|
|
10
12
|
//#region ../../libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js
|
|
11
|
-
function
|
|
12
|
-
let { client:
|
|
13
|
-
client:
|
|
14
|
-
|
|
13
|
+
function o() {
|
|
14
|
+
let { client: o, organizationId: s } = t(), c = n(s), l = r({
|
|
15
|
+
client: o,
|
|
16
|
+
headers: c
|
|
15
17
|
});
|
|
16
|
-
return
|
|
17
|
-
...
|
|
18
|
-
|
|
18
|
+
return a({
|
|
19
|
+
...l,
|
|
20
|
+
onSuccess: async (...t) => {
|
|
21
|
+
await e(i({
|
|
22
|
+
client: o,
|
|
23
|
+
organizationId: s
|
|
24
|
+
})), await l.onSuccess?.(...t);
|
|
25
|
+
}
|
|
19
26
|
});
|
|
20
27
|
}
|
|
21
28
|
//#endregion
|
|
22
|
-
export {
|
|
29
|
+
export { o as useManageDebitCardAccessMutation };
|
package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
6
|
+
import { getOrganizationOptions as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
7
|
+
import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
|
|
8
|
+
import "../../../shared/data-access/dist/index.js";
|
|
9
|
+
import { useQuery as r } from "@tanstack/react-query";
|
|
10
|
+
//#region ../../libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js
|
|
11
|
+
function i({ enabled: i } = {}) {
|
|
12
|
+
let { client: a, organizationId: o, widgetToken: s, authEpoch: c } = e(), l = t({
|
|
13
|
+
client: a,
|
|
14
|
+
path: { organizationId: o ?? "" }
|
|
15
|
+
});
|
|
16
|
+
return r({
|
|
17
|
+
...n(l, c),
|
|
18
|
+
enabled: !!(o && s) && (i === !0 || i === void 0)
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as useCreateCardOrganizationQuery };
|
package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js
CHANGED
|
@@ -3,7 +3,10 @@ var e = {
|
|
|
3
3
|
toast: {
|
|
4
4
|
creating: "Creating your card…",
|
|
5
5
|
success: "Card created successfully.",
|
|
6
|
-
error: "We could not create this card. Please try again."
|
|
6
|
+
error: "We could not create this card. Please try again.",
|
|
7
|
+
companyAdminAccessWarning: "Card created, but some admins could not be granted access to it.",
|
|
8
|
+
debitCardIssuersError: "We could not load the list of admins to grant access to this card.",
|
|
9
|
+
retry: "Retry"
|
|
7
10
|
},
|
|
8
11
|
untitledFundingAccount: "Bank account",
|
|
9
12
|
success: {
|
package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js
CHANGED
|
@@ -3,50 +3,35 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { Scope as e } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
6
|
-
import {
|
|
7
|
-
import { useRolePermissionsQueries as n } from "../../../shared/data-access/dist/lib/role/useRolePermissionsQueries.js";
|
|
8
|
-
import { useAllOrganizationUsersQuery as r } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.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 { useCallback as
|
|
8
|
+
import { useCallback as n, useMemo as r } from "react";
|
|
11
9
|
//#region ../../libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js
|
|
12
|
-
var
|
|
13
|
-
function
|
|
10
|
+
var i = e.DebitCardReadOrg;
|
|
11
|
+
function a(e) {
|
|
14
12
|
let t = e.name?.trim(), n = e.email?.trim();
|
|
15
13
|
return t && n ? `${t} (${n})` : t || n || e.id;
|
|
16
14
|
}
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let r = t.get(e.role?.trim().toLowerCase() ?? "");
|
|
26
|
-
return !!(r && n(r.id));
|
|
27
|
-
}).sort((e, t) => e.name.localeCompare(t.name)).map((e) => ({
|
|
28
|
-
value: e.id,
|
|
29
|
-
label: s(e)
|
|
30
|
-
}));
|
|
31
|
-
}, [
|
|
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
|
+
})), [
|
|
32
23
|
e,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
m(), h(), g();
|
|
39
|
-
}, [
|
|
40
|
-
g,
|
|
41
|
-
h,
|
|
42
|
-
m
|
|
43
|
-
]);
|
|
24
|
+
s,
|
|
25
|
+
o.isResolving
|
|
26
|
+
]), l = o.refetch, u = n(() => {
|
|
27
|
+
l();
|
|
28
|
+
}, [l]);
|
|
44
29
|
return {
|
|
45
|
-
options:
|
|
46
|
-
isResolving:
|
|
47
|
-
isError: e &&
|
|
48
|
-
refetch:
|
|
30
|
+
options: c,
|
|
31
|
+
isResolving: e && o.isResolving,
|
|
32
|
+
isError: e && o.isError,
|
|
33
|
+
refetch: u
|
|
49
34
|
};
|
|
50
35
|
}
|
|
51
36
|
//#endregion
|
|
52
|
-
export {
|
|
37
|
+
export { i as CARDHOLDER_PERMISSION_KEY, a as formatCardholderOptionLabel, o as useCreateCardCardholderOptions };
|
package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js
CHANGED
|
@@ -3,38 +3,41 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
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";
|
|
7
9
|
import "../../../shared/data-access/dist/index.js";
|
|
8
|
-
import { EmbeddedToaster as
|
|
10
|
+
import { EmbeddedToaster as i } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
9
11
|
import "../../../shared/ui/dist/index.js";
|
|
10
|
-
import { useAnalyticsTrack as
|
|
11
|
-
import { WidgetProvider as
|
|
12
|
-
import { getStateOptions as
|
|
13
|
-
import { useWidgetConfig as
|
|
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";
|
|
14
16
|
import "../../../shared/feature/dist/index.js";
|
|
15
|
-
import { CREATE_CARD_WIDGET_LABELS_EN as
|
|
16
|
-
import { CreateCardView as
|
|
17
|
-
import { CreateCardWidget as
|
|
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";
|
|
18
20
|
import "../../ui/dist/index.js";
|
|
19
|
-
import { CardFormatValue as
|
|
21
|
+
import { CardFormatValue as p, buildCreateDebitCardRequest as ee, createDebitCardReference as te, formatBusinessAddress as ne, isBusinessAddressComplete as re, isManualAddressComplete as ie } from "./index3.js";
|
|
20
22
|
import { resolveCreateCardFeatureLabels as ae } from "./index4.js";
|
|
21
|
-
import { CreateCardWidgetAnalyticsEvent as oe, WIDGET_NAME as
|
|
22
|
-
import { getCreateCardPermissions as
|
|
23
|
-
import { useCreateCardCardholderOptions as
|
|
24
|
-
import { useCreateCard as
|
|
25
|
-
import { useCreateDebitCardMutation as
|
|
26
|
-
import {
|
|
23
|
+
import { CreateCardWidgetAnalyticsEvent as oe, WIDGET_NAME as se } from "./index2.js";
|
|
24
|
+
import { getCreateCardPermissions as ce } from "./index5.js";
|
|
25
|
+
import { useCreateCardCardholderOptions as le } from "./index6.js";
|
|
26
|
+
import { useCreateCard as ue } from "../../data-access/dist/index2.js";
|
|
27
|
+
import { useCreateDebitCardMutation as de } from "../../data-access/dist/index4.js";
|
|
28
|
+
import { useManageDebitCardAccessMutation as fe } from "../../data-access/dist/index5.js";
|
|
29
|
+
import { useCreateCardOrganizationQuery as pe } from "../../data-access/dist/index6.js";
|
|
27
30
|
import "../../data-access/dist/index.js";
|
|
28
|
-
import { useEffect as
|
|
29
|
-
import { Fragment as
|
|
31
|
+
import { useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
32
|
+
import { Fragment as me, jsx as v, jsxs as he } from "react/jsx-runtime";
|
|
30
33
|
//#region ../../libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js
|
|
31
|
-
var
|
|
34
|
+
var ge = t.DebitCardIssueOrg, _e = {
|
|
32
35
|
street: "",
|
|
33
36
|
city: "",
|
|
34
37
|
state: "",
|
|
35
38
|
zip: ""
|
|
36
|
-
},
|
|
37
|
-
function
|
|
39
|
+
}, ve = 3e3, y = 5e3;
|
|
40
|
+
function ye(e, t) {
|
|
38
41
|
if (e === "PENDING_ACTIVATION") return {
|
|
39
42
|
title: t.success.pendingActivationTitle,
|
|
40
43
|
description: t.success.pendingActivationDescription
|
|
@@ -44,159 +47,213 @@ function _e(e, t) {
|
|
|
44
47
|
description: t.success.createdDescription
|
|
45
48
|
};
|
|
46
49
|
}
|
|
47
|
-
function
|
|
50
|
+
function b(e) {
|
|
48
51
|
let t = e?.trim().slice(-4);
|
|
49
52
|
return t ? `••••${t}` : void 0;
|
|
50
53
|
}
|
|
51
|
-
function
|
|
52
|
-
let n = e.nickname?.trim(), r =
|
|
54
|
+
function x(e, t) {
|
|
55
|
+
let n = e.nickname?.trim(), r = b(e.accountNumber);
|
|
53
56
|
return n && r ? `${n} (${r})` : n || r || t;
|
|
54
57
|
}
|
|
55
|
-
function
|
|
56
|
-
let
|
|
58
|
+
function S({ cardArtSrc: t, labels: o, featureLabels: se, className: b, onClose: S, onCancel: C, onViewCard: w }) {
|
|
59
|
+
let T = a(), { isReady: E } = ue(), { initResponse: D, organizationId: O } = c(), k = h(() => ce(D?.scopes), [D?.scopes]), A = ae(se), j = {
|
|
60
|
+
...l,
|
|
57
61
|
...o,
|
|
58
|
-
...f,
|
|
59
62
|
setup: {
|
|
60
|
-
...
|
|
61
|
-
...
|
|
63
|
+
...l.setup,
|
|
64
|
+
...o?.setup
|
|
62
65
|
}
|
|
63
|
-
},
|
|
64
|
-
value:
|
|
65
|
-
label:
|
|
66
|
+
}, be = h(() => [{
|
|
67
|
+
value: p.Virtual,
|
|
68
|
+
label: j.setup.cardFormatVirtual
|
|
66
69
|
}, {
|
|
67
|
-
value:
|
|
68
|
-
label:
|
|
69
|
-
}], [
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}), []),
|
|
77
|
-
|
|
78
|
-
}, [
|
|
79
|
-
let { options:
|
|
70
|
+
value: p.Physical,
|
|
71
|
+
label: j.setup.cardFormatPhysical
|
|
72
|
+
}], [j.setup.cardFormatPhysical, j.setup.cardFormatVirtual]), xe = h(() => s(), []), [Se, M] = _(u.Setup), [N, P] = _(null), [F, I] = _(null), [Ce, L] = _(null), [R, z] = _(null), [B, V] = _(_e), [H, we] = _(null), [Te, Ee] = _(null), De = () => {
|
|
73
|
+
P(null), I(null), L(null), z(null), V(_e), we(null), Ee(null), M(u.Setup);
|
|
74
|
+
}, Oe = g(O);
|
|
75
|
+
O && O !== Oe.current && (Oe.current = O, De());
|
|
76
|
+
let U = g(!0);
|
|
77
|
+
m(() => (U.current = !0, () => {
|
|
78
|
+
U.current = !1;
|
|
79
|
+
}), []), m(() => {
|
|
80
|
+
T(oe.Mounted);
|
|
81
|
+
}, [T]);
|
|
82
|
+
let { options: ke, isError: W, refetch: Ae } = le({ enabled: E && k.canReadUsers }), G = r({
|
|
83
|
+
enabled: E && k.canReadUsers,
|
|
84
|
+
permissions: [ge]
|
|
85
|
+
}), je = h(() => !E || !k.canReadUsers || G.isResolving || G.isError ? [] : (G.data?.data ?? []).filter((e) => e.organizationId === O).map((e) => e.id), [
|
|
86
|
+
G.data?.data,
|
|
87
|
+
G.isError,
|
|
88
|
+
G.isResolving,
|
|
89
|
+
E,
|
|
90
|
+
O,
|
|
91
|
+
k.canReadUsers
|
|
92
|
+
]), K = !!G.isError && E && k.canReadUsers, Me = E && k.canReadUsers && G.isResolving, q = g(null);
|
|
93
|
+
m(() => {
|
|
94
|
+
if (!K) {
|
|
95
|
+
q.current !== null && (e.dismiss(q.current), q.current = null);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
return q.current = e.error(A.toast.debitCardIssuersError, {
|
|
99
|
+
duration: Infinity,
|
|
100
|
+
action: {
|
|
101
|
+
label: A.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
|
+
A.toast.debitCardIssuersError,
|
|
112
|
+
A.toast.retry,
|
|
113
|
+
K
|
|
114
|
+
]);
|
|
115
|
+
let Ne = pe({ enabled: E && k.canReadOrganization }), J = n({ enabled: E && k.canReadFundingAccounts }), Pe = de(), Fe = fe(), Y = !!J.isError && E && k.canReadFundingAccounts, X = h(() => Y ? [] : (J.data?.data ?? []).map((e) => ({
|
|
80
116
|
value: e.id,
|
|
81
|
-
label:
|
|
117
|
+
label: x(e, A.untitledFundingAccount)
|
|
82
118
|
})), [
|
|
83
119
|
J.data?.data,
|
|
84
|
-
|
|
120
|
+
A.untitledFundingAccount,
|
|
85
121
|
Y
|
|
86
|
-
]), Z =
|
|
87
|
-
let e =
|
|
122
|
+
]), Z = Ce ?? (X.length === 1 ? X[0].value : null), Q = Ne.data?.address, Ie = ne(Q), Le = re(Q), $ = F === p.Physical, Re = $ && R === d.BusinessAddress && !!Ie, ze = $ && R === d.DifferentAddress, Be = Y || X.length > 0, Ve = !E || !k.canIssue || Pe.isPending || W || Y || K || Me || !N || !F || !Z || F === p.Physical && (!R || R === d.BusinessAddress && !Le || R === d.DifferentAddress && !ie(B)), He = h(() => {
|
|
123
|
+
let e = ye(Te, A);
|
|
88
124
|
return {
|
|
89
|
-
...
|
|
125
|
+
...o,
|
|
90
126
|
success: {
|
|
91
|
-
...
|
|
127
|
+
...o?.success,
|
|
92
128
|
...e
|
|
93
129
|
}
|
|
94
130
|
};
|
|
95
131
|
}, [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
]),
|
|
100
|
-
if (!
|
|
101
|
-
let t =
|
|
102
|
-
cardholderUserId:
|
|
103
|
-
format:
|
|
132
|
+
Te,
|
|
133
|
+
A,
|
|
134
|
+
o
|
|
135
|
+
]), Ue = async () => {
|
|
136
|
+
if (!E) return;
|
|
137
|
+
let t = te(), n = ee({
|
|
138
|
+
cardholderUserId: N,
|
|
139
|
+
format: F,
|
|
104
140
|
bankAccountId: Z,
|
|
105
141
|
reference: t,
|
|
106
|
-
mailingOption:
|
|
142
|
+
mailingOption: R,
|
|
107
143
|
orgAddress: Q,
|
|
108
|
-
manualAddress:
|
|
144
|
+
manualAddress: B
|
|
109
145
|
});
|
|
110
146
|
if (!n) return;
|
|
111
|
-
|
|
112
|
-
let r = e.loading(
|
|
147
|
+
M(u.Preparing);
|
|
148
|
+
let r = e.loading(A.toast.creating);
|
|
113
149
|
try {
|
|
114
|
-
let t = await
|
|
115
|
-
if (!
|
|
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
|
+
M(u.Success), e.warning(A.toast.companyAdminAccessWarning, {
|
|
167
|
+
id: r,
|
|
168
|
+
duration: y
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (!U.current) {
|
|
116
173
|
e.dismiss(r);
|
|
117
174
|
return;
|
|
118
175
|
}
|
|
119
|
-
|
|
176
|
+
M(u.Success), e.success(A.toast.success, {
|
|
120
177
|
id: r,
|
|
121
|
-
duration:
|
|
178
|
+
duration: ve
|
|
122
179
|
});
|
|
123
180
|
} catch {
|
|
124
|
-
if (!
|
|
181
|
+
if (!U.current) {
|
|
125
182
|
e.dismiss(r);
|
|
126
183
|
return;
|
|
127
184
|
}
|
|
128
|
-
|
|
185
|
+
M(u.Setup), e.error(A.toast.error, {
|
|
129
186
|
id: r,
|
|
130
|
-
duration:
|
|
187
|
+
duration: y
|
|
131
188
|
});
|
|
132
189
|
}
|
|
133
190
|
};
|
|
134
|
-
return /* @__PURE__ */ me
|
|
135
|
-
view:
|
|
136
|
-
cardArtSrc:
|
|
137
|
-
labels:
|
|
191
|
+
return /* @__PURE__ */ he(me, { children: [/* @__PURE__ */ v(i, {}), /* @__PURE__ */ v(f, {
|
|
192
|
+
view: Se,
|
|
193
|
+
cardArtSrc: t,
|
|
194
|
+
labels: He,
|
|
138
195
|
className: b,
|
|
139
|
-
cardholderOptions:
|
|
140
|
-
selectedCardholder:
|
|
141
|
-
onCardholderSelect:
|
|
142
|
-
isCardholderError:
|
|
143
|
-
onCardholderRetry:
|
|
144
|
-
cardFormatOptions:
|
|
145
|
-
selectedCardFormat:
|
|
196
|
+
cardholderOptions: ke,
|
|
197
|
+
selectedCardholder: N,
|
|
198
|
+
onCardholderSelect: P,
|
|
199
|
+
isCardholderError: W,
|
|
200
|
+
onCardholderRetry: W ? Ae : void 0,
|
|
201
|
+
cardFormatOptions: be,
|
|
202
|
+
selectedCardFormat: F,
|
|
146
203
|
onCardFormatSelect: (e) => {
|
|
147
|
-
|
|
204
|
+
I(e), z(null);
|
|
148
205
|
},
|
|
149
|
-
isFundingAccountVisible:
|
|
206
|
+
isFundingAccountVisible: Be,
|
|
150
207
|
fundingAccountOptions: X,
|
|
151
208
|
selectedFundingAccount: Z,
|
|
152
|
-
onFundingAccountSelect:
|
|
209
|
+
onFundingAccountSelect: L,
|
|
153
210
|
isFundingAccountError: Y,
|
|
154
211
|
onFundingAccountRetry: Y ? () => {
|
|
155
212
|
J.refetch();
|
|
156
213
|
} : void 0,
|
|
157
214
|
isMailingSectionVisible: $,
|
|
158
|
-
selectedMailingOption:
|
|
159
|
-
onMailingOptionSelect:
|
|
160
|
-
businessAddress:
|
|
161
|
-
isBusinessAddressVisible:
|
|
162
|
-
isManualAddressVisible:
|
|
163
|
-
manualAddress:
|
|
164
|
-
onManualAddressChange: (e) =>
|
|
215
|
+
selectedMailingOption: R,
|
|
216
|
+
onMailingOptionSelect: z,
|
|
217
|
+
businessAddress: Ie,
|
|
218
|
+
isBusinessAddressVisible: Re,
|
|
219
|
+
isManualAddressVisible: ze,
|
|
220
|
+
manualAddress: B,
|
|
221
|
+
onManualAddressChange: (e) => V((t) => ({
|
|
165
222
|
...t,
|
|
166
223
|
...e
|
|
167
224
|
})),
|
|
168
|
-
stateOptions:
|
|
169
|
-
isCreateDisabled:
|
|
225
|
+
stateOptions: xe,
|
|
226
|
+
isCreateDisabled: Ve,
|
|
170
227
|
onCreateClick: () => {
|
|
171
|
-
|
|
228
|
+
Ue();
|
|
172
229
|
},
|
|
173
230
|
onCancelClick: () => {
|
|
174
|
-
|
|
231
|
+
C?.(), S?.();
|
|
175
232
|
},
|
|
176
|
-
onClose:
|
|
177
|
-
onCreateAnotherClick:
|
|
178
|
-
onViewCardClick:
|
|
179
|
-
|
|
233
|
+
onClose: S,
|
|
234
|
+
onCreateAnotherClick: De,
|
|
235
|
+
onViewCardClick: w && H ? () => {
|
|
236
|
+
w(H);
|
|
180
237
|
} : void 0
|
|
181
238
|
})] });
|
|
182
239
|
}
|
|
183
|
-
function
|
|
184
|
-
return /* @__PURE__ */
|
|
185
|
-
widgetName:
|
|
240
|
+
function C({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: i, linkComponent: a, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, ...p }) {
|
|
241
|
+
return /* @__PURE__ */ v(o, {
|
|
242
|
+
widgetName: se,
|
|
186
243
|
baseUrl: e,
|
|
187
244
|
widgetToken: t,
|
|
188
245
|
organizationId: n,
|
|
189
246
|
configClient: r,
|
|
190
247
|
gatewayRouting: i,
|
|
191
248
|
linkComponent: a,
|
|
192
|
-
implementation:
|
|
193
|
-
uiFramework:
|
|
194
|
-
errorFallback:
|
|
195
|
-
onError:
|
|
196
|
-
analytics:
|
|
197
|
-
disclosuresAcceptance:
|
|
198
|
-
children: /* @__PURE__ */
|
|
249
|
+
implementation: s,
|
|
250
|
+
uiFramework: c,
|
|
251
|
+
errorFallback: l,
|
|
252
|
+
onError: u,
|
|
253
|
+
analytics: d,
|
|
254
|
+
disclosuresAcceptance: f,
|
|
255
|
+
children: /* @__PURE__ */ v(S, { ...p })
|
|
199
256
|
});
|
|
200
257
|
}
|
|
201
258
|
//#endregion
|
|
202
|
-
export {
|
|
259
|
+
export { C as CreateCardWidget, x as formatFundingAccountLabel };
|