@plone/volto 19.0.0-alpha.6 → 19.0.0-alpha.8

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 (109) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +2 -2
  3. package/cypress/support/commands.js +5 -6
  4. package/locales/af.json +1 -1
  5. package/locales/ar.json +1 -1
  6. package/locales/bg.json +1 -1
  7. package/locales/bn.json +1 -1
  8. package/locales/ca/LC_MESSAGES/volto.po +20 -5
  9. package/locales/ca.json +1 -1
  10. package/locales/cs.json +1 -1
  11. package/locales/cy.json +1 -1
  12. package/locales/da.json +1 -1
  13. package/locales/de/LC_MESSAGES/volto.po +20 -5
  14. package/locales/de.json +1 -1
  15. package/locales/el.json +1 -1
  16. package/locales/en/LC_MESSAGES/volto.po +20 -5
  17. package/locales/en.json +1 -1
  18. package/locales/en_AU.json +1 -1
  19. package/locales/en_GB.json +1 -1
  20. package/locales/eo.json +1 -1
  21. package/locales/es/LC_MESSAGES/volto.po +20 -5
  22. package/locales/es.json +1 -1
  23. package/locales/et.json +1 -1
  24. package/locales/eu/LC_MESSAGES/volto.po +20 -5
  25. package/locales/eu.json +1 -1
  26. package/locales/fa.json +1 -1
  27. package/locales/fi/LC_MESSAGES/volto.po +20 -5
  28. package/locales/fi.json +1 -1
  29. package/locales/fr/LC_MESSAGES/volto.po +20 -5
  30. package/locales/fr.json +1 -1
  31. package/locales/fu.json +1 -1
  32. package/locales/gl.json +1 -1
  33. package/locales/he.json +1 -1
  34. package/locales/hi/LC_MESSAGES/volto.po +20 -5
  35. package/locales/hi.json +1 -1
  36. package/locales/hr.json +1 -1
  37. package/locales/hu.json +1 -1
  38. package/locales/hy.json +1 -1
  39. package/locales/id.json +1 -1
  40. package/locales/it/LC_MESSAGES/volto.po +21 -6
  41. package/locales/it.json +1 -1
  42. package/locales/ja/LC_MESSAGES/volto.po +20 -5
  43. package/locales/ja.json +1 -1
  44. package/locales/ka.json +1 -1
  45. package/locales/kn.json +1 -1
  46. package/locales/ko.json +1 -1
  47. package/locales/lt.json +1 -1
  48. package/locales/lv.json +1 -1
  49. package/locales/mi.json +1 -1
  50. package/locales/mk.json +1 -1
  51. package/locales/my.json +1 -1
  52. package/locales/nb_NO.json +1 -1
  53. package/locales/nl/LC_MESSAGES/volto.po +20 -5
  54. package/locales/nl.json +1 -1
  55. package/locales/nn.json +1 -1
  56. package/locales/pl.json +1 -1
  57. package/locales/pt/LC_MESSAGES/volto.po +20 -5
  58. package/locales/pt.json +1 -1
  59. package/locales/pt_BR/LC_MESSAGES/volto.po +20 -5
  60. package/locales/pt_BR.json +1 -1
  61. package/locales/rm.json +1 -1
  62. package/locales/ro/LC_MESSAGES/volto.po +20 -5
  63. package/locales/ro.json +1 -1
  64. package/locales/ru/LC_MESSAGES/volto.po +20 -5
  65. package/locales/ru.json +1 -1
  66. package/locales/sk.json +1 -1
  67. package/locales/sl.json +1 -1
  68. package/locales/sm.json +1 -1
  69. package/locales/sq.json +1 -1
  70. package/locales/sr.json +1 -1
  71. package/locales/sr@cyrl.json +1 -1
  72. package/locales/sr@latn.json +1 -1
  73. package/locales/sv.json +1 -1
  74. package/locales/ta.json +1 -1
  75. package/locales/te.json +1 -1
  76. package/locales/th.json +1 -1
  77. package/locales/to.json +1 -1
  78. package/locales/tr.json +1 -1
  79. package/locales/uk.json +1 -1
  80. package/locales/vi.json +1 -1
  81. package/locales/volto.pot +21 -6
  82. package/locales/zh_CN/LC_MESSAGES/volto.po +20 -5
  83. package/locales/zh_CN.json +1 -1
  84. package/locales/zh_Hant.json +1 -1
  85. package/locales/zh_Hant_HK.json +1 -1
  86. package/package.json +11 -10
  87. package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +9 -4
  88. package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +3 -2
  89. package/src/components/manage/Widgets/DatetimeWidget.jsx +5 -0
  90. package/src/components/manage/Widgets/InternalUrlWidget.jsx +2 -0
  91. package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +3 -0
  92. package/src/components/manage/Widgets/UrlWidget.jsx +2 -0
  93. package/src/components/theme/LanguageSelector/LanguageSelector.tsx +89 -0
  94. package/src/helpers/Content/withClientSideContent.jsx +35 -0
  95. package/src/helpers/Html/Html.jsx +1 -9
  96. package/src/helpers/MessageLabels/MessageLabels.js +5 -0
  97. package/src/middleware/api.js +2 -2
  98. package/src/routes.js +3 -1
  99. package/theme/themes/pastanaga/extras/main.less +4 -0
  100. package/tsconfig.json +3 -4
  101. package/types/components/theme/LanguageSelector/LanguageSelector.d.ts +3 -10
  102. package/types/helpers/Content/withClientSideContent.d.ts +1 -0
  103. package/types/helpers/MessageLabels/MessageLabels.d.ts +68 -62
  104. package/types/reducers/index.d.ts +1 -0
  105. package/package-why.json +0 -34
  106. package/src/components/theme/LanguageSelector/LanguageSelector.jsx +0 -79
  107. package/src/helpers/Url/bulkFlattenToAppURL.test.ts +0 -122
  108. package/src/helpers/Url/bulkFlattenToAppURL.ts +0 -24
  109. /package/src/components/theme/LanguageSelector/{LanguageSelector.test.jsx → LanguageSelector.test.tsx} +0 -0
