@sonic-equipment/ui 184.0.0 → 185.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 (93) hide show
  1. package/dist/cards/data-card/data-card.js +37 -20
  2. package/dist/cards/data-card/data-card.module.css.js +1 -1
  3. package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +1 -5
  4. package/dist/exports.d.ts +20 -2
  5. package/dist/forms/form/form.d.ts +7 -3
  6. package/dist/forms/form/form.js +2 -2
  7. package/dist/forms/password-validation/password-validation.d.ts +4 -0
  8. package/dist/forms/password-validation/password-validation.js +32 -0
  9. package/dist/forms/select/select.d.ts +2 -1
  10. package/dist/forms/select/select.js +2 -2
  11. package/dist/index.js +21 -3
  12. package/dist/intl/translation-id.d.ts +1 -1
  13. package/dist/intl/use-formatted-message.js +2 -1
  14. package/dist/lists/menu-list/menu-list.d.ts +2 -1
  15. package/dist/lists/menu-list/menu-list.js +2 -2
  16. package/dist/lists/widget-grid/widget-grid.d.ts +5 -0
  17. package/dist/lists/widget-grid/widget-grid.js +9 -0
  18. package/dist/lists/widget-grid/widget-grid.module.css.js +3 -0
  19. package/dist/lists/widget-grid/widget.d.ts +6 -0
  20. package/dist/lists/widget-grid/widget.js +10 -0
  21. package/dist/modals/dialog/dialog.d.ts +5 -5
  22. package/dist/modals/dialog/dialog.js +18 -18
  23. package/dist/modals/dialog/dialog.module.css.js +1 -1
  24. package/dist/modals/recover-password/recover-password-dialog.js +1 -3
  25. package/dist/pages/account/components/create-account-form/create-account-form.js +2 -17
  26. package/dist/pages/account/create-account-page/create-account-page.js +4 -5
  27. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +1 -1
  28. package/dist/pages/account/sign-in-page/sign-in-page.js +2 -3
  29. package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.d.ts +1 -0
  30. package/dist/pages/components/page-container/page-container.js +1 -1
  31. package/dist/pages/my-sonic/actions/change-customer/change-customer-dialog.d.ts +4 -3
  32. package/dist/pages/my-sonic/actions/change-customer/change-customer-dialog.js +10 -4
  33. package/dist/pages/my-sonic/actions/change-customer/change-customer.d.ts +5 -2
  34. package/dist/pages/my-sonic/actions/change-customer/change-customer.js +16 -7
  35. package/dist/pages/my-sonic/actions/change-customer/change-customer.module.css.js +1 -1
  36. package/dist/pages/my-sonic/actions/change-customer/connected-change-customer-dialog.d.ts +7 -2
  37. package/dist/pages/my-sonic/actions/change-customer/connected-change-customer-dialog.js +9 -6
  38. package/dist/pages/my-sonic/actions/change-password/change-password-dialog.d.ts +10 -0
  39. package/dist/pages/my-sonic/actions/change-password/change-password-dialog.js +24 -0
  40. package/dist/pages/my-sonic/actions/change-password/change-password.d.ts +7 -0
  41. package/dist/pages/my-sonic/actions/change-password/change-password.js +35 -0
  42. package/dist/pages/my-sonic/actions/change-password/change-password.module.css.js +3 -0
  43. package/dist/pages/my-sonic/actions/change-password/connected-change-password-dialog.d.ts +5 -0
  44. package/dist/pages/my-sonic/actions/change-password/connected-change-password-dialog.js +39 -0
  45. package/dist/pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog.d.ts +5 -0
  46. package/dist/pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog.js +56 -0
  47. package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info-dialog.d.ts +10 -0
  48. package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info-dialog.js +15 -0
  49. package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info.d.ts +11 -0
  50. package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info.js +29 -0
  51. package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info.module.css.js +3 -0
  52. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.d.ts +4 -0
  53. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.js +9 -0
  54. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.d.ts +4 -0
  55. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.js +9 -0
  56. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.d.ts +5 -0
  57. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.js +10 -0
  58. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.d.ts +4 -0
  59. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.js +9 -0
  60. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.d.ts +4 -0
  61. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.js +10 -0
  62. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.d.ts +5 -0
  63. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.js +10 -0
  64. package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.module.css.js +3 -0
  65. package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +3 -4
  66. package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.module.css.js +3 -0
  67. package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.d.ts +2 -1
  68. package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.js +2 -2
  69. package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.d.ts +2 -1
  70. package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +2 -2
  71. package/dist/pages/my-sonic/widgets/connected-customer-information-widget.js +3 -3
  72. package/dist/pages/my-sonic/widgets/connected-user-account-widget.js +16 -5
  73. package/dist/shared/api/shared/hooks/use-awaitable-mutation.d.ts +1 -0
  74. package/dist/shared/api/shared/hooks/use-awaitable-mutation.js +6 -0
  75. package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-account.d.ts +1 -1
  76. package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-account.js +3 -1
  77. package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-guest-account.js +3 -1
  78. package/dist/shared/api/storefront/hooks/account/use-fetch-current-account.d.ts +3 -0
  79. package/dist/shared/api/storefront/hooks/account/use-fetch-current-account.js +13 -0
  80. package/dist/shared/api/storefront/hooks/account/use-patch-current-account.d.ts +11 -0
  81. package/dist/shared/api/storefront/hooks/account/use-patch-current-account.js +20 -0
  82. package/dist/shared/api/storefront/hooks/authentication/use-patch-session.d.ts +1 -0
  83. package/dist/shared/api/storefront/hooks/authentication/use-patch-session.js +1 -1
  84. package/dist/shared/api/storefront/hooks/cart/use-patch-cart.d.ts +1 -0
  85. package/dist/shared/api/storefront/hooks/cart/use-place-order.d.ts +1 -0
  86. package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.d.ts +1 -0
  87. package/dist/shared/api/storefront/services/account-service.d.ts +31 -0
  88. package/dist/shared/api/storefront/services/account-service.js +84 -0
  89. package/dist/shared/api/storefront/services/authentication-service.d.ts +7 -26
  90. package/dist/shared/api/storefront/services/authentication-service.js +38 -65
  91. package/dist/styles.css +351 -240
  92. package/package.json +1 -1
  93. /package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-guest-account.d.ts +0 -0
@@ -1,4 +1,5 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
+ import { isValidElement } from 'react';
2
3
  import clsx from 'clsx';
3
4
  import { FormattedMessage } from '../../intl/formatted-message.js';
4
5
  import { ProgressCircle } from '../../loading/progress-circle.js';
@@ -8,43 +9,59 @@ import styles from './data-card.module.css.js';
8
9
 
