create-sitecore-jss 22.10.0-canary.9 → 22.12.0-canary.1
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/templates/angular/angular.json +133 -133
- package/dist/templates/angular/package.json +118 -119
- package/dist/templates/angular/scripts/generate-component-factory/template.ts +1 -3
- package/dist/templates/angular/server.bundle.ts +3 -2
- package/dist/templates/angular/src/app/ViewBag.ts +4 -0
- package/dist/templates/angular/src/app/app.component.ts +10 -9
- package/dist/templates/angular/src/app/app.module.ts +3 -1
- package/dist/templates/angular/src/app/app.server.module.ts +4 -5
- package/dist/templates/angular/src/app/components/app-components.shared.module.ts +16 -3
- package/dist/templates/angular/src/app/components/content-block/content-block.component.ts +2 -1
- package/dist/templates/angular/src/app/i18n/jss-translation-client-loader.service.ts +3 -2
- package/dist/templates/angular/src/app/i18n/jss-translation-server-loader.service.ts +6 -4
- package/dist/templates/angular/src/app/injection-tokens.ts +13 -0
- package/dist/templates/angular/src/app/jss-context.server-side.service.ts +8 -10
- package/dist/templates/angular/src/app/jss-context.service.ts +6 -4
- package/dist/templates/angular/src/app/jss-graphql.module.ts +58 -48
- package/dist/templates/angular/src/app/jss-graphql.service.ts +6 -6
- package/dist/templates/angular/src/app/jss-meta.service.ts +3 -2
- package/dist/templates/angular/src/app/routing/layout/layout.component.ts +10 -4
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +3 -0
- package/dist/templates/angular/src/app/routing/not-found/not-found.component.ts +1 -1
- package/dist/templates/angular/src/app/routing/routing.module.ts +3 -4
- package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +1 -1
- package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +1 -3
- package/dist/templates/angular-sxp/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +41 -39
- package/dist/templates/angular-sxp/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +5 -3
- package/dist/templates/angular-sxp/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +6 -4
- package/dist/templates/angular-sxp/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +4 -4
- package/dist/templates/angular-sxp/src/app/components/graph-ql-layout/graph-ql-layout.component.html +3 -4
- package/dist/templates/angular-sxp/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +4 -4
- package/dist/templates/angular-sxp/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +3 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +5 -5
- package/dist/templates/angular-sxp/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +2 -5
- package/dist/templates/angular-sxp/src/app/components/styleguide-component-params/styleguide-component-params.component.html +8 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +2 -2
- package/dist/templates/angular-sxp/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +5 -5
- package/dist/templates/angular-sxp/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +7 -3
- package/dist/templates/angular-sxp/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +13 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +2 -2
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +20 -16
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +20 -3
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +2 -0
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +4 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +3 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +3 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +4 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +4 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +3 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +2 -0
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +3 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +3 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-layout/styleguide-layout.component.html +12 -8
- package/dist/templates/angular-sxp/src/app/components/styleguide-layout/styleguide-layout.component.ts +2 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +3 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +18 -15
- package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +6 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +2 -2
- package/dist/templates/angular-sxp/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +4 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +7 -3
- package/dist/templates/angular-sxp/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +5 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-section/styleguide-section.component.ts +2 -1
- package/dist/templates/angular-sxp/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +7 -4
- package/dist/templates/angular-sxp/src/app/components/styleguide-tracking/styleguide-tracking.component.html +6 -2
- package/dist/templates/angular-sxp/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +12 -12
- package/dist/templates/angular-sxp/src/app/jss-data-fetcher.service.ts +4 -2
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.ts +10 -0
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +1 -1
- package/dist/templates/angular-sxp/src/app/routing/scripts/visitor-identification/visitor-identification.component.ts +6 -3
- package/dist/templates/angular-xmcloud/scripts/generate-component-factory/template.ts +1 -3
- package/dist/templates/angular-xmcloud/src/app/components/app-components.shared.module.ts +1 -2
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.html +6 -4
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.ts +4 -1
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +14 -5
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +3 -0
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.html +21 -23
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.ts +5 -5
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.html +11 -10
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.ts +3 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.html +14 -17
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.ts +3 -3
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.html +3 -6
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.ts +8 -5
- package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.ts +4 -4
- package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.ts +2 -0
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.html +4 -6
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.ts +3 -0
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +3 -4
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +3 -0
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.html +10 -9
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.ts +3 -0
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.html +4 -5
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.ts +5 -5
- package/dist/templates/angular-xmcloud/src/app/jss-link.service.ts +2 -2
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.html +38 -36
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.ts +10 -6
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cdp-page-view.component.ts +2 -3
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cloud-sdk-init.component.ts +2 -2
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.component.ts +13 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.module.ts +1 -2
- package/package.json +2 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
|
|
2
|
-
import {
|
|
1
|
+
import { Component, OnInit, Input, OnDestroy, inject } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { ComponentRendering, getChildPlaceholder, JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
4
|
import { JssContextService } from '../../jss-context.service';
|
|
4
5
|
import { Subscription } from 'rxjs';
|
|
6
|
+
import { StyleguideSpecimenComponent } from '../shared/styleguide-specimen/styleguide-specimen.component';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Demonstrates advanced component techniques in JSS.
|
|
@@ -15,6 +17,7 @@ import { Subscription } from 'rxjs';
|
|
|
15
17
|
@Component({
|
|
16
18
|
selector: 'app-styleguide-layout-tabs',
|
|
17
19
|
templateUrl: './styleguide-layout-tabs.component.html',
|
|
20
|
+
imports: [CommonModule, JssModule, StyleguideSpecimenComponent]
|
|
18
21
|
})
|
|
19
22
|
export class StyleguideLayoutTabsComponent implements OnInit, OnDestroy {
|
|
20
23
|
@Input() rendering: ComponentRendering;
|
|
@@ -22,8 +25,7 @@ export class StyleguideLayoutTabsComponent implements OnInit, OnDestroy {
|
|
|
22
25
|
activeTab: ComponentRendering;
|
|
23
26
|
isEditing = false;
|
|
24
27
|
private contextSubscription: Subscription;
|
|
25
|
-
|
|
26
|
-
constructor(private jssContext: JssContextService) {}
|
|
28
|
+
private jssContext = inject(JssContextService);
|
|
27
29
|
|
|
28
30
|
ngOnInit() {
|
|
29
31
|
// to get access to route-level data from Sitecore such as route item fields or
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
So we conditionally render the tab title here, when editing.
|
|
5
5
|
-->
|
|
6
6
|
<div data-e2e-class="styleguide-layout-tabs-tab">
|
|
7
|
-
|
|
7
|
+
@if (isEditing) {
|
|
8
8
|
<h5 *scText="rendering.fields.title"></h5>
|
|
9
|
-
|
|
9
|
+
}
|
|
10
10
|
|
|
11
11
|
<div *scRichText="rendering.fields.content"></div>
|
|
12
12
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
|
|
2
|
-
import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
1
|
+
import { Component, OnInit, Input, OnDestroy, inject } from '@angular/core';
|
|
2
|
+
import { ComponentRendering, JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
3
|
import { JssContextService } from '../../jss-context.service';
|
|
4
4
|
import { Subscription } from 'rxjs';
|
|
5
5
|
|
|
@@ -11,13 +11,13 @@ import { Subscription } from 'rxjs';
|
|
|
11
11
|
@Component({
|
|
12
12
|
selector: 'app-styleguide-layout-tabs-tab',
|
|
13
13
|
templateUrl: './styleguide-layout-tabs-tab.component.html',
|
|
14
|
+
imports: [JssModule]
|
|
14
15
|
})
|
|
15
16
|
export class StyleguideLayoutTabsTabComponent implements OnInit, OnDestroy {
|
|
16
17
|
@Input() rendering: ComponentRendering;
|
|
17
18
|
isEditing = false;
|
|
18
19
|
private contextSubscription: Subscription;
|
|
19
|
-
|
|
20
|
-
constructor(private jssContext: JssContextService) { }
|
|
20
|
+
private jssContext = inject(JssContextService);
|
|
21
21
|
|
|
22
22
|
ngOnInit() {
|
|
23
23
|
// to get access to route-level data from Sitecore such as route item fields or
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Component, Input } from '@angular/core';
|
|
2
|
-
import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
1
|
+
import { Component, Input, inject } from '@angular/core';
|
|
2
|
+
import { ComponentRendering, JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
3
|
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
4
5
|
import { JssContextService } from '../../jss-context.service';
|
|
6
|
+
import { StyleguideSpecimenComponent } from '../shared/styleguide-specimen/styleguide-specimen.component';
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Demonstrates using the dictionary functionality and defining route data in
|
|
@@ -10,6 +12,7 @@ import { JssContextService } from '../../jss-context.service';
|
|
|
10
12
|
@Component({
|
|
11
13
|
selector: 'app-styleguide-multilingual',
|
|
12
14
|
templateUrl: './styleguide-multilingual.component.html',
|
|
15
|
+
imports: [JssModule, TranslateModule, StyleguideSpecimenComponent]
|
|
13
16
|
})
|
|
14
17
|
export class StyleguideMultilingualComponent {
|
|
15
18
|
@Input() rendering: ComponentRendering;
|
|
@@ -17,7 +20,8 @@ export class StyleguideMultilingualComponent {
|
|
|
17
20
|
LANG_REGEXP = /^\/([a-zA-Z]{2}(-[a-zA-Z]{2})?)/;
|
|
18
21
|
// inject ngx-translate service to get translation state
|
|
19
22
|
// (in this example, the current language)
|
|
20
|
-
|
|
23
|
+
public translate = inject(TranslateService);
|
|
24
|
+
private jssService = inject(JssContextService);
|
|
21
25
|
|
|
22
26
|
switchLanguage(ev: Event) {
|
|
23
27
|
const href = (ev.target as HTMLAnchorElement).getAttribute('href');
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { Component, OnInit, OnDestroy, Input } from '@angular/core';
|
|
1
|
+
import { Component, OnInit, OnDestroy, Input, inject } from '@angular/core';
|
|
2
2
|
import { Subscription } from 'rxjs';
|
|
3
3
|
import { JssContextService } from '../../jss-context.service';
|
|
4
|
-
import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
|
+
import { ComponentRendering, JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
5
|
+
import { StyleguideSpecimenComponent } from '../shared/styleguide-specimen/styleguide-specimen.component';
|
|
5
6
|
|
|
6
7
|
@Component({
|
|
7
8
|
selector: 'app-styleguide-route-fields',
|
|
8
9
|
templateUrl: './styleguide-route-fields.component.html',
|
|
10
|
+
imports: [JssModule, StyleguideSpecimenComponent]
|
|
9
11
|
})
|
|
10
12
|
export class StyleguideRouteFieldsComponent implements OnInit, OnDestroy {
|
|
11
13
|
@Input() rendering: ComponentRendering;
|
|
12
14
|
contextFields: { [name: string]: unknown };
|
|
13
15
|
|
|
14
16
|
private contextSubscription: Subscription;
|
|
15
|
-
|
|
16
|
-
constructor(private jssContext: JssContextService) { }
|
|
17
|
+
private jssContext = inject(JssContextService);
|
|
17
18
|
|
|
18
19
|
ngOnInit() {
|
|
19
20
|
this.contextSubscription = this.jssContext.state.subscribe((state) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
2
|
+
import { ComponentRendering, JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Represents a category of styleguide specimens within the Styleguide-Layout.
|
|
@@ -9,6 +9,7 @@ import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
|
9
9
|
@Component({
|
|
10
10
|
selector: 'app-styleguide-section',
|
|
11
11
|
templateUrl: './styleguide-section.component.html',
|
|
12
|
+
imports: [JssModule]
|
|
12
13
|
})
|
|
13
14
|
export class StyleguideSectionComponent implements OnInit {
|
|
14
15
|
@Input() rendering: ComponentRendering;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { Component, Input, OnInit, OnDestroy } from '@angular/core';
|
|
2
|
+
import { Component, Input, OnInit, OnDestroy, inject } from '@angular/core';
|
|
3
3
|
import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
4
|
import { JssContextService } from '../../jss-context.service';
|
|
5
|
+
import { StyleguideSpecimenComponent } from '../shared/styleguide-specimen/styleguide-specimen.component';
|
|
5
6
|
import { Subscription } from 'rxjs';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -11,19 +12,21 @@ import { Subscription } from 'rxjs';
|
|
|
11
12
|
* NOTE: if not using async pipe, ensure you unsubscribe from the context
|
|
12
13
|
* in ngOnDestroy(). See styleguide-layout-tabs for an example.
|
|
13
14
|
*/
|
|
15
|
+
|
|
14
16
|
@Component({
|
|
15
17
|
selector: 'app-styleguide-sitecore-context',
|
|
16
|
-
templateUrl: './styleguide-sitecore-context.component.html'
|
|
18
|
+
templateUrl: './styleguide-sitecore-context.component.html',
|
|
19
|
+
imports: [StyleguideSpecimenComponent]
|
|
17
20
|
})
|
|
18
21
|
export class StyleguideSitecoreContextComponent implements OnInit, OnDestroy {
|
|
19
22
|
@Input() rendering: ComponentRendering;
|
|
20
23
|
private contextSubscription: Subscription;
|
|
21
24
|
|
|
22
25
|
// inject the JssContextService, which maintains the current Sitecore Context
|
|
23
|
-
|
|
26
|
+
private jssContext = inject(JssContextService);
|
|
24
27
|
|
|
25
28
|
ngOnInit() {
|
|
26
|
-
this.contextSubscription = this.jssContext.state.subscribe((state) => {
|
|
29
|
+
this.contextSubscription = this.jssContext.state.subscribe((state: unknown) => {
|
|
27
30
|
console.debug('The current Sitecore Context in styleguide-sitecore-context.component.ts is...', state);
|
|
28
31
|
});
|
|
29
32
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<app-styleguide-specimen [rendering]="rendering" e2eId="styleguide-tracking">
|
|
2
|
-
|
|
2
|
+
@if (disconnectedMode) {
|
|
3
|
+
<p>The tracking API is only available in connected, integrated, or headless modes.</p>
|
|
4
|
+
}
|
|
3
5
|
|
|
4
|
-
|
|
6
|
+
@if (!disconnectedMode) {
|
|
7
|
+
<div>
|
|
5
8
|
<p class="alert alert-warning">
|
|
6
9
|
Note: The JSS tracker API is disabled by default. Consult the <a href="https://jss.sitecore.com/docs/fundamentals/services/tracking">tracking documentation</a> to enable it.
|
|
7
10
|
</p>
|
|
@@ -172,4 +175,5 @@
|
|
|
172
175
|
</fieldset>
|
|
173
176
|
</div>
|
|
174
177
|
</div>
|
|
178
|
+
}
|
|
175
179
|
</app-styleguide-specimen>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Component, Input, OnInit } from '@angular/core';
|
|
1
|
+
import { Component, Input, OnInit, inject } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
2
3
|
import {
|
|
3
4
|
ComponentRendering,
|
|
4
5
|
trackingApi,
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
} from '@sitecore-jss/sitecore-jss-angular';
|
|
7
8
|
import { environment } from '../../../environments/environment';
|
|
8
9
|
import { JssDataFetcherService } from '../../jss-data-fetcher.service';
|
|
10
|
+
import { StyleguideSpecimenComponent } from '../shared/styleguide-specimen/styleguide-specimen.component';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* Demonstrates usage of a Text content field within JSS.
|
|
@@ -14,6 +16,7 @@ import { JssDataFetcherService } from '../../jss-data-fetcher.service';
|
|
|
14
16
|
@Component({
|
|
15
17
|
selector: 'app-styleguide-tracking',
|
|
16
18
|
templateUrl: './styleguide-tracking.component.html',
|
|
19
|
+
imports: [CommonModule, StyleguideSpecimenComponent]
|
|
17
20
|
})
|
|
18
21
|
export class StyleguideTrackingComponent implements OnInit {
|
|
19
22
|
@Input() rendering: ComponentRendering;
|
|
@@ -25,17 +28,14 @@ export class StyleguideTrackingComponent implements OnInit {
|
|
|
25
28
|
pageId: string;
|
|
26
29
|
pageUrl: string;
|
|
27
30
|
disconnectedMode = true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
fetcher: dataFetcher.fetch,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
31
|
+
private dataFetcher = inject(JssDataFetcherService);
|
|
32
|
+
trackingApiOptions: TrackingRequestOptions = {
|
|
33
|
+
host: environment.sitecoreApiHost,
|
|
34
|
+
querystringParams: {
|
|
35
|
+
sc_apikey: environment.sitecoreApiKey,
|
|
36
|
+
},
|
|
37
|
+
fetcher: this.dataFetcher.fetch,
|
|
38
|
+
};
|
|
39
39
|
|
|
40
40
|
ngOnInit() {
|
|
41
41
|
this.disconnectedMode = this.rendering.dataSource === 'available-in-connected-mode';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
1
|
+
import { Injectable, inject } from '@angular/core';
|
|
2
2
|
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
|
3
3
|
import { HttpResponse } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
4
|
import { Observable, lastValueFrom } from 'rxjs';
|
|
@@ -7,10 +7,12 @@ import { Observable, lastValueFrom } from 'rxjs';
|
|
|
7
7
|
providedIn: 'root',
|
|
8
8
|
})
|
|
9
9
|
export class JssDataFetcherService {
|
|
10
|
-
constructor(
|
|
10
|
+
constructor() {
|
|
11
11
|
this.fetch = this.fetch.bind(this);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
protected httpClient = inject(HttpClient);
|
|
15
|
+
|
|
14
16
|
fetch<T>(url: string, data: unknown): Promise<HttpResponse<T>> {
|
|
15
17
|
let result: Observable<T>;
|
|
16
18
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { VisitorIdentificationComponent } from './visitor-identification/visitor-identification.component';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-scripts',
|
|
6
|
+
templateUrl: './scripts.component.html',
|
|
7
|
+
imports: [VisitorIdentificationComponent]
|
|
8
|
+
})
|
|
9
|
+
export class ScriptsComponent {}
|
|
10
|
+
|
|
@@ -3,7 +3,7 @@ import { ScriptsComponent } from './scripts.component';
|
|
|
3
3
|
import { VisitorIdentificationComponent } from './visitor-identification/visitor-identification.component';
|
|
4
4
|
|
|
5
5
|
@NgModule({
|
|
6
|
+
imports: [ScriptsComponent, VisitorIdentificationComponent],
|
|
6
7
|
exports: [ScriptsComponent],
|
|
7
|
-
declarations: [ScriptsComponent, VisitorIdentificationComponent],
|
|
8
8
|
})
|
|
9
9
|
export class ScriptsModule {}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Component, OnInit, OnDestroy } from '@angular/core';
|
|
1
|
+
import { Component, OnInit, OnDestroy, inject } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
2
3
|
import { Subscription } from 'rxjs';
|
|
3
4
|
import { JssContextService } from '../../../jss-context.service';
|
|
5
|
+
import { JssState } from '../../../JssState';
|
|
4
6
|
|
|
5
7
|
let emittedVI = false;
|
|
6
8
|
|
|
@@ -20,6 +22,7 @@ let emittedVI = false;
|
|
|
20
22
|
[content]="visitorIdentificationTimestamp"
|
|
21
23
|
/>
|
|
22
24
|
`,
|
|
25
|
+
imports: [CommonModule]
|
|
23
26
|
})
|
|
24
27
|
export class VisitorIdentificationComponent implements OnInit, OnDestroy {
|
|
25
28
|
visitorIdentificationTimestamp: number;
|
|
@@ -27,10 +30,10 @@ export class VisitorIdentificationComponent implements OnInit, OnDestroy {
|
|
|
27
30
|
private contextSubscription: Subscription;
|
|
28
31
|
|
|
29
32
|
// inject the JssContextService, which maintains the current Sitecore Context
|
|
30
|
-
|
|
33
|
+
private jssContext = inject(JssContextService);
|
|
31
34
|
|
|
32
35
|
ngOnInit() {
|
|
33
|
-
this.contextSubscription = this.jssContext.state.subscribe((state) => {
|
|
36
|
+
this.contextSubscription = this.jssContext.state.subscribe((state: JssState) => {
|
|
34
37
|
if (state.sitecore && state.sitecore.context) {
|
|
35
38
|
if (
|
|
36
39
|
!emittedVI &&
|
|
@@ -29,6 +29,7 @@ export const components = [
|
|
|
29
29
|
@NgModule({
|
|
30
30
|
imports: [
|
|
31
31
|
AppComponentsSharedModule,
|
|
32
|
+
${declarations.join('\n ')} // Standalone components
|
|
32
33
|
JssModule.withComponents([
|
|
33
34
|
${registrations.join('\n ')}
|
|
34
35
|
], [
|
|
@@ -49,9 +50,6 @@ export const components = [
|
|
|
49
50
|
JssModule,
|
|
50
51
|
AppComponentsSharedModule,
|
|
51
52
|
],
|
|
52
|
-
declarations: [
|
|
53
|
-
${declarations.join('\n ')}
|
|
54
|
-
],
|
|
55
53
|
})
|
|
56
54
|
export class AppComponentsModule { }
|
|
57
55
|
`;
|
|
@@ -14,8 +14,7 @@ import { NavigationItemComponent } from './navigation/navigation-item.component'
|
|
|
14
14
|
Don't want code generation? See ./.gitignore for instructions to turn it off.
|
|
15
15
|
*/
|
|
16
16
|
@NgModule({
|
|
17
|
-
imports: [CommonModule, TranslateModule, RouterModule, JssModule, FormsModule],
|
|
17
|
+
imports: [CommonModule, TranslateModule, RouterModule, JssModule, FormsModule, NavigationItemComponent],
|
|
18
18
|
exports: [CommonModule, TranslateModule, RouterModule, FormsModule, NavigationItemComponent],
|
|
19
|
-
declarations: [NavigationItemComponent],
|
|
20
19
|
})
|
|
21
20
|
export class AppComponentsSharedModule {}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
<div
|
|
3
|
-
<
|
|
1
|
+
@for (ph of enabledPlaceholders; track ph) {
|
|
2
|
+
<div [ngClass]="getColumnClass(+ph - 1)">
|
|
3
|
+
<div class="row">
|
|
4
|
+
<sc-placeholder [name]="getPlaceholderName(ph)" [rendering]="rendering"> </sc-placeholder>
|
|
5
|
+
</div>
|
|
4
6
|
</div>
|
|
5
|
-
|
|
7
|
+
}
|
|
@@ -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-column-splitter',
|
|
6
8
|
templateUrl: './column-splitter.component.html',
|
|
9
|
+
imports: [CommonModule, JssModule],
|
|
7
10
|
host: {
|
|
8
11
|
'class': 'row component column-splitter',
|
|
9
12
|
'[class]': 'columnSplitterStyles',
|
package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
<
|
|
1
|
+
@if (wrapped) {
|
|
2
|
+
<div class="container-wrapper">
|
|
3
|
+
<div class="component container-default {{ styles }}" [attr.id]="id">
|
|
4
|
+
<div class="component-content" [ngStyle]="backgroundStyle">
|
|
5
|
+
<sc-placeholder
|
|
6
|
+
[name]="placeholderName"
|
|
7
|
+
[rendering]="rendering"
|
|
8
|
+
class="row">
|
|
9
|
+
</sc-placeholder>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
} @else {
|
|
5
14
|
<div class="component container-default {{ styles }}" [attr.id]="id">
|
|
6
15
|
<div class="component-content" [ngStyle]="backgroundStyle">
|
|
7
16
|
<sc-placeholder
|
|
@@ -11,4 +20,4 @@
|
|
|
11
20
|
</sc-placeholder>
|
|
12
21
|
</div>
|
|
13
22
|
</div>
|
|
14
|
-
|
|
23
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
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 { SxaComponent } from '../sxa.component';
|
|
3
5
|
|
|
4
6
|
@Component({
|
|
5
7
|
selector: 'app-container',
|
|
6
8
|
templateUrl: './container.component.html',
|
|
9
|
+
imports: [CommonModule, JssModule],
|
|
7
10
|
})
|
|
8
11
|
export class ContainerComponent extends SxaComponent implements OnInit {
|
|
9
12
|
placeholderName: string;
|
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
<ng-container [ngTemplateOutlet]="variant"></ng-container>
|
|
2
2
|
|
|
3
3
|
<ng-template #default>
|
|
4
|
-
|
|
5
|
-
<div class="component
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
@if (rendering.fields) {
|
|
5
|
+
<div class="component image {{ styles }}" [attr.id]="id">
|
|
6
|
+
<div class="component-content">
|
|
7
|
+
@if (isEditing || !rendering.fields.TargetUrl?.value?.href) {
|
|
8
|
+
<img *scImage="rendering.fields.Image" />
|
|
9
|
+
} @else {
|
|
10
|
+
<a *scGenericLink="rendering.fields.TargetUrl">
|
|
11
|
+
<img *scImage="rendering.fields.Image" />
|
|
12
|
+
</a>
|
|
13
|
+
}
|
|
14
|
+
<span class="image-caption field-imagecaption" *scText="rendering.fields.ImageCaption"></span>
|
|
15
|
+
</div>
|
|
10
16
|
</div>
|
|
11
|
-
|
|
17
|
+
} @else {
|
|
18
|
+
<div class="component image {{ styles }}">
|
|
19
|
+
<div class="component-content">
|
|
20
|
+
<span class="is-empty-hint">Image</span>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
}
|
|
12
24
|
</ng-template>
|
|
13
25
|
|
|
14
26
|
<ng-template #banner>
|
|
15
27
|
<div class="component hero-banner {{ styles }} {{ classHeroBannerEmpty }}" [attr.id]="id">
|
|
16
28
|
<div class="component-content sc-sxa-image-hero-banner" [ngStyle]="backgroundStyle">
|
|
17
|
-
|
|
29
|
+
@if (isEditing) {
|
|
18
30
|
<img *scImage="modifyImageProps" />
|
|
19
|
-
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</ng-template>
|
|
23
|
-
|
|
24
|
-
<ng-template #withLink>
|
|
25
|
-
<a *scGenericLink="rendering.fields.TargetUrl">
|
|
26
|
-
<img *scImage="rendering.fields.Image" />
|
|
27
|
-
</a>
|
|
28
|
-
</ng-template>
|
|
29
|
-
|
|
30
|
-
<ng-template #empty>
|
|
31
|
-
<div class="component image {{ styles }}">
|
|
32
|
-
<div class="component-content">
|
|
33
|
-
<span class="is-empty-hint">Image</span>
|
|
31
|
+
}
|
|
34
32
|
</div>
|
|
35
33
|
</div>
|
|
36
34
|
</ng-template>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { Component, OnInit, OnDestroy, ViewChild, TemplateRef } from '@angular/core';
|
|
1
|
+
import { Component, OnInit, OnDestroy, ViewChild, TemplateRef, 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 { EditMode, ImageField } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
6
|
import { SxaComponent } from '../sxa.component';
|
|
@@ -7,6 +9,7 @@ import { JssContextService } from '../../jss-context.service';
|
|
|
7
9
|
@Component({
|
|
8
10
|
selector: 'app-image',
|
|
9
11
|
templateUrl: './image.component.html',
|
|
12
|
+
imports: [CommonModule, JssModule],
|
|
10
13
|
})
|
|
11
14
|
export class ImageComponent extends SxaComponent implements OnInit, OnDestroy {
|
|
12
15
|
@ViewChild('default', { static: true }) defaultVariant: TemplateRef<any>;
|
|
@@ -16,10 +19,7 @@ export class ImageComponent extends SxaComponent implements OnInit, OnDestroy {
|
|
|
16
19
|
modifyImageProps = {};
|
|
17
20
|
isEditing = false;
|
|
18
21
|
private contextSubscription: Subscription;
|
|
19
|
-
|
|
20
|
-
constructor(private jssContext: JssContextService) {
|
|
21
|
-
super();
|
|
22
|
-
}
|
|
22
|
+
private jssContext = inject(JssContextService);
|
|
23
23
|
|
|
24
24
|
ngOnInit() {
|
|
25
25
|
super.ngOnInit();
|
package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.html
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<div class="component-content">
|
|
2
|
-
|
|
2
|
+
@if (title) {
|
|
3
3
|
<h3 *scText="title"></h3>
|
|
4
|
-
|
|
4
|
+
} @else {
|
|
5
|
+
<span class="is-empty-hint">Link list</span>
|
|
6
|
+
}
|
|
5
7
|
<ul>
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
@for (fieldLink of fieldLinks; track $index) {
|
|
9
|
+
<li [ngClass]="getFieldLinkClass($index)">
|
|
10
|
+
<div class="field-link">
|
|
11
|
+
<a *scGenericLink="fieldLink"></a>
|
|
12
|
+
</div>
|
|
13
|
+
</li>
|
|
14
|
+
}
|
|
11
15
|
</ul>
|
|
12
16
|
</div>
|
|
13
|
-
<ng-template #defaultTitle>
|
|
14
|
-
<span class="is-empty-hint">Link list</span>
|
|
15
|
-
</ng-template>
|
|
@@ -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 { SxaComponent } from '../sxa.component';
|
|
3
5
|
import { Field, LinkField, SxaLinkListFields } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
6
|
|
|
5
7
|
@Component({
|
|
6
8
|
selector: 'app-link-list',
|
|
7
9
|
templateUrl: './link-list.component.html',
|
|
10
|
+
imports: [CommonModule, JssModule],
|
|
8
11
|
host: {
|
|
9
12
|
'class': 'component link-list',
|
|
10
13
|
'[class]': 'styles',
|
package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.html
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
<li [class]="cssClasses" [ngClass]="{ active: isActive }" tabIndex="0">
|
|
2
2
|
<div [ngClass]="{ 'navigation-title': true, child: hasChildren }" (click)="isActive = !isActive">
|
|
3
3
|
<a *scRouterLink="linkField" (click)="onClick($event)">
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
navItemFields.DisplayName
|
|
12
|
-
}}</ng-container>
|
|
4
|
+
@if (navItemFields.NavigationTitle) {
|
|
5
|
+
<span *scText="navItemFields.NavigationTitle"></span>
|
|
6
|
+
} @else if (navItemFields.Title) {
|
|
7
|
+
<span *scText="navItemFields.Title"></span>
|
|
8
|
+
} @else {
|
|
9
|
+
{{ navItemFields.DisplayName }}
|
|
10
|
+
}
|
|
13
11
|
</a>
|
|
14
12
|
</div>
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
</ul>
|
|
13
|
+
@if (hasChildren) {
|
|
14
|
+
<ul class="clearfix">
|
|
15
|
+
@for (childNavItemFields of navItemFields.Children; track childNavItemFields.Id) {
|
|
16
|
+
<app-navigation-item [navItemFields]="childNavItemFields" [relativeLevel]="childrenRelativeLevel" (childLinkClickEvent)="onClick($event)"></app-navigation-item>
|
|
17
|
+
}
|
|
18
|
+
</ul>
|
|
19
|
+
}
|
|
23
20
|
</li>
|
package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { LinkField, JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
4
|
import { Field } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
5
|
|
|
5
6
|
export interface NavItemFields {
|
|
@@ -16,6 +17,7 @@ export interface NavItemFields {
|
|
|
16
17
|
@Component({
|
|
17
18
|
selector: 'app-navigation-item',
|
|
18
19
|
templateUrl: './navigation-item.component.html',
|
|
20
|
+
imports: [CommonModule, JssModule]
|
|
19
21
|
})
|
|
20
22
|
export class NavigationItemComponent implements OnInit {
|
|
21
23
|
@Input() navItemFields: NavItemFields;
|
|
@@ -27,8 +29,6 @@ export class NavigationItemComponent implements OnInit {
|
|
|
27
29
|
childrenRelativeLevel = 0;
|
|
28
30
|
hasChildren = false;
|
|
29
31
|
|
|
30
|
-
constructor() {}
|
|
31
|
-
|
|
32
32
|
ngOnInit() {
|
|
33
33
|
this.cssClasses = `${this.navItemFields.Styles.concat('rel-level' + this.relativeLevel).join(
|
|
34
34
|
' '
|
package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.html
CHANGED
|
@@ -9,12 +9,9 @@
|
|
|
9
9
|
<div class="component-content">
|
|
10
10
|
<nav>
|
|
11
11
|
<ul class="clearfix">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[relativeLevel]="baseLevel"
|
|
16
|
-
(childLinkClickEvent)="toggleMenu($event, false)"
|
|
17
|
-
></app-navigation-item>
|
|
12
|
+
@for (navItemFields of fieldKeys; track $index) {
|
|
13
|
+
<app-navigation-item [navItemFields]="rendering.fields[navItemFields]" [relativeLevel]="baseLevel" (childLinkClickEvent)="toggleMenu($event, false)"></app-navigation-item>
|
|
14
|
+
}
|
|
18
15
|
</ul>
|
|
19
16
|
</nav>
|
|
20
17
|
</div>
|