@planningcenter/chat-react-native 3.1.0-rc.13 → 3.1.0-rc.15

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.
Files changed (252) hide show
  1. package/build/components/conversation/attachments/attachment_card.d.ts +9 -0
  2. package/build/components/conversation/attachments/attachment_card.d.ts.map +1 -0
  3. package/build/components/conversation/attachments/attachment_card.js +35 -0
  4. package/build/components/conversation/attachments/attachment_card.js.map +1 -0
  5. package/build/components/conversation/attachments/audio_attachment.d.ts +6 -0
  6. package/build/components/conversation/attachments/audio_attachment.d.ts.map +1 -0
  7. package/build/components/conversation/attachments/audio_attachment.js +84 -0
  8. package/build/components/conversation/attachments/audio_attachment.js.map +1 -0
  9. package/build/components/conversation/attachments/constants.d.ts +3 -0
  10. package/build/components/conversation/attachments/constants.d.ts.map +1 -0
  11. package/build/components/conversation/attachments/constants.js +4 -0
  12. package/build/components/conversation/attachments/constants.js.map +1 -0
  13. package/build/components/conversation/attachments/download_attachment_button.d.ts +9 -0
  14. package/build/components/conversation/attachments/download_attachment_button.d.ts.map +1 -0
  15. package/build/components/conversation/attachments/download_attachment_button.js +29 -0
  16. package/build/components/conversation/attachments/download_attachment_button.js.map +1 -0
  17. package/build/components/conversation/attachments/expanded_link.d.ts +5 -0
  18. package/build/components/conversation/attachments/expanded_link.d.ts.map +1 -0
  19. package/build/components/conversation/attachments/expanded_link.js +44 -0
  20. package/build/components/conversation/attachments/expanded_link.js.map +1 -0
  21. package/build/components/conversation/attachments/generic_file_attachment.d.ts +7 -0
  22. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -0
  23. package/build/components/conversation/attachments/generic_file_attachment.js +63 -0
  24. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -0
  25. package/build/components/conversation/attachments/giphy_attachment.d.ts +6 -0
  26. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -0
  27. package/build/components/conversation/attachments/giphy_attachment.js +42 -0
  28. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -0
  29. package/build/components/conversation/attachments/image_attachment.d.ts +5 -0
  30. package/build/components/conversation/attachments/image_attachment.d.ts.map +1 -0
  31. package/build/components/conversation/attachments/image_attachment.js +24 -0
  32. package/build/components/conversation/attachments/image_attachment.js.map +1 -0
  33. package/build/components/conversation/attachments/video_attachment.d.ts +6 -0
  34. package/build/components/conversation/attachments/video_attachment.d.ts.map +1 -0
  35. package/build/components/conversation/attachments/video_attachment.js +64 -0
  36. package/build/components/conversation/attachments/video_attachment.js.map +1 -0
  37. package/build/components/conversation/message.d.ts +1 -1
  38. package/build/components/conversation/message.d.ts.map +1 -1
  39. package/build/components/conversation/message.js +13 -7
  40. package/build/components/conversation/message.js.map +1 -1
  41. package/build/components/conversation/message_attachments.d.ts +6 -0
  42. package/build/components/conversation/message_attachments.d.ts.map +1 -0
  43. package/build/components/conversation/message_attachments.js +52 -0
  44. package/build/components/conversation/message_attachments.js.map +1 -0
  45. package/build/components/conversation/message_markdown.d.ts +7 -0
  46. package/build/components/conversation/message_markdown.d.ts.map +1 -0
  47. package/build/components/conversation/message_markdown.js +38 -0
  48. package/build/components/conversation/message_markdown.js.map +1 -0
  49. package/build/components/conversations/conversation_preview.d.ts +9 -0
  50. package/build/components/conversations/conversation_preview.d.ts.map +1 -0
  51. package/build/components/conversations/conversation_preview.js +58 -0
  52. package/build/components/conversations/conversation_preview.js.map +1 -0
  53. package/build/components/conversations/conversations.d.ts +8 -0
  54. package/build/components/conversations/conversations.d.ts.map +1 -0
  55. package/build/components/conversations/conversations.js +40 -0
  56. package/build/components/conversations/conversations.js.map +1 -0
  57. package/build/components/conversations/unread_count_badge.d.ts +5 -0
  58. package/build/components/conversations/unread_count_badge.d.ts.map +1 -0
  59. package/build/components/conversations/unread_count_badge.js +33 -0
  60. package/build/components/conversations/unread_count_badge.js.map +1 -0
  61. package/build/components/display/badge.d.ts +9 -1
  62. package/build/components/display/badge.d.ts.map +1 -1
  63. package/build/components/display/badge.js +22 -10
  64. package/build/components/display/badge.js.map +1 -1
  65. package/build/components/display/button.d.ts +1 -1
  66. package/build/components/display/button.d.ts.map +1 -1
  67. package/build/components/display/button.js.map +1 -1
  68. package/build/components/display/child_notice.js +2 -2
  69. package/build/components/display/child_notice.js.map +1 -1
  70. package/build/components/display/icon.d.ts.map +1 -1
  71. package/build/components/display/icon.js +10 -8
  72. package/build/components/display/icon.js.map +1 -1
  73. package/build/components/display/text.js +2 -8
  74. package/build/components/display/text.js.map +1 -1
  75. package/build/components/index.d.ts +1 -1
  76. package/build/components/index.d.ts.map +1 -1
  77. package/build/components/index.js +1 -1
  78. package/build/components/index.js.map +1 -1
  79. package/build/components/page/error_boundary.d.ts +1 -1
  80. package/build/hooks/use_api.d.ts +6 -4
  81. package/build/hooks/use_api.d.ts.map +1 -1
  82. package/build/hooks/use_api.js +5 -2
  83. package/build/hooks/use_api.js.map +1 -1
  84. package/build/hooks/use_api_client.d.ts +1 -2
  85. package/build/hooks/use_api_client.d.ts.map +1 -1
  86. package/build/hooks/use_api_client.js.map +1 -1
  87. package/build/hooks/use_conversation.js +1 -1
  88. package/build/hooks/use_conversation.js.map +1 -1
  89. package/build/hooks/use_conversation_jolt_events.js +1 -1
  90. package/build/hooks/use_conversation_jolt_events.js.map +1 -1
  91. package/build/hooks/use_conversation_messages_jolt_events.js +1 -1
  92. package/build/hooks/use_conversation_messages_jolt_events.js.map +1 -1
  93. package/build/hooks/use_conversations.d.ts +2 -3
  94. package/build/hooks/use_conversations.d.ts.map +1 -1
  95. package/build/hooks/use_conversations.js +3 -29
  96. package/build/hooks/use_conversations.js.map +1 -1
  97. package/build/hooks/use_groups.d.ts +214 -0
  98. package/build/hooks/use_groups.d.ts.map +1 -0
  99. package/build/hooks/use_groups.js +22 -0
  100. package/build/hooks/use_groups.js.map +1 -0
  101. package/build/hooks/use_groups_groups.d.ts +208 -0
  102. package/build/hooks/use_groups_groups.d.ts.map +1 -0
  103. package/build/hooks/use_groups_groups.js +18 -0
  104. package/build/hooks/use_groups_groups.js.map +1 -0
  105. package/build/hooks/use_services_team.d.ts +4 -0
  106. package/build/hooks/use_services_team.d.ts.map +1 -0
  107. package/build/hooks/use_services_team.js +22 -0
  108. package/build/hooks/use_services_team.js.map +1 -0
  109. package/build/hooks/use_suspense_api.d.ts +2 -1
  110. package/build/hooks/use_suspense_api.d.ts.map +1 -1
  111. package/build/hooks/use_suspense_api.js +2 -1
  112. package/build/hooks/use_suspense_api.js.map +1 -1
  113. package/build/hooks/use_teams.d.ts +208 -0
  114. package/build/hooks/use_teams.d.ts.map +1 -0
  115. package/build/hooks/use_teams.js +22 -0
  116. package/build/hooks/use_teams.js.map +1 -0
  117. package/build/navigation/index.d.ts +11 -0
  118. package/build/navigation/index.d.ts.map +1 -1
  119. package/build/navigation/index.js +5 -0
  120. package/build/navigation/index.js.map +1 -1
  121. package/build/screens/conversation_details_screen.d.ts.map +1 -1
  122. package/build/screens/conversation_details_screen.js +86 -62
  123. package/build/screens/conversation_details_screen.js.map +1 -1
  124. package/build/screens/conversation_filters_screen.d.ts +13 -0
  125. package/build/screens/conversation_filters_screen.d.ts.map +1 -0
  126. package/build/screens/conversation_filters_screen.js +346 -0
  127. package/build/screens/conversation_filters_screen.js.map +1 -0
  128. package/build/screens/conversation_screen.js +2 -1
  129. package/build/screens/conversation_screen.js.map +1 -1
  130. package/build/screens/conversations_screen.d.ts +4 -2
  131. package/build/screens/conversations_screen.d.ts.map +1 -1
  132. package/build/screens/conversations_screen.js +139 -11
  133. package/build/screens/conversations_screen.js.map +1 -1
  134. package/build/screens/create/conversation_select_recipients_screen.d.ts.map +1 -1
  135. package/build/screens/create/conversation_select_recipients_screen.js +3 -11
  136. package/build/screens/create/conversation_select_recipients_screen.js.map +1 -1
  137. package/build/types/resources/group_resource.d.ts +4 -2
  138. package/build/types/resources/group_resource.d.ts.map +1 -1
  139. package/build/types/resources/group_resource.js.map +1 -1
  140. package/build/types/resources/index.d.ts +1 -0
  141. package/build/types/resources/index.d.ts.map +1 -1
  142. package/build/types/resources/index.js +1 -0
  143. package/build/types/resources/index.js.map +1 -1
  144. package/build/types/resources/services/index.d.ts +2 -0
  145. package/build/types/resources/services/index.d.ts.map +1 -0
  146. package/build/types/resources/services/index.js +2 -0
  147. package/build/types/resources/services/index.js.map +1 -0
  148. package/build/types/resources/services/team_resource.d.ts +48 -0
  149. package/build/types/resources/services/team_resource.d.ts.map +1 -0
  150. package/build/types/resources/services/team_resource.js +7 -0
  151. package/build/types/resources/services/team_resource.js.map +1 -0
  152. package/build/utils/index.d.ts +1 -0
  153. package/build/utils/index.d.ts.map +1 -1
  154. package/build/utils/index.js +1 -0
  155. package/build/utils/index.js.map +1 -1
  156. package/build/utils/native_adapters/audio.d.ts +13 -0
  157. package/build/utils/native_adapters/audio.d.ts.map +1 -0
  158. package/build/utils/native_adapters/audio.js +7 -0
  159. package/build/utils/native_adapters/audio.js.map +1 -0
  160. package/build/utils/native_adapters/configuration.d.ts +7 -1
  161. package/build/utils/native_adapters/configuration.d.ts.map +1 -1
  162. package/build/utils/native_adapters/configuration.js +17 -1
  163. package/build/utils/native_adapters/configuration.js.map +1 -1
  164. package/build/utils/native_adapters/index.d.ts +2 -0
  165. package/build/utils/native_adapters/index.d.ts.map +1 -1
  166. package/build/utils/native_adapters/index.js +2 -0
  167. package/build/utils/native_adapters/index.js.map +1 -1
  168. package/build/utils/native_adapters/video.d.ts +25 -0
  169. package/build/utils/native_adapters/video.d.ts.map +1 -0
  170. package/build/utils/native_adapters/video.js +7 -0
  171. package/build/utils/native_adapters/video.js.map +1 -0
  172. package/build/utils/parse_simple_markdown.d.ts +7 -0
  173. package/build/utils/parse_simple_markdown.d.ts.map +1 -0
  174. package/build/utils/parse_simple_markdown.js +32 -0
  175. package/build/utils/parse_simple_markdown.js.map +1 -0
  176. package/build/utils/pluralize.d.ts +2 -0
  177. package/build/utils/pluralize.d.ts.map +1 -0
  178. package/build/utils/pluralize.js +10 -0
  179. package/build/utils/pluralize.js.map +1 -0
  180. package/build/utils/request/conversation.d.ts +10 -0
  181. package/build/utils/request/conversation.d.ts.map +1 -0
  182. package/build/utils/request/conversation.js +32 -0
  183. package/build/utils/request/conversation.js.map +1 -0
  184. package/build/utils/request/messages.d.ts +15 -0
  185. package/build/utils/request/messages.d.ts.map +1 -0
  186. package/build/utils/request/messages.js +22 -0
  187. package/build/utils/request/messages.js.map +1 -0
  188. package/build/utils/theme.d.ts +1 -1
  189. package/build/utils/theme.d.ts.map +1 -1
  190. package/build/utils/theme.js +1 -1
  191. package/build/utils/theme.js.map +1 -1
  192. package/package.json +2 -2
  193. package/src/__tests__/utils/parse_simple_markdown.ts +93 -0
  194. package/src/__tests__/utils/pluralize.tsx +17 -0
  195. package/src/components/conversation/attachments/attachment_card.tsx +46 -0
  196. package/src/components/conversation/attachments/audio_attachment.tsx +102 -0
  197. package/src/components/conversation/attachments/constants.ts +5 -0
  198. package/src/components/conversation/attachments/download_attachment_button.tsx +46 -0
  199. package/src/components/conversation/attachments/expanded_link.tsx +54 -0
  200. package/src/components/conversation/attachments/generic_file_attachment.tsx +75 -0
  201. package/src/components/conversation/attachments/giphy_attachment.tsx +56 -0
  202. package/src/components/conversation/attachments/image_attachment.tsx +31 -0
  203. package/src/components/conversation/attachments/video_attachment.tsx +92 -0
  204. package/src/components/conversation/message.tsx +15 -6
  205. package/src/components/conversation/message_attachments.tsx +61 -0
  206. package/src/components/conversation/message_markdown.tsx +52 -0
  207. package/src/components/conversations/conversation_preview.tsx +84 -0
  208. package/src/components/conversations/conversations.tsx +79 -0
  209. package/src/components/conversations/unread_count_badge.tsx +38 -0
  210. package/src/components/display/badge.tsx +41 -10
  211. package/src/components/display/button.tsx +1 -1
  212. package/src/components/display/child_notice.tsx +2 -2
  213. package/src/components/display/icon.tsx +10 -8
  214. package/src/components/display/text.tsx +1 -7
  215. package/src/components/index.tsx +1 -1
  216. package/src/hooks/use_api.ts +11 -10
  217. package/src/hooks/use_api_client.ts +1 -1
  218. package/src/hooks/use_conversation.ts +1 -1
  219. package/src/hooks/use_conversation_jolt_events.ts +1 -1
  220. package/src/hooks/use_conversation_messages_jolt_events.ts +1 -1
  221. package/src/hooks/use_conversations.ts +3 -31
  222. package/src/hooks/use_groups.ts +31 -0
  223. package/src/hooks/use_groups_groups.ts +20 -0
  224. package/src/hooks/use_services_team.ts +30 -0
  225. package/src/hooks/use_suspense_api.ts +4 -4
  226. package/src/hooks/use_teams.ts +25 -0
  227. package/src/navigation/index.tsx +8 -0
  228. package/src/screens/conversation_details_screen.tsx +149 -117
  229. package/src/screens/conversation_filters_screen.tsx +488 -0
  230. package/src/screens/conversation_screen.tsx +8 -1
  231. package/src/screens/conversations_screen.tsx +210 -13
  232. package/src/screens/create/conversation_select_recipients_screen.tsx +3 -11
  233. package/src/types/resources/group_resource.ts +5 -2
  234. package/src/types/resources/index.ts +1 -0
  235. package/src/types/resources/services/index.ts +1 -0
  236. package/src/types/resources/services/team_resource.ts +60 -0
  237. package/src/utils/client/types.d.ts +2 -1
  238. package/src/utils/index.ts +1 -0
  239. package/src/utils/native_adapters/audio.ts +15 -0
  240. package/src/utils/native_adapters/configuration.ts +24 -1
  241. package/src/utils/native_adapters/index.ts +2 -0
  242. package/src/utils/native_adapters/video.ts +30 -0
  243. package/src/utils/parse_simple_markdown.ts +40 -0
  244. package/src/utils/pluralize.ts +11 -0
  245. package/src/utils/request/conversation.ts +46 -0
  246. package/src/utils/request/messages.ts +21 -0
  247. package/src/utils/theme.ts +2 -2
  248. package/build/components/conversations.d.ts +0 -3
  249. package/build/components/conversations.d.ts.map +0 -1
  250. package/build/components/conversations.js +0 -100
  251. package/build/components/conversations.js.map +0 -1
  252. package/src/components/conversations.tsx +0 -144
