@sparted/shared-library 1.7.30 → 1.7.32

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.
@@ -144,10 +144,11 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
144
144
  video?: {
145
145
  id?: number | undefined;
146
146
  url?: string | undefined;
147
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
147
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
148
148
  } | undefined;
149
149
  } | undefined;
150
150
  question?: {
151
+ id?: number | undefined;
151
152
  sk?: string | undefined;
152
153
  sl?: string | undefined;
153
154
  ar?: string | undefined;
@@ -185,6 +186,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
185
186
  } | undefined;
186
187
  choices?: ({
187
188
  text?: {
189
+ id?: number | undefined;
188
190
  sk?: string | undefined;
189
191
  sl?: string | undefined;
190
192
  ar?: string | undefined;
@@ -233,10 +235,11 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
233
235
  video?: {
234
236
  id?: number | undefined;
235
237
  url?: string | undefined;
236
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
238
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
237
239
  } | undefined;
238
240
  } | undefined;
239
241
  explanation?: {
242
+ id?: number | undefined;
240
243
  sk?: string | undefined;
241
244
  sl?: string | undefined;
242
245
  ar?: string | undefined;
@@ -287,10 +290,11 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
287
290
  video?: {
288
291
  id?: number | undefined;
289
292
  url?: string | undefined;
290
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
293
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
291
294
  } | undefined;
292
295
  } | undefined;
293
296
  wrongText?: {
297
+ id?: number | undefined;
294
298
  sk?: string | undefined;
295
299
  sl?: string | undefined;
296
300
  ar?: string | undefined;
@@ -327,6 +331,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
327
331
  "th-TH"?: string | undefined;
328
332
  } | undefined;
329
333
  correctText?: {
334
+ id?: number | undefined;
330
335
  sk?: string | undefined;
331
336
  sl?: string | undefined;
332
337
  ar?: string | undefined;
@@ -373,10 +378,11 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
373
378
  video?: {
374
379
  id?: number | undefined;
375
380
  url?: string | undefined;
376
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
381
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
377
382
  } | undefined;
378
383
  } | undefined;
379
384
  explanation?: {
385
+ id?: number | undefined;
380
386
  sk?: string | undefined;
381
387
  sl?: string | undefined;
382
388
  ar?: string | undefined;
@@ -427,10 +433,11 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
427
433
  video?: {
428
434
  id?: number | undefined;
429
435
  url?: string | undefined;
430
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
436
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
431
437
  } | undefined;
432
438
  } | undefined;
433
439
  question?: {
440
+ id?: number | undefined;
434
441
  sk?: string | undefined;
435
442
  sl?: string | undefined;
436
443
  ar?: string | undefined;
@@ -467,6 +474,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
467
474
  "th-TH"?: string | undefined;
468
475
  } | undefined;
469
476
  answer?: {
477
+ id?: number | undefined;
470
478
  sk?: string | undefined;
471
479
  sl?: string | undefined;
472
480
  ar?: string | undefined;
@@ -514,10 +522,11 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
514
522
  video?: {
515
523
  id?: number | undefined;
516
524
  url?: string | undefined;
517
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
525
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
518
526
  } | undefined;
519
527
  } | undefined;
520
528
  explanation?: {
529
+ id?: number | undefined;
521
530
  sk?: string | undefined;
522
531
  sl?: string | undefined;
523
532
  ar?: string | undefined;
@@ -568,10 +577,11 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
568
577
  video?: {
569
578
  id?: number | undefined;
570
579
  url?: string | undefined;
571
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
580
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
572
581
  } | undefined;
573
582
  } | undefined;
574
583
  title?: {
584
+ id?: number | undefined;
575
585
  sk?: string | undefined;
576
586
  sl?: string | undefined;
577
587
  ar?: string | undefined;
@@ -608,6 +618,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
608
618
  "th-TH"?: string | undefined;
609
619
  } | undefined;
610
620
  text?: {
621
+ id?: number | undefined;
611
622
  sk?: string | undefined;
612
623
  sl?: string | undefined;
613
624
  ar?: string | undefined;
@@ -654,7 +665,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
654
665
  video?: {
655
666
  id?: number | undefined;
656
667
  url?: string | undefined;
657
- type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
668
+ type?: "Youtube" | "api.video" | "Kumullus" | undefined;
658
669
  } | undefined;
659
670
  } | undefined;
660
671
  };
@@ -674,6 +685,7 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
674
685
  y?: number | undefined;
675
686
  r?: number | undefined;
676
687
  question?: {
688
+ id?: number | undefined;
677
689
  sk?: string | undefined;
678
690
  sl?: string | undefined;
679
691
  ar?: string | undefined;
@@ -710,6 +722,7 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
710
722
  "th-TH"?: string | undefined;
711
723
  } | undefined;
712
724
  description?: {
725
+ id?: number | undefined;
713
726
  sk?: string | undefined;
714
727
  sl?: string | undefined;
715
728
  ar?: string | undefined;
@@ -747,6 +760,7 @@ export declare const isPartialGamePictureSpot: (game: DeepPartial<Game>) => game
747
760
  } | undefined;
748
761
  } | undefined)[] | undefined;
