@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,827 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-nested-ternary */
|
|
2
|
-
import { html, Component } from 'htm/preact';
|
|
3
|
-
import { connect } from 'unistore/preact';
|
|
4
|
-
// import DOMPurify from 'dompurify';
|
|
5
|
-
import { IntegrySDKEvents } from '@/types';
|
|
6
|
-
import { IntegryAPI } from '@/modules/api';
|
|
7
|
-
import { EventEmitter } from '@/modules/event-emitter';
|
|
8
|
-
import { ListBox } from '@/components/Listbox';
|
|
9
|
-
import { Loader } from '@/components/Loader';
|
|
10
|
-
import { IntegryStep, TemplateField } from '@/interfaces';
|
|
11
|
-
import { actionFunctions } from '@/store';
|
|
12
|
-
import MappingUI from '@/features/common/MappingUI';
|
|
13
|
-
import { Button } from '@/components/Button';
|
|
14
|
-
import { StoreType } from '@/types/store';
|
|
15
|
-
import { CheckboxGroup } from '@/components/CheckboxGroup';
|
|
16
|
-
import { DateInput, Input, PasswordInput } from '@/components/Input';
|
|
17
|
-
import { TextArea } from '@/components/TextArea';
|
|
18
|
-
import DynamicField from '@/features/common/DynamicField';
|
|
19
|
-
import { RadioGroup } from '@/components/RadioGroup';
|
|
20
|
-
import { TimeInput } from '@/components/TimeInput';
|
|
21
|
-
import NewMappingUI from '@/features/common/NewMappingUI';
|
|
22
|
-
import { areParentValuesValid } from '@/utils/stepUtils';
|
|
23
|
-
|
|
24
|
-
import styles from './styles.module.scss';
|
|
25
|
-
|
|
26
|
-
interface StepPropsType extends StoreType {
|
|
27
|
-
step: IntegryStep;
|
|
28
|
-
stepType: 'AUTH' | 'CONFIGURATION' | 'SECTION';
|
|
29
|
-
showStepValidation: boolean;
|
|
30
|
-
apiHandler: IntegryAPI;
|
|
31
|
-
eventEmitter: EventEmitter<IntegrySDKEvents>;
|
|
32
|
-
isReadOnly?: boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface StepStateType {
|
|
36
|
-
loading: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
class Step extends Component<StepPropsType, StepStateType> {
|
|
40
|
-
constructor(props: StepPropsType) {
|
|
41
|
-
super(props);
|
|
42
|
-
this.state = {
|
|
43
|
-
loading: false,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
componentDidMount() {
|
|
48
|
-
const { step, verifyStepValidity } = this.props;
|
|
49
|
-
verifyStepValidity(step.id);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
componentDidUpdate(prevProps: StepPropsType) {
|
|
53
|
-
const { step, verifyStepValidity } = this.props;
|
|
54
|
-
if (prevProps.step.id !== step.id) {
|
|
55
|
-
verifyStepValidity(step.id);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
private getStepVisibleFieldsData = (
|
|
60
|
-
stepId: number,
|
|
61
|
-
): {
|
|
62
|
-
[machineName: string]: string;
|
|
63
|
-
} => {
|
|
64
|
-
const fields = this.props.stepDataMapping[stepId];
|
|
65
|
-
const requiredFieldsWithValues = Object.keys(fields)
|
|
66
|
-
.filter((el) => fields[Number(el)].value)
|
|
67
|
-
.reduce((prev, curr) => {
|
|
68
|
-
const currentItem = fields[Number(curr)];
|
|
69
|
-
return {
|
|
70
|
-
...prev,
|
|
71
|
-
[currentItem.machineName]: currentItem.value,
|
|
72
|
-
};
|
|
73
|
-
}, {});
|
|
74
|
-
return requiredFieldsWithValues;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
private areParentValuesFilled = (stepId: number, parentFields: string[]) => {
|
|
78
|
-
let valid = true;
|
|
79
|
-
// check if all parent fields have their values set
|
|
80
|
-
for (let index = 0; index < parentFields.length; index += 1) {
|
|
81
|
-
const val = parentFields[index];
|
|
82
|
-
let fieldId = null;
|
|
83
|
-
if (this.props.parentChildMapping[stepId][val]) {
|
|
84
|
-
fieldId = this.props.parentChildMapping[stepId][val].fieldId;
|
|
85
|
-
}
|
|
86
|
-
const parentField =
|
|
87
|
-
fieldId &&
|
|
88
|
-
this.props.stepDataMapping[stepId] &&
|
|
89
|
-
this.props.stepDataMapping[stepId][fieldId];
|
|
90
|
-
if (!(parentField && parentField.value)) {
|
|
91
|
-
valid = false;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return valid;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
private doParentFieldsHaveValues = (stepId: number, machineName: string) => {
|
|
99
|
-
let valid = true;
|
|
100
|
-
const fieldInfo = this.props.parentChildMapping[stepId][machineName];
|
|
101
|
-
|
|
102
|
-
if (fieldInfo && fieldInfo.parentFields)
|
|
103
|
-
// check if all parent fields have their values set
|
|
104
|
-
for (let index = 0; index < fieldInfo.parentFields.length; index += 1) {
|
|
105
|
-
const parentField = this.props.parentChildMapping[stepId][
|
|
106
|
-
fieldInfo.parentFields[index]
|
|
107
|
-
];
|
|
108
|
-
const parentFieldData =
|
|
109
|
-
parentField &&
|
|
110
|
-
this.props.stepDataMapping[stepId] &&
|
|
111
|
-
this.props.stepDataMapping[stepId][parentField.fieldId];
|
|
112
|
-
if (!(parentFieldData && parentFieldData.value)) {
|
|
113
|
-
valid = false;
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return valid;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
private shouldShowStep = (field: TemplateField) => {
|
|
121
|
-
const stepId = this.props.step.id;
|
|
122
|
-
const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
|
|
123
|
-
|
|
124
|
-
if (field.type === 'BUTTON' || field.type === 'HTML') return true;
|
|
125
|
-
|
|
126
|
-
if (stepObject && field.activity_field) {
|
|
127
|
-
const shouldBeShown = !field.is_hidden;
|
|
128
|
-
// const isAuthSelected = stepObject.selectedAuthId;
|
|
129
|
-
const isAuthSelected = true;
|
|
130
|
-
|
|
131
|
-
const { parentFields } = this.props.parentChildMapping[stepId][
|
|
132
|
-
field.activity_field.machine_name
|
|
133
|
-
];
|
|
134
|
-
|
|
135
|
-
const fieldConditions = this.props.conditionalFieldMapping[stepId][
|
|
136
|
-
field.activity_field.machine_name
|
|
137
|
-
];
|
|
138
|
-
let isParentFilled = true;
|
|
139
|
-
let isConditionValid = true;
|
|
140
|
-
if (parentFields) {
|
|
141
|
-
isParentFilled = this.areParentValuesFilled(stepId, parentFields);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (fieldConditions) {
|
|
145
|
-
isConditionValid = areParentValuesValid(
|
|
146
|
-
stepId,
|
|
147
|
-
fieldConditions,
|
|
148
|
-
this.props.stepDataMapping,
|
|
149
|
-
);
|
|
150
|
-
}
|
|
151
|
-
const isValid = isParentFilled && isConditionValid;
|
|
152
|
-
|
|
153
|
-
return shouldBeShown && isAuthSelected && isValid;
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
private stepIsOfType = (fields: string[]) => {
|
|
159
|
-
const stepId = this.props.step.id;
|
|
160
|
-
const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
|
|
161
|
-
return fields.indexOf(stepObject.step.activity.type) > -1;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
private textFieldParentHasValues = () => {
|
|
165
|
-
const stepId = this.props.step.id;
|
|
166
|
-
const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
|
|
167
|
-
|
|
168
|
-
const anyVisibleFields = stepObject.step.template_fields.filter(
|
|
169
|
-
(el) => el.is_visible,
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
const isAuthSelected = stepObject.selectedAuthId;
|
|
173
|
-
|
|
174
|
-
const dynamicField = anyVisibleFields.filter(
|
|
175
|
-
(el) => el.activity_field && el.activity_field.type === 'DYNAMIC',
|
|
176
|
-
)[0];
|
|
177
|
-
|
|
178
|
-
if (!dynamicField) {
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
anyVisibleFields.length > 0 &&
|
|
184
|
-
dynamicField &&
|
|
185
|
-
dynamicField.activity_field &&
|
|
186
|
-
isAuthSelected &&
|
|
187
|
-
this.doParentFieldsHaveValues(
|
|
188
|
-
stepId,
|
|
189
|
-
dynamicField.activity_field.machine_name,
|
|
190
|
-
)
|
|
191
|
-
) {
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
return false;
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
private shouldShowOldMapping = () => {
|
|
198
|
-
const stepId = this.props.step.id;
|
|
199
|
-
const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
|
|
200
|
-
if (this.stepIsOfType(['ADAPTER', 'ACTION'])) {
|
|
201
|
-
const anyVisibleFields = stepObject.step.template_fields.filter(
|
|
202
|
-
(el) => el.is_visible,
|
|
203
|
-
);
|
|
204
|
-
|
|
205
|
-
const anyVisibleTextFields = stepObject.step.template_fields.filter(
|
|
206
|
-
(el) => el.is_visible && el.activity_field?.type === 'TEXTFIELD',
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
const isAuthSelected = stepObject.selectedAuthId;
|
|
210
|
-
|
|
211
|
-
const dynamicField = anyVisibleFields.filter(
|
|
212
|
-
(el) => el.activity_field && el.activity_field.type === 'DYNAMIC',
|
|
213
|
-
)[0];
|
|
214
|
-
|
|
215
|
-
// show mapping whenever we have visible text fields and a selected auth
|
|
216
|
-
if (
|
|
217
|
-
anyVisibleTextFields.length > 0 &&
|
|
218
|
-
isAuthSelected &&
|
|
219
|
-
!dynamicField &&
|
|
220
|
-
!this.shouldShowNewMapping()
|
|
221
|
-
)
|
|
222
|
-
return true;
|
|
223
|
-
|
|
224
|
-
// in case we dont have visible text fields and no dynamic fields, dont show mapping
|
|
225
|
-
if (!dynamicField) {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
if (
|
|
230
|
-
anyVisibleFields.length > 0 &&
|
|
231
|
-
isAuthSelected &&
|
|
232
|
-
dynamicField &&
|
|
233
|
-
dynamicField.activity_field &&
|
|
234
|
-
this.doParentFieldsHaveValues(
|
|
235
|
-
stepId,
|
|
236
|
-
dynamicField.activity_field.machine_name,
|
|
237
|
-
)
|
|
238
|
-
) {
|
|
239
|
-
const fieldConditions = this.props.conditionalFieldMapping[stepId][
|
|
240
|
-
dynamicField.activity_field.machine_name
|
|
241
|
-
];
|
|
242
|
-
if (fieldConditions) {
|
|
243
|
-
return areParentValuesValid(
|
|
244
|
-
stepId,
|
|
245
|
-
fieldConditions,
|
|
246
|
-
this.props.stepDataMapping,
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
return true;
|
|
250
|
-
}
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
return false;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
private shouldShowNewMapping = () => {
|
|
257
|
-
const { step, stepMapping } = this.props;
|
|
258
|
-
const stepObject = stepMapping[step.id];
|
|
259
|
-
|
|
260
|
-
if (this.stepIsOfType(['ADAPTER', 'ACTION'])) {
|
|
261
|
-
const anyVisibleFields = stepObject.step.template_fields.filter(
|
|
262
|
-
(el) => el.is_visible,
|
|
263
|
-
);
|
|
264
|
-
|
|
265
|
-
if (anyVisibleFields) {
|
|
266
|
-
const fieldMappingField = anyVisibleFields.filter(
|
|
267
|
-
(el) =>
|
|
268
|
-
el.activity_field && el.activity_field.type === 'FIELD_MAPPING',
|
|
269
|
-
)[0];
|
|
270
|
-
if (fieldMappingField) {
|
|
271
|
-
return true;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
return false;
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
private getMappingDataInput = () => {
|
|
279
|
-
const stepId = this.props.step.id;
|
|
280
|
-
const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
|
|
281
|
-
const payload = {
|
|
282
|
-
authId: stepObject.selectedAuthId,
|
|
283
|
-
fieldsData: this.getStepVisibleFieldsData(stepId),
|
|
284
|
-
};
|
|
285
|
-
return payload;
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
private onFieldChange = ({
|
|
289
|
-
stepId,
|
|
290
|
-
fieldId,
|
|
291
|
-
value,
|
|
292
|
-
isRequired,
|
|
293
|
-
}: {
|
|
294
|
-
stepId: number;
|
|
295
|
-
fieldId: number;
|
|
296
|
-
value: string;
|
|
297
|
-
isRequired: boolean;
|
|
298
|
-
}) => {
|
|
299
|
-
this.props.setStepFieldData({
|
|
300
|
-
stepId: `${stepId}`,
|
|
301
|
-
fieldId: `${fieldId}`,
|
|
302
|
-
value,
|
|
303
|
-
isRequired,
|
|
304
|
-
});
|
|
305
|
-
this.props.clearChildFields({ stepId, fieldId });
|
|
306
|
-
this.props.verifyStepValidity(Number(stepId));
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
private fieldDynamicData = (field: TemplateField) => {
|
|
310
|
-
const stepId = this.props.step.id;
|
|
311
|
-
const stepObject = this.props.stepMapping && this.props.stepMapping[stepId];
|
|
312
|
-
if (stepObject && field.activity_field) {
|
|
313
|
-
const { parentFields } = this.props.parentChildMapping[stepId][
|
|
314
|
-
field.activity_field.machine_name
|
|
315
|
-
];
|
|
316
|
-
if (parentFields) {
|
|
317
|
-
const endpointData = parentFields.reduce((prev, next) => {
|
|
318
|
-
const { fieldId } = this.props.parentChildMapping[stepId][next];
|
|
319
|
-
if (fieldId)
|
|
320
|
-
return {
|
|
321
|
-
...prev,
|
|
322
|
-
[next]: this.props.stepDataMapping[stepId][fieldId].value,
|
|
323
|
-
};
|
|
324
|
-
return prev;
|
|
325
|
-
}, {});
|
|
326
|
-
return endpointData;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
return null;
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
private isHTML = (value: string): boolean => {
|
|
333
|
-
if (/<\/?[a-z][\s\S]*>/i.test(value)) {
|
|
334
|
-
return true;
|
|
335
|
-
}
|
|
336
|
-
return false;
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
render() {
|
|
340
|
-
const {
|
|
341
|
-
step,
|
|
342
|
-
stepMapping,
|
|
343
|
-
stepDataMapping,
|
|
344
|
-
setStepFieldData,
|
|
345
|
-
showStepValidation,
|
|
346
|
-
isReadOnly,
|
|
347
|
-
} = this.props;
|
|
348
|
-
const selectedStep = stepMapping[step.id] && stepMapping[step.id].step;
|
|
349
|
-
const selectedStepData = stepDataMapping && stepDataMapping[step.id];
|
|
350
|
-
|
|
351
|
-
return html`
|
|
352
|
-
${this.state.loading
|
|
353
|
-
? html`<${Loader} //>`
|
|
354
|
-
: html`
|
|
355
|
-
${selectedStep
|
|
356
|
-
? html`
|
|
357
|
-
<div class=${styles.stepsWrap}>
|
|
358
|
-
${selectedStep.template_fields.map((el) => {
|
|
359
|
-
if (this.shouldShowStep(el) && el.activity_field) {
|
|
360
|
-
const selectedStepElementData =
|
|
361
|
-
(selectedStepData && selectedStepData[el.id]) || null;
|
|
362
|
-
const elDescription =
|
|
363
|
-
el.description && !this.isHTML(el.description)
|
|
364
|
-
? el.description
|
|
365
|
-
: el.activity_field.description &&
|
|
366
|
-
!this.isHTML(el.activity_field.description)
|
|
367
|
-
? el.activity_field.description
|
|
368
|
-
: '';
|
|
369
|
-
switch (el.activity_field.type) {
|
|
370
|
-
case 'SELECT': {
|
|
371
|
-
return html`
|
|
372
|
-
<div key=${el.id} class=${styles.stepWrap}>
|
|
373
|
-
<${ListBox}
|
|
374
|
-
key=${el.activity_field.id}
|
|
375
|
-
apiHandler=${this.props.apiHandler}
|
|
376
|
-
title=${el.title || el.activity_field.title}
|
|
377
|
-
description=${elDescription}
|
|
378
|
-
showStepValidation=${showStepValidation}
|
|
379
|
-
placeholder=${el.placeholder ||
|
|
380
|
-
el.activity_field.placeholder}
|
|
381
|
-
isRequired=${el.is_required}
|
|
382
|
-
isSearchable=${el.activity_field
|
|
383
|
-
.is_searchable}
|
|
384
|
-
isEditable=${el.is_editable || el.activity_field.is_editable}
|
|
385
|
-
value=${(selectedStepData &&
|
|
386
|
-
selectedStepData[el.id] &&
|
|
387
|
-
selectedStepData[el.id].value) ||
|
|
388
|
-
''}
|
|
389
|
-
onChange=${(val: string) => {
|
|
390
|
-
this.onFieldChange({
|
|
391
|
-
stepId: step.id,
|
|
392
|
-
fieldId: el.id,
|
|
393
|
-
value: val,
|
|
394
|
-
isRequired: el.is_required,
|
|
395
|
-
});
|
|
396
|
-
}}
|
|
397
|
-
endpointUrl=${el.activity_field.data_src}
|
|
398
|
-
isDynamic=${el.activity_field.is_dynamic}
|
|
399
|
-
endpointData=${JSON.stringify({
|
|
400
|
-
authorization_id:
|
|
401
|
-
this.props.stepMapping &&
|
|
402
|
-
this.props.stepMapping[this.props.step.id]
|
|
403
|
-
?.selectedAuthId,
|
|
404
|
-
...this.fieldDynamicData(el),
|
|
405
|
-
})}
|
|
406
|
-
isReadOnly=${isReadOnly}
|
|
407
|
-
isChanged=${selectedStepElementData &&
|
|
408
|
-
selectedStepElementData.isChanged}
|
|
409
|
-
><//>
|
|
410
|
-
</div>
|
|
411
|
-
`;
|
|
412
|
-
}
|
|
413
|
-
case 'TIME':
|
|
414
|
-
return html` <div
|
|
415
|
-
key=${el.id}
|
|
416
|
-
class=${styles.stepWrap}
|
|
417
|
-
>
|
|
418
|
-
<${TimeInput}
|
|
419
|
-
title=${el.title || el.activity_field.title}
|
|
420
|
-
description=${elDescription}
|
|
421
|
-
value=${(selectedStepData &&
|
|
422
|
-
selectedStepData[el.id] &&
|
|
423
|
-
selectedStepData[el.id].value) ||
|
|
424
|
-
''}
|
|
425
|
-
placeholder=${el.placeholder ||
|
|
426
|
-
'Please enter a value'}
|
|
427
|
-
showStepValidation=${showStepValidation}
|
|
428
|
-
isRequired=${el.is_required}
|
|
429
|
-
onChange=${(val: string) => {
|
|
430
|
-
this.onFieldChange({
|
|
431
|
-
stepId: step.id,
|
|
432
|
-
fieldId: el.id,
|
|
433
|
-
value: val,
|
|
434
|
-
isRequired: el.is_required,
|
|
435
|
-
});
|
|
436
|
-
}}
|
|
437
|
-
isReadOnly=${isReadOnly}
|
|
438
|
-
isChanged=${selectedStepElementData &&
|
|
439
|
-
selectedStepElementData.isChanged}
|
|
440
|
-
/>
|
|
441
|
-
</div>`;
|
|
442
|
-
case 'TEXTFIELD':
|
|
443
|
-
return (
|
|
444
|
-
!this.shouldShowOldMapping() &&
|
|
445
|
-
this.textFieldParentHasValues() &&
|
|
446
|
-
!el.added_in_mapping &&
|
|
447
|
-
html`
|
|
448
|
-
<div class=${styles.stepWrap}>
|
|
449
|
-
<${Input}
|
|
450
|
-
id=${el.activity_field.id}
|
|
451
|
-
title=${el.title || el.activity_field.title}
|
|
452
|
-
description=${elDescription}
|
|
453
|
-
value=${(selectedStepData &&
|
|
454
|
-
selectedStepData[el.id] &&
|
|
455
|
-
selectedStepData[el.id].value) ||
|
|
456
|
-
''}
|
|
457
|
-
placeholder=${el.placeholder ||
|
|
458
|
-
'Please enter a value'}
|
|
459
|
-
showStepValidation=${showStepValidation}
|
|
460
|
-
regex=${selectedStepData[el.id].regex}
|
|
461
|
-
regexErrorMessage=${selectedStepData[el.id]
|
|
462
|
-
.regexErrorMessage}
|
|
463
|
-
isRequired=${el.is_required}
|
|
464
|
-
onChange=${(
|
|
465
|
-
val: string,
|
|
466
|
-
passesRegexTest?: boolean,
|
|
467
|
-
) => {
|
|
468
|
-
setStepFieldData({
|
|
469
|
-
stepId: `${step.id}`,
|
|
470
|
-
fieldId: `${el.id}`,
|
|
471
|
-
value: val,
|
|
472
|
-
isRequired: el.is_required,
|
|
473
|
-
passesRegexTest,
|
|
474
|
-
});
|
|
475
|
-
this.props.verifyStepValidity(step.id);
|
|
476
|
-
}}
|
|
477
|
-
isReadOnly=${isReadOnly}
|
|
478
|
-
isChanged=${selectedStepElementData &&
|
|
479
|
-
selectedStepElementData.isChanged}
|
|
480
|
-
><//>
|
|
481
|
-
</div>
|
|
482
|
-
`
|
|
483
|
-
);
|
|
484
|
-
case 'FILE':
|
|
485
|
-
return html`
|
|
486
|
-
<div class=${styles.stepWrap}>
|
|
487
|
-
<${Input}
|
|
488
|
-
id=${el.activity_field.id}
|
|
489
|
-
title=${el.title || el.activity_field.title}
|
|
490
|
-
description=${elDescription}
|
|
491
|
-
value=${(selectedStepData &&
|
|
492
|
-
selectedStepData[el.id] &&
|
|
493
|
-
selectedStepData[el.id].value) ||
|
|
494
|
-
''}
|
|
495
|
-
placeholder=${el.placeholder ||
|
|
496
|
-
'Please enter a URL'}
|
|
497
|
-
showStepValidation=${showStepValidation}
|
|
498
|
-
regex=${selectedStepData[el.id].regex}
|
|
499
|
-
regexErrorMessage=${selectedStepData[el.id]
|
|
500
|
-
.regexErrorMessage}
|
|
501
|
-
isRequired=${el.is_required}
|
|
502
|
-
onChange=${(
|
|
503
|
-
val: string,
|
|
504
|
-
passesRegexTest?: boolean,
|
|
505
|
-
) => {
|
|
506
|
-
setStepFieldData({
|
|
507
|
-
stepId: `${step.id}`,
|
|
508
|
-
fieldId: `${el.id}`,
|
|
509
|
-
value: val,
|
|
510
|
-
isRequired: el.is_required,
|
|
511
|
-
passesRegexTest,
|
|
512
|
-
});
|
|
513
|
-
this.props.verifyStepValidity(step.id);
|
|
514
|
-
}}
|
|
515
|
-
isReadOnly=${isReadOnly}
|
|
516
|
-
isChanged=${selectedStepElementData &&
|
|
517
|
-
selectedStepElementData.isChanged}
|
|
518
|
-
><//>
|
|
519
|
-
</div>
|
|
520
|
-
`;
|
|
521
|
-
case 'CHECKBOX': {
|
|
522
|
-
let dataSrc:
|
|
523
|
-
| Record<string, string>[]
|
|
524
|
-
| string
|
|
525
|
-
| null = null;
|
|
526
|
-
if (
|
|
527
|
-
!el.activity_field?.data_src ||
|
|
528
|
-
el.activity_field?.data_src === ''
|
|
529
|
-
) {
|
|
530
|
-
// use title as checkbox label
|
|
531
|
-
dataSrc = [
|
|
532
|
-
{
|
|
533
|
-
id: el.activity_field.machine_name,
|
|
534
|
-
value: el.activity_field.title,
|
|
535
|
-
},
|
|
536
|
-
];
|
|
537
|
-
} else if (!el.activity_field.data_src_endpoint) {
|
|
538
|
-
try {
|
|
539
|
-
dataSrc = JSON.parse(
|
|
540
|
-
el.activity_field?.data_src ?? '[]',
|
|
541
|
-
);
|
|
542
|
-
} catch (error) {
|
|
543
|
-
dataSrc = [];
|
|
544
|
-
console.error(
|
|
545
|
-
'Error parsing value: ',
|
|
546
|
-
el.activity_field?.data_src,
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
return html`
|
|
551
|
-
<div key=${el.id} class=${styles.stepWrap}>
|
|
552
|
-
<${CheckboxGroup}
|
|
553
|
-
fieldId=${el.id}
|
|
554
|
-
title=${el.title || el.activity_field.title}
|
|
555
|
-
description=${elDescription}
|
|
556
|
-
showStepValidation=${showStepValidation}
|
|
557
|
-
placeholder=${el.placeholder}
|
|
558
|
-
value=${selectedStepData &&
|
|
559
|
-
selectedStepData[el.id] &&
|
|
560
|
-
selectedStepData[el.id].value}
|
|
561
|
-
isRequired=${el.is_required}
|
|
562
|
-
dataSrcEndpoint=${el.activity_field.data_src}
|
|
563
|
-
isDynamic=${el.activity_field.is_dynamic}
|
|
564
|
-
initialOptions=${dataSrc}
|
|
565
|
-
endpointData=${JSON.stringify({
|
|
566
|
-
authorization_id:
|
|
567
|
-
this.props.stepMapping &&
|
|
568
|
-
this.props.stepMapping[this.props.step.id]
|
|
569
|
-
?.selectedAuthId,
|
|
570
|
-
...this.fieldDynamicData(el),
|
|
571
|
-
})}
|
|
572
|
-
onChange=${(val: string) => {
|
|
573
|
-
setStepFieldData({
|
|
574
|
-
stepId: `${step.id}`,
|
|
575
|
-
fieldId: `${el.id}`,
|
|
576
|
-
value: val,
|
|
577
|
-
isRequired: el.is_required,
|
|
578
|
-
});
|
|
579
|
-
this.props.verifyStepValidity(step.id);
|
|
580
|
-
}}
|
|
581
|
-
isReadOnly=${isReadOnly}
|
|
582
|
-
isChanged=${selectedStepElementData &&
|
|
583
|
-
selectedStepElementData.isChanged}
|
|
584
|
-
>
|
|
585
|
-
<//>
|
|
586
|
-
</div>
|
|
587
|
-
`;
|
|
588
|
-
}
|
|
589
|
-
case 'DYNAMIC':
|
|
590
|
-
return !this.shouldShowOldMapping()
|
|
591
|
-
? html`
|
|
592
|
-
<div key=${el.id} class=${styles.stepWrap}>
|
|
593
|
-
<${DynamicField}
|
|
594
|
-
stepId=${selectedStep.id}
|
|
595
|
-
dynamicField=${el}
|
|
596
|
-
endpointData=${JSON.stringify({
|
|
597
|
-
authorization_id:
|
|
598
|
-
this.props.stepMapping &&
|
|
599
|
-
this.props.stepMapping[
|
|
600
|
-
this.props.step.id
|
|
601
|
-
]?.selectedAuthId,
|
|
602
|
-
...this.fieldDynamicData(el),
|
|
603
|
-
})}
|
|
604
|
-
/>
|
|
605
|
-
</div>
|
|
606
|
-
`
|
|
607
|
-
: html``;
|
|
608
|
-
case 'PASSWORD':
|
|
609
|
-
return html`
|
|
610
|
-
<div key=${el.id} class=${styles.stepWrap}>
|
|
611
|
-
<${PasswordInput}
|
|
612
|
-
title=${el.title || el.activity_field.title}
|
|
613
|
-
description=${elDescription}
|
|
614
|
-
value=${(selectedStepData &&
|
|
615
|
-
selectedStepData[el.id] &&
|
|
616
|
-
selectedStepData[el.id].value) ||
|
|
617
|
-
''}
|
|
618
|
-
placeholder=${el.placeholder ||
|
|
619
|
-
el.activity_field.placeholder ||
|
|
620
|
-
'Please enter a value'}
|
|
621
|
-
regex=${selectedStepData[el.id].regex}
|
|
622
|
-
regexErrorMessage=${selectedStepData[el.id]
|
|
623
|
-
.regexErrorMessage}
|
|
624
|
-
showStepValidation=${showStepValidation}
|
|
625
|
-
isRequired=${el.is_required}
|
|
626
|
-
onChange=${(val: string) => {
|
|
627
|
-
setStepFieldData({
|
|
628
|
-
stepId: `${step.id}`,
|
|
629
|
-
fieldId: `${el.id}`,
|
|
630
|
-
value: val,
|
|
631
|
-
isRequired: el.is_required,
|
|
632
|
-
});
|
|
633
|
-
this.props.verifyStepValidity(step.id);
|
|
634
|
-
}}
|
|
635
|
-
isReadOnly=${isReadOnly}
|
|
636
|
-
isChanged=${selectedStepElementData &&
|
|
637
|
-
selectedStepElementData.isChanged}
|
|
638
|
-
/>
|
|
639
|
-
</div>
|
|
640
|
-
`;
|
|
641
|
-
case 'TEXTAREA':
|
|
642
|
-
return html`
|
|
643
|
-
<div key=${el.id} class=${styles.stepWrap}>
|
|
644
|
-
<${TextArea}
|
|
645
|
-
title=${el.title || el.activity_field.title}
|
|
646
|
-
description=${elDescription}
|
|
647
|
-
value=${(selectedStepData &&
|
|
648
|
-
selectedStepData[el.id] &&
|
|
649
|
-
selectedStepData[el.id].value) ||
|
|
650
|
-
''}
|
|
651
|
-
placeholder=${el.placeholder ||
|
|
652
|
-
el.activity_field.placeholder ||
|
|
653
|
-
'Please enter a value'}
|
|
654
|
-
regex=${selectedStepData[el.id].regex}
|
|
655
|
-
regexErrorMessage=${selectedStepData[el.id]
|
|
656
|
-
.regexErrorMessage}
|
|
657
|
-
showStepValidation=${showStepValidation}
|
|
658
|
-
isRequired=${el.is_required}
|
|
659
|
-
onChange=${(
|
|
660
|
-
val: string,
|
|
661
|
-
passesRegexTest?: boolean,
|
|
662
|
-
) => {
|
|
663
|
-
setStepFieldData({
|
|
664
|
-
stepId: `${step.id}`,
|
|
665
|
-
fieldId: `${el.id}`,
|
|
666
|
-
value: val,
|
|
667
|
-
isRequired: el.is_required,
|
|
668
|
-
passesRegexTest,
|
|
669
|
-
});
|
|
670
|
-
this.props.verifyStepValidity(step.id);
|
|
671
|
-
}}
|
|
672
|
-
isReadOnly=${isReadOnly}
|
|
673
|
-
isChanged=${selectedStepElementData &&
|
|
674
|
-
selectedStepElementData.isChanged}
|
|
675
|
-
/>
|
|
676
|
-
</div>
|
|
677
|
-
`;
|
|
678
|
-
case 'DATE':
|
|
679
|
-
return html`
|
|
680
|
-
<div key=${el.id} class=${styles.stepWrap}>
|
|
681
|
-
<${DateInput}
|
|
682
|
-
title=${el.title || el.activity_field.title}
|
|
683
|
-
description=${elDescription}
|
|
684
|
-
value=${(selectedStepData &&
|
|
685
|
-
selectedStepData[el.id] &&
|
|
686
|
-
selectedStepData[el.id].value) ||
|
|
687
|
-
''}
|
|
688
|
-
placeholder=${el.placeholder ||
|
|
689
|
-
'Please enter a value'}
|
|
690
|
-
showStepValidation=${showStepValidation}
|
|
691
|
-
isRequired=${el.is_required}
|
|
692
|
-
onChange=${(val: string) => {
|
|
693
|
-
setStepFieldData({
|
|
694
|
-
stepId: `${step.id}`,
|
|
695
|
-
fieldId: `${el.id}`,
|
|
696
|
-
value: val,
|
|
697
|
-
isRequired: el.is_required,
|
|
698
|
-
});
|
|
699
|
-
this.props.verifyStepValidity(step.id);
|
|
700
|
-
}}
|
|
701
|
-
isReadOnly=${isReadOnly}
|
|
702
|
-
isChanged=${selectedStepElementData &&
|
|
703
|
-
selectedStepElementData.isChanged}
|
|
704
|
-
/>
|
|
705
|
-
</div>
|
|
706
|
-
`;
|
|
707
|
-
case 'RADIO':
|
|
708
|
-
return html`
|
|
709
|
-
<div key=${el.id} class=${styles.stepWrap}>
|
|
710
|
-
<${RadioGroup}
|
|
711
|
-
title=${el.title || el.activity_field.title}
|
|
712
|
-
description=${elDescription}
|
|
713
|
-
isDynamic=${el.activity_field.is_dynamic}
|
|
714
|
-
isRequired=${el.is_required}
|
|
715
|
-
showStepValidation=${showStepValidation}
|
|
716
|
-
dataSrcEndpoint=${el.activity_field.is_dynamic
|
|
717
|
-
? el.activity_field.data_src
|
|
718
|
-
: null}
|
|
719
|
-
value=${(selectedStepData &&
|
|
720
|
-
selectedStepData[el.id] &&
|
|
721
|
-
selectedStepData[el.id].value) ||
|
|
722
|
-
''}
|
|
723
|
-
endpointData=${JSON.stringify({
|
|
724
|
-
authorization_id:
|
|
725
|
-
this.props.stepMapping &&
|
|
726
|
-
this.props.stepMapping[this.props.step.id]
|
|
727
|
-
?.selectedAuthId,
|
|
728
|
-
...this.fieldDynamicData(el),
|
|
729
|
-
})}
|
|
730
|
-
onChange=${(selected: string) => {
|
|
731
|
-
setStepFieldData({
|
|
732
|
-
stepId: `${step.id}`,
|
|
733
|
-
fieldId: `${el.id}`,
|
|
734
|
-
value: selected,
|
|
735
|
-
isRequired: el.is_required,
|
|
736
|
-
});
|
|
737
|
-
this.props.verifyStepValidity(step.id);
|
|
738
|
-
}}
|
|
739
|
-
isReadOnly=${isReadOnly}
|
|
740
|
-
isChanged=${selectedStepElementData &&
|
|
741
|
-
selectedStepElementData.isChanged}
|
|
742
|
-
/>
|
|
743
|
-
</div>
|
|
744
|
-
`;
|
|
745
|
-
case 'FIELD_LIST':
|
|
746
|
-
return html``;
|
|
747
|
-
case 'FIELD_MAPPING':
|
|
748
|
-
return html`
|
|
749
|
-
<div class=${styles.stepWrap}>
|
|
750
|
-
<${NewMappingUI}
|
|
751
|
-
stepId=${selectedStep.id}
|
|
752
|
-
templateFields=${selectedStep.template_fields}
|
|
753
|
-
showStepValidation=${showStepValidation}
|
|
754
|
-
><//>
|
|
755
|
-
</div>
|
|
756
|
-
`;
|
|
757
|
-
case 'HTML':
|
|
758
|
-
return html`
|
|
759
|
-
<div
|
|
760
|
-
dangerouslySetInnerHTML=${{
|
|
761
|
-
__html: el.default_value,
|
|
762
|
-
}}
|
|
763
|
-
/>
|
|
764
|
-
`;
|
|
765
|
-
default:
|
|
766
|
-
return html` <div
|
|
767
|
-
class=${`${styles.stepWrap} ${styles.unsupported}`}
|
|
768
|
-
>
|
|
769
|
-
Field: ${el.activity_field.type} is currently not
|
|
770
|
-
supported
|
|
771
|
-
</div>`;
|
|
772
|
-
}
|
|
773
|
-
} else {
|
|
774
|
-
switch (el.type) {
|
|
775
|
-
case 'HTML':
|
|
776
|
-
return html`
|
|
777
|
-
<div
|
|
778
|
-
style="margin-bottom: 2rem;"
|
|
779
|
-
dangerouslySetInnerHTML=${{
|
|
780
|
-
__html: el.default_value,
|
|
781
|
-
}}
|
|
782
|
-
/>
|
|
783
|
-
`;
|
|
784
|
-
case 'BUTTON':
|
|
785
|
-
return html`
|
|
786
|
-
<div style="margin-bottom: 2rem;">
|
|
787
|
-
<${Button} label=${el.title} />
|
|
788
|
-
</div>
|
|
789
|
-
`;
|
|
790
|
-
default:
|
|
791
|
-
break;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
return html``;
|
|
795
|
-
})}
|
|
796
|
-
${this.shouldShowOldMapping() &&
|
|
797
|
-
!this.shouldShowNewMapping() &&
|
|
798
|
-
html`
|
|
799
|
-
<div class=${styles.stepWrap}>
|
|
800
|
-
<${MappingUI}
|
|
801
|
-
stepId=${selectedStep.id}
|
|
802
|
-
templateFields=${selectedStep.template_fields}
|
|
803
|
-
showStepValidation=${showStepValidation}
|
|
804
|
-
endpointData=${this.getMappingDataInput()}
|
|
805
|
-
key=${`mapping_ui_${selectedStep.id}`}
|
|
806
|
-
><//>
|
|
807
|
-
</div>
|
|
808
|
-
`}
|
|
809
|
-
</div>
|
|
810
|
-
`
|
|
811
|
-
: html`Step data could not be loaded`}
|
|
812
|
-
`}
|
|
813
|
-
`;
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
export default connect<StepPropsType, StepStateType, StoreType, unknown>(
|
|
818
|
-
[
|
|
819
|
-
'stepState',
|
|
820
|
-
'stepMapping',
|
|
821
|
-
'stepDataMapping',
|
|
822
|
-
'parentChildMapping',
|
|
823
|
-
'fieldListMapping',
|
|
824
|
-
'conditionalFieldMapping',
|
|
825
|
-
],
|
|
826
|
-
actionFunctions,
|
|
827
|
-
)(Step);
|