@developer_tribe/react-native-comnyx 0.7.6 → 0.8.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/android/build.gradle +12 -6
- package/android/generated/RCTAppDependencyProvider.h +25 -0
- package/android/generated/RCTAppDependencyProvider.mm +55 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/generated/RCTThirdPartyComponentsProvider.mm +23 -0
- package/android/generated/ReactAppDependencyProvider.podspec +34 -0
- package/android/generated/jni/RNComnyxSpec-generated.cpp +1 -11
- package/android/generated/jni/RNComnyxSpec.h +0 -7
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +0 -11
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +0 -52
- package/android/src/main/java/com/comnyx/ComnyxModule.kt +75 -7
- package/android/src/main/java/com/comnyx/ComnyxPackage.kt +0 -3
- package/android/src/main/java/com/comnyx/src/messaging/firebase/FirebaseMessagingService.kt +1 -9
- package/android/src/main/java/com/comnyx/src/messaging/notifications/NotificationsService.kt +105 -8
- package/ios/Comnyx.m +2 -2
- package/ios/Comnyx.swift +83 -20
- 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 +0 -23
- package/ios/generated/RNComnyxSpec/RNComnyxSpec.h +0 -25
- package/ios/generated/RNComnyxSpecJSI-generated.cpp +0 -11
- package/ios/generated/RNComnyxSpecJSI.h +0 -52
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/lib/commonjs/NativeComnyx.js.map +1 -1
- package/lib/commonjs/api/api.js +4 -0
- package/lib/commonjs/api/api.js.map +1 -1
- package/lib/commonjs/components/ChatList.js +100 -106
- package/lib/commonjs/components/ChatList.js.map +1 -1
- package/lib/commonjs/components/CustomerForm.js +173 -179
- package/lib/commonjs/components/CustomerForm.js.map +1 -1
- package/lib/commonjs/components/EmptyList.js +5 -7
- package/lib/commonjs/components/EmptyList.js.map +1 -1
- package/lib/commonjs/constants/translations.js +145 -29
- package/lib/commonjs/constants/translations.js.map +1 -1
- package/lib/commonjs/hooks/useLocalize.js +7 -0
- package/lib/commonjs/hooks/useLocalize.js.map +1 -1
- package/lib/commonjs/notifications/index.js +2 -1
- package/lib/commonjs/notifications/index.js.map +1 -1
- package/lib/commonjs/notifications/initializeNotifications.js +137 -0
- package/lib/commonjs/notifications/initializeNotifications.js.map +1 -0
- package/lib/commonjs/register/login.js +1 -1
- package/lib/commonjs/register/login.js.map +1 -1
- package/lib/commonjs/store/store.js +14 -1
- package/lib/commonjs/store/store.js.map +1 -1
- package/lib/module/NativeComnyx.js.map +1 -1
- package/lib/module/api/api.js +3 -0
- package/lib/module/api/api.js.map +1 -1
- package/lib/module/components/ChatList.js +101 -107
- package/lib/module/components/ChatList.js.map +1 -1
- package/lib/module/components/CustomerForm.js +174 -180
- package/lib/module/components/CustomerForm.js.map +1 -1
- package/lib/module/components/EmptyList.js +6 -8
- package/lib/module/components/EmptyList.js.map +1 -1
- package/lib/module/constants/translations.js +145 -29
- package/lib/module/constants/translations.js.map +1 -1
- package/lib/module/hooks/useLocalize.js +6 -0
- package/lib/module/hooks/useLocalize.js.map +1 -1
- package/lib/module/notifications/index.js +2 -1
- package/lib/module/notifications/index.js.map +1 -1
- package/lib/module/notifications/initializeNotifications.js +133 -0
- package/lib/module/notifications/initializeNotifications.js.map +1 -0
- package/lib/module/register/login.js +1 -1
- package/lib/module/register/login.js.map +1 -1
- package/lib/module/store/store.js +14 -1
- package/lib/module/store/store.js.map +1 -1
- package/lib/typescript/src/NativeComnyx.d.ts +6 -1
- package/lib/typescript/src/NativeComnyx.d.ts.map +1 -1
- package/lib/typescript/src/api/api.d.ts +1 -0
- package/lib/typescript/src/api/api.d.ts.map +1 -1
- package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomerForm.d.ts.map +1 -1
- package/lib/typescript/src/components/EmptyList.d.ts.map +1 -1
- package/lib/typescript/src/constants/translations.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useLocalize.d.ts +1 -0
- package/lib/typescript/src/hooks/useLocalize.d.ts.map +1 -1
- package/lib/typescript/src/notifications/index.d.ts +63 -4
- package/lib/typescript/src/notifications/index.d.ts.map +1 -1
- package/lib/typescript/src/notifications/initializeNotifications.d.ts +7 -0
- package/lib/typescript/src/notifications/initializeNotifications.d.ts.map +1 -0
- package/lib/typescript/src/store/store.d.ts +4 -0
- package/lib/typescript/src/store/store.d.ts.map +1 -1
- package/lib/typescript/src/types/Customer.d.ts +5 -0
- package/lib/typescript/src/types/Customer.d.ts.map +1 -1
- package/lib/typescript/src/types/LocalizationKeys.d.ts +4 -0
- package/lib/typescript/src/types/LocalizationKeys.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeComnyx.ts +6 -1
- package/src/api/api.ts +4 -0
- package/src/components/ChatList.tsx +110 -123
- package/src/components/CustomerForm.tsx +194 -212
- package/src/components/EmptyList.tsx +3 -10
- package/src/constants/translations.ts +145 -0
- package/src/hooks/useLocalize.ts +6 -0
- package/src/notifications/index.ts +69 -5
- package/src/notifications/initializeNotifications.ts +180 -0
- package/src/register/login.ts +1 -1
- package/src/store/store.ts +13 -0
- package/src/types/Customer.ts +5 -0
- package/src/types/LocalizationKeys.ts +4 -0
- package/android/generated/java/com/comnyx/NativeComnyxSpec.java +0 -37
- package/lib/typescript/setup-jest.d.ts +0 -1
- package/lib/typescript/setup-jest.d.ts.map +0 -1
|
@@ -48,6 +48,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
48
48
|
'customer.form.failed.phone': 'Wrong phone number',
|
|
49
49
|
'customer.form.failed.phone.desc': 'Please fix your phone number.',
|
|
50
50
|
'customer.form.cancel': 'Close',
|
|
51
|
+
'notifications.optIn.title': 'Enable Notifications',
|
|
52
|
+
'notifications.optIn.description':
|
|
53
|
+
'Get notified when you receive new messages from our support team.',
|
|
54
|
+
'notifications.optIn.cancel': 'Not Now',
|
|
55
|
+
'notifications.optIn.openSettings': 'Open Settings',
|
|
51
56
|
},
|
|
52
57
|
tr: {
|
|
53
58
|
'customer.form.title': 'Merhaba👋',
|
|
@@ -95,6 +100,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
95
100
|
'customer.form.failed.phone': 'Yanlış telefon numarası',
|
|
96
101
|
'customer.form.failed.phone.desc': 'Lütfen telefon numaranızı düzeltin.',
|
|
97
102
|
'customer.form.cancel': 'Kapat',
|
|
103
|
+
'notifications.optIn.title': 'Bildirimleri Etkinleştir',
|
|
104
|
+
'notifications.optIn.description':
|
|
105
|
+
'Destek ekibimizden yeni mesajlar aldığınızda bildirim alın.',
|
|
106
|
+
'notifications.optIn.cancel': 'Şimdi Değil',
|
|
107
|
+
'notifications.optIn.openSettings': 'Ayarları Aç',
|
|
98
108
|
},
|
|
99
109
|
es: {
|
|
100
110
|
'customer.form.title': 'Hola👋',
|
|
@@ -144,6 +154,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
144
154
|
'customer.form.failed.phone.desc':
|
|
145
155
|
'Por favor corrija su número de teléfono.',
|
|
146
156
|
'customer.form.cancel': 'Cerrar',
|
|
157
|
+
'notifications.optIn.title': 'Habilitar Notificaciones',
|
|
158
|
+
'notifications.optIn.description':
|
|
159
|
+
'Recibe notificaciones cuando recibas nuevos mensajes de nuestro equipo de soporte.',
|
|
160
|
+
'notifications.optIn.cancel': 'Ahora No',
|
|
161
|
+
'notifications.optIn.openSettings': 'Abrir Configuración',
|
|
147
162
|
},
|
|
148
163
|
fr: {
|
|
149
164
|
'customer.form.title': 'Bonjour👋',
|
|
@@ -194,6 +209,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
194
209
|
'customer.form.failed.phone.desc':
|
|
195
210
|
'Veuillez corriger votre numéro de téléphone.',
|
|
196
211
|
'customer.form.cancel': 'Fermer',
|
|
212
|
+
'notifications.optIn.title': 'Activer les Notifications',
|
|
213
|
+
'notifications.optIn.description':
|
|
214
|
+
'Recevez des notifications lorsque vous recevez de nouveaux messages de notre équipe de support.',
|
|
215
|
+
'notifications.optIn.cancel': 'Pas Maintenant',
|
|
216
|
+
'notifications.optIn.openSettings': 'Ouvrir les Paramètres',
|
|
197
217
|
},
|
|
198
218
|
de: {
|
|
199
219
|
'customer.form.title': 'Hallo👋',
|
|
@@ -245,6 +265,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
245
265
|
'customer.form.failed.phone.desc':
|
|
246
266
|
'Bitte korrigieren Sie Ihre Telefonnummer.',
|
|
247
267
|
'customer.form.cancel': 'Schließen',
|
|
268
|
+
'notifications.optIn.title': 'Benachrichtigungen Aktivieren',
|
|
269
|
+
'notifications.optIn.description':
|
|
270
|
+
'Erhalten Sie Benachrichtigungen, wenn Sie neue Nachrichten von unserem Support-Team erhalten.',
|
|
271
|
+
'notifications.optIn.cancel': 'Nicht Jetzt',
|
|
272
|
+
'notifications.optIn.openSettings': 'Einstellungen Öffnen',
|
|
248
273
|
},
|
|
249
274
|
it: {
|
|
250
275
|
'customer.form.title': 'Ciao👋',
|
|
@@ -293,6 +318,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
293
318
|
'customer.form.failed.phone.desc':
|
|
294
319
|
'Per favore correggi il tuo numero di telefono.',
|
|
295
320
|
'customer.form.cancel': 'Chiudi',
|
|
321
|
+
'notifications.optIn.title': 'Abilita Notifiche',
|
|
322
|
+
'notifications.optIn.description':
|
|
323
|
+
'Ricevi notifiche quando ricevi nuovi messaggi dal nostro team di supporto.',
|
|
324
|
+
'notifications.optIn.cancel': 'Non Ora',
|
|
325
|
+
'notifications.optIn.openSettings': 'Apri Impostazioni',
|
|
296
326
|
},
|
|
297
327
|
pt: {
|
|
298
328
|
'customer.form.title': 'Olá👋',
|
|
@@ -343,6 +373,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
343
373
|
'customer.form.failed.phone.desc':
|
|
344
374
|
'Por favor, corrija seu número de telefone.',
|
|
345
375
|
'customer.form.cancel': 'Fechar',
|
|
376
|
+
'notifications.optIn.title': 'Ativar Notificações',
|
|
377
|
+
'notifications.optIn.description':
|
|
378
|
+
'Receba notificações quando receber novas mensagens da nossa equipe de suporte.',
|
|
379
|
+
'notifications.optIn.cancel': 'Agora Não',
|
|
380
|
+
'notifications.optIn.openSettings': 'Abrir Configurações',
|
|
346
381
|
},
|
|
347
382
|
ru: {
|
|
348
383
|
'customer.form.title': 'Привет👋',
|
|
@@ -393,6 +428,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
393
428
|
'customer.form.failed.phone.desc':
|
|
394
429
|
'Пожалуйста, исправьте ваш номер телефона.',
|
|
395
430
|
'customer.form.cancel': 'Закрыть',
|
|
431
|
+
'notifications.optIn.title': 'Включить Уведомления',
|
|
432
|
+
'notifications.optIn.description':
|
|
433
|
+
'Получайте уведомления о новых сообщениях от нашей службы поддержки.',
|
|
434
|
+
'notifications.optIn.cancel': 'Не Сейчас',
|
|
435
|
+
'notifications.optIn.openSettings': 'Открыть Настройки',
|
|
396
436
|
},
|
|
397
437
|
ja: {
|
|
398
438
|
'customer.form.title': 'こんにちは👋',
|
|
@@ -440,6 +480,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
440
480
|
'customer.form.failed.phone': '電話番号が間違っています',
|
|
441
481
|
'customer.form.failed.phone.desc': '電話番号を修正してください。',
|
|
442
482
|
'customer.form.cancel': '閉じる',
|
|
483
|
+
'notifications.optIn.title': '通知を有効にする',
|
|
484
|
+
'notifications.optIn.description':
|
|
485
|
+
'サポートチームから新しいメッセージを受信したときに通知を受け取ります。',
|
|
486
|
+
'notifications.optIn.cancel': '今はしない',
|
|
487
|
+
'notifications.optIn.openSettings': '設定を開く',
|
|
443
488
|
},
|
|
444
489
|
zh: {
|
|
445
490
|
'customer.form.title': '你好👋',
|
|
@@ -482,6 +527,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
482
527
|
'customer.form.failed.phone': '电话号码错误',
|
|
483
528
|
'customer.form.failed.phone.desc': '请修正您的电话号码。',
|
|
484
529
|
'customer.form.cancel': '关闭',
|
|
530
|
+
'notifications.optIn.title': '启用通知',
|
|
531
|
+
'notifications.optIn.description':
|
|
532
|
+
'当您收到我们支持团队的新消息时获得通知。',
|
|
533
|
+
'notifications.optIn.cancel': '暂不',
|
|
534
|
+
'notifications.optIn.openSettings': '打开设置',
|
|
485
535
|
},
|
|
486
536
|
ar: {
|
|
487
537
|
'customer.form.title': 'مرحباً👋',
|
|
@@ -527,6 +577,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
527
577
|
'customer.form.failed.phone': 'رقم هاتف خاطئ',
|
|
528
578
|
'customer.form.failed.phone.desc': 'يرجى تصحيح رقم هاتفك.',
|
|
529
579
|
'customer.form.cancel': 'إغلاق',
|
|
580
|
+
'notifications.optIn.title': 'تفعيل الإشعارات',
|
|
581
|
+
'notifications.optIn.description':
|
|
582
|
+
'احصل على إشعارات عند تلقي رسائل جديدة من فريق الدعم.',
|
|
583
|
+
'notifications.optIn.cancel': 'ليس الآن',
|
|
584
|
+
'notifications.optIn.openSettings': 'فتح الإعدادات',
|
|
530
585
|
},
|
|
531
586
|
id: {
|
|
532
587
|
'customer.form.title': 'Halo👋',
|
|
@@ -573,6 +628,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
573
628
|
'customer.form.failed.phone': 'Nombor telefon salah',
|
|
574
629
|
'customer.form.failed.phone.desc': 'Sila betulkan nombor telefon anda.',
|
|
575
630
|
'customer.form.cancel': 'Tutup',
|
|
631
|
+
'notifications.optIn.title': 'Aktifkan Notifikasi',
|
|
632
|
+
'notifications.optIn.description':
|
|
633
|
+
'Dapatkan notifikasi saat Anda menerima pesan baru dari tim dukungan kami.',
|
|
634
|
+
'notifications.optIn.cancel': 'Tidak Sekarang',
|
|
635
|
+
'notifications.optIn.openSettings': 'Buka Pengaturan',
|
|
576
636
|
},
|
|
577
637
|
vi: {
|
|
578
638
|
'customer.form.title': 'Xin chào👋',
|
|
@@ -618,6 +678,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
618
678
|
'customer.form.failed.phone': 'Số điện thoại sai',
|
|
619
679
|
'customer.form.failed.phone.desc': 'Vui lòng sửa số điện thoại của bạn.',
|
|
620
680
|
'customer.form.cancel': 'Đóng',
|
|
681
|
+
'notifications.optIn.title': 'Bật Thông Báo',
|
|
682
|
+
'notifications.optIn.description':
|
|
683
|
+
'Nhận thông báo khi bạn nhận được tin nhắn mới từ đội hỗ trợ của chúng tôi.',
|
|
684
|
+
'notifications.optIn.cancel': 'Không Phải Bây Giờ',
|
|
685
|
+
'notifications.optIn.openSettings': 'Mở Cài Đặt',
|
|
621
686
|
},
|
|
622
687
|
sv: {
|
|
623
688
|
'customer.form.title': 'Hej👋',
|
|
@@ -665,6 +730,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
665
730
|
'customer.form.failed.phone': 'Fel telefonnummer',
|
|
666
731
|
'customer.form.failed.phone.desc': 'Vänligen korrigera ditt telefonnummer.',
|
|
667
732
|
'customer.form.cancel': 'Stäng',
|
|
733
|
+
'notifications.optIn.title': 'Aktivera Notifieringar',
|
|
734
|
+
'notifications.optIn.description':
|
|
735
|
+
'Få notifieringar när du får nya meddelanden från vårt supportteam.',
|
|
736
|
+
'notifications.optIn.cancel': 'Inte Nu',
|
|
737
|
+
'notifications.optIn.openSettings': 'Öppna Inställningar',
|
|
668
738
|
},
|
|
669
739
|
ko: {
|
|
670
740
|
'customer.form.title': '안녕하세요👋',
|
|
@@ -708,6 +778,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
708
778
|
'customer.form.failed.phone': '잘못된 전화번호',
|
|
709
779
|
'customer.form.failed.phone.desc': '전화번호를 수정하세요.',
|
|
710
780
|
'customer.form.cancel': '닫기',
|
|
781
|
+
'notifications.optIn.title': '알림 활성화',
|
|
782
|
+
'notifications.optIn.description':
|
|
783
|
+
'지원 팀으로부터 새 메시지를 수신할 때 알림을 받습니다.',
|
|
784
|
+
'notifications.optIn.cancel': '나중에',
|
|
785
|
+
'notifications.optIn.openSettings': '설정 열기',
|
|
711
786
|
},
|
|
712
787
|
hi: {
|
|
713
788
|
'customer.form.title': 'नमस्ते👋',
|
|
@@ -756,6 +831,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
756
831
|
'customer.form.failed.phone': 'गलत फोन नंबर',
|
|
757
832
|
'customer.form.failed.phone.desc': 'कृपया अपना फोन नंबर सही करें।',
|
|
758
833
|
'customer.form.cancel': 'बंद करें',
|
|
834
|
+
'notifications.optIn.title': 'सूचनाएं सक्षम करें',
|
|
835
|
+
'notifications.optIn.description':
|
|
836
|
+
'हमारी सपोर्ट टीम से नए संदेश प्राप्त करने पर सूचनाएं प्राप्त करें।',
|
|
837
|
+
'notifications.optIn.cancel': 'अभी नहीं',
|
|
838
|
+
'notifications.optIn.openSettings': 'सेटिंग्स खोलें',
|
|
759
839
|
},
|
|
760
840
|
nl: {
|
|
761
841
|
'customer.form.title': 'Hallo👋',
|
|
@@ -803,6 +883,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
803
883
|
'customer.form.failed.phone': 'Verkeerd telefoonnummer',
|
|
804
884
|
'customer.form.failed.phone.desc': 'Corrigeer uw telefoonnummer.',
|
|
805
885
|
'customer.form.cancel': 'Sluiten',
|
|
886
|
+
'notifications.optIn.title': 'Meldingen Inschakelen',
|
|
887
|
+
'notifications.optIn.description':
|
|
888
|
+
'Ontvang meldingen wanneer u nieuwe berichten van ons supportteam ontvangt.',
|
|
889
|
+
'notifications.optIn.cancel': 'Niet Nu',
|
|
890
|
+
'notifications.optIn.openSettings': 'Instellingen Openen',
|
|
806
891
|
},
|
|
807
892
|
he: {
|
|
808
893
|
'customer.form.title': 'שלום👋',
|
|
@@ -846,6 +931,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
846
931
|
'customer.form.failed.phone': 'מספר טלפון שגוי',
|
|
847
932
|
'customer.form.failed.phone.desc': 'אנא תקנו את מספר הטלפון שלך.',
|
|
848
933
|
'customer.form.cancel': 'סגור',
|
|
934
|
+
'notifications.optIn.title': 'הפעל התראות',
|
|
935
|
+
'notifications.optIn.description':
|
|
936
|
+
'קבל התראות כאשר אתה מקבל הודעות חדשות מצוות התמיכה שלנו.',
|
|
937
|
+
'notifications.optIn.cancel': 'לא עכשיו',
|
|
938
|
+
'notifications.optIn.openSettings': 'פתח הגדרות',
|
|
849
939
|
},
|
|
850
940
|
uk: {
|
|
851
941
|
'customer.form.title': 'Привіт👋',
|
|
@@ -894,6 +984,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
894
984
|
'customer.form.failed.phone': 'Неправильний телефонний номер',
|
|
895
985
|
'customer.form.failed.phone.desc': 'Виправте ваш телефонний номер.',
|
|
896
986
|
'customer.form.cancel': 'Закрити',
|
|
987
|
+
'notifications.optIn.title': 'Увімкнути Сповіщення',
|
|
988
|
+
'notifications.optIn.description':
|
|
989
|
+
'Отримуйте сповіщення, коли ви отримуєте нові повідомлення від нашої команди підтримки.',
|
|
990
|
+
'notifications.optIn.cancel': 'Не Зараз',
|
|
991
|
+
'notifications.optIn.openSettings': 'Відкрити Налаштування',
|
|
897
992
|
},
|
|
898
993
|
hu: {
|
|
899
994
|
'customer.form.title': 'Helló👋',
|
|
@@ -943,6 +1038,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
943
1038
|
'customer.form.failed.phone': 'Hibás telefonszám',
|
|
944
1039
|
'customer.form.failed.phone.desc': 'Kérjük, javítsd a telefonszámod.',
|
|
945
1040
|
'customer.form.cancel': 'Bezárás',
|
|
1041
|
+
'notifications.optIn.title': 'Értesítések Engedélyezése',
|
|
1042
|
+
'notifications.optIn.description':
|
|
1043
|
+
'Kapj értesítéseket, amikor új üzeneteket kapsz a támogató csapatunktól.',
|
|
1044
|
+
'notifications.optIn.cancel': 'Most Nem',
|
|
1045
|
+
'notifications.optIn.openSettings': 'Beállítások Megnyitása',
|
|
946
1046
|
},
|
|
947
1047
|
ro: {
|
|
948
1048
|
'customer.form.title': 'Salut👋',
|
|
@@ -993,6 +1093,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
993
1093
|
'customer.form.failed.phone.desc':
|
|
994
1094
|
'Te rugăm să îți corectezi numărul de telefon.',
|
|
995
1095
|
'customer.form.cancel': 'Închide',
|
|
1096
|
+
'notifications.optIn.title': 'Activează Notificările',
|
|
1097
|
+
'notifications.optIn.description':
|
|
1098
|
+
'Primește notificări când primești mesaje noi de la echipa noastră de suport.',
|
|
1099
|
+
'notifications.optIn.cancel': 'Nu Acum',
|
|
1100
|
+
'notifications.optIn.openSettings': 'Deschide Setările',
|
|
996
1101
|
},
|
|
997
1102
|
ms: {
|
|
998
1103
|
'customer.form.title': 'Hai👋',
|
|
@@ -1039,6 +1144,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1039
1144
|
'customer.form.failed.phone': 'Nombor telefon salah',
|
|
1040
1145
|
'customer.form.failed.phone.desc': 'Sila betulkan nombor telefon anda.',
|
|
1041
1146
|
'customer.form.cancel': 'Tutup',
|
|
1147
|
+
'notifications.optIn.title': 'Hidupkan Pemberitahuan',
|
|
1148
|
+
'notifications.optIn.description':
|
|
1149
|
+
'Terima pemberitahuan apabila anda menerima mesej baharu daripada pasukan sokongan kami.',
|
|
1150
|
+
'notifications.optIn.cancel': 'Bukan Sekarang',
|
|
1151
|
+
'notifications.optIn.openSettings': 'Buka Tetapan',
|
|
1042
1152
|
},
|
|
1043
1153
|
az: {
|
|
1044
1154
|
'customer.form.title': 'Salam👋',
|
|
@@ -1086,6 +1196,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1086
1196
|
'customer.form.failed.phone.desc':
|
|
1087
1197
|
'Zəhmət olmasa telefon nömrənizi düzəldin.',
|
|
1088
1198
|
'customer.form.cancel': 'Bağla',
|
|
1199
|
+
'notifications.optIn.title': 'Bildirişləri Aktivləşdir',
|
|
1200
|
+
'notifications.optIn.description':
|
|
1201
|
+
'Dəstək komandamızdan yeni mesajlar aldığınızda bildiriş alın.',
|
|
1202
|
+
'notifications.optIn.cancel': 'İndi Yox',
|
|
1203
|
+
'notifications.optIn.openSettings': 'Ayarları Aç',
|
|
1089
1204
|
},
|
|
1090
1205
|
hr: {
|
|
1091
1206
|
'customer.form.title': 'Bok👋',
|
|
@@ -1131,6 +1246,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1131
1246
|
'customer.form.failed.phone': 'Pogrešan broj telefona',
|
|
1132
1247
|
'customer.form.failed.phone.desc': 'Ispravite svoj broj telefona.',
|
|
1133
1248
|
'customer.form.cancel': 'Zatvori',
|
|
1249
|
+
'notifications.optIn.title': 'Omogući Obavijesti',
|
|
1250
|
+
'notifications.optIn.description':
|
|
1251
|
+
'Primajte obavijesti kada primite nove poruke od našeg tima za podršku.',
|
|
1252
|
+
'notifications.optIn.cancel': 'Ne Sada',
|
|
1253
|
+
'notifications.optIn.openSettings': 'Otvori Postavke',
|
|
1134
1254
|
},
|
|
1135
1255
|
kk: {
|
|
1136
1256
|
'customer.form.title': 'Сәлем👋',
|
|
@@ -1178,6 +1298,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1178
1298
|
'customer.form.failed.phone': 'Қате телефон нөірі',
|
|
1179
1299
|
'customer.form.failed.phone.desc': 'Телефон нөіріңізді түзетіңіз.',
|
|
1180
1300
|
'customer.form.cancel': 'Жабу',
|
|
1301
|
+
'notifications.optIn.title': 'Хабарландыруларды Қосу',
|
|
1302
|
+
'notifications.optIn.description':
|
|
1303
|
+
'Қолдау тобымыздан жаңа хабарламалар алғанда хабарландыру алыңыз.',
|
|
1304
|
+
'notifications.optIn.cancel': 'Қазір Емес',
|
|
1305
|
+
'notifications.optIn.openSettings': 'Параметрлерді Ашу',
|
|
1181
1306
|
},
|
|
1182
1307
|
af: {
|
|
1183
1308
|
'customer.form.title': 'Hallo👋',
|
|
@@ -1226,6 +1351,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1226
1351
|
'customer.form.failed.phone.desc':
|
|
1227
1352
|
'Korrigeer asseblief jou telefoonnommer.',
|
|
1228
1353
|
'customer.form.cancel': 'Maak toe',
|
|
1354
|
+
'notifications.optIn.title': 'Aktiveer Kennisgewings',
|
|
1355
|
+
'notifications.optIn.description':
|
|
1356
|
+
'Kry kennisgewings wanneer jy nuwe boodskappe van ons ondersteuningspan ontvang.',
|
|
1357
|
+
'notifications.optIn.cancel': 'Nie Nou Nie',
|
|
1358
|
+
'notifications.optIn.openSettings': 'Maak Instellings Oop',
|
|
1229
1359
|
},
|
|
1230
1360
|
yo: {
|
|
1231
1361
|
'customer.form.title': 'Báwo👋',
|
|
@@ -1270,6 +1400,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1270
1400
|
'customer.form.failed.phone': 'Nọ́mbà fóònù àìtọ́',
|
|
1271
1401
|
'customer.form.failed.phone.desc': 'Jọ̀wọ́, ṣàtúnṣe nọ́mbà fóònù rẹ.',
|
|
1272
1402
|
'customer.form.cancel': 'Pa mọ́',
|
|
1403
|
+
'notifications.optIn.title': 'Ṣí Àwọn Ìmọ̀',
|
|
1404
|
+
'notifications.optIn.description':
|
|
1405
|
+
'Gba àwọn ìmọ̀ nígbà tí o bá gba àwọn ìrántí tuntun láti ọ̀dọ̀ ẹgbẹ́ atilẹ́yin wa.',
|
|
1406
|
+
'notifications.optIn.cancel': 'Kì í ṣe Báyìí',
|
|
1407
|
+
'notifications.optIn.openSettings': 'Ṣí Àwọn Ètò',
|
|
1273
1408
|
},
|
|
1274
1409
|
da: {
|
|
1275
1410
|
'customer.form.title': 'Hej👋',
|
|
@@ -1316,6 +1451,11 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1316
1451
|
'customer.form.failed.phone': 'Forkert telefonnummer',
|
|
1317
1452
|
'customer.form.failed.phone.desc': 'Ret venligst dit telefonnummer.',
|
|
1318
1453
|
'customer.form.cancel': 'Luk',
|
|
1454
|
+
'notifications.optIn.title': 'Aktivér Notifikationer',
|
|
1455
|
+
'notifications.optIn.description':
|
|
1456
|
+
'Få notifikationer når du modtager nye beskeder fra vores supportteam.',
|
|
1457
|
+
'notifications.optIn.cancel': 'Ikke Nu',
|
|
1458
|
+
'notifications.optIn.openSettings': 'Åbn Indstillinger',
|
|
1319
1459
|
},
|
|
1320
1460
|
pl: {
|
|
1321
1461
|
'customer.form.title': 'Cześć👋',
|
|
@@ -1362,5 +1502,10 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1362
1502
|
'customer.form.failed.phone': 'Błędny numer telefonu',
|
|
1363
1503
|
'customer.form.failed.phone.desc': 'Popraw swój numer telefonu.',
|
|
1364
1504
|
'customer.form.cancel': 'Zamknij',
|
|
1505
|
+
'notifications.optIn.title': 'Włącz Powiadomienia',
|
|
1506
|
+
'notifications.optIn.description':
|
|
1507
|
+
'Otrzymuj powiadomienia gdy otrzymasz nowe wiadomości od naszego zespołu wsparcia.',
|
|
1508
|
+
'notifications.optIn.cancel': 'Nie Teraz',
|
|
1509
|
+
'notifications.optIn.openSettings': 'Otwórz Ustawienia',
|
|
1365
1510
|
},
|
|
1366
1511
|
} as const;
|
package/src/hooks/useLocalize.ts
CHANGED
|
@@ -16,3 +16,9 @@ export function useLocalize() {
|
|
|
16
16
|
[language]
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
export function localize(localization: keyof LocalizationKeys): string {
|
|
21
|
+
const { language } = useAppStore.getState();
|
|
22
|
+
return (LocalizationList[language as keyof typeof LocalizationList] ||
|
|
23
|
+
LocalizationList.en)[localization];
|
|
24
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Platform, type EmitterSubscription } from 'react-native';
|
|
2
2
|
import { NativeEventEmitter } from 'react-native';
|
|
3
3
|
import { NativeModules } from 'react-native';
|
|
4
|
-
import { nativeComnyx,
|
|
4
|
+
import { nativeComnyx, NotificationPermissionStatus } from '../NativeComnyx';
|
|
5
|
+
import {
|
|
6
|
+
initializeNotifications,
|
|
7
|
+
type InitializeNotificationsParams,
|
|
8
|
+
} from './initializeNotifications';
|
|
5
9
|
|
|
6
10
|
const comnyxEmitter =
|
|
7
11
|
Platform.OS === 'android'
|
|
@@ -14,6 +18,40 @@ type ComnyxNotificationsEventType =
|
|
|
14
18
|
| 'NOTIFICATION_RECEIVED'
|
|
15
19
|
| 'NOTIFICATION_CLICKED';
|
|
16
20
|
|
|
21
|
+
type IOSRawNotification = {
|
|
22
|
+
request: {
|
|
23
|
+
identifier: string;
|
|
24
|
+
content: {
|
|
25
|
+
title: string;
|
|
26
|
+
body: string;
|
|
27
|
+
subtitle: string;
|
|
28
|
+
badge: number;
|
|
29
|
+
sound: string;
|
|
30
|
+
userInfo: unknown;
|
|
31
|
+
categoryIdentifier: string;
|
|
32
|
+
threadIdentifier: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
type AndroidRawNotification = {};
|
|
37
|
+
|
|
38
|
+
type IOSRawNotificationResponse = {
|
|
39
|
+
request: {
|
|
40
|
+
identifier: string;
|
|
41
|
+
content: {
|
|
42
|
+
title: string;
|
|
43
|
+
body: string;
|
|
44
|
+
subtitle: string;
|
|
45
|
+
badge: number;
|
|
46
|
+
sound: string;
|
|
47
|
+
userInfo: unknown;
|
|
48
|
+
categoryIdentifier: string;
|
|
49
|
+
threadIdentifier: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
type AndroidRawNotificationResponse = {};
|
|
54
|
+
|
|
17
55
|
type ComnyxNotificationsEventResult = {
|
|
18
56
|
TOKEN_INIT: {
|
|
19
57
|
type: string;
|
|
@@ -23,11 +61,37 @@ type ComnyxNotificationsEventResult = {
|
|
|
23
61
|
type: string;
|
|
24
62
|
token: null;
|
|
25
63
|
};
|
|
26
|
-
NOTIFICATION_RECEIVED:
|
|
27
|
-
|
|
64
|
+
NOTIFICATION_RECEIVED: {
|
|
65
|
+
type: string;
|
|
66
|
+
notification: {
|
|
67
|
+
title: string;
|
|
68
|
+
body: string;
|
|
69
|
+
subtitle: string;
|
|
70
|
+
badge: number;
|
|
71
|
+
sound: string;
|
|
72
|
+
data: unknown;
|
|
73
|
+
raw: IOSRawNotification | AndroidRawNotification;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
NOTIFICATION_CLICKED: {
|
|
77
|
+
type: string;
|
|
78
|
+
notification: {
|
|
79
|
+
title: string;
|
|
80
|
+
body: string;
|
|
81
|
+
subtitle: string;
|
|
82
|
+
badge: number;
|
|
83
|
+
sound: string;
|
|
84
|
+
data: unknown;
|
|
85
|
+
raw: IOSRawNotificationResponse | AndroidRawNotificationResponse;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
28
88
|
};
|
|
29
89
|
|
|
30
|
-
interface ComnyxNotificationsType
|
|
90
|
+
interface ComnyxNotificationsType {
|
|
91
|
+
initialize: (params?: InitializeNotificationsParams) => Promise<boolean>;
|
|
92
|
+
optIn: () => Promise<NotificationPermissionStatus>;
|
|
93
|
+
checkOptIn: () => Promise<NotificationPermissionStatus>;
|
|
94
|
+
linkToSettings: () => Promise<boolean>;
|
|
31
95
|
addEventListener<T extends ComnyxNotificationsEventType>(
|
|
32
96
|
event: T,
|
|
33
97
|
listener: (event: ComnyxNotificationsEventResult[T]) => void
|
|
@@ -35,7 +99,7 @@ interface ComnyxNotificationsType extends NativeComnyx {
|
|
|
35
99
|
}
|
|
36
100
|
|
|
37
101
|
export const ComnyxNotifications: ComnyxNotificationsType = {
|
|
38
|
-
initialize:
|
|
102
|
+
initialize: initializeNotifications,
|
|
39
103
|
optIn: nativeComnyx.optIn,
|
|
40
104
|
checkOptIn: nativeComnyx.checkOptIn,
|
|
41
105
|
linkToSettings: nativeComnyx.linkToSettings,
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Alert,
|
|
3
|
+
AppState,
|
|
4
|
+
type EmitterSubscription,
|
|
5
|
+
type NativeEventSubscription,
|
|
6
|
+
Platform,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import { ComnyxNotifications } from '.';
|
|
9
|
+
import { nativeComnyx, NotificationPermissionStatus } from '../NativeComnyx';
|
|
10
|
+
import { useAppStore } from '../store/store';
|
|
11
|
+
import { isInitCalled, isLoginCalled } from '../api/api';
|
|
12
|
+
import { localize } from '../hooks/useLocalize';
|
|
13
|
+
import { accumulator } from '../register/Accumulator';
|
|
14
|
+
|
|
15
|
+
let globalSubscriptions = {
|
|
16
|
+
subscriptionsForNotification: [] as EmitterSubscription[],
|
|
17
|
+
subscriptionsForOptIn: null as NativeEventSubscription | null,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface InitializeNotificationsParams {
|
|
21
|
+
showOptIn?: boolean;
|
|
22
|
+
showOptInOnForeground?: boolean;
|
|
23
|
+
linkToSettings?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function showAlertDialog() {
|
|
27
|
+
Alert.alert(
|
|
28
|
+
localize('notifications.optIn.title'),
|
|
29
|
+
localize('notifications.optIn.description'),
|
|
30
|
+
[
|
|
31
|
+
{
|
|
32
|
+
text: localize('notifications.optIn.cancel'),
|
|
33
|
+
style: 'cancel',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
text: localize('notifications.optIn.openSettings'),
|
|
37
|
+
onPress: () => {
|
|
38
|
+
ComnyxNotifications.linkToSettings();
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function changePermissionStatus(status: NotificationPermissionStatus) {
|
|
46
|
+
const state = useAppStore.getState();
|
|
47
|
+
|
|
48
|
+
if (status === NotificationPermissionStatus.GRANTED) {
|
|
49
|
+
state.setPermissionGiven(true);
|
|
50
|
+
accumulator.add({
|
|
51
|
+
allow_notifications: true,
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
state.setPermissionGiven(false);
|
|
55
|
+
accumulator.add({
|
|
56
|
+
allow_notifications: false,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function initializeNativeNotifications() {
|
|
62
|
+
const state = useAppStore.getState();
|
|
63
|
+
return await nativeComnyx.initialize().then((res) => {
|
|
64
|
+
state.setNotificationInitialized(true);
|
|
65
|
+
if (res.success) {
|
|
66
|
+
accumulator.add({
|
|
67
|
+
country: res.country,
|
|
68
|
+
language: res.language, //ComnyxSupport burayı override ediyor!.
|
|
69
|
+
timezone: res.timezone,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return res.success;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function initializeNotifications(
|
|
77
|
+
params: InitializeNotificationsParams = {}
|
|
78
|
+
) {
|
|
79
|
+
const state = useAppStore.getState();
|
|
80
|
+
if (!isInitCalled()) {
|
|
81
|
+
throw new Error('Please initialize the Comnyx SDK first');
|
|
82
|
+
}
|
|
83
|
+
if (!isLoginCalled()) {
|
|
84
|
+
throw new Error('Please call login first');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
let result: boolean = false;
|
|
88
|
+
|
|
89
|
+
if (globalSubscriptions.subscriptionsForNotification.length > 0) {
|
|
90
|
+
globalSubscriptions.subscriptionsForNotification.forEach((subscription) =>
|
|
91
|
+
subscription.remove()
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
if (globalSubscriptions.subscriptionsForOptIn) {
|
|
95
|
+
globalSubscriptions.subscriptionsForOptIn.remove();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const permissionResult = await ComnyxNotifications.checkOptIn();
|
|
99
|
+
changePermissionStatus(permissionResult);
|
|
100
|
+
if (permissionResult === NotificationPermissionStatus.GRANTED) {
|
|
101
|
+
result = await initializeNativeNotifications();
|
|
102
|
+
} else {
|
|
103
|
+
if (params.showOptIn) {
|
|
104
|
+
if (permissionResult === NotificationPermissionStatus.DENIED) {
|
|
105
|
+
const permissionResultAfterDenied = await ComnyxNotifications.optIn();
|
|
106
|
+
if (
|
|
107
|
+
permissionResultAfterDenied === NotificationPermissionStatus.GRANTED
|
|
108
|
+
) {
|
|
109
|
+
} else if (
|
|
110
|
+
permissionResultAfterDenied === NotificationPermissionStatus.BLOCKED
|
|
111
|
+
) {
|
|
112
|
+
if (params.linkToSettings) {
|
|
113
|
+
showAlertDialog();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
} else if (permissionResult === NotificationPermissionStatus.BLOCKED) {
|
|
117
|
+
if (params.linkToSettings) {
|
|
118
|
+
showAlertDialog();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
globalSubscriptions.subscriptionsForOptIn = AppState.addEventListener(
|
|
125
|
+
'change',
|
|
126
|
+
async (nextAppState) => {
|
|
127
|
+
if (nextAppState === 'active') {
|
|
128
|
+
const permissionGivenInForeground =
|
|
129
|
+
(await ComnyxNotifications.checkOptIn()) ===
|
|
130
|
+
NotificationPermissionStatus.GRANTED;
|
|
131
|
+
if (permissionGivenInForeground) {
|
|
132
|
+
state.setPermissionGiven(true);
|
|
133
|
+
if (!state.notificationInitialized) {
|
|
134
|
+
await ComnyxNotifications.initialize().then(() => {
|
|
135
|
+
state.setNotificationInitialized(true);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
if (params.showOptInOnForeground) {
|
|
140
|
+
ComnyxNotifications.optIn().then(async (permissionResultInner) => {
|
|
141
|
+
changePermissionStatus(permissionResultInner);
|
|
142
|
+
if (
|
|
143
|
+
permissionResultInner === NotificationPermissionStatus.GRANTED
|
|
144
|
+
) {
|
|
145
|
+
await initializeNativeNotifications();
|
|
146
|
+
} else if (
|
|
147
|
+
permissionResultInner === NotificationPermissionStatus.BLOCKED
|
|
148
|
+
) {
|
|
149
|
+
if (params.linkToSettings) {
|
|
150
|
+
showAlertDialog();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
globalSubscriptions.subscriptionsForNotification = [
|
|
161
|
+
ComnyxNotifications.addEventListener('TOKEN_INIT', (data) => {
|
|
162
|
+
if (Platform.OS === 'ios') {
|
|
163
|
+
accumulator.add({
|
|
164
|
+
apnsToken: data.token,
|
|
165
|
+
platform: 'ios',
|
|
166
|
+
});
|
|
167
|
+
} else if (Platform.OS === 'android') {
|
|
168
|
+
accumulator.add({
|
|
169
|
+
fcmToken: data.token,
|
|
170
|
+
platform: 'android',
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}),
|
|
174
|
+
ComnyxNotifications.addEventListener('TOKEN_FAILED', (data) => {
|
|
175
|
+
//TODO: logger
|
|
176
|
+
console.error('TOKEN_FAILED', data);
|
|
177
|
+
}),
|
|
178
|
+
];
|
|
179
|
+
return result;
|
|
180
|
+
}
|
package/src/register/login.ts
CHANGED
|
@@ -15,10 +15,10 @@ export function login(loginOptions: LoginOptions) {
|
|
|
15
15
|
if (!loginOptions.externalId) {
|
|
16
16
|
throw new Error('External ID is required for initialization');
|
|
17
17
|
}
|
|
18
|
+
setLoginForAxios(loginOptions.externalId);
|
|
18
19
|
accumulator.clear();
|
|
19
20
|
accumulator.register(async (accumulatedData: CreateCustomerRequest) => {
|
|
20
21
|
const data = await updateCustomer(accumulatedData, loginOptions.externalId);
|
|
21
|
-
setLoginForAxios(loginOptions.externalId);
|
|
22
22
|
useAppStore.getState().setCustomer(data.customer);
|
|
23
23
|
});
|
|
24
24
|
}
|
package/src/store/store.ts
CHANGED
|
@@ -34,6 +34,10 @@ interface AppStoreState {
|
|
|
34
34
|
}) => void;
|
|
35
35
|
formSubmitted: boolean;
|
|
36
36
|
setForm: (form: Customer) => void;
|
|
37
|
+
permissionGiven: boolean;
|
|
38
|
+
setPermissionGiven: (permissionGiven: boolean) => void;
|
|
39
|
+
notificationInitialized: boolean;
|
|
40
|
+
setNotificationInitialized: (notificationInitialized: boolean) => void;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
export const storeCreator: StateCreator<AppStoreState> = (set, get) => ({
|
|
@@ -79,6 +83,14 @@ export const storeCreator: StateCreator<AppStoreState> = (set, get) => ({
|
|
|
79
83
|
setForm: (form: Customer) => {
|
|
80
84
|
set({ formSubmitted: true, customer: form });
|
|
81
85
|
},
|
|
86
|
+
permissionGiven: false,
|
|
87
|
+
setPermissionGiven: (permissionGiven: boolean) => {
|
|
88
|
+
set({ permissionGiven });
|
|
89
|
+
},
|
|
90
|
+
notificationInitialized: false,
|
|
91
|
+
setNotificationInitialized: (notificationInitialized: boolean) => {
|
|
92
|
+
set({ notificationInitialized });
|
|
93
|
+
},
|
|
82
94
|
});
|
|
83
95
|
|
|
84
96
|
export const useAppStore = createWithEqualityFn<AppStoreState>()(
|
|
@@ -89,6 +101,7 @@ export const useAppStore = createWithEqualityFn<AppStoreState>()(
|
|
|
89
101
|
partialize: (state) => ({
|
|
90
102
|
customer: state.customer,
|
|
91
103
|
formSubmitted: state.formSubmitted,
|
|
104
|
+
permissionGiven: state.permissionGiven,
|
|
92
105
|
}),
|
|
93
106
|
}),
|
|
94
107
|
shallow
|