@developer_tribe/react-native-comnyx 0.6.2 → 0.7.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 (448) hide show
  1. package/Comnyx.podspec +1 -1
  2. package/README.md +192 -16
  3. package/android/build.gradle +13 -1
  4. package/android/generated/RCTAppDependencyProvider.h +25 -0
  5. package/android/generated/RCTAppDependencyProvider.mm +55 -0
  6. package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  7. package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  8. package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
  9. package/android/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  10. package/android/generated/ReactAppDependencyProvider.podspec +34 -0
  11. package/android/generated/jni/RNComnyxSpec-generated.cpp +1 -11
  12. package/android/generated/jni/RNComnyxSpec.h +0 -7
  13. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +0 -11
  14. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +0 -52
  15. package/android/src/main/AndroidManifestNew.xml +10 -0
  16. package/android/src/main/java/com/comnyx/ComnyxModule.kt +107 -5
  17. package/android/src/main/java/com/comnyx/ComnyxPackage.kt +10 -6
  18. package/android/src/main/java/com/comnyx/src/messaging/ComnyxMessaging.kt +45 -0
  19. package/android/src/main/java/com/comnyx/src/messaging/firebase/FCM.kt +38 -0
  20. package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +45 -0
  21. package/android/src/main/java/com/comnyx/src/messaging/notifications/NotificationsService.kt +82 -0
  22. package/android/src/main/java/com/comnyx/src/messaging/permissions/Permissions.kt +64 -0
  23. package/ios/APNService.swift +74 -0
  24. package/ios/Comnyx-Bridging-Header.h +17 -0
  25. package/ios/Comnyx.m +15 -0
  26. package/ios/Comnyx.swift +77 -0
  27. package/ios/ComnyxMessaging.swift +84 -0
  28. package/ios/PushService.swift +7 -0
  29. package/lib/commonjs/NativeComnyx.js +9 -0
  30. package/lib/commonjs/NativeComnyx.js.map +1 -0
  31. package/lib/commonjs/api/api.js +14 -4
  32. package/lib/commonjs/api/api.js.map +1 -1
  33. package/lib/commonjs/api/customers.js +3 -8
  34. package/lib/commonjs/api/customers.js.map +1 -1
  35. package/lib/commonjs/api/index.js +1 -1
  36. package/lib/commonjs/components/AppText.js +1 -1
  37. package/lib/commonjs/components/AppText.js.map +1 -1
  38. package/lib/commonjs/components/ChatList.js +1 -1
  39. package/lib/commonjs/components/ChatList.js.map +1 -1
  40. package/lib/commonjs/components/CustomerForm.js +2 -4
  41. package/lib/commonjs/components/CustomerForm.js.map +1 -1
  42. package/lib/commonjs/components/MessageInput.js +1 -1
  43. package/lib/commonjs/components/MessageInput.js.map +1 -1
  44. package/lib/commonjs/constants/viewabilityConfig.js.map +1 -0
  45. package/lib/commonjs/hooks/isRtl.js +1 -1
  46. package/lib/commonjs/hooks/useLocalize.js +1 -1
  47. package/lib/commonjs/hooks/useLocalize.js.map +1 -1
  48. package/lib/commonjs/hooks/usePolling.js +1 -1
  49. package/lib/commonjs/hooks/usePolling.js.map +1 -1
  50. package/lib/commonjs/hooks/useTheme.js +1 -1
  51. package/lib/commonjs/hooks/useTheme.js.map +1 -1
  52. package/lib/commonjs/index.js +9 -16
  53. package/lib/commonjs/index.js.map +1 -1
  54. package/lib/commonjs/notifications/index.js +21 -0
  55. package/lib/commonjs/notifications/index.js.map +1 -0
  56. package/lib/commonjs/{Accumulator.js → register/Accumulator.js} +8 -1
  57. package/lib/commonjs/register/Accumulator.js.map +1 -0
  58. package/lib/commonjs/{collectData.js → register/collectData.js} +2 -0
  59. package/lib/commonjs/register/collectData.js.map +1 -0
  60. package/lib/commonjs/register/index.js +17 -0
  61. package/lib/commonjs/register/index.js.map +1 -0
  62. package/lib/commonjs/register/init.js +14 -0
  63. package/lib/commonjs/register/init.js.map +1 -0
  64. package/lib/commonjs/register/login.js +24 -0
  65. package/lib/commonjs/register/login.js.map +1 -0
  66. package/lib/commonjs/register/logout.js +20 -0
  67. package/lib/commonjs/register/logout.js.map +1 -0
  68. package/lib/commonjs/{store.js → store/store.js} +3 -2
  69. package/lib/commonjs/store/store.js.map +1 -0
  70. package/lib/commonjs/{App.js → support/ComnyxSupport.js} +39 -14
  71. package/lib/commonjs/support/ComnyxSupport.js.map +1 -0
  72. package/lib/commonjs/support/index.js +13 -0
  73. package/lib/commonjs/support/index.js.map +1 -0
  74. package/lib/commonjs/utils/scalingUtils.js +1 -1
  75. package/lib/module/NativeComnyx.js +5 -0
  76. package/lib/module/NativeComnyx.js.map +1 -0
  77. package/lib/module/api/api.js +11 -4
  78. package/lib/module/api/api.js.map +1 -1
  79. package/lib/module/api/customers.js +3 -7
  80. package/lib/module/api/customers.js.map +1 -1
  81. package/lib/module/api/index.js +1 -1
  82. package/lib/module/api/index.js.map +1 -1
  83. package/lib/module/components/AppText.js +1 -1
  84. package/lib/module/components/AppText.js.map +1 -1
  85. package/lib/module/components/ChatList.js +1 -1
  86. package/lib/module/components/ChatList.js.map +1 -1
  87. package/lib/module/components/CustomerForm.js +2 -4
  88. package/lib/module/components/CustomerForm.js.map +1 -1
  89. package/lib/module/components/MessageInput.js +1 -1
  90. package/lib/module/components/MessageInput.js.map +1 -1
  91. package/lib/module/constants/viewabilityConfig.js.map +1 -0
  92. package/lib/module/hooks/isRtl.js +1 -1
  93. package/lib/module/hooks/isRtl.js.map +1 -1
  94. package/lib/module/hooks/useLocalize.js +1 -1
  95. package/lib/module/hooks/useLocalize.js.map +1 -1
  96. package/lib/module/hooks/usePolling.js +1 -1
  97. package/lib/module/hooks/usePolling.js.map +1 -1
  98. package/lib/module/hooks/useTheme.js +1 -1
  99. package/lib/module/hooks/useTheme.js.map +1 -1
  100. package/lib/module/index.js +8 -5
  101. package/lib/module/index.js.map +1 -1
  102. package/lib/module/notifications/index.js +19 -0
  103. package/lib/module/notifications/index.js.map +1 -0
  104. package/lib/module/{Accumulator.js → register/Accumulator.js} +7 -1
  105. package/lib/module/register/Accumulator.js.map +1 -0
  106. package/lib/module/{collectData.js → register/collectData.js} +2 -0
  107. package/lib/module/register/collectData.js.map +1 -0
  108. package/lib/module/register/index.js +13 -0
  109. package/lib/module/register/index.js.map +1 -0
  110. package/lib/module/register/init.js +10 -0
  111. package/lib/module/register/init.js.map +1 -0
  112. package/lib/module/register/login.js +20 -0
  113. package/lib/module/register/login.js.map +1 -0
  114. package/lib/module/register/logout.js +16 -0
  115. package/lib/module/register/logout.js.map +1 -0
  116. package/lib/module/{store.js → store/store.js} +2 -2
  117. package/lib/module/store/store.js.map +1 -0
  118. package/lib/module/{App.js → support/ComnyxSupport.js} +40 -15
  119. package/lib/module/support/ComnyxSupport.js.map +1 -0
  120. package/lib/module/support/index.js +4 -0
  121. package/lib/module/support/index.js.map +1 -0
  122. package/lib/module/utils/scalingUtils.js +1 -1
  123. package/lib/module/utils/scalingUtils.js.map +1 -1
  124. package/lib/typescript/jest.config.d.ts +4 -0
  125. package/lib/typescript/jest.config.d.ts.map +1 -0
  126. package/lib/typescript/setup-jest.d.ts +1 -0
  127. package/lib/typescript/setup-jest.d.ts.map +1 -0
  128. package/lib/typescript/src/NativeComnyx.d.ts +7 -0
  129. package/lib/typescript/src/NativeComnyx.d.ts.map +1 -0
  130. package/lib/typescript/src/api/api.d.ts +7 -0
  131. package/lib/typescript/src/api/api.d.ts.map +1 -0
  132. package/lib/typescript/src/api/conversations.d.ts.map +1 -0
  133. package/lib/typescript/src/api/customers.d.ts +5 -0
  134. package/lib/typescript/src/api/customers.d.ts.map +1 -0
  135. package/lib/typescript/{commonjs/src → src}/api/index.d.ts +1 -1
  136. package/lib/typescript/src/api/index.d.ts.map +1 -0
  137. package/lib/typescript/src/api/messages.d.ts.map +1 -0
  138. package/lib/typescript/src/components/AppText.d.ts.map +1 -0
  139. package/lib/typescript/src/components/ChatList.d.ts.map +1 -0
  140. package/lib/typescript/src/components/CustomAlert.d.ts.map +1 -0
  141. package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -0
  142. package/lib/typescript/src/components/EmptyList.d.ts.map +1 -0
  143. package/lib/typescript/src/components/InitFailed.d.ts.map +1 -0
  144. package/lib/typescript/src/components/MessageInput.d.ts.map +1 -0
  145. package/lib/typescript/src/components/MessageItem.d.ts.map +1 -0
  146. package/lib/typescript/src/components/ScaledSheet.d.ts.map +1 -0
  147. package/lib/typescript/src/constants/activeOpacity.d.ts.map +1 -0
  148. package/lib/typescript/src/constants/countries.d.ts.map +1 -0
  149. package/lib/typescript/src/constants/rtl.d.ts.map +1 -0
  150. package/lib/typescript/src/constants/translations.d.ts.map +1 -0
  151. package/lib/typescript/src/constants/viewabilityConfig.d.ts.map +1 -0
  152. package/lib/typescript/src/data/fake/conversations.d.ts.map +1 -0
  153. package/lib/typescript/src/data/fake/customers.d.ts.map +1 -0
  154. package/lib/typescript/src/data/fake/messages.d.ts.map +1 -0
  155. package/lib/typescript/src/hooks/isRtl.d.ts.map +1 -0
  156. package/lib/typescript/src/hooks/useLocalize.d.ts.map +1 -0
  157. package/lib/typescript/src/hooks/usePolling.d.ts.map +1 -0
  158. package/lib/typescript/src/hooks/useTheme.d.ts.map +1 -0
  159. package/lib/typescript/src/hooks/useThemeColors.d.ts.map +1 -0
  160. package/lib/typescript/src/index.d.ts +5 -0
  161. package/lib/typescript/src/index.d.ts.map +1 -0
  162. package/lib/typescript/src/notifications/index.d.ts +21 -0
  163. package/lib/typescript/src/notifications/index.d.ts.map +1 -0
  164. package/lib/typescript/{commonjs/src → src/register}/Accumulator.d.ts +4 -3
  165. package/lib/typescript/src/register/Accumulator.d.ts.map +1 -0
  166. package/lib/typescript/src/register/collectData.d.ts.map +1 -0
  167. package/lib/typescript/src/register/index.d.ts +11 -0
  168. package/lib/typescript/src/register/index.d.ts.map +1 -0
  169. package/lib/typescript/src/register/init.d.ts +6 -0
  170. package/lib/typescript/src/register/init.d.ts.map +1 -0
  171. package/lib/typescript/src/register/login.d.ts +6 -0
  172. package/lib/typescript/src/register/login.d.ts.map +1 -0
  173. package/lib/typescript/src/register/logout.d.ts +2 -0
  174. package/lib/typescript/src/register/logout.d.ts.map +1 -0
  175. package/lib/typescript/{module/src → src/store}/store.d.ts +6 -4
  176. package/lib/typescript/src/store/store.d.ts.map +1 -0
  177. package/lib/typescript/src/support/ComnyxSupport.d.ts +12 -0
  178. package/lib/typescript/src/support/ComnyxSupport.d.ts.map +1 -0
  179. package/lib/typescript/src/support/index.d.ts +2 -0
  180. package/lib/typescript/src/support/index.d.ts.map +1 -0
  181. package/lib/typescript/src/types/ApiOptions.d.ts.map +1 -0
  182. package/lib/typescript/src/types/Conversation.d.ts.map +1 -0
  183. package/lib/typescript/src/types/Customer.d.ts.map +1 -0
  184. package/lib/typescript/src/types/GlobalTheme.d.ts.map +1 -0
  185. package/lib/typescript/src/types/Language.d.ts.map +1 -0
  186. package/lib/typescript/src/types/LocalizationKeys.d.ts.map +1 -0
  187. package/lib/typescript/src/types/MessageResponse.d.ts.map +1 -0
  188. package/lib/typescript/src/types/Theme.d.ts.map +1 -0
  189. package/lib/typescript/src/utils/date.d.ts.map +1 -0
  190. package/lib/typescript/src/utils/deepMap.d.ts.map +1 -0
  191. package/lib/typescript/src/utils/formatDate.d.ts.map +1 -0
  192. package/lib/typescript/src/utils/scalingUtils.d.ts.map +1 -0
  193. package/package.json +13 -27
  194. package/src/NativeComnyx.ts +6 -5
  195. package/src/api/api.ts +14 -4
  196. package/src/api/customers.ts +3 -8
  197. package/src/api/index.ts +1 -1
  198. package/src/components/AppText.tsx +1 -1
  199. package/src/components/ChatList.tsx +1 -1
  200. package/src/components/CustomerForm.tsx +2 -3
  201. package/src/components/MessageInput.tsx +1 -1
  202. package/src/hooks/isRtl.ts +1 -1
  203. package/src/hooks/useLocalize.ts +1 -1
  204. package/src/hooks/usePolling.ts +1 -1
  205. package/src/hooks/useTheme.ts +1 -1
  206. package/src/index.ts +8 -0
  207. package/src/notifications/index.ts +49 -0
  208. package/src/{Accumulator.ts → register/Accumulator.ts} +10 -2
  209. package/src/{collectData.ts → register/collectData.ts} +1 -0
  210. package/src/register/index.ts +11 -0
  211. package/src/register/init.ts +16 -0
  212. package/src/register/login.ts +23 -0
  213. package/src/register/logout.ts +14 -0
  214. package/src/{store.ts → store/store.ts} +7 -7
  215. package/src/{App.tsx → support/ComnyxSupport.tsx} +41 -14
  216. package/src/support/index.ts +1 -0
  217. package/src/utils/scalingUtils.ts +1 -1
  218. package/android/generated/java/com/comnyx/NativeComnyxSpec.java +0 -37
  219. package/ios/Comnyx.h +0 -6
  220. package/ios/Comnyx.mm +0 -18
  221. package/ios/generated/RNComnyxSpec/RNComnyxSpec-generated.mm +0 -39
  222. package/ios/generated/RNComnyxSpec/RNComnyxSpec.h +0 -63
  223. package/ios/generated/RNComnyxSpecJSI-generated.cpp +0 -28
  224. package/ios/generated/RNComnyxSpecJSI.h +0 -71
  225. package/lib/commonjs/Accumulator.js.map +0 -1
  226. package/lib/commonjs/App.js.map +0 -1
  227. package/lib/commonjs/NativeComnyx.ts +0 -8
  228. package/lib/commonjs/__dev__.js +0 -29
  229. package/lib/commonjs/__dev__.js.map +0 -1
  230. package/lib/commonjs/collectData.js.map +0 -1
  231. package/lib/commonjs/components/SizeMatter.js +0 -27
  232. package/lib/commonjs/components/SizeMatter.js.map +0 -1
  233. package/lib/commonjs/package.json +0 -1
  234. package/lib/commonjs/register.js +0 -26
  235. package/lib/commonjs/register.js.map +0 -1
  236. package/lib/commonjs/store.js.map +0 -1
  237. package/lib/commonjs/viewabilityConfig.js.map +0 -1
  238. package/lib/module/Accumulator.js.map +0 -1
  239. package/lib/module/App.js.map +0 -1
  240. package/lib/module/NativeComnyx.ts +0 -8
  241. package/lib/module/__dev__.js +0 -29
  242. package/lib/module/__dev__.js.map +0 -1
  243. package/lib/module/collectData.js.map +0 -1
  244. package/lib/module/components/SizeMatter.js +0 -23
  245. package/lib/module/components/SizeMatter.js.map +0 -1
  246. package/lib/module/package.json +0 -1
  247. package/lib/module/register.js +0 -22
  248. package/lib/module/register.js.map +0 -1
  249. package/lib/module/store.js.map +0 -1
  250. package/lib/module/viewabilityConfig.js.map +0 -1
  251. package/lib/typescript/commonjs/package.json +0 -1
  252. package/lib/typescript/commonjs/src/Accumulator.d.ts.map +0 -1
  253. package/lib/typescript/commonjs/src/App.d.ts +0 -12
  254. package/lib/typescript/commonjs/src/App.d.ts.map +0 -1
  255. package/lib/typescript/commonjs/src/NativeComnyx.d.ts +0 -7
  256. package/lib/typescript/commonjs/src/NativeComnyx.d.ts.map +0 -1
  257. package/lib/typescript/commonjs/src/__dev__.d.ts +0 -2
  258. package/lib/typescript/commonjs/src/__dev__.d.ts.map +0 -1
  259. package/lib/typescript/commonjs/src/api/api.d.ts +0 -4
  260. package/lib/typescript/commonjs/src/api/api.d.ts.map +0 -1
  261. package/lib/typescript/commonjs/src/api/conversations.d.ts.map +0 -1
  262. package/lib/typescript/commonjs/src/api/customers.d.ts +0 -6
  263. package/lib/typescript/commonjs/src/api/customers.d.ts.map +0 -1
  264. package/lib/typescript/commonjs/src/api/index.d.ts.map +0 -1
  265. package/lib/typescript/commonjs/src/api/messages.d.ts.map +0 -1
  266. package/lib/typescript/commonjs/src/collectData.d.ts.map +0 -1
  267. package/lib/typescript/commonjs/src/components/AppText.d.ts.map +0 -1
  268. package/lib/typescript/commonjs/src/components/ChatList.d.ts.map +0 -1
  269. package/lib/typescript/commonjs/src/components/CustomAlert.d.ts.map +0 -1
  270. package/lib/typescript/commonjs/src/components/CustomerForm.d.ts.map +0 -1
  271. package/lib/typescript/commonjs/src/components/EmptyList.d.ts.map +0 -1
  272. package/lib/typescript/commonjs/src/components/InitFailed.d.ts.map +0 -1
  273. package/lib/typescript/commonjs/src/components/MessageInput.d.ts.map +0 -1
  274. package/lib/typescript/commonjs/src/components/MessageItem.d.ts.map +0 -1
  275. package/lib/typescript/commonjs/src/components/ScaledSheet.d.ts.map +0 -1
  276. package/lib/typescript/commonjs/src/components/SizeMatter.d.ts +0 -7
  277. package/lib/typescript/commonjs/src/components/SizeMatter.d.ts.map +0 -1
  278. package/lib/typescript/commonjs/src/constants/activeOpacity.d.ts.map +0 -1
  279. package/lib/typescript/commonjs/src/constants/countries.d.ts.map +0 -1
  280. package/lib/typescript/commonjs/src/constants/rtl.d.ts.map +0 -1
  281. package/lib/typescript/commonjs/src/constants/translations.d.ts.map +0 -1
  282. package/lib/typescript/commonjs/src/data/fake/conversations.d.ts.map +0 -1
  283. package/lib/typescript/commonjs/src/data/fake/customers.d.ts.map +0 -1
  284. package/lib/typescript/commonjs/src/data/fake/messages.d.ts.map +0 -1
  285. package/lib/typescript/commonjs/src/hooks/isRtl.d.ts.map +0 -1
  286. package/lib/typescript/commonjs/src/hooks/useLocalize.d.ts.map +0 -1
  287. package/lib/typescript/commonjs/src/hooks/usePolling.d.ts.map +0 -1
  288. package/lib/typescript/commonjs/src/hooks/useTheme.d.ts.map +0 -1
  289. package/lib/typescript/commonjs/src/hooks/useThemeColors.d.ts.map +0 -1
  290. package/lib/typescript/commonjs/src/index.d.ts +0 -7
  291. package/lib/typescript/commonjs/src/index.d.ts.map +0 -1
  292. package/lib/typescript/commonjs/src/register.d.ts +0 -6
  293. package/lib/typescript/commonjs/src/register.d.ts.map +0 -1
  294. package/lib/typescript/commonjs/src/store.d.ts +0 -40
  295. package/lib/typescript/commonjs/src/store.d.ts.map +0 -1
  296. package/lib/typescript/commonjs/src/types/ApiOptions.d.ts.map +0 -1
  297. package/lib/typescript/commonjs/src/types/Conversation.d.ts.map +0 -1
  298. package/lib/typescript/commonjs/src/types/Customer.d.ts.map +0 -1
  299. package/lib/typescript/commonjs/src/types/GlobalTheme.d.ts.map +0 -1
  300. package/lib/typescript/commonjs/src/types/Language.d.ts.map +0 -1
  301. package/lib/typescript/commonjs/src/types/LocalizationKeys.d.ts.map +0 -1
  302. package/lib/typescript/commonjs/src/types/MessageResponse.d.ts.map +0 -1
  303. package/lib/typescript/commonjs/src/types/Theme.d.ts.map +0 -1
  304. package/lib/typescript/commonjs/src/utils/date.d.ts.map +0 -1
  305. package/lib/typescript/commonjs/src/utils/deepMap.d.ts.map +0 -1
  306. package/lib/typescript/commonjs/src/utils/formatDate.d.ts.map +0 -1
  307. package/lib/typescript/commonjs/src/utils/scalingUtils.d.ts.map +0 -1
  308. package/lib/typescript/commonjs/src/viewabilityConfig.d.ts.map +0 -1
  309. package/lib/typescript/module/package.json +0 -1
  310. package/lib/typescript/module/src/Accumulator.d.ts +0 -18
  311. package/lib/typescript/module/src/Accumulator.d.ts.map +0 -1
  312. package/lib/typescript/module/src/App.d.ts +0 -12
  313. package/lib/typescript/module/src/App.d.ts.map +0 -1
  314. package/lib/typescript/module/src/NativeComnyx.d.ts +0 -7
  315. package/lib/typescript/module/src/NativeComnyx.d.ts.map +0 -1
  316. package/lib/typescript/module/src/__dev__.d.ts +0 -2
  317. package/lib/typescript/module/src/__dev__.d.ts.map +0 -1
  318. package/lib/typescript/module/src/api/api.d.ts +0 -4
  319. package/lib/typescript/module/src/api/api.d.ts.map +0 -1
  320. package/lib/typescript/module/src/api/conversations.d.ts +0 -7
  321. package/lib/typescript/module/src/api/conversations.d.ts.map +0 -1
  322. package/lib/typescript/module/src/api/customers.d.ts +0 -6
  323. package/lib/typescript/module/src/api/customers.d.ts.map +0 -1
  324. package/lib/typescript/module/src/api/index.d.ts +0 -4
  325. package/lib/typescript/module/src/api/index.d.ts.map +0 -1
  326. package/lib/typescript/module/src/api/messages.d.ts +0 -4
  327. package/lib/typescript/module/src/api/messages.d.ts.map +0 -1
  328. package/lib/typescript/module/src/collectData.d.ts +0 -3
  329. package/lib/typescript/module/src/collectData.d.ts.map +0 -1
  330. package/lib/typescript/module/src/components/AppText.d.ts +0 -14
  331. package/lib/typescript/module/src/components/AppText.d.ts.map +0 -1
  332. package/lib/typescript/module/src/components/ChatList.d.ts +0 -4
  333. package/lib/typescript/module/src/components/ChatList.d.ts.map +0 -1
  334. package/lib/typescript/module/src/components/CustomAlert.d.ts +0 -15
  335. package/lib/typescript/module/src/components/CustomAlert.d.ts.map +0 -1
  336. package/lib/typescript/module/src/components/CustomerForm.d.ts +0 -4
  337. package/lib/typescript/module/src/components/CustomerForm.d.ts.map +0 -1
  338. package/lib/typescript/module/src/components/EmptyList.d.ts +0 -2
  339. package/lib/typescript/module/src/components/EmptyList.d.ts.map +0 -1
  340. package/lib/typescript/module/src/components/InitFailed.d.ts +0 -6
  341. package/lib/typescript/module/src/components/InitFailed.d.ts.map +0 -1
  342. package/lib/typescript/module/src/components/MessageInput.d.ts +0 -5
  343. package/lib/typescript/module/src/components/MessageInput.d.ts.map +0 -1
  344. package/lib/typescript/module/src/components/MessageItem.d.ts +0 -6
  345. package/lib/typescript/module/src/components/MessageItem.d.ts.map +0 -1
  346. package/lib/typescript/module/src/components/ScaledSheet.d.ts +0 -2
  347. package/lib/typescript/module/src/components/ScaledSheet.d.ts.map +0 -1
  348. package/lib/typescript/module/src/components/SizeMatter.d.ts +0 -7
  349. package/lib/typescript/module/src/components/SizeMatter.d.ts.map +0 -1
  350. package/lib/typescript/module/src/constants/activeOpacity.d.ts +0 -2
  351. package/lib/typescript/module/src/constants/activeOpacity.d.ts.map +0 -1
  352. package/lib/typescript/module/src/constants/countries.d.ts +0 -7
  353. package/lib/typescript/module/src/constants/countries.d.ts.map +0 -1
  354. package/lib/typescript/module/src/constants/rtl.d.ts +0 -2
  355. package/lib/typescript/module/src/constants/rtl.d.ts.map +0 -1
  356. package/lib/typescript/module/src/constants/translations.d.ts +0 -4
  357. package/lib/typescript/module/src/constants/translations.d.ts.map +0 -1
  358. package/lib/typescript/module/src/data/fake/conversations.d.ts +0 -5
  359. package/lib/typescript/module/src/data/fake/conversations.d.ts.map +0 -1
  360. package/lib/typescript/module/src/data/fake/customers.d.ts +0 -3
  361. package/lib/typescript/module/src/data/fake/customers.d.ts.map +0 -1
  362. package/lib/typescript/module/src/data/fake/messages.d.ts +0 -3
  363. package/lib/typescript/module/src/data/fake/messages.d.ts.map +0 -1
  364. package/lib/typescript/module/src/hooks/isRtl.d.ts +0 -2
  365. package/lib/typescript/module/src/hooks/isRtl.d.ts.map +0 -1
  366. package/lib/typescript/module/src/hooks/useLocalize.d.ts +0 -3
  367. package/lib/typescript/module/src/hooks/useLocalize.d.ts.map +0 -1
  368. package/lib/typescript/module/src/hooks/usePolling.d.ts +0 -2
  369. package/lib/typescript/module/src/hooks/usePolling.d.ts.map +0 -1
  370. package/lib/typescript/module/src/hooks/useTheme.d.ts +0 -3
  371. package/lib/typescript/module/src/hooks/useTheme.d.ts.map +0 -1
  372. package/lib/typescript/module/src/hooks/useThemeColors.d.ts +0 -3
  373. package/lib/typescript/module/src/hooks/useThemeColors.d.ts.map +0 -1
  374. package/lib/typescript/module/src/index.d.ts +0 -7
  375. package/lib/typescript/module/src/index.d.ts.map +0 -1
  376. package/lib/typescript/module/src/register.d.ts +0 -6
  377. package/lib/typescript/module/src/register.d.ts.map +0 -1
  378. package/lib/typescript/module/src/store.d.ts.map +0 -1
  379. package/lib/typescript/module/src/types/ApiOptions.d.ts +0 -4
  380. package/lib/typescript/module/src/types/ApiOptions.d.ts.map +0 -1
  381. package/lib/typescript/module/src/types/Conversation.d.ts +0 -33
  382. package/lib/typescript/module/src/types/Conversation.d.ts.map +0 -1
  383. package/lib/typescript/module/src/types/Customer.d.ts +0 -39
  384. package/lib/typescript/module/src/types/Customer.d.ts.map +0 -1
  385. package/lib/typescript/module/src/types/GlobalTheme.d.ts +0 -6
  386. package/lib/typescript/module/src/types/GlobalTheme.d.ts.map +0 -1
  387. package/lib/typescript/module/src/types/Language.d.ts +0 -2
  388. package/lib/typescript/module/src/types/Language.d.ts.map +0 -1
  389. package/lib/typescript/module/src/types/LocalizationKeys.d.ts +0 -43
  390. package/lib/typescript/module/src/types/LocalizationKeys.d.ts.map +0 -1
  391. package/lib/typescript/module/src/types/MessageResponse.d.ts +0 -61
  392. package/lib/typescript/module/src/types/MessageResponse.d.ts.map +0 -1
  393. package/lib/typescript/module/src/types/Theme.d.ts +0 -28
  394. package/lib/typescript/module/src/types/Theme.d.ts.map +0 -1
  395. package/lib/typescript/module/src/utils/date.d.ts +0 -7
  396. package/lib/typescript/module/src/utils/date.d.ts.map +0 -1
  397. package/lib/typescript/module/src/utils/deepMap.d.ts +0 -7
  398. package/lib/typescript/module/src/utils/deepMap.d.ts.map +0 -1
  399. package/lib/typescript/module/src/utils/formatDate.d.ts +0 -2
  400. package/lib/typescript/module/src/utils/formatDate.d.ts.map +0 -1
  401. package/lib/typescript/module/src/utils/scalingUtils.d.ts +0 -10
  402. package/lib/typescript/module/src/utils/scalingUtils.d.ts.map +0 -1
  403. package/lib/typescript/module/src/viewabilityConfig.d.ts +0 -5
  404. package/lib/typescript/module/src/viewabilityConfig.d.ts.map +0 -1
  405. package/src/__dev__.ts +0 -22
  406. package/src/components/SizeMatter.tsx +0 -22
  407. package/src/index.tsx +0 -9
  408. package/src/register.ts +0 -34
  409. /package/lib/commonjs/{viewabilityConfig.js → constants/viewabilityConfig.js} +0 -0
  410. /package/lib/module/{viewabilityConfig.js → constants/viewabilityConfig.js} +0 -0
  411. /package/lib/typescript/{commonjs/src → src}/api/conversations.d.ts +0 -0
  412. /package/lib/typescript/{commonjs/src → src}/api/messages.d.ts +0 -0
  413. /package/lib/typescript/{commonjs/src → src}/components/AppText.d.ts +0 -0
  414. /package/lib/typescript/{commonjs/src → src}/components/ChatList.d.ts +0 -0
  415. /package/lib/typescript/{commonjs/src → src}/components/CustomAlert.d.ts +0 -0
  416. /package/lib/typescript/{commonjs/src → src}/components/CustomerForm.d.ts +0 -0
  417. /package/lib/typescript/{commonjs/src → src}/components/EmptyList.d.ts +0 -0
  418. /package/lib/typescript/{commonjs/src → src}/components/InitFailed.d.ts +0 -0
  419. /package/lib/typescript/{commonjs/src → src}/components/MessageInput.d.ts +0 -0
  420. /package/lib/typescript/{commonjs/src → src}/components/MessageItem.d.ts +0 -0
  421. /package/lib/typescript/{commonjs/src → src}/components/ScaledSheet.d.ts +0 -0
  422. /package/lib/typescript/{commonjs/src → src}/constants/activeOpacity.d.ts +0 -0
  423. /package/lib/typescript/{commonjs/src → src}/constants/countries.d.ts +0 -0
  424. /package/lib/typescript/{commonjs/src → src}/constants/rtl.d.ts +0 -0
  425. /package/lib/typescript/{commonjs/src → src}/constants/translations.d.ts +0 -0
  426. /package/lib/typescript/{commonjs/src → src/constants}/viewabilityConfig.d.ts +0 -0
  427. /package/lib/typescript/{commonjs/src → src}/data/fake/conversations.d.ts +0 -0
  428. /package/lib/typescript/{commonjs/src → src}/data/fake/customers.d.ts +0 -0
  429. /package/lib/typescript/{commonjs/src → src}/data/fake/messages.d.ts +0 -0
  430. /package/lib/typescript/{commonjs/src → src}/hooks/isRtl.d.ts +0 -0
  431. /package/lib/typescript/{commonjs/src → src}/hooks/useLocalize.d.ts +0 -0
  432. /package/lib/typescript/{commonjs/src → src}/hooks/usePolling.d.ts +0 -0
  433. /package/lib/typescript/{commonjs/src → src}/hooks/useTheme.d.ts +0 -0
  434. /package/lib/typescript/{commonjs/src → src}/hooks/useThemeColors.d.ts +0 -0
  435. /package/lib/typescript/{commonjs/src → src/register}/collectData.d.ts +0 -0
  436. /package/lib/typescript/{commonjs/src → src}/types/ApiOptions.d.ts +0 -0
  437. /package/lib/typescript/{commonjs/src → src}/types/Conversation.d.ts +0 -0
  438. /package/lib/typescript/{commonjs/src → src}/types/Customer.d.ts +0 -0
  439. /package/lib/typescript/{commonjs/src → src}/types/GlobalTheme.d.ts +0 -0
  440. /package/lib/typescript/{commonjs/src → src}/types/Language.d.ts +0 -0
  441. /package/lib/typescript/{commonjs/src → src}/types/LocalizationKeys.d.ts +0 -0
  442. /package/lib/typescript/{commonjs/src → src}/types/MessageResponse.d.ts +0 -0
  443. /package/lib/typescript/{commonjs/src → src}/types/Theme.d.ts +0 -0
  444. /package/lib/typescript/{commonjs/src → src}/utils/date.d.ts +0 -0
  445. /package/lib/typescript/{commonjs/src → src}/utils/deepMap.d.ts +0 -0
  446. /package/lib/typescript/{commonjs/src → src}/utils/formatDate.d.ts +0 -0
  447. /package/lib/typescript/{commonjs/src → src}/utils/scalingUtils.d.ts +0 -0
  448. /package/src/{viewabilityConfig.ts → constants/viewabilityConfig.ts} +0 -0
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@developer_tribe/react-native-comnyx",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "React Native chat component with integrated support panel, enabling real-time customer communication and efficient agent workflow management.",
5
- "source": "./src/index.tsx",
5
+ "source": "./src/index.ts",
6
6
  "main": "./lib/commonjs/index.js",
