@integry/sdk 4.5.41 → 4.5.43

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integry/sdk",
3
- "version": "4.5.41",
3
+ "version": "4.5.43",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -21,6 +21,7 @@ interface ObjectFieldProps {
21
21
  parentFieldId?: string,
22
22
  index?: number,
23
23
  ) => void;
24
+ onChangeInFlow?: (val: string) => void;
24
25
  apiHandler: any;
25
26
  isArray?: boolean; // New prop to check if the input is an array
26
27
  activityOutputData: any;
@@ -95,6 +96,7 @@ const ObjectField = (props: ObjectFieldProps) => {
95
96
  connectedAccount,
96
97
  appName,
97
98
  onChange,
99
+ onChangeInFlow,
98
100
  apiHandler,
99
101
  isArray = false, // Default to false
100
102
  activityOutputData,
@@ -102,6 +104,7 @@ const ObjectField = (props: ObjectFieldProps) => {
102
104
  } = props;
103
105
  const [objectArray, setObjectArray] = useState<FieldObject[]>([{}]); // Start with one empty object in the array
104
106
  const [showAddMoreOption, setShowAddMoreOption] = useState(true);
107
+ const [objectHasFields, setObjectHasFields] = useState(true);
105
108
 
106
109
  let templateFields = [];
107
110
 
@@ -109,9 +112,10 @@ const ObjectField = (props: ObjectFieldProps) => {
109
112
  if (field.template_fields.length > 0) {
110
113
  templateFields = field.template_fields;
111
114
  } else if (field.type === 'TEXTAREA' || field.type === 'DYNAMIC') {
112
- if (field.data_type === 'OBJECT[]') {
115
+ if (field.data_type === 'OBJECT[]' || field.data_type === 'OBJECT') {
113
116
  field.type = 'TEXTAREA';
114
117
  setShowAddMoreOption(false);
118
+ setObjectHasFields(false);
115
119
  }
116
120
 
117
121
  templateFields = [field];
@@ -122,6 +126,7 @@ const ObjectField = (props: ObjectFieldProps) => {
122
126
  field.properties = null;
123
127
  templateFields = [field];
124
128
  setShowAddMoreOption(false);
129
+ setObjectHasFields(false);
125
130
  }
126
131
  const normalizedField = {
127
132
  ...field,
@@ -146,15 +151,22 @@ const ObjectField = (props: ObjectFieldProps) => {
146
151
  setObjectArray(updatedObjectArray);
147
152
 
148
153
  // Optionally trigger the parent change handler
154
+ const isFlow = !field.properties && !!field.template_fields;
149
155
  if (isArray) {
150
- onChange(
151
- fieldId,
152
- updatedObjectArray,
153
- dataType,
154
- field.is_required,
155
- field.id,
156
- index,
157
- );
156
+ if (isFlow && onChangeInFlow) {
157
+ onChangeInFlow(value);
158
+ } else {
159
+ onChange(
160
+ fieldId,
161
+ updatedObjectArray,
162
+ dataType,
163
+ field.is_required,
164
+ field.id,
165
+ index,
166
+ );
167
+ }
168
+ } else if (isFlow && onChangeInFlow) {
169
+ onChangeInFlow(value);
158
170
  } else {
159
171
  onChange(fieldId, value, dataType, field.is_required, field.id);
160
172
  }
@@ -328,8 +340,9 @@ const ObjectField = (props: ObjectFieldProps) => {
328
340
  ${objectArray.map(
329
341
  (_, index) =>
330
342
  html`
331
- <div class="${styles.objectFieldWrap}">
332
- <div class="${styles.label}">
343
+ <div class="${objectHasFields ? styles.objectFieldWrap : ''}">
344
+ ${objectHasFields &&
345
+ html`<div class="${styles.label}">
333
346
  <label class="${styles.subLabel}">
334
347
  <div>
335
348
  ${field.title}${isArray ? ` ${index + 1}` : ''}
@@ -371,7 +384,7 @@ const ObjectField = (props: ObjectFieldProps) => {
371
384
  </div>
372
385
  <div>${field.description}</div>
373
386
  </label>
374
- </div>
387
+ </div>`}
375
388
  ${renderFields(normalizedField.properties, index)}
376
389
  </div>
377
390
  `,
@@ -1560,6 +1560,16 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1560
1560
  <${ObjectField}
1561
1561
  field=${el}
1562
1562
  onChange=${this.onFieldChange}
1563
+ onChangeInFlow=${(val: string) => {
1564
+ this.onFieldChange({
1565
+ stepId: step.id,
1566
+ fieldId: el.id,
1567
+ value: val,
1568
+ isRequired: el.is_required,
1569
+ machineName:
1570
+ el.activity_field?.machine_name,
1571
+ });
1572
+ }}
1563
1573
  apiHandler=${this.props.apiHandler}
1564
1574
  isArray=${fieldType === 'OBJECT[]'}
1565
1575
  activityOutputData=${this.arrayToNestedJSONWithFirstValue(