rn-erxes-sdk 0.1.23 → 0.1.25

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 (248) hide show
  1. package/README.md +322 -24
  2. package/lib/commonjs/App.js +7 -6
  3. package/lib/commonjs/App.js.map +1 -1
  4. package/lib/commonjs/Widget.js +154 -29
  5. package/lib/commonjs/Widget.js.map +1 -1
  6. package/lib/commonjs/assets/images/index.js +1 -1
  7. package/lib/commonjs/assets/images/index.js.map +1 -1
  8. package/lib/commonjs/assets/images/x.png +0 -0
  9. package/lib/commonjs/components/Avatar.js +24 -27
  10. package/lib/commonjs/components/Avatar.js.map +1 -1
  11. package/lib/commonjs/components/AvatarWithStatus.js +56 -0
  12. package/lib/commonjs/components/AvatarWithStatus.js.map +1 -0
  13. package/lib/commonjs/components/ConversationItem.js +161 -0
  14. package/lib/commonjs/components/ConversationItem.js.map +1 -0
  15. package/lib/commonjs/components/Icons.js +558 -0
  16. package/lib/commonjs/components/Icons.js.map +1 -0
  17. package/lib/commonjs/components/InputTools.js +329 -38
  18. package/lib/commonjs/components/InputTools.js.map +1 -1
  19. package/lib/commonjs/components/MessengerShell.js +64 -0
  20. package/lib/commonjs/components/MessengerShell.js.map +1 -0
  21. package/lib/commonjs/components/conversation/DateSeparator.js +47 -0
  22. package/lib/commonjs/components/conversation/DateSeparator.js.map +1 -0
  23. package/lib/commonjs/components/conversation/EmojiPicker.js +62 -0
  24. package/lib/commonjs/components/conversation/EmojiPicker.js.map +1 -0
  25. package/lib/commonjs/components/conversation/PersistentMenu.js +64 -0
  26. package/lib/commonjs/components/conversation/PersistentMenu.js.map +1 -0
  27. package/lib/commonjs/components/conversation/TypingStatus.js +122 -0
  28. package/lib/commonjs/components/conversation/TypingStatus.js.map +1 -0
  29. package/lib/commonjs/components/conversation/WelcomeMessage.js +85 -0
  30. package/lib/commonjs/components/conversation/WelcomeMessage.js.map +1 -0
  31. package/lib/commonjs/components/nav/Navigation.js +130 -0
  32. package/lib/commonjs/components/nav/Navigation.js.map +1 -0
  33. package/lib/commonjs/components/nav/constants.js +23 -0
  34. package/lib/commonjs/components/nav/constants.js.map +1 -0
  35. package/lib/commonjs/graphql/ApolloContainer.js +1 -2
  36. package/lib/commonjs/graphql/ApolloContainer.js.map +1 -1
  37. package/lib/commonjs/graphql/mutation.js +58 -23
  38. package/lib/commonjs/graphql/mutation.js.map +1 -1
  39. package/lib/commonjs/graphql/query.js +85 -55
  40. package/lib/commonjs/graphql/query.js.map +1 -1
  41. package/lib/commonjs/graphql/subscription.js +32 -28
  42. package/lib/commonjs/graphql/subscription.js.map +1 -1
  43. package/lib/commonjs/screen/conversation/Attachment.js +77 -12
  44. package/lib/commonjs/screen/conversation/Attachment.js.map +1 -1
  45. package/lib/commonjs/screen/conversation/ConversationDetail.js +305 -137
  46. package/lib/commonjs/screen/conversation/ConversationDetail.js.map +1 -1
  47. package/lib/commonjs/screen/conversation/Message.js +145 -82
  48. package/lib/commonjs/screen/conversation/Message.js.map +1 -1
  49. package/lib/commonjs/screen/faq/Faq.js +373 -0
  50. package/lib/commonjs/screen/faq/Faq.js.map +1 -0
  51. package/lib/commonjs/screen/greetings/Social.js +19 -9
  52. package/lib/commonjs/screen/greetings/Social.js.map +1 -1
  53. package/lib/commonjs/screen/greetings/Supporters.js +49 -46
  54. package/lib/commonjs/screen/greetings/Supporters.js.map +1 -1
  55. package/lib/commonjs/screen/home/Home.js +303 -0
  56. package/lib/commonjs/screen/home/Home.js.map +1 -0
  57. package/lib/commonjs/screen/messages/Messages.js +312 -0
  58. package/lib/commonjs/screen/messages/Messages.js.map +1 -0
  59. package/lib/commonjs/theme.js +132 -0
  60. package/lib/commonjs/theme.js.map +1 -0
  61. package/lib/commonjs/utils/messages.js +93 -0
  62. package/lib/commonjs/utils/messages.js.map +1 -0
  63. package/lib/commonjs/utils/objectId.js +61 -0
  64. package/lib/commonjs/utils/objectId.js.map +1 -0
  65. package/lib/commonjs/utils/onlineHours.js +127 -0
  66. package/lib/commonjs/utils/onlineHours.js.map +1 -0
  67. package/lib/commonjs/utils/upload.js +245 -0
  68. package/lib/commonjs/utils/upload.js.map +1 -0
  69. package/lib/module/App.js +7 -6
  70. package/lib/module/App.js.map +1 -1
  71. package/lib/module/Widget.js +157 -32
  72. package/lib/module/Widget.js.map +1 -1
  73. package/lib/module/assets/images/index.js +1 -1
  74. package/lib/module/assets/images/index.js.map +1 -1
  75. package/lib/module/assets/images/x.png +0 -0
  76. package/lib/module/components/Avatar.js +25 -28
  77. package/lib/module/components/Avatar.js.map +1 -1
  78. package/lib/module/components/AvatarWithStatus.js +47 -0
  79. package/lib/module/components/AvatarWithStatus.js.map +1 -0
  80. package/lib/module/components/ConversationItem.js +153 -0
  81. package/lib/module/components/ConversationItem.js.map +1 -0
  82. package/lib/module/components/Icons.js +537 -0
  83. package/lib/module/components/Icons.js.map +1 -0
  84. package/lib/module/components/InputTools.js +331 -39
  85. package/lib/module/components/InputTools.js.map +1 -1
  86. package/lib/module/components/MessengerShell.js +55 -0
  87. package/lib/module/components/MessengerShell.js.map +1 -0
  88. package/lib/module/components/conversation/DateSeparator.js +40 -0
  89. package/lib/module/components/conversation/DateSeparator.js.map +1 -0
  90. package/lib/module/components/conversation/EmojiPicker.js +55 -0
  91. package/lib/module/components/conversation/EmojiPicker.js.map +1 -0
  92. package/lib/module/components/conversation/PersistentMenu.js +57 -0
  93. package/lib/module/components/conversation/PersistentMenu.js.map +1 -0
  94. package/lib/module/components/conversation/TypingStatus.js +113 -0
  95. package/lib/module/components/conversation/TypingStatus.js.map +1 -0
  96. package/lib/module/components/conversation/WelcomeMessage.js +76 -0
  97. package/lib/module/components/conversation/WelcomeMessage.js.map +1 -0
  98. package/lib/module/components/nav/Navigation.js +121 -0
  99. package/lib/module/components/nav/Navigation.js.map +1 -0
  100. package/lib/module/components/nav/constants.js +16 -0
  101. package/lib/module/components/nav/constants.js.map +1 -0
  102. package/lib/module/graphql/ApolloContainer.js +1 -2
  103. package/lib/module/graphql/ApolloContainer.js.map +1 -1
  104. package/lib/module/graphql/mutation.js +57 -23
  105. package/lib/module/graphql/mutation.js.map +1 -1
  106. package/lib/module/graphql/query.js +83 -52
  107. package/lib/module/graphql/query.js.map +1 -1
  108. package/lib/module/graphql/subscription.js +31 -28
  109. package/lib/module/graphql/subscription.js.map +1 -1
  110. package/lib/module/screen/conversation/Attachment.js +79 -14
  111. package/lib/module/screen/conversation/Attachment.js.map +1 -1
  112. package/lib/module/screen/conversation/ConversationDetail.js +309 -140
  113. package/lib/module/screen/conversation/ConversationDetail.js.map +1 -1
  114. package/lib/module/screen/conversation/Message.js +145 -82
  115. package/lib/module/screen/conversation/Message.js.map +1 -1
  116. package/lib/module/screen/faq/Faq.js +363 -0
  117. package/lib/module/screen/faq/Faq.js.map +1 -0
  118. package/lib/module/screen/greetings/Social.js +19 -9
  119. package/lib/module/screen/greetings/Social.js.map +1 -1
  120. package/lib/module/screen/greetings/Supporters.js +50 -46
  121. package/lib/module/screen/greetings/Supporters.js.map +1 -1
  122. package/lib/module/screen/home/Home.js +293 -0
  123. package/lib/module/screen/home/Home.js.map +1 -0
  124. package/lib/module/screen/messages/Messages.js +303 -0
  125. package/lib/module/screen/messages/Messages.js.map +1 -0
  126. package/lib/module/theme.js +122 -0
  127. package/lib/module/theme.js.map +1 -0
  128. package/lib/module/utils/messages.js +81 -0
  129. package/lib/module/utils/messages.js.map +1 -0
  130. package/lib/module/utils/objectId.js +53 -0
  131. package/lib/module/utils/objectId.js.map +1 -0
  132. package/lib/module/utils/onlineHours.js +118 -0
  133. package/lib/module/utils/onlineHours.js.map +1 -0
  134. package/lib/module/utils/upload.js +233 -0
  135. package/lib/module/utils/upload.js.map +1 -0
  136. package/lib/typescript/App.d.ts +2 -1
  137. package/lib/typescript/App.d.ts.map +1 -1
  138. package/lib/typescript/Widget.d.ts.map +1 -1
  139. package/lib/typescript/components/Avatar.d.ts +7 -1
  140. package/lib/typescript/components/Avatar.d.ts.map +1 -1
  141. package/lib/typescript/components/AvatarWithStatus.d.ts +11 -0
  142. package/lib/typescript/components/AvatarWithStatus.d.ts.map +1 -0
  143. package/lib/typescript/components/ConversationItem.d.ts +9 -0
  144. package/lib/typescript/components/ConversationItem.d.ts.map +1 -0
  145. package/lib/typescript/components/Icons.d.ts +33 -0
  146. package/lib/typescript/components/Icons.d.ts.map +1 -0
  147. package/lib/typescript/components/InputTools.d.ts.map +1 -1
  148. package/lib/typescript/components/MessengerShell.d.ts +4 -0
  149. package/lib/typescript/components/MessengerShell.d.ts.map +1 -0
  150. package/lib/typescript/components/conversation/DateSeparator.d.ts +6 -0
  151. package/lib/typescript/components/conversation/DateSeparator.d.ts.map +1 -0
  152. package/lib/typescript/components/conversation/EmojiPicker.d.ts +7 -0
  153. package/lib/typescript/components/conversation/EmojiPicker.d.ts.map +1 -0
  154. package/lib/typescript/components/conversation/PersistentMenu.d.ts +13 -0
  155. package/lib/typescript/components/conversation/PersistentMenu.d.ts.map +1 -0
  156. package/lib/typescript/components/conversation/TypingStatus.d.ts +4 -0
  157. package/lib/typescript/components/conversation/TypingStatus.d.ts.map +1 -0
  158. package/lib/typescript/components/conversation/WelcomeMessage.d.ts +6 -0
  159. package/lib/typescript/components/conversation/WelcomeMessage.d.ts.map +1 -0
  160. package/lib/typescript/components/nav/Navigation.d.ts +12 -0
  161. package/lib/typescript/components/nav/Navigation.d.ts.map +1 -0
  162. package/lib/typescript/components/nav/constants.d.ts +7 -0
  163. package/lib/typescript/components/nav/constants.d.ts.map +1 -0
  164. package/lib/typescript/graphql/ApolloContainer.d.ts.map +1 -1
  165. package/lib/typescript/graphql/mutation.d.ts +2 -1
  166. package/lib/typescript/graphql/mutation.d.ts.map +1 -1
  167. package/lib/typescript/graphql/query.d.ts +2 -3
  168. package/lib/typescript/graphql/query.d.ts.map +1 -1
  169. package/lib/typescript/graphql/subscription.d.ts +2 -1
  170. package/lib/typescript/graphql/subscription.d.ts.map +1 -1
  171. package/lib/typescript/screen/conversation/Attachment.d.ts.map +1 -1
  172. package/lib/typescript/screen/conversation/ConversationDetail.d.ts.map +1 -1
  173. package/lib/typescript/screen/conversation/Message.d.ts.map +1 -1
  174. package/lib/typescript/screen/faq/Faq.d.ts +4 -0
  175. package/lib/typescript/screen/faq/Faq.d.ts.map +1 -0
  176. package/lib/typescript/screen/greetings/Social.d.ts +1 -1
  177. package/lib/typescript/screen/greetings/Social.d.ts.map +1 -1
  178. package/lib/typescript/screen/greetings/Supporters.d.ts.map +1 -1
  179. package/lib/typescript/screen/home/Home.d.ts +4 -0
  180. package/lib/typescript/screen/home/Home.d.ts.map +1 -0
  181. package/lib/typescript/screen/messages/Messages.d.ts +4 -0
  182. package/lib/typescript/screen/messages/Messages.d.ts.map +1 -0
  183. package/lib/typescript/theme.d.ts +93 -0
  184. package/lib/typescript/theme.d.ts.map +1 -0
  185. package/lib/typescript/utils/messages.d.ts +27 -0
  186. package/lib/typescript/utils/messages.d.ts.map +1 -0
  187. package/lib/typescript/utils/objectId.d.ts +3 -0
  188. package/lib/typescript/utils/objectId.d.ts.map +1 -0
  189. package/lib/typescript/utils/onlineHours.d.ts +19 -0
  190. package/lib/typescript/utils/onlineHours.d.ts.map +1 -0
  191. package/lib/typescript/utils/upload.d.ts +32 -0
  192. package/lib/typescript/utils/upload.d.ts.map +1 -0
  193. package/package.json +29 -23
  194. package/src/App.tsx +10 -7
  195. package/src/Widget.tsx +211 -39
  196. package/src/assets/images/index.ts +1 -1
  197. package/src/assets/images/x.png +0 -0
  198. package/src/components/Avatar.tsx +30 -30
  199. package/src/components/AvatarWithStatus.tsx +63 -0
  200. package/src/components/ConversationItem.tsx +199 -0
  201. package/src/components/Icons.tsx +532 -0
  202. package/src/components/InputTools.tsx +388 -49
  203. package/src/components/MessengerShell.tsx +58 -0
  204. package/src/components/conversation/DateSeparator.tsx +36 -0
  205. package/src/components/conversation/EmojiPicker.tsx +111 -0
  206. package/src/components/conversation/PersistentMenu.tsx +74 -0
  207. package/src/components/conversation/TypingStatus.tsx +112 -0
  208. package/src/components/conversation/WelcomeMessage.tsx +70 -0
  209. package/src/components/nav/Navigation.tsx +137 -0
  210. package/src/components/nav/constants.ts +16 -0
  211. package/src/graphql/ApolloContainer.tsx +0 -1
  212. package/src/graphql/mutation.ts +58 -22
  213. package/src/graphql/query.ts +83 -55
  214. package/src/graphql/subscription.ts +31 -27
  215. package/src/screen/conversation/Attachment.tsx +123 -33
  216. package/src/screen/conversation/ConversationDetail.tsx +365 -135
  217. package/src/screen/conversation/Message.tsx +160 -98
  218. package/src/screen/faq/Faq.tsx +425 -0
  219. package/src/screen/greetings/Social.tsx +18 -4
  220. package/src/screen/greetings/Supporters.tsx +56 -41
  221. package/src/screen/home/Home.tsx +347 -0
  222. package/src/screen/messages/Messages.tsx +331 -0
  223. package/src/theme.ts +104 -0
  224. package/src/utils/messages.ts +105 -0
  225. package/src/utils/objectId.ts +59 -0
  226. package/src/utils/onlineHours.ts +167 -0
  227. package/src/utils/upload.ts +326 -0
  228. package/lib/commonjs/components/FAB.js +0 -51
  229. package/lib/commonjs/components/FAB.js.map +0 -1
  230. package/lib/commonjs/screen/conversation/Conversations.js +0 -160
  231. package/lib/commonjs/screen/conversation/Conversations.js.map +0 -1
  232. package/lib/commonjs/screen/greetings/Greetings.js +0 -96
  233. package/lib/commonjs/screen/greetings/Greetings.js.map +0 -1
  234. package/lib/module/components/FAB.js +0 -42
  235. package/lib/module/components/FAB.js.map +0 -1
  236. package/lib/module/screen/conversation/Conversations.js +0 -149
  237. package/lib/module/screen/conversation/Conversations.js.map +0 -1
  238. package/lib/module/screen/greetings/Greetings.js +0 -85
  239. package/lib/module/screen/greetings/Greetings.js.map +0 -1
  240. package/lib/typescript/components/FAB.d.ts +0 -16
  241. package/lib/typescript/components/FAB.d.ts.map +0 -1
  242. package/lib/typescript/screen/conversation/Conversations.d.ts +0 -4
  243. package/lib/typescript/screen/conversation/Conversations.d.ts.map +0 -1
  244. package/lib/typescript/screen/greetings/Greetings.d.ts +0 -4
  245. package/lib/typescript/screen/greetings/Greetings.d.ts.map +0 -1
  246. package/src/components/FAB.tsx +0 -69
  247. package/src/screen/conversation/Conversations.tsx +0 -150
  248. package/src/screen/greetings/Greetings.tsx +0 -98
