@stack-spot/portal-layout 2.7.0 → 2.9.0

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 (67) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/LayoutOverlayManager.d.ts +4 -5
  3. package/dist/LayoutOverlayManager.d.ts.map +1 -1
  4. package/dist/LayoutOverlayManager.js.map +1 -1
  5. package/dist/components/Backdrop.d.ts +67 -1
  6. package/dist/components/Backdrop.d.ts.map +1 -1
  7. package/dist/components/Backdrop.js +60 -9
  8. package/dist/components/Backdrop.js.map +1 -1
  9. package/dist/components/Contact/show-contact-modal.d.ts +5 -2
  10. package/dist/components/Contact/show-contact-modal.d.ts.map +1 -1
  11. package/dist/components/Contact/show-contact-modal.js +15 -15
  12. package/dist/components/Contact/show-contact-modal.js.map +1 -1
  13. package/dist/components/NotificationCenter/NotificationPanel.js +1 -1
  14. package/dist/components/NotificationCenter/NotificationPanel.js.map +1 -1
  15. package/dist/components/NotificationCenter/styled.d.ts +1 -1
  16. package/dist/components/NotificationCenter/styled.d.ts.map +1 -1
  17. package/dist/components/PortalSwitcher.d.ts +1 -1
  18. package/dist/components/PortalSwitcher.d.ts.map +1 -1
  19. package/dist/components/PortalSwitcher.js +3 -22
  20. package/dist/components/PortalSwitcher.js.map +1 -1
  21. package/dist/components/Rate/hook.d.ts +2 -1
  22. package/dist/components/Rate/hook.d.ts.map +1 -1
  23. package/dist/components/Rate/hook.js +7 -19
  24. package/dist/components/Rate/hook.js.map +1 -1
  25. package/dist/components/Rate/on-nps-submit.js +1 -1
  26. package/dist/components/Rate/on-nps-submit.js.map +1 -1
  27. package/dist/components/menu/MenuSections.d.ts.map +1 -1
  28. package/dist/components/menu/MenuSections.js +24 -3
  29. package/dist/components/menu/MenuSections.js.map +1 -1
  30. package/dist/components/menu/types.d.ts +25 -0
  31. package/dist/components/menu/types.d.ts.map +1 -1
  32. package/dist/index.d.ts +3 -3
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +3 -3
  35. package/dist/index.js.map +1 -1
  36. package/dist/layout.css +60 -12
  37. package/dist/svg/StarFillWithGradient.d.ts +6 -0
  38. package/dist/svg/StarFillWithGradient.d.ts.map +1 -0
  39. package/dist/svg/StarFillWithGradient.js +4 -0
  40. package/dist/svg/StarFillWithGradient.js.map +1 -0
  41. package/dist/types.d.ts +5 -0
  42. package/dist/types.d.ts.map +1 -0
  43. package/dist/types.js.map +1 -0
  44. package/package.json +1 -1
  45. package/src/LayoutOverlayManager.tsx +4 -5
  46. package/src/components/Backdrop.tsx +91 -7
  47. package/src/components/Contact/show-contact-modal.tsx +15 -18
  48. package/src/components/NotificationCenter/NotificationPanel.tsx +1 -1
  49. package/src/components/PortalSwitcher.tsx +4 -29
  50. package/src/components/Rate/hook.tsx +7 -20
  51. package/src/components/Rate/on-nps-submit.ts +1 -1
  52. package/src/components/menu/MenuSections.tsx +47 -12
  53. package/src/components/menu/types.ts +25 -0
  54. package/src/index.ts +3 -3
  55. package/src/layout.css +60 -12
  56. package/src/svg/StarFillWithGradient.tsx +14 -0
  57. package/src/types.ts +4 -0
  58. package/dist/components/Contact/ContactPopover.d.ts +0 -2
  59. package/dist/components/Contact/ContactPopover.d.ts.map +0 -1
  60. package/dist/components/Contact/ContactPopover.js +0 -44
  61. package/dist/components/Contact/ContactPopover.js.map +0 -1
  62. package/dist/components/types.d.ts +0 -2
  63. package/dist/components/types.d.ts.map +0 -1
  64. package/dist/components/types.js.map +0 -1
  65. package/src/components/Contact/ContactPopover.tsx +0 -63
  66. package/src/components/types.ts +0 -1
  67. /package/dist/{components/types.js → types.js} +0 -0
