@movmo_app/react-common 0.11.2 → 0.11.3

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/dist/index.d.ts CHANGED
@@ -171,7 +171,7 @@ export declare interface ModalProps {
171
171
  allowOverflow?: boolean;
172
172
  }
173
173
 
174
- export declare const OTPModal: ({ email, phone, otpLength, otpAction, onVerify, onClose, externalError, title, description, }: OTPModalProps) => JSX_2.Element;
174
+ export declare const OTPModal: ({ email, phone, otpLength, otpAction, onVerify, onClose, externalError, externalErrorVariant, disabled, title, description, onOtpChange, }: OTPModalProps) => JSX_2.Element;
175
175
 
176
176
  export declare interface OTPModalProps {
177
177
  email: string;
@@ -181,8 +181,16 @@ export declare interface OTPModalProps {
181
181
  onVerify: (otp: string) => void;
182
182
  onClose: () => void;
183
183
  externalError?: string;
184
+ externalErrorVariant?: 'error' | 'warning';
185
+ disabled?: boolean;
184
186
  title?: string;
185
187
  description?: string;
188
+ /**
189
+ * Fires when the user edits the OTP (type, paste, backspace). Use to clear
190
+ * stale parent-controlled `externalError` so the message disappears as soon
191
+ * as the user starts correcting their input. Not fired while `disabled`.
192
+ */
193
+ onOtpChange?: (otp: string) => void;
186
194
  }
187
195
 
188
196
  export declare const Pagination: React_2.FC<PaginationProps>;
@@ -285,12 +293,32 @@ export declare const SignInModal: default_2.FC<SignInModalProps>;
285
293
  export declare interface SignInModalProps {
286
294
  isOpen: boolean;
287
295
  onClose: () => void;
296
+ /**
297
+ * Called to start the sign-in flow. Rejected errors are inspected via
298
+ * `isRateLimitError` to decide whether to show the rate-limit notice. The
299
+ * default detector expects an axios-shaped rejection (`error.response.status`
300
+ * === 429); pass a custom `isRateLimitError` if you use a different HTTP client.
301
+ */
288
302
  loginUser: (email: string, phone: string, usernameType: AuthenticationUsernameType) => Promise<LoginUserResponse>;
303
+ /**
304
+ * Called to verify the OTP code. Rejected errors are surfaced to the user:
305
+ * - 429 (per `isRateLimitError`) → OTP modal locked + warning notice.
306
+ * - 400 → "Invalid or expired code…" (most common: typo / expired code).
307
+ * - 401 → "Your session has expired…".
308
+ * - anything else → "Something went wrong. Please try again."
309
+ * Status is read from `error.response.status` (axios shape).
310
+ */
289
311
  verifyOTP: (username: string, code: string, session: string, challengeName: AuthenticationChallengeName | null) => Promise<void>;
290
312
  getCurrentUser: () => Promise<User>;
291
313
  onLoginSuccess: (user: User) => void;
292
314
  hideCloseButton?: boolean;
293
315
  showPhone?: boolean;
316
+ /**
317
+ * Predicate used to detect HTTP 429 rate-limit rejections. Defaults to an
318
+ * axios-shaped check (`error.response?.status === 429`). Supply a custom
319
+ * implementation for non-axios clients (fetch, ky, custom error types).
320
+ */
321
+ isRateLimitError?: (error: unknown) => boolean;
294
322
  }
295
323
 
296
324
  export declare const Textarea: React_2.ForwardRefExoticComponent<TextareaProps & React_2.RefAttributes<HTMLTextAreaElement>>;