@opexa/portal-sdk 0.55.2 → 0.56.1

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.js CHANGED
@@ -3141,6 +3141,70 @@ var CABINET_WITHDRAWAL_QUERY = gql`
3141
3141
  }
3142
3142
  }
3143
3143
  `;
3144
+ var MEMBER_VERIFICATION_REQUEST_QUERY = gql`
3145
+ query MemberVerificationRequest {
3146
+ memberVerificationRequest {
3147
+ id
3148
+ firstName
3149
+ lastName
3150
+ dateOfBirth
3151
+ idFrontImage {
3152
+ id
3153
+ url
3154
+ }
3155
+ selfieImage {
3156
+ id
3157
+ url
3158
+ }
3159
+ permanentAddress
3160
+ currentAddress
3161
+ sourceOfIncome
3162
+ natureOfWork
3163
+ nationality
3164
+ placeOfBirth
3165
+ status
3166
+ basicDetailsSubmitted
3167
+ basicDetailsVerified
3168
+ imageDetailsSubmitted
3169
+ pendingManualImageDetailsVerification
3170
+ imageDetailsVerified
3171
+ personalDetailsSubmitted
3172
+ remarks
3173
+ dateTimeCreated
3174
+ dateTimeLastUpdated
3175
+ dateTimeApproved
3176
+ dateTimeRejected
3177
+ }
3178
+ }
3179
+ `;
3180
+ var SUBMIT_MEMBER_VERIFICATION_REQUEST_BASIC_DETAILS_MUTATION = gql`
3181
+ mutation SubmitMemberVerificationRequestBasicDetails(
3182
+ $input: SubmitMemberVerificationRequestBasicDetailsInput!
3183
+ ) {
3184
+ submitMemberVerificationRequestBasicDetails(input: $input)
3185
+ }
3186
+ `;
3187
+ var SUBMIT_MEMBER_VERIFICATION_REQUEST_IMAGE_DETAILS_MUTATION = gql`
3188
+ mutation SubmitMemberVerificationRequestImageDetails(
3189
+ $input: SubmitMemberVerificationRequestImageDetailsInput!
3190
+ ) {
3191
+ submitMemberVerificationRequestImageDetails(input: $input)
3192
+ }
3193
+ `;
3194
+ var SUBMIT_MEMBER_VERIFICATION_REQUEST_PERSONAL_DETAILS_MUTATION = gql`
3195
+ mutation SubmitMemberVerificationRequestPersonalDetails(
3196
+ $input: SubmitMemberVerificationRequestPersonalDetailsInput!
3197
+ ) {
3198
+ submitMemberVerificationRequestPersonalDetails(input: $input)
3199
+ }
3200
+ `;
3201
+ var MEMBER_VERIFICATION_REQUEST_AUTOMATIC_APPROVAL_ENABLED_QUERY = gql`
3202
+ query MemberVerificationRequestAutomaticApprovalEnabled {
3203
+ platform {
3204
+ memberVerificationRequestAutomaticApprovalEnabled
3205
+ }
3206
+ }
3207
+ `;
3144
3208
 
3145
3209
  // src/services/utils.ts
3146
3210
  function createOperationError(code) {
@@ -3656,6 +3720,50 @@ var AccountService = class {
3656
3720
  }
3657
3721
  return { ok: true };
3658
3722
  }
