@sparted/shared-library 1.5.0-rc0 → 1.6.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.
@@ -34,4 +34,4 @@ export declare const getQuestions: (content: PictureSpot) => Partial<{
34
34
  "id-ID": string;
35
35
  "lv-LV": string;
36
36
  "th-TH": string;
37
- }>[] | undefined;
37
+ }>[];
@@ -1,77 +1,88 @@
1
1
  import { DeepPartial } from 'ts-essentials';
2
- import { LanguageCode, MultilingualLabel } from './multilingual';
3
2
  import { Image, Media } from './media';
3
+ import { LanguageCode, MultilingualLabel } from './multilingual';
4
4
  import { Thematic } from './thematic';
5
5
  export type ErrorText = {
6
+ id: number;
6
7
  type: 'error-text';
7
- gameMedia?: Media;
8
- explanationMedia?: Media;
9
- explanation?: MultilingualLabel;
10
- wrongText?: MultilingualLabel;
11
- correctText?: MultilingualLabel;
8
+ gameMedia: Media;
9
+ wrongText: MultilingualLabel;
10
+ correctText: MultilingualLabel;
11
+ explanationMedia: Media;
12
+ explanation: MultilingualLabel;
13
+ };
14
+ export type ChoiceQuestion = {
15
+ text: MultilingualLabel;
16
+ correct: boolean;
12
17
  };
13
18
  export type MultipleChoiceQuestion = {
19
+ id: number;
14
20
  type: 'mcq';
15
- gameMedia?: Media;
16
- question?: MultilingualLabel;
17
- explanation?: MultilingualLabel;
18
- explanationMedia?: Media;
19
- multiselect?: boolean;
20
- choices?: {
21
- correct: boolean;
22
- text: MultilingualLabel;
23
- }[];
21
+ gameMedia: Media;
22
+ question: MultilingualLabel;
23
+ choices: ChoiceQuestion[];
24
+ explanationMedia: Media;
25
+ explanation: MultilingualLabel;
24
26
  };
25
27
  export type NoInteraction = {
28
+ id: number;
26
29
  type: 'no-interaction';
27
- firstMedia?: Media;
28
- secondMedia?: Media;
29
- title?: MultilingualLabel;
30
- text?: MultilingualLabel;
30
+ firstMedia: Media;
31
+ title: MultilingualLabel;
32
+ text: MultilingualLabel;
33
+ secondMedia: Media;
31
34
  };
32
35
  export type OpenQuestion = {
36
+ id: number;
33
37
  type: 'open-question';
34
- gameMedia?: Media;
35
- question?: MultilingualLabel;
36
- answer?: MultilingualLabel;
37
- explanation?: MultilingualLabel;
38
- explanationMedia?: Media;
39
- levenshteinDistance?: number;
38
+ gameMedia: Media;
39
+ question: MultilingualLabel;
40
+ answer: MultilingualLabel;
41
+ levenshteinDistance: number;
42
+ explanationMedia: Media;
43
+ explanation: MultilingualLabel;
40
44
  };
41
45
  export type OrderingCards = {
46
+ id: number;
42
47
  type: 'ordering-cards';
43
- explanation?: MultilingualLabel;
44
- question?: MultilingualLabel;
45
- topLabel?: MultilingualLabel;
46
- bottomLabel?: MultilingualLabel;
48
+ question: MultilingualLabel;
49
+ topLabel: MultilingualLabel;
47
50
  cards: MultilingualLabel[];
51
+ bottomLabel: MultilingualLabel;
52
+ explanation: MultilingualLabel;
53
+ };
54
+ export type Spot = {
55
+ id: number;
56
+ x: number;
57
+ y: number;
58
+ r: number;
59
+ question: MultilingualLabel;
60
+ description: MultilingualLabel;
48
61
  };
