diff --git a/.gitignore b/.gitignore index 28e0bfffa..2e365d69c 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ nala/.auth/ /agents/ reports/ /.superpowers +docs/superpowers/ .logs # IO Runtime Config diff --git a/io/www/src/fragment/utils/paths.js b/io/www/src/fragment/utils/paths.js index 06ef770e9..b0f8daa7b 100644 --- a/io/www/src/fragment/utils/paths.js +++ b/io/www/src/fragment/utils/paths.js @@ -2,6 +2,8 @@ const MAS_ROOT = '/content/dam/mas'; const FRAGMENT_URL_PREFIX = 'https://odin.adobe.com/adobe/sites/fragments'; +const GATEWAY_PREVIEW_URL = 'https://preview.mas.corp.adobe.com/adobe/contentFragments'; + const PATH_TOKENS = /\/content\/dam\/mas\/(?[\w-_]+)\/(?[\w-_]+)\/(?.+)/; function rootURL(preview) { @@ -43,4 +45,4 @@ function odinUrl(surface, { locale, fragmentPath, preview }) { return `${rootURL(preview)}?path=${MAS_ROOT}/${surface}/${locale}/${fragmentPath}`; } -export { PATH_TOKENS, FRAGMENT_URL_PREFIX, MAS_ROOT, odinUrl, odinId, odinReferences }; +export { PATH_TOKENS, FRAGMENT_URL_PREFIX, GATEWAY_PREVIEW_URL, MAS_ROOT, odinUrl, odinId, odinReferences }; diff --git a/io/www/test/client/fragment-client.test.js b/io/www/test/client/fragment-client.test.js index bd6c7ad9b..662a1862a 100644 --- a/io/www/test/client/fragment-client.test.js +++ b/io/www/test/client/fragment-client.test.js @@ -29,7 +29,7 @@ const localStorageStub = { let objectKeysStub; describe('FragmentClient', () => { - const baseUrl = 'https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments'; + const baseUrl = 'https://preview.mas.corp.adobe.com/adobe/contentFragments'; let fetchStub; before(() => { @@ -42,6 +42,7 @@ describe('FragmentClient', () => { // Stub window.localStorage globalThis.window = globalThis.window || { localStorage: {} }; sinon.stub(globalThis.window, 'localStorage').value(localStorageStub); + globalThis.window.adobeIMS = { getAccessToken: () => ({ token: 'test-ims-token' }) }; globalThis.localStorage = localStorageStub; objectKeysStub = sinon.stub(Object, 'keys').callThrough(); objectKeysStub.withArgs(localStorageStub).callsFake(() => Object.keys(storage)); diff --git a/io/www/test/fragment/paths.test.js b/io/www/test/fragment/paths.test.js index e16ea85d1..d31e75b14 100644 --- a/io/www/test/fragment/paths.test.js +++ b/io/www/test/fragment/paths.test.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { PATH_TOKENS, odinReferences, FRAGMENT_URL_PREFIX } from '../../src/fragment/utils/paths.js'; +import { PATH_TOKENS, odinReferences, FRAGMENT_URL_PREFIX, GATEWAY_PREVIEW_URL } from '../../src/fragment/utils/paths.js'; describe('PATH_TOKENS', () => { it('should work with adobe-home surface', async () => { @@ -27,3 +27,9 @@ describe('odinReferences', () => { expect(result).to.equal(`${FRAGMENT_URL_PREFIX}/test-id`); }); }); + +describe('GATEWAY_PREVIEW_URL', () => { + it('should point to the MAS preview gateway', () => { + expect(GATEWAY_PREVIEW_URL).to.equal('https://preview.mas.corp.adobe.com/adobe/contentFragments'); + }); +}); diff --git a/io/www/test/fragment/pipeline.test.js b/io/www/test/fragment/pipeline.test.js index 640b9345b..2044877db 100644 --- a/io/www/test/fragment/pipeline.test.js +++ b/io/www/test/fragment/pipeline.test.js @@ -41,11 +41,11 @@ const EXPECTED_HEADERS = { const SETTINGS_INDEX_URL_SANDBOX = 'https://odin.adobe.com/adobe/sites/fragments?path=/content/dam/mas/sandbox/settings/index'; const SETTINGS_INDEX_URL_PREVIEW = - 'https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments?path=/content/dam/mas/sandbox/settings/index'; + 'https://preview-p22655-e59433.adobeaemcloud.com/adobe/contentFragments?path=/content/dam/mas/sandbox/settings/index'; const SETTINGS_CONTENT_URL = (settingsId) => `https://odin.adobe.com/adobe/sites/fragments/${settingsId}?references=all-hydrated`; const SETTINGS_CONTENT_URL_PREVIEW = (settingsId) => - `https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments/${settingsId}?references=all-hydrated`; + `https://preview-p22655-e59433.adobeaemcloud.com/adobe/contentFragments/${settingsId}?references=all-hydrated`; function mockSettings(fetchStub, preview = false, settingsId = 'settings-id') { const indexUrl = preview ? SETTINGS_INDEX_URL_PREVIEW : SETTINGS_INDEX_URL_SANDBOX; @@ -60,8 +60,8 @@ function setupFragmentMocks(fetchStub, { id, path, fields = {} }, preview = fals // setup settings mocks so pipeline context gets settings mockSettings(fetchStub, preview); - const odinDomain = `https://${preview ? 'odinpreview.corp' : 'odin'}.adobe.com`; - const odinUriRoot = preview ? '/adobe/sites/cf/fragments' : '/adobe/sites/fragments'; + const odinDomain = preview ? 'https://preview-p22655-e59433.adobeaemcloud.com' : 'https://odin.adobe.com'; + const odinUriRoot = preview ? '/adobe/contentFragments' : '/adobe/sites/fragments'; // english fragment by id fetchStub .withArgs(`${odinDomain}${odinUriRoot}/some-en-us-fragment?references=all-hydrated`) @@ -180,7 +180,7 @@ describe('pipeline full use case', () => { const result = await getFragment({ id: 'some-en-us-fragment', preview: { - url: 'https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments', + url: 'https://preview-p22655-e59433.adobeaemcloud.com/adobe/contentFragments', }, state: state, locale: 'fr_FR', diff --git a/io/www/test/fragment/replace.test.js b/io/www/test/fragment/replace.test.js index 429b84119..a826b7522 100644 --- a/io/www/test/fragment/replace.test.js +++ b/io/www/test/fragment/replace.test.js @@ -40,8 +40,8 @@ const mockDictionaryBySurfaceLocale = ( dictionaryResponse = DICTIONARY_RESPONSE, stub = fetchStub, ) => { - const odinDomain = `https://${preview ? 'odinpreview.corp' : 'odin'}.adobe.com`; - const odinUriRoot = preview ? '/adobe/sites/cf/fragments' : '/adobe/sites/fragments'; + const odinDomain = preview ? 'https://preview-p22655-e59433.adobeaemcloud.com' : 'https://odin.adobe.com'; + const odinUriRoot = preview ? '/adobe/contentFragments' : '/adobe/sites/fragments'; const dictionaryId = dictionaryIdFor(surface, locale); stub.withArgs(`${odinDomain}${odinUriRoot}?path=/content/dam/mas/${surface}/${locale}/dictionary/index`).returns( diff --git a/nala/studio/regional-variations/specs/variations.spec.js b/nala/studio/regional-variations/specs/variations.spec.js index c225aae5e..6933ca71a 100644 --- a/nala/studio/regional-variations/specs/variations.spec.js +++ b/nala/studio/regional-variations/specs/variations.spec.js @@ -157,7 +157,7 @@ export default { locale: 'en_CA', localeName: 'Canada', price: PRICE_PATTERN.CA.mo, - referencesBaseUrl: 'https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments', + referencesBaseUrl: 'https://preview.mas.corp.adobe.com/adobe/contentFragments', editedTitle: '[selfref] Edited title', }, tags: '@mas-studio @regional-variations', diff --git a/studio/libs/fragment-client.js b/studio/libs/fragment-client.js index 7ab71ca18..4c426b893 100644 --- a/studio/libs/fragment-client.js +++ b/studio/libs/fragment-client.js @@ -6,6 +6,7 @@ // Import the modules import { logDebug, logError } from '../../io/www/src/fragment/utils/log.js'; import { getRequestMetadata, storeRequestMetadata, extractContextFromMetadata } from '../../io/www/src/fragment/utils/cache.js'; +import { GATEWAY_PREVIEW_URL } from '../../io/www/src/fragment/utils/paths.js'; import { transformer as corrector } from '../../io/www/src/fragment/transformers/corrector.js'; import { transformer as fetchFragment } from '../../io/www/src/fragment/transformers/fetchFragment.js'; import { clearDictionaryCache, getDictionary, transformer as replace } from '../../io/www/src/fragment/transformers/replace.js'; @@ -34,16 +35,22 @@ class LocaleStorageState { } } +function getPreviewContext() { + return { + preview: { url: GATEWAY_PREVIEW_URL }, + }; +} + const DEFAULT_CONTEXT = { status: 200, - preview:{ - url: 'https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments', + preview: { + url: GATEWAY_PREVIEW_URL, }, requestId: 'preview', state: new LocaleStorageState(), networkConfig: { mainTimeout: 20000, - fetchTimeout: 15000, + fetchTimeout: 4000, retries: 3, }, locale: 'en_US', @@ -67,7 +74,8 @@ async function previewFragment(id, options) { const locale = serviceElement?.getAttribute('locale'); const country = serviceElement?.getAttribute('country'); let context = { ...DEFAULT_CONTEXT, locale, country, ...options, id, api_key: 'fragment-client' }; - const initPromises = {}; + + const initPromises = {}; const cachedMetadata = await getRequestMetadata(context); const metadataContext = extractContextFromMetadata(cachedMetadata); context = { ...context, ...metadataContext }; @@ -80,6 +88,7 @@ async function previewFragment(id, options) { ...structuredClone(context), promises: initPromises, fragmentsIds: context.fragmentsIds, + DEFAULT_HEADERS: context.DEFAULT_HEADERS, }; initContext.loggedTransformer = `${transformer.name}-init`; logDebug(() => `Initializing transformer ${transformer.name}`, initContext); @@ -151,4 +160,4 @@ async function previewStudioFragment(body, options) { return context.body; } -export { clearCaches, previewFragment, previewStudioFragment, customize, settings, replace, getDictionary, corrector }; +export { clearCaches, getPreviewContext, previewFragment, previewStudioFragment, customize, settings, replace, getDictionary, corrector }; diff --git a/studio/src/constants.js b/studio/src/constants.js index c612e11cf..6981cfd73 100644 --- a/studio/src/constants.js +++ b/studio/src/constants.js @@ -261,6 +261,3 @@ export const TABLE_TYPE = { }; export const TRANSLATIONS_ALLOWED_SURFACES = ['acom', 'acom-cc', 'acom-dc', 'express', 'sandbox', 'nala']; - -/** Base URL for Odin preview fragment-by-path checks (e.g. fil_PH .json endpoint). */ -export const ODIN_PREVIEW_ORIGIN = 'https://odinpreview.corp.adobe.com'; diff --git a/studio/src/mas-fragment-editor.js b/studio/src/mas-fragment-editor.js index 5a91a0c78..1c5924377 100644 --- a/studio/src/mas-fragment-editor.js +++ b/studio/src/mas-fragment-editor.js @@ -9,10 +9,10 @@ import { CARD_MODEL_PATH, COLLECTION_MODEL_PATH, MAS_PRODUCT_CODE_PREFIX, - ODIN_PREVIEW_ORIGIN, PAGE_NAMES, TAG_PROMOTION_PREFIX, } from './constants.js'; +import { GATEWAY_PREVIEW_URL } from '../../io/www/src/fragment/utils/paths.js'; import router from './router.js'; import { VARIANTS } from './editors/variant-picker.js'; import { extractLocaleFromPath, generateCodeToUse, getFragmentMapping, replaceLocaleInPath, showToast } from './utils.js'; @@ -891,6 +891,14 @@ export default class MasFragmentEditor extends LitElement { return null; } + async fetchFragmentIdByPath(path) { + const url = `${GATEWAY_PREVIEW_URL}?path=${encodeURIComponent(path)}`; + const res = await fetch(url); + if (!res.ok) return null; + const data = await res.json().catch(() => ({})); + return data.items?.[0]?.id ?? null; + } + async updateTranslatedLocalesStore(isVariation, fragmentPath) { // Only fetch translations for default fragments, not variations if (isVariation) { @@ -918,17 +926,12 @@ export default class MasFragmentEditor extends LitElement { if (isFilPh && fragmentPath) { const enUsPath = replaceLocaleInPath(fragmentPath, 'en_US'); if (enUsPath) { - const enUsUrl = `${ODIN_PREVIEW_ORIGIN}${enUsPath}.json`; - const res = await fetch(enUsUrl); - if (res.ok) { - const data = await res.json().catch(() => ({})); - const enUsFragmentId = data['jcr:uuid']; - if (enUsFragmentId) { - const requestPromise = this.repository.aem.sites.cf.fragments.getTranslations(enUsFragmentId); - this.#translatedLocalesRequest.requestPromise = requestPromise; - const result = await requestPromise; - languageCopies = result.languageCopies ?? []; - } + const enUsFragmentId = await this.fetchFragmentIdByPath(enUsPath); + if (enUsFragmentId) { + const requestPromise = this.repository.aem.sites.cf.fragments.getTranslations(enUsFragmentId); + this.#translatedLocalesRequest.requestPromise = requestPromise; + const result = await requestPromise; + languageCopies = result.languageCopies ?? []; } } } @@ -958,11 +961,9 @@ export default class MasFragmentEditor extends LitElement { const filPhPath = replaceLocaleInPath(fragmentPath, filPhLocale); if (filPhPath) { try { - const filPhUrl = `${ODIN_PREVIEW_ORIGIN}${filPhPath}.json`; - const res = await fetch(filPhUrl); - if (res.ok) { - const data = await res.json().catch(() => ({})); - locales = [...locales, { locale: filPhLocale, id: data['jcr:uuid'] ?? null, path: filPhPath }]; + const filPhId = await this.fetchFragmentIdByPath(filPhPath); + if (filPhId !== null) { + locales = [...locales, { locale: filPhLocale, id: filPhId, path: filPhPath }]; } } catch { // No fil_PH for this fragment. diff --git a/studio/src/mas-repository.js b/studio/src/mas-repository.js index 7e2d3030b..38ef43f2f 100644 --- a/studio/src/mas-repository.js +++ b/studio/src/mas-repository.js @@ -38,7 +38,7 @@ import { Placeholder } from './aem/placeholder.js'; import { getFragmentName } from './translation/translation-utils.js'; import generateFragmentStore from './reactivity/source-fragment-store.js'; import { getDefaultLocaleCode } from '../../io/www/src/fragment/locales.js'; -import { getDictionary } from '../libs/fragment-client.js'; +import { getDictionary, getPreviewContext } from '../libs/fragment-client.js'; import { applyCorrectorToFragment } from './utils/corrector-helper.js'; import { Promotion } from './aem/promotion.js'; @@ -793,9 +793,7 @@ export class MasRepository extends LitElement { // If result is empty and locale isn't en_US, try fallback if ((!result || Object.keys(result).length === 0) && this.filters.value.locale !== 'en_US') { const fallbackContext = { - preview: { - url: 'https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments', - }, + ...getPreviewContext(), locale: 'en_US', surface: this.search.value.path, signal: this.#abortControllers.placeholders?.signal, @@ -821,9 +819,7 @@ export class MasRepository extends LitElement { async fetchDictionary(abortController) { const context = { - preview: { - url: 'https://odinpreview.corp.adobe.com/adobe/sites/cf/fragments', - }, + ...getPreviewContext(), locale: this.filters.value.locale, surface: this.search.value.path, networkConfig: { @@ -2169,7 +2165,7 @@ export class MasRepository extends LitElement { /** * Populates the store with addon placeholders by filtering for keys that start with 'addon-' - * Uses the preview dictionary (loaded via odinpreview) instead of slow AEM search + * Uses the preview dictionary (loaded via preview gateway) instead of slow AEM search */ async loadAddonPlaceholders() { const currentOptions = this.#dedupeAddonOptions(Store.placeholders.addons.data.get()); diff --git a/studio/test/mas-fragment-editor.test.js b/studio/test/mas-fragment-editor.test.js index 27ae70421..25b2faae3 100644 --- a/studio/test/mas-fragment-editor.test.js +++ b/studio/test/mas-fragment-editor.test.js @@ -5,7 +5,8 @@ import MasFragmentEditor from '../src/mas-fragment-editor.js'; import Store from '../src/store.js'; import { Fragment } from '../src/aem/fragment.js'; import generateFragmentStore, { SourceFragmentStore } from '../src/reactivity/source-fragment-store.js'; -import { PAGE_NAMES, CARD_MODEL_PATH, ODIN_PREVIEW_ORIGIN } from '../src/constants.js'; +import { PAGE_NAMES, CARD_MODEL_PATH } from '../src/constants.js'; +import { GATEWAY_PREVIEW_URL } from '../../io/www/src/fragment/utils/paths.js'; import router from '../src/router.js'; import Events from '../src/events.js'; import { extractLocaleFromPath } from '../src/utils.js'; @@ -469,7 +470,7 @@ describe('MasFragmentEditor', () => { const fetchStub = sandbox.stub(window, 'fetch').resolves({ ok: true, - json: () => Promise.resolve({ 'jcr:uuid': 'fil-ph-frag-id' }), + json: () => Promise.resolve({ items: [{ id: 'fil-ph-frag-id' }] }), }); await el.updateTranslatedLocalesStore(false, fragmentPath); @@ -484,7 +485,7 @@ describe('MasFragmentEditor', () => { }); expect(fetchStub.calledOnce).to.be.true; expect(fetchStub.firstCall.args[0]).to.equal( - `${ODIN_PREVIEW_ORIGIN}/content/dam/mas/acom/fil_PH/my-fragment.json`, + `${GATEWAY_PREVIEW_URL}?path=${encodeURIComponent('/content/dam/mas/acom/fil_PH/my-fragment')}`, ); } finally { Store.fragmentEditor.translatedLocales.value = originalTranslatedLocales; @@ -660,7 +661,7 @@ describe('MasFragmentEditor', () => { } }); - it('adds fil_PH with id null when response json has no id', async () => { + it('skips fil_PH entry when response json has no id', async () => { const el = document.createElement('mas-fragment-editor'); const originalTranslatedLocales = Store.fragmentEditor.translatedLocales.value; try { @@ -676,14 +677,14 @@ describe('MasFragmentEditor', () => { el.editorContextStore = { isVariation: sandbox.stub().returns(false) }; sandbox.stub(window, 'fetch').resolves({ ok: true, - json: () => Promise.resolve({}), + json: () => Promise.resolve({ items: [] }), }); await el.updateTranslatedLocalesStore(false, '/content/dam/mas/acom/en_US/my-fragment'); const locales = Store.fragmentEditor.translatedLocales.get(); const filPh = locales.find((l) => l.locale === 'fil_PH'); - expect(filPh).to.deep.include({ locale: 'fil_PH', id: null, path: '/content/dam/mas/acom/fil_PH/my-fragment' }); + expect(filPh).to.be.undefined; } finally { Store.fragmentEditor.translatedLocales.value = originalTranslatedLocales; Store.fragmentEditor.fragmentId.value = null; @@ -712,7 +713,7 @@ describe('MasFragmentEditor', () => { el.editorContextStore = { isVariation: sandbox.stub().returns(false) }; const fetchStub = sandbox.stub(window, 'fetch').resolves({ ok: true, - json: () => Promise.resolve({ 'jcr:uuid': enUsFragmentId }), + json: () => Promise.resolve({ items: [{ id: enUsFragmentId }] }), }); await el.updateTranslatedLocalesStore(false, filPhPath); @@ -721,7 +722,7 @@ describe('MasFragmentEditor', () => { expect(locales).to.have.lengthOf(3); expect(getTranslations.calledOnceWith(enUsFragmentId)).to.be.true; expect(fetchStub.firstCall.args[0]).to.equal( - `${ODIN_PREVIEW_ORIGIN}/content/dam/mas/acom/en_US/my-fragment.json`, + `${GATEWAY_PREVIEW_URL}?path=${encodeURIComponent('/content/dam/mas/acom/en_US/my-fragment')}`, ); const enUs = locales.find((l) => l.locale === 'en_US'); expect(enUs).to.deep.include({ diff --git a/web-components/dist/mas.js b/web-components/dist/mas.js index 87cce255e..cb4e96520 100644 --- a/web-components/dist/mas.js +++ b/web-components/dist/mas.js @@ -8779,7 +8779,7 @@ merch-card[border-color="spectrum-red-700-plans"] { } } -`;document.head.appendChild(Gc);var qc="fragment",Vc="author",jc="preview",Wc="loading",Yc="timeout",Rn="aem-fragment",Xc="eager",Kc="cache",Kh=[Xc,Kc],Ie,Et,_e,On=class{constructor(){E(this,Ie,new Map);E(this,Et,new Map);E(this,_e,new Map)}clear(){p(this,Ie).clear(),p(this,Et).clear(),p(this,_e).clear()}add(t,r=!0){if(!this.has(t.id)&&!this.has(t.fields?.originalId)){if(p(this,Ie).set(t.id,t),t.fields?.originalId&&p(this,Ie).set(t.fields.originalId,t),p(this,_e).has(t.id)){let[,i]=p(this,_e).get(t.id);i()}if(p(this,_e).has(t.fields?.originalId)){let[,i]=p(this,_e).get(t.fields?.originalId);i()}if(!(!r||typeof t.references!="object"||Array.isArray(t.references)))for(let i in t.references){let{type:a,value:n}=t.references[i];a==="content-fragment"&&(n.settings={...t?.settings,...n.settings},n.placeholders={...t?.placeholders,...n.placeholders},n.dictionary={...t?.dictionary,...n.dictionary},n.priceLiterals={...t?.priceLiterals,...n.priceLiterals},this.add(n,t))}}}has(t){return p(this,Ie).has(t)}entries(){return p(this,Ie).entries()}get(t){return p(this,Ie).get(t)}getAsPromise(t){let[r]=p(this,_e).get(t)??[];if(r)return r;let i;return r=new Promise(a=>{i=a,this.has(t)&&a()}),p(this,_e).set(t,[r,i]),r}getFetchInfo(t){let r=p(this,Et).get(t);return r||(r={url:null,retryCount:0,stale:!1,measure:null,status:null},p(this,Et).set(t,r)),r}remove(t){p(this,Ie).delete(t),p(this,Et).delete(t),p(this,_e).delete(t)}};Ie=new WeakMap,Et=new WeakMap,_e=new WeakMap;var Qe=new On,tr,Pe,Ge,Ee,fe,J,Yr,Xr,Le,Kr,Qr,rr,Me,Qc,Zc,Nn,Jc,Yi=class extends HTMLElement{constructor(){super(...arguments);E(this,Me);m(this,"cache",Qe);E(this,tr);E(this,Pe,null);E(this,Ge,null);E(this,Ee,null);E(this,fe);E(this,J);E(this,Yr,Xc);E(this,Xr,5e3);E(this,Le);E(this,Kr,!1);E(this,Qr,0);E(this,rr)}static get observedAttributes(){return[qc,Wc,Yc,Vc,jc]}attributeChangedCallback(r,i,a){r===qc&&(y(this,fe,a),y(this,J,Qe.getFetchInfo(a))),r===Wc&&Kh.includes(a)&&y(this,Yr,a),r===Yc&&y(this,Xr,parseInt(a,10)),r===Vc&&y(this,Kr,["","true"].includes(a)),r===jc&&y(this,rr,a)}connectedCallback(){if(!p(this,Le)){if(p(this,Ee)??y(this,Ee,mt(this)),y(this,rr,p(this,Ee).settings?.preview),p(this,tr)??y(this,tr,p(this,Ee).log.module(`${Rn}[${p(this,fe)}]`)),!p(this,fe)||p(this,fe)==="#"){p(this,J)??y(this,J,Qe.getFetchInfo("missing-fragment-id")),Z(this,Me,Nn).call(this,"Missing fragment id");return}this.refresh(!1)}}get fetchInfo(){return Object.fromEntries(Object.entries(p(this,J)).filter(([r,i])=>i!=null).map(([r,i])=>[`aem-fragment:${r}`,i]))}async refresh(r=!0){if(p(this,Le)&&!await Promise.race([p(this,Le),Promise.resolve(!1)]))return;r&&Qe.remove(p(this,fe)),p(this,Yr)===Kc&&await Promise.race([Qe.getAsPromise(p(this,fe)),new Promise(s=>setTimeout(s,p(this,Xr)))]);try{y(this,Le,Z(this,Me,Jc).call(this)),await p(this,Le)}catch(s){return Z(this,Me,Nn).call(this,s.message),!1}let{references:i,referencesTree:a,placeholders:n,wcs:o}=p(this,Pe)||{};return o&&!F("mas.disableWcsCache")&&p(this,Ee).prefillWcsCache(o),this.dispatchEvent(new CustomEvent(at,{detail:{...this.data,references:i,referencesTree:a,placeholders:n,...p(this,J)},bubbles:!0,composed:!0})),p(this,Le)}get updateComplete(){return p(this,Le)??Promise.reject(new Error("AEM fragment cannot be loaded"))}get data(){return p(this,Ge)?p(this,Ge):(p(this,Kr)?this.transformAuthorData():this.transformPublishData(),p(this,Ge))}get rawData(){return p(this,Pe)}transformAuthorData(){let{fields:r,id:i,tags:a,variationId:n,settings:o={},priceLiterals:s={},dictionary:c={},placeholders:l={}}=p(this,Pe);y(this,Ge,r.reduce((d,{name:h,multiple:u,values:f})=>(d.fields[h]=u?f:f[0],d),{fields:{},id:i,tags:a,settings:o,priceLiterals:s,dictionary:c,placeholders:l,variationId:n}))}transformPublishData(){let{fields:r,id:i,tags:a,settings:n={},priceLiterals:o={},dictionary:s={},placeholders:c={},variationId:l}=p(this,Pe);y(this,Ge,Object.entries(r).reduce((d,[h,u])=>(d.fields[h]=u?.mimeType?u.value:u??"",d),{fields:{},id:i,tags:a,settings:n,priceLiterals:o,dictionary:s,placeholders:c,variationId:l}))}getFragmentClientUrl(){let i=new URLSearchParams(window.location.search).get("maslibs");if(!i||i.trim()==="")return"https://mas.adobe.com/studio/libs/fragment-client.js";let a=i.trim().toLowerCase();if(a==="local")return"http://localhost:3000/studio/libs/fragment-client.js";let{hostname:n}=window.location,o=n.endsWith(".page")?"page":"live";return a.includes("--")?`https://${a}.aem.${o}/studio/libs/fragment-client.js`:`https://${a}--mas--adobecom.aem.${o}/studio/libs/fragment-client.js`}async generatePreview(){let r=this.getFragmentClientUrl(),{previewFragment:i}=await import(r);return await i(p(this,fe),{locale:p(this,Ee).settings.locale,apiKey:p(this,Ee).settings.wcsApiKey,fullContext:!0})}};tr=new WeakMap,Pe=new WeakMap,Ge=new WeakMap,Ee=new WeakMap,fe=new WeakMap,J=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Le=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,rr=new WeakMap,Me=new WeakSet,Qc=async function(r){Jn(this,Qr)._++;let i=`${Rn}:${p(this,fe)}:${p(this,Qr)}`,a=`${i}${st}`,n=`${i}${ct}`;if(p(this,rr)){let s=await this.generatePreview();if(s.status===200)return s.body;throw new Oe(`Failed to generate preview: ${s.message}`,{})}performance.mark(a);let o;try{if(p(this,J).stale=!1,p(this,J).url=r,o=await Ni(r,{cache:"default",credentials:"omit"}),Z(this,Me,Zc).call(this,o),p(this,J).status=o?.status,p(this,J).measure=Ne(performance.measure(n,a)),p(this,J).retryCount=o.retryCount,!o?.ok)throw new Oe("Unexpected fragment response",{response:o,...p(this,Ee).duration});return await o.json()}catch(s){if(p(this,J).measure=Ne(performance.measure(n,a)),p(this,J).retryCount=s.retryCount,p(this,Pe))return p(this,J).stale=!0,p(this,tr).error("Serving stale data",p(this,J)),p(this,Pe);let c=s.message??"unknown";throw new Oe(`Failed to fetch fragment: ${c}`,{})}},Zc=function(r){Object.assign(p(this,J),vi(r))},Nn=function(r){y(this,Le,null),p(this,J).message=r,this.classList.add("error");let i={...p(this,J),...p(this,Ee).duration};p(this,tr).error(r,i),this.dispatchEvent(new CustomEvent(nt,{detail:i,bubbles:!0,composed:!0}))},Jc=async function(){var c;this.classList.remove("error"),y(this,Ge,null);let r=Qe.get(p(this,fe));if(r)return y(this,Pe,r),!0;let{masIOUrl:i,wcsApiKey:a,country:n,locale:o}=p(this,Ee).settings,s=`${i}/fragment?id=${p(this,fe)}&api_key=${a}&locale=${o}`;return n&&!o.endsWith(`_${n}`)&&(s+=`&country=${n}`),r=await Z(this,Me,Qc).call(this,s),(c=r.fields).originalId??(c.originalId=p(this,fe)),Qe.add(r),y(this,Pe,r),!0},m(Yi,"cache",Qe);customElements.define(Rn,Yi);P();Ur();var el={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},tl=e=>(...t)=>({_$litDirective$:e,values:t}),Xi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,i){this._$Ct=t,this._$AM=r,this._$Ci=i}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};var Zr=class extends Xi{constructor(t){if(super(t),this.et=w,t.type!==el.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===w||t==null)return this.ft=void 0,this.et=t;if(t===Ue)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;let r=[t];return r.raw=r,this.ft={_$litType$:this.constructor.resultType,strings:r,values:[]}}};Zr.directiveName="unsafeHTML",Zr.resultType=1;var rl=tl(Zr);var Qh=e=>e?e.startsWith("sp-icon-")?g`${rl(`<${e} class="badge-icon">`)}`:g``:w,ir=class extends U{constructor(){super(),this.color="",this.variant="",this.backgroundColor="",this.borderColor="",this.text=this.textContent,this.icon=""}connectedCallback(){this.borderColor&&this.borderColor!=="transparent"?this.style.setProperty("--merch-badge-border",`1px solid var(--${this.borderColor})`):this.backgroundColor.startsWith("gradient-")||this.style.setProperty("--merch-badge-border",`1px solid var(--${this.backgroundColor})`),this.style.setProperty("--merch-badge-background-color",`var(--${this.backgroundColor})`),(!this.borderColor||this.borderColor==="transparent")&&this.backgroundColor.startsWith("gradient-")?this.style.setProperty("--merch-badge-padding","3px 11px 4px 11px"):this.style.setProperty("--merch-badge-padding","2px 10px 3px 10px"),this.style.setProperty("--merch-badge-color",this.color),this.style.setProperty("--merch-badge-font-size","var(--consonant-merch-card-body-xs-font-size)"),this.querySelector('span[is="inline-price"]')||(this.textContent="");let t=this.closest("merch-card"),r=t?.getAttribute("size"),i=t?.querySelectorAll(":scope > merch-icon").length||0;this.style.setProperty("--merch-badge-offset",i),this.style.setProperty("--merch-badge-with-offset",i?1:0),this.style.setProperty("--merch-badge-card-size",r?2:1),super.connectedCallback()}render(){return g`
+`;document.head.appendChild(Gc);var qc="fragment",Vc="author",jc="preview",Wc="loading",Yc="timeout",Rn="aem-fragment",Xc="eager",Kc="cache",Kh=[Xc,Kc],Ie,Et,_e,On=class{constructor(){E(this,Ie,new Map);E(this,Et,new Map);E(this,_e,new Map)}clear(){p(this,Ie).clear(),p(this,Et).clear(),p(this,_e).clear()}add(t,r=!0){if(!this.has(t.id)&&!this.has(t.fields?.originalId)){if(p(this,Ie).set(t.id,t),t.fields?.originalId&&p(this,Ie).set(t.fields.originalId,t),p(this,_e).has(t.id)){let[,i]=p(this,_e).get(t.id);i()}if(p(this,_e).has(t.fields?.originalId)){let[,i]=p(this,_e).get(t.fields?.originalId);i()}if(!(!r||typeof t.references!="object"||Array.isArray(t.references)))for(let i in t.references){let{type:a,value:n}=t.references[i];a==="content-fragment"&&(n.settings={...t?.settings,...n.settings},n.placeholders={...t?.placeholders,...n.placeholders},n.dictionary={...t?.dictionary,...n.dictionary},n.priceLiterals={...t?.priceLiterals,...n.priceLiterals},this.add(n,t))}}}has(t){return p(this,Ie).has(t)}entries(){return p(this,Ie).entries()}get(t){return p(this,Ie).get(t)}getAsPromise(t){let[r]=p(this,_e).get(t)??[];if(r)return r;let i;return r=new Promise(a=>{i=a,this.has(t)&&a()}),p(this,_e).set(t,[r,i]),r}getFetchInfo(t){let r=p(this,Et).get(t);return r||(r={url:null,retryCount:0,stale:!1,measure:null,status:null},p(this,Et).set(t,r)),r}remove(t){p(this,Ie).delete(t),p(this,Et).delete(t),p(this,_e).delete(t)}};Ie=new WeakMap,Et=new WeakMap,_e=new WeakMap;var Qe=new On,tr,Pe,Ge,Ee,fe,J,Yr,Xr,Le,Kr,Qr,rr,Me,Qc,Zc,Nn,Jc,Yi=class extends HTMLElement{constructor(){super(...arguments);E(this,Me);m(this,"cache",Qe);E(this,tr);E(this,Pe,null);E(this,Ge,null);E(this,Ee,null);E(this,fe);E(this,J);E(this,Yr,Xc);E(this,Xr,5e3);E(this,Le);E(this,Kr,!1);E(this,Qr,0);E(this,rr)}static get observedAttributes(){return[qc,Wc,Yc,Vc,jc]}attributeChangedCallback(r,i,a){r===qc&&(y(this,fe,a),y(this,J,Qe.getFetchInfo(a))),r===Wc&&Kh.includes(a)&&y(this,Yr,a),r===Yc&&y(this,Xr,parseInt(a,10)),r===Vc&&y(this,Kr,["","true"].includes(a)),r===jc&&y(this,rr,a)}connectedCallback(){if(!p(this,Le)){if(p(this,Ee)??y(this,Ee,mt(this)),y(this,rr,p(this,Ee).settings?.preview),p(this,tr)??y(this,tr,p(this,Ee).log.module(`${Rn}[${p(this,fe)}]`)),!p(this,fe)||p(this,fe)==="#"){p(this,J)??y(this,J,Qe.getFetchInfo("missing-fragment-id")),Z(this,Me,Nn).call(this,"Missing fragment id");return}this.refresh(!1)}}get fetchInfo(){return Object.fromEntries(Object.entries(p(this,J)).filter(([r,i])=>i!=null).map(([r,i])=>[`aem-fragment:${r}`,i]))}async refresh(r=!0){if(p(this,Le)&&!await Promise.race([p(this,Le),Promise.resolve(!1)]))return;r&&Qe.remove(p(this,fe)),p(this,Yr)===Kc&&await Promise.race([Qe.getAsPromise(p(this,fe)),new Promise(s=>setTimeout(s,p(this,Xr)))]);try{y(this,Le,Z(this,Me,Jc).call(this)),await p(this,Le)}catch(s){return Z(this,Me,Nn).call(this,s.message),!1}let{references:i,referencesTree:a,placeholders:n,wcs:o}=p(this,Pe)||{};return o&&!F("mas.disableWcsCache")&&p(this,Ee).prefillWcsCache(o),this.dispatchEvent(new CustomEvent(at,{detail:{...this.data,references:i,referencesTree:a,placeholders:n,...p(this,J)},bubbles:!0,composed:!0})),p(this,Le)}get updateComplete(){return p(this,Le)??Promise.reject(new Error("AEM fragment cannot be loaded"))}get data(){return p(this,Ge)?p(this,Ge):(p(this,Kr)?this.transformAuthorData():this.transformPublishData(),p(this,Ge))}get rawData(){return p(this,Pe)}transformAuthorData(){let{fields:r,id:i,tags:a,variationId:n,settings:o={},priceLiterals:s={},dictionary:c={},placeholders:l={}}=p(this,Pe);y(this,Ge,r.reduce((d,{name:h,multiple:u,values:f})=>(d.fields[h]=u?f:f[0],d),{fields:{},id:i,tags:a,settings:o,priceLiterals:s,dictionary:c,placeholders:l,variationId:n}))}transformPublishData(){let{fields:r,id:i,tags:a,settings:n={},priceLiterals:o={},dictionary:s={},placeholders:c={},variationId:l}=p(this,Pe);y(this,Ge,Object.entries(r).reduce((d,[h,u])=>(d.fields[h]=u?.mimeType?u.value:u??"",d),{fields:{},id:i,tags:a,settings:n,priceLiterals:o,dictionary:s,placeholders:c,variationId:l}))}getFragmentClientUrl(){let i=new URLSearchParams(window.location.search).get("maslibs");if(!i||i.trim()==="")return"https://mas.adobe.com/studio/libs/fragment-client.js";let a=i.trim().toLowerCase();if(a==="local")return"http://localhost:3000/studio/libs/fragment-client.js";let{hostname:n}=window.location,o=n.endsWith(".page")?"page":"live";return a.includes("--")?`https://${a}.aem.${o}/studio/libs/fragment-client.js`:`https://${a}--mas--adobecom.aem.${o}/studio/libs/fragment-client.js`}async generatePreview(){let r=this.getFragmentClientUrl(),{previewFragment:i}=await import(r),a={locale:p(this,Ee).settings.locale,apiKey:p(this,Ee).settings.wcsApiKey,fullContext:!0};return await i(p(this,fe),a)}};tr=new WeakMap,Pe=new WeakMap,Ge=new WeakMap,Ee=new WeakMap,fe=new WeakMap,J=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,Le=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,rr=new WeakMap,Me=new WeakSet,Qc=async function(r){Jn(this,Qr)._++;let i=`${Rn}:${p(this,fe)}:${p(this,Qr)}`,a=`${i}${st}`,n=`${i}${ct}`;if(p(this,rr)){let s=await this.generatePreview();if(s.status===200)return s.body;throw new Oe(`Failed to generate preview: ${s.message}`,{})}performance.mark(a);let o;try{if(p(this,J).stale=!1,p(this,J).url=r,o=await Ni(r,{cache:"default",credentials:"omit"}),Z(this,Me,Zc).call(this,o),p(this,J).status=o?.status,p(this,J).measure=Ne(performance.measure(n,a)),p(this,J).retryCount=o.retryCount,!o?.ok)throw new Oe("Unexpected fragment response",{response:o,...p(this,Ee).duration});return await o.json()}catch(s){if(p(this,J).measure=Ne(performance.measure(n,a)),p(this,J).retryCount=s.retryCount,p(this,Pe))return p(this,J).stale=!0,p(this,tr).error("Serving stale data",p(this,J)),p(this,Pe);let c=s.message??"unknown";throw new Oe(`Failed to fetch fragment: ${c}`,{})}},Zc=function(r){Object.assign(p(this,J),vi(r))},Nn=function(r){y(this,Le,null),p(this,J).message=r,this.classList.add("error");let i={...p(this,J),...p(this,Ee).duration};p(this,tr).error(r,i),this.dispatchEvent(new CustomEvent(nt,{detail:i,bubbles:!0,composed:!0}))},Jc=async function(){var c;this.classList.remove("error"),y(this,Ge,null);let r=Qe.get(p(this,fe));if(r)return y(this,Pe,r),!0;let{masIOUrl:i,wcsApiKey:a,country:n,locale:o}=p(this,Ee).settings,s=`${i}/fragment?id=${p(this,fe)}&api_key=${a}&locale=${o}`;return n&&!o.endsWith(`_${n}`)&&(s+=`&country=${n}`),r=await Z(this,Me,Qc).call(this,s),(c=r.fields).originalId??(c.originalId=p(this,fe)),Qe.add(r),y(this,Pe,r),!0},m(Yi,"cache",Qe);customElements.define(Rn,Yi);P();Ur();var el={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},tl=e=>(...t)=>({_$litDirective$:e,values:t}),Xi=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,i){this._$Ct=t,this._$AM=r,this._$Ci=i}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}};var Zr=class extends Xi{constructor(t){if(super(t),this.et=w,t.type!==el.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===w||t==null)return this.ft=void 0,this.et=t;if(t===Ue)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.ft;this.et=t;let r=[t];return r.raw=r,this.ft={_$litType$:this.constructor.resultType,strings:r,values:[]}}};Zr.directiveName="unsafeHTML",Zr.resultType=1;var rl=tl(Zr);var Qh=e=>e?e.startsWith("sp-icon-")?g`${rl(`<${e} class="badge-icon">`)}`:g``:w,ir=class extends U{constructor(){super(),this.color="",this.variant="",this.backgroundColor="",this.borderColor="",this.text=this.textContent,this.icon=""}connectedCallback(){this.borderColor&&this.borderColor!=="transparent"?this.style.setProperty("--merch-badge-border",`1px solid var(--${this.borderColor})`):this.backgroundColor.startsWith("gradient-")||this.style.setProperty("--merch-badge-border",`1px solid var(--${this.backgroundColor})`),this.style.setProperty("--merch-badge-background-color",`var(--${this.backgroundColor})`),(!this.borderColor||this.borderColor==="transparent")&&this.backgroundColor.startsWith("gradient-")?this.style.setProperty("--merch-badge-padding","3px 11px 4px 11px"):this.style.setProperty("--merch-badge-padding","2px 10px 3px 10px"),this.style.setProperty("--merch-badge-color",this.color),this.style.setProperty("--merch-badge-font-size","var(--consonant-merch-card-body-xs-font-size)"),this.querySelector('span[is="inline-price"]')||(this.textContent="");let t=this.closest("merch-card"),r=t?.getAttribute("size"),i=t?.querySelectorAll(":scope > merch-icon").length||0;this.style.setProperty("--merch-badge-offset",i),this.style.setProperty("--merch-badge-with-offset",i?1:0),this.style.setProperty("--merch-badge-card-size",r?2:1),super.connectedCallback()}render(){return g`
${Qh(this.icon)}${this.text}
`}};m(ir,"properties",{color:{type:String},variant:{type:String},backgroundColor:{type:String,attribute:"background-color"},borderColor:{type:String,attribute:"border-color"},icon:{type:String}}),m(ir,"styles",b` :host { diff --git a/web-components/dist/merch-card.js b/web-components/dist/merch-card.js index 6462ffda6..b540fd8dc 100644 --- a/web-components/dist/merch-card.js +++ b/web-components/dist/merch-card.js @@ -8272,7 +8272,7 @@ merch-card[border-color="spectrum-red-700-plans"] { } `;document.head.appendChild(na);function bt(a,t={},{metadata:e=!0,search:r=!0,storage:i=!0}={}){let n;if(r&&n==null){let o=new URLSearchParams(window.location.search),c=Bt(r)?r:a;n=o.get(c)}if(i&&n==null){let o=Bt(i)?i:a;n=window.sessionStorage.getItem(o)??window.localStorage.getItem(o)}if(e&&n==null){let o=yi(Bt(e)?e:a);n=document.documentElement.querySelector(`meta[name="${o}"]`)?.content}return n??t[a]}var bi=a=>typeof a=="boolean",yt=a=>typeof a=="function";var Bt=a=>typeof a=="string";function oa(a,t){if(bi(a))return a;let e=String(a);return e==="1"||e==="true"?!0:e==="0"||e==="false"?!1:t}function yi(a=""){return String(a).replace(/(\p{Lowercase_Letter})(\p{Uppercase_Letter})/gu,(t,e,r)=>`${e}-${r}`).replace(/\W+/gu,"-").toLowerCase()}var Z=class a extends Error{constructor(t,e,r){if(super(t,{cause:r}),this.name="MasError",e.response){let i=e.response.headers?.get(ct);i&&(e.requestId=i),e.response.status&&(e.status=e.response.status,e.statusText=e.response.statusText),e.response.url&&(e.url=e.response.url)}delete e.response,this.context=e,Error.captureStackTrace&&Error.captureStackTrace(this,a)}toString(){let t=Object.entries(this.context||{}).map(([r,i])=>`${r}: ${JSON.stringify(i)}`).join(", "),e=`${this.name}: ${this.message}`;return t&&(e+=` (${t})`),this.cause&&(e+=` -Caused by: ${this.cause}`),e}};var oe={clientId:"merch-at-scale",delimiter:"\xB6",ignoredProperties:["analytics","literals","element"],serializableTypes:["Array","Object"],sampleRate:1,severity:"e",tags:"acom",isProdDomain:!1},ca=1e3;function wi(a){return a instanceof Error||typeof a?.originatingRequest=="string"}function sa(a){if(a==null)return;let t=typeof a;if(t==="function")return a.name?`function ${a.name}`:"function";if(t==="object"){if(a instanceof Error)return a.message;if(typeof a.originatingRequest=="string"){let{message:r,originatingRequest:i,status:n}=a;return[r,n,i].filter(Boolean).join(" ")}let e=a[Symbol.toStringTag]??Object.getPrototypeOf(a).constructor.name;if(!oe.serializableTypes.includes(e))return e}return a}function Ei(a,t){if(!oe.ignoredProperties.includes(a))return sa(t)}var qt={append(a){if(a.level!=="error")return;let{message:t,params:e}=a,r=[],i=[],n=t;e.forEach(p=>{p!=null&&(wi(p)?r:i).push(p)}),r.length&&(n+=" "+r.map(sa).join(" "));let{pathname:o,search:c}=window.location,l=`${oe.delimiter}page=${o}${c}`;l.length>ca&&(l=`${l.slice(0,ca)}`),n+=l,i.length&&(n+=`${oe.delimiter}facts=`,n+=JSON.stringify(i,Ei)),window.lana?.log(n,oe)}};function la(a){Object.assign(oe,Object.fromEntries(Object.entries(a).filter(([t,e])=>t in oe&&e!==""&&e!==null&&e!==void 0&&!Number.isNaN(e))))}var da={LOCAL:"local",PROD:"prod",STAGE:"stage"},Ht={DEBUG:"debug",ERROR:"error",INFO:"info",WARN:"warn"},Ut=new Set,jt=new Set,ha=new Map,pa={append({level:a,message:t,params:e,timestamp:r,source:i}){console[a](`${r}ms [${i}] %c${t}`,"font-weight: bold;",...e)}},ma={filter:({level:a})=>a!==Ht.DEBUG},ki={filter:()=>!1};function Si(a,t,e,r,i){return{level:a,message:t,namespace:e,get params(){return r.length===1&&yt(r[0])&&(r=r[0](),Array.isArray(r)||(r=[r])),r},source:i,timestamp:performance.now().toFixed(3)}}function Ci(a){[...jt].every(t=>t(a))&&Ut.forEach(t=>t(a))}function ga(a){let t=(ha.get(a)??0)+1;ha.set(a,t);let e=`${a} #${t}`,r={id:e,namespace:a,module:i=>ga(`${r.namespace}/${i}`),updateConfig:la};return Object.values(Ht).forEach(i=>{r[i]=(n,...o)=>Ci(Si(i,n,a,o,e))}),Object.seal(r)}function wt(...a){a.forEach(t=>{let{append:e,filter:r}=t;yt(r)&&jt.add(r),yt(e)&&Ut.add(e)})}function Ai(a={}){let{name:t}=a,e=oa(bt("commerce.debug",{search:!0,storage:!0}),t===da.LOCAL);return wt(e?pa:ma),t===da.PROD&&wt(qt),Ke}function Ti(){Ut.clear(),jt.clear()}var Ke={...ga(yr),Level:Ht,Plugins:{consoleAppender:pa,debugFilter:ma,quietFilter:ki,lanaAppender:qt},init:Ai,reset:Ti,use:wt};var Li="mas-commerce-service",Hs=Ke.module("utilities"),zi={requestId:ct,etag:"Etag",lastModified:"Last-Modified",serverTiming:"server-timing"};var Et=a=>window.setTimeout(a);function Gt(){return document.getElementsByTagName(Li)?.[0]}function ua(a){let t={};if(!a?.headers)return t;let e=a.headers;for(let[r,i]of Object.entries(zi)){let n=e.get(i);n&&(n=n.replace(/[,;]/g,"|"),n=n.replace(/[| ]+/g,"|"),t[r]=n)}return t}async function fa(a,t={},e=2,r=100){let i;for(let n=0;n<=e;n++)try{let o=await fetch(a,t);return o.retryCount=n,o}catch(o){if(i=o,i.retryCount=n,n>e)break;await new Promise(c=>setTimeout(c,r*(n+1)))}throw i}var va="fragment",xa="author",ba="preview",ya="loading",wa="timeout",Vt="aem-fragment",Ea="eager",ka="cache",Pi=[Ea,ka],U,ce,$,Wt=class{constructor(){g(this,U,new Map);g(this,ce,new Map);g(this,$,new Map)}clear(){s(this,U).clear(),s(this,ce).clear(),s(this,$).clear()}add(t,e=!0){if(!this.has(t.id)&&!this.has(t.fields?.originalId)){if(s(this,U).set(t.id,t),t.fields?.originalId&&s(this,U).set(t.fields.originalId,t),s(this,$).has(t.id)){let[,r]=s(this,$).get(t.id);r()}if(s(this,$).has(t.fields?.originalId)){let[,r]=s(this,$).get(t.fields?.originalId);r()}if(!(!e||typeof t.references!="object"||Array.isArray(t.references)))for(let r in t.references){let{type:i,value:n}=t.references[r];i==="content-fragment"&&(n.settings={...t?.settings,...n.settings},n.placeholders={...t?.placeholders,...n.placeholders},n.dictionary={...t?.dictionary,...n.dictionary},n.priceLiterals={...t?.priceLiterals,...n.priceLiterals},this.add(n,t))}}}has(t){return s(this,U).has(t)}entries(){return s(this,U).entries()}get(t){return s(this,U).get(t)}getAsPromise(t){let[e]=s(this,$).get(t)??[];if(e)return e;let r;return e=new Promise(i=>{r=i,this.has(t)&&i()}),s(this,$).set(t,[e,r]),e}getFetchInfo(t){let e=s(this,ce).get(t);return e||(e={url:null,retryCount:0,stale:!1,measure:null,status:null},s(this,ce).set(t,e)),e}remove(t){s(this,U).delete(t),s(this,ce).delete(t),s(this,$).delete(t)}};U=new WeakMap,ce=new WeakMap,$=new WeakMap;var J=new Wt,Me,B,V,D,M,S,Ye,Qe,q,Xe,Ze,Re,H,Sa,Ca,Kt,Aa,kt=class extends HTMLElement{constructor(){super(...arguments);g(this,H);d(this,"cache",J);g(this,Me);g(this,B,null);g(this,V,null);g(this,D,null);g(this,M);g(this,S);g(this,Ye,Ea);g(this,Qe,5e3);g(this,q);g(this,Xe,!1);g(this,Ze,0);g(this,Re)}static get observedAttributes(){return[va,ya,wa,xa,ba]}attributeChangedCallback(e,r,i){e===va&&(m(this,M,i),m(this,S,J.getFetchInfo(i))),e===ya&&Pi.includes(i)&&m(this,Ye,i),e===wa&&m(this,Qe,parseInt(i,10)),e===xa&&m(this,Xe,["","true"].includes(i)),e===ba&&m(this,Re,i)}connectedCallback(){if(!s(this,q)){if(s(this,D)??m(this,D,ae(this)),m(this,Re,s(this,D).settings?.preview),s(this,Me)??m(this,Me,s(this,D).log.module(`${Vt}[${s(this,M)}]`)),!s(this,M)||s(this,M)==="#"){s(this,S)??m(this,S,J.getFetchInfo("missing-fragment-id")),z(this,H,Kt).call(this,"Missing fragment id");return}this.refresh(!1)}}get fetchInfo(){return Object.fromEntries(Object.entries(s(this,S)).filter(([e,r])=>r!=null).map(([e,r])=>[`aem-fragment:${e}`,r]))}async refresh(e=!0){if(s(this,q)&&!await Promise.race([s(this,q),Promise.resolve(!1)]))return;e&&J.remove(s(this,M)),s(this,Ye)===ka&&await Promise.race([J.getAsPromise(s(this,M)),new Promise(c=>setTimeout(c,s(this,Qe)))]);try{m(this,q,z(this,H,Aa).call(this)),await s(this,q)}catch(c){return z(this,H,Kt).call(this,c.message),!1}let{references:r,referencesTree:i,placeholders:n,wcs:o}=s(this,B)||{};return o&&!bt("mas.disableWcsCache")&&s(this,D).prefillWcsCache(o),this.dispatchEvent(new CustomEvent(ue,{detail:{...this.data,references:r,referencesTree:i,placeholders:n,...s(this,S)},bubbles:!0,composed:!0})),s(this,q)}get updateComplete(){return s(this,q)??Promise.reject(new Error("AEM fragment cannot be loaded"))}get data(){return s(this,V)?s(this,V):(s(this,Xe)?this.transformAuthorData():this.transformPublishData(),s(this,V))}get rawData(){return s(this,B)}transformAuthorData(){let{fields:e,id:r,tags:i,variationId:n,settings:o={},priceLiterals:c={},dictionary:l={},placeholders:p={}}=s(this,B);m(this,V,e.reduce((h,{name:v,multiple:A,values:R})=>(h.fields[v]=A?R:R[0],h),{fields:{},id:r,tags:i,settings:o,priceLiterals:c,dictionary:l,placeholders:p,variationId:n}))}transformPublishData(){let{fields:e,id:r,tags:i,settings:n={},priceLiterals:o={},dictionary:c={},placeholders:l={},variationId:p}=s(this,B);m(this,V,Object.entries(e).reduce((h,[v,A])=>(h.fields[v]=A?.mimeType?A.value:A??"",h),{fields:{},id:r,tags:i,settings:n,priceLiterals:o,dictionary:c,placeholders:l,variationId:p}))}getFragmentClientUrl(){let r=new URLSearchParams(window.location.search).get("maslibs");if(!r||r.trim()==="")return"https://mas.adobe.com/studio/libs/fragment-client.js";let i=r.trim().toLowerCase();if(i==="local")return"http://localhost:3000/studio/libs/fragment-client.js";let{hostname:n}=window.location,o=n.endsWith(".page")?"page":"live";return i.includes("--")?`https://${i}.aem.${o}/studio/libs/fragment-client.js`:`https://${i}--mas--adobecom.aem.${o}/studio/libs/fragment-client.js`}async generatePreview(){let e=this.getFragmentClientUrl(),{previewFragment:r}=await import(e);return await r(s(this,M),{locale:s(this,D).settings.locale,apiKey:s(this,D).settings.wcsApiKey,fullContext:!0})}};Me=new WeakMap,B=new WeakMap,V=new WeakMap,D=new WeakMap,M=new WeakMap,S=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,q=new WeakMap,Xe=new WeakMap,Ze=new WeakMap,Re=new WeakMap,H=new WeakSet,Sa=async function(e){ir(this,Ze)._++;let r=`${Vt}:${s(this,M)}:${s(this,Ze)}`,i=`${r}${st}`,n=`${r}${lt}`;if(s(this,Re)){let c=await this.generatePreview();if(c.status===200)return c.body;throw new Z(`Failed to generate preview: ${c.message}`,{})}performance.mark(i);let o;try{if(s(this,S).stale=!1,s(this,S).url=e,o=await fa(e,{cache:"default",credentials:"omit"}),z(this,H,Ca).call(this,o),s(this,S).status=o?.status,s(this,S).measure=ve(performance.measure(n,i)),s(this,S).retryCount=o.retryCount,!o?.ok)throw new Z("Unexpected fragment response",{response:o,...s(this,D).duration});return await o.json()}catch(c){if(s(this,S).measure=ve(performance.measure(n,i)),s(this,S).retryCount=c.retryCount,s(this,B))return s(this,S).stale=!0,s(this,Me).error("Serving stale data",s(this,S)),s(this,B);let l=c.message??"unknown";throw new Z(`Failed to fetch fragment: ${l}`,{})}},Ca=function(e){Object.assign(s(this,S),ua(e))},Kt=function(e){m(this,q,null),s(this,S).message=e,this.classList.add("error");let r={...s(this,S),...s(this,D).duration};s(this,Me).error(e,r),this.dispatchEvent(new CustomEvent(fe,{detail:r,bubbles:!0,composed:!0}))},Aa=async function(){var l;this.classList.remove("error"),m(this,V,null);let e=J.get(s(this,M));if(e)return m(this,B,e),!0;let{masIOUrl:r,wcsApiKey:i,country:n,locale:o}=s(this,D).settings,c=`${r}/fragment?id=${s(this,M)}&api_key=${i}&locale=${o}`;return n&&!o.endsWith(`_${n}`)&&(c+=`&country=${n}`),e=await z(this,H,Sa).call(this,c),(l=e.fields).originalId??(l.originalId=s(this,M)),J.add(e),m(this,B,e),!0},d(kt,"cache",J);customElements.define(Vt,kt);import{LitElement as _i,html as Yt,css as Mi,nothing as Ri}from"./lit-all.min.js";import{unsafeHTML as Ni}from"./lit-all.min.js";var Oi=a=>a?a.startsWith("sp-icon-")?Yt`${Ni(`<${a} class="badge-icon">`)}`:Yt``:Ri,Ne=class extends _i{constructor(){super(),this.color="",this.variant="",this.backgroundColor="",this.borderColor="",this.text=this.textContent,this.icon=""}connectedCallback(){this.borderColor&&this.borderColor!=="transparent"?this.style.setProperty("--merch-badge-border",`1px solid var(--${this.borderColor})`):this.backgroundColor.startsWith("gradient-")||this.style.setProperty("--merch-badge-border",`1px solid var(--${this.backgroundColor})`),this.style.setProperty("--merch-badge-background-color",`var(--${this.backgroundColor})`),(!this.borderColor||this.borderColor==="transparent")&&this.backgroundColor.startsWith("gradient-")?this.style.setProperty("--merch-badge-padding","3px 11px 4px 11px"):this.style.setProperty("--merch-badge-padding","2px 10px 3px 10px"),this.style.setProperty("--merch-badge-color",this.color),this.style.setProperty("--merch-badge-font-size","var(--consonant-merch-card-body-xs-font-size)"),this.querySelector('span[is="inline-price"]')||(this.textContent="");let t=this.closest("merch-card"),e=t?.getAttribute("size"),r=t?.querySelectorAll(":scope > merch-icon").length||0;this.style.setProperty("--merch-badge-offset",r),this.style.setProperty("--merch-badge-with-offset",r?1:0),this.style.setProperty("--merch-badge-card-size",e?2:1),super.connectedCallback()}render(){return Yt`
+Caused by: ${this.cause}`),e}};var oe={clientId:"merch-at-scale",delimiter:"\xB6",ignoredProperties:["analytics","literals","element"],serializableTypes:["Array","Object"],sampleRate:1,severity:"e",tags:"acom",isProdDomain:!1},ca=1e3;function wi(a){return a instanceof Error||typeof a?.originatingRequest=="string"}function sa(a){if(a==null)return;let t=typeof a;if(t==="function")return a.name?`function ${a.name}`:"function";if(t==="object"){if(a instanceof Error)return a.message;if(typeof a.originatingRequest=="string"){let{message:r,originatingRequest:i,status:n}=a;return[r,n,i].filter(Boolean).join(" ")}let e=a[Symbol.toStringTag]??Object.getPrototypeOf(a).constructor.name;if(!oe.serializableTypes.includes(e))return e}return a}function Ei(a,t){if(!oe.ignoredProperties.includes(a))return sa(t)}var qt={append(a){if(a.level!=="error")return;let{message:t,params:e}=a,r=[],i=[],n=t;e.forEach(p=>{p!=null&&(wi(p)?r:i).push(p)}),r.length&&(n+=" "+r.map(sa).join(" "));let{pathname:o,search:c}=window.location,l=`${oe.delimiter}page=${o}${c}`;l.length>ca&&(l=`${l.slice(0,ca)}`),n+=l,i.length&&(n+=`${oe.delimiter}facts=`,n+=JSON.stringify(i,Ei)),window.lana?.log(n,oe)}};function la(a){Object.assign(oe,Object.fromEntries(Object.entries(a).filter(([t,e])=>t in oe&&e!==""&&e!==null&&e!==void 0&&!Number.isNaN(e))))}var da={LOCAL:"local",PROD:"prod",STAGE:"stage"},Ht={DEBUG:"debug",ERROR:"error",INFO:"info",WARN:"warn"},Ut=new Set,jt=new Set,ha=new Map,pa={append({level:a,message:t,params:e,timestamp:r,source:i}){console[a](`${r}ms [${i}] %c${t}`,"font-weight: bold;",...e)}},ma={filter:({level:a})=>a!==Ht.DEBUG},ki={filter:()=>!1};function Si(a,t,e,r,i){return{level:a,message:t,namespace:e,get params(){return r.length===1&&yt(r[0])&&(r=r[0](),Array.isArray(r)||(r=[r])),r},source:i,timestamp:performance.now().toFixed(3)}}function Ci(a){[...jt].every(t=>t(a))&&Ut.forEach(t=>t(a))}function ga(a){let t=(ha.get(a)??0)+1;ha.set(a,t);let e=`${a} #${t}`,r={id:e,namespace:a,module:i=>ga(`${r.namespace}/${i}`),updateConfig:la};return Object.values(Ht).forEach(i=>{r[i]=(n,...o)=>Ci(Si(i,n,a,o,e))}),Object.seal(r)}function wt(...a){a.forEach(t=>{let{append:e,filter:r}=t;yt(r)&&jt.add(r),yt(e)&&Ut.add(e)})}function Ai(a={}){let{name:t}=a,e=oa(bt("commerce.debug",{search:!0,storage:!0}),t===da.LOCAL);return wt(e?pa:ma),t===da.PROD&&wt(qt),Ke}function Ti(){Ut.clear(),jt.clear()}var Ke={...ga(yr),Level:Ht,Plugins:{consoleAppender:pa,debugFilter:ma,quietFilter:ki,lanaAppender:qt},init:Ai,reset:Ti,use:wt};var Li="mas-commerce-service",Hs=Ke.module("utilities"),zi={requestId:ct,etag:"Etag",lastModified:"Last-Modified",serverTiming:"server-timing"};var Et=a=>window.setTimeout(a);function Gt(){return document.getElementsByTagName(Li)?.[0]}function ua(a){let t={};if(!a?.headers)return t;let e=a.headers;for(let[r,i]of Object.entries(zi)){let n=e.get(i);n&&(n=n.replace(/[,;]/g,"|"),n=n.replace(/[| ]+/g,"|"),t[r]=n)}return t}async function fa(a,t={},e=2,r=100){let i;for(let n=0;n<=e;n++)try{let o=await fetch(a,t);return o.retryCount=n,o}catch(o){if(i=o,i.retryCount=n,n>e)break;await new Promise(c=>setTimeout(c,r*(n+1)))}throw i}var va="fragment",xa="author",ba="preview",ya="loading",wa="timeout",Vt="aem-fragment",Ea="eager",ka="cache",Pi=[Ea,ka],U,ce,$,Wt=class{constructor(){g(this,U,new Map);g(this,ce,new Map);g(this,$,new Map)}clear(){s(this,U).clear(),s(this,ce).clear(),s(this,$).clear()}add(t,e=!0){if(!this.has(t.id)&&!this.has(t.fields?.originalId)){if(s(this,U).set(t.id,t),t.fields?.originalId&&s(this,U).set(t.fields.originalId,t),s(this,$).has(t.id)){let[,r]=s(this,$).get(t.id);r()}if(s(this,$).has(t.fields?.originalId)){let[,r]=s(this,$).get(t.fields?.originalId);r()}if(!(!e||typeof t.references!="object"||Array.isArray(t.references)))for(let r in t.references){let{type:i,value:n}=t.references[r];i==="content-fragment"&&(n.settings={...t?.settings,...n.settings},n.placeholders={...t?.placeholders,...n.placeholders},n.dictionary={...t?.dictionary,...n.dictionary},n.priceLiterals={...t?.priceLiterals,...n.priceLiterals},this.add(n,t))}}}has(t){return s(this,U).has(t)}entries(){return s(this,U).entries()}get(t){return s(this,U).get(t)}getAsPromise(t){let[e]=s(this,$).get(t)??[];if(e)return e;let r;return e=new Promise(i=>{r=i,this.has(t)&&i()}),s(this,$).set(t,[e,r]),e}getFetchInfo(t){let e=s(this,ce).get(t);return e||(e={url:null,retryCount:0,stale:!1,measure:null,status:null},s(this,ce).set(t,e)),e}remove(t){s(this,U).delete(t),s(this,ce).delete(t),s(this,$).delete(t)}};U=new WeakMap,ce=new WeakMap,$=new WeakMap;var J=new Wt,Me,B,V,D,M,S,Ye,Qe,q,Xe,Ze,Re,H,Sa,Ca,Kt,Aa,kt=class extends HTMLElement{constructor(){super(...arguments);g(this,H);d(this,"cache",J);g(this,Me);g(this,B,null);g(this,V,null);g(this,D,null);g(this,M);g(this,S);g(this,Ye,Ea);g(this,Qe,5e3);g(this,q);g(this,Xe,!1);g(this,Ze,0);g(this,Re)}static get observedAttributes(){return[va,ya,wa,xa,ba]}attributeChangedCallback(e,r,i){e===va&&(m(this,M,i),m(this,S,J.getFetchInfo(i))),e===ya&&Pi.includes(i)&&m(this,Ye,i),e===wa&&m(this,Qe,parseInt(i,10)),e===xa&&m(this,Xe,["","true"].includes(i)),e===ba&&m(this,Re,i)}connectedCallback(){if(!s(this,q)){if(s(this,D)??m(this,D,ae(this)),m(this,Re,s(this,D).settings?.preview),s(this,Me)??m(this,Me,s(this,D).log.module(`${Vt}[${s(this,M)}]`)),!s(this,M)||s(this,M)==="#"){s(this,S)??m(this,S,J.getFetchInfo("missing-fragment-id")),z(this,H,Kt).call(this,"Missing fragment id");return}this.refresh(!1)}}get fetchInfo(){return Object.fromEntries(Object.entries(s(this,S)).filter(([e,r])=>r!=null).map(([e,r])=>[`aem-fragment:${e}`,r]))}async refresh(e=!0){if(s(this,q)&&!await Promise.race([s(this,q),Promise.resolve(!1)]))return;e&&J.remove(s(this,M)),s(this,Ye)===ka&&await Promise.race([J.getAsPromise(s(this,M)),new Promise(c=>setTimeout(c,s(this,Qe)))]);try{m(this,q,z(this,H,Aa).call(this)),await s(this,q)}catch(c){return z(this,H,Kt).call(this,c.message),!1}let{references:r,referencesTree:i,placeholders:n,wcs:o}=s(this,B)||{};return o&&!bt("mas.disableWcsCache")&&s(this,D).prefillWcsCache(o),this.dispatchEvent(new CustomEvent(ue,{detail:{...this.data,references:r,referencesTree:i,placeholders:n,...s(this,S)},bubbles:!0,composed:!0})),s(this,q)}get updateComplete(){return s(this,q)??Promise.reject(new Error("AEM fragment cannot be loaded"))}get data(){return s(this,V)?s(this,V):(s(this,Xe)?this.transformAuthorData():this.transformPublishData(),s(this,V))}get rawData(){return s(this,B)}transformAuthorData(){let{fields:e,id:r,tags:i,variationId:n,settings:o={},priceLiterals:c={},dictionary:l={},placeholders:p={}}=s(this,B);m(this,V,e.reduce((h,{name:v,multiple:A,values:R})=>(h.fields[v]=A?R:R[0],h),{fields:{},id:r,tags:i,settings:o,priceLiterals:c,dictionary:l,placeholders:p,variationId:n}))}transformPublishData(){let{fields:e,id:r,tags:i,settings:n={},priceLiterals:o={},dictionary:c={},placeholders:l={},variationId:p}=s(this,B);m(this,V,Object.entries(e).reduce((h,[v,A])=>(h.fields[v]=A?.mimeType?A.value:A??"",h),{fields:{},id:r,tags:i,settings:n,priceLiterals:o,dictionary:c,placeholders:l,variationId:p}))}getFragmentClientUrl(){let r=new URLSearchParams(window.location.search).get("maslibs");if(!r||r.trim()==="")return"https://mas.adobe.com/studio/libs/fragment-client.js";let i=r.trim().toLowerCase();if(i==="local")return"http://localhost:3000/studio/libs/fragment-client.js";let{hostname:n}=window.location,o=n.endsWith(".page")?"page":"live";return i.includes("--")?`https://${i}.aem.${o}/studio/libs/fragment-client.js`:`https://${i}--mas--adobecom.aem.${o}/studio/libs/fragment-client.js`}async generatePreview(){let e=this.getFragmentClientUrl(),{previewFragment:r}=await import(e),i={locale:s(this,D).settings.locale,apiKey:s(this,D).settings.wcsApiKey,fullContext:!0};return await r(s(this,M),i)}};Me=new WeakMap,B=new WeakMap,V=new WeakMap,D=new WeakMap,M=new WeakMap,S=new WeakMap,Ye=new WeakMap,Qe=new WeakMap,q=new WeakMap,Xe=new WeakMap,Ze=new WeakMap,Re=new WeakMap,H=new WeakSet,Sa=async function(e){ir(this,Ze)._++;let r=`${Vt}:${s(this,M)}:${s(this,Ze)}`,i=`${r}${st}`,n=`${r}${lt}`;if(s(this,Re)){let c=await this.generatePreview();if(c.status===200)return c.body;throw new Z(`Failed to generate preview: ${c.message}`,{})}performance.mark(i);let o;try{if(s(this,S).stale=!1,s(this,S).url=e,o=await fa(e,{cache:"default",credentials:"omit"}),z(this,H,Ca).call(this,o),s(this,S).status=o?.status,s(this,S).measure=ve(performance.measure(n,i)),s(this,S).retryCount=o.retryCount,!o?.ok)throw new Z("Unexpected fragment response",{response:o,...s(this,D).duration});return await o.json()}catch(c){if(s(this,S).measure=ve(performance.measure(n,i)),s(this,S).retryCount=c.retryCount,s(this,B))return s(this,S).stale=!0,s(this,Me).error("Serving stale data",s(this,S)),s(this,B);let l=c.message??"unknown";throw new Z(`Failed to fetch fragment: ${l}`,{})}},Ca=function(e){Object.assign(s(this,S),ua(e))},Kt=function(e){m(this,q,null),s(this,S).message=e,this.classList.add("error");let r={...s(this,S),...s(this,D).duration};s(this,Me).error(e,r),this.dispatchEvent(new CustomEvent(fe,{detail:r,bubbles:!0,composed:!0}))},Aa=async function(){var l;this.classList.remove("error"),m(this,V,null);let e=J.get(s(this,M));if(e)return m(this,B,e),!0;let{masIOUrl:r,wcsApiKey:i,country:n,locale:o}=s(this,D).settings,c=`${r}/fragment?id=${s(this,M)}&api_key=${i}&locale=${o}`;return n&&!o.endsWith(`_${n}`)&&(c+=`&country=${n}`),e=await z(this,H,Sa).call(this,c),(l=e.fields).originalId??(l.originalId=s(this,M)),J.add(e),m(this,B,e),!0},d(kt,"cache",J);customElements.define(Vt,kt);import{LitElement as _i,html as Yt,css as Mi,nothing as Ri}from"./lit-all.min.js";import{unsafeHTML as Ni}from"./lit-all.min.js";var Oi=a=>a?a.startsWith("sp-icon-")?Yt`${Ni(`<${a} class="badge-icon">`)}`:Yt``:Ri,Ne=class extends _i{constructor(){super(),this.color="",this.variant="",this.backgroundColor="",this.borderColor="",this.text=this.textContent,this.icon=""}connectedCallback(){this.borderColor&&this.borderColor!=="transparent"?this.style.setProperty("--merch-badge-border",`1px solid var(--${this.borderColor})`):this.backgroundColor.startsWith("gradient-")||this.style.setProperty("--merch-badge-border",`1px solid var(--${this.backgroundColor})`),this.style.setProperty("--merch-badge-background-color",`var(--${this.backgroundColor})`),(!this.borderColor||this.borderColor==="transparent")&&this.backgroundColor.startsWith("gradient-")?this.style.setProperty("--merch-badge-padding","3px 11px 4px 11px"):this.style.setProperty("--merch-badge-padding","2px 10px 3px 10px"),this.style.setProperty("--merch-badge-color",this.color),this.style.setProperty("--merch-badge-font-size","var(--consonant-merch-card-body-xs-font-size)"),this.querySelector('span[is="inline-price"]')||(this.textContent="");let t=this.closest("merch-card"),e=t?.getAttribute("size"),r=t?.querySelectorAll(":scope > merch-icon").length||0;this.style.setProperty("--merch-badge-offset",r),this.style.setProperty("--merch-badge-with-offset",r?1:0),this.style.setProperty("--merch-badge-card-size",e?2:1),super.connectedCallback()}render(){return Yt`
${Oi(this.icon)}${this.text}
`}};d(Ne,"properties",{color:{type:String},variant:{type:String},backgroundColor:{type:String,attribute:"background-color"},borderColor:{type:String,attribute:"border-color"},icon:{type:String}}),d(Ne,"styles",Mi` :host { diff --git a/web-components/src/aem-fragment.js b/web-components/src/aem-fragment.js index 02b6cb0a4..8ebd24329 100644 --- a/web-components/src/aem-fragment.js +++ b/web-components/src/aem-fragment.js @@ -479,11 +479,12 @@ export class AemFragment extends HTMLElement { async generatePreview() { const fragmentClientUrl = this.getFragmentClientUrl(); const { previewFragment } = await import(fragmentClientUrl); - const data = await previewFragment(this.#fragmentId, { + const options = { locale: this.#service.settings.locale, apiKey: this.#service.settings.wcsApiKey, fullContext: true, - }); + }; + const data = await previewFragment(this.#fragmentId, options); return data; } }