@integry/sdk 4.7.39 → 4.7.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/dist/esm/index.csm.js +1 -1
  2. package/dist/umd/index.umd.js +1 -1
  3. package/package.json +6 -1
  4. package/.eslintignore +0 -1
  5. package/.vscode/launch.json +0 -17
  6. package/CHANGELOG_INTERNAL.md +0 -134
  7. package/README_INTERNAL.md +0 -176
  8. package/THIRD_PARTY_LICENSES +0 -525
  9. package/generateTests.js +0 -80
  10. package/jest.config.cjs +0 -10
  11. package/src/components/AddTagButton/index.ts +0 -23
  12. package/src/components/BasicSelect/index.ts +0 -123
  13. package/src/components/BasicSelect/styles.module.scss +0 -44
  14. package/src/components/Button/index.ts +0 -97
  15. package/src/components/Button/styles.module.scss +0 -152
  16. package/src/components/CheckboxGroup/Checkbox.ts +0 -104
  17. package/src/components/CheckboxGroup/index.ts +0 -190
  18. package/src/components/CheckboxGroup/styles.module.scss +0 -63
  19. package/src/components/CollapsedMenu/index.ts +0 -104
  20. package/src/components/CollapsedMenu/styles.module.scss +0 -46
  21. package/src/components/ConfigureFieldWrapper/index.ts +0 -85
  22. package/src/components/ConfigureFieldWrapper/styles.module.scss +0 -57
  23. package/src/components/EditableText/index.ts +0 -121
  24. package/src/components/EditableText/styles.module.scss +0 -38
  25. package/src/components/EditableTextArea/index.ts +0 -143
  26. package/src/components/EditableTextArea/styles.module.scss +0 -91
  27. package/src/components/ErrorMessage/index.ts +0 -16
  28. package/src/components/ErrorMessage/styles.module.scss +0 -19
  29. package/src/components/ErrorPage/index.ts +0 -42
  30. package/src/components/ErrorPage/styles.module.scss +0 -26
  31. package/src/components/Footer/index.ts +0 -41
  32. package/src/components/Footer/styles.module.scss +0 -40
  33. package/src/components/HTMLContent/index.tsx +0 -205
  34. package/src/components/HTMLContent/styles.module.scss +0 -3
  35. package/src/components/InfoBox/index.ts +0 -48
  36. package/src/components/InfoBox/styles.module.scss +0 -21
  37. package/src/components/Input/BaseInput/index.ts +0 -170
  38. package/src/components/Input/BaseInput/styles.module.scss +0 -95
  39. package/src/components/Input/DateInput/index.ts +0 -103
  40. package/src/components/Input/DateInput/styles.module.scss +0 -50
  41. package/src/components/Input/Input/index.ts +0 -225
  42. package/src/components/Input/Input/styles.module.scss +0 -16
  43. package/src/components/Input/PasswordInput/index.ts +0 -164
  44. package/src/components/Input/PasswordInput/styles.module.scss +0 -37
  45. package/src/components/Input/index.ts +0 -7
  46. package/src/components/Label/index.ts +0 -61
  47. package/src/components/Label/styles.module.scss +0 -41
  48. package/src/components/LargeLoader/index.ts +0 -25
  49. package/src/components/LargeLoader/styles.module.scss +0 -16
  50. package/src/components/Listbox/ListBoxItem.ts +0 -57
  51. package/src/components/Listbox/index.ts +0 -488
  52. package/src/components/Listbox/styles.module.scss +0 -197
  53. package/src/components/Loader/index.ts +0 -25
  54. package/src/components/Loader/styles.module.scss +0 -16
  55. package/src/components/MediaGallery/MediaGalleryModal.ts +0 -82
  56. package/src/components/MediaGallery/MediaSlider.ts +0 -76
  57. package/src/components/MediaGallery/index.ts +0 -92
  58. package/src/components/MediaGallery/styles.module.scss +0 -156
  59. package/src/components/MediaUpload/index.ts +0 -233
  60. package/src/components/MediaUpload/styles.module.scss +0 -118
  61. package/src/components/Modal/index.ts +0 -87
  62. package/src/components/Modal/styles.module.scss +0 -441
  63. package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +0 -59
  64. package/src/components/MultipurposeField/Dropdown/index.tsx +0 -1202
  65. package/src/components/MultipurposeField/Dropdown/styles.module.scss +0 -215
  66. package/src/components/MultipurposeField/TagMenu/index.ts +0 -536
  67. package/src/components/MultipurposeField/TagMenu/styles.module.scss +0 -175
  68. package/src/components/MultipurposeField/TagOptions/index.tsx +0 -83
  69. package/src/components/MultipurposeField/TagOptions/styles.module.scss +0 -95
  70. package/src/components/MultipurposeField/index.tsx +0 -944
  71. package/src/components/MultipurposeField/styles.module.scss +0 -77
  72. package/src/components/NewModal/index.ts +0 -69
  73. package/src/components/NewModal/styles.module.scss +0 -70
  74. package/src/components/OverflowTooltip/index.tsx +0 -59
  75. package/src/components/PopUp/ConfirmationPopUp/index.ts +0 -58
  76. package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +0 -49
  77. package/src/components/PopUp/SuccessPopUp/index.ts +0 -62
  78. package/src/components/PopUp/SuccessPopUp/styles.module.scss +0 -38
  79. package/src/components/RadioGroup/Radio.ts +0 -128
  80. package/src/components/RadioGroup/index.ts +0 -169
  81. package/src/components/RadioGroup/styles.module.scss +0 -81
  82. package/src/components/Search/index.ts +0 -69
  83. package/src/components/Search/styles.module.scss +0 -149
  84. package/src/components/TabBar/Tab.ts +0 -33
  85. package/src/components/TabBar/index.ts +0 -64
  86. package/src/components/TabBar/styles.module.scss +0 -43
  87. package/src/components/Tag/index.ts +0 -29
  88. package/src/components/Tag/styles.module.scss +0 -57
  89. package/src/components/TagsMenu/index.ts +0 -1697
  90. package/src/components/TagsMenu/styles.module.scss +0 -350
  91. package/src/components/TestComponent/index.ts +0 -71
  92. package/src/components/TestComponent/styles.module.scss +0 -152
  93. package/src/components/TextArea/index.ts +0 -172
  94. package/src/components/TextArea/styles.module.scss +0 -72
  95. package/src/components/TextContent/index.tsx +0 -128
  96. package/src/components/TextContent/styles.module.scss +0 -6
  97. package/src/components/ThreeDotLoader/index.ts +0 -39
  98. package/src/components/ThreeDotLoader/styles.module.scss +0 -41
  99. package/src/components/TimeInput/index.ts +0 -129
  100. package/src/components/TimeInput/styles.module.scss +0 -16
  101. package/src/components/Toggle/index.ts +0 -34
  102. package/src/components/Toggle/styles.module.scss +0 -56
  103. package/src/components/Toggle-v2/index.ts +0 -40
  104. package/src/components/Toggle-v2/styles.module.scss +0 -86
  105. package/src/components/Tooltip/index.ts +0 -271
  106. package/src/components/Tooltip/styles.module.scss +0 -105
  107. package/src/components/form/FunctionField/index.ts +0 -816
  108. package/src/components/form/FunctionField/styles.module.scss +0 -478
  109. package/src/components/form/ObjectField/__snapshots__/index.ts.test.tsx.snap +0 -3
  110. package/src/components/form/ObjectField/index.ts +0 -593
  111. package/src/components/form/ObjectField/index.ts.test.tsx +0 -213
  112. package/src/components/form/ObjectField/styles.module.scss +0 -103
  113. package/src/components/form/index.ts +0 -4
  114. package/src/contexts/AppContext.ts +0 -12
  115. package/src/declaration.d.ts +0 -7
  116. package/src/extensions/HMAC.ts +0 -25
  117. package/src/extensions/IntegryAPIError.ts +0 -19
  118. package/src/features/common/AccountDropdown/index.ts +0 -291
  119. package/src/features/common/AccountDropdown/styles.module.scss +0 -19
  120. package/src/features/common/ActionForm/index.ts +0 -2602
  121. package/src/features/common/ActionForm/styles.module.scss +0 -35
  122. package/src/features/common/AppCard/index.ts +0 -207
  123. package/src/features/common/AppCard/styles.module.scss +0 -117
  124. package/src/features/common/AppCardCompact/index.ts +0 -189
  125. package/src/features/common/AppCardCompact/styles.module.scss +0 -141
  126. package/src/features/common/AuthSelector/index.ts +0 -537
  127. package/src/features/common/AuthSelector/styles.module.scss +0 -161
  128. package/src/features/common/AuthSelectorCompact/index.ts +0 -706
  129. package/src/features/common/AuthSelectorCompact/styles.module.scss +0 -219
  130. package/src/features/common/AuthSelectorDropdown/index.ts +0 -704
  131. package/src/features/common/AuthSelectorDropdown/styles.module.scss +0 -361
  132. package/src/features/common/AuthSelectorV2/index.ts +0 -336
  133. package/src/features/common/AuthSelectorV2/styles.module.scss +0 -235
  134. package/src/features/common/DynamicField/index.ts +0 -402
  135. package/src/features/common/DynamicField/styles.module.scss +0 -266
  136. package/src/features/common/DynamicTypedField/index.ts +0 -504
  137. package/src/features/common/DynamicTypedField/styles.module.scss +0 -135
  138. package/src/features/common/FunctionForm/index.ts +0 -1095
  139. package/src/features/common/FunctionForm/styles.module.scss +0 -225
  140. package/src/features/common/MappingUI/index.ts +0 -649
  141. package/src/features/common/MappingUI/styles.module.scss +0 -121
  142. package/src/features/common/MarketplaceAppCard/index.ts +0 -279
  143. package/src/features/common/MarketplaceAppCard/styles.module.scss +0 -231
  144. package/src/features/common/MarketplaceAppCardCompact/index.ts +0 -283
  145. package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +0 -255
  146. package/src/features/common/NewMappingUI/index.ts +0 -515
  147. package/src/features/common/NewMappingUI/styles.module.scss +0 -113
  148. package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +0 -67
  149. package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +0 -23
  150. package/src/features/common/RequestAppWidget/index.ts +0 -48
  151. package/src/features/common/RequestAppWidget/request-app-form.ts +0 -89
  152. package/src/features/common/RequestAppWidget/styles.module.scss +0 -43
  153. package/src/features/common/SectionField/index.ts +0 -272
  154. package/src/features/common/SectionField/styles.module.scss +0 -67
  155. package/src/features/common/Step/index.ts +0 -827
  156. package/src/features/common/Step/styles.module.scss +0 -12
  157. package/src/features/common/StepNavigation/CollapsedSteps.ts +0 -131
  158. package/src/features/common/StepNavigation/NavItem.ts +0 -111
  159. package/src/features/common/StepNavigation/index.ts +0 -261
  160. package/src/features/common/StepNavigation/styles.module.scss +0 -117
  161. package/src/features/common/Steps/index.ts +0 -1140
  162. package/src/features/common/Steps/styles.module.scss +0 -314
  163. package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +0 -404
  164. package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +0 -367
  165. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.test.tsx +0 -58
  166. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +0 -208
  167. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.test.tsx +0 -49
  168. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +0 -421
  169. package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +0 -577
  170. package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +0 -83
  171. package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +0 -233
  172. package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +0 -45
  173. package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +0 -1085
  174. package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +0 -465
  175. package/src/features/containers/AppFlowContainer/Authentication/index.ts +0 -610
  176. package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +0 -468
  177. package/src/features/containers/AppFlowContainer/index.ts +0 -114
  178. package/src/features/containers/AppPageContainer/AppPage/index.tsx +0 -262
  179. package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +0 -120
  180. package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +0 -165
  181. package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +0 -81
  182. package/src/features/containers/AppPageContainer/index.tsx +0 -93
  183. package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
  184. package/src/features/containers/AppsForFlows/index.ts +0 -161
  185. package/src/features/containers/AppsForFlows/styles.module.scss +0 -280
  186. package/src/features/containers/AppsForFlowsCompact/index.ts +0 -161
  187. package/src/features/containers/AppsForFlowsCompact/styles.module.scss +0 -279
  188. package/src/features/containers/AuthSetupContainer/AppSelection.ts +0 -73
  189. package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +0 -67
  190. package/src/features/containers/AuthSetupContainer/Footer.ts +0 -32
  191. package/src/features/containers/AuthSetupContainer/Header.ts +0 -39
  192. package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +0 -27
  193. package/src/features/containers/AuthSetupContainer/index.ts +0 -349
  194. package/src/features/containers/AuthSetupContainer/styles.module.scss +0 -229
  195. package/src/features/containers/FlowSetupContainer/index.ts +0 -391
  196. package/src/features/containers/FlowSetupContainer/styles.module.scss +0 -18
  197. package/src/features/containers/MarkeplaceApps/index.ts +0 -583
  198. package/src/features/containers/MarkeplaceApps/styles.module.scss +0 -558
  199. package/src/features/containers/MarketplaceAppsCompact/index.ts +0 -585
  200. package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +0 -563
  201. package/src/features/containers/MarketplaceAppsContainer/index.ts +0 -91
  202. package/src/features/containers/MarketplaceContainer/AppCard/index.ts +0 -91
  203. package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +0 -66
  204. package/src/features/containers/MarketplaceContainer/AppListing/index.ts +0 -34
  205. package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +0 -10
  206. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +0 -132
  207. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +0 -117
  208. package/src/features/containers/MarketplaceContainer/index.ts +0 -242
  209. package/src/features/containers/MarketplaceContainer/styles.module.scss +0 -84
  210. package/src/features/containers/SDKContainer/index.ts +0 -817
  211. package/src/features/containers/SDKContainer/styles.module.scss +0 -266
  212. package/src/features/containers/SDKDebugContainer/index.ts +0 -137
  213. package/src/features/containers/SDKDebugContainer/styles.module.scss +0 -37
  214. package/src/features/containers/SDKFailedContainer/index.ts +0 -117
  215. package/src/features/containers/SDKFailedContainer/styles.module.scss +0 -57
  216. package/src/features/integrations/IntegrationRow/Icons.ts +0 -77
  217. package/src/features/integrations/IntegrationRow/index.ts +0 -129
  218. package/src/features/integrations/IntegrationRow/styles.module.scss +0 -62
  219. package/src/features/integrations/IntegrationsHeader/index.ts +0 -34
  220. package/src/features/integrations/IntegrationsHeader/styles.module.scss +0 -47
  221. package/src/features/integrations/IntegrationsList/index.ts +0 -252
  222. package/src/features/integrations/IntegrationsList/styles.module.scss +0 -67
  223. package/src/features/templates/Template/index.ts +0 -295
  224. package/src/features/templates/Template/styles.module.scss +0 -226
  225. package/src/features/templates/TemplatesView/index.ts +0 -368
  226. package/src/features/templates/TemplatesView/styles.module.scss +0 -71
  227. package/src/features/templates/TemplatesViewCompact/index.ts +0 -364
  228. package/src/features/templates/TemplatesViewCompact/styles.module.scss +0 -141
  229. package/src/hooks/useAutosizeTextArea.ts +0 -22
  230. package/src/hooks/useCustomRef.ts +0 -13
  231. package/src/hooks/useDebounce.ts +0 -17
  232. package/src/hooks/useElementResize.ts +0 -40
  233. package/src/hooks/useEventListener.ts +0 -42
  234. package/src/hooks/useHover.ts +0 -40
  235. package/src/hooks/useOnClickOutside.ts +0 -32
  236. package/src/index.ts +0 -2244
  237. package/src/index.umd.ts +0 -13
  238. package/src/interfaces/index.ts +0 -938
  239. package/src/modules/api/index.ts +0 -1325
  240. package/src/modules/api/responseHandler.ts +0 -38
  241. package/src/modules/event-emitter/index.ts +0 -72
  242. package/src/modules/event-emitter/runners/abstract.ts +0 -21
  243. package/src/modules/event-emitter/runners/default.ts +0 -11
  244. package/src/modules/event-emitter/runners/ntimes.ts +0 -28
  245. package/src/modules/event-emitter/types.ts +0 -34
  246. package/src/store/actionFunctions.ts +0 -1578
  247. package/src/store/index.ts +0 -17
  248. package/src/store/initialState.ts +0 -58
  249. package/src/types/index.ts +0 -320
  250. package/src/types/preact-compat.d.ts +0 -4
  251. package/src/types/store.ts +0 -366
  252. package/src/types/utils.ts +0 -19
  253. package/src/utils/ActivityOutputUtils.ts +0 -176
  254. package/src/utils/common.ts +0 -20
  255. package/src/utils/copyToClipboard.ts +0 -24
  256. package/src/utils/datetime.ts +0 -101
  257. package/src/utils/getUrlParam.ts +0 -11
  258. package/src/utils/isAuthMessage.ts +0 -16
  259. package/src/utils/isBrowser.ts +0 -1
  260. package/src/utils/jsonEncodeDecode.ts +0 -15
  261. package/src/utils/objectUtils.ts +0 -117
  262. package/src/utils/popup.ts +0 -30
  263. package/src/utils/searchJson.ts +0 -51
  264. package/src/utils/stepUtils.ts +0 -45
  265. package/src/utils/truncate.ts +0 -6
  266. package/test/setup.ts +0 -1
  267. package/vitest.config.ts +0 -16
