@integry/sdk 4.6.0 → 4.6.2

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.0",
3
+ "version": "4.6.2",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -71,6 +71,7 @@
71
71
  "eslint-import-resolver-typescript": "^2.4.0",
72
72
  "eslint-plugin-import": "^2.22.1",
73
73
  "identity-obj-proxy": "^3.0.0",
74
+ "jsdom": "^26.0.0",
74
75
  "postcss": "^8.2.10",
75
76
  "postcss-loader": "^4.0.0",
76
77
  "postcss-nested": "^5.0.5",
@@ -84,7 +84,8 @@
84
84
  border: 1px solid #e2e0db;
85
85
  border-radius: 4px;
86
86
  display: flex;
87
- width: 95vh;
87
+ width: 100%;
88
+ box-sizing: border-box;
88
89
  input {
89
90
  border: none;
90
91
  }
@@ -735,14 +735,19 @@ const ListBox = (props: ListBoxProps) => {
735
735
  if (isDynamic && sourceFlowIntegrataionInvocationUrl) {
736
736
  fetchDynamicDataFromSourceFlow(isRefresh, callback);
737
737
  } else if (endpointUrl) {
738
- if (!isRefresh) {
739
- setLoading(true);
740
- }
738
+ setLoading(true);
741
739
  let data;
742
740
  try {
743
741
  data = JSON.parse(endpointData);
744
742
  } catch (error) {
745
- data = '';
743
+ data = {};
744
+ }
745
+ if (!data) {
746
+ data = {};
747
+ }
748
+ if (selectedAuthId) {
749
+ data.connected_account_id = selectedAuthId;
750
+ data.authorization_id = selectedAuthId;
746
751
  }
747
752
  apiHandler
748
753
  .callDynamicDataEndpoint<
@@ -970,6 +975,7 @@ const ListBox = (props: ListBoxProps) => {
970
975
  isMultiSelect=${isMultiSelect}
971
976
  loadingOptions=${loading}
972
977
  nextPage=${nextPage}
978
+ isDynamic=${isDynamic}
973
979
  />`}
974
980
  </div>
975
981
  `}
@@ -45,6 +45,7 @@ interface FieldMenuProps {
45
45
  loadingOptions?: boolean;
46
46
  nextPage?: string;
47
47
  tagsComponent?: any;
48
+ isDynamic?: boolean;
48
49
  }
49
50
 
50
51
  const customComponent = (props: { element: any }) => {
@@ -73,6 +74,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
73
74
  loadingOptions = false,
74
75
  nextPage = '',
75
76
  tagsComponent = null,
77
+ isDynamic = true,
76
78
  } = props;
77
79
 
78
80
  // Set active tab in state
@@ -288,7 +290,8 @@ const FieldDropdown = (props: FieldMenuProps) => {
288
290
  : html`<span>
289
291
  ${isLoadingOptions || isLoadingMoreOptions
290
292
  ? html`<${ThreeDotLoader} color="#999" />`
291
- : html` <a
293
+ : isDynamic
294
+ ? html` <a
292
295
  className=${styles.optionsRefreshProminent}
293
296
  href="#"
294
297
  onclick=${() => {
@@ -303,7 +306,8 @@ const FieldDropdown = (props: FieldMenuProps) => {
303
306
  >${nextPage
304
307
  ? `Load more options`
305
308
  : `Reload options?`}</a
306
- >`}
309
+ >`
310
+ : html``}
307
311
  </span>`}
308
312
  `;
309
313
  },
@@ -313,7 +317,7 @@ const FieldDropdown = (props: FieldMenuProps) => {
313
317
  </div>`
314
318
  : html`<div className=${styles.noOptions}>
315
319
  <span className=${styles.noOptionsRetry}>
316
- ${isLoadingOptions
320
+ ${isLoadingOptions || loadingOptions
317
321
  ? html`<${ThreeDotLoader} color="#999" />`
318
322
  : html`${isErrorOnLoadingOptions
319
323
  ? 'Could not load options.'
@@ -1,5 +1,5 @@
1
1
  import { html } from 'htm/preact';
2
- import { useState } from 'preact/hooks';
2
+ import { useState, useEffect } from 'preact/hooks';
3
3
  import { Input } from '@/components/Input';
4
4
  import { TextArea } from '@/components/TextArea';
5
5
  import { CheckboxGroup } from '@/components/CheckboxGroup';
@@ -107,7 +107,9 @@ const ObjectField = (props: ObjectFieldProps) => {
107
107
  activityOutputDataRaw,
108
108
  objectValue,
109
109
  } = props;
110
- const [objectArray, setObjectArray] = useState<FieldObject[]>([{}]); // Start with one empty object in the array
110
+ const [objectArray, setObjectArray] = useState<FieldObject[]>(
111
+ Array.isArray(objectValue) ? objectValue : [{}],
112
+ ); // Start with one empty object in the array
111
113
  const [showAddMoreOption, setShowAddMoreOption] = useState(true);
112
114
  const [objectHasFields, setObjectHasFields] = useState(true);
113
115
 
@@ -158,6 +160,21 @@ const ObjectField = (props: ObjectFieldProps) => {
158
160
  );
159
161
  }
160
162
 
163
+ useEffect(() => {
164
+ let objectValueCopy = objectValue;
165
+ if (typeof objectValue === 'string' && objectValue.length > 0) {
166
+ // if default value was sent as a strinfiyed object
167
+ objectValueCopy = JSON.parse(objectValue);
168
+ }
169
+ if (objectValueCopy) {
170
+ if (Array.isArray(objectValueCopy)) {
171
+ setObjectArray(objectValueCopy);
172
+ } else {
173
+ setObjectArray([objectValueCopy]);
174
+ }
175
+ }
176
+ }, [objectValue]);
177
+
161
178
  // Method to handle field changes for each object in the array
162
179
  const handleFieldChange = (
163
180
  index: number,
@@ -280,7 +297,9 @@ const ObjectField = (props: ObjectFieldProps) => {
280
297
  activityOutputData=${activityOutputData}
281
298
  activityOutputDataRaw=${activityOutputDataRaw}
282
299
  description="${fieldDetails.meta.description_for_users}"
283
- value=${(objectArray[objectIndex] || {})[fieldName] || ''}
300
+ value=${(objectArray[objectIndex] || {})[
301
+ fieldDetails?.meta?.machine_name || ''
302
+ ] || ''}
284
303
  placeholder="${placeholder}"
285
304
  onChange=${(val: any) => {
286
305
  const valueReceived =