@quesmed/types-rn 2.6.292 → 2.6.294
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/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
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 {
|
|
@@ -46,6 +46,40 @@ exports.VIDEO_FIELDS = (0, client_1.gql) `
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
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
|
+
`;
|
|
49
83
|
exports.VIDEO_TOKENS_FIELDS = (0, client_1.gql) `
|
|
50
84
|
fragment VideoTokensFields on Video {
|
|
51
85
|
tokens {
|
|
@@ -105,7 +105,7 @@ const resolveConceptCacheId = (cache, conceptId) => {
|
|
|
105
105
|
const updateCacheOnUpsertConceptNote = (cache, result, options) => {
|
|
106
106
|
const { upsertConceptNote } = result?.data?.restricted || {};
|
|
107
107
|
const { variables } = options || {};
|
|
108
|
-
if (!variables
|
|
108
|
+
if (!variables) {
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
const cacheId = resolveConceptCacheId(cache, variables.conceptId);
|
|
@@ -157,7 +157,7 @@ exports.UPSERT_STATION_NOTE = (0, client_1.gql) `
|
|
|
157
157
|
const updateCacheOnUpsertStationNote = (cache, result, options) => {
|
|
158
158
|
const { upsertStationNote } = result?.data?.restricted || {};
|
|
159
159
|
const { variables } = options || {};
|
|
160
|
-
if (!variables
|
|
160
|
+
if (!variables) {
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
cache.writeFragment({
|
|
@@ -93,18 +93,37 @@ const updateCacheOnToggleVideoWatchLater = (cache, result) => {
|
|
|
93
93
|
});
|
|
94
94
|
// Keep the saved-only view of the library in step. Apollo caches per field
|
|
95
95
|
// and args, so videoLibrary(watchLater: true) is its own entry — and only
|
|
96
|
-
// when the Watch Later page has actually fetched it;
|
|
97
|
-
//
|
|
98
|
-
// since the list is ordered by saved-at and this cache has no place to put it.
|
|
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.
|
|
99
98
|
const variables = { watchLater: true };
|
|
100
99
|
const prev = cache.readQuery({
|
|
101
100
|
query: video_1.VIDEO_LIBRARY,
|
|
102
101
|
variables,
|
|
103
102
|
});
|
|
104
|
-
if (!prev
|
|
103
|
+
if (!prev) {
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
107
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
|
+
}
|
|
108
127
|
cache.writeQuery({
|
|
109
128
|
query: video_1.VIDEO_LIBRARY,
|
|
110
129
|
variables,
|
|
@@ -112,7 +131,7 @@ const updateCacheOnToggleVideoWatchLater = (cache, result) => {
|
|
|
112
131
|
...prev,
|
|
113
132
|
restricted: {
|
|
114
133
|
...prev.restricted,
|
|
115
|
-
videoLibrary:
|
|
134
|
+
videoLibrary: nextVideoLibrary,
|
|
116
135
|
},
|
|
117
136
|
},
|
|
118
137
|
});
|
|
@@ -120,37 +120,11 @@ exports.VIDEO = (0, client_1.gql) `
|
|
|
120
120
|
// products) or topic (everything else) the category dropdown is built from.
|
|
121
121
|
// Also serves the Watch Later page via the watchLater argument.
|
|
122
122
|
exports.VIDEO_LIBRARY = (0, client_1.gql) `
|
|
123
|
+
${fragments_1.VIDEO_LIBRARY_FIELDS}
|
|
123
124
|
query VideoLibrary($watchLater: Boolean) {
|
|
124
125
|
restricted {
|
|
125
126
|
videoLibrary(watchLater: $watchLater) {
|
|
126
|
-
|
|
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
|
-
}
|
|
127
|
+
...VideoLibraryFields
|
|
154
128
|
}
|
|
155
129
|
}
|
|
156
130
|
}
|