@@ -1,3 +1,5 @@
1
1
  export * from './clipboard';
2
2
  export * from './configuration';
3
+ export * from './audio';
4
+ export * from './video';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA","sourcesContent":["export * from './clipboard'\nexport * from './configuration'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA","sourcesContent":["export * from './clipboard'\nexport * from './configuration'\nexport * from './audio'\nexport * from './video'\n"]}
@@ -0,0 +1,25 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ export interface VideoPlayerProps {
3
+ source: {
4
+ uri: string;
5
+ };
6
+ aspectRatio?: number;
7
+ style?: StyleProp<ViewStyle>;
8
+ onFullscreenPlayerWillPresent?: () => void;
9
+ onFullscreenPlayerDidPresent?: () => void;
10
+ onFullscreenPlayerWillDismiss?: () => void;
11
+ onFullscreenPlayerDidDismiss?: () => void;
12
+ }
13
+ export interface VideoPlayerHandle {
14
+ play: () => void;
15
+ pause: () => void;
16
+ presentFullscreenPlayer: () => void;
17
+ dismissFullscreen: () => void;
18
+ }
19
+ type VideoPlayer = React.ForwardRefExoticComponent<VideoPlayerProps & React.RefAttributes<VideoPlayerHandle>>;
20
+ export declare class VideoAdapter {
21
+ Player: VideoPlayer;
22
+ constructor(methods: VideoAdapter);
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=video.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;IAC5B,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1C,4BAA4B,CAAC,EAAE,MAAM,IAAI,CAAA;IACzC,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1C,4BAA4B,CAAC,EAAE,MAAM,IAAI,CAAA;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,KAAK,EAAE,MAAM,IAAI,CAAA;IACjB,uBAAuB,EAAE,MAAM,IAAI,CAAA;IACnC,iBAAiB,EAAE,MAAM,IAAI,CAAA;CAC9B;AAED,KAAK,WAAW,GAAG,KAAK,CAAC,yBAAyB,CAChD,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAC1D,CAAA;AAED,qBAAa,YAAY;IACvB,MAAM,EAAE,WAAW,CAAA;gBAEP,OAAO,EAAE,YAAY;CAGlC"}
@@ -0,0 +1,7 @@
1
+ export class VideoAdapter {
2
+ Player;
3
+ constructor(methods) {
4
+ this.Player = methods.Player;
5
+ }
6
+ }
7
+ //# sourceMappingURL=video.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.js","sourceRoot":"","sources":["../../../src/utils/native_adapters/video.ts"],"names":[],"mappings":"AAuBA,MAAM,OAAO,YAAY;IACvB,MAAM,CAAa;IAEnB,YAAY,OAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;IAC9B,CAAC;CACF","sourcesContent":["import { StyleProp, ViewStyle } from 'react-native'\n\nexport interface VideoPlayerProps {\n source: { uri: string }\n aspectRatio?: number\n style?: StyleProp<ViewStyle>\n onFullscreenPlayerWillPresent?: () => void\n onFullscreenPlayerDidPresent?: () => void\n onFullscreenPlayerWillDismiss?: () => void\n onFullscreenPlayerDidDismiss?: () => void\n}\n\nexport interface VideoPlayerHandle {\n play: () => void\n pause: () => void\n presentFullscreenPlayer: () => void\n dismissFullscreen: () => void\n}\n\ntype VideoPlayer = React.ForwardRefExoticComponent<\n VideoPlayerProps & React.RefAttributes<VideoPlayerHandle>\n>\n\nexport class VideoAdapter {\n Player: VideoPlayer\n\n constructor(methods: VideoAdapter) {\n this.Player = methods.Player\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export declare const parseSimpleMarkdown: (input: any) => MarkdownPart[];
2
+ interface MarkdownPart {
3
+ type: 'text' | 'bold' | 'italic' | 'link';
4
+ content: string;
5
+ }
6
+ export {};
7
+ //# sourceMappingURL=parse_simple_markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse_simple_markdown.d.ts","sourceRoot":"","sources":["../../src/utils/parse_simple_markdown.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,gCAiC/B,CAAA;AAED,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAA;IACzC,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,32 @@
1
+ // Supports bold, italic, and links
2
+ export const parseSimpleMarkdown = input => {
3
+ const parts = [];
4
+ const pattern = /(\*\*|__)(.+?)\1|(?<!\*)\*(.+?)\*|(?<!_)_(.+?)_|(https?:\/\/[^\s]+)/g;
5
+ let lastIndex = 0;
6
+ input.replace(pattern, (match, bold, boldText, italic1, italic2, url, offset) => {
7
+ if (offset > lastIndex) {
8
+ parts.push({ type: 'text', content: input.slice(lastIndex, offset) });
9
+ }
10
+ if (bold) {
11
+ parts.push({ type: 'bold', content: boldText });
12
+ }
13
+ else if (italic1 || italic2) {
14
+ parts.push({ type: 'italic', content: italic1 || italic2 });
15
+ }
16
+ else if (url) {
17
+ const urlMatch = url.match(/^(https?:\/\/[^\s]+)([.,;!?]+)$/);
18
+ const urlContent = urlMatch ? urlMatch[1] : url;
19
+ parts.push({ type: 'link', content: urlContent });
20
+ const punctuation = urlMatch ? urlMatch[2] : '';
21
+ if (punctuation) {
22
+ parts.push({ type: 'text', content: punctuation });
23
+ }
24
+ }
25
+ lastIndex = offset + match.length;
26
+ });
27
+ if (lastIndex < input.length) {
28
+ parts.push({ type: 'text', content: input.slice(lastIndex) });
29
+ }
30
+ return parts;
31
+ };
32
+ //# sourceMappingURL=parse_simple_markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parse_simple_markdown.js","sourceRoot":"","sources":["../../src/utils/parse_simple_markdown.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,CAAC,EAAE;IACzC,MAAM,KAAK,GAAmB,EAAE,CAAA;IAEhC,MAAM,OAAO,GAAG,sEAAsE,CAAA;IACtF,IAAI,SAAS,GAAG,CAAC,CAAA;IAEjB,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE;QAC9E,IAAI,MAAM,GAAG,SAAS,EAAE,CAAC;YACvB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,EAAE,CAAC,CAAA;QACvE,CAAC;QAED,IAAI,IAAI,EAAE,CAAC;YACT,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAA;QACjD,CAAC;aAAM,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;YAC9B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,CAAC,CAAA;QAC7D,CAAC;aAAM,IAAI,GAAG,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAA;YAC7D,MAAM,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;YAC/C,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;YACjD,MAAM,WAAW,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YAC/C,IAAI,WAAW,EAAE,CAAC;gBAChB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC,CAAA;YACpD,CAAC;QACH,CAAC;QAED,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;IACnC,CAAC,CAAC,CAAA;IAEF,IAAI,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IAC/D,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["// Supports bold, italic, and links\nexport const parseSimpleMarkdown = input => {\n const parts: MarkdownPart[] = []\n\n const pattern = /(\\*\\*|__)(.+?)\\1|(?<!\\*)\\*(.+?)\\*|(?<!_)_(.+?)_|(https?:\\/\\/[^\\s]+)/g\n let lastIndex = 0\n\n input.replace(pattern, (match, bold, boldText, italic1, italic2, url, offset) => {\n if (offset > lastIndex) {\n parts.push({ type: 'text', content: input.slice(lastIndex, offset) })\n }\n\n if (bold) {\n parts.push({ type: 'bold', content: boldText })\n } else if (italic1 || italic2) {\n parts.push({ type: 'italic', content: italic1 || italic2 })\n } else if (url) {\n const urlMatch = url.match(/^(https?:\\/\\/[^\\s]+)([.,;!?]+)$/)\n const urlContent = urlMatch ? urlMatch[1] : url\n parts.push({ type: 'link', content: urlContent })\n const punctuation = urlMatch ? urlMatch[2] : ''\n if (punctuation) {\n parts.push({ type: 'text', content: punctuation })\n }\n }\n\n lastIndex = offset + match.length\n })\n\n if (lastIndex < input.length) {\n parts.push({ type: 'text', content: input.slice(lastIndex) })\n }\n\n return parts\n}\n\ninterface MarkdownPart {\n type: 'text' | 'bold' | 'italic' | 'link'\n content: string\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function pluralize(count: number, singularWord: string, includeCount?: boolean): string;
2
+ //# sourceMappingURL=pluralize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluralize.d.ts","sourceRoot":"","sources":["../../src/utils/pluralize.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,UAAO,UAQjF"}
@@ -0,0 +1,10 @@
1
+ const irregularInflections = { person: 'people' };
2
+ export function pluralize(count, singularWord, includeCount = true) {
3
+ const plural = count !== 1;
4
+ const pluralWord = irregularInflections[singularWord] || `${singularWord}s`;
5
+ return [
6
+ includeCount ? `${count.toLocaleString()} ` : '',
7
+ plural ? pluralWord : singularWord,
8
+ ].join('');
9
+ }
10
+ //# sourceMappingURL=pluralize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluralize.js","sourceRoot":"","sources":["../../src/utils/pluralize.ts"],"names":[],"mappings":"AAAA,MAAM,oBAAoB,GAA2B,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;AAEzE,MAAM,UAAU,SAAS,CAAC,KAAa,EAAE,YAAoB,EAAE,YAAY,GAAG,IAAI;IAChF,MAAM,MAAM,GAAG,KAAK,KAAK,CAAC,CAAA;IAC1B,MAAM,UAAU,GAAG,oBAAoB,CAAC,YAAY,CAAC,IAAI,GAAG,YAAY,GAAG,CAAA;IAE3E,OAAO;QACL,YAAY,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE;QAChD,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY;KACnC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACZ,CAAC","sourcesContent":["const irregularInflections: Record<string, string> = { person: 'people' }\n\nexport function pluralize(count: number, singularWord: string, includeCount = true) {\n const plural = count !== 1\n const pluralWord = irregularInflections[singularWord] || `${singularWord}s`\n\n return [\n includeCount ? `${count.toLocaleString()} ` : '',\n plural ? pluralWord : singularWord,\n ].join('')\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import { GetRequest } from '../client/types';
2
+ export interface ConversationRequestArgs {
3
+ filter: string;
4
+ gids: string;
5
+ group: string;
6
+ chat_group_graph_id?: string;
7
+ group_source_app_name?: string;
8
+ }
9
+ export declare const getConversationsRequestArgs: ({ filter, gids, group, group_source_app_name, }?: Partial<ConversationRequestArgs>) => GetRequest;
10
+ //# sourceMappingURL=conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED,eAAO,MAAM,2BAA2B,qDAKrC,OAAO,CAAC,uBAAuB,CAAC,KAAQ,UA8BzC,CAAA"}
@@ -0,0 +1,32 @@
1
+ export const getConversationsRequestArgs = ({ filter, gids, group, group_source_app_name, } = {}) => ({
2
+ url: '/me/conversations',
3
+ data: {
4
+ perPage: 20,
5
+ order: '-last_message',
6
+ filter,
7
+ group,
8
+ gids,
9
+ group_source_app_name,
10
+ fields: {
11
+ Conversation: [
12
+ 'created_at',
13
+ 'badges',
14
+ 'groups',
15
+ 'last_message_author_id',
16
+ 'last_message_author_name',
17
+ 'last_message_created_at',
18
+ 'last_message_text_preview',
19
+ 'preview_avatar_urls',
20
+ 'member_ability',
21
+ 'muted',
22
+ 'replies_disabled',
23
+ 'title',
24
+ 'unread_count',
25
+ 'updated_at',
26
+ ],
27
+ ConversationBadge: ['app_name', 'pco_resource_type', 'text'],
28
+ },
29
+ include: ['badges'],
30
+ },
31
+ });
32
+ //# sourceMappingURL=conversation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../../src/utils/request/conversation.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,EAC1C,MAAM,EACN,IAAI,EACJ,KAAK,EACL,qBAAqB,MACe,EAAE,EAAc,EAAE,CAAC,CAAC;IACxD,GAAG,EAAE,mBAAmB;IACxB,IAAI,EAAE;QACJ,OAAO,EAAE,EAAE;QACX,KAAK,EAAE,eAAe;QACtB,MAAM;QACN,KAAK;QACL,IAAI;QACJ,qBAAqB;QACrB,MAAM,EAAE;YACN,YAAY,EAAE;gBACZ,YAAY;gBACZ,QAAQ;gBACR,QAAQ;gBACR,wBAAwB;gBACxB,0BAA0B;gBAC1B,yBAAyB;gBACzB,2BAA2B;gBAC3B,qBAAqB;gBACrB,gBAAgB;gBAChB,OAAO;gBACP,kBAAkB;gBAClB,OAAO;gBACP,cAAc;gBACd,YAAY;aACb;YACD,iBAAiB,EAAE,CAAC,UAAU,EAAE,mBAAmB,EAAE,MAAM,CAAC;SAC7D;QACD,OAAO,EAAE,CAAC,QAAQ,CAAC;KACpB;CACF,CAAC,CAAA","sourcesContent":["import { GetRequest } from '../client/types'\n\nexport interface ConversationRequestArgs {\n filter: string\n gids: string\n group: string\n chat_group_graph_id?: string\n group_source_app_name?: string\n}\n\nexport const getConversationsRequestArgs = ({\n filter,\n gids,\n group,\n group_source_app_name,\n}: Partial<ConversationRequestArgs> = {}): GetRequest => ({\n url: '/me/conversations',\n data: {\n perPage: 20,\n order: '-last_message',\n filter,\n group,\n gids,\n group_source_app_name,\n fields: {\n Conversation: [\n 'created_at',\n 'badges',\n 'groups',\n 'last_message_author_id',\n 'last_message_author_name',\n 'last_message_created_at',\n 'last_message_text_preview',\n 'preview_avatar_urls',\n 'member_ability',\n 'muted',\n 'replies_disabled',\n 'title',\n 'unread_count',\n 'updated_at',\n ],\n ConversationBadge: ['app_name', 'pco_resource_type', 'text'],\n },\n include: ['badges'],\n },\n})\n"]}
@@ -0,0 +1,15 @@
1
+ export declare const getMessagesRequestArgs: ({ conversation_id }: {
2
+ conversation_id: number;
3
+ }) => {
4
+ url: string;
5
+ data: {
6
+ perPage: number;
7
+ fields: {
8
+ Message: string[];
9
+ Person: string[];
10
+ ReactionCount: string[];
11
+ };
12
+ include: string[];
13
+ };
14
+ };
15
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/utils/request/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,wBAAyB;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;CAoBrF,CAAA"}
@@ -0,0 +1,22 @@
1
+ export const getMessagesRequestArgs = ({ conversation_id }) => ({
2
+ url: `/me/conversations/${conversation_id}/messages`,
3
+ data: {
4
+ perPage: 25,
5
+ fields: {
6
+ Message: [
7
+ 'text',
8
+ 'text_edited_at',
9
+ 'mine',
10
+ 'attachments',
11
+ 'created_at',
12
+ 'deleted_at',
13
+ 'author',
14
+ 'reaction_counts',
15
+ ],
16
+ Person: ['name', 'avatar'],
17
+ ReactionCount: ['value', 'count', 'mine', 'message_id', 'author_ids'],
18
+ },
19
+ include: ['author', 'reaction_counts'],
20
+ },
21
+ });
22
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../src/utils/request/messages.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,EAAE,eAAe,EAA+B,EAAE,EAAE,CAAC,CAAC;IAC3F,GAAG,EAAE,qBAAqB,eAAe,WAAW;IACpD,IAAI,EAAE;QACJ,OAAO,EAAE,EAAE;QACX,MAAM,EAAE;YACN,OAAO,EAAE;gBACP,MAAM;gBACN,gBAAgB;gBAChB,MAAM;gBACN,aAAa;gBACb,YAAY;gBACZ,YAAY;gBACZ,QAAQ;gBACR,iBAAiB;aAClB;YACD,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;YAC1B,aAAa,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,CAAC;SACtE;QACD,OAAO,EAAE,CAAC,QAAQ,EAAE,iBAAiB,CAAC;KACvC;CACF,CAAC,CAAA","sourcesContent":["export const getMessagesRequestArgs = ({ conversation_id }: { conversation_id: number }) => ({\n url: `/me/conversations/${conversation_id}/messages`,\n data: {\n perPage: 25,\n fields: {\n Message: [\n 'text',\n 'text_edited_at',\n 'mine',\n 'attachments',\n 'created_at',\n 'deleted_at',\n 'author',\n 'reaction_counts',\n ],\n Person: ['name', 'avatar'],\n ReactionCount: ['value', 'count', 'mine', 'message_id', 'author_ids'],\n },\n include: ['author', 'reaction_counts'],\n },\n})\n"]}
@@ -22,7 +22,7 @@ export interface DefaultTheme {
22
22
  button: {
23
23
  borderRadius: number;
24
24
  };
25
- showBadgeLogo: boolean;
25
+ showBadgeProductLogo: boolean;
26
26
  }
27
27
  export declare const defaultTheme: (colorScheme: ColorSchemeName) => ChatTheme;
28
28
  export type TemporaryDefaultColorsType = Partial<ChatColors>;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AAE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EAAE,MAAM,CAAA;IAC/B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,eAAe,EAAE,MAAM,CAAA;IACvB,qBAAqB,EAAE,MAAM,CAAA;IAC7B,iBAAiB,EAAE,MAAM,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,uBAAuB,EAAE,MAAM,CAAA;IAC/B,sBAAsB,EAAE,MAAM,CAAA;CAC/B"}
@@ -11,7 +11,7 @@ export const defaultTheme = (colorScheme) => {
11
11
  button: {
12
12
  borderRadius: 40,
13
13
  },
14
- showBadgeLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`
14
+ showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`
15
15
  };
16
16
  };
