Skip to content

Commit

Permalink
Merge branch 'main' of github.com:hlxsites/aem-boilerplate-commerce i…
Browse files Browse the repository at this point in the history
…nto develop
  • Loading branch information
sirugh committed Dec 2, 2024
2 parents 25edacf + 1082959 commit 4b749ff
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 16 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
helix-importer-ui
scripts/preact.js
scripts/htm.js
scripts/acdl
tools/picker
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ Additionally, you need to have the following modules and customizations installe
1. magento/module-visual-product-recommendations: Commerce module required for PRex Widget
<!-- 1. TODO: Add further prereqs. -->

## Documentation

Before using the aem-boilerplate, we recommand you to go through the documentation on https://www.aem.live/docs/ and more specifically:
1. [Developer Tutorial](https://www.aem.live/developer/tutorial)
2. [The Anatomy of a Project](https://www.aem.live/developer/anatomy-of-a-project)
3. [Web Performance](https://www.aem.live/developer/keeping-it-100)
4. [Markup, Sections, Blocks, and Auto Blocking](https://www.aem.live/developer/markup-sections-blocks)

## Installation

```sh
Expand Down
7 changes: 4 additions & 3 deletions blocks/product-details/product-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,15 @@ function setMetaTags(product) {
createMetaTag('title', product.metaTitle || product.name, 'name');
createMetaTag('description', product.metaDescription, 'name');
createMetaTag('keywords', product.metaKeyword, 'name');
createMetaTag('og:type', 'og:product', 'property');

createMetaTag('og:type', 'product', 'property');
createMetaTag('og:description', product.shortDescription, 'property');
createMetaTag('og:title', product.metaTitle || product.name, 'property');
createMetaTag('og:url', window.location.href, 'property');
const mainImage = product?.images?.filter((image) => image.roles.includes('thumbnail'))[0];
const metaImage = mainImage?.url || product?.images[0]?.url;
createMetaTag('og:image', metaImage, 'property');
createMetaTag('og:image:secure_url', metaImage, 'property');
createMetaTag('og:product:price:amount', price.value, 'property');
createMetaTag('og:product:price:currency', price.currency, 'property');
createMetaTag('product:price:amount', price.value, 'property');
createMetaTag('product:price:currency', price.currency, 'property');
}
2 changes: 1 addition & 1 deletion blocks/product-list-page-custom/FacetList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-classes-per-file */
import {
h, Component, createRef,
} from '../../scripts/preact.js';
} from '@dropins/tools/preact.js';
import htm from '../../scripts/htm.js';

const html = htm.bind(h);
Expand Down
2 changes: 1 addition & 1 deletion blocks/product-list-page-custom/ProductList.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable object-curly-spacing, class-methods-use-this */
import {
h, Component, Fragment,
} from '../../scripts/preact.js';
} from '@dropins/tools/preact.js';
import htm from '../../scripts/htm.js';
import {
renderPrice,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
h, Component, Fragment, render, createRef,
} from '../../scripts/preact.js';
} from '@dropins/tools/preact.js';
import htm from '../../scripts/htm.js';
import ProductList from './ProductList.js';
import FacetList from './FacetList.js';
Expand Down
4 changes: 3 additions & 1 deletion blocks/product-recommendations/product-recommendations.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ function renderPlaceholder(block) {

function renderItem(unitId, product) {
let image = product.images[0]?.url;
image = image.replace('http://', '//');
if (image) {
image = image.replace('http://', '//');
}

const clickHandler = () => {
window.adobeDataLayer.push((dl) => {
Expand Down
8 changes: 8 additions & 0 deletions draft.robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
User-agent: *
Allow: /
Disallow: /drafts/
Disallow: /enrichment/
Disallow: /tools/
Disallow: /plugins/experimentation/

Sitemap: https://www.aemshop.net/sitemap.xml
10 changes: 7 additions & 3 deletions postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ fs.readdirSync('node_modules/@dropins', { withFileTypes: true }).forEach((file)
});
});

// Copy eventing specific files
fs.copyFileSync(path.resolve(__dirname, './node_modules/@adobe/magento-storefront-event-collector/dist/index.js'), path.resolve(__dirname, './scripts/commerce-events-collector.js'));
fs.copyFileSync(path.resolve(__dirname, './node_modules/@adobe/magento-storefront-events-sdk/dist/index.js'), path.resolve(__dirname, './scripts/commerce-events-sdk.js'));
// Other files to copy
[
{ from: '@adobe/magento-storefront-event-collector/dist/index.js', to: 'commerce-events-collector.js' },
{ from: '@adobe/magento-storefront-events-sdk/dist/index.js', to: 'commerce-events-sdk.js' },
].forEach((file) => {
fs.copyFileSync(path.resolve(__dirname, 'node_modules', file.from), path.resolve(__dirname, 'scripts', file.to));
});

function checkPackageLockForArtifactory() {
return new Promise((resolve, reject) => {
Expand Down
8 changes: 6 additions & 2 deletions scripts/aem.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,14 @@ function sampleRUM(checkpoint, data) {
sampleRUM.enhance = () => {
// only enhance once
if (document.querySelector('script[src*="rum-enhancer"]')) return;

const { enhancerVersion, enhancerHash } = sampleRUM.enhancerContext || {};
const script = document.createElement('script');
if (enhancerHash) {
script.integrity = enhancerHash;
script.setAttribute('crossorigin', 'anonymous');
}
script.src = new URL(
'.rum/@adobe/helix-rum-enhancer@^2/src/index.js',
`.rum/@adobe/helix-rum-enhancer@${enhancerVersion || '^2'}/src/index.js`,
sampleRUM.baseURL,
).href;
document.head.appendChild(script);
Expand Down
2 changes: 1 addition & 1 deletion scripts/htm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion scripts/preact.js

This file was deleted.

Loading

0 comments on commit 4b749ff

Please sign in to comment.