@sonic-equipment/ui 199.0.0 → 201.0.0

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.
Files changed (63) hide show
  1. package/dist/algolia/algolia-multi-select-filter-section.js +1 -1
  2. package/dist/country-select/hooks/use-countries.d.ts +2 -2
  3. package/dist/country-select/hooks/use-countries.js +1 -1
  4. package/dist/exports.d.ts +8 -2
  5. package/dist/forms/elements/checkbox/checkbox.d.ts +1 -0
  6. package/dist/forms/elements/checkbox/checkbox.js +1 -1
  7. package/dist/forms/elements/checkbox/checkbox.module.css.js +1 -1
  8. package/dist/forms/partials/address-form/address-form.d.ts +11 -0
  9. package/dist/forms/partials/address-form/address-form.js +36 -0
  10. package/dist/forms/partials/address-form/address-form.module.css.js +3 -0
  11. package/dist/header/buttons/account/connected-account-button.js +9 -2
  12. package/dist/index.js +9 -3
  13. package/dist/intl/translation-id.d.ts +1 -1
  14. package/dist/pages/account/components/sign-in-form/sign-in-form.d.ts +2 -1
  15. package/dist/pages/account/components/sign-in-form/sign-in-form.js +8 -6
  16. package/dist/pages/account/sign-in-page/sign-in-page.js +2 -2
  17. package/dist/pages/checkout/shipping-page/components/edit-checkout-bill-to-address-form.js +2 -2
  18. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.js +1 -1
  19. package/dist/pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form.d.ts +4 -0
  20. package/dist/pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form.js +90 -0
  21. package/dist/pages/my-sonic/actions/create-ship-to-address/create-ship-to-address.module.css.js +3 -0
  22. package/dist/pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.d.ts +4 -0
  23. package/dist/pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.js +95 -0
  24. package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.module.css.js +3 -0
  25. package/dist/pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.d.ts +5 -0
  26. package/dist/pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.js +127 -0
  27. package/dist/pages/my-sonic/actions/edit-ship-to-address/edit-ship-to-address.module.css.js +3 -0
  28. package/dist/pages/my-sonic/widgets/components/address-data-card.d.ts +2 -2
  29. package/dist/pages/my-sonic/widgets/components/address-data-card.js +2 -6
  30. package/dist/pages/my-sonic/widgets/connected-bill-to-address-widget.d.ts +3 -1
  31. package/dist/pages/my-sonic/widgets/connected-bill-to-address-widget.js +13 -4
  32. package/dist/pages/my-sonic/widgets/connected-ship-to-address-widget.d.ts +4 -1
  33. package/dist/pages/my-sonic/widgets/connected-ship-to-address-widget.js +18 -4
  34. package/dist/shared/api/storefront/hooks/customer/use-fetch-bill-to-address.d.ts +4 -0
  35. package/dist/shared/api/storefront/hooks/customer/use-fetch-bill-to-address.js +11 -0
  36. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.d.ts +3 -1
  37. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.js +3 -7
  38. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-ship-to-address.d.ts +3 -1
  39. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-ship-to-address.js +6 -12
  40. package/dist/shared/api/storefront/hooks/customer/use-fetch-ship-to-address.d.ts +5 -0
  41. package/dist/shared/api/storefront/hooks/customer/use-fetch-ship-to-address.js +18 -0
  42. package/dist/shared/api/storefront/hooks/customer/use-patch-ship-to-address.d.ts +13 -0
  43. package/dist/shared/api/storefront/hooks/customer/use-patch-ship-to-address.js +17 -0
  44. package/dist/shared/api/storefront/hooks/customer/use-post-ship-to-address.d.ts +17 -0
  45. package/dist/shared/api/storefront/hooks/customer/use-post-ship-to-address.js +17 -0
  46. package/dist/shared/api/storefront/hooks/payment/use-invalidate-adyen.d.ts +1 -1
  47. package/dist/shared/api/storefront/hooks/payment/use-invalidate-adyen.js +1 -1
  48. package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.js +3 -1
  49. package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-current-wishlist.js +2 -2
  50. package/dist/shared/api/storefront/hooks/wishlist/use-delete-wishlist-item-from-wishlist.js +2 -2
  51. package/dist/shared/api/storefront/model/storefront.model.d.ts +12 -0
  52. package/dist/shared/api/storefront/services/account-service.js +5 -0
  53. package/dist/shared/api/storefront/services/customer-service.d.ts +24 -3
  54. package/dist/shared/api/storefront/services/customer-service.js +39 -5
  55. package/dist/shared/hooks/use-cookiebot.js +9 -5
  56. package/dist/shared/routing/types.d.ts +2 -0
  57. package/dist/styles.css +93 -7
  58. package/package.json +1 -1
  59. package/dist/forms/partials/edit-address-form/edit-address-form.d.ts +0 -9
  60. package/dist/forms/partials/edit-address-form/edit-address-form.js +0 -36
  61. package/dist/forms/partials/edit-address-form/edit-address-form.module.css.js +0 -3
  62. package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.d.ts +0 -1
  63. package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.js +0 -8
@@ -21,7 +21,7 @@ function AlgoliaMultiSelectFilterSection({ attribute, }) {
21
21
  isSelected: item.isRefined,
22
22
  label: item.label,
23
23
  value: item.value,
24
- })), render: ({ onChange, option }) => (jsx(Checkbox, { isSelected: option.isSelected, onChange: () => onChange(option.value), value: option.value, children: option.label })) }) }));
24
+ })), render: ({ onChange, option }) => (jsx(Checkbox, { isSelected: option.isSelected, onChange: () => onChange(option.value), textSize: "small", value: option.value, children: option.label })) }) }));
25
25
  }
26
26
 
27
27
  export { AlgoliaMultiSelectFilterSection };
