Skip to content

Commit

Permalink
added handling of Acrobat Reader description (#912)
Browse files Browse the repository at this point in the history
* added handling of Acrobat Reader description

* lint fix

* also run procesCard on existing cards

---------

Co-authored-by: Denys Fedotov <dfedotov@Denyss-MacBook-Pro.local>
Co-authored-by: vgoodric <vgoodric@adobe.com>
  • Loading branch information
3 people authored Dec 5, 2024
1 parent ed1549e commit 8d62f2d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,11 @@ async function addCheckbox({ card, md, fragAudience, cardPlanType }) {
const cardId = `${fragAudience}-${cardPlanType}-${cardTitle}`;
card.dataset.aiAdded = false;
const callout = card.querySelector(CALLOUT_SELECTOR);
const description = md.checkbox.description.replace('[AIP]', '<span class="price-placeholder"></span>');
const isReader = card.querySelector('.con-button[href*="adobe.com/reader/"]');
let description = isReader
? md.checkbox.reader.description
: md.checkbox.description;
description = description.replace('[AIP]', '<span class="price-placeholder"></span>');
const checkboxContainer = createTag(
'div',
{ slot: 'callout-content', class: 'ai-checkbox-container' },
Expand Down Expand Up @@ -221,6 +225,9 @@ function processCard(card, md) {
}
export default async function init(el) {
const md = parseMetadata(getMetadata(el));
document.querySelectorAll('merch-card').forEach((card) => {
processCard(card, md);
});
const mainObserver = new MutationObserver((mutationsList) => {
for (const mutation of mutationsList) {
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
Expand Down

0 comments on commit 8d62f2d

Please sign in to comment.