@developer_tribe/react-native-comnyx 0.14.0 → 0.16.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.
- package/Comnyx.podspec +10 -2
- package/README.md +50 -0
- package/android/build.gradle +1 -0
- package/android/consumer-rules.pro +23 -0
- package/android/generated/java/com/comnyx/NativeComnyxSpec.java +46 -0
- package/android/generated/jni/RNComnyxSpec-generated.cpp +23 -1
- package/android/generated/jni/RNComnyxSpec.h +7 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +21 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +70 -0
- package/android/src/main/AndroidManifest.xml +11 -1
- package/android/src/main/AndroidManifestNew.xml +11 -1
- package/android/src/main/java/com/comnyx/ComnyxMediaPickerModule.kt +105 -19
- package/android/src/main/java/com/comnyx/ComnyxModule.kt +7 -0
- package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +4 -6
- package/android/src/main/res/xml/comnyx_file_paths.xml +12 -0
- package/ios/APNService.swift +9 -9
- package/ios/Comnyx.swift +17 -8
- package/ios/ComnyxMediaPicker.m +6 -0
- package/ios/ComnyxMediaPicker.swift +106 -26
- package/ios/ComnyxMessaging.swift +2 -0
- package/ios/PrivacyInfo.xcprivacy +32 -0
- package/ios/comnyx_post_install.rb +25 -0
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/ios/generated/RNComnyxSpec/RNComnyxSpec-generated.mm +53 -0
- package/ios/generated/RNComnyxSpec/RNComnyxSpec.h +67 -0
- package/ios/generated/RNComnyxSpecJSI-generated.cpp +38 -0
- package/ios/generated/RNComnyxSpecJSI.h +89 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/commonjs/NativeComnyxMediaPicker.js +46 -6
- package/lib/commonjs/NativeComnyxMediaPicker.js.map +1 -1
- package/lib/commonjs/api/conversations.js +6 -6
- package/lib/commonjs/api/conversations.js.map +1 -1
- package/lib/commonjs/api/customers.js +3 -2
- package/lib/commonjs/api/customers.js.map +1 -1
- package/lib/commonjs/api/media.js +20 -6
- package/lib/commonjs/api/media.js.map +1 -1
- package/lib/commonjs/api/messages.js +3 -2
- package/lib/commonjs/api/messages.js.map +1 -1
- package/lib/commonjs/assets/gallery.png +0 -0
- package/lib/commonjs/assets/video-play.png +0 -0
- package/lib/commonjs/components/ChatList.js +93 -45
- package/lib/commonjs/components/ChatList.js.map +1 -1
- package/lib/commonjs/components/ComnyxErrorBoundary.js +92 -0
- package/lib/commonjs/components/ComnyxErrorBoundary.js.map +1 -0
- package/lib/commonjs/components/CustomerForm.js +2 -2
- package/lib/commonjs/components/CustomerForm.js.map +1 -1
- package/lib/commonjs/components/MediaMessageItem.js +4 -3
- package/lib/commonjs/components/MediaMessageItem.js.map +1 -1
- package/lib/commonjs/components/MediaPickerButton.js +211 -14
- package/lib/commonjs/components/MediaPickerButton.js.map +1 -1
- package/lib/commonjs/components/MediaViewerModal.js +7 -0
- package/lib/commonjs/components/MediaViewerModal.js.map +1 -1
- package/lib/commonjs/components/MessageInput.js +63 -13
- package/lib/commonjs/components/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageItem.js +1 -2
- package/lib/commonjs/components/MessageItem.js.map +1 -1
- package/lib/commonjs/constants/translations.js +87 -116
- package/lib/commonjs/constants/translations.js.map +1 -1
- package/lib/commonjs/hooks/usePolling.js +25 -21
- package/lib/commonjs/hooks/usePolling.js.map +1 -1
- package/lib/commonjs/hooks/useThemeColors.js +12 -1
- package/lib/commonjs/hooks/useThemeColors.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/notifications/initializeNotifications.js +19 -16
- package/lib/commonjs/notifications/initializeNotifications.js.map +1 -1
- package/lib/commonjs/register/Accumulator.js +19 -6
- package/lib/commonjs/register/Accumulator.js.map +1 -1
- package/lib/commonjs/register/collectData.js +1 -1
- package/lib/commonjs/register/collectData.js.map +1 -1
- package/lib/commonjs/store/store.js +6 -0
- package/lib/commonjs/store/store.js.map +1 -1
- package/lib/commonjs/support/ComnyxSupport.js +60 -15
- package/lib/commonjs/support/ComnyxSupport.js.map +1 -1
- package/lib/commonjs/support/SupportConfigContext.js +24 -0
- package/lib/commonjs/support/SupportConfigContext.js.map +1 -0
- package/lib/commonjs/types/Theme.js +30 -2
- package/lib/commonjs/types/Theme.js.map +1 -1
- package/lib/commonjs/version.js +1 -1
- package/lib/module/NativeComnyxMediaPicker.js +43 -6
- package/lib/module/NativeComnyxMediaPicker.js.map +1 -1
- package/lib/module/api/conversations.js +6 -6
- package/lib/module/api/conversations.js.map +1 -1
- package/lib/module/api/customers.js +3 -2
- package/lib/module/api/customers.js.map +1 -1
- package/lib/module/api/media.js +21 -6
- package/lib/module/api/media.js.map +1 -1
- package/lib/module/api/messages.js +3 -2
- package/lib/module/api/messages.js.map +1 -1
- package/lib/module/assets/gallery.png +0 -0
- package/lib/module/assets/video-play.png +0 -0
- package/lib/module/components/ChatList.js +94 -46
- package/lib/module/components/ChatList.js.map +1 -1
- package/lib/module/components/ComnyxErrorBoundary.js +87 -0
- package/lib/module/components/ComnyxErrorBoundary.js.map +1 -0
- package/lib/module/components/CustomerForm.js +2 -2
- package/lib/module/components/CustomerForm.js.map +1 -1
- package/lib/module/components/MediaMessageItem.js +4 -3
- package/lib/module/components/MediaMessageItem.js.map +1 -1
- package/lib/module/components/MediaPickerButton.js +215 -18
- package/lib/module/components/MediaPickerButton.js.map +1 -1
- package/lib/module/components/MediaViewerModal.js +8 -1
- package/lib/module/components/MediaViewerModal.js.map +1 -1
- package/lib/module/components/MessageInput.js +64 -14
- package/lib/module/components/MessageInput.js.map +1 -1
- package/lib/module/components/MessageItem.js +1 -2
- package/lib/module/components/MessageItem.js.map +1 -1
- package/lib/module/constants/translations.js +87 -116
- package/lib/module/constants/translations.js.map +1 -1
- package/lib/module/hooks/usePolling.js +25 -21
- package/lib/module/hooks/usePolling.js.map +1 -1
- package/lib/module/hooks/useThemeColors.js +13 -2
- package/lib/module/hooks/useThemeColors.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/notifications/initializeNotifications.js +19 -16
- package/lib/module/notifications/initializeNotifications.js.map +1 -1
- package/lib/module/register/Accumulator.js +19 -6
- package/lib/module/register/Accumulator.js.map +1 -1
- package/lib/module/register/collectData.js +1 -1
- package/lib/module/register/collectData.js.map +1 -1
- package/lib/module/store/store.js +6 -0
- package/lib/module/store/store.js.map +1 -1
- package/lib/module/support/ComnyxSupport.js +61 -16
- package/lib/module/support/ComnyxSupport.js.map +1 -1
- package/lib/module/support/SupportConfigContext.js +19 -0
- package/lib/module/support/SupportConfigContext.js.map +1 -0
- package/lib/module/types/Theme.js +30 -2
- package/lib/module/types/Theme.js.map +1 -1
- package/lib/module/version.js +1 -1
- package/lib/typescript/src/NativeComnyxMediaPicker.d.ts +11 -0
- package/lib/typescript/src/NativeComnyxMediaPicker.d.ts.map +1 -1
- package/lib/typescript/src/api/conversations.d.ts +2 -2
- package/lib/typescript/src/api/conversations.d.ts.map +1 -1
- package/lib/typescript/src/api/customers.d.ts +1 -1
- package/lib/typescript/src/api/customers.d.ts.map +1 -1
- package/lib/typescript/src/api/media.d.ts +3 -3
- package/lib/typescript/src/api/media.d.ts.map +1 -1
- package/lib/typescript/src/api/messages.d.ts +1 -1
- package/lib/typescript/src/api/messages.d.ts.map +1 -1
- package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
- package/lib/typescript/src/components/ComnyxErrorBoundary.d.ts +18 -0
- package/lib/typescript/src/components/ComnyxErrorBoundary.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaMessageItem.d.ts.map +1 -1
- package/lib/typescript/src/components/MediaPickerButton.d.ts.map +1 -1
- package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -1
- package/lib/typescript/src/components/MessageInput.d.ts.map +1 -1
- package/lib/typescript/src/components/MessageItem.d.ts.map +1 -1
- package/lib/typescript/src/constants/translations.d.ts.map +1 -1
- package/lib/typescript/src/hooks/usePolling.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useThemeColors.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -1
- package/lib/typescript/src/register/Accumulator.d.ts.map +1 -1
- package/lib/typescript/src/register/collectData.d.ts +4 -1
- package/lib/typescript/src/register/collectData.d.ts.map +1 -1
- package/lib/typescript/src/store/store.d.ts +6 -2
- package/lib/typescript/src/store/store.d.ts.map +1 -1
- package/lib/typescript/src/support/ComnyxSupport.d.ts +56 -2
- package/lib/typescript/src/support/ComnyxSupport.d.ts.map +1 -1
- package/lib/typescript/src/support/SupportConfigContext.d.ts +58 -0
- package/lib/typescript/src/support/SupportConfigContext.d.ts.map +1 -0
- package/lib/typescript/src/support/index.d.ts +1 -0
- package/lib/typescript/src/support/index.d.ts.map +1 -1
- package/lib/typescript/src/types/Conversation.d.ts +2 -2
- package/lib/typescript/src/types/Conversation.d.ts.map +1 -1
- package/lib/typescript/src/types/Customer.d.ts +1 -1
- package/lib/typescript/src/types/Customer.d.ts.map +1 -1
- package/lib/typescript/src/types/LocalizationKeys.d.ts +0 -1
- package/lib/typescript/src/types/LocalizationKeys.d.ts.map +1 -1
- package/lib/typescript/src/types/MessageResponse.d.ts +7 -4
- package/lib/typescript/src/types/MessageResponse.d.ts.map +1 -1
- package/lib/typescript/src/types/Theme.d.ts +26 -0
- package/lib/typescript/src/types/Theme.d.ts.map +1 -1
- package/lib/typescript/src/version.d.ts +1 -1
- package/package.json +12 -25
- package/src/NativeComnyxMediaPicker.ts +46 -7
- package/src/api/conversations.ts +6 -4
- package/src/api/customers.ts +3 -1
- package/src/api/media.ts +32 -10
- package/src/api/messages.ts +3 -1
- package/src/assets/gallery.png +0 -0
- package/src/assets/video-play.png +0 -0
- package/src/components/ChatList.tsx +115 -55
- package/src/components/ComnyxErrorBoundary.tsx +91 -0
- package/src/components/CustomerForm.tsx +2 -2
- package/src/components/MediaMessageItem.tsx +10 -3
- package/src/components/MediaPickerButton.tsx +238 -17
- package/src/components/MediaViewerModal.tsx +8 -1
- package/src/components/MessageInput.tsx +89 -16
- package/src/components/MessageItem.tsx +12 -14
- package/src/constants/translations.ts +87 -116
- package/src/hooks/usePolling.ts +21 -11
- package/src/hooks/useThemeColors.ts +11 -2
- package/src/index.ts +12 -0
- package/src/notifications/initializeNotifications.ts +22 -20
- package/src/register/Accumulator.ts +26 -9
- package/src/register/collectData.ts +10 -2
- package/src/store/store.ts +11 -3
- package/src/support/ComnyxSupport.tsx +128 -22
- package/src/support/SupportConfigContext.tsx +79 -0
- package/src/support/index.ts +7 -0
- package/src/types/Conversation.ts +2 -2
- package/src/types/Customer.ts +1 -2
- package/src/types/LocalizationKeys.ts +0 -1
- package/src/types/MessageResponse.ts +4 -4
- package/src/types/Theme.ts +38 -0
- package/src/version.ts +1 -1
|
@@ -58,10 +58,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
58
58
|
'notifications.optIn.copyToClipboard': 'Copy to Clipboard',
|
|
59
59
|
'chat.media.uploading': 'Uploading...',
|
|
60
60
|
'chat.media.upload.failed': 'Upload failed',
|
|
61
|
-
'chat.media.pick.title': '
|
|
62
|
-
'chat.media.pick.photo': 'Photo',
|
|
63
|
-
'chat.media.pick.video': 'Video',
|
|
64
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
61
|
+
'chat.media.pick.title': 'Select media source',
|
|
62
|
+
'chat.media.pick.photo': 'Choose Photo',
|
|
63
|
+
'chat.media.pick.video': 'Choose Video',
|
|
65
64
|
},
|
|
66
65
|
tr: {
|
|
67
66
|
'customer.form.title': 'Merhaba👋',
|
|
@@ -119,10 +118,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
119
118
|
'notifications.optIn.copyToClipboard': 'Panoya Kopyala',
|
|
120
119
|
'chat.media.uploading': 'Uploading...',
|
|
121
120
|
'chat.media.upload.failed': 'Upload failed',
|
|
122
|
-
'chat.media.pick.title': '
|
|
123
|
-
'chat.media.pick.photo': '
|
|
124
|
-
'chat.media.pick.video': 'Video',
|
|
125
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
121
|
+
'chat.media.pick.title': 'Medya kaynağı seçin',
|
|
122
|
+
'chat.media.pick.photo': 'Fotoğraf Seç',
|
|
123
|
+
'chat.media.pick.video': 'Video Seç',
|
|
126
124
|
},
|
|
127
125
|
es: {
|
|
128
126
|
'customer.form.title': 'Hola👋',
|
|
@@ -182,10 +180,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
182
180
|
'notifications.optIn.copyToClipboard': 'Copiar al Portapapeles',
|
|
183
181
|
'chat.media.uploading': 'Uploading...',
|
|
184
182
|
'chat.media.upload.failed': 'Upload failed',
|
|
185
|
-
'chat.media.pick.title': '
|
|
186
|
-
'chat.media.pick.photo': '
|
|
187
|
-
'chat.media.pick.video': 'Video',
|
|
188
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
183
|
+
'chat.media.pick.title': 'Seleccionar fuente de medios',
|
|
184
|
+
'chat.media.pick.photo': 'Elegir Foto',
|
|
185
|
+
'chat.media.pick.video': 'Elegir Video',
|
|
189
186
|
},
|
|
190
187
|
fr: {
|
|
191
188
|
'customer.form.title': 'Bonjour👋',
|
|
@@ -246,10 +243,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
246
243
|
'notifications.optIn.copyToClipboard': 'Copier dans le Presse-papiers',
|
|
247
244
|
'chat.media.uploading': 'Uploading...',
|
|
248
245
|
'chat.media.upload.failed': 'Upload failed',
|
|
249
|
-
'chat.media.pick.title': '
|
|
250
|
-
'chat.media.pick.photo': 'Photo',
|
|
251
|
-
'chat.media.pick.video': '
|
|
252
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
246
|
+
'chat.media.pick.title': 'Sélectionner la source média',
|
|
247
|
+
'chat.media.pick.photo': 'Choisir une Photo',
|
|
248
|
+
'chat.media.pick.video': 'Choisir une Vidéo',
|
|
253
249
|
},
|
|
254
250
|
de: {
|
|
255
251
|
'customer.form.title': 'Hallo👋',
|
|
@@ -311,10 +307,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
311
307
|
'notifications.optIn.copyToClipboard': 'In die Zwischenablage kopieren',
|
|
312
308
|
'chat.media.uploading': 'Uploading...',
|
|
313
309
|
'chat.media.upload.failed': 'Upload failed',
|
|
314
|
-
'chat.media.pick.title': '
|
|
315
|
-
'chat.media.pick.photo': '
|
|
316
|
-
'chat.media.pick.video': 'Video',
|
|
317
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
310
|
+
'chat.media.pick.title': 'Medienquelle auswählen',
|
|
311
|
+
'chat.media.pick.photo': 'Foto auswählen',
|
|
312
|
+
'chat.media.pick.video': 'Video auswählen',
|
|
318
313
|
},
|
|
319
314
|
it: {
|
|
320
315
|
'customer.form.title': 'Ciao👋',
|
|
@@ -373,10 +368,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
373
368
|
'notifications.optIn.copyToClipboard': 'Copia negli Appunti',
|
|
374
369
|
'chat.media.uploading': 'Uploading...',
|
|
375
370
|
'chat.media.upload.failed': 'Upload failed',
|
|
376
|
-
'chat.media.pick.title': '
|
|
377
|
-
'chat.media.pick.photo': '
|
|
378
|
-
'chat.media.pick.video': 'Video',
|
|
379
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
371
|
+
'chat.media.pick.title': 'Seleziona sorgente media',
|
|
372
|
+
'chat.media.pick.photo': 'Scegli Foto',
|
|
373
|
+
'chat.media.pick.video': 'Scegli Video',
|
|
380
374
|
},
|
|
381
375
|
pt: {
|
|
382
376
|
'customer.form.title': 'Olá👋',
|
|
@@ -438,10 +432,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
438
432
|
'Copiar para a Área de Transferência',
|
|
439
433
|
'chat.media.uploading': 'Uploading...',
|
|
440
434
|
'chat.media.upload.failed': 'Upload failed',
|
|
441
|
-
'chat.media.pick.title': '
|
|
442
|
-
'chat.media.pick.photo': '
|
|
443
|
-
'chat.media.pick.video': '
|
|
444
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
435
|
+
'chat.media.pick.title': 'Selecionar fonte de mídia',
|
|
436
|
+
'chat.media.pick.photo': 'Escolher Foto',
|
|
437
|
+
'chat.media.pick.video': 'Escolher Vídeo',
|
|
445
438
|
},
|
|
446
439
|
ru: {
|
|
447
440
|
'customer.form.title': 'Привет👋',
|
|
@@ -502,10 +495,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
502
495
|
'notifications.optIn.copyToClipboard': 'Скопировать в буфер обмена',
|
|
503
496
|
'chat.media.uploading': 'Uploading...',
|
|
504
497
|
'chat.media.upload.failed': 'Upload failed',
|
|
505
|
-
'chat.media.pick.title': '
|
|
506
|
-
'chat.media.pick.photo': '
|
|
507
|
-
'chat.media.pick.video': '
|
|
508
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
498
|
+
'chat.media.pick.title': 'Выберите источник медиа',
|
|
499
|
+
'chat.media.pick.photo': 'Выбрать Фото',
|
|
500
|
+
'chat.media.pick.video': 'Выбрать Видео',
|
|
509
501
|
},
|
|
510
502
|
ja: {
|
|
511
503
|
'customer.form.title': 'こんにちは👋',
|
|
@@ -563,10 +555,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
563
555
|
'notifications.optIn.copyToClipboard': 'クリップボードにコピー',
|
|
564
556
|
'chat.media.uploading': 'Uploading...',
|
|
565
557
|
'chat.media.upload.failed': 'Upload failed',
|
|
566
|
-
'chat.media.pick.title': '
|
|
567
|
-
'chat.media.pick.photo': '
|
|
568
|
-
'chat.media.pick.video': '
|
|
569
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
558
|
+
'chat.media.pick.title': 'メディアソースを選択',
|
|
559
|
+
'chat.media.pick.photo': '写真を選択',
|
|
560
|
+
'chat.media.pick.video': '動画を選択',
|
|
570
561
|
},
|
|
571
562
|
zh: {
|
|
572
563
|
'customer.form.title': '你好👋',
|
|
@@ -619,10 +610,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
619
610
|
'notifications.optIn.copyToClipboard': '复制到剪贴板',
|
|
620
611
|
'chat.media.uploading': 'Uploading...',
|
|
621
612
|
'chat.media.upload.failed': 'Upload failed',
|
|
622
|
-
'chat.media.pick.title': '
|
|
623
|
-
'chat.media.pick.photo': '
|
|
624
|
-
'chat.media.pick.video': '
|
|
625
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
613
|
+
'chat.media.pick.title': '选择媒体来源',
|
|
614
|
+
'chat.media.pick.photo': '选择照片',
|
|
615
|
+
'chat.media.pick.video': '选择视频',
|
|
626
616
|
},
|
|
627
617
|
ar: {
|
|
628
618
|
'customer.form.title': 'مرحباً👋',
|
|
@@ -678,10 +668,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
678
668
|
'notifications.optIn.copyToClipboard': 'نسخ إلى الحافظة',
|
|
679
669
|
'chat.media.uploading': 'Uploading...',
|
|
680
670
|
'chat.media.upload.failed': 'Upload failed',
|
|
681
|
-
'chat.media.pick.title': '
|
|
682
|
-
'chat.media.pick.photo': '
|
|
683
|
-
'chat.media.pick.video': '
|
|
684
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
671
|
+
'chat.media.pick.title': 'اختر مصدر الوسائط',
|
|
672
|
+
'chat.media.pick.photo': 'اختر صورة',
|
|
673
|
+
'chat.media.pick.video': 'اختر فيديو',
|
|
685
674
|
},
|
|
686
675
|
id: {
|
|
687
676
|
'customer.form.title': 'Halo👋',
|
|
@@ -738,10 +727,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
738
727
|
'notifications.optIn.copyToClipboard': 'Salin ke Clipboard',
|
|
739
728
|
'chat.media.uploading': 'Uploading...',
|
|
740
729
|
'chat.media.upload.failed': 'Upload failed',
|
|
741
|
-
'chat.media.pick.title': '
|
|
742
|
-
'chat.media.pick.photo': '
|
|
743
|
-
'chat.media.pick.video': 'Video',
|
|
744
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
730
|
+
'chat.media.pick.title': 'Pilih sumber media',
|
|
731
|
+
'chat.media.pick.photo': 'Pilih Foto',
|
|
732
|
+
'chat.media.pick.video': 'Pilih Video',
|
|
745
733
|
},
|
|
746
734
|
vi: {
|
|
747
735
|
'customer.form.title': 'Xin chào👋',
|
|
@@ -797,10 +785,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
797
785
|
'notifications.optIn.copyToClipboard': 'Sao chép vào Clipboard',
|
|
798
786
|
'chat.media.uploading': 'Uploading...',
|
|
799
787
|
'chat.media.upload.failed': 'Upload failed',
|
|
800
|
-
'chat.media.pick.title': '
|
|
801
|
-
'chat.media.pick.photo': '
|
|
802
|
-
'chat.media.pick.video': 'Video',
|
|
803
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
788
|
+
'chat.media.pick.title': 'Chọn nguồn phương tiện',
|
|
789
|
+
'chat.media.pick.photo': 'Chọn Ảnh',
|
|
790
|
+
'chat.media.pick.video': 'Chọn Video',
|
|
804
791
|
},
|
|
805
792
|
sv: {
|
|
806
793
|
'customer.form.title': 'Hej👋',
|
|
@@ -858,10 +845,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
858
845
|
'notifications.optIn.copyToClipboard': 'Kopiera till Urklipp',
|
|
859
846
|
'chat.media.uploading': 'Uploading...',
|
|
860
847
|
'chat.media.upload.failed': 'Upload failed',
|
|
861
|
-
'chat.media.pick.title': '
|
|
862
|
-
'chat.media.pick.photo': '
|
|
863
|
-
'chat.media.pick.video': 'Video',
|
|
864
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
848
|
+
'chat.media.pick.title': 'Välj mediakälla',
|
|
849
|
+
'chat.media.pick.photo': 'Välj Foto',
|
|
850
|
+
'chat.media.pick.video': 'Välj Video',
|
|
865
851
|
},
|
|
866
852
|
ko: {
|
|
867
853
|
'customer.form.title': '안녕하세요👋',
|
|
@@ -915,10 +901,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
915
901
|
'notifications.optIn.copyToClipboard': '클립보드에 복사',
|
|
916
902
|
'chat.media.uploading': 'Uploading...',
|
|
917
903
|
'chat.media.upload.failed': 'Upload failed',
|
|
918
|
-
'chat.media.pick.title': '
|
|
919
|
-
'chat.media.pick.photo': '
|
|
920
|
-
'chat.media.pick.video': '
|
|
921
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
904
|
+
'chat.media.pick.title': '미디어 소스 선택',
|
|
905
|
+
'chat.media.pick.photo': '사진 선택',
|
|
906
|
+
'chat.media.pick.video': '동영상 선택',
|
|
922
907
|
},
|
|
923
908
|
hi: {
|
|
924
909
|
'customer.form.title': 'नमस्ते👋',
|
|
@@ -977,10 +962,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
977
962
|
'notifications.optIn.copyToClipboard': 'क्लिपबोर्ड में कॉपी करें',
|
|
978
963
|
'chat.media.uploading': 'Uploading...',
|
|
979
964
|
'chat.media.upload.failed': 'Upload failed',
|
|
980
|
-
'chat.media.pick.title': '
|
|
981
|
-
'chat.media.pick.photo': '
|
|
982
|
-
'chat.media.pick.video': '
|
|
983
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
965
|
+
'chat.media.pick.title': 'मीडिया स्रोत चुनें',
|
|
966
|
+
'chat.media.pick.photo': 'फोटो चुनें',
|
|
967
|
+
'chat.media.pick.video': 'वीडियो चुनें',
|
|
984
968
|
},
|
|
985
969
|
nl: {
|
|
986
970
|
'customer.form.title': 'Hallo👋',
|
|
@@ -1038,10 +1022,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1038
1022
|
'notifications.optIn.copyToClipboard': 'Kopieer naar Klembord',
|
|
1039
1023
|
'chat.media.uploading': 'Uploading...',
|
|
1040
1024
|
'chat.media.upload.failed': 'Upload failed',
|
|
1041
|
-
'chat.media.pick.title': '
|
|
1042
|
-
'chat.media.pick.photo': '
|
|
1043
|
-
'chat.media.pick.video': 'Video',
|
|
1044
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1025
|
+
'chat.media.pick.title': 'Selecteer mediabron',
|
|
1026
|
+
'chat.media.pick.photo': 'Kies Foto',
|
|
1027
|
+
'chat.media.pick.video': 'Kies Video',
|
|
1045
1028
|
},
|
|
1046
1029
|
he: {
|
|
1047
1030
|
'customer.form.title': 'שלום👋',
|
|
@@ -1095,10 +1078,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1095
1078
|
'notifications.optIn.copyToClipboard': 'העתק ללוח',
|
|
1096
1079
|
'chat.media.uploading': 'Uploading...',
|
|
1097
1080
|
'chat.media.upload.failed': 'Upload failed',
|
|
1098
|
-
'chat.media.pick.title': '
|
|
1099
|
-
'chat.media.pick.photo': '
|
|
1100
|
-
'chat.media.pick.video': '
|
|
1101
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1081
|
+
'chat.media.pick.title': 'בחר מקור מדיה',
|
|
1082
|
+
'chat.media.pick.photo': 'בחר תמונה',
|
|
1083
|
+
'chat.media.pick.video': 'בחר סרטון',
|
|
1102
1084
|
},
|
|
1103
1085
|
uk: {
|
|
1104
1086
|
'customer.form.title': 'Привіт👋',
|
|
@@ -1157,10 +1139,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1157
1139
|
'notifications.optIn.copyToClipboard': 'Скопіювати в буфер обміну',
|
|
1158
1140
|
'chat.media.uploading': 'Uploading...',
|
|
1159
1141
|
'chat.media.upload.failed': 'Upload failed',
|
|
1160
|
-
'chat.media.pick.title': '
|
|
1161
|
-
'chat.media.pick.photo': '
|
|
1162
|
-
'chat.media.pick.video': '
|
|
1163
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1142
|
+
'chat.media.pick.title': 'Оберіть джерело медіа',
|
|
1143
|
+
'chat.media.pick.photo': 'Обрати Фото',
|
|
1144
|
+
'chat.media.pick.video': 'Обрати Відео',
|
|
1164
1145
|
},
|
|
1165
1146
|
hu: {
|
|
1166
1147
|
'customer.form.title': 'Helló👋',
|
|
@@ -1220,10 +1201,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1220
1201
|
'notifications.optIn.copyToClipboard': 'Vágólapra másolás',
|
|
1221
1202
|
'chat.media.uploading': 'Uploading...',
|
|
1222
1203
|
'chat.media.upload.failed': 'Upload failed',
|
|
1223
|
-
'chat.media.pick.title': '
|
|
1224
|
-
'chat.media.pick.photo': '
|
|
1225
|
-
'chat.media.pick.video': '
|
|
1226
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1204
|
+
'chat.media.pick.title': 'Válasszon médiaforrást',
|
|
1205
|
+
'chat.media.pick.photo': 'Fotó kiválasztása',
|
|
1206
|
+
'chat.media.pick.video': 'Videó kiválasztása',
|
|
1227
1207
|
},
|
|
1228
1208
|
ro: {
|
|
1229
1209
|
'customer.form.title': 'Salut👋',
|
|
@@ -1284,10 +1264,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1284
1264
|
'notifications.optIn.copyToClipboard': 'Copiază în Clipboard',
|
|
1285
1265
|
'chat.media.uploading': 'Uploading...',
|
|
1286
1266
|
'chat.media.upload.failed': 'Upload failed',
|
|
1287
|
-
'chat.media.pick.title': '
|
|
1288
|
-
'chat.media.pick.photo': '
|
|
1289
|
-
'chat.media.pick.video': 'Video',
|
|
1290
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1267
|
+
'chat.media.pick.title': 'Selectați sursa media',
|
|
1268
|
+
'chat.media.pick.photo': 'Alegeți Foto',
|
|
1269
|
+
'chat.media.pick.video': 'Alegeți Video',
|
|
1291
1270
|
},
|
|
1292
1271
|
ms: {
|
|
1293
1272
|
'customer.form.title': 'Hai👋',
|
|
@@ -1344,10 +1323,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1344
1323
|
'notifications.optIn.copyToClipboard': 'Salin ke Clipboard',
|
|
1345
1324
|
'chat.media.uploading': 'Uploading...',
|
|
1346
1325
|
'chat.media.upload.failed': 'Upload failed',
|
|
1347
|
-
'chat.media.pick.title': '
|
|
1348
|
-
'chat.media.pick.photo': '
|
|
1349
|
-
'chat.media.pick.video': 'Video',
|
|
1350
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1326
|
+
'chat.media.pick.title': 'Pilih sumber media',
|
|
1327
|
+
'chat.media.pick.photo': 'Pilih Foto',
|
|
1328
|
+
'chat.media.pick.video': 'Pilih Video',
|
|
1351
1329
|
},
|
|
1352
1330
|
az: {
|
|
1353
1331
|
'customer.form.title': 'Salam👋',
|
|
@@ -1405,10 +1383,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1405
1383
|
'notifications.optIn.copyToClipboard': 'Klipdorda kopyala',
|
|
1406
1384
|
'chat.media.uploading': 'Uploading...',
|
|
1407
1385
|
'chat.media.upload.failed': 'Upload failed',
|
|
1408
|
-
'chat.media.pick.title': '
|
|
1409
|
-
'chat.media.pick.photo': '
|
|
1410
|
-
'chat.media.pick.video': 'Video',
|
|
1411
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1386
|
+
'chat.media.pick.title': 'Media mənbəyini seçin',
|
|
1387
|
+
'chat.media.pick.photo': 'Şəkil Seç',
|
|
1388
|
+
'chat.media.pick.video': 'Video Seç',
|
|
1412
1389
|
},
|
|
1413
1390
|
hr: {
|
|
1414
1391
|
'customer.form.title': 'Bok👋',
|
|
@@ -1464,10 +1441,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1464
1441
|
'notifications.optIn.copyToClipboard': 'Kopiraj u međuspremnik',
|
|
1465
1442
|
'chat.media.uploading': 'Uploading...',
|
|
1466
1443
|
'chat.media.upload.failed': 'Upload failed',
|
|
1467
|
-
'chat.media.pick.title': '
|
|
1468
|
-
'chat.media.pick.photo': '
|
|
1469
|
-
'chat.media.pick.video': 'Video',
|
|
1470
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1444
|
+
'chat.media.pick.title': 'Odaberite izvor medija',
|
|
1445
|
+
'chat.media.pick.photo': 'Odaberi Fotografiju',
|
|
1446
|
+
'chat.media.pick.video': 'Odaberi Video',
|
|
1471
1447
|
},
|
|
1472
1448
|
kk: {
|
|
1473
1449
|
'customer.form.title': 'Сәлем👋',
|
|
@@ -1525,10 +1501,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1525
1501
|
'notifications.optIn.copyToClipboard': 'Буферге көшіру',
|
|
1526
1502
|
'chat.media.uploading': 'Uploading...',
|
|
1527
1503
|
'chat.media.upload.failed': 'Upload failed',
|
|
1528
|
-
'chat.media.pick.title': '
|
|
1529
|
-
'chat.media.pick.photo': '
|
|
1530
|
-
'chat.media.pick.video': '
|
|
1531
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1504
|
+
'chat.media.pick.title': 'Медиа көзін таңдаңыз',
|
|
1505
|
+
'chat.media.pick.photo': 'Фото таңдау',
|
|
1506
|
+
'chat.media.pick.video': 'Бейне таңдау',
|
|
1532
1507
|
},
|
|
1533
1508
|
af: {
|
|
1534
1509
|
'customer.form.title': 'Hallo👋',
|
|
@@ -1587,10 +1562,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1587
1562
|
'notifications.optIn.copyToClipboard': 'Kopieer naar Klembord',
|
|
1588
1563
|
'chat.media.uploading': 'Uploading...',
|
|
1589
1564
|
'chat.media.upload.failed': 'Upload failed',
|
|
1590
|
-
'chat.media.pick.title': '
|
|
1591
|
-
'chat.media.pick.photo': '
|
|
1592
|
-
'chat.media.pick.video': 'Video',
|
|
1593
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1565
|
+
'chat.media.pick.title': 'Kies mediabron',
|
|
1566
|
+
'chat.media.pick.photo': 'Kies Foto',
|
|
1567
|
+
'chat.media.pick.video': 'Kies Video',
|
|
1594
1568
|
},
|
|
1595
1569
|
yo: {
|
|
1596
1570
|
'customer.form.title': 'Báwo👋',
|
|
@@ -1645,10 +1619,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1645
1619
|
'notifications.optIn.copyToClipboard': 'Kopier til Udklipsholderen',
|
|
1646
1620
|
'chat.media.uploading': 'Uploading...',
|
|
1647
1621
|
'chat.media.upload.failed': 'Upload failed',
|
|
1648
|
-
'chat.media.pick.title': '
|
|
1649
|
-
'chat.media.pick.photo': '
|
|
1650
|
-
'chat.media.pick.video': '
|
|
1651
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1622
|
+
'chat.media.pick.title': 'Yan oríṣun iṣẹ́ amóhùn',
|
|
1623
|
+
'chat.media.pick.photo': 'Yan Àwòrán',
|
|
1624
|
+
'chat.media.pick.video': 'Yan Fídíò',
|
|
1652
1625
|
},
|
|
1653
1626
|
da: {
|
|
1654
1627
|
'customer.form.title': 'Hej👋',
|
|
@@ -1705,10 +1678,9 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1705
1678
|
'notifications.optIn.copyToClipboard': 'Kopier til Udklipsholderen',
|
|
1706
1679
|
'chat.media.uploading': 'Uploading...',
|
|
1707
1680
|
'chat.media.upload.failed': 'Upload failed',
|
|
1708
|
-
'chat.media.pick.title': '
|
|
1709
|
-
'chat.media.pick.photo': '
|
|
1710
|
-
'chat.media.pick.video': 'Video',
|
|
1711
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1681
|
+
'chat.media.pick.title': 'Vælg mediekilde',
|
|
1682
|
+
'chat.media.pick.photo': 'Vælg Foto',
|
|
1683
|
+
'chat.media.pick.video': 'Vælg Video',
|
|
1712
1684
|
},
|
|
1713
1685
|
pl: {
|
|
1714
1686
|
'customer.form.title': 'Cześć👋',
|
|
@@ -1765,9 +1737,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1765
1737
|
'notifications.optIn.copyToClipboard': 'Kopiuj do schowka',
|
|
1766
1738
|
'chat.media.uploading': 'Uploading...',
|
|
1767
1739
|
'chat.media.upload.failed': 'Upload failed',
|
|
1768
|
-
'chat.media.pick.title': '
|
|
1769
|
-
'chat.media.pick.photo': '
|
|
1770
|
-
'chat.media.pick.video': '
|
|
1771
|
-
'chat.media.pick.cancel': 'Cancel',
|
|
1740
|
+
'chat.media.pick.title': 'Wybierz źródło mediów',
|
|
1741
|
+
'chat.media.pick.photo': 'Wybierz Zdjęcie',
|
|
1742
|
+
'chat.media.pick.video': 'Wybierz Wideo',
|
|
1772
1743
|
},
|
|
1773
1744
|
} as const;
|
package/src/hooks/usePolling.ts
CHANGED
|
@@ -13,12 +13,19 @@ export function usePolling() {
|
|
|
13
13
|
const lastMessage = data ? data[data.length - 1] : null;
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
const created_at = lastMessage?.created_at;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
if (!customer || !created_at) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const controller = new AbortController();
|
|
20
|
+
const interval = setInterval(() => {
|
|
21
|
+
getNewCustomerConversation(
|
|
22
|
+
customer.external_id,
|
|
23
|
+
created_at,
|
|
24
|
+
{ fake: useAppStore.getState().fake },
|
|
25
|
+
controller.signal
|
|
26
|
+
)
|
|
27
|
+
.then((newData) => {
|
|
28
|
+
if (controller.signal.aborted) return;
|
|
22
29
|
setData((prevData) => {
|
|
23
30
|
const newMessages = newData.page.data;
|
|
24
31
|
const existingIds = new Set(prevData?.map((msg) => msg.id));
|
|
@@ -34,13 +41,16 @@ export function usePolling() {
|
|
|
34
41
|
...(prevData ?? []),
|
|
35
42
|
];
|
|
36
43
|
});
|
|
44
|
+
})
|
|
45
|
+
.catch((err) => {
|
|
46
|
+
if (controller.signal.aborted) return;
|
|
47
|
+
console.warn('[Comnyx] Polling failed:', err);
|
|
37
48
|
});
|
|
38
|
-
|
|
39
|
-
|
|
49
|
+
}, NEW_MESSAGES_CHECK_INTERVAL);
|
|
50
|
+
|
|
40
51
|
return () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
52
|
+
clearInterval(interval);
|
|
53
|
+
controller.abort();
|
|
44
54
|
};
|
|
45
55
|
}, [customer, lastMessage?.created_at, setData]);
|
|
46
56
|
}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { darkTheme, lightTheme, type ThemeColors } from '../types/Theme';
|
|
3
|
+
import { useAppStore } from '../store/store';
|
|
2
4
|
|
|
3
5
|
export function useThemeColors(): ThemeColors {
|
|
4
|
-
|
|
6
|
+
const theme = useAppStore((s) => s.theme);
|
|
7
|
+
const override = useAppStore((s) => s.themeOverride);
|
|
8
|
+
|
|
9
|
+
return useMemo(() => {
|
|
10
|
+
const base = theme === 'dark' ? darkTheme : lightTheme;
|
|
11
|
+
const patch = override?.[theme];
|
|
12
|
+
return patch ? { ...base, ...patch } : base;
|
|
13
|
+
}, [theme, override]);
|
|
5
14
|
}
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,18 @@ export { ComnyxSupport } from './support';
|
|
|
5
5
|
export { ComnyxNotifications } from './notifications';
|
|
6
6
|
//types
|
|
7
7
|
export { NotificationPermissionStatus } from './NativeComnyx';
|
|
8
|
+
export type {
|
|
9
|
+
ThemeColors,
|
|
10
|
+
ThemeColorsOverride,
|
|
11
|
+
ThemeOverrideConfig,
|
|
12
|
+
} from './types/Theme';
|
|
13
|
+
export type {
|
|
14
|
+
SupportConfig,
|
|
15
|
+
SupportHeaderRenderProps,
|
|
16
|
+
SupportErrorRenderProps,
|
|
17
|
+
SupportMessageRenderProps,
|
|
18
|
+
SupportSendPayload,
|
|
19
|
+
} from './support';
|
|
8
20
|
|
|
9
21
|
//deprecated
|
|
10
22
|
export { registerOneSignalForComnyx } from './register/collectData';
|
|
@@ -81,10 +81,11 @@ function changePermissionStatus(status: NotificationPermissionStatus) {
|
|
|
81
81
|
|
|
82
82
|
async function initializeNativeNotifications(options: InitializeOptions) {
|
|
83
83
|
const state = useAppStore.getState();
|
|
84
|
-
//
|
|
84
|
+
// Listeners are attached BEFORE nativeComnyx.initialize so that a
|
|
85
|
+
// synchronous TOKEN_INIT emission (e.g. cached APN token on iOS) is not
|
|
86
|
+
// lost between native resolve and JS subscription.
|
|
85
87
|
globalSubscriptions.subscriptionsForNotification = [
|
|
86
88
|
ComnyxNotifications.addEventListener('TOKEN_INIT', (data) => {
|
|
87
|
-
console.log('TOKEN_INIT', data);
|
|
88
89
|
useAppStore.getState().setToken(data.token);
|
|
89
90
|
if (Platform.OS === 'ios') {
|
|
90
91
|
accumulator.add({
|
|
@@ -168,7 +169,11 @@ export async function initializeNotifications(
|
|
|
168
169
|
globalSubscriptions.subscriptionsForOptIn = AppState.addEventListener(
|
|
169
170
|
'change',
|
|
170
171
|
async (nextAppState) => {
|
|
171
|
-
|
|
172
|
+
// AppState callbacks are fire-and-forget — any throw here becomes an
|
|
173
|
+
// unhandled rejection that can surface as a red-screen in the host app.
|
|
174
|
+
// Keep the whole body inside a guard.
|
|
175
|
+
try {
|
|
176
|
+
if (nextAppState !== 'active') return;
|
|
172
177
|
const permissionGivenInForeground =
|
|
173
178
|
await ComnyxNotifications.checkOptIn();
|
|
174
179
|
changePermissionStatus(permissionGivenInForeground);
|
|
@@ -179,24 +184,21 @@ export async function initializeNotifications(
|
|
|
179
184
|
if (!state.notificationInitialized) {
|
|
180
185
|
await initializeNativeNotifications(options);
|
|
181
186
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
showAlertDialog();
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (!params.showOptInOnForeground) return;
|
|
190
|
+
const permissionResultInner = await ComnyxNotifications.optIn();
|
|
191
|
+
changePermissionStatus(permissionResultInner);
|
|
192
|
+
if (permissionResultInner === NotificationPermissionStatus.GRANTED) {
|
|
193
|
+
await initializeNativeNotifications(options);
|
|
194
|
+
} else if (
|
|
195
|
+
permissionResultInner === NotificationPermissionStatus.BLOCKED &&
|
|
196
|
+
params.linkToSettings
|
|
197
|
+
) {
|
|
198
|
+
showAlertDialog();
|
|
199
199
|
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
console.warn('[Comnyx] AppState handler failed', err);
|
|
200
202
|
}
|
|
201
203
|
}
|
|
202
204
|
);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateCustomerRequest } from '../types/Customer';
|
|
1
|
+
import type { CreateCustomerRequest, CustomParameter } from '../types/Customer';
|
|
2
2
|
|
|
3
3
|
const ACCUMULATOR_DEBOUNCE_TIME_IN_MS = 3000;
|
|
4
4
|
|
|
@@ -21,11 +21,17 @@ export class Accumulator {
|
|
|
21
21
|
|
|
22
22
|
add(data: Partial<Omit<CreateCustomerRequest, 'externalId'>>) {
|
|
23
23
|
if (!this.registerData) {
|
|
24
|
-
|
|
24
|
+
// Late events (push token callbacks, AppState changes) may arrive
|
|
25
|
+
// after logout() or before login(). Ignore silently instead of
|
|
26
|
+
// throwing so the host app is not crashed by SDK-internal races.
|
|
27
|
+
console.warn(
|
|
28
|
+
'[Comnyx] add() called before register/after logout — ignored'
|
|
29
|
+
);
|
|
30
|
+
return;
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
// First, create a map of existing custom parameters by name
|
|
28
|
-
const customParamsMap = new Map<string,
|
|
34
|
+
const customParamsMap = new Map<string, CustomParameter['value']>();
|
|
29
35
|
|
|
30
36
|
// Add existing parameters to the map
|
|
31
37
|
(this.registerData.customParameters || []).forEach((param) => {
|
|
@@ -59,10 +65,19 @@ export class Accumulator {
|
|
|
59
65
|
|
|
60
66
|
async flush() {
|
|
61
67
|
if (!this.registerData) {
|
|
62
|
-
|
|
68
|
+
console.warn(
|
|
69
|
+
'[Comnyx] flush() called before register/after logout — ignored'
|
|
70
|
+
);
|
|
71
|
+
return;
|
|
63
72
|
}
|
|
64
73
|
if (this.listener) {
|
|
65
|
-
|
|
74
|
+
try {
|
|
75
|
+
await this.listener(this.registerData!);
|
|
76
|
+
} catch (err) {
|
|
77
|
+
console.error('[Comnyx] flush listener error', err);
|
|
78
|
+
this.reset();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
66
81
|
this.registerData = {
|
|
67
82
|
...this.registerData,
|
|
68
83
|
customParameters: [],
|
|
@@ -74,14 +89,16 @@ export class Accumulator {
|
|
|
74
89
|
|
|
75
90
|
debounce() {
|
|
76
91
|
if (!this.registerData) {
|
|
77
|
-
|
|
92
|
+
return;
|
|
78
93
|
}
|
|
79
94
|
this.reset();
|
|
80
95
|
this.__select_time = setTimeout(() => {
|
|
81
|
-
if (this.listener) {
|
|
82
|
-
this.listener(this.registerData
|
|
96
|
+
if (this.listener && this.registerData) {
|
|
97
|
+
Promise.resolve(this.listener(this.registerData)).catch((err) => {
|
|
98
|
+
console.error('[Comnyx] debounce listener error', err);
|
|
99
|
+
});
|
|
83
100
|
this.registerData = {
|
|
84
|
-
...this.registerData
|
|
101
|
+
...this.registerData,
|
|
85
102
|
customParameters: [],
|
|
86
103
|
};
|
|
87
104
|
this._isListenerCalledOnce = true;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
import type { CustomParameter } from '../types/Customer';
|
|
1
2
|
import { accumulator } from './Accumulator';
|
|
2
3
|
|
|
3
|
-
export function collectData
|
|
4
|
+
export function collectData(key: string, value: CustomParameter['value']): void;
|
|
5
|
+
export function collectData(
|
|
6
|
+
data: Partial<Parameters<typeof accumulator.add>[0]>
|
|
7
|
+
): void;
|
|
8
|
+
export function collectData(
|
|
9
|
+
key: string | Partial<Parameters<typeof accumulator.add>[0]>,
|
|
10
|
+
value?: CustomParameter['value']
|
|
11
|
+
) {
|
|
4
12
|
if (typeof key === 'string') {
|
|
5
13
|
accumulator.add({
|
|
6
14
|
customParameters: [
|
|
7
15
|
{
|
|
8
16
|
name: key,
|
|
9
|
-
value,
|
|
17
|
+
value: value ?? null,
|
|
10
18
|
},
|
|
11
19
|
],
|
|
12
20
|
});
|