@sparted/shared-library 1.7.18 → 1.7.20

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.
@@ -23,7 +23,7 @@ export type SharedActivityMetadata = {
23
23
  };
24
24
  export type CampaignActivity = SharedActivityMetadata & Campaign;
25
25
  export type Activity = CampaignActivity | BreakingNewsActivity;
26
- export declare const ACTIVITY_STATUS: readonly ["inactive", "archived", "upcoming", "live", "finished"];
26
+ export declare const ACTIVITY_STATUS: readonly ["draft", "inactive", "archived", "upcoming", "live", "finished"];
27
27
  export declare const isActivityCampaign: (activity: CampaignActivity | BreakingNewsActivity) => activity is CampaignActivity;
28
28
  export declare const isActivityBreakingNews: (activity: CampaignActivity | BreakingNewsActivity) => activity is BreakingNewsActivity;
29
29
  export {};
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const ACTIVITY_STATUS = ['inactive', 'archived', 'upcoming', 'live', 'finished'];
5
+ const ACTIVITY_STATUS = ['draft', 'inactive', 'archived', 'upcoming', 'live', 'finished'];
6
6
  const isActivityCampaign = (activity) => activity.type === 'campaign';
7
7
  const isActivityBreakingNews = (activity) => activity.type === 'breaking-news';
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"activity.js","sources":["../../../src/business/types/activity.ts"],"sourcesContent":["import { BreakingNewsActivity } from './breaking-news';\nimport type { Campaign } from './campaign';\nimport type { LanguageCode } from './multilingual';\n\ntype Segment = {\n id: number;\n label: string;\n dimensionId: number;\n};\n\nexport type ActivityAudience = {\n groupId: number;\n type: 'all' | 'segmentation' | 'magic-code' | 'email-list';\n segments: Segment[];\n};\n\nexport type ActivityStatus = (typeof ACTIVITY_STATUS)[number];\n\nexport type SharedActivityMetadata = {\n status: ActivityStatus;\n languages?: LanguageCode[];\n audiences?: ActivityAudience[];\n userEngagement?: {\n viewCount?: number;\n likeCount?: number;\n };\n};\n\nexport type CampaignActivity = SharedActivityMetadata & Campaign;\n\nexport type Activity = CampaignActivity | BreakingNewsActivity;\n\nexport const ACTIVITY_STATUS = ['inactive', 'archived', 'upcoming', 'live', 'finished'] as const;\n\nexport const isActivityCampaign = (activity: CampaignActivity | BreakingNewsActivity): activity is CampaignActivity =>\n activity.type === 'campaign';\n\nexport const isActivityBreakingNews = (\n activity: CampaignActivity | BreakingNewsActivity,\n): activity is BreakingNewsActivity => activity.type === 'breaking-news';\n"],"names":[],"mappings":";;;;AAgCO,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAW;AAE1F,MAAM,kBAAkB,GAAG,CAAC,QAAiD,KAClF,QAAQ,CAAC,IAAI,KAAK,WAAW;AAExB,MAAM,sBAAsB,GAAG,CACpC,QAAiD,KACZ,QAAQ,CAAC,IAAI,KAAK;;;;;;"}
1
+ {"version":3,"file":"activity.js","sources":["../../../src/business/types/activity.ts"],"sourcesContent":["import { BreakingNewsActivity } from './breaking-news';\nimport type { Campaign } from './campaign';\nimport type { LanguageCode } from './multilingual';\n\ntype Segment = {\n id: number;\n label: string;\n dimensionId: number;\n};\n\nexport type ActivityAudience = {\n groupId: number;\n type: 'all' | 'segmentation' | 'magic-code' | 'email-list';\n segments: Segment[];\n};\n\nexport type ActivityStatus = (typeof ACTIVITY_STATUS)[number];\n\nexport type SharedActivityMetadata = {\n status: ActivityStatus;\n languages?: LanguageCode[];\n audiences?: ActivityAudience[];\n userEngagement?: {\n viewCount?: number;\n likeCount?: number;\n };\n};\n\nexport type CampaignActivity = SharedActivityMetadata & Campaign;\n\nexport type Activity = CampaignActivity | BreakingNewsActivity;\n\nexport const ACTIVITY_STATUS = ['draft', 'inactive', 'archived', 'upcoming', 'live', 'finished'] as const;\n\nexport const isActivityCampaign = (activity: CampaignActivity | BreakingNewsActivity): activity is CampaignActivity =>\n activity.type === 'campaign';\n\nexport const isActivityBreakingNews = (\n activity: CampaignActivity | BreakingNewsActivity,\n): activity is BreakingNewsActivity => activity.type === 'breaking-news';\n"],"names":[],"mappings":";;;;AAgCa,MAAA,eAAe,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAW;AAEnG,MAAM,kBAAkB,GAAG,CAAC,QAAiD,KAClF,QAAQ,CAAC,IAAI,KAAK,WAAW;AAExB,MAAM,sBAAsB,GAAG,CACpC,QAAiD,KACZ,QAAQ,CAAC,IAAI,KAAK;;;;;;"}
@@ -125,7 +125,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
125
125
  video?: {
126
126
  id?: number | undefined;
127
127
  url?: string | undefined;
128
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
128
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
129
129
  } | undefined;
