@opexa/portal-sdk 0.5.0 → 0.7.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.
package/dist/index.cjs CHANGED
@@ -358,6 +358,9 @@ var CREATE_GCASH_WITHDRAWAL_MUTATION = gql`
358
358
  ... on WalletDoesNotExistError {
359
359
  __typename
360
360
  }
361
+ ... on TransactionPasswordNotSetError {
362
+ __typename
363
+ }
361
364
  }
362
365
  }
363
366
  `;
@@ -406,6 +409,9 @@ var CREATE_MAYA_APP_WITHDRAWAL_MUTATION = gql`
406
409
  ... on WalletDoesNotExistError {
407
410
  __typename
408
411
  }
412
+ ... on TransactionPasswordNotSetError {
413
+ __typename
414
+ }
409
415
  }
410
416
  }
411
417
  `;
@@ -439,6 +445,9 @@ var CREATE_AIO_INSTAPAY_WITHDRAWAL_MUTATION = gql`
439
445
  ... on WalletDoesNotExistError {
440
446
  __typename
441
447
  }
448
+ ... on TransactionPasswordNotSetError {
449
+ __typename
450
+ }
442
451
  }
443
452
  }
444
453
  `;
@@ -727,6 +736,9 @@ var CREATE_MANUAL_UPI_DEPOSIT_MUTATION = gql`
727
736
  ... on WalletDoesNotExistError {
728
737
  __typename
729
738
  }
739
+ ... on UPIReferenceNotAvailableError {
740
+ __typename
741
+ }
730
742
  }
731
743
  }
732
744
  `;
@@ -1388,6 +1400,27 @@ var SEND_VERIFICATION_CODE_MUTATION = gql`
1388
1400
  }
1389
1401
  }
1390
1402
  `;
1403
+ var REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_MUTATION = gql`
1404
+ mutation RegisterMemberAccountByMobileNumber(
1405
+ $input: RegisterMemberAccountByMobileNumberInput!
1406
+ $mobileNumberVerificationCode: String!
1407
+ ) {
1408
+ registerMemberAccountByMobileNumber(
1409
+ input: $input
1410
+ mobileNumberVerificationCode: $mobileNumberVerificationCode
1411
+ ) {
1412
+ ... on MobileNumberNotAvailableError {
1413
+ __typename
1414
+ }
1415
+ ... on InvalidSMSVerificationCodeError {
1416
+ __typename
1417
+ }
1418
+ ... on InvalidPlatformError {
1419
+ __typename
1420
+ }
1421
+ }
1422
+ }
1423
+ `;
1391
1424
  var PLATFORM_QUERY = gql`
1392
1425
  fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {
1393
1426
  minimumAmount
@@ -1994,7 +2027,7 @@ var UNMARK_GAME_AS_FAVORITE = gql`
1994
2027
  }
1995
2028
  `;
1996
2029
  var FAVORITE_GAMES_QUERY = gql`
1997
- query favoriteGames {
2030
+ query FavoriteGames {
1998
2031
  favoriteGames {
1999
2032
  id
2000
2033
  }
@@ -2058,7 +2091,9 @@ function createOperationError(code) {
2058
2091
  RateLimitExceededError: "Maximum number of requests reached",
2059
2092
  RewardAlreadyClaimedError: "Reward is already claimed",
2060
2093
  ReCAPTCHAVerificationFailedError: "Invalid reCAPTCHA",
2061
- AccountSuspendedError: "Account is suspended"
2094
+ AccountSuspendedError: "Account is suspended",
2095
+ TransactionPasswordNotSetError: "Transaction password is not set",
2096
+ UPIReferenceNotAvailableError: "UPI reference is no longer available"
2062
2097
  };
2063
2098
  return {
2064
2099
  name: code,
@@ -2326,6 +2361,19 @@ var AccountService = class {
2326
2361
  const res = await this.client.request(POINTS_CLUB_SETTINGS_QUERY);
2327
2362
  return res.ok ? { ok: true, data: res.data.pointsClubSettings } : res;
2328
2363
  }
2364
+ async registerMemberAccountByMobileNumber(variables) {
2365
+ const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_MUTATION, variables);
2366
+ if (!res.ok) return res;
2367
+ if (res.data.registerMemberAccountByMobileNumber) {
2368
+ return {
2369
+ ok: false,
2370
+ error: createOperationError(res.data.registerMemberAccountByMobileNumber.__typename)
2371
+ };
2372
+ }
2373
+ return {
2374
+ ok: true
2375
+ };
2376
+ }
2329
2377
  };
2330
2378
 
2331
2379
  // src/utils/status-code-to-operation-error.ts
@@ -2381,6 +2429,9 @@ var AuthService = class {
2381
2429
  if (input.type === "CABINET") {
2382
2430
  headers.set("Authorization", `OPEXA-CABINET-TOKEN ${input.token}`);
2383
2431
  }
2432
+ if (input.type === "BIOMETRICS") {
2433
+ headers.set("Authorization", `Biometrics ${input.token}`);
2434
+ }
2384
2435
  if (input.reCAPTCHAResponse) {
2385
2436
  headers.set("google-recaptcha-response", input.reCAPTCHAResponse);
2386
2437
  }
@@ -5365,6 +5416,9 @@ var Sdk = class {
5365
5416
  });
5366
5417
  }
