@sonic-equipment/ui 133.0.0 → 134.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-intialization.js → algolia-initialization.js} +7 -0
- package/dist/algolia/algolia-insights-provider.js +7 -0
- package/dist/algolia/algolia-search-provider.js +19 -0
- package/dist/algolia/use-algolia-insights.d.ts +13 -6
- package/dist/algolia/use-algolia-insights.js +93 -10
- package/dist/buttons/button/button.d.ts +4 -1
- package/dist/buttons/button/button.js +2 -2
- package/dist/country-selector/country-select/country-select.d.ts +1 -0
- package/dist/country-selector/country-select/country-select.js +2 -2
- package/dist/delivery-time/delivery-time.js +1 -1
- package/dist/exports.d.ts +7 -2
- package/dist/forms/checkbox/checkbox.d.ts +2 -1
- package/dist/forms/checkbox/checkbox.js +2 -2
- package/dist/forms/field-error/field-error.d.ts +2 -1
- package/dist/forms/field-error/field-error.js +3 -2
- package/dist/forms/input/input.d.ts +1 -0
- package/dist/forms/input/input.js +2 -2
- package/dist/forms/label/label.d.ts +3 -1
- package/dist/forms/label/label.js +3 -2
- package/dist/forms/switch/switch.d.ts +2 -1
- package/dist/forms/switch/switch.js +2 -2
- package/dist/forms/text-field/text-field.d.ts +3 -1
- package/dist/forms/text-field/text-field.js +4 -3
- package/dist/forms/text-field/text-field.module.css.js +1 -1
- package/dist/forms/textarea/textarea.d.ts +1 -0
- package/dist/forms/textarea/textarea.js +3 -2
- package/dist/global-search/plugins/categories-plugin.js +2 -1
- package/dist/global-search/plugins/popular-categories-plugin.js +2 -0
- package/dist/global-search/plugins/query-suggestions-plugin.js +1 -0
- package/dist/global-search/plugins/quick-access-plugin.js +2 -2
- package/dist/global-search/search-result-panel/sections/with-results.js +0 -1
- package/dist/index.js +8 -3
- package/dist/info-icon-tooltip/info-icon-tooltip.d.ts +7 -0
- package/dist/info-icon-tooltip/info-icon-tooltip.js +20 -0
- package/dist/info-icon-tooltip/info-icon-tooltip.module.css.js +3 -0
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.d.ts +5 -0
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +83 -0
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page.js +3 -77
- package/dist/pages/checkout/payment-page/components/payment.js +49 -4
- package/dist/pages/checkout/payment-page/payment-page-content.d.ts +15 -0
- package/dist/pages/checkout/payment-page/payment-page-content.js +43 -0
- package/dist/pages/checkout/payment-page/payment-page.js +3 -37
- package/dist/pages/checkout/shipping-page/components/edit-address.js +3 -3
- package/dist/pages/checkout/shipping-page/shipping-page-content.d.ts +14 -0
- package/dist/pages/checkout/shipping-page/shipping-page-content.js +40 -0
- package/dist/pages/checkout/shipping-page/shipping-page.js +45 -54
- package/dist/pages/product/product-details-page/components/product-details-panel/product-details-panel.js +11 -1
- package/dist/pages/product/product-listing-page/product-listing-product-overview/product-listing-product-overview.js +0 -1
- package/dist/pages/product/search-result-page/search-result-product-overview/search-result-product-overview.js +0 -1
- package/dist/shared/fetch/request.d.ts +18 -13
- package/dist/shared/fetch/request.js +22 -9
- package/dist/shared/ga/use-data-layer.d.ts +7 -3
- package/dist/shared/ga/use-data-layer.js +6 -1
- package/dist/shared/utils/promise.d.ts +2 -0
- package/dist/shared/utils/promise.js +9 -0
- package/dist/sign-in-form/sign-in-form.d.ts +19 -0
- package/dist/sign-in-form/sign-in-form.js +49 -0
- package/dist/sign-in-form/sign-in-form.module.css.js +3 -0
- package/dist/styles.css +192 -44
- package/dist/tooltip/tooltip.d.ts +3 -2
- package/dist/tooltip/tooltip.js +5 -4
- package/package.json +1 -1
- package/dist/shared/utils/wait.d.ts +0 -1
- package/dist/shared/utils/wait.js +0 -5
- /package/dist/algolia/{algolia-intialization.d.ts → algolia-initialization.d.ts} +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef, useRef, useCallback, useEffect } from 'react';
|
|
4
4
|
import { useContextProps, TextAreaContext, TextArea as TextArea$1 } from 'react-aria-components';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
import styles from './textarea.module.css.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -10,7 +11,7 @@ import styles from './textarea.module.css.js';
|
|
|
10
11
|
* The initial height is calculated based on the style of the textarea.
|
|
11
12
|
* The height is updated everytime the user types.
|
|
12
13
|
*/
|
|
13
|
-
const TextArea = forwardRef(({ autoGrow, label, size, ...textAreaProps }, _ref) => {
|
|
14
|
+
const TextArea = forwardRef(({ autoGrow, className, label, size, ...textAreaProps }, _ref) => {
|
|
14
15
|
const textAreaRef = useRef(null);
|
|
15
16
|
const [props, ref] = useContextProps(textAreaProps, textAreaRef, TextAreaContext);
|
|
16
17
|
const initialHeight = useRef(null);
|
|
@@ -40,7 +41,7 @@ const TextArea = forwardRef(({ autoGrow, label, size, ...textAreaProps }, _ref)
|
|
|
40
41
|
}
|
|
41
42
|
updateHeight();
|
|
42
43
|
}, [ref, autoGrow, updateHeight, size]);
|
|
43
|
-
return (jsx(Fragment, { children: jsx("div", { className: styles['input-container'], children: jsx(TextArea$1, { "aria-label": label, ...textAreaProps, ref: node => {
|
|
44
|
+
return (jsx(Fragment, { children: jsx("div", { className: clsx(className, styles['input-container']), children: jsx(TextArea$1, { "aria-label": label, ...textAreaProps, ref: node => {
|
|
44
45
|
ref.current =
|
|
45
46
|
node;
|
|
46
47
|
return (textAreaRef.current = node);
|
|
@@ -3,6 +3,7 @@ import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query
|
|
|
3
3
|
const querySuggestionsPlugin = ({ searchClient, suggestionsIndexName, }) => createQuerySuggestionsPlugin({
|
|
4
4
|
getSearchParams({ state }) {
|
|
5
5
|
return {
|
|
6
|
+
analytics: false,
|
|
6
7
|
hitsPerPage: state.query ? 10 : 0,
|
|
7
8
|
};
|
|
8
9
|
},
|
|
@@ -2,7 +2,7 @@ import { getAlgoliaResults } from '@algolia/autocomplete-preset-algolia';
|
|
|
2
2
|
|
|
3
3
|
const quickAccessPlugin = ({ productsIndexName, searchClient, }) => {
|
|
4
4
|
return {
|
|
5
|
-
getSources(
|
|
5
|
+
getSources() {
|
|
6
6
|
return [
|
|
7
7
|
{
|
|
8
8
|
getItems() {
|
|
@@ -11,10 +11,10 @@ const quickAccessPlugin = ({ productsIndexName, searchClient, }) => {
|
|
|
11
11
|
{
|
|
12
12
|
indexName: productsIndexName,
|
|
13
13
|
params: {
|
|
14
|
+
analytics: false,
|
|
14
15
|
hitsPerPage: 0,
|
|
15
16
|
ruleContexts: ['quick-access'],
|
|
16
17
|
},
|
|
17
|
-
query,
|
|
18
18
|
},
|
|
19
19
|
],
|
|
20
20
|
searchClient,
|
package/dist/index.js
CHANGED
|
@@ -12,10 +12,10 @@ export { AlgoliaFilterPanel } from './algolia/algolia-filter-panel.js';
|
|
|
12
12
|
export { isAlgoliaProductHit } from './algolia/algolia-hit-type.js';
|
|
13
13
|
export { AlgoliaHitsProvider } from './algolia/algolia-hits-provider.js';
|
|
14
14
|
export { algoliaIndexesPerEnvironment, getAlgoliaIndex } from './algolia/algolia-index-config.js';
|
|
15
|
+
export { userToken } from './algolia/algolia-initialization.js';
|
|
15
16
|
export { AlgoliaInsightInstantSearchProvider } from './algolia/algolia-insight-instant-search-provider.js';
|
|
16
17
|
export { AlgoliaInsightsProvider, AlgoliaInsightsProviderContext } from './algolia/algolia-insights-provider.js';
|
|
17
18
|
export { AlgoliaInstantSearchStateProvider } from './algolia/algolia-instant-search-state-provider.js';
|
|
18
|
-
export { userToken } from './algolia/algolia-intialization.js';
|
|
19
19
|
export { AlgoliaMultiSelectFilterSection } from './algolia/algolia-multi-select-filter-section.js';
|
|
20
20
|
export { AlgoliaPagination } from './algolia/algolia-pagination.js';
|
|
21
21
|
export { AlgoliaProvider, useAlgolia } from './algolia/algolia-provider.js';
|
|
@@ -112,6 +112,7 @@ export { SearchList } from './global-search/search-section/search-list.js';
|
|
|
112
112
|
export { SearchListItem } from './global-search/search-section/search-list-item.js';
|
|
113
113
|
export { SearchSection } from './global-search/search-section/search-section.js';
|
|
114
114
|
export { ConnectedCartIcon } from './header/cart-icon/connected-cart-icon.js';
|
|
115
|
+
export { InfoIconTooltip } from './info-icon-tooltip/info-icon-tooltip.js';
|
|
115
116
|
export { FormattedMessage } from './intl/formatted-message.js';
|
|
116
117
|
export { IntlContext } from './intl/intl-context.js';
|
|
117
118
|
export { IntlProvider } from './intl/intl-provider.js';
|
|
@@ -152,17 +153,20 @@ export { CheckoutPageSectionContent } from './pages/checkout/layouts/checkout-pa
|
|
|
152
153
|
export { CheckoutPageSectionHeader } from './pages/checkout/layouts/checkout-page-layout/components/checkout-page-section-header.js';
|
|
153
154
|
export { CheckoutPageSectionLink } from './pages/checkout/layouts/checkout-page-layout/components/checkout-page-section-link.js';
|
|
154
155
|
export { OrderConfirmationPage } from './pages/checkout/order-confirmation-page/order-confirmation-page.js';
|
|
156
|
+
export { OrderConfirmationPageContent } from './pages/checkout/order-confirmation-page/order-confirmation-page-content.js';
|
|
155
157
|
export { AdyenPayment } from './pages/checkout/payment-page/components/adyen-payment.js';
|
|
156
158
|
export { Payment } from './pages/checkout/payment-page/components/payment.js';
|
|
157
159
|
export { useGetAdyenRedirectResult } from './pages/checkout/payment-page/hooks/use-get-adyen-redirect-result.js';
|
|
158
160
|
export { useHasReturnedFromAdyen } from './pages/checkout/payment-page/hooks/use-has-returned-from-adyen.js';
|
|
159
161
|
export { PaymentPage } from './pages/checkout/payment-page/payment-page.js';
|
|
162
|
+
export { PaymentPageContent } from './pages/checkout/payment-page/payment-page-content.js';
|
|
160
163
|
export { parseAmount } from './pages/checkout/payment-page/utils/parse-amount.js';
|
|
161
164
|
export { EDIT_ADDRESS_FORM_ID, EditAddresses } from './pages/checkout/shipping-page/components/edit-address.js';
|
|
162
165
|
export { ReadOnlyAddresses } from './pages/checkout/shipping-page/components/readonly-address.js';
|
|
163
166
|
export { SonicAddress } from './pages/checkout/shipping-page/components/sonic-address.js';
|
|
164
167
|
export { usePatchShippingDetails } from './pages/checkout/shipping-page/hooks/use-patch-shipping-details.js';
|
|
165
168
|
export { ShippingPage } from './pages/checkout/shipping-page/shipping-page.js';
|
|
169
|
+
export { ShippingPageContent } from './pages/checkout/shipping-page/shipping-page-content.js';
|
|
166
170
|
export { PageContainer } from './pages/components/page-container/page-container.js';
|
|
167
171
|
export { PageMetaData } from './pages/components/page-meta-data/page-meta-data.js';
|
|
168
172
|
export { Page } from './pages/components/page/page.js';
|
|
@@ -245,7 +249,7 @@ export { fetchTranslations } from './shared/api/storefront/services/translation-
|
|
|
245
249
|
export { fetchCountries, fetchCountriesLanguages, fetchCountriesWithLanguages, fetchSettings, updateLocale } from './shared/api/storefront/services/website-service.js';
|
|
246
250
|
export { WishListNameAlreadyExistsError, addWishListItemToWishList, createWishList, deleteWishList, deleteWishListItemFromWishList, getWishList, getWishListItemsByWishListId, getWishLists } from './shared/api/storefront/services/wishlist-service.js';
|
|
247
251
|
export { useFeatureFlags } from './shared/feature-flags/use-feature-flags.js';
|
|
248
|
-
export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isRequestError, request } from './shared/fetch/request.js';
|
|
252
|
+
export { BadRequestError, ForbiddenRequestError, InternalServerErrorRequestError, NotFoundRequestError, RequestError, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, isFormData, isJsonBody, isRequestError, request } from './shared/fetch/request.js';
|
|
249
253
|
export { dataLayer } from './shared/ga/data-layer.js';
|
|
250
254
|
export { GoogleAnalyticsProvider, useGoogleAnalyticsProvider } from './shared/ga/google-analytics-provider.js';
|
|
251
255
|
export { isGAEvent } from './shared/ga/types.js';
|
|
@@ -287,16 +291,17 @@ export { environment, environments } from './shared/utils/environment.js';
|
|
|
287
291
|
export { EventEmitter } from './shared/utils/event-emitter.js';
|
|
288
292
|
export { clone, deepMerge, isPlainObject, default as main, merge } from './shared/utils/merge.js';
|
|
289
293
|
export { currencies, formatPrice, getCurrencyByCountryCode } from './shared/utils/price.js';
|
|
294
|
+
export { isPromise, wait } from './shared/utils/promise.js';
|
|
290
295
|
export { random, randomInt } from './shared/utils/random.js';
|
|
291
296
|
export { camelCase, capitalizeFirstLetter } from './shared/utils/string.js';
|
|
292
297
|
export { TIME } from './shared/utils/time.js';
|
|
293
298
|
export { has, hasNo } from './shared/utils/types.js';
|
|
294
299
|
export { createUUID } from './shared/utils/uuid.js';
|
|
295
|
-
export { wait } from './shared/utils/wait.js';
|
|
296
300
|
export { Sidebar } from './sidebar/sidebar.js';
|
|
297
301
|
export { SidebarDetectBreakpoint, SidebarProvider } from './sidebar/sidebar-provider.js';
|
|
298
302
|
export { ToggleSidebarButton } from './sidebar/toggle-sidebar-button.js';
|
|
299
303
|
export { useSidebar, useSidebarActions } from './sidebar/use-sidebar.js';
|
|
304
|
+
export { SignInForm } from './sign-in-form/sign-in-form.js';
|
|
300
305
|
export { Toast } from './toast/toast.js';
|
|
301
306
|
export { ToastProvider } from './toast/toast-provider.js';
|
|
302
307
|
export { useToast } from './toast/use-toast.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface InfoIconTooltipProps {
|
|
3
|
+
children: string | ReactNode;
|
|
4
|
+
className?: string;
|
|
5
|
+
variant?: 'solid' | 'stroke';
|
|
6
|
+
}
|
|
7
|
+
export declare function InfoIconTooltip({ children, className, variant, }: InfoIconTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { SolidInformationIcon } from '../icons/solid/solid-information-icon.js';
|
|
5
|
+
import { StrokeInformationIcon } from '../icons/stroke/stroke-information-icon.js';
|
|
6
|
+
import { IconButton } from '../buttons/icon-button/icon-button.js';
|
|
7
|
+
import { useFormattedMessage } from '../intl/use-formatted-message.js';
|
|
8
|
+
import { Tooltip } from '../tooltip/tooltip.js';
|
|
9
|
+
import styles from './info-icon-tooltip.module.css.js';
|
|
10
|
+
|
|
11
|
+
function InfoIconTooltip({ children, className, variant = 'solid', }) {
|
|
12
|
+
const t = useFormattedMessage();
|
|
13
|
+
const triggerLabel = t('Information');
|
|
14
|
+
function Icon(props) {
|
|
15
|
+
return (jsx(IconButton, { ...props, className: clsx(styles.trigger), children: variant === 'stroke' ? (jsx(StrokeInformationIcon, { "aria-description": triggerLabel })) : (jsx(SolidInformationIcon, { "aria-description": triggerLabel })) }));
|
|
16
|
+
}
|
|
17
|
+
return (jsx(Tooltip, { className: clsx(className, styles['info-icon-tooltip'], styles[variant]), trigger: jsx(Icon, {}), children: children }));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export { InfoIconTooltip };
|
|
@@ -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 order notes' | 'Add to list' | 'Address' | 'Amount: {0}' | 'An error occurred while processing your payment. Please try again.' | '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?' | 'article' | 'articles' | 'As soon as possible' | 'Attention' | '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.' | 'Company name' | 'Conceal value' | 'Continue shopping' | 'Continue' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Delivery date' | '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' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Features' | 'First name' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'Incl. VAT' | 'Includes' | 'Industry' | 'Language' | 'Last name' | 'List name already exists' | 'New list name' | 'of' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Pay by invoice' | 'Pay' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid e-mail address' | 'Please enter a valid phone number' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Print' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Remove all' | '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 desired delivery date' | 'Select a list' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'sign 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' | 'Submit' | 'Subtotal' | 'Suggestions' | 'tag.limited' | 'tag.new' | '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.' | 'Total amount is' | 'Total' | 'Total' | 'Try another search' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unable to update the product in your cart.' | '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 must ' | 'Your cart has been emptied.' | 'Your favorites are available on multiple devices' | 'Your shopping cart is still empty';
|
|
1
|
+
export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Add order notes' | 'Add to list' | 'Address' | 'Amount: {0}' | 'An error occurred while processing your payment. Please try again.' | '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?' | 'article' | 'articles' | 'As soon as possible' | 'Attention' | '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.' | 'Company name' | 'Conceal value' | 'Continue shopping' | 'Continue' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Delivery date' | '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' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Features' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'Incl. VAT' | 'Includes' | 'Industry' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'New list name' | 'New user?' | 'of' | 'Or sign in as guest' | 'Order number' | 'Order' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Pay by invoice' | 'Pay' | 'Payment method' | 'Payment' | 'Password' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid e-mail address' | 'Please enter a valid phone number' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Print' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Requested delivery date' | 'Remember me' | 'Remove all' | '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 desired delivery date' | 'Select a list' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'sign 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' | 'Submit' | 'Subtotal' | 'Suggestions' | 'tag.limited' | 'tag.new' | '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.' | 'Total amount is' | 'Total' | 'Total' | 'Try another search' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unable to update the product in your cart.' | '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 must ' | 'Your cart has been emptied.' | 'Your favorites are available on multiple devices' | 'Your shopping cart is still empty';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CartModel } from '../../../shared/api/storefront/model/storefront.model';
|
|
2
|
+
export interface OrderConfirmationPageContentProps {
|
|
3
|
+
cart: CartModel;
|
|
4
|
+
}
|
|
5
|
+
export declare function OrderConfirmationPageContent({ cart, }: OrderConfirmationPageContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { PrintButton } from '../../../buttons/print-button/print-button.js';
|
|
3
|
+
import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
|
|
4
|
+
import { CartTotals } from '../../../cart-totals/cart-totals.js';
|
|
5
|
+
import { InfoDisplay } from '../../../display/info-display/info-display.js';
|
|
6
|
+
import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
7
|
+
import { useCultureCode } from '../../../intl/use-culture-code.js';
|
|
8
|
+
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
9
|
+
import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
|
|
10
|
+
import { useSaveCartForLater } from '../../../shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
|
|
11
|
+
import { RouteButton } from '../../../shared/routing/route-button.js';
|
|
12
|
+
import { formatDateToLocaleString } from '../../../shared/utils/date.js';
|
|
13
|
+
import { useToast } from '../../../toast/use-toast.js';
|
|
14
|
+
import { Page } from '../../components/page/page.js';
|
|
15
|
+
import { BillingAndInvoiceInformation } from '../components/billing-and-invoice-information.js';
|
|
16
|
+
import { CHECKOUT_PATHS } from '../constants.js';
|
|
17
|
+
import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
|
|
18
|
+
import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
19
|
+
import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
20
|
+
import styles from './order-confirmation-page.module.css.js';
|
|
21
|
+
|
|
22
|
+
function OrderConfirmationPageContent({ cart, }) {
|
|
23
|
+
const t = useFormattedMessage();
|
|
24
|
+
const { addToast } = useToast();
|
|
25
|
+
const cultureCode = useCultureCode();
|
|
26
|
+
const saveCartForLater = useSaveCartForLater({
|
|
27
|
+
onError: () => {
|
|
28
|
+
addToast({
|
|
29
|
+
body: jsx(FormattedMessage, { id: "Unable to save cart for later." }),
|
|
30
|
+
isUserDismissable: false,
|
|
31
|
+
messageType: 'danger',
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
onSuccess: () => {
|
|
35
|
+
addToast({
|
|
36
|
+
body: jsx(FormattedMessage, { id: "Saved cart for later." }),
|
|
37
|
+
isUserDismissable: false,
|
|
38
|
+
messageType: 'success',
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
return (jsx(Page, { breadCrumb: [{ href: CHECKOUT_PATHS.HOME, label: t('Home') }], title: t('Order confirmation'), children: jsx(CheckoutPageLayout, { actions: {
|
|
43
|
+
primary: (jsx(RouteButton, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", href: "/", children: jsx(FormattedMessage, { id: "Continue shopping" }) })),
|
|
44
|
+
secondary: (jsxs(Fragment, { children: [cart.canSaveOrder && (jsx(RouteButton, { color: "secondary", onClick: () => {
|
|
45
|
+
saveCartForLater.mutate({ cart });
|
|
46
|
+
}, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })), jsx(PrintButton, {})] })),
|
|
47
|
+
}, overview: jsx(CartTotals, { fulfillmentMethod: t(`fulfillmentmethod.${cart.fulfillmentMethod}`), orderNumber: cart.orderNumber, shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, vatPercentage: cart.cartLines?.[0]?.pricing?.vatRate }), children: jsxs("div", { children: [jsx(CheckoutPageSection, { hasBorder: false, title: t('General'), children: jsx(CheckoutPageSectionContent, { children: jsxs("div", { className: styles['general-order-info'], children: [cart.orderDate && (jsx(InfoDisplay, { id: "order-date", label: t('Order date'), value: formatDateToLocaleString(new Date(cart.orderDate), cultureCode) })), cart.requestedDeliveryDateDisplay && (jsx(InfoDisplay, { id: "requested-delivery-date", label: t('Requested delivery date'), value: formatDateToLocaleString(new Date(cart.requestedDeliveryDateDisplay.toString()), cultureCode) })), cart.poNumber && (jsx(InfoDisplay, { id: "po-number", label: t('PO Number'), value: cart.poNumber }))] }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Billing and shipping information'), children: jsx(CheckoutPageSectionContent, { children: jsx(BillingAndInvoiceInformation, { billToAddress: {
|
|
48
|
+
address1: cart.billTo?.address1,
|
|
49
|
+
address2: cart.billTo?.address2,
|
|
50
|
+
address3: cart.billTo?.address3,
|
|
51
|
+
city: cart.billTo?.city,
|
|
52
|
+
companyName: cart.billTo?.companyName,
|
|
53
|
+
country: cart.billTo?.country?.name,
|
|
54
|
+
email: cart.billTo?.email,
|
|
55
|
+
phone: cart.billTo?.phone,
|
|
56
|
+
postalCode: cart.billTo?.postalCode,
|
|
57
|
+
}, shipToAddress: {
|
|
58
|
+
address1: cart.shipTo?.address1,
|
|
59
|
+
address2: cart.shipTo?.address2,
|
|
60
|
+
address3: cart.shipTo?.address3,
|
|
61
|
+
city: cart.shipTo?.city,
|
|
62
|
+
companyName: cart.shipTo?.companyName,
|
|
63
|
+
country: cart.shipTo?.country?.name,
|
|
64
|
+
email: cart.shipTo?.email,
|
|
65
|
+
phone: cart.shipTo?.phone,
|
|
66
|
+
postalCode: cart.shipTo?.postalCode,
|
|
67
|
+
} }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Order'), children: jsx(CheckoutPageSectionContent, { stretch: true, children: jsx(OrderLineList, { children: cart.cartLines?.map(cartLine => (jsx(OrderLineCard, { deliveryDate: cartLine.atp?.date, href: cartLine.productUri, image: {
|
|
68
|
+
fit: 'contain',
|
|
69
|
+
image: {
|
|
70
|
+
'1': cartLine.smallImagePath,
|
|
71
|
+
'2': cartLine.smallImagePath,
|
|
72
|
+
'3': cartLine.smallImagePath,
|
|
73
|
+
altText: cartLine.altText,
|
|
74
|
+
},
|
|
75
|
+
title: cartLine.altText,
|
|
76
|
+
}, isReadonly: true, price: {
|
|
77
|
+
originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
|
|
78
|
+
pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
|
|
79
|
+
totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
|
|
80
|
+
}, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }) }));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { OrderConfirmationPageContent };
|
|
@@ -1,36 +1,16 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import { PrintButton } from '../../../buttons/print-button/print-button.js';
|
|
4
|
-
import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
|
|
5
|
-
import { CartTotals } from '../../../cart-totals/cart-totals.js';
|
|
6
|
-
import { InfoDisplay } from '../../../display/info-display/info-display.js';
|
|
7
|
-
import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
8
|
-
import { useCultureCode } from '../../../intl/use-culture-code.js';
|
|
9
|
-
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
10
|
-
import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
|
|
11
3
|
import { LoadingPage } from '../../loading-page/loading-page.js';
|
|
12
4
|
import { useIsAuthenticated } from '../../../shared/api/storefront/hooks/authentication/use-is-authenticated.js';
|
|
13
5
|
import { useFetchCartById } from '../../../shared/api/storefront/hooks/cart/use-fetch-cart-by-id.js';
|
|
14
|
-
import { useSaveCartForLater } from '../../../shared/api/storefront/hooks/cart/use-save-cart-for-later.js';
|
|
15
|
-
import { RouteButton } from '../../../shared/routing/route-button.js';
|
|
16
6
|
import { useNavigate } from '../../../shared/routing/route-provider.js';
|
|
17
|
-
import { formatDateToLocaleString } from '../../../shared/utils/date.js';
|
|
18
7
|
import { hasNo } from '../../../shared/utils/types.js';
|
|
19
|
-
import { useToast } from '../../../toast/use-toast.js';
|
|
20
|
-
import { Page } from '../../components/page/page.js';
|
|
21
8
|
import { ErrorPage } from '../../error-page/error-page.js';
|
|
22
|
-
import { BillingAndInvoiceInformation } from '../components/billing-and-invoice-information.js';
|
|
23
9
|
import { CHECKOUT_PATHS } from '../constants.js';
|
|
24
|
-
import {
|
|
25
|
-
import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
26
|
-
import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
27
|
-
import styles from './order-confirmation-page.module.css.js';
|
|
10
|
+
import { OrderConfirmationPageContent } from './order-confirmation-page-content.js';
|
|
28
11
|
|
|
29
12
|
function OrderConfirmationPage({ cartId }) {
|
|
30
13
|
const isAuthenticated = useIsAuthenticated();
|
|
31
|
-
const t = useFormattedMessage();
|
|
32
|
-
const cultureCode = useCultureCode();
|
|
33
|
-
const { addToast } = useToast();
|
|
34
14
|
const { isNavigating, navigate } = useNavigate();
|
|
35
15
|
const { data: cart, error, isLoading: cartIsLoading, } = useFetchCartById({
|
|
36
16
|
id: cartId,
|
|
@@ -45,22 +25,6 @@ function OrderConfirmationPage({ cartId }) {
|
|
|
45
25
|
if (cart.status === 'Cart')
|
|
46
26
|
navigate(CHECKOUT_PATHS.CART);
|
|
47
27
|
}, [cart, navigate, isAuthenticated]);
|
|
48
|
-
const saveCartForLater = useSaveCartForLater({
|
|
49
|
-
onError: () => {
|
|
50
|
-
addToast({
|
|
51
|
-
body: jsx(FormattedMessage, { id: "Unable to save cart for later." }),
|
|
52
|
-
isUserDismissable: false,
|
|
53
|
-
messageType: 'danger',
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
onSuccess: () => {
|
|
57
|
-
addToast({
|
|
58
|
-
body: jsx(FormattedMessage, { id: "Saved cart for later." }),
|
|
59
|
-
isUserDismissable: false,
|
|
60
|
-
messageType: 'success',
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
28
|
if (error)
|
|
65
29
|
return jsx(ErrorPage, { error: error });
|
|
66
30
|
if (cartIsLoading || isNavigating)
|
|
@@ -71,45 +35,7 @@ function OrderConfirmationPage({ cartId }) {
|
|
|
71
35
|
cart.cartLines.length === 0) {
|
|
72
36
|
return null;
|
|
73
37
|
}
|
|
74
|
-
return
|
|
75
|
-
primary: (jsx(RouteButton, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", href: "/", children: jsx(FormattedMessage, { id: "Continue shopping" }) })),
|
|
76
|
-
secondary: (jsxs(Fragment, { children: [cart.canSaveOrder && (jsx(RouteButton, { color: "secondary", onClick: () => {
|
|
77
|
-
saveCartForLater.mutate({ cart });
|
|
78
|
-
}, variant: "outline", children: jsx(FormattedMessage, { id: "Save order" }) })), jsx(PrintButton, {})] })),
|
|
79
|
-
}, overview: jsx(CartTotals, { fulfillmentMethod: t(`fulfillmentmethod.${cart.fulfillmentMethod}`), orderNumber: cart.orderNumber, shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, vatPercentage: cart.cartLines[0]?.pricing?.vatRate }), children: jsxs("div", { children: [jsx(CheckoutPageSection, { hasBorder: false, title: t('General'), children: jsx(CheckoutPageSectionContent, { children: jsxs("div", { className: styles['general-order-info'], children: [cart.orderDate && (jsx(InfoDisplay, { id: "order-date", label: t('Order date'), value: formatDateToLocaleString(new Date(cart.orderDate), cultureCode) })), cart.requestedDeliveryDate && (jsx(InfoDisplay, { id: "requested-delivery-date", label: t('Requested delivery date'), value: formatDateToLocaleString(new Date(cart.requestedDeliveryDate), cultureCode) })), cart.poNumber && (jsx(InfoDisplay, { id: "po-number", label: t('PO Number'), value: cart.poNumber }))] }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Billing and shipping information'), children: jsx(CheckoutPageSectionContent, { children: jsx(BillingAndInvoiceInformation, { billToAddress: {
|
|
80
|
-
address1: cart.billTo?.address1,
|
|
81
|
-
address2: cart.billTo?.address2,
|
|
82
|
-
address3: cart.billTo?.address3,
|
|
83
|
-
city: cart.billTo?.city,
|
|
84
|
-
companyName: cart.billTo?.companyName,
|
|
85
|
-
country: cart.billTo?.country?.name,
|
|
86
|
-
email: cart.billTo?.email,
|
|
87
|
-
phone: cart.billTo?.phone,
|
|
88
|
-
postalCode: cart.billTo?.postalCode,
|
|
89
|
-
}, shipToAddress: {
|
|
90
|
-
address1: cart.shipTo?.address1,
|
|
91
|
-
address2: cart.shipTo?.address2,
|
|
92
|
-
address3: cart.shipTo?.address3,
|
|
93
|
-
city: cart.shipTo?.city,
|
|
94
|
-
companyName: cart.shipTo?.companyName,
|
|
95
|
-
country: cart.shipTo?.country?.name,
|
|
96
|
-
email: cart.shipTo?.email,
|
|
97
|
-
phone: cart.shipTo?.phone,
|
|
98
|
-
postalCode: cart.shipTo?.postalCode,
|
|
99
|
-
} }) }) }), jsx(CheckoutPageSection, { hasBorder: false, title: t('Order'), children: jsx(CheckoutPageSectionContent, { stretch: true, children: jsx(OrderLineList, { children: cart.cartLines.map(cartLine => (jsx(OrderLineCard, { deliveryDate: cartLine.atp?.date, href: cartLine.productUri, image: {
|
|
100
|
-
fit: 'contain',
|
|
101
|
-
image: {
|
|
102
|
-
'1': cartLine.smallImagePath,
|
|
103
|
-
'2': cartLine.smallImagePath,
|
|
104
|
-
'3': cartLine.smallImagePath,
|
|
105
|
-
altText: cartLine.altText,
|
|
106
|
-
},
|
|
107
|
-
title: cartLine.altText,
|
|
108
|
-
}, isReadonly: true, price: {
|
|
109
|
-
originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
|
|
110
|
-
pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
|
|
111
|
-
totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
|
|
112
|
-
}, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }) }));
|
|
38
|
+
return jsx(OrderConfirmationPageContent, { cart: cart });
|
|
113
39
|
}
|
|
114
40
|
|
|
115
41
|
export { OrderConfirmationPage };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useRef, useState, useMemo, useEffect, useCallback } from 'react';
|
|
3
3
|
import { Form } from 'react-aria-components';
|
|
4
|
+
import { useAlgoliaInsights } from '../../../../algolia/use-algolia-insights.js';
|
|
4
5
|
import { Accordion } from '../../../../collapsables/accordion/accordion.js';
|
|
5
6
|
import { AccordionItem } from '../../../../collapsables/accordion/accordion-item.js';
|
|
6
7
|
import { config } from '../../../../config.js';
|
|
@@ -8,6 +9,7 @@ import { InfoDisplay } from '../../../../display/info-display/info-display.js';
|
|
|
8
9
|
import { Checkbox } from '../../../../forms/checkbox/checkbox.js';
|
|
9
10
|
import { Select } from '../../../../forms/select/select.js';
|
|
10
11
|
import { TextField } from '../../../../forms/text-field/text-field.js';
|
|
12
|
+
import { InfoIconTooltip } from '../../../../info-icon-tooltip/info-icon-tooltip.js';
|
|
11
13
|
import { FormattedMessage } from '../../../../intl/formatted-message.js';
|
|
12
14
|
import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
|
|
13
15
|
import { usePatchSession } from '../../../../shared/api/storefront/hooks/authentication/use-patch-session.js';
|
|
@@ -15,18 +17,20 @@ import { usePatchCart } from '../../../../shared/api/storefront/hooks/cart/use-p
|
|
|
15
17
|
import { usePlaceOrder } from '../../../../shared/api/storefront/hooks/cart/use-place-order.js';
|
|
16
18
|
import { useInvalidateAdyen } from '../../../../shared/api/storefront/hooks/payment/use-invalidate-adyen.js';
|
|
17
19
|
import { validateVATNumber } from '../../../../shared/api/storefront/services/finance-service.js';
|
|
20
|
+
import { useDataLayer } from '../../../../shared/ga/use-data-layer.js';
|
|
18
21
|
import { useDebouncedCallback } from '../../../../shared/hooks/use-debounced-callback.js';
|
|
19
22
|
import { currencySymbolToISO } from '../../../../shared/model/currency.js';
|
|
20
|
-
import { Tooltip } from '../../../../tooltip/tooltip.js';
|
|
21
23
|
import { BillingAndInvoiceInformation } from '../../components/billing-and-invoice-information.js';
|
|
22
24
|
import { useHasReturnedFromAdyen } from '../hooks/use-has-returned-from-adyen.js';
|
|
23
25
|
import { AdyenPayment } from './adyen-payment.js';
|
|
24
26
|
import styles from './payment.module.css.js';
|
|
25
27
|
|
|
26
28
|
function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete, onProcessing, onValidating, }) {
|
|
29
|
+
const { createEcommerceEvent, dataLayer } = useDataLayer();
|
|
27
30
|
const { isLoading: isPatchingCart, mutate: patchCart } = usePatchCart();
|
|
28
31
|
const { isLoading: isPatchingSession } = usePatchSession();
|
|
29
32
|
const { isLoading: isPlacingCart, mutate: placeOrder } = usePlaceOrder();
|
|
33
|
+
const { sendPurchaseEventFromPaymentPage } = useAlgoliaInsights();
|
|
30
34
|
const dropinRef = useRef(null);
|
|
31
35
|
const [paymentError, setPaymentError] = useState();
|
|
32
36
|
const [apiError, setAPIError] = useState();
|
|
@@ -104,6 +108,40 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
104
108
|
setIsValidatingVAT(false);
|
|
105
109
|
}
|
|
106
110
|
}, 500);
|
|
111
|
+
const onPlaceOrderCompleted = useCallback(({ cart, payment_type }) => {
|
|
112
|
+
dataLayer.push(createEcommerceEvent({
|
|
113
|
+
cart,
|
|
114
|
+
event: {
|
|
115
|
+
ecommerce: {
|
|
116
|
+
payment_type,
|
|
117
|
+
},
|
|
118
|
+
event: 'add_payment_info',
|
|
119
|
+
},
|
|
120
|
+
}), createEcommerceEvent({
|
|
121
|
+
cart,
|
|
122
|
+
event: {
|
|
123
|
+
ecommerce: {
|
|
124
|
+
payment_type,
|
|
125
|
+
},
|
|
126
|
+
event: 'purchase',
|
|
127
|
+
},
|
|
128
|
+
}), {
|
|
129
|
+
currency: currencySymbolToISO[cart.currencySymbol],
|
|
130
|
+
event: 'transactionComplete',
|
|
131
|
+
transactionAffiliation: cart.billTo?.companyName,
|
|
132
|
+
transactionId: cart.orderNumber,
|
|
133
|
+
transactionProducts: cart.cartLines?.map(cartLine => ({
|
|
134
|
+
name: cartLine.shortDescription,
|
|
135
|
+
price: cartLine.pricing?.unitNetPrice,
|
|
136
|
+
quantity: cartLine.qtyOrdered,
|
|
137
|
+
sku: cartLine.erpNumber,
|
|
138
|
+
})) || [],
|
|
139
|
+
transactionShipping: cart.shippingAndHandling,
|
|
140
|
+
transactionTax: cart.totalTax,
|
|
141
|
+
transactionTotal: cart.orderGrandTotal,
|
|
142
|
+
});
|
|
143
|
+
sendPurchaseEventFromPaymentPage({ cart });
|
|
144
|
+
}, [createEcommerceEvent, dataLayer, sendPurchaseEventFromPaymentPage]);
|
|
107
145
|
async function onSubmit(e) {
|
|
108
146
|
const formData = new FormData(e.currentTarget);
|
|
109
147
|
const cart = cartRef.current;
|
|
@@ -151,6 +189,10 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
151
189
|
const cart = cartRef.current;
|
|
152
190
|
try {
|
|
153
191
|
await placeOrder({ cart });
|
|
192
|
+
onPlaceOrderCompleted({
|
|
193
|
+
cart,
|
|
194
|
+
payment_type: cart.paymentMethod?.name || '',
|
|
195
|
+
});
|
|
154
196
|
return onPaymentComplete({ cartId: cart.trackId });
|
|
155
197
|
}
|
|
156
198
|
catch (error) {
|
|
@@ -175,14 +217,17 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
175
217
|
},
|
|
176
218
|
},
|
|
177
219
|
});
|
|
220
|
+
onPlaceOrderCompleted({
|
|
221
|
+
cart,
|
|
222
|
+
payment_type: 'Adyen',
|
|
223
|
+
});
|
|
178
224
|
return onPaymentComplete({ cartId: cart.trackId });
|
|
179
225
|
}
|
|
180
226
|
catch (error) {
|
|
181
227
|
console.error(error);
|
|
182
|
-
// TODO: Errors from the placeOrder call are not displayed
|
|
183
228
|
setAPIError(error);
|
|
184
229
|
}
|
|
185
|
-
}, [onPaymentComplete, placeOrder]);
|
|
230
|
+
}, [onPaymentComplete, onPlaceOrderCompleted, placeOrder]);
|
|
186
231
|
const onError = useCallback((error, result) => {
|
|
187
232
|
invalidateAdyen();
|
|
188
233
|
// invalidateCurrentCart()
|
|
@@ -197,7 +242,7 @@ function Payment({ atp, cart: _cart, form, onError: _onError, onPaymentComplete,
|
|
|
197
242
|
setAsSoonAsPossible(checked);
|
|
198
243
|
if (checked)
|
|
199
244
|
setDeliveryDate('');
|
|
200
|
-
}, children: jsx(FormattedMessage, { id: "As soon as possible" }) }), jsx(
|
|
245
|
+
}, children: jsx(FormattedMessage, { id: "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: hasReturnedFromAdyen, label: t('Industry'), name: "industry", options: {
|
|
201
246
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
202
247
|
PP: 'Private User',
|
|
203
248
|
AU: 'Automotive',
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CartModel, CheckoutAtpEntry } from '../../../shared/api/storefront/model/storefront.model';
|
|
2
|
+
export interface PaymentContentProps {
|
|
3
|
+
atp: CheckoutAtpEntry[];
|
|
4
|
+
cart: CartModel;
|
|
5
|
+
formId: string;
|
|
6
|
+
hasAtp: boolean;
|
|
7
|
+
isProcessing: boolean;
|
|
8
|
+
isValidating: boolean;
|
|
9
|
+
onPaymentComplete: ({ cartId }: {
|
|
10
|
+
cartId: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
setIsProcessing: (isProcessing: boolean) => void;
|
|
13
|
+
setIsValidating: (isValidating: boolean) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidating, onPaymentComplete, setIsProcessing, setIsValidating, }: PaymentContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Button } from '../../../buttons/button/button.js';
|
|
3
|
+
import { OrderLineCard } from '../../../cards/orderline-card/orderline-card.js';
|
|
4
|
+
import { CartTotals } from '../../../cart-totals/cart-totals.js';
|
|
5
|
+
import { CartTotalsSummary } from '../../../cart-totals/cart-totals-summary.js';
|
|
6
|
+
import { FormattedMessage } from '../../../intl/formatted-message.js';
|
|
7
|
+
import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
|
|
8
|
+
import { OrderLineList } from '../../../lists/orderline-list/orderline-list.js';
|
|
9
|
+
import { Page } from '../../components/page/page.js';
|
|
10
|
+
import { CHECKOUT_PATHS } from '../constants.js';
|
|
11
|
+
import { CheckoutPageLayout } from '../layouts/checkout-page-layout/checkout-page-layout.js';
|
|
12
|
+
import { CheckoutPageSection } from '../layouts/checkout-page-layout/components/checkout-page-section.js';
|
|
13
|
+
import { CheckoutPageSectionContent } from '../layouts/checkout-page-layout/components/checkout-page-section-content.js';
|
|
14
|
+
import { Payment } from './components/payment.js';
|
|
15
|
+
|
|
16
|
+
function PaymentPageContent({ atp, cart, formId, hasAtp, isProcessing, isValidating, onPaymentComplete, setIsProcessing, setIsValidating, }) {
|
|
17
|
+
const t = useFormattedMessage();
|
|
18
|
+
return (jsx(Page, { breadCrumb: [
|
|
19
|
+
{ href: CHECKOUT_PATHS.HOME, label: t('Home') },
|
|
20
|
+
{
|
|
21
|
+
href: CHECKOUT_PATHS.REVIEW_AND_SUBMIT,
|
|
22
|
+
label: t('Review and payment'),
|
|
23
|
+
},
|
|
24
|
+
], title: t('Review and payment'), children: jsxs(CheckoutPageLayout, { actions: {
|
|
25
|
+
primary: (jsx(Button, { withArrow: true, "data-test-selector": "checkoutShippingCartTotalContinueButton", form: formId, isDisabled: isProcessing, isLoading: isProcessing ? (jsx(FormattedMessage, { id: "Processing" })) : isValidating ? (jsx(FormattedMessage, { id: "Validating" })) : (false), type: "submit", children: jsx(FormattedMessage, { id: "Pay" }) })),
|
|
26
|
+
}, mobileSummary: jsx(CartTotalsSummary, { totalAmount: cart.orderGrandTotalDisplay }), overview: jsx(CartTotals, { deliveryDate: hasAtp ? undefined : cart.requestedDeliveryDate, fulfillmentMethod: cart.fulfillmentMethod, isPayByInvoice: (cart.paymentOptions?.paymentMethods?.length || 1) <= 1 &&
|
|
27
|
+
cart.paymentMethod?.name === 'PBI', shippingCost: cart.shippingAndHandlingDisplay, subtotal: cart.orderSubTotalDisplay, tax: cart.totalTaxDisplay, total: cart.orderGrandTotalDisplay, 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, onPaymentComplete: onPaymentComplete, onProcessing: setIsProcessing, onValidating: setIsValidating }) }) }), 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: {
|
|
28
|
+
fit: 'contain',
|
|
29
|
+
image: {
|
|
30
|
+
'1': cartLine.smallImagePath,
|
|
31
|
+
'2': cartLine.smallImagePath,
|
|
32
|
+
'3': cartLine.smallImagePath,
|
|
33
|
+
altText: cartLine.altText,
|
|
34
|
+
},
|
|
35
|
+
title: cartLine.altText,
|
|
36
|
+
}, isReadonly: true, price: {
|
|
37
|
+
originalTotalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
|
|
38
|
+
pricePerUnit: cartLine.pricing?.unitNetPrice || 0,
|
|
39
|
+
totalPrice: cartLine.pricing?.extendedUnitNetPrice || 0,
|
|
40
|
+
}, productId: cartLine.productId || '', quantity: cartLine.qtyOrdered || 1, sku: cartLine.erpNumber || '', tags: [], title: cartLine.productName }, cartLine.id))) }) }) })] }) }));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { PaymentPageContent };
|