@redocly/theme 0.25.1-beta.4 → 0.25.2

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 (92) hide show
  1. package/lib/components/Catalog/Catalog.js +1 -4
  2. package/lib/components/Catalog/useCatalog.js +3 -4
  3. package/lib/components/CodeBlock/CodeBlockControls.js +1 -1
  4. package/lib/components/CopyButton/CopyButton.js +2 -7
  5. package/lib/components/EditPageButton/EditPageButton.js +1 -4
  6. package/lib/components/Feedback/Comment.js +4 -10
  7. package/lib/components/Feedback/Feedback.js +1 -1
  8. package/lib/components/Feedback/Mood.js +15 -18
  9. package/lib/components/Feedback/Rating.js +12 -12
  10. package/lib/components/Feedback/Reasons.js +4 -9
  11. package/lib/components/Feedback/ReportDialog.js +16 -3
  12. package/lib/components/Feedback/Sentiment.js +13 -15
  13. package/lib/components/Feedback/Thumbs.js +2 -8
  14. package/lib/components/Feedback/types.d.ts +1 -1
  15. package/lib/components/Feedback/useReportDialog.js +6 -8
  16. package/lib/components/Filter/Filter.js +6 -6
  17. package/lib/components/Filter/FilterContent.js +2 -6
  18. package/lib/components/Filter/FilterPopover.js +2 -6
  19. package/lib/components/Footer/FooterCopyright.js +2 -5
  20. package/lib/components/LastUpdated/LastUpdated.js +1 -1
  21. package/lib/components/Menu/hooks/use-mobile-menu-items.js +1 -4
  22. package/lib/components/Menu/hooks/use-mobile-menu-levels.js +2 -6
  23. package/lib/components/Menu/utils.d.ts +2 -1
  24. package/lib/components/Profile/LoginLink.js +2 -5
  25. package/lib/components/Profile/MobileUserProfile.js +1 -4
  26. package/lib/components/Profile/UserProfile.js +3 -7
  27. package/lib/components/Scorecard/Card.d.ts +1 -3
  28. package/lib/components/Scorecard/Card.js +2 -4
  29. package/lib/components/Scorecard/Gauge.d.ts +2 -5
  30. package/lib/components/Scorecard/Gauge.js +2 -6
  31. package/lib/components/Scorecard/StatusByLevelWidget.d.ts +0 -1
  32. package/lib/components/Scorecard/StatusByLevelWidget.js +2 -5
  33. package/lib/components/Search/CancelSearch.js +1 -4
  34. package/lib/components/Search/RecentSearches.js +1 -4
  35. package/lib/components/Search/SearchDialog.js +4 -10
  36. package/lib/components/Search/SearchTrigger.js +1 -4
  37. package/lib/components/Search/SuggestedPages.js +1 -4
  38. package/lib/components/Sidebar/DrilldownMenu.js +2 -5
  39. package/lib/components/Sidebar/VersionPicker.js +2 -6
  40. package/lib/components/TableOfContent/TableOfContent.js +1 -4
  41. package/lib/config.d.ts +0 -6
  42. package/lib/config.js +0 -1
  43. package/lib/layouts/Forbidden.js +2 -6
  44. package/lib/layouts/NotFound.js +2 -6
  45. package/lib/layouts/OIDCForbidden.js +1 -4
  46. package/lib/mocks/hooks/index.d.ts +3 -2
  47. package/lib/mocks/hooks/index.js +3 -4
  48. package/lib/types/portal/src/shared/types/feedback.d.ts +1 -0
  49. package/package.json +2 -2
  50. package/src/components/Catalog/Catalog.tsx +1 -4
  51. package/src/components/Catalog/useCatalog.ts +3 -6
  52. package/src/components/CodeBlock/CodeBlockControls.tsx +0 -1
  53. package/src/components/CopyButton/CopyButton.tsx +3 -8
  54. package/src/components/EditPageButton/EditPageButton.tsx +2 -5
  55. package/src/components/Feedback/Comment.tsx +14 -14
  56. package/src/components/Feedback/Feedback.tsx +2 -2
  57. package/src/components/Feedback/Mood.tsx +25 -20
  58. package/src/components/Feedback/Rating.tsx +15 -14
  59. package/src/components/Feedback/Reasons.tsx +6 -11
  60. package/src/components/Feedback/ReportDialog.tsx +6 -2
  61. package/src/components/Feedback/Sentiment.tsx +15 -17
  62. package/src/components/Feedback/Thumbs.tsx +2 -9
  63. package/src/components/Feedback/types.ts +1 -1
  64. package/src/components/Feedback/useReportDialog.ts +6 -8
  65. package/src/components/Filter/Filter.tsx +9 -6
  66. package/src/components/Filter/FilterContent.tsx +2 -6
  67. package/src/components/Filter/FilterPopover.tsx +2 -6
  68. package/src/components/Footer/FooterCopyright.tsx +2 -5
  69. package/src/components/LastUpdated/LastUpdated.tsx +1 -1
  70. package/src/components/Menu/hooks/use-mobile-menu-items.ts +1 -5
  71. package/src/components/Menu/hooks/use-mobile-menu-levels.ts +2 -7
  72. package/src/components/Menu/utils.ts +2 -1
  73. package/src/components/Profile/LoginLink.tsx +2 -5
  74. package/src/components/Profile/MobileUserProfile.tsx +1 -4
  75. package/src/components/Profile/UserProfile.tsx +5 -8
  76. package/src/components/Scorecard/Card.tsx +2 -4
  77. package/src/components/Scorecard/Gauge.tsx +7 -16
  78. package/src/components/Scorecard/StatusByLevelWidget.tsx +2 -6
  79. package/src/components/Search/CancelSearch.tsx +2 -5
  80. package/src/components/Search/RecentSearches.tsx +2 -5
  81. package/src/components/Search/SearchDialog.tsx +8 -15
  82. package/src/components/Search/SearchTrigger.tsx +3 -5
  83. package/src/components/Search/SuggestedPages.tsx +2 -6
  84. package/src/components/Sidebar/DrilldownMenu.tsx +2 -5
  85. package/src/components/Sidebar/VersionPicker.tsx +3 -7
  86. package/src/components/TableOfContent/TableOfContent.tsx +2 -5
  87. package/src/config.ts +0 -1
  88. package/src/layouts/Forbidden.tsx +4 -13
  89. package/src/layouts/NotFound.tsx +4 -13
  90. package/src/layouts/OIDCForbidden.tsx +2 -6
  91. package/src/mocks/hooks/index.ts +7 -6
  92. package/src/types/portal/src/shared/types/feedback.ts +1 -0
