@quesmed/types-rn 2.6.65 → 2.6.66

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types-rn",
3
- "version": "2.6.65",
3
+ "version": "2.6.66",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",
@@ -1,3 +1,4 @@
1
1
  export declare const VIDEO_FILE_FIELDS: import("@apollo/client").DocumentNode;
2
2
  export declare const VIDEO_FIELDS: import("@apollo/client").DocumentNode;
3
3
  export declare const VIDEO_STATUS_FRAGMENT: import("@apollo/client").DocumentNode;
4
+ 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_STATUS_FRAGMENT = exports.VIDEO_FIELDS = exports.VIDEO_FILE_FIELDS = void 0;
3
+ exports.VIDEO_USER_VIEWED_FRAGMENT = exports.VIDEO_STATUS_FRAGMENT = 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 {
@@ -50,3 +50,8 @@ exports.VIDEO_STATUS_FRAGMENT = (0, client_1.gql) `
50
50
  status
51
51
  }
52
52
  `;
53
+ exports.VIDEO_USER_VIEWED_FRAGMENT = (0, client_1.gql) `
54
+ fragment VideoUserViewed on Video {
55
+ userViewed
56
+ }
57
+ `;
@@ -1,7 +1,10 @@
1
- import { Id, IVideo } from '../../../models';
2
- import { graphqlNormalize, RestrictedData } from '../../types';
1
+ import { ApolloCache } from '@apollo/client';
2
+ import { IVideo, Id } from '../../../models';
3
+ import { ApolloUpdateResultRestricted } from '../../apollo';
4
+ import { RestrictedData, graphqlNormalize } from '../../types';
3
5
  export declare const VIDEO_WATCHED: import("@apollo/client").DocumentNode;
4
6
  export interface IVideoWatchedVar {
5
7
  id: Id;
6
8
  }
7
9
  export type IVideoWatchedData = RestrictedData<graphqlNormalize & IVideo, 'videoWatched'>;
10
+ export declare const updateCacheOnVideoWatched: (cache: ApolloCache<any>, result: ApolloUpdateResultRestricted<IVideoWatchedData>) => void;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.VIDEO_WATCHED = void 0;
3
+ exports.updateCacheOnVideoWatched = exports.VIDEO_WATCHED = void 0;
4
4
  const client_1 = require("@apollo/client");
5
+ const fragments_1 = require("../../fragments");
5
6
  exports.VIDEO_WATCHED = (0, client_1.gql) `
6
7
  mutation VideoWatched($id: Int!) {
7
8
  restricted {
@@ -13,3 +14,18 @@ exports.VIDEO_WATCHED = (0, client_1.gql) `
13
14
  }
14
15
  }
15
16
  `;
17
+ const updateCacheOnVideoWatched = (cache, result) => {
18
+ const { videoWatched } = result?.data?.restricted || {};
19
+ if (!videoWatched) {
20
+ return;
21
+ }
22
+ const { id } = videoWatched;
23
+ cache.writeFragment({
24
+ id: cache.identify({ id, __typename: 'Video' }),
25
+ data: {
26
+ userViewed: true,
27
+ },
28
+ fragment: fragments_1.VIDEO_USER_VIEWED_FRAGMENT,
29
+ });
30
+ };
31
+ exports.updateCacheOnVideoWatched = updateCacheOnVideoWatched;