49
62
  export type PictureSpot = {
63
+ id: number;
50
64
  type: 'picture-spot';
51
- image?: Image;
52
- explanation?: MultilingualLabel;
53
- items?: {
54
- x: number;
55
- y: number;
56
- r: number;
57
- question: MultilingualLabel;
58
- description: MultilingualLabel;
59
- }[];
65
+ image: Image;
66
+ items: Spot[];
67
+ explanation: MultilingualLabel;
60
68
  };
61
69
  export type SwipingCardPosition = 'left' | 'right' | 'top' | 'bottom';
70
+ export type SwipingCardZone = {
71
+ position: SwipingCardPosition;
72
+ text: MultilingualLabel;
73
+ };
74
+ export type SwipingCard = {
75
+ image?: Image;
76
+ text?: MultilingualLabel;
77
+ answer: SwipingCardPosition;
78
+ };
62
79
  export type SwipingCards = {
80
+ id: number;
63
81
  type: 'swiping-cards';
64
- explanation?: MultilingualLabel;
65
- question?: MultilingualLabel;
66
- zones?: {
67
- position: SwipingCardPosition;
68
- text: MultilingualLabel;
69
- }[];
70
- cards?: {
71
- image?: Image;
72
- text?: MultilingualLabel;
73
- answer: SwipingCardPosition;
74
- }[];
82
+ question: MultilingualLabel;
83
+ zones: SwipingCardZone[];
84
+ cards: SwipingCard[];
85
+ explanation: MultilingualLabel;
75
86
  };
76
87
  export type Game = ErrorText | MultipleChoiceQuestion | NoInteraction | OpenQuestion | OrderingCards | PictureSpot | SwipingCards;
77
88
  export type GameType = 'error-text' | 'mcq' | 'open-question' | 'no-interaction' | 'picture-spot' | 'swiping-cards' | 'ordering-cards';
@@ -100,6 +111,7 @@ export declare const isGamePictureSpot: (game: Game) => game is PictureSpot;
100
111
  export declare const isGameOrderingCards: (game: Game) => game is OrderingCards;
101
112
  export declare const isGameSwipingCards: (game: Game) => game is SwipingCards;