@@ -21,15 +21,12 @@ function Catalog(props) {
21
21
  const items = (0, index_1.usePageSharedData)('catalog');
22
22
  const { filterTerm, setFilterTerm, groups, filters } = (0, Catalog_1.useCatalog)(items, catalogConfig);
23
23
  const [isAddingFilter, setIsAddingFilter] = react_1.default.useState(false);
24
- const translationKeys = {
25
- addFilter: 'theme.catalog.filters.select.addFilter',
26
- };
27
24
  const { translate } = (0, index_1.useTranslate)();
28
25
  (0, useModalScrollLock_1.default)(isAddingFilter);
29
26
  return (react_1.default.createElement(Highlight_1.HighlightContext.Provider, { value: [filterTerm] },
30
27
  react_1.default.createElement(exports.CatalogPageWrapper, { withoutFilters: !filters.length },
31
28
  !!filters.length && (react_1.default.createElement(FilterTagsWrapper, null,
32
- react_1.default.createElement(Button_1.Button, { variant: "text", size: "small", icon: react_1.default.createElement(PlusIcon_1.PlusIcon, null), onClick: () => setIsAddingFilter(true) }, translate(translationKeys.addFilter, 'Add filter')),
29
+ react_1.default.createElement(Button_1.Button, { variant: "text", size: "small", icon: react_1.default.createElement(PlusIcon_1.PlusIcon, null), onClick: () => setIsAddingFilter(true) }, translate('theme.catalog.filters.select.addFilter', 'Add filter')),
33
30
  react_1.default.createElement(FilterTags_1.FilterTags, { filters: filters }))),
34
31
  react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, isMobile: false, filterValuesCasing: catalogConfig.filterValuesCasing }),
35
32
  isAddingFilter && (react_1.default.createElement(FilterPopover_1.FilterPopover, { setIsAddingFilter: setIsAddingFilter, filters: filters, filterValuesCasing: catalogConfig.filterValuesCasing })),
@@ -256,10 +256,9 @@ function collectFilterOptions(items, filters) {
256
256
  }
257
257
  }
258
258
  }
259
- const options = Object.entries(usedOptions).map(([value, count]) => ({ value, count }));
260
- if (!staticOptions) {
261
- options.sort((a, b) => b.value.localeCompare(a.value));
262
- }
259
+ const options = Object.entries(usedOptions)
260
+ .map(([value, count]) => ({ value, count }))
261
+ .sort((a, b) => b.value.localeCompare(a.value));
263
262
  if (othersCount) {
264
263
  options.push({
265
264
  value: filter.missingCategoryNameTranslationKey || filter.missingCategoryName || 'Others',
@@ -29,7 +29,7 @@ function CodeBlockControls({ children, className, title, controls, }) {
29
29
  collapse && !((_c = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.collapse) === null || _c === void 0 ? void 0 : _c.hide) ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { "data-cy": "collapse-all", "data-testid": "collapse-all", asIcon: controlsType === 'icon', onClick: collapse === null || collapse === void 0 ? void 0 : collapse.onClick, title: (collapse === null || collapse === void 0 ? void 0 : collapse.tooltipText) || 'Collapse all' }, controlsType === 'icon' ? (react_1.default.createElement(icons_1.CollapseIcon, null)) : (collapse === null || collapse === void 0 ? void 0 : collapse.label) ? (collapse.label) : ('Collapse all'))) : null,
30
30
  select ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { "data-cy": "select-all", "data-testid": "select-all", asIcon: controlsType === 'icon', onClick: select === null || select === void 0 ? void 0 : select.onClick, title: select === null || select === void 0 ? void 0 : select.tooltipText }, controlsType === 'icon' ? react_1.default.createElement(icons_1.SelectIcon, null) : (select === null || select === void 0 ? void 0 : select.label) ? select.label : 'Select all')) : null,
31
31
  deselect ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { "data-cy": "clear-all", "data-testid": "clear-all", asIcon: controlsType === 'icon', onClick: deselect === null || deselect === void 0 ? void 0 : deselect.onClick, title: deselect === null || deselect === void 0 ? void 0 : deselect.tooltipText }, controlsType === 'icon' ? (react_1.default.createElement(icons_1.DeselectIcon, null)) : (deselect === null || deselect === void 0 ? void 0 : deselect.label) ? (deselect.label) : ('Clear all'))) : null,
32
- report && ((_d = report === null || report === void 0 ? void 0 : report.props) === null || _d === void 0 ? void 0 : _d.visible) ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, Object.assign({ "data-cy": "report-button", "data-testid": "report-button", asIcon: controlsType === 'icon', title: report.tooltipText }, report.props, { onClick: () => telemetry_1.telemetry.send('code_snippet_reported', {}) }), controlsType === 'icon' ? react_1.default.createElement(icons_1.ReportIcon, null) : ((_e = report.props) === null || _e === void 0 ? void 0 : _e.buttonText) || 'Report')) : null))) : null;
32
+ report && ((_d = report === null || report === void 0 ? void 0 : report.props) === null || _d === void 0 ? void 0 : _d.visible) ? (react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, Object.assign({ "data-cy": "report-button", "data-testid": "report-button", asIcon: controlsType === 'icon', title: report.tooltipText }, report.props), controlsType === 'icon' ? react_1.default.createElement(icons_1.ReportIcon, null) : ((_e = report.props) === null || _e === void 0 ? void 0 : _e.buttonText) || 'Report')) : null))) : null;
33
33
  return children || controls ? (react_1.default.createElement(ContainerWraper, { "data-component-name": "CodeBlock/CodeBlockControls", className: className }, children ? children : defaultControls)) : null;
34
34
  }
35
35
  exports.CodeBlockControls = CodeBlockControls;
@@ -34,11 +34,6 @@ const hooks_2 = require("../../mocks/hooks");
34
34
  function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', toasterText, toasterDuration, buttonText, tooltipText, onCopyClick, dataTestId = 'copy-button', }) {
35
35
  const tooltip = (0, hooks_1.useControl)();
36
36
  const { translate } = (0, hooks_2.useTranslate)();
