@quesmed/types 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/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/models/Marksheet.d.ts +8 -0
- package/dist/cjs/models/Marksheet.js +10 -1
- package/dist/cjs/models/Preset.d.ts +3 -4
- package/dist/cjs/models/UserSession.d.ts +24 -0
- package/dist/cjs/models/UserSession.js +11 -0
- package/dist/cjs/models/index.d.ts +1 -0
- package/dist/cjs/models/index.js +1 -0
- package/dist/cjs/resolvers/apollo.d.ts +2 -2
- package/dist/cjs/resolvers/fragments/user.js +1 -0
- package/dist/cjs/resolvers/mutation/restricted/preset.js +6 -30
- package/dist/cjs/resolvers/mutation/restricted/stripe.d.ts +5 -1
- package/dist/cjs/resolvers/mutation/restricted/stripe.js +30 -2
- package/dist/cjs/resolvers/mutation/restricted/users.d.ts +5 -0
- package/dist/cjs/resolvers/mutation/restricted/users.js +8 -1
- package/dist/cjs/resolvers/query/restricted/marksheet.js +2 -0
- package/dist/cjs/resolvers/query/restricted/preset.js +6 -30
- package/dist/cjs/resolvers/query/restricted/user.js +1 -0
- package/dist/cjs/resolvers/query/restricted/video.js +1 -0
- package/dist/mjs/index.d.ts +1 -0
- package/dist/mjs/index.js +1 -0
- package/dist/mjs/models/Marksheet.d.ts +8 -0
- package/dist/mjs/models/Marksheet.js +9 -0
- package/dist/mjs/models/Preset.d.ts +3 -4
- package/dist/mjs/models/UserSession.d.ts +24 -0
- package/dist/mjs/models/UserSession.js +8 -0
- package/dist/mjs/models/index.d.ts +1 -0
- package/dist/mjs/models/index.js +1 -0
- package/dist/mjs/resolvers/apollo.d.ts +2 -2
- package/dist/mjs/resolvers/fragments/user.js +1 -0
- package/dist/mjs/resolvers/mutation/restricted/preset.js +6 -30
- package/dist/mjs/resolvers/mutation/restricted/stripe.d.ts +5 -1
- package/dist/mjs/resolvers/mutation/restricted/stripe.js +28 -1
- package/dist/mjs/resolvers/mutation/restricted/users.d.ts +5 -0
- package/dist/mjs/resolvers/mutation/restricted/users.js +7 -0
- package/dist/mjs/resolvers/query/restricted/marksheet.js +2 -0
- package/dist/mjs/resolvers/query/restricted/preset.js +6 -30
- package/dist/mjs/resolvers/query/restricted/user.js +1 -0
- package/dist/mjs/resolvers/query/restricted/video.js +1 -0
- package/package.json +1 -1
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/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) {
|
|
@@ -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
|
|
@@ -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";
|
|
@@ -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/dist/cjs/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);
|
|
@@ -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
|
}
|
package/dist/mjs/index.d.ts
CHANGED
package/dist/mjs/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export const ERRORS = {
|
|
|
8
8
|
TOKEN_EXPIRED: 'Expired token.',
|
|
9
9
|
SUBSCRIPTION_EXPIRED: 'Expired subscription.',
|
|
10
10
|
PERMISSION_INVALID: 'Invalid permission.',
|
|
11
|
+
SESSION_MISSING: 'No Session Found, Please login again',
|
|
11
12
|
};
|
|
12
13
|
export var AlgoliaIndex;
|
|
13
14
|
(function (AlgoliaIndex) {
|
|
@@ -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
|
|
@@ -6,6 +6,15 @@ export var EMarksheetState;
|
|
|
6
6
|
EMarksheetState[EMarksheetState["STATION"] = 3] = "STATION";
|
|
7
7
|
EMarksheetState[EMarksheetState["RESULT"] = 4] = "RESULT";
|
|
8
8
|
})(EMarksheetState || (EMarksheetState = {}));
|
|
9
|
+
export var MARKSHEET_SOURCE;
|
|
10
|
+
(function (MARKSHEET_SOURCE) {
|
|
11
|
+
MARKSHEET_SOURCE["QUIZ"] = "Quiz";
|
|
12
|
+
MARKSHEET_SOURCE["QUICK_BUILD_QUIZ"] = "Quick build quiz";
|
|
13
|
+
MARKSHEET_SOURCE["UKMLA_QUIZ"] = "UKMLA Quiz";
|
|
14
|
+
MARKSHEET_SOURCE["GROUP_STUDY"] = "Qbank group study";
|
|
15
|
+
MARKSHEET_SOURCE["FLAGGED_QUESTIONS_REVIEW"] = "Flagged Questions Review";
|
|
16
|
+
MARKSHEET_SOURCE["FLAGGED_QUESTIONS_QUIZ"] = "Flagged Questions Quiz";
|
|
17
|
+
})(MARKSHEET_SOURCE || (MARKSHEET_SOURCE = {}));
|
|
9
18
|
export var EStudyAction;
|
|
10
19
|
(function (EStudyAction) {
|
|
11
20
|
EStudyAction[EStudyAction["START"] = 0] = "START";
|
|
@@ -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,8 @@
|
|
|
1
|
+
export var ESessionStatus;
|
|
2
|
+
(function (ESessionStatus) {
|
|
3
|
+
ESessionStatus[ESessionStatus["INVALID"] = 0] = "INVALID";
|
|
4
|
+
ESessionStatus[ESessionStatus["VALID"] = 1] = "VALID";
|
|
5
|
+
ESessionStatus[ESessionStatus["STRIPE_SUB_CHANGE"] = 2] = "STRIPE_SUB_CHANGE";
|
|
6
|
+
ESessionStatus[ESessionStatus["REVENUECAT_SUB_CHANGE"] = 3] = "REVENUECAT_SUB_CHANGE";
|
|
7
|
+
ESessionStatus[ESessionStatus["PASSWORD_CHANGE"] = 4] = "PASSWORD_CHANGE";
|
|
8
|
+
})(ESessionStatus || (ESessionStatus = {}));
|
package/dist/mjs/models/index.js
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
|
}
|
|
@@ -60,18 +60,10 @@ export const DUPLICATE_PRESET = gql `
|
|
|
60
60
|
completedCards
|
|
61
61
|
totalCards
|
|
62
62
|
userId
|
|
63
|
-
|
|
63
|
+
concepts {
|
|
64
64
|
id
|
|
65
65
|
name
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
topics {
|
|
69
|
-
id
|
|
70
|
-
name
|
|
71
|
-
concepts {
|
|
72
|
-
id
|
|
73
|
-
name
|
|
74
|
-
}
|
|
66
|
+
topicId
|
|
75
67
|
}
|
|
76
68
|
}
|
|
77
69
|
}
|
|
@@ -120,18 +112,10 @@ export const EDIT_PRESET = gql `
|
|
|
120
112
|
completedCards
|
|
121
113
|
totalCards
|
|
122
114
|
userId
|
|
123
|
-
|
|
115
|
+
concepts {
|
|
124
116
|
id
|
|
125
117
|
name
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
topics {
|
|
129
|
-
id
|
|
130
|
-
name
|
|
131
|
-
concepts {
|
|
132
|
-
id
|
|
133
|
-
name
|
|
134
|
-
}
|
|
118
|
+
topicId
|
|
135
119
|
}
|
|
136
120
|
}
|
|
137
121
|
}
|
|
@@ -157,18 +141,10 @@ export const CREATE_PRESET = gql `
|
|
|
157
141
|
completedCards
|
|
158
142
|
totalCards
|
|
159
143
|
userId
|
|
160
|
-
|
|
161
|
-
id
|
|
162
|
-
name
|
|
163
|
-
country
|
|
164
|
-
}
|
|
165
|
-
topics {
|
|
144
|
+
concepts {
|
|
166
145
|
id
|
|
167
146
|
name
|
|
168
|
-
|
|
169
|
-
id
|
|
170
|
-
name
|
|
171
|
-
}
|
|
147
|
+
topicId
|
|
172
148
|
}
|
|
173
149
|
}
|
|
174
150
|
}
|
|
@@ -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,8 +1,35 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
|
+
import { USER } from '../../query/restricted';
|
|
2
3
|
export const CANCEL_SUBSCRIPTION = gql `
|
|
3
4
|
mutation Mutation($subscriptionId: Int!) {
|
|
4
5
|
restricted {
|
|
5
|
-
cancelSubscription(subscriptionId: $subscriptionId)
|
|
6
|
+
cancelSubscription(subscriptionId: $subscriptionId) {
|
|
7
|
+
id
|
|
8
|
+
endedAt
|
|
9
|
+
periodEndAt
|
|
10
|
+
stripeSubscriptionId
|
|
11
|
+
userId
|
|
12
|
+
productId
|
|
13
|
+
}
|
|
6
14
|
}
|
|
7
15
|
}
|
|
8
16
|
`;
|
|
17
|
+
export const updateSubscriptionOnCancelOrRenew = (cache, result, options) => {
|
|
18
|
+
const { cancelSubscription } = result?.data?.restricted || {};
|
|
19
|
+
const { variables } = options || {};
|
|
20
|
+
if (!variables || !cancelSubscription) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const prevData = cache.readQuery({
|
|
24
|
+
query: USER,
|
|
25
|
+
});
|
|
26
|
+
if (!prevData) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const { subscriptionId } = variables;
|
|
30
|
+
const { subscriptions } = prevData.restricted.user;
|
|
31
|
+
prevData.restricted.user.subscriptions = subscriptions.map((s) => Number(s.id) === Number(subscriptionId)
|
|
32
|
+
? { ...s, ...cancelSubscription }
|
|
33
|
+
: s);
|
|
34
|
+
cache.writeQuery({ query: USER, data: { ...prevData } });
|
|
35
|
+
};
|
|
@@ -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,5 +1,12 @@
|
|
|
1
1
|
import { gql } from '@apollo/client';
|
|
2
2
|
import { EUserLearningStatus, } from '../../../models';
|
|
3
|
+
export const LOGOUT_USER = gql `
|
|
4
|
+
mutation LogoutUser($all: Boolean!) {
|
|
5
|
+
restricted {
|
|
6
|
+
logoutUser(all: $all)
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`;
|
|
3
10
|
export const RESET_PROGRESS = gql `
|
|
4
11
|
mutation ResetProgress($questions: Boolean, $cards: Boolean) {
|
|
5
12
|
restricted {
|
|
@@ -1016,6 +1016,7 @@ export const MARKSHEETS = gql `
|
|
|
1016
1016
|
marksheets(filter: $filter) {
|
|
1017
1017
|
results {
|
|
1018
1018
|
id
|
|
1019
|
+
source
|
|
1019
1020
|
endedAt
|
|
1020
1021
|
topicNames
|
|
1021
1022
|
correct
|
|
@@ -1054,6 +1055,7 @@ export const MARKSHEETS_WINDOW = gql `
|
|
|
1054
1055
|
date
|
|
1055
1056
|
result {
|
|
1056
1057
|
id
|
|
1058
|
+
source
|
|
1057
1059
|
endedAt
|
|
1058
1060
|
topicNames
|
|
1059
1061
|
correct
|
|
@@ -31,18 +31,10 @@ export const PRESETS = gql `
|
|
|
31
31
|
completedCards
|
|
32
32
|
totalCards
|
|
33
33
|
userId
|
|
34
|
-
|
|
34
|
+
concepts {
|
|
35
35
|
id
|
|
36
36
|
name
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
topics {
|
|
40
|
-
id
|
|
41
|
-
name
|
|
42
|
-
concepts {
|
|
43
|
-
id
|
|
44
|
-
name
|
|
45
|
-
}
|
|
37
|
+
topicId
|
|
46
38
|
}
|
|
47
39
|
}
|
|
48
40
|
}
|
|
@@ -68,18 +60,10 @@ export const PRE_DEFINED_PRESETS = gql `
|
|
|
68
60
|
completedCards
|
|
69
61
|
totalCards
|
|
70
62
|
userId
|
|
71
|
-
|
|
63
|
+
concepts {
|
|
72
64
|
id
|
|
73
65
|
name
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
topics {
|
|
77
|
-
id
|
|
78
|
-
name
|
|
79
|
-
concepts {
|
|
80
|
-
id
|
|
81
|
-
name
|
|
82
|
-
}
|
|
66
|
+
topicId
|
|
83
67
|
}
|
|
84
68
|
}
|
|
85
69
|
}
|
|
@@ -105,18 +89,10 @@ export const PRESET = gql `
|
|
|
105
89
|
completedCards
|
|
106
90
|
totalCards
|
|
107
91
|
userId
|
|
108
|
-
|
|
109
|
-
id
|
|
110
|
-
name
|
|
111
|
-
country
|
|
112
|
-
}
|
|
113
|
-
topics {
|
|
92
|
+
concepts {
|
|
114
93
|
id
|
|
115
94
|
name
|
|
116
|
-
|
|
117
|
-
id
|
|
118
|
-
name
|
|
119
|
-
}
|
|
95
|
+
topicId
|
|
120
96
|
}
|
|
121
97
|
}
|
|
122
98
|
}
|