3723
+ async memberVerificationRequest() {
3724
+ const res = await this.client.request(
3725
+ MEMBER_VERIFICATION_REQUEST_QUERY
3726
+ );
3727
+ if (!res.ok) return res;
3728
+ return {
3729
+ ok: true,
3730
+ data: res.data.memberVerificationRequest ?? null
3731
+ };
3732
+ }
3733
+ async submitMemberVerificationRequestBasicDetails(variables) {
3734
+ const res = await this.client.request(SUBMIT_MEMBER_VERIFICATION_REQUEST_BASIC_DETAILS_MUTATION, variables);
3735
+ if (!res.ok) return res;
3736
+ return {
3737
+ ok: true,
3738
+ data: res.data.submitMemberVerificationRequestBasicDetails
3739
+ };
3740
+ }
3741
+ async submitMemberVerificationRequestImageDetails(variables) {
3742
+ const res = await this.client.request(SUBMIT_MEMBER_VERIFICATION_REQUEST_IMAGE_DETAILS_MUTATION, variables);
3743
+ if (!res.ok) return res;
3744
+ return {
3745
+ ok: true,
3746
+ data: res.data.submitMemberVerificationRequestImageDetails
3747
+ };
3748
+ }
3749
+ async submitMemberVerificationRequestPersonalDetails(variables) {
3750
+ const res = await this.client.request(SUBMIT_MEMBER_VERIFICATION_REQUEST_PERSONAL_DETAILS_MUTATION, variables);
3751
+ if (!res.ok) return res;
3752
+ return {
3753
+ ok: true,
3754
+ data: res.data.submitMemberVerificationRequestPersonalDetails
3755
+ };
3756
+ }
3757
+ async memberVerificationRequestAutomaticApprovalEnabled() {
3758
+ const res = await this.client.request(
3759
+ MEMBER_VERIFICATION_REQUEST_AUTOMATIC_APPROVAL_ENABLED_QUERY
3760
+ );
3761
+ if (!res.ok) return res;
3762
+ return {
3763
+ ok: true,
3764
+ data: res.data.memberVerificationRequestAutomaticApprovalEnabled
3765
+ };
3766
+ }
3659
3767
  };
3660
3768
 
3661
3769
  // src/utils/status-code-to-operation-error.ts
@@ -5991,8 +6099,8 @@ function pollable(func, config) {
5991
6099
  };
5992
6100
  }
5993
6101
 
