@asgardeo/javascript 0.20.1 → 0.23.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/AsgardeoJavaScriptClient.d.ts +85 -1
- package/dist/AsgardeoJavaScriptClient.d.ts.map +1 -1
- 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/getBrandingPreference.d.ts.map +1 -1
- package/dist/cjs/index.js +1130 -866
- package/dist/cjs/index.js.map +4 -4
- package/dist/edge/index.js +1130 -865
- package/dist/edge/index.js.map +4 -4
- package/dist/index.d.ts +63 -43
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1130 -865
- package/dist/index.js.map +4 -4
- package/dist/models/agent.d.ts +3 -3
- package/dist/models/agent.d.ts.map +1 -1
- package/dist/models/config.d.ts +22 -1
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/organization.d.ts +11 -1
- package/dist/models/organization.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/models/token.d.ts +1 -1
- package/dist/utils/base64Encode.d.ts +36 -0
- package/dist/utils/base64Encode.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -31,7 +31,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
-
AgentConfig: () => AgentConfig,
|
|
35
34
|
ApplicationNativeAuthenticationConstants: () => ApplicationNativeAuthenticationConstants_default,
|
|
36
35
|
AsgardeoAPIError: () => AsgardeoAPIError,
|
|
37
36
|
AsgardeoAuthClient: () => AsgardeoAuthClient,
|
|
@@ -1088,6 +1087,16 @@ var StorageManager = class _StorageManager {
|
|
|
1088
1087
|
};
|
|
1089
1088
|
var StorageManager_default = StorageManager;
|
|
1090
1089
|
|
|
1090
|
+
// src/utils/base64Encode.ts
|
|
1091
|
+
var jose = __toESM(require("jose"), 1);
|
|
1092
|
+
var base64Encode = (value) => {
|
|
1093
|
+
const b64url = jose.base64url.encode(new TextEncoder().encode(value));
|
|
1094
|
+
const rem = b64url.length % 4;
|
|
1095
|
+
const padded = rem === 0 ? b64url : b64url + "=".repeat(4 - rem);
|
|
1096
|
+
return padded.replace(/-/g, "+").replace(/_/g, "/");
|
|
1097
|
+
};
|
|
1098
|
+
var base64Encode_default = base64Encode;
|
|
1099
|
+
|
|
1091
1100
|
// src/utils/deepMerge.ts
|
|
1092
1101
|
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
1102
|
var deepMerge = (target, ...sources) => {
|
|
@@ -1454,7 +1463,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1454
1463
|
}
|
|
1455
1464
|
const body = new URLSearchParams();
|
|
1456
1465
|
body.set("client_id", configData.clientId);
|
|
1457
|
-
|
|
1466
|
+
const hasSecret = Boolean(configData.clientSecret && configData.clientSecret.trim().length > 0);
|
|
1467
|
+
const tokenEndpointAuthMethod = configData.tokenRequest?.authMethod ?? (configData.platform === "AsgardeoV2" /* AsgardeoV2 */ ? "client_secret_basic" : "client_secret_post");
|
|
1468
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_post") {
|
|
1458
1469
|
body.set("client_secret", configData.clientSecret);
|
|
1459
1470
|
}
|
|
1460
1471
|
const code = authorizationCode;
|
|
@@ -1473,15 +1484,22 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1473
1484
|
);
|
|
1474
1485
|
await this.storageManager.removeTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), userId);
|
|
1475
1486
|
}
|
|
1487
|
+
const tokenRequestHeaders = {
|
|
1488
|
+
Accept: "application/json",
|
|
1489
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1490
|
+
};
|
|
1491
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_basic") {
|
|
1492
|
+
const credential = `${encodeURIComponent(configData.clientId)}:${encodeURIComponent(
|
|
1493
|
+
configData.clientSecret
|
|
1494
|
+
)}`;
|
|
1495
|
+
tokenRequestHeaders["Authorization"] = `Basic ${base64Encode_default(credential)}`;
|
|
1496
|
+
}
|
|
1476
1497
|
let tokenResponse;
|
|
1477
1498
|
try {
|
|
1478
1499
|
tokenResponse = await fetch(tokenEndpoint, {
|
|
1479
1500
|
body,
|
|
1480
1501
|
credentials: configData.sendCookiesInRequests ? "include" : "same-origin",
|
|
1481
|
-
headers:
|
|
1482
|
-
Accept: "application/json",
|
|
1483
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
1484
|
-
},
|
|
1502
|
+
headers: tokenRequestHeaders,
|
|
1485
1503
|
method: "POST"
|
|
1486
1504
|
});
|
|
1487
1505
|
} catch (error2) {
|
|
@@ -3093,171 +3111,533 @@ var updateMeProfile = async ({
|
|
|
3093
3111
|
};
|
|
3094
3112
|
var updateMeProfile_default = updateMeProfile;
|
|
3095
3113
|
|
|
3096
|
-
// src/
|
|
3097
|
-
var
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3114
|
+
// src/utils/logger.ts
|
|
3115
|
+
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
3116
|
+
var DEFAULT_CONFIG = {
|
|
3117
|
+
level: "info",
|
|
3118
|
+
prefix: `${PREFIX}`,
|
|
3119
|
+
showLevel: true,
|
|
3120
|
+
timestamps: true
|
|
3121
|
+
};
|
|
3122
|
+
var isBrowser = () => (
|
|
3123
|
+
/* @ts-ignore */
|
|
3124
|
+
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
3125
|
+
);
|
|
3126
|
+
var isNode = () => (
|
|
3127
|
+
/* @ts-ignore */
|
|
3128
|
+
typeof process !== "undefined" && process.versions && process.versions.node
|
|
3129
|
+
);
|
|
3130
|
+
var COLORS = {
|
|
3131
|
+
blue: "\x1B[34m",
|
|
3132
|
+
bright: "\x1B[1m",
|
|
3133
|
+
cyan: "\x1B[36m",
|
|
3134
|
+
dim: "\x1B[2m",
|
|
3135
|
+
gray: "\x1B[90m",
|
|
3136
|
+
green: "\x1B[32m",
|
|
3137
|
+
magenta: "\x1B[35m",
|
|
3138
|
+
red: "\x1B[31m",
|
|
3139
|
+
reset: "\x1B[0m",
|
|
3140
|
+
white: "\x1B[37m",
|
|
3141
|
+
yellow: "\x1B[33m"
|
|
3142
|
+
};
|
|
3143
|
+
var BROWSER_STYLES = {
|
|
3144
|
+
debug: "color: #6b7280; font-weight: normal;",
|
|
3145
|
+
error: "color: #dc2626; font-weight: bold;",
|
|
3146
|
+
info: "color: #2563eb; font-weight: bold;",
|
|
3147
|
+
prefix: "color: #7c3aed; font-weight: bold;",
|
|
3148
|
+
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
3149
|
+
warn: "color: #d97706; font-weight: bold;"
|
|
3150
|
+
};
|
|
3151
|
+
var LOG_LEVEL_ORDER = {
|
|
3152
|
+
debug: 0,
|
|
3153
|
+
error: 3,
|
|
3154
|
+
info: 1,
|
|
3155
|
+
warn: 2
|
|
3156
|
+
};
|
|
3157
|
+
var Logger = class _Logger {
|
|
3158
|
+
constructor(config = {}) {
|
|
3159
|
+
__publicField(this, "config");
|
|
3160
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
3115
3161
|
}
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
type: type || ""
|
|
3122
|
-
}).filter(([, value]) => Boolean(value))
|
|
3123
|
-
)
|
|
3124
|
-
);
|
|
3125
|
-
const fetchFn = fetcher || fetch;
|
|
3126
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
3127
|
-
const requestInit = {
|
|
3128
|
-
...requestConfig,
|
|
3129
|
-
headers: {
|
|
3130
|
-
Accept: "application/json",
|
|
3131
|
-
"Content-Type": "application/json",
|
|
3132
|
-
...requestConfig.headers
|
|
3133
|
-
},
|
|
3134
|
-
method: "GET"
|
|
3135
|
-
};
|
|
3136
|
-
try {
|
|
3137
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
3138
|
-
if (!response?.ok) {
|
|
3139
|
-
const errorText = await response.text();
|
|
3140
|
-
throw new AsgardeoAPIError(
|
|
3141
|
-
errorText,
|
|
3142
|
-
"getBrandingPreference-ResponseError-001",
|
|
3143
|
-
"javascript",
|
|
3144
|
-
response.status,
|
|
3145
|
-
response.statusText,
|
|
3146
|
-
"Failed to get branding preference"
|
|
3147
|
-
);
|
|
3148
|
-
}
|
|
3149
|
-
const data = await response.json();
|
|
3150
|
-
return data;
|
|
3151
|
-
} catch (error2) {
|
|
3152
|
-
if (error2 instanceof AsgardeoAPIError) {
|
|
3153
|
-
throw error2;
|
|
3154
|
-
}
|
|
3155
|
-
throw new AsgardeoAPIError(
|
|
3156
|
-
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
3157
|
-
"getBrandingPreference-NetworkError-001",
|
|
3158
|
-
"javascript",
|
|
3159
|
-
0,
|
|
3160
|
-
"Network Error"
|
|
3161
|
-
);
|
|
3162
|
+
/**
|
|
3163
|
+
* Update logger configuration
|
|
3164
|
+
*/
|
|
3165
|
+
configure(config) {
|
|
3166
|
+
this.config = { ...this.config, ...config };
|
|
3162
3167
|
}
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3169
|
-
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3170
|
-
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3171
|
-
return EmbeddedSignInFlowStatus3;
|
|
3172
|
-
})(EmbeddedSignInFlowStatus || {});
|
|
3173
|
-
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3174
|
-
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3175
|
-
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3176
|
-
return EmbeddedSignInFlowType3;
|
|
3177
|
-
})(EmbeddedSignInFlowType || {});
|
|
3178
|
-
|
|
3179
|
-
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3180
|
-
var executeEmbeddedSignInFlowV2 = async ({
|
|
3181
|
-
url,
|
|
3182
|
-
baseUrl,
|
|
3183
|
-
payload,
|
|
3184
|
-
authId,
|
|
3185
|
-
...requestConfig
|
|
3186
|
-
}) => {
|
|
3187
|
-
if (!payload) {
|
|
3188
|
-
throw new AsgardeoAPIError(
|
|
3189
|
-
"Authorization payload is required",
|
|
3190
|
-
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3191
|
-
"javascript",
|
|
3192
|
-
400,
|
|
3193
|
-
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3194
|
-
);
|
|
3168
|
+
/**
|
|
3169
|
+
* Get current configuration
|
|
3170
|
+
*/
|
|
3171
|
+
getConfig() {
|
|
3172
|
+
return { ...this.config };
|
|
3195
3173
|
}
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
const response = await fetch(endpoint, {
|
|
3202
|
-
...requestConfig,
|
|
3203
|
-
body: JSON.stringify(requestPayload),
|
|
3204
|
-
headers: {
|
|
3205
|
-
Accept: "application/json",
|
|
3206
|
-
"Content-Type": "application/json",
|
|
3207
|
-
...requestConfig.headers
|
|
3208
|
-
},
|
|
3209
|
-
method: requestConfig.method || "POST"
|
|
3210
|
-
});
|
|
3211
|
-
if (!response.ok) {
|
|
3212
|
-
const errorText = await response.text();
|
|
3213
|
-
throw new AsgardeoAPIError(
|
|
3214
|
-
errorText,
|
|
3215
|
-
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3216
|
-
"javascript",
|
|
3217
|
-
response.status,
|
|
3218
|
-
response.statusText,
|
|
3219
|
-
"Authorization request failed"
|
|
3220
|
-
);
|
|
3174
|
+
/**
|
|
3175
|
+
* Check if a log level should be output
|
|
3176
|
+
*/
|
|
3177
|
+
shouldLog(level) {
|
|
3178
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
3221
3179
|
}
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3180
|
+
/**
|
|
3181
|
+
* Get timestamp string
|
|
3182
|
+
*/
|
|
3183
|
+
static getTimestamp() {
|
|
3184
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3185
|
+
}
|
|
3186
|
+
/**
|
|
3187
|
+
* Get log level string
|
|
3188
|
+
*/
|
|
3189
|
+
static getLevelString(level) {
|
|
3190
|
+
switch (level) {
|
|
3191
|
+
case "debug":
|
|
3192
|
+
return "DEBUG";
|
|
3193
|
+
case "info":
|
|
3194
|
+
return "INFO";
|
|
3195
|
+
case "warn":
|
|
3196
|
+
return "WARN";
|
|
3197
|
+
case "error":
|
|
3198
|
+
return "ERROR";
|
|
3199
|
+
default:
|
|
3200
|
+
return "UNKNOWN";
|
|
3201
|
+
}
|
|
3202
|
+
}
|
|
3203
|
+
/**
|
|
3204
|
+
* Format message for Node.js terminal
|
|
3205
|
+
*/
|
|
3206
|
+
formatForNode(level, message) {
|
|
3207
|
+
const parts = [];
|
|
3208
|
+
if (this.config.timestamps) {
|
|
3209
|
+
parts.push(`${COLORS.gray}[${_Logger.getTimestamp()}]${COLORS.reset}`);
|
|
3210
|
+
}
|
|
3211
|
+
if (this.config.prefix) {
|
|
3212
|
+
parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
3213
|
+
}
|
|
3214
|
+
if (this.config.showLevel) {
|
|
3215
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3216
|
+
let coloredLevel;
|
|
3217
|
+
switch (level) {
|
|
3218
|
+
case "debug":
|
|
3219
|
+
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
3220
|
+
break;
|
|
3221
|
+
case "info":
|
|
3222
|
+
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
3223
|
+
break;
|
|
3224
|
+
case "warn":
|
|
3225
|
+
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
3226
|
+
break;
|
|
3227
|
+
case "error":
|
|
3228
|
+
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
3229
|
+
break;
|
|
3230
|
+
default:
|
|
3231
|
+
coloredLevel = `[${levelStr}]`;
|
|
3232
|
+
}
|
|
3233
|
+
parts.push(coloredLevel);
|
|
3234
|
+
}
|
|
3235
|
+
parts.push(message);
|
|
3236
|
+
return parts.join(" ");
|
|
3237
|
+
}
|
|
3238
|
+
/**
|
|
3239
|
+
* Log message using appropriate method
|
|
3240
|
+
*/
|
|
3241
|
+
logMessage(level, message, ...args) {
|
|
3242
|
+
if (!this.shouldLog(level)) {
|
|
3243
|
+
return;
|
|
3244
|
+
}
|
|
3245
|
+
if (this.config.formatter) {
|
|
3246
|
+
this.config.formatter(level, message, ...args);
|
|
3247
|
+
return;
|
|
3248
|
+
}
|
|
3249
|
+
if (isBrowser()) {
|
|
3250
|
+
this.logToBrowser(level, message, ...args);
|
|
3251
|
+
} else if (isNode()) {
|
|
3252
|
+
this.logToNode(level, message, ...args);
|
|
3253
|
+
} else {
|
|
3254
|
+
console.log(message, ...args);
|
|
3255
|
+
}
|
|
3256
|
+
}
|
|
3257
|
+
/**
|
|
3258
|
+
* Log to browser console with styling
|
|
3259
|
+
*/
|
|
3260
|
+
logToBrowser(level, message, ...args) {
|
|
3261
|
+
const parts = [];
|
|
3262
|
+
const styles = [];
|
|
3263
|
+
if (this.config.timestamps) {
|
|
3264
|
+
parts.push(`%c[${_Logger.getTimestamp()}]`);
|
|
3265
|
+
styles.push(BROWSER_STYLES.timestamp);
|
|
3266
|
+
}
|
|
3267
|
+
if (this.config.prefix) {
|
|
3268
|
+
parts.push(`%c${this.config.prefix}`);
|
|
3269
|
+
styles.push(BROWSER_STYLES.prefix);
|
|
3270
|
+
}
|
|
3271
|
+
if (this.config.showLevel) {
|
|
3272
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3273
|
+
parts.push(`%c[${levelStr}]`);
|
|
3274
|
+
switch (level) {
|
|
3275
|
+
case "debug":
|
|
3276
|
+
styles.push(BROWSER_STYLES.debug);
|
|
3277
|
+
break;
|
|
3278
|
+
case "info":
|
|
3279
|
+
styles.push(BROWSER_STYLES.info);
|
|
3280
|
+
break;
|
|
3281
|
+
case "warn":
|
|
3282
|
+
styles.push(BROWSER_STYLES.warn);
|
|
3283
|
+
break;
|
|
3284
|
+
case "error":
|
|
3285
|
+
styles.push(BROWSER_STYLES.error);
|
|
3286
|
+
break;
|
|
3287
|
+
default:
|
|
3288
|
+
styles.push("");
|
|
3289
|
+
}
|
|
3290
|
+
}
|
|
3291
|
+
parts.push(`%c${message}`);
|
|
3292
|
+
styles.push("color: inherit; font-weight: normal;");
|
|
3293
|
+
const formattedMessage = parts.join(" ");
|
|
3294
|
+
switch (level) {
|
|
3295
|
+
case "debug":
|
|
3296
|
+
console.debug(formattedMessage, ...styles, ...args);
|
|
3297
|
+
break;
|
|
3298
|
+
case "info":
|
|
3299
|
+
console.info(formattedMessage, ...styles, ...args);
|
|
3300
|
+
break;
|
|
3301
|
+
case "warn":
|
|
3302
|
+
console.warn(formattedMessage, ...styles, ...args);
|
|
3303
|
+
break;
|
|
3304
|
+
case "error":
|
|
3305
|
+
console.error(formattedMessage, ...styles, ...args);
|
|
3306
|
+
break;
|
|
3307
|
+
default:
|
|
3308
|
+
console.log(formattedMessage, ...styles, ...args);
|
|
3309
|
+
}
|
|
3310
|
+
}
|
|
3311
|
+
/**
|
|
3312
|
+
* Log to Node.js console
|
|
3313
|
+
*/
|
|
3314
|
+
logToNode(level, message, ...args) {
|
|
3315
|
+
const formattedMessage = this.formatForNode(level, message);
|
|
3316
|
+
switch (level) {
|
|
3317
|
+
case "debug":
|
|
3318
|
+
console.debug(formattedMessage, ...args);
|
|
3319
|
+
break;
|
|
3320
|
+
case "info":
|
|
3321
|
+
console.info(formattedMessage, ...args);
|
|
3322
|
+
break;
|
|
3323
|
+
case "warn":
|
|
3324
|
+
console.warn(formattedMessage, ...args);
|
|
3325
|
+
break;
|
|
3326
|
+
case "error":
|
|
3327
|
+
console.error(formattedMessage, ...args);
|
|
3328
|
+
break;
|
|
3329
|
+
default:
|
|
3330
|
+
console.log(formattedMessage, ...args);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3333
|
+
/**
|
|
3334
|
+
* Log debug message
|
|
3335
|
+
*/
|
|
3336
|
+
debug(message, ...args) {
|
|
3337
|
+
this.logMessage("debug", message, ...args);
|
|
3338
|
+
}
|
|
3339
|
+
/**
|
|
3340
|
+
* Log info message
|
|
3341
|
+
*/
|
|
3342
|
+
info(message, ...args) {
|
|
3343
|
+
this.logMessage("info", message, ...args);
|
|
3344
|
+
}
|
|
3345
|
+
/**
|
|
3346
|
+
* Log warning message
|
|
3347
|
+
*/
|
|
3348
|
+
warn(message, ...args) {
|
|
3349
|
+
this.logMessage("warn", message, ...args);
|
|
3350
|
+
}
|
|
3351
|
+
/**
|
|
3352
|
+
* Log error message
|
|
3353
|
+
*/
|
|
3354
|
+
error(message, ...args) {
|
|
3355
|
+
this.logMessage("error", message, ...args);
|
|
3356
|
+
}
|
|
3357
|
+
/**
|
|
3358
|
+
* Create a child logger with additional prefix
|
|
3359
|
+
*/
|
|
3360
|
+
child(prefix) {
|
|
3361
|
+
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
3362
|
+
return new _Logger({
|
|
3363
|
+
...this.config,
|
|
3364
|
+
prefix: childPrefix
|
|
3365
|
+
});
|
|
3366
|
+
}
|
|
3367
|
+
/**
|
|
3368
|
+
* Set log level
|
|
3369
|
+
*/
|
|
3370
|
+
setLevel(level) {
|
|
3371
|
+
this.config.level = level;
|
|
3372
|
+
}
|
|
3373
|
+
/**
|
|
3374
|
+
* Get current log level
|
|
3375
|
+
*/
|
|
3376
|
+
getLevel() {
|
|
3377
|
+
return this.config.level;
|
|
3378
|
+
}
|
|
3379
|
+
};
|
|
3380
|
+
var logger = new Logger();
|
|
3381
|
+
var createLogger = (config) => new Logger(config);
|
|
3382
|
+
var logger_default = logger;
|
|
3383
|
+
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
3384
|
+
var info = (message, ...args) => logger.info(message, ...args);
|
|
3385
|
+
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
3386
|
+
var error = (message, ...args) => logger.error(message, ...args);
|
|
3387
|
+
var configure = (config) => logger.configure(config);
|
|
3388
|
+
var createComponentLogger = (component) => logger.child(component);
|
|
3389
|
+
var createPackageLogger = (packageName) => createLogger({
|
|
3390
|
+
level: "info",
|
|
3391
|
+
prefix: `${PREFIX} - ${packageName}`,
|
|
3392
|
+
showLevel: true,
|
|
3393
|
+
timestamps: true
|
|
3394
|
+
});
|
|
3395
|
+
var createPackageComponentLogger = (packageName, component) => {
|
|
3396
|
+
const packageLogger = createPackageLogger(packageName);
|
|
3397
|
+
return packageLogger.child(component);
|
|
3398
|
+
};
|
|
3399
|
+
|
|
3400
|
+
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
3401
|
+
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
3402
|
+
if (!baseUrl) {
|
|
3403
|
+
throw new AsgardeoRuntimeError(
|
|
3404
|
+
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
3405
|
+
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
3406
|
+
"javascript",
|
|
3407
|
+
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
3408
|
+
);
|
|
3409
|
+
}
|
|
3410
|
+
let parsedUrl;
|
|
3411
|
+
try {
|
|
3412
|
+
parsedUrl = new URL(baseUrl);
|
|
3413
|
+
} catch (error2) {
|
|
3414
|
+
throw new AsgardeoRuntimeError(
|
|
3415
|
+
`Invalid base URL format: ${baseUrl}`,
|
|
3416
|
+
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
3417
|
+
"javascript",
|
|
3418
|
+
"The provided base URL does not conform to valid URL syntax."
|
|
3419
|
+
);
|
|
3420
|
+
}
|
|
3421
|
+
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
3422
|
+
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3423
|
+
logger_default.warn(
|
|
3424
|
+
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
3425
|
+
);
|
|
3426
|
+
return false;
|
|
3427
|
+
}
|
|
3428
|
+
return true;
|
|
3429
|
+
};
|
|
3430
|
+
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
3431
|
+
|
|
3432
|
+
// src/utils/identifyPlatform.ts
|
|
3433
|
+
var identifyPlatform = (config) => {
|
|
3434
|
+
const { baseUrl } = config;
|
|
3435
|
+
try {
|
|
3436
|
+
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
3437
|
+
try {
|
|
3438
|
+
const url = new URL(baseUrl);
|
|
3439
|
+
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
3440
|
+
return "ASGARDEO" /* Asgardeo */;
|
|
3441
|
+
}
|
|
3442
|
+
} catch {
|
|
3443
|
+
logger_default.debug(
|
|
3444
|
+
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
3445
|
+
);
|
|
3446
|
+
}
|
|
3447
|
+
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
3448
|
+
}
|
|
3449
|
+
return "UNKNOWN" /* Unknown */;
|
|
3450
|
+
} catch (error2) {
|
|
3451
|
+
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
3452
|
+
return "UNKNOWN" /* Unknown */;
|
|
3453
|
+
}
|
|
3454
|
+
};
|
|
3455
|
+
var identifyPlatform_default = identifyPlatform;
|
|
3456
|
+
|
|
3457
|
+
// src/api/getBrandingPreference.ts
|
|
3458
|
+
var getBrandingPreference = async ({
|
|
3459
|
+
baseUrl,
|
|
3460
|
+
locale,
|
|
3461
|
+
name,
|
|
3462
|
+
type,
|
|
3463
|
+
fetcher,
|
|
3464
|
+
...requestConfig
|
|
3465
|
+
}) => {
|
|
3466
|
+
try {
|
|
3467
|
+
new URL(baseUrl);
|
|
3468
|
+
} catch (error2) {
|
|
3469
|
+
throw new AsgardeoAPIError(
|
|
3470
|
+
`Invalid base URL provided. ${error2?.toString()}`,
|
|
3471
|
+
"getBrandingPreference-ValidationError-001",
|
|
3472
|
+
"javascript",
|
|
3473
|
+
400,
|
|
3474
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
3475
|
+
);
|
|
3476
|
+
}
|
|
3477
|
+
const queryParams = new URLSearchParams(
|
|
3478
|
+
Object.fromEntries(
|
|
3479
|
+
Object.entries({
|
|
3480
|
+
locale: locale || "",
|
|
3481
|
+
name: name || "",
|
|
3482
|
+
type: type || ""
|
|
3483
|
+
}).filter(([, value]) => Boolean(value))
|
|
3484
|
+
)
|
|
3485
|
+
);
|
|
3486
|
+
const fetchFn = fetcher || fetch;
|
|
3487
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
3488
|
+
const requestInit = {
|
|
3489
|
+
...requestConfig,
|
|
3490
|
+
headers: {
|
|
3491
|
+
Accept: "application/json",
|
|
3492
|
+
"Content-Type": "application/json",
|
|
3493
|
+
...requestConfig.headers
|
|
3494
|
+
},
|
|
3495
|
+
method: "GET"
|
|
3496
|
+
};
|
|
3497
|
+
try {
|
|
3498
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
3499
|
+
if (!response?.ok) {
|
|
3500
|
+
const errorText = await response.text();
|
|
3501
|
+
const platform = identifyPlatform_default({ baseUrl });
|
|
3502
|
+
let errorDescription;
|
|
3503
|
+
try {
|
|
3504
|
+
const errorBody = JSON.parse(errorText);
|
|
3505
|
+
errorDescription = errorBody?.description || errorBody?.message || errorText;
|
|
3506
|
+
} catch {
|
|
3507
|
+
errorDescription = errorText;
|
|
3508
|
+
}
|
|
3509
|
+
let platformConsoleGuidance;
|
|
3510
|
+
if (platform === "ASGARDEO" /* Asgardeo */) {
|
|
3511
|
+
platformConsoleGuidance = "configure branding preferences in the Asgardeo console";
|
|
3512
|
+
} else if (platform === "IDENTITY_SERVER" /* IdentityServer */) {
|
|
3513
|
+
platformConsoleGuidance = "configure branding preferences in the WSO2 Identity Server console";
|
|
3514
|
+
} else {
|
|
3515
|
+
platformConsoleGuidance = "configure branding preferences in the platform console";
|
|
3516
|
+
}
|
|
3517
|
+
logger_default.warn(
|
|
3518
|
+
`[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.`
|
|
3519
|
+
);
|
|
3520
|
+
throw new AsgardeoAPIError(
|
|
3521
|
+
errorText,
|
|
3522
|
+
"getBrandingPreference-ResponseError-001",
|
|
3523
|
+
"javascript",
|
|
3524
|
+
response.status,
|
|
3525
|
+
response.statusText,
|
|
3526
|
+
"Failed to get branding preference"
|
|
3527
|
+
);
|
|
3528
|
+
}
|
|
3529
|
+
const data = await response.json();
|
|
3530
|
+
return data;
|
|
3531
|
+
} catch (error2) {
|
|
3532
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
3533
|
+
throw error2;
|
|
3534
|
+
}
|
|
3535
|
+
throw new AsgardeoAPIError(
|
|
3536
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
3537
|
+
"getBrandingPreference-NetworkError-001",
|
|
3538
|
+
"javascript",
|
|
3539
|
+
0,
|
|
3540
|
+
"Network Error"
|
|
3541
|
+
);
|
|
3542
|
+
}
|
|
3543
|
+
};
|
|
3544
|
+
var getBrandingPreference_default = getBrandingPreference;
|
|
3545
|
+
|
|
3546
|
+
// src/models/v2/embedded-signin-flow-v2.ts
|
|
3547
|
+
var EmbeddedSignInFlowStatus = /* @__PURE__ */ ((EmbeddedSignInFlowStatus3) => {
|
|
3548
|
+
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3549
|
+
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3550
|
+
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3551
|
+
return EmbeddedSignInFlowStatus3;
|
|
3552
|
+
})(EmbeddedSignInFlowStatus || {});
|
|
3553
|
+
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3554
|
+
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3555
|
+
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3556
|
+
return EmbeddedSignInFlowType3;
|
|
3557
|
+
})(EmbeddedSignInFlowType || {});
|
|
3558
|
+
|
|
3559
|
+
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3560
|
+
var executeEmbeddedSignInFlowV2 = async ({
|
|
3561
|
+
url,
|
|
3562
|
+
baseUrl,
|
|
3563
|
+
payload,
|
|
3564
|
+
authId,
|
|
3565
|
+
...requestConfig
|
|
3566
|
+
}) => {
|
|
3567
|
+
if (!payload) {
|
|
3568
|
+
throw new AsgardeoAPIError(
|
|
3569
|
+
"Authorization payload is required",
|
|
3570
|
+
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3571
|
+
"javascript",
|
|
3572
|
+
400,
|
|
3573
|
+
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3574
|
+
);
|
|
3575
|
+
}
|
|
3576
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3577
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3578
|
+
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
3579
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3580
|
+
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
|
|
3581
|
+
const response = await fetch(endpoint, {
|
|
3582
|
+
...requestConfig,
|
|
3583
|
+
body: JSON.stringify(requestPayload),
|
|
3584
|
+
headers: {
|
|
3585
|
+
Accept: "application/json",
|
|
3586
|
+
"Content-Type": "application/json",
|
|
3587
|
+
...requestConfig.headers
|
|
3588
|
+
},
|
|
3589
|
+
method: requestConfig.method || "POST"
|
|
3590
|
+
});
|
|
3591
|
+
if (!response.ok) {
|
|
3592
|
+
const errorText = await response.text();
|
|
3593
|
+
throw new AsgardeoAPIError(
|
|
3594
|
+
errorText,
|
|
3595
|
+
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3596
|
+
"javascript",
|
|
3597
|
+
response.status,
|
|
3598
|
+
response.statusText,
|
|
3599
|
+
"Authorization request failed"
|
|
3600
|
+
);
|
|
3601
|
+
}
|
|
3602
|
+
const flowResponse = await response.json();
|
|
3603
|
+
if (flowResponse.flowStatus === "COMPLETE" /* Complete */ && flowResponse.assertion && authId) {
|
|
3604
|
+
try {
|
|
3605
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
3606
|
+
body: JSON.stringify({
|
|
3607
|
+
assertion: flowResponse.assertion,
|
|
3608
|
+
authId
|
|
3609
|
+
}),
|
|
3610
|
+
credentials: "include",
|
|
3611
|
+
headers: {
|
|
3612
|
+
Accept: "application/json",
|
|
3613
|
+
"Content-Type": "application/json",
|
|
3614
|
+
...requestConfig.headers
|
|
3615
|
+
},
|
|
3616
|
+
method: "POST"
|
|
3617
|
+
});
|
|
3618
|
+
if (!oauth2Response.ok) {
|
|
3619
|
+
const oauth2ErrorText = await oauth2Response.text();
|
|
3620
|
+
throw new AsgardeoAPIError(
|
|
3621
|
+
`OAuth2 authorization failed: ${oauth2ErrorText}`,
|
|
3622
|
+
"executeEmbeddedSignInFlow-OAuth2Error-002",
|
|
3623
|
+
"javascript",
|
|
3624
|
+
oauth2Response.status,
|
|
3625
|
+
oauth2Response.statusText
|
|
3626
|
+
);
|
|
3627
|
+
}
|
|
3628
|
+
const oauth2Result = await oauth2Response.json();
|
|
3629
|
+
return {
|
|
3630
|
+
flowStatus: flowResponse.flowStatus,
|
|
3631
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
3632
|
+
};
|
|
3633
|
+
} catch (authError) {
|
|
3634
|
+
throw new AsgardeoAPIError(
|
|
3635
|
+
`OAuth2 authorization failed: ${authError instanceof Error ? authError.message : "Unknown error"}`,
|
|
3636
|
+
"executeEmbeddedSignInFlow-OAuth2Error-001",
|
|
3637
|
+
"javascript",
|
|
3638
|
+
500,
|
|
3639
|
+
"Failed to complete OAuth2 authorization after successful embedded sign-in flow."
|
|
3640
|
+
);
|
|
3261
3641
|
}
|
|
3262
3642
|
}
|
|
3263
3643
|
return flowResponse;
|
|
@@ -3705,12 +4085,6 @@ var FlowMode = /* @__PURE__ */ ((FlowMode2) => {
|
|
|
3705
4085
|
return FlowMode2;
|
|
3706
4086
|
})(FlowMode || {});
|
|
3707
4087
|
|
|
3708
|
-
// src/models/agent.ts
|
|
3709
|
-
var AgentConfig;
|
|
3710
|
-
((AgentConfig2) => {
|
|
3711
|
-
AgentConfig2.DEFAULT_AUTHENTICATOR_NAME = "Username & Password";
|
|
3712
|
-
})(AgentConfig || (AgentConfig = {}));
|
|
3713
|
-
|
|
3714
4088
|
// src/models/scim2-schema.ts
|
|
3715
4089
|
var WellKnownSchemaIds = /* @__PURE__ */ ((WellKnownSchemaIds2) => {
|
|
3716
4090
|
WellKnownSchemaIds2["Core"] = "urn:ietf:params:scim:schemas:core:2.0";
|
|
@@ -3775,16 +4149,16 @@ var DefaultCacheStore = class {
|
|
|
3775
4149
|
};
|
|
3776
4150
|
|
|
3777
4151
|
// src/DefaultCrypto.ts
|
|
3778
|
-
var
|
|
4152
|
+
var jose2 = __toESM(require("jose"), 1);
|
|
3779
4153
|
var DefaultCrypto = class {
|
|
3780
4154
|
// eslint-disable-next-line class-methods-use-this
|
|
3781
4155
|
base64URLDecode(value) {
|
|
3782
|
-
const decodedArray =
|
|
4156
|
+
const decodedArray = jose2.base64url.decode(value);
|
|
3783
4157
|
return new TextDecoder().decode(decodedArray);
|
|
3784
4158
|
}
|
|
3785
4159
|
// eslint-disable-next-line class-methods-use-this
|
|
3786
4160
|
base64URLEncode(value) {
|
|
3787
|
-
return
|
|
4161
|
+
return jose2.base64url.encode(value);
|
|
3788
4162
|
}
|
|
3789
4163
|
// eslint-disable-next-line class-methods-use-this
|
|
3790
4164
|
generateRandomBytes(length) {
|
|
@@ -3799,8 +4173,8 @@ var DefaultCrypto = class {
|
|
|
3799
4173
|
}
|
|
3800
4174
|
// eslint-disable-next-line class-methods-use-this
|
|
3801
4175
|
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
3802
|
-
const key = await
|
|
3803
|
-
await
|
|
4176
|
+
const key = await jose2.importJWK(jwk);
|
|
4177
|
+
await jose2.jwtVerify(idToken, key, {
|
|
3804
4178
|
algorithms,
|
|
3805
4179
|
audience: [clientId],
|
|
3806
4180
|
clockTolerance,
|
|
@@ -3811,24 +4185,54 @@ var DefaultCrypto = class {
|
|
|
3811
4185
|
}
|
|
3812
4186
|
};
|
|
3813
4187
|
|
|
4188
|
+
// src/models/agent.ts
|
|
4189
|
+
var AgentConfig;
|
|
4190
|
+
((AgentConfig2) => {
|
|
4191
|
+
AgentConfig2.DEFAULT_AUTHENTICATOR_NAME = "Username & Password";
|
|
4192
|
+
})(AgentConfig || (AgentConfig = {}));
|
|
4193
|
+
|
|
3814
4194
|
// src/AsgardeoJavaScriptClient.ts
|
|
3815
|
-
var
|
|
4195
|
+
var RESERVED_AUTH_KEYS = /* @__PURE__ */ new Set([
|
|
4196
|
+
"client_id",
|
|
4197
|
+
"redirect_uri",
|
|
4198
|
+
"scope",
|
|
4199
|
+
"state",
|
|
4200
|
+
"response_type",
|
|
4201
|
+
"resource",
|
|
4202
|
+
"fidp",
|
|
4203
|
+
"requested_actor",
|
|
4204
|
+
"orgId",
|
|
4205
|
+
"orgHandle",
|
|
4206
|
+
"org",
|
|
4207
|
+
"login_hint",
|
|
4208
|
+
"orgDiscoveryType",
|
|
4209
|
+
"code_challenge",
|
|
4210
|
+
"code_challenge_method"
|
|
4211
|
+
]);
|
|
4212
|
+
var AsgardeoJavaScriptClient = class _AsgardeoJavaScriptClient {
|
|
3816
4213
|
constructor(config, cacheStore, cryptoUtils) {
|
|
3817
4214
|
__publicField(this, "cacheStore");
|
|
3818
4215
|
__publicField(this, "cryptoUtils");
|
|
3819
4216
|
__publicField(this, "auth");
|
|
3820
4217
|
__publicField(this, "storageManager");
|
|
3821
4218
|
__publicField(this, "baseURL");
|
|
4219
|
+
__publicField(this, "initPromise");
|
|
3822
4220
|
this.cacheStore = cacheStore ?? new DefaultCacheStore();
|
|
3823
4221
|
this.cryptoUtils = cryptoUtils ?? new DefaultCrypto();
|
|
3824
4222
|
this.auth = new AsgardeoAuthClient();
|
|
3825
4223
|
if (config) {
|
|
3826
|
-
this.auth.initialize(config, this.cacheStore, this.cryptoUtils);
|
|
4224
|
+
this.initPromise = this.auth.initialize(config, this.cacheStore, this.cryptoUtils);
|
|
3827
4225
|
this.storageManager = this.auth.getStorageManager();
|
|
3828
4226
|
}
|
|
3829
4227
|
this.baseURL = config?.baseUrl ?? "";
|
|
3830
4228
|
}
|
|
4229
|
+
async ensureInitialized() {
|
|
4230
|
+
if (this.initPromise) {
|
|
4231
|
+
await this.initPromise;
|
|
4232
|
+
}
|
|
4233
|
+
}
|
|
3831
4234
|
async getDiscoveryResponse() {
|
|
4235
|
+
await this.ensureInitialized();
|
|
3832
4236
|
if (!this.storageManager) {
|
|
3833
4237
|
return null;
|
|
3834
4238
|
}
|
|
@@ -3903,6 +4307,15 @@ var AsgardeoJavaScriptClient = class {
|
|
|
3903
4307
|
}
|
|
3904
4308
|
/* eslint-enable class-methods-use-this, @typescript-eslint/no-unused-vars */
|
|
3905
4309
|
async getAgentToken(agentConfig) {
|
|
4310
|
+
await this.ensureInitialized();
|
|
4311
|
+
if (!agentConfig?.agentID) {
|
|
4312
|
+
throw new Error("agentConfig.agentID is required for getAgentToken().");
|
|
4313
|
+
}
|
|
4314
|
+
if (!agentConfig.agentSecret) {
|
|
4315
|
+
throw new Error(
|
|
4316
|
+
"agentConfig.agentSecret is required for getAgentToken(). The agent must authenticate against the token endpoint."
|
|
4317
|
+
);
|
|
4318
|
+
}
|
|
3906
4319
|
const customParam = {
|
|
3907
4320
|
response_mode: "direct"
|
|
3908
4321
|
};
|
|
@@ -3942,6 +4355,7 @@ var AsgardeoJavaScriptClient = class {
|
|
|
3942
4355
|
);
|
|
3943
4356
|
}
|
|
3944
4357
|
async getOBOSignInURL(agentConfig) {
|
|
4358
|
+
await this.ensureInitialized();
|
|
3945
4359
|
const customParam = {
|
|
3946
4360
|
requested_actor: agentConfig.agentID
|
|
3947
4361
|
};
|
|
@@ -3966,6 +4380,200 @@ var AsgardeoJavaScriptClient = class {
|
|
|
3966
4380
|
tokenRequestConfig
|
|
3967
4381
|
);
|
|
3968
4382
|
}
|
|
4383
|
+
/**
|
|
4384
|
+
* Builds a `/oauth2/authorize` URL targeting a specific child organization.
|
|
4385
|
+
*
|
|
4386
|
+
* The target organization can be identified by its UUID (`orgID`), handle
|
|
4387
|
+
* (`orgHandle`), display name (`org`) or via email-domain based discovery
|
|
4388
|
+
* (`emailDomain`).
|
|
4389
|
+
*
|
|
4390
|
+
* @param orgDiscoveryType - The organization discovery strategy to use.
|
|
4391
|
+
* @param discoveryInput - The identifier whose meaning depends on
|
|
4392
|
+
* `orgDiscoveryType` (UUID, handle, name or email).
|
|
4393
|
+
* @param options - Optional state, resource, agent delegation and
|
|
4394
|
+
* additional query parameters.
|
|
4395
|
+
* @returns The fully-built authorization URL.
|
|
4396
|
+
*/
|
|
4397
|
+
async getOrgAuthorizationUrl(orgDiscoveryType, discoveryInput, options = {}) {
|
|
4398
|
+
await this.ensureInitialized();
|
|
4399
|
+
const customParam = _AsgardeoJavaScriptClient.buildOrgAuthorizationParams(
|
|
4400
|
+
orgDiscoveryType,
|
|
4401
|
+
discoveryInput,
|
|
4402
|
+
options
|
|
4403
|
+
);
|
|
4404
|
+
const authURL = await this.auth.getSignInUrl(customParam);
|
|
4405
|
+
if (!authURL) {
|
|
4406
|
+
throw new Error("Could not build organization authorization URL");
|
|
4407
|
+
}
|
|
4408
|
+
return authURL.toString();
|
|
4409
|
+
}
|
|
4410
|
+
/**
|
|
4411
|
+
* Exchanges an existing access token for one scoped to a target organization,
|
|
4412
|
+
* using the `organization_switch` grant type.
|
|
4413
|
+
*
|
|
4414
|
+
* Unlike {@link AsgardeoJavaScriptClient.exchangeToken} this method does
|
|
4415
|
+
* not require an active SDK session — the caller supplies the source
|
|
4416
|
+
* access token directly. This makes it safe to use from server-side agent
|
|
4417
|
+
* flows where there is no user session yet.
|
|
4418
|
+
*
|
|
4419
|
+
* @param token - The current access token to be switched.
|
|
4420
|
+
* @param switchingOrganization - The ID/UUID of the target organization.
|
|
4421
|
+
* @param scopes - Optional list of scopes to request for the switched token.
|
|
4422
|
+
* @returns A normalized {@link TokenResponse} for the switched organization.
|
|
4423
|
+
*/
|
|
4424
|
+
async switchTokenToOrganization(token, switchingOrganization, scopes) {
|
|
4425
|
+
await this.ensureInitialized();
|
|
4426
|
+
if (!token) {
|
|
4427
|
+
throw new Error("Token is required for organization switch.");
|
|
4428
|
+
}
|
|
4429
|
+
if (!switchingOrganization) {
|
|
4430
|
+
throw new Error("switchingOrganization is required.");
|
|
4431
|
+
}
|
|
4432
|
+
if (!this.storageManager) {
|
|
4433
|
+
throw new Error("Client is not initialized. Call initialize() before switching organizations.");
|
|
4434
|
+
}
|
|
4435
|
+
const configData = await this.storageManager.getConfigData();
|
|
4436
|
+
if (!configData) {
|
|
4437
|
+
throw new Error("Client configuration is unavailable. Initialize the client before switching organizations.");
|
|
4438
|
+
}
|
|
4439
|
+
const tokenEndpoint = await this.resolveTokenEndpoint();
|
|
4440
|
+
const body = new URLSearchParams();
|
|
4441
|
+
const { clientId, clientSecret } = configData;
|
|
4442
|
+
if (!clientId || clientId.trim().length === 0) {
|
|
4443
|
+
throw new Error("clientId is required in the client configuration for organization switch.");
|
|
4444
|
+
}
|
|
4445
|
+
const hasSecret = Boolean(clientSecret && clientSecret.trim().length > 0);
|
|
4446
|
+
body.set("grant_type", "organization_switch");
|
|
4447
|
+
body.set("token", token);
|
|
4448
|
+
body.set("switching_organization", switchingOrganization);
|
|
4449
|
+
body.set("client_id", clientId);
|
|
4450
|
+
if (hasSecret) {
|
|
4451
|
+
body.set("client_secret", clientSecret);
|
|
4452
|
+
}
|
|
4453
|
+
if (scopes && scopes.length > 0) {
|
|
4454
|
+
body.set("scope", scopes.join(" "));
|
|
4455
|
+
}
|
|
4456
|
+
let response;
|
|
4457
|
+
try {
|
|
4458
|
+
response = await fetch(tokenEndpoint, {
|
|
4459
|
+
body,
|
|
4460
|
+
headers: {
|
|
4461
|
+
Accept: "application/json",
|
|
4462
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
4463
|
+
},
|
|
4464
|
+
method: "POST"
|
|
4465
|
+
});
|
|
4466
|
+
} catch (error2) {
|
|
4467
|
+
throw new Error(`Organization switch request failed: ${error2?.message ?? String(error2)}`);
|
|
4468
|
+
}
|
|
4469
|
+
if (!response.ok) {
|
|
4470
|
+
let errorBody;
|
|
4471
|
+
try {
|
|
4472
|
+
errorBody = JSON.stringify(await response.json());
|
|
4473
|
+
} catch {
|
|
4474
|
+
errorBody = response.statusText;
|
|
4475
|
+
}
|
|
4476
|
+
throw new Error(`Organization switch failed (${response.status}): ${errorBody}`);
|
|
4477
|
+
}
|
|
4478
|
+
const parsed = await response.json();
|
|
4479
|
+
return {
|
|
4480
|
+
accessToken: parsed.access_token,
|
|
4481
|
+
createdAt: parsed.created_at ?? Date.now(),
|
|
4482
|
+
expiresIn: parsed.expires_in,
|
|
4483
|
+
idToken: parsed.id_token,
|
|
4484
|
+
refreshToken: parsed.refresh_token,
|
|
4485
|
+
scope: parsed.scope,
|
|
4486
|
+
tokenType: parsed.token_type
|
|
4487
|
+
};
|
|
4488
|
+
}
|
|
4489
|
+
/**
|
|
4490
|
+
* Resolves the OAuth2 token endpoint URL.
|
|
4491
|
+
*
|
|
4492
|
+
* Prefers the value advertised by the OIDC well-known document (when it
|
|
4493
|
+
* has already been loaded into the storage manager) and falls back to
|
|
4494
|
+
* `${baseURL}/oauth2/token` derived from the SDK configuration.
|
|
4495
|
+
*/
|
|
4496
|
+
async resolveTokenEndpoint() {
|
|
4497
|
+
const discovery = this.storageManager ? await this.storageManager.loadOpenIDProviderConfiguration() : null;
|
|
4498
|
+
const discovered = discovery?.token_endpoint;
|
|
4499
|
+
if (discovered && discovered.trim().length > 0) {
|
|
4500
|
+
return discovered;
|
|
4501
|
+
}
|
|
4502
|
+
if (this.baseURL && this.baseURL.trim().length > 0) {
|
|
4503
|
+
return `${this.baseURL.replace(/\/$/, "")}/oauth2/token`;
|
|
4504
|
+
}
|
|
4505
|
+
throw new Error(
|
|
4506
|
+
"Unable to resolve the token endpoint. Provide a baseUrl in the client configuration or ensure OIDC discovery has been performed."
|
|
4507
|
+
);
|
|
4508
|
+
}
|
|
4509
|
+
/**
|
|
4510
|
+
* Authenticates as the agent and switches the issued agent token into a
|
|
4511
|
+
* target child organization in a single call.
|
|
4512
|
+
*
|
|
4513
|
+
* @param agentConfig - Agent credentials used to obtain the parent-org agent token.
|
|
4514
|
+
* @param switchingOrganization - The ID/UUID of the target organization.
|
|
4515
|
+
* @param orgScopes - Optional scopes to request for the organization-scoped token.
|
|
4516
|
+
* @returns A normalized {@link TokenResponse} scoped to the target organization.
|
|
4517
|
+
*/
|
|
4518
|
+
async getOrganizationAgentToken(agentConfig, switchingOrganization, orgScopes) {
|
|
4519
|
+
if (!switchingOrganization) {
|
|
4520
|
+
throw new Error("switchingOrganization is required.");
|
|
4521
|
+
}
|
|
4522
|
+
const agentToken = await this.getAgentToken(agentConfig);
|
|
4523
|
+
return this.switchTokenToOrganization(agentToken.accessToken, switchingOrganization, orgScopes);
|
|
4524
|
+
}
|
|
4525
|
+
/**
|
|
4526
|
+
* Builds the custom query-parameter map for an organization-scoped authorization request.
|
|
4527
|
+
*/
|
|
4528
|
+
static buildOrgAuthorizationParams(orgDiscoveryType, discoveryInput, options) {
|
|
4529
|
+
const trimmedValue = (discoveryInput ?? "").trim();
|
|
4530
|
+
if (!trimmedValue) {
|
|
4531
|
+
throw new Error("discoveryInput is required.");
|
|
4532
|
+
}
|
|
4533
|
+
const customParam = {};
|
|
4534
|
+
if (!options.isEnhancedOrgAuth) {
|
|
4535
|
+
customParam["fidp"] = "OrganizationSSO";
|
|
4536
|
+
}
|
|
4537
|
+
switch (orgDiscoveryType) {
|
|
4538
|
+
case "orgID":
|
|
4539
|
+
customParam["orgId"] = trimmedValue;
|
|
4540
|
+
break;
|
|
4541
|
+
case "orgHandle":
|
|
4542
|
+
customParam["orgHandle"] = trimmedValue;
|
|
4543
|
+
break;
|
|
4544
|
+
case "org":
|
|
4545
|
+
customParam["org"] = trimmedValue;
|
|
4546
|
+
break;
|
|
4547
|
+
case "emailDomain":
|
|
4548
|
+
customParam["login_hint"] = trimmedValue;
|
|
4549
|
+
customParam["orgDiscoveryType"] = "emailDomain";
|
|
4550
|
+
break;
|
|
4551
|
+
default:
|
|
4552
|
+
throw new Error(`Unsupported orgDiscoveryType: ${orgDiscoveryType}`);
|
|
4553
|
+
}
|
|
4554
|
+
if (options.resource) {
|
|
4555
|
+
customParam["resource"] = options.resource;
|
|
4556
|
+
}
|
|
4557
|
+
if (options.state) {
|
|
4558
|
+
customParam["state"] = options.state;
|
|
4559
|
+
}
|
|
4560
|
+
if (options.agentConfig) {
|
|
4561
|
+
if (!options.agentConfig.agentID || options.agentConfig.agentID.trim().length === 0) {
|
|
4562
|
+
throw new Error("agentConfig.agentID is required when agentConfig is provided.");
|
|
4563
|
+
}
|
|
4564
|
+
customParam["requested_actor"] = options.agentConfig.agentID;
|
|
4565
|
+
}
|
|
4566
|
+
if (options.additionalParams) {
|
|
4567
|
+
const conflicts = Object.keys(options.additionalParams).filter(
|
|
4568
|
+
(key) => RESERVED_AUTH_KEYS.has(key)
|
|
4569
|
+
);
|
|
4570
|
+
if (conflicts.length > 0) {
|
|
4571
|
+
throw new Error(`Reserved authorization parameters cannot be overridden: ${conflicts.sort().join(", ")}`);
|
|
4572
|
+
}
|
|
4573
|
+
Object.assign(customParam, options.additionalParams);
|
|
4574
|
+
}
|
|
4575
|
+
return customParam;
|
|
4576
|
+
}
|
|
3969
4577
|
};
|
|
3970
4578
|
var AsgardeoJavaScriptClient_default = AsgardeoJavaScriptClient;
|
|
3971
4579
|
|
|
@@ -4255,660 +4863,374 @@ var toCssVariables = (theme) => {
|
|
|
4255
4863
|
if (theme.colors?.background?.disabled) {
|
|
4256
4864
|
cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;
|
|
4257
4865
|
}
|
|
4258
|
-
if (theme.colors?.background?.body?.main) {
|
|
4259
|
-
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4260
|
-
}
|
|
4261
|
-
if (theme.colors?.error?.main) {
|
|
4262
|
-
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4263
|
-
}
|
|
4264
|
-
if (theme.colors?.error?.contrastText) {
|
|
4265
|
-
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4266
|
-
}
|
|
4267
|
-
if (theme.colors?.error?.light) {
|
|
4268
|
-
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4269
|
-
}
|
|
4270
|
-
if (theme.colors?.success?.main) {
|
|
4271
|
-
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4272
|
-
}
|
|
4273
|
-
if (theme.colors?.success?.contrastText) {
|
|
4274
|
-
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4275
|
-
}
|
|
4276
|
-
if (theme.colors?.success?.light) {
|
|
4277
|
-
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4278
|
-
}
|
|
4279
|
-
if (theme.colors?.warning?.main) {
|
|
4280
|
-
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4281
|
-
}
|
|
4282
|
-
if (theme.colors?.warning?.contrastText) {
|
|
4283
|
-
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4284
|
-
}
|
|
4285
|
-
if (theme.colors?.warning?.light) {
|
|
4286
|
-
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4287
|
-
}
|
|
4288
|
-
if (theme.colors?.info?.main) {
|
|
4289
|
-
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4290
|
-
}
|
|
4291
|
-
if (theme.colors?.info?.contrastText) {
|
|
4292
|
-
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4293
|
-
}
|
|
4294
|
-
if (theme.colors?.info?.light) {
|
|
4295
|
-
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4296
|
-
}
|
|
4297
|
-
if (theme.colors?.text?.primary) {
|
|
4298
|
-
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4299
|
-
}
|
|
4300
|
-
if (theme.colors?.text?.secondary) {
|
|
4301
|
-
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4302
|
-
}
|
|
4303
|
-
if (theme.colors?.border) {
|
|
4304
|
-
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4305
|
-
}
|
|
4306
|
-
if (theme.spacing?.unit !== void 0) {
|
|
4307
|
-
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4308
|
-
}
|
|
4309
|
-
if (theme.borderRadius?.small) {
|
|
4310
|
-
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4311
|
-
}
|
|
4312
|
-
if (theme.borderRadius?.medium) {
|
|
4313
|
-
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4314
|
-
}
|
|
4315
|
-
if (theme.borderRadius?.large) {
|
|
4316
|
-
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4317
|
-
}
|
|
4318
|
-
if (theme.shadows?.small) {
|
|
4319
|
-
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4320
|
-
}
|
|
4321
|
-
if (theme.shadows?.medium) {
|
|
4322
|
-
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4323
|
-
}
|
|
4324
|
-
if (theme.shadows?.large) {
|
|
4325
|
-
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4326
|
-
}
|
|
4327
|
-
if (theme.typography?.fontFamily) {
|
|
4328
|
-
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4329
|
-
}
|
|
4330
|
-
if (theme.typography?.fontSizes?.xs) {
|
|
4331
|
-
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4332
|
-
}
|
|
4333
|
-
if (theme.typography?.fontSizes?.sm) {
|
|
4334
|
-
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4335
|
-
}
|
|
4336
|
-
if (theme.typography?.fontSizes?.md) {
|
|
4337
|
-
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4338
|
-
}
|
|
4339
|
-
if (theme.typography?.fontSizes?.lg) {
|
|
4340
|
-
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4341
|
-
}
|
|
4342
|
-
if (theme.typography?.fontSizes?.xl) {
|
|
4343
|
-
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4344
|
-
}
|
|
4345
|
-
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4346
|
-
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4347
|
-
}
|
|
4348
|
-
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4349
|
-
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4350
|
-
}
|
|
4351
|
-
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4352
|
-
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4353
|
-
}
|
|
4354
|
-
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4355
|
-
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4356
|
-
}
|
|
4357
|
-
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4358
|
-
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4359
|
-
}
|
|
4360
|
-
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4361
|
-
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4362
|
-
}
|
|
4363
|
-
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4364
|
-
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4365
|
-
}
|
|
4366
|
-
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4367
|
-
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4368
|
-
}
|
|
4369
|
-
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4370
|
-
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4371
|
-
}
|
|
4372
|
-
if (theme.images) {
|
|
4373
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4374
|
-
const imageConfig = theme.images[imageKey];
|
|
4375
|
-
if (imageConfig?.url) {
|
|
4376
|
-
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4377
|
-
}
|
|
4378
|
-
if (imageConfig?.title) {
|
|
4379
|
-
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4380
|
-
}
|
|
4381
|
-
if (imageConfig?.alt) {
|
|
4382
|
-
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4383
|
-
}
|
|
4384
|
-
});
|
|
4385
|
-
}
|
|
4386
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4387
|
-
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4388
|
-
}
|
|
4389
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4390
|
-
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4391
|
-
}
|
|
4392
|
-
return cssVars;
|
|
4393
|
-
};
|
|
4394
|
-
var toThemeVars = (theme) => {
|
|
4395
|
-
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
4396
|
-
const componentVars = {};
|
|
4397
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4398
|
-
componentVars.Button = {
|
|
4399
|
-
root: {
|
|
4400
|
-
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4401
|
-
}
|
|
4402
|
-
};
|
|
4403
|
-
}
|
|
4404
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4405
|
-
componentVars.Field = {
|
|
4406
|
-
root: {
|
|
4407
|
-
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
4408
|
-
}
|
|
4409
|
-
};
|
|
4410
|
-
}
|
|
4411
|
-
const themeVars = {
|
|
4412
|
-
borderRadius: {
|
|
4413
|
-
large: `var(--${prefix}-border-radius-large)`,
|
|
4414
|
-
medium: `var(--${prefix}-border-radius-medium)`,
|
|
4415
|
-
small: `var(--${prefix}-border-radius-small)`
|
|
4416
|
-
},
|
|
4417
|
-
colors: {
|
|
4418
|
-
action: {
|
|
4419
|
-
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
4420
|
-
active: `var(--${prefix}-color-action-active)`,
|
|
4421
|
-
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
4422
|
-
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
4423
|
-
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
4424
|
-
focus: `var(--${prefix}-color-action-focus)`,
|
|
4425
|
-
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
4426
|
-
hover: `var(--${prefix}-color-action-hover)`,
|
|
4427
|
-
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
4428
|
-
selected: `var(--${prefix}-color-action-selected)`,
|
|
4429
|
-
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
4430
|
-
},
|
|
4431
|
-
background: {
|
|
4432
|
-
body: {
|
|
4433
|
-
main: `var(--${prefix}-color-background-body-main)`
|
|
4434
|
-
},
|
|
4435
|
-
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
4436
|
-
surface: `var(--${prefix}-color-background-surface)`
|
|
4437
|
-
},
|
|
4438
|
-
border: `var(--${prefix}-color-border)`,
|
|
4439
|
-
error: {
|
|
4440
|
-
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
4441
|
-
main: `var(--${prefix}-color-error-main)`
|
|
4442
|
-
},
|
|
4443
|
-
info: {
|
|
4444
|
-
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
4445
|
-
main: `var(--${prefix}-color-info-main)`
|
|
4446
|
-
},
|
|
4447
|
-
primary: {
|
|
4448
|
-
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
4449
|
-
main: `var(--${prefix}-color-primary-main)`
|
|
4450
|
-
},
|
|
4451
|
-
secondary: {
|
|
4452
|
-
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
4453
|
-
main: `var(--${prefix}-color-secondary-main)`
|
|
4454
|
-
},
|
|
4455
|
-
success: {
|
|
4456
|
-
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
4457
|
-
main: `var(--${prefix}-color-success-main)`
|
|
4458
|
-
},
|
|
4459
|
-
text: {
|
|
4460
|
-
primary: `var(--${prefix}-color-text-primary)`,
|
|
4461
|
-
secondary: `var(--${prefix}-color-text-secondary)`
|
|
4462
|
-
},
|
|
4463
|
-
warning: {
|
|
4464
|
-
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
4465
|
-
main: `var(--${prefix}-color-warning-main)`
|
|
4466
|
-
}
|
|
4467
|
-
},
|
|
4468
|
-
shadows: {
|
|
4469
|
-
large: `var(--${prefix}-shadow-large)`,
|
|
4470
|
-
medium: `var(--${prefix}-shadow-medium)`,
|
|
4471
|
-
small: `var(--${prefix}-shadow-small)`
|
|
4472
|
-
},
|
|
4473
|
-
spacing: {
|
|
4474
|
-
unit: `var(--${prefix}-spacing-unit)`
|
|
4475
|
-
},
|
|
4476
|
-
typography: {
|
|
4477
|
-
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
4478
|
-
fontSizes: {
|
|
4479
|
-
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
4480
|
-
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
4481
|
-
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
4482
|
-
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
4483
|
-
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
4484
|
-
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
4485
|
-
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
4486
|
-
},
|
|
4487
|
-
fontWeights: {
|
|
4488
|
-
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
4489
|
-
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
4490
|
-
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
4491
|
-
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
4492
|
-
},
|
|
4493
|
-
lineHeights: {
|
|
4494
|
-
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
4495
|
-
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
4496
|
-
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4497
|
-
}
|
|
4498
|
-
}
|
|
4499
|
-
};
|
|
4500
|
-
if (theme.images) {
|
|
4501
|
-
themeVars.images = {};
|
|
4502
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4503
|
-
const imageConfig = theme.images[imageKey];
|
|
4504
|
-
themeVars.images[imageKey] = {
|
|
4505
|
-
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
4506
|
-
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
4507
|
-
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
4508
|
-
};
|
|
4509
|
-
});
|
|
4510
|
-
}
|
|
4511
|
-
if (Object.keys(componentVars).length > 0) {
|
|
4512
|
-
themeVars.components = componentVars;
|
|
4866
|
+
if (theme.colors?.background?.body?.main) {
|
|
4867
|
+
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4513
4868
|
}
|
|
4514
|
-
|
|
4515
|
-
};
|
|
4516
|
-
var createTheme = (config = {}, isDark = false) => {
|
|
4517
|
-
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
4518
|
-
const mergedConfig = {
|
|
4519
|
-
...baseTheme,
|
|
4520
|
-
...config,
|
|
4521
|
-
borderRadius: {
|
|
4522
|
-
...baseTheme.borderRadius,
|
|
4523
|
-
...config.borderRadius
|
|
4524
|
-
},
|
|
4525
|
-
colors: {
|
|
4526
|
-
...baseTheme.colors,
|
|
4527
|
-
...config.colors,
|
|
4528
|
-
action: {
|
|
4529
|
-
...baseTheme.colors.action,
|
|
4530
|
-
...config.colors?.action || {}
|
|
4531
|
-
},
|
|
4532
|
-
secondary: {
|
|
4533
|
-
...baseTheme.colors.secondary,
|
|
4534
|
-
...config.colors?.secondary || {}
|
|
4535
|
-
}
|
|
4536
|
-
},
|
|
4537
|
-
images: {
|
|
4538
|
-
...baseTheme.images,
|
|
4539
|
-
...config.images
|
|
4540
|
-
},
|
|
4541
|
-
shadows: {
|
|
4542
|
-
...baseTheme.shadows,
|
|
4543
|
-
...config.shadows
|
|
4544
|
-
},
|
|
4545
|
-
spacing: {
|
|
4546
|
-
...baseTheme.spacing,
|
|
4547
|
-
...config.spacing
|
|
4548
|
-
},
|
|
4549
|
-
typography: {
|
|
4550
|
-
...baseTheme.typography,
|
|
4551
|
-
...config.typography,
|
|
4552
|
-
fontSizes: {
|
|
4553
|
-
...baseTheme.typography.fontSizes,
|
|
4554
|
-
...config.typography?.fontSizes || {}
|
|
4555
|
-
},
|
|
4556
|
-
fontWeights: {
|
|
4557
|
-
...baseTheme.typography.fontWeights,
|
|
4558
|
-
...config.typography?.fontWeights || {}
|
|
4559
|
-
},
|
|
4560
|
-
lineHeights: {
|
|
4561
|
-
...baseTheme.typography.lineHeights,
|
|
4562
|
-
...config.typography?.lineHeights || {}
|
|
4563
|
-
}
|
|
4564
|
-
}
|
|
4565
|
-
};
|
|
4566
|
-
return {
|
|
4567
|
-
...mergedConfig,
|
|
4568
|
-
cssVariables: toCssVariables(mergedConfig),
|
|
4569
|
-
vars: toThemeVars(mergedConfig)
|
|
4570
|
-
};
|
|
4571
|
-
};
|
|
4572
|
-
var DEFAULT_THEME = "light";
|
|
4573
|
-
var createTheme_default = createTheme;
|
|
4574
|
-
|
|
4575
|
-
// src/utils/arrayBufferToBase64url.ts
|
|
4576
|
-
var arrayBufferToBase64url = (buffer) => {
|
|
4577
|
-
const bytes = new Uint8Array(buffer);
|
|
4578
|
-
let binary = "";
|
|
4579
|
-
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
4580
|
-
binary += String.fromCharCode(bytes[i]);
|
|
4869
|
+
if (theme.colors?.error?.main) {
|
|
4870
|
+
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4581
4871
|
}
|
|
4582
|
-
|
|
4583
|
-
};
|
|
4584
|
-
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
4585
|
-
|
|
4586
|
-
// src/utils/base64urlToArrayBuffer.ts
|
|
4587
|
-
var base64urlToArrayBuffer = (base64url2) => {
|
|
4588
|
-
const padding = "=".repeat((4 - base64url2.length % 4) % 4);
|
|
4589
|
-
const base64 = base64url2.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
4590
|
-
const binaryString = atob(base64);
|
|
4591
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
4592
|
-
for (let i = 0; i < binaryString.length; i += 1) {
|
|
4593
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
4872
|
+
if (theme.colors?.error?.contrastText) {
|
|
4873
|
+
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4594
4874
|
}
|
|
4595
|
-
|
|
4596
|
-
};
|
|
4597
|
-
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
4598
|
-
|
|
4599
|
-
// src/utils/bem.ts
|
|
4600
|
-
var bem = (baseClass, element, modifier) => {
|
|
4601
|
-
let className = baseClass;
|
|
4602
|
-
if (element) {
|
|
4603
|
-
className += `__${element}`;
|
|
4875
|
+
if (theme.colors?.error?.light) {
|
|
4876
|
+
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4604
4877
|
}
|
|
4605
|
-
if (
|
|
4606
|
-
|
|
4878
|
+
if (theme.colors?.success?.main) {
|
|
4879
|
+
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4607
4880
|
}
|
|
4608
|
-
|
|
4609
|
-
};
|
|
4610
|
-
var bem_default = bem;
|
|
4611
|
-
|
|
4612
|
-
// src/utils/formatDate.ts
|
|
4613
|
-
var formatDate = (dateString) => {
|
|
4614
|
-
if (!dateString) return "-";
|
|
4615
|
-
try {
|
|
4616
|
-
return new Date(dateString).toLocaleDateString("en-US", {
|
|
4617
|
-
day: "numeric",
|
|
4618
|
-
month: "long",
|
|
4619
|
-
year: "numeric"
|
|
4620
|
-
});
|
|
4621
|
-
} catch {
|
|
4622
|
-
return dateString;
|
|
4881
|
+
if (theme.colors?.success?.contrastText) {
|
|
4882
|
+
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4623
4883
|
}
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
// src/utils/logger.ts
|
|
4628
|
-
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
4629
|
-
var DEFAULT_CONFIG = {
|
|
4630
|
-
level: "info",
|
|
4631
|
-
prefix: `${PREFIX}`,
|
|
4632
|
-
showLevel: true,
|
|
4633
|
-
timestamps: true
|
|
4634
|
-
};
|
|
4635
|
-
var isBrowser = () => (
|
|
4636
|
-
/* @ts-ignore */
|
|
4637
|
-
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
4638
|
-
);
|
|
4639
|
-
var isNode = () => (
|
|
4640
|
-
/* @ts-ignore */
|
|
4641
|
-
typeof process !== "undefined" && process.versions && process.versions.node
|
|
4642
|
-
);
|
|
4643
|
-
var COLORS = {
|
|
4644
|
-
blue: "\x1B[34m",
|
|
4645
|
-
bright: "\x1B[1m",
|
|
4646
|
-
cyan: "\x1B[36m",
|
|
4647
|
-
dim: "\x1B[2m",
|
|
4648
|
-
gray: "\x1B[90m",
|
|
4649
|
-
green: "\x1B[32m",
|
|
4650
|
-
magenta: "\x1B[35m",
|
|
4651
|
-
red: "\x1B[31m",
|
|
4652
|
-
reset: "\x1B[0m",
|
|
4653
|
-
white: "\x1B[37m",
|
|
4654
|
-
yellow: "\x1B[33m"
|
|
4655
|
-
};
|
|
4656
|
-
var BROWSER_STYLES = {
|
|
4657
|
-
debug: "color: #6b7280; font-weight: normal;",
|
|
4658
|
-
error: "color: #dc2626; font-weight: bold;",
|
|
4659
|
-
info: "color: #2563eb; font-weight: bold;",
|
|
4660
|
-
prefix: "color: #7c3aed; font-weight: bold;",
|
|
4661
|
-
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
4662
|
-
warn: "color: #d97706; font-weight: bold;"
|
|
4663
|
-
};
|
|
4664
|
-
var LOG_LEVEL_ORDER = {
|
|
4665
|
-
debug: 0,
|
|
4666
|
-
error: 3,
|
|
4667
|
-
info: 1,
|
|
4668
|
-
warn: 2
|
|
4669
|
-
};
|
|
4670
|
-
var Logger = class _Logger {
|
|
4671
|
-
constructor(config = {}) {
|
|
4672
|
-
__publicField(this, "config");
|
|
4673
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
4884
|
+
if (theme.colors?.success?.light) {
|
|
4885
|
+
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4674
4886
|
}
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4887
|
+
if (theme.colors?.warning?.main) {
|
|
4888
|
+
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4889
|
+
}
|
|
4890
|
+
if (theme.colors?.warning?.contrastText) {
|
|
4891
|
+
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4892
|
+
}
|
|
4893
|
+
if (theme.colors?.warning?.light) {
|
|
4894
|
+
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4895
|
+
}
|
|
4896
|
+
if (theme.colors?.info?.main) {
|
|
4897
|
+
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4898
|
+
}
|
|
4899
|
+
if (theme.colors?.info?.contrastText) {
|
|
4900
|
+
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4901
|
+
}
|
|
4902
|
+
if (theme.colors?.info?.light) {
|
|
4903
|
+
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4904
|
+
}
|
|
4905
|
+
if (theme.colors?.text?.primary) {
|
|
4906
|
+
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4907
|
+
}
|
|
4908
|
+
if (theme.colors?.text?.secondary) {
|
|
4909
|
+
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4910
|
+
}
|
|
4911
|
+
if (theme.colors?.border) {
|
|
4912
|
+
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4913
|
+
}
|
|
4914
|
+
if (theme.spacing?.unit !== void 0) {
|
|
4915
|
+
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4916
|
+
}
|
|
4917
|
+
if (theme.borderRadius?.small) {
|
|
4918
|
+
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4919
|
+
}
|
|
4920
|
+
if (theme.borderRadius?.medium) {
|
|
4921
|
+
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4922
|
+
}
|
|
4923
|
+
if (theme.borderRadius?.large) {
|
|
4924
|
+
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4925
|
+
}
|
|
4926
|
+
if (theme.shadows?.small) {
|
|
4927
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4928
|
+
}
|
|
4929
|
+
if (theme.shadows?.medium) {
|
|
4930
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4931
|
+
}
|
|
4932
|
+
if (theme.shadows?.large) {
|
|
4933
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4934
|
+
}
|
|
4935
|
+
if (theme.typography?.fontFamily) {
|
|
4936
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4937
|
+
}
|
|
4938
|
+
if (theme.typography?.fontSizes?.xs) {
|
|
4939
|
+
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4940
|
+
}
|
|
4941
|
+
if (theme.typography?.fontSizes?.sm) {
|
|
4942
|
+
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4943
|
+
}
|
|
4944
|
+
if (theme.typography?.fontSizes?.md) {
|
|
4945
|
+
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4946
|
+
}
|
|
4947
|
+
if (theme.typography?.fontSizes?.lg) {
|
|
4948
|
+
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4949
|
+
}
|
|
4950
|
+
if (theme.typography?.fontSizes?.xl) {
|
|
4951
|
+
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4952
|
+
}
|
|
4953
|
+
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4954
|
+
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4955
|
+
}
|
|
4956
|
+
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4957
|
+
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4958
|
+
}
|
|
4959
|
+
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4960
|
+
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4961
|
+
}
|
|
4962
|
+
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4963
|
+
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4964
|
+
}
|
|
4965
|
+
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4966
|
+
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4967
|
+
}
|
|
4968
|
+
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4969
|
+
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4680
4970
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
*/
|
|
4684
|
-
getConfig() {
|
|
4685
|
-
return { ...this.config };
|
|
4971
|
+
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4972
|
+
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4686
4973
|
}
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
*/
|
|
4690
|
-
shouldLog(level) {
|
|
4691
|
-
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
4974
|
+
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4975
|
+
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4692
4976
|
}
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
*/
|
|
4696
|
-
static getTimestamp() {
|
|
4697
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
4977
|
+
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4978
|
+
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4698
4979
|
}
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
default:
|
|
4713
|
-
return "UNKNOWN";
|
|
4714
|
-
}
|
|
4980
|
+
if (theme.images) {
|
|
4981
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
4982
|
+
const imageConfig = theme.images[imageKey];
|
|
4983
|
+
if (imageConfig?.url) {
|
|
4984
|
+
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4985
|
+
}
|
|
4986
|
+
if (imageConfig?.title) {
|
|
4987
|
+
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4988
|
+
}
|
|
4989
|
+
if (imageConfig?.alt) {
|
|
4990
|
+
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4991
|
+
}
|
|
4992
|
+
});
|
|
4715
4993
|
}
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
case "debug":
|
|
4732
|
-
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
4733
|
-
break;
|
|
4734
|
-
case "info":
|
|
4735
|
-
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
4736
|
-
break;
|
|
4737
|
-
case "warn":
|
|
4738
|
-
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
4739
|
-
break;
|
|
4740
|
-
case "error":
|
|
4741
|
-
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
4742
|
-
break;
|
|
4743
|
-
default:
|
|
4744
|
-
coloredLevel = `[${levelStr}]`;
|
|
4994
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4995
|
+
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4996
|
+
}
|
|
4997
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4998
|
+
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4999
|
+
}
|
|
5000
|
+
return cssVars;
|
|
5001
|
+
};
|
|
5002
|
+
var toThemeVars = (theme) => {
|
|
5003
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
5004
|
+
const componentVars = {};
|
|
5005
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
5006
|
+
componentVars.Button = {
|
|
5007
|
+
root: {
|
|
5008
|
+
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4745
5009
|
}
|
|
4746
|
-
|
|
4747
|
-
}
|
|
4748
|
-
parts.push(message);
|
|
4749
|
-
return parts.join(" ");
|
|
5010
|
+
};
|
|
4750
5011
|
}
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
}
|
|
4758
|
-
if (this.config.formatter) {
|
|
4759
|
-
this.config.formatter(level, message, ...args);
|
|
4760
|
-
return;
|
|
4761
|
-
}
|
|
4762
|
-
if (isBrowser()) {
|
|
4763
|
-
this.logToBrowser(level, message, ...args);
|
|
4764
|
-
} else if (isNode()) {
|
|
4765
|
-
this.logToNode(level, message, ...args);
|
|
4766
|
-
} else {
|
|
4767
|
-
console.log(message, ...args);
|
|
4768
|
-
}
|
|
5012
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
5013
|
+
componentVars.Field = {
|
|
5014
|
+
root: {
|
|
5015
|
+
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
5016
|
+
}
|
|
5017
|
+
};
|
|
4769
5018
|
}
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
5019
|
+
const themeVars = {
|
|
5020
|
+
borderRadius: {
|
|
5021
|
+
large: `var(--${prefix}-border-radius-large)`,
|
|
5022
|
+
medium: `var(--${prefix}-border-radius-medium)`,
|
|
5023
|
+
small: `var(--${prefix}-border-radius-small)`
|
|
5024
|
+
},
|
|
5025
|
+
colors: {
|
|
5026
|
+
action: {
|
|
5027
|
+
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
5028
|
+
active: `var(--${prefix}-color-action-active)`,
|
|
5029
|
+
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
5030
|
+
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
5031
|
+
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
5032
|
+
focus: `var(--${prefix}-color-action-focus)`,
|
|
5033
|
+
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
5034
|
+
hover: `var(--${prefix}-color-action-hover)`,
|
|
5035
|
+
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
5036
|
+
selected: `var(--${prefix}-color-action-selected)`,
|
|
5037
|
+
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
5038
|
+
},
|
|
5039
|
+
background: {
|
|
5040
|
+
body: {
|
|
5041
|
+
main: `var(--${prefix}-color-background-body-main)`
|
|
5042
|
+
},
|
|
5043
|
+
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
5044
|
+
surface: `var(--${prefix}-color-background-surface)`
|
|
5045
|
+
},
|
|
5046
|
+
border: `var(--${prefix}-color-border)`,
|
|
5047
|
+
error: {
|
|
5048
|
+
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
5049
|
+
main: `var(--${prefix}-color-error-main)`
|
|
5050
|
+
},
|
|
5051
|
+
info: {
|
|
5052
|
+
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
5053
|
+
main: `var(--${prefix}-color-info-main)`
|
|
5054
|
+
},
|
|
5055
|
+
primary: {
|
|
5056
|
+
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
5057
|
+
main: `var(--${prefix}-color-primary-main)`
|
|
5058
|
+
},
|
|
5059
|
+
secondary: {
|
|
5060
|
+
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
5061
|
+
main: `var(--${prefix}-color-secondary-main)`
|
|
5062
|
+
},
|
|
5063
|
+
success: {
|
|
5064
|
+
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
5065
|
+
main: `var(--${prefix}-color-success-main)`
|
|
5066
|
+
},
|
|
5067
|
+
text: {
|
|
5068
|
+
primary: `var(--${prefix}-color-text-primary)`,
|
|
5069
|
+
secondary: `var(--${prefix}-color-text-secondary)`
|
|
5070
|
+
},
|
|
5071
|
+
warning: {
|
|
5072
|
+
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
5073
|
+
main: `var(--${prefix}-color-warning-main)`
|
|
5074
|
+
}
|
|
5075
|
+
},
|
|
5076
|
+
shadows: {
|
|
5077
|
+
large: `var(--${prefix}-shadow-large)`,
|
|
5078
|
+
medium: `var(--${prefix}-shadow-medium)`,
|
|
5079
|
+
small: `var(--${prefix}-shadow-small)`
|
|
5080
|
+
},
|
|
5081
|
+
spacing: {
|
|
5082
|
+
unit: `var(--${prefix}-spacing-unit)`
|
|
5083
|
+
},
|
|
5084
|
+
typography: {
|
|
5085
|
+
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
5086
|
+
fontSizes: {
|
|
5087
|
+
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
5088
|
+
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
5089
|
+
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
5090
|
+
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
5091
|
+
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
5092
|
+
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
5093
|
+
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
5094
|
+
},
|
|
5095
|
+
fontWeights: {
|
|
5096
|
+
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
5097
|
+
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
5098
|
+
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
5099
|
+
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
5100
|
+
},
|
|
5101
|
+
lineHeights: {
|
|
5102
|
+
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
5103
|
+
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
5104
|
+
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4802
5105
|
}
|
|
4803
5106
|
}
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
console.warn(formattedMessage, ...styles, ...args);
|
|
4816
|
-
break;
|
|
4817
|
-
case "error":
|
|
4818
|
-
console.error(formattedMessage, ...styles, ...args);
|
|
4819
|
-
break;
|
|
4820
|
-
default:
|
|
4821
|
-
console.log(formattedMessage, ...styles, ...args);
|
|
4822
|
-
}
|
|
5107
|
+
};
|
|
5108
|
+
if (theme.images) {
|
|
5109
|
+
themeVars.images = {};
|
|
5110
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
5111
|
+
const imageConfig = theme.images[imageKey];
|
|
5112
|
+
themeVars.images[imageKey] = {
|
|
5113
|
+
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
5114
|
+
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
5115
|
+
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
5116
|
+
};
|
|
5117
|
+
});
|
|
4823
5118
|
}
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
*/
|
|
4827
|
-
logToNode(level, message, ...args) {
|
|
4828
|
-
const formattedMessage = this.formatForNode(level, message);
|
|
4829
|
-
switch (level) {
|
|
4830
|
-
case "debug":
|
|
4831
|
-
console.debug(formattedMessage, ...args);
|
|
4832
|
-
break;
|
|
4833
|
-
case "info":
|
|
4834
|
-
console.info(formattedMessage, ...args);
|
|
4835
|
-
break;
|
|
4836
|
-
case "warn":
|
|
4837
|
-
console.warn(formattedMessage, ...args);
|
|
4838
|
-
break;
|
|
4839
|
-
case "error":
|
|
4840
|
-
console.error(formattedMessage, ...args);
|
|
4841
|
-
break;
|
|
4842
|
-
default:
|
|
4843
|
-
console.log(formattedMessage, ...args);
|
|
4844
|
-
}
|
|
5119
|
+
if (Object.keys(componentVars).length > 0) {
|
|
5120
|
+
themeVars.components = componentVars;
|
|
4845
5121
|
}
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
5122
|
+
return themeVars;
|
|
5123
|
+
};
|
|
5124
|
+
var createTheme = (config = {}, isDark = false) => {
|
|
5125
|
+
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
5126
|
+
const mergedConfig = {
|
|
5127
|
+
...baseTheme,
|
|
5128
|
+
...config,
|
|
5129
|
+
borderRadius: {
|
|
5130
|
+
...baseTheme.borderRadius,
|
|
5131
|
+
...config.borderRadius
|
|
5132
|
+
},
|
|
5133
|
+
colors: {
|
|
5134
|
+
...baseTheme.colors,
|
|
5135
|
+
...config.colors,
|
|
5136
|
+
action: {
|
|
5137
|
+
...baseTheme.colors.action,
|
|
5138
|
+
...config.colors?.action || {}
|
|
5139
|
+
},
|
|
5140
|
+
secondary: {
|
|
5141
|
+
...baseTheme.colors.secondary,
|
|
5142
|
+
...config.colors?.secondary || {}
|
|
5143
|
+
}
|
|
5144
|
+
},
|
|
5145
|
+
images: {
|
|
5146
|
+
...baseTheme.images,
|
|
5147
|
+
...config.images
|
|
5148
|
+
},
|
|
5149
|
+
shadows: {
|
|
5150
|
+
...baseTheme.shadows,
|
|
5151
|
+
...config.shadows
|
|
5152
|
+
},
|
|
5153
|
+
spacing: {
|
|
5154
|
+
...baseTheme.spacing,
|
|
5155
|
+
...config.spacing
|
|
5156
|
+
},
|
|
5157
|
+
typography: {
|
|
5158
|
+
...baseTheme.typography,
|
|
5159
|
+
...config.typography,
|
|
5160
|
+
fontSizes: {
|
|
5161
|
+
...baseTheme.typography.fontSizes,
|
|
5162
|
+
...config.typography?.fontSizes || {}
|
|
5163
|
+
},
|
|
5164
|
+
fontWeights: {
|
|
5165
|
+
...baseTheme.typography.fontWeights,
|
|
5166
|
+
...config.typography?.fontWeights || {}
|
|
5167
|
+
},
|
|
5168
|
+
lineHeights: {
|
|
5169
|
+
...baseTheme.typography.lineHeights,
|
|
5170
|
+
...config.typography?.lineHeights || {}
|
|
5171
|
+
}
|
|
5172
|
+
}
|
|
5173
|
+
};
|
|
5174
|
+
return {
|
|
5175
|
+
...mergedConfig,
|
|
5176
|
+
cssVariables: toCssVariables(mergedConfig),
|
|
5177
|
+
vars: toThemeVars(mergedConfig)
|
|
5178
|
+
};
|
|
5179
|
+
};
|
|
5180
|
+
var DEFAULT_THEME = "light";
|
|
5181
|
+
var createTheme_default = createTheme;
|
|
5182
|
+
|
|
5183
|
+
// src/utils/arrayBufferToBase64url.ts
|
|
5184
|
+
var arrayBufferToBase64url = (buffer) => {
|
|
5185
|
+
const bytes = new Uint8Array(buffer);
|
|
5186
|
+
let binary = "";
|
|
5187
|
+
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
5188
|
+
binary += String.fromCharCode(bytes[i]);
|
|
4851
5189
|
}
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
5190
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
5191
|
+
};
|
|
5192
|
+
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
5193
|
+
|
|
5194
|
+
// src/utils/base64urlToArrayBuffer.ts
|
|
5195
|
+
var base64urlToArrayBuffer = (base64url3) => {
|
|
5196
|
+
const padding = "=".repeat((4 - base64url3.length % 4) % 4);
|
|
5197
|
+
const base64 = base64url3.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
5198
|
+
const binaryString = atob(base64);
|
|
5199
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
5200
|
+
for (let i = 0; i < binaryString.length; i += 1) {
|
|
5201
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
4857
5202
|
}
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
5203
|
+
return bytes.buffer;
|
|
5204
|
+
};
|
|
5205
|
+
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
5206
|
+
|
|
5207
|
+
// src/utils/bem.ts
|
|
5208
|
+
var bem = (baseClass, element, modifier) => {
|
|
5209
|
+
let className = baseClass;
|
|
5210
|
+
if (element) {
|
|
5211
|
+
className += `__${element}`;
|
|
4863
5212
|
}
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
*/
|
|
4867
|
-
error(message, ...args) {
|
|
4868
|
-
this.logMessage("error", message, ...args);
|
|
5213
|
+
if (modifier) {
|
|
5214
|
+
className += `--${modifier}`;
|
|
4869
5215
|
}
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
5216
|
+
return className;
|
|
5217
|
+
};
|
|
5218
|
+
var bem_default = bem;
|
|
5219
|
+
|
|
5220
|
+
// src/utils/formatDate.ts
|
|
5221
|
+
var formatDate = (dateString) => {
|
|
5222
|
+
if (!dateString) return "-";
|
|
5223
|
+
try {
|
|
5224
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
5225
|
+
day: "numeric",
|
|
5226
|
+
month: "long",
|
|
5227
|
+
year: "numeric"
|
|
4878
5228
|
});
|
|
5229
|
+
} catch {
|
|
5230
|
+
return dateString;
|
|
4879
5231
|
}
|
|
4880
|
-
/**
|
|
4881
|
-
* Set log level
|
|
4882
|
-
*/
|
|
4883
|
-
setLevel(level) {
|
|
4884
|
-
this.config.level = level;
|
|
4885
|
-
}
|
|
4886
|
-
/**
|
|
4887
|
-
* Get current log level
|
|
4888
|
-
*/
|
|
4889
|
-
getLevel() {
|
|
4890
|
-
return this.config.level;
|
|
4891
|
-
}
|
|
4892
|
-
};
|
|
4893
|
-
var logger = new Logger();
|
|
4894
|
-
var createLogger = (config) => new Logger(config);
|
|
4895
|
-
var logger_default = logger;
|
|
4896
|
-
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
4897
|
-
var info = (message, ...args) => logger.info(message, ...args);
|
|
4898
|
-
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
4899
|
-
var error = (message, ...args) => logger.error(message, ...args);
|
|
4900
|
-
var configure = (config) => logger.configure(config);
|
|
4901
|
-
var createComponentLogger = (component) => logger.child(component);
|
|
4902
|
-
var createPackageLogger = (packageName) => createLogger({
|
|
4903
|
-
level: "info",
|
|
4904
|
-
prefix: `${PREFIX} - ${packageName}`,
|
|
4905
|
-
showLevel: true,
|
|
4906
|
-
timestamps: true
|
|
4907
|
-
});
|
|
4908
|
-
var createPackageComponentLogger = (packageName, component) => {
|
|
4909
|
-
const packageLogger = createPackageLogger(packageName);
|
|
4910
|
-
return packageLogger.child(component);
|
|
4911
5232
|
};
|
|
5233
|
+
var formatDate_default = formatDate;
|
|
4912
5234
|
|
|
4913
5235
|
// src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
4914
5236
|
var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
@@ -4959,38 +5281,6 @@ var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
|
4959
5281
|
};
|
|
4960
5282
|
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
4961
5283
|
|
|
4962
|
-
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
4963
|
-
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
4964
|
-
if (!baseUrl) {
|
|
4965
|
-
throw new AsgardeoRuntimeError(
|
|
4966
|
-
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
4967
|
-
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
4968
|
-
"javascript",
|
|
4969
|
-
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
4970
|
-
);
|
|
4971
|
-
}
|
|
4972
|
-
let parsedUrl;
|
|
4973
|
-
try {
|
|
4974
|
-
parsedUrl = new URL(baseUrl);
|
|
4975
|
-
} catch (error2) {
|
|
4976
|
-
throw new AsgardeoRuntimeError(
|
|
4977
|
-
`Invalid base URL format: ${baseUrl}`,
|
|
4978
|
-
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
4979
|
-
"javascript",
|
|
4980
|
-
"The provided base URL does not conform to valid URL syntax."
|
|
4981
|
-
);
|
|
4982
|
-
}
|
|
4983
|
-
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
4984
|
-
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
4985
|
-
logger_default.warn(
|
|
4986
|
-
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
4987
|
-
);
|
|
4988
|
-
return false;
|
|
4989
|
-
}
|
|
4990
|
-
return true;
|
|
4991
|
-
};
|
|
4992
|
-
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
4993
|
-
|
|
4994
5284
|
// src/utils/flattenUserSchema.ts
|
|
4995
5285
|
var flattenUserSchema = (schemas) => {
|
|
4996
5286
|
const flattenedAttributes = [];
|
|
@@ -5176,31 +5466,6 @@ var generateFlattenedUserProfile = (meResponse, processedSchemas) => {
|
|
|
5176
5466
|
};
|
|
5177
5467
|
var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
|
|
5178
5468
|
|
|
5179
|
-
// src/utils/identifyPlatform.ts
|
|
5180
|
-
var identifyPlatform = (config) => {
|
|
5181
|
-
const { baseUrl } = config;
|
|
5182
|
-
try {
|
|
5183
|
-
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
5184
|
-
try {
|
|
5185
|
-
const url = new URL(baseUrl);
|
|
5186
|
-
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
5187
|
-
return "ASGARDEO" /* Asgardeo */;
|
|
5188
|
-
}
|
|
5189
|
-
} catch {
|
|
5190
|
-
logger_default.debug(
|
|
5191
|
-
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
5192
|
-
);
|
|
5193
|
-
}
|
|
5194
|
-
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
5195
|
-
}
|
|
5196
|
-
return "UNKNOWN" /* Unknown */;
|
|
5197
|
-
} catch (error2) {
|
|
5198
|
-
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
5199
|
-
return "UNKNOWN" /* Unknown */;
|
|
5200
|
-
}
|
|
5201
|
-
};
|
|
5202
|
-
var identifyPlatform_default = identifyPlatform;
|
|
5203
|
-
|
|
5204
5469
|
// src/utils/getRedirectBasedSignUpUrl.ts
|
|
5205
5470
|
var getRedirectBasedSignUpUrl = (config) => {
|
|
5206
5471
|
const { baseUrl } = config;
|
|
@@ -5643,7 +5908,6 @@ __publicField(_HttpClient, "DEFAULT_HANDLER_DISABLE_TIMEOUT", 1e3);
|
|
|
5643
5908
|
var HttpClient = _HttpClient;
|
|
5644
5909
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5645
5910
|
0 && (module.exports = {
|
|
5646
|
-
AgentConfig,
|
|
5647
5911
|
ApplicationNativeAuthenticationConstants,
|
|
5648
5912
|
AsgardeoAPIError,
|
|
5649
5913
|
AsgardeoAuthClient,
|