@sonic-equipment/ui 244.0.0 → 245.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/config.js +3 -13
- package/dist/index.js +1 -1
- package/dist/pages/checkout/payment-page/components/payment.js +2 -2
- package/dist/shared/error/default-error-view.js +2 -2
- package/dist/shared/providers/react-query-container.js +2 -2
- package/dist/shared/utils/environment.d.ts +3 -2
- package/dist/shared/utils/environment.js +2 -6
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -60,12 +60,11 @@ const configPerEnvironment = {
|
|
|
60
60
|
production: () => ({
|
|
61
61
|
ALGOLIA_API_KEY: 'e31a3a53449eceb4d0f9273b9bcd9759',
|
|
62
62
|
ALGOLIA_APP_ID: '14CUFCVMAD',
|
|
63
|
-
ALGOLIA_HOST: '
|
|
64
|
-
BFF_API_URL: 'https://
|
|
63
|
+
ALGOLIA_HOST: 'shopapi.sonic-equipment.com',
|
|
64
|
+
BFF_API_URL: 'https://shopapi.sonic-equipment.com/api/v1/bff',
|
|
65
65
|
COOKIE_DOMAIN: '.sonic-equipment.com',
|
|
66
66
|
HOME_PAGE_URL: 'https://sonic-equipment.com/',
|
|
67
|
-
|
|
68
|
-
SHOP_API_URL: env?.VITE_SHOP_API_URL || 'https://shop.sonic-equipment.com',
|
|
67
|
+
SHOP_API_URL: 'https://shopapi.sonic-equipment.com',
|
|
69
68
|
}),
|
|
70
69
|
sandbox: () => ({
|
|
71
70
|
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
@@ -85,15 +84,6 @@ const configPerEnvironment = {
|
|
|
85
84
|
HOME_PAGE_URL: 'https://shop-accept.sonic-equipment.workers.dev/',
|
|
86
85
|
SHOP_API_URL: 'https://shop-accept.sonic-equipment.workers.dev',
|
|
87
86
|
}),
|
|
88
|
-
'spire-production': () => ({
|
|
89
|
-
ALGOLIA_API_KEY: 'e31a3a53449eceb4d0f9273b9bcd9759',
|
|
90
|
-
ALGOLIA_APP_ID: '14CUFCVMAD',
|
|
91
|
-
ALGOLIA_HOST: 'shopapi.sonic-equipment.com',
|
|
92
|
-
BFF_API_URL: 'https://shopapi.sonic-equipment.com/api/v1/bff',
|
|
93
|
-
COOKIE_DOMAIN: '.sonic-equipment.com',
|
|
94
|
-
HOME_PAGE_URL: 'https://sonic-equipment.com/',
|
|
95
|
-
SHOP_API_URL: 'https://shopapi.sonic-equipment.com',
|
|
96
|
-
}),
|
|
97
87
|
storybook: () => ({
|
|
98
88
|
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
99
89
|
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
package/dist/index.js
CHANGED
|
@@ -464,7 +464,7 @@ export { childrenToText } from './shared/utils/children-to-text.js';
|
|
|
464
464
|
export { getCssPropertyValue } from './shared/utils/css.js';
|
|
465
465
|
export { formatDate } from './shared/utils/date.js';
|
|
466
466
|
export { trackPropertyChange } from './shared/utils/debug.js';
|
|
467
|
-
export { environment, environments } from './shared/utils/environment.js';
|
|
467
|
+
export { environment, environments, isProductionEnvironment } from './shared/utils/environment.js';
|
|
468
468
|
export { EventEmitter } from './shared/utils/event-emitter.js';
|
|
469
469
|
export { useGreeting } from './shared/utils/greeting.js';
|
|
470
470
|
export { clone, deepMerge, isPlainObject, default as main, merge } from './shared/utils/merge.js';
|
|
@@ -20,7 +20,7 @@ import { useInvalidateCurrentCart } from '../../../../shared/api/storefront/hook
|
|
|
20
20
|
import { useInvalidateAdyen } from '../../../../shared/api/storefront/hooks/payment/use-invalidate-adyen.js';
|
|
21
21
|
import { useDataLayer } from '../../../../shared/ga/use-data-layer.js';
|
|
22
22
|
import { getCurrencyCodeBySymbol } from '../../../../shared/model/currency.js';
|
|
23
|
-
import {
|
|
23
|
+
import { isProductionEnvironment } from '../../../../shared/utils/environment.js';
|
|
24
24
|
import { BillingAndInvoiceInformation } from '../../components/billing-and-invoice-information.js';
|
|
25
25
|
import { useHasReturnedFromAdyen } from '../hooks/use-has-returned-from-adyen.js';
|
|
26
26
|
import { AdyenPayment } from './adyen-payment.js';
|
|
@@ -244,7 +244,7 @@ function Payment({ atp, cart: _cart, form, isProcessing, onError: _onError, onPa
|
|
|
244
244
|
MA: t('industry.MA'),
|
|
245
245
|
OT: t('industry.OT'),
|
|
246
246
|
/* eslint-enable sort-keys-fix/sort-keys-fix */
|
|
247
|
-
}, placeholder: t('Select an industry'), variant: "solid" }), jsx(TextField, { showLabel: true, defaultValue: cart.customerVatNumber, isDisabled: isDisabled, label: t('VAT Number'), minLength: 8, name: "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:
|
|
247
|
+
}, placeholder: t('Select an industry'), variant: "solid" }), jsx(TextField, { showLabel: true, defaultValue: cart.customerVatNumber, isDisabled: isDisabled, label: t('VAT Number'), minLength: 8, name: "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: isProductionEnvironment ? 'live' : 'test', isDisabled: isDisabled, onComplete: onComplete, onError: onError, orderAmount: cart.orderGrandTotal, returnUrl:
|
|
248
248
|
/* eslint-disable ssr-friendly/no-dom-globals-in-react-fc */
|
|
249
249
|
typeof window === 'undefined'
|
|
250
250
|
? ''
|
|
@@ -6,10 +6,10 @@ import { Details } from '../../display/details/details.js';
|
|
|
6
6
|
import { StrokeRecentIcon } from '../../icons/stroke/stroke-recent-icon.js';
|
|
7
7
|
import { useFormattedMessage } from '../../intl/use-formatted-message.js';
|
|
8
8
|
import { Heading } from '../../typography/heading/heading.js';
|
|
9
|
-
import {
|
|
9
|
+
import { isProductionEnvironment } from '../utils/environment.js';
|
|
10
10
|
import styles from './default-error-view.module.css.js';
|
|
11
11
|
|
|
12
|
-
function DefaultErrorView({ className, error, errorInfo, resetError, resetLabel, showErrorDetails =
|
|
12
|
+
function DefaultErrorView({ className, error, errorInfo, resetError, resetLabel, showErrorDetails = !isProductionEnvironment, showReset, title, }) {
|
|
13
13
|
const t = useFormattedMessage();
|
|
14
14
|
return (jsxs("section", { className: clsx(styles['default-error-view'], className), children: [title && (jsx(Heading, { className: styles['title'], size: "s", tag: "h1", children: title || t('Something went wrong') })), jsx("p", { children: error.message || t('An unexpected error occured. Please try again.') }), showErrorDetails && (jsxs(Details, { className: styles['error-details'], lang: "en", summary: "Technical Details (only visible in development mode)", children: [jsx("output", { className: styles['error-kind'], children: error.toString() }), error.stack && (jsxs("div", { className: styles['error-info'], children: [jsx(Heading, { className: styles['error-info-title'], size: "xs", tag: "h2", children: "Stack:" }), jsx("pre", { className: styles['error-info-data'], children: error.stack })] })), errorInfo?.componentStack && (jsxs("div", { className: styles['component-info'], children: [jsx(Heading, { className: styles['error-info-title'], size: "xs", tag: "h2", children: "Component stack:" }), jsx("pre", { className: styles['error-info-data'], children: errorInfo.componentStack })] }))] })), showReset && resetError && (jsx(Button, { light: true, className: styles['reset-button'], color: "secondary", icon: jsx(StrokeRecentIcon, {}), onClick: resetError, size: "sm", type: "button", variant: "outline", children: resetLabel || t('Reset') }))] }));
|
|
15
15
|
}
|
|
@@ -3,11 +3,11 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
5
5
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
|
6
|
-
import {
|
|
6
|
+
import { isProductionEnvironment } from '../utils/environment.js';
|
|
7
7
|
import { createQueryClient } from '../utils/query-client.js';
|
|
8
8
|
|
|
9
9
|
const globalQueryClient = createQueryClient();
|
|
10
|
-
function ReactQueryContainer({ children, enableDevTools =
|
|
10
|
+
function ReactQueryContainer({ children, enableDevTools = !isProductionEnvironment, queryClient: _queryClient, }) {
|
|
11
11
|
const queryClient = useMemo(() => _queryClient || createQueryClient(), [_queryClient]);
|
|
12
12
|
return (jsxs(QueryClientProvider, { client: queryClient, children: [enableDevTools && jsx(ReactQueryDevtools, { initialIsOpen: false }), children instanceof Function ? children({ queryClient }) : children] }));
|
|
13
13
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare const environments: readonly ["marketingLocal", "sandbox", "sandbox-reverse-proxy", "production", "local", "storybook", "next-production", "next-development"
|
|
1
|
+
export declare const environments: readonly ["marketingLocal", "sandbox", "sandbox-reverse-proxy", "production", "local", "storybook", "next-production", "next-development"];
|
|
2
2
|
export type Environment = (typeof environments)[number];
|
|
3
|
-
export declare const environment: "marketingLocal" | "sandbox" | "sandbox-reverse-proxy" | "production" | "local" | "storybook" | "next-production" | "next-development"
|
|
3
|
+
export declare const environment: "marketingLocal" | "sandbox" | "sandbox-reverse-proxy" | "production" | "local" | "storybook" | "next-production" | "next-development";
|
|
4
|
+
export declare const isProductionEnvironment: boolean;
|
|
@@ -9,7 +9,6 @@ const environments = [
|
|
|
9
9
|
'storybook',
|
|
10
10
|
'next-production',
|
|
11
11
|
'next-development',
|
|
12
|
-
'spire-production',
|
|
13
12
|
];
|
|
14
13
|
const marketingLocal = /marketing.local.com/i;
|
|
15
14
|
const storybookUrls = /localhost:6006|storybook.sonic.local.com/i;
|
|
@@ -17,7 +16,6 @@ const localUrls = /sonic.local.com/i;
|
|
|
17
16
|
const reverseProxyUrls = /sonic-equipment.workers.dev/i;
|
|
18
17
|
const sandboxUrls = /local|insitesandbox.com|azurestaticapps|ui.sonic-equipment.com|sandbox|accept|test/i;
|
|
19
18
|
const productionUrls = /sonic-equipment.com|production/i;
|
|
20
|
-
const spireProductionUrls = /spire.sonic-equipment.com/i;
|
|
21
19
|
let environmentUrl;
|
|
22
20
|
function getEnvironment() {
|
|
23
21
|
if (typeof process !== 'undefined' && process.env.IS_NEXT === 'true') {
|
|
@@ -56,9 +54,6 @@ function getEnvironment() {
|
|
|
56
54
|
else if (sandboxUrls.test(environmentUrl)) {
|
|
57
55
|
environment = 'sandbox';
|
|
58
56
|
}
|
|
59
|
-
else if (spireProductionUrls.test(environmentUrl)) {
|
|
60
|
-
environment = 'spire-production';
|
|
61
|
-
}
|
|
62
57
|
else if (productionUrls.test(environmentUrl)) {
|
|
63
58
|
environment = 'production';
|
|
64
59
|
}
|
|
@@ -69,5 +64,6 @@ function getEnvironment() {
|
|
|
69
64
|
return environment;
|
|
70
65
|
}
|
|
71
66
|
const environment = getEnvironment();
|
|
67
|
+
const isProductionEnvironment = environment.includes('production');
|
|
72
68
|
|
|
73
|
-
export { environment, environments };
|
|
69
|
+
export { environment, environments, isProductionEnvironment };
|