@licklist/design 0.78.7 → 0.78.8

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 (153) hide show
  1. package/dist/affiliate/form/AffiliateForm.d.ts.map +1 -1
  2. package/dist/affiliate/form/AffiliateForm.js +6 -2
  3. package/dist/auth/AccessDenied/AccessDenied.d.ts.map +1 -1
  4. package/dist/auth/AccessDenied/AccessDenied.js +4 -3
  5. package/dist/auth/Authorizer.d.ts.map +1 -1
  6. package/dist/auth/Authorizer.js +10 -6
  7. package/dist/auth/ChangePassword/ChangePasswordComponent.d.ts.map +1 -1
  8. package/dist/auth/ChangePassword/ChangePasswordComponent.js +36 -41
  9. package/dist/auth/Layout/AuthNavComponent.d.ts.map +1 -1
  10. package/dist/auth/Layout/AuthNavComponent.js +2 -3
  11. package/dist/auth/Layout/UserNavDropDown.d.ts.map +1 -1
  12. package/dist/auth/Layout/UserNavDropDown.js +8 -9
  13. package/dist/auth/Login/LoginComponent.d.ts.map +1 -1
  14. package/dist/auth/Login/LoginComponent.js +57 -60
  15. package/dist/auth/Logout/Logout.d.ts.map +1 -1
  16. package/dist/auth/Logout/Logout.js +4 -2
  17. package/dist/auth/Register/RegisterComponent.d.ts.map +1 -1
  18. package/dist/auth/Register/RegisterComponent.js +53 -58
  19. package/dist/auth/ResetPassword/ResetPasswordComponent.d.ts.map +1 -1
  20. package/dist/auth/ResetPassword/ResetPasswordComponent.js +26 -30
  21. package/dist/auth/Social/SocialCallbackComponent.d.ts.map +1 -1
  22. package/dist/auth/Social/SocialCallbackComponent.js +3 -3
  23. package/dist/custom-fields/field-set/providers/CustomFieldSetsProvider.d.ts +2 -2
  24. package/dist/custom-fields/field-set/providers/CustomFieldSetsProvider.d.ts.map +1 -1
  25. package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +0 -1
  26. package/dist/events/edit-recurrent-event-modal/EditRecurrentEventModal.d.ts.map +1 -1
  27. package/dist/events/event-card/EventCard.d.ts +1 -1
  28. package/dist/events/event-card/EventCard.d.ts.map +1 -1
  29. package/dist/events/event-card/EventCard.js +1 -1
  30. package/dist/events/event-statistic-modal/EventStatisticModal.d.ts.map +1 -1
  31. package/dist/events/event-statistic-modal/EventStatisticModal.js +0 -1
  32. package/dist/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.d.ts +2 -2
  33. package/dist/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.d.ts.map +1 -1
  34. package/dist/file-upload/FileUpload.d.ts +1 -1
  35. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts +1 -2
  36. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.d.ts.map +1 -1
  37. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.js +3 -4
  38. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.d.ts.map +1 -1
  39. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.js +5 -6
  40. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.js +1 -2
  41. package/dist/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.d.ts.map +1 -1
  42. package/dist/iframe/event/event-navigation-footer/EventNavigationFooter.d.ts.map +1 -1
  43. package/dist/iframe/event/event-navigation-footer/EventNavigationFooter.js +3 -2
  44. package/dist/iframe/order-process/components/CategoryProduct/CategoryProduct.d.ts.map +1 -1
  45. package/dist/iframe/order-process/components/NavigationSteps/NavigationSteps.js +3 -3
  46. package/dist/iframe/order-process/components/PaymentCard/PaymentCard.d.ts +2 -2
  47. package/dist/iframe/order-process/components/PaymentCard/PaymentCard.d.ts.map +1 -1
  48. package/dist/iframe/payment/order-items-table/OrderItemsTable.js +0 -1
  49. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts +0 -5
  50. package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
  51. package/dist/iframe/payment/payment-form/PaymentForm.js +0 -1
  52. package/dist/iframe/payment/payment-page/PaymentPage.d.ts +1 -1
  53. package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
  54. package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
  55. package/dist/iframe/ryft/RyftPaymentForm.js +1 -3
  56. package/dist/iframe/ryft/utils/ryft-form.d.ts +1 -1
  57. package/dist/iframe/ryft/utils/ryft-form.d.ts.map +1 -1
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +3 -1
  61. package/dist/modals/dialog/Dialog.d.ts.map +1 -1
  62. package/dist/modals/dialog/Dialog.js +39 -41
  63. package/dist/modals/dialog/DialogContext.d.ts +2 -2
  64. package/dist/modals/dialog/DialogContext.d.ts.map +1 -1
  65. package/dist/notification/email-template/card/EmailTemplateCard.d.ts.map +1 -1
  66. package/dist/pages/PrivacyComponent.d.ts +3 -0
  67. package/dist/pages/PrivacyComponent.d.ts.map +1 -0
  68. package/dist/pages/PrivacyComponent.js +536 -0
  69. package/dist/pages/TermsComponent.d.ts +3 -0
  70. package/dist/pages/TermsComponent.d.ts.map +1 -0
  71. package/dist/pages/TermsComponent.js +682 -0
  72. package/dist/pages/index.d.ts +3 -0
  73. package/dist/pages/index.d.ts.map +1 -0
  74. package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
  75. package/dist/product-set/card/ProductSetCard.js +3 -2
  76. package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
  77. package/dist/product-set/form/ProductsControl.js +1 -1
  78. package/dist/product-set/product/advanced-options/AdvancedOptions.js +1 -2
  79. package/dist/product-set/utils/index.d.ts +1 -1
  80. package/dist/product-set/utils/index.d.ts.map +1 -1
  81. package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
  82. package/dist/recurrence-input/RecurrenceInput.js +1 -1
  83. package/dist/sales/notes/NotesTableRow.js +0 -1
  84. package/dist/sales/payment-form/components/RyftPayment/RyftPayment.d.ts.map +1 -1
  85. package/dist/sales/payment-form/components/RyftPayment/RyftPayment.js +1 -3
  86. package/dist/setting/dashboard/payments/payments-modal/PaymentsModal.d.ts.map +1 -1
  87. package/dist/setting/dashboard/snippets/card/SnippetCard.d.ts.map +1 -1
  88. package/dist/setting/dashboard/snippets/card/SnippetCard.js +4 -4
  89. package/dist/snippet/snippet-template/preview/Preview.d.ts.map +1 -1
  90. package/dist/snippet/snippet-template/preview/Preview.js +14 -21
  91. package/dist/static/RestrictedAccess.d.ts.map +1 -1
  92. package/dist/static/RestrictedAccess.js +3 -2
  93. package/dist/static/index.js +1 -1
  94. package/dist/striped-static-table/StripedStaticTable.js +0 -1
  95. package/dist/table/ReactTableHelperComponent.d.ts.map +1 -1
  96. package/dist/table/ReactTableHelperComponent.js +3 -3
  97. package/dist/table/TableHelperComponent.d.ts.map +1 -1
  98. package/dist/table/TableHelperComponent.js +3 -3
  99. package/dist/venue-map-sets/card/VenueMapSetCard.d.ts.map +1 -1
  100. package/dist/venue-map-sets/card/VenueMapSetCard.js +4 -3
  101. package/dist/zone/card/ZoneCard.d.ts.map +1 -1
  102. package/dist/zone/card/ZoneCard.js +4 -3
  103. package/package.json +23 -20
  104. package/src/affiliate/form/AffiliateForm.tsx +4 -2
  105. package/src/auth/AccessDenied/AccessDenied.tsx +4 -3
  106. package/src/auth/Authorizer.tsx +11 -6
  107. package/src/auth/ChangePassword/ChangePasswordComponent.tsx +21 -26
  108. package/src/auth/Layout/AuthNavComponent.tsx +2 -3
  109. package/src/auth/Layout/UserNavDropDown.tsx +6 -7
  110. package/src/auth/Login/LoginComponent.tsx +42 -46
  111. package/src/auth/Logout/Logout.stories.tsx +12 -14
  112. package/src/auth/Logout/Logout.tsx +4 -3
  113. package/src/auth/Register/RegisterComponent.tsx +35 -41
  114. package/src/auth/ResetPassword/ResetPasswordComponent.tsx +16 -20
  115. package/src/auth/Social/SocialCallbackComponent.tsx +4 -4
  116. package/src/custom-fields/field-set/providers/CustomFieldSetsProvider.tsx +2 -2
  117. package/src/events/edit-recurrent-event-modal/EditRecurrentEventModal.tsx +1 -0
  118. package/src/events/event-card/EventCard.tsx +10 -8
  119. package/src/events/event-statistic-modal/EventStatisticModal.tsx +1 -0
  120. package/src/events/event-venue-map/components/Dropdown/components/DropdownWrapper/DropdownWrapper.tsx +2 -2
  121. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetForm.tsx +13 -8
  122. package/src/iframe/ProductWithModifierModal/ModifierSetModal/ProductWithModifierSetModal.tsx +12 -4
  123. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ModifierSetControll.tsx +2 -2
  124. package/src/iframe/ProductWithModifierModal/ModifierSetModal/controll/ProductControll.tsx +18 -20
  125. package/src/iframe/event/event-navigation-footer/EventNavigationFooter.tsx +3 -2
  126. package/src/iframe/order-process/components/CategoryProduct/CategoryProduct.tsx +3 -5
  127. package/src/iframe/order-process/components/NavigationSteps/NavigationSteps.tsx +3 -3
  128. package/src/iframe/order-process/components/PaymentCard/PaymentCard.tsx +3 -3
  129. package/src/iframe/order-process/components/utils/useOnWindowUnmount.ts +1 -1
  130. package/src/iframe/payment/payment-page/PaymentPage.tsx +1 -1
  131. package/src/iframe/ryft/RyftPaymentForm.tsx +2 -5
  132. package/src/iframe/ryft/utils/ryft-form.ts +1 -1
  133. package/src/index.ts +1 -0
  134. package/src/modals/dialog/Dialog.tsx +35 -36
  135. package/src/modals/dialog/DialogContext.tsx +8 -2
  136. package/src/notification/email-template/card/EmailTemplateCard.tsx +0 -2
  137. package/src/pages/PrivacyComponent.tsx +318 -0
  138. package/src/pages/TermsComponent.tsx +306 -0
  139. package/src/pages/index.ts +2 -0
  140. package/src/product-set/card/ProductSetCard.tsx +3 -2
  141. package/src/product-set/form/ProductSetForm.tsx +2 -1
  142. package/src/product-set/utils/index.ts +15 -14
  143. package/src/recurrence-input/RecurrenceInput.tsx +4 -3
  144. package/src/sales/payment-form/components/RyftPayment/RyftPayment.tsx +1 -3
  145. package/src/setting/dashboard/payments/payments-modal/PaymentsModal.tsx +1 -0
  146. package/src/setting/dashboard/snippets/card/SnippetCard.tsx +4 -3
  147. package/src/snippet/snippet-template/preview/Preview.tsx +6 -9
  148. package/src/static/RestrictedAccess.tsx +3 -6
  149. package/src/table/ReactTableHelperComponent.tsx +3 -5
  150. package/src/table/TableHelperComponent.tsx +3 -3
  151. package/src/venue-map-sets/card/VenueMapSetCard.tsx +4 -3
  152. package/src/zone/card/ZoneCard.tsx +4 -3
  153. package/yarn.lock +474 -542
