create-sitecore-jss 22.10.0-canary.9 → 22.11.0-canary.2

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 (100) hide show
  1. package/dist/templates/angular/angular.json +133 -133
  2. package/dist/templates/angular/package.json +118 -119
  3. package/dist/templates/angular/scripts/generate-component-factory/template.ts +1 -3
  4. package/dist/templates/angular/server.bundle.ts +3 -2
  5. package/dist/templates/angular/src/app/ViewBag.ts +4 -0
  6. package/dist/templates/angular/src/app/app.component.ts +10 -9
  7. package/dist/templates/angular/src/app/app.module.ts +3 -1
  8. package/dist/templates/angular/src/app/app.server.module.ts +4 -5
  9. package/dist/templates/angular/src/app/components/app-components.shared.module.ts +16 -3
  10. package/dist/templates/angular/src/app/components/content-block/content-block.component.ts +2 -1
  11. package/dist/templates/angular/src/app/i18n/jss-translation-client-loader.service.ts +3 -2
  12. package/dist/templates/angular/src/app/i18n/jss-translation-server-loader.service.ts +6 -4
  13. package/dist/templates/angular/src/app/injection-tokens.ts +13 -0
  14. package/dist/templates/angular/src/app/jss-context.server-side.service.ts +8 -10
  15. package/dist/templates/angular/src/app/jss-context.service.ts +6 -4
  16. package/dist/templates/angular/src/app/jss-graphql.module.ts +58 -48
  17. package/dist/templates/angular/src/app/jss-graphql.service.ts +6 -6
  18. package/dist/templates/angular/src/app/jss-meta.service.ts +3 -2
  19. package/dist/templates/angular/src/app/routing/layout/layout.component.ts +10 -4
  20. package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +3 -0
  21. package/dist/templates/angular/src/app/routing/not-found/not-found.component.ts +1 -1
  22. package/dist/templates/angular/src/app/routing/routing.module.ts +3 -4
  23. package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +1 -1
  24. package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +1 -3
  25. package/dist/templates/angular-sxp/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +41 -39
  26. package/dist/templates/angular-sxp/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +5 -3
  27. package/dist/templates/angular-sxp/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +6 -4
  28. package/dist/templates/angular-sxp/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +4 -4
  29. package/dist/templates/angular-sxp/src/app/components/graph-ql-layout/graph-ql-layout.component.html +3 -4
  30. package/dist/templates/angular-sxp/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +4 -4
  31. package/dist/templates/angular-sxp/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +3 -4
  32. package/dist/templates/angular-sxp/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +5 -5
  33. package/dist/templates/angular-sxp/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +2 -5
  34. package/dist/templates/angular-sxp/src/app/components/styleguide-component-params/styleguide-component-params.component.html +8 -4
  35. package/dist/templates/angular-sxp/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +2 -2
  36. package/dist/templates/angular-sxp/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +5 -5
  37. package/dist/templates/angular-sxp/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +7 -3
  38. package/dist/templates/angular-sxp/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +13 -4
  39. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +2 -2
  40. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +20 -16
  41. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +20 -3
  42. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +2 -0
  43. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +4 -1
  44. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +3 -1
  45. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +3 -1
  46. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +4 -4
  47. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +4 -1
  48. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +3 -1
  49. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +2 -0
  50. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +3 -1
  51. package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +3 -1
  52. package/dist/templates/angular-sxp/src/app/components/styleguide-layout/styleguide-layout.component.html +12 -8
  53. package/dist/templates/angular-sxp/src/app/components/styleguide-layout/styleguide-layout.component.ts +2 -4
  54. package/dist/templates/angular-sxp/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +3 -1
  55. package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +18 -15
  56. package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +6 -4
  57. package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +2 -2
  58. package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +4 -4
  59. package/dist/templates/angular-sxp/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +7 -3
  60. package/dist/templates/angular-sxp/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +5 -4
  61. package/dist/templates/angular-sxp/src/app/components/styleguide-section/styleguide-section.component.ts +2 -1
  62. package/dist/templates/angular-sxp/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +7 -4
  63. package/dist/templates/angular-sxp/src/app/components/styleguide-tracking/styleguide-tracking.component.html +6 -2
  64. package/dist/templates/angular-sxp/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +12 -12
  65. package/dist/templates/angular-sxp/src/app/jss-data-fetcher.service.ts +4 -2
  66. package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.ts +10 -0
  67. package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +1 -1
  68. package/dist/templates/angular-sxp/src/app/routing/scripts/visitor-identification/visitor-identification.component.ts +6 -3
  69. package/dist/templates/angular-xmcloud/scripts/generate-component-factory/template.ts +1 -3
  70. package/dist/templates/angular-xmcloud/src/app/components/app-components.shared.module.ts +1 -2
  71. package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.html +6 -4
  72. package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.ts +4 -1
  73. package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +14 -5
  74. package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +3 -0
  75. package/dist/templates/angular-xmcloud/src/app/components/image/image.component.html +21 -23
  76. package/dist/templates/angular-xmcloud/src/app/components/image/image.component.ts +5 -5
  77. package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.html +11 -10
  78. package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.ts +3 -0
  79. package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.html +14 -17
  80. package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.ts +3 -3
  81. package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.html +3 -6
  82. package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.ts +8 -5
  83. package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.ts +4 -4
  84. package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.ts +2 -0
  85. package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.html +4 -6
  86. package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.ts +3 -0
  87. package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +3 -4
  88. package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +3 -0
  89. package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.html +10 -9
  90. package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.ts +3 -0
  91. package/dist/templates/angular-xmcloud/src/app/components/title/title.component.html +4 -5
  92. package/dist/templates/angular-xmcloud/src/app/components/title/title.component.ts +5 -5
  93. package/dist/templates/angular-xmcloud/src/app/jss-link.service.ts +2 -2
  94. package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.html +38 -36
  95. package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.ts +10 -6
  96. package/dist/templates/angular-xmcloud/src/app/routing/scripts/cdp-page-view.component.ts +2 -3
  97. package/dist/templates/angular-xmcloud/src/app/routing/scripts/cloud-sdk-init.component.ts +2 -2
  98. package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.component.ts +13 -0
  99. package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.module.ts +1 -2
  100. package/package.json +2 -2