@@ -5,8 +5,8 @@ interface UseCountriesArgs {
5
5
  interface UseCountriesReturnType {
6
6
  countries: Country[] | undefined;
7
7
  currentCountry: Country | undefined;
8
- error: unknown;
8
+ error: Error | null;
9
9
  isFetching: boolean;
10
10
  }
11
- export declare function useCountries({ enabled, }: UseCountriesArgs): UseCountriesReturnType;
11
+ export declare function useCountries({ enabled, }?: UseCountriesArgs): UseCountriesReturnType;
12
12
  export {};
@@ -4,7 +4,7 @@ import { useFetchCountriesWithLanguages } from '../../shared/api/storefront/hook
4
4
  import { useCookie } from '../../shared/hooks/use-cookie.js';
5
5
  import { useSessionStorage } from '../../shared/hooks/use-session-storage.js';
6
6
 
7
- function useCountries({ enabled = true, }) {
7
+ function useCountries({ enabled = true, } = {}) {
8
8
  const [sessionCountries, setSessionCountries] = useSessionStorage('countries-v1');
9
9
  const [currentCountryId] = useCookie('CurrentCountryId');
10
10
  const { data: apiCountries, error, isFetching, } = useFetchCountriesWithLanguages({
package/dist/exports.d.ts CHANGED
@@ -109,7 +109,7 @@ export * from './forms/layout/form/form';
109
109
  export * from './forms/layout/form/form-field-layout';
110
110
  export * from './forms/layout/form/form-segment';
111
111
  export * from './forms/layout/form/form-segment-group';
112
- export * from './forms/partials/edit-address-form/edit-address-form';
112
+ export * from './forms/partials/address-form/address-form';
113
113
  export * from './forms/partials/password-validation/password-validation';
114
114
  export * from './global-search/categories-grid/categories-grid';
115
115
  export * from './global-search/global-search';
@@ -247,7 +247,9 @@ export * from './pages/my-sonic/actions/change-customer/connected-change-custome
247
247
  export * from './pages/my-sonic/actions/change-password/change-password';
248
248
  export * from './pages/my-sonic/actions/change-password/change-password-dialog';
249
249
  export * from './pages/my-sonic/actions/change-password/connected-change-password-dialog';
250
- export * from './pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address';
250
+ export * from './pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form';
251
+ export * from './pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form';
252
+ export * from './pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form';
251
253
  export * from './pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog';
252
254
  export * from './pages/my-sonic/actions/edit-user-info/edit-user-info';
253
255
  export * from './pages/my-sonic/actions/edit-user-info/edit-user-info-dialog';
@@ -323,13 +325,17 @@ export * from './shared/api/storefront/hooks/cart/use-patch-cart';
323
325
  export * from './shared/api/storefront/hooks/cart/use-patch-cart-line-by-id';
324
326
  export * from './shared/api/storefront/hooks/cart/use-place-order';
325
327
  export * from './shared/api/storefront/hooks/cart/use-save-cart-for-later';
328
+ export * from './shared/api/storefront/hooks/customer/use-fetch-bill-to-address';
326
329
  export * from './shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses';
327
330
  export * from './shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address';
328
331
  export * from './shared/api/storefront/hooks/customer/use-fetch-current-ship-to-address';
329
332
  export * from './shared/api/storefront/hooks/customer/use-fetch-fulfillment-methods-by-customer-id';
330
333
  export * from './shared/api/storefront/hooks/customer/use-fetch-fulfillment-methods-for-current-cart';
334
+ export * from './shared/api/storefront/hooks/customer/use-fetch-ship-to-address';
331
335
  export * from './shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses';
332
336
  export * from './shared/api/storefront/hooks/customer/use-patch-bill-to-address';
337
+ export * from './shared/api/storefront/hooks/customer/use-patch-ship-to-address';
338
+ export * from './shared/api/storefront/hooks/customer/use-post-ship-to-address';
333
339
  export * from './shared/api/storefront/hooks/orders/use-fetch-orders';
334
340
  export * from './shared/api/storefront/hooks/payment/use-create-adyen-session';
335
341
  export * from './shared/api/storefront/hooks/payment/use-fetch-adyen-config';
@@ -10,6 +10,7 @@ export interface CheckboxPropsBase {
10
10
  isSelected?: boolean;
11
11
  name?: string;
12
12
  onChange?: (isSelected: boolean) => void;
13
+ textSize?: 'normal' | 'small' | 'inherit';
13
14
  value?: string;
14
15
  }
15
16
  export interface CheckboxWithLabelProps extends CheckboxPropsBase {
@@ -9,7 +9,7 @@ function Checkbox(props) {
9
9
  const { autoFocus, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isReadOnly, isRequired, isSelected, name, onChange, value, } = props;
10
10
  const ariaLabel = 'aria-label' in props ? props['aria-label'] : undefined;
11
11
  const children = 'children' in props ? props.children : undefined;
12
- return (jsxs(Checkbox$1, { "aria-label": ariaLabel, autoFocus: autoFocus, className: clsx(styles.checkbox, className), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isSelected: isSelected, name: name, onChange: onChange, value: value, children: [jsx("div", { className: styles.box, children: jsx("svg", { "aria-hidden": "true", className: styles.checkmark, viewBox: "0 0 10 7", children: jsx("path", { d: "m1 2.845 3 3L8.845 1" }) }) }), children && (jsx(Label, { className: styles.label, isRequired: isRequired, children: children }))] }));
12
+ return (jsxs(Checkbox$1, { "aria-label": ariaLabel, autoFocus: autoFocus, className: clsx(styles.checkbox, className, styles[`text-size-${props['textSize'] || 'inherit'}`]), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isSelected: isSelected, name: name, onChange: onChange, value: value, children: [jsx("div", { className: styles.box, children: jsx("svg", { "aria-hidden": "true", className: styles.checkmark, viewBox: "0 0 10 7", children: jsx("path", { d: "m1 2.845 3 3L8.845 1" }) }) }), children && (jsx(Label, { className: styles.label, isRequired: isRequired, children: children }))] }));
13
13
  }
14
14
 
15
15
  export { Checkbox };
@@ -1,3 +1,3 @@
1
- var styles = {"checkbox":"checkbox-module-QzsaZ","box":"checkbox-module-spG9E","checkmark":"checkbox-module-CQcmb","color-checkbox":"checkbox-module-CRPMG","label":"checkbox-module-bO3ou"};
1
+ var styles = {"checkbox":"checkbox-module-QzsaZ","text-size-small":"checkbox-module--o4dt","text-size-normal":"checkbox-module-5vjph","box":"checkbox-module-spG9E","checkmark":"checkbox-module-CQcmb","color-checkbox":"checkbox-module-CRPMG","label":"checkbox-module-bO3ou"};
2
2
 
3
3
  export { styles as default };
@@ -0,0 +1,11 @@
1
+ import { Address } from '../../../shared/model/address';
2
+ import { Country } from '../../../shared/model/countries-languages';
3
+ export interface AddressFormProps {
4
+ address: Address | null | undefined;
5
+ countries: Country[];
6
+ currentCountry: Country | undefined;
7
+ isLoading?: boolean;
8
+ isReadonly?: boolean;
9
+ showCurrencyChangeWarning?: boolean;
10
+ }
11
+ export declare function AddressForm({ address, countries, currentCountry: _currentCountry, isLoading, isReadonly, showCurrencyChangeWarning, }: AddressFormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
+ import { useState } from 'react';
4
+ import { CountrySelect } from '../../../country-select/country-select.js';
5
+ import { FormattedMessage } from '../../../intl/formatted-message.js';
6
+ import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
7
+ import { Message } from '../../../message/message.js';
8
+ import { validatePhone, validateEmail } from '../../../shared/model/address.js';
9
+ import { TextField } from '../../fields/text-field/text-field.js';
10
+ import formStyles from './address-form.module.css.js';
11
+
12
+ function AddressForm({ address, countries, currentCountry: _currentCountry, isLoading = false, isReadonly = false, showCurrencyChangeWarning = false, }) {
13
+ const t = useFormattedMessage();
14
+ const [companyName, setCompanyName] = useState(address?.companyName || '');
15
+ const [lastName, setLastName] = useState(address?.lastName || '');
16
+ const currentCountry = countries.find(c => c.id === address?.country?.id) || _currentCountry;
17
+ const [selectedCountry, setSelectedCountry] = useState(currentCountry);
18
+ const currencyHasChanged = Boolean(currentCountry) &&
19
+ selectedCountry?.currencyCode !== currentCountry?.currencyCode;
20
+ if (countries.length === 0) {
21
+ return (jsx(Message, { type: "danger", children: jsx(FormattedMessage, { force: true, id: "No countries available. Unable to change address." }) }));
22
+ }
23
+ return (jsxs(Fragment, { children: [jsx(TextField, { defaultValue: address?.firstName, isDisabled: isLoading || isReadonly, label: t('First name'), name: "firstName", showLabel: true }), jsx(TextField, { isDisabled: isLoading || isReadonly, isRequired: !companyName, label: t('Last name'), minLength: 3, name: "lastName", onChange: setLastName, showLabel: true, value: lastName }, `lastname-${Boolean(companyName)}`), jsx(TextField, { defaultValue: address?.companyName, isDisabled: isLoading || isReadonly, label: t('Company name'), name: "companyName", onChange: setCompanyName, showLabel: true, value: companyName }), jsx(TextField, { defaultValue: address?.attention, isDisabled: isLoading || isReadonly, label: t('Attention'), name: "attention", showLabel: true }), jsx("div", { className: formStyles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: address?.address1, isDisabled: isLoading || isReadonly, label: `${t('Address')} 1`, maxLength: 30, minLength: 3, name: "address1", showLabel: true }) }), jsx("div", { className: formStyles['span-2'], children: jsx(TextField, { defaultValue: address?.address2, isDisabled: isLoading || isReadonly, label: `${t('Address')} 2`, maxLength: 30, minLength: 3, name: "address2", showLabel: true }) }), jsx("div", { className: formStyles['span-2'], children: jsx(TextField, { defaultValue: address?.address3, isDisabled: isLoading || isReadonly, label: `${t('Address')} 3`, maxLength: 30, minLength: 3, name: "address3", showLabel: true }) }), jsx(TextField, { isRequired: true, defaultValue: address?.postalCode, isDisabled: isLoading || isReadonly, label: t('Postal Code'), maxLength: 10, minLength: 4, name: "postalCode", showLabel: true }), jsx(TextField, { isRequired: true, defaultValue: address?.city, isDisabled: isLoading || isReadonly, label: t('City'), maxLength: 30, minLength: 3, name: "city", showLabel: true }), jsxs("div", { className: formStyles['span-2'], children: [jsx(CountrySelect, { isRequired: true, countries: countries, "data-test-selector": "countrySelect", isDisabled: isLoading || isReadonly, name: "countrySelect", onCountryChange: setSelectedCountry, selectedCountry: selectedCountry }), showCurrencyChangeWarning && currencyHasChanged && (jsx(Message, { className: formStyles['currency-warning'], type: "warning", children: jsx(FormattedMessage, { id: "Selecting this country will result in your cart to be converted to the currency {0}", replacementValues: {
24
+ '0': selectedCountry?.currencyCode || t('Unknown'),
25
+ } }) }))] }), jsx("div", { className: formStyles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: address?.phone, isDisabled: isLoading || isReadonly, label: t('Phone'), name: "phone", showLabel: true, validate: value => {
26
+ if (!value)
27
+ return value;
28
+ return (validatePhone(value) || t('Please enter a valid phone number'));
29
+ } }) }), jsx("div", { className: formStyles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: address?.email || '', isDisabled: isLoading || isReadonly, label: t('Email'), name: "email", showLabel: true, type: "email", validate: value => {
30
+ if (!value)
31
+ return value;
32
+ return (validateEmail(value) || t('Please enter a valid email address'));
33
+ } }) })] }));
34
+ }
35
+
36
+ export { AddressForm };
@@ -0,0 +1,3 @@
1
+ var formStyles = {"form":"address-form-module-pbmJ-","span-2":"address-form-module-dRYo2","currency-warning":"address-form-module-62GxY"};
2
+
3
+ export { formStyles as default };
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { useMemo } from 'react';
3
4
  import { IconButton } from '../../../buttons/icon-button/icon-button.js';
4
5
  import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
5
6
  import { AccountIcon } from '../../../navigation/account-icon/account-icon.js';
@@ -11,10 +12,16 @@ function ConnectedAccountButton({ className, 'data-test-selector': dataTestSelec
11
12
  const paths = usePaths();
12
13
  const t = useFormattedMessage();
13
14
  const isAuthenticated = useIsAuthenticated();
14
- const { href: returnUrl } = useLocation();
15
+ const _location = useLocation();
16
+ const href = useMemo(() =>
17
+ // TODO: Replace with relative URL when migrated away from Umbraco
18
+ typeof location === 'undefined' ? undefined : location.href,
19
+ // Using the location hook to detect url changes, but not using it directly
20
+ // eslint-disable-next-line react-hooks/exhaustive-deps
21
+ [_location]);
15
22
  return (jsx(IconButton, { className: className, "data-authenticated": isAuthenticated ? true : false, "data-test-selector": dataTestSelector, href: isAuthenticated
16
23
  ? paths.ACCOUNT
17
- : `${paths.SIGN_IN}${returnUrl ? `?returnUrl=${encodeURIComponent(returnUrl)}` : ''}`, onClick: onClick, children: jsx(AccountIcon, { "aria-label": isAuthenticated ? t('My Sonic') : t('Sign in or create account'), isAuthenticated: isAuthenticated }) }));
24
+ : `${paths.SIGN_IN}${href ? `?returnUrl=${encodeURIComponent(href)}` : ''}`, onClick: onClick, children: jsx(AccountIcon, { "aria-label": isAuthenticated ? t('My Sonic') : t('Sign in or create account'), isAuthenticated: isAuthenticated }) }));
18
25
  }
