create-sitecore-jss 22.2.0-canary.2 → 22.2.0-canary.21
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 +17 -42
- package/dist/common/index.js +5 -3
- package/dist/common/processes/install.js +1 -1
- package/dist/common/processes/next.js +3 -3
- package/dist/common/processes/transform.js +19 -19
- 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 +6 -3
- package/dist/initializers/angular/index.js +0 -3
- package/dist/initializers/angular/prompts.js +6 -6
- package/dist/initializers/angular-sxp/index.js +8 -2
- package/dist/initializers/angular-xmcloud/index.js +28 -4
- 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 +2 -1
- 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 -5
- package/dist/templates/angular/package.json +0 -2
- package/dist/templates/angular/scripts/config/plugins/fallback.ts +0 -1
- package/dist/templates/angular/scripts/generate-config.ts +25 -6
- package/dist/templates/angular/scripts/update-graphql-fragment-data.ts +21 -30
- package/dist/templates/angular/server.bundle.ts +4 -5
- package/dist/templates/angular/src/app/JssState.ts +3 -6
- package/dist/templates/angular/src/app/lib/dictionary-service-factory.ts +4 -1
- 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 +1 -1
- package/dist/templates/angular/src/app/routing/layout/layout.component.ts +10 -9
- package/dist/templates/angular-sxp/.env +2 -0
- package/dist/templates/angular-sxp/scripts/config/plugins/disconnected.ts +4 -2
- package/dist/templates/angular-xmcloud/.env +7 -1
- package/dist/templates/angular-xmcloud/angular.json +34 -0
- package/dist/templates/angular-xmcloud/package.json +15 -10
- package/dist/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts +16 -0
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.html +15 -0
- package/dist/templates/angular-xmcloud/src/app/components/container/container.component.ts +30 -0
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.html +13 -0
- package/dist/templates/angular-xmcloud/src/app/components/richtext/richtext.component.ts +16 -0
- package/dist/templates/angular-xmcloud/src/app/components/sxa.component.ts +15 -0
- package/dist/templates/angular-xmcloud/src/app/jss-link.service.ts +55 -0
- package/dist/templates/angular-xmcloud/src/app/lib/config.ts +2 -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 +39 -0
- package/dist/templates/angular-xmcloud/src/app/routing/layout/layout.component.ts +104 -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 +49 -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 +4 -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/scripts/config/plugins/fallback.ts +0 -1
- package/dist/templates/nextjs/scripts/generate-config.ts +8 -1
- package/dist/templates/nextjs-styleguide/scripts/config/plugins/disconnected.ts +1 -0
- package/dist/templates/nextjs-sxa/src/assets/sass/components/_component-image.scss +1 -1
- package/dist/templates/nextjs-sxa/src/components/Container.tsx +6 -14
- package/dist/templates/node-xmcloud-proxy/package.json +2 -2
- package/dist/templates/node-xmcloud-proxy/src/config.ts +1 -1
- package/dist/templates/node-xmcloud-proxy/src/index.ts +28 -4
- package/dist/templates/node-xmcloud-proxy/src/types.ts +5 -3
- package/dist/templates/react/scripts/generate-config.js +10 -3
- package/dist/templates/vue/scripts/generate-config.js +5 -0
- package/package.json +2 -2
- package/dist/templates/angular/src/app/lib/graphql-client-factory.ts +0 -28
- package/dist/templates/angular-xmcloud/src/app/lib/graphql-client-factory.ts +0 -44
|
@@ -41,7 +41,7 @@ class NextjsStyleguideInitializer {
|
|
|
41
41
|
init(args) {
|
|
42
42
|
var _a, _b, _c, _d, _e, _f;
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const pkg = (0, common_1.
|
|
44
|
+
const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
|
|
45
45
|
const mergedArgs = Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false });
|
|
46
46
|
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-styleguide-tracking');
|
|
47
47
|
yield (0, common_1.transform)(templatePath, mergedArgs);
|
|
@@ -41,7 +41,7 @@ class NextjsSxaInitializer {
|
|
|
41
41
|
init(args) {
|
|
42
42
|
var _a, _b, _c, _d;
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
const pkg = (0, common_1.
|
|
44
|
+
const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
|
|
45
45
|
// TODO: prompts for SXA
|
|
46
46
|
// const answers = await prompt<StyleguideAnswer>(styleguidePrompts, args);
|
|
47
47
|
const mergedArgs = Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false });
|
|
@@ -42,7 +42,7 @@ class NextjsXMCloudInitializer {
|
|
|
42
42
|
init(args) {
|
|
43
43
|
var _a, _b, _c, _d;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const pkg = (0, common_1.
|
|
45
|
+
const pkg = (0, common_1.openJsonFile)(`${args.destination}${path_1.sep}package.json`);
|
|
46
46
|
const mergedArgs = Object.assign(Object.assign({}, args), { appName: args.appName || ((_a = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _a === void 0 ? void 0 : _a.appName) || common_1.DEFAULT_APPNAME, appPrefix: args.appPrefix || ((_b = pkg === null || pkg === void 0 ? void 0 : pkg.config) === null || _b === void 0 ? void 0 : _b.prefix) || false });
|
|
47
47
|
const templatePath = path_1.default.resolve(__dirname, '../../templates/nextjs-xmcloud');
|
|
48
48
|
yield (0, common_1.transform)(templatePath, mergedArgs);
|
|
@@ -21,7 +21,8 @@ class AngularXmCloudInitializer {
|
|
|
21
21
|
init(args) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
const templatePath = path_1.default.resolve(__dirname, '../../templates/node-xmcloud-proxy');
|
|
24
|
-
|
|
24
|
+
const modifiedArgs = Object.assign(Object.assign({}, args), { destination: args.proxyAppDestination || args.destination });
|
|
25
|
+
yield (0, common_1.transform)(templatePath, modifiedArgs);
|
|
25
26
|
const response = {
|
|
26
27
|
appName: 'node-xmcloud-proxy',
|
|
27
28
|
};
|
|
@@ -52,7 +52,7 @@ class ReactInitializer {
|
|
|
52
52
|
yield (0, common_1.transform)(templatePath, mergedArgs);
|
|
53
53
|
const isDev = (0, common_1.isDevEnvironment)(args.destination);
|
|
54
54
|
const pkgPath = path_1.default.resolve(`${args.destination}${path_1.sep}package.json`);
|
|
55
|
-
const pkg = (0, common_1.
|
|
55
|
+
const pkg = (0, common_1.openJsonFile)(pkgPath);
|
|
56
56
|
if (isDev) {
|
|
57
57
|
Object.entries(pkg.scripts).forEach(([key, value]) => {
|
|
58
58
|
// Can't rewire `eject` script
|
|
@@ -61,14 +61,14 @@ class ReactInitializer {
|
|
|
61
61
|
// It's required to start each command using `react-app-rewired`, to solve duplicate `react` issue
|
|
62
62
|
pkg.scripts[key] = value.replace('react-scripts', 'react-app-rewired');
|
|
63
63
|
});
|
|
64
|
-
(0, common_1.
|
|
64
|
+
(0, common_1.writeJsonFile)(pkg, pkgPath);
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
67
|
// Don't need to rewire anything if we are not in the dev env
|
|
68
68
|
delete pkg.devDependencies['react-app-rewired'];
|
|
69
69
|
// Remove webpack overrides
|
|
70
70
|
(0, common_1.removeFile)(path_1.default.resolve(`${args.destination}${path_1.sep}config-overrides.js`));
|
|
71
|
-
(0, common_1.
|
|
71
|
+
(0, common_1.writeJsonFile)(pkg, pkgPath);
|
|
72
72
|
}
|
|
73
73
|
const response = {
|
|
74
74
|
nextSteps: [`* Connect to Sitecore with ${chalk_1.default.green('jss setup')} (optional)`],
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prompts = void 0;
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
|
-
exports.prompts = [...common_1.clientAppPrompts, ...common_1.styleguidePrompts];
|
|
5
|
+
exports.prompts = [...common_1.clientAppPrompts, ...common_1.sxpPrompts, ...common_1.styleguidePrompts];
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prompts = void 0;
|
|
4
4
|
const common_1 = require("../../common");
|
|
5
|
-
exports.prompts = [...common_1.clientAppPrompts, ...common_1.styleguidePrompts];
|
|
5
|
+
exports.prompts = [...common_1.clientAppPrompts, ...common_1.sxpPrompts, ...common_1.styleguidePrompts];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# ====== Sitecore Preview / Delivery Edge ======
|
|
2
|
+
|
|
1
3
|
# Your Sitecore API key is needed to build the app. Typically, the API key is
|
|
2
4
|
# defined in `scjssconfig.json` (as `sitecore.apiKey`). This file may not exist
|
|
3
5
|
# when building locally (if you've never run `jss setup`), or when building in a
|
|
@@ -17,15 +19,12 @@ SITECORE_API_HOST=
|
|
|
17
19
|
# the resolved Sitecore API hostname + the `graphQLEndpointPath` defined in your `package.json`.
|
|
18
20
|
GRAPH_QL_ENDPOINT=
|
|
19
21
|
|
|
22
|
+
# ==============================================
|
|
23
|
+
|
|
20
24
|
# Your Sitecore site name.
|
|
21
25
|
# Uses your `package.json` config `appName` if empty.
|
|
22
26
|
SITECORE_SITE_NAME=
|
|
23
27
|
|
|
24
|
-
<% if (!locals.xmcloud) { -%>
|
|
25
|
-
# The way in which layout and dictionary data is fetched from Sitecore
|
|
26
|
-
FETCH_WITH=<%- fetchWith %>
|
|
27
|
-
<% } -%>
|
|
28
|
-
|
|
29
28
|
# Your default app language.
|
|
30
29
|
DEFAULT_LANGUAGE=
|
|
31
30
|
|
|
@@ -81,7 +81,6 @@
|
|
|
81
81
|
"@sitecore-jss/sitecore-jss-angular-schematics": "~22.2.0-canary",
|
|
82
82
|
"@sitecore-jss/sitecore-jss-cli": "~22.2.0-canary",
|
|
83
83
|
"@sitecore-jss/sitecore-jss-dev-tools": "~22.2.0-canary",
|
|
84
|
-
"@types/isomorphic-fetch": "0.0.35",
|
|
85
84
|
"@types/jasmine": "~3.6.7",
|
|
86
85
|
"@types/jasminewd2": "~2.0.8",
|
|
87
86
|
"@types/node": "~20.14.10",
|
|
@@ -99,7 +98,6 @@
|
|
|
99
98
|
"eslint-plugin-import": "2.29.1",
|
|
100
99
|
"eslint-plugin-jsdoc": "48.7.0",
|
|
101
100
|
"eslint-plugin-prefer-arrow": "1.2.3",
|
|
102
|
-
"isomorphic-fetch": "^3.0.0",
|
|
103
101
|
"jasmine-core": "~3.7.1",
|
|
104
102
|
"jasmine-spec-reporter": "~6.0.0",
|
|
105
103
|
"karma": "^6.3.2",
|
|
@@ -12,7 +12,6 @@ class FallbackPlugin implements ConfigPlugin {
|
|
|
12
12
|
async exec(config: JssConfig) {
|
|
13
13
|
return Object.assign({}, config, {
|
|
14
14
|
defaultLanguage: config.defaultLanguage || 'en',
|
|
15
|
-
sitecoreApiKey: config.sitecoreApiKey || 'no-api-key-set',
|
|
16
15
|
<% if (!locals.xmcloud) { -%>
|
|
17
16
|
layoutServiceConfigurationName: config.layoutServiceConfigurationName || 'default',
|
|
18
17
|
<% } -%>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
1
2
|
import * as fs from 'fs';
|
|
2
3
|
import * as path from 'path';
|
|
3
4
|
import { constantCase } from 'constant-case';
|
|
@@ -23,8 +24,16 @@ const defaultConfigValue: JssConfig = {
|
|
|
23
24
|
defaultServerRoute: '/',
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
generateConfig('src/environments/environment.
|
|
27
|
+
async function main() {
|
|
28
|
+
await generateConfig('src/environments/environment.js', defaultConfigValue, {
|
|
29
|
+
production: false,
|
|
30
|
+
});
|
|
31
|
+
await generateConfig('src/environments/environment.prod.js', defaultConfigValue, {
|
|
32
|
+
production: true,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
main();
|
|
28
37
|
|
|
29
38
|
/**
|
|
30
39
|
* Generates the JSS config based on config plugins (under ./config/plugins)
|
|
@@ -38,7 +47,15 @@ export function generateConfig(
|
|
|
38
47
|
defaultConfig: JssConfig = defaultConfigValue,
|
|
39
48
|
configOverrides?: { [key: string]: unknown }
|
|
40
49
|
) {
|
|
41
|
-
|
|
50
|
+
// Handle undefined values
|
|
51
|
+
defaultConfig = Object.keys(defaultConfig).reduce((acc, key) => {
|
|
52
|
+
return {
|
|
53
|
+
...acc,
|
|
54
|
+
[key]: defaultConfig[key] || '',
|
|
55
|
+
};
|
|
56
|
+
}, {});
|
|
57
|
+
|
|
58
|
+
return jssConfigFactory
|
|
42
59
|
.create(defaultConfig)
|
|
43
60
|
.then((config) => {
|
|
44
61
|
writeConfig(Object.assign(config, configOverrides), outputPath);
|
|
@@ -67,9 +84,11 @@ export function writeConfig(config: JssConfig, outputPath?: string) {
|
|
|
67
84
|
|
|
68
85
|
// Set base configuration values, allowing override with environment variables
|
|
69
86
|
Object.keys(config).forEach((prop) => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
87
|
+
// Handle undefined values
|
|
88
|
+
const value = config[prop] || '';
|
|
89
|
+
configText += `config.${prop} = process.env.${constantCase(
|
|
90
|
+
prop
|
|
91
|
+
)} || "${value.toString().trim()}";\n`;
|
|
73
92
|
});
|
|
74
93
|
|
|
75
94
|
configText += `module.exports.environment = config;`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as fetch from 'isomorphic-fetch';
|
|
2
1
|
import * as fs from 'fs';
|
|
3
|
-
import
|
|
2
|
+
import clientFactory from 'lib/graphql-client-factory';
|
|
3
|
+
import { getGraphQLClientFactoryConfig } from 'lib/graphql-client-factory/config';
|
|
4
4
|
|
|
5
5
|
// Apollo Client supports caching GraphQL responses, which can greatly reduce network traffic needs.
|
|
6
6
|
// In order to work correctly with interfaces in GraphQL, it needs to know some basic information about
|
|
@@ -9,28 +9,23 @@ import { generateConfig } from './generate-config';
|
|
|
9
9
|
//
|
|
10
10
|
// The `jss graphql:update` command should be executed when Sitecore templates related to the site are altered.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
import './generate-config';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
const clientFactoryConfig = getGraphQLClientFactoryConfig();
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
jssConfig = require('../src/environments/environment').environment;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
console.error(
|
|
20
|
-
'Unable to require JSS config. Ensure `jss setup` has been run, and the app has been started at least once after setup.'
|
|
21
|
-
);
|
|
22
|
-
console.error(e);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
16
|
+
console.log(`Updating GraphQL fragment type data from ${clientFactoryConfig.endpoint}...`);
|
|
25
17
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
clientFactory()
|
|
19
|
+
.request<{
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
__schema: {
|
|
22
|
+
kind: string;
|
|
23
|
+
name: string;
|
|
24
|
+
types: { possibleTypes?: { name: string } }[];
|
|
25
|
+
};
|
|
26
|
+
}>(
|
|
27
|
+
`
|
|
28
|
+
{
|
|
34
29
|
__schema {
|
|
35
30
|
types {
|
|
36
31
|
kind
|
|
@@ -41,22 +36,18 @@ fetch(jssConfig.graphQLEndpoint, {
|
|
|
41
36
|
}
|
|
42
37
|
}
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
})
|
|
47
|
-
.then((result) => result.json())
|
|
39
|
+
`
|
|
40
|
+
)
|
|
48
41
|
.then((result) => {
|
|
49
42
|
// here we're filtering out any type information unrelated to unions or interfaces
|
|
50
|
-
const filteredData = result.
|
|
51
|
-
(type: { possibleTypes: Array<string> }) => type.possibleTypes !== null
|
|
52
|
-
);
|
|
43
|
+
const filteredData = result.__schema.types.filter((type) => type.possibleTypes !== null);
|
|
53
44
|
|
|
54
45
|
const filteredResult = { ...result };
|
|
55
|
-
filteredResult.
|
|
46
|
+
filteredResult.__schema.types = filteredData;
|
|
56
47
|
|
|
57
48
|
fs.writeFile(
|
|
58
49
|
'./src/graphql-fragment-types.ts',
|
|
59
|
-
`export default ${JSON.stringify(filteredResult
|
|
50
|
+
`export default ${JSON.stringify(filteredResult, null, 2)}`,
|
|
60
51
|
(err) => {
|
|
61
52
|
if (err) {
|
|
62
53
|
console.error('Error writing GraphQLFragmentTypes file', err);
|
|
@@ -6,7 +6,8 @@ import 'zone.js';
|
|
|
6
6
|
import { JssRouteBuilderService } from './src/app/routing/jss-route-builder.service';
|
|
7
7
|
import { environment } from './src/environments/environment';
|
|
8
8
|
import { AppServerModule, renderModule } from './src/main.server';
|
|
9
|
-
import
|
|
9
|
+
import clientFactory from './src/app/lib/graphql-client-factory';
|
|
10
|
+
import { getGraphQLClientFactoryConfig } from './src/app/lib/graphql-client-factory/config';
|
|
10
11
|
import { dictionaryServiceFactory } from './src/app/lib/dictionary-service-factory';
|
|
11
12
|
import { layoutServiceFactory } from './src/app/lib/layout-service-factory';
|
|
12
13
|
|
|
@@ -103,8 +104,7 @@ function parseRouteUrl(url: string) {
|
|
|
103
104
|
const apiKey = environment.sitecoreApiKey;
|
|
104
105
|
const siteName = environment.sitecoreSiteName;
|
|
105
106
|
const defaultLanguage = environment.defaultLanguage;
|
|
106
|
-
const
|
|
107
|
-
const graphQLEndpoint = environment.graphQLEndpoint;
|
|
107
|
+
const getClientFactoryConfig = getGraphQLClientFactoryConfig;
|
|
108
108
|
|
|
109
109
|
export {
|
|
110
110
|
renderView,
|
|
@@ -113,9 +113,8 @@ export {
|
|
|
113
113
|
apiKey,
|
|
114
114
|
siteName,
|
|
115
115
|
clientFactory,
|
|
116
|
+
getClientFactoryConfig,
|
|
116
117
|
dictionaryServiceFactory,
|
|
117
118
|
layoutServiceFactory,
|
|
118
119
|
defaultLanguage,
|
|
119
|
-
graphQLEndpointPath,
|
|
120
|
-
graphQLEndpoint,
|
|
121
120
|
};
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RouteData,
|
|
3
|
-
LayoutServiceContextData,
|
|
4
|
-
} from '@sitecore-jss/sitecore-jss-angular';
|
|
1
|
+
import { RouteData, LayoutServiceContextData } 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 {
|
|
8
5
|
language: string;
|
|
9
6
|
serverRoute: string;
|
|
10
7
|
routeFetchError?: LayoutServiceError;
|
|
11
8
|
sitecore?: LayoutServiceContextData & {
|
|
12
|
-
route: RouteData
|
|
9
|
+
route: RouteData | null;
|
|
13
10
|
};
|
|
14
11
|
viewBag: { [key: string]: unknown };
|
|
15
12
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
<% } -%>
|
|
8
8
|
} from '@sitecore-jss/sitecore-jss-angular';
|
|
9
9
|
import { environment as env } from '../../environments/environment';
|
|
10
|
-
import
|
|
10
|
+
import clientFactory from './graphql-client-factory';
|
|
11
11
|
|
|
12
12
|
export class DictionaryServiceFactory {
|
|
13
13
|
create(): DictionaryService {
|
|
@@ -24,6 +24,9 @@ export class DictionaryServiceFactory {
|
|
|
24
24
|
new GraphQLDictionaryService({
|
|
25
25
|
clientFactory,
|
|
26
26
|
siteName: env.sitecoreSiteName,
|
|
27
|
+
<% if (locals.xmcloud) { -%>
|
|
28
|
+
useSiteQuery: true,
|
|
29
|
+
<% } -%>
|
|
27
30
|
/*
|
|
28
31
|
The Dictionary Service needs a root item ID in order to fetch dictionary phrases for the current
|
|
29
32
|
app. If your Sitecore instance only has 1 JSS App, you can specify the root item ID here;
|
|
@@ -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();
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
<% } -%>
|
|
8
8
|
} from '@sitecore-jss/sitecore-jss-angular';
|
|
9
9
|
import { environment } from '../../environments/environment';
|
|
10
|
-
import
|
|
10
|
+
import clientFactory from './graphql-client-factory';
|
|
11
11
|
|
|
12
12
|
export class LayoutServiceFactory {
|
|
13
13
|
create(): LayoutService {
|
|
@@ -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
|
}
|
|
@@ -8,7 +8,7 @@ const chalk = require('chalk');
|
|
|
8
8
|
*/
|
|
9
9
|
class DisconnectedPlugin implements ConfigPlugin {
|
|
10
10
|
// should come before other plugins
|
|
11
|
-
order =
|
|
11
|
+
order = 2;
|
|
12
12
|
|
|
13
13
|
async exec(config: JssConfig) {
|
|
14
14
|
const disconnected = process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED;
|
|
@@ -20,7 +20,9 @@ class DisconnectedPlugin implements ConfigPlugin {
|
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
return config
|
|
23
|
+
return Object.assign({}, config, {
|
|
24
|
+
sitecoreApiKey: config.sitecoreApiKey || 'no-api-key-set',
|
|
25
|
+
});
|
|
24
26
|
}
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
# ========== Sitecore Edge Platform ===========
|
|
3
|
+
|
|
4
|
+
# Your unified Sitecore Edge Context Id.
|
|
5
|
+
# This will be used over any Sitecore Preview / Delivery Edge variables (above).
|
|
6
|
+
SITECORE_EDGE_CONTEXT_ID=
|
|
7
|
+
|
|
2
8
|
# ========== XM Cloud Proxy ===========
|
|
3
9
|
|
|
4
10
|
# Your XM Cloud Proxy hostname is needed to build the app and execute the client-side requests against the proxy server.
|
|
5
11
|
PROXY_HOST=http://localhost:3001
|
|
6
12
|
|
|
7
13
|
# Your XM Cloud Proxy server path is needed to build the app. The build output will be copied to the proxy server path.
|
|
8
|
-
PROXY_BUILD_PATH=<%-
|
|
14
|
+
PROXY_BUILD_PATH=<%- locals.relativeProxyAppDestination.replace(/\\/g, '\\\\') %>dist
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"projects": {
|
|
3
|
+
"<%- appName %>": {
|
|
4
|
+
"architect": {
|
|
5
|
+
"build": {
|
|
6
|
+
"options": {
|
|
7
|
+
"styles": [
|
|
8
|
+
"node_modules/bootstrap/dist/css/bootstrap.min.css",
|
|
9
|
+
"src/styles.css",
|
|
10
|
+
"src/assets/styles/main.scss"
|
|
11
|
+
],
|
|
12
|
+
"stylePreprocessorOptions": {
|
|
13
|
+
"includePaths": ["src/assets/styles", "node_modules"]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"test": {
|
|
18
|
+
"options": {
|
|
19
|
+
"styles": ["src/styles.css", "src/assets/styles/main.scss"],
|
|
20
|
+
"stylePreprocessorOptions": {
|
|
21
|
+
"includePaths": ["src/assets/styles", "node_modules"]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"schematics": {
|
|
29
|
+
"@schematics/angular:component": {
|
|
30
|
+
"prefix": "app",
|
|
31
|
+
"style": "scss"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"config": {
|
|
3
|
-
"sitecoreDistPath": "/dist"
|
|
4
|
-
},
|
|
5
|
-
"scripts": {
|
|
6
|
-
"postbuild:server": "npm-run-all --serial prepare:build prepare:proxy-build",
|
|
7
|
-
"prepare:build": "move-cli ./dist/main.js ./dist/server.bundle.js",
|
|
8
|
-
"prepare:proxy-build": "ts-node --project src/tsconfig.webpack-server.json ./scripts/proxy-build.ts"
|
|
9
|
-
}
|
|
10
|
-
|
|
1
|
+
{
|
|
2
|
+
"config": {
|
|
3
|
+
"sitecoreDistPath": "/dist"
|
|
4
|
+
},
|
|
5
|
+
"scripts": {
|
|
6
|
+
"postbuild:server": "npm-run-all --serial prepare:build prepare:proxy-build",
|
|
7
|
+
"prepare:build": "move-cli ./dist/main.js ./dist/server.bundle.js",
|
|
8
|
+
"prepare:proxy-build": "ts-node --project src/tsconfig.webpack-server.json ./scripts/proxy-build.ts"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"font-awesome": "^4.7.0",
|
|
12
|
+
"sass": "^1.52.3",
|
|
13
|
+
"sass-alias": "^1.0.5"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JssConfig } from 'lib/config';
|
|
2
2
|
import { ConfigPlugin } from '..';
|
|
3
3
|
import { constantCase } from 'constant-case';
|
|
4
|
+
import chalk from 'chalk';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* This plugin will set XM Cloud related config props.
|
|
@@ -13,9 +14,24 @@ class XMCloudPlugin implements ConfigPlugin {
|
|
|
13
14
|
const proxyBuildPath = process.env[`${constantCase('proxyBuildPath')}`]?.replace(/\/$/, '');
|
|
14
15
|
const proxyHost = process.env[`${constantCase('proxyHost')}`];
|
|
15
16
|
|
|
17
|
+
const sitecoreEdgeUrl =
|
|
18
|
+
process.env[`${constantCase('sitecoreEdgeUrl')}`]?.replace(/\/$/, '') ||
|
|
19
|
+
'https://edge-platform.sitecorecloud.io';
|
|
20
|
+
const sitecoreEdgeContextId = process.env[`${constantCase('sitecoreEdgeContextId')}`];
|
|
21
|
+
|
|
22
|
+
if (config.sitecoreApiKey && sitecoreEdgeContextId) {
|
|
23
|
+
console.log(
|
|
24
|
+
chalk.yellow(
|
|
25
|
+
"You have configured both 'sitecoreApiKey' and 'sitecoreEdgeContextId' values. The 'sitecoreEdgeContextId' is used instead."
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
return Object.assign({}, config, {
|
|
17
31
|
proxyBuildPath,
|
|
18
32
|
proxyHost,
|
|
33
|
+
sitecoreEdgeUrl,
|
|
34
|
+
sitecoreEdgeContextId,
|
|
19
35
|
});
|
|
20
36
|
}
|
|
21
37
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="container-wrapper" *ngIf="wrapped; else default">
|
|
2
|
+
<ng-container *ngTemplateOutlet="default"></ng-container>
|
|
3
|
+
</div>
|
|
4
|
+
<ng-template #default>
|
|
5
|
+
<div class="component container-default {{ styles }}" [attr.id]="id">
|
|
6
|
+
<div class="component-content" [ngStyle]="backgroundStyle">
|
|
7
|
+
<div class="row">
|
|
8
|
+
<sc-placeholder
|
|
9
|
+
[name]="placeholderName"
|
|
10
|
+
[rendering]="rendering">
|
|
11
|
+
</sc-placeholder>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
</ng-template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { SxaComponent } from '../sxa.component';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'app-container',
|
|
6
|
+
templateUrl: './container.component.html',
|
|
7
|
+
})
|
|
8
|
+
export class ContainerComponent extends SxaComponent implements OnInit {
|
|
9
|
+
placeholderName: string;
|
|
10
|
+
wrapped: boolean;
|
|
11
|
+
|
|
12
|
+
override ngOnInit() {
|
|
13
|
+
super.ngOnInit();
|
|
14
|
+
|
|
15
|
+
this.placeholderName = `container-${this.rendering.params?.DynamicPlaceholderId}`;
|
|
16
|
+
this.wrapped = this.rendering.params?.Styles?.split(' ').includes('container');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get backgroundStyle() {
|
|
20
|
+
const backgroundImage = this.rendering.params?.BackgroundImage;
|
|
21
|
+
const mediaUrlPattern = new RegExp(/mediaurl=\"([^"]*)\"/, 'i');
|
|
22
|
+
if (!backgroundImage || !backgroundImage.match(mediaUrlPattern)) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
const mediaUrl = backgroundImage.match(mediaUrlPattern)[1];
|
|
26
|
+
return {
|
|
27
|
+
backgroundImage: `url('${mediaUrl}')`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="component rich-text {{ styles }}"
|
|
3
|
+
[attr.id]="id"
|
|
4
|
+
>
|
|
5
|
+
<div class="component-content">
|
|
6
|
+
<ng-container *ngIf="text; else emptyHint">
|
|
7
|
+
<div *scRichText="text"></div>
|
|
8
|
+
</ng-container>
|
|
9
|
+
<ng-template #emptyHint>
|
|
10
|
+
<span class="is-empty-hint">Rich text</span>
|
|
11
|
+
</ng-template>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|