@dynamic-labs/sdk-react-core 2.0.0-alpha.29 → 2.0.0-alpha.30

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +13 -13
  5. package/src/index.cjs +4 -4
  6. package/src/index.d.ts +1 -1
  7. package/src/index.js +3 -3
  8. package/src/lib/Main.cjs +2 -2
  9. package/src/lib/Main.js +2 -2
  10. package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpContext.cjs +9 -0
  11. package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpContext.d.ts +3 -0
  12. package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpContext.js +5 -0
  13. package/src/lib/context/{ConnectWithEmailOtpContext/ConnectWithEmailOtpProvider.cjs → ConnectWithOtpContext/ConnectWithOtpProvider.cjs} +31 -10
  14. package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.d.ts +2 -0
  15. package/src/lib/context/{ConnectWithEmailOtpContext/ConnectWithEmailOtpProvider.js → ConnectWithOtpContext/ConnectWithOtpProvider.js} +31 -10
  16. package/src/lib/context/ConnectWithOtpContext/index.d.ts +2 -0
  17. package/src/lib/context/ConnectWithOtpContext/types.d.ts +20 -0
  18. package/src/lib/context/{ConnectWithEmailOtpContext/useConnectWithEmailOtp.cjs → ConnectWithOtpContext/useConnectWithOtp.cjs} +6 -5
  19. package/src/lib/context/ConnectWithOtpContext/useConnectWithOtp.d.ts +6 -0
  20. package/src/lib/context/{ConnectWithEmailOtpContext/useConnectWithEmailOtp.js → ConnectWithOtpContext/useConnectWithOtp.js} +6 -5
  21. package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/createEmailHandler.cjs +2 -1
  22. package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/createEmailHandler.d.ts +1 -1
  23. package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/createEmailHandler.js +2 -1
  24. package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/createMagicHandler.cjs +2 -1
  25. package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/createMagicHandler.d.ts +1 -1
  26. package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/createMagicHandler.js +2 -1
  27. package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +32 -0
  28. package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.d.ts +3 -0
  29. package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +28 -0
  30. package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -3
  31. package/src/lib/context/DynamicContext/DynamicContext.js +3 -3
  32. package/src/lib/context/VerificationContext/VerificationContext.d.ts +2 -9
  33. package/src/lib/events/dynamicEvents.d.ts +2 -10
  34. package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +2 -2
  35. package/src/lib/shared/types/general.d.ts +8 -0
  36. package/src/lib/context/ConnectWithEmailOtpContext/ConnectWithEmailOtpProvider.d.ts +0 -2
  37. package/src/lib/context/ConnectWithEmailOtpContext/connectWithEmailOtpContext.cjs +0 -9
  38. package/src/lib/context/ConnectWithEmailOtpContext/connectWithEmailOtpContext.d.ts +0 -3
  39. package/src/lib/context/ConnectWithEmailOtpContext/connectWithEmailOtpContext.js +0 -5
  40. package/src/lib/context/ConnectWithEmailOtpContext/index.d.ts +0 -2
  41. package/src/lib/context/ConnectWithEmailOtpContext/types.d.ts +0 -17
  42. package/src/lib/context/ConnectWithEmailOtpContext/useConnectWithEmailOtp.d.ts +0 -6
  43. /package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/constants.cjs +0 -0
  44. /package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/constants.d.ts +0 -0
  45. /package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/constants.js +0 -0
  46. /package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/findEmailProvider.cjs +0 -0
  47. /package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/findEmailProvider.d.ts +0 -0
  48. /package/src/lib/context/{ConnectWithEmailOtpContext → ConnectWithOtpContext}/utils/findEmailProvider.js +0 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,15 @@
1
1
 
