@developer_tribe/react-native-comnyx 0.1.1 → 0.2.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.
Files changed (301) hide show
  1. package/lib/commonjs/App.js +59 -0
  2. package/lib/commonjs/App.js.map +1 -0
  3. package/lib/commonjs/__dev__.js +29 -0
  4. package/lib/commonjs/__dev__.js.map +1 -0
  5. package/lib/commonjs/api/api.js +22 -0
  6. package/lib/commonjs/api/api.js.map +1 -0
  7. package/lib/commonjs/api/conversations.js +37 -0
  8. package/lib/commonjs/api/conversations.js.map +1 -0
  9. package/lib/commonjs/api/customers.js +15 -0
  10. package/lib/commonjs/api/customers.js.map +1 -0
  11. package/lib/commonjs/api/index.js +33 -0
  12. package/lib/commonjs/api/index.js.map +1 -0
  13. package/lib/commonjs/api/messages.js +27 -0
  14. package/lib/commonjs/api/messages.js.map +1 -0
  15. package/lib/commonjs/assets/clock.png +0 -0
  16. package/lib/commonjs/assets/double-check.png +0 -0
  17. package/lib/commonjs/assets/down.png +0 -0
  18. package/lib/commonjs/assets/send.png +0 -0
  19. package/lib/commonjs/components/AppText.js +38 -0
  20. package/lib/commonjs/components/AppText.js.map +1 -0
  21. package/lib/commonjs/components/ChatList.js +268 -0
  22. package/lib/commonjs/components/ChatList.js.map +1 -0
  23. package/lib/commonjs/components/CustomerForm.js +213 -0
  24. package/lib/commonjs/components/CustomerForm.js.map +1 -0
  25. package/lib/commonjs/components/EmptyList.js +40 -0
  26. package/lib/commonjs/components/EmptyList.js.map +1 -0
  27. package/lib/commonjs/components/InitFailed.js +51 -0
  28. package/lib/commonjs/components/InitFailed.js.map +1 -0
  29. package/lib/commonjs/components/MessageInput.js +119 -0
  30. package/lib/commonjs/components/MessageInput.js.map +1 -0
  31. package/lib/commonjs/components/MessageItem.js +117 -0
  32. package/lib/commonjs/components/MessageItem.js.map +1 -0
  33. package/lib/commonjs/constants/translations.js +219 -0
  34. package/lib/commonjs/constants/translations.js.map +1 -0
  35. package/lib/commonjs/data/fake/conversations.js +95 -0
  36. package/lib/commonjs/data/fake/conversations.js.map +1 -0
  37. package/lib/commonjs/data/fake/customers.js +24 -0
  38. package/lib/commonjs/data/fake/customers.js.map +1 -0
  39. package/lib/commonjs/data/fake/messages.js +67 -0
  40. package/lib/commonjs/data/fake/messages.js.map +1 -0
  41. package/lib/commonjs/hooks/useLocalize.js +20 -0
  42. package/lib/commonjs/hooks/useLocalize.js.map +1 -0
  43. package/lib/commonjs/hooks/usePolling.js +50 -0
  44. package/lib/commonjs/hooks/usePolling.js.map +1 -0
  45. package/lib/commonjs/hooks/useThemeColors.js +17 -0
  46. package/lib/commonjs/hooks/useThemeColors.js.map +1 -0
  47. package/lib/commonjs/index.js +15 -6
  48. package/lib/commonjs/index.js.map +1 -1
  49. package/lib/commonjs/register.js +21 -0
  50. package/lib/commonjs/register.js.map +1 -0
  51. package/lib/commonjs/store.js +79 -0
  52. package/lib/commonjs/store.js.map +1 -0
  53. package/lib/commonjs/types/ApiOptions.js +2 -0
  54. package/lib/commonjs/types/ApiOptions.js.map +1 -0
  55. package/lib/commonjs/types/Conversation.js +2 -0
  56. package/lib/commonjs/types/Conversation.js.map +1 -0
  57. package/lib/commonjs/types/Customer.js +2 -0
  58. package/lib/commonjs/types/Customer.js.map +1 -0
  59. package/lib/commonjs/types/Language.js +2 -0
  60. package/lib/commonjs/types/Language.js.map +1 -0
  61. package/lib/commonjs/types/LocalizationKeys.js +2 -0
  62. package/lib/commonjs/types/LocalizationKeys.js.map +1 -0
  63. package/lib/commonjs/types/MessageResponse.js +2 -0
  64. package/lib/commonjs/types/MessageResponse.js.map +1 -0
  65. package/lib/commonjs/types/Theme.js +29 -0
  66. package/lib/commonjs/types/Theme.js.map +1 -0
  67. package/lib/commonjs/utils/date.js +17 -0
  68. package/lib/commonjs/utils/date.js.map +1 -0
  69. package/lib/module/App.js +55 -0
  70. package/lib/module/App.js.map +1 -0
  71. package/lib/module/__dev__.js +29 -0
  72. package/lib/module/__dev__.js.map +1 -0
  73. package/lib/module/api/api.js +17 -0
  74. package/lib/module/api/api.js.map +1 -0
  75. package/lib/module/api/conversations.js +32 -0
  76. package/lib/module/api/conversations.js.map +1 -0
  77. package/lib/module/api/customers.js +11 -0
  78. package/lib/module/api/customers.js.map +1 -0
  79. package/lib/module/api/index.js +6 -0
  80. package/lib/module/api/index.js.map +1 -0
  81. package/lib/module/api/messages.js +23 -0
  82. package/lib/module/api/messages.js.map +1 -0
  83. package/lib/module/assets/clock.png +0 -0
  84. package/lib/module/assets/double-check.png +0 -0
  85. package/lib/module/assets/down.png +0 -0
  86. package/lib/module/assets/send.png +0 -0
  87. package/lib/module/components/AppText.js +34 -0
  88. package/lib/module/components/AppText.js.map +1 -0
  89. package/lib/module/components/ChatList.js +265 -0
  90. package/lib/module/components/ChatList.js.map +1 -0
  91. package/lib/module/components/CustomerForm.js +209 -0
  92. package/lib/module/components/CustomerForm.js.map +1 -0
  93. package/lib/module/components/EmptyList.js +36 -0
  94. package/lib/module/components/EmptyList.js.map +1 -0
  95. package/lib/module/components/InitFailed.js +47 -0
  96. package/lib/module/components/InitFailed.js.map +1 -0
  97. package/lib/module/components/MessageInput.js +115 -0
  98. package/lib/module/components/MessageInput.js.map +1 -0
  99. package/lib/module/components/MessageItem.js +114 -0
  100. package/lib/module/components/MessageItem.js.map +1 -0
  101. package/lib/module/constants/translations.js +215 -0
  102. package/lib/module/constants/translations.js.map +1 -0
  103. package/lib/module/data/fake/conversations.js +88 -0
  104. package/lib/module/data/fake/conversations.js.map +1 -0
  105. package/lib/module/data/fake/customers.js +20 -0
  106. package/lib/module/data/fake/customers.js.map +1 -0
  107. package/lib/module/data/fake/messages.js +63 -0
  108. package/lib/module/data/fake/messages.js.map +1 -0
  109. package/lib/module/hooks/useLocalize.js +16 -0
  110. package/lib/module/hooks/useLocalize.js.map +1 -0
  111. package/lib/module/hooks/usePolling.js +46 -0
  112. package/lib/module/hooks/usePolling.js.map +1 -0
  113. package/lib/module/hooks/useThemeColors.js +13 -0
  114. package/lib/module/hooks/useThemeColors.js.map +1 -0
  115. package/lib/module/index.js +3 -4
  116. package/lib/module/index.js.map +1 -1
  117. package/lib/module/register.js +17 -0
  118. package/lib/module/register.js.map +1 -0
  119. package/lib/module/store.js +74 -0
  120. package/lib/module/store.js.map +1 -0
  121. package/lib/module/types/ApiOptions.js +2 -0
  122. package/lib/module/types/ApiOptions.js.map +1 -0
  123. package/lib/module/types/Conversation.js +2 -0
  124. package/lib/module/types/Conversation.js.map +1 -0
  125. package/lib/module/types/Customer.js +2 -0
  126. package/lib/module/types/Customer.js.map +1 -0
  127. package/lib/module/types/Language.js +2 -0
  128. package/lib/module/types/Language.js.map +1 -0
  129. package/lib/module/types/LocalizationKeys.js +2 -0
  130. package/lib/module/types/LocalizationKeys.js.map +1 -0
  131. package/lib/module/types/MessageResponse.js +2 -0
  132. package/lib/module/types/MessageResponse.js.map +1 -0
  133. package/lib/module/types/Theme.js +25 -0
  134. package/lib/module/types/Theme.js.map +1 -0
  135. package/lib/module/utils/date.js +12 -0
  136. package/lib/module/utils/date.js.map +1 -0
  137. package/lib/typescript/commonjs/src/App.d.ts +9 -0
  138. package/lib/typescript/commonjs/src/App.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/src/__dev__.d.ts +2 -0
  140. package/lib/typescript/commonjs/src/__dev__.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/src/api/api.d.ts +4 -0
  142. package/lib/typescript/commonjs/src/api/api.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/api/conversations.d.ts +7 -0
  144. package/lib/typescript/commonjs/src/api/conversations.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/src/api/customers.d.ts +4 -0
  146. package/lib/typescript/commonjs/src/api/customers.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/api/index.d.ts +4 -0
  148. package/lib/typescript/commonjs/src/api/index.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/src/api/messages.d.ts +4 -0
  150. package/lib/typescript/commonjs/src/api/messages.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/src/components/AppText.d.ts +10 -0
  152. package/lib/typescript/commonjs/src/components/AppText.d.ts.map +1 -0
  153. package/lib/typescript/commonjs/src/components/ChatList.d.ts +2 -0
  154. package/lib/typescript/commonjs/src/components/ChatList.d.ts.map +1 -0
  155. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts +2 -0
  156. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/src/components/EmptyList.d.ts +2 -0
  158. package/lib/typescript/commonjs/src/components/EmptyList.d.ts.map +1 -0
  159. package/lib/typescript/commonjs/src/components/InitFailed.d.ts +6 -0
  160. package/lib/typescript/commonjs/src/components/InitFailed.d.ts.map +1 -0
  161. package/lib/typescript/commonjs/src/components/MessageInput.d.ts +4 -0
  162. package/lib/typescript/commonjs/src/components/MessageInput.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/src/components/MessageItem.d.ts +5 -0
  164. package/lib/typescript/commonjs/src/components/MessageItem.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/src/constants/translations.d.ts +4 -0
  166. package/lib/typescript/commonjs/src/constants/translations.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/src/data/fake/conversations.d.ts +5 -0
  168. package/lib/typescript/commonjs/src/data/fake/conversations.d.ts.map +1 -0
  169. package/lib/typescript/commonjs/src/data/fake/customers.d.ts +3 -0
  170. package/lib/typescript/commonjs/src/data/fake/customers.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/src/data/fake/messages.d.ts +3 -0
  172. package/lib/typescript/commonjs/src/data/fake/messages.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/src/hooks/useLocalize.d.ts +3 -0
  174. package/lib/typescript/commonjs/src/hooks/useLocalize.d.ts.map +1 -0
  175. package/lib/typescript/commonjs/src/hooks/usePolling.d.ts +2 -0
  176. package/lib/typescript/commonjs/src/hooks/usePolling.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/src/hooks/useThemeColors.d.ts +3 -0
  178. package/lib/typescript/commonjs/src/hooks/useThemeColors.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/src/index.d.ts +4 -1
  180. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/src/register.d.ts +5 -0
  182. package/lib/typescript/commonjs/src/register.d.ts.map +1 -0
  183. package/lib/typescript/commonjs/src/store.d.ts +35 -0
  184. package/lib/typescript/commonjs/src/store.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/src/types/ApiOptions.d.ts +4 -0
  186. package/lib/typescript/commonjs/src/types/ApiOptions.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/src/types/Conversation.d.ts +26 -0
  188. package/lib/typescript/commonjs/src/types/Conversation.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/src/types/Customer.d.ts +30 -0
  190. package/lib/typescript/commonjs/src/types/Customer.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/src/types/Language.d.ts +2 -0
  192. package/lib/typescript/commonjs/src/types/Language.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/src/types/LocalizationKeys.d.ts +22 -0
  194. package/lib/typescript/commonjs/src/types/LocalizationKeys.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/src/types/MessageResponse.d.ts +59 -0
  196. package/lib/typescript/commonjs/src/types/MessageResponse.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/src/types/Theme.d.ts +18 -0
  198. package/lib/typescript/commonjs/src/types/Theme.d.ts.map +1 -0
  199. package/lib/typescript/commonjs/src/utils/date.d.ts +7 -0
  200. package/lib/typescript/commonjs/src/utils/date.d.ts.map +1 -0
  201. package/lib/typescript/module/src/App.d.ts +9 -0
  202. package/lib/typescript/module/src/App.d.ts.map +1 -0
  203. package/lib/typescript/module/src/__dev__.d.ts +2 -0
  204. package/lib/typescript/module/src/__dev__.d.ts.map +1 -0
  205. package/lib/typescript/module/src/api/api.d.ts +4 -0
  206. package/lib/typescript/module/src/api/api.d.ts.map +1 -0
  207. package/lib/typescript/module/src/api/conversations.d.ts +7 -0
  208. package/lib/typescript/module/src/api/conversations.d.ts.map +1 -0
  209. package/lib/typescript/module/src/api/customers.d.ts +4 -0
  210. package/lib/typescript/module/src/api/customers.d.ts.map +1 -0
  211. package/lib/typescript/module/src/api/index.d.ts +4 -0
  212. package/lib/typescript/module/src/api/index.d.ts.map +1 -0
  213. package/lib/typescript/module/src/api/messages.d.ts +4 -0
  214. package/lib/typescript/module/src/api/messages.d.ts.map +1 -0
  215. package/lib/typescript/module/src/components/AppText.d.ts +10 -0
  216. package/lib/typescript/module/src/components/AppText.d.ts.map +1 -0
  217. package/lib/typescript/module/src/components/ChatList.d.ts +2 -0
  218. package/lib/typescript/module/src/components/ChatList.d.ts.map +1 -0
  219. package/lib/typescript/module/src/components/CustomerForm.d.ts +2 -0
  220. package/lib/typescript/module/src/components/CustomerForm.d.ts.map +1 -0
  221. package/lib/typescript/module/src/components/EmptyList.d.ts +2 -0
  222. package/lib/typescript/module/src/components/EmptyList.d.ts.map +1 -0
  223. package/lib/typescript/module/src/components/InitFailed.d.ts +6 -0
  224. package/lib/typescript/module/src/components/InitFailed.d.ts.map +1 -0
  225. package/lib/typescript/module/src/components/MessageInput.d.ts +4 -0
  226. package/lib/typescript/module/src/components/MessageInput.d.ts.map +1 -0
  227. package/lib/typescript/module/src/components/MessageItem.d.ts +5 -0
  228. package/lib/typescript/module/src/components/MessageItem.d.ts.map +1 -0
  229. package/lib/typescript/module/src/constants/translations.d.ts +4 -0
  230. package/lib/typescript/module/src/constants/translations.d.ts.map +1 -0
  231. package/lib/typescript/module/src/data/fake/conversations.d.ts +5 -0
  232. package/lib/typescript/module/src/data/fake/conversations.d.ts.map +1 -0
  233. package/lib/typescript/module/src/data/fake/customers.d.ts +3 -0
  234. package/lib/typescript/module/src/data/fake/customers.d.ts.map +1 -0
  235. package/lib/typescript/module/src/data/fake/messages.d.ts +3 -0
  236. package/lib/typescript/module/src/data/fake/messages.d.ts.map +1 -0
  237. package/lib/typescript/module/src/hooks/useLocalize.d.ts +3 -0
  238. package/lib/typescript/module/src/hooks/useLocalize.d.ts.map +1 -0
  239. package/lib/typescript/module/src/hooks/usePolling.d.ts +2 -0
  240. package/lib/typescript/module/src/hooks/usePolling.d.ts.map +1 -0
  241. package/lib/typescript/module/src/hooks/useThemeColors.d.ts +3 -0
  242. package/lib/typescript/module/src/hooks/useThemeColors.d.ts.map +1 -0
  243. package/lib/typescript/module/src/index.d.ts +4 -1
  244. package/lib/typescript/module/src/index.d.ts.map +1 -1
  245. package/lib/typescript/module/src/register.d.ts +5 -0
  246. package/lib/typescript/module/src/register.d.ts.map +1 -0
  247. package/lib/typescript/module/src/store.d.ts +35 -0
  248. package/lib/typescript/module/src/store.d.ts.map +1 -0
  249. package/lib/typescript/module/src/types/ApiOptions.d.ts +4 -0
  250. package/lib/typescript/module/src/types/ApiOptions.d.ts.map +1 -0
  251. package/lib/typescript/module/src/types/Conversation.d.ts +26 -0
  252. package/lib/typescript/module/src/types/Conversation.d.ts.map +1 -0
  253. package/lib/typescript/module/src/types/Customer.d.ts +30 -0
  254. package/lib/typescript/module/src/types/Customer.d.ts.map +1 -0
  255. package/lib/typescript/module/src/types/Language.d.ts +2 -0
  256. package/lib/typescript/module/src/types/Language.d.ts.map +1 -0
  257. package/lib/typescript/module/src/types/LocalizationKeys.d.ts +22 -0
  258. package/lib/typescript/module/src/types/LocalizationKeys.d.ts.map +1 -0
  259. package/lib/typescript/module/src/types/MessageResponse.d.ts +59 -0
  260. package/lib/typescript/module/src/types/MessageResponse.d.ts.map +1 -0
  261. package/lib/typescript/module/src/types/Theme.d.ts +18 -0
  262. package/lib/typescript/module/src/types/Theme.d.ts.map +1 -0
  263. package/lib/typescript/module/src/utils/date.d.ts +7 -0
  264. package/lib/typescript/module/src/utils/date.d.ts.map +1 -0
  265. package/package.json +10 -2
  266. package/src/App.tsx +59 -0
  267. package/src/__dev__.ts +22 -0
  268. package/src/api/api.ts +16 -0
  269. package/src/api/conversations.ts +53 -0
  270. package/src/api/customers.ts +16 -0
  271. package/src/api/index.ts +6 -0
  272. package/src/api/messages.ts +33 -0
  273. package/src/assets/clock.png +0 -0
  274. package/src/assets/double-check.png +0 -0
  275. package/src/assets/down.png +0 -0
  276. package/src/assets/send.png +0 -0
  277. package/src/components/AppText.tsx +43 -0
  278. package/src/components/ChatList.tsx +305 -0
  279. package/src/components/CustomerForm.tsx +203 -0
  280. package/src/components/EmptyList.tsx +32 -0
  281. package/src/components/InitFailed.tsx +46 -0
  282. package/src/components/MessageInput.tsx +133 -0
  283. package/src/components/MessageItem.tsx +141 -0
  284. package/src/constants/translations.ts +232 -0
  285. package/src/data/fake/conversations.ts +558 -0
  286. package/src/data/fake/customers.ts +19 -0
  287. package/src/data/fake/messages.ts +64 -0
  288. package/src/hooks/useLocalize.ts +18 -0
  289. package/src/hooks/usePolling.ts +46 -0
  290. package/src/hooks/useThemeColors.ts +10 -0
  291. package/src/index.tsx +4 -5
  292. package/src/register.ts +17 -0
  293. package/src/store.ts +85 -0
  294. package/src/types/ApiOptions.ts +4 -0
  295. package/src/types/Conversation.ts +29 -0
  296. package/src/types/Customer.ts +31 -0
  297. package/src/types/Language.ts +11 -0
  298. package/src/types/LocalizationKeys.ts +21 -0
  299. package/src/types/MessageResponse.ts +58 -0
  300. package/src/types/Theme.ts +40 -0
  301. package/src/utils/date.ts +11 -0