37
- const translationKeys = {
38
- buttonText: 'theme.codeSnippet.copy.buttonText',
39
- tooltipText: 'theme.codeSnippet.copy.tooltipText',
40
- toasterText: 'theme.codeSnippet.copy.toasterText',
41
- };
42
37
  const showTooltip = (duration = 1500) => {
43
38
  tooltip.handleOpen();
44
39
  setTimeout(() => {
@@ -51,8 +46,8 @@ function CopyButtonComponent({ data, type = 'icon', toasterPlacement = 'top', to
51
46
  showTooltip(duration);
52
47
  onCopyClick === null || onCopyClick === void 0 ? void 0 : onCopyClick();
53
48
  };
54
- return (react_1.default.createElement(Tooltip_1.Tooltip, { className: "copy-button", tip: translate(translationKeys.toasterText, toasterText || 'Copied!'), isOpen: tooltip.isOpened, placement: toasterPlacement },
55
- react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { onClick: () => copy(toasterDuration), "data-cy": dataTestId, asIcon: type === 'icon', title: translate(translationKeys.tooltipText, tooltipText || 'Copy to clipboard'), "data-testid": dataTestId }, type === 'icon' ? (react_1.default.createElement(icons_1.CopyIcon, null)) : (translate(translationKeys.buttonText, buttonText || 'Copy')))));
49
+ return (react_1.default.createElement(Tooltip_1.Tooltip, { className: "copy-button", tip: translate('theme.codeSnippet.copy.buttonText', toasterText || 'Copied!'), isOpen: tooltip.isOpened, placement: toasterPlacement },
50
+ react_1.default.createElement(CodeBlock_1.CodeBlockControlButton, { onClick: () => copy(toasterDuration), "data-cy": dataTestId, asIcon: type === 'icon', title: translate('theme.codeSnippet.copy.tooltipText', tooltipText || 'Copy to clipboard'), "data-testid": dataTestId }, type === 'icon' ? (react_1.default.createElement(icons_1.CopyIcon, null)) : (translate('theme.codeSnippet.copy.toasterText', buttonText || 'Copy')))));
56
51
  }
57
52
  exports.CopyButton = (0, react_1.memo)(CopyButtonComponent);
58
53
  //# sourceMappingURL=CopyButton.js.map
@@ -12,12 +12,9 @@ const icons_1 = require("../../icons");
12
12
  const hooks_1 = require("../../mocks/hooks");
13
13
  const EditPageButton = ({ to }) => {
14
14
  const { translate } = (0, hooks_1.useTranslate)();
15
- const translationKeys = {
16
- text: 'theme.markdown.editPage.text',
17
- };
18
15
  return (react_1.default.createElement(EditButton, { "data-component-name": "EditPageButton/EditPageButton", to: to, onClick: () => telemetry_1.telemetry.send('edit_page_link_clicked', {}) },
19
16
  react_1.default.createElement(ButtonIcon, null),
20
- react_1.default.createElement(ButtonText, { "data-translation-key": translationKeys.text }, translate(translationKeys.text, 'Edit'))));
17
+ react_1.default.createElement(ButtonText, { "data-translation-key": "theme.markdown.editPage.text" }, translate('theme.markdown.editPage.text', 'Edit'))));
21
18
  };
22
19
  exports.EditPageButton = EditPageButton;
23
20
  const EditButton = (0, styled_components_1.default)(Link_1.Link) `
@@ -36,12 +36,6 @@ const Comment = ({ settings, onSubmit, onCancel, className }) => {
36
36
  const [text, setText] = React.useState('');
37
37
  const [submitValue, setSubmitValue] = React.useState('');
38
38
  const { translate } = (0, hooks_1.useTranslate)();
39
- const translationKeys = {
40
- submitText: 'theme.feedback.settings.comment.submitText',
41
- label: 'theme.feedback.settings.comment.label',
42
- send: 'theme.feedback.settings.comment.send',
43
- cancel: 'theme.feedback.settings.comment.cancel',
44
- };
45
39
  const send = () => {
46
40
  if (!text)
47
41
  return;
@@ -53,14 +47,14 @@ const Comment = ({ settings, onSubmit, onCancel, className }) => {
53
47
  };
54
48
  if (submitValue) {
55
49
  return (React.createElement(Wrapper, { className: className },
56
- React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
50
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.comment.submitText" }, translate('theme.feedback.settings.comment.submitText', submitText || 'Thank you for helping improve our documentation!'))));
57
51
  }
58
52
  return (React.createElement(Wrapper, { "data-component-name": "Feedback/Comment", className: className },
59
- React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'Please share your feedback with us.')),
53
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.comment.label" }, translate('theme.feedback.settings.comment.label', label || 'Please share your feedback with us.')),
60
54
  React.createElement(TextArea, { rows: 3, onChange: handleTextAreaChange }),
61
55
  React.createElement(ButtonsContainer, null,
62
- React.createElement(SendButton, { "data-translation-key": translationKeys.send, onClick: send }, translate(translationKeys.send, 'Send')),
63
- onCancel && (React.createElement(CancelButton, { "data-translation-key": translationKeys.cancel, onClick: onCancel }, translate(translationKeys.cancel, 'Cancel'))))));
56
+ React.createElement(SendButton, { "data-translation-key": "theme.feedback.settings.comment.send", onClick: send }, translate('theme.feedback.settings.comment.send', 'Send')),
57
+ onCancel && (React.createElement(CancelButton, { "data-translation-key": "theme.feedback.settings.comment.cancel", onClick: onCancel }, translate('theme.feedback.settings.comment.cancel', 'Cancel'))))));
64
58
  };
65
59
  exports.Comment = Comment;
66
60
  const Wrapper = styled_components_1.default.div `
