@sparted/shared-library 1.2.3-rc3 → 1.2.4
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,12 +1,21 @@
|
|
|
1
1
|
import { Image } from './media';
|
|
2
2
|
import { MultilingualLabel } from './multilingual';
|
|
3
3
|
export type CampaignInformations = {
|
|
4
|
-
coverImage
|
|
4
|
+
coverImage?: Image;
|
|
5
5
|
name: MultilingualLabel;
|
|
6
|
-
description
|
|
6
|
+
description?: MultilingualLabel;
|
|
7
7
|
disclaimer?: MultilingualLabel;
|
|
8
8
|
};
|
|
9
|
+
export type CampaignScheduling = {
|
|
10
|
+
mode: 'manual' | 'random';
|
|
11
|
+
type: 'flexible' | 'intense';
|
|
12
|
+
launchDate?: string;
|
|
13
|
+
endDate?: string;
|
|
14
|
+
extraDays?: number;
|
|
15
|
+
enabledWeekDays?: number[];
|
|
16
|
+
};
|
|
9
17
|
export type Campaign = {
|
|
10
18
|
id: number;
|
|
11
19
|
informations: CampaignInformations;
|
|
20
|
+
scheduling: CampaignScheduling;
|
|
12
21
|
};
|
|
@@ -4,16 +4,16 @@ import { Image, Media } from './media';
|
|
|
4
4
|
import { Thematic } from './thematic';
|
|
5
5
|
export type ErrorText = {
|
|
6
6
|
type: 'error-text';
|
|
7
|
-
gameMedia
|
|
8
|
-
explanationMedia
|
|
9
|
-
explanation
|
|
10
|
-
wrongText
|
|
11
|
-
correctText
|
|
7
|
+
gameMedia?: Media;
|
|
8
|
+
explanationMedia?: Media;
|
|
9
|
+
explanation?: MultilingualLabel;
|
|
10
|
+
wrongText?: MultilingualLabel;
|
|
11
|
+
correctText?: MultilingualLabel;
|
|
12
12
|
};
|
|
13
13
|
export type MultipleChoiceQuestion = {
|
|
14
14
|
type: 'mcq';
|
|
15
15
|
gameMedia?: Media;
|
|
16
|
-
question
|
|
16
|
+
question?: MultilingualLabel;
|
|
17
17
|
explanation?: MultilingualLabel;
|
|
18
18
|
explanationMedia?: Media;
|
|
19
19
|
multiselect?: boolean;
|
|
@@ -26,7 +26,7 @@ export type NoInteraction = {
|
|
|
26
26
|
type: 'no-interaction';
|
|
27
27
|
firstMedia?: Media;
|
|
28
28
|
secondMedia?: Media;
|
|
29
|
-
title
|
|
29
|
+
title?: MultilingualLabel;
|
|
30
30
|
text?: MultilingualLabel;
|
|
31
31
|
};
|
|
32
32
|
export type OpenQuestion = {
|
|
@@ -40,10 +40,10 @@ export type OpenQuestion = {
|
|
|
40
40
|
};
|
|
41
41
|
export type OrderingCards = {
|
|
42
42
|
type: 'ordering-cards';
|
|
43
|
-
explanation
|
|
44
|
-
question
|
|
45
|
-
topLabel
|
|
46
|
-
bottomLabel
|
|
43
|
+
explanation?: MultilingualLabel;
|
|
44
|
+
question?: MultilingualLabel;
|
|
45
|
+
topLabel?: MultilingualLabel;
|
|
46
|
+
bottomLabel?: MultilingualLabel;
|
|
47
47
|
cards: MultilingualLabel[];
|
|
48
48
|
};
|
|
49
49
|
export type PictureSpot = {
|
|
@@ -102,7 +102,6 @@ export declare const isGameSwipingCards: (game: Game) => game is SwipingCards;
|
|
|
102
102
|
export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Game>) => game is {
|
|
103
103
|
type?: "mcq" | undefined;
|
|
104
104
|
gameMedia?: {
|
|
105
|
-
id?: number | undefined;
|
|
106
105
|
image?: {
|
|
107
106
|
id?: number | undefined;
|
|
108
107
|
url?: string | undefined;
|
|
@@ -113,7 +112,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
113
112
|
video?: {
|
|
114
113
|
id?: number | undefined;
|
|
115
114
|
url?: string | undefined;
|
|
116
|
-
type?:
|
|
115
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
117
116
|
} | undefined;
|
|
118
117
|
} | undefined;
|
|
119
118
|
question?: {
|
|
@@ -189,7 +188,6 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
189
188
|
"th-TH"?: string | undefined;
|
|
190
189
|
} | undefined;
|
|
191
190
|
explanationMedia?: {
|
|
192
|
-
id?: number | undefined;
|
|
193
191
|
image?: {
|
|
194
192
|
id?: number | undefined;
|
|
195
193
|
url?: string | undefined;
|
|
@@ -200,7 +198,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
200
198
|
video?: {
|
|
201
199
|
id?: number | undefined;
|
|
202
200
|
url?: string | undefined;
|
|
203
|
-
type?:
|
|
201
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
204
202
|
} | undefined;
|
|
205
203
|
} | undefined;
|
|
206
204
|
multiselect?: boolean | undefined;
|
|
@@ -247,7 +245,6 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
|
|
|
247
245
|
export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game is {
|
|
248
246
|
type?: "error-text" | undefined;
|
|
249
247
|
gameMedia?: {
|
|
250
|
-
id?: number | undefined;
|
|
251
248
|
image?: {
|
|
252
249
|
id?: number | undefined;
|
|
253
250
|
url?: string | undefined;
|
|
@@ -258,11 +255,10 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
258
255
|
video?: {
|
|
259
256
|
id?: number | undefined;
|
|
260
257
|
url?: string | undefined;
|
|
261
|
-
type?:
|
|
258
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
262
259
|
} | undefined;
|
|
263
260
|
} | undefined;
|
|
264
261
|
explanationMedia?: {
|
|
265
|
-
id?: number | undefined;
|
|
266
262
|
image?: {
|
|
267
263
|
id?: number | undefined;
|
|
268
264
|
url?: string | undefined;
|
|
@@ -273,7 +269,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
273
269
|
video?: {
|
|
274
270
|
id?: number | undefined;
|
|
275
271
|
url?: string | undefined;
|
|
276
|
-
type?:
|
|
272
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
277
273
|
} | undefined;
|
|
278
274
|
} | undefined;
|
|
279
275
|
explanation?: {
|
|
@@ -388,7 +384,6 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
|
|
|
388
384
|
export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => game is {
|
|
389
385
|
type?: "open-question" | undefined;
|
|
390
386
|
gameMedia?: {
|
|
391
|
-
id?: number | undefined;
|
|
392
387
|
image?: {
|
|
393
388
|
id?: number | undefined;
|
|
394
389
|
url?: string | undefined;
|
|
@@ -399,7 +394,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
399
394
|
video?: {
|
|
400
395
|
id?: number | undefined;
|
|
401
396
|
url?: string | undefined;
|
|
402
|
-
type?:
|
|
397
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
403
398
|
} | undefined;
|
|
404
399
|
} | undefined;
|
|
405
400
|
question?: {
|
|
@@ -511,7 +506,6 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
511
506
|
"th-TH"?: string | undefined;
|
|
512
507
|
} | undefined;
|
|
513
508
|
explanationMedia?: {
|
|
514
|
-
id?: number | undefined;
|
|
515
509
|
image?: {
|
|
516
510
|
id?: number | undefined;
|
|
517
511
|
url?: string | undefined;
|
|
@@ -522,7 +516,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
522
516
|
video?: {
|
|
523
517
|
id?: number | undefined;
|
|
524
518
|
url?: string | undefined;
|
|
525
|
-
type?:
|
|
519
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
526
520
|
} | undefined;
|
|
527
521
|
} | undefined;
|
|
528
522
|
levenshteinDistance?: number | undefined;
|
|
@@ -530,7 +524,6 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
|
|
|
530
524
|
export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => game is {
|
|
531
525
|
type?: "no-interaction" | undefined;
|
|
532
526
|
firstMedia?: {
|
|
533
|
-
id?: number | undefined;
|
|
534
527
|
image?: {
|
|
535
528
|
id?: number | undefined;
|
|
536
529
|
url?: string | undefined;
|
|
@@ -541,11 +534,10 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
541
534
|
video?: {
|
|
542
535
|
id?: number | undefined;
|
|
543
536
|
url?: string | undefined;
|
|
544
|
-
type?:
|
|
537
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
545
538
|
} | undefined;
|
|
546
539
|
} | undefined;
|
|
547
540
|
secondMedia?: {
|
|
548
|
-
id?: number | undefined;
|
|
549
541
|
image?: {
|
|
550
542
|
id?: number | undefined;
|
|
551
543
|
url?: string | undefined;
|
|
@@ -556,7 +548,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
|
|
|
556
548
|
video?: {
|
|
557
549
|
id?: number | undefined;
|
|
558
550
|
url?: string | undefined;
|
|
559
|
-
type?:
|
|
551
|
+
type?: "Youtube" | "api.video" | "Kumullus" | undefined;
|
|
560
552
|
} | undefined;
|
|
561
553
|
} | undefined;
|
|
562
554
|
title?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content.js","sources":["../../../src/business/types/content.ts"],"sourcesContent":["import { DeepPartial } from 'ts-essentials';\n\nimport { LanguageCode, MultilingualLabel } from './multilingual';\nimport { Image, Media } from './media';\nimport { Thematic } from './thematic';\n\nexport type ErrorText = {\n type: 'error-text';\n gameMedia
|
|
1
|
+
{"version":3,"file":"content.js","sources":["../../../src/business/types/content.ts"],"sourcesContent":["import { DeepPartial } from 'ts-essentials';\n\nimport { LanguageCode, MultilingualLabel } from './multilingual';\nimport { Image, Media } from './media';\nimport { Thematic } from './thematic';\n\nexport type ErrorText = {\n type: 'error-text';\n gameMedia?: Media;\n explanationMedia?: Media;\n explanation?: MultilingualLabel;\n wrongText?: MultilingualLabel;\n correctText?: MultilingualLabel;\n};\n\nexport type MultipleChoiceQuestion = {\n type: 'mcq';\n gameMedia?: Media;\n question?: MultilingualLabel;\n explanation?: MultilingualLabel;\n explanationMedia?: Media;\n multiselect?: boolean;\n choices?: {\n correct: boolean;\n text: MultilingualLabel;\n }[];\n};\n\nexport type NoInteraction = {\n type: 'no-interaction';\n firstMedia?: Media;\n secondMedia?: Media;\n title?: MultilingualLabel;\n text?: MultilingualLabel;\n};\n\nexport type OpenQuestion = {\n type: 'open-question';\n gameMedia?: Media;\n question?: MultilingualLabel;\n answer?: MultilingualLabel;\n explanation?: MultilingualLabel;\n explanationMedia?: Media;\n levenshteinDistance?: number;\n};\n\nexport type OrderingCards = {\n type: 'ordering-cards';\n explanation?: MultilingualLabel;\n question?: MultilingualLabel;\n topLabel?: MultilingualLabel;\n bottomLabel?: MultilingualLabel;\n cards: MultilingualLabel[];\n};\n\nexport type PictureSpot = {\n type: 'picture-spot';\n image?: Image;\n explanation?: MultilingualLabel;\n items?: {\n x: number;\n y: number;\n r: number;\n question: MultilingualLabel;\n description: MultilingualLabel;\n }[];\n};\n\nexport type SwipingCardPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport type SwipingCards = {\n type: 'swiping-cards';\n explanation?: MultilingualLabel;\n question?: MultilingualLabel;\n zones?: {\n position: SwipingCardPosition;\n text: MultilingualLabel;\n }[];\n cards?: {\n image?: Image;\n text?: MultilingualLabel;\n answer: SwipingCardPosition;\n }[];\n};\n\nexport type Game =\n | ErrorText\n | MultipleChoiceQuestion\n | NoInteraction\n | OpenQuestion\n | OrderingCards\n | PictureSpot\n | SwipingCards;\n\nexport type GameType =\n | 'error-text'\n | 'mcq'\n | 'open-question'\n | 'no-interaction'\n | 'picture-spot'\n | 'swiping-cards'\n | 'ordering-cards';\n\nexport const GAME_TYPE: Record<string, GameType> = {\n MCQ: 'mcq',\n ERROR_TEXT: 'error-text',\n OPEN_QUESTION: 'open-question',\n NO_INTERACTION: 'no-interaction',\n PICTURE_SPOT: 'picture-spot',\n ORDERING_CARDS: 'ordering-cards',\n SWIPING_CARDS: 'swiping-cards',\n};\n\nexport type ContentStatuses = Partial<{\n [languageCode in LanguageCode]: 'draft' | 'validated' | 'waiting-translation' | 'waiting-validation';\n}>;\n\nexport type ContentMetadata = {\n identifier: string;\n coverImage?: Image;\n name: MultilingualLabel;\n thematic: Thematic;\n};\n\nexport type Content = {\n archived: boolean;\n id: number;\n metadata: ContentMetadata;\n statuses: ContentStatuses;\n game?: Game;\n};\n\nexport const isGameMultipleChoiceQuestion = (game: Game): game is MultipleChoiceQuestion => game.type === GAME_TYPE.MCQ;\nexport const isGameErrorText = (game: Game): game is ErrorText => game.type === GAME_TYPE.ERROR_TEXT;\nexport const isGameOpenQuestion = (game: Game): game is OpenQuestion => game.type === GAME_TYPE.OPEN_QUESTION;\nexport const isGameNoInteraction = (game: Game): game is NoInteraction => game.type === GAME_TYPE.NO_INTERACTION;\nexport const isGamePictureSpot = (game: Game): game is PictureSpot => game.type === GAME_TYPE.PICTURE_SPOT;\nexport const isGameOrderingCards = (game: Game): game is OrderingCards => game.type === GAME_TYPE.ORDERING_CARDS;\nexport const isGameSwipingCards = (game: Game): game is SwipingCards => game.type === GAME_TYPE.SWIPING_CARDS;\n\nexport const isPartialGameMultipleChoiceQuestion = (\n game: DeepPartial<Game>,\n): game is DeepPartial<MultipleChoiceQuestion> => game.type === GAME_TYPE.MCQ;\nexport const isPartialGameErrorText = (game: DeepPartial<Game>): game is DeepPartial<ErrorText> =>\n game.type === GAME_TYPE.ERROR_TEXT;\nexport const isPartialGameOpenQuestion = (game: DeepPartial<Game>): game is DeepPartial<OpenQuestion> =>\n game.type === GAME_TYPE.OPEN_QUESTION;\nexport const isPartialGameNoInteraction = (game: DeepPartial<Game>): game is DeepPartial<NoInteraction> =>\n game.type === GAME_TYPE.NO_INTERACTION;\nexport const isPartialGamePictureSpot = (game: DeepPartial<Game>): game is DeepPartial<PictureSpot> =>\n game.type === GAME_TYPE.PICTURE_SPOT;\nexport const isPartialGameOrderingCards = (game: DeepPartial<Game>): game is DeepPartial<OrderingCards> =>\n game.type === GAME_TYPE.ORDERING_CARDS;\nexport const isPartialGameSwipingCards = (game: DeepPartial<Game>): game is DeepPartial<SwipingCards> =>\n game.type === GAME_TYPE.SWIPING_CARDS;\n"],"names":[],"mappings":";;;;AAuGa,MAAA,SAAS,GAA6B;AACjD,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,aAAa,EAAE,eAAe;AAC9B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,YAAY,EAAE,cAAc;AAC5B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,aAAa,EAAE,eAAe;EAC9B;AAqBW,MAAA,4BAA4B,GAAG,CAAC,IAAU,KAAqC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;AAC3G,MAAA,eAAe,GAAG,CAAC,IAAU,KAAwB,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,WAAW;AACxF,MAAA,kBAAkB,GAAG,CAAC,IAAU,KAA2B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;AACjG,MAAA,mBAAmB,GAAG,CAAC,IAAU,KAA4B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AACpG,MAAA,iBAAiB,GAAG,CAAC,IAAU,KAA0B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa;AAC9F,MAAA,mBAAmB,GAAG,CAAC,IAAU,KAA4B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AACpG,MAAA,kBAAkB,GAAG,CAAC,IAAU,KAA2B,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;AAEjG,MAAA,mCAAmC,GAAG,CACjD,IAAuB,KACyB,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI;AACjE,MAAA,sBAAsB,GAAG,CAAC,IAAuB,KAC5D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,WAAW;AACxB,MAAA,yBAAyB,GAAG,CAAC,IAAuB,KAC/D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;AAC3B,MAAA,0BAA0B,GAAG,CAAC,IAAuB,KAChE,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AAC5B,MAAA,wBAAwB,GAAG,CAAC,IAAuB,KAC9D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,aAAa;AAC1B,MAAA,0BAA0B,GAAG,CAAC,IAAuB,KAChE,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,eAAe;AAC5B,MAAA,yBAAyB,GAAG,CAAC,IAAuB,KAC/D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;;;;;;;;;;;;;;;;;;"}
|
|
@@ -5,14 +5,12 @@ export type Image = {
|
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
};
|
|
8
|
-
export type VideoSourceType = 'Youtube' | 'api.video' | 'Kumullus' | 'unknown';
|
|
9
8
|
export type Video = {
|
|
10
9
|
id: number;
|
|
11
10
|
url: string;
|
|
12
|
-
type:
|
|
11
|
+
type: 'Youtube' | 'api.video' | 'Kumullus';
|
|
13
12
|
};
|
|
14
13
|
export type Media = {
|
|
15
|
-
id?: number;
|
|
16
14
|
image?: Image;
|
|
17
15
|
video?: Video;
|
|
18
16
|
};
|