asap-viewer 12.6.20 → 12.6.21

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.
Files changed (43) hide show
  1. package/asap-viewer.d.ts +1 -0
  2. package/asap-viewer.metadata.json +1 -1
  3. package/bundles/asap-viewer.umd.js +4842 -2792
  4. package/bundles/asap-viewer.umd.js.map +1 -1
  5. package/bundles/asap-viewer.umd.min.js +1 -1
  6. package/bundles/asap-viewer.umd.min.js.map +1 -1
  7. package/esm2015/asap-viewer.js +3 -2
  8. package/esm2015/lib/@core/interceptors/offline.interceptor.js +119 -0
  9. package/esm2015/lib/@core/pipes/vimeo-embed.pipe.js +16 -4
  10. package/esm2015/lib/@core/services/offline-storage.service.js +750 -0
  11. package/esm2015/lib/@core/services/trail-content.service.js +8 -2
  12. package/esm2015/lib/asap-viewer.module.js +14 -2
  13. package/esm2015/lib/editor/components/video/video.component.js +311 -78
  14. package/esm2015/lib/visualizador/curso-visualizador/curso-navbar/curso-navbar.component.js +73 -4
  15. package/esm2015/lib/visualizador/curso-visualizador/curso-visualizador.component.js +101 -15
  16. package/esm2015/lib/visualizador/curso-visualizador/viewer/viewer.component.js +124 -41
  17. package/esm2015/lib/visualizador/offline-manager/offline-manager.component.js +357 -0
  18. package/esm2015/public_api.js +3 -1
  19. package/esm5/asap-viewer.js +3 -2
  20. package/esm5/lib/@core/interceptors/offline.interceptor.js +130 -0
  21. package/esm5/lib/@core/pipes/vimeo-embed.pipe.js +16 -4
  22. package/esm5/lib/@core/services/offline-storage.service.js +912 -0
  23. package/esm5/lib/@core/services/trail-content.service.js +8 -2
  24. package/esm5/lib/asap-viewer.module.js +14 -2
  25. package/esm5/lib/editor/components/video/video.component.js +351 -78
  26. package/esm5/lib/visualizador/curso-visualizador/curso-navbar/curso-navbar.component.js +75 -4
  27. package/esm5/lib/visualizador/curso-visualizador/curso-visualizador.component.js +115 -15
  28. package/esm5/lib/visualizador/curso-visualizador/viewer/viewer.component.js +163 -55
  29. package/esm5/lib/visualizador/offline-manager/offline-manager.component.js +455 -0
  30. package/esm5/public_api.js +3 -1
  31. package/fesm2015/asap-viewer.js +2119 -420
  32. package/fesm2015/asap-viewer.js.map +1 -1
  33. package/fesm5/asap-viewer.js +4841 -2793
  34. package/fesm5/asap-viewer.js.map +1 -1
  35. package/lib/@core/interceptors/offline.interceptor.d.ts +9 -0
  36. package/lib/@core/services/offline-storage.service.d.ts +75 -0
  37. package/lib/editor/components/video/video.component.d.ts +16 -4
  38. package/lib/visualizador/curso-visualizador/curso-navbar/curso-navbar.component.d.ts +8 -1
  39. package/lib/visualizador/curso-visualizador/curso-visualizador.component.d.ts +4 -1
  40. package/lib/visualizador/curso-visualizador/viewer/viewer.component.d.ts +8 -4
  41. package/lib/visualizador/offline-manager/offline-manager.component.d.ts +41 -0
  42. package/package.json +1 -1
  43. package/public_api.d.ts +2 -0
