@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/cjs/index.js
CHANGED
|
@@ -1088,6 +1088,16 @@ var StorageManager = class _StorageManager {
|
|
|
1088
1088
|
};
|
|
1089
1089
|
var StorageManager_default = StorageManager;
|
|
1090
1090
|
|
|
1091
|
+
// src/utils/base64Encode.ts
|
|
1092
|
+
var jose = __toESM(require("jose"), 1);
|
|
1093
|
+
var base64Encode = (value) => {
|
|
1094
|
+
const b64url = jose.base64url.encode(new TextEncoder().encode(value));
|
|
1095
|
+
const rem = b64url.length % 4;
|
|
1096
|
+
const padded = rem === 0 ? b64url : b64url + "=".repeat(4 - rem);
|
|
1097
|
+
return padded.replace(/-/g, "+").replace(/_/g, "/");
|
|
1098
|
+
};
|
|
1099
|
+
var base64Encode_default = base64Encode;
|
|
1100
|
+
|
|
1091
1101
|
// src/utils/deepMerge.ts
|
|
1092
1102
|
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === "[object Object]";
|
|
1093
1103
|
var deepMerge = (target, ...sources) => {
|
|
@@ -1454,7 +1464,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1454
1464
|
}
|
|
1455
1465
|
const body = new URLSearchParams();
|
|
1456
1466
|
body.set("client_id", configData.clientId);
|
|
1457
|
-
|
|
1467
|
+
const hasSecret = Boolean(configData.clientSecret && configData.clientSecret.trim().length > 0);
|
|
1468
|
+
const tokenEndpointAuthMethod = configData.tokenRequest?.authMethod ?? (configData.platform === "AsgardeoV2" /* AsgardeoV2 */ ? "client_secret_basic" : "client_secret_post");
|
|
1469
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_post") {
|
|
1458
1470
|
body.set("client_secret", configData.clientSecret);
|
|
1459
1471
|
}
|
|
1460
1472
|
const code = authorizationCode;
|
|
@@ -1473,15 +1485,22 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1473
1485
|
);
|
|
1474
1486
|
await this.storageManager.removeTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), userId);
|
|
1475
1487
|
}
|
|
1488
|
+
const tokenRequestHeaders = {
|
|
1489
|
+
Accept: "application/json",
|
|
1490
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1491
|
+
};
|
|
1492
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_basic") {
|
|
1493
|
+
const credential = `${encodeURIComponent(configData.clientId)}:${encodeURIComponent(
|
|
1494
|
+
configData.clientSecret
|
|
1495
|
+
)}`;
|
|
1496
|
+
tokenRequestHeaders["Authorization"] = `Basic ${base64Encode_default(credential)}`;
|
|
1497
|
+
}
|
|
1476
1498
|
let tokenResponse;
|
|
1477
1499
|
try {
|
|
1478
1500
|
tokenResponse = await fetch(tokenEndpoint, {
|
|
1479
1501
|
body,
|
|
1480
1502
|
credentials: configData.sendCookiesInRequests ? "include" : "same-origin",
|
|
1481
|
-
headers:
|
|
1482
|
-
Accept: "application/json",
|
|
1483
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
1484
|
-
},
|
|
1503
|
+
headers: tokenRequestHeaders,
|
|
1485
1504
|
method: "POST"
|
|
1486
1505
|
});
|
|
1487
1506
|
} catch (error2) {
|
|
@@ -2157,20 +2176,37 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
2157
2176
|
__publicField(_AsgardeoAuthClient, "authHelperInstance");
|
|
2158
2177
|
var AsgardeoAuthClient = _AsgardeoAuthClient;
|
|
2159
2178
|
|
|
2179
|
+
// src/utils/parseApiErrorMessage.ts
|
|
2180
|
+
var parseApiErrorMessage = (errorText) => {
|
|
2181
|
+
try {
|
|
2182
|
+
const parsed = JSON.parse(errorText);
|
|
2183
|
+
const description = parsed["description"];
|
|
2184
|
+
const message = parsed["message"];
|
|
2185
|
+
if (description?.defaultValue) return description.defaultValue;
|
|
2186
|
+
if (message?.defaultValue) return message.defaultValue;
|
|
2187
|
+
} catch {
|
|
2188
|
+
}
|
|
2189
|
+
return errorText;
|
|
2190
|
+
};
|
|
2191
|
+
var parseApiErrorMessage_default = parseApiErrorMessage;
|
|
2192
|
+
|
|
2160
2193
|
// src/errors/AsgardeoAPIError.ts
|
|
2161
2194
|
var AsgardeoAPIError = class extends AsgardeoError {
|
|
2162
2195
|
/**
|
|
2163
2196
|
* Creates an instance of AsgardeoAPIError.
|
|
2164
2197
|
*
|
|
2165
|
-
* @param message - Human-readable description
|
|
2198
|
+
* @param message - Human-readable description or raw API error response body
|
|
2166
2199
|
* @param code - A unique error code that identifies the error type
|
|
2200
|
+
* @param origin - The SDK origin (e.g. 'react', 'vue')
|
|
2167
2201
|
* @param statusCode - HTTP status code of the failed request
|
|
2168
2202
|
* @param statusText - HTTP status text of the failed request
|
|
2169
|
-
* @param
|
|
2203
|
+
* @param prefix - Optional prefix prepended to the resolved message
|
|
2170
2204
|
* @constructor
|
|
2171
2205
|
*/
|
|
2172
|
-
constructor(message, code, origin, statusCode, statusText) {
|
|
2173
|
-
|
|
2206
|
+
constructor(message, code, origin, statusCode, statusText, prefix) {
|
|
2207
|
+
const parsed = parseApiErrorMessage_default(message);
|
|
2208
|
+
const resolvedMessage = prefix ? `${prefix}: ${parsed}` : parsed;
|
|
2209
|
+
super(resolvedMessage, code, origin);
|
|
2174
2210
|
this.statusCode = statusCode;
|
|
2175
2211
|
this.statusText = statusText;
|
|
2176
2212
|
Object.defineProperty(this, "name", {
|
|
@@ -2237,11 +2273,12 @@ var initializeEmbeddedSignInFlow = async ({
|
|
|
2237
2273
|
if (!response.ok) {
|
|
2238
2274
|
const errorText = await response.text();
|
|
2239
2275
|
throw new AsgardeoAPIError(
|
|
2240
|
-
|
|
2276
|
+
errorText,
|
|
2241
2277
|
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2242
2278
|
"javascript",
|
|
2243
2279
|
response.status,
|
|
2244
|
-
response.statusText
|
|
2280
|
+
response.statusText,
|
|
2281
|
+
"Authorization request failed"
|
|
2245
2282
|
);
|
|
2246
2283
|
}
|
|
2247
2284
|
return await response.json();
|
|
@@ -2301,11 +2338,12 @@ var executeEmbeddedSignInFlow = async ({
|
|
|
2301
2338
|
if (!response.ok) {
|
|
2302
2339
|
const errorText = await response.text();
|
|
2303
2340
|
throw new AsgardeoAPIError(
|
|
2304
|
-
|
|
2341
|
+
errorText,
|
|
2305
2342
|
"initializeEmbeddedSignInFlow-ResponseError-001",
|
|
2306
2343
|
"javascript",
|
|
2307
2344
|
response.status,
|
|
2308
|
-
response.statusText
|
|
2345
|
+
response.statusText,
|
|
2346
|
+
"Authorization request failed"
|
|
2309
2347
|
);
|
|
2310
2348
|
}
|
|
2311
2349
|
return await response.json();
|
|
@@ -2399,11 +2437,12 @@ var executeEmbeddedSignUpFlow = async ({
|
|
|
2399
2437
|
if (!response.ok) {
|
|
2400
2438
|
const errorText = await response.text();
|
|
2401
2439
|
throw new AsgardeoAPIError(
|
|
2402
|
-
|
|
2440
|
+
errorText,
|
|
2403
2441
|
"javascript-executeEmbeddedSignUpFlow-ResponseError-100",
|
|
2404
2442
|
"javascript",
|
|
2405
2443
|
response.status,
|
|
2406
|
-
response.statusText
|
|
2444
|
+
response.statusText,
|
|
2445
|
+
"Embedded SignUp flow execution failed"
|
|
2407
2446
|
);
|
|
2408
2447
|
}
|
|
2409
2448
|
return await response.json();
|
|
@@ -2448,11 +2487,12 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2448
2487
|
if (!response.ok) {
|
|
2449
2488
|
const errorText = await response.text();
|
|
2450
2489
|
throw new AsgardeoAPIError(
|
|
2451
|
-
|
|
2490
|
+
errorText,
|
|
2452
2491
|
"getUserInfo-ResponseError-001",
|
|
2453
2492
|
"javascript",
|
|
2454
2493
|
response.status,
|
|
2455
|
-
response.statusText
|
|
2494
|
+
response.statusText,
|
|
2495
|
+
"Failed to fetch user info"
|
|
2456
2496
|
);
|
|
2457
2497
|
}
|
|
2458
2498
|
return await response.json();
|
|
@@ -2526,11 +2566,12 @@ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2526
2566
|
if (!response?.ok) {
|
|
2527
2567
|
const errorText = await response.text();
|
|
2528
2568
|
throw new AsgardeoAPIError(
|
|
2529
|
-
|
|
2569
|
+
errorText,
|
|
2530
2570
|
"getScim2Me-ResponseError-001",
|
|
2531
2571
|
"javascript",
|
|
2532
2572
|
response.status,
|
|
2533
|
-
response.statusText
|
|
2573
|
+
response.statusText,
|
|
2574
|
+
"Failed to fetch user profile"
|
|
2534
2575
|
);
|
|
2535
2576
|
}
|
|
2536
2577
|
const user = await response.json();
|
|
@@ -2579,11 +2620,12 @@ var getSchemas = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2579
2620
|
if (!response?.ok) {
|
|
2580
2621
|
const errorText = await response.text();
|
|
2581
2622
|
throw new AsgardeoAPIError(
|
|
2582
|
-
|
|
2623
|
+
errorText,
|
|
2583
2624
|
"getSchemas-ResponseError-001",
|
|
2584
2625
|
"javascript",
|
|
2585
2626
|
response.status,
|
|
2586
|
-
response.statusText
|
|
2627
|
+
response.statusText,
|
|
2628
|
+
"Failed to fetch SCIM2 schemas"
|
|
2587
2629
|
);
|
|
2588
2630
|
}
|
|
2589
2631
|
return await response.json();
|
|
@@ -2647,11 +2689,12 @@ var getAllOrganizations = async ({
|
|
|
2647
2689
|
if (!response?.ok) {
|
|
2648
2690
|
const errorText = await response.text();
|
|
2649
2691
|
throw new AsgardeoAPIError(
|
|
2650
|
-
|
|
2692
|
+
errorText,
|
|
2651
2693
|
"getAllOrganizations-ResponseError-001",
|
|
2652
2694
|
"javascript",
|
|
2653
2695
|
response.status,
|
|
2654
|
-
response.statusText
|
|
2696
|
+
response.statusText,
|
|
2697
|
+
"Failed to get organizations"
|
|
2655
2698
|
);
|
|
2656
2699
|
}
|
|
2657
2700
|
const data = await response.json();
|
|
@@ -2724,11 +2767,12 @@ var createOrganization = async ({
|
|
|
2724
2767
|
if (!response?.ok) {
|
|
2725
2768
|
const errorText = await response.text();
|
|
2726
2769
|
throw new AsgardeoAPIError(
|
|
2727
|
-
|
|
2770
|
+
errorText,
|
|
2728
2771
|
"createOrganization-ResponseError-001",
|
|
2729
2772
|
"javascript",
|
|
2730
2773
|
response.status,
|
|
2731
|
-
response.statusText
|
|
2774
|
+
response.statusText,
|
|
2775
|
+
"Failed to create organization"
|
|
2732
2776
|
);
|
|
2733
2777
|
}
|
|
2734
2778
|
return await response.json();
|
|
@@ -2798,11 +2842,12 @@ var getMeOrganizations = async ({
|
|
|
2798
2842
|
if (!response?.ok) {
|
|
2799
2843
|
const errorText = await response.text();
|
|
2800
2844
|
throw new AsgardeoAPIError(
|
|
2801
|
-
|
|
2845
|
+
errorText,
|
|
2802
2846
|
"getMeOrganizations-ResponseError-001",
|
|
2803
2847
|
"javascript",
|
|
2804
2848
|
response.status,
|
|
2805
|
-
response.statusText
|
|
2849
|
+
response.statusText,
|
|
2850
|
+
"Failed to fetch associated organizations of the user"
|
|
2806
2851
|
);
|
|
2807
2852
|
}
|
|
2808
2853
|
const data = await response.json();
|
|
@@ -2865,11 +2910,12 @@ var getOrganization = async ({
|
|
|
2865
2910
|
if (!response?.ok) {
|
|
2866
2911
|
const errorText = await response.text();
|
|
2867
2912
|
throw new AsgardeoAPIError(
|
|
2868
|
-
|
|
2913
|
+
errorText,
|
|
2869
2914
|
"getOrganization-ResponseError-001",
|
|
2870
2915
|
"javascript",
|
|
2871
2916
|
response.status,
|
|
2872
|
-
response.statusText
|
|
2917
|
+
response.statusText,
|
|
2918
|
+
"Failed to fetch organization details"
|
|
2873
2919
|
);
|
|
2874
2920
|
}
|
|
2875
2921
|
return await response.json();
|
|
@@ -2960,11 +3006,12 @@ var updateOrganization = async ({
|
|
|
2960
3006
|
if (!response?.ok) {
|
|
2961
3007
|
const errorText = await response.text();
|
|
2962
3008
|
throw new AsgardeoAPIError(
|
|
2963
|
-
|
|
3009
|
+
errorText,
|
|
2964
3010
|
"updateOrganization-ResponseError-001",
|
|
2965
3011
|
"javascript",
|
|
2966
3012
|
response.status,
|
|
2967
|
-
response.statusText
|
|
3013
|
+
response.statusText,
|
|
3014
|
+
"Failed to update organization"
|
|
2968
3015
|
);
|
|
2969
3016
|
}
|
|
2970
3017
|
return await response.json();
|
|
@@ -3041,11 +3088,12 @@ var updateMeProfile = async ({
|
|
|
3041
3088
|
if (!response?.ok) {
|
|
3042
3089
|
const errorText = await response.text();
|
|
3043
3090
|
throw new AsgardeoAPIError(
|
|
3044
|
-
|
|
3091
|
+
errorText,
|
|
3045
3092
|
"updateMeProfile-ResponseError-001",
|
|
3046
3093
|
"javascript",
|
|
3047
3094
|
response.status,
|
|
3048
|
-
response.statusText
|
|
3095
|
+
response.statusText,
|
|
3096
|
+
"Failed to update user profile"
|
|
3049
3097
|
);
|
|
3050
3098
|
}
|
|
3051
3099
|
return processUsername_default(await response.json());
|
|
@@ -3064,183 +3112,547 @@ var updateMeProfile = async ({
|
|
|
3064
3112
|
};
|
|
3065
3113
|
var updateMeProfile_default = updateMeProfile;
|
|
3066
3114
|
|
|
3067
|
-
// src/
|
|
3068
|
-
var
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3115
|
+
// src/utils/logger.ts
|
|
3116
|
+
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
3117
|
+
var DEFAULT_CONFIG = {
|
|
3118
|
+
level: "info",
|
|
3119
|
+
prefix: `${PREFIX}`,
|
|
3120
|
+
showLevel: true,
|
|
3121
|
+
timestamps: true
|
|
3122
|
+
};
|
|
3123
|
+
var isBrowser = () => (
|
|
3124
|
+
/* @ts-ignore */
|
|
3125
|
+
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
3126
|
+
);
|
|
3127
|
+
var isNode = () => (
|
|
3128
|
+
/* @ts-ignore */
|
|
3129
|
+
typeof process !== "undefined" && process.versions && process.versions.node
|
|
3130
|
+
);
|
|
3131
|
+
var COLORS = {
|
|
3132
|
+
blue: "\x1B[34m",
|
|
3133
|
+
bright: "\x1B[1m",
|
|
3134
|
+
cyan: "\x1B[36m",
|
|
3135
|
+
dim: "\x1B[2m",
|
|
3136
|
+
gray: "\x1B[90m",
|
|
3137
|
+
green: "\x1B[32m",
|
|
3138
|
+
magenta: "\x1B[35m",
|
|
3139
|
+
red: "\x1B[31m",
|
|
3140
|
+
reset: "\x1B[0m",
|
|
3141
|
+
white: "\x1B[37m",
|
|
3142
|
+
yellow: "\x1B[33m"
|
|
3143
|
+
};
|
|
3144
|
+
var BROWSER_STYLES = {
|
|
3145
|
+
debug: "color: #6b7280; font-weight: normal;",
|
|
3146
|
+
error: "color: #dc2626; font-weight: bold;",
|
|
3147
|
+
info: "color: #2563eb; font-weight: bold;",
|
|
3148
|
+
prefix: "color: #7c3aed; font-weight: bold;",
|
|
3149
|
+
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
3150
|
+
warn: "color: #d97706; font-weight: bold;"
|
|
3151
|
+
};
|
|
3152
|
+
var LOG_LEVEL_ORDER = {
|
|
3153
|
+
debug: 0,
|
|
3154
|
+
error: 3,
|
|
3155
|
+
info: 1,
|
|
3156
|
+
warn: 2
|
|
3157
|
+
};
|
|
3158
|
+
var Logger = class _Logger {
|
|
3159
|
+
constructor(config = {}) {
|
|
3160
|
+
__publicField(this, "config");
|
|
3161
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
3086
3162
|
}
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
type: type || ""
|
|
3093
|
-
}).filter(([, value]) => Boolean(value))
|
|
3094
|
-
)
|
|
3095
|
-
);
|
|
3096
|
-
const fetchFn = fetcher || fetch;
|
|
3097
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
3098
|
-
const requestInit = {
|
|
3099
|
-
...requestConfig,
|
|
3100
|
-
headers: {
|
|
3101
|
-
Accept: "application/json",
|
|
3102
|
-
"Content-Type": "application/json",
|
|
3103
|
-
...requestConfig.headers
|
|
3104
|
-
},
|
|
3105
|
-
method: "GET"
|
|
3106
|
-
};
|
|
3107
|
-
try {
|
|
3108
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
3109
|
-
if (!response?.ok) {
|
|
3110
|
-
const errorText = await response.text();
|
|
3111
|
-
throw new AsgardeoAPIError(
|
|
3112
|
-
`Failed to get branding preference: ${errorText}`,
|
|
3113
|
-
"getBrandingPreference-ResponseError-001",
|
|
3114
|
-
"javascript",
|
|
3115
|
-
response.status,
|
|
3116
|
-
response.statusText
|
|
3117
|
-
);
|
|
3118
|
-
}
|
|
3119
|
-
const data = await response.json();
|
|
3120
|
-
return data;
|
|
3121
|
-
} catch (error2) {
|
|
3122
|
-
if (error2 instanceof AsgardeoAPIError) {
|
|
3123
|
-
throw error2;
|
|
3124
|
-
}
|
|
3125
|
-
throw new AsgardeoAPIError(
|
|
3126
|
-
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
3127
|
-
"getBrandingPreference-NetworkError-001",
|
|
3128
|
-
"javascript",
|
|
3129
|
-
0,
|
|
3130
|
-
"Network Error"
|
|
3131
|
-
);
|
|
3163
|
+
/**
|
|
3164
|
+
* Update logger configuration
|
|
3165
|
+
*/
|
|
3166
|
+
configure(config) {
|
|
3167
|
+
this.config = { ...this.config, ...config };
|
|
3132
3168
|
}
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3139
|
-
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3140
|
-
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3141
|
-
return EmbeddedSignInFlowStatus3;
|
|
3142
|
-
})(EmbeddedSignInFlowStatus || {});
|
|
3143
|
-
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3144
|
-
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3145
|
-
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3146
|
-
return EmbeddedSignInFlowType3;
|
|
3147
|
-
})(EmbeddedSignInFlowType || {});
|
|
3148
|
-
|
|
3149
|
-
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3150
|
-
var executeEmbeddedSignInFlowV2 = async ({
|
|
3151
|
-
url,
|
|
3152
|
-
baseUrl,
|
|
3153
|
-
payload,
|
|
3154
|
-
authId,
|
|
3155
|
-
...requestConfig
|
|
3156
|
-
}) => {
|
|
3157
|
-
if (!payload) {
|
|
3158
|
-
throw new AsgardeoAPIError(
|
|
3159
|
-
"Authorization payload is required",
|
|
3160
|
-
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3161
|
-
"javascript",
|
|
3162
|
-
400,
|
|
3163
|
-
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3164
|
-
);
|
|
3169
|
+
/**
|
|
3170
|
+
* Get current configuration
|
|
3171
|
+
*/
|
|
3172
|
+
getConfig() {
|
|
3173
|
+
return { ...this.config };
|
|
3165
3174
|
}
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
const response = await fetch(endpoint, {
|
|
3172
|
-
...requestConfig,
|
|
3173
|
-
body: JSON.stringify(requestPayload),
|
|
3174
|
-
headers: {
|
|
3175
|
-
Accept: "application/json",
|
|
3176
|
-
"Content-Type": "application/json",
|
|
3177
|
-
...requestConfig.headers
|
|
3178
|
-
},
|
|
3179
|
-
method: requestConfig.method || "POST"
|
|
3180
|
-
});
|
|
3181
|
-
if (!response.ok) {
|
|
3182
|
-
const errorText = await response.text();
|
|
3183
|
-
throw new AsgardeoAPIError(
|
|
3184
|
-
`Authorization request failed: ${errorText}`,
|
|
3185
|
-
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3186
|
-
"javascript",
|
|
3187
|
-
response.status,
|
|
3188
|
-
response.statusText
|
|
3189
|
-
);
|
|
3175
|
+
/**
|
|
3176
|
+
* Check if a log level should be output
|
|
3177
|
+
*/
|
|
3178
|
+
shouldLog(level) {
|
|
3179
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
3190
3180
|
}
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
assertion: flowResponse.assertion,
|
|
3197
|
-
authId
|
|
3198
|
-
}),
|
|
3199
|
-
credentials: "include",
|
|
3200
|
-
headers: {
|
|
3201
|
-
Accept: "application/json",
|
|
3202
|
-
"Content-Type": "application/json",
|
|
3203
|
-
...requestConfig.headers
|
|
3204
|
-
},
|
|
3205
|
-
method: "POST"
|
|
3206
|
-
});
|
|
3207
|
-
if (!oauth2Response.ok) {
|
|
3208
|
-
const oauth2ErrorText = await oauth2Response.text();
|
|
3209
|
-
throw new AsgardeoAPIError(
|
|
3210
|
-
`OAuth2 authorization failed: ${oauth2ErrorText}`,
|
|
3211
|
-
"executeEmbeddedSignInFlow-OAuth2Error-002",
|
|
3212
|
-
"javascript",
|
|
3213
|
-
oauth2Response.status,
|
|
3214
|
-
oauth2Response.statusText
|
|
3215
|
-
);
|
|
3216
|
-
}
|
|
3217
|
-
const oauth2Result = await oauth2Response.json();
|
|
3218
|
-
return {
|
|
3219
|
-
flowStatus: flowResponse.flowStatus,
|
|
3220
|
-
redirectUrl: oauth2Result["redirect_uri"]
|
|
3221
|
-
};
|
|
3222
|
-
} catch (authError) {
|
|
3223
|
-
throw new AsgardeoAPIError(
|
|
3224
|
-
`OAuth2 authorization failed: ${authError instanceof Error ? authError.message : "Unknown error"}`,
|
|
3225
|
-
"executeEmbeddedSignInFlow-OAuth2Error-001",
|
|
3226
|
-
"javascript",
|
|
3227
|
-
500,
|
|
3228
|
-
"Failed to complete OAuth2 authorization after successful embedded sign-in flow."
|
|
3229
|
-
);
|
|
3230
|
-
}
|
|
3181
|
+
/**
|
|
3182
|
+
* Get timestamp string
|
|
3183
|
+
*/
|
|
3184
|
+
static getTimestamp() {
|
|
3185
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3231
3186
|
}
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3187
|
+
/**
|
|
3188
|
+
* Get log level string
|
|
3189
|
+
*/
|
|
3190
|
+
static getLevelString(level) {
|
|
3191
|
+
switch (level) {
|
|
3192
|
+
case "debug":
|
|
3193
|
+
return "DEBUG";
|
|
3194
|
+
case "info":
|
|
3195
|
+
return "INFO";
|
|
3196
|
+
case "warn":
|
|
3197
|
+
return "WARN";
|
|
3198
|
+
case "error":
|
|
3199
|
+
return "ERROR";
|
|
3200
|
+
default:
|
|
3201
|
+
return "UNKNOWN";
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
/**
|
|
3205
|
+
* Format message for Node.js terminal
|
|
3206
|
+
*/
|
|
3207
|
+
formatForNode(level, message) {
|
|
3208
|
+
const parts = [];
|
|
3209
|
+
if (this.config.timestamps) {
|
|
3210
|
+
parts.push(`${COLORS.gray}[${_Logger.getTimestamp()}]${COLORS.reset}`);
|
|
3211
|
+
}
|
|
3212
|
+
if (this.config.prefix) {
|
|
3213
|
+
parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
3214
|
+
}
|
|
3215
|
+
if (this.config.showLevel) {
|
|
3216
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3217
|
+
let coloredLevel;
|
|
3218
|
+
switch (level) {
|
|
3219
|
+
case "debug":
|
|
3220
|
+
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
3221
|
+
break;
|
|
3222
|
+
case "info":
|
|
3223
|
+
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
3224
|
+
break;
|
|
3225
|
+
case "warn":
|
|
3226
|
+
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
3227
|
+
break;
|
|
3228
|
+
case "error":
|
|
3229
|
+
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
3230
|
+
break;
|
|
3231
|
+
default:
|
|
3232
|
+
coloredLevel = `[${levelStr}]`;
|
|
3233
|
+
}
|
|
3234
|
+
parts.push(coloredLevel);
|
|
3235
|
+
}
|
|
3236
|
+
parts.push(message);
|
|
3237
|
+
return parts.join(" ");
|
|
3238
|
+
}
|
|
3239
|
+
/**
|
|
3240
|
+
* Log message using appropriate method
|
|
3241
|
+
*/
|
|
3242
|
+
logMessage(level, message, ...args) {
|
|
3243
|
+
if (!this.shouldLog(level)) {
|
|
3244
|
+
return;
|
|
3245
|
+
}
|
|
3246
|
+
if (this.config.formatter) {
|
|
3247
|
+
this.config.formatter(level, message, ...args);
|
|
3248
|
+
return;
|
|
3249
|
+
}
|
|
3250
|
+
if (isBrowser()) {
|
|
3251
|
+
this.logToBrowser(level, message, ...args);
|
|
3252
|
+
} else if (isNode()) {
|
|
3253
|
+
this.logToNode(level, message, ...args);
|
|
3254
|
+
} else {
|
|
3255
|
+
console.log(message, ...args);
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
/**
|
|
3259
|
+
* Log to browser console with styling
|
|
3260
|
+
*/
|
|
3261
|
+
logToBrowser(level, message, ...args) {
|
|
3262
|
+
const parts = [];
|
|
3263
|
+
const styles = [];
|
|
3264
|
+
if (this.config.timestamps) {
|
|
3265
|
+
parts.push(`%c[${_Logger.getTimestamp()}]`);
|
|
3266
|
+
styles.push(BROWSER_STYLES.timestamp);
|
|
3267
|
+
}
|
|
3268
|
+
if (this.config.prefix) {
|
|
3269
|
+
parts.push(`%c${this.config.prefix}`);
|
|
3270
|
+
styles.push(BROWSER_STYLES.prefix);
|
|
3271
|
+
}
|
|
3272
|
+
if (this.config.showLevel) {
|
|
3273
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3274
|
+
parts.push(`%c[${levelStr}]`);
|
|
3275
|
+
switch (level) {
|
|
3276
|
+
case "debug":
|
|
3277
|
+
styles.push(BROWSER_STYLES.debug);
|
|
3278
|
+
break;
|
|
3279
|
+
case "info":
|
|
3280
|
+
styles.push(BROWSER_STYLES.info);
|
|
3281
|
+
break;
|
|
3282
|
+
case "warn":
|
|
3283
|
+
styles.push(BROWSER_STYLES.warn);
|
|
3284
|
+
break;
|
|
3285
|
+
case "error":
|
|
3286
|
+
styles.push(BROWSER_STYLES.error);
|
|
3287
|
+
break;
|
|
3288
|
+
default:
|
|
3289
|
+
styles.push("");
|
|
3290
|
+
}
|
|
3291
|
+
}
|
|
3292
|
+
parts.push(`%c${message}`);
|
|
3293
|
+
styles.push("color: inherit; font-weight: normal;");
|
|
3294
|
+
const formattedMessage = parts.join(" ");
|
|
3295
|
+
switch (level) {
|
|
3296
|
+
case "debug":
|
|
3297
|
+
console.debug(formattedMessage, ...styles, ...args);
|
|
3298
|
+
break;
|
|
3299
|
+
case "info":
|
|
3300
|
+
console.info(formattedMessage, ...styles, ...args);
|
|
3301
|
+
break;
|
|
3302
|
+
case "warn":
|
|
3303
|
+
console.warn(formattedMessage, ...styles, ...args);
|
|
3304
|
+
break;
|
|
3305
|
+
case "error":
|
|
3306
|
+
console.error(formattedMessage, ...styles, ...args);
|
|
3307
|
+
break;
|
|
3308
|
+
default:
|
|
3309
|
+
console.log(formattedMessage, ...styles, ...args);
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
/**
|
|
3313
|
+
* Log to Node.js console
|
|
3314
|
+
*/
|
|
3315
|
+
logToNode(level, message, ...args) {
|
|
3316
|
+
const formattedMessage = this.formatForNode(level, message);
|
|
3317
|
+
switch (level) {
|
|
3318
|
+
case "debug":
|
|
3319
|
+
console.debug(formattedMessage, ...args);
|
|
3320
|
+
break;
|
|
3321
|
+
case "info":
|
|
3322
|
+
console.info(formattedMessage, ...args);
|
|
3323
|
+
break;
|
|
3324
|
+
case "warn":
|
|
3325
|
+
console.warn(formattedMessage, ...args);
|
|
3326
|
+
break;
|
|
3327
|
+
case "error":
|
|
3328
|
+
console.error(formattedMessage, ...args);
|
|
3329
|
+
break;
|
|
3330
|
+
default:
|
|
3331
|
+
console.log(formattedMessage, ...args);
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* Log debug message
|
|
3336
|
+
*/
|
|
3337
|
+
debug(message, ...args) {
|
|
3338
|
+
this.logMessage("debug", message, ...args);
|
|
3339
|
+
}
|
|
3340
|
+
/**
|
|
3341
|
+
* Log info message
|
|
3342
|
+
*/
|
|
3343
|
+
info(message, ...args) {
|
|
3344
|
+
this.logMessage("info", message, ...args);
|
|
3345
|
+
}
|
|
3346
|
+
/**
|
|
3347
|
+
* Log warning message
|
|
3348
|
+
*/
|
|
3349
|
+
warn(message, ...args) {
|
|
3350
|
+
this.logMessage("warn", message, ...args);
|
|
3351
|
+
}
|
|
3352
|
+
/**
|
|
3353
|
+
* Log error message
|
|
3354
|
+
*/
|
|
3355
|
+
error(message, ...args) {
|
|
3356
|
+
this.logMessage("error", message, ...args);
|
|
3357
|
+
}
|
|
3358
|
+
/**
|
|
3359
|
+
* Create a child logger with additional prefix
|
|
3360
|
+
*/
|
|
3361
|
+
child(prefix) {
|
|
3362
|
+
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
3363
|
+
return new _Logger({
|
|
3364
|
+
...this.config,
|
|
3365
|
+
prefix: childPrefix
|
|
3366
|
+
});
|
|
3367
|
+
}
|
|
3368
|
+
/**
|
|
3369
|
+
* Set log level
|
|
3370
|
+
*/
|
|
3371
|
+
setLevel(level) {
|
|
3372
|
+
this.config.level = level;
|
|
3373
|
+
}
|
|
3374
|
+
/**
|
|
3375
|
+
* Get current log level
|
|
3376
|
+
*/
|
|
3377
|
+
getLevel() {
|
|
3378
|
+
return this.config.level;
|
|
3379
|
+
}
|
|
3380
|
+
};
|
|
3381
|
+
var logger = new Logger();
|
|
3382
|
+
var createLogger = (config) => new Logger(config);
|
|
3383
|
+
var logger_default = logger;
|
|
3384
|
+
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
3385
|
+
var info = (message, ...args) => logger.info(message, ...args);
|
|
3386
|
+
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
3387
|
+
var error = (message, ...args) => logger.error(message, ...args);
|
|
3388
|
+
var configure = (config) => logger.configure(config);
|
|
3389
|
+
var createComponentLogger = (component) => logger.child(component);
|
|
3390
|
+
var createPackageLogger = (packageName) => createLogger({
|
|
3391
|
+
level: "info",
|
|
3392
|
+
prefix: `${PREFIX} - ${packageName}`,
|
|
3393
|
+
showLevel: true,
|
|
3394
|
+
timestamps: true
|
|
3395
|
+
});
|
|
3396
|
+
var createPackageComponentLogger = (packageName, component) => {
|
|
3397
|
+
const packageLogger = createPackageLogger(packageName);
|
|
3398
|
+
return packageLogger.child(component);
|
|
3399
|
+
};
|
|
3400
|
+
|
|
3401
|
+
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
3402
|
+
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
3403
|
+
if (!baseUrl) {
|
|
3404
|
+
throw new AsgardeoRuntimeError(
|
|
3405
|
+
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
3406
|
+
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
3407
|
+
"javascript",
|
|
3408
|
+
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
3409
|
+
);
|
|
3410
|
+
}
|
|
3411
|
+
let parsedUrl;
|
|
3412
|
+
try {
|
|
3413
|
+
parsedUrl = new URL(baseUrl);
|
|
3414
|
+
} catch (error2) {
|
|
3415
|
+
throw new AsgardeoRuntimeError(
|
|
3416
|
+
`Invalid base URL format: ${baseUrl}`,
|
|
3417
|
+
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
3418
|
+
"javascript",
|
|
3419
|
+
"The provided base URL does not conform to valid URL syntax."
|
|
3420
|
+
);
|
|
3421
|
+
}
|
|
3422
|
+
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
3423
|
+
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3424
|
+
logger_default.warn(
|
|
3425
|
+
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
3426
|
+
);
|
|
3427
|
+
return false;
|
|
3428
|
+
}
|
|
3429
|
+
return true;
|
|
3430
|
+
};
|
|
3431
|
+
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
3432
|
+
|
|
3433
|
+
// src/utils/identifyPlatform.ts
|
|
3434
|
+
var identifyPlatform = (config) => {
|
|
3435
|
+
const { baseUrl } = config;
|
|
3436
|
+
try {
|
|
3437
|
+
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
3438
|
+
try {
|
|
3439
|
+
const url = new URL(baseUrl);
|
|
3440
|
+
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
3441
|
+
return "ASGARDEO" /* Asgardeo */;
|
|
3442
|
+
}
|
|
3443
|
+
} catch {
|
|
3444
|
+
logger_default.debug(
|
|
3445
|
+
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
3446
|
+
);
|
|
3447
|
+
}
|
|
3448
|
+
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
3449
|
+
}
|
|
3450
|
+
return "UNKNOWN" /* Unknown */;
|
|
3451
|
+
} catch (error2) {
|
|
3452
|
+
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
3453
|
+
return "UNKNOWN" /* Unknown */;
|
|
3454
|
+
}
|
|
3455
|
+
};
|
|
3456
|
+
var identifyPlatform_default = identifyPlatform;
|
|
3457
|
+
|
|
3458
|
+
// src/api/getBrandingPreference.ts
|
|
3459
|
+
var getBrandingPreference = async ({
|
|
3460
|
+
baseUrl,
|
|
3461
|
+
locale,
|
|
3462
|
+
name,
|
|
3463
|
+
type,
|
|
3464
|
+
fetcher,
|
|
3465
|
+
...requestConfig
|
|
3466
|
+
}) => {
|
|
3467
|
+
try {
|
|
3468
|
+
new URL(baseUrl);
|
|
3469
|
+
} catch (error2) {
|
|
3470
|
+
throw new AsgardeoAPIError(
|
|
3471
|
+
`Invalid base URL provided. ${error2?.toString()}`,
|
|
3472
|
+
"getBrandingPreference-ValidationError-001",
|
|
3473
|
+
"javascript",
|
|
3474
|
+
400,
|
|
3475
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
3476
|
+
);
|
|
3477
|
+
}
|
|
3478
|
+
const queryParams = new URLSearchParams(
|
|
3479
|
+
Object.fromEntries(
|
|
3480
|
+
Object.entries({
|
|
3481
|
+
locale: locale || "",
|
|
3482
|
+
name: name || "",
|
|
3483
|
+
type: type || ""
|
|
3484
|
+
}).filter(([, value]) => Boolean(value))
|
|
3485
|
+
)
|
|
3486
|
+
);
|
|
3487
|
+
const fetchFn = fetcher || fetch;
|
|
3488
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
3489
|
+
const requestInit = {
|
|
3490
|
+
...requestConfig,
|
|
3491
|
+
headers: {
|
|
3492
|
+
Accept: "application/json",
|
|
3493
|
+
"Content-Type": "application/json",
|
|
3494
|
+
...requestConfig.headers
|
|
3495
|
+
},
|
|
3496
|
+
method: "GET"
|
|
3497
|
+
};
|
|
3498
|
+
try {
|
|
3499
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
3500
|
+
if (!response?.ok) {
|
|
3501
|
+
const errorText = await response.text();
|
|
3502
|
+
const platform = identifyPlatform_default({ baseUrl });
|
|
3503
|
+
let errorDescription;
|
|
3504
|
+
try {
|
|
3505
|
+
const errorBody = JSON.parse(errorText);
|
|
3506
|
+
errorDescription = errorBody?.description || errorBody?.message || errorText;
|
|
3507
|
+
} catch {
|
|
3508
|
+
errorDescription = errorText;
|
|
3509
|
+
}
|
|
3510
|
+
let platformConsoleGuidance;
|
|
3511
|
+
if (platform === "ASGARDEO" /* Asgardeo */) {
|
|
3512
|
+
platformConsoleGuidance = "configure branding preferences in the Asgardeo console";
|
|
3513
|
+
} else if (platform === "IDENTITY_SERVER" /* IdentityServer */) {
|
|
3514
|
+
platformConsoleGuidance = "configure branding preferences in the WSO2 Identity Server console";
|
|
3515
|
+
} else {
|
|
3516
|
+
platformConsoleGuidance = "configure branding preferences in the platform console";
|
|
3517
|
+
}
|
|
3518
|
+
logger_default.warn(
|
|
3519
|
+
`[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.`
|
|
3520
|
+
);
|
|
3521
|
+
throw new AsgardeoAPIError(
|
|
3522
|
+
errorText,
|
|
3523
|
+
"getBrandingPreference-ResponseError-001",
|
|
3524
|
+
"javascript",
|
|
3525
|
+
response.status,
|
|
3526
|
+
response.statusText,
|
|
3527
|
+
"Failed to get branding preference"
|
|
3528
|
+
);
|
|
3529
|
+
}
|
|
3530
|
+
const data = await response.json();
|
|
3531
|
+
return data;
|
|
3532
|
+
} catch (error2) {
|
|
3533
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
3534
|
+
throw error2;
|
|
3535
|
+
}
|
|
3536
|
+
throw new AsgardeoAPIError(
|
|
3537
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
3538
|
+
"getBrandingPreference-NetworkError-001",
|
|
3539
|
+
"javascript",
|
|
3540
|
+
0,
|
|
3541
|
+
"Network Error"
|
|
3542
|
+
);
|
|
3543
|
+
}
|
|
3544
|
+
};
|
|
3545
|
+
var getBrandingPreference_default = getBrandingPreference;
|
|
3546
|
+
|
|
3547
|
+
// src/models/v2/embedded-signin-flow-v2.ts
|
|
3548
|
+
var EmbeddedSignInFlowStatus = /* @__PURE__ */ ((EmbeddedSignInFlowStatus3) => {
|
|
3549
|
+
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3550
|
+
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3551
|
+
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3552
|
+
return EmbeddedSignInFlowStatus3;
|
|
3553
|
+
})(EmbeddedSignInFlowStatus || {});
|
|
3554
|
+
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3555
|
+
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3556
|
+
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3557
|
+
return EmbeddedSignInFlowType3;
|
|
3558
|
+
})(EmbeddedSignInFlowType || {});
|
|
3559
|
+
|
|
3560
|
+
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3561
|
+
var executeEmbeddedSignInFlowV2 = async ({
|
|
3562
|
+
url,
|
|
3563
|
+
baseUrl,
|
|
3564
|
+
payload,
|
|
3565
|
+
authId,
|
|
3566
|
+
...requestConfig
|
|
3567
|
+
}) => {
|
|
3568
|
+
if (!payload) {
|
|
3569
|
+
throw new AsgardeoAPIError(
|
|
3570
|
+
"Authorization payload is required",
|
|
3571
|
+
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3572
|
+
"javascript",
|
|
3573
|
+
400,
|
|
3574
|
+
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3575
|
+
);
|
|
3576
|
+
}
|
|
3577
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3578
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3579
|
+
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
3580
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3581
|
+
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
|
|
3582
|
+
const response = await fetch(endpoint, {
|
|
3583
|
+
...requestConfig,
|
|
3584
|
+
body: JSON.stringify(requestPayload),
|
|
3585
|
+
headers: {
|
|
3586
|
+
Accept: "application/json",
|
|
3587
|
+
"Content-Type": "application/json",
|
|
3588
|
+
...requestConfig.headers
|
|
3589
|
+
},
|
|
3590
|
+
method: requestConfig.method || "POST"
|
|
3591
|
+
});
|
|
3592
|
+
if (!response.ok) {
|
|
3593
|
+
const errorText = await response.text();
|
|
3594
|
+
throw new AsgardeoAPIError(
|
|
3595
|
+
errorText,
|
|
3596
|
+
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3597
|
+
"javascript",
|
|
3598
|
+
response.status,
|
|
3599
|
+
response.statusText,
|
|
3600
|
+
"Authorization request failed"
|
|
3601
|
+
);
|
|
3602
|
+
}
|
|
3603
|
+
const flowResponse = await response.json();
|
|
3604
|
+
if (flowResponse.flowStatus === "COMPLETE" /* Complete */ && flowResponse.assertion && authId) {
|
|
3605
|
+
try {
|
|
3606
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
3607
|
+
body: JSON.stringify({
|
|
3608
|
+
assertion: flowResponse.assertion,
|
|
3609
|
+
authId
|
|
3610
|
+
}),
|
|
3611
|
+
credentials: "include",
|
|
3612
|
+
headers: {
|
|
3613
|
+
Accept: "application/json",
|
|
3614
|
+
"Content-Type": "application/json",
|
|
3615
|
+
...requestConfig.headers
|
|
3616
|
+
},
|
|
3617
|
+
method: "POST"
|
|
3618
|
+
});
|
|
3619
|
+
if (!oauth2Response.ok) {
|
|
3620
|
+
const oauth2ErrorText = await oauth2Response.text();
|
|
3621
|
+
throw new AsgardeoAPIError(
|
|
3622
|
+
`OAuth2 authorization failed: ${oauth2ErrorText}`,
|
|
3623
|
+
"executeEmbeddedSignInFlow-OAuth2Error-002",
|
|
3624
|
+
"javascript",
|
|
3625
|
+
oauth2Response.status,
|
|
3626
|
+
oauth2Response.statusText
|
|
3627
|
+
);
|
|
3628
|
+
}
|
|
3629
|
+
const oauth2Result = await oauth2Response.json();
|
|
3630
|
+
return {
|
|
3631
|
+
flowStatus: flowResponse.flowStatus,
|
|
3632
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
3633
|
+
};
|
|
3634
|
+
} catch (authError) {
|
|
3635
|
+
throw new AsgardeoAPIError(
|
|
3636
|
+
`OAuth2 authorization failed: ${authError instanceof Error ? authError.message : "Unknown error"}`,
|
|
3637
|
+
"executeEmbeddedSignInFlow-OAuth2Error-001",
|
|
3638
|
+
"javascript",
|
|
3639
|
+
500,
|
|
3640
|
+
"Failed to complete OAuth2 authorization after successful embedded sign-in flow."
|
|
3641
|
+
);
|
|
3642
|
+
}
|
|
3643
|
+
}
|
|
3644
|
+
return flowResponse;
|
|
3645
|
+
};
|
|
3646
|
+
var executeEmbeddedSignInFlowV2_default = executeEmbeddedSignInFlowV2;
|
|
3647
|
+
|
|
3648
|
+
// src/models/v2/embedded-signup-flow-v2.ts
|
|
3649
|
+
var EmbeddedSignUpFlowStatus = /* @__PURE__ */ ((EmbeddedSignUpFlowStatus2) => {
|
|
3650
|
+
EmbeddedSignUpFlowStatus2["Complete"] = "COMPLETE";
|
|
3651
|
+
EmbeddedSignUpFlowStatus2["Error"] = "ERROR";
|
|
3652
|
+
EmbeddedSignUpFlowStatus2["Incomplete"] = "INCOMPLETE";
|
|
3653
|
+
return EmbeddedSignUpFlowStatus2;
|
|
3654
|
+
})(EmbeddedSignUpFlowStatus || {});
|
|
3655
|
+
var EmbeddedSignUpFlowType = /* @__PURE__ */ ((EmbeddedSignUpFlowType2) => {
|
|
3244
3656
|
EmbeddedSignUpFlowType2["Redirection"] = "REDIRECTION";
|
|
3245
3657
|
EmbeddedSignUpFlowType2["View"] = "VIEW";
|
|
3246
3658
|
return EmbeddedSignUpFlowType2;
|
|
@@ -3281,11 +3693,12 @@ var executeEmbeddedSignUpFlowV2 = async ({
|
|
|
3281
3693
|
if (!response.ok) {
|
|
3282
3694
|
const errorText = await response.text();
|
|
3283
3695
|
throw new AsgardeoAPIError(
|
|
3284
|
-
|
|
3696
|
+
errorText,
|
|
3285
3697
|
"executeEmbeddedSignUpFlow-ResponseError-001",
|
|
3286
3698
|
"javascript",
|
|
3287
3699
|
response.status,
|
|
3288
|
-
response.statusText
|
|
3700
|
+
response.statusText,
|
|
3701
|
+
"Registration request failed"
|
|
3289
3702
|
);
|
|
3290
3703
|
}
|
|
3291
3704
|
const flowResponse = await response.json();
|
|
@@ -3420,11 +3833,12 @@ var executeEmbeddedUserOnboardingFlowV2 = async ({
|
|
|
3420
3833
|
if (!response.ok) {
|
|
3421
3834
|
const errorText = await response.text();
|
|
3422
3835
|
throw new AsgardeoAPIError(
|
|
3423
|
-
|
|
3836
|
+
errorText,
|
|
3424
3837
|
"executeEmbeddedUserOnboardingFlow-ResponseError-001",
|
|
3425
3838
|
"javascript",
|
|
3426
3839
|
response.status,
|
|
3427
|
-
response.statusText
|
|
3840
|
+
response.statusText,
|
|
3841
|
+
"User onboarding request failed"
|
|
3428
3842
|
);
|
|
3429
3843
|
}
|
|
3430
3844
|
const flowResponse = await response.json();
|
|
@@ -3461,11 +3875,12 @@ var getFlowMetaV2 = async ({
|
|
|
3461
3875
|
if (!response.ok) {
|
|
3462
3876
|
const errorText = await response.text();
|
|
3463
3877
|
throw new AsgardeoAPIError(
|
|
3464
|
-
|
|
3878
|
+
errorText,
|
|
3465
3879
|
"getFlowMetaV2-ResponseError-001",
|
|
3466
3880
|
"javascript",
|
|
3467
3881
|
response.status,
|
|
3468
|
-
response.statusText
|
|
3882
|
+
response.statusText,
|
|
3883
|
+
"Flow metadata request failed"
|
|
3469
3884
|
);
|
|
3470
3885
|
}
|
|
3471
3886
|
const flowMetadata = await response.json();
|
|
@@ -3507,11 +3922,12 @@ var getOrganizationUnitChildren = async ({
|
|
|
3507
3922
|
if (!response.ok) {
|
|
3508
3923
|
const errorText = await response.text();
|
|
3509
3924
|
throw new AsgardeoAPIError(
|
|
3510
|
-
|
|
3925
|
+
errorText,
|
|
3511
3926
|
"getOrganizationUnitChildren-ResponseError-001",
|
|
3512
3927
|
"javascript",
|
|
3513
3928
|
response.status,
|
|
3514
|
-
response.statusText
|
|
3929
|
+
response.statusText,
|
|
3930
|
+
"Failed to fetch organization unit children"
|
|
3515
3931
|
);
|
|
3516
3932
|
}
|
|
3517
3933
|
const listResponse = await response.json();
|
|
@@ -3740,16 +4156,16 @@ var DefaultCacheStore = class {
|
|
|
3740
4156
|
};
|
|
3741
4157
|
|
|
3742
4158
|
// src/DefaultCrypto.ts
|
|
3743
|
-
var
|
|
4159
|
+
var jose2 = __toESM(require("jose"), 1);
|
|
3744
4160
|
var DefaultCrypto = class {
|
|
3745
4161
|
// eslint-disable-next-line class-methods-use-this
|
|
3746
4162
|
base64URLDecode(value) {
|
|
3747
|
-
const decodedArray =
|
|
4163
|
+
const decodedArray = jose2.base64url.decode(value);
|
|
3748
4164
|
return new TextDecoder().decode(decodedArray);
|
|
3749
4165
|
}
|
|
3750
4166
|
// eslint-disable-next-line class-methods-use-this
|
|
3751
4167
|
base64URLEncode(value) {
|
|
3752
|
-
return
|
|
4168
|
+
return jose2.base64url.encode(value);
|
|
3753
4169
|
}
|
|
3754
4170
|
// eslint-disable-next-line class-methods-use-this
|
|
3755
4171
|
generateRandomBytes(length) {
|
|
@@ -3764,8 +4180,8 @@ var DefaultCrypto = class {
|
|
|
3764
4180
|
}
|
|
3765
4181
|
// eslint-disable-next-line class-methods-use-this
|
|
3766
4182
|
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
3767
|
-
const key = await
|
|
3768
|
-
await
|
|
4183
|
+
const key = await jose2.importJWK(jwk);
|
|
4184
|
+
await jose2.jwtVerify(idToken, key, {
|
|
3769
4185
|
algorithms,
|
|
3770
4186
|
audience: [clientId],
|
|
3771
4187
|
clockTolerance,
|
|
@@ -4220,660 +4636,374 @@ var toCssVariables = (theme) => {
|
|
|
4220
4636
|
if (theme.colors?.background?.disabled) {
|
|
4221
4637
|
cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;
|
|
4222
4638
|
}
|
|
4223
|
-
if (theme.colors?.background?.body?.main) {
|
|
4224
|
-
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4225
|
-
}
|
|
4226
|
-
if (theme.colors?.error?.main) {
|
|
4227
|
-
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4228
|
-
}
|
|
4229
|
-
if (theme.colors?.error?.contrastText) {
|
|
4230
|
-
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4231
|
-
}
|
|
4232
|
-
if (theme.colors?.error?.light) {
|
|
4233
|
-
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4234
|
-
}
|
|
4235
|
-
if (theme.colors?.success?.main) {
|
|
4236
|
-
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4237
|
-
}
|
|
4238
|
-
if (theme.colors?.success?.contrastText) {
|
|
4239
|
-
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4240
|
-
}
|
|
4241
|
-
if (theme.colors?.success?.light) {
|
|
4242
|
-
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4243
|
-
}
|
|
4244
|
-
if (theme.colors?.warning?.main) {
|
|
4245
|
-
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4246
|
-
}
|
|
4247
|
-
if (theme.colors?.warning?.contrastText) {
|
|
4248
|
-
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4249
|
-
}
|
|
4250
|
-
if (theme.colors?.warning?.light) {
|
|
4251
|
-
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4252
|
-
}
|
|
4253
|
-
if (theme.colors?.info?.main) {
|
|
4254
|
-
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4255
|
-
}
|
|
4256
|
-
if (theme.colors?.info?.contrastText) {
|
|
4257
|
-
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4258
|
-
}
|
|
4259
|
-
if (theme.colors?.info?.light) {
|
|
4260
|
-
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4261
|
-
}
|
|
4262
|
-
if (theme.colors?.text?.primary) {
|
|
4263
|
-
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4264
|
-
}
|
|
4265
|
-
if (theme.colors?.text?.secondary) {
|
|
4266
|
-
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4267
|
-
}
|
|
4268
|
-
if (theme.colors?.border) {
|
|
4269
|
-
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4270
|
-
}
|
|
4271
|
-
if (theme.spacing?.unit !== void 0) {
|
|
4272
|
-
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4273
|
-
}
|
|
4274
|
-
if (theme.borderRadius?.small) {
|
|
4275
|
-
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4276
|
-
}
|
|
4277
|
-
if (theme.borderRadius?.medium) {
|
|
4278
|
-
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4279
|
-
}
|
|
4280
|
-
if (theme.borderRadius?.large) {
|
|
4281
|
-
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4282
|
-
}
|
|
4283
|
-
if (theme.shadows?.small) {
|
|
4284
|
-
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4285
|
-
}
|
|
4286
|
-
if (theme.shadows?.medium) {
|
|
4287
|
-
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4288
|
-
}
|
|
4289
|
-
if (theme.shadows?.large) {
|
|
4290
|
-
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4291
|
-
}
|
|
4292
|
-
if (theme.typography?.fontFamily) {
|
|
4293
|
-
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4294
|
-
}
|
|
4295
|
-
if (theme.typography?.fontSizes?.xs) {
|
|
4296
|
-
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4297
|
-
}
|
|
4298
|
-
if (theme.typography?.fontSizes?.sm) {
|
|
4299
|
-
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4300
|
-
}
|
|
4301
|
-
if (theme.typography?.fontSizes?.md) {
|
|
4302
|
-
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4303
|
-
}
|
|
4304
|
-
if (theme.typography?.fontSizes?.lg) {
|
|
4305
|
-
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4306
|
-
}
|
|
4307
|
-
if (theme.typography?.fontSizes?.xl) {
|
|
4308
|
-
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4309
|
-
}
|
|
4310
|
-
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4311
|
-
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4312
|
-
}
|
|
4313
|
-
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4314
|
-
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4315
|
-
}
|
|
4316
|
-
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4317
|
-
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4318
|
-
}
|
|
4319
|
-
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4320
|
-
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4321
|
-
}
|
|
4322
|
-
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4323
|
-
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4324
|
-
}
|
|
4325
|
-
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4326
|
-
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4327
|
-
}
|
|
4328
|
-
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4329
|
-
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4330
|
-
}
|
|
4331
|
-
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4332
|
-
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4333
|
-
}
|
|
4334
|
-
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4335
|
-
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4336
|
-
}
|
|
4337
|
-
if (theme.images) {
|
|
4338
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4339
|
-
const imageConfig = theme.images[imageKey];
|
|
4340
|
-
if (imageConfig?.url) {
|
|
4341
|
-
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4342
|
-
}
|
|
4343
|
-
if (imageConfig?.title) {
|
|
4344
|
-
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4345
|
-
}
|
|
4346
|
-
if (imageConfig?.alt) {
|
|
4347
|
-
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4348
|
-
}
|
|
4349
|
-
});
|
|
4350
|
-
}
|
|
4351
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4352
|
-
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4353
|
-
}
|
|
4354
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4355
|
-
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4356
|
-
}
|
|
4357
|
-
return cssVars;
|
|
4358
|
-
};
|
|
4359
|
-
var toThemeVars = (theme) => {
|
|
4360
|
-
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
4361
|
-
const componentVars = {};
|
|
4362
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4363
|
-
componentVars.Button = {
|
|
4364
|
-
root: {
|
|
4365
|
-
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4366
|
-
}
|
|
4367
|
-
};
|
|
4368
|
-
}
|
|
4369
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4370
|
-
componentVars.Field = {
|
|
4371
|
-
root: {
|
|
4372
|
-
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
4373
|
-
}
|
|
4374
|
-
};
|
|
4375
|
-
}
|
|
4376
|
-
const themeVars = {
|
|
4377
|
-
borderRadius: {
|
|
4378
|
-
large: `var(--${prefix}-border-radius-large)`,
|
|
4379
|
-
medium: `var(--${prefix}-border-radius-medium)`,
|
|
4380
|
-
small: `var(--${prefix}-border-radius-small)`
|
|
4381
|
-
},
|
|
4382
|
-
colors: {
|
|
4383
|
-
action: {
|
|
4384
|
-
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
4385
|
-
active: `var(--${prefix}-color-action-active)`,
|
|
4386
|
-
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
4387
|
-
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
4388
|
-
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
4389
|
-
focus: `var(--${prefix}-color-action-focus)`,
|
|
4390
|
-
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
4391
|
-
hover: `var(--${prefix}-color-action-hover)`,
|
|
4392
|
-
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
4393
|
-
selected: `var(--${prefix}-color-action-selected)`,
|
|
4394
|
-
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
4395
|
-
},
|
|
4396
|
-
background: {
|
|
4397
|
-
body: {
|
|
4398
|
-
main: `var(--${prefix}-color-background-body-main)`
|
|
4399
|
-
},
|
|
4400
|
-
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
4401
|
-
surface: `var(--${prefix}-color-background-surface)`
|
|
4402
|
-
},
|
|
4403
|
-
border: `var(--${prefix}-color-border)`,
|
|
4404
|
-
error: {
|
|
4405
|
-
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
4406
|
-
main: `var(--${prefix}-color-error-main)`
|
|
4407
|
-
},
|
|
4408
|
-
info: {
|
|
4409
|
-
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
4410
|
-
main: `var(--${prefix}-color-info-main)`
|
|
4411
|
-
},
|
|
4412
|
-
primary: {
|
|
4413
|
-
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
4414
|
-
main: `var(--${prefix}-color-primary-main)`
|
|
4415
|
-
},
|
|
4416
|
-
secondary: {
|
|
4417
|
-
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
4418
|
-
main: `var(--${prefix}-color-secondary-main)`
|
|
4419
|
-
},
|
|
4420
|
-
success: {
|
|
4421
|
-
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
4422
|
-
main: `var(--${prefix}-color-success-main)`
|
|
4423
|
-
},
|
|
4424
|
-
text: {
|
|
4425
|
-
primary: `var(--${prefix}-color-text-primary)`,
|
|
4426
|
-
secondary: `var(--${prefix}-color-text-secondary)`
|
|
4427
|
-
},
|
|
4428
|
-
warning: {
|
|
4429
|
-
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
4430
|
-
main: `var(--${prefix}-color-warning-main)`
|
|
4431
|
-
}
|
|
4432
|
-
},
|
|
4433
|
-
shadows: {
|
|
4434
|
-
large: `var(--${prefix}-shadow-large)`,
|
|
4435
|
-
medium: `var(--${prefix}-shadow-medium)`,
|
|
4436
|
-
small: `var(--${prefix}-shadow-small)`
|
|
4437
|
-
},
|
|
4438
|
-
spacing: {
|
|
4439
|
-
unit: `var(--${prefix}-spacing-unit)`
|
|
4440
|
-
},
|
|
4441
|
-
typography: {
|
|
4442
|
-
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
4443
|
-
fontSizes: {
|
|
4444
|
-
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
4445
|
-
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
4446
|
-
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
4447
|
-
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
4448
|
-
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
4449
|
-
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
4450
|
-
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
4451
|
-
},
|
|
4452
|
-
fontWeights: {
|
|
4453
|
-
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
4454
|
-
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
4455
|
-
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
4456
|
-
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
4457
|
-
},
|
|
4458
|
-
lineHeights: {
|
|
4459
|
-
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
4460
|
-
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
4461
|
-
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4462
|
-
}
|
|
4463
|
-
}
|
|
4464
|
-
};
|
|
4465
|
-
if (theme.images) {
|
|
4466
|
-
themeVars.images = {};
|
|
4467
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4468
|
-
const imageConfig = theme.images[imageKey];
|
|
4469
|
-
themeVars.images[imageKey] = {
|
|
4470
|
-
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
4471
|
-
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
4472
|
-
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
4473
|
-
};
|
|
4474
|
-
});
|
|
4475
|
-
}
|
|
4476
|
-
if (Object.keys(componentVars).length > 0) {
|
|
4477
|
-
themeVars.components = componentVars;
|
|
4639
|
+
if (theme.colors?.background?.body?.main) {
|
|
4640
|
+
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4478
4641
|
}
|
|
4479
|
-
|
|
4480
|
-
};
|
|
4481
|
-
var createTheme = (config = {}, isDark = false) => {
|
|
4482
|
-
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
4483
|
-
const mergedConfig = {
|
|
4484
|
-
...baseTheme,
|
|
4485
|
-
...config,
|
|
4486
|
-
borderRadius: {
|
|
4487
|
-
...baseTheme.borderRadius,
|
|
4488
|
-
...config.borderRadius
|
|
4489
|
-
},
|
|
4490
|
-
colors: {
|
|
4491
|
-
...baseTheme.colors,
|
|
4492
|
-
...config.colors,
|
|
4493
|
-
action: {
|
|
4494
|
-
...baseTheme.colors.action,
|
|
4495
|
-
...config.colors?.action || {}
|
|
4496
|
-
},
|
|
4497
|
-
secondary: {
|
|
4498
|
-
...baseTheme.colors.secondary,
|
|
4499
|
-
...config.colors?.secondary || {}
|
|
4500
|
-
}
|
|
4501
|
-
},
|
|
4502
|
-
images: {
|
|
4503
|
-
...baseTheme.images,
|
|
4504
|
-
...config.images
|
|
4505
|
-
},
|
|
4506
|
-
shadows: {
|
|
4507
|
-
...baseTheme.shadows,
|
|
4508
|
-
...config.shadows
|
|
4509
|
-
},
|
|
4510
|
-
spacing: {
|
|
4511
|
-
...baseTheme.spacing,
|
|
4512
|
-
...config.spacing
|
|
4513
|
-
},
|
|
4514
|
-
typography: {
|
|
4515
|
-
...baseTheme.typography,
|
|
4516
|
-
...config.typography,
|
|
4517
|
-
fontSizes: {
|
|
4518
|
-
...baseTheme.typography.fontSizes,
|
|
4519
|
-
...config.typography?.fontSizes || {}
|
|
4520
|
-
},
|
|
4521
|
-
fontWeights: {
|
|
4522
|
-
...baseTheme.typography.fontWeights,
|
|
4523
|
-
...config.typography?.fontWeights || {}
|
|
4524
|
-
},
|
|
4525
|
-
lineHeights: {
|
|
4526
|
-
...baseTheme.typography.lineHeights,
|
|
4527
|
-
...config.typography?.lineHeights || {}
|
|
4528
|
-
}
|
|
4529
|
-
}
|
|
4530
|
-
};
|
|
4531
|
-
return {
|
|
4532
|
-
...mergedConfig,
|
|
4533
|
-
cssVariables: toCssVariables(mergedConfig),
|
|
4534
|
-
vars: toThemeVars(mergedConfig)
|
|
4535
|
-
};
|
|
4536
|
-
};
|
|
4537
|
-
var DEFAULT_THEME = "light";
|
|
4538
|
-
var createTheme_default = createTheme;
|
|
4539
|
-
|
|
4540
|
-
// src/utils/arrayBufferToBase64url.ts
|
|
4541
|
-
var arrayBufferToBase64url = (buffer) => {
|
|
4542
|
-
const bytes = new Uint8Array(buffer);
|
|
4543
|
-
let binary = "";
|
|
4544
|
-
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
4545
|
-
binary += String.fromCharCode(bytes[i]);
|
|
4642
|
+
if (theme.colors?.error?.main) {
|
|
4643
|
+
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4546
4644
|
}
|
|
4547
|
-
|
|
4548
|
-
};
|
|
4549
|
-
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
4550
|
-
|
|
4551
|
-
// src/utils/base64urlToArrayBuffer.ts
|
|
4552
|
-
var base64urlToArrayBuffer = (base64url2) => {
|
|
4553
|
-
const padding = "=".repeat((4 - base64url2.length % 4) % 4);
|
|
4554
|
-
const base64 = base64url2.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
4555
|
-
const binaryString = atob(base64);
|
|
4556
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
4557
|
-
for (let i = 0; i < binaryString.length; i += 1) {
|
|
4558
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
4645
|
+
if (theme.colors?.error?.contrastText) {
|
|
4646
|
+
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4559
4647
|
}
|
|
4560
|
-
|
|
4561
|
-
};
|
|
4562
|
-
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
4563
|
-
|
|
4564
|
-
// src/utils/bem.ts
|
|
4565
|
-
var bem = (baseClass, element, modifier) => {
|
|
4566
|
-
let className = baseClass;
|
|
4567
|
-
if (element) {
|
|
4568
|
-
className += `__${element}`;
|
|
4648
|
+
if (theme.colors?.error?.light) {
|
|
4649
|
+
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4569
4650
|
}
|
|
4570
|
-
if (
|
|
4571
|
-
|
|
4651
|
+
if (theme.colors?.success?.main) {
|
|
4652
|
+
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4572
4653
|
}
|
|
4573
|
-
|
|
4574
|
-
};
|
|
4575
|
-
var bem_default = bem;
|
|
4576
|
-
|
|
4577
|
-
// src/utils/formatDate.ts
|
|
4578
|
-
var formatDate = (dateString) => {
|
|
4579
|
-
if (!dateString) return "-";
|
|
4580
|
-
try {
|
|
4581
|
-
return new Date(dateString).toLocaleDateString("en-US", {
|
|
4582
|
-
day: "numeric",
|
|
4583
|
-
month: "long",
|
|
4584
|
-
year: "numeric"
|
|
4585
|
-
});
|
|
4586
|
-
} catch {
|
|
4587
|
-
return dateString;
|
|
4654
|
+
if (theme.colors?.success?.contrastText) {
|
|
4655
|
+
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4588
4656
|
}
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
// src/utils/logger.ts
|
|
4593
|
-
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
4594
|
-
var DEFAULT_CONFIG = {
|
|
4595
|
-
level: "info",
|
|
4596
|
-
prefix: `${PREFIX}`,
|
|
4597
|
-
showLevel: true,
|
|
4598
|
-
timestamps: true
|
|
4599
|
-
};
|
|
4600
|
-
var isBrowser = () => (
|
|
4601
|
-
/* @ts-ignore */
|
|
4602
|
-
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
4603
|
-
);
|
|
4604
|
-
var isNode = () => (
|
|
4605
|
-
/* @ts-ignore */
|
|
4606
|
-
typeof process !== "undefined" && process.versions && process.versions.node
|
|
4607
|
-
);
|
|
4608
|
-
var COLORS = {
|
|
4609
|
-
blue: "\x1B[34m",
|
|
4610
|
-
bright: "\x1B[1m",
|
|
4611
|
-
cyan: "\x1B[36m",
|
|
4612
|
-
dim: "\x1B[2m",
|
|
4613
|
-
gray: "\x1B[90m",
|
|
4614
|
-
green: "\x1B[32m",
|
|
4615
|
-
magenta: "\x1B[35m",
|
|
4616
|
-
red: "\x1B[31m",
|
|
4617
|
-
reset: "\x1B[0m",
|
|
4618
|
-
white: "\x1B[37m",
|
|
4619
|
-
yellow: "\x1B[33m"
|
|
4620
|
-
};
|
|
4621
|
-
var BROWSER_STYLES = {
|
|
4622
|
-
debug: "color: #6b7280; font-weight: normal;",
|
|
4623
|
-
error: "color: #dc2626; font-weight: bold;",
|
|
4624
|
-
info: "color: #2563eb; font-weight: bold;",
|
|
4625
|
-
prefix: "color: #7c3aed; font-weight: bold;",
|
|
4626
|
-
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
4627
|
-
warn: "color: #d97706; font-weight: bold;"
|
|
4628
|
-
};
|
|
4629
|
-
var LOG_LEVEL_ORDER = {
|
|
4630
|
-
debug: 0,
|
|
4631
|
-
error: 3,
|
|
4632
|
-
info: 1,
|
|
4633
|
-
warn: 2
|
|
4634
|
-
};
|
|
4635
|
-
var Logger = class _Logger {
|
|
4636
|
-
constructor(config = {}) {
|
|
4637
|
-
__publicField(this, "config");
|
|
4638
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
4657
|
+
if (theme.colors?.success?.light) {
|
|
4658
|
+
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4639
4659
|
}
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4660
|
+
if (theme.colors?.warning?.main) {
|
|
4661
|
+
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4662
|
+
}
|
|
4663
|
+
if (theme.colors?.warning?.contrastText) {
|
|
4664
|
+
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4665
|
+
}
|
|
4666
|
+
if (theme.colors?.warning?.light) {
|
|
4667
|
+
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4668
|
+
}
|
|
4669
|
+
if (theme.colors?.info?.main) {
|
|
4670
|
+
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4671
|
+
}
|
|
4672
|
+
if (theme.colors?.info?.contrastText) {
|
|
4673
|
+
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4674
|
+
}
|
|
4675
|
+
if (theme.colors?.info?.light) {
|
|
4676
|
+
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4677
|
+
}
|
|
4678
|
+
if (theme.colors?.text?.primary) {
|
|
4679
|
+
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4680
|
+
}
|
|
4681
|
+
if (theme.colors?.text?.secondary) {
|
|
4682
|
+
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4683
|
+
}
|
|
4684
|
+
if (theme.colors?.border) {
|
|
4685
|
+
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4686
|
+
}
|
|
4687
|
+
if (theme.spacing?.unit !== void 0) {
|
|
4688
|
+
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4689
|
+
}
|
|
4690
|
+
if (theme.borderRadius?.small) {
|
|
4691
|
+
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4692
|
+
}
|
|
4693
|
+
if (theme.borderRadius?.medium) {
|
|
4694
|
+
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4695
|
+
}
|
|
4696
|
+
if (theme.borderRadius?.large) {
|
|
4697
|
+
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4698
|
+
}
|
|
4699
|
+
if (theme.shadows?.small) {
|
|
4700
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4701
|
+
}
|
|
4702
|
+
if (theme.shadows?.medium) {
|
|
4703
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4704
|
+
}
|
|
4705
|
+
if (theme.shadows?.large) {
|
|
4706
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4707
|
+
}
|
|
4708
|
+
if (theme.typography?.fontFamily) {
|
|
4709
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4710
|
+
}
|
|
4711
|
+
if (theme.typography?.fontSizes?.xs) {
|
|
4712
|
+
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4713
|
+
}
|
|
4714
|
+
if (theme.typography?.fontSizes?.sm) {
|
|
4715
|
+
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4716
|
+
}
|
|
4717
|
+
if (theme.typography?.fontSizes?.md) {
|
|
4718
|
+
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4719
|
+
}
|
|
4720
|
+
if (theme.typography?.fontSizes?.lg) {
|
|
4721
|
+
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4722
|
+
}
|
|
4723
|
+
if (theme.typography?.fontSizes?.xl) {
|
|
4724
|
+
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4725
|
+
}
|
|
4726
|
+
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4727
|
+
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4728
|
+
}
|
|
4729
|
+
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4730
|
+
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4731
|
+
}
|
|
4732
|
+
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4733
|
+
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4734
|
+
}
|
|
4735
|
+
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4736
|
+
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4737
|
+
}
|
|
4738
|
+
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4739
|
+
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4740
|
+
}
|
|
4741
|
+
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4742
|
+
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4645
4743
|
}
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
*/
|
|
4649
|
-
getConfig() {
|
|
4650
|
-
return { ...this.config };
|
|
4744
|
+
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4745
|
+
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4651
4746
|
}
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
*/
|
|
4655
|
-
shouldLog(level) {
|
|
4656
|
-
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
4747
|
+
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4748
|
+
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4657
4749
|
}
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
*/
|
|
4661
|
-
static getTimestamp() {
|
|
4662
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
4750
|
+
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4751
|
+
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4663
4752
|
}
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
default:
|
|
4678
|
-
return "UNKNOWN";
|
|
4679
|
-
}
|
|
4753
|
+
if (theme.images) {
|
|
4754
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
4755
|
+
const imageConfig = theme.images[imageKey];
|
|
4756
|
+
if (imageConfig?.url) {
|
|
4757
|
+
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4758
|
+
}
|
|
4759
|
+
if (imageConfig?.title) {
|
|
4760
|
+
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4761
|
+
}
|
|
4762
|
+
if (imageConfig?.alt) {
|
|
4763
|
+
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4764
|
+
}
|
|
4765
|
+
});
|
|
4680
4766
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
case "debug":
|
|
4697
|
-
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
4698
|
-
break;
|
|
4699
|
-
case "info":
|
|
4700
|
-
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
4701
|
-
break;
|
|
4702
|
-
case "warn":
|
|
4703
|
-
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
4704
|
-
break;
|
|
4705
|
-
case "error":
|
|
4706
|
-
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
4707
|
-
break;
|
|
4708
|
-
default:
|
|
4709
|
-
coloredLevel = `[${levelStr}]`;
|
|
4767
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4768
|
+
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4769
|
+
}
|
|
4770
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4771
|
+
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4772
|
+
}
|
|
4773
|
+
return cssVars;
|
|
4774
|
+
};
|
|
4775
|
+
var toThemeVars = (theme) => {
|
|
4776
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
4777
|
+
const componentVars = {};
|
|
4778
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4779
|
+
componentVars.Button = {
|
|
4780
|
+
root: {
|
|
4781
|
+
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4710
4782
|
}
|
|
4711
|
-
|
|
4712
|
-
}
|
|
4713
|
-
parts.push(message);
|
|
4714
|
-
return parts.join(" ");
|
|
4783
|
+
};
|
|
4715
4784
|
}
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
}
|
|
4723
|
-
if (this.config.formatter) {
|
|
4724
|
-
this.config.formatter(level, message, ...args);
|
|
4725
|
-
return;
|
|
4726
|
-
}
|
|
4727
|
-
if (isBrowser()) {
|
|
4728
|
-
this.logToBrowser(level, message, ...args);
|
|
4729
|
-
} else if (isNode()) {
|
|
4730
|
-
this.logToNode(level, message, ...args);
|
|
4731
|
-
} else {
|
|
4732
|
-
console.log(message, ...args);
|
|
4733
|
-
}
|
|
4785
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4786
|
+
componentVars.Field = {
|
|
4787
|
+
root: {
|
|
4788
|
+
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
4789
|
+
}
|
|
4790
|
+
};
|
|
4734
4791
|
}
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4792
|
+
const themeVars = {
|
|
4793
|
+
borderRadius: {
|
|
4794
|
+
large: `var(--${prefix}-border-radius-large)`,
|
|
4795
|
+
medium: `var(--${prefix}-border-radius-medium)`,
|
|
4796
|
+
small: `var(--${prefix}-border-radius-small)`
|
|
4797
|
+
},
|
|
4798
|
+
colors: {
|
|
4799
|
+
action: {
|
|
4800
|
+
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
4801
|
+
active: `var(--${prefix}-color-action-active)`,
|
|
4802
|
+
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
4803
|
+
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
4804
|
+
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
4805
|
+
focus: `var(--${prefix}-color-action-focus)`,
|
|
4806
|
+
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
4807
|
+
hover: `var(--${prefix}-color-action-hover)`,
|
|
4808
|
+
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
4809
|
+
selected: `var(--${prefix}-color-action-selected)`,
|
|
4810
|
+
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
4811
|
+
},
|
|
4812
|
+
background: {
|
|
4813
|
+
body: {
|
|
4814
|
+
main: `var(--${prefix}-color-background-body-main)`
|
|
4815
|
+
},
|
|
4816
|
+
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
4817
|
+
surface: `var(--${prefix}-color-background-surface)`
|
|
4818
|
+
},
|
|
4819
|
+
border: `var(--${prefix}-color-border)`,
|
|
4820
|
+
error: {
|
|
4821
|
+
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
4822
|
+
main: `var(--${prefix}-color-error-main)`
|
|
4823
|
+
},
|
|
4824
|
+
info: {
|
|
4825
|
+
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
4826
|
+
main: `var(--${prefix}-color-info-main)`
|
|
4827
|
+
},
|
|
4828
|
+
primary: {
|
|
4829
|
+
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
4830
|
+
main: `var(--${prefix}-color-primary-main)`
|
|
4831
|
+
},
|
|
4832
|
+
secondary: {
|
|
4833
|
+
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
4834
|
+
main: `var(--${prefix}-color-secondary-main)`
|
|
4835
|
+
},
|
|
4836
|
+
success: {
|
|
4837
|
+
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
4838
|
+
main: `var(--${prefix}-color-success-main)`
|
|
4839
|
+
},
|
|
4840
|
+
text: {
|
|
4841
|
+
primary: `var(--${prefix}-color-text-primary)`,
|
|
4842
|
+
secondary: `var(--${prefix}-color-text-secondary)`
|
|
4843
|
+
},
|
|
4844
|
+
warning: {
|
|
4845
|
+
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
4846
|
+
main: `var(--${prefix}-color-warning-main)`
|
|
4847
|
+
}
|
|
4848
|
+
},
|
|
4849
|
+
shadows: {
|
|
4850
|
+
large: `var(--${prefix}-shadow-large)`,
|
|
4851
|
+
medium: `var(--${prefix}-shadow-medium)`,
|
|
4852
|
+
small: `var(--${prefix}-shadow-small)`
|
|
4853
|
+
},
|
|
4854
|
+
spacing: {
|
|
4855
|
+
unit: `var(--${prefix}-spacing-unit)`
|
|
4856
|
+
},
|
|
4857
|
+
typography: {
|
|
4858
|
+
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
4859
|
+
fontSizes: {
|
|
4860
|
+
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
4861
|
+
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
4862
|
+
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
4863
|
+
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
4864
|
+
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
4865
|
+
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
4866
|
+
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
4867
|
+
},
|
|
4868
|
+
fontWeights: {
|
|
4869
|
+
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
4870
|
+
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
4871
|
+
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
4872
|
+
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
4873
|
+
},
|
|
4874
|
+
lineHeights: {
|
|
4875
|
+
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
4876
|
+
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
4877
|
+
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4767
4878
|
}
|
|
4768
4879
|
}
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
console.warn(formattedMessage, ...styles, ...args);
|
|
4781
|
-
break;
|
|
4782
|
-
case "error":
|
|
4783
|
-
console.error(formattedMessage, ...styles, ...args);
|
|
4784
|
-
break;
|
|
4785
|
-
default:
|
|
4786
|
-
console.log(formattedMessage, ...styles, ...args);
|
|
4787
|
-
}
|
|
4880
|
+
};
|
|
4881
|
+
if (theme.images) {
|
|
4882
|
+
themeVars.images = {};
|
|
4883
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
4884
|
+
const imageConfig = theme.images[imageKey];
|
|
4885
|
+
themeVars.images[imageKey] = {
|
|
4886
|
+
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
4887
|
+
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
4888
|
+
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
4889
|
+
};
|
|
4890
|
+
});
|
|
4788
4891
|
}
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
*/
|
|
4792
|
-
logToNode(level, message, ...args) {
|
|
4793
|
-
const formattedMessage = this.formatForNode(level, message);
|
|
4794
|
-
switch (level) {
|
|
4795
|
-
case "debug":
|
|
4796
|
-
console.debug(formattedMessage, ...args);
|
|
4797
|
-
break;
|
|
4798
|
-
case "info":
|
|
4799
|
-
console.info(formattedMessage, ...args);
|
|
4800
|
-
break;
|
|
4801
|
-
case "warn":
|
|
4802
|
-
console.warn(formattedMessage, ...args);
|
|
4803
|
-
break;
|
|
4804
|
-
case "error":
|
|
4805
|
-
console.error(formattedMessage, ...args);
|
|
4806
|
-
break;
|
|
4807
|
-
default:
|
|
4808
|
-
console.log(formattedMessage, ...args);
|
|
4809
|
-
}
|
|
4892
|
+
if (Object.keys(componentVars).length > 0) {
|
|
4893
|
+
themeVars.components = componentVars;
|
|
4810
4894
|
}
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4895
|
+
return themeVars;
|
|
4896
|
+
};
|
|
4897
|
+
var createTheme = (config = {}, isDark = false) => {
|
|
4898
|
+
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
4899
|
+
const mergedConfig = {
|
|
4900
|
+
...baseTheme,
|
|
4901
|
+
...config,
|
|
4902
|
+
borderRadius: {
|
|
4903
|
+
...baseTheme.borderRadius,
|
|
4904
|
+
...config.borderRadius
|
|
4905
|
+
},
|
|
4906
|
+
colors: {
|
|
4907
|
+
...baseTheme.colors,
|
|
4908
|
+
...config.colors,
|
|
4909
|
+
action: {
|
|
4910
|
+
...baseTheme.colors.action,
|
|
4911
|
+
...config.colors?.action || {}
|
|
4912
|
+
},
|
|
4913
|
+
secondary: {
|
|
4914
|
+
...baseTheme.colors.secondary,
|
|
4915
|
+
...config.colors?.secondary || {}
|
|
4916
|
+
}
|
|
4917
|
+
},
|
|
4918
|
+
images: {
|
|
4919
|
+
...baseTheme.images,
|
|
4920
|
+
...config.images
|
|
4921
|
+
},
|
|
4922
|
+
shadows: {
|
|
4923
|
+
...baseTheme.shadows,
|
|
4924
|
+
...config.shadows
|
|
4925
|
+
},
|
|
4926
|
+
spacing: {
|
|
4927
|
+
...baseTheme.spacing,
|
|
4928
|
+
...config.spacing
|
|
4929
|
+
},
|
|
4930
|
+
typography: {
|
|
4931
|
+
...baseTheme.typography,
|
|
4932
|
+
...config.typography,
|
|
4933
|
+
fontSizes: {
|
|
4934
|
+
...baseTheme.typography.fontSizes,
|
|
4935
|
+
...config.typography?.fontSizes || {}
|
|
4936
|
+
},
|
|
4937
|
+
fontWeights: {
|
|
4938
|
+
...baseTheme.typography.fontWeights,
|
|
4939
|
+
...config.typography?.fontWeights || {}
|
|
4940
|
+
},
|
|
4941
|
+
lineHeights: {
|
|
4942
|
+
...baseTheme.typography.lineHeights,
|
|
4943
|
+
...config.typography?.lineHeights || {}
|
|
4944
|
+
}
|
|
4945
|
+
}
|
|
4946
|
+
};
|
|
4947
|
+
return {
|
|
4948
|
+
...mergedConfig,
|
|
4949
|
+
cssVariables: toCssVariables(mergedConfig),
|
|
4950
|
+
vars: toThemeVars(mergedConfig)
|
|
4951
|
+
};
|
|
4952
|
+
};
|
|
4953
|
+
var DEFAULT_THEME = "light";
|
|
4954
|
+
var createTheme_default = createTheme;
|
|
4955
|
+
|
|
4956
|
+
// src/utils/arrayBufferToBase64url.ts
|
|
4957
|
+
var arrayBufferToBase64url = (buffer) => {
|
|
4958
|
+
const bytes = new Uint8Array(buffer);
|
|
4959
|
+
let binary = "";
|
|
4960
|
+
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
4961
|
+
binary += String.fromCharCode(bytes[i]);
|
|
4816
4962
|
}
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4963
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
4964
|
+
};
|
|
4965
|
+
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
4966
|
+
|
|
4967
|
+
// src/utils/base64urlToArrayBuffer.ts
|
|
4968
|
+
var base64urlToArrayBuffer = (base64url3) => {
|
|
4969
|
+
const padding = "=".repeat((4 - base64url3.length % 4) % 4);
|
|
4970
|
+
const base64 = base64url3.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
4971
|
+
const binaryString = atob(base64);
|
|
4972
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
4973
|
+
for (let i = 0; i < binaryString.length; i += 1) {
|
|
4974
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
4822
4975
|
}
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4976
|
+
return bytes.buffer;
|
|
4977
|
+
};
|
|
4978
|
+
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
4979
|
+
|
|
4980
|
+
// src/utils/bem.ts
|
|
4981
|
+
var bem = (baseClass, element, modifier) => {
|
|
4982
|
+
let className = baseClass;
|
|
4983
|
+
if (element) {
|
|
4984
|
+
className += `__${element}`;
|
|
4828
4985
|
}
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
*/
|
|
4832
|
-
error(message, ...args) {
|
|
4833
|
-
this.logMessage("error", message, ...args);
|
|
4986
|
+
if (modifier) {
|
|
4987
|
+
className += `--${modifier}`;
|
|
4834
4988
|
}
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4989
|
+
return className;
|
|
4990
|
+
};
|
|
4991
|
+
var bem_default = bem;
|
|
4992
|
+
|
|
4993
|
+
// src/utils/formatDate.ts
|
|
4994
|
+
var formatDate = (dateString) => {
|
|
4995
|
+
if (!dateString) return "-";
|
|
4996
|
+
try {
|
|
4997
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
4998
|
+
day: "numeric",
|
|
4999
|
+
month: "long",
|
|
5000
|
+
year: "numeric"
|
|
4843
5001
|
});
|
|
5002
|
+
} catch {
|
|
5003
|
+
return dateString;
|
|
4844
5004
|
}
|
|
4845
|
-
/**
|
|
4846
|
-
* Set log level
|
|
4847
|
-
*/
|
|
4848
|
-
setLevel(level) {
|
|
4849
|
-
this.config.level = level;
|
|
4850
|
-
}
|
|
4851
|
-
/**
|
|
4852
|
-
* Get current log level
|
|
4853
|
-
*/
|
|
4854
|
-
getLevel() {
|
|
4855
|
-
return this.config.level;
|
|
4856
|
-
}
|
|
4857
|
-
};
|
|
4858
|
-
var logger = new Logger();
|
|
4859
|
-
var createLogger = (config) => new Logger(config);
|
|
4860
|
-
var logger_default = logger;
|
|
4861
|
-
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
4862
|
-
var info = (message, ...args) => logger.info(message, ...args);
|
|
4863
|
-
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
4864
|
-
var error = (message, ...args) => logger.error(message, ...args);
|
|
4865
|
-
var configure = (config) => logger.configure(config);
|
|
4866
|
-
var createComponentLogger = (component) => logger.child(component);
|
|
4867
|
-
var createPackageLogger = (packageName) => createLogger({
|
|
4868
|
-
level: "info",
|
|
4869
|
-
prefix: `${PREFIX} - ${packageName}`,
|
|
4870
|
-
showLevel: true,
|
|
4871
|
-
timestamps: true
|
|
4872
|
-
});
|
|
4873
|
-
var createPackageComponentLogger = (packageName, component) => {
|
|
4874
|
-
const packageLogger = createPackageLogger(packageName);
|
|
4875
|
-
return packageLogger.child(component);
|
|
4876
5005
|
};
|
|
5006
|
+
var formatDate_default = formatDate;
|
|
4877
5007
|
|
|
4878
5008
|
// src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
4879
5009
|
var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
@@ -4924,38 +5054,6 @@ var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
|
4924
5054
|
};
|
|
4925
5055
|
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
4926
5056
|
|
|
4927
|
-
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
4928
|
-
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
4929
|
-
if (!baseUrl) {
|
|
4930
|
-
throw new AsgardeoRuntimeError(
|
|
4931
|
-
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
4932
|
-
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
4933
|
-
"javascript",
|
|
4934
|
-
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
4935
|
-
);
|
|
4936
|
-
}
|
|
4937
|
-
let parsedUrl;
|
|
4938
|
-
try {
|
|
4939
|
-
parsedUrl = new URL(baseUrl);
|
|
4940
|
-
} catch (error2) {
|
|
4941
|
-
throw new AsgardeoRuntimeError(
|
|
4942
|
-
`Invalid base URL format: ${baseUrl}`,
|
|
4943
|
-
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
4944
|
-
"javascript",
|
|
4945
|
-
"The provided base URL does not conform to valid URL syntax."
|
|
4946
|
-
);
|
|
4947
|
-
}
|
|
4948
|
-
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
4949
|
-
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
4950
|
-
logger_default.warn(
|
|
4951
|
-
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
4952
|
-
);
|
|
4953
|
-
return false;
|
|
4954
|
-
}
|
|
4955
|
-
return true;
|
|
4956
|
-
};
|
|
4957
|
-
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
4958
|
-
|
|
4959
5057
|
// src/utils/flattenUserSchema.ts
|
|
4960
5058
|
var flattenUserSchema = (schemas) => {
|
|
4961
5059
|
const flattenedAttributes = [];
|
|
@@ -5141,31 +5239,6 @@ var generateFlattenedUserProfile = (meResponse, processedSchemas) => {
|
|
|
5141
5239
|
};
|
|
5142
5240
|
var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
|
|
5143
5241
|
|
|
5144
|
-
// src/utils/identifyPlatform.ts
|
|
5145
|
-
var identifyPlatform = (config) => {
|
|
5146
|
-
const { baseUrl } = config;
|
|
5147
|
-
try {
|
|
5148
|
-
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
5149
|
-
try {
|
|
5150
|
-
const url = new URL(baseUrl);
|
|
5151
|
-
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
5152
|
-
return "ASGARDEO" /* Asgardeo */;
|
|
5153
|
-
}
|
|
5154
|
-
} catch {
|
|
5155
|
-
logger_default.debug(
|
|
5156
|
-
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
5157
|
-
);
|
|
5158
|
-
}
|
|
5159
|
-
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
5160
|
-
}
|
|
5161
|
-
return "UNKNOWN" /* Unknown */;
|
|
5162
|
-
} catch (error2) {
|
|
5163
|
-
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
5164
|
-
return "UNKNOWN" /* Unknown */;
|
|
5165
|
-
}
|
|
5166
|
-
};
|
|
5167
|
-
var identifyPlatform_default = identifyPlatform;
|
|
5168
|
-
|
|
5169
5242
|
// src/utils/getRedirectBasedSignUpUrl.ts
|
|
5170
5243
|
var getRedirectBasedSignUpUrl = (config) => {
|
|
5171
5244
|
const { baseUrl } = config;
|