@sonic-equipment/ui 228.0.0 → 230.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.
@@ -6,6 +6,7 @@ interface AccordionProps {
6
6
  }
7
7
  interface AccordionStandardProps extends AccordionProps {
8
8
  borderType?: BorderType | BorderType[];
9
+ className?: string;
9
10
  color?: 'white' | 'black';
10
11
  hasLineSeparator?: boolean;
11
12
  indented?: boolean;
@@ -15,8 +15,8 @@ function Accordion({ variant = 'standard', ...rest }) {
15
15
  throw new Error(`Invalid variant ${variant}`);
16
16
  /* eslint-enable @typescript-eslint/no-unnecessary-condition */
17
17
  }
18
- function StandardAccordion({ borderType = 'bottom', children, color = 'black', hasLineSeparator = true, indented, size = 'md', }) {
19
- return (jsx("div", { className: clsx({ [styles.indented]: indented }, styles.accordion, styles[color], styles[size], hasLineSeparator && styles['with-seperators']), children: Boolean(children) &&
18
+ function StandardAccordion({ borderType = 'bottom', children, className, color = 'black', hasLineSeparator = true, indented, size = 'md', }) {
19
+ return (jsx("div", { className: clsx({ [styles.indented]: indented }, styles.accordion, styles[color], styles[size], hasLineSeparator && styles['with-seperators'], className), children: Boolean(children) &&
20
20
  Children.map(children, child => {
21
21
  if (!child)
22
22
  return null;
@@ -5,7 +5,6 @@ import { Link } from '../buttons/link/link.js';
5
5
  import { Accordion } from '../collapsables/accordion/accordion.js';
6
6
  import { AccordionItem } from '../collapsables/accordion/accordion-item.js';
7
7
  import { isNavigationSection, isNavigationLinkItem, isNavigationLink } from '../shared/api/bff/model/bff.model.js';
8
- import { useIsBreakpoint } from '../shared/hooks/use-is-breakpoint.js';
9
8
  import styles from './footer.module.css.js';
10
9
 
11
10
  function BottomSection({ copyright, countrySelector, footerBottomSection, }) {
@@ -15,8 +14,7 @@ function BottomSection({ copyright, countrySelector, footerBottomSection, }) {
15
14
  return (jsxs("section", { className: styles['bottom-section'], children: [copyright && jsx("p", { className: styles.copyright, children: copyright }), footerBottomSection.items.length > 0 && (jsx("ul", { className: styles['bottom-links'], children: links.map(link => (jsx(Link, { className: styles['bottom-link'], href: link.href || undefined, target: link.openInNewTab ? '_blank' : undefined, children: link.label }, link.key))) })), countrySelector && (jsx("div", { className: styles['country-selector'], children: countrySelector }))] }));
16
15
  }
17
16
  function LinkSection({ linkGroup }) {
18
- const isXl = useIsBreakpoint('xl');
19
- return (jsx("section", { className: styles['link-block'], children: jsx(Accordion, { color: "white", hasLineSeparator: false, size: "lg", children: jsx(AccordionItem, { allowCollapse: !isXl, id: `link-block-${linkGroup.key}`, initialIsOpen: isXl, title: linkGroup.header || linkGroup.label, children: jsx("ul", { className: styles['list'], children: linkGroup.items.filter(isNavigationLink).map(link => (jsx("li", { children: jsx(FooterLink, { link: link }) }, link.key))) }) }) }) }, linkGroup.key));
17
+ return (jsxs("section", { className: styles['link-block'], children: [jsx(Accordion, { className: styles['accordion-small'], color: "white", hasLineSeparator: false, size: "lg", children: jsx(AccordionItem, { allowCollapse: true, id: `link-block-${linkGroup.key}`, initialIsOpen: false, title: linkGroup.header || linkGroup.label, children: jsx("ul", { className: styles['list'], children: linkGroup.items.filter(isNavigationLink).map(link => (jsx("li", { children: jsx(FooterLink, { link: link }) }, link.key))) }) }) }), jsx(Accordion, { className: styles['accordion-large'], color: "white", hasLineSeparator: false, size: "lg", children: jsx(AccordionItem, { allowCollapse: false, id: `link-block-${linkGroup.key}`, initialIsOpen: true, title: linkGroup.header || linkGroup.label, children: jsx("ul", { className: styles['list'], children: linkGroup.items.filter(isNavigationLink).map(link => (jsx("li", { children: jsx(FooterLink, { link: link }) }, link.key))) }) }) })] }, linkGroup.key));
20
18
  }
21
19
  function FooterLink({ link }) {
22
20
  return (jsx(Link, { href: link.href || undefined, target: link.openInNewTab ? '_blank' : undefined, children: link.label }));
@@ -1,3 +1,3 @@
1
- var styles = {"footer":"footer-module-YzJ68","main-links":"footer-module-rFBXC","link-block":"footer-module-P5FXP","list":"footer-module-FM4hU","bottom-section":"footer-module-TZq-4","copyright":"footer-module-qlHSS","bottom-links":"footer-module-5eyFH","country-selector":"footer-module-rc0bC"};
1
+ var styles = {"footer":"footer-module-YzJ68","main-links":"footer-module-rFBXC","link-block":"footer-module-P5FXP","list":"footer-module-FM4hU","accordion-small":"footer-module-FfTbn","accordion-large":"footer-module-1wP8R","bottom-section":"footer-module-TZq-4","copyright":"footer-module-qlHSS","bottom-links":"footer-module-5eyFH","country-selector":"footer-module-rc0bC"};
2
2
 
3
3
  export { styles as default };
@@ -7,7 +7,9 @@ import { Checkbox } from '../../../../forms/elements/checkbox/checkbox.js';
7
7
  import { TextField } from '../../../../forms/fields/text-field/text-field.js';
8
8
  import { FormattedMessage } from '../../../../intl/formatted-message.js';
9
9
  import { useFormattedMessage } from '../../../../intl/use-formatted-message.js';
10
+ import { useLocation } from '../../../../shared/routing/use-location.js';
10
11
  import { usePaths } from '../../../../shared/routing/use-paths.js';
12
+ import { environment } from '../../../../shared/utils/environment.js';
11
13
  import { CheckoutPageSection } from '../../layouts/checkout-page-layout/components/checkout-page-section.js';
12
14
  import { CheckoutPageSectionContent } from '../../layouts/checkout-page-layout/components/checkout-page-section-content.js';
13
15
  import { CheckoutPageSectionLink } from '../../layouts/checkout-page-layout/components/checkout-page-section-link.js';
@@ -18,6 +20,16 @@ import styles from './readonly-address.module.css.js';
18
20
  function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipTo, }) {
19
21
  const t = useFormattedMessage();
20
22
  const paths = usePaths();
23
+ const { pathname, search } = useLocation();
24
+ const href = `${pathname}${search}`;
25
+ const billToId = billTo?.id;
26
+ const shipToId = shipTo?.id;
27
+ const editBillToAddressUrl = environment === 'next'
28
+ ? `${paths.ACCOUNT_EDIT_BILL_TO_ADDRESS}/${billToId}?returnUrl=${encodeURIComponent(href)}`
29
+ : paths.ACCOUNT_ADDRESSES;
30
+ const editShipToAddressUrl = environment === 'next'
31
+ ? `${paths.ACCOUNT_EDIT_BILL_TO_ADDRESS}/${billToId}${paths.ACCOUNT_EDIT_SHIP_TO_ADDRESS}/${shipToId}?returnUrl=${encodeURIComponent(href)}`
32
+ : paths.ACCOUNT_ADDRESSES;
21
33
  return (jsxs(Form, { id: EDIT_ADDRESS_FORM_ID, onSubmit: e => {
22
34
  e.preventDefault();
23
35
  const formData = new FormData(e.currentTarget);
@@ -26,7 +38,7 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
26
38
  ? undefined
27
39
  : formData.get('notes')?.toString() || '',
28
40
  });
29
- }, children: [jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: [jsx(CheckoutPageSectionLink, { children: jsxs(Link, { color: "secondary", href: paths.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit billing address" }), " >"] }) }), jsxs(CheckoutPageSectionContent, { children: [billTo && (jsx(AddressInfoDisplay, { address: {
41
+ }, children: [jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: "Billing address" }), children: [jsx(CheckoutPageSectionLink, { children: jsxs(Link, { color: "secondary", href: editBillToAddressUrl, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit billing address" }), " >"] }) }), jsxs(CheckoutPageSectionContent, { children: [billTo && (jsx(AddressInfoDisplay, { address: {
30
42
  address1: billTo.address1,
31
43
  address2: billTo.address2,
32
44
  address3: billTo.address3,
@@ -39,7 +51,7 @@ function ReadOnlyAddresses({ billTo, isLoading, isPickup, notes, onSubmit, shipT
39
51
  lastName: billTo.lastName,
40
52
  phone: billTo.phone,
41
53
  postalCode: billTo.postalCode,
42
- }, "data-test-selector": "billToAddress" })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] })] }), jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: [!isPickup && (jsx(CheckoutPageSectionLink, { children: jsxs(Link, { color: "secondary", href: paths.ACCOUNT_ADDRESSES, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit shipping address" }), " >"] }) })), jsx(CheckoutPageSectionContent, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs(Fragment, { children: [jsx(Checkbox, { className: styles['use-invoice-checkbox'], "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), shipTo && (jsx(AddressInfoDisplay, { address: {
54
+ }, "data-test-selector": "billToAddress" })), jsx("div", { className: styles.notes, children: jsx(TextField, { defaultValue: notes, isDisabled: isLoading, isMultiline: true, label: t('Add order notes'), name: "notes", rows: 3, showLabel: true }) })] })] }), jsxs(CheckoutPageSection, { title: jsx(FormattedMessage, { id: isPickup ? 'Pickup address' : 'Shipping address' }), children: [!isPickup && (jsx(CheckoutPageSectionLink, { children: jsxs(Link, { color: "secondary", href: editShipToAddressUrl, isDisabled: isLoading, children: [jsx(FormattedMessage, { id: "Edit shipping address" }), " >"] }) })), jsx(CheckoutPageSectionContent, { children: isPickup ? (jsx(SonicAddress, {})) : (jsxs(Fragment, { children: [jsx(Checkbox, { className: styles['use-invoice-checkbox'], "data-test-selector": "checkboxUseBillingAddress", isDisabled: true, isSelected: true, children: jsx(FormattedMessage, { id: "Use billing address" }) }), shipTo && (jsx(AddressInfoDisplay, { address: {
43
55
  address1: shipTo.address1,
44
56
  address2: shipTo.address2,
45
57
  address3: shipTo.address3,
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { useQueryClient, useMutation } from '@tanstack/react-query';
3
+ import { UnprocessableContentRequestError } from '../../../../fetch/request.js';
3
4
  import { signIn, createSession, InvalidGrantError } from '../../services/authentication-service.js';
4
5
 
5
6
  function useSignIn() {
@@ -18,6 +19,8 @@ function useSignIn() {
18
19
  return body;
19
20
  }
20
21
  catch (error) {
22
+ if (error instanceof UnprocessableContentRequestError)
23
+ throw error;
21
24
  if (error instanceof InvalidGrantError)
22
25
  throw error;
23
26
  queryClient.resetQueries();
@@ -1,2 +1,2 @@
1
- import type { GADataLayerEvent } from './types';
2
- export declare const dataLayer: GADataLayerEvent[];
1
+ import type { DataLayer } from './types';
2
+ export declare const dataLayer: DataLayer;
@@ -1,3 +1,6 @@
1
+ export interface GAContext {
2
+ [key: string]: string | number | boolean | null | undefined;
3
+ }
1
4
  export interface GABaseEvent {
2
5
  [key: string]: any;
3
6
  event: string;
@@ -27,8 +30,9 @@ export interface GAPageviewEvent extends GABaseEvent {
27
30
  page_title?: string;
28
31
  }
29
32
  export type GADataLayerEvent = GABaseEvent | GAEcommerceEvent | GAPageviewEvent;
33
+ export type DataLayer = (GADataLayerEvent | GAContext)[];
30
34
  declare global {
31
35
  interface Window {
32
- dataLayer?: GADataLayerEvent[];
36
+ dataLayer?: DataLayer;
33
37
  }
34
38
  }
@@ -1,5 +1,5 @@
1
1
  import { CartModel } from '../api/storefront/model/storefront.model';
2
- import { type GADataLayerEvent, type GAEcommerceEvent } from './types';
2
+ import { DataLayer, type GADataLayerEvent, type GAEcommerceEvent } from './types';
3
3
  interface GAProductModel {
4
4
  price?: number;
5
5
  productNumber: string;
@@ -44,7 +44,7 @@ interface CreateEcommerceEvent {
44
44
  }
45
45
  interface UseDataLayerReturnValue {
46
46
  createEcommerceEvent: CreateEcommerceEvent;
47
- dataLayer: GADataLayerEvent[];
47
+ dataLayer: DataLayer;
48
48
  }
49
49
  export declare function useDataLayer(): UseDataLayerReturnValue;
50
50
  export declare function useDataLayer(event: GADataLayerEvent): UseDataLayerReturnValue;
package/dist/styles.css CHANGED
@@ -5154,6 +5154,20 @@ button.swiper-pagination-bullet {
5154
5154
  }
5155
5155
  }
5156
5156
 
5157
+ @media (width >= 1024px) {
5158
+
5159
+ .footer-module-YzJ68 .footer-module-FfTbn {
5160
+ display: none
5161
+ }
5162
+ }
5163
+
5164
+ @media (width < 1024px) {
5165
+
5166
+ .footer-module-YzJ68 .footer-module-1wP8R {
5167
+ display: none
5168
+ }
5169
+ }
5170
+
5157
5171
  .footer-module-YzJ68 .footer-module-TZq-4 {
5158
5172
  display: flex;
5159
5173
  flex-direction: column-reverse;
@@ -6133,6 +6147,7 @@ button.swiper-pagination-bullet {
6133
6147
  }
6134
6148
 
6135
6149
  @media (width < 576px) {.connected-account-button-module-d7qyN {
6150
+ position: fixed !important;
6136
6151
  margin: auto;
6137
6152
  block-size: -moz-fit-content;
6138
6153
  block-size: fit-content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "228.0.0",
3
+ "version": "230.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {