@asgardeo/javascript 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__legacy__/client.d.ts.map +1 -1
- package/dist/__legacy__/models/client-config.d.ts +9 -0
- package/dist/__legacy__/models/client-config.d.ts.map +1 -1
- package/dist/api/createOrganization.d.ts.map +1 -1
- package/dist/api/executeEmbeddedSignInFlow.d.ts.map +1 -1
- package/dist/api/executeEmbeddedSignUpFlow.d.ts.map +1 -1
- package/dist/api/getAllOrganizations.d.ts.map +1 -1
- package/dist/api/getBrandingPreference.d.ts.map +1 -1
- package/dist/api/getMeOrganizations.d.ts.map +1 -1
- package/dist/api/getOrganization.d.ts.map +1 -1
- package/dist/api/getSchemas.d.ts.map +1 -1
- package/dist/api/getScim2Me.d.ts.map +1 -1
- package/dist/api/getUserInfo.d.ts.map +1 -1
- package/dist/api/initializeEmbeddedSignInFlow.d.ts.map +1 -1
- package/dist/api/updateMeProfile.d.ts.map +1 -1
- package/dist/api/updateOrganization.d.ts.map +1 -1
- package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts.map +1 -1
- package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts.map +1 -1
- package/dist/api/v2/executeEmbeddedUserOnboardingFlowV2.d.ts.map +1 -1
- package/dist/api/v2/getFlowMetaV2.d.ts.map +1 -1
- package/dist/api/v2/getOrganizationUnitChildren.d.ts.map +1 -1
- package/dist/cjs/index.js +976 -903
- package/dist/cjs/index.js.map +4 -4
- package/dist/edge/index.js +976 -903
- package/dist/edge/index.js.map +4 -4
- package/dist/errors/AsgardeoAPIError.d.ts +9 -3
- package/dist/errors/AsgardeoAPIError.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +976 -903
- package/dist/index.js.map +4 -4
- package/dist/models/config.d.ts +22 -1
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/token-endpoint-auth.d.ts +30 -0
- package/dist/models/token-endpoint-auth.d.ts.map +1 -0
- package/dist/utils/base64Encode.d.ts +36 -0
- package/dist/utils/base64Encode.d.ts.map +1 -0
- package/dist/utils/parseApiErrorMessage.d.ts +29 -0
- package/dist/utils/parseApiErrorMessage.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/edge/index.js
CHANGED
|
@@ -952,6 +952,16 @@ var StorageManager = class _StorageManager {
|
|
|
952
952
|
};
|
|
953
953
|
var StorageManager_default = StorageManager;
|
|
954
954
|
|
|
955
|
+
// src/utils/base64Encode.ts
|
|
956
|
+
import * as jose from "jose";
|
|
957
|
+
var base64Encode = (value) => {
|
|
958
|
+
const b64url = jose.base64url.encode(new TextEncoder().encode(value));
|
|
959
|
+
const rem = b64url.length % 4;
|
|
960
|
+
const padded = rem === 0 ? b64url : b64url + "=".repeat(4 - rem);
|
|
961
|
+
return padded.replace(/-/g, "+").replace(/_/g, "/");
|
|
962
|
+
};
|
|
963
|
+
var base64Encode_default = base64Encode;
|
|
964
|
+
|
|
955
965
|
// src/utils/deepMerge.ts
|
|
956
966
|
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === "[object Object]";
|
|
957
967
|
var deepMerge = (target, ...sources) => {
|
|
@@ -1318,7 +1328,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1318
1328
|
}
|
|
1319
1329
|
const body = new URLSearchParams();
|
|
1320
1330
|
body.set("client_id", configData.clientId);
|
|
1321
|
-
|
|
1331
|
+
const hasSecret = Boolean(configData.clientSecret && configData.clientSecret.trim().length > 0);
|
|
1332
|
+
const tokenEndpointAuthMethod = configData.tokenRequest?.authMethod ?? (configData.platform === "AsgardeoV2" /* AsgardeoV2 */ ? "client_secret_basic" : "client_secret_post");
|
|
1333
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_post") {
|
|
1322
1334
|
body.set("client_secret", configData.clientSecret);
|
|
1323
1335
|
}
|
|
1324
1336
|
const code = authorizationCode;
|
|
@@ -1337,15 +1349,22 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1337
1349
|
);
|
|
1338
1350
|
await this.storageManager.removeTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), userId);
|
|
1339
1351
|
}
|
|
1352
|
+
const tokenRequestHeaders = {
|
|
1353
|
+
Accept: "application/json",
|
|
1354
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1355
|
+
};
|
|
1356
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_basic") {
|
|
1357
|
+
const credential = `${encodeURIComponent(configData.clientId)}:${encodeURIComponent(
|
|
1358
|
+
configData.clientSecret
|
|
1359
|
+
)}`;
|
|
1360
|
+
tokenRequestHeaders["Authorization"] = `Basic ${base64Encode_default(credential)}`;
|
|
1361
|
+
}
|
|
1340
1362
|
let tokenResponse;
|
|
1341
1363
|
try {
|
|
1342
1364
|
tokenResponse = await fetch(tokenEndpoint, {
|
|
1343
1365
|
body,
|
|
1344
1366
|
credentials: configData.sendCookiesInRequests ? "include" : "same-origin",
|
|
1345
|
-
headers:
|
|
1346
|
-
Accept: "application/json",
|
|
1347
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
1348
|
-
},
|
|
1367
|
+
headers: tokenRequestHeaders,
|
|
1349
1368
|
method: "POST"
|
|
1350
1369
|
});
|
|
1351
1370
|
} catch (error2) {
|
|
@@ -2021,20 +2040,37 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
2021
2040
|
__publicField(_AsgardeoAuthClient, "authHelperInstance");
|
|
2022
2041
|
var AsgardeoAuthClient = _AsgardeoAuthClient;
|
|
2023
2042
|
|
|
2043
|
+
// src/utils/parseApiErrorMessage.ts
|
|
2044
|
+
var parseApiErrorMessage = (errorText) => {
|
|
2045
|
+
try {
|
|
2046
|
+
const parsed = JSON.parse(errorText);
|
|
2047
|
+
const description = parsed["description"];
|
|
2048
|
+
const message = parsed["message"];
|
|
2049
|
+
if (description?.defaultValue) return description.defaultValue;
|
|
2050
|
+
if (message?.defaultValue) return message.defaultValue;
|
|
2051
|
+
} catch {
|
|
2052
|
+
}
|
|
2053
|
+
return errorText;
|
|
2054
|
+
};
|
|
2055
|
+
var parseApiErrorMessage_default = parseApiErrorMessage;
|
|
2056
|
+
|
|
2024
2057
|
// src/errors/AsgardeoAPIError.ts
|
|
2025
2058
|
var AsgardeoAPIError = class extends AsgardeoError {
|
|
2026
2059
|
/**
|
|
2027
2060
|
* Creates an instance of AsgardeoAPIError.
|
|
2028
2061
|
*
|
|
2029
|
-
* @param message - Human-readable description
|
|
2062
|
+
* @param message - Human-readable description or raw API error response body
|
|
2030
2063
|
* @param code - A unique error code that identifies the error type
|
|
2064
|
+
* @param origin - The SDK origin (e.g. 'react', 'vue')
|
|
2031
2065
|
* @param statusCode - HTTP status code of the failed request
|
|
2032
2066
|
* @param statusText - HTTP status text of the failed request
|
|
2033
|
-
* @param
|
|
2067
|
+
* @param prefix - Optional prefix prepended to the resolved message
|
|
2034
2068
|
* @constructor
|
|
2035
2069
|
*/
|
|
2036
|
-
constructor(message, code, origin, statusCode, statusText) {
|
|
2037
|
-
|
|
2070
|
+
constructor(message, code, origin, statusCode, statusText, prefix) {
|
|
2071
|
+
const parsed = parseApiErrorMessage_default(message);
|
|
2072
|
+
const resolvedMessage = prefix ? `${prefix}: ${parsed}` : parsed;
|
|
2073
|
+
super(resolvedMessage, code, origin);
|
|
2038
2074
|
this.statusCode = statusCode;
|
|
2039
2075
|
this.statusText = statusText;
|
|
2040
2076
|
Object.defineProperty(this, "name", {
|
|
@@ -2101,11 +2137,12 @@ var initializeEmbeddedSignInFlow = async ({
|
|
|
2101
2137
|
if (!response.ok) {
|
|
2102
2138
|
const errorText = await response.text();
|
|
2103
2139
|
throw new AsgardeoAPIError(
|
|
2104
|
-
|
|
2140
|
+
errorText,
|
|
2105
2141
|
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2106
2142
|
"javascript",
|
|
2107
2143
|
response.status,
|
|
2108
|
-
response.statusText
|
|
2144
|
+
response.statusText,
|
|
2145
|
+
"Authorization request failed"
|
|
2109
2146
|
);
|
|
2110
2147
|
}
|
|
2111
2148
|
return await response.json();
|
|
@@ -2165,11 +2202,12 @@ var executeEmbeddedSignInFlow = async ({
|
|
|
2165
2202
|
if (!response.ok) {
|
|
2166
2203
|
const errorText = await response.text();
|
|
2167
2204
|
throw new AsgardeoAPIError(
|
|
2168
|
-
|
|
2205
|
+
errorText,
|
|
2169
2206
|
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2170
2207
|
"javascript",
|
|
2171
2208
|
response.status,
|
|
2172
|
-
response.statusText
|
|
2209
|
+
response.statusText,
|
|
2210
|
+
"Authorization request failed"
|
|
2173
2211
|
);
|
|
2174
2212
|
}
|
|
2175
2213
|
return await response.json();
|
|
@@ -2263,11 +2301,12 @@ var executeEmbeddedSignUpFlow = async ({
|
|
|
2263
2301
|
if (!response.ok) {
|
|
2264
2302
|
const errorText = await response.text();
|
|
2265
2303
|
throw new AsgardeoAPIError(
|
|
2266
|
-
|
|
2304
|
+
errorText,
|
|
2267
2305
|
"javascript-executeEmbeddedSignUpFlow-ResponseError-100",
|
|
2268
2306
|
"javascript",
|
|
2269
2307
|
response.status,
|
|
2270
|
-
response.statusText
|
|
2308
|
+
response.statusText,
|
|
2309
|
+
"Embedded SignUp flow execution failed"
|
|
2271
2310
|
);
|
|
2272
2311
|
}
|
|
2273
2312
|
return await response.json();
|
|
@@ -2312,11 +2351,12 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2312
2351
|
if (!response.ok) {
|
|
2313
2352
|
const errorText = await response.text();
|
|
2314
2353
|
throw new AsgardeoAPIError(
|
|
2315
|
-
|
|
2354
|
+
errorText,
|
|
2316
2355
|
"getUserInfo-ResponseError-001",
|
|
2317
2356
|
"javascript",
|
|
2318
2357
|
response.status,
|
|
2319
|
-
response.statusText
|
|
2358
|
+
response.statusText,
|
|
2359
|
+
"Failed to fetch user info"
|
|
2320
2360
|
);
|
|
2321
2361
|
}
|
|
2322
2362
|
return await response.json();
|
|
@@ -2390,11 +2430,12 @@ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2390
2430
|
if (!response?.ok) {
|
|
2391
2431
|
const errorText = await response.text();
|
|
2392
2432
|
throw new AsgardeoAPIError(
|
|
2393
|
-
|
|
2433
|
+
errorText,
|
|
2394
2434
|
"getScim2Me-ResponseError-001",
|
|
2395
2435
|
"javascript",
|
|
2396
2436
|
response.status,
|
|
2397
|
-
response.statusText
|
|
2437
|
+
response.statusText,
|
|
2438
|
+
"Failed to fetch user profile"
|
|
2398
2439
|
);
|
|
2399
2440
|
}
|
|
2400
2441
|
const user = await response.json();
|
|
@@ -2443,11 +2484,12 @@ var getSchemas = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2443
2484
|
if (!response?.ok) {
|
|
2444
2485
|
const errorText = await response.text();
|
|
2445
2486
|
throw new AsgardeoAPIError(
|
|
2446
|
-
|
|
2487
|
+
errorText,
|
|
2447
2488
|
"getSchemas-ResponseError-001",
|
|
2448
2489
|
"javascript",
|
|
2449
2490
|
response.status,
|
|
2450
|
-
response.statusText
|
|
2491
|
+
response.statusText,
|
|
2492
|
+
"Failed to fetch SCIM2 schemas"
|
|
2451
2493
|
);
|
|
2452
2494
|
}
|
|
2453
2495
|
return await response.json();
|
|
@@ -2511,11 +2553,12 @@ var getAllOrganizations = async ({
|
|
|
2511
2553
|
if (!response?.ok) {
|
|
2512
2554
|
const errorText = await response.text();
|
|
2513
2555
|
throw new AsgardeoAPIError(
|
|
2514
|
-
|
|
2556
|
+
errorText,
|
|
2515
2557
|
"getAllOrganizations-ResponseError-001",
|
|
2516
2558
|
"javascript",
|
|
2517
2559
|
response.status,
|
|
2518
|
-
response.statusText
|
|
2560
|
+
response.statusText,
|
|
2561
|
+
"Failed to get organizations"
|
|
2519
2562
|
);
|
|
2520
2563
|
}
|
|
2521
2564
|
const data = await response.json();
|
|
@@ -2588,11 +2631,12 @@ var createOrganization = async ({
|
|
|
2588
2631
|
if (!response?.ok) {
|
|
2589
2632
|
const errorText = await response.text();
|
|
2590
2633
|
throw new AsgardeoAPIError(
|
|
2591
|
-
|
|
2634
|
+
errorText,
|
|
2592
2635
|
"createOrganization-ResponseError-001",
|
|
2593
2636
|
"javascript",
|
|
2594
2637
|
response.status,
|
|
2595
|
-
response.statusText
|
|
2638
|
+
response.statusText,
|
|
2639
|
+
"Failed to create organization"
|
|
2596
2640
|
);
|
|
2597
2641
|
}
|
|
2598
2642
|
return await response.json();
|
|
@@ -2662,11 +2706,12 @@ var getMeOrganizations = async ({
|
|
|
2662
2706
|
if (!response?.ok) {
|
|
2663
2707
|
const errorText = await response.text();
|
|
2664
2708
|
throw new AsgardeoAPIError(
|
|
2665
|
-
|
|
2709
|
+
errorText,
|
|
2666
2710
|
"getMeOrganizations-ResponseError-001",
|
|
2667
2711
|
"javascript",
|
|
2668
2712
|
response.status,
|
|
2669
|
-
response.statusText
|
|
2713
|
+
response.statusText,
|
|
2714
|
+
"Failed to fetch associated organizations of the user"
|
|
2670
2715
|
);
|
|
2671
2716
|
}
|
|
2672
2717
|
const data = await response.json();
|
|
@@ -2729,11 +2774,12 @@ var getOrganization = async ({
|
|
|
2729
2774
|
if (!response?.ok) {
|
|
2730
2775
|
const errorText = await response.text();
|
|
2731
2776
|
throw new AsgardeoAPIError(
|
|
2732
|
-
|
|
2777
|
+
errorText,
|
|
2733
2778
|
"getOrganization-ResponseError-001",
|
|
2734
2779
|
"javascript",
|
|
2735
2780
|
response.status,
|
|
2736
|
-
response.statusText
|
|
2781
|
+
response.statusText,
|
|
2782
|
+
"Failed to fetch organization details"
|
|
2737
2783
|
);
|
|
2738
2784
|
}
|
|
2739
2785
|
return await response.json();
|
|
@@ -2824,11 +2870,12 @@ var updateOrganization = async ({
|
|
|
2824
2870
|
if (!response?.ok) {
|
|
2825
2871
|
const errorText = await response.text();
|
|
2826
2872
|
throw new AsgardeoAPIError(
|
|
2827
|
-
|
|
2873
|
+
errorText,
|
|
2828
2874
|
"updateOrganization-ResponseError-001",
|
|
2829
2875
|
"javascript",
|
|
2830
2876
|
response.status,
|
|
2831
|
-
response.statusText
|
|
2877
|
+
response.statusText,
|
|
2878
|
+
"Failed to update organization"
|
|
2832
2879
|
);
|
|
2833
2880
|
}
|
|
2834
2881
|
return await response.json();
|
|
@@ -2905,11 +2952,12 @@ var updateMeProfile = async ({
|
|
|
2905
2952
|
if (!response?.ok) {
|
|
2906
2953
|
const errorText = await response.text();
|
|
2907
2954
|
throw new AsgardeoAPIError(
|
|
2908
|
-
|
|
2955
|
+
errorText,
|
|
2909
2956
|
"updateMeProfile-ResponseError-001",
|
|
2910
2957
|
"javascript",
|
|
2911
2958
|
response.status,
|
|
2912
|
-
response.statusText
|
|
2959
|
+
response.statusText,
|
|
2960
|
+
"Failed to update user profile"
|
|
2913
2961
|
);
|
|
2914
2962
|
}
|
|
2915
2963
|
return processUsername_default(await response.json());
|
|
@@ -2928,183 +2976,547 @@ var updateMeProfile = async ({
|
|
|
2928
2976
|
};
|
|
2929
2977
|
var updateMeProfile_default = updateMeProfile;
|
|
2930
2978
|
|
|
2931
|
-
// src/
|
|
2932
|
-
var
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2979
|
+
// src/utils/logger.ts
|
|
2980
|
+
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
2981
|
+
var DEFAULT_CONFIG = {
|
|
2982
|
+
level: "info",
|
|
2983
|
+
prefix: `${PREFIX}`,
|
|
2984
|
+
showLevel: true,
|
|
2985
|
+
timestamps: true
|
|
2986
|
+
};
|
|
2987
|
+
var isBrowser = () => (
|
|
2988
|
+
/* @ts-ignore */
|
|
2989
|
+
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
2990
|
+
);
|
|
2991
|
+
var isNode = () => (
|
|
2992
|
+
/* @ts-ignore */
|
|
2993
|
+
typeof process !== "undefined" && void 0
|
|
2994
|
+
);
|
|
2995
|
+
var COLORS = {
|
|
2996
|
+
blue: "\x1B[34m",
|
|
2997
|
+
bright: "\x1B[1m",
|
|
2998
|
+
cyan: "\x1B[36m",
|
|
2999
|
+
dim: "\x1B[2m",
|
|
3000
|
+
gray: "\x1B[90m",
|
|
3001
|
+
green: "\x1B[32m",
|
|
3002
|
+
magenta: "\x1B[35m",
|
|
3003
|
+
red: "\x1B[31m",
|
|
3004
|
+
reset: "\x1B[0m",
|
|
3005
|
+
white: "\x1B[37m",
|
|
3006
|
+
yellow: "\x1B[33m"
|
|
3007
|
+
};
|
|
3008
|
+
var BROWSER_STYLES = {
|
|
3009
|
+
debug: "color: #6b7280; font-weight: normal;",
|
|
3010
|
+
error: "color: #dc2626; font-weight: bold;",
|
|
3011
|
+
info: "color: #2563eb; font-weight: bold;",
|
|
3012
|
+
prefix: "color: #7c3aed; font-weight: bold;",
|
|
3013
|
+
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
3014
|
+
warn: "color: #d97706; font-weight: bold;"
|
|
3015
|
+
};
|
|
3016
|
+
var LOG_LEVEL_ORDER = {
|
|
3017
|
+
debug: 0,
|
|
3018
|
+
error: 3,
|
|
3019
|
+
info: 1,
|
|
3020
|
+
warn: 2
|
|
3021
|
+
};
|
|
3022
|
+
var Logger = class _Logger {
|
|
3023
|
+
constructor(config = {}) {
|
|
3024
|
+
__publicField(this, "config");
|
|
3025
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
2950
3026
|
}
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
type: type || ""
|
|
2957
|
-
}).filter(([, value]) => Boolean(value))
|
|
2958
|
-
)
|
|
2959
|
-
);
|
|
2960
|
-
const fetchFn = fetcher || fetch;
|
|
2961
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2962
|
-
const requestInit = {
|
|
2963
|
-
...requestConfig,
|
|
2964
|
-
headers: {
|
|
2965
|
-
Accept: "application/json",
|
|
2966
|
-
"Content-Type": "application/json",
|
|
2967
|
-
...requestConfig.headers
|
|
2968
|
-
},
|
|
2969
|
-
method: "GET"
|
|
2970
|
-
};
|
|
2971
|
-
try {
|
|
2972
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
2973
|
-
if (!response?.ok) {
|
|
2974
|
-
const errorText = await response.text();
|
|
2975
|
-
throw new AsgardeoAPIError(
|
|
2976
|
-
`Failed to get branding preference: ${errorText}`,
|
|
2977
|
-
"getBrandingPreference-ResponseError-001",
|
|
2978
|
-
"javascript",
|
|
2979
|
-
response.status,
|
|
2980
|
-
response.statusText
|
|
2981
|
-
);
|
|
2982
|
-
}
|
|
2983
|
-
const data = await response.json();
|
|
2984
|
-
return data;
|
|
2985
|
-
} catch (error2) {
|
|
2986
|
-
if (error2 instanceof AsgardeoAPIError) {
|
|
2987
|
-
throw error2;
|
|
2988
|
-
}
|
|
2989
|
-
throw new AsgardeoAPIError(
|
|
2990
|
-
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
2991
|
-
"getBrandingPreference-NetworkError-001",
|
|
2992
|
-
"javascript",
|
|
2993
|
-
0,
|
|
2994
|
-
"Network Error"
|
|
2995
|
-
);
|
|
3027
|
+
/**
|
|
3028
|
+
* Update logger configuration
|
|
3029
|
+
*/
|
|
3030
|
+
configure(config) {
|
|
3031
|
+
this.config = { ...this.config, ...config };
|
|
2996
3032
|
}
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3003
|
-
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3004
|
-
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3005
|
-
return EmbeddedSignInFlowStatus3;
|
|
3006
|
-
})(EmbeddedSignInFlowStatus || {});
|
|
3007
|
-
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3008
|
-
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3009
|
-
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3010
|
-
return EmbeddedSignInFlowType3;
|
|
3011
|
-
})(EmbeddedSignInFlowType || {});
|
|
3012
|
-
|
|
3013
|
-
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3014
|
-
var executeEmbeddedSignInFlowV2 = async ({
|
|
3015
|
-
url,
|
|
3016
|
-
baseUrl,
|
|
3017
|
-
payload,
|
|
3018
|
-
authId,
|
|
3019
|
-
...requestConfig
|
|
3020
|
-
}) => {
|
|
3021
|
-
if (!payload) {
|
|
3022
|
-
throw new AsgardeoAPIError(
|
|
3023
|
-
"Authorization payload is required",
|
|
3024
|
-
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3025
|
-
"javascript",
|
|
3026
|
-
400,
|
|
3027
|
-
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3028
|
-
);
|
|
3033
|
+
/**
|
|
3034
|
+
* Get current configuration
|
|
3035
|
+
*/
|
|
3036
|
+
getConfig() {
|
|
3037
|
+
return { ...this.config };
|
|
3029
3038
|
}
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
const response = await fetch(endpoint, {
|
|
3036
|
-
...requestConfig,
|
|
3037
|
-
body: JSON.stringify(requestPayload),
|
|
3038
|
-
headers: {
|
|
3039
|
-
Accept: "application/json",
|
|
3040
|
-
"Content-Type": "application/json",
|
|
3041
|
-
...requestConfig.headers
|
|
3042
|
-
},
|
|
3043
|
-
method: requestConfig.method || "POST"
|
|
3044
|
-
});
|
|
3045
|
-
if (!response.ok) {
|
|
3046
|
-
const errorText = await response.text();
|
|
3047
|
-
throw new AsgardeoAPIError(
|
|
3048
|
-
`Authorization request failed: ${errorText}`,
|
|
3049
|
-
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3050
|
-
"javascript",
|
|
3051
|
-
response.status,
|
|
3052
|
-
response.statusText
|
|
3053
|
-
);
|
|
3039
|
+
/**
|
|
3040
|
+
* Check if a log level should be output
|
|
3041
|
+
*/
|
|
3042
|
+
shouldLog(level) {
|
|
3043
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
3054
3044
|
}
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
assertion: flowResponse.assertion,
|
|
3061
|
-
authId
|
|
3062
|
-
}),
|
|
3063
|
-
credentials: "include",
|
|
3064
|
-
headers: {
|
|
3065
|
-
Accept: "application/json",
|
|
3066
|
-
"Content-Type": "application/json",
|
|
3067
|
-
...requestConfig.headers
|
|
3068
|
-
},
|
|
3069
|
-
method: "POST"
|
|
3070
|
-
});
|
|
3071
|
-
if (!oauth2Response.ok) {
|
|
3072
|
-
const oauth2ErrorText = await oauth2Response.text();
|
|
3073
|
-
throw new AsgardeoAPIError(
|
|
3074
|
-
`OAuth2 authorization failed: ${oauth2ErrorText}`,
|
|
3075
|
-
"executeEmbeddedSignInFlow-OAuth2Error-002",
|
|
3076
|
-
"javascript",
|
|
3077
|
-
oauth2Response.status,
|
|
3078
|
-
oauth2Response.statusText
|
|
3079
|
-
);
|
|
3080
|
-
}
|
|
3081
|
-
const oauth2Result = await oauth2Response.json();
|
|
3082
|
-
return {
|
|
3083
|
-
flowStatus: flowResponse.flowStatus,
|
|
3084
|
-
redirectUrl: oauth2Result["redirect_uri"]
|
|
3085
|
-
};
|
|
3086
|
-
} catch (authError) {
|
|
3087
|
-
throw new AsgardeoAPIError(
|
|
3088
|
-
`OAuth2 authorization failed: ${authError instanceof Error ? authError.message : "Unknown error"}`,
|
|
3089
|
-
"executeEmbeddedSignInFlow-OAuth2Error-001",
|
|
3090
|
-
"javascript",
|
|
3091
|
-
500,
|
|
3092
|
-
"Failed to complete OAuth2 authorization after successful embedded sign-in flow."
|
|
3093
|
-
);
|
|
3094
|
-
}
|
|
3045
|
+
/**
|
|
3046
|
+
* Get timestamp string
|
|
3047
|
+
*/
|
|
3048
|
+
static getTimestamp() {
|
|
3049
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3095
3050
|
}
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3051
|
+
/**
|
|
3052
|
+
* Get log level string
|
|
3053
|
+
*/
|
|
3054
|
+
static getLevelString(level) {
|
|
3055
|
+
switch (level) {
|
|
3056
|
+
case "debug":
|
|
3057
|
+
return "DEBUG";
|
|
3058
|
+
case "info":
|
|
3059
|
+
return "INFO";
|
|
3060
|
+
case "warn":
|
|
3061
|
+
return "WARN";
|
|
3062
|
+
case "error":
|
|
3063
|
+
return "ERROR";
|
|
3064
|
+
default:
|
|
3065
|
+
return "UNKNOWN";
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
/**
|
|
3069
|
+
* Format message for Node.js terminal
|
|
3070
|
+
*/
|
|
3071
|
+
formatForNode(level, message) {
|
|
3072
|
+
const parts = [];
|
|
3073
|
+
if (this.config.timestamps) {
|
|
3074
|
+
parts.push(`${COLORS.gray}[${_Logger.getTimestamp()}]${COLORS.reset}`);
|
|
3075
|
+
}
|
|
3076
|
+
if (this.config.prefix) {
|
|
3077
|
+
parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
3078
|
+
}
|
|
3079
|
+
if (this.config.showLevel) {
|
|
3080
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3081
|
+
let coloredLevel;
|
|
3082
|
+
switch (level) {
|
|
3083
|
+
case "debug":
|
|
3084
|
+
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
3085
|
+
break;
|
|
3086
|
+
case "info":
|
|
3087
|
+
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
3088
|
+
break;
|
|
3089
|
+
case "warn":
|
|
3090
|
+
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
3091
|
+
break;
|
|
3092
|
+
case "error":
|
|
3093
|
+
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
3094
|
+
break;
|
|
3095
|
+
default:
|
|
3096
|
+
coloredLevel = `[${levelStr}]`;
|
|
3097
|
+
}
|
|
3098
|
+
parts.push(coloredLevel);
|
|
3099
|
+
}
|
|
3100
|
+
parts.push(message);
|
|
3101
|
+
return parts.join(" ");
|
|
3102
|
+
}
|
|
3103
|
+
/**
|
|
3104
|
+
* Log message using appropriate method
|
|
3105
|
+
*/
|
|
3106
|
+
logMessage(level, message, ...args) {
|
|
3107
|
+
if (!this.shouldLog(level)) {
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
if (this.config.formatter) {
|
|
3111
|
+
this.config.formatter(level, message, ...args);
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
if (isBrowser()) {
|
|
3115
|
+
this.logToBrowser(level, message, ...args);
|
|
3116
|
+
} else if (isNode()) {
|
|
3117
|
+
this.logToNode(level, message, ...args);
|
|
3118
|
+
} else {
|
|
3119
|
+
console.log(message, ...args);
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
/**
|
|
3123
|
+
* Log to browser console with styling
|
|
3124
|
+
*/
|
|
3125
|
+
logToBrowser(level, message, ...args) {
|
|
3126
|
+
const parts = [];
|
|
3127
|
+
const styles = [];
|
|
3128
|
+
if (this.config.timestamps) {
|
|
3129
|
+
parts.push(`%c[${_Logger.getTimestamp()}]`);
|
|
3130
|
+
styles.push(BROWSER_STYLES.timestamp);
|
|
3131
|
+
}
|
|
3132
|
+
if (this.config.prefix) {
|
|
3133
|
+
parts.push(`%c${this.config.prefix}`);
|
|
3134
|
+
styles.push(BROWSER_STYLES.prefix);
|
|
3135
|
+
}
|
|
3136
|
+
if (this.config.showLevel) {
|
|
3137
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3138
|
+
parts.push(`%c[${levelStr}]`);
|
|
3139
|
+
switch (level) {
|
|
3140
|
+
case "debug":
|
|
3141
|
+
styles.push(BROWSER_STYLES.debug);
|
|
3142
|
+
break;
|
|
3143
|
+
case "info":
|
|
3144
|
+
styles.push(BROWSER_STYLES.info);
|
|
3145
|
+
break;
|
|
3146
|
+
case "warn":
|
|
3147
|
+
styles.push(BROWSER_STYLES.warn);
|
|
3148
|
+
break;
|
|
3149
|
+
case "error":
|
|
3150
|
+
styles.push(BROWSER_STYLES.error);
|
|
3151
|
+
break;
|
|
3152
|
+
default:
|
|
3153
|
+
styles.push("");
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
parts.push(`%c${message}`);
|
|
3157
|
+
styles.push("color: inherit; font-weight: normal;");
|
|
3158
|
+
const formattedMessage = parts.join(" ");
|
|
3159
|
+
switch (level) {
|
|
3160
|
+
case "debug":
|
|
3161
|
+
console.debug(formattedMessage, ...styles, ...args);
|
|
3162
|
+
break;
|
|
3163
|
+
case "info":
|
|
3164
|
+
console.info(formattedMessage, ...styles, ...args);
|
|
3165
|
+
break;
|
|
3166
|
+
case "warn":
|
|
3167
|
+
console.warn(formattedMessage, ...styles, ...args);
|
|
3168
|
+
break;
|
|
3169
|
+
case "error":
|
|
3170
|
+
console.error(formattedMessage, ...styles, ...args);
|
|
3171
|
+
break;
|
|
3172
|
+
default:
|
|
3173
|
+
console.log(formattedMessage, ...styles, ...args);
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
/**
|
|
3177
|
+
* Log to Node.js console
|
|
3178
|
+
*/
|
|
3179
|
+
logToNode(level, message, ...args) {
|
|
3180
|
+
const formattedMessage = this.formatForNode(level, message);
|
|
3181
|
+
switch (level) {
|
|
3182
|
+
case "debug":
|
|
3183
|
+
console.debug(formattedMessage, ...args);
|
|
3184
|
+
break;
|
|
3185
|
+
case "info":
|
|
3186
|
+
console.info(formattedMessage, ...args);
|
|
3187
|
+
break;
|
|
3188
|
+
case "warn":
|
|
3189
|
+
console.warn(formattedMessage, ...args);
|
|
3190
|
+
break;
|
|
3191
|
+
case "error":
|
|
3192
|
+
console.error(formattedMessage, ...args);
|
|
3193
|
+
break;
|
|
3194
|
+
default:
|
|
3195
|
+
console.log(formattedMessage, ...args);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
/**
|
|
3199
|
+
* Log debug message
|
|
3200
|
+
*/
|
|
3201
|
+
debug(message, ...args) {
|
|
3202
|
+
this.logMessage("debug", message, ...args);
|
|
3203
|
+
}
|
|
3204
|
+
/**
|
|
3205
|
+
* Log info message
|
|
3206
|
+
*/
|
|
3207
|
+
info(message, ...args) {
|
|
3208
|
+
this.logMessage("info", message, ...args);
|
|
3209
|
+
}
|
|
3210
|
+
/**
|
|
3211
|
+
* Log warning message
|
|
3212
|
+
*/
|
|
3213
|
+
warn(message, ...args) {
|
|
3214
|
+
this.logMessage("warn", message, ...args);
|
|
3215
|
+
}
|
|
3216
|
+
/**
|
|
3217
|
+
* Log error message
|
|
3218
|
+
*/
|
|
3219
|
+
error(message, ...args) {
|
|
3220
|
+
this.logMessage("error", message, ...args);
|
|
3221
|
+
}
|
|
3222
|
+
/**
|
|
3223
|
+
* Create a child logger with additional prefix
|
|
3224
|
+
*/
|
|
3225
|
+
child(prefix) {
|
|
3226
|
+
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
3227
|
+
return new _Logger({
|
|
3228
|
+
...this.config,
|
|
3229
|
+
prefix: childPrefix
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
/**
|
|
3233
|
+
* Set log level
|
|
3234
|
+
*/
|
|
3235
|
+
setLevel(level) {
|
|
3236
|
+
this.config.level = level;
|
|
3237
|
+
}
|
|
3238
|
+
/**
|
|
3239
|
+
* Get current log level
|
|
3240
|
+
*/
|
|
3241
|
+
getLevel() {
|
|
3242
|
+
return this.config.level;
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
var logger = new Logger();
|
|
3246
|
+
var createLogger = (config) => new Logger(config);
|
|
3247
|
+
var logger_default = logger;
|
|
3248
|
+
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
3249
|
+
var info = (message, ...args) => logger.info(message, ...args);
|
|
3250
|
+
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
3251
|
+
var error = (message, ...args) => logger.error(message, ...args);
|
|
3252
|
+
var configure = (config) => logger.configure(config);
|
|
3253
|
+
var createComponentLogger = (component) => logger.child(component);
|
|
3254
|
+
var createPackageLogger = (packageName) => createLogger({
|
|
3255
|
+
level: "info",
|
|
3256
|
+
prefix: `${PREFIX} - ${packageName}`,
|
|
3257
|
+
showLevel: true,
|
|
3258
|
+
timestamps: true
|
|
3259
|
+
});
|
|
3260
|
+
var createPackageComponentLogger = (packageName, component) => {
|
|
3261
|
+
const packageLogger = createPackageLogger(packageName);
|
|
3262
|
+
return packageLogger.child(component);
|
|
3263
|
+
};
|
|
3264
|
+
|
|
3265
|
+
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
3266
|
+
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
3267
|
+
if (!baseUrl) {
|
|
3268
|
+
throw new AsgardeoRuntimeError(
|
|
3269
|
+
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
3270
|
+
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
3271
|
+
"javascript",
|
|
3272
|
+
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
3273
|
+
);
|
|
3274
|
+
}
|
|
3275
|
+
let parsedUrl;
|
|
3276
|
+
try {
|
|
3277
|
+
parsedUrl = new URL(baseUrl);
|
|
3278
|
+
} catch (error2) {
|
|
3279
|
+
throw new AsgardeoRuntimeError(
|
|
3280
|
+
`Invalid base URL format: ${baseUrl}`,
|
|
3281
|
+
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
3282
|
+
"javascript",
|
|
3283
|
+
"The provided base URL does not conform to valid URL syntax."
|
|
3284
|
+
);
|
|
3285
|
+
}
|
|
3286
|
+
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
3287
|
+
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3288
|
+
logger_default.warn(
|
|
3289
|
+
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
3290
|
+
);
|
|
3291
|
+
return false;
|
|
3292
|
+
}
|
|
3293
|
+
return true;
|
|
3294
|
+
};
|
|
3295
|
+
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
3296
|
+
|
|
3297
|
+
// src/utils/identifyPlatform.ts
|
|
3298
|
+
var identifyPlatform = (config) => {
|
|
3299
|
+
const { baseUrl } = config;
|
|
3300
|
+
try {
|
|
3301
|
+
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
3302
|
+
try {
|
|
3303
|
+
const url = new URL(baseUrl);
|
|
3304
|
+
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
3305
|
+
return "ASGARDEO" /* Asgardeo */;
|
|
3306
|
+
}
|
|
3307
|
+
} catch {
|
|
3308
|
+
logger_default.debug(
|
|
3309
|
+
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
3310
|
+
);
|
|
3311
|
+
}
|
|
3312
|
+
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
3313
|
+
}
|
|
3314
|
+
return "UNKNOWN" /* Unknown */;
|
|
3315
|
+
} catch (error2) {
|
|
3316
|
+
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
3317
|
+
return "UNKNOWN" /* Unknown */;
|
|
3318
|
+
}
|
|
3319
|
+
};
|
|
3320
|
+
var identifyPlatform_default = identifyPlatform;
|
|
3321
|
+
|
|
3322
|
+
// src/api/getBrandingPreference.ts
|
|
3323
|
+
var getBrandingPreference = async ({
|
|
3324
|
+
baseUrl,
|
|
3325
|
+
locale,
|
|
3326
|
+
name,
|
|
3327
|
+
type,
|
|
3328
|
+
fetcher,
|
|
3329
|
+
...requestConfig
|
|
3330
|
+
}) => {
|
|
3331
|
+
try {
|
|
3332
|
+
new URL(baseUrl);
|
|
3333
|
+
} catch (error2) {
|
|
3334
|
+
throw new AsgardeoAPIError(
|
|
3335
|
+
`Invalid base URL provided. ${error2?.toString()}`,
|
|
3336
|
+
"getBrandingPreference-ValidationError-001",
|
|
3337
|
+
"javascript",
|
|
3338
|
+
400,
|
|
3339
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
3340
|
+
);
|
|
3341
|
+
}
|
|
3342
|
+
const queryParams = new URLSearchParams(
|
|
3343
|
+
Object.fromEntries(
|
|
3344
|
+
Object.entries({
|
|
3345
|
+
locale: locale || "",
|
|
3346
|
+
name: name || "",
|
|
3347
|
+
type: type || ""
|
|
3348
|
+
}).filter(([, value]) => Boolean(value))
|
|
3349
|
+
)
|
|
3350
|
+
);
|
|
3351
|
+
const fetchFn = fetcher || fetch;
|
|
3352
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
3353
|
+
const requestInit = {
|
|
3354
|
+
...requestConfig,
|
|
3355
|
+
headers: {
|
|
3356
|
+
Accept: "application/json",
|
|
3357
|
+
"Content-Type": "application/json",
|
|
3358
|
+
...requestConfig.headers
|
|
3359
|
+
},
|
|
3360
|
+
method: "GET"
|
|
3361
|
+
};
|
|
3362
|
+
try {
|
|
3363
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
3364
|
+
if (!response?.ok) {
|
|
3365
|
+
const errorText = await response.text();
|
|
3366
|
+
const platform = identifyPlatform_default({ baseUrl });
|
|
3367
|
+
let errorDescription;
|
|
3368
|
+
try {
|
|
3369
|
+
const errorBody = JSON.parse(errorText);
|
|
3370
|
+
errorDescription = errorBody?.description || errorBody?.message || errorText;
|
|
3371
|
+
} catch {
|
|
3372
|
+
errorDescription = errorText;
|
|
3373
|
+
}
|
|
3374
|
+
let platformConsoleGuidance;
|
|
3375
|
+
if (platform === "ASGARDEO" /* Asgardeo */) {
|
|
3376
|
+
platformConsoleGuidance = "configure branding preferences in the Asgardeo console";
|
|
3377
|
+
} else if (platform === "IDENTITY_SERVER" /* IdentityServer */) {
|
|
3378
|
+
platformConsoleGuidance = "configure branding preferences in the WSO2 Identity Server console";
|
|
3379
|
+
} else {
|
|
3380
|
+
platformConsoleGuidance = "configure branding preferences in the platform console";
|
|
3381
|
+
}
|
|
3382
|
+
logger_default.warn(
|
|
3383
|
+
`[BrandingError] ${errorDescription} To resolve this issue, please ${platformConsoleGuidance}. If you want to suppress this warning and stop fetching branding preferences, set \`<AsgardeoProvider>\` -> \`preferences\` -> \`theme\` -> \`inheritFromBranding\` to false.`
|
|
3384
|
+
);
|
|
3385
|
+
throw new AsgardeoAPIError(
|
|
3386
|
+
errorText,
|
|
3387
|
+
"getBrandingPreference-ResponseError-001",
|
|
3388
|
+
"javascript",
|
|
3389
|
+
response.status,
|
|
3390
|
+
response.statusText,
|
|
3391
|
+
"Failed to get branding preference"
|
|
3392
|
+
);
|
|
3393
|
+
}
|
|
3394
|
+
const data = await response.json();
|
|
3395
|
+
return data;
|
|
3396
|
+
} catch (error2) {
|
|
3397
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
3398
|
+
throw error2;
|
|
3399
|
+
}
|
|
3400
|
+
throw new AsgardeoAPIError(
|
|
3401
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
3402
|
+
"getBrandingPreference-NetworkError-001",
|
|
3403
|
+
"javascript",
|
|
3404
|
+
0,
|
|
3405
|
+
"Network Error"
|
|
3406
|
+
);
|
|
3407
|
+
}
|
|
3408
|
+
};
|
|
3409
|
+
var getBrandingPreference_default = getBrandingPreference;
|
|
3410
|
+
|
|
3411
|
+
// src/models/v2/embedded-signin-flow-v2.ts
|
|
3412
|
+
var EmbeddedSignInFlowStatus = /* @__PURE__ */ ((EmbeddedSignInFlowStatus3) => {
|
|
3413
|
+
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3414
|
+
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3415
|
+
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3416
|
+
return EmbeddedSignInFlowStatus3;
|
|
3417
|
+
})(EmbeddedSignInFlowStatus || {});
|
|
3418
|
+
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3419
|
+
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3420
|
+
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3421
|
+
return EmbeddedSignInFlowType3;
|
|
3422
|
+
})(EmbeddedSignInFlowType || {});
|
|
3423
|
+
|
|
3424
|
+
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3425
|
+
var executeEmbeddedSignInFlowV2 = async ({
|
|
3426
|
+
url,
|
|
3427
|
+
baseUrl,
|
|
3428
|
+
payload,
|
|
3429
|
+
authId,
|
|
3430
|
+
...requestConfig
|
|
3431
|
+
}) => {
|
|
3432
|
+
if (!payload) {
|
|
3433
|
+
throw new AsgardeoAPIError(
|
|
3434
|
+
"Authorization payload is required",
|
|
3435
|
+
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3436
|
+
"javascript",
|
|
3437
|
+
400,
|
|
3438
|
+
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3441
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3442
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3443
|
+
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
3444
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3445
|
+
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
|
|
3446
|
+
const response = await fetch(endpoint, {
|
|
3447
|
+
...requestConfig,
|
|
3448
|
+
body: JSON.stringify(requestPayload),
|
|
3449
|
+
headers: {
|
|
3450
|
+
Accept: "application/json",
|
|
3451
|
+
"Content-Type": "application/json",
|
|
3452
|
+
...requestConfig.headers
|
|
3453
|
+
},
|
|
3454
|
+
method: requestConfig.method || "POST"
|
|
3455
|
+
});
|
|
3456
|
+
if (!response.ok) {
|
|
3457
|
+
const errorText = await response.text();
|
|
3458
|
+
throw new AsgardeoAPIError(
|
|
3459
|
+
errorText,
|
|
3460
|
+
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3461
|
+
"javascript",
|
|
3462
|
+
response.status,
|
|
3463
|
+
response.statusText,
|
|
3464
|
+
"Authorization request failed"
|
|
3465
|
+
);
|
|
3466
|
+
}
|
|
3467
|
+
const flowResponse = await response.json();
|
|
3468
|
+
if (flowResponse.flowStatus === "COMPLETE" /* Complete */ && flowResponse.assertion && authId) {
|
|
3469
|
+
try {
|
|
3470
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
3471
|
+
body: JSON.stringify({
|
|
3472
|
+
assertion: flowResponse.assertion,
|
|
3473
|
+
authId
|
|
3474
|
+
}),
|
|
3475
|
+
credentials: "include",
|
|
3476
|
+
headers: {
|
|
3477
|
+
Accept: "application/json",
|
|
3478
|
+
"Content-Type": "application/json",
|
|
3479
|
+
...requestConfig.headers
|
|
3480
|
+
},
|
|
3481
|
+
method: "POST"
|
|
3482
|
+
});
|
|
3483
|
+
if (!oauth2Response.ok) {
|
|
3484
|
+
const oauth2ErrorText = await oauth2Response.text();
|
|
3485
|
+
throw new AsgardeoAPIError(
|
|
3486
|
+
`OAuth2 authorization failed: ${oauth2ErrorText}`,
|
|
3487
|
+
"executeEmbeddedSignInFlow-OAuth2Error-002",
|
|
3488
|
+
"javascript",
|
|
3489
|
+
oauth2Response.status,
|
|
3490
|
+
oauth2Response.statusText
|
|
3491
|
+
);
|
|
3492
|
+
}
|
|
3493
|
+
const oauth2Result = await oauth2Response.json();
|
|
3494
|
+
return {
|
|
3495
|
+
flowStatus: flowResponse.flowStatus,
|
|
3496
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
3497
|
+
};
|
|
3498
|
+
} catch (authError) {
|
|
3499
|
+
throw new AsgardeoAPIError(
|
|
3500
|
+
`OAuth2 authorization failed: ${authError instanceof Error ? authError.message : "Unknown error"}`,
|
|
3501
|
+
"executeEmbeddedSignInFlow-OAuth2Error-001",
|
|
3502
|
+
"javascript",
|
|
3503
|
+
500,
|
|
3504
|
+
"Failed to complete OAuth2 authorization after successful embedded sign-in flow."
|
|
3505
|
+
);
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
return flowResponse;
|
|
3509
|
+
};
|
|
3510
|
+
var executeEmbeddedSignInFlowV2_default = executeEmbeddedSignInFlowV2;
|
|
3511
|
+
|
|
3512
|
+
// src/models/v2/embedded-signup-flow-v2.ts
|
|
3513
|
+
var EmbeddedSignUpFlowStatus = /* @__PURE__ */ ((EmbeddedSignUpFlowStatus2) => {
|
|
3514
|
+
EmbeddedSignUpFlowStatus2["Complete"] = "COMPLETE";
|
|
3515
|
+
EmbeddedSignUpFlowStatus2["Error"] = "ERROR";
|
|
3516
|
+
EmbeddedSignUpFlowStatus2["Incomplete"] = "INCOMPLETE";
|
|
3517
|
+
return EmbeddedSignUpFlowStatus2;
|
|
3518
|
+
})(EmbeddedSignUpFlowStatus || {});
|
|
3519
|
+
var EmbeddedSignUpFlowType = /* @__PURE__ */ ((EmbeddedSignUpFlowType2) => {
|
|
3108
3520
|
EmbeddedSignUpFlowType2["Redirection"] = "REDIRECTION";
|
|
3109
3521
|
EmbeddedSignUpFlowType2["View"] = "VIEW";
|
|
3110
3522
|
return EmbeddedSignUpFlowType2;
|
|
@@ -3145,11 +3557,12 @@ var executeEmbeddedSignUpFlowV2 = async ({
|
|
|
3145
3557
|
if (!response.ok) {
|
|
3146
3558
|
const errorText = await response.text();
|
|
3147
3559
|
throw new AsgardeoAPIError(
|
|
3148
|
-
|
|
3560
|
+
errorText,
|
|
3149
3561
|
"executeEmbeddedSignUpFlow-ResponseError-001",
|
|
3150
3562
|
"javascript",
|
|
3151
3563
|
response.status,
|
|
3152
|
-
response.statusText
|
|
3564
|
+
response.statusText,
|
|
3565
|
+
"Registration request failed"
|
|
3153
3566
|
);
|
|
3154
3567
|
}
|
|
3155
3568
|
const flowResponse = await response.json();
|
|
@@ -3284,11 +3697,12 @@ var executeEmbeddedUserOnboardingFlowV2 = async ({
|
|
|
3284
3697
|
if (!response.ok) {
|
|
3285
3698
|
const errorText = await response.text();
|
|
3286
3699
|
throw new AsgardeoAPIError(
|
|
3287
|
-
|
|
3700
|
+
errorText,
|
|
3288
3701
|
"executeEmbeddedUserOnboardingFlow-ResponseError-001",
|
|
3289
3702
|
"javascript",
|
|
3290
3703
|
response.status,
|
|
3291
|
-
response.statusText
|
|
3704
|
+
response.statusText,
|
|
3705
|
+
"User onboarding request failed"
|
|
3292
3706
|
);
|
|
3293
3707
|
}
|
|
3294
3708
|
const flowResponse = await response.json();
|
|
@@ -3325,11 +3739,12 @@ var getFlowMetaV2 = async ({
|
|
|
3325
3739
|
if (!response.ok) {
|
|
3326
3740
|
const errorText = await response.text();
|
|
3327
3741
|
throw new AsgardeoAPIError(
|
|
3328
|
-
|
|
3742
|
+
errorText,
|
|
3329
3743
|
"getFlowMetaV2-ResponseError-001",
|
|
3330
3744
|
"javascript",
|
|
3331
3745
|
response.status,
|
|
3332
|
-
response.statusText
|
|
3746
|
+
response.statusText,
|
|
3747
|
+
"Flow metadata request failed"
|
|
3333
3748
|
);
|
|
3334
3749
|
}
|
|
3335
3750
|
const flowMetadata = await response.json();
|
|
@@ -3371,11 +3786,12 @@ var getOrganizationUnitChildren = async ({
|
|
|
3371
3786
|
if (!response.ok) {
|
|
3372
3787
|
const errorText = await response.text();
|
|
3373
3788
|
throw new AsgardeoAPIError(
|
|
3374
|
-
|
|
3789
|
+
errorText,
|
|
3375
3790
|
"getOrganizationUnitChildren-ResponseError-001",
|
|
3376
3791
|
"javascript",
|
|
3377
3792
|
response.status,
|
|
3378
|
-
response.statusText
|
|
3793
|
+
response.statusText,
|
|
3794
|
+
"Failed to fetch organization unit children"
|
|
3379
3795
|
);
|
|
3380
3796
|
}
|
|
3381
3797
|
const listResponse = await response.json();
|
|
@@ -3604,16 +4020,16 @@ var DefaultCacheStore = class {
|
|
|
3604
4020
|
};
|
|
3605
4021
|
|
|
3606
4022
|
// src/DefaultCrypto.ts
|
|
3607
|
-
import * as
|
|
4023
|
+
import * as jose2 from "jose";
|
|
3608
4024
|
var DefaultCrypto = class {
|
|
3609
4025
|
// eslint-disable-next-line class-methods-use-this
|
|
3610
4026
|
base64URLDecode(value) {
|
|
3611
|
-
const decodedArray =
|
|
4027
|
+
const decodedArray = jose2.base64url.decode(value);
|
|
3612
4028
|
return new TextDecoder().decode(decodedArray);
|
|
3613
4029
|
}
|
|
3614
4030
|
// eslint-disable-next-line class-methods-use-this
|
|
3615
4031
|
base64URLEncode(value) {
|
|
3616
|
-
return
|
|
4032
|
+
return jose2.base64url.encode(value);
|
|
3617
4033
|
}
|
|
3618
4034
|
// eslint-disable-next-line class-methods-use-this
|
|
3619
4035
|
generateRandomBytes(length) {
|
|
@@ -3628,8 +4044,8 @@ var DefaultCrypto = class {
|
|
|
3628
4044
|
}
|
|
3629
4045
|
// eslint-disable-next-line class-methods-use-this
|
|
3630
4046
|
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
3631
|
-
const key = await
|
|
3632
|
-
await
|
|
4047
|
+
const key = await jose2.importJWK(jwk);
|
|
4048
|
+
await jose2.jwtVerify(idToken, key, {
|
|
3633
4049
|
algorithms,
|
|
3634
4050
|
audience: [clientId],
|
|
3635
4051
|
clockTolerance,
|
|
@@ -4084,660 +4500,374 @@ var toCssVariables = (theme) => {
|
|
|
4084
4500
|
if (theme.colors?.background?.disabled) {
|
|
4085
4501
|
cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;
|
|
4086
4502
|
}
|
|
4087
|
-
if (theme.colors?.background?.body?.main) {
|
|
4088
|
-
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4089
|
-
}
|
|
4090
|
-
if (theme.colors?.error?.main) {
|
|
4091
|
-
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4092
|
-
}
|
|
4093
|
-
if (theme.colors?.error?.contrastText) {
|
|
4094
|
-
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4095
|
-
}
|
|
4096
|
-
if (theme.colors?.error?.light) {
|
|
4097
|
-
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4098
|
-
}
|
|
4099
|
-
if (theme.colors?.success?.main) {
|
|
4100
|
-
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4101
|
-
}
|
|
4102
|
-
if (theme.colors?.success?.contrastText) {
|
|
4103
|
-
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4104
|
-
}
|
|
4105
|
-
if (theme.colors?.success?.light) {
|
|
4106
|
-
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4107
|
-
}
|
|
4108
|
-
if (theme.colors?.warning?.main) {
|
|
4109
|
-
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4110
|
-
}
|
|
4111
|
-
if (theme.colors?.warning?.contrastText) {
|
|
4112
|
-
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4113
|
-
}
|
|
4114
|
-
if (theme.colors?.warning?.light) {
|
|
4115
|
-
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4116
|
-
}
|
|
4117
|
-
if (theme.colors?.info?.main) {
|
|
4118
|
-
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4119
|
-
}
|
|
4120
|
-
if (theme.colors?.info?.contrastText) {
|
|
4121
|
-
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4122
|
-
}
|
|
4123
|
-
if (theme.colors?.info?.light) {
|
|
4124
|
-
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4125
|
-
}
|
|
4126
|
-
if (theme.colors?.text?.primary) {
|
|
4127
|
-
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4128
|
-
}
|
|
4129
|
-
if (theme.colors?.text?.secondary) {
|
|
4130
|
-
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4131
|
-
}
|
|
4132
|
-
if (theme.colors?.border) {
|
|
4133
|
-
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4134
|
-
}
|
|
4135
|
-
if (theme.spacing?.unit !== void 0) {
|
|
4136
|
-
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4137
|
-
}
|
|
4138
|
-
if (theme.borderRadius?.small) {
|
|
4139
|
-
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4140
|
-
}
|
|
4141
|
-
if (theme.borderRadius?.medium) {
|
|
4142
|
-
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4143
|
-
}
|
|
4144
|
-
if (theme.borderRadius?.large) {
|
|
4145
|
-
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4146
|
-
}
|
|
4147
|
-
if (theme.shadows?.small) {
|
|
4148
|
-
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4149
|
-
}
|
|
4150
|
-
if (theme.shadows?.medium) {
|
|
4151
|
-
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4152
|
-
}
|
|
4153
|
-
if (theme.shadows?.large) {
|
|
4154
|
-
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4155
|
-
}
|
|
4156
|
-
if (theme.typography?.fontFamily) {
|
|
4157
|
-
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4158
|
-
}
|
|
4159
|
-
if (theme.typography?.fontSizes?.xs) {
|
|
4160
|
-
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4161
|
-
}
|
|
4162
|
-
if (theme.typography?.fontSizes?.sm) {
|
|
4163
|
-
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4164
|
-
}
|
|
4165
|
-
if (theme.typography?.fontSizes?.md) {
|
|
4166
|
-
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4167
|
-
}
|
|
4168
|
-
if (theme.typography?.fontSizes?.lg) {
|
|
4169
|
-
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4170
|
-
}
|
|
4171
|
-
if (theme.typography?.fontSizes?.xl) {
|
|
4172
|
-
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4173
|
-
}
|
|
4174
|
-
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4175
|
-
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4176
|
-
}
|
|
4177
|
-
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4178
|
-
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4179
|
-
}
|
|
4180
|
-
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4181
|
-
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4182
|
-
}
|
|
4183
|
-
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4184
|
-
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4185
|
-
}
|
|
4186
|
-
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4187
|
-
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4188
|
-
}
|
|
4189
|
-
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4190
|
-
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4191
|
-
}
|
|
4192
|
-
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4193
|
-
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4194
|
-
}
|
|
4195
|
-
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4196
|
-
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4197
|
-
}
|
|
4198
|
-
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4199
|
-
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4200
|
-
}
|
|
4201
|
-
if (theme.images) {
|
|
4202
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4203
|
-
const imageConfig = theme.images[imageKey];
|
|
4204
|
-
if (imageConfig?.url) {
|
|
4205
|
-
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4206
|
-
}
|
|
4207
|
-
if (imageConfig?.title) {
|
|
4208
|
-
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4209
|
-
}
|
|
4210
|
-
if (imageConfig?.alt) {
|
|
4211
|
-
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4212
|
-
}
|
|
4213
|
-
});
|
|
4214
|
-
}
|
|
4215
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4216
|
-
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4217
|
-
}
|
|
4218
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4219
|
-
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4220
|
-
}
|
|
4221
|
-
return cssVars;
|
|
4222
|
-
};
|
|
4223
|
-
var toThemeVars = (theme) => {
|
|
4224
|
-
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
4225
|
-
const componentVars = {};
|
|
4226
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4227
|
-
componentVars.Button = {
|
|
4228
|
-
root: {
|
|
4229
|
-
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4230
|
-
}
|
|
4231
|
-
};
|
|
4232
|
-
}
|
|
4233
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4234
|
-
componentVars.Field = {
|
|
4235
|
-
root: {
|
|
4236
|
-
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
4237
|
-
}
|
|
4238
|
-
};
|
|
4239
|
-
}
|
|
4240
|
-
const themeVars = {
|
|
4241
|
-
borderRadius: {
|
|
4242
|
-
large: `var(--${prefix}-border-radius-large)`,
|
|
4243
|
-
medium: `var(--${prefix}-border-radius-medium)`,
|
|
4244
|
-
small: `var(--${prefix}-border-radius-small)`
|
|
4245
|
-
},
|
|
4246
|
-
colors: {
|
|
4247
|
-
action: {
|
|
4248
|
-
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
4249
|
-
active: `var(--${prefix}-color-action-active)`,
|
|
4250
|
-
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
4251
|
-
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
4252
|
-
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
4253
|
-
focus: `var(--${prefix}-color-action-focus)`,
|
|
4254
|
-
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
4255
|
-
hover: `var(--${prefix}-color-action-hover)`,
|
|
4256
|
-
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
4257
|
-
selected: `var(--${prefix}-color-action-selected)`,
|
|
4258
|
-
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
4259
|
-
},
|
|
4260
|
-
background: {
|
|
4261
|
-
body: {
|
|
4262
|
-
main: `var(--${prefix}-color-background-body-main)`
|
|
4263
|
-
},
|
|
4264
|
-
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
4265
|
-
surface: `var(--${prefix}-color-background-surface)`
|
|
4266
|
-
},
|
|
4267
|
-
border: `var(--${prefix}-color-border)`,
|
|
4268
|
-
error: {
|
|
4269
|
-
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
4270
|
-
main: `var(--${prefix}-color-error-main)`
|
|
4271
|
-
},
|
|
4272
|
-
info: {
|
|
4273
|
-
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
4274
|
-
main: `var(--${prefix}-color-info-main)`
|
|
4275
|
-
},
|
|
4276
|
-
primary: {
|
|
4277
|
-
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
4278
|
-
main: `var(--${prefix}-color-primary-main)`
|
|
4279
|
-
},
|
|
4280
|
-
secondary: {
|
|
4281
|
-
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
4282
|
-
main: `var(--${prefix}-color-secondary-main)`
|
|
4283
|
-
},
|
|
4284
|
-
success: {
|
|
4285
|
-
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
4286
|
-
main: `var(--${prefix}-color-success-main)`
|
|
4287
|
-
},
|
|
4288
|
-
text: {
|
|
4289
|
-
primary: `var(--${prefix}-color-text-primary)`,
|
|
4290
|
-
secondary: `var(--${prefix}-color-text-secondary)`
|
|
4291
|
-
},
|
|
4292
|
-
warning: {
|
|
4293
|
-
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
4294
|
-
main: `var(--${prefix}-color-warning-main)`
|
|
4295
|
-
}
|
|
4296
|
-
},
|
|
4297
|
-
shadows: {
|
|
4298
|
-
large: `var(--${prefix}-shadow-large)`,
|
|
4299
|
-
medium: `var(--${prefix}-shadow-medium)`,
|
|
4300
|
-
small: `var(--${prefix}-shadow-small)`
|
|
4301
|
-
},
|
|
4302
|
-
spacing: {
|
|
4303
|
-
unit: `var(--${prefix}-spacing-unit)`
|
|
4304
|
-
},
|
|
4305
|
-
typography: {
|
|
4306
|
-
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
4307
|
-
fontSizes: {
|
|
4308
|
-
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
4309
|
-
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
4310
|
-
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
4311
|
-
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
4312
|
-
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
4313
|
-
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
4314
|
-
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
4315
|
-
},
|
|
4316
|
-
fontWeights: {
|
|
4317
|
-
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
4318
|
-
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
4319
|
-
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
4320
|
-
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
4321
|
-
},
|
|
4322
|
-
lineHeights: {
|
|
4323
|
-
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
4324
|
-
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
4325
|
-
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4326
|
-
}
|
|
4327
|
-
}
|
|
4328
|
-
};
|
|
4329
|
-
if (theme.images) {
|
|
4330
|
-
themeVars.images = {};
|
|
4331
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4332
|
-
const imageConfig = theme.images[imageKey];
|
|
4333
|
-
themeVars.images[imageKey] = {
|
|
4334
|
-
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
4335
|
-
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
4336
|
-
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
4337
|
-
};
|
|
4338
|
-
});
|
|
4339
|
-
}
|
|
4340
|
-
if (Object.keys(componentVars).length > 0) {
|
|
4341
|
-
themeVars.components = componentVars;
|
|
4503
|
+
if (theme.colors?.background?.body?.main) {
|
|
4504
|
+
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4342
4505
|
}
|
|
4343
|
-
|
|
4344
|
-
};
|
|
4345
|
-
var createTheme = (config = {}, isDark = false) => {
|
|
4346
|
-
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
4347
|
-
const mergedConfig = {
|
|
4348
|
-
...baseTheme,
|
|
4349
|
-
...config,
|
|
4350
|
-
borderRadius: {
|
|
4351
|
-
...baseTheme.borderRadius,
|
|
4352
|
-
...config.borderRadius
|
|
4353
|
-
},
|
|
4354
|
-
colors: {
|
|
4355
|
-
...baseTheme.colors,
|
|
4356
|
-
...config.colors,
|
|
4357
|
-
action: {
|
|
4358
|
-
...baseTheme.colors.action,
|
|
4359
|
-
...config.colors?.action || {}
|
|
4360
|
-
},
|
|
4361
|
-
secondary: {
|
|
4362
|
-
...baseTheme.colors.secondary,
|
|
4363
|
-
...config.colors?.secondary || {}
|
|
4364
|
-
}
|
|
4365
|
-
},
|
|
4366
|
-
images: {
|
|
4367
|
-
...baseTheme.images,
|
|
4368
|
-
...config.images
|
|
4369
|
-
},
|
|
4370
|
-
shadows: {
|
|
4371
|
-
...baseTheme.shadows,
|
|
4372
|
-
...config.shadows
|
|
4373
|
-
},
|
|
4374
|
-
spacing: {
|
|
4375
|
-
...baseTheme.spacing,
|
|
4376
|
-
...config.spacing
|
|
4377
|
-
},
|
|
4378
|
-
typography: {
|
|
4379
|
-
...baseTheme.typography,
|
|
4380
|
-
...config.typography,
|
|
4381
|
-
fontSizes: {
|
|
4382
|
-
...baseTheme.typography.fontSizes,
|
|
4383
|
-
...config.typography?.fontSizes || {}
|
|
4384
|
-
},
|
|
4385
|
-
fontWeights: {
|
|
4386
|
-
...baseTheme.typography.fontWeights,
|
|
4387
|
-
...config.typography?.fontWeights || {}
|
|
4388
|
-
},
|
|
4389
|
-
lineHeights: {
|
|
4390
|
-
...baseTheme.typography.lineHeights,
|
|
4391
|
-
...config.typography?.lineHeights || {}
|
|
4392
|
-
}
|
|
4393
|
-
}
|
|
4394
|
-
};
|
|
4395
|
-
return {
|
|
4396
|
-
...mergedConfig,
|
|
4397
|
-
cssVariables: toCssVariables(mergedConfig),
|
|
4398
|
-
vars: toThemeVars(mergedConfig)
|
|
4399
|
-
};
|
|
4400
|
-
};
|
|
4401
|
-
var DEFAULT_THEME = "light";
|
|
4402
|
-
var createTheme_default = createTheme;
|
|
4403
|
-
|
|
4404
|
-
// src/utils/arrayBufferToBase64url.ts
|
|
4405
|
-
var arrayBufferToBase64url = (buffer) => {
|
|
4406
|
-
const bytes = new Uint8Array(buffer);
|
|
4407
|
-
let binary = "";
|
|
4408
|
-
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
4409
|
-
binary += String.fromCharCode(bytes[i]);
|
|
4506
|
+
if (theme.colors?.error?.main) {
|
|
4507
|
+
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4410
4508
|
}
|
|
4411
|
-
|
|
4412
|
-
};
|
|
4413
|
-
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
4414
|
-
|
|
4415
|
-
// src/utils/base64urlToArrayBuffer.ts
|
|
4416
|
-
var base64urlToArrayBuffer = (base64url2) => {
|
|
4417
|
-
const padding = "=".repeat((4 - base64url2.length % 4) % 4);
|
|
4418
|
-
const base64 = base64url2.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
4419
|
-
const binaryString = atob(base64);
|
|
4420
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
4421
|
-
for (let i = 0; i < binaryString.length; i += 1) {
|
|
4422
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
4509
|
+
if (theme.colors?.error?.contrastText) {
|
|
4510
|
+
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4423
4511
|
}
|
|
4424
|
-
|
|
4425
|
-
};
|
|
4426
|
-
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
4427
|
-
|
|
4428
|
-
// src/utils/bem.ts
|
|
4429
|
-
var bem = (baseClass, element, modifier) => {
|
|
4430
|
-
let className = baseClass;
|
|
4431
|
-
if (element) {
|
|
4432
|
-
className += `__${element}`;
|
|
4512
|
+
if (theme.colors?.error?.light) {
|
|
4513
|
+
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4433
4514
|
}
|
|
4434
|
-
if (
|
|
4435
|
-
|
|
4515
|
+
if (theme.colors?.success?.main) {
|
|
4516
|
+
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4436
4517
|
}
|
|
4437
|
-
|
|
4438
|
-
};
|
|
4439
|
-
var bem_default = bem;
|
|
4440
|
-
|
|
4441
|
-
// src/utils/formatDate.ts
|
|
4442
|
-
var formatDate = (dateString) => {
|
|
4443
|
-
if (!dateString) return "-";
|
|
4444
|
-
try {
|
|
4445
|
-
return new Date(dateString).toLocaleDateString("en-US", {
|
|
4446
|
-
day: "numeric",
|
|
4447
|
-
month: "long",
|
|
4448
|
-
year: "numeric"
|
|
4449
|
-
});
|
|
4450
|
-
} catch {
|
|
4451
|
-
return dateString;
|
|
4518
|
+
if (theme.colors?.success?.contrastText) {
|
|
4519
|
+
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4452
4520
|
}
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
// src/utils/logger.ts
|
|
4457
|
-
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
4458
|
-
var DEFAULT_CONFIG = {
|
|
4459
|
-
level: "info",
|
|
4460
|
-
prefix: `${PREFIX}`,
|
|
4461
|
-
showLevel: true,
|
|
4462
|
-
timestamps: true
|
|
4463
|
-
};
|
|
4464
|
-
var isBrowser = () => (
|
|
4465
|
-
/* @ts-ignore */
|
|
4466
|
-
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
4467
|
-
);
|
|
4468
|
-
var isNode = () => (
|
|
4469
|
-
/* @ts-ignore */
|
|
4470
|
-
typeof process !== "undefined" && void 0
|
|
4471
|
-
);
|
|
4472
|
-
var COLORS = {
|
|
4473
|
-
blue: "\x1B[34m",
|
|
4474
|
-
bright: "\x1B[1m",
|
|
4475
|
-
cyan: "\x1B[36m",
|
|
4476
|
-
dim: "\x1B[2m",
|
|
4477
|
-
gray: "\x1B[90m",
|
|
4478
|
-
green: "\x1B[32m",
|
|
4479
|
-
magenta: "\x1B[35m",
|
|
4480
|
-
red: "\x1B[31m",
|
|
4481
|
-
reset: "\x1B[0m",
|
|
4482
|
-
white: "\x1B[37m",
|
|
4483
|
-
yellow: "\x1B[33m"
|
|
4484
|
-
};
|
|
4485
|
-
var BROWSER_STYLES = {
|
|
4486
|
-
debug: "color: #6b7280; font-weight: normal;",
|
|
4487
|
-
error: "color: #dc2626; font-weight: bold;",
|
|
4488
|
-
info: "color: #2563eb; font-weight: bold;",
|
|
4489
|
-
prefix: "color: #7c3aed; font-weight: bold;",
|
|
4490
|
-
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
4491
|
-
warn: "color: #d97706; font-weight: bold;"
|
|
4492
|
-
};
|
|
4493
|
-
var LOG_LEVEL_ORDER = {
|
|
4494
|
-
debug: 0,
|
|
4495
|
-
error: 3,
|
|
4496
|
-
info: 1,
|
|
4497
|
-
warn: 2
|
|
4498
|
-
};
|
|
4499
|
-
var Logger = class _Logger {
|
|
4500
|
-
constructor(config = {}) {
|
|
4501
|
-
__publicField(this, "config");
|
|
4502
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
4521
|
+
if (theme.colors?.success?.light) {
|
|
4522
|
+
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4503
4523
|
}
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4524
|
+
if (theme.colors?.warning?.main) {
|
|
4525
|
+
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4526
|
+
}
|
|
4527
|
+
if (theme.colors?.warning?.contrastText) {
|
|
4528
|
+
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4529
|
+
}
|
|
4530
|
+
if (theme.colors?.warning?.light) {
|
|
4531
|
+
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4532
|
+
}
|
|
4533
|
+
if (theme.colors?.info?.main) {
|
|
4534
|
+
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4535
|
+
}
|
|
4536
|
+
if (theme.colors?.info?.contrastText) {
|
|
4537
|
+
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4538
|
+
}
|
|
4539
|
+
if (theme.colors?.info?.light) {
|
|
4540
|
+
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4541
|
+
}
|
|
4542
|
+
if (theme.colors?.text?.primary) {
|
|
4543
|
+
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4544
|
+
}
|
|
4545
|
+
if (theme.colors?.text?.secondary) {
|
|
4546
|
+
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4547
|
+
}
|
|
4548
|
+
if (theme.colors?.border) {
|
|
4549
|
+
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4550
|
+
}
|
|
4551
|
+
if (theme.spacing?.unit !== void 0) {
|
|
4552
|
+
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4553
|
+
}
|
|
4554
|
+
if (theme.borderRadius?.small) {
|
|
4555
|
+
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4556
|
+
}
|
|
4557
|
+
if (theme.borderRadius?.medium) {
|
|
4558
|
+
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4559
|
+
}
|
|
4560
|
+
if (theme.borderRadius?.large) {
|
|
4561
|
+
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4562
|
+
}
|
|
4563
|
+
if (theme.shadows?.small) {
|
|
4564
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4565
|
+
}
|
|
4566
|
+
if (theme.shadows?.medium) {
|
|
4567
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4568
|
+
}
|
|
4569
|
+
if (theme.shadows?.large) {
|
|
4570
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4571
|
+
}
|
|
4572
|
+
if (theme.typography?.fontFamily) {
|
|
4573
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4574
|
+
}
|
|
4575
|
+
if (theme.typography?.fontSizes?.xs) {
|
|
4576
|
+
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4577
|
+
}
|
|
4578
|
+
if (theme.typography?.fontSizes?.sm) {
|
|
4579
|
+
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4580
|
+
}
|
|
4581
|
+
if (theme.typography?.fontSizes?.md) {
|
|
4582
|
+
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4583
|
+
}
|
|
4584
|
+
if (theme.typography?.fontSizes?.lg) {
|
|
4585
|
+
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4586
|
+
}
|
|
4587
|
+
if (theme.typography?.fontSizes?.xl) {
|
|
4588
|
+
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4589
|
+
}
|
|
4590
|
+
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4591
|
+
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4592
|
+
}
|
|
4593
|
+
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4594
|
+
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4595
|
+
}
|
|
4596
|
+
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4597
|
+
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4598
|
+
}
|
|
4599
|
+
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4600
|
+
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4601
|
+
}
|
|
4602
|
+
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4603
|
+
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4604
|
+
}
|
|
4605
|
+
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4606
|
+
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4509
4607
|
}
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
*/
|
|
4513
|
-
getConfig() {
|
|
4514
|
-
return { ...this.config };
|
|
4608
|
+
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4609
|
+
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4515
4610
|
}
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
*/
|
|
4519
|
-
shouldLog(level) {
|
|
4520
|
-
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
4611
|
+
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4612
|
+
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4521
4613
|
}
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
*/
|
|
4525
|
-
static getTimestamp() {
|
|
4526
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
4614
|
+
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4615
|
+
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4527
4616
|
}
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
default:
|
|
4542
|
-
return "UNKNOWN";
|
|
4543
|
-
}
|
|
4617
|
+
if (theme.images) {
|
|
4618
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
4619
|
+
const imageConfig = theme.images[imageKey];
|
|
4620
|
+
if (imageConfig?.url) {
|
|
4621
|
+
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4622
|
+
}
|
|
4623
|
+
if (imageConfig?.title) {
|
|
4624
|
+
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4625
|
+
}
|
|
4626
|
+
if (imageConfig?.alt) {
|
|
4627
|
+
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4628
|
+
}
|
|
4629
|
+
});
|
|
4544
4630
|
}
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
case "debug":
|
|
4561
|
-
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
4562
|
-
break;
|
|
4563
|
-
case "info":
|
|
4564
|
-
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
4565
|
-
break;
|
|
4566
|
-
case "warn":
|
|
4567
|
-
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
4568
|
-
break;
|
|
4569
|
-
case "error":
|
|
4570
|
-
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
4571
|
-
break;
|
|
4572
|
-
default:
|
|
4573
|
-
coloredLevel = `[${levelStr}]`;
|
|
4631
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4632
|
+
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4633
|
+
}
|
|
4634
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4635
|
+
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4636
|
+
}
|
|
4637
|
+
return cssVars;
|
|
4638
|
+
};
|
|
4639
|
+
var toThemeVars = (theme) => {
|
|
4640
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
4641
|
+
const componentVars = {};
|
|
4642
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4643
|
+
componentVars.Button = {
|
|
4644
|
+
root: {
|
|
4645
|
+
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4574
4646
|
}
|
|
4575
|
-
|
|
4576
|
-
}
|
|
4577
|
-
parts.push(message);
|
|
4578
|
-
return parts.join(" ");
|
|
4647
|
+
};
|
|
4579
4648
|
}
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
}
|
|
4587
|
-
if (this.config.formatter) {
|
|
4588
|
-
this.config.formatter(level, message, ...args);
|
|
4589
|
-
return;
|
|
4590
|
-
}
|
|
4591
|
-
if (isBrowser()) {
|
|
4592
|
-
this.logToBrowser(level, message, ...args);
|
|
4593
|
-
} else if (isNode()) {
|
|
4594
|
-
this.logToNode(level, message, ...args);
|
|
4595
|
-
} else {
|
|
4596
|
-
console.log(message, ...args);
|
|
4597
|
-
}
|
|
4649
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4650
|
+
componentVars.Field = {
|
|
4651
|
+
root: {
|
|
4652
|
+
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
4653
|
+
}
|
|
4654
|
+
};
|
|
4598
4655
|
}
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4656
|
+
const themeVars = {
|
|
4657
|
+
borderRadius: {
|
|
4658
|
+
large: `var(--${prefix}-border-radius-large)`,
|
|
4659
|
+
medium: `var(--${prefix}-border-radius-medium)`,
|
|
4660
|
+
small: `var(--${prefix}-border-radius-small)`
|
|
4661
|
+
},
|
|
4662
|
+
colors: {
|
|
4663
|
+
action: {
|
|
4664
|
+
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
4665
|
+
active: `var(--${prefix}-color-action-active)`,
|
|
4666
|
+
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
4667
|
+
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
4668
|
+
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
4669
|
+
focus: `var(--${prefix}-color-action-focus)`,
|
|
4670
|
+
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
4671
|
+
hover: `var(--${prefix}-color-action-hover)`,
|
|
4672
|
+
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
4673
|
+
selected: `var(--${prefix}-color-action-selected)`,
|
|
4674
|
+
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
4675
|
+
},
|
|
4676
|
+
background: {
|
|
4677
|
+
body: {
|
|
4678
|
+
main: `var(--${prefix}-color-background-body-main)`
|
|
4679
|
+
},
|
|
4680
|
+
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
4681
|
+
surface: `var(--${prefix}-color-background-surface)`
|
|
4682
|
+
},
|
|
4683
|
+
border: `var(--${prefix}-color-border)`,
|
|
4684
|
+
error: {
|
|
4685
|
+
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
4686
|
+
main: `var(--${prefix}-color-error-main)`
|
|
4687
|
+
},
|
|
4688
|
+
info: {
|
|
4689
|
+
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
4690
|
+
main: `var(--${prefix}-color-info-main)`
|
|
4691
|
+
},
|
|
4692
|
+
primary: {
|
|
4693
|
+
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
4694
|
+
main: `var(--${prefix}-color-primary-main)`
|
|
4695
|
+
},
|
|
4696
|
+
secondary: {
|
|
4697
|
+
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
4698
|
+
main: `var(--${prefix}-color-secondary-main)`
|
|
4699
|
+
},
|
|
4700
|
+
success: {
|
|
4701
|
+
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
4702
|
+
main: `var(--${prefix}-color-success-main)`
|
|
4703
|
+
},
|
|
4704
|
+
text: {
|
|
4705
|
+
primary: `var(--${prefix}-color-text-primary)`,
|
|
4706
|
+
secondary: `var(--${prefix}-color-text-secondary)`
|
|
4707
|
+
},
|
|
4708
|
+
warning: {
|
|
4709
|
+
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
4710
|
+
main: `var(--${prefix}-color-warning-main)`
|
|
4711
|
+
}
|
|
4712
|
+
},
|
|
4713
|
+
shadows: {
|
|
4714
|
+
large: `var(--${prefix}-shadow-large)`,
|
|
4715
|
+
medium: `var(--${prefix}-shadow-medium)`,
|
|
4716
|
+
small: `var(--${prefix}-shadow-small)`
|
|
4717
|
+
},
|
|
4718
|
+
spacing: {
|
|
4719
|
+
unit: `var(--${prefix}-spacing-unit)`
|
|
4720
|
+
},
|
|
4721
|
+
typography: {
|
|
4722
|
+
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
4723
|
+
fontSizes: {
|
|
4724
|
+
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
4725
|
+
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
4726
|
+
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
4727
|
+
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
4728
|
+
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
4729
|
+
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
4730
|
+
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
4731
|
+
},
|
|
4732
|
+
fontWeights: {
|
|
4733
|
+
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
4734
|
+
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
4735
|
+
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
4736
|
+
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
4737
|
+
},
|
|
4738
|
+
lineHeights: {
|
|
4739
|
+
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
4740
|
+
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
4741
|
+
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4631
4742
|
}
|
|
4632
4743
|
}
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
console.warn(formattedMessage, ...styles, ...args);
|
|
4645
|
-
break;
|
|
4646
|
-
case "error":
|
|
4647
|
-
console.error(formattedMessage, ...styles, ...args);
|
|
4648
|
-
break;
|
|
4649
|
-
default:
|
|
4650
|
-
console.log(formattedMessage, ...styles, ...args);
|
|
4651
|
-
}
|
|
4744
|
+
};
|
|
4745
|
+
if (theme.images) {
|
|
4746
|
+
themeVars.images = {};
|
|
4747
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
4748
|
+
const imageConfig = theme.images[imageKey];
|
|
4749
|
+
themeVars.images[imageKey] = {
|
|
4750
|
+
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
4751
|
+
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
4752
|
+
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
4753
|
+
};
|
|
4754
|
+
});
|
|
4652
4755
|
}
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
*/
|
|
4656
|
-
logToNode(level, message, ...args) {
|
|
4657
|
-
const formattedMessage = this.formatForNode(level, message);
|
|
4658
|
-
switch (level) {
|
|
4659
|
-
case "debug":
|
|
4660
|
-
console.debug(formattedMessage, ...args);
|
|
4661
|
-
break;
|
|
4662
|
-
case "info":
|
|
4663
|
-
console.info(formattedMessage, ...args);
|
|
4664
|
-
break;
|
|
4665
|
-
case "warn":
|
|
4666
|
-
console.warn(formattedMessage, ...args);
|
|
4667
|
-
break;
|
|
4668
|
-
case "error":
|
|
4669
|
-
console.error(formattedMessage, ...args);
|
|
4670
|
-
break;
|
|
4671
|
-
default:
|
|
4672
|
-
console.log(formattedMessage, ...args);
|
|
4673
|
-
}
|
|
4756
|
+
if (Object.keys(componentVars).length > 0) {
|
|
4757
|
+
themeVars.components = componentVars;
|
|
4674
4758
|
}
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4759
|
+
return themeVars;
|
|
4760
|
+
};
|
|
4761
|
+
var createTheme = (config = {}, isDark = false) => {
|
|
4762
|
+
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
4763
|
+
const mergedConfig = {
|
|
4764
|
+
...baseTheme,
|
|
4765
|
+
...config,
|
|
4766
|
+
borderRadius: {
|
|
4767
|
+
...baseTheme.borderRadius,
|
|
4768
|
+
...config.borderRadius
|
|
4769
|
+
},
|
|
4770
|
+
colors: {
|
|
4771
|
+
...baseTheme.colors,
|
|
4772
|
+
...config.colors,
|
|
4773
|
+
action: {
|
|
4774
|
+
...baseTheme.colors.action,
|
|
4775
|
+
...config.colors?.action || {}
|
|
4776
|
+
},
|
|
4777
|
+
secondary: {
|
|
4778
|
+
...baseTheme.colors.secondary,
|
|
4779
|
+
...config.colors?.secondary || {}
|
|
4780
|
+
}
|
|
4781
|
+
},
|
|
4782
|
+
images: {
|
|
4783
|
+
...baseTheme.images,
|
|
4784
|
+
...config.images
|
|
4785
|
+
},
|
|
4786
|
+
shadows: {
|
|
4787
|
+
...baseTheme.shadows,
|
|
4788
|
+
...config.shadows
|
|
4789
|
+
},
|
|
4790
|
+
spacing: {
|
|
4791
|
+
...baseTheme.spacing,
|
|
4792
|
+
...config.spacing
|
|
4793
|
+
},
|
|
4794
|
+
typography: {
|
|
4795
|
+
...baseTheme.typography,
|
|
4796
|
+
...config.typography,
|
|
4797
|
+
fontSizes: {
|
|
4798
|
+
...baseTheme.typography.fontSizes,
|
|
4799
|
+
...config.typography?.fontSizes || {}
|
|
4800
|
+
},
|
|
4801
|
+
fontWeights: {
|
|
4802
|
+
...baseTheme.typography.fontWeights,
|
|
4803
|
+
...config.typography?.fontWeights || {}
|
|
4804
|
+
},
|
|
4805
|
+
lineHeights: {
|
|
4806
|
+
...baseTheme.typography.lineHeights,
|
|
4807
|
+
...config.typography?.lineHeights || {}
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
};
|
|
4811
|
+
return {
|
|
4812
|
+
...mergedConfig,
|
|
4813
|
+
cssVariables: toCssVariables(mergedConfig),
|
|
4814
|
+
vars: toThemeVars(mergedConfig)
|
|
4815
|
+
};
|
|
4816
|
+
};
|
|
4817
|
+
var DEFAULT_THEME = "light";
|
|
4818
|
+
var createTheme_default = createTheme;
|
|
4819
|
+
|
|
4820
|
+
// src/utils/arrayBufferToBase64url.ts
|
|
4821
|
+
var arrayBufferToBase64url = (buffer) => {
|
|
4822
|
+
const bytes = new Uint8Array(buffer);
|
|
4823
|
+
let binary = "";
|
|
4824
|
+
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
4825
|
+
binary += String.fromCharCode(bytes[i]);
|
|
4680
4826
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4827
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
4828
|
+
};
|
|
4829
|
+
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
4830
|
+
|
|
4831
|
+
// src/utils/base64urlToArrayBuffer.ts
|
|
4832
|
+
var base64urlToArrayBuffer = (base64url3) => {
|
|
4833
|
+
const padding = "=".repeat((4 - base64url3.length % 4) % 4);
|
|
4834
|
+
const base64 = base64url3.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
4835
|
+
const binaryString = atob(base64);
|
|
4836
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
4837
|
+
for (let i = 0; i < binaryString.length; i += 1) {
|
|
4838
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
4686
4839
|
}
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4840
|
+
return bytes.buffer;
|
|
4841
|
+
};
|
|
4842
|
+
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
4843
|
+
|
|
4844
|
+
// src/utils/bem.ts
|
|
4845
|
+
var bem = (baseClass, element, modifier) => {
|
|
4846
|
+
let className = baseClass;
|
|
4847
|
+
if (element) {
|
|
4848
|
+
className += `__${element}`;
|
|
4692
4849
|
}
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
*/
|
|
4696
|
-
error(message, ...args) {
|
|
4697
|
-
this.logMessage("error", message, ...args);
|
|
4850
|
+
if (modifier) {
|
|
4851
|
+
className += `--${modifier}`;
|
|
4698
4852
|
}
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4853
|
+
return className;
|
|
4854
|
+
};
|
|
4855
|
+
var bem_default = bem;
|
|
4856
|
+
|
|
4857
|
+
// src/utils/formatDate.ts
|
|
4858
|
+
var formatDate = (dateString) => {
|
|
4859
|
+
if (!dateString) return "-";
|
|
4860
|
+
try {
|
|
4861
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
4862
|
+
day: "numeric",
|
|
4863
|
+
month: "long",
|
|
4864
|
+
year: "numeric"
|
|
4707
4865
|
});
|
|
4866
|
+
} catch {
|
|
4867
|
+
return dateString;
|
|
4708
4868
|
}
|
|
4709
|
-
/**
|
|
4710
|
-
* Set log level
|
|
4711
|
-
*/
|
|
4712
|
-
setLevel(level) {
|
|
4713
|
-
this.config.level = level;
|
|
4714
|
-
}
|
|
4715
|
-
/**
|
|
4716
|
-
* Get current log level
|
|
4717
|
-
*/
|
|
4718
|
-
getLevel() {
|
|
4719
|
-
return this.config.level;
|
|
4720
|
-
}
|
|
4721
|
-
};
|
|
4722
|
-
var logger = new Logger();
|
|
4723
|
-
var createLogger = (config) => new Logger(config);
|
|
4724
|
-
var logger_default = logger;
|
|
4725
|
-
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
4726
|
-
var info = (message, ...args) => logger.info(message, ...args);
|
|
4727
|
-
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
4728
|
-
var error = (message, ...args) => logger.error(message, ...args);
|
|
4729
|
-
var configure = (config) => logger.configure(config);
|
|
4730
|
-
var createComponentLogger = (component) => logger.child(component);
|
|
4731
|
-
var createPackageLogger = (packageName) => createLogger({
|
|
4732
|
-
level: "info",
|
|
4733
|
-
prefix: `${PREFIX} - ${packageName}`,
|
|
4734
|
-
showLevel: true,
|
|
4735
|
-
timestamps: true
|
|
4736
|
-
});
|
|
4737
|
-
var createPackageComponentLogger = (packageName, component) => {
|
|
4738
|
-
const packageLogger = createPackageLogger(packageName);
|
|
4739
|
-
return packageLogger.child(component);
|
|
4740
4869
|
};
|
|
4870
|
+
var formatDate_default = formatDate;
|
|
4741
4871
|
|
|
4742
4872
|
// src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
4743
4873
|
var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
@@ -4788,38 +4918,6 @@ var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
|
4788
4918
|
};
|
|
4789
4919
|
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
4790
4920
|
|
|
4791
|
-
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
4792
|
-
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
4793
|
-
if (!baseUrl) {
|
|
4794
|
-
throw new AsgardeoRuntimeError(
|
|
4795
|
-
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
4796
|
-
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
4797
|
-
"javascript",
|
|
4798
|
-
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
4799
|
-
);
|
|
4800
|
-
}
|
|
4801
|
-
let parsedUrl;
|
|
4802
|
-
try {
|
|
4803
|
-
parsedUrl = new URL(baseUrl);
|
|
4804
|
-
} catch (error2) {
|
|
4805
|
-
throw new AsgardeoRuntimeError(
|
|
4806
|
-
`Invalid base URL format: ${baseUrl}`,
|
|
4807
|
-
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
4808
|
-
"javascript",
|
|
4809
|
-
"The provided base URL does not conform to valid URL syntax."
|
|
4810
|
-
);
|
|
4811
|
-
}
|
|
4812
|
-
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
4813
|
-
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
4814
|
-
logger_default.warn(
|
|
4815
|
-
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
4816
|
-
);
|
|
4817
|
-
return false;
|
|
4818
|
-
}
|
|
4819
|
-
return true;
|
|
4820
|
-
};
|
|
4821
|
-
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
4822
|
-
|
|
4823
4921
|
// src/utils/flattenUserSchema.ts
|
|
4824
4922
|
var flattenUserSchema = (schemas) => {
|
|
4825
4923
|
const flattenedAttributes = [];
|
|
@@ -5005,31 +5103,6 @@ var generateFlattenedUserProfile = (meResponse, processedSchemas) => {
|
|
|
5005
5103
|
};
|
|
5006
5104
|
var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
|
|
5007
5105
|
|
|
5008
|
-
// src/utils/identifyPlatform.ts
|
|
5009
|
-
var identifyPlatform = (config) => {
|
|
5010
|
-
const { baseUrl } = config;
|
|
5011
|
-
try {
|
|
5012
|
-
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
5013
|
-
try {
|
|
5014
|
-
const url = new URL(baseUrl);
|
|
5015
|
-
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
5016
|
-
return "ASGARDEO" /* Asgardeo */;
|
|
5017
|
-
}
|
|
5018
|
-
} catch {
|
|
5019
|
-
logger_default.debug(
|
|
5020
|
-
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
5021
|
-
);
|
|
5022
|
-
}
|
|
5023
|
-
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
5024
|
-
}
|
|
5025
|
-
return "UNKNOWN" /* Unknown */;
|
|
5026
|
-
} catch (error2) {
|
|
5027
|
-
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
5028
|
-
return "UNKNOWN" /* Unknown */;
|
|
5029
|
-
}
|
|
5030
|
-
};
|
|
5031
|
-
var identifyPlatform_default = identifyPlatform;
|
|
5032
|
-
|
|
5033
5106
|
// src/utils/getRedirectBasedSignUpUrl.ts
|
|
5034
5107
|
var getRedirectBasedSignUpUrl = (config) => {
|
|
5035
5108
|
const { baseUrl } = config;
|