|
| 1 | +import { WalletEventOnReceived } from './wallet-types'; |
| 2 | + |
1 | 3 | export interface LoginWithMagicLinkConfiguration {
|
2 | 4 | /**
|
3 | 5 | * The email address of the user attempting to login.
|
@@ -74,40 +76,6 @@ export interface LoginWithEmailOTPConfiguration {
|
74 | 76 | };
|
75 | 77 | }
|
76 | 78 |
|
77 |
| -/** |
78 |
| - * EventHandlers |
79 |
| - */ |
80 |
| -export type LoginWithMagicLinkEventHandlers = { |
81 |
| - // Event Received |
82 |
| - [LoginWithMagicLinkEventOnReceived.EmailSent]: () => void; |
83 |
| - [LoginWithMagicLinkEventOnReceived.EmailNotDeliverable]: () => void; |
84 |
| - |
85 |
| - // Event sent |
86 |
| - [LoginWithMagicLinkEventEmit.Retry]: () => void; |
87 |
| -} & DeviceVerificationEventHandlers; |
88 |
| - |
89 |
| -export type LoginWithEmailOTPEventHandlers = { |
90 |
| - // Event Received |
91 |
| - [LoginWithEmailOTPEventOnReceived.EmailOTPSent]: () => void; |
92 |
| - [LoginWithEmailOTPEventOnReceived.InvalidEmailOtp]: () => void; |
93 |
| - [LoginWithEmailOTPEventOnReceived.ExpiredEmailOtp]: () => void; |
94 |
| - |
95 |
| - // Event sent |
96 |
| - [LoginWithEmailOTPEventEmit.VerifyEmailOtp]: (otp: string) => void; |
97 |
| - [LoginWithEmailOTPEventEmit.Cancel]: () => void; |
98 |
| -} & DeviceVerificationEventHandlers; |
99 |
| - |
100 |
| -type DeviceVerificationEventHandlers = { |
101 |
| - // Event Received |
102 |
| - [DeviceVerificationEventOnReceived.DeviceNeedsApproval]: () => void; |
103 |
| - [DeviceVerificationEventOnReceived.DeviceVerificationEmailSent]: () => void; |
104 |
| - [DeviceVerificationEventOnReceived.DeviceVerificationLinkExpired]: () => void; |
105 |
| - [DeviceVerificationEventOnReceived.DeviceApproved]: () => void; |
106 |
| - |
107 |
| - // Event sent |
108 |
| - [DeviceVerificationEventEmit.Retry]: () => void; |
109 |
| -}; |
110 |
| - |
111 | 79 | /**
|
112 | 80 | * Auth Events Enum
|
113 | 81 | */
|
@@ -142,38 +110,6 @@ export enum DeviceVerificationEventOnReceived {
|
142 | 110 | DeviceVerificationEmailSent = 'device-verification-email-sent',
|
143 | 111 | }
|
144 | 112 |
|
145 |
| -/** |
146 |
| - * Update Email |
147 |
| - */ |
148 |
| - |
149 |
| -type RecencyCheckEventHandlers = { |
150 |
| - [RecencyCheckEventOnReceived.PrimaryAuthFactorNeedsVerification]: () => void; |
151 |
| - [RecencyCheckEventOnReceived.PrimaryAuthFactorVerified]: () => void; |
152 |
| - [RecencyCheckEventOnReceived.InvalidEmailOtp]: () => void; |
153 |
| - [RecencyCheckEventOnReceived.EmailNotDeliverable]: () => void; |
154 |
| - [RecencyCheckEventOnReceived.EmailExpired]: () => void; |
155 |
| - [RecencyCheckEventOnReceived.EmailSent]: () => void; |
156 |
| - |
157 |
| - [RecencyCheckEventEmit.Cancel]: () => void; |
158 |
| - [RecencyCheckEventEmit.Retry]: () => void; |
159 |
| - [RecencyCheckEventEmit.VerifyEmailOtp]: (otp: string) => void; |
160 |
| -}; |
161 |
| - |
162 |
| -export type UpdateEmailEventHandlers = { |
163 |
| - [UpdateEmailEventOnReceived.NewAuthFactorNeedsVerification]: () => void; |
164 |
| - [UpdateEmailEventOnReceived.EmailUpdated]: () => void; |
165 |
| - [UpdateEmailEventOnReceived.InvalidEmailOtp]: () => void; |
166 |
| - [UpdateEmailEventOnReceived.EmailNotDeliverable]: () => void; |
167 |
| - [UpdateEmailEventOnReceived.EmailExpired]: () => void; |
168 |
| - [UpdateEmailEventOnReceived.EmailSent]: () => void; |
169 |
| - [UpdateEmailEventOnReceived.InvalidEmail]: () => void; |
170 |
| - [UpdateEmailEventOnReceived.EmailAlreadyExists]: () => void; |
171 |
| - |
172 |
| - [UpdateEmailEventEmit.Cancel]: () => void; |
173 |
| - [UpdateEmailEventEmit.RetryWithNewEmail]: (email?: string) => void; |
174 |
| - [UpdateEmailEventEmit.VerifyEmailOtp]: (otp: string) => void; |
175 |
| -} & RecencyCheckEventHandlers; |
176 |
| - |
177 | 113 | export enum RecencyCheckEventEmit {
|
178 | 114 | Retry = 'Recency/auth-factor-retry',
|
179 | 115 | Cancel = 'Recency/auth-factor-verification-cancel',
|
@@ -205,3 +141,75 @@ export enum UpdateEmailEventOnReceived {
|
205 | 141 | InvalidEmail = 'UpdateEmail/new-email-invalid',
|
206 | 142 | EmailAlreadyExists = 'UpdateEmail/new-email-already-exists',
|
207 | 143 | }
|
| 144 | + |
| 145 | +export enum AuthEventOnReceived { |
| 146 | + IDTokenCreated = 'Auth/id-token-created', |
| 147 | +} |
| 148 | + |
| 149 | +/** |
| 150 | + * EventHandlers |
| 151 | + */ |
| 152 | +export type LoginWithMagicLinkEventHandlers = { |
| 153 | + // Event Received |
| 154 | + [LoginWithMagicLinkEventOnReceived.EmailSent]: () => void; |
| 155 | + [LoginWithMagicLinkEventOnReceived.EmailNotDeliverable]: () => void; |
| 156 | + |
| 157 | + // Event sent |
| 158 | + [LoginWithMagicLinkEventEmit.Retry]: () => void; |
| 159 | +} & DeviceVerificationEventHandlers; |
| 160 | + |
| 161 | +export type LoginWithEmailOTPEventHandlers = { |
| 162 | + // Event Received |
| 163 | + [LoginWithEmailOTPEventOnReceived.EmailOTPSent]: () => void; |
| 164 | + [LoginWithEmailOTPEventOnReceived.InvalidEmailOtp]: () => void; |
| 165 | + [LoginWithEmailOTPEventOnReceived.ExpiredEmailOtp]: () => void; |
| 166 | + [AuthEventOnReceived.IDTokenCreated]: (idToken: string) => void; |
| 167 | + [WalletEventOnReceived.WalletInfoFetched]: () => void; |
| 168 | + |
| 169 | + // Event sent |
| 170 | + [LoginWithEmailOTPEventEmit.VerifyEmailOtp]: (otp: string) => void; |
| 171 | + [LoginWithEmailOTPEventEmit.Cancel]: () => void; |
| 172 | +} & DeviceVerificationEventHandlers; |
| 173 | + |
| 174 | +type DeviceVerificationEventHandlers = { |
| 175 | + // Event Received |
| 176 | + [DeviceVerificationEventOnReceived.DeviceNeedsApproval]: () => void; |
| 177 | + [DeviceVerificationEventOnReceived.DeviceVerificationEmailSent]: () => void; |
| 178 | + [DeviceVerificationEventOnReceived.DeviceVerificationLinkExpired]: () => void; |
| 179 | + [DeviceVerificationEventOnReceived.DeviceApproved]: () => void; |
| 180 | + |
| 181 | + // Event sent |
| 182 | + [DeviceVerificationEventEmit.Retry]: () => void; |
| 183 | +}; |
| 184 | + |
| 185 | +/** |
| 186 | + * Update Email |
| 187 | + */ |
| 188 | + |
| 189 | +type RecencyCheckEventHandlers = { |
| 190 | + [RecencyCheckEventOnReceived.PrimaryAuthFactorNeedsVerification]: () => void; |
| 191 | + [RecencyCheckEventOnReceived.PrimaryAuthFactorVerified]: () => void; |
| 192 | + [RecencyCheckEventOnReceived.InvalidEmailOtp]: () => void; |
| 193 | + [RecencyCheckEventOnReceived.EmailNotDeliverable]: () => void; |
| 194 | + [RecencyCheckEventOnReceived.EmailExpired]: () => void; |
| 195 | + [RecencyCheckEventOnReceived.EmailSent]: () => void; |
| 196 | + |
| 197 | + [RecencyCheckEventEmit.Cancel]: () => void; |
| 198 | + [RecencyCheckEventEmit.Retry]: () => void; |
| 199 | + [RecencyCheckEventEmit.VerifyEmailOtp]: (otp: string) => void; |
| 200 | +}; |
| 201 | + |
| 202 | +export type UpdateEmailEventHandlers = { |
| 203 | + [UpdateEmailEventOnReceived.NewAuthFactorNeedsVerification]: () => void; |
| 204 | + [UpdateEmailEventOnReceived.EmailUpdated]: () => void; |
| 205 | + [UpdateEmailEventOnReceived.InvalidEmailOtp]: () => void; |
| 206 | + [UpdateEmailEventOnReceived.EmailNotDeliverable]: () => void; |
| 207 | + [UpdateEmailEventOnReceived.EmailExpired]: () => void; |
| 208 | + [UpdateEmailEventOnReceived.EmailSent]: () => void; |
| 209 | + [UpdateEmailEventOnReceived.InvalidEmail]: () => void; |
| 210 | + [UpdateEmailEventOnReceived.EmailAlreadyExists]: () => void; |
| 211 | + |
| 212 | + [UpdateEmailEventEmit.Cancel]: () => void; |
| 213 | + [UpdateEmailEventEmit.RetryWithNewEmail]: (email?: string) => void; |
| 214 | + [UpdateEmailEventEmit.VerifyEmailOtp]: (otp: string) => void; |
| 215 | +} & RecencyCheckEventHandlers; |
0 commit comments