@integry/sdk 4.6.73 → 4.6.75

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.73",
3
+ "version": "4.6.75",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -76,6 +76,7 @@ interface ListBoxProps {
76
76
  serverSideSearchParamName?: string;
77
77
  iconKeyPath?: string;
78
78
  optionDescriptionKeyPath?: string;
79
+ skipInitialLoad?: boolean;
79
80
  }
80
81
 
81
82
  const ListBox = (props: ListBoxProps) => {
@@ -120,6 +121,7 @@ const ListBox = (props: ListBoxProps) => {
120
121
  parentFieldChanged = false,
121
122
  allowWorkspaceConnectedAccounts = false,
122
123
  tagsTree = null,
124
+ skipInitialLoad = false,
123
125
  } = props;
124
126
 
125
127
  const [query, setQuery] = useState<string>('');
@@ -265,6 +267,7 @@ const ListBox = (props: ListBoxProps) => {
265
267
  { id: '1', value: 'Yes' },
266
268
  { id: '0', value: 'No' },
267
269
  ];
270
+
268
271
  // eslint-disable-next-line @typescript-eslint/no-shadow
269
272
  if (skipOptionFetch && isDynamic) {
270
273
  // skip option fetch for dynamic dropdowns only. Static dropdowns should always fetch options
@@ -279,9 +282,14 @@ const ListBox = (props: ListBoxProps) => {
279
282
  }
280
283
  const { apiHandler } = props;
281
284
 
282
- if (isDynamic && sourceFlowIntegrataionInvocationUrl && !disabled) {
285
+ if (
286
+ isDynamic &&
287
+ sourceFlowIntegrataionInvocationUrl &&
288
+ !disabled &&
289
+ !skipInitialLoad
290
+ ) {
283
291
  fetchDynamicDataFromSourceFlow();
284
- } else if (isDynamic && endpointUrl && !disabled) {
292
+ } else if (isDynamic && endpointUrl && !disabled && !skipInitialLoad) {
285
293
  setLoading(true);
286
294
  let data;
287
295
  try {
@@ -900,6 +908,9 @@ const ListBox = (props: ListBoxProps) => {
900
908
  data.connected_account_id = selectedAuthId;
901
909
  data.authorization_id = selectedAuthId;
902
910
  }
911
+ if (allowWorkspaceConnectedAccounts) {
912
+ data.allow_workspace_connected_accounts = true;
913
+ }
903
914
  apiHandler
904
915
  .callDynamicDataEndpoint<
905
916
  {
@@ -58,6 +58,7 @@ interface ActionFormStateType {
58
58
  parentChildMapping: any;
59
59
  dynamicFieldsData: any;
60
60
  parentFieldChanged: boolean;
61
+ changedParentMachineName: string;
61
62
  }
62
63
 
63
64
  interface StepDataMapping {
@@ -84,6 +85,7 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
84
85
  parentChildMapping: this.setParentChildMapping([templateStep]),
85
86
  dynamicFieldsData: {},
86
87
  parentFieldChanged: false,
88
+ changedParentMachineName: '',
87
89
  };
88
90
  }
89
91
 
@@ -1087,7 +1089,8 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1087
1089
  if (
1088
1090
  this.isParentField(this.state.parentChildMapping, machineName || '')
1089
1091
  ) {
1090
- this.setState({ parentFieldChanged: !this.state.parentFieldChanged });
1092
+ // this.setState({ parentFieldChanged: !this.state.parentFieldChanged });
1093
+ this.setState({ changedParentMachineName: machineName });
1091
1094
  }
1092
1095
 
1093
1096
  this.props.onFieldChangeCallback(machineName || '', value);
@@ -1138,7 +1141,20 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1138
1141
  this.state.parentChildMapping[stepId],
1139
1142
  )
1140
1143
  ) {
1141
- return this.state.dynamicFieldsData;
1144
+ const selfParentFields =
1145
+ this.state.parentChildMapping[stepId][
1146
+ field.activity_field.machine_name
1147
+ ]?.parentFields || [];
1148
+ const result = selfParentFields.reduce(
1149
+ (acc: Record<string, unknown>, parent: any) => {
1150
+ if (this.state.dynamicFieldsData?.[parent]) {
1151
+ acc[parent] = this.state.dynamicFieldsData[parent];
1152
+ }
1153
+ return acc;
1154
+ },
1155
+ {},
1156
+ );
1157
+ return result;
1142
1158
  }
1143
1159
  }
1144
1160
  return null;
@@ -1389,6 +1405,19 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1389
1405
  case 'RADIO':
1390
1406
  case 'SELECT': {
1391
1407
  let fieldVal = null;
1408
+ let elParentFields = [];
1409
+ if (
1410
+ el.activity_field?.parent_fields &&
1411
+ el.activity_field?.parent_fields !== ''
1412
+ ) {
1413
+ try {
1414
+ elParentFields = JSON.parse(
1415
+ el.activity_field?.parent_fields,
1416
+ );
1417
+ } catch (e) {
1418
+ elParentFields = [];
1419
+ }
1420
+ }
1392
1421
  if (this.props.onFieldChangeCallback) {
1393
1422
  if (
1394
1423
  Object.prototype.hasOwnProperty.call(
@@ -1506,9 +1535,9 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1506
1535
  )}
1507
1536
  optionKeyPath=${uiField?.value_key_path || ''}
1508
1537
  valueKeyPath=${uiField?.option_key_path || ''}
1509
- parentFieldChanged=${
1510
- this.state.parentFieldChanged
1511
- }
1538
+ parentFieldChanged=${elParentFields.includes(
1539
+ this.state.changedParentMachineName,
1540
+ )}
1512
1541
  allowWorkspaceConnectedAccounts=${!!this.props
1513
1542
  .onFieldChangeCallback}
1514
1543
  tagsTree=${
@@ -1516,6 +1545,16 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1516
1545
  ? this.props.tagsTree
1517
1546
  : null
1518
1547
  }
1548
+ skipInitialLoad=${
1549
+ (elParentFields.length ?? 0) > 0 &&
1550
+ !elParentFields?.some(
1551
+ (parentField: any) =>
1552
+ parentField &&
1553
+ this.state.dynamicFieldsData?.[
1554
+ parentField
1555
+ ],
1556
+ )
1557
+ }
1519
1558
 
1520
1559
  ><//>
1521
1560
  </${ConfigureFieldWrapper}>
@@ -106,6 +106,9 @@ const DynamicFields = (props: DynamicFieldsProps) => {
106
106
  setLoading(true);
107
107
  try {
108
108
  data = JSON.parse(endpointData);
109
+ if (tagsTree) {
110
+ data.allow_workspace_connected_accounts = true;
111
+ }
109
112
  } catch (error) {
110
113
  data = '';
111
114
  }
@@ -230,7 +233,8 @@ const DynamicFields = (props: DynamicFieldsProps) => {
230
233
  : html` <a
231
234
  className=${styles.optionsRefresh}
232
235
  href="#"
233
- onclick=${() => {
236
+ onclick=${(e: Event) => {
237
+ e.preventDefault();
234
238
  setLoading(true);
235
239
  setIsErrorOnLoadingCustomFields(false);
236
240
  fetchDynamicFields();