@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/cjs/index.js
CHANGED
|
@@ -7042,9 +7042,6 @@ var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType
|
|
|
7042
7042
|
};
|
|
7043
7043
|
var createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, options = {}) => {
|
|
7044
7044
|
const key = options.key || component.id;
|
|
7045
|
-
if (authType === "signin") {
|
|
7046
|
-
console.log("Creating sign-in component for:", component);
|
|
7047
|
-
}
|
|
7048
7045
|
switch (component.type) {
|
|
7049
7046
|
case import_browser45.EmbeddedFlowComponentTypeV2.TextInput:
|
|
7050
7047
|
case import_browser45.EmbeddedFlowComponentTypeV2.PasswordInput:
|
|
@@ -7078,9 +7075,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7078
7075
|
if (options.onSubmit) {
|
|
7079
7076
|
const formData = {};
|
|
7080
7077
|
Object.keys(formValues).forEach((field) => {
|
|
7081
|
-
|
|
7082
|
-
formData[field] = formValues[field];
|
|
7083
|
-
}
|
|
7078
|
+
formData[field] = formValues[field];
|
|
7084
7079
|
});
|
|
7085
7080
|
options.onSubmit(component, formData, shouldSkipValidation);
|
|
7086
7081
|
}
|
|
@@ -7150,12 +7145,8 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7150
7145
|
return null;
|
|
7151
7146
|
}
|
|
7152
7147
|
default:
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
`${authType === "signin" ? "SignIn" : "SignUp"}-UnsupportedComponentType-001`,
|
|
7156
|
-
"react",
|
|
7157
|
-
`Something went wrong while rendering the ${authType} component. Please try again later.`
|
|
7158
|
-
);
|
|
7148
|
+
console.warn(`Unsupported component type: ${component.type}. Skipping render.`);
|
|
7149
|
+
return null;
|
|
7159
7150
|
}
|
|
7160
7151
|
};
|
|
7161
7152
|
var renderSignInComponents = (components, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, options) => components.map(
|
|
@@ -7252,11 +7243,57 @@ var resolveTranslationsInArray = (items, t, properties) => {
|
|
|
7252
7243
|
var resolveTranslationsInArray_default = resolveTranslationsInArray;
|
|
7253
7244
|
|
|
7254
7245
|
// src/utils/v2/flowTransformer.ts
|
|
7246
|
+
var createInputRefMapping = (response) => {
|
|
7247
|
+
const mapping = /* @__PURE__ */ new Map();
|
|
7248
|
+
if (response?.data?.inputs && Array.isArray(response.data.inputs)) {
|
|
7249
|
+
response.data.inputs.forEach((input) => {
|
|
7250
|
+
if (input.ref && input.identifier) {
|
|
7251
|
+
mapping.set(input.ref, input.identifier);
|
|
7252
|
+
}
|
|
7253
|
+
});
|
|
7254
|
+
}
|
|
7255
|
+
return mapping;
|
|
7256
|
+
};
|
|
7257
|
+
var createActionRefMapping = (response) => {
|
|
7258
|
+
const mapping = /* @__PURE__ */ new Map();
|
|
7259
|
+
if (response?.data?.actions && Array.isArray(response.data.actions)) {
|
|
7260
|
+
response.data.actions.forEach((action) => {
|
|
7261
|
+
if (action.ref && action.nextNode) {
|
|
7262
|
+
mapping.set(action.ref, action.nextNode);
|
|
7263
|
+
}
|
|
7264
|
+
});
|
|
7265
|
+
}
|
|
7266
|
+
return mapping;
|
|
7267
|
+
};
|
|
7268
|
+
var applyInputRefMapping = (components, refMapping, actionMapping) => {
|
|
7269
|
+
return components.map((component) => {
|
|
7270
|
+
const transformedComponent = { ...component };
|
|
7271
|
+
if (transformedComponent.ref && refMapping.has(transformedComponent.ref)) {
|
|
7272
|
+
transformedComponent.ref = refMapping.get(transformedComponent.ref);
|
|
7273
|
+
}
|
|
7274
|
+
if (transformedComponent.type === "ACTION" && transformedComponent.id && actionMapping.has(transformedComponent.id)) {
|
|
7275
|
+
transformedComponent.actionRef = actionMapping.get(transformedComponent.id);
|
|
7276
|
+
}
|
|
7277
|
+
if (transformedComponent.components && Array.isArray(transformedComponent.components)) {
|
|
7278
|
+
transformedComponent.components = applyInputRefMapping(
|
|
7279
|
+
transformedComponent.components,
|
|
7280
|
+
refMapping,
|
|
7281
|
+
actionMapping
|
|
7282
|
+
);
|
|
7283
|
+
}
|
|
7284
|
+
return transformedComponent;
|
|
7285
|
+
});
|
|
7286
|
+
};
|
|
7255
7287
|
var transformComponents = (response, t, resolveTranslations = true) => {
|
|
7256
7288
|
if (!response?.data?.meta?.components) {
|
|
7257
7289
|
return [];
|
|
7258
7290
|
}
|
|
7259
|
-
|
|
7291
|
+
let components = response.data.meta.components;
|
|
7292
|
+
const refMapping = createInputRefMapping(response);
|
|
7293
|
+
const actionMapping = createActionRefMapping(response);
|
|
7294
|
+
if (refMapping.size > 0 || actionMapping.size > 0) {
|
|
7295
|
+
components = applyInputRefMapping(components, refMapping, actionMapping);
|
|
7296
|
+
}
|
|
7260
7297
|
return resolveTranslations ? resolveTranslationsInArray_default(components, t) : components;
|
|
7261
7298
|
};
|
|
7262
7299
|
var extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic") => {
|
|
@@ -9161,8 +9198,9 @@ var BaseSignUpContent2 = ({
|
|
|
9161
9198
|
const processComponents = (comps) => {
|
|
9162
9199
|
comps.forEach((component) => {
|
|
9163
9200
|
if (component.type === import_browser59.EmbeddedFlowComponentTypeV2.TextInput) {
|
|
9201
|
+
const fieldName = component.ref || component.id;
|
|
9164
9202
|
fields.push({
|
|
9165
|
-
name:
|
|
9203
|
+
name: fieldName,
|
|
9166
9204
|
required: component.required || false,
|
|
9167
9205
|
initialValue: "",
|
|
9168
9206
|
validator: (value) => {
|
|
@@ -9253,7 +9291,7 @@ var BaseSignUpContent2 = ({
|
|
|
9253
9291
|
const payload = {
|
|
9254
9292
|
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
9255
9293
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
9256
|
-
...component.id && {
|
|
9294
|
+
...component.id && { actionId: component.id },
|
|
9257
9295
|
inputs: filteredInputs
|
|
9258
9296
|
};
|
|
9259
9297
|
const rawResponse = await onSubmit(payload);
|