@sonic-equipment/ui 200.0.0 → 202.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.
Files changed (80) hide show
  1. package/dist/algolia/algolia-multi-select-filter-section.js +1 -1
  2. package/dist/buttons/button/button.js +1 -2
  3. package/dist/buttons/icon-button/icon-button.js +1 -2
  4. package/dist/buttons/link/link.js +1 -2
  5. package/dist/country-select/hooks/use-countries.d.ts +2 -2
  6. package/dist/country-select/hooks/use-countries.js +1 -1
  7. package/dist/exports.d.ts +10 -2
  8. package/dist/forms/elements/checkbox/checkbox.d.ts +1 -0
  9. package/dist/forms/elements/checkbox/checkbox.js +1 -1
  10. package/dist/forms/elements/checkbox/checkbox.module.css.js +1 -1
  11. package/dist/forms/partials/address-form/address-form.d.ts +11 -0
  12. package/dist/forms/partials/address-form/address-form.js +36 -0
  13. package/dist/forms/partials/address-form/address-form.module.css.js +3 -0
  14. package/dist/index.js +12 -4
  15. package/dist/intl/translation-id.d.ts +1 -1
  16. package/dist/pages/account/components/sign-in-form/sign-in-form.d.ts +2 -1
  17. package/dist/pages/account/components/sign-in-form/sign-in-form.js +8 -6
  18. package/dist/pages/account/sign-in-page/sign-in-page.js +2 -2
  19. package/dist/pages/checkout/shipping-page/components/edit-checkout-bill-to-address-form.js +2 -2
  20. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.js +1 -1
  21. package/dist/pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form.d.ts +4 -0
  22. package/dist/pages/my-sonic/actions/create-ship-to-address/connected-create-ship-to-address-form.js +90 -0
  23. package/dist/pages/my-sonic/actions/create-ship-to-address/create-ship-to-address.module.css.js +3 -0
  24. package/dist/pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.d.ts +4 -0
  25. package/dist/pages/my-sonic/actions/edit-bill-to-address/connected-edit-bill-to-address-form.js +95 -0
  26. package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.module.css.js +3 -0
  27. package/dist/pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.d.ts +5 -0
  28. package/dist/pages/my-sonic/actions/edit-ship-to-address/connected-edit-ship-to-address-form.js +127 -0
  29. package/dist/pages/my-sonic/actions/edit-ship-to-address/edit-ship-to-address.module.css.js +3 -0
  30. package/dist/pages/my-sonic/widgets/components/address-data-card.d.ts +2 -2
  31. package/dist/pages/my-sonic/widgets/components/address-data-card.js +2 -6
  32. package/dist/pages/my-sonic/widgets/connected-bill-to-address-widget.d.ts +3 -1
  33. package/dist/pages/my-sonic/widgets/connected-bill-to-address-widget.js +13 -4
  34. package/dist/pages/my-sonic/widgets/connected-ship-to-address-widget.d.ts +4 -1
  35. package/dist/pages/my-sonic/widgets/connected-ship-to-address-widget.js +18 -4
  36. package/dist/shared/api/storefront/hooks/customer/use-fetch-bill-to-address.d.ts +4 -0
  37. package/dist/shared/api/storefront/hooks/customer/use-fetch-bill-to-address.js +11 -0
  38. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.d.ts +3 -1
  39. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-bill-to-address.js +3 -7
  40. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-ship-to-address.d.ts +3 -1
  41. package/dist/shared/api/storefront/hooks/customer/use-fetch-current-ship-to-address.js +6 -12
  42. package/dist/shared/api/storefront/hooks/customer/use-fetch-ship-to-address.d.ts +5 -0
  43. package/dist/shared/api/storefront/hooks/customer/use-fetch-ship-to-address.js +18 -0
  44. package/dist/shared/api/storefront/hooks/customer/use-patch-ship-to-address.d.ts +13 -0
  45. package/dist/shared/api/storefront/hooks/customer/use-patch-ship-to-address.js +17 -0
  46. package/dist/shared/api/storefront/hooks/customer/use-post-ship-to-address.d.ts +17 -0
  47. package/dist/shared/api/storefront/hooks/customer/use-post-ship-to-address.js +17 -0
  48. package/dist/shared/api/storefront/hooks/payment/use-invalidate-adyen.d.ts +1 -1
  49. package/dist/shared/api/storefront/hooks/payment/use-invalidate-adyen.js +1 -1
  50. package/dist/shared/api/storefront/hooks/product/use-mark-product-as-viewed.js +3 -1
  51. package/dist/shared/api/storefront/hooks/wishlist/use-add-wishlist-item-to-current-wishlist.js +2 -2
  52. package/dist/shared/api/storefront/hooks/wishlist/use-delete-wishlist-item-from-wishlist.js +2 -2
  53. package/dist/shared/api/storefront/model/storefront.model.d.ts +12 -0
  54. package/dist/shared/api/storefront/services/account-service.js +5 -0
  55. package/dist/shared/api/storefront/services/customer-service.d.ts +24 -3
  56. package/dist/shared/api/storefront/services/customer-service.js +39 -5
  57. package/dist/shared/hooks/use-cookiebot.js +9 -5
  58. package/dist/shared/routing/route-context.d.ts +2 -0
  59. package/dist/shared/routing/route-context.js +6 -0
  60. package/dist/shared/routing/route-provider.js +7 -8
  61. package/dist/shared/routing/types.d.ts +3 -1
  62. package/dist/shared/routing/use-location.d.ts +3 -3
  63. package/dist/shared/routing/use-location.js +4 -4
  64. package/dist/shared/routing/use-navigate.js +4 -7
  65. package/dist/shared/routing/use-paths.js +4 -5
  66. package/dist/shared/routing/use-route-link-element.d.ts +1 -1
  67. package/dist/shared/routing/use-route-link-element.js +5 -6
  68. package/dist/shared/routing/use-route-link.d.ts +1 -1
  69. package/dist/shared/routing/use-route-link.js +1 -0
  70. package/dist/shared/routing/use-router.d.ts +1 -0
  71. package/dist/shared/routing/use-router.js +13 -0
  72. package/dist/shared/routing/with-routing.d.ts +1 -0
  73. package/dist/shared/routing/with-routing.js +2 -1
  74. package/dist/styles.css +93 -7
  75. package/package.json +1 -1
  76. package/dist/forms/partials/edit-address-form/edit-address-form.d.ts +0 -9
  77. package/dist/forms/partials/edit-address-form/edit-address-form.js +0 -36
  78. package/dist/forms/partials/edit-address-form/edit-address-form.module.css.js +0 -3
  79. package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.d.ts +0 -1
  80. package/dist/pages/my-sonic/actions/edit-bill-to-address/edit-bill-to-address.js +0 -8