2
+ ## [2.0.0-alpha.30](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.29...v2.0.0-alpha.30) (2024-04-11)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * add headless sms sign-in (#5274)
8
+
9
+ ### Features
10
+
11
+ * add headless sms sign-in ([#5274](https://github.com/dynamic-labs/DynamicAuth/issues/5274)) ([fffc293](https://github.com/dynamic-labs/DynamicAuth/commit/fffc293f85447a784e8c728d1586f3555ab1fbfa))
12
+
2
13
  ## [2.0.0-alpha.29](https://github.com/dynamic-labs/DynamicAuth/compare/v2.0.0-alpha.28...v2.0.0-alpha.29) (2024-04-10)
3
14
 
4
15
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "2.0.0-alpha.29";
5
+ var version = "2.0.0-alpha.30";
6
6
  var dependencies = {
7
7
  "@dynamic-labs/sdk-api-core": "0.0.415",
8
8
  "@hcaptcha/react-hcaptcha": "1.4.4",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "2.0.0-alpha.29";
1
+ var version = "2.0.0-alpha.30";
2
2
  var dependencies = {
3
3
  "@dynamic-labs/sdk-api-core": "0.0.415",
4
4
  "@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": "2.0.0-alpha.29",
3
+ "version": "2.0.0-alpha.30",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -17,18 +17,18 @@
17
17
  "react-i18next": "13.5.0",
18
18
  "yup": "0.32.11",
19
19
  "react-international-phone": "4.2.5",
20
- "@dynamic-labs/ethereum": "2.0.0-alpha.29",
21
- "@dynamic-labs/iconic": "2.0.0-alpha.29",
22
- "@dynamic-labs/logger": "2.0.0-alpha.29",
23
- "@dynamic-labs/multi-wallet": "2.0.0-alpha.29",
24
- "@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.29",
25
- "@dynamic-labs/rpc-provider-solana": "2.0.0-alpha.29",
26
- "@dynamic-labs/rpc-providers": "2.0.0-alpha.29",
27
- "@dynamic-labs/types": "2.0.0-alpha.29",
28
- "@dynamic-labs/utils": "2.0.0-alpha.29",
29
- "@dynamic-labs/viem-utils": "2.0.0-alpha.29",
30
- "@dynamic-labs/wallet-book": "2.0.0-alpha.29",
31
- "@dynamic-labs/wallet-connector-core": "2.0.0-alpha.29",
20
+ "@dynamic-labs/ethereum": "2.0.0-alpha.30",
21
+ "@dynamic-labs/iconic": "2.0.0-alpha.30",
22
+ "@dynamic-labs/logger": "2.0.0-alpha.30",
23
+ "@dynamic-labs/multi-wallet": "2.0.0-alpha.30",
24
+ "@dynamic-labs/rpc-provider-ethereum": "2.0.0-alpha.30",
25
+ "@dynamic-labs/rpc-provider-solana": "2.0.0-alpha.30",
26
+ "@dynamic-labs/rpc-providers": "2.0.0-alpha.30",
27
+ "@dynamic-labs/types": "2.0.0-alpha.30",
28
+ "@dynamic-labs/utils": "2.0.0-alpha.30",
29
+ "@dynamic-labs/viem-utils": "2.0.0-alpha.30",
30
+ "@dynamic-labs/wallet-book": "2.0.0-alpha.30",
31
+ "@dynamic-labs/wallet-connector-core": "2.0.0-alpha.30",
32
32
  "eventemitter3": "5.0.1"
33
33
  },
34
34
  "devDependencies": {
package/src/index.cjs CHANGED
@@ -136,9 +136,9 @@ var index$2 = require('./lib/utils/functions/walletFilters/index.cjs');
136
136
  var SendBalanceContext = require('./lib/context/SendBalanceContext/SendBalanceContext.cjs');
137
137
  require('./lib/context/FundingContext/FundingContext.cjs');
138
138
  var useFunding = require('./lib/context/FundingContext/useFunding/useFunding.cjs');
139
- require('./lib/context/ConnectWithEmailOtpContext/connectWithEmailOtpContext.cjs');
140
- require('./lib/context/ConnectWithEmailOtpContext/constants.cjs');
141
- var useConnectWithEmailOtp = require('./lib/context/ConnectWithEmailOtpContext/useConnectWithEmailOtp.cjs');
139
+ require('./lib/context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
140
+ require('./lib/context/ConnectWithOtpContext/constants.cjs');
141
+ var useConnectWithOtp = require('./lib/context/ConnectWithOtpContext/useConnectWithOtp.cjs');
142
142
 
143
143
 
144
144
 
@@ -232,4 +232,4 @@ exports.SortWallets = index$2.SortWallets;
232
232
  exports.UniswapFilter = index$2.UniswapFilter;
233
233
  exports.useSendBalance = SendBalanceContext.useSendBalance;
234
234
  exports.useFunding = useFunding.useFunding;
235
- exports.useConnectWithEmailOtp = useConnectWithEmailOtp.useConnectWithEmailOtp;
235
+ exports.useConnectWithOtp = useConnectWithOtp.useConnectWithOtp;
package/src/index.d.ts CHANGED
@@ -113,4 +113,4 @@ export { type DynamicJwt, DynamicJwtFromJSON, } from '@dynamic-labs/sdk-api-core
113
113
  export { useSendBalance } from './lib/context/SendBalanceContext';
114
114
  export type { LocaleResource } from './lib/locale';
115
115
  export { useFunding } from './lib/context/FundingContext';
116
- export { useConnectWithEmailOtp } from './lib/context/ConnectWithEmailOtpContext';
116
+ export { useConnectWithOtp } from './lib/context/ConnectWithOtpContext';
package/src/index.js CHANGED
@@ -132,6 +132,6 @@ export { FilterAndSortWallets, FilterBridgeChainsName, FilterChain, FilterWallet
132
132
  export { useSendBalance } from './lib/context/SendBalanceContext/SendBalanceContext.js';
133
133
  import './lib/context/FundingContext/FundingContext.js';
134
134
  export { useFunding } from './lib/context/FundingContext/useFunding/useFunding.js';
135
- import './lib/context/ConnectWithEmailOtpContext/connectWithEmailOtpContext.js';
136
- import './lib/context/ConnectWithEmailOtpContext/constants.js';
137
- export { useConnectWithEmailOtp } from './lib/context/ConnectWithEmailOtpContext/useConnectWithEmailOtp.js';
135
+ import './lib/context/ConnectWithOtpContext/ConnectWithOtpContext.js';
136
+ import './lib/context/ConnectWithOtpContext/constants.js';
137
+ export { useConnectWithOtp } from './lib/context/ConnectWithOtpContext/useConnectWithOtp.js';
package/src/lib/Main.cjs CHANGED
@@ -84,8 +84,8 @@ require('./widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWal
84
84
  require('@hcaptcha/react-hcaptcha');
85
85
  require('./views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.cjs');
86
86
  require('./context/SendBalanceContext/SendBalanceContext.cjs');
87
- require('./context/ConnectWithEmailOtpContext/connectWithEmailOtpContext.cjs');
88
- require('./context/ConnectWithEmailOtpContext/constants.cjs');
87
+ require('./context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
88
+ require('./context/ConnectWithOtpContext/constants.cjs');
89
89
  require('./main.global.cjs');
90
90
  var isSelectedWalletAlreadyConnected = require('./utils/functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.cjs');
91
91
  var useVerifyOnAwaitingSignature = require('./utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.cjs');
package/src/lib/Main.js CHANGED
@@ -80,8 +80,8 @@ import './widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWall
80
80
  import '@hcaptcha/react-hcaptcha';
81
81
  import './views/LoginView/sections/PhoneNumberSignInSection/PhoneNumberSignInSection.js';
82
82
  import './context/SendBalanceContext/SendBalanceContext.js';
83
- import './context/ConnectWithEmailOtpContext/connectWithEmailOtpContext.js';
84
- import './context/ConnectWithEmailOtpContext/constants.js';
83
+ import './context/ConnectWithOtpContext/ConnectWithOtpContext.js';
84
+ import './context/ConnectWithOtpContext/constants.js';
85
85
  import './main.global.js';
86
86
  import { isSelectedWalletAlreadyConnected } from './utils/functions/isSelectedWalletAlreadyConnected/isSelectedWalletAlreadyConnected.js';
87
87
  import { useVerifyOnAwaitingSignature } from './utils/hooks/multiWallet/useVerifyOnAwaitingSignature/useVerifyOnAwaitingSignature.js';
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+
7
+ const ConnectWithOtpContext = React.createContext(undefined);
8
+
9
+ exports.ConnectWithOtpContext = ConnectWithOtpContext;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IConnectWithOtpContext } from './types';
3
+ export declare const ConnectWithOtpContext: import("react").Context<IConnectWithOtpContext | undefined>;
@@ -0,0 +1,5 @@
1
+ import { createContext } from 'react';
2
+
3
+ const ConnectWithOtpContext = createContext(undefined);
4
+
5
+ export { ConnectWithOtpContext };
@@ -76,13 +76,14 @@ require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
76
76
  require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
77
77
  require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
78
78
  var useInternalDynamicContext = require('../DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
79
- var connectWithEmailOtpContext = require('./connectWithEmailOtpContext.cjs');
79
+ var ConnectWithOtpContext = require('./ConnectWithOtpContext.cjs');
80
80
  var findEmailProvider = require('./utils/findEmailProvider.cjs');
81
81
  var createMagicHandler = require('./utils/createMagicHandler.cjs');
82
82
  var createEmailHandler = require('./utils/createEmailHandler.cjs');
83
+ var createSmsHandler = require('./utils/createSmsHandler.cjs');
83
84
 
84
- const { Provider } = connectWithEmailOtpContext.connectWithEmailOtpContext;
85
- const ConnectWithEmailOtpProvider = ({ children, }) => {
85
+ const { Provider } = ConnectWithOtpContext.ConnectWithOtpContext;
86
+ const ConnectWithOtpProvider = ({ children }) => {
86
87
  const { walletConnectorOptions, environmentId, projectSettings, setCallback, } = useInternalDynamicContext.useInternalDynamicContext();
87
88
  const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback.useCreateUserProfileByJWTCallback();
88
89
  const { handleInstalledExtensionClick } = useWalletItemActions.useWalletItemActions();
@@ -112,29 +113,49 @@ const ConnectWithEmailOtpProvider = ({ children, }) => {
112
113
  const verificationHandler = yield mapProvider[effectiveEmailProvider].handler(email);
113
114
  lastVerificationHandlerRef.current = verificationHandler;
114
115
  });
116
+ const connectWithSms = (phone) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
117
+ if (!isProviderEnabled.isProviderEnabled(providers, sdkApiCore.ProviderEnum.Sms)) {
118
+ throw new Error('SMS provider is not enabled');
119
+ }
120
+ const handler = createSmsHandler.createSmsHandler(environmentId, createUserProfileByJWT);
121
+ const verificationHandler = yield handler(phone);
122
+ lastVerificationHandlerRef.current = verificationHandler;
123
+ });
115
124
  const verifyOneTimePassword = (oneTimePassword) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
116
125
  if (!lastVerificationHandlerRef.current) {
117
- throw new Error('Verification have not started, use connectWithEmail before verifying');
126
+ throw new Error('Verification has not started, use connectWithEmail or connectWithSms before verifying');
127
+ }
128
+ const { type, verify } = lastVerificationHandlerRef.current;
129
+ const { destination, verified } = yield verify(oneTimePassword);
130
+ if (type === 'sms') {
131
+ dynamicEvents.dynamicEvents.emit('smsVerificationResult', verified, destination);
132
+ }
133
+ else {
134
+ //EMAIL
135
+ dynamicEvents.dynamicEvents.emit('emailVerificationResult', verified, destination);
118
136
  }
119
- const { email, verified } = yield lastVerificationHandlerRef.current.verify(oneTimePassword);
120
- dynamicEvents.dynamicEvents.emit('emailVerificationResult', verified, email);
121
137
  if (verified) {
122
138
  setCallback('authSuccess');
123
139
  }
124
140
  else {
125
- throw new Error('Email verification failed');
141
+ throw new Error(`${type === 'sms' ? 'SMS' : 'Email'} verification failed`);
126
142
  }
127
143
  });
128
144
  const retryOneTimePassword = () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
129
145
  if (!lastVerificationHandlerRef.current) {
130
- throw new Error('Verification have not started, use connectWithEmail before verifying');
146
+ throw new Error('Verification has not started, use connectWithEmail or connectWithSms before verifying');
131
147
  }
132
148
  if (!lastVerificationHandlerRef.current.retry) {
133
149
  throw new Error('Re-send is not supported');
134
150
  }
135
151
  return lastVerificationHandlerRef.current.retry();
136
152
  });
137
- return (jsxRuntime.jsx(Provider, { value: { connectWithEmail, retryOneTimePassword, verifyOneTimePassword }, children: children }));
153
+ return (jsxRuntime.jsx(Provider, { value: {
154
+ connectWithEmail,
155
+ connectWithSms,
156
+ retryOneTimePassword,
157
+ verifyOneTimePassword,
158
+ }, children: children }));
138
159
  };
139
160
 
140
- exports.ConnectWithEmailOtpProvider = ConnectWithEmailOtpProvider;
161
+ exports.ConnectWithOtpProvider = ConnectWithOtpProvider;
@@ -0,0 +1,2 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ export declare const ConnectWithOtpProvider: FC<PropsWithChildren>;
@@ -72,13 +72,14 @@ import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
72
72
  import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
73
73
  import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
74
74
  import { useInternalDynamicContext } from '../DynamicContext/useDynamicContext/useInternalDynamicContext.js';
75
- import { connectWithEmailOtpContext } from './connectWithEmailOtpContext.js';
75
+ import { ConnectWithOtpContext } from './ConnectWithOtpContext.js';
76
76
  import { findEmailProvider } from './utils/findEmailProvider.js';
77
77
  import { createMagicHandler } from './utils/createMagicHandler.js';
78
78
  import { createEmailHandler } from './utils/createEmailHandler.js';
79
+ import { createSmsHandler } from './utils/createSmsHandler.js';
79
80
 
80
- const { Provider } = connectWithEmailOtpContext;
81
- const ConnectWithEmailOtpProvider = ({ children, }) => {
81
+ const { Provider } = ConnectWithOtpContext;
82
+ const ConnectWithOtpProvider = ({ children }) => {
82
83
  const { walletConnectorOptions, environmentId, projectSettings, setCallback, } = useInternalDynamicContext();
83
84
  const { createUserProfileByJWT } = useCreateUserProfileByJWTCallback();
84
85
  const { handleInstalledExtensionClick } = useWalletItemActions();
@@ -108,29 +109,49 @@ const ConnectWithEmailOtpProvider = ({ children, }) => {
108
109
  const verificationHandler = yield mapProvider[effectiveEmailProvider].handler(email);
109
110
  lastVerificationHandlerRef.current = verificationHandler;
110
111
  });
112
+ const connectWithSms = (phone) => __awaiter(void 0, void 0, void 0, function* () {
113
+ if (!isProviderEnabled(providers, ProviderEnum.Sms)) {
114
+ throw new Error('SMS provider is not enabled');
115
+ }
116
+ const handler = createSmsHandler(environmentId, createUserProfileByJWT);
117
+ const verificationHandler = yield handler(phone);
118
+ lastVerificationHandlerRef.current = verificationHandler;
119
+ });
111
120
  const verifyOneTimePassword = (oneTimePassword) => __awaiter(void 0, void 0, void 0, function* () {
112
121
  if (!lastVerificationHandlerRef.current) {
113
- throw new Error('Verification have not started, use connectWithEmail before verifying');
122
+ throw new Error('Verification has not started, use connectWithEmail or connectWithSms before verifying');
123
+ }
124
+ const { type, verify } = lastVerificationHandlerRef.current;
125
+ const { destination, verified } = yield verify(oneTimePassword);
126
+ if (type === 'sms') {
127
+ dynamicEvents.emit('smsVerificationResult', verified, destination);
128
+ }
129
+ else {
130
+ //EMAIL
131
+ dynamicEvents.emit('emailVerificationResult', verified, destination);
114
132
  }
115
- const { email, verified } = yield lastVerificationHandlerRef.current.verify(oneTimePassword);
116
- dynamicEvents.emit('emailVerificationResult', verified, email);
117
133
  if (verified) {
118
134
  setCallback('authSuccess');
119
135
  }
120
136
  else {
121
- throw new Error('Email verification failed');
137
+ throw new Error(`${type === 'sms' ? 'SMS' : 'Email'} verification failed`);
122
138
  }
123
139
  });
124
140
  const retryOneTimePassword = () => __awaiter(void 0, void 0, void 0, function* () {
125
141
  if (!lastVerificationHandlerRef.current) {
126
- throw new Error('Verification have not started, use connectWithEmail before verifying');
142
+ throw new Error('Verification has not started, use connectWithEmail or connectWithSms before verifying');
127
143
  }
128
144
  if (!lastVerificationHandlerRef.current.retry) {
129
145
  throw new Error('Re-send is not supported');
130
146
  }
131
147
  return lastVerificationHandlerRef.current.retry();
132
148
  });
133
- return (jsx(Provider, { value: { connectWithEmail, retryOneTimePassword, verifyOneTimePassword }, children: children }));
149
+ return (jsx(Provider, { value: {
150
+ connectWithEmail,
151
+ connectWithSms,
152
+ retryOneTimePassword,
153
+ verifyOneTimePassword,
154
+ }, children: children }));
134
155
  };
135
156
 
136
- export { ConnectWithEmailOtpProvider };
157
+ export { ConnectWithOtpProvider };
@@ -0,0 +1,2 @@
1
+ export { ConnectWithOtpProvider } from './ConnectWithOtpProvider';
2
+ export { useConnectWithOtp } from './useConnectWithOtp';
@@ -0,0 +1,20 @@
1
+ import { PhoneData } from '../../shared';
2
+ export type EmailProviders = 'magicLink' | 'dynamic';
3
+ export type ConnectWithOtpOptions = {
4
+ provider?: EmailProviders;
5
+ };
6
+ export type IConnectWithOtpContext = {
7
+ connectWithEmail: (email: string, options?: ConnectWithOtpOptions) => Promise<void>;
8
+ connectWithSms: (phone: PhoneData) => Promise<void>;
9
+ verifyOneTimePassword: (oneTimePassword: string) => Promise<void>;
10
+ retryOneTimePassword: () => Promise<void>;
11
+ };
12
+ export type ProviderVerificationHandler<T> = {
13
+ type: 'email' | 'sms';
14
+ verify: (oneTimePassword: string) => Promise<{
15
+ destination: T;
16
+ verified: boolean;
17
+ }>;
18
+ retry?: () => Promise<void>;
19
+ };
20
+ export type ProviderHandler<T> = (destination: T) => Promise<ProviderVerificationHandler<T>>;
@@ -3,18 +3,19 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
- var connectWithEmailOtpContext = require('./connectWithEmailOtpContext.cjs');
6
+ var ConnectWithOtpContext = require('./ConnectWithOtpContext.cjs');
7
7
 
8
- const useConnectWithEmailOtp = ({ provider: defaultProvider, } = {}) => {
9
- const context = React.useContext(connectWithEmailOtpContext.connectWithEmailOtpContext);
8
+ const useConnectWithOtp = ({ emailProvider: defaultProvider, } = {}) => {
9
+ const context = React.useContext(ConnectWithOtpContext.ConnectWithOtpContext);
10
10
  if (!context) {
11
- throw new Error('useConnectWithEmailOtp must be used within a DynamicContextProvider');
11
+ throw new Error('useConnectWithOtp must be used within a DynamicContextProvider');
12
12
  }
13
13
  return {
14
14
  connectWithEmail: (email, options = {}) => context.connectWithEmail(email, Object.assign({ provider: defaultProvider }, options)),
15
+ connectWithSms: context.connectWithSms,
15
16
  retryOneTimePassword: context.retryOneTimePassword,
16
17
  verifyOneTimePassword: context.verifyOneTimePassword,
17
18
  };
18
19
  };
19
20
 
20
- exports.useConnectWithEmailOtp = useConnectWithEmailOtp;
21
+ exports.useConnectWithOtp = useConnectWithOtp;
@@ -0,0 +1,6 @@
1
+ import { EmailProviders, IConnectWithOtpContext } from './types';
2
+ type UseConnectWithOtpProps = {
3
+ emailProvider?: EmailProviders;
4
+ };
5
+ export declare const useConnectWithOtp: ({ emailProvider: defaultProvider, }?: UseConnectWithOtpProps) => IConnectWithOtpContext;
6
+ export {};
@@ -1,16 +1,17 @@
1
1
  import { useContext } from 'react';
2
- import { connectWithEmailOtpContext } from './connectWithEmailOtpContext.js';
2
+ import { ConnectWithOtpContext } from './ConnectWithOtpContext.js';
3
3
 
4
- const useConnectWithEmailOtp = ({ provider: defaultProvider, } = {}) => {
5
- const context = useContext(connectWithEmailOtpContext);
4
+ const useConnectWithOtp = ({ emailProvider: defaultProvider, } = {}) => {
5
+ const context = useContext(ConnectWithOtpContext);
6
6
  if (!context) {
7
- throw new Error('useConnectWithEmailOtp must be used within a DynamicContextProvider');
7
+ throw new Error('useConnectWithOtp must be used within a DynamicContextProvider');
8
8
  }
9
9
  return {
10
10
  connectWithEmail: (email, options = {}) => context.connectWithEmail(email, Object.assign({ provider: defaultProvider }, options)),
11
+ connectWithSms: context.connectWithSms,
11
12
  retryOneTimePassword: context.retryOneTimePassword,
12
13
  verifyOneTimePassword: context.verifyOneTimePassword,
13
14
  };
14
15
  };
15
16
 
16
- export { useConnectWithEmailOtp };
17
+ export { useConnectWithOtp };
@@ -11,6 +11,7 @@ const createEmailHandler = (environmentId, createUserProfileByJWT) => (email) =>
11
11
  environmentId,
12
12
  });
13
13
  return {
14
+ type: 'email',
14
15
  verify: (oneTimePassword) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
15
16
  const response = yield api.signInWithEmailVerification({
16
17
  environmentId,
@@ -19,7 +20,7 @@ const createEmailHandler = (environmentId, createUserProfileByJWT) => (email) =>
19
20
  });
20
21
  yield createUserProfileByJWT(response.jwt, response.minifiedJwt);
21
22
  return {
22
- email,
23
+ destination: email,
23
24
  verified: Boolean(response.jwt),
24
25
  };
25
26
  }),
@@ -1,2 +1,2 @@
1
1
  import { ProviderHandler } from '../types';
2
- export declare const createEmailHandler: (environmentId: string, createUserProfileByJWT: (jwt: string, minifiedJwt: string) => Promise<void>) => ProviderHandler;
2
+ export declare const createEmailHandler: (environmentId: string, createUserProfileByJWT: (jwt: string, minifiedJwt: string) => Promise<void>) => ProviderHandler<string>;
@@ -7,6 +7,7 @@ const createEmailHandler = (environmentId, createUserProfileByJWT) => (email) =>
7
7
  environmentId,
8
8
  });
