@developer_tribe/react-native-comnyx 0.7.6 → 0.9.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 (108) hide show
  1. package/android/build.gradle +12 -6
  2. package/android/generated/RCTAppDependencyProvider.h +25 -0
  3. package/android/generated/RCTAppDependencyProvider.mm +55 -0
  4. package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  5. package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  6. package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
  7. package/android/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  8. package/android/generated/ReactAppDependencyProvider.podspec +34 -0
  9. package/android/generated/jni/RNComnyxSpec-generated.cpp +1 -11
  10. package/android/generated/jni/RNComnyxSpec.h +0 -7
  11. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +0 -11
  12. package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +0 -52
  13. package/android/src/main/java/com/comnyx/ComnyxModule.kt +75 -7
  14. package/android/src/main/java/com/comnyx/ComnyxPackage.kt +0 -3
  15. package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +1 -9
  16. package/android/src/main/java/com/comnyx/src/messaging/notifications/NotificationsService.kt +105 -8
  17. package/ios/Comnyx.m +2 -2
  18. package/ios/Comnyx.swift +83 -20
  19. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  20. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  21. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  22. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  23. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  24. package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
  25. package/ios/generated/RNComnyxSpec/RNComnyxSpec-generated.mm +0 -23
  26. package/ios/generated/RNComnyxSpec/RNComnyxSpec.h +0 -25
  27. package/ios/generated/RNComnyxSpecJSI-generated.cpp +0 -11
  28. package/ios/generated/RNComnyxSpecJSI.h +0 -52
  29. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  30. package/lib/commonjs/NativeComnyx.js.map +1 -1
  31. package/lib/commonjs/api/api.js +4 -0
  32. package/lib/commonjs/api/api.js.map +1 -1
  33. package/lib/commonjs/components/ChatList.js +100 -106
  34. package/lib/commonjs/components/ChatList.js.map +1 -1
  35. package/lib/commonjs/components/CustomerForm.js +173 -179
  36. package/lib/commonjs/components/CustomerForm.js.map +1 -1
  37. package/lib/commonjs/components/EmptyList.js +5 -7
  38. package/lib/commonjs/components/EmptyList.js.map +1 -1
  39. package/lib/commonjs/constants/translations.js +145 -29
  40. package/lib/commonjs/constants/translations.js.map +1 -1
  41. package/lib/commonjs/hooks/useLocalize.js +7 -0
  42. package/lib/commonjs/hooks/useLocalize.js.map +1 -1
  43. package/lib/commonjs/notifications/index.js +2 -1
  44. package/lib/commonjs/notifications/index.js.map +1 -1
  45. package/lib/commonjs/notifications/initializeNotifications.js +137 -0
  46. package/lib/commonjs/notifications/initializeNotifications.js.map +1 -0
  47. package/lib/commonjs/register/login.js +1 -1
  48. package/lib/commonjs/register/login.js.map +1 -1
  49. package/lib/commonjs/store/store.js +14 -1
  50. package/lib/commonjs/store/store.js.map +1 -1
  51. package/lib/module/NativeComnyx.js.map +1 -1
  52. package/lib/module/api/api.js +3 -0
  53. package/lib/module/api/api.js.map +1 -1
  54. package/lib/module/components/ChatList.js +101 -107
  55. package/lib/module/components/ChatList.js.map +1 -1
  56. package/lib/module/components/CustomerForm.js +174 -180
  57. package/lib/module/components/CustomerForm.js.map +1 -1
  58. package/lib/module/components/EmptyList.js +6 -8
  59. package/lib/module/components/EmptyList.js.map +1 -1
  60. package/lib/module/constants/translations.js +145 -29
  61. package/lib/module/constants/translations.js.map +1 -1
  62. package/lib/module/hooks/useLocalize.js +6 -0
  63. package/lib/module/hooks/useLocalize.js.map +1 -1
  64. package/lib/module/notifications/index.js +2 -1
  65. package/lib/module/notifications/index.js.map +1 -1
  66. package/lib/module/notifications/initializeNotifications.js +133 -0
  67. package/lib/module/notifications/initializeNotifications.js.map +1 -0
  68. package/lib/module/register/login.js +1 -1
  69. package/lib/module/register/login.js.map +1 -1
  70. package/lib/module/store/store.js +14 -1
  71. package/lib/module/store/store.js.map +1 -1
  72. package/lib/typescript/src/NativeComnyx.d.ts +6 -1
  73. package/lib/typescript/src/NativeComnyx.d.ts.map +1 -1
  74. package/lib/typescript/src/api/api.d.ts +1 -0
  75. package/lib/typescript/src/api/api.d.ts.map +1 -1
  76. package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
  77. package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -1
  78. package/lib/typescript/src/components/EmptyList.d.ts.map +1 -1
  79. package/lib/typescript/src/constants/translations.d.ts.map +1 -1
  80. package/lib/typescript/src/hooks/useLocalize.d.ts +1 -0
  81. package/lib/typescript/src/hooks/useLocalize.d.ts.map +1 -1
  82. package/lib/typescript/src/notifications/index.d.ts +63 -4
  83. package/lib/typescript/src/notifications/index.d.ts.map +1 -1
  84. package/lib/typescript/src/notifications/initializeNotifications.d.ts +7 -0
  85. package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -0
  86. package/lib/typescript/src/store/store.d.ts +4 -0
  87. package/lib/typescript/src/store/store.d.ts.map +1 -1
  88. package/lib/typescript/src/types/Customer.d.ts +5 -0
  89. package/lib/typescript/src/types/Customer.d.ts.map +1 -1
  90. package/lib/typescript/src/types/LocalizationKeys.d.ts +4 -0
  91. package/lib/typescript/src/types/LocalizationKeys.d.ts.map +1 -1
  92. package/package.json +2 -2
  93. package/src/NativeComnyx.ts +6 -1
  94. package/src/api/api.ts +4 -0
  95. package/src/components/ChatList.tsx +110 -123
  96. package/src/components/CustomerForm.tsx +194 -212
  97. package/src/components/EmptyList.tsx +3 -10
  98. package/src/constants/translations.ts +145 -0
  99. package/src/hooks/useLocalize.ts +6 -0
  100. package/src/notifications/index.ts +69 -5
  101. package/src/notifications/initializeNotifications.ts +180 -0
  102. package/src/register/login.ts +1 -1
  103. package/src/store/store.ts +13 -0
  104. package/src/types/Customer.ts +5 -0
  105. package/src/types/LocalizationKeys.ts +4 -0
  106. package/android/generated/java/com/comnyx/NativeComnyxSpec.java +0 -37
  107. package/lib/typescript/setup-jest.d.ts +0 -1
  108. package/lib/typescript/setup-jest.d.ts.map +0 -1