19
26
 
20
27
  export { ConnectedAccountButton };
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ export { Form } from './forms/layout/form/form.js';
113
113
  export { FormFieldLayout } from './forms/layout/form/form-field-layout.js';
114
114
  export { FormSegment } from './forms/layout/form/form-segment.js';
115
115
  export { FormSegmentGroup } from './forms/layout/form/form-segment-group.js';
116
- export { EditAddressForm } from './forms/partials/edit-address-form/edit-address-form.js';
116
+ export { AddressForm } from './forms/partials/address-form/address-form.js';
117
117
  export { PasswordValidation } from './forms/partials/password-validation/password-validation.js';
118
118
  export { CategoriesGrid } from './global-search/categories-grid/categories-grid.js';
119
119
  export { GlobalSearch, SearchRoot } from './global-search/global-search.js';
@@ -249,7 +249,9 @@ export { ConnectedChangeCustomerDialog } from './pages/my-sonic/actions/change-c
249
249
  export { ChangePassword } from './pages/my-sonic/actions/change-password/change-password.js';
250
250
  export { ChangePasswordDialog } from './pages/my-sonic/actions/change-password/change-password-dialog.js';
251
251
  export { ConnectedChangePasswordDialog } from './pages/my-sonic/actions/change-password/connected-change-password-dialog.js';
