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-151250: Implemented filtering cards by partner level #14

Merged
merged 15 commits into from
Jun 14, 2024
Merged
Changes from 1 commit
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
26 changes: 24 additions & 2 deletions eds/components/PartnerCards.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,11 @@ export class PartnerCards extends LitElement {

const { collectionTags, language, country } = this.blockData;

if (collectionTags) {
api.searchParams.set('collectionTags', collectionTags);
const partnerDataCollectionTag = this.getPartnerDataCollectionTag();
const mergedCollectionTags = collectionTags ? `${collectionTags}&${partnerDataCollectionTag}` : partnerDataCollectionTag;

if (mergedCollectionTags) {
api.searchParams.set('collectionTags', mergedCollectionTags);
}

if (language && country) {
Expand All @@ -209,6 +212,25 @@ export class PartnerCards extends LitElement {
}
}

getPartnerDataCollectionTag () {
let cookies = document.cookie.split(';').map(cookie => cookie.trim());
let partnerDataCookie = cookies.find(cookie => cookie.startsWith('partner_data='));
if(!partnerDataCookie) return '';
const { level } = JSON.parse(partnerDataCookie.substring(('partner_data=').length).toLowerCase());
saragajic11 marked this conversation as resolved.
Show resolved Hide resolved
const portal = this.blockData.ietf === 'en-US' ? this.getProgramType(window.location.pathname.split('/')[1]) : this.getProgramType(window.location.pathname.split('/')[2]);
saragajic11 marked this conversation as resolved.
Show resolved Hide resolved
if(!portal) return '';
saragajic11 marked this conversation as resolved.
Show resolved Hide resolved
return `caas:adobe-partners/${portal}/partner-level/${level}`
}

getProgramType(path) {
switch(path) {
case 'solutionpartners': return 'spp';
case 'technologypartners': return 'tpp';
case 'channelpartners': return 'cpp';
default: return '';
}
}

initUrlSearchParams () {
const { search } = location || window.location;
this.urlSearchParams = new URLSearchParams(search);
Expand Down
Loading