@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,536 +0,0 @@
1
- /* eslint-disable no-nested-ternary */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- import { NestedObject } from '@/interfaces';
4
- import { html } from 'htm/preact';
5
- import { createRef } from 'preact';
6
- import { useEffect, useRef, useState } from 'preact/hooks';
7
- import { isScrolledIntoView } from '@/utils/common';
8
- import { searchJSON } from '@/utils/searchJson';
9
- import { Input } from '@/components/Input';
10
- // import TagsMenuComponent from '@/components/React/TagsMenu';
11
- import { TagsMenu } from '@/components/TagsMenu';
12
- import { TagOptions } from '../TagOptions';
13
- import { ThreeDotLoader } from '../../ThreeDotLoader';
14
- import styles from './styles.module.scss';
15
-
16
- // component to show tags in the tag menu
17
-
18
- // enum for active tab
19
- export enum Tabs {
20
- Values = 'values',
21
- AppFields = 'AppFields',
22
- }
23
- interface Option {
24
- value: string;
25
- id: string;
26
- isSelected?: boolean;
27
- icon?: string;
28
- description?: string;
29
- }
30
- interface FieldMenuProps {
31
- tags: NestedObject;
32
- options?: Option[];
33
- appName?: string;
34
- onTagClick?: (tag: string) => void;
35
- onOptionClick?: (option: Option) => void;
36
- hideTabs?: boolean;
37
- defaultTab?: Tabs.AppFields | Tabs.Values;
38
- fieldId?: string;
39
- value?: string;
40
- onTabSelect?: (tab: Tabs) => void;
41
- isMappable?: boolean;
42
- isEditable?: boolean;
43
- enableSearch?: boolean;
44
- refreshRootStepData?: (callback?: any) => void;
45
- handleRefreshClick?: (callback?: any, nextPage?: string) => void;
46
- isErrorOnLoadingOptions?: boolean;
47
- isMultiSelect?: boolean;
48
- loadingOptions?: boolean;
49
- nextPage?: string;
50
- tagsComponent?: any;
51
- isDynamic?: boolean;
52
- tagsTree?: any;
53
- showMenuOnLeft?: boolean; // used when showing mapping menu in web app.
54
- }
55
-
56
- const customComponent = (props: { element: any }) => {
57
- const { element } = props;
58
- return html` <${element} /> `;
59
- };
60
-
61
- const FieldDropdown = (props: FieldMenuProps) => {
62
- const {
63
- appName = '',
64
- tags = {},
65
- options = [],
66
- hideTabs = false,
67
- defaultTab = Tabs.AppFields,
68
- onTagClick = () => null,
69
- onOptionClick = () => null,
70
- fieldId = '',
71
- value,
72
- onTabSelect,
73
- isEditable = false,
74
- enableSearch = false,
75
- refreshRootStepData,
76
- handleRefreshClick,
77
- isErrorOnLoadingOptions = false,
78
- isMultiSelect = false,
79
- loadingOptions = false,
80
- nextPage = '',
81
- isDynamic = true,
82
- tagsTree = null,
83
- isMappable = false,
84
- showMenuOnLeft = false,
85
- } = props;
86
-
87
- // Set active tab in state
88
- const [activeTab, setActiveTab] = useState(defaultTab);
89
- const menuItemRefs = useRef<any>([]);
90
- const tagMenyStyleRef = useRef<{ bottom?: string } | null>(null);
91
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
92
- const [renderAgain, setRenderAgain] = useState(false);
93
- const [searchValue, setSearchValue] = useState('');
94
- const [isLoadingRootStepData, setisLoadingRootStepData] = useState(false);
95
- const [
96
- isErrorOnLoadingRootStepData,
97
- setIsErrorOnLoadingRootStepData,
98
- ] = useState(false);
99
- const [isLoadingOptions, setisLoadingOptions] = useState(loadingOptions);
100
- const [isLoadingMoreOptions, setIsLoadingMoreOptions] = useState(false);
101
-
102
- useEffect(() => {
103
- let optionsToProcess = options;
104
- if (!Array.isArray(options)) {
105
- optionsToProcess = [];
106
- }
107
- menuItemRefs.current = (optionsToProcess || []).map(
108
- (element, i) => menuItemRefs.current[i] ?? createRef(),
109
- );
110
- }, [options]);
111
-
112
- const isContentOverflowing = (menuItemRef: any): boolean => {
113
- if (menuItemRef && menuItemRef.current) {
114
- return menuItemRef.current.clientWidth < menuItemRef.current.scrollWidth;
115
- }
116
- return false;
117
- };
118
-
119
- /* set menu position relative to parent container,
120
- as the menu position is fixed to make it visible outside the scrollable area */
121
- const parentContainer = document.getElementById(fieldId);
122
- const getDynamicTagMenuPosition = (): any => {
123
- const top = parentContainer
124
- ? parentContainer.getBoundingClientRect().bottom
125
- : '';
126
- let tagMenuStyle = {
127
- top: parentContainer ? `${top}px` : '',
128
- left: parentContainer
129
- ? `${parentContainer.getBoundingClientRect().left}px`
130
- : '',
131
- display:
132
- parentContainer &&
133
- !isScrolledIntoView(parentContainer, 'steps-body-container')
134
- ? 'none'
135
- : 'block',
136
- maxWidth: parentContainer
137
- ? `${
138
- parentContainer.getBoundingClientRect().width - (tagsTree ? 0 : 0)
139
- }px`
140
- : '342px',
141
- } as any;
142
- if (
143
- parentContainer &&
144
- parentContainer.getBoundingClientRect().bottom +
145
- 210 /* 210 is maxheight of tagMenu */ >
146
- window.innerHeight - 8
147
- ) {
148
- // if tagMenu is overflowing window, display it above the field
149
- tagMenuStyle = {
150
- bottom: `${
151
- window.innerHeight - parentContainer.getBoundingClientRect().top
152
- }px`,
153
- left: parentContainer
154
- ? `${parentContainer.getBoundingClientRect().left}px`
155
- : '',
156
- display:
157
- parentContainer &&
158
- !isScrolledIntoView(parentContainer, 'steps-body-container')
159
- ? 'none'
160
- : 'block',
161
- maxWidth: parentContainer
162
- ? `${parentContainer.getBoundingClientRect().width}px`
163
- : '342px',
164
- };
165
- }
166
- return tagMenuStyle;
167
- };
168
-
169
- const getDynamicTagMenuPositionLeftAligned = (): any => {
170
- let tagMenuStyle = {} as any;
171
-
172
- if (parentContainer) {
173
- const parentRect = parentContainer.getBoundingClientRect();
174
- const estimatedMenuWidth = 210; // Estimated width for the menu
175
- const estimatedMenuHeight = 400; // Estimated height for the menu (same as the 210 value mentioned in your original code)
176
-
177
- // Position the menu to the left of the parent container
178
- tagMenuStyle = {
179
- top: `${parentRect.top}px`,
180
- right: `${window.innerWidth - parentRect.left}px`, // This positions it to the left of the container
181
- display: !isScrolledIntoView(parentContainer, 'steps-body-container')
182
- ? 'none'
183
- : 'block',
184
- };
185
-
186
- // Check if the tag menu would overflow to the left of the window
187
- if (parentRect.left - estimatedMenuWidth < 0) {
188
- // If it would overflow to the left, position it to the right of the parent instead
189
- tagMenuStyle = {
190
- ...tagMenuStyle,
191
- right: 'auto', // Clear the right property
192
- left: `${parentRect.right}px`,
193
- };
194
- }
195
-
196
- // Check if the menu would overflow vertically
197
- if (parentRect.top + estimatedMenuHeight > window.innerHeight - 8) {
198
- // If it would overflow at the bottom, adjust the top position
199
- const availableHeight = window.innerHeight - 8 - parentRect.top;
200
- tagMenuStyle.maxHeight = `${availableHeight}px`;
201
-
202
- // If available height is too small, position above the parent instead
203
- if (availableHeight < 300) {
204
- // Minimum usable height
205
- tagMenuStyle.top = 'auto';
206
- tagMenuStyle.bottom = `${
207
- window.innerHeight - parentRect.top - parentRect.height
208
- }px`;
209
- tagMenuStyle.maxHeight = `${Math.min(
210
- estimatedMenuHeight,
211
- parentRect.top - 8,
212
- )}px`;
213
- }
214
- } else {
215
- tagMenuStyle.maxHeight = `${estimatedMenuHeight}px`;
216
- }
217
- } else {
218
- tagMenuStyle = {
219
- display: 'none',
220
- };
221
- }
222
-
223
- return tagMenuStyle;
224
- };
225
-
226
- tagMenyStyleRef.current = showMenuOnLeft
227
- ? getDynamicTagMenuPositionLeftAligned()
228
- : getDynamicTagMenuPosition();
229
-
230
- const onScroll = (): void => {
231
- tagMenyStyleRef.current = showMenuOnLeft
232
- ? getDynamicTagMenuPositionLeftAligned()
233
- : getDynamicTagMenuPosition();
234
- setRenderAgain((prev) => !prev);
235
- };
236
-
237
- const getFilteredOptions = (
238
- optionsToFilter: Option[] = [],
239
- searchText = '',
240
- ): Option[] => {
241
- if (searchText.trim().length === 0) {
242
- return optionsToFilter;
243
- }
244
- return optionsToFilter.filter((obj) =>
245
- obj.value.toLowerCase().includes(searchText.trim().toLowerCase()),
246
- );
247
- };
248
- const handleTabSelection = (tab: Tabs): void => {
249
- setActiveTab(tab);
250
- if (onTabSelect) {
251
- onTabSelect(tab);
252
- }
253
- };
254
- useEffect(() => {
255
- if (value && !hideTabs) {
256
- if (value.startsWith('{') && value.endsWith('}')) {
257
- handleTabSelection(Tabs.AppFields);
258
- }
259
- }
260
- window.addEventListener('scroll', onScroll, true);
261
- return () => window.removeEventListener('scroll', onScroll);
262
- }, []);
263
-
264
- const handleOnSearch = (val: string) => {
265
- setSearchValue(val);
266
- };
267
-
268
- const refreshCallback = (error = false) => {
269
- setisLoadingRootStepData(false);
270
- setIsErrorOnLoadingRootStepData(error);
271
- };
272
-
273
- const handleRefresh = () => {
274
- if (refreshRootStepData) {
275
- setisLoadingRootStepData(true);
276
- refreshRootStepData(refreshCallback);
277
- }
278
- };
279
- let selectedValues: any = [];
280
- if (value) {
281
- if (isMultiSelect) {
282
- try {
283
- selectedValues = JSON.parse(value);
284
- selectedValues = Array.isArray(selectedValues)
285
- ? selectedValues
286
- : [String(selectedValues)];
287
- } catch (e) {
288
- selectedValues = [String(value)];
289
- }
290
- } else {
291
- selectedValues = [value];
292
- }
293
- }
294
-
295
- const popoverBottom = tagMenyStyleRef?.current?.bottom;
296
- const popoverTop = (tagMenyStyleRef?.current as {
297
- top?: string;
298
- bottom?: string;
299
- })?.top;
300
- // remove px from end and convert to number
301
- const popoverVertical = popoverBottom
302
- ? `bottom: ${Number(popoverBottom.replace('px', '')) + 10}px;`
303
- : popoverTop
304
- ? `top: ${Number(popoverTop.replace('px', '')) + 10}px;`
305
- : 'top: 0px;';
306
-
307
- return html` <div
308
- class=${showMenuOnLeft ? `${styles.tagMenuV2Container}` : ''}
309
- >
310
- ${showMenuOnLeft &&
311
- html`<div
312
- class="popover-arrow"
313
- style="position: fixed;border-top: 10px solid transparent;border-bottom: 10px solid transparent;border-left: 10px solid rgb(189, 189, 189);${popoverVertical}"
314
- ></div>`}
315
-
316
- <div
317
- class=${`${styles.tagMenu} ${tagsTree ? styles.tagMenuV2 : ''} ${
318
- enableSearch && !tagsTree ? styles.tagMenuWithSearch : ''
319
- }`}
320
- style=${parentContainer && tagMenyStyleRef?.current
321
- ? tagMenyStyleRef.current
322
- : ''}
323
- >
324
- ${enableSearch &&
325
- !tagsTree &&
326
- html`
327
- <div class=${styles.tagMenuSearch}>
328
- <${Input}
329
- id="search_${fieldId}"
330
- placeholder="Search for a field"
331
- value="${searchValue}"
332
- onChange="${handleOnSearch}"
333
- />
334
- </div>
335
- `}
336
- ${!hideTabs &&
337
- html`<div class=${styles.tagMenuHeader}>
338
- <div
339
- class=${`${styles.tagMenuHeaderItem} ${
340
- activeTab === Tabs.Values ? styles.active : ''
341
- }`}
342
- onClick=${() => handleTabSelection(Tabs.Values)}
343
- >
344
- Values
345
- </div>
346
- <div
347
- class=${`${styles.tagMenuHeaderItem} ${
348
- activeTab === Tabs.AppFields ? styles.active : ''
349
- }`}
350
- onClick=${() => handleTabSelection(Tabs.AppFields)}
351
- >
352
- ${appName ? `${appName} fields` : 'Fields'}
353
- </div>
354
- </div>`}
355
- <div
356
- class=${`${styles.tagMenuBody} ${
357
- enableSearch && !tagsTree ? styles.tagMenuBodyWithSearch : ''
358
- }`}
359
- >
360
- ${activeTab === Tabs.Values && (tagsTree === null || isDynamic)
361
- ? html`<div
362
- className=${styles.tagMenuBodyItem}
363
- id="tag-menu-body-item"
364
- >
365
- ${options.length > 0
366
- ? getFilteredOptions(options, searchValue).length > 0
367
- ? getFilteredOptions(options, searchValue).map(
368
- (option, i, arr) => {
369
- if (i === arr.length - 1) {
370
- setisLoadingOptions(false);
371
- }
372
- return html`
373
- <div
374
- class=${`${styles.value} ${
375
- option.icon ? styles.valueWithIcon : ''
376
- } ${
377
- selectedValues.includes(option.id)
378
- ? styles.selected
379
- : ''
380
- }`}
381
- onClick=${(e: Event) => {
382
- e.stopPropagation();
383
- onOptionClick(option);
384
- }}
385
- ref=${menuItemRefs.current[i]}
386
- >
387
- ${option.icon &&
388
- html`<img
389
- src="${option.icon}"
390
- alt="icon"
391
- class="${styles.icon}"
392
- />`}
393
- <div class="label-text">
394
- <div
395
- class="${option.description
396
- ? styles.nameWithDescription
397
- : ''}"
398
- >
399
- ${option.value}
400
- </div>
401
- ${option.description &&
402
- html`<div class="${styles.description}">
403
- ${option.description}
404
- </div>`}
405
- </div>
406
- </div>
407
-
408
- ${i !== arr.length - 1
409
- ? ''
410
- : html`<span>
411
- ${isLoadingOptions || isLoadingMoreOptions
412
- ? html`<${ThreeDotLoader} color="#999" />`
413
- : isDynamic
414
- ? html` <a
415
- className=${styles.optionsRefreshProminent}
416
- href="#"
417
- onclick=${(e: Event) => {
418
- e.preventDefault();
419
- if (handleRefreshClick) {
420
- setIsLoadingMoreOptions(true);
421
- handleRefreshClick(
422
- () =>
423
- setIsLoadingMoreOptions(false),
424
- nextPage,
425
- );
426
- }
427
- }}
428
- >${nextPage
429
- ? `Load more options`
430
- : `Reload options?`}</a
431
- >`
432
- : html``}
433
- </span>`}
434
- `;
435
- },
436
- )
437
- : html`<div className=${styles.noOptions}>
438
- Your search did not match any values
439
- </div>`
440
- : html`<div className=${styles.noOptions}>
441
- <span className=${styles.noOptionsRetry}>
442
- ${isLoadingOptions || loadingOptions
443
- ? html`<${ThreeDotLoader} color="#999" />`
444
- : html`${isErrorOnLoadingOptions
445
- ? 'Could not load options.'
446
- : 'No options found.'}
447
- <a
448
- className=${styles.optionsRefresh}
449
- href="#"
450
- onclick=${(e: Event) => {
451
- e.preventDefault();
452
- if (handleRefreshClick) {
453
- setisLoadingOptions(true);
454
- handleRefreshClick(() =>
455
- setisLoadingOptions(false),
456
- );
457
- }
458
- }}
459
- >
460
- ${' '}Try again?</a
461
- >`}
462
- </span>
463
- </div>`}
464
- </div>`
465
- : html` <div className="${styles.mappedFieldMenu}">
466
- ${tagsTree
467
- ? html`<${TagsMenu}
468
- tagsTree=${tagsTree}
469
- onSelect=${onTagClick}
470
- renderValuesTab=${activeTab === Tabs.Values &&
471
- !isDynamic &&
472
- isMappable}
473
- options=${options}
474
- onOptionClick=${onOptionClick}
475
- />`
476
- : html`${Object.keys(
477
- !isEditable ? searchJSON(tags, searchValue) : tags,
478
- ).length > 0
479
- ? Object.keys(
480
- !isEditable ? searchJSON(tags, searchValue) : tags,
481
- ).map(
482
- (objKey, index, arr) => html`
483
- <${TagOptions}
484
- objectKey="${objKey}"
485
- keyValue="${objKey}"
486
- objectData="${!isEditable
487
- ? searchJSON(tags, searchValue)[objKey]
488
- : tags[objKey]}"
489
- onSelect=${onTagClick}
490
- isRoot="${true}"
491
- />
492
- ${index !== arr.length - 1
493
- ? ''
494
- : html`<span>
495
- ${isLoadingRootStepData
496
- ? html`<${ThreeDotLoader} color="#999" />`
497
- : html` <a
498
- className=${styles.optionsRefreshProminent}
499
- href="#"
500
- onclick=${handleRefresh}
501
- >Reload fields?</a
502
- >`}
503
- </span>`}
504
- `,
505
- )
506
- : html`<div className=${styles.noOptions}>
507
- ${!isEditable && searchValue !== ''
508
- ? 'Your search did not match any fields'
509
- : html`
510
- <span className=${styles.noOptionsRetry}>
511
- ${isLoadingRootStepData
512
- ? html`<${ThreeDotLoader} color="#999" />`
513
- : html`${isErrorOnLoadingRootStepData
514
- ? 'Could not load fields.'
515
- : 'No fields found.'}
516
- <a
517
- className=${styles.optionsRefresh}
518
- href="#"
519
- onclick=${(e: any) => {
520
- e.preventDefault();
521
- e.stopPropagation();
522
- handleRefresh();
523
- }}
524
- >
525
- ${' '}Try again?</a
526
- >`}
527
- </span>
528
- `}
529
- </div>`}`}
530
- </div>`}
531
- </div>
532
- </div>
533
- </div>`;
534
- };
535
-
536
- export { FieldDropdown, FieldMenuProps };
@@ -1,175 +0,0 @@
1
- .tagMenu {
2
- width: 100%;
3
- max-width: 342px;
4
- max-height: 210px;
5
- background: #ffffff;
6
- box-shadow: rgba(0, 0, 0, 0.2) 0px 10px 30px 0px;
7
- border: 1px solid #e2e0db;
8
- border-radius: 4px;
9
- padding: 12px;
10
- overflow-y: auto;
11
- margin-top: 0px;
12
- position: fixed;
13
- z-index: 999;
14
- height: max-content;
15
-
16
- &::-webkit-scrollbar {
17
- width: 7px;
18
- }
19
-
20
- /* Track */
21
- &::-webkit-scrollbar-track {
22
- // background: #f1f1f1;
23
- background: transparent;
24
- border-radius: 8px;
25
- }
26
-
27
- /* Handle */
28
- &::-webkit-scrollbar-thumb {
29
- background: #bdbdbd;
30
- border: 1px solid #bdbdbd;
31
- border-radius: 8px;
32
- }
33
-
34
- /* Handle on hover */
35
- &::-webkit-scrollbar-thumb:hover {
36
- background: rgb(116, 116, 116);
37
- }
38
-
39
- .tagMenuHeader {
40
- display: flex;
41
- justify-content: start;
42
- align-items: center;
43
- margin-bottom: 16px;
44
- gap: 8px;
45
- .tagMenuHeaderItem {
46
- padding: 6px 12px;
47
- background: #f2f2f2;
48
- border-radius: 5px;
49
- font-weight: 400;
50
- font-size: 10px;
51
- line-height: 12px;
52
- color: #333333;
53
- cursor: pointer;
54
- &.active {
55
- background: #4250f0;
56
- color: #ffffff;
57
- }
58
- }
59
- }
60
- .tagMenuBody {
61
- min-height: 15px;
62
- .tagMenuBodyItem {
63
- .value {
64
- box-sizing: border-box;
65
- height: 31px;
66
- padding: 8px 0px 8px 12px;
67
- width: 100%;
68
- font-size: 12px;
69
- line-height: 15px;
70
- color: #333333;
71
- overflow: hidden;
72
- white-space: nowrap;
73
- text-overflow: ellipsis;
74
- margin-bottom: 5px;
75
- cursor: pointer;
76
- &:hover {
77
- background: rgba(66, 80, 240, 0.1);
78
- border-radius: 5px !important;
79
- }
80
- }
81
- .valueWithIcon {
82
- display: flex;
83
- align-items: center;
84
- gap: 8px; /* Adjust spacing between image and text */
85
- height: 40px !important;
86
- }
87
- .icon {
88
- width: 20px;
89
- height: 20px;
90
- }
91
-
92
- .description {
93
- font-size: 0.85em;
94
- color: #666;
95
- width: 31.5rem;
96
- text-overflow: ellipsis;
97
- overflow: hidden;
98
- }
99
- .nameWithDescription {
100
- font-weight: 500;
101
- }
102
- .selected {
103
- background: rgba(66, 80, 240, 0.1);
104
- border-radius: 5px;
105
- }
106
- }
107
- }
108
- .noOptions {
109
- font-weight: 400;
110
- font-size: 12px;
111
- line-height: 15px;
112
- margin-left: 16px;
113
- color: #999;
114
- span.noOptionsRetry {
115
- [class^='styles-module_loader_'] {
116
- position: relative;
117
- top: 5px;
118
- }
119
- }
120
- }
121
- a.optionsRefreshProminent {
122
- display: flex;
123
- justify-content: center;
124
- align-items: center;
125
- padding: 8px;
126
- font-size: 12px;
127
- line-height: 15px;
128
- color: #4250f0;
129
- cursor: pointer;
130
- text-decoration: none;
131
- }
132
- a.optionsRefresh {
133
- font-size: 12px;
134
- line-height: 15px;
135
- color: #4250f0;
136
- cursor: pointer;
137
- text-decoration: none;
138
- }
139
- }
140
- .tagMenuSearch {
141
- position: relative;
142
- margin-bottom: 5px;
143
- fieldset {
144
- margin-bottom: 5px;
145
- }
146
- }
147
-
148
- .tagMenuWithSearch {
149
- padding-top: 0px;
150
- }
151
- .tagMenuBodyWithSearch {
152
- max-height: 142px;
153
- overflow-y: auto;
154
- span {
155
- padding-left: 3px !important;
156
- }
157
- }
158
-
159
- .tagMenuV2 {
160
- height: max-content;
161
- max-height: 405px !important;
162
- max-width: 550px !important;
163
- overflow: hidden;
164
- min-width: 470px;
165
- margin-right: 10px;
166
- width: fit-content !important;
167
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 10px 20px rgba(0, 0, 0, 0.1),
168
- 0 4px 8px rgba(0, 0, 0, 0.05) !important;
169
- }
170
- .tagMenuV2Container {
171
- display: block;
172
- position: absolute;
173
- left: -10px;
174
- top: 0;
175
- }