@create-flow/auth-ui 0.0.4 → 0.1.0
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/components/IAMConsole.d.ts +23 -0
- package/dist/components/Login.d.ts +10 -4
- package/dist/components/OAuthButtons.d.ts +1 -1
- package/dist/components/Profile.d.ts +13 -0
- package/dist/components/ResetPassword.d.ts +10 -0
- package/dist/components/Signup.d.ts +7 -1
- package/dist/components/UserMenu.d.ts +5 -1
- package/dist/components/VerifyEmail.d.ts +2 -1
- package/dist/components/iam/ConfirmDialog.d.ts +12 -0
- package/dist/components/iam/DropdownMenu.d.ts +20 -0
- package/dist/components/iam/GroupModal.d.ts +14 -0
- package/dist/components/iam/RoleModal.d.ts +15 -0
- package/dist/components/iam/UserModal.d.ts +14 -0
- package/dist/components/iam/icons.d.ts +22 -0
- package/dist/i18n/I18nContext.d.ts +23 -0
- package/dist/i18n/translations.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +21429 -180
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +21427 -182
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/__tests__/authApi.test.d.ts +1 -0
- package/dist/utils/authApi.d.ts +3 -3
- package/dist/utils/iamApi.d.ts +209 -0
- package/package.json +20 -8
- package/src/index.css +0 -25
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils/authApi.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const DEFAULT_AUTH_HOST: string;
|
|
2
2
|
declare const DEFAULT_APP_ID: string;
|
|
3
|
-
declare function buildAuthUrl(path: string, host?: string, query?: Record<string, string | undefined>):
|
|
4
|
-
export declare function postAuthJson(path: string, body: unknown, host?: string): Promise<{
|
|
3
|
+
declare function buildAuthUrl(path: string, host?: string, query?: Record<string, string | undefined>): string;
|
|
4
|
+
export declare function postAuthJson(path: string, body: unknown, host?: string, authToken?: string): Promise<{
|
|
5
5
|
response: Response;
|
|
6
6
|
data: any;
|
|
7
7
|
}>;
|
|
8
|
-
export declare function getAuthJson(path: string, host?: string, query?: Record<string, string | undefined
|
|
8
|
+
export declare function getAuthJson(path: string, host?: string, query?: Record<string, string | undefined>, authToken?: string): Promise<{
|
|
9
9
|
response: Response;
|
|
10
10
|
data: any;
|
|
11
11
|
}>;
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
export interface IAMUser {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
phone?: string;
|
|
7
|
+
role?: string;
|
|
8
|
+
roles?: Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}>;
|
|
12
|
+
groups?: Array<{
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}>;
|
|
16
|
+
permissions?: string[];
|
|
17
|
+
permissionDetails?: Array<{
|
|
18
|
+
id: string;
|
|
19
|
+
name: string;
|
|
20
|
+
module: string;
|
|
21
|
+
}>;
|
|
22
|
+
isActive: boolean;
|
|
23
|
+
approvalStatus?: 'approved' | 'pending' | 'rejected';
|
|
24
|
+
createdAt: string;
|
|
25
|
+
lastLoginAt?: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface IAMRole {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
isBuiltIn: boolean;
|
|
32
|
+
isActive: boolean;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
permissions?: string[];
|
|
35
|
+
permissionDetails?: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
module: string;
|
|
39
|
+
isBuiltIn: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
}
|
|
42
|
+
export interface IAMPermission {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
module: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
isBuiltIn: boolean;
|
|
48
|
+
createdAt: string;
|
|
49
|
+
}
|
|
50
|
+
export interface IAMGroup {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
userCount?: number;
|
|
56
|
+
permissions?: string[];
|
|
57
|
+
permissionDetails?: Array<{
|
|
58
|
+
id: string;
|
|
59
|
+
name: string;
|
|
60
|
+
module: string;
|
|
61
|
+
isBuiltIn: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
export interface IAMPolicy {
|
|
65
|
+
id: string;
|
|
66
|
+
appId: string;
|
|
67
|
+
sessionTimeoutMinutes: number;
|
|
68
|
+
allowGuest: boolean;
|
|
69
|
+
allowSignUp: boolean;
|
|
70
|
+
requireSignupApproval: boolean;
|
|
71
|
+
passwordMinLength: number;
|
|
72
|
+
passwordRequireUppercase: boolean;
|
|
73
|
+
passwordRequireLowercase: boolean;
|
|
74
|
+
passwordRequireNumbers: boolean;
|
|
75
|
+
passwordRequireSpecialChars: boolean;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
}
|
|
79
|
+
export interface PaginationInfo {
|
|
80
|
+
page: number;
|
|
81
|
+
limit: number;
|
|
82
|
+
totalCount: number;
|
|
83
|
+
totalPages: number;
|
|
84
|
+
hasNext: boolean;
|
|
85
|
+
hasPrev: boolean;
|
|
86
|
+
}
|
|
87
|
+
export declare class ApiError extends Error {
|
|
88
|
+
status: number;
|
|
89
|
+
code?: string;
|
|
90
|
+
constructor(message: string, status: number, code?: string);
|
|
91
|
+
}
|
|
92
|
+
export declare const usersApi: {
|
|
93
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined, options?: {
|
|
94
|
+
excludeGuests?: boolean | undefined;
|
|
95
|
+
page?: number | undefined;
|
|
96
|
+
limit?: number | undefined;
|
|
97
|
+
} | undefined) => Promise<{
|
|
98
|
+
users: IAMUser[];
|
|
99
|
+
pagination: PaginationInfo;
|
|
100
|
+
}>;
|
|
101
|
+
create: (appId: string, userData: Partial<IAMUser> & {
|
|
102
|
+
password: string;
|
|
103
|
+
roleIds?: string[];
|
|
104
|
+
groupIds?: string[];
|
|
105
|
+
permissionIds?: string[];
|
|
106
|
+
}, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMUser>;
|
|
107
|
+
update: (appId: string, userId: string, userData: Partial<IAMUser>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMUser>;
|
|
108
|
+
delete: (appId: string, userId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
109
|
+
updateRole: (appId: string, userId: string, roleIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
110
|
+
updateGroup: (appId: string, userId: string, groupIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
111
|
+
updatePermission: (appId: string, userId: string, permissionIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
112
|
+
resetPassword: (appId: string, userId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
113
|
+
message: string;
|
|
114
|
+
}>;
|
|
115
|
+
getLastLogins: (appId: string, userIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
116
|
+
lastLogins: Record<string, string | null>;
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
export declare const rolesApi: {
|
|
120
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined, options?: {
|
|
121
|
+
page?: number | undefined;
|
|
122
|
+
limit?: number | undefined;
|
|
123
|
+
} | undefined) => Promise<{
|
|
124
|
+
roles: IAMRole[];
|
|
125
|
+
pagination: PaginationInfo;
|
|
126
|
+
}>;
|
|
127
|
+
create: (appId: string, roleData: Partial<IAMRole>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMRole>;
|
|
128
|
+
update: (appId: string, roleId: string, roleData: Partial<IAMRole>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMRole>;
|
|
129
|
+
delete: (appId: string, roleId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
130
|
+
};
|
|
131
|
+
export declare const permissionsApi: {
|
|
132
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
133
|
+
permissions: IAMPermission[];
|
|
134
|
+
}>;
|
|
135
|
+
create: (appId: string, permissionData: Partial<IAMPermission>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMPermission>;
|
|
136
|
+
};
|
|
137
|
+
export declare const groupsApi: {
|
|
138
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
139
|
+
groups: IAMGroup[];
|
|
140
|
+
}>;
|
|
141
|
+
create: (appId: string, groupData: Partial<IAMGroup>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMGroup>;
|
|
142
|
+
update: (appId: string, groupId: string, groupData: Partial<IAMGroup>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMGroup>;
|
|
143
|
+
delete: (appId: string, groupId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
144
|
+
};
|
|
145
|
+
export declare const policyApi: {
|
|
146
|
+
get: (appId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMPolicy>;
|
|
147
|
+
update: (appId: string, policyData: Partial<IAMPolicy>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMPolicy>;
|
|
148
|
+
};
|
|
149
|
+
export declare const iamApi: {
|
|
150
|
+
users: {
|
|
151
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined, options?: {
|
|
152
|
+
excludeGuests?: boolean | undefined;
|
|
153
|
+
page?: number | undefined;
|
|
154
|
+
limit?: number | undefined;
|
|
155
|
+
} | undefined) => Promise<{
|
|
156
|
+
users: IAMUser[];
|
|
157
|
+
pagination: PaginationInfo;
|
|
158
|
+
}>;
|
|
159
|
+
create: (appId: string, userData: Partial<IAMUser> & {
|
|
160
|
+
password: string;
|
|
161
|
+
roleIds?: string[];
|
|
162
|
+
groupIds?: string[];
|
|
163
|
+
permissionIds?: string[];
|
|
164
|
+
}, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMUser>;
|
|
165
|
+
update: (appId: string, userId: string, userData: Partial<IAMUser>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMUser>;
|
|
166
|
+
delete: (appId: string, userId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
167
|
+
updateRole: (appId: string, userId: string, roleIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
168
|
+
updateGroup: (appId: string, userId: string, groupIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
169
|
+
updatePermission: (appId: string, userId: string, permissionIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
170
|
+
resetPassword: (appId: string, userId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
171
|
+
message: string;
|
|
172
|
+
}>;
|
|
173
|
+
getLastLogins: (appId: string, userIds: string[], authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
174
|
+
lastLogins: Record<string, string | null>;
|
|
175
|
+
}>;
|
|
176
|
+
};
|
|
177
|
+
roles: {
|
|
178
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined, options?: {
|
|
179
|
+
page?: number | undefined;
|
|
180
|
+
limit?: number | undefined;
|
|
181
|
+
} | undefined) => Promise<{
|
|
182
|
+
roles: IAMRole[];
|
|
183
|
+
pagination: PaginationInfo;
|
|
184
|
+
}>;
|
|
185
|
+
create: (appId: string, roleData: Partial<IAMRole>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMRole>;
|
|
186
|
+
update: (appId: string, roleId: string, roleData: Partial<IAMRole>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMRole>;
|
|
187
|
+
delete: (appId: string, roleId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
188
|
+
};
|
|
189
|
+
permissions: {
|
|
190
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
191
|
+
permissions: IAMPermission[];
|
|
192
|
+
}>;
|
|
193
|
+
create: (appId: string, permissionData: Partial<IAMPermission>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMPermission>;
|
|
194
|
+
};
|
|
195
|
+
groups: {
|
|
196
|
+
getAll: (appId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<{
|
|
197
|
+
groups: IAMGroup[];
|
|
198
|
+
}>;
|
|
199
|
+
create: (appId: string, groupData: Partial<IAMGroup>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMGroup>;
|
|
200
|
+
update: (appId: string, groupId: string, groupData: Partial<IAMGroup>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMGroup>;
|
|
201
|
+
delete: (appId: string, groupId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<void>;
|
|
202
|
+
};
|
|
203
|
+
policy: {
|
|
204
|
+
get: (appId: string, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMPolicy>;
|
|
205
|
+
update: (appId: string, policyData: Partial<IAMPolicy>, authHost?: string | undefined, authToken?: string | undefined) => Promise<IAMPolicy>;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
export declare function fetchIamAuthToken(authHost?: string): Promise<string | null>;
|
|
209
|
+
export declare function fetchIamSession(authHost?: string): Promise<Record<string, any> | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@create-flow/auth-ui",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Made with create-react-library",
|
|
5
5
|
"author": "@create-flow",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -13,11 +13,18 @@
|
|
|
13
13
|
"source": "src/index.tsx",
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
16
17
|
"import": "./dist/index.modern.js",
|
|
17
|
-
"require": "./dist/index.js"
|
|
18
|
-
"types": "./dist/index.d.ts"
|
|
18
|
+
"require": "./dist/index.js"
|
|
19
19
|
},
|
|
20
|
-
"./styles":
|
|
20
|
+
"./styles": {
|
|
21
|
+
"style": "./dist/index.css",
|
|
22
|
+
"default": "./dist/index.css"
|
|
23
|
+
},
|
|
24
|
+
"./dist/index.css": {
|
|
25
|
+
"style": "./dist/index.css",
|
|
26
|
+
"default": "./dist/index.css"
|
|
27
|
+
}
|
|
21
28
|
},
|
|
22
29
|
"engines": {
|
|
23
30
|
"node": ">=10"
|
|
@@ -35,13 +42,16 @@
|
|
|
35
42
|
"version:patch": "node -e \"const p=require('./package.json');const v=p.version.split('.');v[2]++;p.version=v.join('.');require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')\"",
|
|
36
43
|
"version:minor": "node -e \"const p=require('./package.json');const v=p.version.split('.');v[1]++;v[2]=0;p.version=v.join('.');require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')\"",
|
|
37
44
|
"version:major": "node -e \"const p=require('./package.json');const v=p.version.split('.');v[0]++;v[1]=0;v[2]=0;p.version=v.join('.');require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\\n')\"",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:watch": "vitest",
|
|
38
47
|
"publish:patch": "bun run version:patch && bun publish",
|
|
39
48
|
"publish:minor": "bun run version:minor && bun publish",
|
|
40
49
|
"publish:major": "bun run version:major && bun publish"
|
|
41
50
|
},
|
|
42
51
|
"peerDependencies": {
|
|
43
52
|
"next": "*",
|
|
44
|
-
"react": "^16.0.0"
|
|
53
|
+
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
54
|
+
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
45
55
|
},
|
|
46
56
|
"devDependencies": {
|
|
47
57
|
"@testing-library/jest-dom": "^4.2.4",
|
|
@@ -56,7 +66,6 @@
|
|
|
56
66
|
"@typescript-eslint/parser": "^2.26.0",
|
|
57
67
|
"autoprefixer": "^10.4.16",
|
|
58
68
|
"babel-eslint": "^10.0.3",
|
|
59
|
-
"babel-plugin-transform-async-to-promises": "^0.8.18",
|
|
60
69
|
"cross-env": "^7.0.2",
|
|
61
70
|
"eslint": "^6.8.0",
|
|
62
71
|
"eslint-config-prettier": "^6.7.0",
|
|
@@ -78,11 +87,14 @@
|
|
|
78
87
|
"react-dom": "^16.13.1",
|
|
79
88
|
"react-scripts": "^3.4.1",
|
|
80
89
|
"tailwindcss": "^3.3.5",
|
|
81
|
-
"typescript": "^3.7.5"
|
|
90
|
+
"typescript": "^3.7.5",
|
|
91
|
+
"vitest": "3"
|
|
82
92
|
},
|
|
83
93
|
"files": [
|
|
84
94
|
"dist",
|
|
85
95
|
"src/**/*.css"
|
|
86
96
|
],
|
|
87
|
-
"dependencies": {
|
|
97
|
+
"dependencies": {
|
|
98
|
+
"babel-plugin-transform-async-to-promises": "^0.8.18"
|
|
99
|
+
}
|
|
88
100
|
}
|
package/src/index.css
CHANGED
|
@@ -1,28 +1,3 @@
|
|
|
1
1
|
@tailwind base;
|
|
2
2
|
@tailwind components;
|
|
3
3
|
@tailwind utilities;
|
|
4
|
-
|
|
5
|
-
:root {
|
|
6
|
-
--background: #ffffff;
|
|
7
|
-
--foreground: #171717;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@theme inline {
|
|
11
|
-
--color-background: var(--background);
|
|
12
|
-
--color-foreground: var(--foreground);
|
|
13
|
-
--font-sans: var(--font-geist-sans);
|
|
14
|
-
--font-mono: var(--font-geist-mono);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@media (prefers-color-scheme: dark) {
|
|
18
|
-
:root {
|
|
19
|
-
--background: #0a0a0a;
|
|
20
|
-
--foreground: #ededed;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
body {
|
|
25
|
-
background: var(--background);
|
|
26
|
-
color: var(--foreground);
|
|
27
|
-
font-family: Arial, Helvetica, sans-serif;
|
|
28
|
-
}
|