@integry/sdk 4.6.25 → 4.6.26

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.6.25",
3
+ "version": "4.6.26",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -279,7 +279,7 @@ const ListBox = (props: ListBoxProps) => {
279
279
  setLoading(true);
280
280
  let data;
281
281
  try {
282
- if (endpointData.indexOf('/functions/') !== -1) {
282
+ if (endpointUrl.indexOf('/functions/') !== -1) {
283
283
  data = JSON.parse(endpointData) || {};
284
284
  } else {
285
285
  data = {};
@@ -148,7 +148,6 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
148
148
  },
149
149
  {}, // Initial empty object
150
150
  );
151
-
152
151
  // Create a new object for `mapping` to avoid mutation
153
152
  return {
154
153
  ...mapping, // Spread the existing mapping to preserve the previous entries
@@ -1101,13 +1100,22 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1101
1100
  }
1102
1101
  };
1103
1102
 
1103
+ private hasParent = (
1104
+ fieldId: string,
1105
+ data: Record<string, { parentFields: string[] | null }>,
1106
+ ): boolean => {
1107
+ const parentFields = data[fieldId]?.parentFields;
1108
+ return Array.isArray(parentFields) && parentFields.length > 0;
1109
+ };
1110
+
1104
1111
  private fieldDynamicData = (field: TemplateField) => {
1105
1112
  const stepId = this.props.step.id;
1106
1113
  const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
1107
- if (stepObject && field.activity_field) {
1114
+ if ((stepObject || this.props.tagsTree) && field.activity_field) {
1108
1115
  const parentFields =
1109
- this.props.parentChildMapping[stepId][field.activity_field.machine_name]
1110
- ?.parentFields || null;
1116
+ this.props.parentChildMapping[stepId]?.[
1117
+ field.activity_field.machine_name
1118
+ ]?.parentFields || null;
1111
1119
  if (parentFields) {
1112
1120
  const endpointData = parentFields.reduce((prev, next) => {
1113
1121
  const { fieldId } = this.props.parentChildMapping[stepId][next];
@@ -1120,6 +1128,15 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1120
1128
  }, {});
1121
1129
  return endpointData;
1122
1130
  }
1131
+ if (
1132
+ this.state.parentChildMapping &&
1133
+ this.hasParent(
1134
+ field.activity_field.machine_name,
1135
+ this.state.parentChildMapping[stepId],
1136
+ )
1137
+ ) {
1138
+ return this.state.dynamicFieldsData;
1139
+ }
1123
1140
  }
1124
1141
  return null;
1125
1142
  };
@@ -1363,13 +1380,19 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1363
1380
  case 'RADIO':
1364
1381
  case 'SELECT': {
1365
1382
  let fieldVal = null;
1366
- if (
1367
- this.props.onFieldChangeCallback &&
1368
- this.state.dynamicFieldsData
1369
- ) {
1370
- fieldVal = this.state.dynamicFieldsData[
1371
- el.activity_field?.machine_name || ''
1372
- ];
1383
+ if (this.props.onFieldChangeCallback) {
1384
+ if (
1385
+ Object.prototype.hasOwnProperty.call(
1386
+ this.state.dynamicFieldsData || {},
1387
+ el.activity_field?.machine_name || '',
1388
+ )
1389
+ ) {
1390
+ fieldVal = this.state.dynamicFieldsData[
1391
+ el.activity_field?.machine_name || ''
1392
+ ];
1393
+ } else {
1394
+ fieldVal = el.default_value;
1395
+ }
1373
1396
  }
1374
1397
  return html`
1375
1398
  <div key=${
@@ -1405,7 +1428,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1405
1428
  (selectedStepData &&
1406
1429
  selectedStepData[el.id] &&
1407
1430
  selectedStepData[el.id].value) ||
1408
- el.default_value ||
1431
+ (this.props.onFieldChangeCallback
1432
+ ? ''
1433
+ : el.default_value) ||
1409
1434
  ''
1410
1435
  }
1411
1436
  onChange=${(val: string) => {
@@ -1430,7 +1455,6 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1430
1455
  this.props.stepMapping[this.props.step.id]
1431
1456
  ?.selectedAuthId,
1432
1457
  ...this.fieldDynamicData(el),
1433
- ...this.state.dynamicFieldsData,
1434
1458
  })}
1435
1459
  isReadOnly=${isReadOnly}
1436
1460
  isChanged=${