@@ -1,122 +0,0 @@
1
- import { describe, it, expect, afterEach } from 'vitest';
2
- import config from '@plone/registry';
3
- import { bulkFlattenToAppURL } from './bulkFlattenToAppURL';
4
-
5
- const API_PATH = 'http://example.com/api';
6
- const INTERNAL_API_PATH = 'http://backend/api';
7
-
8
- describe('bulkFlattenToAppURL', () => {
9
- afterEach(() => {
10
- config.settings = {};
11
- });
12
-
13
- it('should flatten URLs correctly with API_PATH', () => {
14
- config.settings.apiPath = API_PATH;
15
-
16
- const input = {
17
- '@id': `${API_PATH}/path/to/resource`,
18
- anotherField: `${API_PATH}/another/path`,
19
- nested: {
20
- '@id': `${API_PATH}/nested/resource`,
21
- anotherNestedField: `${API_PATH}/nested/another/path`,
22
- },
23
- arrayField: [
24
- {
25
- '@id': `${API_PATH}/array/resource/1`,
26
- anotherArrayField: `${API_PATH}/array/another/path/1`,
27
- },
28
- {
29
- '@id': `${API_PATH}/array/resource/2`,
30
- anotherArrayField: `${API_PATH}/array/another/path/2`,
31
- },
32
- ],
33
- stringField: 'This is a string',
34
- numberField: 42,
35
- booleanField: true,
36
- nullField: null,
37
- undefinedField: undefined,
38
- };
39
-
40
- const expectedOutput = {
41
- '@id': '/path/to/resource',
42
- anotherField: '/another/path',
43
- nested: {
44
- '@id': '/nested/resource',
45
- anotherNestedField: '/nested/another/path',
46
- },
47
- arrayField: [
48
- {
49
- '@id': '/array/resource/1',
50
- anotherArrayField: '/array/another/path/1',
51
- },
52
- {
53
- '@id': '/array/resource/2',
54
- anotherArrayField: '/array/another/path/2',
55
- },
56
- ],
57
- stringField: 'This is a string',
58
- numberField: 42,
59
- booleanField: true,
60
- nullField: null,
61
- undefinedField: undefined,
62
- };
63
-
64
- const result = bulkFlattenToAppURL(input as any);
65
- expect(result).toEqual(expectedOutput);
66
- });
67
-
68
- it('should flatten URLs correctly with INTERNAL_API_PATH', () => {
69
- config.settings.internalApiPath = INTERNAL_API_PATH;
70
-
71
- const input = {
72
- '@id': `${INTERNAL_API_PATH}/path/to/resource`,
73
- anotherField: `${INTERNAL_API_PATH}/another/path`,
74
- nested: {
75
- '@id': `${INTERNAL_API_PATH}/nested/resource`,
76
- anotherNestedField: `${INTERNAL_API_PATH}/nested/another/path`,
77
- },
78
- arrayField: [
79
- {
80
- '@id': `${INTERNAL_API_PATH}/array/resource/1`,
81
- anotherArrayField: `${INTERNAL_API_PATH}/array/another/path/1`,
82
- },
83
- {
84
- '@id': `${INTERNAL_API_PATH}/array/resource/2`,
85
- anotherArrayField: `${INTERNAL_API_PATH}/array/another/path/2`,
86
- },
87
- ],
88
- stringField: 'This is a string',
89
- numberField: 42,
90
- booleanField: true,
91
- nullField: null,
92
- undefinedField: undefined,
93
- };
94
-
95
- const expectedOutput = {
96
- '@id': '/path/to/resource',
97
- anotherField: '/another/path',
98
- nested: {
99
- '@id': '/nested/resource',
100
- anotherNestedField: '/nested/another/path',
101
- },
102
- arrayField: [
103
- {
104
- '@id': '/array/resource/1',
105
- anotherArrayField: '/array/another/path/1',
106
- },
107
- {
108
- '@id': '/array/resource/2',
109
- anotherArrayField: '/array/another/path/2',
110
- },
111
- ],
112
- stringField: 'This is a string',
113
- numberField: 42,
114
- booleanField: true,
115
- nullField: null,
116
- undefinedField: undefined,
117
- };
118
-
119
- const result = bulkFlattenToAppURL(input as any);
120
- expect(result).toEqual(expectedOutput);
121
- });
122
- });
@@ -1,24 +0,0 @@
1
- import config from '@plone/registry';
2
-
3
- /**
4
- * The definitive flattenToAppURL function
5
- * Flattens all the URLs in the response to the current app URL (or internalApiPath if set).
6
- */
7
- export function bulkFlattenToAppURL<T>(data: T) {
8
- // Convert data to string to perform replacements
9
- let stringData = JSON.stringify(data);
10
-
11
- // Replace all occurrences of backend URLs
12
- stringData = stringData.replaceAll(`${config.settings.apiPath}/`, '/');
13
- stringData = stringData.replaceAll(config.settings.apiPath, '/');
14
- if (config.settings.internalApiPath) {
15
- stringData = stringData.replaceAll(
16
- `${config.settings.internalApiPath}/`,
17
- '/',
18
- );
19
- stringData = stringData.replaceAll(config.settings.internalApiPath, '/');
20
- }
21
-
22
- // Parse back to object
23
- return JSON.parse(stringData) as T;
24
- }