react-unified-auth 1.0.1 → 1.0.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.
@@ -0,0 +1,59 @@
1
+ export interface AuthConfig {
2
+ apiUrl: string;
3
+ clientId?: string;
4
+ clientSecret?: string;
5
+ redirectUri?: string;
6
+ scope?: string[];
7
+ headers?: Record<string, string>;
8
+ timeout?: number;
9
+ }
10
+ export interface FormField {
11
+ name: string;
12
+ type: 'text' | 'email' | 'password' | 'number' | 'select' | 'checkbox' | 'radio' | 'textarea';
13
+ label: string;
14
+ placeholder?: string;
15
+ required?: boolean;
16
+ options?: Array<{
17
+ label: string;
18
+ value: string;
19
+ }>;
20
+ validation?: {
21
+ pattern?: string;
22
+ minLength?: number;
23
+ maxLength?: number;
24
+ min?: number;
25
+ max?: number;
26
+ };
27
+ }
28
+ export interface DynamicFormConfig {
29
+ fields: FormField[];
30
+ submitUrl: string;
31
+ method?: 'POST' | 'PUT' | 'PATCH';
32
+ submitButton?: {
33
+ text: string;
34
+ variant?: 'primary' | 'secondary' | 'outline';
35
+ };
36
+ }
37
+ export interface UserInfo {
38
+ id: string;
39
+ name: string;
40
+ email?: string;
41
+ avatar?: string;
42
+ [key: string]: any;
43
+ }
44
+ export interface AuthResponse {
45
+ success: boolean;
46
+ data?: {
47
+ user?: UserInfo;
48
+ token?: string;
49
+ refreshToken?: string;
50
+ };
51
+ error?: string;
52
+ }
53
+ export interface SocialProvider {
54
+ id: string;
55
+ name: string;
56
+ icon?: string;
57
+ authUrl: string;
58
+ scope?: string[];
59
+ }
@@ -0,0 +1,14 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ export declare class ApiClient {
3
+ private client;
4
+ constructor(config: {
5
+ baseURL: string;
6
+ timeout?: number;
7
+ headers?: Record<string, string>;
8
+ });
9
+ get<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
10
+ post<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
11
+ put<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
12
+ patch<T>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
13
+ delete<T>(url: string, config?: AxiosRequestConfig): Promise<T>;
14
+ }
@@ -0,0 +1,9 @@
1
+ import { FormField } from '../types';
2
+ export declare function validateField(field: FormField, value: any): {
3
+ valid: boolean;
4
+ error?: string;
5
+ };
6
+ export declare function validateForm(fields: FormField[], values: Record<string, any>): {
7
+ valid: boolean;
8
+ errors: Record<string, string>;
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-unified-auth",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A unified entry point for third-party login with dynamic form support",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -26,24 +26,23 @@
26
26
  "author": "",
27
27
  "license": "MIT",
28
28
  "peerDependencies": {
29
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
30
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
29
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
30
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@rollup/plugin-commonjs": "^25.0.0",
34
34
  "@rollup/plugin-node-resolve": "^15.0.0",
35
35
  "@rollup/plugin-typescript": "^11.0.0",
36
- "@types/react": "^18.0.0",
37
- "@types/react-dom": "^18.0.0",
36
+ "@types/react": "^18.0.0 || ^19.0.0",
37
+ "@types/react-dom": "^18.0.0 || ^19.0.0",
38
38
  "@typescript-eslint/eslint-plugin": "^6.0.0",
39
39
  "@typescript-eslint/parser": "^6.0.0",
40
40
  "eslint": "^8.0.0",
41
41
  "eslint-plugin-react": "^7.32.0",
42
42
  "eslint-plugin-react-hooks": "^4.6.0",
43
43
  "rollup": "^3.0.0",
44
- "rollup-plugin-dts": "^5.0.0",
44
+ "rollup-plugin-css-only": "^4.5.5",
45
45
  "rollup-plugin-peer-deps-external": "^2.2.4",
46
- "rollup-plugin-postcss": "^4.0.2",
47
46
  "tslib": "^2.8.1",
48
47
  "typescript": "^5.0.0"
49
48
  },