7
7
  "module": "./lib/module/index.js",
8
+ "types": "./lib/typescript/src/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
11
  "import": {
@@ -25,6 +26,7 @@
25
26
  "cpp",
26
27
  "*.podspec",
27
28
  "react-native.config.js",
29
+ "!server-scripts",
28
30
  "!ios/build",
29
31
  "!android/build",
30
32
  "!android/gradle",
@@ -37,7 +39,7 @@
37
39
  "!**/.*"
38
40
  ],
39
41
  "scripts": {
40
- "test": "jest",
42
+ "test": "jest --config jest.config.ts",
41
43
  "typecheck": "tsc",
42
44
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
43
45
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
@@ -69,9 +71,10 @@
69
71
  "@react-native-community/cli": "15.0.1",
70
72
  "@react-native/eslint-config": "^0.73.1",
71
73
  "@release-it/conventional-changelog": "^9.0.2",
74
+ "@testing-library/react-native": "^13.2.0",
72
75
  "@types/jest": "^29.5.5",
73
76
  "@types/react": "^18.2.44",
74
- "axios": "1.7.9",
77
+ "axios": "1.9.0",
75
78
  "commitlint": "^19.6.1",
76
79
  "del-cli": "^5.1.0",
77
80
  "eslint": "^8.51.0",
@@ -81,9 +84,11 @@
81
84
  "prettier": "^3.0.3",
82
85
  "react": "19.0.0",
83
86
  "react-native": "0.78.1",
84
- "react-native-builder-bob": "^0.38.3",
87
+ "react-native-builder-bob": "^0.33.1",
88
+ "react-test-renderer": "^19.0.0",
85
89
  "release-it": "^17.10.0",
86
- "turbo": "^1.10.7",
90
+ "ts-jest": "^29.3.4",
91
+ "ts-node": "^10.9.2",
87
92
  "typescript": "5.1.6",
88
93
  "use-sync-external-store": "^1.5.0",
89
94
  "zustand": "^5.0.3"
@@ -96,7 +101,6 @@
96
101
  "react": "*",
97
102
  "react-native": "*"
98
103
  },
