@huma-finance/widgets 0.0.41 → 0.0.42-beta.76

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.
@@ -4129,6 +4129,10 @@ var _templateObject$6, _templateObject2$4;
4129
4129
  var KYCProvider = 'Securitize';
4130
4130
  // TODO: Add copies for the other pools. Currently only the Jia pool is using the KYC process.
4131
4131
  var JiaPoolCopies = {
4132
+ signInRequired: {
4133
+ title: 'Sign In',
4134
+ description: 'Please sign in to verify that you are the owner of the wallet.'
4135
+ },
4132
4136
  verifyIdentity: {
4133
4137
  title: 'Verify Identity',
4134
4138
  description: "This pool is only available to accredited investors at the moment, with minimum investments of $10,000. Please complete identity verification and investor accreditation via ".concat(KYCProvider, "."),
@@ -4171,6 +4175,9 @@ function EvaluationKYC(_ref) {
4171
4175
  kycProvider = _useParamsSearch.kycProvider,
4172
4176
  code = _useParamsSearch.code,
4173
4177
  kycPool = _useParamsSearch.kycPool;
4178
+ var _useAuthErrorHandling = shared.useAuthErrorHandling(account, chainId, isDev),
4179
+ isWalletOwnershipVerified = _useAuthErrorHandling.isWalletOwnershipVerified,
4180
+ setAuthError = _useAuthErrorHandling.setError;
4174
4181
  var _useState = React.useState(),
4175
4182
  _useState2 = _slicedToArray(_useState, 2),
4176
4183
  loadingType = _useState2[0],
@@ -4250,8 +4257,13 @@ function EvaluationKYC(_ref) {
4250
4257
  case 7:
4251
4258
  _context.prev = 7;
4252
4259
  _context.t0 = _context["catch"](0);
4253
- // The repeated call will throw an error of 401, so we can ignore it.
4254
- console.error(_context.t0);
4260
+ try {
4261
+ setAuthError(_context.t0);
4262
+ setKYCCopy(JiaPoolCopies.signInRequired);
4263
+ } catch (e) {
4264
+ // The repeated call will throw an error of 401, so we can ignore it.
4265
+ console.log(e);
4266
+ }
4255
4267
  case 10:
4256
4268
  _context.prev = 10;
4257
4269
  if (!(account && chainId)) {
@@ -4304,34 +4316,39 @@ function EvaluationKYC(_ref) {
4304
4316
  setKYCCopy(JiaPoolCopies.resendSignatureLink);
4305
4317
  }
4306
4318
  case 35:
4307
- _context.next = 41;
4319
+ _context.next = 40;
4308
4320
  break;
4309
4321
  case 37:
4310
4322
  _context.prev = 37;
4311
4323
  _context.t1 = _context["catch"](10);
4312
- console.error(_context.t1);
4313
- dispatch(setError({
4314
- errorMessage: 'Something went wrong, please try again later.'
4315
- }));
4316
- case 41:
4317
- _context.prev = 41;
4324
+ try {
4325
+ setAuthError(_context.t1);
4326
+ setKYCCopy(JiaPoolCopies.signInRequired);
4327
+ } catch (e) {
4328
+ console.error(e);
4329
+ dispatch(setError({
4330
+ errorMessage: 'Something went wrong, please try again later.'
4331
+ }));
4332
+ }
4333
+ case 40:
4334
+ _context.prev = 40;
4318
4335
  setLoadingType(undefined);
4319
- return _context.finish(41);
4320
- case 44:
4336
+ return _context.finish(40);
4337
+ case 43:
4321
4338
  case "end":
4322
4339
  return _context.stop();
4323
4340
  }
4324
- }, _callee, null, [[0, 7], [10, 37, 41, 44]]);
4341
+ }, _callee, null, [[0, 7], [10, 37, 40, 43]]);
4325
4342
  }));
4326
4343
  return function fetchData() {
4327
4344
  return _ref2.apply(this, arguments);
4328
4345
  };
4329
4346
  }();
4330
4347
  fetchData();
