@quesmed/types 2.6.88 → 2.6.89

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.
@@ -113,10 +113,16 @@ export interface IUserSettings {
113
113
  productSettings: {
114
114
  examDate: number | Date | null;
115
115
  nextFeedbackDate: number | Date;
116
- feedback: string | null;
117
- rating: number | null;
118
116
  };
119
117
  }
118
+ export interface IProductFeedback {
119
+ id: Id;
120
+ userId: Id;
121
+ productId: EProductType;
122
+ rating: number;
123
+ feedback: string;
124
+ createdAt: number | Date;
125
+ }
120
126
  export interface IUser {
121
127
  id: Id;
122
128
  createdAt: number | Date;
@@ -69,8 +69,6 @@ exports.USER_SETTINGS_FIELDS = (0, client_1.gql) `
69
69
  addToDailyFlashcards
70
70
  }
71
71
  productSettings {
72
- feedback
73
- rating
74
72
  examDate
75
73
  nextFeedbackDate
76
74
  }
@@ -1,5 +1,5 @@
1
1
  import { ApolloCache } from '@apollo/client';
2
- import { EUserLearningStatus, IUser, IUserConceptStatus, IUserSettings, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
2
+ import { EUserLearningStatus, IProductFeedback, IUser, IUserConceptStatus, IUserSettings, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
3
3
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
4
  import { DeepPartial, RestrictedData, graphqlNormalize } from '../../types';
5
5
  export declare const LOGOUT_USER: import("@apollo/client").DocumentNode;
@@ -44,6 +44,13 @@ export type IUpdateUserData = RestrictedData<{
44
44
  user: IUser & graphqlNormalize;
45
45
  }, 'updateUser'>;
46
46
  export declare const UPDATE_USER_SETTINGS: import("@apollo/client").DocumentNode;
47
+ export interface IAddProductFeedbackVar {
48
+ rating: number;
49
+ feedback: string;
50
+ }
51
+ export type IAddProductFeedbackData = RestrictedData<IProductFeedback & graphqlNormalize, 'addProductFeedback'>;
52
+ export declare const ADD_PRODUCT_FEEDBACK: import("@apollo/client").DocumentNode;
53
+ export declare const optimisticAddProductFeedback: (input: IAddProductFeedbackVar) => IAddProductFeedbackData;
47
54
  export interface IUpdateUserSettingsVar {
48
55
  input: Omit<DeepPartial<IUserSettings>, 'id' | 'userId' | 'updatedAt'>;
49
56
  }
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.optimisticVideoLearningStatus = exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.optimisticStationLearningStatus = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.optimisticConceptLearningStatus = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.updateCacheOnUpdateUserSettings = exports.optimisticUpdateUserSettings = exports.UPDATE_USER_SETTINGS = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = void 0;
3
+ exports.optimisticVideoLearningStatus = exports.updateCacheOnVideoLearningStatusUpdate = exports.UPSERT_USER_VIDEO_STATUS = exports.optimisticStationLearningStatus = exports.updateCacheOnStationLearningStatusUpdate = exports.UPSERT_USER_STATION_STATUS = exports.optimisticConceptLearningStatus = exports.updateCacheOnConceptLearningStatusUpdate = exports.UPSERT_USER_CONCEPT_STATUS = exports.TOC_ACCEPT = exports.RENEW_TOKEN = exports.updateCacheOnUpdateUserSettings = exports.optimisticUpdateUserSettings = exports.optimisticAddProductFeedback = exports.ADD_PRODUCT_FEEDBACK = exports.UPDATE_USER_SETTINGS = exports.UPDATE_USER = exports.DELETE_USER = exports.RESET_CATEGORY_PROGRESS = exports.RESET_PROGRESS = exports.LOGOUT_USER = void 0;
4
4
  const client_1 = require("@apollo/client");
5
5
  const models_1 = require("../../../models");
6
+ const utils_1 = require("../../../utils");
6
7
  const fragments_1 = require("../../fragments");
7
8
  exports.LOGOUT_USER = (0, client_1.gql) `
8
9
  mutation LogoutUser($all: Boolean!) {
@@ -72,6 +73,32 @@ exports.UPDATE_USER_SETTINGS = (0, client_1.gql) `
72
73
  }
73
74
  }
74
75
  `;
76
+ exports.ADD_PRODUCT_FEEDBACK = (0, client_1.gql) `
77
+ mutation AddProductFeedback($rating: Int!, $feedback: String!) {
78
+ restricted {
79
+ addProductFeedback(rating: $rating, feedback: $feedback) {
80
+ id
81
+ userId
82
+ createdAt
83
+ rating
84
+ feedback
85
+ productId
86
+ }
87
+ }
88
+ }
89
+ `;
90
+ const optimisticAddProductFeedback = (input) => ({
91
+ restricted: {
92
+ addProductFeedback: {
93
+ ...input,
94
+ createdAt: new Date(),
95
+ userId: 1,
96
+ productId: 1,
97
+ id: (0, utils_1.randomInt)(),
98
+ },
99
+ },
100
+ });
101
+ exports.optimisticAddProductFeedback = optimisticAddProductFeedback;
75
102
  const optimisticUpdateUserSettings = (settings) => ({ input }) => ({
76
103
  restricted: {
77
104
  updateUserSettings: {
@@ -113,10 +113,16 @@ export interface IUserSettings {
113
113
  productSettings: {
114
114
  examDate: number | Date | null;
115
115
  nextFeedbackDate: number | Date;
116
- feedback: string | null;
117
- rating: number | null;
118
116
  };
119
117
  }
118
+ export interface IProductFeedback {
119
+ id: Id;
120
+ userId: Id;
121
+ productId: EProductType;
122
+ rating: number;
123
+ feedback: string;
124
+ createdAt: number | Date;
125
+ }
120
126
  export interface IUser {
121
127
  id: Id;
122
128
  createdAt: number | Date;
@@ -66,8 +66,6 @@ export const USER_SETTINGS_FIELDS = gql `
66
66
  addToDailyFlashcards
67
67
  }
68
68
  productSettings {
69
- feedback
70
- rating
71
69
  examDate
72
70
  nextFeedbackDate
73
71
  }
@@ -1,5 +1,5 @@
1
1
  import { ApolloCache } from '@apollo/client';
2
- import { EUserLearningStatus, IUser, IUserConceptStatus, IUserSettings, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
2
+ import { EUserLearningStatus, IProductFeedback, IUser, IUserConceptStatus, IUserSettings, IUserStationStatus, IUserVideoStatus, Id } from '../../../models';
3
3
  import { ApolloUpdateOptions, ApolloUpdateResultRestricted } from '../../apollo';
4
4
  import { DeepPartial, RestrictedData, graphqlNormalize } from '../../types';
5
5
  export declare const LOGOUT_USER: import("@apollo/client").DocumentNode;
@@ -44,6 +44,13 @@ export type IUpdateUserData = RestrictedData<{
44
44
  user: IUser & graphqlNormalize;
45
45
  }, 'updateUser'>;
46
46
  export declare const UPDATE_USER_SETTINGS: import("@apollo/client").DocumentNode;
47
+ export interface IAddProductFeedbackVar {
48
+ rating: number;
49
+ feedback: string;
50
+ }
51
+ export type IAddProductFeedbackData = RestrictedData<IProductFeedback & graphqlNormalize, 'addProductFeedback'>;
52
+ export declare const ADD_PRODUCT_FEEDBACK: import("@apollo/client").DocumentNode;
53
+ export declare const optimisticAddProductFeedback: (input: IAddProductFeedbackVar) => IAddProductFeedbackData;
47
54
  export interface IUpdateUserSettingsVar {
48
55
  input: Omit<DeepPartial<IUserSettings>, 'id' | 'userId' | 'updatedAt'>;
49
56
  }
@@ -1,5 +1,6 @@
1
1
  import { gql } from '@apollo/client';
2
2
  import { EUserLearningStatus, } from '../../../models';
3
+ import { randomInt } from '../../../utils';
3
4
  import { UPDATE_USER_SETTINGS_FRAGMENT, USER_SETTINGS_FIELDS, } from '../../fragments';
4
5
  export const LOGOUT_USER = gql `
5
6
  mutation LogoutUser($all: Boolean!) {
@@ -69,6 +70,31 @@ export const UPDATE_USER_SETTINGS = gql `
69
70
  }
70
71
  }
71
72
  `;
73
+ export const ADD_PRODUCT_FEEDBACK = gql `
74
+ mutation AddProductFeedback($rating: Int!, $feedback: String!) {
75
+ restricted {
76
+ addProductFeedback(rating: $rating, feedback: $feedback) {
77
+ id
78
+ userId
79
+ createdAt
80
+ rating
81
+ feedback
82
+ productId
83
+ }
84
+ }
85
+ }
86
+ `;
87
+ export const optimisticAddProductFeedback = (input) => ({
88
+ restricted: {
89
+ addProductFeedback: {
90
+ ...input,
91
+ createdAt: new Date(),
92
+ userId: 1,
93
+ productId: 1,
94
+ id: randomInt(),
95
+ },
96
+ },
97
+ });
72
98
  export const optimisticUpdateUserSettings = (settings) => ({ input }) => ({
73
99
  restricted: {
74
100
  updateUserSettings: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quesmed/types",
3
- "version": "2.6.88",
3
+ "version": "2.6.89",
4
4
  "description": "Typescript types for Quesmed",
5
5
  "keywords": [
6
6
  "quesmed",