5367
5418
  async signIn(input) {
5419
+ if (input.type === "TOKEN") {
5420
+ console.warn("'TOKEN (signIn)' is deprecated. Please use 'SOCIALS' instead.");
5421
+ }
5368
5422
  switch (input.type) {
5369
5423
  case "NAME_AND_PASSWORD": {
5370
5424
  const res = await this.sessionManager.create({
@@ -5412,6 +5466,13 @@ var Sdk = class {
5412
5466
  });
5413
5467
  return res.ok ? { ok: true } : res;
5414
5468
  }
5469
+ case "BIOMETRICS": {
5470
+ const res = await this.sessionManager.create({
5471
+ type: "BIOMETRICS",
5472
+ token: input.token
5473
+ });
5474
+ return res.ok ? { ok: true } : res;
5475
+ }
5415
5476
  default: {
5416
5477
  const res = await this.sessionManager.create(input);
5417
5478
  return res.ok ? { ok: true } : res;
@@ -5494,6 +5555,7 @@ var Sdk = class {
5494
5555
  /**/
5495
5556
  /** @deprecated */
5496
5557
  async platform() {
5558
+ console.warn("'platform' is deprecated. Please use 'platform__next' instead.");
5497
5559
  const res = await this.accountService.platform();
5498
5560
  if (!res.ok) return res;
5499
5561
  return {
@@ -5534,6 +5596,7 @@ var Sdk = class {
5534
5596
  * @deprecated use `createAccount__next`
5535
5597
  */
5536
5598
  async createAccount(input) {
5599
+ console.warn("'createAccount' is deprecated. Please use 'createAccount__next' instead.");
5537
5600
  const id = input.id ?? objectId.ObjectId.generate(ObjectType.Account).toString();
5538
5601
  const res = await this.accountService.registerMemberAccount({
5539
5602
  input: {
@@ -5687,6 +5750,9 @@ var Sdk = class {
5687
5750
  * @deprecated use `sendVerificationCode__next`
5688
5751
  */
5689
5752
  async sendVerificationCode(mobileNumber) {
5753
+ console.warn(
5754
+ "'sendVerificationCode' is deprecated. Please use 'sendVerificationCode__next' instead."
5755
+ );
5690
5756
  return await this.accountService.sendVerificationCode({
5691
5757
  input: {
5692
5758
  channel: "SMS",
@@ -5714,6 +5780,17 @@ var Sdk = class {
5714
5780
  data: res.data ? this.transformer.transform.wallet(res.data) : null
5715
5781
  };
5716
5782
  }
5783
+ async registerMemberAccountByMobileNumber(input) {
5784
+ return await this.accountService.registerMemberAccountByMobileNumber({
5785
+ input: {
5786
+ id: input.id,
5787
+ mobileNumber: addAreaCode(input.mobileNumber, await this.locale),
5788
+ password: await sha256(input.password),
5789
+ realName: input.realName
5790
+ },
5791
+ mobileNumberVerificationCode: input.mobileNumberVerificationCode
5792
+ });
5793
+ }
5717
5794
  /**/
5718
5795
  /*+----------------------------------------+*/
5719
5796
  /*+ ANNOUNCEMENT +*/
@@ -6140,6 +6217,7 @@ var Sdk = class {
6140
6217
  }
6141
6218
  /** @deprecated */
6142
6219
  async bonus() {
6220
+ console.warn("'bonus' is deprecated. Please use 'bonuses' instead.");
6143
6221
  const res = await this.walletService.bonus();
6144
6222
  if (!res.ok) return res;
6145
6223
  return {
@@ -6147,6 +6225,14 @@ var Sdk = class {
6147
6225
  data: res.data ? this.transformer.transform.bonus(res.data) : null
6148
6226
  };
6149
6227
  }
6228
+ async bonuses() {
6229
+ const res = await this.walletService.bonuses();
6230
+ if (!res.ok) return res;
6231
+ return {
6232
+ ok: true,
6233
+ data: res.data.map(this.transformer.transform.bonus)
6234
+ };
6235
+ }
6150
6236
  async cashbackBonuses() {
6151
6237
  const res = await this.walletService.cashbackBonuses();
6152
6238
  if (!res.ok) return res;
@@ -6182,7 +6268,9 @@ var Sdk = class {
6182
6268
  data: res.data ? this.transformer.transform.game(res.data) : null
6183
6269
  };
6184
6270
  }
6271
+ /** @deprecated */
6185
6272
  async games(input) {
6273
+ console.warn("'games' is deprecated. Please use 'games__next' instead.");
6186
6274
  const res = await this.cmsPortalService.games(input);
6187
6275
  if (!res.ok) return res;
6188
6276
  return {
@@ -6528,14 +6616,6 @@ var Sdk = class {
6528
6616
  async claimReward(id) {
6529
6617
  return await this.triggerService.claimReward({ id });
6530
6618
  }
6531
- async bonuses() {
6532
- const res = await this.walletService.bonuses();
6533
- if (!res.ok) return res;
6534
- return {
6535
- ok: true,
6536
- data: res.data.map(this.transformer.transform.bonus)
6537
- };
6538
- }
6539
6619
  /**/
6540
6620
  /*+----------------------------------------+*/
6541
6621
  /*+ ONBOARDING +*/