@jetbrains/ring-ui-built 6.1.1-beta.0 → 7.0.0-beta.10

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 (351) hide show
  1. package/components/_helpers/_rollupPluginBabelHelpers.js +1 -504
  2. package/components/_helpers/anchor.js +7 -10
  3. package/components/_helpers/button__classes.js +23 -20
  4. package/components/_helpers/caption.js +11 -21
  5. package/components/_helpers/card.js +91 -123
  6. package/components/_helpers/dialog__body-scroll-preventer.js +10 -17
  7. package/components/_helpers/header.js +1 -1
  8. package/components/_helpers/icon__svg.js +27 -29
  9. package/components/_helpers/input.js +151 -193
  10. package/components/_helpers/query-assist__suggestions.js +79 -94
  11. package/components/_helpers/select__filter.js +56 -75
  12. package/components/_helpers/services-link.js +23 -39
  13. package/components/_helpers/sidebar.js +91 -102
  14. package/components/_helpers/tab-link.js +8 -12
  15. package/components/_helpers/table.js +1 -1
  16. package/components/_helpers/theme.js +61 -51
  17. package/components/_helpers/title.js +59 -84
  18. package/components/alert/alert.d.ts +7 -24
  19. package/components/alert/alert.js +111 -179
  20. package/components/alert/container.d.ts +0 -5
  21. package/components/alert/container.js +32 -44
  22. package/components/alert-service/alert-service.js +104 -162
  23. package/components/analytics/analytics.js +12 -20
  24. package/components/analytics/analytics__custom-plugin.js +52 -68
  25. package/components/auth/auth.js +2 -31
  26. package/components/auth/auth__core.d.ts +1 -1
  27. package/components/auth/auth__core.js +754 -1440
  28. package/components/auth/background-flow.js +84 -121
  29. package/components/auth/down-notification.js +32 -79
  30. package/components/auth/iframe-flow.js +71 -125
  31. package/components/auth/request-builder.js +46 -77
  32. package/components/auth/response-parser.js +84 -112
  33. package/components/auth/storage.js +162 -324
  34. package/components/auth/token-validator.js +132 -227
  35. package/components/auth/window-flow.js +84 -121
  36. package/components/auth-dialog/auth-dialog.d.ts +0 -18
  37. package/components/auth-dialog/auth-dialog.js +107 -176
  38. package/components/auth-dialog-service/auth-dialog-service.js +12 -33
  39. package/components/avatar/avatar-example-datauri.js +1 -1
  40. package/components/avatar/avatar.d.ts +0 -13
  41. package/components/avatar/avatar.js +94 -136
  42. package/components/avatar/fallback-avatar.d.ts +1 -10
  43. package/components/avatar/fallback-avatar.js +20 -40
  44. package/components/badge/badge.d.ts +0 -10
  45. package/components/badge/badge.js +32 -48
  46. package/components/breadcrumbs/breadcrumbs.js +13 -17
  47. package/components/button/button.d.ts +0 -21
  48. package/components/button/button.js +68 -104
  49. package/components/button/button__classes.d.ts +1 -1
  50. package/components/button-group/button-group.d.ts +0 -5
  51. package/components/button-group/button-group.js +27 -41
  52. package/components/button-group/caption.d.ts +0 -4
  53. package/components/button-group/caption.js +0 -1
  54. package/components/button-set/button-set.d.ts +0 -6
  55. package/components/button-set/button-set.js +19 -33
  56. package/components/button-toolbar/button-toolbar.d.ts +0 -6
  57. package/components/button-toolbar/button-toolbar.js +17 -31
  58. package/components/caret/caret.js +184 -211
  59. package/components/checkbox/checkbox.d.ts +0 -19
  60. package/components/checkbox/checkbox.js +69 -104
  61. package/components/clipboard/clipboard-fallback.js +7 -7
  62. package/components/clipboard/clipboard.js +36 -129
  63. package/components/code/code.d.ts +0 -12
  64. package/components/code/code.js +83 -163
  65. package/components/collapse/collapse-content.js +42 -60
  66. package/components/collapse/collapse-context.js +2 -2
  67. package/components/collapse/collapse-control.js +12 -12
  68. package/components/collapse/collapse.js +12 -17
  69. package/components/collapse/consts.js +4 -4
  70. package/components/collapse/utils.js +1 -3
  71. package/components/confirm/confirm.d.ts +0 -14
  72. package/components/confirm/confirm.js +68 -112
  73. package/components/confirm-service/confirm-service.js +25 -47
  74. package/components/content-layout/content-layout.d.ts +0 -7
  75. package/components/content-layout/content-layout.js +41 -63
  76. package/components/content-layout/sidebar.d.ts +0 -9
  77. package/components/content-layout/sidebar.js +1 -2
  78. package/components/contenteditable/contenteditable.d.ts +1 -22
  79. package/components/contenteditable/contenteditable.js +37 -60
  80. package/components/control-help/control-help.js +5 -3
  81. package/components/control-label/control-label.js +9 -14
  82. package/components/data-list/data-list.d.ts +4 -6
  83. package/components/data-list/data-list.js +115 -179
  84. package/components/data-list/data-list.mock.js +3 -6
  85. package/components/data-list/item.js +119 -165
  86. package/components/data-list/selection.js +77 -135
  87. package/components/data-list/title.d.ts +2 -2
  88. package/components/data-list/title.js +2 -12
  89. package/components/date-picker/consts.d.ts +0 -2
  90. package/components/date-picker/consts.js +16 -24
  91. package/components/date-picker/date-input.d.ts +0 -20
  92. package/components/date-picker/date-input.js +100 -148
  93. package/components/date-picker/date-picker.d.ts +0 -29
  94. package/components/date-picker/date-picker.js +143 -224
  95. package/components/date-picker/date-popup.d.ts +0 -22
  96. package/components/date-picker/date-popup.js +282 -352
  97. package/components/date-picker/day.d.ts +0 -14
  98. package/components/date-picker/day.js +72 -109
  99. package/components/date-picker/month-names.d.ts +1 -11
  100. package/components/date-picker/month-names.js +42 -72
  101. package/components/date-picker/month-slider.d.ts +0 -9
  102. package/components/date-picker/month-slider.js +43 -71
  103. package/components/date-picker/month.d.ts +1 -9
  104. package/components/date-picker/month.js +18 -30
  105. package/components/date-picker/months.d.ts +1 -9
  106. package/components/date-picker/months.js +45 -55
  107. package/components/date-picker/weekdays.d.ts +2 -8
  108. package/components/date-picker/weekdays.js +12 -25
  109. package/components/date-picker/years.d.ts +0 -6
  110. package/components/date-picker/years.js +77 -104
  111. package/components/dialog/dialog.d.ts +0 -20
  112. package/components/dialog/dialog.js +153 -210
  113. package/components/dialog/dialog__body-scroll-preventer.js +0 -3
  114. package/components/dropdown/anchor.d.ts +1 -8
  115. package/components/dropdown/anchor.js +0 -7
  116. package/components/dropdown/dropdown.d.ts +4 -22
  117. package/components/dropdown/dropdown.js +134 -176
  118. package/components/dropdown-menu/dropdown-menu.js +51 -103
  119. package/components/editable-heading/editable-heading.js +69 -118
  120. package/components/error-bubble/error-bubble.d.ts +0 -6
  121. package/components/error-bubble/error-bubble.js +30 -60
  122. package/components/error-message/error-message.d.ts +0 -10
  123. package/components/error-message/error-message.js +34 -59
  124. package/components/footer/footer.js +28 -44
  125. package/components/form/form.js +1 -1
  126. package/components/global/compose.js +1 -8
  127. package/components/global/composeRefs.d.ts +0 -3
  128. package/components/global/composeRefs.js +8 -15
  129. package/components/global/controls-height.js +2 -2
  130. package/components/global/create-stateful-context.d.ts +0 -4
  131. package/components/global/create-stateful-context.js +14 -17
  132. package/components/global/data-tests.js +7 -12
  133. package/components/global/dom.js +49 -82
  134. package/components/global/focus-sensor-hoc.js +95 -122
  135. package/components/global/fuzzy-highlight.js +23 -34
  136. package/components/global/get-event-key.js +8 -8
  137. package/components/global/get-uid.js +3 -7
  138. package/components/global/inject-styles.js +7 -14
  139. package/components/global/listeners.js +28 -47
  140. package/components/global/memoize.js +6 -10
  141. package/components/global/normalize-indent.js +19 -46
  142. package/components/global/promise-with-timeout.js +6 -8
  143. package/components/global/react-dom-renderer.d.ts +0 -5
  144. package/components/global/react-dom-renderer.js +29 -45
  145. package/components/global/rerender-hoc.d.ts +2 -2
  146. package/components/global/rerender-hoc.js +16 -32
  147. package/components/global/schedule-raf.js +4 -4
  148. package/components/global/sniffer.js +1 -1
  149. package/components/global/theme.d.ts +8 -2
  150. package/components/global/theme.js +2 -20
  151. package/components/global/trivial-template-tag.js +4 -9
  152. package/components/global/typescript-utils.js +2 -6
  153. package/components/global/url.js +20 -23
  154. package/components/global/use-event-callback.js +7 -4
  155. package/components/grid/col.d.ts +0 -14
  156. package/components/grid/col.js +27 -53
  157. package/components/grid/grid.d.ts +0 -5
  158. package/components/grid/grid.js +20 -32
  159. package/components/grid/row.d.ts +0 -18
  160. package/components/grid/row.js +23 -47
  161. package/components/group/group.d.ts +0 -5
  162. package/components/group/group.js +18 -27
  163. package/components/header/header-icon.d.ts +10 -0
  164. package/components/header/header-icon.js +39 -0
  165. package/components/header/header.d.ts +3 -7
  166. package/components/header/header.js +32 -74
  167. package/components/header/links.d.ts +2 -0
  168. package/components/header/links.js +20 -0
  169. package/components/header/logo.d.ts +0 -4
  170. package/components/header/logo.js +15 -30
  171. package/components/header/profile.d.ts +1 -39
  172. package/components/header/profile.js +126 -190
  173. package/components/header/services-link.d.ts +0 -10
  174. package/components/header/services-link.js +1 -4
  175. package/components/header/services.d.ts +0 -14
  176. package/components/header/services.js +67 -112
  177. package/components/header/smart-profile.d.ts +0 -9
  178. package/components/header/smart-profile.js +116 -205
  179. package/components/header/smart-services.d.ts +0 -4
  180. package/components/header/smart-services.js +73 -142
  181. package/components/header/tray.d.ts +0 -5
  182. package/components/header/tray.js +21 -35
  183. package/components/heading/heading.d.ts +1 -4
  184. package/components/heading/heading.js +25 -42
  185. package/components/http/http.js +162 -319
  186. package/components/http/http.mock.js +50 -98
  187. package/components/hub-source/hub-source.js +77 -182
  188. package/components/hub-source/hub-source__user.js +9 -37
  189. package/components/hub-source/hub-source__users-groups.js +34 -60
  190. package/components/i18n/i18n-context.js +7 -8
  191. package/components/i18n/i18n.js +3 -6
  192. package/components/icon/icon.d.ts +0 -11
  193. package/components/icon/icon.js +60 -85
  194. package/components/icon/icon__svg.d.ts +0 -8
  195. package/components/icon/icon__svg.js +0 -6
  196. package/components/icon/index.js +0 -6
  197. package/components/input/input-legacy.js +1 -1
  198. package/components/input/input.js +2 -14
  199. package/components/input-size/input-size.js +1 -1
  200. package/components/island/adaptive-island-hoc.d.ts +4 -5
  201. package/components/island/adaptive-island-hoc.js +30 -39
  202. package/components/island/content.d.ts +0 -10
  203. package/components/island/content.js +99 -119
  204. package/components/island/header.js +55 -73
  205. package/components/island/island.d.ts +4 -13
  206. package/components/island/island.js +25 -41
  207. package/components/island-legacy/content-legacy.d.ts +0 -5
  208. package/components/island-legacy/content-legacy.js +16 -27
  209. package/components/island-legacy/header-legacy.d.ts +0 -5
  210. package/components/island-legacy/header-legacy.js +19 -30
  211. package/components/island-legacy/island-legacy.d.ts +0 -5
  212. package/components/island-legacy/island-legacy.js +16 -27
  213. package/components/link/clickableLink.d.ts +0 -9
  214. package/components/link/clickableLink.js +33 -51
  215. package/components/link/link.d.ts +8 -33
  216. package/components/link/link.js +47 -68
  217. package/components/list/consts.js +2 -2
  218. package/components/list/list.d.ts +0 -32
  219. package/components/list/list.js +399 -516
  220. package/components/list/list__custom.js +51 -78
  221. package/components/list/list__hint.d.ts +0 -4
  222. package/components/list/list__hint.js +8 -21
  223. package/components/list/list__item.js +147 -211
  224. package/components/list/list__link.js +39 -59
  225. package/components/list/list__separator.js +15 -30
  226. package/components/list/list__title.js +25 -41
  227. package/components/list/list__users-groups-source.js +55 -123
  228. package/components/loader/loader.d.ts +0 -10
  229. package/components/loader/loader.js +38 -70
  230. package/components/loader/loader__core.js +123 -184
  231. package/components/loader-inline/loader-inline.d.ts +0 -6
  232. package/components/loader-inline/loader-inline.js +24 -38
  233. package/components/loader-screen/loader-screen.d.ts +0 -6
  234. package/components/loader-screen/loader-screen.js +24 -46
  235. package/components/login-dialog/login-dialog.d.ts +0 -11
  236. package/components/login-dialog/login-dialog.js +94 -145
  237. package/components/login-dialog/service.js +11 -33
  238. package/components/markdown/markdown.js +16 -29
  239. package/components/message/message.js +171 -218
  240. package/components/old-browsers-message/old-browsers-message.js +11 -14
  241. package/components/old-browsers-message/old-browsers-message__stop.js +1 -4
  242. package/components/old-browsers-message/white-list.js +8 -13
  243. package/components/pager/pager.d.ts +1 -0
  244. package/components/pager/pager.js +211 -275
  245. package/components/panel/panel.d.ts +0 -5
  246. package/components/panel/panel.js +16 -27
  247. package/components/permissions/permissions.js +118 -161
  248. package/components/permissions/permissions__cache.js +191 -218
  249. package/components/popup/popup.consts.js +1 -1
  250. package/components/popup/popup.js +237 -329
  251. package/components/popup/popup.target.js +9 -12
  252. package/components/popup/position.js +94 -101
  253. package/components/popup-menu/popup-menu.js +31 -76
  254. package/components/progress-bar/progress-bar.d.ts +19 -33
  255. package/components/progress-bar/progress-bar.js +55 -99
  256. package/components/query-assist/query-assist.d.ts +63 -93
  257. package/components/query-assist/query-assist.js +585 -748
  258. package/components/query-assist/query-assist__suggestions.js +2 -28
  259. package/components/radio/radio.d.ts +0 -8
  260. package/components/radio/radio.js +15 -35
  261. package/components/radio/radio__item.d.ts +0 -9
  262. package/components/radio/radio__item.js +52 -72
  263. package/components/scrollable-section/scrollable-section.d.ts +2 -0
  264. package/components/scrollable-section/scrollable-section.js +53 -0
  265. package/components/select/select.d.ts +3 -0
  266. package/components/select/select.js +714 -863
  267. package/components/select/select__filter.js +2 -29
  268. package/components/select/select__popup.js +317 -465
  269. package/components/shortcuts/core.js +147 -195
  270. package/components/shortcuts/shortcut-title.js +6 -10
  271. package/components/shortcuts/shortcuts-hoc.d.ts +4 -9
  272. package/components/shortcuts/shortcuts-hoc.js +23 -46
  273. package/components/shortcuts/shortcuts.d.ts +0 -8
  274. package/components/shortcuts/shortcuts.js +41 -72
  275. package/components/slider/slider.js +93 -113
  276. package/components/slider/slider.utils.js +16 -23
  277. package/components/storage/storage.d.ts +2 -3
  278. package/components/storage/storage.js +2 -46
  279. package/components/storage/storage__local.js +89 -148
  280. package/components/style.css +1 -1
  281. package/components/tab-trap/tab-trap.js +35 -61
  282. package/components/table/cell.d.ts +0 -6
  283. package/components/table/cell.js +11 -27
  284. package/components/table/disable-hover-hoc.d.ts +4 -5
  285. package/components/table/disable-hover-hoc.js +27 -42
  286. package/components/table/header-cell.d.ts +0 -10
  287. package/components/table/header-cell.js +59 -85
  288. package/components/table/header.d.ts +1 -23
  289. package/components/table/header.js +89 -126
  290. package/components/table/multitable.d.ts +0 -4
  291. package/components/table/multitable.js +83 -93
  292. package/components/table/row-with-focus-sensor.d.ts +2 -2
  293. package/components/table/row-with-focus-sensor.js +26 -60
  294. package/components/table/row.js +170 -235
  295. package/components/table/selection-adapter.js +2 -2
  296. package/components/table/selection-shortcuts-hoc.js +102 -126
  297. package/components/table/selection.js +150 -217
  298. package/components/table/simple-table.d.ts +17 -0
  299. package/components/table/simple-table.js +83 -0
  300. package/components/table/smart-table.d.ts +0 -46
  301. package/components/table/smart-table.js +41 -83
  302. package/components/table/table.d.ts +9 -6
  303. package/components/table/table.js +270 -372
  304. package/components/tabs/collapsible-more.d.ts +1 -9
  305. package/components/tabs/collapsible-more.js +47 -97
  306. package/components/tabs/collapsible-tab.js +32 -44
  307. package/components/tabs/collapsible-tabs.d.ts +2 -29
  308. package/components/tabs/collapsible-tabs.js +89 -161
  309. package/components/tabs/custom-item.d.ts +1 -7
  310. package/components/tabs/custom-item.js +4 -7
  311. package/components/tabs/dumb-tabs.d.ts +0 -11
  312. package/components/tabs/dumb-tabs.js +60 -104
  313. package/components/tabs/smart-tabs.d.ts +0 -6
  314. package/components/tabs/smart-tabs.js +29 -68
  315. package/components/tabs/tab-link.d.ts +0 -8
  316. package/components/tabs/tab-link.js +1 -4
  317. package/components/tabs/tab.d.ts +0 -8
  318. package/components/tabs/tab.js +14 -32
  319. package/components/tabs/tabs.js +1 -28
  320. package/components/tag/tag.d.ts +0 -19
  321. package/components/tag/tag.js +120 -179
  322. package/components/tags-input/tags-input.d.ts +7 -33
  323. package/components/tags-input/tags-input.js +224 -339
  324. package/components/tags-list/tags-list.d.ts +0 -13
  325. package/components/tags-list/tags-list.js +45 -74
  326. package/components/text/text.d.ts +0 -7
  327. package/components/text/text.js +27 -43
  328. package/components/toggle/toggle.d.ts +0 -15
  329. package/components/toggle/toggle.js +53 -78
  330. package/components/tooltip/tooltip.d.ts +4 -10
  331. package/components/tooltip/tooltip.js +105 -137
  332. package/components/user-agreement/service.d.ts +2 -1
  333. package/components/user-agreement/service.js +260 -405
  334. package/components/user-agreement/user-agreement.d.ts +0 -18
  335. package/components/user-agreement/user-agreement.js +92 -138
  336. package/components/user-card/card.d.ts +0 -35
  337. package/components/user-card/card.js +2 -27
  338. package/components/user-card/smart-user-card-tooltip.d.ts +0 -5
  339. package/components/user-card/smart-user-card-tooltip.js +52 -108
  340. package/components/user-card/tooltip.d.ts +0 -9
  341. package/components/user-card/tooltip.js +35 -74
  342. package/components/user-card/user-card.js +1 -26
  343. package/package.json +5 -7
  344. package/components/global/prop-types.d.ts +0 -4
  345. package/components/global/prop-types.js +0 -9
  346. package/components/global/react-render-adapter.d.ts +0 -1
  347. package/components/global/react-render-adapter.js +0 -6
  348. package/components/header/tray-icon.d.ts +0 -32
  349. package/components/header/tray-icon.js +0 -56
  350. package/components/storage/storage__fallback.d.ts +0 -79
  351. package/components/storage/storage__fallback.js +0 -253
