@integry/sdk 4.7.39 → 4.7.41
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.js +1 -1
- package/dist/umd/index.umd.js +1 -1
- package/package.json +6 -1
- package/.eslintignore +0 -1
- package/.vscode/launch.json +0 -17
- package/CHANGELOG_INTERNAL.md +0 -134
- package/README_INTERNAL.md +0 -176
- package/THIRD_PARTY_LICENSES +0 -525
- package/generateTests.js +0 -80
- package/jest.config.cjs +0 -10
- package/src/components/AddTagButton/index.ts +0 -23
- package/src/components/BasicSelect/index.ts +0 -123
- package/src/components/BasicSelect/styles.module.scss +0 -44
- package/src/components/Button/index.ts +0 -97
- package/src/components/Button/styles.module.scss +0 -152
- package/src/components/CheckboxGroup/Checkbox.ts +0 -104
- package/src/components/CheckboxGroup/index.ts +0 -190
- package/src/components/CheckboxGroup/styles.module.scss +0 -63
- package/src/components/CollapsedMenu/index.ts +0 -104
- package/src/components/CollapsedMenu/styles.module.scss +0 -46
- package/src/components/ConfigureFieldWrapper/index.ts +0 -85
- package/src/components/ConfigureFieldWrapper/styles.module.scss +0 -57
- package/src/components/EditableText/index.ts +0 -121
- package/src/components/EditableText/styles.module.scss +0 -38
- package/src/components/EditableTextArea/index.ts +0 -143
- package/src/components/EditableTextArea/styles.module.scss +0 -91
- package/src/components/ErrorMessage/index.ts +0 -16
- package/src/components/ErrorMessage/styles.module.scss +0 -19
- package/src/components/ErrorPage/index.ts +0 -42
- package/src/components/ErrorPage/styles.module.scss +0 -26
- package/src/components/Footer/index.ts +0 -41
- package/src/components/Footer/styles.module.scss +0 -40
- package/src/components/HTMLContent/index.tsx +0 -205
- package/src/components/HTMLContent/styles.module.scss +0 -3
- package/src/components/InfoBox/index.ts +0 -48
- package/src/components/InfoBox/styles.module.scss +0 -21
- package/src/components/Input/BaseInput/index.ts +0 -170
- package/src/components/Input/BaseInput/styles.module.scss +0 -95
- package/src/components/Input/DateInput/index.ts +0 -103
- package/src/components/Input/DateInput/styles.module.scss +0 -50
- package/src/components/Input/Input/index.ts +0 -225
- package/src/components/Input/Input/styles.module.scss +0 -16
- package/src/components/Input/PasswordInput/index.ts +0 -164
- package/src/components/Input/PasswordInput/styles.module.scss +0 -37
- package/src/components/Input/index.ts +0 -7
- package/src/components/Label/index.ts +0 -61
- package/src/components/Label/styles.module.scss +0 -41
- package/src/components/LargeLoader/index.ts +0 -25
- package/src/components/LargeLoader/styles.module.scss +0 -16
- package/src/components/Listbox/ListBoxItem.ts +0 -57
- package/src/components/Listbox/index.ts +0 -488
- package/src/components/Listbox/styles.module.scss +0 -197
- package/src/components/Loader/index.ts +0 -25
- package/src/components/Loader/styles.module.scss +0 -16
- package/src/components/MediaGallery/MediaGalleryModal.ts +0 -82
- package/src/components/MediaGallery/MediaSlider.ts +0 -76
- package/src/components/MediaGallery/index.ts +0 -92
- package/src/components/MediaGallery/styles.module.scss +0 -156
- package/src/components/MediaUpload/index.ts +0 -233
- package/src/components/MediaUpload/styles.module.scss +0 -118
- package/src/components/Modal/index.ts +0 -87
- package/src/components/Modal/styles.module.scss +0 -441
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +0 -59
- package/src/components/MultipurposeField/Dropdown/index.tsx +0 -1202
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +0 -215
- package/src/components/MultipurposeField/TagMenu/index.ts +0 -536
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +0 -175
- package/src/components/MultipurposeField/TagOptions/index.tsx +0 -83
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +0 -95
- package/src/components/MultipurposeField/index.tsx +0 -944
- package/src/components/MultipurposeField/styles.module.scss +0 -77
- package/src/components/NewModal/index.ts +0 -69
- package/src/components/NewModal/styles.module.scss +0 -70
- package/src/components/OverflowTooltip/index.tsx +0 -59
- package/src/components/PopUp/ConfirmationPopUp/index.ts +0 -58
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +0 -49
- package/src/components/PopUp/SuccessPopUp/index.ts +0 -62
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +0 -38
- package/src/components/RadioGroup/Radio.ts +0 -128
- package/src/components/RadioGroup/index.ts +0 -169
- package/src/components/RadioGroup/styles.module.scss +0 -81
- package/src/components/Search/index.ts +0 -69
- package/src/components/Search/styles.module.scss +0 -149
- package/src/components/TabBar/Tab.ts +0 -33
- package/src/components/TabBar/index.ts +0 -64
- package/src/components/TabBar/styles.module.scss +0 -43
- package/src/components/Tag/index.ts +0 -29
- package/src/components/Tag/styles.module.scss +0 -57
- package/src/components/TagsMenu/index.ts +0 -1697
- package/src/components/TagsMenu/styles.module.scss +0 -350
- package/src/components/TestComponent/index.ts +0 -71
- package/src/components/TestComponent/styles.module.scss +0 -152
- package/src/components/TextArea/index.ts +0 -172
- package/src/components/TextArea/styles.module.scss +0 -72
- package/src/components/TextContent/index.tsx +0 -128
- package/src/components/TextContent/styles.module.scss +0 -6
- package/src/components/ThreeDotLoader/index.ts +0 -39
- package/src/components/ThreeDotLoader/styles.module.scss +0 -41
- package/src/components/TimeInput/index.ts +0 -129
- package/src/components/TimeInput/styles.module.scss +0 -16
- package/src/components/Toggle/index.ts +0 -34
- package/src/components/Toggle/styles.module.scss +0 -56
- package/src/components/Toggle-v2/index.ts +0 -40
- package/src/components/Toggle-v2/styles.module.scss +0 -86
- package/src/components/Tooltip/index.ts +0 -271
- package/src/components/Tooltip/styles.module.scss +0 -105
- package/src/components/form/FunctionField/index.ts +0 -816
- package/src/components/form/FunctionField/styles.module.scss +0 -478
- package/src/components/form/ObjectField/__snapshots__/index.ts.test.tsx.snap +0 -3
- package/src/components/form/ObjectField/index.ts +0 -593
- package/src/components/form/ObjectField/index.ts.test.tsx +0 -213
- package/src/components/form/ObjectField/styles.module.scss +0 -103
- package/src/components/form/index.ts +0 -4
- package/src/contexts/AppContext.ts +0 -12
- package/src/declaration.d.ts +0 -7
- package/src/extensions/HMAC.ts +0 -25
- package/src/extensions/IntegryAPIError.ts +0 -19
- package/src/features/common/AccountDropdown/index.ts +0 -291
- package/src/features/common/AccountDropdown/styles.module.scss +0 -19
- package/src/features/common/ActionForm/index.ts +0 -2602
- package/src/features/common/ActionForm/styles.module.scss +0 -35
- package/src/features/common/AppCard/index.ts +0 -207
- package/src/features/common/AppCard/styles.module.scss +0 -117
- package/src/features/common/AppCardCompact/index.ts +0 -189
- package/src/features/common/AppCardCompact/styles.module.scss +0 -141
- package/src/features/common/AuthSelector/index.ts +0 -537
- package/src/features/common/AuthSelector/styles.module.scss +0 -161
- package/src/features/common/AuthSelectorCompact/index.ts +0 -706
- package/src/features/common/AuthSelectorCompact/styles.module.scss +0 -219
- package/src/features/common/AuthSelectorDropdown/index.ts +0 -704
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +0 -361
- package/src/features/common/AuthSelectorV2/index.ts +0 -336
- package/src/features/common/AuthSelectorV2/styles.module.scss +0 -235
- package/src/features/common/DynamicField/index.ts +0 -402
- package/src/features/common/DynamicField/styles.module.scss +0 -266
- package/src/features/common/DynamicTypedField/index.ts +0 -504
- package/src/features/common/DynamicTypedField/styles.module.scss +0 -135
- package/src/features/common/FunctionForm/index.ts +0 -1095
- package/src/features/common/FunctionForm/styles.module.scss +0 -225
- package/src/features/common/MappingUI/index.ts +0 -649
- package/src/features/common/MappingUI/styles.module.scss +0 -121
- package/src/features/common/MarketplaceAppCard/index.ts +0 -279
- package/src/features/common/MarketplaceAppCard/styles.module.scss +0 -231
- package/src/features/common/MarketplaceAppCardCompact/index.ts +0 -283
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +0 -255
- package/src/features/common/NewMappingUI/index.ts +0 -515
- package/src/features/common/NewMappingUI/styles.module.scss +0 -113
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +0 -67
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +0 -23
- package/src/features/common/RequestAppWidget/index.ts +0 -48
- package/src/features/common/RequestAppWidget/request-app-form.ts +0 -89
- package/src/features/common/RequestAppWidget/styles.module.scss +0 -43
- package/src/features/common/SectionField/index.ts +0 -272
- package/src/features/common/SectionField/styles.module.scss +0 -67
- package/src/features/common/Step/index.ts +0 -827
- package/src/features/common/Step/styles.module.scss +0 -12
- package/src/features/common/StepNavigation/CollapsedSteps.ts +0 -131
- package/src/features/common/StepNavigation/NavItem.ts +0 -111
- package/src/features/common/StepNavigation/index.ts +0 -261
- package/src/features/common/StepNavigation/styles.module.scss +0 -117
- package/src/features/common/Steps/index.ts +0 -1140
- package/src/features/common/Steps/styles.module.scss +0 -314
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +0 -404
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +0 -367
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.test.tsx +0 -58
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +0 -208
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.test.tsx +0 -49
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +0 -421
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +0 -577
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +0 -83
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +0 -233
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +0 -45
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +0 -1085
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +0 -465
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +0 -610
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +0 -468
- package/src/features/containers/AppFlowContainer/index.ts +0 -114
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +0 -262
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +0 -120
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +0 -165
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +0 -81
- package/src/features/containers/AppPageContainer/index.tsx +0 -93
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +0 -161
- package/src/features/containers/AppsForFlows/styles.module.scss +0 -280
- package/src/features/containers/AppsForFlowsCompact/index.ts +0 -161
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +0 -279
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +0 -73
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +0 -67
- package/src/features/containers/AuthSetupContainer/Footer.ts +0 -32
- package/src/features/containers/AuthSetupContainer/Header.ts +0 -39
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +0 -27
- package/src/features/containers/AuthSetupContainer/index.ts +0 -349
- package/src/features/containers/AuthSetupContainer/styles.module.scss +0 -229
- package/src/features/containers/FlowSetupContainer/index.ts +0 -391
- package/src/features/containers/FlowSetupContainer/styles.module.scss +0 -18
- package/src/features/containers/MarkeplaceApps/index.ts +0 -583
- package/src/features/containers/MarkeplaceApps/styles.module.scss +0 -558
- package/src/features/containers/MarketplaceAppsCompact/index.ts +0 -585
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +0 -563
- package/src/features/containers/MarketplaceAppsContainer/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +0 -91
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +0 -66
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +0 -34
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +0 -10
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +0 -132
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +0 -117
- package/src/features/containers/MarketplaceContainer/index.ts +0 -242
- package/src/features/containers/MarketplaceContainer/styles.module.scss +0 -84
- package/src/features/containers/SDKContainer/index.ts +0 -817
- package/src/features/containers/SDKContainer/styles.module.scss +0 -266
- package/src/features/containers/SDKDebugContainer/index.ts +0 -137
- package/src/features/containers/SDKDebugContainer/styles.module.scss +0 -37
- package/src/features/containers/SDKFailedContainer/index.ts +0 -117
- package/src/features/containers/SDKFailedContainer/styles.module.scss +0 -57
- package/src/features/integrations/IntegrationRow/Icons.ts +0 -77
- package/src/features/integrations/IntegrationRow/index.ts +0 -129
- package/src/features/integrations/IntegrationRow/styles.module.scss +0 -62
- package/src/features/integrations/IntegrationsHeader/index.ts +0 -34
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +0 -47
- package/src/features/integrations/IntegrationsList/index.ts +0 -252
- package/src/features/integrations/IntegrationsList/styles.module.scss +0 -67
- package/src/features/templates/Template/index.ts +0 -295
- package/src/features/templates/Template/styles.module.scss +0 -226
- package/src/features/templates/TemplatesView/index.ts +0 -368
- package/src/features/templates/TemplatesView/styles.module.scss +0 -71
- package/src/features/templates/TemplatesViewCompact/index.ts +0 -364
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +0 -141
- package/src/hooks/useAutosizeTextArea.ts +0 -22
- package/src/hooks/useCustomRef.ts +0 -13
- package/src/hooks/useDebounce.ts +0 -17
- package/src/hooks/useElementResize.ts +0 -40
- package/src/hooks/useEventListener.ts +0 -42
- package/src/hooks/useHover.ts +0 -40
- package/src/hooks/useOnClickOutside.ts +0 -32
- package/src/index.ts +0 -2244
- package/src/index.umd.ts +0 -13
- package/src/interfaces/index.ts +0 -938
- package/src/modules/api/index.ts +0 -1325
- package/src/modules/api/responseHandler.ts +0 -38
- package/src/modules/event-emitter/index.ts +0 -72
- package/src/modules/event-emitter/runners/abstract.ts +0 -21
- package/src/modules/event-emitter/runners/default.ts +0 -11
- package/src/modules/event-emitter/runners/ntimes.ts +0 -28
- package/src/modules/event-emitter/types.ts +0 -34
- package/src/store/actionFunctions.ts +0 -1578
- package/src/store/index.ts +0 -17
- package/src/store/initialState.ts +0 -58
- package/src/types/index.ts +0 -320
- package/src/types/preact-compat.d.ts +0 -4
- package/src/types/store.ts +0 -366
- package/src/types/utils.ts +0 -19
- package/src/utils/ActivityOutputUtils.ts +0 -176
- package/src/utils/common.ts +0 -20
- package/src/utils/copyToClipboard.ts +0 -24
- package/src/utils/datetime.ts +0 -101
- package/src/utils/getUrlParam.ts +0 -11
- package/src/utils/isAuthMessage.ts +0 -16
- package/src/utils/isBrowser.ts +0 -1
- package/src/utils/jsonEncodeDecode.ts +0 -15
- package/src/utils/objectUtils.ts +0 -117
- package/src/utils/popup.ts +0 -30
- package/src/utils/searchJson.ts +0 -51
- package/src/utils/stepUtils.ts +0 -45
- package/src/utils/truncate.ts +0 -6
- package/test/setup.ts +0 -1
- package/vitest.config.ts +0 -16
|
@@ -1,593 +0,0 @@
|
|
|
1
|
-
import { html } from 'htm/preact';
|
|
2
|
-
import { useState, useEffect } from 'preact/hooks';
|
|
3
|
-
import { Input } from '@/components/Input';
|
|
4
|
-
import { TextArea } from '@/components/TextArea';
|
|
5
|
-
import { CheckboxGroup } from '@/components/CheckboxGroup';
|
|
6
|
-
import ConfigureFieldWrapper from '@/components/ConfigureFieldWrapper';
|
|
7
|
-
import { ListBox } from '@/components/MultipurposeField/Dropdown';
|
|
8
|
-
import { MultipurposeField } from '@/components/MultipurposeField';
|
|
9
|
-
import styles from './styles.module.scss';
|
|
10
|
-
|
|
11
|
-
interface ObjectFieldProps {
|
|
12
|
-
field: any;
|
|
13
|
-
functionArguments: any;
|
|
14
|
-
connectedAccount: string;
|
|
15
|
-
appName: string;
|
|
16
|
-
onChange: (
|
|
17
|
-
fieldId: string,
|
|
18
|
-
value: any,
|
|
19
|
-
type: string,
|
|
20
|
-
required: boolean,
|
|
21
|
-
parentFieldId?: string,
|
|
22
|
-
index?: number,
|
|
23
|
-
) => void;
|
|
24
|
-
onChangeInFlow?: (val: any) => void;
|
|
25
|
-
apiHandler: any;
|
|
26
|
-
isArray?: boolean; // New prop to check if the input is an array
|
|
27
|
-
activityOutputData: any;
|
|
28
|
-
activityOutputDataRaw: any;
|
|
29
|
-
objectValue?: any;
|
|
30
|
-
isDisabled?: boolean;
|
|
31
|
-
tagsTree?: any; // Optional prop for tags tree
|
|
32
|
-
showMenuOnLeft?: boolean; // Optional prop to show menu on the left
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
type Option = {
|
|
36
|
-
id: any;
|
|
37
|
-
value: string;
|
|
38
|
-
};
|
|
39
|
-
interface FieldDetails {
|
|
40
|
-
meta: {
|
|
41
|
-
title: string;
|
|
42
|
-
description_for_users: string;
|
|
43
|
-
is_required: boolean;
|
|
44
|
-
machine_name?: string;
|
|
45
|
-
ui: {
|
|
46
|
-
placeholder: string;
|
|
47
|
-
regex?: string;
|
|
48
|
-
regex_error_message?: string;
|
|
49
|
-
ui_field: {
|
|
50
|
-
type?: string;
|
|
51
|
-
options?: Option[];
|
|
52
|
-
data_source?: any; // If needed, define this more specifically
|
|
53
|
-
endpointURL?: string; // Add endpointURL here
|
|
54
|
-
option_key_path?: string;
|
|
55
|
-
value_key_path?: string;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
properties?: any; // If there are nested fields for objects
|
|
60
|
-
type: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Define the structure of each object in the array
|
|
64
|
-
type FieldObject = {
|
|
65
|
-
[key: string]: any; // Allow any string key with any value
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const transformTemplateFieldsToProperties = (templateFields: any[]) => {
|
|
69
|
-
const properties: { [key: string]: FieldDetails } = {};
|
|
70
|
-
|
|
71
|
-
templateFields.forEach((tf) => {
|
|
72
|
-
properties[tf.id || tf.machine_name] = {
|
|
73
|
-
meta: {
|
|
74
|
-
title: tf.title,
|
|
75
|
-
description_for_users: tf.description,
|
|
76
|
-
is_required: tf.is_required,
|
|
77
|
-
machine_name:
|
|
78
|
-
tf?.activity_field?.machine_name || tf?.machine_name || '',
|
|
79
|
-
ui: {
|
|
80
|
-
placeholder: tf.placeholder,
|
|
81
|
-
regex: tf.regex || '',
|
|
82
|
-
regex_error_message: tf.regex_msg || 'Invalid input.',
|
|
83
|
-
ui_field: tf?.ui_field || {
|
|
84
|
-
type: tf.type || 'TEXTFIELD',
|
|
85
|
-
options: [], // Populate if needed
|
|
86
|
-
data_source: null, // Adjust if needed
|
|
87
|
-
endpointURL: '', // Adjust if needed
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
properties: tf.template_fields?.length
|
|
92
|
-
? transformTemplateFieldsToProperties(tf.template_fields)
|
|
93
|
-
: undefined,
|
|
94
|
-
type: tf.data_type || 'string',
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
return properties;
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const ObjectField = (props: ObjectFieldProps) => {
|
|
102
|
-
const {
|
|
103
|
-
field,
|
|
104
|
-
functionArguments,
|
|
105
|
-
connectedAccount,
|
|
106
|
-
appName,
|
|
107
|
-
onChange,
|
|
108
|
-
onChangeInFlow,
|
|
109
|
-
apiHandler,
|
|
110
|
-
isArray = false, // Default to false
|
|
111
|
-
activityOutputData,
|
|
112
|
-
activityOutputDataRaw,
|
|
113
|
-
objectValue,
|
|
114
|
-
isDisabled = false,
|
|
115
|
-
tagsTree = null,
|
|
116
|
-
showMenuOnLeft = false, // Default to false
|
|
117
|
-
} = props;
|
|
118
|
-
|
|
119
|
-
// Calculate initial state based on field properties
|
|
120
|
-
const calculateInitialObjectHasFields = (f: any) => {
|
|
121
|
-
// Special case for the Blocks field or similar fields
|
|
122
|
-
if (
|
|
123
|
-
field.type === 'TEXTAREA' &&
|
|
124
|
-
(field.data_type === 'OBJECT[]' || field.data_type === 'OBJECT') &&
|
|
125
|
-
(!field.template_fields || field.template_fields.length === 0)
|
|
126
|
-
) {
|
|
127
|
-
return false;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// For other cases, use the original logic
|
|
131
|
-
if (Array.isArray(field.template_fields)) {
|
|
132
|
-
if (field.template_fields.length > 0) {
|
|
133
|
-
return true;
|
|
134
|
-
}
|
|
135
|
-
if (field.type === 'TEXTAREA' || field.type === 'DYNAMIC') {
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
} else if (field.properties && Object.keys(field.properties).length === 0) {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
return true;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const calculateInitialShowAddMoreOption = (f: any) => {
|
|
146
|
-
// Special case for the Blocks field or similar fields
|
|
147
|
-
if (
|
|
148
|
-
field.type === 'TEXTAREA' &&
|
|
149
|
-
(field.data_type === 'OBJECT[]' || field.data_type === 'OBJECT') &&
|
|
150
|
-
(!field.template_fields || field.template_fields.length === 0)
|
|
151
|
-
) {
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// For other cases, use the original logic
|
|
156
|
-
if (Array.isArray(field.template_fields)) {
|
|
157
|
-
if (field.template_fields.length > 0) {
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
if (field.type === 'TEXTAREA' || field.type === 'DYNAMIC') {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
} else if (field.properties && Object.keys(field.properties).length === 0) {
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return true;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const [objectArray, setObjectArray] = useState<FieldObject[]>(
|
|
171
|
-
Array.isArray(objectValue) ? objectValue : [{}],
|
|
172
|
-
); // Start with one empty object in the array
|
|
173
|
-
const [showAddMoreOption, setShowAddMoreOption] = useState(() =>
|
|
174
|
-
calculateInitialShowAddMoreOption(field),
|
|
175
|
-
);
|
|
176
|
-
const [objectHasFields, setObjectHasFields] = useState(() =>
|
|
177
|
-
calculateInitialObjectHasFields(field),
|
|
178
|
-
);
|
|
179
|
-
|
|
180
|
-
let templateFields = [];
|
|
181
|
-
|
|
182
|
-
if (Array.isArray(field.template_fields)) {
|
|
183
|
-
if (field.template_fields.length > 0) {
|
|
184
|
-
templateFields = field.template_fields;
|
|
185
|
-
} else if (field.type === 'TEXTAREA' || field.type === 'DYNAMIC') {
|
|
186
|
-
if (field.data_type === 'OBJECT[]' || field.data_type === 'OBJECT') {
|
|
187
|
-
field.type = 'TEXTAREA';
|
|
188
|
-
setShowAddMoreOption(false);
|
|
189
|
-
setObjectHasFields(false);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
templateFields = [field];
|
|
193
|
-
}
|
|
194
|
-
} else if (field.properties && Object.keys(field.properties).length === 0) {
|
|
195
|
-
field.type = 'TEXTAREA';
|
|
196
|
-
field.template_fields = [];
|
|
197
|
-
field.properties = null;
|
|
198
|
-
templateFields = [field];
|
|
199
|
-
setShowAddMoreOption(false);
|
|
200
|
-
setObjectHasFields(false);
|
|
201
|
-
}
|
|
202
|
-
const normalizedField = {
|
|
203
|
-
...field,
|
|
204
|
-
properties:
|
|
205
|
-
field.properties ||
|
|
206
|
-
(field.template_fields
|
|
207
|
-
? transformTemplateFieldsToProperties(templateFields)
|
|
208
|
-
: {}),
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
const isFlow = !field.properties && !!field.template_fields;
|
|
212
|
-
|
|
213
|
-
if (isFlow) {
|
|
214
|
-
setObjectHasFields(
|
|
215
|
-
!!Object.keys(normalizedField?.template_fields || []).length,
|
|
216
|
-
);
|
|
217
|
-
setShowAddMoreOption(
|
|
218
|
-
!!Object.keys(normalizedField?.template_fields || []).length,
|
|
219
|
-
);
|
|
220
|
-
} else {
|
|
221
|
-
setObjectHasFields(!!Object.keys(normalizedField?.properties || []).length);
|
|
222
|
-
setShowAddMoreOption(
|
|
223
|
-
!!Object.keys(normalizedField?.properties || []).length,
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
useEffect(() => {
|
|
228
|
-
let objectValueCopy = objectValue;
|
|
229
|
-
if (
|
|
230
|
-
typeof objectValue === 'string' &&
|
|
231
|
-
objectValue.length > 0 &&
|
|
232
|
-
field.type !== 'TEXTAREA'
|
|
233
|
-
) {
|
|
234
|
-
// if default value was sent as a strinfiyed object
|
|
235
|
-
objectValueCopy = JSON.parse(objectValue);
|
|
236
|
-
}
|
|
237
|
-
if (objectValueCopy) {
|
|
238
|
-
if (Array.isArray(objectValueCopy)) {
|
|
239
|
-
setObjectArray(objectValueCopy);
|
|
240
|
-
} else {
|
|
241
|
-
setObjectArray([objectValueCopy]);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, [objectValue]);
|
|
245
|
-
|
|
246
|
-
// Method to handle field changes for each object in the array
|
|
247
|
-
const handleFieldChange = (
|
|
248
|
-
index: number,
|
|
249
|
-
fieldId: string,
|
|
250
|
-
value: any,
|
|
251
|
-
dataType: string,
|
|
252
|
-
machine_name?: string,
|
|
253
|
-
) => {
|
|
254
|
-
const updatedObjectArray =
|
|
255
|
-
field.type === 'TEXTAREA' ? value : [...objectArray];
|
|
256
|
-
const updatedObjectArrayKey = (isFlow && machine_name) || fieldId;
|
|
257
|
-
if (field.type !== 'TEXTAREA') {
|
|
258
|
-
updatedObjectArray[index][updatedObjectArrayKey] = value;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Update the state with the modified object array
|
|
262
|
-
if (field.type === 'TEXTAREA') {
|
|
263
|
-
setObjectArray([updatedObjectArray]);
|
|
264
|
-
} else {
|
|
265
|
-
setObjectArray(updatedObjectArray);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Optionally trigger the parent change handler
|
|
269
|
-
if (isArray) {
|
|
270
|
-
if (isFlow && onChangeInFlow) {
|
|
271
|
-
if (normalizedField.template_fields?.length > 0) {
|
|
272
|
-
onChangeInFlow(JSON.stringify(updatedObjectArray));
|
|
273
|
-
} else {
|
|
274
|
-
onChangeInFlow(value);
|
|
275
|
-
}
|
|
276
|
-
} else {
|
|
277
|
-
onChange(
|
|
278
|
-
fieldId,
|
|
279
|
-
updatedObjectArray,
|
|
280
|
-
dataType,
|
|
281
|
-
field.is_required,
|
|
282
|
-
field.id,
|
|
283
|
-
index,
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
} else if (isFlow && onChangeInFlow) {
|
|
287
|
-
if (normalizedField.template_fields?.length > 0) {
|
|
288
|
-
onChangeInFlow(
|
|
289
|
-
JSON.stringify({
|
|
290
|
-
[machine_name || '']: value,
|
|
291
|
-
}),
|
|
292
|
-
);
|
|
293
|
-
} else {
|
|
294
|
-
onChangeInFlow(value);
|
|
295
|
-
}
|
|
296
|
-
} else {
|
|
297
|
-
onChange(fieldId, value, dataType, field.is_required, field.id);
|
|
298
|
-
}
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
// Method to handle the 'Add More' button click
|
|
302
|
-
const handleAddMore = () => {
|
|
303
|
-
setObjectArray([...objectArray, {}]); // Add another empty object to the array
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const getRegex: any = (f: any) => {
|
|
307
|
-
if (f.type === 'boolean') {
|
|
308
|
-
return '^(true|false)$'; // Matches "true" or "false" as strings
|
|
309
|
-
}
|
|
310
|
-
if (f.type === 'number') {
|
|
311
|
-
return '^\\d+$'; // Matches numeric values only
|
|
312
|
-
}
|
|
313
|
-
if (f.type === 'array' && f.items && f.items.type === 'number') {
|
|
314
|
-
return '^\\d+$'; // Matches numeric values only
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
return ''; // Default to empty string
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
const getRegexErrorMessage: any = (f: any) => {
|
|
321
|
-
if (f.type === 'boolean') {
|
|
322
|
-
return 'Please enter "true" or "false".'; // Error message for boolean fields
|
|
323
|
-
}
|
|
324
|
-
if (f.type === 'number') {
|
|
325
|
-
return 'Please enter a valid number.'; // Error message for number fields
|
|
326
|
-
}
|
|
327
|
-
if (f.type === 'array' && f.items && f.items.type === 'number') {
|
|
328
|
-
return 'Please enter a valid number.'; // Error message for number fields
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return 'Invalid input.'; // Default error message
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
const handleDeleteIconClick = (index: number) => {
|
|
335
|
-
setObjectArray((prevValues) => {
|
|
336
|
-
const newValues = prevValues.filter((_, i) => i !== index);
|
|
337
|
-
return newValues;
|
|
338
|
-
});
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
const formatValueForTextarea = (value: any): string => {
|
|
342
|
-
if (typeof value === 'object' && value !== null) {
|
|
343
|
-
return JSON.stringify(value, null, 2); // Pretty-print with 2-space indentation
|
|
344
|
-
}
|
|
345
|
-
return String(value || ''); // Convert other values to string
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
// Render fields for each object in the array
|
|
349
|
-
const renderFields = (
|
|
350
|
-
properties: { [key: string]: FieldDetails },
|
|
351
|
-
objectIndex: number,
|
|
352
|
-
) =>
|
|
353
|
-
Object.entries(properties).map(([fieldName, fieldDetails], index) => {
|
|
354
|
-
const fieldType = fieldDetails.meta.ui.ui_field?.type || 'TEXTFIELD';
|
|
355
|
-
let options: Option[] = fieldDetails.meta.ui.ui_field?.options || [];
|
|
356
|
-
if (fieldType === 'CHECKBOX') {
|
|
357
|
-
options = [
|
|
358
|
-
{
|
|
359
|
-
id: '0',
|
|
360
|
-
value: 'No',
|
|
361
|
-
},
|
|
362
|
-
{
|
|
363
|
-
id: '1',
|
|
364
|
-
value: 'Yes',
|
|
365
|
-
},
|
|
366
|
-
];
|
|
367
|
-
}
|
|
368
|
-
const placeholder =
|
|
369
|
-
fieldDetails.meta.ui.placeholder ||
|
|
370
|
-
(['DYNAMIC_DROPDOWN', 'STATIC_DROPDOWN'].includes(
|
|
371
|
-
fieldDetails.meta.ui.ui_field?.type || '',
|
|
372
|
-
)
|
|
373
|
-
? `Select or enter a value here...`
|
|
374
|
-
: `Enter value here...`);
|
|
375
|
-
|
|
376
|
-
const fieldElement = html`
|
|
377
|
-
<div
|
|
378
|
-
id=${[
|
|
379
|
-
'integry-action-field-wrap',
|
|
380
|
-
field?.activity_field?.machine_name !==
|
|
381
|
-
fieldDetails?.meta?.machine_name
|
|
382
|
-
? field?.activity_field?.machine_name
|
|
383
|
-
: null,
|
|
384
|
-
fieldDetails?.meta?.machine_name,
|
|
385
|
-
isArray ? objectIndex : null,
|
|
386
|
-
]
|
|
387
|
-
.filter(Boolean)
|
|
388
|
-
.join('-')}
|
|
389
|
-
class="${styles.functionFieldWrap
|
|
390
|
-
? styles.functionFieldWrap
|
|
391
|
-
: ''} integry-action-field-wrap"
|
|
392
|
-
>
|
|
393
|
-
<${ConfigureFieldWrapper} field=${fieldDetails}>
|
|
394
|
-
${fieldType === 'TEXTFIELD' &&
|
|
395
|
-
html`
|
|
396
|
-
<${MultipurposeField}
|
|
397
|
-
id="${fieldName}"
|
|
398
|
-
title="${fieldDetails.meta.title}"
|
|
399
|
-
activityOutputData=${activityOutputData}
|
|
400
|
-
activityOutputDataRaw=${activityOutputDataRaw}
|
|
401
|
-
description="${fieldDetails.meta.description_for_users}"
|
|
402
|
-
value=${(objectArray[objectIndex] || {})[
|
|
403
|
-
fieldDetails?.meta?.machine_name || ''
|
|
404
|
-
] || ''}
|
|
405
|
-
placeholder="${placeholder}"
|
|
406
|
-
onChange=${(val: any) => {
|
|
407
|
-
const valueReceived =
|
|
408
|
-
fieldDetails.type === 'number' ? Number(val) : val;
|
|
409
|
-
handleFieldChange(
|
|
410
|
-
objectIndex,
|
|
411
|
-
fieldName,
|
|
412
|
-
valueReceived,
|
|
413
|
-
fieldDetails.meta.ui.ui_field?.type || 'TEXTFIELD',
|
|
414
|
-
fieldDetails.meta.machine_name,
|
|
415
|
-
);
|
|
416
|
-
}}
|
|
417
|
-
regex=${fieldDetails.meta.ui.regex || getRegex(fieldDetails)}
|
|
418
|
-
regexErrorMessage=${fieldDetails.meta.ui.regex_error_message ||
|
|
419
|
-
getRegexErrorMessage(fieldDetails)}
|
|
420
|
-
isRequired="${fieldDetails.meta.is_required}"
|
|
421
|
-
type=${fieldType}
|
|
422
|
-
isMappable=${activityOutputDataRaw &&
|
|
423
|
-
Object.entries(activityOutputDataRaw).length > 0}
|
|
424
|
-
isEditable=${true}
|
|
425
|
-
allowTagsInText=${activityOutputDataRaw}
|
|
426
|
-
fieldId=${`${field.id}_${fieldName}`}
|
|
427
|
-
isDisabled=${isDisabled}
|
|
428
|
-
><//>
|
|
429
|
-
`}
|
|
430
|
-
${fieldType === 'TEXTAREA' &&
|
|
431
|
-
html`
|
|
432
|
-
<${MultipurposeField}
|
|
433
|
-
id="${fieldName}"
|
|
434
|
-
title="${fieldDetails.meta.title}"
|
|
435
|
-
description="${fieldDetails.meta.description_for_users}"
|
|
436
|
-
activityOutputData=${activityOutputData}
|
|
437
|
-
activityOutputDataRaw=${activityOutputDataRaw}
|
|
438
|
-
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
439
|
-
onChange=${(val: any) =>
|
|
440
|
-
handleFieldChange(
|
|
441
|
-
objectIndex,
|
|
442
|
-
fieldName,
|
|
443
|
-
val,
|
|
444
|
-
fieldDetails.meta.ui.ui_field?.type || 'TEXTAREA',
|
|
445
|
-
fieldDetails.meta.machine_name,
|
|
446
|
-
)}
|
|
447
|
-
placeholder="${placeholder}"
|
|
448
|
-
isRequired="${fieldDetails.meta.is_required}"
|
|
449
|
-
regex=${fieldDetails.meta.ui.regex || getRegex(fieldDetails)}
|
|
450
|
-
regexErrorMessage=${fieldDetails.meta.ui.regex_error_message ||
|
|
451
|
-
getRegexErrorMessage(fieldDetails)}
|
|
452
|
-
isEditable=${true}
|
|
453
|
-
fieldId=${`${field.id}_${fieldName}`}
|
|
454
|
-
type=${fieldType}
|
|
455
|
-
isMappable=${tagsTree
|
|
456
|
-
? true
|
|
457
|
-
: activityOutputDataRaw &&
|
|
458
|
-
Object.entries(activityOutputDataRaw).length > 0}
|
|
459
|
-
allowTagsInText=${activityOutputDataRaw || tagsTree}
|
|
460
|
-
value=${objectHasFields
|
|
461
|
-
? (objectArray[objectIndex] || {})[
|
|
462
|
-
fieldDetails?.meta?.machine_name || ''
|
|
463
|
-
] || ''
|
|
464
|
-
: formatValueForTextarea(objectValue)}
|
|
465
|
-
isDisabled=${isDisabled}
|
|
466
|
-
tagsTree=${tagsTree}
|
|
467
|
-
showMenuOnLeft=${showMenuOnLeft}
|
|
468
|
-
><//>
|
|
469
|
-
`}
|
|
470
|
-
${fieldType === 'DYNAMIC_DROPDOWN' &&
|
|
471
|
-
html`
|
|
472
|
-
<${ListBox}
|
|
473
|
-
key=${fieldName}
|
|
474
|
-
fieldId=${fieldName}
|
|
475
|
-
apiHandler=${apiHandler}
|
|
476
|
-
title=${fieldDetails.meta.title}
|
|
477
|
-
description=${fieldDetails.meta.description_for_users}
|
|
478
|
-
placeholder="${placeholder}"
|
|
479
|
-
isRequired="${fieldDetails.meta.is_required}"
|
|
480
|
-
isDynamic=${true}
|
|
481
|
-
isDisabled=${isDisabled}
|
|
482
|
-
endpointUrl=${fieldDetails.meta.ui.ui_field?.data_source?.url ||
|
|
483
|
-
''}
|
|
484
|
-
options=${options}
|
|
485
|
-
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
486
|
-
onChange=${(val: any) =>
|
|
487
|
-
handleFieldChange(
|
|
488
|
-
objectIndex,
|
|
489
|
-
fieldName,
|
|
490
|
-
val,
|
|
491
|
-
fieldDetails.meta.ui.ui_field?.type || 'DYNAMIC_DROPDOWN',
|
|
492
|
-
fieldDetails.meta.machine_name,
|
|
493
|
-
)}
|
|
494
|
-
optionKeyPath=${fieldDetails.meta.ui.ui_field?.value_key_path ||
|
|
495
|
-
''}
|
|
496
|
-
valueKeyPath=${fieldDetails.meta.ui.ui_field?.option_key_path ||
|
|
497
|
-
''}
|
|
498
|
-
/>
|
|
499
|
-
`}
|
|
500
|
-
${(fieldType === 'STATIC_DROPDOWN' || fieldType === 'CHECKBOX') &&
|
|
501
|
-
html`
|
|
502
|
-
<${ListBox}
|
|
503
|
-
key=${`${fieldName}_${objectIndex}`}
|
|
504
|
-
fieldId=${`${fieldName}_${objectIndex}`}
|
|
505
|
-
apiHandler=${apiHandler}
|
|
506
|
-
title=${fieldDetails.meta.title}
|
|
507
|
-
description=${fieldDetails.meta.description_for_users}
|
|
508
|
-
placeholder="${placeholder}"
|
|
509
|
-
isRequired="${fieldDetails.meta.is_required}"
|
|
510
|
-
isDynamic=${false}
|
|
511
|
-
isDisabled=${isDisabled}
|
|
512
|
-
endpointUrl=${JSON.stringify(options) || ''}
|
|
513
|
-
options=${options}
|
|
514
|
-
type=${fieldType}
|
|
515
|
-
value=${(objectArray[objectIndex] || {})[fieldName] || ''}
|
|
516
|
-
onChange=${(val: any) =>
|
|
517
|
-
handleFieldChange(
|
|
518
|
-
objectIndex,
|
|
519
|
-
fieldName,
|
|
520
|
-
val,
|
|
521
|
-
fieldDetails.meta.ui.ui_field?.type || 'DYNAMIC_DROPDOWN',
|
|
522
|
-
fieldDetails.meta.machine_name,
|
|
523
|
-
)}
|
|
524
|
-
/>
|
|
525
|
-
`}
|
|
526
|
-
<//>
|
|
527
|
-
</div>
|
|
528
|
-
`;
|
|
529
|
-
|
|
530
|
-
return fieldElement;
|
|
531
|
-
});
|
|
532
|
-
return html`
|
|
533
|
-
<div class="${styles.objectContainer}">
|
|
534
|
-
${objectArray.map(
|
|
535
|
-
(_, index) =>
|
|
536
|
-
html`
|
|
537
|
-
<div class="${objectHasFields ? styles.objectFieldWrap : ''}">
|
|
538
|
-
${objectHasFields &&
|
|
539
|
-
html`<div class="${styles.label}">
|
|
540
|
-
<label class="${styles.subLabel}">
|
|
541
|
-
<div>
|
|
542
|
-
${field.title}${isArray ? ` ${index + 1}` : ''}
|
|
543
|
-
${isArray &&
|
|
544
|
-
objectArray.length > 1 &&
|
|
545
|
-
index !== objectArray.length - 1 &&
|
|
546
|
-
html`
|
|
547
|
-
<div class=${styles.removeButton}>
|
|
548
|
-
<button
|
|
549
|
-
class="${styles.removeButton}"
|
|
550
|
-
onClick=${() => {
|
|
551
|
-
if (handleDeleteIconClick) {
|
|
552
|
-
handleDeleteIconClick(index);
|
|
553
|
-
}
|
|
554
|
-
}}
|
|
555
|
-
tabindex="-1"
|
|
556
|
-
>
|
|
557
|
-
<svg
|
|
558
|
-
width="15"
|
|
559
|
-
height="15"
|
|
560
|
-
viewBox="0 0 15 15"
|
|
561
|
-
fill="none"
|
|
562
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
563
|
-
>
|
|
564
|
-
<path d="M1.5 4.1999H13.65" stroke="#999999" />
|
|
565
|
-
<path
|
|
566
|
-
d="M11.6254 5.5498V6.2248L10.9504 13.6498H4.20039L3.52539 6.2248V5.5498"
|
|
567
|
-
stroke="#999999"
|
|
568
|
-
stroke-linejoin="round"
|
|
569
|
-
/>
|
|
570
|
-
<path
|
|
571
|
-
d="M5.55078 3.525V2.175C5.55078 1.80221 5.85299 1.5 6.22578 1.5H8.92578C9.29857 1.5 9.60078 1.80221 9.60078 2.175V3.525"
|
|
572
|
-
stroke="#999999"
|
|
573
|
-
/>
|
|
574
|
-
</svg>
|
|
575
|
-
</button>
|
|
576
|
-
</div>
|
|
577
|
-
`}
|
|
578
|
-
</div>
|
|
579
|
-
<div>${field.description}</div>
|
|
580
|
-
</label>
|
|
581
|
-
</div>`}
|
|
582
|
-
${renderFields(normalizedField.properties, index)}
|
|
583
|
-
</div>
|
|
584
|
-
`,
|
|
585
|
-
)}
|
|
586
|
-
${isArray &&
|
|
587
|
-
showAddMoreOption &&
|
|
588
|
-
html` <a onClick=${handleAddMore}>+ Add another ${field.title}</a> `}
|
|
589
|
-
</div>
|
|
590
|
-
`;
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
export { ObjectField, ObjectFieldProps };
|