@@ -0,0 +1,9 @@
1
+ import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { OfflineStorageService } from '../services/offline-storage.service';
4
+ export declare class OfflineHttpInterceptor implements HttpInterceptor {
5
+ private offlineService;
6
+ constructor(offlineService: OfflineStorageService);
7
+ intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
8
+ private handleOfflineFallback;
9
+ }
@@ -0,0 +1,75 @@
1
+ import { BehaviorSubject, Observable } from 'rxjs';
2
+ export interface DownloadedLesson {
3
+ id: string | number;
4
+ trailId: string | number;
5
+ title: string;
6
+ subtitle?: string;
7
+ thumbnail?: string;
8
+ sizeBytes: number;
9
+ sizeFormatted: string;
10
+ downloadedAt: Date;
11
+ stageData: any;
12
+ stages: any[];
13
+ videoBlob?: Blob;
14
+ videoMimeType?: string;
15
+ }
16
+ export interface SyncAction {
17
+ id?: number;
18
+ type: 'stage_progress' | 'video_progress' | 'notes';
19
+ endpoint: string;
20
+ payload: any;
21
+ createdAt: Date;
22
+ }
23
+ export interface DownloadProgress {
24
+ stageId: string | number;
25
+ progress: number;
26
+ loaded: number;
27
+ total: number;
28
+ status: 'downloading' | 'completed' | 'error' | 'idle';
29
+ }
30
+ export declare class OfflineStorageService {
31
+ private readonly DB_NAME;
32
+ private readonly DB_VERSION;
33
+ private readonly STORE_LESSONS;
34
+ private readonly STORE_SYNC_QUEUE;
35
+ private db;
36
+ private isOnlineSubject;
37
+ isOnline$: Observable<boolean>;
38
+ downloadProgress$: BehaviorSubject<{
39
+ [key: string]: DownloadProgress;
40
+ }>;
41
+ downloadedLessons$: BehaviorSubject<DownloadedLesson[]>;
42
+ constructor();
43
+ private initNetworkListeners;
44
+ private initDatabase;
45
+ downloadLesson(lessonData: {
46
+ id: string | number;
47
+ trailId: string | number;
48
+ title: string;
49
+ subtitle?: string;
50
+ thumbnail?: string;
51
+ videoUrl?: string;
52
+ stageData: any;
53
+ stages: any[];
54
+ }): Promise<DownloadedLesson>;
55
+ private fetchBlobWithProgress;
56
+ private updateProgress;
57
+ isLessonDownloaded(lessonId: string | number): Promise<boolean>;
58
+ getDownloadedLesson(lessonId: string | number): Promise<DownloadedLesson | null>;
59
+ getOfflineVideoUrl(lessonId: string | number): Promise<string | null>;
60
+ getAllDownloadedLessons(): Promise<DownloadedLesson[]>;
61
+ refreshDownloadedLessons(): Promise<void>;
62
+ deleteDownloadedLesson(lessonId: string | number): Promise<boolean>;
63
+ clearAllDownloads(): Promise<boolean>;
64
+ queueSyncAction(action: {
65
+ type: 'stage_progress' | 'video_progress' | 'notes';
66
+ endpoint: string;
67
+ payload: any;
68
+ }): Promise<void>;
69
+ processSyncQueue(): Promise<number>;
70
+ formatBytes(bytes: number, decimals?: number): string;
71
+ getTotalStorageUsed(lessons: DownloadedLesson[]): {
72
+ totalBytes: number;
73
+ formatted: string;
74
+ };
75
+ }
@@ -1,9 +1,12 @@
1
- import { EventEmitter, OnInit, OnDestroy } from '@angular/core';
1
+ import { EventEmitter, OnInit, OnDestroy, OnChanges, SimpleChanges, ChangeDetectorRef } from '@angular/core';
2
2
  import { DomSanitizer } from '@angular/platform-browser';
3
3
  import { TrailContentService } from '../../../@core/services/trail-content.service';
