@integry/sdk 4.7.39 → 4.7.40

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,1085 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable no-use-before-define */
3
- /* eslint-disable no-nested-ternary */
4
- import { html } from 'htm/preact';
5
- import {
6
- useEffect,
7
- useContext,
8
- useState,
9
- useCallback,
10
- useRef,
11
- } from 'preact/hooks';
12
- import { connect } from 'unistore/preact';
13
- import { Modal } from '@/components/Modal';
14
- import Footer from '@/components/Footer';
15
- import { actionFunctions } from '@/store';
16
- import FlowSetupContainer from '@/features/containers/FlowSetupContainer';
17
- import Authentication from '@/features/containers/AppFlowContainer/Authentication';
18
- import AppContext from '@/contexts/AppContext';
19
- import { StoreType } from '@/types/store';
20
- import {
21
- BrandingApp,
22
- UserConfig,
23
- Flow,
24
- TemplateStep,
25
- Instance,
26
- Integration,
27
- } from '@/interfaces';
28
- import { AuthData, isAuthMessage } from '@/utils/isAuthMessage';
29
- import { MarketplaceRenderModes, ViewStyles } from '@/types';
30
- import AppFlowListing from '../AppFlowListing';
31
-
32
- import styles from './styles.module.scss';
33
- import AppPageLoader from './app-page-loader';
34
-
35
- interface WraperrProps extends StoreType {
36
- marketplaceId: string;
37
- userConfig?: UserConfig;
38
- renderMode?: MarketplaceRenderModes;
39
- renderFlowSetupMode?: MarketplaceRenderModes;
40
- onBackClick?: () => void;
41
- isInModal?: boolean;
42
- }
43
-
44
- const RenderAppPage = (props: WraperrProps) => {
45
- const [appData, setAppData] = useState<BrandingApp | null>(null);
46
- const [isLoading, setIsloading] = useState<boolean>(false);
47
- const [isReloadingFlowListing, setIsReloadingFlowListing] = useState<boolean>(
48
- false,
49
- );
50
- const [selectedFlow, setSelectedFlow] = useState<{
51
- flow: Flow;
52
- instance: Instance | null;
53
- } | null>(null);
54
- const [appFlows, setAppFlows] = useState<Flow[] | []>([]);
55
- const [skipAuth, setSkipAuth] = useState<boolean>(true);
56
- const [accountVerified, setAccountVerified] = useState<boolean>(false);
57
- const interval = useRef<null | ReturnType<typeof setTimeout>>(null);
58
- // const [selectedAuthId, setSelectedAuthId] = useState<number>(0);
59
- const context = useContext(AppContext);
60
- const {
61
- genericData,
62
- renderMode,
63
- renderFlowSetupMode,
64
- isInModal = false,
65
- } = props;
66
- const { marketplaceId, app_id, keepBackButtonForFlows = false } = genericData;
67
- let selectedAuthId = 0;
68
-
69
- useEffect(() => {
70
- setIsloading(true);
71
- if (app_id) {
72
- // eslint-disable-next-line no-use-before-define
73
- getAppFlows();
74
- }
75
- return () => interval.current && clearInterval(interval.current);
76
- }, [app_id]);
77
-
78
- useEffect(() => {
79
- if (app_id) {
80
- context?.apiHandler.getAppInfo(app_id).then((data) => {
81
- if (data) {
82
- setAppData(data);
83
- if (data.authorization_type) {
84
- const { authorizations = [] } = data.authorization_type;
85
- setSkipAuth(authorizations.length > 0);
86
- emitDidAppLoadEvent(data);
87
- }
88
- } else {
89
- console.error(`Failed to fetch app details`);
90
- }
91
- });
92
- }
93
- }, [app_id]);
94
-
95
- const emitDidAppLoadEvent = useCallback((appInfo: BrandingApp) => {
96
- if (appInfo && appInfo.authorization_type) {
97
- const { authorizations = [] } = appInfo.authorization_type;
98
- const currentAutObj =
99
- authorizations.length > 0
100
- ? authorizations[authorizations.length - 1]
101
- : null;
102
- context?.eventEmitter.emit('did-app-load', {
103
- appName: appInfo.name,
104
- appId: appInfo.id,
105
- appLogoUrl: appInfo.icon_url,
106
- authorizationId: currentAutObj?.id || null,
107
- });
108
- }
109
- }, []);
110
-
111
- const pollApiWithExponentialBackoff = (
112
- remainingTime = 600000, // 10 mins
113
- currentDelay = 1000,
114
- ) => {
115
- if (app_id && remainingTime > 0) {
116
- const { userConfig } = props;
117
- if (genericData.deploymentId && genericData.showTemplates) {
118
- context?.apiHandler
119
- .getAdminAppFlows({
120
- appId: app_id,
121
- bundleId: genericData.deploymentId,
122
- })
123
- .then((data) => {
124
- if (data) {
125
- setAppFlows(data.results);
126
- interval.current = setTimeout(() => {
127
- pollApiWithExponentialBackoff(
128
- remainingTime - currentDelay,
129
- currentDelay * 1.5,
130
- );
131
- }, currentDelay);
132
- } else {
133
- console.error(`Failed to fetch flows`);
134
- }
135
- });
136
- } else {
137
- const { tags = [] } = userConfig || {};
138
- context?.apiHandler
139
- .getAppFlows(app_id, tags, selectedAuthId)
140
- .then((data) => {
141
- if (data) {
142
- setAppFlows(data.results);
143
- interval.current = setTimeout(() => {
144
- pollApiWithExponentialBackoff(
145
- remainingTime - currentDelay,
146
- currentDelay * 1.5,
147
- );
148
- }, currentDelay);
149
- } else {
150
- console.error(`Failed to fetch flows`);
151
- }
152
- });
153
- }
154
- }
155
- };
156
-
157
- const pollFlowStatus = (flows: Flow[]) => {
158
- const shouldPoll = flows.some(
159
- (flow) =>
160
- flow.instances.length > 0 &&
161
- flow.instances.some((instance) => instance.status === 'ACTIVE'),
162
- );
163
- if (shouldPoll) {
164
- pollApiWithExponentialBackoff();
165
- } else if (interval.current) {
166
- clearInterval(interval.current);
167
- }
168
- };
169
-
170
- const updateInstanceName = (
171
- flowId: number,
172
- instanceId: number,
173
- name: string,
174
- ) => {
175
- const updatedInstances = appFlows.map((flow) => {
176
- if (flow.id === flowId) {
177
- const updatedFlow = {
178
- ...flow,
179
- instances: flow.instances.map((instance) => {
180
- const updatedInstance = { ...instance };
181
- if (instance.id === instanceId) {
182
- updatedInstance.name = name;
183
- }
184
- return updatedInstance;
185
- }),
186
- };
187
- return updatedFlow;
188
- }
189
- return flow;
190
- });
191
- setAppFlows(updatedInstances);
192
- };
193
-
194
- const handleDeleteInstance = (integration: Integration) => {
195
- const {
196
- id: integrationId,
197
- name: integrationName,
198
- template_detail,
199
- } = integration;
200
- props.setIntegrationLoadingState({
201
- integrationId,
202
- isLoading: true,
203
- op: 'edit',
204
- });
205
- context?.apiHandler
206
- .deleteIntegration(integrationId)
207
- .then((res) => {
208
- console.info(res);
209
- props.setIntegrationLoadingState({
210
- integrationId,
211
- isLoading: false,
212
- op: 'delete',
213
- });
214
- getAppFlows();
215
-
216
- context?.eventEmitter.emit('did-delete-integration', {
217
- flowId: template_detail.id,
218
- flowName: template_detail.name,
219
- flowDescription: template_detail.description,
220
- integrationId,
221
- integrationName,
222
- });
223
- })
224
- .catch((err) => console.error(err));
225
- };
226
-
227
- const getAppFlows = (authId: any = null) => {
228
- if (authId && selectedAuthId !== authId) {
229
- setIsReloadingFlowListing(true);
230
- selectedAuthId = authId;
231
- }
232
- if (interval.current) clearInterval(interval.current);
233
- if (app_id) {
234
- const { userConfig } = props;
235
- if (genericData.deploymentId && genericData.showTemplates) {
236
- context?.apiHandler
237
- .getAdminAppFlows({
238
- appId: app_id,
239
- bundleId: genericData.deploymentId,
240
- })
241
- .then((data) => {
242
- if (data) {
243
- setAppFlows(data.results);
244
- pollFlowStatus(data.results);
245
- setIsloading(false);
246
- setIsReloadingFlowListing(false);
247
- context?.eventEmitter.emit('did-load-flows', {
248
- flows: data.results,
249
- });
250
- } else {
251
- console.error(`Failed to fetch flows`);
252
- }
253
- });
254
- } else {
255
- const { tags = [] } = userConfig || {};
256
- context?.apiHandler.getAppFlows(app_id, tags, authId).then((data) => {
257
- if (data) {
258
- setAppFlows(data.results);
259
- pollFlowStatus(data.results);
260
- setIsloading(false);
261
- setIsReloadingFlowListing(false);
262
- context?.eventEmitter.emit('did-load-flows', {
263
- flows: data.results,
264
- });
265
- } else {
266
- console.error(`Failed to fetch flows`);
267
- }
268
- });
269
- }
270
- }
271
- };
272
-
273
- const emitAddAuthEvent = useCallback(
274
- (messageEvent: MessageEvent<AuthData>) => {
275
- if (isAuthMessage(messageEvent) && messageEvent.data.activity_name) {
276
- const eventPayload = {
277
- identity: messageEvent.data.user_identity,
278
- authorizationId: Number(messageEvent.data.authorization_id),
279
- flowId: null,
280
- appId: messageEvent.data.app_id,
281
- appName: appData?.name || '',
282
- appIcon: appData?.icon_url || '',
283
- alreadyExists: messageEvent.data.already_exists,
284
- externalId: messageEvent.data.external_id,
285
- };
286
- context?.eventEmitter.emit('did-add-authorization', eventPayload);
287
- }
288
- },
289
- [],
290
- );
291
-
292
- const emitDeleteAuthEvent = (authId: number, appId: number) => {
293
- context?.eventEmitter.emit('did-remove-authorization', {
294
- authorizationId: Number(authId),
295
- appId,
296
- });
297
- };
298
-
299
- const onFlowSelect = (flow: Flow, instance?: Instance) => {
300
- setSelectedFlow({ flow, instance: instance || null });
301
- if (!instance) {
302
- props.setStoreState({
303
- integrationIdToEdit: null,
304
- showSetupModal: true,
305
- });
306
- props.setGenericData({
307
- name: flow.name,
308
- });
309
- } else {
310
- props.setStoreState({
311
- integrationIdToEdit: instance.id,
312
- showSetupModal: true,
313
- });
314
- props.setGenericData({
315
- name: instance.name,
316
- });
317
- }
318
- if (interval.current) {
319
- clearInterval(interval.current);
320
- }
321
- };
322
-
323
- const getSelectedStep = () => {
324
- const { stepState, stepMapping } = props;
325
- const { currentStep, stepIndex, steps } = stepState;
326
- let selectedStep: {
327
- step: TemplateStep;
328
- selectedAuthId: number | null;
329
- } | null = null;
330
- let shouldShowLastStep = false;
331
- let shouldShowBackButton = false;
332
- let isStepValid = false;
333
- let showStepValidation = false;
334
- if (stepIndex > -1 && currentStep?.type !== 'CONFIRMATION') {
335
- selectedStep = stepMapping[Number(currentStep?.stepId)];
336
- shouldShowLastStep = false;
337
- shouldShowBackButton = stepState.stepIndex > 0;
338
- isStepValid = currentStep?.isValid ?? false;
339
- showStepValidation = stepState.showValidation;
340
- } else if (
341
- currentStep?.type === 'CONFIRMATION' &&
342
- stepIndex === steps.length
343
- ) {
344
- shouldShowBackButton = true;
345
- shouldShowLastStep = true;
346
- }
347
- return {
348
- selectedStep,
349
- isStepValid,
350
- showStepValidation,
351
- shouldShowBackButton,
352
- shouldShowLastStep,
353
- };
354
- };
355
-
356
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
357
- const getSelectedStepApp = (step: any): any => {
358
- if (step && step.authorization_type) {
359
- return {
360
- id: step.authorization_type.app.id,
361
- name: step.authorization_type.app.name,
362
- icon_url: step.authorization_type.app.icon_url,
363
- authorization_type: step.authorization_type,
364
- };
365
- }
366
- return null;
367
- };
368
-
369
- const getStepAuthorizations = (authorizations: any) => {
370
- const updateAuthorizations: any = [];
371
- authorizations.forEach((auth: any) => {
372
- updateAuthorizations.push({
373
- id: auth.authorizationId,
374
- user_identity: auth.userIdentity,
375
- });
376
- });
377
- return updateAuthorizations;
378
- };
379
-
380
- const handleAuthSelected = (
381
- authId: number,
382
- stepId: number,
383
- isVerified: boolean,
384
- override: boolean,
385
- ) => {
386
- const dependentSteps = props.stepMapping[stepId]?.step.template_fields
387
- .filter((el) => el.activity_field && el.activity_field.is_dynamic)
388
- .map((el) => el.id);
389
- // reset all dynamic steps if auth changes
390
- if (props.stepMapping[stepId]?.selectedAuthId !== authId) {
391
- props.setStepAuthorization(
392
- stepId,
393
- authId,
394
- isVerified,
395
- dependentSteps,
396
- override,
397
- );
398
- }
399
-
400
- if (selectedFlow === null) {
401
- props.setSelectedAuthByAppId({
402
- appId: appData?.id || -1,
403
- authId,
404
- });
405
- }
406
- // selectedAuthId = authId;
407
- getAppFlows(authId);
408
-
409
- /* const isMainApp =
410
- props.stepMapping[stepId]?.step.activity.app.id ===
411
- (props.genericData.app_id || -1); */
412
- // if (
413
- // props.skipAuth &&
414
- // currentStep?.type === 'AUTH' &&
415
- // isMainApp &&
416
- // isVerified
417
- // ) {
418
- // this.props.gotoNextStep();
419
- // }
420
- };
421
-
422
- const deleteAuth = (authId: number, stepId: number, appId: number) => {
423
- const auth = props.stepMapping[stepId].authorizations.filter(
424
- // eslint-disable-next-line @typescript-eslint/no-shadow
425
- (auth: any) => auth.authorizationId === authId,
426
- )[0];
427
-
428
- props.toggleDeleteAuthorizationFlag({
429
- stepId,
430
- authId: auth.authorizationId,
431
- isDeleting: true,
432
- error: '',
433
- });
434
-
435
- context?.eventEmitter.emit('did-begin-remove-authorization', {
436
- authorizationId: Number(auth.authorizationId),
437
- });
438
- props.removeAuthorization({
439
- stepId,
440
- authId: auth.authorizationId,
441
- });
442
- context?.eventEmitter.emit('did-remove-authorization', {
443
- authorizationId: Number(auth.authorizationId),
444
- appId,
445
- });
446
- };
447
-
448
- const onAuthResponseReceived = (
449
- messageEvent: MessageEvent<AuthData>,
450
- stepId: number,
451
- ) => {
452
- if (isAuthMessage(messageEvent) && messageEvent.data.activity_name) {
453
- console.info(messageEvent.data);
454
- if (stepId) {
455
- if (!messageEvent.data.already_exists) {
456
- props.addAuthorization({
457
- stepId,
458
- authData: {
459
- authorizationId: messageEvent.data.authorization_id,
460
- userIdentity: messageEvent.data.user_identity,
461
- disableLink: '',
462
- authType: '',
463
- isVerified: false,
464
- didFetchStatus: false,
465
- isVerifying: false,
466
- isDeleting: false,
467
- error: '',
468
- },
469
- });
470
- } else {
471
- props.setStepAuthId({
472
- stepId,
473
- authId: Number(messageEvent.data.authorization_id),
474
- });
475
- }
476
- // context?.eventEmitter.emit('did-add-authorization', {
477
- // identity: messageEvent.data.user_identity,
478
- // authorizationId: Number(messageEvent.data.authorization_id),
479
- // flowId: props.genericData.templateId,
480
- // appId: appId || 0,
481
- // appName: authApp?.name,
482
- // appIcon: authApp?.icon_url,
483
- // alreadyExists: messageEvent.data.already_exists,
484
- // externalId: messageEvent.data.external_id,
485
- // });
486
- }
487
- }
488
- };
489
-
490
- const handleGoBackToAppsCloseModal = () => {
491
- setSelectedFlow(null);
492
- getAppFlows();
493
- props.setStoreState({
494
- showSetupModal: false,
495
- });
496
- };
497
-
498
- const handleGoBackToApps = () => {
499
- if (!props.genericData.testMultipurpose) {
500
- setSelectedFlow(null);
501
- getAppFlows();
502
- props.setStoreState({
503
- showSetupModal: false,
504
- });
505
- } else if (getSelectedStep().shouldShowBackButton) {
506
- const currentSelectedStep =
507
- props.stepState?.steps[props.stepState?.stepIndex - 1];
508
- if (currentSelectedStep.type === 'AUTH') {
509
- setSelectedFlow(null);
510
- getAppFlows();
511
- props.setStoreState({
512
- showSetupModal: false,
513
- });
514
- } else {
515
- props.gotoPreviousStep();
516
- }
517
- } else {
518
- setSelectedFlow(null);
519
- getAppFlows();
520
- props.setStoreState({
521
- showSetupModal: false,
522
- });
523
- }
524
- };
525
-
526
- return isLoading
527
- ? html`<div
528
- class="${genericData.viewStyle === ViewStyles.COMPACT
529
- ? styles['compact-view']
530
- : ''}"
531
- >
532
- <${AppPageLoader} renderMode=${renderMode} />
533
- </div>`
534
- : html`
535
- <div
536
- id="appPageContainer-${genericData.viewStyle}--${renderMode}"
537
- class="${styles.appPageContainer} ${'integry-container__app-page'} ${props
538
- .genericData.testMultipurpose
539
- ? styles.appPageContainerCompact
540
- : ''} ${genericData.viewStyle === ViewStyles.COMPACT
541
- ? styles['compact-view']
542
- : ''}"
543
- style="${renderMode === MarketplaceRenderModes.INLINE
544
- ? 'display: flex; flex-direction: column;'
545
- : ''}
546
- ${genericData.viewStyle === ViewStyles.COMPACT &&
547
- renderMode === MarketplaceRenderModes.INLINE
548
- ? 'height: calc(100%);'
549
- : ''}
550
- "
551
- >
552
- <div
553
- class="${selectedFlow && props.genericData.testMultipurpose
554
- ? styles.headerCompact
555
- : styles.header} ${'app-page__header'} ${genericData.viewStyle ===
556
- ViewStyles.COMPACT && isInModal
557
- ? styles.headerCompactInModal
558
- : ''}"
559
- >
560
- ${props.genericData.testMultipurpose &&
561
- html` <div class=${styles.appInfo}>
562
- ${selectedFlow &&
563
- html`
564
- <div class="${styles.flowSetupHeaderCompact}">
565
- <svg
566
- onclick=${handleGoBackToApps}
567
- class=${styles.backLink}
568
- xmlns="http://www.w3.org/2000/svg"
569
- width="32"
570
- height="32"
571
- viewBox="0 0 32 32"
572
- fill="none"
573
- >
574
- <circle
575
- cx="16"
576
- cy="16"
577
- r="15.5"
578
- fill="white"
579
- stroke="#E0E0E0"
580
- />
581
- <path
582
- d="M15.547 11.0504L15.8825 10.7004L15.8825 10.7004L15.547 11.0504ZM15.5614 11.7359L15.2114 11.4004L15.2114 11.4004L15.5614 11.7359ZM14.8614 11.0649L15.2114 11.4004L15.2114 11.4004L14.8614 11.0649ZM10.013 16.1222L9.66297 15.7867L9.66297 15.7867L10.013 16.1222ZM9.69129 16.4578L9.3413 16.1222L9.01962 16.4578L9.3413 16.7933L9.69129 16.4578ZM10.013 16.7933L9.66297 17.1288L10.013 16.7933ZM14.8614 21.8507L15.2114 21.5151L15.2114 21.5151L14.8614 21.8507ZM15.547 21.8651L15.8825 22.2151L15.8825 22.2151L15.547 21.8651ZM15.5614 21.1796L15.9114 20.8441L15.9114 20.8441L15.5614 21.1796ZM11.0346 16.4578L10.6846 16.1222L10.363 16.4578L10.6846 16.7933L11.0346 16.4578ZM15.2114 11.4004L15.2114 11.4004L15.9114 12.0715C16.282 11.6849 16.2691 11.071 15.8825 10.7004L15.2114 11.4004ZM15.2114 11.4004L15.2114 11.4004L15.8825 10.7004C15.4959 10.3298 14.8821 10.3427 14.5115 10.7293L15.2114 11.4004ZM10.363 16.4578L15.2114 11.4004L14.5115 10.7293L9.66297 15.7867L10.363 16.4578ZM10.0413 16.7933L10.363 16.4578L9.66297 15.7867L9.3413 16.1222L10.0413 16.7933ZM10.363 16.4578L10.0413 16.1222L9.3413 16.7933L9.66297 17.1288L10.363 16.4578ZM15.2114 21.5151L10.363 16.4578L9.66297 17.1288L14.5115 22.1862L15.2114 21.5151ZM15.2114 21.5151L15.2114 21.5151L14.5115 22.1862C14.8821 22.5728 15.4959 22.5858 15.8825 22.2151L15.2114 21.5151ZM15.2114 21.5151L15.2114 21.5151L15.8825 22.2151C16.2691 21.8445 16.282 21.2307 15.9114 20.8441L15.2114 21.5151ZM10.6846 16.7933L15.2114 21.5151L15.9114 20.8441L11.3846 16.1222L10.6846 16.7933ZM15.2114 11.4004L10.6846 16.1222L11.3846 16.7933L15.9114 12.0715L15.2114 11.4004ZM21.5152 16.4581L21.5152 17.4278C22.0507 17.4278 22.4848 16.9937 22.4848 16.4581L21.5152 16.4581ZM21.5152 16.4581L22.4848 16.4581C22.4848 15.9226 22.0507 15.4884 21.5152 15.4884L21.5152 16.4581ZM11.8182 16.4581L21.5152 16.4581L21.5152 15.4884L11.8182 15.4884L11.8182 16.4581ZM11.8182 16.4581L11.8182 16.4581L11.8182 15.4884C11.2826 15.4884 10.8485 15.9226 10.8485 16.4581L11.8182 16.4581ZM11.8182 16.4581L11.8182 16.4581L10.8485 16.4581C10.8485 16.9937 11.2826 17.4278 11.8182 17.4278L11.8182 16.4581ZM21.5152 16.4581L11.8182 16.4581L11.8182 17.4278L21.5152 17.4278L21.5152 16.4581Z"
583
- fill="#4250F0"
584
- />
585
- </svg>
586
- <div
587
- class="${styles.flowNameCompact}"
588
- style="${genericData.viewStyle !== ViewStyles.COMPACT
589
- ? 'justify-content: flex-start;'
590
- : ''}"
591
- >
592
- <img
593
- class=${styles.flowNameCompactImg}
594
- src=${appData?.icon_url}
595
- alt=${appData?.name}
596
- />
597
- <span>${selectedFlow?.flow.name}</span>
598
- ${selectedFlow?.flow?.version_number &&
599
- html`<span class=${styles.flowVersion}
600
- >v${selectedFlow?.flow?.version_number}</span
601
- >`}
602
- </div>
603
- </div>
604
- `}
605
- ${selectedFlow === null &&
606
- html`${keepBackButtonForFlows &&
607
- props.onBackClick &&
608
- selectedFlow === null &&
609
- html`
610
- <svg
611
- style="cursor: pointer;"
612
- onclick=${props.onBackClick}
613
- xmlns="http://www.w3.org/2000/svg"
614
- width="32"
615
- height="32"
616
- viewBox="0 0 32 32"
617
- fill="none"
618
- >
619
- <circle
620
- cx="16"
621
- cy="16"
622
- r="15.5"
623
- fill="white"
624
- stroke="#E0E0E0"
625
- />
626
- <path
627
- d="M15.5477 11.0504L15.8832 10.7004L15.8832 10.7004L15.5477 11.0504ZM15.5622 11.7359L15.2122 11.4004L15.2122 11.4004L15.5622 11.7359ZM14.8622 11.0649L15.2122 11.4004L15.2122 11.4004L14.8622 11.0649ZM10.0137 16.1222L9.66371 15.7867L9.66371 15.7867L10.0137 16.1222ZM9.69202 16.4578L9.34203 16.1222L9.02036 16.4578L9.34203 16.7933L9.69202 16.4578ZM10.0137 16.7933L9.66371 17.1288L10.0137 16.7933ZM14.8622 21.8507L15.2122 21.5151L15.2122 21.5151L14.8622 21.8507ZM15.5477 21.8651L15.8832 22.2151L15.8832 22.2151L15.5477 21.8651ZM15.5622 21.1796L15.9122 20.8441L15.9122 20.8441L15.5622 21.1796ZM11.0354 16.4578L10.6854 16.1222L10.3637 16.4578L10.6854 16.7933L11.0354 16.4578ZM15.2122 11.4004L15.2122 11.4004L15.9122 12.0715C16.2828 11.6849 16.2698 11.071 15.8832 10.7004L15.2122 11.4004ZM15.2122 11.4004L15.2122 11.4004L15.8832 10.7004C15.4967 10.3298 14.8828 10.3427 14.5122 10.7293L15.2122 11.4004ZM10.3637 16.4578L15.2122 11.4004L14.5122 10.7293L9.66371 15.7867L10.3637 16.4578ZM10.042 16.7933L10.3637 16.4578L9.66371 15.7867L9.34203 16.1222L10.042 16.7933ZM10.3637 16.4578L10.042 16.1222L9.34203 16.7933L9.66371 17.1288L10.3637 16.4578ZM15.2122 21.5151L10.3637 16.4578L9.66371 17.1288L14.5122 22.1862L15.2122 21.5151ZM15.2122 21.5151L15.2122 21.5151L14.5122 22.1862C14.8828 22.5728 15.4967 22.5858 15.8832 22.2151L15.2122 21.5151ZM15.2122 21.5151L15.2122 21.5151L15.8832 22.2151C16.2698 21.8445 16.2828 21.2307 15.9122 20.8441L15.2122 21.5151ZM10.6854 16.7933L15.2122 21.5151L15.9122 20.8441L11.3853 16.1222L10.6854 16.7933ZM15.2122 11.4004L10.6854 16.1222L11.3853 16.7933L15.9122 12.0715L15.2122 11.4004ZM21.5152 16.4578L21.5152 16.4578L21.5152 17.4275C22.0507 17.4275 22.4848 16.9933 22.4848 16.4578L21.5152 16.4578ZM21.5152 16.4578L21.5152 16.4578L22.4848 16.4578C22.4848 15.9222 22.0507 15.4881 21.5152 15.4881L21.5152 16.4578ZM11.8182 16.4578L21.5152 16.4578L21.5152 15.4881L11.8182 15.4881L11.8182 16.4578ZM11.8182 16.4578L11.8182 15.4881C11.2826 15.4881 10.8485 15.9222 10.8485 16.4578L11.8182 16.4578ZM11.8182 16.4578L10.8485 16.4578C10.8485 16.9933 11.2826 17.4275 11.8182 17.4275L11.8182 16.4578ZM21.5152 16.4578L11.8182 16.4578L11.8182 17.4275L21.5152 17.4275L21.5152 16.4578Z"
628
- fill="#4250F0"
629
- />
630
- </svg>
631
- `}
632
- <img src=${appData?.icon_url} alt=${appData?.name} />
633
- <div class="${styles.appName}">${appData?.name}</div>`}
634
- </div>
635
- <div class=${styles.flowAccountWrap}>
636
- ${props.stepState.currentStep?.type === 'CONFIGURATION' &&
637
- getSelectedStep().selectedStep?.step.authorization_type.app
638
- .id !== props.genericData.selfAppId &&
639
- getSelectedStep().selectedStep?.step.authorization_type.type !==
640
- 'NO_AUTH' &&
641
- html` <${Authentication}
642
- authorizations=${getStepAuthorizations(
643
- props.stepMapping[props.stepState.currentStep.stepId]
644
- ?.authorizations || [],
645
- )}
646
- appData=${getSelectedStepApp(
647
- getSelectedStep().selectedStep?.step,
648
- )}
649
- onAuthDelete=${(authId: number, appId: number) => {
650
- deleteAuth(
651
- authId,
652
- Number(getSelectedStep().selectedStep?.step.id),
653
- appId,
654
- );
655
- }}
656
- onAuthenticationRecieved=${(
657
- messageEvent: MessageEvent<AuthData>,
658
- ) => {
659
- onAuthResponseReceived(
660
- messageEvent,
661
- Number(getSelectedStep().selectedStep?.step.id),
662
- );
663
- handleAuthSelected(
664
- messageEvent.data.authorization_id,
665
- Number(getSelectedStep().selectedStep?.step.id),
666
- true,
667
- false,
668
- );
669
- }}
670
- onAuthVerify=${(authId: number, status: boolean) => {
671
- handleAuthSelected(
672
- authId,
673
- Number(getSelectedStep().selectedStep?.step.id),
674
- status,
675
- false,
676
- );
677
- }}
678
- hideAuthActions=${true}
679
- onAuthSelected=${(authId: number, status: boolean) => {
680
- handleAuthSelected(
681
- authId,
682
- Number(getSelectedStep().selectedStep?.step.id),
683
- status,
684
- false,
685
- );
686
- }}
687
- stepId=${Number(getSelectedStep().selectedStep?.step.id)}
688
- initialAuthVerification=${true}
689
- />`}
690
- </div>
691
- ${selectedFlow === null &&
692
- appData?.authorization_type.type !== 'NO_AUTH' &&
693
- html` <${Authentication}
694
- authorizations=${appData?.authorization_type.authorizations ||
695
- []}
696
- flows=${appFlows}
697
- appData=${appData}
698
- onAuthDelete=${(authId: number, appId: number) => {
699
- setAccountVerified(false);
700
- if (app_id) {
701
- context?.apiHandler.getAppInfo(app_id).then((data) => {
702
- if (data) {
703
- setAppData(data);
704
- if (data.authorization_type) {
705
- const {
706
- authorizations = [],
707
- } = data.authorization_type;
708
- setSkipAuth(authorizations.length > 0);
709
- }
710
- } else {
711
- console.error(`Failed to fetch app details`);
712
- }
713
- });
714
- }
715
- getAppFlows();
716
- setSelectedFlow(null);
717
- emitDeleteAuthEvent(authId, appId);
718
- }}
719
- onAuthenticationRecieved=${(
720
- messageEvent: MessageEvent<AuthData>,
721
- ) => {
722
- setAccountVerified(false);
723
- if (app_id) {
724
- context?.apiHandler.getAppInfo(app_id).then((data) => {
725
- if (data) {
726
- setAppData(data);
727
- if (data.authorization_type) {
728
- const {
729
- authorizations = [],
730
- } = data.authorization_type;
731
- setSkipAuth(authorizations.length > 0);
732
- }
733
- getAppFlows(messageEvent.data.authorization_id);
734
- } else {
735
- console.error(`Failed to fetch app details`);
736
- }
737
- });
738
- } else {
739
- getAppFlows();
740
- }
741
- emitAddAuthEvent(messageEvent);
742
- }}
743
- onAuthVerify=${(authId: number, staus: boolean) => {
744
- setAccountVerified(staus);
745
- }}
746
- hideAuthActions=${selectedFlow !== null}
747
- onAuthSelected=${(authId: number, status: boolean) => {
748
- handleAuthSelected(
749
- authId,
750
- Number(getSelectedStep().selectedStep?.step.id),
751
- status,
752
- false,
753
- );
754
- }}
755
- stepId=${Number(getSelectedStep().selectedStep?.step.id)}
756
- initialAuthVerification=${true}
757
- />`}`}
758
- ${!props.genericData.testMultipurpose &&
759
- html` <div class=${styles.appInfo}>
760
- ${keepBackButtonForFlows &&
761
- props.onBackClick &&
762
- selectedFlow === null &&
763
- html`
764
- <svg
765
- style="cursor: pointer;"
766
- onclick=${props.onBackClick}
767
- xmlns="http://www.w3.org/2000/svg"
768
- width="32"
769
- height="32"
770
- viewBox="0 0 32 32"
771
- fill="none"
772
- >
773
- <circle
774
- cx="16"
775
- cy="16"
776
- r="15.5"
777
- fill="white"
778
- stroke="#E0E0E0"
779
- />
780
- <path
781
- d="M15.5477 11.0504L15.8832 10.7004L15.8832 10.7004L15.5477 11.0504ZM15.5622 11.7359L15.2122 11.4004L15.2122 11.4004L15.5622 11.7359ZM14.8622 11.0649L15.2122 11.4004L15.2122 11.4004L14.8622 11.0649ZM10.0137 16.1222L9.66371 15.7867L9.66371 15.7867L10.0137 16.1222ZM9.69202 16.4578L9.34203 16.1222L9.02036 16.4578L9.34203 16.7933L9.69202 16.4578ZM10.0137 16.7933L9.66371 17.1288L10.0137 16.7933ZM14.8622 21.8507L15.2122 21.5151L15.2122 21.5151L14.8622 21.8507ZM15.5477 21.8651L15.8832 22.2151L15.8832 22.2151L15.5477 21.8651ZM15.5622 21.1796L15.9122 20.8441L15.9122 20.8441L15.5622 21.1796ZM11.0354 16.4578L10.6854 16.1222L10.3637 16.4578L10.6854 16.7933L11.0354 16.4578ZM15.2122 11.4004L15.2122 11.4004L15.9122 12.0715C16.2828 11.6849 16.2698 11.071 15.8832 10.7004L15.2122 11.4004ZM15.2122 11.4004L15.2122 11.4004L15.8832 10.7004C15.4967 10.3298 14.8828 10.3427 14.5122 10.7293L15.2122 11.4004ZM10.3637 16.4578L15.2122 11.4004L14.5122 10.7293L9.66371 15.7867L10.3637 16.4578ZM10.042 16.7933L10.3637 16.4578L9.66371 15.7867L9.34203 16.1222L10.042 16.7933ZM10.3637 16.4578L10.042 16.1222L9.34203 16.7933L9.66371 17.1288L10.3637 16.4578ZM15.2122 21.5151L10.3637 16.4578L9.66371 17.1288L14.5122 22.1862L15.2122 21.5151ZM15.2122 21.5151L15.2122 21.5151L14.5122 22.1862C14.8828 22.5728 15.4967 22.5858 15.8832 22.2151L15.2122 21.5151ZM15.2122 21.5151L15.2122 21.5151L15.8832 22.2151C16.2698 21.8445 16.2828 21.2307 15.9122 20.8441L15.2122 21.5151ZM10.6854 16.7933L15.2122 21.5151L15.9122 20.8441L11.3853 16.1222L10.6854 16.7933ZM15.2122 11.4004L10.6854 16.1222L11.3853 16.7933L15.9122 12.0715L15.2122 11.4004ZM21.5152 16.4578L21.5152 16.4578L21.5152 17.4275C22.0507 17.4275 22.4848 16.9933 22.4848 16.4578L21.5152 16.4578ZM21.5152 16.4578L21.5152 16.4578L22.4848 16.4578C22.4848 15.9222 22.0507 15.4881 21.5152 15.4881L21.5152 16.4578ZM11.8182 16.4578L21.5152 16.4578L21.5152 15.4881L11.8182 15.4881L11.8182 16.4578ZM11.8182 16.4578L11.8182 15.4881C11.2826 15.4881 10.8485 15.9222 10.8485 16.4578L11.8182 16.4578ZM11.8182 16.4578L10.8485 16.4578C10.8485 16.9933 11.2826 17.4275 11.8182 17.4275L11.8182 16.4578ZM21.5152 16.4578L11.8182 16.4578L11.8182 17.4275L21.5152 17.4275L21.5152 16.4578Z"
782
- fill="#4250F0"
783
- />
784
- </svg>
785
- `}
786
- <img src=${appData?.icon_url} alt=${appData?.name} />
787
- <div class="${styles.appName}">${appData?.name}</div>
788
- </div>
789
- <${Authentication}
790
- authorizations=${appData?.authorization_type.authorizations ||
791
- []}
792
- flows=${appFlows}
793
- appData=${appData}
794
- onAuthDelete=${(authId: number, appId: number) => {
795
- setAccountVerified(false);
796
- if (app_id) {
797
- context?.apiHandler.getAppInfo(app_id).then((data) => {
798
- if (data) {
799
- setAppData(data);
800
- if (data.authorization_type) {
801
- const {
802
- authorizations = [],
803
- } = data.authorization_type;
804
- setSkipAuth(authorizations.length > 0);
805
- }
806
- } else {
807
- console.error(`Failed to fetch app details`);
808
- }
809
- });
810
- }
811
- getAppFlows();
812
- setSelectedFlow(null);
813
- emitDeleteAuthEvent(authId, appId);
814
- }}
815
- onAuthenticationRecieved=${(
816
- messageEvent: MessageEvent<AuthData>,
817
- ) => {
818
- setAccountVerified(false);
819
- if (app_id) {
820
- context?.apiHandler.getAppInfo(app_id).then((data) => {
821
- if (data) {
822
- setAppData(data);
823
- if (data.authorization_type) {
824
- const {
825
- authorizations = [],
826
- } = data.authorization_type;
827
- setSkipAuth(authorizations.length > 0);
828
- }
829
- getAppFlows(messageEvent.data.authorization_id);
830
- } else {
831
- console.error(`Failed to fetch app details`);
832
- }
833
- });
834
- } else {
835
- getAppFlows();
836
- }
837
- emitAddAuthEvent(messageEvent);
838
- }}
839
- onAuthVerify=${(authId: number, staus: boolean) => {
840
- setAccountVerified(staus);
841
- }}
842
- hideAuthActions=${selectedFlow !== null}
843
- onAuthSelected=${(authId: number, status: boolean) => {
844
- handleAuthSelected(
845
- authId,
846
- Number(getSelectedStep().selectedStep?.step.id),
847
- status,
848
- false,
849
- );
850
- }}
851
- stepId=${Number(getSelectedStep().selectedStep?.step.id)}
852
- />`}
853
- </div>
854
-
855
- <div
856
- class="${renderMode === MarketplaceRenderModes.MODAL
857
- ? genericData.viewStyle === ViewStyles.COMPACT && isInModal
858
- ? styles.modalContentWrapCompact
859
- : styles.modalContentWrap
860
- : styles.inlineContentWrap} ${'integry-apps-flow-container'}"
861
- style="${renderFlowSetupMode === MarketplaceRenderModes.MODAL &&
862
- selectedFlow !== null
863
- ? 'overflow: hidden;'
864
- : ''}"
865
- >
866
- ${(selectedFlow === null ||
867
- renderFlowSetupMode === MarketplaceRenderModes.MODAL) &&
868
- html` ${isReloadingFlowListing &&
869
- !isLoading &&
870
- html`<div
871
- class="${genericData.viewStyle === ViewStyles.COMPACT
872
- ? styles['compact-view']
873
- : ''}"
874
- >
875
- <${AppPageLoader} renderMode=${renderMode} />
876
- </div>`}
877
- <${AppFlowListing}
878
- marketplaceId=${marketplaceId}
879
- onFlowSelect=${onFlowSelect}
880
- updateInstanceName=${updateInstanceName}
881
- appData=${appData}
882
- appFlows=${appFlows}
883
- accountVerified=${appData?.authorization_type.type === 'NO_AUTH'
884
- ? true
885
- : accountVerified}
886
- renderMode=${renderMode}
887
- onDeleteInstance=${(instance: Integration) => {
888
- handleDeleteInstance(instance);
889
- }}
890
- />`}
891
- ${selectedFlow &&
892
- (renderFlowSetupMode === MarketplaceRenderModes.INLINE
893
- ? html`
894
- <div class="${styles.appFlowSetupForm}">
895
- ${
896
- !props.genericData.testMultipurpose &&
897
- html` <div class="${styles.flowSetupHeader}">
898
- <div class="${styles.backLink}" onclick=${handleGoBackToApps}>
899
- <svg
900
- width="24"
901
- height="24"
902
- viewBox="0 0 33 33"
903
- fill="none"
904
- xmlns="http://www.w3.org/2000/svg"
905
- >
906
- <circle
907
- cx="16.6758"
908
- cy="16.5684"
909
- r="15.5"
910
- fill="white"
911
- stroke="#4250f0"
912
- />
913
- <path
914
- d="M16.8975 11.3777L16.5547 11.7205L16.5547 11.7205L16.8975 11.3777ZM16.8975 12.0634L16.5547 11.7205L16.5547 11.7205L16.8975 12.0634ZM16.2119 11.3777L16.5547 11.7205L16.2119 11.3777ZM11.3634 16.2262L11.0205 15.8833L11.0205 15.8833L11.3634 16.2262ZM11.0205 16.569L10.6777
915
- 16.2262L10.3349 16.569L10.6777 16.9118L11.0205 16.569ZM11.3634 16.9118L11.0205 17.2547L11.0205 17.2547L11.3634 16.9118ZM16.2119 21.7603L16.5547 21.4175L16.5547 21.4175L16.2119 21.7603ZM16.8975 21.7603L16.5547 21.4175L16.5547 21.4175L16.8975 21.7603ZM16.8975 21.0747L16.5547 21.4175L16.5547 21.4175L16.8975 21.0747ZM12.3919 16.569L12.0491 16.2262L11.7062 16.569L12.0491 16.9118L12.3919 16.569ZM22.8574 17.0545L22.8574 17.5394L22.8574 17.0545ZM22.8574 16.0848L22.8574 16.5697L22.8574
916
- 16.0848ZM13.1605 16.0848L13.1605 15.6L13.1605 16.0848ZM13.1605 17.0545L13.1605 16.5697L13.1605 17.0545ZM16.5547 11.7205L16.5547 11.7205L17.2404 12.4062C17.6191 12.0275 17.6191 11.4135 17.2404 11.0348L16.5547 11.7205ZM16.5547 11.7205L17.2404 11.0348C16.8617 10.6562 16.2477 10.6562 15.869 11.0348L16.5547 11.7205ZM11.7062 16.569L16.5547 11.7205L15.869 11.0348L11.0205 15.8833L11.7062 16.569ZM11.3634 16.9118L11.7062 16.569L11.0205 15.8833L10.6777 16.2262L11.3634 16.9118ZM11.7062 16.569L11.3634 16.2262L10.6777
917
- 16.9118L11.0205 17.2547L11.7062 16.569ZM16.5547 21.4175L11.7062 16.569L11.0205 17.2547L15.869 22.1032L16.5547 21.4175ZM16.5547 21.4175L15.869 22.1032C16.2477 22.4819 16.8617 22.4819 17.2404 22.1032L16.5547 21.4175ZM16.5547 21.4175L16.5547
918
- 21.4175L17.2404 22.1032C17.6191 21.7245 17.6191 21.1105 17.2404 20.7318L16.5547 21.4175ZM12.0491 16.9118L16.5547 21.4175L17.2404 20.7318L12.7347 16.2262L12.0491 16.9118ZM16.5547 11.7205L12.0491 16.2262L12.7347 16.9118L17.2404 12.4062L16.5547 11.7205ZM22.8574 16.5697L22.8574 16.5697L22.8574 17.5394C23.393 17.5394 23.8271 17.1052 23.8271 16.5697L22.8574 16.5697ZM22.8574 16.5697L22.8574 16.5697L23.8271 16.5697C23.8271 16.0341 23.393 15.6 22.8574 15.6L22.8574
919
- 16.5697ZM13.1605 16.5697L22.8574 16.5697L22.8574 15.6L13.1605 15.6L13.1605 16.5697ZM13.1605 16.5697L13.1605 15.6C12.6249 15.6 12.1908 16.0341 12.1908 16.5697L13.1605 16.5697ZM13.1605 16.5697L12.1908 16.5697C12.1908 17.1052 12.6249 17.5394 13.1605 17.5394L13.1605 16.5697ZM22.8574 16.5697L13.1605 16.5697L13.1605 17.5394L22.8574 17.5394L22.8574 16.5697Z"
920
- fill="#4250f0"
921
- />
922
- </svg>
923
- </div>
924
- <div class="${styles.flowName}">${genericData.name}</div>
925
- </div>`
926
- }
927
- <div id="${
928
- renderMode === MarketplaceRenderModes.MODAL
929
- ? 'flowSetupWrapperModal'
930
- : 'flowSetupWrapper'
931
- }" class="${
932
- renderMode === MarketplaceRenderModes.MODAL
933
- ? styles.flowSetupWrapperModal
934
- : styles.flowSetupWrapper
935
- } ${
936
- genericData.viewStyle === ViewStyles.COMPACT &&
937
- styles.flowSetupWrapperModalCompact
938
- }">
939
- <${FlowSetupContainer}
940
- deploymentId=${
941
- genericData.deploymentId || appData?.default_bundle_id
942
- }
943
- flowId=${selectedFlow?.flow.id}
944
- key=${`flow-setup-${selectedFlow?.flow.id}-${selectedFlow?.instance?.id}`}
945
- integrationId=${selectedFlow?.instance?.id || null}
946
- hideStepNavigation=${true}
947
- setupContainerClassName=${
948
- renderMode === MarketplaceRenderModes.MODAL
949
- ? styles.setupContainer
950
- : ''
951
- }
952
- stepsClassName=${
953
- renderMode === MarketplaceRenderModes.MODAL
954
- ? { bottom: styles.stepsBottom }
955
- : null
956
- }
957
- onUpdate=${handleGoBackToAppsCloseModal}
958
- onFlowExecute=${getAppFlows}
959
- onBackClick=${() => {
960
- setSelectedFlow(null);
961
- }}
962
- skipAuth=${skipAuth}
963
- hideStepCount=${true}
964
- isInModal=${renderMode === MarketplaceRenderModes.MODAL}
965
-
966
- ></${FlowSetupContainer}>
967
- </div>
968
- </div>
969
- `
970
- : html`
971
- <${Modal}
972
- isOpen=${props.showSetupModal}
973
- onClose=${handleGoBackToAppsCloseModal}
974
- className="flowAppsModal"
975
- isCompact=${genericData.viewStyle === ViewStyles.COMPACT}
976
- >
977
- <div class="${styles.appFlowSetupForm}">
978
- ${html` <div class="${styles.flowSetupHeader}">
979
- <div
980
- class="${styles.backLink}"
981
- onclick=${handleGoBackToApps}
982
- >
983
- <svg
984
- width="24"
985
- height="24"
986
- viewBox="0 0 33 33"
987
- fill="none"
988
- xmlns="http://www.w3.org/2000/svg"
989
- >
990
- <circle
991
- cx="16.6758"
992
- cy="16.5684"
993
- r="15.5"
994
- fill="white"
995
- stroke="#4250f0"
996
- />
997
- <path
998
- d="M16.8975 11.3777L16.5547 11.7205L16.5547 11.7205L16.8975 11.3777ZM16.8975 12.0634L16.5547 11.7205L16.5547 11.7205L16.8975 12.0634ZM16.2119 11.3777L16.5547 11.7205L16.2119 11.3777ZM11.3634 16.2262L11.0205 15.8833L11.0205 15.8833L11.3634 16.2262ZM11.0205 16.569L10.6777
999
- 16.2262L10.3349 16.569L10.6777 16.9118L11.0205 16.569ZM11.3634 16.9118L11.0205 17.2547L11.0205 17.2547L11.3634 16.9118ZM16.2119 21.7603L16.5547 21.4175L16.5547 21.4175L16.2119 21.7603ZM16.8975 21.7603L16.5547 21.4175L16.5547 21.4175L16.8975 21.7603ZM16.8975 21.0747L16.5547 21.4175L16.5547 21.4175L16.8975 21.0747ZM12.3919 16.569L12.0491 16.2262L11.7062 16.569L12.0491 16.9118L12.3919 16.569ZM22.8574 17.0545L22.8574 17.5394L22.8574 17.0545ZM22.8574 16.0848L22.8574 16.5697L22.8574
1000
- 16.0848ZM13.1605 16.0848L13.1605 15.6L13.1605 16.0848ZM13.1605 17.0545L13.1605 16.5697L13.1605 17.0545ZM16.5547 11.7205L16.5547 11.7205L17.2404 12.4062C17.6191 12.0275 17.6191 11.4135 17.2404 11.0348L16.5547 11.7205ZM16.5547 11.7205L17.2404 11.0348C16.8617 10.6562 16.2477 10.6562 15.869 11.0348L16.5547 11.7205ZM11.7062 16.569L16.5547 11.7205L15.869 11.0348L11.0205 15.8833L11.7062 16.569ZM11.3634 16.9118L11.7062 16.569L11.0205 15.8833L10.6777 16.2262L11.3634 16.9118ZM11.7062 16.569L11.3634 16.2262L10.6777
1001
- 16.9118L11.0205 17.2547L11.7062 16.569ZM16.5547 21.4175L11.7062 16.569L11.0205 17.2547L15.869 22.1032L16.5547 21.4175ZM16.5547 21.4175L15.869 22.1032C16.2477 22.4819 16.8617 22.4819 17.2404 22.1032L16.5547 21.4175ZM16.5547 21.4175L16.5547
1002
- 21.4175L17.2404 22.1032C17.6191 21.7245 17.6191 21.1105 17.2404 20.7318L16.5547 21.4175ZM12.0491 16.9118L16.5547 21.4175L17.2404 20.7318L12.7347 16.2262L12.0491 16.9118ZM16.5547 11.7205L12.0491 16.2262L12.7347 16.9118L17.2404 12.4062L16.5547 11.7205ZM22.8574 16.5697L22.8574 16.5697L22.8574 17.5394C23.393 17.5394 23.8271 17.1052 23.8271 16.5697L22.8574 16.5697ZM22.8574 16.5697L22.8574 16.5697L23.8271 16.5697C23.8271 16.0341 23.393 15.6 22.8574 15.6L22.8574
1003
- 16.5697ZM13.1605 16.5697L22.8574 16.5697L22.8574 15.6L13.1605 15.6L13.1605 16.5697ZM13.1605 16.5697L13.1605 15.6C12.6249 15.6 12.1908 16.0341 12.1908 16.5697L13.1605 16.5697ZM13.1605 16.5697L12.1908 16.5697C12.1908 17.1052 12.6249 17.5394 13.1605 17.5394L13.1605 16.5697ZM22.8574 16.5697L13.1605 16.5697L13.1605 17.5394L22.8574 17.5394L22.8574 16.5697Z"
1004
- fill="#4250f0"
1005
- />
1006
- </svg>
1007
- </div>
1008
- <div
1009
- class="${styles.flowName}"
1010
- style="${genericData.viewStyle === ViewStyles.COMPACT &&
1011
- renderFlowSetupMode === MarketplaceRenderModes.MODAL
1012
- ? 'width: 75%; text-align: center;'
1013
- : ''}"
1014
- >
1015
- ${genericData.name}
1016
- </div>
1017
- </div>`}
1018
- ${props.genericData.testMultipurpose && html``}
1019
-
1020
- <div id="flowSetupWrapperModal" class=${
1021
- styles.flowSetupWrapperModal
1022
- }>
1023
- <${FlowSetupContainer}
1024
- deploymentId=${
1025
- genericData.deploymentId || appData?.default_bundle_id
1026
- }
1027
- flowId=${selectedFlow?.flow.id}
1028
- key=${`flow-setup-${selectedFlow?.flow.id}-${selectedFlow?.instance?.id}`}
1029
- integrationId=${selectedFlow?.instance?.id || null}
1030
- hideStepNavigation=${true}
1031
- setupContainerClassName=${
1032
- renderMode === MarketplaceRenderModes.MODAL
1033
- ? styles.setupContainer
1034
- : renderFlowSetupMode === MarketplaceRenderModes.MODAL
1035
- ? styles.setupContainerModal
1036
- : ''
1037
- }
1038
- stepsClassName=${
1039
- renderMode === MarketplaceRenderModes.MODAL
1040
- ? { bottom: styles.stepsBottom }
1041
- : null
1042
- }
1043
- onUpdate=${handleGoBackToAppsCloseModal}
1044
- onFlowExecute=${getAppFlows}
1045
- onBackClick=${() => {
1046
- setSelectedFlow(null);
1047
- }}
1048
- skipAuth=${skipAuth}
1049
- hideStepCount=${true}
1050
- isInModal=${
1051
- renderMode === MarketplaceRenderModes.MODAL ||
1052
- renderFlowSetupMode === MarketplaceRenderModes.MODAL
1053
- }
1054
- ></${FlowSetupContainer}>
1055
- </div>
1056
- </div>
1057
- <//>
1058
- `)}
1059
- </div>
1060
- ${((renderMode === MarketplaceRenderModes.INLINE &&
1061
- renderFlowSetupMode !== MarketplaceRenderModes.INLINE) ||
1062
- !selectedFlow) &&
1063
- html`<${Footer}
1064
- style="${renderMode === MarketplaceRenderModes.MODAL
1065
- ? 'padding-top: 10px;'
1066
- : ''}"
1067
- />`}
1068
- </div>
1069
- `;
1070
- };
1071
-
1072
- export default connect<WraperrProps, unknown, StoreType, unknown>(
1073
- [
1074
- 'userConfig',
1075
- 'genericData',
1076
- 'showMarketplaceModal',
1077
- 'showMarketplaceAppPageId',
1078
- 'showSetupModal',
1079
- 'IUAccountsData',
1080
- 'incomingWebhookPayload',
1081
- 'stepState',
1082
- 'stepMapping',
1083
- ],
1084
- actionFunctions,
1085
- )(RenderAppPage);