@sonic-equipment/ui 0.0.90 → 0.0.92
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/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ interface Config {
|
|
|
21
21
|
ALGOLIA_APP_ID: string;
|
|
22
22
|
ALGOLIA_HOST: string;
|
|
23
23
|
BFF_API_URL: string;
|
|
24
|
+
COOKIE_DOMAIN?: string;
|
|
24
25
|
SHOP_API_URL: string;
|
|
25
26
|
}
|
|
26
27
|
declare const configPerEnvironment: Record<Environment, Config>;
|
|
@@ -125,6 +126,7 @@ interface Request {
|
|
|
125
126
|
declare const request: Request;
|
|
126
127
|
|
|
127
128
|
declare const features: {
|
|
129
|
+
readonly language: "language";
|
|
128
130
|
readonly pdp: "pdpV2";
|
|
129
131
|
readonly pdpv1: "pdpV1";
|
|
130
132
|
readonly plpv1: "plpV1";
|
package/dist/index.js
CHANGED
|
@@ -71,7 +71,8 @@ const configPerEnvironment = {
|
|
|
71
71
|
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
72
72
|
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
73
73
|
ALGOLIA_HOST: 'sonicequipment.commerce.insitesandbox.com',
|
|
74
|
-
BFF_API_URL: 'https://
|
|
74
|
+
BFF_API_URL: 'https://sonicequipment.commerce.insitesandbox.com/api/v1/bff',
|
|
75
|
+
COOKIE_DOMAIN: undefined,
|
|
75
76
|
SHOP_API_URL:
|
|
76
77
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
77
78
|
'',
|
|
@@ -81,6 +82,7 @@ const configPerEnvironment = {
|
|
|
81
82
|
ALGOLIA_APP_ID: '14CUFCVMAD',
|
|
82
83
|
ALGOLIA_HOST: 'shop.sonic-equipment.com',
|
|
83
84
|
BFF_API_URL: 'https://shop.sonic-equipment.com/api/v1/bff',
|
|
85
|
+
COOKIE_DOMAIN: '.sonic-equipment.com',
|
|
84
86
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
85
87
|
SHOP_API_URL: 'https://shop.sonic-equipment.com',
|
|
86
88
|
},
|
|
@@ -89,6 +91,7 @@ const configPerEnvironment = {
|
|
|
89
91
|
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
90
92
|
ALGOLIA_HOST: 'sonicequipment.commerce.insitesandbox.com',
|
|
91
93
|
BFF_API_URL: 'https://sonicequipment.commerce.insitesandbox.com/api/v1/bff',
|
|
94
|
+
COOKIE_DOMAIN: '.insitesandbox.com',
|
|
92
95
|
SHOP_API_URL:
|
|
93
96
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
94
97
|
'https://sonicequipment.commerce.insitesandbox.com',
|
|
@@ -98,6 +101,7 @@ const configPerEnvironment = {
|
|
|
98
101
|
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
99
102
|
ALGOLIA_HOST: 'sonicequipment.commerce.insitesandbox.com',
|
|
100
103
|
BFF_API_URL: 'https://sonicequipment.commerce.insitesandbox.com/api/v1/bff',
|
|
104
|
+
COOKIE_DOMAIN: '.insitesandbox.com',
|
|
101
105
|
SHOP_API_URL:
|
|
102
106
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
103
107
|
'https://sonic.local.com:4443',
|
|
@@ -364,6 +368,7 @@ const request = (function createRequestFunction() {
|
|
|
364
368
|
})();
|
|
365
369
|
|
|
366
370
|
const features = {
|
|
371
|
+
language: 'language',
|
|
367
372
|
pdp: 'pdpV2',
|
|
368
373
|
pdpv1: 'pdpV1',
|
|
369
374
|
plpv1: 'plpV1',
|
|
@@ -7675,7 +7680,12 @@ function CountrySelectorDialog({ countries, isOpen, onSubmit, selectedCountry, s
|
|
|
7675
7680
|
const t = useFormattedMessage();
|
|
7676
7681
|
const [currentCountry, setCurrentCountry] = useState(selectedCountry);
|
|
7677
7682
|
const [currentLanguage, setCurrentLanguage] = useState(selectedLanguage);
|
|
7678
|
-
const countryOptions = useMemo(() => countries.reduce((acc, country) => ({
|
|
7683
|
+
const countryOptions = useMemo(() => countries.reduce((acc, country) => ({
|
|
7684
|
+
...acc,
|
|
7685
|
+
[country.id]: t(`clSelector.${country.name}`),
|
|
7686
|
+
}), {}),
|
|
7687
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7688
|
+
[countries]);
|
|
7679
7689
|
const languageOptions = useMemo(() => currentCountry.languages.reduce((acc, language) => ({ ...acc, [language.id]: language.description }), {}), [currentCountry]);
|
|
7680
7690
|
useEffect(() => {
|
|
7681
7691
|
if (currentCountry.languages.some(language => language.id === currentLanguage.id))
|
|
@@ -7697,11 +7707,12 @@ function CountrySelectorDialog({ countries, isOpen, onSubmit, selectedCountry, s
|
|
|
7697
7707
|
var styles$J = {"country-selector-trigger":"country-selector-trigger-module-aioDu","flag":"country-selector-trigger-module-zOSJK","text":"country-selector-trigger-module-TE8tl","divider":"country-selector-trigger-module-GNRDD"};
|
|
7698
7708
|
|
|
7699
7709
|
function CountrySelectorTrigger({ onClick, selectedCountry, selectedLanguage, showCountry = true, }) {
|
|
7710
|
+
const t = useFormattedMessage();
|
|
7700
7711
|
if (!selectedCountry || !selectedLanguage)
|
|
7701
7712
|
return;
|
|
7702
7713
|
const abbreviation = selectedCountry.abbreviation.toLowerCase();
|
|
7703
7714
|
const flagSrc = `https://res.cloudinary.com/dkz9eknwh/image/upload/v1729678637/images/flags/${abbreviation}.svg`;
|
|
7704
|
-
return (jsxs("button", { "aria-label": "Open country selector dialog", className: styles$J['country-selector-trigger'], onClick: onClick, type: "button", children: [jsx(Image, { className: styles$J.flag, height: 24, image: { 1: flagSrc, 2: flagSrc, 3: flagSrc, altText: abbreviation }, title: abbreviation, width: 24 }), jsxs("div", { className: styles$J.text, children: [showCountry && (jsxs(Fragment, { children: [jsx("span", { children: selectedCountry.name }), jsx("span", { className: styles$J.divider, children: "-" })] })), jsx("span", { children: selectedLanguage.description })] })] }));
|
|
7715
|
+
return (jsxs("button", { "aria-label": "Open country selector dialog", className: styles$J['country-selector-trigger'], onClick: onClick, type: "button", children: [jsx(Image, { className: styles$J.flag, height: 24, image: { 1: flagSrc, 2: flagSrc, 3: flagSrc, altText: abbreviation }, title: abbreviation, width: 24 }), jsxs("div", { className: styles$J.text, children: [showCountry && (jsxs(Fragment, { children: [jsx("span", { children: t(`clSelector.${selectedCountry.name}`) }), jsx("span", { className: styles$J.divider, children: "-" })] })), jsx("span", { children: selectedLanguage.description })] })] }));
|
|
7705
7716
|
}
|
|
7706
7717
|
|
|
7707
7718
|
async function fetchCountriesLanguages() {
|
|
@@ -7780,7 +7791,7 @@ function useUpdateLanguageById() {
|
|
|
7780
7791
|
}
|
|
7781
7792
|
|
|
7782
7793
|
function useCookie(name, options) {
|
|
7783
|
-
const cookieValue = Cookies.get(name
|
|
7794
|
+
const cookieValue = Cookies.get()[name];
|
|
7784
7795
|
const [stateValue, setStateValue] = useState(cookieValue);
|
|
7785
7796
|
function setValue(valueOrFn) {
|
|
7786
7797
|
setStateValue(oldValue => {
|
|
@@ -7814,7 +7825,11 @@ function useSessionStorage(key, initialState) {
|
|
|
7814
7825
|
}
|
|
7815
7826
|
|
|
7816
7827
|
const cookieOptions = {
|
|
7828
|
+
domain: config.COOKIE_DOMAIN,
|
|
7829
|
+
expires: 365,
|
|
7817
7830
|
path: '/',
|
|
7831
|
+
sameSite: 'None',
|
|
7832
|
+
secure: true,
|
|
7818
7833
|
};
|
|
7819
7834
|
function useCountriesLanguages({ defaultCountryCode, defaultLanguageCode, }) {
|
|
7820
7835
|
const [sessionCountries, setSessionCountries] = useSessionStorage('countries-v1');
|
package/dist/src/config.d.ts
CHANGED