create-sitecore-jss 22.2.0-canary.83 → 22.3.0-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +35 -19
- package/dist/common/index.js +5 -3
- package/dist/common/processes/install.js +9 -2
- package/dist/common/processes/next.js +6 -3
- package/dist/common/processes/transform.js +18 -13
- package/dist/common/prompts/base.js +0 -25
- package/dist/common/prompts/proxy.js +35 -0
- package/dist/common/prompts/sxp.js +34 -0
- package/dist/common/utils/helpers.js +29 -19
- package/dist/init-runner.js +16 -11
- package/dist/initializers/angular/index.js +13 -0
- package/dist/initializers/angular/prompts.js +22 -1
- package/dist/initializers/angular-sxp/index.js +62 -0
- package/dist/initializers/angular-xmcloud/index.js +80 -0
- package/dist/initializers/nextjs/index.js +2 -2
- package/dist/initializers/nextjs/prompts.js +2 -0
- 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/node-xmcloud-proxy/index.js +33 -0
- package/dist/initializers/react/index.js +3 -3
- package/dist/initializers/react/prompts.js +1 -1
- package/dist/initializers/react-native/prompts.js +1 -0
- package/dist/initializers/vue/prompts.js +1 -1
- package/dist/templates/angular/.env +4 -3
- package/dist/templates/angular/.eslintrc +1 -0
- package/dist/templates/angular/README.md +5 -45
- package/dist/templates/angular/angular.json +1 -6
- package/dist/templates/angular/gitignore +5 -0
- package/dist/templates/angular/package.json +11 -23
- 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 +22 -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-component-factory/index.ts +45 -0
- package/dist/templates/angular/scripts/generate-component-factory/plugins/component-factory.ts +147 -0
- package/dist/templates/angular/scripts/generate-component-factory/plugins/components.ts +19 -0
- package/dist/templates/angular/scripts/generate-component-factory/plugins/packages.ts +29 -0
- package/dist/templates/angular/scripts/generate-component-factory/template.ts +46 -0
- package/dist/templates/angular/scripts/generate-config.ts +71 -72
- package/dist/templates/angular/scripts/generate-plugins.ts +33 -0
- package/dist/templates/angular/scripts/temp/gitignore +2 -0
- package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +21 -28
- package/dist/templates/angular/server.bundle.ts +3 -5
- package/dist/templates/angular/server.exports.ts +13 -0
- package/dist/templates/angular/src/app/JssState.ts +2 -9
- package/dist/templates/angular/src/app/app.module.ts +5 -6
- package/dist/templates/angular/src/app/app.server.module.ts +9 -6
- package/dist/templates/angular/src/app/components/app-components.shared.module.ts +4 -19
- package/dist/templates/angular/src/app/components/gitignore +1 -1
- package/dist/templates/angular/src/app/i18n/jss-translation-client-loader.service.ts +15 -7
- package/dist/templates/angular/src/app/i18n/jss-translation-server-loader.service.ts +14 -2
- package/dist/templates/angular/src/app/jss-context.server-side.service.ts +4 -4
- package/dist/templates/angular/src/app/jss-context.service.ts +14 -11
- 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/config.ts +16 -0
- package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +24 -13
- package/dist/templates/angular/src/app/lib/graphql-client-factory/config.ts +21 -0
- package/dist/templates/angular/src/app/lib/graphql-client-factory/index.ts +16 -0
- 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 +11 -11
- 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/environments/gitignore +2 -1
- package/dist/templates/angular/src/graphql-fragment-types.ts +0 -95
- package/dist/templates/angular/tsconfig.json +7 -2
- package/dist/templates/angular-sxp/.env +2 -0
- 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 +29 -0
- package/dist/templates/angular-sxp/src/app/components/app-components.shared.module.ts +35 -0
- package/dist/templates/{angular → angular-sxp}/src/app/components/graph-ql-layout/graph-ql-layout.component.ts +1 -1
- 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 +21 -0
- package/dist/templates/angular-xmcloud/angular.json +33 -0
- package/dist/templates/angular-xmcloud/package.json +17 -0
- package/dist/templates/angular-xmcloud/scripts/bootstrap.ts +28 -0
- package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +39 -0
- package/dist/templates/angular-xmcloud/scripts/generate-component-factory/plugins/packages.ts +34 -0
- package/dist/templates/angular-xmcloud/scripts/generate-component-factory/template.ts +57 -0
- package/dist/templates/angular-xmcloud/scripts/generate-metadata.ts +25 -0
- package/dist/templates/angular-xmcloud/scripts/proxy-build.ts +15 -0
- package/dist/templates/angular-xmcloud/server.exports.ts +24 -0
- package/dist/templates/angular-xmcloud/src/app/components/app-components.shared.module.ts +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.html +5 -0
- package/dist/templates/angular-xmcloud/src/app/components/column-splitter/column-splitter.component.ts +40 -0
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +14 -0
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +30 -0
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.html +36 -0
- package/dist/templates/angular-xmcloud/src/app/components/image/image.component.ts +67 -0
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.html +15 -0
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.ts +41 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.html +23 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation-item.component.ts +65 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.html +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/navigation/navigation.component.ts +49 -0
- package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.html +5 -0
- package/dist/templates/angular-xmcloud/src/app/components/page-content/page-content.component.ts +39 -0
- package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.html +1 -0
- package/dist/templates/angular-xmcloud/src/app/components/partial-design-dynamic-placeholder/partial-design-dynamic-placeholder.component.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.html +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/promo/promo.component.ts +13 -0
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +8 -0
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +21 -0
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.html +11 -0
- package/dist/templates/angular-xmcloud/src/app/components/row-splitter/row-splitter.component.ts +35 -0
- package/dist/templates/angular-xmcloud/src/app/components/sxa.component.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.html +10 -0
- package/dist/templates/angular-xmcloud/src/app/components/title/title.component.ts +56 -0
- package/dist/templates/angular-xmcloud/src/app/jss-link.service.ts +55 -0
- package/dist/templates/angular-xmcloud/src/app/lib/config.ts +17 -0
- package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory/config.ts +58 -0
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.html +38 -0
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.ts +104 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cdp-page-view.component.ts +77 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/cloud-sdk-init.component.ts +48 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.component.html +5 -0
- package/dist/templates/angular-xmcloud/src/app/routing/scripts/scripts.module.ts +12 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_component.scss +48 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_container.scss +64 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_fonts.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_footer.scss +31 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_header.scss +51 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_navigation.scss +150 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_promo.scss +58 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_rich-text.scss +11 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/_variables.scss +10 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/basic/main.scss +8 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/main.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/_app.scss +103 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_functions.scss +8 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_mixins.scss +121 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/_vars.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_colors.scss +283 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_fontSizes.scss +16 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/abstracts/vars/_margins.scss +11 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/_fonts.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/fonts/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/index.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/_link-button.scss +26 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/links/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_inputs.scss +58 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_links.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/reset/_ui-datepicker.scss +7 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext-files-icons.scss +86 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/_richtext.scss +101 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/richtext/index.scss +2 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/_typehead.scss +95 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/base/typehead/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-column-splitter.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-container.scss +27 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-image.scss +18 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-navigation.scss +51 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-promo.scss +42 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/_component-richtext-content.scss +19 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_alignment.scss +26 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_boxed.scss +16 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_clearfix.scss +11 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_highlighted.scss +63 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_link-button.scss +16 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/_promoted-box.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/common/index.scss +6 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_bordered.scss +24 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/_title-row-box.scss +66 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/container/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/_image-default-size.scss +6 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-left.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/image-alignment/_image-right.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/index.scss +17 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_acaindent.scss +5 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/_background.scss +27 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/layout/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_component-link-list.scss +45 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/_list-vertical.scss +20 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/link-list/index.scss +2 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-fat.scss +58 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-main-horizontal-vertical.scss +176 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-mobile.scss +85 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_navigation-sidebar.scss +29 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/_sitemap-navigation.scss +20 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/navigation/index.scss +5 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_absolute-bottom-link.scss +8 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-hero.scss +40 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/_promo-shadow.scss +42 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/promo/index.scss +3 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/_rich-text-lists.scss +63 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/rich-text/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_background-colors.scss +14 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/_indent.scss +13 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/spacing/index.scss +2 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/_component-title.scss +30 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/components/title/index.scss +1 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/main.scss +4 -0
- package/dist/templates/angular-xmcloud/src/assets/styles/sass/variants/index.scss +6 -0
- 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/nextjs/package.json +4 -4
- package/dist/templates/nextjs/scripts/config/plugins/fallback.ts +0 -1
- package/dist/templates/nextjs/scripts/generate-config.ts +8 -1
- package/dist/templates/nextjs-styleguide/package.json +1 -1
- package/dist/templates/nextjs-styleguide/scripts/config/plugins/disconnected.ts +1 -0
- package/dist/templates/nextjs-sxa/src/assets/sass/components/common/_alignment.scss +34 -7
- package/dist/templates/node-headless-ssr-experience-edge/gitignore +19 -0
- package/dist/templates/node-headless-ssr-experience-edge/package.json +2 -2
- package/dist/templates/node-headless-ssr-proxy/gitignore +19 -0
- package/dist/templates/node-headless-ssr-proxy/package.json +3 -3
- 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 +9 -2
- package/dist/templates/node-xmcloud-proxy/.env +14 -0
- package/dist/templates/node-xmcloud-proxy/README.md +36 -0
- package/dist/templates/node-xmcloud-proxy/gitignore +33 -0
- package/dist/templates/node-xmcloud-proxy/package.json +26 -0
- package/dist/templates/node-xmcloud-proxy/src/config.ts +25 -0
- package/dist/templates/node-xmcloud-proxy/src/index.ts +210 -0
- package/dist/templates/node-xmcloud-proxy/src/types.ts +27 -0
- package/dist/templates/node-xmcloud-proxy/tsconfig.json +22 -0
- package/dist/templates/react/package.json +5 -5
- package/dist/templates/react/scripts/generate-config.js +10 -3
- package/dist/templates/react-native/package.json +4 -4
- package/dist/templates/vue/package.json +4 -4
- package/dist/templates/vue/scripts/generate-config.js +5 -0
- package/package.json +2 -2
- package/dist/templates/angular/scripts/generate-component-factory.ts +0 -166
- package/dist/templates/angular/src/app/lib/client-factory.ts +0 -28
- /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/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,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RouteData,
|
|
3
|
-
LayoutServiceContextData,
|
|
4
|
-
} from '@sitecore-jss/sitecore-jss-angular';
|
|
1
|
+
import { BaseJssState } from '@sitecore-jss/sitecore-jss-angular';
|
|
5
2
|
import { LayoutServiceError } from './layout/jss-layout.service';
|
|
6
3
|
|
|
7
|
-
export class JssState
|
|
4
|
+
export class JssState extends BaseJssState {
|
|
8
5
|
language: string;
|
|
9
6
|
serverRoute: string;
|
|
10
7
|
routeFetchError?: LayoutServiceError;
|
|
11
|
-
sitecore?: LayoutServiceContextData & {
|
|
12
|
-
route: RouteData<Fields>;
|
|
13
|
-
};
|
|
14
|
-
viewBag: { [key: string]: unknown };
|
|
15
8
|
}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { APP_ID, NgModule, TransferState } from '@angular/core';
|
|
2
2
|
import { APP_BASE_HREF } from '@angular/common';
|
|
3
|
-
import { HttpClientModule
|
|
3
|
+
import { HttpClientModule } 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';
|
|
7
6
|
import { AppComponentsModule } from './components/app-components.module';
|
|
8
7
|
import { AppComponent } from './app.component';
|
|
9
8
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
10
9
|
import { JssTranslationClientLoaderService } from './i18n/jss-translation-client-loader.service';
|
|
11
10
|
import { JssTranslationLoaderService } from './i18n/jss-translation-loader.service';
|
|
12
11
|
import { GraphQLModule } from './jss-graphql.module';
|
|
13
|
-
import { JssDataFetcherService } from './jss-data-fetcher.service';
|
|
14
12
|
import { JssMetaService } from './jss-meta.service';
|
|
13
|
+
import { JssContextService } from './jss-context.service';
|
|
15
14
|
|
|
16
15
|
@NgModule({
|
|
17
16
|
imports: [
|
|
@@ -21,8 +20,9 @@ import { JssMetaService } from './jss-meta.service';
|
|
|
21
20
|
TranslateModule.forRoot({
|
|
22
21
|
loader: {
|
|
23
22
|
provide: TranslateLoader,
|
|
24
|
-
useFactory: () =>
|
|
25
|
-
|
|
23
|
+
useFactory: (transferState: TransferState) =>
|
|
24
|
+
new JssTranslationClientLoaderService(new JssTranslationLoaderService(), transferState),
|
|
25
|
+
deps: [TransferState],
|
|
26
26
|
},
|
|
27
27
|
}),
|
|
28
28
|
AppComponentsModule,
|
|
@@ -31,7 +31,6 @@ import { JssMetaService } from './jss-meta.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,
|
|
35
34
|
JssLayoutService,
|
|
36
35
|
JssMetaService,
|
|
37
36
|
// IMPORTANT: you must set the base href with this token, not a <base> tag in the HTML.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
1
|
+
import { NgModule, TransferState } from '@angular/core';
|
|
2
2
|
import { ServerModule } from '@angular/platform-server';
|
|
3
3
|
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
4
4
|
|
|
@@ -18,11 +18,14 @@ 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
|
-
|
|
21
|
+
useFactory: (
|
|
22
|
+
ssrViewBag: {
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
dictionary: { [key: string]: string };
|
|
25
|
+
},
|
|
26
|
+
transferState: TransferState
|
|
27
|
+
) => new JssTranslationServerLoaderService(ssrViewBag, transferState),
|
|
28
|
+
deps: ['JSS_SERVER_VIEWBAG', TransferState],
|
|
26
29
|
},
|
|
27
30
|
}),
|
|
28
31
|
],
|
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
8
7
|
|
|
9
8
|
/*
|
|
@@ -14,22 +13,8 @@ import { JssModule } from '@sitecore-jss/sitecore-jss-angular';
|
|
|
14
13
|
Don't want code generation? See ./.gitignore for instructions to turn it off.
|
|
15
14
|
*/
|
|
16
15
|
@NgModule({
|
|
17
|
-
imports: [
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
],
|
|
16
|
+
imports: [CommonModule, TranslateModule, RouterModule, JssModule, FormsModule],
|
|
17
|
+
exports: [CommonModule, TranslateModule, RouterModule, FormsModule],
|
|
18
|
+
declarations: [],
|
|
34
19
|
})
|
|
35
|
-
export class AppComponentsSharedModule {
|
|
20
|
+
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.ts
|
|
4
|
+
# - Delete /scripts/generate-component-factory/index.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
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Injectable, TransferState } from '@angular/core';
|
|
2
2
|
import { TranslateLoader } from '@ngx-translate/core';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { DictionaryPhrases } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
|
+
import { EMPTY, Observable, of } from 'rxjs';
|
|
5
|
+
import { JssTranslationLoaderService } from './jss-translation-loader.service';
|
|
6
|
+
import { dictionaryStateKey } from './jss-translation-server-loader.service';
|
|
6
7
|
|
|
7
8
|
@Injectable()
|
|
8
9
|
export class JssTranslationClientLoaderService implements TranslateLoader {
|
|
9
10
|
constructor(
|
|
10
|
-
private fallbackLoader:
|
|
11
|
-
|
|
11
|
+
private fallbackLoader: JssTranslationLoaderService,
|
|
12
|
+
private transferState: TransferState
|
|
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
|
+
}
|
|
12
21
|
|
|
13
|
-
getTranslation(lang: string) {
|
|
14
22
|
if (!this.fallbackLoader) {
|
|
15
23
|
return EMPTY;
|
|
16
24
|
}
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
import { Inject, Injectable } from '@angular/core';
|
|
1
|
+
import { Inject, Injectable, makeStateKey, StateKey, TransferState } from '@angular/core';
|
|
2
2
|
import { TranslateLoader } from '@ngx-translate/core';
|
|
3
|
+
import { DictionaryPhrases } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
4
|
import { of as observableOf, EMPTY } from 'rxjs';
|
|
4
5
|
|
|
6
|
+
export const dictionaryStateKey: StateKey<DictionaryPhrases> = makeStateKey<DictionaryPhrases>(
|
|
7
|
+
'dictionary'
|
|
8
|
+
);
|
|
9
|
+
|
|
5
10
|
@Injectable()
|
|
6
11
|
export class JssTranslationServerLoaderService implements TranslateLoader {
|
|
7
12
|
constructor(
|
|
8
13
|
// this initial state from sitecore is injected by server.bundle for "integrated" mode
|
|
9
14
|
@Inject('JSS_SERVER_VIEWBAG')
|
|
10
|
-
private serverViewBag: { [key: string]: unknown; dictionary:
|
|
15
|
+
private serverViewBag: { [key: string]: unknown; dictionary: DictionaryPhrases },
|
|
16
|
+
private transferState: TransferState
|
|
11
17
|
) {}
|
|
12
18
|
getTranslation(_lang: string) {
|
|
13
19
|
// read initial dictionary from data injected via server.bundle wrapper
|
|
14
20
|
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
|
+
|
|
15
27
|
if (dictionary) {
|
|
16
28
|
return observableOf(dictionary);
|
|
17
29
|
}
|
|
@@ -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';
|
|
6
5
|
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 stateService: JssStateService<JssState>,
|
|
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, stateService);
|
|
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.stateService.setState(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 } from '@sitecore-jss/sitecore-jss-angular';
|
|
2
|
+
import { LayoutServiceData, JssStateService } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
3
|
import { map, shareReplay, catchError } from 'rxjs/operators';
|
|
4
|
-
import { Observable, of as observableOf
|
|
5
|
-
import { JssState } from './JssState';
|
|
4
|
+
import { Observable, of as observableOf } from 'rxjs';
|
|
6
5
|
import { JssLayoutService, LayoutServiceError } from './layout/jss-layout.service';
|
|
6
|
+
import { JssState } from './JssState';
|
|
7
7
|
|
|
8
8
|
export const jssKey = makeStateKey<JssState>('jss');
|
|
9
9
|
|
|
@@ -16,14 +16,17 @@ 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
|
-
state
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
get state() {
|
|
20
|
+
return this.stateService.state;
|
|
21
|
+
}
|
|
22
|
+
get stateValue() {
|
|
23
|
+
return this.stateService.stateValue;
|
|
24
|
+
}
|
|
25
|
+
constructor(protected transferState: TransferState, protected layoutService: JssLayoutService, protected stateService: JssStateService<JssState>) {
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
changeLanguage(language: string) {
|
|
26
|
-
this.
|
|
29
|
+
this.stateService.setState({ ...this.stateService.stateValue, language });
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
// primarily invoked by JssRouteResolver on URL/route change
|
|
@@ -33,11 +36,11 @@ export class JssContextService {
|
|
|
33
36
|
if (foundInitialState) {
|
|
34
37
|
const jssState = this.transferState.get<JssState>(jssKey, null);
|
|
35
38
|
this.transferState.remove(jssKey);
|
|
36
|
-
this.
|
|
39
|
+
this.stateService.setState(jssState);
|
|
37
40
|
return observableOf(jssState);
|
|
38
41
|
}
|
|
39
42
|
|
|
40
|
-
const appLanguage = this.
|
|
43
|
+
const appLanguage = this.stateService.stateValue.language || language;
|
|
41
44
|
|
|
42
45
|
const jssState$ = this.layoutService.getRouteData(route, appLanguage).pipe(
|
|
43
46
|
map((routeData) => {
|
|
@@ -61,7 +64,7 @@ export class JssContextService {
|
|
|
61
64
|
|
|
62
65
|
// subscribe to it ourselves so we can maintain current state
|
|
63
66
|
jssState$.subscribe((jssState) => {
|
|
64
|
-
this.
|
|
67
|
+
this.stateService.setState(jssState);
|
|
65
68
|
});
|
|
66
69
|
|
|
67
70
|
return jssState$;
|
|
@@ -43,7 +43,7 @@ export class JssGraphQLService {
|
|
|
43
43
|
) {
|
|
44
44
|
this.isEditingOrPreviewingAndSsr =
|
|
45
45
|
isPlatformServer(this.platformId) &&
|
|
46
|
-
this.sitecoreContext.
|
|
46
|
+
this.sitecoreContext.stateValue.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.stateValue.sitecore &&
|
|
131
|
+
this.sitecoreContext.stateValue.sitecore.route &&
|
|
132
|
+
this.sitecoreContext.stateValue.sitecore.route.itemId
|
|
133
133
|
) {
|
|
134
|
-
(variables as EmptyObject).contextItem = this.sitecoreContext.
|
|
134
|
+
(variables as EmptyObject).contextItem = this.sitecoreContext.stateValue.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.stateValue.language
|
|
141
141
|
) {
|
|
142
|
-
(variables as EmptyObject).language = this.sitecoreContext.
|
|
142
|
+
(variables as EmptyObject).language = this.sitecoreContext.stateValue.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
|
-
|
|
12
10
|
export class LayoutServiceError {
|
|
13
11
|
status: number;
|
|
14
12
|
statusText: string;
|
|
15
13
|
data?: { sitecore?: LayoutServiceContextData };
|
|
16
14
|
}
|
|
17
15
|
|
|
16
|
+
const layoutServiceInstance = layoutServiceFactory.create();
|
|
17
|
+
|
|
18
18
|
@Injectable()
|
|
19
19
|
export class JssLayoutService {
|
|
20
20
|
getRouteData(
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
<% if (!locals.xmcloud) { -%>
|
|
13
|
+
layoutServiceConfigurationName?: string;
|
|
14
|
+
<% } -%>
|
|
15
|
+
defaultServerRoute?: string;
|
|
16
|
+
}
|
|
@@ -1,30 +1,41 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DictionaryService,
|
|
3
3
|
GraphQLDictionaryService,
|
|
4
|
+
<% if (!locals.xmcloud) { -%>
|
|
4
5
|
RestDictionaryService,
|
|
5
6
|
constants,
|
|
7
|
+
<% } -%>
|
|
6
8
|
} from '@sitecore-jss/sitecore-jss-angular';
|
|
7
9
|
import { environment as env } from '../../environments/environment';
|
|
8
|
-
import
|
|
10
|
+
import clientFactory from './graphql-client-factory';
|
|
9
11
|
|
|
10
12
|
export class DictionaryServiceFactory {
|
|
11
13
|
create(): DictionaryService {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/*
|
|
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({
|
|
14
|
+
const service =
|
|
15
|
+
<% if (!locals.xmcloud) { -%>
|
|
16
|
+
process.env.FETCH_WITH === constants.FETCH_WITH.REST
|
|
17
|
+
? new RestDictionaryService({
|
|
24
18
|
apiHost: env.sitecoreApiHost,
|
|
25
19
|
apiKey: env.sitecoreApiKey,
|
|
26
20
|
siteName: env.sitecoreSiteName,
|
|
21
|
+
})
|
|
22
|
+
:
|
|
23
|
+
<% } -%>
|
|
24
|
+
new GraphQLDictionaryService({
|
|
25
|
+
clientFactory,
|
|
26
|
+
siteName: env.sitecoreSiteName,
|
|
27
|
+
<% if (locals.xmcloud) { -%>
|
|
28
|
+
useSiteQuery: true,
|
|
29
|
+
<% } -%>
|
|
30
|
+
/*
|
|
31
|
+
The Dictionary Service needs a root item ID in order to fetch dictionary phrases for the current
|
|
32
|
+
app. If your Sitecore instance only has 1 JSS App, you can specify the root item ID here;
|
|
33
|
+
otherwise, the service will attempt to figure out the root item for the current JSS App using GraphQL and app name.
|
|
34
|
+
rootItemId: '{GUID}'
|
|
35
|
+
*/
|
|
27
36
|
});
|
|
37
|
+
|
|
38
|
+
return service;
|
|
28
39
|
}
|
|
29
40
|
}
|
|
30
41
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GraphQLRequestClientFactoryConfig } from '@sitecore-jss/sitecore-jss-angular/cjs';
|
|
2
|
+
import { environment as env } from '../../../environments/environment';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Gets the configuration for the GraphQLRequestClientFactory
|
|
6
|
+
* @returns GraphQLRequestClientFactoryConfig
|
|
7
|
+
*/
|
|
8
|
+
export const getGraphQLClientFactoryConfig = () => {
|
|
9
|
+
let clientConfig: GraphQLRequestClientFactoryConfig;
|
|
10
|
+
|
|
11
|
+
if (env.graphQLEndpoint && env.sitecoreApiKey) {
|
|
12
|
+
clientConfig = {
|
|
13
|
+
endpoint: env.graphQLEndpoint,
|
|
14
|
+
apiKey: env.sitecoreApiKey,
|
|
15
|
+
};
|
|
16
|
+
} else {
|
|
17
|
+
throw new Error('Please configure your graphQLEndpoint and sitecoreApiKey.');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return clientConfig;
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GraphQLRequestClient } from '@sitecore-jss/sitecore-jss-angular/cjs';
|
|
2
|
+
import { getGraphQLClientFactoryConfig } from './config';
|
|
3
|
+
|
|
4
|
+
// The GraphQLRequestClientFactory serves as the central hub for executing GraphQL requests within the application
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new GraphQLRequestClientFactory instance
|
|
8
|
+
* @returns GraphQLRequestClientFactory instance
|
|
9
|
+
*/
|
|
10
|
+
const createGraphQLClientFactory = () => {
|
|
11
|
+
const clientConfig = getGraphQLClientFactoryConfig();
|
|
12
|
+
|
|
13
|
+
return GraphQLRequestClient.createClientFactory(clientConfig);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default createGraphQLClientFactory();
|
|
@@ -1,25 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LayoutService,
|
|
3
3
|
GraphQLLayoutService,
|
|
4
|
+
<% if (!locals.xmcloud) { -%>
|
|
4
5
|
RestLayoutService,
|
|
5
6
|
constants,
|
|
7
|
+
<% } -%>
|
|
6
8
|
} from '@sitecore-jss/sitecore-jss-angular';
|
|
7
9
|
import { environment } from '../../environments/environment';
|
|
8
|
-
import
|
|
10
|
+
import clientFactory from './graphql-client-factory';
|
|
9
11
|
|
|
10
12
|
export class LayoutServiceFactory {
|
|
11
13
|
create(): LayoutService {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
const service =
|
|
15
|
+
<% if (!locals.xmcloud) { -%>
|
|
16
|
+
process.env.FETCH_WITH === constants.FETCH_WITH.REST
|
|
17
|
+
? new RestLayoutService({
|
|
18
|
+
apiHost: environment.sitecoreApiHost,
|
|
19
|
+
apiKey: environment.sitecoreApiKey,
|
|
20
|
+
siteName: environment.sitecoreSiteName,
|
|
21
|
+
configurationName: environment.layoutServiceConfigurationName,
|
|
22
|
+
})
|
|
23
|
+
:
|
|
24
|
+
<% } -%>
|
|
25
|
+
new GraphQLLayoutService({
|
|
26
|
+
clientFactory,
|
|
27
|
+
siteName: environment.sitecoreSiteName,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return service;
|
|
23
31
|
}
|
|
24
32
|
}
|
|
25
33
|
|
|
@@ -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-scripts></app-scripts>
|
|
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,14 +28,11 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|
|
28
28
|
subscription: Subscription;
|
|
29
29
|
errorContextData: LayoutServiceContextData;
|
|
30
30
|
|
|
31
|
-
constructor(
|
|
32
|
-
private activatedRoute: ActivatedRoute,
|
|
33
|
-
private readonly meta: JssMetaService,
|
|
34
|
-
) { }
|
|
31
|
+
constructor(private activatedRoute: ActivatedRoute, private readonly meta: JssMetaService) {}
|
|
35
32
|
|
|
36
33
|
ngOnInit() {
|
|
37
34
|
// route data is populated by the JssRouteResolver
|
|
38
|
-
this.subscription = this.activatedRoute.data.subscribe((data: { jssState: JssState
|
|
35
|
+
this.subscription = this.activatedRoute.data.subscribe((data: { jssState: JssState }) => {
|
|
39
36
|
if (!data.jssState) {
|
|
40
37
|
this.state = LayoutState.NotFound;
|
|
41
38
|
return;
|
|
@@ -48,13 +45,17 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
if (data.jssState.routeFetchError) {
|
|
51
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
data.jssState.routeFetchError.status >= 400 &&
|
|
50
|
+
data.jssState.routeFetchError.status < 500
|
|
51
|
+
) {
|
|
52
52
|
this.state = LayoutState.NotFound;
|
|
53
53
|
} else {
|
|
54
54
|
this.state = LayoutState.Error;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
this.errorContextData =
|
|
57
|
+
this.errorContextData =
|
|
58
|
+
data.jssState.routeFetchError.data && data.jssState.routeFetchError.data.sitecore;
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
}
|
|
@@ -71,9 +72,8 @@ export class LayoutComponent implements OnInit, OnDestroy {
|
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
onPlaceholderLoaded(
|
|
75
|
+
onPlaceholderLoaded(_placeholderName: string) {
|
|
75
76
|
// you may optionally hook to the loaded event for a placeholder,
|
|
76
77
|
// 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,4 +1,6 @@
|
|
|
1
|
-
<div
|
|
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
|
+
>
|
|
2
4
|
<h5 class="my-0 me-md-auto fw-normal">
|
|
3
5
|
<a routerLink="/" class="text-dark" class="logo"></a>
|
|
4
6
|
</h5>
|
|
@@ -11,11 +13,8 @@
|
|
|
11
13
|
>
|
|
12
14
|
{{ 'Documentation' | translate }}
|
|
13
15
|
</a>
|
|
14
|
-
<a
|
|
15
|
-
{{ '
|
|
16
|
-
</a>
|
|
17
|
-
<a routerLink="/graphql" class="p-2 text-dark">
|
|
18
|
-
{{ 'GraphQL' | translate }}
|
|
16
|
+
<a href="https://github.com/Sitecore/jss" class="p-2 text-dark">
|
|
17
|
+
{{ 'JSS Repository' | translate }}
|
|
19
18
|
</a>
|
|
20
19
|
</nav>
|
|
21
20
|
</div>
|