@integry/sdk 4.7.23 → 4.7.25

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.7.23",
3
+ "version": "4.7.25",
4
4
  "description": "Integry SDK",
5
5
  "main": "dist/umd/index.umd.js",
6
6
  "module": "dist/esm/index.csm.js",
@@ -212,7 +212,7 @@ const MultipurposeField = (props: MultipurposeFieldProps) => {
212
212
  useEffect(() => {
213
213
  const textfield = inputRef.current;
214
214
  const scalarValue = Array.isArray(value) ? value[0] : value;
215
- if (textfield && activityOutputDataRaw.length) {
215
+ if (textfield && (activityOutputDataRaw.length || tagsTree !== null)) {
216
216
  const el: any = document.getElementById(`tagify_${fieldId}`);
217
217
  if (el && el.dataset.tagifyFieldId !== fieldId) {
218
218
  el.value = getDefaultTagifyValue(value || '');
@@ -28,6 +28,8 @@ interface ObjectFieldProps {
28
28
  activityOutputDataRaw: any;
29
29
  objectValue?: any;
30
30
  isDisabled?: boolean;
31
+ tagsTree?: any; // Optional prop for tags tree
32
+ showMenuOnLeft?: boolean; // Optional prop to show menu on the left
31
33
  }
32
34
 
33
35
  type Option = {
@@ -110,6 +112,8 @@ const ObjectField = (props: ObjectFieldProps) => {
110
112
  activityOutputDataRaw,
111
113
  objectValue,
112
114
  isDisabled = false,
115
+ tagsTree = null,
116
+ showMenuOnLeft = false, // Default to false
113
117
  } = props;
114
118
  const [objectArray, setObjectArray] = useState<FieldObject[]>(
115
119
  Array.isArray(objectValue) ? objectValue : [{}],
@@ -392,15 +396,19 @@ const ObjectField = (props: ObjectFieldProps) => {
392
396
  isEditable=${true}
393
397
  fieldId=${`${field.id}_${fieldName}`}
394
398
  type=${fieldType}
395
- isMappable=${activityOutputDataRaw &&
396
- Object.entries(activityOutputDataRaw).length > 0}
397
- allowTagsInText=${activityOutputDataRaw}
399
+ isMappable=${tagsTree
400
+ ? true
401
+ : activityOutputDataRaw &&
402
+ Object.entries(activityOutputDataRaw).length > 0}
403
+ allowTagsInText=${activityOutputDataRaw || tagsTree}
398
404
  value=${objectHasFields
399
405
  ? (objectArray[objectIndex] || {})[
400
406
  fieldDetails?.meta?.machine_name || ''
401
407
  ] || ''
402
408
  : formatValueForTextarea(objectValue)}
403
409
  isDisabled=${isDisabled}
410
+ tagsTree=${tagsTree}
411
+ showMenuOnLeft=${showMenuOnLeft}
404
412
  ><//>
405
413
  `}
406
414
  ${fieldType === 'DYNAMIC_DROPDOWN' &&
@@ -1851,6 +1851,14 @@ class ActionForm extends Component<ActionFormPropsType, ActionFormStateType> {
1851
1851
  el.default_value ||
1852
1852
  ''
1853
1853
  }
1854
+ tagsTree=${
1855
+ this.props.showMappingMenu
1856
+ ? this.props.tagsTree
1857
+ : null
1858
+ }
1859
+ showMenuOnLeft=${
1860
+ this.props.showMenuOnLeft || false
1861
+ }
1854
1862
  />
1855
1863
  </${ConfigureFieldWrapper}>
1856
1864
  </div>
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  PreviewPayload,
11
11
  MarketplaceConfig,
12
12
  MultipurposeFieldType,
13
+ FunctionFieldType,
13
14
  ConnectedAccount,
14
15
  MarketplaceApp,
15
16
  } from '@/interfaces';
@@ -55,6 +56,7 @@ import {
55
56
  arrayToNestedJSONWithFirstValue,
56
57
  } from '@/utils/ActivityOutputUtils';
57
58
  import { ListBox } from '@/components/MultipurposeField/Dropdown';
59
+ import { FunctionField } from '@/components/form';
58
60
  import { MultipurposeField } from './components/MultipurposeField';
59
61
  import SDKDebugContainer from './features/containers/SDKDebugContainer';
60
62
 
@@ -2005,6 +2007,55 @@ export class IntegryJS {
2005
2007
  }
2006
2008
  };
2007
2009
 
2010
+ public renderFunctionField = (
2011
+ containerId: string,
2012
+ functionFieldProps: FunctionFieldType,
2013
+ ) => {
2014
+ const target = document.getElementById(containerId);
2015
+
2016
+ if (target) {
2017
+ const store = createSDKStore();
2018
+ render(
2019
+ html`<div>
2020
+ <${AppContext.Provider}
2021
+ value=${{
2022
+ apiHandler: this.apiHandler,
2023
+ eventEmitter: this.eventEmitter,
2024
+ isPreviewMode: false,
2025
+ }}
2026
+ >
2027
+ <${Provider} store=${store} key=${this.getRandomFlowId(10)}>
2028
+ <${FunctionField}
2029
+ field=${functionFieldProps.field}
2030
+ name="${functionFieldProps.field.activity_field?.machine_name ||
2031
+ 'function_field'}"
2032
+ description=${functionFieldProps.field.description || ''}
2033
+ label="${functionFieldProps.field.title}"
2034
+ value=${functionFieldProps.field.default_value || []}
2035
+ apiHandler=${this.apiHandler}
2036
+ isArray=${!!(functionFieldProps.field.data_type === 'OBJECT[]')}
2037
+ onChange=${(val: string) => {
2038
+ if (functionFieldProps.onChange) {
2039
+ functionFieldProps.onChange(val);
2040
+ }
2041
+ }}
2042
+ tagsTree=${functionFieldProps.tagsTree
2043
+ ? functionFieldProps.tagsTree
2044
+ : null}
2045
+ isReadOnly=${functionFieldProps.isReadOnly}
2046
+ />
2047
+ <//>
2048
+ <//>
2049
+ </div>`,
2050
+ target,
2051
+ );
2052
+ } else {
2053
+ console.warn(
2054
+ `Integry SDK render target with id ${containerId} was not found`,
2055
+ );
2056
+ }
2057
+ };
2058
+
2008
2059
  public renderFlowStep = (
2009
2060
  options: RenderFlowStepOptions = {
2010
2061
  containerId: 'integry-marketplace',
@@ -929,3 +929,10 @@ export interface MultipurposeFieldType {
929
929
  fieldId?: string;
930
930
  enableTagify?: boolean;
931
931
  }
932
+
933
+ export interface FunctionFieldType {
934
+ onChange?: (val: any) => void;
935
+ isReadOnly?: boolean;
936
+ field: TemplateField;
937
+ tagsTree?: any;
938
+ }