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

[Release] Stage to Main #2910

Merged
merged 13 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .hlxignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ LICENSE
web-test-runner.config.mjs
codecov.yaml
libs/features/mas/*
!libs/features/mas/docs
11 changes: 9 additions & 2 deletions libs/blocks/global-navigation/global-navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import {
addMepHighlightAndTargetId,
isDarkMode,
darkIcons,
setDisableAEDState,
getDisableAEDState,
} from './utilities/utilities.js';

import { replaceKey, replaceKeyArray } from '../../features/placeholders.js';
Expand Down Expand Up @@ -837,8 +839,9 @@ class Gnav {

if (!hasActiveLink()) {
const sections = this.elements.mainNav.querySelectorAll('.feds-navItem--section');
const disableAED = getDisableAEDState();

if (sections.length === 1) {
if (!disableAED && sections.length === 1) {
sections[0].classList.add(selectors.activeNavItem.slice(1));
setActiveLink(true);
}
Expand Down Expand Up @@ -1024,7 +1027,11 @@ const getSource = async () => {
export default async function init(block) {
try {
const { mep } = getConfig();
const url = await getSource();
const sourceUrl = await getSource();
const [url, hash = ''] = sourceUrl.split('#');
if (hash === '_noActiveItem') {
setDisableAEDState();
}
const content = await fetchAndProcessPlainHtml({ url });
if (!content) return null;
const gnav = new Gnav({
Expand Down
14 changes: 12 additions & 2 deletions libs/blocks/global-navigation/utilities/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export function getAnalyticsValue(str, index) {

export function getExperienceName() {
const experiencePath = getMetadata('gnav-source');
const explicitExperience = experiencePath?.split('/').pop();
const explicitExperience = experiencePath?.split('#')[0]?.split('/').pop();
if (explicitExperience?.length
&& explicitExperience !== 'gnav') return explicitExperience;

Expand Down Expand Up @@ -257,14 +257,24 @@ export function setActiveDropdown(elem) {
});
}

// Disable AED(Active Element Detection)
export const [setDisableAEDState, getDisableAEDState] = (() => {
let disableAED = false;
return [
() => { disableAED = true; },
() => disableAED,
];
})();

export const [hasActiveLink, setActiveLink, getActiveLink] = (() => {
let activeLinkFound;

return [
() => activeLinkFound,
(val) => { activeLinkFound = !!val; },
(area) => {
if (hasActiveLink() || !(area instanceof HTMLElement)) return null;
const disableAED = getDisableAEDState();
if (disableAED || hasActiveLink() || !(area instanceof HTMLElement)) return null;
const { origin, pathname } = window.location;
const url = `${origin}${pathname}`;
const activeLink = [
Expand Down
8 changes: 4 additions & 4 deletions libs/deps/mas/mas.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.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/deps/mas/merch-datasource.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.

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

64 changes: 64 additions & 0 deletions libs/features/mas/docs/plans.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

<!DOCTYPE html>
<html>
<head>
<title>Plans merch cards</title>
<meta name="access-control-allow-origin" content="*">
<meta name="robots" content="noindex, nofollow">
<meta name="nofollow-links" content="on">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="/libs/scripts/scripts.js" type="module"></script>
<script src="/libs/deps/mas/mas.js" type="module"></script>
<link rel="stylesheet" href="/libs/styles/styles.css">
</head>
<body>
<header></header>
<main>
<div class="section dark xs-spacing" style="background: rgb(34, 34, 34);" daa-lh="s1">
<div class="text text-block con-block" daa-lh="b1|text">
<div class="foreground">
<div>M@S2 Components</div>
</div>
</div>
<div class="columns contained static-links columns-table" daa-lh="b2|columns">
<div class="row row-1">
<div data-valign="middle" class="col col-1"><strong class="tracking-header">Explore</strong></div>
<div data-valign="middle" class="col col-2"></div>
</div>
<div class="row row-2">
<div data-valign="middle" class="col col-1">
<ul>
<li><a href="/libs/features/mas/docs/plans.html">Plans Cards</a></li>
</ul>
</div>
<div data-valign="middle" class="col col-2">
<p>Merch @ Scale (M@S), is a system developed by the Adobe.com Warriors engineering team designed to streamline the authoring, configuration, and display of pricing data on adobe.com.</p>
<p>Contact us in Slack: #tacocat-friends</p>
</div>
</div>
</div>
<div class="section-metadata">
<div>
<div>style</div>
<div>Dark, xs spacing</div>
</div>
<div>
<div>background</div>
<div>#222222</div>
</div>
</div>
<div class="text center xl-spacing-bottom xl-spacing-top text-block con-block" daa-lh="b3|text">
<div class="foreground">
<div data-valign="middle">
<h2 id="merch-cards" class="heading-l">&lt;&lt;Merch cards&gt;&gt;</h2>
</div>
</div>
</div>
</div>
<div class="section m-spacing">
<merch-card><merch-datasource path="/content/dam/mas/acom/us/en/creative-cloud-all-apps"></merch-datasource></merch-card>
</div>
</main>
<footer></footer>
</body>
</html>
Loading
Loading