@longvansoftware/storefront-js-client 2.9.8 → 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.
- package/dist/src/graphql/auth/mutations.d.ts +0 -1
- package/dist/src/graphql/auth/mutations.js +1 -6
- package/dist/src/graphql/auth/queries.d.ts +1 -0
- package/dist/src/graphql/auth/queries.js +6 -1
- package/dist/src/lib/auth/index.d.ts +3 -3
- package/dist/src/lib/auth/index.js +5 -5
- package/package.json +1 -1
|
@@ -13,4 +13,3 @@ export declare const ADD_ROLE_USER_MUTATION: import("graphql").DocumentNode;
|
|
|
13
13
|
export declare const CREATE_USER_LOGIN_MUTATION: import("graphql").DocumentNode;
|
|
14
14
|
export declare const SEND_OTP_MUTATION: import("graphql").DocumentNode;
|
|
15
15
|
export declare const VALIDATE_OTP_MUTATION: import("graphql").DocumentNode;
|
|
16
|
-
export declare const GET_ACCESS_TOKEN_BY_OTP_MUTATION: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VALIDATE_OTP_MUTATION = exports.SEND_OTP_MUTATION = exports.CREATE_USER_LOGIN_MUTATION = exports.ADD_ROLE_USER_MUTATION = exports.CREATE_ORG_MUTATION = exports.CREATE_USER_DETAIL_MUTATION = exports.LINKING_USER_LOGIN_AND_USER_DETAIL_MUTATION = exports.UPDATE_PROFILE_MUTATION = exports.UPDATE_PASSWORD_MUTATION = exports.UPDATE_INFO_MUTATION = exports.RESET_PASSWORD_MUTATION = exports.VERIFY_CODE_MUTATION = exports.SEND_SMS_VERIFY_CODE_MUTATION = exports.REGISTER_MUTATION = exports.LOGIN_MUTATION = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.LOGIN_MUTATION = (0, graphql_tag_1.gql) `
|
|
6
6
|
mutation Login($loginRequest: LoginRequest!) {
|
|
@@ -189,8 +189,3 @@ exports.VALIDATE_OTP_MUTATION = (0, graphql_tag_1.gql) `
|
|
|
189
189
|
validateOTP(otpCode: $otpCode, phone: $phone, channelType: $channelType)
|
|
190
190
|
}
|
|
191
191
|
`;
|
|
192
|
-
exports.GET_ACCESS_TOKEN_BY_OTP_MUTATION = (0, graphql_tag_1.gql) `
|
|
193
|
-
mutation GetAccessTokenByOTP($otpCode: String!, $phone: String!, $channelType: String) {
|
|
194
|
-
getAccessTokenByOTP(otpCode: $otpCode, phone: $phone, channelType: $channelType)
|
|
195
|
-
}
|
|
196
|
-
`;
|
|
@@ -6,3 +6,4 @@ export declare const LOGIN_GOOGLE: import("graphql").DocumentNode;
|
|
|
6
6
|
export declare const LOGIN_FACEBOOK: import("graphql").DocumentNode;
|
|
7
7
|
export declare const LOGIN_ZALO: import("graphql").DocumentNode;
|
|
8
8
|
export declare const CHECK_USER_LOGIN: import("graphql").DocumentNode;
|
|
9
|
+
export declare const GET_ACCESS_TOKEN_BY_OTP: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CHECK_USER_LOGIN = exports.LOGIN_ZALO = exports.LOGIN_FACEBOOK = exports.LOGIN_GOOGLE = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
3
|
+
exports.GET_ACCESS_TOKEN_BY_OTP = exports.CHECK_USER_LOGIN = exports.LOGIN_ZALO = exports.LOGIN_FACEBOOK = exports.LOGIN_GOOGLE = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetUserDetail($orgId: String!, $accessToken: String!) {
|
|
@@ -78,3 +78,8 @@ exports.CHECK_USER_LOGIN = (0, graphql_tag_1.gql) `
|
|
|
78
78
|
checkUserLogin(userLoginId: $userLoginId)
|
|
79
79
|
}
|
|
80
80
|
`;
|
|
81
|
+
exports.GET_ACCESS_TOKEN_BY_OTP = (0, graphql_tag_1.gql) `
|
|
82
|
+
query GetAccessTokenByOTP($otpCode: String!, $phone: String!, $channelType: String) {
|
|
83
|
+
getAccessTokenByOTP(otpCode: $otpCode, phone: $phone, channelType: $channelType)
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
@@ -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
|
-
const response = yield this.
|
|
468
|
-
return
|
|
467
|
+
const response = yield this.graphqlQuery(queries_1.GET_ACCESS_TOKEN_BY_OTP, variables);
|
|
468
|
+
return response;
|
|
469
469
|
}
|
|
470
470
|
catch (error) {
|
|
471
471
|
console.log(`Error in getAccessTokenByOTP: ${error}`);
|