@quesmed/types-rn 2.4.11 → 2.4.12

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.
@@ -79,6 +79,26 @@ export interface IQuestion {
79
79
  dislikes?: number;
80
80
  isLikedByMe?: EQuestionLike;
81
81
  comments?: IQuestionComment[];
82
+ highlights?: Array<IHighlight>;
83
+ }
84
+ export interface IHighlight {
85
+ start: number;
86
+ end: number;
87
+ text: string;
88
+ color?: string;
89
+ part?: string;
90
+ tag?: string;
91
+ }
92
+ export interface IQuestionHighlights {
93
+ id: Id;
94
+ createdAt: number | Date;
95
+ updatedAt: number | Date;
96
+ deletedAt: number | Date;
97
+ userId?: Id;
98
+ questionId?: Id;
99
+ user?: IUser;
100
+ question?: IQuestion;
101
+ highlights?: Array<IHighlight>;
82
102
  }
83
103
  export interface IQuestionChoice {
84
104
  id: Id;
package/models/User.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { ICard } from './Card';
2
2
  import { IConcept } from './Concept';
3
3
  import { IMarksheet, IMarksheetMark } from './Marksheet';
4
+ import { IQuestionHighlights } from './Question';
4
5
  import { INotification } from './Notification';
5
6
  import { IQuestion } from './Question';
6
7
  import { ISubscription } from './Subscription';
@@ -93,6 +94,7 @@ export interface IUser {
93
94
  qbankSubscriptionEndDate: number | Date | null;
94
95
  osceSubscriptionEndDate: number | Date | null;
95
96
  bundleSubscriptionEndDate: number | Date | null;
97
+ questionHighlights?: IQuestionHighlights[];
96
98
  }
97
99
  export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
98
100
  export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.4.11",
3
+ "version": "2.4.12",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -68,6 +68,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
68
68
  question
69
69
  totalVotes
70
70
  typeId
71
+ highlights {
72
+ start
73
+ end
74
+ text
75
+ part
76
+ tag
77
+ color
78
+ }
71
79
  choices {
72
80
  id
73
81
  explanation
@@ -188,6 +196,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
188
196
  question
189
197
  totalVotes
190
198
  typeId
199
+ highlights {
200
+ start
201
+ end
202
+ text
203
+ part
204
+ tag
205
+ color
206
+ }
191
207
  choices {
192
208
  id
193
209
  explanation
@@ -311,6 +327,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
311
327
  question
312
328
  totalVotes
313
329
  typeId
330
+ highlights {
331
+ start
332
+ end
333
+ text
334
+ part
335
+ tag
336
+ color
337
+ }
314
338
  choices {
315
339
  id
316
340
  explanation
@@ -431,6 +455,14 @@ exports.BUILD_QUESTION_MARKSHEET = (0, client_1.gql) `
431
455
  question
432
456
  totalVotes
433
457
  typeId
458
+ highlights {
459
+ start
460
+ end
461
+ text
462
+ part
463
+ tag
464
+ color
465
+ }
434
466
  choices {
435
467
  id
436
468
  explanation
@@ -646,6 +678,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
646
678
  question
647
679
  totalVotes
648
680
  typeId
681
+ highlights {
682
+ start
683
+ end
684
+ text
685
+ part
686
+ tag
687
+ color
688
+ }
649
689
  choices {
650
690
  id
651
691
  explanation
@@ -766,6 +806,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
766
806
  question
767
807
  totalVotes
768
808
  typeId
809
+ highlights {
810
+ start
811
+ end
812
+ text
813
+ part
814
+ tag
815
+ color
816
+ }
769
817
  choices {
770
818
  id
771
819
  explanation
@@ -889,6 +937,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
889
937
  question
890
938
  totalVotes
891
939
  typeId
940
+ highlights {
941
+ start
942
+ end
943
+ text
944
+ part
945
+ tag
946
+ color
947
+ }
892
948
  choices {
893
949
  id
894
950
  explanation
@@ -1009,6 +1065,14 @@ exports.BUILD_MARKSHEET = (0, client_1.gql) `
1009
1065
  question
1010
1066
  totalVotes
1011
1067
  typeId
1068
+ highlights {
1069
+ start
1070
+ end
1071
+ text
1072
+ part
1073
+ tag
1074
+ color
1075
+ }
1012
1076
  choices {
1013
1077
  id
1014
1078
  explanation
@@ -1229,6 +1293,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1229
1293
  question
1230
1294
  totalVotes
1231
1295
  typeId
1296
+ highlights {
1297
+ start
1298
+ end
1299
+ text
1300
+ part
1301
+ tag
1302
+ color
1303
+ }
1232
1304
  choices {
1233
1305
  id
1234
1306
  explanation
@@ -1349,6 +1421,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1349
1421
  question
1350
1422
  totalVotes
1351
1423
  typeId
1424
+ highlights {
1425
+ start
1426
+ end
1427
+ text
1428
+ part
1429
+ tag
1430
+ color
1431
+ }
1352
1432
  choices {
1353
1433
  id
1354
1434
  explanation
@@ -1472,6 +1552,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1472
1552
  question
1473
1553
  totalVotes
1474
1554
  typeId
1555
+ highlights {
1556
+ start
1557
+ end
1558
+ text
1559
+ part
1560
+ tag
1561
+ color
1562
+ }
1475
1563
  choices {
1476
1564
  id
1477
1565
  explanation
@@ -1592,6 +1680,14 @@ exports.RE_BUILD_MARKSHEET = (0, client_1.gql) `
1592
1680
  question
1593
1681
  totalVotes
1594
1682
  typeId
1683
+ highlights {
1684
+ start
1685
+ end
1686
+ text
1687
+ part
1688
+ tag
1689
+ color
1690
+ }
1595
1691
  choices {
1596
1692
  id
1597
1693
  explanation
@@ -1,6 +1,6 @@
1
1
  import { ApolloCache, DocumentNode } from '@apollo/client';
2
2
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../..';
3
- import { EQuestionLike, EQuestionType, Id, IQuestion, IQuestionComment } from '../../../models';
3
+ import { EQuestionLike, EQuestionType, Id, IHighlight, IQuestion, IQuestionComment, IQuestionHighlights } from '../../../models';
4
4
  import { graphqlNormalize, RestrictedData } from '../../types';
5
5
  interface LikeData {
6
6
  likes?: number;
@@ -9,9 +9,14 @@ interface LikeData {
9
9
  }
10
10
  export declare const QUESTION_SBA_COMMENT_FIELDS: DocumentNode;
11
11
  export declare const QUESTION_QA_COMMENT_FIELDS: DocumentNode;
12
+ export declare const QUESTION_QA_HIGHLIGHT_FIELDS: DocumentNode;
13
+ export declare const QUESTION_SBA_HIGHLIGHT_FIELDS: DocumentNode;
14
+ export declare const QUESTION_MULTIA_HIGHLIGHT_FIELDS: DocumentNode;
15
+ export declare const QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS: DocumentNode;
12
16
  export declare const QUESTION_MULTIA_COMMENT_FIELDS: DocumentNode;
13
17
  export declare const QUESTION_PRESCRIPTION_COMMENT_FIELDS: DocumentNode;
14
18
  export declare const getLikeData: (like: EQuestionLike, item: LikeData) => LikeData;
19
+ export declare const getQuestionHighlightsFragment: (typeId: EQuestionType) => DocumentNode;
15
20
  export declare const getQuestionTypeName: (typeId: EQuestionType) => string;
16
21
  export declare const QUESTION_LIKE: DocumentNode;
17
22
  export declare const optimisticQuestionLike: (input: IQuestionLikeVar, question: IQuestion) => IQuestionLikeData;
@@ -52,4 +57,16 @@ export interface IQuestionCommentRemoveVar {
52
57
  commentId: Id;
53
58
  }
54
59
  export declare type IQuestionCommentRemoveData = RestrictedData<graphqlNormalize & IQuestionComment, 'questionCommentRemove'>;
60
+ /**
61
+ * addQuestionHighlight
62
+ */
63
+ export interface IAddQuestionHighlightVar {
64
+ input: {
65
+ questionId: Id;
66
+ highlights: IHighlight[];
67
+ }[];
68
+ }
69
+ export declare type IAddQuestionHighlightData = RestrictedData<(graphqlNormalize & IQuestionHighlights)[], 'addQuestionHighlight'>;
70
+ export declare const ADD_QUESTION_HIGHLIGHT: DocumentNode;
71
+ export declare const updateQuestionHighlights: (typeId: EQuestionType) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IAddQuestionHighlightData>, options: ApolloUpdateOptions) => void;
55
72
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optimisticQuestionCommentRemove = exports.updateQuestionCommentsRemove = exports.QUESTION_COMMENT_REMOVE = exports.optimisticCommentLike = exports.QUESTION_COMMENT_LIKE = exports.optimisticQuestionComment = exports.updateQuestionComments = exports.QUESTION_COMMENTS = exports.optimisticQuestionLike = exports.QUESTION_LIKE = exports.getQuestionTypeName = exports.getLikeData = exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = exports.QUESTION_MULTIA_COMMENT_FIELDS = exports.QUESTION_QA_COMMENT_FIELDS = exports.QUESTION_SBA_COMMENT_FIELDS = void 0;
3
+ exports.updateQuestionHighlights = exports.ADD_QUESTION_HIGHLIGHT = exports.optimisticQuestionCommentRemove = exports.updateQuestionCommentsRemove = exports.QUESTION_COMMENT_REMOVE = exports.optimisticCommentLike = exports.QUESTION_COMMENT_LIKE = exports.optimisticQuestionComment = exports.updateQuestionComments = exports.QUESTION_COMMENTS = exports.optimisticQuestionLike = exports.QUESTION_LIKE = exports.getQuestionTypeName = exports.getQuestionHighlightsFragment = exports.getLikeData = exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = exports.QUESTION_MULTIA_COMMENT_FIELDS = exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS = exports.QUESTION_SBA_HIGHLIGHT_FIELDS = exports.QUESTION_QA_HIGHLIGHT_FIELDS = exports.QUESTION_QA_COMMENT_FIELDS = exports.QUESTION_SBA_COMMENT_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const models_1 = require("../../../models");
6
6
  exports.QUESTION_SBA_COMMENT_FIELDS = (0, client_1.gql) `
@@ -9,6 +9,14 @@ exports.QUESTION_SBA_COMMENT_FIELDS = (0, client_1.gql) `
9
9
  likes
10
10
  dislikes
11
11
  isLikedByMe
12
+ highlights {
13
+ start
14
+ end
15
+ text
16
+ part
17
+ tag
18
+ color
19
+ }
12
20
  comments {
13
21
  id
14
22
  createdAt
@@ -45,6 +53,14 @@ exports.QUESTION_QA_COMMENT_FIELDS = (0, client_1.gql) `
45
53
  likes
46
54
  dislikes
47
55
  isLikedByMe
56
+ highlights {
57
+ start
58
+ end
59
+ text
60
+ part
61
+ tag
62
+ color
63
+ }
48
64
  comments {
49
65
  id
50
66
  createdAt
@@ -75,12 +91,68 @@ exports.QUESTION_QA_COMMENT_FIELDS = (0, client_1.gql) `
75
91
  }
76
92
  }
77
93
  `;
94
+ exports.QUESTION_QA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
95
+ fragment QuestionQAHighlights on QuestionQA {
96
+ highlights {
97
+ start
98
+ end
99
+ text
100
+ part
101
+ tag
102
+ color
103
+ }
104
+ }
105
+ `;
106
+ exports.QUESTION_SBA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
107
+ fragment QuestionSBAHighlights on QuestionSBA {
108
+ highlights {
109
+ start
110
+ end
111
+ text
112
+ part
113
+ tag
114
+ color
115
+ }
116
+ }
117
+ `;
118
+ exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS = (0, client_1.gql) `
119
+ fragment QuestionMultiAHighlights on QuestionMultiA {
120
+ highlights {
121
+ start
122
+ end
123
+ text
124
+ part
125
+ tag
126
+ color
127
+ }
128
+ }
129
+ `;
130
+ exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS = (0, client_1.gql) `
131
+ fragment QuestionPrescriptionHighlights on QuestionPrescription {
132
+ highlights {
133
+ start
134
+ end
135
+ text
136
+ part
137
+ tag
138
+ color
139
+ }
140
+ }
141
+ `;
78
142
  exports.QUESTION_MULTIA_COMMENT_FIELDS = (0, client_1.gql) `
79
143
  fragment QuestionMultiAComments on QuestionMultiA {
80
144
  id
81
145
  likes
82
146
  dislikes
83
147
  isLikedByMe
148
+ highlights {
149
+ start
150
+ end
151
+ text
152
+ part
153
+ tag
154
+ color
155
+ }
84
156
  comments {
85
157
  id
86
158
  createdAt
@@ -117,6 +189,14 @@ exports.QUESTION_PRESCRIPTION_COMMENT_FIELDS = (0, client_1.gql) `
117
189
  likes
118
190
  dislikes
119
191
  isLikedByMe
192
+ highlights {
193
+ start
194
+ end
195
+ text
196
+ part
197
+ tag
198
+ color
199
+ }
120
200
  comments {
121
201
  id
122
202
  createdAt
@@ -172,6 +252,20 @@ const getLikeData = (like, item) => {
172
252
  return { likes, dislikes, isLikedByMe: like };
173
253
  };
174
254
  exports.getLikeData = getLikeData;
255
+ const getQuestionHighlightsFragment = (typeId) => {
256
+ switch (typeId) {
257
+ case models_1.EQuestionType.QUESTION_ANSWER:
258
+ return exports.QUESTION_QA_HIGHLIGHT_FIELDS;
259
+ case models_1.EQuestionType.PRESCRIPTION_ANSWER:
260
+ return exports.QUESTION_PRESCRIPTION_HIGHLIGHT_FIELDS;
261
+ case models_1.EQuestionType.MULTIPLE_ANSWERS:
262
+ return exports.QUESTION_MULTIA_HIGHLIGHT_FIELDS;
263
+ case models_1.EQuestionType.SINGLE_BEST_ANSWER:
264
+ default:
265
+ return exports.QUESTION_SBA_HIGHLIGHT_FIELDS;
266
+ }
267
+ };
268
+ exports.getQuestionHighlightsFragment = getQuestionHighlightsFragment;
175
269
  const getQuestionTypeName = (typeId) => {
176
270
  switch (typeId) {
177
271
  case models_1.EQuestionType.QUESTION_ANSWER:
@@ -527,3 +621,48 @@ const optimisticQuestionCommentRemove = (comments, input, parentId) => {
527
621
  };
528
622
  };
529
623
  exports.optimisticQuestionCommentRemove = optimisticQuestionCommentRemove;
624
+ exports.ADD_QUESTION_HIGHLIGHT = (0, client_1.gql) `
625
+ mutation AddHighlight($input: [AddQuestionHighlightInput!]!) {
626
+ restricted {
627
+ addQuestionHighlight(input: $input) {
628
+ id
629
+ questionId
630
+ userId
631
+ highlights {
632
+ start
633
+ end
634
+ text
635
+ part
636
+ tag
637
+ color
638
+ }
639
+ }
640
+ }
641
+ }
642
+ `;
643
+ const updateQuestionHighlights = (typeId) => (cache, result, options) => {
644
+ const { addQuestionHighlight } = result?.data?.restricted ?? {};
645
+ const { variables } = options || {};
646
+ if (!variables || !addQuestionHighlight) {
647
+ return;
648
+ }
649
+ const { input } = variables;
650
+ try {
651
+ input.forEach(({ questionId }) => {
652
+ cache.writeFragment({
653
+ id: cache.identify({
654
+ id: questionId,
655
+ __typename: (0, exports.getQuestionTypeName)(typeId),
656
+ }),
657
+ data: {
658
+ highlights: addQuestionHighlight[0].highlights,
659
+ },
660
+ fragment: (0, exports.getQuestionHighlightsFragment)(typeId),
661
+ });
662
+ });
663
+ }
664
+ catch (error) {
665
+ console.error(error);
666
+ }
667
+ };
668
+ exports.updateQuestionHighlights = updateQuestionHighlights;
@@ -74,6 +74,14 @@ exports.MARKSHEET = (0, client_1.gql) `
74
74
  question
75
75
  totalVotes
76
76
  typeId
77
+ highlights {
78
+ start
79
+ end
80
+ text
81
+ part
82
+ tag
83
+ color
84
+ }
77
85
  choices {
78
86
  id
79
87
  explanation
@@ -194,6 +202,14 @@ exports.MARKSHEET = (0, client_1.gql) `
194
202
  question
195
203
  totalVotes
196
204
  typeId
205
+ highlights {
206
+ start
207
+ end
208
+ text
209
+ part
210
+ tag
211
+ color
212
+ }
197
213
  choices {
198
214
  id
199
215
  explanation
@@ -317,6 +333,14 @@ exports.MARKSHEET = (0, client_1.gql) `
317
333
  question
318
334
  totalVotes
319
335
  typeId
336
+ highlights {
337
+ start
338
+ end
339
+ text
340
+ part
341
+ tag
342
+ color
343
+ }
320
344
  choices {
321
345
  id
322
346
  explanation
@@ -437,6 +461,14 @@ exports.MARKSHEET = (0, client_1.gql) `
437
461
  question
438
462
  totalVotes
439
463
  typeId
464
+ highlights {
465
+ start
466
+ end
467
+ text
468
+ part
469
+ tag
470
+ color
471
+ }
440
472
  choices {
441
473
  id
442
474
  explanation
@@ -637,6 +669,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
637
669
  question
638
670
  totalVotes
639
671
  typeId
672
+ highlights {
673
+ start
674
+ end
675
+ text
676
+ part
677
+ tag
678
+ color
679
+ }
640
680
  choices {
641
681
  id
642
682
  explanation
@@ -764,6 +804,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
764
804
  question
765
805
  totalVotes
766
806
  typeId
807
+ highlights {
808
+ start
809
+ end
810
+ text
811
+ part
812
+ tag
813
+ color
814
+ }
767
815
  choices {
768
816
  id
769
817
  explanation
@@ -884,6 +932,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
884
932
  question
885
933
  totalVotes
886
934
  typeId
935
+ highlights {
936
+ start
937
+ end
938
+ text
939
+ part
940
+ tag
941
+ color
942
+ }
887
943
  choices {
888
944
  id
889
945
  explanation
@@ -1007,6 +1063,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1007
1063
  question
1008
1064
  totalVotes
1009
1065
  typeId
1066
+ highlights {
1067
+ start
1068
+ end
1069
+ text
1070
+ part
1071
+ tag
1072
+ color
1073
+ }
1010
1074
  choices {
1011
1075
  id
1012
1076
  explanation
@@ -1127,6 +1191,14 @@ exports.FLAGGED_QUESTIONS = (0, client_1.gql) `
1127
1191
  question
1128
1192
  totalVotes
1129
1193
  typeId
1194
+ highlights {
1195
+ start
1196
+ end
1197
+ text
1198
+ part
1199
+ tag
1200
+ color
1201
+ }
1130
1202
  choices {
1131
1203
  id
1132
1204
  explanation
@@ -1335,6 +1407,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1335
1407
  question
1336
1408
  totalVotes
1337
1409
  typeId
1410
+ highlights {
1411
+ start
1412
+ end
1413
+ text
1414
+ part
1415
+ tag
1416
+ color
1417
+ }
1338
1418
  choices {
1339
1419
  id
1340
1420
  explanation
@@ -1455,6 +1535,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1455
1535
  question
1456
1536
  totalVotes
1457
1537
  typeId
1538
+ highlights {
1539
+ start
1540
+ end
1541
+ text
1542
+ part
1543
+ tag
1544
+ color
1545
+ }
1458
1546
  choices {
1459
1547
  id
1460
1548
  explanation
@@ -1578,6 +1666,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1578
1666
  question
1579
1667
  totalVotes
1580
1668
  typeId
1669
+ highlights {
1670
+ start
1671
+ end
1672
+ text
1673
+ part
1674
+ tag
1675
+ color
1676
+ }
1581
1677
  choices {
1582
1678
  id
1583
1679
  explanation
@@ -1698,6 +1794,14 @@ exports.FLAGGED_QUESTIONS_MARKSHEET = (0, client_1.gql) `
1698
1794
  question
1699
1795
  totalVotes
1700
1796
  typeId
1797
+ highlights {
1798
+ start
1799
+ end
1800
+ text
1801
+ part
1802
+ tag
1803
+ color
1804
+ }
1701
1805
  choices {
1702
1806
  id
1703
1807
  explanation