@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,583 +0,0 @@
1
- import { html } from 'htm/preact';
2
- import { useEffect, useState, useContext, useRef } from 'preact/hooks';
3
-
4
- import { LargeLoader } from '@/components/LargeLoader';
5
- import AppCard from '@/features/common/MarketplaceAppCard';
6
- import AppCardCompact from '@/features/common/MarketplaceAppCardCompact';
7
- import { ThreeDotLoader } from '@/components/ThreeDotLoader';
8
- import { Hint } from '@/components/Tooltip';
9
- import isBrowser from '@/utils/isBrowser';
10
- import { openPopupWindow } from '@/utils/popup';
11
- import { AuthData, isAuthMessage } from '@/utils/isAuthMessage';
12
- import { truncate, isTruncatable } from '@/utils/truncate';
13
- import Footer from '@/components/Footer';
14
-
15
- import { connect } from 'unistore/preact';
16
- import { StoreType } from '@/types/store';
17
- import { actionFunctions } from '@/store';
18
- import AppContext from '@/contexts/AppContext';
19
- import { ViewStyles } from '@/types';
20
-
21
- import styles from './styles.module.scss';
22
-
23
- const Confirmation = (props: { callback(shouldDelete: boolean): void }) => {
24
- const { callback } = props;
25
- const [isProcessing, setIsProcessing] = useState(false);
26
-
27
- const handleYesClick = () => {
28
- setIsProcessing(true); // Update the state to show "..."
29
- callback(true); // Trigger the callback function
30
- };
31
-
32
- return html`
33
- <div class=${styles.confirmation}>
34
- <div class=${styles.confirmationText}>Are you sure?</div>
35
- <button disabled=${isProcessing} onclick=${() => callback(false)}>
36
- No
37
- </button>
38
- <button onclick=${handleYesClick}>
39
- ${isProcessing ? html`<${ThreeDotLoader} color="#fff" />` : 'Yes'}
40
- </button>
41
- </div>
42
- `;
43
- };
44
-
45
- const AuthorizationRow = (props: {
46
- id: string;
47
- value: string;
48
- isChecked?: boolean;
49
- isLoading: boolean;
50
- willDelete?: boolean;
51
- isDeleting?: boolean;
52
- error?: string;
53
- status: 'VERIFYING' | 'CONNECTED' | 'ERROR' | 'IDLE' | null;
54
- handleChange?: (id: string) => void;
55
- handleReverify?: () => void;
56
- handleDelete?: (shouldDelete: boolean) => void;
57
- handleWillDelete?: () => void;
58
- isReadOnly?: boolean;
59
- forcedLoading?: boolean;
60
- }) => {
61
- const {
62
- id,
63
- value,
64
- isChecked,
65
- status = 'IDLE',
66
- isDeleting = false,
67
- willDelete = false,
68
- handleChange,
69
- handleReverify,
70
- handleDelete = () => null,
71
- handleWillDelete = () => null,
72
- error,
73
- isReadOnly,
74
- } = props;
75
- return html`
76
- <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
77
- <div class="${styles.checkboxRow} ${styles.buttonShadow}">
78
- <div
79
- class="${styles.connectedAccountRow} ${willDelete
80
- ? styles.statusWrapShortWidth
81
- : ''}"
82
- >
83
- <span class="${styles.connectedAccountValue}"
84
- >${isTruncatable(value, 66) ? truncate(value, 66) : value}</span
85
- >
86
- <div class=${`${styles.statusWrap}`}>
87
- <div class=${styles.status}>
88
- <svg
89
- width="12"
90
- height="13"
91
- viewBox="0 0 12 13"
92
- fill="none"
93
- xmlns="http://www.w3.org/2000/svg"
94
- >
95
- <circle cx="6" cy="6.5" r="6" fill="#C4E9D2" />
96
- <path
97
- d="M8.49951 4.5L5.22003 8.25L3.49951 6.28264"
98
- stroke="#3BB568"
99
- stroke-linecap="round"
100
- />
101
- </svg>
102
- </div>
103
- </div>
104
- </div>
105
-
106
- ${willDelete &&
107
- !isDeleting &&
108
- html` <${Confirmation} callback=${handleDelete} /> `}
109
- ${!(status === 'VERIFYING' || isDeleting || willDelete) &&
110
- !isReadOnly &&
111
- html`
112
- <div class=${styles.deleteIcon} onclick=${handleWillDelete}>
113
- <svg
114
- width="15"
115
- height="15"
116
- viewBox="0 0 15 15"
117
- fill="none"
118
- xmlns="http://www.w3.org/2000/svg"
119
- >
120
- <path d="M1.5 4.1999H13.65" stroke="#F05C42" />
121
- <path
122
- d="M11.6254 5.5498V6.2248L10.9504 13.6498H4.20039L3.52539 6.2248V5.5498"
123
- stroke="#F05C42"
124
- stroke-linejoin="round"
125
- />
126
- <path
127
- 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"
128
- stroke="#F05C42"
129
- />
130
- </svg>
131
- </div>
132
- `}
133
- </div>
134
- <//>
135
- `;
136
- };
137
-
138
- const MarketplaceApps = (props: any) => {
139
- const {
140
- genericData,
141
- renderMode,
142
- userConfig,
143
- appName,
144
- fetchAll,
145
- useLoadMoreButton,
146
- } = props;
147
- const context = useContext(AppContext);
148
- const [apps, setApps] = useState<any[]>([]);
149
- const [filteredApps, setFilteredApps] = useState<any[]>([]);
150
- const [isFetchingApps, setIsFetchingApps] = useState<boolean>(true);
151
- const [searchText, setSearchText] = useState<string>('');
152
- const [totalApps, setTotalApps] = useState<number>(0);
153
- const [cursor, setCursor] = useState<string>('');
154
- const [filteredAppsCount, setFilteredAppsCount] = useState<number>(0);
155
- const [loadingNextPage, setLoadingNextPage] = useState<boolean>(false);
156
- const [searchInProgress, setSearchInProgress] = useState<boolean>(false);
157
- const [selectedApp, setSelectedApp] = useState<any>(null);
158
- const [
159
- selectedAppConnectedAccounts,
160
- setSelectedAppConnectedAccounts,
161
- ] = useState<any[]>([]);
162
- const [willDeleteAuthWithIndex, setWillDeleteAuthWithIndex] = useState<
163
- number | null
164
- >(null);
165
- const [allowMultipleAuths, setAllowMultipleAuth] = useState<boolean>(true);
166
-
167
- const DEBOUNCE_DELAY = 500;
168
- const debounceTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);
169
-
170
- const getApps = ({
171
- currentApps = <any>[],
172
- search = '',
173
- initialLoad = false,
174
- nextCursor = '',
175
- }) => {
176
- setIsFetchingApps(true);
177
-
178
- const cursorToUse = nextCursor || cursor;
179
-
180
- context?.apiHandler
181
- .getMarketplaceAppsV2({
182
- cursor: search !== '' ? null : cursorToUse,
183
- search,
184
- fetchAll,
185
- })
186
- .then((appsResponse) => {
187
- const tempApps = appsResponse.apps.map((app: any) => ({
188
- ...app,
189
- }));
190
- if (appsResponse._cursor || search === '') {
191
- // we don't want to
192
- setCursor(appsResponse._cursor);
193
- }
194
-
195
- setTotalApps(appsResponse.count || (tempApps || []).length);
196
- if (search === '') {
197
- setFilteredApps((prev) => [...prev, ...tempApps]);
198
- } else {
199
- setFilteredApps(tempApps);
200
- }
201
-
202
- if (initialLoad) {
203
- setApps((prev) => [...prev, ...tempApps]);
204
- }
205
- setIsFetchingApps(false);
206
- setLoadingNextPage(false);
207
- setSearchInProgress(false);
208
- })
209
- .catch((error) => {
210
- // eslint-disable-next-line no-console
211
- console.log('error', { error });
212
- setIsFetchingApps(false);
213
- setLoadingNextPage(false);
214
- setSearchInProgress(false);
215
- });
216
- };
217
-
218
- const handleScroll = (e: any) => {
219
- const bottom =
220
- Math.floor(e.target.scrollHeight) ===
221
- Math.floor(e.target.scrollTop + e.target.clientHeight);
222
-
223
- if (bottom && !isFetchingApps && cursor && !loadingNextPage) {
224
- // Trigger the next page load when at the bottom
225
- setLoadingNextPage(true);
226
- getApps({
227
- currentApps: filteredApps,
228
- search: searchText,
229
- initialLoad: true, // we consider the next page to be part of the initial load
230
- nextCursor: cursor, // Use the cursor for pagination
231
- });
232
- }
233
- };
234
-
235
- const filterApps = (inputString: string, items: any) => {
236
- const cleanedInput = inputString.trim(); // Remove trailing spaces
237
- setSearchInProgress(true);
238
-
239
- if (cleanedInput === '') {
240
- setFilteredApps(items); // Set the apps when there's no search input
241
- return items;
242
- }
243
-
244
- setFilteredApps([]); // Clear the apps on each input change
245
-
246
- // Clear the previous timeout to avoid executing the previous search
247
- if (debounceTimeout.current) {
248
- clearTimeout(debounceTimeout.current);
249
- }
250
-
251
- // Set a new debounce timeout to trigger the search after the delay
252
- debounceTimeout.current = setTimeout(() => {
253
- // Call the server-side function to fetch apps based on the search term
254
- getApps({ currentApps: items, search: cleanedInput });
255
- }, DEBOUNCE_DELAY); // Delay search until user stops typing
256
-
257
- return [];
258
- };
259
-
260
- const handleGoBackToApps = () => {
261
- setSelectedApp(null);
262
- };
263
-
264
- const onAuthResponseReceived = (messageEvent: MessageEvent<AuthData>) => {
265
- if (isAuthMessage(messageEvent) && messageEvent.data.activity_name) {
266
- const tempAccounts = [
267
- ...selectedAppConnectedAccounts,
268
- {
269
- id: messageEvent.data.authorization_id,
270
- display_name: messageEvent.data.user_identity,
271
- },
272
- ];
273
- if (selectedApp && !selectedApp.allow_multiple_connected_accounts) {
274
- setAllowMultipleAuth(false);
275
- }
276
- setSelectedAppConnectedAccounts(tempAccounts);
277
- if (isBrowser())
278
- window.removeEventListener('message', onAuthResponseReceived);
279
- }
280
- };
281
-
282
- const openAuthWindow = () => {
283
- if (isBrowser()) window.addEventListener('message', onAuthResponseReceived);
284
- if (context && selectedApp && allowMultipleAuths) {
285
- const url = selectedApp.login_url;
286
- openPopupWindow(url, 'Auth Window', window, 800, 600);
287
- }
288
- };
289
-
290
- const deleteAuth = (authIndex: number) => {
291
- const auth = selectedAppConnectedAccounts[authIndex];
292
-
293
- context?.apiHandler
294
- .deleteAuth(auth.id)
295
- .then((res) => {
296
- if (res?.status === 200) {
297
- if (selectedAppConnectedAccounts && authIndex >= 0) {
298
- selectedAppConnectedAccounts.splice(authIndex, 1);
299
- if (selectedAppConnectedAccounts.length === 0) {
300
- setAllowMultipleAuth(true);
301
- }
302
- }
303
- const eventPayload = selectedApp;
304
- eventPayload.connected_account_id = auth.id;
305
- context.eventEmitter.emit('app-disconnected', eventPayload);
306
- }
307
- })
308
- .catch((err) => {
309
- console.error(err);
310
- })
311
- .finally(() => {
312
- // setWillDeleteAuth(false);
313
- // setIsDeletingAuth(false);
314
- setWillDeleteAuthWithIndex(null);
315
- });
316
- };
317
-
318
- const willDelete = (authIndex: number) => {
319
- setWillDeleteAuthWithIndex(authIndex);
320
- };
321
-
322
- const getApp = (_appName: string) => {
323
- context?.apiHandler.getApp(_appName).then((app) => {
324
- setSelectedApp(app);
325
- if (
326
- app.allow_multiple_connected_accounts ||
327
- app.connected_accounts.length === 0
328
- ) {
329
- setAllowMultipleAuth(true);
330
- } else {
331
- setAllowMultipleAuth(false);
332
- }
333
- setIsFetchingApps(false);
334
- });
335
- };
336
-
337
- useEffect(() => {
338
- if (appName && appName !== '') {
339
- getApp(appName);
340
- } else {
341
- getApps({
342
- currentApps: apps,
343
- search: '',
344
- initialLoad: true,
345
- });
346
- }
347
- }, []);
348
-
349
- useEffect(() => {
350
- setSelectedAppConnectedAccounts(selectedApp?.connected_accounts || []);
351
- }, [selectedApp]);
352
- return html`
353
- <div
354
- id="embed--appsContainer"
355
- class="${renderMode === 'INLINE'
356
- ? styles.appsContainerInline
357
- : styles.appsContainer}
358
- ${genericData.viewStyle === ViewStyles.COMPACT
359
- ? styles['compact-view']
360
- : ''}"
361
- style="${renderMode === 'INLINE' && props.showMarketplaceModal
362
- ? 'display: flex;'
363
- : ''}"
364
- >
365
- <div
366
- id="apps-header"
367
- class="${styles.appsHeader} ${selectedApp
368
- ? styles.appsHeaderWithBorder
369
- : ''}"
370
- >
371
- ${selectedApp
372
- ? html`
373
- <div class="${styles.backLink} ${styles.appsHeaderTitle}">
374
- ${!appName &&
375
- html`<svg
376
- width="33"
377
- height="33"
378
- viewBox="0 0 33 33"
379
- fill="none"
380
- xmlns="http://www.w3.org/2000/svg"
381
- onclick=${handleGoBackToApps}
382
- >
383
- <circle
384
- cx="16.6758"
385
- cy="16.5684"
386
- r="15.5"
387
- fill="white"
388
- stroke="#E0E0E0"
389
- />
390
- <path
391
- 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
392
- 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
393
- 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
394
- 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
395
- 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
396
- 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"
397
- fill="#4250F0"
398
- />
399
- </svg>`}
400
- ${selectedApp &&
401
- html`<img
402
- src=${selectedApp.icon_url}
403
- title="${selectedApp.title}"
404
- />`}
405
-
406
- <p class="${styles.backLabel}">
407
- ${selectedApp ? selectedApp.title : 'Apps'}
408
- </p>
409
- </div>
410
- `
411
- : html`
412
- <p id="appsHeaderTitle" class=${styles.appsHeaderTitle}>
413
- ${(() => {
414
- if (selectedApp) {
415
- return selectedApp.title;
416
- }
417
- if (appName) {
418
- return 'Loading...';
419
- }
420
- return 'Apps';
421
- })()}
422
- </p>
423
- `}
424
- ${!selectedApp &&
425
- !appName &&
426
- html`<div id="search-container" class=${styles.searchContainer}>
427
- <svg
428
- xmlns="http://www.w3.org/2000/svg"
429
- width="15"
430
- height="15"
431
- viewBox="0 0 15 15"
432
- fill="none"
433
- >
434
- <path
435
- 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"
436
- fill="#BDBDBD"
437
- />
438
- </svg>
439
- <input
440
- id="search-apps-flow-lifecycle"
441
- class=${styles.searchInput}
442
- placeholder="${userConfig.searchPlaceholder || 'Search for apps'}"
443
- value=${searchText}
444
- oninput=${(e: any) => {
445
- setSearchText(e.target.value);
446
- filterApps(e.target.value, apps);
447
- }}
448
- />
449
- ${searchText !== '' &&
450
- html` <svg
451
- class=${styles.clearCta}
452
- onclick=${() => {
453
- setSearchText('');
454
- filterApps('', apps);
455
- }}
456
- xmlns="http://www.w3.org/2000/svg"
457
- width="12"
458
- height="12"
459
- viewBox="0 0 12 12"
460
- fill="none"
461
- >
462
- <path
463
- d="M10.2426 10.2425L1.75732 1.75732"
464
- stroke="#333333"
465
- stroke-width="1.33333"
466
- stroke-linecap="round"
467
- />
468
- <path
469
- d="M10.2426 1.75732L1.75732 10.2425"
470
- stroke="#333333"
471
- stroke-width="1.33333"
472
- stroke-linecap="round"
473
- />
474
- </svg>`}
475
- </div>`}
476
- </div>
477
-
478
- ${true &&
479
- filteredApps.length < 1 &&
480
- !selectedApp &&
481
- html` <div
482
- id="appsForFlowsCardsNoAppFound"
483
- class=${styles.appsForFlowsCardsNoAppFound}
484
- >
485
- ${searchText !== '' &&
486
- html` ${isFetchingApps && html`<${LargeLoader} />`}
487
- ${!searchInProgress && html`<p>Sorry, no apps found.</p>`}`}
488
- ${searchText === '' &&
489
- html` ${isFetchingApps && html`<${LargeLoader} />`}
490
- ${!isFetchingApps && html`<p>Sorry, no apps found.</p>`}`}
491
- </div>`}
492
- ${true &&
493
- (filteredApps.length > 0 || selectedApp) &&
494
- html`
495
- ${selectedApp
496
- ? html`<div
497
- class="${styles.marketplaceAuthSelectorWrap} integry-container__auth-selector"
498
- >
499
- <div class="${styles.heading}">Connected Accounts</div>
500
- <div class=${styles.rows}>
501
- ${selectedAppConnectedAccounts.map(
502
- (el: any, index: number) => html`<${AuthorizationRow}
503
- id=${el.id}
504
- value=${el.display_name}
505
- status=${`CONNECTED`}
506
- handleDelete=${(shouldDelete: boolean) =>
507
- shouldDelete
508
- ? deleteAuth(index)
509
- : setWillDeleteAuthWithIndex(null)}
510
- handleWillDelete=${() => willDelete(index)}
511
- willDelete=${willDeleteAuthWithIndex === index}
512
- />`,
513
- )}
514
- </div>
515
- ${true &&
516
- html`
517
- <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
518
- <div
519
- data-hint="${allowMultipleAuths
520
- ? ''
521
- : `You cannot connect more than one account for ${selectedApp.title}.`}"
522
- class="${styles.checkboxRow} ${styles.buttonShadow} ${styles.marketplaceAddAccountBtn} ${allowMultipleAuths
523
- ? ''
524
- : styles.disabled}"
525
- onclick=${openAuthWindow}
526
- >
527
- <span>+</span>
528
- <p>Add account</p>
529
- </div>
530
- <//>
531
- `}
532
- </div>`
533
- : html`<div
534
- id="${`embed--appsForFlowsCardsComfortable__${renderMode}`}"
535
- onscroll=${!useLoadMoreButton ? handleScroll : undefined}
536
- class="${props.genericData.viewStyle === ViewStyles.COMPACT
537
- ? styles.appsForFlowsCardsCompact
538
- : styles.appsForFlowsCards}"
539
- >
540
- ${filteredApps.map(
541
- (app: any) =>
542
- html`
543
- <${genericData.viewStyle === ViewStyles.COMPACT
544
- ? AppCardCompact
545
- : AppCard}
546
- key=${app.id}
547
- app=${app}
548
- onAppClick=${(appClicked: any) => {
549
- setSelectedApp(appClicked);
550
- }}
551
- />
552
- `,
553
- )}
554
- ${cursor &&
555
- html`<div
556
- class="${styles.loadMore}"
557
- onclick=${() => {
558
- setLoadingNextPage(true);
559
- getApps({
560
- currentApps: apps,
561
- });
562
- }}
563
- >
564
- ${loadingNextPage
565
- ? html`<${ThreeDotLoader} color="#999" />`
566
- : html`${useLoadMoreButton ? html`<a>Load more</a>` : ''}`}
567
- </div>`}
568
- </div>`}
569
- `}
570
- ${!isFetchingApps &&
571
- html`<${Footer}
572
- style=${renderMode === 'INLINE'
573
- ? 'padding-top: 12px;'
574
- : 'padding-top: 12px; box-shadow: 0px -6px 10px 0px rgba(255, 255, 255, 0.8);'}
575
- />`}
576
- </div>
577
- `;
578
- };
579
-
580
- export default connect<StoreType, unknown, StoreType, unknown>(
581
- ['genericData', 'userConfig', 'showMarketplaceModal'],
582
- actionFunctions,
583
- )(MarketplaceApps);