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-157555: Remove useless logic and putting import commerce.js top. #2906

Open
wants to merge 2 commits into
base: stage
Choose a base branch
from
Open
Changes from all 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
10 changes: 2 additions & 8 deletions libs/blocks/merch/merch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
createTag, getConfig, loadArea, loadScript, loadStyle, localizeLink,
} from '../../utils/utils.js';
import { replaceKey } from '../../features/placeholders.js';
import '../../deps/mas/commerce.js';

export const CHECKOUT_LINK_CONFIG_PATH = '/commerce/checkout-link.json'; // relative to libs.

Expand Down Expand Up @@ -422,14 +423,7 @@ export async function initService(force = false) {
}
const { env, commerce = {}, locale } = getConfig();
initService.promise = initService.promise ?? polyfills().then(async () => {
const { hostname, searchParams } = new URL(window.location.href);
let commerceLibPath = '../../deps/mas/commerce.js';
if (/hlx\.(page|live)$|localhost$|www\.stage\.adobe\.com$/.test(hostname)) {
const maslibs = searchParams.get('maslibs');
if (maslibs) {
commerceLibPath = `${getMasBase(hostname, maslibs)}/libs/commerce.js`;
}
}
const commerceLibPath = '../../deps/mas/commerce.js';
const commerceLib = await import(commerceLibPath);
const service = await commerceLib.init(() => ({
env,
Expand Down
Loading