@@ -7,8 +7,6 @@ import {
7
7
  ScrollView,
8
8
  StatusBar,
9
9
  ActivityIndicator,
10
- KeyboardAvoidingView,
11
- Platform,
12
10
  } from 'react-native';
13
11
  import { useForm, Controller } from 'react-hook-form';
14
12
  import { createCustomer } from '../api';
@@ -124,234 +122,218 @@ export function CustomerForm({
124
122
  animated={false}
125
123
  translucent
126
124
  />
127
- <KeyboardAvoidingView
128
- behavior={Platform.OS === 'ios' ? 'padding' : undefined}
129
- style={{ flex: 1 }}
125
+ <TouchableOpacity
126
+ style={[styles.container, { backgroundColor: themeColors.background }]}
127
+ onPress={Keyboard.dismiss}
128
+ activeOpacity={1}
130
129
  >
131
- <TouchableOpacity
132
- style={[
133
- styles.container,
134
- { backgroundColor: themeColors.background },
135
- ]}
136
- onPress={Keyboard.dismiss}
137
- activeOpacity={1}
130
+ <ScrollView
131
+ contentContainerStyle={styles.scrollContainer}
132
+ keyboardShouldPersistTaps="handled"
138
133
  >
139
- <ScrollView
140
- contentContainerStyle={styles.scrollContainer}
141
- keyboardShouldPersistTaps="handled"
134
+ <View
135
+ style={[
136
+ styles.container,
137
+ { backgroundColor: themeColors.background },
138
+ ]}
142
139
  >
140
+ <TouchableOpacity
141
+ activeOpacity={1}
142
+ style={[
143
+ styles.iconContainer,
144
+ { backgroundColor: themeColors.dark_background },
145
+ ]}
146
+ onPress={onBack}
147
+ >
148
+ <Image
149
+ source={closeIcon}
150
+ style={[
151
+ styles.closeIcon,
152
+ { tintColor: themeColors.light_text },
153
+ ]}
154
+ />
155
+ </TouchableOpacity>
143
156
  <View
144
157
  style={[
145
- styles.container,
146
- { backgroundColor: themeColors.background },
158
+ styles.headerContainer,
159
+ { backgroundColor: themeColors.dark_background },
147
160
  ]}
148
161
  >
149
- <TouchableOpacity
150
- activeOpacity={1}
162
+ <AppText
163
+ localization="customer.form.title"
164
+ style={[styles.headerText, { color: themeColors.gainsboro }]}
165
+ />
166
+ <AppText
167
+ localization="customer.form.instructions"
168
+ style={[styles.headerText, { color: themeColors.light_text }]}
169
+ />
170
+ </View>
171
+ <View style={styles.titleContainer}>
172
+ <AppText
151
173
  style={[
152
- styles.iconContainer,
153
- { backgroundColor: themeColors.dark_background },
174
+ styles.title,
175
+ {
176
+ color: themeColors.slate,
177
+ },
154
178
  ]}
155
- onPress={onBack}
156
179
  >
157
- <Image
158
- source={closeIcon}
159
- style={[
160
- styles.closeIcon,
161
- { tintColor: themeColors.light_text },
162
- ]}
163
- />
164
- </TouchableOpacity>
165
- <View
180
+ {localize('customer.form.name')}
181
+ </AppText>
182
+ <Controller
183
+ control={control}
184
+ rules={{
185
+ required: {
186
+ value: true,
187
+ message: localize('customer.form.validation.name.required'),
188
+ },
189
+ maxLength: {
190
+ value: 30,
191
+ message: localize(
192
+ 'customer.form.validation.name.maxLength'
193
+ ),
194
+ },
195
+ }}
196
+ render={({ field: { onChange, value } }) => (
197
+ <View
198
+ style={[
199
+ styles.inputContainer,
200
+ { borderBottomColor: themeColors.ghost },
201
+ ]}
202
+ >
203
+ <TextInput
204
+ style={inputStyle}
205
+ placeholder={localize('customer.form.placeholder.name')}
206
+ placeholderTextColor={themeColors.gainsboro}
207
+ value={value}
208
+ onChangeText={onChange}
209
+ />
210
+ {errors.name && (
211
+ <InfoButton
212
+ title={'customer.form.failed.name'}
213
+ description={'customer.form.failed.name.desc'}
214
+ />
215
+ )}
216
+ </View>
217
+ )}
218
+ name="name"
219
+ />
220
+ <AppText
166
221
  style={[
167
- styles.headerContainer,
168
- { backgroundColor: themeColors.dark_background },
222
+ styles.title,
223
+ {
224
+ color: themeColors.slate,
225
+ },
169
226
  ]}
170
227
  >
171
- <AppText
172
- localization="customer.form.title"
173
- style={[styles.headerText, { color: themeColors.gainsboro }]}
174
- />
175
- <AppText
176
- localization="customer.form.instructions"
177
- style={[styles.headerText, { color: themeColors.light_text }]}
178
- />
179
- </View>
180
- <View style={styles.titleContainer}>
181
- <AppText
182
- style={[
183
- styles.title,
184
- {
185
- color: themeColors.slate,
186
- },
187
- ]}
188
- >
189
- {localize('customer.form.name')}
190
- </AppText>
191
- <Controller
192
- control={control}
193
- rules={{
194
- required: {
195
- value: true,
196
- message: localize(
197
- 'customer.form.validation.name.required'
198
- ),
199
- },
200
- maxLength: {
201
- value: 30,
202
- message: localize(
203
- 'customer.form.validation.name.maxLength'
204
- ),
205
- },
206
- }}
207
- render={({ field: { onChange, value } }) => (
208
- <View
209
- style={[
210
- styles.inputContainer,
211
- { borderBottomColor: themeColors.ghost },
212
- ]}
213
- >
214
- <TextInput
215
- style={inputStyle}
216
- placeholder={localize('customer.form.placeholder.name')}
217
- placeholderTextColor={themeColors.gainsboro}
218
- value={value}
219
- onChangeText={onChange}
220
- />
221
- {errors.name && (
222
- <InfoButton
223
- title={'customer.form.failed.name'}
224
- description={'customer.form.failed.name.desc'}
225
- />
226
- )}
227
- </View>
228
- )}
229
- name="name"
230
- />
231
- <AppText
232
- style={[
233
- styles.title,
234
- {
235
- color: themeColors.slate,
236
- },
237
- ]}
238
- >
239
- Email
240
- </AppText>
241
- <Controller
242
- control={control}
243
- rules={{
244
- pattern: {
245
- value: /^\S+@\S+$/i,
246
- message: localize(
247
- 'customer.form.validation.email.pattern'
248
- ),
249
- },
250
- }}
251
- render={({ field: { onChange, value } }) => (
252
- <View
253
- style={[
254
- styles.inputContainer,
255
- { borderBottomColor: themeColors.ghost },
256
- ]}
257
- >
258
- <TextInput
259
- style={inputStyle}
260
- placeholder={localize(
261
- 'customer.form.placeholder.email'
262
- )}
263
- placeholderTextColor={themeColors.gainsboro}
264
- value={value}
265
- onChangeText={onChange}
266
- keyboardType="email-address"
228
+ Email
229
+ </AppText>
230
+ <Controller
231
+ control={control}
232
+ rules={{
233
+ pattern: {
234
+ value: /^\S+@\S+$/i,
235
+ message: localize('customer.form.validation.email.pattern'),
236
+ },
237
+ }}
238
+ render={({ field: { onChange, value } }) => (
239
+ <View
240
+ style={[
241
+ styles.inputContainer,
242
+ { borderBottomColor: themeColors.ghost },
243
+ ]}
244
+ >
245
+ <TextInput
246
+ style={inputStyle}
247
+ placeholder={localize('customer.form.placeholder.email')}
248
+ placeholderTextColor={themeColors.gainsboro}
249
+ value={value}
250
+ onChangeText={onChange}
251
+ keyboardType="email-address"
252
+ />
253
+ {errors.email && (
254
+ <InfoButton
255
+ title={'customer.form.failed.email'}
256
+ description={'customer.form.failed.email.desc'}
267
257
  />
268
- {errors.email && (
269
- <InfoButton
270
- title={'customer.form.failed.email'}
271
- description={'customer.form.failed.email.desc'}
272
- />
273
- )}
274
- </View>
275
- )}
276
- name="email"
277
- />
278
- <AppText
279
- style={[
280
- styles.title,
281
- {
282
- color: themeColors.slate,
283
- },
284
- ]}
285
- >
286
- Phone
287
- </AppText>
288
- <Controller
289
- control={control}
290
- rules={{
291
- validate: (value) => {
292
- if (!value) return true;
293
- return (
294
- typeof value === 'string' ||
295
- localize('customer.form.validation.phone.invalid')
296
- );
297
- },
298
- }}
299
- render={({ field: { onChange, value } }) => (
300
- <View
301
- style={[
302
- styles.inputContainer,
303
- { borderBottomColor: themeColors.ghost },
304
- ]}
305
- >
306
- <TextInput
307
- style={inputStyle}
308
- placeholder={localize(
309
- 'customer.form.placeholder.phone'
310
- )}
311
- placeholderTextColor={themeColors.gainsboro}
312
- value={value}
313
- onChangeText={onChange}
314
- keyboardType="phone-pad"
258
+ )}
259
+ </View>
260
+ )}
261
+ name="email"
262
+ />
263
+ <AppText
264
+ style={[
265
+ styles.title,
266
+ {
267
+ color: themeColors.slate,
268
+ },
269
+ ]}
270
+ >
271
+ Phone
272
+ </AppText>
273
+ <Controller
274
+ control={control}
275
+ rules={{
276
+ validate: (value) => {
277
+ if (!value) return true;
278
+ return (
279
+ typeof value === 'string' ||
280
+ localize('customer.form.validation.phone.invalid')
281
+ );
282
+ },
283
+ }}
284
+ render={({ field: { onChange, value } }) => (
285
+ <View
286
+ style={[
287
+ styles.inputContainer,
288
+ { borderBottomColor: themeColors.ghost },
289
+ ]}
290
+ >
291
+ <TextInput
292
+ style={inputStyle}
293
+ placeholder={localize('customer.form.placeholder.phone')}
294
+ placeholderTextColor={themeColors.gainsboro}
295
+ value={value}
296
+ onChangeText={onChange}
297
+ keyboardType="phone-pad"
298
+ />
299
+ {errors.phone && (
300
+ <InfoButton
301
+ title={'customer.form.failed.phone'}
302
+ description={'customer.form.failed.phone.desc'}
315
303
  />
316
- {errors.phone && (
317
- <InfoButton
318
- title={'customer.form.failed.phone'}
319
- description={'customer.form.failed.phone.desc'}
320
- />
321
- )}
322
- </View>
323
- )}
324
- name="phone"
325
- />
326
- </View>
304
+ )}
305
+ </View>
306
+ )}
307
+ name="phone"
308
+ />
327
309
  </View>
328
- </ScrollView>
329
- <TouchableOpacity
330
- activeOpacity={activeOpacity}
331
- style={[
332
- styles.button,
333
- { backgroundColor: themeColors.dark_background },
334
- ]}
335
- onPress={handleSubmit(onSubmit)}
336
- >
337
- <AppText
338
- localization="customer.form.submit"
339
- style={[styles.buttonText, { color: themeColors.light_text }]}
340
- />
341
- </TouchableOpacity>
342
- <CustomPopup
343
- isVisible={popupVisible}
344
- onClose={() => setPopupVisible(false)}
345
- title={popupContent.title}
346
- description={popupContent.description}
347
- onCancelButton={() => {
348
- setPopupVisible(false);
349
- setPopupContent({ title: '', description: '' });
350
- }}
351
- buttonText={'customer.form.cancel' as keyof LocalizationKeys}
310
+ </View>
311
+ </ScrollView>
312
+ <TouchableOpacity
313
+ activeOpacity={activeOpacity}
314
+ style={[
315
+ styles.button,
316
+ { backgroundColor: themeColors.dark_background },
317
+ ]}
318
+ onPress={handleSubmit(onSubmit)}
319
+ >
320
+ <AppText
321
+ localization="customer.form.submit"
322
+ style={[styles.buttonText, { color: themeColors.light_text }]}
352
323
  />
353
324
  </TouchableOpacity>
354
- </KeyboardAvoidingView>
325
+ <CustomPopup
326
+ isVisible={popupVisible}
327
+ onClose={() => setPopupVisible(false)}
328
+ title={popupContent.title}
329
+ description={popupContent.description}
330
+ onCancelButton={() => {
331
+ setPopupVisible(false);
332
+ setPopupContent({ title: '', description: '' });
333
+ }}
334
+ buttonText={'customer.form.cancel' as keyof LocalizationKeys}
335
+ />
336
+ </TouchableOpacity>
355
337
  </>
356
338
  );
357
339
  }
@@ -1,4 +1,4 @@
1
- import { View, Image, Platform } from 'react-native';
1
+ import { View, Image } from 'react-native';
2
2
  import { useThemeColors } from '../hooks/useThemeColors';
3
3
  import { AppText } from './AppText';
4
4
  import type { LocalizationKeys } from '../types/LocalizationKeys';
@@ -11,15 +11,7 @@ export function EmptyList() {
11
11
 
12
12
  return (
13
13
  <View
14
- style={[
15
- styles.container,
16
- {
17
- backgroundColor: themeColors.background,
18
- transform: [
19
- Platform.OS === 'ios' ? { scaleY: -1 } : { rotate: '180deg' },
20
- ],
21
- },
22
- ]}
14
+ style={[styles.container, { backgroundColor: themeColors.background }]}
23
15
  >
24
16
  <Image
25
17
  source={notificationIcon}
@@ -45,6 +37,7 @@ const styles = ScaledSheet.create({
45
37
  paddingHorizontal: '20@s',
46
38
  paddingVertical: '20@vs',
47
39
  gap: 15,
40
+ transform: [{ rotate: '180deg' }],
48
41
  },
49
42
  title: {
50
43
  fontSize: '18@vs',