@@ -1,20 +1,21 @@
1
1
  import { Button } from 'react-bootstrap'
2
2
  import { useTranslation } from 'react-i18next'
3
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
4
3
  import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
5
4
  import { FaLock } from 'react-icons/fa'
5
+ import { useNavigate } from 'react-router-dom'
6
6
 
7
7
  export const AccessDenied = () => {
8
8
  const { t } = useTranslation('App')
9
9
  const user = useUser()
10
+ const navigate = useNavigate()
10
11
 
11
12
  const onGoToHomepage = () => {
12
- RouteService.redirectTo('/')
13
+ navigate('/')
13
14
  }
14
15
 
15
16
  const logOutHandler = () => {
16
17
  user.logout()
17
- RouteService.redirectTo('/')
18
+ navigate('/')
18
19
  }
19
20
 
20
21
  return (
@@ -1,10 +1,10 @@
1
1
  import { ReactNode, useEffect, useState, useCallback } from 'react'
2
- import { matchPath } from 'react-router-dom'
2
+ import { matchPath, useLocation } from 'react-router-dom'
3
3
  import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
4
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
5
4
  import { ROUTES, MATCH_ROUTE_PATTERNS } from '@licklist/core/dist/Config'
6
5
  import useAuthApi from '@licklist/plugins/dist/hooks/Api/useAuthApi'
7
6
  import useAuth from '@licklist/plugins/dist/context/user/hooks/useAuth'
7
+ import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
8
8
  import { BlockLoader } from '../static/loader/BlockLoader'
9
9
 
10
10
  export interface AuthorizerProps {
@@ -17,6 +17,8 @@ function Authorizer(props: AuthorizerProps) {
17
17
  const user = useUser()
18
18
  const { useProfile } = useAuthApi()
19
19
 
20
+ const { pathname } = useLocation()
21
+
20
22
  // This will re-fetch user's profile
21
23
  const profile = useProfile()
22
24
 
@@ -26,13 +28,15 @@ function Authorizer(props: AuthorizerProps) {
26
28
  () =>
27
29
  Object.values(MATCH_ROUTE_PATTERNS)
28
30
  .map((pathUrlPattern) =>
29
- matchPath<{ url: string }>(
31
+ matchPath(
32
+ {
33
+ path: pathUrlPattern,
34
+ },
30
35
  RouteService.getCurrentPage(),
31
- pathUrlPattern,
32
36
  ),
33
37
  )
34
38
  .filter(Boolean)
35
- .map((matched) => matched.url),
39
+ .map((matched) => matched.pathname),
36
40
  [],
37
41
  )
38
42
 
@@ -61,7 +65,7 @@ function Authorizer(props: AuthorizerProps) {
61
65
  ROUTES.FORGOT_PASSWORD,
62
66
  ROUTES.SSO_LOGIN,
63
67
  ...matchedPathPatternUrls(),
64
- ].includes(RouteService.getCurrentPage())
68
+ ].includes(pathname)
65
69
  ) {
66
70
  setIsValidated(() => true)
67
71
  return
@@ -80,6 +84,7 @@ function Authorizer(props: AuthorizerProps) {
80
84
  profile.isError,
81
85
  profile.isLoading,
82
86
  profile.isFetching,
87
+ pathname,
83
88
  ])
84
89
 
85
90
  if (profile.isFetching || profile.isLoading || !isValidated)
@@ -2,16 +2,14 @@ import { useContext, useEffect, useState } from 'react'
2
2
  import Row from 'react-bootstrap/Row'
3
3
  import Col from 'react-bootstrap/Col'
4
4
  import { useTranslation } from 'react-i18next'
5
- import { useLocation } from 'react-router-dom'
5
+ import { useLocation, useNavigate } from 'react-router-dom'
6
6
  import { ApiServiceError } from '@licklist/core/dist/Api/ApiService'
7
7
  import RequestContext from '@licklist/plugins/dist/context/app/RequestContext'
8
8
  import useUserApi from '@licklist/plugins/dist/hooks/Api/useUserApi'
9
9
  import useNotification from '@licklist/plugins/dist/context/app/hooks/useNotification'
10
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
11
10
  import { UserChangePasswordRequest } from '@licklist/plugins/dist/types/Request/UserChangePasswordRequest'
12
11
  import { ROUTES } from '@licklist/core/dist/Config'
13
12
  import { ChangePasswordFormComponent } from './ChangePasswordFormComponent'
14
- import { Router } from '../Router'
15
13
  import FormCard from '../../static/FormCard'
16
14
  import { LoaderIndicator } from '../../static/loader/LoaderIndicator'
17
15
 
@@ -22,6 +20,7 @@ function ChangePasswordComponent() {
22
20
  const { search } = useLocation()
23
21
  const email = new URLSearchParams(search).get('email')
24
22
  const token = new URLSearchParams(search).get('token')
23
+ const navigate = useNavigate()
25
24
 
26
25
  const [isLoading, setIsLoading] = useState<boolean>(false)
27
26
 
@@ -33,7 +32,7 @@ function ChangePasswordComponent() {
33
32
  message: error.response?.data?.message,
34
33
  })
35
34
 
36
- RouteService.redirectTo(ROUTES.FORGOT_PASSWORD)
35
+ navigate(ROUTES.FORGOT_PASSWORD)
37
36
  }
38
37
 
39
38
  const changePassword = async (resetRequest: UserChangePasswordRequest) =>
@@ -51,39 +50,35 @@ function ChangePasswordComponent() {
51
50
  message: t('Notification:passwordChangedSuccessfully'),
52
51
  })
53
52
 
54
- RouteService.redirectTo(ROUTES.LOGIN_PAGE)
53
+ navigate(ROUTES.LOGIN_PAGE)
55
54
  }
