@edifice.io/client 1.7.4-develop-pedago.20241211160712

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 (83) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +90 -0
  3. package/dist/analytics/Service.d.ts +17 -0
  4. package/dist/apps/timeline/Framework.d.ts +25 -0
  5. package/dist/apps/timeline/Notification.model.d.ts +10 -0
  6. package/dist/apps/timeline/interfaces.d.ts +69 -0
  7. package/dist/audience/ReactionsService.d.ts +22 -0
  8. package/dist/audience/Service.d.ts +13 -0
  9. package/dist/audience/ViewsService.d.ts +12 -0
  10. package/dist/audience/interface.d.ts +108 -0
  11. package/dist/cache/Service.d.ts +14 -0
  12. package/dist/configure/Analytics.d.ts +40 -0
  13. package/dist/configure/AppConf.d.ts +17 -0
  14. package/dist/configure/Framework.d.ts +22 -0
  15. package/dist/configure/Service.d.ts +21 -0
  16. package/dist/configure/Theme.d.ts +34 -0
  17. package/dist/configure/User.d.ts +21 -0
  18. package/dist/configure/interfaces.d.ts +218 -0
  19. package/dist/data/Service.d.ts +25 -0
  20. package/dist/data/WebBroker.d.ts +12 -0
  21. package/dist/data/interface.d.ts +50 -0
  22. package/dist/directory/Service.d.ts +17 -0
  23. package/dist/directory/interface.d.ts +53 -0
  24. package/dist/embedder/Service.d.ts +39 -0
  25. package/dist/embedder/interface.d.ts +14 -0
  26. package/dist/globals.d.ts +52 -0
  27. package/dist/idiom/Idiom.d.ts +18 -0
  28. package/dist/idiom/Service.d.ts +24 -0
  29. package/dist/idiom/interfaces.d.ts +22 -0
  30. package/dist/index.cjs +6 -0
  31. package/dist/index.d.ts +13 -0
  32. package/dist/index.js +6192 -0
  33. package/dist/notify/Framework.d.ts +29 -0
  34. package/dist/notify/Subject.d.ts +9 -0
  35. package/dist/notify/interfaces.d.ts +113 -0
  36. package/dist/resources/ResourceService.d.ts +52 -0
  37. package/dist/resources/ServiceRegistry.d.ts +25 -0
  38. package/dist/resources/SnipletsService.d.ts +18 -0
  39. package/dist/resources/behaviours/AbstractBehaviourService.d.ts +34 -0
  40. package/dist/resources/behaviours/ActualitesBehaviour.d.ts +6 -0
  41. package/dist/resources/behaviours/BlogBehaviour.d.ts +6 -0
  42. package/dist/resources/behaviours/CollaborativewallBehaviour.d.ts +6 -0
  43. package/dist/resources/behaviours/CommunityBehaviour.d.ts +6 -0
  44. package/dist/resources/behaviours/ExercizerBehaviour.d.ts +6 -0
  45. package/dist/resources/behaviours/FormulaireBehaviour.d.ts +6 -0
  46. package/dist/resources/behaviours/ForumBehaviour.d.ts +6 -0
  47. package/dist/resources/behaviours/HomeworksBehaviour.d.ts +6 -0
  48. package/dist/resources/behaviours/MagnetoBehaviour.d.ts +6 -0
  49. package/dist/resources/behaviours/MindmapBehaviour.d.ts +6 -0
  50. package/dist/resources/behaviours/PagesBehaviour.d.ts +6 -0
  51. package/dist/resources/behaviours/PollBehaviour.d.ts +6 -0
  52. package/dist/resources/behaviours/ScrapbookBehaviour.d.ts +6 -0
  53. package/dist/resources/behaviours/TimelinegeneratorBehaviour.d.ts +6 -0
  54. package/dist/resources/behaviours/WikiBehaviour.d.ts +6 -0
  55. package/dist/resources/behaviours/WorkspaceBehaviour.d.ts +7 -0
  56. package/dist/resources/interface.d.ts +390 -0
  57. package/dist/resources/services/ScrapbookResourceService.d.ts +14 -0
  58. package/dist/rights/Service.d.ts +77 -0
  59. package/dist/rights/interface.d.ts +18 -0
  60. package/dist/services/OdeServices.d.ts +72 -0
  61. package/dist/services/index.d.ts +10 -0
  62. package/dist/session/Framework.d.ts +10 -0
  63. package/dist/session/Service.d.ts +39 -0
  64. package/dist/session/Session.d.ts +34 -0
  65. package/dist/session/interfaces.d.ts +268 -0
  66. package/dist/share/Service.d.ts +18 -0
  67. package/dist/share/interface.d.ts +104 -0
  68. package/dist/transport/Framework.d.ts +9 -0
  69. package/dist/transport/Http.d.ts +26 -0
  70. package/dist/transport/Service.d.ts +31 -0
  71. package/dist/transport/interfaces.d.ts +70 -0
  72. package/dist/utilities/DocumentHelper.d.ts +27 -0
  73. package/dist/utilities/StringUtils.d.ts +3 -0
  74. package/dist/utilities/index.d.ts +3 -0
  75. package/dist/utilities/isActionAvailable.d.ts +2 -0
  76. package/dist/video/Service.d.ts +21 -0
  77. package/dist/video/interface.d.ts +42 -0
  78. package/dist/widget/Framework.d.ts +31 -0
  79. package/dist/widget/LastInfos.widget.d.ts +15 -0
  80. package/dist/widget/interfaces.d.ts +53 -0
  81. package/dist/workspace/Service.d.ts +75 -0
  82. package/dist/workspace/interface.d.ts +67 -0
  83. package/package.json +53 -0
