@longvansoftware/storefront-js-client 2.9.9 → 3.0.1
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.
|
@@ -92,7 +92,7 @@ export declare class AuthService extends Service {
|
|
|
92
92
|
* @returns A promise that resolves to the result of the sendOTP mutation.
|
|
93
93
|
* @throws Will throw an error if the GraphQL mutation fails.
|
|
94
94
|
*/
|
|
95
|
-
sendOTP(phone: string, type?:
|
|
95
|
+
sendOTP(phone: string, type?: "SMS" | "ZALO"): Promise<SendOTPResponse>;
|
|
96
96
|
/**
|
|
97
97
|
* Validates OTP code for the specified phone number.
|
|
98
98
|
*
|
|
@@ -102,7 +102,7 @@ export declare class AuthService extends Service {
|
|
|
102
102
|
* @returns A promise that resolves to the result of the validateOTP mutation.
|
|
103
103
|
* @throws Will throw an error if the GraphQL mutation fails.
|
|
104
104
|
*/
|
|
105
|
-
validateOTP(otpCode: string, phone: string, type?:
|
|
105
|
+
validateOTP(otpCode: string, phone: string, type?: "SMS" | "ZALO"): Promise<ValidateOTPResponse>;
|
|
106
106
|
/**
|
|
107
107
|
* Gets access token by validating OTP code for the specified phone number.
|
|
108
108
|
* This function validates the OTP and returns an access token if successful.
|
|
@@ -113,5 +113,5 @@ export declare class AuthService extends Service {
|
|
|
113
113
|
* @returns A promise that resolves to an object containing the access token.
|
|
114
114
|
* @throws Will throw an error if the GraphQL mutation fails.
|
|
115
115
|
*/
|
|
116
|
-
getAccessTokenByOTP(otpCode: string, phone: string, type?:
|
|
116
|
+
getAccessTokenByOTP(otpCode: string, phone: string, type?: "SMS" | "ZALO"): Promise<GetAccessTokenByOTPResponse>;
|
|
117
117
|
}
|
|
@@ -408,7 +408,7 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
408
408
|
const variables = {
|
|
409
409
|
orgId: this.orgId,
|
|
410
410
|
phone,
|
|
411
|
-
channelType: type ||
|
|
411
|
+
channelType: type || "SMS", // Default to SMS if not specified
|
|
412
412
|
};
|
|
413
413
|
try {
|
|
414
414
|
const response = yield this.graphqlMutation(mutations_1.SEND_OTP_MUTATION, variables);
|
|
@@ -434,7 +434,7 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
434
434
|
const variables = {
|
|
435
435
|
otpCode,
|
|
436
436
|
phone,
|
|
437
|
-
channelType: type ||
|
|
437
|
+
channelType: type || "SMS",
|
|
438
438
|
};
|
|
439
439
|
try {
|
|
440
440
|
const response = yield this.graphqlMutation(mutations_1.VALIDATE_OTP_MUTATION, variables);
|
|
@@ -461,11 +461,11 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
461
461
|
const variables = {
|
|
462
462
|
otpCode,
|
|
463
463
|
phone,
|
|
464
|
-
channelType: type ||
|
|
464
|
+
channelType: type || "SMS",
|
|
465
465
|
};
|
|
466
466
|
try {
|
|
467
467
|
const response = yield this.graphqlQuery(queries_1.GET_ACCESS_TOKEN_BY_OTP, variables);
|
|
468
|
-
return
|
|
468
|
+
return response;
|
|
469
469
|
}
|
|
470
470
|
catch (error) {
|
|
471
471
|
console.log(`Error in getAccessTokenByOTP: ${error}`);
|