@@ -40,6 +40,7 @@ const Feedback = (props) => {
40
40
  const { feedback: themeFeedbackConf } = (0, hooks_1.useThemeConfig)();
41
41
  const feedbackConf = Object.assign(Object.assign({}, themeFeedbackConf), props);
42
42
  const renderFeedbackComponent = () => {
43
+ const { type, settings, path } = feedbackConf;
43
44
  switch (type) {
44
45
  case 'rating':
45
46
  return (React.createElement(Wrapper, null,
@@ -70,7 +71,6 @@ const Feedback = (props) => {
70
71
  break;
71
72
  }
72
73
  };
73
- const { type, settings, path } = feedbackConf;
74
74
  return React.createElement(React.Fragment, { key: pathname }, renderFeedbackComponent());
75
75
  };
76
76
  exports.Feedback = Feedback;
@@ -41,16 +41,10 @@ var MOOD_STATES;
41
41
  const Mood = ({ settings, onSubmit, className }) => {
42
42
  const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
43
43
  const [score, setScore] = React.useState('');
44
+ const [isSubmitted, setIsSubmitted] = React.useState(false);
44
45
  const [comment, setComment] = React.useState('');
45
46
  const [reasons, setReasons] = React.useState([]);
46
47
  const { translate } = (0, hooks_1.useTranslate)();
47
- const translationKeys = {
48
- submitText: 'theme.feedback.settings.submitText',
49
- label: 'theme.feedback.settings.label',
50
- satisfiedLabel: 'theme.feedback.settings.comment.satisfiedLabel',
51
- neutralLabel: 'theme.feedback.settings.comment.neutralLabel',
52
- dissatisfiedLabel: 'theme.feedback.settings.comment.dissatisfiedLabel',
53
- };
54
48
  if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
55
49
  const { label: reasonsLabel, items, multi } = reasonsSettings;
56
50
  const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
@@ -60,28 +54,31 @@ const Mood = ({ settings, onSubmit, className }) => {
60
54
  const renderCommentLabel = (score) => {
61
55
  switch (score) {
62
56
  case MOOD_STATES.SATISFIED:
63
- return translate(translationKeys.satisfiedLabel, commentSettings.satisfiedLabel || 'What was most helpful?');
57
+ return translate('theme.feedback.settings.comment.satisfiedLabel', commentSettings.satisfiedLabel || 'What was most helpful?');
64
58
  case MOOD_STATES.NEUTRAL:
65
- return translate(translationKeys.neutralLabel, commentSettings.neutralLabel || 'What can we improve?');
59
+ return translate('theme.feedback.settings.comment.neutralLabel', commentSettings.neutralLabel || 'What can we improve?');
66
60
  case MOOD_STATES.DISSATISFIED:
67
- return translate(translationKeys.dissatisfiedLabel, commentSettings.dissatisfiedLabel || 'What can we improve?');
61
+ return translate('theme.feedback.settings.comment.dissatisfiedLabel', commentSettings.dissatisfiedLabel || 'What can we improve?');
68
62
  default:
69
- return translate(translationKeys.satisfiedLabel, 'What can we improve?');
63
+ return translate('theme.feedback.settings.comment.satisfiedLabel', 'What can we improve?');
70
64
  }
71
65
  };
72
66
  return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: renderCommentLabel(score) } }));
73
67
  }
74
68
  if (score) {
75
- onSubmit({
76
- score,
77
- comment,
78
- reasons,
79
- });
69
+ if (!isSubmitted) {
70
+ onSubmit({
71
+ score,
72
+ comment,
73
+ reasons,
74
+ });
75
+ setIsSubmitted(true);
76
+ }
80
77
  return (React.createElement(Wrapper, null,
81
- React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for your feedback!'))));
78
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.submitText" }, translate('theme.feedback.settings.submitText', submitText || 'Thank you for your feedback!'))));
82
79
  }
83
80
  return (React.createElement(Wrapper, { "data-component-name": "Feedback/Mood", className: className },
84
- React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'Was this page helpful?')),
81
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.label" }, translate('theme.feedback.settings.label', label || 'Was this page helpful?')),
85
82
  React.createElement(Vote, { onClick: () => {
86
83
  setScore(MOOD_STATES.DISSATISFIED);
87
84
  } },
@@ -33,14 +33,11 @@ const Feedback_1 = require("../../components/Feedback");
33
33
  const hooks_1 = require("../../mocks/hooks");
34
34
  const Rating = ({ settings, onSubmit, className }) => {
35
35
  const { label, max, submitText, comment: commentSettings, reasons: reasonsSettings, } = settings || {};
36
+ const [isSubmitted, setIsSubmitted] = React.useState(false);
36
37
  const [score, setScore] = React.useState(0);
37
38
  const [comment, setComment] = React.useState('');
38
39
  const [reasons, setReasons] = React.useState([]);
39
40
  const { translate } = (0, hooks_1.useTranslate)();
40
- const translationKeys = {
41
- submitText: 'theme.feedback.settings.submitText',
42
- label: 'theme.feedback.settings.label',
43
- };
44
41
  const maxRating = max || 5;
45
42
  if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
46
43
  const { label: reasonsLabel, items, multi } = reasonsSettings;
@@ -51,17 +48,20 @@ const Rating = ({ settings, onSubmit, className }) => {
51
48
  return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: commentSettings.label } }));
52
49
  }
53
50
  if (score) {
54
- onSubmit({
55
- score,
56
- comment,
57
- reasons,
58
- max: maxRating,
59
- });
51
+ if (!isSubmitted) {
52
+ onSubmit({
53
+ score,
54
+ comment,
55
+ reasons,
56
+ max: maxRating,
57
+ });
58
+ setIsSubmitted(true);
59
+ }
60
60
  return (React.createElement(Wrapper, null,
61
- React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
61
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.submitText" }, translate('theme.feedback.settings.submitText', submitText || 'Thank you for helping improve our documentation!'))));
62
62
  }
63
63
  return (React.createElement(Wrapper, { "data-component-name": "Feedback/Rating", className: className },
64
- React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'How helpful was this page?')),
64
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.label" }, translate('theme.feedback.settings.label', label || 'How helpful was this page?')),
65
65
  React.createElement(Stars, { max: maxRating, onSubmit: setScore })));
66
66
  };
67
67
  exports.Rating = Rating;
