@quesmed/types-rn 2.6.291 → 2.6.293

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
@@ -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 {
package/models/Video.d.ts CHANGED
@@ -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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.291",
3
+ "version": "2.6.293",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -1,5 +1,7 @@
1
1
  export declare const VIDEO_FILE_FIELDS: import("@apollo/client").DocumentNode;
2
2
  export declare const VIDEO_FIELDS: import("@apollo/client").DocumentNode;
3
+ export declare const VIDEO_LIBRARY_FIELDS: import("@apollo/client").DocumentNode;
3
4
  export declare const VIDEO_TOKENS_FIELDS: import("@apollo/client").DocumentNode;
4
5
  export declare const VIDEO_STATUS_FRAGMENT: import("@apollo/client").DocumentNode;
5
6
  export declare const VIDEO_USER_VIEWED_FRAGMENT: import("@apollo/client").DocumentNode;
7
+ 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_LIBRARY_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
@@ -45,6 +46,40 @@ exports.VIDEO_FIELDS = (0, client_1.gql) `
45
46
  }
46
47
  }
47
48
  `;
49
+ // The VIDEO_LIBRARY selection, named so the cache updater can rebuild a list
50
+ // entry from the normalized Video entity without drifting from the query.
51
+ exports.VIDEO_LIBRARY_FIELDS = (0, client_1.gql) `
52
+ fragment VideoLibraryFields on Video {
53
+ id
54
+ title
55
+ # legacy videos.thumbnail — fallback for videos with no bunnyId
56
+ thumbnail
57
+ # signed Bunny assets, 6h expiry — prefer tokens.thumbnail when present
58
+ tokens {
59
+ thumbnail
60
+ gif
61
+ bunnyUrl
62
+ }
63
+ duration
64
+ status
65
+ watchLater
66
+ userViewed
67
+ demo
68
+ entitlement {
69
+ id
70
+ name
71
+ }
72
+ topic {
73
+ id
74
+ name
75
+ }
76
+ osceStation {
77
+ id
78
+ name
79
+ hiddenName
80
+ }
81
+ }
82
+ `;
48
83
  exports.VIDEO_TOKENS_FIELDS = (0, client_1.gql) `
49
84
  fragment VideoTokensFields on Video {
50
85
  tokens {
@@ -67,3 +102,8 @@ exports.VIDEO_USER_VIEWED_FRAGMENT = (0, client_1.gql) `
67
102
  userViewed
68
103
  }
69
104
  `;
105
+ exports.VIDEO_WATCH_LATER_FRAGMENT = (0, client_1.gql) `
106
+ fragment VideoWatchLater on Video {
107
+ watchLater
108
+ }
109
+ `;
@@ -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,80 @@ 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; there is nothing to
97
+ // reconcile before then, and the page's first fetch covers it.
98
+ const variables = { watchLater: true };
99
+ const prev = cache.readQuery({
100
+ query: video_1.VIDEO_LIBRARY,
101
+ variables,
102
+ });
103
+ if (!prev) {
104
+ return;
105
+ }
106
+ const { videoLibrary } = prev.restricted;
107
+ let nextVideoLibrary;
108
+ if (watchLater) {
109
+ if (videoLibrary.some((video) => Number(video.id) === Number(id))) {
110
+ return;
111
+ }
112
+ // The list is ordered saved-at descending, so the video just saved belongs
113
+ // at the top. Its fields are already normalized under Video:id by the
114
+ // library query, so the entry is rebuilt from the cache, not the wire.
115
+ const video = cache.readFragment({
116
+ id: cache.identify({ id, __typename: 'Video' }),
117
+ fragment: fragments_1.VIDEO_LIBRARY_FIELDS,
118
+ });
119
+ if (!video) {
120
+ return;
121
+ }
122
+ nextVideoLibrary = [{ ...video, watchLater: true }, ...videoLibrary];
123
+ }
124
+ else {
125
+ nextVideoLibrary = videoLibrary.filter((video) => Number(video.id) !== Number(id));
126
+ }
127
+ cache.writeQuery({
128
+ query: video_1.VIDEO_LIBRARY,
129
+ variables,
130
+ data: {
131
+ ...prev,
132
+ restricted: {
133
+ ...prev.restricted,
134
+ videoLibrary: nextVideoLibrary,
135
+ },
136
+ },
137
+ });
138
+ };
139
+ 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,20 @@ 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
+ ${fragments_1.VIDEO_LIBRARY_FIELDS}
124
+ query VideoLibrary($watchLater: Boolean) {
125
+ restricted {
126
+ videoLibrary(watchLater: $watchLater) {
127
+ ...VideoLibraryFields
128
+ }
129
+ }
130
+ }
131
+ `;
117
132
  exports.VIDEOS = (0, client_1.gql) `
118
133
  query Videos($platform: Int!, $filter: Int!, $search: String, $limit: Int!) {
119
134
  restricted {