17
17
  const colorsChatLight = {
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AA8B/E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAA4B,EAAa,EAAE;IACtE,MAAM,MAAM,GAAG,WAAW,IAAI,OAAO,CAAA;IAErC,MAAM,aAAa,GAAG;QACpB,GAAG,iBAAiB,CAAC,MAAM,CAAC;QAC5B,GAAG,mBAAmB,CAAC,MAAM,CAAC;KAC/B,CAAA;IAED,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE;YACN,YAAY,EAAE,EAAE;SACjB;QACD,aAAa,EAAE,IAAI,EAAE,sEAAsE;KAC5F,CAAA;AACH,CAAC,CAAA;AA+BD,MAAM,eAAe,GAAe;IAClC,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,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,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,eAAe,EAAE,MAAM,CAAC,+BAA+B;IACvD,eAAe,EAAE,MAAM,CAAC,wBAAwB;IAChD,qBAAqB,EAAE,MAAM,CAAC,6BAA6B;IAC3D,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,sBAAsB,EAAE,MAAM,CAAC,0BAA0B;CAC1D,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACrB,CAAA","sourcesContent":["import { ColorSchemeName } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n showBadgeLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName): ChatTheme => {\n const scheme = colorScheme || 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n showBadgeLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n switchTrackTrue: string | undefined\n switchTrackFalse: string | undefined\n switchThumbColor: string | undefined\n testColor: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBackground: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBackground: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBackground: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBackground: string\n statusNeutralIcon: string\n statusNeutralText: string\n statusNeutralBackground: string\n borderColorStatusError: string\n}\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBackground: tokens.fillColorStatusWarningGhost,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralText: tokens.textColorStatusNeutral,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhost,\n borderColorStatusError: tokens.borderColorStatusError,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralText: tokens.textColorStatusNeutralDark,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorStatusError: tokens.borderColorStatusErrorDark,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"]}
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAA;AA8B/E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAA4B,EAAa,EAAE;IACtE,MAAM,MAAM,GAAG,WAAW,IAAI,OAAO,CAAA;IAErC,MAAM,aAAa,GAAG;QACpB,GAAG,iBAAiB,CAAC,MAAM,CAAC;QAC5B,GAAG,mBAAmB,CAAC,MAAM,CAAC;KAC/B,CAAA;IAED,OAAO;QACL,MAAM,EAAE,aAAa;QACrB,MAAM,EAAE;YACN,YAAY,EAAE,EAAE;SACjB;Q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,CAAC,8BAA8B;IACrD,cAAc,EAAE,MAAM,CAAC,uBAAuB;IAC9C,oBAAoB,EAAE,MAAM,CAAC,4BAA4B;IACzD,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,eAAe,EAAE,MAAM,CAAC,+BAA+B;IACvD,eAAe,EAAE,MAAM,CAAC,wBAAwB;IAChD,qBAAqB,EAAE,MAAM,CAAC,6BAA6B;IAC3D,iBAAiB,EAAE,MAAM,CAAC,iCAAiC;IAC3D,iBAAiB,EAAE,MAAM,CAAC,0BAA0B;IACpD,uBAAuB,EAAE,MAAM,CAAC,+BAA+B;IAC/D,sBAAsB,EAAE,MAAM,CAAC,0BAA0B;CAC1D,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACrB,CAAA","sourcesContent":["import { ColorSchemeName } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { aliasTokensColorMap } from '../vendor/tapestry/alias_tokens_color_map'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof aliasTokensColorMap.light | typeof aliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n borderRadius: number\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n button: {\n borderRadius: number\n }\n showBadgeProductLogo: boolean\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName): ChatTheme => {\n const scheme = colorScheme || 'light'\n\n const defaultColors = {\n ...chatThemeColorMap[scheme],\n ...aliasTokensColorMap[scheme],\n }\n\n return {\n colors: defaultColors,\n button: {\n borderRadius: 40,\n },\n showBadgeProductLogo: true, // Overrides visibility of the product logo in `src/display/badge.tsx`\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n buttonStart: string | undefined\n buttonEnd: string | undefined\n interaction: string\n switchTrackTrue: string | undefined\n switchTrackFalse: string | undefined\n switchThumbColor: string | undefined\n testColor: string\n statusInfoIcon: string\n statusInfoText: string\n statusInfoBackground: string\n statusSuccessIcon: string\n statusSuccessText: string\n statusSuccessBackground: string\n statusWarningIcon: string\n statusWarningText: string\n statusWarningBackground: string\n statusErrorIcon: string\n statusErrorText: string\n statusErrorBackground: string\n statusNeutralIcon: string\n statusNeutralText: string\n statusNeutralBackground: string\n borderColorStatusError: string\n}\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefault,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'hotpink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimary,\n statusInfoText: tokens.textColorStatusInfo,\n statusInfoBackground: tokens.fillColorStatusInfoGhost,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimary,\n statusSuccessText: tokens.textColorStatusSuccess,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhost,\n statusWarningIcon: tokens.iconColorStatusWarningPrimary,\n statusWarningText: tokens.textColorStatusWarning,\n statusWarningBackground: tokens.fillColorStatusWarningGhost,\n statusErrorIcon: tokens.iconColorStatusErrorPrimary,\n statusErrorText: tokens.textColorStatusError,\n statusErrorBackground: tokens.fillColorStatusErrorGhost,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimary,\n statusNeutralText: tokens.textColorStatusNeutral,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhost,\n borderColorStatusError: tokens.borderColorStatusError,\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n buttonStart: undefined,\n buttonEnd: undefined,\n interaction: tokens.fillColorInteractionDefaultDark,\n switchTrackTrue: undefined,\n switchTrackFalse: undefined,\n switchThumbColor: undefined,\n testColor: 'pink',\n statusInfoIcon: tokens.iconColorStatusInfoPrimaryDark,\n statusInfoText: tokens.textColorStatusInfoDark,\n statusInfoBackground: tokens.fillColorStatusInfoGhostDark,\n statusSuccessIcon: tokens.iconColorStatusSuccessPrimaryDark,\n statusSuccessText: tokens.textColorStatusSuccessDark,\n statusSuccessBackground: tokens.fillColorStatusSuccessGhostDark,\n statusWarningIcon: tokens.iconColorStatusWarningPrimaryDark,\n statusWarningText: tokens.textColorStatusWarningDark,\n statusWarningBackground: tokens.fillColorStatusWarningGhostDark,\n statusErrorIcon: tokens.iconColorStatusErrorPrimaryDark,\n statusErrorText: tokens.textColorStatusErrorDark,\n statusErrorBackground: tokens.fillColorStatusErrorGhostDark,\n statusNeutralIcon: tokens.iconColorStatusNeutralPrimaryDark,\n statusNeutralText: tokens.textColorStatusNeutralDark,\n statusNeutralBackground: tokens.fillColorStatusNeutralGhostDark,\n borderColorStatusError: tokens.borderColorStatusErrorDark,\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.1.0-rc.13",
3
+ "version": "3.1.0-rc.15",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -52,5 +52,5 @@
52
52
  "prettier": "^3.4.2",
53
53
  "typescript": "<5.6.0"
54
54
  },
55
- "gitHead": "16426849214eaeee850eee8999bdd7c0f69dbe36"
55
+ "gitHead": "2725953053f7e22a20632e00efb8e21123cc923e"
56
56
  }
