Skip to content

Commit

Permalink
Merge pull request #926 from adobecom/MWPW-164339
Browse files Browse the repository at this point in the history
MWPW-164339: Send test-uploaded thru done
  • Loading branch information
TsayAdobe authored Dec 23, 2024
2 parents 75ad33f + 722e513 commit bc73821
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion acrobat/blocks/verb-widget/verb-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ export default async function init(element) {
}

if (e.detail?.event === 'uploaded') {
verbAnalytics('job:test-uploaded', VERB, e.detail?.data);
verbAnalytics('job:test-uploaded', VERB, e.detail?.data, false);
exitFlag = true;
setUser();
document.cookie = `UTS_Uploaded=${Date.now()};domain=.adobe.com;path=/;expires=${cookieExp}`;
Expand Down
33 changes: 21 additions & 12 deletions acrobat/scripts/alloy/verb-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if (params.dropzone2) {
appTags.push('dropzone2');
}

export default function init(eventName, verb, metaData) {
export default function init(eventName, verb, metaData, documentUnloading = true) {
function getSessionID() {
const aToken = window.adobeIMS.getAccessToken();
const arrayToken = aToken?.token.split('.');
Expand All @@ -33,7 +33,25 @@ export default function init(eventName, verb, metaData) {
return tokenPayload.sub || tokenPayload.user_id;
}
const event = {
documentUnloading: true,
documentUnloading,
// eslint-disable-next-line
done: function (AJOPropositionResult, error) {
if (!documentUnloading) {
const accountType = window?.adobeIMS?.getAccountType();
const verbEvent = `acrobat:verb-${verb}:${eventName}`;
if (error) {
window.lana?.log(
`Error Code: ${error}, Status: 'Unknown', Message: An error occurred while sending ${verbEvent}, Account Type: ${accountType}`,
{ sampleRate: 100, tags: 'DC_Milo,Project Unity (DC)' },
);
} else {
window.lana?.log(
`Message: Event ${verbEvent} has been sent successfully, Account Type: ${accountType}`,
{ sampleRate: 100, tags: 'DC_Milo,Project Unity (DC)' },
);
}
}
},
data: {
eventType: 'web.webinteraction.linkClicks',
web: {
Expand Down Expand Up @@ -104,15 +122,6 @@ export default function init(eventName, verb, metaData) {
},
},
};

// Alloy Ready...
const AlloyReady = setInterval(() => {
// eslint-disable-next-line no-underscore-dangle
if (window?._satellite?.track) {
clearInterval(AlloyReady);
// eslint-disable-next-line no-underscore-dangle
window._satellite?.track('event', event);
}
}, 1000);
// eslint-disable-next-line no-underscore-dangle
window._satellite?.track?.('event', event);
}

0 comments on commit bc73821

Please sign in to comment.