@longvansoftware/service-js-client 1.6.3 → 1.6.5

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.
@@ -11,3 +11,5 @@ export declare const CHECK_RESET_KEY: import("graphql").DocumentNode;
11
11
  export declare const UPDATE_PROFILE: import("graphql").DocumentNode;
12
12
  export declare const CREATE_USER_DETAIL: import("graphql").DocumentNode;
13
13
  export declare const LINKING_USER_LOGIN_AND_USER_DETAIL: import("graphql").DocumentNode;
14
+ export declare const SEND_OTP: import("graphql").DocumentNode;
15
+ export declare const VALIDATE_OTP: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LINKING_USER_LOGIN_AND_USER_DETAIL = exports.CREATE_USER_DETAIL = exports.UPDATE_PROFILE = exports.CHECK_RESET_KEY = exports.CREATE_RESET_KEY = exports.LOGIN_v2 = 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.VALIDATE_OTP = exports.SEND_OTP = exports.LINKING_USER_LOGIN_AND_USER_DETAIL = exports.CREATE_USER_DETAIL = exports.UPDATE_PROFILE = exports.CHECK_RESET_KEY = exports.CREATE_RESET_KEY = exports.LOGIN_v2 = 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,3 +189,18 @@ exports.LINKING_USER_LOGIN_AND_USER_DETAIL = (0, graphql_tag_1.gql) `
189
189
  linkingUserLoginAndUserDetail(userLoginId: $userLoginId, partyId: $partyId)
190
190
  }
191
191
  `;
192
+ exports.SEND_OTP = (0, graphql_tag_1.gql) `
193
+ mutation SendOTP($orgId: String!, $phone: String!) {
194
+ sendOTP(orgId: $orgId, phone: $phone) {
195
+ id
196
+ code
197
+ username
198
+ timeExpired
199
+ }
200
+ }
201
+ `;
202
+ exports.VALIDATE_OTP = (0, graphql_tag_1.gql) `
203
+ mutation ValidateOTP($otpCode: String!, $phone: String!) {
204
+ validateOTP(otpCode: $otpCode, phone: $phone)
205
+ }
206
+ `;
@@ -36,4 +36,6 @@ export declare class AuthService extends Service {
36
36
  getUserLoginByUserLoginId(userLoginId: string): Promise<any>;
37
37
  checkUsernameExisted(username: string): Promise<any>;
38
38
  getUserLoginsByPartyId(partyId: string): Promise<any>;
39
+ sendOTP(phone: string): Promise<any>;
40
+ validateOTP(otpCode: string, phone: string): Promise<any>;
39
41
  }
@@ -232,10 +232,44 @@ class AuthService extends serviceSDK_1.Service {
232
232
  };
233
233
  try {
234
234
  const response = yield this.graphqlQuery(query, variables);
235
- return response.CHECK_USERNAME_EXISTED;
235
+ return response.getUserLoginsByPartyId;
236
236
  }
237
237
  catch (error) {
238
- console.log(`Error in CHECK_USERNAME_EXISTED: ${error}`);
238
+ console.log(`Error in getUserLoginsByPartyId: ${error}`);
239
+ throw error;
240
+ }
241
+ });
242
+ }
243
+ sendOTP(phone) {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ const query = mutations_1.SEND_OTP;
246
+ const variables = {
247
+ orgId: this.orgId,
248
+ phone,
249
+ };
250
+ try {
251
+ const response = yield this.graphqlMutation(query, variables);
252
+ return response.sendOTP;
253
+ }
254
+ catch (error) {
255
+ console.log(`Error in sendOTP: ${error}`);
256
+ throw error;
257
+ }
258
+ });
259
+ }
260
+ validateOTP(otpCode, phone) {
261
+ return __awaiter(this, void 0, void 0, function* () {
262
+ const query = mutations_1.VALIDATE_OTP;
263
+ const variables = {
264
+ otpCode,
265
+ phone,
266
+ };
267
+ try {
268
+ const response = yield this.graphqlMutation(query, variables);
269
+ return response.validateOTP;
270
+ }
271
+ catch (error) {
272
+ console.log(`Error in validateOTP: ${error}`);
239
273
  throw error;
240
274
  }
241
275
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [