@opexa/portal-sdk 0.55.1 → 0.56.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
@@ -3146,6 +3146,63 @@ var CABINET_WITHDRAWAL_QUERY = gql`
3146
3146
  }
3147
3147
  }
3148
3148
  `;
3149
+ var MEMBER_VERIFICATION_REQUEST_QUERY = gql`
3150
+ query MemberVerificationRequest {
3151
+ memberVerificationRequest {
3152
+ id
3153
+ firstName
3154
+ lastName
3155
+ dateOfBirth
3156
+ idFrontImage {
3157
+ id
3158
+ url
3159
+ }
3160
+ selfieImage {
3161
+ id
3162
+ url
3163
+ }
3164
+ permanentAddress
3165
+ currentAddress
3166
+ sourceOfIncome
3167
+ natureOfWork
3168
+ nationality
3169
+ placeOfBirth
3170
+ status
3171
+ basicDetailsSubmitted
3172
+ basicDetailsVerified
3173
+ imageDetailsSubmitted
3174
+ pendingManualImageDetailsVerification
3175
+ imageDetailsVerified
3176
+ personalDetailsSubmitted
3177
+ remarks
3178
+ dateTimeCreated
3179
+ dateTimeLastUpdated
3180
+ dateTimeApproved
3181
+ dateTimeRejected
3182
+ }
3183
+ }
3184
+ `;
3185
+ var SUBMIT_MEMBER_VERIFICATION_REQUEST_BASIC_DETAILS_MUTATION = gql`
3186
+ mutation SubmitMemberVerificationRequestBasicDetails(
3187
+ $input: SubmitMemberVerificationRequestBasicDetailsInput!
3188
+ ) {
3189
+ submitMemberVerificationRequestBasicDetails(input: $input)
3190
+ }
3191
+ `;
3192
+ var SUBMIT_MEMBER_VERIFICATION_REQUEST_IMAGE_DETAILS_MUTATION = gql`
3193
+ mutation SubmitMemberVerificationRequestImageDetails(
3194
+ $input: SubmitMemberVerificationRequestImageDetailsInput!
3195
+ ) {
3196
+ submitMemberVerificationRequestImageDetails(input: $input)
3197
+ }
3198
+ `;
3199
+ var SUBMIT_MEMBER_VERIFICATION_REQUEST_PERSONAL_DETAILS_MUTATION = gql`
3200
+ mutation SubmitMemberVerificationRequestPersonalDetails(
3201
+ $input: SubmitMemberVerificationRequestPersonalDetailsInput!
3202
+ ) {
3203
+ submitMemberVerificationRequestPersonalDetails(input: $input)
3204
+ }
3205
+ `;
3149
3206
 
3150
3207
  // src/services/utils.ts
3151
3208
  function createOperationError(code) {
@@ -3644,7 +3701,14 @@ var AccountService = class {
3644
3701
  };
3645
3702
  }
3646
3703
  async registerAgentAccount(variables) {
3647
- const res = await this.client.request(REGISTER_AGENT_ACCOUNT_MUTATION, variables);
3704
+ const { code, ...others } = variables;
3705
+ const res = await this.client.request(REGISTER_AGENT_ACCOUNT_MUTATION, others, {
3706
+ headers: {
3707
+ ...code && {
3708
+ "Agent-Code": code
3709
+ }
3710
+ }
3711
+ });
3648
3712
  if (!res.ok) return res;
3649
3713
  if (res.data?.registerAgentAccount) {
3650
3714
  return {
@@ -3654,6 +3718,38 @@ var AccountService = class {
3654
3718
  }
3655
3719
  return { ok: true };
3656
3720
  }
3721
+ async memberVerificationRequest() {
3722
+ const res = await this.client.request(MEMBER_VERIFICATION_REQUEST_QUERY);
3723
+ if (!res.ok) return res;
3724
+ return {
3725
+ ok: true,
3726
+ data: res.data.memberVerificationRequest ?? null
3727
+ };
3728
+ }
3729
+ async submitMemberVerificationRequestBasicDetails(variables) {
3730
+ const res = await this.client.request(SUBMIT_MEMBER_VERIFICATION_REQUEST_BASIC_DETAILS_MUTATION, variables);
3731
+ if (!res.ok) return res;
3732
+ return {
3733
+ ok: true,
3734
+ data: res.data.submitMemberVerificationRequestBasicDetails
3735
+ };
3736
+ }
3737
+ async submitMemberVerificationRequestImageDetails(variables) {
3738
+ const res = await this.client.request(SUBMIT_MEMBER_VERIFICATION_REQUEST_IMAGE_DETAILS_MUTATION, variables);
3739
+ if (!res.ok) return res;
3740
+ return {
3741
+ ok: true,
3742
+ data: res.data.submitMemberVerificationRequestImageDetails
3743
+ };
3744
+ }
3745
+ async submitMemberVerificationRequestPersonalDetails(variables) {
3746
+ const res = await this.client.request(SUBMIT_MEMBER_VERIFICATION_REQUEST_PERSONAL_DETAILS_MUTATION, variables);
3747
+ if (!res.ok) return res;
3748
+ return {
3749
+ ok: true,
3750
+ data: res.data.submitMemberVerificationRequestPersonalDetails
3751
+ };
3752
+ }
3657
3753
  };
3658
3754
 
3659
3755
  // src/utils/status-code-to-operation-error.ts
@@ -6819,7 +6915,8 @@ var Transformer = class {
6819
6915
  memberLevelSettings: this.memberLevelSettings.bind(this),
6820
6916
  achievementSettings: this.achievementSettings.bind(this),
6821
6917
  achievementPointsHistoryRecord: this.achievementPointsHistoryRecord.bind(this),
6822
- memberAchievements: this.memberAchievements.bind(this)
6918
+ memberAchievements: this.memberAchievements.bind(this),
6919
+ memberVerificationRequest: this.memberVerificationRequest.bind(this)
6823
6920
  };
6824
6921
  }
6825
6922
  site(data) {
@@ -8271,6 +8368,34 @@ var Transformer = class {
8271
8368
  };
8272
8369
  return compact(o);
8273
8370
  }
8371
+ memberVerificationRequest(data) {
8372
+ return {
8373
+ id: data.id,
8374
+ firstName: data.firstName ?? void 0,
8375
+ lastName: data.lastName ?? void 0,
8376
+ dateOfBirth: data.dateOfBirth ? new Date(data.dateOfBirth) : void 0,
8377
+ idFrontImage: data.idFrontImage ?? void 0,
8378
+ selfieImage: data.selfieImage ?? void 0,
8379
+ permanentAddress: data.permanentAddress ?? void 0,
8380
+ currentAddress: data.currentAddress ?? void 0,
8381
+ sourceOfIncome: data.sourceOfIncome ?? void 0,
8382
+ natureOfWork: data.natureOfWork ?? void 0,
8383
+ nationality: data.nationality ?? void 0,
8384
+ placeOfBirth: data.placeOfBirth ?? void 0,
8385
+ status: data.status,
8386
+ basicDetailsSubmitted: data.basicDetailsSubmitted,
8387
+ basicDetailsVerified: data.basicDetailsVerified,
8388
+ imageDetailsSubmitted: data.imageDetailsSubmitted,
8389
+ pendingManualImageDetailsVerification: data.pendingManualImageDetailsVerification,
8390
+ imageDetailsVerified: data.imageDetailsVerified,
8391
+ personalDetailsSubmitted: data.personalDetailsSubmitted,
8392
+ remarks: data.remarks ?? void 0,
8393
+ dateTimeCreated: new Date(data.dateTimeCreated),
8394
+ dateTimeLastUpdated: new Date(data.dateTimeLastUpdated),
8395
+ dateTimeApproved: data.dateTimeApproved ? new Date(data.dateTimeApproved) : void 0,
8396
+ dateTimeRejected: data.dateTimeRejected ? new Date(data.dateTimeRejected) : void 0
8397
+ };
8398
+ }
8274
8399
  };
8275
8400
 
8276
8401
  // src/sdk/sdk.ts
@@ -8942,7 +9067,7 @@ var Sdk = class {
8942
9067
  }
8943
9068
  });
8944
9069
  }
8945
- async registerAgentAccount(input) {
9070
+ async registerAgentAccount(input, code) {
8946
9071
  return await this.accountService.registerAgentAccount({
8947
9072
  input: {
8948
9073
  name: input.name,
@@ -8952,6 +9077,7 @@ var Sdk = class {
8952
9077
  emailAddress: input.emailAddress,
8953
9078
  customProperties: input.customProperties
8954
9079
  },
9080
+ ...code && { code },
8955
9081
  ...this.webDomain && {
8956
9082
  domain: this.webDomain
8957
9083
  }
@@ -10454,16 +10580,50 @@ var Sdk = class {
10454
10580
  data: res.data ?? false
10455
10581
  };
10456
10582
  }
10583
+ /*
10584
+ *=============================================
10585
+ * MEMBER VERIFICATION REQUEST
10586
+ *=============================================
10587
+ */
10588
+ async memberVerificationRequest() {
10589
+ const res = await this.accountService.memberVerificationRequest();
10590
+ if (!res.ok) return res;
10591
+ return {
10592
+ ok: true,
10593
+ data: res.data ? this.transformer.transform.memberVerificationRequest(res.data) : null
10594
+ };
10595
+ }
10596
+ async submitMemberVerificationRequestBasicDetails(input) {
10597
+ return await this.accountService.submitMemberVerificationRequestBasicDetails(
10598
+ {
10599
+ input: {
10600
+ ...input,
10601
+ dateOfBirth: this.formatYmd(input.dateOfBirth)
10602
+ }
10603
+ }
10604
+ );
10605
+ }
10606
+ async submitMemberVerificationRequestImageDetails(input) {
10607
+ return await this.accountService.submitMemberVerificationRequestImageDetails(
10608
+ { input }
10609
+ );
10610
+ }
10611
+ async submitMemberVerificationRequestPersonalDetails(input) {
10612
+ return await this.accountService.submitMemberVerificationRequestPersonalDetails(
10613
+ { input }
10614
+ );
10615
+ }
10457
10616
  /*
10458
10617
  *=============================================
10459
10618
  * UTILS
10460
10619
  *=============================================
10461
10620
  */
10462
10621
  formatYmd(date) {
10622
+ const date_ = date instanceof Date ? date : new Date(date);
10463
10623
  const ensure2Digits = (n) => n.toString().padStart(2, "0");
10464
- const y = date.getFullYear();
10465
- const m = ensure2Digits(date.getMonth() + 1);
10466
- const d = ensure2Digits(date.getDate());
10624
+ const y = date_.getFullYear();
10625
+ const m = ensure2Digits(date_.getMonth() + 1);
10626
+ const d = ensure2Digits(date_.getDate());
10467
10627
  return `${y}-${m}-${d}`;
10468
10628
  }
10469
10629
  };