@quesmed/types-rn 2.6.68 → 2.6.70

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.68",
3
+ "version": "2.6.70",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -39,11 +39,11 @@ export declare const getChapterHighlightOptimisticResponse: (userId: number, hig
39
39
  updatedAt: number;
40
40
  deletedAt: number;
41
41
  highlights: {
42
+ part: string;
42
43
  start: number;
43
44
  end: number;
44
45
  text: string;
45
46
  color: string;
46
- part?: string | undefined;
47
47
  tag: string;
48
48
  __typename: string;
49
49
  }[];
@@ -7,9 +7,17 @@ const fragments_1 = require("../../fragments");
7
7
  * upsertChapterNote
8
8
  */
9
9
  exports.UPSERT_CHAPTER_NOTE = (0, client_1.gql) `
10
- mutation UpsertChapterNote($chapterId: Int!, $note: String!, $marksheetId: Int) {
10
+ mutation UpsertChapterNote(
11
+ $chapterId: Int!
12
+ $note: String!
13
+ $marksheetId: Int
14
+ ) {
11
15
  restricted {
12
- upsertChapterNote(chapterId: $chapterId, note: $note, marksheetId: $marksheetId) {
16
+ upsertChapterNote(
17
+ chapterId: $chapterId
18
+ note: $note
19
+ marksheetId: $marksheetId
20
+ ) {
13
21
  id
14
22
  chapterId
15
23
  userId
@@ -113,6 +121,7 @@ const getChapterHighlightOptimisticResponse = (userId, highlights, chapterId) =>
113
121
  tag: '',
114
122
  color: '',
115
123
  ...highlight,
124
+ part: highlight.part || '',
116
125
  })),
117
126
  __typename: 'ChapterHighlight',
118
127
  },
@@ -400,10 +400,10 @@ const updateQuestionLearningPoint = (typeId) => (cache, result, options) => {
400
400
  return;
401
401
  }
402
402
  try {
403
- for (const { id, userPoint } of addQuestionLearningPoint) {
403
+ for (const { questionId, userPoint } of addQuestionLearningPoint) {
404
404
  cache.writeFragment({
405
405
  id: cache.identify({
406
- id,
406
+ id: questionId,
407
407
  __typename: (0, exports.getQuestionTypeName)(typeId),
408
408
  }),
409
409
  data: {
@@ -1,5 +1,5 @@
1
1
  import { ApolloCache } from '@apollo/client';
2
- import { IVideo, Id } from '../../../models';
2
+ import { EEntitlementType, IVideo, Id } from '../../../models';
3
3
  import { ApolloUpdateResultRestricted } from '../../apollo';
4
4
  import { RestrictedData, graphqlNormalize } from '../../types';
5
5
  export declare const VIDEO_WATCHED: import("@apollo/client").DocumentNode;
@@ -7,4 +7,4 @@ export interface IVideoWatchedVar {
7
7
  id: Id;
8
8
  }
9
9
  export type IVideoWatchedData = RestrictedData<graphqlNormalize & IVideo, 'videoWatched'>;
10
- export declare const updateCacheOnVideoWatched: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IVideoWatchedData>) => void;
10
+ export declare const updateCacheOnVideoWatched: (entitlementId?: EEntitlementType | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IVideoWatchedData>) => void;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateCacheOnVideoWatched = exports.VIDEO_WATCHED = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const fragments_1 = require("../../fragments");
6
+ const osce_1 = require("../../query/restricted/osce");
6
7
  exports.VIDEO_WATCHED = (0, client_1.gql) `
7
8
  mutation VideoWatched($id: Int!) {
8
9
  restricted {
@@ -14,7 +15,7 @@ exports.VIDEO_WATCHED = (0, client_1.gql) `
14
15
  }
15
16
  }
16
17
  `;
17
- const updateCacheOnVideoWatched = (cache, result) => {
18
+ const updateCacheOnVideoWatched = (entitlementId) => (cache, result) => {
18
19
  const { videoWatched } = result?.data?.restricted || {};
19
20
  if (!videoWatched) {
20
21
  return;
@@ -27,5 +28,34 @@ const updateCacheOnVideoWatched = (cache, result) => {
27
28
  },
28
29
  fragment: fragments_1.VIDEO_USER_VIEWED_FRAGMENT,
29
30
  });
31
+ if (entitlementId) {
32
+ const prevOsceStats = cache?.readQuery({
33
+ query: osce_1.OSCE_STATS,
34
+ variables: { solo: true },
35
+ });
36
+ if (prevOsceStats) {
37
+ const { completed, types } = prevOsceStats.restricted.osceStats;
38
+ cache.writeQuery({
39
+ query: osce_1.OSCE_STATS,
40
+ data: {
41
+ ...prevOsceStats,
42
+ restricted: {
43
+ ...prevOsceStats.restricted,
44
+ osceStats: {
45
+ ...prevOsceStats.restricted.osceStats,
46
+ completed: Number(completed) + 1,
47
+ types: types?.map(({ id, completed, ...rest }) => ({
48
+ id,
49
+ completed: Number(id) === Number(entitlementId)
50
+ ? Number(completed) + 1
51
+ : completed,
52
+ ...rest,
53
+ })),
54
+ },
55
+ },
56
+ },
57
+ });
58
+ }
59
+ }
30
60
  };
31
61
  exports.updateCacheOnVideoWatched = updateCacheOnVideoWatched;