@@ -6,8 +6,8 @@ import { theme } from '@stack-spot/portal-theme'
6
6
  import { useTranslate } from '@stack-spot/portal-translate'
7
7
  import { ReactNode, useState } from 'react'
8
8
  import styled from 'styled-components'
9
+ import { PortalAcronym } from '../types'
9
10
  import { useTour } from './tour'
10
- import { PortalAcronym } from './types'
11
11
 
12
12
  const Logos: Record<PortalAcronym, ReactNode> = {
13
13
  'AI': <AI />,
@@ -67,7 +67,6 @@ const PortalSwitcherBox = styled(Flex)`
67
67
  }
68
68
 
69
69
  .action {
70
- padding: 16px;
71
70
  background-color: ${theme.color.light['400']};
72
71
  border-width: 1px;
73
72
  border-style: solid;
@@ -79,7 +78,8 @@ const PortalSwitcherBox = styled(Flex)`
79
78
  }
80
79
 
81
80
  a {
82
- height: auto;
81
+ padding: 16px;
82
+ height: 24px;
83
83
  transition: unset;
84
84
  align-items: flex-start;
85
85
  }
@@ -97,7 +97,6 @@ const PORTAL_SWITCHER_ID = 'PortalSwitcher'
97
97
  */
98
98
  export const PortalSwitcher = ({ portals = [] }: PortalSwitcherProps) => {
99
99
  const [visible, setVisible] = useState<boolean>(false)
100
- const t = useTranslate(translations)
101
100
  const currentPortal = portals?.find(portal => location.href.startsWith(portal.url))
102
101
  usePortalSwitcherTourStep()
103
102
 
@@ -125,10 +124,7 @@ export const PortalSwitcher = ({ portals = [] }: PortalSwitcherProps) => {
125
124
  items={portals?.map(portal => ({
126
125
  label: {
127
126
  id: portal.acronym,
128
- element: <Flex flexDirection="column">
129
- {Logos[portal.acronym]}
130
- <Text appearance="microtext1" mt={3} colorScheme="light.700">{t[portal.acronym]}</Text>
131
- </Flex>,
127
+ element: <Flex w="250px">{Logos[portal.acronym]}</Flex>,
132
128
  },
133
129
  target: '_self',
134
130
  href: portal.url,
@@ -142,27 +138,6 @@ export const PortalSwitcher = ({ portals = [] }: PortalSwitcherProps) => {
142
138
  </PortalSwitcherBox >
143
139
  }
144
140
 
145
-
146
- const translations = {
147
- en: {
148
- EDP: 'Efficient and secure solutions from code to production deployment.',
149
- AI: 'Speed up coding with efficient suggestions and high-quality results.',
150
- HUB: 'Discover AI Stacks, knowledge sources, and quick commands, all in one streamlined hub.',
151
- CS: 'Setup your business in the cloud with reliable services from Stackspot.',
152
- portalSwitcher: 'Portal switcher',
153
- selected: 'selected',
154
- },
155
- pt: {
156
- EDP: 'Soluções eficientes e seguras do código até a implantação em produção.',
157
- AI: 'Acelere o desenvolvimento com sugestões eficientes e resultados de alta qualidade.',
158
- HUB: 'Descubra AI Stacks, knowledge sources e quick commands, tudo em um hub simplificado.',
159
- CS: 'Coloque seu negócio na nuvem com os serviços de cloud confiáveis da Stackspot',
160
- portalSwitcher: 'Seletor de portais',
161
- selected: 'selecionado',
162
- },
163
- }
164
-
165
-
166
141
  /**
167
142
  * Tutorial: a React hook for retrieving the React Tour step that explains how the portal switcher works. The portal switcher is a component
168
143
  * at the top left corner of the layout (header) that allows the user to switch between the different Stackspot portals.
@@ -9,8 +9,8 @@ const loadScript = () => new Promise<void>((resolve, reject) => {
9
9
  document.body.appendChild(script)
10
10
  })
11
11
 
12
- // Function to check if the difference between two dates is greater than 24 hours
13
- function isMoreThan24Hours(date1: Date, date2: Date) {
12
+ // Function to check if the difference between two dates is greater than 30 days
13
+ export function isLessThan30Days(date1: Date, date2: Date) {
14
14
  // Get the timestamps of the dates
15
15
  const timestamp1 = date1.getTime()
16
16
  const timestamp2 = date2.getTime()
@@ -18,30 +18,17 @@ function isMoreThan24Hours(date1: Date, date2: Date) {
18
18
  // Calculate the difference in milliseconds
19
19
  const differenceInMilliseconds = Math.abs(timestamp2 - timestamp1)
20
20
 
21
- // Convert milliseconds to hours
22
- const differenceInHours = differenceInMilliseconds / (1000 * 60 * 60)
21
+ // Convert milliseconds to days
22
+ const differenceInDays = differenceInMilliseconds / (1000 * 60 * 60 * 24)
23
23
 
24
- // Check if the difference is equal or greater than 24 hours
25
- return differenceInHours >= 24
24
+ // Check if the difference is fewer than 30 days
25
+ return differenceInDays < 30
26
26
  }
27
27
 
28
- export function useRatingEffect(onOpenModal?: () => void) {
29
- const verifyShowModal = () => {
30
- const rateNpsItem = localStorage.getItem('rateNps')
31
- const viewNpsItem = localStorage.getItem('viewNpsItem')
32
- const shouldShow = viewNpsItem ? isMoreThan24Hours(new Date(+viewNpsItem), new Date(Date.now())) : true
33
-
34
- setTimeout(() => {
35
- if (!rateNpsItem && shouldShow) {
36
- onOpenModal?.()
37
- localStorage.setItem('viewNpsItem', Date.now().toString())
38
- }
39
- }, 3000)
40
- }
28
+ export function useRatingEffect() {
41
29
 
42
30
  const handleInit = async () => {
43
31
  await loadScript()
44
- verifyShowModal()
45
32
  }
46
33
 
47
34
  useEffectOnce(() => {
@@ -1,5 +1,5 @@
1
1
  function onNpsSubmit(): void {
2
- localStorage.setItem('rateNps', 'true')
2
+ localStorage.setItem('RATED_US_IN', Date.now().toString())
3
3
  }
4
4
 
5
5
  export {}
@@ -3,8 +3,10 @@ import { ChevronRight, Cog, Collapse, Expand, Support } from '@citric/icons'
3
3
  import { useKeyboardControls } from '@stack-spot/portal-components'
4
4
  import { useAnchorTag } from '@stack-spot/portal-components/anchor'
5
5
  import { Dictionary, interpolate, useTranslate } from '@stack-spot/portal-translate'
6
- import { useCallback, useMemo, useState } from 'react'
6
+ import { useCallback, useEffect, useMemo, useState } from 'react'
7
7
  import { elementIds, getLayoutElements } from '../../elements'
8
+ import { StarFillWithGradient } from '../../svg/StarFillWithGradient'
9
+ import { isLessThan30Days } from '../Rate/hook'
8
10
  import { MenuContent } from './MenuContent'
9
11
  import { MenuProps, MenuSection } from './types'
10
12
 
@@ -288,16 +290,7 @@ export const MenuSections = ({ sections = [], ...props }: MenuProps) => {
288
290
  <ul role="menu">{sectionItems}</ul>
289
291
 
290
292
  <Flex mb={7} alignItems="center">
291
- {(props.contactUs?.show) &&
292
- <button role="menuitem" className="toggle sections-footer" onClick={props.contactUs?.onClick}
293
- {...(props.contactUs.active ? { 'aria-current': 'page' } : undefined)}>
294
- <IconBox aria-label={t.contactIcon}>
295
- <Support />
296
- </IconBox>
297
- <Text appearance="microtext1" ml={8} sx={{ marginTop: '3px' }}
298
- className="collapse" colorScheme="light.contrastText">{t.contactUs}</Text>
299
- </button>
300
- }
293
+ <RateAndContactUsItem {...props} />
301
294
  <button role="menuitem" className="toggle sections-footer" onClick={() => toggleMenu(!!props.content || !!props.customContent)}
302
295
  title={t.toggle} tabIndex={-1}>
303
296
  <IconBox>
@@ -313,7 +306,7 @@ export const MenuSections = ({ sections = [], ...props }: MenuProps) => {
313
306
  <IconBox aria-label={t.settingsIcon}>
314
307
  <Cog />
315
308
  </IconBox>
316
- <Text appearance="microtext1" ml={8} className="collapse">{t.settings}</Text>
309
+ <Text appearance="microtext1" ml={8} className="collapse">{t.settings}</Text>
317
310
  </Link>
318
311
  }
319
312
  </Flex>
@@ -325,6 +318,44 @@ export const MenuSections = ({ sections = [], ...props }: MenuProps) => {
325
318
  )
326
319
  }
327
320
 
321
+ const RateAndContactUsItem = ({ ...props }: Omit<MenuProps, 'sections'>) => {
322
+ const t = useTranslate(dictionary)
323
+ const alreadyAnswered = localStorage.getItem('RATED_US_IN')
324
+ const hasAnsweredLess30Days = alreadyAnswered ? isLessThan30Days(new Date(+alreadyAnswered), new Date(Date.now())) : false
325
+
326
+ //This effect is only used to remove from local storage unused keys from
327
+ //previous rate us and contact us versions. We do not want to fill the users storage
328
+ //with things that are not used anymore.
329
+ useEffect(() => {
330
+ localStorage.removeItem('CONTACT_POPOVER')
331
+ localStorage.removeItem('RATE_POPOVER')
332
+ localStorage.removeItem('viewNpsItem')
333
+ }, [])
334
+
335
+ return <>
336
+ {(props.rateUs?.show && !hasAnsweredLess30Days) &&
337
+ <button role="menuitem" className="toggle sections-footer" onClick={props.rateUs?.onClick}
338
+ {...(props.rateUs.active ? { 'aria-current': 'page' } : undefined)}>
339
+ <IconBox aria-label={t.rateUsIcon} sx={{ paddingTop: '2px' }}>
340
+ <StarFillWithGradient id="svg-icon" className="gradient-svg rotate-icon" />
341
+ </IconBox>
342
+ <Text appearance="microtext1" ml={8} sx={{ marginTop: '3px' }}
343
+ className="collapse gradient grow-shrink" colorScheme="light.contrastText">{t.rateUs}</Text>
344
+ </button>
345
+ }
346
+ {(props.contactUs?.show) &&
347
+ <button role="menuitem" className="toggle sections-footer" onClick={props.contactUs?.onClick}
348
+ {...(props.contactUs.active ? { 'aria-current': 'page' } : undefined)}>
349
+ <IconBox aria-label={t.contactIcon}>
350
+ <Support />
351
+ </IconBox>
352
+ <Text appearance="microtext1" ml={8} sx={{ marginTop: '3px' }}
353
+ className="collapse" colorScheme="light.contrastText">{t.contactUs}</Text>
354
+ </button>
355
+ }
356
+ </>
357
+ }
358
+
328
359
  const dictionary = {
329
360
  en: {
330
361
  toggle: 'Show or hide the menu',
@@ -334,6 +365,8 @@ const dictionary = {
334
365
  hide: 'Hide',
335
366
  contactUs: 'Contact us',
336
367
  contactIcon: 'Contact icon',
368
+ rateUs: 'Rate us',
369
+ rateUsIcon: 'Rate us icon',
337
370
  },
338
371
  pt: {
339
372
  toggle: 'Visualizar ou esconder o menu',
@@ -343,5 +376,7 @@ const dictionary = {
343
376
  hide: 'Esconder',
344
377
  contactUs: 'Fale conosco',
345
378
  contactIcon: 'Ícone de contato',
379
+ rateUs: 'Avalie-nos',
380
+ rateUsIcon: 'Avalie-nos icon',
346
381
  },
347
382
  } satisfies Dictionary
@@ -182,6 +182,31 @@ interface BaseMenuProps {
182
182
  /**
183
183
  * Options for the rate button.
184
184
  */
185
+ rateUs?: {
186
+ /**
187
+ * Whether or not to show the rate button.
188
+ */
189
+ show?: boolean,
190
+ /**
191
+ * A function to call when the button is clicked.
192
+ */
193
+ onClick?: () => void,
194
+ /**
195
+ * A url to go to when the button is clicked.
196
+ */
197
+ href?: string,
198
+ /**
199
+ * Whether or not this button represents the page currently active.
200
+ */
201
+ active?: boolean,
202
+ /**
203
+ * A css class to pass to the button.
204
+ */
205
+ className?: string,
206
+ },
207
+ /**
208
+ * Options for the contact us button.
209
+ */
185
210
  contactUs?: {
186
211
  /**
187
212
  * Whether or not to show the rate button.
package/src/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { Backdrop } from './components/Backdrop'
2
+ export { showContactUsModal, showRateUsModal } from './components/Contact/show-contact-modal'
1
3
  export { Dialog } from './components/Dialog'
2
4
  export { Header, HeaderProps } from './components/Header'
3
5
  export { ActionItem, MenuContent, MenuGroup, Title } from './components/menu/MenuContent'
@@ -8,13 +10,11 @@ export { PortalSwitcher } from './components/PortalSwitcher'
8
10
  export { RateComponent } from './components/Rate'
9
11
  export { useRatingEffect } from './components/Rate/hook'
10
12
  export { showRatingModal } from './components/Rate/show-rating-modal'
11
- export { showContactUsModal } from './components/Contact/show-contact-modal'
12
- export { ContactPopover } from './components/Contact/ContactPopover'
13
13
  export * from './components/tour'
14
- export * from './components/types'
15
14
  export * from './elements'
16
15
  export * from './errors'
17
16
  export { Layout, RawLayout } from './Layout'
18
17
  export { overlay } from './LayoutOverlayManager'
18
+ export * from './types'
19
19
  export * from './utils'
20
20
 
package/src/layout.css CHANGED
@@ -192,6 +192,54 @@ body {
192
192
  z-index: 2;
193
193
  }
194
194
 
195
+ .gradient-svg {
196
+ width: 100px;
197
+ height: 100px;
198
+ }
199
+
200
+ .gradient-svg path {
201
+ fill: url(#gradient);
202
+ }
203
+
204
+ #menuSections .toggle .gradient {
205
+ background: linear-gradient(to right, #FF9900, #FF6633);
206
+ -webkit-background-clip: text;
207
+ background-clip: text;
208
+ -webkit-text-fill-color: transparent;
209
+ font-weight: 500;
210
+ line-height: 16px;
211
+ }
212
+
213
+ @keyframes rotate {
214
+ from {
215
+ transform: rotate(0deg);
216
+ }
217
+ to {
218
+ transform: rotate(360deg);
219
+ }
220
+ }
221
+
222
+ .rotate-icon {
223
+ animation: rotate 2s linear forwards;
224
+ animation-delay: 2s;
225
+ }
226
+
227
+ @keyframes growShrink {
228
+ 0% {
229
+ transform: scale(1);
230
+ }
231
+ 50% {
232
+ transform: scale(1.2);
233
+ }
234
+ 100% {
235
+ transform: scale(1);
236
+ }
237
+ }
238
+
239
+ .grow-shrink {
240
+ animation: growShrink 2s ease-in-out forwards;
241
+ }
242
+
195
243
  #menuSections > ul li a:before {
196
244
  content: '';
197
245
  position: absolute;
@@ -301,7 +349,7 @@ body {
301
349
  pointer-events: auto;
302
350
  }
303
351
 
304
- #modal {
352
+ #modal, #backdrop .modal-box {
305
353
  transform: scale(0);
306
354
  display: flex;
307
355
  flex-direction: column;
@@ -309,32 +357,32 @@ body {
309
357
  width: calc(100% - 60px);
310
358
  }
311
359
 
312
- #modal.fit-content {
360
+ #modal.fit-content, #backdrop .modal-box.fit-content {
313
361
  width: auto;
314
362
  }
315
363
 
316
- #modal.full {
364
+ #modal.full, #backdrop .modal-box.full {
317
365
  width: 100%;
318
366
  height: 100%;
319
367
  }
320
368
 
321
- #modal.large {
369
+ #modal.large, #backdrop .modal-box.large {
322
370
  max-width: 1000px;
323
371
  }
324
372
 
325
- #modal.medium {
373
+ #modal.medium, #backdrop .modal-box.medium {
326
374
  max-width: 800px;
327
375
  }
328
376
 
329
- #modal.small {
377
+ #modal.small, #backdrop .modal-box.small {
330
378
  max-width: 600px;
331
379
  }
332
380
 
333
- #modal.visible {
381
+ #modal.visible, #backdrop.visible .modal-box {
334
382
  transform: scale(1);
335
383
  }
336
384
 
337
- #rightPanel {
385
+ #rightPanel, #backdrop .right-panel-box {
338
386
  position: fixed;
339
387
  display: flex;
340
388
  flex-direction: column;
@@ -347,22 +395,22 @@ body {
347
395
  border-bottom-left-radius: 1rem;
348
396
  }
349
397
 
350
- #rightPanel.small {
398
+ #rightPanel.small, #backdrop .right-panel-box.small {
351
399
  right: -400px;
352
400
  width: 400px;
353
401
  }
354
402
 
355
- #rightPanel.medium {
403
+ #rightPanel.medium, #backdrop .right-panel-box.medium {
356
404
  right: -600px;
357
405
  width: 600px;
358
406
  }
359
407
 
360
- #rightPanel.large {
408
+ #rightPanel.large, #backdrop .right-panel-box.large {
361
409
  right: -800px;
362
410
  width: 800px;
363
411
  }
364
412
 
365
- #rightPanel.visible {
413
+ #rightPanel.visible, #backdrop.visible .right-panel-box {
366
414
  right: 0;
367
415
  }
368
416
 
@@ -0,0 +1,14 @@
1
+ /* eslint-disable max-len */
2
+
3
+ export const StarFillWithGradient = ({ className, id, style }: { className?: string, id?: string, style?: React.CSSProperties }) => (
4
+ <svg viewBox="0 0 512 512" className={className} id={id} style={style} width="16" height="16" xmlns="http://www.w3.org/2000/svg">
5
+ <defs>
6
+ <linearGradient id="gradient" x1="0%" y1="0%" x2="100%" y2="100%">
7
+ <stop offset="0%" style={{ 'stopColor':'#FF9900', 'stopOpacity': 1 }}/>
8
+ <stop offset="100%" style={{ 'stopColor':'#FF6633', 'stopOpacity': 1 }}/>
9
+ </linearGradient>
10
+ </defs>
11
+ <path d="M226.885 21.9523C231.432 9.88404 242.98 1.91992 255.85 1.91992C268.719 1.91992 280.268 9.88408 284.814 21.9523C284.863 22.0812 284.91 22.2105 284.956 22.3403L335.667 165.876L478.048 165.876H478.049C490.986 165.876 502.581 173.922 507.079 186.08C511.579 198.245 508.006 211.912 498.152 220.324C498.075 220.39 497.997 220.456 497.918 220.521L377.676 320.039L428.087 471.216L428.091 471.226C432.349 484.019 427.824 498.078 416.935 505.998C406.055 513.912 391.305 513.892 380.445 505.949L380.435 505.941L255.825 414.67L131.151 505.944L131.075 506C131.045 506.021 131.016 506.042 130.987 506.063C120.124 513.848 105.488 513.783 94.6943 505.902C83.8927 498.015 79.374 484.073 83.5272 471.34C83.5408 471.299 83.5545 471.257 83.5683 471.216L133.979 320.041L13.7166 220.522C13.6378 220.457 13.5595 220.391 13.4817 220.324C3.62771 211.912 0.054518 198.245 4.55486 186.08C9.05287 173.922 20.6475 165.876 33.5842 165.876H33.5857L175.992 165.876L226.745 22.3356C226.791 22.2074 226.837 22.0796 226.885 21.9523Z" />
12
+ </svg>
13
+ )
14
+
package/src/types.ts ADDED
@@ -0,0 +1,4 @@
1
+ export type PortalAcronym = 'EDP' | 'AI' | 'HUB' | 'CS'
2
+ export type RightPanelSize = 'small' | 'medium' | 'large'
3
+ export type ModalSize = RightPanelSize | 'fit-content'
4
+ export type CustomModalSize = ModalSize | 'full'
@@ -1,2 +0,0 @@
1
- export declare const ContactPopover: () => import("react/jsx-runtime").JSX.Element;
2
- //# sourceMappingURL=ContactPopover.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContactPopover.d.ts","sourceRoot":"","sources":["../../../src/components/Contact/ContactPopover.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,cAAc,+CA0C1B,CAAA"}
@@ -1,44 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { Box, Text } from '@citric/core';
3
- import { Popover } from '@citric/ui';
4
- import { useTranslate } from '@stack-spot/portal-translate';
5
- import { useEffect, useState } from 'react';
6
- import { useTour } from '../tour/index.js';
7
- const CONTACT_POPOVER = 'CONTACT_POPOVER';
8
- export const ContactPopover = () => {
9
- const t = useTranslate(dictionary);
10
- const { isOpen } = useTour();
11
- const [visible, setVisible] = useState(false);
12
- useEffect(() => {
13
- if (!isOpen) {
14
- const rateInStorage = localStorage.getItem(CONTACT_POPOVER);
15
- setVisible(!rateInStorage);
16
- }
17
- else {
18
- localStorage.removeItem(CONTACT_POPOVER);
19
- setVisible(false);
20
- }
21
- }, [isOpen]);
22
- return _jsx(Popover, { position: "right", sx: {
23
- p: 3,
24
- left: 'calc(var(--menu-sections-width) + 16px)',
25
- bottom: 'calc(var(--menu-item-height) - 64px)',
26
- top: 'auto',
27
- maxHeight: '130px',
28
- zIndex: '3',
29
- '* button:disabled ': { pointerEvents: 'all' },
30
- }, defaultVisible: visible, content: _jsx(Box, { px: 5, py: 3, children: _jsx(Text, { appearance: "microtext1", colorScheme: "inverse.contrastText", children: t.popoverContent }) }), title: t.contactUs, containerSx: { position: 'unset' }, onClose: () => {
31
- visible && localStorage.setItem(CONTACT_POPOVER, '1');
32
- }, children: _jsx(_Fragment, {}) });
33
- };
34
- const dictionary = {
35
- en: {
36
- contactUs: 'Contact us',
37
- popoverContent: 'Here you can help us improve by rating StackSpot or request assistance from our support team.',
38
- },
39
- pt: {
40
- contactUs: 'Fale conosco',
41
- popoverContent: 'Aqui você pode nos ajudar a melhorar avaliando o StackSpot ou solicitando assistência de nossa equipe de suporte.',
42
- },
43
- };
44
- //# sourceMappingURL=ContactPopover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ContactPopover.js","sourceRoot":"","sources":["../../../src/components/Contact/ContactPopover.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAU,IAAI,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAc,YAAY,EAAE,MAAM,8BAA8B,CAAA;AACvE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAEzC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IAClC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAA;IAC5B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAE7C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,eAAe,CAAC,CAAA;YAC3D,UAAU,CAAC,CAAC,aAAa,CAAC,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,UAAU,CAAC,eAAe,CAAC,CAAA;YACxC,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAEZ,OAAO,KAAC,OAAO,IACb,QAAQ,EAAC,OAAO,EAChB,EAAE,EAAE;YACF,CAAC,EAAE,CAAC;YACJ,IAAI,EAAE,yCAAyC;YAC/C,MAAM,EAAE,sCAAsC;YAC9C,GAAG,EAAE,MAAM;YACX,SAAS,EAAE,OAAO;YAClB,MAAM,EAAE,GAAG;YACX,oBAAoB,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE;SACrC,EACX,cAAc,EAAE,OAAO,EACvB,OAAO,EACL,KAAC,GAAG,IAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,UAAU,EAAC,YAAY,EAAC,WAAW,EAAC,sBAAsB,YAC7D,CAAC,CAAC,cAAc,GACZ,GACH,EAER,KAAK,EAAE,CAAC,CAAC,SAAS,EAClB,WAAW,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,EAClC,OAAO,EAAE,GAAG,EAAE;YACZ,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAA;QACvD,CAAC,YAED,mBAAK,GACG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE;QACF,SAAS,EAAE,YAAY;QACvB,cAAc,EAAE,+FAA+F;KAChH;IACD,EAAE,EAAE;QACF,SAAS,EAAE,cAAc;QACzB,cAAc,EAAE,mHAAmH;KACpI;CACmB,CAAA"}
@@ -1,2 +0,0 @@
1
- export type PortalAcronym = 'EDP' | 'AI' | 'HUB' | 'CS';
2
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":""}
@@ -1,63 +0,0 @@
1
- import { Box, Styles, Text } from '@citric/core'
2
- import { Popover } from '@citric/ui'
3
- import { Dictionary, useTranslate } from '@stack-spot/portal-translate'
4
- import { useEffect, useState } from 'react'
5
- import { useTour } from '../tour'
6
-
7
- const CONTACT_POPOVER = 'CONTACT_POPOVER'
8
-
9
- export const ContactPopover = () => {
10
- const t = useTranslate(dictionary)
11
- const { isOpen } = useTour()
12
- const [visible, setVisible] = useState(false)
13
-
14
- useEffect(() => {
15
- if (!isOpen) {
16
- const rateInStorage = localStorage.getItem(CONTACT_POPOVER)
17
- setVisible(!rateInStorage)
18
- } else {
19
- localStorage.removeItem(CONTACT_POPOVER)
20
- setVisible(false)
21
- }
22
- }, [isOpen])
23
-
24
- return <Popover
25
- position="right"
26
- sx={{
27
- p: 3,
28
- left: 'calc(var(--menu-sections-width) + 16px)',
29
- bottom: 'calc(var(--menu-item-height) - 64px)',
30
- top: 'auto',
31
- maxHeight: '130px',
32
- zIndex: '3',
33
- '* button:disabled ': { pointerEvents: 'all' },
34
- } as Styles}
35
- defaultVisible={visible}
36
- content={
37
- <Box px={5} py={3}>
38
- <Text appearance="microtext1" colorScheme="inverse.contrastText">
39
- {t.popoverContent}
40
- </Text>
41
- </Box>
42
- }
43
- title={t.contactUs}
44
- containerSx={{ position: 'unset' }}
45
- onClose={() => {
46
- visible && localStorage.setItem(CONTACT_POPOVER, '1')
47
- }}
48
- >
49
- <></>
50
- </Popover>
51
- }
52
-
53
- const dictionary = {
54
- en: {
55
- contactUs: 'Contact us',
56
- popoverContent: 'Here you can help us improve by rating StackSpot or request assistance from our support team.',
57
- },
58
- pt: {
59
- contactUs: 'Fale conosco',
60
- popoverContent: 'Aqui você pode nos ajudar a melhorar avaliando o StackSpot ou solicitando assistência de nossa equipe de suporte.',
61
- },
62
- } satisfies Dictionary
63
-
@@ -1 +0,0 @@
1
- export type PortalAcronym = 'EDP' | 'AI' | 'HUB' | 'CS'
File without changes