@quesmed/types-rn 2.6.291 → 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.
- package/models/User.d.ts +1 -0
- package/models/Video.d.ts +5 -0
- package/package.json +1 -1
- package/resolvers/fragments/video.d.ts +1 -0
- package/resolvers/fragments/video.js +7 -1
- package/resolvers/mutation/restricted/video.d.ts +8 -0
- package/resolvers/mutation/restricted/video.js +60 -1
- package/resolvers/query/restricted/video.d.ts +5 -0
- package/resolvers/query/restricted/video.js +42 -1
package/models/User.d.ts
CHANGED
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
|
@@ -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 {
|