@sonic-equipment/ui 230.0.0 → 231.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.
@@ -94,7 +94,7 @@ function SignInPage({ returnUrl } = {}) {
94
94
  userName: userName || '',
95
95
  }, { onSuccess: onSignInSuccess });
96
96
  };
97
- return (jsxs(Fragment, { children: [jsx(SignInPageLayout, { fullHeight: true, "data-test-selector": "signInPage", children: jsx(SignInForm, { allowGuestSignIn: allowGuestSignIn, createAccountPath: createAccountPath, errorType: signInErrorType, initialEmail: session?.isGuest ? '' : session?.email, initialRememberMe: session?.rememberMe, isDisabled: !session || isSuccess, isLoading: isLoading, isPendingGuestSignIn: isPendingCreateGuest, isPendingUserSignIn: isPendingSignIn, onRecoverPasswordDialogOpen: () => setRecoverPasswordDialogOpen(true), onSubmit: onSignIn }) }), jsx(RecoverPasswordDialog, { isOpen: isRecoverPasswordDialogOpen, onOpenChange: isOpen => setRecoverPasswordDialogOpen(isOpen) }), jsx(ChangePasswordDialog, { allowClose: false, error: errorChangePassword, informationalText: t('You are required to change your password and then sign in again, using your new credentials.'), isOpen: isChangePasswordDialogOpen, isUpdating: isSessionUpdating, onClose: () => setChangePasswordDialogOpen(false), onPasswordChanged: onChangePassword, userName: userName })] }));
97
+ return (jsxs(Fragment, { children: [jsx(SignInPageLayout, { fullHeight: true, "data-test-selector": "signInPage", children: jsx(SignInForm, { allowGuestSignIn: allowGuestSignIn, createAccountPath: createAccountPath, errorType: signInErrorType, initialEmail: session?.isGuest ? '' : session?.email, initialRememberMe: session?.rememberMe, isDisabled: !session || isSuccess, isLoading: isLoading, isPendingGuestSignIn: isPendingCreateGuest, isPendingUserSignIn: isPendingSignIn, onRecoverPasswordDialogOpen: () => setRecoverPasswordDialogOpen(true), onSubmit: onSignIn }) }), jsx(RecoverPasswordDialog, { isOpen: isRecoverPasswordDialogOpen, onOpenChange: isOpen => setRecoverPasswordDialogOpen(isOpen) }), jsx(ChangePasswordDialog, { allowClose: true, error: errorChangePassword, informationalText: t('You are required to change your password and then sign in again, using your new credentials.'), isOpen: isChangePasswordDialogOpen, isUpdating: isSessionUpdating, onClose: () => setChangePasswordDialogOpen(false), onPasswordChanged: onChangePassword, userName: userName })] }));
98
98
  }
99
99
 
100
100
  export { SignInPage };
@@ -1,4 +1,4 @@
1
- import { BadRequestError, RequestError } from '../../../fetch/request';
1
+ import { BadRequestError, RequestError, RequestReturnType } from '../../../fetch/request';
2
2
  import { APIArguments } from '../../shared/types';
3
3
  import { PatchSessionModel, SessionModel } from '../model/storefront.model';
4
4
  export declare function fetchSession(args?: APIArguments): Promise<SessionModel>;
@@ -47,7 +47,7 @@ export interface CreateSessionRequestBody {
47
47
  export declare function createSession({ accessToken, isGuest, keepMeSignedIn, password, rememberMe, returnUrl, userName, }: {
48
48
  accessToken: string;
49
49
  } & CreateSessionRequestBody): Promise<SessionModel>;
50
- export declare function signOut(): Promise<void>;
50
+ export declare function signOut(args?: APIArguments): Promise<RequestReturnType<unknown>>;
51
51
  export declare function recoverPassword({ userName, }: {
52
52
  userName: string;
53
53
  }): Promise<SessionModel>;
@@ -144,16 +144,17 @@ async function createSession({ accessToken, isGuest, keepMeSignedIn, password, r
144
144
  throw error;
145
145
  }
146
146
  }
147
- async function signOut() {
147
+ async function signOut(args) {
148
148
  try {
149
- await request({
149
+ return await request({
150
+ headers: args?.headers,
150
151
  method: 'DELETE',
151
152
  url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
152
153
  });
153
154
  }
154
155
  catch (error) {
155
156
  if (error instanceof UnauthorizedRequestError)
156
- return;
157
+ return error.response;
157
158
  throw error;
158
159
  }
159
160
  }
@@ -22,6 +22,7 @@ export declare class RequestError extends Error {
22
22
  status: number;
23
23
  statusText?: string;
24
24
  body?: any;
25
+ response?: Response;
25
26
  context?: string;
26
27
  options?: RequestOptions;
27
28
  constructor(responseOrError: Response | any, options?: RequestErrorOptions, status?: number, statusText?: string);
@@ -32,7 +33,8 @@ export declare class BadRequestError extends RequestError {
32
33
  constructor(responseOrError: Response | unknown, options?: RequestErrorOptions);
33
34
  }
34
35
  export declare class UnauthorizedRequestError extends RequestError {
35
- constructor(responseOrError: Response | unknown, options?: RequestErrorOptions);
36
+ response: Response;
37
+ constructor(responseOrError: Response, options?: RequestErrorOptions);
36
38
  }
37
39
  export declare class ForbiddenRequestError extends RequestError {
38
40
  constructor(responseOrError: Response | unknown, options?: RequestErrorOptions);
@@ -37,6 +37,12 @@ class RequestError extends Error {
37
37
  writable: true,
38
38
  value: void 0
39
39
  });
40
+ Object.defineProperty(this, "response", {
41
+ enumerable: true,
42
+ configurable: true,
43
+ writable: true,
44
+ value: void 0
45
+ });
40
46
  Object.defineProperty(this, "context", {
41
47
  enumerable: true,
42
48
  configurable: true,
@@ -52,6 +58,7 @@ class RequestError extends Error {
52
58
  if (isResponse(responseOrError)) {
53
59
  this.status = responseOrError.status || status || -1;
54
60
  this.statusText = responseOrError.statusText || statusText;
61
+ this.response = responseOrError;
55
62
  }
56
63
  else {
57
64
  this.status = -1;
@@ -92,7 +99,14 @@ class BadRequestError extends RequestError {
92
99
  class UnauthorizedRequestError extends RequestError {
93
100
  constructor(responseOrError, options) {
94
101
  super(responseOrError, options, 401, 'unauthorized');
102
+ Object.defineProperty(this, "response", {
103
+ enumerable: true,
104
+ configurable: true,
105
+ writable: true,
106
+ value: void 0
107
+ });
95
108
  this.name = 'UnauthorizedRequestError';
109
+ this.response = responseOrError;
96
110
  }
97
111
  }
98
112
  class ForbiddenRequestError extends RequestError {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "230.0.0",
3
+ "version": "231.0.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {