@quesmed/types-rn 2.5.67 → 2.5.69

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.5.67",
3
+ "version": "2.5.69",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -78,7 +78,9 @@ export interface IRemoveFlaggedQuestionVar {
78
78
  export type IRemoveFlaggedQuestionData = RestrictedData<(graphqlNormalize & IUserFlaggedQuestion)[], 'removeFlaggedQuestion'>;
79
79
  export declare const MARK_FLAGGED_FIELD: import("@apollo/client").DocumentNode;
80
80
  export declare const updateCacheAddFlaggedQuestion: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddFlaggedQuestionData>) => void;
81
+ export declare const optimisticAddFlaggedQuestion: (id: number, markId: number) => IAddFlaggedQuestionData;
81
82
  export declare const updateCacheRemoveFlaggedQuestion: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IRemoveFlaggedQuestionData>) => void;
83
+ export declare const optimisticRemoveFlaggedQuestion: (id: number, markId: number) => IRemoveFlaggedQuestionData;
82
84
  /**
83
85
  * startOrJoinMarksheet
84
86
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TOGGLE_STRIKE_OPTIONS = exports.optimisticEndMarksheet = exports.updateCacheOnEndMarksheet = exports.END_MARKSHEET = exports.LEAVE_MARKSHEET = exports.MODIFY_CURRENT_MARKSHEET_MARK_FRAGMENT = exports.MODIFY_CURRENT_MARKSHEET_MARK = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID = exports.MODIFY_MARKSHEET_MARK_STRIKED_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_STRIKED = exports.MODIFY_MARKSHEET_MARK = exports.MODIFY_MARKSHEET_STATE_FRAGMENT = exports.MODIFY_MARKSHEET_STATE = exports.MODIFY_CURRENT_MARK_FRAGMENT = exports.MODIFY_TOPIC_SELECTION_FRAGMENT = exports.MODIFY_TOPIC_SELECTION = exports.MODIFY_BUILDER_CONFIG_FRAGMENT = exports.MODIFY_BUILDER_CONFIG = exports.MODIFY_MARKSHEET = exports.optimisticModifyMarksheetBuilderConfig = exports.START_OR_JOIN_MARKSHEET = exports.updateCacheRemoveFlaggedQuestion = exports.updateCacheAddFlaggedQuestion = exports.MARK_FLAGGED_FIELD = exports.REMOVE_FLAGGED_QUESTION = exports.ADD_FLAGGED_QUESTION = exports.optimisticSaveMarksheets = exports.updateMarksheets = exports.SAVE_MARKSHEET = exports.RE_BUILD_MARKSHEET = exports.BUILD_MARKSHEET = exports.BUILD_QUESTION_MARKSHEET = void 0;
3
+ exports.TOGGLE_STRIKE_OPTIONS = exports.optimisticEndMarksheet = exports.updateCacheOnEndMarksheet = exports.END_MARKSHEET = exports.LEAVE_MARKSHEET = exports.MODIFY_CURRENT_MARKSHEET_MARK_FRAGMENT = exports.MODIFY_CURRENT_MARKSHEET_MARK = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_QUESTIONCHOICEID = exports.MODIFY_MARKSHEET_MARK_STRIKED_FRAGMENT = exports.MODIFY_MARKSHEET_MARK_STRIKED = exports.MODIFY_MARKSHEET_MARK = exports.MODIFY_MARKSHEET_STATE_FRAGMENT = exports.MODIFY_MARKSHEET_STATE = exports.MODIFY_CURRENT_MARK_FRAGMENT = exports.MODIFY_TOPIC_SELECTION_FRAGMENT = exports.MODIFY_TOPIC_SELECTION = exports.MODIFY_BUILDER_CONFIG_FRAGMENT = exports.MODIFY_BUILDER_CONFIG = exports.MODIFY_MARKSHEET = exports.optimisticModifyMarksheetBuilderConfig = exports.START_OR_JOIN_MARKSHEET = exports.optimisticRemoveFlaggedQuestion = exports.updateCacheRemoveFlaggedQuestion = exports.optimisticAddFlaggedQuestion = exports.updateCacheAddFlaggedQuestion = exports.MARK_FLAGGED_FIELD = exports.REMOVE_FLAGGED_QUESTION = exports.ADD_FLAGGED_QUESTION = exports.optimisticSaveMarksheets = exports.updateMarksheets = exports.SAVE_MARKSHEET = exports.RE_BUILD_MARKSHEET = exports.BUILD_MARKSHEET = exports.BUILD_QUESTION_MARKSHEET = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const restricted_1 = require("../../query/restricted");
6
6
  exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
@@ -3105,6 +3105,22 @@ const updateCacheAddFlaggedQuestion = (cache, result) => {
3105
3105
  });
3106
3106
  };
3107
3107
  exports.updateCacheAddFlaggedQuestion = updateCacheAddFlaggedQuestion;
3108
+ const optimisticAddFlaggedQuestion = (id, markId) => {
3109
+ const response = {
3110
+ createdAt: new Date(),
3111
+ id,
3112
+ markId,
3113
+ };
3114
+ return {
3115
+ restricted: {
3116
+ addFlaggedQuestion: {
3117
+ __typename: 'UserFlaggedQuestion',
3118
+ ...response,
3119
+ },
3120
+ },
3121
+ };
3122
+ };
3123
+ exports.optimisticAddFlaggedQuestion = optimisticAddFlaggedQuestion;
3108
3124
  const updateCacheRemoveFlaggedQuestion = (cache, result) => {
3109
3125
  const { removeFlaggedQuestion } = result?.data?.restricted || {};
3110
3126
  if (!removeFlaggedQuestion) {
@@ -3121,6 +3137,23 @@ const updateCacheRemoveFlaggedQuestion = (cache, result) => {
3121
3137
  });
3122
3138
  };
3123
3139
  exports.updateCacheRemoveFlaggedQuestion = updateCacheRemoveFlaggedQuestion;
3140
+ const optimisticRemoveFlaggedQuestion = (id, markId) => {
3141
+ const response = {
3142
+ id,
3143
+ markId,
3144
+ };
3145
+ return {
3146
+ restricted: {
3147
+ removeFlaggedQuestion: [
3148
+ {
3149
+ __typename: 'UserFlaggedQuestion',
3150
+ ...response,
3151
+ },
3152
+ ],
3153
+ },
3154
+ };
3155
+ };
3156
+ exports.optimisticRemoveFlaggedQuestion = optimisticRemoveFlaggedQuestion;
3124
3157
  exports.START_OR_JOIN_MARKSHEET = (0, client_1.gql) `
3125
3158
  mutation StartOrJoinMarksheet($sessionId: String!, $action: Int!) {
3126
3159
  restricted {
@@ -48,6 +48,7 @@ export type IUpsertUserConceptStatusVar = {
48
48
  export type IUpsertUserConceptStatusData = RestrictedData<graphqlNormalize & IUserConceptStatus[], 'upsertUserConceptStatus'>;
49
49
  export declare const UPSERT_USER_CONCEPT_STATUS: import("@apollo/client").DocumentNode;
50
50
  export declare const updateCacheOnConceptLearningStatusUpdate: (topicId: number, prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserConceptStatusData>, options: ApolloUpdateOptions) => void;
51
+ export declare const optimisticConceptLearningStatus: (id: number, conceptIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserConceptStatusData;
51
52
  export type IUpsertUserStationStatusVar = {
52
53
  osceStationIds: Id[];
53
54
  status: EUserLearningStatus;
@@ -55,6 +56,7 @@ export type IUpsertUserStationStatusVar = {
55
56
  export type IUpsertUserStationStatusData = RestrictedData<graphqlNormalize & IUserStationStatus[], 'upsertUserStationStatus'>;
56
57
  export declare const UPSERT_USER_STATION_STATUS: import("@apollo/client").DocumentNode;
57
58
  export declare const updateCacheOnStationLearningStatusUpdate: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserStationStatusData>, options: ApolloUpdateOptions) => void;
59
+ export declare const optimisticStationLearningStatus: (id: number, osceStationIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserStationStatusData;
58
60
  export type IUpsertUserVideoStatusVar = {
59
61
  videoIds: Id[];
60
62
  status: EUserLearningStatus;
@@ -62,3 +64,4 @@ export type IUpsertUserVideoStatusVar = {
62
64
  export type IUpsertUserVideoStatusData = RestrictedData<graphqlNormalize & IUserVideoStatus[], 'upsertUserVideoStatus'>;
63
65
  export declare const UPSERT_USER_VIDEO_STATUS: import("@apollo/client").DocumentNode;
64
66
  export declare const updateCacheOnVideoLearningStatusUpdate: (prevStatus?: EUserLearningStatus | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpsertUserVideoStatusData>, options: ApolloUpdateOptions) => void;
67
+ export declare const optimisticVideoLearningStatus: (id: number, videoIds: number[], userId: number, status: EUserLearningStatus) => IUpsertUserVideoStatusData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_PROGRESS = void 0;
3
+ exports.optimisticVideoLearningStatus = exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.optimisticStationLearningStatus = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.optimisticConceptLearningStatus = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_PROGRESS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const models_1 = require("../../../models");
6
6
  exports.RESET_PROGRESS = (0, client_1.gql) `
@@ -144,6 +144,24 @@ const updateCacheOnConceptLearningStatusUpdate = (topicId, prevStatus) => (cache
144
144
  }
145
145
  };
146
146
  exports.updateCacheOnConceptLearningStatusUpdate = updateCacheOnConceptLearningStatusUpdate;
147
+ const optimisticConceptLearningStatus = (id, conceptIds, userId, status) => {
148
+ const response = {
149
+ userId,
150
+ status,
151
+ };
152
+ return {
153
+ restricted: {
154
+ upsertUserConceptStatus: conceptIds.map((conceptId) => ({
155
+ __typename: 'UserConceptStatus',
156
+ ...response,
157
+ createdAt: new Date(),
158
+ id,
159
+ conceptId,
160
+ })),
161
+ },
162
+ };
163
+ };
164
+ exports.optimisticConceptLearningStatus = optimisticConceptLearningStatus;
147
165
  exports.UPSERT_USER_STATION_STATUS = (0, client_1.gql) `
148
166
  mutation UpsertUserStationStatus($osceStationIds: [Int!]!, $status: Int!) {
149
167
  restricted {
@@ -183,6 +201,24 @@ const updateCacheOnStationLearningStatusUpdate = (cache, result, options) => {
183
201
  });
184
202
  };
185
203
  exports.updateCacheOnStationLearningStatusUpdate = updateCacheOnStationLearningStatusUpdate;
204
+ const optimisticStationLearningStatus = (id, osceStationIds, userId, status) => {
205
+ const response = {
206
+ userId,
207
+ status,
208
+ };
209
+ return {
210
+ restricted: {
211
+ upsertUserStationStatus: osceStationIds.map((osceStationId) => ({
212
+ __typename: 'UserStationStatus',
213
+ ...response,
214
+ createdAt: new Date(),
215
+ id,
216
+ osceStationId,
217
+ })),
218
+ },
219
+ };
220
+ };
221
+ exports.optimisticStationLearningStatus = optimisticStationLearningStatus;
186
222
  exports.UPSERT_USER_VIDEO_STATUS = (0, client_1.gql) `
187
223
  mutation UpsertUserVideoStatus($videoIds: [Int!]!, $status: Int!) {
188
224
  restricted {
@@ -291,3 +327,27 @@ const updateCacheOnVideoLearningStatusUpdate = (prevStatus) => (cache, result, o
291
327
  });
292
328
  };
293
329
  exports.updateCacheOnVideoLearningStatusUpdate = updateCacheOnVideoLearningStatusUpdate;
330
+ const optimisticVideoLearningStatus = (id, videoIds, userId, status) => {
331
+ const response = {
332
+ userId,
333
+ status,
334
+ };
335
+ // The video field is needed to updated not only the video status but related topics stats.
336
+ // We are not able to get this data for optimisitc response, as we don't have all videos
337
+ // with all their concepts in the cache, but we pass an empty object to let updae function works
338
+ // with no errors. In the case of offline mode the status of updated video on the video list
339
+ // or the status on the video view will be updated in the cahce and UI will be updated
340
+ return {
341
+ restricted: {
342
+ upsertUserVideoStatus: videoIds.map((videoId) => ({
343
+ __typename: 'UserVideoStatus',
344
+ ...response,
345
+ id,
346
+ createdAt: new Date(),
347
+ videoId,
348
+ video: {},
349
+ })),
350
+ },
351
+ };
352
+ };
353
+ exports.optimisticVideoLearningStatus = optimisticVideoLearningStatus;
@@ -6,6 +6,7 @@ export interface IPresetsVar {
6
6
  search?: string;
7
7
  timestamp?: number;
8
8
  limit?: number;
9
+ ascending?: boolean;
9
10
  }
10
11
  export type IPresetsData = RestrictedData<IPreset[], 'presets'>;
11
12
  export declare const PRESETS: import("@apollo/client").DocumentNode;
@@ -9,6 +9,7 @@ exports.PRESETS = (0, client_1.gql) `
9
9
  $search: String
10
10
  $timestamp: Int
11
11
  $limit: Int
12
+ $ascending: Boolean
12
13
  ) {
13
14
  restricted {
14
15
  presets(
@@ -17,6 +18,7 @@ exports.PRESETS = (0, client_1.gql) `
17
18
  search: $search
18
19
  timestamp: $timestamp
19
20
  limit: $limit
21
+ ascending: $ascending
20
22
  ) {
21
23
  id
22
24
  createdAt