@plone/volto 18.35.0 → 18.35.1

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 (183) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/locales/af/LC_MESSAGES/volto.po +5 -5
  3. package/locales/af.json +1 -1
  4. package/locales/ar/LC_MESSAGES/volto.po +5 -5
  5. package/locales/ar.json +1 -1
  6. package/locales/bg/LC_MESSAGES/volto.po +5 -5
  7. package/locales/bg.json +1 -1
  8. package/locales/bn/LC_MESSAGES/volto.po +5 -5
  9. package/locales/bn.json +1 -1
  10. package/locales/ca/LC_MESSAGES/volto.po +5 -5
  11. package/locales/ca.json +1 -1
  12. package/locales/cs/LC_MESSAGES/volto.po +5 -5
  13. package/locales/cs.json +1 -1
  14. package/locales/cy/LC_MESSAGES/volto.po +5 -5
  15. package/locales/cy.json +1 -1
  16. package/locales/da/LC_MESSAGES/volto.po +5 -5
  17. package/locales/da.json +1 -1
  18. package/locales/de/LC_MESSAGES/volto.po +5 -5
  19. package/locales/de.json +1 -1
  20. package/locales/el/LC_MESSAGES/volto.po +5 -5
  21. package/locales/el.json +1 -1
  22. package/locales/en/LC_MESSAGES/volto.po +5 -5
  23. package/locales/en.json +1 -1
  24. package/locales/en_AU/LC_MESSAGES/volto.po +5 -5
  25. package/locales/en_AU.json +1 -1
  26. package/locales/en_GB/LC_MESSAGES/volto.po +5 -5
  27. package/locales/en_GB.json +1 -1
  28. package/locales/eo/LC_MESSAGES/volto.po +5 -5
  29. package/locales/eo.json +1 -1
  30. package/locales/es/LC_MESSAGES/volto.po +5 -5
  31. package/locales/es.json +1 -1
  32. package/locales/et/LC_MESSAGES/volto.po +5 -5
  33. package/locales/et.json +1 -1
  34. package/locales/eu/LC_MESSAGES/volto.po +5 -5
  35. package/locales/eu.json +1 -1
  36. package/locales/fa/LC_MESSAGES/volto.po +5 -5
  37. package/locales/fa.json +1 -1
  38. package/locales/fi/LC_MESSAGES/volto.po +5 -5
  39. package/locales/fi.json +1 -1
  40. package/locales/fr/LC_MESSAGES/volto.po +5 -5
  41. package/locales/fr.json +1 -1
  42. package/locales/fu/LC_MESSAGES/volto.po +5 -5
  43. package/locales/fu.json +1 -1
  44. package/locales/gl/LC_MESSAGES/volto.po +5 -5
  45. package/locales/gl.json +1 -1
  46. package/locales/he/LC_MESSAGES/volto.po +5 -5
  47. package/locales/he.json +1 -1
  48. package/locales/hi/LC_MESSAGES/volto.po +5 -5
  49. package/locales/hi.json +1 -1
  50. package/locales/hr/LC_MESSAGES/volto.po +5 -5
  51. package/locales/hr.json +1 -1
  52. package/locales/hu/LC_MESSAGES/volto.po +5 -5
  53. package/locales/hu.json +1 -1
  54. package/locales/hy/LC_MESSAGES/volto.po +5 -5
  55. package/locales/hy.json +1 -1
  56. package/locales/id/LC_MESSAGES/volto.po +5 -5
  57. package/locales/id.json +1 -1
  58. package/locales/it/LC_MESSAGES/volto.po +5 -5
  59. package/locales/it.json +1 -1
  60. package/locales/ja/LC_MESSAGES/volto.po +5 -5
  61. package/locales/ja.json +1 -1
  62. package/locales/ka/LC_MESSAGES/volto.po +5 -5
  63. package/locales/ka.json +1 -1
  64. package/locales/kn/LC_MESSAGES/volto.po +5 -5
  65. package/locales/kn.json +1 -1
  66. package/locales/ko/LC_MESSAGES/volto.po +5 -5
  67. package/locales/ko.json +1 -1
  68. package/locales/lt/LC_MESSAGES/volto.po +5 -5
  69. package/locales/lt.json +1 -1
  70. package/locales/lv/LC_MESSAGES/volto.po +5 -5
  71. package/locales/lv.json +1 -1
  72. package/locales/mi/LC_MESSAGES/volto.po +5 -5
  73. package/locales/mi.json +1 -1
  74. package/locales/mk/LC_MESSAGES/volto.po +5 -5
  75. package/locales/mk.json +1 -1
  76. package/locales/my/LC_MESSAGES/volto.po +5 -5
  77. package/locales/my.json +1 -1
  78. package/locales/nb_NO/LC_MESSAGES/volto.po +5 -5
  79. package/locales/nb_NO.json +1 -1
  80. package/locales/nl/LC_MESSAGES/volto.po +5 -5
  81. package/locales/nl.json +1 -1
  82. package/locales/nn/LC_MESSAGES/volto.po +5 -5
  83. package/locales/nn.json +1 -1
  84. package/locales/pl/LC_MESSAGES/volto.po +5 -5
  85. package/locales/pl.json +1 -1
  86. package/locales/pt/LC_MESSAGES/volto.po +5 -5
  87. package/locales/pt.json +1 -1
  88. package/locales/pt_BR/LC_MESSAGES/volto.po +5 -5
  89. package/locales/pt_BR.json +1 -1
  90. package/locales/rm/LC_MESSAGES/volto.po +5 -5
  91. package/locales/rm.json +1 -1
  92. package/locales/ro/LC_MESSAGES/volto.po +5 -5
  93. package/locales/ro.json +1 -1
  94. package/locales/ru/LC_MESSAGES/volto.po +5 -5
  95. package/locales/ru.json +1 -1
  96. package/locales/sk/LC_MESSAGES/volto.po +5 -5
  97. package/locales/sk.json +1 -1
  98. package/locales/sl/LC_MESSAGES/volto.po +5 -5
  99. package/locales/sl.json +1 -1
  100. package/locales/sm/LC_MESSAGES/volto.po +5 -5
  101. package/locales/sm.json +1 -1
  102. package/locales/sq/LC_MESSAGES/volto.po +5 -5
  103. package/locales/sq.json +1 -1
  104. package/locales/sr/LC_MESSAGES/volto.po +5 -5
  105. package/locales/sr.json +1 -1
  106. package/locales/sr@cyrl/LC_MESSAGES/volto.po +5 -5
  107. package/locales/sr@cyrl.json +1 -1
  108. package/locales/sr@latn/LC_MESSAGES/volto.po +5 -5
  109. package/locales/sr@latn.json +1 -1
  110. package/locales/sv/LC_MESSAGES/volto.po +5 -5
  111. package/locales/sv.json +1 -1
  112. package/locales/ta/LC_MESSAGES/volto.po +5 -5
  113. package/locales/ta.json +1 -1
  114. package/locales/te/LC_MESSAGES/volto.po +5 -5
  115. package/locales/te.json +1 -1
  116. package/locales/th/LC_MESSAGES/volto.po +5 -5
  117. package/locales/th.json +1 -1
  118. package/locales/to/LC_MESSAGES/volto.po +5 -5
  119. package/locales/to.json +1 -1
  120. package/locales/tr/LC_MESSAGES/volto.po +5 -5
  121. package/locales/tr.json +1 -1
  122. package/locales/uk/LC_MESSAGES/volto.po +5 -5
  123. package/locales/uk.json +1 -1
  124. package/locales/vi/LC_MESSAGES/volto.po +5 -5
  125. package/locales/vi.json +1 -1
  126. package/locales/volto.pot +6 -6
  127. package/locales/zh_CN/LC_MESSAGES/volto.po +5 -5
  128. package/locales/zh_CN.json +1 -1
  129. package/locales/zh_Hant/LC_MESSAGES/volto.po +5 -5
  130. package/locales/zh_Hant.json +1 -1
  131. package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +5 -5
  132. package/locales/zh_Hant_HK.json +1 -1
  133. package/package.json +18 -22
  134. package/src/actions/querystringsearch/querystringsearch.js +4 -1
  135. package/src/actions/querystringsearch/querystringsearch.test.js +77 -0
  136. package/src/components/manage/BlockChooser/BlockChooser.jsx +7 -10
  137. package/src/components/manage/Blocks/Block/Edit.jsx +9 -10
  138. package/src/components/manage/Blocks/Block/Order/Item.jsx +9 -4
  139. package/src/components/manage/Blocks/Image/View.test.jsx +8 -8
  140. package/src/components/manage/Contents/ContentsBreadcrumbs.jsx +7 -6
  141. package/src/components/manage/Sidebar/ObjectBrowser.jsx +7 -0
  142. package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +7 -3
  143. package/src/components/manage/Sidebar/ObjectBrowserBody.test.jsx +52 -0
  144. package/src/components/manage/Widgets/ArrayWidget.jsx +3 -2
  145. package/src/components/manage/Widgets/FormFieldWrapper.jsx +16 -3
  146. package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +1 -0
  147. package/src/components/manage/Widgets/QuerystringWidget.jsx +1 -18
  148. package/src/components/manage/Widgets/QuerystringWidget.test.jsx +45 -2
  149. package/src/components/manage/Widgets/SelectStyling.jsx +33 -1
  150. package/src/components/manage/Widgets/SelectWidget.jsx +3 -2
  151. package/src/components/manage/Widgets/TextWidget.test.jsx +44 -0
  152. package/src/components/theme/Unauthorized/Unauthorized.jsx +1 -2
  153. package/src/components/theme/View/EventView.stories.jsx +89 -0
  154. package/src/components/theme/View/FileView.stories.jsx +50 -0
  155. package/src/components/theme/View/LinkView.stories.jsx +57 -0
  156. package/src/components/theme/View/ListingView.stories.jsx +70 -0
  157. package/src/components/theme/View/NewsItemView.stories.jsx +58 -0
  158. package/src/components/theme/View/RenderBlocks.stories.jsx +112 -0
  159. package/src/components/theme/View/SummaryView.stories.jsx +71 -0
  160. package/src/components/theme/View/TabularView.stories.jsx +66 -0
  161. package/src/helpers/I18n/I18n.test.ts +44 -0
  162. package/src/helpers/I18n/I18n.ts +31 -0
  163. package/src/helpers/index.js +1 -0
  164. package/src/server.jsx +7 -1
  165. package/types/components/manage/Controlpanels/Relations/RelationsMatrix.d.ts +1 -1
  166. package/types/components/manage/Multilingual/ManageTranslations.d.ts +1 -1
  167. package/types/components/manage/Sidebar/ObjectBrowser.d.ts +1 -1
  168. package/types/components/manage/Sidebar/ObjectBrowserBody.test.d.ts +1 -0
  169. package/types/components/manage/Widgets/ImageWidget.d.ts +1 -1
  170. package/types/components/manage/Widgets/InternalUrlWidget.d.ts +1 -1
  171. package/types/components/manage/Widgets/QuerystringWidget.d.ts +0 -4
  172. package/types/components/manage/Widgets/UrlWidget.d.ts +1 -1
  173. package/types/components/manage/Widgets/index.d.ts +2 -2
  174. package/types/components/theme/View/EventView.stories.d.ts +19 -0
  175. package/types/components/theme/View/FileView.stories.d.ts +18 -0
  176. package/types/components/theme/View/LinkView.stories.d.ts +18 -0
  177. package/types/components/theme/View/ListingView.stories.d.ts +24 -0
  178. package/types/components/theme/View/NewsItemView.stories.d.ts +23 -0
  179. package/types/components/theme/View/RenderBlocks.stories.d.ts +23 -0
  180. package/types/components/theme/View/SummaryView.stories.d.ts +23 -0
  181. package/types/components/theme/View/TabularView.stories.d.ts +23 -0
  182. package/types/helpers/I18n/I18n.d.ts +20 -0
  183. package/types/helpers/index.d.ts +1 -0
