@sonic-equipment/ui 1.1.5 → 1.1.6
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.
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { BillToModel, PatchCartModel, PostShipToModel, ShipToModel } from '../../../../shared/api/storefront/model/storefront.model';
|
|
2
2
|
import { Country } from '../../../../shared/model/countries-languages';
|
|
3
|
-
export declare function ReadOnlyAddresses({ billTo, cartId, countries, currentCountry,
|
|
3
|
+
export declare function ReadOnlyAddresses({ billTo, cartId, countries, currentCountry, isLoading, isPickup, notes, onSubmit, shipTo, }: {
|
|
4
4
|
billTo: BillToModel | undefined | null;
|
|
5
5
|
cartId: string;
|
|
6
6
|
countries: Country[];
|
|
7
7
|
currentCountry?: Country | undefined;
|
|
8
|
-
hasVatNumber: boolean;
|
|
9
8
|
isLoading: boolean;
|
|
10
9
|
isPickup: boolean;
|
|
11
10
|
notes: string | undefined;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { Form } from 'react-aria-components';
|
|
4
4
|
import { AddressInfoDisplay } from '../../../../address-info-display/address-info-display.js';
|
|
5
5
|
import { TextField } from '../../../../forms/fields/text-field/text-field.js';
|
|
6
6
|
import { AddressForm } from '../../../../forms/partials/address-form/address-form.js';
|
|
7
7
|
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
8
8
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
9
|
-
import { Message } from '../../../../message/message.js';
|
|
10
9
|
import { CheckoutPageSection } from '../../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
11
10
|
import { CheckoutPageSectionContent } from '../../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
12
11
|
import { AddressBookSelector } from './address-book-selector.js';
|
|
@@ -15,7 +14,7 @@ import ShipToModeSelector from './ship-to-mode-selector.js';
|
|
|
15
14
|
import { SonicAddress } from './sonic-address.js';
|
|
16
15
|
import styles from './readonly-address.module.css.js';
|
|
17
16
|
|
|
18
|
-
function ReadOnlyAddresses({ billTo, cartId, countries, currentCountry,
|
|
17
|
+
function ReadOnlyAddresses({ billTo, cartId, countries, currentCountry, isLoading, isPickup, notes, onSubmit, shipTo, }) {
|
|
19
18
|
const t = useFormattedMessage();
|
|
20
19
|
const billToId = billTo?.id;
|
|
21
20
|
const shipToId = shipTo?.id;
|
|
@@ -122,7 +121,7 @@ function ReadOnlyAddresses({ billTo, cartId, countries, currentCountry, hasVatNu
|
|
|
122
121
|
lastName: billTo.lastName,
|
|
123
122
|
phone: billTo.phone,
|
|
124
123
|
postalCode: billTo.postalCode,
|
|
125
|
-
}, "data-test-selector": "billToAddress" })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] }) }), jsx(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: jsx(CheckoutPageSectionContent, { stretch: true, children: isPickup ? (jsx(SonicAddress, {})) :
|
|
124
|
+
}, "data-test-selector": "billToAddress" })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] }) }), jsx(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: jsx(CheckoutPageSectionContent, { stretch: true, children: isPickup ? (jsx(SonicAddress, {})) : (jsx(ShipToModeSelector, { addressBookSelector: billTo?.id && (jsx("div", { className: styles['address-book-selector'], children: jsx(AddressBookSelector, { billToId: billTo.id, currentShipToId: shipTo?.id }) })), defaultShippingOption: isShipToABillToAddress
|
|
126
125
|
? 'useBillTo'
|
|
127
126
|
: shipTo
|
|
128
127
|
? 'selectFromAddressBook'
|
|
@@ -159,7 +159,7 @@ function ShippingPage() {
|
|
|
159
159
|
},
|
|
160
160
|
});
|
|
161
161
|
await refetchCart();
|
|
162
|
-
}, readOnlyAddress: jsx(ReadOnlyAddresses, { billTo: cart.billTo, cartId: cart.id, countries: countries || [], currentCountry: currentCountry,
|
|
162
|
+
}, readOnlyAddress: jsx(ReadOnlyAddresses, { billTo: cart.billTo, cartId: cart.id, countries: countries || [], currentCountry: currentCountry, isLoading: isPatching, isPickup: isPickup, notes: cart.notes, onSubmit: async ({ cart: updatedCart, notes, shipTo }) => {
|
|
163
163
|
if (!cart.billTo)
|
|
164
164
|
return;
|
|
165
165
|
if (notes ||
|