@integry/sdk 4.7.39 → 4.7.41

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