@asgardeo/react 0.6.29 → 0.6.31
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 -10
- package/dist/cjs/index.js.map +2 -2
- package/dist/components/primitives/Select/Select.d.ts +4 -0
- package/dist/index.js +53 -10
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -889,9 +889,7 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
|
|
|
889
889
|
});
|
|
890
890
|
}
|
|
891
891
|
async signInSilently(options) {
|
|
892
|
-
return this.
|
|
893
|
-
return this.asgardeo.signInSilently(options);
|
|
894
|
-
});
|
|
892
|
+
return this.asgardeo.signInSilently(options);
|
|
895
893
|
}
|
|
896
894
|
async signOut(...args) {
|
|
897
895
|
if (args[1] && typeof args[1] !== "function") {
|
|
@@ -3921,6 +3919,7 @@ var Select = ({
|
|
|
3921
3919
|
required,
|
|
3922
3920
|
disabled,
|
|
3923
3921
|
helperText,
|
|
3922
|
+
placeholder,
|
|
3924
3923
|
options,
|
|
3925
3924
|
style = {},
|
|
3926
3925
|
...rest
|
|
@@ -3943,7 +3942,7 @@ var Select = ({
|
|
|
3943
3942
|
style,
|
|
3944
3943
|
children: [
|
|
3945
3944
|
label && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(InputLabel_default, { required, error: hasError, children: label }),
|
|
3946
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.
|
|
3945
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3947
3946
|
"select",
|
|
3948
3947
|
{
|
|
3949
3948
|
className: selectClassName,
|
|
@@ -3951,7 +3950,10 @@ var Select = ({
|
|
|
3951
3950
|
"aria-invalid": hasError,
|
|
3952
3951
|
"aria-required": required,
|
|
3953
3952
|
...rest,
|
|
3954
|
-
children:
|
|
3953
|
+
children: [
|
|
3954
|
+
placeholder && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", disabled: true, children: placeholder }),
|
|
3955
|
+
options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: option.value, className: styles.option, children: option.label }, option.value))
|
|
3956
|
+
]
|
|
3955
3957
|
}
|
|
3956
3958
|
)
|
|
3957
3959
|
]
|
|
@@ -7175,6 +7177,32 @@ var createAuthComponentFromFlow = (component, formValues, touchedFields, formErr
|
|
|
7175
7177
|
case import_browser45.EmbeddedFlowComponentTypeV2.Divider: {
|
|
7176
7178
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Divider_default, { children: component.label || "" }, key);
|
|
7177
7179
|
}
|
|
7180
|
+
case import_browser45.EmbeddedFlowComponentTypeV2.Select: {
|
|
7181
|
+
const identifier = component.ref;
|
|
7182
|
+
const value = formValues[identifier] || "";
|
|
7183
|
+
const isTouched = touchedFields[identifier] || false;
|
|
7184
|
+
const error = isTouched ? formErrors[identifier] : void 0;
|
|
7185
|
+
const selectOptions = (component.options || []).map((opt) => ({
|
|
7186
|
+
value: typeof opt === "string" ? opt : String(opt.value ?? ""),
|
|
7187
|
+
label: typeof opt === "string" ? opt : String(opt.label ?? opt.value ?? "")
|
|
7188
|
+
}));
|
|
7189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
7190
|
+
Select_default,
|
|
7191
|
+
{
|
|
7192
|
+
name: identifier,
|
|
7193
|
+
label: component.label || "",
|
|
7194
|
+
placeholder: component.placeholder,
|
|
7195
|
+
required: component.required,
|
|
7196
|
+
options: selectOptions,
|
|
7197
|
+
value,
|
|
7198
|
+
error,
|
|
7199
|
+
onChange: (e) => onInputChange(identifier, e.target.value),
|
|
7200
|
+
onBlur: () => options.onInputBlur?.(identifier),
|
|
7201
|
+
className: options.inputClassName
|
|
7202
|
+
},
|
|
7203
|
+
key
|
|
7204
|
+
);
|
|
7205
|
+
}
|
|
7178
7206
|
case import_browser45.EmbeddedFlowComponentTypeV2.Block: {
|
|
7179
7207
|
if (component.components && component.components.length > 0) {
|
|
7180
7208
|
const blockComponents = component.components.map(
|
|
@@ -7318,12 +7346,25 @@ var createActionRefMapping = (response) => {
|
|
|
7318
7346
|
}
|
|
7319
7347
|
return mapping;
|
|
7320
7348
|
};
|
|
7321
|
-
var applyInputRefMapping = (components, refMapping, actionMapping) => {
|
|
7349
|
+
var applyInputRefMapping = (components, refMapping, actionMapping, inputsData = []) => {
|
|
7322
7350
|
return components.map((component) => {
|
|
7323
7351
|
const transformedComponent = { ...component };
|
|
7324
7352
|
if (transformedComponent.ref && refMapping.has(transformedComponent.ref)) {
|
|
7325
7353
|
transformedComponent.ref = refMapping.get(transformedComponent.ref);
|
|
7326
7354
|
}
|
|
7355
|
+
if (transformedComponent.type === "SELECT" && component.id) {
|
|
7356
|
+
const inputData = inputsData.find((input) => input.ref === component.id);
|
|
7357
|
+
if (inputData?.options) {
|
|
7358
|
+
transformedComponent.options = inputData.options.map((opt) => {
|
|
7359
|
+
if (typeof opt === "string") {
|
|
7360
|
+
return { value: opt, label: opt };
|
|
7361
|
+
}
|
|
7362
|
+
const value = typeof opt.value === "object" ? JSON.stringify(opt.value) : String(opt.value || "");
|
|
7363
|
+
const label = typeof opt.label === "object" ? JSON.stringify(opt.label) : String(opt.label || value);
|
|
7364
|
+
return { value, label };
|
|
7365
|
+
});
|
|
7366
|
+
}
|
|
7367
|
+
}
|
|
7327
7368
|
if (transformedComponent.type === "ACTION" && transformedComponent.id && actionMapping.has(transformedComponent.id)) {
|
|
7328
7369
|
transformedComponent.actionRef = actionMapping.get(transformedComponent.id);
|
|
7329
7370
|
}
|
|
@@ -7331,7 +7372,8 @@ var applyInputRefMapping = (components, refMapping, actionMapping) => {
|
|
|
7331
7372
|
transformedComponent.components = applyInputRefMapping(
|
|
7332
7373
|
transformedComponent.components,
|
|
7333
7374
|
refMapping,
|
|
7334
|
-
actionMapping
|
|
7375
|
+
actionMapping,
|
|
7376
|
+
inputsData
|
|
7335
7377
|
);
|
|
7336
7378
|
}
|
|
7337
7379
|
return transformedComponent;
|
|
@@ -7344,8 +7386,9 @@ var transformComponents = (response, t, resolveTranslations = true) => {
|
|
|
7344
7386
|
let components = response.data.meta.components;
|
|
7345
7387
|
const refMapping = createInputRefMapping(response);
|
|
7346
7388
|
const actionMapping = createActionRefMapping(response);
|
|
7347
|
-
|
|
7348
|
-
|
|
7389
|
+
const inputsData = response?.data?.inputs || [];
|
|
7390
|
+
if (refMapping.size > 0 || actionMapping.size > 0 || inputsData.length > 0) {
|
|
7391
|
+
components = applyInputRefMapping(components, refMapping, actionMapping, inputsData);
|
|
7349
7392
|
}
|
|
7350
7393
|
return resolveTranslations ? resolveTranslationsInArray_default(components, t) : components;
|
|
7351
7394
|
};
|
|
@@ -9256,7 +9299,7 @@ var BaseSignUpContent2 = ({
|
|
|
9256
9299
|
const fields = [];
|
|
9257
9300
|
const processComponents = (comps) => {
|
|
9258
9301
|
comps.forEach((component) => {
|
|
9259
|
-
if (component.type === import_browser59.EmbeddedFlowComponentTypeV2.TextInput || component.type === import_browser59.EmbeddedFlowComponentTypeV2.PasswordInput || component.type === import_browser59.EmbeddedFlowComponentTypeV2.EmailInput) {
|
|
9302
|
+
if (component.type === import_browser59.EmbeddedFlowComponentTypeV2.TextInput || component.type === import_browser59.EmbeddedFlowComponentTypeV2.PasswordInput || component.type === import_browser59.EmbeddedFlowComponentTypeV2.EmailInput || component.type === import_browser59.EmbeddedFlowComponentTypeV2.Select) {
|
|
9260
9303
|
const fieldName = component.ref || component.id;
|
|
9261
9304
|
fields.push({
|
|
9262
9305
|
name: fieldName,
|