56
55
 
57
56
  useEffect(() => {
58
57
  if (!email && !token) {
59
- RouteService.redirectTo(ROUTES.LOGIN_PAGE)
58
+ navigate(ROUTES.LOGIN_PAGE)
60
59
  }
61
60
  // eslint-disable-next-line react-hooks/exhaustive-deps
62
61
  }, [])
63
62
 
64
63
  return (
65
- <Router>
66
- <Row className='justify-content-center'>
67
- <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
68
- <>
69
- <h1 className='text-center'>{t('User:resetPasswordTitle')}</h1>
70
- <h3 className='text-center'>{t('User:forEmail', { email })}</h3>
64
+ <Row className='justify-content-center'>
65
+ <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
66
+ <h1 className='text-center'>{t('User:resetPasswordTitle')}</h1>
67
+ <h3 className='text-center'>{t('User:forEmail', { email })}</h3>
71
68
 
72
- <FormCard>
73
- <ChangePasswordFormComponent
74
- isLoading={isLoading}
75
- setIsLoading={setIsLoading}
76
- onSubmit={handleOnSubmit}
77
- email={email}
78
- token={token}
79
- />
69
+ <FormCard>
70
+ <ChangePasswordFormComponent
71
+ isLoading={isLoading}
72
+ setIsLoading={setIsLoading}
73
+ onSubmit={handleOnSubmit}
74
+ email={email}
75
+ token={token}
76
+ />
80
77
 
81
- <LoaderIndicator isLoaded={!isLoading} />
82
- </FormCard>
83
- </>
84
- </Col>
85
- </Row>
86
- </Router>
78
+ <LoaderIndicator isLoaded={!isLoading} />
79
+ </FormCard>
80
+ </Col>
81
+ </Row>
87
82
  )
