@quesmed/types-rn 2.6.200 → 2.6.202

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.200",
3
+ "version": "2.6.202",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -70,7 +70,7 @@ export type IUpsertUserConceptStatusVar = {
70
70
  };
71
71
  export type IUpsertUserConceptStatusData = RestrictedData<graphqlNormalize & IUserConceptStatus[], 'upsertUserConceptStatus'>;
72
72
  export declare const UPSERT_USER_CONCEPT_STATUS: import("@apollo/client").DocumentNode;
73
- export declare const updateCacheOnConceptLearningStatusUpdate: (topicId: number, prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserConceptStatusData>, options: ApolloUpdateOptions) => void;
73
+ export declare const updateCacheOnConceptLearningStatusUpdate: (topicId: number, prevStatus?: EUserLearningStatus | null, entitlement?: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserConceptStatusData>, options: ApolloUpdateOptions) => void;
74
74
  export declare const optimisticConceptLearningStatus: (id: number, conceptIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserConceptStatusData;
75
75
  export type IUpsertUserStationStatusVar = {
76
76
  osceStationIds: Id[];
@@ -86,5 +86,5 @@ export type IUpsertUserVideoStatusVar = {
86
86
  };
87
87
  export type IUpsertUserVideoStatusData = RestrictedData<graphqlNormalize & IUserVideoStatus[], 'upsertUserVideoStatus'>;
88
88
  export declare const UPSERT_USER_VIDEO_STATUS: import("@apollo/client").DocumentNode;
89
- export declare const updateCacheOnVideoLearningStatusUpdate: (prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserVideoStatusData>, options: ApolloUpdateOptions) => void;
89
+ export declare const updateCacheOnVideoLearningStatusUpdate: (prevStatus?: EUserLearningStatus | null, entitlement?: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserVideoStatusData>, options: ApolloUpdateOptions) => void;
90
90
  export declare const optimisticVideoLearningStatus: (id: number, videoIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserVideoStatusData;
@@ -202,7 +202,7 @@ const getConceptUpdatedFieldNames = (newStatus, prevStatus) => [
202
202
  getConceptStatsFieldName(prevStatus),
203
203
  getConceptStatsFieldName(newStatus),
204
204
  ];
205
- const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache, result, options) => {
205
+ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus, entitlement) => (cache, result, options) => {
206
206
  const { upsertUserConceptStatus } = result?.data?.restricted || {};
207
207
  const { variables } = options || {};
208
208
  if (!variables || !upsertUserConceptStatus) {
@@ -212,17 +212,24 @@ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache
212
212
  conceptIds.forEach((id) => {
213
213
  cache.writeFragment({
214
214
  id: cache.identify({ id, __typename: 'Concept' }),
215
- data: {
216
- status,
217
- },
215
+ data: { status },
218
216
  fragment: STATUS_CONCEPT_FRAGMENT,
219
217
  });
220
218
  });
221
- const prevData = cache.readFragment({
222
- id: cache.identify({
223
- id: topicId,
224
- __typename: 'Topic',
219
+ const topicFragmentId = cache.identify({
220
+ id: topicId.toString(),
221
+ ...(entitlement && {
222
+ entitlement: {
223
+ __ref: cache.identify({
224
+ id: entitlement,
225
+ __typename: 'Entitlement',
226
+ }),
227
+ },
225
228
  }),
229
+ __typename: 'Topic',
230
+ });
231
+ const prevData = cache.readFragment({
232
+ id: topicFragmentId,
226
233
  fragment: TOPIC_CONCEPT_STATUS_STATS_FRAGMENT,
227
234
  });
228
235
  if (prevData) {
@@ -238,7 +245,7 @@ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache
238
245
  (prevData[prevStatName] || 0) - conceptIds.length;
239
246
  }
240
247
  cache.writeFragment({
241
- id: cache.identify({ id: topicId, __typename: 'Topic' }),
248
+ id: topicFragmentId,
242
249
  data: {
243
250
  ...newData,
244
251
  },
@@ -376,7 +383,7 @@ const getVideoUpdatedFieldNames = (newStatus, prevStatus) => [
376
383
  getVideoStatsFieldName(prevStatus),
377
384
  getVideoStatsFieldName(newStatus),
378
385
  ];
379
- const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, options) => {
386
+ const updateCacheOnVideoLearningStatusUpdate = (prevStatus, entitlement) => (cache, result, options) => {
380
387
  const { upsertUserVideoStatus } = result?.data?.restricted || {};
381
388
  const { variables } = options || {};
382
389
  if (!variables || !upsertUserVideoStatus) {
@@ -386,9 +393,7 @@ const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, o
386
393
  videoIds.forEach((id) => {
387
394
  cache.writeFragment({
388
395
  id: cache.identify({ id, __typename: 'Video' }),
389
- data: {
390
- status,
391
- },
396
+ data: { status },
392
397
  fragment: VIDEO_STATUS_FRAGMENT,
393
398
  });
394
399
  });
@@ -405,11 +410,20 @@ const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, o
405
410
  return;
406
411
  }
407
412
  [...topicIds].forEach((topicId) => {
408
- const prevData = cache.readFragment({
409
- id: cache.identify({
410
- id: topicId,
411
- __typename: 'Topic',
413
+ const topicFragmentId = cache.identify({
414
+ id: topicId.toString(),
415
+ ...(entitlement && {
416
+ entitlement: {
417
+ __ref: cache.identify({
418
+ id: entitlement,
419
+ __typename: 'Entitlement',
420
+ }),
421
+ },
412
422
  }),
423
+ __typename: 'Topic',
424
+ });
425
+ const prevData = cache.readFragment({
426
+ id: topicFragmentId,
413
427
  fragment: TOPIC_VIDEO_STATUS_STATS_FRAGMENT,
414
428
  });
415
429
  if (prevData) {
@@ -425,7 +439,7 @@ const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, o
425
439
  (prevData[prevStatName] || 0) - videoIds.length;
426
440
  }
427
441
  cache.writeFragment({
428
- id: cache.identify({ id: topicId, __typename: 'Topic' }),
442
+ id: topicFragmentId,
429
443
  data: {
430
444
  ...newData,
431
445
  },
@@ -134,8 +134,7 @@ exports.DASHBOARD_QBANK = (0, client_1.gql) `
134
134
  }
135
135
  `;
136
136
  exports.DASHBOARD = (0, client_1.gql) `
137
- ${fragments_1.PICTURE_FIELDS}
138
- query Dashboard($filter: MarksheetFilterInput!, $order: Int) {
137
+ query Dashboard {
139
138
  restricted {
140
139
  latestPastMarksheetId
141
140
  latestSessionId
@@ -149,99 +148,6 @@ exports.DASHBOARD = (0, client_1.gql) `
149
148
  }
150
149
  universityId
151
150
  classYear
152
- completedQuestionsCount
153
- completedCorrectQuestionsCount
154
- completedIncorrectQuestionsCount
155
- completedCards {
156
- id
157
- createdAt
158
- updatedAt
159
- concept {
160
- id
161
- name
162
- }
163
- lastSeen
164
- reviewDate
165
- score
166
- iteration
167
- optimalFactor
168
- cardId
169
- card {
170
- id
171
- conceptId
172
- concept {
173
- id
174
- name
175
- }
176
- topic {
177
- id
178
- name
179
- }
180
- question
181
- explanation
182
- pictures {
183
- ...PictureFields
184
- }
185
- }
186
- }
187
- completedCardsCount
188
- completedGreenCardsCount
189
- completedYellowCardsCount
190
- completedRedCardsCount
191
- marksheetsCount
192
- dailyProgress {
193
- date
194
- dateString
195
- intensity
196
- totalCorrect
197
- totalCount
198
- }
199
- userProgress {
200
- marksheetCount
201
- questionsCount
202
- daysInCurrentStreak
203
- daysInPreviousStreak
204
- daysInLongestStreak
205
- }
206
- }
207
- totalQuestions
208
- totalCards
209
- marksheets(filter: $filter) {
210
- results {
211
- id
212
- topicNames
213
- correct
214
- incorrect
215
- totalQuestions
216
- isTestMarksheet
217
- }
218
- total
219
- }
220
- topics(filter: 0, order: $order) {
221
- id
222
- name
223
- entitlement {
224
- id
225
- name
226
- index
227
- }
228
- totalQuestions
229
- correctQuestions
230
- incorrectQuestions
231
- totalCards
232
- greenCards
233
- yellowCards
234
- redCards
235
- dailyFeedCards
236
- }
237
- universityLeaderboard(limit: 3) {
238
- updatedAt
239
- month {
240
- id
241
- name
242
- speciality
243
- rank
244
- }
245
151
  }
246
152
  }
247
153
  }