@@ -1,6 +1,19 @@
1
- import { BillToCollectionModel, BillToModel, PatchBillToModel, ShipToCollectionModel, ShipToModel } from 'shared/api/storefront/model/storefront.model';
2
- export declare function fetchCurrentBillToAddress(): Promise<BillToModel>;
3
- export declare function fetchCurrentShipToAddress(): Promise<ShipToModel>;
1
+ import { BillToCollectionModel, BillToModel, PatchBillToModel, PatchShipToModel, PostShipToModel, ShipToCollectionModel, ShipToModel } from 'shared/api/storefront/model/storefront.model';
2
+ export declare function fetchCurrentBillToAddress({ includeValidation, }?: {
3
+ includeValidation?: boolean;
4
+ }): Promise<BillToModel>;
5
+ export declare function fetchBillToAddress({ billToId, includeValidation, }: {
6
+ billToId: string;
7
+ includeValidation?: boolean;
8
+ }): Promise<BillToModel>;
9
+ export declare function fetchCurrentShipToAddress({ includeValidation, }?: {
10
+ includeValidation?: boolean;
11
+ }): Promise<ShipToModel>;
12
+ export declare function fetchShipToAddress({ billToId, includeValidation, shipToId, }: {
13
+ billToId: string;
14
+ includeValidation?: boolean;
15
+ shipToId: string;
16
+ }): Promise<ShipToModel>;
4
17
  export interface FetchBillToAddressesParams {
5
18
  filter?: string;
6
19
  pageSize?: number;
@@ -12,6 +25,14 @@ export declare function fetchShipToAddresses({ shipToId }: {
12
25
  export declare function patchBillToAddress({ billTo, }: {
13
26
  billTo: PatchBillToModel;
14
27
  }): Promise<BillToModel>;
28
+ export declare function patchShipToAddress({ billToId, shipTo, }: {
29
+ billToId: string;
30
+ shipTo: PatchShipToModel;
31
+ }): Promise<ShipToModel>;
32
+ export declare function postShipToAddress({ billToId, shipTo, }: {
33
+ billToId: string;
34
+ shipTo: PostShipToModel;
35
+ }): Promise<ShipToModel>;
15
36
  export declare function fetchFulfillmentMethods({ customerId, }: {
16
37
  customerId: string;
17
38
  }): Promise<string[]>;
@@ -1,17 +1,27 @@
1
1
  import { config } from '../../../../config.js';
2
2
  import { request } from '../../../fetch/request.js';
3
3
 
4
- async function fetchCurrentBillToAddress() {
4
+ async function fetchCurrentBillToAddress({ includeValidation = false, } = {}) {
5
+ return fetchBillToAddress({ billToId: 'current', includeValidation });
6
+ }
7
+ async function fetchBillToAddress({ billToId, includeValidation = false, }) {
5
8
  const { body } = await request({
6
9
  credentials: 'include',
7
- url: `${config.SHOP_API_URL}/api/v1/billtos/current`,
10
+ url: `${config.SHOP_API_URL}/api/v1/billtos/${billToId}${includeValidation ? '?expand=validation' : ''}`,
8
11
  });
9
12
  return body;
10
13
  }
11
- async function fetchCurrentShipToAddress() {
14
+ async function fetchCurrentShipToAddress({ includeValidation = false, } = {}) {
15
+ return fetchShipToAddress({
16
+ billToId: 'current',
17
+ includeValidation,
18
+ shipToId: 'current',
19
+ });
20
+ }
21
+ async function fetchShipToAddress({ billToId, includeValidation = false, shipToId, }) {
12
22
  const { body } = await request({
13
23
  credentials: 'include',
14
- url: `${config.SHOP_API_URL}/api/v1/billtos/current/shiptos/current`,
24
+ url: `${config.SHOP_API_URL}/api/v1/billtos/${billToId}/shiptos/${shipToId}${includeValidation ? '?expand=validation' : ''}`,
15
25
  });
16
26
  return body;
17
27
  }
@@ -41,6 +51,30 @@ async function patchBillToAddress({ billTo, }) {
41
51
  });
42
52
  return updatedBillTo;
43
53
  }
54
+ async function patchShipToAddress({ billToId, shipTo, }) {
55
+ const { body: updatedShipTo } = await request({
56
+ body: shipTo,
57
+ credentials: 'include',
58
+ headers: {
59
+ 'Content-Type': 'application/json',
60
+ },
61
+ method: 'PATCH',
62
+ url: `${config.SHOP_API_URL}/api/v1/billtos/${billToId}/shiptos/${shipTo.id}`,
63
+ });
64
+ return updatedShipTo;
65
+ }
66
+ async function postShipToAddress({ billToId, shipTo, }) {
67
+ const { body: createdShipTo } = await request({
68
+ body: shipTo,
69
+ credentials: 'include',
70
+ headers: {
71
+ 'Content-Type': 'application/json',
72
+ },
73
+ method: 'POST',
74
+ url: `${config.SHOP_API_URL}/api/v1/billtos/${billToId}/shiptos`,
75
+ });
76
+ return createdShipTo;
77
+ }
44
78
  async function fetchFulfillmentMethods({ customerId, }) {
45
79
  const { body: updatedBillTo } = await request({
46
80
  credentials: 'include',
@@ -50,4 +84,4 @@ async function fetchFulfillmentMethods({ customerId, }) {
50
84
  return updatedBillTo;
51
85
  }
52
86
 
53
- export { fetchBillToAddresses, fetchCurrentBillToAddress, fetchCurrentShipToAddress, fetchFulfillmentMethods, fetchShipToAddresses, patchBillToAddress };
87
+ export { fetchBillToAddress, fetchBillToAddresses, fetchCurrentBillToAddress, fetchCurrentShipToAddress, fetchFulfillmentMethods, fetchShipToAddress, fetchShipToAddresses, patchBillToAddress, patchShipToAddress, postShipToAddress };
@@ -3,19 +3,23 @@ import { useState, useEffect } from 'react';
3
3
 
4
4
  // https://www.cookiebot.com/en/developer/
5
5
  function useCookiebot() {
6
- const [hasResponse, setHasResponse] = useState(Boolean(window?.Cookiebot?.hasResponse));
6
+ const [hasResponse, setHasResponse] = useState(Boolean(typeof window === 'undefined' ? undefined : window.Cookiebot?.hasResponse));
7
7
  const [isDialogOpen, setIsDialogOpen] = useState(false);
8
8
  const handleDialogDisplay = () => {
9
9
  setIsDialogOpen(true);
10
10
  };
11
11
  const handleAcceptDecline = () => {
12
- setHasResponse(Boolean(window?.Cookiebot?.hasResponse));
12
+ setHasResponse(Boolean(typeof window === 'undefined'
13
+ ? undefined
14
+ : window.Cookiebot?.hasResponse));
13
15
  setIsDialogOpen(false);
14
16
  };
15
17
  useEffect(() => {
16
- window?.addEventListener('CookiebotOnDialogDisplay', handleDialogDisplay);
17
- window?.addEventListener('CookiebotOnAccept', handleAcceptDecline);
18
- window?.addEventListener('CookiebotOnDecline', handleAcceptDecline);
18
+ if (typeof window === 'undefined')
19
+ return;
20
+ window.addEventListener('CookiebotOnDialogDisplay', handleDialogDisplay);
21
+ window.addEventListener('CookiebotOnAccept', handleAcceptDecline);
22
+ window.addEventListener('CookiebotOnDecline', handleAcceptDecline);
19
23
  return () => {
20
24
  window?.removeEventListener('CookiebotOnDialogDisplay', handleDialogDisplay);
21
25
  window?.removeEventListener('CookiebotOnAccept', handleAcceptDecline);
@@ -0,0 +1,2 @@
1
+ import { RouteContextValue } from './types';
2
+ export declare const RouteContext: React.Context<RouteContextValue | undefined>;
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { createContext } from 'react';
3
+
4
+ const RouteContext = createContext(undefined);
5
+
6
+ export { RouteContext };
@@ -1,17 +1,16 @@
1
1
  "use client";
2
- import { jsx, Fragment } from 'react/jsx-runtime';
3
- import { useGlobalState } from '../providers/global-state-provider.js';
4
- import { withRouting } from './with-routing.js';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { useMemo } from 'react';
4
+ import { RouteContext } from './route-context.js';
5
5
 
6
- function RouteProvider({ children, Link = FallbackRouteLink, navigate, paths, url, }) {
7
- useGlobalState('routing', {
6
+ function RouteProvider({ children, Link, navigate, paths, url, }) {
7
+ const value = useMemo(() => ({
8
8
  Link,
9
9
  navigate,
10
10
  paths,
11
11
  url,
12
- });
13
- return jsx(Fragment, { children: children });
12
+ }), [Link, navigate, paths, url]);
13
+ return jsx(RouteContext.Provider, { value: value, children: children });
14
14
  }
15
- const FallbackRouteLink = withRouting('a');
16
15
 
17
16
  export { RouteProvider };
@@ -3,6 +3,8 @@ export interface Paths {
3
3
  ACCOUNT: string;
4
4
  ACCOUNT_ADDRESSES: string;
5
5
  ACCOUNT_CREATE: string;
6
+ ACCOUNT_EDIT_BILL_TO_ADDRESS: string;
7
+ ACCOUNT_EDIT_SHIP_TO_ADDRESS: string;
6
8
  ACCOUNT_INVOICES: string;
7
9
  ACCOUNT_MY_LISTS: string;
8
10
  ACCOUNT_ORDERS: string;
@@ -16,7 +18,7 @@ export interface Paths {
16
18
  REVIEW_AND_SUBMIT: string;
17
19
  SIGN_IN: string;
18
20
  }
19
- export interface RouteContext {
21
+ export interface RouteContextValue {
20
22
  Link?: ElementType<RouteLinkElementProps>;
21
23
  navigate: NavigateFunction;
22
24
  paths: Paths;
@@ -1,9 +1,9 @@
1
1
  import qs from 'query-string';
2
2
  export declare function useLocation(): {
3
3
  basePathname: string | undefined;
4
- fullPathname: string | undefined;
4
+ fullPathname: string;
5
5
  href: string;
6
- pathname: string | undefined;
6
+ pathname: string;
7
7
  query: qs.ParsedQuery<string>;
8
- search: string | undefined;
8
+ search: string;
9
9
  };
@@ -1,15 +1,15 @@
1
+ "use client";
1
2
  import qs from 'query-string';
2
- import { useGlobalState } from '../providers/global-state-provider.js';
3
+ import { useRouter } from './use-router.js';
3
4
 
4
5
  function useLocation() {
5
- const [routeState] = useGlobalState('routing');
6
- const { url: { basePathname, pathname, search }, } = routeState || { url: {} };
6
+ const { url: { basePathname, pathname, search }, } = useRouter();
7
7
  const query = qs.parse(search || '');
8
8
  return {
9
9
  basePathname,
10
10
  fullPathname: pathname,
11
11
  href: `${pathname}${search}`,
12
- pathname: pathname?.replace(new RegExp(`^${basePathname}`), ''),
12
+ pathname: pathname.replace(new RegExp(`^${basePathname}`), ''),
13
13
  query,
14
14
  search,
15
15
  };
@@ -1,22 +1,19 @@
1
1
  "use client";
2
2
  import { useRef, useCallback } from 'react';
3
- import { useGlobalState } from '../providers/global-state-provider.js';
4
3
  import { useOnNavigate } from './use-on-navigate.js';
4
+ import { useRouter } from './use-router.js';
5
5
 
6
6
  function useNavigate() {
7
7
  const isNavigatingRef = useRef(false);
8
- const [state] = useGlobalState('routing');
8
+ const routeState = useRouter();
9
9
  const trigger = useOnNavigate(() => {
10
10
  isNavigatingRef.current = false;
11
11
  });
12
- if (!state) {
13
- throw new Error('RouteProvider not found');
14
- }
15
12
  const navigate = useCallback((href, options) => {
16
13
  trigger(href, options);
17
14
  isNavigatingRef.current = true;
18
- return state.navigate(href, options);
19
- }, [state, trigger]);
15
+ return routeState.navigate(href, options);
16
+ }, [routeState, trigger]);
20
17
  return { isNavigating: isNavigatingRef.current, navigate };
21
18
  }
22
19
 
@@ -1,10 +1,9 @@
1
- import { useGlobalState } from '../providers/global-state-provider.js';
1
+ "use client";
2
+ import { useRouter } from './use-router.js';
2
3
 
3
4
  function usePaths() {
4
- const [routeState] = useGlobalState('routing');
5
- if (!routeState)
6
- throw new Error('usePaths must be used within a RouteProvider context');
7
- return routeState.paths;
5
+ const { paths } = useRouter();
6
+ return paths;
8
7
  }
9
8
 
10
9
  export { usePaths };
@@ -1 +1 @@
1
- export declare function useRouteLinkElement(): React.ElementType<import("./types").RouteLinkElementProps> | undefined;
1
+ export declare function useRouteLinkElement(): React.ElementType<import("./types").RouteLinkElementProps>;
@@ -1,11 +1,10 @@
1
- import { useGlobalState } from '../providers/global-state-provider.js';
1
+ "use client";
2
+ import { useRouter } from './use-router.js';
3
+ import { FallbackRouteLink } from './with-routing.js';
2
4
 
3
5
  function useRouteLinkElement() {
4
- const [state] = useGlobalState('routing');
5
- if (!state) {
6
- throw new Error('RouteProvider not found');
7
- }
8
- return state.Link;
6
+ const { Link } = useRouter();
7
+ return Link || FallbackRouteLink;
9
8
  }
10
9
 
11
10
  export { useRouteLinkElement };
@@ -1,6 +1,6 @@
1
1
  import { NavigateOptions } from './types';
2
2
  export declare function useRouteLink(): {
3
- RouteLinkElement: React.ElementType<import("./types").RouteLinkElementProps> | undefined;
3
+ RouteLinkElement: React.ElementType<import("./types").RouteLinkElementProps>;
4
4
  getRouteLinkProps: (href: string, route?: NavigateOptions) => {
5
5
  href: string;
6
6
  onNavigate: () => void;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { useCallback } from 'react';
2
3
  import { buildHref } from './route-utils.js';
3
4
  import { useLocation } from './use-location.js';
@@ -0,0 +1 @@
1
+ export declare function useRouter(): import("./types").RouteContextValue;
@@ -0,0 +1,13 @@
1
+ "use client";
2
+ import { useContext } from 'react';
3
+ import { RouteContext } from './route-context.js';
4
+
5
+ function useRouter() {
6
+ const context = useContext(RouteContext);
7
+ if (!context) {
8
+ throw new Error('useRouter must be used within a RouteProvider');
9
+ }
10
+ return context;
11
+ }
12
+
13
+ export { useRouter };
@@ -5,3 +5,4 @@ export interface WithRoutingProps {
5
5
  route?: NavigateOptions;
6
6
  }
7
7
  export declare function withRouting(component: ElementType<RouteLinkElementProps>): React.FunctionComponent<RouteLinkElementProps>;
8
+ export declare const FallbackRouteLink: React.FunctionComponent<RouteLinkElementProps>;
@@ -29,5 +29,6 @@ function withRouting(component) {
29
29
  Component.displayName = `WithRouting(${component.toString()})`;
30
30
  return Component;
31
31
  }
32
+ const FallbackRouteLink = withRouting('a');
32
33
 
33
- export { withRouting };
34
+ export { FallbackRouteLink, withRouting };
package/dist/styles.css CHANGED
@@ -1386,13 +1386,22 @@ html {
1386
1386
  all: unset;
1387
1387
  display: flex;
1388
1388
  box-sizing: border-box;
1389
- align-items: baseline;
1389
+ align-items: center;
1390
1390
  color: var(--color-brand-black);
1391
1391
  cursor: pointer;
1392
- font-size: var(--font-size-14);
1392
+ font-size: inherit;
1393
1393
  forced-color-adjust: none;
1394
+ line-height: 1;
1394
1395
  }
1395
1396
 
1397
+ .checkbox-module-QzsaZ.checkbox-module--o4dt {
1398
+ font-size: var(--font-size-14);
1399
+ }
1400
+
1401
+ .checkbox-module-QzsaZ.checkbox-module-5vjph {
1402
+ font-size: var(--font-size-16);
1403
+ }
1404
+
1396
1405
  .checkbox-module-QzsaZ .checkbox-module-spG9E {
1397
1406
  display: flex;
1398
1407
  width: 16px;
@@ -5354,16 +5363,27 @@ button.swiper-pagination-bullet {
5354
5363
  */
5355
5364
  }
5356
5365
 
5357
- .edit-address-form-module-HF64G {
5366
+ .address-form-module-pbmJ- {
5358
5367
  display: grid;
5368
+ gap: var(--space-16);
5369
+ grid-template-columns: auto;
5359
5370
  }
5360
5371
 
5361
- @media (width >= 576px) {.edit-address-form-module-HF64G {
5362
- grid-column: span 2
5372
+ .address-form-module-pbmJ- .address-form-module-dRYo2 {
5373
+ display: grid;
5374
+ }
5375
+
5376
+ @media (width >= 576px) {.address-form-module-pbmJ- {
5377
+ align-items: flex-start;
5378
+ grid-template-columns: 1fr 1fr
5363
5379
  }
5380
+
5381
+ .address-form-module-pbmJ- .address-form-module-dRYo2 {
5382
+ grid-column: span 2;
5383
+ }
5364
5384
  }
5365
5385
 
5366
- .edit-address-form-module-V-LOB {
5386
+ .address-form-module-62GxY {
5367
5387
  margin-block-start: var(--space-8);
5368
5388
  }
5369
5389
 
@@ -7666,7 +7686,7 @@ button.swiper-pagination-bullet {
7666
7686
  display: grid;
7667
7687
  }
7668
7688
 
7669
- @media (width >= 576px) {.edit-checkout-bill-to-address-form-module-UWk3T {
7689
+ @media (width >= 768px) {.edit-checkout-bill-to-address-form-module-UWk3T {
7670
7690
  align-items: flex-start;
7671
7691
  grid-template-columns: 1fr 1fr
7672
7692
  }
@@ -7812,6 +7832,72 @@ button.swiper-pagination-bullet {
7812
7832
  margin-block-start: var(--space-16);
7813
7833
  }
7814
7834
 
7835
+ .create-ship-to-address-module--IJ52 {
7836
+ display: flex;
7837
+ flex-direction: column;
7838
+ align-items: stretch;
7839
+ justify-content: flex-end;
7840
+ gap: var(--space-8);
7841
+ }
7842
+
7843
+ @media (width >= 576px) {.create-ship-to-address-module--IJ52 {
7844
+ flex-direction: row;
7845
+ align-items: center;
7846
+ grid-column: span 2
7847
+ }
7848
+ }
7849
+
7850
+ @media (width >= 576px) {
7851
+
7852
+ .create-ship-to-address-module-FYIIw {
7853
+ grid-column: span 2
7854
+ }
7855
+ }
7856
+
7857
+ .edit-bill-to-address-module-u7Vjd {
7858
+ display: flex;
7859
+ flex-direction: column;
7860
+ align-items: stretch;
7861
+ justify-content: flex-end;
7862
+ gap: var(--space-8);
7863
+ }
7864
+
7865
+ @media (width >= 576px) {.edit-bill-to-address-module-u7Vjd {
7866
+ flex-direction: row;
7867
+ align-items: center;
7868
+ grid-column: span 2
7869
+ }
7870
+ }
7871
+
7872
+ @media (width >= 576px) {
7873
+
7874
+ .edit-bill-to-address-module-WZIOF {
7875
+ grid-column: span 2
7876
+ }
7877
+ }
7878
+
7879
+ .edit-ship-to-address-module-aDVqM {
7880
+ display: flex;
7881
+ flex-direction: column;
7882
+ align-items: stretch;
7883
+ justify-content: flex-end;
7884
+ gap: var(--space-8);
7885
+ }
7886
+
7887
+ @media (width >= 576px) {.edit-ship-to-address-module-aDVqM {
7888
+ flex-direction: row;
7889
+ align-items: center;
7890
+ grid-column: span 2
7891
+ }
7892
+ }
7893
+
7894
+ @media (width >= 576px) {
7895
+
7896
+ .edit-ship-to-address-module-9FsP4 {
7897
+ grid-column: span 2
7898
+ }
7899
+ }
7900
+
7815
7901
  .edit-user-info-module-yQOre {
7816
7902
  display: grid;
7817
7903
  inset: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "200.0.0",
3
+ "version": "202.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -1,9 +0,0 @@
1
- import { Address } from '../../../shared/model/address';
2
- import { Country } from '../../../shared/model/countries-languages';
3
- export interface EditAddressFormProps {
4
- address: Address | null | undefined;
5
- countries: Country[];
6
- currentCountry: Country | undefined;
7
- isLoading: boolean;
8
- }
9
- export declare function EditAddressForm({ address, countries, currentCountry: _currentCountry, isLoading, }: EditAddressFormProps): import("react/jsx-runtime").JSX.Element;
@@ -1,36 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { useState } from 'react';
4
- import { CountrySelect } from '../../../country-select/country-select.js';
5
- import { TextField } from '../../fields/text-field/text-field.js';
6
- import { FormattedMessage } from '../../../intl/formatted-message.js';
7
- import { useFormattedMessage } from '../../../intl/use-formatted-message.js';
8
- import { Message } from '../../../message/message.js';
9
- import { validatePhone, validateEmail } from '../../../shared/model/address.js';
10
- import styles from './edit-address-form.module.css.js';
11
-
12
- function EditAddressForm({ address, countries, currentCountry: _currentCountry, isLoading, }) {
13
- const t = useFormattedMessage();
14
- const [companyName, setCompanyName] = useState(address?.companyName || '');
15
- const [lastName, setLastName] = useState(address?.lastName || '');
16
- const currentCountry = countries.find(c => c.id === address?.country?.id) || _currentCountry;
17
- const [selectedCountry, setSelectedCountry] = useState(currentCountry);
18
- const currencyHasChanged = Boolean(currentCountry) &&
19
- selectedCountry?.currencyCode !== currentCountry?.currencyCode;
20
- if (countries.length === 0) {
21
- return (jsx(Message, { type: "danger", children: jsx(FormattedMessage, { force: true, id: "No countries available. Unable to change address." }) }));
22
- }
23
- return (jsxs(Fragment, { children: [jsx(TextField, { defaultValue: address?.firstName, isDisabled: isLoading, label: t('First name'), name: "firstName", showLabel: true }), jsx(TextField, { isDisabled: isLoading, isRequired: !companyName, label: t('Last name'), minLength: 3, name: "lastName", onChange: setLastName, showLabel: true, value: lastName }, `lastname-${Boolean(companyName)}`), jsx(TextField, { defaultValue: address?.companyName, isDisabled: isLoading, label: t('Company name'), name: "companyName", onChange: setCompanyName, showLabel: true, value: companyName }), jsx(TextField, { defaultValue: address?.attention, isDisabled: isLoading, label: t('Attention'), name: "attention", showLabel: true }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: address?.address1, isDisabled: isLoading, label: `${t('Address')} 1`, maxLength: 30, minLength: 3, name: "address1", showLabel: true }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: address?.address2, isDisabled: isLoading, label: `${t('Address')} 2`, maxLength: 30, minLength: 3, name: "address2", showLabel: true }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { defaultValue: address?.address3, isDisabled: isLoading, label: `${t('Address')} 3`, maxLength: 30, minLength: 3, name: "address3", showLabel: true }) }), jsx(TextField, { isRequired: true, defaultValue: address?.postalCode, isDisabled: isLoading, label: t('Postal Code'), maxLength: 10, minLength: 4, name: "postalCode", showLabel: true }), jsx(TextField, { isRequired: true, defaultValue: address?.city, isDisabled: isLoading, label: t('City'), maxLength: 30, minLength: 3, name: "city", showLabel: true }), jsxs("div", { className: styles['span-2'], children: [jsx(CountrySelect, { isRequired: true, countries: countries, "data-test-selector": "countrySelect", isDisabled: isLoading, name: "countrySelect", onCountryChange: setSelectedCountry, selectedCountry: selectedCountry }), currencyHasChanged && (jsx(Message, { className: styles['currency-warning'], type: "warning", children: jsx(FormattedMessage, { id: "Selecting this country will result in your cart to be converted to the currency {0}", replacementValues: {
24
- '0': selectedCountry?.currencyCode || t('Unknown'),
25
- } }) }))] }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: address?.phone, isDisabled: isLoading, label: t('Phone'), name: "phone", showLabel: true, validate: value => {
26
- if (!value)
27
- return value;
28
- return (validatePhone(value) || t('Please enter a valid phone number'));
29
- } }) }), jsx("div", { className: styles['span-2'], children: jsx(TextField, { isRequired: true, defaultValue: address?.email || '', isDisabled: isLoading, label: t('Email'), name: "email", showLabel: true, type: "email", validate: value => {
30
- if (!value)
31
- return value;
32
- return (validateEmail(value) || t('Please enter a valid email address'));
33
- } }) })] }));
34
- }
35
-
36
- export { EditAddressForm };
@@ -1,3 +0,0 @@
1
- var styles = {"span-2":"edit-address-form-module-HF64G","currency-warning":"edit-address-form-module-V-LOB"};
2
-
3
- export { styles as default };
@@ -1 +0,0 @@
1
- export declare function EditBillToAddress(): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +0,0 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { EditAddressForm } from '../../../../forms/partials/edit-address-form/edit-address-form.js';
3
-
4
- function EditBillToAddress() {
5
- return (jsx(EditAddressForm, { address: undefined, countries: [], currentCountry: undefined, isLoading: false }));
6
- }
7
-
8
- export { EditBillToAddress };