5994
- // src/sdk/session-manager.ts
5995
- var SessionManager = class {
6102
+ // src/sdk/session-manager-cookie.ts
6103
+ var SessionManagerCookie = class {
5996
6104
  logger;
5997
6105
  storageKey = "session";
5998
6106
  platformStorageKey = "session/platform";
@@ -6003,10 +6111,6 @@ var SessionManager = class {
6003
6111
  this.authService = config.authService;
6004
6112
  this.walletService = config.walletService;
6005
6113
  this.logger = config.logger;
6006
- if (config.sessionPrefix) {
6007
- this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
6008
- this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
6009
- }
6010
6114
  }
6011
6115
  get refreshing() {
6012
6116
  return this._refreshing;
@@ -6015,16 +6119,6 @@ var SessionManager = class {
6015
6119
  this._refreshing = value;
6016
6120
  }
6017
6121
  async create(input) {
6018
- if (this.isServer) {
6019
- this.logger.warn("'localStorage' is not available on the server.");
6020
- return {
6021
- ok: false,
6022
- error: {
6023
- name: "UnknownError",
6024
- message: "Server sign in is not supported."
6025
- }
6026
- };
6027
- }
6028
6122
  if (input.type === "MAYA") {
6029
6123
  localStorage.setItem(this.platformStorageKey, "MAYA");
6030
6124
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6051,13 +6145,14 @@ var SessionManager = class {
6051
6145
  })();
6052
6146
  if (!r1.ok) return r1;
6053
6147
  const now2 = /* @__PURE__ */ new Date();
6054
- localStorage.setItem(
6148
+ cookies.set(
6055
6149
  this.storageKey,
6056
6150
  JSON.stringify({
6057
6151
  ...r1.data,
6058
6152
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6059
6153
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6060
- })
6154
+ }),
6155
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6061
6156
  );
6062
6157
  return {
6063
6158
  ok: true,
@@ -6068,13 +6163,16 @@ var SessionManager = class {
6068
6163
  const res2 = await this.authService.createSession(input);
6069
6164
  if (res2.ok) {
6070
6165
  const now2 = /* @__PURE__ */ new Date();
6071
- localStorage.setItem(
6166
+ cookies.set(
6072
6167
  this.storageKey,
6073
6168
  JSON.stringify({
6074
6169
  ...res2.data,
6075
6170
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6076
6171
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6077
- })
6172
+ }),
6173
+ {
6174
+ expires: subMinutes(addDays(now2, 30), 2).getTime()
6175
+ }
6078
6176
  );
6079
6177
  return {
6080
6178
  ok: true,
@@ -6086,18 +6184,18 @@ var SessionManager = class {
6086
6184
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6087
6185
  const res2 = await this.authService.createSession({
6088
6186
  type: "SOCIALS",
6089
- token: input.token,
6090
- channel: input.channel
6187
+ token: input.token
6091
6188
  });
6092
6189
  if (res2.ok) {
6093
6190
  const now2 = /* @__PURE__ */ new Date();
6094
- localStorage.setItem(
6191
+ cookies.set(
6095
6192
  this.storageKey,
6096
6193
  JSON.stringify({
6097
6194
  ...res2.data,
6098
6195
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6099
6196
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6100
- })
6197
+ }),
6198
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6101
6199
  );
6102
6200
  return {
6103
6201
  ok: true,
@@ -6111,13 +6209,14 @@ var SessionManager = class {
6111
6209
  const res2 = await this.authService.createSession(input);
6112
6210
  if (res2.ok) {
6113
6211
  const now2 = /* @__PURE__ */ new Date();
6114
- localStorage.setItem(
6212
+ cookies.set(
6115
6213
  this.storageKey,
6116
6214
  JSON.stringify({
6117
6215
  ...res2.data,
6118
6216
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6119
6217
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6120
- })
6218
+ }),
6219
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6121
6220
  );
6122
6221
  return {
6123
6222
  ok: true,
@@ -6137,13 +6236,14 @@ var SessionManager = class {
6137
6236
  };
6138
6237
  }
6139
6238
  const now = /* @__PURE__ */ new Date();
6140
- localStorage.setItem(
6239
+ cookies.set(
6141
6240
  this.storageKey,
6142
6241
  JSON.stringify({
6143
6242
  ...res.data,
6144
6243
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6145
6244
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6146
- })
6245
+ }),
6246
+ {}
6147
6247
  );
6148
6248
  return {
6149
6249
  ok: true,
@@ -6155,15 +6255,18 @@ var SessionManager = class {
6155
6255
  if (res.ok) {
6156
6256
  const now = /* @__PURE__ */ new Date();
6157
6257
  if (this.isServer) {
6158
- this.logger.warn("'localStorage' is not available on the server.");
6258
+ this.logger.warn("'client cookies' is not available on the server.");
6159
6259
  } else {
6160
- localStorage.setItem(
6260
+ cookies.set(
6161
6261
  this.storageKey,
6162
6262
  JSON.stringify({
6163
6263
  ...res.data,
6164
6264
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6165
6265
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6166
- })
6266
+ }),
6267
+ {
6268
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6269
+ }
6167
6270
  );
6168
6271
  }
6169
6272
  return { ok: true };
@@ -6173,7 +6276,7 @@ var SessionManager = class {
6173
6276
  }
6174
6277
  async get() {
6175
6278
  if (this.isServer) {
6176
- this.logger.warn("'localStorage' is not available on the server.");
6279
+ this.logger.warn("'client cookies' is not available on the server.");
6177
6280
  return {
6178
6281
  ok: true,
6179
6282
  data: null
@@ -6183,7 +6286,7 @@ var SessionManager = class {
6183
6286
  await sleep(1e3);
6184
6287
  return await this.get();
6185
6288
  }
6186
- const val = localStorage.getItem(this.storageKey);
6289
+ const val = cookies.get(this.storageKey);
6187
6290
  if (!val) {
6188
6291
  return {
6189
6292
  ok: true,
@@ -6197,7 +6300,7 @@ var SessionManager = class {
6197
6300
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6198
6301
  if (isAfter(now, refreshTokenExpiresAt)) {
6199
6302
  this.logger.warn("Session expired. Logging out..");
6200
- localStorage.removeItem(this.storageKey);
6303
+ cookies.remove(this.storageKey);
6201
6304
  return {
6202
6305
  ok: false,
6203
6306
  error: {
@@ -6214,7 +6317,7 @@ var SessionManager = class {
6214
6317
  if (!res.ok) {
6215
6318
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6216
6319
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6217
- localStorage.removeItem(this.storageKey);
6320
+ cookies.remove(this.storageKey);
6218
6321
  return {
6219
6322
  ok: false,
6220
6323
  error: res.error
@@ -6235,7 +6338,9 @@ var SessionManager = class {
6235
6338
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6236
6339
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6237
6340
  };
6238
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6341
+ cookies.set(this.storageKey, JSON.stringify(obj), {
6342
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6343
+ });
6239
6344
  }
6240
6345
  return {
6241
6346
  ok: true,
@@ -6253,13 +6358,13 @@ var SessionManager = class {
6253
6358
  }
6254
6359
  async refresh() {
6255
6360
  if (this.isServer) {
6256
- this.logger.warn("'localStorage' is not available on the server.");
6361
+ this.logger.warn("'client cookies' is not available on the server.");
6257
6362
  return {
6258
6363
  ok: true,
6259
6364
  data: null
6260
6365
  };
6261
6366
  }
6262
- const val = localStorage.getItem(this.storageKey);
6367
+ const val = cookies.get(this.storageKey);
6263
6368
  if (!val) {
6264
6369
  return {
6265
6370
  ok: true,
@@ -6276,7 +6381,7 @@ var SessionManager = class {
6276
6381
  if (!res.ok) {
6277
6382
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6278
6383
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6279
- localStorage.removeItem(this.storageKey);
6384
+ cookies.remove(this.storageKey);
6280
6385
  return {
6281
6386
  ok: false,
6282
6387
  error: res.error
@@ -6297,7 +6402,9 @@ var SessionManager = class {
6297
6402
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6298
6403
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6299
6404
  };
6300
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6405
+ cookies.set(this.storageKey, JSON.stringify(obj), {
6406
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6407
+ });
6301
6408
  return {
6302
6409
  ok: true,
6303
6410
  data: obj
@@ -6314,18 +6421,18 @@ var SessionManager = class {
6314
6421
  }
6315
6422
  async destroy() {
6316
6423
  if (this.isServer) {
6317
- this.logger.warn("'localStorage' is not available on the server.");
6424
+ this.logger.warn("'client cookies' is not available on the server.");
6318
6425
  return;
6319
6426
  }
6320
6427
  const res = await this.get();
6321
6428
  if (res.data?.accessToken) {
6322
6429
  await this.authService.destroySession(res.data.accessToken);
6323
6430
  }
6324
- localStorage.removeItem(this.storageKey);
6431
+ cookies.remove(this.storageKey);
6325
6432
  }
6326
6433
  async verify() {
6327
6434
  if (this.isServer) {
6328
- this.logger.warn("'localStorage' is not available on the server.");
6435
+ this.logger.warn("'client cookies' is not available on the server.");
6329
6436
  return true;
6330
6437
  }
6331
6438
  const s = await this.get();
@@ -6335,13 +6442,13 @@ var SessionManager = class {
6335
6442
  if (!s.data) return true;
6336
6443
  const v = await this.authService.verifySession(s.data.accessToken);
6337
6444
  if (!v) {
6338
- localStorage.removeItem(this.storageKey);
6445
+ cookies.remove(this.storageKey);
6339
6446
  }
6340
6447
  return v;
6341
6448
  }
6342
6449
  get onMaya() {
6343
6450
  if (this.isServer) {
6344
- this.logger.warn("'localStorage' is not available on the server.");
6451
+ this.logger.warn("'client cookies' is not available on the server.");
6345
6452
  return false;
6346
6453
  }
6347
6454
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -6357,7 +6464,9 @@ var SessionManager = class {
6357
6464
  return typeof window === "undefined";
6358
6465
  }
6359
6466
  };
6360
- var SessionManagerCookie = class {
6467
+
6468
+ // src/sdk/session-manager.ts
6469
+ var SessionManager = class {
6361
6470
  logger;
6362
6471
  storageKey = "session";
6363
6472
  platformStorageKey = "session/platform";
@@ -6368,6 +6477,10 @@ var SessionManagerCookie = class {
6368
6477
  this.authService = config.authService;
6369
6478
  this.walletService = config.walletService;
6370
6479
  this.logger = config.logger;
6480
+ if (config.sessionPrefix) {
6481
+ this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
6482
+ this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
6483
+ }
6371
6484
  }
6372
6485
  get refreshing() {
6373
6486
  return this._refreshing;
@@ -6376,6 +6489,16 @@ var SessionManagerCookie = class {
6376
6489
  this._refreshing = value;
6377
6490
  }
6378
6491
  async create(input) {
6492
+ if (this.isServer) {
6493
+ this.logger.warn("'localStorage' is not available on the server.");
6494
+ return {
6495
+ ok: false,
6496
+ error: {
6497
+ name: "UnknownError",
6498
+ message: "Server sign in is not supported."
6499
+ }
6500
+ };
6501
+ }
6379
6502
  if (input.type === "MAYA") {
6380
6503
  localStorage.setItem(this.platformStorageKey, "MAYA");
6381
6504
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6402,14 +6525,13 @@ var SessionManagerCookie = class {
6402
6525
  })();
6403
6526
  if (!r1.ok) return r1;
6404
6527
  const now2 = /* @__PURE__ */ new Date();
6405
- cookies.set(
6528
+ localStorage.setItem(
6406
6529
  this.storageKey,
6407
6530
  JSON.stringify({
6408
6531
  ...r1.data,
6409
6532
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6410
6533
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6411
- }),
6412
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6534
+ })
6413
6535
  );
6414
6536
  return {
6415
6537
  ok: true,
@@ -6420,16 +6542,13 @@ var SessionManagerCookie = class {
6420
6542
  const res2 = await this.authService.createSession(input);
6421
6543
  if (res2.ok) {
6422
6544
  const now2 = /* @__PURE__ */ new Date();
6423
- cookies.set(
6545
+ localStorage.setItem(
6424
6546
  this.storageKey,
6425
6547
  JSON.stringify({
6426
6548
  ...res2.data,
6427
6549
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6428
6550
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6429
- }),
6430
- {
6431
- expires: subMinutes(addDays(now2, 30), 2).getTime()
6432
- }
6551
+ })
6433
6552
  );
6434
6553
  return {
6435
6554
  ok: true,
@@ -6441,18 +6560,18 @@ var SessionManagerCookie = class {
6441
6560
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6442
6561
  const res2 = await this.authService.createSession({
6443
6562
  type: "SOCIALS",
6444
- token: input.token
6563
+ token: input.token,
6564
+ channel: input.channel
6445
6565
  });
6446
6566
  if (res2.ok) {
6447
6567
  const now2 = /* @__PURE__ */ new Date();
6448
- cookies.set(
6568
+ localStorage.setItem(
6449
6569
  this.storageKey,
6450
6570
  JSON.stringify({
6451
6571
  ...res2.data,
6452
6572
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6453
6573
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6454
- }),
6455
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6574
+ })
6456
6575
  );
6457
6576
  return {
6458
6577
  ok: true,
@@ -6466,14 +6585,13 @@ var SessionManagerCookie = class {
6466
6585
  const res2 = await this.authService.createSession(input);
6467
6586
  if (res2.ok) {
6468
6587
  const now2 = /* @__PURE__ */ new Date();
6469
- cookies.set(
6588
+ localStorage.setItem(
6470
6589
  this.storageKey,
6471
6590
  JSON.stringify({
6472
6591
  ...res2.data,
6473
6592
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6474
6593
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6475
- }),
6476
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6594
+ })
6477
6595
  );
6478
6596
  return {
6479
6597
  ok: true,
@@ -6493,14 +6611,13 @@ var SessionManagerCookie = class {
6493
6611
  };
6494
6612
  }
6495
6613
  const now = /* @__PURE__ */ new Date();
6496
- cookies.set(
6614
+ localStorage.setItem(
6497
6615
  this.storageKey,
6498
6616
  JSON.stringify({
6499
6617
  ...res.data,
6500
6618
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6501
6619
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6502
- }),
6503
- {}
6620
+ })
6504
6621
  );
6505
6622
  return {
6506
6623
  ok: true,
@@ -6512,18 +6629,15 @@ var SessionManagerCookie = class {
6512
6629
  if (res.ok) {
6513
6630
  const now = /* @__PURE__ */ new Date();
6514
6631
  if (this.isServer) {
6515
- this.logger.warn("'client cookies' is not available on the server.");
6632
+ this.logger.warn("'localStorage' is not available on the server.");
6516
6633
  } else {
6517
- cookies.set(
6634
+ localStorage.setItem(
6518
6635
  this.storageKey,
6519
6636
  JSON.stringify({
6520
6637
  ...res.data,
6521
6638
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6522
6639
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6523
- }),
6524
- {
6525
- expires: subMinutes(addDays(now, 30), 2).getTime()
6526
- }
6640
+ })
6527
6641
  );
6528
6642
  }
6529
6643
  return { ok: true };
@@ -6533,7 +6647,7 @@ var SessionManagerCookie = class {
6533
6647
  }
6534
6648
  async get() {
6535
6649
  if (this.isServer) {
6536
- this.logger.warn("'client cookies' is not available on the server.");
6650
+ this.logger.warn("'localStorage' is not available on the server.");
6537
6651
  return {
6538
6652
  ok: true,
6539
6653
  data: null
@@ -6543,7 +6657,7 @@ var SessionManagerCookie = class {
6543
6657
  await sleep(1e3);
6544
6658
  return await this.get();
6545
6659
  }
6546
- const val = cookies.get(this.storageKey);
6660
+ const val = localStorage.getItem(this.storageKey);
6547
6661
  if (!val) {
6548
6662
  return {
6549
6663
  ok: true,
@@ -6557,7 +6671,7 @@ var SessionManagerCookie = class {
6557
6671
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6558
6672
  if (isAfter(now, refreshTokenExpiresAt)) {
6559
6673
  this.logger.warn("Session expired. Logging out..");
6560
- cookies.remove(this.storageKey);
6674
+ localStorage.removeItem(this.storageKey);
6561
6675
  return {
6562
6676
  ok: false,
6563
6677
  error: {
@@ -6574,7 +6688,7 @@ var SessionManagerCookie = class {
6574
6688
  if (!res.ok) {
6575
6689
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6576
6690
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6577
- cookies.remove(this.storageKey);
6691
+ localStorage.removeItem(this.storageKey);
6578
6692
  return {
6579
6693
  ok: false,
6580
6694
  error: res.error
@@ -6595,9 +6709,7 @@ var SessionManagerCookie = class {
6595
6709
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6596
6710
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6597
6711
  };
6598
- cookies.set(this.storageKey, JSON.stringify(obj), {
6599
- expires: subMinutes(addDays(now, 30), 2).getTime()
6600
- });
6712
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
6601
6713
  }
6602
6714
  return {
6603
6715
  ok: true,
@@ -6615,13 +6727,13 @@ var SessionManagerCookie = class {
6615
6727
  }
6616
6728
  async refresh() {
6617
6729
  if (this.isServer) {
6618
- this.logger.warn("'client cookies' is not available on the server.");
6730
+ this.logger.warn("'localStorage' is not available on the server.");
6619
6731
  return {
6620
6732
  ok: true,
6621
6733
  data: null
6622
6734
  };
6623
6735
  }
6624
- const val = cookies.get(this.storageKey);
6736
+ const val = localStorage.getItem(this.storageKey);
6625
6737
  if (!val) {
6626
6738
  return {
6627
6739
  ok: true,
@@ -6638,7 +6750,7 @@ var SessionManagerCookie = class {
6638
6750
  if (!res.ok) {
6639
6751
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6640
6752
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6641
- cookies.remove(this.storageKey);
6753
+ localStorage.removeItem(this.storageKey);
6642
6754
  return {
6643
6755
  ok: false,
6644
6756
  error: res.error
@@ -6659,9 +6771,7 @@ var SessionManagerCookie = class {
6659
6771
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6660
6772
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6661
6773
  };
6662
- cookies.set(this.storageKey, JSON.stringify(obj), {
6663
- expires: subMinutes(addDays(now, 30), 2).getTime()
6664
- });
6774
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
6665
6775
  return {
6666
6776
  ok: true,
6667
6777
  data: obj
@@ -6678,18 +6788,18 @@ var SessionManagerCookie = class {
6678
6788
  }
6679
6789
  async destroy() {
6680
6790
  if (this.isServer) {
6681
- this.logger.warn("'client cookies' is not available on the server.");
6791
+ this.logger.warn("'localStorage' is not available on the server.");
6682
6792
  return;
6683
6793
  }
6684
6794
  const res = await this.get();
6685
6795
  if (res.data?.accessToken) {
6686
6796
  await this.authService.destroySession(res.data.accessToken);
6687
6797
  }
6688
- cookies.remove(this.storageKey);
6798
+ localStorage.removeItem(this.storageKey);
6689
6799
  }
6690
6800
  async verify() {
6691
6801
  if (this.isServer) {
6692
- this.logger.warn("'client cookies' is not available on the server.");
6802
+ this.logger.warn("'localStorage' is not available on the server.");
6693
6803
  return true;
6694
6804
  }
6695
6805
  const s = await this.get();
@@ -6699,13 +6809,13 @@ var SessionManagerCookie = class {
6699
6809
  if (!s.data) return true;
6700
6810
  const v = await this.authService.verifySession(s.data.accessToken);
6701
6811
  if (!v) {
6702
- cookies.remove(this.storageKey);
6812
+ localStorage.removeItem(this.storageKey);
6703
6813
  }
6704
6814
  return v;
6705
6815
  }
6706
6816
  get onMaya() {
6707
6817
  if (this.isServer) {
6708
- this.logger.warn("'client cookies' is not available on the server.");
6818
+ this.logger.warn("'localStorage' is not available on the server.");
6709
6819
  return false;
6710
6820
  }
6711
6821
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -6819,7 +6929,8 @@ var Transformer = class {
6819
6929
  memberLevelSettings: this.memberLevelSettings.bind(this),
6820
6930
  achievementSettings: this.achievementSettings.bind(this),
6821
6931
  achievementPointsHistoryRecord: this.achievementPointsHistoryRecord.bind(this),
6822
- memberAchievements: this.memberAchievements.bind(this)
6932
+ memberAchievements: this.memberAchievements.bind(this),
6933
+ memberVerificationRequest: this.memberVerificationRequest.bind(this)
6823
6934
  };
6824
6935
  }
6825
6936
  site(data) {
@@ -8271,6 +8382,34 @@ var Transformer = class {
8271
8382
  };
8272
8383
  return compact(o);
8273
8384
  }
8385
+ memberVerificationRequest(data) {
8386
+ return {
8387
+ id: data.id,
8388
+ firstName: data.firstName ?? void 0,
8389
+ lastName: data.lastName ?? void 0,
8390
+ dateOfBirth: data.dateOfBirth ? new Date(data.dateOfBirth) : void 0,
8391
+ idFrontImage: data.idFrontImage ?? void 0,
8392
+ selfieImage: data.selfieImage ?? void 0,
8393
+ permanentAddress: data.permanentAddress ?? void 0,
8394
+ currentAddress: data.currentAddress ?? void 0,
8395
+ sourceOfIncome: data.sourceOfIncome ?? void 0,
8396
+ natureOfWork: data.natureOfWork ?? void 0,
8397
+ nationality: data.nationality ?? void 0,
8398
+ placeOfBirth: data.placeOfBirth ?? void 0,
8399
+ status: data.status,
8400
+ basicDetailsSubmitted: data.basicDetailsSubmitted,
8401
+ basicDetailsVerified: data.basicDetailsVerified,
8402
+ imageDetailsSubmitted: data.imageDetailsSubmitted,
8403
+ pendingManualImageDetailsVerification: data.pendingManualImageDetailsVerification,
8404
+ imageDetailsVerified: data.imageDetailsVerified,
8405
+ personalDetailsSubmitted: data.personalDetailsSubmitted,
8406
+ remarks: data.remarks ?? void 0,
8407
+ dateTimeCreated: new Date(data.dateTimeCreated),
8408
+ dateTimeLastUpdated: new Date(data.dateTimeLastUpdated),
8409
+ dateTimeApproved: data.dateTimeApproved ? new Date(data.dateTimeApproved) : void 0,
8410
+ dateTimeRejected: data.dateTimeRejected ? new Date(data.dateTimeRejected) : void 0
8411
+ };
8412
+ }
8274
8413
  };
8275
8414
 
8276
8415
  // src/sdk/sdk.ts
@@ -10455,16 +10594,53 @@ var Sdk = class {
10455
10594
  data: res.data ?? false
10456
10595
  };
10457
10596
  }
10597
+ /*
10598
+ *=============================================
10599
+ * MEMBER VERIFICATION REQUEST
10600
+ *=============================================
10601
+ */
10602
+ async memberVerificationRequest() {
10603
+ const res = await this.accountService.memberVerificationRequest();
10604
+ if (!res.ok) return res;
10605
+ return {
10606
+ ok: true,
10607
+ data: res.data ? this.transformer.transform.memberVerificationRequest(res.data) : null
10608
+ };
10609
+ }
10610
+ async submitMemberVerificationRequestBasicDetails(input) {
10611
+ return await this.accountService.submitMemberVerificationRequestBasicDetails(
10612
+ {
10613
+ input: {
10614
+ ...input,
10615
+ dateOfBirth: this.formatYmd(input.dateOfBirth)
10616
+ }
10617
+ }
10618
+ );
10619
+ }
10620
+ async submitMemberVerificationRequestImageDetails(input) {
10621
+ return await this.accountService.submitMemberVerificationRequestImageDetails(
10622
+ { input }
10623
+ );
10624
+ }
10625
+ async submitMemberVerificationRequestPersonalDetails(input) {
10626
+ return await this.accountService.submitMemberVerificationRequestPersonalDetails(
10627
+ { input }
10628
+ );
10629
+ }
10630
+ async memberVerificationRequestAutomaticApprovalEnabled() {
10631
+ return await this.accountService.memberVerificationRequestAutomaticApprovalEnabled();
10632
+ }
10458
10633
  /*
10459
10634
  *=============================================
10460
10635
  * UTILS
10461
10636
  *=============================================
10462
10637
  */
10463
10638
  formatYmd(date) {
10639
+ const date_ = date instanceof Date ? date : new Date(date);
10464
10640
  const ensure2Digits = (n) => n.toString().padStart(2, "0");
10465
- const y = date.getFullYear();
10466
- const m = ensure2Digits(date.getMonth() + 1);
10467
- const d = ensure2Digits(date.getDate());
10641
+ const y = date_.getFullYear();
10642
+ const m = ensure2Digits(date_.getMonth() + 1);
10643
+ const d = ensure2Digits(date_.getDate());
10468
10644
  return `${y}-${m}-${d}`;
10469
10645
  }
10470
10646
  };