Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies #698

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions clients/banking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"@formatjs/intl": "2.10.1",
"@juggle/resize-observer": "3.4.0",
"@sentry/react": "7.109.0",
"@swan-io/boxed": "2.1.1",
"@swan-io/boxed": "2.2.1",
"@swan-io/chicane": "2.0.0",
"@swan-io/graphql-client": "0.1.0",
"@swan-io/lake": "8.0.0",
"@swan-io/request": "1.0.4",
"@swan-io/shared-business": "8.0.0",
"@swan-io/use-form": "2.0.1",
"@swan-io/graphql-client": "0.1.1",
"@swan-io/lake": "8.1.0",
"@swan-io/request": "1.0.5",
"@swan-io/shared-business": "8.1.0",
"@swan-io/use-form": "2.0.3",
"core-js": "3.36.1",
"dayjs": "1.11.10",
"iban": "0.0.14",
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const AppContainer = () => {

const loginInfo = authStatus
.mapOk(data => data.user?.id != null)
.map(result => ({ isLoggedIn: result.getWithDefault(false) }));
.map(result => ({ isLoggedIn: result.getOr(false) }));

return match(loginInfo)
.with(AsyncData.P.NotAsked, AsyncData.P.Loading, () => null)
Expand Down
6 changes: 3 additions & 3 deletions clients/banking/src/components/AccountArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export const AccountArea = ({

const hasMultipleMemberships = Option.fromNullable(accountMembership.user)
.map(({ accountMemberships: { totalCount } }) => totalCount > 1)
.getWithDefault(false);
.getOr(false);

const account = accountMembership.account;
const accountCountry = account?.country ?? undefined;
Expand All @@ -219,7 +219,7 @@ export const AccountArea = ({
const [, setAccountMembershipState] = usePersistedState<unknown>(
`swan_session_webBankingAccountMembershipState${projectConfiguration
.map(({ projectId }) => `_${projectId}`)
.getWithDefault("")}`,
.getOr("")}`,
{},
);

Expand Down Expand Up @@ -288,7 +288,7 @@ export const AccountArea = ({
({ accountMembershipsWithBindingUserError }) =>
accountMembershipsWithBindingUserError.totalCount > 0,
)
.getWithDefault(false),
.getOr(false),
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ export const AccountStatementCustom = ({ accountId, large }: Props) => {
),
)
.map(url => <Link to={url} target="_blank" />)
.getWithDefault(<View />);
.getOr(<View />);
}}
loading={{
isLoading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export const AccountStatementMonthly = ({ accountId, large }: Props) => {
Array.findMap(item.type, item => Option.fromNullable(item?.url)),
)
.map(url => <Link to={url} target="_blank" />)
.getWithDefault(<View />);
.getOr(<View />);
}}
loading={{
isLoading,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const CardItemIdentityVerificationGate = ({
const isProcessing = lastRelevantIdentification
.map(getIdentificationLevelStatusInfo)
.map(({ status }) => status === "Pending")
.getWithDefault(false);
.getOr(false);

return (
<View style={styles.container}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const CardItemTransactionList = ({
.flatMap(result => result.toOption())
.flatMap(data => Option.fromNullable(data.card?.transactions))
.map(({ edges }) => edges.map(({ node }) => node))
.getWithDefault([]);
.getOr([]);

const panelRef = useRef<FocusTrapRef | null>(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const MembershipInvitationLinkModal = ({ accountMembershipId, onPressClos
fullName: getMemberName({ accountMembership }),
}),
)
.getWithDefault(t("members.invitationTitle"))}
.getOr(t("members.invitationTitle"))}
>
<LakeLabel
label={t("members.invitationLink")}
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/MembershipsArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const MembershipsArea = ({
.flatMap(data => data.toOption())
.flatMap(({ account }) => Option.fromNullable(account?.memberships))
.map(({ edges }) => edges.map(({ node }) => node))
.getWithDefault([]);
.getOr([]);

const panelRef = useRef<FocusTrapRef | null>(null);

Expand Down
38 changes: 4 additions & 34 deletions clients/banking/src/components/NewMembershipWizard.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Array, Option } from "@swan-io/boxed";
import { Array, Dict, Option } from "@swan-io/boxed";
import { useMutation } from "@swan-io/graphql-client";
import { Box } from "@swan-io/lake/src/components/Box";
import { LakeButton, LakeButtonGroup } from "@swan-io/lake/src/components/LakeButton";
Expand All @@ -18,7 +18,7 @@ import { TaxIdentificationNumberInput } from "@swan-io/shared-business/src/compo
import { CountryCCA3, allCountries } from "@swan-io/shared-business/src/constants/countries";
import { translateError } from "@swan-io/shared-business/src/utils/i18n";
import { validateIndividualTaxNumber } from "@swan-io/shared-business/src/utils/validation";
import { OptionRecord, combineValidators, useForm } from "@swan-io/use-form";
import { combineValidators, useForm } from "@swan-io/use-form";
import dayjs from "dayjs";
import { parsePhoneNumber } from "libphonenumber-js";
import { useState } from "react";
Expand Down Expand Up @@ -339,42 +339,12 @@ export const NewMembershipWizard = ({
}
};

const filterDefinedValues = (
values: OptionRecord<FormState>,
): {
[K in keyof FormState]?: FormState[K];
} => ({
...(values.addressLine1.isSome() ? { addressLine1: values.addressLine1.get() } : null),
...(values.birthDate.isSome() ? { birthDate: values.birthDate.get() } : null),
...(values.canInitiatePayments.isSome()
? { canInitiatePayments: values.canInitiatePayments.get() }
: null),
...(values.canManageAccountMembership.isSome()
? { canManageAccountMembership: values.canManageAccountMembership.get() }
: null),
...(values.canManageBeneficiaries.isSome()
? { canManageBeneficiaries: values.canManageBeneficiaries.get() }
: null),
...(values.canManageCards.isSome() ? { canManageCards: values.canManageCards.get() } : null),
...(values.canViewAccount.isSome() ? { canViewAccount: values.canViewAccount.get() } : null),
...(values.city.isSome() ? { city: values.city.get() } : null),
...(values.country.isSome() ? { country: values.country.get() } : null),
...(values.email.isSome() ? { email: values.email.get() } : null),
...(values.firstName.isSome() ? { firstName: values.firstName.get() } : null),
...(values.lastName.isSome() ? { lastName: values.lastName.get() } : null),
...(values.phoneNumber.isSome() ? { phoneNumber: values.phoneNumber.get() } : null),
...(values.postalCode.isSome() ? { postalCode: values.postalCode.get() } : null),
...(values.taxIdentificationNumber.isSome()
? { taxIdentificationNumber: values.taxIdentificationNumber.get() }
: null),
});

const onPressNext = () => {
submitForm({
onSuccess: values => {
setPartiallySavedValues(previousValues => ({
...previousValues,
...filterDefinedValues(values),
...Dict.fromOptional(values),
}));

const currentStepIndex = steps.indexOf(step);
Expand Down Expand Up @@ -427,7 +397,7 @@ export const NewMembershipWizard = ({
onSuccess: values => {
const computedValues = {
...partiallySavedValues,
...filterDefinedValues(values),
...Dict.fromOptional(values),
};

if (hasDefinedKeys(computedValues, MANDATORY_FIELDS)) {
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/components/TransactionsArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export const TransactionsArea = ({
({ fundingSources, merchantProfiles }) =>
fundingSources.totalCount > 0 || merchantProfiles.totalCount > 0,
)
.getWithDefault(false);
.getOr(false);

const availableBalance = account?.balances?.available;
const bookedBalance = account?.balances?.booked;
Expand Down
4 changes: 2 additions & 2 deletions clients/banking/src/components/TransferTypePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const TransferTypePicker = ({ accountMembershipId }: Props) => {
title: t("transfer.tile.recurringTransfer.title"),
subtitle: t("transfer.tile.recurringTransfer.subtitle"),
},
...(ictEnabled.getWithDefault(false)
...(ictEnabled.getOr(false)
? [
{
url: Router.AccountPaymentsNew({ accountMembershipId, type: "international" }),
Expand All @@ -82,7 +82,7 @@ export const TransferTypePicker = ({ accountMembershipId }: Props) => {
},
]
: []),
...(bulkEnabled.getWithDefault(false)
...(bulkEnabled.getOr(false)
? [
{
url: Router.AccountPaymentsNew({ accountMembershipId, type: "bulk" }),
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/pages/AccountActivationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ export const AccountActivationPage = ({
<Space height={32} />

<LakeButton mode="primary" color="partner" onPress={handleProveIdentity}>
{lastRelevantIdentification.map(isReadyToSign).getWithDefault(false)
{lastRelevantIdentification.map(isReadyToSign).getOr(false)
? t("accountActivation.identity.button.signVerification")
: t("accountActivation.identity.button.verifyMyIdentity")}
</LakeButton>
Expand Down
8 changes: 3 additions & 5 deletions clients/banking/src/pages/ProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const ProfilePage = ({
Option.P.None,
Option.P.Some({ status: P.union("NotStarted", "Started", "Canceled", "Expired") }),
() =>
lastRelevantIdentification.map(isReadyToSign).getWithDefault(false) ? (
lastRelevantIdentification.map(isReadyToSign).getOr(false) ? (
<LakeAlert
anchored={true}
variant="warning"
Expand Down Expand Up @@ -239,7 +239,7 @@ export const ProfilePage = ({
mode="primary"
onPress={handleProveIdentity}
>
{lastRelevantIdentification.map(isReadyToSign).getWithDefault(false)
{lastRelevantIdentification.map(isReadyToSign).getOr(false)
? t("profile.finalizeVerification")
: t("profile.verifyIdentity")}
</LakeButton>
Expand Down Expand Up @@ -343,9 +343,7 @@ export const ProfilePage = ({
mode="primary"
onPress={handleProveIdentity}
>
{lastRelevantIdentification
.map(isReadyToSign)
.getWithDefault(false)
{lastRelevantIdentification.map(isReadyToSign).getOr(false)
? t("profile.finalizeVerification")
: t("profile.verifyIdentity")}
</LakeButton>
Expand Down
2 changes: 1 addition & 1 deletion clients/banking/src/utils/tggl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ updateTgglContext({
environmentType: lowerCase(env.APP_TYPE),
projectId: projectConfiguration
.map<string | undefined>(config => config.projectId)
.getWithDefault(undefined),
.getOr(undefined),
});
12 changes: 6 additions & 6 deletions clients/onboarding/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"@formatjs/intl": "2.10.1",
"@juggle/resize-observer": "3.4.0",
"@sentry/react": "7.109.0",
"@swan-io/boxed": "2.1.1",
"@swan-io/boxed": "2.2.1",
"@swan-io/chicane": "2.0.0",
"@swan-io/graphql-client": "0.1.0",
"@swan-io/lake": "8.0.0",
"@swan-io/request": "1.0.4",
"@swan-io/shared-business": "8.0.0",
"@swan-io/use-form": "2.0.1",
"@swan-io/graphql-client": "0.1.1",
"@swan-io/lake": "8.1.0",
"@swan-io/request": "1.0.5",
"@swan-io/shared-business": "8.1.0",
"@swan-io/use-form": "2.0.3",
"core-js": "3.36.1",
"dayjs": "1.11.10",
"nanoid": "5.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const getNextStep = (
return Array.findIndex(steps, step => step.id === currentStep)
.flatMap(index => Option.fromNullable(steps[index + 1]))
.map(step => step.id)
.getWithDefault(currentStep);
.getOr(currentStep);
};

const getPreviousStep = (
Expand All @@ -81,7 +81,7 @@ const getPreviousStep = (
return Array.findIndex(steps, step => step.id === currentStep)
.flatMap(index => Option.fromNullable(steps[index - 1]))
.map(step => step.id)
.getWithDefault(currentStep);
.getOr(currentStep);
};

export const OnboardingCompanyWizard = ({ onboarding, onboardingId, holder }: Props) => {
Expand Down
2 changes: 1 addition & 1 deletion clients/onboarding/src/utils/tggl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ updateTgglContext({
environmentType: lowerCase(env.SWAN_ENVIRONMENT),
projectId: projectConfiguration
.map<string | undefined>(config => config.projectId)
.getWithDefault(undefined),
.getOr(undefined),
});
10 changes: 5 additions & 5 deletions clients/payment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"@formatjs/intl": "2.10.1",
"@juggle/resize-observer": "3.4.0",
"@sentry/react": "7.109.0",
"@swan-io/boxed": "2.1.1",
"@swan-io/boxed": "2.2.1",
"@swan-io/chicane": "2.0.0",
"@swan-io/graphql-client": "0.1.0",
"@swan-io/lake": "8.0.0",
"@swan-io/shared-business": "8.0.0",
"@swan-io/use-form": "2.0.1",
"@swan-io/graphql-client": "0.1.1",
"@swan-io/lake": "8.1.0",
"@swan-io/shared-business": "8.1.0",
"@swan-io/use-form": "2.0.3",
"core-js": "3.36.1",
"dayjs": "1.11.10",
"iban": "0.0.14",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@localazy/cli": "1.7.8",
"@playwright/test": "1.41.2",
"@sentry/cli": "2.31.0",
"@swan-io/boxed": "2.1.1",
"@swan-io/boxed": "2.2.1",
"@types/glob": "8.1.0",
"@types/prompts": "2.4.9",
"@types/sodium-native": "2.3.9",
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@opentelemetry/sdk-trace-base": "1.23.0",
"@opentelemetry/sdk-trace-node": "1.23.0",
"@opentelemetry/semantic-conventions": "1.23.0",
"@swan-io/boxed": "2.1.1",
"@swan-io/boxed": "2.2.1",
"fast-proxy": "2.2.0",
"fastify": "4.26.2",
"get-port": "5.1.1",
Expand Down
2 changes: 1 addition & 1 deletion server/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ export const start = async ({

const state = Result.fromExecution<unknown>(() =>
JSON.parse(request.query.state ?? "{}"),
).getWithDefault({});
).getOr({});

const stateId = request.session.get("state") ?? "UNKNOWN";

Expand Down
Loading
Loading