@quesmed/types 2.6.290 → 2.6.292

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.
@@ -143,6 +143,8 @@ export interface IOsceStation {
143
143
  userNote: null | IUserStationNote;
144
144
  public: boolean;
145
145
  clinicalData?: IClinicalDataModule[];
146
+ preDefined?: boolean;
147
+ createdBy?: Id;
146
148
  }
147
149
  export interface IOsceStationTopic {
148
150
  id: Id;
@@ -292,6 +292,7 @@ export interface IUserVideoStatus {
292
292
  videoId: Id;
293
293
  video: IVideo;
294
294
  status: EUserLearningStatus;
295
+ watchLater: boolean;
295
296
  user: IUser;
296
297
  }
297
298
  export interface IUserStationStatus {
@@ -1,6 +1,8 @@
1
1
  import { IConcept } from './Concept';
2
2
  import { IFile } from './File';
3
3
  import { IOsceStation } from './OsceStation';
4
+ import { IEntitlement } from './Product';
5
+ import { ITopic } from './Topic';
4
6
  import { Id } from './Type';
5
7
  import { EUserLearningStatus } from './User';
6
8
  export declare enum EVideoFilter {
@@ -36,6 +38,8 @@ export interface IVideo {
36
38
  duration: number;
37
39
  concepts: IConcept[];
38
40
  osceStation: IOsceStation;
41
+ entitlement?: IEntitlement;
42
+ topic?: ITopic;
39
43
  files: IFile[];
40
44
  send1hrPushAt: number | Date | null;
41
45
  sent1hrPushAt: number | Date | null;
@@ -44,6 +48,7 @@ export interface IVideo {
44
48
  viewsToday?: number | null;
45
49
  status?: EUserLearningStatus | null;
46
50
  userViewed?: boolean;
51
+ watchLater?: boolean;
47
52
  tokens: IVideoTokens;
48
53
  }
49
54
  export interface IVideoOsceStation {
@@ -30,6 +30,8 @@ exports.OSCE_STATION_FIELDS = (0, client_1.gql) `
30
30
  name
31
31
  hiddenName
32
32
  status
33
+ createdBy
34
+ preDefined
33
35
  aiEnabled
34
36
  examinerQuestions {
35
37
  index
@@ -3,3 +3,4 @@ export declare const VIDEO_FIELDS: import("@apollo/client").DocumentNode;
3
3
  export declare const VIDEO_TOKENS_FIELDS: import("@apollo/client").DocumentNode;
4
4
  export declare const VIDEO_STATUS_FRAGMENT: import("@apollo/client").DocumentNode;
5
5
  export declare const VIDEO_USER_VIEWED_FRAGMENT: import("@apollo/client").DocumentNode;
6
+ export declare const VIDEO_WATCH_LATER_FRAGMENT: import("@apollo/client").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VIDEO_USER_VIEWED_FRAGMENT = exports.VIDEO_STATUS_FRAGMENT = exports.VIDEO_TOKENS_FIELDS = exports.VIDEO_FIELDS = exports.VIDEO_FILE_FIELDS = void 0;
3
+ exports.VIDEO_WATCH_LATER_FRAGMENT = exports.VIDEO_USER_VIEWED_FRAGMENT = exports.VIDEO_STATUS_FRAGMENT = exports.VIDEO_TOKENS_FIELDS = exports.VIDEO_FIELDS = exports.VIDEO_FILE_FIELDS = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  exports.VIDEO_FILE_FIELDS = (0, client_1.gql) `
6
6
  fragment VideoFileFields on File {
@@ -31,6 +31,7 @@ exports.VIDEO_FIELDS = (0, client_1.gql) `
31
31
  viewsToday
32
32
  views
33
33
  userViewed
34
+ watchLater
34
35
  osceStation {
35
36
  id
36
37
  name
@@ -67,3 +68,8 @@ exports.VIDEO_USER_VIEWED_FRAGMENT = (0, client_1.gql) `
67
68
  userViewed
68
69
  }
69
70
  `;
71
+ exports.VIDEO_WATCH_LATER_FRAGMENT = (0, client_1.gql) `
72
+ fragment VideoWatchLater on Video {
73
+ watchLater
74
+ }
75
+ `;
@@ -8,3 +8,11 @@ export interface IVideoWatchedVar {
8
8
  }
9
9
  export type IVideoWatchedData = RestrictedData<graphqlNormalize & IVideo, 'videoWatched'>;
10
10
  export declare const updateCacheOnVideoWatched: (entitlementId?: EEntitlementType | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IVideoWatchedData>) => void;
11
+ export declare const TOGGLE_VIDEO_WATCH_LATER: import("@apollo/client").DocumentNode;
12
+ export interface IToggleVideoWatchLaterVar {
13
+ videoId: Id;
14
+ save: boolean;
15
+ }
16
+ export type IToggleVideoWatchLaterData = RestrictedData<graphqlNormalize & Pick<IVideo, 'id' | 'watchLater'>, 'toggleVideoWatchLater'>;
17
+ export declare const optimisticToggleVideoWatchLater: (videoId: Id, save: boolean) => IToggleVideoWatchLaterData;
18
+ export declare const updateCacheOnToggleVideoWatchLater: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IToggleVideoWatchLaterData>) => void;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateCacheOnVideoWatched = exports.VIDEO_WATCHED = void 0;
3
+ exports.updateCacheOnToggleVideoWatchLater = exports.optimisticToggleVideoWatchLater = exports.TOGGLE_VIDEO_WATCH_LATER = exports.updateCacheOnVideoWatched = exports.VIDEO_WATCHED = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const fragments_1 = require("../../fragments");
6
+ const video_1 = require("../../query/restricted/video");
6
7
  const osce_1 = require("../../query/restricted/osce");
7
8
  exports.VIDEO_WATCHED = (0, client_1.gql) `
8
9
  mutation VideoWatched($id: Int!) {
@@ -59,3 +60,61 @@ const updateCacheOnVideoWatched = (entitlementId) => (cache, result) => {
59
60
  }
60
61
  };
61
62
  exports.updateCacheOnVideoWatched = updateCacheOnVideoWatched;
63
+ exports.TOGGLE_VIDEO_WATCH_LATER = (0, client_1.gql) `
64
+ mutation ToggleVideoWatchLater($videoId: Int!, $save: Boolean!) {
65
+ restricted {
66
+ toggleVideoWatchLater(videoId: $videoId, save: $save) {
67
+ id
68
+ watchLater
69
+ }
70
+ }
71
+ }
72
+ `;
73
+ const optimisticToggleVideoWatchLater = (videoId, save) => ({
74
+ restricted: {
75
+ toggleVideoWatchLater: {
76
+ __typename: 'Video',
77
+ id: videoId,
78
+ watchLater: save,
79
+ },
80
+ },
81
+ });
82
+ exports.optimisticToggleVideoWatchLater = optimisticToggleVideoWatchLater;
83
+ const updateCacheOnToggleVideoWatchLater = (cache, result) => {
84
+ const { toggleVideoWatchLater } = result?.data?.restricted || {};
85
+ if (!toggleVideoWatchLater) {
86
+ return;
87
+ }
88
+ const { id, watchLater } = toggleVideoWatchLater;
89
+ cache.writeFragment({
90
+ id: cache.identify({ id, __typename: 'Video' }),
91
+ data: { watchLater },
92
+ fragment: fragments_1.VIDEO_WATCH_LATER_FRAGMENT,
93
+ });
94
+ // Keep the saved-only view of the library in step. Apollo caches per field
95
+ // and args, so videoLibrary(watchLater: true) is its own entry — and only
96
+ // when the Watch Later page has actually fetched it; reading an absent query
97
+ // would throw. Unsaving splices the video out; saving is left to a refetch,
98
+ // since the list is ordered by saved-at and this cache has no place to put it.
99
+ const variables = { watchLater: true };
100
+ const prev = cache.readQuery({
101
+ query: video_1.VIDEO_LIBRARY,
102
+ variables,
103
+ });
104
+ if (!prev || watchLater) {
105
+ return;
106
+ }
107
+ const { videoLibrary } = prev.restricted;
108
+ cache.writeQuery({
109
+ query: video_1.VIDEO_LIBRARY,
110
+ variables,
111
+ data: {
112
+ ...prev,
113
+ restricted: {
114
+ ...prev.restricted,
115
+ videoLibrary: videoLibrary.filter((video) => Number(video.id) !== Number(id)),
116
+ },
117
+ },
118
+ });
119
+ };
120
+ exports.updateCacheOnToggleVideoWatchLater = updateCacheOnToggleVideoWatchLater;
@@ -6,6 +6,11 @@ export interface IVideoVar {
6
6
  }
7
7
  export type IVideoData = RestrictedData<graphqlNormalize & IVideo, 'video'>;
8
8
  export declare const VIDEO: import("@apollo/client").DocumentNode;
9
+ export interface IVideoLibraryVar {
10
+ watchLater?: boolean;
11
+ }
12
+ export type IVideoLibraryData = RestrictedData<(graphqlNormalize & IVideo)[], 'videoLibrary'>;
13
+ export declare const VIDEO_LIBRARY: import("@apollo/client").DocumentNode;
9
14
  export interface IVideosVar {
10
15
  platform: EPlatformId;
11
16
  filter: EVideoFilter;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VIDEOS = exports.VIDEO = void 0;
3
+ exports.VIDEOS = exports.VIDEO_LIBRARY = exports.VIDEO = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const fragments_1 = require("../../fragments");
6
6
  exports.VIDEO = (0, client_1.gql) `
@@ -17,6 +17,7 @@ exports.VIDEO = (0, client_1.gql) `
17
17
  viewsToday
18
18
  views
19
19
  userViewed
20
+ watchLater
20
21
  thumbnail
21
22
  playbackId
22
23
  assetId
@@ -114,6 +115,46 @@ exports.VIDEO = (0, client_1.gql) `
114
115
  }
115
116
  }
116
117
  `;
118
+ // Lean replacement for OSCE_KNOWLEDGE_VIDEO_LIBRARY: a flat video list carrying
119
+ // only what the library grid/list renders, plus the entitlement (station
120
+ // products) or topic (everything else) the category dropdown is built from.
121
+ // Also serves the Watch Later page via the watchLater argument.
122
+ exports.VIDEO_LIBRARY = (0, client_1.gql) `
123
+ query VideoLibrary($watchLater: Boolean) {
124
+ restricted {
125
+ videoLibrary(watchLater: $watchLater) {
126
+ id
127
+ title
128
+ # legacy videos.thumbnail — fallback for videos with no bunnyId
129
+ thumbnail
130
+ # signed Bunny assets, 6h expiry — prefer tokens.thumbnail when present
131
+ tokens {
132
+ thumbnail
133
+ gif
134
+ bunnyUrl
135
+ }
136
+ duration
137
+ status
138
+ watchLater
139
+ userViewed
140
+ demo
141
+ entitlement {
142
+ id
143
+ name
144
+ }
145
+ topic {
146
+ id
147
+ name
148
+ }
149
+ osceStation {
150
+ id
151
+ name
152
+ hiddenName
153
+ }
154
+ }
155
+ }
156
+ }
157
+ `;
117
158
  exports.VIDEOS = (0, client_1.gql) `
118
159
  query Videos($platform: Int!, $filter: Int!, $search: String, $limit: Int!) {
119
160
  restricted {
@@ -143,6 +143,8 @@ export interface IOsceStation {
143
143
  userNote: null | IUserStationNote;
144
144
  public: boolean;
145
145
  clinicalData?: IClinicalDataModule[];
146
+ preDefined?: boolean;
147
+ createdBy?: Id;
146
148
  }
147
149
  export interface IOsceStationTopic {
148
150
  id: Id;
@@ -292,6 +292,7 @@ export interface IUserVideoStatus {
292
292
  videoId: Id;
293
293
  video: IVideo;
294
294
  status: EUserLearningStatus;
295
+ watchLater: boolean;
295
296
  user: IUser;
296
297
  }
297
298
  export interface IUserStationStatus {
@@ -1,6 +1,8 @@
1
1
  import { IConcept } from './Concept';
2
2
  import { IFile } from './File';
3
3
  import { IOsceStation } from './OsceStation';
4
+ import { IEntitlement } from './Product';
5
+ import { ITopic } from './Topic';
4
6
  import { Id } from './Type';
5
7
  import { EUserLearningStatus } from './User';
6
8
  export declare enum EVideoFilter {
@@ -36,6 +38,8 @@ export interface IVideo {
36
38
  duration: number;
37
39
  concepts: IConcept[];
38
40
  osceStation: IOsceStation;
41
+ entitlement?: IEntitlement;
42
+ topic?: ITopic;
39
43
  files: IFile[];
40
44
  send1hrPushAt: number | Date | null;
41
45
  sent1hrPushAt: number | Date | null;
@@ -44,6 +48,7 @@ export interface IVideo {
44
48
  viewsToday?: number | null;
45
49
  status?: EUserLearningStatus | null;
46
50
  userViewed?: boolean;
51
+ watchLater?: boolean;
47
52
  tokens: IVideoTokens;
48
53
  }
49
54
  export interface IVideoOsceStation {
@@ -27,6 +27,8 @@ export const OSCE_STATION_FIELDS = gql `
27
27
  name
28
28
  hiddenName
29
29
  status
30
+ createdBy
31
+ preDefined
30
32
  aiEnabled
31
33
  examinerQuestions {
32
34
  index
@@ -3,3 +3,4 @@ export declare const VIDEO_FIELDS: import("@apollo/client").DocumentNode;
3
3
  export declare const VIDEO_TOKENS_FIELDS: import("@apollo/client").DocumentNode;
4
4
  export declare const VIDEO_STATUS_FRAGMENT: import("@apollo/client").DocumentNode;
5
5
  export declare const VIDEO_USER_VIEWED_FRAGMENT: import("@apollo/client").DocumentNode;
6
+ export declare const VIDEO_WATCH_LATER_FRAGMENT: import("@apollo/client").DocumentNode;
@@ -28,6 +28,7 @@ export const VIDEO_FIELDS = gql `
28
28
  viewsToday
29
29
  views
30
30
  userViewed
31
+ watchLater
31
32
  osceStation {
32
33
  id
33
34
  name
@@ -64,3 +65,8 @@ export const VIDEO_USER_VIEWED_FRAGMENT = gql `
64
65
  userViewed
65
66
  }
66
67
  `;
68
+ export const VIDEO_WATCH_LATER_FRAGMENT = gql `
69
+ fragment VideoWatchLater on Video {
70
+ watchLater
71
+ }
72
+ `;
@@ -8,3 +8,11 @@ export interface IVideoWatchedVar {
8
8
  }
9
9
  export type IVideoWatchedData = RestrictedData<graphqlNormalize & IVideo, 'videoWatched'>;
10
10
  export declare const updateCacheOnVideoWatched: (entitlementId?: EEntitlementType | null) => (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IVideoWatchedData>) => void;
11
+ export declare const TOGGLE_VIDEO_WATCH_LATER: import("@apollo/client").DocumentNode;
12
+ export interface IToggleVideoWatchLaterVar {
13
+ videoId: Id;
14
+ save: boolean;
15
+ }
16
+ export type IToggleVideoWatchLaterData = RestrictedData<graphqlNormalize & Pick<IVideo, 'id' | 'watchLater'>, 'toggleVideoWatchLater'>;
17
+ export declare const optimisticToggleVideoWatchLater: (videoId: Id, save: boolean) => IToggleVideoWatchLaterData;
18
+ export declare const updateCacheOnToggleVideoWatchLater: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IToggleVideoWatchLaterData>) => void;
@@ -1,5 +1,6 @@
1
1
  import { gql } from '@apollo/client';
2
- import { VIDEO_USER_VIEWED_FRAGMENT } from '../../fragments';
2
+ import { VIDEO_USER_VIEWED_FRAGMENT, VIDEO_WATCH_LATER_FRAGMENT, } from '../../fragments';
3
+ import { VIDEO_LIBRARY, } from '../../query/restricted/video';
3
4
  import { OSCE_STATS, } from '../../query/restricted/osce';
4
5
  export const VIDEO_WATCHED = gql `
5
6
  mutation VideoWatched($id: Int!) {
@@ -55,3 +56,59 @@ export const updateCacheOnVideoWatched = (entitlementId) => (cache, result) => {
55
56
  }
56
57
  }
57
58
  };
59
+ export const TOGGLE_VIDEO_WATCH_LATER = gql `
60
+ mutation ToggleVideoWatchLater($videoId: Int!, $save: Boolean!) {
61
+ restricted {
62
+ toggleVideoWatchLater(videoId: $videoId, save: $save) {
63
+ id
64
+ watchLater
65
+ }
66
+ }
67
+ }
68
+ `;
69
+ export const optimisticToggleVideoWatchLater = (videoId, save) => ({
70
+ restricted: {
71
+ toggleVideoWatchLater: {
72
+ __typename: 'Video',
73
+ id: videoId,
74
+ watchLater: save,
75
+ },
76
+ },
77
+ });
78
+ export const updateCacheOnToggleVideoWatchLater = (cache, result) => {
79
+ const { toggleVideoWatchLater } = result?.data?.restricted || {};
80
+ if (!toggleVideoWatchLater) {
81
+ return;
82
+ }
83
+ const { id, watchLater } = toggleVideoWatchLater;
84
+ cache.writeFragment({
85
+ id: cache.identify({ id, __typename: 'Video' }),
86
+ data: { watchLater },
87
+ fragment: VIDEO_WATCH_LATER_FRAGMENT,
88
+ });
89
+ // Keep the saved-only view of the library in step. Apollo caches per field
90
+ // and args, so videoLibrary(watchLater: true) is its own entry — and only
91
+ // when the Watch Later page has actually fetched it; reading an absent query
92
+ // would throw. Unsaving splices the video out; saving is left to a refetch,
93
+ // since the list is ordered by saved-at and this cache has no place to put it.
94
+ const variables = { watchLater: true };
95
+ const prev = cache.readQuery({
96
+ query: VIDEO_LIBRARY,
97
+ variables,
98
+ });
99
+ if (!prev || watchLater) {
100
+ return;
101
+ }
102
+ const { videoLibrary } = prev.restricted;
103
+ cache.writeQuery({
104
+ query: VIDEO_LIBRARY,
105
+ variables,
106
+ data: {
107
+ ...prev,
108
+ restricted: {
109
+ ...prev.restricted,
110
+ videoLibrary: videoLibrary.filter((video) => Number(video.id) !== Number(id)),
111
+ },
112
+ },
113
+ });
114
+ };
@@ -6,6 +6,11 @@ export interface IVideoVar {
6
6
  }
7
7
  export type IVideoData = RestrictedData<graphqlNormalize & IVideo, 'video'>;
8
8
  export declare const VIDEO: import("@apollo/client").DocumentNode;
9
+ export interface IVideoLibraryVar {
10
+ watchLater?: boolean;
11
+ }
12
+ export type IVideoLibraryData = RestrictedData<(graphqlNormalize & IVideo)[], 'videoLibrary'>;
13
+ export declare const VIDEO_LIBRARY: import("@apollo/client").DocumentNode;
9
14
  export interface IVideosVar {
10
15
  platform: EPlatformId;
11
16
  filter: EVideoFilter;
@@ -14,6 +14,7 @@ export const VIDEO = gql `
14
14
  viewsToday
15
15
  views
16
16
  userViewed
17
+ watchLater
17
18
  thumbnail
18
19
  playbackId
19
20
  assetId
@@ -111,6 +112,46 @@ export const VIDEO = gql `
111
112
  }
112
113
  }
113
114
  `;
115
+ // Lean replacement for OSCE_KNOWLEDGE_VIDEO_LIBRARY: a flat video list carrying
116
+ // only what the library grid/list renders, plus the entitlement (station
117
+ // products) or topic (everything else) the category dropdown is built from.
118
+ // Also serves the Watch Later page via the watchLater argument.
119
+ export const VIDEO_LIBRARY = gql `
120
+ query VideoLibrary($watchLater: Boolean) {
121
+ restricted {
122
+ videoLibrary(watchLater: $watchLater) {
123
+ id
124
+ title
125
+ # legacy videos.thumbnail — fallback for videos with no bunnyId
126
+ thumbnail
127
+ # signed Bunny assets, 6h expiry — prefer tokens.thumbnail when present
128
+ tokens {
129
+ thumbnail
130
+ gif
131
+ bunnyUrl
132
+ }
133
+ duration
134
+ status
135
+ watchLater
136
+ userViewed
137
+ demo
138
+ entitlement {
139
+ id
140
+ name
141
+ }
142
+ topic {
143
+ id
144
+ name
145
+ }
146
+ osceStation {
147
+ id
148
+ name
149
+ hiddenName
150
+ }
151
+ }
152
+ }
153
+ }
154
+ `;
114
155
  export const VIDEOS = gql `
115
156
  query Videos($platform: Int!, $filter: Int!, $search: String, $limit: Int!) {
116
157
  restricted {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.290",
3
+ "version": "2.6.292",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",