Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-164339: Send test-uploaded thru done #926

Merged
merged 2 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
Loading