@@ -35,11 +35,6 @@ const Reasons = ({ settings, onSubmit, className }) => {
35
35
  const { label, multi, buttonText, items = [] } = settings;
36
36
  const [checkedState, setCheckedState] = React.useState(new Array(items.length).fill(false));
37
37
  const { translate } = (0, hooks_1.useTranslate)();
38
- const translationKeys = {
39
- label: 'theme.feedback.settings.reasons.label',
40
- items: 'theme.feedback.settings.reasons.items',
41
- send: 'theme.feedback.settings.reasons.send',
42
- };
43
38
  if (!items.length) {
44
39
  return React.createElement(React.Fragment, null);
45
40
  }
@@ -53,12 +48,12 @@ const Reasons = ({ settings, onSubmit, className }) => {
53
48
  const submitForm = () => {
54
49
  onSubmit({ reasons: items.filter((_, index) => !!checkedState[index]) });
55
50
  };
56
- return (React.createElement(Wrapper, { "data-component-name": "Feedback/Reasons", "data-translation-key": translationKeys.label, className: className },
57
- React.createElement(Label, null, translate(translationKeys.label, label || 'Which statement describes your thoughts about this page?')),
51
+ return (React.createElement(Wrapper, { "data-component-name": "Feedback/Reasons", "data-translation-key": "theme.feedback.settings.reasons.label", className: className },
52
+ React.createElement(Label, null, translate('theme.feedback.settings.reasons.label', label || 'Which statement describes your thoughts about this page?')),
58
53
  items.map((reason, idx) => (React.createElement(OptionWrapper, { key: reason },
59
54
  React.createElement("input", { type: input_type, value: reason, checked: checkedState[idx], name: "reasons", onChange: () => handleOptionChange(idx) }),
60
- React.createElement("label", { "data-translation-key": `${translationKeys.items}.${idx + 1}`, id: reason, onClick: () => handleOptionChange(idx) }, translate(`${translationKeys.items}.${idx + 1}`, reason))))),
61
- React.createElement(SendButton, { "data-translation-key": translationKeys.send, onClick: submitForm }, translate(translationKeys.send, buttonText || 'Send'))));
55
+ React.createElement("label", { "data-translation-key": `theme.feedback.settings.reasons.items.${idx + 1}`, id: reason, onClick: () => handleOptionChange(idx) }, translate(`theme.feedback.settings.reasons.items.${idx + 1}`, reason))))),
56
+ React.createElement(SendButton, { "data-translation-key": "theme.feedback.settings.reasons.send", onClick: submitForm }, translate('theme.feedback.settings.reasons.send', buttonText || 'Send'))));
62
57
  };
63
58
  exports.Reasons = Reasons;
64
59
  const Wrapper = styled_components_1.default.div `
@@ -22,6 +22,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
25
34
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
36
  };
@@ -29,14 +38,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
38
  exports.ReportDialog = void 0;
30
39
  const React = __importStar(require("react"));
31
40
  const styled_components_1 = __importDefault(require("styled-components"));
41
+ const react_router_dom_1 = require("react-router-dom");
42
+ const telemetry_1 = require("../../mocks/telemetry");
32
43
  const Comment_1 = require("../../components/Feedback/Comment");
33
44
  const ReportDialog = ({ location, settings, onSubmit, onCancel, submitFeedback, }) => {
34
45
  const { label } = settings;
46
+ const { pathname } = (0, react_router_dom_1.useLocation)();
35
47
  return (React.createElement(Wrapper, { className: "modal" },
36
- React.createElement(Comment_1.Comment, { settings: { label }, onSubmit: (value) => {
37
- submitFeedback({ type: 'problem', values: value, path: location });
48
+ React.createElement(Comment_1.Comment, { settings: { label }, onSubmit: (value) => __awaiter(void 0, void 0, void 0, function* () {
49
+ yield submitFeedback({ type: 'problem', values: value, location, path: pathname });
50
+ telemetry_1.telemetry.send('code_snippet_reported', {});
38
51
  onSubmit();
39
- }, onCancel: onCancel })));
52
+ }), onCancel: onCancel })));
40
53
  };
41
54
  exports.ReportDialog = ReportDialog;
42
55
  const Wrapper = styled_components_1.default.div `
@@ -34,16 +34,11 @@ const Thumbs_1 = require("../../components/Feedback/Thumbs");
34
34
  const hooks_1 = require("../../mocks/hooks");
35
35
  const Sentiment = ({ settings, onSubmit, className }) => {
36
36
  const { label, submitText, comment: commentSettings, reasons: reasonsSettings } = settings || {};
37
+ const [isSubmitted, setIsSubmitted] = React.useState(false);
37
38
  const [score, setScore] = React.useState(0);
38
39
  const [comment, setComment] = React.useState('');
39
40
  const [reasons, setReasons] = React.useState([]);
40
41
  const { translate } = (0, hooks_1.useTranslate)();
41
- const translationKeys = {
42
- submitText: 'theme.feedback.settings.submitText',
43
- label: 'theme.feedback.settings.label',
44
- likeLabel: 'theme.feedback.settings.comment.likeLabel',
45
- dislikeLabel: 'theme.feedback.settings.comment.dislikeLabel',
46
- };
47
42
  if (score && (reasonsSettings === null || reasonsSettings === void 0 ? void 0 : reasonsSettings.enable) && !reasons.length) {
48
43
  const { label: reasonsLabel, items, multi } = reasonsSettings;
49
44
  const buttonText = (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) ? 'Next' : 'Send';
@@ -51,21 +46,24 @@ const Sentiment = ({ settings, onSubmit, className }) => {
51
46
  }
52
47
  if (score && (commentSettings === null || commentSettings === void 0 ? void 0 : commentSettings.enable) && !comment) {
53
48
  const commentLabel = score === 1
54
- ? translate(translationKeys.likeLabel, commentSettings.likeLabel || 'What was most helpful?')
55
- : translate(translationKeys.dislikeLabel, commentSettings.dislikeLabel || 'What can we improve?');
49
+ ? translate('theme.feedback.settings.comment.likeLabel', commentSettings.likeLabel || 'What was most helpful?')
50
+ : translate('theme.feedback.settings.comment.dislikeLabel', commentSettings.dislikeLabel || 'What can we improve?');
56
51
  return (React.createElement(Feedback_1.Comment, { onSubmit: ({ comment }) => setComment(comment), settings: { label: commentLabel } }));
57
52
  }
58
53
  if (score) {
59
- onSubmit({
60
- score,
61
- comment,
62
- reasons,
63
- });
54
+ if (!isSubmitted) {
55
+ onSubmit({
56
+ score,
57
+ comment,
58
+ reasons,
59
+ });
60
+ setIsSubmitted(true);
61
+ }
64
62
  return (React.createElement(Wrapper, null,
65
- React.createElement(Label, { "data-translation-key": translationKeys.submitText }, translate(translationKeys.submitText, submitText || 'Thank you for helping improve our documentation!'))));
63
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.submitText" }, translate('theme.feedback.settings.submitText', submitText || 'Thank you for helping improve our documentation!'))));
66
64
  }
67
65
  return (React.createElement(Wrapper, { "data-component-name": "Feedback/Sentiment", className: className },
68
- React.createElement(Label, { "data-translation-key": translationKeys.label }, translate(translationKeys.label, label || 'Was this page helpful?')),
66
+ React.createElement(Label, { "data-translation-key": "theme.feedback.settings.label" }, translate('theme.feedback.settings.label', label || 'Was this page helpful?')),
69
67
  React.createElement(Vote, { onClick: () => {
70
68
  setScore(1);
71
69
  } },
@@ -32,9 +32,6 @@ const styled_components_1 = __importDefault(require("styled-components"));
32
32
  const hooks_1 = require("../../mocks/hooks");
33
33
  const ThumbUp = ({ text }) => {
34
34
  const { translate } = (0, hooks_1.useTranslate)();
35
- const translationKeys = {
36
- thumbUp: 'theme.feedback.sentiment.thumbUp',
37
- };
38
35
  return (React.createElement(Wrapper, { style: { alignItems: 'normal' } },
39
36
  React.createElement(Icon, null,
40
37
  React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 512 512" },
@@ -45,14 +42,11 @@ const ThumbUp = ({ text }) => {
45
42
  React.createElement("path", { d: "M76.8,443.733c9.412,0,17.067-7.654,17.067-17.067S86.212,409.6,76.8,409.6c-9.412,0-17.067,7.654-17.067,17.067\n S67.388,443.733,76.8,443.733z" }),
46
43
  React.createElement("path", { d: "M179.2,247.467c25.353,0,57.429-28.297,74.3-45.167c36.634-36.634,36.634-82.167,36.634-151.1\n c0-5.342,3.191-8.533,8.533-8.533c29.508,0,42.667,13.158,42.667,42.667v102.4c0,4.71,3.814,8.533,8.533,8.533\n s8.533-3.823,8.533-8.533v-102.4c0-39.083-20.659-59.733-59.733-59.733c-14.831,0-25.6,10.769-25.6,25.6\n c0,66.978,0,107.401-31.633,139.034C216.661,215.006,192.811,230.4,179.2,230.4c-4.719,0-8.533,3.823-8.533,8.533\n S174.481,247.467,179.2,247.467z" }),
47
44
  React.createElement("path", { d: "M145.067,213.333H8.533c-4.719,0-8.533,3.823-8.533,8.533v256c0,4.71,3.814,8.533,8.533,8.533h136.533\n c4.719,0,8.533-3.823,8.533-8.533v-256C153.6,217.156,149.786,213.333,145.067,213.333z M136.533,469.333H17.067V230.4h119.467\n V469.333z" })))))),
48
- React.createElement("span", null, translate(translationKeys.thumbUp, text || 'Yes'))));
45
+ React.createElement("span", null, translate('theme.feedback.sentiment.thumbUp', text || 'Yes'))));
49
46
  };
