@redocly/theme 0.30.8 → 0.30.9

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.
@@ -32,6 +32,7 @@ const styled_components_1 = __importDefault(require("styled-components"));
32
32
  const timeago_js_1 = require("timeago.js");
33
33
  const useThemeConfig_1 = require("../../hooks/useThemeConfig");
34
34
  const hooks_1 = require("../../mocks/hooks");
35
+ const constants_1 = require("../../types/portal/src/shared/constants");
35
36
  const FORMATS = {
36
37
  timeago: (date, locale) => (0, timeago_js_1.format)(date, locale),
37
38
  iso: (date) => date.toISOString().split('T')[0],
@@ -47,7 +48,9 @@ function LastUpdated(props) {
47
48
  }
48
49
  const lastModified = props.lastModified;
49
50
  const format = props.format || lastUpdatedBlock.format || 'timeago';
50
- const locale = props.locale || lastUpdatedBlock.locale || currentLocale || 'en-US';
51
+ const locale = props.locale ||
52
+ lastUpdatedBlock.locale ||
53
+ (currentLocale !== constants_1.DEFAULT_LOCALE_PLACEHOLDER ? currentLocale || 'en-US' : 'en-US');
51
54
  const isoDate = lastModified.toISOString().split('T')[0];
52
55
  const lastUpdatedString = FORMATS[format](lastModified, locale);
53
56
  const translationKey = format === 'timeago' ? 'theme.page.lastUpdated.timeago' : 'theme.page.lastUpdated.on';
@@ -1,6 +1,7 @@
1
1
  export declare const DEFAULT_THEME_NAME = "@redocly/theme";
2
2
  export declare const USER_THEME_ALIAS = "@theme";
3
3
  export declare const REDOCLY_TEAMS_RBAC = "redocly::teams-rbac";
4
+ export declare const DEFAULT_LOCALE_PLACEHOLDER = "default_locale";
4
5
  export type REQUIRED_OIDC_SCOPES = string[];
5
6
  export type DEFAULT_COOKIE_EXPIRATION = number;
6
7
  export declare enum FEEDBACK_TYPES {
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FsErrors = exports.ExternalRoutes = exports.DEV_LOGIN_SLUG = exports.FEEDBACK_TYPES = exports.REDOCLY_TEAMS_RBAC = exports.USER_THEME_ALIAS = exports.DEFAULT_THEME_NAME = void 0;
3
+ exports.FsErrors = exports.ExternalRoutes = exports.DEV_LOGIN_SLUG = exports.FEEDBACK_TYPES = exports.DEFAULT_LOCALE_PLACEHOLDER = exports.REDOCLY_TEAMS_RBAC = exports.USER_THEME_ALIAS = exports.DEFAULT_THEME_NAME = void 0;
4
4
  exports.DEFAULT_THEME_NAME = '@redocly/theme';
5
5
  exports.USER_THEME_ALIAS = '@theme';
6
6
  exports.REDOCLY_TEAMS_RBAC = 'redocly::teams-rbac';
7
+ exports.DEFAULT_LOCALE_PLACEHOLDER = 'default_locale';
7
8
  var FEEDBACK_TYPES;
8
9
  (function (FEEDBACK_TYPES) {
9
10
  FEEDBACK_TYPES["RATING"] = "rating";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redocly/theme",
3
- "version": "0.30.8",
3
+ "version": "0.30.9",
4
4
  "description": "Shared UI components lib",
5
5
  "keywords": [
6
6
  "theme",
@@ -5,6 +5,8 @@ import { format } from 'timeago.js';
5
5
  import { useThemeConfig } from '@theme/hooks/useThemeConfig';
6
6
  import { useI18nConfig, useTranslate } from '@portal/hooks';
7
7
 
8
+ import { DEFAULT_LOCALE_PLACEHOLDER } from '../../types/portal/src/shared/constants';
9
+
8
10
  const FORMATS = {
9
11
  timeago: (date: Date, locale: string) => format(date, locale),
10
12
  iso: (date: Date) => date.toISOString().split('T')[0],
@@ -32,7 +34,10 @@ export function LastUpdated(props: LastUpdatedProps): JSX.Element | null {
32
34
 
33
35
  const lastModified = props.lastModified;
34
36
  const format = props.format || lastUpdatedBlock.format || 'timeago';
35
- const locale = props.locale || lastUpdatedBlock.locale || currentLocale || 'en-US';
37
+ const locale =
38
+ props.locale ||
39
+ lastUpdatedBlock.locale ||
40
+ (currentLocale !== DEFAULT_LOCALE_PLACEHOLDER ? currentLocale || 'en-US' : 'en-US');
36
41
 
37
42
  const isoDate = lastModified.toISOString().split('T')[0];
38
43
 
@@ -1,6 +1,7 @@
1
1
  export const DEFAULT_THEME_NAME = '@redocly/theme';
2
2
  export const USER_THEME_ALIAS = '@theme';
3
3
  export const REDOCLY_TEAMS_RBAC = 'redocly::teams-rbac';
4
+ export const DEFAULT_LOCALE_PLACEHOLDER = 'default_locale'
4
5
  export type REQUIRED_OIDC_SCOPES = string[];
5
6
  export type DEFAULT_COOKIE_EXPIRATION = number;
6
7
  export enum FEEDBACK_TYPES {