4
- export declare class VideoComponent implements OnInit, OnDestroy {
4
+ import { OfflineStorageService } from '../../../@core/services/offline-storage.service';
5
+ export declare class VideoComponent implements OnInit, OnDestroy, OnChanges {
5
6
  private sanitizer;
6
7
  _trailContentService: TrailContentService;
8
+ offlineService: OfflineStorageService;
9
+ private cdr;
7
10
  item: any;
8
11
  id: number;
9
12
  content: any;
@@ -16,6 +19,8 @@ export declare class VideoComponent implements OnInit, OnDestroy {
16
19
  notes: string;
17
20
  currentTime: number;
18
21
  seconds: number;
22
+ offlineUrl: string | null;
23
+ isOnline: boolean;
19
24
  player: any;
20
25
  videoMonitor: any;
21
26
  playerStatus: any;
@@ -23,7 +28,14 @@ export declare class VideoComponent implements OnInit, OnDestroy {
23
28
  timeLapse: number;
24
29
  timeLapseTimer: any;
25
30
  disableNextButton: boolean;
26
- constructor(sanitizer: DomSanitizer, _trailContentService: TrailContentService);
31
+ constructor(sanitizer: DomSanitizer, _trailContentService: TrailContentService, offlineService: OfflineStorageService, cdr: ChangeDetectorRef);
32
+ isAllowNext(): boolean;
33
+ ngOnChanges(changes: SimpleChanges): void;
34
+ loadOfflineVideo(): Promise<void>;
35
+ loadVimeoSdk(): Promise<any>;
36
+ isVimeoSource(): boolean;
37
+ initVimeoPlayer(): Promise<void>;
38
+ private initOnlinePlayer;
27
39
  loadYT(): any;
28
40
  ngOnInit(): void;
29
41
  ngOnDestroy(): void;
@@ -36,5 +48,5 @@ export declare class VideoComponent implements OnInit, OnDestroy {
36
48
  goPlay(): void;
37
49
  getYoutubeID(url: any): string;
38
50
  youtubeParserID(url: any): any;
39
- getVimeoID(url: any): string;
51
+ getVimeoID(url: any): any;
40
52
  }
@@ -4,6 +4,8 @@ import { Location } from '@angular/common';
4
4
  import { AmbienteVirtualService } from '../../../@core/services/ambiente-virtual.service';
5
5
  import { Global } from 'asap-crud';
6
6
  import { Trailv2Service } from '../../../@core/services/trailv2.service';
7
+ import { MatDialog } from '@angular/material/dialog';
8
+ import { OfflineStorageService } from '../../../@core/services/offline-storage.service';
7
9
  export declare class CursoNavbarComponent implements OnInit {
8
10
  private renderer;
9
11
  private element;
@@ -12,6 +14,8 @@ export declare class CursoNavbarComponent implements OnInit {
12
14
  private global;
13
15
  private trailService;
14
16
  private route;
17
+ private dialog;
18
+ offlineService: OfflineStorageService;
15
19
  location: Location;
16
20
  platform: string;
17
21
  urlEscola: string;
@@ -22,6 +26,8 @@ export declare class CursoNavbarComponent implements OnInit {
22
26
  sub_etapa: any;
23
27
  sub_etapa_id: any;
24
28
  indexes: any;
29
+ downloadedCount: number;
30
+ isOnline: boolean;
25
31
  eventNavbar: EventEmitter<any>;
26
32
  event: EventEmitter<any>;
27
33
  checkIfAllHaveDoneVar: boolean;
@@ -29,7 +35,7 @@ export declare class CursoNavbarComponent implements OnInit {
29
35
  origemUrl: any;
30
36
  referenceUrl: any;
31
37
  button: any;
32
- constructor(location: Location, renderer: Renderer2, element: ElementRef, ambienteVirtualService: AmbienteVirtualService, _router: Router, global: Global, trailService: Trailv2Service, route: ActivatedRoute);
38
+ constructor(location: Location, renderer: Renderer2, element: ElementRef, ambienteVirtualService: AmbienteVirtualService, _router: Router, global: Global, trailService: Trailv2Service, route: ActivatedRoute, dialog: MatDialog, offlineService: OfflineStorageService);
33
39
  setIndexes(data: any, current: any): void;
34
40
  getUrlEscola(): string | false;
35
41
  ngOnChanges(sub_etapa_id: any): void;
@@ -39,5 +45,6 @@ export declare class CursoNavbarComponent implements OnInit {
39
45
  toSeoUrl(url: any): any;
40
46
  back(): void;
41
47
  backUrl(): void;
48
+ openOfflineManager(): void;
42
49
  menuNavigate(obj: any): void;
43
50
  }
@@ -6,6 +6,7 @@ import { AmbienteVirtualService } from '../../@core/services/ambiente-virtual.se
6
6
  import { bannerService } from '../../@core/services/banner.service';
7
7
  import { Global } from 'asap-crud';
8
8
  import { Location } from '@angular/common';
9
+ import { OfflineStorageService } from '../../@core/services/offline-storage.service';
9
10
  export declare class CursoVisualizadorComponent implements OnInit {
10
11
  private ambienteVirtualService;
11
12
  private activatedRoute;
@@ -15,6 +16,7 @@ export declare class CursoVisualizadorComponent implements OnInit {
15
16
  dialog: MatDialog;
16
17
  global: Global;
17
18
  private location;
19
+ offlineService: OfflineStorageService;
18
20
  id: number;
19
21
  loader: boolean;
20
22
  bannerArray: any;
@@ -29,10 +31,11 @@ export declare class CursoVisualizadorComponent implements OnInit {
29
31
  name_etapa: any;
30
32
  activeSubetapa: any;
31
33
  acesso_jornada: any;
32
- constructor(ambienteVirtualService: AmbienteVirtualService, activatedRoute: ActivatedRoute, router: Router, _bannerService: bannerService, trailService: Trailv2Service, dialog: MatDialog, global: Global, location: Location);
34
+ constructor(ambienteVirtualService: AmbienteVirtualService, activatedRoute: ActivatedRoute, router: Router, _bannerService: bannerService, trailService: Trailv2Service, dialog: MatDialog, global: Global, location: Location, offlineService: OfflineStorageService);
33
35
  ngOnInit(): void;
34
36
  readonly themeConfig: any;
35
37
  private getParams;
38
+ loadOfflineModule(id: any): Promise<void>;
36
39
  getData(): void;
37
40
  verificaBanner(): void;
38
41
  openDialog(data: any): void;
@@ -1,17 +1,20 @@
1
- import { OnInit, EventEmitter } from '@angular/core';
1
+ import { OnInit, EventEmitter, OnChanges, SimpleChanges, ChangeDetectorRef } from '@angular/core';
2
2
  import { DomSanitizer } from '@angular/platform-browser';
3
3
  import { MatDialog } from '@angular/material/dialog';
4
4
  import { VimeoService } from '../../../@core/services/vimeo.service';
5
5
  import { AmbienteVirtualService } from '../../../@core/services/ambiente-virtual.service';
6
6
  import { Global } from 'asap-crud';
7
7
  import { TrailContentService } from '../../../@core/services/trail-content.service';
8
- export declare class ViewerComponent implements OnInit {
8
+ import { OfflineStorageService } from '../../../@core/services/offline-storage.service';
9
+ export declare class ViewerComponent implements OnInit, OnChanges {
9
10
  private _ambienteVirtualService;
10
11
  private _sanitizer;
11
12
  private _vimeoService;
12
13
  dialog: MatDialog;
13
14
  global: Global;
14
15
  trailContentService: TrailContentService;
16
+ offlineService: OfflineStorageService;
17
+ private cdr;
15
18
  module: any;
16
19
  step: any;
17
20
  id: any;
@@ -28,12 +31,13 @@ export declare class ViewerComponent implements OnInit {
28
31
  ratingOpened: boolean;
29
32
  componentArray: Array<any>;
30
33
  loader: boolean;
31
- constructor(_ambienteVirtualService: AmbienteVirtualService, _sanitizer: DomSanitizer, _vimeoService: VimeoService, dialog: MatDialog, global: Global, trailContentService: TrailContentService);
34
+ constructor(_ambienteVirtualService: AmbienteVirtualService, _sanitizer: DomSanitizer, _vimeoService: VimeoService, dialog: MatDialog, global: Global, trailContentService: TrailContentService, offlineService: OfflineStorageService, cdr: ChangeDetectorRef);
35
+ ngOnChanges(changes: SimpleChanges): void;
32
36
  ngOnInit(): void;
33
37
  private sanitizer;
34
38
  getYoutubeID(url: string): string;
35
39
  getVimeoID(url: string): string;
36
- getContent(step: number): void;
40
+ getContent(step: number): Promise<void>;
37
41
  readonly hasVideo: boolean;
38
42
  resetVideoUpdater(): void;
39
43
  updateVideoTime(event: any): void;
@@ -0,0 +1,41 @@
1
+ import { OnInit, OnDestroy, EventEmitter } from '@angular/core';
2
+ import { MatDialogRef } from '@angular/material/dialog';
3
+ import { OfflineStorageService, DownloadedLesson, DownloadProgress } from '../../@core/services/offline-storage.service';
4
+ import { AmbienteVirtualService } from '../../@core/services/ambiente-virtual.service';
5
+ export declare class OfflineManagerModalComponent implements OnInit, OnDestroy {
6
+ offlineService: OfflineStorageService;
7
+ ambienteVirtualService: AmbienteVirtualService;
8
+ dialogRef: MatDialogRef<OfflineManagerModalComponent>;
9
+ data: any;
10
+ currentEtapa: any;
11
+ currentStageData: any;
12
+ currentMenuItems: any[];
13
+ selectOfflineLesson: EventEmitter<DownloadedLesson>;
14
+ isOnline: boolean;
15
+ downloadedLessons: DownloadedLesson[];
16
+ totalStorageUsed: string;
17
+ currentProgress: DownloadProgress | null;
18
+ isCurrentLessonDownloaded: boolean;
19
+ isDownloading: boolean;
20
+ batchStatus: {
21
+ current: number;
22
+ total: number;
23
+ currentLessonName: string;
24
+ overallProgress: number;
25
+ };
26
+ private subscriptions;
27
+ constructor(offlineService: OfflineStorageService, ambienteVirtualService: AmbienteVirtualService, dialogRef: MatDialogRef<OfflineManagerModalComponent>, data: any);
28
+ ngOnInit(): void;
29
+ ngOnDestroy(): void;
30
+ checkIfCurrentLessonIsDownloaded(): Promise<void>;
31
+ /**
32
+ * Baixa TODAS as aulas deste módulo em lote
33
+ */
34
+ downloadAllModuleLessons(): Promise<void>;
35
+ downloadCurrentLesson(): Promise<void>;
36
+ deleteLesson(lesson: DownloadedLesson, event?: MouseEvent): Promise<void>;
37
+ clearAll(): Promise<void>;
38
+ openLesson(lesson: DownloadedLesson): void;
39
+ closeModal(): void;
40
+ triggerManualSync(): Promise<void>;
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asap-viewer",
3
- "version": "12.6.20",
3
+ "version": "12.6.21",
4
4
  "main": "bundles/asap-viewer.umd.js",
5
5
  "module": "fesm5/asap-viewer.js",
6
6
  "es2015": "fesm2015/asap-viewer.js",
package/public_api.d.ts CHANGED
@@ -2,3 +2,5 @@ export * from './lib/asap-viewer.component';
2
2
  export * from './lib/asap-viewer.module';
3
3
  export * from './lib/asap-viewer.service';
4
4
  export * from './lib/asap-viewer.routing';
5
+ export * from './lib/@core/services/offline-storage.service';
6
+ export * from './lib/visualizador/offline-manager/offline-manager.component';