252
- export { EditBillToAddress } from './pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.js';
252
+ export { ConnectedCreateShipToAddressForm } from './pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form.js';
253
+ export { ConnectedEditBillToAddressForm } from './pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.js';
254
+ export { ConnectedEditShipToAddressForm } from './pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.js';
253
255
  export { ConnectedEditUserInfoDialog } from './pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog.js';
254
256
  export { EditUserInfo } from './pages/my-sonic/actions/edit-user-info/edit-user-info.js';
255
257
  export { EditUserInfoDialog } from './pages/my-sonic/actions/edit-user-info/edit-user-info-dialog.js';
@@ -324,13 +326,17 @@ export { usePatchCart } from './shared/api/storefront/hooks/cart/use-patch-cart.
324
326
  export { usePatchCartLineById } from './shared/api/storefront/hooks/cart/use-patch-cart-line-by-id.js';
325
327
  export { usePlaceOrder } from './shared/api/storefront/hooks/cart/use-place-order.js';
326
328
  export { useSaveCartForLater } from './shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
329
+ export { useFetchBillToAddress } from './shared/api/storefront/hooks/customer/use-fetch-bill-to-address.js';
327
330
  export { useFetchBillToAddresses } from './shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses.js';
328
331
  export { useFetchCurrentBillToAddress } from './shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.js';
329
332
  export { useFetchCurrentShipToAddress } from './shared/api/storefront/hooks/customer/use-fetch-current-ship-to-address.js';
330
333
  export { useFetchFulfillmentMethodsByCustomerId } from './shared/api/storefront/hooks/customer/use-fetch-fulfillment-methods-by-customer-id.js';
331
334
  export { useFetchFulfillmentMethodsForCurrentCart } from './shared/api/storefront/hooks/customer/use-fetch-fulfillment-methods-for-current-cart.js';
335
+ export { useFetchShipToAddress } from './shared/api/storefront/hooks/customer/use-fetch-ship-to-address.js';
332
336
  export { useFetchShipToAddresses } from './shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses.js';
333
337
  export { usePatchBillToAddress } from './shared/api/storefront/hooks/customer/use-patch-bill-to-address.js';
338
+ export { usePatchShipToAddress } from './shared/api/storefront/hooks/customer/use-patch-ship-to-address.js';
339
+ export { usePostShipToAddress } from './shared/api/storefront/hooks/customer/use-post-ship-to-address.js';
334
340
  export { useFetchOrders } from './shared/api/storefront/hooks/orders/use-fetch-orders.js';
335
341
  export { useCreateAdyenSession } from './shared/api/storefront/hooks/payment/use-create-adyen-session.js';
336
342
  export { useFetchAdyenConfig } from './shared/api/storefront/hooks/payment/use-fetch-adyen-config.js';
@@ -351,7 +357,7 @@ export { useFetchWishLists } from './shared/api/storefront/hooks/wishlist/use-fe
351
357
  export { ExistingAccountError, createAccount, createGuestAccount, fetchCurrentAccount, patchCurrentAccount } from './shared/api/storefront/services/account-service.js';
352
358
  export { InvalidPasswordError, NonUniquePasswordError, createSession, fetchSession, patchSession, recoverPassword, signIn, signOut } from './shared/api/storefront/services/authentication-service.js';
353
359
  export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCart, patchCartLineById, placeOrder, postAdyenPayment, saveCartForLater } from './shared/api/storefront/services/cart-service.js';
354
- export { fetchBillToAddresses, fetchCurrentBillToAddress, fetchCurrentShipToAddress, fetchFulfillmentMethods, fetchShipToAddresses, patchBillToAddress } from './shared/api/storefront/services/customer-service.js';
360
+ export { fetchBillToAddress, fetchBillToAddresses, fetchCurrentBillToAddress, fetchCurrentShipToAddress, fetchFulfillmentMethods, fetchShipToAddress, fetchShipToAddresses, patchBillToAddress, patchShipToAddress, postShipToAddress } from './shared/api/storefront/services/customer-service.js';
355
361
  export { validateVATNumber } from './shared/api/storefront/services/finance-service.js';
356
362
  export { fetchOrders } from './shared/api/storefront/services/order-service.js';
357
363
  export { createAdyenSession, fetchAdyenConfig } from './shared/api/storefront/services/payment-service.js';