50
47
  exports.ThumbUp = ThumbUp;
51
48
  const ThumbDown = ({ text }) => {
52
49
  const { translate } = (0, hooks_1.useTranslate)();
53
- const translationKeys = {
54
- thumbDown: 'theme.feedback.sentiment.thumbDown',
55
- };
56
50
  return (React.createElement(Wrapper, { style: { alignItems: 'end' } },
57
51
  React.createElement(Icon, null,
58
52
  React.createElement("svg", { version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 512 512" },
@@ -63,7 +57,7 @@ const ThumbDown = ({ text }) => {
63
57
  React.createElement("path", { d: "M495.736,221.227C505.634,213.41,512,201.301,512,187.733c0-18.295-11.58-33.946-27.802-39.996\n\t\t\t\tc6.673-7.535,10.735-17.434,10.735-28.271c0-22.281-17.169-40.627-38.963-42.505c3.055-5.094,4.83-10.999,4.83-17.229\n\t\t\t\tc0-17.86-16.265-34.133-34.133-34.133h-128c-40.021,0-56.03,8.832-71.526,17.374c-11.827,6.519-24.047,13.261-49.152,16.845\n\t\t\t\tc-4.668,0.666-7.902,4.992-7.236,9.66c0.666,4.659,4.949,7.885,9.66,7.236c28.177-4.028,42.411-11.87,54.963-18.79\n\t\t\t\tc14.848-8.183,27.665-15.258,63.292-15.258h128c8.619,0,17.067,8.456,17.067,17.067c0,8.934-8.132,17.067-17.067,17.067\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533h25.6c14.114,0,25.6,11.486,25.6,25.6s-11.486,25.6-25.6,25.6\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533c0,4.71,3.814,8.533,8.533,8.533h17.067c14.114,0,25.6,11.486,25.6,25.6\n\t\t\t\ts-11.486,25.6-25.6,25.6c-4.531,0-8.277,3.541-8.516,8.064c-0.247,4.531,3.081,8.457,7.586,8.951\n\t\t\t\tc26.53,2.91,26.53,16.418,26.53,20.847c0,13.773-11.418,30.404-25.6,30.404H349.867c-14.763,0-42.667,8.917-42.667,42.667\n\t\t\t\tc0,4.71,3.814,8.533,8.533,8.533s8.533-3.823,8.533-8.533c0-24.09,21.367-25.549,25.6-25.6h119.467\n\t\t\t\tc24.414,0,42.667-25.054,42.667-47.471C512,242.603,509.397,229.683,495.736,221.227z" }),
64
58
  React.createElement("path", { d: "M349.867,315.733c-4.719,0-8.533,3.823-8.533,8.533v102.4c0,29.508-13.158,42.667-42.667,42.667\n\t\t\t\tc-5.342,0-8.533-3.192-8.533-8.533c0-68.932,0-114.466-36.634-151.1c-16.87-16.87-48.947-45.167-74.3-45.167\n\t\t\t\tc-4.719,0-8.533,3.823-8.533,8.533s3.814,8.533,8.533,8.533c13.611,0,37.461,15.394,62.234,40.166\n\t\t\t\tc31.633,31.633,31.633,72.055,31.633,139.034c0,14.831,10.769,25.6,25.6,25.6c39.074,0,59.733-20.651,59.733-59.733v-102.4\n\t\t\t\tC358.4,319.556,354.586,315.733,349.867,315.733z" }),
65
59
  React.createElement("path", { d: "M145.067,25.6H8.533C3.814,25.6,0,29.423,0,34.133v256c0,4.71,3.814,8.533,8.533,8.533h136.533\n\t\t\t\tc4.719,0,8.533-3.823,8.533-8.533v-256C153.6,29.423,149.786,25.6,145.067,25.6z M136.533,281.6H17.067V42.667h119.467V281.6z" })))))),
66
- React.createElement("span", null, translate(translationKeys.thumbDown, text || 'No'))));
60
+ React.createElement("span", null, translate('theme.feedback.sentiment.thumbDown', text || 'No'))));
67
61
  };
