Add the basic telemetry for Organize feature (bug 2022481)

This commit is contained in:
Calixte Denizet 2026-03-20 14:33:55 +01:00
parent ff1af5a058
commit 008181a43e
No known key found for this signature in database
GPG Key ID: 0C5442631EE0691F
2 changed files with 20 additions and 0 deletions

View File

@ -1334,6 +1334,10 @@ const PDFViewerApplication = {
classList.add("wait");
if (this.pdfThumbnailViewer?.hasStructuralChanges()) {
this.externalServices.reportTelemetry({
type: "pageOrganization",
data: { action: "save" },
});
await this.onSavePages({
data: this.pdfThumbnailViewer.getStructuralChanges(),
});

View File

@ -709,6 +709,7 @@ class PDFThumbnailViewer {
this.#toggleMenuEntries(false);
this.#updateStatus("select");
this.#reportTelemetry({ action: "move" });
this.eventBus.dispatch("pagesedited", {
source: this,
pagesMapper,
@ -825,7 +826,18 @@ class PDFThumbnailViewer {
}
}
#reportTelemetry(data) {
this.eventBus.dispatch("reporttelemetry", {
source: this,
details: {
type: "pageOrganization",
data,
},
});
}
#saveExtractedPages() {
this.#reportTelemetry({ action: "exportSelected" });
this.eventBus.dispatch("saveextractedpages", {
source: this,
data: this.#pagesMapper.extractPages(this.#selectedPages),
@ -840,6 +852,7 @@ class PDFThumbnailViewer {
// that clicking the "Done" button later only cancels the copy and does
// not accidentally restore a previous paste or delete.
this.#savedThumbnails = null;
this.#reportTelemetry({ action: "copy" });
}
this.#updateStatus(this.#isCut ? "cut" : "copy");
const pageNumbersToCopy = (this.#copiedPageNumbers = Uint32Array.from(
@ -869,12 +882,14 @@ class PDFThumbnailViewer {
return;
}
this.#reportTelemetry({ action: "cut" });
this.#isCut = true;
this.#copyPages(false);
this.#deletePages(/* type = */ "cut");
}
#pastePages(index) {
this.#reportTelemetry({ action: "paste" });
const pagesMapper = this.#pagesMapper;
const currentPageNumber = this.#copiedPageNumbers.includes(
this._currentPageNumber
@ -907,6 +922,7 @@ class PDFThumbnailViewer {
const selectedPages = this.#selectedPages;
if (type === "delete") {
this.#reportTelemetry({ action: "delete" });
this.#updateStatus("delete");
}
const pagesMapper = this.#pagesMapper;