@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/index.js
CHANGED
|
@@ -1949,16 +1949,15 @@ var initializeEmbeddedSignInFlow = async ({
|
|
|
1949
1949
|
searchParams.append(key, String(value));
|
|
1950
1950
|
}
|
|
1951
1951
|
});
|
|
1952
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
1953
1952
|
const response = await fetch(url ?? `${baseUrl}/oauth2/authorize`, {
|
|
1953
|
+
...requestConfig,
|
|
1954
1954
|
method: requestConfig.method || "POST",
|
|
1955
1955
|
headers: {
|
|
1956
|
+
...requestConfig.headers,
|
|
1956
1957
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
1957
|
-
Accept: "application/json"
|
|
1958
|
-
...customHeaders
|
|
1958
|
+
Accept: "application/json"
|
|
1959
1959
|
},
|
|
1960
|
-
body: searchParams.toString()
|
|
1961
|
-
...otherConfig
|
|
1960
|
+
body: searchParams.toString()
|
|
1962
1961
|
});
|
|
1963
1962
|
if (!response.ok) {
|
|
1964
1963
|
const errorText = await response.text();
|
|
@@ -1990,16 +1989,15 @@ var executeEmbeddedSignInFlow = async ({
|
|
|
1990
1989
|
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
1991
1990
|
);
|
|
1992
1991
|
}
|
|
1993
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
1994
1992
|
const response = await fetch(url ?? `${baseUrl}/oauth2/authn`, {
|
|
1993
|
+
...requestConfig,
|
|
1995
1994
|
method: requestConfig.method || "POST",
|
|
1996
1995
|
headers: {
|
|
1997
1996
|
"Content-Type": "application/json",
|
|
1998
1997
|
Accept: "application/json",
|
|
1999
|
-
...
|
|
1998
|
+
...requestConfig.headers
|
|
2000
1999
|
},
|
|
2001
|
-
body: JSON.stringify(payload)
|
|
2002
|
-
...otherConfig
|
|
2000
|
+
body: JSON.stringify(payload)
|
|
2003
2001
|
});
|
|
2004
2002
|
if (!response.ok) {
|
|
2005
2003
|
const errorText = await response.text();
|
|
@@ -2059,19 +2057,18 @@ var executeEmbeddedSignUpFlow = async ({
|
|
|
2059
2057
|
"At least one of the baseUrl or url must be provided to execute the embedded sign up flow."
|
|
2060
2058
|
);
|
|
2061
2059
|
}
|
|
2062
|
-
const { headers: customHeaders, ...otherConfig } = requestConfig;
|
|
2063
2060
|
const response = await fetch(url ?? `${baseUrl}/api/server/v1/flow/execute`, {
|
|
2061
|
+
...requestConfig,
|
|
2064
2062
|
method: requestConfig.method || "POST",
|
|
2065
2063
|
headers: {
|
|
2066
2064
|
"Content-Type": "application/json",
|
|
2067
2065
|
Accept: "application/json",
|
|
2068
|
-
...
|
|
2066
|
+
...requestConfig.headers
|
|
2069
2067
|
},
|
|
2070
2068
|
body: JSON.stringify({
|
|
2071
2069
|
...payload ?? {},
|
|
2072
2070
|
flowType: "REGISTRATION" /* Registration */
|
|
2073
|
-
})
|
|
2074
|
-
...otherConfig
|
|
2071
|
+
})
|
|
2075
2072
|
});
|
|
2076
2073
|
if (!response.ok) {
|
|
2077
2074
|
const errorText = await response.text();
|
|
@@ -2101,12 +2098,13 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2101
2098
|
);
|
|
2102
2099
|
}
|
|
2103
2100
|
const response = await fetch(url, {
|
|
2101
|
+
...requestConfig,
|
|
2104
2102
|
method: "GET",
|
|
2105
2103
|
headers: {
|
|
2106
2104
|
"Content-Type": "application/json",
|
|
2107
|
-
Accept: "application/json"
|
|
2108
|
-
|
|
2109
|
-
|
|
2105
|
+
Accept: "application/json",
|
|
2106
|
+
...requestConfig.headers
|
|
2107
|
+
}
|
|
2110
2108
|
});
|
|
2111
2109
|
if (!response.ok) {
|
|
2112
2110
|
const errorText = await response.text();
|
|
@@ -2122,6 +2120,32 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2122
2120
|
};
|
|
2123
2121
|
var getUserInfo_default = getUserInfo;
|
|
2124
2122
|
|
|
2123
|
+
// src/utils/processUsername.ts
|
|
2124
|
+
var USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
2125
|
+
var removeUserstorePrefix = (username) => {
|
|
2126
|
+
if (!username) {
|
|
2127
|
+
return "";
|
|
2128
|
+
}
|
|
2129
|
+
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
2130
|
+
};
|
|
2131
|
+
var processUsername = (user) => {
|
|
2132
|
+
if (!user) {
|
|
2133
|
+
return user;
|
|
2134
|
+
}
|
|
2135
|
+
const processedUser = { ...user };
|
|
2136
|
+
if (processedUser.username) {
|
|
2137
|
+
processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
2138
|
+
}
|
|
2139
|
+
if (processedUser.userName) {
|
|
2140
|
+
processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
2141
|
+
}
|
|
2142
|
+
if (processedUser.user_name) {
|
|
2143
|
+
processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
2144
|
+
}
|
|
2145
|
+
return processedUser;
|
|
2146
|
+
};
|
|
2147
|
+
var processUsername_default = processUsername;
|
|
2148
|
+
|
|
2125
2149
|
// src/api/getScim2Me.ts
|
|
2126
2150
|
var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
2127
2151
|
try {
|
|
@@ -2138,13 +2162,13 @@ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2138
2162
|
const fetchFn = fetcher || fetch;
|
|
2139
2163
|
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
2140
2164
|
const requestInit = {
|
|
2165
|
+
...requestConfig,
|
|
2141
2166
|
method: "GET",
|
|
2142
2167
|
headers: {
|
|
2143
2168
|
"Content-Type": "application/scim+json",
|
|
2144
2169
|
Accept: "application/json",
|
|
2145
2170
|
...requestConfig.headers
|
|
2146
|
-
}
|
|
2147
|
-
...requestConfig
|
|
2171
|
+
}
|
|
2148
2172
|
};
|
|
2149
2173
|
try {
|
|
2150
2174
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2158,7 +2182,8 @@ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2158
2182
|
response.statusText
|
|
2159
2183
|
);
|
|
2160
2184
|
}
|
|
2161
|
-
|
|
2185
|
+
const user = await response.json();
|
|
2186
|
+
return processUsername_default(user);
|
|
2162
2187
|
} catch (error) {
|
|
2163
2188
|
if (error instanceof AsgardeoAPIError) {
|
|
2164
2189
|
throw error;
|
|
@@ -2190,13 +2215,13 @@ var getSchemas = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2190
2215
|
const fetchFn = fetcher || fetch;
|
|
2191
2216
|
const resolvedUrl = url ?? `${baseUrl}/scim2/Schemas`;
|
|
2192
2217
|
const requestInit = {
|
|
2218
|
+
...requestConfig,
|
|
2193
2219
|
method: "GET",
|
|
2194
2220
|
headers: {
|
|
2195
2221
|
"Content-Type": "application/json",
|
|
2196
2222
|
Accept: "application/json",
|
|
2197
2223
|
...requestConfig.headers
|
|
2198
|
-
}
|
|
2199
|
-
...requestConfig
|
|
2224
|
+
}
|
|
2200
2225
|
};
|
|
2201
2226
|
try {
|
|
2202
2227
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2258,13 +2283,13 @@ var getAllOrganizations = async ({
|
|
|
2258
2283
|
const fetchFn = fetcher || fetch;
|
|
2259
2284
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations?${queryParams.toString()}`;
|
|
2260
2285
|
const requestInit = {
|
|
2286
|
+
...requestConfig,
|
|
2261
2287
|
method: "GET",
|
|
2262
2288
|
headers: {
|
|
2289
|
+
...requestConfig.headers,
|
|
2263
2290
|
"Content-Type": "application/json",
|
|
2264
|
-
Accept: "application/json"
|
|
2265
|
-
|
|
2266
|
-
},
|
|
2267
|
-
...requestConfig
|
|
2291
|
+
Accept: "application/json"
|
|
2292
|
+
}
|
|
2268
2293
|
};
|
|
2269
2294
|
try {
|
|
2270
2295
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2334,14 +2359,14 @@ var createOrganization = async ({
|
|
|
2334
2359
|
const fetchFn = fetcher || fetch;
|
|
2335
2360
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations`;
|
|
2336
2361
|
const requestInit = {
|
|
2362
|
+
...requestConfig,
|
|
2337
2363
|
method: "POST",
|
|
2338
2364
|
headers: {
|
|
2339
2365
|
"Content-Type": "application/json",
|
|
2340
2366
|
Accept: "application/json",
|
|
2341
2367
|
...requestConfig.headers
|
|
2342
2368
|
},
|
|
2343
|
-
body: JSON.stringify(organizationPayload)
|
|
2344
|
-
...requestConfig
|
|
2369
|
+
body: JSON.stringify(organizationPayload)
|
|
2345
2370
|
};
|
|
2346
2371
|
try {
|
|
2347
2372
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2409,13 +2434,13 @@ var getMeOrganizations = async ({
|
|
|
2409
2434
|
const fetchFn = fetcher || fetch;
|
|
2410
2435
|
const resolvedUrl = `${baseUrl}/api/users/v1/me/organizations?${queryParams.toString()}`;
|
|
2411
2436
|
const requestInit = {
|
|
2437
|
+
...requestConfig,
|
|
2412
2438
|
method: "GET",
|
|
2413
2439
|
headers: {
|
|
2414
2440
|
"Content-Type": "application/json",
|
|
2415
2441
|
Accept: "application/json",
|
|
2416
2442
|
...requestConfig.headers
|
|
2417
|
-
}
|
|
2418
|
-
...requestConfig
|
|
2443
|
+
}
|
|
2419
2444
|
};
|
|
2420
2445
|
try {
|
|
2421
2446
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2476,13 +2501,13 @@ var getOrganization = async ({
|
|
|
2476
2501
|
const fetchFn = fetcher || fetch;
|
|
2477
2502
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
2478
2503
|
const requestInit = {
|
|
2504
|
+
...requestConfig,
|
|
2479
2505
|
method: "GET",
|
|
2480
2506
|
headers: {
|
|
2481
2507
|
"Content-Type": "application/json",
|
|
2482
2508
|
Accept: "application/json",
|
|
2483
2509
|
...requestConfig.headers
|
|
2484
|
-
}
|
|
2485
|
-
...requestConfig
|
|
2510
|
+
}
|
|
2486
2511
|
};
|
|
2487
2512
|
try {
|
|
2488
2513
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2570,14 +2595,14 @@ var updateOrganization = async ({
|
|
|
2570
2595
|
const fetchFn = fetcher || fetch;
|
|
2571
2596
|
const resolvedUrl = `${baseUrl}/api/server/v1/organizations/${organizationId}`;
|
|
2572
2597
|
const requestInit = {
|
|
2598
|
+
...requestConfig,
|
|
2573
2599
|
method: "PATCH",
|
|
2574
2600
|
headers: {
|
|
2575
2601
|
"Content-Type": "application/json",
|
|
2576
2602
|
Accept: "application/json",
|
|
2577
2603
|
...requestConfig.headers
|
|
2578
2604
|
},
|
|
2579
|
-
body: JSON.stringify(operations)
|
|
2580
|
-
...requestConfig
|
|
2605
|
+
body: JSON.stringify(operations)
|
|
2581
2606
|
};
|
|
2582
2607
|
try {
|
|
2583
2608
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2654,13 +2679,13 @@ var updateMeProfile = async ({
|
|
|
2654
2679
|
const resolvedUrl = url ?? `${baseUrl}/scim2/Me`;
|
|
2655
2680
|
const requestInit = {
|
|
2656
2681
|
method: "PATCH",
|
|
2682
|
+
...requestConfig,
|
|
2657
2683
|
headers: {
|
|
2684
|
+
...requestConfig.headers,
|
|
2658
2685
|
"Content-Type": "application/scim+json",
|
|
2659
|
-
Accept: "application/json"
|
|
2660
|
-
...requestConfig.headers
|
|
2686
|
+
Accept: "application/json"
|
|
2661
2687
|
},
|
|
2662
|
-
body: JSON.stringify(data)
|
|
2663
|
-
...requestConfig
|
|
2688
|
+
body: JSON.stringify(data)
|
|
2664
2689
|
};
|
|
2665
2690
|
try {
|
|
2666
2691
|
const response = await fetchFn(resolvedUrl, requestInit);
|
|
@@ -2690,6 +2715,75 @@ var updateMeProfile = async ({
|
|
|
2690
2715
|
};
|
|
2691
2716
|
var updateMeProfile_default = updateMeProfile;
|
|
2692
2717
|
|
|
2718
|
+
// src/api/getBrandingPreference.ts
|
|
2719
|
+
var getBrandingPreference = async ({
|
|
2720
|
+
baseUrl,
|
|
2721
|
+
locale,
|
|
2722
|
+
name,
|
|
2723
|
+
type,
|
|
2724
|
+
fetcher,
|
|
2725
|
+
...requestConfig
|
|
2726
|
+
}) => {
|
|
2727
|
+
try {
|
|
2728
|
+
new URL(baseUrl);
|
|
2729
|
+
} catch (error) {
|
|
2730
|
+
throw new AsgardeoAPIError(
|
|
2731
|
+
`Invalid base URL provided. ${error?.toString()}`,
|
|
2732
|
+
"getBrandingPreference-ValidationError-001",
|
|
2733
|
+
"javascript",
|
|
2734
|
+
400,
|
|
2735
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
2736
|
+
);
|
|
2737
|
+
}
|
|
2738
|
+
const queryParams = new URLSearchParams(
|
|
2739
|
+
Object.fromEntries(
|
|
2740
|
+
Object.entries({
|
|
2741
|
+
locale: locale || "",
|
|
2742
|
+
name: name || "",
|
|
2743
|
+
type: type || ""
|
|
2744
|
+
}).filter(([, value]) => Boolean(value))
|
|
2745
|
+
)
|
|
2746
|
+
);
|
|
2747
|
+
const fetchFn = fetcher || fetch;
|
|
2748
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2749
|
+
const requestInit = {
|
|
2750
|
+
...requestConfig,
|
|
2751
|
+
method: "GET",
|
|
2752
|
+
headers: {
|
|
2753
|
+
"Content-Type": "application/json",
|
|
2754
|
+
Accept: "application/json",
|
|
2755
|
+
...requestConfig.headers
|
|
2756
|
+
}
|
|
2757
|
+
};
|
|
2758
|
+
try {
|
|
2759
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2760
|
+
if (!response?.ok) {
|
|
2761
|
+
const errorText = await response.text();
|
|
2762
|
+
throw new AsgardeoAPIError(
|
|
2763
|
+
`Failed to get branding preference: ${errorText}`,
|
|
2764
|
+
"getBrandingPreference-ResponseError-001",
|
|
2765
|
+
"javascript",
|
|
2766
|
+
response.status,
|
|
2767
|
+
response.statusText
|
|
2768
|
+
);
|
|
2769
|
+
}
|
|
2770
|
+
const data = await response.json();
|
|
2771
|
+
return data;
|
|
2772
|
+
} catch (error) {
|
|
2773
|
+
if (error instanceof AsgardeoAPIError) {
|
|
2774
|
+
throw error;
|
|
2775
|
+
}
|
|
2776
|
+
throw new AsgardeoAPIError(
|
|
2777
|
+
`Network or parsing error: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
2778
|
+
"getBrandingPreference-NetworkError-001",
|
|
2779
|
+
"javascript",
|
|
2780
|
+
0,
|
|
2781
|
+
"Network Error"
|
|
2782
|
+
);
|
|
2783
|
+
}
|
|
2784
|
+
};
|
|
2785
|
+
var getBrandingPreference_default = getBrandingPreference;
|
|
2786
|
+
|
|
2693
2787
|
// src/constants/ApplicationNativeAuthenticationConstants.ts
|
|
2694
2788
|
var ApplicationNativeAuthenticationConstants = {
|
|
2695
2789
|
SupportedAuthenticators: {
|
|
@@ -2795,6 +2889,19 @@ var AsgardeoJavaScriptClient_default = AsgardeoJavaScriptClient;
|
|
|
2795
2889
|
// src/theme/createTheme.ts
|
|
2796
2890
|
var lightTheme = {
|
|
2797
2891
|
colors: {
|
|
2892
|
+
action: {
|
|
2893
|
+
active: "rgba(0, 0, 0, 0.54)",
|
|
2894
|
+
hover: "rgba(0, 0, 0, 0.04)",
|
|
2895
|
+
hoverOpacity: 0.04,
|
|
2896
|
+
selected: "rgba(0, 0, 0, 0.08)",
|
|
2897
|
+
selectedOpacity: 0.08,
|
|
2898
|
+
disabled: "rgba(0, 0, 0, 0.26)",
|
|
2899
|
+
disabledBackground: "rgba(0, 0, 0, 0.12)",
|
|
2900
|
+
disabledOpacity: 0.38,
|
|
2901
|
+
focus: "rgba(0, 0, 0, 0.12)",
|
|
2902
|
+
focusOpacity: 0.12,
|
|
2903
|
+
activatedOpacity: 0.12
|
|
2904
|
+
},
|
|
2798
2905
|
primary: {
|
|
2799
2906
|
main: "#1a73e8",
|
|
2800
2907
|
contrastText: "#ffffff"
|
|
@@ -2840,10 +2947,57 @@ var lightTheme = {
|
|
|
2840
2947
|
small: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
2841
2948
|
medium: "0 4px 16px rgba(0, 0, 0, 0.15)",
|
|
2842
2949
|
large: "0 8px 32px rgba(0, 0, 0, 0.2)"
|
|
2950
|
+
},
|
|
2951
|
+
typography: {
|
|
2952
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
2953
|
+
fontSizes: {
|
|
2954
|
+
xs: "0.75rem",
|
|
2955
|
+
// 12px
|
|
2956
|
+
sm: "0.875rem",
|
|
2957
|
+
// 14px
|
|
2958
|
+
md: "1rem",
|
|
2959
|
+
// 16px
|
|
2960
|
+
lg: "1.125rem",
|
|
2961
|
+
// 18px
|
|
2962
|
+
xl: "1.25rem",
|
|
2963
|
+
// 20px
|
|
2964
|
+
"2xl": "1.5rem",
|
|
2965
|
+
// 24px
|
|
2966
|
+
"3xl": "2.125rem"
|
|
2967
|
+
// 34px
|
|
2968
|
+
},
|
|
2969
|
+
fontWeights: {
|
|
2970
|
+
normal: 400,
|
|
2971
|
+
medium: 500,
|
|
2972
|
+
semibold: 600,
|
|
2973
|
+
bold: 700
|
|
2974
|
+
},
|
|
2975
|
+
lineHeights: {
|
|
2976
|
+
tight: 1.2,
|
|
2977
|
+
normal: 1.4,
|
|
2978
|
+
relaxed: 1.6
|
|
2979
|
+
}
|
|
2980
|
+
},
|
|
2981
|
+
images: {
|
|
2982
|
+
favicon: {},
|
|
2983
|
+
logo: {}
|
|
2843
2984
|
}
|
|
2844
2985
|
};
|
|
2845
2986
|
var darkTheme = {
|
|
2846
2987
|
colors: {
|
|
2988
|
+
action: {
|
|
2989
|
+
active: "rgba(255, 255, 255, 0.70)",
|
|
2990
|
+
hover: "rgba(255, 255, 255, 0.04)",
|
|
2991
|
+
hoverOpacity: 0.04,
|
|
2992
|
+
selected: "rgba(255, 255, 255, 0.08)",
|
|
2993
|
+
selectedOpacity: 0.08,
|
|
2994
|
+
disabled: "rgba(255, 255, 255, 0.26)",
|
|
2995
|
+
disabledBackground: "rgba(255, 255, 255, 0.12)",
|
|
2996
|
+
disabledOpacity: 0.38,
|
|
2997
|
+
focus: "rgba(255, 255, 255, 0.12)",
|
|
2998
|
+
focusOpacity: 0.12,
|
|
2999
|
+
activatedOpacity: 0.12
|
|
3000
|
+
},
|
|
2847
3001
|
primary: {
|
|
2848
3002
|
main: "#1a73e8",
|
|
2849
3003
|
contrastText: "#ffffff"
|
|
@@ -2889,35 +3043,308 @@ var darkTheme = {
|
|
|
2889
3043
|
small: "0 2px 8px rgba(0, 0, 0, 0.3)",
|
|
2890
3044
|
medium: "0 4px 16px rgba(0, 0, 0, 0.4)",
|
|
2891
3045
|
large: "0 8px 32px rgba(0, 0, 0, 0.5)"
|
|
3046
|
+
},
|
|
3047
|
+
typography: {
|
|
3048
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
3049
|
+
fontSizes: {
|
|
3050
|
+
xs: "0.75rem",
|
|
3051
|
+
// 12px
|
|
3052
|
+
sm: "0.875rem",
|
|
3053
|
+
// 14px
|
|
3054
|
+
md: "1rem",
|
|
3055
|
+
// 16px
|
|
3056
|
+
lg: "1.125rem",
|
|
3057
|
+
// 18px
|
|
3058
|
+
xl: "1.25rem",
|
|
3059
|
+
// 20px
|
|
3060
|
+
"2xl": "1.5rem",
|
|
3061
|
+
// 24px
|
|
3062
|
+
"3xl": "2.125rem"
|
|
3063
|
+
// 34px
|
|
3064
|
+
},
|
|
3065
|
+
fontWeights: {
|
|
3066
|
+
normal: 400,
|
|
3067
|
+
medium: 500,
|
|
3068
|
+
semibold: 600,
|
|
3069
|
+
bold: 700
|
|
3070
|
+
},
|
|
3071
|
+
lineHeights: {
|
|
3072
|
+
tight: 1.2,
|
|
3073
|
+
normal: 1.4,
|
|
3074
|
+
relaxed: 1.6
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
3077
|
+
images: {
|
|
3078
|
+
favicon: {},
|
|
3079
|
+
logo: {}
|
|
2892
3080
|
}
|
|
2893
3081
|
};
|
|
2894
3082
|
var toCssVariables = (theme) => {
|
|
2895
3083
|
const cssVars = {};
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
3084
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
3085
|
+
if (theme.colors?.action?.active) {
|
|
3086
|
+
cssVars[`--${prefix}-color-action-active`] = theme.colors.action.active;
|
|
3087
|
+
}
|
|
3088
|
+
if (theme.colors?.action?.hover) {
|
|
3089
|
+
cssVars[`--${prefix}-color-action-hover`] = theme.colors.action.hover;
|
|
3090
|
+
}
|
|
3091
|
+
if (theme.colors?.action?.hoverOpacity !== void 0) {
|
|
3092
|
+
cssVars[`--${prefix}-color-action-hoverOpacity`] = theme.colors.action.hoverOpacity.toString();
|
|
3093
|
+
}
|
|
3094
|
+
if (theme.colors?.action?.selected) {
|
|
3095
|
+
cssVars[`--${prefix}-color-action-selected`] = theme.colors.action.selected;
|
|
3096
|
+
}
|
|
3097
|
+
if (theme.colors?.action?.selectedOpacity !== void 0) {
|
|
3098
|
+
cssVars[`--${prefix}-color-action-selectedOpacity`] = theme.colors.action.selectedOpacity.toString();
|
|
3099
|
+
}
|
|
3100
|
+
if (theme.colors?.action?.disabled) {
|
|
3101
|
+
cssVars[`--${prefix}-color-action-disabled`] = theme.colors.action.disabled;
|
|
3102
|
+
}
|
|
3103
|
+
if (theme.colors?.action?.disabledBackground) {
|
|
3104
|
+
cssVars[`--${prefix}-color-action-disabledBackground`] = theme.colors.action.disabledBackground;
|
|
3105
|
+
}
|
|
3106
|
+
if (theme.colors?.action?.disabledOpacity !== void 0) {
|
|
3107
|
+
cssVars[`--${prefix}-color-action-disabledOpacity`] = theme.colors.action.disabledOpacity.toString();
|
|
3108
|
+
}
|
|
3109
|
+
if (theme.colors?.action?.focus) {
|
|
3110
|
+
cssVars[`--${prefix}-color-action-focus`] = theme.colors.action.focus;
|
|
3111
|
+
}
|
|
3112
|
+
if (theme.colors?.action?.focusOpacity !== void 0) {
|
|
3113
|
+
cssVars[`--${prefix}-color-action-focusOpacity`] = theme.colors.action.focusOpacity.toString();
|
|
3114
|
+
}
|
|
3115
|
+
if (theme.colors?.action?.activatedOpacity !== void 0) {
|
|
3116
|
+
cssVars[`--${prefix}-color-action-activatedOpacity`] = theme.colors.action.activatedOpacity.toString();
|
|
3117
|
+
}
|
|
3118
|
+
if (theme.colors?.primary?.main) {
|
|
3119
|
+
cssVars[`--${prefix}-color-primary-main`] = theme.colors.primary.main;
|
|
3120
|
+
}
|
|
3121
|
+
if (theme.colors?.primary?.contrastText) {
|
|
3122
|
+
cssVars[`--${prefix}-color-primary-contrastText`] = theme.colors.primary.contrastText;
|
|
3123
|
+
}
|
|
3124
|
+
if (theme.colors?.secondary?.main) {
|
|
3125
|
+
cssVars[`--${prefix}-color-secondary-main`] = theme.colors.secondary.main;
|
|
3126
|
+
}
|
|
3127
|
+
if (theme.colors?.secondary?.contrastText) {
|
|
3128
|
+
cssVars[`--${prefix}-color-secondary-contrastText`] = theme.colors.secondary.contrastText;
|
|
3129
|
+
}
|
|
3130
|
+
if (theme.colors?.background?.surface) {
|
|
3131
|
+
cssVars[`--${prefix}-color-background-surface`] = theme.colors.background.surface;
|
|
3132
|
+
}
|
|
3133
|
+
if (theme.colors?.background?.disabled) {
|
|
3134
|
+
cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;
|
|
3135
|
+
}
|
|
3136
|
+
if (theme.colors?.background?.body?.main) {
|
|
3137
|
+
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
3138
|
+
}
|
|
3139
|
+
if (theme.colors?.error?.main) {
|
|
3140
|
+
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
3141
|
+
}
|
|
3142
|
+
if (theme.colors?.error?.contrastText) {
|
|
3143
|
+
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
3144
|
+
}
|
|
3145
|
+
if (theme.colors?.success?.main) {
|
|
3146
|
+
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
3147
|
+
}
|
|
3148
|
+
if (theme.colors?.success?.contrastText) {
|
|
3149
|
+
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
3150
|
+
}
|
|
3151
|
+
if (theme.colors?.warning?.main) {
|
|
3152
|
+
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
3153
|
+
}
|
|
3154
|
+
if (theme.colors?.warning?.contrastText) {
|
|
3155
|
+
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
3156
|
+
}
|
|
3157
|
+
if (theme.colors?.text?.primary) {
|
|
3158
|
+
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
3159
|
+
}
|
|
3160
|
+
if (theme.colors?.text?.secondary) {
|
|
3161
|
+
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
3162
|
+
}
|
|
3163
|
+
if (theme.colors?.border) {
|
|
3164
|
+
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
3165
|
+
}
|
|
3166
|
+
if (theme.spacing?.unit !== void 0) {
|
|
3167
|
+
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
3168
|
+
}
|
|
3169
|
+
if (theme.borderRadius?.small) {
|
|
3170
|
+
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
3171
|
+
}
|
|
3172
|
+
if (theme.borderRadius?.medium) {
|
|
3173
|
+
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
3174
|
+
}
|
|
3175
|
+
if (theme.borderRadius?.large) {
|
|
3176
|
+
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
3177
|
+
}
|
|
3178
|
+
if (theme.shadows?.small) {
|
|
3179
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
3180
|
+
}
|
|
3181
|
+
if (theme.shadows?.medium) {
|
|
3182
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
3183
|
+
}
|
|
3184
|
+
if (theme.shadows?.large) {
|
|
3185
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
3186
|
+
}
|
|
3187
|
+
if (theme.typography?.fontFamily) {
|
|
3188
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
3189
|
+
}
|
|
3190
|
+
if (theme.typography?.fontSizes?.xs) {
|
|
3191
|
+
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
3192
|
+
}
|
|
3193
|
+
if (theme.typography?.fontSizes?.sm) {
|
|
3194
|
+
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
3195
|
+
}
|
|
3196
|
+
if (theme.typography?.fontSizes?.md) {
|
|
3197
|
+
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
3198
|
+
}
|
|
3199
|
+
if (theme.typography?.fontSizes?.lg) {
|
|
3200
|
+
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
3201
|
+
}
|
|
3202
|
+
if (theme.typography?.fontSizes?.xl) {
|
|
3203
|
+
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
3204
|
+
}
|
|
3205
|
+
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
3206
|
+
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
3207
|
+
}
|
|
3208
|
+
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
3209
|
+
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
3210
|
+
}
|
|
3211
|
+
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
3212
|
+
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
3213
|
+
}
|
|
3214
|
+
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
3215
|
+
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
3216
|
+
}
|
|
3217
|
+
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
3218
|
+
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
3219
|
+
}
|
|
3220
|
+
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
3221
|
+
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
3222
|
+
}
|
|
3223
|
+
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
3224
|
+
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
3225
|
+
}
|
|
3226
|
+
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
3227
|
+
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
3228
|
+
}
|
|
3229
|
+
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
3230
|
+
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
3231
|
+
}
|
|
3232
|
+
if (theme.images) {
|
|
3233
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
3234
|
+
const imageConfig = theme.images[imageKey];
|
|
3235
|
+
if (imageConfig?.url) {
|
|
3236
|
+
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
3237
|
+
}
|
|
3238
|
+
if (imageConfig?.title) {
|
|
3239
|
+
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
3240
|
+
}
|
|
3241
|
+
if (imageConfig?.alt) {
|
|
3242
|
+
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
3243
|
+
}
|
|
3244
|
+
});
|
|
3245
|
+
}
|
|
2919
3246
|
return cssVars;
|
|
2920
3247
|
};
|
|
3248
|
+
var toThemeVars = (theme) => {
|
|
3249
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
3250
|
+
const themeVars = {
|
|
3251
|
+
colors: {
|
|
3252
|
+
action: {
|
|
3253
|
+
active: `var(--${prefix}-color-action-active)`,
|
|
3254
|
+
hover: `var(--${prefix}-color-action-hover)`,
|
|
3255
|
+
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
3256
|
+
selected: `var(--${prefix}-color-action-selected)`,
|
|
3257
|
+
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`,
|
|
3258
|
+
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
3259
|
+
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
3260
|
+
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
3261
|
+
focus: `var(--${prefix}-color-action-focus)`,
|
|
3262
|
+
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
3263
|
+
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`
|
|
3264
|
+
},
|
|
3265
|
+
primary: {
|
|
3266
|
+
main: `var(--${prefix}-color-primary-main)`,
|
|
3267
|
+
contrastText: `var(--${prefix}-color-primary-contrastText)`
|
|
3268
|
+
},
|
|
3269
|
+
secondary: {
|
|
3270
|
+
main: `var(--${prefix}-color-secondary-main)`,
|
|
3271
|
+
contrastText: `var(--${prefix}-color-secondary-contrastText)`
|
|
3272
|
+
},
|
|
3273
|
+
background: {
|
|
3274
|
+
surface: `var(--${prefix}-color-background-surface)`,
|
|
3275
|
+
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
3276
|
+
body: {
|
|
3277
|
+
main: `var(--${prefix}-color-background-body-main)`
|
|
3278
|
+
}
|
|
3279
|
+
},
|
|
3280
|
+
error: {
|
|
3281
|
+
main: `var(--${prefix}-color-error-main)`,
|
|
3282
|
+
contrastText: `var(--${prefix}-color-error-contrastText)`
|
|
3283
|
+
},
|
|
3284
|
+
success: {
|
|
3285
|
+
main: `var(--${prefix}-color-success-main)`,
|
|
3286
|
+
contrastText: `var(--${prefix}-color-success-contrastText)`
|
|
3287
|
+
},
|
|
3288
|
+
warning: {
|
|
3289
|
+
main: `var(--${prefix}-color-warning-main)`,
|
|
3290
|
+
contrastText: `var(--${prefix}-color-warning-contrastText)`
|
|
3291
|
+
},
|
|
3292
|
+
text: {
|
|
3293
|
+
primary: `var(--${prefix}-color-text-primary)`,
|
|
3294
|
+
secondary: `var(--${prefix}-color-text-secondary)`
|
|
3295
|
+
},
|
|
3296
|
+
border: `var(--${prefix}-color-border)`
|
|
3297
|
+
},
|
|
3298
|
+
spacing: {
|
|
3299
|
+
unit: `var(--${prefix}-spacing-unit)`
|
|
3300
|
+
},
|
|
3301
|
+
borderRadius: {
|
|
3302
|
+
small: `var(--${prefix}-border-radius-small)`,
|
|
3303
|
+
medium: `var(--${prefix}-border-radius-medium)`,
|
|
3304
|
+
large: `var(--${prefix}-border-radius-large)`
|
|
3305
|
+
},
|
|
3306
|
+
shadows: {
|
|
3307
|
+
small: `var(--${prefix}-shadow-small)`,
|
|
3308
|
+
medium: `var(--${prefix}-shadow-medium)`,
|
|
3309
|
+
large: `var(--${prefix}-shadow-large)`
|
|
3310
|
+
},
|
|
3311
|
+
typography: {
|
|
3312
|
+
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
3313
|
+
fontSizes: {
|
|
3314
|
+
xs: `var(--${prefix}-typography-fontSize-xs)`,
|
|
3315
|
+
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
3316
|
+
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
3317
|
+
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
3318
|
+
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
3319
|
+
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
3320
|
+
"3xl": `var(--${prefix}-typography-fontSize-3xl)`
|
|
3321
|
+
},
|
|
3322
|
+
fontWeights: {
|
|
3323
|
+
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
3324
|
+
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
3325
|
+
semibold: `var(--${prefix}-typography-fontWeight-semibold)`,
|
|
3326
|
+
bold: `var(--${prefix}-typography-fontWeight-bold)`
|
|
3327
|
+
},
|
|
3328
|
+
lineHeights: {
|
|
3329
|
+
tight: `var(--${prefix}-typography-lineHeight-tight)`,
|
|
3330
|
+
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
3331
|
+
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
};
|
|
3335
|
+
if (theme.images) {
|
|
3336
|
+
themeVars.images = {};
|
|
3337
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
3338
|
+
const imageConfig = theme.images[imageKey];
|
|
3339
|
+
themeVars.images[imageKey] = {
|
|
3340
|
+
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0,
|
|
3341
|
+
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
3342
|
+
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0
|
|
3343
|
+
};
|
|
3344
|
+
});
|
|
3345
|
+
}
|
|
3346
|
+
return themeVars;
|
|
3347
|
+
};
|
|
2921
3348
|
var createTheme = (config = {}, isDark = false) => {
|
|
2922
3349
|
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
2923
3350
|
const mergedConfig = {
|
|
@@ -2926,6 +3353,10 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
2926
3353
|
colors: {
|
|
2927
3354
|
...baseTheme.colors,
|
|
2928
3355
|
...config.colors,
|
|
3356
|
+
action: {
|
|
3357
|
+
...baseTheme.colors.action,
|
|
3358
|
+
...config.colors?.action || {}
|
|
3359
|
+
},
|
|
2929
3360
|
secondary: {
|
|
2930
3361
|
...baseTheme.colors.secondary,
|
|
2931
3362
|
...config.colors?.secondary || {}
|
|
@@ -2942,11 +3373,32 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
2942
3373
|
shadows: {
|
|
2943
3374
|
...baseTheme.shadows,
|
|
2944
3375
|
...config.shadows
|
|
3376
|
+
},
|
|
3377
|
+
typography: {
|
|
3378
|
+
...baseTheme.typography,
|
|
3379
|
+
...config.typography,
|
|
3380
|
+
fontSizes: {
|
|
3381
|
+
...baseTheme.typography.fontSizes,
|
|
3382
|
+
...config.typography?.fontSizes || {}
|
|
3383
|
+
},
|
|
3384
|
+
fontWeights: {
|
|
3385
|
+
...baseTheme.typography.fontWeights,
|
|
3386
|
+
...config.typography?.fontWeights || {}
|
|
3387
|
+
},
|
|
3388
|
+
lineHeights: {
|
|
3389
|
+
...baseTheme.typography.lineHeights,
|
|
3390
|
+
...config.typography?.lineHeights || {}
|
|
3391
|
+
}
|
|
3392
|
+
},
|
|
3393
|
+
images: {
|
|
3394
|
+
...baseTheme.images,
|
|
3395
|
+
...config.images
|
|
2945
3396
|
}
|
|
2946
3397
|
};
|
|
2947
3398
|
return {
|
|
2948
3399
|
...mergedConfig,
|
|
2949
|
-
cssVariables: toCssVariables(mergedConfig)
|
|
3400
|
+
cssVariables: toCssVariables(mergedConfig),
|
|
3401
|
+
vars: toThemeVars(mergedConfig)
|
|
2950
3402
|
};
|
|
2951
3403
|
};
|
|
2952
3404
|
var createTheme_default = createTheme;
|
|
@@ -2978,6 +3430,58 @@ var deepMerge = (target, ...sources) => {
|
|
|
2978
3430
|
};
|
|
2979
3431
|
var deepMerge_default = deepMerge;
|
|
2980
3432
|
|
|
3433
|
+
// src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
3434
|
+
var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
3435
|
+
if (!baseUrl) {
|
|
3436
|
+
throw new AsgardeoRuntimeError(
|
|
3437
|
+
"Base URL is required to derive organization handle.",
|
|
3438
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-001",
|
|
3439
|
+
"javascript",
|
|
3440
|
+
"A valid base URL must be provided to extract the organization handle."
|
|
3441
|
+
);
|
|
3442
|
+
}
|
|
3443
|
+
let parsedUrl;
|
|
3444
|
+
try {
|
|
3445
|
+
parsedUrl = new URL(baseUrl);
|
|
3446
|
+
} catch (error) {
|
|
3447
|
+
throw new AsgardeoRuntimeError(
|
|
3448
|
+
`Invalid base URL format: ${baseUrl}`,
|
|
3449
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-ValidationError-002",
|
|
3450
|
+
"javascript",
|
|
3451
|
+
"The provided base URL does not conform to valid URL syntax."
|
|
3452
|
+
);
|
|
3453
|
+
}
|
|
3454
|
+
const hostname = parsedUrl.hostname.toLowerCase();
|
|
3455
|
+
if (!hostname.endsWith(".asgardeo.io")) {
|
|
3456
|
+
throw new AsgardeoRuntimeError(
|
|
3457
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3458
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-001",
|
|
3459
|
+
"javascript",
|
|
3460
|
+
"The provided base URL uses a custom domain. Please provide the organizationHandle explicitly in the configuration."
|
|
3461
|
+
);
|
|
3462
|
+
}
|
|
3463
|
+
const pathSegments = parsedUrl.pathname.split("/").filter((segment) => segment.length > 0);
|
|
3464
|
+
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3465
|
+
throw new AsgardeoRuntimeError(
|
|
3466
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3467
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-002",
|
|
3468
|
+
"javascript",
|
|
3469
|
+
"The provided base URL does not follow the expected Asgardeo URL pattern (/t/{orgHandle}). Please provide the organizationHandle explicitly in the configuration."
|
|
3470
|
+
);
|
|
3471
|
+
}
|
|
3472
|
+
const organizationHandle = pathSegments[1];
|
|
3473
|
+
if (!organizationHandle || organizationHandle.trim().length === 0) {
|
|
3474
|
+
throw new AsgardeoRuntimeError(
|
|
3475
|
+
"Organization handle is required since a custom domain is configured.",
|
|
3476
|
+
"javascript-deriveOrganizationHandleFromBaseUrl-CustomDomainError-003",
|
|
3477
|
+
"javascript",
|
|
3478
|
+
"The organization handle could not be extracted from the base URL. Please provide the organizationHandle explicitly in the configuration."
|
|
3479
|
+
);
|
|
3480
|
+
}
|
|
3481
|
+
return organizationHandle;
|
|
3482
|
+
};
|
|
3483
|
+
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
3484
|
+
|
|
2981
3485
|
// src/utils/flattenUserSchema.ts
|
|
2982
3486
|
var flattenUserSchema = (schemas) => {
|
|
2983
3487
|
const flattenedAttributes = [];
|
|
@@ -3218,8 +3722,18 @@ var translations = {
|
|
|
3218
3722
|
"organization.switcher.members": "members",
|
|
3219
3723
|
"organization.switcher.member": "member",
|
|
3220
3724
|
"organization.switcher.create.organization": "Create Organization",
|
|
3221
|
-
"organization.switcher.manage.organizations": "Manage
|
|
3725
|
+
"organization.switcher.manage.organizations": "Manage Organizations",
|
|
3222
3726
|
"organization.switcher.manage.button": "Manage",
|
|
3727
|
+
"organization.switcher.organizations.title": "Organizations",
|
|
3728
|
+
"organization.switcher.switch.button": "Switch",
|
|
3729
|
+
"organization.switcher.no.access": "No Access",
|
|
3730
|
+
"organization.switcher.status.label": "Status:",
|
|
3731
|
+
"organization.switcher.showing.count": "Showing {showing} of {total} organizations",
|
|
3732
|
+
"organization.switcher.refresh.button": "Refresh",
|
|
3733
|
+
"organization.switcher.load.more": "Load More Organizations",
|
|
3734
|
+
"organization.switcher.loading.more": "Loading...",
|
|
3735
|
+
"organization.switcher.no.organizations": "No organizations found",
|
|
3736
|
+
"organization.switcher.error.prefix": "Error:",
|
|
3223
3737
|
"organization.profile.title": "Organization Profile",
|
|
3224
3738
|
"organization.profile.loading": "Loading organization...",
|
|
3225
3739
|
"organization.profile.error": "Failed to load organization",
|
|
@@ -3306,6 +3820,112 @@ var resolveFieldName_default = resolveFieldName;
|
|
|
3306
3820
|
// src/utils/withVendorCSSClassPrefix.ts
|
|
3307
3821
|
var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|
|
3308
3822
|
var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
3823
|
+
|
|
3824
|
+
// src/utils/transformBrandingPreferenceToTheme.ts
|
|
3825
|
+
var extractColorValue = (colorVariant) => {
|
|
3826
|
+
return colorVariant?.main;
|
|
3827
|
+
};
|
|
3828
|
+
var extractContrastText = (colorVariant) => {
|
|
3829
|
+
return colorVariant?.contrastText;
|
|
3830
|
+
};
|
|
3831
|
+
var transformThemeVariant = (themeVariant, isDark = false) => {
|
|
3832
|
+
const colors = themeVariant.colors;
|
|
3833
|
+
const buttons = themeVariant.buttons;
|
|
3834
|
+
const inputs = themeVariant.inputs;
|
|
3835
|
+
const images = themeVariant.images;
|
|
3836
|
+
return {
|
|
3837
|
+
colors: {
|
|
3838
|
+
action: {
|
|
3839
|
+
active: isDark ? "rgba(255, 255, 255, 0.70)" : "rgba(0, 0, 0, 0.54)",
|
|
3840
|
+
hover: isDark ? "rgba(255, 255, 255, 0.04)" : "rgba(0, 0, 0, 0.04)",
|
|
3841
|
+
hoverOpacity: 0.04,
|
|
3842
|
+
selected: isDark ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.08)",
|
|
3843
|
+
selectedOpacity: 0.08,
|
|
3844
|
+
disabled: isDark ? "rgba(255, 255, 255, 0.26)" : "rgba(0, 0, 0, 0.26)",
|
|
3845
|
+
disabledBackground: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
3846
|
+
disabledOpacity: 0.38,
|
|
3847
|
+
focus: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
3848
|
+
focusOpacity: 0.12,
|
|
3849
|
+
activatedOpacity: 0.12
|
|
3850
|
+
},
|
|
3851
|
+
primary: {
|
|
3852
|
+
main: extractColorValue(colors?.primary),
|
|
3853
|
+
contrastText: extractContrastText(colors?.primary)
|
|
3854
|
+
},
|
|
3855
|
+
secondary: {
|
|
3856
|
+
main: extractColorValue(colors?.secondary),
|
|
3857
|
+
contrastText: extractContrastText(colors?.secondary)
|
|
3858
|
+
},
|
|
3859
|
+
background: {
|
|
3860
|
+
surface: extractColorValue(colors?.background?.surface),
|
|
3861
|
+
disabled: extractColorValue(colors?.background?.surface),
|
|
3862
|
+
body: {
|
|
3863
|
+
main: extractColorValue(colors?.background?.body)
|
|
3864
|
+
}
|
|
3865
|
+
},
|
|
3866
|
+
text: {
|
|
3867
|
+
primary: colors?.text?.primary,
|
|
3868
|
+
secondary: colors?.text?.secondary
|
|
3869
|
+
},
|
|
3870
|
+
border: colors?.outlined?.default,
|
|
3871
|
+
error: {
|
|
3872
|
+
main: extractColorValue(colors?.alerts?.error),
|
|
3873
|
+
contrastText: extractContrastText(colors?.alerts?.error)
|
|
3874
|
+
},
|
|
3875
|
+
success: {
|
|
3876
|
+
main: extractColorValue(colors?.alerts?.info),
|
|
3877
|
+
contrastText: extractContrastText(colors?.alerts?.info)
|
|
3878
|
+
},
|
|
3879
|
+
warning: {
|
|
3880
|
+
main: extractColorValue(colors?.alerts?.warning),
|
|
3881
|
+
contrastText: extractContrastText(colors?.alerts?.warning)
|
|
3882
|
+
}
|
|
3883
|
+
},
|
|
3884
|
+
// Extract border radius from buttons or inputs
|
|
3885
|
+
borderRadius: {
|
|
3886
|
+
small: buttons?.primary?.base?.border?.borderRadius || inputs?.base?.border?.borderRadius,
|
|
3887
|
+
medium: buttons?.secondary?.base?.border?.borderRadius,
|
|
3888
|
+
large: buttons?.externalConnection?.base?.border?.borderRadius
|
|
3889
|
+
},
|
|
3890
|
+
// Extract and transform images
|
|
3891
|
+
images: {
|
|
3892
|
+
favicon: images?.favicon ? {
|
|
3893
|
+
url: images.favicon.imgURL,
|
|
3894
|
+
title: images.favicon.title,
|
|
3895
|
+
alt: images.favicon.altText
|
|
3896
|
+
} : void 0,
|
|
3897
|
+
logo: images?.logo ? {
|
|
3898
|
+
url: images.logo.imgURL,
|
|
3899
|
+
title: images.logo.title,
|
|
3900
|
+
alt: images.logo.altText
|
|
3901
|
+
} : void 0
|
|
3902
|
+
}
|
|
3903
|
+
};
|
|
3904
|
+
};
|
|
3905
|
+
var transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
|
|
3906
|
+
const themeConfig = brandingPreference?.preference?.theme;
|
|
3907
|
+
if (!themeConfig) {
|
|
3908
|
+
return createTheme_default({}, false);
|
|
3909
|
+
}
|
|
3910
|
+
let activeThemeKey;
|
|
3911
|
+
if (forceTheme) {
|
|
3912
|
+
activeThemeKey = forceTheme.toUpperCase();
|
|
3913
|
+
} else {
|
|
3914
|
+
activeThemeKey = themeConfig.activeTheme || "LIGHT";
|
|
3915
|
+
}
|
|
3916
|
+
const themeVariant = themeConfig[activeThemeKey];
|
|
3917
|
+
if (!themeVariant) {
|
|
3918
|
+
const fallbackVariant = themeConfig.LIGHT || themeConfig.DARK;
|
|
3919
|
+
if (fallbackVariant) {
|
|
3920
|
+
const transformedConfig2 = transformThemeVariant(fallbackVariant, activeThemeKey === "DARK");
|
|
3921
|
+
return createTheme_default(transformedConfig2, activeThemeKey === "DARK");
|
|
3922
|
+
}
|
|
3923
|
+
return createTheme_default({}, activeThemeKey === "DARK");
|
|
3924
|
+
}
|
|
3925
|
+
const transformedConfig = transformThemeVariant(themeVariant, activeThemeKey === "DARK");
|
|
3926
|
+
return createTheme_default(transformedConfig, activeThemeKey === "DARK");
|
|
3927
|
+
};
|
|
3928
|
+
var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
|
|
3309
3929
|
export {
|
|
3310
3930
|
ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants,
|
|
3311
3931
|
AsgardeoAPIError,
|
|
@@ -3336,6 +3956,7 @@ export {
|
|
|
3336
3956
|
createPatchOperations,
|
|
3337
3957
|
createTheme_default as createTheme,
|
|
3338
3958
|
deepMerge_default as deepMerge,
|
|
3959
|
+
deriveOrganizationHandleFromBaseUrl_default as deriveOrganizationHandleFromBaseUrl,
|
|
3339
3960
|
executeEmbeddedSignInFlow_default as executeEmbeddedSignInFlow,
|
|
3340
3961
|
executeEmbeddedSignUpFlow_default as executeEmbeddedSignUpFlow,
|
|
3341
3962
|
extractPkceStorageKeyFromState_default as extractPkceStorageKeyFromState,
|
|
@@ -3345,6 +3966,7 @@ export {
|
|
|
3345
3966
|
generateUserProfile_default as generateUserProfile,
|
|
3346
3967
|
get_default as get,
|
|
3347
3968
|
getAllOrganizations_default as getAllOrganizations,
|
|
3969
|
+
getBrandingPreference_default as getBrandingPreference,
|
|
3348
3970
|
getI18nBundles_default as getI18nBundles,
|
|
3349
3971
|
getLatestStateParam_default as getLatestStateParam,
|
|
3350
3972
|
getMeOrganizations_default as getMeOrganizations,
|
|
@@ -3355,10 +3977,12 @@ export {
|
|
|
3355
3977
|
initializeEmbeddedSignInFlow_default as initializeEmbeddedSignInFlow,
|
|
3356
3978
|
isEmpty_default as isEmpty,
|
|
3357
3979
|
processOpenIDScopes_default as processOpenIDScopes,
|
|
3980
|
+
processUsername_default as processUsername,
|
|
3358
3981
|
removeTrailingSlash_default as removeTrailingSlash,
|
|
3359
3982
|
resolveFieldName_default as resolveFieldName,
|
|
3360
3983
|
resolveFieldType_default as resolveFieldType,
|
|
3361
3984
|
set_default as set,
|
|
3985
|
+
transformBrandingPreferenceToTheme_default as transformBrandingPreferenceToTheme,
|
|
3362
3986
|
updateMeProfile_default as updateMeProfile,
|
|
3363
3987
|
updateOrganization_default as updateOrganization,
|
|
3364
3988
|
withVendorCSSClassPrefix_default as withVendorCSSClassPrefix
|