749
762
  explanation?: {
763
+ id?: number | undefined;
750
764
  sk?: string | undefined;
751
765
  sl?: string | undefined;
752
766
  ar?: string | undefined;
@@ -787,6 +801,7 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
787
801
  id?: number | undefined;
788
802
  type?: "ordering-cards" | undefined;
789
803
  question?: {
804
+ id?: number | undefined;
790
805
  sk?: string | undefined;
791
806
  sl?: string | undefined;
792
807
  ar?: string | undefined;
@@ -823,6 +838,7 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
823
838
  "th-TH"?: string | undefined;
824
839
  } | undefined;
825
840
  topLabel?: {
841
+ id?: number | undefined;
826
842
  sk?: string | undefined;
827
843
  sl?: string | undefined;
828
844
  ar?: string | undefined;
@@ -859,6 +875,7 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
859
875
  "th-TH"?: string | undefined;
860
876
  } | undefined;
861
877
  cards?: ({
878
+ id?: number | undefined;
862
879
  sk?: string | undefined;
863
880
  sl?: string | undefined;
864
881
  ar?: string | undefined;
@@ -895,6 +912,7 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
895
912
  "th-TH"?: string | undefined;
896
913
  } | undefined)[] | undefined;
897
914
  bottomLabel?: {
915
+ id?: number | undefined;
898
916
  sk?: string | undefined;
899
917
  sl?: string | undefined;
900
918
  ar?: string | undefined;
@@ -931,6 +949,7 @@ export declare const isPartialGameOrderingCards: (game: DeepPartial<Game>) => ga
931
949
  "th-TH"?: string | undefined;
932
950
  } | undefined;
933
951
  explanation?: {
952
+ id?: number | undefined;
934
953
  sk?: string | undefined;
935
954
  sl?: string | undefined;
936
955
  ar?: string | undefined;
@@ -971,6 +990,7 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
971
990
  id?: number | undefined;
972
991
  type?: "swiping-cards" | undefined;
973
992
  question?: {
993
+ id?: number | undefined;
974
994
  sk?: string | undefined;
975
995
  sl?: string | undefined;
976
996
  ar?: string | undefined;
@@ -1009,6 +1029,7 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
1009
1029
  zones?: ({
1010
1030
  position?: SwipingCardPosition | undefined;
1011
1031
  text?: {
1032
+ id?: number | undefined;
1012
1033
  sk?: string | undefined;
1013
1034
  sl?: string | undefined;
1014
1035
  ar?: string | undefined;
@@ -1054,6 +1075,7 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
1054
1075
  height?: number | undefined;
1055
1076
  } | undefined;
1056
1077
  text?: {
1078
+ id?: number | undefined;
1057
1079
  sk?: string | undefined;
1058
1080
  sl?: string | undefined;
1059
1081
  ar?: string | undefined;
@@ -1092,6 +1114,7 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
1092
1114
  answer?: SwipingCardPosition | undefined;
1093
1115
  } | undefined)[] | undefined;
1094
1116
  explanation?: {
1117
+ id?: number | undefined;
1095
1118
  sk?: string | undefined;
1096
1119
  sl?: string | undefined;
1097
1120
  ar?: string | undefined;
@@ -1128,39 +1151,5 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
1128
1151
  "th-TH"?: string | undefined;
1129
1152
  } | undefined;
1130
1153
  };
1131
- export declare const extractExplanation: (content: Content) => Partial<{
1132
- sk: string;
1133
- sl: string;
1134
- ar: string;
1135
- lt: string;
1136
- "en-US": string;
1137
- "fr-FR": string;
1138
- "es-ES": string;
1139
- "it-IT": string;
1140
- "de-DE": string;
1141
- "ru-RU": string;
1142
- "nl-NL": string;
1143
- "pt-BR": string;
1144
- "zh-CN": string;
1145
- "he-IL": string;
1146
- "cs-CZ": string;
1147
- "ko-KR": string;
1148
- "ja-JP": string;
1149
- "zh-TW": string;
1150
- "bg-BG": string;
1151
- "hr-HR": string;
1152
- "da-DK": string;
1153
- "fi-FI": string;
1154
- "el-GR": string;
1155
- "hu-HU": string;
1156
- "nb-NO": string;
1157
- "pl-PL": string;
1158
- "pt-PT": string;
1159
- "ro-RO": string;
1160
- "sv-SE": string;
1161
- "tr-TR": string;
1162
- "et-EE": string;
1163
- "id-ID": string;
1164
- "lv-LV": string;
1165
- "th-TH": string;
1166
- }> | undefined;
1154
+ export declare const extractGameExplanation: (game?: Game) => MultilingualLabel | undefined;
1155
+ export declare const extractExplanation: (content: Content) => MultilingualLabel | undefined;
@@ -25,15 +25,19 @@ const isPartialGameNoInteraction = (game) => game.type === GAME_TYPE.NO_INTERACT
25
25
  const isPartialGamePictureSpot = (game) => game.type === GAME_TYPE.PICTURE_SPOT;
26
26
  const isPartialGameOrderingCards = (game) => game.type === GAME_TYPE.ORDERING_CARDS;
27
27
  const isPartialGameSwipingCards = (game) => game.type === GAME_TYPE.SWIPING_CARDS;
28
- const extractExplanation = (content) => {
29
- if (!content.game || content.game.type === 'no-interaction') {
28
+ const extractGameExplanation = (game) => {
29
+ if (!game || game.type === 'no-interaction') {
30
30
  return undefined;
31
31
  }
32
- return content.game.explanation;
32
+ return game.explanation;
33
+ };
34
+ const extractExplanation = (content) => {
35
+ return extractGameExplanation(content.game);
33
36
  };
34
37
 
35
38
  exports.GAME_TYPE = GAME_TYPE;
36
39
  exports.extractExplanation = extractExplanation;
40
+ exports.extractGameExplanation = extractGameExplanation;
37
41
  exports.isGameErrorText = isGameErrorText;
38
42
  exports.isGameMultipleChoiceQuestion = isGameMultipleChoiceQuestion;
39
43
  exports.isGameNoInteraction = isGameNoInteraction;
@@ -1 +1 @@
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';\nimport { PlayerProfile } from './player';\n\nexport type ContentStatuses = Partial<{\n [languageCode in LanguageCode]: 'draft' | 'validated' | 'waiting-translation' | 'waiting-validation';\n}>;\n\nexport type BOContentCard = {\n id: number;\n customId: string;\n coverImage?: Image;\n title: MultilingualLabel;\n statuses: ContentStatuses;\n};\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 ContentMetadata = {\n identifier: string;\n coverImage?: Image;\n name: MultilingualLabel;\n knowMore: MultilingualLabel;\n thematic: Thematic;\n type: GameType;\n};\n\nexport type ContributionType =\n | 'validated'\n | 'created'\n | 'edited'\n | 'deleted'\n | 'translation-requested'\n | 'translation-validated'\n | 'validation-requested';\n\nexport type ContentContribution = {\n id: number;\n contributor: PlayerProfile;\n type: ContributionType;\n date: Date;\n};\n\nexport type Content = {\n id: number;\n legacyKnowledgeId: number;\n legacyContentIds: number[];\n metadata: ContentMetadata;\n game?: Game;\n statuses: ContentStatuses;\n contributions: ContentContribution[];\n archived: boolean;\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\nexport const extractExplanation = (content: Content) => {\n if (!content.game || content.game.type === 'no-interaction') {\n return undefined;\n }\n\n return content.game.explanation;\n};\n"],"names":[],"mappings":";;;;AAmIa,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;AAsCW,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;AAC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;;;;;;;;;;;"}
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';\nimport { PlayerProfile } from './player';\n\nexport type ContentStatuses = Partial<{\n [languageCode in LanguageCode]: 'draft' | 'validated' | 'waiting-translation' | 'waiting-validation';\n}>;\n\nexport type BOContentCard = {\n id: number;\n customId: string;\n coverImage?: Image;\n title: MultilingualLabel;\n statuses: ContentStatuses;\n};\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 ContentMetadata = {\n identifier: string;\n coverImage?: Image;\n name: MultilingualLabel;\n knowMore: MultilingualLabel;\n thematic: Thematic;\n type: GameType;\n};\n\nexport type ContributionType =\n | 'validated'\n | 'created'\n | 'edited'\n | 'deleted'\n | 'translation-requested'\n | 'translation-validated'\n | 'validation-requested';\n\nexport type ContentContribution = {\n id: number;\n contributor: PlayerProfile;\n type: ContributionType;\n date: Date;\n};\n\nexport type Content = {\n id: number;\n legacyKnowledgeId: number;\n legacyContentIds: number[];\n metadata: ContentMetadata;\n game?: Game;\n statuses: ContentStatuses;\n contributions: ContentContribution[];\n archived: boolean;\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\nexport const extractGameExplanation = (game?: Game) => {\n if (!game || game.type === 'no-interaction') {\n return undefined;\n }\n\n return game.explanation;\n};\n\nexport const extractExplanation = (content: Content) => {\n return extractGameExplanation(content.game);\n};\n"],"names":[],"mappings":";;;;AAmIa,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,EA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AAC5B,MAAA,yBAAyB,GAAG,CAAC,IAAuB,KAC/D,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,cAAc;AAE3B,MAAA,sBAAsB,GAAG,CAAC,IAAW,KAAI;IACpD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE;AAC3C,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;IAED,OAAO,IAAI,CAAC,WAAW,CAAC;AAC1B,EAAE;AAEW,MAAA,kBAAkB,GAAG,CAAC,OAAgB,KAAI;AACrD,IAAA,OAAO,sBAAsB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9C;;;;;;;;;;;;;;;;;;;;"}
@@ -19,6 +19,7 @@ exports.isCampaignSchedulingManual = campaign.isCampaignSchedulingManual;
19
19
  exports.isCampaignSchedulingRandom = campaign.isCampaignSchedulingRandom;
20
20
  exports.GAME_TYPE = content.GAME_TYPE;
21
21
  exports.extractExplanation = content.extractExplanation;
22
+ exports.extractGameExplanation = content.extractGameExplanation;
22
23
  exports.isGameErrorText = content.isGameErrorText;
23
24
  exports.isGameMultipleChoiceQuestion = content.isGameMultipleChoiceQuestion;
24
25
  exports.isGameNoInteraction = content.isGameNoInteraction;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -8,7 +8,7 @@ export type Image = {
8
8
  export type Video = {
9
9
  id: number;
10
10
  url: string;
11
- type: 'Youtube' | 'api.video' | 'Kumullus' | 'Brightcove';
11
+ type: 'Youtube' | 'api.video' | 'Kumullus';
12
12
  };
13
13
  export type Media = {
14
14
  image?: Image;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparted/shared-library",
3
- "version": "1.7.30",
3
+ "version": "1.7.32",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": {
6
6
  "name": "Sparted",