9
10
  function DataCard({ actions, data, 'data-test-selector': dataTestSelector, isLoading = false, rendering, showError = false, title, }) {
10
11
  const dataFields = data.flatMap((entry) => entry.type === 'section' ? entry.data : [entry]);
11
- const visibleData = dataFields.filter(({ value }) => Boolean(value));
12
+ const visibleData = dataFields.filter(dataField => isDataFieldVisible(dataField, rendering));
12
13
  const hasItems = visibleData.length > 0;
13
- const sections = sectionizeItems(data);
14
- return (jsxs("section", { className: styles['data-card-container'], "data-test-selector": dataTestSelector, children: [title && (jsx(Heading, { className: styles.title, size: "xxs", tag: "h3", children: jsx(FormattedMessage, { id: title }) })), jsx("div", { className: styles['data-card'], children: showError ? (jsx("div", { className: styles['error-container'], children: showError instanceof UnauthorizedRequestError ? (jsx(FormattedMessage, { id: "You are not authorized to access this information." })) : typeof showError === 'string' ? (jsx(FormattedMessage, { id: showError })) : (jsx(FormattedMessage, { id: "An unexpected error occured" })) })) : isLoading ? (jsx("div", { className: styles['loading-container'], children: jsx(ProgressCircle, { variant: "gray" }) })) : hasItems ? (jsxs("div", { className: clsx(styles['container']), children: [jsx("dl", { className: styles['data-table'], children: sections.map(section => (jsx(DataTableSection, { dataSection: section, rendering: rendering }, section.key))) }), actions?.length && (jsx("div", { className: styles['data-card-actions'], children: actions }))] })) : (jsx("div", { className: clsx(styles['no-data-container']), children: jsx(FormattedMessage, { id: "There is no information to display" }) })) })] }));
14
+ const sections = sectionizeItems(data, rendering);
15
+ return (jsxs("section", { className: styles['data-card-container'], "data-test-selector": dataTestSelector, children: [title && (jsx(Heading, { className: styles.title, size: "xxs", tag: "h3", children: jsx(FormattedMessage, { id: title }) })), jsx("div", { className: styles['data-card'], children: showError ? (jsx("div", { className: styles['error-container'], children: showError instanceof UnauthorizedRequestError ? (jsx(FormattedMessage, { id: "You are not authorized to access this information." })) : typeof showError === 'string' ? (jsx(FormattedMessage, { id: showError })) : (jsx(FormattedMessage, { id: "An unexpected error occured" })) })) : isLoading ? (jsx("div", { className: styles['loading-container'], children: jsx(ProgressCircle, { variant: "gray" }) })) : hasItems ? (jsxs("div", { className: clsx(styles['container']), children: [jsx("dl", { className: styles['data-table'], children: sections.map(section => (jsx(DataTableSection, { dataSection: section, rendering: rendering }, section.key))) }), Boolean(actions?.length) && (jsx("div", { className: styles['data-card-actions'], children: actions }))] })) : (jsx("div", { className: clsx(styles['no-data-container']), children: jsx(FormattedMessage, { id: "There is no information to display" }) })) })] }));
16
+ }
17
+ function renderValue(rendering, key, value) {
18
+ const renderedValue = rendering?.value
19
+ ? rendering.value({ key, value })
20
+ : value !== undefined && value !== null
21
+ ? String(value)
22
+ : null;
23
+ if (renderedValue === null ||
24
+ renderedValue === undefined ||
25
+ renderedValue === 'string' ||
26
+ isValidElement(renderedValue))
27
+ return renderedValue;
28
+ return String(renderedValue);
15
29
  }
16
30
  function DataTable({ data, rendering, }) {
17
31
  return data.map(({ key, label, value }, index) => (jsxs(Fragment, { children: [jsx("dt", { className: clsx(styles['data-table-key'], {
18
32
  [styles['data-table-section-end']]: index === data.length - 1,
19
- }), children: rendering?.label ? (rendering.label({ key, label })) : (jsx(FormattedMessage, { id: label })) }), jsx("dd", { className: styles['data-table-value'], "data-key": key, children: rendering?.value
20
- ? rendering.value({ key, value })
21
- : value !== undefined && value !== null
22
- ? String(value)
23
- : null })] }, key)));
33
+ }), children: rendering?.label ? (rendering.label({ key, label })) : (jsx(FormattedMessage, { id: label })) }), jsx("dd", { className: styles['data-table-value'], "data-key": key, children: renderValue(rendering, key, value) })] }, key)));
24
34
  }
25
35
  function DataTableSection({ dataSection, rendering, }) {
26
36
  return (jsxs(Fragment, { children: [dataSection.heading && (jsx(Heading, { className: styles['data-table-section-heading'], size: "xxxs", tag: "h3", children: dataSection.heading })), jsx(DataTable, { data: dataSection.data, rendering: rendering })] }));
27
37
  }
