@dynamic-labs/sdk-react-core 0.18.0-RC.15 → 0.18.0-RC.16

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,17 @@
1
1
 
2
+ ## [0.18.0-RC.16](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.15...v0.18.0-RC.16) (2023-07-18)
3
+
4
+
5
+ ### Features
6
+
7
+ * **QNTM-30:** add spinner to log out button ([#2663](https://github.com/dynamic-labs/DynamicAuth/issues/2663)) ([fceafbb](https://github.com/dynamic-labs/DynamicAuth/commit/fceafbb6fecf323df39ac3a8f518ba8005d4b550))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * handle edge cases for missing projectSettings for PoweredByDynamic ([#2684](https://github.com/dynamic-labs/DynamicAuth/issues/2684)) ([6f5b3d8](https://github.com/dynamic-labs/DynamicAuth/commit/6f5b3d8d1b1d4aed0dd2e73e5423f6e50347ff3d))
13
+ * typo in blocked view ([#2673](https://github.com/dynamic-labs/DynamicAuth/issues/2673)) ([034bdaf](https://github.com/dynamic-labs/DynamicAuth/commit/034bdafb44b767600ea7c0148f39dd026280e3b8))
14
+
2
15
  ## [0.18.0-RC.15](https://github.com/dynamic-labs/DynamicAuth/compare/v0.18.0-RC.14...v0.18.0-RC.15) (2023-07-18)
3
16
 
4
17
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.18.0-RC.15";
5
+ var version = "0.18.0-RC.16";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "2.9.2",
8
8
  "@dynamic-labs/iconic": "0.1.23",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.18.0-RC.15";
1
+ var version = "0.18.0-RC.16";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "2.9.2",
4
4
  "@dynamic-labs/iconic": "0.1.23",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.18.0-RC.15",
3
+ "version": "0.18.0-RC.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -16,13 +16,13 @@
16
16
  "formik": "2.2.9",
17
17
  "qrcode": "1.5.1",
18
18
  "ethers": "5.7.2",
19
- "@dynamic-labs/logger": "0.18.0-RC.15",
20
- "@dynamic-labs/multi-wallet": "0.18.0-RC.15",
21
- "@dynamic-labs/rpc-providers": "0.18.0-RC.15",
22
- "@dynamic-labs/types": "0.18.0-RC.15",
23
- "@dynamic-labs/utils": "0.18.0-RC.15",
24
- "@dynamic-labs/wallet-book": "0.18.0-RC.15",
25
- "@dynamic-labs/wallet-connector-core": "0.18.0-RC.15"
19
+ "@dynamic-labs/logger": "0.18.0-RC.16",
20
+ "@dynamic-labs/multi-wallet": "0.18.0-RC.16",
21
+ "@dynamic-labs/rpc-providers": "0.18.0-RC.16",
22
+ "@dynamic-labs/types": "0.18.0-RC.16",
23
+ "@dynamic-labs/utils": "0.18.0-RC.16",
24
+ "@dynamic-labs/wallet-book": "0.18.0-RC.16",
25
+ "@dynamic-labs/wallet-connector-core": "0.18.0-RC.16"
26
26
  },
27
27
  "devDependencies": {
28
28
  "semver": "7.3.8"
@@ -2,14 +2,15 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _tslib = require('../../../../_virtual/_tslib.cjs');
5
6
  var jsxRuntime = require('react/jsx-runtime');
7
+ var React = require('react');
6
8
  var useInternalDynamicContext = require('../../context/DynamicContext/useInternalDynamicContext.cjs');
7
9
  require('@dynamic-labs/sdk-api');
8
- require('../../shared/logger.cjs');
10
+ var logger = require('../../shared/logger.cjs');
9
11
  require('@dynamic-labs/iconic');
10
12
  require('@dynamic-labs/wallet-connector-core');
11
13
  require('../../context/ViewContext/ViewContext.cjs');
12
- require('react');
13
14
  var logout = require('../../shared/assets/logout.cjs');
14
15
  require('@dynamic-labs/wallet-book');
15
16
  require('@dynamic-labs/utils');
@@ -20,8 +21,21 @@ require('../../shared/consts/index.cjs');
20
21
  var Button = require('../Button/Button.cjs');
21
22
 
22
23
  const LogoutButton = ({ buttonClassName = '', isTextButton = false, }) => {
24
+ const [loading, setLoading] = React.useState(false);
23
25
  const { handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
24
- return (jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: buttonClassName, buttonVariant: 'tertiary', buttonRounded: 'small', buttonPadding: isTextButton ? 'none' : 'medium', onClick: handleLogOut, typographyProps: isTextButton
26
+ const onLogOutClick = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
27
+ try {
28
+ setLoading(true);
29
+ yield handleLogOut();
30
+ }
31
+ catch (e) {
32
+ logger.logger.error(e);
33
+ }
34
+ finally {
35
+ setLoading(false);
36
+ }
37
+ });
38
+ return (jsxRuntime.jsx(Button.Button, Object.assign({ buttonClassName: buttonClassName, buttonVariant: 'tertiary', buttonRounded: 'small', buttonPadding: isTextButton ? 'none' : 'medium', loading: loading, disabled: loading, onClick: onLogOutClick, typographyProps: isTextButton
25
39
  ? { color: 'secondary', variant: 'button_tertiary' }
26
40
  : { color: 'primary', variant: 'button_secondary' }, dataTestId: 'logout-button', startSlot: isTextButton ? jsxRuntime.jsx(logout.ReactComponent, {}) : undefined, expanded: !isTextButton, type: 'button' }, { children: "Log out" })));
27
41
  };
@@ -1,11 +1,12 @@
1
+ import { __awaiter } from '../../../../_virtual/_tslib.js';
1
2
  import { jsx } from 'react/jsx-runtime';
3
+ import { useState } from 'react';
2
4
  import { useInternalDynamicContext } from '../../context/DynamicContext/useInternalDynamicContext.js';
3
5
  import '@dynamic-labs/sdk-api';
4
- import '../../shared/logger.js';
6
+ import { logger } from '../../shared/logger.js';
5
7
  import '@dynamic-labs/iconic';
6
8
  import '@dynamic-labs/wallet-connector-core';
7
9
  import '../../context/ViewContext/ViewContext.js';
8
- import 'react';
9
10
  import { ReactComponent as SvgLogout } from '../../shared/assets/logout.js';
10
11
  import '@dynamic-labs/wallet-book';
11
12
  import '@dynamic-labs/utils';
@@ -16,8 +17,21 @@ import '../../shared/consts/index.js';
16
17
  import { Button } from '../Button/Button.js';
17
18
 
18
19
  const LogoutButton = ({ buttonClassName = '', isTextButton = false, }) => {
20
+ const [loading, setLoading] = useState(false);
19
21
  const { handleLogOut } = useInternalDynamicContext();
20
- return (jsx(Button, Object.assign({ buttonClassName: buttonClassName, buttonVariant: 'tertiary', buttonRounded: 'small', buttonPadding: isTextButton ? 'none' : 'medium', onClick: handleLogOut, typographyProps: isTextButton
22
+ const onLogOutClick = () => __awaiter(void 0, void 0, void 0, function* () {
23
+ try {
24
+ setLoading(true);
25
+ yield handleLogOut();
26
+ }
27
+ catch (e) {
28
+ logger.error(e);
29
+ }
30
+ finally {
31
+ setLoading(false);
32
+ }
33
+ });
34
+ return (jsx(Button, Object.assign({ buttonClassName: buttonClassName, buttonVariant: 'tertiary', buttonRounded: 'small', buttonPadding: isTextButton ? 'none' : 'medium', loading: loading, disabled: loading, onClick: onLogOutClick, typographyProps: isTextButton
21
35
  ? { color: 'secondary', variant: 'button_tertiary' }
22
36
  : { color: 'primary', variant: 'button_secondary' }, dataTestId: 'logout-button', startSlot: isTextButton ? jsx(SvgLogout, {}) : undefined, expanded: !isTextButton, type: 'button' }, { children: "Log out" })));
23
37
  };
@@ -15,8 +15,9 @@ const alignClassNames = {
15
15
  right: 'powered-by-dynamic--right',
16
16
  };
17
17
  const PoweredByDynamic = ({ align = 'center', classNameLogo, classNameRoot, classNameText, }) => {
18
+ var _a;
18
19
  const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
19
- if ((projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.displayDynamicMessaging) === false) {
20
+ if (((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.displayDynamicMessaging) === false) {
20
21
  return null;
21
22
  }
22
23
  return (jsxRuntime.jsxs("a", Object.assign({ target: '_blank', href: URL, className: classNames.classNames('powered-by-dynamic', alignClassNames[align], classNameRoot), rel: 'noreferrer' }, { children: [jsxRuntime.jsx(Typography.Typography, Object.assign({ as: 'span', color: 'secondary', weight: 'regular', variant: 'body_mini', className: classNames.classNames('powered-by-dynamic__text', classNameText) }, { children: "Powered by" })), jsxRuntime.jsx(dynamicLogo.ReactComponent, { className: classNames.classNames('powered-by-dynamic__logo', classNameLogo) })] })));
@@ -11,8 +11,9 @@ const alignClassNames = {
11
11
  right: 'powered-by-dynamic--right',
12
12
  };
13
13
  const PoweredByDynamic = ({ align = 'center', classNameLogo, classNameRoot, classNameText, }) => {
14
+ var _a;
14
15
  const { projectSettings } = useInternalDynamicContext();
15
- if ((projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.displayDynamicMessaging) === false) {
16
+ if (((_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.displayDynamicMessaging) === false) {
16
17
  return null;
17
18
  }
18
19
  return (jsxs("a", Object.assign({ target: '_blank', href: URL, className: classNames('powered-by-dynamic', alignClassNames[align], classNameRoot), rel: 'noreferrer' }, { children: [jsx(Typography, Object.assign({ as: 'span', color: 'secondary', weight: 'regular', variant: 'body_mini', className: classNames('powered-by-dynamic__text', classNameText) }, { children: "Powered by" })), jsx(SvgDynamicLogo, { className: classNames('powered-by-dynamic__logo', classNameLogo) })] })));
@@ -84,7 +84,7 @@ const textData = {
84
84
  _socialMediaLinkText: undefined,
85
85
  _socialMediaUrl: undefined,
86
86
  buttonTitle: 'Try a different wallet',
87
- subtitle: 'An NFT or a token is required to access this site.',
87
+ subtitle: 'A NFT or a token is required to access this site.',
88
88
  title: 'You cannot access the site',
89
89
  },
90
90
  };
@@ -80,7 +80,7 @@ const textData = {
80
80
  _socialMediaLinkText: undefined,
81
81
  _socialMediaUrl: undefined,
82
82
  buttonTitle: 'Try a different wallet',
83
- subtitle: 'An NFT or a token is required to access this site.',
83
+ subtitle: 'A NFT or a token is required to access this site.',
84
84
  title: 'You cannot access the site',
85
85
  },
86
86
  };