@@ -0,0 +1,57 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import LinkViewComponent from './LinkView';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ const IntlLinkViewComponent = injectIntl(LinkViewComponent);
7
+
8
+ function StoryComponent(args) {
9
+ return (
10
+ <Wrapper
11
+ customStore={{
12
+ userSession: {
13
+ token: null,
14
+ },
15
+ intl: {
16
+ locale: 'en',
17
+ messages: {},
18
+ },
19
+ }}
20
+ >
21
+ <div id="toolbar" style={{ display: 'none' }} />
22
+ <IntlLinkViewComponent
23
+ token="1234"
24
+ content={{
25
+ ...args,
26
+ }}
27
+ />
28
+ </Wrapper>
29
+ );
30
+ }
31
+
32
+ export const Default = StoryComponent.bind({});
33
+ Default.args = {
34
+ title: 'Hello World!',
35
+ description: 'Hi',
36
+ remoteUrl: '/news',
37
+ };
38
+
39
+ export default {
40
+ title: 'Public components/View/LinkView',
41
+ component: LinkViewComponent,
42
+ decorators: [
43
+ (Story) => (
44
+ <div className="ui segment form attached" style={{ width: '900px' }}>
45
+ <Story />
46
+ </div>
47
+ ),
48
+ ],
49
+ argTypes: {
50
+ title: {
51
+ description: 'Title of the component',
52
+ },
53
+ remoteUrl: {
54
+ description: 'remoteUrl mentioned in the page',
55
+ },
56
+ },
57
+ };
@@ -0,0 +1,70 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import ListingViewComponent from './ListingView';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ const IntlListingViewComponent = injectIntl(ListingViewComponent);
7
+
8
+ function StoryComponent(args) {
9
+ return (
10
+ <Wrapper
11
+ customStore={{
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ }}
17
+ >
18
+ <div id="toolbar" style={{ display: 'none' }} />
19
+ <IntlListingViewComponent
20
+ content={{
21
+ title: 'Hello World!',
22
+ description: 'Hi',
23
+ ...args,
24
+ }}
25
+ />
26
+ </Wrapper>
27
+ );
28
+ }
29
+
30
+ export const Default = StoryComponent.bind({});
31
+ Default.args = {
32
+ items: [
33
+ {
34
+ title: 'My item',
35
+ description: 'My item description',
36
+ url: '/item',
37
+ '@type': 'Document',
38
+ },
39
+ {
40
+ title: 'Second item',
41
+ description: 'My second item description',
42
+ url: '/item2',
43
+ '@type': 'Document',
44
+ },
45
+ ],
46
+ };
47
+
48
+ export default {
49
+ title: 'Public components/View/ListingView',
50
+ component: ListingViewComponent,
51
+ decorators: [
52
+ (Story) => (
53
+ <div className="ui segment form attached" style={{ width: '900px' }}>
54
+ <Story />
55
+ </div>
56
+ ),
57
+ ],
58
+ argTypes: {
59
+ items: {
60
+ control: 'object',
61
+ description: 'Listed pages',
62
+ },
63
+ title: {
64
+ description: 'Title of the page listed',
65
+ },
66
+ description: {
67
+ description: 'Description of the page',
68
+ },
69
+ },
70
+ };
@@ -0,0 +1,58 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import NewsItemViewComponent from './NewsItemView';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ const IntlNewsItemViewComponent = injectIntl(NewsItemViewComponent);
7
+
8
+ function StoryComponent(args) {
9
+ return (
10
+ <Wrapper
11
+ customStore={{
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ }}
17
+ >
18
+ <div id="toolbar" style={{ display: 'none' }} />
19
+ <IntlNewsItemViewComponent
20
+ content={{
21
+ ...args,
22
+ }}
23
+ />
24
+ </Wrapper>
25
+ );
26
+ }
27
+
28
+ export const Default = StoryComponent.bind({});
29
+ Default.args = {
30
+ title: 'Hello World!',
31
+ description: 'Hi',
32
+ text: {
33
+ data: '<p>Hello World!</p>',
34
+ },
35
+ };
36
+
37
+ export default {
38
+ title: 'Public components/View/NewsItemView',
39
+ component: NewsItemViewComponent,
40
+ decorators: [
41
+ (Story) => (
42
+ <div className="ui segment form attached" style={{ width: '900px' }}>
43
+ <Story />
44
+ </div>
45
+ ),
46
+ ],
47
+ argTypes: {
48
+ title: {
49
+ description: 'Title of the page listed',
50
+ },
51
+ description: {
52
+ description: 'Description of the page',
53
+ },
54
+ text: {
55
+ description: 'Content',
56
+ },
57
+ },
58
+ };
@@ -0,0 +1,112 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import RenderBlocksComponent from './RenderBlocks';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ import config from '@plone/volto/registry';
7
+
8
+ const IntlRenderBlocksComponent = injectIntl(RenderBlocksComponent);
9
+
10
+ function StoryComponent(args) {
11
+ return (
12
+ <Wrapper
13
+ customStore={{
14
+ intl: {
15
+ locale: 'en',
16
+ messages: {},
17
+ },
18
+ }}
19
+ >
20
+ <div id="toolbar" style={{ display: 'none' }} />
21
+ <IntlRenderBlocksComponent
22
+ blocksConfig={{
23
+ ...config.blocks.blocksConfig,
24
+ custom: {
25
+ id: 'custom',
26
+ ...args,
27
+ },
28
+ }}
29
+ content={{
30
+ blocks_layout: {
31
+ items: ['a', 'b'],
32
+ },
33
+ ...args,
34
+ }}
35
+ path="/foo"
36
+ />
37
+ </Wrapper>
38
+ );
39
+ }
40
+
41
+ export const Default = StoryComponent.bind({});
42
+ Default.args = {
43
+ view: ({ id, data }) => (
44
+ <div>
45
+ {id} - {data.text}
46
+ </div>
47
+ ),
48
+ blocks: {
49
+ a: {
50
+ '@type': 'custom',
51
+ text: 'a',
52
+ },
53
+ b: {
54
+ '@type': 'custom',
55
+ text: 'b',
56
+ },
57
+ },
58
+ };
59
+ export const PathToBlocks = StoryComponent.bind({});
60
+ PathToBlocks.args = {
61
+ view: ({ id, data, path }) => (
62
+ <div>
63
+ id: {id} - text: {data.text} - path: {path}
64
+ </div>
65
+ ),
66
+
67
+ blocks: {
68
+ a: {
69
+ '@type': 'custom',
70
+ text: 'bar',
71
+ },
72
+ b: {
73
+ '@type': 'custom',
74
+ text: 'foo',
75
+ },
76
+ },
77
+ };
78
+
79
+ export const InvalidBlocks = StoryComponent.bind({});
80
+ InvalidBlocks.args = {
81
+ blocks_layout: {
82
+ items: ['MISSING-YOU-1', 'a', 'MISSING-YOU-2'],
83
+ },
84
+ blocks: {
85
+ a: {
86
+ '@type': 'custom',
87
+ text: 'bar',
88
+ },
89
+ },
90
+ };
91
+ export default {
92
+ title: 'Internal components/View/RenderBlocks',
93
+ component: RenderBlocksComponent,
94
+ decorators: [
95
+ (Story) => (
96
+ <div className="ui segment form attached" style={{ width: '900px' }}>
97
+ <Story />
98
+ </div>
99
+ ),
100
+ ],
101
+ argTypes: {
102
+ view: {
103
+ description: 'Pattern in which to place block content',
104
+ },
105
+ blocks: {
106
+ description: 'blocks in the page',
107
+ },
108
+ blocks_layout: {
109
+ description: 'block layout in the page',
110
+ },
111
+ },
112
+ };
@@ -0,0 +1,71 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import SummaryViewComponent from './SummaryView';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ const IntlSummaryViewComponent = injectIntl(SummaryViewComponent);
7
+
8
+ function StoryComponent(args) {
9
+ return (
10
+ <Wrapper
11
+ customStore={{
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ }}
17
+ >
18
+ <div id="toolbar" style={{ display: 'none' }} />
19
+ <IntlSummaryViewComponent
20
+ content={{
21
+ ...args,
22
+ }}
23
+ />
24
+ </Wrapper>
25
+ );
26
+ }
27
+
28
+ export const Default = StoryComponent.bind({});
29
+ Default.args = {
30
+ title: 'Hello World!',
31
+ description: 'Hi',
32
+ items: [
33
+ {
34
+ title: 'My item',
35
+ description: 'My item description',
36
+ url: '/item',
37
+ image: {
38
+ scales: {
39
+ thumb: {
40
+ download: 'file:///preview.jpg',
41
+ },
42
+ },
43
+ },
44
+ image_caption: 'My image caption',
45
+ '@type': 'News Item',
46
+ },
47
+ ],
48
+ };
49
+ export default {
50
+ title: 'Public components/View/SummaryView',
51
+ component: SummaryViewComponent,
52
+ decorators: [
53
+ (Story) => (
54
+ <div className="ui segment form attached" style={{ width: '900px' }}>
55
+ <Story />
56
+ </div>
57
+ ),
58
+ ],
59
+
60
+ argTypes: {
61
+ title: {
62
+ description: 'Title of the page listed',
63
+ },
64
+ description: {
65
+ description: 'Description of the page',
66
+ },
67
+ items: {
68
+ description: 'Content in the page',
69
+ },
70
+ },
71
+ };
@@ -0,0 +1,66 @@
1
+ import { injectIntl } from 'react-intl';
2
+ import React from 'react';
3
+ import TabularViewComponent from './TabularView';
4
+ import { RealStoreWrapper as Wrapper } from '@plone/volto/storybook';
5
+
6
+ const IntlTabularViewComponent = injectIntl(TabularViewComponent);
7
+
8
+ function StoryComponent(args) {
9
+ return (
10
+ <Wrapper
11
+ customStore={{
12
+ intl: {
13
+ locale: 'en',
14
+ messages: {},
15
+ },
16
+ }}
17
+ >
18
+ <div id="toolbar" style={{ display: 'none' }} />
19
+ <IntlTabularViewComponent
20
+ content={{
21
+ ...args,
22
+ }}
23
+ />
24
+ </Wrapper>
25
+ );
26
+ }
27
+
28
+ export const Default = StoryComponent.bind({});
29
+ Default.args = {
30
+ title: 'Hello World!',
31
+ description: 'Hi',
32
+ items: [
33
+ {
34
+ title: 'My item 1',
35
+ description: 'My item description 1',
36
+ url: '/item1',
37
+ },
38
+ {
39
+ title: 'My item 2',
40
+ description: 'My item description 2',
41
+ url: '/item2',
42
+ },
43
+ ],
44
+ };
45
+ export default {
46
+ title: 'Public components/View/TabularView',
47
+ component: TabularViewComponent,
48
+ decorators: [
49
+ (Story) => (
50
+ <div className="ui segment form attached" style={{ width: '900px' }}>
51
+ <Story />
52
+ </div>
53
+ ),
54
+ ],
55
+ argTypes: {
56
+ title: {
57
+ description: 'Title of the page listed',
58
+ },
59
+ description: {
60
+ description: 'Description of the page',
61
+ },
62
+ items: {
63
+ description: 'Row items of the page',
64
+ },
65
+ },
66
+ };
@@ -0,0 +1,44 @@
1
+ import { createIntl, createIntlCache } from 'react-intl';
2
+ import type { IntlShape } from 'react-intl';
3
+ import { formatMessageWithFallback } from './I18n';
4
+
5
+ const buildIntl = (
6
+ locale: string,
7
+ messages: Record<string, string>,
8
+ ): IntlShape => createIntl({ locale, messages }, createIntlCache());
9
+
10
+ describe('formatMessageWithFallback', () => {
11
+ it('returns the translated string when the locale catalog has an entry', () => {
12
+ const intl = buildIntl('pt-BR', { Image: 'Imagem' });
13
+ expect(formatMessageWithFallback(intl, 'Image')).toBe('Imagem');
14
+ });
15
+
16
+ it('falls back to the input message when no translation is registered', () => {
17
+ const intl = buildIntl('pt-BR', {});
18
+ expect(formatMessageWithFallback(intl, 'Image')).toBe('Image');
19
+ });
20
+
21
+ it('returns undefined unchanged', () => {
22
+ const intl = buildIntl('en', {});
23
+ expect(formatMessageWithFallback(intl, undefined)).toBeUndefined();
24
+ });
25
+
26
+ it('returns null unchanged', () => {
27
+ const intl = buildIntl('en', {});
28
+ expect(formatMessageWithFallback(intl, null)).toBeNull();
29
+ });
30
+
31
+ it('returns an empty string unchanged', () => {
32
+ const intl = buildIntl('en', {});
33
+ expect(formatMessageWithFallback(intl, '')).toBe('');
34
+ });
35
+
36
+ it('does not call intl.formatMessage when the message is falsy', () => {
37
+ const intl = buildIntl('en', {});
38
+ const spy = vi.spyOn(intl, 'formatMessage');
39
+ formatMessageWithFallback(intl, undefined);
40
+ formatMessageWithFallback(intl, null);
41
+ formatMessageWithFallback(intl, '');
42
+ expect(spy).not.toHaveBeenCalled();
43
+ });
44
+ });
@@ -0,0 +1,31 @@
1
+ /**
2
+ * I18n helpers.
3
+ * @module helpers/I18n/I18n
4
+ */
5
+
6
+ import type { IntlShape } from 'react-intl';
7
+
8
+ /**
9
+ * Format a `react-intl` message using a plain string as both the id and the
10
+ * default fallback. Useful when a UI value (e.g. a block title configured as
11
+ * a plain string) should be looked up in the locale catalog when available,
12
+ * and rendered as-is otherwise.
13
+ *
14
+ * Returns the input untouched when it is falsy, so the result can be used
15
+ * directly in `||` fallback chains.
16
+ *
17
+ * @param intl react-intl `intl` instance, typically from `useIntl()`.
18
+ * @param message The string to translate; used as both `id` and
19
+ * `defaultMessage`.
20
+ * @returns Translated text, or `message` unchanged if falsy / no translation.
21
+ */
22
+ export function formatMessageWithFallback<T extends string | undefined | null>(
23
+ intl: IntlShape,
24
+ message: T,
25
+ ): T extends string ? string : T {
26
+ if (!message) return message as T extends string ? string : T;
27
+ return intl.formatMessage({
28
+ id: message,
29
+ defaultMessage: message,
30
+ }) as T extends string ? string : T;
31
+ }
@@ -112,6 +112,7 @@ export {
112
112
  normalizeString,
113
113
  } from '@plone/volto/helpers/Utils/Utils';
