@jsb188/graphql 1.1.4 → 1.1.5

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.
@@ -2,11 +2,11 @@ import { getENVVariable } from '@jsb188/app';
2
2
  import { getAuthToken } from '@jsb188/app/utils/api';
3
3
  import SSE from '@jsb188/sse';
4
4
  import { useEffect, useState } from 'react';
5
- import { loadFragment } from '../cache/';
5
+ import { loadFragment, loadQuery, makeVariablesKey, updateQuery } from '../cache/';
6
6
  import { useQuery } from '../client';
7
7
  import { aiChatMessagesQry, aiChatQry, aiChatsQry } from '../gql/queries/aiChatQueries';
8
8
  import handleSSEData, { type PublishPayload } from '../sse';
9
- import type { UseQueryParams } from '../types.d';
9
+ import type { UpdateObserversFn, UseQueryParams } from '../types.d';
10
10
 
11
11
  /**
12
12
  * Constants
@@ -105,6 +105,39 @@ export function useAIChatWithSSE(aiChatId?: string, initialSessionKey?: string |
105
105
  }
106
106
  }, [dataAIChatId, sessionKey]);
107
107
 
108
+ useEffect(() => {
109
+ // Every time AIChat is fetched, check if it exists in lists cache
110
+ if (dataAIChatId) {
111
+ const variablesKey = makeVariablesKey({
112
+ filter: aiChat.calDate ? 'CAL_DATE' : 'CHATS',
113
+ cursor: null,
114
+ after: false,
115
+ limit: AI_CHATS_LIMIT
116
+ });
117
+
118
+ const queryKey = `#aiChats:${variablesKey}`;
119
+ const queryCache = loadQuery(queryKey);
120
+
121
+ if (queryCache) {
122
+ const notFound = queryCache.every((a: any) => a.id !== dataAIChatId);
123
+
124
+ if (notFound) {
125
+ // If not found, add to cache
126
+ updateQuery(queryKey, (prev: any) => {
127
+ return [{
128
+ cursor: aiChat.cursor,
129
+ __flat: {
130
+ __cache: true,
131
+ data: [`$aiChatFragment:${dataAIChatId}`],
132
+ }
133
+ }, ...prev];
134
+ }, false, updateObservers);
135
+ }
136
+ }
137
+
138
+ }
139
+ }, [dataAIChatId]);
140
+
108
141
  return {
109
142
  aiChat,
110
143
  generatingFragmentId,
@@ -138,6 +171,35 @@ export function useAIChatMessages(aiChatId?: string, params: UseQueryParams = {}
138
171
  };
139
172
  }
140
173
 
174
+ /**
175
+ * Update sidebar AI chats query
176
+ */
177
+
178
+ export function updateAIChats(aiChat: any, updateObservers: UpdateObserversFn) {
179
+ if (aiChat) {
180
+ const isCalDate = !!aiChat.calDate;
181
+ const queryKey = `#aiChats:$after:false$filter:${isCalDate ? 'cal_date' : 'chats'}$limit:${AI_CHATS_LIMIT}`;
182
+
183
+ updateQuery(
184
+ queryKey,
185
+ (res) => {
186
+ return [
187
+ {
188
+ cursor: aiChat.cursor,
189
+ __flat: {
190
+ __cache: true,
191
+ data: [`$aiChatFragment:${aiChat.id}`]
192
+ }
193
+ },
194
+ ...res
195
+ ];
196
+ },
197
+ false,
198
+ updateObservers
199
+ );
200
+ }
201
+ }
202
+
141
203
  /**
142
204
  * Fetch AI chats list
143
205
  */
@@ -2,10 +2,10 @@ import i18n from '@jsb188/app/i18n';
2
2
  import { deleteAuthToken } from '@jsb188/app/platform';
3
3
  import type { UseMutationParams } from '@jsb188/graphql/types.d';
4
4
  import type { OpenModalPopUpFn } from '@jsb188/react/states';
