@dynamic-labs/sdk-react-core 3.0.0-alpha.20 → 3.0.0-alpha.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,12 @@
1
1
 
2
+ ## [3.0.0-alpha.21](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.20...v3.0.0-alpha.21) (2024-07-17)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * invalid email error appears ([#6348](https://github.com/dynamic-labs/DynamicAuth/issues/6348)) ([01bcfd2](https://github.com/dynamic-labs/DynamicAuth/commit/01bcfd2f3cc37083c47c0f26e3398f974f6b6a17))
8
+ * stop unnecessary phantom btc popup when disconnecting ([#6188](https://github.com/dynamic-labs/DynamicAuth/issues/6188)) ([15c2eb5](https://github.com/dynamic-labs/DynamicAuth/commit/15c2eb5da90be93ab917e7c61a873a0e9a568211))
9
+
2
10
  ## [3.0.0-alpha.20](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.19...v3.0.0-alpha.20) (2024-07-15)
3
11
 
4
12
 
package/package.cjs CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "3.0.0-alpha.20";
6
+ var version = "3.0.0-alpha.21";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.0.470",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- var version = "3.0.0-alpha.20";
2
+ var version = "3.0.0-alpha.21";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.0.470",
5
5
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "3.0.0-alpha.20",
3
+ "version": "3.0.0-alpha.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -17,15 +17,15 @@
17
17
  "react-i18next": "13.5.0",
18
18
  "yup": "0.32.11",
19
19
  "react-international-phone": "4.2.5",
20
- "@dynamic-labs/iconic": "3.0.0-alpha.20",
21
- "@dynamic-labs/logger": "3.0.0-alpha.20",
22
- "@dynamic-labs/multi-wallet": "3.0.0-alpha.20",
23
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.20",
24
- "@dynamic-labs/store": "3.0.0-alpha.20",
25
- "@dynamic-labs/types": "3.0.0-alpha.20",
26
- "@dynamic-labs/utils": "3.0.0-alpha.20",
27
- "@dynamic-labs/wallet-book": "3.0.0-alpha.20",
28
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.20",
20
+ "@dynamic-labs/iconic": "3.0.0-alpha.21",
21
+ "@dynamic-labs/logger": "3.0.0-alpha.21",
22
+ "@dynamic-labs/multi-wallet": "3.0.0-alpha.21",
23
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.21",
24
+ "@dynamic-labs/store": "3.0.0-alpha.21",
25
+ "@dynamic-labs/types": "3.0.0-alpha.21",
26
+ "@dynamic-labs/utils": "3.0.0-alpha.21",
27
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.21",
28
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.21",
29
29
  "eventemitter3": "5.0.1"
30
30
  },
31
31
  "devDependencies": {
@@ -94,7 +94,6 @@ require('qrcode');
94
94
  const EmailForm = ({ isLoading, onSubmit, isEmailInvalid = false, currentEmail, emailSubmitButtonInsideInput = false, buttonCopyKey = 'dyn_login.email_form.submit_button.label', isDisabled = false, className, style, }) => {
95
95
  const { t } = reactI18next.useTranslation();
96
96
  const [emailInput, setEmailInput] = React.useState(currentEmail !== null && currentEmail !== void 0 ? currentEmail : '');
97
- const [invalidEmail, setInvalidEmail] = React.useState(isEmailInvalid);
98
97
  /** Indicates the state of the input relative to the user's interaction */
99
98
  const [isHovered, setIsHovered] = React.useState(false);
100
99
  const [isFocused, setIsFocused] = React.useState(false);
@@ -105,12 +104,11 @@ const EmailForm = ({ isLoading, onSubmit, isEmailInvalid = false, currentEmail,
105
104
  const handleSubmit = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
106
105
  e.preventDefault();
107
106
  if (!isEmailValid.isEmailValid(emailInput)) {
108
- setInvalidEmail(true);
109
107
  return;
110
108
  }
111
109
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(emailInput);
112
110
  });
113
- return (jsxRuntime.jsxs("form", { className: classNames.classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: jsxRuntime.jsx(InlineSubmitButton.InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), autoComplete: 'email' }), !emailSubmitButtonInsideInput && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
111
+ return (jsxRuntime.jsxs("form", { className: classNames.classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsxRuntime.jsx(Input.Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: isEmailInvalid, message: isEmailInvalid && t('dyn_login.helper.email_form.invalid_email'), suffix: jsxRuntime.jsx(InlineSubmitButton.InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), autoComplete: 'email' }), !emailSubmitButtonInsideInput && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
114
112
  color: 'inherit',
115
113
  }, children: t(buttonCopyKey) }))] }));
116
114
  };
