@quesmed/types-rn 2.6.9 → 2.6.11
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/index.d.ts +1 -0
- package/index.js +1 -0
- package/models/Marksheet.d.ts +8 -0
- package/models/Marksheet.js +10 -1
- package/models/Preset.d.ts +3 -4
- package/models/UserSession.d.ts +24 -0
- package/models/UserSession.js +11 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/package.json +1 -1
- package/resolvers/apollo.d.ts +2 -2
- package/resolvers/fragments/user.js +1 -0
- package/resolvers/mutation/restricted/preset.js +6 -30
- package/resolvers/mutation/restricted/stripe.d.ts +5 -1
- package/resolvers/mutation/restricted/stripe.js +30 -2
- package/resolvers/mutation/restricted/users.d.ts +5 -0
- package/resolvers/mutation/restricted/users.js +8 -1
- package/resolvers/query/restricted/marksheet.js +2 -0
- package/resolvers/query/restricted/preset.js +6 -30
- package/resolvers/query/restricted/user.js +1 -0
- package/resolvers/query/restricted/video.js +1 -0
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -37,6 +37,7 @@ exports.ERRORS = {
|
|
|
37
37
|
TOKEN_EXPIRED: 'Expired token.',
|
|
38
38
|
SUBSCRIPTION_EXPIRED: 'Expired subscription.',
|
|
39
39
|
PERMISSION_INVALID: 'Invalid permission.',
|
|
40
|
+
SESSION_MISSING: 'No Session Found, Please login again',
|
|
40
41
|
};
|
|
41
42
|
var AlgoliaIndex;
|
|
42
43
|
(function (AlgoliaIndex) {
|
package/models/Marksheet.d.ts
CHANGED
|
@@ -11,6 +11,14 @@ export declare enum EMarksheetState {
|
|
|
11
11
|
STATION = 3,
|
|
12
12
|
RESULT = 4
|
|
13
13
|
}
|
|
14
|
+
export declare enum MARKSHEET_SOURCE {
|
|
15
|
+
QUIZ = "Quiz",
|
|
16
|
+
QUICK_BUILD_QUIZ = "Quick build quiz",
|
|
17
|
+
UKMLA_QUIZ = "UKMLA Quiz",
|
|
18
|
+
GROUP_STUDY = "Qbank group study",
|
|
19
|
+
FLAGGED_QUESTIONS_REVIEW = "Flagged Questions Review",
|
|
20
|
+
FLAGGED_QUESTIONS_QUIZ = "Flagged Questions Quiz"
|
|
21
|
+
}
|
|
14
22
|
export declare enum EStudyAction {
|
|
15
23
|
START = 0,
|
|
16
24
|
JOIN = 1
|
package/models/Marksheet.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EMarksheetAction = exports.EMarksheetType = exports.EStudyAction = exports.EMarksheetState = void 0;
|
|
3
|
+
exports.EMarksheetAction = exports.EMarksheetType = exports.EStudyAction = exports.MARKSHEET_SOURCE = exports.EMarksheetState = void 0;
|
|
4
4
|
var EMarksheetState;
|
|
5
5
|
(function (EMarksheetState) {
|
|
6
6
|
EMarksheetState[EMarksheetState["LOBBY"] = 0] = "LOBBY";
|
|
@@ -9,6 +9,15 @@ var EMarksheetState;
|
|
|
9
9
|
EMarksheetState[EMarksheetState["STATION"] = 3] = "STATION";
|
|
10
10
|
EMarksheetState[EMarksheetState["RESULT"] = 4] = "RESULT";
|
|
11
11
|
})(EMarksheetState = exports.EMarksheetState || (exports.EMarksheetState = {}));
|
|
12
|
+
var MARKSHEET_SOURCE;
|
|
13
|
+
(function (MARKSHEET_SOURCE) {
|
|
14
|
+
MARKSHEET_SOURCE["QUIZ"] = "Quiz";
|
|
15
|
+
MARKSHEET_SOURCE["QUICK_BUILD_QUIZ"] = "Quick build quiz";
|
|
16
|
+
MARKSHEET_SOURCE["UKMLA_QUIZ"] = "UKMLA Quiz";
|
|
17
|
+
MARKSHEET_SOURCE["GROUP_STUDY"] = "Qbank group study";
|
|
18
|
+
MARKSHEET_SOURCE["FLAGGED_QUESTIONS_REVIEW"] = "Flagged Questions Review";
|
|
19
|
+
MARKSHEET_SOURCE["FLAGGED_QUESTIONS_QUIZ"] = "Flagged Questions Quiz";
|
|
20
|
+
})(MARKSHEET_SOURCE = exports.MARKSHEET_SOURCE || (exports.MARKSHEET_SOURCE = {}));
|
|
12
21
|
var EStudyAction;
|
|
13
22
|
(function (EStudyAction) {
|
|
14
23
|
EStudyAction[EStudyAction["START"] = 0] = "START";
|
package/models/Preset.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IConcept } from './Concept';
|
|
2
|
+
import { ETopicType } from './Topic';
|
|
2
3
|
import { Id } from './Type';
|
|
3
|
-
import { IUniversity } from './University';
|
|
4
4
|
export declare enum EPresetType {
|
|
5
5
|
PRE_DEFINED = 0,
|
|
6
6
|
CUSTOM = 1
|
|
@@ -22,8 +22,7 @@ export interface IPreset {
|
|
|
22
22
|
redCards: number;
|
|
23
23
|
completedCards: number;
|
|
24
24
|
totalCards: number;
|
|
25
|
-
|
|
26
|
-
topics: ITopic[];
|
|
25
|
+
concepts: IConcept[];
|
|
27
26
|
}
|
|
28
27
|
export interface IPresetConcepts {
|
|
29
28
|
id: Id;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Id } from "./Type";
|
|
2
|
+
export declare enum ESessionStatus {
|
|
3
|
+
INVALID = 0,
|
|
4
|
+
VALID = 1,
|
|
5
|
+
STRIPE_SUB_CHANGE = 2,
|
|
6
|
+
REVENUECAT_SUB_CHANGE = 3,
|
|
7
|
+
PASSWORD_CHANGE = 4
|
|
8
|
+
}
|
|
9
|
+
export interface ISession {
|
|
10
|
+
id: Id;
|
|
11
|
+
createdAt: number | Date;
|
|
12
|
+
updatedAt: number | Date;
|
|
13
|
+
userId: Id;
|
|
14
|
+
sessionId: string;
|
|
15
|
+
ip: string;
|
|
16
|
+
status: ESessionStatus;
|
|
17
|
+
meta: {
|
|
18
|
+
'accept-language': string;
|
|
19
|
+
'user-agent': string;
|
|
20
|
+
'sec-ch-ua-platform': string;
|
|
21
|
+
'sec-ch-ua': string;
|
|
22
|
+
'sec-ch-ua-mobile': string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ESessionStatus = void 0;
|
|
4
|
+
var ESessionStatus;
|
|
5
|
+
(function (ESessionStatus) {
|
|
6
|
+
ESessionStatus[ESessionStatus["INVALID"] = 0] = "INVALID";
|
|
7
|
+
ESessionStatus[ESessionStatus["VALID"] = 1] = "VALID";
|
|
8
|
+
ESessionStatus[ESessionStatus["STRIPE_SUB_CHANGE"] = 2] = "STRIPE_SUB_CHANGE";
|
|
9
|
+
ESessionStatus[ESessionStatus["REVENUECAT_SUB_CHANGE"] = 3] = "REVENUECAT_SUB_CHANGE";
|
|
10
|
+
ESessionStatus[ESessionStatus["PASSWORD_CHANGE"] = 4] = "PASSWORD_CHANGE";
|
|
11
|
+
})(ESessionStatus = exports.ESessionStatus || (exports.ESessionStatus = {}));
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
|
@@ -45,4 +45,5 @@ __exportStar(require("./Type"), exports);
|
|
|
45
45
|
__exportStar(require("./UkmlaTopic"), exports);
|
|
46
46
|
__exportStar(require("./University"), exports);
|
|
47
47
|
__exportStar(require("./User"), exports);
|
|
48
|
+
__exportStar(require("./UserSession"), exports);
|
|
48
49
|
__exportStar(require("./Video"), exports);
|
package/package.json
CHANGED
package/resolvers/apollo.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DefaultContext, FetchResult } from '@apollo/client';
|
|
2
2
|
export type ApolloUpdateResultRestricted<T> = Omit<FetchResult<T>, 'context'>;
|
|
3
|
-
export interface ApolloUpdateOptions {
|
|
3
|
+
export interface ApolloUpdateOptions<T = Record<string, any>> {
|
|
4
4
|
context?: DefaultContext;
|
|
5
|
-
variables?:
|
|
5
|
+
variables?: T;
|
|
6
6
|
}
|
|
@@ -64,18 +64,10 @@ exports.DUPLICATE_PRESET = (0, client_1.gql) `
|
|
|
64
64
|
completedCards
|
|
65
65
|
totalCards
|
|
66
66
|
userId
|
|
67
|
-
|
|
67
|
+
concepts {
|
|
68
68
|
id
|
|
69
69
|
name
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
topics {
|
|
73
|
-
id
|
|
74
|
-
name
|
|
75
|
-
concepts {
|
|
76
|
-
id
|
|
77
|
-
name
|
|
78
|
-
}
|
|
70
|
+
topicId
|
|
79
71
|
}
|
|
80
72
|
}
|
|
81
73
|
}
|
|
@@ -125,18 +117,10 @@ exports.EDIT_PRESET = (0, client_1.gql) `
|
|
|
125
117
|
completedCards
|
|
126
118
|
totalCards
|
|
127
119
|
userId
|
|
128
|
-
|
|
120
|
+
concepts {
|
|
129
121
|
id
|
|
130
122
|
name
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
topics {
|
|
134
|
-
id
|
|
135
|
-
name
|
|
136
|
-
concepts {
|
|
137
|
-
id
|
|
138
|
-
name
|
|
139
|
-
}
|
|
123
|
+
topicId
|
|
140
124
|
}
|
|
141
125
|
}
|
|
142
126
|
}
|
|
@@ -162,18 +146,10 @@ exports.CREATE_PRESET = (0, client_1.gql) `
|
|
|
162
146
|
completedCards
|
|
163
147
|
totalCards
|
|
164
148
|
userId
|
|
165
|
-
|
|
166
|
-
id
|
|
167
|
-
name
|
|
168
|
-
country
|
|
169
|
-
}
|
|
170
|
-
topics {
|
|
149
|
+
concepts {
|
|
171
150
|
id
|
|
172
151
|
name
|
|
173
|
-
|
|
174
|
-
id
|
|
175
|
-
name
|
|
176
|
-
}
|
|
152
|
+
topicId
|
|
177
153
|
}
|
|
178
154
|
}
|
|
179
155
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { ApolloCache } from '@apollo/client';
|
|
2
|
+
import { ISubscription } from '../../../models';
|
|
3
|
+
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
1
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
2
5
|
export interface ICancelSubscriptionVar {
|
|
3
6
|
subscriptionId: number;
|
|
4
7
|
}
|
|
5
|
-
export type ICancelSubscriptionData = RestrictedData<graphqlNormalize &
|
|
8
|
+
export type ICancelSubscriptionData = RestrictedData<graphqlNormalize & ISubscription, 'cancelSubscription'>;
|
|
6
9
|
export declare const CANCEL_SUBSCRIPTION: import("@apollo/client").DocumentNode;
|
|
10
|
+
export declare const updateSubscriptionOnCancelOrRenew: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<ICancelSubscriptionData>, options: ApolloUpdateOptions<ICancelSubscriptionVar>) => void;
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CANCEL_SUBSCRIPTION = void 0;
|
|
3
|
+
exports.updateSubscriptionOnCancelOrRenew = exports.CANCEL_SUBSCRIPTION = void 0;
|
|
4
4
|
const client_1 = require("@apollo/client");
|
|
5
|
+
const restricted_1 = require("../../query/restricted");
|
|
5
6
|
exports.CANCEL_SUBSCRIPTION = (0, client_1.gql) `
|
|
6
7
|
mutation Mutation($subscriptionId: Int!) {
|
|
7
8
|
restricted {
|
|
8
|
-
cancelSubscription(subscriptionId: $subscriptionId)
|
|
9
|
+
cancelSubscription(subscriptionId: $subscriptionId) {
|
|
10
|
+
id
|
|
11
|
+
endedAt
|
|
12
|
+
periodEndAt
|
|
13
|
+
stripeSubscriptionId
|
|
14
|
+
userId
|
|
15
|
+
productId
|
|
16
|
+
}
|
|
9
17
|
}
|
|
10
18
|
}
|
|
11
19
|
`;
|
|
20
|
+
const updateSubscriptionOnCancelOrRenew = (cache, result, options) => {
|
|
21
|
+
const { cancelSubscription } = result?.data?.restricted || {};
|
|
22
|
+
const { variables } = options || {};
|
|
23
|
+
if (!variables || !cancelSubscription) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const prevData = cache.readQuery({
|
|
27
|
+
query: restricted_1.USER,
|
|
28
|
+
});
|
|
29
|
+
if (!prevData) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const { subscriptionId } = variables;
|
|
33
|
+
const { subscriptions } = prevData.restricted.user;
|
|
34
|
+
prevData.restricted.user.subscriptions = subscriptions.map((s) => Number(s.id) === Number(subscriptionId)
|
|
35
|
+
? { ...s, ...cancelSubscription }
|
|
36
|
+
: s);
|
|
37
|
+
cache.writeQuery({ query: restricted_1.USER, data: { ...prevData } });
|
|
38
|
+
};
|
|
39
|
+
exports.updateSubscriptionOnCancelOrRenew = updateSubscriptionOnCancelOrRenew;
|
|
@@ -2,6 +2,11 @@ import { ApolloCache } from '@apollo/client';
|
|
|
2
2
|
import { EUserLearningStatus, IUser, IUserConceptStatus, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
|
|
3
3
|
import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
|
|
4
4
|
import { RestrictedData, graphqlNormalize } from '../../types';
|
|
5
|
+
export declare const LOGOUT_USER: import("@apollo/client").DocumentNode;
|
|
6
|
+
export interface ILogoutUserVar {
|
|
7
|
+
all: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type ILogoutUserData = RestrictedData<graphqlNormalize & boolean, 'logoutUser'>;
|
|
5
10
|
export declare const RESET_PROGRESS: import("@apollo/client").DocumentNode;
|
|
6
11
|
export interface IResetProgressVar {
|
|
7
12
|
questions?: boolean;
|
|
@@ -1,8 +1,15 @@
|
|
|
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 = 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_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
|
+
exports.LOGOUT_USER = (0, client_1.gql) `
|
|
7
|
+
mutation LogoutUser($all: Boolean!) {
|
|
8
|
+
restricted {
|
|
9
|
+
logoutUser(all: $all)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
6
13
|
exports.RESET_PROGRESS = (0, client_1.gql) `
|
|
7
14
|
mutation ResetProgress($questions: Boolean, $cards: Boolean) {
|
|
8
15
|
restricted {
|
|
@@ -1019,6 +1019,7 @@ exports.MARKSHEETS = (0, client_1.gql) `
|
|
|
1019
1019
|
marksheets(filter: $filter) {
|
|
1020
1020
|
results {
|
|
1021
1021
|
id
|
|
1022
|
+
source
|
|
1022
1023
|
endedAt
|
|
1023
1024
|
topicNames
|
|
1024
1025
|
correct
|
|
@@ -1057,6 +1058,7 @@ exports.MARKSHEETS_WINDOW = (0, client_1.gql) `
|
|
|
1057
1058
|
date
|
|
1058
1059
|
result {
|
|
1059
1060
|
id
|
|
1061
|
+
source
|
|
1060
1062
|
endedAt
|
|
1061
1063
|
topicNames
|
|
1062
1064
|
correct
|
|
@@ -34,18 +34,10 @@ exports.PRESETS = (0, client_1.gql) `
|
|
|
34
34
|
completedCards
|
|
35
35
|
totalCards
|
|
36
36
|
userId
|
|
37
|
-
|
|
37
|
+
concepts {
|
|
38
38
|
id
|
|
39
39
|
name
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
topics {
|
|
43
|
-
id
|
|
44
|
-
name
|
|
45
|
-
concepts {
|
|
46
|
-
id
|
|
47
|
-
name
|
|
48
|
-
}
|
|
40
|
+
topicId
|
|
49
41
|
}
|
|
50
42
|
}
|
|
51
43
|
}
|
|
@@ -71,18 +63,10 @@ exports.PRE_DEFINED_PRESETS = (0, client_1.gql) `
|
|
|
71
63
|
completedCards
|
|
72
64
|
totalCards
|
|
73
65
|
userId
|
|
74
|
-
|
|
66
|
+
concepts {
|
|
75
67
|
id
|
|
76
68
|
name
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
topics {
|
|
80
|
-
id
|
|
81
|
-
name
|
|
82
|
-
concepts {
|
|
83
|
-
id
|
|
84
|
-
name
|
|
85
|
-
}
|
|
69
|
+
topicId
|
|
86
70
|
}
|
|
87
71
|
}
|
|
88
72
|
}
|
|
@@ -108,18 +92,10 @@ exports.PRESET = (0, client_1.gql) `
|
|
|
108
92
|
completedCards
|
|
109
93
|
totalCards
|
|
110
94
|
userId
|
|
111
|
-
|
|
112
|
-
id
|
|
113
|
-
name
|
|
114
|
-
country
|
|
115
|
-
}
|
|
116
|
-
topics {
|
|
95
|
+
concepts {
|
|
117
96
|
id
|
|
118
97
|
name
|
|
119
|
-
|
|
120
|
-
id
|
|
121
|
-
name
|
|
122
|
-
}
|
|
98
|
+
topicId
|
|
123
99
|
}
|
|
124
100
|
}
|
|
125
101
|
}
|