@integry/sdk 4.6.44 → 4.6.46
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/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/BasicSelect/index.ts +47 -38
- package/src/components/Input/Input/index.ts +1 -1
- package/src/components/Input/Input/styles.module.scss +2 -0
- package/src/components/Listbox/index.ts +21 -12
- package/src/components/MultipurposeField/Dropdown/index.tsx +1 -1
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +2 -0
- package/src/components/MultipurposeField/index.tsx +6 -2
- package/src/components/TagsMenu/styles.module.scss +4 -2
- package/src/components/TextArea/index.ts +1 -1
- package/src/components/TextArea/styles.module.scss +2 -0
- package/src/components/form/FunctionField/index.ts +64 -14
- package/src/features/common/FunctionForm/index.ts +380 -182
- package/src/features/common/FunctionForm/styles.module.scss +56 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
/* eslint-disable no-nested-ternary */
|
|
2
4
|
import { html, Component } from 'htm/preact';
|
|
3
5
|
import { connect } from 'unistore/preact';
|
|
@@ -6,11 +8,10 @@ import { useContext } from 'preact/hooks';
|
|
|
6
8
|
import { ListBox } from '@/components/MultipurposeField/Dropdown';
|
|
7
9
|
import { actionFunctions } from '@/store';
|
|
8
10
|
import { Button } from '@/components/Button';
|
|
9
|
-
import { StoreType } from '@/types/store';
|
|
11
|
+
import type { StoreType } from '@/types/store';
|
|
10
12
|
import { MultipurposeField } from '@/components/MultipurposeField';
|
|
11
13
|
import DynamicTypedField from '@/features/common/DynamicTypedField';
|
|
12
14
|
import ConfigureFieldWrapper from '@/components/ConfigureFieldWrapper';
|
|
13
|
-
import { CheckboxGroup } from '@/components/CheckboxGroup';
|
|
14
15
|
import AppContext from '@/contexts/AppContext';
|
|
15
16
|
import { ObjectField } from '@/components/form/ObjectField';
|
|
16
17
|
import { LargeLoader } from '@/components/LargeLoader';
|
|
@@ -33,6 +34,13 @@ interface FunctionFormPropsType extends StoreType {
|
|
|
33
34
|
customSaveCallback?: (response: any) => void; // Optional callback: Helps the implementor to implement their own save button
|
|
34
35
|
showMappingMenu?: boolean; // Optional prop to show mapping menu
|
|
35
36
|
forceShowAllFields?: boolean; // Optional prop to show all fields including hidden fields
|
|
37
|
+
enableAIAssist?: boolean; // New prop for enabling AI assist feature
|
|
38
|
+
defaultAIAssistedFields?: string[]; // New prop for field IDs that should have AI assist enabled by default
|
|
39
|
+
onAIAssistToggle?: (
|
|
40
|
+
fieldId: string,
|
|
41
|
+
enabled: boolean,
|
|
42
|
+
allAIAssistedFields: string[],
|
|
43
|
+
) => void; // Callback when AI assist toggle changes
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
interface ActionFormStateType {
|
|
@@ -43,6 +51,7 @@ interface ActionFormStateType {
|
|
|
43
51
|
invalidFields: any;
|
|
44
52
|
parentFields: any;
|
|
45
53
|
parentFieldsChanged: boolean;
|
|
54
|
+
aiAssistedFields: string[]; // New state to track fields with AI assist enabled
|
|
46
55
|
}
|
|
47
56
|
|
|
48
57
|
interface StepDataMapping {
|
|
@@ -68,6 +77,7 @@ class FunctionForm extends Component<
|
|
|
68
77
|
invalidFields: [],
|
|
69
78
|
parentFields: [],
|
|
70
79
|
parentFieldsChanged: false,
|
|
80
|
+
aiAssistedFields: [], // Initialize empty array for AI assisted fields
|
|
71
81
|
};
|
|
72
82
|
}
|
|
73
83
|
|
|
@@ -103,6 +113,7 @@ class FunctionForm extends Component<
|
|
|
103
113
|
argumentsData[key].meta.ui.default_value ||
|
|
104
114
|
'';
|
|
105
115
|
|
|
116
|
+
// Only add to invalidFields if not AI assisted
|
|
106
117
|
if (argumentsData[key].meta.is_required && !args[key]) {
|
|
107
118
|
this.setState((prevState) => ({
|
|
108
119
|
invalidFields: prevState.invalidFields.includes(key)
|
|
@@ -139,6 +150,57 @@ class FunctionForm extends Component<
|
|
|
139
150
|
dynamicFieldDataState: args,
|
|
140
151
|
});
|
|
141
152
|
|
|
153
|
+
// Enable AI assist for default fields if provided
|
|
154
|
+
if (
|
|
155
|
+
this.props.enableAIAssist &&
|
|
156
|
+
this.props.defaultAIAssistedFields &&
|
|
157
|
+
this.props.defaultAIAssistedFields.length > 0
|
|
158
|
+
) {
|
|
159
|
+
const validFieldIds = Object.keys(response.parameters.properties);
|
|
160
|
+
const defaultAIFields = this.props.defaultAIAssistedFields.filter(
|
|
161
|
+
(fieldId) => validFieldIds.includes(fieldId),
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
if (defaultAIFields.length > 0) {
|
|
165
|
+
this.setState((prevState) => {
|
|
166
|
+
// Create new arrays to avoid mutating state directly
|
|
167
|
+
const newAIAssistedFields = [
|
|
168
|
+
...prevState.aiAssistedFields,
|
|
169
|
+
...defaultAIFields,
|
|
170
|
+
];
|
|
171
|
+
const newInvalidFields = prevState.invalidFields.filter(
|
|
172
|
+
(fieldId: string) => !defaultAIFields.includes(fieldId),
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// Notify parent component about the default AI assisted fields
|
|
176
|
+
if (this.props.onAIAssistToggle && defaultAIFields.length > 0) {
|
|
177
|
+
// Call once for each field to ensure proper tracking
|
|
178
|
+
defaultAIFields.forEach((fieldId) => {
|
|
179
|
+
this.props.onAIAssistToggle!(
|
|
180
|
+
fieldId,
|
|
181
|
+
true,
|
|
182
|
+
newAIAssistedFields,
|
|
183
|
+
);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// If we have a custom save callback, notify it about the changes
|
|
188
|
+
if (this.props.customSaveCallback) {
|
|
189
|
+
// Get current data state but exclude AI assisted fields
|
|
190
|
+
this.props.customSaveCallback({
|
|
191
|
+
hasInvalidFields: newInvalidFields.length > 0,
|
|
192
|
+
data: args,
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return {
|
|
197
|
+
aiAssistedFields: newAIAssistedFields,
|
|
198
|
+
invalidFields: newInvalidFields,
|
|
199
|
+
};
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
142
204
|
this.setState({ loading: false });
|
|
143
205
|
});
|
|
144
206
|
}
|
|
@@ -153,17 +215,26 @@ class FunctionForm extends Component<
|
|
|
153
215
|
return arr;
|
|
154
216
|
};
|
|
155
217
|
|
|
156
|
-
private onSubmit = (
|
|
218
|
+
private onSubmit = (
|
|
219
|
+
event: any,
|
|
220
|
+
returnResponse = false,
|
|
221
|
+
AIAssistFieldId = '',
|
|
222
|
+
) => {
|
|
157
223
|
this.setState({ isSubmitting: true });
|
|
158
224
|
const { functionName } = this.props;
|
|
159
225
|
const { functionDetails } = this.state;
|
|
160
226
|
const args: { [key: string]: any } = {};
|
|
161
|
-
const { dynamicFieldDataState } = this.state;
|
|
227
|
+
const { dynamicFieldDataState, aiAssistedFields } = this.state;
|
|
162
228
|
|
|
163
229
|
Object.keys(dynamicFieldDataState).forEach((key: string) => {
|
|
164
230
|
const fieldDetails = functionDetails.parameters.properties[key];
|
|
165
231
|
let value = dynamicFieldDataState[key] || '';
|
|
166
232
|
|
|
233
|
+
// If field is AI assisted, mark it in the submission
|
|
234
|
+
if (aiAssistedFields.includes(key) || key === AIAssistFieldId) {
|
|
235
|
+
return; // Skip further processing for this field
|
|
236
|
+
}
|
|
237
|
+
|
|
167
238
|
// Check for field type and cast value
|
|
168
239
|
if (fieldDetails) {
|
|
169
240
|
switch (fieldDetails.type) {
|
|
@@ -305,9 +376,17 @@ class FunctionForm extends Component<
|
|
|
305
376
|
};
|
|
306
377
|
});
|
|
307
378
|
|
|
379
|
+
// Skip validation for AI assisted fields
|
|
380
|
+
if (this.state.aiAssistedFields.includes(fieldId)) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
|
|
308
384
|
const isValid = true;
|
|
309
385
|
let hasInvalidFields = Object.keys(this.state.dynamicFieldDataState).some(
|
|
310
|
-
(key) =>
|
|
386
|
+
(key) =>
|
|
387
|
+
key !== fieldId &&
|
|
388
|
+
this.state.invalidFields.includes(key) &&
|
|
389
|
+
!this.state.aiAssistedFields.includes(key),
|
|
311
390
|
);
|
|
312
391
|
|
|
313
392
|
if (value && isValid) {
|
|
@@ -340,6 +419,63 @@ class FunctionForm extends Component<
|
|
|
340
419
|
}
|
|
341
420
|
};
|
|
342
421
|
|
|
422
|
+
// New method to toggle AI assist for a field
|
|
423
|
+
toggleAIAssist = (fieldId: string, enabled: boolean) => {
|
|
424
|
+
this.setState((prevState) => {
|
|
425
|
+
let newAIAssistedFields = [...prevState.aiAssistedFields];
|
|
426
|
+
let newInvalidFields = [...prevState.invalidFields];
|
|
427
|
+
|
|
428
|
+
if (enabled) {
|
|
429
|
+
// Add to AI assisted fields if not already there
|
|
430
|
+
if (!newAIAssistedFields.includes(fieldId)) {
|
|
431
|
+
newAIAssistedFields.push(fieldId);
|
|
432
|
+
}
|
|
433
|
+
// Remove from invalid fields if it was there
|
|
434
|
+
newInvalidFields = newInvalidFields.filter(
|
|
435
|
+
(field) => field !== fieldId,
|
|
436
|
+
);
|
|
437
|
+
} else {
|
|
438
|
+
// Remove from AI assisted fields
|
|
439
|
+
newAIAssistedFields = newAIAssistedFields.filter(
|
|
440
|
+
(field) => field !== fieldId,
|
|
441
|
+
);
|
|
442
|
+
|
|
443
|
+
// Check if field should be marked as invalid
|
|
444
|
+
const fieldDetails =
|
|
445
|
+
prevState.functionDetails.parameters?.properties[fieldId];
|
|
446
|
+
const fieldValue = prevState.dynamicFieldDataState[fieldId];
|
|
447
|
+
|
|
448
|
+
if (
|
|
449
|
+
fieldDetails?.meta.is_required &&
|
|
450
|
+
(!fieldValue || fieldValue === '')
|
|
451
|
+
) {
|
|
452
|
+
if (!newInvalidFields.includes(fieldId)) {
|
|
453
|
+
newInvalidFields.push(fieldId);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Call the onAIAssistToggle callback if provided
|
|
459
|
+
if (this.props.onAIAssistToggle) {
|
|
460
|
+
this.props.onAIAssistToggle(fieldId, enabled, newAIAssistedFields);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
if (this.props.customSaveCallback) {
|
|
464
|
+
// we have communciate back to the custom save callback with the updated state
|
|
465
|
+
const currentDataState = this.onSubmit({}, true, fieldId);
|
|
466
|
+
this.props.customSaveCallback({
|
|
467
|
+
hasInvalidFields: newInvalidFields.length > 0,
|
|
468
|
+
data: currentDataState,
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
return {
|
|
473
|
+
aiAssistedFields: newAIAssistedFields,
|
|
474
|
+
invalidFields: newInvalidFields,
|
|
475
|
+
};
|
|
476
|
+
});
|
|
477
|
+
};
|
|
478
|
+
|
|
343
479
|
replacePlaceholders = (
|
|
344
480
|
templateObj: { [key: string]: any },
|
|
345
481
|
dictionary: { [key: string]: any },
|
|
@@ -424,6 +560,37 @@ class FunctionForm extends Component<
|
|
|
424
560
|
return data;
|
|
425
561
|
};
|
|
426
562
|
|
|
563
|
+
// Custom wrapper for ConfigureFieldWrapper to add AI assist toggle
|
|
564
|
+
renderFieldWrapper = (field: any, children: any) => {
|
|
565
|
+
const { enableAIAssist } = this.props;
|
|
566
|
+
const isAIAssisted = this.state.aiAssistedFields.includes(field.id);
|
|
567
|
+
|
|
568
|
+
if (!enableAIAssist) {
|
|
569
|
+
return html`<${ConfigureFieldWrapper} field=${field}>${children}<//>`;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// Add AI assist toggle to the field wrapper
|
|
573
|
+
return html`
|
|
574
|
+
<${ConfigureFieldWrapper} field=${field}>
|
|
575
|
+
<div class="${styles.fieldWrapperWithAIAssist}">
|
|
576
|
+
<div class="${styles.aiAssistToggleContainer}">
|
|
577
|
+
<label class="${styles.aiAssistToggleLabel}">
|
|
578
|
+
<span>AI assist</span>
|
|
579
|
+
<input
|
|
580
|
+
type="checkbox"
|
|
581
|
+
class="${styles.aiAssistToggle}"
|
|
582
|
+
checked=${isAIAssisted}
|
|
583
|
+
onChange=${(e: any) =>
|
|
584
|
+
this.toggleAIAssist(field.id, e.target.checked)}
|
|
585
|
+
/>
|
|
586
|
+
</label>
|
|
587
|
+
</div>
|
|
588
|
+
${children}
|
|
589
|
+
</div>
|
|
590
|
+
<//>
|
|
591
|
+
`;
|
|
592
|
+
};
|
|
593
|
+
|
|
427
594
|
renderFields = (
|
|
428
595
|
properties: any,
|
|
429
596
|
functionArguments: any,
|
|
@@ -517,92 +684,107 @@ class FunctionForm extends Component<
|
|
|
517
684
|
return null;
|
|
518
685
|
}
|
|
519
686
|
|
|
687
|
+
// Check if field has AI assist enabled
|
|
688
|
+
const isAIAssisted = this.state.aiAssistedFields.includes(field.id);
|
|
689
|
+
// Set placeholder text for AI assisted fields
|
|
690
|
+
const aiPlaceholder = isAIAssisted
|
|
691
|
+
? field.placeholder
|
|
692
|
+
: field.placeholder;
|
|
693
|
+
|
|
520
694
|
switch (field.type) {
|
|
521
695
|
case 'TEXTFIELD':
|
|
522
696
|
fieldElement = html`
|
|
523
697
|
<div class="${styles.functionFieldWrap} integry-action-field-wrap">
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
698
|
+
${this.renderFieldWrapper(
|
|
699
|
+
field,
|
|
700
|
+
html`
|
|
701
|
+
<${MultipurposeField}
|
|
702
|
+
id="${field.id}"
|
|
703
|
+
title="${field.title}"
|
|
704
|
+
activityOutputData=${arrayToNestedJSONWithFirstValue(
|
|
705
|
+
JSONToActivityOutputData(this.props.variables || {}),
|
|
706
|
+
JSONToDynamicFieldData(this.props.variables || {}),
|
|
707
|
+
)}
|
|
708
|
+
activityOutputDataRaw=${JSONToActivityOutputData(
|
|
709
|
+
this.props.variables || {},
|
|
710
|
+
)}
|
|
711
|
+
description="${field.description}"
|
|
712
|
+
value=${this.state.dynamicFieldDataState[field.id]}
|
|
713
|
+
placeholder="${aiPlaceholder}"
|
|
714
|
+
regex=${field.regex}
|
|
715
|
+
regexErrorMessage=${field.regexErrorMessage}
|
|
716
|
+
isRequired="${field.is_required}"
|
|
717
|
+
onChange=${(val: any) => {
|
|
718
|
+
this.onFieldChange(
|
|
719
|
+
field.id,
|
|
720
|
+
val,
|
|
721
|
+
field.dataType,
|
|
722
|
+
field.is_required,
|
|
723
|
+
parentFieldId,
|
|
724
|
+
);
|
|
725
|
+
}}
|
|
726
|
+
type=${fieldType}
|
|
727
|
+
isMappable=${this.props.variables &&
|
|
728
|
+
Object.entries(this.props.variables).length > 0 &&
|
|
729
|
+
field.dataType !== 'array'}
|
|
730
|
+
isEditable=${true}
|
|
731
|
+
isDisabled=${isAIAssisted}
|
|
732
|
+
allowTagsInText=${this.props.variables}
|
|
733
|
+
fieldId=${field.id}
|
|
734
|
+
isArray=${field.dataType === 'array'}
|
|
735
|
+
tagsTree=${this.props.showMappingMenu
|
|
736
|
+
? this.props.variables
|
|
737
|
+
: null}
|
|
738
|
+
><//>
|
|
739
|
+
`,
|
|
740
|
+
)}
|
|
563
741
|
</div>
|
|
564
742
|
`;
|
|
565
743
|
break;
|
|
566
744
|
case 'TEXTAREA':
|
|
567
745
|
fieldElement = html`
|
|
568
746
|
<div class="${styles.functionFieldWrap} integry-action-field-wrap">
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
747
|
+
${this.renderFieldWrapper(
|
|
748
|
+
field,
|
|
749
|
+
html`
|
|
750
|
+
<${MultipurposeField}
|
|
751
|
+
id="${field.id}"
|
|
752
|
+
title="${field.title}"
|
|
753
|
+
activityOutputData=${arrayToNestedJSONWithFirstValue(
|
|
754
|
+
JSONToActivityOutputData(this.props.variables || {}),
|
|
755
|
+
JSONToDynamicFieldData(this.props.variables || {}),
|
|
756
|
+
)}
|
|
757
|
+
activityOutputDataRaw=${JSONToActivityOutputData(
|
|
758
|
+
this.props.variables || {},
|
|
759
|
+
)}
|
|
760
|
+
description="${field.description}"
|
|
761
|
+
value=${this.state.dynamicFieldDataState[field.id]}
|
|
762
|
+
placeholder="${aiPlaceholder}"
|
|
763
|
+
isRequired=${field.is_required}
|
|
764
|
+
isDisabled="${isAIAssisted}"
|
|
765
|
+
isEditable="${field.is_editable}"
|
|
766
|
+
fieldId=${field.id}
|
|
767
|
+
onChange=${(val: any) => {
|
|
768
|
+
this.onFieldChange(
|
|
769
|
+
field.id,
|
|
770
|
+
val,
|
|
771
|
+
field.dataType,
|
|
772
|
+
field.is_required,
|
|
773
|
+
parentFieldId,
|
|
774
|
+
);
|
|
775
|
+
}}
|
|
776
|
+
regex=${field.regex}
|
|
777
|
+
regexErrorMessage=${field.regexErrorMessage}
|
|
778
|
+
type=${fieldType}
|
|
779
|
+
isMappable=${this.props.variables &&
|
|
780
|
+
Object.entries(this.props.variables).length > 0}
|
|
781
|
+
allowTagsInText=${this.props.variables}
|
|
782
|
+
tagsTree=${this.props.showMappingMenu
|
|
783
|
+
? this.props.variables
|
|
784
|
+
: null}
|
|
785
|
+
><//>
|
|
786
|
+
`,
|
|
787
|
+
)}
|
|
606
788
|
</div>
|
|
607
789
|
`;
|
|
608
790
|
break;
|
|
@@ -612,56 +794,61 @@ class FunctionForm extends Component<
|
|
|
612
794
|
isDynamic = field.type === 'DYNAMIC_DROPDOWN';
|
|
613
795
|
fieldElement = html`
|
|
614
796
|
<div class="${styles.functionFieldWrap} integry-action-field-wrap">
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
797
|
+
${this.renderFieldWrapper(
|
|
798
|
+
field,
|
|
799
|
+
html`
|
|
800
|
+
<${ListBox}
|
|
801
|
+
key=${field.id}
|
|
802
|
+
fieldId=${field.id}
|
|
803
|
+
apiHandler=${this.props.apiHandler}
|
|
804
|
+
title=${field.title}
|
|
805
|
+
description=${field.description}
|
|
806
|
+
placeholder=${aiPlaceholder}
|
|
807
|
+
isRequired=${field.is_required}
|
|
808
|
+
value=${this.state.dynamicFieldDataState[field.id]}
|
|
809
|
+
endpointUrl=${isDynamic
|
|
810
|
+
? field.endpointURL
|
|
811
|
+
: JSON.stringify(options)}
|
|
812
|
+
isDynamic=${isDynamic}
|
|
813
|
+
optionKeyPath=${field.valueKeyPath}
|
|
814
|
+
valueKeyPath=${field.optionKeyPath}
|
|
815
|
+
endpointData=${field.dependsOn.length > 0
|
|
816
|
+
? JSON.stringify({
|
|
817
|
+
authorization_id: `${connectedAccount}`,
|
|
818
|
+
...this.fetchDynamicData(field),
|
|
819
|
+
})
|
|
820
|
+
: null}
|
|
821
|
+
type=${`${fieldType}`}
|
|
822
|
+
isDisabled="${isAIAssisted}"
|
|
823
|
+
isEditable=${field.type === 'DYNAMIC_DROPDOWN'}
|
|
824
|
+
isSearchable=${true}
|
|
825
|
+
isMappable=${this.props.showMappingMenu &&
|
|
826
|
+
field.type !== 'DYNAMIC_DROPDOWN'}
|
|
827
|
+
appName=${`${appName}`}
|
|
828
|
+
isMultiSelect=${field.isMultiSelect}
|
|
829
|
+
onChange=${(val: any, stopChangePropagation = false) => {
|
|
830
|
+
this.onFieldChange(
|
|
831
|
+
field.id,
|
|
832
|
+
val,
|
|
833
|
+
field.dataType,
|
|
834
|
+
field.is_required,
|
|
835
|
+
parentFieldId,
|
|
836
|
+
-1,
|
|
837
|
+
stopChangePropagation,
|
|
838
|
+
);
|
|
839
|
+
}}
|
|
840
|
+
dataSourceBody=${this.replacePlaceholders(
|
|
841
|
+
field.dataSourceBody,
|
|
842
|
+
this.state.dynamicFieldDataState,
|
|
843
|
+
)}
|
|
844
|
+
selectedAuthId=${`${connectedAccount}`}
|
|
845
|
+
tagsTree=${this.props.showMappingMenu
|
|
846
|
+
? this.props.variables
|
|
847
|
+
: null}
|
|
848
|
+
isReadOnly=${isAIAssisted}
|
|
849
|
+
><//>
|
|
850
|
+
`,
|
|
851
|
+
)}
|
|
665
852
|
</div>
|
|
666
853
|
`;
|
|
667
854
|
break;
|
|
@@ -675,40 +862,46 @@ class FunctionForm extends Component<
|
|
|
675
862
|
key=${field.id}
|
|
676
863
|
class=${`${styles.actionStepFieldWrap} integry-action-field-wrap`}
|
|
677
864
|
>
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
865
|
+
${this.renderFieldWrapper(
|
|
866
|
+
field,
|
|
867
|
+
html`
|
|
868
|
+
<${DynamicTypedField}
|
|
869
|
+
dynamicField=${field}
|
|
870
|
+
endpointData=${JSON.stringify({
|
|
871
|
+
authorization_id: `${connectedAccount}`,
|
|
872
|
+
})}
|
|
873
|
+
placeHolder=${aiPlaceholder}
|
|
874
|
+
appName=${`${appName}`}
|
|
875
|
+
selectedAuthId=${`${connectedAccount}`}
|
|
876
|
+
sourceFlowIntegrataionInvocationUrl=${field.endpointURL}
|
|
877
|
+
isMappable=${Object.entries(this.props.variables || {})
|
|
878
|
+
.length > 0}
|
|
879
|
+
isDisabled=${isAIAssisted}
|
|
880
|
+
isEditable=${false}
|
|
881
|
+
allowTagsInText=${true}
|
|
882
|
+
apiHandler=${this.props.apiHandler}
|
|
883
|
+
idKeyPath=${field.idKeyPath}
|
|
884
|
+
typeKeyPath=${field.typeKeyPath}
|
|
885
|
+
titleKeyPath=${field.titleKeyPath}
|
|
886
|
+
onChange=${(val: any) => {
|
|
887
|
+
this.onFieldChange(field.id, val, field.dataType, false);
|
|
888
|
+
}}
|
|
889
|
+
dataSourceBody=${this.replacePlaceholders(
|
|
890
|
+
field.dataSourceBody,
|
|
891
|
+
this.state.dynamicFieldDataState,
|
|
892
|
+
)}
|
|
893
|
+
parentFieldsChanged=${this.state.parentFieldsChanged}
|
|
894
|
+
activityOutputData=${arrayToNestedJSONWithFirstValue(
|
|
895
|
+
JSONToActivityOutputData(this.props.variables || {}),
|
|
896
|
+
JSONToDynamicFieldData(this.props.variables || {}),
|
|
897
|
+
)}
|
|
898
|
+
activityOutputDataRaw=${JSONToActivityOutputData(
|
|
899
|
+
this.props.variables || {},
|
|
900
|
+
)}
|
|
901
|
+
value=${this.state.dynamicFieldDataState[field.id] || {}}
|
|
902
|
+
/>
|
|
903
|
+
`,
|
|
904
|
+
)}
|
|
712
905
|
</div>
|
|
713
906
|
`;
|
|
714
907
|
|
|
@@ -720,22 +913,27 @@ class FunctionForm extends Component<
|
|
|
720
913
|
<div
|
|
721
914
|
class="${styles.functionFieldWrap} integry-action-field-wrap"
|
|
722
915
|
>
|
|
723
|
-
|
|
724
|
-
field
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
916
|
+
${this.renderFieldWrapper(
|
|
917
|
+
field,
|
|
918
|
+
html`
|
|
919
|
+
<${ObjectField}
|
|
920
|
+
field=${field}
|
|
921
|
+
functionArguments=${functionArguments}
|
|
922
|
+
connectedAccount=${connectedAccount}
|
|
923
|
+
appName=${appName}
|
|
924
|
+
onChange=${this.onFieldChange}
|
|
925
|
+
apiHandler=${this.props.apiHandler}
|
|
926
|
+
isArray=${field.dataType === 'array'}
|
|
927
|
+
activityOutputData=${arrayToNestedJSONWithFirstValue(
|
|
928
|
+
JSONToActivityOutputData(this.props.variables || {}),
|
|
929
|
+
JSONToDynamicFieldData(this.props.variables || {}),
|
|
930
|
+
)}
|
|
931
|
+
activityOutputDataRaw=${JSONToActivityOutputData(
|
|
932
|
+
this.props.variables || {},
|
|
933
|
+
)}
|
|
934
|
+
/>
|
|
935
|
+
`,
|
|
936
|
+
)}
|
|
739
937
|
</div>
|
|
740
938
|
`;
|
|
741
939
|
}
|
|
@@ -748,7 +946,7 @@ class FunctionForm extends Component<
|
|
|
748
946
|
|
|
749
947
|
return html`
|
|
750
948
|
<div class="${styles.functionFieldWrap} integry-action-field-wrap">
|
|
751
|
-
|
|
949
|
+
${fieldElement}
|
|
752
950
|
</div>
|
|
753
951
|
`;
|
|
754
952
|
});
|