@sonic-equipment/ui 163.0.0 → 165.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-categories-filters.js +9 -7
- package/dist/background-overlay/background-overlay-manager.d.ts +178 -0
- package/dist/background-overlay/background-overlay-manager.js +291 -0
- package/dist/background-overlay/background-overlay.d.ts +12 -2
- package/dist/background-overlay/background-overlay.js +28 -27
- package/dist/badges/badge/badge.d.ts +2 -1
- package/dist/badges/badge/badge.js +2 -2
- package/dist/badges/badge/icon-with-badge/icon-with-badge.d.ts +2 -1
- package/dist/badges/badge/icon-with-badge/icon-with-badge.js +2 -2
- package/dist/cards/orderline-card/orderline-card.js +5 -1
- package/dist/cards/product-card/product-card.js +5 -1
- package/dist/collapsables/cascading-component/cascading-component.d.ts +6 -2
- package/dist/collapsables/cascading-component/cascading-component.js +5 -5
- package/dist/collapsables/unmounter/unmounter.js +2 -2
- package/dist/country-select/country-select.js +1 -1
- package/dist/country-selector/connected-country-selector.js +20 -2
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +1 -1
- package/dist/country-selector/use-countries-languages.d.ts +17 -1
- package/dist/country-selector/use-countries-languages.js +58 -29
- package/dist/delivery-time/delivery-time.d.ts +1 -1
- package/dist/delivery-time/delivery-time.js +20 -8
- package/dist/delivery-time/delivery-time.module.css.js +1 -1
- package/dist/drawer/drawer.d.ts +26 -0
- package/dist/drawer/drawer.js +37 -0
- package/dist/drawer/drawer.module.css.js +3 -0
- package/dist/drawer/use-drawer.d.ts +17 -0
- package/dist/drawer/use-drawer.js +71 -0
- package/dist/exports.d.ts +12 -0
- package/dist/global-search/global-search-provider/global-search-provider.js +1 -2
- package/dist/global-search/global-search.module.css.js +1 -1
- package/dist/header/cart-icon/connected-cart-icon.js +4 -4
- package/dist/icons/solid/solid-login-icon.js +7 -0
- package/dist/index.js +13 -1
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/layout/center.d.ts +5 -0
- package/dist/layout/center.js +9 -0
- package/dist/layout/center.module.css.js +3 -0
- package/dist/lists/menu-list/menu-list.d.ts +4 -2
- package/dist/lists/menu-list/menu-list.js +2 -2
- package/dist/lists/menu-list/menu-list.module.css.js +1 -1
- package/dist/lists/orderline-list/orderline-list.js +1 -2
- package/dist/navigation/account-icon/account-icon.d.ts +5 -0
- package/dist/navigation/account-icon/account-icon.js +12 -0
- package/dist/navigation/cart-icon/cart-icon.d.ts +5 -0
- package/dist/navigation/cart-icon/cart-icon.js +12 -0
- package/dist/navigation/favorite-icon/favorite-icon.d.ts +5 -0
- package/dist/navigation/favorite-icon/favorite-icon.js +12 -0
- package/dist/navigation/mobile-navigation/mobile-navigation.d.ts +5 -0
- package/dist/navigation/mobile-navigation/mobile-navigation.js +20 -0
- package/dist/navigation/panel-navigation/panel-navigation.d.ts +28 -0
- package/dist/navigation/panel-navigation/panel-navigation.js +69 -0
- package/dist/navigation/panel-navigation/panel-navigation.module.css.js +3 -0
- package/dist/pages/checkout/payment-page/components/payment.js +9 -9
- package/dist/pages/paths.d.ts +1 -0
- package/dist/pages/paths.js +1 -0
- package/dist/shared/hooks/use-global-disclosure.d.ts +10 -0
- package/dist/shared/hooks/use-global-disclosure.js +25 -0
- package/dist/shared/hooks/use-watch-css-property.d.ts +1 -1
- package/dist/shared/hooks/use-watch-css-property.js +2 -3
- package/dist/shared/model/category.d.ts +5 -0
- package/dist/shared/model/category.js +7 -1
- package/dist/shared/model/price.d.ts +2 -2
- package/dist/shared/utils/css.d.ts +1 -0
- package/dist/shared/utils/css.js +13 -0
- package/dist/shared/utils/date.d.ts +1 -12
- package/dist/shared/utils/date.js +8 -64
- package/dist/shared/utils/refs.d.ts +2 -0
- package/dist/shared/utils/refs.js +14 -0
- package/dist/sidebar/sidebar-provider.js +1 -1
- package/dist/styles.css +278 -66
- package/package.json +1 -1
- package/dist/background-overlay/background-overlay.module.css.js +0 -3
- package/dist/shared/utils/date.test.d.ts +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { SolidCartIcon } from '../../icons/solid/solid-cart-icon.js';
|
|
3
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
4
|
+
import { CartIcon } from '../../navigation/cart-icon/cart-icon.js';
|
|
6
5
|
import { useFetchCurrentCartCount } from '../../shared/api/storefront/hooks/cart/use-fetch-current-cart-count.js';
|
|
7
6
|
import { RouteIconButton } from '../../shared/routing/route-icon-button.js';
|
|
8
7
|
|
|
9
8
|
function ConnectedCartIcon({ href }) {
|
|
10
9
|
const count = useFetchCurrentCartCount();
|
|
11
|
-
|
|
10
|
+
const t = useFormattedMessage();
|
|
11
|
+
return (jsx(RouteIconButton, { "data-test-selector": "cartIcon", href: href, children: jsx(CartIcon, { "aria-label": t('Shopping cart'), count: count }) }));
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export { ConnectedCartIcon };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
function SolidLoginIcon(props) {
|
|
4
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "24", viewBox: "0 0 24 24", width: "24", children: jsx("path", { d: "M11.9996246,2 C17.5137282,2 22,6.48597148 22,11.9997748 C22,17.5140285 17.5137282,22 11.9996246,22 C6.48582133,22 2,17.5140285 2,11.9997748 C2,6.48597148 6.48582133,2 11.9996246,2 Z M11.9996246,3.33025009 C7.21934336,3.33025009 3.33009993,7.21934336 3.33009993,11.9997748 C3.33009993,14.0213525 4.02743387,15.8819608 5.19160917,17.3580143 C7.03044454,15.6346505 9.47216445,14.6559204 11.9997748,14.6559204 C14.5290368,14.6559204 16.9689548,15.6343502 18.8079404,17.3581645 C19.9722658,15.8821109 20.6697499,14.0213525 20.6697499,11.9997748 C20.6697499,7.21934336 16.7803563,3.33025009 11.9996246,3.33025009 Z M11.9999399,5.83909064 C14.0652136,5.83909064 15.7454821,7.51935913 15.7454821,9.58463283 C15.7454821,11.6500567 14.0652136,13.3303252 11.9999399,13.3303252 C9.93466624,13.3303252 8.25439775,11.6500567 8.25439775,9.58463283 C8.25439775,7.51935913 9.93466624,5.83909064 11.9999399,5.83909064 Z", fillRule: "evenodd" }) }));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export { SolidLoginIcon };
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export { useAlgoliaInsightsGlobalState } from './algolia/use-algolia-insights-pr
|
|
|
32
32
|
export { useAlgoliaInstantSearchState, useAlgoliaInstantSearchStateIndex, useAlgoliaInstantSearchStateOnline, useAlgoliaInstantSearchStateQueryId, useAlgoliaInstantSearchStateStatus } from './algolia/use-algolia-instant-search-state.js';
|
|
33
33
|
export { useAlgoliaSearch } from './algolia/use-algolia-search.js';
|
|
34
34
|
export { BackgroundOverlay } from './background-overlay/background-overlay.js';
|
|
35
|
+
export { BackgroundOverlayManager } from './background-overlay/background-overlay-manager.js';
|
|
35
36
|
export { Badge } from './badges/badge/badge.js';
|
|
36
37
|
export { IconWithBadge } from './badges/badge/icon-with-badge/icon-with-badge.js';
|
|
37
38
|
export { Tag } from './badges/tag/tag.js';
|
|
@@ -84,6 +85,8 @@ export { DeliveryTime } from './delivery-time/delivery-time.js';
|
|
|
84
85
|
export { InfoDisplay } from './display/info-display/info-display.js';
|
|
85
86
|
export { Price } from './display/price/price.js';
|
|
86
87
|
export { ProductSku } from './display/product-sku/product-sku.js';
|
|
88
|
+
export { Drawer } from './drawer/drawer.js';
|
|
89
|
+
export { useDrawer } from './drawer/use-drawer.js';
|
|
87
90
|
export { ActiveFilters } from './filters/active-filters/active-filters.js';
|
|
88
91
|
export { MultiSelect } from './filters/multi-select/multi-select.js';
|
|
89
92
|
export { Pagination } from './filters/pagination/pagination.js';
|
|
@@ -148,6 +151,7 @@ export { useFormattedMessage } from './intl/use-formatted-message.js';
|
|
|
148
151
|
export { useIntl } from './intl/use-intl.js';
|
|
149
152
|
export { useLanguageCode } from './intl/use-language-code.js';
|
|
150
153
|
export { getLanguageCodeFromCultureCode, spireTranslateAdapter } from './intl/utils.js';
|
|
154
|
+
export { Center } from './layout/center.js';
|
|
151
155
|
export { DownloadDocumentList } from './lists/download-document-list/download-document-list.js';
|
|
152
156
|
export { FeatureList } from './lists/feature-list/feature-list.js';
|
|
153
157
|
export { IconList, IconListItem } from './lists/icon-list/icon-list.js';
|
|
@@ -173,6 +177,11 @@ export { AddToFavoriteDialog } from './modals/favorite/add-to-favorite-dialog.js
|
|
|
173
177
|
export { Modal } from './modals/modal/modal.js';
|
|
174
178
|
export { RecoverPasswordDialog } from './modals/recover-password/recover-password-dialog.js';
|
|
175
179
|
export { SignInDialog } from './modals/signin/sign-in-dialog.js';
|
|
180
|
+
export { AccountIcon } from './navigation/account-icon/account-icon.js';
|
|
181
|
+
export { CartIcon } from './navigation/cart-icon/cart-icon.js';
|
|
182
|
+
export { FavoriteIcon } from './navigation/favorite-icon/favorite-icon.js';
|
|
183
|
+
export { MobileNavigation } from './navigation/mobile-navigation/mobile-navigation.js';
|
|
184
|
+
export { PanelNavigation } from './navigation/panel-navigation/panel-navigation.js';
|
|
176
185
|
export { Announcement } from './notifications/announcements/announcement.js';
|
|
177
186
|
export { AnnouncementProvider } from './notifications/announcements/announcement-provider.js';
|
|
178
187
|
export { ConnectedAnnouncement, now } from './notifications/announcements/connected-announcement.js';
|
|
@@ -306,6 +315,7 @@ export { useCSSLink } from './shared/hooks/use-css-link.js';
|
|
|
306
315
|
export { useDebouncedCallback } from './shared/hooks/use-debounced-callback.js';
|
|
307
316
|
export { useDisclosure } from './shared/hooks/use-disclosure.js';
|
|
308
317
|
export { useEnableMobileZoom } from './shared/hooks/use-enable-mobile-zoom.js';
|
|
318
|
+
export { useGlobalDisclosure } from './shared/hooks/use-global-disclosure.js';
|
|
309
319
|
export { useIntersectionObserver } from './shared/hooks/use-intersection-observer.js';
|
|
310
320
|
export { useIsBreakpoint } from './shared/hooks/use-is-breakpoint.js';
|
|
311
321
|
export { useIsScrolledBeyondElement } from './shared/hooks/use-is-scrolled-beyond-element.js';
|
|
@@ -338,7 +348,8 @@ export { useOnNavigate } from './shared/routing/use-on-navigate.js';
|
|
|
338
348
|
export { withRouting } from './shared/routing/with-routing.js';
|
|
339
349
|
export { ensureArray } from './shared/utils/array.js';
|
|
340
350
|
export { breakpoints, getCurrentBreakpoints } from './shared/utils/breakpoints.js';
|
|
341
|
-
export {
|
|
351
|
+
export { getCssPropertyValue } from './shared/utils/css.js';
|
|
352
|
+
export { formatDateToLocaleString } from './shared/utils/date.js';
|
|
342
353
|
export { trackPropertyChange } from './shared/utils/debug.js';
|
|
343
354
|
export { environment, environments } from './shared/utils/environment.js';
|
|
344
355
|
export { EventEmitter } from './shared/utils/event-emitter.js';
|
|
@@ -347,6 +358,7 @@ export { ensureNumber } from './shared/utils/number.js';
|
|
|
347
358
|
export { formatCurrency, getCurrencyByCountryCode, parseCurrency } from './shared/utils/price.js';
|
|
348
359
|
export { isPromise, wait } from './shared/utils/promise.js';
|
|
349
360
|
export { random, randomInt } from './shared/utils/random.js';
|
|
361
|
+
export { multiRef } from './shared/utils/refs.js';
|
|
350
362
|
export { camelCase } from './shared/utils/string.js';
|
|
351
363
|
export { TIME } from './shared/utils/time.js';
|
|
352
364
|
export { has, hasNo } from './shared/utils/types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | '
|
|
1
|
+
export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Add order notes' | 'Add to list' | 'Address' | 'Amount: {0}' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | '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.' | 'Client cases' | 'Close' | 'Company name' | 'Conceal value' | 'Confirm password' | 'Continue shopping' | 'Continue to sign in' | 'Continue' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Delivery date' | 'Delivery expected on {0}' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Favorites' | 'Features' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'Incl. VAT' | 'Includes' | 'Industry' | 'industry.PP' | 'industry.AU' | 'industry.MC' | 'industry.BC' | 'industry.TR' | 'industry.AG' | 'industry.AV' | 'industry.MA' | 'industry.OT' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'Main menu' | 'More than {0} articles' | 'My account' | 'My Sonic' | 'Navigation' | 'New list name' | 'New user?' | 'Number of favorites' | 'Number of products' | 'of' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order number' | 'Order' | 'Order' | 'Our products' | 'Password does not meet requirements' | 'Password' | 'Passwords do not match' | 'Pay by invoice' | 'Pay' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove all' | 'Requested delivery date' | 'Requested delivery date' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search' | 'Searching again using more general terms' | 'See all results' | 'Select a country' | 'Select a desired delivery date' | 'Select a language' | 'Select a list' | 'Select an industry' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Shopping cart' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'sign in' | 'Sign in or create account' | 'Sign me up for newsletters and product updates' | 'Signed in' | 'Signed out' | 'Signing in…' | 'Sonic address' | 'Sonic Equipment' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'Specifications' | 'Submenu' | 'Submit email address' | 'Submit' | 'Submitting…' | 'Subtotal' | 'Support' | 'Suggestions' | 'tag.limited' | 'tag.new' | 'The email address you entered is already associated with an existing account. Please sign in to this account or contact Customer Support.' | 'The expected delivery is an indication based on the product availability and the shipping location.' | 'The product has been added to your cart.' | 'The product has been removed from your cart.' | 'The product has been updated in your cart.' | 'There are no products in your shopping cart.' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Validating' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!' | 'You must ' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'Your cart has been emptied.' | 'Your email and password were not recognized.' | 'Your favorites are available on multiple devices' | 'Your new Sonic Equipment account was succesfully created. You should receive an email soon with further instructions on how to activate this account. If you do not receive this email, please contact Customer Support.' | 'Your shopping cart is still empty';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import styles from './center.module.css.js';
|
|
4
|
+
|
|
5
|
+
function Center({ children, className, }) {
|
|
6
|
+
return jsx("div", { className: clsx(styles.center, className), children: children });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { Center };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
export type MenuListVariant = 'default' | 'primary';
|
|
2
3
|
export interface MenuListProps {
|
|
3
4
|
back?: {
|
|
4
5
|
onClick: () => void;
|
|
@@ -9,6 +10,7 @@ export interface MenuListProps {
|
|
|
9
10
|
href: string;
|
|
10
11
|
title: string;
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
scrollable?: boolean;
|
|
14
|
+
variant?: MenuListVariant;
|
|
13
15
|
}
|
|
14
|
-
export declare function MenuList({ back, children, header, variant, }: MenuListProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function MenuList({ back, children, header, scrollable, variant, }: MenuListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,10 +4,10 @@ import { MenuListBackButton } from './menu-list-back-button.js';
|
|
|
4
4
|
import { MenuListHeader } from './menu-list-header.js';
|
|
5
5
|
import styles from './menu-list.module.css.js';
|
|
6
6
|
|
|
7
|
-
function MenuList({ back, children, header, variant = 'default', }) {
|
|
7
|
+
function MenuList({ back, children, header, scrollable = true, variant = 'default', }) {
|
|
8
8
|
const headerTitle = typeof header === 'string' ? header : header?.title;
|
|
9
9
|
const headerHref = typeof header === 'string' ? undefined : header?.href;
|
|
10
|
-
return (jsxs("section", { className: clsx(styles['menu-list'], styles[variant]), role: "menu", children: [back && (jsx(MenuListBackButton, { onClick: back.onClick, children: back.title })), jsxs("div", { className: styles['scroll-area'], children: [header && (jsx(MenuListHeader, { href: headerHref, children: headerTitle })), jsx("ul", { className: styles['list'], children: children })] })] }));
|
|
10
|
+
return (jsxs("section", { className: clsx(styles['menu-list'], styles[variant], scrollable && styles['scrollable']), role: "menu", children: [back && (jsx(MenuListBackButton, { onClick: back.onClick, children: back.title })), jsxs("div", { className: styles['scroll-area'], children: [header && (jsx(MenuListHeader, { href: headerHref, children: headerTitle })), jsx("ul", { className: styles['list'], children: children })] })] }));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export { MenuList };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var styles = {"menu-list":"menu-list-module-TloB9","primary":"menu-list-module-xUg6i","scroll-area":"menu-list-module-x3D-V","list":"menu-list-module-m3rpo","menu-list-back-button":"menu-list-module-eKDL9","icon":"menu-list-module-syyw9","menu-list-header":"menu-list-module-S08LI","menu-list-item":"menu-list-module-4QhF4","label":"menu-list-module-xFYyo","image":"menu-list-module-ELekn","badge":"menu-list-module-4PbP-","selected":"menu-list-module-hiMca","has-children":"menu-list-module-61uJb"};
|
|
1
|
+
var styles = {"menu-list":"menu-list-module-TloB9","primary":"menu-list-module-xUg6i","scrollable":"menu-list-module-AiDgG","scroll-area":"menu-list-module-x3D-V","list":"menu-list-module-m3rpo","menu-list-back-button":"menu-list-module-eKDL9","icon":"menu-list-module-syyw9","menu-list-header":"menu-list-module-S08LI","menu-list-item":"menu-list-module-4QhF4","label":"menu-list-module-xFYyo","image":"menu-list-module-ELekn","badge":"menu-list-module-4PbP-","selected":"menu-list-module-hiMca","has-children":"menu-list-module-61uJb"};
|
|
2
2
|
|
|
3
3
|
export { styles as default };
|
|
@@ -14,13 +14,12 @@ function OrderLineList({ children, onRemoveAll }) {
|
|
|
14
14
|
const { close, isOpen, open } = useDisclosure();
|
|
15
15
|
// eslint-disable-next-line @eslint-react/no-children-count
|
|
16
16
|
const count = React.Children.count(children);
|
|
17
|
-
const productString = count === 1 ? t('Product') : t('Products');
|
|
18
17
|
function handleRemoveAll() {
|
|
19
18
|
if (!onRemoveAll)
|
|
20
19
|
return;
|
|
21
20
|
open();
|
|
22
21
|
}
|
|
23
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: styles['orderline-list'], children: [jsxs("div", { className: styles.header, children: [jsxs("p", { className: styles.count, children: [jsx("span", { "data-test-selector": "orderLineListCount", children: count }), ` ${
|
|
22
|
+
return (jsxs(Fragment, { children: [jsxs("div", { className: styles['orderline-list'], children: [jsxs("div", { className: styles.header, children: [jsxs("p", { className: styles.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("div", { className: styles.items, children:
|
|
24
23
|
// eslint-disable-next-line @eslint-react/no-children-map
|
|
25
24
|
Children.map(children, (child, index) => (
|
|
26
25
|
// eslint-disable-next-line @eslint-react/no-array-index-key
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Badge } from '../../badges/badge/badge.js';
|
|
3
|
+
import { IconWithBadge } from '../../badges/badge/icon-with-badge/icon-with-badge.js';
|
|
4
|
+
import { SolidLoginIcon } from '../../icons/solid/solid-login-icon.js';
|
|
5
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
6
|
+
|
|
7
|
+
function AccountIcon({ 'aria-label': ariaLabel, isAuthenticated, }) {
|
|
8
|
+
const t = useFormattedMessage();
|
|
9
|
+
return (jsx(IconWithBadge, { "aria-label": ariaLabel, badge: isAuthenticated ? (jsx(Badge, { "aria-label": `(${t('Signed in')})`, variant: "green" })) : (jsx(Badge, { "aria-label": `(${t('Signed out')})`, variant: "red" })), icon: jsx(SolidLoginIcon, { role: "presentation" }) }));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { AccountIcon };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Badge } from '../../badges/badge/badge.js';
|
|
3
|
+
import { IconWithBadge } from '../../badges/badge/icon-with-badge/icon-with-badge.js';
|
|
4
|
+
import { SolidCartIcon } from '../../icons/solid/solid-cart-icon.js';
|
|
5
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
6
|
+
|
|
7
|
+
function CartIcon({ 'aria-label': ariaLabel, count }) {
|
|
8
|
+
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": "cartIconCount", icon: jsx(SolidCartIcon, { role: "presentation" }) }));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { CartIcon };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Badge } from '../../badges/badge/badge.js';
|
|
3
|
+
import { IconWithBadge } from '../../badges/badge/icon-with-badge/icon-with-badge.js';
|
|
4
|
+
import { SolidFavoriteIcon } from '../../icons/solid/solid-favorite-icon.js';
|
|
5
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
6
|
+
|
|
7
|
+
function FavoriteIcon({ 'aria-label': ariaLabel, count, }) {
|
|
8
|
+
const t = useFormattedMessage();
|
|
9
|
+
return (jsx(IconWithBadge, { "aria-label": ariaLabel, badge: count && count > 0 ? (jsx(Badge, { "aria-label": count && count > 0 ? `(${t('Number of favorites')})` : undefined, count: count })) : undefined, "data-test-selector": "favoriteIconCount", icon: jsx(SolidFavoriteIcon, { role: "presentation" }) }));
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { FavoriteIcon };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
3
|
+
import { MenuList } from '../../lists/menu-list/menu-list.js';
|
|
4
|
+
import { MenuListItem } from '../../lists/menu-list/menu-list-item.js';
|
|
5
|
+
import { PATHS } from '../../pages/paths.js';
|
|
6
|
+
import { useFetchSession } from '../../shared/api/storefront/hooks/authentication/use-fetch-session.js';
|
|
7
|
+
import { useFetchCurrentCartCount } from '../../shared/api/storefront/hooks/cart/use-fetch-current-cart-count.js';
|
|
8
|
+
import { AccountIcon } from '../account-icon/account-icon.js';
|
|
9
|
+
import { CartIcon } from '../cart-icon/cart-icon.js';
|
|
10
|
+
import { FavoriteIcon } from '../favorite-icon/favorite-icon.js';
|
|
11
|
+
import { PanelNavigation } from '../panel-navigation/panel-navigation.js';
|
|
12
|
+
|
|
13
|
+
function MobileNavigation({ links }) {
|
|
14
|
+
const t = useFormattedMessage();
|
|
15
|
+
const { data: { isAuthenticated } = {} } = useFetchSession();
|
|
16
|
+
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') })] }) }));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { MobileNavigation };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ImageType } from '../../shared/model/image';
|
|
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);
|
|
15
|
+
export interface PanelNavigationProps {
|
|
16
|
+
allowBack?: boolean;
|
|
17
|
+
children?: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
header?: string | {
|
|
20
|
+
href: string;
|
|
21
|
+
title: string;
|
|
22
|
+
};
|
|
23
|
+
isNarrow?: boolean;
|
|
24
|
+
links?: NavigationMenuLink[];
|
|
25
|
+
variant?: 'primary';
|
|
26
|
+
}
|
|
27
|
+
export declare function PanelNavigation({ allowBack, children, className, header, isNarrow, links, variant, }: PanelNavigationProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef, useRef, useState, useCallback, useEffect } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { CascadingComponent } from '../../collapsables/cascading-component/cascading-component.js';
|
|
5
|
+
import { CascadingComponentContainer } from '../../collapsables/cascading-component/cascading-component-container.js';
|
|
6
|
+
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
7
|
+
import { MenuList } from '../../lists/menu-list/menu-list.js';
|
|
8
|
+
import { MenuListItem } from '../../lists/menu-list/menu-list-item.js';
|
|
9
|
+
import { multiRef } from '../../shared/utils/refs.js';
|
|
10
|
+
import styles from './panel-navigation.module.css.js';
|
|
11
|
+
|
|
12
|
+
const focusableSelectors = [
|
|
13
|
+
'a[href]',
|
|
14
|
+
'button:not([disabled])',
|
|
15
|
+
'textarea:not([disabled])',
|
|
16
|
+
'input:not([disabled]):not([type="hidden"])',
|
|
17
|
+
'select:not([disabled])',
|
|
18
|
+
'[tabindex]:not([tabindex="-1"])',
|
|
19
|
+
].join(',');
|
|
20
|
+
const NavigationMenu = forwardRef(({ allowBack, back, children, className, header, id, isNarrow, links, scrollable, variant, }, ref) => {
|
|
21
|
+
const menuRef = useRef();
|
|
22
|
+
const submenuRef = useRef(null);
|
|
23
|
+
const [selectedNavigationLink, setSelectedNavigationLink] = useState();
|
|
24
|
+
const [selectedNavigationVisible, setSelectedNavigationVisible] = useState(false);
|
|
25
|
+
const onUnmounted = useCallback(() => {
|
|
26
|
+
setSelectedNavigationLink(undefined);
|
|
27
|
+
}, []);
|
|
28
|
+
const onFocus = useCallback((ref) => () => {
|
|
29
|
+
if (!ref.current)
|
|
30
|
+
return;
|
|
31
|
+
const focusable = ref.current.querySelector(focusableSelectors);
|
|
32
|
+
focusable?.focus();
|
|
33
|
+
}, []);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
// eslint-disable-next-line @eslint-react/hooks-extra/no-direct-set-state-in-use-effect
|
|
36
|
+
setSelectedNavigationVisible(Boolean(selectedNavigationLink));
|
|
37
|
+
}, [selectedNavigationLink]);
|
|
38
|
+
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 => 'links' in link ? (jsx(MenuListItem, { hasChildren: true, "aria-controls": `menu-${link.key}`, image: link.image, isSelected: selectedNavigationLink?.key === link.key, onClick: () => setSelectedNavigationLink(selectedNavigationLink?.key === link.key
|
|
40
|
+
? 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
|
+
? {
|
|
43
|
+
onClick: () => {
|
|
44
|
+
setSelectedNavigationVisible(false);
|
|
45
|
+
},
|
|
46
|
+
title: header
|
|
47
|
+
? typeof header === 'string'
|
|
48
|
+
? header
|
|
49
|
+
: header.title
|
|
50
|
+
: t('Main menu'),
|
|
51
|
+
}
|
|
52
|
+
: undefined, header: selectedNavigationLink?.url
|
|
53
|
+
? {
|
|
54
|
+
href: selectedNavigationLink.url,
|
|
55
|
+
title: selectedNavigationLink.title,
|
|
56
|
+
}
|
|
57
|
+
: selectedNavigationLink?.title, id: selectedNavigationLink?.key
|
|
58
|
+
? `menu-${selectedNavigationLink.key}`
|
|
59
|
+
: undefined, isNarrow: isNarrow, links: selectedNavigationLink && 'links' in selectedNavigationLink
|
|
60
|
+
? selectedNavigationLink.links
|
|
61
|
+
: [] }, selectedNavigationLink?.key) })] }));
|
|
62
|
+
});
|
|
63
|
+
NavigationMenu.displayName = 'NavigationMenu';
|
|
64
|
+
function PanelNavigation({ allowBack, children, className, header, isNarrow, links, variant, }) {
|
|
65
|
+
const t = useFormattedMessage();
|
|
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 }) }) }) }));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { PanelNavigation };
|
|
@@ -306,15 +306,15 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
|
|
|
306
306
|
setDeliveryDate('');
|
|
307
307
|
}, children: t('As soon as possible') }), jsx(InfoIconTooltip, { variant: "stroke", children: t('Selecting As Soon As Possible will enable us to send the products to you as they become available.') })] })] })), jsx(Select, { isRequired: true, "data-test-selector": "industrySelect", defaultSelectedOption: cart.properties.industry, isDisabled: isDisabled, label: t('Industry'), name: "industry", options: {
|
|
308
308
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
309
|
-
PP: '
|
|
310
|
-
AU: '
|
|
311
|
-
MC: '
|
|
312
|
-
BC: '
|
|
313
|
-
TR: '
|
|
314
|
-
AG: '
|
|
315
|
-
AV: '
|
|
316
|
-
MA: '
|
|
317
|
-
OT: '
|
|
309
|
+
PP: t('industry.PP'),
|
|
310
|
+
AU: t('industry.AU'),
|
|
311
|
+
MC: t('industry.MC'),
|
|
312
|
+
BC: t('industry.BC'),
|
|
313
|
+
TR: t('industry.TR'),
|
|
314
|
+
AG: t('industry.AG'),
|
|
315
|
+
AV: t('industry.AV'),
|
|
316
|
+
MA: t('industry.MA'),
|
|
317
|
+
OT: t('industry.OT'),
|
|
318
318
|
/* eslint-enable sort-keys-fix/sort-keys-fix */
|
|
319
319
|
}, placeholder: t('Select an industry'), variant: "solid" }), jsx(TextField, { showLabel: true, isDisabled: isDisabled, label: t('VAT Number'), name: "customerVatNumber", onBlur: e => validateVAT(e.target.value), onChange: setCustomerVatNumber, validate: () => validationErrors.customerVatNumber ?? true, value: customerVatNumber }, `vat${Boolean(validationErrors.customerVatNumber)}`), jsx(TextField, { showLabel: true, defaultValue: cart.poNumber, isDisabled: isDisabled, isRequired: cart.requiresPoNumber, label: t('PO Number'), name: "poNumber" }), paymentMethodOptions && Object.keys(paymentMethodOptions).length > 1 && (jsx(Select, { "data-test-selector": "paymentMethodSelect", defaultSelectedOption: cart.paymentOptions?.paymentMethods?.[0]?.name || 'ADY', isDisabled: isDisabled, label: t('Payment method'), name: "paymentMethod", onChange: setSelectedPaymentMethod, options: paymentMethodOptions, selectedOption: selectedPaymentMethod, variant: "solid" })), isAdyenPayment && cart.billTo && (jsx(AdyenPayment, { amount: cart.orderGrandTotal, cartId: cart.trackId, countryCode: countryCode, currencyCode: currencyCode, customerId: cart.billTo.id, dropinRef: dropinRef, environment: environment === 'production' ? 'live' : 'test', isDisabled: isDisabled, onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl:
|
|
320
320
|
/* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
|
package/dist/pages/paths.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const PATHS: {
|
|
|
5
5
|
readonly CART: "/Cart";
|
|
6
6
|
readonly CHECKOUT_SHIPPING: "/CheckoutShipping";
|
|
7
7
|
readonly CHECKOUT_SHIPPING_VIA_SIGNIN: "/SignIn?returnUrl=/CheckoutShipping";
|
|
8
|
+
readonly FAVORITES: "/MyAccount/MyLists";
|
|
8
9
|
readonly HOME: "/";
|
|
9
10
|
readonly ORDER_CONFIRMATION: "/OrderConfirmation";
|
|
10
11
|
readonly REVIEW_AND_SUBMIT: "/CheckoutReviewAndSubmit";
|
package/dist/pages/paths.js
CHANGED
|
@@ -5,6 +5,7 @@ const PATHS = {
|
|
|
5
5
|
CART: '/Cart',
|
|
6
6
|
CHECKOUT_SHIPPING: '/CheckoutShipping',
|
|
7
7
|
CHECKOUT_SHIPPING_VIA_SIGNIN: '/SignIn?returnUrl=/CheckoutShipping',
|
|
8
|
+
FAVORITES: '/MyAccount/MyLists',
|
|
8
9
|
HOME: '/',
|
|
9
10
|
ORDER_CONFIRMATION: '/OrderConfirmation',
|
|
10
11
|
REVIEW_AND_SUBMIT: '/CheckoutReviewAndSubmit',
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface UseDisclosureReturnType {
|
|
2
|
+
close: VoidFunction;
|
|
3
|
+
isClosed: boolean;
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
open: VoidFunction;
|
|
6
|
+
setIsOpen: (isOpen: boolean) => void;
|
|
7
|
+
toggle: VoidFunction;
|
|
8
|
+
}
|
|
9
|
+
export declare const useGlobalDisclosure: (key: string, isInitialOpen?: boolean) => UseDisclosureReturnType;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useGlobalState } from '../providers/global-state-provider.js';
|
|
3
|
+
|
|
4
|
+
const useGlobalDisclosure = (key, isInitialOpen = false) => {
|
|
5
|
+
const [isOpen, setIsOpen] = useGlobalState(key, isInitialOpen);
|
|
6
|
+
const open = useCallback(() => {
|
|
7
|
+
setIsOpen(true);
|
|
8
|
+
}, [setIsOpen]);
|
|
9
|
+
const close = useCallback(() => {
|
|
10
|
+
setIsOpen(false);
|
|
11
|
+
}, [setIsOpen]);
|
|
12
|
+
const toggle = useCallback(() => {
|
|
13
|
+
setIsOpen(prevIsOpen => !prevIsOpen);
|
|
14
|
+
}, [setIsOpen]);
|
|
15
|
+
return {
|
|
16
|
+
close,
|
|
17
|
+
isClosed: !isOpen,
|
|
18
|
+
isOpen,
|
|
19
|
+
open,
|
|
20
|
+
setIsOpen,
|
|
21
|
+
toggle,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { useGlobalDisclosure };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useWatchCssProperty(property: string): string | undefined;
|
|
1
|
+
export declare function useWatchCssProperty(property: string): string | number | undefined;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
|
+
import { getCssPropertyValue } from '../utils/css.js';
|
|
2
3
|
|
|
3
4
|
function useWatchCssProperty(property) {
|
|
4
|
-
const [value, setValue] = useState(
|
|
5
|
-
? getComputedStyle?.(document.body).getPropertyValue(property)
|
|
6
|
-
: undefined);
|
|
5
|
+
const [value, setValue] = useState(() => getCssPropertyValue(property));
|
|
7
6
|
useEffect(() => {
|
|
8
7
|
if (typeof MutationObserver === 'undefined' ||
|
|
9
8
|
typeof document === 'undefined')
|
|
@@ -6,6 +6,7 @@ export interface Category {
|
|
|
6
6
|
title: string;
|
|
7
7
|
}
|
|
8
8
|
export declare function transformAlgoliaCategoryData(categories: RefinementListItem[]): {
|
|
9
|
+
count: number;
|
|
9
10
|
href: string;
|
|
10
11
|
image: {
|
|
11
12
|
1: string;
|
|
@@ -13,6 +14,10 @@ export declare function transformAlgoliaCategoryData(categories: RefinementListI
|
|
|
13
14
|
3: string;
|
|
14
15
|
altText: string;
|
|
15
16
|
} | undefined;
|
|
17
|
+
isRefined: boolean;
|
|
18
|
+
label: string;
|
|
16
19
|
name: string;
|
|
17
20
|
path: string[];
|
|
21
|
+
sortOrder: number;
|
|
22
|
+
value: string;
|
|
18
23
|
}[];
|
|
@@ -3,6 +3,7 @@ function transformAlgoliaCategoryData(categories) {
|
|
|
3
3
|
.map(item => {
|
|
4
4
|
const data = JSON.parse(item.value);
|
|
5
5
|
return {
|
|
6
|
+
count: item.count,
|
|
6
7
|
href: data.href,
|
|
7
8
|
image: data.images.length > 0
|
|
8
9
|
? {
|
|
@@ -15,11 +16,16 @@ function transformAlgoliaCategoryData(categories) {
|
|
|
15
16
|
altText: data.name,
|
|
16
17
|
}
|
|
17
18
|
: undefined,
|
|
19
|
+
isRefined: item.isRefined,
|
|
20
|
+
label: item.label,
|
|
18
21
|
name: data.name,
|
|
19
22
|
path: data.path.split(' > '),
|
|
23
|
+
sortOrder: data.sortOrder,
|
|
24
|
+
value: item.value,
|
|
20
25
|
};
|
|
21
26
|
})
|
|
22
|
-
.sort((a, b) => a.
|
|
27
|
+
.sort((a, b) => (a.sortOrder || 100_000) - (b.sortOrder || 100_000) ||
|
|
28
|
+
a.name.localeCompare(b.name));
|
|
23
29
|
}
|
|
24
30
|
|
|
25
31
|
export { transformAlgoliaCategoryData };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CurrencyCode } from '../../intl/types';
|
|
2
2
|
export interface ProductPriceType {
|
|
3
|
-
currencyCode
|
|
3
|
+
currencyCode?: CurrencyCode;
|
|
4
4
|
isVatIncluded: boolean;
|
|
5
5
|
originalPrice?: number;
|
|
6
6
|
price: number;
|
|
7
7
|
}
|
|
8
8
|
export interface ProductTotalPriceType {
|
|
9
|
-
currencyCode
|
|
9
|
+
currencyCode?: CurrencyCode;
|
|
10
10
|
originalTotalPrice?: number;
|
|
11
11
|
pricePerUnit?: number;
|
|
12
12
|
totalPrice: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCssPropertyValue(property: string): string | number | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function getCssPropertyValue(property) {
|
|
2
|
+
if (typeof document === 'undefined')
|
|
3
|
+
return;
|
|
4
|
+
const rawValue = getComputedStyle?.(document.body).getPropertyValue(property);
|
|
5
|
+
if (!rawValue)
|
|
6
|
+
return undefined;
|
|
7
|
+
const valueAsNumber = Number.parseFloat(rawValue);
|
|
8
|
+
if (!Number.isNaN(valueAsNumber))
|
|
9
|
+
return valueAsNumber;
|
|
10
|
+
return rawValue;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { getCssPropertyValue };
|