@asgardeo/react 0.6.25 → 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 +51 -9
- package/dist/cjs/index.js.map +2 -2
- package/dist/index.js +51 -9
- package/dist/index.js.map +2 -2
- package/dist/utils/v2/flowTransformer.d.ts +2 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -6958,9 +6958,6 @@ var matchesSocialProvider = (actionId, eventType, buttonText, provider, authType
|
|
|
6958
6958
|
};
|
|
6959
6959
|
var createAuthComponentFromFlow = (component, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, options = {}) => {
|
|
6960
6960
|
const key = options.key || component.id;
|
|
6961
|
-
if (authType === "signin") {
|
|
6962
|
-
console.log("Creating sign-in component for:", component);
|
|
6963
|
-
}
|
|
6964
6961
|
switch (component.type) {
|
|
6965
6962
|
case EmbeddedFlowComponentType.TextInput:
|
|
6966
6963
|
case EmbeddedFlowComponentType.PasswordInput:
|
|
@@ -6994,9 +6991,7 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
6994
6991
|
if (options.onSubmit) {
|
|
6995
6992
|
const formData = {};
|
|
6996
6993
|
Object.keys(formValues).forEach((field) => {
|
|
6997
|
-
|
|
6998
|
-
formData[field] = formValues[field];
|
|
6999
|
-
}
|
|
6994
|
+
formData[field] = formValues[field];
|
|
7000
6995
|
});
|
|
7001
6996
|
options.onSubmit(component, formData, shouldSkipValidation);
|
|
7002
6997
|
}
|
|
@@ -7164,11 +7159,57 @@ var resolveTranslationsInArray = (items, t, properties) => {
|
|
|
7164
7159
|
var resolveTranslationsInArray_default = resolveTranslationsInArray;
|
|
7165
7160
|
|
|
7166
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
|
+
};
|
|
7167
7203
|
var transformComponents = (response, t, resolveTranslations = true) => {
|
|
7168
7204
|
if (!response?.data?.meta?.components) {
|
|
7169
7205
|
return [];
|
|
7170
7206
|
}
|
|
7171
|
-
|
|
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
|
+
}
|
|
7172
7213
|
return resolveTranslations ? resolveTranslationsInArray_default(components, t) : components;
|
|
7173
7214
|
};
|
|
7174
7215
|
var extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic") => {
|
|
@@ -9090,8 +9131,9 @@ var BaseSignUpContent2 = ({
|
|
|
9090
9131
|
const processComponents = (comps) => {
|
|
9091
9132
|
comps.forEach((component) => {
|
|
9092
9133
|
if (component.type === EmbeddedFlowComponentType4.TextInput) {
|
|
9134
|
+
const fieldName = component.ref || component.id;
|
|
9093
9135
|
fields.push({
|
|
9094
|
-
name:
|
|
9136
|
+
name: fieldName,
|
|
9095
9137
|
required: component.required || false,
|
|
9096
9138
|
initialValue: "",
|
|
9097
9139
|
validator: (value) => {
|
|
@@ -9182,7 +9224,7 @@ var BaseSignUpContent2 = ({
|
|
|
9182
9224
|
const payload = {
|
|
9183
9225
|
...currentFlow.flowId && { flowId: currentFlow.flowId },
|
|
9184
9226
|
flowType: currentFlow.flowType || "REGISTRATION",
|
|
9185
|
-
...component.id && {
|
|
9227
|
+
...component.id && { actionId: component.id },
|
|
9186
9228
|
inputs: filteredInputs
|
|
9187
9229
|
};
|
|
9188
9230
|
const rawResponse = await onSubmit(payload);
|