99
- "packageManager": "yarn@3.6.1",
100
104
  "jest": {
101
105
  "preset": "react-native",
102
106
  "modulePathIgnorePatterns": [
@@ -163,7 +167,6 @@
163
167
  "source": "src",
164
168
  "output": "lib",
165
169
  "targets": [
166
- "codegen",
167
170
  [
168
171
  "commonjs",
169
172
  {
@@ -184,28 +187,11 @@
184
187
  ]
185
188
  ]
186
189
  },
187
- "codegenConfig": {
188
- "name": "RNComnyxSpec",
189
- "type": "modules",
190
- "jsSrcsDir": "src",
191
- "outputDir": {
192
- "ios": "ios/generated",
193
- "android": "android/generated"
194
- },
195
- "android": {
196
- "javaPackageName": "com.comnyx"
197
- },
198
- "includesGeneratedCode": true
199
- },
200
- "create-react-native-library": {
201
- "type": "turbo-module",
202
- "languages": "kotlin-objc",
203
- "version": "0.48.6"
204
- },
205
190
  "engines": {
206
191
  "node": ">=18.0.0"
207
192
  },
208
193
  "dependencies": {
209
194
  "react-hook-form": "^7.55.0"
210
- }
195
+ },
196
+ "packageManager": "yarn@1.22.19"
211
197
  }
