@opexa/portal-sdk 0.56.0 → 0.56.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.
package/dist/index.cjs CHANGED
@@ -1809,6 +1809,27 @@ var REGISTER_MEMBER_ACCOUNT_MUTATION__NEXT = gql`
1809
1809
  }
1810
1810
  }
1811
1811
  `;
1812
+ var REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_MUTATION__NEXT = gql`
1813
+ mutation RegisterMemberAccountByMobileNumber($input: _RegisterMemberAccountByMobileNumberInput!) {
1814
+ registerMemberAccountByMobileNumber: _registerMemberAccountByMobileNumber(input: $input) {
1815
+ ... on MobileNumberNotAvailableError {
1816
+ __typename
1817
+ }
1818
+ ... on EmailAddressNotAvailableError {
1819
+ __typename
1820
+ }
1821
+ ... on InvalidMobileNumberVerificationCodeError {
1822
+ __typename
1823
+ }
1824
+ ... on InvalidAgentCodeError {
1825
+ __typename
1826
+ }
1827
+ ... on InvalidPlatformError {
1828
+ __typename
1829
+ }
1830
+ }
1831
+ }
1832
+ `;
1812
1833
  var REGISTER_MAYA_MEMBER_ACCOUNT_MUTATION = gql`
1813
1834
  mutation RegisterMayaMemberAccount($input: RegisterMayaMemberAccountInput!) {
1814
1835
  registerMayaMemberAccount(input: $input) {
@@ -3203,6 +3224,11 @@ var SUBMIT_MEMBER_VERIFICATION_REQUEST_PERSONAL_DETAILS_MUTATION = gql`
3203
3224
  submitMemberVerificationRequestPersonalDetails(input: $input)
3204
3225
  }
3205
3226
  `;
3227
+ var MEMBER_VERIFICATION_REQUEST_AUTOMATIC_APPROVAL_ENABLED_QUERY = gql`
3228
+ query MemberVerificationRequestAutomaticApprovalEnabled {
3229
+ memberVerificationRequestAutomaticApprovalEnabled
3230
+ }
3231
+ `;
3206
3232
 
3207
3233
  // src/services/utils.ts
3208
3234
  function createOperationError(code) {
@@ -3680,6 +3706,34 @@ var AccountService = class {
3680
3706
  ok: true
3681
3707
  };
3682
3708
  }
3709
+ async registerMemberAccountByMobileNumber__next(variables) {
3710
+ const { reCAPTCHAResponse, domain, testPass, ...others } = variables;
3711
+ const res = await this.client.request(REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_MUTATION__NEXT, others, {
3712
+ headers: {
3713
+ ...reCAPTCHAResponse && {
3714
+ "Google-Recaptcha-Response": reCAPTCHAResponse
3715
+ },
3716
+ ...testPass && {
3717
+ "Test-Pass": "true"
3718
+ },
3719
+ ...domain && {
3720
+ Domain: domain
3721
+ }
3722
+ }
3723
+ });
3724
+ if (!res.ok) return res;
3725
+ if (res.data.registerMemberAccountByMobileNumber) {
3726
+ return {
3727
+ ok: false,
3728
+ error: createOperationError(
3729
+ res.data.registerMemberAccountByMobileNumber.__typename
3730
+ )
3731
+ };
3732
+ }
3733
+ return {
3734
+ ok: true
3735
+ };
3736
+ }
3683
3737
  async googleClientId() {
3684
3738
  const res = await this.client.request(
3685
3739
  GOOGLE_CLIEND_ID_QUERY
@@ -3719,7 +3773,9 @@ var AccountService = class {
3719
3773
  return { ok: true };
3720
3774
  }
3721
3775
  async memberVerificationRequest() {
3722
- const res = await this.client.request(MEMBER_VERIFICATION_REQUEST_QUERY);
3776
+ const res = await this.client.request(
3777
+ MEMBER_VERIFICATION_REQUEST_QUERY
3778
+ );
3723
3779
  if (!res.ok) return res;
3724
3780
  return {
3725
3781
  ok: true,
@@ -3750,6 +3806,16 @@ var AccountService = class {
3750
3806
  data: res.data.submitMemberVerificationRequestPersonalDetails
3751
3807
  };
3752
3808
  }
3809
+ async memberVerificationRequestAutomaticApprovalEnabled() {
3810
+ const res = await this.client.request(
3811
+ MEMBER_VERIFICATION_REQUEST_AUTOMATIC_APPROVAL_ENABLED_QUERY
3812
+ );
3813
+ if (!res.ok) return res;
3814
+ return {
3815
+ ok: true,
3816
+ data: res.data.memberVerificationRequestAutomaticApprovalEnabled
3817
+ };
3818
+ }
3753
3819
  };
3754
3820
 
3755
3821
  // src/utils/status-code-to-operation-error.ts
@@ -4021,11 +4087,11 @@ var AuthService = class {
4021
4087
  };
4022
4088
  }
4023
4089
  }
4024
- async createSingleUseToken(accessToken) {
4090
+ async createSingleUseToken(accessToken, ttl) {
4025
4091
  const headers = new Headers(this.headers);
4026
4092
  headers.append("Authorization", `Bearer ${accessToken}`);
4027
4093
  try {
4028
- const res = await fetch(`${this.url}/token?ttl=30d`, {
4094
+ const res = await fetch(`${this.url}/token?ttl=${ttl ?? "30d"}`, {
4029
4095
  method: "POST",
4030
4096
  headers
4031
4097
  });
@@ -9042,6 +9108,22 @@ var Sdk = class {
9042
9108
  });
9043
9109
  return res2.ok ? { ok: true, data: { id } } : res2;
9044
9110
  }
9111
+ if (input.type === "MOBILE_NUMBER[NEXT]") {
9112
+ const res2 = await this.accountService.registerMemberAccountByMobileNumber__next({
9113
+ input: {
9114
+ id,
9115
+ mobileNumber: addAreaCode(input.mobileNumber, await this.locale),
9116
+ emailAddress: input.emailAddress,
9117
+ branchCode: input.branchCode
9118
+ },
9119
+ testPass: input.testPass,
9120
+ reCAPTCHAResponse: input.reCAPTCHAResponse,
9121
+ ...this.webDomain && {
9122
+ domain: this.webDomain
9123
+ }
9124
+ });
9125
+ return res2.ok ? { ok: true, data: { id } } : res2;
9126
+ }
9045
9127
  const res = await this.accountService.registerMemberAccountByName({
9046
9128
  input: {
9047
9129
  id,
@@ -10613,6 +10695,9 @@ var Sdk = class {
10613
10695
  { input }
10614
10696
  );
10615
10697
  }
10698
+ async memberVerificationRequestAutomaticApprovalEnabled() {
10699
+ return await this.accountService.memberVerificationRequestAutomaticApprovalEnabled();
10700
+ }
10616
10701
  /*
10617
10702
  *=============================================
10618
10703
  * UTILS