130
130
  } | undefined;
131
131
  question?: {
@@ -214,7 +214,7 @@ export declare const isPartialGameMultipleChoiceQuestion: (game: DeepPartial<Gam
214
214
  video?: {
215
215
  id?: number | undefined;
216
216
  url?: string | undefined;
217
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
217
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
218
218
  } | undefined;
219
219
  } | undefined;
220
220
  explanation?: {
@@ -268,7 +268,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
268
268
  video?: {
269
269
  id?: number | undefined;
270
270
  url?: string | undefined;
271
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
271
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
272
272
  } | undefined;
273
273
  } | undefined;
274
274
  wrongText?: {
@@ -354,7 +354,7 @@ export declare const isPartialGameErrorText: (game: DeepPartial<Game>) => game i
354
354
  video?: {
355
355
  id?: number | undefined;
356
356
  url?: string | undefined;
357
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
357
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
358
358
  } | undefined;
359
359
  } | undefined;
360
360
  explanation?: {
@@ -408,7 +408,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
408
408
  video?: {
409
409
  id?: number | undefined;
410
410
  url?: string | undefined;
411
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
411
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
412
412
  } | undefined;
413
413
  } | undefined;
414
414
  question?: {
@@ -495,7 +495,7 @@ export declare const isPartialGameOpenQuestion: (game: DeepPartial<Game>) => gam
495
495
  video?: {
496
496
  id?: number | undefined;
497
497
  url?: string | undefined;
498
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
498
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
499
499
  } | undefined;
500
500
  } | undefined;
501
501
  explanation?: {
@@ -549,7 +549,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
549
549
  video?: {
550
550
  id?: number | undefined;
551
551
  url?: string | undefined;
552
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
552
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
553
553
  } | undefined;
554
554
  } | undefined;
555
555
  title?: {
@@ -635,7 +635,7 @@ export declare const isPartialGameNoInteraction: (game: DeepPartial<Game>) => ga
635
635
  video?: {
636
636
  id?: number | undefined;
637
637
  url?: string | undefined;
638
- type?: "Youtube" | "api.video" | "Kumullus" | undefined;
638
+ type?: "Youtube" | "api.video" | "Kumullus" | "Brightcove" | undefined;
639
639
  } | undefined;
640
640
  } | undefined;
641
641
  };
@@ -1109,3 +1109,39 @@ export declare const isPartialGameSwipingCards: (game: DeepPartial<Game>) => gam
1109
1109
  "th-TH"?: string | undefined;
1110
1110
  } | undefined;
1111
1111
  };