@@ -1,10 +1,7 @@
1
- import { b as _createClass, e as _classCallCheck, _ as _defineProperty, g as _asyncToGenerator, d as _objectSpread2, h as _regeneratorRuntime, i as _slicedToArray } from '../_helpers/_rollupPluginBabelHelpers.js';
2
- import 'core-js/modules/es.array.iterator.js';
3
- import 'core-js/modules/es.object.to-string.js';
4
- import 'core-js/modules/es.promise.js';
1
+ import { _ as _defineProperty, b as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
5
2
  import 'core-js/modules/web.dom-collections.iterator.js';
6
3
  import { createRoot } from 'react-dom/client';
7
- import ActualStorage from '../storage/storage.js';
4
+ import LocalStorage from '../storage/storage__local.js';
8
5
  import alertService from '../alert-service/alert-service.js';
9
6
  import Link from '../link/link.js';
10
7
  import Alert from '../alert/alert.js';
@@ -12,27 +9,15 @@ import Group from '../group/group.js';
12
9
  import { ControlsHeightContext, getGlobalControlsHeight } from '../global/controls-height.js';
13
10
  import UserAgreement from './user-agreement.js';
14
11
  import { jsx, jsxs } from 'react/jsx-runtime';
15
- import '../storage/storage__local.js';
16
- import '../storage/storage__fallback.js';
17
- import 'core-js/modules/es.array.concat.js';
18
- import 'core-js/modules/es.array.index-of.js';
19
- import 'core-js/modules/es.reflect.delete-property.js';
20
- import 'deep-equal';
21
- import 'core-js/modules/es.array.filter.js';
22
- import 'core-js/modules/es.array.map.js';
23
12
  import '../global/get-uid.js';
24
- import 'core-js/modules/es.regexp.to-string.js';
25
13
  import '../alert/container.js';
26
14
  import 'react';
27
15
  import 'react-dom';
28
16
  import 'classnames';
29
- import 'prop-types';
30
17
  import '../global/data-tests.js';
31
18
  import 'core-js/modules/es.array.reduce.js';
32
- import 'core-js/modules/es.object.entries.js';
33
19
  import '../link/clickableLink.js';
34
20
  import '../_helpers/link.js';
35
- import 'core-js/modules/es.object.values.js';
36
21
  import '@jetbrains/icons/exception';
37
22
  import '@jetbrains/icons/checkmark';
38
23
  import '@jetbrains/icons/warning';
@@ -43,16 +28,9 @@ import '../icon/icon__constants.js';
43
28
  import '../_helpers/icon__svg.js';
44
29
  import 'core-js/modules/es.regexp.exec.js';
45
30
  import 'core-js/modules/es.string.replace.js';
46
- import 'core-js/modules/es.string.starts-with.js';
47
31
  import '../global/memoize.js';
48
- import 'core-js/modules/es.map.js';
49
- import 'core-js/modules/es.weak-map.js';
50
32
  import '../loader-inline/loader-inline.js';
51
33
  import '../global/dom.js';
52
- import 'core-js/modules/es.object.assign.js';
53
- import 'core-js/modules/es.set.js';
54
- import 'core-js/modules/es.string.split.js';
55
- import 'core-js/modules/web.dom-collections.for-each.js';
56
34
  import '../button/button.js';
57
35
  import '@jetbrains/icons/chevron-down';
58
36
  import '../_helpers/button__classes.js';
@@ -62,12 +40,6 @@ import '../popup/popup.js';
62
40
  import '../global/schedule-raf.js';
63
41
  import '../shortcuts/shortcuts.js';
64
42
  import '../shortcuts/core.js';
65
- import 'core-js/modules/es.array.find-index.js';
66
- import 'core-js/modules/es.array.includes.js';
67
- import 'core-js/modules/es.array.slice.js';
68
- import 'core-js/modules/es.array.splice.js';
69
- import 'core-js/modules/es.string.includes.js';
70
- import 'core-js/modules/es.string.match.js';
71
43
  import 'combokeys';
72
44
  import '../global/sniffer.js';
73
45
  import 'sniffr';
@@ -89,407 +61,290 @@ import '../panel/panel.js';
89
61
  import '../i18n/i18n-context.js';
90
62
  import '../i18n/i18n.js';
91
63
 
92
- var GUEST_SESSION_KEY = 'end-user-agreement-consent';
93
- var ONE_HOUR = 60 * 60 * 1000; // eslint-disable-line @typescript-eslint/no-magic-numbers
94
- var storageKey = 'userAgreementKey';
95
- var showMessage = 'userAgreementShow';
96
- var hideMessage = 'userAgreementHide';
97
- var DEFAULT_CONSENT = {
64
+ const GUEST_SESSION_KEY = 'end-user-agreement-consent';
65
+ const ONE_HOUR = 60 * 60 * 1000; // eslint-disable-line @typescript-eslint/no-magic-numbers
66
+ const storageKey = 'userAgreementKey';
67
+ const showMessage = 'userAgreementShow';
68
+ const hideMessage = 'userAgreementHide';
69
+ const DEFAULT_CONSENT = {
98
70
  accepted: false,
99
71
  majorVersion: 0,
100
72
  minorVersion: 0
101
73
  };
102
- var DEFAULT_AGREEMENT = {
74
+ const DEFAULT_AGREEMENT = {
103
75
  enabled: false,
104
76
  majorVersion: 0,
105
77
  minorVersion: 0,
106
78
  requiredForREST: false,
107
79
  content: ''
108
80
  };
109
- var UserAgreementService = /*#__PURE__*/_createClass(function UserAgreementService(config) {
110
- var _this = this;
111
- _classCallCheck(this, UserAgreementService);
112
- _defineProperty(this, "config", void 0);
113
- _defineProperty(this, "_dialogPromise", null);
114
- _defineProperty(this, "_alertPromise", null);
115
- _defineProperty(this, "tabId", Math.random());
116
- _defineProperty(this, "interval", ONE_HOUR);
117
- _defineProperty(this, "container", document.createElement('div'));
118
- _defineProperty(this, "reactRoot", createRoot(this.container));
119
- _defineProperty(this, "storage", new ActualStorage());
120
- _defineProperty(this, "checkingPromise", null);
121
- _defineProperty(this, "guest", false);
122
- _defineProperty(this, "userAgreement", DEFAULT_AGREEMENT);
123
- _defineProperty(this, "userConsent", DEFAULT_CONSENT);
124
- _defineProperty(this, "intervalId", void 0);
125
- _defineProperty(this, "startChecking", function () {
126
- _this.intervalId = window.setInterval(_this.checkConsentAndShowDialog, _this.interval);
127
- window.addEventListener('storage', _this.onStorageEvent);
128
- _this.checkConsentAndShowDialog();
129
- });
130
- _defineProperty(this, "stopChecking", function () {
131
- clearInterval(_this.intervalId);
132
- window.removeEventListener('storage', _this.onStorageEvent);
133
- _this.hideDialog();
134
- });
135
- _defineProperty(this, "onStorageEvent", function (event) {
136
- if (event.key === storageKey && event.newValue != null) {
137
- var _JSON$parse = JSON.parse(event.newValue),
138
- tabId = _JSON$parse.tabId,
139
- command = _JSON$parse.command;
140
- if (tabId !== _this.tabId) {
141
- if (command === showMessage) {
142
- _this.checkConsentAndShowDialog(true);
143
- } else if (command === hideMessage) {
144
- _this.hideDialogAndAlert(true);
81
+ class UserAgreementService {
82
+ constructor(config) {
83
+ var _this = this;
84
+ _defineProperty(this, "config", void 0);
85
+ _defineProperty(this, "_dialogPromise", null);
86
+ _defineProperty(this, "_alertPromise", null);
87
+ _defineProperty(this, "tabId", Math.random());
88
+ _defineProperty(this, "interval", ONE_HOUR);
89
+ _defineProperty(this, "container", document.createElement('div'));
90
+ _defineProperty(this, "reactRoot", createRoot(this.container));
91
+ _defineProperty(this, "storage", new LocalStorage());
92
+ _defineProperty(this, "checkingPromise", null);
93
+ _defineProperty(this, "guest", false);
94
+ _defineProperty(this, "userAgreement", DEFAULT_AGREEMENT);
95
+ _defineProperty(this, "userConsent", DEFAULT_CONSENT);
96
+ _defineProperty(this, "intervalId", void 0);
97
+ _defineProperty(this, "startChecking", () => {
98
+ this.intervalId = window.setInterval(this.checkConsentAndShowDialog, this.interval);
99
+ window.addEventListener('storage', this.onStorageEvent);
100
+ this.checkConsentAndShowDialog();
101
+ });
102
+ _defineProperty(this, "stopChecking", () => {
103
+ clearInterval(this.intervalId);
104
+ window.removeEventListener('storage', this.onStorageEvent);
105
+ this.hideDialog();
106
+ });
107
+ _defineProperty(this, "onStorageEvent", event => {
108
+ if (event.key === storageKey && event.newValue != null) {
109
+ const {
110
+ tabId,
111
+ command
112
+ } = JSON.parse(event.newValue);
113
+ if (tabId !== this.tabId) {
114
+ if (command === showMessage) {
115
+ this.checkConsentAndShowDialog(true);
116
+ } else if (command === hideMessage) {
117
+ this.hideDialogAndAlert(true);
118
+ }
145
119
  }
146
120
  }
147
- }
148
- });
149
- _defineProperty(this, "_notifyAboutShowing", function () {
150
- localStorage.setItem(storageKey, JSON.stringify({
151
- command: showMessage,
152
- tabId: _this.tabId
153
- }));
154
- });
155
- _defineProperty(this, "_notifyAboutHiding", function () {
156
- localStorage.setItem(storageKey, JSON.stringify({
157
- command: hideMessage,
158
- tabId: _this.tabId
159
- }));
160
- });
161
- _defineProperty(this, "getUserAgreement", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
162
- return _regeneratorRuntime().wrap(function _callee$(_context) {
163
- while (1) switch (_context.prev = _context.next) {
164
- case 0:
165
- _context.next = 2;
166
- return _this.config.getUserAgreement();
167
- case 2:
168
- _context.t0 = _context.sent;
169
- if (_context.t0) {
170
- _context.next = 5;
171
- break;
172
- }
173
- _context.t0 = DEFAULT_AGREEMENT;
174
- case 5:
175
- _this.userAgreement = _context.t0;
176
- return _context.abrupt("return", _this.userAgreement);
177
- case 7:
178
- case "end":
179
- return _context.stop();
121
+ });
122
+ _defineProperty(this, "_notifyAboutShowing", () => {
123
+ localStorage.setItem(storageKey, JSON.stringify({
124
+ command: showMessage,
125
+ tabId: this.tabId
126
+ }));
127
+ });
128
+ _defineProperty(this, "_notifyAboutHiding", () => {
129
+ localStorage.setItem(storageKey, JSON.stringify({
130
+ command: hideMessage,
131
+ tabId: this.tabId
132
+ }));
133
+ });
134
+ _defineProperty(this, "getUserAgreement", async () => {
135
+ this.userAgreement = (await this.config.getUserAgreement()) || DEFAULT_AGREEMENT;
136
+ return this.userAgreement;
137
+ });
138
+ _defineProperty(this, "getUserConsent", async () => {
139
+ const {
140
+ guest,
141
+ endUserAgreementConsent
142
+ } = await this.config.getUserConsent();
143
+ this.guest = guest;
144
+ if (guest) {
145
+ this.userConsent = (await this.storage.get(GUEST_SESSION_KEY)) || this.userConsent;
146
+ } else {
147
+ this.userConsent = endUserAgreementConsent || this.userConsent;
180
148
  }
181
- }, _callee);
182
- })));
183
- _defineProperty(this, "getUserConsent", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
184
- var _yield$_this$config$g, guest, endUserAgreementConsent;
185
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
186
- while (1) switch (_context2.prev = _context2.next) {
187
- case 0:
188
- _context2.next = 2;
189
- return _this.config.getUserConsent();
190
- case 2:
191
- _yield$_this$config$g = _context2.sent;
192
- guest = _yield$_this$config$g.guest;
193
- endUserAgreementConsent = _yield$_this$config$g.endUserAgreementConsent;
194
- _this.guest = guest;
195
- if (!guest) {
196
- _context2.next = 15;
197
- break;
198
- }
199
- _context2.next = 9;
200
- return _this.storage.get(GUEST_SESSION_KEY);
201
- case 9:
202
- _context2.t0 = _context2.sent;
203
- if (_context2.t0) {
204
- _context2.next = 12;
205
- break;
206
- }
207
- _context2.t0 = _this.userConsent;
208
- case 12:
209
- _this.userConsent = _context2.t0;
210
- _context2.next = 16;
211
- break;
212
- case 15:
213
- _this.userConsent = endUserAgreementConsent || _this.userConsent;
214
- case 16:
215
- return _context2.abrupt("return", _this.userConsent);
216
- case 17:
217
- case "end":
218
- return _context2.stop();
149
+ return this.userConsent;
150
+ });
151
+ _defineProperty(this, "checkConsentAndShowDialog", async withoutNotifications => {
152
+ if (await this.checkConsent()) {
153
+ return this.hideDialogAndAlert(withoutNotifications);
154
+ } else {
155
+ return this.showDialogOrAlert(withoutNotifications);
219
156
  }
220
- }, _callee2);
221
- })));
222
- _defineProperty(this, "checkConsentAndShowDialog", /*#__PURE__*/function () {
223
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(withoutNotifications) {
224
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
225
- while (1) switch (_context3.prev = _context3.next) {
226
- case 0:
227
- _context3.next = 2;
228
- return _this.checkConsent();
229
- case 2:
230
- if (!_context3.sent) {
231
- _context3.next = 6;
232
- break;
233
- }
234
- return _context3.abrupt("return", _this.hideDialogAndAlert(withoutNotifications));
235
- case 6:
236
- return _context3.abrupt("return", _this.showDialogOrAlert(withoutNotifications));
237
- case 7:
238
- case "end":
239
- return _context3.stop();
240
- }
241
- }, _callee3);
242
- }));
243
- return function (_x) {
244
- return _ref3.apply(this, arguments);
245
- };
246
- }());
247
- _defineProperty(this, "checkConsent", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
248
- var _yield$_this$checking, _yield$_this$checking2, userAgreement, userConsent, enabled, actualVersion, accepted, acceptedVersion;
249
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
250
- while (1) switch (_context4.prev = _context4.next) {
251
- case 0:
252
- if (!_this.checkingPromise) {
253
- _this.checkingPromise = Promise.all([_this.getUserAgreement(), _this.getUserConsent()]);
254
- }
255
- _context4.next = 3;
256
- return _this.checkingPromise;
257
- case 3:
258
- _yield$_this$checking = _context4.sent;
259
- _yield$_this$checking2 = _slicedToArray(_yield$_this$checking, 2);
260
- userAgreement = _yield$_this$checking2[0];
261
- userConsent = _yield$_this$checking2[1];
262
- _this.checkingPromise = null;
263
- enabled = userAgreement.enabled, actualVersion = userAgreement.majorVersion;
264
- accepted = userConsent.accepted, acceptedVersion = userConsent.majorVersion;
265
- return _context4.abrupt("return", !enabled || accepted && actualVersion === acceptedVersion);
266
- case 11:
267
- case "end":
268
- return _context4.stop();
157
+ });
158
+ _defineProperty(this, "checkConsent", async () => {
159
+ if (!this.checkingPromise) {
160
+ this.checkingPromise = Promise.all([this.getUserAgreement(), this.getUserConsent()]);
269
161
  }
270
- }, _callee4);
271
- })));
272
- _defineProperty(this, "alertKey", void 0);
273
- _defineProperty(this, "showAlert", function (withoutNotifications) {
274
- if (_this._alertPromise) {
275
- return _this._alertPromise;
276
- }
277
- _this._alertPromise = new Promise(function (resolve, reject) {
278
- var _ref5 = _this.config.translations || {},
279
- userAgreement = _ref5.userAgreement,
280
- reviewNow = _ref5.reviewNow,
281
- remindLater = _ref5.remindLater;
282
- var onRemind = function onRemind() {
283
- _this.hideDialogAndAlert(withoutNotifications);
284
- reject('Postponed');
285
- };
286
- var onReview = /*#__PURE__*/function () {
287
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
288
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
289
- while (1) switch (_context5.prev = _context5.next) {
290
- case 0:
291
- _context5.next = 2;
292
- return _this.showDialog(true, false, {
293
- onRemindLater: onRemind
294
- });
295
- case 2:
296
- _this.hideAlert(withoutNotifications);
297
- resolve();
298
- case 4:
299
- case "end":
300
- return _context5.stop();
301
- }
302
- }, _callee5);
303
- }));
304
- return function onReview() {
305
- return _ref6.apply(this, arguments);
162
+ const [userAgreement, userConsent] = await this.checkingPromise;
163
+ this.checkingPromise = null;
164
+ const {
165
+ enabled,
166
+ majorVersion: actualVersion
167
+ } = userAgreement;
168
+ const {
169
+ accepted,
170
+ majorVersion: acceptedVersion
171
+ } = userConsent;
172
+ return !enabled || accepted && actualVersion === acceptedVersion;
173
+ });
174
+ _defineProperty(this, "alertKey", void 0);
175
+ _defineProperty(this, "showAlert", withoutNotifications => {
176
+ if (this._alertPromise) {
177
+ return this._alertPromise;
178
+ }
179
+ this._alertPromise = new Promise((resolve, reject) => {
180
+ const {
181
+ userAgreement,
182
+ reviewNow,
183
+ remindLater
184
+ } = this.config.translations || {};
185
+ const onRemind = () => {
186
+ this.hideDialogAndAlert(withoutNotifications);
187
+ reject('Postponed');
306
188
  };
307
- }();
308
- var message = /*#__PURE__*/jsxs(Group, {
309
- children: [/*#__PURE__*/jsx("span", {
310
- children: userAgreement || 'User Agreement'
311
- }), /*#__PURE__*/jsx(Link, {
312
- onClick: onReview,
313
- "data-test": "review",
314
- children: reviewNow || 'Review now'
315
- }), /*#__PURE__*/jsx(Link, {
316
- onClick: onRemind,
317
- "data-test": "later",
318
- children: remindLater || 'Remind me later'
319
- })]
320
- });
321
- _this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
322
- closeable: false
189
+ const onReview = async () => {
190
+ await this.showDialog(true, false, {
191
+ onRemindLater: onRemind
192
+ });
193
+ this.hideAlert(withoutNotifications);
194
+ resolve();
195
+ };
196
+ const message = /*#__PURE__*/jsxs(Group, {
197
+ children: [/*#__PURE__*/jsx("span", {
198
+ children: userAgreement || 'User Agreement'
199
+ }), /*#__PURE__*/jsx(Link, {
200
+ onClick: onReview,
201
+ "data-test": "review",
202
+ children: reviewNow || 'Review now'
203
+ }), /*#__PURE__*/jsx(Link, {
204
+ onClick: onRemind,
205
+ "data-test": "later",
206
+ children: remindLater || 'Remind me later'
207
+ })]
208
+ });
209
+ this.alertKey = alertService.addAlert(message, Alert.Type.WARNING, 0, {
210
+ closeable: false
211
+ });
323
212
  });
213
+ if (!withoutNotifications) {
214
+ this._notifyAboutShowing();
215
+ }
216
+ return this._alertPromise;
324
217
  });
