@integry/sdk 4.6.75 → 4.6.76

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.75",
3
+ "version": "4.6.76",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -24,6 +24,7 @@ import TextContent from '@/components/TextContent';
24
24
  // import { MappedField } from '@/components/MappedField/MappedField';
25
25
  import { MultipurposeField } from '@/components/MultipurposeField';
26
26
  import DynamicField from '@/features/common/DynamicField';
27
+ import DynamicTypedField from '@/features/common/DynamicTypedField';
27
28
  import SectionField from '@/features/common/SectionField';
28
29
  import { TimeInput } from '@/components/TimeInput';
29
30
  import NewMappingUI from '@/features/common/NewMappingUI';
@@ -57,7 +58,7 @@ interface ActionFormStateType {
57
58
  dynamicFieldDataState: any;
58
59
  parentChildMapping: any;
59
60
  dynamicFieldsData: any;
60
- parentFieldChanged: boolean;
61
+ parentFieldChanged: any;
61
62
  changedParentMachineName: string;
62
63
  }
63
64
 
@@ -84,7 +85,7 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
84
85
  dynamicFieldDataState: {},
85
86
  parentChildMapping: this.setParentChildMapping([templateStep]),
86
87
  dynamicFieldsData: {},
87
- parentFieldChanged: false,
88
+ parentFieldChanged: [],
88
89
  changedParentMachineName: '',
89
90
  };
90
91
  }
@@ -1089,7 +1090,14 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1089
1090
  if (
1090
1091
  this.isParentField(this.state.parentChildMapping, machineName || '')
1091
1092
  ) {
1092
- // this.setState({ parentFieldChanged: !this.state.parentFieldChanged });
1093
+ this.setState((prevState) => ({
1094
+ parentFieldChanged: {
1095
+ ...prevState.parentFieldChanged,
1096
+ [machineName as string]: !prevState.parentFieldChanged?.[
1097
+ machineName as string
1098
+ ],
1099
+ },
1100
+ }));
1093
1101
  this.setState({ changedParentMachineName: machineName });
1094
1102
  }
1095
1103
 
@@ -1301,13 +1309,13 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1301
1309
  const lastPartKey = keyPath.split('.').pop(); // Get the last part of the key path
1302
1310
 
1303
1311
  // Check if dictionary has an exact match for the full path or the last part of the path
