@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,649 @@
|
|
|
1
|
+
import { html } from 'htm/preact';
|
|
2
|
+
import { connect } from 'unistore/preact';
|
|
3
|
+
import { useContext, useEffect, useMemo, useRef, useState } from 'preact/hooks';
|
|
4
|
+
import { IncomingWebhookObject, TemplateField } from '@/interfaces';
|
|
5
|
+
import AppContext from '@/contexts/AppContext';
|
|
6
|
+
import { StoreType } from '@/types/store';
|
|
7
|
+
import { LargeLoader } from '@/components/LargeLoader';
|
|
8
|
+
import { actionFunctions } from '@/store';
|
|
9
|
+
import { Label } from '@/components/Label';
|
|
10
|
+
import { ListBox } from '@/components/Listbox';
|
|
11
|
+
import { Tag } from '@/components/Tag';
|
|
12
|
+
import { Select } from '@/components/BasicSelect';
|
|
13
|
+
import { MultipurposeField } from '@/components/MultipurposeField';
|
|
14
|
+
import {
|
|
15
|
+
JSONToActivityOutputData,
|
|
16
|
+
JSONToDynamicFieldData,
|
|
17
|
+
} from '@/utils/ActivityOutputUtils';
|
|
18
|
+
import { areParentValuesValid } from '@/utils/stepUtils';
|
|
19
|
+
|
|
20
|
+
import styles from './styles.module.scss';
|
|
21
|
+
|
|
22
|
+
export type MappingUiProps = {
|
|
23
|
+
stepId: number;
|
|
24
|
+
templateFields: TemplateField[];
|
|
25
|
+
showStepValidation?: boolean;
|
|
26
|
+
endpointData: {
|
|
27
|
+
authId: number;
|
|
28
|
+
fieldsData: Record<string, string | number>;
|
|
29
|
+
};
|
|
30
|
+
} & StoreType;
|
|
31
|
+
|
|
32
|
+
interface DynamicDataItem {
|
|
33
|
+
fieldId: number;
|
|
34
|
+
id: string | null;
|
|
35
|
+
title: string | null;
|
|
36
|
+
type: string;
|
|
37
|
+
isNotDynamic?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const MappingUI = (props: MappingUiProps) => {
|
|
41
|
+
const [loading, setLoading] = useState<boolean>(true);
|
|
42
|
+
const [rootDataLoading, setRootDataLoading] = useState<boolean>(false);
|
|
43
|
+
const [dynamicDataLoading, setDynamicDataLoading] = useState<boolean>(false);
|
|
44
|
+
const [fieldsRef, setFieldsRef] = useState<number[]>([]);
|
|
45
|
+
const [dynamicItems, setDynamicItems] = useState<DynamicDataItem[]>([]);
|
|
46
|
+
const [dynamicListId, setDynamicListId] = useState('');
|
|
47
|
+
const [incommingWebhookApp, setIncommingWebhookApp] = useState<{
|
|
48
|
+
id: number;
|
|
49
|
+
name: string;
|
|
50
|
+
icon_url: string;
|
|
51
|
+
} | null>(null);
|
|
52
|
+
// const [additionalData, setAdditionalData] = useState({});
|
|
53
|
+
|
|
54
|
+
const context = useContext(AppContext);
|
|
55
|
+
const isReadOnly = context?.isReadOnly;
|
|
56
|
+
|
|
57
|
+
const dynamicFieldIdRef = useRef('');
|
|
58
|
+
|
|
59
|
+
const shouldShowField = (field: any) => {
|
|
60
|
+
const { stepId, conditionalFieldMapping } = props;
|
|
61
|
+
const fieldConditions = conditionalFieldMapping[stepId][
|
|
62
|
+
field.id
|
|
63
|
+
];
|
|
64
|
+
let isConditionValid = true;
|
|
65
|
+
|
|
66
|
+
if (fieldConditions) {
|
|
67
|
+
isConditionValid = areParentValuesValid(
|
|
68
|
+
stepId,
|
|
69
|
+
fieldConditions,
|
|
70
|
+
props.stepDataMapping,
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
return isConditionValid;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (dynamicItems.length > 0) {
|
|
78
|
+
// eslint-disable-next-line array-callback-return
|
|
79
|
+
dynamicItems.map((el, index) => {
|
|
80
|
+
const ele = props.stepDataMapping[props.stepId][el.fieldId];
|
|
81
|
+
if (ele && !ele.isDynamic && ele.value) {
|
|
82
|
+
const parsedValue = ele.value.slice(1, -1);
|
|
83
|
+
if (parsedValue) setFieldsRef((prev) => [...prev, index]);
|
|
84
|
+
} else if (ele && ele.isDynamic && ele.objectValue && el.id) {
|
|
85
|
+
const parsedValues = ele.objectValue || {};
|
|
86
|
+
if (parsedValues[el.id]) {
|
|
87
|
+
setFieldsRef((prev) => [...prev, index]);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}, [dynamicItems]);
|
|
93
|
+
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
const triggerStep = props.genericData.stepWithActivityOutput;
|
|
96
|
+
if (triggerStep) {
|
|
97
|
+
const { id: triggerStepId } = triggerStep;
|
|
98
|
+
// eslint-disable-next-line no-use-before-define
|
|
99
|
+
const data = getVisibleFieldsDataOnRootStep(triggerStepId);
|
|
100
|
+
// eslint-disable-next-line no-use-before-define
|
|
101
|
+
setRootStepData(data);
|
|
102
|
+
}
|
|
103
|
+
}, []);
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
// fetch the dynamic field in case it exists
|
|
107
|
+
const dynamicFieldToRender = props.templateFields.filter(
|
|
108
|
+
(el) => el.activity_field && el.activity_field.type === 'DYNAMIC',
|
|
109
|
+
)[0];
|
|
110
|
+
|
|
111
|
+
if (dynamicFieldToRender) {
|
|
112
|
+
// set our dynamic list ID
|
|
113
|
+
setDynamicListId(`${dynamicFieldToRender.id}`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// get a list of text fields that will be part of the mapping
|
|
117
|
+
const textFieldsToRender = props.templateFields
|
|
118
|
+
.filter(
|
|
119
|
+
(el) =>
|
|
120
|
+
el.activity_field &&
|
|
121
|
+
el.activity_field.type === 'TEXTFIELD' &&
|
|
122
|
+
el.is_visible,
|
|
123
|
+
)
|
|
124
|
+
.map((el) => ({
|
|
125
|
+
fieldId: el.id,
|
|
126
|
+
id: el.activity_field && el.activity_field.machine_name,
|
|
127
|
+
title: el.activity_field && el.activity_field.title,
|
|
128
|
+
type: 'text',
|
|
129
|
+
isNotDynamic: true,
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
const filteredTextFieldsToRender: any = [];
|
|
133
|
+
|
|
134
|
+
textFieldsToRender.forEach(fieldToRender => {
|
|
135
|
+
if(shouldShowField(fieldToRender)) {
|
|
136
|
+
filteredTextFieldsToRender.push(fieldToRender);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
// grab activity output data since that is used in both cases
|
|
140
|
+
// if (!props.activityOutputData) {
|
|
141
|
+
// console.log('props.activity output data is null');
|
|
142
|
+
// // eslint-disable-next-line no-use-before-define
|
|
143
|
+
// setRootStepData();
|
|
144
|
+
// }
|
|
145
|
+
|
|
146
|
+
// if dynamic field exists, fetch the fields and show those
|
|
147
|
+
if (
|
|
148
|
+
dynamicFieldToRender &&
|
|
149
|
+
dynamicFieldToRender.activity_field // &&
|
|
150
|
+
// dynamicFieldToRender.id !== Number(dynamicListId)
|
|
151
|
+
) {
|
|
152
|
+
const mappingField =
|
|
153
|
+
props.parentChildMapping[props.stepId][
|
|
154
|
+
dynamicFieldToRender.activity_field.machine_name
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
let valuesMapField = '';
|
|
158
|
+
if (mappingField) {
|
|
159
|
+
const valuesMap = mappingField.parentFields?.reduce((prev, next) => {
|
|
160
|
+
const parentFieldId =
|
|
161
|
+
props.parentChildMapping[props.stepId][next].fieldId;
|
|
162
|
+
return {
|
|
163
|
+
...prev,
|
|
164
|
+
[parentFieldId]:
|
|
165
|
+
props.stepDataMapping[props.stepId][parentFieldId].value,
|
|
166
|
+
};
|
|
167
|
+
}, {});
|
|
168
|
+
valuesMapField = JSON.stringify(valuesMap);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// in case the parent field value changes, refetch the custom fields
|
|
172
|
+
if (
|
|
173
|
+
valuesMapField !== dynamicFieldIdRef.current ||
|
|
174
|
+
dynamicFieldToRender.id !== Number(dynamicListId)
|
|
175
|
+
) {
|
|
176
|
+
setLoading(true);
|
|
177
|
+
|
|
178
|
+
// eslint-disable-next-line no-use-before-define
|
|
179
|
+
fetchDynamicFieldData(dynamicFieldToRender)
|
|
180
|
+
?.then((res) => {
|
|
181
|
+
setLoading(false);
|
|
182
|
+
// props.resetCustomMappingData(props.stepId);
|
|
183
|
+
setFieldsRef([]);
|
|
184
|
+
dynamicFieldIdRef.current = valuesMapField;
|
|
185
|
+
if (Array.isArray(res)) {
|
|
186
|
+
setDynamicItems([
|
|
187
|
+
...filteredTextFieldsToRender,
|
|
188
|
+
...res.map((el) => ({
|
|
189
|
+
...el,
|
|
190
|
+
fieldId: dynamicFieldToRender.id,
|
|
191
|
+
fetchedFromAOU: true,
|
|
192
|
+
})),
|
|
193
|
+
]);
|
|
194
|
+
} else {
|
|
195
|
+
setDynamicItems(filteredTextFieldsToRender);
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
.catch((err) => {
|
|
199
|
+
console.error(err)
|
|
200
|
+
setDynamicItems([...filteredTextFieldsToRender]);
|
|
201
|
+
setLoading(false);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
} else if (!dynamicItems.length) {
|
|
205
|
+
// we dont have any dynamic fields so,
|
|
206
|
+
// just set the text fields as items to render
|
|
207
|
+
setDynamicItems([...filteredTextFieldsToRender]);
|
|
208
|
+
setLoading(false);
|
|
209
|
+
} else if (dynamicItems.length > 0) {
|
|
210
|
+
const tempFields: any = [];
|
|
211
|
+
const cleanedDynamicFields: any = [];
|
|
212
|
+
// remove all items from dynamicItems which has fetchedFromAOU = false
|
|
213
|
+
dynamicItems.forEach((item: any) => {
|
|
214
|
+
if (item.fetchedFromAOU) {
|
|
215
|
+
cleanedDynamicFields.push(item);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
filteredTextFieldsToRender.forEach((item: any) => {
|
|
220
|
+
let fieldExist = false;
|
|
221
|
+
cleanedDynamicFields.forEach((dynamicItem: any) => {
|
|
222
|
+
if(dynamicItem.fieldId === item.fieldId || dynamicItem.fetchedFromAOU) {
|
|
223
|
+
fieldExist = true;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
if (!fieldExist) {
|
|
227
|
+
tempFields.push(item);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
setDynamicItems([...filteredTextFieldsToRender, ...cleanedDynamicFields]);
|
|
231
|
+
setLoading(false);
|
|
232
|
+
}
|
|
233
|
+
}, [props.stepDataMapping[props.stepId]]);
|
|
234
|
+
|
|
235
|
+
const getVisibleFieldsDataOnRootStep = (
|
|
236
|
+
stepId: number,
|
|
237
|
+
): {
|
|
238
|
+
[machineName: string]: string;
|
|
239
|
+
} => {
|
|
240
|
+
const fields = props.stepDataMapping[stepId];
|
|
241
|
+
const requiredFieldsWithValues = Object.keys(fields)
|
|
242
|
+
.filter((el) => fields[Number(el)].value)
|
|
243
|
+
.reduce((prev, curr) => {
|
|
244
|
+
const currentItem = fields[Number(curr)];
|
|
245
|
+
return {
|
|
246
|
+
...prev,
|
|
247
|
+
[currentItem.machineName]: currentItem.value,
|
|
248
|
+
};
|
|
249
|
+
}, {});
|
|
250
|
+
|
|
251
|
+
return requiredFieldsWithValues;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
const setRootStepData = async (
|
|
255
|
+
additionalData: Record<string, string> | undefined,
|
|
256
|
+
) => {
|
|
257
|
+
const triggerStep = props.genericData.stepWithActivityOutput;
|
|
258
|
+
const integryObject = triggerStep?.template_fields.find(
|
|
259
|
+
(el) => el.activity_field?.machine_name === 'integry_webhook_object',
|
|
260
|
+
)?.default_value;
|
|
261
|
+
|
|
262
|
+
if (triggerStep) {
|
|
263
|
+
const { id: triggerStepId } = triggerStep;
|
|
264
|
+
|
|
265
|
+
if (triggerStep.activity.activity_output_url) {
|
|
266
|
+
setRootDataLoading(true);
|
|
267
|
+
context?.apiHandler
|
|
268
|
+
.callDynamicDataEndpoint<
|
|
269
|
+
{
|
|
270
|
+
text: string;
|
|
271
|
+
value: string;
|
|
272
|
+
}[]
|
|
273
|
+
>(new URL(triggerStep.activity.activity_output_url), {
|
|
274
|
+
authorization_id: `${props.stepMapping[triggerStepId].selectedAuthId}`,
|
|
275
|
+
...additionalData,
|
|
276
|
+
})
|
|
277
|
+
.then((res) => {
|
|
278
|
+
setRootDataLoading(false);
|
|
279
|
+
if (res)
|
|
280
|
+
props.setActivityOutputData({
|
|
281
|
+
activityOutputData: res,
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
} else {
|
|
285
|
+
setRootDataLoading(false);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (integryObject) {
|
|
289
|
+
try {
|
|
290
|
+
const parsedIntegryObject = JSON.parse(
|
|
291
|
+
integryObject,
|
|
292
|
+
) as IncomingWebhookObject;
|
|
293
|
+
let objectPaylaod = {};
|
|
294
|
+
if (props.userConfig?.objects?.[parsedIntegryObject.name]) {
|
|
295
|
+
objectPaylaod =
|
|
296
|
+
props.userConfig?.objects?.[parsedIntegryObject.name];
|
|
297
|
+
} else {
|
|
298
|
+
objectPaylaod = JSON.parse(parsedIntegryObject.payload);
|
|
299
|
+
}
|
|
300
|
+
const activityOutputData = JSONToActivityOutputData(objectPaylaod);
|
|
301
|
+
const dynamicFieldData = JSONToDynamicFieldData(objectPaylaod);
|
|
302
|
+
props.setIncomingWebhookPayload({
|
|
303
|
+
incomingWebhookPayload: objectPaylaod,
|
|
304
|
+
});
|
|
305
|
+
props.setActivityOutputData({
|
|
306
|
+
activityOutputData: activityOutputData || [],
|
|
307
|
+
});
|
|
308
|
+
props.setDynamicFieldData({
|
|
309
|
+
dynamicFieldData: dynamicFieldData || {},
|
|
310
|
+
});
|
|
311
|
+
} catch (e) {
|
|
312
|
+
console.error(e);
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
const incommingWebhookAppTemp = triggerStep?.template_fields.find(
|
|
316
|
+
(el) => el.activity_field?.machine_name === 'app',
|
|
317
|
+
)?.default_value;
|
|
318
|
+
setIncommingWebhookApp(JSON.parse(incommingWebhookAppTemp || '{}'));
|
|
319
|
+
} catch (e) {
|
|
320
|
+
console.error('Failed to get incoming webhook app', e);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (triggerStep.activity.dynamic_field_data_endpoint) {
|
|
325
|
+
setDynamicDataLoading(true);
|
|
326
|
+
context?.apiHandler
|
|
327
|
+
.callDynamicDataEndpoint<{
|
|
328
|
+
[fieldId: string]: (string | Record<string, string>)[];
|
|
329
|
+
}>(new URL(triggerStep.activity.dynamic_field_data_endpoint), {
|
|
330
|
+
authorization_id: `${props.stepMapping[triggerStepId].selectedAuthId}`,
|
|
331
|
+
...additionalData,
|
|
332
|
+
})
|
|
333
|
+
.then((res) => {
|
|
334
|
+
setDynamicDataLoading(false);
|
|
335
|
+
if (res)
|
|
336
|
+
props.setDynamicFieldData({
|
|
337
|
+
dynamicFieldData: res,
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
} else {
|
|
341
|
+
setDynamicDataLoading(false);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
const fetchDynamicFieldData = (templateField: TemplateField) => {
|
|
347
|
+
const dynamicEndpoint = `${templateField.activity_field?.dynamic_field_src}`;
|
|
348
|
+
return context?.apiHandler.callDynamicDataEndpoint<DynamicDataItem[]>(
|
|
349
|
+
new URL(dynamicEndpoint),
|
|
350
|
+
{
|
|
351
|
+
authorization_id: `${props.endpointData.authId}`,
|
|
352
|
+
...props.endpointData.fieldsData,
|
|
353
|
+
},
|
|
354
|
+
);
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const onMappingValueSelected = (
|
|
358
|
+
index: number,
|
|
359
|
+
item: DynamicDataItem,
|
|
360
|
+
isRequired: boolean,
|
|
361
|
+
rowIndex: number,
|
|
362
|
+
) => {
|
|
363
|
+
const activityOutputObject = props.activityOutputData?.[index];
|
|
364
|
+
const arrayIndex = fieldsRef.findIndex((el) => el === rowIndex);
|
|
365
|
+
if (index < 0) {
|
|
366
|
+
setFieldsRef((prev) => prev.filter((el) => el !== rowIndex));
|
|
367
|
+
if (item.isNotDynamic) {
|
|
368
|
+
props.setStepFieldData({
|
|
369
|
+
stepId: `${props.stepId}`,
|
|
370
|
+
fieldId: `${item.fieldId}`,
|
|
371
|
+
value: '',
|
|
372
|
+
isRequired,
|
|
373
|
+
});
|
|
374
|
+
} else if (dynamicListId) {
|
|
375
|
+
props.setStepMappingData({
|
|
376
|
+
stepId: props.stepId,
|
|
377
|
+
fieldId: Number(dynamicListId),
|
|
378
|
+
id: `${item.id}`,
|
|
379
|
+
value: null,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
} else if (activityOutputObject) {
|
|
383
|
+
if (arrayIndex < 0) {
|
|
384
|
+
setFieldsRef((prev) => [...prev, rowIndex]);
|
|
385
|
+
}
|
|
386
|
+
if (item.isNotDynamic) {
|
|
387
|
+
props.setStepFieldData({
|
|
388
|
+
stepId: `${props.stepId}`,
|
|
389
|
+
fieldId: `${item.fieldId}`,
|
|
390
|
+
value: `{${activityOutputObject.value}}`,
|
|
391
|
+
isRequired,
|
|
392
|
+
});
|
|
393
|
+
} else if (dynamicListId) {
|
|
394
|
+
props.setStepMappingData({
|
|
395
|
+
stepId: props.stepId,
|
|
396
|
+
fieldId: Number(dynamicListId),
|
|
397
|
+
id: `${item.id}`,
|
|
398
|
+
value: `{${activityOutputObject.value}}`,
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
props.verifyStepValidity(props.stepId);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const triggerApp = useMemo(
|
|
406
|
+
() =>
|
|
407
|
+
Object.keys(props.stepMapping)
|
|
408
|
+
?.map((stepId) => props.stepMapping[stepId])
|
|
409
|
+
?.filter(
|
|
410
|
+
(el) =>
|
|
411
|
+
el.step.activity.type === 'TRIGGER' ||
|
|
412
|
+
el.step.activity.type === 'QUERY',
|
|
413
|
+
)[0],
|
|
414
|
+
[],
|
|
415
|
+
);
|
|
416
|
+
const triggerAppInfo = {
|
|
417
|
+
icon_url:
|
|
418
|
+
incommingWebhookApp?.icon_url ||
|
|
419
|
+
triggerApp?.step.activity.app.icon_url ||
|
|
420
|
+
props.genericData.brandingApp?.icon_url,
|
|
421
|
+
name:
|
|
422
|
+
incommingWebhookApp?.name ||
|
|
423
|
+
triggerApp?.step.activity.app.name ||
|
|
424
|
+
props.genericData.brandingApp?.name,
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
const removeCurlyBraces = (value: string): string => value.replace(/^{(.*)}$/, '$1')
|
|
428
|
+
|
|
429
|
+
const arrayToNestedJSONWithFirstValue = (array: any, valueObj: any) => {
|
|
430
|
+
let tempValueObj: any = {};
|
|
431
|
+
Object.keys(valueObj).forEach(i => {
|
|
432
|
+
const key = removeCurlyBraces(i);
|
|
433
|
+
tempValueObj = {
|
|
434
|
+
...tempValueObj,
|
|
435
|
+
[key]: valueObj[i] || '',
|
|
436
|
+
};
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
const result = {};
|
|
440
|
+
array.forEach((item: any) => {
|
|
441
|
+
const keys = item.value.split('.');
|
|
442
|
+
let currentLevel: any = result;
|
|
443
|
+
|
|
444
|
+
keys.forEach((key: any, index: any) => {
|
|
445
|
+
if (!currentLevel[key]) {
|
|
446
|
+
if (index === keys.length - 1) {
|
|
447
|
+
// eslint-disable-next-line prefer-destructuring
|
|
448
|
+
currentLevel[key] = tempValueObj[item.value][0];
|
|
449
|
+
} else {
|
|
450
|
+
currentLevel[key] = {};
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
currentLevel = currentLevel[key];
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
return result;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if ((dynamicItems || []).length === 0) {
|
|
460
|
+
return html``;
|
|
461
|
+
}
|
|
462
|
+
return html`
|
|
463
|
+
<div>
|
|
464
|
+
<${Label}
|
|
465
|
+
title="Map data"
|
|
466
|
+
description="Please map fields you want to use from both apps"
|
|
467
|
+
/>
|
|
468
|
+
<div>
|
|
469
|
+
${loading || rootDataLoading || dynamicDataLoading
|
|
470
|
+
? html`<div class=${styles.loader}><${LargeLoader} /></div>`
|
|
471
|
+
: html`
|
|
472
|
+
<div class=${styles.mappingWrap}>
|
|
473
|
+
${html`
|
|
474
|
+
<div class=${styles.mappingRow}>
|
|
475
|
+
<div class=${styles.mappingHeaderItem}>
|
|
476
|
+
<img
|
|
477
|
+
src=${props.stepMapping[props.stepId].step.activity.app
|
|
478
|
+
.icon_url}
|
|
479
|
+
/>
|
|
480
|
+
<div>
|
|
481
|
+
${`${
|
|
482
|
+
props.stepMapping[props.stepId].step.activity.app.name
|
|
483
|
+
} Field`}
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
${html`<div class=${styles.sampleData}>Sample Data</div>`}
|
|
487
|
+
<div class=${styles.mappingHeaderItem}>
|
|
488
|
+
<img src=${triggerAppInfo?.icon_url} />
|
|
489
|
+
<div>${`${triggerAppInfo.name} Field`}</div>
|
|
490
|
+
</div>
|
|
491
|
+
${isReadOnly && html`<div class=${styles.tagColumn}></div>`}
|
|
492
|
+
</div>`}
|
|
493
|
+
${dynamicItems.map((el, itemIndex) => {
|
|
494
|
+
const slug = el.id || '';
|
|
495
|
+
const ele = props.stepDataMapping[props.stepId][el.fieldId];
|
|
496
|
+
let isFieldValueChanged = false;
|
|
497
|
+
let selectVal;
|
|
498
|
+
let parsedVal: string | Record<string, string | number>;
|
|
499
|
+
if (ele) {
|
|
500
|
+
if (ele.isDynamic) {
|
|
501
|
+
parsedVal = ele.objectValue as Record<
|
|
502
|
+
string,
|
|
503
|
+
string | number
|
|
504
|
+
>;
|
|
505
|
+
if (ele.changedDynamicFields) {
|
|
506
|
+
isFieldValueChanged = ele.changedDynamicFields.includes(
|
|
507
|
+
slug,
|
|
508
|
+
);
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
parsedVal = ele.value?.slice(1, -1) as string;
|
|
512
|
+
}
|
|
513
|
+
if (!ele.isDynamic && parsedVal) {
|
|
514
|
+
selectVal = parsedVal;
|
|
515
|
+
isFieldValueChanged = ele.isChanged;
|
|
516
|
+
} else if (
|
|
517
|
+
el.id &&
|
|
518
|
+
ele.isDynamic &&
|
|
519
|
+
ele.objectValue &&
|
|
520
|
+
(parsedVal as Record<string, string | number>)[slug]
|
|
521
|
+
) {
|
|
522
|
+
selectVal = `${
|
|
523
|
+
(parsedVal as Record<string, string | number>)[slug]
|
|
524
|
+
}`.slice(1, -1);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return html`
|
|
528
|
+
<div class=${styles.mappingRow}>
|
|
529
|
+
<div class=${styles.title}>
|
|
530
|
+
${el.title}${ele?.isRequired && html`<span>*</span>`}
|
|
531
|
+
</div>
|
|
532
|
+
${html`
|
|
533
|
+
<div class=${styles.sampleData}>
|
|
534
|
+
${props.dynamicFieldData &&
|
|
535
|
+
selectVal &&
|
|
536
|
+
(props.dynamicFieldData || {})[
|
|
537
|
+
`{${selectVal}}`
|
|
538
|
+
]?.map((sample: string | Record<string, string>) =>
|
|
539
|
+
sample ? html`<pre>${sample}</pre>` : html``,
|
|
540
|
+
)}
|
|
541
|
+
</div>
|
|
542
|
+
`}
|
|
543
|
+
<div class=${styles.selectBox}>
|
|
544
|
+
${html`
|
|
545
|
+
<${Select}
|
|
546
|
+
ariaLabel="Map a value"
|
|
547
|
+
placeholder="Please map a value"
|
|
548
|
+
options=${Array.isArray(props.activityOutputData)
|
|
549
|
+
? props.activityOutputData?.map((item) => ({
|
|
550
|
+
key: item.value,
|
|
551
|
+
label: item.text,
|
|
552
|
+
}))
|
|
553
|
+
: []}
|
|
554
|
+
value=${selectVal}
|
|
555
|
+
isRequired=${ele?.isRequired}
|
|
556
|
+
showStepValidation=${props.showStepValidation}
|
|
557
|
+
showUnselectedValue=${true}
|
|
558
|
+
unselectedText="Skip"
|
|
559
|
+
onChange=${(index: number) =>
|
|
560
|
+
onMappingValueSelected(
|
|
561
|
+
index,
|
|
562
|
+
el,
|
|
563
|
+
ele?.isRequired ?? false,
|
|
564
|
+
itemIndex,
|
|
565
|
+
)}
|
|
566
|
+
isReadOnly=${isReadOnly}
|
|
567
|
+
><//>
|
|
568
|
+
`}
|
|
569
|
+
${false && html`
|
|
570
|
+
<${MultipurposeField}
|
|
571
|
+
activityOutputData=${arrayToNestedJSONWithFirstValue(props.activityOutputData, props.dynamicFieldData)}
|
|
572
|
+
placeholder=${'Please map a value'}
|
|
573
|
+
value=${selectVal}
|
|
574
|
+
type=${`TEXT`}
|
|
575
|
+
isMappable=${true}
|
|
576
|
+
allowTagsInText=${true}
|
|
577
|
+
/>
|
|
578
|
+
`}
|
|
579
|
+
${false && html`<${ListBox}
|
|
580
|
+
ariaLabel="Map a value"
|
|
581
|
+
placeholder="Please map a value"
|
|
582
|
+
showStepValidation=${props.showStepValidation}
|
|
583
|
+
isReadOnly=${isReadOnly}
|
|
584
|
+
value=${selectVal}
|
|
585
|
+
onChange=${(selectedValue: string) => {
|
|
586
|
+
const index = (props.activityOutputData || []).findIndex(obj => obj.value === selectedValue);
|
|
587
|
+
onMappingValueSelected(
|
|
588
|
+
index,
|
|
589
|
+
el,
|
|
590
|
+
ele?.isRequired ?? false,
|
|
591
|
+
itemIndex,
|
|
592
|
+
);
|
|
593
|
+
}}
|
|
594
|
+
items=${Array.isArray(props.activityOutputData)
|
|
595
|
+
? props.activityOutputData?.map((item) => ({
|
|
596
|
+
id: item.value,
|
|
597
|
+
value: item.text,
|
|
598
|
+
}))
|
|
599
|
+
: []}
|
|
600
|
+
><//>`}
|
|
601
|
+
</div>
|
|
602
|
+
${isReadOnly &&
|
|
603
|
+
html`<div class=${styles.tagColumn}>
|
|
604
|
+
${isFieldValueChanged &&
|
|
605
|
+
html`<${Tag} label="Changed" />`}
|
|
606
|
+
</div>`}
|
|
607
|
+
</div>
|
|
608
|
+
`;
|
|
609
|
+
})}
|
|
610
|
+
<div class=${styles.mappingInfo}>
|
|
611
|
+
<div>
|
|
612
|
+
<span>Mapped</span>
|
|
613
|
+
<span
|
|
614
|
+
>${fieldsRef.length}${' '}
|
|
615
|
+
field${fieldsRef.length !== 1 ? 's' : ''}</span
|
|
616
|
+
>
|
|
617
|
+
</div>
|
|
618
|
+
<div>
|
|
619
|
+
<span>Ignored</span>
|
|
620
|
+
<span
|
|
621
|
+
>${dynamicItems.length - fieldsRef.length}${' '}
|
|
622
|
+
field${dynamicItems.length - fieldsRef.length !== 1
|
|
623
|
+
? 's'
|
|
624
|
+
: ''}</span
|
|
625
|
+
>
|
|
626
|
+
</div>
|
|
627
|
+
</div>
|
|
628
|
+
</div>
|
|
629
|
+
`}
|
|
630
|
+
</div>
|
|
631
|
+
</div>
|
|
632
|
+
`;
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
export default connect<MappingUiProps, unknown, StoreType, unknown>(
|
|
636
|
+
[
|
|
637
|
+
'stepState',
|
|
638
|
+
'genericData',
|
|
639
|
+
'stepMapping',
|
|
640
|
+
'stepDataMapping',
|
|
641
|
+
'activityOutputData',
|
|
642
|
+
'dynamicFieldData',
|
|
643
|
+
'stepDataMapping',
|
|
644
|
+
'parentChildMapping',
|
|
645
|
+
'userConfig',
|
|
646
|
+
'conditionalFieldMapping',
|
|
647
|
+
],
|
|
648
|
+
actionFunctions,
|
|
649
|
+
)(MappingUI);
|