@@ -0,0 +1,26 @@
1
+ export interface ConversationMessage {
2
+ id: number;
3
+ content: string;
4
+ created_at: string;
5
+ user: any | null;
6
+ }
7
+ export interface AppConversationMessage extends Omit<ConversationMessage, 'id' | 'created_at'> {
8
+ id: number | null;
9
+ approved?: boolean;
10
+ created_at: Date;
11
+ }
12
+ export interface ConversationPage {
13
+ current_page: number;
14
+ data: ConversationMessage[];
15
+ first_page_url: string;
16
+ from: number;
17
+ next_page_url: string | null;
18
+ path: string;
19
+ per_page: number;
20
+ prev_page_url: string | null;
21
+ to: number;
22
+ }
23
+ export interface ConversationResponse {
24
+ page: ConversationPage;
25
+ }
26
+ //# sourceMappingURL=Conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Conversation.d.ts","sourceRoot":"","sources":["../../../../../src/types/Conversation.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,YAAY,CAAC;IACtD,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,IAAI,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,gBAAgB,CAAC;CACxB"}
@@ -0,0 +1,30 @@
1
+ export interface CustomParameter {
2
+ name: string;
3
+ value: string;
4
+ }
5
+ export interface CreateCustomerRequest {
6
+ name: string;
7
+ country: string;
8
+ language: string;
9
+ externalId: string;
10
+ email: string;
11
+ phone: string;
12
+ ipAddress: string;
13
+ customParameters?: CustomParameter[];
14
+ }
15
+ export interface Customer {
16
+ id: number;
17
+ project_id: number;
18
+ external_id: string;
19
+ name: string;
20
+ country: string;
21
+ language: string;
22
+ email: string;
23
+ phone: string;
24
+ ip_address: string;
25
+ custom_parameters: string;
26
+ user_code: string;
27
+ updated_at: string;
28
+ created_at: string;
29
+ }
30
+ //# sourceMappingURL=Customer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Customer.d.ts","sourceRoot":"","sources":["../../../../../src/types/Customer.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,2 @@
1
+ export type LanguageCode = 'en' | 'tr' | 'es' | 'fr' | 'de' | 'it' | 'pt' | 'ru' | 'ja' | 'zh';
2
+ //# sourceMappingURL=Language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Language.d.ts","sourceRoot":"","sources":["../../../../../src/types/Language.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,CAAC"}
@@ -0,0 +1,22 @@
1
+ export type LocalizationKeys = {
2
+ 'customer.form.title': string;
3
+ 'customer.form.email': string;
4
+ 'customer.form.phone': string;
5
+ 'customer.form.country': string;
6
+ 'customer.form.submit': string;
7
+ 'customer.form.error': string;
8
+ 'customer.form.instructions': string;
9
+ 'customer.form.error.country': string;
10
+ 'customer.form.error.email': string;
11
+ 'customer.form.error.phone': string;
12
+ 'customer.form.placeholder.name': string;
13
+ 'customer.form.placeholder.country': string;
14
+ 'customer.form.placeholder.email': string;
15
+ 'customer.form.placeholder.phone': string;
16
+ 'chat.messageInput.placeholder': string;
17
+ 'app.initialization.required': string;
18
+ 'chat.load.error': string;
19
+ 'chat.init.error': string;
20
+ 'chat.empty': string;
21
+ };
22
+ //# sourceMappingURL=LocalizationKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalizationKeys.d.ts","sourceRoot":"","sources":["../../../../../src/types/LocalizationKeys.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,4BAA4B,EAAE,MAAM,CAAC;IACrC,6BAA6B,EAAE,MAAM,CAAC;IACtC,2BAA2B,EAAE,MAAM,CAAC;IACpC,2BAA2B,EAAE,MAAM,CAAC;IACpC,gCAAgC,EAAE,MAAM,CAAC;IACzC,mCAAmC,EAAE,MAAM,CAAC;IAC5C,iCAAiC,EAAE,MAAM,CAAC;IAC1C,iCAAiC,EAAE,MAAM,CAAC;IAC1C,+BAA+B,EAAE,MAAM,CAAC;IACxC,6BAA6B,EAAE,MAAM,CAAC;IACtC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
@@ -0,0 +1,59 @@
1
+ export interface MessageResponse {
2
+ message: {
3
+ conversation_id: number;
4
+ content: string;
5
+ is_note: boolean;
6
+ updated_at: string;
7
+ created_at: string;
8
+ id: number;
9
+ user: null | any;
10
+ conversation: {
11
+ id: number;
12
+ project_id: number;
13
+ customer_id: number;
14
+ created_at: string;
15
+ updated_at: string;
16
+ deleted_at: null | string;
17
+ language: string;
18
+ use_ai_answers: number;
19
+ project: {
20
+ id: number;
21
+ name: string;
22
+ organization_id: number;
23
+ created_at: string;
24
+ updated_at: string;
25
+ deleted_at: null | string;
26
+ uuid: string;
27
+ organization: {
28
+ id: number;
29
+ name: string;
30
+ created_at: string;
31
+ updated_at: string;
32
+ deleted_at: null | string;
33
+ owner: Array<{
34
+ id: number;
35
+ name: string;
36
+ email: string;
37
+ email_verified_at: null | string;
38
+ created_at: string;
39
+ updated_at: string;
40
+ avatar: null | string;
41
+ two_factor_secret: null | string;
42
+ two_factor_recovery_codes: null | string;
43
+ is_bot: boolean;
44
+ profile_photo_url: string;
45
+ pivot: {
46
+ organization_id: number;
47
+ user_id: number;
48
+ role: string;
49
+ created_at: string;
50
+ updated_at: string;
51
+ };
52
+ }>;
53
+ };
54
+ };
55
+ };
56
+ events: any[];
57
+ };
58
+ }
59
+ //# sourceMappingURL=MessageResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageResponse.d.ts","sourceRoot":"","sources":["../../../../../src/types/MessageResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE;QACP,eAAe,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,MAAM,CAAC;QACnB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,IAAI,GAAG,GAAG,CAAC;QACjB,YAAY,EAAE;YACZ,EAAE,EAAE,MAAM,CAAC;YACX,UAAU,EAAE,MAAM,CAAC;YACnB,WAAW,EAAE,MAAM,CAAC;YACpB,UAAU,EAAE,MAAM,CAAC;YACnB,UAAU,EAAE,MAAM,CAAC;YACnB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;YAC1B,QAAQ,EAAE,MAAM,CAAC;YACjB,cAAc,EAAE,MAAM,CAAC;YACvB,OAAO,EAAE;gBACP,EAAE,EAAE,MAAM,CAAC;gBACX,IAAI,EAAE,MAAM,CAAC;gBACb,eAAe,EAAE,MAAM,CAAC;gBACxB,UAAU,EAAE,MAAM,CAAC;gBACnB,UAAU,EAAE,MAAM,CAAC;gBACnB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;gBAC1B,IAAI,EAAE,MAAM,CAAC;gBACb,YAAY,EAAE;oBACZ,EAAE,EAAE,MAAM,CAAC;oBACX,IAAI,EAAE,MAAM,CAAC;oBACb,UAAU,EAAE,MAAM,CAAC;oBACnB,UAAU,EAAE,MAAM,CAAC;oBACnB,UAAU,EAAE,IAAI,GAAG,MAAM,CAAC;oBAC1B,KAAK,EAAE,KAAK,CAAC;wBACX,EAAE,EAAE,MAAM,CAAC;wBACX,IAAI,EAAE,MAAM,CAAC;wBACb,KAAK,EAAE,MAAM,CAAC;wBACd,iBAAiB,EAAE,IAAI,GAAG,MAAM,CAAC;wBACjC,UAAU,EAAE,MAAM,CAAC;wBACnB,UAAU,EAAE,MAAM,CAAC;wBACnB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;wBACtB,iBAAiB,EAAE,IAAI,GAAG,MAAM,CAAC;wBACjC,yBAAyB,EAAE,IAAI,GAAG,MAAM,CAAC;wBACzC,MAAM,EAAE,OAAO,CAAC;wBAChB,iBAAiB,EAAE,MAAM,CAAC;wBAC1B,KAAK,EAAE;4BACL,eAAe,EAAE,MAAM,CAAC;4BACxB,OAAO,EAAE,MAAM,CAAC;4BAChB,IAAI,EAAE,MAAM,CAAC;4BACb,UAAU,EAAE,MAAM,CAAC;4BACnB,UAAU,EAAE,MAAM,CAAC;yBACpB,CAAC;qBACH,CAAC,CAAC;iBACJ,CAAC;aACH,CAAC;SACH,CAAC;QACF,MAAM,EAAE,GAAG,EAAE,CAAC;KACf,CAAC;CACH"}
@@ -0,0 +1,18 @@
1
+ export interface ThemeColors {
2
+ primary: string;
3
+ secondary: string;
4
+ background: string;
5
+ text: string;
6
+ error: string;
7
+ success: string;
8
+ warning: string;
9
+ info: string;
10
+ border: string;
11
+ }
12
+ export declare const lightTheme: ThemeColors;
13
+ export declare const darkTheme: ThemeColors;
14
+ export interface Theme {
15
+ light: ThemeColors;
16
+ dark: ThemeColors;
17
+ }
18
+ //# sourceMappingURL=Theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Theme.d.ts","sourceRoot":"","sources":["../../../../../src/types/Theme.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,UAAU,EAAE,WAUxB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,WAUvB,CAAC;AAEF,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,WAAW,CAAC;IACnB,IAAI,EAAE,WAAW,CAAC;CACnB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Converts a Date object to Unix timestamp (seconds)
3
+ * @param date - The Date object to convert
4
+ * @returns Unix timestamp in seconds, or undefined if date is undefined
5
+ */
6
+ export declare const dateToUnixTimestamp: (date: Date | undefined) => number | undefined;
7
+ //# sourceMappingURL=date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../../../src/utils/date.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,SACxB,IAAI,GAAG,SAAS,KACrB,MAAM,GAAG,SAGX,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@developer_tribe/react-native-comnyx",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",
@@ -65,11 +65,13 @@
65
65
  "devDependencies": {
66
66
  "@commitlint/config-conventional": "^19.6.0",
67
67
  "@evilmartians/lefthook": "^1.5.0",
68
+ "@react-native-async-storage/async-storage": "^2.1.2",
68
69
  "@react-native-community/cli": "15.0.1",
69
70
  "@react-native/eslint-config": "^0.73.1",
70
71
  "@release-it/conventional-changelog": "^9.0.2",
71
72
  "@types/jest": "^29.5.5",
72
73
  "@types/react": "^18.2.44",
74
+ "axios": "1.7.9",
73
75
  "commitlint": "^19.6.1",
74
76
  "del-cli": "^5.1.0",
75
77
  "eslint": "^8.51.0",
@@ -82,12 +84,15 @@
82
84
  "react-native-builder-bob": "^0.38.3",
83
85
  "release-it": "^17.10.0",
84
86
  "turbo": "^1.10.7",
85
- "typescript": "^5.2.2"
87
+ "typescript": "5.1.6",
88
+ "use-sync-external-store": "^1.5.0",
89
+ "zustand": "^5.0.3"
86
90
  },
