@integry/sdk 4.5.53 → 4.6.1
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/.vscode/launch.json +3 -3
- package/THIRD_PARTY_LICENSES +3 -2
- package/dist/esm/index.csm.d.ts +7 -5
- package/dist/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.d.ts +7 -5
- package/dist/umd/index.umd.js +1 -1
- package/package.json +2 -1
- package/src/components/Input/BaseInput/styles.module.scss +2 -1
- package/src/components/MultipurposeField/Dropdown/index.tsx +10 -4
- package/src/components/MultipurposeField/TagMenu/index.ts +7 -3
- package/src/components/form/ObjectField/index.ts +1 -1
- package/src/index.ts +17 -15
- package/src/types/index.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integry/sdk",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.1",
|
|
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",
|
|
@@ -735,14 +735,19 @@ const ListBox = (props: ListBoxProps) => {
|
|
|
735
735
|
if (isDynamic && sourceFlowIntegrataionInvocationUrl) {
|
|
736
736
|
fetchDynamicDataFromSourceFlow(isRefresh, callback);
|
|
737
737
|
} else if (endpointUrl) {
|
|
738
|
-
|
|
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
|
-
:
|
|
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.'
|
|
@@ -250,7 +250,7 @@ const ObjectField = (props: ObjectFieldProps) => {
|
|
|
250
250
|
if (typeof value === 'object' && value !== null) {
|
|
251
251
|
return JSON.stringify(value, null, 2); // Pretty-print with 2-space indentation
|
|
252
252
|
}
|
|
253
|
-
return String(value); // Convert other values to string
|
|
253
|
+
return String(value || ''); // Convert other values to string
|
|
254
254
|
};
|
|
255
255
|
|
|
256
256
|
// Render fields for each object in the array
|
package/src/index.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
Layouts,
|
|
30
30
|
SetupIntegrationOptions,
|
|
31
31
|
RenderFlowStepOptions,
|
|
32
|
+
ShowFunctionOptions,
|
|
32
33
|
} from '@/types';
|
|
33
34
|
|
|
34
35
|
import { createSDKStore, initialState } from '@/store';
|
|
@@ -581,20 +582,21 @@ export class IntegryJS {
|
|
|
581
582
|
|
|
582
583
|
public showFunction = (
|
|
583
584
|
functionName: string,
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
autoMapVars = false,
|
|
591
|
-
connectedAccountId?: string,
|
|
585
|
+
options: ShowFunctionOptions = {
|
|
586
|
+
params: {},
|
|
587
|
+
payload: {},
|
|
588
|
+
connectedAccountId: '',
|
|
589
|
+
autoMapPayload: false,
|
|
590
|
+
},
|
|
592
591
|
): Promise<Record<any, any>> => {
|
|
593
592
|
const store = createSDKStore();
|
|
594
593
|
|
|
595
594
|
return new Promise((resolve, reject) => {
|
|
596
595
|
this.apiHandler
|
|
597
|
-
.getFunctionDetails(
|
|
596
|
+
.getFunctionDetails(
|
|
597
|
+
functionName,
|
|
598
|
+
options.autoMapPayload ? options.payload : {},
|
|
599
|
+
)
|
|
598
600
|
.then((response: any) => {
|
|
599
601
|
if (!response) {
|
|
600
602
|
return reject(new Error('Function not found.'));
|
|
@@ -603,9 +605,9 @@ export class IntegryJS {
|
|
|
603
605
|
return reject(new Error('No connected account found.'));
|
|
604
606
|
}
|
|
605
607
|
if (
|
|
606
|
-
connectedAccountId &&
|
|
608
|
+
options.connectedAccountId &&
|
|
607
609
|
!response.meta.app.connected_accounts.find(
|
|
608
|
-
(account: any) => account.id === connectedAccountId,
|
|
610
|
+
(account: any) => account.id === options.connectedAccountId,
|
|
609
611
|
)
|
|
610
612
|
) {
|
|
611
613
|
return reject(new Error('Connected account not found.'));
|
|
@@ -656,10 +658,10 @@ export class IntegryJS {
|
|
|
656
658
|
<${Provider} store=${store}>
|
|
657
659
|
<${FunctionForm}
|
|
658
660
|
functionName=${functionName}
|
|
659
|
-
connectedAccountId=${connectedAccountId}
|
|
660
|
-
functionArguments=${params}
|
|
661
|
-
variables=${
|
|
662
|
-
autoMapVars=${
|
|
661
|
+
connectedAccountId=${options.connectedAccountId}
|
|
662
|
+
functionArguments=${options.params}
|
|
663
|
+
variables=${options.payload}
|
|
664
|
+
autoMapVars=${options.autoMapPayload}
|
|
663
665
|
apiHandler=${this.apiHandler}
|
|
664
666
|
onClose=${(functionUIResponse: any) => {
|
|
665
667
|
const authIdElement = document.getElementById(
|
package/src/types/index.ts
CHANGED
|
@@ -297,3 +297,9 @@ export type RenderFlowStepOptions = {
|
|
|
297
297
|
onFieldChangeCallback: (fieldId: string, value: any) => void;
|
|
298
298
|
tagsTree: any;
|
|
299
299
|
};
|
|
300
|
+
export type ShowFunctionOptions = {
|
|
301
|
+
params?: Record<string, any>;
|
|
302
|
+
payload?: Record<string, any>;
|
|
303
|
+
connectedAccountId?: string;
|
|
304
|
+
autoMapPayload?: boolean;
|
|
305
|
+
};
|