@@ -90,7 +90,6 @@ import 'qrcode';
90
90
  const EmailForm = ({ isLoading, onSubmit, isEmailInvalid = false, currentEmail, emailSubmitButtonInsideInput = false, buttonCopyKey = 'dyn_login.email_form.submit_button.label', isDisabled = false, className, style, }) => {
91
91
  const { t } = useTranslation();
92
92
  const [emailInput, setEmailInput] = useState(currentEmail !== null && currentEmail !== void 0 ? currentEmail : '');
93
- const [invalidEmail, setInvalidEmail] = useState(isEmailInvalid);
94
93
  /** Indicates the state of the input relative to the user's interaction */
95
94
  const [isHovered, setIsHovered] = useState(false);
96
95
  const [isFocused, setIsFocused] = useState(false);
@@ -101,12 +100,11 @@ const EmailForm = ({ isLoading, onSubmit, isEmailInvalid = false, currentEmail,
101
100
  const handleSubmit = (e) => __awaiter(void 0, void 0, void 0, function* () {
102
101
  e.preventDefault();
103
102
  if (!isEmailValid(emailInput)) {
104
- setInvalidEmail(true);
105
103
  return;
106
104
  }
107
105
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(emailInput);
108
106
  });
109
- return (jsxs("form", { className: classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsx(Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: invalidEmail, message: invalidEmail && t('dyn_login.helper.email_form.invalid_email'), suffix: jsx(InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), autoComplete: 'email' }), !emailSubmitButtonInsideInput && (jsx(TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
107
+ return (jsxs("form", { className: classNames('login-with-email-form', className), style: style, "data-testid": 'email-form', onSubmit: (e) => handleSubmit(e), children: [jsx(Input, { id: 'email_field', value: emailInput, onChange: handleEmailOnChangeEvent, copykey: 'dyn_login.email_form.email_field.label', label: t('dyn_login.email_form.email_field.label'), error: isEmailInvalid, message: isEmailInvalid && t('dyn_login.helper.email_form.invalid_email'), suffix: jsx(InlineSubmitButton, { disabled: isLoading || isDisabled, highlighted: emailInput.length > 0, isFocused: isFocused, isHovered: isHovered, emailSubmitButtonInsideInput: emailSubmitButtonInsideInput }), disabled: isLoading || isDisabled, type: 'email', onPointerEnter: () => setIsHovered(true), onPointerLeave: () => setIsHovered(false), onFocus: () => setIsFocused(true), onBlur: () => setIsFocused(false), autoComplete: 'email' }), !emailSubmitButtonInsideInput && (jsx(TypographyButton, { dataTestId: 'submit_button', buttonClassName: 'login-with-email-form__button', type: 'submit', loading: isLoading, disabled: isLoading || emailInput.length < 3 || isDisabled, buttonVariant: 'brand-primary', buttonPadding: 'login-screen-height', expanded: true, copykey: buttonCopyKey, typographyProps: {
110
108
  color: 'inherit',
111
109
  }, children: t(buttonCopyKey) }))] }));
112
110
  };
@@ -34,6 +34,7 @@ require('@dynamic-labs/multi-wallet');
34
34
  var getAuthToken = require('../../utils/functions/getAuthToken/getAuthToken.cjs');
35
35
  var getMinAuthToken = require('../../utils/functions/getMinAuthToken/getMinAuthToken.cjs');
36
36
  require('react-international-phone');
37
+ var version = require('../../../version.cjs');
37
38
  var ApiEndpoint = require('../../config/ApiEndpoint.cjs');
38
39
  var userActions = require('../../store/actions/userActions/userActions.cjs');
39
40
  var settings = require('../../data/api/settings/settings.cjs');
@@ -689,6 +690,12 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
689
690
  id: 'wallet-book',
690
691
  type: 'application/json',
691
692
  });
693
+ usePrefetch.usePrefetch({
694
+ as: 'fetch',
695
+ href: `${ApiEndpoint.getBaseUrl()}/sdk/${environmentId}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${version.VERSION}`)}`,
696
+ id: `project-settings-${environmentId}`,
697
+ type: 'application/json',
698
+ });
692
699
  // DYN-1140 - Opens Widget when multiWalletWidgetState changes
693
700
  React.useEffect(() => {
694
701
  // If statement to secure SingleWallet widget
@@ -30,6 +30,7 @@ import '@dynamic-labs/multi-wallet';
30
30
  import { getAuthToken } from '../../utils/functions/getAuthToken/getAuthToken.js';
31
31
  import { getMinAuthToken } from '../../utils/functions/getMinAuthToken/getMinAuthToken.js';
32
32
  import 'react-international-phone';
33
+ import { VERSION } from '../../../version.js';
33
34
  import ApiEndpoint from '../../config/ApiEndpoint.js';
34
35
  import { setUser } from '../../store/actions/userActions/userActions.js';
35
36
  import { sendDynamicProps } from '../../data/api/settings/settings.js';
@@ -685,6 +686,12 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
685
686
  id: 'wallet-book',
686
687
  type: 'application/json',
687
688
  });
689
+ usePrefetch({
690
+ as: 'fetch',
691
+ href: `${ApiEndpoint.getBaseUrl()}/sdk/${environmentId}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${VERSION}`)}`,
692
+ id: `project-settings-${environmentId}`,
693
+ type: 'application/json',
694
+ });
688
695
  // DYN-1140 - Opens Widget when multiWalletWidgetState changes
689
696
  useEffect(() => {
690
697
  // If statement to secure SingleWallet widget
@@ -75,9 +75,9 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
75
75
  return updatedQueue;
76
76
  });
77
77
  }, [callbackQueue, handleNextCallback, primaryWallet, user]);
