@pronto-tools-and-more/components 8.10.0 → 8.12.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
@@ -4,6 +4,24 @@ var JsonComponent = ({ json }) => {
4
4
  return node;
5
5
  };
6
6
 
7
+ // src/parts/Button/Button.tsx
8
+ var Button = ({
9
+ message,
10
+ to,
11
+ className
12
+ }) => {
13
+ const json = {
14
+ type: "button",
15
+ message,
16
+ tap: {
17
+ type: "navigate",
18
+ path: to
19
+ }
20
+ };
21
+ const fullClassName = `Button ${className || ""}`;
22
+ return /* @__PURE__ */ React.createElement("div", { className: fullClassName }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
23
+ };
24
+
7
25
  // src/parts/Collection/Collection.tsx
8
26
  var Collection = ({
9
27
  limit,
@@ -411,77 +429,107 @@ var SearchLink = ({ message } = {}) => {
411
429
  return /* @__PURE__ */ React.createElement("div", { className: "SearchLink" }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
412
430
  };
413
431
 
432
+ // src/parts/GetFilterLanguage/GetFilterLanguage.ts
433
+ var getFilterLanguage = (language) => {
434
+ switch (language) {
435
+ case "de":
436
+ return "de-de";
437
+ case "en":
438
+ return "en-gb";
439
+ case "es":
440
+ return "es-es";
441
+ case "fr":
442
+ return "fr-fr";
443
+ case "":
444
+ case void 0:
445
+ return "";
446
+ default:
447
+ throw new Error(`unsupported language: ${language}`);
448
+ }
449
+ };
450
+
414
451
  // src/parts/SearchResults/SearchResults.tsx
415
452
  var SearchResults = ({
416
- render
453
+ render,
454
+ language
417
455
  }) => {
456
+ const filterLanguage = getFilterLanguage(language);
457
+ const filterAnd = [
458
+ {
459
+ OR: [
460
+ {
461
+ contentType: {
462
+ value: "POST"
463
+ }
464
+ },
465
+ {
466
+ contentType: {
467
+ value: "BUNDLE"
468
+ }
469
+ }
470
+ ]
471
+ },
472
+ {
473
+ postType: {
474
+ value: "post"
475
+ }
476
+ },
477
+ {
478
+ condition: {
479
+ value: "$context.issue-age",
480
+ compareValue: "day"
481
+ },
482
+ age: {
483
+ count: 1,
484
+ unit: "DAY"
485
+ }
486
+ },
487
+ {
488
+ condition: {
489
+ value: "$context.issue-age",
490
+ compareValue: "week"
491
+ },
492
+ age: {
493
+ count: 1,
494
+ unit: "WEEK"
495
+ }
496
+ },
497
+ {
498
+ condition: {
499
+ value: "$context.issue-age",
500
+ compareValue: "month"
501
+ },
502
+ age: {
503
+ count: 1,
504
+ unit: "MONTH"
505
+ }
506
+ },
507
+ {
508
+ condition: {
509
+ value: "$context.issue-age",
510
+ compareValue: "year"
511
+ },
512
+ age: {
513
+ count: 1,
514
+ unit: "YEAR"
515
+ }
516
+ }
517
+ ];
518
+ if (filterLanguage) {
519
+ filterAnd.push({
520
+ properties: {
521
+ key: "lang",
522
+ value: filterLanguage
523
+ }
524
+ });
525
+ }
418
526
  const json = {
419
527
  render,
420
528
  dataSource: {
421
529
  phrase: "$context.phrase",
422
530
  type: "search-result",
423
531
  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
- ]
532
+ AND: filterAnd
485
533
  },
486
534
  contextKey: "searchResults",
487
535
  searchOptions: {
@@ -525,6 +573,7 @@ var SubscriptionLink = ({ message } = {}) => {
525
573
  return /* @__PURE__ */ React.createElement("div", { className: "SubscriptionLink" }, /* @__PURE__ */ React.createElement(JsonComponent, { json }));
526
574
  };
527
575
  export {
576
+ Button,
528
577
  Collection,
529
578
  Container,
530
579
  ContentBody,
@@ -1,3 +1,4 @@
1
+ export * from "../Button/Button.tsx";
1
2
  export * from "../Collection/Collection.tsx";
2
3
  export * from "../Container/Container.tsx";
3
4
  export * from "../ContentBody/ContentBody.tsx";
@@ -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.12.0",
4
4
  "description": "",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",