@quesmed/types-rn 2.6.80 → 2.6.82

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/models/User.d.ts CHANGED
@@ -19,6 +19,10 @@ export declare enum IAccessLevel {
19
19
  DEMO = "demo",
20
20
  EXPIRED = "expired"
21
21
  }
22
+ export declare enum ETheme {
23
+ LIGHT = 0,
24
+ DARK = 1
25
+ }
22
26
  export type IClassYear = 'Year 1' | 'Year 2' | 'Year 3' | 'Year 4' | 'Year 5' | 'Graduated' | 'PhD' | 'BSc' | 'MSc' | 'Beta Tester';
23
27
  export declare const classYears: IClassYear[];
24
28
  export declare const subscriptionDates: IUserSubsriptionDates[];
@@ -92,6 +96,26 @@ export interface IUserProgressData {
92
96
  daysInPreviousStreak: number;
93
97
  daysInLongestStreak: number;
94
98
  }
99
+ export interface IUserSettings {
100
+ id: Id;
101
+ userId: Id;
102
+ updatedAt: number | Date;
103
+ globalSettings: {
104
+ dailyFeedResetTime: number;
105
+ dailyFeedMax: number;
106
+ theme: ETheme;
107
+ disabledColors: boolean;
108
+ expandedReading: boolean;
109
+ readingTextScale: number;
110
+ addToDailyFlashcards: boolean;
111
+ };
112
+ productSettings: {
113
+ examDate: number | Date | null;
114
+ nextFeedbackDate: number | Date;
115
+ feedback: string | null;
116
+ rating: number | null;
117
+ };
118
+ }
95
119
  export interface IUser {
96
120
  id: Id;
97
121
  createdAt: number | Date;
@@ -101,8 +125,6 @@ export interface IUser {
101
125
  firstName: string;
102
126
  lastName: string;
103
127
  tocAccepted: boolean;
104
- dailyFeedResetTime: number;
105
- dailyFeedMax: number;
106
128
  stripeCustomerId: string;
107
129
  stripeLastSyncAt: number | Date | null;
108
130
  referralCount: number;
@@ -110,7 +132,6 @@ export interface IUser {
110
132
  graduationYear: number;
111
133
  universityId: Id;
112
134
  university: IUniversity;
113
- examDate: number | Date | null;
114
135
  accessLevel: IAccessLevel;
115
136
  elo: number;
116
137
  marksheets: IMarksheet[];
@@ -145,6 +166,7 @@ export interface IUser {
145
166
  radiologyInterviewSubscriptionEndDate: number | Date | null;
146
167
  plab1SubscriptionEndDate: number | Date | null;
147
168
  plab2SubscriptionEndDate: number | Date | null;
169
+ settings: IUserSettings;
148
170
  }
149
171
  export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
150
172
  export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
package/models/User.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningPoint = exports.EUserLearningStatus = exports.EClassYearGroup = exports.dateProductMapping = exports.subscriptionDates = exports.classYears = exports.IAccessLevel = void 0;
3
+ exports.currentClassGroup = exports.currentClassYear = exports.EPracticeIntensity = exports.classYearGroup = exports.EUserLearningPoint = exports.EUserLearningStatus = exports.EClassYearGroup = exports.dateProductMapping = exports.subscriptionDates = exports.classYears = exports.ETheme = exports.IAccessLevel = void 0;
4
4
  const luxon_1 = require("luxon");
5
5
  const Product_1 = require("./Product");
6
6
  var IAccessLevel;
@@ -11,6 +11,11 @@ var IAccessLevel;
11
11
  IAccessLevel["DEMO"] = "demo";
12
12
  IAccessLevel["EXPIRED"] = "expired";
13
13
  })(IAccessLevel = exports.IAccessLevel || (exports.IAccessLevel = {}));
14
+ var ETheme;
15
+ (function (ETheme) {
16
+ ETheme[ETheme["LIGHT"] = 0] = "LIGHT";
17
+ ETheme[ETheme["DARK"] = 1] = "DARK";
18
+ })(ETheme = exports.ETheme || (exports.ETheme = {}));
14
19
  exports.classYears = [
15
20
  'Year 1',
16
21
  'Year 2',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.80",
3
+ "version": "2.6.82",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -1,2 +1,4 @@
1
- export declare const USER_FIELDS: import("@apollo/client").DocumentNode;
2
1
  export declare const COMPLETED_CARDS: import("@apollo/client").DocumentNode;
2
+ export declare const USER_SETTINGS_FIELDS: import("@apollo/client").DocumentNode;
3
+ export declare const USER_FIELDS: import("@apollo/client").DocumentNode;
4
+ export declare const UPDATE_USER_SETTINGS_FRAGMENT: import("@apollo/client").DocumentNode;
@@ -1,8 +1,83 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.COMPLETED_CARDS = exports.USER_FIELDS = void 0;
3
+ exports.UPDATE_USER_SETTINGS_FRAGMENT = exports.USER_FIELDS = exports.USER_SETTINGS_FIELDS = exports.COMPLETED_CARDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
+ exports.COMPLETED_CARDS = (0, client_1.gql) `
6
+ fragment UserCompletedCards on User {
7
+ completedCards {
8
+ id
9
+ createdAt
10
+ updatedAt
11
+ concept {
12
+ id
13
+ name
14
+ }
15
+ lastSeen
16
+ reviewDate
17
+ score
18
+ iteration
19
+ optimalFactor
20
+ cardId
21
+ card {
22
+ id
23
+ conceptId
24
+ concept {
25
+ id
26
+ name
27
+ }
28
+ topic {
29
+ id
30
+ name
31
+ }
32
+ question
33
+ explanation
34
+ pictures {
35
+ id
36
+ createdAt
37
+ updatedAt
38
+ name
39
+ caption
40
+ index
41
+ path
42
+ path512
43
+ path256
44
+ thumbhash
45
+ topicId
46
+ topic {
47
+ id
48
+ name
49
+ typeId
50
+ }
51
+ }
52
+ }
53
+ }
54
+ completedCardsCount
55
+ }
56
+ `;
57
+ exports.USER_SETTINGS_FIELDS = (0, client_1.gql) `
58
+ fragment UserSettingsFields on UserSettings {
59
+ id
60
+ userId
61
+ updatedAt
62
+ globalSettings {
63
+ dailyFeedMax
64
+ dailyFeedResetTime
65
+ theme
66
+ expandedReading
67
+ disabledColors
68
+ readingTextScale
69
+ addToDailyFlashcards
70
+ }
71
+ productSettings {
72
+ feedback
73
+ rating
74
+ examDate
75
+ nextFeedbackDate
76
+ }
77
+ }
78
+ `;
5
79
  exports.USER_FIELDS = (0, client_1.gql) `
80
+ ${exports.USER_SETTINGS_FIELDS}
6
81
  fragment UserFields on User {
7
82
  id
8
83
  accessLevel
@@ -15,9 +90,9 @@ exports.USER_FIELDS = (0, client_1.gql) `
15
90
  classYear
16
91
  graduationYear
17
92
  universityId
18
- examDate
19
- dailyFeedResetTime
20
- dailyFeedMax
93
+ settings {
94
+ ...UserSettingsFields
95
+ }
21
96
  stripeCustomerId
22
97
  tocAccepted
23
98
 
@@ -76,55 +151,12 @@ exports.USER_FIELDS = (0, client_1.gql) `
76
151
  # completedRedCardsCount
77
152
  }
78
153
  `;
79
- exports.COMPLETED_CARDS = (0, client_1.gql) `
80
- fragment UserCompletedCards on User {
81
- completedCards {
82
- id
83
- createdAt
84
- updatedAt
85
- concept {
86
- id
87
- name
88
- }
89
- lastSeen
90
- reviewDate
91
- score
92
- iteration
93
- optimalFactor
94
- cardId
95
- card {
96
- id
97
- conceptId
98
- concept {
99
- id
100
- name
101
- }
102
- topic {
103
- id
104
- name
105
- }
106
- question
107
- explanation
108
- pictures {
109
- id
110
- createdAt
111
- updatedAt
112
- name
113
- caption
114
- index
115
- path
116
- path512
117
- path256
118
- thumbhash
119
- topicId
120
- topic {
121
- id
122
- name
123
- typeId
124
- }
125
- }
126
- }
154
+ // used in cache updator
155
+ exports.UPDATE_USER_SETTINGS_FRAGMENT = (0, client_1.gql) `
156
+ ${exports.USER_SETTINGS_FIELDS}
157
+ fragment UpdateUserSettingsFragment on User {
158
+ settings {
159
+ ...UserSettingsFields
127
160
  }
128
- completedCardsCount
129
161
  }
130
162
  `;
@@ -1,5 +1,5 @@
1
1
  import { ApolloCache } from '@apollo/client';
2
- import { EUserLearningStatus, IUser, IUserConceptStatus, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
2
+ import { EUserLearningStatus, IUser, IUserConceptStatus, IUserSettings, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
3
3
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
4
  import { RestrictedData, graphqlNormalize } from '../../types';
5
5
  export declare const LOGOUT_USER: import("@apollo/client").DocumentNode;
@@ -31,9 +31,6 @@ export interface IUserInput {
31
31
  graduationYear?: number;
32
32
  password?: string;
33
33
  oldPassword?: string;
34
- examDate?: number | Date;
35
- dailyFeedResetTime?: number;
36
- dailyFeedMax?: number;
37
34
  referral?: string;
38
35
  universityId?: number;
39
36
  }
@@ -46,6 +43,12 @@ export type IUpdateUserData = RestrictedData<{
46
43
  jwt: string;
47
44
  user: IUser & graphqlNormalize;
48
45
  }, 'updateUser'>;
46
+ export declare const UPDATE_USER_SETTINGS: import("@apollo/client").DocumentNode;
47
+ export interface IUpdateUserSettingsVar {
48
+ input: Omit<IUserSettings, 'id' | 'userId' | 'updatedAt'>;
49
+ }
50
+ export type IUpdateUserSettingsData = RestrictedData<IUserSettings & graphqlNormalize, 'updateUserSettings'>;
51
+ export declare const updateCacheOnUpdateUserSettings: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IUpdateUserSettingsData>, options: ApolloUpdateOptions<IUpdateUserSettingsVar>) => void;
49
52
  export declare const RENEW_TOKEN: import("@apollo/client").DocumentNode;
50
53
  export type IRenewTokenVar = null;
51
54
  export type IRenewTokenData = RestrictedData<string, 'renewToken'>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = 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.updateCacheOnUpdateUserSettings = exports.UPDATE_USER_SETTINGS = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const models_1 = require("../../../models");
6
+ const fragments_1 = require("../../fragments");
6
7
  exports.LOGOUT_USER = (0, client_1.gql) `
7
8
  mutation LogoutUser($all: Boolean!) {
8
9
  restricted {
@@ -55,15 +56,40 @@ exports.UPDATE_USER = (0, client_1.gql) `
55
56
  classYear
56
57
  graduationYear
57
58
  universityId
58
- examDate
59
- dailyFeedMax
60
- dailyFeedResetTime
61
59
  tocAccepted
62
60
  }
63
61
  }
64
62
  }
65
63
  }
66
64
  `;
65
+ exports.UPDATE_USER_SETTINGS = (0, client_1.gql) `
66
+ ${fragments_1.USER_SETTINGS_FIELDS}
67
+ mutation UpdateUserSettings($input: UserSettingsInput!) {
68
+ restricted {
69
+ updateUserSettings(input: $input) {
70
+ ...UserSettingsFields
71
+ }
72
+ }
73
+ }
74
+ `;
75
+ const updateCacheOnUpdateUserSettings = (cache, result, options) => {
76
+ const { updateUserSettings } = result?.data?.restricted || {};
77
+ const { variables } = options || {};
78
+ if (!variables || !updateUserSettings) {
79
+ return;
80
+ }
81
+ cache.writeFragment({
82
+ id: cache.identify({
83
+ id: updateUserSettings.userId,
84
+ __typename: 'User',
85
+ }),
86
+ data: {
87
+ settings: updateUserSettings,
88
+ },
89
+ fragment: fragments_1.UPDATE_USER_SETTINGS_FRAGMENT,
90
+ });
91
+ };
92
+ exports.updateCacheOnUpdateUserSettings = updateCacheOnUpdateUserSettings;
67
93
  exports.RENEW_TOKEN = (0, client_1.gql) `
68
94
  mutation RenewToken {
69
95
  restricted {
@@ -41,7 +41,14 @@ exports.DASHBOARD_OSCE = (0, client_1.gql) `
41
41
  total
42
42
  }
43
43
  user {
44
- examDate
44
+ settings {
45
+ productSettings {
46
+ examDate
47
+ rating
48
+ feedback
49
+ nextFeedbackDate
50
+ }
51
+ }
45
52
  userProgress {
46
53
  marksheetCount
47
54
  stationsCount
@@ -11,7 +11,14 @@ exports.DASHBOARD_QBANK = (0, client_1.gql) `
11
11
  latestSessionId
12
12
  user {
13
13
  id
14
- examDate
14
+ settings {
15
+ productSettings {
16
+ examDate
17
+ rating
18
+ feedback
19
+ nextFeedbackDate
20
+ }
21
+ }
15
22
  completedQuestionsCount
16
23
  completedCorrectQuestionsCount
17
24
  completedIncorrectQuestionsCount
@@ -136,7 +143,14 @@ exports.DASHBOARD = (0, client_1.gql) `
136
143
  latestSessionId
137
144
  user {
138
145
  id
139
- examDate
146
+ settings {
147
+ productSettings {
148
+ examDate
149
+ rating
150
+ feedback
151
+ nextFeedbackDate
152
+ }
153
+ }
140
154
  universityId
141
155
  classYear
142
156
  completedQuestionsCount
@@ -144,6 +144,13 @@ exports.PACE_KNOWLEDGE_LIBRARY = (0, client_1.gql) `
144
144
  demo
145
145
  status
146
146
  typeId
147
+ userNote {
148
+ id
149
+ userId
150
+ conceptId
151
+ note
152
+ updatedAt
153
+ }
147
154
  entitlement {
148
155
  id
149
156
  name