Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-164093: Adobe Home "Try Buy Widget" merch card #3651

Open
wants to merge 29 commits into
base: stage
Choose a base branch
from

Conversation

Axelcureno
Copy link
Member

@Axelcureno Axelcureno commented Feb 7, 2025

Copy link
Contributor

aem-code-sync bot commented Feb 7, 2025

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

eslint

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/deps/mas/merch-subscription-panel.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/deps/mas/merch-twp-d2p.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/deps/mas/merch-whats-included.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/dist/mas.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/docs/mas-sidenav.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/checkout-mixin.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/global.css.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/hydrate.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/match-media-controller.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/merch-card-collection.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/merch-card.css.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/merch-stock.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/merch-subscription-panel.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/merch-twp-d2p.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/plans-modal.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/sidenav/merch-sidenav.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/variants/ah-try-buy-widget.css.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/variants/ah-try-buy-widget.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/src/variants/variants.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/test/aem-fragment.test.html.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/test/checkout-button.test.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/test/checkout-link.test.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/5962134316ca6ef39112f61727b506565cd6d1df/libs/features/mas/test/hydrate.test.js

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

aem-code-sync bot commented Feb 7, 2025

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

'light',
el.classList.contains('light'),
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium documentation

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix AI 18 days ago

To fix the problem, we need to ensure that any text content inserted into the DOM is properly escaped to prevent XSS attacks. This can be achieved by using a text node instead of setting innerHTML directly. By creating a text node, we ensure that any special characters in the text content are automatically escaped.

The best way to fix this issue is to create a text node for the content of el.textContent and append it to the target container. This way, the text content is safely inserted into the DOM without being interpreted as HTML.

Suggested changeset 1
libs/features/mas/docs/checkout-button.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/libs/features/mas/docs/checkout-button.html b/libs/features/mas/docs/checkout-button.html
--- a/libs/features/mas/docs/checkout-button.html
+++ b/libs/features/mas/docs/checkout-button.html
@@ -586,3 +586,7 @@
                 );
-                targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
+                const demoContainer = document.createElement('div');
+                demoContainer.className = 'demo-container';
+                demoContainer.textContent = el.textContent;
+                targetContainer.innerHTML = '<h4>Demo: </h4>';
+                targetContainer.appendChild(demoContainer);
                 el.parentElement.after(targetContainer);
EOF
@@ -586,3 +586,7 @@
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
const demoContainer = document.createElement('div');
demoContainer.className = 'demo-container';
demoContainer.textContent = el.textContent;
targetContainer.innerHTML = '<h4>Demo: </h4>';
targetContainer.appendChild(demoContainer);
el.parentElement.after(targetContainer);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
'light',
el.classList.contains('light'),
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium documentation

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix AI 18 days ago

To fix the problem, we need to ensure that any text content assigned to innerHTML is properly escaped to prevent the interpretation of HTML meta-characters. This can be achieved by using a function that escapes HTML special characters before assigning the text to innerHTML.

The best way to fix this without changing existing functionality is to create a utility function that escapes HTML special characters and use this function to sanitize el.textContent before assigning it to innerHTML.

Suggested changeset 1
libs/features/mas/docs/checkout-link.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/libs/features/mas/docs/checkout-link.html b/libs/features/mas/docs/checkout-link.html
--- a/libs/features/mas/docs/checkout-link.html
+++ b/libs/features/mas/docs/checkout-link.html
@@ -582,2 +582,15 @@
         <script type="module">
