@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,1139 @@
|
|
|
1
|
+
/* eslint-disable no-nested-ternary */
|
|
2
|
+
import { html, Component } from 'htm/preact';
|
|
3
|
+
import { connect } from 'unistore/preact';
|
|
4
|
+
import {
|
|
5
|
+
IntegrationSaveResponse,
|
|
6
|
+
TemplateField,
|
|
7
|
+
TemplateStep,
|
|
8
|
+
} from '@/interfaces';
|
|
9
|
+
import { Button, ButtonTypes } from '@/components/Button';
|
|
10
|
+
import { StoreType } from '@/types/store';
|
|
11
|
+
import AuthSelector from '@/features/common/AuthSelector';
|
|
12
|
+
import AuthSelectorCompact from '@/features/common/AuthSelectorCompact';
|
|
13
|
+
import AppContext from '@/contexts/AppContext';
|
|
14
|
+
import Step from '@/features/common/Step';
|
|
15
|
+
import ActionForm from '@/features/common/ActionForm';
|
|
16
|
+
import { actionFunctions } from '@/store';
|
|
17
|
+
import { InfoBox } from '@/components/InfoBox';
|
|
18
|
+
import { TextArea } from '@/components/TextArea';
|
|
19
|
+
import { Tag } from '@/components/Tag';
|
|
20
|
+
import { notEmpty } from '@/types/utils';
|
|
21
|
+
import { ViewStyles } from '@/types';
|
|
22
|
+
import {
|
|
23
|
+
extractTagsFromStepDataMapping,
|
|
24
|
+
createMappedObject,
|
|
25
|
+
getIntegryObject,
|
|
26
|
+
} from '@/utils/objectUtils';
|
|
27
|
+
|
|
28
|
+
import styles from './styles.module.scss';
|
|
29
|
+
|
|
30
|
+
export type StepsPropsType = {
|
|
31
|
+
onUpdate?(integrationDate: IntegrationSaveResponse): void;
|
|
32
|
+
stepsClassName?: {
|
|
33
|
+
bottom?: string;
|
|
34
|
+
};
|
|
35
|
+
skipAuth?: boolean;
|
|
36
|
+
onBackClick?: () => void;
|
|
37
|
+
submitButtonText?: string;
|
|
38
|
+
hideStepCount?: boolean;
|
|
39
|
+
editMode?: boolean;
|
|
40
|
+
deploymentId?: number | string;
|
|
41
|
+
isInModal?: boolean;
|
|
42
|
+
stepContainerStyle?: string;
|
|
43
|
+
} & StoreType;
|
|
44
|
+
|
|
45
|
+
type Parameter = {
|
|
46
|
+
id: number;
|
|
47
|
+
machine_name: string;
|
|
48
|
+
title: string;
|
|
49
|
+
is_required: boolean;
|
|
50
|
+
data_type: string;
|
|
51
|
+
default_value: string;
|
|
52
|
+
fields: any[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
type IntegrationPayload = {
|
|
56
|
+
name: string;
|
|
57
|
+
notification_email: string;
|
|
58
|
+
template: number;
|
|
59
|
+
bundle_id: number;
|
|
60
|
+
bundle_instance_id?: string;
|
|
61
|
+
steps: {
|
|
62
|
+
id: number;
|
|
63
|
+
authorization: number | null;
|
|
64
|
+
template_step: number;
|
|
65
|
+
app_user_data: {
|
|
66
|
+
id: number;
|
|
67
|
+
value: string | null;
|
|
68
|
+
template_field: number;
|
|
69
|
+
}[];
|
|
70
|
+
}[];
|
|
71
|
+
parameters: Record<string, string>;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
interface PostSaveDataArray {
|
|
75
|
+
postSave: boolean;
|
|
76
|
+
sendWebhookURLInEvent: boolean;
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
+
postSaveData: any;
|
|
79
|
+
templateStepId: number;
|
|
80
|
+
activityId: number;
|
|
81
|
+
stepName: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type StepsStateType = {
|
|
85
|
+
selectedAuthStep: number | null;
|
|
86
|
+
loading: boolean;
|
|
87
|
+
payload: IntegrationPayload | null;
|
|
88
|
+
postSave: boolean;
|
|
89
|
+
postSaveData: Record<string, string | number | boolean> | null;
|
|
90
|
+
postSaveDataArray: PostSaveDataArray[] | null;
|
|
91
|
+
integrationData: IntegrationSaveResponse | null;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
class Steps extends Component<
|
|
95
|
+
StepsPropsType,
|
|
96
|
+
StepsStateType & Record<string, unknown>
|
|
97
|
+
> {
|
|
98
|
+
static contextType = AppContext;
|
|
99
|
+
|
|
100
|
+
constructor(props: StepsPropsType) {
|
|
101
|
+
super(props);
|
|
102
|
+
this.state = {
|
|
103
|
+
loading: false,
|
|
104
|
+
selectedAuthStep: null,
|
|
105
|
+
payload: null,
|
|
106
|
+
postSave: false,
|
|
107
|
+
postSaveData: null,
|
|
108
|
+
postSaveDataArray: null,
|
|
109
|
+
integrationData: null,
|
|
110
|
+
sendWebhookURLInEvent: false,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
componentDidMount() {
|
|
115
|
+
const { stepState: newStepState } = this.props;
|
|
116
|
+
this.context.eventEmitter.emit('did-change-step', {
|
|
117
|
+
stepId: newStepState.steps[newStepState.stepIndex]?.stepId ?? null,
|
|
118
|
+
stepType:
|
|
119
|
+
newStepState.steps[newStepState.stepIndex]?.type ?? 'CONFIRMATION',
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
componentDidUpdate(prevProps: StepsPropsType) {
|
|
124
|
+
const { stepState: prevStepState } = prevProps;
|
|
125
|
+
const { stepState: newStepState } = this.props;
|
|
126
|
+
if (prevStepState.stepIndex !== newStepState.stepIndex)
|
|
127
|
+
this.context.eventEmitter.emit('did-change-step', {
|
|
128
|
+
stepId: newStepState.steps[newStepState.stepIndex]?.stepId ?? null,
|
|
129
|
+
stepType:
|
|
130
|
+
newStepState.steps[newStepState.stepIndex]?.type ?? 'CONFIRMATION',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private getMappingPayload = (stepId: number, data: TemplateField[]) => {
|
|
135
|
+
const { stepDataMapping } = this.props;
|
|
136
|
+
// if old mapping, return A, else B
|
|
137
|
+
let mappingPayload = null;
|
|
138
|
+
|
|
139
|
+
const sectionFields = data.reduce(
|
|
140
|
+
(acc: any[], el) =>
|
|
141
|
+
el.type === 'SECTION' ? acc.concat(el.template_fields) : acc,
|
|
142
|
+
[],
|
|
143
|
+
);
|
|
144
|
+
const dataFiltered = data
|
|
145
|
+
.filter((el) => el.type !== 'SECTION')
|
|
146
|
+
.concat(sectionFields);
|
|
147
|
+
|
|
148
|
+
if (this.props.mappingInfo?.isNewMapping) {
|
|
149
|
+
//
|
|
150
|
+
const standardFieldsOutsideMapping = data.filter(
|
|
151
|
+
(el) =>
|
|
152
|
+
!el.added_in_mapping && el.activity_field?.type !== 'FIELD_MAPPING',
|
|
153
|
+
);
|
|
154
|
+
const standardFieldsInsideMapping = data.filter(
|
|
155
|
+
(el) =>
|
|
156
|
+
el.added_in_mapping && el.activity_field?.type !== 'FIELD_MAPPING',
|
|
157
|
+
);
|
|
158
|
+
const mappingField = data.filter(
|
|
159
|
+
(el) => el.activity_field?.type === 'FIELD_MAPPING',
|
|
160
|
+
)[0];
|
|
161
|
+
|
|
162
|
+
const payloadForNormalFields = standardFieldsOutsideMapping.map(
|
|
163
|
+
(field) => ({
|
|
164
|
+
id: stepDataMapping[stepId][field.id].integrationFieldId || field.id,
|
|
165
|
+
value: stepDataMapping[stepId][field.id].value,
|
|
166
|
+
template_field: field.id,
|
|
167
|
+
}),
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
if (mappingField) {
|
|
171
|
+
const normalFieldsInsideMappingObj = standardFieldsInsideMapping.reduce(
|
|
172
|
+
(prev, next) => ({
|
|
173
|
+
...prev,
|
|
174
|
+
[next.activity_field?.machine_name ?? '']: stepDataMapping[stepId][
|
|
175
|
+
next.id
|
|
176
|
+
].value,
|
|
177
|
+
}),
|
|
178
|
+
{},
|
|
179
|
+
);
|
|
180
|
+
const parsedField =
|
|
181
|
+
stepDataMapping[stepId][mappingField.id].objectValue;
|
|
182
|
+
|
|
183
|
+
mappingPayload = {
|
|
184
|
+
id: Number(
|
|
185
|
+
stepDataMapping[stepId][mappingField.id].integrationFieldId,
|
|
186
|
+
),
|
|
187
|
+
template_field: mappingField.id,
|
|
188
|
+
value: JSON.stringify({
|
|
189
|
+
...normalFieldsInsideMappingObj,
|
|
190
|
+
...{
|
|
191
|
+
[this.props.mappingInfo.customFieldsKey || '']: parsedField,
|
|
192
|
+
},
|
|
193
|
+
}),
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const finalPayload = [...payloadForNormalFields];
|
|
198
|
+
|
|
199
|
+
if (mappingPayload) {
|
|
200
|
+
finalPayload.push(mappingPayload);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// "mapping": { // field mapper machine name
|
|
204
|
+
// "merged_fields": {
|
|
205
|
+
// "mc_email_type": "{sib_trigger.out.attribute.email_type}"
|
|
206
|
+
// },
|
|
207
|
+
// "mc_email": "{sib_trigger.out.email}"
|
|
208
|
+
// }
|
|
209
|
+
|
|
210
|
+
return finalPayload;
|
|
211
|
+
}
|
|
212
|
+
return dataFiltered.map((field) => ({
|
|
213
|
+
id: stepDataMapping[stepId][field.id].integrationFieldId || field.id,
|
|
214
|
+
value:
|
|
215
|
+
(stepDataMapping[stepId][field.id].value ||
|
|
216
|
+
stepDataMapping[stepId][field.id].value === '') &&
|
|
217
|
+
!stepDataMapping[stepId][field.id].objectValue
|
|
218
|
+
? `${stepDataMapping[stepId][field.id].value}`
|
|
219
|
+
.replace(/\u200b/g, '') // replace zerowidthspaces caused by the tagify implementation.
|
|
220
|
+
.replace(/\u00A0/g, '')
|
|
221
|
+
: JSON.stringify(stepDataMapping[stepId][field.id].objectValue)
|
|
222
|
+
.replace(/\u200b/g, '')
|
|
223
|
+
.replace(/\u00A0/g, ''),
|
|
224
|
+
template_field: field.id,
|
|
225
|
+
}));
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
private updateParams = (
|
|
229
|
+
parameters: Parameter[],
|
|
230
|
+
updates: Record<string, string>,
|
|
231
|
+
): Record<string, string> =>
|
|
232
|
+
parameters.reduce(
|
|
233
|
+
(acc, param) => ({
|
|
234
|
+
...acc,
|
|
235
|
+
[param.machine_name]:
|
|
236
|
+
updates[param.machine_name] ?? param.default_value,
|
|
237
|
+
}),
|
|
238
|
+
{},
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
private getPayload = () => {
|
|
242
|
+
const { stepMapping } = this.props;
|
|
243
|
+
if (this.context.isPreviewMode) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
let payload: IntegrationPayload = {
|
|
247
|
+
name: this.props.genericData.name ?? 'My new flow',
|
|
248
|
+
notification_email: '',
|
|
249
|
+
template: Number(this.props.genericData.templateId),
|
|
250
|
+
bundle_id: Number(
|
|
251
|
+
this.props.deploymentId || this.props.genericData.deploymentId || -1,
|
|
252
|
+
),
|
|
253
|
+
steps: Object.keys(stepMapping).map((el) => ({
|
|
254
|
+
id: stepMapping[el].integrationStepId || stepMapping[el].step.id,
|
|
255
|
+
authorization: Number(stepMapping[el].selectedAuthId) || null,
|
|
256
|
+
template_step: stepMapping[el].step.id,
|
|
257
|
+
app_user_data: this.getMappingPayload(
|
|
258
|
+
stepMapping[el].step.id,
|
|
259
|
+
stepMapping[el].step.template_fields,
|
|
260
|
+
),
|
|
261
|
+
})),
|
|
262
|
+
parameters: this.updateParams(
|
|
263
|
+
this.props.genericData.flowParameters ?? {},
|
|
264
|
+
this.props.genericData.flowParametersData ?? {},
|
|
265
|
+
),
|
|
266
|
+
};
|
|
267
|
+
if (this.props.integrationIdToEdit) {
|
|
268
|
+
payload = { ...payload, ...{ bundle_instance_id: 'false' } };
|
|
269
|
+
}
|
|
270
|
+
this.setState({ loading: true, payload });
|
|
271
|
+
return payload;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
private createIntegration = () => {
|
|
275
|
+
const payload = this.getPayload();
|
|
276
|
+
if (payload)
|
|
277
|
+
this.context.apiHandler
|
|
278
|
+
.saveIntegration(payload)
|
|
279
|
+
.then((integration: IntegrationSaveResponse) => {
|
|
280
|
+
this.postSaveOrCreate(integration);
|
|
281
|
+
})
|
|
282
|
+
.catch((err: unknown) => console.error(err));
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
private postSaveOrCreate = (integration: IntegrationSaveResponse) => {
|
|
286
|
+
const returnedSteps = integration.steps.filter((el) => !!el.returned_data);
|
|
287
|
+
if (returnedSteps && returnedSteps.length > 0) {
|
|
288
|
+
let tempPostSave = false;
|
|
289
|
+
let tempSendWebhookURLInEvent = false;
|
|
290
|
+
let tempPostSaveData = null;
|
|
291
|
+
const tempPostSaveDataArray: PostSaveDataArray[] = [];
|
|
292
|
+
returnedSteps.forEach((returnedStep) => {
|
|
293
|
+
if (returnedStep && returnedStep.returned_data) {
|
|
294
|
+
try {
|
|
295
|
+
const parsedData = JSON.parse(returnedStep.returned_data);
|
|
296
|
+
if (parsedData.is_webhook_url && parsedData.endpoint) {
|
|
297
|
+
if (this.props.userConfig?.hideWebhookUrlScreen) {
|
|
298
|
+
tempPostSave = false;
|
|
299
|
+
tempSendWebhookURLInEvent = true;
|
|
300
|
+
tempPostSaveData = parsedData;
|
|
301
|
+
} else if (
|
|
302
|
+
Object.prototype.hasOwnProperty.call(
|
|
303
|
+
parsedData,
|
|
304
|
+
'user_experience',
|
|
305
|
+
)
|
|
306
|
+
) {
|
|
307
|
+
if (parsedData.user_experience === 'SHOW_TO_USER') {
|
|
308
|
+
tempPostSave = true;
|
|
309
|
+
tempSendWebhookURLInEvent = true;
|
|
310
|
+
tempPostSaveData = parsedData;
|
|
311
|
+
} else if (parsedData.user_experience === 'RETURN_VIA_SDK') {
|
|
312
|
+
tempPostSave = false;
|
|
313
|
+
tempSendWebhookURLInEvent = true;
|
|
314
|
+
tempPostSaveData = parsedData;
|
|
315
|
+
} else {
|
|
316
|
+
tempPostSave = false;
|
|
317
|
+
tempSendWebhookURLInEvent = false;
|
|
318
|
+
tempPostSaveData = parsedData;
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
tempPostSave = true;
|
|
322
|
+
tempSendWebhookURLInEvent = true;
|
|
323
|
+
tempPostSaveData = parsedData;
|
|
324
|
+
}
|
|
325
|
+
tempPostSaveDataArray.push({
|
|
326
|
+
postSave: tempPostSave,
|
|
327
|
+
sendWebhookURLInEvent: tempSendWebhookURLInEvent,
|
|
328
|
+
postSaveData: tempPostSaveData,
|
|
329
|
+
templateStepId: returnedStep.template_step,
|
|
330
|
+
activityId: returnedStep.activity_id,
|
|
331
|
+
stepName: returnedStep.step_name,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
} catch (error) {
|
|
335
|
+
console.error(error);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
const anyWebhookStepIndex = tempPostSaveDataArray.findIndex(
|
|
340
|
+
(obj) => obj.postSave,
|
|
341
|
+
);
|
|
342
|
+
if (anyWebhookStepIndex <= -1) {
|
|
343
|
+
this.setState(
|
|
344
|
+
{
|
|
345
|
+
postSave: false,
|
|
346
|
+
integrationData: integration,
|
|
347
|
+
postSaveDataArray: tempPostSaveDataArray,
|
|
348
|
+
},
|
|
349
|
+
() => {
|
|
350
|
+
this.dismiss();
|
|
351
|
+
},
|
|
352
|
+
);
|
|
353
|
+
} else {
|
|
354
|
+
this.setState({
|
|
355
|
+
postSave: true,
|
|
356
|
+
integrationData: integration,
|
|
357
|
+
postSaveDataArray: tempPostSaveDataArray,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
this.setState(
|
|
362
|
+
{
|
|
363
|
+
postSave: false,
|
|
364
|
+
integrationData: integration,
|
|
365
|
+
postSaveDataArray: null,
|
|
366
|
+
},
|
|
367
|
+
() => {
|
|
368
|
+
this.dismiss();
|
|
369
|
+
},
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
this.setState({ loading: false });
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
private updateIntegration = () => {
|
|
376
|
+
const { integrations, integrationIdToEdit, genericData } = this.props;
|
|
377
|
+
const { currentIntegrationStatus } = genericData;
|
|
378
|
+
const payload = this.getPayload();
|
|
379
|
+
const isIntegrationActive =
|
|
380
|
+
integrations.find(
|
|
381
|
+
(eachIntg) => Number(eachIntg.id) === Number(integrationIdToEdit),
|
|
382
|
+
)?.status === 'ACTIVE' || currentIntegrationStatus === 'ACTIVE';
|
|
383
|
+
if (payload) {
|
|
384
|
+
this.context.apiHandler
|
|
385
|
+
.updateIntegration(
|
|
386
|
+
this.props.integrationIdToEdit,
|
|
387
|
+
isIntegrationActive,
|
|
388
|
+
{
|
|
389
|
+
...payload,
|
|
390
|
+
id: `${this.props.integrationIdToEdit}`,
|
|
391
|
+
},
|
|
392
|
+
)
|
|
393
|
+
.then((integration: IntegrationSaveResponse) => {
|
|
394
|
+
this.postSaveOrCreate(integration);
|
|
395
|
+
})
|
|
396
|
+
.catch((err: unknown) => console.error(err));
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
private getAuthorizationsData = (): {
|
|
401
|
+
authorizationId: unknown;
|
|
402
|
+
userIdentity: string;
|
|
403
|
+
isBrandingAppAuth: unknown;
|
|
404
|
+
}[] => {
|
|
405
|
+
const { stepMapping } = this.props;
|
|
406
|
+
const auths = Object.keys(stepMapping)
|
|
407
|
+
.map((stepId) => {
|
|
408
|
+
const step = stepMapping[stepId];
|
|
409
|
+
const auth = step.authorizations.filter(
|
|
410
|
+
(el) => el.authorizationId === step.selectedAuthId,
|
|
411
|
+
)[0];
|
|
412
|
+
if (auth) {
|
|
413
|
+
return {
|
|
414
|
+
authorizationId: stepMapping[stepId].selectedAuthId,
|
|
415
|
+
userIdentity: auth.userIdentity,
|
|
416
|
+
isBrandingAppAuth:
|
|
417
|
+
step.step.activity.app.id ===
|
|
418
|
+
this.props.genericData.brandingApp?.id,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
return null;
|
|
422
|
+
})
|
|
423
|
+
.filter(notEmpty);
|
|
424
|
+
return auths;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
private getCallBackURL = () => {
|
|
428
|
+
const { postSaveDataArray } = this.state;
|
|
429
|
+
if (postSaveDataArray && postSaveDataArray.length > 0) {
|
|
430
|
+
if (postSaveDataArray[0].sendWebhookURLInEvent) {
|
|
431
|
+
return postSaveDataArray[0].postSaveData.endpoint;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return null;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
private getCallBackURLArray = () => {
|
|
438
|
+
const { postSaveDataArray } = this.state;
|
|
439
|
+
if (postSaveDataArray && postSaveDataArray.length > 0) {
|
|
440
|
+
const tempURLArray = postSaveDataArray
|
|
441
|
+
.filter((tempData) => tempData.sendWebhookURLInEvent)
|
|
442
|
+
.map((tempData) => ({
|
|
443
|
+
templateStepId: tempData.templateStepId,
|
|
444
|
+
activityId: tempData.activityId,
|
|
445
|
+
callbackUrl: tempData.postSaveData.endpoint,
|
|
446
|
+
}));
|
|
447
|
+
if (tempURLArray.length > 0) {
|
|
448
|
+
return tempURLArray;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return null;
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
private dismiss = () => {
|
|
455
|
+
const { userConfig, onUpdate = () => null } = this.props;
|
|
456
|
+
const { integrationData } = this.state;
|
|
457
|
+
const triggerStep = this.props.genericData.stepWithActivityOutput;
|
|
458
|
+
const integryObject = getIntegryObject(triggerStep, this.props.userConfig);
|
|
459
|
+
const objectName = integryObject?.name || 'object';
|
|
460
|
+
const objectPayload = integryObject?.payload || {};
|
|
461
|
+
const tags = extractTagsFromStepDataMapping(this.props.stepDataMapping);
|
|
462
|
+
const mappedObject = createMappedObject(objectPayload, tags);
|
|
463
|
+
|
|
464
|
+
if (integrationData) {
|
|
465
|
+
onUpdate(integrationData);
|
|
466
|
+
this.props.resetTemplateFields();
|
|
467
|
+
this.props.setStoreState({
|
|
468
|
+
showSetupModal: false,
|
|
469
|
+
showSetupInline: false,
|
|
470
|
+
fetchingIntegrations: true,
|
|
471
|
+
activatedTab: userConfig?.autoRedirectToMyFlows ? 'tab-1' : '',
|
|
472
|
+
dFlag: new Date().toISOString(),
|
|
473
|
+
// activatedTab: userConfig?.autoRedirectToMyFlows ? 'tab-2' : '',
|
|
474
|
+
});
|
|
475
|
+
this.context.eventEmitter.emit('did-save-integration', {
|
|
476
|
+
integrationId: integrationData.id,
|
|
477
|
+
name: integrationData.name,
|
|
478
|
+
templateId: integrationData.template,
|
|
479
|
+
flowId: integrationData.template,
|
|
480
|
+
status: integrationData.status,
|
|
481
|
+
callbackUrl: this.getCallBackURL(),
|
|
482
|
+
callbackUrlArray: this.getCallBackURLArray(),
|
|
483
|
+
authorizations: this.getAuthorizationsData(),
|
|
484
|
+
steps: this.state.payload?.steps ?? [],
|
|
485
|
+
event: this.props.integrationIdToEdit ? 'EDIT' : 'CREATE',
|
|
486
|
+
object: objectPayload,
|
|
487
|
+
mappedObject: objectName
|
|
488
|
+
? { [objectName]: mappedObject }
|
|
489
|
+
: mappedObject,
|
|
490
|
+
flowDescription: this.props.genericData.flowDescription,
|
|
491
|
+
flowName: this.props.genericData.name,
|
|
492
|
+
brandingApp: this.props.genericData.brandingApp,
|
|
493
|
+
});
|
|
494
|
+
this.context.eventEmitter.emit('integration-created', {
|
|
495
|
+
integrationId: integrationData.id,
|
|
496
|
+
name: integrationData.name,
|
|
497
|
+
templateId: integrationData.template,
|
|
498
|
+
flowId: integrationData.template,
|
|
499
|
+
status: integrationData.status,
|
|
500
|
+
callbackUrl: this.getCallBackURL(),
|
|
501
|
+
callbackUrlArray: this.getCallBackURLArray(),
|
|
502
|
+
authorizations: this.getAuthorizationsData(),
|
|
503
|
+
steps: this.state.payload?.steps ?? [],
|
|
504
|
+
event: this.props.integrationIdToEdit ? 'EDIT' : 'CREATE',
|
|
505
|
+
object: objectPayload,
|
|
506
|
+
mappedObject: objectName
|
|
507
|
+
? { [objectName]: mappedObject }
|
|
508
|
+
: mappedObject,
|
|
509
|
+
flowDescription: this.props.genericData.flowDescription,
|
|
510
|
+
flowName: this.props.genericData.name,
|
|
511
|
+
brandingApp: this.props.genericData.brandingApp,
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
private handleClose = () => {
|
|
517
|
+
this.context.eventEmitter.emit('did-click-close-button', {
|
|
518
|
+
isCloseClicked: true,
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
private handleAuthSelected = (
|
|
523
|
+
authId: number,
|
|
524
|
+
stepId: number,
|
|
525
|
+
isVerified: boolean,
|
|
526
|
+
override: boolean,
|
|
527
|
+
) => {
|
|
528
|
+
const { stepState } = this.props;
|
|
529
|
+
const { currentStep } = stepState;
|
|
530
|
+
const dependentSteps = this.props.stepMapping[stepId].step.template_fields
|
|
531
|
+
.filter((el) => el.activity_field && el.activity_field.is_dynamic)
|
|
532
|
+
.map((el) => el.id);
|
|
533
|
+
// reset all dynamic steps if auth changes
|
|
534
|
+
this.props.setStepAuthorization(
|
|
535
|
+
stepId,
|
|
536
|
+
authId,
|
|
537
|
+
isVerified,
|
|
538
|
+
dependentSteps,
|
|
539
|
+
override,
|
|
540
|
+
);
|
|
541
|
+
const isMainApp =
|
|
542
|
+
this.props.stepMapping[stepId].step.activity.app.id ===
|
|
543
|
+
(this.props.genericData.app_id || -1);
|
|
544
|
+
|
|
545
|
+
const isSelfApp =
|
|
546
|
+
this.props.stepMapping[stepId].step.authorization_type.app.id ===
|
|
547
|
+
(this.props.genericData.selfAppId || -1);
|
|
548
|
+
const visibleFields = this.props.stepMapping[
|
|
549
|
+
stepId
|
|
550
|
+
].step.template_fields.filter((field: any) => field.is_visible === true);
|
|
551
|
+
|
|
552
|
+
if (
|
|
553
|
+
this.props.skipAuth &&
|
|
554
|
+
currentStep?.type === 'AUTH' &&
|
|
555
|
+
isMainApp &&
|
|
556
|
+
isVerified &&
|
|
557
|
+
visibleFields.length === 0
|
|
558
|
+
) {
|
|
559
|
+
this.props.gotoNextStep();
|
|
560
|
+
}
|
|
561
|
+
if (isSelfApp && currentStep?.type === 'AUTH' && isVerified) {
|
|
562
|
+
// this.props.gotoNextStep();
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
private showChangedTag = (currentStepId: number) => {
|
|
567
|
+
let isStepChanged = false;
|
|
568
|
+
const { stepDataMapping } = this.props;
|
|
569
|
+
if (Object.keys(stepDataMapping).length > 0) {
|
|
570
|
+
if (stepDataMapping[currentStepId]) {
|
|
571
|
+
// eslint-disable-next-line consistent-return
|
|
572
|
+
Object.keys(stepDataMapping[currentStepId]).forEach((stepFieldId) => {
|
|
573
|
+
const selectStepField =
|
|
574
|
+
stepDataMapping[currentStepId][Number(stepFieldId)];
|
|
575
|
+
if (
|
|
576
|
+
selectStepField.type !== 'HIDDEN' &&
|
|
577
|
+
selectStepField.isChanged === true
|
|
578
|
+
) {
|
|
579
|
+
isStepChanged = true;
|
|
580
|
+
return isStepChanged;
|
|
581
|
+
// eslint-disable-next-line no-else-return
|
|
582
|
+
} else if (
|
|
583
|
+
selectStepField.type === 'DYNAMIC' &&
|
|
584
|
+
selectStepField.changedDynamicFields &&
|
|
585
|
+
selectStepField.changedDynamicFields.length > 0
|
|
586
|
+
) {
|
|
587
|
+
isStepChanged = true;
|
|
588
|
+
return isStepChanged;
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return isStepChanged;
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
render() {
|
|
597
|
+
let selectedStep: {
|
|
598
|
+
step: TemplateStep;
|
|
599
|
+
selectedAuthId: number | null;
|
|
600
|
+
isAuthVerified?: any | true;
|
|
601
|
+
authorizations?: any;
|
|
602
|
+
} | null = null;
|
|
603
|
+
const { stepState, stepMapping, isInModal = false } = this.props;
|
|
604
|
+
const { postSave } = this.state;
|
|
605
|
+
const { currentStep, stepIndex, steps } = stepState;
|
|
606
|
+
const isReadOnly = this.context?.isReadOnly;
|
|
607
|
+
let shouldShowLastStep = false;
|
|
608
|
+
let shouldShowBackButton = false;
|
|
609
|
+
let isStepValid = false;
|
|
610
|
+
let showStepValidation = false;
|
|
611
|
+
let tooltip = '';
|
|
612
|
+
let forceShowLastPage = false;
|
|
613
|
+
if (steps.length === 0) {
|
|
614
|
+
shouldShowBackButton = true;
|
|
615
|
+
shouldShowLastStep = true;
|
|
616
|
+
forceShowLastPage = true;
|
|
617
|
+
} else if (stepIndex > -1 && currentStep?.type !== 'CONFIRMATION') {
|
|
618
|
+
selectedStep = stepMapping[Number(currentStep?.stepId)];
|
|
619
|
+
shouldShowLastStep = false;
|
|
620
|
+
shouldShowBackButton = stepState.stepIndex > 0;
|
|
621
|
+
isStepValid =
|
|
622
|
+
(currentStep?.isValid && selectedStep?.isAuthVerified) ?? false;
|
|
623
|
+
showStepValidation = stepState.showValidation;
|
|
624
|
+
if (
|
|
625
|
+
selectedStep?.isAuthVerified === false ||
|
|
626
|
+
(selectedStep.step.activity.auth_required &&
|
|
627
|
+
selectedStep.authorizations.length === 0)
|
|
628
|
+
) {
|
|
629
|
+
tooltip =
|
|
630
|
+
selectedStep.step.authorization_type.type !== 'NO_AUTH'
|
|
631
|
+
? 'Please connect an account to proceed'
|
|
632
|
+
: '';
|
|
633
|
+
} else if (!currentStep?.isValid) {
|
|
634
|
+
tooltip = 'Please fill all required fields to proceed';
|
|
635
|
+
}
|
|
636
|
+
} else if (
|
|
637
|
+
currentStep?.type === 'CONFIRMATION' &&
|
|
638
|
+
stepIndex === steps.length
|
|
639
|
+
) {
|
|
640
|
+
shouldShowBackButton = true;
|
|
641
|
+
shouldShowLastStep = true;
|
|
642
|
+
}
|
|
643
|
+
return html`
|
|
644
|
+
<div
|
|
645
|
+
id="stepsWrap"
|
|
646
|
+
class="${styles.stepsWrap} ${'integry-steps-container'}"
|
|
647
|
+
>
|
|
648
|
+
<div
|
|
649
|
+
id="stepContainer"
|
|
650
|
+
class="${styles.stepContainer}"
|
|
651
|
+
style="${!isInModal &&
|
|
652
|
+
this.props.genericData.viewStyle === ViewStyles.COMPACT
|
|
653
|
+
? 'margin: 0px;padding: 0 24px;'
|
|
654
|
+
: ''}${this.props.stepContainerStyle || ''}${this.props.genericData
|
|
655
|
+
.viewStyle === ViewStyles.COMPACT && isInModal
|
|
656
|
+
? ''
|
|
657
|
+
: ''}"
|
|
658
|
+
>
|
|
659
|
+
${this.props.genericData.isPreviewMode &&
|
|
660
|
+
this.props.stepState.currentStep?.type === 'AUTH' &&
|
|
661
|
+
html`
|
|
662
|
+
<${InfoBox} style=${{ marginBottom: 30 }}>
|
|
663
|
+
The auth step is always shown in preview mode and will be hidden
|
|
664
|
+
when implicit auth is configured on your deployment. Learn more
|
|
665
|
+
${' '}<a
|
|
666
|
+
href="https://support.integry.io/hc/en-us/articles/360049619874-Single-Sign-On-SSO-with-Integration-Marketplace#implementingssoforintegrationmarketplaceinyourapplication"
|
|
667
|
+
target="_blank"
|
|
668
|
+
>here</a
|
|
669
|
+
>.
|
|
670
|
+
</${InfoBox}>
|
|
671
|
+
`}
|
|
672
|
+
<div
|
|
673
|
+
id="stepInfo"
|
|
674
|
+
class="${this.props.genericData.viewStyle === ViewStyles.COMPACT
|
|
675
|
+
? styles.stepInfoCompact
|
|
676
|
+
: styles.stepInfo} ${'integry-steps-information'} ${this.props
|
|
677
|
+
.genericData.app_id
|
|
678
|
+
? styles.appFlowStepInfo
|
|
679
|
+
: ''}"
|
|
680
|
+
>
|
|
681
|
+
${(currentStep || forceShowLastPage) &&
|
|
682
|
+
html`
|
|
683
|
+
${shouldShowLastStep
|
|
684
|
+
? html`
|
|
685
|
+
<div class=${styles.header}>
|
|
686
|
+
<div class=${styles.name}>
|
|
687
|
+
<svg
|
|
688
|
+
width="25"
|
|
689
|
+
height="25"
|
|
690
|
+
viewBox="0 0 25 25"
|
|
691
|
+
fill="none"
|
|
692
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
693
|
+
>
|
|
694
|
+
<circle
|
|
695
|
+
cx="12.5"
|
|
696
|
+
cy="12.5"
|
|
697
|
+
r="11.75"
|
|
698
|
+
fill="white"
|
|
699
|
+
stroke="#2ECC71"
|
|
700
|
+
stroke-width="1.5"
|
|
701
|
+
/>
|
|
702
|
+
<path
|
|
703
|
+
d="M17.2209 9.16699L11.3907 15.8337L8.33203 12.3361"
|
|
704
|
+
stroke="#2ECC71"
|
|
705
|
+
stroke-width="1.5"
|
|
706
|
+
stroke-linecap="round"
|
|
707
|
+
/>
|
|
708
|
+
</svg>
|
|
709
|
+
<div>
|
|
710
|
+
${postSave &&
|
|
711
|
+
!this.props.userConfig?.hideWebhookUrlScreen
|
|
712
|
+
? `Flow ${
|
|
713
|
+
this.context?.integrationId
|
|
714
|
+
? 'updated'
|
|
715
|
+
: 'created'
|
|
716
|
+
} successfully`
|
|
717
|
+
: 'Confirm and activate'}
|
|
718
|
+
</div>
|
|
719
|
+
</div>
|
|
720
|
+
${this.props.hideStepCount
|
|
721
|
+
? null
|
|
722
|
+
: html` <div class=${styles.steps}>
|
|
723
|
+
${`Step ${
|
|
724
|
+
(this.props.stepState?.stepIndex ?? 0) + 1
|
|
725
|
+
} / ${
|
|
726
|
+
(this.props.stepState?.steps.length ?? 0) + 1
|
|
727
|
+
}`}
|
|
728
|
+
</div>`}
|
|
729
|
+
</div>
|
|
730
|
+
`
|
|
731
|
+
: currentStep?.type === 'AUTH' &&
|
|
732
|
+
this.props.stepMapping[Number(selectedStep?.step.id)].step
|
|
733
|
+
.activity.app.id ===
|
|
734
|
+
(this.props.genericData.app_id || -1) &&
|
|
735
|
+
this.props.skipAuth
|
|
736
|
+
? null
|
|
737
|
+
: html`
|
|
738
|
+
<div class=${styles.header}>
|
|
739
|
+
<div class=${styles.name}>
|
|
740
|
+
<img
|
|
741
|
+
src=${selectedStep?.step.authorization_type.app
|
|
742
|
+
.icon_url ||
|
|
743
|
+
selectedStep?.step.activity.app.icon_url}
|
|
744
|
+
/>
|
|
745
|
+
<div class=${styles.textDiv}>
|
|
746
|
+
${currentStep?.type !== 'CONFIRMATION' &&
|
|
747
|
+
currentStep?.title}
|
|
748
|
+
${isReadOnly &&
|
|
749
|
+
currentStep?.type === 'CONFIGURATION' &&
|
|
750
|
+
this.showChangedTag(Number(selectedStep?.step?.id)) &&
|
|
751
|
+
html`<${Tag} label="Changed" />`}
|
|
752
|
+
</div>
|
|
753
|
+
</div>
|
|
754
|
+
${this.props.hideStepCount
|
|
755
|
+
? null
|
|
756
|
+
: html` <div class=${styles.steps}>
|
|
757
|
+
${`Step ${
|
|
758
|
+
(this.props.stepState?.stepIndex ?? 0) + 1
|
|
759
|
+
} / ${
|
|
760
|
+
isReadOnly
|
|
761
|
+
? this.props.stepState?.steps.length ?? 0
|
|
762
|
+
: (this.props.stepState?.steps.length ?? 0) + 1
|
|
763
|
+
}`}
|
|
764
|
+
</div>`}
|
|
765
|
+
</div>
|
|
766
|
+
${currentStep?.type !== 'CONFIRMATION' &&
|
|
767
|
+
(currentStep?.description || '') !== '' &&
|
|
768
|
+
html`
|
|
769
|
+
<div class=${styles.header}>
|
|
770
|
+
<div class=${styles.description}>
|
|
771
|
+
${currentStep?.description}
|
|
772
|
+
</div>
|
|
773
|
+
</div>
|
|
774
|
+
`}
|
|
775
|
+
`}
|
|
776
|
+
`}
|
|
777
|
+
</div>
|
|
778
|
+
<div
|
|
779
|
+
class="${this.props.genericData.viewStyle === ViewStyles.COMPACT
|
|
780
|
+
? styles.topCompact
|
|
781
|
+
: styles.top} ${this.props.genericData.viewStyle ===
|
|
782
|
+
ViewStyles.COMPACT
|
|
783
|
+
? styles.integryScrollbar
|
|
784
|
+
: ''}"
|
|
785
|
+
style="${this.props.genericData.testMultipurpose
|
|
786
|
+
? 'padding: 0px;'
|
|
787
|
+
: ''}${isInModal &&
|
|
788
|
+
this.props.genericData.viewStyle === ViewStyles.COMPACT
|
|
789
|
+
? 'overflow-y: auto;width: calc(100% + 10px);padding-right: 5px;max-width: none;'
|
|
790
|
+
: ''}"
|
|
791
|
+
>
|
|
792
|
+
${currentStep || forceShowLastPage
|
|
793
|
+
? html`
|
|
794
|
+
${shouldShowLastStep
|
|
795
|
+
? html`
|
|
796
|
+
${postSave &&
|
|
797
|
+
!this.props.userConfig?.hideWebhookUrlScreen
|
|
798
|
+
? html`
|
|
799
|
+
<div class=${styles.postSave}>
|
|
800
|
+
${this.state.postSaveDataArray &&
|
|
801
|
+
this.state.postSaveDataArray.length > 0 &&
|
|
802
|
+
html`
|
|
803
|
+
${this.state.postSaveDataArray
|
|
804
|
+
.filter((data) => data.postSave)
|
|
805
|
+
.map(
|
|
806
|
+
(data) => html`
|
|
807
|
+
<div
|
|
808
|
+
key=${`key_${data.templateStepId}`}
|
|
809
|
+
class="${styles.webhookFieldWrap}"
|
|
810
|
+
>
|
|
811
|
+
<${TextArea}
|
|
812
|
+
title="${data.stepName}"
|
|
813
|
+
description="Please use the following webhook url to send data"
|
|
814
|
+
value=${data.postSaveData.endpoint}
|
|
815
|
+
showCopyButton=${true}
|
|
816
|
+
/>
|
|
817
|
+
</div>
|
|
818
|
+
`,
|
|
819
|
+
)}
|
|
820
|
+
`}
|
|
821
|
+
</div>
|
|
822
|
+
`
|
|
823
|
+
: html`
|
|
824
|
+
<div class=${styles.save}>
|
|
825
|
+
${this.props.genericData.isAnonymous
|
|
826
|
+
? html`The integration cannot be enabled
|
|
827
|
+
because the marketplace owner hasn't
|
|
828
|
+
configured authorization. If you are the
|
|
829
|
+
owner, you can set up authorization in
|
|
830
|
+
Marketplace settings.`
|
|
831
|
+
: html` ${this.props.integrationIdToEdit
|
|
832
|
+
? `Your integration is ready to be updated. Click “${
|
|
833
|
+
this.props.userConfig
|
|
834
|
+
?.buttonLabelToSaveIntegration ||
|
|
835
|
+
'Update'
|
|
836
|
+
}” to continue.`
|
|
837
|
+
: `Your integration is ready to be enabled. Click “${
|
|
838
|
+
this.props.userConfig
|
|
839
|
+
?.buttonLabelToSaveIntegration ||
|
|
840
|
+
'Save'
|
|
841
|
+
}” to continue.`}`}
|
|
842
|
+
</div>
|
|
843
|
+
`}
|
|
844
|
+
`
|
|
845
|
+
: html`
|
|
846
|
+
${selectedStep &&
|
|
847
|
+
html`
|
|
848
|
+
${currentStep?.type === 'AUTH'
|
|
849
|
+
? html`
|
|
850
|
+
<div class=${styles.authWrap}>
|
|
851
|
+
<${this.props.genericData.testMultipurpose
|
|
852
|
+
? AuthSelectorCompact
|
|
853
|
+
: AuthSelector}
|
|
854
|
+
stepId=${selectedStep.step.id}
|
|
855
|
+
key=${selectedStep.step.id}
|
|
856
|
+
apiHandler=${this.context.apiHandler}
|
|
857
|
+
showErrors=${showStepValidation}
|
|
858
|
+
forcedLoading=${this.props.skipAuth &&
|
|
859
|
+
this.props.stepMapping[
|
|
860
|
+
Number(selectedStep?.step.id)
|
|
861
|
+
].step.activity.app.id ===
|
|
862
|
+
(this.props.genericData.app_id || -1)}
|
|
863
|
+
onAuthSelected=${(
|
|
864
|
+
authId: number,
|
|
865
|
+
isVerified: boolean,
|
|
866
|
+
override: boolean,
|
|
867
|
+
) =>
|
|
868
|
+
this.handleAuthSelected(
|
|
869
|
+
authId,
|
|
870
|
+
Number(selectedStep?.step.id),
|
|
871
|
+
isVerified,
|
|
872
|
+
override,
|
|
873
|
+
)}
|
|
874
|
+
isReadOnly=${this.props.editMode}
|
|
875
|
+
>
|
|
876
|
+
<//>
|
|
877
|
+
</div>
|
|
878
|
+
`
|
|
879
|
+
: html`
|
|
880
|
+
<${this.props.genericData.testMultipurpose
|
|
881
|
+
? ActionForm
|
|
882
|
+
: Step}
|
|
883
|
+
step=${selectedStep?.step}
|
|
884
|
+
stepType=${currentStep?.type}
|
|
885
|
+
showStepValidation=${showStepValidation}
|
|
886
|
+
apiHandler=${this.context.apiHandler}
|
|
887
|
+
eventEmitter=${this.context.eventEmitter}
|
|
888
|
+
isReadOnly=${this.context?.isReadOnly}
|
|
889
|
+
/>
|
|
890
|
+
`}
|
|
891
|
+
`}
|
|
892
|
+
`}
|
|
893
|
+
`
|
|
894
|
+
: html`This flow has no configured steps`}
|
|
895
|
+
</div>
|
|
896
|
+
${currentStep &&
|
|
897
|
+
this.props.genericData.viewStyle === ViewStyles.COMPACT &&
|
|
898
|
+
html`
|
|
899
|
+
<div
|
|
900
|
+
id="${this.props.genericData.viewStyle === ViewStyles.COMPACT
|
|
901
|
+
? 'stepsBottom'
|
|
902
|
+
: 'stepsBottomComfortable'}"
|
|
903
|
+
style="${this.props.genericData.viewStyle ===
|
|
904
|
+
ViewStyles.COMPACT && !isInModal
|
|
905
|
+
? 'padding-bottom: 16px;'
|
|
906
|
+
: ''}"
|
|
907
|
+
class=${`${
|
|
908
|
+
this.props.genericData.viewStyle === ViewStyles.COMPACT
|
|
909
|
+
? styles.bottomCompact
|
|
910
|
+
: styles.bottom
|
|
911
|
+
} ${this.props.stepsClassName?.bottom || ''}`}
|
|
912
|
+
>
|
|
913
|
+
<div
|
|
914
|
+
class=${this.props.genericData.viewStyle === ViewStyles.COMPACT
|
|
915
|
+
? styles.buttonsCompact
|
|
916
|
+
: styles.buttons}
|
|
917
|
+
>
|
|
918
|
+
${!this.props.genericData.testMultipurpose &&
|
|
919
|
+
shouldShowBackButton &&
|
|
920
|
+
!postSave &&
|
|
921
|
+
html`
|
|
922
|
+
<${Button}
|
|
923
|
+
label="Back"
|
|
924
|
+
onClick=${() => {
|
|
925
|
+
const currentSelectedStep = this.props.stepState?.steps[
|
|
926
|
+
this.props.stepState?.stepIndex - 1
|
|
927
|
+
];
|
|
928
|
+
if (
|
|
929
|
+
this.props.skipAuth &&
|
|
930
|
+
currentSelectedStep.type === 'AUTH' &&
|
|
931
|
+
this.props.onBackClick
|
|
932
|
+
) {
|
|
933
|
+
let isDifferntApp = false;
|
|
934
|
+
if (
|
|
935
|
+
this.props.stepMapping[
|
|
936
|
+
Number(currentSelectedStep.stepId)
|
|
937
|
+
].step.activity.app.id !==
|
|
938
|
+
(this.props.genericData.app_id || -1)
|
|
939
|
+
) {
|
|
940
|
+
isDifferntApp = true;
|
|
941
|
+
}
|
|
942
|
+
if (isDifferntApp) {
|
|
943
|
+
this.props.gotoPreviousStep();
|
|
944
|
+
} else {
|
|
945
|
+
this.props.onBackClick();
|
|
946
|
+
}
|
|
947
|
+
} else {
|
|
948
|
+
this.props.gotoPreviousStep();
|
|
949
|
+
}
|
|
950
|
+
}}
|
|
951
|
+
type=${ButtonTypes.SECONDARY}
|
|
952
|
+
><//>
|
|
953
|
+
`}
|
|
954
|
+
${shouldShowLastStep
|
|
955
|
+
? html`
|
|
956
|
+
${!postSave
|
|
957
|
+
? html`
|
|
958
|
+
${this.props.integrationIdToEdit
|
|
959
|
+
? html`
|
|
960
|
+
<${Button}
|
|
961
|
+
label=${this.props.submitButtonText ||
|
|
962
|
+
this.props.userConfig
|
|
963
|
+
?.buttonLabelToSaveIntegration ||
|
|
964
|
+
'Update'}
|
|
965
|
+
disabled=${this.context.isPreviewMode ||
|
|
966
|
+
this.state.loading}
|
|
967
|
+
isLoading=${this.state.loading}
|
|
968
|
+
onClick=${() => this.updateIntegration()}
|
|
969
|
+
><//>
|
|
970
|
+
`
|
|
971
|
+
: html`
|
|
972
|
+
<${Button}
|
|
973
|
+
label=${this.props.submitButtonText ||
|
|
974
|
+
this.props.userConfig
|
|
975
|
+
?.buttonLabelToSaveIntegration ||
|
|
976
|
+
'Save'}
|
|
977
|
+
disabled=${this.context.isPreviewMode ||
|
|
978
|
+
this.props.genericData.isAnonymous ||
|
|
979
|
+
this.state.loading}
|
|
980
|
+
tooltip=${this.context.isPreviewMode
|
|
981
|
+
? 'Since this is just a preview, integration\nsetup will have to be done in "Live View"'
|
|
982
|
+
: null}
|
|
983
|
+
isLoading=${this.state.loading}
|
|
984
|
+
onClick=${() => this.createIntegration()}
|
|
985
|
+
><//>
|
|
986
|
+
`}
|
|
987
|
+
`
|
|
988
|
+
: html`
|
|
989
|
+
<${Button}
|
|
990
|
+
label="Continue"
|
|
991
|
+
onClick=${() => this.dismiss()}
|
|
992
|
+
><//>
|
|
993
|
+
`}
|
|
994
|
+
`
|
|
995
|
+
: html` ${isReadOnly && stepIndex === steps.length - 1
|
|
996
|
+
? html`<${Button}
|
|
997
|
+
label="Close"
|
|
998
|
+
disabled=${this.context.isPreviewMode ||
|
|
999
|
+
this.state.loading}
|
|
1000
|
+
isLoading=${this.state.loading}
|
|
1001
|
+
onClick=${() => this.handleClose()}
|
|
1002
|
+
><//>`
|
|
1003
|
+
: html`<${Button}
|
|
1004
|
+
label="Next"
|
|
1005
|
+
hasError=${!isReadOnly && !isStepValid}
|
|
1006
|
+
tooltip=${tooltip}
|
|
1007
|
+
position="top-right-compact"
|
|
1008
|
+
onClick=${() =>
|
|
1009
|
+
isReadOnly || isStepValid
|
|
1010
|
+
? this.props.gotoNextStep()
|
|
1011
|
+
: this.props.showStepValidationState()}
|
|
1012
|
+
><//> `}`}
|
|
1013
|
+
</div>
|
|
1014
|
+
</div>
|
|
1015
|
+
`}
|
|
1016
|
+
</div>
|
|
1017
|
+
</div>
|
|
1018
|
+
${(currentStep || forceShowLastPage) &&
|
|
1019
|
+
this.props.genericData.viewStyle === ViewStyles.COMFORTABLE &&
|
|
1020
|
+
html`
|
|
1021
|
+
<div
|
|
1022
|
+
id="${'stepsBottomComfortable'}"
|
|
1023
|
+
class=${`${styles.bottom} ${this.props.stepsClassName?.bottom || ''}`}
|
|
1024
|
+
>
|
|
1025
|
+
<div class=${styles.buttons}>
|
|
1026
|
+
${!this.props.genericData.testMultipurpose &&
|
|
1027
|
+
shouldShowBackButton &&
|
|
1028
|
+
!postSave &&
|
|
1029
|
+
html`
|
|
1030
|
+
<${Button}
|
|
1031
|
+
label="Back"
|
|
1032
|
+
onClick=${() => {
|
|
1033
|
+
const currentSelectedStep = this.props.stepState?.steps[
|
|
1034
|
+
this.props.stepState?.stepIndex - 1
|
|
1035
|
+
];
|
|
1036
|
+
if (
|
|
1037
|
+
this.props.skipAuth &&
|
|
1038
|
+
currentSelectedStep.type === 'AUTH' &&
|
|
1039
|
+
this.props.onBackClick
|
|
1040
|
+
) {
|
|
1041
|
+
let isDifferntApp = false;
|
|
1042
|
+
if (
|
|
1043
|
+
this.props.stepMapping[Number(currentSelectedStep.stepId)]
|
|
1044
|
+
.step.activity.app.id !==
|
|
1045
|
+
(this.props.genericData.app_id || -1)
|
|
1046
|
+
) {
|
|
1047
|
+
isDifferntApp = true;
|
|
1048
|
+
}
|
|
1049
|
+
if (isDifferntApp) {
|
|
1050
|
+
this.props.gotoPreviousStep();
|
|
1051
|
+
} else {
|
|
1052
|
+
this.props.onBackClick();
|
|
1053
|
+
}
|
|
1054
|
+
} else {
|
|
1055
|
+
this.props.gotoPreviousStep();
|
|
1056
|
+
}
|
|
1057
|
+
}}
|
|
1058
|
+
type=${ButtonTypes.SECONDARY}
|
|
1059
|
+
><//>
|
|
1060
|
+
`}
|
|
1061
|
+
${shouldShowLastStep
|
|
1062
|
+
? html`
|
|
1063
|
+
${!postSave
|
|
1064
|
+
? html`
|
|
1065
|
+
${this.props.integrationIdToEdit
|
|
1066
|
+
? html`
|
|
1067
|
+
<${Button}
|
|
1068
|
+
label=${this.props.submitButtonText ||
|
|
1069
|
+
this.props.userConfig
|
|
1070
|
+
?.buttonLabelToSaveIntegration ||
|
|
1071
|
+
'Update'}
|
|
1072
|
+
disabled=${this.context.isPreviewMode ||
|
|
1073
|
+
this.state.loading}
|
|
1074
|
+
isLoading=${this.state.loading}
|
|
1075
|
+
onClick=${() => this.updateIntegration()}
|
|
1076
|
+
><//>
|
|
1077
|
+
`
|
|
1078
|
+
: html`
|
|
1079
|
+
<${Button}
|
|
1080
|
+
label=${this.props.submitButtonText ||
|
|
1081
|
+
this.props.userConfig
|
|
1082
|
+
?.buttonLabelToSaveIntegration ||
|
|
1083
|
+
'Save'}
|
|
1084
|
+
disabled=${this.context.isPreviewMode ||
|
|
1085
|
+
this.props.genericData.isAnonymous ||
|
|
1086
|
+
this.state.loading}
|
|
1087
|
+
tooltip=${this.context.isPreviewMode
|
|
1088
|
+
? 'Since this is just a preview, integration\nsetup will have to be done in "Live View"'
|
|
1089
|
+
: null}
|
|
1090
|
+
isLoading=${this.state.loading}
|
|
1091
|
+
onClick=${() => this.createIntegration()}
|
|
1092
|
+
><//>
|
|
1093
|
+
`}
|
|
1094
|
+
`
|
|
1095
|
+
: html`
|
|
1096
|
+
<${Button}
|
|
1097
|
+
label="Continue"
|
|
1098
|
+
onClick=${() => this.dismiss()}
|
|
1099
|
+
><//>
|
|
1100
|
+
`}
|
|
1101
|
+
`
|
|
1102
|
+
: html` ${isReadOnly && stepIndex === steps.length - 1
|
|
1103
|
+
? html`<${Button}
|
|
1104
|
+
label="Close"
|
|
1105
|
+
disabled=${this.context.isPreviewMode ||
|
|
1106
|
+
this.state.loading}
|
|
1107
|
+
isLoading=${this.state.loading}
|
|
1108
|
+
onClick=${() => this.handleClose()}
|
|
1109
|
+
><//>`
|
|
1110
|
+
: html`<${Button}
|
|
1111
|
+
label="Next"
|
|
1112
|
+
hasError=${!isReadOnly && !isStepValid}
|
|
1113
|
+
tooltip=${tooltip}
|
|
1114
|
+
position="top-right"
|
|
1115
|
+
onClick=${() =>
|
|
1116
|
+
isReadOnly || isStepValid
|
|
1117
|
+
? this.props.gotoNextStep()
|
|
1118
|
+
: this.props.showStepValidationState()}
|
|
1119
|
+
><//> `}`}
|
|
1120
|
+
</div>
|
|
1121
|
+
</div>
|
|
1122
|
+
`}
|
|
1123
|
+
`;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
export default connect<StepsPropsType, StepsStateType, StoreType, unknown>(
|
|
1128
|
+
[
|
|
1129
|
+
'stepState',
|
|
1130
|
+
'userConfig',
|
|
1131
|
+
'mappingInfo',
|
|
1132
|
+
'genericData',
|
|
1133
|
+
'stepMapping',
|
|
1134
|
+
'stepDataMapping',
|
|
1135
|
+
'integrationIdToEdit',
|
|
1136
|
+
'integrations',
|
|
1137
|
+
],
|
|
1138
|
+
actionFunctions,
|
|
1139
|
+
)(Steps);
|