package/README.md CHANGED
@@ -89,51 +89,349 @@ erxes is composed of 2 main components: **XOS** & **Plugins**
89
89
 
90
90
  <img src="https://raw.githubusercontent.com/erxes/rn-erxes-sdk/a7a111fafd30b71e34e99e618800b3110c2b57b6/Simulator%20Screenshot%20-%20iPhone%2014%20Pro%20Max%20-%202023-06-02%20at%2017.08.25.png" alt="screenshot" width="350">
91
91
 
92
- **🖐 Installation**
92
+ ---
93
93
 
94
- Install the library using either yarn or npm like so:
94
+ # rn-erxes-sdk
95
95
 
96
- ```sh
96
+ A React Native SDK for embedding the [erxes](https://erxes.io/) messenger experience inside a mobile application. It renders the erxes messenger UI, connects the visitor/customer to your erxes messenger integration, and handles conversations, unread counts, and message subscriptions for you.
97
+
98
+ It works in Expo (managed) and bare React Native apps.
99
+
100
+ ## Installation
101
+
102
+ Install the SDK with Yarn:
103
+
104
+ ```bash
97
105
  yarn add rn-erxes-sdk
98
106
  ```
99
107
 
100
- OR
108
+ or npm:
101
109
 
102
- ```sh
110
+ ```bash
103
111
  npm install --save rn-erxes-sdk
104
112
  ```