+            function escapeHTML(str) {
+                return str.replace(/[&<>"']/g, function (match) {
+                    const escapeMap = {
+                        '&': '&amp;',
+                        '<': '&lt;',
+                        '>': '&gt;',
+                        '"': '&quot;',
+                        "'": '&#39;',
+                    };
+                    return escapeMap[match];
+                });
+            }
+
             document.querySelectorAll('code.demo').forEach((el) => {
@@ -588,3 +601,3 @@
                 );
-                targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
+                targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${escapeHTML(el.textContent)}</div>`;
                 el.parentElement.after(targetContainer);
EOF
@@ -582,2 +582,15 @@
<script type="module">
function escapeHTML(str) {
return str.replace(/[&<>"']/g, function (match) {
const escapeMap = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;',
};
return escapeMap[match];
});
}

document.querySelectorAll('code.demo').forEach((el) => {
@@ -588,3 +601,3 @@
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${escapeHTML(el.textContent)}</div>`;
el.parentElement.after(targetContainer);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
'light',
el.classList.contains('light'),
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium documentation

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix AI 18 days ago

To fix the problem, we need to ensure that the text content is properly escaped before being inserted into the HTML. This can be achieved by creating a text node and appending it to the target container, which ensures that any special characters in the text content are properly escaped.

  • Replace the direct insertion of el.textContent into the HTML with a safer method that escapes the text content.
  • Specifically, create a text node for the demo content and append it to the target container.
  • Modify the relevant lines in the file libs/features/mas/docs/inline-price.html.
Suggested changeset 1
libs/features/mas/docs/inline-price.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/libs/features/mas/docs/inline-price.html b/libs/features/mas/docs/inline-price.html
--- a/libs/features/mas/docs/inline-price.html
+++ b/libs/features/mas/docs/inline-price.html
@@ -522,3 +522,7 @@
                 );
-                targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
+                const demoContainer = document.createElement('div');
+                demoContainer.className = 'demo-container';
+                demoContainer.textContent = el.textContent;
+                targetContainer.innerHTML = '<h4>Demo: </h4>';
+                targetContainer.appendChild(demoContainer);
                 el.parentElement.after(targetContainer);
EOF
@@ -522,3 +522,7 @@
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
const demoContainer = document.createElement('div');
demoContainer.className = 'demo-container';
demoContainer.textContent = el.textContent;
targetContainer.innerHTML = '<h4>Demo: </h4>';
targetContainer.appendChild(demoContainer);
el.parentElement.after(targetContainer);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
'light',
el.classList.contains('light'),
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium documentation

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix AI 18 days ago

To fix the problem, we need to ensure that the text content is properly escaped before being inserted into the HTML. This can be achieved by creating a text node and appending it to the container, which ensures that any special characters in the text content are treated as text rather than HTML.

  • Replace the direct assignment of el.textContent to innerHTML with a method that safely appends the text content.
  • Specifically, create a text node with the content of el.textContent and append it to the container.
Suggested changeset 1
libs/features/mas/docs/mas.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/libs/features/mas/docs/mas.html b/libs/features/mas/docs/mas.html
--- a/libs/features/mas/docs/mas.html
+++ b/libs/features/mas/docs/mas.html
@@ -269,3 +269,7 @@
                 );
-                targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
+                const demoContainer = document.createElement('div');
+                demoContainer.className = 'demo-container';
+                demoContainer.textContent = el.textContent;
+                targetContainer.innerHTML = '<h4>Demo: </h4>';
+                targetContainer.appendChild(demoContainer);
                 el.parentElement.after(targetContainer);
EOF
@@ -269,3 +269,7 @@
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
const demoContainer = document.createElement('div');
demoContainer.className = 'demo-container';
demoContainer.textContent = el.textContent;
targetContainer.innerHTML = '<h4>Demo: </h4>';
targetContainer.appendChild(demoContainer);
el.parentElement.after(targetContainer);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
'light',
el.classList.contains('light'),
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;

Check warning

Code scanning / CodeQL

DOM text reinterpreted as HTML Medium documentation

DOM text
is reinterpreted as HTML without escaping meta-characters.

Copilot Autofix AI 18 days ago

To fix the problem, we need to ensure that any text content extracted from the DOM and inserted back as HTML is properly escaped to prevent it from being interpreted as HTML. This can be achieved by using a function to escape HTML special characters before assigning the text content to innerHTML.

The best way to fix this without changing existing functionality is to create a utility function that escapes HTML special characters and use this function to sanitize el.textContent before inserting it into the innerHTML.

Suggested changeset 1
libs/features/mas/docs/mas.js.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/libs/features/mas/docs/mas.js.html b/libs/features/mas/docs/mas.js.html
--- a/libs/features/mas/docs/mas.js.html
+++ b/libs/features/mas/docs/mas.js.html
@@ -785,2 +785,10 @@
         <script type="module">