88
83
  }
89
84
 
@@ -1,13 +1,12 @@
1
1
  import { useTranslation } from 'react-i18next'
2
2
  import { Link } from 'react-router-dom'
3
3
  import StyledButton from '../../static/StyledButton'
4
- import { Router } from '../Router'
5
4
 
6
5
  function AuthNavComponent() {
7
6
  const { t } = useTranslation('User')
8
7
 
9
8
  return (
10
- <Router>
9
+ <>
11
10
  {/* TODO fix issue react router types
12
11
  @ts-expect-error */}
13
12
  <Link to='/login'>
@@ -26,7 +25,7 @@ function AuthNavComponent() {
26
25
  {t('register')}
27
26
  </StyledButton>
28
27
  </Link>
29
- </Router>
28
+ </>
30
29
  )
31
30
  }
32
31
 
@@ -1,24 +1,23 @@
1
1
  import Dropdown from 'react-bootstrap/Dropdown'
2
2
  import { useTranslation } from 'react-i18next'
3
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
4
3
  import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
4
+ import { useNavigate } from 'react-router-dom'
5
5
 
6
6
  function UserNavDropDown() {
7
7
  const { t } = useTranslation('App')
8
8
  const user = useUser()
9
+ const navigate = useNavigate()
9
10
 
10
11
  const onLogoutHandler = () => {
11
12
  user.logout()
12
13
 
13
- RouteService.redirectTo('/')
14
+ navigate('/')
14
15
  }
15
16
 
16
17
  return (
17
- <>
18
- <Dropdown.Item eventKey='1' onClick={onLogoutHandler}>
19
- {t('logout')}
20
- </Dropdown.Item>
21
- </>
18
+ <Dropdown.Item eventKey='1' onClick={onLogoutHandler}>
19
+ {t('logout')}
20
+ </Dropdown.Item>
22
21
  )
23
22
  }
24
23
 
@@ -2,20 +2,18 @@ import { useContext, useEffect, useState } from 'react'
2
2
  import Row from 'react-bootstrap/Row'
3
3
  import Col from 'react-bootstrap/Col'
4
4
  import { Trans, useTranslation } from 'react-i18next'
5
- import { Link } from 'react-router-dom'
5
+ import { Link, useNavigate } from 'react-router-dom'
6
6
  import RequestContext from '@licklist/plugins/dist/context/app/RequestContext'
7
7
  import useUserApi from '@licklist/plugins/dist/hooks/Api/useUserApi'
8
8
  import useNotification from '@licklist/plugins/dist/context/app/hooks/useNotification'
9
9
  import useAuth from '@licklist/plugins/dist/context/user/hooks/useAuth'
10
10
  import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
11
11
  import useInvite from '@licklist/plugins/dist/context/user/hooks/useInvite'
12
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
13
12
  import { IAuth } from '@licklist/plugins/dist/types/context/user/IAuth'
14
13
  import { UserLoginRequest } from '@licklist/plugins/dist/types/Request/UserLoginRequest'
15
14
  import { IUser } from '@licklist/plugins/dist/types/context/user/IUser'
16
15
  import { SocialFormComponent } from '../Social/SocialFormComponent'
17
16
  import { LoginFormComponent } from './LoginFormComponent'
18
- import { Router } from '../Router'
19
17
  import FormCard from '../../static/FormCard'
20
18
  import { LoaderIndicator } from '../../static/loader/LoaderIndicator'
21
19
  import Logo from '../../logo/Logo'
@@ -37,6 +35,8 @@ const LoginComponent = ({
37
35
  const user = useUser()
38
36
  const invite = useInvite()
39
37
 
38
+ const navigate = useNavigate()
39
+
40
40
  const [isLoading, setIsLoading] = useState<boolean>(false)
41
41
 
42
42
  const userApiService = useUserApi(request)
@@ -87,7 +87,7 @@ const LoginComponent = ({
87
87
  message: t('Notification:loggedSuccessfully'),
88
88
  })
89
89
 
90
- RouteService.redirectTo('/')
90
+ navigate('/', { replace: true })
91
91
  }
92
92
 
93
93
  useEffect(() => {
@@ -95,55 +95,51 @@ const LoginComponent = ({
95
95
  return
96
96
  }
97
97
 
98
- RouteService.redirectTo('/')
98
+ navigate('/')
99
99
  }, [user.profile, auth.secrets])
100
100
 
101
101
  return (
102
- <Router>
103
- <Row className='justify-content-center'>
104
- <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
105
- <>
106
- <h1 className='text-center'>{t('User:loginTitle')}</h1>
107
-
108
- <div className='login d-flex pb-4 justify-content-center'>
109
- <Logo logo={<BookeditLogoSvg />} />
110
- </div>
111
-
112
- {!hideSignUpLink && (
113
- <h6 className='text-center'>
114
- <Trans t={t} i18nKey='loginPromo'>
115
- {/* TODO fix issue react router types
116
- @ts-expect-error */}
117
- Don&apos;t have account? <Link to='/register'>Sign up</Link>.
118
- </Trans>
119
- </h6>
120
- )}
121
-
122
- <FormCard>
123
- {showSocialLinks && (
124
- <>
125
- <SocialFormComponent
126
- isLoading={isLoading}
127
- setIsLoading={setIsLoading}
128
- />
129
-
130
- <hr className='mb-2' />
131
- </>
132
- )}
133
-
134
- <LoginFormComponent
102
+ <Row className='justify-content-center'>
103
+ <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
104
+ <h1 className='text-center'>{t('User:loginTitle')}</h1>
105
+
106
+ <div className='login d-flex pb-4 justify-content-center'>
107
+ <Logo logo={<BookeditLogoSvg />} />
108
+ </div>
109
+
110
+ {!hideSignUpLink && (
111
+ <h6 className='text-center'>
112
+ <Trans t={t} i18nKey='loginPromo'>
113
+ {/* TODO fix issue react router types
114
+ @ts-expect-error */}
115
+ Don&apos;t have account? <Link to='/register'>Sign up</Link>.
116
+ </Trans>
117
+ </h6>
118
+ )}
119
+
120
+ <FormCard>
121
+ {showSocialLinks && (
122
+ <>
123
+ <SocialFormComponent
135
124
  isLoading={isLoading}
136
125
  setIsLoading={setIsLoading}
137
- onSubmit={handleOnSubmit}
138
- invitation={invite.invitation}
139
126
  />
140
127
 
141
- <LoaderIndicator isLoaded={!isLoading} />
142
- </FormCard>
143
- </>
144
- </Col>
145
- </Row>
146
- </Router>
128
+ <hr className='mb-2' />
129
+ </>
130
+ )}
131
+
132
+ <LoginFormComponent
133
+ isLoading={isLoading}
134
+ setIsLoading={setIsLoading}
135
+ onSubmit={handleOnSubmit}
136
+ invitation={invite.invitation}
137
+ />
138
+
139
+ <LoaderIndicator isLoaded={!isLoading} />
140
+ </FormCard>
141
+ </Col>
142
+ </Row>
147
143
  )
148
144
  }
149
145
 
@@ -1,31 +1,29 @@
1
1
  import { useEffect } from 'react'
2
- import { Route, Switch, MemoryRouter } from 'react-router-dom'
2
+ import { Route, MemoryRouter, useNavigate, Routes } from 'react-router-dom'
3
3
  import { Meta, Story } from '@storybook/react'
4
4
  import UserProvider from '@licklist/plugins/dist/context/user/providers/UserProvider'
5
5
  import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
6
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
7
- import { Logout } from './Logout'
8
6
  import { Button } from 'react-bootstrap'
7
+ import { Logout } from './Logout'
9
8
 
10
9
  export default {
11
10
  title: 'Auth/Logout',
12
11
  } as Meta
13
12
 
14
13
  export const LogoutComponent: Story = () => (
15
- <>
16
- <UserProvider>
17
- <MemoryRouter initialIndex={0} initialEntries={['/', '/logout']}>
18
- <Switch>
19
- <Route path='/' exact component={LoggedPage} />
20
- <Route path='/logout' component={LogoutWrapper} />
21
- </Switch>
22
- </MemoryRouter>
23
- </UserProvider>
24
- </>
14
+ <UserProvider>
15
+ <MemoryRouter initialIndex={0} initialEntries={['/', '/logout']}>
16
+ <Routes>
17
+ <Route path='/' element={LoggedPage} />
18
+ <Route path='/logout' element={LogoutWrapper} />
19
+ </Routes>
20
+ </MemoryRouter>
21
+ </UserProvider>
25
22
  )
26
23
 
27
24
  function LoggedPage() {
28
25
  const user = useUser()
26
+ const navigate = useNavigate()
29
27
 
30
28
  useEffect(() => {
31
29
  user.login({
@@ -43,7 +41,7 @@ function LoggedPage() {
43
41
  }, [])
44
42
 
45
43
  const redirectToLogout = () => {
46
- RouteService.redirectTo('/logout')
44
+ navigate('/logout')
47
45
  }
48
46
 
49
47
  return (
@@ -1,15 +1,16 @@
1
1
  import { useEffect } from 'react'
2
2
  import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
3
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
3
+ import { useNavigate } from 'react-router-dom'
4
4
  import { BlockLoader } from '../../static'
5
5
 
6
6
  export const Logout = () => {
7
7
  const user = useUser()
8
+ const navigate = useNavigate()
8
9
 
9
10
  useEffect(() => {
10
11
  user.logout()
11
- RouteService.redirectTo('/')
12
- }, [user])
12
+ navigate('/')
13
+ }, [navigate, user])
13
14
 
14
15
  return <BlockLoader />
15
16
  }
@@ -1,9 +1,8 @@
1
1
  import { useContext, useState } from 'react'
2
2
  import { Trans, useTranslation } from 'react-i18next'
3
- import { Link } from 'react-router-dom'
3
+ import { Link, useNavigate } from 'react-router-dom'
4
4
  import { Row, Col } from 'react-bootstrap'
5
5
  import RequestContext from '@licklist/plugins/dist/context/app/RequestContext'
6
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
7
6
  import useNotification from '@licklist/plugins/dist/context/app/hooks/useNotification'
8
7
  import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
9
8
  import useAuth from '@licklist/plugins/dist/context/user/hooks/useAuth'
@@ -13,10 +12,8 @@ import { IAuth } from '@licklist/plugins/dist/types/context/user/IAuth'
13
12
  import { IUser } from '@licklist/plugins/dist/types/context/user/IUser'
14
13
  import { UserRegisterRequest } from '@licklist/plugins/dist/types/Request/UserRegisterRequest'
15
14
  import { ErrorHandlerFn } from '@licklist/core/dist/Api/ApiService'
16
-
17
15
  import { RegisterFormComponent } from './RegisterFormComponent'
18
16
  import { SocialFormComponent } from '../Social/SocialFormComponent'
19
- import { Router } from '../Router'
20
17
  import FormCard from '../../static/FormCard'
21
18
  import { LoaderIndicator } from '../../static/loader/LoaderIndicator'
22
19
 
@@ -33,6 +30,7 @@ function RegisterComponent({
33
30
  const auth = useAuth()
34
31
  const user = useUser()
35
32
  const invite = useInvite()
33
+ const navigate = useNavigate()
36
34
 
37
35
  const [isLoading, setIsLoading] = useState<boolean>(false)
38
36
  const [serverErrors, setServerErrors] = useState(null)
@@ -92,51 +90,47 @@ function RegisterComponent({
92
90
  message: t('Notification:registeredSuccessfully'),
93
91
  })
94
92
 
95
- RouteService.redirectTo('/')
93
+ navigate('/')
96
94
  }
97
95
 
98
96
  return (
99
- <Router>
100
- <Row className='justify-content-center'>
101
- <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
102
- <>
103
- <h1 className='text-center'>{t('registerTitle')}</h1>
104
-
105
- <h6 className='text-center'>
106
- <Trans t={t} i18nKey='registerPromo'>
107
- Fill out the form below to sign up for {{ name: t('bookedit') }}
108
- {/* TODO fix issue react router types
97
+ <Row className='justify-content-center'>
98
+ <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
99
+ <h1 className='text-center'>{t('registerTitle')}</h1>
100
+
101
+ <h6 className='text-center'>
102
+ <Trans t={t} i18nKey='registerPromo'>
103
+ Fill out the form below to sign up for {{ name: t('bookedit') }}
104
+ {/* TODO fix issue react router types
109
105
  @ts-expect-error */}
110
- . Already signed up? Then just <Link to='/login'>Log in</Link>.
111
- </Trans>
112
- </h6>
113
-
114
- <FormCard>
115
- {showSocialLinks && (
116
- <>
117
- <SocialFormComponent
118
- isLoading={isLoading}
119
- setIsLoading={setIsLoading}
120
- />
121
-
122
- <hr className='mb-2' />
123
- </>
124
- )}
125
-
126
- <RegisterFormComponent
106
+ . Already signed up? Then just <Link to='/login'>Log in</Link>.
107
+ </Trans>
108
+ </h6>
109
+
110
+ <FormCard>
111
+ {showSocialLinks && (
112
+ <>
113
+ <SocialFormComponent
127
114
  isLoading={isLoading}
128
115
  setIsLoading={setIsLoading}
129
- onSubmit={handleOnSubmit}
130
- invitation={invite.invitation}
131
- serverErrors={serverErrors}
132
116
  />
133
117
 
134
- <LoaderIndicator isLoaded={!isLoading} />
135
- </FormCard>
136
- </>
137
- </Col>
138
- </Row>
139
- </Router>
118
+ <hr className='mb-2' />
119
+ </>
120
+ )}
121
+
122
+ <RegisterFormComponent
123
+ isLoading={isLoading}
124
+ setIsLoading={setIsLoading}
125
+ onSubmit={handleOnSubmit}
126
+ invitation={invite.invitation}
127
+ serverErrors={serverErrors}
128
+ />
129
+
130
+ <LoaderIndicator isLoaded={!isLoading} />
131
+ </FormCard>
132
+ </Col>
133
+ </Row>
140
134
  )
141
135
  }
142
136
 
@@ -6,11 +6,10 @@ import { ApiServiceError } from '@licklist/core/dist/Api/ApiService'
6
6
  import RequestContext from '@licklist/plugins/dist/context/app/RequestContext'
7
7
  import useUserApi from '@licklist/plugins/dist/hooks/Api/useUserApi'
8
8
  import useNotification from '@licklist/plugins/dist/context/app/hooks/useNotification'
9
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
10
9
  import { UserResetPasswordRequest } from '@licklist/plugins/dist/types/Request/UserResetPasswordRequest'
11
10
  import { ROUTES } from '@licklist/core/dist/Config'
11
+ import { useNavigate } from 'react-router-dom'
12
12
  import { ResetPasswordFormComponent } from './ResetPasswordFormComponent'
13
- import { Router } from '../Router'
14
13
  import FormCard from '../../static/FormCard'
15
14
  import { LoaderIndicator } from '../../static/loader/LoaderIndicator'
16
15
 
@@ -18,6 +17,7 @@ function ResetPasswordComponent() {
18
17
  const { t } = useTranslation(['Notification', 'User', 'App'])
19
18
  const request = useContext(RequestContext)
20
19
  const notification = useNotification()
20
+ const navigate = useNavigate()
21
21
 
22
22
  const [isLoading, setIsLoading] = useState<boolean>(false)
23
23
 
@@ -45,29 +45,25 @@ function ResetPasswordComponent() {
45
45
  message: t('Notification:passwordResetedSuccessfully'),
46
46
  })
47
47
 
48
- RouteService.redirectTo(ROUTES.LOGIN_PAGE)
48
+ navigate(ROUTES.LOGIN_PAGE)
49
49
  }
50
50
 
51
51
  return (
52
- <Router>
53
- <Row className='justify-content-center'>
54
- <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
55
- <>
56
- <h1 className='text-center'>{t('User:resetPasswordTitle')}</h1>
52
+ <Row className='justify-content-center'>
53
+ <Col xs sm={12} md={7} lg={6} xl={5} className='align-self-center'>
54
+ <h1 className='text-center'>{t('User:resetPasswordTitle')}</h1>
57
55
 
58
- <FormCard>
59
- <ResetPasswordFormComponent
60
- isLoading={isLoading}
61
- setIsLoading={setIsLoading}
62
- onSubmit={handleOnSubmit}
63
- />
56
+ <FormCard>
57
+ <ResetPasswordFormComponent
58
+ isLoading={isLoading}
59
+ setIsLoading={setIsLoading}
60
+ onSubmit={handleOnSubmit}
61
+ />
64
62
 
65
- <LoaderIndicator isLoaded={!isLoading} />
66
- </FormCard>
67
- </>
68
- </Col>
69
- </Row>
70
- </Router>
63
+ <LoaderIndicator isLoaded={!isLoading} />
64
+ </FormCard>
65
+ </Col>
66
+ </Row>
71
67
  )
72
68
  }
73
69
 
@@ -6,11 +6,10 @@ import useUser from '@licklist/plugins/dist/context/user/hooks/useUser'
6
6
  import useQuery from '@licklist/plugins/dist/hooks/Query/useQuery'
7
7
  import useSocialApi from '@licklist/plugins/dist/hooks/Api/useSocialApi'
8
8
  import useUserApi from '@licklist/plugins/dist/hooks/Api/useUserApi'
9
- import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
10
9
  import { IAuth } from '@licklist/plugins/dist/types/context/user/IAuth'
11
10
  import { IUser } from '@licklist/plugins/dist/types/context/user/IUser'
12
11
  import { useTranslation } from 'react-i18next'
13
- import { useParams } from 'react-router-dom'
12
+ import { useNavigate, useParams } from 'react-router-dom'
14
13
  import Row from 'react-bootstrap/Row'
15
14
  import Col from 'react-bootstrap/Col'
16
15
  import FormCard from '../../static/FormCard'
@@ -23,12 +22,13 @@ interface Params {
23
22
  function SocialCallbackComponent() {
24
23
  const { t } = useTranslation(['Notification'])
25
24
  const [isProcessed, setIsProcessed] = useState<boolean>(false)
26
- const { provider } = useParams<Params>()
25
+ const { provider } = useParams<Readonly<Params>>()
27
26
  const query = useQuery()
28
27
  const request = useContext(RequestContext)
29
28
  const notification = useNotification()
30
29
  const auth = useAuth()
31
30
  const user = useUser()
31
+ const navigate = useNavigate()
32
32
 
33
33
  const socialApiService = useSocialApi(request)
34
34
  const userApiService = useUserApi(request)
@@ -78,7 +78,7 @@ function SocialCallbackComponent() {
78
78
  })
79
79
 
80
80
  // Redirect user in case of successful results
81
- RouteService.redirectTo('/')
81
+ navigate('/')
82
82
  }
83
83
 
84
84
  const getSocialProvider = () => socialApiService.getSocialProvider(provider)