@asgardeo/react 0.5.31 → 0.5.33
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/cjs/index.js +23 -13
- package/dist/cjs/index.js.map +2 -2
- package/dist/contexts/Asgardeo/AsgardeoContext.d.ts +6 -3
- package/dist/index.js +23 -13
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -173,10 +173,10 @@ var AsgardeoContext = (0, import_react.createContext)({
|
|
|
173
173
|
isLoading: true,
|
|
174
174
|
isSignedIn: false,
|
|
175
175
|
organization: null,
|
|
176
|
-
signIn:
|
|
177
|
-
signInSilently:
|
|
178
|
-
signOut:
|
|
179
|
-
signUp:
|
|
176
|
+
signIn: () => Promise.resolve({}),
|
|
177
|
+
signInSilently: () => Promise.resolve({}),
|
|
178
|
+
signOut: () => Promise.resolve({}),
|
|
179
|
+
signUp: () => Promise.resolve({}),
|
|
180
180
|
user: null,
|
|
181
181
|
http: {
|
|
182
182
|
request: () => null,
|
|
@@ -7536,7 +7536,7 @@ var normalizeFlowResponse = (response, t) => {
|
|
|
7536
7536
|
// src/components/presentation/SignIn/component-driven/SignIn.tsx
|
|
7537
7537
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
7538
7538
|
var SignIn = ({ className, size = "medium", onSuccess, onError, variant, children }) => {
|
|
7539
|
-
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading
|
|
7539
|
+
const { applicationId, afterSignInUrl, signIn, isInitialized, isLoading } = useAsgardeo_default();
|
|
7540
7540
|
const { t } = useTranslation_default();
|
|
7541
7541
|
const [components, setComponents] = (0, import_react60.useState)([]);
|
|
7542
7542
|
const [currentFlowId, setCurrentFlowId] = (0, import_react60.useState)(null);
|
|
@@ -7551,10 +7551,13 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7551
7551
|
}
|
|
7552
7552
|
}, [isInitialized, isLoading, isFlowInitialized]);
|
|
7553
7553
|
const initializeFlow = async () => {
|
|
7554
|
-
const
|
|
7555
|
-
|
|
7554
|
+
const urlParams = new URL(window.location.href).searchParams;
|
|
7555
|
+
const flowIdFromUrl = urlParams.get("flowId");
|
|
7556
|
+
const applicationIdFromUrl = urlParams.get("applicationId");
|
|
7557
|
+
const effectiveApplicationId = applicationId || applicationIdFromUrl;
|
|
7558
|
+
if (!flowIdFromUrl && !effectiveApplicationId) {
|
|
7556
7559
|
const error = new import_browser49.AsgardeoRuntimeError(
|
|
7557
|
-
|
|
7560
|
+
"Either flowId or applicationId is required for authentication",
|
|
7558
7561
|
"SignIn-initializeFlow-RuntimeError-001",
|
|
7559
7562
|
"react",
|
|
7560
7563
|
"Something went wrong while trying to sign in. Please try again later."
|
|
@@ -7564,10 +7567,17 @@ var SignIn = ({ className, size = "medium", onSuccess, onError, variant, childre
|
|
|
7564
7567
|
}
|
|
7565
7568
|
try {
|
|
7566
7569
|
setFlowError(null);
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7570
|
+
let response;
|
|
7571
|
+
if (flowIdFromUrl) {
|
|
7572
|
+
response = await signIn({
|
|
7573
|
+
flowId: flowIdFromUrl
|
|
7574
|
+
});
|
|
7575
|
+
} else {
|
|
7576
|
+
response = await signIn({
|
|
7577
|
+
applicationId: effectiveApplicationId,
|
|
7578
|
+
flowType: import_browser49.EmbeddedFlowType.Authentication
|
|
7579
|
+
});
|
|
7580
|
+
}
|
|
7571
7581
|
const { flowId, components: components2 } = normalizeFlowResponse(response, t);
|
|
7572
7582
|
if (flowId && components2) {
|
|
7573
7583
|
setCurrentFlowId(flowId);
|
|
@@ -7725,7 +7735,7 @@ var CheckboxInput = ({
|
|
|
7725
7735
|
}) => {
|
|
7726
7736
|
const config = component.config || {};
|
|
7727
7737
|
const fieldName = config["identifier"] || config["name"] || component.id;
|
|
7728
|
-
const value = formValues[fieldName] ||
|
|
7738
|
+
const value = formValues[fieldName] || false;
|
|
7729
7739
|
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
7730
7740
|
return createField({
|
|
7731
7741
|
type: import_browser51.FieldType.Checkbox,
|