@tesouro/embedded-components-react 0.3.16 → 0.3.18
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 +22 -1
- package/dist/index.js +10 -10
- package/dist/lib/AcceptDisclosuresWidget.d.ts +11 -1
- package/dist/lib/AcceptDisclosuresWidget.js +1 -1
- package/dist/lib/BalancesWidget.js +1 -1
- package/dist/lib/BankAccountOnboardingWidget.d.ts +21 -21
- package/dist/lib/BankAccountOnboardingWidget.js +1 -1
- package/dist/lib/CardsWidget.js +1 -1
- package/dist/lib/ExpenseApprovalPoliciesWidget.js +1 -1
- package/dist/lib/ExpenseManagementWidget.js +1 -1
- package/dist/lib/InsightsWidget.js +1 -1
- package/dist/lib/ReceiptMatchWidget.js +1 -1
- package/dist/lib/TransfersWidget.js +1 -1
- package/dist/lib/UploadReceiptWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +10 -140
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index5.js +152 -0
- package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js +19 -19
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index4.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index5.js +15 -64
- package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/index6.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/BalancesWidget.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/balances-widget/ui/dist/lib/BalancesWidget/SingleBalance/SingleBalance.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index10.js +109 -169
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index11.js +170 -63
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index12.js +73 -81
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index13.js +77 -101
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index14.js +110 -83
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index15.js +91 -7
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +7 -28
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +26 -320
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +341 -0
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index9.js +29 -100
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index11.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index15.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index16.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index18.js +14 -10
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index19.js +42 -42
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index2.js +80 -77
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index20.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index22.js +14 -10
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index23.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index27.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index3.js +7 -6
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index5.js +23 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +28 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/index.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsHeader.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js +4 -23
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index4.js +23 -24
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +24 -30
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js +28 -55
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +54 -209
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +206 -81
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js +95 -0
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardFaceSwatch.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +31 -30
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index10.js +1 -255
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index11.js +253 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index12.js +2 -71
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index13.js +73 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index5.js +7 -218
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +219 -79
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index7.js +89 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js +2 -47
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index9.js +49 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleCard.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ApprovalRuleForm.js +32 -32
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js +11 -8
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index10.js +12 -14
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index11.js +21 -62
- package/dist/libs/tesouro-embedded-components-react/insights-widget/feature/dist/index12.js +73 -0
- package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/InsightsWidget.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/insights-widget/ui/dist/lib/InsightsWidget/SingleInsight/SingleInsight.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +67 -46
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/testIds.js +26 -0
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApprovalPolicyRules.js +151 -135
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index14.js +17 -17
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +17 -15
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index18.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index20.js +16 -13
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index3.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index5.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index9.js +6 -6
- 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/ui/dist/lib/OnboardingShell/OnboardingShell.js +21 -20
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellOverlayPortal.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShellScrollRegion.js +17 -17
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index5.js +18 -99
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index6.js +116 -19
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/index7.js +28 -0
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/ReviewTransferStep.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferMoneyModal.js +13 -11
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransferMoneyModal/TransferResultStep.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/transfers-widget/ui/dist/lib/TransfersWidget/TransfersWidget.js +19 -19
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
- package/package.json +1 -1
|
@@ -1,33 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "../../../shared/data-access/dist/index.js";
|
|
4
|
-
import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
5
|
-
import "../../../shared/feature/dist/index.js";
|
|
1
|
+
import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
2
|
+
import { normalizeAmountOutputCurrencyCode as t } from "../../../shared/util/dist/lib/normalizeAmountOutputCurrencyCode.js";
|
|
6
3
|
//#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
return {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
canReadFundingAccounts: t === n.Debit && e(s, i),
|
|
29
|
-
canComposeDebitCreate: t === n.Debit && e(s, a.users) && e(s, a.funding)
|
|
30
|
-
};
|
|
4
|
+
function n(e) {
|
|
5
|
+
if (e == null || e === "") return;
|
|
6
|
+
let t = Number(e);
|
|
7
|
+
return Number.isFinite(t) ? t : void 0;
|
|
8
|
+
}
|
|
9
|
+
function r({ limit: r, currencyCode: i }) {
|
|
10
|
+
let a = n(r);
|
|
11
|
+
if (a === void 0) return;
|
|
12
|
+
let o = t(i);
|
|
13
|
+
return new Intl.NumberFormat(void 0, {
|
|
14
|
+
style: "currency",
|
|
15
|
+
currency: o,
|
|
16
|
+
maximumFractionDigits: 0
|
|
17
|
+
}).format(a / 10 ** e(o));
|
|
18
|
+
}
|
|
19
|
+
function i(e) {
|
|
20
|
+
let t = e?.trim().slice(-4);
|
|
21
|
+
return t ? `••••${t}` : void 0;
|
|
22
|
+
}
|
|
23
|
+
function a(e, t) {
|
|
24
|
+
return e?.trim() || t;
|
|
31
25
|
}
|
|
32
26
|
//#endregion
|
|
33
|
-
export {
|
|
27
|
+
export { r as formatCardLimit, i as maskAccountNumber, a as withFallback };
|
|
@@ -1,60 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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";
|
|
3
|
+
import "../../../shared/data-access/dist/index.js";
|
|
4
|
+
import { CardProgram as n } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
3
5
|
import "../../../shared/feature/dist/index.js";
|
|
4
|
-
import { formatCardLimit as n, withFallback as r } from "./index4.js";
|
|
5
|
-
import { CARD_COLUMN_KEYS as i } from "../../ui/dist/lib/CardsList/types.js";
|
|
6
|
-
import "../../ui/dist/index.js";
|
|
7
6
|
//#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index6.js
|
|
8
|
-
var
|
|
9
|
-
[
|
|
10
|
-
|
|
7
|
+
var r = {
|
|
8
|
+
[n.Credit]: {
|
|
9
|
+
read: [t.CreditCardReadOrg],
|
|
10
|
+
activate: [t.CreditCardActivateOrg],
|
|
11
|
+
create: [t.CreditCardIssueOrg]
|
|
12
|
+
},
|
|
13
|
+
[n.Debit]: {
|
|
14
|
+
read: [t.DebitCardReadOrg],
|
|
15
|
+
activate: [t.DebitCardActivateOrg],
|
|
16
|
+
create: [t.DebitCardIssueOrg]
|
|
17
|
+
}
|
|
18
|
+
}, i = [t.BankAccountReadOrg], a = {
|
|
19
|
+
users: [t.UserReadOrg],
|
|
20
|
+
funding: i
|
|
11
21
|
};
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
limit: e.cardLimit,
|
|
22
|
-
limitCurrencyCode: e.currentBalance?.currencyCode
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
function c(e) {
|
|
26
|
-
return e.map((e) => ({
|
|
27
|
-
id: e.id,
|
|
28
|
-
userId: e.userId,
|
|
29
|
-
status: e.cardStatus,
|
|
30
|
-
type: e.cardType,
|
|
31
|
-
cardholderName: e.cardholderName,
|
|
32
|
-
nickname: e.nickname,
|
|
33
|
-
lastFourDigits: e.lastFourDigits,
|
|
34
|
-
fundingAccountId: e.bankAccountId
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
function l(e, { labels: i, fundingAccountNames: o, canActivate: s, onCardSelect: c, onActivateCard: l }) {
|
|
38
|
-
return e.map((e) => {
|
|
39
|
-
let u = s && e.status === a, d = e.fundingAccountId ? o?.get(e.fundingAccountId) : void 0;
|
|
40
|
-
return {
|
|
41
|
-
key: e.id,
|
|
42
|
-
nickname: r(e.nickname, i.untitledCard),
|
|
43
|
-
lastFour: e.lastFourDigits,
|
|
44
|
-
typeLabel: i.cardType[e.type] ?? i.emptyValue,
|
|
45
|
-
fundingAccount: d?.name ?? i.emptyValue,
|
|
46
|
-
fundingAccountLastFour: d?.lastFour,
|
|
47
|
-
cardholder: r(e.cardholderName, i.emptyValue),
|
|
48
|
-
statusLabel: i.cardStatus[e.status] ?? i.emptyValue,
|
|
49
|
-
statusTone: t[e.status] ?? "neutral",
|
|
50
|
-
limit: n({
|
|
51
|
-
limit: e.limit,
|
|
52
|
-
currencyCode: e.limitCurrencyCode
|
|
53
|
-
}),
|
|
54
|
-
onSelect: c ? () => c(e.id) : void 0,
|
|
55
|
-
onActivate: u && l ? () => l(e.id) : void 0
|
|
56
|
-
};
|
|
57
|
-
});
|
|
22
|
+
function o({ cardProgram: t, scopes: o }) {
|
|
23
|
+
let s = new Set(o ?? []), c = r[t];
|
|
24
|
+
return {
|
|
25
|
+
canRead: e(s, c.read),
|
|
26
|
+
canActivate: e(s, c.activate),
|
|
27
|
+
canCreate: e(s, c.create),
|
|
28
|
+
canReadFundingAccounts: t === n.Debit && e(s, i),
|
|
29
|
+
canComposeDebitCreate: t === n.Debit && e(s, a.users) && e(s, a.funding)
|
|
30
|
+
};
|
|
58
31
|
}
|
|
59
32
|
//#endregion
|
|
60
|
-
export { o as
|
|
33
|
+
export { o as getCardsPermissions };
|
|
@@ -1,215 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { useAllBankAccountsQuery as e } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
|
|
6
|
-
import "../../../shared/data-access/dist/index.js";
|
|
7
|
-
import { useAnalyticsTrack as t } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
8
|
-
import { useWidgetConfig as n, useWidgetError as ee, useWidgetLoading as te } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
|
-
import { CardProgram as r } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
1
|
+
import { CardProgram as e } from "../../../shared/feature/dist/lib/card/cardProgram.js";
|
|
2
|
+
import { CARD_STATUS_TONE as t } from "../../../shared/feature/dist/lib/card/cardPresentation.js";
|
|
10
3
|
import "../../../shared/feature/dist/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import { maskAccountNumber as ae } from "./index4.js";
|
|
15
|
-
import { CARD_COLUMNS_BY_PROGRAM as oe, toCardRows as se, toCreditCardListItems as ce, toDebitCardListItems as le } from "./index6.js";
|
|
16
|
-
import { useCreditCardsQuery as ue } from "../../data-access/dist/index2.js";
|
|
17
|
-
import { useDebitCardsQuery as de } from "../../data-access/dist/index3.js";
|
|
18
|
-
import "../../data-access/dist/index.js";
|
|
19
|
-
import { useCallback as i, useEffect as a, useMemo as o, useRef as fe, useState as s } from "react";
|
|
20
|
-
import { useControllableState as pe } from "@radix-ui/react-use-controllable-state";
|
|
4
|
+
import { formatCardLimit as n, withFallback as r } from "./index5.js";
|
|
5
|
+
import { CARD_COLUMN_KEYS as i } from "../../ui/dist/lib/CardsList/types.js";
|
|
6
|
+
import "../../ui/dist/index.js";
|
|
21
7
|
//#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
var a = "PENDING_ACTIVATION", o = {
|
|
9
|
+
[e.Credit]: i.filter((e) => e !== "fundingAccount" && e !== "limit"),
|
|
10
|
+
[e.Debit]: i.filter((e) => e !== "limit")
|
|
11
|
+
};
|
|
12
|
+
function s(e) {
|
|
13
|
+
return e.map((e) => ({
|
|
14
|
+
id: e.id,
|
|
15
|
+
userId: e.userId,
|
|
16
|
+
status: e.cardStatus,
|
|
17
|
+
type: e.cardType,
|
|
18
|
+
cardholderName: e.cardholderName,
|
|
19
|
+
nickname: e.nickname,
|
|
20
|
+
lastFourDigits: e.lastFourDigits,
|
|
21
|
+
limit: e.cardLimit,
|
|
22
|
+
limitCurrencyCode: e.currentBalance?.currencyCode
|
|
23
|
+
}));
|
|
29
24
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
function c(e) {
|
|
26
|
+
return e.map((e) => ({
|
|
27
|
+
id: e.id,
|
|
28
|
+
userId: e.userId,
|
|
29
|
+
status: e.cardStatus,
|
|
30
|
+
type: e.cardType,
|
|
31
|
+
cardholderName: e.cardholderName,
|
|
32
|
+
nickname: e.nickname,
|
|
33
|
+
lastFourDigits: e.lastFourDigits,
|
|
34
|
+
fundingAccountId: e.bankAccountId
|
|
35
|
+
}));
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
resetKey: k,
|
|
59
|
-
paginationToken: E.paginationToken,
|
|
60
|
-
pageSize: E.pageSize
|
|
61
|
-
})), [Te, Ee] = s(!0), [De, N] = pe({
|
|
62
|
-
prop: ge,
|
|
63
|
-
defaultProp: _e ?? null,
|
|
64
|
-
onChange: ve,
|
|
65
|
-
caller: "CardsWidget"
|
|
66
|
-
}), P = fe({
|
|
67
|
-
cardProgram: c,
|
|
68
|
-
organizationId: O,
|
|
69
|
-
userId: D
|
|
70
|
-
}), Oe = P.current.cardProgram !== c || l(P.current.organizationId, O) || l(P.current.userId, D);
|
|
71
|
-
a(() => {
|
|
72
|
-
let e = P.current;
|
|
73
|
-
P.current = {
|
|
74
|
-
cardProgram: c,
|
|
75
|
-
organizationId: O,
|
|
76
|
-
userId: D
|
|
77
|
-
}, (e.cardProgram !== c || l(e.organizationId, O) || l(e.userId, D)) && N(null);
|
|
78
|
-
}, [
|
|
79
|
-
c,
|
|
80
|
-
O,
|
|
81
|
-
D,
|
|
82
|
-
N
|
|
83
|
-
]);
|
|
84
|
-
let F = i((e) => {
|
|
85
|
-
N(e);
|
|
86
|
-
}, [N]), I = Te && !!x, ke = j.resetKey === k;
|
|
87
|
-
a(() => {
|
|
88
|
-
A || M((e) => e.resetKey === k ? e : {
|
|
89
|
-
resetKey: k,
|
|
90
|
-
paginationToken: E.paginationToken,
|
|
91
|
-
pageSize: E.pageSize
|
|
92
|
-
});
|
|
93
|
-
}, [
|
|
94
|
-
E.pageSize,
|
|
95
|
-
E.paginationToken,
|
|
96
|
-
A,
|
|
97
|
-
k
|
|
98
|
-
]);
|
|
99
|
-
let L = A ? Se : ke ? j : E, Ae = L.paginationToken, R = L.pageSize, z = I ? x : void 0, B = {
|
|
100
|
-
limit: R,
|
|
101
|
-
paginationToken: Ae
|
|
102
|
-
}, V = ue({
|
|
103
|
-
...B,
|
|
104
|
-
userId: z,
|
|
105
|
-
enabled: T && c === r.Credit
|
|
106
|
-
}), H = de({
|
|
107
|
-
...B,
|
|
108
|
-
cardholderUserId: z,
|
|
109
|
-
enabled: T && c === r.Debit
|
|
110
|
-
}), U = c === r.Credit ? V : H, W = T && w.canReadFundingAccounts, G = e({ enabled: W }), K = o(() => {
|
|
111
|
-
let e = /* @__PURE__ */ new Map();
|
|
112
|
-
if (!w.canReadFundingAccounts) return e;
|
|
113
|
-
for (let t of G.data?.data ?? []) {
|
|
114
|
-
let n = t.nickname?.trim();
|
|
115
|
-
e.set(t.id, n ? {
|
|
116
|
-
name: n,
|
|
117
|
-
lastFour: t.accountNumber?.trim().slice(-4) || void 0
|
|
118
|
-
} : { name: ae(t.accountNumber) ?? _.untitledFundingAccount });
|
|
119
|
-
}
|
|
120
|
-
return e;
|
|
121
|
-
}, [
|
|
122
|
-
G.data?.data,
|
|
123
|
-
_.untitledFundingAccount,
|
|
124
|
-
w.canReadFundingAccounts
|
|
125
|
-
]), q = W && G.isError, je = W && !q && (G.isLoading || G.isFetchingNextPage || !!G.hasNextPage), J = o(() => T ? c === r.Credit ? ce(V.data?.data ?? []) : le(H.data?.data ?? []) : [], [
|
|
126
|
-
T,
|
|
127
|
-
c,
|
|
128
|
-
V.data?.data,
|
|
129
|
-
H.data?.data
|
|
130
|
-
]), Me = o(() => se(J, {
|
|
131
|
-
labels: _,
|
|
132
|
-
fundingAccountNames: K,
|
|
133
|
-
canActivate: w.canActivate,
|
|
134
|
-
onCardSelect: F,
|
|
135
|
-
onActivateCard: g
|
|
136
|
-
}), [
|
|
137
|
-
J,
|
|
138
|
-
K,
|
|
139
|
-
F,
|
|
140
|
-
_,
|
|
141
|
-
g,
|
|
142
|
-
w.canActivate
|
|
143
|
-
]), Y = U.data?.nextPaginationToken ?? void 0, X = U.data?.prevPaginationToken ?? void 0, Ne = !!U.data, Z = T && (U.isError || q), Q = i((e) => {
|
|
144
|
-
A || M({
|
|
145
|
-
resetKey: k,
|
|
146
|
-
paginationToken: e.paginationToken,
|
|
147
|
-
pageSize: e.pageSize
|
|
148
|
-
}), p?.(e);
|
|
149
|
-
}, [
|
|
150
|
-
A,
|
|
151
|
-
p,
|
|
152
|
-
k
|
|
153
|
-
]), $ = i(() => {
|
|
154
|
-
Q({
|
|
155
|
-
paginationToken: void 0,
|
|
156
|
-
pageSize: R
|
|
157
|
-
});
|
|
158
|
-
}, [Q, R]), Pe = i((e) => {
|
|
159
|
-
Q({
|
|
160
|
-
paginationToken: void 0,
|
|
161
|
-
pageSize: e
|
|
162
|
-
});
|
|
163
|
-
}, [Q]), Fe = i((e) => {
|
|
164
|
-
Ee(e), $();
|
|
165
|
-
}, [$]), Ie = i(() => {
|
|
166
|
-
Q({
|
|
167
|
-
paginationToken: X,
|
|
168
|
-
pageSize: R
|
|
169
|
-
});
|
|
170
|
-
}, [
|
|
171
|
-
Q,
|
|
172
|
-
R,
|
|
173
|
-
X
|
|
174
|
-
]), Le = i(() => {
|
|
175
|
-
Q({
|
|
176
|
-
paginationToken: Y,
|
|
177
|
-
pageSize: R
|
|
178
|
-
});
|
|
179
|
-
}, [
|
|
180
|
-
Q,
|
|
181
|
-
Y,
|
|
182
|
-
R
|
|
183
|
-
]), Re = U.refetch, ze = G.refetch, Be = i(() => {
|
|
184
|
-
Re(), W && ze();
|
|
185
|
-
}, [
|
|
186
|
-
W,
|
|
187
|
-
Re,
|
|
188
|
-
ze
|
|
189
|
-
]);
|
|
190
|
-
return {
|
|
191
|
-
rows: Me,
|
|
192
|
-
selectedCardId: Oe ? null : De,
|
|
193
|
-
onSelectCard: F,
|
|
194
|
-
canReadCards: w.canRead,
|
|
195
|
-
columns: oe[c],
|
|
196
|
-
isLoading: !S && (!C || xe && !b || T && (U.isLoading || je)),
|
|
197
|
-
isError: S || Z,
|
|
198
|
-
canToggleShowMyCards: w.canRead && !!x,
|
|
199
|
-
isShowingMyCards: I,
|
|
200
|
-
onShowMyCardsChange: Fe,
|
|
201
|
-
canCreateCard: w.canCreate && (!!h || !!ye && w.canComposeDebitCreate),
|
|
202
|
-
onCreateCardClick: h,
|
|
203
|
-
onRetry: Be,
|
|
204
|
-
isPaginationVisible: T && Ne && !Z,
|
|
205
|
-
pageSize: R,
|
|
206
|
-
pageSizeOptions: me,
|
|
207
|
-
isPreviousPageDisabled: !X,
|
|
208
|
-
isNextPageDisabled: !Y,
|
|
209
|
-
onPageSizeChange: Pe,
|
|
210
|
-
onPreviousPageClick: Ie,
|
|
211
|
-
onNextPageClick: Le
|
|
212
|
-
};
|
|
37
|
+
function l(e, { labels: i, fundingAccountNames: o, canActivate: s, onCardSelect: c, onActivateCard: l }) {
|
|
38
|
+
return e.map((e) => {
|
|
39
|
+
let u = s && e.status === a, d = e.fundingAccountId ? o?.get(e.fundingAccountId) : void 0;
|
|
40
|
+
return {
|
|
41
|
+
key: e.id,
|
|
42
|
+
nickname: r(e.nickname, i.untitledCard),
|
|
43
|
+
lastFour: e.lastFourDigits,
|
|
44
|
+
typeLabel: i.cardType[e.type] ?? i.emptyValue,
|
|
45
|
+
fundingAccount: d?.name ?? i.emptyValue,
|
|
46
|
+
fundingAccountLastFour: d?.lastFour,
|
|
47
|
+
cardholder: r(e.cardholderName, i.emptyValue),
|
|
48
|
+
statusLabel: i.cardStatus[e.status] ?? i.emptyValue,
|
|
49
|
+
statusTone: t[e.status] ?? "neutral",
|
|
50
|
+
limit: n({
|
|
51
|
+
limit: e.limit,
|
|
52
|
+
currencyCode: e.limitCurrencyCode
|
|
53
|
+
}),
|
|
54
|
+
onSelect: c ? () => c(e.id) : void 0,
|
|
55
|
+
onActivate: u && l ? () => l(e.id) : void 0
|
|
56
|
+
};
|
|
57
|
+
});
|
|
213
58
|
}
|
|
214
59
|
//#endregion
|
|
215
|
-
export {
|
|
60
|
+
export { o as CARD_COLUMNS_BY_PROGRAM, l as toCardRows, s as toCreditCardListItems, c as toDebitCardListItems };
|