68
62
  exports.ThumbDown = ThumbDown;
69
63
  const Wrapper = styled_components_1.default.div `
@@ -101,6 +101,6 @@ export type ReportDialogProps = {
101
101
  settings: {
102
102
  label?: string;
103
103
  };
104
- submitFeedback: ({ type, values, path }: SubmitFeedbackParams) => Promise<void>;
104
+ submitFeedback: ({ type, values, path, location }: SubmitFeedbackParams) => Promise<void>;
105
105
  className?: string;
106
106
  };
@@ -4,16 +4,13 @@ exports.useReportDialog = void 0;
4
4
  const react_1 = require("react");
5
5
  const hooks_1 = require("../../mocks/hooks");
6
6
  const hooks_2 = require("../../hooks");
7
+ const useSubmitFeedback_1 = require("../../mocks/Feedback/useSubmitFeedback");
7
8
  function useReportDialog() {
8
9
  const { codeSnippet: { report = {} } = {} } = (0, hooks_2.useThemeConfig)();
9
10
  const [isReportDialogShown, setIsReportDialogShown] = (0, react_1.useState)(false);
10
11
  const isReportButtonShown = (report === null || report === void 0 ? void 0 : report.hide) === false; // TODO: report temporary disabled by default
11
12
  const { translate } = (0, hooks_1.useTranslate)();
12
- const translationKeys = {
13
- buttonText: 'theme.codeSnippet.report.buttonText',
14
- tooltipText: 'theme.codeSnippet.report.tooltipText',
15
- label: 'theme.codeSnippet.report.label',
16
- };
13
+ const { submitFeedback } = (0, useSubmitFeedback_1.useSubmitFeedback)();
17
14
  const showReportDialog = () => {
18
15
  setIsReportDialogShown(true);
19
16
  };
@@ -22,16 +19,17 @@ function useReportDialog() {
22
19
  };
23
20
  const reportButtonProps = {
24
21
  onClick: showReportDialog,
25
- buttonText: translate(translationKeys.buttonText, 'Report'),
26
- tooltip: translate(translationKeys.tooltipText, 'Report a problem'),
22
+ buttonText: translate('theme.codeSnippet.report.buttonText', 'Report'),
23
+ tooltip: translate('theme.codeSnippet.report.tooltipText', 'Report a problem'),
27
24
  visible: isReportButtonShown,
28
25
  };
29
26
  const reportDialogProps = {
30
27
  settings: {
31
- label: translate(translationKeys.label, 'What is wrong with this code?'),
28
+ label: translate('theme.codeSnippet.report.label', 'What is wrong with this code?'),
32
29
  },
33
30
  onSubmit: hideReportDialog,
34
31
  onCancel: hideReportDialog,
32
+ submitFeedback,
35
33
  };
36
34
  return {
37
35
  reportDialog: { visible: isReportDialogShown, props: reportDialogProps },
@@ -13,10 +13,6 @@ const Select_1 = require("../../components/Select");
13
13
  function Filter({ filter, filterValuesCasing, }) {
14
14
  var _a;
15
15
  const { translate } = (0, hooks_1.useTranslate)();
16
- const translationKeys = {
17
- selectAll: 'theme.catalog.filters.select.all',
18
- clear: 'theme.catalog.filters.clear',
19
- };
20
16
  if (!filter.parentUsed)
21
17
  return null;
22
18
  let selectOptions = [];
@@ -26,7 +22,7 @@ function Filter({ filter, filterValuesCasing, }) {
26
22
  {
27
23
  value: '',
28
24
  element: (react_1.default.createElement(FilterOption, { key: "all", onClick: () => filter.selectOption('') },
29
- react_1.default.createElement(FilterOptionLabel, null, translate(translationKeys.selectAll, 'All')),
25
+ react_1.default.createElement(FilterOptionLabel, null, translate('theme.catalog.filters.select.all', 'All')),
30
26
  react_1.default.createElement(FilterOptionCount, null, defaultOptionCount))),
31
27
  },
32
28
  ];
@@ -56,7 +52,7 @@ function Filter({ filter, filterValuesCasing, }) {
56
52
  return;
57
53
  filter.selectOption(Object.assign(Object.assign({}, filter.selectedOptions), { to: formatDateWithNoTimeZone(to) }));
58
54
  } })))) : (filter.filteredOptions.map((value) => {
59
- const id = 'filter--' + filter.property + '--' + value.value;
55
+ const id = 'filter--' + filter.property + '--' + slug(value.value);
60
56
  return (react_1.default.createElement(FilterOption, { key: id, role: "link", onClick: () => filter.toggleOption(value.value) },
61
57
  react_1.default.createElement(icons_1.CheckboxIcon, { checked: filter.selectedOptions.has(value.value) }),
62
58
  react_1.default.createElement(FilterOptionLabel, null, changeCasing(translate(value.value), filterValuesCasing)),
@@ -137,6 +133,10 @@ const StyledSelect = (0, styled_components_1.default)(Select_1.Select) `
137
133
  margin: var(--filter-select-option-margin);
138
134
  }
139
135
  `;
136
+ // TODO: import from portal
137
+ function slug(str) {
138
+ return str.replace(/\s/g, '-').toLowerCase();
139
+ }
140
140
  const DatePickerWrapper = styled_components_1.default.div `
141
141
  color: var(--filter-date-picker-color);
142
142
  display: flex;
@@ -14,10 +14,6 @@ const Sidebar_1 = require("../../components/Sidebar");
14
14
  const FilterPopover_1 = require("../../components/Filter/FilterPopover");
