@asgardeo/javascript 0.1.1 → 0.1.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/AsgardeoJavaScriptClient.d.ts +9 -5
- package/dist/api/getAllOrganizations.d.ts +2 -11
- package/dist/api/getBrandingPreference.d.ts +103 -0
- package/dist/cjs/index.js +690 -62
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +8 -2
- package/dist/index.js +686 -62
- package/dist/index.js.map +4 -4
- package/dist/models/branding-preference.d.ts +248 -0
- package/dist/models/client.d.ts +10 -6
- package/dist/models/config.d.ts +18 -0
- package/dist/models/i18n.d.ts +10 -0
- package/dist/models/organization.d.ts +9 -0
- package/dist/theme/createTheme.d.ts +17 -1
- package/dist/theme/types.d.ts +212 -1
- package/dist/utils/deriveOrganizationHandleFromBaseUrl.d.ts +47 -0
- package/dist/utils/processUsername.d.ts +73 -0
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts +48 -0
- package/package.json +1 -1
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Interface for color configuration with multiple variants.
|
|
20
|
+
*/
|
|
21
|
+
export interface ColorVariants {
|
|
22
|
+
contrastText?: string;
|
|
23
|
+
dark?: string;
|
|
24
|
+
inverted?: string;
|
|
25
|
+
light?: string;
|
|
26
|
+
main?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Interface for text color configuration.
|
|
30
|
+
*/
|
|
31
|
+
export interface TextColors {
|
|
32
|
+
primary?: string;
|
|
33
|
+
secondary?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Interface for button styling configuration.
|
|
37
|
+
*/
|
|
38
|
+
export interface ButtonStyle {
|
|
39
|
+
base?: {
|
|
40
|
+
background?: {
|
|
41
|
+
backgroundColor?: string;
|
|
42
|
+
};
|
|
43
|
+
border?: {
|
|
44
|
+
borderColor?: string;
|
|
45
|
+
borderRadius?: string;
|
|
46
|
+
};
|
|
47
|
+
font?: {
|
|
48
|
+
color?: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Interface for buttons configuration.
|
|
54
|
+
*/
|
|
55
|
+
export interface ButtonsConfig {
|
|
56
|
+
externalConnection?: ButtonStyle;
|
|
57
|
+
primary?: ButtonStyle;
|
|
58
|
+
secondary?: ButtonStyle;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Interface for color palette configuration.
|
|
62
|
+
*/
|
|
63
|
+
export interface ColorsConfig {
|
|
64
|
+
alerts?: {
|
|
65
|
+
error?: ColorVariants;
|
|
66
|
+
info?: ColorVariants;
|
|
67
|
+
neutral?: ColorVariants;
|
|
68
|
+
warning?: ColorVariants;
|
|
69
|
+
};
|
|
70
|
+
background?: {
|
|
71
|
+
body?: ColorVariants;
|
|
72
|
+
surface?: ColorVariants;
|
|
73
|
+
};
|
|
74
|
+
illustrations?: {
|
|
75
|
+
accent1?: ColorVariants;
|
|
76
|
+
accent2?: ColorVariants;
|
|
77
|
+
accent3?: ColorVariants;
|
|
78
|
+
primary?: ColorVariants;
|
|
79
|
+
secondary?: ColorVariants;
|
|
80
|
+
};
|
|
81
|
+
outlined?: {
|
|
82
|
+
default?: string;
|
|
83
|
+
};
|
|
84
|
+
primary?: ColorVariants;
|
|
85
|
+
secondary?: ColorVariants;
|
|
86
|
+
text?: TextColors;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Interface for footer configuration.
|
|
90
|
+
*/
|
|
91
|
+
export interface FooterConfig {
|
|
92
|
+
border?: {
|
|
93
|
+
borderColor?: string;
|
|
94
|
+
};
|
|
95
|
+
font?: {
|
|
96
|
+
color?: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Interface for image configuration.
|
|
101
|
+
*/
|
|
102
|
+
export interface ImageConfig {
|
|
103
|
+
altText?: string;
|
|
104
|
+
imgURL?: string;
|
|
105
|
+
title?: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Interface for images configuration.
|
|
109
|
+
*/
|
|
110
|
+
export interface ImagesConfig {
|
|
111
|
+
favicon?: Partial<ImageConfig>;
|
|
112
|
+
logo?: Partial<ImageConfig>;
|
|
113
|
+
myAccountLogo?: Partial<ImageConfig>;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Interface for input styling configuration.
|
|
117
|
+
*/
|
|
118
|
+
export interface InputsConfig {
|
|
119
|
+
base?: {
|
|
120
|
+
background?: {
|
|
121
|
+
backgroundColor?: string;
|
|
122
|
+
};
|
|
123
|
+
border?: {
|
|
124
|
+
borderColor?: string;
|
|
125
|
+
borderRadius?: string;
|
|
126
|
+
};
|
|
127
|
+
font?: {
|
|
128
|
+
color?: string;
|
|
129
|
+
};
|
|
130
|
+
labels?: {
|
|
131
|
+
font?: {
|
|
132
|
+
color?: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Interface for login box configuration.
|
|
139
|
+
*/
|
|
140
|
+
export interface LoginBoxConfig {
|
|
141
|
+
background?: {
|
|
142
|
+
backgroundColor?: string;
|
|
143
|
+
};
|
|
144
|
+
border?: {
|
|
145
|
+
borderColor?: string;
|
|
146
|
+
borderRadius?: string;
|
|
147
|
+
borderWidth?: string;
|
|
148
|
+
};
|
|
149
|
+
font?: {
|
|
150
|
+
color?: string;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Interface for login page configuration.
|
|
155
|
+
*/
|
|
156
|
+
export interface LoginPageConfig {
|
|
157
|
+
background?: {
|
|
158
|
+
backgroundColor?: string;
|
|
159
|
+
};
|
|
160
|
+
font?: {
|
|
161
|
+
color?: string;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Interface for typography configuration.
|
|
166
|
+
*/
|
|
167
|
+
export interface TypographyConfig {
|
|
168
|
+
font?: {
|
|
169
|
+
color?: string;
|
|
170
|
+
fontFamily?: string;
|
|
171
|
+
importURL?: string;
|
|
172
|
+
};
|
|
173
|
+
heading?: {
|
|
174
|
+
font?: {
|
|
175
|
+
color?: string;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Interface for theme variant configuration (LIGHT/DARK).
|
|
181
|
+
*/
|
|
182
|
+
export interface ThemeVariant {
|
|
183
|
+
buttons?: ButtonsConfig;
|
|
184
|
+
colors?: ColorsConfig;
|
|
185
|
+
footer?: FooterConfig;
|
|
186
|
+
images?: ImagesConfig;
|
|
187
|
+
inputs?: InputsConfig;
|
|
188
|
+
loginBox?: LoginBoxConfig;
|
|
189
|
+
loginPage?: LoginPageConfig;
|
|
190
|
+
typography?: TypographyConfig;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Interface for branding preference layout configuration.
|
|
194
|
+
*/
|
|
195
|
+
export interface BrandingLayout {
|
|
196
|
+
activeLayout?: string;
|
|
197
|
+
sideImg?: {
|
|
198
|
+
altText?: string;
|
|
199
|
+
imgURL?: string;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Interface for organization details configuration.
|
|
204
|
+
*/
|
|
205
|
+
export interface BrandingOrganizationDetails {
|
|
206
|
+
displayName?: string;
|
|
207
|
+
supportEmail?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Interface for URL configurations.
|
|
211
|
+
*/
|
|
212
|
+
export interface UrlsConfig {
|
|
213
|
+
cookiePolicyURL?: string;
|
|
214
|
+
privacyPolicyURL?: string;
|
|
215
|
+
termsOfUseURL?: string;
|
|
216
|
+
selfSignUpURL?: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Interface for branding preference theme configuration.
|
|
220
|
+
*/
|
|
221
|
+
export interface BrandingTheme {
|
|
222
|
+
activeTheme?: string;
|
|
223
|
+
LIGHT?: ThemeVariant;
|
|
224
|
+
DARK?: ThemeVariant;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Interface for branding preference configuration.
|
|
228
|
+
*/
|
|
229
|
+
export interface BrandingPreferenceConfig {
|
|
230
|
+
configs?: {
|
|
231
|
+
isBrandingEnabled?: boolean;
|
|
232
|
+
removeDefaultBranding?: boolean;
|
|
233
|
+
selfSignUpEnabled?: boolean;
|
|
234
|
+
};
|
|
235
|
+
layout?: BrandingLayout;
|
|
236
|
+
organizationDetails?: BrandingOrganizationDetails;
|
|
237
|
+
theme?: BrandingTheme;
|
|
238
|
+
urls?: UrlsConfig;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Interface for branding preference configuration.
|
|
242
|
+
*/
|
|
243
|
+
export interface BrandingPreference {
|
|
244
|
+
type?: string;
|
|
245
|
+
name?: string;
|
|
246
|
+
locale?: string;
|
|
247
|
+
preference?: BrandingPreferenceConfig;
|
|
248
|
+
}
|
package/dist/models/client.d.ts
CHANGED
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
import { AllOrganizationsApiResponse } from '../models/organization';
|
|
18
19
|
import { EmbeddedFlowExecuteRequestConfig, EmbeddedFlowExecuteRequestPayload, EmbeddedFlowExecuteResponse } from './embedded-flow';
|
|
19
20
|
import { EmbeddedSignInFlowHandleRequestPayload } from './embedded-signin-flow';
|
|
20
21
|
import { Organization } from './organization';
|
|
21
22
|
import { User, UserProfile } from './user';
|
|
23
|
+
import { TokenResponse } from './token';
|
|
22
24
|
export type SignInOptions = Record<string, unknown>;
|
|
23
25
|
export type SignOutOptions = Record<string, unknown>;
|
|
24
26
|
export type SignUpOptions = Record<string, unknown>;
|
|
@@ -34,36 +36,38 @@ export type SignUpOptions = Record<string, unknown>;
|
|
|
34
36
|
*/
|
|
35
37
|
export interface AsgardeoClient<T> {
|
|
36
38
|
/**
|
|
37
|
-
* Gets the
|
|
39
|
+
* Gets the current signed-in user's associated organizations.
|
|
38
40
|
*
|
|
39
41
|
* @returns Associated organizations.
|
|
40
42
|
*/
|
|
41
|
-
|
|
43
|
+
getMyOrganizations(options?: any, sessionId?: string): Promise<Organization[]>;
|
|
44
|
+
getAllOrganizations(options?: any, sessionId?: string): Promise<AllOrganizationsApiResponse>;
|
|
42
45
|
/**
|
|
43
46
|
* Gets the current organization of the user.
|
|
44
47
|
*
|
|
45
48
|
* @returns The current organization if available, otherwise null.
|
|
46
49
|
*/
|
|
47
|
-
getCurrentOrganization(): Promise<Organization | null>;
|
|
50
|
+
getCurrentOrganization(sessionId?: string): Promise<Organization | null>;
|
|
48
51
|
/**
|
|
49
52
|
* Switches the current organization to the specified one.
|
|
50
53
|
* @param organization - The organization to switch to.
|
|
51
54
|
* @returns A promise that resolves when the switch is complete.
|
|
52
55
|
*/
|
|
53
|
-
switchOrganization(organization: Organization): Promise<
|
|
56
|
+
switchOrganization(organization: Organization, sessionId?: string): Promise<TokenResponse | Response>;
|
|
54
57
|
getConfiguration(): T;
|
|
58
|
+
updateUserProfile(payload: any, userId?: string): Promise<User>;
|
|
55
59
|
/**
|
|
56
60
|
* Gets user information from the session.
|
|
57
61
|
*
|
|
58
62
|
* @returns User object containing user details.
|
|
59
63
|
*/
|
|
60
|
-
getUser(): Promise<User>;
|
|
64
|
+
getUser(options?: any): Promise<User>;
|
|
61
65
|
/**
|
|
62
66
|
* Fetches the user profile along with its schemas and a flattened version of the profile.
|
|
63
67
|
*
|
|
64
68
|
* @returns A promise resolving to a UserProfile object containing the user's profile information.
|
|
65
69
|
*/
|
|
66
|
-
getUserProfile(): Promise<UserProfile>;
|
|
70
|
+
getUserProfile(options?: any): Promise<UserProfile>;
|
|
67
71
|
/**
|
|
68
72
|
* Initializes the authentication client with provided configuration.
|
|
69
73
|
*
|
package/dist/models/config.d.ts
CHANGED
|
@@ -40,6 +40,20 @@ export interface BaseConfig<T = unknown> extends WithPreferences {
|
|
|
40
40
|
* For production: "https://your-app.com/api/auth/signout"
|
|
41
41
|
*/
|
|
42
42
|
afterSignOutUrl?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Optional organization handle for the Organization in Asgardeo.
|
|
45
|
+
* This is used to identify the organization in the Asgardeo identity server in cases like Branding, etc.
|
|
46
|
+
* If not provided, the framework layer will try to use the `baseUrl` to determine the organization handle.
|
|
47
|
+
* @remarks This is mandatory if a custom domain is configured for the Asgardeo organization.
|
|
48
|
+
*/
|
|
49
|
+
organizationHandle?: string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Optional UUID of the Asgardeo application.
|
|
52
|
+
* This is used to identify the application in the Asgardeo identity server for Application Branding,
|
|
53
|
+
* obtaining the access URL in the sign-up flow, etc.
|
|
54
|
+
* If not provided, the framework layer will use the default application ID based on the application.
|
|
55
|
+
*/
|
|
56
|
+
applicationId?: string | undefined;
|
|
43
57
|
/**
|
|
44
58
|
* The base URL of the Asgardeo identity server.
|
|
45
59
|
* Example: "https://api.asgardeo.io/t/{org_name}"
|
|
@@ -91,6 +105,10 @@ export interface WithPreferences {
|
|
|
91
105
|
}
|
|
92
106
|
export type Config<T = unknown> = BaseConfig<T>;
|
|
93
107
|
export interface ThemePreferences {
|
|
108
|
+
/**
|
|
109
|
+
* Inherit from Branding from WSO2 Identity Server or Asgardeo.
|
|
110
|
+
*/
|
|
111
|
+
inheritFromBranding?: boolean;
|
|
94
112
|
/**
|
|
95
113
|
* The theme mode to use. Defaults to 'system'.
|
|
96
114
|
*/
|
package/dist/models/i18n.d.ts
CHANGED
|
@@ -55,6 +55,16 @@ export interface I18nTranslations {
|
|
|
55
55
|
'organization.switcher.create.organization': string;
|
|
56
56
|
'organization.switcher.manage.organizations': string;
|
|
57
57
|
'organization.switcher.manage.button': string;
|
|
58
|
+
'organization.switcher.organizations.title': string;
|
|
59
|
+
'organization.switcher.switch.button': string;
|
|
60
|
+
'organization.switcher.no.access': string;
|
|
61
|
+
'organization.switcher.status.label': string;
|
|
62
|
+
'organization.switcher.showing.count': string;
|
|
63
|
+
'organization.switcher.refresh.button': string;
|
|
64
|
+
'organization.switcher.load.more': string;
|
|
65
|
+
'organization.switcher.loading.more': string;
|
|
66
|
+
'organization.switcher.no.organizations': string;
|
|
67
|
+
'organization.switcher.error.prefix': string;
|
|
58
68
|
'organization.profile.title': string;
|
|
59
69
|
'organization.profile.loading': string;
|
|
60
70
|
'organization.profile.error': string;
|
|
@@ -22,3 +22,12 @@ export interface Organization {
|
|
|
22
22
|
ref?: string;
|
|
23
23
|
status?: string;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Interface for paginated organization response.
|
|
27
|
+
*/
|
|
28
|
+
export interface AllOrganizationsApiResponse {
|
|
29
|
+
hasMore?: boolean;
|
|
30
|
+
nextCursor?: string;
|
|
31
|
+
organizations: Organization[];
|
|
32
|
+
totalCount?: number;
|
|
33
|
+
}
|
|
@@ -4,7 +4,23 @@
|
|
|
4
4
|
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
6
6
|
* in compliance with the License.
|
|
7
|
-
* You may obtain a
|
|
7
|
+
* You may obtain a cop // Shadows
|
|
8
|
+
if (theme.shadows?.small) {
|
|
9
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
10
|
+
}
|
|
11
|
+
if (theme.shadows?.medium) {
|
|
12
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
13
|
+
}
|
|
14
|
+
if (theme.shadows?.large) {
|
|
15
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Typography - Font Family
|
|
19
|
+
if (theme.typography?.fontFamily) {
|
|
20
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Typography - Font Sizesense at
|
|
8
24
|
*
|
|
9
25
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
26
|
*
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -15,7 +15,43 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
export interface ThemeTypography {
|
|
19
|
+
fontFamily: string;
|
|
20
|
+
fontSizes: {
|
|
21
|
+
xs: string;
|
|
22
|
+
sm: string;
|
|
23
|
+
md: string;
|
|
24
|
+
lg: string;
|
|
25
|
+
xl: string;
|
|
26
|
+
'2xl': string;
|
|
27
|
+
'3xl': string;
|
|
28
|
+
};
|
|
29
|
+
fontWeights: {
|
|
30
|
+
normal: number;
|
|
31
|
+
medium: number;
|
|
32
|
+
semibold: number;
|
|
33
|
+
bold: number;
|
|
34
|
+
};
|
|
35
|
+
lineHeights: {
|
|
36
|
+
tight: number;
|
|
37
|
+
normal: number;
|
|
38
|
+
relaxed: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
18
41
|
export interface ThemeColors {
|
|
42
|
+
action: {
|
|
43
|
+
active: string;
|
|
44
|
+
hover: string;
|
|
45
|
+
hoverOpacity: number;
|
|
46
|
+
selected: string;
|
|
47
|
+
selectedOpacity: number;
|
|
48
|
+
disabled: string;
|
|
49
|
+
disabledBackground: string;
|
|
50
|
+
disabledOpacity: number;
|
|
51
|
+
focus: string;
|
|
52
|
+
focusOpacity: number;
|
|
53
|
+
activatedOpacity: number;
|
|
54
|
+
};
|
|
19
55
|
background: {
|
|
20
56
|
body: {
|
|
21
57
|
main: string;
|
|
@@ -64,8 +100,183 @@ export interface ThemeConfig {
|
|
|
64
100
|
spacing: {
|
|
65
101
|
unit: number;
|
|
66
102
|
};
|
|
103
|
+
typography: {
|
|
104
|
+
fontFamily: string;
|
|
105
|
+
fontSizes: {
|
|
106
|
+
xs: string;
|
|
107
|
+
sm: string;
|
|
108
|
+
md: string;
|
|
109
|
+
lg: string;
|
|
110
|
+
xl: string;
|
|
111
|
+
'2xl': string;
|
|
112
|
+
'3xl': string;
|
|
113
|
+
};
|
|
114
|
+
fontWeights: {
|
|
115
|
+
normal: number;
|
|
116
|
+
medium: number;
|
|
117
|
+
semibold: number;
|
|
118
|
+
bold: number;
|
|
119
|
+
};
|
|
120
|
+
lineHeights: {
|
|
121
|
+
tight: number;
|
|
122
|
+
normal: number;
|
|
123
|
+
relaxed: number;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Image assets configuration
|
|
128
|
+
*/
|
|
129
|
+
images?: ThemeImages;
|
|
130
|
+
/**
|
|
131
|
+
* The prefix used for CSS variables.
|
|
132
|
+
* @default 'asgardeo' (from VendorConstants.VENDOR_PREFIX)
|
|
133
|
+
*/
|
|
134
|
+
cssVarPrefix?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface ThemeVars {
|
|
137
|
+
colors: {
|
|
138
|
+
action: {
|
|
139
|
+
active: string;
|
|
140
|
+
hover: string;
|
|
141
|
+
hoverOpacity: string;
|
|
142
|
+
selected: string;
|
|
143
|
+
selectedOpacity: string;
|
|
144
|
+
disabled: string;
|
|
145
|
+
disabledBackground: string;
|
|
146
|
+
disabledOpacity: string;
|
|
147
|
+
focus: string;
|
|
148
|
+
focusOpacity: string;
|
|
149
|
+
activatedOpacity: string;
|
|
150
|
+
};
|
|
151
|
+
primary: {
|
|
152
|
+
main: string;
|
|
153
|
+
contrastText: string;
|
|
154
|
+
};
|
|
155
|
+
secondary: {
|
|
156
|
+
main: string;
|
|
157
|
+
contrastText: string;
|
|
158
|
+
};
|
|
159
|
+
background: {
|
|
160
|
+
surface: string;
|
|
161
|
+
disabled: string;
|
|
162
|
+
body: {
|
|
163
|
+
main: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
error: {
|
|
167
|
+
main: string;
|
|
168
|
+
contrastText: string;
|
|
169
|
+
};
|
|
170
|
+
success: {
|
|
171
|
+
main: string;
|
|
172
|
+
contrastText: string;
|
|
173
|
+
};
|
|
174
|
+
warning: {
|
|
175
|
+
main: string;
|
|
176
|
+
contrastText: string;
|
|
177
|
+
};
|
|
178
|
+
text: {
|
|
179
|
+
primary: string;
|
|
180
|
+
secondary: string;
|
|
181
|
+
};
|
|
182
|
+
border: string;
|
|
183
|
+
};
|
|
184
|
+
spacing: {
|
|
185
|
+
unit: string;
|
|
186
|
+
};
|
|
187
|
+
borderRadius: {
|
|
188
|
+
small: string;
|
|
189
|
+
medium: string;
|
|
190
|
+
large: string;
|
|
191
|
+
};
|
|
192
|
+
shadows: {
|
|
193
|
+
small: string;
|
|
194
|
+
medium: string;
|
|
195
|
+
large: string;
|
|
196
|
+
};
|
|
197
|
+
typography: {
|
|
198
|
+
fontFamily: string;
|
|
199
|
+
fontSizes: {
|
|
200
|
+
xs: string;
|
|
201
|
+
sm: string;
|
|
202
|
+
md: string;
|
|
203
|
+
lg: string;
|
|
204
|
+
xl: string;
|
|
205
|
+
'2xl': string;
|
|
206
|
+
'3xl': string;
|
|
207
|
+
};
|
|
208
|
+
fontWeights: {
|
|
209
|
+
normal: string;
|
|
210
|
+
medium: string;
|
|
211
|
+
semibold: string;
|
|
212
|
+
bold: string;
|
|
213
|
+
};
|
|
214
|
+
lineHeights: {
|
|
215
|
+
tight: string;
|
|
216
|
+
normal: string;
|
|
217
|
+
relaxed: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
images?: {
|
|
221
|
+
favicon?: {
|
|
222
|
+
url?: string;
|
|
223
|
+
title?: string;
|
|
224
|
+
alt?: string;
|
|
225
|
+
};
|
|
226
|
+
logo?: {
|
|
227
|
+
url?: string;
|
|
228
|
+
title?: string;
|
|
229
|
+
alt?: string;
|
|
230
|
+
};
|
|
231
|
+
[key: string]: {
|
|
232
|
+
url?: string;
|
|
233
|
+
title?: string;
|
|
234
|
+
alt?: string;
|
|
235
|
+
} | undefined;
|
|
236
|
+
};
|
|
67
237
|
}
|
|
68
238
|
export interface Theme extends ThemeConfig {
|
|
69
239
|
cssVariables: Record<string, string>;
|
|
240
|
+
vars: ThemeVars;
|
|
241
|
+
}
|
|
242
|
+
export type ThemeMode = 'light' | 'dark' | 'system' | 'class';
|
|
243
|
+
export interface ThemeDetection {
|
|
244
|
+
/**
|
|
245
|
+
* The CSS class name to detect for dark mode (without the dot)
|
|
246
|
+
* @default 'dark'
|
|
247
|
+
*/
|
|
248
|
+
darkClass?: string;
|
|
249
|
+
/**
|
|
250
|
+
* The CSS class name to detect for light mode (without the dot)
|
|
251
|
+
* @default 'light'
|
|
252
|
+
*/
|
|
253
|
+
lightClass?: string;
|
|
254
|
+
}
|
|
255
|
+
export interface ThemeImage {
|
|
256
|
+
/**
|
|
257
|
+
* The URL of the image
|
|
258
|
+
*/
|
|
259
|
+
url?: string;
|
|
260
|
+
/**
|
|
261
|
+
* The title/alt text for the image
|
|
262
|
+
*/
|
|
263
|
+
title?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Alternative text for accessibility
|
|
266
|
+
*/
|
|
267
|
+
alt?: string;
|
|
268
|
+
}
|
|
269
|
+
export interface ThemeImages {
|
|
270
|
+
/**
|
|
271
|
+
* Favicon configuration
|
|
272
|
+
*/
|
|
273
|
+
favicon?: ThemeImage;
|
|
274
|
+
/**
|
|
275
|
+
* Logo configuration
|
|
276
|
+
*/
|
|
277
|
+
logo?: ThemeImage;
|
|
278
|
+
/**
|
|
279
|
+
* Allow for additional custom images
|
|
280
|
+
*/
|
|
281
|
+
[key: string]: ThemeImage | undefined;
|
|
70
282
|
}
|
|
71
|
-
export type ThemeMode = 'light' | 'dark' | 'system';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Extracts the organization handle from an Asgardeo base URL.
|
|
20
|
+
*
|
|
21
|
+
* This function parses Asgardeo URLs with the standard pattern:
|
|
22
|
+
* - https://dev.asgardeo.io/t/{orgHandle}
|
|
23
|
+
* - https://stage.asgardeo.io/t/{orgHandle}
|
|
24
|
+
* - https://prod.asgardeo.io/t/{orgHandle}
|
|
25
|
+
* - https://{subdomain}.asgardeo.io/t/{orgHandle}
|
|
26
|
+
*
|
|
27
|
+
* @param baseUrl - The base URL of the Asgardeo identity server
|
|
28
|
+
* @returns The extracted organization handle
|
|
29
|
+
* @throws {AsgardeoRuntimeError} When the URL doesn't match the expected Asgardeo pattern,
|
|
30
|
+
* indicating a custom domain is configured and organizationHandle must be provided explicitly
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Standard Asgardeo URLs
|
|
35
|
+
* const handle1 = deriveOrganizationHandleFromBaseUrl('https://dev.asgardeo.io/t/dxlab');
|
|
36
|
+
* // Returns: 'dxlab'
|
|
37
|
+
*
|
|
38
|
+
* const handle2 = deriveOrganizationHandleFromBaseUrl('https://stage.asgardeo.io/t/myorg');
|
|
39
|
+
* // Returns: 'myorg'
|
|
40
|
+
*
|
|
41
|
+
* // Custom domain - throws error
|
|
42
|
+
* deriveOrganizationHandleFromBaseUrl('https://custom.example.com/auth');
|
|
43
|
+
* // Throws: AsgardeoRuntimeError
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
declare const deriveOrganizationHandleFromBaseUrl: (baseUrl?: string) => string;
|
|
47
|
+
export default deriveOrganizationHandleFromBaseUrl;
|