@integry/sdk 4.5.2 → 4.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/.vscode/launch.json +2 -2
  2. package/THIRD_PARTY_LICENSES +0 -37
  3. package/dist/esm/index.csm.d.ts +12 -2
  4. package/dist/esm/index.csm.js +7262 -1
  5. package/dist/umd/index.umd.d.ts +9 -1
  6. package/dist/umd/index.umd.js +7262 -1
  7. package/jest.config.cjs +10 -0
  8. package/package.json +10 -4
  9. package/src/components/AddTagButton/index.ts +23 -0
  10. package/src/components/BasicSelect/index.ts +114 -0
  11. package/src/components/BasicSelect/styles.module.scss +44 -0
  12. package/src/components/Button/index.ts +94 -0
  13. package/src/components/Button/styles.module.scss +152 -0
  14. package/src/components/CheckboxGroup/Checkbox.ts +104 -0
  15. package/src/components/CheckboxGroup/index.ts +190 -0
  16. package/src/components/CheckboxGroup/styles.module.scss +63 -0
  17. package/src/components/CollapsedMenu/index.ts +101 -0
  18. package/src/components/CollapsedMenu/styles.module.scss +46 -0
  19. package/src/components/ConfigureFieldWrapper/index.ts +85 -0
  20. package/src/components/ConfigureFieldWrapper/styles.module.scss +57 -0
  21. package/src/components/EditableText/index.ts +121 -0
  22. package/src/components/EditableText/styles.module.scss +38 -0
  23. package/src/components/EditableTextArea/index.ts +143 -0
  24. package/src/components/EditableTextArea/styles.module.scss +91 -0
  25. package/src/components/ErrorMessage/index.ts +16 -0
  26. package/src/components/ErrorMessage/styles.module.scss +19 -0
  27. package/src/components/ErrorPage/index.ts +42 -0
  28. package/src/components/ErrorPage/styles.module.scss +26 -0
  29. package/src/components/Footer/index.ts +41 -0
  30. package/src/components/Footer/styles.module.scss +40 -0
  31. package/src/components/HTMLContent/index.tsx +275 -0
  32. package/src/components/HTMLContent/styles.module.scss +3 -0
  33. package/src/components/InfoBox/index.ts +48 -0
  34. package/src/components/InfoBox/styles.module.scss +21 -0
  35. package/src/components/Input/BaseInput/index.ts +170 -0
  36. package/src/components/Input/BaseInput/styles.module.scss +94 -0
  37. package/src/components/Input/DateInput/index.ts +103 -0
  38. package/src/components/Input/DateInput/styles.module.scss +50 -0
  39. package/src/components/Input/Input/index.ts +206 -0
  40. package/src/components/Input/Input/styles.module.scss +14 -0
  41. package/src/components/Input/PasswordInput/index.ts +164 -0
  42. package/src/components/Input/PasswordInput/styles.module.scss +37 -0
  43. package/src/components/Input/index.ts +7 -0
  44. package/src/components/Label/index.ts +61 -0
  45. package/src/components/Label/styles.module.scss +41 -0
  46. package/src/components/LargeLoader/index.ts +25 -0
  47. package/src/components/LargeLoader/styles.module.scss +16 -0
  48. package/src/components/Listbox/ListBoxItem.ts +57 -0
  49. package/src/components/Listbox/index.ts +479 -0
  50. package/src/components/Listbox/styles.module.scss +197 -0
  51. package/src/components/Loader/index.ts +25 -0
  52. package/src/components/Loader/styles.module.scss +16 -0
  53. package/src/components/MediaGallery/MediaGalleryModal.ts +82 -0
  54. package/src/components/MediaGallery/MediaSlider.ts +76 -0
  55. package/src/components/MediaGallery/index.ts +92 -0
  56. package/src/components/MediaGallery/styles.module.scss +156 -0
  57. package/src/components/MediaUpload/index.ts +233 -0
  58. package/src/components/MediaUpload/styles.module.scss +118 -0
  59. package/src/components/Modal/index.ts +87 -0
  60. package/src/components/Modal/styles.module.scss +441 -0
  61. package/src/components/MultipurposeField/Dropdown/ListBoxItem.tsx +58 -0
  62. package/src/components/MultipurposeField/Dropdown/index.tsx +981 -0
  63. package/src/components/MultipurposeField/Dropdown/styles.module.scss +208 -0
  64. package/src/components/MultipurposeField/TagMenu/index.ts +384 -0
  65. package/src/components/MultipurposeField/TagMenu/styles.module.scss +136 -0
  66. package/src/components/MultipurposeField/TagOptions/index.tsx +83 -0
  67. package/src/components/MultipurposeField/TagOptions/styles.module.scss +95 -0
  68. package/src/components/MultipurposeField/index.tsx +687 -0
  69. package/src/components/MultipurposeField/styles.module.scss +56 -0
  70. package/src/components/NewModal/index.ts +69 -0
  71. package/src/components/NewModal/styles.module.scss +70 -0
  72. package/src/components/OverflowTooltip/index.tsx +59 -0
  73. package/src/components/PopUp/ConfirmationPopUp/index.ts +58 -0
  74. package/src/components/PopUp/ConfirmationPopUp/styles.module.scss +49 -0
  75. package/src/components/PopUp/SuccessPopUp/index.ts +62 -0
  76. package/src/components/PopUp/SuccessPopUp/styles.module.scss +38 -0
  77. package/src/components/RadioGroup/Radio.ts +129 -0
  78. package/src/components/RadioGroup/index.ts +169 -0
  79. package/src/components/RadioGroup/styles.module.scss +81 -0
  80. package/src/components/Search/index.ts +69 -0
  81. package/src/components/Search/styles.module.scss +149 -0
  82. package/src/components/TabBar/Tab.ts +33 -0
  83. package/src/components/TabBar/index.ts +64 -0
  84. package/src/components/TabBar/styles.module.scss +43 -0
  85. package/src/components/Tag/index.ts +29 -0
  86. package/src/components/Tag/styles.module.scss +57 -0
  87. package/src/components/TextArea/index.ts +172 -0
  88. package/src/components/TextArea/styles.module.scss +70 -0
  89. package/src/components/TextContent/index.tsx +128 -0
  90. package/src/components/TextContent/styles.module.scss +6 -0
  91. package/src/components/ThreeDotLoader/index.ts +39 -0
  92. package/src/components/ThreeDotLoader/styles.module.scss +41 -0
  93. package/src/components/TimeInput/index.ts +129 -0
  94. package/src/components/TimeInput/styles.module.scss +16 -0
  95. package/src/components/Toggle/index.ts +34 -0
  96. package/src/components/Toggle/styles.module.scss +56 -0
  97. package/src/components/Toggle-v2/index.ts +40 -0
  98. package/src/components/Toggle-v2/styles.module.scss +86 -0
  99. package/src/components/Tooltip/index.ts +271 -0
  100. package/src/components/Tooltip/styles.module.scss +105 -0
  101. package/src/components/form/ObjectField/index.ts +364 -0
  102. package/src/components/form/ObjectField/styles.module.scss +103 -0
  103. package/src/components/form/index.ts +3 -0
  104. package/src/contexts/AppContext.ts +12 -0
  105. package/src/declaration.d.ts +7 -0
  106. package/src/extensions/HMAC.ts +25 -0
  107. package/src/extensions/IntegryAPIError.ts +19 -0
  108. package/src/features/common/AccountDropdown/index.ts +291 -0
  109. package/src/features/common/AccountDropdown/styles.module.scss +19 -0
  110. package/src/features/common/ActionForm/index.ts +1818 -0
  111. package/src/features/common/ActionForm/styles.module.scss +23 -0
  112. package/src/features/common/AppCard/index.ts +207 -0
  113. package/src/features/common/AppCard/styles.module.scss +117 -0
  114. package/src/features/common/AppCardCompact/index.ts +189 -0
  115. package/src/features/common/AppCardCompact/styles.module.scss +141 -0
  116. package/src/features/common/AuthSelector/index.ts +537 -0
  117. package/src/features/common/AuthSelector/styles.module.scss +161 -0
  118. package/src/features/common/AuthSelectorCompact/index.ts +706 -0
  119. package/src/features/common/AuthSelectorCompact/styles.module.scss +219 -0
  120. package/src/features/common/AuthSelectorDropdown/index.ts +704 -0
  121. package/src/features/common/AuthSelectorDropdown/styles.module.scss +361 -0
  122. package/src/features/common/DynamicField/index.ts +229 -0
  123. package/src/features/common/DynamicField/styles.module.scss +67 -0
  124. package/src/features/common/DynamicTypedField/index.ts +217 -0
  125. package/src/features/common/DynamicTypedField/styles.module.scss +67 -0
  126. package/src/features/common/FunctionForm/index.ts +862 -0
  127. package/src/features/common/FunctionForm/styles.module.scss +163 -0
  128. package/src/features/common/MappingUI/index.ts +649 -0
  129. package/src/features/common/MappingUI/styles.module.scss +121 -0
  130. package/src/features/common/MarketplaceAppCard/index.ts +279 -0
  131. package/src/features/common/MarketplaceAppCard/styles.module.scss +231 -0
  132. package/src/features/common/MarketplaceAppCardCompact/index.ts +283 -0
  133. package/src/features/common/MarketplaceAppCardCompact/styles.module.scss +255 -0
  134. package/src/features/common/NewMappingUI/index.ts +515 -0
  135. package/src/features/common/NewMappingUI/styles.module.scss +113 -0
  136. package/src/features/common/RequestAppWidget/RequestAppModal/index.ts +67 -0
  137. package/src/features/common/RequestAppWidget/RequestAppModal/styles.module.scss +23 -0
  138. package/src/features/common/RequestAppWidget/index.ts +48 -0
  139. package/src/features/common/RequestAppWidget/request-app-form.ts +89 -0
  140. package/src/features/common/RequestAppWidget/styles.module.scss +43 -0
  141. package/src/features/common/SectionField/index.ts +272 -0
  142. package/src/features/common/SectionField/styles.module.scss +67 -0
  143. package/src/features/common/Step/index.ts +827 -0
  144. package/src/features/common/Step/styles.module.scss +12 -0
  145. package/src/features/common/StepNavigation/CollapsedSteps.ts +125 -0
  146. package/src/features/common/StepNavigation/NavItem.ts +111 -0
  147. package/src/features/common/StepNavigation/index.ts +257 -0
  148. package/src/features/common/StepNavigation/styles.module.scss +117 -0
  149. package/src/features/common/Steps/index.ts +1139 -0
  150. package/src/features/common/Steps/styles.module.scss +314 -0
  151. package/src/features/containers/AppFlowContainer/AppFlowListing/compactStyles.module.scss +383 -0
  152. package/src/features/containers/AppFlowContainer/AppFlowListing/flow-instance.tsx +367 -0
  153. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCard.tsx +194 -0
  154. package/src/features/containers/AppFlowContainer/AppFlowListing/flowCardCompact.tsx +389 -0
  155. package/src/features/containers/AppFlowContainer/AppFlowListing/flowInstanceCompact.tsx +577 -0
  156. package/src/features/containers/AppFlowContainer/AppFlowListing/index.tsx +83 -0
  157. package/src/features/containers/AppFlowContainer/AppFlowListing/styles.module.scss +212 -0
  158. package/src/features/containers/AppFlowContainer/AppFlowWrap/app-page-loader.tsx +45 -0
  159. package/src/features/containers/AppFlowContainer/AppFlowWrap/index.tsx +1081 -0
  160. package/src/features/containers/AppFlowContainer/AppFlowWrap/styles.module.scss +452 -0
  161. package/src/features/containers/AppFlowContainer/Authentication/index.ts +610 -0
  162. package/src/features/containers/AppFlowContainer/Authentication/styles.module.scss +468 -0
  163. package/src/features/containers/AppFlowContainer/index.ts +114 -0
  164. package/src/features/containers/AppPageContainer/AppPage/index.tsx +262 -0
  165. package/src/features/containers/AppPageContainer/AppPage/styles.module.scss +120 -0
  166. package/src/features/containers/AppPageContainer/IntegrationCard/index.ts +165 -0
  167. package/src/features/containers/AppPageContainer/IntegrationCard/styles.module.scss +81 -0
  168. package/src/features/containers/AppPageContainer/index.tsx +93 -0
  169. package/src/features/containers/AppPageContainer/styles.module.scss +0 -0
  170. package/src/features/containers/AppsForFlows/index.ts +161 -0
  171. package/src/features/containers/AppsForFlows/styles.module.scss +280 -0
  172. package/src/features/containers/AppsForFlowsCompact/index.ts +161 -0
  173. package/src/features/containers/AppsForFlowsCompact/styles.module.scss +279 -0
  174. package/src/features/containers/AuthSetupContainer/AppSelection.ts +73 -0
  175. package/src/features/containers/AuthSetupContainer/AuthTypeSelection.ts +67 -0
  176. package/src/features/containers/AuthSetupContainer/Footer.ts +32 -0
  177. package/src/features/containers/AuthSetupContainer/Header.ts +39 -0
  178. package/src/features/containers/AuthSetupContainer/PostAdditionPopup.ts +27 -0
  179. package/src/features/containers/AuthSetupContainer/index.ts +349 -0
  180. package/src/features/containers/AuthSetupContainer/styles.module.scss +229 -0
  181. package/src/features/containers/FlowSetupContainer/index.ts +390 -0
  182. package/src/features/containers/FlowSetupContainer/styles.module.scss +18 -0
  183. package/src/features/containers/MarkeplaceApps/index.ts +574 -0
  184. package/src/features/containers/MarkeplaceApps/styles.module.scss +559 -0
  185. package/src/features/containers/MarketplaceAppsCompact/index.ts +576 -0
  186. package/src/features/containers/MarketplaceAppsCompact/styles.module.scss +546 -0
  187. package/src/features/containers/MarketplaceAppsContainer/index.ts +83 -0
  188. package/src/features/containers/MarketplaceContainer/AppCard/index.ts +91 -0
  189. package/src/features/containers/MarketplaceContainer/AppCard/styles.module.scss +66 -0
  190. package/src/features/containers/MarketplaceContainer/AppListing/index.ts +34 -0
  191. package/src/features/containers/MarketplaceContainer/AppListing/styles.module.scss +10 -0
  192. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/index.ts +132 -0
  193. package/src/features/containers/MarketplaceContainer/MarketplaceContentWrap/styles.module.scss +117 -0
  194. package/src/features/containers/MarketplaceContainer/index.ts +242 -0
  195. package/src/features/containers/MarketplaceContainer/styles.module.scss +84 -0
  196. package/src/features/containers/SDKContainer/index.ts +817 -0
  197. package/src/features/containers/SDKContainer/styles.module.scss +266 -0
  198. package/src/features/containers/SDKDebugContainer/index.ts +137 -0
  199. package/src/features/containers/SDKDebugContainer/styles.module.scss +37 -0
  200. package/src/features/containers/SDKFailedContainer/index.ts +117 -0
  201. package/src/features/containers/SDKFailedContainer/styles.module.scss +57 -0
  202. package/src/features/integrations/IntegrationRow/Icons.ts +77 -0
  203. package/src/features/integrations/IntegrationRow/index.ts +129 -0
  204. package/src/features/integrations/IntegrationRow/styles.module.scss +62 -0
  205. package/src/features/integrations/IntegrationsHeader/index.ts +34 -0
  206. package/src/features/integrations/IntegrationsHeader/styles.module.scss +47 -0
  207. package/src/features/integrations/IntegrationsList/index.ts +252 -0
  208. package/src/features/integrations/IntegrationsList/styles.module.scss +67 -0
  209. package/src/features/templates/Template/index.ts +295 -0
  210. package/src/features/templates/Template/styles.module.scss +226 -0
  211. package/src/features/templates/TemplatesView/index.ts +368 -0
  212. package/src/features/templates/TemplatesView/styles.module.scss +71 -0
  213. package/src/features/templates/TemplatesViewCompact/index.ts +364 -0
  214. package/src/features/templates/TemplatesViewCompact/styles.module.scss +141 -0
  215. package/src/hooks/useAutosizeTextArea.ts +22 -0
  216. package/src/hooks/useCustomRef.ts +13 -0
  217. package/src/hooks/useDebounce.ts +17 -0
  218. package/src/hooks/useElementResize.ts +40 -0
  219. package/src/hooks/useEventListener.ts +44 -0
  220. package/src/hooks/useHover.ts +40 -0
  221. package/src/hooks/useOnClickOutside.ts +32 -0
  222. package/src/index.ts +2051 -0
  223. package/src/index.umd.ts +13 -0
  224. package/src/interfaces/index.ts +924 -0
  225. package/src/modules/api/index.ts +1315 -0
  226. package/src/modules/api/responseHandler.ts +38 -0
  227. package/src/modules/event-emitter/index.ts +72 -0
  228. package/src/modules/event-emitter/runners/abstract.ts +21 -0
  229. package/src/modules/event-emitter/runners/default.ts +11 -0
  230. package/src/modules/event-emitter/runners/ntimes.ts +28 -0
  231. package/src/modules/event-emitter/types.ts +34 -0
  232. package/src/store/actionFunctions.ts +1573 -0
  233. package/src/store/index.ts +17 -0
  234. package/src/store/initialState.ts +58 -0
  235. package/src/stories/Button.stories.tsx +83 -0
  236. package/src/stories/Checkbox/Checkbox.stories.tsx +41 -0
  237. package/src/stories/Checkbox/CheckboxGroup.stories.tsx +46 -0
  238. package/src/stories/EditableText.stories.tsx +35 -0
  239. package/src/stories/Input/BaseInput.stories.tsx +48 -0
  240. package/src/stories/Input/DateInput.stories.tsx +28 -0
  241. package/src/stories/Input/Input.stories.tsx +24 -0
  242. package/src/stories/Input/PasswordInput.stories.tsx +26 -0
  243. package/src/stories/Introduction.stories.mdx +211 -0
  244. package/src/stories/Label.stories.tsx +27 -0
  245. package/src/stories/Listbox.stories.tsx +122 -0
  246. package/src/stories/Radio/Radio.stories.tsx +39 -0
  247. package/src/stories/Radio/RadioGroup.stories.tsx +46 -0
  248. package/src/stories/StepNavigation/NavItem.stories.tsx +31 -0
  249. package/src/stories/StepNavigation/StepNavigation.stories.tsx +50 -0
  250. package/src/stories/TabBar.stories.tsx +31 -0
  251. package/src/stories/TextArea.stories.tsx +23 -0
  252. package/src/stories/TimeInput.stories.tsx +37 -0
  253. package/src/stories/Toggle.stories.tsx +33 -0
  254. package/src/stories/assets/code-brackets.svg +1 -0
  255. package/src/stories/assets/colors.svg +1 -0
  256. package/src/stories/assets/comments.svg +1 -0
  257. package/src/stories/assets/direction.svg +1 -0
  258. package/src/stories/assets/flow.svg +1 -0
  259. package/src/stories/assets/plugin.svg +1 -0
  260. package/src/stories/assets/repo.svg +1 -0
  261. package/src/stories/assets/stackalt.svg +1 -0
  262. package/src/types/index.ts +293 -0
  263. package/src/types/store.ts +366 -0
  264. package/src/types/utils.ts +19 -0
  265. package/src/utils/ActivityOutputUtils.ts +163 -0
  266. package/src/utils/common.ts +20 -0
  267. package/src/utils/copyToClipboard.ts +24 -0
  268. package/src/utils/datetime.ts +101 -0
  269. package/src/utils/getUrlParam.ts +11 -0
  270. package/src/utils/isAuthMessage.ts +16 -0
  271. package/src/utils/isBrowser.ts +1 -0
  272. package/src/utils/jsonEncodeDecode.ts +15 -0
  273. package/src/utils/objectUtils.ts +116 -0
  274. package/src/utils/popup.ts +30 -0
  275. package/src/utils/searchJson.ts +51 -0
  276. package/src/utils/stepUtils.ts +45 -0
  277. package/src/utils/truncate.ts +6 -0
  278. package/test/setup.ts +1 -0
  279. package/vitest.config.ts +10 -0
