@dynamic-labs/sdk-react-core 0.16.19 → 0.16.21

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/CHANGELOG.md CHANGED
@@ -1,4 +1,18 @@
1
1
 
2
+ ### [0.16.21](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.20...v0.16.21) (2023-06-05)
3
+
4
+
5
+ ### Features
6
+
7
+ * disable button on social unlink ([#2247](https://github.com/dynamic-labs/DynamicAuth/issues/2247)) ([e74a53c](https://github.com/dynamic-labs/DynamicAuth/commit/e74a53c947fdbeca66144b65dc6babdd449c9240))
8
+
9
+ ### [0.16.20](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.19...v0.16.20) (2023-06-02)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * flow connection status improvements ([#2212](https://github.com/dynamic-labs/DynamicAuth/issues/2212)) ([#2218](https://github.com/dynamic-labs/DynamicAuth/issues/2218)) ([8c3f9b3](https://github.com/dynamic-labs/DynamicAuth/commit/8c3f9b34b673d252cd696d271e8ee5a0457b2213))
15
+
2
16
  ### [0.16.19](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.18...v0.16.19) (2023-06-01)
3
17
 
4
18
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.16.19";
5
+ var version = "0.16.21";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "^2.9.2",
8
8
  "@dynamic-labs/sdk-api": "0.0.174",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.16.19";
1
+ var version = "0.16.21";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "^2.9.2",
4
4
  "@dynamic-labs/sdk-api": "0.0.174",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.16.19",
3
+ "version": "0.16.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -17,9 +17,9 @@
17
17
  "formik": "^2.2.9",
18
18
  "qrcode": "1.5.1",
19
19
  "ethers": "^5.7.2",
20
- "@dynamic-labs/logger": "0.16.19",
21
- "@dynamic-labs/multi-wallet": "0.16.19",
22
- "@dynamic-labs/wallet-connector-core": "0.16.19"
20
+ "@dynamic-labs/logger": "0.16.21",
21
+ "@dynamic-labs/multi-wallet": "0.16.21",
22
+ "@dynamic-labs/wallet-connector-core": "0.16.21"
23
23
  },
24
24
  "devDependencies": {
25
25
  "semver": "^7.3.8"
@@ -8,7 +8,7 @@ var React = require('react');
8
8
  var iconic = require('@dynamic-labs/iconic');
9
9
  var Typography = require('../../../Typography/Typography.cjs');
10
10
  require('@dynamic-labs/sdk-api');
11
- require('../../../../shared/logger.cjs');
11
+ var logger = require('../../../../shared/logger.cjs');
12
12
  require('@dynamic-labs/multi-wallet');
13
13
  require('../../../../context/ViewContext/ViewContext.cjs');
14
14
  var add = require('../../../../shared/assets/add.cjs');
@@ -71,14 +71,23 @@ const UserProfileSocialAccount = ({ provider, authorizationUrl, verifiedCredenti
71
71
  };
72
72
  const disconnectAccount = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
73
73
  var _c;
74
- const jwt = yield api.unlinkOAuth({
75
- environmentId,
76
- verifiedCrentialId: (_c = verifiedCredential === null || verifiedCredential === void 0 ? void 0 : verifiedCredential.id) !== null && _c !== void 0 ? _c : '',
77
- }, String(authToken || onboardingOnlyJwt));
78
- if (!jwt) {
79
- return;
74
+ try {
75
+ setLoading(true);
76
+ const jwt = yield api.unlinkOAuth({
77
+ environmentId,
78
+ verifiedCrentialId: (_c = verifiedCredential === null || verifiedCredential === void 0 ? void 0 : verifiedCredential.id) !== null && _c !== void 0 ? _c : '',
79
+ }, String(authToken || onboardingOnlyJwt));
80
+ if (!jwt) {
81
+ return;
82
+ }
83
+ updateUserProfileByJWT(jwt);
84
+ }
85
+ catch (err) {
86
+ logger.logger.error(err);
87
+ }
88
+ finally {
89
+ setLoading(false);
80
90
  }
81
- updateUserProfileByJWT(jwt);
82
91
  });
83
92
  if (!verifiedCredential && !authorizationUrl) {
84
93
  return null;
@@ -4,7 +4,7 @@ import { useState } from 'react';
4
4
  import { SocialIcon } from '@dynamic-labs/iconic';
5
5
  import { Typography } from '../../../Typography/Typography.js';
6
6
  import '@dynamic-labs/sdk-api';
7
- import '../../../../shared/logger.js';
7
+ import { logger } from '../../../../shared/logger.js';
8
8
  import '@dynamic-labs/multi-wallet';
9
9
  import '../../../../context/ViewContext/ViewContext.js';
10
10
  import { ReactComponent as SvgAdd } from '../../../../shared/assets/add.js';
@@ -67,14 +67,23 @@ const UserProfileSocialAccount = ({ provider, authorizationUrl, verifiedCredenti
67
67
  };
68
68
  const disconnectAccount = () => __awaiter(void 0, void 0, void 0, function* () {
69
69
  var _c;
70
- const jwt = yield unlinkOAuth({
71
- environmentId,
72
- verifiedCrentialId: (_c = verifiedCredential === null || verifiedCredential === void 0 ? void 0 : verifiedCredential.id) !== null && _c !== void 0 ? _c : '',
73
- }, String(authToken || onboardingOnlyJwt));
74
- if (!jwt) {
75
- return;
70
+ try {
71
+ setLoading(true);
72
+ const jwt = yield unlinkOAuth({
73
+ environmentId,
74
+ verifiedCrentialId: (_c = verifiedCredential === null || verifiedCredential === void 0 ? void 0 : verifiedCredential.id) !== null && _c !== void 0 ? _c : '',
75
+ }, String(authToken || onboardingOnlyJwt));
76
+ if (!jwt) {
77
+ return;
78
+ }
79
+ updateUserProfileByJWT(jwt);
80
+ }
81
+ catch (err) {
82
+ logger.error(err);
83
+ }
84
+ finally {
85
+ setLoading(false);
76
86
  }
77
- updateUserProfileByJWT(jwt);
78
87
  });
79
88
  if (!verifiedCredential && !authorizationUrl) {
80
89
  return null;
@@ -41,7 +41,7 @@ const Wallet = ({ setNewWalletId, wallet, ens }) => {
41
41
  const walletPublicKey = wallet.address;
42
42
  const walletId = wallet.id;
43
43
  const { connector } = wallet;
44
- const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, } = useInternalDynamicContext.useInternalDynamicContext();
44
+ const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, primaryWallet, } = useInternalDynamicContext.useInternalDynamicContext();
45
45
  const { setWalletIdToUnlink } = DynamicWidgetContext.useWidgetContext();
46
46
  const iconSize = 20;
47
47
  const options = [
@@ -69,8 +69,9 @@ const Wallet = ({ setNewWalletId, wallet, ens }) => {
69
69
  });
70
70
  const onSelectWalletClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
71
71
  var _a, _b;
72
- if (wallet.connector.connectedChain === 'FLOW') {
73
- (_b = (_a = wallet.connector).endSession) === null || _b === void 0 ? void 0 : _b.call(_a);
72
+ if ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) === 'flow' &&
73
+ wallet.connector.connectedChain === 'FLOW') {
74
+ yield ((_b = (_a = wallet.connector).endSession) === null || _b === void 0 ? void 0 : _b.call(_a));
74
75
  }
75
76
  setNewWalletId === null || setNewWalletId === void 0 ? void 0 : setNewWalletId(walletId);
76
77
  setPrimaryWallet(walletId);
@@ -37,7 +37,7 @@ const Wallet = ({ setNewWalletId, wallet, ens }) => {
37
37
  const walletPublicKey = wallet.address;
38
38
  const walletId = wallet.id;
39
39
  const { connector } = wallet;
40
- const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, } = useInternalDynamicContext();
40
+ const { computeConnectedStateForWallets, setPrimaryWallet, setSelectedWalletConnector, primaryWallet, } = useInternalDynamicContext();
41
41
  const { setWalletIdToUnlink } = useWidgetContext();
42
42
  const iconSize = 20;
43
43
  const options = [
@@ -65,8 +65,9 @@ const Wallet = ({ setNewWalletId, wallet, ens }) => {
65
65
  });
66
66
  const onSelectWalletClick = () => __awaiter(void 0, void 0, void 0, function* () {
67
67
  var _a, _b;
68
- if (wallet.connector.connectedChain === 'FLOW') {
69
- (_b = (_a = wallet.connector).endSession) === null || _b === void 0 ? void 0 : _b.call(_a);
68
+ if ((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) === 'flow' &&
69
+ wallet.connector.connectedChain === 'FLOW') {
70
+ yield ((_b = (_a = wallet.connector).endSession) === null || _b === void 0 ? void 0 : _b.call(_a));
70
71
  }
71
72
  setNewWalletId === null || setNewWalletId === void 0 ? void 0 : setNewWalletId(walletId);
72
73
  setPrimaryWallet(walletId);