@edifice.io/client 2.0.1-develop-hotfix.1736863177286 → 2.0.1

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.
@@ -1,32 +1,8 @@
1
- import { IMatomoTrackingParams, ITrackingParams, IXitiTrackingParams } from '../configure/interfaces';
2
1
  import { IOdeServices } from '../services/OdeServices';
3
2
  import { IWebApp } from '../session/interfaces';
4
- export type XitiConf = {
5
- ID_EXPLOITANT: string;
6
- ID_PLATEFORME: string;
7
- ID_PROJET: string;
8
- active: boolean;
9
- config: boolean;
10
- structureMap?: {
11
- [structureId: string]: {
12
- UAI?: string;
13
- active: boolean;
14
- collectiviteId?: number;
15
- plateformeId?: any;
16
- projetId?: any;
17
- };
18
- };
19
- };
20
- export type ParamsByTrackingSystem = {
21
- type: 'none' | 'internal' | 'matomo' | 'multiple';
22
- internal?: ITrackingParams;
23
- matomo?: IMatomoTrackingParams;
24
- xiti?: IXitiTrackingParams;
25
- };
26
3
  export declare class AnalyticsService {
27
4
  private context;
28
5
  constructor(context: IOdeServices);
29
- private get conf();
30
6
  private get http();
31
7
  private get session();
32
8
  /**
@@ -0,0 +1,25 @@
1
+ import { IFlashMessageModel, ITimelineApp } from './interfaces';
2
+ import { Notification } from './Notification.model';
3
+ export declare class TimelineApp implements ITimelineApp {
4
+ private _notifications;
5
+ private _notificationTypes;
6
+ private _flashMessages;
7
+ private _pageNumber;
8
+ private _lastPage;
9
+ private _loading;
10
+ showMine: boolean;
11
+ get notifications(): Array<Notification>;
12
+ get isLoading(): boolean;
13
+ get page(): number;
14
+ get hasMorePage(): boolean;
15
+ get notificationTypes(): Array<string>;
16
+ get selectedNotificationTypes(): Array<string>;
17
+ get preferences(): any;
18
+ get flashMessages(): IFlashMessageModel[];
19
+ savePreferences(): Promise<void>;
20
+ resetPagination(): void;
21
+ initialize(): Promise<void>;
22
+ loadNotifications(force?: boolean): Promise<void>;
23
+ loadFlashMessages(): Promise<void>;
24
+ markAsRead(msg: IFlashMessageModel): Promise<void>;
25
+ }
@@ -0,0 +1,10 @@
1
+ import { ITimelineNotification, NotificationModel } from './interfaces';
2
+ export declare class Notification implements ITimelineNotification {
3
+ constructor(model: NotificationModel);
4
+ _id: string;
5
+ model: NotificationModel;
6
+ isUnread(): boolean;
7
+ delete(): Promise<any>;
8
+ discard(): Promise<any>;
9
+ report(): Promise<any>;
10
+ }
@@ -0,0 +1,69 @@
1
+ export declare abstract class ITimelineFactory {
2
+ static createInstance(): ITimelineApp;
3
+ }
4
+ export interface ITimelineApp {
5
+ initialize(): Promise<void>;
6
+ readonly notificationTypes: Array<string>;
7
+ readonly selectedNotificationTypes: Array<string>;
8
+ showMine: boolean;
9
+ /** Load more notifications, or force loading more by virtually incrementing the page. */
10
+ loadNotifications(force?: boolean): Promise<void>;
11
+ readonly notifications: Array<ITimelineNotification>;
12
+ resetPagination(): void;
13
+ readonly isLoading: boolean;
14
+ readonly page: number;
15
+ readonly hasMorePage: boolean;
16
+ savePreferences(): Promise<void>;
17
+ readonly preferences: any;
18
+ loadFlashMessages(): Promise<void>;
19
+ readonly flashMessages: Array<IFlashMessageModel>;
20
+ markAsRead(msg: IFlashMessageModel): Promise<void>;
21
+ }
22
+ export interface ITimelineNotification {
23
+ readonly _id: string;
24
+ readonly model: NotificationModel;
25
+ isUnread(): boolean;
26
+ delete(): Promise<void>;
27
+ discard(): Promise<void>;
28
+ report(): Promise<void>;
29
+ }
30
+ export type NotificationModel = {
31
+ _id: string;
32
+ type: string;
33
+ eventType: string;
34
+ resource: string;
35
+ sender: string;
36
+ params: {
37
+ uri: string;
38
+ username: string;
39
+ blogTitle: string;
40
+ resourceUri: string;
41
+ };
42
+ date: {
43
+ $date: number;
44
+ };
45
+ message: string;
46
+ recipients?: Array<Recipient>;
47
+ reported?: boolean;
48
+ reporters?: any;
49
+ };
50
+ export interface Recipient {
51
+ userId: string;
52
+ }
53
+ export interface IFlashMessageModel {
54
+ readonly id: string;
55
+ readonly title?: string;
56
+ readonly contents?: Object;
57
+ readonly startDate?: string;
58
+ readonly endDate?: string;
59
+ readonly readCount?: number;
60
+ readonly author?: string;
61
+ readonly profiles?: string[];
62
+ readonly color?: string;
63
+ readonly customColor?: string | null;
64
+ readonly lastModifier?: string;
65
+ readonly structureId?: string;
66
+ readonly subStructures?: string[];
67
+ readonly signature?: string;
68
+ readonly signatureColor?: string;
69
+ }
@@ -0,0 +1,40 @@
1
+ import { AnalyticStatus, IXitiTrackingParams, IMatomoTrackingParams, ITrackingParams, TrackingType } from './interfaces';
2
+ export type ParamsByTrackingSystem = {
3
+ type: 'none' | 'internal' | 'matomo' | 'multiple';
4
+ internal?: ITrackingParams;
5
+ matomo?: IMatomoTrackingParams;
6
+ xiti?: IXitiTrackingParams;
7
+ };
8
+ export type XitiConf = {
9
+ ID_EXPLOITANT: string;
10
+ ID_PLATEFORME: string;
11
+ ID_PROJET: string;
12
+ active: boolean;
13
+ config: boolean;
14
+ structureMap?: {
15
+ [structureId: string]: {
16
+ UAI?: string;
17
+ active: boolean;
18
+ collectiviteId?: number;
19
+ plateformeId?: any;
20
+ projetId?: any;
21
+ };
22
+ };
23
+ };
24
+ export declare class Analytics {
25
+ private _status;
26
+ private _params?;
27
+ get status(): AnalyticStatus;
28
+ xiti(): Promise<IXitiTrackingParams | undefined>;
29
+ parameters<T extends ITrackingParams>(type: TrackingType): Promise<T | undefined>;
30
+ private parametersWithCheck;
31
+ /**
32
+ * This method loads the conf and waits for the user session to start.
33
+ * It can be called ASAP, but it will be automatically called if needed.
34
+ * @returns A promise of the end of the init process (it may throw errors)
35
+ * @throws ERROR_CODE.MALFORMED_DATA when config cannot be read.
36
+ */
37
+ private initialize;
38
+ /** 2021 implementation of XiTi. */
39
+ private initializeXiti;
40
+ }
@@ -0,0 +1,17 @@
1
+ import { App } from '../globals';
2
+ import { IWebApp } from '../session/interfaces';
3
+ export declare class AppConf {
4
+ private _publicConf;
5
+ private _currentApp?;
6
+ private _appConf;
7
+ /**
8
+ * Get the currently initialized App.
9
+ * @see getter SessionFramework.currentApp
10
+ */
11
+ get currentApp(): App | null;
12
+ setCurrentApp(app: App): AppConf;
13
+ initialize(app: App, alternativeApp?: boolean): Promise<void>;
14
+ getPublicConf(app: App): Promise<any>;
15
+ getWebAppConf(app: App): Promise<IWebApp | undefined>;
16
+ loadI18n(app: App): Promise<void>;
17
+ }
@@ -0,0 +1,22 @@
1
+ import { IConfigurationFramework } from './interfaces';
2
+ import { Theme } from './Theme';
3
+ import { Idiom } from '../idiom/Idiom';
4
+ import { User } from './User';
5
+ import { AppConf } from './AppConf';
6
+ import { Analytics } from './Analytics';
7
+ export declare class ConfigurationFramework implements IConfigurationFramework {
8
+ readonly Platform: {
9
+ deploymentTag: string;
10
+ cdnDomain: string;
11
+ apps: AppConf;
12
+ theme: Theme;
13
+ analytics: Analytics;
14
+ idiom: Idiom;
15
+ listLanguages: () => Promise<any>;
16
+ };
17
+ readonly School: {};
18
+ readonly User: User;
19
+ initialize(version?: string | null, cdnDomain?: string | null): Promise<void>;
20
+ }
21
+ /** The whole framework is a singleton. */
22
+ export declare const configure: ConfigurationFramework;
@@ -4,13 +4,10 @@ import { IGetConf } from './interfaces';
4
4
  export declare class ConfService {
5
5
  private context;
6
6
  constructor(context: IOdeServices);
7
- readonly Platform: {
8
- deploymentTag: string;
9
- cdnDomain: string;
10
- };
11
7
  private get http();
12
8
  private get cache();
13
9
  private get cdnDomain();
10
+ private get notify();
14
11
  getConf(app: App): Promise<IGetConf>;
15
12
  getPublicConf<T>(app: App): Promise<T>;
16
13
  getCdnUrl(): string | undefined;
@@ -0,0 +1,34 @@
1
+ import { ITheme, IThemeConf, IThemeDesc, IThemeOverrides, IThemeConfOverriding } from './interfaces';
2
+ export declare class Theme implements ITheme {
3
+ private _conf?;
4
+ private _loaded?;
5
+ skinName: string;
6
+ themeName: string;
7
+ skin: string;
8
+ themeUrl: string;
9
+ templateOverrides: IThemeOverrides;
10
+ portalTemplate: string;
11
+ basePath: string;
12
+ logoutCallback: string;
13
+ skins: Array<IThemeConfOverriding>;
14
+ is1D: boolean;
15
+ is2D: boolean;
16
+ initialize(version?: string): Promise<void>;
17
+ private get version();
18
+ private get cdnDomain();
19
+ onFullyReady(): Promise<ITheme>;
20
+ private _onSkinReady;
21
+ onSkinReady(): Promise<ITheme>;
22
+ private _onOverrideReady;
23
+ onOverrideReady(): Promise<IThemeOverrides>;
24
+ getConf(version?: string): Promise<IThemeConf>;
25
+ load(version?: string): Promise<void>;
26
+ private loadDisconnected;
27
+ private loadConnected;
28
+ /** Load the user's configured theme. */
29
+ private loadDefaultTheme;
30
+ listThemes(): Promise<IThemeDesc[]>;
31
+ setDefaultTheme(theme: IThemeDesc): Promise<void>;
32
+ listSkins(): Promise<IThemeConfOverriding[]>;
33
+ getHelpPath(): Promise<String>;
34
+ }
@@ -0,0 +1,21 @@
1
+ import { App } from '../globals';
2
+ import { IUserPreferences } from './interfaces';
3
+ import { IWebApp } from '../session/interfaces';
4
+ export declare class User {
5
+ private _me;
6
+ private _keepOpenOnLogout;
7
+ private _preferences;
8
+ private _bookmarkedApps;
9
+ get keepOpenOnLogout(): boolean;
10
+ get preferences(): IUserPreferences;
11
+ get bookmarkedApps(): Array<IWebApp>;
12
+ initialize(version?: string): Promise<void>;
13
+ private setCurrentModel;
14
+ private loadPublicConf;
15
+ /** Bookmarks : pinned apps */
16
+ private loadBookmarks;
17
+ loadAppPrefs(app: App): Promise<any>;
18
+ saveAppPrefs(app: App): Promise<void>;
19
+ loadLanguage(): Promise<string>;
20
+ saveLanguage(lang: string): Promise<void>;
21
+ }
@@ -1,5 +1,8 @@
1
1
  import { App, USER_PREFS } from '../globals';
2
2
  import { IWebApp } from '../session/interfaces';
3
+ export declare abstract class ConfigurationFrameworkFactory {
4
+ static instance(): IConfigurationFramework;
5
+ }
3
6
  export interface IConfigurationFramework {
4
7
  /** Framework initialization */
5
8
  initialize(version: string | null, cdnDomain: string | null): Promise<void>;
@@ -0,0 +1,25 @@
1
+ import { DataServiceProps, IDataService } from './interface';
2
+ import { IOdeServices } from '../services/OdeServices';
3
+ /** Public conf of an app with a DataService activated. See backend /conf/public */
4
+ export interface PublicConfForDataService {
5
+ 'data-service'?: DataServiceProps;
6
+ }
7
+ export declare class DataService implements IDataService {
8
+ private odeServices;
9
+ private _webBroker?;
10
+ private app?;
11
+ private user?;
12
+ private profile?;
13
+ constructor(odeServices: IOdeServices);
14
+ private get conf();
15
+ private get notify();
16
+ initialize(): Promise<void>;
17
+ predestroy(): void;
18
+ /** Send a web-user-level event to the data pipeline. */
19
+ private trackWebEvent;
20
+ private addUserInfos;
21
+ trackVideoSave(video_id: string, duration: number, weight: number, isCaptation: boolean, url: string, browser: string, deviceType?: string): void;
22
+ trackVideoRead(video_id: string, isCaptation: boolean, url: string, browser: string, deviceType?: string): void;
23
+ trackSpeechAndText(direction: 'STT' | 'TTS'): void;
24
+ trackAccessLibraryFromExplorer(): void;
25
+ }
@@ -1,7 +1,12 @@
1
1
  import { DataServiceProps, IEventBroker } from './interface';
2
+ import { IOdeServices } from '../services/OdeServices';
2
3
  export declare class WebBroker implements IEventBroker {
4
+ private odeServices;
3
5
  private subscription?;
4
- constructor();
6
+ constructor(odeServices: IOdeServices);
7
+ private get http();
8
+ private get events();
9
+ private dispatchEvent;
5
10
  initialize(props: DataServiceProps['web'] | undefined): this;
6
11
  destroy(): void;
7
12
  }
package/dist/globals.d.ts CHANGED
@@ -25,7 +25,6 @@ export declare const APP: {
25
25
  readonly TIMELINE: "timeline";
26
26
  readonly WORKSPACE: "workspace";
27
27
  readonly EXPLORER: "explorer";
28
- readonly HOMEWORKS: "homeworks";
29
28
  readonly VIDEO: "video";
30
29
  readonly MINDMAP: "mindmap";
31
30
  readonly SCRAPBOOK: "scrapbook";
@@ -0,0 +1,18 @@
1
+ import { AddBundleCallback, IIdiom } from '../configure/interfaces';
2
+ export declare const defaultDiacriticsRemovalMap: {
3
+ base: string;
4
+ letters: RegExp;
5
+ }[];
6
+ export declare class Idiom implements IIdiom {
7
+ translate(key: string, params?: {
8
+ [param: string]: any;
9
+ }): string;
10
+ addBundlePromise(path: string): Promise<void>;
11
+ addBundle(path: string, callback?: AddBundleCallback): void;
12
+ loadBundlePromise(lang: string, path: string): Promise<void>;
13
+ private loadBundle;
14
+ addTranslations(folder: string, callback?: AddBundleCallback): void;
15
+ addAllTranslations(folders: string[]): Promise<void>;
16
+ addKeys(keys: any): void;
17
+ removeAccents(str: string): string;
18
+ }