forked from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add storefront context directly to ACDL
- Loading branch information
Showing
2 changed files
with
29 additions
and
64 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,36 @@ | ||
// eslint-disable-next-line import/no-cycle | ||
import { sampleRUM } from './aem.js'; | ||
import initCommerceEvents from './commerce-events.js'; | ||
import { getConfigValue } from './configs.js'; | ||
|
||
// Core Web Vitals RUM collection | ||
sampleRUM('cwv'); | ||
|
||
// add more delayed functionality here | ||
initCommerceEvents(); | ||
|
||
// Load Commerce events SDK and collector | ||
const config = { | ||
environmentId: await getConfigValue('commerce-environment-id'), | ||
environment: await getConfigValue('commerce-environment'), | ||
storeUrl: await getConfigValue('commerce-store-url'), | ||
websiteId: await getConfigValue('commerce-website-id'), | ||
websiteCode: await getConfigValue('commerce-website-code'), | ||
storeId: await getConfigValue('commerce-store-id'), | ||
storeCode: await getConfigValue('commerce-store-code'), | ||
storeViewId: await getConfigValue('commerce-store-view-id'), | ||
storeViewCode: await getConfigValue('commerce-store-view-code'), | ||
websiteName: await getConfigValue('commerce-website-name'), | ||
storeName: await getConfigValue('commerce-store-name'), | ||
storeViewName: await getConfigValue('commerce-store-view-name'), | ||
baseCurrencyCode: await getConfigValue('commerce-base-currency-code'), | ||
storeViewCurrencyCode: await getConfigValue('commerce-base-currency-code'), | ||
storefrontTemplate: 'Franklin', | ||
}; | ||
|
||
window.adobeDataLayer.push( | ||
{ storefrontInstanceContext: config }, | ||
{ eventForwardingContext: { commerce: true, aep: false } }, | ||
); | ||
|
||
// Load events SDK and collector | ||
import('./commerce-events-sdk.js'); | ||
import('./commerce-events-collector.js'); |