102
113
  export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Game>) => game is {
114
+ id?: number | undefined;
103
115
  type?: "mcq" | undefined;
104
116
  gameMedia?: {
105
117
  image?: {
@@ -151,59 +163,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
151
163
  "lv-LV"?: string | undefined;
152
164
  "th-TH"?: string | undefined;
153
165
  } | undefined;
154
- explanation?: {
155
- sk?: string | undefined;
156
- sl?: string | undefined;
157
- ar?: string | undefined;
158
- lt?: string | undefined;
159
- "en-US"?: string | undefined;
160
- "fr-FR"?: string | undefined;
161
- "es-ES"?: string | undefined;
162
- "it-IT"?: string | undefined;
163
- "de-DE"?: string | undefined;
164
- "ru-RU"?: string | undefined;
165
- "nl-NL"?: string | undefined;
166
- "pt-BR"?: string | undefined;
167
- "zh-CN"?: string | undefined;
168
- "he-IL"?: string | undefined;
169
- "cs-CZ"?: string | undefined;
170
- "ko-KR"?: string | undefined;
171
- "ja-JP"?: string | undefined;
172
- "zh-TW"?: string | undefined;
173
- "bg-BG"?: string | undefined;
174
- "hr-HR"?: string | undefined;
175
- "da-DK"?: string | undefined;
176
- "fi-FI"?: string | undefined;
177
- "el-GR"?: string | undefined;
178
- "hu-HU"?: string | undefined;
179
- "nb-NO"?: string | undefined;
180
- "pl-PL"?: string | undefined;
181
- "pt-PT"?: string | undefined;
182
- "ro-RO"?: string | undefined;
183
- "sv-SE"?: string | undefined;
184
- "tr-TR"?: string | undefined;
185
- "et-EE"?: string | undefined;
186
- "id-ID"?: string | undefined;
187
- "lv-LV"?: string | undefined;
188
- "th-TH"?: string | undefined;
189
- } | undefined;
190
- explanationMedia?: {
191
- image?: {
192
- id?: number | undefined;
193
- url?: string | undefined;
194
- filename?: string | undefined;
195
- width?: number | undefined;
196
- height?: number | undefined;
197
- } | undefined;
198
- video?: {
199
- id?: number | undefined;
200
- url?: string | undefined;
201
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
202
- } | undefined;
203
- } | undefined;
204
- multiselect?: boolean | undefined;
205
166
  choices?: ({
206
- correct?: boolean | undefined;
207
167
  text?: {
208
168
  sk?: string | undefined;
209
169
  sl?: string | undefined;
@@ -240,24 +200,8 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
240
200
  "lv-LV"?: string | undefined;
241
201
  "th-TH"?: string | undefined;
242
202
  } | undefined;
203
+ correct?: boolean | undefined;
243
204
  } | undefined)[] | undefined;
244
- };
245
- export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game is {
246
- type?: "error-text" | undefined;
247
- gameMedia?: {
248
- image?: {
249
- id?: number | undefined;
250
- url?: string | undefined;
251
- filename?: string | undefined;
252
- width?: number | undefined;
253
- height?: number | undefined;
254
- } | undefined;
255
- video?: {
256
- id?: number | undefined;
257
- url?: string | undefined;
258
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
259
- } | undefined;
260
- } | undefined;
261
205
  explanationMedia?: {
262
206
  image?: {
263
207
  id?: number | undefined;
@@ -308,6 +252,24 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
308
252
  "lv-LV"?: string | undefined;
309
253
  "th-TH"?: string | undefined;
310
254
  } | undefined;
255
+ };
256
+ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game is {
257
+ id?: number | undefined;
258
+ type?: "error-text" | undefined;
259
+ gameMedia?: {
260
+ image?: {
261
+ id?: number | undefined;
262
+ url?: string | undefined;
263
+ filename?: string | undefined;
264
+ width?: number | undefined;
265
+ height?: number | undefined;
266
+ } | undefined;
267
+ video?: {
268
+ id?: number | undefined;
269
+ url?: string | undefined;
270
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
271
+ } | undefined;
272
+ } | undefined;
311
273
  wrongText?: {
312
274
  sk?: string | undefined;
313
275
  sl?: string | undefined;
@@ -380,10 +342,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
380
342
  "lv-LV"?: string | undefined;
381
343
  "th-TH"?: string | undefined;
382
344
  } | undefined;
383
- };
384
- export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => game is {
385
- type?: "open-question" | undefined;
386
- gameMedia?: {
345
+ explanationMedia?: {
387
346
  image?: {
388
347
  id?: number | undefined;
389
348
  url?: string | undefined;
@@ -397,7 +356,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
397
356
  type?: "Youtube" | "api.video" | "Kumullus" | undefined;
398
357
  } | undefined;
399
358
  } | undefined;
400
- question?: {
359
+ explanation?: {
401
360
  sk?: string | undefined;
402
361
  sl?: string | undefined;
403
362
  ar?: string | undefined;
@@ -433,7 +392,25 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
433
392
  "lv-LV"?: string | undefined;
434
393
  "th-TH"?: string | undefined;
435
394
  } | undefined;
436
- answer?: {
395
+ };
396
+ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => game is {
397
+ id?: number | undefined;
398
+ type?: "open-question" | undefined;
399
+ gameMedia?: {
400
+ image?: {
401
+ id?: number | undefined;
402
+ url?: string | undefined;
403
+ filename?: string | undefined;
404
+ width?: number | undefined;
405
+ height?: number | undefined;
406
+ } | undefined;
407
+ video?: {
408
+ id?: number | undefined;
409
+ url?: string | undefined;
410
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
411
+ } | undefined;
412
+ } | undefined;
413
+ question?: {
437
414
  sk?: string | undefined;
438
415
  sl?: string | undefined;
439
416
  ar?: string | undefined;
@@ -469,7 +446,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
469
446
  "lv-LV"?: string | undefined;
470
447
  "th-TH"?: string | undefined;
471
448
  } | undefined;
472
- explanation?: {
449
+ answer?: {
473
450
  sk?: string | undefined;
474
451
  sl?: string | undefined;
475
452
  ar?: string | undefined;
@@ -505,39 +482,8 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
505
482
  "lv-LV"?: string | undefined;
506
483
  "th-TH"?: string | undefined;
507
484
  } | undefined;
508
- explanationMedia?: {
509
- image?: {
510
- id?: number | undefined;
511
- url?: string | undefined;
512
- filename?: string | undefined;
513
- width?: number | undefined;
514
- height?: number | undefined;
515
- } | undefined;
516
- video?: {
517
- id?: number | undefined;
518
- url?: string | undefined;
519
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
520
- } | undefined;
521
- } | undefined;
522
485
  levenshteinDistance?: number | undefined;
523
- };
524
- export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => game is {
525
- type?: "no-interaction" | undefined;
526
- firstMedia?: {
527
- image?: {
528
- id?: number | undefined;
529
- url?: string | undefined;
530
- filename?: string | undefined;
531
- width?: number | undefined;
532
- height?: number | undefined;
533
- } | undefined;
534
- video?: {
535
- id?: number | undefined;
536
- url?: string | undefined;
537
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
538
- } | undefined;
539
- } | undefined;
540
- secondMedia?: {
486
+ explanationMedia?: {
541
487
  image?: {
542
488
  id?: number | undefined;
543
489
  url?: string | undefined;
@@ -551,7 +497,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
551
497
  type?: "Youtube" | "api.video" | "Kumullus" | undefined;
552
498
  } | undefined;
553
499
  } | undefined;
554
- title?: {
500
+ explanation?: {
555
501
  sk?: string | undefined;
556
502
  sl?: string | undefined;
557
503
  ar?: string | undefined;
@@ -587,7 +533,25 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
587
533
  "lv-LV"?: string | undefined;
588
534
  "th-TH"?: string | undefined;
589
535
  } | undefined;
590
- text?: {
536
+ };
537
+ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => game is {
538
+ id?: number | undefined;
539
+ type?: "no-interaction" | undefined;
540
+ firstMedia?: {
541
+ image?: {
542
+ id?: number | undefined;
543
+ url?: string | undefined;
544
+ filename?: string | undefined;
545
+ width?: number | undefined;
546
+ height?: number | undefined;
547
+ } | undefined;
548
+ video?: {
549
+ id?: number | undefined;
550
+ url?: string | undefined;
551
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
552
+ } | undefined;
553
+ } | undefined;
554
+ title?: {
591
555
  sk?: string | undefined;
592
556
  sl?: string | undefined;
593
557
  ar?: string | undefined;
@@ -623,17 +587,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
623
587
  "lv-LV"?: string | undefined;
624
588
  "th-TH"?: string | undefined;
625
589
  } | undefined;
626
- };
627
- export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game is {
628
- type?: "picture-spot" | undefined;
629
- image?: {
630
- id?: number | undefined;
631
- url?: string | undefined;
632
- filename?: string | undefined;
633
- width?: number | undefined;
634
- height?: number | undefined;
635
- } | undefined;
636
- explanation?: {
590
+ text?: {
637
591
  sk?: string | undefined;
638
592
  sl?: string | undefined;
639
593
  ar?: string | undefined;
@@ -669,7 +623,33 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
669
623
  "lv-LV"?: string | undefined;
670
624
  "th-TH"?: string | undefined;
671
625
  } | undefined;
626
+ secondMedia?: {
627
+ image?: {
628
+ id?: number | undefined;
629
+ url?: string | undefined;
630
+ filename?: string | undefined;
631
+ width?: number | undefined;
632
+ height?: number | undefined;
633
+ } | undefined;
634
+ video?: {
635
+ id?: number | undefined;
636
+ url?: string | undefined;
637
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
638
+ } | undefined;
639
+ } | undefined;
640
+ };
641
+ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game is {
642
+ id?: number | undefined;
643
+ type?: "picture-spot" | undefined;
644
+ image?: {
645
+ id?: number | undefined;
646
+ url?: string | undefined;
647
+ filename?: string | undefined;
648
+ width?: number | undefined;
649
+ height?: number | undefined;
650
+ } | undefined;
672
651
  items?: ({
652
+ id?: number | undefined;
673
653
  x?: number | undefined;
674
654
  y?: number | undefined;
675
655
  r?: number | undefined;
@@ -746,9 +726,6 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
746
726
  "th-TH"?: string | undefined;
747
727
  } | undefined;
748
728
  } | undefined)[] | undefined;
749
- };
750
- export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => game is {
751
- type?: "ordering-cards" | undefined;
752
729
  explanation?: {
753
730
  sk?: string | undefined;
754
731
  sl?: string | undefined;
@@ -785,6 +762,10 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
785
762
  "lv-LV"?: string | undefined;
786
763
  "th-TH"?: string | undefined;
787
764
  } | undefined;
765
+ };
766
+ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => game is {
767
+ id?: number | undefined;
768
+ type?: "ordering-cards" | undefined;
788
769
  question?: {
789
770
  sk?: string | undefined;
790
771
  sl?: string | undefined;
@@ -857,7 +838,7 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
857
838
  "lv-LV"?: string | undefined;
858
839
  "th-TH"?: string | undefined;
859
840
  } | undefined;
860
- bottomLabel?: {
841
+ cards?: ({
861
842
  sk?: string | undefined;
862
843
  sl?: string | undefined;
863
844
  ar?: string | undefined;
@@ -892,8 +873,8 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
892
873
  "id-ID"?: string | undefined;
893
874
  "lv-LV"?: string | undefined;
894
875
  "th-TH"?: string | undefined;
895
- } | undefined;
896
- cards?: ({
876
+ } | undefined)[] | undefined;
877
+ bottomLabel?: {
897
878
  sk?: string | undefined;
898
879
  sl?: string | undefined;
899
880
  ar?: string | undefined;
@@ -928,10 +909,7 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
928
909
  "id-ID"?: string | undefined;
929
910
  "lv-LV"?: string | undefined;
930
911
  "th-TH"?: string | undefined;
931
- } | undefined)[] | undefined;
932
- };
933
- export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => game is {
934
- type?: "swiping-cards" | undefined;
912
+ } | undefined;
935
913
  explanation?: {
936
914
  sk?: string | undefined;
937
915
  sl?: string | undefined;
@@ -968,6 +946,10 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
968
946
  "lv-LV"?: string | undefined;
969
947
  "th-TH"?: string | undefined;
970
948
  } | undefined;
949
+ };
950
+ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => game is {
951
+ id?: number | undefined;
952
+ type?: "swiping-cards" | undefined;
971
953
  question?: {
972
954
  sk?: string | undefined;
973
955
  sl?: string | undefined;
@@ -1089,4 +1071,40 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
1089
1071
  } | undefined;
1090
1072
  answer?: SwipingCardPosition | undefined;
1091
1073
  } | undefined)[] | undefined;
1074
+ explanation?: {
1075
+ sk?: string | undefined;
1076
+ sl?: string | undefined;
1077
+ ar?: string | undefined;
1078
+ lt?: string | undefined;
1079
+ "en-US"?: string | undefined;
1080
+ "fr-FR"?: string | undefined;
1081
+ "es-ES"?: string | undefined;
1082
+ "it-IT"?: string | undefined;
1083
+ "de-DE"?: string | undefined;
1084
+ "ru-RU"?: string | undefined;
1085
+ "nl-NL"?: string | undefined;
1086
+ "pt-BR"?: string | undefined;
1087
+ "zh-CN"?: string | undefined;
1088
+ "he-IL"?: string | undefined;
1089
+ "cs-CZ"?: string | undefined;
1090
+ "ko-KR"?: string | undefined;
1091
+ "ja-JP"?: string | undefined;
1092
+ "zh-TW"?: string | undefined;
1093
+ "bg-BG"?: string | undefined;
1094
+ "hr-HR"?: string | undefined;
1095
+ "da-DK"?: string | undefined;
1096
+ "fi-FI"?: string | undefined;
1097
+ "el-GR"?: string | undefined;
1098
+ "hu-HU"?: string | undefined;
1099
+ "nb-NO"?: string | undefined;
1100
+ "pl-PL"?: string | undefined;
1101
+ "pt-PT"?: string | undefined;
1102
+ "ro-RO"?: string | undefined;
1103
+ "sv-SE"?: string | undefined;
1104
+ "tr-TR"?: string | undefined;
1105
+ "et-EE"?: string | undefined;
1106
+ "id-ID"?: string | undefined;
1107
+ "lv-LV"?: string | undefined;
1108
+ "th-TH"?: string | undefined;
1109
+ } | undefined;
1092
1110
  };
@@ -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?: 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;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"content.js","sources":["../../../src/business/types/content.ts"],"sourcesContent":["import { DeepPartial } from 'ts-essentials';\n\nimport { Image, Media } from './media';\nimport { LanguageCode, MultilingualLabel } from './multilingual';\nimport { Thematic } from './thematic';\n\nexport type ErrorText = {\n id: number;\n type: 'error-text';\n gameMedia: Media;\n wrongText: MultilingualLabel;\n correctText: MultilingualLabel;\n explanationMedia: Media;\n explanation: MultilingualLabel;\n};\n\nexport type ChoiceQuestion = {\n text: MultilingualLabel;\n correct: boolean;\n};\n\nexport type MultipleChoiceQuestion = {\n id: number;\n type: 'mcq';\n gameMedia: Media;\n question: MultilingualLabel;\n choices: ChoiceQuestion[];\n explanationMedia: Media;\n explanation: MultilingualLabel;\n};\n\nexport type NoInteraction = {\n id: number;\n type: 'no-interaction';\n firstMedia: Media;\n title: MultilingualLabel;\n text: MultilingualLabel;\n secondMedia: Media;\n};\n\nexport type OpenQuestion = {\n id: number;\n type: 'open-question';\n gameMedia: Media;\n question: MultilingualLabel;\n answer: MultilingualLabel;\n levenshteinDistance: number;\n explanationMedia: Media;\n explanation: MultilingualLabel;\n};\n\nexport type OrderingCards = {\n id: number;\n type: 'ordering-cards';\n question: MultilingualLabel;\n topLabel: MultilingualLabel;\n cards: MultilingualLabel[];\n bottomLabel: MultilingualLabel;\n explanation: MultilingualLabel;\n};\n\nexport type Spot = {\n id: number;\n x: number;\n y: number;\n r: number;\n question: MultilingualLabel;\n description: MultilingualLabel;\n};\n\nexport type PictureSpot = {\n id: number;\n type: 'picture-spot';\n image: Image;\n items: Spot[];\n explanation: MultilingualLabel;\n};\n\nexport type SwipingCardPosition = 'left' | 'right' | 'top' | 'bottom';\n\nexport type SwipingCardZone = {\n position: SwipingCardPosition;\n text: MultilingualLabel;\n};\n\nexport type SwipingCard = {\n image?: Image;\n text?: MultilingualLabel;\n answer: SwipingCardPosition;\n};\n\nexport type SwipingCards = {\n id: number;\n type: 'swiping-cards';\n question: MultilingualLabel;\n zones: SwipingCardZone[];\n cards: SwipingCard[];\n explanation: MultilingualLabel;\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":";;;;AAsHa,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;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparted/shared-library",
3
- "version": "1.5.0-rc0",
3
+ "version": "1.6.0",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": {
6
6
  "name": "Sparted",