4331
- }, [account, chainId, checkGetDocSignatureStatusIsAvailable, code, dispatch, envelopeDocuSignStatusKey, envelopeKey, envelopeLastQueryTimeKey, isDev, kycPool, kycProvider, poolInfo.pool]);
4348
+ }, [account, chainId, checkGetDocSignatureStatusIsAvailable, code, dispatch, envelopeDocuSignStatusKey, envelopeKey, envelopeLastQueryTimeKey, isDev, kycPool, kycProvider, poolInfo.pool, setAuthError, isWalletOwnershipVerified]);
4332
4349
  var approveLender = /*#__PURE__*/function () {
4333
4350
  var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
4334
- var _ref4, isNotOnboarded, isVerified, issuerId, baseUrl, originUrl, redirectUrl, providerAuthorizeUrl, envelopeId, _yield$IdentityServic2, _envelopeId;
4351
+ var _ref4, isNotOnboarded, isVerified, issuerId, baseUrl, originUrl, redirectUrl, providerAuthorizeUrl, envelopeId, _yield$IdentityServic2, _envelopeId, _yield$IdentityServic3, _envelopeId2;
4335
4352
  return regenerator.wrap(function _callee2$(_context2) {
4336
4353
  while (1) switch (_context2.prev = _context2.next) {
4337
4354
  case 0:
@@ -4353,7 +4370,7 @@ function EvaluationKYC(_ref) {
4353
4370
  redirectUrl = "".concat(originUrl, "?poolName=").concat(poolInfo.poolName, "&kycProvider=").concat(KYCProvider, "&kycPool=").concat(poolInfo.pool);
4354
4371
  providerAuthorizeUrl = "".concat(baseUrl, "/#/authorize?issuerId=").concat(issuerId, "&scope=details&details=verification&redirectUrl=").concat(redirectUrl);
4355
4372
  window.location.href = isNotOnboarded ? providerAuthorizeUrl : baseUrl;
4356
- _context2.next = 39;
4373
+ _context2.next = 52;
4357
4374
  break;
4358
4375
  case 13:
4359
4376
  envelopeId = localStorage.getItem(envelopeKey);
@@ -4380,24 +4397,37 @@ function EvaluationKYC(_ref) {
4380
4397
  case 29:
4381
4398
  setOpenSnackBar(true);
4382
4399
  case 30:
4383
- _context2.next = 36;
4400
+ _context2.next = 49;
4384
4401
  break;
4385
4402
  case 32:
4386
4403
  _context2.prev = 32;
4387
4404
  _context2.t0 = _context2["catch"](14);
4388
- console.error(_context2.t0);
4389
- dispatch(setError({
4390
- errorMessage: 'Something went wrong, please try again later.'
4391
- }));
4392
- case 36:
4393
- _context2.prev = 36;
4405
+ _context2.prev = 34;
4406
+ _context2.next = 37;
4407
+ return shared.IdentityService.requestDocSignature(account, chainId, isDev);
4408
+ case 37:
4409
+ _yield$IdentityServic3 = _context2.sent;
4410
+ _envelopeId2 = _yield$IdentityServic3.envelopeId;
4411
+ localStorage.setItem(envelopeKey, _envelopeId2);
4412
+ localStorage.setItem(envelopeLastQueryTimeKey, String(shared.timeUtil.getUnixTimestamp()));
4413
+ setOpenSnackBar(true);
4414
+ setKYCCopy(JiaPoolCopies.resendSignatureLink);
4415
+ _context2.next = 49;
4416
+ break;
4417
+ case 45:
4418
+ _context2.prev = 45;
4419
+ _context2.t1 = _context2["catch"](34);
4420
+ setAuthError(_context2.t1);
4421
+ setKYCCopy(JiaPoolCopies.signInRequired);
4422
+ case 49:
4423
+ _context2.prev = 49;
4394
4424
  setLoadingType(undefined);
4395
- return _context2.finish(36);
4396
- case 39:
4425
+ return _context2.finish(49);
4426
+ case 52:
4397
4427
  case "end":
4398
4428
  return _context2.stop();
4399
4429
  }
4400
- }, _callee2, null, [[14, 32, 36, 39]]);
4430
+ }, _callee2, null, [[14, 32, 49, 52], [34, 45]]);
4401
4431
  }));
4402
4432
  return function approveLender() {
4403
4433
  return _ref3.apply(this, arguments);
@@ -4426,7 +4456,7 @@ function EvaluationKYC(_ref) {
4426
4456
  }), jsxRuntime.jsx(material.Box, {
4427
4457
  css: styles.description,
4428
4458
  children: kycCopy.description
4429
- }), jsxRuntime.jsx(BottomButton, {
4459
+ }), Boolean(kycCopy.buttonText) && jsxRuntime.jsx(BottomButton, {
4430
4460
  variant: "contained",
4431
4461
  onClick: approveLender,
4432
4462
  children: kycCopy.buttonText