325
- if (!withoutNotifications) {
326
- _this._notifyAboutShowing();
327
- }
328
- return _this._alertPromise;
329
- });
330
- _defineProperty(this, "hideAlert", function (withoutNotifications) {
331
- var onRemindLater = _this.config.onRemindLater;
332
- alertService.remove(_this.alertKey);
333
- _this.alertKey = null;
334
- _this._alertPromise = null;
335
- if (onRemindLater) {
336
- onRemindLater();
337
- }
338
- if (!withoutNotifications) {
339
- _this._notifyAboutHiding();
340
- }
341
- });
342
- _defineProperty(this, "showDialog", function (withoutNotifications) {
343
- var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
344
- var restOptions = arguments.length > 2 ? arguments[2] : undefined;
345
- var _this$config = _this.config,
346
- translations = _this$config.translations,
347
- onDialogShow = _this$config.onDialogShow;
348
- var content = _this.userAgreement.content;
349
- var show = true;
350
- if (!_this._dialogPromise) {
351
- _this._dialogPromise = new Promise(function (resolve, reject) {
352
- var onAccept = /*#__PURE__*/function () {
353
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
354
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
355
- while (1) switch (_context6.prev = _context6.next) {
356
- case 0:
357
- _context6.next = 2;
358
- return _this.onAccept();
359
- case 2:
360
- resolve();
361
- case 3:
362
- case "end":
363
- return _context6.stop();
364
- }
365
- }, _callee6);
366
- }));
367
- return function onAccept() {
368
- return _ref7.apply(this, arguments);
218
+ _defineProperty(this, "hideAlert", withoutNotifications => {
219
+ const {
220
+ onRemindLater
221
+ } = this.config;
222
+ alertService.remove(this.alertKey);
223
+ this.alertKey = null;
224
+ this._alertPromise = null;
225
+ if (onRemindLater) {
226
+ onRemindLater();
227
+ }
228
+ if (!withoutNotifications) {
229
+ this._notifyAboutHiding();
230
+ }
231
+ });
232
+ _defineProperty(this, "showDialog", function (withoutNotifications) {
233
+ let preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
234
+ let restOptions = arguments.length > 2 ? arguments[2] : undefined;
235
+ const {
236
+ translations,
237
+ onDialogShow
238
+ } = _this.config;
239
+ const {
240
+ content
241
+ } = _this.userAgreement;
242
+ const show = true;
243
+ if (!_this._dialogPromise) {
244
+ _this._dialogPromise = new Promise((resolve, reject) => {
245
+ const onAccept = async () => {
246
+ await _this.onAccept();
247
+ resolve();
369
248
  };
370
- }();
371
- var onDecline = /*#__PURE__*/function () {
372
- var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
373
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
374
- while (1) switch (_context7.prev = _context7.next) {
375
- case 0:
376
- _context7.next = 2;
377
- return _this.onDecline();
378
- case 2:
379
- reject();
380
- case 3:
381
- case "end":
382
- return _context7.stop();
383
- }
384
- }, _callee7);
385
- }));
386
- return function onDecline() {
387
- return _ref8.apply(this, arguments);
249
+ const onDecline = async () => {
250
+ await _this.onDecline();
251
+ reject();
388
252
  };
389
- }();
390
- var onClose = _this.hideDialogAndAlert;
391
- var props = _objectSpread2({
392
- children: content,
393
- show,
394
- onAccept,
395
- onDecline,
396
- onClose,
397
- translations,
398
- preview
399
- }, restOptions);
400
- _this.reactRoot.render( /*#__PURE__*/jsx(ControlsHeightContext.Provider, {
401
- value: getGlobalControlsHeight(),
402
- children: /*#__PURE__*/jsx(UserAgreement, _objectSpread2({}, props))
403
- }));
404
- if (onDialogShow) {
405
- onDialogShow();
253
+ const onClose = _this.hideDialogAndAlert;
254
+ const props = _objectSpread2({
255
+ children: content,
256
+ show,
257
+ onAccept,
258
+ onDecline,
259
+ onClose,
260
+ translations,
261
+ preview
262
+ }, restOptions);
263
+ _this.reactRoot.render(/*#__PURE__*/jsx(ControlsHeightContext.Provider, {
264
+ value: getGlobalControlsHeight(),
265
+ children: /*#__PURE__*/jsx(UserAgreement, _objectSpread2({}, props))
266
+ }));
267
+ if (onDialogShow) {
268
+ onDialogShow();
269
+ }
270
+ });
271
+ if (!withoutNotifications) {
272
+ _this._notifyAboutShowing();
406
273
  }
407
- });
408
- if (!withoutNotifications) {
409
- _this._notifyAboutShowing();
410
274
  }
