@integry/sdk 4.5.52 → 4.6.0

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.5.52",
3
+ "version": "4.6.0",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -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
@@ -1306,7 +1306,11 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1306
1306
  >
1307
1307
  <${ListBox}
1308
1308
  key=${el.activity_field?.id}
1309
- fieldId=${el.activity_field?.id || el.id}
1309
+ fieldId=${
1310
+ el.activity_field?.id ||
1311
+ el.id ||
1312
+ el?.activity_field?.machine_name
1313
+ }
1310
1314
  apiHandler=${this.props.apiHandler}
1311
1315
  title=${el.title || el.activity_field?.title}
1312
1316
  description=${elDescription}
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
- params: {
585
- [key: string]: any;
586
- } = {},
587
- vars: {
588
- [key: string]: any;
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(functionName, autoMapVars ? vars : {})
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=${vars}
662
- autoMapVars=${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(
@@ -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
+ };