@asgardeo/javascript 0.20.1 → 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/getBrandingPreference.d.ts.map +1 -1
- package/dist/cjs/index.js +894 -856
- package/dist/cjs/index.js.map +4 -4
- package/dist/edge/index.js +894 -856
- package/dist/edge/index.js.map +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +894 -856
- 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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -952,6 +952,16 @@ var StorageManager = class _StorageManager {
|
|
|
952
952
|
};
|
|
953
953
|
var StorageManager_default = StorageManager;
|
|
954
954
|
|
|
955
|
+
// src/utils/base64Encode.ts
|
|
956
|
+
import * as jose from "jose";
|
|
957
|
+
var base64Encode = (value) => {
|
|
958
|
+
const b64url = jose.base64url.encode(new TextEncoder().encode(value));
|
|
959
|
+
const rem = b64url.length % 4;
|
|
960
|
+
const padded = rem === 0 ? b64url : b64url + "=".repeat(4 - rem);
|
|
961
|
+
return padded.replace(/-/g, "+").replace(/_/g, "/");
|
|
962
|
+
};
|
|
963
|
+
var base64Encode_default = base64Encode;
|
|
964
|
+
|
|
955
965
|
// src/utils/deepMerge.ts
|
|
956
966
|
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof Date) && !(value instanceof RegExp) && Object.prototype.toString.call(value) === "[object Object]";
|
|
957
967
|
var deepMerge = (target, ...sources) => {
|
|
@@ -1318,7 +1328,9 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1318
1328
|
}
|
|
1319
1329
|
const body = new URLSearchParams();
|
|
1320
1330
|
body.set("client_id", configData.clientId);
|
|
1321
|
-
|
|
1331
|
+
const hasSecret = Boolean(configData.clientSecret && configData.clientSecret.trim().length > 0);
|
|
1332
|
+
const tokenEndpointAuthMethod = configData.tokenRequest?.authMethod ?? (configData.platform === "AsgardeoV2" /* AsgardeoV2 */ ? "client_secret_basic" : "client_secret_post");
|
|
1333
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_post") {
|
|
1322
1334
|
body.set("client_secret", configData.clientSecret);
|
|
1323
1335
|
}
|
|
1324
1336
|
const code = authorizationCode;
|
|
@@ -1337,15 +1349,22 @@ var _AsgardeoAuthClient = class _AsgardeoAuthClient {
|
|
|
1337
1349
|
);
|
|
1338
1350
|
await this.storageManager.removeTemporaryDataParameter(extractPkceStorageKeyFromState_default(state), userId);
|
|
1339
1351
|
}
|
|
1352
|
+
const tokenRequestHeaders = {
|
|
1353
|
+
Accept: "application/json",
|
|
1354
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1355
|
+
};
|
|
1356
|
+
if (hasSecret && tokenEndpointAuthMethod === "client_secret_basic") {
|
|
1357
|
+
const credential = `${encodeURIComponent(configData.clientId)}:${encodeURIComponent(
|
|
1358
|
+
configData.clientSecret
|
|
1359
|
+
)}`;
|
|
1360
|
+
tokenRequestHeaders["Authorization"] = `Basic ${base64Encode_default(credential)}`;
|
|
1361
|
+
}
|
|
1340
1362
|
let tokenResponse;
|
|
1341
1363
|
try {
|
|
1342
1364
|
tokenResponse = await fetch(tokenEndpoint, {
|
|
1343
1365
|
body,
|
|
1344
1366
|
credentials: configData.sendCookiesInRequests ? "include" : "same-origin",
|
|
1345
|
-
headers:
|
|
1346
|
-
Accept: "application/json",
|
|
1347
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
1348
|
-
},
|
|
1367
|
+
headers: tokenRequestHeaders,
|
|
1349
1368
|
method: "POST"
|
|
1350
1369
|
});
|
|
1351
1370
|
} catch (error2) {
|
|
@@ -2957,171 +2976,533 @@ var updateMeProfile = async ({
|
|
|
2957
2976
|
};
|
|
2958
2977
|
var updateMeProfile_default = updateMeProfile;
|
|
2959
2978
|
|
|
2960
|
-
// src/
|
|
2961
|
-
var
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
+
// src/utils/logger.ts
|
|
2980
|
+
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
2981
|
+
var DEFAULT_CONFIG = {
|
|
2982
|
+
level: "info",
|
|
2983
|
+
prefix: `${PREFIX}`,
|
|
2984
|
+
showLevel: true,
|
|
2985
|
+
timestamps: true
|
|
2986
|
+
};
|
|
2987
|
+
var isBrowser = () => (
|
|
2988
|
+
/* @ts-ignore */
|
|
2989
|
+
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
2990
|
+
);
|
|
2991
|
+
var isNode = () => (
|
|
2992
|
+
/* @ts-ignore */
|
|
2993
|
+
typeof process !== "undefined" && process.versions && process.versions.node
|
|
2994
|
+
);
|
|
2995
|
+
var COLORS = {
|
|
2996
|
+
blue: "\x1B[34m",
|
|
2997
|
+
bright: "\x1B[1m",
|
|
2998
|
+
cyan: "\x1B[36m",
|
|
2999
|
+
dim: "\x1B[2m",
|
|
3000
|
+
gray: "\x1B[90m",
|
|
3001
|
+
green: "\x1B[32m",
|
|
3002
|
+
magenta: "\x1B[35m",
|
|
3003
|
+
red: "\x1B[31m",
|
|
3004
|
+
reset: "\x1B[0m",
|
|
3005
|
+
white: "\x1B[37m",
|
|
3006
|
+
yellow: "\x1B[33m"
|
|
3007
|
+
};
|
|
3008
|
+
var BROWSER_STYLES = {
|
|
3009
|
+
debug: "color: #6b7280; font-weight: normal;",
|
|
3010
|
+
error: "color: #dc2626; font-weight: bold;",
|
|
3011
|
+
info: "color: #2563eb; font-weight: bold;",
|
|
3012
|
+
prefix: "color: #7c3aed; font-weight: bold;",
|
|
3013
|
+
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
3014
|
+
warn: "color: #d97706; font-weight: bold;"
|
|
3015
|
+
};
|
|
3016
|
+
var LOG_LEVEL_ORDER = {
|
|
3017
|
+
debug: 0,
|
|
3018
|
+
error: 3,
|
|
3019
|
+
info: 1,
|
|
3020
|
+
warn: 2
|
|
3021
|
+
};
|
|
3022
|
+
var Logger = class _Logger {
|
|
3023
|
+
constructor(config = {}) {
|
|
3024
|
+
__publicField(this, "config");
|
|
3025
|
+
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
2979
3026
|
}
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
type: type || ""
|
|
2986
|
-
}).filter(([, value]) => Boolean(value))
|
|
2987
|
-
)
|
|
2988
|
-
);
|
|
2989
|
-
const fetchFn = fetcher || fetch;
|
|
2990
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2991
|
-
const requestInit = {
|
|
2992
|
-
...requestConfig,
|
|
2993
|
-
headers: {
|
|
2994
|
-
Accept: "application/json",
|
|
2995
|
-
"Content-Type": "application/json",
|
|
2996
|
-
...requestConfig.headers
|
|
2997
|
-
},
|
|
2998
|
-
method: "GET"
|
|
2999
|
-
};
|
|
3000
|
-
try {
|
|
3001
|
-
const response = await fetchFn(resolvedUrl, requestInit);
|
|
3002
|
-
if (!response?.ok) {
|
|
3003
|
-
const errorText = await response.text();
|
|
3004
|
-
throw new AsgardeoAPIError(
|
|
3005
|
-
errorText,
|
|
3006
|
-
"getBrandingPreference-ResponseError-001",
|
|
3007
|
-
"javascript",
|
|
3008
|
-
response.status,
|
|
3009
|
-
response.statusText,
|
|
3010
|
-
"Failed to get branding preference"
|
|
3011
|
-
);
|
|
3012
|
-
}
|
|
3013
|
-
const data = await response.json();
|
|
3014
|
-
return data;
|
|
3015
|
-
} catch (error2) {
|
|
3016
|
-
if (error2 instanceof AsgardeoAPIError) {
|
|
3017
|
-
throw error2;
|
|
3018
|
-
}
|
|
3019
|
-
throw new AsgardeoAPIError(
|
|
3020
|
-
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
3021
|
-
"getBrandingPreference-NetworkError-001",
|
|
3022
|
-
"javascript",
|
|
3023
|
-
0,
|
|
3024
|
-
"Network Error"
|
|
3025
|
-
);
|
|
3027
|
+
/**
|
|
3028
|
+
* Update logger configuration
|
|
3029
|
+
*/
|
|
3030
|
+
configure(config) {
|
|
3031
|
+
this.config = { ...this.config, ...config };
|
|
3026
3032
|
}
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3033
|
-
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3034
|
-
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3035
|
-
return EmbeddedSignInFlowStatus3;
|
|
3036
|
-
})(EmbeddedSignInFlowStatus || {});
|
|
3037
|
-
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3038
|
-
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3039
|
-
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3040
|
-
return EmbeddedSignInFlowType3;
|
|
3041
|
-
})(EmbeddedSignInFlowType || {});
|
|
3042
|
-
|
|
3043
|
-
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3044
|
-
var executeEmbeddedSignInFlowV2 = async ({
|
|
3045
|
-
url,
|
|
3046
|
-
baseUrl,
|
|
3047
|
-
payload,
|
|
3048
|
-
authId,
|
|
3049
|
-
...requestConfig
|
|
3050
|
-
}) => {
|
|
3051
|
-
if (!payload) {
|
|
3052
|
-
throw new AsgardeoAPIError(
|
|
3053
|
-
"Authorization payload is required",
|
|
3054
|
-
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3055
|
-
"javascript",
|
|
3056
|
-
400,
|
|
3057
|
-
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3058
|
-
);
|
|
3033
|
+
/**
|
|
3034
|
+
* Get current configuration
|
|
3035
|
+
*/
|
|
3036
|
+
getConfig() {
|
|
3037
|
+
return { ...this.config };
|
|
3059
3038
|
}
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
const response = await fetch(endpoint, {
|
|
3066
|
-
...requestConfig,
|
|
3067
|
-
body: JSON.stringify(requestPayload),
|
|
3068
|
-
headers: {
|
|
3069
|
-
Accept: "application/json",
|
|
3070
|
-
"Content-Type": "application/json",
|
|
3071
|
-
...requestConfig.headers
|
|
3072
|
-
},
|
|
3073
|
-
method: requestConfig.method || "POST"
|
|
3074
|
-
});
|
|
3075
|
-
if (!response.ok) {
|
|
3076
|
-
const errorText = await response.text();
|
|
3077
|
-
throw new AsgardeoAPIError(
|
|
3078
|
-
errorText,
|
|
3079
|
-
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3080
|
-
"javascript",
|
|
3081
|
-
response.status,
|
|
3082
|
-
response.statusText,
|
|
3083
|
-
"Authorization request failed"
|
|
3084
|
-
);
|
|
3039
|
+
/**
|
|
3040
|
+
* Check if a log level should be output
|
|
3041
|
+
*/
|
|
3042
|
+
shouldLog(level) {
|
|
3043
|
+
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
3085
3044
|
}
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3045
|
+
/**
|
|
3046
|
+
* Get timestamp string
|
|
3047
|
+
*/
|
|
3048
|
+
static getTimestamp() {
|
|
3049
|
+
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* Get log level string
|
|
3053
|
+
*/
|
|
3054
|
+
static getLevelString(level) {
|
|
3055
|
+
switch (level) {
|
|
3056
|
+
case "debug":
|
|
3057
|
+
return "DEBUG";
|
|
3058
|
+
case "info":
|
|
3059
|
+
return "INFO";
|
|
3060
|
+
case "warn":
|
|
3061
|
+
return "WARN";
|
|
3062
|
+
case "error":
|
|
3063
|
+
return "ERROR";
|
|
3064
|
+
default:
|
|
3065
|
+
return "UNKNOWN";
|
|
3066
|
+
}
|
|
3067
|
+
}
|
|
3068
|
+
/**
|
|
3069
|
+
* Format message for Node.js terminal
|
|
3070
|
+
*/
|
|
3071
|
+
formatForNode(level, message) {
|
|
3072
|
+
const parts = [];
|
|
3073
|
+
if (this.config.timestamps) {
|
|
3074
|
+
parts.push(`${COLORS.gray}[${_Logger.getTimestamp()}]${COLORS.reset}`);
|
|
3075
|
+
}
|
|
3076
|
+
if (this.config.prefix) {
|
|
3077
|
+
parts.push(`${COLORS.magenta}${this.config.prefix}${COLORS.reset}`);
|
|
3078
|
+
}
|
|
3079
|
+
if (this.config.showLevel) {
|
|
3080
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3081
|
+
let coloredLevel;
|
|
3082
|
+
switch (level) {
|
|
3083
|
+
case "debug":
|
|
3084
|
+
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
3085
|
+
break;
|
|
3086
|
+
case "info":
|
|
3087
|
+
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
3088
|
+
break;
|
|
3089
|
+
case "warn":
|
|
3090
|
+
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
3091
|
+
break;
|
|
3092
|
+
case "error":
|
|
3093
|
+
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
3094
|
+
break;
|
|
3095
|
+
default:
|
|
3096
|
+
coloredLevel = `[${levelStr}]`;
|
|
3097
|
+
}
|
|
3098
|
+
parts.push(coloredLevel);
|
|
3099
|
+
}
|
|
3100
|
+
parts.push(message);
|
|
3101
|
+
return parts.join(" ");
|
|
3102
|
+
}
|
|
3103
|
+
/**
|
|
3104
|
+
* Log message using appropriate method
|
|
3105
|
+
*/
|
|
3106
|
+
logMessage(level, message, ...args) {
|
|
3107
|
+
if (!this.shouldLog(level)) {
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
3110
|
+
if (this.config.formatter) {
|
|
3111
|
+
this.config.formatter(level, message, ...args);
|
|
3112
|
+
return;
|
|
3113
|
+
}
|
|
3114
|
+
if (isBrowser()) {
|
|
3115
|
+
this.logToBrowser(level, message, ...args);
|
|
3116
|
+
} else if (isNode()) {
|
|
3117
|
+
this.logToNode(level, message, ...args);
|
|
3118
|
+
} else {
|
|
3119
|
+
console.log(message, ...args);
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
/**
|
|
3123
|
+
* Log to browser console with styling
|
|
3124
|
+
*/
|
|
3125
|
+
logToBrowser(level, message, ...args) {
|
|
3126
|
+
const parts = [];
|
|
3127
|
+
const styles = [];
|
|
3128
|
+
if (this.config.timestamps) {
|
|
3129
|
+
parts.push(`%c[${_Logger.getTimestamp()}]`);
|
|
3130
|
+
styles.push(BROWSER_STYLES.timestamp);
|
|
3131
|
+
}
|
|
3132
|
+
if (this.config.prefix) {
|
|
3133
|
+
parts.push(`%c${this.config.prefix}`);
|
|
3134
|
+
styles.push(BROWSER_STYLES.prefix);
|
|
3135
|
+
}
|
|
3136
|
+
if (this.config.showLevel) {
|
|
3137
|
+
const levelStr = _Logger.getLevelString(level);
|
|
3138
|
+
parts.push(`%c[${levelStr}]`);
|
|
3139
|
+
switch (level) {
|
|
3140
|
+
case "debug":
|
|
3141
|
+
styles.push(BROWSER_STYLES.debug);
|
|
3142
|
+
break;
|
|
3143
|
+
case "info":
|
|
3144
|
+
styles.push(BROWSER_STYLES.info);
|
|
3145
|
+
break;
|
|
3146
|
+
case "warn":
|
|
3147
|
+
styles.push(BROWSER_STYLES.warn);
|
|
3148
|
+
break;
|
|
3149
|
+
case "error":
|
|
3150
|
+
styles.push(BROWSER_STYLES.error);
|
|
3151
|
+
break;
|
|
3152
|
+
default:
|
|
3153
|
+
styles.push("");
|
|
3154
|
+
}
|
|
3155
|
+
}
|
|
3156
|
+
parts.push(`%c${message}`);
|
|
3157
|
+
styles.push("color: inherit; font-weight: normal;");
|
|
3158
|
+
const formattedMessage = parts.join(" ");
|
|
3159
|
+
switch (level) {
|
|
3160
|
+
case "debug":
|
|
3161
|
+
console.debug(formattedMessage, ...styles, ...args);
|
|
3162
|
+
break;
|
|
3163
|
+
case "info":
|
|
3164
|
+
console.info(formattedMessage, ...styles, ...args);
|
|
3165
|
+
break;
|
|
3166
|
+
case "warn":
|
|
3167
|
+
console.warn(formattedMessage, ...styles, ...args);
|
|
3168
|
+
break;
|
|
3169
|
+
case "error":
|
|
3170
|
+
console.error(formattedMessage, ...styles, ...args);
|
|
3171
|
+
break;
|
|
3172
|
+
default:
|
|
3173
|
+
console.log(formattedMessage, ...styles, ...args);
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
/**
|
|
3177
|
+
* Log to Node.js console
|
|
3178
|
+
*/
|
|
3179
|
+
logToNode(level, message, ...args) {
|
|
3180
|
+
const formattedMessage = this.formatForNode(level, message);
|
|
3181
|
+
switch (level) {
|
|
3182
|
+
case "debug":
|
|
3183
|
+
console.debug(formattedMessage, ...args);
|
|
3184
|
+
break;
|
|
3185
|
+
case "info":
|
|
3186
|
+
console.info(formattedMessage, ...args);
|
|
3187
|
+
break;
|
|
3188
|
+
case "warn":
|
|
3189
|
+
console.warn(formattedMessage, ...args);
|
|
3190
|
+
break;
|
|
3191
|
+
case "error":
|
|
3192
|
+
console.error(formattedMessage, ...args);
|
|
3193
|
+
break;
|
|
3194
|
+
default:
|
|
3195
|
+
console.log(formattedMessage, ...args);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3198
|
+
/**
|
|
3199
|
+
* Log debug message
|
|
3200
|
+
*/
|
|
3201
|
+
debug(message, ...args) {
|
|
3202
|
+
this.logMessage("debug", message, ...args);
|
|
3203
|
+
}
|
|
3204
|
+
/**
|
|
3205
|
+
* Log info message
|
|
3206
|
+
*/
|
|
3207
|
+
info(message, ...args) {
|
|
3208
|
+
this.logMessage("info", message, ...args);
|
|
3209
|
+
}
|
|
3210
|
+
/**
|
|
3211
|
+
* Log warning message
|
|
3212
|
+
*/
|
|
3213
|
+
warn(message, ...args) {
|
|
3214
|
+
this.logMessage("warn", message, ...args);
|
|
3215
|
+
}
|
|
3216
|
+
/**
|
|
3217
|
+
* Log error message
|
|
3218
|
+
*/
|
|
3219
|
+
error(message, ...args) {
|
|
3220
|
+
this.logMessage("error", message, ...args);
|
|
3221
|
+
}
|
|
3222
|
+
/**
|
|
3223
|
+
* Create a child logger with additional prefix
|
|
3224
|
+
*/
|
|
3225
|
+
child(prefix) {
|
|
3226
|
+
const childPrefix = this.config.prefix ? `${this.config.prefix} - ${prefix}` : prefix;
|
|
3227
|
+
return new _Logger({
|
|
3228
|
+
...this.config,
|
|
3229
|
+
prefix: childPrefix
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
/**
|
|
3233
|
+
* Set log level
|
|
3234
|
+
*/
|
|
3235
|
+
setLevel(level) {
|
|
3236
|
+
this.config.level = level;
|
|
3237
|
+
}
|
|
3238
|
+
/**
|
|
3239
|
+
* Get current log level
|
|
3240
|
+
*/
|
|
3241
|
+
getLevel() {
|
|
3242
|
+
return this.config.level;
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
var logger = new Logger();
|
|
3246
|
+
var createLogger = (config) => new Logger(config);
|
|
3247
|
+
var logger_default = logger;
|
|
3248
|
+
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
3249
|
+
var info = (message, ...args) => logger.info(message, ...args);
|
|
3250
|
+
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
3251
|
+
var error = (message, ...args) => logger.error(message, ...args);
|
|
3252
|
+
var configure = (config) => logger.configure(config);
|
|
3253
|
+
var createComponentLogger = (component) => logger.child(component);
|
|
3254
|
+
var createPackageLogger = (packageName) => createLogger({
|
|
3255
|
+
level: "info",
|
|
3256
|
+
prefix: `${PREFIX} - ${packageName}`,
|
|
3257
|
+
showLevel: true,
|
|
3258
|
+
timestamps: true
|
|
3259
|
+
});
|
|
3260
|
+
var createPackageComponentLogger = (packageName, component) => {
|
|
3261
|
+
const packageLogger = createPackageLogger(packageName);
|
|
3262
|
+
return packageLogger.child(component);
|
|
3263
|
+
};
|
|
3264
|
+
|
|
3265
|
+
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
3266
|
+
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
3267
|
+
if (!baseUrl) {
|
|
3268
|
+
throw new AsgardeoRuntimeError(
|
|
3269
|
+
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
3270
|
+
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
3271
|
+
"javascript",
|
|
3272
|
+
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
3273
|
+
);
|
|
3274
|
+
}
|
|
3275
|
+
let parsedUrl;
|
|
3276
|
+
try {
|
|
3277
|
+
parsedUrl = new URL(baseUrl);
|
|
3278
|
+
} catch (error2) {
|
|
3279
|
+
throw new AsgardeoRuntimeError(
|
|
3280
|
+
`Invalid base URL format: ${baseUrl}`,
|
|
3281
|
+
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
3282
|
+
"javascript",
|
|
3283
|
+
"The provided base URL does not conform to valid URL syntax."
|
|
3284
|
+
);
|
|
3285
|
+
}
|
|
3286
|
+
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
3287
|
+
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
3288
|
+
logger_default.warn(
|
|
3289
|
+
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
3290
|
+
);
|
|
3291
|
+
return false;
|
|
3292
|
+
}
|
|
3293
|
+
return true;
|
|
3294
|
+
};
|
|
3295
|
+
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
3296
|
+
|
|
3297
|
+
// src/utils/identifyPlatform.ts
|
|
3298
|
+
var identifyPlatform = (config) => {
|
|
3299
|
+
const { baseUrl } = config;
|
|
3300
|
+
try {
|
|
3301
|
+
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
3302
|
+
try {
|
|
3303
|
+
const url = new URL(baseUrl);
|
|
3304
|
+
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
3305
|
+
return "ASGARDEO" /* Asgardeo */;
|
|
3306
|
+
}
|
|
3307
|
+
} catch {
|
|
3308
|
+
logger_default.debug(
|
|
3309
|
+
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
3310
|
+
);
|
|
3311
|
+
}
|
|
3312
|
+
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
3313
|
+
}
|
|
3314
|
+
return "UNKNOWN" /* Unknown */;
|
|
3315
|
+
} catch (error2) {
|
|
3316
|
+
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
3317
|
+
return "UNKNOWN" /* Unknown */;
|
|
3318
|
+
}
|
|
3319
|
+
};
|
|
3320
|
+
var identifyPlatform_default = identifyPlatform;
|
|
3321
|
+
|
|
3322
|
+
// src/api/getBrandingPreference.ts
|
|
3323
|
+
var getBrandingPreference = async ({
|
|
3324
|
+
baseUrl,
|
|
3325
|
+
locale,
|
|
3326
|
+
name,
|
|
3327
|
+
type,
|
|
3328
|
+
fetcher,
|
|
3329
|
+
...requestConfig
|
|
3330
|
+
}) => {
|
|
3331
|
+
try {
|
|
3332
|
+
new URL(baseUrl);
|
|
3333
|
+
} catch (error2) {
|
|
3334
|
+
throw new AsgardeoAPIError(
|
|
3335
|
+
`Invalid base URL provided. ${error2?.toString()}`,
|
|
3336
|
+
"getBrandingPreference-ValidationError-001",
|
|
3337
|
+
"javascript",
|
|
3338
|
+
400,
|
|
3339
|
+
"The provided `baseUrl` does not adhere to the URL schema."
|
|
3340
|
+
);
|
|
3341
|
+
}
|
|
3342
|
+
const queryParams = new URLSearchParams(
|
|
3343
|
+
Object.fromEntries(
|
|
3344
|
+
Object.entries({
|
|
3345
|
+
locale: locale || "",
|
|
3346
|
+
name: name || "",
|
|
3347
|
+
type: type || ""
|
|
3348
|
+
}).filter(([, value]) => Boolean(value))
|
|
3349
|
+
)
|
|
3350
|
+
);
|
|
3351
|
+
const fetchFn = fetcher || fetch;
|
|
3352
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
3353
|
+
const requestInit = {
|
|
3354
|
+
...requestConfig,
|
|
3355
|
+
headers: {
|
|
3356
|
+
Accept: "application/json",
|
|
3357
|
+
"Content-Type": "application/json",
|
|
3358
|
+
...requestConfig.headers
|
|
3359
|
+
},
|
|
3360
|
+
method: "GET"
|
|
3361
|
+
};
|
|
3362
|
+
try {
|
|
3363
|
+
const response = await fetchFn(resolvedUrl, requestInit);
|
|
3364
|
+
if (!response?.ok) {
|
|
3365
|
+
const errorText = await response.text();
|
|
3366
|
+
const platform = identifyPlatform_default({ baseUrl });
|
|
3367
|
+
let errorDescription;
|
|
3368
|
+
try {
|
|
3369
|
+
const errorBody = JSON.parse(errorText);
|
|
3370
|
+
errorDescription = errorBody?.description || errorBody?.message || errorText;
|
|
3371
|
+
} catch {
|
|
3372
|
+
errorDescription = errorText;
|
|
3373
|
+
}
|
|
3374
|
+
let platformConsoleGuidance;
|
|
3375
|
+
if (platform === "ASGARDEO" /* Asgardeo */) {
|
|
3376
|
+
platformConsoleGuidance = "configure branding preferences in the Asgardeo console";
|
|
3377
|
+
} else if (platform === "IDENTITY_SERVER" /* IdentityServer */) {
|
|
3378
|
+
platformConsoleGuidance = "configure branding preferences in the WSO2 Identity Server console";
|
|
3379
|
+
} else {
|
|
3380
|
+
platformConsoleGuidance = "configure branding preferences in the platform console";
|
|
3381
|
+
}
|
|
3382
|
+
logger_default.warn(
|
|
3383
|
+
`[BrandingError] ${errorDescription} To resolve this issue, please ${platformConsoleGuidance}. If you want to suppress this warning and stop fetching branding preferences, set \`<AsgardeoProvider>\` -> \`preferences\` -> \`theme\` -> \`inheritFromBranding\` to false.`
|
|
3384
|
+
);
|
|
3385
|
+
throw new AsgardeoAPIError(
|
|
3386
|
+
errorText,
|
|
3387
|
+
"getBrandingPreference-ResponseError-001",
|
|
3388
|
+
"javascript",
|
|
3389
|
+
response.status,
|
|
3390
|
+
response.statusText,
|
|
3391
|
+
"Failed to get branding preference"
|
|
3392
|
+
);
|
|
3393
|
+
}
|
|
3394
|
+
const data = await response.json();
|
|
3395
|
+
return data;
|
|
3396
|
+
} catch (error2) {
|
|
3397
|
+
if (error2 instanceof AsgardeoAPIError) {
|
|
3398
|
+
throw error2;
|
|
3399
|
+
}
|
|
3400
|
+
throw new AsgardeoAPIError(
|
|
3401
|
+
`Network or parsing error: ${error2 instanceof Error ? error2.message : "Unknown error"}`,
|
|
3402
|
+
"getBrandingPreference-NetworkError-001",
|
|
3403
|
+
"javascript",
|
|
3404
|
+
0,
|
|
3405
|
+
"Network Error"
|
|
3406
|
+
);
|
|
3407
|
+
}
|
|
3408
|
+
};
|
|
3409
|
+
var getBrandingPreference_default = getBrandingPreference;
|
|
3410
|
+
|
|
3411
|
+
// src/models/v2/embedded-signin-flow-v2.ts
|
|
3412
|
+
var EmbeddedSignInFlowStatus = /* @__PURE__ */ ((EmbeddedSignInFlowStatus3) => {
|
|
3413
|
+
EmbeddedSignInFlowStatus3["Complete"] = "COMPLETE";
|
|
3414
|
+
EmbeddedSignInFlowStatus3["Error"] = "ERROR";
|
|
3415
|
+
EmbeddedSignInFlowStatus3["Incomplete"] = "INCOMPLETE";
|
|
3416
|
+
return EmbeddedSignInFlowStatus3;
|
|
3417
|
+
})(EmbeddedSignInFlowStatus || {});
|
|
3418
|
+
var EmbeddedSignInFlowType = /* @__PURE__ */ ((EmbeddedSignInFlowType3) => {
|
|
3419
|
+
EmbeddedSignInFlowType3["Redirection"] = "REDIRECTION";
|
|
3420
|
+
EmbeddedSignInFlowType3["View"] = "VIEW";
|
|
3421
|
+
return EmbeddedSignInFlowType3;
|
|
3422
|
+
})(EmbeddedSignInFlowType || {});
|
|
3423
|
+
|
|
3424
|
+
// src/api/v2/executeEmbeddedSignInFlowV2.ts
|
|
3425
|
+
var executeEmbeddedSignInFlowV2 = async ({
|
|
3426
|
+
url,
|
|
3427
|
+
baseUrl,
|
|
3428
|
+
payload,
|
|
3429
|
+
authId,
|
|
3430
|
+
...requestConfig
|
|
3431
|
+
}) => {
|
|
3432
|
+
if (!payload) {
|
|
3433
|
+
throw new AsgardeoAPIError(
|
|
3434
|
+
"Authorization payload is required",
|
|
3435
|
+
"executeEmbeddedSignInFlow-ValidationError-002",
|
|
3436
|
+
"javascript",
|
|
3437
|
+
400,
|
|
3438
|
+
"If an authorization payload is not provided, the request cannot be constructed correctly."
|
|
3439
|
+
);
|
|
3440
|
+
}
|
|
3441
|
+
const endpoint = url ?? `${baseUrl}/flow/execute`;
|
|
3442
|
+
const cleanPayload = typeof payload === "object" && payload !== null ? Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "verbose")) : payload;
|
|
3443
|
+
const hasOnlyAppIdAndFlowType = typeof cleanPayload === "object" && cleanPayload !== null && "applicationId" in cleanPayload && "flowType" in cleanPayload && Object.keys(cleanPayload).length === 2;
|
|
3444
|
+
const hasOnlyFlowId = typeof cleanPayload === "object" && cleanPayload !== null && "executionId" in cleanPayload && Object.keys(cleanPayload).length === 1;
|
|
3445
|
+
const requestPayload = hasOnlyAppIdAndFlowType || hasOnlyFlowId ? { ...cleanPayload, verbose: true } : cleanPayload;
|
|
3446
|
+
const response = await fetch(endpoint, {
|
|
3447
|
+
...requestConfig,
|
|
3448
|
+
body: JSON.stringify(requestPayload),
|
|
3449
|
+
headers: {
|
|
3450
|
+
Accept: "application/json",
|
|
3451
|
+
"Content-Type": "application/json",
|
|
3452
|
+
...requestConfig.headers
|
|
3453
|
+
},
|
|
3454
|
+
method: requestConfig.method || "POST"
|
|
3455
|
+
});
|
|
3456
|
+
if (!response.ok) {
|
|
3457
|
+
const errorText = await response.text();
|
|
3458
|
+
throw new AsgardeoAPIError(
|
|
3459
|
+
errorText,
|
|
3460
|
+
"executeEmbeddedSignInFlow-ResponseError-001",
|
|
3461
|
+
"javascript",
|
|
3462
|
+
response.status,
|
|
3463
|
+
response.statusText,
|
|
3464
|
+
"Authorization request failed"
|
|
3465
|
+
);
|
|
3466
|
+
}
|
|
3467
|
+
const flowResponse = await response.json();
|
|
3468
|
+
if (flowResponse.flowStatus === "COMPLETE" /* Complete */ && flowResponse.assertion && authId) {
|
|
3469
|
+
try {
|
|
3470
|
+
const oauth2Response = await fetch(`${baseUrl}/oauth2/auth/callback`, {
|
|
3471
|
+
body: JSON.stringify({
|
|
3472
|
+
assertion: flowResponse.assertion,
|
|
3473
|
+
authId
|
|
3474
|
+
}),
|
|
3475
|
+
credentials: "include",
|
|
3476
|
+
headers: {
|
|
3477
|
+
Accept: "application/json",
|
|
3478
|
+
"Content-Type": "application/json",
|
|
3479
|
+
...requestConfig.headers
|
|
3480
|
+
},
|
|
3481
|
+
method: "POST"
|
|
3482
|
+
});
|
|
3483
|
+
if (!oauth2Response.ok) {
|
|
3484
|
+
const oauth2ErrorText = await oauth2Response.text();
|
|
3485
|
+
throw new AsgardeoAPIError(
|
|
3486
|
+
`OAuth2 authorization failed: ${oauth2ErrorText}`,
|
|
3487
|
+
"executeEmbeddedSignInFlow-OAuth2Error-002",
|
|
3488
|
+
"javascript",
|
|
3489
|
+
oauth2Response.status,
|
|
3490
|
+
oauth2Response.statusText
|
|
3491
|
+
);
|
|
3492
|
+
}
|
|
3493
|
+
const oauth2Result = await oauth2Response.json();
|
|
3494
|
+
return {
|
|
3495
|
+
flowStatus: flowResponse.flowStatus,
|
|
3496
|
+
redirectUrl: oauth2Result["redirect_uri"]
|
|
3497
|
+
};
|
|
3498
|
+
} catch (authError) {
|
|
3499
|
+
throw new AsgardeoAPIError(
|
|
3500
|
+
`OAuth2 authorization failed: ${authError instanceof Error ? authError.message : "Unknown error"}`,
|
|
3501
|
+
"executeEmbeddedSignInFlow-OAuth2Error-001",
|
|
3502
|
+
"javascript",
|
|
3503
|
+
500,
|
|
3504
|
+
"Failed to complete OAuth2 authorization after successful embedded sign-in flow."
|
|
3505
|
+
);
|
|
3125
3506
|
}
|
|
3126
3507
|
}
|
|
3127
3508
|
return flowResponse;
|
|
@@ -3639,16 +4020,16 @@ var DefaultCacheStore = class {
|
|
|
3639
4020
|
};
|
|
3640
4021
|
|
|
3641
4022
|
// src/DefaultCrypto.ts
|
|
3642
|
-
import * as
|
|
4023
|
+
import * as jose2 from "jose";
|
|
3643
4024
|
var DefaultCrypto = class {
|
|
3644
4025
|
// eslint-disable-next-line class-methods-use-this
|
|
3645
4026
|
base64URLDecode(value) {
|
|
3646
|
-
const decodedArray =
|
|
4027
|
+
const decodedArray = jose2.base64url.decode(value);
|
|
3647
4028
|
return new TextDecoder().decode(decodedArray);
|
|
3648
4029
|
}
|
|
3649
4030
|
// eslint-disable-next-line class-methods-use-this
|
|
3650
4031
|
base64URLEncode(value) {
|
|
3651
|
-
return
|
|
4032
|
+
return jose2.base64url.encode(value);
|
|
3652
4033
|
}
|
|
3653
4034
|
// eslint-disable-next-line class-methods-use-this
|
|
3654
4035
|
generateRandomBytes(length) {
|
|
@@ -3663,8 +4044,8 @@ var DefaultCrypto = class {
|
|
|
3663
4044
|
}
|
|
3664
4045
|
// eslint-disable-next-line class-methods-use-this
|
|
3665
4046
|
async verifyJwt(idToken, jwk, algorithms, clientId, issuer, subject, clockTolerance, validateJwtIssuer = true) {
|
|
3666
|
-
const key = await
|
|
3667
|
-
await
|
|
4047
|
+
const key = await jose2.importJWK(jwk);
|
|
4048
|
+
await jose2.jwtVerify(idToken, key, {
|
|
3668
4049
|
algorithms,
|
|
3669
4050
|
audience: [clientId],
|
|
3670
4051
|
clockTolerance,
|
|
@@ -4119,660 +4500,374 @@ var toCssVariables = (theme) => {
|
|
|
4119
4500
|
if (theme.colors?.background?.disabled) {
|
|
4120
4501
|
cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;
|
|
4121
4502
|
}
|
|
4122
|
-
if (theme.colors?.background?.body?.main) {
|
|
4123
|
-
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4124
|
-
}
|
|
4125
|
-
if (theme.colors?.error?.main) {
|
|
4126
|
-
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4127
|
-
}
|
|
4128
|
-
if (theme.colors?.error?.contrastText) {
|
|
4129
|
-
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4130
|
-
}
|
|
4131
|
-
if (theme.colors?.error?.light) {
|
|
4132
|
-
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4133
|
-
}
|
|
4134
|
-
if (theme.colors?.success?.main) {
|
|
4135
|
-
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4136
|
-
}
|
|
4137
|
-
if (theme.colors?.success?.contrastText) {
|
|
4138
|
-
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4139
|
-
}
|
|
4140
|
-
if (theme.colors?.success?.light) {
|
|
4141
|
-
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4142
|
-
}
|
|
4143
|
-
if (theme.colors?.warning?.main) {
|
|
4144
|
-
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4145
|
-
}
|
|
4146
|
-
if (theme.colors?.warning?.contrastText) {
|
|
4147
|
-
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4148
|
-
}
|
|
4149
|
-
if (theme.colors?.warning?.light) {
|
|
4150
|
-
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4151
|
-
}
|
|
4152
|
-
if (theme.colors?.info?.main) {
|
|
4153
|
-
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4154
|
-
}
|
|
4155
|
-
if (theme.colors?.info?.contrastText) {
|
|
4156
|
-
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4157
|
-
}
|
|
4158
|
-
if (theme.colors?.info?.light) {
|
|
4159
|
-
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4160
|
-
}
|
|
4161
|
-
if (theme.colors?.text?.primary) {
|
|
4162
|
-
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4163
|
-
}
|
|
4164
|
-
if (theme.colors?.text?.secondary) {
|
|
4165
|
-
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4166
|
-
}
|
|
4167
|
-
if (theme.colors?.border) {
|
|
4168
|
-
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4169
|
-
}
|
|
4170
|
-
if (theme.spacing?.unit !== void 0) {
|
|
4171
|
-
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4172
|
-
}
|
|
4173
|
-
if (theme.borderRadius?.small) {
|
|
4174
|
-
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4175
|
-
}
|
|
4176
|
-
if (theme.borderRadius?.medium) {
|
|
4177
|
-
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4178
|
-
}
|
|
4179
|
-
if (theme.borderRadius?.large) {
|
|
4180
|
-
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4181
|
-
}
|
|
4182
|
-
if (theme.shadows?.small) {
|
|
4183
|
-
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4184
|
-
}
|
|
4185
|
-
if (theme.shadows?.medium) {
|
|
4186
|
-
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4187
|
-
}
|
|
4188
|
-
if (theme.shadows?.large) {
|
|
4189
|
-
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4190
|
-
}
|
|
4191
|
-
if (theme.typography?.fontFamily) {
|
|
4192
|
-
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4193
|
-
}
|
|
4194
|
-
if (theme.typography?.fontSizes?.xs) {
|
|
4195
|
-
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4196
|
-
}
|
|
4197
|
-
if (theme.typography?.fontSizes?.sm) {
|
|
4198
|
-
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4199
|
-
}
|
|
4200
|
-
if (theme.typography?.fontSizes?.md) {
|
|
4201
|
-
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4202
|
-
}
|
|
4203
|
-
if (theme.typography?.fontSizes?.lg) {
|
|
4204
|
-
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4205
|
-
}
|
|
4206
|
-
if (theme.typography?.fontSizes?.xl) {
|
|
4207
|
-
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4208
|
-
}
|
|
4209
|
-
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4210
|
-
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4211
|
-
}
|
|
4212
|
-
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4213
|
-
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4214
|
-
}
|
|
4215
|
-
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4216
|
-
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4217
|
-
}
|
|
4218
|
-
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4219
|
-
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4220
|
-
}
|
|
4221
|
-
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4222
|
-
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4223
|
-
}
|
|
4224
|
-
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4225
|
-
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4226
|
-
}
|
|
4227
|
-
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4228
|
-
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4229
|
-
}
|
|
4230
|
-
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4231
|
-
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4232
|
-
}
|
|
4233
|
-
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4234
|
-
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4235
|
-
}
|
|
4236
|
-
if (theme.images) {
|
|
4237
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4238
|
-
const imageConfig = theme.images[imageKey];
|
|
4239
|
-
if (imageConfig?.url) {
|
|
4240
|
-
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4241
|
-
}
|
|
4242
|
-
if (imageConfig?.title) {
|
|
4243
|
-
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4244
|
-
}
|
|
4245
|
-
if (imageConfig?.alt) {
|
|
4246
|
-
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4247
|
-
}
|
|
4248
|
-
});
|
|
4249
|
-
}
|
|
4250
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4251
|
-
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4252
|
-
}
|
|
4253
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4254
|
-
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4255
|
-
}
|
|
4256
|
-
return cssVars;
|
|
4257
|
-
};
|
|
4258
|
-
var toThemeVars = (theme) => {
|
|
4259
|
-
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
4260
|
-
const componentVars = {};
|
|
4261
|
-
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4262
|
-
componentVars.Button = {
|
|
4263
|
-
root: {
|
|
4264
|
-
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4265
|
-
}
|
|
4266
|
-
};
|
|
4267
|
-
}
|
|
4268
|
-
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4269
|
-
componentVars.Field = {
|
|
4270
|
-
root: {
|
|
4271
|
-
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
4272
|
-
}
|
|
4273
|
-
};
|
|
4274
|
-
}
|
|
4275
|
-
const themeVars = {
|
|
4276
|
-
borderRadius: {
|
|
4277
|
-
large: `var(--${prefix}-border-radius-large)`,
|
|
4278
|
-
medium: `var(--${prefix}-border-radius-medium)`,
|
|
4279
|
-
small: `var(--${prefix}-border-radius-small)`
|
|
4280
|
-
},
|
|
4281
|
-
colors: {
|
|
4282
|
-
action: {
|
|
4283
|
-
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
4284
|
-
active: `var(--${prefix}-color-action-active)`,
|
|
4285
|
-
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
4286
|
-
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
4287
|
-
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
4288
|
-
focus: `var(--${prefix}-color-action-focus)`,
|
|
4289
|
-
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
4290
|
-
hover: `var(--${prefix}-color-action-hover)`,
|
|
4291
|
-
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
4292
|
-
selected: `var(--${prefix}-color-action-selected)`,
|
|
4293
|
-
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
4294
|
-
},
|
|
4295
|
-
background: {
|
|
4296
|
-
body: {
|
|
4297
|
-
main: `var(--${prefix}-color-background-body-main)`
|
|
4298
|
-
},
|
|
4299
|
-
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
4300
|
-
surface: `var(--${prefix}-color-background-surface)`
|
|
4301
|
-
},
|
|
4302
|
-
border: `var(--${prefix}-color-border)`,
|
|
4303
|
-
error: {
|
|
4304
|
-
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
4305
|
-
main: `var(--${prefix}-color-error-main)`
|
|
4306
|
-
},
|
|
4307
|
-
info: {
|
|
4308
|
-
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
4309
|
-
main: `var(--${prefix}-color-info-main)`
|
|
4310
|
-
},
|
|
4311
|
-
primary: {
|
|
4312
|
-
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
4313
|
-
main: `var(--${prefix}-color-primary-main)`
|
|
4314
|
-
},
|
|
4315
|
-
secondary: {
|
|
4316
|
-
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
4317
|
-
main: `var(--${prefix}-color-secondary-main)`
|
|
4318
|
-
},
|
|
4319
|
-
success: {
|
|
4320
|
-
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
4321
|
-
main: `var(--${prefix}-color-success-main)`
|
|
4322
|
-
},
|
|
4323
|
-
text: {
|
|
4324
|
-
primary: `var(--${prefix}-color-text-primary)`,
|
|
4325
|
-
secondary: `var(--${prefix}-color-text-secondary)`
|
|
4326
|
-
},
|
|
4327
|
-
warning: {
|
|
4328
|
-
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
4329
|
-
main: `var(--${prefix}-color-warning-main)`
|
|
4330
|
-
}
|
|
4331
|
-
},
|
|
4332
|
-
shadows: {
|
|
4333
|
-
large: `var(--${prefix}-shadow-large)`,
|
|
4334
|
-
medium: `var(--${prefix}-shadow-medium)`,
|
|
4335
|
-
small: `var(--${prefix}-shadow-small)`
|
|
4336
|
-
},
|
|
4337
|
-
spacing: {
|
|
4338
|
-
unit: `var(--${prefix}-spacing-unit)`
|
|
4339
|
-
},
|
|
4340
|
-
typography: {
|
|
4341
|
-
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
4342
|
-
fontSizes: {
|
|
4343
|
-
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
4344
|
-
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
4345
|
-
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
4346
|
-
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
4347
|
-
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
4348
|
-
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
4349
|
-
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
4350
|
-
},
|
|
4351
|
-
fontWeights: {
|
|
4352
|
-
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
4353
|
-
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
4354
|
-
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
4355
|
-
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
4356
|
-
},
|
|
4357
|
-
lineHeights: {
|
|
4358
|
-
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
4359
|
-
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
4360
|
-
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4361
|
-
}
|
|
4362
|
-
}
|
|
4363
|
-
};
|
|
4364
|
-
if (theme.images) {
|
|
4365
|
-
themeVars.images = {};
|
|
4366
|
-
Object.keys(theme.images).forEach((imageKey) => {
|
|
4367
|
-
const imageConfig = theme.images[imageKey];
|
|
4368
|
-
themeVars.images[imageKey] = {
|
|
4369
|
-
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
4370
|
-
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
4371
|
-
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
4372
|
-
};
|
|
4373
|
-
});
|
|
4374
|
-
}
|
|
4375
|
-
if (Object.keys(componentVars).length > 0) {
|
|
4376
|
-
themeVars.components = componentVars;
|
|
4503
|
+
if (theme.colors?.background?.body?.main) {
|
|
4504
|
+
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
4377
4505
|
}
|
|
4378
|
-
|
|
4379
|
-
};
|
|
4380
|
-
var createTheme = (config = {}, isDark = false) => {
|
|
4381
|
-
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
4382
|
-
const mergedConfig = {
|
|
4383
|
-
...baseTheme,
|
|
4384
|
-
...config,
|
|
4385
|
-
borderRadius: {
|
|
4386
|
-
...baseTheme.borderRadius,
|
|
4387
|
-
...config.borderRadius
|
|
4388
|
-
},
|
|
4389
|
-
colors: {
|
|
4390
|
-
...baseTheme.colors,
|
|
4391
|
-
...config.colors,
|
|
4392
|
-
action: {
|
|
4393
|
-
...baseTheme.colors.action,
|
|
4394
|
-
...config.colors?.action || {}
|
|
4395
|
-
},
|
|
4396
|
-
secondary: {
|
|
4397
|
-
...baseTheme.colors.secondary,
|
|
4398
|
-
...config.colors?.secondary || {}
|
|
4399
|
-
}
|
|
4400
|
-
},
|
|
4401
|
-
images: {
|
|
4402
|
-
...baseTheme.images,
|
|
4403
|
-
...config.images
|
|
4404
|
-
},
|
|
4405
|
-
shadows: {
|
|
4406
|
-
...baseTheme.shadows,
|
|
4407
|
-
...config.shadows
|
|
4408
|
-
},
|
|
4409
|
-
spacing: {
|
|
4410
|
-
...baseTheme.spacing,
|
|
4411
|
-
...config.spacing
|
|
4412
|
-
},
|
|
4413
|
-
typography: {
|
|
4414
|
-
...baseTheme.typography,
|
|
4415
|
-
...config.typography,
|
|
4416
|
-
fontSizes: {
|
|
4417
|
-
...baseTheme.typography.fontSizes,
|
|
4418
|
-
...config.typography?.fontSizes || {}
|
|
4419
|
-
},
|
|
4420
|
-
fontWeights: {
|
|
4421
|
-
...baseTheme.typography.fontWeights,
|
|
4422
|
-
...config.typography?.fontWeights || {}
|
|
4423
|
-
},
|
|
4424
|
-
lineHeights: {
|
|
4425
|
-
...baseTheme.typography.lineHeights,
|
|
4426
|
-
...config.typography?.lineHeights || {}
|
|
4427
|
-
}
|
|
4428
|
-
}
|
|
4429
|
-
};
|
|
4430
|
-
return {
|
|
4431
|
-
...mergedConfig,
|
|
4432
|
-
cssVariables: toCssVariables(mergedConfig),
|
|
4433
|
-
vars: toThemeVars(mergedConfig)
|
|
4434
|
-
};
|
|
4435
|
-
};
|
|
4436
|
-
var DEFAULT_THEME = "light";
|
|
4437
|
-
var createTheme_default = createTheme;
|
|
4438
|
-
|
|
4439
|
-
// src/utils/arrayBufferToBase64url.ts
|
|
4440
|
-
var arrayBufferToBase64url = (buffer) => {
|
|
4441
|
-
const bytes = new Uint8Array(buffer);
|
|
4442
|
-
let binary = "";
|
|
4443
|
-
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
4444
|
-
binary += String.fromCharCode(bytes[i]);
|
|
4506
|
+
if (theme.colors?.error?.main) {
|
|
4507
|
+
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
4445
4508
|
}
|
|
4446
|
-
|
|
4447
|
-
};
|
|
4448
|
-
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
4449
|
-
|
|
4450
|
-
// src/utils/base64urlToArrayBuffer.ts
|
|
4451
|
-
var base64urlToArrayBuffer = (base64url2) => {
|
|
4452
|
-
const padding = "=".repeat((4 - base64url2.length % 4) % 4);
|
|
4453
|
-
const base64 = base64url2.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
4454
|
-
const binaryString = atob(base64);
|
|
4455
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
4456
|
-
for (let i = 0; i < binaryString.length; i += 1) {
|
|
4457
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
4509
|
+
if (theme.colors?.error?.contrastText) {
|
|
4510
|
+
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
4458
4511
|
}
|
|
4459
|
-
|
|
4460
|
-
};
|
|
4461
|
-
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
4462
|
-
|
|
4463
|
-
// src/utils/bem.ts
|
|
4464
|
-
var bem = (baseClass, element, modifier) => {
|
|
4465
|
-
let className = baseClass;
|
|
4466
|
-
if (element) {
|
|
4467
|
-
className += `__${element}`;
|
|
4512
|
+
if (theme.colors?.error?.light) {
|
|
4513
|
+
cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
|
|
4468
4514
|
}
|
|
4469
|
-
if (
|
|
4470
|
-
|
|
4515
|
+
if (theme.colors?.success?.main) {
|
|
4516
|
+
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
4471
4517
|
}
|
|
4472
|
-
|
|
4473
|
-
};
|
|
4474
|
-
var bem_default = bem;
|
|
4475
|
-
|
|
4476
|
-
// src/utils/formatDate.ts
|
|
4477
|
-
var formatDate = (dateString) => {
|
|
4478
|
-
if (!dateString) return "-";
|
|
4479
|
-
try {
|
|
4480
|
-
return new Date(dateString).toLocaleDateString("en-US", {
|
|
4481
|
-
day: "numeric",
|
|
4482
|
-
month: "long",
|
|
4483
|
-
year: "numeric"
|
|
4484
|
-
});
|
|
4485
|
-
} catch {
|
|
4486
|
-
return dateString;
|
|
4518
|
+
if (theme.colors?.success?.contrastText) {
|
|
4519
|
+
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
4487
4520
|
}
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
// src/utils/logger.ts
|
|
4492
|
-
var PREFIX = "\u{1F6E1}\uFE0F Asgardeo";
|
|
4493
|
-
var DEFAULT_CONFIG = {
|
|
4494
|
-
level: "info",
|
|
4495
|
-
prefix: `${PREFIX}`,
|
|
4496
|
-
showLevel: true,
|
|
4497
|
-
timestamps: true
|
|
4498
|
-
};
|
|
4499
|
-
var isBrowser = () => (
|
|
4500
|
-
/* @ts-ignore */
|
|
4501
|
-
typeof window !== "undefined" && typeof window.document !== "undefined"
|
|
4502
|
-
);
|
|
4503
|
-
var isNode = () => (
|
|
4504
|
-
/* @ts-ignore */
|
|
4505
|
-
typeof process !== "undefined" && process.versions && process.versions.node
|
|
4506
|
-
);
|
|
4507
|
-
var COLORS = {
|
|
4508
|
-
blue: "\x1B[34m",
|
|
4509
|
-
bright: "\x1B[1m",
|
|
4510
|
-
cyan: "\x1B[36m",
|
|
4511
|
-
dim: "\x1B[2m",
|
|
4512
|
-
gray: "\x1B[90m",
|
|
4513
|
-
green: "\x1B[32m",
|
|
4514
|
-
magenta: "\x1B[35m",
|
|
4515
|
-
red: "\x1B[31m",
|
|
4516
|
-
reset: "\x1B[0m",
|
|
4517
|
-
white: "\x1B[37m",
|
|
4518
|
-
yellow: "\x1B[33m"
|
|
4519
|
-
};
|
|
4520
|
-
var BROWSER_STYLES = {
|
|
4521
|
-
debug: "color: #6b7280; font-weight: normal;",
|
|
4522
|
-
error: "color: #dc2626; font-weight: bold;",
|
|
4523
|
-
info: "color: #2563eb; font-weight: bold;",
|
|
4524
|
-
prefix: "color: #7c3aed; font-weight: bold;",
|
|
4525
|
-
timestamp: "color: #6b7280; font-size: 0.9em;",
|
|
4526
|
-
warn: "color: #d97706; font-weight: bold;"
|
|
4527
|
-
};
|
|
4528
|
-
var LOG_LEVEL_ORDER = {
|
|
4529
|
-
debug: 0,
|
|
4530
|
-
error: 3,
|
|
4531
|
-
info: 1,
|
|
4532
|
-
warn: 2
|
|
4533
|
-
};
|
|
4534
|
-
var Logger = class _Logger {
|
|
4535
|
-
constructor(config = {}) {
|
|
4536
|
-
__publicField(this, "config");
|
|
4537
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
4521
|
+
if (theme.colors?.success?.light) {
|
|
4522
|
+
cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
|
|
4538
4523
|
}
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4524
|
+
if (theme.colors?.warning?.main) {
|
|
4525
|
+
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
4526
|
+
}
|
|
4527
|
+
if (theme.colors?.warning?.contrastText) {
|
|
4528
|
+
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
4529
|
+
}
|
|
4530
|
+
if (theme.colors?.warning?.light) {
|
|
4531
|
+
cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
|
|
4532
|
+
}
|
|
4533
|
+
if (theme.colors?.info?.main) {
|
|
4534
|
+
cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
|
|
4535
|
+
}
|
|
4536
|
+
if (theme.colors?.info?.contrastText) {
|
|
4537
|
+
cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
|
|
4538
|
+
}
|
|
4539
|
+
if (theme.colors?.info?.light) {
|
|
4540
|
+
cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
|
|
4541
|
+
}
|
|
4542
|
+
if (theme.colors?.text?.primary) {
|
|
4543
|
+
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
4544
|
+
}
|
|
4545
|
+
if (theme.colors?.text?.secondary) {
|
|
4546
|
+
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
4547
|
+
}
|
|
4548
|
+
if (theme.colors?.border) {
|
|
4549
|
+
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
4550
|
+
}
|
|
4551
|
+
if (theme.spacing?.unit !== void 0) {
|
|
4552
|
+
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
4553
|
+
}
|
|
4554
|
+
if (theme.borderRadius?.small) {
|
|
4555
|
+
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
4556
|
+
}
|
|
4557
|
+
if (theme.borderRadius?.medium) {
|
|
4558
|
+
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
4559
|
+
}
|
|
4560
|
+
if (theme.borderRadius?.large) {
|
|
4561
|
+
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
4562
|
+
}
|
|
4563
|
+
if (theme.shadows?.small) {
|
|
4564
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
4565
|
+
}
|
|
4566
|
+
if (theme.shadows?.medium) {
|
|
4567
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
4568
|
+
}
|
|
4569
|
+
if (theme.shadows?.large) {
|
|
4570
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
4571
|
+
}
|
|
4572
|
+
if (theme.typography?.fontFamily) {
|
|
4573
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
4574
|
+
}
|
|
4575
|
+
if (theme.typography?.fontSizes?.xs) {
|
|
4576
|
+
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
4577
|
+
}
|
|
4578
|
+
if (theme.typography?.fontSizes?.sm) {
|
|
4579
|
+
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
4580
|
+
}
|
|
4581
|
+
if (theme.typography?.fontSizes?.md) {
|
|
4582
|
+
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
4583
|
+
}
|
|
4584
|
+
if (theme.typography?.fontSizes?.lg) {
|
|
4585
|
+
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
4586
|
+
}
|
|
4587
|
+
if (theme.typography?.fontSizes?.xl) {
|
|
4588
|
+
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
4589
|
+
}
|
|
4590
|
+
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
4591
|
+
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
4592
|
+
}
|
|
4593
|
+
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
4594
|
+
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
4595
|
+
}
|
|
4596
|
+
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
4597
|
+
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
4598
|
+
}
|
|
4599
|
+
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
4600
|
+
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
4601
|
+
}
|
|
4602
|
+
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
4603
|
+
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
4604
|
+
}
|
|
4605
|
+
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
4606
|
+
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
4544
4607
|
}
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
*/
|
|
4548
|
-
getConfig() {
|
|
4549
|
-
return { ...this.config };
|
|
4608
|
+
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
4609
|
+
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
4550
4610
|
}
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
*/
|
|
4554
|
-
shouldLog(level) {
|
|
4555
|
-
return LOG_LEVEL_ORDER[level] >= LOG_LEVEL_ORDER[this.config.level];
|
|
4611
|
+
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
4612
|
+
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
4556
4613
|
}
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
*/
|
|
4560
|
-
static getTimestamp() {
|
|
4561
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
4614
|
+
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
4615
|
+
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
4562
4616
|
}
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
default:
|
|
4577
|
-
return "UNKNOWN";
|
|
4578
|
-
}
|
|
4617
|
+
if (theme.images) {
|
|
4618
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
4619
|
+
const imageConfig = theme.images[imageKey];
|
|
4620
|
+
if (imageConfig?.url) {
|
|
4621
|
+
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
4622
|
+
}
|
|
4623
|
+
if (imageConfig?.title) {
|
|
4624
|
+
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
4625
|
+
}
|
|
4626
|
+
if (imageConfig?.alt) {
|
|
4627
|
+
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
4628
|
+
}
|
|
4629
|
+
});
|
|
4579
4630
|
}
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
case "debug":
|
|
4596
|
-
coloredLevel = `${COLORS.gray}[${levelStr}]${COLORS.reset}`;
|
|
4597
|
-
break;
|
|
4598
|
-
case "info":
|
|
4599
|
-
coloredLevel = `${COLORS.blue}[${levelStr}]${COLORS.reset}`;
|
|
4600
|
-
break;
|
|
4601
|
-
case "warn":
|
|
4602
|
-
coloredLevel = `${COLORS.yellow}[${levelStr}]${COLORS.reset}`;
|
|
4603
|
-
break;
|
|
4604
|
-
case "error":
|
|
4605
|
-
coloredLevel = `${COLORS.red}[${levelStr}]${COLORS.reset}`;
|
|
4606
|
-
break;
|
|
4607
|
-
default:
|
|
4608
|
-
coloredLevel = `[${levelStr}]`;
|
|
4631
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4632
|
+
cssVars[`--${prefix}-component-button-root-borderRadius`] = theme.components.Button.styleOverrides.root.borderRadius;
|
|
4633
|
+
}
|
|
4634
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4635
|
+
cssVars[`--${prefix}-component-field-root-borderRadius`] = theme.components.Field.styleOverrides.root.borderRadius;
|
|
4636
|
+
}
|
|
4637
|
+
return cssVars;
|
|
4638
|
+
};
|
|
4639
|
+
var toThemeVars = (theme) => {
|
|
4640
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
4641
|
+
const componentVars = {};
|
|
4642
|
+
if (theme.components?.Button?.styleOverrides?.root?.borderRadius) {
|
|
4643
|
+
componentVars.Button = {
|
|
4644
|
+
root: {
|
|
4645
|
+
borderRadius: `var(--${prefix}-component-button-root-borderRadius)`
|
|
4609
4646
|
}
|
|
4610
|
-
|
|
4611
|
-
}
|
|
4612
|
-
parts.push(message);
|
|
4613
|
-
return parts.join(" ");
|
|
4647
|
+
};
|
|
4614
4648
|
}
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
}
|
|
4622
|
-
if (this.config.formatter) {
|
|
4623
|
-
this.config.formatter(level, message, ...args);
|
|
4624
|
-
return;
|
|
4625
|
-
}
|
|
4626
|
-
if (isBrowser()) {
|
|
4627
|
-
this.logToBrowser(level, message, ...args);
|
|
4628
|
-
} else if (isNode()) {
|
|
4629
|
-
this.logToNode(level, message, ...args);
|
|
4630
|
-
} else {
|
|
4631
|
-
console.log(message, ...args);
|
|
4632
|
-
}
|
|
4649
|
+
if (theme.components?.Field?.styleOverrides?.root?.borderRadius) {
|
|
4650
|
+
componentVars.Field = {
|
|
4651
|
+
root: {
|
|
4652
|
+
borderRadius: `var(--${prefix}-component-field-root-borderRadius)`
|
|
4653
|
+
}
|
|
4654
|
+
};
|
|
4633
4655
|
}
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4656
|
+
const themeVars = {
|
|
4657
|
+
borderRadius: {
|
|
4658
|
+
large: `var(--${prefix}-border-radius-large)`,
|
|
4659
|
+
medium: `var(--${prefix}-border-radius-medium)`,
|
|
4660
|
+
small: `var(--${prefix}-border-radius-small)`
|
|
4661
|
+
},
|
|
4662
|
+
colors: {
|
|
4663
|
+
action: {
|
|
4664
|
+
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`,
|
|
4665
|
+
active: `var(--${prefix}-color-action-active)`,
|
|
4666
|
+
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
4667
|
+
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
4668
|
+
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
4669
|
+
focus: `var(--${prefix}-color-action-focus)`,
|
|
4670
|
+
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
4671
|
+
hover: `var(--${prefix}-color-action-hover)`,
|
|
4672
|
+
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
4673
|
+
selected: `var(--${prefix}-color-action-selected)`,
|
|
4674
|
+
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`
|
|
4675
|
+
},
|
|
4676
|
+
background: {
|
|
4677
|
+
body: {
|
|
4678
|
+
main: `var(--${prefix}-color-background-body-main)`
|
|
4679
|
+
},
|
|
4680
|
+
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
4681
|
+
surface: `var(--${prefix}-color-background-surface)`
|
|
4682
|
+
},
|
|
4683
|
+
border: `var(--${prefix}-color-border)`,
|
|
4684
|
+
error: {
|
|
4685
|
+
contrastText: `var(--${prefix}-color-error-contrastText)`,
|
|
4686
|
+
main: `var(--${prefix}-color-error-main)`
|
|
4687
|
+
},
|
|
4688
|
+
info: {
|
|
4689
|
+
contrastText: `var(--${prefix}-color-info-contrastText)`,
|
|
4690
|
+
main: `var(--${prefix}-color-info-main)`
|
|
4691
|
+
},
|
|
4692
|
+
primary: {
|
|
4693
|
+
contrastText: `var(--${prefix}-color-primary-contrastText)`,
|
|
4694
|
+
main: `var(--${prefix}-color-primary-main)`
|
|
4695
|
+
},
|
|
4696
|
+
secondary: {
|
|
4697
|
+
contrastText: `var(--${prefix}-color-secondary-contrastText)`,
|
|
4698
|
+
main: `var(--${prefix}-color-secondary-main)`
|
|
4699
|
+
},
|
|
4700
|
+
success: {
|
|
4701
|
+
contrastText: `var(--${prefix}-color-success-contrastText)`,
|
|
4702
|
+
main: `var(--${prefix}-color-success-main)`
|
|
4703
|
+
},
|
|
4704
|
+
text: {
|
|
4705
|
+
primary: `var(--${prefix}-color-text-primary)`,
|
|
4706
|
+
secondary: `var(--${prefix}-color-text-secondary)`
|
|
4707
|
+
},
|
|
4708
|
+
warning: {
|
|
4709
|
+
contrastText: `var(--${prefix}-color-warning-contrastText)`,
|
|
4710
|
+
main: `var(--${prefix}-color-warning-main)`
|
|
4711
|
+
}
|
|
4712
|
+
},
|
|
4713
|
+
shadows: {
|
|
4714
|
+
large: `var(--${prefix}-shadow-large)`,
|
|
4715
|
+
medium: `var(--${prefix}-shadow-medium)`,
|
|
4716
|
+
small: `var(--${prefix}-shadow-small)`
|
|
4717
|
+
},
|
|
4718
|
+
spacing: {
|
|
4719
|
+
unit: `var(--${prefix}-spacing-unit)`
|
|
4720
|
+
},
|
|
4721
|
+
typography: {
|
|
4722
|
+
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
4723
|
+
fontSizes: {
|
|
4724
|
+
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
4725
|
+
"3xl": `var(--${prefix}-typography-fontSize-3xl)`,
|
|
4726
|
+
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
4727
|
+
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
4728
|
+
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
4729
|
+
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
4730
|
+
xs: `var(--${prefix}-typography-fontSize-xs)`
|
|
4731
|
+
},
|
|
4732
|
+
fontWeights: {
|
|
4733
|
+
bold: `var(--${prefix}-typography-fontWeight-bold)`,
|
|
4734
|
+
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
4735
|
+
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
4736
|
+
semibold: `var(--${prefix}-typography-fontWeight-semibold)`
|
|
4737
|
+
},
|
|
4738
|
+
lineHeights: {
|
|
4739
|
+
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
4740
|
+
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`,
|
|
4741
|
+
tight: `var(--${prefix}-typography-lineHeight-tight)`
|
|
4666
4742
|
}
|
|
4667
4743
|
}
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
console.warn(formattedMessage, ...styles, ...args);
|
|
4680
|
-
break;
|
|
4681
|
-
case "error":
|
|
4682
|
-
console.error(formattedMessage, ...styles, ...args);
|
|
4683
|
-
break;
|
|
4684
|
-
default:
|
|
4685
|
-
console.log(formattedMessage, ...styles, ...args);
|
|
4686
|
-
}
|
|
4744
|
+
};
|
|
4745
|
+
if (theme.images) {
|
|
4746
|
+
themeVars.images = {};
|
|
4747
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
4748
|
+
const imageConfig = theme.images[imageKey];
|
|
4749
|
+
themeVars.images[imageKey] = {
|
|
4750
|
+
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0,
|
|
4751
|
+
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
4752
|
+
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0
|
|
4753
|
+
};
|
|
4754
|
+
});
|
|
4687
4755
|
}
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
*/
|
|
4691
|
-
logToNode(level, message, ...args) {
|
|
4692
|
-
const formattedMessage = this.formatForNode(level, message);
|
|
4693
|
-
switch (level) {
|
|
4694
|
-
case "debug":
|
|
4695
|
-
console.debug(formattedMessage, ...args);
|
|
4696
|
-
break;
|
|
4697
|
-
case "info":
|
|
4698
|
-
console.info(formattedMessage, ...args);
|
|
4699
|
-
break;
|
|
4700
|
-
case "warn":
|
|
4701
|
-
console.warn(formattedMessage, ...args);
|
|
4702
|
-
break;
|
|
4703
|
-
case "error":
|
|
4704
|
-
console.error(formattedMessage, ...args);
|
|
4705
|
-
break;
|
|
4706
|
-
default:
|
|
4707
|
-
console.log(formattedMessage, ...args);
|
|
4708
|
-
}
|
|
4756
|
+
if (Object.keys(componentVars).length > 0) {
|
|
4757
|
+
themeVars.components = componentVars;
|
|
4709
4758
|
}
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4759
|
+
return themeVars;
|
|
4760
|
+
};
|
|
4761
|
+
var createTheme = (config = {}, isDark = false) => {
|
|
4762
|
+
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
4763
|
+
const mergedConfig = {
|
|
4764
|
+
...baseTheme,
|
|
4765
|
+
...config,
|
|
4766
|
+
borderRadius: {
|
|
4767
|
+
...baseTheme.borderRadius,
|
|
4768
|
+
...config.borderRadius
|
|
4769
|
+
},
|
|
4770
|
+
colors: {
|
|
4771
|
+
...baseTheme.colors,
|
|
4772
|
+
...config.colors,
|
|
4773
|
+
action: {
|
|
4774
|
+
...baseTheme.colors.action,
|
|
4775
|
+
...config.colors?.action || {}
|
|
4776
|
+
},
|
|
4777
|
+
secondary: {
|
|
4778
|
+
...baseTheme.colors.secondary,
|
|
4779
|
+
...config.colors?.secondary || {}
|
|
4780
|
+
}
|
|
4781
|
+
},
|
|
4782
|
+
images: {
|
|
4783
|
+
...baseTheme.images,
|
|
4784
|
+
...config.images
|
|
4785
|
+
},
|
|
4786
|
+
shadows: {
|
|
4787
|
+
...baseTheme.shadows,
|
|
4788
|
+
...config.shadows
|
|
4789
|
+
},
|
|
4790
|
+
spacing: {
|
|
4791
|
+
...baseTheme.spacing,
|
|
4792
|
+
...config.spacing
|
|
4793
|
+
},
|
|
4794
|
+
typography: {
|
|
4795
|
+
...baseTheme.typography,
|
|
4796
|
+
...config.typography,
|
|
4797
|
+
fontSizes: {
|
|
4798
|
+
...baseTheme.typography.fontSizes,
|
|
4799
|
+
...config.typography?.fontSizes || {}
|
|
4800
|
+
},
|
|
4801
|
+
fontWeights: {
|
|
4802
|
+
...baseTheme.typography.fontWeights,
|
|
4803
|
+
...config.typography?.fontWeights || {}
|
|
4804
|
+
},
|
|
4805
|
+
lineHeights: {
|
|
4806
|
+
...baseTheme.typography.lineHeights,
|
|
4807
|
+
...config.typography?.lineHeights || {}
|
|
4808
|
+
}
|
|
4809
|
+
}
|
|
4810
|
+
};
|
|
4811
|
+
return {
|
|
4812
|
+
...mergedConfig,
|
|
4813
|
+
cssVariables: toCssVariables(mergedConfig),
|
|
4814
|
+
vars: toThemeVars(mergedConfig)
|
|
4815
|
+
};
|
|
4816
|
+
};
|
|
4817
|
+
var DEFAULT_THEME = "light";
|
|
4818
|
+
var createTheme_default = createTheme;
|
|
4819
|
+
|
|
4820
|
+
// src/utils/arrayBufferToBase64url.ts
|
|
4821
|
+
var arrayBufferToBase64url = (buffer) => {
|
|
4822
|
+
const bytes = new Uint8Array(buffer);
|
|
4823
|
+
let binary = "";
|
|
4824
|
+
for (let i = 0; i < bytes.byteLength; i += 1) {
|
|
4825
|
+
binary += String.fromCharCode(bytes[i]);
|
|
4715
4826
|
}
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4827
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
4828
|
+
};
|
|
4829
|
+
var arrayBufferToBase64url_default = arrayBufferToBase64url;
|
|
4830
|
+
|
|
4831
|
+
// src/utils/base64urlToArrayBuffer.ts
|
|
4832
|
+
var base64urlToArrayBuffer = (base64url3) => {
|
|
4833
|
+
const padding = "=".repeat((4 - base64url3.length % 4) % 4);
|
|
4834
|
+
const base64 = base64url3.replace(/-/g, "+").replace(/_/g, "/") + padding;
|
|
4835
|
+
const binaryString = atob(base64);
|
|
4836
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
4837
|
+
for (let i = 0; i < binaryString.length; i += 1) {
|
|
4838
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
4721
4839
|
}
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4840
|
+
return bytes.buffer;
|
|
4841
|
+
};
|
|
4842
|
+
var base64urlToArrayBuffer_default = base64urlToArrayBuffer;
|
|
4843
|
+
|
|
4844
|
+
// src/utils/bem.ts
|
|
4845
|
+
var bem = (baseClass, element, modifier) => {
|
|
4846
|
+
let className = baseClass;
|
|
4847
|
+
if (element) {
|
|
4848
|
+
className += `__${element}`;
|
|
4727
4849
|
}
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
*/
|
|
4731
|
-
error(message, ...args) {
|
|
4732
|
-
this.logMessage("error", message, ...args);
|
|
4850
|
+
if (modifier) {
|
|
4851
|
+
className += `--${modifier}`;
|
|
4733
4852
|
}
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4853
|
+
return className;
|
|
4854
|
+
};
|
|
4855
|
+
var bem_default = bem;
|
|
4856
|
+
|
|
4857
|
+
// src/utils/formatDate.ts
|
|
4858
|
+
var formatDate = (dateString) => {
|
|
4859
|
+
if (!dateString) return "-";
|
|
4860
|
+
try {
|
|
4861
|
+
return new Date(dateString).toLocaleDateString("en-US", {
|
|
4862
|
+
day: "numeric",
|
|
4863
|
+
month: "long",
|
|
4864
|
+
year: "numeric"
|
|
4742
4865
|
});
|
|
4866
|
+
} catch {
|
|
4867
|
+
return dateString;
|
|
4743
4868
|
}
|
|
4744
|
-
/**
|
|
4745
|
-
* Set log level
|
|
4746
|
-
*/
|
|
4747
|
-
setLevel(level) {
|
|
4748
|
-
this.config.level = level;
|
|
4749
|
-
}
|
|
4750
|
-
/**
|
|
4751
|
-
* Get current log level
|
|
4752
|
-
*/
|
|
4753
|
-
getLevel() {
|
|
4754
|
-
return this.config.level;
|
|
4755
|
-
}
|
|
4756
|
-
};
|
|
4757
|
-
var logger = new Logger();
|
|
4758
|
-
var createLogger = (config) => new Logger(config);
|
|
4759
|
-
var logger_default = logger;
|
|
4760
|
-
var debug = (message, ...args) => logger.debug(message, ...args);
|
|
4761
|
-
var info = (message, ...args) => logger.info(message, ...args);
|
|
4762
|
-
var warn = (message, ...args) => logger.warn(message, ...args);
|
|
4763
|
-
var error = (message, ...args) => logger.error(message, ...args);
|
|
4764
|
-
var configure = (config) => logger.configure(config);
|
|
4765
|
-
var createComponentLogger = (component) => logger.child(component);
|
|
4766
|
-
var createPackageLogger = (packageName) => createLogger({
|
|
4767
|
-
level: "info",
|
|
4768
|
-
prefix: `${PREFIX} - ${packageName}`,
|
|
4769
|
-
showLevel: true,
|
|
4770
|
-
timestamps: true
|
|
4771
|
-
});
|
|
4772
|
-
var createPackageComponentLogger = (packageName, component) => {
|
|
4773
|
-
const packageLogger = createPackageLogger(packageName);
|
|
4774
|
-
return packageLogger.child(component);
|
|
4775
4869
|
};
|
|
4870
|
+
var formatDate_default = formatDate;
|
|
4776
4871
|
|
|
4777
4872
|
// src/utils/deriveOrganizationHandleFromBaseUrl.ts
|
|
4778
4873
|
var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
@@ -4823,38 +4918,6 @@ var deriveOrganizationHandleFromBaseUrl = (baseUrl) => {
|
|
|
4823
4918
|
};
|
|
4824
4919
|
var deriveOrganizationHandleFromBaseUrl_default = deriveOrganizationHandleFromBaseUrl;
|
|
4825
4920
|
|
|
4826
|
-
// src/utils/isRecognizedBaseUrlPattern.ts
|
|
4827
|
-
var isRecognizedBaseUrlPattern = (baseUrl) => {
|
|
4828
|
-
if (!baseUrl) {
|
|
4829
|
-
throw new AsgardeoRuntimeError(
|
|
4830
|
-
"Base URL is required to derive if the `baseUrl` is recognized.",
|
|
4831
|
-
"isRecognizedBaseUrlPattern-ValidationError-001",
|
|
4832
|
-
"javascript",
|
|
4833
|
-
"A valid base URL must be provided to derive if the `baseUrl` is recognized to use the sensible fallbacks."
|
|
4834
|
-
);
|
|
4835
|
-
}
|
|
4836
|
-
let parsedUrl;
|
|
4837
|
-
try {
|
|
4838
|
-
parsedUrl = new URL(baseUrl);
|
|
4839
|
-
} catch (error2) {
|
|
4840
|
-
throw new AsgardeoRuntimeError(
|
|
4841
|
-
`Invalid base URL format: ${baseUrl}`,
|
|
4842
|
-
"isRecognizedBaseUrlPattern-ValidationError-002",
|
|
4843
|
-
"javascript",
|
|
4844
|
-
"The provided base URL does not conform to valid URL syntax."
|
|
4845
|
-
);
|
|
4846
|
-
}
|
|
4847
|
-
const pathSegments = parsedUrl.pathname?.split("/")?.filter((segment) => segment?.length > 0);
|
|
4848
|
-
if (pathSegments.length < 2 || pathSegments[0] !== "t") {
|
|
4849
|
-
logger_default.warn(
|
|
4850
|
-
"[isRecognizedBaseUrlPattern] The provided base URL does not follow the expected URL pattern (/t/{orgHandle})."
|
|
4851
|
-
);
|
|
4852
|
-
return false;
|
|
4853
|
-
}
|
|
4854
|
-
return true;
|
|
4855
|
-
};
|
|
4856
|
-
var isRecognizedBaseUrlPattern_default = isRecognizedBaseUrlPattern;
|
|
4857
|
-
|
|
4858
4921
|
// src/utils/flattenUserSchema.ts
|
|
4859
4922
|
var flattenUserSchema = (schemas) => {
|
|
4860
4923
|
const flattenedAttributes = [];
|
|
@@ -5040,31 +5103,6 @@ var generateFlattenedUserProfile = (meResponse, processedSchemas) => {
|
|
|
5040
5103
|
};
|
|
5041
5104
|
var generateFlattenedUserProfile_default = generateFlattenedUserProfile;
|
|
5042
5105
|
|
|
5043
|
-
// src/utils/identifyPlatform.ts
|
|
5044
|
-
var identifyPlatform = (config) => {
|
|
5045
|
-
const { baseUrl } = config;
|
|
5046
|
-
try {
|
|
5047
|
-
if (isRecognizedBaseUrlPattern_default(baseUrl)) {
|
|
5048
|
-
try {
|
|
5049
|
-
const url = new URL(baseUrl);
|
|
5050
|
-
if (/\.asgardeo\.io$/i.test(url.hostname) || /asgardeo\.io$/i.test(url.hostname)) {
|
|
5051
|
-
return "ASGARDEO" /* Asgardeo */;
|
|
5052
|
-
}
|
|
5053
|
-
} catch {
|
|
5054
|
-
logger_default.debug(
|
|
5055
|
-
`[identifyPlatform] Could not identify platform from the base URL: ${baseUrl}. Defaulting to WSO2 Identity Server as the platform.`
|
|
5056
|
-
);
|
|
5057
|
-
}
|
|
5058
|
-
return "IDENTITY_SERVER" /* IdentityServer */;
|
|
5059
|
-
}
|
|
5060
|
-
return "UNKNOWN" /* Unknown */;
|
|
5061
|
-
} catch (error2) {
|
|
5062
|
-
logger_default.debug(`[identifyPlatform] Error identifying platform from base URL: ${baseUrl}. Error: ${error2.message}`);
|
|
5063
|
-
return "UNKNOWN" /* Unknown */;
|
|
5064
|
-
}
|
|
5065
|
-
};
|
|
5066
|
-
var identifyPlatform_default = identifyPlatform;
|
|
5067
|
-
|
|
5068
5106
|
// src/utils/getRedirectBasedSignUpUrl.ts
|
|
5069
5107
|
var getRedirectBasedSignUpUrl = (config) => {
|
|
5070
5108
|
const { baseUrl } = config;
|