@integry/sdk 4.5.2 → 4.5.4
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/.vscode/launch.json +2 -2
- package/THIRD_PARTY_LICENSES +0 -37
- package/dist/esm/index.csm.d.ts +12 -2
- package/dist/esm/index.csm.js +7262 -1
- package/dist/umd/index.umd.d.ts +9 -1
- package/dist/umd/index.umd.js +7262 -1
- package/jest.config.cjs +10 -0
- package/package.json +10 -4
- package/src/components/AddTagButton/index.ts +23 -0
- package/src/components/BasicSelect/index.ts +114 -0
- package/src/components/BasicSelect/styles.module.scss +44 -0
- package/src/components/Button/index.ts +94 -0
- package/src/components/Button/styles.module.scss +152 -0
- package/src/components/CheckboxGroup/Checkbox.ts +104 -0
- package/src/components/CheckboxGroup/index.ts +190 -0
- package/src/components/CheckboxGroup/styles.module.scss +63 -0
- package/src/components/CollapsedMenu/index.ts +101 -0
- package/src/components/CollapsedMenu/styles.module.scss +46 -0
- package/src/components/ConfigureFieldWrapper/index.ts +85 -0
- package/src/components/ConfigureFieldWrapper/styles.module.scss +57 -0
- package/src/components/EditableText/index.ts +121 -0
- package/src/components/EditableText/styles.module.scss +38 -0
- package/src/components/EditableTextArea/index.ts +143 -0
- package/src/components/EditableTextArea/styles.module.scss +91 -0
- package/src/components/ErrorMessage/index.ts +16 -0
- package/src/components/ErrorMessage/styles.module.scss +19 -0
- package/src/components/ErrorPage/index.ts +42 -0
- package/src/components/ErrorPage/styles.module.scss +26 -0
- package/src/components/Footer/index.ts +41 -0
- package/src/components/Footer/styles.module.scss +40 -0
- package/src/components/HTMLContent/index.tsx +275 -0
- package/src/components/HTMLContent/styles.module.scss +3 -0
- package/src/components/InfoBox/index.ts +48 -0
- package/src/components/InfoBox/styles.module.scss +21 -0
- package/src/components/Input/BaseInput/index.ts +170 -0
- package/src/components/Input/BaseInput/styles.module.scss +94 -0
- package/src/components/Input/DateInput/index.ts +103 -0
- package/src/components/Input/DateInput/styles.module.scss +50 -0
- package/src/components/Input/Input/index.ts +206 -0
- package/src/components/Input/Input/styles.module.scss +14 -0
- package/src/components/Input/PasswordInput/index.ts +164 -0
- package/src/components/Input/PasswordInput/styles.module.scss +37 -0
- package/src/components/Input/index.ts +7 -0
- package/src/components/Label/index.ts +61 -0
- package/src/components/Label/styles.module.scss +41 -0
- package/src/components/LargeLoader/index.ts +25 -0
- package/src/components/LargeLoader/styles.module.scss +16 -0
- package/src/components/Listbox/ListBoxItem.ts +57 -0
- package/src/components/Listbox/index.ts +479 -0
- package/src/components/Listbox/styles.module.scss +197 -0
- package/src/components/Loader/index.ts +25 -0
- package/src/components/Loader/styles.module.scss +16 -0
- package/src/components/MediaGallery/MediaGalleryModal.ts +82 -0
- package/src/components/MediaGallery/MediaSlider.ts +76 -0
- package/src/components/MediaGallery/index.ts +92 -0
- package/src/components/MediaGallery/styles.module.scss +156 -0
- package/src/components/MediaUpload/index.ts +233 -0
- package/src/components/MediaUpload/styles.module.scss +118 -0
- package/src/components/Modal/index.ts +87 -0
- package/src/components/Modal/styles.module.scss +441 -0
- package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +58 -0
- package/src/components/MultipurposeField/Dropdown/index.tsx +981 -0
- package/src/components/MultipurposeField/Dropdown/styles.module.scss +208 -0
- package/src/components/MultipurposeField/TagMenu/index.ts +384 -0
- package/src/components/MultipurposeField/TagMenu/styles.module.scss +136 -0
- package/src/components/MultipurposeField/TagOptions/index.tsx +83 -0
- package/src/components/MultipurposeField/TagOptions/styles.module.scss +95 -0
- package/src/components/MultipurposeField/index.tsx +687 -0
- package/src/components/MultipurposeField/styles.module.scss +56 -0
- package/src/components/NewModal/index.ts +69 -0
- package/src/components/NewModal/styles.module.scss +70 -0
- package/src/components/OverflowTooltip/index.tsx +59 -0
- package/src/components/PopUp/ConfirmationPopUp/index.ts +58 -0
- package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +49 -0
- package/src/components/PopUp/SuccessPopUp/index.ts +62 -0
- package/src/components/PopUp/SuccessPopUp/styles.module.scss +38 -0
- package/src/components/RadioGroup/Radio.ts +129 -0
- package/src/components/RadioGroup/index.ts +169 -0
- package/src/components/RadioGroup/styles.module.scss +81 -0
- package/src/components/Search/index.ts +69 -0
- package/src/components/Search/styles.module.scss +149 -0
- package/src/components/TabBar/Tab.ts +33 -0
- package/src/components/TabBar/index.ts +64 -0
- package/src/components/TabBar/styles.module.scss +43 -0
- package/src/components/Tag/index.ts +29 -0
- package/src/components/Tag/styles.module.scss +57 -0
- package/src/components/TextArea/index.ts +172 -0
- package/src/components/TextArea/styles.module.scss +70 -0
- package/src/components/TextContent/index.tsx +128 -0
- package/src/components/TextContent/styles.module.scss +6 -0
- package/src/components/ThreeDotLoader/index.ts +39 -0
- package/src/components/ThreeDotLoader/styles.module.scss +41 -0
- package/src/components/TimeInput/index.ts +129 -0
- package/src/components/TimeInput/styles.module.scss +16 -0
- package/src/components/Toggle/index.ts +34 -0
- package/src/components/Toggle/styles.module.scss +56 -0
- package/src/components/Toggle-v2/index.ts +40 -0
- package/src/components/Toggle-v2/styles.module.scss +86 -0
- package/src/components/Tooltip/index.ts +271 -0
- package/src/components/Tooltip/styles.module.scss +105 -0
- package/src/components/form/ObjectField/index.ts +364 -0
- package/src/components/form/ObjectField/styles.module.scss +103 -0
- package/src/components/form/index.ts +3 -0
- package/src/contexts/AppContext.ts +12 -0
- package/src/declaration.d.ts +7 -0
- package/src/extensions/HMAC.ts +25 -0
- package/src/extensions/IntegryAPIError.ts +19 -0
- package/src/features/common/AccountDropdown/index.ts +291 -0
- package/src/features/common/AccountDropdown/styles.module.scss +19 -0
- package/src/features/common/ActionForm/index.ts +1818 -0
- package/src/features/common/ActionForm/styles.module.scss +23 -0
- package/src/features/common/AppCard/index.ts +207 -0
- package/src/features/common/AppCard/styles.module.scss +117 -0
- package/src/features/common/AppCardCompact/index.ts +189 -0
- package/src/features/common/AppCardCompact/styles.module.scss +141 -0
- package/src/features/common/AuthSelector/index.ts +537 -0
- package/src/features/common/AuthSelector/styles.module.scss +161 -0
- package/src/features/common/AuthSelectorCompact/index.ts +706 -0
- package/src/features/common/AuthSelectorCompact/styles.module.scss +219 -0
- package/src/features/common/AuthSelectorDropdown/index.ts +704 -0
- package/src/features/common/AuthSelectorDropdown/styles.module.scss +361 -0
- package/src/features/common/DynamicField/index.ts +229 -0
- package/src/features/common/DynamicField/styles.module.scss +67 -0
- package/src/features/common/DynamicTypedField/index.ts +217 -0
- package/src/features/common/DynamicTypedField/styles.module.scss +67 -0
- package/src/features/common/FunctionForm/index.ts +862 -0
- package/src/features/common/FunctionForm/styles.module.scss +163 -0
- package/src/features/common/MappingUI/index.ts +649 -0
- package/src/features/common/MappingUI/styles.module.scss +121 -0
- package/src/features/common/MarketplaceAppCard/index.ts +279 -0
- package/src/features/common/MarketplaceAppCard/styles.module.scss +231 -0
- package/src/features/common/MarketplaceAppCardCompact/index.ts +283 -0
- package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +255 -0
- package/src/features/common/NewMappingUI/index.ts +515 -0
- package/src/features/common/NewMappingUI/styles.module.scss +113 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +67 -0
- package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +23 -0
- package/src/features/common/RequestAppWidget/index.ts +48 -0
- package/src/features/common/RequestAppWidget/request-app-form.ts +89 -0
- package/src/features/common/RequestAppWidget/styles.module.scss +43 -0
- package/src/features/common/SectionField/index.ts +272 -0
- package/src/features/common/SectionField/styles.module.scss +67 -0
- package/src/features/common/Step/index.ts +827 -0
- package/src/features/common/Step/styles.module.scss +12 -0
- package/src/features/common/StepNavigation/CollapsedSteps.ts +125 -0
- package/src/features/common/StepNavigation/NavItem.ts +111 -0
- package/src/features/common/StepNavigation/index.ts +257 -0
- package/src/features/common/StepNavigation/styles.module.scss +117 -0
- package/src/features/common/Steps/index.ts +1139 -0
- package/src/features/common/Steps/styles.module.scss +314 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +383 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +367 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +194 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +389 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +577 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +83 -0
- package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +212 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +45 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +1081 -0
- package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +452 -0
- package/src/features/containers/AppFlowContainer/Authentication/index.ts +610 -0
- package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +468 -0
- package/src/features/containers/AppFlowContainer/index.ts +114 -0
- package/src/features/containers/AppPageContainer/AppPage/index.tsx +262 -0
- package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +120 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +165 -0
- package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +81 -0
- package/src/features/containers/AppPageContainer/index.tsx +93 -0
- package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
- package/src/features/containers/AppsForFlows/index.ts +161 -0
- package/src/features/containers/AppsForFlows/styles.module.scss +280 -0
- package/src/features/containers/AppsForFlowsCompact/index.ts +161 -0
- package/src/features/containers/AppsForFlowsCompact/styles.module.scss +279 -0
- package/src/features/containers/AuthSetupContainer/AppSelection.ts +73 -0
- package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +67 -0
- package/src/features/containers/AuthSetupContainer/Footer.ts +32 -0
- package/src/features/containers/AuthSetupContainer/Header.ts +39 -0
- package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +27 -0
- package/src/features/containers/AuthSetupContainer/index.ts +349 -0
- package/src/features/containers/AuthSetupContainer/styles.module.scss +229 -0
- package/src/features/containers/FlowSetupContainer/index.ts +390 -0
- package/src/features/containers/FlowSetupContainer/styles.module.scss +18 -0
- package/src/features/containers/MarkeplaceApps/index.ts +574 -0
- package/src/features/containers/MarkeplaceApps/styles.module.scss +559 -0
- package/src/features/containers/MarketplaceAppsCompact/index.ts +576 -0
- package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +546 -0
- package/src/features/containers/MarketplaceAppsContainer/index.ts +83 -0
- package/src/features/containers/MarketplaceContainer/AppCard/index.ts +91 -0
- package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +66 -0
- package/src/features/containers/MarketplaceContainer/AppListing/index.ts +34 -0
- package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +10 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +132 -0
- package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +117 -0
- package/src/features/containers/MarketplaceContainer/index.ts +242 -0
- package/src/features/containers/MarketplaceContainer/styles.module.scss +84 -0
- package/src/features/containers/SDKContainer/index.ts +817 -0
- package/src/features/containers/SDKContainer/styles.module.scss +266 -0
- package/src/features/containers/SDKDebugContainer/index.ts +137 -0
- package/src/features/containers/SDKDebugContainer/styles.module.scss +37 -0
- package/src/features/containers/SDKFailedContainer/index.ts +117 -0
- package/src/features/containers/SDKFailedContainer/styles.module.scss +57 -0
- package/src/features/integrations/IntegrationRow/Icons.ts +77 -0
- package/src/features/integrations/IntegrationRow/index.ts +129 -0
- package/src/features/integrations/IntegrationRow/styles.module.scss +62 -0
- package/src/features/integrations/IntegrationsHeader/index.ts +34 -0
- package/src/features/integrations/IntegrationsHeader/styles.module.scss +47 -0
- package/src/features/integrations/IntegrationsList/index.ts +252 -0
- package/src/features/integrations/IntegrationsList/styles.module.scss +67 -0
- package/src/features/templates/Template/index.ts +295 -0
- package/src/features/templates/Template/styles.module.scss +226 -0
- package/src/features/templates/TemplatesView/index.ts +368 -0
- package/src/features/templates/TemplatesView/styles.module.scss +71 -0
- package/src/features/templates/TemplatesViewCompact/index.ts +364 -0
- package/src/features/templates/TemplatesViewCompact/styles.module.scss +141 -0
- package/src/hooks/useAutosizeTextArea.ts +22 -0
- package/src/hooks/useCustomRef.ts +13 -0
- package/src/hooks/useDebounce.ts +17 -0
- package/src/hooks/useElementResize.ts +40 -0
- package/src/hooks/useEventListener.ts +44 -0
- package/src/hooks/useHover.ts +40 -0
- package/src/hooks/useOnClickOutside.ts +32 -0
- package/src/index.ts +2051 -0
- package/src/index.umd.ts +13 -0
- package/src/interfaces/index.ts +924 -0
- package/src/modules/api/index.ts +1315 -0
- package/src/modules/api/responseHandler.ts +38 -0
- package/src/modules/event-emitter/index.ts +72 -0
- package/src/modules/event-emitter/runners/abstract.ts +21 -0
- package/src/modules/event-emitter/runners/default.ts +11 -0
- package/src/modules/event-emitter/runners/ntimes.ts +28 -0
- package/src/modules/event-emitter/types.ts +34 -0
- package/src/store/actionFunctions.ts +1573 -0
- package/src/store/index.ts +17 -0
- package/src/store/initialState.ts +58 -0
- package/src/stories/Button.stories.tsx +83 -0
- package/src/stories/Checkbox/Checkbox.stories.tsx +41 -0
- package/src/stories/Checkbox/CheckboxGroup.stories.tsx +46 -0
- package/src/stories/EditableText.stories.tsx +35 -0
- package/src/stories/Input/BaseInput.stories.tsx +48 -0
- package/src/stories/Input/DateInput.stories.tsx +28 -0
- package/src/stories/Input/Input.stories.tsx +24 -0
- package/src/stories/Input/PasswordInput.stories.tsx +26 -0
- package/src/stories/Introduction.stories.mdx +211 -0
- package/src/stories/Label.stories.tsx +27 -0
- package/src/stories/Listbox.stories.tsx +122 -0
- package/src/stories/Radio/Radio.stories.tsx +39 -0
- package/src/stories/Radio/RadioGroup.stories.tsx +46 -0
- package/src/stories/StepNavigation/NavItem.stories.tsx +31 -0
- package/src/stories/StepNavigation/StepNavigation.stories.tsx +50 -0
- package/src/stories/TabBar.stories.tsx +31 -0
- package/src/stories/TextArea.stories.tsx +23 -0
- package/src/stories/TimeInput.stories.tsx +37 -0
- package/src/stories/Toggle.stories.tsx +33 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/types/index.ts +293 -0
- package/src/types/store.ts +366 -0
- package/src/types/utils.ts +19 -0
- package/src/utils/ActivityOutputUtils.ts +163 -0
- package/src/utils/common.ts +20 -0
- package/src/utils/copyToClipboard.ts +24 -0
- package/src/utils/datetime.ts +101 -0
- package/src/utils/getUrlParam.ts +11 -0
- package/src/utils/isAuthMessage.ts +16 -0
- package/src/utils/isBrowser.ts +1 -0
- package/src/utils/jsonEncodeDecode.ts +15 -0
- package/src/utils/objectUtils.ts +116 -0
- package/src/utils/popup.ts +30 -0
- package/src/utils/searchJson.ts +51 -0
- package/src/utils/stepUtils.ts +45 -0
- package/src/utils/truncate.ts +6 -0
- package/test/setup.ts +1 -0
- package/vitest.config.ts +10 -0
|
@@ -0,0 +1,827 @@
|
|
|
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);
|