@longvansoftware/storefront-js-client 3.1.1 → 3.1.2
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.
|
@@ -5,6 +5,7 @@ export declare const VERIFY_CODE_MUTATION: import("graphql").DocumentNode;
|
|
|
5
5
|
export declare const RESET_PASSWORD_MUTATION: import("graphql").DocumentNode;
|
|
6
6
|
export declare const UPDATE_INFO_MUTATION: import("graphql").DocumentNode;
|
|
7
7
|
export declare const UPDATE_PASSWORD_MUTATION = "\n mutation UpdatePassword($orgId: String!, $accessToken: String!, $currentPassword: String!, $newPassword: String!) {\n updatePassword(orgId: $orgId, accessToken: $accessToken, currentPassword: $currentPassword, newPassword: $newPassword)\n }\n";
|
|
8
|
+
export declare const CREATE_PASSWORD_MUTATION: import("graphql").DocumentNode;
|
|
8
9
|
export declare const UPDATE_PROFILE_MUTATION: import("graphql").DocumentNode;
|
|
9
10
|
export declare const LINKING_USER_LOGIN_AND_USER_DETAIL_MUTATION: import("graphql").DocumentNode;
|
|
10
11
|
export declare const CREATE_USER_DETAIL_MUTATION: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_ACCESS_TOKEN_BY_OTP_MUTATION = 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;
|
|
3
|
+
exports.GET_ACCESS_TOKEN_BY_OTP_MUTATION = 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.CREATE_PASSWORD_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!) {
|
|
@@ -97,6 +97,21 @@ exports.UPDATE_PASSWORD_MUTATION = `
|
|
|
97
97
|
updatePassword(orgId: $orgId, accessToken: $accessToken, currentPassword: $currentPassword, newPassword: $newPassword)
|
|
98
98
|
}
|
|
99
99
|
`;
|
|
100
|
+
exports.CREATE_PASSWORD_MUTATION = (0, graphql_tag_1.gql) `
|
|
101
|
+
mutation CreatePassword($orgId: String!, $accessToken: String!, $password: String!) {
|
|
102
|
+
updateInfo(orgId: $orgId, accessToken: $accessToken, password: $password) {
|
|
103
|
+
partyId
|
|
104
|
+
fullName
|
|
105
|
+
email
|
|
106
|
+
phone
|
|
107
|
+
address
|
|
108
|
+
identityNumber
|
|
109
|
+
gender
|
|
110
|
+
birthDate
|
|
111
|
+
avatarUrl
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
100
115
|
exports.UPDATE_PROFILE_MUTATION = (0, graphql_tag_1.gql) `
|
|
101
116
|
mutation UpdateProfile(
|
|
102
117
|
$userLoginId: String!
|
|
@@ -114,4 +114,13 @@ export declare class AuthService extends Service {
|
|
|
114
114
|
* @throws Will throw an error if the GraphQL mutation fails.
|
|
115
115
|
*/
|
|
116
116
|
getAccessTokenByOTP(otpCode: string, phone: string, type?: 'SMS' | 'ZALO'): Promise<GetAccessTokenByOTPResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* Creates/sets a password for a user using the updateInfo mutation.
|
|
119
|
+
* Uses the SDK's internal orgId and token (accessToken).
|
|
120
|
+
*
|
|
121
|
+
* @param password - The new password to set.
|
|
122
|
+
* @returns A promise that resolves to the updated user information.
|
|
123
|
+
* @throws Will throw an error if the GraphQL mutation fails.
|
|
124
|
+
*/
|
|
125
|
+
createPassword(password: string): Promise<any>;
|
|
117
126
|
}
|
|
@@ -473,5 +473,30 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
473
473
|
}
|
|
474
474
|
});
|
|
475
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Creates/sets a password for a user using the updateInfo mutation.
|
|
478
|
+
* Uses the SDK's internal orgId and token (accessToken).
|
|
479
|
+
*
|
|
480
|
+
* @param password - The new password to set.
|
|
481
|
+
* @returns A promise that resolves to the updated user information.
|
|
482
|
+
* @throws Will throw an error if the GraphQL mutation fails.
|
|
483
|
+
*/
|
|
484
|
+
createPassword(password) {
|
|
485
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
486
|
+
const variables = {
|
|
487
|
+
orgId: this.orgId,
|
|
488
|
+
accessToken: this.token,
|
|
489
|
+
password,
|
|
490
|
+
};
|
|
491
|
+
try {
|
|
492
|
+
const response = yield this.graphqlMutation(mutations_1.CREATE_PASSWORD_MUTATION, variables);
|
|
493
|
+
return response.updateInfo;
|
|
494
|
+
}
|
|
495
|
+
catch (error) {
|
|
496
|
+
console.log(`Error in createPassword: ${error}`);
|
|
497
|
+
throw error;
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
}
|
|
476
501
|
}
|
|
477
502
|
exports.AuthService = AuthService;
|