@integry/sdk 4.5.2 → 4.5.3

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 (279) hide show
  1. package/.vscode/launch.json +2 -2
  2. package/THIRD_PARTY_LICENSES +0 -37
  3. package/dist/esm/index.csm.d.ts +12 -2
  4. package/dist/esm/index.csm.js +7262 -1
  5. package/dist/umd/index.umd.d.ts +9 -1
  6. package/dist/umd/index.umd.js +7262 -1
  7. package/jest.config.cjs +10 -0
  8. package/package.json +10 -4
  9. package/src/components/AddTagButton/index.ts +23 -0
  10. package/src/components/BasicSelect/index.ts +114 -0
  11. package/src/components/BasicSelect/styles.module.scss +44 -0
  12. package/src/components/Button/index.ts +94 -0
  13. package/src/components/Button/styles.module.scss +152 -0
  14. package/src/components/CheckboxGroup/Checkbox.ts +104 -0
  15. package/src/components/CheckboxGroup/index.ts +190 -0
  16. package/src/components/CheckboxGroup/styles.module.scss +63 -0
  17. package/src/components/CollapsedMenu/index.ts +101 -0
  18. package/src/components/CollapsedMenu/styles.module.scss +46 -0
  19. package/src/components/ConfigureFieldWrapper/index.ts +85 -0
  20. package/src/components/ConfigureFieldWrapper/styles.module.scss +57 -0
  21. package/src/components/EditableText/index.ts +121 -0
  22. package/src/components/EditableText/styles.module.scss +38 -0
  23. package/src/components/EditableTextArea/index.ts +143 -0
  24. package/src/components/EditableTextArea/styles.module.scss +91 -0
  25. package/src/components/ErrorMessage/index.ts +16 -0
  26. package/src/components/ErrorMessage/styles.module.scss +19 -0
  27. package/src/components/ErrorPage/index.ts +42 -0
  28. package/src/components/ErrorPage/styles.module.scss +26 -0
  29. package/src/components/Footer/index.ts +41 -0
  30. package/src/components/Footer/styles.module.scss +40 -0
  31. package/src/components/HTMLContent/index.tsx +275 -0
  32. package/src/components/HTMLContent/styles.module.scss +3 -0
  33. package/src/components/InfoBox/index.ts +48 -0
  34. package/src/components/InfoBox/styles.module.scss +21 -0
  35. package/src/components/Input/BaseInput/index.ts +170 -0
  36. package/src/components/Input/BaseInput/styles.module.scss +94 -0
  37. package/src/components/Input/DateInput/index.ts +103 -0
  38. package/src/components/Input/DateInput/styles.module.scss +50 -0
  39. package/src/components/Input/Input/index.ts +206 -0
  40. package/src/components/Input/Input/styles.module.scss +14 -0
  41. package/src/components/Input/PasswordInput/index.ts +164 -0
  42. package/src/components/Input/PasswordInput/styles.module.scss +37 -0
  43. package/src/components/Input/index.ts +7 -0
  44. package/src/components/Label/index.ts +61 -0
  45. package/src/components/Label/styles.module.scss +41 -0
  46. package/src/components/LargeLoader/index.ts +25 -0
  47. package/src/components/LargeLoader/styles.module.scss +16 -0
  48. package/src/components/Listbox/ListBoxItem.ts +57 -0
  49. package/src/components/Listbox/index.ts +479 -0
  50. package/src/components/Listbox/styles.module.scss +197 -0
  51. package/src/components/Loader/index.ts +25 -0
  52. package/src/components/Loader/styles.module.scss +16 -0
  53. package/src/components/MediaGallery/MediaGalleryModal.ts +82 -0
  54. package/src/components/MediaGallery/MediaSlider.ts +76 -0
  55. package/src/components/MediaGallery/index.ts +92 -0
  56. package/src/components/MediaGallery/styles.module.scss +156 -0
  57. package/src/components/MediaUpload/index.ts +233 -0
  58. package/src/components/MediaUpload/styles.module.scss +118 -0
  59. package/src/components/Modal/index.ts +87 -0
  60. package/src/components/Modal/styles.module.scss +441 -0
  61. package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +58 -0
  62. package/src/components/MultipurposeField/Dropdown/index.tsx +981 -0
  63. package/src/components/MultipurposeField/Dropdown/styles.module.scss +208 -0
  64. package/src/components/MultipurposeField/TagMenu/index.ts +384 -0
  65. package/src/components/MultipurposeField/TagMenu/styles.module.scss +136 -0
  66. package/src/components/MultipurposeField/TagOptions/index.tsx +83 -0
  67. package/src/components/MultipurposeField/TagOptions/styles.module.scss +95 -0
  68. package/src/components/MultipurposeField/index.tsx +687 -0
  69. package/src/components/MultipurposeField/styles.module.scss +56 -0
  70. package/src/components/NewModal/index.ts +69 -0
  71. package/src/components/NewModal/styles.module.scss +70 -0
  72. package/src/components/OverflowTooltip/index.tsx +59 -0
  73. package/src/components/PopUp/ConfirmationPopUp/index.ts +58 -0
  74. package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +49 -0
  75. package/src/components/PopUp/SuccessPopUp/index.ts +62 -0
  76. package/src/components/PopUp/SuccessPopUp/styles.module.scss +38 -0
  77. package/src/components/RadioGroup/Radio.ts +129 -0
  78. package/src/components/RadioGroup/index.ts +169 -0
  79. package/src/components/RadioGroup/styles.module.scss +81 -0
  80. package/src/components/Search/index.ts +69 -0
  81. package/src/components/Search/styles.module.scss +149 -0
  82. package/src/components/TabBar/Tab.ts +33 -0
  83. package/src/components/TabBar/index.ts +64 -0
  84. package/src/components/TabBar/styles.module.scss +43 -0
  85. package/src/components/Tag/index.ts +29 -0
  86. package/src/components/Tag/styles.module.scss +57 -0
  87. package/src/components/TextArea/index.ts +172 -0
  88. package/src/components/TextArea/styles.module.scss +70 -0
  89. package/src/components/TextContent/index.tsx +128 -0
  90. package/src/components/TextContent/styles.module.scss +6 -0
  91. package/src/components/ThreeDotLoader/index.ts +39 -0
  92. package/src/components/ThreeDotLoader/styles.module.scss +41 -0
  93. package/src/components/TimeInput/index.ts +129 -0
  94. package/src/components/TimeInput/styles.module.scss +16 -0
  95. package/src/components/Toggle/index.ts +34 -0
  96. package/src/components/Toggle/styles.module.scss +56 -0
  97. package/src/components/Toggle-v2/index.ts +40 -0
  98. package/src/components/Toggle-v2/styles.module.scss +86 -0
  99. package/src/components/Tooltip/index.ts +271 -0
  100. package/src/components/Tooltip/styles.module.scss +105 -0
  101. package/src/components/form/ObjectField/index.ts +364 -0
  102. package/src/components/form/ObjectField/styles.module.scss +103 -0
  103. package/src/components/form/index.ts +3 -0
  104. package/src/contexts/AppContext.ts +12 -0
  105. package/src/declaration.d.ts +7 -0
  106. package/src/extensions/HMAC.ts +25 -0
  107. package/src/extensions/IntegryAPIError.ts +19 -0
  108. package/src/features/common/AccountDropdown/index.ts +291 -0
  109. package/src/features/common/AccountDropdown/styles.module.scss +19 -0
  110. package/src/features/common/ActionForm/index.ts +1790 -0
  111. package/src/features/common/ActionForm/styles.module.scss +23 -0
  112. package/src/features/common/AppCard/index.ts +207 -0
  113. package/src/features/common/AppCard/styles.module.scss +117 -0
  114. package/src/features/common/AppCardCompact/index.ts +189 -0
  115. package/src/features/common/AppCardCompact/styles.module.scss +141 -0
  116. package/src/features/common/AuthSelector/index.ts +537 -0
  117. package/src/features/common/AuthSelector/styles.module.scss +161 -0
  118. package/src/features/common/AuthSelectorCompact/index.ts +706 -0
  119. package/src/features/common/AuthSelectorCompact/styles.module.scss +219 -0
  120. package/src/features/common/AuthSelectorDropdown/index.ts +704 -0
  121. package/src/features/common/AuthSelectorDropdown/styles.module.scss +361 -0
  122. package/src/features/common/DynamicField/index.ts +229 -0
  123. package/src/features/common/DynamicField/styles.module.scss +67 -0
  124. package/src/features/common/DynamicTypedField/index.ts +217 -0
  125. package/src/features/common/DynamicTypedField/styles.module.scss +67 -0
  126. package/src/features/common/FunctionForm/index.ts +862 -0
  127. package/src/features/common/FunctionForm/styles.module.scss +163 -0
  128. package/src/features/common/MappingUI/index.ts +649 -0
  129. package/src/features/common/MappingUI/styles.module.scss +121 -0
  130. package/src/features/common/MarketplaceAppCard/index.ts +279 -0
  131. package/src/features/common/MarketplaceAppCard/styles.module.scss +231 -0
  132. package/src/features/common/MarketplaceAppCardCompact/index.ts +283 -0
  133. package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +255 -0
  134. package/src/features/common/NewMappingUI/index.ts +515 -0
  135. package/src/features/common/NewMappingUI/styles.module.scss +113 -0
  136. package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +67 -0
  137. package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +23 -0
  138. package/src/features/common/RequestAppWidget/index.ts +48 -0
  139. package/src/features/common/RequestAppWidget/request-app-form.ts +89 -0
  140. package/src/features/common/RequestAppWidget/styles.module.scss +43 -0
  141. package/src/features/common/SectionField/index.ts +272 -0
  142. package/src/features/common/SectionField/styles.module.scss +67 -0
  143. package/src/features/common/Step/index.ts +827 -0
  144. package/src/features/common/Step/styles.module.scss +12 -0
  145. package/src/features/common/StepNavigation/CollapsedSteps.ts +125 -0
  146. package/src/features/common/StepNavigation/NavItem.ts +111 -0
  147. package/src/features/common/StepNavigation/index.ts +257 -0
  148. package/src/features/common/StepNavigation/styles.module.scss +117 -0
  149. package/src/features/common/Steps/index.ts +1139 -0
  150. package/src/features/common/Steps/styles.module.scss +314 -0
  151. package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +383 -0
  152. package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +367 -0
  153. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +194 -0
  154. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +389 -0
  155. package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +577 -0
  156. package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +83 -0
  157. package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +212 -0
  158. package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +45 -0
  159. package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +1081 -0
  160. package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +452 -0
  161. package/src/features/containers/AppFlowContainer/Authentication/index.ts +610 -0
  162. package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +468 -0
  163. package/src/features/containers/AppFlowContainer/index.ts +114 -0
  164. package/src/features/containers/AppPageContainer/AppPage/index.tsx +262 -0
  165. package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +120 -0
  166. package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +165 -0
  167. package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +81 -0
  168. package/src/features/containers/AppPageContainer/index.tsx +93 -0
  169. package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
  170. package/src/features/containers/AppsForFlows/index.ts +161 -0
  171. package/src/features/containers/AppsForFlows/styles.module.scss +280 -0
  172. package/src/features/containers/AppsForFlowsCompact/index.ts +161 -0
  173. package/src/features/containers/AppsForFlowsCompact/styles.module.scss +279 -0
  174. package/src/features/containers/AuthSetupContainer/AppSelection.ts +73 -0
  175. package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +67 -0
  176. package/src/features/containers/AuthSetupContainer/Footer.ts +32 -0
  177. package/src/features/containers/AuthSetupContainer/Header.ts +39 -0
  178. package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +27 -0
  179. package/src/features/containers/AuthSetupContainer/index.ts +349 -0
  180. package/src/features/containers/AuthSetupContainer/styles.module.scss +229 -0
  181. package/src/features/containers/FlowSetupContainer/index.ts +390 -0
  182. package/src/features/containers/FlowSetupContainer/styles.module.scss +18 -0
  183. package/src/features/containers/MarkeplaceApps/index.ts +574 -0
  184. package/src/features/containers/MarkeplaceApps/styles.module.scss +559 -0
  185. package/src/features/containers/MarketplaceAppsCompact/index.ts +576 -0
  186. package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +546 -0
  187. package/src/features/containers/MarketplaceAppsContainer/index.ts +83 -0
  188. package/src/features/containers/MarketplaceContainer/AppCard/index.ts +91 -0
  189. package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +66 -0
  190. package/src/features/containers/MarketplaceContainer/AppListing/index.ts +34 -0
  191. package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +10 -0
  192. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +132 -0
  193. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +117 -0
  194. package/src/features/containers/MarketplaceContainer/index.ts +242 -0
  195. package/src/features/containers/MarketplaceContainer/styles.module.scss +84 -0
  196. package/src/features/containers/SDKContainer/index.ts +817 -0
  197. package/src/features/containers/SDKContainer/styles.module.scss +266 -0
  198. package/src/features/containers/SDKDebugContainer/index.ts +137 -0
  199. package/src/features/containers/SDKDebugContainer/styles.module.scss +37 -0
  200. package/src/features/containers/SDKFailedContainer/index.ts +117 -0
  201. package/src/features/containers/SDKFailedContainer/styles.module.scss +57 -0
  202. package/src/features/integrations/IntegrationRow/Icons.ts +77 -0
  203. package/src/features/integrations/IntegrationRow/index.ts +129 -0
  204. package/src/features/integrations/IntegrationRow/styles.module.scss +62 -0
  205. package/src/features/integrations/IntegrationsHeader/index.ts +34 -0
  206. package/src/features/integrations/IntegrationsHeader/styles.module.scss +47 -0
  207. package/src/features/integrations/IntegrationsList/index.ts +252 -0
  208. package/src/features/integrations/IntegrationsList/styles.module.scss +67 -0
  209. package/src/features/templates/Template/index.ts +295 -0
  210. package/src/features/templates/Template/styles.module.scss +226 -0
  211. package/src/features/templates/TemplatesView/index.ts +368 -0
  212. package/src/features/templates/TemplatesView/styles.module.scss +71 -0
  213. package/src/features/templates/TemplatesViewCompact/index.ts +364 -0
  214. package/src/features/templates/TemplatesViewCompact/styles.module.scss +141 -0
  215. package/src/hooks/useAutosizeTextArea.ts +22 -0
  216. package/src/hooks/useCustomRef.ts +13 -0
  217. package/src/hooks/useDebounce.ts +17 -0
  218. package/src/hooks/useElementResize.ts +40 -0
  219. package/src/hooks/useEventListener.ts +44 -0
  220. package/src/hooks/useHover.ts +40 -0
  221. package/src/hooks/useOnClickOutside.ts +32 -0
  222. package/src/index.ts +2051 -0
  223. package/src/index.umd.ts +13 -0
  224. package/src/interfaces/index.ts +924 -0
  225. package/src/modules/api/index.ts +1315 -0
  226. package/src/modules/api/responseHandler.ts +38 -0
  227. package/src/modules/event-emitter/index.ts +72 -0
  228. package/src/modules/event-emitter/runners/abstract.ts +21 -0
  229. package/src/modules/event-emitter/runners/default.ts +11 -0
  230. package/src/modules/event-emitter/runners/ntimes.ts +28 -0
  231. package/src/modules/event-emitter/types.ts +34 -0
  232. package/src/store/actionFunctions.ts +1573 -0
  233. package/src/store/index.ts +17 -0
  234. package/src/store/initialState.ts +58 -0
  235. package/src/stories/Button.stories.tsx +83 -0
  236. package/src/stories/Checkbox/Checkbox.stories.tsx +41 -0
  237. package/src/stories/Checkbox/CheckboxGroup.stories.tsx +46 -0
  238. package/src/stories/EditableText.stories.tsx +35 -0
  239. package/src/stories/Input/BaseInput.stories.tsx +48 -0
  240. package/src/stories/Input/DateInput.stories.tsx +28 -0
  241. package/src/stories/Input/Input.stories.tsx +24 -0
  242. package/src/stories/Input/PasswordInput.stories.tsx +26 -0
  243. package/src/stories/Introduction.stories.mdx +211 -0
  244. package/src/stories/Label.stories.tsx +27 -0
  245. package/src/stories/Listbox.stories.tsx +122 -0
  246. package/src/stories/Radio/Radio.stories.tsx +39 -0
  247. package/src/stories/Radio/RadioGroup.stories.tsx +46 -0
  248. package/src/stories/StepNavigation/NavItem.stories.tsx +31 -0
  249. package/src/stories/StepNavigation/StepNavigation.stories.tsx +50 -0
  250. package/src/stories/TabBar.stories.tsx +31 -0
  251. package/src/stories/TextArea.stories.tsx +23 -0
  252. package/src/stories/TimeInput.stories.tsx +37 -0
  253. package/src/stories/Toggle.stories.tsx +33 -0
  254. package/src/stories/assets/code-brackets.svg +1 -0
  255. package/src/stories/assets/colors.svg +1 -0
  256. package/src/stories/assets/comments.svg +1 -0
  257. package/src/stories/assets/direction.svg +1 -0
  258. package/src/stories/assets/flow.svg +1 -0
  259. package/src/stories/assets/plugin.svg +1 -0
  260. package/src/stories/assets/repo.svg +1 -0
  261. package/src/stories/assets/stackalt.svg +1 -0
  262. package/src/types/index.ts +293 -0
  263. package/src/types/store.ts +366 -0
  264. package/src/types/utils.ts +19 -0
  265. package/src/utils/ActivityOutputUtils.ts +163 -0
  266. package/src/utils/common.ts +20 -0
  267. package/src/utils/copyToClipboard.ts +24 -0
  268. package/src/utils/datetime.ts +101 -0
  269. package/src/utils/getUrlParam.ts +11 -0
  270. package/src/utils/isAuthMessage.ts +16 -0
  271. package/src/utils/isBrowser.ts +1 -0
  272. package/src/utils/jsonEncodeDecode.ts +15 -0
  273. package/src/utils/objectUtils.ts +116 -0
  274. package/src/utils/popup.ts +30 -0
  275. package/src/utils/searchJson.ts +51 -0
  276. package/src/utils/stepUtils.ts +45 -0
  277. package/src/utils/truncate.ts +6 -0
  278. package/test/setup.ts +1 -0
  279. package/vitest.config.ts +10 -0