9
9
  return {
10
+ type: 'email',
10
11
  verify: (oneTimePassword) => __awaiter(void 0, void 0, void 0, function* () {
11
12
  const response = yield signInWithEmailVerification({
12
13
  environmentId,
@@ -15,7 +16,7 @@ const createEmailHandler = (environmentId, createUserProfileByJWT) => (email) =>
15
16
  });
16
17
  yield createUserProfileByJWT(response.jwt, response.minifiedJwt);
17
18
  return {
18
- email,
19
+ destination: email,
19
20
  verified: Boolean(response.jwt),
20
21
  };
21
22
  }),
@@ -12,9 +12,10 @@ const createMagicHandler = (connector, handleInstalledExtensionClick) => (email)
12
12
  handleInstalledExtensionClick(connector);
13
13
  return {
14
14
  retry: () => connector.retryOneTimePassword(),
15
+ type: 'email',
15
16
  verify: (oneTimePassword) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
16
17
  return ({
17
- email,
18
+ destination: email,
18
19
  verified: yield connector.verifyOneTimePassword(oneTimePassword),
19
20
  });
20
21
  }),
@@ -1,3 +1,3 @@
1
1
  import { IEmailOTPWalletConnector } from '@dynamic-labs/wallet-connector-core';
2
2
  import { ProviderHandler } from '../types';