@@ -1 +1 @@
1
- export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Account' | 'active' | 'Add order notes' | 'Add to cart' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address' | 'All payment methods are unavailable at this time. Please contact customer support.' | 'Amount: {0}' | 'An error occurred while changing the customer.' | 'An error occurred while fetching customers. Please try again later.' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'ASC' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Billing' | 'Cancel' | 'Cart' | 'Change customer' | 'Change password' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Checkout order' | 'Chosen filters' | 'City' | 'Clear filters' | 'Clear' | 'Click the button below to continue shopping.' | 'Client cases' | 'Close' | 'CoC number' | 'Company name' | 'Conceal value' | 'Confirm password' | 'Continue shopping' | 'Continue to sign in' | 'Continue' | 'Copyright © Sonic Equipment B.V.' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Current Password is invalid' | 'Date' | 'Decrease' | 'Delivery date' | 'Delivery expected on {0}' | 'DESC' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Edit Sonic account' | 'Edit' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Favorites' | 'Features' | 'Filter order status' | 'Finalize order' | 'Finalize payment' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'Incl. VAT' | 'Includes' | 'Increase' | 'Industry' | 'industry.AG' | 'industry.AU' | 'industry.AV' | 'industry.BC' | 'industry.MA' | 'industry.MC' | 'industry.OT' | 'industry.PP' | 'industry.TR' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'Log out' | 'Main menu' | 'Make this the default customer' | 'More than {0} articles' | 'My Sonic' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New Password is required and must be different than Current Password' | 'New password' | 'New user?' | 'Next' | 'No orders found.' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'OK' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order#' | 'Order' | 'Orders' | 'orderProperty.Number' | 'orderProperty.Date' | 'orderProperty.Price' | 'orderProperty.Status' | 'orderProperty.Shipping Address' | 'orderProperty.PO Number' | 'orderStatus.Any' | 'orderStatus.Cancelled' | 'orderStatus.Fulfilled' | 'orderStatus.Partially fulfilled' | 'orderStatus.Processing' | 'orderStatus.Saved' | 'orderStatus.Waiting for customer service' | 'Our products' | 'Overview' | 'Password changed. Please sign in again.' | 'Password does not meet requirements' | 'Password' | 'Passwords do not match' | 'Pay by invoice' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Previous' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove all' | 'Reorder' | 'Requested delivery date' | 'Results' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | 'Search orders' | 'See all results' | 'Select a country' | 'Select a desired delivery date' | 'Select a language' | 'Select a list' | 'Select an industry' | 'Select other customer' | 'Selected customer' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Shopping cart' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sign in or create account' | 'sign in' | 'Sign me up for newsletters and product updates' | 'Signed in' | 'Signed out' | 'Signing in…' | 'Sonic account' | 'Sonic address' | 'Sonic Equipment' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'sort.ASC' | 'sort.DESC' | 'sort.NONE' | 'Specifications' | 'Start checkout' | 'Status' | 'Submenu' | 'Submit email address' | 'Submit' | 'Submitting…' | 'Subtotal' | 'Suggestions' | 'Support' | 'tag.limited' | 'tag.new' | 'The email address you entered is already associated with an existing account. Please sign in to this account or contact Customer Support.' | 'The expected delivery is an indication based on the product availability and the shipping location.' | 'The product has been added to your cart.' | 'The product has been removed from your cart.' | 'The product has been updated in your cart.' | 'There are more customers, please refine your search if needed.' | 'There are no products in your shopping cart.' | 'There is no information to display' | 'This email is already in use' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Username' | 'Validating' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You are not authorized to access this information.' | 'You are not authorized to perform this action' | 'You are not authorized to view customers. Please log in or contact support.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!' | 'You must ' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'Your cart has been emptied.' | 'Your email and password were not recognized.' | 'Your favorites are available on multiple devices' | 'Your new Sonic Equipment account was succesfully created. You should receive an email soon with further instructions on how to activate this account. If you do not receive this email, please contact Customer Support.' | 'Your shopping cart is still empty';
1
+ export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Account' | 'active' | 'Add order notes' | 'Add to cart' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address not found' | 'Address' | 'All payment methods are unavailable at this time. Please contact customer support.' | 'Amount: {0}' | 'An error occurred while changing the customer.' | 'An error occurred while fetching customers. Please try again later.' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'ASC' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | 'Back' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Billing' | 'Cancel' | 'Cart' | 'Change customer' | 'Change password' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Checkout order' | 'Chosen filters' | 'City' | 'Clear filters' | 'Create' | 'Clear' | 'Click the button below to continue shopping.' | 'Client cases' | 'Close' | 'CoC number' | 'Company name' | 'Conceal value' | 'Confirm password' | 'Continue shopping' | 'Continue to sign in' | 'Continue' | 'Copyright © Sonic Equipment B.V.' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Current Password is invalid' | 'Date' | 'Decrease' | 'Delivery date' | 'Delivery expected on {0}' | 'DESC' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Edit Sonic account' | 'Edit' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Favorites' | 'Features' | 'Filter order status' | 'Finalize order' | 'Finalize payment' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'Incl. VAT' | 'Includes' | 'Increase' | 'Industry' | 'industry.AG' | 'industry.AU' | 'industry.AV' | 'industry.BC' | 'industry.MA' | 'industry.MC' | 'industry.OT' | 'industry.PP' | 'industry.TR' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'Log out' | 'Main menu' | 'Make this the default customer' | 'Make this the default ship to address' | 'More than {0} articles' | 'My Sonic' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New Password is required and must be different than Current Password' | 'New password' | 'New user?' | 'Next' | 'No orders found.' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'OK' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order#' | 'Order' | 'Orders' | 'orderProperty.Number' | 'orderProperty.Date' | 'orderProperty.Price' | 'orderProperty.Status' | 'orderProperty.Shipping Address' | 'orderProperty.PO Number' | 'orderStatus.Any' | 'orderStatus.Cancelled' | 'orderStatus.Fulfilled' | 'orderStatus.Partially fulfilled' | 'orderStatus.Processing' | 'orderStatus.Saved' | 'orderStatus.Waiting for customer service' | 'Our products' | 'Overview' | 'Password changed. Please sign in again.' | 'Password does not meet requirements' | 'Password' | 'Passwords do not match' | 'Pay by invoice' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Previous' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove all' | 'Reorder' | 'Requested delivery date' | 'Results' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved' | 'Saved cart for later.' | 'Saving' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | 'Search orders' | 'See all results' | 'Select a country' | 'Select a desired delivery date' | 'Select a language' | 'Select a list' | 'Select an industry' | 'Select other customer' | 'Selected customer' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Shopping cart' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sign in or create account' | 'sign in' | 'Sign me up for newsletters and product updates' | 'Signed in' | 'Signed out' | 'Signing in…' | 'Sonic account' | 'Sonic address' | 'Sonic Equipment' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'sort.ASC' | 'sort.DESC' | 'sort.NONE' | 'Specifications' | 'Start checkout' | 'Status' | 'Submenu' | 'Submit email address' | 'Submit' | 'Submitting…' | 'Subtotal' | 'Suggestions' | 'Support' | 'tag.limited' | 'tag.new' | 'The email address you entered is already associated with an existing account. Please sign in to this account or contact Customer Support.' | 'The expected delivery is an indication based on the product availability and the shipping location.' | 'The product has been added to your cart.' | 'The product has been removed from your cart.' | 'The product has been updated in your cart.' | 'There are more customers, please refine your search if needed.' | 'There are no products in your shopping cart.' | 'There is no information to display' | 'This email is already in use' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Username' | 'Validating' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You are not authorized to access this information.' | 'You are not authorized to perform this action' | 'You are not authorized to view customers. Please log in or contact support.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!' | 'You must ' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'Your cart has been emptied.' | 'Your email and password were not recognized.' | 'Your favorites are available on multiple devices' | 'Your new Sonic Equipment account was succesfully created. You should receive an email soon with further instructions on how to activate this account. If you do not receive this email, please contact Customer Support.' | 'Your shopping cart is still empty';
@@ -16,6 +16,7 @@ export interface SignInFormProps {
16
16
  initialEmail?: string;
17
17
  initialRememberMe?: boolean;
18
18
  isDisabled?: boolean;
19
+ isLoading?: boolean;
19
20
  isPendingGuestSignIn?: boolean;
20
21
  isPendingUserSignIn?: boolean;
21
22
  onRecoverPasswordDialogOpen?: () => void;
@@ -23,5 +24,5 @@ export interface SignInFormProps {
23
24
  data: SubmitData;
24
25
  }) => void;
