@integry/sdk 4.7.24 → 4.7.26
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/dist/esm/index.csm.d.ts +8 -1
- package/dist/esm/index.csm.js +1 -1
- package/dist/umd/index.umd.d.ts +8 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +1 -1
- package/src/components/MultipurposeField/index.tsx +1 -1
- package/src/components/form/ObjectField/index.ts +11 -3
- package/src/features/common/ActionForm/index.ts +8 -0
- package/src/index.ts +66 -10
- package/src/interfaces/index.ts +7 -0
package/package.json
CHANGED
|
@@ -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=${
|
|
396
|
-
|
|
397
|
-
|
|
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
|
|
|
@@ -82,13 +84,15 @@ export class IntegryJS {
|
|
|
82
84
|
|
|
83
85
|
static RenderModes: typeof RenderModes = RenderModes;
|
|
84
86
|
|
|
85
|
-
static TemplateFormRenderModes: typeof TemplateFormRenderModes =
|
|
87
|
+
static TemplateFormRenderModes: typeof TemplateFormRenderModes =
|
|
88
|
+
TemplateFormRenderModes;
|
|
86
89
|
|
|
87
90
|
static Layouts: typeof Layouts = Layouts;
|
|
88
91
|
|
|
89
92
|
static ViewStyles: typeof ViewStyles = ViewStyles;
|
|
90
93
|
|
|
91
|
-
static MarketplaceRenderModes: typeof MarketplaceRenderModes =
|
|
94
|
+
static MarketplaceRenderModes: typeof MarketplaceRenderModes =
|
|
95
|
+
MarketplaceRenderModes;
|
|
92
96
|
|
|
93
97
|
static Helpers: {
|
|
94
98
|
getAuthHash: (key: string, message: string) => Promise<string>;
|
|
@@ -521,8 +525,8 @@ export class IntegryJS {
|
|
|
521
525
|
userConfig: this.config.userConfig,
|
|
522
526
|
genericData: {
|
|
523
527
|
...initialState.genericData,
|
|
524
|
-
implicitAuthEnabled:
|
|
525
|
-
?.apiKey,
|
|
528
|
+
implicitAuthEnabled:
|
|
529
|
+
!!this.config.xIntegryConfig?.appAuth?.apiKey,
|
|
526
530
|
deploymentId: Number(this.config.deploymentId),
|
|
527
531
|
isAnonymous: !!this.config.xIntegryConfig?.isAnonymous,
|
|
528
532
|
},
|
|
@@ -632,8 +636,8 @@ export class IntegryJS {
|
|
|
632
636
|
userConfig: this.config.userConfig,
|
|
633
637
|
genericData: {
|
|
634
638
|
...initialState.genericData,
|
|
635
|
-
implicitAuthEnabled:
|
|
636
|
-
?.apiKey,
|
|
639
|
+
implicitAuthEnabled:
|
|
640
|
+
!!this.config.xIntegryConfig?.appAuth?.apiKey,
|
|
637
641
|
deploymentId: Number(this.config.deploymentId),
|
|
638
642
|
isAnonymous: !!this.config.xIntegryConfig?.isAnonymous,
|
|
639
643
|
},
|
|
@@ -739,6 +743,7 @@ export class IntegryJS {
|
|
|
739
743
|
} = {},
|
|
740
744
|
connectedAccountId: string,
|
|
741
745
|
version: string | null = null,
|
|
746
|
+
allow_workspace_connected_accounts = false,
|
|
742
747
|
): Promise<Record<any, any>> =>
|
|
743
748
|
new Promise((resolve, reject) => {
|
|
744
749
|
// Prepare the request body by encoding `args` to JSON
|
|
@@ -748,9 +753,13 @@ export class IntegryJS {
|
|
|
748
753
|
if (version) {
|
|
749
754
|
headers.Version = version;
|
|
750
755
|
}
|
|
756
|
+
let url = `${this.getBaseAPIUrl()}/functions/${functionName}/call/`;
|
|
757
|
+
if (allow_workspace_connected_accounts) {
|
|
758
|
+
url += '?allow_workspace_connected_accounts=true';
|
|
759
|
+
}
|
|
751
760
|
const functionDetails = {
|
|
752
761
|
method: this.getMethod(),
|
|
753
|
-
url
|
|
762
|
+
url,
|
|
754
763
|
headers,
|
|
755
764
|
args: params,
|
|
756
765
|
vars,
|
|
@@ -1026,9 +1035,7 @@ export class IntegryJS {
|
|
|
1026
1035
|
);
|
|
1027
1036
|
};
|
|
1028
1037
|
|
|
1029
|
-
public async removeAuthorization(data: {
|
|
1030
|
-
authorizationId: number;
|
|
1031
|
-
}): Promise<{
|
|
1038
|
+
public async removeAuthorization(data: { authorizationId: number }): Promise<{
|
|
1032
1039
|
data: string | null;
|
|
1033
1040
|
status: number;
|
|
1034
1041
|
} | null> {
|
|
@@ -2005,6 +2012,55 @@ export class IntegryJS {
|
|
|
2005
2012
|
}
|
|
2006
2013
|
};
|
|
2007
2014
|
|
|
2015
|
+
public renderFunctionField = (
|
|
2016
|
+
containerId: string,
|
|
2017
|
+
functionFieldProps: FunctionFieldType,
|
|
2018
|
+
) => {
|
|
2019
|
+
const target = document.getElementById(containerId);
|
|
2020
|
+
|
|
2021
|
+
if (target) {
|
|
2022
|
+
const store = createSDKStore();
|
|
2023
|
+
render(
|
|
2024
|
+
html`<div>
|
|
2025
|
+
<${AppContext.Provider}
|
|
2026
|
+
value=${{
|
|
2027
|
+
apiHandler: this.apiHandler,
|
|
2028
|
+
eventEmitter: this.eventEmitter,
|
|
2029
|
+
isPreviewMode: false,
|
|
2030
|
+
}}
|
|
2031
|
+
>
|
|
2032
|
+
<${Provider} store=${store} key=${this.getRandomFlowId(10)}>
|
|
2033
|
+
<${FunctionField}
|
|
2034
|
+
field=${functionFieldProps.field}
|
|
2035
|
+
name="${functionFieldProps.field.activity_field?.machine_name ||
|
|
2036
|
+
'function_field'}"
|
|
2037
|
+
description=${functionFieldProps.field.description || ''}
|
|
2038
|
+
label="${functionFieldProps.field.title}"
|
|
2039
|
+
value=${functionFieldProps.field.default_value || []}
|
|
2040
|
+
apiHandler=${this.apiHandler}
|
|
2041
|
+
isArray=${!!(functionFieldProps.field.data_type === 'OBJECT[]')}
|
|
2042
|
+
onChange=${(val: string) => {
|
|
2043
|
+
if (functionFieldProps.onChange) {
|
|
2044
|
+
functionFieldProps.onChange(val);
|
|
2045
|
+
}
|
|
2046
|
+
}}
|
|
2047
|
+
tagsTree=${functionFieldProps.tagsTree
|
|
2048
|
+
? functionFieldProps.tagsTree
|
|
2049
|
+
: null}
|
|
2050
|
+
isReadOnly=${functionFieldProps.isReadOnly}
|
|
2051
|
+
/>
|
|
2052
|
+
<//>
|
|
2053
|
+
<//>
|
|
2054
|
+
</div>`,
|
|
2055
|
+
target,
|
|
2056
|
+
);
|
|
2057
|
+
} else {
|
|
2058
|
+
console.warn(
|
|
2059
|
+
`Integry SDK render target with id ${containerId} was not found`,
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
2062
|
+
};
|
|
2063
|
+
|
|
2008
2064
|
public renderFlowStep = (
|
|
2009
2065
|
options: RenderFlowStepOptions = {
|
|
2010
2066
|
containerId: 'integry-marketplace',
|
package/src/interfaces/index.ts
CHANGED
|
@@ -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
|
+
}
|