105
113
 
106
- ### How to use
114
+ These commands install the latest version published to **npm**. Pushing code to GitHub does **not** automatically update the npm package — a new version must be published explicitly (see [Maintainer workflow](#maintainer-workflow)).
115
+
116
+ ## Required peer dependencies
117
+
118
+ The SDK relies on the following native packages, which must be installed in the host app:
119
+
120
+ ```bash
121
+ npx expo install @react-native-async-storage/async-storage
122
+ yarn add react-native-get-random-values
123
+ ```
124
+
125
+ npm equivalent:
126
+
127
+ ```bash
128
+ npx expo install @react-native-async-storage/async-storage
129
+ npm install --save react-native-get-random-values
130
+ ```
131
+
132
+ - **`@react-native-async-storage/async-storage`** — required. Used to cache the customer id and conversation id between launches.
133
+ - **`react-native-get-random-values`** — required. The SDK imports it internally to polyfill `crypto.getRandomValues`, which is used to generate a guest visitor id. It must be present in the host app's dependency tree.
107
134
 
135
+ ### Optional
136
+
137
+ ```bash
138
+ npx expo install expo-image-picker
139
+ ```
140
+
141
+ - **`expo-image-picker`** — optional. If installed, the messenger lets users attach images from their library. The SDK loads it lazily, so the attachment button is simply hidden when it is not installed. (Bare React Native apps may use `react-native-image-picker` instead — it is detected the same way.)
142
+
143
+ ## Quick start with Expo
144
+
145
+ ```bash
146
+ npx create-expo-app@latest rn-erxes-sdk-test
147
+ cd rn-erxes-sdk-test
148
+
149
+ yarn add rn-erxes-sdk
150
+ npx expo install @react-native-async-storage/async-storage
151
+ yarn add react-native-get-random-values
152
+
153
+ npx expo start --clear
108
154
  ```
109
- import React from 'react';
155
+
156
+ npm alternative:
157
+
158
+ ```bash
159
+ npm install --save rn-erxes-sdk
160
+ npx expo install @react-native-async-storage/async-storage
161
+ npm install --save react-native-get-random-values
162
+
163
+ npx expo start --clear
164
+ ```
165
+
166
+ Render `<ErxesSDK />` from your app entry. In a classic Expo (`blank-typescript`) project that is `App.tsx`. In an Expo Router project the usage commonly lives in:
167
+
168
+ ```text
169
+ app/index.tsx
170
+ ```
171
+
172
+ or:
173
+
174
+ ```text
175
+ src/app/index.tsx
176
+ ```
177
+
178
+ ## Usage with Expo
179
+
180
+ The example below separates three concerns:
181
+
182
+ 1. authenticated customer-profile data taken from the host app's `currentUser` query,
183
+ 2. browser/device/runtime metadata, and
184
+ 3. the props passed to `ErxesSDK`.
185
+
186
+ ```tsx
187
+ import * as React from 'react';
188
+ import { Platform, View } from 'react-native';
110
189
  import { ErxesSDK } from 'rn-erxes-sdk';
111
190
 
112
- interface Props {
113
- navigation: any;
114
- route: any;
115
- onReceiveMessage: () => void;
116
- }
191
+ type CurrentUser = {
192
+ firstName?: string;
193
+ lastName?: string;
194
+ primaryEmail?: string;
195
+ primaryPhone?: string;
196
+ sex?: string | number;
197
+ propertiesData?: Record<string, unknown>;
198
+ };
199
+
200
+ type Props = {
201
+ currentUser?: CurrentUser;
202
+ };
203
+
204
+ export default function App({ currentUser }: Props) {
205
+ const integrationId = 'YOUR_INTEGRATION_ID';
206
+ const subDomain = 'YOUR_SUBDOMAIN.next.erxes.io';
207
+
208
+ const data = {
209
+ firstName: currentUser?.firstName ?? '',
210
+ lastName: currentUser?.lastName ?? '',
211
+ primaryEmail: currentUser?.primaryEmail ?? '',
212
+ sex: currentUser?.sex ?? '',
213
+ Type: 'mobile',
214
+ ...currentUser?.propertiesData,
215
+ };
216
+
217
+ const properties = {
218
+ remoteAddress: '',
219
+ region: '',
220
+ countryCode: '',
221
+ city: '',
222
+ country: '',
223
+ url: 'https://YOUR_SUBDOMAIN.nextwidgets.erxes.io/',
224
+ hostname: 'YOUR_SUBDOMAIN.nextwidgets.erxes.io',
225
+ language: 'en-US',
226
+ userAgent: Platform.OS,
227
+ };
117
228
 
118
- const Widget = () => {
119
229
  return (
120
- <ErxesSDK
121
- brandCode={brandCode}
122
- />
230
+ <View style={{ flex: 1 }}>
231
+ <ErxesSDK
232
+ integrationId={integrationId}
233
+ subDomain={subDomain}
234
+ onBack={() => console.log('onBack')}
235
+ showWidget={false}
236
+ phone={currentUser?.primaryPhone ?? ''}
237
+ data={data}
238
+ properties={properties}
239
+ />
240
+ </View>
123
241
  );
242
+ }
243
+ ```
244
+
245
+ Notes:
246
+
247
+ - The exact `currentUser` query depends on your host application — the SDK does not provide it.
248
+ - `data` should normally be mapped from the authenticated user's query result rather than hardcoded.
249
+ - Do not hardcode private customer information in production.
250
+ - Empty property values are acceptable when metadata is unavailable.
251
+ - Do not fake IP addresses or location values.
252
+ - Replace `YOUR_INTEGRATION_ID` and `YOUR_SUBDOMAIN` with the values from your erxes environment.
253
+ - `Platform.OS` is only a lightweight fallback for `userAgent`; it is not a complete browser user-agent string.
254
+
255
+ ## Customer data from `currentUser`
256
+
257
+ `data` is customer-profile information. It is forwarded to the erxes `widgetsMessengerConnect` mutation (as the `data` JSON argument) when the SDK connects, and is used to create or identify the customer.
258
+
259
+ ```tsx
260
+ const data = {
261
+ firstName: currentUser?.firstName ?? '',
262
+ lastName: currentUser?.lastName ?? '',
263
+ primaryEmail: currentUser?.primaryEmail ?? '',
264
+ sex: currentUser?.sex ?? '',
265
+ Type: 'mobile',
266
+ ...currentUser?.propertiesData,
124
267
  };
125
- export default Widget;
126
268
  ```
127
269
 
128
- ### Properties
270
+ - This normally comes from the host application's authenticated-user query.
271
+ - Custom fields may be included when relevant (e.g. spread from `propertiesData`).
272
+ - `data` is optional — when omitted, the visitor is connected as a guest.
273
+ - Do not use fake values in production.
274
+
275
+ ## Browser and device information
276
+
277
+ `properties` describes the browser, device, and runtime environment. When the SDK has an identified customer, it sends these values to the erxes `widgetsSaveBrowserInfo` mutation internally — **you do not call it yourself**, you only pass the `properties` prop.
278
+
279
+ ```tsx
280
+ const properties = {
281
+ remoteAddress: '',
282
+ region: '',
283
+ countryCode: '',
284
+ city: '',
285
+ country: '',
286
+ url: 'https://YOUR_SUBDOMAIN.nextwidgets.erxes.io/',
287
+ hostname: 'YOUR_SUBDOMAIN.nextwidgets.erxes.io',
288
+ language: 'en-US',
289
+ userAgent: 'DEVICE_USER_AGENT',
290
+ };
291
+ ```
292
+
293
+ - Empty strings are acceptable when a value is unavailable.
294
+ - Do not fake IP addresses or location values.
295
+ - Collect real runtime values where possible.
296
+
297
+ For reference, the mutation the SDK calls internally is:
298
+
299
+ ```graphql
300
+ mutation widgetsSaveBrowserInfo(
301
+ $customerId: String
302
+ $visitorId: String
303
+ $browserInfo: JSON!
304
+ ) {
305
+ widgetsSaveBrowserInfo(
306
+ customerId: $customerId
307
+ visitorId: $visitorId
308
+ browserInfo: $browserInfo
309
+ ) {
310
+ _id
311
+ conversationId
312
+ customerId
313
+ }
314
+ }
315
+ ```
316
+
317
+ The SDK passes the connected `customerId` together with your `properties` object as `browserInfo`. The customer id and visitor id are managed by the SDK:
318
+
319
+ - On first launch the SDK generates a guest **visitor id** (a 24-character hex string) and uses it to connect.
320
+ - After connecting, the resolved **customer id** is cached in `AsyncStorage` and reused on later launches.
321
+
322
+ You only pass the relevant props (`data`, `properties`, `phone`); you should not duplicate this connect / save-browser-info flow yourself.
323
+
324
+ ## Props
325
+
326
+ Public props of `ErxesSDK` (from the SDK's TypeScript types):
327
+
328
+ | Prop | Type | Required | Description |
329
+ | --- | --- | --- | --- |
330
+ | `integrationId` | `string` | Yes | erxes messenger integration id used to connect. |
331
+ | `subDomain` | `string` | Yes | erxes environment subdomain (e.g. `YOUR_SUBDOMAIN.next.erxes.io`); used to build the GraphQL/WS endpoints and asset URLs. |
332
+ | `showWidget` | `boolean` | Yes | When `true`, renders the floating launcher button; when `false`, renders the messenger inline. |
333
+ | `brandCode` | `string` | No | Brand code; used as a fallback when `integrationId` is not provided. |
334
+ | `email` | `string` | No | When set, the contact is connected as an identified user (`isUser`). |
335
+ | `onBack` | `() => void` | No | Called when the user navigates back from the messenger. |
336
+ | `phone` | `string` | No | Phone number used to identify the customer on connect. |
337
+ | `data` | `object` | No | Customer-profile data forwarded to `widgetsMessengerConnect`. |
338
+ | `properties` | `object` | No | Browser/device metadata sent as `browserInfo` to `widgetsSaveBrowserInfo`. |
339
+ | `backIcon` | `ImageSource` | No | Custom back icon. |
340
+ | `newChatIcon` | `ImageSource` | No | Custom "new chat" icon. |
341
+ | `sendIcon` | `ImageSource` | No | Custom send icon. |
342
+
343
+ ## Troubleshooting
344
+
345
+ ### Clear Expo cache
346
+
347
+ ```bash
348
+ npx expo start --clear
349
+ ```
350
+
351
+ ### Confirm the installed version
352
+
353
+ ```bash
354
+ yarn list --pattern rn-erxes-sdk
355
+ ```
356
+
357
+ or:
358
+
359
+ ```bash
360
+ npm ls rn-erxes-sdk
361
+ ```
362
+
363
+ ### Upgrade the SDK
364
+
365
+ ```bash
366
+ yarn add rn-erxes-sdk@latest
367
+ npx expo start --clear
368
+ ```
369
+
370
+ or:
371
+
372
+ ```bash
373
+ npm install --save rn-erxes-sdk@latest
374
+ npx expo start --clear
375
+ ```
376
+
377
+ ### Native dependencies
378
+
379
+ The required peer dependencies (`@react-native-async-storage/async-storage`, `react-native-get-random-values`) must be installed in the **host app**. The SDK does not bundle them.
380
+
381
+ ### `await is not defined` (BSON Metro crash)
382
+
383
+ Older SDK releases depended on `bson`, which could cause Metro/Hermes to crash at startup with:
384
+
385
+ ```text
386
+ await is not defined
387
+ node_modules/bson/lib/bson.mjs
388
+ ```
389
+
390
+ This happened because Expo resolves packages through their ESM `exports` map and picked `bson/lib/bson.mjs`, which uses a top-level `await`. **Upgrade to the latest `rn-erxes-sdk` release** — it no longer depends on `bson`. A custom Metro config change is not required.
391
+
392
+ ## Maintainer workflow
129
393
 
130
- | Prop | Default | Required |
131
- | ---------------- | ------- | -------- |
132
- | **`brandCode`** | `None` | True |
133
- | **`email`** | `Null` | False |
134
- | **`onBack`** | `None` | False |
135
- | **`showWidget`** | `false` | True |
394
+ This repository requires Node.js `>=20.19.0` and Yarn Classic `1.22.22`.
395
+
396
+ ```bash
397
+ corepack enable
398
+ corepack prepare yarn@1.22.22 --activate
399
+
400
+ yarn install
401
+ yarn typecheck
402
+ yarn lint
403
+ yarn test
404
+ yarn prepack
405
+ npm pack --dry-run
406
+ ```
407
+
408
+ The example app uses Expo SDK 54, React `19.1.0`, and React Native `0.81.5`, and aliases `rn-erxes-sdk` to the root `src` directory for local development:
409
+
410
+ ```bash
411
+ cd example
412
+ yarn install
413
+ npx expo start --clear
414
+ ```
415
+
416
+ ### Release
417
+
418
+ ```bash
419
+ npm login
420
+ npm whoami
421
+
422
+ npm version patch
423
+ npm publish
424
+
425
+ npm view rn-erxes-sdk version
426
+ git push origin main --follow-tags
427
+ ```
136
428
 
429
+ - Pushing to GitHub does **not** publish to npm.
430
+ - npmjs displays the README from the **published** package version.
431
+ - Each release requires a new version; a published version cannot be republished.
432
+ - `npm version patch` is appropriate for backward-compatible fixes and documentation updates.
433
+ - `npm publish` may require 2FA or a granular access token with publish permission.
434
+ - Do not repeatedly run `npm version patch` after a failed publish unless a genuinely new version is needed.
137
435
  ## Become a partner
138
436
 
139
437
  Offer your expertise to the world and introduce your community to erxes.
@@ -8,13 +8,14 @@ require("react-native-get-random-values");
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _Widget = _interopRequireDefault(require("./Widget"));
10
10
  var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
11
- var _bson = require("bson");
11
+ var _objectId = require("./utils/objectId");
12
12
  var _ApolloContainer = _interopRequireDefault(require("./graphql/ApolloContainer"));
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
16
  const ErxesSDK = _ref => {
17
17
  let {
18
+ integrationId,
18
19
  brandCode,
19
20
  subDomain,
20
21
  email = null,
@@ -39,17 +40,16 @@ const ErxesSDK = _ref => {
39
40
  let tempCustomerId = '';
40
41
  setLoading(true);
41
42
  _asyncStorage.default.getItem('cachedCustomerId').then(value => {
42
- var _visitorId;
43
43
  if (value !== null) {
44
44
  tempCustomerId = JSON.parse(value);
45
45
  }
46
46
  if (!tempCustomerId) {
47
- // declare the data fetching function
48
- visitorId = new _bson.ObjectId();
47
+ // mint a guest visitor id (24-char hex, same shape as a Mongo ObjectId)
48
+ visitorId = (0, _objectId.createObjectIdLikeString)();
49
49
  }
50
50
  setConnection({
51
51
  cachedCustomerId: tempCustomerId ? tempCustomerId : null,
52
- visitorId: (_visitorId = visitorId) === null || _visitorId === void 0 ? void 0 : _visitorId.toString()
52
+ visitorId: visitorId
53
53
  });
54
54
  _asyncStorage.default.getItem('conversationId').then(v => {
55
55
  if (v !== null) {
@@ -63,7 +63,7 @@ const ErxesSDK = _ref => {
63
63
  }).catch(e => {
64
64
  setConnection({
65
65
  cachedCustomerId: null,
66
- visitorId: new _bson.ObjectId()
66
+ visitorId: (0, _objectId.createObjectIdLikeString)()
67
67
  });
68
68
  setLoading(false);
69
69
  console.log('Failed on cachedCustomerId', e.message);
@@ -76,6 +76,7 @@ const ErxesSDK = _ref => {
76
76
  return null;
77
77
  }
78
78
  const props = {
79
+ integrationId: integrationId || brandCode,
79
80
  brandCode,
80
81
  subDomain,
81
82
  email,
@@ -1 +1 @@
1
- {"version":3,"names":["require","_react","_interopRequireWildcard","_Widget","_interopRequireDefault","_asyncStorage","_bson","_ApolloContainer","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ErxesSDK","_ref","brandCode","subDomain","email","onBack","showWidget","backIcon","newChatIcon","sendIcon","phone","data","properties","loading","setLoading","React","useState","connection","setConnection","cachedCustomerId","visitorId","cachedConversationId","setCachedConversationId","show","setShow","useEffect","tempCustomerId","AsyncStorage","getItem","then","value","_visitorId","JSON","parse","ObjectId","toString","v","catch","e","console","log","message","props","createElement","_default","exports"],"sourceRoot":"../../src","sources":["App.tsx"],"mappings":";;;;;;AAAAA,OAAA;AACA,IAAAC,MAAA,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AAK;IACLC,IAAI;IACJC,UAAU;IACV;IACAW,IAAI;IACJC,OAAO;IACP;IACAH;EACF,CAAC;EAED,oBACElD,MAAA,CAAAS,OAAA,CAAA+D,aAAA,CAAClE,gBAAA,CAAAG,OAAe;IAACuB,SAAS,EAAEA;EAAU,gBACpChC,MAAA,CAAAS,OAAA,CAAA+D,aAAA,CAACtE,OAAA,CAAAO,OAAM,EAAK8D,KAAQ,CACL,CAAC;AAEtB,CAAC;AAAC,IAAAE,QAAA,GAEa5C,QAAQ;AAAA6C,OAAA,CAAAjE,OAAA,GAAAgE,QAAA"}
1
+ {"version":3,"names":["require","_react","_interopRequireWildcard","_Widget","_interopRequireDefault","_asyncStorage","_objectId","_ApolloContainer","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ErxesSDK","_ref","integrationId","brandCode","subDomain","email","onBack","showWidget","backIcon","newChatIcon","sendIcon","phone","data","properties","loading","setLoading","React","useState","connection","setConnection","cachedCustomerId","visitorId","cachedConversationId","setCachedConversationId","show","setShow","useEffect","tempCustomerId","AsyncStorage","getItem","then","value","JSON","parse","createObjectIdLikeString","v","catch","e","console","log","message","props","createElement","_default","exports"],"sourceRoot":"../../src","sources":["App.tsx"],"mappings":";;;;;;AAAAA,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAH,sBAAA,CAAAJ,OAAA;AAAwD,SAAAI,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAA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