@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,944 +0,0 @@
1
- 'use client';
2
-
3
- /* eslint-disable no-nested-ternary */
4
- import { html } from 'htm/preact';
5
- import { useState, useRef, useEffect } from 'preact/hooks';
6
- import { Input } from '@/components/Input';
7
- import { TextArea } from '@/components/TextArea';
8
- import { useOnClickOutside } from '@/hooks/useOnClickOutside';
9
- import { FieldDropdown } from '@/components/MultipurposeField/TagMenu';
10
- import type { NestedObject } from '@/interfaces';
11
- import type { TagProps } from '@/components/Tag';
12
- // import { TagsMenu } from '@/components/TagsMenu';
13
- // @ts-ignore
14
- import Tagify from '@yaireo/tagify';
15
- import '@yaireo/tagify/dist/tagify.css'; // Tagify CSS
16
- import styles from './styles.module.scss';
17
-
18
- interface MultipurposeFieldProps {
19
- activityOutputData: NestedObject;
20
- title: string;
21
- description: string;
22
- placeholder: string;
23
- value?: string;
24
- regex: string | null;
25
- regexErrorMessage: string | null;
26
- isRequired?: boolean;
27
- isHidden?: boolean;
28
- showStepValidation?: boolean;
29
- onChange?: (val: string, passesRegexTest?: boolean) => void;
30
- isChanged?: boolean;
31
- className?: string;
32
- containerClass: string;
33
- type: string;
34
- key: string;
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- apiHandler: any;
37
- isSearchable: boolean;
38
- endpointUrl: string;
39
- isDynamic: boolean;
40
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
- endpointData: any;
42
- skipOptionFetch: boolean;
43
- isMappable?: boolean;
44
- isEditable?: boolean;
45
- allowTagsInText?: boolean;
46
- accountConnected?: boolean;
47
- isConfigMode?: boolean;
48
- fieldId?: string;
49
- labelTags: TagProps[];
50
- activityOutputDataRaw: any;
51
- enableTagify?: boolean;
52
- refreshRootStepData?: (callback?: any) => void;
53
- isArray?: boolean;
54
- isButtonEnabled?: boolean;
55
- buttonText?: string;
56
- onButtonClickScript?: string;
57
- buttonScriptRequiresAuthToken?: boolean;
58
- tagsComponent?: any;
59
- tagsTree?: any;
60
- isDisabled?: boolean;
61
- showMenuOnLeft?: boolean;
62
- }
63
-
64
- const MultipurposeField = (props: MultipurposeFieldProps) => {
65
- const {
66
- activityOutputData = {},
67
- title,
68
- description,
69
- placeholder,
70
- value,
71
- regex,
72
- regexErrorMessage,
73
- isRequired,
74
- showStepValidation,
75
- onChange,
76
- isChanged,
77
- className,
78
- type,
79
- isMappable,
80
- isEditable,
81
- allowTagsInText,
82
- isHidden,
83
- isConfigMode = false,
84
- fieldId = 'dropdown-field',
85
- labelTags = [],
86
- activityOutputDataRaw = [],
87
- enableTagify = true,
88
- refreshRootStepData,
89
- isArray = false,
90
- isButtonEnabled = false,
91
- buttonText = 'Add',
92
- onButtonClickScript = '',
93
- buttonScriptRequiresAuthToken = false,
94
- tagsComponent = null,
95
- tagsTree = null,
96
- isDisabled = false,
97
- showMenuOnLeft = false,
98
- } = props;
99
- const [showTagMenu, setShowTagMenu] = useState(false);
100
- const [currentValue, setCurrentValue] = useState(value);
101
- const [newValue, setNewValue] = useState(value);
102
- const [tempPlaceholder, setTempPlaceholder] = useState('');
103
- const [searchValue, setSearchValue] = useState('');
104
- const [tagify, setTagify] = useState<Tagify | null>(null);
105
-
106
- const menuRef = useRef<HTMLDivElement | null>(null);
107
- const inputRef = useRef<HTMLInputElement>();
108
- const appIconMapRef = useRef<Record<string, string>>({});
109
-
110
- const handleTabKeyDown = (event: KeyboardEvent) => {
111
- if (event.key === 'Tab') {
112
- setShowTagMenu(false);
113
- }
114
- };
115
-
116
- const getFieldValFromActivityOutputRaw = (array: any, val: any) => {
117
- const valueToUse = (Array.isArray(val) ? val[val.length - 1] : val) || '';
118
- const results = valueToUse.toString().match(/{([^}]+)}/g);
119
- let valSubstituded = valueToUse;
120
- (results || []).forEach((tag: string) => {
121
- const tagCheck = tag.replace(/{|}/g, '');
122
- (array || []).forEach((arr: any) => {
123
- if (arr.value === tagCheck) {
124
- valSubstituded = valSubstituded.replace(tag, `{${arr.text}}`);
125
- }
126
- });
127
- });
128
- return valSubstituded;
129
- };
130
-
131
- useEffect(() => {
132
- const clrearTag = (e: KeyboardEvent) => {
133
- if (e.key === 'Backspace' && searchValue === '' && !isEditable) {
134
- setCurrentValue('');
135
- setNewValue('');
136
- if (onChange) onChange('', true);
137
- }
138
- };
139
- inputRef.current?.addEventListener('keydown', clrearTag);
140
- // cleanup function
141
- return () => {
142
- inputRef.current?.removeEventListener('keydown', clrearTag);
143
- };
144
- }, [inputRef.current, searchValue]);
145
-
146
- // useEffect to update the current value when the value prop changes
147
- useEffect(() => {
148
- setCurrentValue(value);
149
- setNewValue(getFieldValFromActivityOutputRaw(activityOutputDataRaw, value));
150
-
151
- // Attach the event listener when the component mounts
152
- document.addEventListener('keydown', handleTabKeyDown);
153
-
154
- // Clean up the event listener when the component unmounts
155
- return () => {
156
- document.removeEventListener('keydown', handleTabKeyDown);
157
- };
158
- }, [value, title]);
159
-
160
- // Helper function to extract step name from tag value
161
- const getStepNameFromValue = (tagValue: string): string | null => {
162
- const parts = tagValue.split('.');
163
- // For values like "steps.slack_post_message_1.output.ok", "storage.user_data.value",
164
- // "setup_form.api_key.value", "parameters.timeout.value" return the second part
165
- if (parts.length >= 2) {
166
- if (parts.length === 0) {
167
- return null;
168
- }
169
-
170
- // Determine if first segment is a known root key from tagsTree
171
- const rootKeys = tagsTree
172
- ? Object.keys(tagsTree).map((key) => {
173
- const node = tagsTree[key];
174
- return node?.machineName || key;
175
- })
176
- : [];
177
-
178
- if (parts.length >= 2 && rootKeys.includes(parts[0])) {
179
- return parts[1];
180
- }
181
- if (parts.length >= 2 && parts[0] === 'meta') {
182
- return parts[0];
183
- }
184
- // If there's no second part, return null
185
- return null;
186
- }
187
- return parts[0] || null;
188
- };
189
-
190
- // Build flattened appIcon map when tagsTree changes
191
- useEffect(() => {
192
- if (!tagsTree) {
193
- appIconMapRef.current = {};
194
- return;
195
- }
196
-
197
- const flattenedMap: Record<string, string> = {};
198
-
199
- // Traverse tagsTree and build flattened map
200
- const traverseAndMap = (tags: any[]) => {
201
- if (!Array.isArray(tags)) return;
202
-
203
- tags.forEach((tag) => {
204
- if (tag.machineName && tag.appIcon) {
205
- flattenedMap[tag.machineName] = tag.appIcon;
206
- }
207
- // Recursively traverse nested tags
208
- if (tag.tags && Array.isArray(tag.tags)) {
209
- traverseAndMap(tag.tags);
210
- }
211
- });
212
- };
213
-
214
- // Traverse all categories in tagsTree
215
- for (const categoryKey in tagsTree) {
216
- const category = tagsTree[categoryKey];
217
- if (category.tags && Array.isArray(category.tags)) {
218
- traverseAndMap(category.tags);
219
- }
220
- }
221
-
222
- appIconMapRef.current = flattenedMap;
223
- }, [tagsTree]);
224
-
225
- // Helper function to get appIcon from precomputed map
226
- const getAppIconFromMap = (stepName: string): string | null => {
227
- return appIconMapRef.current[stepName] || null;
228
- };
229
-
230
- useEffect(() => {
231
- const textfield = inputRef.current;
232
- const scalarValue = Array.isArray(value) ? value[0] : value;
233
- if (textfield && (activityOutputDataRaw.length || tagsTree !== null)) {
234
- const el: any = document.getElementById(`tagify_${fieldId}`);
235
- if (el && el.dataset.tagifyFieldId !== fieldId) {
236
- el.value = getDefaultTagifyValue(value || '');
237
- el.dataset.tagifyFieldId = fieldId;
238
- }
239
- if (el && !el.__tagify) {
240
- var tagify = new Tagify(el, {
241
- mode: 'mix',
242
- duplicates: true,
243
- editTags: false,
244
- trim: false,
245
- tagTextProp: 'text',
246
- templates: {
247
- tag: tagTemplate,
248
- },
249
- userInput: allowTagsInText || !isMappable ? true : false,
250
- });
251
- tagify
252
- .on('focus', handleFieldFocus)
253
- .on('blur', handleFieldBlur)
254
- .on('remove', handleOnTagRemove)
255
- .on('change', handleOnTagRemove);
256
- setTagify(tagify);
257
-
258
- tagify.on('click', (e: any) => {
259
- const tagData = e.detail.data;
260
- if (!tagData?.appIcon) {
261
- return; // Ignore clicks on tags without appIcon
262
- }
263
- const tagElm = e.detail.tag;
264
-
265
- // Remove the tag
266
- tagify.removeTag(tagElm);
267
-
268
- // Place caret after the removed tag
269
- const selection = window.getSelection();
270
- const range = document.createRange();
271
-
272
- // Insert editable text node (without appIcon in the text)
273
- const editableText = document.createTextNode(`{${tagData.value}} `);
274
-
275
- // Insert text after the removed tag
276
- tagElm.parentNode.insertBefore(editableText, tagElm.nextSibling);
277
-
278
- // Move caret to end of inserted text
279
- range.setStart(editableText, editableText.length);
280
- range.setEnd(editableText, editableText.length);
281
- selection?.removeAllRanges();
282
- selection?.addRange(range);
283
-
284
- // Optional: trigger input event so Tagify re-parses
285
- tagify.DOM.input.dispatchEvent(new Event('input'));
286
- });
287
-
288
- tagify.on('keydown', (e: any) => {
289
- if (
290
- e?.detail?.event?.code === 'Enter' &&
291
- tagsTree &&
292
- type === 'TEXTAREA'
293
- ) {
294
- e.preventDefault();
295
- document.execCommand('insertHTML', false, '<br><br>');
296
- return false;
297
- }
298
- });
299
- }
300
- } else if (
301
- textfield &&
302
- !activityOutputDataRaw.length &&
303
- !scalarValue?.startsWith('{') &&
304
- !scalarValue?.endsWith('}')
305
- ) {
306
- const el: any = document.getElementById(`tagify_${fieldId}`);
307
- if (el && el.dataset.tagifyFieldId !== fieldId) {
308
- el.value = getDefaultTagifyValue(scalarValue || '');
309
- el.dataset.tagifyFieldId = fieldId;
310
- }
311
- }
312
- }, [activityOutputDataRaw]);
313
-
314
- const handleTagInputChanged = (e: any) => {
315
- const textField = inputRef.current;
316
- if (textField) {
317
- const oldValue = textField.value;
318
- let newValue = oldValue;
319
- if (removeWhitespace(oldValue).length === 0) {
320
- newValue = '';
321
- }
322
- if (e.detail.textContent.length === 0) {
323
- newValue = '';
324
- }
325
- setCurrentValue(newValue);
326
- setNewValue(newValue);
327
- if (onChange) onChange(newValue, true);
328
- }
329
- };
330
- const handleOnTagRemove = (e: any) => {
331
- const el: any = document.getElementById(`tagify_${fieldId}`);
332
-
333
- let newValue = el.__tagify.DOM.input.innerText;
334
-
335
- // Process tags being removed
336
- el.__tagify.value.forEach((tag: any) => {
337
- newValue = newValue
338
- .replace(tag.text, `{${tag.value}}`)
339
- .replace('Step: ', '')
340
- .replace('User variable: ', '')
341
- .replace('Setup form: ', '');
342
- });
343
-
344
- newValue = newValue.trim();
345
- // remove zero width space
346
- newValue = newValue.replace(/\u200B/g, '');
347
- if (removeWhitespace(newValue).length === 0) {
348
- el.value = '';
349
- newValue = '';
350
- }
351
- newValue = newValue.replace(/<br>/g, '\n'); // replace <br> with newlines
352
- newValue = newValue.replace(/\n{/g, '{').replace(/}\n/g, '}'); // remove \n before and after tags
353
-
354
- setCurrentValue(newValue);
355
- if (onChange) onChange(newValue, true);
356
- };
357
- //write a function that removes all whitespaces including \s, \u200b, \u00A0
358
- const removeWhitespace = (str: string) => {
359
- return str
360
- .replace(/\s/g, '')
361
- .replace(/\u200b/g, '')
362
- .replace(/\u00A0/g, '');
363
- };
364
-
365
- const capitalize = (text: string) => {
366
- if (!text) return '';
367
- return text.charAt(0).toUpperCase() + text.slice(1);
368
- };
369
-
370
- const tagTemplate = (tagData: any) => {
371
- if (tagData.appIcon) {
372
- const origin = tagData.value.split('.')[0];
373
- let originText = capitalize(origin);
374
- switch (origin) {
375
- case 'steps':
376
- originText = 'Step';
377
- break;
378
- case 'storage':
379
- originText = 'User variable';
380
- break;
381
- case 'setup_form':
382
- originText = 'Setup form';
383
- break;
384
- default:
385
- originText = capitalize(origin);
386
- }
387
- return `
388
- <tag
389
- contenteditable='false'
390
- spellcheck='false'
391
- tabIndex="-1"
392
- class="tagify__tag ${tagData.class ? tagData.class : ''}"
393
- >
394
- <div class="${styles.tagifyTagTemplate}">
395
- <img class="${styles.tagifyAppIcon}" src="${
396
- tagData.appIcon
397
- }" alt="" />
398
- <span data-hint="${
399
- typeof tagData.title === 'string' ? tagData.title : ''
400
- }" class='tagify__tag-text'>${originText}: ${tagData.text}</span>
401
- </div>
402
- </tag>`;
403
- }
404
- return `
405
- <tag
406
- contenteditable='false'
407
- spellcheck='false'
408
- tabIndex="-1"
409
- class="tagify__tag ${tagData.class ? tagData.class : ''}"
410
- >
411
- <x title='' class='tagify__tag__removeBtn' role='button' aria-label='remove tag'></x>
412
- <div>
413
- <span data-hint="${
414
- typeof tagData.title === 'string' ? tagData.title : ''
415
- }" class='tagify__tag-text'>${tagData.text}</span>
416
- </div>
417
- </tag>`;
418
- };
419
-
420
- useEffect(() => {
421
- if (value && !isArray) {
422
- handleOnChange(value, true);
423
- }
424
- }, [fieldId]);
425
-
426
- // Returns all those strings which are enclosed in curly braces {}
427
- const getTags = (str: string) => {
428
- if (typeof str !== 'string') {
429
- return [];
430
- }
431
- return str.match(/{[^{}"'<>:]+}/g) || [];
432
- };
433
-
434
- const checkIfTagExists = (AOUElement: string, tagValue: string) => {
435
- if (tagValue.includes('out.')) {
436
- const tagValuePart = tagValue.split('out.')[1];
437
-
438
- return AOUElement.endsWith(tagValuePart);
439
- }
440
- return false;
441
- };
442
-
443
- const getDefaultTagifyValue = (value: any) => {
444
- const tags = getTags(value || '');
445
-
446
- if (tags && tags.length > 0) {
447
- let newValue = value;
448
-
449
- if (type === 'TEXTAREA') {
450
- newValue = newValue.replace(/\n/g, '<br>');
451
- }
452
-
453
- tags.forEach((tag) => {
454
- const tagValue = tag.replace(/{|}/g, '');
455
- const tagValueParts = tagValue.split('.');
456
-
457
- let tagData = (activityOutputDataRaw || []).find((element: any) => {
458
- return (
459
- element.value === tagValue ||
460
- checkIfTagExists(element.value, tagValue)
461
- );
462
- }) || {
463
- value: tagValue,
464
- text:
465
- tagValueParts.length > 0
466
- ? prettifyString(tagValueParts[tagValueParts.length - 1])
467
- : tagValue,
468
- title: tagValue,
469
- };
470
-
471
- // Try to get appIcon from tagsTree based on step name
472
- const stepName = getStepNameFromValue(tagValue);
473
- const appIconFromTree = stepName ? getAppIconFromMap(stepName) : null;
474
-
475
- if (appIconFromTree) {
476
- tagData.appIcon = appIconFromTree;
477
- }
478
-
479
- if (tagsTree) {
480
- tagData = {
481
- value: tagValue,
482
- text:
483
- tagValueParts.length > 0
484
- ? prettifyString(tagValueParts[tagValueParts.length - 1])
485
- : tagValue,
486
- title: tagValue,
487
- ...(appIconFromTree && { appIcon: appIconFromTree }),
488
- };
489
- }
490
-
491
- if (tagData) {
492
- // Include appIcon in the JSON if it exists
493
- const tagDataForJson = {
494
- value: tagData.value,
495
- text: tagData.text,
496
- title: getTagData(tagData.text),
497
- ...(tagData.appIcon && { appIcon: tagData.appIcon }),
498
- };
499
-
500
- newValue = newValue?.replace(
501
- tag,
502
- `[[${JSON.stringify(tagDataForJson)}]]`,
503
- );
504
- }
505
- });
506
-
507
- return newValue;
508
- }
509
-
510
- return value;
511
- };
512
-
513
- useOnClickOutside(menuRef, (e) => {
514
- const clickedElement = e.target as HTMLElement;
515
-
516
- if (
517
- (clickedElement.tagName === 'INPUT' ||
518
- clickedElement.tagName === 'TEXTAREA') &&
519
- inputRef.current &&
520
- inputRef.current.contains(e.target as Node)
521
- )
522
- return;
523
- setTempPlaceholder('');
524
- setSearchValue('');
525
- setShowTagMenu(false);
526
- });
527
-
528
- const removeSpecificString = (
529
- str: string,
530
- specificString: string,
531
- ): string => {
532
- let tempStr = str;
533
- if (tempStr.endsWith(specificString)) {
534
- tempStr = tempStr.slice(0, -specificString.length);
535
- }
536
-
537
- return tempStr;
538
- };
539
-
540
- const getTagData = (tag: string) => {
541
- if (tag.includes('.')) {
542
- const tagParts = tag.split('.');
543
- let tagValue: any = activityOutputData;
544
- tagParts.forEach((tagPart) => {
545
- if (tagValue[tagPart]) {
546
- tagValue = tagValue[tagPart];
547
- }
548
- });
549
- return tagValue;
550
- }
551
- return activityOutputData[tag] || '';
552
- };
553
-
554
- const prettifyString = (str: string) => {
555
- return str
556
- .replace(/_/g, ' ') // Replace underscores with spaces
557
- .replace(/\b\w/g, (c) => c.toUpperCase()); // Capitalize first letter of each word
558
- };
559
-
560
- const insertTag = (tag: string | any) => {
561
- let result = activityOutputDataRaw.find((element: any) => {
562
- return element.text === tag;
563
- });
564
- let isStandardTag = true;
565
- if (
566
- !result &&
567
- tag.hasOwnProperty('value') &&
568
- tag.hasOwnProperty('key') &&
569
- tag.hasOwnProperty('currentPath')
570
- ) {
571
- result = {
572
- value: tag.currentPath,
573
- text: tag.key,
574
- title: tag.value,
575
- appIcon: tag.parentAppIcon,
576
- };
577
- isStandardTag = false; // This tag is coming from TagsMenu component
578
- }
579
- if (tagify) {
580
- var tagElm = tagify.createTagElem({
581
- value: result.value,
582
- text: isStandardTag ? result.text : prettifyString(result.text),
583
- title: isStandardTag ? getTagData(tag) : result.title,
584
- appIcon: result.appIcon,
585
- editable: false,
586
- });
587
- tagify.injectAtCaret(tagElm);
588
- if (allowTagsInText) {
589
- var elm = tagify.insertAfterTag(tagElm, ''); // <- adds space after the tag
590
- tagify.placeCaretAfterNode(elm);
591
- }
592
- }
593
- };
594
-
595
- const onTagClick = (tag: string | any) => {
596
- if (tagify) {
597
- if (!allowTagsInText) {
598
- tagify.removeAllTags();
599
- setShowTagMenu(false);
600
- }
601
- insertTag(tag);
602
- let newValue = tagify.DOM.input.textContent;
603
- tagify.value.forEach((tag: any) => {
604
- newValue = (newValue || '').replace(tag.text, `{${tag.value}}`);
605
- });
606
- newValue = (newValue || '').trim();
607
- }
608
-
609
- setCurrentValue(newValue);
610
- if (onChange) onChange(newValue || '', true);
611
- };
612
-
613
- const onSelect = (option: string) => {
614
- const textField = inputRef.current;
615
- let newValue = `{${option}}`;
616
- setTempPlaceholder('');
617
-
618
- // if the field is editable only, then EU can only eneter text, no tags and tags menu wont show up, so this function wont be called
619
- if (textField) {
620
- if (allowTagsInText) {
621
- // allowTagsInText will be true only if the field is editable
622
- // if the fields is editable and allowTagsInText, then EU can enter text or select muliple tags within the text
623
- const { selectionStart = 0, selectionEnd = 0 } = textField;
624
- const oldValue =
625
- searchValue !== ''
626
- ? removeSpecificString(textField.value || '', searchValue)
627
- : textField.value;
628
- const textBeforeCursor = oldValue.substring(0, selectionStart || 0);
629
- const textAfterCursor = oldValue.substring(selectionEnd || 0);
630
- const insertedText = `{${option}}`;
631
- newValue = textBeforeCursor + insertedText + textAfterCursor;
632
- textField.selectionStart = (selectionStart || 0) + insertedText.length;
633
- textField.selectionEnd = textField.selectionStart;
634
- textField.focus();
635
- }
636
- }
637
- // if the field is editable and mappable, then EU can enter text or select a tag
638
- // if the fields in mappable only, then select only one tag
639
- setCurrentValue(newValue);
640
- if (showTagMenu && !isEditable) {
641
- setShowTagMenu(false);
642
- }
643
- setSearchValue('');
644
- if (onChange) onChange(newValue, true);
645
- };
646
-
647
- const handleFieldFocus = (e: any) => {
648
- // open tag menu
649
- if (isMappable) {
650
- setShowTagMenu(true);
651
- }
652
- // if allowTagsInText is false, then make current value as temp placeholder to fade it out when user starts typing
653
- // current valus is tag when it starts with { and ends with }
654
- const vallueToUse = Array.isArray(currentValue)
655
- ? currentValue[0]
656
- : currentValue;
657
- const isTag =
658
- typeof vallueToUse === 'string'
659
- ? vallueToUse?.startsWith('{') && vallueToUse?.endsWith('}')
660
- : false;
661
- if (isEditable && !allowTagsInText && isMappable && isTag) {
662
- setTempPlaceholder(vallueToUse || '');
663
- }
664
- };
665
-
666
- const handleFieldBlur = (e: any) => {
667
- const el: any = document.getElementById(`tagify_${fieldId}`);
668
- const currentTagifyValue = getDefaultTagifyValue(el.value || '');
669
- el.value = currentTagifyValue;
670
- };
671
-
672
- const getStringFromEnd = (str: string): string => {
673
- // eslint-disable-next-line @typescript-eslint/no-shadow
674
- const regex = /\{([^{}]+)$/;
675
- const matches = typeof str === 'string' ? (str || '').match(regex) : [];
676
-
677
- if (matches && matches.length > 1) {
678
- const capturedString = matches[0];
679
- return capturedString;
680
- }
681
- return '';
682
- };
683
- const handleOnSearch = (val: string) => {
684
- setTempPlaceholder(``);
685
- const tempSearchValue =
686
- showTagMenu && !isEditable ? val.trim() : getStringFromEnd(val);
687
- if (val !== '') {
688
- setSearchValue(tempSearchValue);
689
- } else {
690
- setSearchValue('');
691
- }
692
- };
693
- const handleOnChange = (val: string, passedReg: boolean, index?: number) => {
694
- setTempPlaceholder('');
695
- setCurrentValue(val);
696
- if (onChange) onChange(val, passedReg);
697
- let valueToUse = index !== undefined ? val[index] : val;
698
- if (index === undefined && Array.isArray(valueToUse)) {
699
- valueToUse = valueToUse[valueToUse.length - 1];
700
- }
701
- const tempSearchValue = getStringFromEnd(valueToUse);
702
- if (valueToUse !== '') {
703
- setSearchValue(tempSearchValue);
704
- } else {
705
- setSearchValue('');
706
- }
707
- };
708
-
709
- return html`
710
- <div class="${styles.multipurposeFieldContainer}">
711
- <div class="${styles.multipurposeField}">
712
- ${type === 'TEXTAREA'
713
- ? html`
714
- ${enableTagify && isMappable && !isDisabled
715
- ? html`
716
- <${TextArea}
717
- id="tagify_${fieldId}"
718
- title=${title}
719
- description=${description}
720
- placeholder="${showTagMenu && !isEditable
721
- ? currentValue
722
- : tempPlaceholder || placeholder}"
723
- regex=${regex}
724
- regexErrorMessage=${regexErrorMessage}
725
- showStepValidation="${showStepValidation && !showTagMenu}"
726
- isRequired=${isRequired}
727
- onFocus=${handleFieldFocus}
728
- onChange="${showTagMenu && !isEditable
729
- ? handleOnSearch
730
- : handleOnChange}"
731
- isChanged="${isChanged}"
732
- ref=${inputRef}
733
- isEditable="${isEditable || showTagMenu}"
734
- isHidden=${isHidden}
735
- fieldId=${fieldId}
736
- labelTags=${labelTags}
737
- />
738
- <div style="display:none">
739
- <${TextArea}
740
- id="${fieldId}"
741
- title=${title}
742
- description=${description}
743
- placeholder="${showTagMenu && !isEditable
744
- ? currentValue
745
- : tempPlaceholder || placeholder}"
746
- value="${showTagMenu && !isEditable
747
- ? searchValue
748
- : tempPlaceholder
749
- ? ''
750
- : currentValue}"
751
- regex=${regex}
752
- regexErrorMessage=${regexErrorMessage}
753
- showStepValidation="${showStepValidation &&
754
- !showTagMenu}"
755
- isRequired=${isRequired}
756
- onFocus=${handleFieldFocus}
757
- onChange="${showTagMenu && !isEditable
758
- ? handleOnSearch
759
- : handleOnChange}"
760
- isChanged="${isChanged}"
761
- ref=${inputRef}
762
- isEditable="${isEditable || showTagMenu}"
763
- isHidden=${isHidden}
764
- fieldId=${fieldId}
765
- labelTags=${labelTags}
766
- />
767
- </div>
768
- `
769
- : html`
770
- <${TextArea}
771
- id="${fieldId}"
772
- title=${title}
773
- description=${description}
774
- placeholder="${showTagMenu && !isEditable
775
- ? currentValue
776
- : tempPlaceholder || placeholder}"
777
- value="${showTagMenu && !isEditable
778
- ? searchValue
779
- : tempPlaceholder
780
- ? ''
781
- : currentValue}"
782
- regex=${regex}
783
- regexErrorMessage=${regexErrorMessage}
784
- showStepValidation="${showStepValidation && !showTagMenu}"
785
- isRequired=${isRequired}
786
- onFocus=${handleFieldFocus}
787
- onChange="${showTagMenu && !isEditable
788
- ? handleOnSearch
789
- : handleOnChange}"
790
- isChanged="${isChanged}"
791
- ref=${inputRef}
792
- isEditable="${isEditable || showTagMenu}"
793
- isHidden=${isHidden}
794
- fieldId=${fieldId}
795
- labelTags=${labelTags}
796
- isReadOnly=${isDisabled}
797
- />
798
- `}
799
- `
800
- : html`
801
- ${enableTagify && isMappable && !isDisabled
802
- ? html`
803
- <${Input}
804
- id="tagify_${fieldId}"
805
- title="${title}"
806
- description="${description}"
807
- placeholder="${showTagMenu && !isEditable
808
- ? currentValue
809
- : tempPlaceholder || placeholder}"
810
- regex="${regex}"
811
- regexErrorMessage="${regexErrorMessage}"
812
- isRequired="${isRequired}"
813
- showStepValidation="${showStepValidation && !showTagMenu}"
814
- handleFocus=${handleFieldFocus}
815
- onChange="${showTagMenu && !isEditable
816
- ? handleOnSearch
817
- : handleOnChange}"
818
- isEditable="${isEditable || showTagMenu}"
819
- isHidden="${isHidden}"
820
- isChanged=${isChanged}
821
- className="${className}"
822
- ref=${inputRef}
823
- fieldId=${fieldId}
824
- labelTags=${labelTags}
825
- hideError=${false}
826
- isArray=${isArray}
827
- isButtonEnabled=${isButtonEnabled}
828
- buttonText=${buttonText}
829
- onButtonClickScript=${onButtonClickScript}
830
- buttonScriptRequiresAuthToken=${buttonScriptRequiresAuthToken}
831
- apiHandler=${props.apiHandler}
832
- ...${isArray
833
- ? {
834
- value:
835
- showTagMenu && !isEditable
836
- ? searchValue
837
- : tempPlaceholder
838
- ? ''
839
- : currentValue,
840
- }
841
- : {}}
842
- />
843
- <div style="display:none">
844
- <${Input}
845
- id="${fieldId}"
846
- title="${title}"
847
- description="${description}"
848
- placeholder="${showTagMenu && !isEditable
849
- ? currentValue
850
- : tempPlaceholder || placeholder}"
851
- value="${showTagMenu && !isEditable
852
- ? searchValue
853
- : tempPlaceholder
854
- ? ''
855
- : currentValue}"
856
- regex="${regex}"
857
- regexErrorMessage="${regexErrorMessage}"
858
- isRequired="${isRequired}"
859
- showStepValidation="${showStepValidation &&
860
- !showTagMenu}"
861
- handleFocus=${handleFieldFocus}
862
- onChange="${showTagMenu && !isEditable
863
- ? handleOnSearch
864
- : handleOnChange}"
865
- isEditable="${isEditable || showTagMenu}"
866
- isHidden="${isHidden}"
867
- isChanged=${isChanged}
868
- className="${className}"
869
- ref=${inputRef}
870
- fieldId=${fieldId}
871
- labelTags=${labelTags}
872
- hideError=${false}
873
- isArray=${isArray}
874
- />
875
- </div>
876
- `
877
- : html`
878
- <${Input}
879
- id="${fieldId}"
880
- title="${title}"
881
- description="${description}"
882
- placeholder="${showTagMenu && !isEditable
883
- ? currentValue
884
- : tempPlaceholder || placeholder}"
885
- value="${showTagMenu && !isEditable
886
- ? searchValue
887
- : tempPlaceholder
888
- ? ''
889
- : currentValue}"
890
- regex="${regex}"
891
- regexErrorMessage="${regexErrorMessage}"
892
- isRequired="${isRequired}"
893
- showStepValidation="${showStepValidation && !showTagMenu}"
894
- handleFocus=${handleFieldFocus}
895
- onChange="${showTagMenu && !isEditable
896
- ? handleOnSearch
897
- : handleOnChange}"
898
- isEditable="${isEditable || showTagMenu}"
899
- isHidden="${isHidden}"
900
- isChanged=${isChanged}
901
- className="${className}"
902
- ref=${inputRef}
903
- fieldId=${fieldId}
904
- labelTags=${labelTags}
905
- hideError=${false}
906
- isArray=${isArray}
907
- isButtonEnabled=${isButtonEnabled}
908
- buttonText=${buttonText}
909
- onButtonClickScript=${onButtonClickScript}
910
- buttonScriptRequiresAuthToken=${buttonScriptRequiresAuthToken}
911
- apiHandler=${props.apiHandler}
912
- isReadOnly=${isDisabled}
913
- />
914
- `}
915
- `}
916
- </div>
917
- <div>
918
- ${showTagMenu &&
919
- (isMappable || allowTagsInText) &&
920
- html` <div
921
- ref=${menuRef}
922
- className=${`${type.toLocaleLowerCase()}_tags_dropdown`}
923
- >
924
- <${FieldDropdown}
925
- tags=${activityOutputData}
926
- onTagClick=${enableTagify && isMappable ? onTagClick : onSelect}
927
- hideTabs=${true}
928
- fieldId=${fieldId}
929
- value=${currentValue}
930
- enableSearch=${Object.keys(activityOutputData).length > 0
931
- ? true
932
- : false}
933
- refreshRootStepData=${refreshRootStepData}
934
- tagsComponent=${tagsComponent}
935
- tagsTree=${tagsTree}
936
- showMenuOnLeft=${showMenuOnLeft}
937
- />
938
- </div>`}
939
- </div>
940
- </div>
941
- `;
942
- };
943
-
944
- export { MultipurposeField, MultipurposeFieldProps };