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-158473: CCD Suggested Card [Merch card] #2927

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
29a16b0
initial commit
Axelcureno Sep 17, 2024
cd361b9
slots, styles and basic layout
Axelcureno Sep 18, 2024
d47b6ff
more changes
Axelcureno Sep 19, 2024
1894a7a
Update merch-card.ccd-suggested.test.html
Axelcureno Sep 19, 2024
eb40fb4
Update merch-twp-d2p.test.html
Axelcureno Sep 19, 2024
329be3a
unit tests, strip slot and more
Axelcureno Sep 19, 2024
0b1aef8
fixed review comments
Axelcureno Sep 23, 2024
e20123a
review comments fixed
Axelcureno Sep 23, 2024
f545c53
Merge branch 'stage' into MWPW-158473
Axelcureno Sep 24, 2024
254ef7a
Merge branch 'stage' into MWPW-158473
Axelcureno Sep 24, 2024
937713f
RTL background image support
Axelcureno Sep 24, 2024
59285a0
Initial @adobecom/mas-js version.
yesil Sep 26, 2024
1dd8ea9
a
Axelcureno Sep 30, 2024
5e5924d
Update merch-card.ccd-suggested.test.html
Axelcureno Sep 30, 2024
eb156cc
a
Axelcureno Sep 30, 2024
5302051
dark mode, unit tests and rtl
Axelcureno Oct 1, 2024
bdf845d
simplified styles
Axelcureno Oct 1, 2024
d2b50c4
Merge branch 'stage' into MWPW-158473
Axelcureno Oct 1, 2024
bdd6322
updated deps
Axelcureno Oct 1, 2024
d8eb9e9
Update variant-layout.js
Axelcureno Oct 1, 2024
d1ba823
dark theme ut
Axelcureno Oct 1, 2024
fed743d
Update merch-card.ccd-suggested.test.html.js
Axelcureno Oct 1, 2024
48d5fc4
Update variant-layout.js
Axelcureno Oct 1, 2024
a7ac03d
card mapping
Axelcureno Oct 2, 2024
0aa1042
MWPW-158200: Merch card Dark mode
Axelcureno Oct 2, 2024
521ac4e
updated deps
Axelcureno Oct 2, 2024
b2e797e
MWPW-159257 refactor mas enablement
npeltier Oct 4, 2024
d07b721
MWPW-159257 fix unit test + register co
npeltier Oct 4, 2024
cd61ece
review comments fixed
Axelcureno Oct 4, 2024
54dd79d
MWPW-159257 some feedbacks, more coverage
npeltier Oct 6, 2024
f5c38d3
draft
npeltier Oct 7, 2024
aff1f4a
Merge remote-tracking branch 'upstream/stage' into MWPW-157288
yesil Oct 8, 2024
046f140
Merge branch 'MWPW-158200' of github.com:adobecom/milo into MWPW-157288
yesil Oct 8, 2024
b5ef73c
Merge branch 'MWPW-158473' of github.com:adobecom/milo into MWPW-157288
yesil Oct 8, 2024
8069853
bump pkg version
yesil Oct 8, 2024
2f47a9d
MWPW-160085: WIP
yesil Oct 8, 2024
181a47d
wip
yesil Oct 9, 2024
0f39d38
fix cta mapping for suggested card
yesil Oct 9, 2024
a77246f
ccd-suggested fixes
yesil Oct 9, 2024
53faa8d
dark theme update
yesil Oct 9, 2024
1bd7cd7
remove css var
yesil Oct 9, 2024
bf98d49
fix size attribute in hydrate
yesil Oct 9, 2024
d697854
Merge branch 'MWPW-157288' into MWPW-160085
yesil Oct 9, 2024
5f6c4dd
MWPW-159257 remove init & reset concept
npeltier Oct 8, 2024
7d3b828
update docs
yesil Oct 9, 2024
fb50fdc
Merge branch 'fur-ilyas' of github.com:npeltier/milo into MWPW-160085
yesil Oct 10, 2024
dd9b869
merge changes, add more docs
yesil Oct 10, 2024
f179e09
update docs
yesil Oct 10, 2024
f8fcef8
update docs
yesil Oct 10, 2024
655afb4
fix docu
3ch023 Oct 10, 2024
13fe806
add ccd test page
3ch023 Oct 11, 2024
755e6e6
update ccd gallery
3ch023 Oct 14, 2024
fb07228
add dark theme
3ch023 Oct 14, 2024
c6d7712
fix fragment test init
npeltier Oct 15, 2024
2c73de1
Merge branch 'ccd' of github.com:adobecom/milo into ccd
npeltier Oct 15, 2024
eae4854
add vpn banner
3ch023 Oct 15, 2024
2fd5647
fixed fragment mapping
Axelcureno Oct 15, 2024
5b8bdf6
Update merch-card.js
Axelcureno Oct 15, 2024
2ddea92
Update mas.js
Axelcureno Oct 15, 2024
619f690
Merge branch 'ccd' into MWPW-158473
Axelcureno Oct 15, 2024
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
127 changes: 115 additions & 12 deletions libs/blocks/merch/merch.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,104 @@ export const CC_SINGLE_APPS = [
['XD'],
];

