From 27cdff3110a5678880c2b990cb02bd1978c62ee6 Mon Sep 17 00:00:00 2001 From: James Tsay Date: Fri, 3 Jan 2025 13:19:23 -0800 Subject: [PATCH 01/19] handle redirectUrl --- acrobat/blocks/verb-widget/verb-widget.js | 84 +++++++++++------------ 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 8f5eaee1..3191c84f 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -42,24 +42,19 @@ const setDraggingClass = (widget, shouldToggle) => { shouldToggle ? widget.classList.add('dragging') : widget.classList.remove('dragging'); }; -function prefetchNextPage(verb) { - const { locale } = getConfig(); - const localePath = localeMap[locale.prefix.replace('/', '')].split('-').reverse().join('/'); - const nextPageHost = getEnv() === 'prod' ? 'acrobat.adobe.com' : 'stage.acrobat.adobe.com'; - const nextPageUrl = `https://${nextPageHost}/${localePath}/${verb}`; - +function prefetchNextPage(url) { const link = document.createElement('link'); link.rel = 'prefetch'; - link.href = nextPageUrl; + link.href = url; link.crossOrigin = 'anonymous'; link.as = 'document'; document.head.appendChild(link); } -function initiatePrefetch(verb) { +function initiatePrefetch(url) { if (!window.prefetchInitiated) { - prefetchNextPage(verb); + prefetchNextPage(url); window.prefetchInitiated = true; } } @@ -225,7 +220,6 @@ export default async function init(element) { button.addEventListener('click', () => { verbAnalytics('filepicker:shown', VERB); verbAnalytics('dropzone:choose-file-clicked', VERB); - initiatePrefetch(VERB); }); button.addEventListener('cancel', () => { @@ -235,7 +229,6 @@ export default async function init(element) { widget.addEventListener('dragover', (e) => { e.preventDefault(); setDraggingClass(widget, true); - initiatePrefetch(VERB); }); widget.addEventListener('dragleave', () => { @@ -249,38 +242,43 @@ export default async function init(element) { element.addEventListener('unity:track-analytics', (e) => { const cookieExp = new Date(Date.now() + 90 * 1000).toUTCString(); - - if (e.detail?.event === 'change') { - verbAnalytics('choose-file:open', VERB, e.detail?.data); - setUser(); - } - // maybe new event name files-dropped? - if (e.detail?.event === 'drop') { - initiatePrefetch(VERB); - verbAnalytics('files-dropped', VERB, e.detail?.data); - setDraggingClass(widget, false); - setUser(); - } - - if (e.detail?.event === 'cancel') { - verbAnalytics('job:cancel', VERB, e.detail?.data); - setUser(); - } - - if (e.detail?.event === 'uploading') { - verbAnalytics('job:uploading', VERB, e.detail?.data); - setUser(); - document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; - window.addEventListener('beforeunload', (w) => { - handleExit(w); - }); - } - - if (e.detail?.event === 'uploaded') { - verbAnalytics('job:test-uploaded', VERB, e.detail?.data, false); - exitFlag = true; - setUser(); - document.cookie = `UTS_Uploaded=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; + const { event, data } = e.detail || {}; + + if (!event) return; + + const analyticsMap = { + change: () => { + verbAnalytics('choose-file:open', VERB, data); + setUser(); + }, + drop: () => { + verbAnalytics('files-dropped', VERB, data); + setDraggingClass(widget, false); + setUser(); + }, + cancel: () => { + verbAnalytics('job:cancel', VERB, data); + setUser(); + }, + uploading: () => { + verbAnalytics('job:uploading', VERB, data); + setUser(); + document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; + window.addEventListener('beforeunload', handleExit); + }, + uploaded: () => { + verbAnalytics('job:test-uploaded', VERB, data, false); + exitFlag = true; + setUser(); + document.cookie = `UTS_Uploaded=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; + }, + redirectUrl: () => { + if (data) initiatePrefetch(data); + }, + }; + + if (analyticsMap[event]) { + analyticsMap[event](); } }); From 364816952de737b3636c7c50fb8abf4c800c155c Mon Sep 17 00:00:00 2001 From: James Tsay Date: Fri, 3 Jan 2025 14:02:39 -0800 Subject: [PATCH 02/19] Remove localMap reference --- acrobat/blocks/verb-widget/verb-widget.js | 1 - 1 file changed, 1 deletion(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 3191c84f..94f02a90 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -2,7 +2,6 @@ import LIMITS from './limits.js'; import { setLibs, getEnv, isOldBrowser } from '../../scripts/utils.js'; import verbAnalytics from '../../scripts/alloy/verb-widget.js'; import createSvgElement from './icons.js'; -import { localeMap } from '../unity/unity.js'; const miloLibs = setLibs('/libs'); const { createTag, getConfig } = await import(`${miloLibs}/utils/utils.js`); From 30ab0f28313c1aeb3791729f7800dd54fdc50ab5 Mon Sep 17 00:00:00 2001 From: Adam Peller <46139+peller@users.noreply.github.com> Date: Mon, 6 Jan 2025 22:29:49 -0500 Subject: [PATCH 03/19] DCXY-28094 Map Unity locales to supported Acrobat Web locales --- acrobat/blocks/unity/unity.js | 128 +++++++++++++++++----------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/acrobat/blocks/unity/unity.js b/acrobat/blocks/unity/unity.js index 5ae9c9f8..2d732c29 100644 --- a/acrobat/blocks/unity/unity.js +++ b/acrobat/blocks/unity/unity.js @@ -3,94 +3,94 @@ import LIMITS from '../verb-widget/limits.js'; export const localeMap = { '': 'en-us', br: 'pt-br', - ca: 'en-ca', - ca_fr: 'fr-ca', - mx: 'es-mx', - la: 'es-la', - africa: 'en-za', - za: 'en-za', - be_nl: 'nl-be', - be_fr: 'fr-be', - be_en: 'en-be', + ca: 'en-us', + ca_fr: 'fr-fr', + mx: 'es-es', + la: 'es-es', + africa: 'en-us', + za: 'en-us', + be_nl: 'nl-nl', + be_fr: 'fr-fr', + be_en: 'en-us', cz: 'cs-cz', - cy_en: 'en-cy', + cy_en: 'en-us', dk: 'da-dk', de: 'de-de', - ee: 'et-ee', + ee: 'en-us', es: 'es-es', fr: 'fr-fr', - gr_en: 'en-gr', - gr_el: 'el-gr', - ie: 'en-ie', - il_en: 'en-il', - il_he: 'he-il', + gr_en: 'en-us', + gr_el: 'en-us', + ie: 'en-us', + il_en: 'en-us', + il_he: 'en-us', it: 'it-it', - lv: 'lv-lv', - lt: 'lt-lt', - lu_de: 'de-lu', - lu_en: 'en-lu', - lu_fr: 'fr-lu', - hu: 'hu-hu', - mt: 'en-mt', - mena_en: 'en-ae', - mena_ar: 'ar-ae', + lv: 'en-us', + lt: 'en-us', + lu_de: 'de-de', + lu_en: 'en-us', + lu_fr: 'fr-fr', + hu: 'en-us', + mt: 'en-us', + mena_en: 'en-us', + mena_ar: 'en-us', nl: 'nl-nl', no: 'nb-no', - at: 'de-at', + at: 'de-de', pl: 'pl-pl', - pt: 'pt-pt', + pt: 'pt-br', ro: 'ro-ro', - ch_de: 'de-ch', - si: 'sl-si', - sk: 'sk-sk', - ch_fr: 'fr-ch', + ch_de: 'de-de', + si: 'en-us', + sk: 'en-us', + ch_fr: 'fr-fr', fi: 'fi-fi', se: 'sv-se', - ch_it: 'it-ch', + ch_it: 'it-it', tr: 'tr-tr', uk: 'en-gb', - bg: 'bg-bg', + bg: 'en-us', ru: 'ru-ru', - ua: 'uk-ua', + ua: 'en-us', au: 'en-au', - hk_en: 'en-hk', - in: 'en-in', + hk_en: 'en-us', + in: 'en-us', in_hi: 'hi-in', nz: 'en-nz', hk_zh: 'zh-tw', tw: 'zh-tw', jp: 'ja-jp', kr: 'ko-kr', - ae_en: 'en-ae', - ae_ar: 'ar-ae', - sa_en: 'en-sa', - sa_ar: 'ar-sa', - th_en: 'en-th', + ae_en: 'en-us', + ae_ar: 'en-us', + sa_en: 'en-us', + sa_ar: 'en-us', + th_en: 'en-us', th_th: 'th-th', - sg: 'en-sg', - cl: 'es-cl', - co: 'es-co', - ar: 'es-ar', - cr: 'es-cr', - pr: 'es-pr', - ec: 'es-ec', - pe: 'es-pe', - eg_en: 'en-eg', - eg_ar: 'ar-eg', - gt: 'es-gt', - id_en: 'en-id', + sg: 'en-us', + cl: 'es-es', + co: 'es-es', + ar: 'es-es', + cr: 'es-es', + pr: 'es-es', + ec: 'es-es', + pe: 'es-es', + eg_en: 'en-us', + eg_ar: 'en-us', + gt: 'es-es', + id_en: 'en-us', id_id: 'id-id', - ph_en: 'en-ph', - ph_fil: 'en-ph', - my_en: 'en-my', - my_ms: 'ms-my', - kw_en: 'en-kw', - kw_ar: 'ar-kw', - ng: 'en-ng', - qa_en: 'en-qa', - qa_ar: 'ar-qa', - vn_en: 'en-vn', - vn_vi: 'vi-vn', + ph_en: 'en-us', + ph_fil: 'en-us', + my_en: 'en-us', + my_ms: 'en-us', + kw_en: 'en-us', + kw_ar: 'en-us', + ng: 'en-us', + qa_en: 'en-us', + qa_ar: 'en-us', + vn_en: 'en-us', + vn_vi: 'en-us', }; function getUnityLibs(prodLibs = '/unitylibs') { From 9f30a767c49e66c5a184ea9f4b4e166da5fa8e4c Mon Sep 17 00:00:00 2001 From: James Tsay Date: Tue, 7 Jan 2025 15:06:40 -0800 Subject: [PATCH 04/19] Use hlx domain as default --- acrobat/blocks/unity/unity.js | 2 +- acrobat/scripts/scripts.js | 2 +- acrobat/scripts/utils.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/acrobat/blocks/unity/unity.js b/acrobat/blocks/unity/unity.js index 5ae9c9f8..542665dd 100644 --- a/acrobat/blocks/unity/unity.js +++ b/acrobat/blocks/unity/unity.js @@ -99,7 +99,7 @@ function getUnityLibs(prodLibs = '/unitylibs') { // eslint-disable-next-line compat/compat const branch = new URLSearchParams(search).get('unitylibs') || 'main'; if (branch === 'main' && hostname === 'www.stage.adobe.com') return prodLibs; - const env = hostname.includes('.hlx.') ? 'hlx' : 'aem'; + const env = hostname.includes('.aem.') ? 'aem' : 'hlx'; return `https://${branch}${branch.includes('--') ? '' : '--unity--adobecom'}.${env}.live/unitylibs`; } diff --git a/acrobat/scripts/scripts.js b/acrobat/scripts/scripts.js index 7428f12e..29627cde 100644 --- a/acrobat/scripts/scripts.js +++ b/acrobat/scripts/scripts.js @@ -28,7 +28,7 @@ const setLibs = (prodLibs, location = window.location) => { const branch = new URLSearchParams(search).get('milolibs') || 'main'; if (branch === 'main' && hostname === 'www.stage.adobe.com') return '/libs'; if (branch === 'local') return 'http://localhost:6456/libs'; - const env = hostname.includes('.hlx.') ? 'hlx' : 'aem'; + const env = hostname.includes('.aem.') ? 'aem' : 'hlx'; return `https://${branch}${branch.includes('--') ? '' : '--milo--adobecom'}.${env}.live/libs`; }; diff --git a/acrobat/scripts/utils.js b/acrobat/scripts/utils.js index d311f323..4012c3f4 100644 --- a/acrobat/scripts/utils.js +++ b/acrobat/scripts/utils.js @@ -30,7 +30,7 @@ export const [setLibs, getLibs] = (() => { const branch = new URLSearchParams(search).get('milolibs') || 'main'; if (branch === 'main' && hostname === 'www.stage.adobe.com') return '/libs'; if (branch === 'local') return 'http://localhost:6456/libs'; - const env = hostname.includes('.hlx.') ? 'hlx' : 'aem'; + const env = hostname.includes('.aem.') ? 'aem' : 'hlx'; return `https://${branch}${branch.includes('--') ? '' : '--milo--adobecom'}.${env}.live/libs`; })(); return libs; From 7595b6afa8472d51fb8e452fe49b3702cf922422 Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 9 Jan 2025 13:36:46 -0800 Subject: [PATCH 05/19] Set trial limit and show upsell --- acrobat/blocks/verb-widget/limits.js | 1 + acrobat/blocks/verb-widget/verb-widget.css | 121 +++++++++++++++++++++ acrobat/blocks/verb-widget/verb-widget.js | 45 ++++++++ 3 files changed, 167 insertions(+) diff --git a/acrobat/blocks/verb-widget/limits.js b/acrobat/blocks/verb-widget/limits.js index f9436f94..d8316d45 100644 --- a/acrobat/blocks/verb-widget/limits.js +++ b/acrobat/blocks/verb-widget/limits.js @@ -32,6 +32,7 @@ const LIMITS = { 'image/png', ], multipleFiles: true, + trial: 2, }, }; diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index d9c0c61d..96e52591 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -131,6 +131,7 @@ display: flex; justify-content: space-between; align-items: center; + min-height: 100%; } .verb-col { @@ -277,6 +278,66 @@ text-decoration: none; } +.verb-upsell { + color: rgb(34, 34, 34); + display: flex; + flex-direction: column; + width: 774.75px; + height: 532px; + position: static; + justify-content: normal; + align-items: normal; +} + +.verb-upsell-heading { + display: inline; + font-size: 32px; + font-weight: 700; + line-height: 40px; + margin-bottom: 8px; +} + +.verb-upsell-heading + .verb-upsell-heading { + margin-left: 5px; +} + +.verb-upsell-heading-nopayment { + font-weight: 400 !important; +} + +.verb-upsell-bullets-heading { + margin-bottom: -4px; + margin-top: 24px; + padding-left: 0; +} + +.verb-upsell-bullets { + margin-top: 8px; + padding: 0 0 0 15px; +} + +.verb-upsell-list { + font-size: 16px; + list-style-position: inside; + margin-bottom: 0; + margin-top: 8px; + max-width: 408px; + padding: 0 0 0 10px; +} + +.verb-upsell-bullets li::before { + content: "•"; + position: absolute; + left: -12px; +} + +.verb-upsell-bullets li { + list-style: none; + position: relative; + padding-left: 0; + margin-bottom: 8px; +} + @media screen and (min-width: 768px) { .verb-container { align-items: center; @@ -324,4 +385,64 @@ .verb-cta { cursor: pointer; } + + .verb-upsell { + width: 100%; + height: auto; + } + + .verb-upsell-heading { + display: inline; + word-wrap: break-word; + overflow-wrap: break-word; + white-space: normal; + max-width: 100%; + } + + .verb-upsell-heading + .verb-upsell-heading { + margin-left: 5px; + } + + .verb-upsell-bullets-heading { + margin-bottom: -4px; + margin-top: 16px; + } + + .verb-upsell-bullets { + margin-top: 4px; + } + + .verb-upsell-bullets li { + margin-bottom: 0; + } + + .verb-upsell-bullets li:last-child { + margin-bottom: 0; + } +} + +.verb-wrapper.verb-upsell-active { + cursor: default; + border: 3px solid #d5d5d5; +} + +.verb-wrapper.verb-upsell-active:hover { + border: 3px solid #d5d5d5; +} + +.verb-wrapper.verb-upsell-active.dragging { + background-color: #fff; + border: 3px solid #d5d5d5; +} + +.verb-upsell-column { + flex: 1; + padding-right: 24px; +} + +.verb-upsell-social-container { + flex: 1; + display: flex; + justify-content: center; + align-items: center; } diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 8f5eaee1..3a182195 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -84,6 +84,37 @@ function handleExit(event) { event.returnValue = true; } +async function showUpSell(verb, element) { + const headline = window.mph[`verb-widget-upsell-headline-${verb}`] || window.mph['verb-widget-upsell-headline']; + const headlineNopayment = window.mph['verb-widget-upsell-headline-nopayment']; + const bulletsHeading = window.mph['verb-widget-upsell-bullets-heading']; + const bullets = window.mph[`verb-widget-upsell-bullets-${verb}`] || window.mph['verb-widget-upsell-bullets']; + + const headlineEl = createTag('h1', { class: 'verb-upsell-heading' }, headline); + const headingNopaymentEl = createTag('h1', { class: 'verb-upsell-heading verb-upsell-heading-nopayment' }, headlineNopayment); + const upsellBulletsHeading = createTag('p', { class: 'verb-upsell-bullets-heading' }, bulletsHeading); + const upsellBullets = createTag('ul', { class: 'verb-upsell-bullets' }); + bullets.split('\n').forEach((bullet) => { upsellBullets.append(createTag('li', {}, bullet))}); + + const upsell = createTag('div', { class: 'verb-upsell' }); + const upsellColumn = createTag('div', { class: 'verb-upsell-column' }); + const socialContainer = createTag('div', { class: 'verb-upsell-social-container' }); + + const upsellRow = createTag('div', { class: 'verb-row' }); + upsellRow.append(upsellColumn, socialContainer); + + upsell.append(upsellRow); + + upsellColumn.append(headlineEl, headingNopaymentEl, upsellBulletsHeading, upsellBullets); + + const widget = createTag('div', { class: 'verb-wrapper verb-upsell-active' }); + const widgetContainer = createTag('div', { class: 'verb-container' }); + widget.append(widgetContainer); + widgetContainer.append(upsell); + + element.replaceChildren(widget); +} + export default async function init(element) { if (isOldBrowser()) { window.location.href = EOLBrowserPage; @@ -211,6 +242,14 @@ export default async function init(element) { // Analytics verbAnalytics('landing:shown', VERB); + if (LIMITS[VERB].trial) { + const count = parseInt(localStorage.getItem(`${VERB}_trial`), 10); + if (count >= LIMITS[VERB].trial) { + showUpSell(VERB, element); + return; + } + } + window.prefetchInitiated = false; widgetMobileButton.addEventListener('click', () => { @@ -268,6 +307,12 @@ export default async function init(element) { } if (e.detail?.event === 'uploading') { + if (LIMITS[VERB].trial) { + const key = `${VERB}_trial`; + const stored = localStorage.getItem(key); + const count = parseInt(stored, 10); + localStorage.setItem(key, count + 1 || 1); + } verbAnalytics('job:uploading', VERB, e.detail?.data); setUser(); document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; From 5f360ffd83b5e6ff234561c4e595339e124967bc Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 9 Jan 2025 14:07:52 -0800 Subject: [PATCH 06/19] ESLint fixes --- acrobat/blocks/verb-widget/verb-widget.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index dff23344..9929be0d 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -79,7 +79,7 @@ function handleExit(event) { } async function showUpSell(verb, element) { - const headline = window.mph[`verb-widget-upsell-headline-${verb}`] || window.mph['verb-widget-upsell-headline']; + const headline = window.mph[`verb-widget-upsell-headline-${verb}`] || window.mph['verb-widget-upsell-headline']; const headlineNopayment = window.mph['verb-widget-upsell-headline-nopayment']; const bulletsHeading = window.mph['verb-widget-upsell-bullets-heading']; const bullets = window.mph[`verb-widget-upsell-bullets-${verb}`] || window.mph['verb-widget-upsell-bullets']; @@ -88,7 +88,7 @@ async function showUpSell(verb, element) { const headingNopaymentEl = createTag('h1', { class: 'verb-upsell-heading verb-upsell-heading-nopayment' }, headlineNopayment); const upsellBulletsHeading = createTag('p', { class: 'verb-upsell-bullets-heading' }, bulletsHeading); const upsellBullets = createTag('ul', { class: 'verb-upsell-bullets' }); - bullets.split('\n').forEach((bullet) => { upsellBullets.append(createTag('li', {}, bullet))}); + bullets.split('\n').forEach((bullet) => upsellBullets.append(createTag('li', {}, bullet))); const upsell = createTag('div', { class: 'verb-upsell' }); const upsellColumn = createTag('div', { class: 'verb-upsell-column' }); @@ -305,7 +305,7 @@ export default async function init(element) { const stored = localStorage.getItem(key); const count = parseInt(stored, 10); localStorage.setItem(key, count + 1 || 1); - } + } verbAnalytics('job:uploading', VERB, data); setUser(); document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; From 0fcf8f4bbb40743ae549c8d3664737a4b227472d Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 9 Jan 2025 17:45:41 -0800 Subject: [PATCH 07/19] Add SUSI Light Block --- acrobat/blocks/susi-light/susi-light.css | 5 + acrobat/blocks/susi-light/susi-light.js | 125 ++++++++++++++++++ test/integration/susi-light/mocks/body.html | 6 + test/integration/susi-light/mocks/head.html | 2 + test/integration/susi-light/susi-light.int.js | 28 ++++ 5 files changed, 166 insertions(+) create mode 100644 acrobat/blocks/susi-light/susi-light.css create mode 100644 acrobat/blocks/susi-light/susi-light.js create mode 100644 test/integration/susi-light/mocks/body.html create mode 100644 test/integration/susi-light/mocks/head.html create mode 100644 test/integration/susi-light/susi-light.int.js diff --git a/acrobat/blocks/susi-light/susi-light.css b/acrobat/blocks/susi-light/susi-light.css new file mode 100644 index 00000000..ce4a7199 --- /dev/null +++ b/acrobat/blocks/susi-light/susi-light.css @@ -0,0 +1,5 @@ +/* preserving modal space for ux */ +.dialog-modal:has(.susi-light) { + width: 360px; + min-height: 462px; +} \ No newline at end of file diff --git a/acrobat/blocks/susi-light/susi-light.js b/acrobat/blocks/susi-light/susi-light.js new file mode 100644 index 00000000..08a99d7f --- /dev/null +++ b/acrobat/blocks/susi-light/susi-light.js @@ -0,0 +1,125 @@ +/* eslint-disable chai-friendly/no-unused-expressions */ +/* eslint-disable camelcase */ +/* eslint-disable compat/compat */ +/* eslint-disable no-underscore-dangle */ +import { setLibs, getEnv } from '../../scripts/utils.js'; + +const miloLibs = setLibs('/libs'); +const { createTag, loadScript, getConfig } = await import(`${miloLibs}/utils/utils.js`); + +const variant = 'standard'; +const isStage = ['stage', 'dev'].includes(getEnv()); + +const onRedirect = (e) => { + // eslint-disable-next-line no-console + console.log('redirecting to:', e.detail); + setTimeout(() => { + window.location.assign(e.detail); + // temporary solution: allows analytics to go thru + }, 100); +}; +const onError = (e) => { + window.lana?.log('on error:', e); +}; + +export function loadWrapper() { + const CDN_URL = `https://auth-light.identity${ + isStage ? '-stage' : '' + }.adobe.com/sentry/wrapper.js`; + return loadScript(CDN_URL); +} + +function getDestURL(url) { + let destURL; + try { + destURL = new URL(url); + } catch (err) { + window.lana?.log(`invalid redirect uri for susi-light: ${url}`); + destURL = new URL('https://www.adobe.com'); + } + if (isStage) { + destURL.hostname = 'www.stage.adobe.com'; + } + return destURL.toString(); +} + +export default async function init(el) { + const rows = el.querySelectorAll(':scope> div > div'); + const redirectUrl = rows[0]?.textContent?.trim().toLowerCase(); + const { client_id, redirect_uri } = window.adobeid; + const title = rows[2]?.textContent?.trim(); + const authParams = { + dt: false, + locale: getConfig().locale.ietf.toLowerCase(), + response_type: 'code', + client_id, + redirect_uri: redirectUrl || redirect_uri, + scope: 'AdobeID,openid', + }; + const destURL = getDestURL(redirectUrl); + const goDest = () => window.location.assign(destURL); + if (window.feds?.utilities?.imslib) { + const { imslib } = window.feds.utilities; + imslib.isReady() && imslib.isSignedInUser() && goDest(); + imslib.onReady().then(() => imslib.isSignedInUser() && goDest()); + } + el.innerHTML = ''; + await loadWrapper(); + const config = { consentProfile: 'free' }; + if (title) { + config.title = title; + } + const susi = createTag('susi-sentry-light'); + susi.authParams = authParams; + susi.authParams.redirect_uri = destURL; + susi.config = config; + if (isStage) susi.stage = 'true'; + susi.variant = variant; + function sendEventToAnalytics(type, eventName) { + const sendEvent = () => { + window._satellite.track('event', { + xdm: {}, + data: { + eventType: 'web.webinteraction.linkClicks', + web: { + webInteraction: { + name: eventName, + linkClicks: { value: 1 }, + type, + }, + }, + _adobe_corpnew: { + digitalData: { + primaryEvent: { + eventInfo: { + eventName, + client_id, + }, + }, + }, + }, + }, + }); + }; + if (window._satellite?.track) { + sendEvent(); + } else { + window.addEventListener( + 'alloy_sendEvent', + () => { + sendEvent(); + }, + { once: true }, + ); + } + } + + const onAnalytics = (e) => { + const { type, event } = e.detail; + sendEventToAnalytics(type, event); + }; + susi.addEventListener('redirect', onRedirect); + susi.addEventListener('on-error', onError); + susi.addEventListener('on-analytics', onAnalytics); + el.append(susi); +} diff --git a/test/integration/susi-light/mocks/body.html b/test/integration/susi-light/mocks/body.html new file mode 100644 index 00000000..8e4becd0 --- /dev/null +++ b/test/integration/susi-light/mocks/body.html @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/test/integration/susi-light/mocks/head.html b/test/integration/susi-light/mocks/head.html new file mode 100644 index 00000000..cb46cf64 --- /dev/null +++ b/test/integration/susi-light/mocks/head.html @@ -0,0 +1,2 @@ + + diff --git a/test/integration/susi-light/susi-light.int.js b/test/integration/susi-light/susi-light.int.js new file mode 100644 index 00000000..5c35f328 --- /dev/null +++ b/test/integration/susi-light/susi-light.int.js @@ -0,0 +1,28 @@ +/* eslint-env mocha */ +/* eslint-disable no-unused-vars */ +import { readFile } from '@web/test-runner-commands'; +import { expect } from '@esm-bundle/chai'; +import { setLibs } from '../../../acrobat/scripts/utils.js'; + +const miloLibs = setLibs('/libs'); +const { setConfig } = await import(`${miloLibs}/utils/utils.js`); + +document.head.innerHTML = await readFile({ path: './mocks/head.html' }); +document.body.innerHTML = await readFile({ path: './mocks/body.html' }); + +describe('Susi-light', async () => { + before(async () => { + setConfig({ origin: '', locale: { ietf: 'en-us' } }); + window.adobeid = { client_id: 'test', redirect_uri: 'https://www.adobe.com' }; + const block = document.querySelector('.susi-light'); + const { default: init } = await import( + '../../../acrobat/blocks/susi-light/susi-light.js' + ); + init(block); + }); + + it('Susi-light gets decorated', () => { + const block = document.querySelector('.susi-light'); + expect(block).to.exist; + }); +}); From 8b9b2f1b798cbc1f04f581d335cce9ba0bdf4984 Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 9 Jan 2025 19:44:11 -0800 Subject: [PATCH 08/19] Update client_id --- acrobat/blocks/susi-light/susi-light.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acrobat/blocks/susi-light/susi-light.js b/acrobat/blocks/susi-light/susi-light.js index 08a99d7f..a1f71702 100644 --- a/acrobat/blocks/susi-light/susi-light.js +++ b/acrobat/blocks/susi-light/susi-light.js @@ -52,7 +52,7 @@ export default async function init(el) { dt: false, locale: getConfig().locale.ietf.toLowerCase(), response_type: 'code', - client_id, + client_id: 'AdobeExpressWeb', redirect_uri: redirectUrl || redirect_uri, scope: 'AdobeID,openid', }; From 1b25769958357bc556fc918b848c0f4d77f70229 Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 9 Jan 2025 23:36:31 -0800 Subject: [PATCH 09/19] Add social CTA --- acrobat/blocks/verb-widget/verb-widget.css | 15 +++++++++++---- acrobat/blocks/verb-widget/verb-widget.js | 7 ++++++- acrobat/scripts/contentSecurityPolicy/dev.js | 1 + acrobat/scripts/contentSecurityPolicy/prod.js | 1 + acrobat/scripts/contentSecurityPolicy/stage.js | 1 + 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index 96e52591..c6cc4d5b 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -235,6 +235,7 @@ } .verb-heading { + order: 1; color: #2c2c2c; font-weight: 600; font-size: 44px; @@ -282,8 +283,8 @@ color: rgb(34, 34, 34); display: flex; flex-direction: column; - width: 774.75px; - height: 532px; + width: 100%; + height: 100%; position: static; justify-content: normal; align-items: normal; @@ -306,12 +307,14 @@ } .verb-upsell-bullets-heading { + order: 3; margin-bottom: -4px; margin-top: 24px; padding-left: 0; } .verb-upsell-bullets { + order: 4; margin-top: 8px; padding: 0 0 0 15px; } @@ -351,6 +354,7 @@ } /* responsive design */ +.susi-light { order: 2; } @media screen and (max-width: 768px) { .verb-wrapper { @@ -361,7 +365,6 @@ } .verb-row { - display: flex; flex-direction: column; } @@ -419,6 +422,10 @@ .verb-upsell-bullets li:last-child { margin-bottom: 0; } + + .verb-upsell-social-container { + width: 100%; + } } .verb-wrapper.verb-upsell-active { @@ -437,7 +444,7 @@ .verb-upsell-column { flex: 1; - padding-right: 24px; + padding: 0 12px; } .verb-upsell-social-container { diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 9929be0d..11f3f125 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -4,7 +4,7 @@ import verbAnalytics from '../../scripts/alloy/verb-widget.js'; import createSvgElement from './icons.js'; const miloLibs = setLibs('/libs'); -const { createTag, getConfig } = await import(`${miloLibs}/utils/utils.js`); +const { createTag, getConfig, loadBlock } = await import(`${miloLibs}/utils/utils.js`); const fallBack = 'https://www.adobe.com/go/acrobat-overview'; const EOLBrowserPage = 'https://acrobat.adobe.com/home/index-browser-eol.html'; @@ -92,9 +92,14 @@ async function showUpSell(verb, element) { const upsell = createTag('div', { class: 'verb-upsell' }); const upsellColumn = createTag('div', { class: 'verb-upsell-column' }); + const socialContainer = createTag('div', { class: 'verb-upsell-social-container' }); + const socialCta = createTag('div', { class: 'susi-light' }); + socialContainer.append(socialCta); + await loadBlock(socialCta); const upsellRow = createTag('div', { class: 'verb-row' }); + upsellRow.append(upsellColumn, socialContainer); upsell.append(upsellRow); diff --git a/acrobat/scripts/contentSecurityPolicy/dev.js b/acrobat/scripts/contentSecurityPolicy/dev.js index f63c998e..8dc4e49e 100644 --- a/acrobat/scripts/contentSecurityPolicy/dev.js +++ b/acrobat/scripts/contentSecurityPolicy/dev.js @@ -108,6 +108,7 @@ const frameSrc = [ 's.company-target.com', 'stage-ui.messaging.adobe.com/', 'acrobatservices.adobe.com', + 'auth-light.identity-stage.adobe.com', ';', ]; diff --git a/acrobat/scripts/contentSecurityPolicy/prod.js b/acrobat/scripts/contentSecurityPolicy/prod.js index 4f6f9884..733d1080 100644 --- a/acrobat/scripts/contentSecurityPolicy/prod.js +++ b/acrobat/scripts/contentSecurityPolicy/prod.js @@ -112,6 +112,7 @@ const frameSrc = [ 's.company-target.com', 'ui.messaging.adobe.com/', 'acrobatservices.adobe.com', + 'auth-light.identity.adobe.com', ';', ]; diff --git a/acrobat/scripts/contentSecurityPolicy/stage.js b/acrobat/scripts/contentSecurityPolicy/stage.js index 8396cc0e..04c3b54e 100644 --- a/acrobat/scripts/contentSecurityPolicy/stage.js +++ b/acrobat/scripts/contentSecurityPolicy/stage.js @@ -112,6 +112,7 @@ const frameSrc = [ 's.company-target.com', 'stage-ui.messaging.adobe.com/', 'acrobatservices.adobe.com', + 'auth-light.identity-stage.adobe.com', ';', ]; From 1c22b7fd143bfb034b7dee8da0c0cea0233fa5a0 Mon Sep 17 00:00:00 2001 From: James Tsay Date: Thu, 9 Jan 2025 23:48:26 -0800 Subject: [PATCH 10/19] Fix CSP --- acrobat/scripts/contentSecurityPolicy/dev.js | 1 + acrobat/scripts/contentSecurityPolicy/prod.js | 1 + acrobat/scripts/contentSecurityPolicy/stage.js | 1 + 3 files changed, 3 insertions(+) diff --git a/acrobat/scripts/contentSecurityPolicy/dev.js b/acrobat/scripts/contentSecurityPolicy/dev.js index 8dc4e49e..c21838bc 100644 --- a/acrobat/scripts/contentSecurityPolicy/dev.js +++ b/acrobat/scripts/contentSecurityPolicy/dev.js @@ -12,6 +12,7 @@ const connectSrc = [ '*.adobe.com', 'stage.adobeccstatic.com', '*.adobe.io', + '*.identity-stage.adobe.com', '*.adobelogin.com', '*.amazonaws.com', '*.blob.core.windows.net', diff --git a/acrobat/scripts/contentSecurityPolicy/prod.js b/acrobat/scripts/contentSecurityPolicy/prod.js index 733d1080..5e47978f 100644 --- a/acrobat/scripts/contentSecurityPolicy/prod.js +++ b/acrobat/scripts/contentSecurityPolicy/prod.js @@ -12,6 +12,7 @@ const connectSrc = [ 'prod.adobeccstatic.com', '*.clicktale.net/', '*.adobe.io', + '*.identity.adobe.com', '*.adobelogin.com', '*.amazonaws.com', '*.blob.core.windows.net', diff --git a/acrobat/scripts/contentSecurityPolicy/stage.js b/acrobat/scripts/contentSecurityPolicy/stage.js index 04c3b54e..981227bd 100644 --- a/acrobat/scripts/contentSecurityPolicy/stage.js +++ b/acrobat/scripts/contentSecurityPolicy/stage.js @@ -12,6 +12,7 @@ const connectSrc = [ '*.adobe.com', 'stage.adobeccstatic.com', '*.adobe.io', + '*.identity-stage.adobe.com', '*.adobelogin.com', '*.amazonaws.com', '*.blob.core.windows.net', From cd2050b957ebe9c9eb8493155379aa1262de03d4 Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Thu, 9 Jan 2025 18:16:51 -0300 Subject: [PATCH 11/19] Verb widget mobile version --- acrobat/blocks/verb-widget/icons.js | 1 + acrobat/blocks/verb-widget/verb-widget.css | 50 ++++++++++++++++++++-- acrobat/blocks/verb-widget/verb-widget.js | 15 ++++++- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/acrobat/blocks/verb-widget/icons.js b/acrobat/blocks/verb-widget/icons.js index 460dbbb7..9f6a58a4 100644 --- a/acrobat/blocks/verb-widget/icons.js +++ b/acrobat/blocks/verb-widget/icons.js @@ -5,6 +5,7 @@ const ICONS = { WIDGET_ICON: '', fillsign: '', 'compress-pdf': '', + 'compress-pdf-mobile': '', UPLOAD_ICON: '', SECURITY_ICON: '', INFO_ICON: '', diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index d9c0c61d..44580e83 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -292,11 +292,18 @@ /* responsive design */ @media screen and (max-width: 768px) { + .verb-widget { + background-image: linear-gradient(180deg, #EB1000 0%, #F79B94 50%, #FFF 70%); + padding: 16px; + } + .verb-wrapper { width: unset; max-width: unset; - padding: 20px; - min-height: calc(100vh - 150px); + padding: 24px 29px; + border: 3px dashed #d5d5d5; + border-radius: 8px; + min-height: calc(100vh - (63px + 32px + 115px + 48px)); } .verb-row { @@ -305,8 +312,8 @@ } .verb-icon { - width: 40px; - height: 40px; + width: 58px; + height: 56px; } .verb-title { @@ -319,9 +326,44 @@ .verb-copy { font-size: 18px; + margin-bottom: 25px; + padding-bottom: 10px; + line-height: 27px; } .verb-cta { cursor: pointer; + font-size: 22px; + padding: 9px 25px; + } + + .verb-cta .upload-icon { + margin-right: 12px; + } + + .verb-image { + width: 135px; + height: 130px; + margin-top: 56px; + margin-bottom: 28px; + } + + .verb-col.right { + flex-direction: column; + align-items: center; + } + + .info-icon { + margin-left: 7px; + margin-right: 15px; + } + + .verb-legal-wrapper { + margin-top: 23px; + } + + .verb-legal { + margin-top: 0; + font-size: 12px; } } diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 94f02a90..c1d4889a 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -180,11 +180,22 @@ export default async function init(element) { widgetLeft.append(widgetHeader, widgetHeading, widgetCopy, errorState, widgetButton, button); legalTwo.innerHTML = legalTwo.outerHTML.replace(window.mph['verb-widget-terms-of-use'], ` ${window.mph['verb-widget-terms-of-use']}`); legalTwo.innerHTML = legalTwo.outerHTML.replace(window.mph['verb-widget-privacy-policy'], ` ${window.mph['verb-widget-privacy-policy']}`); - legalWrapper.append(legal, legalTwo); footer.append(iconSecurity, legalWrapper, infoIcon); - element.append(widget, footer); + if (window.browser?.isMobile) { + widgetCopy.after(widgetMobCopy); + widgetCopy.remove(); + const verbMobImageSvg = createSvgElement(`${VERB}-mobile`); + if (verbMobImageSvg) { + verbImageSvg.remove(); + verbMobImageSvg.classList.add('icon-verb-image'); + widgetImage.appendChild(verbMobImageSvg); + } + widgetImage.after(widgetImage); + iconSecurity.remove(iconSecurity); + footer.prepend(infoIcon); + } } function checkSignedInUser() { From b89ffc4bd4cd4b5509d52ce2ec807b261033758f Mon Sep 17 00:00:00 2001 From: James Tsay Date: Fri, 10 Jan 2025 14:21:36 -0800 Subject: [PATCH 12/19] Update Styles --- acrobat/blocks/verb-widget/verb-widget.css | 64 +++++++++++----------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index c6cc4d5b..a3e6f9bf 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -235,7 +235,6 @@ } .verb-heading { - order: 1; color: #2c2c2c; font-weight: 600; font-size: 44px; @@ -307,14 +306,12 @@ } .verb-upsell-bullets-heading { - order: 3; margin-bottom: -4px; margin-top: 24px; padding-left: 0; } .verb-upsell-bullets { - order: 4; margin-top: 8px; padding: 0 0 0 15px; } @@ -353,8 +350,36 @@ } } -/* responsive design */ -.susi-light { order: 2; } +.verb-wrapper.verb-upsell-active { + cursor: default; + border: 3px solid #d5d5d5; +} + +.verb-wrapper.verb-upsell-active:hover { + border: 3px solid #d5d5d5; +} + +.verb-wrapper.verb-upsell-active.dragging { + background-color: #fff; + border: 3px solid #d5d5d5; +} + +.verb-upsell-column { + flex: 1; + padding: 0 12px; +} + +.verb-upsell-social-container { + flex: 1; + display: flex; + justify-content: center; + align-items: center; + padding: 20px; + margin: 0 20px; + background-color: #fdfdfd; + border: 1px solid #e6e6e6; + border-radius: 10px; +} @media screen and (max-width: 768px) { .verb-wrapper { @@ -425,31 +450,8 @@ .verb-upsell-social-container { width: 100%; + border: none; + background-color: transparent; + padding: 0; } } - -.verb-wrapper.verb-upsell-active { - cursor: default; - border: 3px solid #d5d5d5; -} - -.verb-wrapper.verb-upsell-active:hover { - border: 3px solid #d5d5d5; -} - -.verb-wrapper.verb-upsell-active.dragging { - background-color: #fff; - border: 3px solid #d5d5d5; -} - -.verb-upsell-column { - flex: 1; - padding: 0 12px; -} - -.verb-upsell-social-container { - flex: 1; - display: flex; - justify-content: center; - align-items: center; -} From 2ee5d63ddad6b8ccecc8b78c176ef7bf6a59ad77 Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Mon, 13 Jan 2025 13:46:58 -0300 Subject: [PATCH 13/19] Flex direction & padding --- acrobat/blocks/verb-widget/verb-widget.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index 44580e83..5ab6e132 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -303,7 +303,8 @@ padding: 24px 29px; border: 3px dashed #d5d5d5; border-radius: 8px; - min-height: calc(100vh - (63px + 32px + 115px + 48px)); + min-height: calc(100vh - (63px + 32px + 115px + 48px + 7px)); + justify-content: flex-start; } .verb-row { From b9434b5cd35576317a5d8de75dca5db2a352ff4f Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Mon, 13 Jan 2025 18:22:05 -0300 Subject: [PATCH 14/19] Verb widget analytics --- acrobat/blocks/verb-widget/verb-widget.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index c1d4889a..885bad77 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -228,6 +228,10 @@ export default async function init(element) { }); button.addEventListener('click', () => { + if (VERB === 'compress-pdf') { + verbAnalytics('entry:clicked', VERB); + verbAnalytics('discover:clicked', VERB); + } verbAnalytics('filepicker:shown', VERB); verbAnalytics('dropzone:choose-file-clicked', VERB); }); @@ -263,6 +267,10 @@ export default async function init(element) { }, drop: () => { verbAnalytics('files-dropped', VERB, data); + if (VERB === 'compress-pdf') { + verbAnalytics('entry:clicked', VERB, data); + verbAnalytics('discover:clicked', VERB, data); + } setDraggingClass(widget, false); setUser(); }, @@ -272,6 +280,9 @@ export default async function init(element) { }, uploading: () => { verbAnalytics('job:uploading', VERB, data); + if (VERB === 'compress-pdf') { + verbAnalytics('job:multi-file-uploading', VERB, data); + } setUser(); document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`; window.addEventListener('beforeunload', handleExit); From 57c81802fe104796abaf9b2e29a637976bf1f75d Mon Sep 17 00:00:00 2001 From: James Tsay Date: Mon, 13 Jan 2025 14:02:28 -0800 Subject: [PATCH 15/19] Fix color --- acrobat/blocks/verb-widget/verb-widget.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index 96e52591..165bb135 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -279,7 +279,7 @@ } .verb-upsell { - color: rgb(34, 34, 34); + color: #222; display: flex; flex-direction: column; width: 774.75px; From 1428b2ad960ca7a96cd2a1205e69c45fbe89cb0c Mon Sep 17 00:00:00 2001 From: vgoodric Date: Mon, 13 Jan 2025 17:40:31 -0700 Subject: [PATCH 16/19] add learn folder --- acrobat/scripts/scripts.js | 1 + 1 file changed, 1 insertion(+) diff --git a/acrobat/scripts/scripts.js b/acrobat/scripts/scripts.js index 29627cde..e96241e4 100644 --- a/acrobat/scripts/scripts.js +++ b/acrobat/scripts/scripts.js @@ -333,6 +333,7 @@ const CONFIG = { htmlExclude: [ /www\.adobe\.com\/(\w\w(_\w\w)?\/)?express(\/.*)?/, /www\.adobe\.com\/(\w\w(_\w\w)?\/)?go(\/.*)?/, + /www\.adobe\.com\/(\w\w(_\w\w)?\/)?learn(\/.*)?/, ], imsScope: 'AdobeID,openid,gnav,pps.read,firefly_api,additional_info.roles,read_organizations', }; From 9aa7fe4c19edd39ff432cba4958a3f68f6fc642d Mon Sep 17 00:00:00 2001 From: James Tsay Date: Mon, 13 Jan 2025 17:29:56 -0800 Subject: [PATCH 17/19] Fix for signed in user --- acrobat/blocks/verb-widget/verb-widget.css | 12 ++++++++++++ acrobat/blocks/verb-widget/verb-widget.js | 19 ++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.css b/acrobat/blocks/verb-widget/verb-widget.css index cd1a1106..18628166 100644 --- a/acrobat/blocks/verb-widget/verb-widget.css +++ b/acrobat/blocks/verb-widget/verb-widget.css @@ -80,6 +80,18 @@ display: none; } +.verb-widget.signed-in .verb-upsell-active { + display: none; +} + +.verb-widget.upsell .verb-footer { + display: none; +} + +.verb-widget.upsell #drop-zone { + display: none; +} + .verb-footer a { text-decoration: underline; } diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index cb0f56d4..3e111fad 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -111,7 +111,8 @@ async function showUpSell(verb, element) { widget.append(widgetContainer); widgetContainer.append(upsell); - element.replaceChildren(widget); + element.classList.add('upsell'); + element.append(widget); } export default async function init(element) { @@ -236,6 +237,7 @@ export default async function init(element) { function checkSignedInUser() { if (window.adobeIMS?.isSignedInUser?.()) { + element.classList.remove('upsell'); element.classList.add('signed-in'); if (window.adobeIMS.getAccountType() !== 'type1') { redDir(VERB); @@ -243,6 +245,13 @@ export default async function init(element) { } } + if (LIMITS[VERB].trial) { + const count = parseInt(localStorage.getItem(`${VERB}_trial`), 10); + if (count >= LIMITS[VERB].trial) { + await showUpSell(VERB, element); + } + } + // Race the condition checkSignedInUser(); @@ -252,14 +261,6 @@ export default async function init(element) { // Analytics verbAnalytics('landing:shown', VERB); - if (LIMITS[VERB].trial) { - const count = parseInt(localStorage.getItem(`${VERB}_trial`), 10); - if (count >= LIMITS[VERB].trial) { - showUpSell(VERB, element); - return; - } - } - window.prefetchInitiated = false; widgetMobileButton.addEventListener('click', () => { From e8fe71e4be7d42e77cbcd11679f55d057d983b1d Mon Sep 17 00:00:00 2001 From: James Tsay Date: Mon, 13 Jan 2025 20:19:10 -0800 Subject: [PATCH 18/19] Skip trial count if signed in --- acrobat/blocks/verb-widget/verb-widget.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 3e111fad..3b699d49 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -326,10 +326,12 @@ export default async function init(element) { }, uploading: () => { if (LIMITS[VERB].trial) { - const key = `${VERB}_trial`; - const stored = localStorage.getItem(key); - const count = parseInt(stored, 10); - localStorage.setItem(key, count + 1 || 1); + if (!window.adobeIMS?.isSignedInUser?.()) { + const key = `${VERB}_trial`; + const stored = localStorage.getItem(key); + const count = parseInt(stored, 10); + localStorage.setItem(key, count + 1 || 1); + } } verbAnalytics('job:uploading', VERB, data); if (VERB === 'compress-pdf') { From aaeb2955d79490c86756f0f3dfa2ba2d88e4db90 Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Tue, 14 Jan 2025 10:25:28 -0300 Subject: [PATCH 19/19] Compress legacy analytics events fix to be dispatched --- acrobat/blocks/verb-widget/verb-widget.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 3b699d49..02a7b3e9 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -272,10 +272,10 @@ export default async function init(element) { if (!mobileLink) { button.click(); } }); - button.addEventListener('click', () => { + button.addEventListener('click', (data) => { if (VERB === 'compress-pdf') { - verbAnalytics('entry:clicked', VERB); - verbAnalytics('discover:clicked', VERB); + verbAnalytics('entry:clicked', VERB, data, false); + verbAnalytics('discover:clicked', VERB, data, false); } verbAnalytics('filepicker:shown', VERB); verbAnalytics('dropzone:choose-file-clicked', VERB); @@ -312,10 +312,10 @@ export default async function init(element) { setUser(); }, drop: () => { - verbAnalytics('files-dropped', VERB, data); + verbAnalytics('files-dropped', VERB, data, false); if (VERB === 'compress-pdf') { - verbAnalytics('entry:clicked', VERB, data); - verbAnalytics('discover:clicked', VERB, data); + verbAnalytics('entry:clicked', VERB, data, false); + verbAnalytics('discover:clicked', VERB, data, false); } setDraggingClass(widget, false); setUser(); @@ -333,9 +333,9 @@ export default async function init(element) { localStorage.setItem(key, count + 1 || 1); } } - verbAnalytics('job:uploading', VERB, data); + verbAnalytics('job:uploading', VERB, data, false); if (VERB === 'compress-pdf') { - verbAnalytics('job:multi-file-uploading', VERB, data); + verbAnalytics('job:multi-file-uploading', VERB, data, false); } setUser(); document.cookie = `UTS_Uploading=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`;