@d-i-t-a/reader 2.2.0-beta.5 → 2.2.0
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.
- package/dist/esm/index.js +423 -245
- package/dist/esm/index.js.map +3 -3
- package/dist/injectables/click/click.js +1 -1
- package/dist/injectables/click/click.js.map +1 -1
- package/dist/reader.css.map +1 -1
- package/dist/reader.js +65732 -79
- package/dist/reader.js.map +3 -3
- package/dist/types/modules/consumption/ConsumptionModule.d.ts +56 -0
- package/dist/types/navigator/IFrameNavigator.d.ts +4 -0
- package/dist/types/reader.d.ts +1 -0
- package/dist/types/store/Annotator.d.ts +1 -0
- package/dist/types/store/LocalAnnotator.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ReaderModule } from "../ReaderModule";
|
|
2
|
+
import { Publication } from "../../model/Publication";
|
|
3
|
+
import { IFrameNavigator } from "../../navigator/IFrameNavigator";
|
|
4
|
+
import { Locator } from "../../model/Locator";
|
|
5
|
+
export declare enum Action {
|
|
6
|
+
BookmarkCreated = "BookmarkCreated",
|
|
7
|
+
HighlightCreated = "HighlightCreated"
|
|
8
|
+
}
|
|
9
|
+
export interface ConsumptionModuleAPI {
|
|
10
|
+
startResearchSession: any;
|
|
11
|
+
updateResearchSession: any;
|
|
12
|
+
endResearchSession: any;
|
|
13
|
+
idleSince: any;
|
|
14
|
+
actionTracked: any;
|
|
15
|
+
}
|
|
16
|
+
export interface ConsumptionModuleProperties {
|
|
17
|
+
enableTrackingSession?: boolean;
|
|
18
|
+
updateSessionInterval?: number;
|
|
19
|
+
enableTrackingActions?: boolean;
|
|
20
|
+
idleTimeout?: number;
|
|
21
|
+
responseTimeout?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ConsumptionModuleConfig extends ConsumptionModuleProperties {
|
|
24
|
+
publication: Publication;
|
|
25
|
+
delegate: IFrameNavigator;
|
|
26
|
+
properties?: ConsumptionModuleProperties;
|
|
27
|
+
api?: ConsumptionModuleAPI;
|
|
28
|
+
}
|
|
29
|
+
export declare class ConsumptionModule implements ReaderModule {
|
|
30
|
+
private delegate;
|
|
31
|
+
private publication;
|
|
32
|
+
private properties;
|
|
33
|
+
api?: ConsumptionModuleAPI;
|
|
34
|
+
startResearchTimer?: Date;
|
|
35
|
+
researchSessionId: any;
|
|
36
|
+
readingSessions: any[];
|
|
37
|
+
readingSessionsInterval: any;
|
|
38
|
+
startReadingTimer: Date;
|
|
39
|
+
firstReadingLocator: Locator;
|
|
40
|
+
lastReadingLocator: Locator;
|
|
41
|
+
private constructor();
|
|
42
|
+
static create(config: ConsumptionModuleConfig): Promise<ConsumptionModule>;
|
|
43
|
+
protected start(): Promise<void>;
|
|
44
|
+
stop(): Promise<void>;
|
|
45
|
+
initialize(): void;
|
|
46
|
+
trackAction(locator: Locator, action: Action): void;
|
|
47
|
+
startReadingSession(locator: Locator): void;
|
|
48
|
+
continueReadingSession(locator: Locator): void;
|
|
49
|
+
startResearchSession(): void;
|
|
50
|
+
updateResearchSession(): void;
|
|
51
|
+
endResearchSession(): void;
|
|
52
|
+
timer: any;
|
|
53
|
+
currSeconds: number;
|
|
54
|
+
startIdleTimer(): void;
|
|
55
|
+
resetTimer(): void;
|
|
56
|
+
}
|
|
@@ -20,6 +20,7 @@ import EventEmitter from "eventemitter3";
|
|
|
20
20
|
import LineFocusModule, { LineFocusModuleConfig } from "../modules/linefocus/LineFocusModule";
|
|
21
21
|
import { HistoryModule } from "../modules/history/HistoryModule";
|
|
22
22
|
import CitationModule, { CitationModuleConfig } from "../modules/citation/CitationModule";
|
|
23
|
+
import { ConsumptionModule, ConsumptionModuleConfig } from "../modules/consumption/ConsumptionModule";
|
|
23
24
|
export declare type GetContent = (href: string) => Promise<string>;
|
|
24
25
|
export declare type GetContentBytesLength = (href: string, requestConfig?: RequestConfig) => Promise<number>;
|
|
25
26
|
export interface RequestConfig extends RequestInit {
|
|
@@ -96,6 +97,7 @@ export interface ReaderRights {
|
|
|
96
97
|
customKeyboardEvents: boolean;
|
|
97
98
|
enableHistory: boolean;
|
|
98
99
|
enableCitations: boolean;
|
|
100
|
+
enableConsumption: boolean;
|
|
99
101
|
}
|
|
100
102
|
export interface ReaderUI {
|
|
101
103
|
settings: UserSettingsUIConfig;
|
|
@@ -118,6 +120,7 @@ export interface ReaderConfig {
|
|
|
118
120
|
bookmarks?: Partial<BookmarkModuleConfig>;
|
|
119
121
|
lineFocus?: Partial<LineFocusModuleConfig>;
|
|
120
122
|
citations?: Partial<CitationModuleConfig>;
|
|
123
|
+
consumption?: Partial<ConsumptionModuleConfig>;
|
|
121
124
|
highlighter?: Partial<TextHighlighterConfig>;
|
|
122
125
|
injectables: Array<Injectable>;
|
|
123
126
|
injectablesFixed?: Array<Injectable>;
|
|
@@ -147,6 +150,7 @@ export declare class IFrameNavigator extends EventEmitter implements Navigator {
|
|
|
147
150
|
lineFocusModule?: LineFocusModule;
|
|
148
151
|
historyModule?: HistoryModule;
|
|
149
152
|
citationModule?: CitationModule;
|
|
153
|
+
consumptionModule?: ConsumptionModule;
|
|
150
154
|
sideNavExpanded: boolean;
|
|
151
155
|
currentChapterLink: D2Link;
|
|
152
156
|
currentSpreadLinks: {
|
package/dist/types/reader.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface Annotator {
|
|
|
14
14
|
deleteAnnotation(id: any): any;
|
|
15
15
|
deleteSelectedAnnotation(annotation: any): any;
|
|
16
16
|
getAnnotations(): any;
|
|
17
|
+
getAnnotationsByChapter(chapter: string): any;
|
|
17
18
|
getAnnotation(annotation: IHighlight): any;
|
|
18
19
|
getAnnotationByID(id: string): any;
|
|
19
20
|
getAnnotationPosition(id: any, iframeWin: any): any;
|
|
@@ -29,6 +29,7 @@ export default class LocalAnnotator implements Annotator {
|
|
|
29
29
|
deleteAnnotation(id: any): any;
|
|
30
30
|
deleteSelectedAnnotation(annotation: any): any;
|
|
31
31
|
getAnnotations(): any;
|
|
32
|
+
getAnnotationsByChapter(chapter: string): any;
|
|
32
33
|
getAnnotationPosition(id: any, iframeWin: any): any;
|
|
33
34
|
getAnnotationElement(id: any, iframeWin: any): any;
|
|
34
35
|
getAnnotation(highlight: IHighlight): any;
|