@fluid-topics/ft-reader-attachments 2.0.31 → 2.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,7 +3,18 @@ import { ElementDefinitionsMap } from "@fluid-topics/ft-wc-utils";
|
|
|
3
3
|
import { FtReaderAttachmentsProperties } from "./ft-reader-attachments.properties";
|
|
4
4
|
import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
|
|
5
5
|
import { FtMap, FtMapAttachment } from "@fluid-topics/public-api";
|
|
6
|
-
declare const FtReaderAttachments_base: typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface
|
|
6
|
+
declare const FtReaderAttachments_base: import("@fluid-topics/ft-wc-utils").withAnalyticsType<typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>, {
|
|
7
|
+
"attachment-viewed": {
|
|
8
|
+
label: string;
|
|
9
|
+
defaultEventName: string;
|
|
10
|
+
defaultComponentId: string;
|
|
11
|
+
};
|
|
12
|
+
"attachment-downloaded": {
|
|
13
|
+
label: string;
|
|
14
|
+
defaultEventName: string;
|
|
15
|
+
defaultComponentId: string;
|
|
16
|
+
};
|
|
17
|
+
}>;
|
|
7
18
|
export declare class FtReaderAttachments extends FtReaderAttachments_base implements FtReaderAttachmentsProperties {
|
|
8
19
|
static elementDefinitions: ElementDefinitionsMap;
|
|
9
20
|
static styles: import("lit").CSSResult;
|
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
8
|
import { property, state } from "lit/decorators.js";
|
|
9
|
-
import { last, redux, reduxEventListener } from "@fluid-topics/ft-wc-utils";
|
|
9
|
+
import { last, redux, reduxEventListener, withAnalytics, } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { styles } from "./ft-reader-attachments.styles";
|
|
11
11
|
import { FtReaderComponent, FtReaderStoreEvents } from "@fluid-topics/ft-reader-context/build/registration";
|
|
12
12
|
import { repeat } from "lit/directives/repeat.js";
|
|
@@ -16,7 +16,19 @@ import { FtTypography } from "@fluid-topics/ft-typography";
|
|
|
16
16
|
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
17
17
|
import { classMap } from "lit/directives/class-map.js";
|
|
18
18
|
import { FtRipple } from "@fluid-topics/ft-ripple";
|
|
19
|
-
|
|
19
|
+
const analyticsActions = {
|
|
20
|
+
"attachment-viewed": {
|
|
21
|
+
label: "Opening attachment",
|
|
22
|
+
defaultEventName: "attachment-open",
|
|
23
|
+
defaultComponentId: "ft-reader-attachments",
|
|
24
|
+
},
|
|
25
|
+
"attachment-downloaded": {
|
|
26
|
+
label: "Downloading attachment",
|
|
27
|
+
defaultEventName: "attachment-download",
|
|
28
|
+
defaultComponentId: "ft-reader-attachments",
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export class FtReaderAttachments extends withAnalytics(withI18n(FtReaderComponent), analyticsActions) {
|
|
20
32
|
constructor() {
|
|
21
33
|
super();
|
|
22
34
|
this.hideFileFormatIcon = false;
|
|
@@ -41,7 +53,8 @@ export class FtReaderAttachments extends withI18n(FtReaderComponent) {
|
|
|
41
53
|
return html `
|
|
42
54
|
<div part="attachment">
|
|
43
55
|
<a part="viewer-link" href="${url}"
|
|
44
|
-
aria-label="${this.getAttachmentAriaLabel(attachment)}"
|
|
56
|
+
aria-label="${this.getAttachmentAriaLabel(attachment)}"
|
|
57
|
+
@click=${() => this.emitAnalyticsAction("attachment-viewed", { name: attachment.name })}>
|
|
45
58
|
<ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
|
|
46
59
|
<ft-icon part="file-format-icon"
|
|
47
60
|
variant="file-format"
|
|
@@ -54,7 +67,9 @@ export class FtReaderAttachments extends withI18n(FtReaderComponent) {
|
|
|
54
67
|
: html `
|
|
55
68
|
<a part="download-link"
|
|
56
69
|
href="${(_d = this.service) === null || _d === void 0 ? void 0 : _d.getAttachmentDownloadLink(attachment.id)}"
|
|
57
|
-
|
|
70
|
+
target="_blank"
|
|
71
|
+
aria-label="${attachmentsMessages.messages.download(this.getAttachmentAriaLabel(attachment))}"
|
|
72
|
+
@click=${() => this.emitAnalyticsAction("attachment-downloaded", { name: attachment.name })}>
|
|
58
73
|
<ft-ripple part="ripple download-link-ripple"></ft-ripple>
|
|
59
74
|
<ft-icon part="download-icon">DOWNLOAD</ft-icon>
|
|
60
75
|
</a>
|