@@ -0,0 +1,93 @@
1
+ import { parseSimpleMarkdown } from '../../utils/parse_simple_markdown'
2
+
3
+ describe('parseSimpleMarkdown', () => {
4
+ it('parses bold text correctly', () => {
5
+ const input = 'This is **bold** text'
6
+ const result = parseSimpleMarkdown(input)
7
+ expect(result).toEqual([
8
+ { type: 'text', content: 'This is ' },
9
+ { type: 'bold', content: 'bold' },
10
+ { type: 'text', content: ' text' },
11
+ ])
12
+ })
13
+
14
+ it('parses italic text correctly', () => {
15
+ const input = 'This is *italic* text'
16
+ const result = parseSimpleMarkdown(input)
17
+ expect(result).toEqual([
18
+ { type: 'text', content: 'This is ' },
19
+ { type: 'italic', content: 'italic' },
20
+ { type: 'text', content: ' text' },
21
+ ])
22
+ })
23
+
24
+ it('parses links correctly', () => {
25
+ const input = 'Visit https://example.com/page?query=info&number=1#hash. for more info'
26
+ const result = parseSimpleMarkdown(input)
27
+ expect(result).toEqual([
28
+ { type: 'text', content: 'Visit ' },
29
+ { type: 'link', content: 'https://example.com/page?query=info&number=1#hash' },
30
+ { type: 'text', content: '.' },
31
+ { type: 'text', content: ' for more info' },
32
+ ])
33
+ })
34
+
35
+ it('parses mixed formatting correctly', () => {
36
+ const input = 'This is **bold** and *italic* and a link: https://example.com'
37
+ const result = parseSimpleMarkdown(input)
38
+ expect(result).toEqual([
39
+ { type: 'text', content: 'This is ' },
40
+ { type: 'bold', content: 'bold' },
41
+ { type: 'text', content: ' and ' },
42
+ { type: 'italic', content: 'italic' },
43
+ { type: 'text', content: ' and a link: ' },
44
+ { type: 'link', content: 'https://example.com' },
45
+ ])
46
+ })
47
+
48
+ it('parses unordered lists correctly', () => {
49
+ const input = '* Item 1\n* Item 2\n* Item 3'
50
+ const result = parseSimpleMarkdown(input)
51
+ expect(result).toEqual([{ type: 'text', content: '* Item 1\n* Item 2\n* Item 3' }])
52
+ })
53
+
54
+ it('parses ordered lists correctly', () => {
55
+ const input = '1. Item 1\n2. Item 2\n3. Item 3'
56
+ const result = parseSimpleMarkdown(input)
57
+ expect(result).toEqual([{ type: 'text', content: '1. Item 1\n2. Item 2\n3. Item 3' }])
58
+ })
59
+
60
+ it('handles plain text without formatting', () => {
61
+ const input = 'Just plain text'
62
+ const result = parseSimpleMarkdown(input)
63
+ expect(result).toEqual([{ type: 'text', content: 'Just plain text' }])
64
+ })
65
+
66
+ it('handles empty input', () => {
67
+ const input = ''
68
+ const result = parseSimpleMarkdown(input)
69
+ expect(result).toEqual([])
70
+ })
71
+
72
+ it('handles multiple consecutive formatting', () => {
73
+ const input = '**bold** *italic* https://example.com'
74
+ const result = parseSimpleMarkdown(input)
75
+ expect(result).toEqual([
76
+ { type: 'bold', content: 'bold' },
77
+ { type: 'text', content: ' ' },
78
+ { type: 'italic', content: 'italic' },
79
+ { type: 'text', content: ' ' },
80
+ { type: 'link', content: 'https://example.com' },
81
+ ])
82
+ })
83
+
84
+ it('handles unmatched formatting gracefully', () => {
85
+ const input = 'This is **bold and *italic'
86
+ const result = parseSimpleMarkdown(input)
87
+ expect(result).toEqual([
88
+ { type: 'text', content: 'This is ' },
89
+ { type: 'italic', content: '*bold and ' },
90
+ { type: 'text', content: 'italic' },
91
+ ])
92
+ })
93
+ })
@@ -0,0 +1,17 @@
1
+ import { pluralize } from '../../utils'
2
+
3
+ describe('pluralize', () => {
4
+ it('includes count and adds an s', () => {
5
+ expect(pluralize(0, 'kid')).toEqual('0 kids')
6
+ expect(pluralize(1, 'kid')).toEqual('1 kid')
7
+ expect(pluralize(2, 'kid')).toEqual('2 kids')
8
+ expect(pluralize(10, 'kid')).toEqual('10 kids')
9
+ })
10
+ it('can optionally not include count', () => {
11
+ expect(pluralize(1, 'kid', false)).toEqual('kid')
12
+ expect(pluralize(2, 'kid', false)).toEqual('kids')
13
+ })
14
+ it('can convert "person" to "people"', () => {
15
+ expect(pluralize(2, 'person', false)).toEqual('people')
16
+ })
17
+ })
@@ -0,0 +1,46 @@
1
+ import React, { ComponentProps, ReactNode } from 'react'
2
+ import { StyleSheet, View } from 'react-native'
3
+ import { MESSAGE_ATTACHMENT_WIDTH_SINGLE } from './constants'
4
+ import { Text } from '../../display'
5
+ import { tokens } from '../../../vendor/tapestry/tokens'
6
+ import { useTheme } from '../../../hooks'
7
+
8
+ type AttachmentCardProps = ComponentProps<typeof View>
9
+
10
+ export function AttachmentCard({ children, ...props }: AttachmentCardProps) {
11
+ const styles = useStyles()
12
+
13
+ return (
14
+ <View style={styles.card} {...props}>
15
+ {children}
16
+ </View>
17
+ )
18
+ }
19
+
20
+ export function AttachmentCardTitle({ children }: { children: ReactNode }) {
21
+ const styles = useStyles()
22
+
23
+ return (
24
+ <Text style={styles.title} numberOfLines={1} ellipsizeMode="tail" selectable={false}>
25
+ {children}
26
+ </Text>
27
+ )
28
+ }
29
+
30
+ const useStyles = () => {
31
+ const { colors } = useTheme()
32
+
33
+ return StyleSheet.create({
34
+ card: {
35
+ padding: 4,
36
+ backgroundColor: 'white',
37
+ borderRadius: 8,
38
+ minWidth: MESSAGE_ATTACHMENT_WIDTH_SINGLE,
39
+ minHeight: 48,
40
+ },
41
+ title: {
42
+ color: colors.textColorDefaultPrimary,
43
+ fontSize: tokens.fontSizeSm,
44
+ },
45
+ })
46
+ }
@@ -0,0 +1,102 @@
1
+ import React from 'react'
2
+ import { View, Text, StyleSheet } from 'react-native'
3
+ import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
4
+ import { IconButton } from '../../display'
5
+ import { AttachmentCard, AttachmentCardTitle } from './attachment_card'
6
+ import { tokens } from '../../../vendor/tapestry/tokens'
7
+ import { useTheme } from '../../../hooks'
8
+ import { Audio } from '../../../utils/native_adapters'
9
+
10
+ export function AudioAttachment({
11
+ attachment,
12
+ }: {
13
+ attachment: DenormalizedMessageAttachmentResource
14
+ }) {
15
+ const styles = useStyles()
16
+ const { attributes } = attachment
17
+ const { url, filename } = attributes
18
+ const sound = Audio.useAudio(url)
19
+
20
+ function toggleAudio() {
21
+ if (!sound.isPlaying) {
22
+ sound.play()
23
+ } else {
24
+ sound.pause()
25
+ }
26
+ }
27
+
28
+ const progress = sound.duration > 0 ? sound.position / sound.duration : 0
29
+
30
+ function durationText() {
31
+ if (sound.duration > 0) {
32
+ return `${Math.floor(sound.position / 1000)}s / ${Math.floor(sound.duration / 1000)}s`
33
+ } else {
34
+ return 'Loading...'
35
+ }
36
+ }
37
+
38
+ return (
39
+ <AttachmentCard>
40
+ <View style={styles.container}>
41
+ <IconButton
42
+ name={sound.isPlaying ? 'services.pause' : 'services.play'}
43
+ size="md"
44
+ accessibilityLabel={sound.isPlaying ? 'Pause' : 'Play'}
45
+ onPress={toggleAudio}
46
+ disabled={!sound}
47
+ style={styles.button}
48
+ />
49
+ <View style={styles.details}>
50
+ <AttachmentCardTitle>{filename}</AttachmentCardTitle>
51
+ <View style={styles.progressContainer}>
52
+ <View style={[styles.progressBar, { width: `${progress * 100}%` }]} />
53
+ </View>
54
+ <Text style={styles.durationText}>{durationText()}</Text>
55
+ </View>
56
+ </View>
57
+ </AttachmentCard>
58
+ )
59
+ }
60
+
61
+ const useStyles = () => {
62
+ const { colors } = useTheme()
63
+
64
+ return StyleSheet.create({
65
+ container: {
66
+ flexDirection: 'row',
67
+ },
68
+ button: {
69
+ width: 42,
70
+ height: 42,
71
+ justifyContent: 'center',
72
+ alignItems: 'center',
73
+ borderRadius: 25,
74
+ backgroundColor: '#eee',
75
+ borderColor: '#aaa',
76
+ borderWidth: 1,
77
+ },
78
+ buttonText: {
79
+ fontSize: 32,
80
+ lineHeight: 32,
81
+ },
82
+ details: {
83
+ flex: 1,
84
+ marginLeft: 10,
85
+ gap: 5,
86
+ },
87
+ progressContainer: {
88
+ height: 5,
89
+ backgroundColor: '#ccc',
90
+ borderRadius: 2.5,
91
+ overflow: 'hidden',
92
+ },
93
+ progressBar: {
94
+ height: '100%',
95
+ backgroundColor: 'blue',
96
+ },
97
+ durationText: {
98
+ fontSize: tokens.fontSizeXs,
99
+ color: colors.textColorDefaultSecondary,
100
+ },
101
+ })
102
+ }
@@ -0,0 +1,5 @@
1
+ const MESSAGE_BUBBLE_ATTACHMENT_PADDING = 2
2
+
3
+ export const MESSAGE_BUBBLE_WIDTH_SINGLE = 232
4
+ export const MESSAGE_ATTACHMENT_WIDTH_SINGLE =
5
+ MESSAGE_BUBBLE_WIDTH_SINGLE - MESSAGE_BUBBLE_ATTACHMENT_PADDING * 2
@@ -0,0 +1,46 @@
1
+ import React from 'react'
2
+ import { IconButton } from '../../display'
3
+ import { useTheme } from '../../../hooks'
4
+ import { Linking, StyleSheet } from 'react-native'
5
+
6
+ interface DownloadAttachmentButtonProps {
7
+ to: string
8
+ filename: string
9
+ title: string
10
+ }
11
+
12
+ export function DownloadAttachmentButton({ to, title }: DownloadAttachmentButtonProps) {
13
+ const styles = useStyles()
14
+ async function handleDownload() {
15
+ if (to) {
16
+ // Open link in the default web browser
17
+ Linking.openURL(to)
18
+ }
19
+ }
20
+
21
+ return (
22
+ <IconButton
23
+ name="general.fromCloudArrow"
24
+ size="md"
25
+ accessibilityLabel={title}
26
+ onPress={handleDownload}
27
+ style={styles.iconButton}
28
+ />
29
+ )
30
+ }
31
+
32
+ const useStyles = () => {
33
+ const { colors } = useTheme()
34
+
35
+ return StyleSheet.create({
36
+ iconButton: {
37
+ color: colors.fillColorInteractionDefault,
38
+ backgroundColor: colors.fillColorNeutral070,
39
+ borderWidth: 1,
40
+ borderColor: colors.fillColorNeutral060,
41
+ borderRadius: 4,
42
+ width: 24,
43
+ height: 24,
44
+ },
45
+ })
46
+ }