@asgardeo/react 0.5.14 → 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;
|
|
@@ -1370,6 +1371,7 @@ var AsgardeoProvider = ({
|
|
|
1370
1371
|
signUpUrl,
|
|
1371
1372
|
organizationHandle,
|
|
1372
1373
|
applicationId,
|
|
1374
|
+
signInOptions,
|
|
1373
1375
|
...rest
|
|
1374
1376
|
}) => {
|
|
1375
1377
|
const reRenderCheckRef = useRef(false);
|
|
@@ -1393,6 +1395,7 @@ var AsgardeoProvider = ({
|
|
|
1393
1395
|
scopes,
|
|
1394
1396
|
signUpUrl,
|
|
1395
1397
|
signInUrl,
|
|
1398
|
+
signInOptions,
|
|
1396
1399
|
...rest
|
|
1397
1400
|
});
|
|
1398
1401
|
const [brandingPreference, setBrandingPreference] = useState7(null);
|
|
@@ -1630,7 +1633,8 @@ var AsgardeoProvider = ({
|
|
|
1630
1633
|
http: {
|
|
1631
1634
|
request: asgardeo.request.bind(asgardeo),
|
|
1632
1635
|
requestAll: asgardeo.requestAll.bind(asgardeo)
|
|
1633
|
-
}
|
|
1636
|
+
},
|
|
1637
|
+
signInOptions
|
|
1634
1638
|
}),
|
|
1635
1639
|
[
|
|
1636
1640
|
applicationId,
|
|
@@ -1646,7 +1650,8 @@ var AsgardeoProvider = ({
|
|
|
1646
1650
|
signIn,
|
|
1647
1651
|
signInSilently,
|
|
1648
1652
|
user,
|
|
1649
|
-
asgardeo
|
|
1653
|
+
asgardeo,
|
|
1654
|
+
signInOptions
|
|
1650
1655
|
]
|
|
1651
1656
|
);
|
|
1652
1657
|
return /* @__PURE__ */ jsx7(AsgardeoContext_default.Provider, { value, children: /* @__PURE__ */ jsx7(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ jsx7(
|
|
@@ -2457,8 +2462,8 @@ var BaseSignInButton_default = BaseSignInButton;
|
|
|
2457
2462
|
import { AsgardeoRuntimeError as AsgardeoRuntimeError4 } from "@asgardeo/browser";
|
|
2458
2463
|
import { forwardRef as forwardRef3, useState as useState9 } from "react";
|
|
2459
2464
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
2460
|
-
var SignInButton = forwardRef3(({ children, onClick, preferences, ...rest }, ref) => {
|
|
2461
|
-
const { signIn, signInUrl } = useAsgardeo_default();
|
|
2465
|
+
var SignInButton = forwardRef3(({ children, onClick, preferences, signInOptions: overriddenSignInOptions = {}, ...rest }, ref) => {
|
|
2466
|
+
const { signIn, signInUrl, signInOptions } = useAsgardeo_default();
|
|
2462
2467
|
const { t } = useTranslation_default(preferences?.i18n);
|
|
2463
2468
|
const [isLoading, setIsLoading] = useState9(false);
|
|
2464
2469
|
const handleSignIn = async (e) => {
|
|
@@ -2468,7 +2473,7 @@ var SignInButton = forwardRef3(({ children, onClick, preferences, ...rest }, ref
|
|
|
2468
2473
|
window.history.pushState(null, "", signInUrl);
|
|
2469
2474
|
window.dispatchEvent(new PopStateEvent("popstate", { state: null }));
|
|
2470
2475
|
} else {
|
|
2471
|
-
await signIn();
|
|
2476
|
+
await signIn(overriddenSignInOptions ?? signInOptions);
|
|
2472
2477
|
}
|
|
2473
2478
|
if (onClick) {
|
|
2474
2479
|
onClick(e);
|