@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,515 +0,0 @@
1
- /* eslint-disable no-nested-ternary */
2
- import { html } from 'htm/preact';
3
- import { connect } from 'unistore/preact';
4
- import { useContext, useEffect, useRef, useState } from 'preact/hooks';
5
- import { ActivityCustomField, TemplateField } from '@/interfaces';
6
- import AppContext from '@/contexts/AppContext';
7
- import { StoreType } from '@/types/store';
8
- import { LargeLoader } from '@/components/LargeLoader';
9
- import { actionFunctions } from '@/store';
10
- import { Label } from '@/components/Label';
11
- import { Tag } from '@/components/Tag';
12
- import { Select } from '@/components/BasicSelect';
13
-
14
- import styles from './styles.module.scss';
15
-
16
- export type MappingUiProps = {
17
- stepId: number;
18
- templateFields: TemplateField[];
19
- showStepValidation?: boolean;
20
- } & StoreType;
21
-
22
- interface DynamicDataItem {
23
- fieldId: number;
24
- id: string | null;
25
- title: string | null;
26
- type: string;
27
- isDynamic?: boolean;
28
- isVisible: boolean;
29
- }
30
-
31
- interface FieldMappingEndpointData {
32
- [key: string]: DynamicDataItem[];
33
- }
34
-
35
- const NewMappingUI = (props: MappingUiProps) => {
36
- const [loading, setLoading] = useState<boolean>(true);
37
- const [fieldsLoading, setFieldsLoading] = useState<boolean>(true);
38
-
39
- const [fieldsRef, setFieldsRef] = useState<number[]>([]);
40
- const [dynamicItems, setDynamicItems] = useState<DynamicDataItem[]>([]);
41
- const [dynamicListId, setDynamicListId] = useState('');
42
- const [
43
- savedMappingField,
44
- setSavedMappingField,
45
- ] = useState<TemplateField | null>(null);
46
-
47
- const [error, setError] = useState('');
48
- const [standardFields, setStandardFields] = useState<
49
- {
50
- fieldId: number;
51
- id: string | null;
52
- title: string | null;
53
- type: string;
54
- isDynamic: boolean;
55
- isVisible: boolean;
56
- }[]
57
- >([]);
58
-
59
- const [
60
- fieldMappingData,
61
- setFieldMappingData,
62
- ] = useState<FieldMappingEndpointData>({});
63
-
64
- const [fieldListData, setFieldListData] = useState<ActivityCustomField[]>([]);
65
-
66
- const context = useContext(AppContext);
67
- const isReadOnly = context?.isReadOnly;
68
-
69
- const dynamicFieldIdRef = useRef('');
70
-
71
- // This takes care of updating the mapped fields count on the bottom
72
- useEffect(() => {
73
- if (dynamicItems.length > 0) {
74
- // eslint-disable-next-line array-callback-return
75
- dynamicItems.map((el, index) => {
76
- const ele = props.stepDataMapping[props.stepId][el.fieldId];
77
- if (!ele.isDynamic && ele.value) {
78
- const parsedValue = ele.value;
79
- if (parsedValue) setFieldsRef((prev) => [...prev, index]);
80
- } else if (ele.isDynamic && ele.objectValue && el.id) {
81
- const parsedValues = ele.objectValue || {};
82
- if (parsedValues[el.id]) {
83
- setFieldsRef((prev) => [...prev, index]);
84
- }
85
- }
86
- });
87
- }
88
- }, [dynamicItems]);
89
-
90
- useEffect(() => {
91
- if (fieldListData.length) {
92
- setFieldsLoading(false);
93
- }
94
- }, [fieldListData]);
95
-
96
- useEffect(() => {
97
- const mappingField = props.templateFields.filter(
98
- (el) => el.activity_field && el.activity_field.type === 'FIELD_MAPPING',
99
- )[0];
100
-
101
- if (mappingField) {
102
- setSavedMappingField(mappingField);
103
- }
104
-
105
- if (
106
- // fieldListData.length &&
107
- fieldMappingData !== null &&
108
- fieldMappingData !== undefined &&
109
- Object.keys(fieldMappingData).length > 0
110
- ) {
111
- // both field list and mapping data has been fetched
112
- setLoading(false);
113
- const fieldMappingResponseKey = Object.keys(fieldMappingData)[0];
114
- props.setStoreState({
115
- mappingInfo: {
116
- ...props.mappingInfo,
117
- isNewMapping: true,
118
- customFieldsKey: fieldMappingResponseKey,
119
- },
120
- });
121
-
122
- if (
123
- fieldMappingResponseKey &&
124
- Array.isArray(fieldMappingData[fieldMappingResponseKey])
125
- ) {
126
- setDynamicItems([
127
- ...standardFields,
128
- ...fieldMappingData[fieldMappingResponseKey].map((el) => ({
129
- ...el,
130
- isDynamic: true,
131
- isVisible: mappingField.is_visible,
132
- fieldId: mappingField.id,
133
- })),
134
- ]);
135
- } else {
136
- setError(
137
- `fieldMappingResponseKey '${fieldMappingResponseKey}' not found, custom fields are not in a nested array under a single key`,
138
- );
139
- }
140
- }
141
- }, [fieldMappingData]);
142
-
143
- useEffect(() => {
144
- // fetch the mapping field
145
- const mappingField = props.templateFields.filter(
146
- (el) => el.activity_field && el.activity_field.type === 'FIELD_MAPPING',
147
- )[0];
148
-
149
- if (mappingField) {
150
- // set our dynamic list ID
151
- setDynamicListId(`${mappingField.id}`);
152
- } else {
153
- return;
154
- }
155
-
156
- // get a list of standard (TEXT) fields that will be part of the mapping
157
- const standardFieldsToRender = props.templateFields
158
- .filter(
159
- (el) =>
160
- el.activity_field &&
161
- el.activity_field.type === 'TEXTFIELD' &&
162
- el.is_visible && // only show visible standard fields
163
- el.added_in_mapping,
164
- )
165
- .map((el) => ({
166
- fieldId: el.id,
167
- id: el.activity_field && el.activity_field.machine_name,
168
- title: el.activity_field && el.activity_field.title,
169
- type: 'text',
170
- isDynamic: false,
171
- isVisible: el.is_visible,
172
- }));
173
-
174
- setStandardFields(standardFieldsToRender);
175
-
176
- // grab activity output data since that is used in both cases
177
- if (!fieldListData.length) {
178
- if (
179
- mappingField.field_mapping_source &&
180
- props.fieldListMapping[mappingField.field_mapping_source]
181
- ) {
182
- setLoading(true);
183
- // eslint-disable-next-line no-use-before-define
184
- fetchFieldsListData(mappingField);
185
- } else {
186
- console.error(
187
- `Field mapping source not found, expected: ${mappingField.field_mapping_source}`,
188
- );
189
- }
190
- }
191
-
192
- // if dynamic field exists, fetch the fields and show those
193
- if (mappingField && mappingField.activity_field) {
194
- const originalMappingField =
195
- props.parentChildMapping[props.stepId][
196
- mappingField.activity_field.machine_name
197
- ];
198
-
199
- let valuesMapField = '';
200
- if (originalMappingField) {
201
- const valuesMap = originalMappingField.parentFields?.reduce(
202
- (prev, next) => {
203
- const parentFieldId =
204
- props.parentChildMapping[props.stepId][next].fieldId;
205
- return {
206
- ...prev,
207
- [parentFieldId]:
208
- props.stepDataMapping[props.stepId][parentFieldId].value,
209
- };
210
- },
211
- {},
212
- );
213
- valuesMapField = JSON.stringify(valuesMap);
214
- }
215
-
216
- // in case the parent field value changes, refetch the custom fields
217
- if (valuesMapField !== dynamicFieldIdRef.current) {
218
- setLoading(true);
219
-
220
- // eslint-disable-next-line no-use-before-define
221
- fetchAndSaveFieldMappingData(mappingField)
222
- ?.then(() => {
223
- setFieldsRef([]);
224
- setLoading(false);
225
- dynamicFieldIdRef.current = valuesMapField;
226
- })
227
- .catch((err) => console.error(err));
228
- }
229
- }
230
- }, [props.stepDataMapping[props.stepId]]);
231
-
232
- const getStepVisibleFieldsData = (
233
- stepId: number,
234
- ): {
235
- [machineName: string]: string;
236
- } => {
237
- const fields = props.stepDataMapping[stepId];
238
- const requiredFieldsWithValues = Object.keys(fields)
239
- .filter((el) => fields[Number(el)].value)
240
- .reduce((prev, curr) => {
241
- const currentItem = fields[Number(curr)];
242
- return {
243
- ...prev,
244
- [currentItem.machineName]: currentItem.value,
245
- };
246
- }, {});
247
- return requiredFieldsWithValues;
248
- };
249
-
250
- const fetchFieldsListData = (field: TemplateField) => {
251
- const { stepMapping, fieldListMapping } = props;
252
-
253
- const fieldListActivityField =
254
- fieldListMapping[field.field_mapping_source || ''];
255
-
256
- const fieldsListStepObject =
257
- stepMapping && stepMapping[fieldListActivityField.stepId];
258
-
259
- if (fieldListActivityField) {
260
- const payload = {
261
- authorizationId: Number(fieldsListStepObject.selectedAuthId),
262
- activityFieldId: Number(fieldListActivityField.activity_field?.id),
263
- endpointData:
264
- getStepVisibleFieldsData(fieldListActivityField.stepId) || {},
265
- };
266
- return context?.apiHandler
267
- .getCustomFields(payload)
268
- .then((data) => {
269
- if (data)
270
- setFieldListData(
271
- data.map((el) => ({
272
- ...el,
273
- // sample_data: JSON.stringify(['1', '2']), // test sample data
274
- })),
275
- );
276
- })
277
- .catch((err) => {
278
- console.error(err);
279
- setFieldsLoading(false);
280
- });
281
- }
282
- return null;
283
- };
284
-
285
- const fetchAndSaveFieldMappingData = (templateField: TemplateField) => {
286
- const { stepId, stepMapping } = props;
287
- const dynamicEndpoint = `${templateField.activity_field?.dynamic_field_src}`;
288
- return context?.apiHandler
289
- .callDynamicDataEndpoint<FieldMappingEndpointData>(
290
- new URL(dynamicEndpoint),
291
- {
292
- authorization_id: `${stepMapping[stepId].selectedAuthId}`,
293
- ...getStepVisibleFieldsData(stepId),
294
- },
295
- )
296
- .then((data) => {
297
- if (data) setFieldMappingData(data);
298
- return data;
299
- });
300
- };
301
-
302
- const onMappingValueSelected = (
303
- index: number,
304
- item: DynamicDataItem,
305
- isRequired: boolean,
306
- rowIndex: number,
307
- ) => {
308
- const fieldListObject = fieldListData[index];
309
- const arrayIndex = fieldsRef.findIndex((el) => el === rowIndex);
310
- if (index < 0) {
311
- // unset
312
- setFieldsRef((prev) => prev.filter((el) => el !== rowIndex));
313
- if (!item.isDynamic) {
314
- props.setStepFieldData({
315
- stepId: `${props.stepId}`,
316
- fieldId: `${item.fieldId}`,
317
- value: '',
318
- isRequired,
319
- });
320
- } else if (dynamicListId) {
321
- props.setStepMappingData({
322
- stepId: props.stepId,
323
- fieldId: Number(dynamicListId),
324
- id: `${item.id}`,
325
- value: null,
326
- });
327
- }
328
- } else if (fieldListObject) {
329
- // value is set
330
- if (arrayIndex < 0) {
331
- //
332
- setFieldsRef((prev) => [...prev, rowIndex]);
333
- }
334
- if (!item.isDynamic) {
335
- props.setStepFieldData({
336
- stepId: `${props.stepId}`,
337
- fieldId: `${item.fieldId}`,
338
- value: fieldListObject.tag,
339
- isRequired,
340
- });
341
- } else if (dynamicListId) {
342
- props.setStepMappingData({
343
- stepId: props.stepId,
344
- fieldId: Number(dynamicListId),
345
- id: `${item.id}`,
346
- value: fieldListObject.tag,
347
- });
348
- }
349
- }
350
- props.verifyStepValidity(props.stepId);
351
- };
352
-
353
- return html`
354
- <div>
355
- <${Label}
356
- title=${savedMappingField?.title ||
357
- savedMappingField?.activity_field?.title}
358
- description=${savedMappingField?.description ||
359
- savedMappingField?.activity_field?.description}
360
- />
361
- <div>
362
- ${loading
363
- ? html`<div class=${styles.loader}><${LargeLoader} /></div>`
364
- : error
365
- ? html` <div>${error}</div> `
366
- : html`
367
- <div class=${styles.mappingWrap}>
368
- <div class=${styles.mappingRow}>
369
- <div class=${styles.mappingHeaderItem}>
370
- <img
371
- src=${props.stepMapping[props.stepId].step.activity.app
372
- .icon_url}
373
- />
374
- <div>
375
- ${`${
376
- props.stepMapping[props.stepId].step.activity.app.name
377
- } Field`}
378
- </div>
379
- </div>
380
- <div class=${styles.sampleData}>Sample Data</div>
381
- <div class=${styles.mappingHeaderItem}>
382
- <img src=${props.genericData.brandingApp?.icon_url} />
383
- <div>${props.genericData.brandingApp?.name} Field</div>
384
- </div>
385
- ${isReadOnly &&
386
- html`<div class=${styles.tagColumn}>
387
- </div>`}
388
- </div>
389
- ${dynamicItems.map((el, itemIndex) => {
390
- // console.log(itemIndex);
391
- // console.log({ el });
392
-
393
- if (!el.isVisible) return html``;
394
-
395
- const slug = el.id || '';
396
- const ele = props.stepDataMapping[props.stepId][el.fieldId];
397
- // console.log({ ele });
398
- let selectVal = '';
399
- let parsedVal: string | Record<string, string | number>;
400
- if (el.isDynamic) {
401
- parsedVal = ele.objectValue as Record<
402
- string,
403
- string | number
404
- >;
405
- } else {
406
- parsedVal = `${ele.value}`;
407
- }
408
-
409
- // console.log({ parsedVal });
410
- if (
411
- el.id &&
412
- el.isDynamic &&
413
- ele.objectValue &&
414
- (parsedVal as Record<string, string | number>)[slug]
415
- ) {
416
- selectVal = `${
417
- (parsedVal as Record<string, string | number>)[slug]
418
- }`;
419
- } else if (!el.isDynamic) {
420
- selectVal = parsedVal as string;
421
- }
422
-
423
- let sampleData = '';
424
- const rawData =
425
- fieldListData.filter((field) => field.tag === selectVal)[0]
426
- ?.sample_data ?? '';
427
- try {
428
- sampleData = JSON.parse(rawData);
429
- } catch (err) {
430
- sampleData = rawData;
431
- }
432
-
433
- return html`
434
- <div class=${styles.mappingRow}>
435
- <div class=${styles.title}>
436
- ${el.title}${ele?.isRequired && html`<span>*</span>`}
437
- </div>
438
- <div class=${styles.sampleData}>
439
- ${sampleData
440
- ? Array.isArray(sampleData)
441
- ? sampleData.map(
442
- (sample: string | Record<string, string>) =>
443
- sample ? html`<pre>${sample}</pre>` : html``,
444
- )
445
- : html`<pre>${sampleData}</pre>`
446
- : html``}
447
- </div>
448
- <div class=${styles.selectBox}>
449
- <${Select}
450
- ariaLabel="Map a value"
451
- placeholder="Please map a value"
452
- options=${fieldListData.map((item) => ({
453
- key: item.tag,
454
- label: item.text,
455
- }))}
456
- value=${selectVal}
457
- isRequired=${ele?.isRequired}
458
- showStepValidation=${props.showStepValidation}
459
- showUnselectedValue=${true}
460
- unselectedText="Skip"
461
- loading=${fieldsLoading}
462
- onChange=${(index: number) =>
463
- onMappingValueSelected(
464
- index,
465
- el,
466
- ele?.isRequired ?? false,
467
- itemIndex,
468
- )}
469
- isReadOnly=${isReadOnly}
470
- ><//>
471
- </div>
472
- ${isReadOnly &&
473
- html`<div class=${styles.tagColumn}>
474
- ${ele.isChanged &&
475
- html`<${Tag} label="Changed"/>`}
476
- </div>`}
477
- </div>
478
- `;
479
- })}
480
- <div class=${styles.mappingInfo}>
481
- <div>
482
- <span>Mapped</span>
483
- <span
484
- >${fieldsRef.length}${' '}
485
- field${fieldsRef.length !== 1 ? 's' : ''}</span
486
- >
487
- </div>
488
- <div>
489
- <span>Ignored</span>
490
- <span
491
- >${dynamicItems.length - fieldsRef.length}${' '}
492
- field${dynamicItems.length - fieldsRef.length !== 1
493
- ? 's'
494
- : ''}</span
495
- >
496
- </div>
497
- </div>
498
- </div>
499
- `}
500
- </div>
501
- </div>
502
- `;
503
- };
504
-
505
- export default connect<MappingUiProps, unknown, StoreType, unknown>(
506
- [
507
- 'stepState',
508
- 'genericData',
509
- 'stepMapping',
510
- 'fieldListMapping',
511
- 'stepDataMapping',
512
- 'parentChildMapping',
513
- ],
514
- actionFunctions,
515
- )(NewMappingUI);
@@ -1,113 +0,0 @@
1
- .mappingWrap {
2
- .mappingInfo {
3
- margin-top: 20px;
4
- display: flex;
5
- justify-content: flex-end;
6
- font-size: 10px;
7
- line-height: 12px;
8
- display: flex;
9
- align-items: center;
10
- letter-spacing: 0.1px;
11
- color: #999999;
12
- & > :not(:last-child) {
13
- margin-right: 20px;
14
- }
15
- & > div {
16
- margin-right: 7px;
17
- & > span:first-child {
18
- color: #333333;
19
- margin: 0;
20
- margin-right: 3px;
21
- }
22
- }
23
- }
24
- & .mappingRow:first-child {
25
- padding-top: 0;
26
- padding-bottom: 5px;
27
- height: 60px;
28
- font-style: normal;
29
- font-weight: normal;
30
- font-size: 14px;
31
- letter-spacing: 0.1px;
32
- color: #333333;
33
- }
34
- }
35
-
36
- .loader {
37
- margin-top: 35px;
38
- margin-bottom: -60px;
39
- display: flex;
40
- justify-content: center;
41
- }
42
-
43
- .mappingRow {
44
- display: flex;
45
- box-sizing: content-box;
46
- align-items: center;
47
- justify-content: space-between;
48
- background-color: #fff;
49
- padding-left: 10px;
50
- padding-right: 10px;
51
- height: 90px;
52
- .title {
53
- width: 40%;
54
- padding-right: 4px;
55
- font-weight: 500;
56
- font-size: 14px;
57
- color: #333333;
58
- padding-right: 10px;
59
- line-height: 18px;
60
- white-space: nowrap;
61
- overflow: hidden;
62
- text-overflow: ellipsis;
63
- span {
64
- color: red;
65
- font-size: 16px;
66
- margin-left: 2px;
67
- }
68
- }
69
- .sampleData {
70
- display: flex;
71
- flex-direction: column;
72
- width: 40%;
73
- overflow: hidden;
74
- word-break: break-word;
75
- padding-right: 20px;
76
- }
77
- .selectBox {
78
- width: 40%;
79
- font-size: 14px;
80
- }
81
- &:nth-child(even) {
82
- background: #f8f8f880;
83
- }
84
- &:first-child {
85
- color: #333333;
86
- }
87
- .mappingHeaderItem {
88
- display: flex;
89
- align-items: center;
90
- width: 40%;
91
- &:first-child {
92
- padding-right: 4px;
93
- }
94
- img {
95
- height: 25px;
96
- width: 25px;
97
- padding: 2px;
98
- object-fit: contain;
99
- border-radius: 9999px;
100
- margin-right: 5px;
101
- }
102
- }
103
- pre {
104
- margin: 0;
105
- padding: 0;
106
- color: #7d7d7d;
107
- height: 20px;
108
- font-size: 14px;
109
- line-height: 20px;
110
- overflow: hidden;
111
- text-overflow: ellipsis;
112
- }
113
- }
@@ -1,67 +0,0 @@
1
- import { html } from 'htm/preact';
2
- import { connect } from 'unistore/preact';
3
- import { useState } from 'preact/hooks';
4
- import { actionFunctions } from '@/store';
5
- import { StoreType } from '@/types/store';
6
- import { Modal } from '@/components/Modal';
7
- import { SuccessPopUp } from '@/components/PopUp/SuccessPopUp';
8
- import RequestAppForm from '../request-app-form';
9
- import styles from './styles.module.scss';
10
-
11
- type RequestAppModalProps = StoreType
12
-
13
- const RequestAppModal = (props: RequestAppModalProps) => {
14
- const [showSuccessPopUp, setShowSuccessPopUp] = useState(false);
15
-
16
- const handleCloseRequestAppModal = () => {
17
- props.setStoreState({
18
- showRequestAppModal: false,
19
- requestAppFormData: {},
20
- });
21
- }
22
-
23
- const handleSuccess = () => {
24
- props.setStoreState({
25
- showRequestAppModal: false,
26
- requestAppFormData: {},
27
- });
28
- setShowSuccessPopUp(true);
29
- }
30
-
31
- const handleClosePopUp = () => {
32
- setShowSuccessPopUp(false);
33
- }
34
-
35
- return html`
36
- <${Modal}
37
- isOpen=${props.showRequestAppModal}
38
- onClose=${handleCloseRequestAppModal}
39
- className="request-app-modal"
40
- >
41
- <div class="${styles.modalSetup} ${'integry-container__request-app-modal'}">
42
- <div class=${styles.modalHeader}>
43
- <div class="${styles.modalTitle}">${'Tell us more'}</div>
44
- </div>
45
- <div class="${styles.modalContentWrap}">
46
- <${RequestAppForm} onSuccess=${handleSuccess} />
47
- </div>
48
- </div>
49
- <//>
50
- ${showSuccessPopUp && html`
51
- <${SuccessPopUp}
52
- isOpen=${showSuccessPopUp}
53
- title="Request Sent"
54
- description="We will work hard to make this app available in our marketplace. Thanks for your suggestion!"
55
- buttonLabel="OK"
56
- handleButtonClick=${handleClosePopUp}
57
- />
58
- `
59
- }`;
60
- };
61
-
62
- export default connect<RequestAppModalProps, unknown, StoreType, unknown>(
63
- [
64
- 'showRequestAppModal',
65
- ],
66
- actionFunctions,
67
- )(RequestAppModal);