@@ -1,585 +0,0 @@
1
- import { html } from 'htm/preact';
2
- import { useEffect, useState, useContext, useRef } from 'preact/hooks';
3
-
4
- import { Loader } from '@/components/Loader';
5
- import { LargeLoader } from '@/components/LargeLoader';
6
- import { ThreeDotLoader } from '@/components/ThreeDotLoader';
7
- import AppCard from '@/features/common/MarketplaceAppCard';
8
- import AppCardCompact from '@/features/common/MarketplaceAppCardCompact';
9
- import Footer from '@/components/Footer';
10
- import { Hint } from '@/components/Tooltip';
11
- import isBrowser from '@/utils/isBrowser';
12
- import { truncate, isTruncatable } from '@/utils/truncate';
13
- import { AuthData, isAuthMessage } from '@/utils/isAuthMessage';
14
- import { openPopupWindow } from '@/utils/popup';
15
-
16
- import { connect } from 'unistore/preact';
17
- import { StoreType } from '@/types/store';
18
- import { actionFunctions } from '@/store';
19
- import AppContext from '@/contexts/AppContext';
20
- import { ViewStyles } from '@/types';
21
-
22
- import styles from './styles.module.scss';
23
-
24
- const Confirmation = (props: { callback(shouldDelete: boolean): void }) => {
25
- const { callback } = props;
26
- const [isProcessing, setIsProcessing] = useState(false);
27
-
28
- const handleYesClick = () => {
29
- setIsProcessing(true); // Update the state to show "..."
30
- callback(true); // Trigger the callback function
31
- };
32
-
33
- return html`
34
- <div class=${styles.confirmation}>
35
- <div class=${styles.confirmationText}>Are you sure?</div>
36
- <button disabled=${isProcessing} onclick=${() => callback(false)}>
37
- No
38
- </button>
39
- <button onclick=${handleYesClick}>
40
- ${isProcessing ? html`<${ThreeDotLoader} color="#fff" />` : 'Yes'}
41
- </button>
42
- </div>
43
- `;
44
- };
45
-
46
- const AuthorizationRow = (props: {
47
- id: string;
48
- value: string;
49
- isChecked?: boolean;
50
- isLoading: boolean;
51
- willDelete?: boolean;
52
- isDeleting?: boolean;
53
- error?: string;
54
- status: 'VERIFYING' | 'CONNECTED' | 'ERROR' | 'IDLE' | null;
55
- handleChange?: (id: string) => void;
56
- handleReverify?: () => void;
57
- handleDelete?: (shouldDelete: boolean) => void;
58
- handleWillDelete?: () => void;
59
- isReadOnly?: boolean;
60
- forcedLoading?: boolean;
61
- }) => {
62
- const {
63
- id,
64
- value,
65
- isChecked,
66
- status = 'IDLE',
67
- isDeleting = false,
68
- willDelete = false,
69
- handleChange,
70
- handleReverify,
71
- handleDelete = () => null,
72
- handleWillDelete = () => null,
73
- error,
74
- isReadOnly,
75
- } = props;
76
- return html`
77
- <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
78
- <div class="${styles.checkboxRow} ${styles.buttonShadow}">
79
- <div
80
- class="${styles.connectedAccountRow} ${willDelete
81
- ? styles.statusWrapShortWidth
82
- : ''}"
83
- >
84
- <span class="${styles.connectedAccountValue}"
85
- >${isTruncatable(value, 66) ? truncate(value, 66) : value}</span
86
- >
87
- <div class=${`${styles.statusWrap}`}>
88
- <div class=${styles.status}>
89
- <svg
90
- width="12"
91
- height="13"
92
- viewBox="0 0 12 13"
93
- fill="none"
94
- xmlns="http://www.w3.org/2000/svg"
95
- >
96
- <circle cx="6" cy="6.5" r="6" fill="#C4E9D2" />
97
- <path
98
- d="M8.49951 4.5L5.22003 8.25L3.49951 6.28264"
99
- stroke="#3BB568"
100
- stroke-linecap="round"
101
- />
102
- </svg>
103
- </div>
104
- </div>
105
- </div>
106
-
107
- ${willDelete &&
108
- !isDeleting &&
109
- html` <${Confirmation} callback=${handleDelete} /> `}
110
- ${!(status === 'VERIFYING' || isDeleting || willDelete) &&
111
- !isReadOnly &&
112
- html`
113
- <div class=${styles.deleteIcon} onclick=${handleWillDelete}>
114
- <svg
115
- width="15"
116
- height="15"
117
- viewBox="0 0 15 15"
118
- fill="none"
119
- xmlns="http://www.w3.org/2000/svg"
120
- >
121
- <path d="M1.5 4.1999H13.65" stroke="#F05C42" />
122
- <path
123
- d="M11.6254 5.5498V6.2248L10.9504 13.6498H4.20039L3.52539 6.2248V5.5498"
124
- stroke="#F05C42"
125
- stroke-linejoin="round"
126
- />
127
- <path
128
- d="M5.55078 3.525V2.175C5.55078 1.80221 5.85299 1.5 6.22578 1.5H8.92578C9.29857 1.5 9.60078 1.80221 9.60078 2.175V3.525"
129
- stroke="#F05C42"
130
- />
131
- </svg>
132
- </div>
133
- `}
134
- </div>
135
- <//>
136
- `;
137
- };
138
-
139
- const MarketplaceAppsCompact = (props: any) => {
140
- const {
141
- genericData,
142
- renderMode,
143
- userConfig,
144
- appName,
145
- fetchAll,
146
- useLoadMoreButton,
147
- } = props;
148
- const context = useContext(AppContext);
149
- const [apps, setApps] = useState<any[]>([]);
150
- const [filteredApps, setFilteredApps] = useState<any[]>([]);
151
- const [isFetchingApps, setIsFetchingApps] = useState<boolean>(true);
152
- const [searchText, setSearchText] = useState<string>('');
153
- const [totalApps, setTotalApps] = useState<number>(0);
154
- const [cursor, setCursor] = useState<string>('');
155
- const [filteredAppsCount, setFilteredAppsCount] = useState<number>(0);
156
-
157
- const [loadingNextPage, setLoadingNextPage] = useState<boolean>(false);
158
- const [searchInProgress, setSearchInProgress] = useState<boolean>(false);
159
-
160
- const [selectedApp, setSelectedApp] = useState<any>(null);
161
- const [
162
- selectedAppConnectedAccounts,
163
- setSelectedAppConnectedAccounts,
164
- ] = useState<any[]>([]);
165
- const [willDeleteAuthWithIndex, setWillDeleteAuthWithIndex] = useState<
166
- number | null
167
- >(null);
168
- const [allowMultipleAuths, setAllowMultipleAuth] = useState<boolean>(true);
169
-
170
- const DEBOUNCE_DELAY = 500;
171
- const debounceTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);
172
-
173
- const getApps = ({
174
- currentApps = <any>[],
175
- search = '',
176
- initialLoad = false,
177
- nextCursor = '',
178
- }) => {
179
- setIsFetchingApps(true);
180
-
181
- const cursorToUse = nextCursor || cursor;
182
-
183
- context?.apiHandler
184
- .getMarketplaceAppsV2({
185
- cursor: search !== '' ? null : cursorToUse,
186
- search,
187
- fetchAll,
188
- })
189
- .then((appsResponse) => {
190
- const tempApps = appsResponse.apps.map((app: any) => ({
191
- ...app,
192
- }));
193
- if (appsResponse._cursor || search === '') {
194
- // we don't want to
195
- setCursor(appsResponse._cursor);
196
- }
197
-
198
- setTotalApps(appsResponse.count || (tempApps || []).length);
199
- if (search === '') {
200
- setFilteredApps((prev) => [...prev, ...tempApps]);
201
- } else {
202
- setFilteredApps(tempApps);
203
- }
204
-
205
- if (initialLoad) {
206
- setApps((prev) => [...prev, ...tempApps]);
207
- }
208
- setIsFetchingApps(false);
209
- setLoadingNextPage(false);
210
- setSearchInProgress(false);
211
- })
212
- .catch((error) => {
213
- // eslint-disable-next-line no-console
214
- console.log('error', { error });
215
- setIsFetchingApps(false);
216
- setLoadingNextPage(false);
217
- setSearchInProgress(false);
218
- });
219
- };
220
-
221
- const handleScroll = (e: any) => {
222
- const bottom =
223
- Math.floor(e.target.scrollHeight) ===
224
- Math.floor(e.target.scrollTop + e.target.clientHeight);
225
-
226
- if (bottom && !isFetchingApps && cursor && !loadingNextPage) {
227
- // Trigger the next page load when at the bottom
228
- setLoadingNextPage(true);
229
- getApps({
230
- currentApps: filteredApps,
231
- search: searchText,
232
- initialLoad: true, // we consider the next page to be part of the initial load
233
- nextCursor: cursor, // Use the cursor for pagination
234
- });
235
- }
236
- };
237
-
238
- const filterApps = (inputString: string, items: any) => {
239
- const cleanedInput = inputString.trim(); // Remove trailing spaces
240
- setSearchInProgress(true);
241
-
242
- if (cleanedInput === '') {
243
- setFilteredApps(items); // Set the apps when there's no search input
244
- return items;
245
- }
246
-
247
- setFilteredApps([]); // Clear the apps on each input change
248
-
249
- // Clear the previous timeout to avoid executing the previous search
250
- if (debounceTimeout.current) {
251
- clearTimeout(debounceTimeout.current);
252
- }
253
-
254
- // Set a new debounce timeout to trigger the search after the delay
255
- debounceTimeout.current = setTimeout(() => {
256
- // Call the server-side function to fetch apps based on the search term
257
- getApps({ currentApps: items, search: cleanedInput });
258
- }, DEBOUNCE_DELAY); // Delay search until user stops typing
259
-
260
- return [];
261
- };
262
-
263
- const handleGoBackToApps = () => {
264
- setSelectedApp(null);
265
- };
266
-
267
- const onAuthResponseReceived = (messageEvent: MessageEvent<AuthData>) => {
268
- if (isAuthMessage(messageEvent) && messageEvent.data.activity_name) {
269
- const tempAccounts = [
270
- ...selectedAppConnectedAccounts,
271
- {
272
- id: messageEvent.data.authorization_id,
273
- display_name: messageEvent.data.user_identity,
274
- },
275
- ];
276
- if (selectedApp && !selectedApp.allow_multiple_connected_accounts) {
277
- setAllowMultipleAuth(false);
278
- }
279
- setSelectedAppConnectedAccounts(tempAccounts);
280
- if (isBrowser())
281
- window.removeEventListener('message', onAuthResponseReceived);
282
- }
283
- };
284
-
285
- const openAuthWindow = () => {
286
- if (isBrowser()) window.addEventListener('message', onAuthResponseReceived);
287
- if (context && selectedApp && allowMultipleAuths) {
288
- const url = selectedApp.login_url;
289
- openPopupWindow(url, 'Auth Window', window, 800, 600);
290
- }
291
- };
292
-
293
- const deleteAuth = (authIndex: number) => {
294
- const auth = selectedAppConnectedAccounts[authIndex];
295
-
296
- context?.apiHandler
297
- .deleteAuth(auth.id)
298
- .then((res) => {
299
- if (res?.status === 200) {
300
- if (selectedAppConnectedAccounts && authIndex >= 0) {
301
- selectedAppConnectedAccounts.splice(authIndex, 1);
302
- if (selectedAppConnectedAccounts.length === 0) {
303
- setAllowMultipleAuth(true);
304
- }
305
- }
306
-
307
- context.eventEmitter.emit('app-disconnected', selectedApp);
308
- }
309
- })
310
- .catch((err) => {
311
- console.error(err);
312
- })
313
- .finally(() => {
314
- // setWillDeleteAuth(false);
315
- // setIsDeletingAuth(false);
316
- setWillDeleteAuthWithIndex(null);
317
- });
318
- };
319
-
320
- const willDelete = (authIndex: number) => {
321
- setWillDeleteAuthWithIndex(authIndex);
322
- };
323
-
324
- const getApp = (_appName: string) => {
325
- context?.apiHandler.getApp(_appName).then((app) => {
326
- setSelectedApp(app);
327
- if (
328
- app.allow_multiple_connected_accounts ||
329
- app.connected_accounts.length === 0
330
- ) {
331
- setAllowMultipleAuth(true);
332
- } else {
333
- setAllowMultipleAuth(false);
334
- }
335
- setIsFetchingApps(false);
336
- });
337
- };
338
-
339
- useEffect(() => {
340
- if (appName && appName !== '') {
341
- getApp(appName);
342
- } else {
343
- getApps({
344
- currentApps: apps,
345
- search: '',
346
- initialLoad: true,
347
- });
348
- }
349
- }, []);
350
-
351
- useEffect(() => {
352
- setSelectedAppConnectedAccounts(selectedApp?.connected_accounts || []);
353
- }, [selectedApp]);
354
- return html`
355
- <div
356
- id="embed--appsContainer"
357
- class="${renderMode === 'INLINE'
358
- ? styles.appsContainerInline
359
- : styles.appsContainer}
360
- ${genericData.viewStyle === ViewStyles.COMPACT
361
- ? styles['compact-view']
362
- : ''} embed--appsContainer--${renderMode}"
363
- style="${renderMode === 'INLINE' && props.showMarketplaceModal
364
- ? 'display: flex;'
365
- : ''}"
366
- >
367
- <div
368
- id="apps-header"
369
- class="${styles.appsHeader} ${selectedApp
370
- ? styles.appsHeaderWithBorder
371
- : ''}"
372
- >
373
- ${selectedApp
374
- ? html`
375
- <div class="${styles.backLink} ${styles.appsHeaderTitle}">
376
- ${!appName &&
377
- html`<svg
378
- width="33"
379
- height="33"
380
- viewBox="0 0 33 33"
381
- fill="none"
382
- xmlns="http://www.w3.org/2000/svg"
383
- onclick=${handleGoBackToApps}
384
- >
385
- <circle
386
- cx="16.6758"
387
- cy="16.5684"
388
- r="15.5"
389
- fill="white"
390
- stroke="#E0E0E0"
391
- />
392
- <path
393
- 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
394
- 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
395
- 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
396
- 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
397
- 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
398
- 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"
399
- fill="#4250F0"
400
- />
401
- </svg>`}
402
- ${selectedApp &&
403
- html`<img
404
- src=${selectedApp.icon_url}
405
- title="${selectedApp.title}"
406
- />`}
407
-
408
- <p class="${styles.backLabel}">
409
- ${selectedApp ? selectedApp.title : 'Apps'}
410
- </p>
411
- </div>
412
- `
413
- : html`
414
- <p id="appsHeaderTitle" class=${styles.appsHeaderTitle}>
415
- ${(() => {
416
- if (selectedApp) {
417
- return selectedApp.title;
418
- }
419
- if (appName) {
420
- return 'Loading...';
421
- }
422
- return 'Apps';
423
- })()}
424
- </p>
425
- `}
426
- ${!selectedApp &&
427
- !appName &&
428
- html`<div id="search-container" class=${styles.searchContainer}>
429
- <svg
430
- xmlns="http://www.w3.org/2000/svg"
431
- width="15"
432
- height="15"
433
- viewBox="0 0 15 15"
434
- fill="none"
435
- >
436
- <path
437
- d="M14.7706 13.6638L11.148 10.0407C13.0421 7.59989 12.8712 4.06416 10.6303 1.82385C9.45395 0.647448 7.89024 0 6.2271 0C4.56335 0 2.99953 0.647997 1.82385 1.82385C0.647448 2.99965 0 4.56335 0 6.2271C0 7.89084 0.647996 9.45466 1.82385 10.6303C3.00025 11.8067 4.56396 12.4542 6.2271 12.4542C7.62663 12.4542 8.95411 11.9942 10.0413 11.1481L13.6638 14.7706C13.8168 14.9236 14.0167 14.9997 14.2172 14.9997C14.4172 14.9997 14.6177 14.9236 14.7706 14.7706C15.0765 14.4654 15.0765 13.9697 14.7706 13.6639L14.7706 13.6638ZM2.93043 9.52291C2.05038 8.64226 1.56482 7.47179 1.56482 6.22694C1.56482 4.98153 2.04978 3.81114 2.93043 2.93037C3.81049 2.04972 4.98156 1.56476 6.2264 1.56476C7.47124 1.56476 8.6422 2.04972 9.52297 2.93037C11.3409 4.74767 11.3409 7.705 9.52297 9.52276C8.64232 10.4034 7.47124 10.8884 6.2264 10.8884C4.98156 10.8884 3.8112 10.4034 2.93043 9.52276V9.52291Z"
438
- fill="#BDBDBD"
439
- />
440
- </svg>
441
- <input
442
- id="search-apps-flow-lifecycle"
443
- class=${styles.searchInput}
444
- placeholder="${userConfig.searchPlaceholder || 'Search for apps'}"
445
- value=${searchText}
446
- oninput=${(e: any) => {
447
- setSearchText(e.target.value);
448
- filterApps(e.target.value, apps);
449
- }}
450
- />
451
- ${searchText !== '' &&
452
- html` <svg
453
- class=${styles.clearCta}
454
- onclick=${() => {
455
- setSearchText('');
456
- filterApps('', apps);
457
- }}
458
- xmlns="http://www.w3.org/2000/svg"
459
- width="12"
460
- height="12"
461
- viewBox="0 0 12 12"
462
- fill="none"
463
- >
464
- <path
465
- d="M10.2426 10.2425L1.75732 1.75732"
466
- stroke="#333333"
467
- stroke-width="1.33333"
468
- stroke-linecap="round"
469
- />
470
- <path
471
- d="M10.2426 1.75732L1.75732 10.2425"
472
- stroke="#333333"
473
- stroke-width="1.33333"
474
- stroke-linecap="round"
475
- />
476
- </svg>`}
477
- </div>`}
478
- </div>
479
-
480
- ${true &&
481
- filteredApps.length < 1 &&
482
- !selectedApp &&
483
- html` <div
484
- id="appsForFlowsCardsNoAppFound"
485
- class=${styles.appsForFlowsCardsNoAppFound}
486
- >
487
- ${searchText !== '' &&
488
- html` ${isFetchingApps && html`<${LargeLoader} />`}
489
- ${!searchInProgress && html`<p>Sorry, no apps found.</p>`}`}
490
- ${searchText === '' &&
491
- html` ${isFetchingApps && html`<${LargeLoader} />`}
492
- ${!isFetchingApps && html`<p>Sorry, no apps found.</p>`}`}
493
- </div>`}
494
- ${true &&
495
- (filteredApps.length > 0 || selectedApp) &&
496
- html`
497
- ${selectedApp
498
- ? html`<div
499
- class="${styles.marketplaceAuthSelectorWrap} integry-container__auth-selector"
500
- >
501
- <div class="${styles.heading}">Connected Accounts</div>
502
- <div class=${styles.rows}>
503
- ${selectedAppConnectedAccounts.map(
504
- (el: any, index: number) => html`<${AuthorizationRow}
505
- id=${el.id}
506
- value=${el.display_name}
507
- status=${`CONNECTED`}
508
- handleDelete=${(shouldDelete: boolean) =>
509
- shouldDelete
510
- ? deleteAuth(index)
511
- : setWillDeleteAuthWithIndex(null)}
512
- handleWillDelete=${() => willDelete(index)}
513
- willDelete=${willDeleteAuthWithIndex === index}
514
- />`,
515
- )}
516
- </div>
517
- ${true &&
518
- html`
519
- <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
520
- <div
521
- data-hint="${allowMultipleAuths
522
- ? ''
523
- : `You cannot connect more than one account for ${selectedApp.title}.`}"
524
- class="${styles.checkboxRow} ${styles.buttonShadow} ${styles.marketplaceAddAccountBtn} ${allowMultipleAuths
525
- ? ''
526
- : styles.disabled}"
527
- onclick=${openAuthWindow}
528
- >
529
- <span>+</span>
530
- <p>Add account</p>
531
- </div>
532
- <//>
533
- `}
534
- </div>`
535
- : html`<div
536
- id="${`embed--appsForFlowsCardsComfortable__${renderMode}`}"
537
- onscroll=${!useLoadMoreButton ? handleScroll : undefined}
538
- class="${props.genericData.viewStyle === ViewStyles.COMPACT
539
- ? styles.appsForFlowsCardsCompact
540
- : styles.appsForFlowsCards}"
541
- >
542
- ${filteredApps.map(
543
- (app: any) =>
544
- html`
545
- <${genericData.viewStyle === ViewStyles.COMPACT
546
- ? AppCardCompact
547
- : AppCard}
548
- key=${app.id}
549
- app=${app}
550
- onAppClick=${(appClicked: any) => {
551
- setSelectedApp(appClicked);
552
- }}
553
- />
554
- `,
555
- )}
556
- ${cursor &&
557
- html`<div
558
- class="${styles.loadMore}"
559
- onclick=${() => {
560
- setLoadingNextPage(true);
561
- getApps({
562
- currentApps: apps,
563
- });
564
- }}
565
- >
566
- ${loadingNextPage
567
- ? html`<${ThreeDotLoader} color="#999" />`
568
- : html`${useLoadMoreButton ? html`<a>Load more</a>` : ''}`}
569
- </div>`}
570
- </div>`}
571
- `}
572
- ${!isFetchingApps &&
573
- html`<${Footer}
574
- style=${renderMode === 'INLINE'
575
- ? 'padding-top: 12px;'
576
- : 'padding-top: 12px; box-shadow: 0px -6px 10px 0px rgba(255, 255, 255, 0.8);'}
577
- />`}
578
- </div>
579
- `;
580
- };
581
-
582
- export default connect<StoreType, unknown, StoreType, unknown>(
583
- ['genericData', 'userConfig', 'showMarketplaceModal'],
584
- actionFunctions,
585
- )(MarketplaceAppsCompact);