@@ -0,0 +1,275 @@
1
+ import { html } from 'htm/preact';
2
+ import { connect } from 'unistore/preact';
3
+ import { useEffect, useState, useRef } from 'preact/hooks';
4
+ import { StoreType } from '@/types/store';
5
+ import { openPopupWindow } from '@/utils/popup';
6
+
7
+ import styles from './styles.module.scss';
8
+
9
+ interface HTMLFieldProps {
10
+ htmlContent: string;
11
+ xIntegryConfig?: any;
12
+ stepDataMapping?: any;
13
+ stepState?: any;
14
+ genericData?: any;
15
+ stepMapping?: any;
16
+ isAction?: boolean;
17
+ requiresAuthToken?: boolean;
18
+ apiHandler?: any;
19
+ handleChange?: (e: any) => void;
20
+ handleCancel?: () => void;
21
+ }
22
+
23
+ const HTMLContent = (props: HTMLFieldProps) => {
24
+ const { htmlContent, xIntegryConfig = {} } = props;
25
+ const [htmlContentState, setHtmlContentState] = useState(htmlContent);
26
+ const [hasPreprocessedHtmlContent, setHasPreprocessedHtmlContent] = useState(
27
+ false,
28
+ );
29
+ const containerRef = useRef<HTMLDivElement | null>(null);
30
+ const actionBaseUrl = 'https://embed.app.integry.io';
31
+ const actionUrl = `${actionBaseUrl}/render-action-btn-html/render`;
32
+
33
+ const replaceValuesWithJSON = (inputString: string, jsonData: any) => {
34
+ // Regular expression to match values inside double curly braces
35
+ const regex = /{(.*?)}/g;
36
+
37
+ // Use the replace method to replace matched values
38
+ const replacedString = inputString.replace(
39
+ regex,
40
+ (match: any, group: string) => {
41
+ // Trim the group to remove leading and trailing whitespaces
42
+ const key = group.trim();
43
+
44
+ // Access the nested values using a loop
45
+ const keys = key.split('.');
46
+ let value = jsonData;
47
+
48
+ // eslint-disable-next-line no-restricted-syntax
49
+ for (const k of keys) {
50
+ // eslint-disable-next-line no-prototype-builtins
51
+ if (value.hasOwnProperty(k)) {
52
+ value = value[k];
53
+ } else {
54
+ // If a key is not found and key is not authorization.token.access_token, return an empty string
55
+ if (key !== 'authorization.token.access_token') return '';
56
+
57
+ return `{${key}}`;
58
+ }
59
+ }
60
+
61
+ // Return the replacement value
62
+ return value;
63
+ },
64
+ );
65
+
66
+ return replacedString;
67
+ };
68
+
69
+ const getCurrentStep = () => {
70
+ const { stepState, stepMapping } = props;
71
+
72
+ return stepMapping[stepState.currentStep.stepId] || {};
73
+ };
74
+
75
+ const generateInJsonData = () => {
76
+ let generatedJSON = {
77
+ steps: {},
78
+ storage: {},
79
+ authorization: {},
80
+ };
81
+ const { stepDataMapping, stepState, stepMapping } = props;
82
+ const { steps = [] } = stepState;
83
+ const currentStep = getCurrentStep();
84
+ const selectedAuthFilter = currentStep.authorizations.filter(
85
+ (auth: any) => auth.authorizationId === currentStep.selectedAuthId,
86
+ );
87
+ const selectedAuth = selectedAuthFilter[0] || {};
88
+ if (steps.length > 0) {
89
+ let tempSteps = {};
90
+ steps.forEach(
91
+ (step: { title: string; type: string; stepId: number | string }) => {
92
+ const { title, type, stepId } = step;
93
+ if (type === 'CONFIGURATION') {
94
+ const objectTitle = `form_${title
95
+ .toLowerCase()
96
+ .replace(/ /g, '_')}`;
97
+ if (stepDataMapping[stepId]) {
98
+ let tempObject = {};
99
+ Object.keys(stepDataMapping[stepId]).forEach((fieldId) => {
100
+ const { value, machineName } = stepDataMapping[stepId][fieldId];
101
+ tempObject = {
102
+ ...tempObject,
103
+ [machineName]: value,
104
+ };
105
+ });
106
+ tempSteps = {
107
+ ...tempSteps,
108
+ [objectTitle]: {
109
+ in: {
110
+ ...tempObject,
111
+ },
112
+ },
113
+ };
114
+ }
115
+ }
116
+ },
117
+ );
118
+ generatedJSON = {
119
+ ...generatedJSON,
120
+ steps: {
121
+ ...tempSteps,
122
+ },
123
+ storage: {
124
+ ...props.genericData.storage,
125
+ },
126
+ };
127
+ }
128
+ return generatedJSON;
129
+ };
130
+
131
+ const onActionResponseReceived = (event: MessageEvent) => {
132
+ // Verify the message origin (for security)
133
+ if (event.origin !== actionBaseUrl) return;
134
+
135
+ // Check if the message contains the connectedAccountId
136
+ if (props.handleChange) {
137
+ props.handleChange(event.data);
138
+ }
139
+ };
140
+
141
+ // Add the message event listener
142
+ window.addEventListener('message', onActionResponseReceived);
143
+
144
+ // Handle cases where the user closes the auth window without completing auth
145
+
146
+ useEffect(() => {
147
+ const result = replaceValuesWithJSON(htmlContent, {
148
+ xIntegryConfig: { ...(xIntegryConfig || {}) },
149
+ ...generateInJsonData(),
150
+ });
151
+ setHtmlContentState(result);
152
+
153
+ if (props.isAction) {
154
+ /**
155
+ * we want to open html render in a child window if its for an action of a text field
156
+ */
157
+ const encodedHmlt = btoa(encodeURIComponent(result));
158
+ const currentStep = getCurrentStep();
159
+ const selectedAuthFilter = currentStep.authorizations.filter(
160
+ (auth: any) => auth.authorizationId === currentStep.selectedAuthId,
161
+ );
162
+ const selectedAuth = selectedAuthFilter[0] || {};
163
+ const selectedAuthId = props.requiresAuthToken
164
+ ? selectedAuth.authorizationId
165
+ : '';
166
+ const authWindow = openPopupWindow(
167
+ `${actionUrl}?content=${encodedHmlt}&auth_id=${selectedAuthId}&${props.apiHandler.getAuthConfig()}`,
168
+ 'Action Button',
169
+ window,
170
+ 800,
171
+ 600,
172
+ );
173
+ const checkWindowClosed = setInterval(() => {
174
+ if (authWindow && authWindow.closed) {
175
+ clearInterval(checkWindowClosed);
176
+ window.removeEventListener('message', onActionResponseReceived);
177
+ if (props.handleCancel) {
178
+ props.handleCancel();
179
+ }
180
+ }
181
+ }, 500);
182
+ } else if (containerRef.current) {
183
+ try {
184
+ containerRef.current.innerHTML = htmlContentState;
185
+
186
+ // Extract and process link tags
187
+ const links = containerRef.current.querySelectorAll(
188
+ 'link[rel="stylesheet"]',
189
+ );
190
+ links.forEach((link) => {
191
+ const newLink = document.createElement('link');
192
+ Array.from(link.attributes).forEach((attr) =>
193
+ newLink.setAttribute(attr.name, attr.value),
194
+ );
195
+
196
+ // Avoid duplicates
197
+ if (
198
+ !Array.from(document.head.querySelectorAll('link')).some(
199
+ (existingLink) => existingLink.href === newLink.href,
200
+ )
201
+ ) {
202
+ document.head.appendChild(newLink);
203
+ }
204
+ link.remove();
205
+ });
206
+
207
+ // Extract and process scripts
208
+ const scripts = containerRef.current.querySelectorAll('script');
209
+
210
+ // Define loadScript with proper typing
211
+ const loadScript = (
212
+ script: HTMLScriptElement,
213
+ callback: () => void,
214
+ ) => {
215
+ const newScript = document.createElement('script');
216
+
217
+ if (script.src) {
218
+ // For external scripts
219
+ newScript.src = script.src;
220
+ newScript.onload = callback;
221
+ } else {
222
+ // For inline scripts
223
+ newScript.textContent = script.textContent;
224
+ callback(); // Inline scripts can execute immediately
225
+ }
226
+
227
+ // Copy attributes if any
228
+ Array.from(script.attributes).forEach((attr) =>
229
+ newScript.setAttribute(attr.name, attr.value),
230
+ );
231
+
232
+ document.body.appendChild(newScript);
233
+ script.remove();
234
+ };
235
+
236
+ // Process scripts in sequence
237
+ const processScripts = (
238
+ scripts: NodeListOf<HTMLScriptElement>,
239
+ index = 0,
240
+ ) => {
241
+ if (index < scripts.length) {
242
+ loadScript(scripts[index], () =>
243
+ processScripts(scripts, index + 1),
244
+ );
245
+ }
246
+ };
247
+
248
+ processScripts(scripts);
249
+ } catch (e) {
250
+ console.error(e);
251
+ }
252
+ }
253
+ setHasPreprocessedHtmlContent(true);
254
+ }, [htmlContentState]);
255
+
256
+ return html`
257
+ ${hasPreprocessedHtmlContent && !props.isAction
258
+ ? html`<div
259
+ class="${styles.htmlField}"
260
+ dangerouslySetInnerHTML=${{
261
+ __html: htmlContentState,
262
+ }}
263
+ ref="${containerRef}"
264
+ />`
265
+ : html``}
266
+ `;
267
+ };
268
+
269
+ export default connect<HTMLFieldProps, unknown, StoreType, unknown>([
270
+ 'xIntegryConfig',
271
+ 'stepDataMapping',
272
+ 'stepMapping',
273
+ 'stepState',
274
+ 'genericData',
275
+ ])(HTMLContent);
@@ -0,0 +1,3 @@
1
+ .htmlField {
2
+ margin-bottom: 16px;
3
+ }
@@ -0,0 +1,48 @@
1
+ import { html } from 'htm/preact';
2
+ import { FunctionComponent } from 'preact';
3
+
4
+ import styles from './styles.module.scss';
5
+
6
+ const InfoBox: FunctionComponent<{
7
+ style: Record<string, string | number>;
8
+ }> = ({ style, children }) => html`
9
+ <div class=${styles.smartbox} style=${style}>
10
+ <svg
11
+ width="25"
12
+ height="25"
13
+ viewBox="0 0 25 25"
14
+ fill="none"
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ >
17
+ <path
18
+ fill-rule="evenodd"
19
+ clip-rule="evenodd"
20
+ d="M5.3125 12.3603C5.3125 8.47114 8.46911 5.31445 12.3584 5.31445L12.3585 5.31484C16.2474 5.31484 19.4041 8.47145 19.4417 12.3215C19.4417 14.8631 18.1333 17.134 15.9767 18.4048V22.718C15.9767 23.6805 15.2067 24.4505 14.2442 24.4505H10.51C9.5475 24.4505 8.7775 23.6805 8.7775 22.718V18.4437C6.62088 17.1728 5.3125 14.8628 5.3125 12.3603ZM10.3164 20.5597H14.3982V19.7897H10.3164V20.5597ZM14.2079 22.8697H10.4738C10.3971 22.8697 10.2812 22.793 10.2812 22.6772V22.0997H14.363V22.6772C14.4006 22.793 14.3239 22.8697 14.2081 22.8697H14.2079ZM14.3977 17.5188L14.8218 17.2872H14.8218C16.7092 16.3247 17.8642 14.4387 17.8642 12.3588C17.8642 9.3163 15.3992 6.85291 12.3583 6.85291C9.31585 6.85291 6.85246 9.31791 6.85246 12.3588C6.85246 14.4764 8.00746 16.3638 9.89335 17.2872L10.3175 17.5188V18.2888H14.3977V17.5188Z"
21
+ fill="#556BDD"
22
+ />
23
+ <path
24
+ d="M12.3559 4.19588C12.7801 4.19588 13.1259 3.84998 13.1259 3.42588V0.77C13.1259 0.345884 12.78 0 12.3559 0C11.9318 0 11.5859 0.345899 11.5859 0.77V3.42588C11.5859 3.85 11.9318 4.19588 12.3559 4.19588Z"
25
+ fill="#556BDD"
26
+ />
27
+ <path
28
+ d="M23.9454 11.5107H21.2895C20.8654 11.5107 20.5195 11.8566 20.5195 12.2807C20.5195 12.7049 20.8654 13.0507 21.2895 13.0507H23.9454C24.3695 13.0507 24.7154 12.7048 24.7154 12.2807C24.7154 11.8581 24.368 11.5107 23.9454 11.5107Z"
29
+ fill="#556BDD"
30
+ />
31
+ <path
32
+ d="M3.42588 11.5107H0.77C0.345884 11.5107 0 11.8566 0 12.2807C0 12.7049 0.345899 13.0507 0.77 13.0507H3.42588C3.85 13.0507 4.19588 12.7048 4.19588 12.2807C4.19588 11.8581 3.84848 11.5107 3.42588 11.5107Z"
33
+ fill="#556BDD"
34
+ />
35
+ <path
36
+ d="M5.58214 4.77336L3.69625 2.88748C3.38795 2.57917 2.92625 2.57917 2.61795 2.88748C2.30964 3.19578 2.30965 3.65748 2.61795 3.96578L4.50383 5.85167C4.65723 6.00507 4.84973 6.08327 5.04221 6.08327C5.2347 6.08327 5.42721 6.00657 5.5806 5.85167C5.8904 5.54337 5.8904 5.08167 5.5821 4.77336H5.58214Z"
37
+ fill="#556BDD"
38
+ />
39
+ <path
40
+ d="M22.0978 2.88748C21.7895 2.57917 21.3278 2.57917 21.0195 2.88748L19.1336 4.77336C18.8253 5.08166 18.8253 5.54336 19.1336 5.85167C19.287 6.00507 19.4795 6.08327 19.672 6.08327C19.8644 6.08327 20.057 6.00657 20.2103 5.85167L22.0962 3.96578C22.406 3.65748 22.406 3.19578 22.0977 2.88748H22.0978Z"
41
+ fill="#556BDD"
42
+ />
43
+ </svg>
44
+ <div>${children}</div>
45
+ </div>
46
+ `;
47
+
48
+ export { InfoBox };
@@ -0,0 +1,21 @@
1
+ .smartbox {
2
+ display: flex;
3
+ background: #f6f7fd;
4
+ border: 1px solid #a5b1ed;
5
+ box-sizing: border-box;
6
+ border-radius: 6px;
7
+ padding: 20px;
8
+ font-size: 13px;
9
+ line-height: 20px;
10
+ color: #333333;
11
+ svg {
12
+ margin-right: 10px;
13
+ }
14
+ a {
15
+ text-decoration: none;
16
+ color: #4250f0;
17
+ &:hover {
18
+ text-decoration: underline;
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,170 @@
1
+ import { html, Component } from 'htm/preact';
2
+ import { forwardRef } from 'preact/compat';
3
+ import { TagButton } from '@/components/AddTagButton';
4
+ import HTMLContent from '@/components/HTMLContent';
5
+ import { useState } from 'preact/hooks';
6
+
7
+ import styles from './styles.module.scss';
8
+
9
+ interface BaseInputProps extends Partial<HTMLInputElement> {
10
+ placeholder: string;
11
+ value: string;
12
+ control?: Component;
13
+ handleChange?: (id: string) => void;
14
+ handleBlur?: () => void;
15
+ handleFocus?: () => void;
16
+ isReadOnly?: boolean;
17
+ className?: string;
18
+ onAddTag?: () => void;
19
+ fieldId?: string;
20
+ showDeleteIcon?: boolean;
21
+ handleDeleteIconClick?: () => void;
22
+ isButtonEnabled?: boolean;
23
+ buttonText?: string;
24
+ onButtonClickScript?: string;
25
+ buttonScriptRequiresAuthToken?: boolean;
26
+ apiHandler?: any;
27
+ }
28
+
29
+ /**
30
+ * BaseInput component
31
+ *
32
+ */
33
+ const BaseInput = forwardRef((props: BaseInputProps, ref) => {
34
+ const {
35
+ placeholder,
36
+ value,
37
+ type = 'text',
38
+ control,
39
+ handleChange = () => null,
40
+ handleBlur = () => null,
41
+ handleFocus = () => null,
42
+ isReadOnly = false,
43
+ className = '',
44
+ onAddTag,
45
+ fieldId = '',
46
+ id = '',
47
+ showDeleteIcon = false,
48
+ handleDeleteIconClick,
49
+ isButtonEnabled = false,
50
+ buttonText = '',
51
+ onButtonClickScript = '',
52
+ buttonScriptRequiresAuthToken = false,
53
+ apiHandler,
54
+ } = props;
55
+
56
+ const [isActionClicked, setIsActionClicked] = useState(false);
57
+
58
+ const handleInputChange = (e: MouseEvent) => {
59
+ if (!isReadOnly && e.currentTarget instanceof HTMLInputElement) {
60
+ const { value: newValue } = e.currentTarget;
61
+ handleChange(newValue);
62
+ }
63
+ };
64
+
65
+ const handleDateChange = (e: InputEvent) => {
66
+ if (
67
+ !isReadOnly &&
68
+ e.currentTarget instanceof HTMLInputElement &&
69
+ e.currentTarget.type === 'date'
70
+ ) {
71
+ const { value: newValue } = e.currentTarget;
72
+ handleChange(newValue);
73
+ }
74
+ };
75
+
76
+ const handleActionReturned = (val: string) => {
77
+ if (handleChange) {
78
+ handleChange(val);
79
+ }
80
+ setIsActionClicked(false);
81
+ };
82
+
83
+ const handleActionCancelled = () => {
84
+ setIsActionClicked(false);
85
+ };
86
+
87
+ return html`
88
+ <div
89
+ class=${`${styles.inputWrapper} ${className ? styles[className] : ''} ${
90
+ showDeleteIcon ? styles.withDeleteIcon : ''
91
+ }`}
92
+ id=${fieldId}
93
+ style="position: relative;"
94
+ >
95
+ <input
96
+ type=${type}
97
+ placeholder=${placeholder}
98
+ value=${value}
99
+ onkeyup=${handleInputChange}
100
+ onchange=${handleDateChange}
101
+ onblur=${handleBlur}
102
+ onfocus=${handleFocus}
103
+ readonly=${isReadOnly}
104
+ ref=${ref}
105
+ id=${id}
106
+ class=${`${isReadOnly ? styles.readonly : ''} ${
107
+ styles[className || '']
108
+ }`}
109
+ />
110
+ ${isButtonEnabled &&
111
+ html`
112
+ <a
113
+ href="#"
114
+ class=${styles.inputButtonLink}
115
+ onClick=${(e: MouseEvent) => {
116
+ e.preventDefault();
117
+ setIsActionClicked(true);
118
+ }}
119
+ >
120
+ ${buttonText}
121
+ </a>
122
+ `}
123
+ ${showDeleteIcon &&
124
+ html`
125
+ <button
126
+ class="${styles.removeButton}"
127
+ onClick=${() => {
128
+ if (handleDeleteIconClick) {
129
+ handleDeleteIconClick();
130
+ }
131
+ }}
132
+ tabindex="-1"
133
+ >
134
+ <svg
135
+ width="15"
136
+ height="15"
137
+ viewBox="0 0 15 15"
138
+ fill="none"
139
+ xmlns="http://www.w3.org/2000/svg"
140
+ >
141
+ <path d="M1.5 4.1999H13.65" stroke="#999999" />
142
+ <path
143
+ d="M11.6254 5.5498V6.2248L10.9504 13.6498H4.20039L3.52539 6.2248V5.5498"
144
+ stroke="#999999"
145
+ stroke-linejoin="round"
146
+ />
147
+ <path
148
+ 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"
149
+ stroke="#999999"
150
+ />
151
+ </svg>
152
+ </button>
153
+ `}
154
+ ${onAddTag && html` <${TagButton} onClick=${onAddTag} /> `}
155
+ ${control && html`<${control} //>`}
156
+ </div>
157
+ ${isButtonEnabled &&
158
+ isActionClicked &&
159
+ html`<${HTMLContent}
160
+ htmlContent=${onButtonClickScript}
161
+ isAction=${true}
162
+ handleChange=${handleActionReturned}
163
+ handleCancel=${handleActionCancelled}
164
+ requiresAuthToken=${buttonScriptRequiresAuthToken}
165
+ apiHandler=${apiHandler}
166
+ />`}
167
+ `;
168
+ });
169
+
170
+ export { BaseInput, BaseInputProps };
@@ -0,0 +1,94 @@
1
+ .inputWrapper {
2
+ position: relative;
3
+ width: 100%;
4
+ margin-top: 8px;
5
+ input {
6
+ width: 100%;
7
+ color: #333;
8
+ display: block;
9
+ box-sizing: border-box;
10
+ appearance: none;
11
+ padding: 12px 12px;
12
+ border-radius: 4px;
13
+ border: 1px solid #e2e0db;
14
+ font-size: 14px;
15
+ outline: none;
16
+ height: 40px;
17
+ font-family: Inter;
18
+ font-size: 12px;
19
+ font-style: normal;
20
+ font-weight: 400;
21
+ line-height: 20px; /* 166.667% */
22
+
23
+ &:focus {
24
+ outline: none;
25
+ }
26
+ &::placeholder {
27
+ color: var(--black-and-grey-draft-and-tooltip-desc, #999);
28
+ font-family: Inter;
29
+ font-size: 12px;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ line-height: 20px; /* 166.667% */
33
+ }
34
+ &.readonly {
35
+ cursor: auto !important;
36
+ }
37
+ }
38
+ &.request-app-form-field {
39
+ margin-top: 6px;
40
+ input {
41
+ border: 1px solid #ada9bb;
42
+ border-radius: 5px;
43
+ height: 37px;
44
+ font-style: normal;
45
+ font-weight: 400;
46
+ font-size: 14px;
47
+ line-height: 20px;
48
+ color: #333333;
49
+ font-family: inherit;
50
+ &::placeholder {
51
+ line-height: 17px;
52
+ color: #8c8c8c;
53
+ }
54
+ }
55
+ }
56
+ .removeButton {
57
+ background: none;
58
+ border: none;
59
+ color: #999999; /* Red color */
60
+ cursor: pointer;
61
+ font-size: 18px; /* Size of the delete icon */
62
+ padding: 0;
63
+ display: flex;
64
+ justify-content: center;
65
+ align-items: center;
66
+ margin-right: 10px;
67
+ }
68
+
69
+ .removeButton:hover {
70
+ color: #999999; /* Darker red on hover */
71
+ }
72
+ .inputButtonLink {
73
+ position: absolute;
74
+ right: 15px;
75
+ top: 50%;
76
+ transform: translateY(-50%);
77
+ font-size: 12px;
78
+ text-decoration: none;
79
+ color: #007bff; /* Adjust to match your theme */
80
+ cursor: pointer;
81
+ }
82
+ }
83
+ .withDeleteIcon {
84
+ border: 1px solid #e2e0db;
85
+ border-radius: 4px;
86
+ display: flex;
87
+ width: 95vh;
88
+ input {
89
+ border: none;
90
+ }
91
+ tags {
92
+ border: none;
93
+ }
94
+ }