@quesmed/types-rn 2.5.87 → 2.5.89

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.
@@ -1,6 +1,10 @@
1
1
  import { ETopicType, ITopic } from './Topic';
2
2
  import { Id } from './Type';
3
3
  import { IUniversity } from './University';
4
+ export declare enum EPresetType {
5
+ PRE_DEFINED = 0,
6
+ CUSTOM = 1
7
+ }
4
8
  export interface IPreset {
5
9
  id: Id;
6
10
  createdAt: number | Date;
package/models/Preset.js CHANGED
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EPresetType = void 0;
4
+ var EPresetType;
5
+ (function (EPresetType) {
6
+ EPresetType[EPresetType["PRE_DEFINED"] = 0] = "PRE_DEFINED";
7
+ EPresetType[EPresetType["CUSTOM"] = 1] = "CUSTOM";
8
+ })(EPresetType = exports.EPresetType || (exports.EPresetType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.5.87",
3
+ "version": "2.5.89",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -8,13 +8,13 @@ export type IDeletePresetData = RestrictedData<boolean, 'deletePreset'>;
8
8
  export interface IDeletePresetVar {
9
9
  presetId: number;
10
10
  }
11
- export declare const updateCacheOnDeletePrest: (userId: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IDeletePresetData>, options: ApolloUpdateOptions) => void;
11
+ export declare const updateCacheOnDeletePrest: () => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IDeletePresetData>, options: ApolloUpdateOptions) => void;
12
12
  export declare const DUPLICATE_PRESET: import("@apollo/client").DocumentNode;
13
13
  export type IDuplicatePresetData = RestrictedData<IPreset, 'duplicatePreset'>;
14
14
  export interface IDuplicatePresetVar {
15
15
  presetId: number;
16
16
  }
17
- export declare const updateCacheOnDuplicatePreset: (userId: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IDuplicatePresetData>) => void;
17
+ export declare const updateCacheOnDuplicatePreset: () => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IDuplicatePresetData>) => void;
18
18
  export declare const EDIT_PRESET: import("@apollo/client").DocumentNode;
19
19
  export type IEditPresetData = RestrictedData<IPreset, 'editPreset'>;
20
20
  export interface IEditPresetVar {
@@ -34,4 +34,4 @@ export interface ICreatePresetVar {
34
34
  conceptIds: Id[];
35
35
  };
36
36
  }
37
- export declare const updateCacheOnCreatePreset: (userId: number) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICreatePresetData>) => void;
37
+ export declare const updateCacheOnCreatePreset: () => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICreatePresetData>) => void;
@@ -11,13 +11,13 @@ exports.DELETE_PRESET = (0, client_1.gql) `
11
11
  }
12
12
  }
13
13
  `;