@@ -1,11 +1,15 @@
1
- import { Component, OnInit, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, OnDestroy, inject } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
2
4
  import { Subscription } from 'rxjs';
3
5
  import { SxaComponent } from '../sxa.component';
4
6
  import { JssContextService } from '../../jss-context.service';
7
+ import { NavigationItemComponent } from './navigation-item.component';
5
8
 
6
9
  @Component({
7
10
  selector: 'app-navigation',
8
11
  templateUrl: './navigation.component.html',
12
+ imports: [CommonModule, JssModule, NavigationItemComponent],
9
13
  host: {
10
14
  'class': 'component navigation',
11
15
  '[id]': 'id',
@@ -17,16 +21,15 @@ export class NavigationComponent extends SxaComponent implements OnInit, OnDestr
17
21
  private contextSubscription: Subscription;
18
22
  isOpenMenu = false;
19
23
  baseLevel = 1;
20
-
21
- constructor(private jssContext: JssContextService) {
22
- super();
23
- }
24
+ private jssContext = inject(JssContextService);
25
+ fieldKeys: string[];
24
26
 
25
27
  ngOnInit() {
26
28
  super.ngOnInit();
27
29
  this.contextSubscription = this.jssContext.state.subscribe((newState) => {
28
30
  this.isEditing = newState.sitecore && newState.sitecore.context.pageEditing;
29
31
  });
32
+ this.fieldKeys = Object.keys(this.rendering.fields || {});
30
33
  }
31
34
 
32
35
  ngOnDestroy() {
@@ -1,4 +1,5 @@
1
- import { Component, OnDestroy, OnInit } from '@angular/core';
1
+ import { Component, OnDestroy, OnInit, inject } from '@angular/core';
2
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
2
3
  import { RichTextField } from '@sitecore-jss/sitecore-jss-angular';
3
4
  import { JssContextService } from '../../jss-context.service';
4
5
  import { SxaComponent } from './../sxa.component';
@@ -7,6 +8,7 @@ import { Subscription } from 'rxjs';
7
8
  @Component({
8
9
  selector: 'app-page-content',
9
10
  templateUrl: './page-content.component.html',
11
+ imports: [JssModule],
10
12
  host: {
11
13
  'class': 'component content',
12
14
  '[class]': 'styles',
@@ -17,10 +19,8 @@ export class PageContentComponent extends SxaComponent implements OnInit, OnDest
17
19
  content?: RichTextField;
18
20
  contextContent?: RichTextField;
19
21
  private contextSubscription: Subscription;
22
+ private jssContext = inject(JssContextService);
20
23
 
21
- constructor(private jssContext: JssContextService) {
22
- super();
23
- }
24
24
  ngOnInit() {
25
25
  super.ngOnInit();
26
26
 
@@ -1,9 +1,11 @@
1
1
  import { Component, OnInit } from '@angular/core';
2
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
2
3
  import { SxaComponent } from '../sxa.component';
3
4
 
4
5
  @Component({
5
6
  selector: 'app-partial-design-dynamic-placeholder',
6
7
  templateUrl: './partial-design-dynamic-placeholder.component.html',
8
+ imports: [JssModule]
7
9
  })
8
10
  export class PartialDesignDynamicPlaceholderComponent extends SxaComponent implements OnInit {
9
11
  sig: string;
@@ -1,5 +1,5 @@
1
1
  <div class="component-content">
2
- <ng-container *ngIf="rendering.fields; else empty">
2
+ @if (rendering.fields) {
3
3
  <div class="field-promoicon">
4
4
  <img *scImage="rendering.fields.PromoIcon" />
5
5
  </div>
@@ -13,9 +13,7 @@
13
13
  <a *scGenericLink="rendering.fields.PromoLink"></a>
14
14
  </div>
15
15
  </div>
16
- </ng-container>
16
+ } @else {
17
+ <span className="is-empty-hint">Promo</span>
18
+ }
17
19
  </div>
18
-
19
- <ng-template #empty>
20
- <span className="is-empty-hint">Promo</span>
21
- </ng-template>
@@ -1,9 +1,12 @@
1
1
  import { Component } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
2
4
  import { SxaComponent } from '../sxa.component';
3
5
 
4
6
  @Component({
5
7
  selector: 'app-promo',
6
8
  templateUrl: './promo.component.html',
9
+ imports: [CommonModule, JssModule],
7
10
  host: {
8
11
  'class': 'component promo',
9
12
  '[class]': "styles",
@@ -1,8 +1,7 @@
1
1
  <div class="component-content">
2
- <ng-container *ngIf="text; else emptyHint">
2
+ @if (text) {
3
3
  <div *scRichText="text"></div>
4
- </ng-container>
5
- <ng-template #emptyHint>
4
+ } @else {
6
5
  <span class="is-empty-hint">Rich text</span>
7
- </ng-template>
6
+ }
8
7
  </div>
@@ -1,10 +1,13 @@
1
1
  import { Component, OnInit } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
2
4
  import { Field } from '@sitecore-jss/sitecore-jss-angular';
3
5
  import { SxaComponent } from '../sxa.component';
4
6
 
5
7
  @Component({
6
8
  selector: 'app-richtext',
7
9
  templateUrl: './richtext.component.html',
10
+ imports: [CommonModule, JssModule],
8
11
  host: {
9
12
  'class': 'component rich-text',
10
13
  '[class]': "styles",
@@ -1,11 +1,12 @@
1
- <div
2
- *ngFor="let ph of enabledPlaceholders"
3
- class="container-fluid"
4
- [ngClass]="getRowClass(+ph - 1)"
5
- >
6
- <div>
7
- <div class="row">
8
- <sc-placeholder [name]="getPlaceholderName(ph)" [rendering]="rendering"> </sc-placeholder>
1
+ @for (ph of enabledPlaceholders; track ph) {
2
+ <div
3
+ class="container-fluid"
4
+ [ngClass]="getRowClass(+ph - 1)"
5
+ >
6
+ <div>
7
+ <div class="row">
8
+ <sc-placeholder [name]="getPlaceholderName(ph)" [rendering]="rendering"> </sc-placeholder>
9
+ </div>
9
10
  </div>
10
11
  </div>
11
- </div>
12
+ }
@@ -1,9 +1,12 @@
1
1
  import { Component } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
2
4
  import { SxaComponent } from '../sxa.component';
3
5
 
4
6
  @Component({
5
7
  selector: 'app-row-splitter',
6
8
  templateUrl: './row-splitter.component.html',
9
+ imports: [CommonModule, JssModule],
7
10
  host: {
8
11
  "class": "component row-splitter",
9
12
  "[class]": "rowSplitterStyles",
@@ -1,10 +1,9 @@
1
1
  <div clas="component-content">
2
2
  <div class="field-title">
3
- <ng-container *ngIf="!pageEditing; else textOnly">
3
+ @if (!pageEditing) {
4
4
  <a *scGenericLink="link"></a>
5
- </ng-container>
5
+ } @else {
6
+ <span *scText="text"></span>
7
+ }
6
8
  </div>
7
9
  </div>
8
- <ng-template #textOnly>
9
- <span *scText="text"></span>
10
- </ng-template>
@@ -1,4 +1,6 @@
1
- import { Component, OnDestroy, OnInit } from '@angular/core';
1
+ import { Component, OnDestroy, OnInit, inject } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
2
4
  import { LinkField, SxaTitleFields, TextField } from '@sitecore-jss/sitecore-jss-angular';
3
5
  import { SxaComponent } from '../sxa.component';
4
6
  import { Subscription } from 'rxjs';
@@ -7,6 +9,7 @@ import { JssContextService } from '../../jss-context.service';
7
9
  @Component({
8
10
  selector: 'app-title',
9
11
  templateUrl: './title.component.html',
12
+ imports: [CommonModule, JssModule],
10
13
  host: {
11
14
  'class': 'component title',
12
15
  '[class]': 'styles',
@@ -19,10 +22,7 @@ export class TitleComponent extends SxaComponent<SxaTitleFields> implements OnIn
19
22
  pageEditing?: boolean;
20
23
 
21
24
  private contextSubscription: Subscription;
22
-
23
- constructor(private jssContext: JssContextService) {
24
- super();
25
- }
25
+ private jssContext = inject(JssContextService);
26
26
 
27
27
  ngOnInit() {
28
28
  super.ngOnInit();
@@ -1,4 +1,4 @@
1
- import { Inject, Injectable } from '@angular/core';
1
+ import { inject, Injectable } from '@angular/core';
2
2
  import { DOCUMENT } from '@angular/common';
3
3
  import { HTMLLink } from '@sitecore-jss/sitecore-jss-angular';
4
4
 
@@ -6,7 +6,7 @@ import { HTMLLink } from '@sitecore-jss/sitecore-jss-angular';
6
6
  providedIn: 'root',
7
7
  })
8
8
  export class JssLinkService {
9
- constructor(@Inject(DOCUMENT) private document: Document) {}
9
+ private document = inject(DOCUMENT);
10
10
 
11
11
  /**
12
12
  * Adds link element in the document head.
@@ -1,38 +1,40 @@
1
1
  <div class="{{ mainClassPageEditing }}">
2
- <ng-container *ngIf="state === LayoutState.Layout">
3
- <app-scripts></app-scripts>
4
- <header>
5
- <div id="header">
6
- <sc-placeholder
7
- name="headless-header"
8
- [rendering]="route"
9
- (loaded)="onPlaceholderLoaded($event)"
10
- ></sc-placeholder>
11
- </div>
12
- </header>
13
- <main>
14
- <div id="content">
15
- <sc-placeholder
16
- name="headless-main"
17
- [rendering]="route"
18
- (loaded)="onPlaceholderLoaded($event)"
19
- ></sc-placeholder>
20
- </div>
21
- </main>
22
- <footer>
23
- <div id="footer">
24
- <sc-placeholder
25
- name="headless-footer"
26
- [rendering]="route"
27
- (loaded)="onPlaceholderLoaded($event)"
28
- ></sc-placeholder>
29
- </div>
30
- </footer>
31
- </ng-container>
32
-
33
- <app-not-found
34
- *ngIf="state === LayoutState.NotFound"
35
- [errorContextData]="errorContextData"
36
- ></app-not-found>
37
- <app-server-error *ngIf="state === LayoutState.Error"></app-server-error>
2
+ @if (state === LayoutState.Layout) {
3
+ <ng-container>
4
+ <app-scripts></app-scripts>
5
+ <header>
6
+ <div id="header">
7
+ <sc-placeholder
8
+ name="headless-header"
9
+ [rendering]="route"
10
+ (loaded)="onPlaceholderLoaded($event)"
11
+ ></sc-placeholder>
12
+ </div>
13
+ </header>
14
+ <main>
15
+ <div id="content">
16
+ <sc-placeholder
17
+ name="headless-main"
18
+ [rendering]="route"
19
+ (loaded)="onPlaceholderLoaded($event)"
20
+ ></sc-placeholder>
21
+ </div>
22
+ </main>
23
+ <footer>
24
+ <div id="footer">
25
+ <sc-placeholder
26
+ name="headless-footer"
27
+ [rendering]="route"
28
+ (loaded)="onPlaceholderLoaded($event)"
29
+ ></sc-placeholder>
30
+ </div>
31
+ </footer>
32
+ </ng-container>
33
+ }
34
+ @if (state === LayoutState.NotFound) {
35
+ <app-not-found [errorContextData]="errorContextData"></app-not-found>
36
+ }
37
+ @if (state === LayoutState.Error) {
38
+ <app-server-error></app-server-error>
39
+ }
38
40
  </div>
@@ -1,17 +1,22 @@
1
1
  /* eslint-disable no-shadow, no-console */
2
- import { Component, OnInit, OnDestroy } from '@angular/core';
2
+ import { Component, OnInit, OnDestroy, inject } from '@angular/core';
3
3
  import {
4
4
  RouteData,
5
5
  Field,
6
6
  LayoutServiceContextData,
7
7
  getContentStylesheetLink,
8
+ JssModule,
8
9
  } from '@sitecore-jss/sitecore-jss-angular';
9
10
  import { ActivatedRoute } from '@angular/router';
10
11
  import { Subscription } from 'rxjs';
11
12
  import { JssState } from '../../JssState';
12
13
  import { JssMetaService } from '../../jss-meta.service';
13
14
  import { JssLinkService } from '../../jss-link.service';
15
+ import { NotFoundComponent } from '../not-found/not-found.component';
16
+ import { ServerErrorComponent } from '../server-error/server-error.component';
17
+ import { ScriptsComponent } from '../scripts/scripts.component';
14
18
  import { environment as env } from '../../../environments/environment';
19
+ import { CommonModule } from '@angular/common';
15
20
 
16
21
  enum LayoutState {
17
22
  Layout,
@@ -27,6 +32,7 @@ interface RouteFields {
27
32
  @Component({
28
33
  selector: 'app-layout',
29
34
  templateUrl: './layout.component.html',
35
+ imports: [CommonModule, JssModule, NotFoundComponent, ServerErrorComponent, ScriptsComponent],
30
36
  })
31
37
  export class LayoutComponent implements OnInit, OnDestroy {
32
38
  route: RouteData<RouteFields>;
@@ -36,11 +42,9 @@ export class LayoutComponent implements OnInit, OnDestroy {
36
42
  errorContextData: LayoutServiceContextData;
37
43
  mainClassPageEditing: string;
38
44
 
39
- constructor(
40
- private activatedRoute: ActivatedRoute,
41
- private readonly meta: JssMetaService,
42
- private linkService: JssLinkService
43
- ) {}
45
+ private activatedRoute = inject(ActivatedRoute);
46
+ private readonly meta = inject(JssMetaService);
47
+ private linkService = inject(JssLinkService);
44
48
 
45
49
  ngOnInit() {
46
50
  // route data is populated by the JssRouteResolver
@@ -1,4 +1,4 @@
1
- import { Component, OnInit, OnDestroy } from '@angular/core';
1
+ import { Component, OnInit, OnDestroy, inject } from '@angular/core';
2
2
  import { Subscription } from 'rxjs';
3
3
  import { isServer, CdpHelper, LayoutServicePageState } from '@sitecore-jss/sitecore-jss-angular';
4
4
  import { pageView, PageViewData } from '@sitecore-cloudsdk/events/browser';
@@ -18,8 +18,7 @@ import { environment } from '../../../environments/environment';
18
18
  })
19
19
  export class CdpPageViewComponent implements OnInit, OnDestroy {
20
20
  private contextSubscription: Subscription;
21
-
22
- constructor(private jssContext: JssContextService) {}
21
+ private jssContext = inject(JssContextService);
23
22
 
24
23
  ngOnInit(): void {
25
24
  if (!isServer()) {
@@ -1,4 +1,4 @@
1
- import { Component, OnInit } from '@angular/core';
1
+ import { Component, OnInit, inject } from '@angular/core';
2
2
  import { take } from 'rxjs/operators';
3
3
  import { CloudSDK } from '@sitecore-cloudsdk/core/browser';
4
4
  import '@sitecore-cloudsdk/events/browser';
@@ -15,7 +15,7 @@ import { JssState } from '../../JssState';
15
15
  template: '',
16
16
  })
17
17
  export class CloudSdkInitComponent implements OnInit {
18
- constructor(private jssContext: JssContextService) {}
18
+ private jssContext = inject(JssContextService);
19
19
 
20
20
  ngOnInit(): void {
21
21
  if (!isServer() && environment.production) {
@@ -0,0 +1,13 @@
1
+ import { Component } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
4
+ import { CloudSdkInitComponent } from './cloud-sdk-init.component';
5
+ import { CdpPageViewComponent } from './cdp-page-view.component';
6
+
7
+ @Component({
8
+ selector: 'app-scripts',
9
+ templateUrl: './scripts.component.html',
10
+ imports: [CommonModule, JssModule, CloudSdkInitComponent, CdpPageViewComponent]
11
+ })
12
+ export class ScriptsComponent {}
13
+
@@ -5,8 +5,7 @@ import { CloudSdkInitComponent } from './cloud-sdk-init.component';
5
5
  import { CdpPageViewComponent } from './cdp-page-view.component';
6
6
 
7
7
  @NgModule({
8
+ imports: [JssModule, ScriptsComponent, CloudSdkInitComponent, CdpPageViewComponent],
8
9
  exports: [ScriptsComponent],
9
- imports: [JssModule],
10
- declarations: [ScriptsComponent, CloudSdkInitComponent, CdpPageViewComponent],
11
10
  })
12
11
  export class ScriptsModule {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sitecore-jss",
3
- "version": "22.10.0-canary.9",
3
+ "version": "22.11.0-canary.2",
4
4
  "description": "Sitecore JSS initializer",
5
5
  "bin": "./dist/index.js",
6
6
  "scripts": {
@@ -63,5 +63,5 @@
63
63
  "ts-node": "^10.9.2",
64
64
  "typescript": "~5.9.2"
65
65
  },
66
- "gitHead": "db2b558f784ce412eacd2f4a26bc0e38f00fe49a"
66
+ "gitHead": "a2f6bec65f2127ae1aed808c999b47977df371d6"
67
67
  }