28
- function sectionizeItems(data) {
29
- const result = [];
38
+ function isDataFieldVisible({ key, value }, rendering) {
39
+ return Boolean(renderValue(rendering, key, value));
40
+ }
41
+ function sectionizeItems(data, rendering) {
42
+ const dataSections = [];
30
43
  let currentSection = null;
31
44
  data.forEach((item, index) => {
32
45
  if (item.type === 'section') {
33
46
  currentSection = null;
34
- result.push(item);
35
- }
36
- else if (currentSection) {
37
- currentSection.data.push(item);
47
+ dataSections.push(item);
38
48
  }
39
49
  else {
40
- result.push((currentSection = {
41
- data: [item],
42
- key: `section-${index}`,
43
- type: 'section',
44
- }));
50
+ if (!isDataFieldVisible(item, rendering))
51
+ return;
52
+ if (currentSection) {
53
+ currentSection.data.push(item);
54
+ }
55
+ else {
56
+ dataSections.push((currentSection = {
57
+ data: [item],
58
+ key: `section-${index}`,
59
+ type: 'section',
60
+ }));
61
+ }
45
62
  }
46
63
  });
47
- return result;
64
+ return dataSections.filter(section => section.data.length > 0);
48
65
  }
49
66
 
50
67
  export { DataCard };
@@ -1,3 +1,3 @@
1
- var styles = {"data-card-container":"data-card-module-OMXIh","title":"data-card-module-DMbBO","data-card":"data-card-module-24uin","error-container":"data-card-module-j-RFT","loading-container":"data-card-module-d9zvu","no-data-container":"data-card-module-FVD44","container":"data-card-module-ZefqY","data-table":"data-card-module-EDbE-","data-table-section-heading":"data-card-module-CjTal","data-table-section-end":"data-card-module-QixKJ","data-table-key":"data-card-module-FAgmN","data-table-value":"data-card-module-fcSbu","data-card-actions":"data-card-module-Qv5iI"};
1
+ var styles = {"data-card-container":"data-card-module-OMXIh","title":"data-card-module-DMbBO","data-card":"data-card-module-24uin","error-container":"data-card-module-j-RFT","loading-container":"data-card-module-d9zvu","no-data-container":"data-card-module-FVD44","container":"data-card-module-ZefqY","data-table":"data-card-module-EDbE-","data-table-section-heading":"data-card-module-CjTal","data-table-section-end":"data-card-module-QixKJ","data-table-value":"data-card-module-fcSbu","data-table-key":"data-card-module-FAgmN","data-card-actions":"data-card-module-Qv5iI"};
2
2
 
3
3
  export { styles as default };
@@ -28,11 +28,7 @@ function CountrySelectorDialog({ countries, isDismissable, isOpen, onOpenChange,
28
28
  return (jsx(Dialog, { hideTitle: true, allowClose: isDismissable, className: {
29
29
  dialog: styles['country-selector-dialog'],
30
30
  modal: styles.modal,
31
- }, footer: jsx(Button, { withArrow: true, "data-test-selector": "clSelector_apply", type: "submit", children: jsx(FormattedMessage, { id: "Save" }) }), hasCloseButton: isDismissable, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: onOpenChange, onSubmit: e => {
32
- onSubmit({ country: currentCountry, language: currentLanguage });
33
- e.preventDefault();
34
- e.stopPropagation();
35
- }, shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(CountrySelect, { isRequired: true, countries: countries, countryNameInLanguageOfCountry: true, "data-test-selector": "clSelector_country", onCountryChange: onCountryChange, selectedCountry: currentCountry })), jsx(Select, { isRequired: true, "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, placeholder: t('Select a language'), selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
31
+ }, footer: jsx(Button, { withArrow: true, "data-test-selector": "clSelector_apply", type: "submit", children: jsx(FormattedMessage, { id: "Save" }) }), hasCloseButton: isDismissable, isDismissable: isDismissable, isOpen: isOpen, onOpenChange: onOpenChange, onSubmit: () => onSubmit({ country: currentCountry, language: currentLanguage }), shouldCloseOnInteractOutside: isDismissable, title: "Country Selector", children: jsxs("div", { className: styles.content, children: [jsx("svg", { className: styles.logo, height: "32", viewBox: "0 0 134 32", width: "134", xmlns: "http://www.w3.org/2000/svg", children: jsxs("g", { fill: "none", fillRule: "evenodd", children: [jsx("path", { d: "M15.83 11.533c2.42 0 4.382 1.977 4.382 4.415 0 8.794-7.1 15.95-15.83 15.95C1.963 31.897 0 29.92 0 27.481c0-2.354 1.83-4.278 4.134-4.408l.249-.007c3.797 0 6.905-3.036 7.058-6.826l.006-.293c0-2.438 1.963-4.415 4.383-4.415zM15.83 0c2.42 0 4.383 1.977 4.383 4.415 0 2.355-1.83 4.279-4.134 4.409l-.249.007c-3.8 0-6.906 3.035-7.059 6.824l-.006.293c0 2.438-1.962 4.415-4.382 4.415S0 18.386 0 15.948C0 7.154 7.101 0 15.83 0zm8.208 16.022c0 8.794 7.101 15.95 15.83 15.95s15.83-7.156 15.83-15.95S48.597.074 39.868.074s-15.83 7.154-15.83 15.948zm8.765 0c0-3.924 3.169-7.118 7.065-7.118 3.895 0 7.065 3.194 7.065 7.118 0 3.926-3.17 7.119-7.065 7.119-3.896 0-7.065-3.193-7.065-7.12zm76.888-11.276c-6.173 6.217-6.173 16.335-.002 22.553 6.173 6.217 16.215 6.217 22.388 0a4.44 4.44 0 0 0 .001-6.244 4.359 4.359 0 0 0-6.003-.184l-.194.184a7.04 7.04 0 0 1-9.994 0c-2.753-2.775-2.753-7.29.002-10.065a7.036 7.036 0 0 1 9.751-.233l.24.231a4.36 4.36 0 0 0 6.198 0 4.44 4.44 0 0 0-.001-6.245c-6.173-6.217-16.215-6.216-22.386.003zm-17.162-.174v22.863c0 2.439 1.961 4.416 4.381 4.416 2.422 0 4.384-1.977 4.384-4.416V4.572c0-2.439-1.962-4.416-4.384-4.416-2.42 0-4.38 1.977-4.38 4.416zM64.1.1c-2.42 0-4.383 1.977-4.383 4.415v23.07c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V8.93h3.933c3.895 0 7.065 3.192 7.065 7.118v11.537c0 2.438 1.962 4.415 4.382 4.415s4.383-1.977 4.383-4.415V16.048C88.244 7.254 81.143.1 72.414.1h-8.316z", fill: "#000" }), jsx("path", { d: "M47.036 16.022c0 3.99-3.209 7.222-7.168 7.222-3.96 0-7.169-3.233-7.169-7.222 0-3.989 3.21-7.222 7.169-7.222 3.96 0 7.168 3.233 7.168 7.222", fill: "#E30613" })] }) }), jsx("p", { className: styles.intro, children: jsx(FormattedMessage, { id: "Welcome to Sonic Equipment. Please choose your country and language below." }) }), jsxs("div", { className: styles.selects, children: [showCountry && (jsx(CountrySelect, { isRequired: true, countries: countries, countryNameInLanguageOfCountry: true, "data-test-selector": "clSelector_country", onCountryChange: onCountryChange, selectedCountry: currentCountry })), jsx(Select, { isRequired: true, "data-test-selector": "clSelector_language", label: t('Language'), onChange: value => setCurrentLanguage(currentCountry.languages.find(language => language.id === value) || currentLanguage), options: languageOptions, placeholder: t('Select a language'), selectedOption: currentLanguage.id, showPlaceholder: false, variant: "solid" })] })] }) }));
36
32
  }
37
33
 
38
34
  export { CountrySelectorDialog };
package/dist/exports.d.ts CHANGED
@@ -101,6 +101,7 @@ export * from './forms/input/input';
101
101
  export * from './forms/label/label';
102
102
  export * from './forms/number-field/number-field';
103
103
  export * from './forms/password-field/password-field';
104
+ export * from './forms/password-validation/password-validation';
104
105
  export * from './forms/search-field/search-field';
105
106
  export * from './forms/select-field/select-field';
106
107
  export * from './forms/select/select';
@@ -170,6 +171,8 @@ export * from './lists/menu-list/menu-list-header';
170
171
  export * from './lists/menu-list/menu-list-item';
171
172
  export * from './lists/orderline-list/orderline-list';
172
173
  export * from './lists/product-overview-grid/product-overview-grid';
174
+ export * from './lists/widget-grid/widget';
175
+ export * from './lists/widget-grid/widget-grid';
173
176
  export * from './loading/blank-page-spacer';
174
177
  export * from './loading/loading-overlay';
175
178
  export * from './loading/progress-circle';
@@ -234,6 +237,18 @@ export * from './pages/loading-page/loading-page';
234
237
  export * from './pages/my-sonic/actions/change-customer/change-customer';
235
238
  export * from './pages/my-sonic/actions/change-customer/change-customer-dialog';
236
239
  export * from './pages/my-sonic/actions/change-customer/connected-change-customer-dialog';
240
+ export * from './pages/my-sonic/actions/change-password/change-password';
241
+ export * from './pages/my-sonic/actions/change-password/change-password-dialog';
242
+ export * from './pages/my-sonic/actions/change-password/connected-change-password-dialog';
243
+ export * from './pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog';
244
+ export * from './pages/my-sonic/actions/edit-user-info/edit-user-info';
245
+ export * from './pages/my-sonic/actions/edit-user-info/edit-user-info-dialog';
246
+ export * from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout';
247
+ export * from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside';
248
+ export * from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main';
249
+ export * from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page';
250
+ export * from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside';
251
+ export * from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title';
237
252
  export * from './pages/my-sonic/navigation/connected-my-sonic-navigation';
238
253
  export * from './pages/my-sonic/navigation/my-sonic-desktop-navigation';
239
254
  export * from './pages/my-sonic/navigation/my-sonic-mobile-navigation';
@@ -272,8 +287,10 @@ export * from './shared/api/bff/hooks/use-fetch-product-listing-page-data';
272
287
  export * from './shared/api/bff/hooks/use-fetch-recently-viewed-products';
273
288
  export * from './shared/api/bff/services/bff-service';
274
289
  export * from './shared/api/shared/hooks/use-awaitable-mutation';
275
- export * from './shared/api/storefront/hooks/authentication/use-create-account';
276
- export * from './shared/api/storefront/hooks/authentication/use-create-guest-account';
290
+ export * from './shared/api/storefront/hooks/account/use-create-account';
291
+ export * from './shared/api/storefront/hooks/account/use-create-guest-account';
292
+ export * from './shared/api/storefront/hooks/account/use-fetch-current-account';
293
+ export * from './shared/api/storefront/hooks/account/use-patch-current-account';
277
294
  export * from './shared/api/storefront/hooks/authentication/use-fetch-session';
278
295
  export * from './shared/api/storefront/hooks/authentication/use-invalidate-session';
279
296
  export * from './shared/api/storefront/hooks/authentication/use-is-authenticated';
@@ -321,6 +338,7 @@ export * from './shared/api/storefront/hooks/wishlist/use-create-wishlist';
321
338
  export * from './shared/api/storefront/hooks/wishlist/use-delete-wishlist-item-from-wishlist';
322
339
  export * from './shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items';
323
340
  export * from './shared/api/storefront/hooks/wishlist/use-fetch-wishlists';
341
+ export * from './shared/api/storefront/services/account-service';
324
342
  export * from './shared/api/storefront/services/authentication-service';
325
343
  export * from './shared/api/storefront/services/cart-service';
326
344
  export * from './shared/api/storefront/services/customer-service';
@@ -1,8 +1,11 @@
1
1
  import { ReactNode } from 'react';
2
- export interface OnSubmitParams {
2
+ import { FormProps as AriaFormProps } from 'react-aria-components';
3
+ export interface OnSubmitEventArgs {
3
4
  formData: FormData;
4
5
  submitter?: HTMLButtonElement;
5
6
  }
7
+ export type OnSubmitHandler = (e: OnSubmitEventArgs) => void;
8
+ export type ValidationErrors = AriaFormProps['validationErrors'];
6
9
  export interface FormProps {
7
10
  autoComplete?: boolean;
8
11
  children: ReactNode;
@@ -10,7 +13,8 @@ export interface FormProps {
10
13
  errorMessage?: string;
11
14
  footer?: ReactNode;
12
15
  header?: ReactNode;
13
- onSubmit?: ({ formData, submitter }: OnSubmitParams) => void;
16
+ onSubmit?: OnSubmitHandler;
14
17
  title?: string;
18
+ validationErrors?: ValidationErrors;
15
19
  }
16
- export declare function Form({ autoComplete, children, className, errorMessage, footer, header, onSubmit, title, }: FormProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function Form({ autoComplete, children, className, errorMessage, footer, header, onSubmit, title, validationErrors, }: FormProps): import("react/jsx-runtime").JSX.Element;
@@ -7,7 +7,7 @@ import { Message } from '../../message/message.js';
7
7
  import { scrollToTop } from '../../shared/hooks/use-scroll-to.js';
8
8
  import styles from './form.module.css.js';
9
9
 
10
- function Form({ autoComplete = false, children, className, errorMessage, footer, header, onSubmit, title, }) {
10
+ function Form({ autoComplete = false, children, className, errorMessage, footer, header, onSubmit, title, validationErrors, }) {
11
11
  const handleSubmit = (event) => {
12
12
  if (onSubmit) {
13
13
  event.preventDefault();
@@ -22,7 +22,7 @@ function Form({ autoComplete = false, children, className, errorMessage, footer,
22
22
  scrollToTop();
23
23
  }
24
24
  }, [errorMessage]);
25
- return (jsxs(Form$1, { "aria-label": title, autoComplete: autoComplete ? 'on' : 'off', className: clsx(styles['form'], className), onSubmit: handleSubmit, validationBehavior: "native", children: [jsx("header", { className: styles['form-header'], children: header }), errorMessage && (jsx("section", { className: styles['error-messages'], children: jsx(Message, { type: "danger", children: errorMessage }) })), children, jsx("footer", { className: styles['form-footer'], children: footer })] }));
25
+ return (jsxs(Form$1, { "aria-label": title, autoComplete: autoComplete ? 'on' : 'off', className: clsx(styles['form'], className), onSubmit: handleSubmit, validationBehavior: "native", validationErrors: validationErrors, children: [jsx("header", { className: styles['form-header'], children: header }), errorMessage && (jsx("section", { className: styles['error-messages'], children: jsx(Message, { type: "danger", children: errorMessage }) })), children, jsx("footer", { className: styles['form-footer'], children: footer })] }));
26
26
  }
27
27
 
28
28
  export { Form };
@@ -0,0 +1,4 @@
1
+ export declare function PasswordValidation({ isDisabled, onPasswordChanged, }: {
2
+ isDisabled?: boolean;
3
+ onPasswordChanged?: (password: string | undefined) => void;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { useState, useCallback, useEffect } from 'react';
3
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
4
+ import { validatePassword } from '../../shared/model/account.js';
5
+ import { FormSegment } from '../form/form-segment.js';
6
+ import { PasswordField } from '../password-field/password-field.js';
7
+
8
+ function PasswordValidation({ isDisabled = false, onPasswordChanged, }) {
9
+ const t = useFormattedMessage();
10
+ const [password, setPassword] = useState('');
11
+ const [passwordConfirm, setPasswordConfirm] = useState('');
12
+ const isMatchingPasswords = useCallback(() => {
13
+ if (!password || !passwordConfirm)
14
+ return undefined;
15
+ return password === passwordConfirm;
16
+ }, [password, passwordConfirm]);
17
+ useEffect(() => {
18
+ if (!isMatchingPasswords())
19
+ return onPasswordChanged?.(password);
20
+ onPasswordChanged?.(password);
21
+ }, [isMatchingPasswords, onPasswordChanged, password, passwordConfirm]);
22
+ return (jsxs(Fragment, { children: [jsx(FormSegment, { children: jsx(PasswordField, { autoComplete: "new-password", "data-test-selector": "new_password", info: "Password must be at least 8 characters long, include at least one number, at least one lowercase character, at least one uppercase character and at least one non-alphanumeric character.", isDisabled: isDisabled, isRequired: true, label: t('New password'), name: "new-password", onChange: setPassword, validate: value => {
23
+ if (!value)
24
+ return;
25
+ return (validatePassword(value) ||
26
+ t('Password does not meet requirements'));
27
+ } }) }), jsx(FormSegment, { children: jsx(PasswordField, { autoComplete: "new-password", customErrorMessage: isMatchingPasswords() === false
28
+ ? 'Passwords do not match'
29
+ : undefined, "data-test-selector": "new_passwordConfirm", isDisabled: isDisabled, isInvalid: isMatchingPasswords() === false ? true : undefined, isRequired: true, label: t('Confirm password'), onChange: setPasswordConfirm, value: passwordConfirm }) })] }));
30
+ }
31
+
32
+ export { PasswordValidation };
@@ -1,4 +1,5 @@
1
1
  export interface SelectProps<T> {
2
+ className?: string;
2
3
  'data-test-selector'?: string;
3
4
  defaultSelectedOption?: keyof T;
4
5
  icon?: React.ReactNode;
@@ -16,4 +17,4 @@ export interface SelectProps<T> {
16
17
  size?: 'sm' | 'md';
17
18
  variant?: 'outline' | 'solid';
18
19
  }
19
- export declare function Select<T extends Record<string, string>>({ 'data-test-selector': dataTestSelector, defaultSelectedOption, icon, isDisabled, isLoading, isRequired, label, name, onChange, options, placeholder, selectedOption, showLabel, showPlaceholder, size, variant, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
20
+ export declare function Select<T extends Record<string, string>>({ className, 'data-test-selector': dataTestSelector, defaultSelectedOption, icon, isDisabled, isLoading, isRequired, label, name, onChange, options, placeholder, selectedOption, showLabel, showPlaceholder, size, variant, }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,7 @@ import { Label } from '../label/label.js';
11
11
  import styles from './select.module.css.js';
12
12
 
13
13
  const defaultIcon = (jsx(GlyphsChevronsSlimDownIcon, { "aria-hidden": "true", className: styles.chevron }));
14
- function Select({ 'data-test-selector': dataTestSelector, defaultSelectedOption, icon = defaultIcon, isDisabled = false, isLoading, isRequired = false, label, name, onChange, options, placeholder, selectedOption, showLabel = false, showPlaceholder = true, size = 'md', variant = 'outline', }) {
14
+ function Select({ className, 'data-test-selector': dataTestSelector, defaultSelectedOption, icon = defaultIcon, isDisabled = false, isLoading, isRequired = false, label, name, onChange, options, placeholder, selectedOption, showLabel = false, showPlaceholder = true, size = 'md', variant = 'outline', }) {
15
15
  const selectRef = useRef(null);
16
16
  useEffect(() => {
17
17
  const updateWidth = () => {
@@ -28,7 +28,7 @@ function Select({ 'data-test-selector': dataTestSelector, defaultSelectedOption,
28
28
  }, []);
29
29
  return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: clsx(styles.select, styles[size], styles[variant], {
30
30
  [styles['loading']]: isLoading,
31
- }), "data-test-selector": dataTestSelector, defaultSelectedKey: defaultSelectedOption === undefined
31
+ }, className), "data-test-selector": dataTestSelector, defaultSelectedKey: defaultSelectedOption === undefined
32
32
  ? undefined
33
33
  : String(defaultSelectedOption), isDisabled: isDisabled, isRequired: isRequired, name: name, onSelectionChange: selected => onChange?.(selected), placeholder: placeholder || label, selectedKey: selectedOption === undefined ? undefined : String(selectedOption), children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), jsxs(Button, { className: styles.button, children: [jsx(SelectValue, { "data-test-selector": "value" }), jsx("div", { className: styles['icon-wrapper'], children: isLoading ? jsx(ProgressCircle, { variant: "gray" }) : icon })] }), jsx(FieldError, {}), jsx(Popover, { ref: ref =>
34
34
  // Workaround for react/react-aria #1513
package/dist/index.js CHANGED
@@ -105,6 +105,7 @@ export { Input } from './forms/input/input.js';
105
105
  export { Label } from './forms/label/label.js';
106
106
  export { NumberField } from './forms/number-field/number-field.js';
107
107
  export { PasswordField } from './forms/password-field/password-field.js';
108
+ export { PasswordValidation } from './forms/password-validation/password-validation.js';
108
109
  export { SearchField } from './forms/search-field/search-field.js';
109
110
  export { SelectField } from './forms/select-field/select-field.js';
110
111
  export { Select } from './forms/select/select.js';
@@ -172,6 +173,8 @@ export { MenuListHeader } from './lists/menu-list/menu-list-header.js';
172
173
  export { MenuListItem } from './lists/menu-list/menu-list-item.js';
173
174
  export { OrderLineList } from './lists/orderline-list/orderline-list.js';
174
175
  export { ProductOverviewGrid } from './lists/product-overview-grid/product-overview-grid.js';
176
+ export { Widget } from './lists/widget-grid/widget.js';
177
+ export { WidgetGrid } from './lists/widget-grid/widget-grid.js';
175
178
  export { BlankPageSpacer } from './loading/blank-page-spacer.js';
176
179
  export { LoadingOverlay } from './loading/loading-overlay.js';
177
180
  export { ProgressCircle } from './loading/progress-circle.js';
@@ -236,6 +239,18 @@ export { LoadingPage } from './pages/loading-page/loading-page.js';
236
239
  export { ChangeCustomer } from './pages/my-sonic/actions/change-customer/change-customer.js';
237
240
  export { ChangeCustomerDialog } from './pages/my-sonic/actions/change-customer/change-customer-dialog.js';
238
241
  export { ConnectedChangeCustomerDialog } from './pages/my-sonic/actions/change-customer/connected-change-customer-dialog.js';
242
+ export { ChangePassword } from './pages/my-sonic/actions/change-password/change-password.js';
243
+ export { ChangePasswordDialog } from './pages/my-sonic/actions/change-password/change-password-dialog.js';
244
+ export { ConnectedChangePasswordDialog } from './pages/my-sonic/actions/change-password/connected-change-password-dialog.js';
245
+ export { ConnectedEditUserInfoDialog } from './pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog.js';
246
+ export { EditUserInfo } from './pages/my-sonic/actions/edit-user-info/edit-user-info.js';
247
+ export { EditUserInfoDialog } from './pages/my-sonic/actions/edit-user-info/edit-user-info-dialog.js';
248
+ export { MySonicLayout } from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.js';
249
+ export { MySonicLayoutAside } from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.js';
250
+ export { MySonicLayoutMain } from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.js';
251
+ export { MySonicLayoutPage } from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.js';
252
+ export { MySonicLayoutPreAside } from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.js';
253
+ export { MySonicLayoutTitle } from './pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.js';
239
254
  export { ConnectedMySonicNavigation } from './pages/my-sonic/navigation/connected-my-sonic-navigation.js';
240
255
  export { MySonicDesktopNavigation } from './pages/my-sonic/navigation/my-sonic-desktop-navigation.js';
241
256
  export { MySonicMobileNavigation } from './pages/my-sonic/navigation/my-sonic-mobile-navigation.js';
@@ -273,8 +288,10 @@ export { useFetchProductListingPageData } from './shared/api/bff/hooks/use-fetch
273
288
  export { useFetchRecentlyViewedProducts } from './shared/api/bff/hooks/use-fetch-recently-viewed-products.js';
274
289
  export { fetchAnnouncements, fetchNavigationLinks, fetchProductDetailsPageData, fetchProductListingPageData, fetchRecentlyViewedProducts } from './shared/api/bff/services/bff-service.js';
275
290
  export { useAwaitableMutation } from './shared/api/shared/hooks/use-awaitable-mutation.js';
276
- export { useCreateAccount } from './shared/api/storefront/hooks/authentication/use-create-account.js';
277
- export { useCreateGuestAccount } from './shared/api/storefront/hooks/authentication/use-create-guest-account.js';
291
+ export { useCreateAccount } from './shared/api/storefront/hooks/account/use-create-account.js';
292
+ export { useCreateGuestAccount } from './shared/api/storefront/hooks/account/use-create-guest-account.js';
293
+ export { useFetchCurrentAccount } from './shared/api/storefront/hooks/account/use-fetch-current-account.js';
294
+ export { usePatchCurrentAccount } from './shared/api/storefront/hooks/account/use-patch-current-account.js';
278
295
  export { useFetchSession } from './shared/api/storefront/hooks/authentication/use-fetch-session.js';
279
296
  export { useInvalidateSession } from './shared/api/storefront/hooks/authentication/use-invalidate-session.js';
280
297
  export { useIsAuthenticated } from './shared/api/storefront/hooks/authentication/use-is-authenticated.js';
@@ -322,7 +339,8 @@ export { useCreateWishList } from './shared/api/storefront/hooks/wishlist/use-cr
322
339
  export { useDeleteWishListItemFromWishList } from './shared/api/storefront/hooks/wishlist/use-delete-wishlist-item-from-wishlist.js';
323
340
  export { useFetchAllWishListsItems } from './shared/api/storefront/hooks/wishlist/use-fetch-all-wishlists-items.js';
324
341
  export { useFetchWishLists } from './shared/api/storefront/hooks/wishlist/use-fetch-wishlists.js';
325
- export { ExistingAccountError, createAccount, createGuestAccount, createSession, fetchSession, patchSession, recoverPassword, signIn, signOut } from './shared/api/storefront/services/authentication-service.js';
342
+ export { ExistingAccountError, createAccount, createGuestAccount, fetchCurrentAccount, patchCurrentAccount } from './shared/api/storefront/services/account-service.js';
343
+ export { InvalidPasswordError, NonUniquePasswordError, createSession, fetchSession, patchSession, recoverPassword, signIn, signOut } from './shared/api/storefront/services/authentication-service.js';
326
344
  export { addProductToCurrentCart, convertToMinorUnits, deleteCartLineById, deleteCurrentCart, fetchCart, fetchCurrentCart, fetchCurrentCartLines, fetchCurrentCartProductAtp, fetchCurrentCartPromotions, fetchCurrentCheckoutAtp, getAdyenPaymentDetails, patchCart, patchCartLineById, placeOrder, postAdyenPayment, saveCartForLater } from './shared/api/storefront/services/cart-service.js';
327
345
  export { fetchBillToAddresses, fetchCurrentBillToAddress, fetchCurrentShipToAddress, fetchFulfillmentMethods, fetchShipToAddresses, patchBillToAddress } from './shared/api/storefront/services/customer-service.js';
328
346
  export { validateVATNumber } from './shared/api/storefront/services/finance-service.js';
@@ -1 +1 @@
1
- export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Account' | 'Access denied.' | 'active' | 'Add order notes' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address' | 'Amount: {0}' | 'An error occurred while changing the customer.' | 'An error occurred while fetching customers. Please try again later.' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'ascending' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Billing' | 'Cancel' | 'Cart' | 'Change customer' | 'Change password' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Checkout order' | 'Chosen filters' | 'City' | 'Clear filters' | 'Clear' | 'Click the button below to continue shopping.' | 'Client cases' | 'Close' | 'CoC number' | 'Company name' | 'Conceal value' | 'Confirm password' | 'Continue shopping' | 'Continue to sign in' | 'Continue' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Delivery date' | 'Delivery expected on {0}' | 'descending' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Edit' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Favorites' | 'Features' | 'Finalize order' | 'Finalize payment' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'Incl. VAT' | 'Includes' | 'Industry' | 'industry.AG' | 'industry.AU' | 'industry.AV' | 'industry.BC' | 'industry.MA' | 'industry.MC' | 'industry.OT' | 'industry.PP' | 'industry.TR' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'Log out' | 'Main menu' | 'More than {0} articles' | 'My Sonic' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New user?' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Orders' | 'Our products' | 'Overview' | 'Password does not meet requirements' | 'Password' | 'Passwords do not match' | 'Pay by invoice' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove all' | 'Requested delivery date' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | 'See all results' | 'Select a country' | 'Select a desired delivery date' | 'Select a language' | 'Select a list' | 'Select an industry' | 'Select other customer' | 'Selected customer' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Shopping cart' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sign in or create account' | 'sign in' | 'Sign me up for newsletters and product updates' | 'Signed in' | 'Signed out' | 'Signing in…' | 'Sonic account' | 'Sonic address' | 'Sonic Equipment' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'Specifications' | 'Start checkout' | 'Submenu' | 'Submit email address' | 'Submit' | 'Submitting…' | 'Subtotal' | 'Suggestions' | 'Support' | 'tag.limited' | 'tag.new' | 'The email address you entered is already associated with an existing account. Please sign in to this account or contact Customer Support.' | 'The expected delivery is an indication based on the product availability and the shipping location.' | 'The product has been added to your cart.' | 'The product has been removed from your cart.' | 'The product has been updated in your cart.' | 'There are more customers, please refine your search if needed.' | 'There are no products in your shopping cart.' | 'There is no information to display' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Validating' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You are not authorized to access this information.' | 'You are not authorized to view customers. Please log in or contact support.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!' | 'You must ' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'Your cart has been emptied.' | 'Your email and password were not recognized.' | 'Your favorites are available on multiple devices' | 'Your new Sonic Equipment account was succesfully created. You should receive an email soon with further instructions on how to activate this account. If you do not receive this email, please contact Customer Support.' | 'Your shopping cart is still empty';
1
+ export type TranslationId = "'{0}' in all products" | "Try 'Search' and try to find the product you're looking for" | "Unfortnately, We found no articles for your search '{0}'" | ' to your account to manage your lists.' | 'Access denied.' | 'Account' | 'active' | 'Add order notes' | 'Add to list' | 'Address 1' | 'Address 2' | 'Address 3' | 'Address 4' | 'Address' | 'Amount: {0}' | 'An error occurred while changing the customer.' | 'An error occurred while fetching customers. Please try again later.' | 'An error occurred while processing your payment. Please try again.' | 'An unexpected error occured' | 'An unexpected error occured. Please try again.' | 'Are you looking for information about our service? Please visit our customer support page' | 'Are you sure you want to remove all items from your cart?' | 'Are you sure you want to remove this item from your cart?' | 'article' | 'articles' | 'As soon as possible' | 'ascending' | 'Attention' | 'Availability unknown, please contact customer support for lead time or alternatives.' | 'Billing address' | 'Billing and shipping address' | 'Billing and shipping information' | 'Billing' | 'Cancel' | 'Cart' | 'Change customer' | 'Change password' | 'Changing your address is currently not possible. Please contact customer support to change your address.' | 'Checkout order' | 'Chosen filters' | 'City' | 'Clear filters' | 'Clear' | 'Click the button below to continue shopping.' | 'Client cases' | 'Close' | 'CoC number' | 'Company name' | 'Conceal value' | 'Confirm password' | 'Continue shopping' | 'Continue to sign in' | 'Continue' | 'Cost overview' | 'Country' | 'create account' | 'Create new list' | 'Currency Change' | 'Current page' | 'Current Password is invalid' | 'Delivery date' | 'Delivery expected on {0}' | 'descending' | 'Double check your spelling' | 'Downloads' | 'Easily add your favorite products' | 'Edit billing address' | 'Edit shipping address' | 'Edit Sonic account' | 'Edit' | 'Email' | 'Enter your email address and we will send you an email that will allow you to recover your password.' | 'Excl. VAT' | 'Explore by categories' | 'Exploring our products by category' | 'facet.categories' | 'facet.height' | 'facet.weight' | 'Favorites' | 'Features' | 'Finalize order' | 'Finalize payment' | 'First name' | 'Forgot password?' | 'Fulfillment method' | 'General' | 'Hide filters' | 'Home' | 'If an account matches the email address you entered, instructions on how to recover the password will be sent to that email address shortly. If you do not receive this email, please contact Customer Support.' | 'If you want to proceed, click the continue button. If you want to change your country, close this message and select a different country.' | 'Incl. VAT' | 'Includes' | 'Industry' | 'industry.AG' | 'industry.AU' | 'industry.AV' | 'industry.BC' | 'industry.MA' | 'industry.MC' | 'industry.OT' | 'industry.PP' | 'industry.TR' | 'Information' | 'Language' | 'Last name' | 'List name already exists' | 'Log out' | 'Main menu' | 'Make this the default customer' | 'More than {0} articles' | 'My Sonic' | 'Name' | 'Navigate to...' | 'Navigation' | 'New list name' | 'New Password is required and must be different than Current Password' | 'New password' | 'New user?' | 'No results found. Please refine your search.' | 'Number of favorites' | 'Number of products' | 'of' | 'Or continue as guest' | 'Order confirmation' | 'Order date' | 'Order number' | 'Order' | 'Orders' | 'Our products' | 'Overview' | 'Password changed. Please sign in again.' | 'Password does not meet requirements' | 'Password' | 'Passwords do not match' | 'Pay by invoice' | 'Payment method' | 'Payment' | 'pc' | 'Phone' | 'Pick up' | 'Pickup address' | 'Please enter a valid email address' | 'Please enter a valid phone number' | 'please go back to your cart.' | 'Please Sign In' | 'PO Number' | 'Popular searches' | 'Postal Code' | 'Print' | 'Private account' | 'Processing' | 'Product Features' | 'Product' | 'Products' | 'Quantity' | 'Quick access' | 'Recent searches' | 'Recently viewed' | 'Recover your password' | 'Remember me' | 'Remove all' | 'Requested delivery date' | 'Reveal value' | 'Review and payment' | 'Save order' | 'Save' | 'Saved cart for later.' | 'Search for a customer' | 'Search' | 'Searching again using more general terms' | 'See all results' | 'Select a country' | 'Select a desired delivery date' | 'Select a language' | 'Select a list' | 'Select an industry' | 'Select other customer' | 'Selected customer' | 'Selecting As Soon As Possible will enable us to send the products to you as they become available.' | 'Selecting this country will result in your cart to be converted to the currency {0}' | 'Share your favorite list with others' | 'Ship' | 'Shipping address' | 'Shipping and handling' | 'Shipping details' | 'Shop more efficiently and quicker with a favorites list' | 'Shopping cart' | 'Show all' | 'Show filters' | 'Show less' | 'Show' | 'Sign in or create account' | 'sign in' | 'Sign me up for newsletters and product updates' | 'Signed in' | 'Signed out' | 'Signing in…' | 'Sonic account' | 'Sonic address' | 'Sonic Equipment' | 'Sorry, there are no products found' | 'Sorry, we could not find matches for' | 'Sort by' | 'sort.newest' | 'sort.price_asc' | 'sort.price_desc' | 'sort.relevance' | 'Specifications' | 'Start checkout' | 'Submenu' | 'Submit email address' | 'Submit' | 'Submitting…' | 'Subtotal' | 'Suggestions' | 'Support' | 'tag.limited' | 'tag.new' | 'The email address you entered is already associated with an existing account. Please sign in to this account or contact Customer Support.' | 'The expected delivery is an indication based on the product availability and the shipping location.' | 'The product has been added to your cart.' | 'The product has been removed from your cart.' | 'The product has been updated in your cart.' | 'There are more customers, please refine your search if needed.' | 'There are no products in your shopping cart.' | 'There is no information to display' | 'This email is already in use' | 'Toggle navigation menu' | 'Total amount is' | 'Total' | 'Try another search' | 'Unable to add the product to your cart.' | 'Unable to empty your cart.' | 'Unable to remove the product from your cart.' | 'Unable to save cart for later.' | 'Unable to update the product in your cart.' | 'Unknown' | 'Updating address' | 'Use billing address' | 'Use fewer keywords' | 'Username' | 'Validating' | 'validation.badInput' | 'validation.customError' | 'validation.invalid' | 'validation.patternMismatch' | 'validation.rangeOverflow' | 'validation.rangeUnderflow' | 'validation.stepMismatch' | 'validation.tooLong' | 'validation.tooShort' | 'validation.typeMismatch' | 'validation.valid' | 'validation.valueMissing' | 'VAT Number' | 'VAT' | 'Welcome to Sonic Equipment. Please choose your country and language below.' | 'What are you searching for?' | 'You are not authorized to access this information.' | 'You are not authorized to perform this action' | 'You are not authorized to view customers. Please log in or contact support.' | 'You could try checking the spelling of your search query' | 'You could try exploring our products by category' | 'You could try' | 'You have reached the end of the results, but there may be more articles available. Adjust your filters or search to discover more!' | 'You must ' | 'You selected a country where we invoice in a different currency. This will result in your cart being converted to the new currency. If you would like to review your order, ' | 'Your cart has been emptied.' | 'Your email and password were not recognized.' | 'Your favorites are available on multiple devices' | 'Your new Sonic Equipment account was succesfully created. You should receive an email soon with further instructions on how to activate this account. If you do not receive this email, please contact Customer Support.' | 'Your shopping cart is still empty';
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import { useCallback } from 'react';
2
3
  import { useIntl } from './use-intl.js';
3
4
 
4
5
  function useFormattedMessage() {
@@ -10,7 +11,7 @@ function useFormattedMessage() {
10
11
  : `${translationIdOrPrefix}.${translationIdOrCount}.${count === 1 ? 'singular' : 'plural'}`));
11
12
  }
12
13
  formatFunction.pluralize = pluralize;
13
- return formatFunction;
14
+ return useCallback(formatFunction, [formattedMessage]);
14
15
  }
15
16
 
16
17
  export { useFormattedMessage };
@@ -6,6 +6,7 @@ export interface MenuListProps {
6
6
  title: string;
7
7
  };
8
8
  children: ReactNode;
9
+ className?: string;
9
10
  header?: string | {
10
11
  href: string;
11
12
  title: string;
@@ -13,4 +14,4 @@ export interface MenuListProps {
13
14
  scrollable?: boolean;
14
15
  variant?: MenuListVariant;
15
16
  }
16
- export declare function MenuList({ back, children, header, scrollable, variant, }: MenuListProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function MenuList({ back, children, className, header, scrollable, variant, }: MenuListProps): import("react/jsx-runtime").JSX.Element;
@@ -5,10 +5,10 @@ import { MenuListBackButton } from './menu-list-back-button.js';
5
5
  import { MenuListHeader } from './menu-list-header.js';
6
6
  import styles from './menu-list.module.css.js';
7
7
 
8
- function MenuList({ back, children, header, scrollable = true, variant = 'default', }) {
8
+ function MenuList({ back, children, className, header, scrollable = true, variant = 'default', }) {
9
9
  const headerTitle = typeof header === 'string' ? header : header?.title;
10
10
  const headerHref = typeof header === 'string' ? undefined : header?.href;
11
- return (jsxs("section", { className: clsx(styles['menu-list'], styles[variant], scrollable && styles['scrollable']), role: "menu", children: [back && (jsx(MenuListBackButton, { "data-test-selector": "menuListBackButton", onClick: back.onClick, children: back.title })), jsxs("div", { className: styles['scroll-area'], "data-test-selector": "menuListScrollArea", children: [header && (jsx(MenuListHeader, { "data-test-selector": "menuListHeader", href: headerHref, children: headerTitle })), jsx("ul", { className: styles['list'], children: children })] })] }));
11
+ return (jsxs("section", { className: clsx(styles['menu-list'], styles[variant], scrollable && styles['scrollable'], className), role: "menu", children: [back && (jsx(MenuListBackButton, { "data-test-selector": "menuListBackButton", onClick: back.onClick, children: back.title })), jsxs("div", { className: styles['scroll-area'], "data-test-selector": "menuListScrollArea", children: [header && (jsx(MenuListHeader, { "data-test-selector": "menuListHeader", href: headerHref, children: headerTitle })), jsx("ul", { className: styles['list'], children: children })] })] }));
12
12
  }
13
13
 
14
14
  export { MenuList };
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+ export interface WidgetGridProps {
3
+ children?: ReactNode;
4
+ }
5
+ export declare function WidgetGrid({ children }: WidgetGridProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import styles from './widget-grid.module.css.js';
4
+
5
+ function WidgetGrid({ children }) {
6
+ return jsx("div", { className: styles['widget-grid'], children: children });
7
+ }
8
+
9
+ export { WidgetGrid };
@@ -0,0 +1,3 @@
1
+ var styles = {"widget-grid":"widget-grid-module-GdtqD","widget":"widget-grid-module-y2wM2","size-full":"widget-grid-module-Pladu"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ export interface WidgetProps {
3
+ children?: ReactNode;
4
+ size?: 'default' | 'full';
5
+ }
6
+ export declare function Widget({ children, size }: WidgetProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
4
+ import styles from './widget-grid.module.css.js';
5
+
6
+ function Widget({ children, size = 'default' }) {
7
+ return (jsx("div", { className: clsx(styles['widget'], styles[`size-${size}`]), children: children }));
8
+ }
9
+
10
+ export { Widget };
@@ -1,5 +1,5 @@
1
- import { ComponentProps, ReactNode } from 'react';
2
- import { Form as AriaForm } from 'react-aria-components';
1
+ import { ReactNode } from 'react';
2
+ import { OnSubmitHandler, ValidationErrors } from '../../forms/form/form';
3
3
  import { ModalProps } from '../modal/modal';
4
4
  interface DialogProps extends Omit<ModalProps, 'children' | 'className'> {
5
5
  allowClose?: boolean;
@@ -16,16 +16,16 @@ interface DialogProps extends Omit<ModalProps, 'children' | 'className'> {
16
16
  form?: string;
17
17
  header?: string;
18
18
  heading?: string;
19
- modal?: string;
19
+ modal?: ModalProps['className'];
20
20
  };
21
21
  'data-test-selector'?: string;
22
22
  footer?: ReactNode | ((props: DialogFooterProps) => ReactNode);
23
23
  hideTitle?: boolean;
24
24
  isSubmitting?: boolean;
25
- onSubmit?: (e: React.FormEvent<HTMLFormElement>) => void;
25
+ onSubmit?: OnSubmitHandler;
26
26
  submitLabel?: string;
27
27
  title: string;
28
- validationErrors?: ComponentProps<typeof AriaForm>['validationErrors'];
28
+ validationErrors?: ValidationErrors;
29
29
  }
30
30
  interface DialogFooterProps {
31
31
  allowSubmit?: boolean;
@@ -1,9 +1,10 @@
1
1
  "use client";
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
- import { Dialog as Dialog$1, Form } from 'react-aria-components';
3
+ import { Dialog as Dialog$1 } from 'react-aria-components';
4
4
  import clsx from 'clsx';
5
5
  import { Button } from '../../buttons/button/button.js';
6
6
  import { IconButton } from '../../buttons/icon-button/icon-button.js';
7
+ import { Form } from '../../forms/form/form.js';
7
8
  import { StrokeCloseboxIcon } from '../../icons/stroke/stroke-closebox-icon.js';
8
9
  import { FormattedMessage } from '../../intl/formatted-message.js';
9
10
  import { useFormattedMessage } from '../../intl/use-formatted-message.js';
@@ -16,23 +17,22 @@ function Footer({ allowSubmit = true, cancelLabel, close, isSubmitting, submitLa
16
17
  }
17
18
  function Dialog({ allowClose = true, allowSubmit = true, cancelLabel = 'Close', children, className, 'data-test-selector': dataTestSelector = 'dialog', footer = Footer, hasCloseButton = true, hideTitle, isDismissable, isFullScreen, isKeyboardDismissDisabled, isOpen, isSubmitting = false, onOpenChange, onSubmit, shouldCloseOnInteractOutside, submitLabel = 'Submit', title, validationErrors, }) {
18
19
  const t = useFormattedMessage();
19
- return (jsx(Modal, { className: clsx(styles['modal-overlay'], typeof className === 'string' ? className : className?.modal), hasCloseButton: false, isDismissable: isDismissable, isFullScreen: isFullScreen, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, children: jsx(Dialog$1, { "aria-label": title, className: clsx(styles.dialog, typeof className === 'string' ? undefined : className?.dialog), "data-test-selector": dataTestSelector, children: ({ close }) => (jsxs(Form, { className: clsx(styles.form, typeof className === 'string' ? undefined : className?.form), onSubmit: e => {
20
- e.preventDefault();
21
- e.stopPropagation();
22
- onSubmit?.(e);
23
- }, validationErrors: validationErrors, children: [jsxs("header", { className: clsx(styles.header, typeof className === 'string' ? undefined : className?.header), children: [!hideTitle && (jsx(Heading, { className: clsx(styles.heading, typeof className === 'string'
24
- ? undefined
25
- : className?.heading), size: "xs", tag: "h2", children: title })), hasCloseButton && (jsx("div", { className: clsx(styles.close, typeof className === 'string'
26
- ? undefined
27
- : className?.close), children: jsx(IconButton, { "aria-label": t('Close'), color: "secondary", isDisabled: !allowClose, onClick: close, children: jsx(StrokeCloseboxIcon, {}) }) }))] }), jsx("div", { className: clsx(styles.content, typeof className === 'string' ? undefined : className?.content), children: children instanceof Function ? children({ close }) : children }), jsx("footer", { className: clsx(styles.footer, typeof className === 'string' ? undefined : className?.footer), children: footer instanceof Function
28
- ? footer({
29
- allowSubmit,
30
- cancelLabel,
31
- close,
32
- isSubmitting,
33
- submitLabel,
34
- })
35
- : footer })] })) }) }));
20
+ return (jsx(Modal, { className: {
21
+ modal: styles.modal,
22
+ overlay: clsx(styles['modal-overlay'], typeof className === 'string' ? className : className?.modal),
23
+ }, hasCloseButton: false, isDismissable: isDismissable, isFullScreen: isFullScreen, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, shouldCloseOnInteractOutside: shouldCloseOnInteractOutside, children: jsx(Dialog$1, { "aria-label": title, className: clsx(styles.dialog, typeof className === 'string' ? undefined : className?.dialog), "data-test-selector": dataTestSelector, children: ({ close }) => (jsx(Form, { className: clsx(styles.form, typeof className === 'string' ? undefined : className?.form), footer: jsx("div", { className: clsx(styles.footer, typeof className === 'string' ? undefined : className?.footer), children: footer instanceof Function
24
+ ? footer({
25
+ allowSubmit,
26
+ cancelLabel,
27
+ close,
28
+ isSubmitting,
29
+ submitLabel,
30
+ })
31
+ : footer }), header: jsxs(Fragment, { children: [!hideTitle && (jsx(Heading, { className: clsx(styles.heading, typeof className === 'string'
32
+ ? undefined
33
+ : className?.heading), size: "xs", tag: "h2", children: title })), hasCloseButton && (jsx("div", { className: clsx(styles.close, typeof className === 'string'
34
+ ? undefined
35
+ : className?.close), children: jsx(IconButton, { "aria-label": t('Close'), color: "secondary", isDisabled: !allowClose, onClick: close, children: jsx(StrokeCloseboxIcon, {}) }) }))] }), onSubmit: onSubmit, validationErrors: validationErrors, children: jsx("div", { className: clsx(styles.content, typeof className === 'string' ? undefined : className?.content), children: children instanceof Function ? children({ close }) : children }) })) }) }));
36
36
  }
37
37
 
38
38
  export { Dialog };
@@ -1,3 +1,3 @@
1
- var styles = {"dialog":"dialog-module-qKzgy","header":"dialog-module-ZnsAe","close":"dialog-module-Y7Tqg","footer":"dialog-module-y7Axm"};
1
+ var styles = {"modal":"dialog-module-uKVDu","dialog":"dialog-module-qKzgy","form":"dialog-module-5sZYV","close":"dialog-module-Y7Tqg","footer":"dialog-module-y7Axm"};
2
2
 
3
3
  export { styles as default };