@plone/volto 18.13.0 → 18.14.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/CHANGELOG.md CHANGED
@@ -17,6 +17,12 @@ myst:
17
17
 
18
18
  <!-- towncrier release notes start -->
19
19
 
20
+ ## 18.14.0 (2025-04-23)
21
+
22
+ ### Feature
23
+
24
+ - Added current evaluated `querystring` as a parameter in expander's `querystring` key when it's a function. @sneridagh [#7012](https://github.com/plone/volto/issues/7012)
25
+
20
26
  ## 18.13.0 (2025-04-22)
21
27
 
22
28
  ### Feature
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "18.13.0",
12
+ "version": "18.14.0",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -236,8 +236,8 @@
236
236
  "url": "^0.11.3",
237
237
  "use-deep-compare-effect": "1.8.1",
238
238
  "uuid": "^8.3.2",
239
- "@plone/volto-slate": "18.3.0",
240
239
  "@plone/scripts": "3.9.0",
240
+ "@plone/volto-slate": "18.3.0",
241
241
  "@plone/registry": "2.5.1"
242
242
  },
243
243
  "devDependencies": {
@@ -282,4 +282,51 @@ describe('api middleware helpers', () => {
282
282
  '/de/mypage?expand=navigation&expand.navigation.coolness=1&expand.navigation.depth=3&someotherquery=1&someotherquery=2',
283
283
  );
284
284
  });
285
+
286
+ it('addExpandersToPath - inherit expander merged using querystring as a function', () => {
287
+ config.settings.apiExpanders = [
288
+ {
289
+ match: '/',
290
+ GET_CONTENT: ['navigation'],
291
+ querystring: {
292
+ 'expand.navigation.depth': 3,
293
+ 'expand.navigation.coolness': 1,
294
+ },
295
+ },
296
+ {
297
+ match: '/',
298
+ GET_CONTENT: ['inherit'],
299
+ querystring: {
300
+ 'expand.inherit.behaviors':
301
+ 'voltolighttheme.header,voltolighttheme.theme,voltolighttheme.footer',
302
+ },
303
+ },
304
+ {
305
+ match: '/',
306
+ GET_CONTENT: ['inherit'],
307
+ querystring: (config, querystring) => {
308
+ if (querystring['expand.inherit.behaviors']) {
309
+ return {
310
+ 'expand.inherit.behaviors': querystring[
311
+ 'expand.inherit.behaviors'
312
+ ].concat(',', 'plonegovbr.socialmedia.settings'),
313
+ };
314
+ } else {
315
+ return {
316
+ 'expand.inherit.behaviors': 'plonegovbr.socialmedia.settings',
317
+ };
318
+ }
319
+ },
320
+ },
321
+ ];
322
+
323
+ const result = addExpandersToPath(
324
+ '/de/mypage?someotherquery=1&someotherquery=2',
325
+ GET_CONTENT,
326
+ );
327
+
328
+ expect(result).toEqual(
329
+ '/de/mypage?expand=navigation,inherit&expand.inherit.behaviors=voltolighttheme.header,voltolighttheme.theme,voltolighttheme.footer,plonegovbr.socialmedia.settings&expand.navigation.coolness=1&expand.navigation.depth=3&someotherquery=1&someotherquery=2',
330
+ );
331
+ });
285
332
  });
@@ -75,7 +75,7 @@ export function addExpandersToPath(path, type, isAnonymous) {
75
75
  // The querystring accepts being a function to be able to take other
76
76
  // config parameters
77
77
  if (typeof querystring === 'function') {
78
- querystring = querystring(config);
78
+ querystring = querystring(config, acc);
79
79
  }
80
80
  return { ...acc, ...querystring };
81
81
  }, {});