114
114
  export { messages } from './MessageLabels/MessageLabels';
115
+ export { formatMessageWithFallback } from './I18n/I18n';
115
116
  export {
116
117
  withBlockSchemaEnhancer,
117
118
  withVariationSchemaEnhancer,
package/src/server.jsx CHANGED
@@ -243,7 +243,13 @@ server.get('/*', (req, res) => {
243
243
  : store.getState().content.data?.language?.token ||
244
244
  config.settings.defaultLanguage;
245
245
 
246
- if (toBackendLang(initialLang) !== contentLang && url !== '/') {
246
+ const isMultilingual = config.settings.isMultilingual;
247
+
248
+ if (
249
+ toBackendLang(initialLang) !== contentLang &&
250
+ !/\/\.well-known\/.*$/.test(location.pathname) &&
251
+ !(isMultilingual && location.pathname === '/')
252
+ ) {
247
253
  const newLang = toReactIntlLang(
248
254
  new locale.Locales(contentLang).best(supported).toString(),
249
255
  );
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  state: {
4
4
  isObjectBrowserOpen: boolean;
5
5
  };
6
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
6
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
7
7
  mode: string;
8
8
  dataName: string;
9
9
  onSelectItem: string;
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  state: {
4
4
  isObjectBrowserOpen: boolean;
5
5
  };
6
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
6
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
7
7
  mode: string;
8
8
  dataName: string;
9
9
  onSelectItem: string;
@@ -31,7 +31,7 @@ declare function withObjectBrowser(WrappedComponent: any): {
31
31
  * }),
32
32
  * });
33
33
  */
34
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
34
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
35
35
  mode: string;
36
36
  dataName: string;
37
37
  onSelectItem: string;
@@ -10,7 +10,7 @@ export const ImageInput: {
10
10
  state: {
11
11
  isObjectBrowserOpen: boolean;
12
12
  };
13
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
13
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
14
14
  mode: string;
15
15
  dataName: string;
16
16
  onSelectItem: string;
@@ -41,7 +41,7 @@ declare const _default: {
41
41
  state: {
42
42
  isObjectBrowserOpen: boolean;
43
43
  };
44
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
44
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
45
45
  mode: string;
46
46
  dataName: string;
47
47
  onSelectItem: string;
@@ -13,10 +13,6 @@ export function objectSchema({ intl, isDisabled, value }: {
13
13
  title: any;
14
14
  widget: string;
15
15
  };
16
- depth: {
17
- title: any;
18
- type: string;
19
- };
20
16
  sort_on: {
21
17
  title: any;
22
18
  widget: string;
@@ -41,7 +41,7 @@ declare const _default: {
41
41
  state: {
42
42
  isObjectBrowserOpen: boolean;
43
43
  };
44
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
44
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
45
45
  mode: string;
46
46
  dataName: string;
47
47
  onSelectItem: string;
@@ -23,7 +23,7 @@ export declare const UrlWidget: import("@loadable/component").LoadableClassCompo
23
23
  state: {
24
24
  isObjectBrowserOpen: boolean;
25
25
  };
26
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
26
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
27
27
  mode: string;
28
28
  dataName: string;
29
29
  onSelectItem: string;
@@ -63,7 +63,7 @@ export declare const InternalUrlWidget: import("@loadable/component").LoadableCl
63
63
  state: {
64
64
  isObjectBrowserOpen: boolean;
65
65
  };
66
- openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, onlyFolderishSelectable, }?: {
66
+ openObjectBrowser: ({ mode, onSelectItem, dataName, overlay, propDataName, searchableTypes, selectableTypes, maximumSelectionSize, currentPath, initialPath, onlyFolderishSelectable, }?: {
67
67
  mode: string;
68
68
  dataName: string;
69
69
  onSelectItem: string;
@@ -0,0 +1,19 @@
1
+ export const Default: any;
2
+ export const EventViewAllProps: any;
3
+ export const EventViewWithoutLinkToApiInTheText: any;
4
+ declare namespace _default {
5
+ export let title: string;
6
+ export { EventViewComponent as component };
7
+ export let decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
8
+ export namespace argTypes {
9
+ namespace end {
10
+ let control: string;
11
+ }
12
+ namespace start {
13
+ let control_1: string;
14
+ export { control_1 as control };
15
+ }
16
+ }
17
+ }
18
+ export default _default;
19
+ import EventViewComponent from './EventView';
@@ -0,0 +1,18 @@
1
+ export const Default: any;
2
+ declare namespace _default {
3
+ export let title: string;
4
+ export { FileViewComponent as component };
5
+ export let decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
6
+ export namespace argTypes {
7
+ export namespace title_1 {
8
+ let description: string;
9
+ }
10
+ export { title_1 as title };
11
+ export namespace filename {
12
+ let description_1: string;
13
+ export { description_1 as description };
14
+ }
15
+ }
16
+ }
17
+ export default _default;
18
+ import FileViewComponent from './FileView';