3
- export declare const createMagicHandler: (connector: IEmailOTPWalletConnector | undefined, handleInstalledExtensionClick: (connector: IEmailOTPWalletConnector) => void) => ProviderHandler;
3
+ export declare const createMagicHandler: (connector: IEmailOTPWalletConnector | undefined, handleInstalledExtensionClick: (connector: IEmailOTPWalletConnector) => void) => ProviderHandler<string>;
@@ -8,9 +8,10 @@ const createMagicHandler = (connector, handleInstalledExtensionClick) => (email)
8
8
  handleInstalledExtensionClick(connector);
9
9
  return {
10
10
  retry: () => connector.retryOneTimePassword(),
11
+ type: 'email',
11
12
  verify: (oneTimePassword) => __awaiter(void 0, void 0, void 0, function* () {
12
13
  return ({
13
- email,
14
+ destination: email,
14
15
  verified: yield connector.verifyOneTimePassword(oneTimePassword),
15
16
  });
16
17
  }),
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('../../../../../_virtual/_tslib.cjs');
6
+ var api = require('../../../data/api.cjs');
7
+
8
+ const createSmsHandler = (environmentId, createUserProfileByJWT) => (phone) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
9
+ const { verificationUUID } = yield api.createSmsVerification({
10
+ environmentId,
11
+ isoCountryCode: phone.iso2,
12
+ phoneCountryCode: phone.dialCode,
13
+ phoneNumber: phone.phone,
14
+ });
15
+ return {
16
+ type: 'sms',
17
+ verify: (oneTimePassword) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
18
+ const response = yield api.signInWithSmsVerification({
19
+ environmentId,
20
+ verificationToken: oneTimePassword,
21
+ verificationUUID,
22
+ });
23
+ yield createUserProfileByJWT(response.jwt, response.minifiedJwt);
24
+ return {
25
+ destination: phone,
26
+ verified: Boolean(response.jwt),
27
+ };
28
+ }),
29
+ };
30
+ });
31
+
32
+ exports.createSmsHandler = createSmsHandler;
@@ -0,0 +1,3 @@
1
+ import { PhoneData } from '../../../shared';
2
+ import { ProviderHandler } from '../types';
3
+ export declare const createSmsHandler: (environmentId: string, createUserProfileByJWT: (jwt: string, minifiedJwt: string) => Promise<void>) => ProviderHandler<PhoneData>;
@@ -0,0 +1,28 @@
1
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
2
+ import { createSmsVerification, signInWithSmsVerification } from '../../../data/api.js';
3
+
4
+ const createSmsHandler = (environmentId, createUserProfileByJWT) => (phone) => __awaiter(void 0, void 0, void 0, function* () {
5
+ const { verificationUUID } = yield createSmsVerification({
6
+ environmentId,
7
+ isoCountryCode: phone.iso2,
8
+ phoneCountryCode: phone.dialCode,
9
+ phoneNumber: phone.phone,
10
+ });
11
+ return {
12
+ type: 'sms',
13
+ verify: (oneTimePassword) => __awaiter(void 0, void 0, void 0, function* () {
14
+ const response = yield signInWithSmsVerification({
15
+ environmentId,
16
+ verificationToken: oneTimePassword,
17
+ verificationUUID,
18
+ });
19
+ yield createUserProfileByJWT(response.jwt, response.minifiedJwt);
20
+ return {
21
+ destination: phone,
22
+ verified: Boolean(response.jwt),
23
+ };
24
+ }),
25
+ };
26
+ });
27
+
28
+ export { createSmsHandler };
@@ -104,8 +104,8 @@ require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidge
104
104
  require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