5
- import { AppContext, onAccountLogin, onGuestInit, useOpenModalPopUp } from '@jsb188/react/states';
5
+ import { AppContext, onGuestInit, useOpenModalPopUp } from '@jsb188/react/states';
6
6
  import React, { useContext, useEffect, useState } from 'react';
7
- import { sendEmailVerificationMtn, signUpWithEmailMtn } from '../gql/mutations/authMutations';
8
- import { changePasswordMtn, checkUsernameOrEmailMtn, requestTokenizedEmailMtn, signInMtn, signOutMtn } from '../gql/mutations/userAuthMutations';
7
+ import { changeAccountPasswordMtn, checkUsernameOrEmailMtn, confirmPhoneVerificationCodeMtn, requestTokenizedEmailMtn, sendPhoneVerificationCodeMtn, signUpWithEmailMtn } from '../gql/mutations/authMutations';
8
+ import { signOutMtn } from '../gql/mutations/userAuthMutations';
9
9
  import { useMutation } from './index';
10
10
 
11
11
  /**
@@ -21,20 +21,31 @@ interface AuthHookParams extends UseMutationParams {
21
21
  * Change password (while logged in)
22
22
  */
23
23
 
24
- export function useChangePassword(params: UseMutationParams = {}) {
24
+ interface UseChangeAccountPasswordParams extends UseMutationParams {
25
+ doNotFinishForm?: boolean;
26
+ }
25
27
 
26
- const { dispatchApp, appState: { hasPassword, account } } = useContext(AppContext);
27
- const openModalPopUp = useOpenModalPopUp();
28
- const { onCompleted, onError } = params;
28
+ export function useChangeAccountPassword(params: UseChangeAccountPasswordParams = {}, openModalPopUp?: OpenModalPopUpFn) {
29
29
 
30
- const onCompleted_ = (data: any, err: any, variables: any) => {
31
- if (onCompleted) {
32
- onCompleted(data, err, variables);
30
+ const { dispatchApp, appState: { hasPassword, account } } = useContext(AppContext);
31
+ const { onCompleted, onError, doNotFinishForm } = params;
32
+
33
+ const onFinishChangeAccountPassword = () => {
34
+ if (!hasPassword) {
35
+ dispatchApp({
36
+ __type: 'APP_EDIT_AUTH',
37
+ data: {
38
+ id: account?.id,
39
+ hasPassword: true,
40
+ }
41
+ });
33
42
  }
43
+ };
34
44
 
35
- const success = !!data?.changePassword;
45
+ const onCompleted_ = (data: any, err: any, variables: any) => {
46
+ const success = !!data?.changeAccountPassword;
36
47
  if (success) {
37
- openModalPopUp({
48
+ openModalPopUp?.({
38
49
  name: 'password_changed',
39
50
  props: {
40
51
  title: i18n.t('form.success'),
@@ -43,20 +54,18 @@ export function useChangePassword(params: UseMutationParams = {}) {
43
54
  }
44
55
  });
45
56
 
46
- if (!hasPassword) {
47
- dispatchApp({
48
- __type: 'APP_EDIT_AUTH',
49
- data: {
50
- id: account?.id,
51
- hasPassword: true,
52
- }
53
- });
57
+ if (!doNotFinishForm) {
58
+ onFinishChangeAccountPassword();
59
+ }
60
+
61
+ if (onCompleted) {
62
+ onCompleted(success, err, variables);
54
63
  }
55
64
  }
56
65
  };
57
66
 
58
- const [changePassword, mtnValues] = useMutation(
59
- changePasswordMtn,
67
+ const [changeAccountPassword, mtnValues, mtnHandlers] = useMutation(
68
+ changeAccountPasswordMtn,
60
69
  {
61
70
  openModalPopUp,
62
71
  onCompleted: onCompleted_,
@@ -66,8 +75,11 @@ export function useChangePassword(params: UseMutationParams = {}) {
66
75
 
67
76
  return {
68
77
  openModalPopUp,
69
- changePassword,
78
+ changeAccountPassword,
79
+ onFinishChangeAccountPassword,
80
+ account,
70
81
  ...mtnValues,
82
+ ...mtnHandlers,
71
83
  };
72
84
  }
73
85
 
@@ -75,7 +87,7 @@ export function useChangePassword(params: UseMutationParams = {}) {
75
87
  * Reset password (from 30m email link)
76
88
  */
77
89
 
78
- export function useChangePasswordForm(params: UseMutationParams = {}) {
90
+ export function useChangeAccountPasswordForm(params: UseMutationParams = {}) {
79
91
 
80
92
  const { dispatchApp, appState: { hasPassword, account } } = useContext(AppContext);
81
93
  const { onCompleted, onError } = params;
@@ -85,7 +97,7 @@ export function useChangePasswordForm(params: UseMutationParams = {}) {
85
97
  onCompleted(data, err, variables);
86
98
  }
87
99
 
88
- const success = !!data?.changePassword;
100
+ const success = !!data?.changeAccountPassword;
89
101
  if (success) {
90
102
  // It's possible for user to use this hook without being logged in
91
103
  // So we have to check for ID first
@@ -101,8 +113,8 @@ export function useChangePasswordForm(params: UseMutationParams = {}) {
101
113
  }
102
114
  };
103
115
 
104
- const [changePassword, mtnValues] = useMutation(
105
- changePasswordMtn,
116
+ const [changeAccountPassword, mtnValues, mtnHandlers] = useMutation(
117
+ changeAccountPasswordMtn,
106
118
  {
107
119
  checkMountedBeforeCallback: true,
108
120
  onCompleted: onCompleted_,
@@ -111,8 +123,9 @@ export function useChangePasswordForm(params: UseMutationParams = {}) {
111
123
  );
112
124
 
113
125
  return {
114
- changePassword,
126
+ changeAccountPassword,
115
127
  ...mtnValues,
128
+ ...mtnHandlers,
116
129
  };
117
130
  }
118
131
 
@@ -121,7 +134,6 @@ export function useChangePasswordForm(params: UseMutationParams = {}) {
121
134
  */
122
135
 
123
136
  export function useRequestTokenizedEmail(params: UseMutationParams = {}, openModalPopUp?: OpenModalPopUpFn) {
124
-
125
137
  const { onCompleted, onError } = params;
126
138
  const [requestTokenizedEmail, mtnValues] = useMutation(
127
139
  requestTokenizedEmailMtn,
@@ -139,13 +151,59 @@ export function useRequestTokenizedEmail(params: UseMutationParams = {}, openMod
139
151
  };
140
152
  }
141
153
 
154
+ /**
155
+ * Send verification code to phone number
156
+ */
157
+
158
+ export function useSendPhoneVerificationCode(params: UseMutationParams = {}, openModalPopUp?: OpenModalPopUpFn) {
159
+ const { onCompleted, onError } = params;
160
+ const [sendPhoneVerificationCode, mtnValues, mtnHandlers] = useMutation(
161
+ sendPhoneVerificationCodeMtn,
162
+ {
163
+ checkMountedBeforeCallback: true,
164
+ openModalPopUp,
165
+ onCompleted,
166
+ onError
167
+ },
168
+ );
169
+
170
+ return {
171
+ sendPhoneVerificationCode,
172
+ ...mtnValues,
173
+ ...mtnHandlers,
174
+ };
175
+ }
176
+
177
+ /**
178
+ * Confirm verification code
179
+ */
180
+
181
+ export function useConfirmPhoneVerificationCode(params: UseMutationParams = {}, openModalPopUp?: OpenModalPopUpFn) {
182
+ const { onCompleted, onError } = params;
183
+
184
+ const [confirmPhoneVerificationCode, mtnValues, mtnHandlers] = useMutation(
185
+ confirmPhoneVerificationCodeMtn,
186
+ {
187
+ checkMountedBeforeCallback: true,
188
+ openModalPopUp,
189
+ onCompleted,
190
+ onError
191
+ },
192
+ );
193
+
194
+ return {
195
+ confirmPhoneVerificationCode,
196
+ ...mtnValues,
197
+ ...mtnHandlers,
198
+ };
199
+ }
200
+
142
201
  /**
143
202
  * Sign in
144
203
  */
145
204
 
146
- export function useSignIn(params: AuthHookParams = {}, openModalPopUp?: OpenModalPopUpFn) {
205
+ export function useCheckUsernameOrEmail(params: AuthHookParams = {}, openModalPopUp?: OpenModalPopUpFn) {
147
206
  const { onError, onCompleted, initialError, initialFormData } = params;
148
- const { dispatchApp } = useContext<any>(AppContext);
149
207
 
150
208
  const [dataForSchema, setDataForSchema] = useState({
151
209
  hasInput: !!initialFormData?.usernameOrEmail,
@@ -153,7 +211,7 @@ export function useSignIn(params: AuthHookParams = {}, openModalPopUp?: OpenModa
153
211
  hidePassword: !initialFormData?.usernameOrEmail,
154
212
  });
155
213
 
156
- const [checkUsernameOrEmail, step1MtnValues, step1MtnHandlers] = useMutation(
214
+ const [checkUsernameOrEmail, mtnValues, mtnHandlers] = useMutation(
157
215
  checkUsernameOrEmailMtn,
158
216
  {
159
217
  openModalPopUp,
@@ -163,40 +221,10 @@ export function useSignIn(params: AuthHookParams = {}, openModalPopUp?: OpenModa
163
221
  },
164
222
  );
165
223
 
166
- const [signIn, step2MtnValues, step2MtnHandlers] = useMutation(
167
- signInMtn,
168
- {
169
- openModalPopUp,
170
- initialError,
171
- onError,
172
- onCompleted: (data, error) => {
173
- const result = data?.signIn;
174
- if (result?.token && result.user?.id) {
175
- onAccountLogin(result, dispatchApp);
176
-
177
- if (onCompleted) {
178
- onCompleted(data, error);
179
- }
180
- }
181
- },
182
- },
183
- );
184
-
185
- let mtnValues;
186
- let mtnHandlers;
187
- if (dataForSchema.hidePassword) {
188
- mtnValues = step1MtnValues;
189
- mtnHandlers = step1MtnHandlers;
190
- } else {
191
- mtnValues = step2MtnValues;
192
- mtnHandlers = step2MtnHandlers;
193
- }
194
-
195
224
  return {
196
225
  ...mtnValues,
197
226
  ...mtnHandlers,
198
227
  checkUsernameOrEmail,
199
- signIn,
200
228
  dataForSchema,
201
229
  setDataForSchema,
202
230
  };
@@ -0,0 +1,85 @@
1
+ import { checkACLPermission } from '@jsb188/app/utils/organization';
2
+ import type { UseMutationParams } from '@jsb188/graphql/types.d';
3
+ import { OpenModalPopUpFn } from '@jsb188/react/states';
4
+ import { useMemo } from 'react';
5
+ import { updateFragment } from '../cache/index';
6
+ import { deleteLogEntryMtn, editLogEntryMtn } from '../gql/mutations/logMutations';
7
+ import { useMutation } from './index';
8
+ import { useReactiveLogFragment } from './use-log-qry';
9
+ import { useOrganizationRelationship } from './use-organization-qry';
10
+
11
+ /**
12
+ * Fetch a single log entry,
13
+ * from cache first; only check server if cache is not found.
14
+ */
15
+
16
+ export function useEditLogEntry(
17
+ viewerAccountId: string,
18
+ logEntryId: string,
19
+ organizationId: string,
20
+ params: UseMutationParams = {},
21
+ openModalPopUp?: OpenModalPopUpFn
22
+ ) {
23
+
24
+ const { organizationRelationship } = useOrganizationRelationship(organizationId);
25
+ const notReady = !organizationRelationship;
26
+
27
+ const [editLogEntry, mtnValues, mtnHandlers] = useMutation(
28
+ editLogEntryMtn,
29
+ {
30
+ // checkMountedBeforeCallback: true,
31
+ openModalPopUp,
32
+ ...params,
33
+ },
34
+ );
35
+
36
+ const logEntry = useReactiveLogFragment(logEntryId, null, mtnValues.mutationCount);
37
+ // const logEntry = useReactiveFragment(
38
+ // null,
39
+ // [`$logEntryFragment:${logEntryId}`, [`$logEntryArableFragment:${logEntryId}`, 'details']],
40
+ // mtnValues.mutationCount,
41
+ // );
42
+
43
+ const isMyDocument = !!viewerAccountId && logEntry?.accountId === viewerAccountId;
44
+ const allowEdit = useMemo(() => {
45
+ return checkACLPermission(organizationRelationship, 'logs', isMyDocument ? 'WRITE' : 'MANAGE');
46
+ }, [organizationRelationship?.acl, organizationRelationship?.role]);
47
+
48
+ return {
49
+ logEntry,
50
+ editLogEntry,
51
+ notReady,
52
+ allowEdit,
53
+ ...mtnValues,
54
+ ...mtnHandlers,
55
+ };
56
+ }
57
+
58
+ /**
59
+ * Delete a single log entry
60
+ * NOTE: Don't check ACL and allow server to handle it.
61
+ */
62
+
63
+ export function useDeleteLogEntry(params: UseMutationParams = {}, openModalPopUp?: OpenModalPopUpFn) {
64
+
65
+ const { onCompleted, ...rest } = params;
66
+ const [deleteLogEntry, mtnValues, mtnHandlers, updateObservers] = useMutation(
67
+ deleteLogEntryMtn,
68
+ {
69
+ openModalPopUp,
70
+ onCompleted: (data, dataMtnValues, variables) => {
71
+ if (data?.deleteLogEntry) {
72
+ updateFragment(`$logEntryFragment:${variables.logEntryId}`, { __deleted: true }, null, false, updateObservers);
73
+ }
74
+ onCompleted?.(data, dataMtnValues, variables);
75
+ },
76
+ ...rest,
77
+ },
78
+ );
79
+
80
+ return {
81
+ deleteLogEntry,
82
+ ...mtnValues,
83
+ ...mtnHandlers,
84
+ };
85
+ }
@@ -1,13 +1,13 @@
1
- import type { PaginationArgs, UseQueryParams } from '../types';
2
- import { useQuery } from '../client';
1
+ import type { FilterLogEntriesArgs } from '@jsb188/mday/types/log.d';
2
+ import { useQuery, useReactiveFragment } from '../client';
3
3
  import { logEntriesQry } from '../gql/queries/logQueries';
4
- import type { FilterLogEntriesArgs } from '@jsb188/app/types/log.d';
4
+ import type { PaginationArgs, UseQueryParams } from '../types';
5
5
 
6
6
  /**
7
7
  * Constants
8
8
  */
9
9
 
10
- const LOG_ENTRIES_LIMIT = 50;
10
+ const LOG_ENTRIES_LIMIT = 200;
11
11
 
12
12
  /**
13
13
  * Helper; use this to get/use same filter for logEntries() query everywhere
@@ -16,7 +16,7 @@ const LOG_ENTRIES_LIMIT = 50;
16
16
  export function getDefaultLogEntriesFilter(operation: FilterLogEntriesArgs['operation']): FilterLogEntriesArgs {
17
17
  return {
18
18
  operation,
19
- type: null,
19
+ types: null,
20
20
  startDate: null,
21
21
  endDate: null,
22
22
  query: ''
@@ -36,7 +36,7 @@ interface LogEntriesArgs extends PaginationArgs {
36
36
 
37
37
  export function useLogEntries(variables: LogEntriesArgs, params: UseQueryParams = {}) {
38
38
 
39
- const { data, ...other } = useQuery(logEntriesQry, {
39
+ const { data, ...rest } = useQuery(logEntriesQry, {
40
40
  variables: {
41
41
  ...variables,
42
42
  cursor: null,
@@ -50,6 +50,28 @@ export function useLogEntries(variables: LogEntriesArgs, params: UseQueryParams
50
50
 
51
51
  return {
52
52
  logEntries: data?.logEntries,
53
- ...other
53
+ ...rest
54
54
  };
55
55
  }
56
+
57
+ /**
58
+ * Get reactive log fragment
59
+ */
60
+
61
+ export function useReactiveLogFragment(logEntryId: string, currentData?: any, queryCount?: number) {
62
+ return useReactiveFragment(
63
+ currentData,
64
+ [
65
+ `$logEntryFragment:${logEntryId}`,
66
+
67
+ // By having the second paramter as null, we only observe the reactive changes without setting the data
68
+ [`$logEntryArableFragment:${logEntryId}`, null],
69
+
70
+ // This is not needed because $logEntryFragment has spread data
71
+ // [`$accountFragment:${logEntryId}`, 'account']
72
+ ],
73
+ queryCount,
74
+ // Using the otherCheck() function is the only way I could keep sticker updates reactive
75
+ // (_, updatedKeys) => updatedKeys.find((k) => typeof k === 'string' && k.startsWith('$chatStickerFragment:')),
76
+ );
77
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsb188/graphql",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "GraphQL client for react, using recoil",
5
5
  "license": "ISC",
6
6
  "author": "jsb188",
@@ -11,32 +11,22 @@
11
11
  "./fragments/accountAuth": "./gql/fragments/accountAuthFragments.ts",
12
12
  "./fragments/aiChat": "./gql/fragments/aiChatFragments.ts",
13
13
  "./fragments/billing": "./gql/fragments/billingFragments.ts",
14
- "./fragments/card": "./gql/fragments/cardFragments.ts",
15
- "./fragments/chat": "./gql/fragments/chatFragments.ts",
16
14
  "./fragments/log": "./gql/fragments/logFragments.ts",
17
15
  "./fragments/organization": "./gql/fragments/organizationFragments.ts",
18
16
  "./fragments/other": "./gql/fragments/otherFragments.ts",
19
- "./fragments/user": "./gql/fragments/userFragments.ts",
20
- "./fragments/userAuth": "./gql/fragments/userAuthFragments.ts",
21
17
  "./hooks": "./hooks/",
22
18
  "./hooks/use-aiChat-qry": "./hooks/use-aiChat-qry.ts",
23
19
  "./hooks/use-app-qry": "./hooks/use-app-qry.ts",
24
20
  "./hooks/use-log-qry": "./hooks/use-log-qry.ts",
25
21
  "./hooks/use-organization-qry": "./hooks/use-organization-qry.ts",
22
+ "./hooks/use-account-mtn": "./hooks/use-account-mtn.ts",
23
+ "./hooks/use-aiChat-mtn": "./hooks/use-aiChat-mtn.ts",
26
24
  "./hooks/use-auth-mtn": "./hooks/use-auth-mtn.ts",
27
- "./mutations/aiChat": "./gql/mutations/aiChatMutations.ts",
28
- "./mutations/auth": "./gql/mutations/authMutations.ts",
29
- "./mutations/billing": "./gql/mutations/billingMutations.ts",
30
- "./mutations/chat": "./gql/mutations/chatMutations.ts",
31
- "./mutations/log": "./gql/mutations/logMutations.ts",
32
- "./mutations/other": "./gql/mutations/otherMutations.ts",
33
- "./mutations/user": "./gql/mutations/userMutations.ts",
34
- "./mutations/userAuth": "./gql/mutations/userAuthMutations.ts",
25
+ "./hooks/use-log-mtn": "./hooks/use-log-mtn.ts",
26
+ "./mutations": "./gql/mutations/index.ts",
35
27
  "./queries/aiChat": "./gql/queries/aiChatQueries.ts",
36
28
  "./queries/app": "./gql/queries/appQueries.ts",
37
29
  "./queries/billing": "./gql/queries/billingQueries.ts",
38
- "./queries/card": "./gql/queries/cardQueries.ts",
39
- "./queries/chat": "./gql/queries/chatQueries.ts",
40
30
  "./queries/log": "./gql/queries/logQueries.ts",
41
31
  "./queries/organization": "./gql/queries/organizationQueries.ts",
42
32
  "./queries/other": "./gql/queries/otherQueries.ts",
@@ -55,7 +45,7 @@
55
45
  "graphql-tag": "^2.12.6"
56
46
  },
57
47
  "peerDependencies": {
58
- "@jsb188/app": "1.1.4",
59
- "@jsb188/react": "1.1.4"
48
+ "@jsb188/app": "1.1.5",
49
+ "@jsb188/react": "1.1.5"
60
50
  }
61
51
  }
package/types.d.ts CHANGED
@@ -13,6 +13,7 @@ export interface APIRequestOutput {
13
13
  export interface GraphQLHandlers {
14
14
  resetErrors: () => void;
15
15
  setError: (error: SimpleErrorType) => void;
16
+ setSaving: (nextSaving: boolean, resetInMS?: number) => void;
16
17
  refetch: () => void;
17
18
  }
18
19
 
@@ -1,15 +0,0 @@
1
- export const cardFragment = `fragment cardFragment on Card {
2
- id
3
- title
4
- }`;
5
-
6
- export const linkFragment = `fragment linkFragment on Link {
7
- id
8
- relatedId
9
- text
10
- url
11
- type
12
- photoUri
13
- broken
14
- order
15
- }`;
@@ -1,98 +0,0 @@
1
- // NOTE: Can't use "hasAccess" here; because live chats need participants[] data in back-end
2
- // NOTE: "chatFragment" is used in lists, "chatPartial" is used in chat main
3
- export const chatFragment = `fragment chatFragment on Chat {
4
- id
5
- ownerId
6
- name
7
- note
8
- deleted
9
- photoUri
10
- unread
11
- pinned
12
-
13
- type
14
- status
15
- liveCategory
16
-
17
- theme {
18
- id
19
- name
20
- backgroundPhotoUri
21
- }
22
-
23
- lastMessage
24
- lastMessageAt
25
- lastMessageUserId
26
- lastMessageDisplayName
27
- lastMessagePhotoUri
28
- lastMessageIsSelf
29
- }`;
30
-
31
- export const chatStickerFragment = `fragment chatStickerFragment on ChatSticker {
32
- id
33
- code
34
- photoId
35
- photoUri
36
- }`;
37
-
38
- // NOTE: "chatFragment" is used in lists, "chatPartial" is used in chat main
39
- export const chatPartial = `fragment chatPartial on Chat {
40
- id
41
- ownerId
42
- name
43
- note
44
- deleted
45
- photoUri
46
- unread
47
- hasAccess
48
-
49
- type
50
- status
51
- liveCategory
52
-
53
- theme {
54
- id
55
- name
56
- backgroundPhotoUri
57
- }
58
-
59
- stickers {
60
- id
61
- code
62
- photoId
63
- photoUri
64
- }
65
- }`;
66
-
67
- export const chatStatusPartial = `fragment chatStatusPartial on Chat {
68
- id
69
- unread
70
- pinned
71
- status
72
- }`;
73
-
74
- export const chatMessageFragment = `fragment chatMessageFragment on ChatMessage {
75
- id
76
- userId
77
- aiId
78
-
79
- displayName
80
- photoUri
81
- plusStatus
82
- badge
83
- message
84
- attachmentUri
85
- interactionType
86
-
87
- metaData {
88
- stickers
89
- }
90
-
91
- createdAt
92
- updatedAt
93
- }`;
94
-
95
- export const chatUserStatusFragment = `fragment chatUserStatusFragment on ChatUserStatus {
96
- id
97
- onlineStatus
98
- }`;
@@ -1,8 +0,0 @@
1
- export const userAuthFragment = `fragment userAuthFragment on Auth {
2
- token
3
- activated
4
- hasPassword
5
- stickySection
6
- birthdate
7
- version
8
- }`;