411
- }
412
- return _this._dialogPromise;
413
- });
414
- _defineProperty(this, "hideDialog", function (withoutNotifications) {
415
- var onDialogHide = _this.config.onDialogHide;
416
- _this.reactRoot.render(null);
417
- if (onDialogHide) {
418
- onDialogHide();
419
- _this._dialogPromise = null;
420
- if (!withoutNotifications) {
421
- _this._notifyAboutHiding();
275
+ return _this._dialogPromise;
276
+ });
277
+ _defineProperty(this, "hideDialog", withoutNotifications => {
278
+ const {
279
+ onDialogHide
280
+ } = this.config;
281
+ this.reactRoot.render(null);
282
+ if (onDialogHide) {
283
+ onDialogHide();
284
+ this._dialogPromise = null;
285
+ if (!withoutNotifications) {
286
+ this._notifyAboutHiding();
287
+ }
288
+ }
289
+ });
290
+ _defineProperty(this, "showDialogOrAlert", (withoutNotifications, preview, restOptions) => {
291
+ if (this.guest && !this.userAgreement.requiredForREST) {
292
+ return this.showAlert(withoutNotifications);
293
+ }
294
+ return this.showDialog(withoutNotifications, preview, restOptions);
295
+ });
296
+ _defineProperty(this, "hideDialogAndAlert", withoutNotifications => {
297
+ this.hideAlert(withoutNotifications);
298
+ this.hideDialog(withoutNotifications);
299
+ });
300
+ _defineProperty(this, "onAccept", async () => {
301
+ const {
302
+ setUserConsent,
303
+ onAccept
304
+ } = this.config;
305
+ if (this.guest) {
306
+ const {
307
+ majorVersion,
308
+ minorVersion
309
+ } = this.userAgreement;
310
+ this.userConsent = {
311
+ majorVersion,
312
+ minorVersion,
313
+ accepted: true
314
+ };
315
+ await this.storage.set(GUEST_SESSION_KEY, this.userConsent);
316
+ } else {
317
+ this.userConsent = await setUserConsent();
422
318
  }
319
+ this.hideDialog();
320
+ if (onAccept) {
321
+ onAccept();
322
+ }
323
+ });
324
+ _defineProperty(this, "onDecline", () => {
325
+ const {
326
+ onDecline
327
+ } = this.config;
328
+ this.hideDialog();
329
+ if (onDecline) {
330
+ onDecline();
331
+ }
332
+ });
333
+ if (!config) {
334
+ throw new Error('Please pass a config to UserAgreementService');
423
335
  }
424
- });
425
- _defineProperty(this, "showDialogOrAlert", function (withoutNotifications, preview, restOptions) {
426
- if (_this.guest && !_this.userAgreement.requiredForREST) {
427
- return _this.showAlert(withoutNotifications);
336
+ if (!config.getUserAgreement) {
337
+ throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
428
338
  }
429
- return _this.showDialog(withoutNotifications, preview, restOptions);
430
- });
431
- _defineProperty(this, "hideDialogAndAlert", function (withoutNotifications) {
432
- _this.hideAlert(withoutNotifications);
433
- _this.hideDialog(withoutNotifications);
434
- });
435
- _defineProperty(this, "onAccept", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
436
- var _this$config2, setUserConsent, onAccept, _this$userAgreement, majorVersion, minorVersion;
437
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
438
- while (1) switch (_context8.prev = _context8.next) {
439
- case 0:
440
- _this$config2 = _this.config, setUserConsent = _this$config2.setUserConsent, onAccept = _this$config2.onAccept;
441
- if (!_this.guest) {
442
- _context8.next = 8;
443
- break;
444
- }
445
- _this$userAgreement = _this.userAgreement, majorVersion = _this$userAgreement.majorVersion, minorVersion = _this$userAgreement.minorVersion;
446
- _this.userConsent = {
447
- majorVersion,
448
- minorVersion,
449
- accepted: true
450
- };
451
- _context8.next = 6;
452
- return _this.storage.set(GUEST_SESSION_KEY, _this.userConsent);
453
- case 6:
454
- _context8.next = 11;
455
- break;
456
- case 8:
457
- _context8.next = 10;
458
- return setUserConsent();
459
- case 10:
460
- _this.userConsent = _context8.sent;
461
- case 11:
462
- _this.hideDialog();
463
- if (onAccept) {
464
- onAccept();
465
- }
466
- case 13:
467
- case "end":
468
- return _context8.stop();
469
- }
470
- }, _callee8);
471
- })));
472
- _defineProperty(this, "onDecline", function () {
473
- var onDecline = _this.config.onDecline;
474
- _this.hideDialog();
475
- if (onDecline) {
476
- onDecline();
339
+ if (!config.getUserConsent) {
340
+ throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
477
341
  }
478
- });
479
- if (!config) {
480
- throw new Error('Please pass a config to UserAgreementService');
481
- }
482
- if (!config.getUserAgreement) {
483
- throw new Error('Please pass a "getUserAgreement" option to UserAgreementService');
484
- }
485
- if (!config.getUserConsent) {
486
- throw new Error('Please pass a "getUserConsent" option to UserAgreementService');
487
- }
488
- if (!config.setUserConsent) {
489
- throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
342
+ if (!config.setUserConsent) {
343
+ throw new Error('Please pass a "setUserConsent" option to UserAgreementService');
344
+ }
345
+ this.config = config;
346
+ this.interval = config.interval || this.interval;
490
347
  }
491
- this.config = config;
492
- this.interval = config.interval || this.interval;
493
- });
348
+ }
494
349
 
495
350
  export { UserAgreementService as default, hideMessage, showMessage };