@sonic-equipment/ui 167.0.0 → 169.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/algolia/algolia-sonic-searchclient.d.ts +2 -1
- package/dist/algolia/algolia-sonic-searchclient.js +2 -2
- package/dist/background-overlay/background-overlay-manager.js +6 -0
- package/dist/background-overlay/background-overlay.d.ts +1 -1
- package/dist/base.css +59 -1
- package/dist/buttons/link/link.d.ts +1 -1
- package/dist/buttons/link/link.js +6 -4
- package/dist/cart-totals/cart-totals.js +1 -0
- package/dist/collapsables/accordion/accordion-item.js +3 -2
- package/dist/collapsables/cascading-component/cascading-component-container-context.js +1 -0
- package/dist/collapsables/cascading-component/cascading-component-container-provider.js +1 -0
- package/dist/collapsables/cascading-component/cascading-component-container.js +1 -0
- package/dist/collapsables/cascading-component/cascading-component.js +1 -0
- package/dist/collapsables/unmounter/unmounter.js +1 -0
- package/dist/config.js +12 -11
- package/dist/country-select/country-select.js +1 -0
- package/dist/country-selector/connected-country-selector.d.ts +6 -6
- package/dist/display/price/price.js +1 -0
- package/dist/drawer/drawer.d.ts +3 -2
- package/dist/drawer/drawer.js +15 -3
- package/dist/drawer/drawer.module.css.js +1 -1
- package/dist/drawer/use-drawer.js +1 -6
- package/dist/exports.d.ts +15 -5
- package/dist/footer/connected-footer.d.ts +6 -0
- package/dist/footer/connected-footer.js +13 -0
- package/dist/footer/footer.d.ts +8 -4
- package/dist/footer/footer.js +23 -2
- package/dist/footer/footer.model.d.ts +3 -15
- package/dist/forms/form/form.js +1 -0
- package/dist/forms/text-field/password-reveal-toggle/password-reveal-toggle.js +1 -0
- package/dist/global-search/global-search-provider/global-search-provider.d.ts +0 -6
- package/dist/global-search/global-search-provider/global-search-provider.js +3 -9
- package/dist/global-search/global-search-provider/use-search-disclosure.d.ts +1 -6
- package/dist/global-search/global-search-provider/use-search-disclosure.js +5 -9
- package/dist/global-search/global-search.d.ts +3 -1
- package/dist/global-search/global-search.js +7 -6
- package/dist/header/buttons/account/connected-account-button.d.ts +7 -0
- package/dist/header/buttons/account/connected-account-button.js +14 -0
- package/dist/header/buttons/cart/connected-cart-button.d.ts +7 -0
- package/dist/header/buttons/cart/connected-cart-button.js +14 -0
- package/dist/header/buttons/favorites/connected-favorites-button.d.ts +7 -0
- package/dist/header/buttons/favorites/connected-favorites-button.js +13 -0
- package/dist/header/{hamburger-button → buttons/hamburger}/hamburger-button.d.ts +2 -1
- package/dist/header/buttons/hamburger/hamburger-button.js +13 -0
- package/dist/header/buttons/hamburger/hamburger-button.module.css.js +3 -0
- package/dist/header/buttons/search/search-button.d.ts +7 -0
- package/dist/header/buttons/search/search-button.js +12 -0
- package/dist/header/connected-header.d.ts +5 -0
- package/dist/header/connected-header.js +12 -0
- package/dist/header/drawers/desktop-navigation-drawer.d.ts +8 -0
- package/dist/header/drawers/desktop-navigation-drawer.js +12 -0
- package/dist/header/drawers/desktop-navigation-drawer.module.css.js +3 -0
- package/dist/header/drawers/mobile-navigation-drawer.d.ts +7 -0
- package/dist/header/drawers/mobile-navigation-drawer.js +10 -0
- package/dist/header/drawers/mobile-navigation-drawer.module.css.js +3 -0
- package/dist/header/drawers/search-drawer.d.ts +5 -0
- package/dist/header/drawers/search-drawer.js +9 -0
- package/dist/header/header-layout/header-layout.d.ts +2 -1
- package/dist/header/header-layout/header-layout.js +3 -2
- package/dist/header/header-layout/header-layout.module.css.js +1 -1
- package/dist/header/header.d.ts +4 -2
- package/dist/header/header.js +64 -5
- package/dist/header/header.module.css.js +3 -0
- package/dist/header/link-list/navigation-link-list.d.ts +3 -2
- package/dist/header/link-list/navigation-link-list.js +3 -3
- package/dist/header/link-list/navigation-link-list.module.css.js +1 -1
- package/dist/header/sonic-logo/sonic-logo.d.ts +2 -1
- package/dist/header/sonic-logo/sonic-logo.js +4 -2
- package/dist/index.js +17 -6
- package/dist/intl/missing-translation-provider.js +1 -0
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/lists/menu-list/menu-list-back-button.js +1 -0
- package/dist/lists/menu-list/menu-list-item.d.ts +9 -21
- package/dist/lists/menu-list/menu-list-item.js +3 -8
- package/dist/lists/menu-list/menu-list.js +1 -0
- package/dist/lists/orderline-list/orderline-list.js +2 -2
- package/dist/media/zoom-image/zoom-image.js +1 -0
- package/dist/navigation/account-icon/account-icon.js +1 -0
- package/dist/navigation/cart-icon/cart-icon.js +2 -1
- package/dist/navigation/favorite-icon/favorite-icon.js +1 -0
- package/dist/navigation/mobile-navigation/mobile-navigation.d.ts +6 -3
- package/dist/navigation/mobile-navigation/mobile-navigation.js +8 -3
- package/dist/navigation/mobile-navigation/mobile-navigation.module.css.js +3 -0
- package/dist/navigation/panel-navigation/panel-navigation.d.ts +4 -16
- package/dist/navigation/panel-navigation/panel-navigation.js +5 -5
- package/dist/notifications/announcements/announcement-list.d.ts +7 -0
- package/dist/notifications/announcements/announcement-list.js +26 -0
- package/dist/notifications/announcements/announcement-list.module.css.js +3 -0
- package/dist/notifications/announcements/announcement.d.ts +2 -1
- package/dist/notifications/announcements/announcement.js +7 -3
- package/dist/notifications/announcements/announcement.module.css.js +1 -1
- package/dist/notifications/announcements/connected-announcement-list.d.ts +3 -0
- package/dist/notifications/announcements/connected-announcement-list.js +22 -0
- package/dist/notifications/announcements/use-filter-announcements.d.ts +2 -0
- package/dist/notifications/announcements/use-filter-announcements.js +35 -0
- package/dist/observers/intersection-observer.js +1 -0
- package/dist/pages/account/create-account-page/create-account-page.js +1 -0
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +1 -0
- package/dist/pages/account/sign-in-page/sign-in-page.js +1 -0
- package/dist/pages/checkout/cart-page/cart-page.js +2 -1
- package/dist/pages/checkout/cart-page/components/empty-cart-page.js +1 -0
- package/dist/pages/checkout/components/billing-and-invoice-information.js +1 -0
- package/dist/pages/checkout/layouts/checkout-page-layout/checkout-page-layout.js +2 -1
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +1 -0
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +1 -0
- package/dist/pages/checkout/payment-page/components/adyen-payment.js +1 -0
- package/dist/pages/checkout/payment-page/components/payment.js +1 -0
- package/dist/pages/checkout/payment-page/payment-page-content.js +2 -1
- package/dist/pages/checkout/payment-page/payment-page.js +1 -0
- package/dist/pages/checkout/shipping-page/components/currency-change-dialog.js +1 -0
- package/dist/pages/checkout/shipping-page/components/edit-address-form.js +1 -0
- package/dist/pages/checkout/shipping-page/components/readonly-address.js +1 -0
- package/dist/pages/checkout/shipping-page/components/sonic-address.js +1 -0
- package/dist/pages/checkout/shipping-page/shipping-page-content.js +2 -1
- package/dist/pages/checkout/shipping-page/shipping-page.js +1 -0
- package/dist/pages/components/page-meta-data/page-meta-data.js +4 -0
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +1 -0
- package/dist/shared/api/bff/hooks/use-fetch-navigation-links.d.ts +2 -0
- package/dist/shared/api/bff/hooks/use-fetch-navigation-links.js +15 -0
- package/dist/shared/api/bff/model/bff.model.d.ts +30 -0
- package/dist/shared/api/bff/services/bff-service.d.ts +7 -1
- package/dist/shared/api/bff/services/bff-service.js +8 -1
- package/dist/shared/feature-flags/use-feature-flags.d.ts +1 -0
- package/dist/shared/feature-flags/use-feature-flags.js +1 -0
- package/dist/shared/ga/data-layer.js +4 -3
- package/dist/shared/hooks/use-mutation-observer.d.ts +3 -0
- package/dist/shared/hooks/use-mutation-observer.js +27 -0
- package/dist/shared/hooks/use-resize-observer.js +7 -1
- package/dist/shared/hooks/use-watch-css-property.js +1 -1
- package/dist/shared/routing/route-button.d.ts +1 -1
- package/dist/shared/routing/route-icon-button.d.ts +1 -1
- package/dist/shared/routing/route-link.d.ts +1 -1
- package/dist/shared/routing/with-routing.d.ts +2 -2
- package/dist/shared/routing/with-routing.js +5 -4
- package/dist/shared/utils/css.js +53 -0
- package/dist/styles.css +696 -476
- package/dist/toast/toast-provider.js +1 -0
- package/dist/tooltip/tooltip.js +1 -0
- package/dist/typography/heading/heading.js +1 -0
- package/package.json +1 -1
- package/dist/header/cart-icon/connected-cart-icon.d.ts +0 -3
- package/dist/header/cart-icon/connected-cart-icon.js +0 -14
- package/dist/header/hamburger-button/hamburger-button.js +0 -14
- package/dist/header/hamburger-button/hamburger-button.module.css.js +0 -3
- package/dist/notifications/announcements/announcement-provider.d.ts +0 -1
- package/dist/notifications/announcements/announcement-provider.js +0 -29
- package/dist/notifications/announcements/announcement-provider.module.css.js +0 -3
- package/dist/notifications/announcements/connected-announcement.d.ts +0 -5
- package/dist/notifications/announcements/connected-announcement.js +0 -27
- package/dist/shared/api/bff/model/announcement.model.d.ts +0 -12
- package/dist/shared/model/link.d.ts +0 -15
|
@@ -1,26 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ImageType } from '../../shared/model/image';
|
|
3
|
-
interface
|
|
4
|
-
children: ReactNode | string;
|
|
5
|
-
onClick?: VoidFunction;
|
|
6
|
-
}
|
|
7
|
-
interface MenuListItemNoChildrenProps {
|
|
8
|
-
hasChildren?: false;
|
|
9
|
-
href: string;
|
|
10
|
-
}
|
|
11
|
-
interface MenuListItemWithChildrenProps {
|
|
3
|
+
export interface MenuListItemProps {
|
|
12
4
|
'aria-controls'?: string;
|
|
13
|
-
hasChildren: true;
|
|
14
|
-
isSelected?: boolean;
|
|
15
|
-
}
|
|
16
|
-
interface MenuListItemWithImageProps {
|
|
17
|
-
badge?: never;
|
|
18
|
-
image?: ImageType;
|
|
19
|
-
}
|
|
20
|
-
interface MenuListItemWithBadgeProps {
|
|
21
5
|
badge?: ReactNode;
|
|
22
|
-
|
|
6
|
+
children: ReactNode | string;
|
|
7
|
+
hasChildren?: boolean;
|
|
8
|
+
href?: string;
|
|
9
|
+
image?: ImageType;
|
|
10
|
+
isSelected?: boolean;
|
|
11
|
+
onClick?: VoidFunction;
|
|
12
|
+
openInNewTab?: boolean;
|
|
23
13
|
}
|
|
24
|
-
export
|
|
25
|
-
export declare function MenuListItem(props: MenuListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export {};
|
|
14
|
+
export declare function MenuListItem({ 'aria-controls': ariaControls, badge, children, hasChildren, href, image, isSelected, onClick, openInNewTab, }: MenuListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import clsx from 'clsx';
|
|
3
4
|
import { GlyphsChevronsSlimRightIcon } from '../../icons/glyph/glyphs-chevrons-slim-right-icon.js';
|
|
@@ -6,15 +7,9 @@ import { Image } from '../../media/image/image.js';
|
|
|
6
7
|
import { RouteLink } from '../../shared/routing/route-link.js';
|
|
7
8
|
import styles from './menu-list.module.css.js';
|
|
8
9
|
|
|
9
|
-
function MenuListItem(
|
|
10
|
-
const { children, hasChildren, onClick } = props;
|
|
11
|
-
const href = 'href' in props ? props.href : undefined;
|
|
12
|
-
const isSelected = 'isSelected' in props ? props.isSelected : false;
|
|
13
|
-
const badge = 'badge' in props ? props.badge : undefined;
|
|
14
|
-
const image = 'image' in props ? props.image : undefined;
|
|
15
|
-
const ariaControls = 'aria-controls' in props ? props['aria-controls'] : undefined;
|
|
10
|
+
function MenuListItem({ 'aria-controls': ariaControls, badge, children, hasChildren, href, image, isSelected, onClick, openInNewTab, }) {
|
|
16
11
|
const t = useFormattedMessage();
|
|
17
|
-
return (jsxs("li", { "aria-owns": ariaControls, className: clsx(styles['menu-list-item'], isSelected && styles['selected'], hasChildren && styles['has-children']), children: [image && (jsx("span", { className: styles['image'], role: "presentation", children: jsx(Image, { fit: "contain", image: image, title: "" }) })), badge && jsx("span", { className: styles['badge'], children: badge }), jsx(RouteLink, { "aria-controls": ariaControls, "aria-expanded": ariaControls && isSelected, "aria-haspopup": hasChildren ? 'true' : undefined, className: styles['label'], href: href, onClick: onClick, role: hasChildren ? 'menuitem' : undefined, children: children }), hasChildren && (jsx(GlyphsChevronsSlimRightIcon, { "aria-description": `(${t('Submenu')})`, className: styles['icon'] }))] }));
|
|
12
|
+
return (jsxs("li", { "aria-owns": ariaControls, className: clsx(styles['menu-list-item'], isSelected && styles['selected'], hasChildren && styles['has-children']), children: [image && (jsx("span", { className: styles['image'], role: "presentation", children: jsx(Image, { fit: "contain", image: image, title: "" }) })), badge && jsx("span", { className: styles['badge'], children: badge }), jsx(RouteLink, { "aria-controls": ariaControls, "aria-expanded": ariaControls && isSelected, "aria-haspopup": hasChildren ? 'true' : undefined, className: styles['label'], href: href, onClick: onClick, role: hasChildren ? 'menuitem' : undefined, target: openInNewTab ? '_blank' : undefined, children: children }), hasChildren && (jsx(GlyphsChevronsSlimRightIcon, { "aria-description": `(${t('Submenu')})`, className: styles['icon'] }))] }));
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
export { MenuListItem };
|
|
@@ -19,11 +19,11 @@ function OrderLineList({ children, onRemoveAll }) {
|
|
|
19
19
|
return;
|
|
20
20
|
open();
|
|
21
21
|
}
|
|
22
|
-
return (jsxs(Fragment, { children: [jsxs("
|
|
22
|
+
return (jsxs(Fragment, { children: [jsxs("section", { "aria-labelledby": "orderline-list-count", className: styles['orderline-list'], children: [jsxs("div", { className: styles.header, children: [jsxs("p", { className: styles.count, id: "orderline-list-count", children: [jsx("span", { "data-test-selector": "orderLineListCount", children: count }), ` ${t.pluralize('product', count)}`] }), onRemoveAll && (jsxs(Link, { className: styles['lnk-remove-all'], color: "primary", "data-test-selector": "cartlineHeader_removeAll", onClick: handleRemoveAll, children: [jsx(StrokeTrashIcon, {}), jsx(FormattedMessage, { id: "Remove all" })] }))] }), jsx("ul", { className: styles.items, children:
|
|
23
23
|
// eslint-disable-next-line @eslint-react/no-children-map
|
|
24
24
|
Children.map(children, (child, index) => (
|
|
25
25
|
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
26
|
-
jsx("
|
|
26
|
+
jsx("li", { className: styles.item, children: child }, index))) })] }), onRemoveAll && (jsx(ConfirmationDialog, { isOpen: isOpen, onCancel: close, onConfirm: onRemoveAll, title: t('Are you sure you want to remove all items from your cart?') }))] }));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
export { OrderLineList };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { Badge } from '../../badges/badge/badge.js';
|
|
3
4
|
import { IconWithBadge } from '../../badges/badge/icon-with-badge/icon-with-badge.js';
|
|
@@ -6,7 +7,7 @@ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
|
6
7
|
|
|
7
8
|
function CartIcon({ 'aria-label': ariaLabel, count }) {
|
|
8
9
|
const t = useFormattedMessage();
|
|
9
|
-
return (jsx(IconWithBadge, { "aria-label": ariaLabel, badge: count && count > 0 ? (jsx(Badge, { "aria-label": count && count > 0 ? `(${t('Number of products')})` : undefined, count: count })) : undefined, "data-test-selector": "
|
|
10
|
+
return (jsx(IconWithBadge, { "aria-label": ariaLabel, badge: count && count > 0 ? (jsx(Badge, { "aria-label": count && count > 0 ? `(${t('Number of products')})` : undefined, count: count })) : undefined, "data-test-selector": "cartIcon", icon: jsx(SolidCartIcon, { role: "presentation" }) }));
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
export { CartIcon };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NavigationLink } from '../../shared/api/bff/model/bff.model';
|
|
2
2
|
export interface MobileNavigationProps {
|
|
3
|
-
|
|
3
|
+
id: string;
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
links: NavigationLink[];
|
|
6
|
+
onActiveChange: (isActive: boolean) => void;
|
|
4
7
|
}
|
|
5
|
-
export declare function MobileNavigation({ links }: MobileNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function MobileNavigation({ id, isActive, links, onActiveChange, }: MobileNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { HamburgerButton } from '../../header/buttons/hamburger/hamburger-button.js';
|
|
5
|
+
import { SonicLogo } from '../../header/sonic-logo/sonic-logo.js';
|
|
2
6
|
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
3
7
|
import { MenuList } from '../../lists/menu-list/menu-list.js';
|
|
4
8
|
import { MenuListItem } from '../../lists/menu-list/menu-list-item.js';
|
|
@@ -9,12 +13,13 @@ import { AccountIcon } from '../account-icon/account-icon.js';
|
|
|
9
13
|
import { CartIcon } from '../cart-icon/cart-icon.js';
|
|
10
14
|
import { FavoriteIcon } from '../favorite-icon/favorite-icon.js';
|
|
11
15
|
import { PanelNavigation } from '../panel-navigation/panel-navigation.js';
|
|
16
|
+
import styles from './mobile-navigation.module.css.js';
|
|
12
17
|
|
|
13
|
-
function MobileNavigation({ links }) {
|
|
18
|
+
function MobileNavigation({ id, isActive, links, onActiveChange, }) {
|
|
14
19
|
const t = useFormattedMessage();
|
|
15
20
|
const { data: { isAuthenticated } = {} } = useFetchSession();
|
|
16
21
|
const cartCount = useFetchCurrentCartCount();
|
|
17
|
-
return (jsx(PanelNavigation, { allowBack: true, isNarrow: true, links: links, variant: "primary", children: jsxs(MenuList, { header: t('My Sonic'), scrollable: false, children: [jsx(MenuListItem, { badge: jsx(AccountIcon, { isAuthenticated: isAuthenticated }), href: PATHS.ACCOUNT, children: isAuthenticated ? t('My account') : t('Sign in or create account') }), jsx(MenuListItem, { badge: jsx(FavoriteIcon, {}), href: PATHS.FAVORITES, children: t('Favorites') }), jsx(MenuListItem, { badge: jsx(CartIcon, { count: cartCount }), href: PATHS.CART, children: t('Shopping cart') })] }) }));
|
|
22
|
+
return (jsxs("section", { "aria-label": t('Main menu'), className: clsx(styles['mobile-navigation'], isActive && styles['active']), id: id, children: [jsxs("header", { className: styles['header'], children: [jsx("div", { className: styles['logo'], role: "presentation", children: jsx(SonicLogo, {}) }), jsx("div", { className: styles['hamburger'], children: jsx(HamburgerButton, { "aria-controls": "mobile-navigation", isActive: isActive, onActiveChange: onActiveChange }) })] }), jsx(PanelNavigation, { allowBack: true, className: styles['panels'], isNarrow: true, links: links, variant: "primary", children: jsxs(MenuList, { header: t('My Sonic'), scrollable: false, children: [jsx(MenuListItem, { badge: jsx(AccountIcon, { isAuthenticated: isAuthenticated }), href: PATHS.ACCOUNT, children: isAuthenticated ? t('My account') : t('Sign in or create account') }), jsx(MenuListItem, { badge: jsx(FavoriteIcon, {}), href: PATHS.FAVORITES, children: t('Favorites') }), jsx(MenuListItem, { badge: jsx(CartIcon, { count: cartCount }), href: PATHS.CART, children: t('Shopping cart') })] }) })] }));
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
export { MobileNavigation };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"mobile-navigation":"mobile-navigation-module-rMdS-","header":"mobile-navigation-module-XKb3-","active":"mobile-navigation-module-P0kLz","logo":"mobile-navigation-module-keQoj","hamburger":"mobile-navigation-module-3Z-Sl","panels":"mobile-navigation-module-zDR9Q"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { NavigationLink } from '../../shared/model/link';
|
|
4
|
-
interface NavigationMenuLinkBase extends Omit<NavigationLink, 'external' | 'openInNewTab' | 'type' | 'url' | 'links'> {
|
|
5
|
-
image?: ImageType;
|
|
6
|
-
}
|
|
7
|
-
interface MenuListItemWithChildrenProps {
|
|
8
|
-
links: NavigationMenuLink[];
|
|
9
|
-
url?: string;
|
|
10
|
-
}
|
|
11
|
-
interface MenuListItemWithoutChildrenProps {
|
|
12
|
-
url: string;
|
|
13
|
-
}
|
|
14
|
-
export type NavigationMenuLink = NavigationMenuLinkBase & (MenuListItemWithChildrenProps | MenuListItemWithoutChildrenProps);
|
|
2
|
+
import { NavigationLink } from '../../shared/api/bff/model/bff.model';
|
|
15
3
|
export interface PanelNavigationProps {
|
|
16
4
|
allowBack?: boolean;
|
|
17
5
|
children?: ReactNode;
|
|
@@ -20,9 +8,9 @@ export interface PanelNavigationProps {
|
|
|
20
8
|
href: string;
|
|
21
9
|
title: string;
|
|
22
10
|
};
|
|
11
|
+
id?: string;
|
|
23
12
|
isNarrow?: boolean;
|
|
24
|
-
links?:
|
|
13
|
+
links?: NavigationLink[];
|
|
25
14
|
variant?: 'primary';
|
|
26
15
|
}
|
|
27
|
-
export declare function PanelNavigation({ allowBack, children, className, header, isNarrow, links, variant, }: PanelNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export {};
|
|
16
|
+
export declare function PanelNavigation({ allowBack, children, className, header, id, isNarrow, links, variant, }: PanelNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
|
|
3
4
|
import clsx from 'clsx';
|
|
@@ -36,9 +37,9 @@ const NavigationMenu = forwardRef(({ allowBack, back, children, className, heade
|
|
|
36
37
|
setSelectedNavigationVisible(Boolean(selectedNavigationLink));
|
|
37
38
|
}, [selectedNavigationLink]);
|
|
38
39
|
const t = useFormattedMessage();
|
|
39
|
-
return (jsxs(Fragment, { children: [jsxs("div", { ref: multiRef(ref, menuRef), className: clsx(styles['panel'], isNarrow && styles['narrow'], className), id: id, children: [jsx(MenuList, { back: back, header: header, scrollable: scrollable, variant: variant, children: links?.map(link =>
|
|
40
|
+
return (jsxs(Fragment, { children: [jsxs("div", { ref: multiRef(ref, menuRef), className: clsx(styles['panel'], isNarrow && styles['narrow'], className), id: id, children: [jsx(MenuList, { back: back, header: header, scrollable: scrollable, variant: variant, children: links?.map(link => link.links && link.links.length > 0 ? (jsx(MenuListItem, { hasChildren: true, "aria-controls": `menu-${link.key}`, image: link.image, isSelected: selectedNavigationLink?.key === link.key, onClick: () => setSelectedNavigationLink(selectedNavigationLink?.key === link.key
|
|
40
41
|
? undefined
|
|
41
|
-
: link), children: link.title }, link.key)) : (jsx(MenuListItem, { href: link.url, image: link.image, children: link.title }, link.key))) }), children] }), jsx(CascadingComponent, { isVisible: selectedNavigationVisible, nodeRef: submenuRef, onEntered: onFocus(submenuRef), onExited: onFocus(menuRef), onUnmounted: onUnmounted, children: jsx(NavigationMenu, { ref: submenuRef, allowBack: allowBack, back: allowBack
|
|
42
|
+
: link), children: link.title }, link.key)) : (jsx(MenuListItem, { href: link.url, image: link.image, openInNewTab: link.openInNewTab, children: link.title }, link.key))) }), children] }), jsx(CascadingComponent, { isVisible: selectedNavigationVisible, nodeRef: submenuRef, onEntered: onFocus(submenuRef), onExited: onFocus(menuRef), onUnmounted: onUnmounted, children: jsx(NavigationMenu, { ref: submenuRef, allowBack: allowBack, back: allowBack
|
|
42
43
|
? {
|
|
43
44
|
onClick: () => {
|
|
44
45
|
setSelectedNavigationVisible(false);
|
|
@@ -61,9 +62,8 @@ const NavigationMenu = forwardRef(({ allowBack, back, children, className, heade
|
|
|
61
62
|
: [] }, selectedNavigationLink?.key) })] }));
|
|
62
63
|
});
|
|
63
64
|
NavigationMenu.displayName = 'NavigationMenu';
|
|
64
|
-
function PanelNavigation({ allowBack, children, className, header, isNarrow, links, variant, }) {
|
|
65
|
-
|
|
66
|
-
return (jsx("section", { "aria-label": t('Navigation'), className: clsx(styles['panel-navigation'], className), children: jsx(CascadingComponentContainer, { children: jsx("div", { className: clsx(styles['panels'], isNarrow && styles['narrow']), children: jsx(NavigationMenu, { allowBack: allowBack, className: children ? styles['top-panel'] : undefined, header: header, id: "panel-navigation-first-level", isNarrow: isNarrow, links: links, scrollable: children ? false : undefined, variant: variant, children: children }) }) }) }));
|
|
65
|
+
function PanelNavigation({ allowBack, children, className, header, id, isNarrow, links, variant, }) {
|
|
66
|
+
return (jsx("section", { className: clsx(styles['panel-navigation'], className), id: id, children: jsx(CascadingComponentContainer, { children: jsx("div", { className: clsx(styles['panels'], isNarrow && styles['narrow']), children: jsx(NavigationMenu, { allowBack: allowBack, className: children ? styles['top-panel'] : undefined, header: header, id: "panel-navigation-first-level", isNarrow: isNarrow, links: links, scrollable: children ? false : undefined, variant: variant, children: children }) }) }) }));
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
export { PanelNavigation };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AnnouncementObject } from '../../shared/model/announcement';
|
|
2
|
+
export declare function AnnouncementList({ announcements, className, onDismiss, sticky, }: {
|
|
3
|
+
announcements: AnnouncementObject[];
|
|
4
|
+
className?: string;
|
|
5
|
+
onDismiss?: (id: string) => void;
|
|
6
|
+
sticky?: boolean;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useResizeObserver } from '../../shared/hooks/use-resize-observer.js';
|
|
7
|
+
import { Announcement } from './announcement.js';
|
|
8
|
+
import { useFilterAnnouncements } from './use-filter-announcements.js';
|
|
9
|
+
import styles from './announcement-list.module.css.js';
|
|
10
|
+
|
|
11
|
+
function AnnouncementList({ announcements, className, onDismiss, sticky, }) {
|
|
12
|
+
const filteredAnnouncements = useFilterAnnouncements(announcements);
|
|
13
|
+
const nodeRef = useRef(null);
|
|
14
|
+
const { ref: announcementRef } = useResizeObserver((_, size) => {
|
|
15
|
+
const height = Math.floor(size.height);
|
|
16
|
+
document?.documentElement.style.setProperty('--announcements-height', `${height}px`);
|
|
17
|
+
});
|
|
18
|
+
return (jsx("section", { ref: announcementRef, className: clsx(styles['announcement-list'], sticky && styles['sticky'], className), children: jsx(TransitionGroup, { className: styles['list'], role: "list", children: filteredAnnouncements.map(announcement => (jsx(CSSTransition, { classNames: {
|
|
19
|
+
enter: styles['enter'],
|
|
20
|
+
enterActive: styles['enter-active'],
|
|
21
|
+
exit: styles['exit'],
|
|
22
|
+
exitActive: styles['exit-active'],
|
|
23
|
+
}, nodeRef: nodeRef, timeout: 250, children: jsx(Announcement, { ref: nodeRef, announcement: announcement, className: styles['list-item'], onDismiss: onDismiss }) }, announcement.id))) }) }));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { AnnouncementList };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var styles = {"announcement-list":"announcement-list-module-Nn6HC","sticky":"announcement-list-module-icXq8","list":"announcement-list-module-cgFNU","list-item":"announcement-list-module-fUupi","enter":"announcement-list-module-W10mi","exit":"announcement-list-module-tyqE0","exit-active":"announcement-list-module-dUOEB","enter-active":"announcement-list-module-1Rfn0"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnnouncementObject } from '../../shared/model/announcement';
|
|
2
2
|
export interface AnnouncementProps {
|
|
3
3
|
announcement: AnnouncementObject;
|
|
4
|
+
className?: string;
|
|
4
5
|
onDismiss?: (id: string) => void;
|
|
5
6
|
}
|
|
6
|
-
export declare
|
|
7
|
+
export declare const Announcement: React.ForwardRefExoticComponent<AnnouncementProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
5
|
import { IconButton } from '../../buttons/icon-button/icon-button.js';
|
|
5
6
|
import { GlyphsArrowSemiBoldRightIcon } from '../../icons/glyph/glyphs-arrow-semibold-right-icon.js';
|
|
@@ -12,6 +13,7 @@ import { SolidSaleIcon } from '../../icons/solid/solid-sale-icon.js';
|
|
|
12
13
|
import { SolidTagIcon } from '../../icons/solid/solid-tag-icon.js';
|
|
13
14
|
import { StrokeCloseboxIcon } from '../../icons/stroke/stroke-closebox-icon.js';
|
|
14
15
|
import { RouteLink } from '../../shared/routing/route-link.js';
|
|
16
|
+
import { multiRef } from '../../shared/utils/refs.js';
|
|
15
17
|
import styles from './announcement.module.css.js';
|
|
16
18
|
|
|
17
19
|
const iconMap = {
|
|
@@ -23,8 +25,10 @@ const iconMap = {
|
|
|
23
25
|
notice: jsx(SolidNoticeIcon, {}),
|
|
24
26
|
sales: jsx(SolidSaleIcon, {}),
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
}
|
|
28
|
+
const Announcement = forwardRef(({ announcement: { href, id, subType, text, title, type }, className, onDismiss, }, ref) => {
|
|
29
|
+
return (jsx("div", { ref: multiRef(ref), className: clsx(styles.announcement, styles[type], styles[subType], className), role: "listitem", children: jsxs("div", { className: styles.wrapper, children: [jsx("div", { className: styles.icon, role: "presentation", children: iconMap[subType] }), jsxs("div", { className: styles.content, children: [jsx("h2", { className: styles.title, children: title }), text &&
|
|
30
|
+
(href ? (jsxs(RouteLink, { className: styles.link, href: href, children: [text, jsx(GlyphsArrowSemiBoldRightIcon, {})] })) : (jsx("p", { className: styles.text, children: text })))] }), jsx(IconButton, { className: styles.close, color: "current-color", onClick: () => onDismiss?.(id), children: jsx(StrokeCloseboxIcon, {}) })] }) }));
|
|
31
|
+
});
|
|
32
|
+
Announcement.displayName = 'Announcement';
|
|
29
33
|
|
|
30
34
|
export { Announcement };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"announcement":"announcement-module-Xi0L5","wrapper":"announcement-module-4XVjD","icon":"announcement-module-lxmA2","content":"announcement-module-1Jn7y","title":"announcement-module-8k2rK","text":"announcement-module-yXGsN","close":"announcement-module-gZ9ae","informative":"announcement-module-0LTWL","notice":"announcement-module-Ga3lN","critical":"announcement-module-S3nSW","
|
|
1
|
+
var styles = {"announcement":"announcement-module-Xi0L5","wrapper":"announcement-module-4XVjD","icon":"announcement-module-lxmA2","content":"announcement-module-1Jn7y","title":"announcement-module-8k2rK","link":"announcement-module--Bhqj","text":"announcement-module-yXGsN","close":"announcement-module-gZ9ae","informative":"announcement-module-0LTWL","notice":"announcement-module-Ga3lN","critical":"announcement-module-S3nSW","promo":"announcement-module-E6DqW"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useCultureCode } from '../../intl/use-culture-code.js';
|
|
4
|
+
import { useLogError } from '../../logging/use-log-error.js';
|
|
5
|
+
import { useFetchAnnouncements } from '../../shared/api/bff/hooks/use-fetch-announcements.js';
|
|
6
|
+
import { useLocalStorage } from '../../shared/hooks/use-local-storage.js';
|
|
7
|
+
import { AnnouncementList } from './announcement-list.js';
|
|
8
|
+
|
|
9
|
+
function ConnectedAnnouncementList({ className, }) {
|
|
10
|
+
const cultureCode = useCultureCode();
|
|
11
|
+
const { data: announcements, error } = useFetchAnnouncements({
|
|
12
|
+
cultureCode,
|
|
13
|
+
});
|
|
14
|
+
useLogError(error);
|
|
15
|
+
const [dismissedIds, setDismissedIds] = useLocalStorage('dismissedAnnouncementIds', []);
|
|
16
|
+
const filteredAnnouncements = announcements?.filter(({ id }) => !dismissedIds.includes(id));
|
|
17
|
+
if (!filteredAnnouncements)
|
|
18
|
+
return null;
|
|
19
|
+
return (jsx(AnnouncementList, { announcements: filteredAnnouncements, className: className, onDismiss: id => setDismissedIds(dismissedIds => [...dismissedIds, id]), sticky: true }));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { ConnectedAnnouncementList };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState, useCallback, useEffect } from 'react';
|
|
3
|
+
import { TIME } from '../../shared/utils/time.js';
|
|
4
|
+
|
|
5
|
+
const now = () => new Date();
|
|
6
|
+
const filterAnnouncement = (announcement) => {
|
|
7
|
+
const { endDate, startDate } = announcement;
|
|
8
|
+
const isVisible = (!startDate || startDate <= now()) && (!endDate || endDate > now());
|
|
9
|
+
return isVisible;
|
|
10
|
+
};
|
|
11
|
+
const arraysEqual = (a, b) => {
|
|
12
|
+
if (a.length !== b.length)
|
|
13
|
+
return false;
|
|
14
|
+
return a.every((val, index) => val === b[index]);
|
|
15
|
+
};
|
|
16
|
+
function useFilterAnnouncements(announcements) {
|
|
17
|
+
const [filteredAnnouncements, setFilteredAnnouncements] = useState(announcements.filter(filterAnnouncement));
|
|
18
|
+
const updateAnnouncements = useCallback(() => {
|
|
19
|
+
const newFilteredAnnouncements = announcements.filter(filterAnnouncement);
|
|
20
|
+
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
|
21
|
+
setFilteredAnnouncements(filteredAnnouncements => arraysEqual(filteredAnnouncements, newFilteredAnnouncements)
|
|
22
|
+
? filteredAnnouncements
|
|
23
|
+
: newFilteredAnnouncements);
|
|
24
|
+
}, [announcements]);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
updateAnnouncements();
|
|
27
|
+
}, [announcements, updateAnnouncements]);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const intervalId = setInterval(updateAnnouncements, 1 * TIME.MINUTE);
|
|
30
|
+
return () => clearInterval(intervalId);
|
|
31
|
+
}, [updateAnnouncements]);
|
|
32
|
+
return filteredAnnouncements;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { useFilterAnnouncements };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { ConnectedOrderLineCard } from '../../../cards/orderline-card/connected-orderline-card.js';
|
|
3
4
|
import { CartTotals } from '../../../cart-totals/cart-totals.js';
|
|
@@ -80,7 +81,7 @@ function CartContent({ cartLines }) {
|
|
|
80
81
|
if (!currencyCode)
|
|
81
82
|
throw new Error(`Currency code not found for symbol ${currentCart.currencySymbol}`);
|
|
82
83
|
return (jsx(CheckoutPageLayout, { actions: {
|
|
83
|
-
primary: (jsx(RouteButton, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", href: "/CheckoutShipping", children: jsx(FormattedMessage, { id: "
|
|
84
|
+
primary: (jsx(RouteButton, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", href: "/CheckoutShipping", children: jsx(FormattedMessage, { id: "Start checkout" }) })),
|
|
84
85
|
secondary: (jsx(RouteButton, { color: "secondary", "data-test-selector": "saveCartForLaterButton", href: isAuthenticated ? undefined : PATHS.SIGN_IN, onClick: () => {
|
|
85
86
|
if (!isAuthenticated)
|
|
86
87
|
return;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { useRef, useMemo } from 'react';
|
|
3
4
|
import clsx from 'clsx';
|
|
@@ -11,7 +12,7 @@ function CheckoutPageLayout({ actions, children, mobileSummary, overview, }) {
|
|
|
11
12
|
const isXXL = useIsBreakpoint('xxl');
|
|
12
13
|
const topRef = useRef(null);
|
|
13
14
|
const bottomRef = useRef(null);
|
|
14
|
-
const headerHeight = useWatchCssProperty('--header-
|
|
15
|
+
const headerHeight = useWatchCssProperty('--header-bottom');
|
|
15
16
|
const isScrolledBeyond = useIsScrolledBeyondElement(bottomRef.current || undefined);
|
|
16
17
|
const observables = useMemo(() => [
|
|
17
18
|
{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
3
|
import { Button } from '../../../buttons/button/button.js';
|
|
3
4
|
import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
|
|
@@ -27,7 +28,7 @@ function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidat
|
|
|
27
28
|
label: t('Review and payment'),
|
|
28
29
|
},
|
|
29
30
|
], "data-test-selector": "paymentPage", title: t('Review and payment'), children: jsxs(CheckoutPageLayout, { actions: {
|
|
30
|
-
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_placeOrder", form: formId, isDisabled: isProcessing, isLoading: isProcessing ? (jsx(FormattedMessage, { id: "Processing" })) : isValidatingVAT ? (jsx(FormattedMessage, { id: "Validating" })) : (false), type: "submit", children: jsx(FormattedMessage, { id: "
|
|
31
|
+
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutReviewAndSubmit_placeOrder", form: formId, isDisabled: isProcessing, isLoading: isProcessing ? (jsx(FormattedMessage, { id: "Processing" })) : isValidatingVAT ? (jsx(FormattedMessage, { id: "Validating" })) : (false), type: "submit", children: cart.paymentMethod?.name === 'PBI' ? (jsx(FormattedMessage, { id: "Finalize order" })) : (jsx(FormattedMessage, { id: "Finalize payment" })) })),
|
|
31
32
|
}, mobileSummary: jsx(CartTotalsSummary, { currencyCode: currencyCode, totalAmount: cart.orderGrandTotal }), overview: jsx(CartTotals, { currencyCode: currencyCode, deliveryDate: hasAtp ? undefined : cart.requestedDeliveryDate, fulfillmentMethod: cart.fulfillmentMethod, isPayByInvoice: (cart.paymentOptions?.paymentMethods?.length || 1) <= 1 &&
|
|
32
33
|
cart.paymentMethod?.name === 'PBI', shippingCost: cart.shippingAndHandling, subtotal: cart.orderSubTotal, tax: cart.totalTax, total: cart.orderGrandTotal, vatPercentage: cart.cartLines?.[0]?.pricing?.vatRate || 0 }), children: [jsx(CheckoutPageSection, { hasBorder: false, title: jsx(FormattedMessage, { id: "Payment" }), children: jsx(CheckoutPageSectionContent, { children: jsx(Payment, { atp: atp, cart: cart, form: formId, isProcessing: isProcessing, onPaymentComplete: onPaymentComplete, onProcessing: setIsProcessing, onValidatingVAT: setIsValidatingVAT }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: jsx(FormattedMessage, { id: "Order" }), children: jsx(CheckoutPageSectionContent, { stretch: true, children: jsx(OrderLineList, { children: cart.cartLines?.map(cartLine => (jsx(OrderLineCard, { deliveryDate: cartLine.atp?.date, href: cartLine.productUri, image: {
|
|
33
34
|
fit: 'contain',
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
3
|
import { Button } from '../../../buttons/button/button.js';
|
|
3
4
|
import { CartTotals } from '../../../cart-totals/cart-totals.js';
|
|
@@ -31,7 +32,7 @@ function ShippingPageContent({ cart, editAddress, errorPatchBillingAddress, fulf
|
|
|
31
32
|
label: t('Shipping details'),
|
|
32
33
|
},
|
|
33
34
|
], "data-test-selector": "shippingPage", title: t('Shipping details'), children: jsxs(CheckoutPageLayout, { actions: {
|
|
34
|
-
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", form: EDIT_ADDRESS_FORM_ID, isDisabled: isPatching, isLoading: isPatching || isPatchingSession ? (jsx(FormattedMessage, { id: "Updating address" })) : undefined, type: "submit", children: jsx(FormattedMessage, { id: "
|
|
35
|
+
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", form: EDIT_ADDRESS_FORM_ID, isDisabled: isPatching, isLoading: isPatching || isPatchingSession ? (jsx(FormattedMessage, { id: "Updating address" })) : undefined, type: "submit", children: jsx(FormattedMessage, { id: "Checkout order" }) })),
|
|
35
36
|
}, mobileSummary: jsx(CartTotalsSummary, { currencyCode: currencyCode, totalAmount: cart.orderGrandTotal }), overview: jsx(CartTotals, { currencyCode: currencyCode, fulfillmentMethod: fulfillmentMethods && fulfillmentMethods.length === 1
|
|
36
37
|
? cart.fulfillmentMethod
|
|
37
38
|
: undefined, shippingCost: cart.shippingAndHandling, subtotal: cart.orderSubTotal, tax: cart.totalTax, total: cart.orderGrandTotal, vatPercentage: cart.cartLines?.[0]?.pricing?.vatRate }), children: [jsxs(Fragment, { children: [fulfillmentMethods && fulfillmentMethods.length > 1 && (jsx(CheckoutPageSection, { hasBorder: true, title: t('Fulfillment method'), children: jsx(CheckoutPageSectionContent, { children: jsx("div", { className: styles['fulfillment-select-wrapper'], children: jsx(Select, { isRequired: true, showLabel: true, "data-test-selector": "fulfillmentMethodSelect", defaultSelectedOption: cart.fulfillmentMethod, isLoading: isLoadingFulfillmentMethods, label: t('Fulfillment method'), name: "fulfillmentMethod", onChange: onChangeFulfillmentMethod, options: fulfillmentMethodOptions || {}, variant: "solid" }) }) }) })), hasBillToAddress && !isGuest ? readOnlyAddress : editAddress] }), Boolean(errorPatchBillingAddress) && (jsx("div", { className: styles['error-message'], children: jsx(FormattedMessage, { id: "An unexpected error occured" }) }))] }) }));
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { environment } from '../../../shared/utils/environment.js';
|
|
2
|
+
|
|
1
3
|
function addOrUpdateElement(selector, { attributes, tag, }) {
|
|
2
4
|
const existingElement = document?.querySelector(selector);
|
|
3
5
|
if (existingElement) {
|
|
@@ -19,6 +21,8 @@ function removeElements(selector) {
|
|
|
19
21
|
document?.querySelectorAll(selector).forEach(element => element.remove());
|
|
20
22
|
}
|
|
21
23
|
function PageMetaData(props) {
|
|
24
|
+
if (environment === 'next')
|
|
25
|
+
return null;
|
|
22
26
|
if (typeof document === 'undefined')
|
|
23
27
|
return null;
|
|
24
28
|
if (props.windowTitle) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import { ConnectedAddToCartButton } from '../../../../../buttons/add-to-cart-button/connected-add-to-cart-button.js';
|
|
3
4
|
import { ConnectedFavoriteButton } from '../../../../../buttons/favorite/connected-favorite-button.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { FetchNavigationLinksArgs } from '../services/bff-service';
|
|
2
|
+
export declare function useFetchNavigationLinks({ cultureCode, source, }: FetchNavigationLinksArgs): import("@tanstack/react-query").UseQueryResult<import("../model/bff.model").NavigationLinkResponse, Error>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { TIME } from '../../../utils/time.js';
|
|
3
|
+
import { fetchNavigationLinks } from '../services/bff-service.js';
|
|
4
|
+
|
|
5
|
+
function useFetchNavigationLinks({ cultureCode, source, }) {
|
|
6
|
+
return useQuery({
|
|
7
|
+
gcTime: 1 * TIME.DAY,
|
|
8
|
+
queryFn: () => fetchNavigationLinks({ cultureCode, source }),
|
|
9
|
+
queryKey: ['navigation', source, cultureCode],
|
|
10
|
+
refetchInterval: 5 * TIME.MINUTE,
|
|
11
|
+
staleTime: 1 * TIME.DAY,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { useFetchNavigationLinks };
|