@asgardeo/react 0.5.13 → 0.5.15
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.
|
@@ -20,7 +20,12 @@ import { BaseSignInButtonProps } from './BaseSignInButton';
|
|
|
20
20
|
/**
|
|
21
21
|
* Props interface of {@link SignInButton}
|
|
22
22
|
*/
|
|
23
|
-
export type SignInButtonProps = BaseSignInButtonProps
|
|
23
|
+
export type SignInButtonProps = BaseSignInButtonProps & {
|
|
24
|
+
/**
|
|
25
|
+
* Additional parameters to pass to the `authorize` request.
|
|
26
|
+
*/
|
|
27
|
+
signInOptions?: Record<string, any>;
|
|
28
|
+
};
|
|
24
29
|
/**
|
|
25
30
|
* SignInButton component that supports both render props and traditional props patterns.
|
|
26
31
|
*
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
18
|
import { Context } from 'react';
|
|
19
|
-
import { HttpRequestConfig, HttpResponse, Organization } from '@asgardeo/browser';
|
|
19
|
+
import { HttpRequestConfig, HttpResponse, Organization, SignInOptions } from '@asgardeo/browser';
|
|
20
20
|
import AsgardeoReactClient from '../../AsgardeoReactClient';
|
|
21
21
|
/**
|
|
22
22
|
* Props interface of {@link AsgardeoContext}
|
|
@@ -77,6 +77,16 @@ export type AsgardeoContextProps = {
|
|
|
77
77
|
*/
|
|
78
78
|
requestAll: (requestConfigs?: HttpRequestConfig[]) => Promise<HttpResponse<any>[]>;
|
|
79
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Optional additional parameters to be sent in the sign-in request.
|
|
82
|
+
* This can include custom parameters that your authorization server supports.
|
|
83
|
+
* These parameters will be included in the authorization request sent to the server.
|
|
84
|
+
* If not provided, no additional parameters will be sent.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* signInOptions: { prompt: "login", fidp: "OrganizationSSO" }
|
|
88
|
+
*/
|
|
89
|
+
signInOptions?: SignInOptions;
|
|
80
90
|
};
|
|
81
91
|
/**
|
|
82
92
|
* Context object for managing the Authentication flow builder core context.
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,8 @@ var AsgardeoContext = createContext({
|
|
|
31
31
|
http: {
|
|
32
32
|
request: () => null,
|
|
33
33
|
requestAll: () => null
|
|
34
|
-
}
|
|
34
|
+
},
|
|
35
|
+
signInOptions: {}
|
|
35
36
|
});
|
|
36
37
|
AsgardeoContext.displayName = "AsgardeoContext";
|
|
37
38
|
var AsgardeoContext_default = AsgardeoContext;
|
|
@@ -1176,7 +1177,8 @@ var ThemeProvider = ({
|
|
|
1176
1177
|
borderRadius: brandingTheme.borderRadius,
|
|
1177
1178
|
shadows: brandingTheme.shadows,
|
|
1178
1179
|
spacing: brandingTheme.spacing,
|
|
1179
|
-
images: brandingTheme.images
|
|
1180
|
+
images: brandingTheme.images,
|
|
1181
|
+
components: brandingTheme.components
|
|
1180
1182
|
};
|
|
1181
1183
|
return {
|
|
1182
1184
|
...brandingThemeConfig,
|
|
@@ -1200,6 +1202,10 @@ var ThemeProvider = ({
|
|
|
1200
1202
|
images: {
|
|
1201
1203
|
...brandingThemeConfig.images,
|
|
1202
1204
|
...themeConfig?.images
|
|
1205
|
+
},
|
|
1206
|
+
components: {
|
|
1207
|
+
...brandingThemeConfig.components,
|
|
1208
|
+
...themeConfig?.components
|
|
1203
1209
|
}
|
|
1204
1210
|
};
|
|
1205
1211
|
}, [inheritFromBranding, brandingTheme, themeConfig]);
|
|
@@ -1365,6 +1371,7 @@ var AsgardeoProvider = ({
|
|
|
1365
1371
|
signUpUrl,
|
|
1366
1372
|
organizationHandle,
|
|
1367
1373
|
applicationId,
|
|
1374
|
+
signInOptions,
|
|
1368
1375
|
...rest
|
|
1369
1376
|
}) => {
|
|
1370
1377
|
const reRenderCheckRef = useRef(false);
|
|
@@ -1388,6 +1395,7 @@ var AsgardeoProvider = ({
|
|
|
1388
1395
|
scopes,
|
|
1389
1396
|
signUpUrl,
|
|
1390
1397
|
signInUrl,
|
|
1398
|
+
signInOptions,
|
|
1391
1399
|
...rest
|
|
1392
1400
|
});
|
|
1393
1401
|
const [brandingPreference, setBrandingPreference] = useState7(null);
|
|
@@ -1625,7 +1633,8 @@ var AsgardeoProvider = ({
|
|
|
1625
1633
|
http: {
|
|
1626
1634
|
request: asgardeo.request.bind(asgardeo),
|
|
1627
1635
|
requestAll: asgardeo.requestAll.bind(asgardeo)
|
|
1628
|
-
}
|
|
1636
|
+
},
|
|
1637
|
+
signInOptions
|
|
1629
1638
|
}),
|
|
1630
1639
|
[
|
|
1631
1640
|
applicationId,
|
|
@@ -1641,7 +1650,8 @@ var AsgardeoProvider = ({
|
|
|
1641
1650
|
signIn,
|
|
1642
1651
|
signInSilently,
|
|
1643
1652
|
user,
|
|
1644
|
-
asgardeo
|
|
1653
|
+
asgardeo,
|
|
1654
|
+
signInOptions
|
|
1645
1655
|
]
|
|
1646
1656
|
);
|
|
1647
1657
|
return /* @__PURE__ */ jsx7(AsgardeoContext_default.Provider, { value, children: /* @__PURE__ */ jsx7(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ jsx7(
|
|
@@ -2121,7 +2131,7 @@ var useStyles2 = (theme, colorScheme, color, variant, size, fullWidth, disabled,
|
|
|
2121
2131
|
align-items: center;
|
|
2122
2132
|
justify-content: center;
|
|
2123
2133
|
gap: calc(${theme.vars.spacing.unit} * 1);
|
|
2124
|
-
border-radius: ${shape === "round" ? "50%" : theme.vars.borderRadius.medium};
|
|
2134
|
+
border-radius: ${shape === "round" ? "50%" : theme.vars.components?.Button?.root?.borderRadius || theme.vars.borderRadius.medium};
|
|
2125
2135
|
font-weight: 500;
|
|
2126
2136
|
cursor: ${disabled || loading ? "not-allowed" : "pointer"};
|
|
2127
2137
|
outline: none;
|
|
@@ -2452,8 +2462,8 @@ var BaseSignInButton_default = BaseSignInButton;
|
|
|
2452
2462
|
import { AsgardeoRuntimeError as AsgardeoRuntimeError4 } from "@asgardeo/browser";
|
|
2453
2463
|
import { forwardRef as forwardRef3, useState as useState9 } from "react";
|
|
2454
2464
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2455
|
-
var SignInButton = forwardRef3(({ children, onClick, preferences, ...rest }, ref) => {
|
|
2456
|
-
const { signIn, signInUrl } = useAsgardeo_default();
|
|
2465
|
+
var SignInButton = forwardRef3(({ children, onClick, preferences, signInOptions: overriddenSignInOptions = {}, ...rest }, ref) => {
|
|
2466
|
+
const { signIn, signInUrl, signInOptions } = useAsgardeo_default();
|
|
2457
2467
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
2458
2468
|
const [isLoading, setIsLoading] = useState9(false);
|
|
2459
2469
|
const handleSignIn = async (e) => {
|
|
@@ -2463,7 +2473,7 @@ var SignInButton = forwardRef3(({ children, onClick, preferences, ...rest }, ref
|
|
|
2463
2473
|
window.history.pushState(null, "", signInUrl);
|
|
2464
2474
|
window.dispatchEvent(new PopStateEvent("popstate", { state: null }));
|
|
2465
2475
|
} else {
|
|
2466
|
-
await signIn();
|
|
2476
|
+
await signIn(overriddenSignInOptions ?? signInOptions);
|
|
2467
2477
|
}
|
|
2468
2478
|
if (onClick) {
|
|
2469
2479
|
onClick(e);
|
|
@@ -3239,7 +3249,7 @@ var useStyles6 = (theme, colorScheme, disabled, hasError, hasStartIcon, hasEndIc
|
|
|
3239
3249
|
width: 100%;
|
|
3240
3250
|
padding: ${theme.vars.spacing.unit} ${rightPadding} ${theme.vars.spacing.unit} ${leftPadding};
|
|
3241
3251
|
border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};
|
|
3242
|
-
border-radius: ${theme.vars.borderRadius.medium};
|
|
3252
|
+
border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};
|
|
3243
3253
|
font-size: ${theme.vars.typography.fontSizes.md};
|
|
3244
3254
|
color: ${theme.vars.colors.text.primary};
|
|
3245
3255
|
background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};
|
|
@@ -3423,7 +3433,7 @@ var useStyles7 = (theme, colorScheme, disabled, hasError) => {
|
|
|
3423
3433
|
width: 100%;
|
|
3424
3434
|
padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);
|
|
3425
3435
|
border: 1px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};
|
|
3426
|
-
border-radius: ${theme.vars.borderRadius.medium};
|
|
3436
|
+
border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};
|
|
3427
3437
|
font-size: ${theme.vars.typography.fontSizes.md};
|
|
3428
3438
|
color: ${theme.vars.colors.text.primary};
|
|
3429
3439
|
background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};
|
|
@@ -3563,7 +3573,7 @@ var useStyles8 = (theme, colorScheme, disabled, hasError, length) => {
|
|
|
3563
3573
|
font-size: ${theme.vars.typography.fontSizes.xl};
|
|
3564
3574
|
font-weight: 500;
|
|
3565
3575
|
border: 2px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};
|
|
3566
|
-
border-radius: ${theme.vars.borderRadius.medium};
|
|
3576
|
+
border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};
|
|
3567
3577
|
color: ${theme.vars.colors.text.primary};
|
|
3568
3578
|
background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};
|
|
3569
3579
|
outline: none;
|
|
@@ -3893,7 +3903,7 @@ var useStyles10 = (theme, colorScheme, hasError, disabled) => {
|
|
|
3893
3903
|
width: 100%;
|
|
3894
3904
|
padding: ${theme.vars.spacing.unit} calc(${theme.vars.spacing.unit} * 1.5);
|
|
3895
3905
|
border: 1px solid ${theme.vars.colors.border};
|
|
3896
|
-
border-radius: ${theme.vars.borderRadius.medium};
|
|
3906
|
+
border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};
|
|
3897
3907
|
font-size: 1rem;
|
|
3898
3908
|
color: ${theme.vars.colors.text.primary};
|
|
3899
3909
|
background-color: ${theme.vars.colors.background.surface};
|