25
26
  }
26
- export declare function SignInForm({ allowGuestSignIn, createAccountPath, errorType, initialEmail, initialRememberMe, isDisabled: _isDisabled, isPendingGuestSignIn, isPendingUserSignIn, onRecoverPasswordDialogOpen, onSubmit, }: SignInFormProps): import("react/jsx-runtime").JSX.Element;
27
+ export declare function SignInForm({ allowGuestSignIn, createAccountPath, errorType, initialEmail, initialRememberMe, isDisabled: _isDisabled, isLoading, isPendingGuestSignIn, isPendingUserSignIn, onRecoverPasswordDialogOpen, onSubmit, }: SignInFormProps): import("react/jsx-runtime").JSX.Element;
27
28
  export {};
@@ -9,13 +9,14 @@ import { Form } from '../../../../forms/layout/form/form.js';
9
9
  import { FormSegment } from '../../../../forms/layout/form/form-segment.js';
10
10
  import { FormSegmentGroup } from '../../../../forms/layout/form/form-segment-group.js';
11
11
  import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
12
+ import { DynamicLoadingOverlay } from '../../../../loading/dynamic-loading-overlay.js';
12
13
  import { validateEmail } from '../../../../shared/model/address.js';
13
14
  import { voidFunction } from '../../../../shared/model/defaults.js';
14
15
  import { Heading } from '../../../../typography/heading/heading.js';
15
16
  import styles from './sign-in-form.module.css.js';
16
17
 
17
18
  const GUEST_SIGN_IN_BUTTON_NAME = 'guestSignin';
