-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Next.js] Introduce
nextjs-xmcloud
Initializer Template (#1653)
* rename nextjs-personalize -> nextjs-xmcloud. move feaas and BYOC here. * Move Sitecore Edge Platform / conext related items to nextjs-xmcloud * Repurpose nextjs-personalize -> nextjs-xmcloud initializer "system" template (driven by prompt / --xmcloud CLI option) * Moved skipping of site information fetch on XM Cloud to base package (GraphQLSiteInfoService) * CHANGELOG update * fix scaffold samples * removed <BYOC/> from sxa Layout.tsx * fix for PR comment (cherry picked from commit 19f5c22)
- Loading branch information
Showing
38 changed files
with
253 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
packages/create-sitecore-jss/src/templates/nextjs-personalize/package.json
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 29 additions & 20 deletions
49
...jss/src/templates/nextjs-personalize/.env → ...ore-jss/src/templates/nextjs-xmcloud/.env
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
# Your Sitecore CDP API target (specific to your data center region) | ||
NEXT_PUBLIC_CDP_TARGET_URL= | ||
|
||
# Your Sitecore CDP client key | ||
NEXT_PUBLIC_CDP_CLIENT_KEY= | ||
|
||
# An optional Sitecore Personalize scope identifier. | ||
# This can be used to isolate personalization data when multiple XM Cloud Environments share a Personalize tenant. | ||
# This should match the PAGES_PERSONALIZE_SCOPE environment variable for your connected XM Cloud Environment. | ||
NEXT_PUBLIC_PERSONALIZE_SCOPE= | ||
|
||
# Your Sitecore CDP point(s) of sale | ||
# Can be provided as a single value (mypoint.com) or a multi-value JSON with locales ({"en":"en.mypoint.com","fr":"fr.mypoint.com"} etc) | ||
NEXT_PUBLIC_CDP_POINTOFSALE= | ||
|
||
# Timeout (ms) for Sitecore CDP requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT= | ||
|
||
# Timeout (ms) for Sitecore Experience Edge requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT= | ||
|
||
# ========== Sitecore Edge Platform =========== | ||
|
||
# Your unified Sitecore Edge Context Id. | ||
# This will be used over any Sitecore Preview / Delivery Edge variables (above). | ||
SITECORE_EDGE_CONTEXT_ID= | ||
|
||
# ============================================== | ||
|
||
# Your Sitecore CDP API target (specific to your data center region) | ||
NEXT_PUBLIC_CDP_TARGET_URL= | ||
|
||
# Your Sitecore CDP client key | ||
NEXT_PUBLIC_CDP_CLIENT_KEY= | ||
|
||
# An optional Sitecore Personalize scope identifier. | ||
# This can be used to isolate personalization data when multiple XM Cloud Environments share a Personalize tenant. | ||
# This should match the PAGES_PERSONALIZE_SCOPE environment variable for your connected XM Cloud Environment. | ||
NEXT_PUBLIC_PERSONALIZE_SCOPE= | ||
|
||
# Your Sitecore CDP point(s) of sale | ||
# Can be provided as a single value (mypoint.com) or a multi-value JSON with locales ({"en":"en.mypoint.com","fr":"fr.mypoint.com"} etc) | ||
NEXT_PUBLIC_CDP_POINTOFSALE= | ||
|
||
# Timeout (ms) for Sitecore CDP requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_CDP_TIMEOUT= | ||
|
||
# Timeout (ms) for Sitecore Experience Edge requests to respond within. Default is 400. | ||
PERSONALIZE_MIDDLEWARE_EDGE_TIMEOUT= |
7 changes: 7 additions & 0 deletions
7
packages/create-sitecore-jss/src/templates/nextjs-xmcloud/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"dependencies": { | ||
"@sitecore/components": "~1.0.19", | ||
"@sitecore/engage": "^1.4.1", | ||
"@sitecore-feaas/clientside": "^0.4.12" | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../create-sitecore-jss/src/templates/nextjs-xmcloud/scripts/config/plugins/edge-platform.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'dotenv/config'; | ||
import chalk from 'chalk'; | ||
import { constantCase } from 'constant-case'; | ||
import { JssConfig } from 'lib/config'; | ||
import { ConfigPlugin } from '..'; | ||
|
||
/** | ||
* This plugin will set config props used by the Sitecore Edge Platform. | ||
*/ | ||
class EdgePlatformPlugin implements ConfigPlugin { | ||
order = 2; | ||
|
||
async exec(config: JssConfig) { | ||
const sitecoreEdgeUrl = process.env[`${constantCase('sitecoreEdgeUrl')}`] || 'https://edge-platform.sitecorecloud.io'; | ||
const sitecoreEdgeContextId = process.env[`${constantCase('sitecoreEdgeContextId')}`]; | ||
|
||
if (config.sitecoreApiKey && sitecoreEdgeContextId) { | ||
console.log( | ||
chalk.yellow( | ||
"You have configured both 'sitecoreApiKey' and 'sitecoreEdgeContextId' values. The 'sitecoreEdgeContextId' is used instead." | ||
) | ||
); | ||
} | ||
|
||
return Object.assign({}, config, { | ||
sitecoreEdgeUrl, | ||
sitecoreEdgeContextId, | ||
}); | ||
} | ||
} | ||
|
||
export const edgePlatformPlugin = new EdgePlatformPlugin(); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...plates/nextjs-personalize/src/Scripts.tsx → .../templates/nextjs-xmcloud/src/Scripts.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.