@planningcenter/chat-react-native 1.5.0 → 1.6.0
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/build/components/conversations.d.ts.map +1 -1
- package/build/components/conversations.js +29 -8
- package/build/components/conversations.js.map +1 -1
- package/build/components/display/button.d.ts +71 -0
- package/build/components/display/button.d.ts.map +1 -0
- package/build/components/display/button.js +136 -0
- package/build/components/display/button.js.map +1 -0
- package/build/components/display/button_color_utils.d.ts +24 -0
- package/build/components/display/button_color_utils.d.ts.map +1 -0
- package/build/components/display/button_color_utils.js +43 -0
- package/build/components/display/button_color_utils.js.map +1 -0
- package/build/components/display/heading.d.ts +4 -0
- package/build/components/display/heading.d.ts.map +1 -1
- package/build/components/display/heading.js +3 -0
- package/build/components/display/heading.js.map +1 -1
- package/build/components/display/icon.d.ts +8 -4
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +21 -13
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/image.d.ts +7 -2
- package/build/components/display/image.d.ts.map +1 -1
- package/build/components/display/image.js +5 -5
- package/build/components/display/image.js.map +1 -1
- package/build/components/display/index.d.ts +10 -7
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +10 -7
- package/build/components/display/index.js.map +1 -1
- package/build/components/display/spinner.d.ts +5 -1
- package/build/components/display/spinner.d.ts.map +1 -1
- package/build/components/display/spinner.js +19 -13
- package/build/components/display/spinner.js.map +1 -1
- package/build/components/display/text.d.ts +13 -3
- package/build/components/display/text.d.ts.map +1 -1
- package/build/components/display/text.js +17 -5
- package/build/components/display/text.js.map +1 -1
- package/build/components/display/text_button.d.ts +37 -0
- package/build/components/display/text_button.d.ts.map +1 -0
- package/build/components/display/text_button.js +36 -0
- package/build/components/display/text_button.js.map +1 -0
- package/build/components/display/text_inline_button.d.ts +12 -0
- package/build/components/display/text_inline_button.d.ts.map +1 -0
- package/build/components/display/text_inline_button.js +53 -0
- package/build/components/display/text_inline_button.js.map +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.js.map +1 -1
- package/build/components/primitive/avatar_primitive.d.ts +1 -1
- package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
- package/build/components/primitive/avatar_primitive.js +6 -9
- package/build/components/primitive/avatar_primitive.js.map +1 -1
- package/build/contexts/api_provider.d.ts +4 -6
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +13 -20
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +7 -5
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +40 -4
- package/build/contexts/chat_context.js.map +1 -1
- package/build/hooks/index.d.ts +4 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +4 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_create_android_ripple_color.d.ts +4 -0
- package/build/hooks/use_create_android_ripple_color.d.ts.map +1 -0
- package/build/hooks/use_create_android_ripple_color.js +15 -0
- package/build/hooks/use_create_android_ripple_color.js.map +1 -0
- package/build/hooks/use_current_person.d.ts +3 -0
- package/build/hooks/use_current_person.d.ts.map +1 -0
- package/build/hooks/use_current_person.js +13 -0
- package/build/hooks/use_current_person.js.map +1 -0
- package/build/hooks/use_font_scale.d.ts +4 -0
- package/build/hooks/use_font_scale.d.ts.map +1 -0
- package/build/hooks/use_font_scale.js +8 -0
- package/build/hooks/use_font_scale.js.map +1 -0
- package/build/hooks/use_suspense_api.d.ts +61 -0
- package/build/hooks/use_suspense_api.d.ts.map +1 -0
- package/build/hooks/use_suspense_api.js +39 -0
- package/build/hooks/use_suspense_api.js.map +1 -0
- package/build/navigation/index.d.ts +1 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +7 -4
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +59 -6
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/display.d.ts.map +1 -1
- package/build/screens/display.js +277 -51
- package/build/screens/display.js.map +1 -1
- package/build/screens/not_found.js +1 -1
- package/build/screens/not_found.js.map +1 -1
- package/build/types/api_primitives.d.ts +23 -0
- package/build/types/api_primitives.d.ts.map +1 -0
- package/build/types/api_primitives.js +2 -0
- package/build/types/api_primitives.js.map +1 -0
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +4 -0
- package/build/types/index.js.map +1 -0
- package/build/types/resources/conversation.d.ts +15 -0
- package/build/types/resources/conversation.d.ts.map +1 -0
- package/build/types/resources/conversation.js +2 -0
- package/build/types/resources/conversation.js.map +1 -0
- package/build/types/resources/index.d.ts +5 -0
- package/build/types/resources/index.d.ts.map +1 -0
- package/build/types/resources/index.js +5 -0
- package/build/types/resources/index.js.map +1 -0
- package/build/types/resources/message.d.ts +16 -0
- package/build/types/resources/message.d.ts.map +1 -0
- package/build/types/resources/message.js +2 -0
- package/build/types/resources/message.js.map +1 -0
- package/build/types/resources/oauth_token.d.ts +9 -0
- package/build/types/resources/oauth_token.d.ts.map +1 -0
- package/build/types/resources/oauth_token.js +2 -0
- package/build/types/resources/oauth_token.js.map +1 -0
- package/build/types/resources/person.d.ts +9 -0
- package/build/types/resources/person.d.ts.map +1 -0
- package/build/types/resources/person.js +2 -0
- package/build/types/resources/person.js.map +1 -0
- package/build/types/resources/reaction.d.ts +10 -0
- package/build/types/resources/reaction.d.ts.map +1 -0
- package/build/types/resources/reaction.js +2 -0
- package/build/types/resources/reaction.js.map +1 -0
- package/build/types/utils/index.d.ts +4 -0
- package/build/types/utils/index.d.ts.map +1 -0
- package/build/types/utils/index.js +4 -0
- package/build/types/utils/index.js.map +1 -0
- package/build/utils/client/client.d.ts +21 -12
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js +24 -22
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/session.d.ts +0 -5
- package/build/utils/session.d.ts.map +1 -1
- package/build/utils/session.js +0 -10
- package/build/utils/session.js.map +1 -1
- package/build/utils/styles.d.ts +5 -0
- package/build/utils/styles.d.ts.map +1 -1
- package/build/utils/styles.js +9 -0
- package/build/utils/styles.js.map +1 -1
- package/build/utils/theme.d.ts +3 -1
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +6 -2
- package/build/utils/theme.js.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.js +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
- package/build/vendor/tapestry/tokens.d.ts +21 -0
- package/build/vendor/tapestry/tokens.d.ts.map +1 -1
- package/build/vendor/tapestry/tokens.js +21 -0
- package/build/vendor/tapestry/tokens.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/client.ts +72 -19
- package/src/__tests__/session.ts +0 -11
- package/src/__utils__/handlers.ts +1 -1
- package/src/components/conversations.tsx +33 -11
- package/src/components/display/button.tsx +293 -0
- package/src/components/display/button_color_utils.ts +72 -0
- package/src/components/display/heading.tsx +12 -0
- package/src/components/display/icon.tsx +35 -16
- package/src/components/display/image.tsx +29 -7
- package/src/components/display/index.ts +10 -7
- package/src/components/display/spinner.tsx +42 -13
- package/src/components/display/text.tsx +34 -13
- package/src/components/display/text_button.tsx +102 -0
- package/src/components/display/text_inline_button.tsx +91 -0
- package/src/components/index.tsx +1 -0
- package/src/components/primitive/avatar_primitive.tsx +12 -6
- package/src/contexts/api_provider.tsx +18 -26
- package/src/contexts/chat_context.tsx +61 -7
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use_create_android_ripple_color.ts +18 -0
- package/src/hooks/use_current_person.ts +15 -0
- package/src/hooks/use_font_scale.ts +9 -0
- package/src/hooks/use_suspense_api.ts +60 -0
- package/src/navigation/index.tsx +14 -4
- package/src/screens/conversation_screen.tsx +83 -7
- package/src/screens/display.tsx +447 -51
- package/src/screens/not_found.tsx +1 -1
- package/src/types/api_primitives.ts +24 -0
- package/src/types/index.ts +3 -0
- package/src/types/resources/conversation.ts +15 -0
- package/src/types/resources/index.ts +4 -0
- package/src/types/resources/message.ts +18 -0
- package/src/types/resources/oauth_token.ts +8 -0
- package/src/types/resources/person.ts +9 -0
- package/src/types/resources/reaction.ts +9 -0
- package/src/types/utils/index.ts +6 -0
- package/src/utils/client/client.ts +41 -34
- package/src/utils/client/types.d.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/session.ts +0 -13
- package/src/utils/styles.ts +12 -0
- package/src/utils/theme.ts +9 -3
- package/src/vendor/tapestry/alias_tokens_color_map.ts +12 -0
- package/src/vendor/tapestry/tokens.ts +21 -0
- package/build/utils/api.d.ts +0 -9
- package/build/utils/api.d.ts.map +0 -1
- package/build/utils/api.js +0 -36
- package/build/utils/api.js.map +0 -1
- package/src/types.d.ts +0 -35
- package/src/utils/api.ts +0 -47
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ResourceObject } from '../api_primitives'
|
|
2
|
+
|
|
3
|
+
export interface ConversationResource extends ResourceObject {
|
|
4
|
+
title: string
|
|
5
|
+
subtitle: string
|
|
6
|
+
createdAt: string
|
|
7
|
+
updatedAt: string
|
|
8
|
+
repliesDisabled: boolean
|
|
9
|
+
lastMessageAuthorId: string
|
|
10
|
+
lastMessageAuthorName: string
|
|
11
|
+
lastMessageCreatedAt: string
|
|
12
|
+
lastMessageTextPreview: string
|
|
13
|
+
unreadCount: number
|
|
14
|
+
muted: boolean
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PersonResource } from './person'
|
|
2
|
+
import type { ReactionCountResource } from './reaction'
|
|
3
|
+
|
|
4
|
+
export interface MessageResource {
|
|
5
|
+
type: 'Message'
|
|
6
|
+
id: string
|
|
7
|
+
text: string
|
|
8
|
+
createdAt: string
|
|
9
|
+
textEditedAt: string | null
|
|
10
|
+
mine: boolean
|
|
11
|
+
attachments: unknown[]
|
|
12
|
+
author: PersonResource
|
|
13
|
+
reactionCounts: ReactionCountResource[]
|
|
14
|
+
|
|
15
|
+
// Custom Local Properties we set for rendering
|
|
16
|
+
renderAuthor?: boolean
|
|
17
|
+
renderTime?: boolean
|
|
18
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiCollection, ApiResource } from '../../types'
|
|
2
|
+
import { Session } from '../session'
|
|
2
3
|
import Uri from '../uri'
|
|
3
4
|
import {
|
|
4
5
|
concatRecords,
|
|
@@ -8,37 +9,34 @@ import {
|
|
|
8
9
|
throwErrorIfFieldsMissing,
|
|
9
10
|
throwErrorIfQueryParams,
|
|
10
11
|
} from './request_helpers'
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
|
|
13
|
+
import { DeleteRequest, GetRequest, PatchRequest, PostRequest, WalkRequest } from './types'
|
|
14
|
+
|
|
15
|
+
type ClientArgs = {
|
|
16
|
+
version: string
|
|
17
|
+
defaultHeaders?: Record<string, string>
|
|
18
|
+
onTokenExpired: () => void
|
|
19
|
+
session: Session
|
|
20
|
+
app: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class Client {
|
|
21
24
|
version: string = ''
|
|
22
25
|
defaultHeaders: Record<string, string> = {}
|
|
23
26
|
uri: Uri
|
|
27
|
+
onTokenExpired: () => void
|
|
24
28
|
|
|
25
|
-
constructor({ version, defaultHeaders = {}, session, app }) {
|
|
29
|
+
constructor({ version, defaultHeaders = {}, session, app, onTokenExpired }: ClientArgs) {
|
|
26
30
|
this.version = version
|
|
27
31
|
this.uri = new Uri({ session, app })
|
|
28
|
-
this.defaultHeaders =
|
|
29
|
-
|
|
30
|
-
'Content-Type': 'application/json',
|
|
31
|
-
'X-PCO-API-Version': version,
|
|
32
|
-
...this.uri.headers,
|
|
33
|
-
...defaultHeaders,
|
|
34
|
-
}
|
|
32
|
+
this.defaultHeaders = defaultHeaders
|
|
33
|
+
this.onTokenExpired = onTokenExpired
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
async get(args: GetRequest): Promise<
|
|
36
|
+
async get<T extends ApiCollection | ApiResource>(args: GetRequest): Promise<T> {
|
|
38
37
|
const { walk, ...data } = args.data
|
|
39
38
|
const isWalking = Boolean(walk)
|
|
40
|
-
const
|
|
41
|
-
const headers = { ...defaultHeaders, ...args.headers }
|
|
39
|
+
const headers = { ...this.headers, ...args.headers }
|
|
42
40
|
const url = this.uri.appUrl(args.url)
|
|
43
41
|
|
|
44
42
|
await throwErrorIfQueryParams(url)
|
|
@@ -71,42 +69,51 @@ export class Client implements ApiClient {
|
|
|
71
69
|
|
|
72
70
|
const handler = isWalking ? walkRequest : makeRequest
|
|
73
71
|
|
|
74
|
-
return throwErrorIfFieldsMissing(handler, requestArgs)
|
|
72
|
+
return throwErrorIfFieldsMissing(handler, requestArgs).catch(this.handleTokenExpired)
|
|
75
73
|
}
|
|
76
74
|
|
|
77
75
|
async patch(args: PatchRequest) {
|
|
78
|
-
const
|
|
79
|
-
const headers = { ...defaultHeaders, ...args.headers }
|
|
76
|
+
const headers = { ...this.headers, ...args.headers }
|
|
80
77
|
const url = this.uri.appUrl(args.url)
|
|
81
78
|
|
|
82
79
|
const requestArgs: MakeRequestArgs = { data: args.data, url, action: 'PATCH', headers }
|
|
83
80
|
|
|
84
|
-
return ensureNoQueryParamsInDev(makeRequest, requestArgs)
|
|
81
|
+
return ensureNoQueryParamsInDev(makeRequest, requestArgs).catch(this.handleTokenExpired)
|
|
85
82
|
}
|
|
86
83
|
|
|
87
84
|
async post(args: PostRequest) {
|
|
88
|
-
const
|
|
89
|
-
const headers = { ...defaultHeaders, ...args.headers }
|
|
85
|
+
const headers = { ...this.headers, ...args.headers }
|
|
90
86
|
const url = this.uri.appUrl(args.url)
|
|
91
87
|
|
|
92
88
|
const requestArgs: MakeRequestArgs = { ...args, data: args.data, url, action: 'POST', headers }
|
|
93
89
|
|
|
94
|
-
return ensureNoQueryParamsInDev(makeRequest, requestArgs)
|
|
90
|
+
return ensureNoQueryParamsInDev(makeRequest, requestArgs).catch(this.handleTokenExpired)
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
async delete(args: DeleteRequest) {
|
|
98
|
-
const
|
|
99
|
-
const headers = { ...defaultHeaders, ...args.headers }
|
|
94
|
+
const headers = { ...this.headers, ...args.headers }
|
|
100
95
|
const url = this.uri.appUrl(args.url)
|
|
101
96
|
|
|
102
97
|
const requestArgs: MakeRequestArgs = { url, action: 'DELETE', headers }
|
|
103
98
|
|
|
104
|
-
return makeRequest(requestArgs)
|
|
99
|
+
return makeRequest(requestArgs).catch(this.handleTokenExpired)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
handleTokenExpired = (response: Response) => {
|
|
103
|
+
if (response.status === 401) {
|
|
104
|
+
this.onTokenExpired()
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return Promise.reject(response)
|
|
105
108
|
}
|
|
106
109
|
|
|
107
|
-
get
|
|
110
|
+
get headers() {
|
|
108
111
|
return {
|
|
109
|
-
|
|
112
|
+
Accept: 'application/vnd.api+json',
|
|
113
|
+
'Content-Type': 'application/json',
|
|
114
|
+
'X-PCO-API-Version': this.version,
|
|
115
|
+
...this.uri.headers,
|
|
116
|
+
...this.defaultHeaders,
|
|
110
117
|
}
|
|
111
118
|
}
|
|
112
119
|
}
|
|
@@ -21,6 +21,7 @@ export interface GetRequest extends GenericRequest {
|
|
|
21
21
|
include?: string[]
|
|
22
22
|
order?: string
|
|
23
23
|
perPage?: number
|
|
24
|
+
offset?: number
|
|
24
25
|
walk?: boolean
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -61,4 +62,5 @@ export type RequestData = {
|
|
|
61
62
|
include: string[]
|
|
62
63
|
data: Record<string, unknown>
|
|
63
64
|
perPage: number
|
|
65
|
+
offset: number
|
|
64
66
|
}
|
package/src/utils/index.ts
CHANGED
package/src/utils/session.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuthToken } from '../types'
|
|
2
|
-
import Uri from './uri'
|
|
3
2
|
|
|
4
3
|
export type ENV = 'production' | 'staging' | 'development'
|
|
5
4
|
|
|
@@ -19,27 +18,17 @@ type SessionProps = { env?: ENV; token?: OAuthToken } | undefined
|
|
|
19
18
|
export class Session {
|
|
20
19
|
env: ENV
|
|
21
20
|
token: OAuthToken | undefined
|
|
22
|
-
uri: Uri
|
|
23
21
|
|
|
24
22
|
constructor(props?: SessionProps) {
|
|
25
23
|
const { env = 'production', token } = props || {}
|
|
26
24
|
this.env = env
|
|
27
25
|
this.token = token
|
|
28
|
-
this.uri = new Uri({ session: this })
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
get isAuthenticated() {
|
|
32
29
|
return Boolean(this.token)
|
|
33
30
|
}
|
|
34
31
|
|
|
35
|
-
get host() {
|
|
36
|
-
return this.uri.host
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
get baseUrl() {
|
|
40
|
-
return this.uri.baseUrl
|
|
41
|
-
}
|
|
42
|
-
|
|
43
32
|
toString() {
|
|
44
33
|
return JSON.stringify({ env: this.env, token: this.token })
|
|
45
34
|
}
|
|
@@ -53,5 +42,3 @@ export class Session {
|
|
|
53
42
|
}
|
|
54
43
|
}
|
|
55
44
|
}
|
|
56
|
-
|
|
57
|
-
export let session = new Session({ env: 'development' })
|
package/src/utils/styles.ts
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { Platform } from 'react-native'
|
|
2
2
|
import { tokens } from '../vendor/tapestry/tokens'
|
|
3
3
|
|
|
4
|
+
export const MAX_FONT_SIZE_MULTIPLIER = 1.5
|
|
5
|
+
|
|
6
|
+
export const platformFontWeightMedium = Platform.select({
|
|
7
|
+
ios: tokens.fontWeightMedium,
|
|
8
|
+
android: tokens.fontWeightBold,
|
|
9
|
+
})
|
|
10
|
+
|
|
4
11
|
export const platformFontWeightBold = Platform.select({
|
|
5
12
|
ios: tokens.fontWeightSemiBold,
|
|
6
13
|
android: tokens.fontWeightBold,
|
|
7
14
|
})
|
|
15
|
+
|
|
16
|
+
export const platformPressedOpacityStyle = Platform.select({
|
|
17
|
+
ios: { opacity: 0.5 },
|
|
18
|
+
android: { opacity: 1 },
|
|
19
|
+
})
|
package/src/utils/theme.ts
CHANGED
|
@@ -51,19 +51,25 @@ export type TemporaryDefaultColorsType = Partial<ChatColors>
|
|
|
51
51
|
|
|
52
52
|
interface ChatColors {
|
|
53
53
|
name: string
|
|
54
|
-
|
|
54
|
+
buttonStart: string | undefined
|
|
55
|
+
buttonEnd: string | undefined
|
|
56
|
+
interaction: string
|
|
55
57
|
testColor: string
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
const colorsChatLight: ChatColors = {
|
|
59
61
|
name: 'light',
|
|
60
|
-
|
|
62
|
+
buttonStart: undefined,
|
|
63
|
+
buttonEnd: undefined,
|
|
64
|
+
interaction: tokens.fillColorInteractionDefault,
|
|
61
65
|
testColor: 'red',
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
const colorsChatDark: ChatColors = {
|
|
65
69
|
name: 'dark',
|
|
66
|
-
|
|
70
|
+
buttonStart: undefined,
|
|
71
|
+
buttonEnd: undefined,
|
|
72
|
+
interaction: tokens.fillColorInteractionDefaultDark,
|
|
67
73
|
testColor: 'blue',
|
|
68
74
|
}
|
|
69
75
|
|
|
@@ -63,6 +63,10 @@ interface SemanticAliasesColors {
|
|
|
63
63
|
textColorDefaultPlaceholder: string
|
|
64
64
|
textColorDefaultInverted: string
|
|
65
65
|
fillColorInteractionOnlineDefault: string
|
|
66
|
+
fillColorInteractionDefault: string
|
|
67
|
+
fillColorStatusErrorMedium: string
|
|
68
|
+
fillColorButtonNeutralSolidDisabled: string
|
|
69
|
+
androidRippleNeutral: string
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
const semanticAliasesLight: SemanticAliasesColors = {
|
|
@@ -79,6 +83,10 @@ const semanticAliasesLight: SemanticAliasesColors = {
|
|
|
79
83
|
textColorDefaultPlaceholder: neutralsLight.fillColorNeutral030,
|
|
80
84
|
textColorDefaultInverted: tokens.colorNeutral100White,
|
|
81
85
|
fillColorInteractionOnlineDefault: tokens.colorInteractionOnlineDefault,
|
|
86
|
+
fillColorInteractionDefault: tokens.fillColorInteractionDefault,
|
|
87
|
+
fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,
|
|
88
|
+
fillColorButtonNeutralSolidDisabled: neutralsLight.fillColorNeutral070,
|
|
89
|
+
androidRippleNeutral: tokens.fillColorTransparencyDark020,
|
|
82
90
|
} as const
|
|
83
91
|
|
|
84
92
|
const semanticAliasesDark: SemanticAliasesColors = {
|
|
@@ -95,6 +103,10 @@ const semanticAliasesDark: SemanticAliasesColors = {
|
|
|
95
103
|
textColorDefaultPlaceholder: neutralsDark.fillColorNeutral030,
|
|
96
104
|
textColorDefaultInverted: tokens.colorNeutral7,
|
|
97
105
|
fillColorInteractionOnlineDefault: tokens.colorInteractionOnlineDefault,
|
|
106
|
+
fillColorInteractionDefault: tokens.fillColorInteractionDefaultDark,
|
|
107
|
+
fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,
|
|
108
|
+
fillColorButtonNeutralSolidDisabled: neutralsDark.fillColorNeutral070,
|
|
109
|
+
androidRippleNeutral: tokens.fillColorTransparencyLight020,
|
|
98
110
|
}
|
|
99
111
|
|
|
100
112
|
export const aliasTokensColorMap = {
|
|
@@ -21,6 +21,25 @@ const colorPrimitives = {
|
|
|
21
21
|
colorNeutral97: 'hsl(0, 0%, 97%)',
|
|
22
22
|
colorNeutral98: 'hsl(0, 0%, 98%)',
|
|
23
23
|
colorNeutral100White: 'hsl(0, 0%, 100%)',
|
|
24
|
+
fillColorInteractionDefault: 'hsl(204, 100%, 40%)',
|
|
25
|
+
fillColorTransparencyLight010: 'hsla(0, 0%, 100%, 0.1)',
|
|
26
|
+
fillColorTransparencyLight020: 'hsla(0, 0%, 100%, 0.2)',
|
|
27
|
+
fillColorTransparencyLight030: 'hsla(0, 0%, 100%, 0.3)',
|
|
28
|
+
fillColorTransparencyLight040: 'hsla(0, 0%, 100%, 0.4)',
|
|
29
|
+
fillColorTransparencyLight050: 'hsla(0, 0%, 100%, 0.5)',
|
|
30
|
+
fillColorTransparencyLight060: 'hsla(0, 0%, 100%, 0.6)',
|
|
31
|
+
fillColorTransparencyLight070: 'hsla(0, 0%, 100%, 0.7)',
|
|
32
|
+
fillColorTransparencyLight080: 'hsla(0, 0%, 100%, 0.8)',
|
|
33
|
+
fillColorTransparencyLight090: 'hsla(0, 0%, 100%, 0.9)',
|
|
34
|
+
fillColorTransparencyDark010: 'hsla(0, 0%, 0%, 0.1)',
|
|
35
|
+
fillColorTransparencyDark020: 'hsla(0, 0%, 0%, 0.2)',
|
|
36
|
+
fillColorTransparencyDark030: 'hsla(0, 0%, 0%, 0.3)',
|
|
37
|
+
fillColorTransparencyDark040: 'hsla(0, 0%, 0%, 0.4)',
|
|
38
|
+
fillColorTransparencyDark050: 'hsla(0, 0%, 0%, 0.5)',
|
|
39
|
+
fillColorTransparencyDark060: 'hsla(0, 0%, 0%, 0.6)',
|
|
40
|
+
fillColorTransparencyDark070: 'hsla(0, 0%, 0%, 0.7)',
|
|
41
|
+
fillColorTransparencyDark080: 'hsla(0, 0%, 0%, 0.8)',
|
|
42
|
+
fillColorTransparencyDark090: 'hsla(0, 0%, 0%, 0.9)',
|
|
24
43
|
} as const
|
|
25
44
|
|
|
26
45
|
const numericPrimtives = {
|
|
@@ -62,6 +81,8 @@ const numericAliases = {
|
|
|
62
81
|
// These tokens are specfic to Chat will not be replaced by the Tapestry library
|
|
63
82
|
const localChatTokens = {
|
|
64
83
|
colorInteractionOnlineDefault: 'hsl(123, 38%, 57%)',
|
|
84
|
+
fillColorInteractionDefaultDark: 'hsl(204, 100%, 40%)',
|
|
85
|
+
fillColorStatusErrorMedium: 'hsl(0, 72%, 45%)',
|
|
65
86
|
} as const
|
|
66
87
|
|
|
67
88
|
export const tokens = {
|
package/build/utils/api.d.ts
DELETED
package/build/utils/api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,GAAG,OAAO,EAC5C,GAAG,EAAE,MAAM,EACX,EAAE,MAAc,EAAE,IAAW,EAAE;;;CAAK,GACnC,OAAO,CAAC;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,CAuBvD"}
|
package/build/utils/api.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import DeviceInfo from 'react-native-device-info';
|
|
2
|
-
import { session } from './session';
|
|
3
|
-
const brand = DeviceInfo.getBrand();
|
|
4
|
-
const model = DeviceInfo.getModel();
|
|
5
|
-
const systemName = DeviceInfo.getSystemName();
|
|
6
|
-
const systemVersion = DeviceInfo.getSystemVersion();
|
|
7
|
-
const readableVersion = DeviceInfo.getReadableVersion();
|
|
8
|
-
const appName = DeviceInfo.getApplicationName();
|
|
9
|
-
export default function apiRequest(url, { method = 'GET', data = null } = {}) {
|
|
10
|
-
const options = {
|
|
11
|
-
headers: {
|
|
12
|
-
Accept: 'application/vnd.api+json',
|
|
13
|
-
'Content-Type': 'application/json',
|
|
14
|
-
'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,
|
|
15
|
-
Authorization: `Bearer ${session.token?.access_token}`,
|
|
16
|
-
},
|
|
17
|
-
method,
|
|
18
|
-
};
|
|
19
|
-
if (data && method !== 'GET') {
|
|
20
|
-
options.body = JSON.stringify(data);
|
|
21
|
-
}
|
|
22
|
-
return fetch(url, options)
|
|
23
|
-
.then(validateResponse)
|
|
24
|
-
.then(response => response
|
|
25
|
-
.json()
|
|
26
|
-
.then(json => ({ json: json, ok: response.ok, response }))
|
|
27
|
-
.catch(() => ({ json: null, ok: response.ok, response })));
|
|
28
|
-
}
|
|
29
|
-
const validateResponse = (response) => {
|
|
30
|
-
const isExpired = response.status === 401;
|
|
31
|
-
if (isExpired) {
|
|
32
|
-
throw new Error('Token expired');
|
|
33
|
-
}
|
|
34
|
-
return response;
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=api.js.map
|
package/build/utils/api.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;AAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;AACnD,MAAM,eAAe,GAAG,UAAU,CAAC,kBAAkB,EAAE,CAAA;AACvD,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,EAAE,CAAA;AAE/C,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,GAAW,EACX,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE;IAEpC,MAAM,OAAO,GAAgB;QAC3B,OAAO,EAAE;YACP,MAAM,EAAE,0BAA0B;YAClC,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,GAAG,OAAO,IAAI,eAAe,KAAK,KAAK,KAAK,KAAK,KAAK,UAAU,KAAK,aAAa,GAAG;YACnG,aAAa,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE;SACvD;QACD,MAAM;KACP,CAAA;IAED,IAAI,IAAI,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC;SACvB,IAAI,CAAC,gBAAgB,CAAC;SACtB,IAAI,CAAC,QAAQ,CAAC,EAAE,CACf,QAAQ;SACL,IAAI,EAAE;SACN,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;SAC9D,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CACjE,CAAA;AACL,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,EAAE;IAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAA;IAEzC,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA","sourcesContent":["import DeviceInfo from 'react-native-device-info'\nimport { session } from './session'\n\nconst brand = DeviceInfo.getBrand()\nconst model = DeviceInfo.getModel()\nconst systemName = DeviceInfo.getSystemName()\nconst systemVersion = DeviceInfo.getSystemVersion()\nconst readableVersion = DeviceInfo.getReadableVersion()\nconst appName = DeviceInfo.getApplicationName()\n\nexport default function apiRequest<T = unknown>(\n url: string,\n { method = 'GET', data = null } = {}\n): Promise<{ json: T; ok: boolean; response: Response }> {\n const options: RequestInit = {\n headers: {\n Accept: 'application/vnd.api+json',\n 'Content-Type': 'application/json',\n 'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,\n Authorization: `Bearer ${session.token?.access_token}`,\n },\n method,\n }\n\n if (data && method !== 'GET') {\n options.body = JSON.stringify(data)\n }\n\n return fetch(url, options)\n .then(validateResponse)\n .then(response =>\n response\n .json()\n .then(json => ({ json: json as T, ok: response.ok, response }))\n .catch(() => ({ json: null as T, ok: response.ok, response }))\n )\n}\n\nconst validateResponse = (response: Response) => {\n const isExpired = response.status === 401\n\n if (isExpired) {\n throw new Error('Token expired')\n }\n\n return response\n}\n"]}
|
package/src/types.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export type ConversationRecord = {
|
|
2
|
-
id: string
|
|
3
|
-
type: 'Conversation'
|
|
4
|
-
attributes: {
|
|
5
|
-
title: string
|
|
6
|
-
created_at: string
|
|
7
|
-
updated_at: string
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export type OAuthToken = {
|
|
12
|
-
token_type: any
|
|
13
|
-
access_token: any
|
|
14
|
-
created_at: number
|
|
15
|
-
expires_in: any
|
|
16
|
-
scope: string
|
|
17
|
-
refresh_token: any
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Sets all the properties of of a deeply nested object to optional.
|
|
21
|
-
// Example: `DeepPartial<ChatTheme>`
|
|
22
|
-
export type DeepPartial<T> = {
|
|
23
|
-
[P in keyof T]?: DeepPartial<T[P]>
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type RootStackParamList = {
|
|
27
|
-
Settings: undefined
|
|
28
|
-
Conversations: undefined
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare global {
|
|
32
|
-
namespace ReactNavigation {
|
|
33
|
-
interface RootParamList extends RootStackParamList {}
|
|
34
|
-
}
|
|
35
|
-
}
|
package/src/utils/api.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import DeviceInfo from 'react-native-device-info'
|
|
2
|
-
import { session } from './session'
|
|
3
|
-
|
|
4
|
-
const brand = DeviceInfo.getBrand()
|
|
5
|
-
const model = DeviceInfo.getModel()
|
|
6
|
-
const systemName = DeviceInfo.getSystemName()
|
|
7
|
-
const systemVersion = DeviceInfo.getSystemVersion()
|
|
8
|
-
const readableVersion = DeviceInfo.getReadableVersion()
|
|
9
|
-
const appName = DeviceInfo.getApplicationName()
|
|
10
|
-
|
|
11
|
-
export default function apiRequest<T = unknown>(
|
|
12
|
-
url: string,
|
|
13
|
-
{ method = 'GET', data = null } = {}
|
|
14
|
-
): Promise<{ json: T; ok: boolean; response: Response }> {
|
|
15
|
-
const options: RequestInit = {
|
|
16
|
-
headers: {
|
|
17
|
-
Accept: 'application/vnd.api+json',
|
|
18
|
-
'Content-Type': 'application/json',
|
|
19
|
-
'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,
|
|
20
|
-
Authorization: `Bearer ${session.token?.access_token}`,
|
|
21
|
-
},
|
|
22
|
-
method,
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (data && method !== 'GET') {
|
|
26
|
-
options.body = JSON.stringify(data)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return fetch(url, options)
|
|
30
|
-
.then(validateResponse)
|
|
31
|
-
.then(response =>
|
|
32
|
-
response
|
|
33
|
-
.json()
|
|
34
|
-
.then(json => ({ json: json as T, ok: response.ok, response }))
|
|
35
|
-
.catch(() => ({ json: null as T, ok: response.ok, response }))
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const validateResponse = (response: Response) => {
|
|
40
|
-
const isExpired = response.status === 401
|
|
41
|
-
|
|
42
|
-
if (isExpired) {
|
|
43
|
-
throw new Error('Token expired')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return response
|
|
47
|
-
}
|