Skip to content

Commit da1ead1

Browse files
[angular-xmcloud][xmcloud-proxy] Move PERSONALIZE_SCOPE to angular SPA (#1973)
* [angular-xmcloud][xmcloud-proxy] Move PERSONALIZE_SCOPE to angular SPA * changelog
1 parent 0c8193a commit da1ead1

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Our versioning strategy is as follows:
4040
* `proxyAppDestination` arg can be passed into `create-sitecore-jss` command to define path for proxy to be installed in
4141
* `[templates/angular]` `[templates/angular-xmcloud]` `[template/node-xmcloud-proxy]` `[sitecore-jss-proxy]` Introduced /api/editing/config endpoint ([#1903](https://github.com/Sitecore/jss/pull/1903))
4242
* `[templates/angular]` `[templates/angular-xmcloud]` `[template/node-xmcloud-proxy]` `[sitecore-jss-proxy]` Introduced /api/editing/render endpoint ([#1908](https://github.com/Sitecore/jss/pull/1908))
43-
* `[templates/angular-xmcloud]` `[template/node-xmcloud-proxy]` Personalization support ([#1964](https://github.com/Sitecore/jss/pull/1964)[#1971](https://github.com/Sitecore/jss/pull/1971))
43+
* `[templates/angular-xmcloud]` `[template/node-xmcloud-proxy]` Personalization support ([#1964](https://github.com/Sitecore/jss/pull/1964)[#1971](https://github.com/Sitecore/jss/pull/1971)[#1973](https://github.com/Sitecore/jss/pull/1973))
4444
* `[create-sitecore-jss]``[sitecore-jss-angular]``[template/angular-xmcloud]` Angular SXA components
4545
* Angular placeholder now supports SXA components ([#1870](https://github.com/Sitecore/jss/pull/1870))
4646
* Component styles ([#1917](https://github.com/Sitecore/jss/pull/1917))

packages/create-sitecore-jss/src/templates/angular-xmcloud/.env

+7
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,10 @@ PROXY_HOST=http://localhost:3000
1212

1313
# Your XM Cloud Proxy server path is needed to build the app. The build output will be copied to the proxy server path.
1414
PROXY_BUILD_PATH=<%- locals.relativeProxyAppDestination.replace(/\\/g, '\\\\') %>dist
15+
16+
# ==============================================
17+
18+
# An optional Sitecore Personalize scope identifier.
19+
# This can be used to isolate personalization data when multiple XM Cloud Environments share a Personalize tenant.
20+
# This should match the PAGES_PERSONALIZE_SCOPE environment variable for your connected XM Cloud Environment.
21+
PERSONALIZE_SCOPE=

packages/create-sitecore-jss/src/templates/angular-xmcloud/scripts/config/plugins/xmcloud.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class XMCloudPlugin implements ConfigPlugin {
1818
process.env[`${constantCase('sitecoreEdgeUrl')}`]?.replace(/\/$/, '') ||
1919
'https://edge-platform.sitecorecloud.io';
2020
const sitecoreEdgeContextId = process.env[`${constantCase('sitecoreEdgeContextId')}`];
21+
const personalizeScope = process.env[`${constantCase('personalizeScope')}`]
2122

2223
if (config.sitecoreApiKey && sitecoreEdgeContextId) {
2324
console.log(
@@ -32,6 +33,7 @@ class XMCloudPlugin implements ConfigPlugin {
3233
proxyHost,
3334
sitecoreEdgeUrl,
3435
sitecoreEdgeContextId,
36+
personalizeScope,
3537
});
3638
}
3739
}

packages/create-sitecore-jss/src/templates/angular-xmcloud/server.exports.ts

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import metadata from './src/environments/metadata.json';
1111

1212
const defaultLanguage = environment.defaultLanguage;
1313
const sitecoreSiteName = environment.sitecoreSiteName;
14+
const personalizeScope = environment.personalizeScope;
1415
const getClientFactoryConfig = getGraphQLClientFactoryConfig;
1516

1617
export {
@@ -20,6 +21,7 @@ export {
2021
layoutServiceFactory,
2122
defaultLanguage,
2223
sitecoreSiteName,
24+
personalizeScope,
2325
components,
2426
metadata,
2527
};

packages/create-sitecore-jss/src/templates/node-xmcloud-proxy/.env

-5
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ PROXY_BUNDLE_PATH=
1313
# Set the DEBUG environment variable to 'sitecore-jss:*,sitecore-jss:proxy,http-proxy-middleware*' to see all logs:
1414
#DEBUG=sitecore-jss:*,http-proxy-middleware*
1515

16-
# An optional Sitecore Personalize scope identifier.
17-
# This can be used to isolate personalization data when multiple XM Cloud Environments share a Personalize tenant.
18-
# This should match the PAGES_PERSONALIZE_SCOPE environment variable for your connected XM Cloud Environment.
19-
PERSONALIZE_SCOPE=
20-
2116
# Timeout (ms) for Sitecore CDP requests to respond within. Default is 400.
2217
PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT=
2318

packages/create-sitecore-jss/src/templates/node-xmcloud-proxy/src/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const personalizeConfig: PersonalizeConfig = {
7777
400,
7878
},
7979
// Optional Sitecore Personalize scope identifier.
80-
scope: process.env.PERSONALIZE_SCOPE,
80+
scope: serverBundle.personalizeScope,
8181
// This function determines if the personalization should be turned off.
8282
// IMPORTANT: You should implement based on your cookie consent management solution of choice.
8383
// You may wish to keep it disabled while in development mode.

packages/create-sitecore-jss/src/templates/node-xmcloud-proxy/src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface ServerBundle {
1717
getClientFactoryConfig: () => GraphQLRequestClientFactoryConfig;
1818
defaultLanguage: string;
1919
sitecoreSiteName: string;
20+
personalizeScope?: string;
2021
layoutServiceFactory: { create: () => LayoutService };
2122
dictionaryServiceFactory: { create: () => DictionaryService };
2223
components: string[] | Map<string, unknown>;

0 commit comments

Comments
 (0)