@pronto-tools-and-more/components 8.10.0 → 8.11.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/dist/main.js CHANGED
@@ -411,77 +411,105 @@ var SearchLink = ({ message } = {}) => {
411
411
  return /* @__PURE__ */ React.createElement("div", { className: "SearchLink" }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
412
412
  };
413
413
 
414
+ // src/parts/GetFilterLanguage/GetFilterLanguage.ts
415
+ var getFilterLanguage = (language) => {
416
+ switch (language) {
417
+ case "de":
418
+ return "de-de";
419
+ case "en":
420
+ return "en-gb";
421
+ case "es":
422
+ return "es-es";
423
+ case "":
424
+ case void 0:
425
+ return "";
426
+ default:
427
+ throw new Error(`unsupported language: ${language}`);
428
+ }
429
+ };
430
+
414
431
  // src/parts/SearchResults/SearchResults.tsx
415
432
  var SearchResults = ({
416
- render
433
+ render,
434
+ language
417
435
  }) => {
436
+ const filterLanguage = getFilterLanguage(language);
437
+ const filterAnd = [
438
+ {
439
+ OR: [
440
+ {
441
+ contentType: {
442
+ value: "POST"
443
+ }
444
+ },
445
+ {
446
+ contentType: {
447
+ value: "BUNDLE"
448
+ }
449
+ }
450
+ ]
451
+ },
452
+ {
453
+ postType: {
454
+ value: "post"
455
+ }
456
+ },
457
+ {
458
+ condition: {
459
+ value: "$context.issue-age",
460
+ compareValue: "day"
461
+ },
462
+ age: {
463
+ count: 1,
464
+ unit: "DAY"
465
+ }
466
+ },
467
+ {
468
+ condition: {
469
+ value: "$context.issue-age",
470
+ compareValue: "week"
471
+ },
472
+ age: {
473
+ count: 1,
474
+ unit: "WEEK"
475
+ }
476
+ },
477
+ {
478
+ condition: {
479
+ value: "$context.issue-age",
480
+ compareValue: "month"
481
+ },
482
+ age: {
483
+ count: 1,
484
+ unit: "MONTH"
485
+ }
486
+ },
487
+ {
488
+ condition: {
489
+ value: "$context.issue-age",
490
+ compareValue: "year"
491
+ },
492
+ age: {
493
+ count: 1,
494
+ unit: "YEAR"
495
+ }
496
+ }
497
+ ];
498
+ if (filterLanguage) {
499
+ filterAnd.push({
500
+ properties: {
501
+ key: "language",
502
+ value: filterLanguage
503
+ }
504
+ });
505
+ }
418
506
  const json = {
419
507
  render,
420
508
  dataSource: {
421
509
  phrase: "$context.phrase",
422
510
  type: "search-result",
423
511
  filter: {
424
- AND: [
425
- {
426
- OR: [
427
- {
428
- contentType: {
429
- value: "POST"
430
- }
431
- },
432
- {
433
- contentType: {
434
- value: "BUNDLE"
435
- }
436
- }
437
- ]
438
- },
439
- {
440
- postType: {
441
- value: "post"
442
- }
443
- },
444
- {
445
- condition: {
446
- value: "$context.issue-age",
447
- compareValue: "day"
448
- },
449
- age: {
450
- count: 1,
451
- unit: "DAY"
452
- }
453
- },
454
- {
455
- condition: {
456
- value: "$context.issue-age",
457
- compareValue: "week"
458
- },
459
- age: {
460
- count: 1,
461
- unit: "WEEK"
462
- }
463
- },
464
- {
465
- condition: {
466
- value: "$context.issue-age",
467
- compareValue: "month"
468
- },
469
- age: {
470
- count: 1,
471
- unit: "MONTH"
472
- }
473
- },
474
- {
475
- condition: {
476
- value: "$context.issue-age",
477
- compareValue: "year"
478
- },
479
- age: {
480
- count: 1,
481
- unit: "YEAR"
482
- }
483
- }
484
- ]
512
+ AND: filterAnd
485
513
  },
486
514
  contextKey: "searchResults",
487
515
  searchOptions: {
@@ -0,0 +1 @@
1
+ export declare const getFilterLanguage: (language: string | undefined) => string;
@@ -1,4 +1,5 @@
1
1
  import type { ISearchResultItemRenderer } from "../ISearchResultComponent/ISearchResultComponent.tsx";
2
- export declare const SearchResults: ({ render, }: {
2
+ export declare const SearchResults: ({ render, language, }: {
3
3
  render: ISearchResultItemRenderer;
4
+ language?: string;
4
5
  }) => import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pronto-tools-and-more/components",
3
- "version": "8.10.0",
3
+ "version": "8.11.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",