create-sitecore-jss 22.1.0-canary.9 → 22.2.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.
- package/dist/bin.js +69 -28
- package/dist/common/processes/install.js +9 -2
- package/dist/common/processes/transform.js +7 -2
- package/dist/init-runner.js +12 -8
- package/dist/initializers/angular/index.js +16 -0
- package/dist/initializers/angular/prompts.js +22 -1
- package/dist/initializers/angular-sxp/index.js +56 -0
- package/dist/initializers/angular-xmcloud/index.js +56 -0
- package/dist/initializers/node-xmcloud-proxy/index.js +32 -0
- package/dist/templates/angular/.env +5 -3
- package/dist/templates/angular/README.md +5 -45
- package/dist/templates/angular/angular.json +1 -6
- package/dist/templates/angular/package.json +43 -53
- package/dist/templates/angular/proxy.conf.js +5 -23
- package/dist/templates/angular/scripts/bootstrap.ts +5 -24
- package/dist/templates/angular/scripts/config/index.ts +28 -0
- package/dist/templates/angular/scripts/config/plugins/computed.ts +21 -0
- package/dist/templates/angular/scripts/config/plugins/fallback.ts +23 -0
- package/dist/templates/angular/scripts/config/plugins/package-json.ts +22 -0
- package/dist/templates/angular/scripts/config/plugins/scjssconfig.ts +29 -0
- package/dist/templates/angular/scripts/generate-config.ts +53 -73
- package/dist/templates/angular/scripts/generate-plugins.ts +28 -0
- package/dist/templates/angular/scripts/temp/gitignore +2 -0
- package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +4 -2
- package/dist/templates/angular/server.bundle.ts +20 -2
- package/dist/templates/angular/src/app/app.module.ts +0 -2
- package/dist/templates/angular/src/app/components/app-components.shared.module.ts +4 -19
- package/dist/templates/angular/src/app/jss-context.server-side.service.ts +0 -2
- package/dist/templates/angular/src/app/lib/config.ts +16 -0
- package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +21 -13
- package/dist/templates/angular/src/app/lib/layout-service-factory.ts +20 -12
- package/dist/templates/angular/src/app/routing/layout/layout.component.html +1 -1
- package/dist/templates/angular/src/app/routing/layout/layout.component.ts +1 -2
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.html +5 -6
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +1 -2
- package/dist/templates/angular/src/app/routing/routing.module.ts +14 -21
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.html +1 -0
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.ts +7 -0
- package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +8 -0
- package/dist/templates/angular/src/graphql-fragment-types.ts +0 -95
- package/dist/templates/angular/src/polyfills.ts +2 -6
- package/dist/templates/angular/src/test.ts +1 -6
- package/dist/templates/angular/tsconfig.json +7 -2
- package/dist/templates/angular-sxp/package.json +12 -0
- package/dist/templates/angular-sxp/proxy.conf.js +43 -0
- package/dist/templates/angular-sxp/scripts/config/plugins/disconnected.ts +27 -0
- package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +35 -0
- package/dist/templates/{angular → angular-sxp}/src/app/jss-data-fetcher.service.ts +3 -1
- package/dist/templates/angular-sxp/src/app/routing/navigation/navigation.component.html +23 -0
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.html +3 -0
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +9 -0
- package/dist/templates/{angular/src/app/routing → angular-sxp/src/app/routing/scripts}/visitor-identification/visitor-identification.component.ts +9 -3
- package/dist/templates/angular-sxp/src/graphql-fragment-types.ts +219 -0
- package/dist/templates/angular-xmcloud/.env +8 -0
- package/dist/templates/angular-xmcloud/package.json +10 -0
- package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +23 -0
- package/dist/templates/angular-xmcloud/scripts/proxy-build.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/lib/config.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory.ts +44 -0
- package/dist/templates/nextjs/next.config.js +5 -0
- package/dist/templates/nextjs/package.json +7 -6
- package/dist/templates/nextjs/src/lib/next-config/plugins/cors-header.js +0 -9
- package/dist/templates/nextjs/src/pages/[[...path]].tsx +1 -13
- package/dist/templates/nextjs-styleguide/package.json +1 -1
- package/dist/templates/nextjs-sxa/src/assets/sass/components/title/_component-title.scss +19 -13
- package/dist/templates/nextjs-sxa/src/components/Image.tsx +22 -12
- package/dist/templates/nextjs-sxa/src/components/Promo.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Title.tsx +10 -13
- package/dist/templates/nextjs-xmcloud/package.json +1 -1
- package/dist/templates/nextjs-xmcloud/src/Scripts.tsx +2 -0
- package/dist/templates/nextjs-xmcloud/src/lib/dictionary-service-factory.ts +46 -0
- package/dist/templates/nextjs-xmcloud/src/lib/graphql-editing-service.ts +9 -0
- package/dist/templates/nextjs-xmcloud/src/lib/middleware/plugins/personalize.ts +6 -5
- package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/personalize.ts +7 -3
- package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/preview-mode.ts +72 -0
- package/dist/templates/nextjs-xmcloud/src/pages/api/editing/render.ts +46 -0
- package/dist/templates/node-headless-ssr-experience-edge/package.json +2 -2
- package/dist/templates/node-headless-ssr-proxy/package.json +4 -4
- package/dist/templates/node-xmcloud-proxy/.env +8 -0
- package/dist/templates/node-xmcloud-proxy/README.md +36 -0
- package/dist/templates/node-xmcloud-proxy/package.json +25 -0
- package/dist/templates/node-xmcloud-proxy/src/config.ts +19 -0
- package/dist/templates/node-xmcloud-proxy/src/index.ts +161 -0
- package/dist/templates/node-xmcloud-proxy/src/types.ts +59 -0
- package/dist/templates/node-xmcloud-proxy/tsconfig.json +22 -0
- package/dist/templates/react/package.json +5 -5
- package/dist/templates/react-native/package.json +4 -4
- package/dist/templates/vue/package.json +4 -4
- package/package.json +4 -4
- /package/dist/templates/angular/src/app/lib/{client-factory.ts → graphql-client-factory.ts} +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/component-content/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ContentListField/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/EditFrameDemo/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/Styleguide/ItemLinkField/Item2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/content/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/dictionary/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/dictionary/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/files/jss.pdf +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/img/jss_logo.png +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/media/img/sc_logo.png +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-1/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/graphql/sample-2/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/custom-route-type/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/en.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/styleguide/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/data/routes/{{language}}.yml +0 -0
- /package/dist/templates/{angular → angular-sxp}/scripts/disconnected-mode-proxy.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/scripts/lint-yml.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/config/{{appName}}.config +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/component-content.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Reuse.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs-Tab.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout-Tabs.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Layout.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Multilingual.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/Styleguide-Section.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/content-block.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-connected-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.graphql +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/graph-ql-layout.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-angular-lazy-loading.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-component-params.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-custom-route-type.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-edit-frame.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-checkbox.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-content-list.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-custom.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-date.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-file.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-image.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-item-link.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-link.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-number.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-rich-text.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-field-usage-text.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-route-fields.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-sitecore-context.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/components/styleguide-tracking.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/config.js +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/content.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/dictionary.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/placeholders.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/routes.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-content-list-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-edit-frame-list-item-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/definitions/templates/styleguide-item-link-template.sitecore.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/gitignore +0 -0
- /package/dist/templates/{angular → angular-sxp}/sitecore/pipelines/example.patch.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.graphql +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout/styleguide-layout.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-section/styleguide-section.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.html +0 -0
- /package/dist/templates/{angular → angular-sxp}/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, OnInit, OnDestroy } from '@angular/core';
|
|
2
2
|
import { Subscription } from 'rxjs';
|
|
3
|
-
import { JssContextService } from '
|
|
3
|
+
import { JssContextService } from '../../../jss-context.service';
|
|
4
4
|
|
|
5
5
|
let emittedVI = false;
|
|
6
6
|
|
|
@@ -13,7 +13,13 @@ let emittedVI = false;
|
|
|
13
13
|
*/
|
|
14
14
|
@Component({
|
|
15
15
|
selector: 'app-visitor-identification',
|
|
16
|
-
template:
|
|
16
|
+
template: `
|
|
17
|
+
<meta
|
|
18
|
+
*ngIf="visitorIdentificationTimestamp"
|
|
19
|
+
name="VIcurrentDateTime"
|
|
20
|
+
[content]="visitorIdentificationTimestamp"
|
|
21
|
+
/>
|
|
22
|
+
`,
|
|
17
23
|
})
|
|
18
24
|
export class VisitorIdentificationComponent implements OnInit, OnDestroy {
|
|
19
25
|
visitorIdentificationTimestamp: number;
|
|
@@ -21,7 +27,7 @@ export class VisitorIdentificationComponent implements OnInit, OnDestroy {
|
|
|
21
27
|
private contextSubscription: Subscription;
|
|
22
28
|
|
|
23
29
|
// inject the JssContextService, which maintains the current Sitecore Context
|
|
24
|
-
constructor(private jssContext: JssContextService) {
|
|
30
|
+
constructor(private jssContext: JssContextService) {}
|
|
25
31
|
|
|
26
32
|
ngOnInit() {
|
|
27
33
|
this.contextSubscription = this.jssContext.state.subscribe((state) => {
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {
|
|
3
|
+
__schema: {
|
|
4
|
+
types: [
|
|
5
|
+
{
|
|
6
|
+
kind: 'INTERFACE',
|
|
7
|
+
name: 'ItemField',
|
|
8
|
+
possibleTypes: [
|
|
9
|
+
{
|
|
10
|
+
name: 'RichTextField',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: 'NumberField',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'MultilistField',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'LookupField',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'LinkField',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'TextField',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'IntegerField',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'ImageField',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'DateField',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'CheckboxField',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'NameValueListField',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
kind: 'INTERFACE',
|
|
46
|
+
name: 'Item',
|
|
47
|
+
possibleTypes: [
|
|
48
|
+
{
|
|
49
|
+
name: 'UnknownItem',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'StyleguideComponentParamsRenderingParameters',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: 'C__StandardTemplate',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'C__Route',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'RenderEngineType',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideTracking',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideSitecoreContext',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideSection',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideRouteFields',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideMultilingual',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideLayoutTabsTab',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideLayoutTabs',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideLayoutReuse',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name:
|
|
89
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideItemLinkItemTemplate',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageText',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name:
|
|
96
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageRichText',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageNumber',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageLink',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name:
|
|
106
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageItemLink',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageImage',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageFile',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageDate',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageCustom',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name:
|
|
122
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageContentList',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name:
|
|
126
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideFieldUsageCheckbox',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name:
|
|
130
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideExplanatoryComponent',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name:
|
|
134
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideContentListItemTemplate',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideComponentParams',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name:
|
|
141
|
+
'<%- helper.getAppPrefix(appPrefix, appName, false) %>StyleguideAngularLazyLoading',
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>GraphQLIntegratedDemo',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>GraphQLConnectedDemo',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>ExampleCustomRouteType',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>ContentBlock',
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: 'C__<%- helper.getAppPrefix(appPrefix, appName, false) %>AppRoute',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
name: 'JsonRendering',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: 'JavaScriptRendering',
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: 'JSSLayout',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'App',
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
kind: 'INTERFACE',
|
|
174
|
+
name: 'RenderingOptions',
|
|
175
|
+
possibleTypes: [
|
|
176
|
+
{
|
|
177
|
+
name: 'JsonRendering',
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'JavaScriptRendering',
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
kind: 'INTERFACE',
|
|
186
|
+
name: 'Layout',
|
|
187
|
+
possibleTypes: [
|
|
188
|
+
{
|
|
189
|
+
name: 'JSSLayout',
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
kind: 'INTERFACE',
|
|
195
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>AppRoute',
|
|
196
|
+
possibleTypes: [
|
|
197
|
+
{
|
|
198
|
+
name: '<%- helper.getAppPrefix(appPrefix, appName, false) %>ExampleCustomRouteType',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'C__<%- helper.getAppPrefix(appPrefix, appName, false) %>AppRoute',
|
|
202
|
+
},
|
|
203
|
+
],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
kind: 'INTERFACE',
|
|
207
|
+
name: 'Caching',
|
|
208
|
+
possibleTypes: [
|
|
209
|
+
{
|
|
210
|
+
name: 'JsonRendering',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'JavaScriptRendering',
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
],
|
|
218
|
+
},
|
|
219
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
# ========== XM Cloud Proxy ===========
|
|
3
|
+
|
|
4
|
+
# Your XM Cloud Proxy hostname is needed to build the app and execute the client-side requests against the proxy server.
|
|
5
|
+
PROXY_HOST=http://localhost:3001
|
|
6
|
+
|
|
7
|
+
# Your XM Cloud Proxy server path is needed to build the app. The build output will be copied to the proxy server path.
|
|
8
|
+
PROXY_BUILD_PATH=<%- proxyAppDestination %>/dist
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"config": {
|
|
3
|
+
"sitecoreDistPath": "/dist"
|
|
4
|
+
},
|
|
5
|
+
"scripts": {
|
|
6
|
+
"postbuild:server": "npm-run-all --serial prepare:build prepare:proxy-build",
|
|
7
|
+
"prepare:build": "move-cli ./dist/main.js ./dist/server.bundle.js",
|
|
8
|
+
"prepare:proxy-build": "ts-node --project src/tsconfig.webpack-server.json ./scripts/proxy-build.ts"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JssConfig } from 'lib/config';
|
|
2
|
+
import { ConfigPlugin } from '..';
|
|
3
|
+
import { constantCase } from 'constant-case';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This plugin will set XM Cloud related config props.
|
|
7
|
+
*/
|
|
8
|
+
class XMCloudPlugin implements ConfigPlugin {
|
|
9
|
+
// should come after other plugins (but before fallback)
|
|
10
|
+
order = 10;
|
|
11
|
+
|
|
12
|
+
async exec(config: JssConfig) {
|
|
13
|
+
const proxyBuildPath = process.env[`${constantCase('proxyBuildPath')}`]?.replace(/\/$/, '');
|
|
14
|
+
const proxyHost = process.env[`${constantCase('proxyHost')}`];
|
|
15
|
+
|
|
16
|
+
return Object.assign({}, config, {
|
|
17
|
+
proxyBuildPath,
|
|
18
|
+
proxyHost,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const xmcloudPlugin = new XMCloudPlugin();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { environment } from '../src/environments/environment';
|
|
3
|
+
|
|
4
|
+
// Executed at the end of the build process (jss build) to move the build output to the proxy build path
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
console.log('Moving build output to proxy build path:', environment.proxyBuildPath);
|
|
8
|
+
|
|
9
|
+
execSync(`del-cli ${environment.proxyBuildPath} --force`, { stdio: 'inherit' });
|
|
10
|
+
execSync(`move-cli ./dist ${environment.proxyBuildPath}`, { stdio: 'inherit' });
|
|
11
|
+
|
|
12
|
+
console.log('Proxy build prepared successfully!');
|
|
13
|
+
} catch (error) {
|
|
14
|
+
console.error('Error preparing proxy build:', error);
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Represents the type of config object available within the generated /environments/environment.js
|
|
3
|
+
*/
|
|
4
|
+
export interface JssConfig extends Record<string, string | boolean | undefined> {
|
|
5
|
+
production?: false;
|
|
6
|
+
sitecoreApiKey?: string;
|
|
7
|
+
sitecoreApiHost?: string;
|
|
8
|
+
sitecoreSiteName?: string;
|
|
9
|
+
defaultLanguage?: string;
|
|
10
|
+
graphQLEndpoint?: string;
|
|
11
|
+
graphQLEndpointPath?: string;
|
|
12
|
+
defaultServerRoute?: string;
|
|
13
|
+
proxyBuildPath?: string;
|
|
14
|
+
proxyHost?: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GraphQLRequestClientFactoryConfig,
|
|
3
|
+
GraphQLRequestClient,
|
|
4
|
+
} from '@sitecore-jss/sitecore-jss-angular';
|
|
5
|
+
import { environment as env } from '../../environments/environment';
|
|
6
|
+
|
|
7
|
+
// The GraphQLRequestClientFactory serves as the central hub for executing GraphQL requests within the application
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new GraphQLRequestClientFactory instance
|
|
11
|
+
* @returns GraphQLRequestClientFactory instance
|
|
12
|
+
*/
|
|
13
|
+
export const createGraphQLClientFactory = () => {
|
|
14
|
+
let clientConfig: GraphQLRequestClientFactoryConfig;
|
|
15
|
+
|
|
16
|
+
// If we are in a production environment we are going to use Node XM Cloud proxy
|
|
17
|
+
if (env.production === 'true') {
|
|
18
|
+
if (env.proxyHost && env.sitecoreApiKey && env.graphQLEndpoint) {
|
|
19
|
+
// Server side requests should go directly to the Sitecore, browser requests should go through the proxy.
|
|
20
|
+
clientConfig = {
|
|
21
|
+
endpoint:
|
|
22
|
+
typeof window === 'undefined'
|
|
23
|
+
? env.graphQLEndpoint
|
|
24
|
+
: `${env.proxyHost}${env.graphQLEndpointPath}`,
|
|
25
|
+
apiKey: env.sitecoreApiKey,
|
|
26
|
+
};
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error('Please configure your proxyHost, sitecoreApiKey, graphQLEndpoint.');
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
if (env.graphQLEndpoint && env.sitecoreApiKey) {
|
|
32
|
+
clientConfig = {
|
|
33
|
+
endpoint: env.graphQLEndpoint,
|
|
34
|
+
apiKey: env.sitecoreApiKey,
|
|
35
|
+
};
|
|
36
|
+
} else {
|
|
37
|
+
throw new Error('Please configure your graphQLEndpoint and sitecoreApiKey.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return GraphQLRequestClient.createClientFactory(clientConfig);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const clientFactory = createGraphQLClientFactory();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%- appName %>",
|
|
3
3
|
"description": "Application utilizing Sitecore JavaScript Services and Next.js",
|
|
4
|
-
"version": "22.
|
|
4
|
+
"version": "22.2.0-canary",
|
|
5
5
|
"private": true,
|
|
6
6
|
"config": {
|
|
7
7
|
"appName": "<%- appName %>",
|
|
@@ -25,13 +25,14 @@
|
|
|
25
25
|
},
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sitecore-jss/sitecore-jss-nextjs": "~22.
|
|
28
|
+
"@sitecore-jss/sitecore-jss-nextjs": "~22.2.0-canary",
|
|
29
29
|
"graphql": "~15.8.0",
|
|
30
30
|
"graphql-tag": "^2.12.6",
|
|
31
31
|
"next": "^14.1.0",
|
|
32
32
|
"next-localization": "^0.12.0",
|
|
33
33
|
"react": "^18.2.0",
|
|
34
|
-
"react-dom": "^18.2.0"
|
|
34
|
+
"react-dom": "^18.2.0",
|
|
35
|
+
"sharp": "0.32.6"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@graphql-codegen/cli": "^5.0.0",
|
|
@@ -42,9 +43,9 @@
|
|
|
42
43
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
43
44
|
"@graphql-codegen/typescript-resolvers": "^4.0.1",
|
|
44
45
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
45
|
-
"@sitecore-jss/sitecore-jss-cli": "~22.
|
|
46
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "~22.
|
|
47
|
-
"@types/node": "^
|
|
46
|
+
"@sitecore-jss/sitecore-jss-cli": "~22.2.0-canary",
|
|
47
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "~22.2.0-canary",
|
|
48
|
+
"@types/node": "^20.14.2",
|
|
48
49
|
"@types/react": "^18.2.22",
|
|
49
50
|
"@types/react-dom": "^18.0.5",
|
|
50
51
|
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
@@ -7,10 +7,8 @@ import { GetServerSideProps } from 'next';
|
|
|
7
7
|
import NotFound from 'src/NotFound';
|
|
8
8
|
import Layout from 'src/Layout';
|
|
9
9
|
import {
|
|
10
|
-
RenderingType,
|
|
11
10
|
SitecoreContext,
|
|
12
11
|
ComponentPropsContext,
|
|
13
|
-
EditingComponentPlaceholder,
|
|
14
12
|
<% if (prerender === 'SSG') { -%>
|
|
15
13
|
StaticPath,
|
|
16
14
|
<% } -%>
|
|
@@ -36,8 +34,6 @@ const SitecorePage = ({ notFound, componentProps, layoutData, headLinks }: Sitec
|
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
const isEditing = layoutData.sitecore.context.pageEditing;
|
|
39
|
-
const isComponentRendering =
|
|
40
|
-
layoutData.sitecore.context.renderingType === RenderingType.Component;
|
|
41
37
|
|
|
42
38
|
return (
|
|
43
39
|
<ComponentPropsContext value={componentProps}>
|
|
@@ -45,15 +41,7 @@ const SitecorePage = ({ notFound, componentProps, layoutData, headLinks }: Sitec
|
|
|
45
41
|
componentFactory={componentBuilder.getComponentFactory({ isEditing })}
|
|
46
42
|
layoutData={layoutData}
|
|
47
43
|
>
|
|
48
|
-
{
|
|
49
|
-
Sitecore Pages supports component rendering to avoid refreshing the entire page during component editing.
|
|
50
|
-
If you are using Experience Editor only, this logic can be removed, Layout can be left.
|
|
51
|
-
*/}
|
|
52
|
-
{isComponentRendering ? (
|
|
53
|
-
<EditingComponentPlaceholder rendering={layoutData.sitecore.route} />
|
|
54
|
-
) : (
|
|
55
|
-
<Layout layoutData={layoutData} headLinks={headLinks} />
|
|
56
|
-
)}
|
|
44
|
+
<Layout layoutData={layoutData} headLinks={headLinks} />
|
|
57
45
|
</SitecoreContext>
|
|
58
46
|
</ComponentPropsContext>
|
|
59
47
|
);
|
|
@@ -3,22 +3,28 @@
|
|
|
3
3
|
|
|
4
4
|
.title {
|
|
5
5
|
background: $title-bg;
|
|
6
|
+
|
|
6
7
|
h1,
|
|
7
8
|
.field-title {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
@include border-basic(bottom, $border-basic-color);
|
|
10
|
+
font-size: $font-extrabig;
|
|
11
|
+
margin-bottom: $small-margin;
|
|
12
|
+
color: $title-color;
|
|
13
|
+
line-height: normal;
|
|
14
|
+
padding-bottom: 10px;
|
|
15
|
+
display: block;
|
|
16
|
+
text-decoration: none;
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
|
|
19
|
+
&:hover {
|
|
20
|
+
color: $title-color-active;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
> a,
|
|
24
|
+
> span {
|
|
16
25
|
text-decoration: none;
|
|
17
|
-
|
|
18
|
-
&:hover {
|
|
19
|
-
color: $title-color-active;
|
|
20
|
-
}
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
|
-
|
|
28
|
+
|
|
23
29
|
@import '@sass/variants/title';
|
|
24
30
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
Link as JssLink,
|
|
5
|
-
ImageField,
|
|
2
|
+
EditMode,
|
|
6
3
|
Field,
|
|
4
|
+
ImageField,
|
|
5
|
+
NextImage as JssImage,
|
|
6
|
+
Link as JssLink,
|
|
7
7
|
LinkField,
|
|
8
8
|
Text,
|
|
9
9
|
useSitecoreContext,
|
|
10
10
|
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
11
|
+
import React, { CSSProperties } from 'react';
|
|
11
12
|
|
|
12
13
|
interface Fields {
|
|
13
|
-
Image: ImageField;
|
|
14
|
+
Image: ImageField & { metadata?: { [key: string]: unknown } };
|
|
14
15
|
ImageCaption: Field<string>;
|
|
15
16
|
TargetUrl: LinkField;
|
|
16
17
|
}
|
|
@@ -29,8 +30,10 @@ const ImageDefault = (props: ImageProps): JSX.Element => (
|
|
|
29
30
|
);
|
|
30
31
|
|
|
31
32
|
export const Banner = (props: ImageProps): JSX.Element => {
|
|
33
|
+
const id = props.params.RenderingIdentifier;
|
|
32
34
|
const { sitecoreContext } = useSitecoreContext();
|
|
33
35
|
const isPageEditing = sitecoreContext.pageEditing;
|
|
36
|
+
const isMetadataMode = sitecoreContext?.editMode === EditMode.Metadata;
|
|
34
37
|
const classHeroBannerEmpty =
|
|
35
38
|
isPageEditing && props.fields?.Image?.value?.class === 'scEmptyImage'
|
|
36
39
|
? 'hero-banner-empty'
|
|
@@ -38,13 +41,20 @@ export const Banner = (props: ImageProps): JSX.Element => {
|
|
|
38
41
|
const backgroundStyle = (props?.fields?.Image?.value?.src && {
|
|
39
42
|
backgroundImage: `url('${props.fields.Image.value.src}')`,
|
|
40
43
|
}) as CSSProperties;
|
|
41
|
-
const modifyImageProps =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
const modifyImageProps = !isMetadataMode
|
|
45
|
+
? {
|
|
46
|
+
...props.fields.Image,
|
|
47
|
+
editable: props?.fields?.Image?.editable
|
|
48
|
+
?.replace(`width="${props?.fields?.Image?.value?.width}"`, 'width="100%"')
|
|
49
|
+
.replace(`height="${props?.fields?.Image?.value?.height}"`, 'height="100%"'),
|
|
50
|
+
}
|
|
51
|
+
: {
|
|
52
|
+
...props.fields.Image,
|
|
53
|
+
value: {
|
|
54
|
+
...props.fields.Image.value,
|
|
55
|
+
style: { width: '100%', height: '100%' },
|
|
56
|
+
},
|
|
57
|
+
};
|
|
48
58
|
|
|
49
59
|
return (
|
|
50
60
|
<div
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import {
|
|
3
2
|
Link,
|
|
4
|
-
Text,
|
|
5
|
-
useSitecoreContext,
|
|
6
3
|
LinkField,
|
|
4
|
+
Text,
|
|
7
5
|
TextField,
|
|
6
|
+
useSitecoreContext,
|
|
8
7
|
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
8
|
+
import React from 'react';
|
|
9
9
|
|
|
10
10
|
interface Fields {
|
|
11
11
|
data: {
|
|
@@ -17,7 +17,8 @@ interface Fields {
|
|
|
17
17
|
field: {
|
|
18
18
|
jsonValue: {
|
|
19
19
|
value: string;
|
|
20
|
-
editable
|
|
20
|
+
editable?: string;
|
|
21
|
+
metadata?: { [key: string]: unknown };
|
|
21
22
|
};
|
|
22
23
|
};
|
|
23
24
|
};
|
|
@@ -29,7 +30,8 @@ interface Fields {
|
|
|
29
30
|
field: {
|
|
30
31
|
jsonValue: {
|
|
31
32
|
value: string;
|
|
32
|
-
editable
|
|
33
|
+
editable?: string;
|
|
34
|
+
metadata?: { [key: string]: unknown };
|
|
33
35
|
};
|
|
34
36
|
};
|
|
35
37
|
};
|
|
@@ -61,21 +63,16 @@ const ComponentContent = (props: ComponentContentProps) => {
|
|
|
61
63
|
export const Default = (props: TitleProps): JSX.Element => {
|
|
62
64
|
const datasource = props.fields?.data?.datasource || props.fields?.data?.contextItem;
|
|
63
65
|
const { sitecoreContext } = useSitecoreContext();
|
|
64
|
-
|
|
65
|
-
const text: TextField = {
|
|
66
|
-
value: datasource?.field?.jsonValue?.value,
|
|
67
|
-
editable: datasource?.field?.jsonValue?.editable,
|
|
68
|
-
};
|
|
66
|
+
const text: TextField = datasource?.field?.jsonValue || {};
|
|
69
67
|
const link: LinkField = {
|
|
70
68
|
value: {
|
|
71
69
|
href: datasource?.url?.path,
|
|
72
70
|
title: datasource?.field?.jsonValue?.value,
|
|
73
|
-
editable: true,
|
|
74
71
|
},
|
|
75
72
|
};
|
|
76
73
|
if (sitecoreContext.pageState !== 'normal') {
|
|
77
74
|
link.value.querystring = `sc_site=${datasource?.url?.siteName}`;
|
|
78
|
-
if (!text
|
|
75
|
+
if (!text?.value) {
|
|
79
76
|
text.value = 'Title field';
|
|
80
77
|
link.value.href = '#';
|
|
81
78
|
}
|
|
@@ -84,7 +81,7 @@ export const Default = (props: TitleProps): JSX.Element => {
|
|
|
84
81
|
return (
|
|
85
82
|
<ComponentContent styles={props.params.styles} id={props.params.RenderingIdentifier}>
|
|
86
83
|
<>
|
|
87
|
-
{sitecoreContext.
|
|
84
|
+
{sitecoreContext.pageEditing ? (
|
|
88
85
|
<Text field={text} />
|
|
89
86
|
) : (
|
|
90
87
|
<Link field={link}>
|