+            function escapeHtml(unsafe) {
+                return unsafe
+                    .replace(/&/g, "&amp;")
+                    .replace(/</g, "&lt;")
+                    .replace(/>/g, "&gt;")
+                    .replace(/"/g, "&quot;")
+                    .replace(/'/g, "&#039;");
+            }
             document.querySelectorAll('code.demo').forEach((el) => {
@@ -791,3 +799,3 @@
                 );
-                targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
+                targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${escapeHtml(el.textContent)}</div>`;
                 el.parentElement.after(targetContainer);
EOF
@@ -785,2 +785,10 @@
<script type="module">
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
}
document.querySelectorAll('code.demo').forEach((el) => {
@@ -791,3 +799,3 @@
);
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${el.textContent}</div>`;
targetContainer.innerHTML = `<h4>Demo: </h4><div class="demo-container">${escapeHtml(el.textContent)}</div>`;
el.parentElement.after(targetContainer);
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

eslint

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/merch-card.css.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/merch-stock.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/merch-subscription-panel.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/merch-twp-d2p.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/plans-modal.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/sidenav/merch-sidenav.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/variants/ah-try-buy-widget.css.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/variants/ah-try-buy-widget.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/src/variants/variants.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/test/aem-fragment.test.html.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/test/checkout-button.test.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/test/checkout-link.test.js


⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

https://github.com/adobecom/milo/blob/781f75d935e60c184f2ee1180d2e08d34848bc2c/libs/features/mas/test/hydrate.test.js

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] reported by reviewdog 🐶
File ignored because of a matching ignore pattern. Use "--no-ignore" to override.

@Axelcureno Axelcureno changed the title MWPW-164093: Adobe Home 'Pricing Widget' merch card MWPW-164093: Adobe Home "Try Buy Widget" merch card Feb 7, 2025
Copy link
Contributor

github-actions bot commented Feb 8, 2025

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not in the navigation menu(lost in previous PRs) can you add it back?

try {
await customElements.whenDefined('checkout-button');
const CheckoutButtonEl = customElements.get('checkout-button');
const checkoutBtn = CheckoutButtonEl.createCheckoutButton({}, cta.innerHTML);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this block causes runtime errors in ah gallery:

mas.js:2370 Failed to initialize checkout-button logic: TypeError: Cannot read properties of null (reading 'setAttribute')
at mas.js:2370:30403

const checkoutBtn = CheckoutButtonEl.createCheckoutButton({}, cta.innerHTML);

for (const attr of cta.attributes) {
checkoutBtn.setAttribute(attr.name, attr.value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this is needed?

/* c8 ignore next 3 */
(async () => {
try {
await customElements.whenDefined('checkout-button');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is safe to assume that checkout-button is already defined before we hit here, if not wee need to check how mas.js is bundled.
I would avoid adding checks for web components that we know are in the bundle.

Copy link
Member Author

@Axelcureno Axelcureno Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disregard my previous comment, I found the root cause for the race condition. It was that in my test page, mas-commerce-service was actually defined after mas.js so the checkout button was not created properly since there was no service.

e.stopPropagation();
cta.click();
if (typeof checkoutBtn.clickHandler === 'function') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't checkoutBtn.click() not enough?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, fixed

@@ -0,0 +1,34 @@
import { LitElement } from 'lit';

export default class MatchMediaController {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this different than https://opensource.adobe.com/spectrum-web-components/tools/match-media/ ?

can we use the lit one instead?

Copy link
Contributor

@st-angelo-adobe st-angelo-adobe Feb 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked about it a few weeks ago. You said if MatchMediaController from SWC is small we could use it, otherwise we can implement the logic in js. And this is it, a local implementation of the same thing.
However, it's pretty much the same as the one from SWC to be honest. Let me know if you want me to remove this and just use the one from SWC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually since MatchMediaController from SWC is so small we can just use that. I changed it back everywhere too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true true, I thought this portion was from Axel and I didn't remember our discussion.
if putting MatchMediaController doesn't explode our bundle size, let's use it as it.

@@ -1,6 +1,6 @@
import { LitElement, css, html } from 'lit';
import { EVENT_MERCH_STOCK_CHANGE } from './constants.js';
import { MatchMediaController } from '@spectrum-web-components/reactive-controllers/src/MatchMedia.js';
import MatchMediaController from './match-media-controller.js';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to understand the difference

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

flex-direction: row;
}
:host([variant='ah-try-buy-widget']) .footer .spectrum-Button-label {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we don't support Spectrum CSS anymore for AH, we should remove such rules.

`;
}

customElements.define('ah-try-buy-widget', AHTryBuyWidget);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please cleanup Spectrum CSS related rules since we switched to SWC.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed, hopefully all of them

@@ -100,7 +100,6 @@ export function CheckoutMixin(Base) {
}

async render(overrides = {}) {
if (!this.isConnected) return false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it to fix some issue? do you have more details?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3ch023 I asked them. Since sp-button doesn't have checkout-link capabilities, instead we will render a checkout-link but not in the DOM and just forward clicks to it.
But the DOM element must be rendered even if it is not connected to DOM which is fine IMO.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am good if there is no impact on events we throw for CCD

let title = fields.cardTitle;
const { maxCount } = titleConfig;
if (maxCount) {
const [truncatedTitle, cleanTitle] = getTruncatedTextData(fields.cardTitle, maxCount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have a nala card with 'too long' description and a test checking truncation on /libs/features/mas/docs/adobe-home.html

lets do it as a follow up ticket though, @Axelcureno could you create one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Axelcureno Axelcureno requested a review from yesil February 19, 2025 16:26
@aem-code-sync aem-code-sync bot had a problem deploying to mas-v0.2.7-dev February 19, 2025 16:54 Failure
@Roycethan
Copy link

Roycethan commented Feb 20, 2025

@Axelcureno Can you plz fix following , Thanks

  1. When used dark theme , the theme is not apllied to few cards in double and single plan types:
    https://mwpw-164093--milo--adobecom.hlx.live/libs/features/mas/docs/adobe-home.html?theme=dark
image

2)Plz update the first card in triple plan to have background - Grey

  1. On first card - 'See terms'' and Annual billed monthly' should be in separate rows and not wrapped - Better add pricing in between
image
  1. ac: buttons should be responsive to hover state, e.g. S2/Accent colored button changes to S2/Primary when hovered over - I don't see hover and change color working in gallery , Can you plz check this requirement ?

  2. ac: product titles should be truncated with ellipses (...) if they exceed 40 characters or 3 lines
    Looks like its truncating title before 40 characters or 3 lines -
    ex: Creative Cloud All Apps Long Test Exa...

image
  1. max character count in description should be 200 characters - Its taking more than that
image
  1. In description field , if i enter around more than 25 characters in 1 row , its not wrapped into next line automatically and remaining characters are not rendered.
image
  1. why the 'size' feild is blank for this card ?
    https://mwpw-164093--mas--adobecom.hlx.page/studio.html?milolibs=MWPW-164093--milo--adobecom#path=adobe-home&page=content&query=f07084e9-1963-4877-8ab0-f7d2982e62cb
image

@st-angelo-adobe
Copy link
Contributor

@Roycethan
2, 3: Done.
4. I seriously doubt Accent buttons need to change to Primary color when hovered. I'll confirm with the AH team if this is an actual requirement, it may have been a misunderstanding.
5. Actually, the title is truncated at 37 characters, plus 3 for ellipses = 40 in total. If this is not the desired behavior we can change that.
6. From what I'm seeing this is actually fine. The editor is counting more than actual characters, possibly (maybe \n is counted as 2 characters, not sure, this needs to be investigated).
image
8. That was just a remnant, previously Triple was just Normal, then you had the option to pick Single or Double. I changed it to Triple.

For 1 and 7 we'll look into it. cc: @Axelcureno

@Roycethan
Copy link

Roycethan commented Feb 20, 2025

@Axelcureno Can you plz fix following , Thanks

  1. When used dark theme , the theme is not apllied to few cards in double and single plan types:
    https://mwpw-164093--milo--adobecom.hlx.live/libs/features/mas/docs/adobe-home.html?theme=dark
image 2)Plz update the first card in triple plan to have background - Grey
  1. On first card - 'See terms'' and Annual billed monthly' should be in separate rows and not wrapped - Better add pricing in between
image 4. ac: buttons should be responsive to hover state, e.g. S2/Accent colored button changes to S2/Primary when hovered over - I don't see hover and change color working in gallery , Can you plz check this requirement ? 5. ac: product titles should be truncated with ellipses (...) if they exceed 40 characters or 3 lines Looks like its truncating title before 40 characters or 3 lines - ex: Creative Cloud All Apps Long Test Exa... image 6. max character count in description should be 200 characters - Its taking more than that image 7. In description field , if i enter around more than 25 characters in 1 row , its not wrapped into next line automatically and remaining characters are not rendered. image 8. why the 'size' feild is blank for this card ? https://mwpw-164093--mas--adobecom.hlx.page/studio.html?milolibs=MWPW-164093--milo--adobecom#path=adobe-home&page=content&query=f07084e9-1963-4877-8ab0-f7d2982e62cb image
  1. In dark theme , the buy button in figma (say for photoshop) looks more darker than whats implemented - can we plz check this as well ?
    Figma:
image Actual: image

10)Figma mentions widjet should have shadow on Desktop and tablet and not in mobile: do we have a separate ticket to address this ?
image

Actual: Shadow is not rendered in the widject for Desktop/tablet:
image

@Axelcureno cc @st-angelo-adobe
1 - Need fix
2,3 -fixed
4- Requirement was wrong , and need correction per figma- for now looks ok
5- Ok as explained
6 - Not working as expected
7 - Need investigation
8- fixed
9- Plz review
10 - Plz review

@Axelcureno
Copy link
Member Author

@Roycethan we are not delivering "widgets", we are only delivering the cards. The page in milo is just for demonstration purposes, it does not represent the actual widget. The widget containing the cards is built in adobe home code.

@Axelcureno
Copy link
Member Author

@Roycethan item #9 is a mistake in the color of figma, we are not overriding colors in dark theme and even in figma it says "Dark mode follows the same S2 guidelines as Light mode."
I've left a comment here for correction: https://www.figma.com/design/7tUtNgFelfMjgPoJ5QcE1k?node-id=5160-32869&m=dev#1142597000

@Axelcureno
Copy link
Member Author

I've fixed the remaining items, please check @Roycethan

@Roycethan
Copy link

I've fixed the remaining items, please check @Roycethan

Thanks 1 is fixed, for 6 and 7 will create a separate followup ticket, approving this to proceed to stage

@Roycethan Roycethan added verified PR has been E2E tested by a reviewer Ready for Stage labels Feb 21, 2025
@milo-pr-merge
Copy link
Contributor

milo-pr-merge bot commented Feb 21, 2025

Skipped 3651: "MWPW-164093: Adobe Home "Try Buy Widget" merch card" due to file "libs/deps/mas/commerce.js" overlap. Merging will be attempted in the next batch

@narcis-radu
Copy link
Contributor

Thanks 1 is fixed, for 6 and 7 will create a separate followup ticket, approving this to proceed to stage
@Roycethan , @Axelcureno , @st-angelo-adobe - Have you created follow-up tickets for 6 / 7 ?

@narcis-radu
Copy link
Contributor

@Axelcureno , @Roycethan - it is almost impossible for someone outside the Merch team to test the changes. I had to go through comments to find a URL where the elements are rendered. The testing URL should be in the PR description.
Additionally, I am unable to test on small viewports, the content does not flow properly. I would assume mobile support is present.

@Roycethan
Copy link

Thanks 1 is fixed, for 6 and 7 will create a separate followup ticket, approving this to proceed to stage
@Roycethan , @Axelcureno , @st-angelo-adobe - Have you created follow-up tickets for 6 / 7 ?

Yes tracking here https://jira.corp.adobe.com/browse/MWPW-168322

@Axelcureno
Copy link
Member Author

le for someone outside the Merch team to test the changes. I had to go through comments to find a URL where the elements are rendered. T

@Roycethan 6 and 7 are working as expected. I have validated on my end.

@Roycethan
Copy link

https://jira.corp.adobe.com/browse/MWPW-168322

Cool thanks @Axelcureno for fixing them, closing as fixed

@aem-code-sync aem-code-sync bot had a problem deploying to mas-v0.2.8-dev February 22, 2025 03:05 Failure
@aem-code-sync aem-code-sync bot had a problem deploying to mas-v0.2.9-dev February 25, 2025 03:46 Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commerce merch card Ready for Stage verified PR has been E2E tested by a reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants