@integry/sdk 4.7.37 → 4.7.39
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
|
@@ -79,6 +79,8 @@ const DynamicTypedFields = (props: DynamicFieldsProps) => {
|
|
|
79
79
|
allowWorkspaceConnectedAccounts = false,
|
|
80
80
|
tagsTree = null,
|
|
81
81
|
showMenuOnLeft = false,
|
|
82
|
+
appName = '',
|
|
83
|
+
placeHolder = '',
|
|
82
84
|
} = props;
|
|
83
85
|
|
|
84
86
|
const [dynamicItems, setDynamicItems] = useState<DynamicDataItem[]>([]);
|
|
@@ -333,6 +335,16 @@ const DynamicTypedFields = (props: DynamicFieldsProps) => {
|
|
|
333
335
|
onFieldSetChange(0, id, val, type);
|
|
334
336
|
};
|
|
335
337
|
|
|
338
|
+
const getPlaceholder = () => {
|
|
339
|
+
let placeHolderValue = 'Enter text or map to fields...';
|
|
340
|
+
if (placeHolder) {
|
|
341
|
+
placeHolderValue = placeHolder;
|
|
342
|
+
} else if (appName) {
|
|
343
|
+
placeHolderValue = `Enter text or map to ${appName} fields...`;
|
|
344
|
+
}
|
|
345
|
+
return placeHolderValue;
|
|
346
|
+
};
|
|
347
|
+
|
|
336
348
|
return html`
|
|
337
349
|
<div>
|
|
338
350
|
${loading
|
|
@@ -375,7 +387,7 @@ const DynamicTypedFields = (props: DynamicFieldsProps) => {
|
|
|
375
387
|
<${MultipurposeField}
|
|
376
388
|
id="${`${setIndex}_${el.id}`}"
|
|
377
389
|
title="${el.title}"
|
|
378
|
-
placeholder
|
|
390
|
+
placeholder=${getPlaceholder()}
|
|
379
391
|
isRequired="${el.is_required !== undefined
|
|
380
392
|
? el.is_required
|
|
381
393
|
: dynamicField.is_required}"
|
|
@@ -432,7 +444,7 @@ const DynamicTypedFields = (props: DynamicFieldsProps) => {
|
|
|
432
444
|
<${MultipurposeField}
|
|
433
445
|
id="${el.id}"
|
|
434
446
|
title="${el.title}"
|
|
435
|
-
placeholder
|
|
447
|
+
placeholder=${getPlaceholder()}
|
|
436
448
|
isRequired="${el.is_required !== undefined
|
|
437
449
|
? el.is_required
|
|
438
450
|
: dynamicField.is_required}"
|
|
@@ -53,35 +53,48 @@ export function JSONToActivityOutputData(
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export function JSONToDynamicFieldData(
|
|
56
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
56
|
obj: any,
|
|
58
57
|
parentKey = '',
|
|
59
58
|
sourceStepKey = '',
|
|
60
|
-
):
|
|
61
|
-
let result:
|
|
59
|
+
): Record<string, string[]> {
|
|
60
|
+
let result: Record<string, string[]> = {};
|
|
61
|
+
|
|
62
62
|
Object.keys(obj).forEach((key) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
let currentKey = sourceStepKey ? `${sourceStepKey}` : '';
|
|
64
|
+
currentKey += parentKey ? `${parentKey}.${key}` : key;
|
|
65
|
+
|
|
66
|
+
const value = obj[key];
|
|
67
|
+
|
|
68
|
+
if (value === null || value === undefined) {
|
|
69
|
+
result[currentKey] = [''];
|
|
70
|
+
} else if (typeof value === 'object') {
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
// Handle array elements individually
|
|
73
|
+
value.forEach((item, index) => {
|
|
74
|
+
const indexedKey = `${currentKey}.${index}`;
|
|
75
|
+
if (typeof item === 'object' && item !== null) {
|
|
76
|
+
// Recursively flatten array item
|
|
77
|
+
const flattened = JSONToDynamicFieldData(item, indexedKey);
|
|
78
|
+
result = { ...result, ...flattened };
|
|
79
|
+
} else {
|
|
80
|
+
result[indexedKey] = [item];
|
|
77
81
|
}
|
|
82
|
+
});
|
|
83
|
+
} else {
|
|
84
|
+
// Regular nested object
|
|
85
|
+
try {
|
|
86
|
+
result[currentKey] = [JSON.stringify(value)];
|
|
87
|
+
} catch {
|
|
88
|
+
result[currentKey] = [''];
|
|
78
89
|
}
|
|
90
|
+
const flattened = JSONToDynamicFieldData(value, currentKey);
|
|
79
91
|
result = { ...result, ...flattened };
|
|
80
|
-
} else if (result) {
|
|
81
|
-
result[currentKey] = [obj[key]];
|
|
82
92
|
}
|
|
93
|
+
} else {
|
|
94
|
+
result[currentKey] = [value];
|
|
83
95
|
}
|
|
84
96
|
});
|
|
97
|
+
|
|
85
98
|
return result;
|
|
86
99
|
}
|
|
87
100
|
|