@sonic-equipment/ui 201.0.0 → 203.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/breadcrumbs/breadcrumb.js +7 -16
- package/dist/breadcrumbs/breadcrumb.module.css.js +1 -1
- package/dist/buttons/add-to-cart-button/add-to-cart-button.d.ts +1 -1
- package/dist/buttons/add-to-cart-button/add-to-cart-button.js +12 -13
- package/dist/buttons/button/button.js +1 -2
- package/dist/buttons/icon-button/icon-button.js +1 -2
- package/dist/buttons/link/link.js +1 -2
- package/dist/collapsables/accordion/accordion-item.js +6 -5
- package/dist/collapsables/accordion/accordion.module.css.js +1 -1
- package/dist/cookies/client-cookie-context.d.ts +3 -0
- package/dist/cookies/client-cookie-context.js +30 -0
- package/dist/cookies/cookie-context.d.ts +2 -0
- package/dist/cookies/cookie-context.js +6 -0
- package/dist/cookies/cookie-provider.d.ts +6 -0
- package/dist/cookies/cookie-provider.js +10 -0
- package/dist/cookies/readonly-cookie-reader.d.ts +2 -0
- package/dist/cookies/readonly-cookie-reader.js +18 -0
- package/dist/cookies/types.d.ts +14 -0
- package/dist/cookies/types.js +7 -0
- package/dist/{shared/hooks → cookies}/use-cookie.d.ts +1 -2
- package/dist/cookies/use-cookie.js +30 -0
- package/dist/country-select/hooks/use-countries.js +1 -1
- package/dist/country-selector/connected-country-selector.js +1 -1
- package/dist/country-selector/use-countries-languages.js +3 -11
- package/dist/exports.d.ts +8 -1
- package/dist/header/buttons/account/connected-account-button.js +1 -8
- package/dist/index.js +10 -3
- package/dist/media/image-grid/images-grid.d.ts +2 -1
- package/dist/media/image-grid/images-grid.js +2 -2
- package/dist/media/image-lightbox/image-lightbox.d.ts +2 -1
- package/dist/media/image-lightbox/image-lightbox.js +2 -2
- package/dist/pages/account/components/create-account-form/create-account-form.js +1 -1
- package/dist/pages/account/create-account-page/create-account-page.js +5 -3
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.d.ts +2 -1
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +2 -4
- package/dist/pages/account/sign-in-page/sign-in-page.js +2 -2
- package/dist/pages/checkout/cart-page/cart-page.js +1 -1
- package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +1 -1
- package/dist/pages/my-sonic/widgets/connected-bill-to-address-widget.js +2 -1
- package/dist/pages/my-sonic/widgets/connected-ship-to-address-widget.js +2 -1
- package/dist/pages/product/product-details-page/components/product-details-images/product-detail-images.js +1 -3
- package/dist/pages/product/product-details-page/components/product-details-images/product-detail-images.module.css.js +1 -1
- package/dist/pages/product/product-details-page/product-details.js +5 -1
- package/dist/pages/product/product-listing-page/no-results/no-results.js +3 -1
- package/dist/shared/api/storefront/hooks/cart/use-fetch-current-cart-with-atp.js +6 -4
- package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.d.ts +5 -3
- package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.js +4 -8
- package/dist/shared/api/storefront/services/website-service.js +9 -0
- package/dist/shared/hooks/use-debounced-callback.d.ts +5 -1
- package/dist/shared/hooks/use-debounced-callback.js +10 -10
- package/dist/shared/providers/react-query-container.d.ts +8 -3
- package/dist/shared/providers/react-query-container.js +4 -4
- package/dist/shared/routing/route-context.d.ts +2 -0
- package/dist/shared/routing/route-context.js +6 -0
- package/dist/shared/routing/route-provider.d.ts +1 -0
- package/dist/shared/routing/route-provider.js +7 -8
- package/dist/shared/routing/types.d.ts +2 -1
- package/dist/shared/routing/use-location.d.ts +3 -3
- package/dist/shared/routing/use-location.js +5 -5
- package/dist/shared/routing/use-navigate.js +4 -7
- package/dist/shared/routing/use-paths.js +4 -5
- package/dist/shared/routing/use-route-link-element.d.ts +1 -1
- package/dist/shared/routing/use-route-link-element.js +5 -6
- package/dist/shared/routing/use-route-link.d.ts +1 -1
- package/dist/shared/routing/use-route-link.js +1 -0
- package/dist/shared/routing/use-router.d.ts +1 -0
- package/dist/shared/routing/use-router.js +13 -0
- package/dist/shared/routing/with-routing.d.ts +1 -0
- package/dist/shared/routing/with-routing.js +2 -1
- package/dist/sidebar/sidebar-provider.js +0 -2
- package/dist/styles.css +31 -1
- package/package.json +1 -1
- package/dist/shared/hooks/use-cookie.js +0 -34
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import Cookies from 'js-cookie';
|
|
4
|
-
import { config } from '../../config.js';
|
|
5
|
-
|
|
6
|
-
const defaultCookieOptions = {
|
|
7
|
-
domain: config.COOKIE_DOMAIN,
|
|
8
|
-
expires: 365,
|
|
9
|
-
path: '/',
|
|
10
|
-
sameSite: 'None',
|
|
11
|
-
secure: true,
|
|
12
|
-
};
|
|
13
|
-
function useCookie(name, options = defaultCookieOptions) {
|
|
14
|
-
const cookieValue = Cookies.get()?.[name];
|
|
15
|
-
const [stateValue, setStateValue] = useState(cookieValue);
|
|
16
|
-
if (cookieValue !== stateValue) {
|
|
17
|
-
setStateValue(cookieValue);
|
|
18
|
-
}
|
|
19
|
-
function setValue(valueOrFn) {
|
|
20
|
-
setStateValue(oldValue => {
|
|
21
|
-
const newValue = typeof valueOrFn === 'function' ? valueOrFn(oldValue) : valueOrFn;
|
|
22
|
-
if (newValue) {
|
|
23
|
-
Cookies.set(name, newValue, options);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
Cookies.remove(name);
|
|
27
|
-
}
|
|
28
|
-
return newValue;
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
return [stateValue, setValue];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { defaultCookieOptions, useCookie };
|