Skip to content

Commit 74ba7d9

Browse files
committed
perf: upgrade @commercelayer/sdk and @types/react
1 parent 3d1286a commit 74ba7d9

39 files changed

Lines changed: 679 additions & 701 deletions

File tree

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ orbs:
66
jobs:
77
test: # this can be any name you choose
88
docker:
9-
- image: mcr.microsoft.com/playwright:v1.32.3-focal
9+
- image: mcr.microsoft.com/playwright:v1.34.3-focal
1010
resource_class: medium+
1111
parallelism: 10
1212

@typings/checkout.d.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
type NullableType<T> = T | null | undefined
2+
type ChildrenType = JSX.Element[] | JSX.Element | null
3+
14
interface HSLProps {
25
h: number
36
s: string
@@ -12,16 +15,16 @@ interface CheckoutSettings {
1215
endpoint: string
1316
domain: string
1417
slug: string
15-
logoUrl?: string
18+
logoUrl: NullableType<string>
1619
companyName: string
1720
language: string
1821
primaryColor: HSLProps
1922
favicon: string
20-
gtmId?: string
21-
supportEmail?: string
22-
supportPhone?: string
23-
termsUrl?: string
24-
privacyUrl?: string
23+
gtmId: NullableType<string>
24+
supportEmail: NullableType<string>
25+
supportPhone: NullableType<string>
26+
termsUrl: NullableType<string>
27+
privacyUrl: NullableType<string>
2528
}
2629

2730
interface InvalidCheckoutSettings {

components/composite/ErrorContainer/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Footer } from "components/ui/Footer"
44

55
import { Wrapper, LogoWrapper, FullLogo, Main, Error } from "./styled"
66

7-
export const ErrorContainer = ({ children }: { children: JSX.Element[] | JSX.Element | null }) => {
7+
export const ErrorContainer = ({ children }: { children: ChildrenType }) => {
88
return (
99
<Base>
1010
<Container>

components/composite/OrderSummary/ReturnToCart/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import Link from "next/link"
21
// eslint-disable-next-line import/order
32
import { useTranslation } from "next-i18next"
43

54
import { CartLinkWrapper, LinkWrapper } from "./styled"
65

76
interface Props {
8-
cartUrl?: string
7+
cartUrl: NullableType<string>
98
}
109

1110
export const ReturnToCart = ({ cartUrl }: Props) => {

components/composite/StepComplete/index.tsx

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const StepComplete: React.FC<Props> = ({
8383
>
8484
<Trans
8585
i18nKey={"stepComplete.description"}
86-
values={{ orderNumber: orderNumber }}
86+
values={{ orderNumber }}
8787
components={{
8888
WrapperOrderId: <strong className="text-black" />,
8989
}}
@@ -130,40 +130,44 @@ export const StepComplete: React.FC<Props> = ({
130130
</RecapItemTitle>
131131
<RecapBox>
132132
<CustomAddress
133-
firstName={ctx.billingAddress?.first_name}
134-
lastName={ctx.billingAddress?.last_name}
135-
city={ctx.billingAddress?.city}
136-
line1={ctx.billingAddress?.line_1}
137-
line2={ctx.billingAddress?.line_2}
138-
zipCode={ctx.billingAddress?.zip_code}
139-
stateCode={ctx.billingAddress?.state_code}
140-
countryCode={ctx.billingAddress?.country_code}
141-
phone={ctx.billingAddress?.phone}
133+
firstName={ctx.billingAddress?.first_name ?? ""}
134+
lastName={ctx.billingAddress?.last_name ?? ""}
135+
city={ctx.billingAddress?.city ?? ""}
136+
line1={ctx.billingAddress?.line_1 ?? ""}
137+
line2={ctx.billingAddress?.line_2 ?? ""}
138+
zipCode={ctx.billingAddress?.zip_code ?? ""}
139+
stateCode={ctx.billingAddress?.state_code ?? ""}
140+
countryCode={ctx.billingAddress?.country_code ?? ""}
141+
phone={ctx.billingAddress?.phone ?? ""}
142142
addressType="billing"
143143
/>
144144
</RecapBox>
145145
</div>
146-
<>{ctx.isShipmentRequired && (
147-
<div data-testid="shipping-address-recap">
148-
<RecapItemTitle>
149-
{t("stepComplete.ship_to")}
150-
</RecapItemTitle>
151-
<RecapBox>
152-
<CustomAddress
153-
firstName={ctx.shippingAddress?.first_name}
154-
lastName={ctx.shippingAddress?.last_name}
155-
city={ctx.shippingAddress?.city}
156-
line1={ctx.shippingAddress?.line_1}
157-
line2={ctx.shippingAddress?.line_2}
158-
zipCode={ctx.shippingAddress?.zip_code}
159-
stateCode={ctx.shippingAddress?.state_code}
160-
countryCode={ctx.shippingAddress?.country_code}
161-
phone={ctx.shippingAddress?.phone}
162-
addressType="shipping"
163-
/>
164-
</RecapBox>
165-
</div>
166-
)}</>
146+
<>
147+
{ctx.isShipmentRequired && (
148+
<div data-testid="shipping-address-recap">
149+
<RecapItemTitle>
150+
{t("stepComplete.ship_to")}
151+
</RecapItemTitle>
152+
<RecapBox>
153+
<CustomAddress
154+
firstName={ctx.shippingAddress?.first_name ?? ""}
155+
lastName={ctx.shippingAddress?.last_name ?? ""}
156+
city={ctx.shippingAddress?.city ?? ""}
157+
line1={ctx.shippingAddress?.line_1 ?? ""}
158+
line2={ctx.shippingAddress?.line_2 ?? ""}
159+
zipCode={ctx.shippingAddress?.zip_code ?? ""}
160+
stateCode={ctx.shippingAddress?.state_code ?? ""}
161+
countryCode={
162+
ctx.shippingAddress?.country_code ?? ""
163+
}
164+
phone={ctx.shippingAddress?.phone ?? ""}
165+
addressType="shipping"
166+
/>
167+
</RecapBox>
168+
</div>
169+
)}
170+
</>
167171
</AddressContainer>
168172
</RecapCol>
169173

components/composite/StepCustomer/AddressInputGroup/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const AddressInputGroup: React.FC<Props> = ({
7373

7474
const appCtx = useContext(AppContext)
7575

76-
let shippingCountryCodeLock: string | undefined = ""
76+
let shippingCountryCodeLock: NullableType<string> = ""
7777

7878
if (appCtx) {
7979
shippingCountryCodeLock = appCtx.shippingCountryCodeLock

components/composite/StepCustomer/AddressSectionEmail/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Label } from "components/ui/form/Label"
1111
interface Props {
1212
readonly?: boolean
1313
setCustomerEmail?: (email: string) => void
14-
emailAddress?: string
14+
emailAddress: NullableType<string>
1515
}
1616

1717
export const AddressSectionEmail: React.FC<Props> = ({
@@ -59,7 +59,7 @@ export const AddressSectionEmail: React.FC<Props> = ({
5959
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
6060
// @ts-ignore
6161
onBlur={saveEmail}
62-
value={emailAddress}
62+
value={emailAddress ?? ""}
6363
/>
6464
<StyledErrors
6565
data-testid="customer_email_error"

components/composite/StepCustomer/AddressSectionTitle/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ interface Props {
55
children?: JSX.Element[] | JSX.Element
66
}
77

8-
export const AddressSectionTitle = ({ children, ...rest }: Props): JSX.Element => {
8+
export const AddressSectionTitle = ({
9+
children,
10+
...rest
11+
}: Props): JSX.Element => {
912
return <Wrapper {...rest}>{children}</Wrapper>
1013
}
1114

components/composite/StepCustomer/BillingAddressFormNew/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { AddressInputGroup } from "components/composite/StepCustomer/AddressInpu
88
import { AppContext } from "components/data/AppProvider"
99

1010
interface Props {
11-
billingAddress?: Address
11+
billingAddress: NullableType<Address>
1212
openShippingAddress: (props: ShippingToggleProps) => void
1313
}
1414

components/composite/StepCustomer/CheckoutAddresses.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import { BillingAddressFormNew } from "./BillingAddressFormNew"
1919
import { ShippingAddressFormNew } from "./ShippingAddressFormNew"
2020

2121
interface Props {
22-
billingAddress?: Address
23-
shippingAddress?: Address
24-
emailAddress?: string
22+
billingAddress: NullableType<Address>
23+
shippingAddress: NullableType<Address>
24+
emailAddress: NullableType<string>
2525
hasSameAddresses: boolean
2626
isShipmentRequired: boolean
2727
isLocalLoader: boolean
@@ -49,9 +49,8 @@ export const CheckoutAddresses: React.FC<Props> = ({
4949
}: Props) => {
5050
const { t } = useTranslation()
5151

52-
const [shippingAddressFill, setShippingAddressFill] = useState<
53-
Address | undefined
54-
>(shippingAddress)
52+
const [shippingAddressFill, setShippingAddressFill] =
53+
useState<NullableType<Address>>(shippingAddress)
5554

5655
const handleToggleDifferentAddress = () => {
5756
return [

0 commit comments

Comments
 (0)