105
105
  require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
106
106
  var FundingWidget = require('../../widgets/FundingWidget/FundingWidget.cjs');
107
- var ConnectWithEmailOtpProvider = require('../ConnectWithEmailOtpContext/ConnectWithEmailOtpProvider.cjs');
108
- require('../ConnectWithEmailOtpContext/connectWithEmailOtpContext.cjs');
107
+ var ConnectWithOtpProvider = require('../ConnectWithOtpContext/ConnectWithOtpProvider.cjs');
108
+ require('../ConnectWithOtpContext/ConnectWithOtpContext.cjs');
109
109
  var FundingContext = require('../FundingContext/FundingContext.cjs');
110
110
  var PhantomRedirectContext = require('../PhantomRedirectContext/PhantomRedirectContext.cjs');
111
111
  var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs');
@@ -673,7 +673,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale: locale
673
673
  isAuthenticated: isAuthenticated || Boolean(primaryWallet),
674
674
  isBridgeFlow,
675
675
  isMultiWalletEnabled: multiWallet,
676
- }), children: [networkValidationMode === 'always' && jsxRuntime.jsx(UseNetworkValidation.UseNetworkValidation, {}), jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { canSync: didConnectedStateLoad, children: jsxRuntime.jsx(PasskeyContext.PasskeyContextProvider, { children: jsxRuntime.jsx(VerificationContext.VerificationProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsx(UserFieldEditorContext.UserFieldEditorContextProvider, { children: jsxRuntime.jsx(ConnectWithEmailOtpProvider.ConnectWithEmailOtpProvider, { children: jsxRuntime.jsx(PhantomRedirectContext.PhantomRedirectContextProvider, { children: jsxRuntime.jsxs(SocialRedirectContext.SocialRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(SyncEmbeddedWalletAuthFlow.SyncEmbeddedWalletAuthFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
676
+ }), children: [networkValidationMode === 'always' && jsxRuntime.jsx(UseNetworkValidation.UseNetworkValidation, {}), jsxRuntime.jsx(CaptchaContext.CaptchaContextProvider, { children: jsxRuntime.jsx(AccountExistsContext.AccountExistsContextProvider, { children: jsxRuntime.jsx(WalletContext.WalletContextProvider, { canSync: didConnectedStateLoad, children: jsxRuntime.jsx(PasskeyContext.PasskeyContextProvider, { children: jsxRuntime.jsx(VerificationContext.VerificationProvider, { children: jsxRuntime.jsx(DynamicWidgetContext.DynamicWidgetContextProvider, { children: jsxRuntime.jsx(DynamicBridgeWidgetContext.DynamicBridgeWidgetContextProvider, { children: jsxRuntime.jsx(FundingContext.FundingContextProvider, { children: jsxRuntime.jsx(AccessDeniedContext.AccessDeniedContextProvider, { children: jsxRuntime.jsx(SendBalanceContext.SendBalanceContextProvider, { children: jsxRuntime.jsx(WalletGroupContext.WalletGroupContextProvider, { children: jsxRuntime.jsx(UserFieldEditorContext.UserFieldEditorContextProvider, { children: jsxRuntime.jsx(ConnectWithOtpProvider.ConnectWithOtpProvider, { children: jsxRuntime.jsx(PhantomRedirectContext.PhantomRedirectContextProvider, { children: jsxRuntime.jsxs(SocialRedirectContext.SocialRedirectContextProvider, { children: [jsxRuntime.jsx(app.DynamicAuthFlow, {}), jsxRuntime.jsx(Toolkit.Toolkit, {}), jsxRuntime.jsx(FundingWidget.FundingWidget, {}), jsxRuntime.jsx(SyncEmbeddedWalletAuthFlow.SyncEmbeddedWalletAuthFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
677
677
  };
678
678
  /** The context provider you need to have access too all of Dynamic's hooks */
679
679
  const DynamicContextProvider = (props) => {
@@ -100,8 +100,8 @@ import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidget
100
100
  import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
101
101
  import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
102
102
  import { FundingWidget } from '../../widgets/FundingWidget/FundingWidget.js';
103
- import { ConnectWithEmailOtpProvider } from '../ConnectWithEmailOtpContext/ConnectWithEmailOtpProvider.js';
104
- import '../ConnectWithEmailOtpContext/connectWithEmailOtpContext.js';
103
+ import { ConnectWithOtpProvider } from '../ConnectWithOtpContext/ConnectWithOtpProvider.js';
104
+ import '../ConnectWithOtpContext/ConnectWithOtpContext.js';
105
105
  import { FundingContextProvider } from '../FundingContext/FundingContext.js';
106
106
  import { PhantomRedirectContextProvider } from '../PhantomRedirectContext/PhantomRedirectContext.js';
107
107
  import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceContext.js';
@@ -669,7 +669,7 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, }) =>
669
669
  isAuthenticated: isAuthenticated || Boolean(primaryWallet),
670
670
  isBridgeFlow,
671
671
  isMultiWalletEnabled: multiWallet,
672
- }), children: [networkValidationMode === 'always' && jsx(UseNetworkValidation, {}), jsx(CaptchaContextProvider, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { canSync: didConnectedStateLoad, children: jsx(PasskeyContextProvider, { children: jsx(VerificationProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsx(UserFieldEditorContextProvider, { children: jsx(ConnectWithEmailOtpProvider, { children: jsx(PhantomRedirectContextProvider, { children: jsxs(SocialRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(SyncEmbeddedWalletAuthFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
672
+ }), children: [networkValidationMode === 'always' && jsx(UseNetworkValidation, {}), jsx(CaptchaContextProvider, { children: jsx(AccountExistsContextProvider, { children: jsx(WalletContextProvider, { canSync: didConnectedStateLoad, children: jsx(PasskeyContextProvider, { children: jsx(VerificationProvider, { children: jsx(DynamicWidgetContextProvider, { children: jsx(DynamicBridgeWidgetContextProvider, { children: jsx(FundingContextProvider, { children: jsx(AccessDeniedContextProvider, { children: jsx(SendBalanceContextProvider, { children: jsx(WalletGroupContextProvider, { children: jsx(UserFieldEditorContextProvider, { children: jsx(ConnectWithOtpProvider, { children: jsx(PhantomRedirectContextProvider, { children: jsxs(SocialRedirectContextProvider, { children: [jsx(DynamicAuthFlow, {}), jsx(Toolkit, {}), jsx(FundingWidget, {}), jsx(SyncEmbeddedWalletAuthFlow, {}), confirmationModal, children] }) }) }) }) }) }) }) }) }) }) }) }) }) }) })] }) }) }) }) }) }));
673
673
  };
674
674
  /** The context provider you need to have access too all of Dynamic's hooks */
675
675
  const DynamicContextProvider = (props) => {
@@ -1,13 +1,6 @@
1
1
  import { ReactNode, SetStateAction, Dispatch } from 'react';
2
- type RetryPhoneParams = {
3
- /** Non formatted phone number without country code */
4
- phone: string;
5
- /** Country iso2, such as "US", "FR" or "BR" */
6
- iso2: string;
7
- /** Country code, such as "1", "33" or "55" */
8
- dialCode: string;
9
- };
10
- type RetryData = RetryPhoneParams;
2
+ import { PhoneData } from '../../shared';
3
+ type RetryData = PhoneData;
11
4
  type VerificationContextProps = {
12
5
  /**
13
6
  * Where we tell the user the verification code was sent to.
@@ -1,14 +1,6 @@
1
1
  import EventEmitter from 'eventemitter3';
2
2
  import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core/models/JwtVerifiedCredential';
3
- import { Wallet } from '../shared';
4
- export type PhoneEventData = {
5
- /** Just the phone numbers with no country dial code */
6
- phone: string;
7
- /** ISO2 of the corresponding country */
8
- iso2: string;
9
- /** Dial code of the corresponding country */
10
- dialCode: string;
11
- };
3
+ import { PhoneData, Wallet } from '../shared';
12
4
  /** Maps internal event names to their listeners */
13
5
  export type DynamicEvents = {
14
6
  authFlowOpen: () => void;
@@ -17,7 +9,7 @@ export type DynamicEvents = {
17
9
  /** Triggered when auth is attempted but fails, like when user rejects connection or the network call fails */
18
10
  authFlowCancelled: () => void;
19
11
  emailVerificationResult: (param: boolean, email: string) => void;
20
- smsVerificationResult: (param: boolean, phone: PhoneEventData) => void;
12
+ smsVerificationResult: (param: boolean, phone: PhoneData) => void;
21
13
  embeddedWalletCreated: (wallet: Wallet, verifiedCredential: JwtVerifiedCredential | undefined) => void;
22
14
  embeddedWalletFailed: (error: unknown) => void;
23
15
  passkeyRecoveryCompleted: (wallet: Wallet) => void;
@@ -1,8 +1,8 @@
1
1
  import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
2
2
  import { OtpVerificationDestination } from '../../utils/hooks/authenticationHooks/useOtpVerificationRequest';
3
- import { PhoneEventData } from '../../events';
4
3
  import { UserProfile } from './user';
5
4
  import { Wallet } from './wallets';
5
+ import { PhoneData } from '.';
6
6
  export type DynamicEventsCallbacks = {
7
7
  onSignedMessage?: (params: {
8
8
  messageToSign: string;
@@ -45,7 +45,7 @@ destination: {
45
45
  value: string;
46
46
  } | {
47
47
  type: Extract<OtpVerificationDestination, 'sms'>;
48
- value: PhoneEventData;
48
+ value: PhoneData;
49
49
  }) => void;
50
50
  export type OnUserProfileUpdate = (user: UserProfile) => void;
51
51
  export type OnEmbeddedWalletCreated = (verifiedCredential: JwtVerifiedCredential | undefined) => void;
@@ -3,3 +3,11 @@ export type ErrorWithCode = Error & {
3
3
  code: string;
4
4
  };
5
5
  export type PasswordInputMode = 'password' | 'text';
6
+ export type PhoneData = {
7
+ /** Just the phone numbers with no country dial code */
8
+ phone: string;
9
+ /** ISO2 of the corresponding country */
10
+ iso2: string;
11
+ /** Dial code of the corresponding country */
12
+ dialCode: string;
13
+ };
@@ -1,2 +0,0 @@
1
- import { FC, PropsWithChildren } from 'react';
2
- export declare const ConnectWithEmailOtpProvider: FC<PropsWithChildren>;
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var React = require('react');
6
-
7
- const connectWithEmailOtpContext = React.createContext(undefined);
8
-
9
- exports.connectWithEmailOtpContext = connectWithEmailOtpContext;
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- import { ConnectWithEmailOtpContext } from './types';
3
- export declare const connectWithEmailOtpContext: import("react").Context<ConnectWithEmailOtpContext | undefined>;
@@ -1,5 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- const connectWithEmailOtpContext = createContext(undefined);
4
-
5
- export { connectWithEmailOtpContext };
@@ -1,2 +0,0 @@
1
- export { ConnectWithEmailOtpProvider } from './ConnectWithEmailOtpProvider';
2
- export { useConnectWithEmailOtp } from './useConnectWithEmailOtp';
@@ -1,17 +0,0 @@
1
- export type EmailProviders = 'magicLink' | 'dynamic';
2
- export type ConnectWithEmailOtpOptions = {
3
- provider?: EmailProviders;
4
- };
5
- export type ConnectWithEmailOtpContext = {
6
- connectWithEmail: (email: string, options?: ConnectWithEmailOtpOptions) => Promise<void>;
7
- verifyOneTimePassword: (oneTimePassword: string) => Promise<void>;
8
- retryOneTimePassword: () => Promise<void>;
9
- };
10
- export type ProviderVerificationHandler = {
11
- verify: (oneTimePassword: string) => Promise<{
12
- email: string;
13
- verified: boolean;
14
- }>;
15
- retry?: () => Promise<void>;
16
- };
17
- export type ProviderHandler = (email: string) => Promise<ProviderVerificationHandler>;
@@ -1,6 +0,0 @@
1
- import { EmailProviders, ConnectWithEmailOtpContext } from './types';
2
- type UseConnectWithEmailOtpProps = {
3
- provider?: EmailProviders;
4
- };
5
- export declare const useConnectWithEmailOtp: ({ provider: defaultProvider, }?: UseConnectWithEmailOtpProps) => ConnectWithEmailOtpContext;
6
- export {};