@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,537 +0,0 @@
1
- import { html, Component } from 'htm/preact';
2
- import { connect } from 'unistore/preact';
3
-
4
- import { Loader } from '@/components/Loader';
5
- import { IntegryAPI } from '@/modules/api';
6
- import { Radio } from '@/components/RadioGroup/Radio';
7
- import { Button, ButtonTypes } from '@/components/Button';
8
- import { ErrorMessage } from '@/components/ErrorMessage';
9
- import { Label } from '@/components/Label';
10
- import { Hint } from '@/components/Tooltip';
11
- import { Authorization, StoreType } from '@/types/store';
12
- import { actionFunctions } from '@/store';
13
- import isBrowser from '@/utils/isBrowser';
14
- import AppContext from '@/contexts/AppContext';
15
-
16
- import { openPopupWindow } from '@/utils/popup';
17
- import { AuthData, isAuthMessage } from '@/utils/isAuthMessage';
18
-
19
- import styles from './styles.module.scss';
20
-
21
- interface AuthSelectorPropsType extends StoreType {
22
- stepId: number;
23
- apiHandler: IntegryAPI;
24
- showErrors?: boolean;
25
- onAuthSelected(
26
- authId: number | null,
27
- isVerified: boolean,
28
- override: boolean,
29
- ): void;
30
- forcedLoading?: boolean;
31
- isReadOnly?: boolean;
32
- }
33
-
34
- interface AuthSelectorStateType {
35
- isLoading: boolean;
36
- fetched: boolean;
37
- willDeleteAuthWithIndex: number | null;
38
- }
39
-
40
- const Confirmation = (props: { callback(shouldDelete: boolean): void }) => {
41
- const { callback } = props;
42
- return html`
43
- <div class=${styles.confirmation}>
44
- <div class=${styles.confirmationText}>Are you sure?</div>
45
- <button onclick=${() => callback(false)}>No</button>
46
- <button onclick=${() => callback(true)}>Yes</button>
47
- </div>
48
- `;
49
- };
50
-
51
- const Resend = () => html`
52
- <svg
53
- class=${styles.resend}
54
- width="13"
55
- height="15"
56
- viewBox="0 0 13 15"
57
- fill="none"
58
- xmlns="http://www.w3.org/2000/svg"
59
- >
60
- <path
61
- d="M11.8403 5.34L10.1453 6.345C10.5053 6.96 10.7003 7.68 10.7003 8.445C10.7003 10.77 8.81031 12.645 6.50031 12.645C4.19031 12.645 2.30031 10.755 2.30031 8.445C2.30031 6.135 4.19031 4.245 6.50031 4.245V6.15L11.1053 3.27L6.50031 0.375V2.28C3.09531 2.28 0.320312 5.055 0.320312 8.46C0.320313 11.85 3.09531 14.625 6.50031 14.625C9.90531 14.625 12.6803 11.85 12.6803 8.445C12.6803 7.32 12.3653 6.255 11.8403 5.34Z"
62
- fill="#8D8D8D"
63
- />
64
- </svg>
65
- `;
66
-
67
- const AuthorizationRow = (props: {
68
- id: string;
69
- value: string;
70
- isChecked?: boolean;
71
- isLoading: boolean;
72
- willDelete?: boolean;
73
- isDeleting?: boolean;
74
- error?: string;
75
- status: 'VERIFYING' | 'CONNECTED' | 'ERROR' | 'IDLE' | null;
76
- handleChange?: (id: string) => void;
77
- handleReverify?: () => void;
78
- handleDelete?: (shouldDelete: boolean) => void;
79
- handleWillDelete?: () => void;
80
- isReadOnly?: boolean;
81
- forcedLoading?: boolean;
82
- }) => {
83
- const {
84
- id,
85
- value,
86
- isChecked,
87
- status = 'IDLE',
88
- isDeleting = false,
89
- willDelete = false,
90
- handleChange,
91
- handleReverify,
92
- handleDelete = () => null,
93
- handleWillDelete = () => null,
94
- error,
95
- isReadOnly,
96
- } = props;
97
- return html`
98
- <${Hint} dismissOnClick=${false} position="top" deltaY=${0}>
99
- <div class=${styles.checkboxRow}>
100
- ${isReadOnly &&
101
- html`<span
102
- class=${styles.readonlyHint}
103
- data-hint=${isReadOnly ? `Cannot modify user selection` : ''}
104
- ></span>`}
105
- <div class=${`${styles.radio} ${isReadOnly ? styles.readonly : ''}`}>
106
- <${Radio}
107
- id=${id}
108
- value=${value}
109
- isChecked=${isChecked}
110
- onChange=${handleChange}
111
- isDisabled=${isReadOnly}
112
- className="authRadio"
113
- />
114
- </div>
115
- <div
116
- class=${`${styles.statusWrap} ${isReadOnly ? styles.readonly : ''}`}
117
- >
118
- <div class=${styles.status}>
119
- ${isReadOnly
120
- ? html`
121
- ${isChecked &&
122
- html`<div>
123
- <div class=${styles.statusGreen} />
124
- Connected
125
- </div>`}
126
- `
127
- : html`
128
- <div>
129
- ${status === 'VERIFYING' &&
130
- !isDeleting &&
131
- html`<div class=${styles.statusOrange} />
132
- Verifying <${Loader} /> `}
133
- </div>
134
- <div>
135
- ${status === 'CONNECTED' &&
136
- !error &&
137
- !isDeleting &&
138
- html`<div class=${styles.statusGreen} />
139
- Connected`}
140
- </div>
141
- <div>
142
- ${status === 'ERROR' &&
143
- !isDeleting &&
144
- html`<div class=${styles.statusRed} />
145
- Failed
146
- ${!isReadOnly &&
147
- html`<div onclick=${handleReverify}>
148
- <${Resend} />
149
- </div>`} `}
150
- </div>
151
- ${isDeleting && html`<${Loader} />`}
152
- ${error &&
153
- !isDeleting &&
154
- !(status === 'VERIFYING') &&
155
- html`<div class=${styles.error}>${error}</div>`}
156
- `}
157
- </div>
158
- </div>
159
- ${willDelete &&
160
- !isDeleting &&
161
- html` <${Confirmation} callback=${handleDelete} /> `}
162
- ${!(status === 'VERIFYING' || isDeleting || willDelete) &&
163
- !isReadOnly &&
164
- html`
165
- <div class=${styles.deleteIcon} onclick=${handleWillDelete}>
166
- <svg
167
- width="15"
168
- height="15"
169
- viewBox="0 0 15 15"
170
- fill="none"
171
- xmlns="http://www.w3.org/2000/svg"
172
- >
173
- <path d="M1.5 4.1999H13.65" stroke="#F05C42" />
174
- <path
175
- d="M11.6254 5.5498V6.2248L10.9504 13.6498H4.20039L3.52539 6.2248V5.5498"
176
- stroke="#F05C42"
177
- stroke-linejoin="round"
178
- />
179
- <path
180
- 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"
181
- stroke="#F05C42"
182
- />
183
- </svg>
184
- </div>
185
- `}
186
- </div>
187
- <//>
188
- `;
189
- };
190
-
191
- class AuthSelector extends Component<
192
- AuthSelectorPropsType,
193
- AuthSelectorStateType
194
- > {
195
- static contextType = AppContext;
196
-
197
- constructor(props: AuthSelectorPropsType) {
198
- super(props);
199
- this.state = {
200
- isLoading: false,
201
- fetched: false,
202
- willDeleteAuthWithIndex: null,
203
- };
204
- }
205
-
206
- componentDidMount() {
207
- if (isBrowser())
208
- window.addEventListener('message', this.onAuthResponseReceived);
209
-
210
- // in preview mode, auto-verify the auth we pass
211
- const { stepId, stepMapping } = this.props;
212
- let auth = stepMapping[stepId].selectedAuthId;
213
- if (!auth && stepMapping[stepId].authorizations.length > 0) {
214
- auth = stepMapping[stepId].authorizations[0].authorizationId;
215
- }
216
- let authIndex = stepMapping[stepId].authorizations.findIndex(
217
- (el) => el.authorizationId === auth,
218
- );
219
- if(stepMapping[stepId].authorizations.length > 0 && authIndex === -1) {
220
- authIndex = 0;
221
- }
222
- const authStatus = this.getAuthStatus(
223
- stepMapping[stepId].authorizations[authIndex] || auth,
224
- );
225
- // auth is selected but is in idle state
226
- if (stepMapping[stepId].selectedAuthId && authStatus === 'IDLE') {
227
- this.verifyAuth(authIndex, true);
228
- } else if (!stepMapping[stepId].selectedAuthId && authIndex !== -1) {
229
- this.verifyAuth(authIndex, true);
230
- } else if (auth) {
231
- this.verifyAuth(0, true);
232
- }
233
- }
234
-
235
- componentDidUpdate(prevProps: AuthSelectorPropsType) {
236
- const { stepId, stepMapping } = this.props;
237
- const step = stepMapping[stepId];
238
- const authId = step.selectedAuthId;
239
-
240
- const authIndex = stepMapping[stepId].authorizations.findIndex(
241
- (el) => el.authorizationId === authId,
242
- );
243
-
244
- const auth = stepMapping[stepId].authorizations[authIndex];
245
-
246
- const authStatus = this.getAuthStatus(
247
- stepMapping[stepId].authorizations[authIndex],
248
- );
249
-
250
- // verify auth whenever we select a new one
251
- // if (authId !== prevProps.stepMapping[stepId].selectedAuthId && authIndex) {
252
- // console.log('verifying 1');
253
-
254
- // this.verifyAuth(authIndex);
255
- // }
256
- if (
257
- step.authorizations.length ===
258
- prevProps.stepMapping[stepId].authorizations.length + 1
259
- ) {
260
- // auth was added so we verify
261
- this.verifyAuth(step.authorizations.length - 1);
262
- }
263
- // verify auth in edit mode when step changes
264
- if (
265
- authStatus === 'IDLE' &&
266
- !auth.isVerifying &&
267
- !auth.isVerified &&
268
- !this.state.isLoading
269
- ) {
270
- this.verifyAuth(authIndex, true);
271
- }
272
- }
273
-
274
- componentWillUnmount() {
275
- if (isBrowser())
276
- window.removeEventListener('message', this.onAuthResponseReceived);
277
- }
278
-
279
- private verifyAuth = (authIndex: number, override?: boolean) => {
280
- const { stepId } = this.props;
281
- const auth = this.props.stepMapping[stepId].authorizations[authIndex];
282
-
283
- if (!auth) return;
284
-
285
- const isAuthVerifiedInPreviewMode =
286
- !this.props.genericData.isPreviewMode && auth.isVerified;
287
- const hideAuhtorizationStatus = !this.props.stepMapping[stepId]
288
- .isUserinfoRequired;
289
-
290
- if (isAuthVerifiedInPreviewMode || hideAuhtorizationStatus) {
291
- this.props.onAuthSelected(auth.authorizationId, true, !!override);
292
- this.context.eventEmitter.emit('did-select-authorization', {
293
- authorizationId: Number(auth.authorizationId),
294
- });
295
- return;
296
- }
297
-
298
- this.setState({ isLoading: true });
299
- this.props.toggleVerifyAuthorizationFlag({
300
- stepId,
301
- authId: auth.authorizationId,
302
- isVerifying: true,
303
- });
304
-
305
- this.props.apiHandler
306
- .verifyOAuth(auth.authorizationId)
307
- .then((res) => {
308
- if (res) {
309
- this.props.onAuthSelected(auth.authorizationId, true, !!override);
310
- this.context.eventEmitter.emit('did-select-authorization', {
311
- authorizationId: Number(auth.authorizationId),
312
- });
313
- } else {
314
- this.props.onAuthSelected(auth.authorizationId, false, !!override);
315
- }
316
- })
317
- .catch((err) => console.error(err))
318
- .finally(() => {
319
- this.props.toggleVerifyAuthorizationFlag({
320
- stepId,
321
- authId: auth.authorizationId,
322
- isVerifying: false,
323
- });
324
- this.setState({ isLoading: false });
325
- });
326
- };
327
-
328
- private willDelete = (authIndex: number) => {
329
- this.setState({
330
- willDeleteAuthWithIndex: authIndex,
331
- });
332
- };
333
-
334
- private deleteAuth = (authIndex: number) => {
335
- const { stepId } = this.props;
336
- const auth = this.props.stepMapping[stepId].authorizations[authIndex];
337
-
338
- this.props.toggleDeleteAuthorizationFlag({
339
- stepId,
340
- authId: auth.authorizationId,
341
- isDeleting: true,
342
- error: '',
343
- });
344
-
345
- this.context.eventEmitter.emit('did-begin-remove-authorization', {
346
- authorizationId: Number(auth.authorizationId),
347
- });
348
-
349
- this.props.apiHandler
350
- .deleteAuth(auth.authorizationId)
351
- .then((res) => {
352
- if (res?.status === 200) {
353
- this.props.removeAuthorization({
354
- stepId,
355
- authId: auth.authorizationId,
356
- });
357
- this.context.eventEmitter.emit('did-remove-authorization', {
358
- authorizationId: Number(auth.authorizationId),
359
- appId: this.props.genericData.app_id || '',
360
- });
361
- } else if (res?.status === 405) {
362
- // we have a deletion error
363
- this.props.toggleDeleteAuthorizationFlag({
364
- stepId,
365
- authId: auth.authorizationId,
366
- isDeleting: false,
367
- error: `${res.data}`,
368
- });
369
- } else {
370
- this.props.toggleDeleteAuthorizationFlag({
371
- stepId,
372
- authId: auth.authorizationId,
373
- isDeleting: false,
374
- error: 'An unexpected error occurred',
375
- });
376
- }
377
- })
378
- .catch((err) => {
379
- console.error(err);
380
- })
381
- .finally(() => this.setState({ willDeleteAuthWithIndex: null }));
382
- };
383
-
384
- private onAuthResponseReceived = (messageEvent: MessageEvent<AuthData>) => {
385
- if (isAuthMessage(messageEvent) && messageEvent.data.activity_name) {
386
- console.info(messageEvent.data);
387
- if (this.props.stepId) {
388
- const { stepId } = this.props;
389
- const authApp = this.props.stepMapping[stepId]?.step?.activity?.app;
390
- if (!messageEvent.data.already_exists) {
391
- this.props.addAuthorization({
392
- stepId: this.props.stepId,
393
- authData: {
394
- authorizationId: messageEvent.data.authorization_id,
395
- userIdentity: messageEvent.data.user_identity,
396
- disableLink: '',
397
- authType: '',
398
- isVerified: false,
399
- didFetchStatus: false,
400
- isVerifying: false,
401
- isDeleting: false,
402
- error: '',
403
- },
404
- });
405
- } else {
406
- this.props.setStepAuthId({
407
- stepId: this.props.stepId,
408
- authId: Number(messageEvent.data.authorization_id),
409
- });
410
- }
411
- this.context.eventEmitter.emit('did-add-authorization', {
412
- identity: messageEvent.data.user_identity,
413
- authorizationId: Number(messageEvent.data.authorization_id),
414
- flowId: this.props.genericData.templateId,
415
- appId: authApp.id || '',
416
- appName: authApp?.name,
417
- appIcon: authApp?.icon_url,
418
- alreadyExists: messageEvent.data.already_exists,
419
- externalId: messageEvent.data.external_id,
420
- });
421
- }
422
- }
423
- };
424
-
425
- private getAuthStatus = (auth: Authorization) => {
426
- const { stepId } = this.props;
427
- if (!auth) return null;
428
- let status = 'IDLE';
429
- const hideAuhtorizationStatus = !this.props.stepMapping[stepId]
430
- .isUserinfoRequired;
431
- if (hideAuhtorizationStatus) {
432
- return status;
433
- }
434
- if (auth.isVerified && auth.didFetchStatus) status = 'CONNECTED';
435
- if (!auth.isVerified && auth.didFetchStatus) status = 'ERROR';
436
- if (auth.isVerifying) status = 'VERIFYING';
437
- return status;
438
- };
439
-
440
- private getError = () => {
441
- const { stepId } = this.props;
442
- const step = this.props.stepMapping[stepId];
443
- if (!step.authorizations) {
444
- return `Please add a valid ${
445
- step.step.authorization_type.app?.name || step.step.activity.app.name
446
- } account`;
447
- }
448
- return `Please select a valid ${
449
- step.step.authorization_type.app?.name || step.step.activity.app.name
450
- } account`;
451
- };
452
-
453
- public openAuthWindow = () => {
454
- const { stepMapping, stepId } = this.props;
455
- const selectedStep = stepMapping[stepId].step;
456
- if (selectedStep) {
457
- const url = this.context.apiHandler.getAuthUrl(
458
- selectedStep.authorization_type.id,
459
- );
460
- openPopupWindow(url, 'Auth Window', window, 800, 600);
461
- }
462
- };
463
-
464
- render() {
465
- const { stepId, showErrors = false, forcedLoading = false } = this.props;
466
- const step = this.props.stepMapping[stepId];
467
- const { authorizations } = step;
468
- const isReadOnly = this.context?.isReadOnly || this.props.isReadOnly;
469
- if (forcedLoading) {
470
- return html`
471
- <div style="margin-top:-74px; display: flex; justify-content: center;">
472
- <${Loader} />
473
- </div>
474
- `;
475
- }
476
- return html`
477
- <div class="${styles.authSelectorWrap} integry-container__auth-selector">
478
- <${Label}
479
- title="Connect account"
480
- description=${`Select your ${
481
- step.step.authorization_type.app?.name ||
482
- step.step.activity.app.name
483
- } account`}
484
- isRequired=${true}
485
- />
486
- <div class=${styles.rows}>
487
- ${authorizations.map(
488
- (el, index) => html`<${AuthorizationRow}
489
- id=${el.authorizationId}
490
- value=${el.userIdentity}
491
- status=${this.getAuthStatus(el)}
492
- isChecked=${el.authorizationId === step.selectedAuthId}
493
- isDeleting=${el.isDeleting}
494
- willDelete=${this.state.willDeleteAuthWithIndex === index}
495
- error=${el.error}
496
- handleChange=${() => this.verifyAuth(index)}
497
- handleReverify=${() => this.verifyAuth(index)}
498
- handleDelete=${(shouldDelete: boolean) =>
499
- shouldDelete
500
- ? this.deleteAuth(index)
501
- : this.setState({ willDeleteAuthWithIndex: null })}
502
- handleWillDelete=${() => this.willDelete(index)}
503
- isReadOnly=${isReadOnly}
504
- />`,
505
- )}
506
- </div>
507
- ${!isReadOnly &&
508
- html`
509
- <div class=${showErrors ? `${styles.error}` : ''}>
510
- <${Button}
511
- onClick=${() =>
512
- !this.props.genericData.isPreviewMode && this.openAuthWindow()}
513
- label=${`Add ${step.step.authorization_type.app.name} account`}
514
- type=${ButtonTypes.SECONDARY}
515
- disabled=${this.state.isLoading ||
516
- this.props.genericData.isPreviewMode}
517
- tooltip=${this.props.genericData.isPreviewMode &&
518
- 'New accounts cannot be added in preview mode'}
519
- >
520
- <//>
521
- </div>
522
- ${showErrors && html`<${ErrorMessage}>${this.getError()}<//>`}
523
- `}
524
- </div>
525
- `;
526
- }
527
- }
528
-
529
- export default connect<
530
- AuthSelectorPropsType,
531
- AuthSelectorStateType,
532
- StoreType,
533
- unknown
534
- >(
535
- ['stepMapping', 'genericData'],
536
- actionFunctions,
537
- )(AuthSelector);
@@ -1,161 +0,0 @@
1
- .authSelectorWrap {
2
- .label {
3
- font-weight: 800;
4
- font-size: 14px;
5
- color: #333333;
6
- line-height: 20px;
7
- margin-bottom: 5px;
8
-
9
- span {
10
- color: #ff4d34;
11
- margin-left: 2px;
12
- font-size: 16px;
13
- }
14
- }
15
-
16
- .confirmation {
17
- display: flex;
18
- align-items: center;
19
- width: 35%;
20
- button {
21
- cursor: pointer;
22
- -webkit-appearance: button;
23
- font-weight: 500;
24
- font-size: 12px;
25
- line-height: 15px;
26
- /* identical to box height */
27
- padding: 4px 12px;
28
-
29
- text-align: center;
30
- border-radius: 12px;
31
- border: 0;
32
- outline: none;
33
-
34
- color: #7e7a8f;
35
- background-color: #f1f1f1;
36
-
37
- &:nth-child(2) {
38
- color: #ffffff;
39
- margin-left: 10px;
40
- margin-right: 10px;
41
- background-color: #f05c42;
42
- }
43
- }
44
- }
45
- .rows {
46
- margin-top: 24px;
47
- margin-bottom: 24px;
48
- }
49
-
50
- .error {
51
- color: #f05c42;
52
- button {
53
- color: #f05c42;
54
- border-color: #f05c42;
55
- }
56
- }
57
-
58
- .errorMessage {
59
- margin-top: 4px;
60
- font-size: 12px;
61
- line-height: 15px;
62
- letter-spacing: -0.197647px;
63
- color: #f05c42;
64
- }
65
-
66
- .description {
67
- font-size: 14px;
68
- line-height: 20px;
69
- color: #8c8c8c;
70
- margin-bottom: 10px;
71
- }
72
-
73
- .checkboxRow {
74
- display: flex;
75
- align-items: center;
76
- color: #333;
77
- font-size: 14px;
78
- margin-bottom: 16px;
79
-
80
- .radio {
81
- width: 45%;
82
- overflow: hidden;
83
- text-overflow: ellipsis;
84
- white-space: nowrap;
85
- &.readonly {
86
- width: 70%;
87
- }
88
- }
89
- .deleteIcon {
90
- width: 200px;
91
- padding-left: 8px;
92
- padding-right: 8px;
93
- display: flex;
94
- align-items: center;
95
- cursor: pointer;
96
- svg {
97
- cursor: pointer;
98
- visibility: hidden;
99
- user-select: none;
100
- }
101
- }
102
- .statusWrap {
103
- display: flex;
104
- align-items: center;
105
- font-size: 12px;
106
- width: 20%;
107
- &.readonly {
108
- width: 30%;
109
- }
110
- .status {
111
- position: relative;
112
- width: 200px;
113
- div {
114
- display: flex;
115
- align-items: center;
116
- }
117
- svg {
118
- margin-left: 8px;
119
- }
120
- .statusRed,
121
- .statusOrange,
122
- .statusGreen {
123
- width: 5px;
124
- height: 5px;
125
- border-radius: 9999px;
126
- margin: 0 8px;
127
- }
128
- .statusRed {
129
- background: #e26154;
130
- }
131
- .statusOrange {
132
- background: #fcc700;
133
- }
134
-
135
- .statusGreen {
136
- background: #2ecc71;
137
- }
138
-
139
- span {
140
- margin-left: 10px;
141
- }
142
- .resend {
143
- cursor: pointer;
144
- }
145
- }
146
- }
147
- &:hover {
148
- .deleteIcon svg {
149
- visibility: visible;
150
- user-select: auto;
151
- }
152
- }
153
- .readonlyHint {
154
- position: absolute;
155
- width: 40%;
156
- height: -webkit-fill-available;
157
- z-index: 99;
158
- margin: 10px 0px;
159
- }
160
- }
161
- }