@opexa/portal-sdk 0.55.2 → 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) {
@@ -3661,6 +3718,38 @@ var AccountService = class {
3661
3718
  }
3662
3719
  return { ok: true };
3663
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
+ }
3664
3753
  };
3665
3754
 
3666
3755
  // src/utils/status-code-to-operation-error.ts
@@ -5996,8 +6085,8 @@ function pollable(func, config) {
5996
6085
  };
5997
6086
  }
5998
6087
 
5999
- // src/sdk/session-manager.ts
6000
- var SessionManager = class {
6088
+ // src/sdk/session-manager-cookie.ts
6089
+ var SessionManagerCookie = class {
6001
6090
  logger;
6002
6091
  storageKey = "session";
6003
6092
  platformStorageKey = "session/platform";
@@ -6008,10 +6097,6 @@ var SessionManager = class {
6008
6097
  this.authService = config.authService;
6009
6098
  this.walletService = config.walletService;
6010
6099
  this.logger = config.logger;
6011
- if (config.sessionPrefix) {
6012
- this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
6013
- this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
6014
- }
6015
6100
  }
6016
6101
  get refreshing() {
6017
6102
  return this._refreshing;
@@ -6020,16 +6105,6 @@ var SessionManager = class {
6020
6105
  this._refreshing = value;
6021
6106
  }
6022
6107
  async create(input) {
6023
- if (this.isServer) {
6024
- this.logger.warn("'localStorage' is not available on the server.");
6025
- return {
6026
- ok: false,
6027
- error: {
6028
- name: "UnknownError",
6029
- message: "Server sign in is not supported."
6030
- }
6031
- };
6032
- }
6033
6108
  if (input.type === "MAYA") {
6034
6109
  localStorage.setItem(this.platformStorageKey, "MAYA");
6035
6110
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6056,13 +6131,14 @@ var SessionManager = class {
6056
6131
  })();
6057
6132
  if (!r1.ok) return r1;
6058
6133
  const now2 = /* @__PURE__ */ new Date();
6059
- localStorage.setItem(
6134
+ cookies__default.default.set(
6060
6135
  this.storageKey,
6061
6136
  JSON.stringify({
6062
6137
  ...r1.data,
6063
6138
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6064
6139
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6065
- })
6140
+ }),
6141
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6066
6142
  );
6067
6143
  return {
6068
6144
  ok: true,
@@ -6073,13 +6149,16 @@ var SessionManager = class {
6073
6149
  const res2 = await this.authService.createSession(input);
6074
6150
  if (res2.ok) {
6075
6151
  const now2 = /* @__PURE__ */ new Date();
6076
- localStorage.setItem(
6152
+ cookies__default.default.set(
6077
6153
  this.storageKey,
6078
6154
  JSON.stringify({
6079
6155
  ...res2.data,
6080
6156
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6081
6157
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6082
- })
6158
+ }),
6159
+ {
6160
+ expires: subMinutes(addDays(now2, 30), 2).getTime()
6161
+ }
6083
6162
  );
6084
6163
  return {
6085
6164
  ok: true,
@@ -6091,18 +6170,18 @@ var SessionManager = class {
6091
6170
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6092
6171
  const res2 = await this.authService.createSession({
6093
6172
  type: "SOCIALS",
6094
- token: input.token,
6095
- channel: input.channel
6173
+ token: input.token
6096
6174
  });
6097
6175
  if (res2.ok) {
6098
6176
  const now2 = /* @__PURE__ */ new Date();
6099
- localStorage.setItem(
6177
+ cookies__default.default.set(
6100
6178
  this.storageKey,
6101
6179
  JSON.stringify({
6102
6180
  ...res2.data,
6103
6181
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6104
6182
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6105
- })
6183
+ }),
6184
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6106
6185
  );
6107
6186
  return {
6108
6187
  ok: true,
@@ -6116,13 +6195,14 @@ var SessionManager = class {
6116
6195
  const res2 = await this.authService.createSession(input);
6117
6196
  if (res2.ok) {
6118
6197
  const now2 = /* @__PURE__ */ new Date();
6119
- localStorage.setItem(
6198
+ cookies__default.default.set(
6120
6199
  this.storageKey,
6121
6200
  JSON.stringify({
6122
6201
  ...res2.data,
6123
6202
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6124
6203
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6125
- })
6204
+ }),
6205
+ { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6126
6206
  );
6127
6207
  return {
6128
6208
  ok: true,
@@ -6142,13 +6222,14 @@ var SessionManager = class {
6142
6222
  };
6143
6223
  }
6144
6224
  const now = /* @__PURE__ */ new Date();
6145
- localStorage.setItem(
6225
+ cookies__default.default.set(
6146
6226
  this.storageKey,
6147
6227
  JSON.stringify({
6148
6228
  ...res.data,
6149
6229
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6150
6230
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6151
- })
6231
+ }),
6232
+ {}
6152
6233
  );
6153
6234
  return {
6154
6235
  ok: true,
@@ -6160,15 +6241,18 @@ var SessionManager = class {
6160
6241
  if (res.ok) {
6161
6242
  const now = /* @__PURE__ */ new Date();
6162
6243
  if (this.isServer) {
6163
- this.logger.warn("'localStorage' is not available on the server.");
6244
+ this.logger.warn("'client cookies' is not available on the server.");
6164
6245
  } else {
6165
- localStorage.setItem(
6246
+ cookies__default.default.set(
6166
6247
  this.storageKey,
6167
6248
  JSON.stringify({
6168
6249
  ...res.data,
6169
6250
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6170
6251
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6171
- })
6252
+ }),
6253
+ {
6254
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6255
+ }
6172
6256
  );
6173
6257
  }
6174
6258
  return { ok: true };
@@ -6178,7 +6262,7 @@ var SessionManager = class {
6178
6262
  }
6179
6263
  async get() {
6180
6264
  if (this.isServer) {
6181
- this.logger.warn("'localStorage' is not available on the server.");
6265
+ this.logger.warn("'client cookies' is not available on the server.");
6182
6266
  return {
6183
6267
  ok: true,
6184
6268
  data: null
@@ -6188,7 +6272,7 @@ var SessionManager = class {
6188
6272
  await sleep(1e3);
6189
6273
  return await this.get();
6190
6274
  }
6191
- const val = localStorage.getItem(this.storageKey);
6275
+ const val = cookies__default.default.get(this.storageKey);
6192
6276
  if (!val) {
6193
6277
  return {
6194
6278
  ok: true,
@@ -6202,7 +6286,7 @@ var SessionManager = class {
6202
6286
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6203
6287
  if (isAfter(now, refreshTokenExpiresAt)) {
6204
6288
  this.logger.warn("Session expired. Logging out..");
6205
- localStorage.removeItem(this.storageKey);
6289
+ cookies__default.default.remove(this.storageKey);
6206
6290
  return {
6207
6291
  ok: false,
6208
6292
  error: {
@@ -6219,7 +6303,7 @@ var SessionManager = class {
6219
6303
  if (!res.ok) {
6220
6304
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6221
6305
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6222
- localStorage.removeItem(this.storageKey);
6306
+ cookies__default.default.remove(this.storageKey);
6223
6307
  return {
6224
6308
  ok: false,
6225
6309
  error: res.error
@@ -6240,7 +6324,9 @@ var SessionManager = class {
6240
6324
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6241
6325
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6242
6326
  };
6243
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6327
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6328
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6329
+ });
6244
6330
  }
6245
6331
  return {
6246
6332
  ok: true,
@@ -6258,13 +6344,13 @@ var SessionManager = class {
6258
6344
  }
6259
6345
  async refresh() {
6260
6346
  if (this.isServer) {
6261
- this.logger.warn("'localStorage' is not available on the server.");
6347
+ this.logger.warn("'client cookies' is not available on the server.");
6262
6348
  return {
6263
6349
  ok: true,
6264
6350
  data: null
6265
6351
  };
6266
6352
  }
6267
- const val = localStorage.getItem(this.storageKey);
6353
+ const val = cookies__default.default.get(this.storageKey);
6268
6354
  if (!val) {
6269
6355
  return {
6270
6356
  ok: true,
@@ -6281,7 +6367,7 @@ var SessionManager = class {
6281
6367
  if (!res.ok) {
6282
6368
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6283
6369
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6284
- localStorage.removeItem(this.storageKey);
6370
+ cookies__default.default.remove(this.storageKey);
6285
6371
  return {
6286
6372
  ok: false,
6287
6373
  error: res.error
@@ -6302,7 +6388,9 @@ var SessionManager = class {
6302
6388
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6303
6389
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6304
6390
  };
6305
- localStorage.setItem(this.storageKey, JSON.stringify(obj));
6391
+ cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6392
+ expires: subMinutes(addDays(now, 30), 2).getTime()
6393
+ });
6306
6394
  return {
6307
6395
  ok: true,
6308
6396
  data: obj
@@ -6319,18 +6407,18 @@ var SessionManager = class {
6319
6407
  }
6320
6408
  async destroy() {
6321
6409
  if (this.isServer) {
6322
- this.logger.warn("'localStorage' is not available on the server.");
6410
+ this.logger.warn("'client cookies' is not available on the server.");
6323
6411
  return;
6324
6412
  }
6325
6413
  const res = await this.get();
6326
6414
  if (res.data?.accessToken) {
6327
6415
  await this.authService.destroySession(res.data.accessToken);
6328
6416
  }
6329
- localStorage.removeItem(this.storageKey);
6417
+ cookies__default.default.remove(this.storageKey);
6330
6418
  }
6331
6419
  async verify() {
6332
6420
  if (this.isServer) {
6333
- this.logger.warn("'localStorage' is not available on the server.");
6421
+ this.logger.warn("'client cookies' is not available on the server.");
6334
6422
  return true;
6335
6423
  }
6336
6424
  const s = await this.get();
@@ -6340,13 +6428,13 @@ var SessionManager = class {
6340
6428
  if (!s.data) return true;
6341
6429
  const v = await this.authService.verifySession(s.data.accessToken);
6342
6430
  if (!v) {
6343
- localStorage.removeItem(this.storageKey);
6431
+ cookies__default.default.remove(this.storageKey);
6344
6432
  }
6345
6433
  return v;
6346
6434
  }
6347
6435
  get onMaya() {
6348
6436
  if (this.isServer) {
6349
- this.logger.warn("'localStorage' is not available on the server.");
6437
+ this.logger.warn("'client cookies' is not available on the server.");
6350
6438
  return false;
6351
6439
  }
6352
6440
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -6362,7 +6450,9 @@ var SessionManager = class {
6362
6450
  return typeof window === "undefined";
6363
6451
  }
6364
6452
  };
6365
- var SessionManagerCookie = class {
6453
+
6454
+ // src/sdk/session-manager.ts
6455
+ var SessionManager = class {
6366
6456
  logger;
6367
6457
  storageKey = "session";
6368
6458
  platformStorageKey = "session/platform";
@@ -6373,6 +6463,10 @@ var SessionManagerCookie = class {
6373
6463
  this.authService = config.authService;
6374
6464
  this.walletService = config.walletService;
6375
6465
  this.logger = config.logger;
6466
+ if (config.sessionPrefix) {
6467
+ this.storageKey = `${config.sessionPrefix}/${this.storageKey}`;
6468
+ this.platformStorageKey = `${config.sessionPrefix}/${this.platformStorageKey}`;
6469
+ }
6376
6470
  }
6377
6471
  get refreshing() {
6378
6472
  return this._refreshing;
@@ -6381,6 +6475,16 @@ var SessionManagerCookie = class {
6381
6475
  this._refreshing = value;
6382
6476
  }
6383
6477
  async create(input) {
6478
+ if (this.isServer) {
6479
+ this.logger.warn("'localStorage' is not available on the server.");
6480
+ return {
6481
+ ok: false,
6482
+ error: {
6483
+ name: "UnknownError",
6484
+ message: "Server sign in is not supported."
6485
+ }
6486
+ };
6487
+ }
6384
6488
  if (input.type === "MAYA") {
6385
6489
  localStorage.setItem(this.platformStorageKey, "MAYA");
6386
6490
  const f0 = () => this.walletService.mayaSession({ id: input.sessionId });
@@ -6407,14 +6511,13 @@ var SessionManagerCookie = class {
6407
6511
  })();
6408
6512
  if (!r1.ok) return r1;
6409
6513
  const now2 = /* @__PURE__ */ new Date();
6410
- cookies__default.default.set(
6514
+ localStorage.setItem(
6411
6515
  this.storageKey,
6412
6516
  JSON.stringify({
6413
6517
  ...r1.data,
6414
6518
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6415
6519
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6416
- }),
6417
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6520
+ })
6418
6521
  );
6419
6522
  return {
6420
6523
  ok: true,
@@ -6425,16 +6528,13 @@ var SessionManagerCookie = class {
6425
6528
  const res2 = await this.authService.createSession(input);
6426
6529
  if (res2.ok) {
6427
6530
  const now2 = /* @__PURE__ */ new Date();
6428
- cookies__default.default.set(
6531
+ localStorage.setItem(
6429
6532
  this.storageKey,
6430
6533
  JSON.stringify({
6431
6534
  ...res2.data,
6432
6535
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6433
6536
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6434
- }),
6435
- {
6436
- expires: subMinutes(addDays(now2, 30), 2).getTime()
6437
- }
6537
+ })
6438
6538
  );
6439
6539
  return {
6440
6540
  ok: true,
@@ -6446,18 +6546,18 @@ var SessionManagerCookie = class {
6446
6546
  if (input.type === "SOCIALS" || input.type === "TOKEN") {
6447
6547
  const res2 = await this.authService.createSession({
6448
6548
  type: "SOCIALS",
6449
- token: input.token
6549
+ token: input.token,
6550
+ channel: input.channel
6450
6551
  });
6451
6552
  if (res2.ok) {
6452
6553
  const now2 = /* @__PURE__ */ new Date();
6453
- cookies__default.default.set(
6554
+ localStorage.setItem(
6454
6555
  this.storageKey,
6455
6556
  JSON.stringify({
6456
6557
  ...res2.data,
6457
6558
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6458
6559
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6459
- }),
6460
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6560
+ })
6461
6561
  );
6462
6562
  return {
6463
6563
  ok: true,
@@ -6471,14 +6571,13 @@ var SessionManagerCookie = class {
6471
6571
  const res2 = await this.authService.createSession(input);
6472
6572
  if (res2.ok) {
6473
6573
  const now2 = /* @__PURE__ */ new Date();
6474
- cookies__default.default.set(
6574
+ localStorage.setItem(
6475
6575
  this.storageKey,
6476
6576
  JSON.stringify({
6477
6577
  ...res2.data,
6478
6578
  accessTokenExpiresAt: addMinutes(now2, 8).getTime(),
6479
6579
  refreshTokenExpiresAt: subMinutes(addDays(now2, 30), 2).getTime()
6480
- }),
6481
- { expires: subMinutes(addDays(now2, 30), 2).getTime() }
6580
+ })
6482
6581
  );
6483
6582
  return {
6484
6583
  ok: true,
@@ -6498,14 +6597,13 @@ var SessionManagerCookie = class {
6498
6597
  };
6499
6598
  }
6500
6599
  const now = /* @__PURE__ */ new Date();
6501
- cookies__default.default.set(
6600
+ localStorage.setItem(
6502
6601
  this.storageKey,
6503
6602
  JSON.stringify({
6504
6603
  ...res.data,
6505
6604
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6506
6605
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6507
- }),
6508
- {}
6606
+ })
6509
6607
  );
6510
6608
  return {
6511
6609
  ok: true,
@@ -6517,18 +6615,15 @@ var SessionManagerCookie = class {
6517
6615
  if (res.ok) {
6518
6616
  const now = /* @__PURE__ */ new Date();
6519
6617
  if (this.isServer) {
6520
- this.logger.warn("'client cookies' is not available on the server.");
6618
+ this.logger.warn("'localStorage' is not available on the server.");
6521
6619
  } else {
6522
- cookies__default.default.set(
6620
+ localStorage.setItem(
6523
6621
  this.storageKey,
6524
6622
  JSON.stringify({
6525
6623
  ...res.data,
6526
6624
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6527
6625
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6528
- }),
6529
- {
6530
- expires: subMinutes(addDays(now, 30), 2).getTime()
6531
- }
6626
+ })
6532
6627
  );
6533
6628
  }
6534
6629
  return { ok: true };
@@ -6538,7 +6633,7 @@ var SessionManagerCookie = class {
6538
6633
  }
6539
6634
  async get() {
6540
6635
  if (this.isServer) {
6541
- this.logger.warn("'client cookies' is not available on the server.");
6636
+ this.logger.warn("'localStorage' is not available on the server.");
6542
6637
  return {
6543
6638
  ok: true,
6544
6639
  data: null
@@ -6548,7 +6643,7 @@ var SessionManagerCookie = class {
6548
6643
  await sleep(1e3);
6549
6644
  return await this.get();
6550
6645
  }
6551
- const val = cookies__default.default.get(this.storageKey);
6646
+ const val = localStorage.getItem(this.storageKey);
6552
6647
  if (!val) {
6553
6648
  return {
6554
6649
  ok: true,
@@ -6562,7 +6657,7 @@ var SessionManagerCookie = class {
6562
6657
  const refreshTokenExpiresAt = new Date(obj.refreshTokenExpiresAt);
6563
6658
  if (isAfter(now, refreshTokenExpiresAt)) {
6564
6659
  this.logger.warn("Session expired. Logging out..");
6565
- cookies__default.default.remove(this.storageKey);
6660
+ localStorage.removeItem(this.storageKey);
6566
6661
  return {
6567
6662
  ok: false,
6568
6663
  error: {
@@ -6579,7 +6674,7 @@ var SessionManagerCookie = class {
6579
6674
  if (!res.ok) {
6580
6675
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6581
6676
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6582
- cookies__default.default.remove(this.storageKey);
6677
+ localStorage.removeItem(this.storageKey);
6583
6678
  return {
6584
6679
  ok: false,
6585
6680
  error: res.error
@@ -6600,9 +6695,7 @@ var SessionManagerCookie = class {
6600
6695
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6601
6696
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6602
6697
  };
6603
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6604
- expires: subMinutes(addDays(now, 30), 2).getTime()
6605
- });
6698
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
6606
6699
  }
6607
6700
  return {
6608
6701
  ok: true,
@@ -6620,13 +6713,13 @@ var SessionManagerCookie = class {
6620
6713
  }
6621
6714
  async refresh() {
6622
6715
  if (this.isServer) {
6623
- this.logger.warn("'client cookies' is not available on the server.");
6716
+ this.logger.warn("'localStorage' is not available on the server.");
6624
6717
  return {
6625
6718
  ok: true,
6626
6719
  data: null
6627
6720
  };
6628
6721
  }
6629
- const val = cookies__default.default.get(this.storageKey);
6722
+ const val = localStorage.getItem(this.storageKey);
6630
6723
  if (!val) {
6631
6724
  return {
6632
6725
  ok: true,
@@ -6643,7 +6736,7 @@ var SessionManagerCookie = class {
6643
6736
  if (!res.ok) {
6644
6737
  this.logger.error(`Failed to refresh session: ${res.error.message}`);
6645
6738
  if (res.error.name === "InvalidTokenError" || res.error.name === "AccountBlacklistedError" || res.error.name === "VerificationLockedError") {
6646
- cookies__default.default.remove(this.storageKey);
6739
+ localStorage.removeItem(this.storageKey);
6647
6740
  return {
6648
6741
  ok: false,
6649
6742
  error: res.error
@@ -6664,9 +6757,7 @@ var SessionManagerCookie = class {
6664
6757
  accessTokenExpiresAt: addMinutes(now, 8).getTime(),
6665
6758
  refreshTokenExpiresAt: subMinutes(addDays(now, 30), 2).getTime()
6666
6759
  };
6667
- cookies__default.default.set(this.storageKey, JSON.stringify(obj), {
6668
- expires: subMinutes(addDays(now, 30), 2).getTime()
6669
- });
6760
+ localStorage.setItem(this.storageKey, JSON.stringify(obj));
6670
6761
  return {
6671
6762
  ok: true,
6672
6763
  data: obj
@@ -6683,18 +6774,18 @@ var SessionManagerCookie = class {
6683
6774
  }
6684
6775
  async destroy() {
6685
6776
  if (this.isServer) {
6686
- this.logger.warn("'client cookies' is not available on the server.");
6777
+ this.logger.warn("'localStorage' is not available on the server.");
6687
6778
  return;
6688
6779
  }
6689
6780
  const res = await this.get();
6690
6781
  if (res.data?.accessToken) {
6691
6782
  await this.authService.destroySession(res.data.accessToken);
6692
6783
  }
6693
- cookies__default.default.remove(this.storageKey);
6784
+ localStorage.removeItem(this.storageKey);
6694
6785
  }
6695
6786
  async verify() {
6696
6787
  if (this.isServer) {
6697
- this.logger.warn("'client cookies' is not available on the server.");
6788
+ this.logger.warn("'localStorage' is not available on the server.");
6698
6789
  return true;
6699
6790
  }
6700
6791
  const s = await this.get();
@@ -6704,13 +6795,13 @@ var SessionManagerCookie = class {
6704
6795
  if (!s.data) return true;
6705
6796
  const v = await this.authService.verifySession(s.data.accessToken);
6706
6797
  if (!v) {
6707
- cookies__default.default.remove(this.storageKey);
6798
+ localStorage.removeItem(this.storageKey);
6708
6799
  }
6709
6800
  return v;
6710
6801
  }
6711
6802
  get onMaya() {
6712
6803
  if (this.isServer) {
6713
- this.logger.warn("'client cookies' is not available on the server.");
6804
+ this.logger.warn("'localStorage' is not available on the server.");
6714
6805
  return false;
6715
6806
  }
6716
6807
  return localStorage.getItem(this.platformStorageKey) === "MAYA";
@@ -6824,7 +6915,8 @@ var Transformer = class {
6824
6915
  memberLevelSettings: this.memberLevelSettings.bind(this),
6825
6916
  achievementSettings: this.achievementSettings.bind(this),
6826
6917
  achievementPointsHistoryRecord: this.achievementPointsHistoryRecord.bind(this),
6827
- memberAchievements: this.memberAchievements.bind(this)
6918
+ memberAchievements: this.memberAchievements.bind(this),
6919
+ memberVerificationRequest: this.memberVerificationRequest.bind(this)
6828
6920
  };
6829
6921
  }
6830
6922
  site(data) {
@@ -8276,6 +8368,34 @@ var Transformer = class {
8276
8368
  };
8277
8369
  return compact(o);
8278
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
+ }
8279
8399
  };
8280
8400
 
8281
8401
  // src/sdk/sdk.ts
@@ -10460,16 +10580,50 @@ var Sdk = class {
10460
10580
  data: res.data ?? false
10461
10581
  };
10462
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
+ }
10463
10616
  /*
10464
10617
  *=============================================
10465
10618
  * UTILS
10466
10619
  *=============================================
10467
10620
  */
10468
10621
  formatYmd(date) {
10622
+ const date_ = date instanceof Date ? date : new Date(date);
10469
10623
  const ensure2Digits = (n) => n.toString().padStart(2, "0");
10470
- const y = date.getFullYear();
10471
- const m = ensure2Digits(date.getMonth() + 1);
10472
- const d = ensure2Digits(date.getDate());
10624
+ const y = date_.getFullYear();
10625
+ const m = ensure2Digits(date_.getMonth() + 1);
10626
+ const d = ensure2Digits(date_.getDate());
10473
10627
  return `${y}-${m}-${d}`;
10474
10628
  }
10475
10629
  };