18
- function SignInForm({ allowGuestSignIn = false, createAccountPath, errorType, initialEmail, initialRememberMe, isDisabled: _isDisabled = false, isPendingGuestSignIn = false, isPendingUserSignIn = false, onRecoverPasswordDialogOpen = voidFunction, onSubmit = voidFunction, }) {
19
+ function SignInForm({ allowGuestSignIn = false, createAccountPath, errorType, initialEmail, initialRememberMe, isDisabled: _isDisabled = false, isLoading = false, isPendingGuestSignIn = false, isPendingUserSignIn = false, onRecoverPasswordDialogOpen = voidFunction, onSubmit = voidFunction, }) {
19
20
  const t = useFormattedMessage();
20
21
  const title = t('sign in');
21
22
  const isDisabled = isPendingUserSignIn || isPendingGuestSignIn || _isDisabled;
@@ -61,11 +62,12 @@ function SignInForm({ allowGuestSignIn = false, createAccountPath, errorType, in
61
62
  const header = (jsx(Heading, { "data-test-selector": "pageTitle", italic: true, size: "m", tag: "h1", uppercase: true, children: title }));
62
63
  // form footer
63
64
  const footer = (jsxs(Fragment, { children: [jsx(FormSegment, { isFloating: true, children: jsx(SwitchField, { defaultSelected: initialRememberMe, isDisabled: isDisabled, name: "rememberMe", value: "true", children: t('Remember me') }) }), jsx(FormSegment, { children: jsx(Button, { "data-test-selector": "signIn_submit", isDisabled: isDisabled, isLoading: isPendingUserSignIn && t('Signing in…'), type: "submit", withArrow: true, children: t('sign in') }) }), jsxs(FormSegment, { children: [jsx("p", { className: styles['footer-options'], children: jsx(Link, { color: "primary", "data-test-selector": "signIn_forgotPassword", hasUnderline: true, isDisabled: isDisabled, onClick: onRecoverPasswordDialogOpen, children: t('Forgot password?') }) }), jsx("p", { className: styles['footer-options'], children: jsxs(Fragment, { children: [t('New user?'), ' ', jsx(Link, { "data-test-selector": "signInCreateNewAccount_createNewAccount", hasUnderline: true, href: createAccountPath, isDisabled: isDisabled, children: t('create account') })] }) })] }), allowGuestSignIn && (jsx(FormSegment, { children: jsx(Button, { color: "secondary", "data-test-selector": "continueAsGuest", isDisabled: isDisabled, isLoading: isPendingGuestSignIn && t('Signing in…'), isValidating: false, name: GUEST_SIGN_IN_BUTTON_NAME, type: "submit", value: "true", variant: "outline", children: t('Or continue as guest') }) }))] }));
64
- return (jsx(Form, { autoComplete: true, className: styles['sign-in-form'], errorMessage: errorMessage, footer: footer, header: header, onSubmit: handleSubmit, title: title, children: jsxs(FormSegmentGroup, { children: [jsx(FormSegment, { children: jsx(TextField, { autoComplete: "username", "data-test-selector": "signIn_userName", defaultValue: initialEmail, inputMode: "email", isDisabled: isDisabled, isRequired: true, label: t('Email'), name: "email", showLabel: true, type: "email", validate: value => {
65
- if (!value)
66
- return value;
67
- return (validateEmail(value) || t('Please enter a valid email address'));
68
- } }) }), jsx(FormSegment, { children: jsx(PasswordField, { autoComplete: "current-password", "data-test-selector": "signIn_password", isDisabled: isDisabled, isRequired: true, label: t('Password'), name: "password", showLabel: true }) })] }) }));
65
+ return (jsx(Form, { autoComplete: true, className: styles['sign-in-form'], errorMessage: errorMessage, footer: footer, header: header, onSubmit: handleSubmit, title: title, children: jsx(DynamicLoadingOverlay, { isLoading: isLoading, children: jsxs(FormSegmentGroup, { children: [jsx(FormSegment, { children: jsx(TextField, { autoComplete: "username", "data-test-selector": "signIn_userName", defaultValue: initialEmail, inputMode: "email", isDisabled: isDisabled, isRequired: true, label: t('Email'), name: "email", showLabel: true, type: "email", validate: value => {
66
+ if (!value)
67
+ return value;
68
+ return (validateEmail(value) ||
69
+ t('Please enter a valid email address'));
70
+ } }) }), jsx(FormSegment, { children: jsx(PasswordField, { autoComplete: "current-password", "data-test-selector": "signIn_password", isDisabled: isDisabled, isRequired: true, label: t('Password'), name: "password", showLabel: true }) })] }) }) }));
69
71
  }
70
72
 
71
73
  export { SignInForm };
@@ -17,7 +17,7 @@ function SignInPage({ returnUrl } = {}) {
17
17
  const { navigate } = useNavigate();
18
18
  const [isSuccess, setIsSuccess] = useState(false);
19
19
  const { isOpen: isRecoverPasswordDialogOpen, setIsOpen: setRecoverPasswordDialogOpen, } = useDisclosure(false);
20
- const { data: session } = useFetchSession();
20
+ const { data: session, isLoading } = useFetchSession();
21
21
  const { error: errorSignIn, isPending: isPendingSignIn, mutate: signIn, reset: resetSignIn, } = useSignIn();
22
22
  const { error: errorCreateGuest, isPending: isPendingCreateGuest, mutate: createGuest, reset: resetCreateGuest, } = useCreateGuestAccount();
23
23
  const errorType = useMemo(() => {
@@ -57,7 +57,7 @@ function SignInPage({ returnUrl } = {}) {
57
57
  const onRecoverPasswordDialogOpen = () => {
58
58
  setRecoverPasswordDialogOpen(true);
59
59
  };
60
- return (jsxs(Fragment, { children: [jsx(SignInPageLayout, { fullHeight: true, children: jsx(SignInForm, { allowGuestSignIn: allowGuestSignIn, createAccountPath: createAccountPath, errorType: errorType, initialEmail: session?.isGuest ? '' : session?.email, initialRememberMe: session?.rememberMe, isDisabled: !session || isSuccess, isPendingGuestSignIn: isPendingCreateGuest, isPendingUserSignIn: isPendingSignIn, onRecoverPasswordDialogOpen: onRecoverPasswordDialogOpen, onSubmit: onSubmit }) }), jsx(RecoverPasswordDialog, { isOpen: isRecoverPasswordDialogOpen, onOpenChange: isOpen => setRecoverPasswordDialogOpen(isOpen) })] }));
60
+ return (jsxs(Fragment, { children: [jsx(SignInPageLayout, { fullHeight: true, children: jsx(SignInForm, { allowGuestSignIn: allowGuestSignIn, createAccountPath: createAccountPath, errorType: errorType, initialEmail: session?.isGuest ? '' : session?.email, initialRememberMe: session?.rememberMe, isDisabled: !session || isSuccess, isLoading: isLoading, isPendingGuestSignIn: isPendingCreateGuest, isPendingUserSignIn: isPendingSignIn, onRecoverPasswordDialogOpen: onRecoverPasswordDialogOpen, onSubmit: onSubmit }) }), jsx(RecoverPasswordDialog, { isOpen: isRecoverPasswordDialogOpen, onOpenChange: isOpen => setRecoverPasswordDialogOpen(isOpen) })] }));
61
61
  }
62
62
 
63
63
  export { SignInPage };
@@ -3,7 +3,7 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { Form } from 'react-aria-components';
4
4
  import { Checkbox } from '../../../../forms/elements/checkbox/checkbox.js';
5
5
  import { TextField } from '../../../../forms/fields/text-field/text-field.js';
6
- import { EditAddressForm } from '../../../../forms/partials/edit-address-form/edit-address-form.js';
6
+ import { AddressForm } from '../../../../forms/partials/address-form/address-form.js';
7
7
  import { InfoIconTooltip } from '../../../../info-icon-tooltip/info-icon-tooltip.js';
8
8
  import { FormattedMessage } from '../../../../intl/formatted-message.js';
9
9
  import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
@@ -43,7 +43,7 @@ function EditCheckoutBillToAddressForm({ billTo, countries, currentCountry, isLo
43
43
  ? undefined
44
44
  : formData.get('notes')?.toString() || '',
45
45
  });
46
- }, children: [jsx(EditAddressForm, { address: billTo, countries: countries, currentCountry: currentCountry, isLoading: isLoading }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: cart?.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, { children: jsx(Fragment, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs("div", { className: styles['use-invoice-checkbox'], children: [jsx(Checkbox, { "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), jsx(InfoIconTooltip, { variant: "stroke", children: t('Changing your address is currently not possible. Please contact customer support to change your address.') })] })) }) }) })] }));
46
+ }, children: [jsx(AddressForm, { showCurrencyChangeWarning: true, address: billTo, countries: countries, currentCountry: currentCountry, isLoading: isLoading }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: cart?.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, { children: jsx(Fragment, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs("div", { className: styles['use-invoice-checkbox'], children: [jsx(Checkbox, { "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), jsx(InfoIconTooltip, { variant: "stroke", children: t('Changing your address is currently not possible. Please contact customer support to change your address.') })] })) }) }) })] }));
47
47
  }
48
48
 
49
49
  export { EDIT_ADDRESS_FORM_ID, EditCheckoutBillToAddressForm };
@@ -32,7 +32,7 @@ function usePatchShippingDetails() {
32
32
  queryClient.setQueryData(['session'], patchedSession);
33
33
  }
34
34
  else if (patchedBillTo) {
35
- queryClient.removeQueries({ queryKey: ['session'] });
35
+ queryClient.invalidateQueries({ queryKey: ['session'] });
36
36
  }
37
37
  if (patchedCart) {
38
38
  queryClient.setQueryData(['carts', patchedCart.id], patchedCart);
@@ -0,0 +1,4 @@
1
+ export declare function ConnectedCreateShipToAddressForm({ billToId, returnUrl, }: {
2
+ billToId: string;
3
+ returnUrl?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,90 @@
1
+ "use client";
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { Button } from '../../../../buttons/button/button.js';
4
+ import { useCountries } from '../../../../country-select/hooks/use-countries.js';
5
+ import { Checkbox } from '../../../../forms/elements/checkbox/checkbox.js';
6
+ import { Form } from '../../../../forms/layout/form/form.js';
7
+ import { AddressForm } from '../../../../forms/partials/address-form/address-form.js';
8
+ import { FormattedMessage } from '../../../../intl/formatted-message.js';
9
+ import { Message } from '../../../../message/message.js';
10
+ import { usePatchCurrentAccount } from '../../../../shared/api/storefront/hooks/account/use-patch-current-account.js';
11
+ import { usePatchSession } from '../../../../shared/api/storefront/hooks/authentication/use-patch-session.js';
12
+ import { usePostShipToAddress } from '../../../../shared/api/storefront/hooks/customer/use-post-ship-to-address.js';
13
+ import { NotFoundRequestError } from '../../../../shared/fetch/request.js';
14
+ import { useNavigate } from '../../../../shared/routing/use-navigate.js';
15
+ import { usePaths } from '../../../../shared/routing/use-paths.js';
16
+ import { Heading } from '../../../../typography/heading/heading.js';
17
+ import { ErrorPage } from '../../../error-page/error-page.js';
18
+ import { LoadingPage } from '../../../loading-page/loading-page.js';
19
+ import formStyles from '../../../../forms/partials/address-form/address-form.module.css.js';
20
+ import styles from './create-ship-to-address.module.css.js';
21
+
22
+ function ConnectedCreateShipToAddressForm({ billToId, returnUrl, }) {
23
+ const paths = usePaths();
24
+ const { navigate } = useNavigate();
25
+ const { countries, currentCountry, error: errorCountries, isFetching: isLoadingCountries, } = useCountries();
26
+ const { error: errorShipToAddress, isLoading: isPostingShipToAddress, isSuccess, mutate: postShipToAddress, } = usePostShipToAddress();
27
+ const { isLoading: isPatchingSession, mutate: patchSession } = usePatchSession();
28
+ const { isLoading: isPatchingCurrentAccount, mutate: patchCurrentAccount } = usePatchCurrentAccount();
29
+ const isPatching = isPostingShipToAddress || isPatchingSession || isPatchingCurrentAccount;
30
+ if (isLoadingCountries)
31
+ return jsx(LoadingPage, {});
32
+ if (errorShipToAddress && errorShipToAddress instanceof NotFoundRequestError)
33
+ return (jsx(Heading, { size: "l", children: jsx(FormattedMessage, { id: "Address not found" }) }));
34
+ if (errorCountries)
35
+ return jsx(ErrorPage, { error: errorCountries });
36
+ if (!countries) {
37
+ return jsx(ErrorPage, { error: new Error('No countries data available.') });
38
+ }
39
+ return (jsxs(Form, { className: formStyles.form, "data-test-selector": "shipToAddressForm", onSubmit: async ({ formData }) => {
40
+ const countryFormValue = formData.get('countrySelect')?.toString();
41
+ const country = countries.find(country => country.id === countryFormValue);
42
+ if (!country)
43
+ throw new Error(`Country not found ${formData.get('country')}`);
44
+ const isDefault = formData.get('setAsDefault')?.toString() === 'TRUE' || false;
45
+ const createdShipToAddress = await postShipToAddress({
46
+ billToId,
47
+ shipTo: {
48
+ address1: formData.get('address1')?.toString() || '',
49
+ address2: formData.get('address2')?.toString() || '',
50
+ address3: formData.get('address3')?.toString() || '',
51
+ attention: formData.get('attention')?.toString() || '',
52
+ city: formData.get('city')?.toString() || '',
53
+ companyName: formData.get('companyName')?.toString() || '',
54
+ country: { id: country.id },
55
+ email: formData.get('email')?.toString() || '',
56
+ firstName: formData.get('firstName')?.toString() || '',
57
+ id: 'Create New Address',
58
+ isDefault: formData.get('setAsDefault')?.toString() === 'TRUE' || false,
59
+ isNew: true,
60
+ isVmiLocation: false,
61
+ label: 'Create New Address',
62
+ lastName: formData.get('lastName')?.toString() || '',
63
+ oneTimeAddress: false,
64
+ phone: formData.get('phone')?.toString() || '',
65
+ postalCode: formData.get('postalCode')?.toString() || '',
66
+ properties: {},
67
+ state: null,
68
+ uri: undefined,
69
+ },
70
+ });
71
+ if (isDefault) {
72
+ await patchSession({
73
+ session: {
74
+ customerWasUpdated: true,
75
+ shipTo: { id: createdShipToAddress.id, isDefault: true },
76
+ },
77
+ });
78
+ await patchCurrentAccount({
79
+ account: {
80
+ defaultCustomerId: createdShipToAddress.id,
81
+ defaultFulfillmentMethod: 'Ship',
82
+ setDefaultCustomer: true,
83
+ },
84
+ });
85
+ }
86
+ return navigate(`${paths.ACCOUNT_EDIT_BILL_TO_ADDRESS}/${billToId}${paths.ACCOUNT_EDIT_SHIP_TO_ADDRESS}/${createdShipToAddress.id}?returnUrl=${encodeURIComponent(returnUrl || '')}`);
87
+ }, children: [jsx(AddressForm, { address: undefined, countries: countries, currentCountry: currentCountry, isLoading: isPatching }), jsx(Checkbox, { isDisabled: isPatching, name: "setAsDefault", value: "TRUE", children: jsx(FormattedMessage, { id: "Make this the default ship to address" }) }), Boolean(errorShipToAddress) && (jsx("div", { className: styles.info, children: jsx(Message, { type: "danger", children: jsx(FormattedMessage, { id: "An unexpected error occured" }) }) })), isSuccess && !isPatching && (jsx("div", { className: styles.info, children: jsx(Message, { type: "info", children: jsx(FormattedMessage, { id: "Saved" }) }) })), jsxs("div", { className: styles.actions, children: [returnUrl && (jsx(Button, { color: "secondary", isDisabled: isPatching, onClick: () => navigate(returnUrl), variant: "outline", children: jsx(FormattedMessage, { id: "Back" }) })), jsx(Button, { isLoading: isPatching ? jsx(FormattedMessage, { id: "Saving" }) : undefined, type: "submit", children: jsx(FormattedMessage, { id: "Save" }) })] })] }));
88
+ }
89
+
90
+ export { ConnectedCreateShipToAddressForm };
@@ -0,0 +1,3 @@
1
+ var styles = {"actions":"create-ship-to-address-module--IJ52","info":"create-ship-to-address-module-FYIIw"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,4 @@
1
+ export declare function ConnectedEditBillToAddressForm({ billToId, returnUrl, }: {
2
+ billToId: string;
3
+ returnUrl?: string;
4
+ }): import("react/jsx-runtime").JSX.Element;