@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
@@ -8,8 +8,6 @@ import {
8
8
  TouchableOpacity,
9
9
  Keyboard,
10
10
  StatusBar,
11
- KeyboardAvoidingView,
12
- Platform,
13
11
  } from 'react-native';
14
12
  import { getCustomerConversation, sendCustomerMessage } from '../api';
15
13
  import type { AppConversationMessage } from '../types/Conversation';
@@ -557,143 +555,132 @@ export function ChatList({
557
555
  animated={false}
558
556
  translucent
559
557
  />
560
- <KeyboardAvoidingView
561
- behavior={Platform.OS === 'ios' ? 'padding' : undefined}
562
- style={{ flex: 1 }}
558
+ <View
559
+ style={[styles.container, { backgroundColor: themeColors.background }]}
563
560
  >
561
+ <TouchableOpacity
562
+ style={[styles.iconContainer]}
563
+ onPress={onBack}
564
+ activeOpacity={activeOpacity}
565
+ >
566
+ <Image
567
+ source={closeIcon}
568
+ style={[styles.closeIcon, { tintColor: themeColors.text }]}
569
+ />
570
+ </TouchableOpacity>
564
571
  <View
565
572
  style={[
566
- styles.container,
567
- { backgroundColor: themeColors.background },
573
+ styles.headerContainer,
574
+ {
575
+ backgroundColor: themeColors.background,
576
+ borderBottomColor: themeColors.lavender,
577
+ },
568
578
  ]}
569
579
  >
570
- <TouchableOpacity
571
- style={[styles.iconContainer]}
572
- onPress={onBack}
573
- activeOpacity={activeOpacity}
574
- >
575
- <Image
576
- source={closeIcon}
577
- style={[styles.closeIcon, { tintColor: themeColors.text }]}
578
- />
579
- </TouchableOpacity>
580
+ <AppText
581
+ localization="chat.support-team"
582
+ weight={'600'}
583
+ style={[styles.header, { color: themeColors.text }]}
584
+ />
580
585
  <View
581
586
  style={[
582
- styles.headerContainer,
583
- {
584
- backgroundColor: themeColors.background,
585
- borderBottomColor: themeColors.lavender,
586
- },
587
+ styles.headerText,
588
+ { backgroundColor: themeColors.background },
587
589
  ]}
588
590
  >
591
+ <Image
592
+ source={headphonesIcon}
593
+ style={[styles.headphonesIcon, { tintColor: themeColors.text }]}
594
+ />
589
595
  <AppText
590
- localization="chat.support-team"
591
- weight={'600'}
592
- style={[styles.header, { color: themeColors.text }]}
596
+ localization="chat.live"
597
+ style={[styles.liveChat, { color: themeColors.text }]}
593
598
  />
594
599
  <View
595
- style={[
596
- styles.headerText,
597
- { backgroundColor: themeColors.background },
598
- ]}
599
- >
600
- <Image
601
- source={headphonesIcon}
602
- style={[styles.headphonesIcon, { tintColor: themeColors.text }]}
603
- />
604
- <AppText
605
- localization="chat.live"
606
- style={[styles.liveChat, { color: themeColors.text }]}
607
- />
608
- <View
609
- style={[styles.dot, { backgroundColor: themeColors.green }]}
610
- />
611
- </View>
612
- </View>
613
-
614
- <View style={styles.listContainer}>
615
- <AppText
616
- style={[
617
- styles.dateText,
618
- {
619
- color: themeColors.slate,
620
- backgroundColor: themeColors.ghost,
621
- },
622
- ]}
623
- >
624
- {currentSection}
625
- </AppText>
626
-
627
- <SectionList
628
- ref={ref}
629
- sections={sections}
630
- inverted
631
- renderItem={renderItem}
632
- contentContainerStyle={[
633
- styles.contentContainer,
634
- { backgroundColor: themeColors.background },
635
- ]}
636
- style={styles.list}
637
- ListEmptyComponent={
638
- !loading && (!sections || sections.length === 0) ? (
639
- <EmptyList />
640
- ) : null
641
- }
642
- ListFooterComponent={loading ? <LoadingItem /> : null}
643
- keyExtractor={(item: AppConversationMessage) =>
644
- item.id + '-' + item.created_at
645
- }
646
- removeClippedSubviews={false}
647
- maxToRenderPerBatch={20}
648
- windowSize={21}
649
- initialNumToRender={MESSAGES_PER_PAGE}
650
- getItemLayout={(_: any, index: number) => ({
651
- length: MESSAGE_MIN_HEIGHT + 10,
652
- offset: (MESSAGE_MIN_HEIGHT + 10) * index,
653
- index,
654
- })}
655
- onScroll={handleScroll}
656
- scrollEventThrottle={1}
657
- stickySectionHeadersEnabled={false}
658
- showsVerticalScrollIndicator={false}
600
+ style={[styles.dot, { backgroundColor: themeColors.green }]}
659
601
  />
660
602
  </View>
661
- {isScrollingUp && (
662
- <TouchableOpacity
663
- activeOpacity={activeOpacity}
664
- style={[
665
- styles.scrollDownButton,
666
- { backgroundColor: themeColors.ghost },
667
- isKeyboardVisible && styles.scrollDownButtonWithKeyboard,
668
- ]}
669
- onPress={() => scrollToBottom(true)}
670
- >
671
- <Image
672
- source={require('../assets/down.png')}
673
- style={[styles.scrollUpIcon, { tintColor: themeColors.text }]}
674
- />
675
- </TouchableOpacity>
676
- )}
677
- <MessageInput
678
- scrollToBottom={scrollToBottom}
679
- selectedMessage={selectedMessage}
680
- />
681
- <CustomPopup
682
- isVisible={popupVisible}
683
- onClose={() => setPopupVisible(false)}
684
- title={'chat.list-failed-message.title'}
685
- description={'chat.list-failed-message.description'}
686
- onCancelButton={() => {
687
- setPopupVisible(false);
688
- }}
689
- onResendButton={() => {
690
- resendMessage();
691
- setPopupVisible(false);
692
- }}
693
- buttonText={'chat.list-cancel' as keyof LocalizationKeys}
603
+ </View>
604
+
605
+ <View style={styles.listContainer}>
606
+ <AppText
607
+ style={[
608
+ styles.dateText,
609
+ { color: themeColors.slate, backgroundColor: themeColors.ghost },
610
+ ]}
611
+ >
612
+ {currentSection}
613
+ </AppText>
614
+
615
+ <SectionList
616
+ ref={ref}
617
+ sections={sections}
618
+ inverted
619
+ renderItem={renderItem}
620
+ contentContainerStyle={[
621
+ styles.contentContainer,
622
+ { backgroundColor: themeColors.background },
623
+ ]}
624
+ style={styles.list}
625
+ ListEmptyComponent={
626
+ !loading && (!sections || sections.length === 0) ? (
627
+ <EmptyList />
628
+ ) : null
629
+ }
630
+ ListFooterComponent={loading ? <LoadingItem /> : null}
631
+ keyExtractor={(item: AppConversationMessage) =>
632
+ item.id + '-' + item.created_at
633
+ }
634
+ removeClippedSubviews={false}
635
+ maxToRenderPerBatch={20}
636
+ windowSize={21}
637
+ initialNumToRender={MESSAGES_PER_PAGE}
638
+ getItemLayout={(_: any, index: number) => ({
639
+ length: MESSAGE_MIN_HEIGHT + 10,
640
+ offset: (MESSAGE_MIN_HEIGHT + 10) * index,
641
+ index,
642
+ })}
643
+ onScroll={handleScroll}
644
+ scrollEventThrottle={1}
645
+ stickySectionHeadersEnabled={false}
646
+ showsVerticalScrollIndicator={false}
694
647
  />
695
648
  </View>
696
- </KeyboardAvoidingView>
649
+ {isScrollingUp && (
650
+ <TouchableOpacity
651
+ activeOpacity={activeOpacity}
652
+ style={[
653
+ styles.scrollDownButton,
654
+ { backgroundColor: themeColors.ghost },
655
+ isKeyboardVisible && styles.scrollDownButtonWithKeyboard,
656
+ ]}
657
+ onPress={() => scrollToBottom(true)}
658
+ >
659
+ <Image
660
+ source={require('../assets/down.png')}
661
+ style={[styles.scrollUpIcon, { tintColor: themeColors.text }]}
662
+ />
663
+ </TouchableOpacity>
664
+ )}
665
+ <MessageInput
666
+ scrollToBottom={scrollToBottom}
667
+ selectedMessage={selectedMessage}
668
+ />
669
+ <CustomPopup
670
+ isVisible={popupVisible}
671
+ onClose={() => setPopupVisible(false)}
672
+ title={'chat.list-failed-message.title'}
673
+ description={'chat.list-failed-message.description'}
674
+ onCancelButton={() => {
675
+ setPopupVisible(false);
676
+ }}
677
+ onResendButton={() => {
678
+ resendMessage();
679
+ setPopupVisible(false);
680
+ }}
681
+ buttonText={'chat.list-cancel' as keyof LocalizationKeys}
682
+ />
683
+ </View>
697
684
  </>
698
685
  );
699
686
  }