create-sitecore-jss 22.2.0-canary.81 → 22.2.0-canary.83
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 +19 -35
- package/dist/common/index.js +3 -5
- package/dist/common/processes/install.js +2 -9
- package/dist/common/processes/next.js +3 -6
- package/dist/common/processes/transform.js +13 -18
- package/dist/common/prompts/base.js +25 -0
- package/dist/common/utils/helpers.js +19 -29
- package/dist/init-runner.js +11 -16
- package/dist/initializers/angular/index.js +0 -13
- package/dist/initializers/angular/prompts.js +1 -22
- package/dist/initializers/nextjs/index.js +2 -2
- package/dist/initializers/nextjs/prompts.js +0 -2
- package/dist/initializers/nextjs/remove-dev-dependencies.js +2 -2
- package/dist/initializers/nextjs-multisite/index.js +1 -1
- package/dist/initializers/nextjs-styleguide/index.js +1 -1
- package/dist/initializers/nextjs-styleguide-tracking/index.js +1 -1
- package/dist/initializers/nextjs-sxa/index.js +1 -1
- package/dist/initializers/nextjs-xmcloud/index.js +1 -1
- package/dist/initializers/react/index.js +3 -3
- package/dist/initializers/react/prompts.js +1 -1
- package/dist/initializers/react-native/prompts.js +0 -1
- package/dist/initializers/vue/prompts.js +1 -1
- package/dist/templates/angular/.env +3 -4
- package/dist/templates/angular/.eslintrc +0 -1
- package/dist/templates/angular/README.md +45 -5
- package/dist/templates/angular/angular.json +6 -1
- package/dist/templates/angular/gitignore +0 -5
- package/dist/templates/angular/package.json +18 -6
- package/dist/templates/angular/proxy.conf.js +23 -5
- package/dist/templates/angular/scripts/bootstrap.ts +24 -5
- package/dist/templates/angular/scripts/generate-component-factory.ts +166 -0
- package/dist/templates/angular/scripts/generate-config.ts +72 -71
- package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +28 -21
- package/dist/templates/angular/server.bundle.ts +5 -3
- package/dist/templates/angular/src/app/JssState.ts +9 -2
- package/dist/templates/angular/src/app/app.module.ts +6 -5
- package/dist/templates/angular/src/app/app.server.module.ts +6 -9
- package/dist/templates/angular/src/app/components/app-components.shared.module.ts +19 -4
- package/dist/templates/angular/src/app/components/gitignore +1 -1
- package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +1 -1
- package/dist/templates/angular/src/app/i18n/jss-translation-client-loader.service.ts +7 -15
- package/dist/templates/angular/src/app/i18n/jss-translation-server-loader.service.ts +2 -14
- package/dist/templates/angular/src/app/jss-context.server-side.service.ts +4 -4
- package/dist/templates/angular/src/app/jss-context.service.ts +11 -14
- package/dist/templates/{angular-sxp → angular}/src/app/jss-data-fetcher.service.ts +1 -3
- package/dist/templates/angular/src/app/jss-graphql.service.ts +7 -7
- package/dist/templates/angular/src/app/layout/jss-layout.service.ts +2 -2
- package/dist/templates/angular/src/app/lib/client-factory.ts +28 -0
- package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +13 -24
- package/dist/templates/angular/src/app/lib/layout-service-factory.ts +12 -20
- package/dist/templates/angular/src/app/routing/layout/layout.component.html +1 -1
- package/dist/templates/angular/src/app/routing/layout/layout.component.ts +11 -11
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.html +6 -5
- package/dist/templates/angular/src/app/routing/navigation/navigation.component.ts +2 -1
- package/dist/templates/angular/src/app/routing/routing.module.ts +21 -14
- package/dist/templates/{angular-sxp/src/app/routing/scripts → angular/src/app/routing}/visitor-identification/visitor-identification.component.ts +3 -9
- package/dist/templates/angular/src/environments/gitignore +1 -2
- package/dist/templates/angular/src/graphql-fragment-types.ts +95 -0
- package/dist/templates/angular/tsconfig.json +2 -7
- package/dist/templates/nextjs/scripts/config/plugins/fallback.ts +1 -0
- package/dist/templates/nextjs/scripts/generate-config.ts +1 -8
- package/dist/templates/nextjs-styleguide/scripts/config/plugins/disconnected.ts +0 -1
- package/dist/templates/nextjs-sxa/src/assets/sass/components/common/_alignment.scss +7 -34
- package/dist/templates/node-headless-ssr-proxy/src/config.ts +3 -3
- package/dist/templates/node-headless-ssr-proxy/src/httpAgents.ts +2 -2
- package/dist/templates/node-headless-ssr-proxy/src/index.ts +2 -9
- package/dist/templates/react/scripts/generate-config.js +3 -10
- package/dist/templates/vue/scripts/generate-config.js +0 -5
- package/package.json +2 -2
- package/dist/common/prompts/proxy.js +0 -35
- package/dist/common/prompts/sxp.js +0 -34
- package/dist/initializers/angular-sxp/index.js +0 -62
- package/dist/initializers/angular-xmcloud/index.js +0 -80
- package/dist/initializers/node-xmcloud-proxy/index.js +0 -33
- package/dist/templates/angular/scripts/config/index.ts +0 -28
- package/dist/templates/angular/scripts/config/plugins/computed.ts +0 -21
- package/dist/templates/angular/scripts/config/plugins/fallback.ts +0 -22
- package/dist/templates/angular/scripts/config/plugins/package-json.ts +0 -22
- package/dist/templates/angular/scripts/config/plugins/scjssconfig.ts +0 -29
- package/dist/templates/angular/scripts/generate-component-factory/index.ts +0 -45
- package/dist/templates/angular/scripts/generate-component-factory/plugins/component-factory.ts +0 -147
- package/dist/templates/angular/scripts/generate-component-factory/plugins/components.ts +0 -19
- package/dist/templates/angular/scripts/generate-component-factory/plugins/packages.ts +0 -29
- package/dist/templates/angular/scripts/generate-component-factory/template.ts +0 -46
- package/dist/templates/angular/scripts/generate-plugins.ts +0 -33
- package/dist/templates/angular/scripts/temp/gitignore +0 -2
- package/dist/templates/angular/server.exports.ts +0 -13
- package/dist/templates/angular/src/app/lib/config.ts +0 -16
- package/dist/templates/angular/src/app/lib/graphql-client-factory/config.ts +0 -21
- package/dist/templates/angular/src/app/lib/graphql-client-factory/index.ts +0 -16
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.html +0 -1
- package/dist/templates/angular/src/app/routing/scripts/scripts.component.ts +0 -7
- package/dist/templates/angular/src/app/routing/scripts/scripts.module.ts +0 -8
- package/dist/templates/angular-sxp/.env +0 -2
- package/dist/templates/angular-sxp/package.json +0 -12
- package/dist/templates/angular-sxp/proxy.conf.js +0 -43
- package/dist/templates/angular-sxp/scripts/config/plugins/disconnected.ts +0 -29
- package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +0 -35
- package/dist/templates/angular-sxp/src/app/routing/navigation/navigation.component.html +0 -23
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.component.html +0 -3
- package/dist/templates/angular-sxp/src/app/routing/scripts/scripts.module.ts +0 -9
- package/dist/templates/angular-sxp/src/graphql-fragment-types.ts +0 -219
- package/dist/templates/angular-xmcloud/.env +0 -21
- package/dist/templates/angular-xmcloud/angular.json +0 -33
- package/dist/templates/angular-xmcloud/package.json +0 -17
- package/dist/templates/angular-xmcloud/scripts/bootstrap.ts +0 -28
- package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +0 -39
- package/dist/templates/angular-xmcloud/scripts/generate-component-factory/plugins/packages.ts +0 -34
- package/dist/templates/angular-xmcloud/scripts/generate-component-factory/template.ts +0 -57
- package/dist/templates/angular-xmcloud/scripts/generate-metadata.ts +0 -25
- package/dist/templates/angular-xmcloud/scripts/proxy-build.ts +0 -15
- package/dist/templates/angular-xmcloud/server.exports.ts +0 -24
- package/dist/templates/angular-xmcloud/src/app/components/app-components.shared.module.ts +0 -21
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.html +0 -5
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.ts +0 -40
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +0 -14
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +0 -30
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.html +0 -36
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.ts +0 -67
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.html +0 -15
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.ts +0 -41
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.html +0 -23
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.ts +0 -65
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.html +0 -21
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.ts +0 -49
- package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.html +0 -5
- package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.ts +0 -39
- package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.html +0 -1
- package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.ts +0 -15
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.html +0 -21
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.ts +0 -13
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +0 -8
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +0 -21
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.html +0 -11
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.ts +0 -35
- package/dist/templates/angular-xmcloud/src/app/components/sxa.component.ts +0 -15
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.html +0 -10
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.ts +0 -56
- package/dist/templates/angular-xmcloud/src/app/jss-link.service.ts +0 -55
- package/dist/templates/angular-xmcloud/src/app/lib/config.ts +0 -17
- package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory/config.ts +0 -58
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.html +0 -38
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.ts +0 -104
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cdp-page-view.component.ts +0 -77
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cloud-sdk-init.component.ts +0 -48
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.component.html +0 -5
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.module.ts +0 -12
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_component.scss +0 -48
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_container.scss +0 -64
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_fonts.scss +0 -3
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_footer.scss +0 -31
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_header.scss +0 -51
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_navigation.scss +0 -150
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_promo.scss +0 -58
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_rich-text.scss +0 -11
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_variables.scss +0 -10
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/main.scss +0 -8
- package/dist/templates/angular-xmcloud/src/assets/styles/main.scss +0 -14
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/_app.scss +0 -103
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_functions.scss +0 -8
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_mixins.scss +0 -121
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_vars.scss +0 -3
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_colors.scss +0 -283
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_fontSizes.scss +0 -16
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_margins.scss +0 -11
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/_fonts.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/index.scss +0 -3
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/_link-button.scss +0 -26
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_inputs.scss +0 -58
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_links.scss +0 -14
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_ui-datepicker.scss +0 -7
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext-files-icons.scss +0 -86
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext.scss +0 -101
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/index.scss +0 -2
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/_typehead.scss +0 -95
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-column-splitter.scss +0 -14
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-container.scss +0 -27
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-image.scss +0 -18
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-navigation.scss +0 -51
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-promo.scss +0 -42
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-richtext-content.scss +0 -19
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_alignment.scss +0 -26
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_boxed.scss +0 -16
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_clearfix.scss +0 -11
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_highlighted.scss +0 -63
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_link-button.scss +0 -16
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_promoted-box.scss +0 -3
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/index.scss +0 -6
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_bordered.scss +0 -24
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_title-row-box.scss +0 -66
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/_image-default-size.scss +0 -6
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-left.scss +0 -3
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-right.scss +0 -3
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/index.scss +0 -17
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_acaindent.scss +0 -5
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_background.scss +0 -27
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_component-link-list.scss +0 -45
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_list-vertical.scss +0 -20
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/index.scss +0 -2
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-fat.scss +0 -58
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-main-horizontal-vertical.scss +0 -176
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-mobile.scss +0 -85
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-sidebar.scss +0 -29
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_sitemap-navigation.scss +0 -20
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/index.scss +0 -5
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_absolute-bottom-link.scss +0 -8
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-hero.scss +0 -40
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-shadow.scss +0 -42
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/index.scss +0 -3
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/_rich-text-lists.scss +0 -63
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_background-colors.scss +0 -14
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_indent.scss +0 -13
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/index.scss +0 -2
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/_component-title.scss +0 -30
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/index.scss +0 -1
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/main.scss +0 -4
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/index.scss +0 -6
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/link-list/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/navigation/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/page-content/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/promo/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/rich-text/index.scss +0 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/title/index.scss +0 -0
- package/dist/templates/node-headless-ssr-experience-edge/gitignore +0 -19
- package/dist/templates/node-headless-ssr-proxy/gitignore +0 -19
- package/dist/templates/node-xmcloud-proxy/.env +0 -14
- package/dist/templates/node-xmcloud-proxy/README.md +0 -36
- package/dist/templates/node-xmcloud-proxy/gitignore +0 -33
- package/dist/templates/node-xmcloud-proxy/package.json +0 -26
- package/dist/templates/node-xmcloud-proxy/src/config.ts +0 -25
- package/dist/templates/node-xmcloud-proxy/src/index.ts +0 -210
- package/dist/templates/node-xmcloud-proxy/src/types.ts +0 -27
- package/dist/templates/node-xmcloud-proxy/tsconfig.json +0 -22
- /package/dist/templates/{angular-sxp → angular}/data/component-content/Styleguide/ContentReuse/LoremIpsumContentBlock/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/component-content/gitignore +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ContentListField/Item1/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ContentListField/Item2/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/EditFrameDemo/Item1/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/EditFrameDemo/Item2/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ItemLinkField/Item1/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/content/Styleguide/ItemLinkField/Item2/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/content/gitignore +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/dictionary/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/dictionary/{{language}}.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/media/files/jss.pdf +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/media/img/jss_logo.png +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/media/img/sc_logo.png +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/graphql/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/graphql/sample-1/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/graphql/sample-2/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/styleguide/custom-route-type/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/styleguide/en.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/styleguide/{{language}}.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/data/routes/{{language}}.yml +0 -0
- /package/dist/templates/{angular-sxp → angular}/scripts/disconnected-mode-proxy.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/scripts/lint-yml.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/config/{{appName}}.config +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/component-content.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout-Reuse.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout-Tabs-Tab.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout-Tabs.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Layout.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Multilingual.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/Styleguide-Section.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/content-block.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-connected-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.graphql +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-integrated-demo.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/graph-ql-layout.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-angular-lazy-loading.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-component-params.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-custom-route-type.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-edit-frame.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-checkbox.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-content-list.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-custom.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-date.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-file.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-image.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-item-link.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-link.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-number.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-rich-text.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-field-usage-text.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-route-fields.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-sitecore-context.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/components/styleguide-tracking.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/config.js +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/content.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/dictionary.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/placeholders.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/routes.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/Styleguide-Explanatory-Component.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/styleguide-content-list-template.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/styleguide-edit-frame-list-item-template.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/definitions/templates/styleguide-item-link-template.sitecore.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/gitignore +0 -0
- /package/dist/templates/{angular-sxp → angular}/sitecore/pipelines/example.patch.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.graphql +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-connected-demo/graph-ql-connected-demo.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-integrated-demo/graph-ql-integrated-demo.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/graph-ql-layout/graph-ql-layout.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/shared/styleguide-specimen/styleguide-specimen.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-angular-lazy-loading/styleguide-angular-lazy-loading.module.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-component-params/styleguide-component-params.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-component-params/styleguide-component-params.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-custom-route-type/styleguide-custom-route-type.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-edit-frame/styleguide-edit-frame.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-checkbox/styleguide-field-usage-checkbox.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-content-list/styleguide-field-usage-content-list.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-custom/styleguide-field-usage-custom.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-date/styleguide-field-usage-date.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-file/styleguide-field-usage-file.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-image/styleguide-field-usage-image.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-item-link/styleguide-field-usage-item-link.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-link/styleguide-field-usage-link.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-number/styleguide-field-usage-number.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-rich-text/styleguide-field-usage-rich-text.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-field-usage-text/styleguide-field-usage-text.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout/styleguide-layout.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout/styleguide-layout.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-reuse/styleguide-layout-reuse.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs/styleguide-layout-tabs.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-layout-tabs-tab/styleguide-layout-tabs-tab.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-multilingual/styleguide-multilingual.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-route-fields/styleguide-route-fields.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-section/styleguide-section.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-section/styleguide-section.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-sitecore-context/styleguide-sitecore-context.component.ts +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-tracking/styleguide-tracking.component.html +0 -0
- /package/dist/templates/{angular-sxp → angular}/src/app/components/styleguide-tracking/styleguide-tracking.component.ts +0 -0
|
@@ -4,12 +4,11 @@ import { join } from 'path';
|
|
|
4
4
|
import 'reflect-metadata';
|
|
5
5
|
import 'zone.js';
|
|
6
6
|
import { JssRouteBuilderService } from './src/app/routing/jss-route-builder.service';
|
|
7
|
+
import { environment } from './src/environments/environment';
|
|
7
8
|
import { AppServerModule, renderModule } from './src/main.server';
|
|
8
9
|
|
|
9
10
|
export * from './src/main.server';
|
|
10
11
|
|
|
11
|
-
export * from './server.exports';
|
|
12
|
-
|
|
13
12
|
const http = require('http');
|
|
14
13
|
const https = require('https');
|
|
15
14
|
|
|
@@ -98,4 +97,7 @@ function parseRouteUrl(url: string) {
|
|
|
98
97
|
};
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
|
|
100
|
+
const apiKey = environment.sitecoreApiKey;
|
|
101
|
+
const siteName = environment.sitecoreSiteName;
|
|
102
|
+
|
|
103
|
+
export { renderView, parseRouteUrl, setUpDefaultAgents, apiKey, siteName };
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
RouteData,
|
|
3
|
+
LayoutServiceContextData,
|
|
4
|
+
} from '@sitecore-jss/sitecore-jss-angular';
|
|
2
5
|
import { LayoutServiceError } from './layout/jss-layout.service';
|
|
3
6
|
|
|
4
|
-
export class JssState
|
|
7
|
+
export class JssState<Fields = Record<string, unknown>> {
|
|
5
8
|
language: string;
|
|
6
9
|
serverRoute: string;
|
|
7
10
|
routeFetchError?: LayoutServiceError;
|
|
11
|
+
sitecore?: LayoutServiceContextData & {
|
|
12
|
+
route: RouteData<Fields>;
|
|
13
|
+
};
|
|
14
|
+
viewBag: { [key: string]: unknown };
|
|
8
15
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { APP_ID, NgModule, TransferState } from '@angular/core';
|
|
2
2
|
import { APP_BASE_HREF } from '@angular/common';
|
|
3
|
-
import { HttpClientModule } from '@angular/common/http';
|
|
3
|
+
import { HttpClientModule, HttpClient } from '@angular/common/http';
|
|
4
4
|
import { RoutingModule } from './routing/routing.module';
|
|
5
5
|
import { JssLayoutService } from './layout/jss-layout.service';
|
|
6
|
+
import { JssContextService } from './jss-context.service';
|
|
6
7
|
import { AppComponentsModule } from './components/app-components.module';
|
|
7
8
|
import { AppComponent } from './app.component';
|
|
8
9
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
9
10
|
import { JssTranslationClientLoaderService } from './i18n/jss-translation-client-loader.service';
|
|
10
11
|
import { JssTranslationLoaderService } from './i18n/jss-translation-loader.service';
|
|
11
12
|
import { GraphQLModule } from './jss-graphql.module';
|
|
13
|
+
import { JssDataFetcherService } from './jss-data-fetcher.service';
|
|
12
14
|
import { JssMetaService } from './jss-meta.service';
|
|
13
|
-
import { JssContextService } from './jss-context.service';
|
|
14
15
|
|
|
15
16
|
@NgModule({
|
|
16
17
|
imports: [
|
|
@@ -20,9 +21,8 @@ import { JssContextService } from './jss-context.service';
|
|
|
20
21
|
TranslateModule.forRoot({
|
|
21
22
|
loader: {
|
|
22
23
|
provide: TranslateLoader,
|
|
23
|
-
useFactory: (
|
|
24
|
-
|
|
25
|
-
deps: [TransferState],
|
|
24
|
+
useFactory: () => new JssTranslationClientLoaderService(new JssTranslationLoaderService()),
|
|
25
|
+
deps: [HttpClient, TransferState],
|
|
26
26
|
},
|
|
27
27
|
}),
|
|
28
28
|
AppComponentsModule,
|
|
@@ -31,6 +31,7 @@ import { JssContextService } from './jss-context.service';
|
|
|
31
31
|
// The token is needed in cases when multiple applications are bootstrapped on a page
|
|
32
32
|
{ provide: APP_ID, useValue: 'my-app' },
|
|
33
33
|
JssContextService,
|
|
34
|
+
JssDataFetcherService,
|
|
34
35
|
JssLayoutService,
|
|
35
36
|
JssMetaService,
|
|
36
37
|
// IMPORTANT: you must set the base href with this token, not a <base> tag in the HTML.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NgModule
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
2
|
import { ServerModule } from '@angular/platform-server';
|
|
3
3
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
4
4
|
|
|
@@ -18,14 +18,11 @@ import { JssTranslationServerLoaderService } from './i18n/jss-translation-server
|
|
|
18
18
|
// <-- *Important* to get translation values server-side
|
|
19
19
|
loader: {
|
|
20
20
|
provide: TranslateLoader,
|
|
21
|
-
useFactory: (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
transferState: TransferState
|
|
27
|
-
) => new JssTranslationServerLoaderService(ssrViewBag, transferState),
|
|
28
|
-
deps: ['JSS_SERVER_VIEWBAG', TransferState],
|
|
21
|
+
useFactory: (ssrViewBag: {
|
|
22
|
+
[key: string]: unknown;
|
|
23
|
+
dictionary: { [key: string]: string };
|
|
24
|
+
}) => new JssTranslationServerLoaderService(ssrViewBag),
|
|
25
|
+
deps: ['JSS_SERVER_VIEWBAG'],
|
|
29
26
|
},
|
|
30
27
|
}),
|
|
31
28
|
],
|
|
@@ -3,6 +3,7 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
import { FormsModule } from '@angular/forms';
|
|
4
4
|
import { TranslateModule } from '@ngx-translate/core';
|
|
5
5
|
import { RouterModule } from '@angular/router';
|
|
6
|
+
import { StyleguideSpecimenComponent } from './shared/styleguide-specimen/styleguide-specimen.component';
|
|
6
7
|
import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
7
8
|
|
|
8
9
|
/*
|
|
@@ -13,8 +14,22 @@ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
|
13
14
|
Don't want code generation? See ./.gitignore for instructions to turn it off.
|
|
14
15
|
*/
|
|
15
16
|
@NgModule({
|
|
16
|
-
imports: [
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
imports: [
|
|
18
|
+
CommonModule,
|
|
19
|
+
TranslateModule,
|
|
20
|
+
RouterModule,
|
|
21
|
+
JssModule,
|
|
22
|
+
FormsModule,
|
|
23
|
+
],
|
|
24
|
+
exports: [
|
|
25
|
+
CommonModule,
|
|
26
|
+
TranslateModule,
|
|
27
|
+
RouterModule,
|
|
28
|
+
FormsModule,
|
|
29
|
+
StyleguideSpecimenComponent
|
|
30
|
+
],
|
|
31
|
+
declarations: [
|
|
32
|
+
StyleguideSpecimenComponent
|
|
33
|
+
],
|
|
19
34
|
})
|
|
20
|
-
export class AppComponentsSharedModule {}
|
|
35
|
+
export class AppComponentsSharedModule { }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# App component module is auto-generated by default.
|
|
2
2
|
# To manually maintain the module,
|
|
3
3
|
# - Remove this ignore file
|
|
4
|
-
# - Delete /scripts/generate-component-factory
|
|
4
|
+
# - Delete /scripts/generate-component-factory.ts
|
|
5
5
|
# - Remove the reference from /scripts/bootstrap.ts
|
|
6
6
|
# - Consider merging app-components.shared and app-components modules
|
|
7
7
|
app-components.module.ts
|
|
@@ -13,6 +13,6 @@ export class GraphQLLayoutComponent implements OnInit {
|
|
|
13
13
|
constructor(private contextService: JssContextService) { }
|
|
14
14
|
|
|
15
15
|
ngOnInit() {
|
|
16
|
-
this.disconnectedMode = this.contextService.
|
|
16
|
+
this.disconnectedMode = this.contextService.state.value.sitecore.route.itemId === 'available-in-connected-mode';
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { makeStateKey, Injectable } from '@angular/core';
|
|
2
2
|
import { TranslateLoader } from '@ngx-translate/core';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { dictionaryStateKey } from './jss-translation-server-loader.service';
|
|
3
|
+
import { EMPTY } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
export const dictionaryStateKey = makeStateKey('jssDictionary');
|
|
7
6
|
|
|
8
7
|
@Injectable()
|
|
9
8
|
export class JssTranslationClientLoaderService implements TranslateLoader {
|
|
10
9
|
constructor(
|
|
11
|
-
private fallbackLoader:
|
|
12
|
-
|
|
13
|
-
) {}
|
|
14
|
-
|
|
15
|
-
getTranslation(lang: string): Observable<DictionaryPhrases> {
|
|
16
|
-
const dictionary = this.transferState.get(dictionaryStateKey, null);
|
|
17
|
-
|
|
18
|
-
if (dictionary) {
|
|
19
|
-
return of(dictionary);
|
|
20
|
-
}
|
|
10
|
+
private fallbackLoader: TranslateLoader,
|
|
11
|
+
) { }
|
|
21
12
|
|
|
13
|
+
getTranslation(lang: string) {
|
|
22
14
|
if (!this.fallbackLoader) {
|
|
23
15
|
return EMPTY;
|
|
24
16
|
}
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
import { Inject, Injectable
|
|
1
|
+
import { Inject, Injectable } from '@angular/core';
|
|
2
2
|
import { TranslateLoader } from '@ngx-translate/core';
|
|
3
|
-
import { DictionaryPhrases } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
3
|
import { of as observableOf, EMPTY } from 'rxjs';
|
|
5
4
|
|
|
6
|
-
export const dictionaryStateKey: StateKey<DictionaryPhrases> = makeStateKey<DictionaryPhrases>(
|
|
7
|
-
'dictionary'
|
|
8
|
-
);
|
|
9
|
-
|
|
10
5
|
@Injectable()
|
|
11
6
|
export class JssTranslationServerLoaderService implements TranslateLoader {
|
|
12
7
|
constructor(
|
|
13
8
|
// this initial state from sitecore is injected by server.bundle for "integrated" mode
|
|
14
9
|
@Inject('JSS_SERVER_VIEWBAG')
|
|
15
|
-
private serverViewBag: { [key: string]: unknown; dictionary:
|
|
16
|
-
private transferState: TransferState
|
|
10
|
+
private serverViewBag: { [key: string]: unknown; dictionary: { [key: string]: string } }
|
|
17
11
|
) {}
|
|
18
12
|
getTranslation(_lang: string) {
|
|
19
13
|
// read initial dictionary from data injected via server.bundle wrapper
|
|
20
14
|
const dictionary = this.serverViewBag.dictionary;
|
|
21
|
-
|
|
22
|
-
// set the dictionary in transfer state for the client
|
|
23
|
-
// since for ng-translate there is no obvious way to pass the server side dictionary to the client
|
|
24
|
-
// https://github.com/ngx-translate/core/issues/1207#issuecomment-700741671
|
|
25
|
-
this.transferState.set(dictionaryStateKey, dictionary);
|
|
26
|
-
|
|
27
15
|
if (dictionary) {
|
|
28
16
|
return observableOf(dictionary);
|
|
29
17
|
}
|
|
@@ -2,8 +2,8 @@ import { Injectable, Inject, TransferState } from '@angular/core';
|
|
|
2
2
|
import { JssContextService, jssKey } from './jss-context.service';
|
|
3
3
|
import { JssState } from './JssState';
|
|
4
4
|
import { Observable, of as observableOf } from 'rxjs';
|
|
5
|
+
import { JssDataFetcherService } from './jss-data-fetcher.service';
|
|
5
6
|
import { JssLayoutService } from './layout/jss-layout.service';
|
|
6
|
-
import { JssStateService } from '@sitecore-jss/sitecore-jss-angular';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Stores the JSS app's context (current route and Sitecore context data).
|
|
@@ -15,11 +15,11 @@ export class JssContextServerSideService extends JssContextService {
|
|
|
15
15
|
constructor(
|
|
16
16
|
protected transferState: TransferState,
|
|
17
17
|
protected layoutService: JssLayoutService,
|
|
18
|
-
protected
|
|
18
|
+
protected dataFetcher: JssDataFetcherService,
|
|
19
19
|
// this initial state from sitecore is injected by server.bundle for "integrated" mode
|
|
20
20
|
@Inject('JSS_SERVER_LAYOUT_DATA') private serverToSsrState: JssState
|
|
21
21
|
) {
|
|
22
|
-
super(transferState, layoutService
|
|
22
|
+
super(transferState, layoutService);
|
|
23
23
|
}
|
|
24
24
|
changeRoute(_route: string, _language: string): Observable<JssState> {
|
|
25
25
|
// console.log('Server route change to ' + route);
|
|
@@ -36,7 +36,7 @@ export class JssContextServerSideService extends JssContextService {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// read initial state from data injected via server.bundle wrapper
|
|
39
|
-
this.
|
|
39
|
+
this.state.next(this.serverToSsrState);
|
|
40
40
|
|
|
41
41
|
// place the initial state into TransferState for the client
|
|
42
42
|
this.transferState.set<JssState>(jssKey, this.serverToSsrState);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Injectable, TransferState, makeStateKey } from '@angular/core';
|
|
2
|
-
import { LayoutServiceData
|
|
2
|
+
import { LayoutServiceData } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
3
|
import { map, shareReplay, catchError } from 'rxjs/operators';
|
|
4
|
-
import { Observable, of as observableOf } from 'rxjs';
|
|
5
|
-
import { JssLayoutService, LayoutServiceError } from './layout/jss-layout.service';
|
|
4
|
+
import { Observable, of as observableOf, BehaviorSubject } from 'rxjs';
|
|
6
5
|
import { JssState } from './JssState';
|
|
6
|
+
import { JssLayoutService, LayoutServiceError } from './layout/jss-layout.service';
|
|
7
7
|
|
|
8
8
|
export const jssKey = makeStateKey<JssState>('jss');
|
|
9
9
|
|
|
@@ -16,17 +16,14 @@ export const jssKey = makeStateKey<JssState>('jss');
|
|
|
16
16
|
export class JssContextService {
|
|
17
17
|
// components can subscribe to this (or use getValue()) to get access to latest data from Layout Service,
|
|
18
18
|
// as well as current language and server route
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return this.stateService.stateValue;
|
|
24
|
-
}
|
|
25
|
-
constructor(protected transferState: TransferState, protected layoutService: JssLayoutService, protected stateService: JssStateService<JssState>) {
|
|
19
|
+
state: BehaviorSubject<JssState>;
|
|
20
|
+
|
|
21
|
+
constructor(protected transferState: TransferState, protected layoutService: JssLayoutService) {
|
|
22
|
+
this.state = new BehaviorSubject<JssState>(new JssState());
|
|
26
23
|
}
|
|
27
24
|
|
|
28
25
|
changeLanguage(language: string) {
|
|
29
|
-
this.
|
|
26
|
+
this.state.next({ ...this.state.value, language });
|
|
30
27
|
}
|
|
31
28
|
|
|
32
29
|
// primarily invoked by JssRouteResolver on URL/route change
|
|
@@ -36,11 +33,11 @@ export class JssContextService {
|
|
|
36
33
|
if (foundInitialState) {
|
|
37
34
|
const jssState = this.transferState.get<JssState>(jssKey, null);
|
|
38
35
|
this.transferState.remove(jssKey);
|
|
39
|
-
this.
|
|
36
|
+
this.state.next(jssState);
|
|
40
37
|
return observableOf(jssState);
|
|
41
38
|
}
|
|
42
39
|
|
|
43
|
-
const appLanguage = this.
|
|
40
|
+
const appLanguage = this.state.value.language || language;
|
|
44
41
|
|
|
45
42
|
const jssState$ = this.layoutService.getRouteData(route, appLanguage).pipe(
|
|
46
43
|
map((routeData) => {
|
|
@@ -64,7 +61,7 @@ export class JssContextService {
|
|
|
64
61
|
|
|
65
62
|
// subscribe to it ourselves so we can maintain current state
|
|
66
63
|
jssState$.subscribe((jssState) => {
|
|
67
|
-
this.
|
|
64
|
+
this.state.next(jssState);
|
|
68
65
|
});
|
|
69
66
|
|
|
70
67
|
return jssState$;
|
|
@@ -3,9 +3,7 @@ import { HttpClient, HttpErrorResponse } from '@angular/common/http';
|
|
|
3
3
|
import { HttpResponse } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
4
|
import { Observable, lastValueFrom } from 'rxjs';
|
|
5
5
|
|
|
6
|
-
@Injectable(
|
|
7
|
-
providedIn: 'root'
|
|
8
|
-
})
|
|
6
|
+
@Injectable()
|
|
9
7
|
export class JssDataFetcherService {
|
|
10
8
|
constructor(
|
|
11
9
|
private readonly httpClient: HttpClient,
|
|
@@ -43,7 +43,7 @@ export class JssGraphQLService {
|
|
|
43
43
|
) {
|
|
44
44
|
this.isEditingOrPreviewingAndSsr =
|
|
45
45
|
isPlatformServer(this.platformId) &&
|
|
46
|
-
this.sitecoreContext.
|
|
46
|
+
this.sitecoreContext.state.value.sitecore.context.pageState !== 'normal';
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
private static extractVariableNames(query: DocumentNode) {
|
|
@@ -127,19 +127,19 @@ export class JssGraphQLService {
|
|
|
127
127
|
|
|
128
128
|
if (
|
|
129
129
|
usedVariables.contextItem &&
|
|
130
|
-
this.sitecoreContext.
|
|
131
|
-
this.sitecoreContext.
|
|
132
|
-
this.sitecoreContext.
|
|
130
|
+
this.sitecoreContext.state.value.sitecore &&
|
|
131
|
+
this.sitecoreContext.state.value.sitecore.route &&
|
|
132
|
+
this.sitecoreContext.state.value.sitecore.route.itemId
|
|
133
133
|
) {
|
|
134
|
-
(variables as EmptyObject).contextItem = this.sitecoreContext.
|
|
134
|
+
(variables as EmptyObject).contextItem = this.sitecoreContext.state.value.sitecore.route.itemId;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
// pass language as a variable to the query, if language exists as a variable and in sitecoreContext
|
|
138
138
|
if (
|
|
139
139
|
usedVariables.language &&
|
|
140
|
-
this.sitecoreContext.
|
|
140
|
+
this.sitecoreContext.state.value.language
|
|
141
141
|
) {
|
|
142
|
-
(variables as EmptyObject).language = this.sitecoreContext.
|
|
142
|
+
(variables as EmptyObject).language = this.sitecoreContext.state.value.language;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
return variables;
|
|
@@ -7,14 +7,14 @@ import { from as fromPromise, Observable, throwError as observableThrow } from '
|
|
|
7
7
|
import { catchError, map } from 'rxjs/operators';
|
|
8
8
|
import { layoutServiceFactory } from '../lib/layout-service-factory';
|
|
9
9
|
|
|
10
|
+
const layoutServiceInstance = layoutServiceFactory.create();
|
|
11
|
+
|
|
10
12
|
export class LayoutServiceError {
|
|
11
13
|
status: number;
|
|
12
14
|
statusText: string;
|
|
13
15
|
data?: { sitecore?: LayoutServiceContextData };
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
const layoutServiceInstance = layoutServiceFactory.create();
|
|
17
|
-
|
|
18
18
|
@Injectable()
|
|
19
19
|
export class JssLayoutService {
|
|
20
20
|
getRouteData(
|
|
@@ -0,0 +1,28 @@
|
|
|
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 (env.graphQLEndpoint && env.sitecoreApiKey) {
|
|
17
|
+
clientConfig = {
|
|
18
|
+
endpoint: env.graphQLEndpoint,
|
|
19
|
+
apiKey: env.sitecoreApiKey,
|
|
20
|
+
};
|
|
21
|
+
} else {
|
|
22
|
+
throw new Error('Please configure your graphQLEndpoint and sitecoreApiKey.');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return GraphQLRequestClient.createClientFactory(clientConfig);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const clientFactory = createGraphQLClientFactory();
|
|
@@ -1,41 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DictionaryService,
|
|
3
3
|
GraphQLDictionaryService,
|
|
4
|
-
<% if (!locals.xmcloud) { -%>
|
|
5
4
|
RestDictionaryService,
|
|
6
5
|
constants,
|
|
7
|
-
<% } -%>
|
|
8
6
|
} from '@sitecore-jss/sitecore-jss-angular';
|
|
9
7
|
import { environment as env } from '../../environments/environment';
|
|
10
|
-
import clientFactory from './
|
|
8
|
+
import { clientFactory } from './client-factory';
|
|
11
9
|
|
|
12
10
|
export class DictionaryServiceFactory {
|
|
13
11
|
create(): DictionaryService {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
process.env.FETCH_WITH === constants.FETCH_WITH.REST
|
|
17
|
-
? new RestDictionaryService({
|
|
18
|
-
apiHost: env.sitecoreApiHost,
|
|
19
|
-
apiKey: env.sitecoreApiKey,
|
|
20
|
-
siteName: env.sitecoreSiteName,
|
|
21
|
-
})
|
|
22
|
-
:
|
|
23
|
-
<% } -%>
|
|
24
|
-
new GraphQLDictionaryService({
|
|
12
|
+
return process.env.FETCH_WITH === constants.FETCH_WITH.GRAPHQL
|
|
13
|
+
? new GraphQLDictionaryService({
|
|
25
14
|
clientFactory,
|
|
26
15
|
siteName: env.sitecoreSiteName,
|
|
27
|
-
<% if (locals.xmcloud) { -%>
|
|
28
|
-
useSiteQuery: true,
|
|
29
|
-
<% } -%>
|
|
30
16
|
/*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
17
|
+
The Dictionary Service needs a root item ID in order to fetch dictionary phrases for the current
|
|
18
|
+
app. If your Sitecore instance only has 1 JSS App, you can specify the root item ID here;
|
|
19
|
+
otherwise, the service will attempt to figure out the root item for the current JSS App using GraphQL and app name.
|
|
20
|
+
rootItemId: '{GUID}'
|
|
21
|
+
*/
|
|
22
|
+
})
|
|
23
|
+
: new RestDictionaryService({
|
|
24
|
+
apiHost: env.sitecoreApiHost,
|
|
25
|
+
apiKey: env.sitecoreApiKey,
|
|
26
|
+
siteName: env.sitecoreSiteName,
|
|
36
27
|
});
|
|
37
|
-
|
|
38
|
-
return service;
|
|
39
28
|
}
|
|
40
29
|
}
|
|
41
30
|
|
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LayoutService,
|
|
3
3
|
GraphQLLayoutService,
|
|
4
|
-
<% if (!locals.xmcloud) { -%>
|
|
5
4
|
RestLayoutService,
|
|
6
5
|
constants,
|
|
7
|
-
<% } -%>
|
|
8
6
|
} from '@sitecore-jss/sitecore-jss-angular';
|
|
9
7
|
import { environment } from '../../environments/environment';
|
|
10
|
-
import clientFactory from './
|
|
8
|
+
import { clientFactory } from './client-factory';
|
|
11
9
|
|
|
12
10
|
export class LayoutServiceFactory {
|
|
13
11
|
create(): LayoutService {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
new GraphQLLayoutService({
|
|
26
|
-
clientFactory,
|
|
27
|
-
siteName: environment.sitecoreSiteName,
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
return service;
|
|
12
|
+
return process.env.FETCH_WITH === constants.FETCH_WITH.GRAPHQL
|
|
13
|
+
? new GraphQLLayoutService({
|
|
14
|
+
clientFactory,
|
|
15
|
+
siteName: environment.sitecoreSiteName,
|
|
16
|
+
})
|
|
17
|
+
: new RestLayoutService({
|
|
18
|
+
apiHost: environment.sitecoreApiHost,
|
|
19
|
+
apiKey: environment.sitecoreApiKey,
|
|
20
|
+
siteName: environment.sitecoreSiteName,
|
|
21
|
+
configurationName: environment.layoutServiceConfigurationName,
|
|
22
|
+
});
|
|
31
23
|
}
|
|
32
24
|
}
|
|
33
25
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<app-navigation></app-navigation>
|
|
2
2
|
<div class="container">
|
|
3
3
|
<ng-container *ngIf="state === LayoutState.Layout">
|
|
4
|
-
<app-
|
|
4
|
+
<app-visitor-identification></app-visitor-identification>
|
|
5
5
|
<sc-placeholder
|
|
6
6
|
name="<%- helper.getAppPrefix(appPrefix, appName) %>jss-main"
|
|
7
7
|
[rendering]="route"
|
|
@@ -9,12 +9,12 @@ import { JssMetaService } from '../../jss-meta.service';
|
|
|
9
9
|
enum LayoutState {
|
|
10
10
|
Layout,
|
|
11
11
|
NotFound,
|
|
12
|
-
Error
|
|
12
|
+
Error
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
interface RouteFields {
|
|
16
16
|
[name: string]: unknown;
|
|
17
|
-
pageTitle
|
|
17
|
+
pageTitle: Field<string>;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
@Component({
|
|
@@ -28,11 +28,14 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|
|
28
28
|
subscription: Subscription;
|
|
29
29
|
errorContextData: LayoutServiceContextData;
|
|
30
30
|
|
|
31
|
-
constructor(
|
|
31
|
+
constructor(
|
|
32
|
+
private activatedRoute: ActivatedRoute,
|
|
33
|
+
private readonly meta: JssMetaService,
|
|
34
|
+
) { }
|
|
32
35
|
|
|
33
36
|
ngOnInit() {
|
|
34
37
|
// route data is populated by the JssRouteResolver
|
|
35
|
-
this.subscription = this.activatedRoute.data.subscribe((data: { jssState: JssState }) => {
|
|
38
|
+
this.subscription = this.activatedRoute.data.subscribe((data: { jssState: JssState<RouteFields> }) => {
|
|
36
39
|
if (!data.jssState) {
|
|
37
40
|
this.state = LayoutState.NotFound;
|
|
38
41
|
return;
|
|
@@ -45,17 +48,13 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
if (data.jssState.routeFetchError) {
|
|
48
|
-
if (
|
|
49
|
-
data.jssState.routeFetchError.status >= 400 &&
|
|
50
|
-
data.jssState.routeFetchError.status < 500
|
|
51
|
-
) {
|
|
51
|
+
if (data.jssState.routeFetchError.status >= 400 && data.jssState.routeFetchError.status < 500) {
|
|
52
52
|
this.state = LayoutState.NotFound;
|
|
53
53
|
} else {
|
|
54
54
|
this.state = LayoutState.Error;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
this.errorContextData =
|
|
58
|
-
data.jssState.routeFetchError.data && data.jssState.routeFetchError.data.sitecore;
|
|
57
|
+
this.errorContextData = data.jssState.routeFetchError.data && data.jssState.routeFetchError.data.sitecore;
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
60
|
}
|
|
@@ -72,8 +71,9 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|
|
72
71
|
}
|
|
73
72
|
}
|
|
74
73
|
|
|
75
|
-
onPlaceholderLoaded(
|
|
74
|
+
onPlaceholderLoaded(placeholderName: string) {
|
|
76
75
|
// you may optionally hook to the loaded event for a placeholder,
|
|
77
76
|
// which can be useful for analytics and other DOM-based things that need to know when a placeholder's content is available.
|
|
77
|
+
console.debug(`layout.component.ts: placeholder component fired loaded event for the ${placeholderName} placeholder`);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
<div
|
|
2
|
-
class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom"
|
|
3
|
-
>
|
|
1
|
+
<div class="d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom">
|
|
4
2
|
<h5 class="my-0 me-md-auto fw-normal">
|
|
5
3
|
<a routerLink="/" class="text-dark" class="logo"></a>
|
|
6
4
|
</h5>
|
|
@@ -13,8 +11,11 @@
|
|
|
13
11
|
>
|
|
14
12
|
{{ 'Documentation' | translate }}
|
|
15
13
|
</a>
|
|
16
|
-
<a
|
|
17
|
-
{{ '
|
|
14
|
+
<a routerLink="/styleguide" class="p-2 text-dark">
|
|
15
|
+
{{ 'Styleguide' | translate }}
|
|
16
|
+
</a>
|
|
17
|
+
<a routerLink="/graphql" class="p-2 text-dark">
|
|
18
|
+
{{ 'GraphQL' | translate }}
|
|
18
19
|
</a>
|
|
19
20
|
</nav>
|
|
20
21
|
</div>
|