@asgardeo/javascript 0.1.2 → 0.1.4
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 +6 -2
- package/dist/api/getAllOrganizations.d.ts +2 -11
- package/dist/cjs/index.js +536 -31
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.js +534 -31
- package/dist/index.js.map +4 -4
- package/dist/models/client.d.ts +16 -3
- package/dist/models/i18n.d.ts +10 -0
- package/dist/models/organization.d.ts +9 -0
- package/dist/theme/createTheme.d.ts +17 -1
- package/dist/theme/types.d.ts +199 -0
- package/dist/utils/processUsername.d.ts +73 -0
- package/dist/utils/transformBrandingPreferenceToTheme.d.ts +48 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1953,9 +1953,9 @@ var initializeEmbeddedSignInFlow = async ({
|
|
|
1953
1953
|
...requestConfig,
|
|
1954
1954
|
method: requestConfig.method || "POST",
|
|
1955
1955
|
headers: {
|
|
1956
|
+
...requestConfig.headers,
|
|
1956
1957
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
1957
|
-
Accept: "application/json"
|
|
1958
|
-
...requestConfig.headers
|
|
1958
|
+
Accept: "application/json"
|
|
1959
1959
|
},
|
|
1960
1960
|
body: searchParams.toString()
|
|
1961
1961
|
});
|
|
@@ -2120,6 +2120,32 @@ var getUserInfo = async ({ url, ...requestConfig }) => {
|
|
|
2120
2120
|
};
|
|
2121
2121
|
var getUserInfo_default = getUserInfo;
|
|
2122
2122
|
|
|
2123
|
+
// src/utils/processUsername.ts
|
|
2124
|
+
var USERSTORE_PREFIX_REGEX = /^[A-Z_][A-Z0-9_]*\//;
|
|
2125
|
+
var removeUserstorePrefix = (username) => {
|
|
2126
|
+
if (!username) {
|
|
2127
|
+
return "";
|
|
2128
|
+
}
|
|
2129
|
+
return username.replace(USERSTORE_PREFIX_REGEX, "");
|
|
2130
|
+
};
|
|
2131
|
+
var processUsername = (user) => {
|
|
2132
|
+
if (!user) {
|
|
2133
|
+
return user;
|
|
2134
|
+
}
|
|
2135
|
+
const processedUser = { ...user };
|
|
2136
|
+
if (processedUser.username) {
|
|
2137
|
+
processedUser.username = removeUserstorePrefix(processedUser.username);
|
|
2138
|
+
}
|
|
2139
|
+
if (processedUser.userName) {
|
|
2140
|
+
processedUser.userName = removeUserstorePrefix(processedUser.userName);
|
|
2141
|
+
}
|
|
2142
|
+
if (processedUser.user_name) {
|
|
2143
|
+
processedUser.user_name = removeUserstorePrefix(processedUser.user_name);
|
|
2144
|
+
}
|
|
2145
|
+
return processedUser;
|
|
2146
|
+
};
|
|
2147
|
+
var processUsername_default = processUsername;
|
|
2148
|
+
|
|
2123
2149
|
// src/api/getScim2Me.ts
|
|
2124
2150
|
var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
2125
2151
|
try {
|
|
@@ -2156,7 +2182,8 @@ var getScim2Me = async ({ url, baseUrl, fetcher, ...requestConfig }) => {
|
|
|
2156
2182
|
response.statusText
|
|
2157
2183
|
);
|
|
2158
2184
|
}
|
|
2159
|
-
|
|
2185
|
+
const user = await response.json();
|
|
2186
|
+
return processUsername_default(user);
|
|
2160
2187
|
} catch (error) {
|
|
2161
2188
|
if (error instanceof AsgardeoAPIError) {
|
|
2162
2189
|
throw error;
|
|
@@ -2259,9 +2286,9 @@ var getAllOrganizations = async ({
|
|
|
2259
2286
|
...requestConfig,
|
|
2260
2287
|
method: "GET",
|
|
2261
2288
|
headers: {
|
|
2289
|
+
...requestConfig.headers,
|
|
2262
2290
|
"Content-Type": "application/json",
|
|
2263
|
-
Accept: "application/json"
|
|
2264
|
-
...requestConfig.headers
|
|
2291
|
+
Accept: "application/json"
|
|
2265
2292
|
}
|
|
2266
2293
|
};
|
|
2267
2294
|
try {
|
|
@@ -2718,7 +2745,7 @@ var getBrandingPreference = async ({
|
|
|
2718
2745
|
)
|
|
2719
2746
|
);
|
|
2720
2747
|
const fetchFn = fetcher || fetch;
|
|
2721
|
-
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2748
|
+
const resolvedUrl = `${baseUrl}/api/server/v1/branding-preference/resolve${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
|
|
2722
2749
|
const requestInit = {
|
|
2723
2750
|
...requestConfig,
|
|
2724
2751
|
method: "GET",
|
|
@@ -2862,6 +2889,19 @@ var AsgardeoJavaScriptClient_default = AsgardeoJavaScriptClient;
|
|
|
2862
2889
|
// src/theme/createTheme.ts
|
|
2863
2890
|
var lightTheme = {
|
|
2864
2891
|
colors: {
|
|
2892
|
+
action: {
|
|
2893
|
+
active: "rgba(0, 0, 0, 0.54)",
|
|
2894
|
+
hover: "rgba(0, 0, 0, 0.04)",
|
|
2895
|
+
hoverOpacity: 0.04,
|
|
2896
|
+
selected: "rgba(0, 0, 0, 0.08)",
|
|
2897
|
+
selectedOpacity: 0.08,
|
|
2898
|
+
disabled: "rgba(0, 0, 0, 0.26)",
|
|
2899
|
+
disabledBackground: "rgba(0, 0, 0, 0.12)",
|
|
2900
|
+
disabledOpacity: 0.38,
|
|
2901
|
+
focus: "rgba(0, 0, 0, 0.12)",
|
|
2902
|
+
focusOpacity: 0.12,
|
|
2903
|
+
activatedOpacity: 0.12
|
|
2904
|
+
},
|
|
2865
2905
|
primary: {
|
|
2866
2906
|
main: "#1a73e8",
|
|
2867
2907
|
contrastText: "#ffffff"
|
|
@@ -2907,10 +2947,57 @@ var lightTheme = {
|
|
|
2907
2947
|
small: "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
2908
2948
|
medium: "0 4px 16px rgba(0, 0, 0, 0.15)",
|
|
2909
2949
|
large: "0 8px 32px rgba(0, 0, 0, 0.2)"
|
|
2950
|
+
},
|
|
2951
|
+
typography: {
|
|
2952
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
2953
|
+
fontSizes: {
|
|
2954
|
+
xs: "0.75rem",
|
|
2955
|
+
// 12px
|
|
2956
|
+
sm: "0.875rem",
|
|
2957
|
+
// 14px
|
|
2958
|
+
md: "1rem",
|
|
2959
|
+
// 16px
|
|
2960
|
+
lg: "1.125rem",
|
|
2961
|
+
// 18px
|
|
2962
|
+
xl: "1.25rem",
|
|
2963
|
+
// 20px
|
|
2964
|
+
"2xl": "1.5rem",
|
|
2965
|
+
// 24px
|
|
2966
|
+
"3xl": "2.125rem"
|
|
2967
|
+
// 34px
|
|
2968
|
+
},
|
|
2969
|
+
fontWeights: {
|
|
2970
|
+
normal: 400,
|
|
2971
|
+
medium: 500,
|
|
2972
|
+
semibold: 600,
|
|
2973
|
+
bold: 700
|
|
2974
|
+
},
|
|
2975
|
+
lineHeights: {
|
|
2976
|
+
tight: 1.2,
|
|
2977
|
+
normal: 1.4,
|
|
2978
|
+
relaxed: 1.6
|
|
2979
|
+
}
|
|
2980
|
+
},
|
|
2981
|
+
images: {
|
|
2982
|
+
favicon: {},
|
|
2983
|
+
logo: {}
|
|
2910
2984
|
}
|
|
2911
2985
|
};
|
|
2912
2986
|
var darkTheme = {
|
|
2913
2987
|
colors: {
|
|
2988
|
+
action: {
|
|
2989
|
+
active: "rgba(255, 255, 255, 0.70)",
|
|
2990
|
+
hover: "rgba(255, 255, 255, 0.04)",
|
|
2991
|
+
hoverOpacity: 0.04,
|
|
2992
|
+
selected: "rgba(255, 255, 255, 0.08)",
|
|
2993
|
+
selectedOpacity: 0.08,
|
|
2994
|
+
disabled: "rgba(255, 255, 255, 0.26)",
|
|
2995
|
+
disabledBackground: "rgba(255, 255, 255, 0.12)",
|
|
2996
|
+
disabledOpacity: 0.38,
|
|
2997
|
+
focus: "rgba(255, 255, 255, 0.12)",
|
|
2998
|
+
focusOpacity: 0.12,
|
|
2999
|
+
activatedOpacity: 0.12
|
|
3000
|
+
},
|
|
2914
3001
|
primary: {
|
|
2915
3002
|
main: "#1a73e8",
|
|
2916
3003
|
contrastText: "#ffffff"
|
|
@@ -2956,35 +3043,308 @@ var darkTheme = {
|
|
|
2956
3043
|
small: "0 2px 8px rgba(0, 0, 0, 0.3)",
|
|
2957
3044
|
medium: "0 4px 16px rgba(0, 0, 0, 0.4)",
|
|
2958
3045
|
large: "0 8px 32px rgba(0, 0, 0, 0.5)"
|
|
3046
|
+
},
|
|
3047
|
+
typography: {
|
|
3048
|
+
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
|
|
3049
|
+
fontSizes: {
|
|
3050
|
+
xs: "0.75rem",
|
|
3051
|
+
// 12px
|
|
3052
|
+
sm: "0.875rem",
|
|
3053
|
+
// 14px
|
|
3054
|
+
md: "1rem",
|
|
3055
|
+
// 16px
|
|
3056
|
+
lg: "1.125rem",
|
|
3057
|
+
// 18px
|
|
3058
|
+
xl: "1.25rem",
|
|
3059
|
+
// 20px
|
|
3060
|
+
"2xl": "1.5rem",
|
|
3061
|
+
// 24px
|
|
3062
|
+
"3xl": "2.125rem"
|
|
3063
|
+
// 34px
|
|
3064
|
+
},
|
|
3065
|
+
fontWeights: {
|
|
3066
|
+
normal: 400,
|
|
3067
|
+
medium: 500,
|
|
3068
|
+
semibold: 600,
|
|
3069
|
+
bold: 700
|
|
3070
|
+
},
|
|
3071
|
+
lineHeights: {
|
|
3072
|
+
tight: 1.2,
|
|
3073
|
+
normal: 1.4,
|
|
3074
|
+
relaxed: 1.6
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
3077
|
+
images: {
|
|
3078
|
+
favicon: {},
|
|
3079
|
+
logo: {}
|
|
2959
3080
|
}
|
|
2960
3081
|
};
|
|
2961
3082
|
var toCssVariables = (theme) => {
|
|
2962
3083
|
const cssVars = {};
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
3084
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
3085
|
+
if (theme.colors?.action?.active) {
|
|
3086
|
+
cssVars[`--${prefix}-color-action-active`] = theme.colors.action.active;
|
|
3087
|
+
}
|
|
3088
|
+
if (theme.colors?.action?.hover) {
|
|
3089
|
+
cssVars[`--${prefix}-color-action-hover`] = theme.colors.action.hover;
|
|
3090
|
+
}
|
|
3091
|
+
if (theme.colors?.action?.hoverOpacity !== void 0) {
|
|
3092
|
+
cssVars[`--${prefix}-color-action-hoverOpacity`] = theme.colors.action.hoverOpacity.toString();
|
|
3093
|
+
}
|
|
3094
|
+
if (theme.colors?.action?.selected) {
|
|
3095
|
+
cssVars[`--${prefix}-color-action-selected`] = theme.colors.action.selected;
|
|
3096
|
+
}
|
|
3097
|
+
if (theme.colors?.action?.selectedOpacity !== void 0) {
|
|
3098
|
+
cssVars[`--${prefix}-color-action-selectedOpacity`] = theme.colors.action.selectedOpacity.toString();
|
|
3099
|
+
}
|
|
3100
|
+
if (theme.colors?.action?.disabled) {
|
|
3101
|
+
cssVars[`--${prefix}-color-action-disabled`] = theme.colors.action.disabled;
|
|
3102
|
+
}
|
|
3103
|
+
if (theme.colors?.action?.disabledBackground) {
|
|
3104
|
+
cssVars[`--${prefix}-color-action-disabledBackground`] = theme.colors.action.disabledBackground;
|
|
3105
|
+
}
|
|
3106
|
+
if (theme.colors?.action?.disabledOpacity !== void 0) {
|
|
3107
|
+
cssVars[`--${prefix}-color-action-disabledOpacity`] = theme.colors.action.disabledOpacity.toString();
|
|
3108
|
+
}
|
|
3109
|
+
if (theme.colors?.action?.focus) {
|
|
3110
|
+
cssVars[`--${prefix}-color-action-focus`] = theme.colors.action.focus;
|
|
3111
|
+
}
|
|
3112
|
+
if (theme.colors?.action?.focusOpacity !== void 0) {
|
|
3113
|
+
cssVars[`--${prefix}-color-action-focusOpacity`] = theme.colors.action.focusOpacity.toString();
|
|
3114
|
+
}
|
|
3115
|
+
if (theme.colors?.action?.activatedOpacity !== void 0) {
|
|
3116
|
+
cssVars[`--${prefix}-color-action-activatedOpacity`] = theme.colors.action.activatedOpacity.toString();
|
|
3117
|
+
}
|
|
3118
|
+
if (theme.colors?.primary?.main) {
|
|
3119
|
+
cssVars[`--${prefix}-color-primary-main`] = theme.colors.primary.main;
|
|
3120
|
+
}
|
|
3121
|
+
if (theme.colors?.primary?.contrastText) {
|
|
3122
|
+
cssVars[`--${prefix}-color-primary-contrastText`] = theme.colors.primary.contrastText;
|
|
3123
|
+
}
|
|
3124
|
+
if (theme.colors?.secondary?.main) {
|
|
3125
|
+
cssVars[`--${prefix}-color-secondary-main`] = theme.colors.secondary.main;
|
|
3126
|
+
}
|
|
3127
|
+
if (theme.colors?.secondary?.contrastText) {
|
|
3128
|
+
cssVars[`--${prefix}-color-secondary-contrastText`] = theme.colors.secondary.contrastText;
|
|
3129
|
+
}
|
|
3130
|
+
if (theme.colors?.background?.surface) {
|
|
3131
|
+
cssVars[`--${prefix}-color-background-surface`] = theme.colors.background.surface;
|
|
3132
|
+
}
|
|
3133
|
+
if (theme.colors?.background?.disabled) {
|
|
3134
|
+
cssVars[`--${prefix}-color-background-disabled`] = theme.colors.background.disabled;
|
|
3135
|
+
}
|
|
3136
|
+
if (theme.colors?.background?.body?.main) {
|
|
3137
|
+
cssVars[`--${prefix}-color-background-body-main`] = theme.colors.background.body.main;
|
|
3138
|
+
}
|
|
3139
|
+
if (theme.colors?.error?.main) {
|
|
3140
|
+
cssVars[`--${prefix}-color-error-main`] = theme.colors.error.main;
|
|
3141
|
+
}
|
|
3142
|
+
if (theme.colors?.error?.contrastText) {
|
|
3143
|
+
cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
|
|
3144
|
+
}
|
|
3145
|
+
if (theme.colors?.success?.main) {
|
|
3146
|
+
cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
|
|
3147
|
+
}
|
|
3148
|
+
if (theme.colors?.success?.contrastText) {
|
|
3149
|
+
cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
|
|
3150
|
+
}
|
|
3151
|
+
if (theme.colors?.warning?.main) {
|
|
3152
|
+
cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
|
|
3153
|
+
}
|
|
3154
|
+
if (theme.colors?.warning?.contrastText) {
|
|
3155
|
+
cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
|
|
3156
|
+
}
|
|
3157
|
+
if (theme.colors?.text?.primary) {
|
|
3158
|
+
cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
|
|
3159
|
+
}
|
|
3160
|
+
if (theme.colors?.text?.secondary) {
|
|
3161
|
+
cssVars[`--${prefix}-color-text-secondary`] = theme.colors.text.secondary;
|
|
3162
|
+
}
|
|
3163
|
+
if (theme.colors?.border) {
|
|
3164
|
+
cssVars[`--${prefix}-color-border`] = theme.colors.border;
|
|
3165
|
+
}
|
|
3166
|
+
if (theme.spacing?.unit !== void 0) {
|
|
3167
|
+
cssVars[`--${prefix}-spacing-unit`] = `${theme.spacing.unit}px`;
|
|
3168
|
+
}
|
|
3169
|
+
if (theme.borderRadius?.small) {
|
|
3170
|
+
cssVars[`--${prefix}-border-radius-small`] = theme.borderRadius.small;
|
|
3171
|
+
}
|
|
3172
|
+
if (theme.borderRadius?.medium) {
|
|
3173
|
+
cssVars[`--${prefix}-border-radius-medium`] = theme.borderRadius.medium;
|
|
3174
|
+
}
|
|
3175
|
+
if (theme.borderRadius?.large) {
|
|
3176
|
+
cssVars[`--${prefix}-border-radius-large`] = theme.borderRadius.large;
|
|
3177
|
+
}
|
|
3178
|
+
if (theme.shadows?.small) {
|
|
3179
|
+
cssVars[`--${prefix}-shadow-small`] = theme.shadows.small;
|
|
3180
|
+
}
|
|
3181
|
+
if (theme.shadows?.medium) {
|
|
3182
|
+
cssVars[`--${prefix}-shadow-medium`] = theme.shadows.medium;
|
|
3183
|
+
}
|
|
3184
|
+
if (theme.shadows?.large) {
|
|
3185
|
+
cssVars[`--${prefix}-shadow-large`] = theme.shadows.large;
|
|
3186
|
+
}
|
|
3187
|
+
if (theme.typography?.fontFamily) {
|
|
3188
|
+
cssVars[`--${prefix}-typography-fontFamily`] = theme.typography.fontFamily;
|
|
3189
|
+
}
|
|
3190
|
+
if (theme.typography?.fontSizes?.xs) {
|
|
3191
|
+
cssVars[`--${prefix}-typography-fontSize-xs`] = theme.typography.fontSizes.xs;
|
|
3192
|
+
}
|
|
3193
|
+
if (theme.typography?.fontSizes?.sm) {
|
|
3194
|
+
cssVars[`--${prefix}-typography-fontSize-sm`] = theme.typography.fontSizes.sm;
|
|
3195
|
+
}
|
|
3196
|
+
if (theme.typography?.fontSizes?.md) {
|
|
3197
|
+
cssVars[`--${prefix}-typography-fontSize-md`] = theme.typography.fontSizes.md;
|
|
3198
|
+
}
|
|
3199
|
+
if (theme.typography?.fontSizes?.lg) {
|
|
3200
|
+
cssVars[`--${prefix}-typography-fontSize-lg`] = theme.typography.fontSizes.lg;
|
|
3201
|
+
}
|
|
3202
|
+
if (theme.typography?.fontSizes?.xl) {
|
|
3203
|
+
cssVars[`--${prefix}-typography-fontSize-xl`] = theme.typography.fontSizes.xl;
|
|
3204
|
+
}
|
|
3205
|
+
if (theme.typography?.fontSizes?.["2xl"]) {
|
|
3206
|
+
cssVars[`--${prefix}-typography-fontSize-2xl`] = theme.typography.fontSizes["2xl"];
|
|
3207
|
+
}
|
|
3208
|
+
if (theme.typography?.fontSizes?.["3xl"]) {
|
|
3209
|
+
cssVars[`--${prefix}-typography-fontSize-3xl`] = theme.typography.fontSizes["3xl"];
|
|
3210
|
+
}
|
|
3211
|
+
if (theme.typography?.fontWeights?.normal !== void 0) {
|
|
3212
|
+
cssVars[`--${prefix}-typography-fontWeight-normal`] = theme.typography.fontWeights.normal.toString();
|
|
3213
|
+
}
|
|
3214
|
+
if (theme.typography?.fontWeights?.medium !== void 0) {
|
|
3215
|
+
cssVars[`--${prefix}-typography-fontWeight-medium`] = theme.typography.fontWeights.medium.toString();
|
|
3216
|
+
}
|
|
3217
|
+
if (theme.typography?.fontWeights?.semibold !== void 0) {
|
|
3218
|
+
cssVars[`--${prefix}-typography-fontWeight-semibold`] = theme.typography.fontWeights.semibold.toString();
|
|
3219
|
+
}
|
|
3220
|
+
if (theme.typography?.fontWeights?.bold !== void 0) {
|
|
3221
|
+
cssVars[`--${prefix}-typography-fontWeight-bold`] = theme.typography.fontWeights.bold.toString();
|
|
3222
|
+
}
|
|
3223
|
+
if (theme.typography?.lineHeights?.tight !== void 0) {
|
|
3224
|
+
cssVars[`--${prefix}-typography-lineHeight-tight`] = theme.typography.lineHeights.tight.toString();
|
|
3225
|
+
}
|
|
3226
|
+
if (theme.typography?.lineHeights?.normal !== void 0) {
|
|
3227
|
+
cssVars[`--${prefix}-typography-lineHeight-normal`] = theme.typography.lineHeights.normal.toString();
|
|
3228
|
+
}
|
|
3229
|
+
if (theme.typography?.lineHeights?.relaxed !== void 0) {
|
|
3230
|
+
cssVars[`--${prefix}-typography-lineHeight-relaxed`] = theme.typography.lineHeights.relaxed.toString();
|
|
3231
|
+
}
|
|
3232
|
+
if (theme.images) {
|
|
3233
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
3234
|
+
const imageConfig = theme.images[imageKey];
|
|
3235
|
+
if (imageConfig?.url) {
|
|
3236
|
+
cssVars[`--${prefix}-image-${imageKey}-url`] = imageConfig.url;
|
|
3237
|
+
}
|
|
3238
|
+
if (imageConfig?.title) {
|
|
3239
|
+
cssVars[`--${prefix}-image-${imageKey}-title`] = imageConfig.title;
|
|
3240
|
+
}
|
|
3241
|
+
if (imageConfig?.alt) {
|
|
3242
|
+
cssVars[`--${prefix}-image-${imageKey}-alt`] = imageConfig.alt;
|
|
3243
|
+
}
|
|
3244
|
+
});
|
|
3245
|
+
}
|
|
2986
3246
|
return cssVars;
|
|
2987
3247
|
};
|
|
3248
|
+
var toThemeVars = (theme) => {
|
|
3249
|
+
const prefix = theme.cssVarPrefix || VendorConstants_default.VENDOR_PREFIX;
|
|
3250
|
+
const themeVars = {
|
|
3251
|
+
colors: {
|
|
3252
|
+
action: {
|
|
3253
|
+
active: `var(--${prefix}-color-action-active)`,
|
|
3254
|
+
hover: `var(--${prefix}-color-action-hover)`,
|
|
3255
|
+
hoverOpacity: `var(--${prefix}-color-action-hoverOpacity)`,
|
|
3256
|
+
selected: `var(--${prefix}-color-action-selected)`,
|
|
3257
|
+
selectedOpacity: `var(--${prefix}-color-action-selectedOpacity)`,
|
|
3258
|
+
disabled: `var(--${prefix}-color-action-disabled)`,
|
|
3259
|
+
disabledBackground: `var(--${prefix}-color-action-disabledBackground)`,
|
|
3260
|
+
disabledOpacity: `var(--${prefix}-color-action-disabledOpacity)`,
|
|
3261
|
+
focus: `var(--${prefix}-color-action-focus)`,
|
|
3262
|
+
focusOpacity: `var(--${prefix}-color-action-focusOpacity)`,
|
|
3263
|
+
activatedOpacity: `var(--${prefix}-color-action-activatedOpacity)`
|
|
3264
|
+
},
|
|
3265
|
+
primary: {
|
|
3266
|
+
main: `var(--${prefix}-color-primary-main)`,
|
|
3267
|
+
contrastText: `var(--${prefix}-color-primary-contrastText)`
|
|
3268
|
+
},
|
|
3269
|
+
secondary: {
|
|
3270
|
+
main: `var(--${prefix}-color-secondary-main)`,
|
|
3271
|
+
contrastText: `var(--${prefix}-color-secondary-contrastText)`
|
|
3272
|
+
},
|
|
3273
|
+
background: {
|
|
3274
|
+
surface: `var(--${prefix}-color-background-surface)`,
|
|
3275
|
+
disabled: `var(--${prefix}-color-background-disabled)`,
|
|
3276
|
+
body: {
|
|
3277
|
+
main: `var(--${prefix}-color-background-body-main)`
|
|
3278
|
+
}
|
|
3279
|
+
},
|
|
3280
|
+
error: {
|
|
3281
|
+
main: `var(--${prefix}-color-error-main)`,
|
|
3282
|
+
contrastText: `var(--${prefix}-color-error-contrastText)`
|
|
3283
|
+
},
|
|
3284
|
+
success: {
|
|
3285
|
+
main: `var(--${prefix}-color-success-main)`,
|
|
3286
|
+
contrastText: `var(--${prefix}-color-success-contrastText)`
|
|
3287
|
+
},
|
|
3288
|
+
warning: {
|
|
3289
|
+
main: `var(--${prefix}-color-warning-main)`,
|
|
3290
|
+
contrastText: `var(--${prefix}-color-warning-contrastText)`
|
|
3291
|
+
},
|
|
3292
|
+
text: {
|
|
3293
|
+
primary: `var(--${prefix}-color-text-primary)`,
|
|
3294
|
+
secondary: `var(--${prefix}-color-text-secondary)`
|
|
3295
|
+
},
|
|
3296
|
+
border: `var(--${prefix}-color-border)`
|
|
3297
|
+
},
|
|
3298
|
+
spacing: {
|
|
3299
|
+
unit: `var(--${prefix}-spacing-unit)`
|
|
3300
|
+
},
|
|
3301
|
+
borderRadius: {
|
|
3302
|
+
small: `var(--${prefix}-border-radius-small)`,
|
|
3303
|
+
medium: `var(--${prefix}-border-radius-medium)`,
|
|
3304
|
+
large: `var(--${prefix}-border-radius-large)`
|
|
3305
|
+
},
|
|
3306
|
+
shadows: {
|
|
3307
|
+
small: `var(--${prefix}-shadow-small)`,
|
|
3308
|
+
medium: `var(--${prefix}-shadow-medium)`,
|
|
3309
|
+
large: `var(--${prefix}-shadow-large)`
|
|
3310
|
+
},
|
|
3311
|
+
typography: {
|
|
3312
|
+
fontFamily: `var(--${prefix}-typography-fontFamily)`,
|
|
3313
|
+
fontSizes: {
|
|
3314
|
+
xs: `var(--${prefix}-typography-fontSize-xs)`,
|
|
3315
|
+
sm: `var(--${prefix}-typography-fontSize-sm)`,
|
|
3316
|
+
md: `var(--${prefix}-typography-fontSize-md)`,
|
|
3317
|
+
lg: `var(--${prefix}-typography-fontSize-lg)`,
|
|
3318
|
+
xl: `var(--${prefix}-typography-fontSize-xl)`,
|
|
3319
|
+
"2xl": `var(--${prefix}-typography-fontSize-2xl)`,
|
|
3320
|
+
"3xl": `var(--${prefix}-typography-fontSize-3xl)`
|
|
3321
|
+
},
|
|
3322
|
+
fontWeights: {
|
|
3323
|
+
normal: `var(--${prefix}-typography-fontWeight-normal)`,
|
|
3324
|
+
medium: `var(--${prefix}-typography-fontWeight-medium)`,
|
|
3325
|
+
semibold: `var(--${prefix}-typography-fontWeight-semibold)`,
|
|
3326
|
+
bold: `var(--${prefix}-typography-fontWeight-bold)`
|
|
3327
|
+
},
|
|
3328
|
+
lineHeights: {
|
|
3329
|
+
tight: `var(--${prefix}-typography-lineHeight-tight)`,
|
|
3330
|
+
normal: `var(--${prefix}-typography-lineHeight-normal)`,
|
|
3331
|
+
relaxed: `var(--${prefix}-typography-lineHeight-relaxed)`
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
};
|
|
3335
|
+
if (theme.images) {
|
|
3336
|
+
themeVars.images = {};
|
|
3337
|
+
Object.keys(theme.images).forEach((imageKey) => {
|
|
3338
|
+
const imageConfig = theme.images[imageKey];
|
|
3339
|
+
themeVars.images[imageKey] = {
|
|
3340
|
+
url: imageConfig?.url ? `var(--${prefix}-image-${imageKey}-url)` : void 0,
|
|
3341
|
+
title: imageConfig?.title ? `var(--${prefix}-image-${imageKey}-title)` : void 0,
|
|
3342
|
+
alt: imageConfig?.alt ? `var(--${prefix}-image-${imageKey}-alt)` : void 0
|
|
3343
|
+
};
|
|
3344
|
+
});
|
|
3345
|
+
}
|
|
3346
|
+
return themeVars;
|
|
3347
|
+
};
|
|
2988
3348
|
var createTheme = (config = {}, isDark = false) => {
|
|
2989
3349
|
const baseTheme = isDark ? darkTheme : lightTheme;
|
|
2990
3350
|
const mergedConfig = {
|
|
@@ -2993,6 +3353,10 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
2993
3353
|
colors: {
|
|
2994
3354
|
...baseTheme.colors,
|
|
2995
3355
|
...config.colors,
|
|
3356
|
+
action: {
|
|
3357
|
+
...baseTheme.colors.action,
|
|
3358
|
+
...config.colors?.action || {}
|
|
3359
|
+
},
|
|
2996
3360
|
secondary: {
|
|
2997
3361
|
...baseTheme.colors.secondary,
|
|
2998
3362
|
...config.colors?.secondary || {}
|
|
@@ -3009,11 +3373,32 @@ var createTheme = (config = {}, isDark = false) => {
|
|
|
3009
3373
|
shadows: {
|
|
3010
3374
|
...baseTheme.shadows,
|
|
3011
3375
|
...config.shadows
|
|
3376
|
+
},
|
|
3377
|
+
typography: {
|
|
3378
|
+
...baseTheme.typography,
|
|
3379
|
+
...config.typography,
|
|
3380
|
+
fontSizes: {
|
|
3381
|
+
...baseTheme.typography.fontSizes,
|
|
3382
|
+
...config.typography?.fontSizes || {}
|
|
3383
|
+
},
|
|
3384
|
+
fontWeights: {
|
|
3385
|
+
...baseTheme.typography.fontWeights,
|
|
3386
|
+
...config.typography?.fontWeights || {}
|
|
3387
|
+
},
|
|
3388
|
+
lineHeights: {
|
|
3389
|
+
...baseTheme.typography.lineHeights,
|
|
3390
|
+
...config.typography?.lineHeights || {}
|
|
3391
|
+
}
|
|
3392
|
+
},
|
|
3393
|
+
images: {
|
|
3394
|
+
...baseTheme.images,
|
|
3395
|
+
...config.images
|
|
3012
3396
|
}
|
|
3013
3397
|
};
|
|
3014
3398
|
return {
|
|
3015
3399
|
...mergedConfig,
|
|
3016
|
-
cssVariables: toCssVariables(mergedConfig)
|
|
3400
|
+
cssVariables: toCssVariables(mergedConfig),
|
|
3401
|
+
vars: toThemeVars(mergedConfig)
|
|
3017
3402
|
};
|
|
3018
3403
|
};
|
|
3019
3404
|
var createTheme_default = createTheme;
|
|
@@ -3337,8 +3722,18 @@ var translations = {
|
|
|
3337
3722
|
"organization.switcher.members": "members",
|
|
3338
3723
|
"organization.switcher.member": "member",
|
|
3339
3724
|
"organization.switcher.create.organization": "Create Organization",
|
|
3340
|
-
"organization.switcher.manage.organizations": "Manage
|
|
3725
|
+
"organization.switcher.manage.organizations": "Manage Organizations",
|
|
3341
3726
|
"organization.switcher.manage.button": "Manage",
|
|
3727
|
+
"organization.switcher.organizations.title": "Organizations",
|
|
3728
|
+
"organization.switcher.switch.button": "Switch",
|
|
3729
|
+
"organization.switcher.no.access": "No Access",
|
|
3730
|
+
"organization.switcher.status.label": "Status:",
|
|
3731
|
+
"organization.switcher.showing.count": "Showing {showing} of {total} organizations",
|
|
3732
|
+
"organization.switcher.refresh.button": "Refresh",
|
|
3733
|
+
"organization.switcher.load.more": "Load More Organizations",
|
|
3734
|
+
"organization.switcher.loading.more": "Loading...",
|
|
3735
|
+
"organization.switcher.no.organizations": "No organizations found",
|
|
3736
|
+
"organization.switcher.error.prefix": "Error:",
|
|
3342
3737
|
"organization.profile.title": "Organization Profile",
|
|
3343
3738
|
"organization.profile.loading": "Loading organization...",
|
|
3344
3739
|
"organization.profile.error": "Failed to load organization",
|
|
@@ -3425,6 +3820,112 @@ var resolveFieldName_default = resolveFieldName;
|
|
|
3425
3820
|
// src/utils/withVendorCSSClassPrefix.ts
|
|
3426
3821
|
var withVendorCSSClassPrefix = (className) => `${VendorConstants_default.VENDOR_PREFIX}-${className}`;
|
|
3427
3822
|
var withVendorCSSClassPrefix_default = withVendorCSSClassPrefix;
|
|
3823
|
+
|
|
3824
|
+
// src/utils/transformBrandingPreferenceToTheme.ts
|
|
3825
|
+
var extractColorValue = (colorVariant) => {
|
|
3826
|
+
return colorVariant?.main;
|
|
3827
|
+
};
|
|
3828
|
+
var extractContrastText = (colorVariant) => {
|
|
3829
|
+
return colorVariant?.contrastText;
|
|
3830
|
+
};
|
|
3831
|
+
var transformThemeVariant = (themeVariant, isDark = false) => {
|
|
3832
|
+
const colors = themeVariant.colors;
|
|
3833
|
+
const buttons = themeVariant.buttons;
|
|
3834
|
+
const inputs = themeVariant.inputs;
|
|
3835
|
+
const images = themeVariant.images;
|
|
3836
|
+
return {
|
|
3837
|
+
colors: {
|
|
3838
|
+
action: {
|
|
3839
|
+
active: isDark ? "rgba(255, 255, 255, 0.70)" : "rgba(0, 0, 0, 0.54)",
|
|
3840
|
+
hover: isDark ? "rgba(255, 255, 255, 0.04)" : "rgba(0, 0, 0, 0.04)",
|
|
3841
|
+
hoverOpacity: 0.04,
|
|
3842
|
+
selected: isDark ? "rgba(255, 255, 255, 0.08)" : "rgba(0, 0, 0, 0.08)",
|
|
3843
|
+
selectedOpacity: 0.08,
|
|
3844
|
+
disabled: isDark ? "rgba(255, 255, 255, 0.26)" : "rgba(0, 0, 0, 0.26)",
|
|
3845
|
+
disabledBackground: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
3846
|
+
disabledOpacity: 0.38,
|
|
3847
|
+
focus: isDark ? "rgba(255, 255, 255, 0.12)" : "rgba(0, 0, 0, 0.12)",
|
|
3848
|
+
focusOpacity: 0.12,
|
|
3849
|
+
activatedOpacity: 0.12
|
|
3850
|
+
},
|
|
3851
|
+
primary: {
|
|
3852
|
+
main: extractColorValue(colors?.primary),
|
|
3853
|
+
contrastText: extractContrastText(colors?.primary)
|
|
3854
|
+
},
|
|
3855
|
+
secondary: {
|
|
3856
|
+
main: extractColorValue(colors?.secondary),
|
|
3857
|
+
contrastText: extractContrastText(colors?.secondary)
|
|
3858
|
+
},
|
|
3859
|
+
background: {
|
|
3860
|
+
surface: extractColorValue(colors?.background?.surface),
|
|
3861
|
+
disabled: extractColorValue(colors?.background?.surface),
|
|
3862
|
+
body: {
|
|
3863
|
+
main: extractColorValue(colors?.background?.body)
|
|
3864
|
+
}
|
|
3865
|
+
},
|
|
3866
|
+
text: {
|
|
3867
|
+
primary: colors?.text?.primary,
|
|
3868
|
+
secondary: colors?.text?.secondary
|
|
3869
|
+
},
|
|
3870
|
+
border: colors?.outlined?.default,
|
|
3871
|
+
error: {
|
|
3872
|
+
main: extractColorValue(colors?.alerts?.error),
|
|
3873
|
+
contrastText: extractContrastText(colors?.alerts?.error)
|
|
3874
|
+
},
|
|
3875
|
+
success: {
|
|
3876
|
+
main: extractColorValue(colors?.alerts?.info),
|
|
3877
|
+
contrastText: extractContrastText(colors?.alerts?.info)
|
|
3878
|
+
},
|
|
3879
|
+
warning: {
|
|
3880
|
+
main: extractColorValue(colors?.alerts?.warning),
|
|
3881
|
+
contrastText: extractContrastText(colors?.alerts?.warning)
|
|
3882
|
+
}
|
|
3883
|
+
},
|
|
3884
|
+
// Extract border radius from buttons or inputs
|
|
3885
|
+
borderRadius: {
|
|
3886
|
+
small: buttons?.primary?.base?.border?.borderRadius || inputs?.base?.border?.borderRadius,
|
|
3887
|
+
medium: buttons?.secondary?.base?.border?.borderRadius,
|
|
3888
|
+
large: buttons?.externalConnection?.base?.border?.borderRadius
|
|
3889
|
+
},
|
|
3890
|
+
// Extract and transform images
|
|
3891
|
+
images: {
|
|
3892
|
+
favicon: images?.favicon ? {
|
|
3893
|
+
url: images.favicon.imgURL,
|
|
3894
|
+
title: images.favicon.title,
|
|
3895
|
+
alt: images.favicon.altText
|
|
3896
|
+
} : void 0,
|
|
3897
|
+
logo: images?.logo ? {
|
|
3898
|
+
url: images.logo.imgURL,
|
|
3899
|
+
title: images.logo.title,
|
|
3900
|
+
alt: images.logo.altText
|
|
3901
|
+
} : void 0
|
|
3902
|
+
}
|
|
3903
|
+
};
|
|
3904
|
+
};
|
|
3905
|
+
var transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
|
|
3906
|
+
const themeConfig = brandingPreference?.preference?.theme;
|
|
3907
|
+
if (!themeConfig) {
|
|
3908
|
+
return createTheme_default({}, false);
|
|
3909
|
+
}
|
|
3910
|
+
let activeThemeKey;
|
|
3911
|
+
if (forceTheme) {
|
|
3912
|
+
activeThemeKey = forceTheme.toUpperCase();
|
|
3913
|
+
} else {
|
|
3914
|
+
activeThemeKey = themeConfig.activeTheme || "LIGHT";
|
|
3915
|
+
}
|
|
3916
|
+
const themeVariant = themeConfig[activeThemeKey];
|
|
3917
|
+
if (!themeVariant) {
|
|
3918
|
+
const fallbackVariant = themeConfig.LIGHT || themeConfig.DARK;
|
|
3919
|
+
if (fallbackVariant) {
|
|
3920
|
+
const transformedConfig2 = transformThemeVariant(fallbackVariant, activeThemeKey === "DARK");
|
|
3921
|
+
return createTheme_default(transformedConfig2, activeThemeKey === "DARK");
|
|
3922
|
+
}
|
|
3923
|
+
return createTheme_default({}, activeThemeKey === "DARK");
|
|
3924
|
+
}
|
|
3925
|
+
const transformedConfig = transformThemeVariant(themeVariant, activeThemeKey === "DARK");
|
|
3926
|
+
return createTheme_default(transformedConfig, activeThemeKey === "DARK");
|
|
3927
|
+
};
|
|
3928
|
+
var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
|
|
3428
3929
|
export {
|
|
3429
3930
|
ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants,
|
|
3430
3931
|
AsgardeoAPIError,
|
|
@@ -3476,10 +3977,12 @@ export {
|
|
|
3476
3977
|
initializeEmbeddedSignInFlow_default as initializeEmbeddedSignInFlow,
|
|
3477
3978
|
isEmpty_default as isEmpty,
|
|
3478
3979
|
processOpenIDScopes_default as processOpenIDScopes,
|
|
3980
|
+
processUsername_default as processUsername,
|
|
3479
3981
|
removeTrailingSlash_default as removeTrailingSlash,
|
|
3480
3982
|
resolveFieldName_default as resolveFieldName,
|
|
3481
3983
|
resolveFieldType_default as resolveFieldType,
|
|
3482
3984
|
set_default as set,
|
|
3985
|
+
transformBrandingPreferenceToTheme_default as transformBrandingPreferenceToTheme,
|
|
3483
3986
|
updateMeProfile_default as updateMeProfile,
|
|
3484
3987
|
updateOrganization_default as updateOrganization,
|
|
3485
3988
|
withVendorCSSClassPrefix_default as withVendorCSSClassPrefix
|