@deix/rossini-core 1.0.9 → 2.0.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.
- package/lib/components/buttons/Avatar/Avatar.d.ts.map +1 -0
- package/lib/components/buttons/Avatar/Avatar.js +49 -0
- package/lib/components/buttons/LanguageSelect/LanguageSelect.d.ts.map +1 -0
- package/lib/components/buttons/LanguageSelect/LanguageSelect.js +57 -0
- package/lib/components/buttons/ToggleButtonGroup/ToggleButtonGroup.d.ts.map +1 -0
- package/lib/components/buttons/ToggleButtonGroup/ToggleButtonGroup.js +18 -0
- package/lib/components/buttons/index.d.ts.map +1 -0
- package/lib/components/buttons/index.js +3 -0
- package/lib/components/display/Accordion/Accordion.d.ts.map +1 -0
- package/lib/components/display/Accordion/Accordion.js +22 -0
- package/lib/components/display/StyledValue/ImprovementChip.d.ts.map +1 -0
- package/lib/components/display/StyledValue/ImprovementChip.js +62 -0
- package/lib/components/display/StyledValue/StyledValue.d.ts.map +1 -0
- package/lib/components/display/StyledValue/StyledValue.js +84 -0
- package/lib/components/display/StyledValue/hooks.d.ts +6 -0
- package/lib/components/display/StyledValue/hooks.d.ts.map +1 -0
- package/lib/{src/components → components}/display/StyledValue/hooks.js +4 -7
- package/lib/components/display/index.d.ts.map +1 -0
- package/lib/components/display/index.js +3 -0
- package/lib/components/i18n/Link.d.ts +9 -0
- package/lib/components/i18n/Link.d.ts.map +1 -0
- package/lib/components/i18n/Link.js +20 -0
- package/lib/components/i18n/index.d.ts +3 -0
- package/lib/components/i18n/index.d.ts.map +1 -0
- package/lib/components/i18n/index.js +1 -0
- package/lib/{src/components → components}/index.d.ts +4 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +6 -0
- package/lib/components/layout/MinimalLayout/MinimalLayout.d.ts.map +1 -0
- package/lib/components/layout/MinimalLayout/MinimalLayout.js +59 -0
- package/lib/{src/components/layout/StandardLayout → components/layout/MinimalLayout}/translations.json +1 -0
- package/lib/components/layout/StandardLayout/StandardLayout.d.ts.map +1 -0
- package/lib/components/layout/StandardLayout/StandardLayout.js +72 -0
- package/lib/{src/components/layout/MinimalLayout → components/layout/StandardLayout}/translations.json +1 -0
- package/lib/components/layout/assets/DeixLogo.d.ts.map +1 -0
- package/lib/components/layout/assets/DeixLogo.js +15 -0
- package/lib/components/layout/assets/ServerDown.d.ts.map +1 -0
- package/lib/components/layout/assets/ServerDown.js +55 -0
- package/lib/components/layout/components/AppLogo/AppLogo.d.ts.map +1 -0
- package/lib/components/layout/components/AppLogo/AppLogo.js +25 -0
- package/lib/components/layout/components/Footer/Footer.d.ts.map +1 -0
- package/lib/components/layout/components/Footer/Footer.js +59 -0
- package/lib/components/layout/components/Sidebar/Sidebar.d.ts.map +1 -0
- package/lib/components/layout/components/Sidebar/Sidebar.js +237 -0
- package/lib/components/layout/components/Topbar/ElevationScroll.d.ts.map +1 -0
- package/lib/components/layout/components/Topbar/ElevationScroll.js +13 -0
- package/lib/components/layout/components/Topbar/Topbar.d.ts.map +1 -0
- package/lib/components/layout/components/Topbar/Topbar.js +38 -0
- package/lib/{src/components → components}/layout/components/Topbar/translations.json +4 -0
- package/lib/components/layout/components/Topline/TopLine.d.ts.map +1 -0
- package/lib/components/layout/components/Topline/TopLine.js +14 -0
- package/lib/components/layout/index.d.ts.map +1 -0
- package/lib/components/layout/index.js +2 -0
- package/lib/components/progress/CircularLoading/CircularLoading.d.ts.map +1 -0
- package/lib/components/progress/CircularLoading/CircularLoading.js +19 -0
- package/lib/components/progress/index.d.ts.map +1 -0
- package/lib/components/progress/index.js +1 -0
- package/lib/{src/utils → components}/provider/PageProvider.d.ts +1 -3
- package/lib/components/provider/PageProvider.d.ts.map +1 -0
- package/lib/components/provider/PageProvider.js +9 -0
- package/lib/components/provider/ThemeProvider.d.ts +15 -0
- package/lib/components/provider/ThemeProvider.d.ts.map +1 -0
- package/lib/components/provider/ThemeProvider.js +36 -0
- package/lib/components/provider/index.d.ts +3 -0
- package/lib/components/provider/index.d.ts.map +1 -0
- package/lib/components/provider/index.js +1 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +3 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/{src/types → types}/api.d.ts +1 -1
- package/lib/types/api.d.ts.map +1 -0
- package/lib/types/api.js +1 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +1 -0
- package/lib/{src/types → types}/languages.d.ts +2 -1
- package/lib/types/languages.d.ts.map +1 -0
- package/lib/types/languages.js +15 -0
- package/lib/{src/types → types}/palette.d.ts +2 -1
- package/lib/types/palette.d.ts.map +1 -0
- package/lib/types/palette.js +1 -0
- package/lib/utils/helpers/colorHelpers.d.ts.map +1 -0
- package/lib/{src/utils → utils}/helpers/colorHelpers.js +6 -13
- package/lib/utils/helpers/dateHelpers.d.ts.map +1 -0
- package/lib/{src/utils → utils}/helpers/dateHelpers.js +5 -12
- package/lib/utils/helpers/index.d.ts +4 -0
- package/lib/utils/helpers/index.d.ts.map +1 -0
- package/lib/{src/utils/helpers/index.d.ts → utils/helpers/index.js} +1 -2
- package/lib/{src/utils → utils}/helpers/stringHelpers.d.ts +1 -0
- package/lib/utils/helpers/stringHelpers.d.ts.map +1 -0
- package/lib/utils/helpers/stringHelpers.js +40 -0
- package/lib/{src/utils → utils}/hooks/index.d.ts +1 -0
- package/lib/utils/hooks/index.d.ts.map +1 -0
- package/lib/utils/hooks/index.js +5 -0
- package/lib/utils/hooks/useAPI.d.ts.map +1 -0
- package/lib/utils/hooks/useAPI.js +18 -0
- package/lib/utils/hooks/useLocale.d.ts.map +1 -0
- package/lib/utils/hooks/useLocale.js +9 -0
- package/lib/utils/hooks/usePathname.d.ts +2 -0
- package/lib/utils/hooks/usePathname.d.ts.map +1 -0
- package/lib/utils/hooks/usePathname.js +7 -0
- package/lib/{src/utils → utils}/hooks/usePersistedState.d.ts +2 -1
- package/lib/utils/hooks/usePersistedState.d.ts.map +1 -0
- package/lib/{src/utils → utils}/hooks/usePersistedState.js +18 -20
- package/lib/{src/utils → utils}/hooks/useUserInfo.d.ts +2 -1
- package/lib/utils/hooks/useUserInfo.d.ts.map +1 -0
- package/lib/utils/hooks/useUserInfo.js +25 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +3 -0
- package/lib/utils/middleware/createI18nMiddleware.d.ts +8 -0
- package/lib/utils/middleware/createI18nMiddleware.d.ts.map +1 -0
- package/lib/utils/middleware/createI18nMiddleware.js +35 -0
- package/lib/utils/theme/components/MuiAccordion.d.ts.map +1 -0
- package/lib/{src/utils → utils}/theme/components/MuiAccordion.js +1 -3
- package/lib/utils/theme/components/MuiCard.d.ts.map +1 -0
- package/lib/{src/utils → utils}/theme/components/MuiCard.js +1 -3
- package/lib/utils/theme/components/MuiCardHeader.d.ts.map +1 -0
- package/lib/{src/utils → utils}/theme/components/MuiCardHeader.js +1 -3
- package/lib/utils/theme/components/MuiFormControl.d.ts.map +1 -0
- package/lib/utils/theme/components/MuiFormControl.js +6 -0
- package/lib/utils/theme/components/MuiGrid.d.ts.map +1 -0
- package/lib/utils/theme/components/MuiGrid.js +5 -0
- package/lib/utils/theme/components/MuiPaper.d.ts.map +1 -0
- package/lib/{src/utils → utils}/theme/components/MuiPaper.js +1 -3
- package/lib/utils/theme/components/MuiTypography.d.ts.map +1 -0
- package/lib/utils/theme/components/MuiTypography.js +5 -0
- package/lib/utils/theme/components/index.d.ts.map +1 -0
- package/lib/utils/theme/components/index.js +17 -0
- package/lib/utils/theme/index.d.ts.map +1 -0
- package/lib/utils/theme/index.js +56 -0
- package/lib/{src/utils → utils}/theme/palette/index.d.ts +2 -2
- package/lib/utils/theme/palette/index.d.ts.map +1 -0
- package/lib/utils/theme/palette/index.js +96 -0
- package/lib/utils/theme/typography.d.ts.map +1 -0
- package/lib/{src/utils → utils}/theme/typography.js +1 -3
- package/package.json +50 -42
- package/lib/package.json +0 -85
- package/lib/src/components/buttons/Avatar/Avatar.d.ts.map +0 -1
- package/lib/src/components/buttons/Avatar/Avatar.js +0 -78
- package/lib/src/components/buttons/LanguageSelect/LanguageSelect.d.ts.map +0 -1
- package/lib/src/components/buttons/LanguageSelect/LanguageSelect.js +0 -58
- package/lib/src/components/buttons/ToggleButtonGroup/ToggleButtonGroup.d.ts.map +0 -1
- package/lib/src/components/buttons/ToggleButtonGroup/ToggleButtonGroup.js +0 -44
- package/lib/src/components/buttons/index.d.ts.map +0 -1
- package/lib/src/components/buttons/index.js +0 -9
- package/lib/src/components/display/Accordion/Accordion.d.ts.map +0 -1
- package/lib/src/components/display/Accordion/Accordion.js +0 -26
- package/lib/src/components/display/StyledValue/ImprovementChip.d.ts.map +0 -1
- package/lib/src/components/display/StyledValue/ImprovementChip.js +0 -66
- package/lib/src/components/display/StyledValue/StyledValue.d.ts.map +0 -1
- package/lib/src/components/display/StyledValue/StyledValue.js +0 -86
- package/lib/src/components/display/StyledValue/hooks.d.ts +0 -4
- package/lib/src/components/display/StyledValue/hooks.d.ts.map +0 -1
- package/lib/src/components/display/index.d.ts.map +0 -1
- package/lib/src/components/display/index.js +0 -12
- package/lib/src/components/index.d.ts.map +0 -1
- package/lib/src/components/index.js +0 -16
- package/lib/src/components/layout/MinimalLayout/MinimalLayout.d.ts.map +0 -1
- package/lib/src/components/layout/MinimalLayout/MinimalLayout.js +0 -64
- package/lib/src/components/layout/StandardLayout/StandardLayout.d.ts.map +0 -1
- package/lib/src/components/layout/StandardLayout/StandardLayout.js +0 -74
- package/lib/src/components/layout/assets/DeixLogo.d.ts.map +0 -1
- package/lib/src/components/layout/assets/DeixLogo.js +0 -20
- package/lib/src/components/layout/assets/ServerDown.d.ts.map +0 -1
- package/lib/src/components/layout/assets/ServerDown.js +0 -60
- package/lib/src/components/layout/components/AppLogo/AppLogo.d.ts.map +0 -1
- package/lib/src/components/layout/components/AppLogo/AppLogo.js +0 -30
- package/lib/src/components/layout/components/Footer/Footer.d.ts.map +0 -1
- package/lib/src/components/layout/components/Footer/Footer.js +0 -64
- package/lib/src/components/layout/components/Sidebar/Sidebar.d.ts.map +0 -1
- package/lib/src/components/layout/components/Sidebar/Sidebar.js +0 -237
- package/lib/src/components/layout/components/Topbar/ElevationScroll.d.ts.map +0 -1
- package/lib/src/components/layout/components/Topbar/ElevationScroll.js +0 -17
- package/lib/src/components/layout/components/Topbar/Topbar.d.ts.map +0 -1
- package/lib/src/components/layout/components/Topbar/Topbar.js +0 -61
- package/lib/src/components/layout/components/Topbar/Topbar.styles.d.ts +0 -18
- package/lib/src/components/layout/components/Topbar/Topbar.styles.d.ts.map +0 -1
- package/lib/src/components/layout/components/Topbar/Topbar.styles.js +0 -16
- package/lib/src/components/layout/components/Topline/TopLine.d.ts.map +0 -1
- package/lib/src/components/layout/components/Topline/TopLine.js +0 -18
- package/lib/src/components/layout/index.d.ts.map +0 -1
- package/lib/src/components/layout/index.js +0 -10
- package/lib/src/components/progress/CircularLoading/CircularLoading.d.ts.map +0 -1
- package/lib/src/components/progress/CircularLoading/CircularLoading.js +0 -22
- package/lib/src/components/progress/index.d.ts.map +0 -1
- package/lib/src/components/progress/index.js +0 -8
- package/lib/src/index.d.ts +0 -7
- package/lib/src/index.d.ts.map +0 -1
- package/lib/src/index.js +0 -32
- package/lib/src/types/api.d.ts.map +0 -1
- package/lib/src/types/api.js +0 -2
- package/lib/src/types/index.d.ts.map +0 -1
- package/lib/src/types/index.js +0 -5
- package/lib/src/types/languages.d.ts.map +0 -1
- package/lib/src/types/languages.js +0 -18
- package/lib/src/types/palette.d.ts.map +0 -1
- package/lib/src/types/palette.js +0 -2
- package/lib/src/utils/helpers/colorHelpers.d.ts.map +0 -1
- package/lib/src/utils/helpers/dateHelpers.d.ts.map +0 -1
- package/lib/src/utils/helpers/index.d.ts.map +0 -1
- package/lib/src/utils/helpers/index.js +0 -17
- package/lib/src/utils/helpers/stringHelpers.d.ts.map +0 -1
- package/lib/src/utils/helpers/stringHelpers.js +0 -39
- package/lib/src/utils/hooks/index.d.ts.map +0 -1
- package/lib/src/utils/hooks/index.js +0 -14
- package/lib/src/utils/hooks/useAPI.d.ts.map +0 -1
- package/lib/src/utils/hooks/useAPI.js +0 -23
- package/lib/src/utils/hooks/useLocale.d.ts.map +0 -1
- package/lib/src/utils/hooks/useLocale.js +0 -13
- package/lib/src/utils/hooks/usePersistedState.d.ts.map +0 -1
- package/lib/src/utils/hooks/useUserInfo.d.ts.map +0 -1
- package/lib/src/utils/hooks/useUserInfo.js +0 -32
- package/lib/src/utils/index.d.ts +0 -5
- package/lib/src/utils/index.d.ts.map +0 -1
- package/lib/src/utils/index.js +0 -25
- package/lib/src/utils/provider/PageProvider.d.ts.map +0 -1
- package/lib/src/utils/provider/PageProvider.js +0 -19
- package/lib/src/utils/provider/ThemeProvider.d.ts +0 -9
- package/lib/src/utils/provider/ThemeProvider.d.ts.map +0 -1
- package/lib/src/utils/provider/ThemeProvider.js +0 -47
- package/lib/src/utils/theme/components/MuiAccordion.d.ts.map +0 -1
- package/lib/src/utils/theme/components/MuiCard.d.ts.map +0 -1
- package/lib/src/utils/theme/components/MuiCardHeader.d.ts.map +0 -1
- package/lib/src/utils/theme/components/MuiFormControl.d.ts.map +0 -1
- package/lib/src/utils/theme/components/MuiFormControl.js +0 -8
- package/lib/src/utils/theme/components/MuiGrid.d.ts.map +0 -1
- package/lib/src/utils/theme/components/MuiGrid.js +0 -7
- package/lib/src/utils/theme/components/MuiPaper.d.ts.map +0 -1
- package/lib/src/utils/theme/components/MuiTypography.d.ts.map +0 -1
- package/lib/src/utils/theme/components/MuiTypography.js +0 -7
- package/lib/src/utils/theme/components/index.d.ts.map +0 -1
- package/lib/src/utils/theme/components/index.js +0 -22
- package/lib/src/utils/theme/createEmotionCache.d.ts +0 -2
- package/lib/src/utils/theme/createEmotionCache.d.ts.map +0 -1
- package/lib/src/utils/theme/createEmotionCache.js +0 -11
- package/lib/src/utils/theme/index.d.ts.map +0 -1
- package/lib/src/utils/theme/index.js +0 -85
- package/lib/src/utils/theme/palette/index.d.ts.map +0 -1
- package/lib/src/utils/theme/palette/index.js +0 -100
- package/lib/src/utils/theme/typography.d.ts.map +0 -1
- /package/lib/{src/components → components}/buttons/Avatar/Avatar.d.ts +0 -0
- /package/lib/{src/components → components}/buttons/LanguageSelect/LanguageSelect.d.ts +0 -0
- /package/lib/{src/components → components}/buttons/LanguageSelect/translations.json +0 -0
- /package/lib/{src/components → components}/buttons/ToggleButtonGroup/ToggleButtonGroup.d.ts +0 -0
- /package/lib/{src/components → components}/buttons/index.d.ts +0 -0
- /package/lib/{src/components → components}/display/Accordion/Accordion.d.ts +0 -0
- /package/lib/{src/components → components}/display/StyledValue/ImprovementChip.d.ts +0 -0
- /package/lib/{src/components → components}/display/StyledValue/StyledValue.d.ts +0 -0
- /package/lib/{src/components → components}/display/StyledValue/translations.json +0 -0
- /package/lib/{src/components → components}/display/index.d.ts +0 -0
- /package/lib/{src/components → components}/layout/MinimalLayout/MinimalLayout.d.ts +0 -0
- /package/lib/{src/components → components}/layout/StandardLayout/StandardLayout.d.ts +0 -0
- /package/lib/{src/components → components}/layout/assets/DeixLogo.d.ts +0 -0
- /package/lib/{src/components → components}/layout/assets/DeixLogo.tsx +0 -0
- /package/lib/{src/components → components}/layout/assets/ServerDown.d.ts +0 -0
- /package/lib/{src/components → components}/layout/assets/ServerDown.tsx +0 -0
- /package/lib/{src/components → components}/layout/assets/deix_logo_symbol_minimal.svg +0 -0
- /package/lib/{src/components → components}/layout/assets/undraw_server_down.svg +0 -0
- /package/lib/{src/components → components}/layout/components/AppLogo/AppLogo.d.ts +0 -0
- /package/lib/{src/components → components}/layout/components/Footer/Footer.d.ts +0 -0
- /package/lib/{src/components → components}/layout/components/Sidebar/Sidebar.d.ts +0 -0
- /package/lib/{src/components → components}/layout/components/Topbar/ElevationScroll.d.ts +0 -0
- /package/lib/{src/components → components}/layout/components/Topbar/Topbar.d.ts +0 -0
- /package/lib/{src/components → components}/layout/components/Topline/TopLine.d.ts +0 -0
- /package/lib/{src/components → components}/layout/index.d.ts +0 -0
- /package/lib/{src/components → components}/progress/CircularLoading/CircularLoading.d.ts +0 -0
- /package/lib/{src/components → components}/progress/CircularLoading/translations.json +0 -0
- /package/lib/{src/components → components}/progress/index.d.ts +0 -0
- /package/lib/{src/types → types}/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/helpers/colorHelpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/helpers/dateHelpers.d.ts +0 -0
- /package/lib/{src/utils → utils}/hooks/useAPI.d.ts +0 -0
- /package/lib/{src/utils → utils}/hooks/useLocale.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/MuiAccordion.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/MuiCard.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/MuiCardHeader.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/MuiFormControl.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/MuiGrid.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/MuiPaper.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/MuiTypography.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/components/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/index.d.ts +0 -0
- /package/lib/{src/utils → utils}/theme/typography.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,WAAW,KAAK;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,kBAAkB,CAAC;CAC7B;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AACD,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AAClC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/lib/types/api.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AACrE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isStringTranslation } from './languages';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const locales: readonly ["en", "es", "de", "fr", "it"];
|
|
2
|
+
export type Locale = (typeof locales)[number];
|
|
2
3
|
export type CountryCode = 'us' | 'de' | 'fr' | 'it';
|
|
3
4
|
export type StringTranslation = {
|
|
4
5
|
[key in Locale]?: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/types/languages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,yCAA0C,CAAC;AAC/D,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9C,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG;KAC7B,GAAG,IAAI,MAAM,CAAC,CAAC,EAAE,MAAM;CACzB,CAAC;AAEF,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,UACvB,OAAO,+BAGf,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE;KAAG,GAAG,IAAI,WAAW,GAAG,MAAM;CAKrD,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const locales = ['en', 'es', 'de', 'fr', 'it'];
|
|
2
|
+
/**
|
|
3
|
+
* Type guard for StringTranslation type.
|
|
4
|
+
*
|
|
5
|
+
* @param {unknown} value the value whose type needs checking.
|
|
6
|
+
*/
|
|
7
|
+
export const isStringTranslation = (value) => {
|
|
8
|
+
return value.en !== undefined;
|
|
9
|
+
};
|
|
10
|
+
export const flagIcons = {
|
|
11
|
+
us: '🇺🇸',
|
|
12
|
+
it: '🇮🇹',
|
|
13
|
+
de: '🇩🇪',
|
|
14
|
+
fr: '🇫🇷',
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../../src/types/palette.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,OAAO;QACf,QAAQ,EAAE,yBAAyB,CAAC;QACpC,aAAa,EAAE,yBAAyB,CAAC;QACzC,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC7C,MAAM,EAAE,yBAAyB,CAAC;KACnC;IACD,UAAU,cAAc;QACtB,QAAQ,EAAE,yBAAyB,CAAC;QACpC,aAAa,EAAE,yBAAyB,CAAC;QACzC,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,CAAC;QAC7C,MAAM,EAAE,yBAAyB,CAAC;KACnC;CACF;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/colorHelpers.ts"],"names":[],"mappings":"AAwJA,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,mBASnC;AAED,eAAO,MAAM,UAAU,WAAY,MAAM,oBAIxC,CAAC;AAEF,eAAO,MAAM,aAAa,QAAS,MAAM,EAAE,GAAG,IAAI,WACyB,CAAC;AAE5E,eAAO,MAAM,YAAY,mBAAoB,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,sBAQpE,CAAC"}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTextColor = exports.getBrightness = exports.colorToRgb = exports.hexToRgb = void 0;
|
|
4
1
|
function colourNameToHex(colour) {
|
|
5
2
|
const colours = {
|
|
6
3
|
aliceblue: '#f0f8ff',
|
|
@@ -150,7 +147,7 @@ function colourNameToHex(colour) {
|
|
|
150
147
|
}
|
|
151
148
|
return false;
|
|
152
149
|
}
|
|
153
|
-
function hexToRgb(hex) {
|
|
150
|
+
export function hexToRgb(hex) {
|
|
154
151
|
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
155
152
|
return result
|
|
156
153
|
? [
|
|
@@ -160,19 +157,15 @@ function hexToRgb(hex) {
|
|
|
160
157
|
]
|
|
161
158
|
: null;
|
|
162
159
|
}
|
|
163
|
-
|
|
164
|
-
const colorToRgb = (colour) => {
|
|
160
|
+
export const colorToRgb = (colour) => {
|
|
165
161
|
const hexColor = colour.charAt(0) === '#' ? colour : colourNameToHex(colour);
|
|
166
162
|
return hexColor ? hexToRgb(hexColor) : [0, 0, 0];
|
|
167
163
|
};
|
|
168
|
-
|
|
169
|
-
const
|
|
170
|
-
exports.getBrightness = getBrightness;
|
|
171
|
-
const getTextColor = (background_rgb) => {
|
|
164
|
+
export const getBrightness = (rgb) => rgb ? Math.round((rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000) : 0;
|
|
165
|
+
export const getTextColor = (background_rgb) => {
|
|
172
166
|
// it give black or white color based on background color
|
|
173
|
-
const brightness =
|
|
174
|
-
?
|
|
167
|
+
const brightness = getBrightness(typeof background_rgb === 'string'
|
|
168
|
+
? colorToRgb(background_rgb)
|
|
175
169
|
: background_rgb);
|
|
176
170
|
return brightness > 125 ? 'black' : 'white';
|
|
177
171
|
};
|
|
178
|
-
exports.getTextColor = getTextColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/dateHelpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,UAAW,IAAI,SAAS,IAAI;;;;;CAkBhD,CAAC;AAEF,eAAO,MAAM,UAAU,UAAW,MAAM,WASvC,CAAC;AAEF,eAAO,MAAM,WAAW,MAAO,MAAM,GAAG,IAAI,cAG3C,CAAC;AAEF,eAAO,MAAM,yBAAyB,MAAO,MAAM,GAAG,IAAI,uBAczD,CAAC"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toLocalStandardDateString = exports.isValidDate = exports.getTimeStr = exports.dateDiff = void 0;
|
|
4
|
-
const dateDiff = (date1, date2) => {
|
|
1
|
+
export const dateDiff = (date1, date2) => {
|
|
5
2
|
let elapsedSeconds = Math.abs(date2.getTime() - date1.getTime()) / 1000; // in seconds
|
|
6
3
|
const elapsedDays = Math.floor(elapsedSeconds / 86400);
|
|
7
4
|
elapsedSeconds -= elapsedDays * 86400;
|
|
@@ -16,8 +13,7 @@ const dateDiff = (date1, date2) => {
|
|
|
16
13
|
seconds: elapsedSeconds,
|
|
17
14
|
};
|
|
18
15
|
};
|
|
19
|
-
|
|
20
|
-
const getTimeStr = (value) => {
|
|
16
|
+
export const getTimeStr = (value) => {
|
|
21
17
|
// converts hours in a string {xx}h {yy}m {zz}s
|
|
22
18
|
const hv = Math.floor(value);
|
|
23
19
|
let restv = value - hv;
|
|
@@ -27,15 +23,13 @@ const getTimeStr = (value) => {
|
|
|
27
23
|
const retStr = `${hv}h ${mv}m ${sv}s`;
|
|
28
24
|
return retStr;
|
|
29
25
|
};
|
|
30
|
-
|
|
31
|
-
const isValidDate = (d) => {
|
|
26
|
+
export const isValidDate = (d) => {
|
|
32
27
|
const date = new Date(d);
|
|
33
28
|
return date instanceof Date && !isNaN(date.getDate());
|
|
34
29
|
};
|
|
35
|
-
|
|
36
|
-
const toLocalStandardDateString = (d) => {
|
|
30
|
+
export const toLocalStandardDateString = (d) => {
|
|
37
31
|
// converts date to locale YYYY/MM/DD format
|
|
38
|
-
if (
|
|
32
|
+
if (isValidDate(d)) {
|
|
39
33
|
const date = new Date(d);
|
|
40
34
|
const isoDateTime = new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
|
41
35
|
.toISOString()
|
|
@@ -47,4 +41,3 @@ const toLocalStandardDateString = (d) => {
|
|
|
47
41
|
return undefined;
|
|
48
42
|
}
|
|
49
43
|
};
|
|
50
|
-
exports.toLocalStandardDateString = toLocalStandardDateString;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { colorToRgb, getTextColor, hexToRgb } from './colorHelpers';
|
|
2
|
+
export { dateDiff, getTimeStr, isValidDate, toLocalStandardDateString, } from './dateHelpers';
|
|
3
|
+
export { camelToSnake, commonStart, stringToColor, toTitleCase, interpolate, } from './stringHelpers';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,GACZ,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { colorToRgb, getTextColor, hexToRgb } from './colorHelpers';
|
|
2
2
|
export { dateDiff, getTimeStr, isValidDate, toLocalStandardDateString, } from './dateHelpers';
|
|
3
|
-
export { camelToSnake, commonStart, stringToColor, toTitleCase, } from './stringHelpers';
|
|
4
|
-
//# sourceMappingURL=index.d.ts.map
|
|
3
|
+
export { camelToSnake, commonStart, stringToColor, toTitleCase, interpolate, } from './stringHelpers';
|
|
@@ -3,4 +3,5 @@ export declare const snakeToCamel: (inputString: string) => string;
|
|
|
3
3
|
export declare const toTitleCase: (inputString: string, sep?: string) => string;
|
|
4
4
|
export declare const stringToColor: (string: string) => string;
|
|
5
5
|
export declare const commonStart: (strings: string[]) => string;
|
|
6
|
+
export declare const interpolate: (template: string, values: Record<string, string>) => string;
|
|
6
7
|
//# sourceMappingURL=stringHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/stringHelpers.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,gBAAiB,MAAM,KAAG,MAC0B,CAAC;AAE9E,eAAO,MAAM,YAAY,gBAAiB,MAAM,KAAG,MAGhD,CAAC;AAEJ,eAAO,MAAM,WAAW,gBAAiB,MAAM,mBAAc,MAI/C,CAAC;AAEf,eAAO,MAAM,aAAa,WAAY,MAAM,WAkB3C,CAAC;AAEF,eAAO,MAAM,WAAW,YAAa,MAAM,EAAE,WAS5C,CAAC;AAIF,eAAO,MAAM,WAAW,aACZ,MAAM,UACR,OAAO,MAAM,EAAE,MAAM,CAAC,WAO/B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const camelToSnake = (inputString) => inputString.replace(/[\w]([A-Z])/g, (m) => `${m[0]}-${m[1]}`).toLowerCase();
|
|
2
|
+
export const snakeToCamel = (inputString) => inputString.replace(/([-_][a-z])/g, (subStr) => subStr.toUpperCase().replace('-', '').replace('_', ''));
|
|
3
|
+
export const toTitleCase = (inputString, sep = '_') => inputString
|
|
4
|
+
.split(sep)
|
|
5
|
+
.map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase())
|
|
6
|
+
.join(' ');
|
|
7
|
+
export const stringToColor = (string) => {
|
|
8
|
+
let hash = 0;
|
|
9
|
+
let i;
|
|
10
|
+
/* eslint-disable no-bitwise */
|
|
11
|
+
for (i = 0; i < string.length; i += 1) {
|
|
12
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
13
|
+
}
|
|
14
|
+
let color = '#';
|
|
15
|
+
for (i = 0; i < 3; i += 1) {
|
|
16
|
+
const value = (hash >> (i * 8)) & 0xff;
|
|
17
|
+
color += `00${value.toString(16)}`.slice(-2);
|
|
18
|
+
}
|
|
19
|
+
/* eslint-enable no-bitwise */
|
|
20
|
+
return color;
|
|
21
|
+
};
|
|
22
|
+
export const commonStart = (strings) => {
|
|
23
|
+
const sortedList = strings.slice().sort();
|
|
24
|
+
const first = sortedList[0];
|
|
25
|
+
const last = sortedList[sortedList.length - 1];
|
|
26
|
+
let i = 0;
|
|
27
|
+
while (i < first.length && first.charAt(i) === last.charAt(i)) {
|
|
28
|
+
i++;
|
|
29
|
+
}
|
|
30
|
+
return first.substring(0, i);
|
|
31
|
+
};
|
|
32
|
+
/// template is a string containing placeholder in curly brackets (e.g. "Hello, {name}!")
|
|
33
|
+
/// values is an object whose keys should match the ones used in the template (e.g. {name: "John"})
|
|
34
|
+
export const interpolate = (template, values) => {
|
|
35
|
+
const replaceVariable = (_match, key) => {
|
|
36
|
+
// key is the content of the capture group
|
|
37
|
+
return values[key] || '';
|
|
38
|
+
};
|
|
39
|
+
return template.replace(/\{(\w+)\}/gi, replaceVariable);
|
|
40
|
+
};
|
|
@@ -2,5 +2,6 @@ export { default as useAPI } from './useAPI';
|
|
|
2
2
|
export { useUserInfo } from './useUserInfo';
|
|
3
3
|
export type { UserInfo } from './useUserInfo';
|
|
4
4
|
export { useLocale } from './useLocale';
|
|
5
|
+
export { usePathname } from './usePathname';
|
|
5
6
|
export { default as usePersistedState } from './usePersistedState';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAPI.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useAPI.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,QAAA,MAAM,MAAM,aAAc,MAAM,KAAG,aAAa,GAAG,SASlD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* Create an Axios instance.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} baseURL the API address.
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
const useAPI = (baseURL) => {
|
|
9
|
+
if (baseURL) {
|
|
10
|
+
return axios.create({
|
|
11
|
+
baseURL,
|
|
12
|
+
headers: {
|
|
13
|
+
Accept: 'application/json',
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default useAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLocale.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useLocale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,SAAS,QAAO,MAK5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePathname.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/usePathname.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,cAIvB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { usePathname as useNextPathname } from 'next/navigation';
|
|
2
|
+
import { useLocale } from './useLocale';
|
|
3
|
+
export const usePathname = () => {
|
|
4
|
+
const pathname = useNextPathname();
|
|
5
|
+
const locale = useLocale();
|
|
6
|
+
return pathname.replace(new RegExp(`^/${locale}`), '') || '/';
|
|
7
|
+
};
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* @param {string} name the name of the variable in local storage.
|
|
5
5
|
* @param {T} defaultValue the default value
|
|
6
6
|
* @param {"local" | "session"} storage the type of storage where to persist the state
|
|
7
|
+
* @returns {[T | undefined, function (T)]} the current value (undefined until localStorage has been checked + a function to update the value)
|
|
7
8
|
*/
|
|
8
|
-
declare function usePersistedState<T>(name: string, defaultValue: T, storage?: 'local' | 'session'): [T, (value: T) => void];
|
|
9
|
+
declare function usePersistedState<T>(name: string, defaultValue: T, storage?: 'local' | 'session'): [T | undefined, (value: T) => void];
|
|
9
10
|
export default usePersistedState;
|
|
10
11
|
//# sourceMappingURL=usePersistedState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePersistedState.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/usePersistedState.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,iBAAS,iBAAiB,CAAC,CAAC,EAC1B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,EACf,OAAO,GAAE,OAAO,GAAG,SAAmB,GACrC,CAAC,CAAC,GAAG,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC,CAyDrC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const react_1 = require("react");
|
|
4
|
-
const storageMap = {
|
|
5
|
-
local: 'localStorage',
|
|
6
|
-
session: 'sessionStorage',
|
|
7
|
-
};
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
8
2
|
/**
|
|
9
3
|
* Use a variable stored persistently on local storage.
|
|
10
4
|
*
|
|
11
5
|
* @param {string} name the name of the variable in local storage.
|
|
12
6
|
* @param {T} defaultValue the default value
|
|
13
7
|
* @param {"local" | "session"} storage the type of storage where to persist the state
|
|
8
|
+
* @returns {[T | undefined, function (T)]} the current value (undefined until localStorage has been checked + a function to update the value)
|
|
14
9
|
*/
|
|
15
10
|
function usePersistedState(name, defaultValue, storage = 'local') {
|
|
16
|
-
const [value, setValue] =
|
|
17
|
-
|
|
18
|
-
(0, react_1.useEffect)(() => {
|
|
11
|
+
const [value, setValue] = useState(undefined);
|
|
12
|
+
useEffect(() => {
|
|
19
13
|
try {
|
|
20
14
|
if (storage === 'local') {
|
|
21
15
|
const localValueString = window.localStorage.getItem(name);
|
|
@@ -23,6 +17,9 @@ function usePersistedState(name, defaultValue, storage = 'local') {
|
|
|
23
17
|
const localValue = JSON.parse(localValueString);
|
|
24
18
|
setValue(localValue);
|
|
25
19
|
}
|
|
20
|
+
else {
|
|
21
|
+
setValue(defaultValue);
|
|
22
|
+
}
|
|
26
23
|
}
|
|
27
24
|
else {
|
|
28
25
|
const localValueString = window.sessionStorage.getItem(name);
|
|
@@ -30,6 +27,9 @@ function usePersistedState(name, defaultValue, storage = 'local') {
|
|
|
30
27
|
const localValue = JSON.parse(localValueString);
|
|
31
28
|
setValue(localValue);
|
|
32
29
|
}
|
|
30
|
+
else {
|
|
31
|
+
setValue(defaultValue);
|
|
32
|
+
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
catch (err) {
|
|
@@ -40,21 +40,19 @@ function usePersistedState(name, defaultValue, storage = 'local') {
|
|
|
40
40
|
else {
|
|
41
41
|
window.sessionStorage.removeItem(name);
|
|
42
42
|
}
|
|
43
|
+
setValue(defaultValue);
|
|
43
44
|
}
|
|
44
45
|
}, [name, setValue]);
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
firstRender.current = false;
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
46
|
+
const setAndPersistValue = (newValue) => {
|
|
47
|
+
setValue(newValue);
|
|
50
48
|
try {
|
|
51
49
|
if (storage === 'local') {
|
|
52
|
-
window.localStorage.setItem(name, JSON.stringify(
|
|
50
|
+
window.localStorage.setItem(name, JSON.stringify(newValue, (_k, v) => {
|
|
53
51
|
return v === undefined ? null : v;
|
|
54
52
|
}));
|
|
55
53
|
}
|
|
56
54
|
else {
|
|
57
|
-
window.sessionStorage.setItem(name, JSON.stringify(
|
|
55
|
+
window.sessionStorage.setItem(name, JSON.stringify(newValue, (_k, v) => {
|
|
58
56
|
return v === undefined ? null : v;
|
|
59
57
|
}));
|
|
60
58
|
}
|
|
@@ -62,7 +60,7 @@ function usePersistedState(name, defaultValue, storage = 'local') {
|
|
|
62
60
|
catch (err) {
|
|
63
61
|
console.error(err);
|
|
64
62
|
}
|
|
65
|
-
}
|
|
66
|
-
return [value,
|
|
63
|
+
};
|
|
64
|
+
return [value, setAndPersistValue];
|
|
67
65
|
}
|
|
68
|
-
|
|
66
|
+
export default usePersistedState;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
1
2
|
export interface UserInfo {
|
|
2
3
|
/**
|
|
3
4
|
* The email address of the user.
|
|
@@ -12,5 +13,5 @@ export interface UserInfo {
|
|
|
12
13
|
*/
|
|
13
14
|
preferredUsername: string;
|
|
14
15
|
}
|
|
15
|
-
export declare const useUserInfo: () =>
|
|
16
|
+
export declare const useUserInfo: () => UseQueryResult<UserInfo, Error>;
|
|
16
17
|
//# sourceMappingURL=useUserInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUserInfo.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useUserInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAY,MAAM,uBAAuB,CAAC;AAEjE,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAqBD,eAAO,MAAM,WAAW,QAAO,eAAe,QAAQ,EAAE,KAAK,CAKzD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
const getUserInfo = async () => {
|
|
4
|
+
const fetch = axios
|
|
5
|
+
.get('/oauth2/userinfo')
|
|
6
|
+
.then((result) => {
|
|
7
|
+
console.log('User Info', result.data);
|
|
8
|
+
return result.data;
|
|
9
|
+
})
|
|
10
|
+
.catch((err) => {
|
|
11
|
+
console.error('Could not get user info');
|
|
12
|
+
console.error(err);
|
|
13
|
+
return {
|
|
14
|
+
email: '',
|
|
15
|
+
user: 'anonymous',
|
|
16
|
+
preferredUsername: 'anonymous',
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
return await fetch;
|
|
20
|
+
};
|
|
21
|
+
export const useUserInfo = () => useQuery({
|
|
22
|
+
queryKey: ['user-info'],
|
|
23
|
+
queryFn: () => getUserInfo(),
|
|
24
|
+
staleTime: Infinity,
|
|
25
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { camelToSnake, colorToRgb, commonStart, dateDiff, getTextColor, getTimeStr, hexToRgb, interpolate, isValidDate, stringToColor, toLocalStandardDateString, toTitleCase, } from './helpers';
|
|
2
|
+
export { useAPI, useLocale, usePathname, usePersistedState, useUserInfo, } from './hooks';
|
|
3
|
+
export type { UserInfo } from './hooks';
|
|
4
|
+
export { createI18nMiddleware } from './middleware/createI18nMiddleware';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,aAAa,EACb,yBAAyB,EACzB,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,MAAM,EACN,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { camelToSnake, colorToRgb, commonStart, dateDiff, getTextColor, getTimeStr, hexToRgb, interpolate, isValidDate, stringToColor, toLocalStandardDateString, toTitleCase, } from './helpers';
|
|
2
|
+
export { useAPI, useLocale, usePathname, usePersistedState, useUserInfo, } from './hooks';
|
|
3
|
+
export { createI18nMiddleware } from './middleware/createI18nMiddleware';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { Locale } from '../../types';
|
|
3
|
+
export declare const cookieName = "ROSSINI_LANG";
|
|
4
|
+
export declare const createI18nMiddleware: ({ locales, defaultLocale }: {
|
|
5
|
+
locales: Locale[];
|
|
6
|
+
defaultLocale: Locale;
|
|
7
|
+
}) => (request: NextRequest) => NextResponse<unknown>;
|
|
8
|
+
//# sourceMappingURL=createI18nMiddleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createI18nMiddleware.d.ts","sourceRoot":"","sources":["../../../src/utils/middleware/createI18nMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,eAAO,MAAM,UAAU,iBAAiB,CAAC;AAqBzC,eAAO,MAAM,oBAAoB;aACS,MAAM,EAAE;mBAAiB,MAAM;gBAC7D,WAAW,0BAiCpB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { match as matchLocale } from '@formatjs/intl-localematcher';
|
|
2
|
+
import Negotiator from 'negotiator';
|
|
3
|
+
import { NextResponse } from 'next/server';
|
|
4
|
+
export const cookieName = 'ROSSINI_LANG';
|
|
5
|
+
const getLocale = (request, locales, defaultLocale) => {
|
|
6
|
+
// Negotiator expects plain object so we need to transform headers
|
|
7
|
+
const negotiatorHeaders = {};
|
|
8
|
+
request.headers.forEach((value, key) => (negotiatorHeaders[key] = value));
|
|
9
|
+
// Use negotiator and intl-localematcher to get best locale
|
|
10
|
+
const languages = new Negotiator({ headers: negotiatorHeaders }).languages(locales);
|
|
11
|
+
const locale = matchLocale(languages, locales, defaultLocale);
|
|
12
|
+
return locale;
|
|
13
|
+
};
|
|
14
|
+
export const createI18nMiddleware = ({ locales, defaultLocale }) => (request) => {
|
|
15
|
+
const pathname = request.nextUrl.pathname;
|
|
16
|
+
// Check if there is any supported locale in the pathname
|
|
17
|
+
const pathnameIsMissingLocale = locales.every((locale) => !pathname.startsWith(`/${locale}/`) && pathname !== `/${locale}`);
|
|
18
|
+
// Redirect if there is no locale
|
|
19
|
+
if (pathnameIsMissingLocale) {
|
|
20
|
+
let requestedLocale;
|
|
21
|
+
if (request.cookies.has(cookieName)) {
|
|
22
|
+
requestedLocale = request.cookies.get(cookieName)?.value;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
requestedLocale = getLocale(request, locales, defaultLocale);
|
|
26
|
+
}
|
|
27
|
+
const locale = locales.find((l) => l === requestedLocale) || defaultLocale;
|
|
28
|
+
// e.g. incoming request is /products
|
|
29
|
+
// The new URL is now /en/products
|
|
30
|
+
const response = NextResponse.redirect(new URL(`/${locale}${pathname.startsWith('/') ? '' : '/'}${pathname}`, request.url));
|
|
31
|
+
response.cookies.set(cookieName, locale);
|
|
32
|
+
return response;
|
|
33
|
+
}
|
|
34
|
+
return NextResponse.next();
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiAccordion.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/MuiAccordion.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,wBAmBE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiCard.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/MuiCard.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,wBASE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiCardHeader.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/MuiCardHeader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,wBAcE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiFormControl.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/MuiFormControl.ts"],"names":[],"mappings":";;;;;;AAAA,wBAKE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiGrid.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/MuiGrid.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiPaper.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/MuiPaper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,wBAeE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MuiTypography.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/MuiTypography.ts"],"names":[],"mappings":";;;;;AAAA,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/theme/components/index.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQf,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import MuiAccordion from './MuiAccordion';
|
|
2
|
+
import MuiCard from './MuiCard';
|
|
3
|
+
import MuiCardHeader from './MuiCardHeader';
|
|
4
|
+
import MuiFormControl from './MuiFormControl';
|
|
5
|
+
import MuiGrid from './MuiGrid';
|
|
6
|
+
import MuiPaper from './MuiPaper';
|
|
7
|
+
import MuiTypography from './MuiTypography';
|
|
8
|
+
const components = {
|
|
9
|
+
MuiAccordion,
|
|
10
|
+
MuiCard,
|
|
11
|
+
MuiCardHeader,
|
|
12
|
+
MuiFormControl,
|
|
13
|
+
MuiGrid,
|
|
14
|
+
MuiPaper,
|
|
15
|
+
MuiTypography,
|
|
16
|
+
};
|
|
17
|
+
export default components;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAe,KAAK,EAAgB,MAAM,sBAAsB,CAAC;AAIxE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAmB,YAAY,EAAE,MAAM,WAAW,CAAC;AAe1D,eAAO,MAAM,aAAa,SAClB,YAAY,UACV,MAAM,iBACC,cAAc,gBACf,cAAc,KAC3B,KAWF,CAAC;AAEF,eAAO,MAAM,YAAY,2CA8BxB,CAAC"}
|