@@ -0,0 +1,262 @@
1
+ /* eslint-disable no-use-before-define */
2
+ import { html } from 'htm/preact';
3
+ import { connect } from 'unistore/preact';
4
+ import { actionFunctions } from '@/store';
5
+ import { StoreType } from '@/types/store';
6
+ import { useEffect, useContext, useState, useRef } from 'preact/hooks';
7
+ import AppContext from '@/contexts/AppContext';
8
+ import { MarketplaceAppBundle, UploadFileObj } from '@/interfaces';
9
+ import { LargeLoader } from '@/components/LargeLoader';
10
+ import { EditableTextArea } from '@/components/EditableTextArea';
11
+ // import { Modal } from '@/components/Modal';
12
+ import AccountDropdown from '@/features/common/AccountDropdown';
13
+ import FlowSetupContainer from '@/features/containers/FlowSetupContainer';
14
+ import { Authorization } from '@/types';
15
+ import { ConfirmationPopUp } from '@/components/PopUp/ConfirmationPopUp';
16
+ import MediaUplaod from '@/components/MediaUpload';
17
+ import MediaGallery from '@/components/MediaGallery';
18
+ import IntegrationCard from '../IntegrationCard';
19
+ import styles from './styles.module.scss';
20
+
21
+ interface AppPageProps extends StoreType {
22
+ marketplaceId: string;
23
+ marketplaceAppId: string;
24
+ }
25
+
26
+ const AppPage = (props: AppPageProps) => {
27
+ const {
28
+ marketplaceId,
29
+ marketplaceAppId
30
+ } = props;
31
+ const context = useContext(AppContext);
32
+ const [appData, setAppData] = useState<MarketplaceAppBundle | null>(null);
33
+ const [loading, setLoading] = useState<boolean>(false);
34
+ const [reloadPage, setReloadPage] = useState<boolean>(false);
35
+ const [connectedAppAuthID, setConnectedAppAuthID] = useState<number | undefined | null>(null);
36
+ const connectedAppAuthIDRef = useRef<number | undefined | null>(null);
37
+ const [showConnectAccountPopUp, setShowConnectAccountPopUp] = useState(false);
38
+ const [triggerAddAccount, setTriggerAddAccount] = useState(false);
39
+
40
+ useEffect(() => () => {
41
+ props.setStoreState({
42
+ showSetupInline: false
43
+ })
44
+ props.resetTemplateFields();
45
+ }, []);
46
+
47
+ useEffect(() => {
48
+ if (marketplaceId) {
49
+ setLoading(true);
50
+ context?.apiHandler
51
+ .getMarketplaceAppDetail({ marketplaceId, marketplaceAppId, app_auth_id: connectedAppAuthID })
52
+ .then((data) => {
53
+ if (data) {
54
+ setAppData(data);
55
+ connectedAppAuthIDRef.current = data.app.authorization_type.default_authorization;
56
+ } else {
57
+ console.error(`Failed to fetch app details`);
58
+ }
59
+ setLoading(false);
60
+ })
61
+ }
62
+ }, [marketplaceId, marketplaceAppId, reloadPage, connectedAppAuthID]);
63
+
64
+ const handelAuthorizationSelected = (authObj: Authorization | null, authID: number): void => {
65
+ setShowConnectAccountPopUp(false);
66
+ setConnectedAppAuthID(authID);
67
+ // setReloadPage((prev) => !prev);
68
+ }
69
+
70
+ const handelAuthorizationDeleted = (): void => {
71
+ setReloadPage((prev) => !prev);
72
+ }
73
+
74
+ const saveAppDescription = (updatedDescription: string): void => {
75
+ if (appData?.id) {
76
+ context?.apiHandler
77
+ .saveAppDescription(appData?.id, {long_description: updatedDescription})
78
+ .then((data) => {
79
+ if (data) {
80
+ // saved description
81
+ } else {
82
+ console.error(`Failed to save app description`);
83
+ }
84
+ })
85
+ }
86
+ }
87
+
88
+ const saveAppMedia = (uploadMedia: UploadFileObj[]): void => {
89
+ if (appData?.id) {
90
+ context?.apiHandler
91
+ .saveAppMedia(appData?.id, {media: uploadMedia})
92
+ .then((data) => {
93
+ if (data) {
94
+ // saved media
95
+ } else {
96
+ console.error(`Failed to save app media`);
97
+ }
98
+ })
99
+ }
100
+ }
101
+
102
+ const handleUploadMedia = (filesData: UploadFileObj[]): void => {
103
+ if (filesData) {
104
+ saveAppMedia(filesData);
105
+ }
106
+ }
107
+
108
+ const onEditDescription = (value: string): void => {
109
+ saveAppDescription(value);
110
+ };
111
+
112
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
113
+ const getContainerName = (): string => {
114
+ if (appData?.integrations && appData.integrations.length > 0) {
115
+ return appData?.integrations.filter(
116
+ (el) => el.id === props.genericData.templateId,
117
+ )[0]?.name;
118
+ }
119
+ return '';
120
+ };
121
+
122
+ const canOpenIntegration = (): boolean => {
123
+ if (!connectedAppAuthID && !connectedAppAuthIDRef.current) {
124
+ setShowConnectAccountPopUp(true);
125
+ return false;
126
+ }
127
+ return true;
128
+ };
129
+
130
+ const connectAccount = (): void => {
131
+ setTriggerAddAccount(true);
132
+ setTriggerAddAccount(false);
133
+ }
134
+
135
+ const onIntegrationUpdate = (): void => {
136
+ setReloadPage((prev) => !prev);
137
+ };
138
+
139
+ return html`${loading ? html`<div class="${styles.appPageLoader}"><${LargeLoader} /></div>` : html `${appData && html `
140
+ ${!props.showSetupInline && html `<div class="${styles.appPage} integry-container__app-page" >
141
+ <div class="${styles.appLogoSection}">
142
+ <div class="${styles.appLogoWrap}">
143
+ <img class="${styles.logo}" src=${appData?.app.icon_url} />
144
+ <div class="${styles.appNameWrap}">
145
+ <h2 class="${styles.appName}">${appData?.app.name}</h2>
146
+ </div>
147
+ </div>
148
+ <div class="${styles.appConnectWrap}">
149
+ <div class="${styles.connectList}">
150
+ <${AccountDropdown}
151
+ authorizationType=${appData?.app?.authorization_type}
152
+ onAuthorizationSelected=${handelAuthorizationSelected}
153
+ onAuthorizationDeleted=${handelAuthorizationDeleted}
154
+ showConnectButton=${true}
155
+ triggerAddAccount=${triggerAddAccount}
156
+ showError=${true}
157
+ />
158
+ </div>
159
+ </div>
160
+ </div>
161
+ <div class="${styles.appOverviewSection}">
162
+ ${appData.long_description || (props?.userConfig && props?.userConfig?.viewAsIU) ? html`
163
+ <div class="${styles.appDetail}">
164
+ ${props?.userConfig && props?.userConfig?.viewAsIU ? html`
165
+ <${EditableTextArea} value=${appData?.long_description}
166
+ handleChange=${onEditDescription}
167
+ keepEditingOn=${true}
168
+ placeholder="Enter help text here..."
169
+ //>
170
+ `
171
+ : html`
172
+ ${appData?.long_description}
173
+ `}
174
+ </div>` : html ``}
175
+ ${((appData?.media && appData.media.length > 0) || (props?.userConfig && props?.userConfig?.viewAsIU)) && html`
176
+ <div class="${styles.appMedia}">
177
+ ${props?.userConfig && props?.userConfig?.viewAsIU ? html`
178
+ <${MediaUplaod} media=${appData?.media} handleUploadMedia=${handleUploadMedia} />
179
+ `: html `
180
+ <${MediaGallery} media=${appData?.media} />
181
+ `}
182
+ </div>
183
+ `}
184
+ </div>
185
+ <div class="${styles.appIntegrationSection}">
186
+ <h2 class="${styles.sectionHeading}">Integrations</h2>
187
+ <div class="${styles.integrationListing}">
188
+ ${appData?.integrations && appData.integrations.length > 0 && html`
189
+ ${appData?.integrations.map((integration) => (
190
+ html`
191
+ <${IntegrationCard} integrationData=${integration}
192
+ canOpenIntegration=${canOpenIntegration} />
193
+ `
194
+ ))}
195
+ `}
196
+ </div>
197
+ </div>
198
+ ${showConnectAccountPopUp && html`
199
+ <${ConfirmationPopUp}
200
+ isOpen=${showConnectAccountPopUp}
201
+ title=${`You haven’t connected your ${appData.app.name} account`}
202
+ description="In order to run the integrations on your behalf, we need access to your account."
203
+ buttonLabel="Login"
204
+ cancelButtonLabel="Cancel"
205
+ handleButtonClick=${connectAccount}
206
+ handleCancelClick=${() => {
207
+ setShowConnectAccountPopUp(false);
208
+ setTriggerAddAccount(false);
209
+ }}
210
+ icon=${appData.app.icon_url}
211
+ />
212
+ `}
213
+ </div>
214
+ `}
215
+ ${props.showSetupInline && html`
216
+ <div
217
+ class="${styles.inlineSetup} ${'integry-container__setup-form--inline'}"
218
+ >
219
+ <${FlowSetupContainer}
220
+ deploymentId=${props.genericData.marketplaceId}
221
+ flowId=${props.genericData.templateId}
222
+ connectedAppAuthID=${connectedAppAuthID || connectedAppAuthIDRef.current}
223
+ onUpdate=${onIntegrationUpdate}
224
+ />
225
+ <div
226
+ class=${styles.close}
227
+ onclick=${() => {
228
+ props.resetTemplateFields();
229
+ }}
230
+ >
231
+ <svg
232
+ width="20"
233
+ height="22"
234
+ viewBox="0 0 20 22"
235
+ fill="none"
236
+ xmlns="http://www.w3.org/2000/svg"
237
+ >
238
+ <path
239
+ d="M14.2426 16.1822L5.75732 6.86328"
240
+ stroke="#999999"
241
+ stroke-width="2"
242
+ stroke-linecap="round"
243
+ />
244
+ <path
245
+ d="M14.2426 6.86328L5.75732 16.1822"
246
+ stroke="#999999"
247
+ stroke-width="2"
248
+ stroke-linecap="round"
249
+ />
250
+ </svg>
251
+ </div>
252
+ </div>
253
+ `}
254
+ `}
255
+ `}
256
+ `;
257
+ };
258
+
259
+ export default connect<AppPageProps, unknown, StoreType, unknown>(
260
+ ['userConfig', 'integrationIdToEdit', 'genericData', 'showSetupInline'],
261
+ actionFunctions,
262
+ )(AppPage);
@@ -0,0 +1,120 @@
1
+ .appPageLoader {
2
+ position: relative;
3
+ left: calc(100% - 26px - 50%);
4
+ top: 30%;
5
+ width: fit-content;
6
+ }
7
+ .appPage {
8
+ font-family: inherit;
9
+ p {
10
+ margin: 0px;
11
+ }
12
+ padding-bottom: 15px;
13
+ .appLogoSection {
14
+ display: flex;
15
+ flex-wrap: wrap;
16
+ gap: 16px;
17
+ justify-content: space-between;
18
+ align-items: flex-start;
19
+ margin-bottom: 24px;
20
+ .appLogoWrap {
21
+ display: flex;
22
+ align-items: center;
23
+ column-gap: 8px;
24
+ .logo {
25
+ width: 40px;
26
+ height: 40px;
27
+ border-radius: 50%;
28
+ }
29
+ .appNameWrap {
30
+ .appName {
31
+ margin: 0px;
32
+ font-family: inherit;
33
+ font-style: normal;
34
+ font-weight: 600;
35
+ font-size: 24px;
36
+ line-height: 29px;
37
+ text-transform: capitalize;
38
+ color: #333333;
39
+ }
40
+ .appCategory {
41
+ margin: 0px;
42
+ }
43
+ }
44
+ }
45
+ .appConnectWrap {
46
+ display: flex;
47
+ align-items: baseline;
48
+ .connectLabel {
49
+ margin-right: 16px;
50
+ }
51
+ .connectList {
52
+
53
+ }
54
+ }
55
+ }
56
+ .appOverviewSection {
57
+ margin-bottom: 24px;
58
+ .appDetail {
59
+ font-family: inherit;
60
+ font-style: normal;
61
+ font-weight: 400;
62
+ font-size: 16px;
63
+ line-height: 30px;
64
+ color: #999999;
65
+ height: fit-content;
66
+ width: 100%;
67
+ }
68
+ .appMedia {
69
+ margin-top: 16px;
70
+ }
71
+ }
72
+ .appIntegrationSection {
73
+ .sectionHeading {
74
+ font-family: inherit;
75
+ font-style: normal;
76
+ font-weight: 500;
77
+ font-size: 18px;
78
+ line-height: 22px;
79
+ color: #000000;
80
+ margin-bottom: 16px;
81
+ }
82
+ .integrationListing {
83
+ display: flex;
84
+ flex-wrap: wrap;
85
+ gap: 16px;
86
+ }
87
+ }
88
+ @media (min-width: 640px) {
89
+ .appOverviewSection {
90
+ display: flex;
91
+ flex-wrap: wrap;
92
+ }
93
+ }
94
+ @media (min-width: 857px) {
95
+ .appOverviewSection {
96
+ display: flex;
97
+ flex-wrap: nowrap;
98
+ justify-content: space-between;
99
+ align-items: flex-start;
100
+ gap: 32px;
101
+ .appMedia {
102
+ margin-top: 0px;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ .inlineSetup {
108
+ display: flex;
109
+ position: relative;
110
+ justify-content: center;
111
+ height: 100%;
112
+ padding: 50px;
113
+ .close {
114
+ position: absolute;
115
+ padding: 10px;
116
+ cursor: pointer;
117
+ top: 0;
118
+ right: 0;
119
+ }
120
+ }
@@ -0,0 +1,165 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable no-use-before-define */
3
+ import { html } from 'htm/preact';
4
+ import { connect } from 'unistore/preact';
5
+ import { actionFunctions } from '@/store';
6
+ import { StoreType } from '@/types/store';
7
+ import { useContext, useState } from 'preact/hooks';
8
+ import { MarketplaceAppIntegration } from '@/interfaces';
9
+ import { Button } from '@/components/Button';
10
+ import { Tag } from '@/components/Tag';
11
+ import { Toggle } from '@/components/Toggle';
12
+ import { convertDateToStandard } from '@/utils/datetime';
13
+ import AppContext from '@/contexts/AppContext';
14
+ import styles from './styles.module.scss';
15
+
16
+ enum IntegrationTagTypeLabel {
17
+ run_on_demand = 'Run on-demand',
18
+ run_automatically = 'Runs automatically',
19
+ '' = '',
20
+ }
21
+
22
+ enum integrationStatus {
23
+ ACTIVE = 'ACTIVE',
24
+ INACTIVE = 'INACTIVE',
25
+ }
26
+
27
+ interface IntegrationCardProps extends StoreType {
28
+ integrationData: MarketplaceAppIntegration;
29
+ canOpenIntegration?: () => boolean;
30
+ }
31
+
32
+ const IntegrationCard = (props: IntegrationCardProps) => {
33
+ const {
34
+ integrationData,
35
+ canOpenIntegration,
36
+ } = props;
37
+ const context = useContext(AppContext);
38
+ const { name, id, meta = null } = integrationData;
39
+ const [isIntegrationEnabled, setIsIntegrationEnabled] = useState(meta ? meta.status === integrationStatus.ACTIVE: false);
40
+ const [loading, setLoading] = useState<boolean>(false);
41
+
42
+ const toggleIntegrationStatus = (shouldEnable: boolean): void => {
43
+ if (meta && meta.integration_id) {
44
+ document.body.style.cursor='wait';
45
+ context?.apiHandler
46
+ .toggleIntegration(meta.integration_id, shouldEnable)
47
+ .then((data) => {
48
+ if (data) {
49
+ setIsIntegrationEnabled(shouldEnable);
50
+ } else {
51
+ console.error(`Failed to update integration status`);
52
+ }
53
+ document.body.style.cursor='default';
54
+ })
55
+ }
56
+ };
57
+
58
+ const handleEnableDisableIntegration = (shouldEnable: boolean): void => {
59
+ if (meta && meta.integration_id) {
60
+ toggleIntegrationStatus(shouldEnable);
61
+ }
62
+ }
63
+
64
+ const handleIntegrationEdit = () => {
65
+ if (canOpenIntegration && canOpenIntegration()) {
66
+ props.setStoreState({
67
+ ...{
68
+ integrationIdToEdit: meta ? meta.integration_id : null,
69
+ genericData: {
70
+ ...props.genericData,
71
+ brandingApp: null,
72
+ templateId: id,
73
+ },
74
+ },
75
+ ...({
76
+ showSetupInline: true,
77
+ }),
78
+ });
79
+ }
80
+ };
81
+
82
+ return html`${integrationData && html`
83
+ <div class="${styles.integrationCard}" onclick=${handleIntegrationEdit}>
84
+ <p class="${styles.integrationName}">${name}</p>
85
+ <div class="${styles.metaInfoWrap}">
86
+ <div class="${styles.integrationTypeTag}">
87
+ <${Tag} label="${IntegrationTagTypeLabel.run_automatically}" type="grey" className="integration-card-tag" />
88
+ </div>
89
+ <div class="${styles.moreInfo}">
90
+ More info
91
+ <svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg">
92
+ <g clip-path="url(#clip0_355_3187)">
93
+ <path d="M7.37138 8.72406C7.37138 7.97593 6.24951 7.97593 6.24951 8.72406C6.24951 9.47219 7.37138 9.47219 7.37138 8.72406Z" fill="#999999"/>
94
+ <path d="M6.81063 11.5133C9.63127 11.5133 11.9263 9.21824 11.9263 6.3976C11.9257 3.5776 9.63127 1.28256 6.81063 1.28256C3.98999 1.28256 1.69495 3.57696 1.69495 6.39824C1.69495 9.21888 3.98935 11.5133 6.81063 11.5133ZM6.81063 12.082C3.67127 12.082 1.12695 9.53707 1.12695 6.39835C1.12695 3.25899 3.67191 0.714671 6.81063 0.714671C9.94999 0.714671 12.4943 3.25963 12.4943 6.39835C12.4943 9.53707 9.94935 12.082 6.81063 12.082Z" fill="#999999"/>
95
+ <path d="M6.4126 7.39746H7.20823V3.51186H6.4126V7.39746Z" fill="#999999"/>
96
+ </g>
97
+ <defs>
98
+ <clipPath id="clip0_355_3187">
99
+ <rect width="12" height="12" fill="white" transform="matrix(1 0 0 -1 0.746094 12.6885)"/>
100
+ </clipPath>
101
+ </defs>
102
+ </svg>
103
+ </div>
104
+ </div>
105
+ <div class="${styles.bottomWrap}">
106
+ <div class="${styles.integrationStatus}">
107
+ Last run | ${meta ? html`${meta.last_run_start_time ?
108
+ // convertDateToStandard(meta.last_run_start_time) : 'Never'}
109
+ convertDateToStandard(meta.last_run_start_time) : 'No runs as yet'}
110
+ ${meta?.last_run_status && html`${
111
+ meta?.last_run_status === 'ok' ? html`
112
+ <svg width="16" height="16" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
113
+ <path d="M8.32812 0.517578C3.91213 0.517578 0.328125 4.10158 0.328125 8.51758C0.328125 12.9381 3.91213 16.5176 8.32812 16.5176C12.7487 16.5176 16.3281 12.9381 16.3281 8.51758C16.3281 4.10158 12.7441 0.517578 8.32812 0.517578ZM8.32812 15.329C4.57041 15.329 1.5167 12.2753 1.5167 8.51758C1.5167 4.75986 4.57041 1.70615 8.32812 1.70615C12.0858 1.70615 15.1396 4.75986 15.1396 8.51758C15.1396 12.2753 12.0813 15.329 8.32812 15.329Z" fill="#4BBF72"/>
114
+ <path d="M10.9838 5.68334L7.24437 10.0765L5.65352 8.3622C5.42952 8.11991 5.05466 8.1062 4.81237 8.3302C4.57009 8.5542 4.55637 8.92906 4.78037 9.17134L6.82837 11.3748C6.94266 11.4936 7.09809 11.5668 7.26266 11.5668C7.26723 11.5668 7.2718 11.5668 7.27637 11.5668C7.44551 11.5622 7.60551 11.4891 7.71523 11.3565L11.8844 6.45591C12.0947 6.20448 12.0672 5.82963 11.8158 5.61934C11.5689 5.39991 11.1941 5.43191 10.9838 5.68334Z" fill="#4BBF72"/>
115
+ </svg>
116
+ ` : html`
117
+ <svg width="16" height="16" viewBox="0 0 16 22" fill="none" xmlns="http://www.w3.org/2000/svg">
118
+ <rect y="0.5" width="16" height="16" rx="8" fill="#E26154"/>
119
+ <g filter="url(#filter0_d_398_2637)">
120
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.30152 6.44613C7.25819 5.97754 7.66442 5.52344 8.12171 5.52344C8.61526 5.52344 9.00706 5.9775 8.97049 6.44613L8.68756 9.94401C8.66602 10.2565 8.39017 10.5022 8.07803 10.4798C7.80247 10.4574 7.59183 10.2193 7.57737 9.94401L7.30152 6.44613ZM7.29834 12.1526C7.29834 11.729 7.6707 11.3842 8.13026 11.3842C8.60094 11.3842 8.97328 11.729 8.97286 12.1526V12.3004C8.97286 12.724 8.58982 13.0588 8.13026 13.0588C7.67026 13.0588 7.29834 12.724 7.29834 12.3004V12.1526Z" fill="white"/>
121
+ </g>
122
+ <defs>
123
+ <filter id="filter0_d_398_2637" x="3.29834" y="5.52344" width="9.67432" height="15.5352" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
124
+ <feFlood flood-opacity="0" result="BackgroundImageFix"/>
125
+ <feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
126
+ <feOffset dy="4"/>
127
+ <feGaussianBlur stdDeviation="2"/>
128
+ <feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
129
+ <feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_398_2637"/>
130
+ <feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_398_2637" result="shape"/>
131
+ </filter>
132
+ </defs>
133
+ </svg>
134
+ `}`}
135
+ ` : 'No runs as yet'}
136
+ </div>
137
+ ${true ? html`
138
+ <div class="${styles.toggleWrap}">
139
+ ${ isIntegrationEnabled ? 'Enabled' : 'Disabled' }
140
+ <${Toggle} id=${id} value=${isIntegrationEnabled}
141
+ onChange=${(val: boolean, event: any) => {
142
+ event.stopPropagation();
143
+ handleEnableDisableIntegration(val);
144
+ }}
145
+ <//>
146
+ </div>
147
+ ` : html`
148
+ <${Button} label="Run"
149
+ disabled=${false}
150
+ className="integry-primary-btn"
151
+ isLoading=${false}
152
+ width="54px"
153
+ height="36px"
154
+ />
155
+ `}
156
+ </div>
157
+ </div>
158
+ `}
159
+ `;
160
+ };
161
+
162
+ export default connect<IntegrationCardProps, unknown, StoreType, unknown>(
163
+ ['genericData'],
164
+ actionFunctions,
165
+ )(IntegrationCard);
@@ -0,0 +1,81 @@
1
+ .integrationCard {
2
+ background: #FFFFFF;
3
+ border: 1px solid #F2F2F2;
4
+ box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.06);
5
+ border-radius: 8px;
6
+ width: 352px;
7
+ height: 197px;
8
+ padding-bottom: 16px;
9
+ cursor: pointer;
10
+ .integrationName {
11
+ font-family: inherit;
12
+ font-style: normal;
13
+ font-weight: 500;
14
+ font-size: 14px;
15
+ line-height: 24px;
16
+ color: #333333;
17
+ margin-bottom: 16px;
18
+ word-break: break-word;
19
+ overflow: hidden;
20
+ height: 48px;
21
+ padding: 0px 24px;
22
+ margin-top: 24px;
23
+ }
24
+ .metaInfoWrap {
25
+ display: flex;
26
+ flex-wrap: wrap;
27
+ align-items: center;
28
+ justify-content: flex-start;
29
+ margin-bottom: 16px;
30
+ gap: 16px;
31
+ padding: 0px 24px;
32
+ .moreInfo {
33
+ font-family: inherit;
34
+ font-style: normal;
35
+ font-weight: 400;
36
+ font-size: 12px;
37
+ line-height: 15px;
38
+ color: #999999;
39
+ display: flex;
40
+ justify-content: flex-start;
41
+ align-items: center;
42
+ svg {
43
+ vertical-align: unset;
44
+ margin-left: 5px;
45
+ }
46
+ }
47
+ }
48
+ .bottomWrap {
49
+ display: flex;
50
+ justify-content: space-between;
51
+ align-items: center;
52
+ border-top: 1px solid #E0E0E0;
53
+ padding: 24px;
54
+ padding-top: 16px;
55
+ padding-bottom: 0px;
56
+ .integrationStatus {
57
+ font-family: inherit;
58
+ font-style: normal;
59
+ font-weight: 400;
60
+ font-size: 12px;
61
+ line-height: 15px;
62
+ color: #999999;
63
+ display: flex;
64
+ align-items: center;
65
+ justify-content: flex-start;
66
+ gap: 6px;
67
+ }
68
+ .toggleWrap {
69
+ font-family: inherit;
70
+ font-style: normal;
71
+ font-weight: 400;
72
+ font-size: 13px;
73
+ line-height: 16px;
74
+ color: #999999;
75
+ display: flex;
76
+ justify-content: flex-end;
77
+ align-items: center;
78
+ gap: 8px;
79
+ }
80
+ }
81
+ }