@integry/sdk 4.6.51 → 4.6.52
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/package.json
CHANGED
|
@@ -78,6 +78,20 @@ const DynamicTypedFields = (props: DynamicFieldsProps) => {
|
|
|
78
78
|
const isReadOnly = context?.isReadOnly;
|
|
79
79
|
const apiHandlerRef = context?.apiHandler || props.apiHandler;
|
|
80
80
|
|
|
81
|
+
const resolveValue = (path: string, item: any): any => {
|
|
82
|
+
// If the path contains template tags, process it
|
|
83
|
+
if (/{([^}]+)}/.test(path)) {
|
|
84
|
+
return path.replace(/{([^}]+)}/g, (_, placeholder) => {
|
|
85
|
+
const keys = placeholder.split('.');
|
|
86
|
+
return keys.reduce((acc: any, key: any) => acc && acc[key], item) || '';
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Otherwise, treat it as a plain property path
|
|
91
|
+
const keys = path.split('.');
|
|
92
|
+
return keys.reduce((acc: any, key) => acc && acc[key], item);
|
|
93
|
+
};
|
|
94
|
+
|
|
81
95
|
const fetchDynamicFields = async () => {
|
|
82
96
|
if (sourceFlowIntegrataionInvocationUrl && selectedAuthId) {
|
|
83
97
|
setLoading(true);
|
|
@@ -106,8 +120,8 @@ const DynamicTypedFields = (props: DynamicFieldsProps) => {
|
|
|
106
120
|
|
|
107
121
|
if (idKeyPath && titleKeyPath) {
|
|
108
122
|
transformedItems = res.output.map((item: any) => ({
|
|
109
|
-
id:
|
|
110
|
-
title:
|
|
123
|
+
id: resolveValue(idKeyPath, item), // Use idKeyPath to access the ID
|
|
124
|
+
title: resolveValue(titleKeyPath, item), // Use titleKeyPath to access the title
|
|
111
125
|
type: 'TEXTFIELD', // Use typeKeyPath to access the type
|
|
112
126
|
}));
|
|
113
127
|
} else {
|