@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
package/dist/cjs/index.js
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
createPatchOperations: () => createPatchOperations,
|
|
51
51
|
createTheme: () => createTheme_default,
|
|
52
52
|
deepMerge: () => deepMerge_default,
|
|
53
|
+
deriveOrganizationHandleFromBaseUrl: () => deriveOrganizationHandleFromBaseUrl_default,
|
|
53
54
|
executeEmbeddedSignInFlow: () => executeEmbeddedSignInFlow_default,
|
|
54
55
|
executeEmbeddedSignUpFlow: () => executeEmbeddedSignUpFlow_default,
|
|
55
56
|
extractPkceStorageKeyFromState: () => extractPkceStorageKeyFromState_default,
|
|
@@ -59,6 +60,7 @@ __export(index_exports, {
|
|
|
59
60
|
generateUserProfile: () => generateUserProfile_default,
|
|
60
61
|
get: () => get_default,
|
|
61
62
|
getAllOrganizations: () => getAllOrganizations_default,
|
|
63
|
+
getBrandingPreference: () => getBrandingPreference_default,
|
|
62
64
|
getI18nBundles: () => getI18nBundles_default,
|
|
63
65
|
getLatestStateParam: () => getLatestStateParam_default,
|
|
64
66
|
getMeOrganizations: () => getMeOrganizations_default,
|
|
@@ -69,10 +71,12 @@ __export(index_exports, {
|
|
|
69
71
|
initializeEmbeddedSignInFlow: () => initializeEmbeddedSignInFlow_default,
|
|
70
72
|
isEmpty: () => isEmpty_default,
|
|
71
73
|
processOpenIDScopes: () => processOpenIDScopes_default,
|
|
74
|
+
processUsername: () => processUsername_default,
|
|
72
75
|
removeTrailingSlash: () => removeTrailingSlash_default,
|
|
73
76
|
resolveFieldName: () => resolveFieldName_default,
|
|
74
77
|
resolveFieldType: () => resolveFieldType_default,
|
|
75
78
|
set: () => set_default,
|
|
79
|
+
transformBrandingPreferenceToTheme: () => transformBrandingPreferenceToTheme_default,
|
|
76
80
|
updateMeProfile: () => updateMeProfile_default,
|
|
77
81
|
updateOrganization: () => updateOrganization_default,
|
|
78
82
|
withVendorCSSClassPrefix: () => withVendorCSSClassPrefix_default
|
|
@@ -2022,16 +2026,15 @@ var initializeEmbeddedSignInFlow = async ({
|
|
|
2022
2026
|
searchParams.append(key, String(value));
|
|
2023
2027
|
}
|
|
2024
2028
|
});
|
|
2025
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
2026
2029
|
const response = await fetch(url ?? `${baseUrl}/oauth2/authorize`, {
|
|
2030
|
+
...requestConfig,
|
|
2027
2031
|
method: requestConfig.method || "POST",
|
|
2028
2032
|
headers: {
|
|
2033
|
+
...requestConfig.headers,
|
|
2029
2034
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
2030
|
-
Accept: "application/json"
|
|
2031
|
-
...customHeaders
|
|
2035
|
+
Accept: "application/json"
|
|
2032
2036
|
},
|
|
2033
|
-
body: searchParams.toString()
|
|
2034
|
-
...otherConfig
|
|
2037
|
+
body: searchParams.toString()
|
|
2035
2038
|
});
|
|
2036
2039
|
if (!response.ok) {
|
|
2037
2040
|
const errorText = await response.text();
|
|
@@ -2063,16 +2066,15 @@ var executeEmbeddedSignInFlow = async ({
|
|
|
2063
2066
|
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
2064
2067
|
);
|
|
2065
2068
|
}
|
|
2066
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
2067
2069
|
const response = await fetch(url ?? `${baseUrl}/oauth2/authn`, {
|
|
2070
|
+
...requestConfig,
|
|
2068
2071
|
method: requestConfig.method || "POST",
|
|
2069
2072
|
headers: {
|
|
2070
2073
|
"Content-Type": "application/json",
|
|
2071
2074
|
Accept: "application/json",
|
|
2072
|
-
...
|
|
2075
|
+
...requestConfig.headers
|
|
2073
2076
|
},
|
|
2074
|
-
body: JSON.stringify(payload)
|
|
2075
|
-
...otherConfig
|
|
2077
|
+
body: JSON.stringify(payload)
|
|
2076
2078
|
});
|
|
2077
2079
|
if (!response.ok) {
|
|
2078
2080
|
const errorText = await response.text();
|
|
@@ -2132,19 +2134,18 @@ var executeEmbeddedSignUpFlow = async ({
|
|
|
2132
2134
|
"At least one of the baseUrl or url must be provided to execute the embedded sign up flow."
|
|
2133
2135
|
);
|
|
2134
2136
|
}
|
|
2135
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
2136
2137
|
const response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {
|
|
2138
|
+
...requestConfig,
|
|
2137
2139
|
method: requestConfig.method || "POST",
|
|
2138
2140
|
headers: {
|
|
2139
2141
|
"Content-Type": "application/json",
|
|
2140
2142
|
Accept: "application/json",
|
|
2141
|
-
...
|
|
2143
|
+
...requestConfig.headers
|
|
2142
2144
|
},
|
|
2143
2145
|
body: JSON.stringify({
|
|
2144
2146
|
...payload ?? {},
|
|
2145
2147
|
flowType: "REGISTRATION" /* Registration */
|
|
2146
|
-
})
|
|
2147
|
-
...otherConfig
|
|
2148
|
+
})
|
|
2148
2149
|
});
|
|
2149
2150
|
if (!response.ok) {
|
|
2150
2151
|
const errorText = await response.text();
|
|
@@ -2174,12 +2175,13 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2174
2175
|
);
|
|
2175
2176
|
}
|
|
2176
2177
|
const response = await fetch(url, {
|
|
2178
|
+
...requestConfig,
|
|
2177
2179
|
method: "GET",
|
|
2178
2180
|
headers: {
|
|
2179
2181
|
"Content-Type": "application/json",
|
|
2180
|
-
Accept: "application/json"
|
|
2181
|
-
|
|
2182
|
-
|
|
2182
|
+
Accept: "application/json",
|
|
2183
|
+
...requestConfig.headers
|
|
2184
|
+
}
|
|
2183
2185
|
});
|
|
2184
2186
|
if (!response.ok) {
|
|
2185
2187
|
const errorText = await response.text();
|
|
@@ -2195,6 +2197,32 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2195
2197
|
};
|
|
2196
2198
|
var getUserInfo_default = getUserInfo;
|
|
2197
2199
|
|
|
2200
|
+
// src/utils/processUsername.ts
|
|
2201
|
+
var USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
2202
|
+
var removeUserstorePrefix = (username) => {
|
|
2203
|
+
if (!username) {
|
|
2204
|
+
return "";
|
|
2205
|
+
}
|
|
2206
|
+
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
2207
|
+
};
|
|
2208
|
+
var processUsername = (user) => {
|
|
2209
|
+
if (!user) {
|
|
2210
|
+
return user;
|
|
2211
|
+
}
|
|
2212
|
+
const processedUser = { ...user };
|
|
2213
|
+
if (processedUser.username) {
|
|
2214
|
+
processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
2215
|
+
}
|
|
2216
|
+
if (processedUser.userName) {
|
|
2217
|
+
processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
2218
|
+
}
|
|
2219
|
+
if (processedUser.user_name) {
|
|
2220
|
+
processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
2221
|
+
}
|
|
2222
|
+
return processedUser;
|
|
2223
|
+
};
|
|
2224
|
+
var processUsername_default = processUsername;
|
|
2225
|
+
|
|
2198
2226
|
// src/api/getScim2Me.ts
|
|
2199
2227
|
var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
2200
2228
|
try {
|
|
@@ -2211,13 +2239,13 @@ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2211
2239
|
const fetchFn = fetcher || fetch;
|
|
2212
2240
|
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
2213
2241
|
const requestInit = {
|
|
2242
|
+
...requestConfig,
|
|
2214
2243
|
method: "GET",
|
|
2215
2244
|
headers: {
|
|
2216
2245
|
"Content-Type": "application/scim+json",
|
|
2217
2246
|
Accept: "application/json",
|
|
2218
2247
|
...requestConfig.headers
|
|
2219
|
-
}
|
|
2220
|
-
...requestConfig
|
|
2248
|
+
}
|
|
2221
2249
|
};
|
|
2222
2250
|
try {
|
|
2223
2251
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2231,7 +2259,8 @@ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2231
2259
|
response.statusText
|
|
2232
2260
|
);
|
|
2233
2261
|
}
|
|
2234
|
-
|
|
2262
|
+
const user = await response.json();
|
|
2263
|
+
return processUsername_default(user);
|
|
2235
2264
|
} catch (error) {
|
|
2236
2265
|
if (error instanceof AsgardeoAPIError) {
|
|
2237
2266
|
throw error;
|
|
@@ -2263,13 +2292,13 @@ var getSchemas = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2263
2292
|
const fetchFn = fetcher || fetch;
|
|
2264
2293
|
const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
|
|
2265
2294
|
const requestInit = {
|
|
2295
|
+
...requestConfig,
|
|
2266
2296
|
method: "GET",
|
|
2267
2297
|
headers: {
|
|
2268
2298
|
"Content-Type": "application/json",
|
|
2269
2299
|
Accept: "application/json",
|
|
2270
2300
|
...requestConfig.headers
|
|
2271
|
-
}
|
|
2272
|
-
...requestConfig
|
|
2301
|
+
}
|
|
2273
2302
|
};
|
|
2274
2303
|
try {
|
|
2275
2304
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2331,13 +2360,13 @@ var getAllOrganizations = async ({
|
|
|
2331
2360
|
const fetchFn = fetcher || fetch;
|
|
2332
2361
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;
|
|
2333
2362
|
const requestInit = {
|
|
2363
|
+
...requestConfig,
|
|
2334
2364
|
method: "GET",
|
|
2335
2365
|
headers: {
|
|
2366
|
+
...requestConfig.headers,
|
|
2336
2367
|
"Content-Type": "application/json",
|
|
2337
|
-
Accept: "application/json"
|
|
2338
|
-
|
|
2339
|
-
},
|
|
2340
|
-
...requestConfig
|
|
2368
|
+
Accept: "application/json"
|
|
2369
|
+
}
|
|
2341
2370
|
};
|
|
2342
2371
|
try {
|
|
2343
2372
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2407,14 +2436,14 @@ var createOrganization = async ({
|
|
|
2407
2436
|
const fetchFn = fetcher || fetch;
|
|
2408
2437
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations`;
|
|
2409
2438
|
const requestInit = {
|
|
2439
|
+
...requestConfig,
|
|
2410
2440
|
method: "POST",
|
|
2411
2441
|
headers: {
|
|
2412
2442
|
"Content-Type": "application/json",
|
|
2413
2443
|
Accept: "application/json",
|
|
2414
2444
|
...requestConfig.headers
|
|
2415
2445
|
},
|
|
2416
|
-
body: JSON.stringify(organizationPayload)
|
|
2417
|
-
...requestConfig
|
|
2446
|
+
body: JSON.stringify(organizationPayload)
|
|
2418
2447
|
};
|
|
2419
2448
|
try {
|
|
2420
2449
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2482,13 +2511,13 @@ var getMeOrganizations = async ({
|
|
|
2482
2511
|
const fetchFn = fetcher || fetch;
|
|
2483
2512
|
const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;
|
|
2484
2513
|
const requestInit = {
|
|
2514
|
+
...requestConfig,
|
|
2485
2515
|
method: "GET",
|
|
2486
2516
|
headers: {
|
|
2487
2517
|
"Content-Type": "application/json",
|
|
2488
2518
|
Accept: "application/json",
|
|
2489
2519
|
...requestConfig.headers
|
|
2490
|
-
}
|
|
2491
|
-
...requestConfig
|
|
2520
|
+
}
|
|
2492
2521
|
};
|
|
2493
2522
|
try {
|
|
2494
2523
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2549,13 +2578,13 @@ var getOrganization = async ({
|
|
|
2549
2578
|
const fetchFn = fetcher || fetch;
|
|
2550
2579
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
2551
2580
|
const requestInit = {
|
|
2581
|
+
...requestConfig,
|
|
2552
2582
|
method: "GET",
|
|
2553
2583
|
headers: {
|
|
2554
2584
|
"Content-Type": "application/json",
|
|
2555
2585
|
Accept: "application/json",
|
|
2556
2586
|
...requestConfig.headers
|
|
2557
|
-
}
|
|
2558
|
-
...requestConfig
|
|
2587
|
+
}
|
|
2559
2588
|
};
|
|
2560
2589
|
try {
|
|
2561
2590
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2643,14 +2672,14 @@ var updateOrganization = async ({
|
|
|
2643
2672
|
const fetchFn = fetcher || fetch;
|
|
2644
2673
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
2645
2674
|
const requestInit = {
|
|
2675
|
+
...requestConfig,
|
|
2646
2676
|
method: "PATCH",
|
|
2647
2677
|
headers: {
|
|
2648
2678
|
"Content-Type": "application/json",
|
|
2649
2679
|
Accept: "application/json",
|
|
2650
2680
|
...requestConfig.headers
|
|
2651
2681
|
},
|
|
2652
|
-
body: JSON.stringify(operations)
|
|
2653
|
-
...requestConfig
|
|
2682
|
+
body: JSON.stringify(operations)
|
|
2654
2683
|
};
|
|
2655
2684
|
try {
|
|
2656
2685
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2727,13 +2756,13 @@ var updateMeProfile = async ({
|
|
|
2727
2756
|
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
2728
2757
|
const requestInit = {
|
|
2729
2758
|
method: "PATCH",
|
|
2759
|
+
...requestConfig,
|
|
2730
2760
|
headers: {
|
|
2761
|
+
...requestConfig.headers,
|
|
2731
2762
|
"Content-Type": "application/scim+json",
|
|
2732
|
-
Accept: "application/json"
|
|
2733
|
-
...requestConfig.headers
|
|
2763
|
+
Accept: "application/json"
|
|
2734
2764
|
},
|
|
2735
|
-
body: JSON.stringify(data)
|
|
2736
|
-
...requestConfig
|
|
2765
|
+
body: JSON.stringify(data)
|
|
2737
2766
|
};
|
|
2738
2767
|
try {
|
|
2739
2768
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2763,6 +2792,75 @@ var updateMeProfile = async ({
|
|
|
2763
2792
|
};
|
|
2764
2793
|
var updateMeProfile_default = updateMeProfile;
|
|
2765
2794
|
|
|
2795
|
+
// src/api/getBrandingPreference.ts
|
|
2796
|
+
var getBrandingPreference = async ({
|
|
2797
|
+
baseUrl,
|
|
2798
|
+
locale,
|
|
2799
|
+
name,
|
|
2800
|
+
type,
|
|
2801
|
+
fetcher,
|
|
2802
|
+
...requestConfig
|
|
2803
|
+
}) => {
|
|
2804
|
+
try {
|
|
2805
|
+
new URL(baseUrl);
|
|
2806
|
+
} catch (error) {
|
|
2807
|
+
throw new AsgardeoAPIError(
|
|
2808
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2809
|
+
"getBrandingPreference-ValidationError-001",
|
|
2810
|
+
"javascript",
|
|
2811
|
+
400,
|
|
2812
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2813
|
+
);
|
|
2814
|
+
}
|
|
2815
|
+
const queryParams = new URLSearchParams(
|
|
2816
|
+
Object.fromEntries(
|
|
2817
|
+
Object.entries({
|
|
2818
|
+
locale: locale || "",
|
|
2819
|
+
name: name || "",
|
|
2820
|
+
type: type || ""
|
|
2821
|
+
}).filter(([, value]) => Boolean(value))
|
|
2822
|
+
)
|
|
2823
|
+
);
|
|
2824
|
+
const fetchFn = fetcher || fetch;
|
|
2825
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2826
|
+
const requestInit = {
|
|
2827
|
+
...requestConfig,
|
|
2828
|
+
method: "GET",
|
|
2829
|
+
headers: {
|
|
2830
|
+
"Content-Type": "application/json",
|
|
2831
|
+
Accept: "application/json",
|
|
2832
|
+
...requestConfig.headers
|
|
2833
|
+
}
|
|
2834
|
+
};
|
|
2835
|
+
try {
|
|
2836
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2837
|
+
if (!response?.ok) {
|
|
2838
|
+
const errorText = await response.text();
|
|
2839
|
+
throw new AsgardeoAPIError(
|
|
2840
|
+
`Failed to get branding preference: ${errorText}`,
|
|
2841
|
+
"getBrandingPreference-ResponseError-001",
|
|
2842
|
+
"javascript",
|
|
2843
|
+
response.status,
|
|
2844
|
+
response.statusText
|
|
2845
|
+
);
|
|
2846
|
+
}
|
|
2847
|
+
const data = await response.json();
|
|
2848
|
+
return data;
|
|
2849
|
+
} catch (error) {
|
|
2850
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2851
|
+
throw error;
|
|
2852
|
+
}
|
|
2853
|
+
throw new AsgardeoAPIError(
|
|
2854
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2855
|
+
"getBrandingPreference-NetworkError-001",
|
|
2856
|
+
"javascript",
|
|
2857
|
+
0,
|
|
2858
|
+
"Network Error"
|
|
2859
|
+
);
|
|
2860
|
+
}
|
|
2861
|
+
};
|
|
2862
|
+
var getBrandingPreference_default = getBrandingPreference;
|
|
2863
|
+
|
|
2766
2864
|
// src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
2767
2865
|
var ApplicationNativeAuthenticationConstants = {
|
|
2768
2866
|
SupportedAuthenticators: {
|
|
@@ -2868,6 +2966,19 @@ var AsgardeoJavaScriptClient_default = AsgardeoJavaScriptClient;
|
|
|
2868
2966
|
// src/theme/createTheme.ts
|
|
2869
2967
|
var lightTheme = {
|
|
2870
2968
|
colors: {
|
|
2969
|
+
action: {
|
|
2970
|
+
active: "rgba(0, 0, 0, 0.54)",
|
|
2971
|
+
hover: "rgba(0, 0, 0, 0.04)",
|
|
2972
|
+
hoverOpacity: 0.04,
|
|
2973
|
+
selected: "rgba(0, 0, 0, 0.08)",
|
|
2974
|
+
selectedOpacity: 0.08,
|
|
2975
|
+
disabled: "rgba(0, 0, 0, 0.26)",
|
|
2976
|
+
disabledBackground: "rgba(0, 0, 0, 0.12)",
|
|
2977
|
+
disabledOpacity: 0.38,
|
|
2978
|
+
focus: "rgba(0, 0, 0, 0.12)",
|
|
2979
|
+
focusOpacity: 0.12,
|
|
2980
|
+
activatedOpacity: 0.12
|
|
2981
|
+
},
|
|
2871
2982
|
primary: {
|
|
2872
2983
|
main: "#1a73e8",
|
|
2873
2984
|
contrastText: "#ffffff"
|
|
@@ -2913,10 +3024,57 @@ var lightTheme = {
|
|
|
2913
3024
|
small: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
2914
3025
|
medium: "0 4px 16px rgba(0, 0, 0, 0.15)",
|
|
2915
3026
|
large: "0 8px 32px rgba(0, 0, 0, 0.2)"
|
|
3027
|
+
},
|
|
3028
|
+
typography: {
|
|
3029
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
3030
|
+
fontSizes: {
|
|
3031
|
+
xs: "0.75rem",
|
|
3032
|
+
// 12px
|
|
3033
|
+
sm: "0.875rem",
|
|
3034
|
+
// 14px
|
|
3035
|
+
md: "1rem",
|
|
3036
|
+
// 16px
|
|
3037
|
+
lg: "1.125rem",
|
|
3038
|
+
// 18px
|
|
3039
|
+
xl: "1.25rem",
|
|
3040
|
+
// 20px
|
|
3041
|
+
"2xl": "1.5rem",
|
|
3042
|
+
// 24px
|
|
3043
|
+
"3xl": "2.125rem"
|
|
3044
|
+
// 34px
|
|
3045
|
+
},
|
|
3046
|
+
fontWeights: {
|
|
3047
|
+
normal: 400,
|
|
3048
|
+
medium: 500,
|
|
3049
|
+
semibold: 600,
|
|
3050
|
+
bold: 700
|
|
3051
|
+
},
|
|
3052
|
+
lineHeights: {
|
|
3053
|
+
tight: 1.2,
|
|
3054
|
+
normal: 1.4,
|
|
3055
|
+
relaxed: 1.6
|
|
3056
|
+
}
|
|
3057
|
+
},
|
|
3058
|
+
images: {
|
|
3059
|
+
favicon: {},
|
|
3060
|
+
logo: {}
|
|
2916
3061
|
}
|
|
2917
3062
|
};
|
|
2918
3063
|
var darkTheme = {
|
|
2919
3064
|
colors: {
|
|
3065
|
+
action: {
|
|
3066
|
+
active: "rgba(255, 255, 255, 0.70)",
|
|
3067
|
+
hover: "rgba(255, 255, 255, 0.04)",
|
|
3068
|
+
hoverOpacity: 0.04,
|
|
3069
|
+
selected: "rgba(255, 255, 255, 0.08)",
|
|
3070
|
+
selectedOpacity: 0.08,
|
|
3071
|
+
disabled: "rgba(255, 255, 255, 0.26)",
|
|
3072
|
+
disabledBackground: "rgba(255, 255, 255, 0.12)",
|
|
3073
|
+
disabledOpacity: 0.38,
|
|
3074
|
+
focus: "rgba(255, 255, 255, 0.12)",
|
|
3075
|
+
focusOpacity: 0.12,
|
|
3076
|
+
activatedOpacity: 0.12
|
|
3077
|
+
},
|
|
2920
3078
|
primary: {
|
|
2921
3079
|
main: "#1a73e8",
|
|
2922
3080
|
contrastText: "#ffffff"
|
|
@@ -2962,35 +3120,308 @@ var darkTheme = {
|
|
|
2962
3120
|
small: "0 2px 8px rgba(0, 0, 0, 0.3)",
|
|
2963
3121
|
medium: "0 4px 16px rgba(0, 0, 0, 0.4)",
|
|
2964
3122
|
large: "0 8px 32px rgba(0, 0, 0, 0.5)"
|
|
3123
|
+
},
|
|
3124
|
+
typography: {
|
|
3125
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
3126
|
+
fontSizes: {
|
|
3127
|
+
xs: "0.75rem",
|
|
3128
|
+
// 12px
|
|
3129
|
+
sm: "0.875rem",
|
|
3130
|
+
// 14px
|
|
3131
|
+
md: "1rem",
|
|
3132
|
+
// 16px
|
|
3133
|
+
lg: "1.125rem",
|
|
3134
|
+
// 18px
|
|
3135
|
+
xl: "1.25rem",
|
|
3136
|
+
// 20px
|
|
3137
|
+
"2xl": "1.5rem",
|
|
3138
|
+
// 24px
|
|
3139
|
+
"3xl": "2.125rem"
|
|
3140
|
+
// 34px
|
|
3141
|
+
},
|
|
3142
|
+
fontWeights: {
|
|
3143
|
+
normal: 400,
|
|
3144
|
+
medium: 500,
|
|
3145
|
+
semibold: 600,
|
|
3146
|
+
bold: 700
|
|
3147
|
+
},
|
|
3148
|
+
lineHeights: {
|
|
3149
|
+
tight: 1.2,
|
|
3150
|
+
normal: 1.4,
|
|
3151
|
+
relaxed: 1.6
|
|
3152
|
+
}
|
|
3153
|
+
},
|
|
3154
|
+
images: {
|
|
3155
|
+
favicon: {},
|
|
3156
|
+
logo: {}
|
|
2965
3157
|
}
|
|
2966
3158
|
};
|
|
2967
3159
|
var toCssVariables = (theme) => {
|
|
2968
3160
|
const cssVars = {};
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
3161
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
3162
|
+
if (theme.colors?.action?.active) {
|
|
3163
|
+
cssVars[`--${prefix}-color-action-active`] = theme.colors.action.active;
|
|
3164
|
+
}
|
|
3165
|
+
if (theme.colors?.action?.hover) {
|
|
3166
|
+
cssVars[`--${prefix}-color-action-hover`] = theme.colors.action.hover;
|
|
3167
|
+
}
|
|
3168
|
+
if (theme.colors?.action?.hoverOpacity !== void 0) {
|
|
3169
|
+
cssVars[`--${prefix}-color-action-hoverOpacity`] = theme.colors.action.hoverOpacity.toString();
|
|
3170
|
+
}
|
|
3171
|
+
if (theme.colors?.action?.selected) {
|
|
3172
|
+
cssVars[`--${prefix}-color-action-selected`] = theme.colors.action.selected;
|
|
3173
|
+
}
|
|
3174
|
+
if (theme.colors?.action?.selectedOpacity !== void 0) {
|
|
3175
|
+
cssVars[`--${prefix}-color-action-selectedOpacity`] = theme.colors.action.selectedOpacity.toString();
|
|
3176
|
+
}
|
|
3177
|
+
if (theme.colors?.action?.disabled) {
|
|
3178
|
+
cssVars[`--${prefix}-color-action-disabled`] = theme.colors.action.disabled;
|
|
3179
|
+
}
|
|
3180
|
+
if (theme.colors?.action?.disabledBackground) {
|
|
3181
|
+
cssVars[`--${prefix}-color-action-disabledBackground`] = theme.colors.action.disabledBackground;
|
|
3182
|
+
}
|
|
3183
|
+
if (theme.colors?.action?.disabledOpacity !== void 0) {
|
|
3184
|
+
cssVars[`--${prefix}-color-action-disabledOpacity`] = theme.colors.action.disabledOpacity.toString();
|
|
3185
|
+
}
|
|
3186
|
+
if (theme.colors?.action?.focus) {
|
|
3187
|
+
cssVars[`--${prefix}-color-action-focus`] = theme.colors.action.focus;
|
|
3188
|
+
}
|
|
3189
|
+
if (theme.colors?.action?.focusOpacity !== void 0) {
|
|
3190
|
+
cssVars[`--${prefix}-color-action-focusOpacity`] = theme.colors.action.focusOpacity.toString();
|
|
3191
|
+
}
|
|
3192
|
+
if (theme.colors?.action?.activatedOpacity !== void 0) {
|
|
3193
|
+
cssVars[`--${prefix}-color-action-activatedOpacity`] = theme.colors.action.activatedOpacity.toString();
|
|
3194
|
+
}
|
|
3195
|
+
if (theme.colors?.primary?.main) {
|
|
3196
|
+
cssVars[`--${prefix}-color-primary-main`] = theme.colors.primary.main;
|
|
3197
|
+
}
|
|
3198
|
+
if (theme.colors?.primary?.contrastText) {
|
|
3199
|
+
cssVars[`--${prefix}-color-primary-contrastText`] = theme.colors.primary.contrastText;
|
|
3200
|
+
}
|
|
3201
|
+
if (theme.colors?.secondary?.main) {
|
|
3202
|
+
cssVars[`--${prefix}-color-secondary-main`] = theme.colors.secondary.main;
|
|
3203
|
+
}
|
|
3204
|
+
if (theme.colors?.secondary?.contrastText) {
|
|
3205
|
+
cssVars[`--${prefix}-color-secondary-contrastText`] = theme.colors.secondary.contrastText;
|
|
3206
|
+
}
|
|
3207
|
+
if (theme.colors?.background?.surface) {
|
|
3208
|
+
cssVars[`--${prefix}-color-background-surface`] = theme.colors.background.surface;
|
|
3209
|
+
}
|
|
3210
|
+
if (theme.colors?.background?.disabled) {
|
|
3211
|
+
cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;
|
|
3212
|
+
}
|
|
3213
|
+
if (theme.colors?.background?.body?.main) {
|
|
3214
|
+
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
3215
|
+
}
|
|
3216
|
+
if (theme.colors?.error?.main) {
|
|
3217
|
+
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
3218
|
+
}
|
|
3219
|
+
if (theme.colors?.error?.contrastText) {
|
|
3220
|
+
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
3221
|
+
}
|
|
3222
|
+
if (theme.colors?.success?.main) {
|
|
3223
|
+
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
3224
|
+
}
|
|
3225
|
+
if (theme.colors?.success?.contrastText) {
|
|
3226
|
+
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
3227
|
+
}
|
|
3228
|
+
if (theme.colors?.warning?.main) {
|
|
3229
|
+
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
3230
|
+
}
|
|
3231
|
+
if (theme.colors?.warning?.contrastText) {
|
|
3232
|
+
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
3233
|
+
}
|
|
3234
|
+
if (theme.colors?.text?.primary) {
|
|
3235
|
+
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
3236
|
+
}
|
|
3237
|
+
if (theme.colors?.text?.secondary) {
|
|
3238
|
+
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
3239
|
+
}
|
|
3240
|
+
if (theme.colors?.border) {
|
|
3241
|
+
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
3242
|
+
}
|
|
3243
|
+
if (theme.spacing?.unit !== void 0) {
|
|
3244
|
+
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
3245
|
+
}
|
|
3246
|
+
if (theme.borderRadius?.small) {
|
|
3247
|
+
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
3248
|
+
}
|
|
3249
|
+
if (theme.borderRadius?.medium) {
|
|
3250
|
+
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
3251
|
+
}
|
|
3252
|
+
if (theme.borderRadius?.large) {
|
|
3253
|
+
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
3254
|
+
}
|
|
3255
|
+
if (theme.shadows?.small) {
|
|
3256
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
3257
|
+
}
|
|
3258
|
+
if (theme.shadows?.medium) {
|
|
3259
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
3260
|
+
}
|
|
3261
|
+
if (theme.shadows?.large) {
|
|
3262
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
3263
|
+
}
|
|
3264
|
+
if (theme.typography?.fontFamily) {
|
|
3265
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
3266
|
+
}
|
|
3267
|
+
if (theme.typography?.fontSizes?.xs) {
|
|
3268
|
+
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
3269
|
+
}
|
|
3270
|
+
if (theme.typography?.fontSizes?.sm) {
|
|
3271
|
+
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
3272
|
+
}
|
|
3273
|
+
if (theme.typography?.fontSizes?.md) {
|
|
3274
|
+
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
3275
|
+
}
|
|
3276
|
+
if (theme.typography?.fontSizes?.lg) {
|
|
3277
|
+
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
3278
|
+
}
|
|
3279
|
+
if (theme.typography?.fontSizes?.xl) {
|
|
3280
|
+
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
3281
|
+
}
|
|
3282
|
+
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
3283
|
+
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
3284
|
+
}
|
|
3285
|
+
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
3286
|
+
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
3287
|
+
}
|
|
3288
|
+
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
3289
|
+
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
3290
|
+
}
|
|
3291
|
+
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
3292
|
+
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
3293
|
+
}
|
|
3294
|
+
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
3295
|
+
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
3296
|
+
}
|
|
3297
|
+
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
3298
|
+
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
3299
|
+
}
|
|
3300
|
+
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
3301
|
+
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
3302
|
+
}
|
|
3303
|
+
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
3304
|
+
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
3305
|
+
}
|
|
3306
|
+
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
3307
|
+
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
3308
|
+
}
|
|
3309
|
+
if (theme.images) {
|
|
3310
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
3311
|
+
const imageConfig = theme.images[imageKey];
|
|
3312
|
+
if (imageConfig?.url) {
|
|
3313
|
+
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
3314
|
+
}
|
|
3315
|
+
if (imageConfig?.title) {
|
|
3316
|
+
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
3317
|
+
}
|
|
3318
|
+
if (imageConfig?.alt) {
|
|
3319
|
+
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
3320
|
+
}
|
|
3321
|
+
});
|
|
3322
|
+
}
|
|
2992
3323
|
return cssVars;
|
|
2993
3324
|
};
|
|
3325
|
+
var toThemeVars = (theme) => {
|
|
3326
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
3327
|
+
const themeVars = {
|
|
3328
|
+
colors: {
|
|
3329
|
+
action: {
|
|
3330
|
+
active: `var(--${prefix}-color-action-active)`,
|
|
3331
|
+
hover: `var(--${prefix}-color-action-hover)`,
|
|
3332
|
+
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
3333
|
+
selected: `var(--${prefix}-color-action-selected)`,
|
|
3334
|
+
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`,
|
|
3335
|
+
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
3336
|
+
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
3337
|
+
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
3338
|
+
focus: `var(--${prefix}-color-action-focus)`,
|
|
3339
|
+
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
3340
|
+
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`
|
|
3341
|
+
},
|
|
3342
|
+
primary: {
|
|
3343
|
+
main: `var(--${prefix}-color-primary-main)`,
|
|
3344
|
+
contrastText: `var(--${prefix}-color-primary-contrastText)`
|
|
3345
|
+
},
|
|
3346
|
+
secondary: {
|
|
3347
|
+
main: `var(--${prefix}-color-secondary-main)`,
|
|
3348
|
+
contrastText: `var(--${prefix}-color-secondary-contrastText)`
|
|
3349
|
+
},
|
|
3350
|
+
background: {
|
|
3351
|
+
surface: `var(--${prefix}-color-background-surface)`,
|
|
3352
|
+
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
3353
|
+
body: {
|
|
3354
|
+
main: `var(--${prefix}-color-background-body-main)`
|
|
3355
|
+
}
|
|
3356
|
+
},
|
|
3357
|
+
error: {
|
|
3358
|
+
main: `var(--${prefix}-color-error-main)`,
|
|
3359
|
+
contrastText: `var(--${prefix}-color-error-contrastText)`
|
|
3360
|
+
},
|
|
3361
|
+
success: {
|
|
3362
|
+
main: `var(--${prefix}-color-success-main)`,
|
|
3363
|
+
contrastText: `var(--${prefix}-color-success-contrastText)`
|
|
3364
|
+
},
|
|
3365
|
+
warning: {
|
|
3366
|
+
main: `var(--${prefix}-color-warning-main)`,
|
|
3367
|
+
contrastText: `var(--${prefix}-color-warning-contrastText)`
|
|
3368
|
+
},
|
|
3369
|
+
text: {
|
|
3370
|
+
primary: `var(--${prefix}-color-text-primary)`,
|
|
3371
|
+
secondary: `var(--${prefix}-color-text-secondary)`
|
|
3372
|
+
},
|
|
3373
|
+
border: `var(--${prefix}-color-border)`
|
|
3374
|
+
},
|
|
3375
|
+
spacing: {
|
|
3376
|
+
unit: `var(--${prefix}-spacing-unit)`
|
|
3377
|
+
},
|
|
3378
|
+
borderRadius: {
|
|
3379
|
+
small: `var(--${prefix}-border-radius-small)`,
|
|
3380
|
+
medium: `var(--${prefix}-border-radius-medium)`,
|
|
3381
|
+
large: `var(--${prefix}-border-radius-large)`
|
|
3382
|
+
},
|
|
3383
|
+
shadows: {
|
|
3384
|
+
small: `var(--${prefix}-shadow-small)`,
|
|
3385
|
+
medium: `var(--${prefix}-shadow-medium)`,
|
|
3386
|
+
large: `var(--${prefix}-shadow-large)`
|
|
3387
|
+
},
|
|
3388
|
+
typography: {
|
|
3389
|
+
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
3390
|
+
fontSizes: {
|
|
3391
|
+
xs: `var(--${prefix}-typography-fontSize-xs)`,
|
|
3392
|
+
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
3393
|
+
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
3394
|
+
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
3395
|
+
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
3396
|
+
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
3397
|
+
"3xl": `var(--${prefix}-typography-fontSize-3xl)`
|
|
3398
|
+
},
|
|
3399
|
+
fontWeights: {
|
|
3400
|
+
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
3401
|
+
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
3402
|
+
semibold: `var(--${prefix}-typography-fontWeight-semibold)`,
|
|
3403
|
+
bold: `var(--${prefix}-typography-fontWeight-bold)`
|
|
3404
|
+
},
|
|
3405
|
+
lineHeights: {
|
|
3406
|
+
tight: `var(--${prefix}-typography-lineHeight-tight)`,
|
|
3407
|
+
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
3408
|
+
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
};
|
|
3412
|
+
if (theme.images) {
|
|
3413
|
+
themeVars.images = {};
|
|
3414
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
3415
|
+
const imageConfig = theme.images[imageKey];
|
|
3416
|
+
themeVars.images[imageKey] = {
|
|
3417
|
+
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0,
|
|
3418
|
+
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
3419
|
+
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0
|
|
3420
|
+
};
|
|
3421
|
+
});
|
|
3422
|
+
}
|
|
3423
|
+
return themeVars;
|
|
3424
|
+
};
|
|
2994
3425
|
var createTheme = (config = {}, isDark = false) => {
|
|
2995
3426
|
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
2996
3427
|
const mergedConfig = {
|
|
@@ -2999,6 +3430,10 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
2999
3430
|
colors: {
|
|
3000
3431
|
...baseTheme.colors,
|
|
3001
3432
|
...config.colors,
|
|
3433
|
+
action: {
|
|
3434
|
+
...baseTheme.colors.action,
|
|
3435
|
+
...config.colors?.action || {}
|
|
3436
|
+
},
|
|
3002
3437
|
secondary: {
|
|
3003
3438
|
...baseTheme.colors.secondary,
|
|
3004
3439
|
...config.colors?.secondary || {}
|
|
@@ -3015,11 +3450,32 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
3015
3450
|
shadows: {
|
|
3016
3451
|
...baseTheme.shadows,
|
|
3017
3452
|
...config.shadows
|
|
3453
|
+
},
|
|
3454
|
+
typography: {
|
|
3455
|
+
...baseTheme.typography,
|
|
3456
|
+
...config.typography,
|
|
3457
|
+
fontSizes: {
|
|
3458
|
+
...baseTheme.typography.fontSizes,
|
|
3459
|
+
...config.typography?.fontSizes || {}
|
|
3460
|
+
},
|
|
3461
|
+
fontWeights: {
|
|
3462
|
+
...baseTheme.typography.fontWeights,
|
|
3463
|
+
...config.typography?.fontWeights || {}
|
|
3464
|
+
},
|
|
3465
|
+
lineHeights: {
|
|
3466
|
+
...baseTheme.typography.lineHeights,
|
|
3467
|
+
...config.typography?.lineHeights || {}
|
|
3468
|
+
}
|
|
3469
|
+
},
|
|
3470
|
+
images: {
|
|
3471
|
+
...baseTheme.images,
|
|
3472
|
+
...config.images
|
|
3018
3473
|
}
|
|
3019
3474
|
};
|
|
3020
3475
|
return {
|
|
3021
3476
|
...mergedConfig,
|
|
3022
|
-
cssVariables: toCssVariables(mergedConfig)
|
|
3477
|
+
cssVariables: toCssVariables(mergedConfig),
|
|
3478
|
+
vars: toThemeVars(mergedConfig)
|
|
3023
3479
|
};
|
|
3024
3480
|
};
|
|
3025
3481
|
var createTheme_default = createTheme;
|
|
@@ -3051,6 +3507,58 @@ var deepMerge = (target, ...sources) => {
|
|
|
3051
3507
|
};
|
|
3052
3508
|
var deepMerge_default = deepMerge;
|
|
3053
3509
|
|
|
3510
|
+
// src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
3511
|
+
var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
3512
|
+
if (!baseUrl) {
|
|
3513
|
+
throw new AsgardeoRuntimeError(
|
|
3514
|
+
"Base URL is required to derive organization handle.",
|
|
3515
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-001",
|
|
3516
|
+
"javascript",
|
|
3517
|
+
"A valid base URL must be provided to extract the organization handle."
|
|
3518
|
+
);
|
|
3519
|
+
}
|
|
3520
|
+
let parsedUrl;
|
|
3521
|
+
try {
|
|
3522
|
+
parsedUrl = new URL(baseUrl);
|
|
3523
|
+
} catch (error) {
|
|
3524
|
+
throw new AsgardeoRuntimeError(
|
|
3525
|
+
`Invalid base URL format: ${baseUrl}`,
|
|
3526
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-002",
|
|
3527
|
+
"javascript",
|
|
3528
|
+
"The provided base URL does not conform to valid URL syntax."
|
|
3529
|
+
);
|
|
3530
|
+
}
|
|
3531
|
+
const hostname = parsedUrl.hostname.toLowerCase();
|
|
3532
|
+
if (!hostname.endsWith(".asgardeo.io")) {
|
|
3533
|
+
throw new AsgardeoRuntimeError(
|
|
3534
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3535
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-001",
|
|
3536
|
+
"javascript",
|
|
3537
|
+
"The provided base URL uses a custom domain. Please provide the organizationHandle explicitly in the configuration."
|
|
3538
|
+
);
|
|
3539
|
+
}
|
|
3540
|
+
const pathSegments = parsedUrl.pathname.split("/").filter((segment) => segment.length > 0);
|
|
3541
|
+
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3542
|
+
throw new AsgardeoRuntimeError(
|
|
3543
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3544
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002",
|
|
3545
|
+
"javascript",
|
|
3546
|
+
"The provided base URL does not follow the expected Asgardeo URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration."
|
|
3547
|
+
);
|
|
3548
|
+
}
|
|
3549
|
+
const organizationHandle = pathSegments[1];
|
|
3550
|
+
if (!organizationHandle || organizationHandle.trim().length === 0) {
|
|
3551
|
+
throw new AsgardeoRuntimeError(
|
|
3552
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3553
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003",
|
|
3554
|
+
"javascript",
|
|
3555
|
+
"The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration."
|
|
3556
|
+
);
|
|
3557
|
+
}
|
|
3558
|
+
return organizationHandle;
|
|
3559
|
+
};
|
|
3560
|
+
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
3561
|
+
|
|
3054
3562
|
// src/utils/flattenUserSchema.ts
|
|
3055
3563
|
var flattenUserSchema = (schemas) => {
|
|
3056
3564
|
const flattenedAttributes = [];
|
|
@@ -3291,8 +3799,18 @@ var translations = {
|
|
|
3291
3799
|
"organization.switcher.members": "members",
|
|
3292
3800
|
"organization.switcher.member": "member",
|
|
3293
3801
|
"organization.switcher.create.organization": "Create Organization",
|
|
3294
|
-
"organization.switcher.manage.organizations": "Manage
|
|
3802
|
+
"organization.switcher.manage.organizations": "Manage Organizations",
|
|
3295
3803
|
"organization.switcher.manage.button": "Manage",
|
|
3804
|
+
"organization.switcher.organizations.title": "Organizations",
|
|
3805
|
+
"organization.switcher.switch.button": "Switch",
|
|
3806
|
+
"organization.switcher.no.access": "No Access",
|
|
3807
|
+
"organization.switcher.status.label": "Status:",
|
|
3808
|
+
"organization.switcher.showing.count": "Showing {showing} of {total} organizations",
|
|
3809
|
+
"organization.switcher.refresh.button": "Refresh",
|
|
3810
|
+
"organization.switcher.load.more": "Load More Organizations",
|
|
3811
|
+
"organization.switcher.loading.more": "Loading...",
|
|
3812
|
+
"organization.switcher.no.organizations": "No organizations found",
|
|
3813
|
+
"organization.switcher.error.prefix": "Error:",
|
|
3296
3814
|
"organization.profile.title": "Organization Profile",
|
|
3297
3815
|
"organization.profile.loading": "Loading organization...",
|
|
3298
3816
|
"organization.profile.error": "Failed to load organization",
|
|
@@ -3379,6 +3897,112 @@ var resolveFieldName_default = resolveFieldName;
|
|
|
3379
3897
|
// src/utils/withVendorCSSClassPrefix.ts
|
|
3380
3898
|
var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|
|
3381
3899
|
var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
3900
|
+
|
|
3901
|
+
// src/utils/transformBrandingPreferenceToTheme.ts
|
|
3902
|
+
var extractColorValue = (colorVariant) => {
|
|
3903
|
+
return colorVariant?.main;
|
|
3904
|
+
};
|
|
3905
|
+
var extractContrastText = (colorVariant) => {
|
|
3906
|
+
return colorVariant?.contrastText;
|
|
3907
|
+
};
|
|
3908
|
+
var transformThemeVariant = (themeVariant, isDark = false) => {
|
|
3909
|
+
const colors = themeVariant.colors;
|
|
3910
|
+
const buttons = themeVariant.buttons;
|
|
3911
|
+
const inputs = themeVariant.inputs;
|
|
3912
|
+
const images = themeVariant.images;
|
|
3913
|
+
return {
|
|
3914
|
+
colors: {
|
|
3915
|
+
action: {
|
|
3916
|
+
active: isDark ? "rgba(255, 255, 255, 0.70)" : "rgba(0, 0, 0, 0.54)",
|
|
3917
|
+
hover: isDark ? "rgba(255, 255, 255, 0.04)" : "rgba(0, 0, 0, 0.04)",
|
|
3918
|
+
hoverOpacity: 0.04,
|
|
3919
|
+
selected: isDark ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.08)",
|
|
3920
|
+
selectedOpacity: 0.08,
|
|
3921
|
+
disabled: isDark ? "rgba(255, 255, 255, 0.26)" : "rgba(0, 0, 0, 0.26)",
|
|
3922
|
+
disabledBackground: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
3923
|
+
disabledOpacity: 0.38,
|
|
3924
|
+
focus: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
3925
|
+
focusOpacity: 0.12,
|
|
3926
|
+
activatedOpacity: 0.12
|
|
3927
|
+
},
|
|
3928
|
+
primary: {
|
|
3929
|
+
main: extractColorValue(colors?.primary),
|
|
3930
|
+
contrastText: extractContrastText(colors?.primary)
|
|
3931
|
+
},
|
|
3932
|
+
secondary: {
|
|
3933
|
+
main: extractColorValue(colors?.secondary),
|
|
3934
|
+
contrastText: extractContrastText(colors?.secondary)
|
|
3935
|
+
},
|
|
3936
|
+
background: {
|
|
3937
|
+
surface: extractColorValue(colors?.background?.surface),
|
|
3938
|
+
disabled: extractColorValue(colors?.background?.surface),
|
|
3939
|
+
body: {
|
|
3940
|
+
main: extractColorValue(colors?.background?.body)
|
|
3941
|
+
}
|
|
3942
|
+
},
|
|
3943
|
+
text: {
|
|
3944
|
+
primary: colors?.text?.primary,
|
|
3945
|
+
secondary: colors?.text?.secondary
|
|
3946
|
+
},
|
|
3947
|
+
border: colors?.outlined?.default,
|
|
3948
|
+
error: {
|
|
3949
|
+
main: extractColorValue(colors?.alerts?.error),
|
|
3950
|
+
contrastText: extractContrastText(colors?.alerts?.error)
|
|
3951
|
+
},
|
|
3952
|
+
success: {
|
|
3953
|
+
main: extractColorValue(colors?.alerts?.info),
|
|
3954
|
+
contrastText: extractContrastText(colors?.alerts?.info)
|
|
3955
|
+
},
|
|
3956
|
+
warning: {
|
|
3957
|
+
main: extractColorValue(colors?.alerts?.warning),
|
|
3958
|
+
contrastText: extractContrastText(colors?.alerts?.warning)
|
|
3959
|
+
}
|
|
3960
|
+
},
|
|
3961
|
+
// Extract border radius from buttons or inputs
|
|
3962
|
+
borderRadius: {
|
|
3963
|
+
small: buttons?.primary?.base?.border?.borderRadius || inputs?.base?.border?.borderRadius,
|
|
3964
|
+
medium: buttons?.secondary?.base?.border?.borderRadius,
|
|
3965
|
+
large: buttons?.externalConnection?.base?.border?.borderRadius
|
|
3966
|
+
},
|
|
3967
|
+
// Extract and transform images
|
|
3968
|
+
images: {
|
|
3969
|
+
favicon: images?.favicon ? {
|
|
3970
|
+
url: images.favicon.imgURL,
|
|
3971
|
+
title: images.favicon.title,
|
|
3972
|
+
alt: images.favicon.altText
|
|
3973
|
+
} : void 0,
|
|
3974
|
+
logo: images?.logo ? {
|
|
3975
|
+
url: images.logo.imgURL,
|
|
3976
|
+
title: images.logo.title,
|
|
3977
|
+
alt: images.logo.altText
|
|
3978
|
+
} : void 0
|
|
3979
|
+
}
|
|
3980
|
+
};
|
|
3981
|
+
};
|
|
3982
|
+
var transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
|
|
3983
|
+
const themeConfig = brandingPreference?.preference?.theme;
|
|
3984
|
+
if (!themeConfig) {
|
|
3985
|
+
return createTheme_default({}, false);
|
|
3986
|
+
}
|
|
3987
|
+
let activeThemeKey;
|
|
3988
|
+
if (forceTheme) {
|
|
3989
|
+
activeThemeKey = forceTheme.toUpperCase();
|
|
3990
|
+
} else {
|
|
3991
|
+
activeThemeKey = themeConfig.activeTheme || "LIGHT";
|
|
3992
|
+
}
|
|
3993
|
+
const themeVariant = themeConfig[activeThemeKey];
|
|
3994
|
+
if (!themeVariant) {
|
|
3995
|
+
const fallbackVariant = themeConfig.LIGHT || themeConfig.DARK;
|
|
3996
|
+
if (fallbackVariant) {
|
|
3997
|
+
const transformedConfig2 = transformThemeVariant(fallbackVariant, activeThemeKey === "DARK");
|
|
3998
|
+
return createTheme_default(transformedConfig2, activeThemeKey === "DARK");
|
|
3999
|
+
}
|
|
4000
|
+
return createTheme_default({}, activeThemeKey === "DARK");
|
|
4001
|
+
}
|
|
4002
|
+
const transformedConfig = transformThemeVariant(themeVariant, activeThemeKey === "DARK");
|
|
4003
|
+
return createTheme_default(transformedConfig, activeThemeKey === "DARK");
|
|
4004
|
+
};
|
|
4005
|
+
var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
|
|
3382
4006
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3383
4007
|
0 && (module.exports = {
|
|
3384
4008
|
ApplicationNativeAuthenticationConstants,
|
|
@@ -3410,6 +4034,7 @@ var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
|
3410
4034
|
createPatchOperations,
|
|
3411
4035
|
createTheme,
|
|
3412
4036
|
deepMerge,
|
|
4037
|
+
deriveOrganizationHandleFromBaseUrl,
|
|
3413
4038
|
executeEmbeddedSignInFlow,
|
|
3414
4039
|
executeEmbeddedSignUpFlow,
|
|
3415
4040
|
extractPkceStorageKeyFromState,
|
|
@@ -3419,6 +4044,7 @@ var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
|
3419
4044
|
generateUserProfile,
|
|
3420
4045
|
get,
|
|
3421
4046
|
getAllOrganizations,
|
|
4047
|
+
getBrandingPreference,
|
|
3422
4048
|
getI18nBundles,
|
|
3423
4049
|
getLatestStateParam,
|
|
3424
4050
|
getMeOrganizations,
|
|
@@ -3429,10 +4055,12 @@ var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
|
3429
4055
|
initializeEmbeddedSignInFlow,
|
|
3430
4056
|
isEmpty,
|
|
3431
4057
|
processOpenIDScopes,
|
|
4058
|
+
processUsername,
|
|
3432
4059
|
removeTrailingSlash,
|
|
3433
4060
|
resolveFieldName,
|
|
3434
4061
|
resolveFieldType,
|
|
3435
4062
|
set,
|
|
4063
|
+
transformBrandingPreferenceToTheme,
|
|
3436
4064
|
updateMeProfile,
|
|
3437
4065
|
updateOrganization,
|
|
3438
4066
|
withVendorCSSClassPrefix
|