@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.
- package/dist/cards/data-card/data-card.js +37 -20
- package/dist/cards/data-card/data-card.module.css.js +1 -1
- package/dist/country-selector/country-selector-dialog/country-selector-dialog.js +1 -5
- package/dist/exports.d.ts +20 -2
- package/dist/forms/form/form.d.ts +7 -3
- package/dist/forms/form/form.js +2 -2
- package/dist/forms/password-validation/password-validation.d.ts +4 -0
- package/dist/forms/password-validation/password-validation.js +32 -0
- package/dist/forms/select/select.d.ts +2 -1
- package/dist/forms/select/select.js +2 -2
- package/dist/index.js +21 -3
- package/dist/intl/translation-id.d.ts +1 -1
- package/dist/intl/use-formatted-message.js +2 -1
- package/dist/lists/menu-list/menu-list.d.ts +2 -1
- package/dist/lists/menu-list/menu-list.js +2 -2
- package/dist/lists/widget-grid/widget-grid.d.ts +5 -0
- package/dist/lists/widget-grid/widget-grid.js +9 -0
- package/dist/lists/widget-grid/widget-grid.module.css.js +3 -0
- package/dist/lists/widget-grid/widget.d.ts +6 -0
- package/dist/lists/widget-grid/widget.js +10 -0
- package/dist/modals/dialog/dialog.d.ts +5 -5
- package/dist/modals/dialog/dialog.js +18 -18
- package/dist/modals/dialog/dialog.module.css.js +1 -1
- package/dist/modals/recover-password/recover-password-dialog.js +1 -3
- package/dist/pages/account/components/create-account-form/create-account-form.js +2 -17
- package/dist/pages/account/create-account-page/create-account-page.js +4 -5
- package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +1 -1
- package/dist/pages/account/sign-in-page/sign-in-page.js +2 -3
- package/dist/pages/checkout/shipping-page/hooks/use-patch-shipping-details.d.ts +1 -0
- package/dist/pages/components/page-container/page-container.js +1 -1
- package/dist/pages/my-sonic/actions/change-customer/change-customer-dialog.d.ts +4 -3
- package/dist/pages/my-sonic/actions/change-customer/change-customer-dialog.js +10 -4
- package/dist/pages/my-sonic/actions/change-customer/change-customer.d.ts +5 -2
- package/dist/pages/my-sonic/actions/change-customer/change-customer.js +16 -7
- package/dist/pages/my-sonic/actions/change-customer/change-customer.module.css.js +1 -1
- package/dist/pages/my-sonic/actions/change-customer/connected-change-customer-dialog.d.ts +7 -2
- package/dist/pages/my-sonic/actions/change-customer/connected-change-customer-dialog.js +9 -6
- package/dist/pages/my-sonic/actions/change-password/change-password-dialog.d.ts +10 -0
- package/dist/pages/my-sonic/actions/change-password/change-password-dialog.js +24 -0
- package/dist/pages/my-sonic/actions/change-password/change-password.d.ts +7 -0
- package/dist/pages/my-sonic/actions/change-password/change-password.js +35 -0
- package/dist/pages/my-sonic/actions/change-password/change-password.module.css.js +3 -0
- package/dist/pages/my-sonic/actions/change-password/connected-change-password-dialog.d.ts +5 -0
- package/dist/pages/my-sonic/actions/change-password/connected-change-password-dialog.js +39 -0
- package/dist/pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog.d.ts +5 -0
- package/dist/pages/my-sonic/actions/edit-user-info/connected-edit-user-info-dialog.js +56 -0
- package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info-dialog.d.ts +10 -0
- package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info-dialog.js +15 -0
- package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info.d.ts +11 -0
- package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info.js +29 -0
- package/dist/pages/my-sonic/actions/edit-user-info/edit-user-info.module.css.js +3 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.d.ts +4 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-aside.js +9 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.d.ts +4 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-main.js +9 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.d.ts +5 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-page.js +10 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.d.ts +4 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-pre-aside.js +9 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.d.ts +4 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout-title.js +10 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.d.ts +5 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.js +10 -0
- package/dist/pages/my-sonic/layouts/my-sonic-layout/my-sonic-layout.module.css.js +3 -0
- package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.js +3 -4
- package/dist/pages/my-sonic/navigation/connected-my-sonic-navigation.module.css.js +3 -0
- package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.d.ts +2 -1
- package/dist/pages/my-sonic/navigation/my-sonic-desktop-navigation.js +2 -2
- package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.d.ts +2 -1
- package/dist/pages/my-sonic/navigation/my-sonic-mobile-navigation.js +2 -2
- package/dist/pages/my-sonic/widgets/connected-customer-information-widget.js +3 -3
- package/dist/pages/my-sonic/widgets/connected-user-account-widget.js +16 -5
- package/dist/shared/api/shared/hooks/use-awaitable-mutation.d.ts +1 -0
- package/dist/shared/api/shared/hooks/use-awaitable-mutation.js +6 -0
- package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-account.d.ts +1 -1
- package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-account.js +3 -1
- package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-guest-account.js +3 -1
- package/dist/shared/api/storefront/hooks/account/use-fetch-current-account.d.ts +3 -0
- package/dist/shared/api/storefront/hooks/account/use-fetch-current-account.js +13 -0
- package/dist/shared/api/storefront/hooks/account/use-patch-current-account.d.ts +11 -0
- package/dist/shared/api/storefront/hooks/account/use-patch-current-account.js +20 -0
- package/dist/shared/api/storefront/hooks/authentication/use-patch-session.d.ts +1 -0
- package/dist/shared/api/storefront/hooks/authentication/use-patch-session.js +1 -1
- package/dist/shared/api/storefront/hooks/cart/use-patch-cart.d.ts +1 -0
- package/dist/shared/api/storefront/hooks/cart/use-place-order.d.ts +1 -0
- package/dist/shared/api/storefront/hooks/customer/use-patch-bill-to-address.d.ts +1 -0
- package/dist/shared/api/storefront/services/account-service.d.ts +31 -0
- package/dist/shared/api/storefront/services/account-service.js +84 -0
- package/dist/shared/api/storefront/services/authentication-service.d.ts +7 -26
- package/dist/shared/api/storefront/services/authentication-service.js +38 -65
- package/dist/styles.css +351 -240
- package/package.json +1 -1
- /package/dist/shared/api/storefront/hooks/{authentication → account}/use-create-guest-account.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { config } from '../../../../config.js';
|
|
2
|
-
import { request, isRequestError
|
|
2
|
+
import { request, isRequestError } from '../../../fetch/request.js';
|
|
3
3
|
|
|
4
4
|
async function fetchSession() {
|
|
5
5
|
const { body } = await request({
|
|
@@ -8,17 +8,43 @@ async function fetchSession() {
|
|
|
8
8
|
});
|
|
9
9
|
return body;
|
|
10
10
|
}
|
|
11
|
+
class InvalidPasswordError extends Error {
|
|
12
|
+
constructor(error) {
|
|
13
|
+
super(error.body?.message || error.message);
|
|
14
|
+
this.name = 'InvalidPasswordError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
class NonUniquePasswordError extends Error {
|
|
18
|
+
constructor(error) {
|
|
19
|
+
super(error.body?.message || error.message);
|
|
20
|
+
this.name = 'NonUniquePasswordError';
|
|
21
|
+
}
|
|
22
|
+
}
|
|
11
23
|
async function patchSession({ session, }) {
|
|
12
|
-
|
|
13
|
-
body
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
try {
|
|
25
|
+
const { body } = await request({
|
|
26
|
+
body: session,
|
|
27
|
+
credentials: 'include',
|
|
28
|
+
headers: {
|
|
29
|
+
'Content-Type': 'application/json',
|
|
30
|
+
},
|
|
31
|
+
method: 'PATCH',
|
|
32
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
33
|
+
});
|
|
34
|
+
return body;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (isRequestError(error) && error.status === 400) {
|
|
38
|
+
if (error.body?.message ===
|
|
39
|
+
'New Password is required and must be different than Current Password') {
|
|
40
|
+
throw new NonUniquePasswordError(error);
|
|
41
|
+
}
|
|
42
|
+
if (error.body?.message === 'Current Password is invalid') {
|
|
43
|
+
throw new InvalidPasswordError(error);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
22
48
|
}
|
|
23
49
|
async function signIn({ password, userName, }) {
|
|
24
50
|
const params = new URLSearchParams();
|
|
@@ -70,21 +96,6 @@ async function signOut() {
|
|
|
70
96
|
throw error;
|
|
71
97
|
}
|
|
72
98
|
}
|
|
73
|
-
async function createGuestAccount({ defaultWarehouseId, }) {
|
|
74
|
-
const { body } = await request({
|
|
75
|
-
body: {
|
|
76
|
-
defaultFulfillmentMethod: 'Ship',
|
|
77
|
-
defaultWarehouseId,
|
|
78
|
-
isGuest: true,
|
|
79
|
-
},
|
|
80
|
-
headers: {
|
|
81
|
-
'Content-Type': 'application/json',
|
|
82
|
-
},
|
|
83
|
-
method: 'POST',
|
|
84
|
-
url: `${config.SHOP_API_URL}/api/v1/accounts`,
|
|
85
|
-
});
|
|
86
|
-
return body;
|
|
87
|
-
}
|
|
88
99
|
async function recoverPassword({ userName, }) {
|
|
89
100
|
const { body } = await request({
|
|
90
101
|
body: {
|
|
@@ -99,43 +110,5 @@ async function recoverPassword({ userName, }) {
|
|
|
99
110
|
});
|
|
100
111
|
return body;
|
|
101
112
|
}
|
|
102
|
-
class ExistingAccountError extends RequestError {
|
|
103
|
-
constructor(error) {
|
|
104
|
-
super(error);
|
|
105
|
-
this.name = 'ExistingAccountError';
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
async function createAccount({ companyName, countryCode, email, firstName, isPrivateAccount, isSubscribed, lastName, password, }) {
|
|
109
|
-
try {
|
|
110
|
-
const { body } = await request({
|
|
111
|
-
body: {
|
|
112
|
-
email,
|
|
113
|
-
firstName,
|
|
114
|
-
isSubscribed,
|
|
115
|
-
lastName,
|
|
116
|
-
password,
|
|
117
|
-
properties: {
|
|
118
|
-
PrivateAccount: isPrivateAccount,
|
|
119
|
-
companyName,
|
|
120
|
-
countryCode,
|
|
121
|
-
},
|
|
122
|
-
userName: '',
|
|
123
|
-
},
|
|
124
|
-
headers: {
|
|
125
|
-
'Content-Type': 'application/json',
|
|
126
|
-
},
|
|
127
|
-
method: 'POST',
|
|
128
|
-
url: `${config.SHOP_API_URL}/api/v1/accounts`,
|
|
129
|
-
});
|
|
130
|
-
return body;
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
if (isRequestError(error) &&
|
|
134
|
-
error.status === 400 &&
|
|
135
|
-
error.body?.message === 'Email Address already exists')
|
|
136
|
-
throw new ExistingAccountError(error);
|
|
137
|
-
throw error;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
113
|
|
|
141
|
-
export {
|
|
114
|
+
export { InvalidPasswordError, NonUniquePasswordError, createSession, fetchSession, patchSession, recoverPassword, signIn, signOut };
|