const GeoMap = {
ar: 'AR_es',
be_en: 'BE_en',
be_fr: 'BE_fr',
be_nl: 'BE_nl',
br: 'BR_pt',
ca: 'CA_en',
ch_de: 'CH_de',
ch_fr: 'CH_fr',
ch_it: 'CH_it',
cl: 'CL_es',
co: 'CO_es',
la: 'DO_es',
mx: 'MX_es',
pe: 'PE_es',
africa: 'MU_en',
dk: 'DK_da',
de: 'DE_de',
ee: 'EE_et',
eg_ar: 'EG_ar',
eg_en: 'EG_en',
es: 'ES_es',
fr: 'FR_fr',
gr_el: 'GR_el',
gr_en: 'GR_en',
ie: 'IE_en',
il_he: 'IL_iw',
it: 'IT_it',
lv: 'LV_lv',
lt: 'LT_lt',
lu_de: 'LU_de',
lu_en: 'LU_en',
lu_fr: 'LU_fr',
my_en: 'MY_en',
my_ms: 'MY_ms',
hu: 'HU_hu',
mt: 'MT_en',
mena_en: 'DZ_en',
mena_ar: 'DZ_ar',
nl: 'NL_nl',
no: 'NO_nb',
pl: 'PL_pl',
pt: 'PT_pt',
ro: 'RO_ro',
si: 'SI_sl',
sk: 'SK_sk',
fi: 'FI_fi',
se: 'SE_sv',
tr: 'TR_tr',
uk: 'GB_en',
at: 'AT_de',
cz: 'CZ_cs',
bg: 'BG_bg',
ru: 'RU_ru',
ua: 'UA_uk',
au: 'AU_en',
in_en: 'IN_en',
in_hi: 'IN_hi',
id_en: 'ID_en',
id_id: 'ID_in',
nz: 'NZ_en',
sa_ar: 'SA_ar',
sa_en: 'SA_en',
sg: 'SG_en',
cn: 'CN_zh-Hans',
tw: 'TW_zh-Hant',
hk_zh: 'HK_zh-hant',
jp: 'JP_ja',
kr: 'KR_ko',
za: 'ZA_en',
ng: 'NG_en',
cr: 'CR_es',
ec: 'EC_es',
pr: 'US_es', // not a typo, should be US
gt: 'GT_es',
cis_en: 'AZ_en',
cis_ru: 'AZ_ru',
sea: 'SG_en',
th_en: 'TH_en',
th_th: 'TH_th',
};

export function getMiloLocaleSettings(locale) {
const localePrefix = locale?.prefix || 'US_en';
const geo = localePrefix.replace('/', '') ?? '';
let [country = 'US', language = 'en'] = (
GeoMap[geo] ?? geo
).split('_', 2);

country = country.toUpperCase();
language = language.toLowerCase();

return {
language,
locale: `${language}_${country}`,
};
}

/* Optional checkout link params that are appended to checkout urls as is */
export const CHECKOUT_ALLOWED_KEYS = [
'af',
Expand Down Expand Up @@ -420,7 +518,7 @@ export async function initService(force = false) {
fetchEntitlements.promise = undefined;
fetchCheckoutLinkConfigs.promise = undefined;
}
const { env, commerce = {}, locale } = getConfig();
const { env, locale: miloLocale } = getConfig();
initService.promise = initService.promise ?? polyfills().then(async () => {
const { hostname, searchParams } = new URL(window.location.href);
let commerceLibPath = '../../deps/mas/commerce.js';
Expand All @@ -430,17 +528,22 @@ export async function initService(force = false) {
commerceLibPath = `${getMasBase(hostname, maslibs)}/libs/commerce.js`;
}
}
const commerceLib = await import(commerceLibPath);
const service = await commerceLib.init(() => ({
env,
commerce,
locale,
}), () => ({ getCheckoutAction, force }));
service.imsSignedInPromise.then((isSignedIn) => {
if (isSignedIn) {
fetchEntitlements();
}
});
await import(commerceLibPath);
const { language, locale } = getMiloLocaleSettings(miloLocale);
let service = document.querySelector('mas-commerce-service');
if (service && force) {
service.remove();
}
if (!service) {
service = createTag('mas-commerce-service', { env: env?.name, locale, language });
document.head.append(service);
await service.promise;
service.imsSignedInPromise?.then((isSignedIn) => {
if (isSignedIn) {
fetchEntitlements();
}
});
}
return service;
});
return initService.promise;
Expand Down
3 changes: 2 additions & 1 deletion libs/blocks/ost/ost.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ export const createLinkMarkup = (

export async function loadOstEnv() {
/* c8 ignore next */
const { Log, Defaults, getLocaleSettings } = await import('../../deps/mas/commerce.js');
const { Log, Defaults } = await import('../../deps/mas/commerce.js');
const { getLocaleSettings } = await import('../merch/merch.js');

const searchParameters = new URLSearchParams(window.location.search);
const ostSearchParameters = new URLSearchParams();
Expand Down
4,781 changes: 4,778 additions & 3 deletions libs/deps/mas/commerce.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.

297 changes: 205 additions & 92 deletions libs/deps/mas/mas.js

Large diffs are not rendered by default.

Loading
Loading