From 0eb6c070910561d35fd89beaa893cba2ccbb324e Mon Sep 17 00:00:00 2001 From: Blaine Gunn Date: Thu, 17 Aug 2023 13:15:04 -0600 Subject: [PATCH 1/2] MWPW-135230 --- .../blocks/dc-converter-widget/dc-converter-widget.js | 8 ++++++-- acrobat/scripts/dcLana.js | 9 +++++++-- acrobat/scripts/scripts.js | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js index 3653710b..eccf2a68 100644 --- a/acrobat/blocks/dc-converter-widget/dc-converter-widget.js +++ b/acrobat/blocks/dc-converter-widget/dc-converter-widget.js @@ -120,8 +120,8 @@ const pageLang = localeMap[langFromPath] || 'en-us'; export default async function init(element) { element.closest('main > div').dataset.section = 'widget'; const widget = element; - const DC_WIDGET_VERSION_FALLBACK = '2.40.0_1.172.1'; - const DC_GENERATE_CACHE_VERSION_FALLBACK = '1.172.1'; + const DC_WIDGET_VERSION_FALLBACK = '3.7.1_2.14.0'; + const DC_GENERATE_CACHE_VERSION_FALLBACK = '2.14.0'; const STG_DC_WIDGET_VERSION = document.querySelector('meta[name="stg-dc-widget-version"]')?.getAttribute('content'); const STG_DC_GENERATE_CACHE_VERSION = document.querySelector('meta[name="stg-dc-generate-cache-version"]')?.getAttribute('content'); @@ -132,13 +132,17 @@ export default async function init(element) { sampleRate: 1, tags: 'Cat=DxDC_Frictionless,origin=milo', }; + // LANA + window.dcwErrors = []; if (!DC_WIDGET_VERSION) { DC_WIDGET_VERSION = DC_WIDGET_VERSION_FALLBACK; window.lana?.log(`DC WIDGET VERSION IS NOT SET, USING FALLBACK VERSION: ${DC_WIDGET_VERSION_FALLBACK}`, lanaOptions); + dcwErrors.push(`DC WIDGET VERSION IS NOT SET, USING FALLBACK VERSION: ${DC_WIDGET_VERSION_FALLBACK}`); } if (!DC_GENERATE_CACHE_VERSION) { DC_GENERATE_CACHE_VERSION = DC_GENERATE_CACHE_VERSION_FALLBACK; window.lana?.log(`DC GENERATE CACHE VERSION IS NOT SET, USING FALLBACK VERSION: ${DC_GENERATE_CACHE_VERSION_FALLBACK}`, lanaOptions); + dcwErrors.push(`DC GENERATE CACHE VERSION IS NOT SET, USING FALLBACK VERSION: ${DC_GENERATE_CACHE_VERSION_FALLBACK}`); } let WIDGET_ENV = `https://dev.acrobat.adobe.com/dc-hosted/${DC_WIDGET_VERSION}/dc-app-launcher.js`; let ENV = 'dev'; diff --git a/acrobat/scripts/dcLana.js b/acrobat/scripts/dcLana.js index b5b533a6..ddf4ed8a 100644 --- a/acrobat/scripts/dcLana.js +++ b/acrobat/scripts/dcLana.js @@ -28,7 +28,7 @@ export default function lanaLogging() { // Content Security Policy Logging if (fricPage) { - window.cspErrors.forEach((error) => { + window.cspErrors?.forEach((error) => { lanaCspOptions.tags = 'Cat=DxDC_Frictionless_CSP,origin=milo'; window.lana.log(error, lanaCspOptions); }) @@ -36,6 +36,11 @@ export default function lanaLogging() { document.addEventListener("securitypolicyviolation", (e) => { lanaCspOptions.tags = 'Cat=DxDC_Frictionless_CSP,origin=milo'; window.lana.log(`${e.violatedDirective} violation ¶ Refused to load content from ${e.blockedURI}`, lanaCspOptions); - }); + }); + + window.dcwErrors?.forEach((error) => { + lanaOptions.tags = 'Cat=DxDC_Frictionless,origin=milo'; + window.lana.log(error, lanaOptions); + }) } } diff --git a/acrobat/scripts/scripts.js b/acrobat/scripts/scripts.js index f5dbcaa3..b0788369 100644 --- a/acrobat/scripts/scripts.js +++ b/acrobat/scripts/scripts.js @@ -250,8 +250,10 @@ const { ietf } = getLocale(locales); loadArea, loadScript, setConfig, loadLana, getMetadata } = await import(`${miloLibs}/utils/utils.js`); addLocale(ietf); + setConfig({ ...CONFIG, miloLibs }); loadLana({ clientId: 'dxdc' }); + // get event back form dc web and then load area await loadArea(document, false); From 976b4bc57d4b2cb8467797f52f7b9fd98757ddd8 Mon Sep 17 00:00:00 2001 From: Blaine Gunn Date: Fri, 18 Aug 2023 09:02:37 -0600 Subject: [PATCH 2/2] moving logger --- acrobat/scripts/dcLana.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/acrobat/scripts/dcLana.js b/acrobat/scripts/dcLana.js index ddf4ed8a..fd096c80 100644 --- a/acrobat/scripts/dcLana.js +++ b/acrobat/scripts/dcLana.js @@ -26,6 +26,11 @@ export default function lanaLogging() { } }, 10000); + window.dcwErrors?.forEach((error) => { + lanaOptions.tags = 'Cat=DxDC_Frictionless,origin=milo'; + window.lana.log(error, lanaOptions); + }); + // Content Security Policy Logging if (fricPage) { window.cspErrors?.forEach((error) => { @@ -37,10 +42,5 @@ export default function lanaLogging() { lanaCspOptions.tags = 'Cat=DxDC_Frictionless_CSP,origin=milo'; window.lana.log(`${e.violatedDirective} violation ¶ Refused to load content from ${e.blockedURI}`, lanaCspOptions); }); - - window.dcwErrors?.forEach((error) => { - lanaOptions.tags = 'Cat=DxDC_Frictionless,origin=milo'; - window.lana.log(error, lanaOptions); - }) } }