15
15
  function FilterContent({ setFilterTerm, filters, filterTerm, isMobile, filterValuesCasing, }) {
16
16
  const { translate } = (0, hooks_1.useTranslate)();
17
- const translationKeys = {
18
- placeholder: 'theme.catalog.filters.placeholder',
19
- clearAll: 'theme.catalog.filters.clearAll',
20
- };
21
17
  const hasActiveFilters = filters.some((filter) => {
22
18
  if (filterTerm)
23
19
  return true;
@@ -34,10 +30,10 @@ function FilterContent({ setFilterTerm, filters, filterTerm, isMobile, filterVal
34
30
  };
35
31
  return (react_1.default.createElement(FilterContentWrapper, { isMobile: isMobile },
36
32
  react_1.default.createElement(Catalog_1.FilterControls, null,
37
- react_1.default.createElement(FilterPopover_1.StyledInput, { placeholder: translate(translationKeys.placeholder, 'Type to filter...'), value: filterTerm, onChange: (e) => setFilterTerm(e.target.value) })),
33
+ react_1.default.createElement(FilterPopover_1.StyledInput, { placeholder: translate('theme.catalog.filters.placeholder', 'Type to filter...'), value: filterTerm, onChange: (e) => setFilterTerm(e.target.value) })),
38
34
  react_1.default.createElement(exports.FilterItems, null, filters.map((filter, idx) => (react_1.default.createElement(Filter_1.Filter, { filter: filter, key: filter.property + '-' + idx, filterValuesCasing: filterValuesCasing })))),
39
35
  hasActiveFilters && (react_1.default.createElement(ActionsContainer, null,
40
- react_1.default.createElement(ClearAllButton, { size: "default", variant: "outlined", onClick: handleClearAll }, translate(translationKeys.placeholder, 'Clear all filters'))))));
36
+ react_1.default.createElement(ClearAllButton, { size: "default", variant: "outlined", onClick: handleClearAll }, translate('theme.catalog.filters.clearAll', 'Clear all filters'))))));
41
37
  }
42
38
  exports.FilterContent = FilterContent;
43
39
  const FilterContentWrapper = (0, styled_components_1.default)(Sidebar_1.Sidebar) `
@@ -19,18 +19,14 @@ function FilterPopover({ setIsAddingFilter, filters, filterValuesCasing, }) {
19
19
  ? Object.assign(Object.assign({}, filter), { filteredOptions: options }) : null;
20
20
  })
21
21
  .filter(Boolean);
22
- const translationKeys = {
23
- placeholder: 'theme.catalog.filters.placeholder',
24
- done: 'theme.catalog.filters.done',
25
- };
26
22
  const { translate } = (0, hooks_1.useTranslate)();
27
23
  return (react_1.default.createElement(FilterPopoverWrapper, null,
28
24
  react_1.default.createElement(FilterPopoverHeader, null,
29
25
  react_1.default.createElement(FilterPopoverHeaderLabel, null, "Add Filter"),
30
- react_1.default.createElement(FilterPopoverHeaderButton, { onClick: () => setIsAddingFilter(false) }, translate(translationKeys.placeholder, 'Done'))),
26
+ react_1.default.createElement(FilterPopoverHeaderButton, { onClick: () => setIsAddingFilter(false) }, translate('theme.catalog.filters.done', 'Done'))),
31
27
  react_1.default.createElement(FilterContent_1.FilterContent, { setFilterTerm: setFilterTerm, filters: filters, filterTerm: filterTerm, filterValuesCasing: filterValuesCasing, isMobile: true }),
32
28
  react_1.default.createElement(Catalog_1.FilterControls, null,
33
- react_1.default.createElement(exports.StyledInput, { placeholder: translate(translationKeys.placeholder, 'Type to filter...'), value: filterTerm, onChange: (e) => setFilterTerm(e.target.value) })),
29
+ react_1.default.createElement(exports.StyledInput, { placeholder: translate('theme.catalog.filters.placeholder', 'Type to filter...'), value: filterTerm, onChange: (e) => setFilterTerm(e.target.value) })),
34
30
  react_1.default.createElement(FilterContent_1.FilterItems, null, filteredFilters.map((filter, idx) => (react_1.default.createElement(Filter_1.Filter, { filter: filter, key: filter.property + '-' + idx }))))));
35
31
  }
36
32
  exports.FilterPopover = FilterPopover;
@@ -11,11 +11,8 @@ const hooks_1 = require("../../mocks/hooks");
11
11
  function FooterCopyright({ copyrightText = '', className, }) {
12
12
  const { translate } = (0, hooks_1.useTranslate)();
13
13
  const { changeLanguage } = (0, hooks_1.useI18n)();
14
- const translationKeys = {
15
- copyrightText: 'theme.footer.copyrightText',
16
- };
17
- return copyrightText ? (react_1.default.createElement(Wrapper, { className: className, "data-component-name": "Footer/FooterCopyright", "data-translation-key": translationKeys.copyrightText },
18
- react_1.default.createElement(Label, null, translate(translationKeys.copyrightText, copyrightText)),
14
+ return copyrightText ? (react_1.default.createElement(Wrapper, { className: className, "data-component-name": "Footer/FooterCopyright", "data-translation-key": "theme.footer.copyrightText" },
15
+ react_1.default.createElement(Label, null, translate('theme.footer.copyrightText', copyrightText)),
19
16
  react_1.default.createElement(LanguagePicker_1.LanguagePicker, { onChangeLanguage: changeLanguage, placement: "top", alignment: "end" }))) : null;
20
17
  }
21
18
  exports.FooterCopyright = FooterCopyright;
@@ -51,7 +51,7 @@ function LastUpdated(props) {
51
51
  const lastUpdatedString = FORMATS[format](lastModified, locale);
52
52
  const translationKey = format === 'timeago' ? 'theme.page.lastUpdated.timeago' : 'theme.page.lastUpdated.on';
53
53
  const text = format === 'timeago'
54
- ? translate(translationKey, 'Last updated ')
54
+ ? translate(translationKey, 'Last updated') + ' '
55
55
  : translate(translationKey, 'Last updated on');
56
56
  return (React.createElement(Wrapper, { className: props.className, "data-component-name": "LastUpdated/LastUpdated", rawOnPrint: format === 'timeago', "data-print-datetime": isoDate, "data-translation-key": translationKey },
57
57
  text,
@@ -11,9 +11,6 @@ const MENU_SEPARATOR = {
11
11
  type: 'separator',
12
12
  separatorLine: true,
13
13
  };
14
- const TRANSLATION_KEYS = {
15
- products: 'theme.mobileMenu.products',
16
- };
17
14
  const useMobileMenuItems = (menuType) => {
18
15
  var _a, _b, _c;
19
16
  const { versions = [] } = (0, hooks_1.usePageVersions)() || {};
@@ -59,7 +56,7 @@ const useMobileMenuItems = (menuType) => {
59
56
  if (productMenuItems.length) {
60
57
  menuItems.push({
61
58
  type: 'separator',
62
- label: translate(TRANSLATION_KEYS.products, 'Products'),
59
+ label: translate('theme.mobileMenu.products', 'Products'),
63
60
  });
64
61
  menuItems.push(...productMenuItems);
65
62
  }