@sonic-equipment/ui 124.0.0 → 126.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.
- package/dist/address/address.d.ts +9 -0
- package/dist/address/address.js +9 -0
- package/dist/address/address.module.css.js +3 -0
- package/dist/algolia/use-algolia-insights.d.ts +1 -1
- package/dist/breadcrumbs/breadcrumb.js +4 -3
- package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.d.ts +1 -1
- package/dist/buttons/add-to-cart-button/connected-add-to-cart-button.js +2 -2
- package/dist/buttons/button/button.d.ts +2 -1
- package/dist/buttons/button/button.js +2 -2
- package/dist/buttons/button/button.module.css.js +1 -1
- package/dist/checkout/adyen-payment.d.ts +1 -1
- package/dist/checkout/payment-details.d.ts +1 -1
- package/dist/checkout/payment.d.ts +1 -1
- package/dist/checkout/payment.js +1 -1
- package/dist/country-selector/country-select/country-select.d.ts +20 -0
- package/dist/country-selector/country-select/country-select.js +17 -0
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +2 -8
- package/dist/exports.d.ts +10 -2
- package/dist/forms/text-field/text-field.d.ts +2 -1
- package/dist/forms/text-field/text-field.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -6
- package/dist/intl/formatted-message.d.ts +1 -2
- package/dist/intl/missing-translation-provider.d.ts +6 -0
- package/dist/intl/missing-translation-provider.js +30 -0
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/modals/signin/sign-in-dialog.js +1 -1
- package/dist/pages/layouts/checkout-page-layout/checkout-page-layout.d.ts +1 -1
- package/dist/pages/shipping-page/components/edit-address.d.ts +24 -0
- package/dist/pages/shipping-page/components/edit-address.js +54 -0
- package/dist/pages/shipping-page/components/edit-address.module.css.js +3 -0
- package/dist/pages/shipping-page/components/readonly-address.d.ts +10 -0
- package/dist/pages/shipping-page/components/readonly-address.js +25 -0
- package/dist/pages/shipping-page/components/readonly-address.module.css.js +3 -0
- package/dist/pages/shipping-page/shipping-page.d.ts +1 -0
- package/dist/pages/shipping-page/shipping-page.js +75 -0
- package/dist/pages/shipping-page/shipping-page.module.css.js +3 -0
- package/dist/shared/api/shared/hooks/use-awaitable-mutation.d.ts +13 -0
- package/dist/shared/api/shared/hooks/use-awaitable-mutation.js +32 -0
- package/dist/shared/api/storefront/hooks/authentication/use-create-guest-account.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/authentication/use-fetch-session.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/authentication/use-patch-session.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-add-product-to-current-cart.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-delete-current-cart.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-checkout-atp.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines-with-atp.d.ts +15 -15
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-lines.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-product-atp.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-promotions.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-patch-cart-line-by-id.d.ts +6 -0
- package/dist/shared/api/storefront/hooks/cart/{use-update-cart-line-by-id.js → use-patch-cart-line-by-id.js} +4 -4
- package/dist/shared/api/storefront/hooks/cart/use-patch-cart.d.ts +10 -3
- package/dist/shared/api/storefront/hooks/cart/use-patch-cart.js +10 -7
- package/dist/shared/api/storefront/hooks/cart/use-place-order.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-save-cart-for-later.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.d.ts +6 -0
- package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.js +15 -0
- package/dist/shared/api/storefront/hooks/payment/use-create-adyen-session.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/payment/use-fetch-adyen-config.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/translation/use-fetch-translations.js +1 -1
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries-languages.d.ts +2 -2
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries.d.ts +3 -1
- package/dist/shared/api/storefront/hooks/website/use-fetch-countries.js +2 -1
- package/dist/shared/api/storefront/hooks/website/use-fetch-settings.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/website/use-update-locale.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/wishlist/use-fetch-wishlists.d.ts +1 -1
- package/dist/shared/api/storefront/services/authentication-service.d.ts +1 -1
- package/dist/shared/api/storefront/services/cart-service.d.ts +2 -2
- package/dist/shared/api/storefront/services/cart-service.js +2 -2
- package/dist/shared/api/storefront/services/customer-service.d.ts +2 -2
- package/dist/shared/api/storefront/services/customer-service.js +2 -2
- package/dist/shared/api/storefront/services/payment-service.d.ts +1 -1
- package/dist/shared/api/storefront/services/website-service.d.ts +1 -1
- package/dist/shared/api/storefront/services/wishlist-service.d.ts +1 -1
- package/dist/shared/feature-flags/use-feature-flags.d.ts +3 -0
- package/dist/shared/feature-flags/use-feature-flags.js +3 -0
- package/dist/shared/ga/google-analytics-provider.d.ts +1 -1
- package/dist/shared/ga/google-analytics-provider.js +2 -1
- package/dist/shared/ga/use-data-layer.d.ts +1 -1
- package/dist/shared/providers/cart-provider.d.ts +1 -1
- package/dist/shared/providers/favorite-provider.d.ts +1 -1
- package/dist/shared/utils/string.d.ts +1 -0
- package/dist/shared/utils/string.js +5 -0
- package/dist/styles.css +192 -92
- package/dist/tooltip/tooltip.js +1 -1
- package/dist/tooltip/tooltip.module.css.js +1 -1
- package/package.json +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-update-cart-line-by-id.d.ts +0 -6
- package/dist/shared/api/storefront/hooks/customer/use-update-bill-to-address.d.ts +0 -6
- package/dist/shared/api/storefront/hooks/customer/use-update-bill-to-address.js +0 -17
- /package/dist/shared/api/storefront/model/{shop.model.d.ts → storefront.model.d.ts} +0 -0
- /package/dist/shared/api/storefront/model/{shop.model.js → storefront.model.js} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface AddressProps {
|
|
2
|
+
city?: string;
|
|
3
|
+
companyName?: string;
|
|
4
|
+
country?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
phone?: string;
|
|
7
|
+
postalCode?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Address({ city, companyName, country, email, phone, postalCode, }: AddressProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { capitalizeFirstLetter } from '../shared/utils/string.js';
|
|
3
|
+
import styles from './address.module.css.js';
|
|
4
|
+
|
|
5
|
+
function Address({ city, companyName, country, email, phone, postalCode, }) {
|
|
6
|
+
return (jsxs("address", { className: styles.address, children: [companyName && jsx("p", { children: companyName }), (postalCode || city) && (jsxs("p", { children: [postalCode, " ", city ? capitalizeFirstLetter(city) : ''] })), country && jsx("p", { children: country }), phone && jsx("p", { children: phone }), email && jsx("p", { children: email })] }));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { Address };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CartLineModel } from '../shared/api/storefront/model/
|
|
1
|
+
import { CartLineModel } from '../shared/api/storefront/model/storefront.model';
|
|
2
2
|
import { AlgoliaInsightsProviderGlobalState } from './use-algolia-insights-provider-global-state';
|
|
3
3
|
export interface UseAlgoliaEventResult {
|
|
4
4
|
context: Readonly<AlgoliaInsightsProviderGlobalState>;
|
|
@@ -13,17 +13,18 @@ function BreadcrumbShort({ links }) {
|
|
|
13
13
|
const previousLink = links.at(-2);
|
|
14
14
|
const isHomeLink = previousLink === undefined || previousLink === homeLink;
|
|
15
15
|
const href = previousLink?.href || homeLink?.href;
|
|
16
|
-
|
|
16
|
+
const label = previousLink?.label || homeLink?.label;
|
|
17
|
+
return (jsx(Breadcrumbs, { className: styles.breadcrumbs, children: jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsxs(RouteLink, { className: styles.link, href: href, isDisabled: false, title: label, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: styles.icon }), isHomeLink ? (jsx(SolidHomeIcon, { className: styles.icon })) : (jsx("span", { children: previousLink.label }))] }) }) }));
|
|
17
18
|
}
|
|
18
19
|
function BreadcrumbLongItem({ index, isDisabled, link, }) {
|
|
19
|
-
return (jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsxs(RouteLink, { className: styles.link, color: "secondary", href: link.href, isDisabled: isDisabled, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: clsx(styles['previous-icon'], styles.icon) }), link.label] }) }, index));
|
|
20
|
+
return (jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsxs(RouteLink, { className: styles.link, color: "secondary", href: link.href, isDisabled: isDisabled, title: link.label, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: clsx(styles['previous-icon'], styles.icon) }), link.label] }) }, index));
|
|
20
21
|
}
|
|
21
22
|
function BreadcrumbLong({ links }) {
|
|
22
23
|
const linksWithoutFirst = links.slice(1);
|
|
23
24
|
const homeLink = links[0];
|
|
24
25
|
if (!homeLink)
|
|
25
26
|
return null;
|
|
26
|
-
return (jsxs(Breadcrumbs, { className: styles.breadcrumbs, children: [jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsx(RouteLink, { className: styles.link, href: homeLink.href, children: jsx(SolidHomeIcon, { className: clsx(styles['home-icon'], styles.icon) }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, index)))] }));
|
|
27
|
+
return (jsxs(Breadcrumbs, { className: styles.breadcrumbs, children: [jsx(Breadcrumb$1, { className: styles.breadcrumb, children: jsx(RouteLink, { className: styles.link, href: homeLink.href, title: homeLink.label, children: jsx(SolidHomeIcon, { className: clsx(styles['home-icon'], styles.icon) }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, index)))] }));
|
|
27
28
|
}
|
|
28
29
|
function Breadcrumb({ links }) {
|
|
29
30
|
const { lg } = useBreakpoint();
|
|
@@ -4,7 +4,7 @@ import { FormattedMessage } from '../../intl/formatted-message.js';
|
|
|
4
4
|
import { useAddProductToCurrentCart } from '../../shared/api/storefront/hooks/cart/use-add-product-to-current-cart.js';
|
|
5
5
|
import { useDeleteCartLineById } from '../../shared/api/storefront/hooks/cart/use-delete-cart-line-by-id.js';
|
|
6
6
|
import { useFetchCurrentCartLines } from '../../shared/api/storefront/hooks/cart/use-fetch-current-cart-lines.js';
|
|
7
|
-
import {
|
|
7
|
+
import { usePatchCartLineById } from '../../shared/api/storefront/hooks/cart/use-patch-cart-line-by-id.js';
|
|
8
8
|
import { useDataLayer } from '../../shared/ga/use-data-layer.js';
|
|
9
9
|
import { useCartEvents } from '../../shared/providers/cart-provider.js';
|
|
10
10
|
import { useToast } from '../../toast/use-toast.js';
|
|
@@ -15,7 +15,7 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
|
15
15
|
const { isPending: isPendingAddToCart, mutate: addToCart } = useAddProductToCurrentCart();
|
|
16
16
|
const { data: cartLines, isLoading: isLoadingCartLines } = useFetchCurrentCartLines();
|
|
17
17
|
const { isPending: isPendingDeleteCartLine, mutate: deleteCartLine } = useDeleteCartLineById();
|
|
18
|
-
const { mutate: updateCartLine } =
|
|
18
|
+
const { mutate: updateCartLine } = usePatchCartLineById();
|
|
19
19
|
const { addToast } = useToast();
|
|
20
20
|
const { onCartLineAdded, onCartLineError, onCartLineRemoved, onCartLineUpdated, } = useCartEvents() || {};
|
|
21
21
|
const cartLine = cartLines?.find(line => line.productId === productId);
|
|
@@ -6,6 +6,7 @@ export interface ButtonProps {
|
|
|
6
6
|
color?: 'primary' | 'secondary';
|
|
7
7
|
condensed?: boolean;
|
|
8
8
|
'data-test-selector'?: string;
|
|
9
|
+
form?: string;
|
|
9
10
|
icon?: React.ReactNode;
|
|
10
11
|
iconPosition?: 'left' | 'right';
|
|
11
12
|
isDisabled?: boolean;
|
|
@@ -16,4 +17,4 @@ export interface ButtonProps {
|
|
|
16
17
|
variant?: 'solid' | 'outline' | 'ghost';
|
|
17
18
|
withArrow?: boolean;
|
|
18
19
|
}
|
|
19
|
-
export declare function Button({ _pseudo, children, className, color, condensed, 'data-test-selector': dataTestSelector, icon, iconPosition, isDisabled, isLoading, onClick: _onClick, size, type, variant, withArrow, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export declare function Button({ _pseudo, children, className, color, condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition, isDisabled, isLoading, onClick: _onClick, size, type, variant, withArrow, }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { ProgressCircle } from '../../loading/progress-circle.js';
|
|
|
6
6
|
import { GlyphsArrowBoldCapsRightIcon } from '../../icons/glyph/glyphs-arrow-boldcaps-right-icon.js';
|
|
7
7
|
import buttonStyles from './button.module.css.js';
|
|
8
8
|
|
|
9
|
-
function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, icon, iconPosition = 'left', isDisabled, isLoading = false, onClick: _onClick, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
|
|
9
|
+
function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, 'data-test-selector': dataTestSelector, form, icon, iconPosition = 'left', isDisabled, isLoading = false, onClick: _onClick, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
|
|
10
10
|
const showIconOnLeft = icon && iconPosition === 'left';
|
|
11
11
|
const showIconOnRight = icon && iconPosition === 'right';
|
|
12
12
|
const onClick = (e) => {
|
|
@@ -20,7 +20,7 @@ function Button({ _pseudo = 'none', children, className, color = 'primary', cond
|
|
|
20
20
|
return (jsx("button", { className: clsx({ [buttonStyles.condensed]: condensed }, { [buttonStyles.icon]: icon }, { [buttonStyles['loading-uninformative']]: isLoading === true }, {
|
|
21
21
|
[buttonStyles['loading-informative']]: isLoading &&
|
|
22
22
|
(typeof isLoading === 'string' || isValidElement(isLoading)),
|
|
23
|
-
}, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, onClick: onClick, type: type, children: jsxs(Fragment, { children: [showIconOnLeft && jsx("span", { className: buttonStyles.icon, children: icon }), jsx("span", { className: buttonStyles.children, children: isLoading ? (isLoading === true ? children : isLoading) : children }), withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && jsx("span", { className: buttonStyles.icon, children: icon }), isLoading && (jsx(ProgressCircle, { className: buttonStyles.spinner, size: "sm", variant: color === 'primary' ? 'white' : 'gray' }))] }) }));
|
|
23
|
+
}, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), "data-disabled": isDisabled ? true : undefined, "data-test-selector": dataTestSelector, disabled: isDisabled, form: form, onClick: onClick, type: type, children: jsxs(Fragment, { children: [showIconOnLeft && jsx("span", { className: buttonStyles.icon, children: icon }), jsx("span", { className: buttonStyles.children, children: isLoading ? (isLoading === true ? children : isLoading) : children }), withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && jsx("span", { className: buttonStyles.icon, children: icon }), isLoading && (jsx(ProgressCircle, { className: buttonStyles.spinner, size: "sm", variant: color === 'primary' ? 'white' : 'gray' }))] }) }));
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export { Button };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var buttonStyles = {"button":"button-module-V4meK","icon":"button-module-XaNWz","loading-uninformative":"button-module-LwuW2","loading-informative":"button-module-U5IxM","spinner":"button-module-13ndF","children":"button-module-vqRq-","primary":"button-module-tmyk8","secondary":"button-module--1bCH","sm":"button-module-Pbwz7","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe"
|
|
1
|
+
var buttonStyles = {"button":"button-module-V4meK","icon":"button-module-XaNWz","loading-uninformative":"button-module-LwuW2","loading-informative":"button-module-U5IxM","spinner":"button-module-13ndF","children":"button-module-vqRq-","right-arrow-icon":"button-module-ydQAo","primary":"button-module-tmyk8","secondary":"button-module--1bCH","sm":"button-module-Pbwz7","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe"};
|
|
2
2
|
|
|
3
3
|
export { buttonStyles as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
2
|
import Dropin from '@adyen/adyen-web/dist/types/components/Dropin';
|
|
3
|
-
import { AdyenPaymentModel } from 'shared/api/storefront/model/
|
|
3
|
+
import { AdyenPaymentModel } from 'shared/api/storefront/model/storefront.model';
|
|
4
4
|
import '@adyen/adyen-web/dist/adyen.css';
|
|
5
5
|
interface AdyenPaymentProps {
|
|
6
6
|
amount: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CartModel } from '../shared/api/storefront/model/
|
|
1
|
+
import { CartModel } from '../shared/api/storefront/model/storefront.model';
|
|
2
2
|
export declare function PaymentDetails({ cart, onCartChanged, }: {
|
|
3
3
|
cart: CartModel;
|
|
4
4
|
onCartChanged: (cart: CartModel) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdyenPaymentModel, CartModel } from '../shared/api/storefront/model/
|
|
1
|
+
import { AdyenPaymentModel, CartModel } from '../shared/api/storefront/model/storefront.model';
|
|
2
2
|
export declare function Payment({ cart: _cart, onError, onPaymentComplete, }: {
|
|
3
3
|
cart: CartModel;
|
|
4
4
|
onError: (error: unknown, result: AdyenPaymentModel) => void;
|
package/dist/checkout/payment.js
CHANGED
|
@@ -10,7 +10,7 @@ import { AdyenPayment } from './adyen-payment.js';
|
|
|
10
10
|
import { PaymentDetails } from './payment-details.js';
|
|
11
11
|
|
|
12
12
|
function Payment({ cart: _cart, onError, onPaymentComplete, }) {
|
|
13
|
-
const patchCart = usePatchCart();
|
|
13
|
+
const { mutate: patchCart } = usePatchCart();
|
|
14
14
|
const placeOrder = usePlaceOrder();
|
|
15
15
|
const dropinRef = useRef(null);
|
|
16
16
|
const cartRef = useRef(_cart);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CountryModel } from '../../shared/api/storefront/model/storefront.model';
|
|
2
|
+
import { Country } from '../../shared/model/countries-languages';
|
|
3
|
+
interface CountrySelectProps<T extends Country | CountryModel> {
|
|
4
|
+
countries: T[];
|
|
5
|
+
'data-test-selector'?: string;
|
|
6
|
+
isRequired?: boolean;
|
|
7
|
+
name?: string;
|
|
8
|
+
showLabel?: boolean;
|
|
9
|
+
}
|
|
10
|
+
interface CountrySelectPropsWithSelectedCountry<T extends Country | CountryModel> extends CountrySelectProps<T> {
|
|
11
|
+
onCountryChange?: (country: T) => void;
|
|
12
|
+
selectedCountry: T;
|
|
13
|
+
}
|
|
14
|
+
interface CountrySelectPropsWithoutSelectedCountry<T extends Country | CountryModel> extends CountrySelectProps<T> {
|
|
15
|
+
onCountryChange?: (country: T | undefined) => void;
|
|
16
|
+
selectedCountry?: T | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare function CountrySelect<T extends Country | CountryModel>(props: CountrySelectPropsWithSelectedCountry<T>): JSX.Element;
|
|
19
|
+
export declare function CountrySelect<T extends Country | CountryModel>(props: CountrySelectPropsWithoutSelectedCountry<T>): JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Select } from '../../forms/select/select.js';
|
|
4
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
5
|
+
|
|
6
|
+
function CountrySelect({ countries, 'data-test-selector': dataTestSelector, isRequired, name, onCountryChange, selectedCountry, showLabel = true, }) {
|
|
7
|
+
const t = useFormattedMessage();
|
|
8
|
+
const countryOptions = useMemo(() => countries.reduce((acc, country) => ({
|
|
9
|
+
...acc,
|
|
10
|
+
[country.id]: t(`clSelector.${country.abbreviation}`),
|
|
11
|
+
}), {}),
|
|
12
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
13
|
+
[countries]);
|
|
14
|
+
return (jsx(Select, { "data-test-selector": dataTestSelector, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, selectedOption: selectedCountry?.id, showLabel: showLabel, showPlaceholder: false, variant: "solid" }));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { CountrySelect };
|
|
@@ -6,18 +6,13 @@ import { Select } from '../../forms/select/select.js';
|
|
|
6
6
|
import { FormattedMessage } from '../../intl/formatted-message.js';
|
|
7
7
|
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
8
8
|
import { Dialog } from '../../modals/dialog/dialog.js';
|
|
9
|
+
import { CountrySelect } from '../country-select/country-select.js';
|
|
9
10
|
import styles from './country-selector-dialog.module.css.js';
|
|
10
11
|
|
|
11
12
|
function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange, onSubmit, selectedCountry, selectedLanguage, showCountry = true, }) {
|
|
12
13
|
const t = useFormattedMessage();
|
|
13
14
|
const [currentCountry, setCurrentCountry] = useState(selectedCountry);
|
|
14
15
|
const [currentLanguage, setCurrentLanguage] = useState(selectedLanguage);
|
|
15
|
-
const countryOptions = useMemo(() => countries.reduce((acc, country) => ({
|
|
16
|
-
...acc,
|
|
17
|
-
[country.id]: t(`clSelector.${country.abbreviation}`),
|
|
18
|
-
}), {}),
|
|
19
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20
|
-
[countries]);
|
|
21
16
|
const languageOptions = useMemo(() => currentCountry.languages.reduce((acc, language) => ({ ...acc, [language.id]: language.description }), {}), [currentCountry]);
|
|
22
17
|
useEffect(() => {
|
|
23
18
|
if (currentCountry.languages.some(language => language.id === currentLanguage.id))
|
|
@@ -35,8 +30,7 @@ function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange,
|
|
|
35
30
|
onSubmit({ country: currentCountry, language: currentLanguage });
|
|
36
31
|
e.preventDefault();
|
|
37
32
|
e.stopPropagation();
|
|
38
|
-
}, shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(
|
|
39
|
-
currentCountry), options: countryOptions, selectedOption: currentCountry.id, showPlaceholder: false, variant: "solid" })), jsx(Select, { "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
|
|
33
|
+
}, shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(CountrySelect, { countries: countries, "data-test-selector": "clSelector_country", onCountryChange: setCurrentCountry, selectedCountry: currentCountry })), jsx(Select, { "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
export { CountrySelectorDialog };
|
package/dist/exports.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './address/address';
|
|
1
2
|
export * from './algolia/algolia-active-categories';
|
|
2
3
|
export * from './algolia/algolia-active-filters';
|
|
3
4
|
export * from './algolia/algolia-categories-filters';
|
|
@@ -64,6 +65,7 @@ export * from './collapsables/accordion/accordion-item';
|
|
|
64
65
|
export * from './collapsables/show-all/show-all';
|
|
65
66
|
export * from './config';
|
|
66
67
|
export * from './country-selector/connected-country-selector';
|
|
68
|
+
export * from './country-selector/country-select/country-select';
|
|
67
69
|
export * from './country-selector/country-selector-dialog/country-selector-dialog';
|
|
68
70
|
export * from './country-selector/country-selector-trigger/country-selector-trigger';
|
|
69
71
|
export * from './country-selector/use-countries-languages';
|
|
@@ -110,6 +112,7 @@ export * from './header/cart-icon/connected-cart-icon';
|
|
|
110
112
|
export * from './intl/formatted-message';
|
|
111
113
|
export * from './intl/intl-context';
|
|
112
114
|
export * from './intl/intl-provider';
|
|
115
|
+
export * from './intl/missing-translation-provider';
|
|
113
116
|
export * from './intl/translation-id';
|
|
114
117
|
export * from './intl/types';
|
|
115
118
|
export * from './intl/use-culture-code';
|
|
@@ -160,6 +163,9 @@ export * from './pages/product-listing-page/product-listing-product-overview/pro
|
|
|
160
163
|
export * from './pages/search-result-page/search-result-product-overview/search-result-product-overview';
|
|
161
164
|
export * from './pages/search-result-page/search-results-page';
|
|
162
165
|
export * from './pages/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel';
|
|
166
|
+
export * from './pages/shipping-page/components/edit-address';
|
|
167
|
+
export * from './pages/shipping-page/components/readonly-address';
|
|
168
|
+
export * from './pages/shipping-page/shipping-page';
|
|
163
169
|
export * from './promos/promo-banner/promo-banner';
|
|
164
170
|
export * from './promos/promo-banners/promo-banners';
|
|
165
171
|
export * from './promos/promo-card/promo-card';
|
|
@@ -167,6 +173,7 @@ export * from './shared/api/bff/hooks/use-fetch-announcements';
|
|
|
167
173
|
export * from './shared/api/bff/hooks/use-fetch-product-details-page-data';
|
|
168
174
|
export * from './shared/api/bff/hooks/use-fetch-product-listing-page-data';
|
|
169
175
|
export * from './shared/api/bff/services/bff-service';
|
|
176
|
+
export * from './shared/api/shared/hooks/use-awaitable-mutation';
|
|
170
177
|
export * from './shared/api/storefront/hooks/authentication/use-create-guest-account';
|
|
171
178
|
export * from './shared/api/storefront/hooks/authentication/use-fetch-session';
|
|
172
179
|
export * from './shared/api/storefront/hooks/authentication/use-invalidate-session';
|
|
@@ -187,12 +194,12 @@ export * from './shared/api/storefront/hooks/cart/use-fetch-current-cart-promoti
|
|
|
187
194
|
export * from './shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp';
|
|
188
195
|
export * from './shared/api/storefront/hooks/cart/use-invalidate-current-cart';
|
|
189
196
|
export * from './shared/api/storefront/hooks/cart/use-patch-cart';
|
|
197
|
+
export * from './shared/api/storefront/hooks/cart/use-patch-cart-line-by-id';
|
|
190
198
|
export * from './shared/api/storefront/hooks/cart/use-place-order';
|
|
191
199
|
export * from './shared/api/storefront/hooks/cart/use-save-cart-for-later';
|
|
192
|
-
export * from './shared/api/storefront/hooks/cart/use-update-cart-line-by-id';
|
|
193
200
|
export * from './shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses';
|
|
194
201
|
export * from './shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses';
|
|
195
|
-
export * from './shared/api/storefront/hooks/customer/use-
|
|
202
|
+
export * from './shared/api/storefront/hooks/customer/use-patch-bill-to-address';
|
|
196
203
|
export * from './shared/api/storefront/hooks/payment/use-create-adyen-session';
|
|
197
204
|
export * from './shared/api/storefront/hooks/payment/use-fetch-adyen-config';
|
|
198
205
|
export * from './shared/api/storefront/hooks/payment/use-invalidate-adyen';
|
|
@@ -259,6 +266,7 @@ export * from './shared/utils/event-emitter';
|
|
|
259
266
|
export * from './shared/utils/merge';
|
|
260
267
|
export * from './shared/utils/price';
|
|
261
268
|
export * from './shared/utils/random';
|
|
269
|
+
export * from './shared/utils/string';
|
|
262
270
|
export * from './shared/utils/time';
|
|
263
271
|
export * from './shared/utils/uuid';
|
|
264
272
|
export * from './shared/utils/wait';
|
|
@@ -20,6 +20,7 @@ interface TextFieldProps {
|
|
|
20
20
|
rows?: number;
|
|
21
21
|
showLabel?: boolean;
|
|
22
22
|
size?: 'md' | 'lg';
|
|
23
|
+
type?: 'text' | 'email' | 'password';
|
|
23
24
|
validate?: ValidateFunction<string>;
|
|
24
25
|
value?: string;
|
|
25
26
|
}
|
|
@@ -28,5 +29,5 @@ interface TextFieldProps {
|
|
|
28
29
|
* It can be used as a single line input or as a textarea.
|
|
29
30
|
* This field can also grow when a user types in text.
|
|
30
31
|
*/
|
|
31
|
-
export declare function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel, size, validate, value, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel, size, type, validate, value, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
32
33
|
export {};
|
|
@@ -13,10 +13,10 @@ import styles from './text-field.module.css.js';
|
|
|
13
13
|
* It can be used as a single line input or as a textarea.
|
|
14
14
|
* This field can also grow when a user types in text.
|
|
15
15
|
*/
|
|
16
|
-
function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', validate, value, }) {
|
|
16
|
+
function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, minLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', type = 'text', validate, value, }) {
|
|
17
17
|
return (jsxs(TextField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles.field, styles[size]), defaultValue: defaultValue, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxLength: maxLength, minLength: minLength, name: name, onChange: value => {
|
|
18
18
|
onChange?.(value);
|
|
19
|
-
}, onInput: onInput, onKeyUp: e => onKeyUp?.(e), validate: validate, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, label: label, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, label: label, placeholder: placeholder, size: size })), jsx(FieldError, {})] }));
|
|
19
|
+
}, onInput: onInput, onKeyUp: e => onKeyUp?.(e), validate: validate, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, label: label, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, label: label, placeholder: placeholder, size: size, type: type })), jsx(FieldError, {}, Math.random())] }));
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export { TextField };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './shared/utils/local-storage';
|
|
2
2
|
import './tokens/index.css';
|
|
3
3
|
export * as BffModel from './shared/api/bff/model/bff.model';
|
|
4
|
-
export * as
|
|
4
|
+
export * as StorefrontModel from './shared/api/storefront/model/storefront.model';
|
|
5
5
|
export * from './exports';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import './shared/utils/local-storage.js';
|
|
2
2
|
import * as bff_model from './shared/api/bff/model/bff.model.js';
|
|
3
3
|
export { bff_model as BffModel };
|
|
4
|
-
import * as
|
|
5
|
-
export {
|
|
4
|
+
import * as storefront_model from './shared/api/storefront/model/storefront.model.js';
|
|
5
|
+
export { storefront_model as StorefrontModel };
|
|
6
|
+
export { Address } from './address/address.js';
|
|
6
7
|
export { AlgoliaActiveCategories } from './algolia/algolia-active-categories.js';
|
|
7
8
|
export { AlgoliaActiveFilters } from './algolia/algolia-active-filters.js';
|
|
8
9
|
export { AlgoliaCategoriesFilters } from './algolia/algolia-categories-filters.js';
|
|
@@ -69,6 +70,7 @@ export { AccordionItem } from './collapsables/accordion/accordion-item.js';
|
|
|
69
70
|
export { ShowAll } from './collapsables/show-all/show-all.js';
|
|
70
71
|
export { config, configPerEnvironment } from './config.js';
|
|
71
72
|
export { ConnectedCountrySelector } from './country-selector/connected-country-selector.js';
|
|
73
|
+
export { CountrySelect } from './country-selector/country-select/country-select.js';
|
|
72
74
|
export { CountrySelectorDialog } from './country-selector/country-selector-dialog/country-selector-dialog.js';
|
|
73
75
|
export { CountrySelectorTrigger } from './country-selector/country-selector-trigger/country-selector-trigger.js';
|
|
74
76
|
export { useCountriesLanguages } from './country-selector/use-countries-languages.js';
|
|
@@ -114,6 +116,7 @@ export { ConnectedCartIcon } from './header/cart-icon/connected-cart-icon.js';
|
|
|
114
116
|
export { FormattedMessage } from './intl/formatted-message.js';
|
|
115
117
|
export { IntlContext } from './intl/intl-context.js';
|
|
116
118
|
export { IntlProvider } from './intl/intl-provider.js';
|
|
119
|
+
export { MissingTranslationProvider } from './intl/missing-translation-provider.js';
|
|
117
120
|
export { isCountryCode, isCultureCode, isLanguageCode } from './intl/types.js';
|
|
118
121
|
export { useCultureCode, useUpdateCultureCode } from './intl/use-culture-code.js';
|
|
119
122
|
export { useFormattedMessage } from './intl/use-formatted-message.js';
|
|
@@ -162,6 +165,9 @@ export { ProductListingProductOverview } from './pages/product-listing-page/prod
|
|
|
162
165
|
export { SearchResultProductOverview } from './pages/search-result-page/search-result-product-overview/search-result-product-overview.js';
|
|
163
166
|
export { SearchResultsPage } from './pages/search-result-page/search-results-page.js';
|
|
164
167
|
export { SearchResultsPageCategoryCarousel } from './pages/search-result-page/search-results-page-category-carousel/search-results-page-category-carousel.js';
|
|
168
|
+
export { EDIT_ADDRESS_FORM_ID, EditAddresses } from './pages/shipping-page/components/edit-address.js';
|
|
169
|
+
export { ReadOnlyAddresses } from './pages/shipping-page/components/readonly-address.js';
|
|
170
|
+
export { ShippingPage } from './pages/shipping-page/shipping-page.js';
|
|
165
171
|
export { PromoBanner } from './promos/promo-banner/promo-banner.js';
|
|
166
172
|
export { PromoBanners } from './promos/promo-banners/promo-banners.js';
|
|
167
173
|
export { PromoCard } from './promos/promo-card/promo-card.js';
|
|
@@ -169,6 +175,7 @@ export { useFetchAnnouncements } from './shared/api/bff/hooks/use-fetch-announce
|
|
|
169
175
|
export { useFetchProductDetailsPageData } from './shared/api/bff/hooks/use-fetch-product-details-page-data.js';
|
|
170
176
|
export { useFetchProductListingPageData } from './shared/api/bff/hooks/use-fetch-product-listing-page-data.js';
|
|
171
177
|
export { fetchAnnouncements, fetchProductDetailsPageData, fetchProductListingPageData } from './shared/api/bff/services/bff-service.js';
|
|
178
|
+
export { useAwaitableMutation } from './shared/api/shared/hooks/use-awaitable-mutation.js';
|
|
172
179
|
export { useCreateGuestAccount } from './shared/api/storefront/hooks/authentication/use-create-guest-account.js';
|
|
173
180
|
export { useFetchSession } from './shared/api/storefront/hooks/authentication/use-fetch-session.js';
|
|
174
181
|
export { useInvalidateSession } from './shared/api/storefront/hooks/authentication/use-invalidate-session.js';
|
|
@@ -189,12 +196,12 @@ export { useFetchCurrentCartPromotions } from './shared/api/storefront/hooks/car
|
|
|
189
196
|
export { useFetchCurrentCartWithAtp } from './shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js';
|
|
190
197
|
export { useInvalidateCurrentCart } from './shared/api/storefront/hooks/cart/use-invalidate-current-cart.js';
|
|
191
198
|
export { usePatchCart } from './shared/api/storefront/hooks/cart/use-patch-cart.js';
|
|
199
|
+
export { usePatchCartLineById } from './shared/api/storefront/hooks/cart/use-patch-cart-line-by-id.js';
|
|
192
200
|
export { usePlaceOrder } from './shared/api/storefront/hooks/cart/use-place-order.js';
|
|
193
201
|
export { useSaveCartForLater } from './shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
|
|
194
|
-
export { useUpdateCartLineById } from './shared/api/storefront/hooks/cart/use-update-cart-line-by-id.js';
|
|
195
202
|
export { useFetchBillToAddresses } from './shared/api/storefront/hooks/customer/use-fetch-bill-to-addresses.js';
|
|
196
203
|
export { useFetchShipToAddresses } from './shared/api/storefront/hooks/customer/use-fetch-ship-to-addresses.js';
|
|
197
|
-
export {
|
|
204
|
+
export { usePatchBillToAddress } from './shared/api/storefront/hooks/customer/use-patch-bill-to-address.js';
|
|
198
205
|
export { useCreateAdyenSession } from './shared/api/storefront/hooks/payment/use-create-adyen-session.js';
|
|
199
206
|
export { useFetchAdyenConfig } from './shared/api/storefront/hooks/payment/use-fetch-adyen-config.js';
|
|
200
207
|
export { useInvalidateAdyen } from './shared/api/storefront/hooks/payment/use-invalidate-adyen.js';
|
|
@@ -211,8 +218,8 @@ export { useDeleteWishListItemFromWishList } from './shared/api/storefront/hooks
|
|
|
211
218
|
export { useFetchAllWishListsItems } from './shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.js';
|
|
212
219
|
export { useFetchWishLists } from './shared/api/storefront/hooks/wishlist/use-fetch-wishlists.js';
|
|
213
220
|
export { createGuestAccount, createSession, fetchSession, patchSession, signIn, signOut } from './shared/api/storefront/services/authentication-service.js';
|
|
214
|
-
export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCart, placeOrder, postAdyenPayment, saveCartForLater
|
|
215
|
-
export { fetchBillToAddresses, fetchShipToAddresses,
|
|
221
|
+
export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCart, patchCartLineById, placeOrder, postAdyenPayment, saveCartForLater } from './shared/api/storefront/services/cart-service.js';
|
|
222
|
+
export { fetchBillToAddresses, fetchShipToAddresses, patchBillToAddress } from './shared/api/storefront/services/customer-service.js';
|
|
216
223
|
export { createAdyenSession, fetchAdyenConfig } from './shared/api/storefront/services/payment-service.js';
|
|
217
224
|
export { fetchTranslations } from './shared/api/storefront/services/translation-service.js';
|
|
218
225
|
export { fetchCountries, fetchCountriesLanguages, fetchCountriesWithLanguages, fetchSettings, updateLocale } from './shared/api/storefront/services/website-service.js';
|
|
@@ -259,6 +266,7 @@ export { EventEmitter } from './shared/utils/event-emitter.js';
|
|
|
259
266
|
export { clone, deepMerge, isPlainObject, default as main, merge } from './shared/utils/merge.js';
|
|
260
267
|
export { currencies, formatPrice, getCurrencyByCountryCode } from './shared/utils/price.js';
|
|
261
268
|
export { random, randomInt } from './shared/utils/random.js';
|
|
269
|
+
export { capitalizeFirstLetter } from './shared/utils/string.js';
|
|
262
270
|
export { TIME } from './shared/utils/time.js';
|
|
263
271
|
export { createUUID } from './shared/utils/uuid.js';
|
|
264
272
|
export { wait } from './shared/utils/wait.js';
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
1
|
import { FormattedMessageProps } from './types';
|
|
3
|
-
export declare const FormattedMessage:
|
|
2
|
+
export declare const FormattedMessage: ({ fallbackValue, id, optional, replacementValues, }: FormattedMessageProps) => string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
interface MissingTranslationProviderProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare function MissingTranslationProvider({ children, }: MissingTranslationProviderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, useCallback } from 'react';
|
|
3
|
+
import { useFetchTranslations } from '../shared/api/storefront/hooks/translation/use-fetch-translations.js';
|
|
4
|
+
import { useFeatureFlags } from '../shared/feature-flags/use-feature-flags.js';
|
|
5
|
+
import { IntlContext } from './intl-context.js';
|
|
6
|
+
import { getLanguageCodeFromCultureCode } from './utils.js';
|
|
7
|
+
|
|
8
|
+
function MissingTranslationProvider({ children, }) {
|
|
9
|
+
const { missing, translations: showTranslations } = useFeatureFlags();
|
|
10
|
+
const intlProps = useContext(IntlContext);
|
|
11
|
+
const { data: translations, isLoading } = useFetchTranslations(getLanguageCodeFromCultureCode(intlProps.cultureCode), { enabled: missing });
|
|
12
|
+
const formattedMessage = useCallback((id, options) => {
|
|
13
|
+
const message = intlProps.formattedMessage(id, options);
|
|
14
|
+
if (!missing && !showTranslations)
|
|
15
|
+
return message;
|
|
16
|
+
if (missing && !translations?.[id])
|
|
17
|
+
return `❗️${message}❗️`;
|
|
18
|
+
return showTranslations ? `⭐️${message}⭐️` : message;
|
|
19
|
+
}, [intlProps, missing, showTranslations, translations]);
|
|
20
|
+
if (!missing && !showTranslations)
|
|
21
|
+
return jsx(Fragment, { children: children });
|
|
22
|
+
if (missing && (isLoading || !translations))
|
|
23
|
+
return null;
|
|
24
|
+
return (jsx(IntlContext.Provider, { value: {
|
|
25
|
+
...intlProps,
|
|
26
|
+
formattedMessage,
|
|
27
|
+
}, children: children }));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { MissingTranslationProvider };
|
|
@@ -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.' | 'Add to list' | 'Amount: {0}' | 'An unexpected error occured' | '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?' | 'Cancel' | 'Cart' | 'Chosen filters' | 'Clear filters' | 'Clear' | 'Click the button below to continue shopping.' | 'Continue shopping' | 'Continue' | 'Cost overview' | 'Country' | 'Create new list' | 'Delivery expected in {0} {1}' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'Features' | 'Fulfillment method' | 'Hide filters' | 'Incl. VAT' | 'Includes' | 'Language' | 'List name already exists' | 'New list name' | 'Order number' | 'PO Number' | 'Please Sign In' | 'Popular searches' | 'Print' | 'Product Features' | 'Product' | 'Products' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Remove all' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Searching again using more general terms' | 'See all results' | 'Select a list' | 'Share your favorite list with others' | 'Shipping and handling' | 'Shop more efficiently and quicker with a favorites list' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'Specifications' | 'Submit' | 'Subtotal' | 'Suggestions' | '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 no products in your shopping cart.' | '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.' | 'Use fewer keywords' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You must ' | 'Your cart has been emptied.' | 'Your favorites are available on multiple devices' | 'Your shopping cart is still empty' | 'article' | 'articles' | 'create account' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'of' | 'pc' | 'sign in' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'tag.limited' | 'tag.new' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing';
|
|
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.' | 'Add to list' | 'Add order notes' | 'Address' | 'Amount: {0}' | 'An unexpected error occured' | '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?' | 'Attention' | 'Billing address' | 'Cancel' | 'Cart' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Chosen filters' | 'City' | 'Clear filters' | 'Clear' | 'Click the button below to continue shopping.' | 'Company name' | 'Continue shopping' | 'Continue' | 'Cost overview' | 'Country' | 'Create new list' | 'Delivery expected in {0} {1}' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Email' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'Features' | 'First name' | 'Fulfillment method' | 'Hide filters' | 'Home' | 'Incl. VAT' | 'Includes' | 'Language' | 'Last name' | 'List name already exists' | 'New list name' | 'Order number' | 'PO Number' | 'Phone' | 'Please Sign In' | 'Popular searches' | 'Postal Code' | 'Print' | 'Product Features' | 'Product' | 'Products' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Remove all' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Searching again using more general terms' | 'See all results' | 'Select a list' | 'Share your favorite list with others' | 'Shipping and handling' | 'Shop more efficiently and quicker with a favorites list' | 'Shipping details' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'Specifications' | 'Submit' | 'Subtotal' | 'Suggestions' | '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 no products in your shopping cart.' | 'Unable to add the product to your cart.' | 'Unable to update the product in your cart.' | 'Unable to remove the product from your cart.' | 'Unable to empty your cart.' | 'Unable to save cart for later.' | 'Use billing address' | 'Try another search' | 'Total' | '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.' | 'Use fewer keywords' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You must ' | 'Your cart has been emptied.' | 'Your favorites are available on multiple devices' | 'Your shopping cart is still empty' | 'article' | 'articles' | 'create account' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'of' | 'pc' | 'Shipping address' | 'sign in' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'tag.limited' | 'tag.new' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing';
|
|
@@ -14,7 +14,7 @@ function SignInDialog({ isOpen, onOpenChange }) {
|
|
|
14
14
|
const { signInUrl } = useFavorite();
|
|
15
15
|
const t = useFormattedMessage();
|
|
16
16
|
const location = getLocation();
|
|
17
|
-
if (!location)
|
|
17
|
+
if (!location || !isOpen)
|
|
18
18
|
return null;
|
|
19
19
|
return (jsx(Dialog, { isDismissable: true, className: { dialog: styles['sign-in-dialog'] }, footer: jsxs(Fragment, { children: [jsx(RouteButton, { withArrow: true, color: "primary", href: `${signInUrl}?returnUrl=${encodeURIComponent(location.pathname + location.search)}`, onClick: () => onOpenChange(false), variant: "solid", children: jsx(FormattedMessage, { id: "sign in" }) }), jsx(RouteButton, { color: "secondary", href: `${signInUrl}?returnUrl=${encodeURIComponent(location.pathname + location.search)}`, onClick: () => onOpenChange(false), variant: "outline", children: jsx(FormattedMessage, { id: "create account" }) })] }), isOpen: isOpen, onOpenChange: onOpenChange, title: t('Shop more efficiently and quicker with a favorites list'), children: jsxs(List, { children: [jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Easily add your favorite products') }), jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Your favorites are available on multiple devices') }), jsx(ListItem, { icon: jsx(SolidOkayIcon, { fill: "var(--color-status-available)" }), text: t('Share your favorite list with others') })] }) }));
|
|
20
20
|
}
|
|
@@ -5,7 +5,7 @@ export interface CheckoutPageLayoutProps {
|
|
|
5
5
|
secondary?: ReactNode;
|
|
6
6
|
};
|
|
7
7
|
children: ReactNode;
|
|
8
|
-
mobileSummary
|
|
8
|
+
mobileSummary?: ReactNode;
|
|
9
9
|
overview: ReactNode;
|
|
10
10
|
}
|
|
11
11
|
export declare function CheckoutPageLayout({ actions, children, mobileSummary, overview, }: CheckoutPageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CountryModel } from '../../../shared/api/storefront/model/storefront.model';
|
|
2
|
+
export declare const EDIT_ADDRESS_FORM_ID = "billToForm";
|
|
3
|
+
interface Address {
|
|
4
|
+
address1: string;
|
|
5
|
+
address2: string;
|
|
6
|
+
address3: string;
|
|
7
|
+
attention: string;
|
|
8
|
+
city: string;
|
|
9
|
+
companyName: string;
|
|
10
|
+
country: CountryModel;
|
|
11
|
+
firstName: string;
|
|
12
|
+
lastName: string;
|
|
13
|
+
phone: string;
|
|
14
|
+
postalCode: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function EditAddresses({ countries, isLoading, onSubmit, }: {
|
|
17
|
+
countries: CountryModel[];
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
onSubmit: (event: {
|
|
20
|
+
address: Address;
|
|
21
|
+
notes: string;
|
|
22
|
+
}) => void;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export {};
|