78
- const setCallback = (callback, params) => {
78
+ const setCallback = React.useCallback((callback, params) => {
79
79
  setCallbackQueue((prev) => [...prev, { callback, params }]);
80
- };
80
+ }, []);
81
81
  return { setCallback };
82
82
  };
83
83
 
@@ -71,9 +71,9 @@ const useCustomerCallbacks = ({ callbacks: { onAuthSuccess, onUserProfileUpdate
71
71
  return updatedQueue;
72
72
  });
73
73
  }, [callbackQueue, handleNextCallback, primaryWallet, user]);
74
- const setCallback = (callback, params) => {
74
+ const setCallback = useCallback((callback, params) => {
75
75
  setCallbackQueue((prev) => [...prev, { callback, params }]);
76
- };
76
+ }, []);
77
77
  return { setCallback };
78
78
  };
79
79
 
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
+ var React = require('react');
7
8
  require('@dynamic-labs/utils');
8
9
  require('@dynamic-labs/sdk-api-core');
9
10
  require('../../../shared/logger.cjs');
@@ -11,7 +12,6 @@ require('@dynamic-labs/iconic');
11
12
  require('@dynamic-labs/wallet-connector-core');
12
13
  require('react/jsx-runtime');
13
14
  require('../../../context/ViewContext/ViewContext.cjs');
14
- require('react');
15
15
  require('@dynamic-labs/wallet-book');
16
16
  require('../../constants/colors.cjs');
17
17
  require('../../constants/values.cjs');
@@ -101,7 +101,7 @@ const useExternalAuth = () => {
101
101
  *
102
102
  * @returns {UserProfile} - User profile for successfully signed in user
103
103
  */
104
- const signInWithExternalJwt = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ externalUserId, externalJwt, }) {
104
+ const signInWithExternalJwt = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ externalUserId, externalJwt, }) {
105
105
  try {
106
106
  const userProfile = yield externalAuth.externalAuthSignin({
107
107
  environmentId,
@@ -119,8 +119,8 @@ const useExternalAuth = () => {
119
119
  }, { error: e });
120
120
  throw e;
121
121
  }
122
- });
123
- return { signInWithExternalJwt };
122
+ }), [environmentId, setCallback, setShowAuthFlow]);
123
+ return React.useMemo(() => ({ signInWithExternalJwt }), [signInWithExternalJwt]);
124
124
  };
125
125
 
126
126
  exports.useExternalAuth = useExternalAuth;
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { useCallback, useMemo } from 'react';
3
4
  import '@dynamic-labs/utils';
4
5
  import '@dynamic-labs/sdk-api-core';
5
6
  import '../../../shared/logger.js';
@@ -7,7 +8,6 @@ import '@dynamic-labs/iconic';
7
8
  import '@dynamic-labs/wallet-connector-core';
8
9
  import 'react/jsx-runtime';
9
10
  import '../../../context/ViewContext/ViewContext.js';
10
- import 'react';
11
11
  import '@dynamic-labs/wallet-book';
12
12
  import '../../constants/colors.js';
13
13
  import '../../constants/values.js';
@@ -97,7 +97,7 @@ const useExternalAuth = () => {
97
97
  *
98
98
  * @returns {UserProfile} - User profile for successfully signed in user
99
99
  */
100
- const signInWithExternalJwt = (_a) => __awaiter(void 0, [_a], void 0, function* ({ externalUserId, externalJwt, }) {
100
+ const signInWithExternalJwt = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ externalUserId, externalJwt, }) {
101
101
  try {
102
102
  const userProfile = yield externalAuthSignin({
103
103
  environmentId,
@@ -115,8 +115,8 @@ const useExternalAuth = () => {
115
115
  }, { error: e });
116
116
  throw e;
117
117
  }
118
- });
119
- return { signInWithExternalJwt };
118
+ }), [environmentId, setCallback, setShowAuthFlow]);
119
+ return useMemo(() => ({ signInWithExternalJwt }), [signInWithExternalJwt]);
120
120
  };
121
121
 
122
122
  export { useExternalAuth };