@payos-inc/payos-react 1.2.1-staging.102 → 1.2.1-staging.104

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.
@@ -36,6 +36,14 @@ export declare class ApiError extends Error {
36
36
  code?: string;
37
37
  constructor(message: string, status: number, details?: string, code?: string);
38
38
  }
39
+ /**
40
+ * Maximum time a single API request (including reading its body) may take.
41
+ * Longer than the backend's own 30s upstream network timeout (plus a vault
42
+ * call before it on generate), so a slow but successful call is not reported
43
+ * to the customer as failed.
44
+ */
45
+ export declare const REQUEST_TIMEOUT_MS = 60000;
46
+ export declare const REQUEST_TIMEOUT_MESSAGE = "The request timed out. Check your connection and try again.";
39
47
  /**
40
48
  * Send OTP verification code to a phone number
41
49
  * @param baseUrl API base URL
@@ -1,12 +1,18 @@
1
1
  /**
2
2
  * Environment utilities for PayOS Elements
3
3
  */
4
+ export type PayOSEnvironment = 'sandbox' | 'production';
5
+ /**
6
+ * Throw a configuration error unless `environment` is exactly 'sandbox' or 'production'.
7
+ */
8
+ export declare function assertValidEnvironment(environment: unknown): asserts environment is PayOSEnvironment;
4
9
  /**
5
10
  * Get the API base URL based on environment and optional development override.
6
11
  *
7
12
  * @param environment - 'sandbox' or 'production'
8
13
  * @param developmentApiUrl - Optional override for local development (e.g., 'http://localhost:3000')
9
14
  * @returns The API base URL to use for all SDK/API calls
15
+ * @throws Error if `environment` is not 'sandbox' or 'production'
10
16
  *
11
17
  * @example
12
18
  * // Local development
@@ -18,4 +24,4 @@
18
24
  * // Production live
19
25
  * getApiBaseUrl('production') // => 'https://api.payos.ai'
20
26
  */
21
- export declare function getApiBaseUrl(environment: 'sandbox' | 'production', developmentApiUrl?: string): string;
27
+ export declare function getApiBaseUrl(environment: PayOSEnvironment, developmentApiUrl?: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payos-inc/payos-react",
3
- "version": "1.2.1-staging.102",
3
+ "version": "1.2.1-staging.104",
4
4
  "description": "PayOS React SDK - Drawer checkout component for React",
5
5
  "main": "dist/payos-react.cjs",
6
6
  "module": "dist/payos-react.mjs",