@asgardeo/react 0.6.24 → 0.6.26
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 +53 -15
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +53 -16
- package/dist/index.js.map +3 -3
- package/dist/utils/v2/flowTransformer.d.ts +2 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6877,7 +6877,6 @@ import {
|
|
|
6877
6877
|
// src/components/presentation/auth/AuthOptionFactory.tsx
|
|
6878
6878
|
import React from "react";
|
|
6879
6879
|
import {
|
|
6880
|
-
AsgardeoRuntimeError as AsgardeoRuntimeError7,
|
|
6881
6880
|
FieldType as FieldType7,
|
|
6882
6881
|
EmbeddedFlowComponentTypeV2 as EmbeddedFlowComponentType,
|
|
6883
6882
|
EmbeddedFlowActionVariantV2 as EmbeddedFlowActionVariant,
|
|
@@ -6959,9 +6958,6 @@ var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType
|
|
|
6959
6958
|
};
|
|
6960
6959
|
var createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, options = {}) => {
|
|
6961
6960
|
const key = options.key || component.id;
|
|
6962
|
-
if (authType === "signin") {
|
|
6963
|
-
console.log("Creating sign-in component for:", component);
|
|
6964
|
-
}
|
|
6965
6961
|
switch (component.type) {
|
|
6966
6962
|
case EmbeddedFlowComponentType.TextInput:
|
|
6967
6963
|
case EmbeddedFlowComponentType.PasswordInput:
|
|
@@ -6995,9 +6991,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
6995
6991
|
if (options.onSubmit) {
|
|
6996
6992
|
const formData = {};
|
|
6997
6993
|
Object.keys(formValues).forEach((field) => {
|
|
6998
|
-
|
|
6999
|
-
formData[field] = formValues[field];
|
|
7000
|
-
}
|
|
6994
|
+
formData[field] = formValues[field];
|
|
7001
6995
|
});
|
|
7002
6996
|
options.onSubmit(component, formData, shouldSkipValidation);
|
|
7003
6997
|
}
|
|
@@ -7067,12 +7061,8 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7067
7061
|
return null;
|
|
7068
7062
|
}
|
|
7069
7063
|
default:
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
`${authType === "signin" ? "SignIn" : "SignUp"}-UnsupportedComponentType-001`,
|
|
7073
|
-
"react",
|
|
7074
|
-
`Something went wrong while rendering the ${authType} component. Please try again later.`
|
|
7075
|
-
);
|
|
7064
|
+
console.warn(`Unsupported component type: ${component.type}. Skipping render.`);
|
|
7065
|
+
return null;
|
|
7076
7066
|
}
|
|
7077
7067
|
};
|
|
7078
7068
|
var renderSignInComponents = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => components.map(
|
|
@@ -7169,11 +7159,57 @@ var resolveTranslationsInArray = (items, t, properties) => {
|
|
|
7169
7159
|
var resolveTranslationsInArray_default = resolveTranslationsInArray;
|
|
7170
7160
|
|
|
7171
7161
|
// src/utils/v2/flowTransformer.ts
|
|
7162
|
+
var createInputRefMapping = (response) => {
|
|
7163
|
+
const mapping = /* @__PURE__ */ new Map();
|
|
7164
|
+
if (response?.data?.inputs && Array.isArray(response.data.inputs)) {
|
|
7165
|
+
response.data.inputs.forEach((input) => {
|
|
7166
|
+
if (input.ref && input.identifier) {
|
|
7167
|
+
mapping.set(input.ref, input.identifier);
|
|
7168
|
+
}
|
|
7169
|
+
});
|
|
7170
|
+
}
|
|
7171
|
+
return mapping;
|
|
7172
|
+
};
|
|
7173
|
+
var createActionRefMapping = (response) => {
|
|
7174
|
+
const mapping = /* @__PURE__ */ new Map();
|
|
7175
|
+
if (response?.data?.actions && Array.isArray(response.data.actions)) {
|
|
7176
|
+
response.data.actions.forEach((action) => {
|
|
7177
|
+
if (action.ref && action.nextNode) {
|
|
7178
|
+
mapping.set(action.ref, action.nextNode);
|
|
7179
|
+
}
|
|
7180
|
+
});
|
|
7181
|
+
}
|
|
7182
|
+
return mapping;
|
|
7183
|
+
};
|
|
7184
|
+
var applyInputRefMapping = (components, refMapping, actionMapping) => {
|
|
7185
|
+
return components.map((component) => {
|
|
7186
|
+
const transformedComponent = { ...component };
|
|
7187
|
+
if (transformedComponent.ref && refMapping.has(transformedComponent.ref)) {
|
|
7188
|
+
transformedComponent.ref = refMapping.get(transformedComponent.ref);
|
|
7189
|
+
}
|
|
7190
|
+
if (transformedComponent.type === "ACTION" && transformedComponent.id && actionMapping.has(transformedComponent.id)) {
|
|
7191
|
+
transformedComponent.actionRef = actionMapping.get(transformedComponent.id);
|
|
7192
|
+
}
|
|
7193
|
+
if (transformedComponent.components && Array.isArray(transformedComponent.components)) {
|
|
7194
|
+
transformedComponent.components = applyInputRefMapping(
|
|
7195
|
+
transformedComponent.components,
|
|
7196
|
+
refMapping,
|
|
7197
|
+
actionMapping
|
|
7198
|
+
);
|
|
7199
|
+
}
|
|
7200
|
+
return transformedComponent;
|
|
7201
|
+
});
|
|
7202
|
+
};
|
|
7172
7203
|
var transformComponents = (response, t, resolveTranslations = true) => {
|
|
7173
7204
|
if (!response?.data?.meta?.components) {
|
|
7174
7205
|
return [];
|
|
7175
7206
|
}
|
|
7176
|
-
|
|
7207
|
+
let components = response.data.meta.components;
|
|
7208
|
+
const refMapping = createInputRefMapping(response);
|
|
7209
|
+
const actionMapping = createActionRefMapping(response);
|
|
7210
|
+
if (refMapping.size > 0 || actionMapping.size > 0) {
|
|
7211
|
+
components = applyInputRefMapping(components, refMapping, actionMapping);
|
|
7212
|
+
}
|
|
7177
7213
|
return resolveTranslations ? resolveTranslationsInArray_default(components, t) : components;
|
|
7178
7214
|
};
|
|
7179
7215
|
var extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic") => {
|
|
@@ -9095,8 +9131,9 @@ var BaseSignUpContent2 = ({
|
|
|
9095
9131
|
const processComponents = (comps) => {
|
|
9096
9132
|
comps.forEach((component) => {
|
|
9097
9133
|
if (component.type === EmbeddedFlowComponentType4.TextInput) {
|
|
9134
|
+
const fieldName = component.ref || component.id;
|
|
9098
9135
|
fields.push({
|
|
9099
|
-
name:
|
|
9136
|
+
name: fieldName,
|
|
9100
9137
|
required: component.required || false,
|
|
9101
9138
|
initialValue: "",
|
|
9102
9139
|
validator: (value) => {
|
|
@@ -9187,7 +9224,7 @@ var BaseSignUpContent2 = ({
|
|
|
9187
9224
|
const payload = {
|
|
9188
9225
|
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
9189
9226
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
9190
|
-
...component.id && {
|
|
9227
|
+
...component.id && { actionId: component.id },
|
|
9191
9228
|
inputs: filteredInputs
|
|
9192
9229
|
};
|
|
9193
9230
|
const rawResponse = await onSubmit(payload);
|