@@ -0,0 +1,268 @@
1
+ import { App } from '../globals';
2
+ import { WidgetName } from '../widget/interfaces';
3
+ export declare abstract class SessionFrameworkFactory {
4
+ static instance(): ISessionFramework;
5
+ }
6
+ export interface ISessionFramework {
7
+ /** Initialize once before use. */
8
+ initialize(): Promise<void>;
9
+ /** The current user session. */
10
+ session: ISession;
11
+ /** Log the current user in. */
12
+ login(email: string, password: string, rememberMe?: boolean, secureLocation?: boolean): Promise<void>;
13
+ /** Close the current user session. */
14
+ logout(): Promise<void>;
15
+ }
16
+ export interface ILoginModel {
17
+ email: string;
18
+ password: string;
19
+ rememberMe?: boolean;
20
+ secureLocation?: boolean;
21
+ }
22
+ export interface GetUserProfileOptions {
23
+ options?: any;
24
+ params?: Record<string, any>;
25
+ }
26
+ export interface ISession {
27
+ /** Language code (2-letters) actually applied. */
28
+ readonly currentLanguage: string;
29
+ /** Truthy when no user is connected. */
30
+ readonly notLoggedIn: boolean;
31
+ /** Additional information about the connected user. */
32
+ readonly description: IUserDescription;
33
+ /** Additional profile user information. */
34
+ readonly profile: UserProfile;
35
+ /**
36
+ * Get the connected user's avatar URL, or a default one.
37
+ * Append a query parameter to this URL for it to get resized, for example "?thumbnail=48x48"
38
+ */
39
+ readonly avatarUrl: string;
40
+ /** Basic information about the connected user. */
41
+ readonly user: IUserInfo;
42
+ /** Retrieve the current main app, @see ConfigureFramework.Platform.apps */
43
+ readonly currentApp: App | null;
44
+ /** Retrieve the lastest storage + quota information. */
45
+ readonly latestQuotaAndUsage: Promise<IQuotaAndUsage>;
46
+ hasWorkflow(workflowName: string): boolean;
47
+ hasRight(resource: any, right: any): boolean;
48
+ /** Get User Profile */
49
+ getUserProfile({ options, params, }: Partial<GetUserProfileOptions>): Promise<UserProfile>;
50
+ /** Verify if the logged-in user has a valid email address. */
51
+ getEmailValidationInfos(): Promise<IEmailValidationInfos>;
52
+ /**
53
+ * Send a 6-digits code to an email address to validate it.
54
+ * => when resolved successfully, the email validation infos will switch to the "pending" state.
55
+ */
56
+ checkEmail(email: String): Promise<void>;
57
+ /** Send a 6-digits code to the server to try validating the pending email address. */
58
+ tryEmailValidation(code: String): Promise<IEmailValidationState>;
59
+ /** Verify if the logged-in user has a valid phone number. */
60
+ getMobileValidationInfos(): Promise<IMobileValidationInfos>;
61
+ /**
62
+ * Send a 6-digits code to a phone number to validate it.
63
+ * => when resolved successfully, the phone number infos will switch to the "pending" state.
64
+ */
65
+ checkMobile(mobile: String): Promise<void>;
66
+ /** Send a 6-digits code to the server to try validating the pending phone number. */
67
+ tryMobileValidation(code: String): Promise<IMobileValidationState>;
68
+ /** Start an MFA for the logged-in user, unless already pending or done. */
69
+ getMfaInfos(): Promise<IMfaInfos>;
70
+ /** Send a 6-digits code to the server to validate a pending MFA. */
71
+ tryMfaCode(code: String): Promise<IMfaCodeState>;
72
+ }
73
+ export type Hobby = {
74
+ visibility: 'PRIVE' | 'PUBLIC';
75
+ category: 'sport' | 'cinema' | 'animals' | 'music' | 'places' | 'books';
76
+ values: string;
77
+ };
78
+ export type School = {
79
+ classes: Array<string>;
80
+ id: string;
81
+ name: string;
82
+ UAI: string;
83
+ exports: string[];
84
+ };
85
+ export type UserProfile = Array<'Student' | 'Teacher' | 'Relative' | 'Personnel' | 'Guest'>;
86
+ export interface IUserDescription {
87
+ alertSize: boolean;
88
+ health: string;
89
+ hobbies: Array<Hobby>;
90
+ mood: 'default' | 'happy' | 'proud' | 'dreamy' | 'love' | 'tired' | 'angry' | 'worried' | 'sick' | 'joker' | 'sad';
91
+ motto: string;
92
+ oldPicture?: string;
93
+ picture: string;
94
+ quota: number;
95
+ storage: number;
96
+ theme: string;
97
+ type: string;
98
+ userid: string;
99
+ address: string;
100
+ birthdate: string;
101
+ displayName: string;
102
+ email: string;
103
+ id: string;
104
+ login: string;
105
+ mobile: string;
106
+ photo: string;
107
+ relatedId?: any;
108
+ relatedName?: any;
109
+ relatedType?: any;
110
+ schools: Array<School>;
111
+ tel: string;
112
+ profiles: UserProfile;
113
+ userId: string;
114
+ visibleInfos: Array<string>;
115
+ }
116
+ export interface IQuotaAndUsage {
117
+ /** Maximum use of the storage space. */
118
+ quota: number;
119
+ /** Current use of the storage space. */
120
+ storage: number;
121
+ }
122
+ export interface IUserInfo {
123
+ apps: Array<IWebApp>;
124
+ authorizedActions: Array<IWorkflowAuth>;
125
+ birthDate: string;
126
+ children: any;
127
+ childrenIds: Array<string>;
128
+ classNames: Array<string>;
129
+ classes: Array<any>;
130
+ deletePending: boolean;
131
+ externalId: string;
132
+ federated?: any;
133
+ federatedIDP?: any;
134
+ firstName: string;
135
+ forceChangePassword?: any;
136
+ functions: {
137
+ ADMIN_LOCAL?: {
138
+ code: string;
139
+ scope: Array<string>;
140
+ };
141
+ SUPER_ADMIN: {
142
+ code: string;
143
+ scope: Array<string>;
144
+ };
145
+ };
146
+ groupsIds: Array<string>;
147
+ hasApp: boolean;
148
+ hasPw: boolean;
149
+ lastName: string;
150
+ level: string;
151
+ login: string;
152
+ needRevalidateTerms: any;
153
+ optionEnabled: Array<any>;
154
+ preferences?: {
155
+ save: (pref: any, data: any) => void;
156
+ };
157
+ sessionMetadata: {
158
+ _id: string;
159
+ userId: string;
160
+ };
161
+ structureNames: Array<string>;
162
+ structures: Array<string>;
163
+ type: 'ENSEIGNANT' | 'ELEVE' | 'PERSRELELEVE' | 'SUPERADMIN' | 'PERSEDUCNAT';
164
+ uai: Array<any>;
165
+ userId: string;
166
+ username: string;
167
+ widgets: Array<IWidgetModel>;
168
+ }
169
+ export declare const WIDGET_POSITION: {
170
+ readonly LEFT: "left";
171
+ readonly RIGHT: "right";
172
+ };
173
+ export type WidgetPosition = (typeof WIDGET_POSITION)[keyof typeof WIDGET_POSITION];
174
+ export interface IWidgetModel {
175
+ application?: string;
176
+ position?: WidgetPosition;
177
+ i18n: string;
178
+ id: string;
179
+ js: string;
180
+ mandatory: boolean;
181
+ name: WidgetName;
182
+ path: string;
183
+ }
184
+ export interface IWebApp {
185
+ address: string;
186
+ casType?: string;
187
+ display: boolean;
188
+ displayName: string;
189
+ icon: string;
190
+ isExternal: boolean;
191
+ name: string;
192
+ prefix?: string;
193
+ scope: Array<string>;
194
+ target?: any;
195
+ }
196
+ export interface IWorkflowAuth {
197
+ displayName: string;
198
+ name: string;
199
+ type: string;
200
+ }
201
+ export interface IEmailValidationInfos {
202
+ /** The current email address of the user (maybe not verified) */
203
+ email: string;
204
+ /** State of the current email address. */
205
+ emailState: IEmailValidationState | null;
206
+ /** Suggested time to wait for the validation mail to be sent (platform configuration) */
207
+ waitInSeconds: number;
208
+ }
209
+ export interface IEmailValidationState {
210
+ /** Validation state */
211
+ state: 'unchecked' | 'outdated' | 'pending' | 'valid';
212
+ /** Last known valid email address, or empty string. */
213
+ valid: string;
214
+ /** (optional) Current pending (or outdated) email address being checked. */
215
+ pending?: string;
216
+ /** (optional) Seconds remaining for the user to type in the correct validation code. */
217
+ ttl?: number;
218
+ /** (optional) Remaining number of times a validation code can be typed in. */
219
+ tries?: number;
220
+ }
221
+ export interface IMobileValidationInfos {
222
+ /** The current phone number of the user (maybe not verified) */
223
+ mobile: string;
224
+ /** State of the current phone number. */
225
+ mobileState: IMobileValidationState | null;
226
+ /** Suggested time to wait for the validation phone number to be sent (platform configuration) */
227
+ waitInSeconds: number;
228
+ }
229
+ export interface IMobileValidationState {
230
+ /** Validation state */
231
+ state: 'unchecked' | 'outdated' | 'pending' | 'valid';
232
+ /** Last known valid phone number, or empty string. */
233
+ valid: string;
234
+ /** (optional) Current pending (or outdated) phone number being checked. */
235
+ pending?: string;
236
+ /** (optional) Seconds remaining for the user to type in the correct validation code. */
237
+ ttl?: number;
238
+ /** (optional) Remaining number of times a validation code can be typed in. */
239
+ tries?: number;
240
+ }
241
+ export interface IMfaInfos {
242
+ /** The type of MFA used. */
243
+ type: 'sms' | 'email';
244
+ /** State of the generated MFA code. */
245
+ state: IMfaCodeState | null;
246
+ /** Suggested time to wait for the MFA code to be sent (platform configuration) */
247
+ waitInSeconds: number;
248
+ }
249
+ export interface IMfaCodeState {
250
+ /** Validation state */
251
+ state: 'outdated' | 'pending' | 'valid';
252
+ /** (optional) Seconds remaining for the user to type in the correct code. */
253
+ ttl?: number;
254
+ /** (optional) Remaining number of times a code can be typed in. */
255
+ tries?: number;
256
+ }
257
+ export interface IGetSession {
258
+ user?: IUserInfo;
259
+ currentLanguage?: string;
260
+ quotaAndUsage: IQuotaAndUsage;
261
+ userDescription: Partial<IUserDescription>;
262
+ userProfile?: UserProfile;
263
+ bookmarkedApps: IWebApp[];
264
+ }
265
+ export type PersonApiResult = {
266
+ status: 'ok' | string;
267
+ result: Array<IUserDescription>;
268
+ };
@@ -0,0 +1,18 @@
1
+ import { IOdeServices } from '../services/OdeServices';
2
+ import { GetResourceRightPayload, PutShareResponse, ShareMapping, ShareRight, ShareRightAction, ShareRightActionDisplayName, ShareRightWithVisibles, ShareSubject } from './interface';
3
+ export declare class ShareService {
4
+ protected context: IOdeServices;
5
+ constructor(context: IOdeServices);
6
+ get directory(): import('../directory/Service').DirectoryService;
7
+ get http(): import('../transport/Service').HttpService;
8
+ get cache(): import('../cache/Service').CacheService;
9
+ searchShareSubjects(app: string, resourceId: string, searchText: string): Promise<ShareSubject[]>;
10
+ getShareMapping(app: string): Promise<ShareMapping>;
11
+ getActionsAvailableFor({ id, type }: {
12
+ id: string;
13
+ type: 'user' | 'group';
14
+ }, payload: GetResourceRightPayload, mapping: ShareMapping): ShareRightActionDisplayName[];
15
+ getRightsForResource(app: string, resourceId: string): Promise<ShareRightWithVisibles>;
16
+ saveRights(app: string, resourceId: string, rights: ShareRight[]): Promise<PutShareResponse>;
17
+ getActionsForApp(app: string): Promise<ShareRightAction[]>;
18
+ }
@@ -0,0 +1,104 @@
1
+ import { Group, Bookmark, User } from '../directory/interface';
2
+ export interface ShareRight {
3
+ id: string;
4
+ type: ShareRightType;
5
+ displayName: string;
6
+ profile?: string;
7
+ avatarUrl: string;
8
+ directoryUrl: string;
9
+ actions: ShareRightAction[];
10
+ isBookmarkMember?: boolean;
11
+ users?: User[];
12
+ groups?: Group[];
13
+ }
14
+ export interface ShareParameters {
15
+ id: string;
16
+ rights: ShareRight[];
17
+ }
18
+ /**
19
+ * Type of share right
20
+ * */
21
+ export type ShareRightType = 'user' | 'group' | 'sharebookmark';
22
+ /**
23
+ * Type of action when sharing
24
+ * */
25
+ export interface ShareRightAction {
26
+ id: ShareRightActionDisplayName;
27
+ displayName: ShareRightActionDisplayName;
28
+ priority?: number;
29
+ requires?: ShareRightActionDisplayName[];
30
+ }
31
+ /**
32
+ * Name of current action when sharing
33
+ * */
34
+ export type ShareRightActionDisplayName = 'read' | 'contrib' | 'manage' | 'publish' | 'manager' | 'comment';
35
+ export type ShareRightActionDisplayNameExt = ShareRightActionDisplayName | 'creator';
36
+ export type SharingRight = Record<ShareRightActionDisplayName, {
37
+ priority: number;
38
+ default: boolean;
39
+ requires: ShareRightActionDisplayName[];
40
+ }>;
41
+ export type ShareMapping = Record<ShareRightActionDisplayName, string[]>;
42
+ /**
43
+ * Payload of shared resource
44
+ * */
45
+ export interface GetResourceRightPayload {
46
+ actions: Array<{
47
+ name: string[];
48
+ displayName: string;
49
+ type: 'RESOURCE';
50
+ }>;
51
+ groups: {
52
+ visibles: Array<{
53
+ id: string;
54
+ name: string;
55
+ groupDisplayName: string;
56
+ structureName: string;
57
+ }>;
58
+ checked: Record<string, string[]>;
59
+ };
60
+ users: {
61
+ visibles: Array<{
62
+ id: string;
63
+ login: string;
64
+ username: string;
65
+ lastName: string;
66
+ firstName: string;
67
+ profile: string;
68
+ }>;
69
+ checked: Record<string, string[]>;
70
+ };
71
+ }
72
+ /**
73
+ * Update payload of shared resource
74
+ * */
75
+ export interface PutSharePayload {
76
+ users: Record<string, string[]>;
77
+ groups: Record<string, string[]>;
78
+ bookmarks: Record<string, string[]>;
79
+ }
80
+ /**
81
+ * Response of shared resource
82
+ * */
83
+ export interface PutShareResponse {
84
+ 'notify-timeline-array': Array<{
85
+ groupId: string;
86
+ } | {
87
+ userId: string;
88
+ }>;
89
+ }
90
+ export interface ShareSubject {
91
+ id: string;
92
+ displayName: string;
93
+ profile?: string;
94
+ avatarUrl: string;
95
+ directoryUrl: string;
96
+ type: 'user' | 'group' | 'sharebookmark';
97
+ structureName?: string;
98
+ }
99
+ export interface ShareRightWithVisibles {
100
+ rights: ShareRight[];
101
+ visibleUsers: User[];
102
+ visibleGroups: Group[];
103
+ visibleBookmarks: Bookmark[];
104
+ }
@@ -0,0 +1,9 @@
1
+ import { IHttp, ITransportFramework } from './interfaces';
2
+ declare class TransportFramework implements ITransportFramework {
3
+ private _http;
4
+ get http(): IHttp;
5
+ newHttpInstance(params?: any): IHttp;
6
+ }
7
+ /** The whole framework is a singleton. */
8
+ export declare const transport: TransportFramework;
9
+ export {};
@@ -0,0 +1,26 @@
1
+ import { IHttp, IHttpParams, IHttpResponse } from './interfaces';
2
+ export declare class Http implements IHttp {
3
+ private axios;
4
+ private _latestResponse;
5
+ constructor(params?: any);
6
+ setCdn(cdnUrl: string): void;
7
+ private toAxiosConfig;
8
+ private toCdnUrl;
9
+ private mapAxiosError;
10
+ private mapAxiosResponse;
11
+ get latestResponse(): IHttpResponse;
12
+ isResponseError(): boolean;
13
+ get<R = any>(url: string, params?: IHttpParams): Promise<R>;
14
+ post<R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
15
+ postFile<R = any>(url: string, data: any, params?: IHttpParams): Promise<R>;
16
+ postJson<R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
17
+ put<R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
18
+ putJson<R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
19
+ delete<R = any>(url: string, params?: IHttpParams): Promise<R>;
20
+ deleteJson<R = any>(url: string, json: any): Promise<R>;
21
+ getScript<R = any>(url: string, params?: IHttpParams, variableName?: string): Promise<R>;
22
+ loadScript(url: string, params?: IHttpParams): Promise<void>;
23
+ }
24
+ /**
25
+ * Promisified HTTP
26
+ */
@@ -0,0 +1,31 @@
1
+ import { IOdeServices } from '../services/OdeServices';
2
+ import { IHttp, IHttpParams, IHttpResponse } from './interfaces';
3
+ export declare class HttpService implements IHttp {
4
+ private context;
5
+ private axios;
6
+ private baseUrl?;
7
+ private headers;
8
+ private _latestResponse;
9
+ constructor(context: IOdeServices, params?: any);
10
+ private fixBaseUrl;
11
+ useBaseUrl(baseUrl?: string): this;
12
+ useHeaders(headers: Record<string, string>): this;
13
+ setCdn(cdnUrl: string): void;
14
+ private toAxiosConfig;
15
+ private toCdnUrl;
16
+ private mapAxiosError;
17
+ private mapAxiosResponse;
18
+ get latestResponse(): IHttpResponse;
19
+ isResponseError(): boolean;
20
+ get<R = any>(url: string, params?: IHttpParams): Promise<R>;
21
+ post<R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
22
+ postFile<R = any>(url: string, data: any, params?: IHttpParams): Promise<R>;
23
+ postJson<R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
24
+ put<R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
25
+ putFile<R = any>(url: string, data: FormData, params?: IHttpParams): Promise<any>;
26
+ putJson<R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
27
+ delete<R = any>(url: string, params?: IHttpParams): Promise<R>;
28
+ deleteJson<R = any>(url: string, json: any): Promise<R>;
29
+ getScript<R = any>(url: string, params?: IHttpParams, variableName?: string): Promise<R>;
30
+ loadScript(url: string, params?: IHttpParams): Promise<void>;
31
+ }
@@ -0,0 +1,70 @@
1
+ export declare abstract class TransportFrameworkFactory {
2
+ static instance(): ITransportFramework;
3
+ }
4
+ export interface ITransportFramework {
5
+ /** Default instance. */
6
+ readonly http: IHttp;
7
+ /**
8
+ * Creates a new IHttp object with a custom configuration;
9
+ * @param params see available options at https://axios-http.com/docs/req_config
10
+ */
11
+ newHttpInstance(params?: any): IHttp;
12
+ }
13
+ export interface IHttp {
14
+ /** Latest available HTTP response, valid during your get|post|put...then() and catch() handlers. */
15
+ readonly latestResponse: IHttpResponse;
16
+ /** Check if HTTP status of latestResponse is <200 or >=300 */
17
+ isResponseError(): boolean;
18
+ /** HTTP GET Accept: application/json */
19
+ get<R = any>(url: string, params?: IHttpParams): Promise<R>;
20
+ /** HTTP POST, Accept: application/json */
21
+ post<R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
22
+ /**
23
+ * HTTP POST
24
+ * @param data must be of one of the following types:
25
+ * string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams
26
+ * Browser only: FormData, File, Blob
27
+ * Node only: Stream, Buffer
28
+ */
29
+ postFile<R = any>(url: string, data: any, params?: IHttpParams): Promise<R>;
30
+ /** HTTP POST, Accept: application/json, Content-type: application/json */
31
+ postJson<T = any, R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
32
+ /** HTTP PUT, Accept: application/json */
33
+ put<T = any, R = any>(url: string, data?: any, params?: IHttpParams): Promise<R>;
34
+ /** HTTP PUT, Accept: application/json, Content-type: application/json */
35
+ putJson<T = any, R = any>(url: string, json: any, params?: IHttpParams): Promise<R>;
36
+ /** HTTP DELETE */
37
+ delete<T = any, R = any>(url: string, params?: IHttpParams): Promise<R>;
38
+ /** HTTP DELETE, Accept: application/json */
39
+ deleteJson<T = any, R = any>(url: string, json: any): Promise<R>;
40
+ /**
41
+ * HTTP GET, Accept: application/javascript
42
+ * @param exportedVariableName: unused at the moment.
43
+ */
44
+ getScript<R = any>(url: string, params?: IHttpParams, exportedVariableName?: string): Promise<R>;
45
+ /** HTTP GET, Accept: application/javascript */
46
+ loadScript(url: string, params?: IHttpParams): Promise<void>;
47
+ setCdn(url: string): void;
48
+ }
49
+ export type IHttpParamsResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
50
+ export type IHttpParams = {
51
+ /** Request the API to send a notification when done. */
52
+ readonly requestName?: string;
53
+ /** Set to true to prevent sending notifications. */
54
+ readonly disableNotifications?: boolean;
55
+ /** HTTP headers to apply to the request. */
56
+ readonly headers?: {
57
+ [key: string]: string;
58
+ };
59
+ /** Object to serialize as query parameters and append to the request URL. */
60
+ readonly queryParams?: {
61
+ [key: string]: any;
62
+ };
63
+ /** Response Type */
64
+ readonly responseType?: IHttpParamsResponseType;
65
+ };
66
+ export type IHttpResponse = {
67
+ status: number;
68
+ statusText: string;
69
+ headers?: any;
70
+ };
@@ -0,0 +1,27 @@
1
+ import { WorkspaceElement } from '../services';
2
+ export type RoleMapperParams = {
3
+ type: string;
4
+ previewRole: boolean;
5
+ extension?: string;
6
+ };
7
+ declare const defaultMappers: {
8
+ readonly csv: ({ type, extension }: RoleMapperParams) => boolean;
9
+ readonly doc: ({ type, extension }: RoleMapperParams) => boolean;
10
+ readonly xls: ({ type, extension }: RoleMapperParams) => boolean;
11
+ readonly img: ({ type }: RoleMapperParams) => boolean;
12
+ readonly pdf: ({ type }: RoleMapperParams) => boolean;
13
+ readonly ppt: ({ type, extension }: RoleMapperParams) => boolean;
14
+ readonly txt: ({ type, extension }: RoleMapperParams) => boolean;
15
+ readonly md: ({ type, extension }: RoleMapperParams) => boolean;
16
+ readonly video: ({ type }: RoleMapperParams) => boolean;
17
+ readonly audio: ({ type }: RoleMapperParams) => boolean;
18
+ readonly zip: ({ type }: RoleMapperParams) => boolean;
19
+ };
20
+ export type Role = keyof typeof defaultMappers;
21
+ export type RoleMapper = (params: RoleMapperParams) => Role | undefined;
22
+ export declare abstract class DocumentHelper {
23
+ private static roleMappers;
24
+ static getRole(doc: WorkspaceElement): Role | 'unknown';
25
+ static role(contentType: string | undefined, previewRole?: boolean, extension?: string): Role | 'unknown';
26
+ }
27
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare class StringUtils {
2
+ static removeAccents(str: string): string;
3
+ }
@@ -0,0 +1,3 @@
1
+ export * from './DocumentHelper';
2
+ export * from './isActionAvailable';
3
+ export * from './StringUtils';
@@ -0,0 +1,2 @@
1
+ import { IAction } from '../services';
2
+ export declare const isActionAvailable: (workflow: string, actions: IAction[] | undefined) => boolean | undefined;
@@ -0,0 +1,21 @@
1
+ import { IOdeServices } from '../services/OdeServices';
2
+ import { VideoConf, VideoUploadParams, VideoUploadResponse } from './interface';
3
+ export declare class VideoService {
4
+ private context;
5
+ private static MAX_WEIGHT;
6
+ private static MAX_DURATION;
7
+ constructor(context: IOdeServices);
8
+ private get http();
9
+ private get conf();
10
+ /**
11
+ * Returns the video app public conf (maxWeight, maxDuration and accepted extensions)
12
+ * @returns the Video app public conf
13
+ */
14
+ getVideoConf(): Promise<VideoConf>;
15
+ /**
16
+ * Starts the encoding process and check when video is fully processed.
17
+ * @param params cf VideoUploadParams
18
+ * @returns a VideoCheckResponse
19
+ */
20
+ upload({ data, appCode, captation, duration, }: VideoUploadParams): Promise<VideoUploadResponse>;
21
+ }
@@ -0,0 +1,42 @@
1
+ export type VideoEncodeResponse = {
2
+ /** encoding process id, useful for check API */
3
+ processid: string;
4
+ /** encoding API state */
5
+ state: 'running' | 'succeed' | 'error';
6
+ };
7
+ export type VideoUploadParams = {
8
+ data: {
9
+ device: string | undefined;
10
+ browser: {
11
+ name: string | undefined;
12
+ version: string | undefined;
13
+ };
14
+ url: string;
15
+ file: Blob;
16
+ filename: string;
17
+ weight: number;
18
+ };
19
+ appCode: string;
20
+ captation: boolean;
21
+ duration: number;
22
+ };
23
+ export type VideoUploadResponse = VideoEncodeResponse & {
24
+ /** ID of the video file. */
25
+ videoid?: string;
26
+ /** size of the encoded video, in bytes. */
27
+ videosize?: number;
28
+ /** ID of the video document in Workspace. */
29
+ videoworkspaceid?: string;
30
+ /** Error code (i18n key), when state==="error" */
31
+ code?: string;
32
+ };
33
+ export type VideoPublicConfResponse = {
34
+ 'accept-videoupload-extensions': Array<string>;
35
+ 'max-videoduration-minutes': number;
36
+ 'max-videosize-mbytes': number;
37
+ };
38
+ export type VideoConf = {
39
+ acceptVideoUploadExtensions: Array<string>;
40
+ maxDuration: number;
41
+ maxWeight: number;
42
+ };
@@ -0,0 +1,31 @@
1
+ import { IWidgetFramework, IWidget, WidgetUserPref, WidgetName } from './interfaces';
2
+ import { IWidgetModel, WidgetPosition } from '../session/interfaces';
3
+ export declare class WidgetFramework implements IWidgetFramework {
4
+ private _initialized?;
5
+ private _widgets;
6
+ initialize(version: string | null, cdnDomain: string | null): Promise<void>;
7
+ get list(): Widget[];
8
+ lookup(widgetName: string): IWidget | undefined;
9
+ lookupDefaultPosition(widgetName: WidgetName): WidgetPosition | undefined;
10
+ private _userPrefs;
11
+ get userPrefs(): IWidgetUserPrefs;
12
+ private loadUserPrefs;
13
+ saveUserPrefs(): Promise<void>;
14
+ private applyUserPrefs;
15
+ }
16
+ declare class Widget implements IWidget {
17
+ private _platformConf;
18
+ constructor(_platformConf: IWidgetModel);
19
+ get platformConf(): IWidgetModel;
20
+ private _schoolConf;
21
+ get schoolConf(): {};
22
+ private _userPref;
23
+ get userPref(): WidgetUserPref;
24
+ applyUserPref(pref: WidgetUserPref): void;
25
+ }
26
+ interface IWidgetUserPrefs {
27
+ [widgetName: string]: WidgetUserPref;
28
+ }
29
+ /** The whole framework is a singleton. */
30
+ export declare const widgets: WidgetFramework;
31
+ export {};