@ecodev/natural 55.1.1 → 55.3.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.
@@ -6,7 +6,7 @@ import * as i0 from "@angular/core";
6
6
  /**
7
7
  * Usage :
8
8
  *
9
- * <mat-tab-group mat-stretch-tabs="false" [naturalLinkableTab]="!isPanel">
9
+ * <mat-tab-group [naturalLinkableTab]="!isPanel">
10
10
  * <mat-tab label="Third 1">third 1</mat-tab> // First tab doesn't need id. This keeps url clean on default one
11
11
  * <mat-tab label="Third 2" id="third2">Third 2</mat-tab>
12
12
  * ...
@@ -1,6 +1,7 @@
1
1
  import { InjectionToken } from '@angular/core';
2
2
  import { Meta, Title } from '@angular/platform-browser';
3
3
  import { Data, Router } from '@angular/router';
4
+ import { Observable } from 'rxjs';
4
5
  import * as i0 from "@angular/core";
5
6
  export type NaturalSeo = NaturalSeoBasic | NaturalSeoCallback | NaturalSeoResolve;
6
7
  /**
@@ -18,6 +19,10 @@ export type NaturalSeoBasic = Robots & {
18
19
  * If given will be used as page description, otherwise fallback on default value
19
20
  */
20
21
  description?: string;
22
+ /**
23
+ * List of parameters included in the canonical tag's url
24
+ */
25
+ canonicalQueryParamsWhitelist?: string[];
21
26
  };
22
27
  /**
23
28
  * Typically used for a "dynamic" page where a single object is resolved. So a detail page, such
@@ -52,19 +57,19 @@ interface Robots {
52
57
  */
53
58
  robots?: string;
54
59
  }
55
- export interface NaturalSeoConfig {
60
+ interface NaturalSeoConfigPlain {
56
61
  /**
57
62
  * The name of the application that will always appear in the page title
58
63
  */
59
- applicationName: string;
64
+ readonly applicationName: string;
60
65
  /**
61
66
  * Default value for description meta that is used for pages without value
62
67
  */
63
- defaultDescription?: string;
68
+ readonly defaultDescription?: string;
64
69
  /**
65
70
  * Default value for robots meta that is used for pages without value
66
71
  */
67
- defaultRobots?: string;
72
+ readonly defaultRobots?: string;
68
73
  /**
69
74
  * If given, the callback will be called for each route and must return a string that will
70
75
  * be inserted between the page title and the application name.
@@ -72,8 +77,14 @@ export interface NaturalSeoConfig {
72
77
  * It should be used to complete the title with info that are often, but not necessarily always,
73
78
  * available throughout the entire application. Typically used for the site/state in OKpilot.
74
79
  */
75
- extraPart?: (routeData: Data) => string;
80
+ readonly extraPart?: (routeData: Data) => string;
81
+ /**
82
+ * Used to generate alternative tags
83
+ * <link rel="alternate" hreflang="en" href="https://www.example.com/en/page">
84
+ */
85
+ readonly languages?: Readonly<string[]>;
76
86
  }
87
+ export type NaturalSeoConfig = NaturalSeoConfigPlain | Observable<NaturalSeoConfigPlain>;
77
88
  export declare const NATURAL_SEO_CONFIG: InjectionToken<NaturalSeoConfig>;
78
89
  export declare function stripTags(str: string): string;
79
90
  /**
@@ -91,24 +102,38 @@ export declare function stripTags(str: string): string;
91
102
  * configured for it in the routing.
92
103
  */
93
104
  export declare class NaturalSeoService {
94
- private readonly config;
95
105
  private readonly router;
96
106
  private readonly titleService;
97
107
  private readonly metaTagService;
108
+ private readonly document;
109
+ private locale;
98
110
  private routeData?;
99
- constructor(config: NaturalSeoConfig, router: Router, titleService: Title, metaTagService: Meta);
111
+ private config;
112
+ constructor(configToken: NaturalSeoConfig, router: Router, titleService: Title, metaTagService: Meta, document: Document, locale: string);
100
113
  /**
101
114
  * Update the SEO with given info. The extra part and app name will be appended automatically.
102
115
  *
103
- * In most cases this should not be used, and instead the SEO should be configured in the routing,
116
+ * In most cases, this should not be used. And instead, the SEO should be configured in the routing,
104
117
  * possibly with the callback variant for some dynamism.
105
118
  *
106
- * But in rare cases only the Component is able to build a proper page title, after it gather everything it
107
- * needed. For those cases the Component can inject this service and update the SEO directly.
119
+ * But in rare cases, only the Component is able to build a proper page title, after it gathered everything it
120
+ * needed. For those cases, the Component can inject this service and update the SEO directly.
108
121
  */
109
122
  update(seo: NaturalSeoBasic): void;
123
+ private updateAlternates;
124
+ private getUrlParts;
125
+ /**
126
+ * Add language between domain and uri https://example.com/fr/folder/page
127
+ */
128
+ private getUrl;
129
+ private addLanguageSegment;
110
130
  private join;
111
131
  private updateTag;
132
+ private updateLinkTag;
133
+ /**
134
+ * Returns selector to use in querySelector to get the given link
135
+ */
136
+ private parseSelector;
112
137
  /**
113
138
  * Returns the data from the most deep/specific activated route
114
139
  */
@@ -25,7 +25,7 @@ export declare class NaturalPanelsService {
25
25
  /**
26
26
  * Stream that emits when all open dialog have finished closing
27
27
  */
28
- afterAllClosed: Subject<void>;
28
+ readonly afterAllClosed: Subject<void>;
29
29
  /**
30
30
  * Cache for panels counter. Works more like an ID.
31
31
  * Is used to give an unique identifier to multiple similar panels configurations
@@ -19,7 +19,7 @@ export declare class NaturalDropdownContainerComponent extends BasePortalOutlet
19
19
  /** Current state of the panel animation. */
20
20
  panelAnimationState: 'void' | 'enter';
21
21
  /** Emits whenever an animation on the menu completes. */
22
- private animationDone;
22
+ private readonly animationDone;
23
23
  private focusTrap;
24
24
  private elementFocusedBeforeDialogWasOpened;
25
25
  constructor(elementRef: ElementRef<HTMLElement>, focusTrapFactory: ConfigurableFocusTrapFactory, data: NaturalDropdownContainerData);
@@ -14,7 +14,7 @@ export interface FacetSelectorConfiguration {
14
14
  export declare class FacetSelectorComponent implements DropdownComponent {
15
15
  data: NaturalDropdownData<FacetSelectorConfiguration>;
16
16
  protected dropdownRef: NaturalDropdownRef;
17
- renderedValue: BehaviorSubject<string>;
17
+ readonly renderedValue: BehaviorSubject<string>;
18
18
  facets: NaturalSearchFacets;
19
19
  selection: Facet | null;
20
20
  constructor(data: NaturalDropdownData<FacetSelectorConfiguration>, dropdownRef: NaturalDropdownRef);
@@ -89,7 +89,7 @@ export declare class NaturalSelectComponent<TService extends NaturalAbstractMode
89
89
  /**
90
90
  * Init search options
91
91
  */
92
- private variablesManager;
92
+ private readonly variablesManager;
93
93
  /**
94
94
  * Whether the value can be changed
95
95
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecodev/natural",
3
- "version": "55.1.1",
3
+ "version": "55.3.0",
4
4
  "license": "MIT",
5
5
  "repository": "github:Ecodev/natural",
6
6
  "sideEffects": false,