@quesmed/types-rn 2.2.55 → 2.2.58

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.
@@ -0,0 +1,17 @@
1
+ import { Id } from './Type';
2
+ export declare enum EProductType {
3
+ QBANK = 1,
4
+ OSCE = 2,
5
+ BUNDLE = 3
6
+ }
7
+ export interface IProduct {
8
+ id: Id;
9
+ createdAt: number | Date;
10
+ name: string;
11
+ description: string | null;
12
+ price: number;
13
+ stripePriceId: string;
14
+ duration: number;
15
+ public: boolean;
16
+ typeId: EProductType;
17
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EProductType = void 0;
4
+ var EProductType;
5
+ (function (EProductType) {
6
+ EProductType[EProductType["QBANK"] = 1] = "QBANK";
7
+ EProductType[EProductType["OSCE"] = 2] = "OSCE";
8
+ EProductType[EProductType["BUNDLE"] = 3] = "BUNDLE";
9
+ })(EProductType = exports.EProductType || (exports.EProductType = {}));
package/models/Promo.d.ts CHANGED
@@ -10,5 +10,5 @@ export interface IPromoReport {
10
10
  date: number | Date;
11
11
  couponId: Id;
12
12
  userId: Id;
13
- subscriptionId: Id;
13
+ productId: Id;
14
14
  }
@@ -1,17 +1,18 @@
1
+ import { IProduct } from './Product';
1
2
  import { Id } from './Type';
3
+ import { IClassYear, IUser } from './User';
2
4
  export interface ISubscription {
3
5
  id: Id;
4
6
  createdAt: number | Date;
5
- name: string;
6
- description: string | null;
7
- price: number;
8
- stripePriceId: string;
9
- duration: number;
10
- public: boolean;
11
- typeId: Id;
12
- }
13
- export declare enum ESubscriptionType {
14
- QBANK = 1,
15
- OSCE = 2,
16
- BUNDLE = 3
7
+ updatedAt: number | Date;
8
+ startedAt: number | Date;
9
+ endedAt: number | Date;
10
+ periodEndAt: number | Date;
11
+ stripeSubscriptionId: string;
12
+ userId: Id;
13
+ user?: IUser;
14
+ productId: Id;
15
+ product?: IProduct;
16
+ classYear: IClassYear;
17
+ invoiced: number;
17
18
  }
@@ -1,9 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ESubscriptionType = void 0;
4
- var ESubscriptionType;
5
- (function (ESubscriptionType) {
6
- ESubscriptionType[ESubscriptionType["QBANK"] = 1] = "QBANK";
7
- ESubscriptionType[ESubscriptionType["OSCE"] = 2] = "OSCE";
8
- ESubscriptionType[ESubscriptionType["BUNDLE"] = 3] = "BUNDLE";
9
- })(ESubscriptionType = exports.ESubscriptionType || (exports.ESubscriptionType = {}));
package/models/User.d.ts CHANGED
@@ -26,9 +26,9 @@ export interface IPayload {
26
26
  accessLevel: IAccessLevel;
27
27
  tocAccepted: boolean;
28
28
  exp: number;
29
- stripeQBankSubscriptionEndDate: number | null;
30
- stripeOsceSubscriptionEndDate: number | null;
31
- stripeBundleSubscriptionEndDate: number | null;
29
+ qbankSubscriptionEndDate: number | null;
30
+ osceSubscriptionEndDate: number | null;
31
+ bundleSubscriptionEndDate: number | null;
32
32
  }
33
33
  export interface IDailyProgressInfo {
34
34
  totalCount: number;
@@ -48,18 +48,6 @@ export interface IUser {
48
48
  dailyFeedMax: number;
49
49
  stripeCustomerId: string;
50
50
  stripeLastSyncAt: number | Date | null;
51
- qBankSubscriptionId: Id;
52
- qBankSubscription: ISubscription | null;
53
- stripeQBankSubscriptionId: string;
54
- stripeQBankSubscriptionEndDate: number | Date;
55
- osceSubscriptionId: Id;
56
- osceSubscription: ISubscription | null;
57
- stripeOsceSubscriptionId: string;
58
- stripeOsceSubscriptionEndDate: number | Date;
59
- bundleSubscriptionId: Id;
60
- bundleSubscription: ISubscription | null;
61
- stripeBundleSubscriptionId: string;
62
- stripeBundleSubscriptionEndDate: number | Date;
63
51
  referralCount: number;
64
52
  classYear: IClassYear;
65
53
  graduationYear: number;
@@ -82,8 +70,12 @@ export interface IUser {
82
70
  dailyFeed: ITodo;
83
71
  dailyProgress: IDailyProgressInfo[];
84
72
  notifications: INotification[];
73
+ subscriptions: ISubscription[];
74
+ qbankSubscriptionEndDate: number | Date | null;
75
+ osceSubscriptionEndDate: number | Date | null;
76
+ bundleSubscriptionEndDate: number | Date | null;
85
77
  }
86
- export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear): IClassYear;
78
+ export declare function currentClassYear(createdAtUnix: number, classYear: IClassYear, compareUnix?: number): IClassYear;
87
79
  export declare function currentClassGroup(createdAtUnix: number, classYear: IClassYear): EClassYearGroup;
88
80
  export interface IUserCompletedQuestion {
89
81
  id: Id;
package/models/User.js CHANGED
@@ -26,7 +26,7 @@ exports.classYearGroup = {
26
26
  MSc: EClassYearGroup.CLINICAL,
27
27
  'Beta Tester': EClassYearGroup.CLINICAL,
28
28
  };
29
- function currentClassYear(createdAtUnix, classYear) {
29
+ function currentClassYear(createdAtUnix, classYear, compareUnix = new Date().getTime()) {
30
30
  if (createdAtUnix === 0) {
31
31
  throw new Error('createdAt not given in Unix');
32
32
  }
@@ -38,10 +38,10 @@ function currentClassYear(createdAtUnix, classYear) {
38
38
  if (classYearsIdx === -1) {
39
39
  return exports.classYears[lastClassYearIdx];
40
40
  }
41
- const now = new Date();
42
- const currentYear = now.getFullYear();
41
+ const compareDate = new Date(compareUnix * 1000);
42
+ const currentYear = compareDate.getFullYear();
43
43
  const createdAt = new Date(createdAtUnix * 1000);
44
- if (createdAt.getFullYear() > now.getFullYear()) {
44
+ if (createdAt.getFullYear() > compareDate.getFullYear()) {
45
45
  throw new Error('createdAt not given in Unix');
46
46
  }
47
47
  const createdYear = createdAt.getFullYear();
@@ -51,7 +51,7 @@ function currentClassYear(createdAtUnix, classYear) {
51
51
  if (createdAt > createdAcademicYear) {
52
52
  yearsAdded--;
53
53
  }
54
- if (now > nowAcademicYear) {
54
+ if (compareDate > nowAcademicYear) {
55
55
  yearsAdded++;
56
56
  }
57
57
  const newClassYearIdx = classYearsIdx + yearsAdded;
package/models/index.d.ts CHANGED
@@ -13,8 +13,10 @@ export * from './Notification';
13
13
  export * from './OsceMarksheet';
14
14
  export * from './OsceStation';
15
15
  export * from './Picture';
16
+ export * from './Product';
16
17
  export * from './Promo';
17
18
  export * from './Question';
19
+ export * from './Referrals';
18
20
  export * from './Subscription';
19
21
  export * from './Todo';
20
22
  export * from './Token';
@@ -23,4 +25,3 @@ export * from './Type';
23
25
  export * from './University';
24
26
  export * from './User';
25
27
  export * from './Video';
26
- export * from './Referrals';
package/models/index.js CHANGED
@@ -25,8 +25,10 @@ __exportStar(require("./Notification"), exports);
25
25
  __exportStar(require("./OsceMarksheet"), exports);
26
26
  __exportStar(require("./OsceStation"), exports);
27
27
  __exportStar(require("./Picture"), exports);
28
+ __exportStar(require("./Product"), exports);
28
29
  __exportStar(require("./Promo"), exports);
29
30
  __exportStar(require("./Question"), exports);
31
+ __exportStar(require("./Referrals"), exports);
30
32
  __exportStar(require("./Subscription"), exports);
31
33
  __exportStar(require("./Todo"), exports);
32
34
  __exportStar(require("./Token"), exports);
@@ -35,4 +37,3 @@ __exportStar(require("./Type"), exports);
35
37
  __exportStar(require("./University"), exports);
36
38
  __exportStar(require("./User"), exports);
37
39
  __exportStar(require("./Video"), exports);
38
- __exportStar(require("./Referrals"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.2.55",
3
+ "version": "2.2.58",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -18,12 +18,9 @@ exports.USER_FIELDS = (0, client_1.gql) `
18
18
  dailyFeedResetTime
19
19
  dailyFeedMax
20
20
  stripeCustomerId
21
- stripeQBankSubscriptionId
22
- stripeQBankSubscriptionEndDate
23
- stripeOsceSubscriptionId
24
- stripeOsceSubscriptionEndDate
25
- stripeBundleSubscriptionId
26
- stripeBundleSubscriptionEndDate
21
+ qbankSubscriptionEndDate
22
+ osceSubscriptionEndDate
23
+ bundleSubscriptionEndDate
27
24
 
28
25
  # user-specific keys
29
26
  # marksheets
@@ -188,7 +188,7 @@ export declare const LEAVE_MARKSHEET: import("@apollo/client").DocumentNode;
188
188
  export interface IEndMarksheetVar {
189
189
  marksheetId: Id;
190
190
  }
191
- export declare type IEndMarksheetData = RestrictedData<graphqlNormalize & boolean, 'endMarksheet'>;
191
+ export declare type IEndMarksheetData = RestrictedData<graphqlNormalize & IMarksheet, 'endMarksheet'>;
192
192
  export declare const END_MARKSHEET: import("@apollo/client").DocumentNode;
193
193
  /**
194
194
  * toggleStrikeOptions
@@ -2427,6 +2427,7 @@ exports.REMOVE_FLAGGED_QUESTION = (0, client_1.gql) `
2427
2427
  restricted {
2428
2428
  removeFlaggedQuestion(questionId: $questionId) {
2429
2429
  id
2430
+ markId
2430
2431
  }
2431
2432
  }
2432
2433
  }
@@ -2487,8 +2488,8 @@ exports.START_OR_JOIN_MARKSHEET = (0, client_1.gql) `
2487
2488
  questionChoiceId
2488
2489
  marksheetId
2489
2490
  timeTaken
2490
- isAnswered
2491
2491
  striked
2492
+ isAnswered
2492
2493
  mark
2493
2494
  question {
2494
2495
  ... on QuestionSBA {
@@ -3063,8 +3064,8 @@ exports.MODIFY_MARKSHEET_INFO = (0, client_1.gql) `
3063
3064
  questionChoiceId
3064
3065
  marksheetId
3065
3066
  timeTaken
3066
- isAnswered
3067
3067
  striked
3068
+ isAnswered
3068
3069
  mark
3069
3070
  question {
3070
3071
  ... on QuestionSBA {
@@ -3586,7 +3587,11 @@ exports.LEAVE_MARKSHEET = (0, client_1.gql) `
3586
3587
  exports.END_MARKSHEET = (0, client_1.gql) `
3587
3588
  mutation EndMarksheet($marksheetId: Int!) {
3588
3589
  restricted {
3589
- endMarksheet(marksheetId: $marksheetId)
3590
+ endMarksheet(marksheetId: $marksheetId) {
3591
+ id
3592
+ timeTaken
3593
+ endedAt
3594
+ }
3590
3595
  }
3591
3596
  }
3592
3597
  `;
@@ -3,9 +3,9 @@ export * from './author';
3
3
  export * from './blog';
4
4
  export * from './book';
5
5
  export * from './feedback';
6
+ export * from './product';
6
7
  export * as restricted from './restricted';
7
8
  export * from './sample';
8
- export * from './subscription';
9
9
  export * from './university';
10
10
  export * from './user';
11
11
  export * from './video';
@@ -28,9 +28,9 @@ __exportStar(require("./author"), exports);
28
28
  __exportStar(require("./blog"), exports);
29
29
  __exportStar(require("./book"), exports);
30
30
  __exportStar(require("./feedback"), exports);
31
+ __exportStar(require("./product"), exports);
31
32
  exports.restricted = __importStar(require("./restricted"));
32
33
  __exportStar(require("./sample"), exports);
33
- __exportStar(require("./subscription"), exports);
34
34
  __exportStar(require("./university"), exports);
35
35
  __exportStar(require("./user"), exports);
36
36
  __exportStar(require("./video"), exports);
@@ -0,0 +1,4 @@
1
+ import { IProduct } from '../../models';
2
+ import { graphqlNormalize, RootData } from '../types';
3
+ export declare type IProductsData = RootData<(graphqlNormalize & IProduct)[], 'products'>;
4
+ export declare const PRODUCTS: import("@apollo/client").DocumentNode;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SUBSCRIPTIONS = void 0;
3
+ exports.PRODUCTS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
- exports.SUBSCRIPTIONS = (0, client_1.gql) `
6
- query Subscriptions {
7
- subscriptions {
5
+ exports.PRODUCTS = (0, client_1.gql) `
6
+ query Products {
7
+ products {
8
8
  id
9
9
  createdAt
10
10
  description
@@ -1,4 +0,0 @@
1
- import { ISubscription } from '../../models';
2
- import { graphqlNormalize, RootData } from '../types';
3
- export declare type ISubscriptionsData = RootData<(graphqlNormalize & ISubscription)[], 'subscriptions'>;
4
- export declare const SUBSCRIPTIONS: import("@apollo/client").DocumentNode;