14
- const updateCacheOnDeletePrest = (userId) => (cache, result, options) => {
14
+ const updateCacheOnDeletePrest = () => (cache, result, options) => {
15
15
  const { deletePreset } = result?.data?.restricted || {};
16
16
  const { variables } = options || {};
17
17
  const { presetId } = variables || {};
18
18
  if (deletePreset && presetId) {
19
19
  const prevData = cache.readQuery({
20
- variables: { userId: Number(userId), order: __1.ESortOrder.DESC },
20
+ variables: { order: __1.ESortOrder.DESC },
21
21
  query: restricted_1.PRESETS,
22
22
  });
23
23
  if (prevData) {
@@ -30,7 +30,7 @@ const updateCacheOnDeletePrest = (userId) => (cache, result, options) => {
30
30
  ];
31
31
  cache.writeQuery({
32
32
  query: restricted_1.PRESETS,
33
- variables: { userId: Number(userId), order: __1.ESortOrder.DESC },
33
+ variables: { order: __1.ESortOrder.DESC },
34
34
  data: {
35
35
  ...prevData,
36
36
  restricted: {
@@ -81,18 +81,18 @@ exports.DUPLICATE_PRESET = (0, client_1.gql) `
81
81
  }
82
82
  }
83
83
  `;
84
- const updateCacheOnDuplicatePreset = (userId) => (cache, result) => {
84
+ const updateCacheOnDuplicatePreset = () => (cache, result) => {
85
85
  const { duplicatePreset } = result?.data?.restricted || {};
86
86
  if (duplicatePreset) {
87
87
  const prevData = cache.readQuery({
88
- variables: { userId: Number(userId), order: __1.ESortOrder.DESC },
88
+ variables: { order: __1.ESortOrder.DESC },
89
89
  query: restricted_1.PRESETS,
90
90
  });
91
91
  if (prevData) {
92
92
  const { presets } = prevData.restricted || {};
93
93
  cache.writeQuery({
94
94
  query: restricted_1.PRESETS,
95
- variables: { userId: Number(userId), order: __1.ESortOrder.DESC },
95
+ variables: { order: __1.ESortOrder.DESC },
96
96
  data: {
97
97
  ...prevData,
98
98
  restricted: {
@@ -179,18 +179,18 @@ exports.CREATE_PRESET = (0, client_1.gql) `
179
179
  }
180
180
  }
181
181
  `;
182
- const updateCacheOnCreatePreset = (userId) => (cache, result) => {
182
+ const updateCacheOnCreatePreset = () => (cache, result) => {
183
183
  const { createPreset } = result?.data?.restricted || {};
184
184
  if (createPreset) {
185
185
  const prevData = cache.readQuery({
186
- variables: { userId },
186
+ variables: {},
187
187
  query: restricted_1.PRESETS,
188
188
  });
189
189
  if (prevData) {
190
190
  const { presets } = prevData.restricted || {};
191
191
  cache.writeQuery({
192
192
  query: restricted_1.PRESETS,
193
- variables: { userId: Number(userId) },
193
+ variables: {},
194
194
  data: {
195
195
  ...prevData,
196
196
  restricted: {
@@ -2,7 +2,6 @@ import { ETopicType, IPreset, Id } from '../../../models';
2
2
  import { ESortOrder } from '../../enums';
3
3
  import { RestrictedData } from '../../types';
4
4
  export interface IPresetsVar {
5
- userId?: Id;
6
5
  topicType?: ETopicType;
7
6
  search?: string;
8
7
  timestamp?: number;
@@ -11,6 +10,12 @@ export interface IPresetsVar {
11
10
  }
12
11
  export type IPresetsData = RestrictedData<IPreset[], 'presets'>;
13
12
  export declare const PRESETS: import("@apollo/client").DocumentNode;
13
+ export interface IPreDefinedPresetsVar {
14
+ search?: string;
15
+ order?: ESortOrder;
16
+ }
17
+ export type IPreDefinedPresetsData = RestrictedData<IPreset[], 'preDefinedPresets'>;
18
+ export declare const PRE_DEFINED_PRESETS: import("@apollo/client").DocumentNode;
14
19
  export interface IPresetVar {
15
20
  id: Id;
16
21
  }
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PRESET = exports.PRESETS = void 0;
3
+ exports.PRESET = exports.PRE_DEFINED_PRESETS = exports.PRESETS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  exports.PRESETS = (0, client_1.gql) `
6
6
  query Presets(
7
- $userId: Int
8
7
  $topicType: Int
9
8
  $search: String
10
9
  $timestamp: Int
@@ -13,7 +12,6 @@ exports.PRESETS = (0, client_1.gql) `
13
12
  ) {
14
13
  restricted {
15
14
  presets(
16
- userId: $userId
17
15
  topicType: $topicType
18
16
  search: $search
19
17
  timestamp: $timestamp
@@ -53,6 +51,43 @@ exports.PRESETS = (0, client_1.gql) `
53
51
  }
54
52
  }
55
53
  `;
54
+ exports.PRE_DEFINED_PRESETS = (0, client_1.gql) `
55
+ query PreDefinedPresets($search: String, $order: Int) {
56
+ restricted {
57
+ preDefinedPresets(search: $search, order: $order) {
58
+ id
59
+ createdAt
60
+ updatedAt
61
+ name
62
+ likes
63
+ topicType
64
+ correctQuestions
65
+ incorrectQuestions
66
+ completedQuestions
67
+ totalQuestions
68
+ yellowCards
69
+ greenCards
70
+ redCards
71
+ completedCards
72
+ totalCards
73
+ userId
74
+ university {
75
+ id
76
+ name
77
+ country
78
+ }
79
+ topics {
80
+ id
81
+ name
82
+ concepts {
83
+ id
84
+ name
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ `;
56
91
  exports.PRESET = (0, client_1.gql) `
57
92
  query Preset($id: Int!) {
58
93
  restricted {
@@ -3,12 +3,15 @@ import { RestrictedData, graphqlNormalize } from '../../types';
3
3
  export type IQuesBookVar = {
4
4
  /**TODO: make it mandatory once frontend changes are completed */
5
5
  typeId?: ETopicType[];
6
+ videosOnly?: boolean;
6
7
  };
7
8
  export type IQuesBookData = RestrictedData<(graphqlNormalize & ITopic)[], 'quesBook'>;
8
9
  export declare const QUES_BOOK: import("@apollo/client").DocumentNode;
10
+ export declare const PUBLIC_QUES_BOOK: import("@apollo/client").DocumentNode;
9
11
  export type IOsceBookVar = {
10
12
  /**TODO: make it mandatory once frontend changes are completed */
11
13
  typeId?: EOsceType[];
14
+ videosOnly?: boolean;
12
15
  };
13
16
  export type IOsceBookData = RestrictedData<(graphqlNormalize & IOsceStation)[], 'osceBook'>;
14
17
  export declare const OSCE_BOOK: import("@apollo/client").DocumentNode;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OSCE_BOOK = exports.QUES_BOOK = void 0;
3
+ exports.OSCE_BOOK = exports.PUBLIC_QUES_BOOK = exports.QUES_BOOK = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const osce_1 = require("./../../fragments/osce");
6
6
  exports.QUES_BOOK = (0, client_1.gql) `
7
- query quesBook($typeId: [Int]) {
7
+ query quesBook($typeId: [Int], $videosOnly: Boolean) {
8
8
  restricted {
9
- quesBook(typeId: $typeId) {
9
+ quesBook(typeId: $typeId, videosOnly: $videosOnly) {
10
10
  id
11
11
  name
12
12
  typeId
@@ -62,11 +62,68 @@ exports.QUES_BOOK = (0, client_1.gql) `
62
62
  }
63
63
  }
64
64
  `;
65
+ exports.PUBLIC_QUES_BOOK = (0, client_1.gql) `
66
+ query PublicQuesBook($typeId: [Int], $videosOnly: Boolean) {
67
+ quesBook(typeId: $typeId, videosOnly: $videosOnly) {
68
+ id
69
+ name
70
+ typeId
71
+ demo
72
+ unreadConcepts
73
+ completedConcepts
74
+ revisingConcepts
75
+ urgentConcepts
76
+ unwatchedVideos
77
+ completedVideos
78
+ revisingVideos
79
+ urgentVideos
80
+ concepts {
81
+ id
82
+ name
83
+ demo
84
+ status
85
+ totalCards
86
+ totalQuestions
87
+ chapter {
88
+ id
89
+ typeId
90
+ explanation
91
+ pictures {
92
+ id
93
+ createdAt
94
+ updatedAt
95
+ name
96
+ caption
97
+ path
98
+ path512
99
+ path256
100
+ index
101
+ }
102
+ }
103
+ topicId
104
+ videos {
105
+ id
106
+ status
107
+ title
108
+ museId
109
+ thumbnail
110
+ concepts {
111
+ id
112
+ name
113
+ }
114
+ live
115
+ description
116
+ duration
117
+ }
118
+ }
119
+ }
120
+ }
121
+ `;
65
122
  exports.OSCE_BOOK = (0, client_1.gql) `
66
123
  ${osce_1.OSCE_STATION_FIELDS}
67
- query OsceBook($typeId: [Int]) {
124
+ query OsceBook($typeId: [Int], $videosOnly: Boolean) {
68
125
  restricted {
69
- osceBook(typeId: $typeId) {
126
+ osceBook(typeId: $typeId, videosOnly: $videosOnly) {
70
127
  ...OsceStationFields
71
128
  lastOsceMarksheetId
72
129
  score