87
91
  "resolutions": {
88
92
  "@types/react": "^18.2.44"
89
93
  },
90
94
  "peerDependencies": {
95
+ "@react-native-async-storage/async-storage": ">=2.0.0",
91
96
  "react": "*",
92
97
  "react-native": "*"
93
98
  },
@@ -199,5 +204,8 @@
199
204
  },
200
205
  "engines": {
201
206
  "node": ">=22.0.0"
207
+ },
208
+ "dependencies": {
209
+ "react-hook-form": "^7.55.0"
202
210
  }
203
211
  }
package/src/App.tsx ADDED
@@ -0,0 +1,59 @@
1
+ import { View, StyleSheet } from 'react-native';
2
+ import { useAppStore } from './store';
3
+ import { ChatList } from './components/ChatList';
4
+ import { CustomerForm } from './components/CustomerForm';
5
+ import type { LanguageCode } from './types/Language';
6
+ import { useEffect } from 'react';
7
+ import { AppText } from './components/AppText';
8
+ import { useThemeColors } from './hooks/useThemeColors';
9
+ import { usePolling } from './hooks/usePolling';
10
+
11
+ interface ComnyxProps {
12
+ language?: LanguageCode;
13
+ theme?: 'light' | 'dark';
14
+ fake?: boolean;
15
+ }
16
+
17
+ export function Comnyx({
18
+ language = 'en',
19
+ theme = 'dark',
20
+ fake = false,
21
+ }: ComnyxProps) {
22
+ const { initialized, customer } = useAppStore((s) => ({
23
+ initialized: s.initialized,
24
+ customer: s.customer,
25
+ }));
26
+ const themeColors = useThemeColors();
27
+ usePolling();
28
+ useEffect(() => {
29
+ useAppStore.getState().setLanguage(language);
30
+ useAppStore.getState().setTheme(theme);
31
+ useAppStore.getState().setFake(fake);
32
+ }, [language, theme, fake]);
33
+
34
+ if (!initialized) {
35
+ return (
36
+ <View
37
+ style={[styles.container, { backgroundColor: themeColors.background }]}
38
+ >
39
+ <AppText localization="app.initialization.required" />
40
+ </View>
41
+ );
42
+ } else if (!customer) {
43
+ return <CustomerForm />;
44
+ }
45
+
46
+ return (
47
+ <View
48
+ style={[styles.container, { backgroundColor: themeColors.background }]}
49
+ >
50
+ <ChatList />
51
+ </View>
52
+ );
53
+ }
54
+
55
+ const styles = StyleSheet.create({
56
+ container: {
57
+ flex: 1,
58
+ },
59
+ });
package/src/__dev__.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { useAppStore } from './store';
2
+ import type { LanguageCode } from './types/Language';
3
+
4
+ // @ts-ignore
5
+ global.clearStorage = async () => {
6
+ useAppStore.setState({ data: null });
7
+ console.info('Storage cleared');
8
+ };
9
+
10
+ // @ts-ignore
11
+ global.changeLanguage = (language: string) => {
12
+ useAppStore.setState({ language: language as LanguageCode });
13
+ console.info(`Language changed to: ${language}`);
14
+ };
15
+
16
+ // @ts-ignore
17
+ global.toggleTheme = () => {
18
+ const currentTheme = useAppStore.getState().theme;
19
+ const newTheme = currentTheme === 'light' ? 'dark' : 'light';
20
+ useAppStore.setState({ theme: newTheme });
21
+ console.info(`Theme changed to: ${newTheme}`);
22
+ };
package/src/api/api.ts ADDED
@@ -0,0 +1,16 @@
1
+ import axios from 'axios';
2
+ const axiosInstance = axios.create({
3
+ //baseURL: 'https://api.comnyx.com',
4
+ baseURL: 'https://stage.comnyx.com',
5
+ headers: {
6
+ 'Content-Type': 'application/json',
7
+ },
8
+ timeout: 1000,
9
+ });
10
+
11
+ export function initApi(token: string) {
12
+ axiosInstance.defaults.headers.common['Content-Type'] = 'application/json';
13
+ axiosInstance.defaults.headers.common.Authorization = 'Bearer ' + token;
14
+ }
15
+
16
+ export { axiosInstance };
@@ -0,0 +1,53 @@
1
+ import type { ConversationResponse } from '../types/Conversation';
2
+ import type { ApiOptions } from '../types/ApiOptions';
3
+ import {
4
+ getFakeConversationResponse,
5
+ getFakePaginatedConversationResponse,
6
+ } from '../data/fake/conversations';
7
+ import { axiosInstance } from './api';
8
+ import { dateToUnixTimestamp } from '../utils/date';
9
+
10
+ const PER_PAGE = 25;
11
+
12
+ export function getCustomerConversation(
13
+ externalId: string,
14
+ created_at: Date | undefined,
15
+ page: number = 0,
16
+ options: ApiOptions & { per_page?: number }
17
+ ): Promise<ConversationResponse> {
18
+ if (options.fake) {
19
+ return getFakePaginatedConversationResponse(
20
+ page,
21
+ options.per_page ?? PER_PAGE
22
+ );
23
+ }
24
+ return axiosInstance
25
+ .get<ConversationResponse>(`/api/customers/${externalId}/conversation`, {
26
+ params: {
27
+ page,
28
+ // per_page: PER_PAGE,
29
+ getOld: 1,
30
+ getFrom: dateToUnixTimestamp(created_at),
31
+ },
32
+ })
33
+ .then((res) => res.data);
34
+ }
35
+
36
+ export function getNewCustomerConversation(
37
+ externalId: string,
38
+ created_at: Date | undefined,
39
+ options: ApiOptions
40
+ ): Promise<ConversationResponse> {
41
+ if (options.fake) {
42
+ return getFakeConversationResponse(25, 0, 0, true);
43
+ }
44
+ return axiosInstance
45
+ .get<ConversationResponse>(`/api/customers/${externalId}/conversation`, {
46
+ params: {
47
+ page: 1,
48
+ // per_page: 25,
49
+ getFrom: dateToUnixTimestamp(created_at),
50
+ },
51
+ })
52
+ .then((res) => res.data);
53
+ }
@@ -0,0 +1,16 @@
1
+ import type { CreateCustomerRequest, Customer } from '../types/Customer';
2
+ import type { ApiOptions } from '../types/ApiOptions';
3
+ import { getFakeCustomer } from '../data/fake/customers';
4
+ import { axiosInstance } from './api';
5
+
6
+ export function createCustomer(
7
+ customerData: CreateCustomerRequest,
8
+ options: ApiOptions
9
+ ): Promise<Customer> {
10
+ if (options.fake) {
11
+ return Promise.resolve(getFakeCustomer(customerData));
12
+ }
13
+ return axiosInstance
14
+ .post('/api/customers/create', customerData)
15
+ .then((res) => res.data);
16
+ }
@@ -0,0 +1,6 @@
1
+ export { createCustomer } from './customers';
2
+ export {
3
+ getCustomerConversation,
4
+ getNewCustomerConversation,
5
+ } from './conversations';
6
+ export { sendCustomerMessage } from './messages';
@@ -0,0 +1,33 @@
1
+ import type { MessageResponse } from '../types/MessageResponse';
2
+ import type { ApiOptions } from '../types/ApiOptions';
3
+ import { getFakeMessageResponse } from '../data/fake/messages';
4
+ import { axiosInstance } from './api';
5
+
6
+ export function sendCustomerMessage(
7
+ externalId: string,
8
+ content: string,
9
+ options: ApiOptions
10
+ ): Promise<MessageResponse> {
11
+ if (options.fake) {
12
+ return new Promise<MessageResponse>((resolve, _) => {
13
+ setTimeout(() => {
14
+ resolve(getFakeMessageResponse(content));
15
+ }, 500);
16
+ });
17
+ }
18
+ return axiosInstance
19
+ .post<MessageResponse>(
20
+ '/api/customers/message',
21
+ {
22
+ externalId,
23
+ content,
24
+ },
25
+ {
26
+ headers: {
27
+ 'Accept': 'application/json',
28
+ 'Content-Type': 'application/x-www-form-urlencoded',
29
+ },
30
+ }
31
+ )
32
+ .then((res) => res.data);
33
+ }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,43 @@
1
+ import { Text } from 'react-native';
2
+ import type { TextProps } from 'react-native';
3
+ import { LocalizationList } from '../constants/translations';
4
+ import { useAppStore } from '../store';
5
+ import { useThemeColors } from '../hooks/useThemeColors';
6
+ import type { LocalizationKeys } from '../types/LocalizationKeys';
7
+
8
+ interface AppTextProps extends Omit<TextProps, 'children'> {
9
+ localization?: keyof LocalizationKeys;
10
+ children?: React.ReactNode;
11
+ }
12
+
13
+ export function AppText({
14
+ style,
15
+ localization,
16
+ children,
17
+ ...props
18
+ }: AppTextProps) {
19
+ const themeColors = useThemeColors();
20
+ const { language } = useAppStore((s) => ({
21
+ language: s.language,
22
+ }));
23
+
24
+ const localizedText = localization
25
+ ? (LocalizationList[language as keyof typeof LocalizationList] ||
26
+ LocalizationList.en)[localization]
27
+ : undefined;
28
+
29
+ const content = localizedText || children;
30
+
31
+ if (!content) {
32
+ console.warn(
33
+ 'AppText: No content provided. Either localization or children must be provided.'
34
+ );
35
+ return null;
36
+ }
37
+
38
+ return (
39
+ <Text style={[{ color: themeColors.text }, style]} {...props}>
40
+ {content}
41
+ </Text>
42
+ );
43
+ }