1112
+ export declare const extractExplanation: (content: Content) => Partial<{
1113
+ sk: string;
1114
+ sl: string;
1115
+ ar: string;
1116
+ lt: string;
1117
+ "en-US": string;
1118
+ "fr-FR": string;
1119
+ "es-ES": string;
1120
+ "it-IT": string;
1121
+ "de-DE": string;
1122
+ "ru-RU": string;
1123
+ "nl-NL": string;
1124
+ "pt-BR": string;
1125
+ "zh-CN": string;
1126
+ "he-IL": string;
1127
+ "cs-CZ": string;
1128
+ "ko-KR": string;
1129
+ "ja-JP": string;
1130
+ "zh-TW": string;
1131
+ "bg-BG": string;
1132
+ "hr-HR": string;
1133
+ "da-DK": string;
1134
+ "fi-FI": string;
1135
+ "el-GR": string;
1136
+ "hu-HU": string;
1137
+ "nb-NO": string;
1138
+ "pl-PL": string;
1139
+ "pt-PT": string;
1140
+ "ro-RO": string;
1141
+ "sv-SE": string;
1142
+ "tr-TR": string;
1143
+ "et-EE": string;
1144
+ "id-ID": string;
1145
+ "lv-LV": string;
1146
+ "th-TH": string;
1147
+ }> | undefined;
@@ -24,9 +24,16 @@ const isPartialGameOpenQuestion = (game) => game.type === GAME_TYPE.OPEN_QUESTIO
24
24
  const isPartialGameNoInteraction = (game) => game.type === GAME_TYPE.NO_INTERACTION;
25
25
  const isPartialGamePictureSpot = (game) => game.type === GAME_TYPE.PICTURE_SPOT;
26
26
  const isPartialGameOrderingCards = (game) => game.type === GAME_TYPE.ORDERING_CARDS;
27
- const isPartialGameSwipingCards = (game) => game.type === GAME_TYPE.SWIPING_CARDS;
27
+ const isPartialGameSwipingCards = (game) => game.type === GAME_TYPE.SWIPING_CARDS;
28
+ const extractExplanation = (content) => {
29
+ if (!content.game || content.game.type === 'no-interaction') {
30
+ return undefined;
31
+ }
32
+ return content.game.explanation;
33
+ };
28
34
 
29
35
  exports.GAME_TYPE = GAME_TYPE;
36
+ exports.extractExplanation = extractExplanation;
30
37
  exports.isGameErrorText = isGameErrorText;
31
38
  exports.isGameMultipleChoiceQuestion = isGameMultipleChoiceQuestion;
32
39
  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';\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 type: GameType;\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;AAsBW,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 type: GameType;\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\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":";;;;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;AAsBW,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,cAAc;AAE3B,MAAA,kBAAkB,GAAG,CAAC,OAAgB,KAAI;AACrD,IAAA,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,gBAAgB,EAAE;AAC3D,QAAA,OAAO,SAAS,CAAC;AAClB,KAAA;AAED,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;AAClC;;;;;;;;;;;;;;;;;;;"}
@@ -14,6 +14,7 @@ exports.ACTIVITY_STATUS = activity.ACTIVITY_STATUS;
14
14
  exports.isActivityBreakingNews = activity.isActivityBreakingNews;
15
15
  exports.isActivityCampaign = activity.isActivityCampaign;
16
16
  exports.GAME_TYPE = content.GAME_TYPE;
17
+ exports.extractExplanation = content.extractExplanation;
17
18
  exports.isGameErrorText = content.isGameErrorText;
18
19
  exports.isGameMultipleChoiceQuestion = content.isGameMultipleChoiceQuestion;
19
20
  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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparted/shared-library",
3
- "version": "1.7.18",
3
+ "version": "1.7.20",
4
4
  "repository": "git@github.com:Sparted/shared-library.git",
5
5
  "author": {
6
6
  "name": "Sparted",