@@ -1,8 +1,9 @@
1
- import type { TurboModule } from 'react-native';
2
- import { TurboModuleRegistry } from 'react-native';
1
+ import { NativeModules } from 'react-native';
3
2
 
4
- export interface Spec extends TurboModule {
5
- multiply(a: number, b: number): number;
3
+ export interface NativeComnyx {
4
+ initialize(): Promise<boolean>;
5
+ checkOptIn(): Promise<boolean>;
6
+ optIn(): Promise<boolean>;
6
7
  }
7
8
 
8
- export default TurboModuleRegistry.getEnforcing<Spec>('Comnyx');
9
+ export const nativeComnyx = NativeModules.Comnyx as NativeComnyx;
package/src/api/api.ts CHANGED
@@ -1,18 +1,28 @@
1
1
  import axios from 'axios';
2
2
  const axiosInstance = axios.create({
3
- //baseURL: 'https://api.comnyx.com',
4
- baseURL: 'https://stage.comnyx.com',
3
+ baseURL: 'https://api.comnyx.com',
5
4
  headers: {
6
5
  'Content-Type': 'application/json',
7
6
  },
8
7
  timeout: 1000,
9
8
  });
10
9
 
11
- export function initApi(token: string, externalId: string, baseURL: string) {
10
+ export function isInitCalled() {
11
+ return !!axiosInstance.defaults.headers.common.Authorization;
12
+ }
13
+
14
+ export function initApi(token: string, baseURL?: string) {
12
15
  axiosInstance.defaults.headers.common['Content-Type'] = 'application/json';
13
16
  axiosInstance.defaults.headers.common.Authorization = 'Bearer ' + token;
14
- axiosInstance.defaults.headers.common['external-id'] = externalId;
15
17
  axiosInstance.defaults.baseURL = baseURL || axiosInstance.defaults.baseURL;
16
18
  }
17
19
 
20
+ export function setLoginForAxios(externalId: string) {
21
+ axiosInstance.defaults.headers.common['external-id'] = externalId;
22
+ }
23
+
24
+ export function setLogoutForAxios() {
25
+ axiosInstance.defaults.headers.common['external-id'] = null;
26
+ }
27
+
18
28
  export { axiosInstance };
@@ -1,16 +1,11 @@
1
1
  import type { CreateCustomerRequest, Customer } from '../types/Customer';
2
- import type { ApiOptions } from '../types/ApiOptions';
3
- import { getFakeCustomer } from '../data/fake/customers';
4
2
  import { axiosInstance } from './api';
5
3
 
6
- export function createCustomer(
4
+ // NOTE: This is not a REST API endpoint. Data is collected with debounce and sent to the server at an appropriate time.
5
+ export function updateCustomer(
7
6
  customerData: CreateCustomerRequest,
8
- options: ApiOptions,
9
- externalId: string
7
+ externalId?: string
10
8
  ): Promise<{ customer: Customer }> {
11
- if (options.fake) {
12
- return Promise.resolve({ customer: getFakeCustomer(customerData) });
13
- }
14
9
  console.info('[Comnyx] Adding customer info');
15
10
  return axiosInstance
16
11
  .post('/api/customers/create', customerData, {
package/src/api/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { createCustomer } from './customers';
1
+ export { updateCustomer as createCustomer } from './customers';
2
2
  export {
3
3
  getCustomerConversation,
4
4
  getNewCustomerConversation,
@@ -1,10 +1,10 @@
1
1
  import { Text } from 'react-native';
2
2
  import type { TextProps } from 'react-native';
3
3
  import { LocalizationList } from '../constants/translations';
4
- import { useAppStore } from '../store';
5
4
  import { useThemeColors } from '../hooks/useThemeColors';
6
5
  import type { LocalizationKeys } from '../types/LocalizationKeys';
7
6
  import { useGlobalTheme } from '../hooks/useTheme';
7
+ import { useAppStore } from '../store/store';
8
8
 
9
9
  export type FamilyWeight = Record<Weight, string | undefined>;
10
10
 
@@ -1,5 +1,4 @@
1
1
  import { useCallback, useEffect, useRef, useState, useMemo } from 'react';
2
- import { useAppStore } from '../store';
3
2
  import {
4
3
  SectionList,
5
4
  View,
@@ -23,6 +22,7 @@ import type { LocalizationKeys } from '../types/LocalizationKeys';
23
22
  import { ScaledSheet } from './ScaledSheet';
24
23
  import { formatDate } from '../utils/formatDate';
25
24
  import { activeOpacity } from '../constants/activeOpacity';
25
+ import { useAppStore } from '../store/store';
26
26
 
27
27
  const headphonesIcon = require('../assets/headphones-01.png');
28
28
  const closeIcon = require('../assets/x-close.png');
@@ -9,7 +9,6 @@ import {
9
9
  ActivityIndicator,
10
10
  } from 'react-native';
11
11
  import { useForm, Controller } from 'react-hook-form';
12
- import { useAppStore } from '../store';
13
12
  import { createCustomer } from '../api';
14
13
  import { AppText } from './AppText';
15
14
  import { useLocalize } from '../hooks/useLocalize';
@@ -19,7 +18,8 @@ import { useEffect, useState } from 'react';
19
18
  import { ScaledSheet } from './ScaledSheet';
20
19
  import type { LocalizationKeys } from '../types/LocalizationKeys';
21
20
  import { activeOpacity } from '../constants/activeOpacity';
22
- import { accumulator } from '../Accumulator';
21
+ import { accumulator } from '../register/Accumulator';
22
+ import { useAppStore } from '../store/store';
23
23
 
24
24
  interface CustomerFormData {
25
25
  name: string;
@@ -78,7 +78,6 @@ export function CustomerForm({ onBack }: { onBack: () => void }) {
78
78
  language: 'en',
79
79
  customParameters: [],
80
80
  },
81
- { fake: useAppStore.getState().fake },
82
81
  useAppStore.getState().customer?.external_id ?? ''
83
82
  );
84
83
  if (res) {
@@ -1,5 +1,4 @@
1
1
  import { TextInput, View, Image, TouchableOpacity } from 'react-native';
2
- import { useAppStore } from '../store';
3
2
  import { useState } from 'react';
4
3
  import { sendCustomerMessage } from '../api';
5
4
  import { useThemeColors } from '../hooks/useThemeColors';
@@ -7,6 +6,7 @@ import { ScaledSheet } from './ScaledSheet';
7
6
  import { useLocalize } from '../hooks/useLocalize';
8
7
  import { activeOpacity } from '../constants/activeOpacity';
9
8
  import { useIsRtl } from '../hooks/isRtl';
9
+ import { useAppStore } from '../store/store';
10
10
 
11
11
  const sendDark = require('../assets/arrow-right.png');
12
12
 
@@ -1,5 +1,5 @@
1
1
  import { rtlLanguages } from '../constants/rtl';
2
- import { useAppStore } from '../store';
2
+ import { useAppStore } from '../store/store';
3
3
 
4
4
  export const useIsRtl = () => {
5
5
  const language = useAppStore((s) => s.language);
@@ -1,7 +1,7 @@
1
1
  import { useCallback } from 'react';
2
2
  import { LocalizationList } from '../constants/translations';
3
- import { useAppStore } from '../store';
4
3
  import type { LocalizationKeys } from '../types/LocalizationKeys';
4
+ import { useAppStore } from '../store/store';
5
5
 
6
6
  export function useLocalize() {
7
7
  const { language } = useAppStore((s) => ({
@@ -1,6 +1,6 @@
1
1
  import { useEffect } from 'react';
2
- import { useAppStore } from '../store';
3
2
  import { getNewCustomerConversation } from '../api';
3
+ import { useAppStore } from '../store/store';
4
4
 
5
5
  const NEW_MESSAGES_CHECK_INTERVAL = 10000;
6
6
 
@@ -1,5 +1,5 @@
1
- import { useAppStore } from '../store';
2
1
  import type { GlobalTheme } from '../types/GlobalTheme';
2
+ import { useAppStore } from '../store/store';
3
3
 
4
4
  export function useGlobalTheme(): Required<GlobalTheme> {
5
5
  const themes = useAppStore((s) => s.themes);
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ export { Comnyx } from './register';
2
+ export { ComnyxSupport } from './support';
3
+ export { ComnyxNotifications } from './notifications';
4
+
5
+ //types
6
+
7
+ //deprecated
8
+ export { registerOneSignalForComnyx } from './register/collectData';
@@ -0,0 +1,49 @@
1
+ import { Platform, type EmitterSubscription } from 'react-native';
2
+ import { NativeEventEmitter } from 'react-native';
3
+ import { NativeModules } from 'react-native';
4
+ import { nativeComnyx, type NativeComnyx } from '../NativeComnyx';
5
+
6
+ const comnyxEmitter =
7
+ Platform.OS === 'android'
8
+ ? new NativeEventEmitter() //TODO2: fix
9
+ : new NativeEventEmitter(NativeModules.Comnyx);
10
+
11
+ type ComnyxNotificationsEventType =
12
+ | 'TOKEN_INIT'
13
+ | 'TOKEN_FAILED'
14
+ | 'NOTIFICATION_RECEIVED'
15
+ | 'NOTIFICATION_CLICKED';
16
+
17
+ type ComnyxNotificationsEventResult = {
18
+ TOKEN_INIT: {
19
+ type: string;
20
+ token: string;
21
+ };
22
+ TOKEN_FAILED: {
23
+ type: string;
24
+ token: null;
25
+ };
26
+ NOTIFICATION_RECEIVED: unknown;
27
+ NOTIFICATION_CLICKED: unknown;
28
+ };
29
+
30
+ interface ComnyxNotificationsType extends NativeComnyx {
31
+ addEventListener<T extends ComnyxNotificationsEventType>(
32
+ event: T,
33
+ listener: (event: ComnyxNotificationsEventResult[T]) => void
34
+ ): EmitterSubscription;
35
+ }
36
+
37
+ export const ComnyxNotifications: ComnyxNotificationsType = {
38
+ initialize: nativeComnyx.initialize,
39
+ optIn: nativeComnyx.optIn,
40
+ checkOptIn: nativeComnyx.checkOptIn,
41
+ addEventListener: function <T extends ComnyxNotificationsEventType>(
42
+ eventType: T,
43
+ listener: (event: ComnyxNotificationsEventResult[T]) => void
44
+ ): EmitterSubscription {
45
+ return comnyxEmitter.addListener(eventType, (event) => {
46
+ listener(event);
47
+ });
48
+ },
49
+ };
@@ -1,8 +1,8 @@
1
- import type { CreateCustomerRequest } from './types/Customer';
1
+ import type { CreateCustomerRequest } from '../types/Customer';
2
2
 
3
3
  const ACCUMULATOR_DEBOUNCE_TIME_IN_MS = 3000;
4
4
 
5
- class Accumulator {
5
+ export class Accumulator {
6
6
  private registerData: CreateCustomerRequest | null = null;
7
7
  private __select_time: NodeJS.Timeout | undefined = undefined;
8
8
  private listener: ((data: CreateCustomerRequest) => Promise<void>) | null =
@@ -95,6 +95,14 @@ class Accumulator {
95
95
  }
96
96
  }
97
97
 
98
+ clear() {
99
+ this.registerData = null;
100
+ }
101
+
102
+ empty() {
103
+ this.registerData = {};
104
+ }
105
+
98
106
  get() {
99
107
  return this.registerData;
100
108
  }
@@ -11,6 +11,7 @@ export function collectData(key: string, value: string) {
11
11
  });
12
12
  }
13
13
 
14
+ //* @deprecated
14
15
  export function registerOneSignalForComnyx(external_id: string) {
15
16
  accumulator.add({
16
17
  integrationParameters: {
@@ -0,0 +1,11 @@
1
+ import { login } from './login';
2
+ import { collectData } from './collectData';
3
+ import { logout } from './logout';
4
+ import { init } from './init';
5
+
6
+ export const Comnyx = {
7
+ init: init,
8
+ login: login,
9
+ logout: logout,
10
+ collectData: collectData,
11
+ };
@@ -0,0 +1,16 @@
1
+ import { initApi } from '../api/api';
2
+
3
+ interface InitOptions {
4
+ token: string;
5
+ }
6
+
7
+ interface ExtendedInitOptions extends InitOptions {
8
+ baseURL?: string;
9
+ }
10
+
11
+ export function init(initOptions: InitOptions) {
12
+ if (!initOptions.token) {
13
+ throw new Error('App token is required');
14
+ }
15
+ initApi(initOptions.token, (initOptions as ExtendedInitOptions).baseURL);
16
+ }
@@ -0,0 +1,23 @@
1
+ import { accumulator } from './Accumulator';
2
+ import { isInitCalled, setLoginForAxios } from '../api/api';
3
+ import type { CreateCustomerRequest } from '../types/Customer';
4
+ import { useAppStore } from '../store/store';
5
+ import { updateCustomer } from '../api/customers';
6
+
7
+ interface LoginOptions {
8
+ externalId: string;
9
+ }
10
+
11
+ export function login(loginOptions: LoginOptions) {
12
+ if (!isInitCalled()) {
13
+ throw new Error('Please initialize the Comnyx SDK first');
14
+ }
15
+ if (!loginOptions.externalId) {
16
+ throw new Error('External ID is required for initialization');
17
+ }
18
+ accumulator.register(async (accumulatedData: CreateCustomerRequest) => {
19
+ const data = await updateCustomer(accumulatedData, loginOptions.externalId);
20
+ setLoginForAxios(loginOptions.externalId);
21
+ useAppStore.getState().setCustomer(data.customer);
22
+ });
23
+ }
@@ -0,0 +1,14 @@
1
+ import { setLogoutForAxios } from '../api/api';
2
+ import { useAppStore } from '../store/store';
3
+ import { accumulator } from './Accumulator';
4
+
5
+ export async function logout() {
6
+ accumulator.empty();
7
+ await accumulator.flush();
8
+ setLogoutForAxios();
9
+ //TODO: state
10
+ useAppStore.setState({
11
+ customer: null,
12
+ formSubmitted: false,
13
+ });
14
+ }
@@ -3,9 +3,9 @@ import { shallow } from 'zustand/shallow';
3
3
  import { createWithEqualityFn } from 'zustand/traditional';
4
4
  import type { StateCreator } from 'zustand';
5
5
  import AsyncStorage from '@react-native-async-storage/async-storage';
6
- import type { Customer } from './types/Customer';
7
- import type { AppConversationMessage } from './types/Conversation';
8
- import type { LanguageCode } from './types/Language';
6
+ import type { AppConversationMessage } from '../types/Conversation';
7
+ import type { LanguageCode } from '../types/Language';
8
+ import type { Customer } from '../types/Customer';
9
9
 
10
10
  interface AppStoreState {
11
11
  baseHeight: number;
@@ -23,7 +23,7 @@ interface AppStoreState {
23
23
  ) => AppConversationMessage[] | null
24
24
  ) => void;
25
25
  setFirstMessage: (message: AppConversationMessage | null) => void;
26
- setCustomer: (createCustomerResponse: Customer) => void;
26
+ setCustomer: (createCustomerResponse: Customer | null) => void;
27
27
  setLanguage: (language: LanguageCode) => void;
28
28
  setTheme: (theme: 'light' | 'dark') => void;
29
29
  setFake: (fake: boolean) => void;
@@ -36,7 +36,7 @@ interface AppStoreState {
36
36
  setForm: (form: Customer) => void;
37
37
  }
38
38
 
39
- const storeCreator: StateCreator<AppStoreState> = (set, get) => ({
39
+ export const storeCreator: StateCreator<AppStoreState> = (set, get) => ({
40
40
  baseWidth: 390,
41
41
  baseHeight: 844,
42
42
  initialized: false,
@@ -55,10 +55,10 @@ const storeCreator: StateCreator<AppStoreState> = (set, get) => ({
55
55
  setFirstMessage: (message) => {
56
56
  set({ firstMessage: message });
57
57
  },
58
- setCustomer: (createCustomerResponse: Customer) => {
58
+ setCustomer: (createCustomerResponse: Customer | null) => {
59
59
  set({
60
60
  customer: createCustomerResponse,
61
- formSubmitted: !!createCustomerResponse.name,
61
+ formSubmitted: !!createCustomerResponse?.name,
62
62
  });
63
63
  },
64
64
  setLanguage: (language: LanguageCode) => {
@@ -1,14 +1,16 @@
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';
1
+ import { View, TouchableOpacity, Image } from 'react-native';
2
+ import { ChatList } from '../components/ChatList';
3
+ import { CustomerForm } from '../components/CustomerForm';
4
+ import type { LanguageCode } from '../types/Language';
6
5
  import { useEffect } from 'react';
7
- import { AppText } from './components/AppText';
8
- import { useThemeColors } from './hooks/useThemeColors';
9
- import { usePolling } from './hooks/usePolling';
6
+ import { AppText } from '../components/AppText';
7
+ import { useThemeColors } from '../hooks/useThemeColors';
8
+ import { usePolling } from '../hooks/usePolling';
9
+ import { useAppStore } from '../store/store';
10
+ import { ScaledSheet } from '../components/ScaledSheet';
11
+ const closeIcon = require('../assets/x-close.png');
10
12
 
11
- interface ComnyxProps {
13
+ interface SupportComnyxProps {
12
14
  language?: LanguageCode;
13
15
  theme?: 'light' | 'dark';
14
16
  fake?: boolean;
@@ -17,13 +19,13 @@ interface ComnyxProps {
17
19
  rtlFix?: boolean;
18
20
  }
19
21
 
20
- export function Comnyx({
22
+ export function ComnyxSupport({
21
23
  language = 'en',
22
24
  theme = 'dark',
23
25
  fake = false,
24
26
  onBack,
25
27
  themes,
26
- }: ComnyxProps) {
28
+ }: SupportComnyxProps) {
27
29
  const { customer, formSubmitted } = useAppStore((s) => ({
28
30
  customer: s.customer,
29
31
  formSubmitted: s.formSubmitted,
@@ -51,9 +53,25 @@ export function Comnyx({
51
53
  //NOTE: customer yoksa register hiç çalışmamış
52
54
  return (
53
55
  <View
54
- style={[styles.container, { backgroundColor: themeColors.background }]}
56
+ style={[
57
+ styles.container,
58
+ { backgroundColor: themeColors.background, justifyContent: 'center' },
59
+ ]}
55
60
  >
56
- <AppText localization="app.initialization.required" />
61
+ <TouchableOpacity
62
+ activeOpacity={1}
63
+ style={[styles.iconContainer]}
64
+ onPress={onBack}
65
+ >
66
+ <Image
67
+ source={closeIcon}
68
+ style={[styles.closeIcon, { tintColor: themeColors.text }]}
69
+ />
70
+ </TouchableOpacity>
71
+ <AppText
72
+ style={{ textAlign: 'center' }}
73
+ localization="app.initialization.required"
74
+ />
57
75
  </View>
58
76
  );
59
77
  } else if (!formSubmitted) {
@@ -70,8 +88,17 @@ export function Comnyx({
70
88
  );
71
89
  }
72
90
 
73
- const styles = StyleSheet.create({
91
+ const styles = ScaledSheet.create({
74
92
  container: {
75
93
  flex: 1,
76
94
  },
95
+ iconContainer: {
96
+ position: 'absolute',
97
+ top: '60@vs',
98
+ left: '24@s',
99
+ },
100
+ closeIcon: {
101
+ width: '24@vs',
102
+ height: '24@vs',
103
+ },
77
104
  });
@@ -0,0 +1 @@
1
+ export { ComnyxSupport } from './ComnyxSupport';
@@ -1,5 +1,5 @@
1
1
  import { Dimensions } from 'react-native';
2
- import { useAppStore } from '../store';
2
+ import { useAppStore } from '../store/store';
3
3
 
4
4
  const { width, height } = Dimensions.get('window');
5
5
  const [shortDimension, longDimension] =
@@ -1,37 +0,0 @@
1
-
2
- /**
3
- * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
4
- *
5
- * Do not edit this file as changes may cause incorrect behavior and will be lost
6
- * once the code is regenerated.
7
- *
8
- * @generated by codegen project: GenerateModuleJavaSpec.js
9
- *
10
- * @nolint
11
- */
12
-
13
- package com.comnyx;
14
-
15
- import com.facebook.proguard.annotations.DoNotStrip;
16
- import com.facebook.react.bridge.ReactApplicationContext;
17
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
18
- import com.facebook.react.bridge.ReactMethod;
19
- import com.facebook.react.turbomodule.core.interfaces.TurboModule;
20
- import javax.annotation.Nonnull;
21
-
22
- public abstract class NativeComnyxSpec extends ReactContextBaseJavaModule implements TurboModule {
23
- public static final String NAME = "Comnyx";
24
-
25
- public NativeComnyxSpec(ReactApplicationContext reactContext) {
26
- super(reactContext);
27
- }
28
-
29
- @Override
30
- public @Nonnull String getName() {
31
- return NAME;
32
- }
33
-
34
- @ReactMethod(isBlockingSynchronousMethod = true)
35
- @DoNotStrip
36
- public abstract double multiply(double a, double b);
37
- }
package/ios/Comnyx.h DELETED
@@ -1,6 +0,0 @@
1
-
2
- #import "generated/RNComnyxSpec/RNComnyxSpec.h"
3
-
4
- @interface Comnyx : NSObject <NativeComnyxSpec>
5
-
6
- @end
package/ios/Comnyx.mm DELETED
@@ -1,18 +0,0 @@
1
- #import "Comnyx.h"
2
-
3
- @implementation Comnyx
4
- RCT_EXPORT_MODULE()
5
-
6
- - (NSNumber *)multiply:(double)a b:(double)b {
7
- NSNumber *result = @(a * b);
8
-
9
- return result;
10
- }
11
-
12
- - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
13
- (const facebook::react::ObjCTurboModule::InitParams &)params
14
- {
15
- return std::make_shared<facebook::react::NativeComnyxSpecJSI>(params);
16
- }
17
-
18
- @end