1304
- if (dictionary[keyPath] !== undefined) {
1312
+ if (dictionary?.[keyPath] !== undefined) {
1305
1313
  // Replace using the exact match
1306
1314
  updatedObj[key] = value.replace(
1307
1315
  placeholderKey[0],
1308
1316
  dictionary[keyPath],
1309
1317
  );
1310
- } else if (lastPartKey && dictionary[lastPartKey] !== undefined) {
1318
+ } else if (lastPartKey && dictionary?.[lastPartKey] !== undefined) {
1311
1319
  // Replace using the last part match
1312
1320
  updatedObj[key] = value.replace(
1313
1321
  placeholderKey[0],
@@ -1392,12 +1400,26 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1392
1400
  el.data_type === 'OBJECT' &&
1393
1401
  el.type !== 'FUNCTION_FIELD'
1394
1402
  ) {
1395
- fieldType = 'OBJECT';
1403
+ if (
1404
+ el.type === 'DYNAMIC' &&
1405
+ uiField?.type === 'CUSTOM_FIELDS'
1406
+ ) {
1407
+ fieldType = 'CUSTOM_FIELDS';
1408
+ } else {
1409
+ fieldType = 'OBJECT';
1410
+ }
1396
1411
  } else if (
1397
1412
  el.data_type === 'OBJECT[]' &&
1398
1413
  el.type !== 'FUNCTION_FIELD'
1399
1414
  ) {
1400
- fieldType = 'OBJECT[]';
1415
+ if (
1416
+ el.type === 'DYNAMIC' &&
1417
+ uiField?.type === 'CUSTOM_FIELDS'
1418
+ ) {
1419
+ fieldType = 'CUSTOM_FIELDS';
1420
+ } else {
1421
+ fieldType = 'OBJECT[]';
1422
+ }
1401
1423
  }
1402
1424
 
1403
1425
  switch (fieldType) {
@@ -1921,7 +1943,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1921
1943
  refreshRootStepData=${this
1922
1944
  .refreshRootStepData}
1923
1945
  parentFieldChanged=${this.state
1924
- .parentFieldChanged}
1946
+ .parentFieldChanged?.[
1947
+ this.state.changedParentMachineName
1948
+ ]}
1925
1949
  onChangeCallback=${this.props
1926
1950
  .onFieldChangeCallback
1927
1951
  ? (val: any) => {
@@ -1947,6 +1971,125 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1947
1971
  </div>
1948
1972
  `;
1949
1973
  }
1974
+ case 'CUSTOM_FIELDS': {
1975
+ let fieldVal = null;
1976
+ let elParentFields = [];
1977
+ if (
1978
+ el.activity_field?.parent_fields &&
1979
+ el.activity_field?.parent_fields !== ''
1980
+ ) {
1981
+ try {
1982
+ elParentFields = JSON.parse(
1983
+ el.activity_field?.parent_fields,
1984
+ );
1985
+ } catch (e) {
1986
+ elParentFields = [];
1987
+ }
1988
+ }
1989
+ if (this.props.onFieldChangeCallback) {
1990
+ if (
1991
+ Object.prototype.hasOwnProperty.call(
1992
+ this.state.dynamicFieldsData || {},
1993
+ el.activity_field?.machine_name || '',
1994
+ )
1995
+ ) {
1996
+ fieldVal = this.state.dynamicFieldsData[
1997
+ el.activity_field?.machine_name || ''
1998
+ ];
1999
+ } else {
2000
+ fieldVal = el.default_value;
2001
+ }
2002
+ }
2003
+
2004
+ return html`
2005
+ <div
2006
+ key=${el.id}
2007
+ id=${`integry-action-field-wrap-${
2008
+ el?.activity_field?.machine_name || ''
2009
+ }`}
2010
+ class=${`integry-action-field-wrap`}
2011
+ >
2012
+ <${DynamicTypedField}
2013
+ dynamicField=${el}
2014
+ endpointData=${JSON.stringify({
2015
+ authorization_id:
2016
+ (this.props.stepMapping &&
2017
+ this.props.stepMapping[
2018
+ this.props.step.id
2019
+ ]?.selectedAuthId) ||
2020
+ this.props.selectedAuthId,
2021
+ })}
2022
+ placeHolder=${this.getPlaceholder(el)}
2023
+ appName=${this.props.step.activity.app
2024
+ .name}
2025
+ selectedAuthId=${`${
2026
+ this.props.stepMapping[
2027
+ this.props.step.id
2028
+ ]?.selectedAuthId ||
2029
+ this.props.selectedAuthId ||
2030
+ ''
2031
+ }`}
2032
+ sourceFlowIntegrataionInvocationUrl=${uiField
2033
+ ?.data_source?.url}
2034
+ isMappable=${this.props.showMappingMenu}
2035
+ isDisabled=${false}
2036
+ isEditable=${false}
2037
+ allowTagsInText=${true}
2038
+ apiHandler=${this.props.apiHandler}
2039
+ idKeyPath=${uiField?.id_key_path}
2040
+ typeKeyPath=${uiField?.type_key_path}
2041
+ titleKeyPath=${uiField?.title_key_path}
2042
+ onChange=${this.props
2043
+ .onFieldChangeCallback
2044
+ ? (val: any) => {
2045
+ if (
2046
+ this.props.onFieldChangeCallback
2047
+ ) {
2048
+ this.onFieldChange({
2049
+ stepId: step.id,
2050
+ fieldId: el.id,
2051
+ value: val,
2052
+ isRequired: el.is_required,
2053
+ machineName:
2054
+ el.activity_field
2055
+ ?.machine_name,
2056
+ });
2057
+ }
2058
+ }
2059
+ : null}
2060
+ tagsTree=${this.props.showMappingMenu
2061
+ ? this.props.tagsTree
2062
+ : null}
2063
+ dataSourceBody=${this.replacePlaceholders(
2064
+ uiField?.data_source.body || {},
2065
+ this.state.dynamicFieldsData,
2066
+ )}
2067
+ parentFieldsChanged=${this.state
2068
+ .parentFieldChanged?.[
2069
+ this.state.changedParentMachineName
2070
+ ] &&
2071
+ elParentFields.includes(
2072
+ this.state.changedParentMachineName,
2073
+ )}
2074
+ activityOutputData=${this.arrayToNestedJSONWithFirstValue(
2075
+ this.props.activityOutputData ||
2076
+ JSONToActivityOutputData(
2077
+ this.props.tagsTree || {},
2078
+ ),
2079
+ this.props.dynamicFieldData ||
2080
+ this.state.dynamicFieldDataState ||
2081
+ {},
2082
+ )}
2083
+ activityOutputDataRaw=${this.props
2084
+ .activityOutputData ||
2085
+ JSONToActivityOutputData(
2086
+ this.props.tagsTree || {},
2087
+ )}
2088
+ value=${fieldVal}
2089
+ />
2090
+ </div>
2091
+ `;
2092
+ }
1950
2093
  case 'SECTION':
1951
2094
  return html`
1952
2095
  <div
@@ -310,6 +310,9 @@ export interface UiField {
310
310
  type: string;
311
311
  value_key_path: string;
312
312
  data_source: UiFieldDataSource;
313
+ type_key_path?: string;
314
+ title_key_path?: string;
315
+ id_key_path?: string;
313
316
  }
314
317
 
315
318
  export interface TemplateField {