@developer_tribe/react-native-comnyx 0.12.14 → 0.13.1
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 +23 -10
- package/android/build.gradle +60 -4
- 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/java/com/comnyx/NativeComnyxSpec.java +46 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNComnyxSpec-generated.cpp +44 -0
- package/android/generated/jni/RNComnyxSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI-generated.cpp +38 -0
- package/android/generated/jni/react/renderer/components/RNComnyxSpec/RNComnyxSpecJSI.h +89 -0
- package/android/src/main/java/com/comnyx/ComnyxModule.kt +15 -16
- package/ios/Comnyx.h +17 -0
- package/ios/Comnyx.m +7 -5
- package/ios/Comnyx.swift +11 -10
- package/ios/ComnyxObjC.h +19 -0
- package/ios/ComnyxObjC.m +28 -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/NativeComnyx.js +5 -2
- package/lib/commonjs/NativeComnyx.js.map +1 -1
- package/lib/commonjs/components/ChatList.js +53 -125
- package/lib/commonjs/components/ChatList.js.map +1 -1
- package/lib/commonjs/constants/translations.js +58 -0
- package/lib/commonjs/constants/translations.js.map +1 -1
- package/lib/commonjs/hooks/usePolling.js.map +1 -1
- package/lib/commonjs/register/Accumulator.js.map +1 -1
- package/lib/commonjs/store/store.js +2 -3
- package/lib/commonjs/store/store.js.map +1 -1
- package/lib/commonjs/utils/formatDate.js +30 -9
- package/lib/commonjs/utils/formatDate.js.map +1 -1
- package/lib/commonjs/utils/mmkvStorage.js +21 -0
- package/lib/commonjs/utils/mmkvStorage.js.map +1 -0
- package/lib/commonjs/version.js +1 -1
- package/lib/commonjs/version.js.map +1 -1
- package/lib/module/NativeComnyx.js +8 -2
- package/lib/module/NativeComnyx.js.map +1 -1
- package/lib/module/components/ChatList.js +54 -126
- package/lib/module/components/ChatList.js.map +1 -1
- package/lib/module/constants/translations.js +58 -0
- package/lib/module/constants/translations.js.map +1 -1
- package/lib/module/hooks/usePolling.js.map +1 -1
- package/lib/module/register/Accumulator.js.map +1 -1
- package/lib/module/store/store.js +2 -2
- package/lib/module/store/store.js.map +1 -1
- package/lib/module/utils/formatDate.js +28 -8
- package/lib/module/utils/formatDate.js.map +1 -1
- package/lib/module/utils/mmkvStorage.js +17 -0
- package/lib/module/utils/mmkvStorage.js.map +1 -0
- package/lib/module/version.js +1 -1
- package/lib/module/version.js.map +1 -1
- package/lib/typescript/src/NativeComnyx.d.ts +21 -8
- package/lib/typescript/src/NativeComnyx.d.ts.map +1 -1
- package/lib/typescript/src/api/conversations.d.ts +1 -1
- package/lib/typescript/src/api/conversations.d.ts.map +1 -1
- package/lib/typescript/src/components/AppText.d.ts +1 -1
- package/lib/typescript/src/components/AppText.d.ts.map +1 -1
- package/lib/typescript/src/components/ChatList.d.ts.map +1 -1
- package/lib/typescript/src/constants/translations.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useListenNativeTokenForDebug.d.ts +1 -1
- package/lib/typescript/src/hooks/useListenNativeTokenForDebug.d.ts.map +1 -1
- package/lib/typescript/src/register/Accumulator.d.ts +1 -1
- package/lib/typescript/src/register/Accumulator.d.ts.map +1 -1
- package/lib/typescript/src/store/store.d.ts.map +1 -1
- package/lib/typescript/src/types/LocalizationKeys.d.ts +2 -0
- package/lib/typescript/src/types/LocalizationKeys.d.ts.map +1 -1
- package/lib/typescript/src/utils/formatDate.d.ts +1 -0
- package/lib/typescript/src/utils/formatDate.d.ts.map +1 -1
- package/lib/typescript/src/utils/mmkvStorage.d.ts +3 -0
- package/lib/typescript/src/utils/mmkvStorage.d.ts.map +1 -0
- package/lib/typescript/src/version.d.ts +1 -1
- package/lib/typescript/src/version.d.ts.map +1 -1
- package/package.json +21 -12
- package/src/NativeComnyx.ts +30 -10
- package/src/components/ChatList.tsx +101 -174
- package/src/constants/translations.ts +58 -0
- package/src/hooks/usePolling.ts +1 -1
- package/src/register/Accumulator.ts +1 -1
- package/src/store/store.ts +2 -2
- package/src/types/LocalizationKeys.ts +2 -0
- package/src/utils/formatDate.ts +46 -9
- package/src/utils/mmkvStorage.ts +17 -0
- package/src/version.ts +1 -1
- package/lib/typescript/jest.config.d.ts +0 -4
- package/lib/typescript/jest.config.d.ts.map +0 -1
|
@@ -11,7 +11,9 @@ import {
|
|
|
11
11
|
KeyboardAvoidingView,
|
|
12
12
|
Platform,
|
|
13
13
|
Animated,
|
|
14
|
+
type SectionListData,
|
|
14
15
|
} from 'react-native';
|
|
16
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
15
17
|
import { getCustomerConversation, sendCustomerMessage } from '../api';
|
|
16
18
|
import type { AppConversationMessage } from '../types/Conversation';
|
|
17
19
|
import { MessageItem } from './MessageItem';
|
|
@@ -23,7 +25,7 @@ import { EmptyList } from './EmptyList';
|
|
|
23
25
|
import CustomPopup from './CustomAlert';
|
|
24
26
|
import type { LocalizationKeys } from '../types/LocalizationKeys';
|
|
25
27
|
import { ScaledSheet } from './ScaledSheet';
|
|
26
|
-
import { formatDate } from '../utils/formatDate';
|
|
28
|
+
import { formatDate, getDateKey } from '../utils/formatDate';
|
|
27
29
|
import { activeOpacity } from '../constants/activeOpacity';
|
|
28
30
|
import { useAppStore } from '../store/store';
|
|
29
31
|
|
|
@@ -108,6 +110,7 @@ export function ChatList({
|
|
|
108
110
|
}) {
|
|
109
111
|
const themeColors = useThemeColors();
|
|
110
112
|
const { height: windowHeight } = useWindowDimensions();
|
|
113
|
+
const insets = useSafeAreaInsets();
|
|
111
114
|
const MESSAGE_MIN_HEIGHT = 60;
|
|
112
115
|
const FLATLIST_PADDING = 20;
|
|
113
116
|
const MESSAGES_PER_PAGE = Math.ceil(
|
|
@@ -129,15 +132,11 @@ export function ChatList({
|
|
|
129
132
|
const nextPageStatus = useRef<'fail' | 'loading' | 'empty'>();
|
|
130
133
|
const [nexPageFailed, setNexPageFailed] = useState(false);
|
|
131
134
|
const [initFailed, setInitFailed] = useState(false);
|
|
132
|
-
const [
|
|
135
|
+
const [showScrollDownButton, setShowScrollDownButton] = useState(false);
|
|
133
136
|
const [isKeyboardVisible, setIsKeyboardVisible] = useState(false);
|
|
134
137
|
const listChangedRef = useRef(false);
|
|
135
138
|
const [popupVisible, setPopupVisible] = useState(false);
|
|
136
139
|
const [selectedMessage, setSelectedMessage] = useState<string>('');
|
|
137
|
-
const [currentSection, setCurrentSection] = useState<string>('');
|
|
138
|
-
const lastSectionChangeTime = useRef<number>(0);
|
|
139
|
-
const pendingSectionRef = useRef<string | null>(null);
|
|
140
|
-
const MIN_SECTION_CHANGE_INTERVAL = 150;
|
|
141
140
|
|
|
142
141
|
const sections = useMemo(() => {
|
|
143
142
|
if (!data || data.length === 0) return [];
|
|
@@ -152,54 +151,78 @@ export function ChatList({
|
|
|
152
151
|
return message;
|
|
153
152
|
});
|
|
154
153
|
|
|
155
|
-
|
|
154
|
+
type GroupedMessages = {
|
|
155
|
+
label: string;
|
|
156
|
+
timestamp: number;
|
|
157
|
+
messages: AppConversationMessage[];
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const messagesByDate: Record<string, GroupedMessages> = {};
|
|
156
161
|
|
|
157
162
|
validData.forEach((message: AppConversationMessage) => {
|
|
158
|
-
|
|
163
|
+
if (!message.created_at) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const createdAt =
|
|
168
|
+
message.created_at instanceof Date
|
|
169
|
+
? message.created_at
|
|
170
|
+
: new Date(message.created_at);
|
|
171
|
+
|
|
172
|
+
const dateKey = getDateKey(createdAt);
|
|
173
|
+
if (!dateKey) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const dayStart = new Date(
|
|
178
|
+
createdAt.getFullYear(),
|
|
179
|
+
createdAt.getMonth(),
|
|
180
|
+
createdAt.getDate()
|
|
181
|
+
).getTime();
|
|
182
|
+
|
|
159
183
|
if (!messagesByDate[dateKey]) {
|
|
160
|
-
messagesByDate[dateKey] =
|
|
184
|
+
messagesByDate[dateKey] = {
|
|
185
|
+
label: formatDate(language, createdAt),
|
|
186
|
+
timestamp: dayStart,
|
|
187
|
+
messages: [],
|
|
188
|
+
};
|
|
161
189
|
}
|
|
162
|
-
// @ts-ignore
|
|
163
|
-
messagesByDate[dateKey].push(message);
|
|
164
|
-
});
|
|
165
190
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (dateKeys.length === 0) return [];
|
|
191
|
+
messagesByDate[dateKey].messages.push(message);
|
|
192
|
+
});
|
|
169
193
|
|
|
170
|
-
return Object.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
194
|
+
return Object.values(messagesByDate)
|
|
195
|
+
.sort((a, b) => b.timestamp - a.timestamp)
|
|
196
|
+
.map(({ label, messages }) => ({
|
|
197
|
+
title: label,
|
|
198
|
+
data: messages.sort((a, b) => {
|
|
199
|
+
try {
|
|
200
|
+
if (!a.created_at || !b.created_at) {
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
180
203
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
204
|
+
const dateA =
|
|
205
|
+
a.created_at instanceof Date
|
|
206
|
+
? a.created_at
|
|
207
|
+
: new Date(a.created_at);
|
|
208
|
+
const dateB =
|
|
209
|
+
b.created_at instanceof Date
|
|
210
|
+
? b.created_at
|
|
211
|
+
: new Date(b.created_at);
|
|
212
|
+
|
|
213
|
+
if (typeof dateA.getTime !== 'function') {
|
|
214
|
+
return 0;
|
|
215
|
+
}
|
|
216
|
+
if (typeof dateB.getTime !== 'function') {
|
|
217
|
+
return 0;
|
|
218
|
+
}
|
|
189
219
|
|
|
190
|
-
|
|
220
|
+
return dateB.getTime() - dateA.getTime();
|
|
221
|
+
} catch (error) {
|
|
191
222
|
return 0;
|
|
192
223
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return dateB.getTime() - dateA.getTime();
|
|
198
|
-
} catch (error) {
|
|
199
|
-
return 0;
|
|
200
|
-
}
|
|
201
|
-
}),
|
|
202
|
-
}));
|
|
224
|
+
}),
|
|
225
|
+
}));
|
|
203
226
|
}, [data, language]);
|
|
204
227
|
|
|
205
228
|
const resendMessage = useCallback(() => {
|
|
@@ -371,39 +394,30 @@ export function ChatList({
|
|
|
371
394
|
[]
|
|
372
395
|
);
|
|
373
396
|
|
|
374
|
-
const
|
|
375
|
-
(
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}
|
|
397
|
-
}, MIN_SECTION_CHANGE_INTERVAL - timeSinceLastChange);
|
|
398
|
-
} else {
|
|
399
|
-
// Enough time has passed, update immediately
|
|
400
|
-
setCurrentSection(newSection);
|
|
401
|
-
lastSectionChangeTime.current = now;
|
|
402
|
-
pendingSectionRef.current = null;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
397
|
+
const renderSectionFooter = useCallback(
|
|
398
|
+
({
|
|
399
|
+
section,
|
|
400
|
+
}: {
|
|
401
|
+
section: SectionListData<AppConversationMessage, any>;
|
|
402
|
+
}) => {
|
|
403
|
+
const title = (section as any).title;
|
|
404
|
+
return (
|
|
405
|
+
<View style={styles.sectionHeaderContainer}>
|
|
406
|
+
<AppText
|
|
407
|
+
style={[
|
|
408
|
+
styles.sectionHeader,
|
|
409
|
+
{
|
|
410
|
+
color: themeColors.slate,
|
|
411
|
+
backgroundColor: themeColors.ghost,
|
|
412
|
+
},
|
|
413
|
+
]}
|
|
414
|
+
>
|
|
415
|
+
{title}
|
|
416
|
+
</AppText>
|
|
417
|
+
</View>
|
|
418
|
+
);
|
|
405
419
|
},
|
|
406
|
-
[
|
|
420
|
+
[themeColors]
|
|
407
421
|
);
|
|
408
422
|
|
|
409
423
|
const handleScroll = useCallback(
|
|
@@ -412,67 +426,14 @@ export function ChatList({
|
|
|
412
426
|
const contentHeight = event.nativeEvent.contentSize.height;
|
|
413
427
|
const scrollViewHeight = event.nativeEvent.layoutMeasurement.height;
|
|
414
428
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
// Determine the section at the bottom of the window based on scroll position
|
|
418
|
-
if (sections && sections.length > 0) {
|
|
419
|
-
let accumulatedHeight = 0;
|
|
420
|
-
let lastVisibleSection = null;
|
|
421
|
-
|
|
422
|
-
// Check all sections
|
|
423
|
-
for (let i = 0; i < sections.length; i++) {
|
|
424
|
-
const section = sections[i];
|
|
425
|
-
if (!section || !section.data) continue;
|
|
426
|
-
|
|
427
|
-
// Calculate section height
|
|
428
|
-
const sectionHeight = section.data.length * (MESSAGE_MIN_HEIGHT + 10);
|
|
429
|
-
|
|
430
|
-
// Section positions
|
|
431
|
-
const sectionStart = accumulatedHeight;
|
|
432
|
-
const sectionEnd = sectionStart + sectionHeight;
|
|
433
|
-
|
|
434
|
-
// Visible area
|
|
435
|
-
const visibleTop = currentScrollY;
|
|
436
|
-
const visibleBottom = visibleTop + scrollViewHeight;
|
|
437
|
-
|
|
438
|
-
// Find the section visible at the bottom of the screen
|
|
439
|
-
const isSectionVisibleAtBottom =
|
|
440
|
-
(visibleBottom >= sectionStart && visibleBottom <= sectionEnd) ||
|
|
441
|
-
(sectionStart <= visibleTop && sectionEnd >= visibleBottom);
|
|
442
|
-
|
|
443
|
-
if (isSectionVisibleAtBottom) {
|
|
444
|
-
lastVisibleSection = section;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
accumulatedHeight += sectionHeight;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
// Display the found section using our safe updater
|
|
451
|
-
if (
|
|
452
|
-
lastVisibleSection?.title &&
|
|
453
|
-
lastVisibleSection.title !== currentSection
|
|
454
|
-
) {
|
|
455
|
-
updateSectionSafely(lastVisibleSection.title);
|
|
456
|
-
} else if (
|
|
457
|
-
!lastVisibleSection &&
|
|
458
|
-
currentScrollY <= 10 &&
|
|
459
|
-
sections[0]?.title
|
|
460
|
-
) {
|
|
461
|
-
updateSectionSafely(sections[0].title);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
429
|
+
const shouldShowScrollButton = currentScrollY > 300;
|
|
430
|
+
setShowScrollDownButton(shouldShowScrollButton);
|
|
464
431
|
|
|
465
432
|
if (currentScrollY >= contentHeight - scrollViewHeight - 200) {
|
|
466
433
|
nextPage();
|
|
467
434
|
}
|
|
468
435
|
},
|
|
469
|
-
[
|
|
470
|
-
nextPage,
|
|
471
|
-
sections,
|
|
472
|
-
currentSection,
|
|
473
|
-
MESSAGE_MIN_HEIGHT,
|
|
474
|
-
updateSectionSafely,
|
|
475
|
-
]
|
|
436
|
+
[nextPage]
|
|
476
437
|
);
|
|
477
438
|
|
|
478
439
|
const scrollToBottom = useCallback(
|
|
@@ -542,13 +503,6 @@ export function ChatList({
|
|
|
542
503
|
}
|
|
543
504
|
}, [MESSAGES_PER_PAGE, customer?.external_id, initFailed, setData]);
|
|
544
505
|
|
|
545
|
-
// Initialize the current section when sections are loaded
|
|
546
|
-
useEffect(() => {
|
|
547
|
-
if (sections.length > 0 && sections[0]?.title) {
|
|
548
|
-
setCurrentSection(sections[0].title);
|
|
549
|
-
}
|
|
550
|
-
}, [sections]);
|
|
551
|
-
|
|
552
506
|
// Add keyboard listeners
|
|
553
507
|
useEffect(() => {
|
|
554
508
|
const keyboardDidShowListener = Keyboard.addListener(
|
|
@@ -571,13 +525,6 @@ export function ChatList({
|
|
|
571
525
|
};
|
|
572
526
|
}, []);
|
|
573
527
|
|
|
574
|
-
// Clear pending updates on unmount
|
|
575
|
-
useEffect(() => {
|
|
576
|
-
return () => {
|
|
577
|
-
pendingSectionRef.current = null;
|
|
578
|
-
};
|
|
579
|
-
}, []);
|
|
580
|
-
|
|
581
528
|
if (nexPageFailed) {
|
|
582
529
|
return (
|
|
583
530
|
<View
|
|
@@ -623,11 +570,14 @@ export function ChatList({
|
|
|
623
570
|
<View
|
|
624
571
|
style={[
|
|
625
572
|
styles.container,
|
|
626
|
-
{
|
|
573
|
+
{
|
|
574
|
+
backgroundColor: themeColors.background,
|
|
575
|
+
paddingTop: insets.top || 40,
|
|
576
|
+
},
|
|
627
577
|
]}
|
|
628
578
|
>
|
|
629
579
|
<TouchableOpacity
|
|
630
|
-
style={[styles.iconContainer]}
|
|
580
|
+
style={[styles.iconContainer, { top: insets.top || 40 }]}
|
|
631
581
|
onPress={onBack}
|
|
632
582
|
activeOpacity={activeOpacity}
|
|
633
583
|
>
|
|
@@ -671,23 +621,12 @@ export function ChatList({
|
|
|
671
621
|
</View>
|
|
672
622
|
|
|
673
623
|
<View style={styles.listContainer}>
|
|
674
|
-
<AppText
|
|
675
|
-
style={[
|
|
676
|
-
styles.dateText,
|
|
677
|
-
{
|
|
678
|
-
color: themeColors.slate,
|
|
679
|
-
backgroundColor: themeColors.ghost,
|
|
680
|
-
},
|
|
681
|
-
]}
|
|
682
|
-
>
|
|
683
|
-
{currentSection}
|
|
684
|
-
</AppText>
|
|
685
|
-
|
|
686
624
|
<SectionList
|
|
687
625
|
ref={ref}
|
|
688
626
|
sections={sections}
|
|
689
627
|
inverted
|
|
690
628
|
renderItem={renderItem}
|
|
629
|
+
renderSectionFooter={renderSectionFooter}
|
|
691
630
|
contentContainerStyle={[
|
|
692
631
|
styles.contentContainer,
|
|
693
632
|
{ backgroundColor: themeColors.background },
|
|
@@ -717,7 +656,7 @@ export function ChatList({
|
|
|
717
656
|
showsVerticalScrollIndicator={false}
|
|
718
657
|
/>
|
|
719
658
|
</View>
|
|
720
|
-
{
|
|
659
|
+
{showScrollDownButton && (
|
|
721
660
|
<TouchableOpacity
|
|
722
661
|
activeOpacity={activeOpacity}
|
|
723
662
|
style={[
|
|
@@ -762,7 +701,6 @@ const styles = ScaledSheet.create({
|
|
|
762
701
|
container: {
|
|
763
702
|
flex: 1,
|
|
764
703
|
paddingBottom: '20@vs',
|
|
765
|
-
paddingTop: '40@vs',
|
|
766
704
|
position: 'relative',
|
|
767
705
|
},
|
|
768
706
|
list: {
|
|
@@ -841,7 +779,7 @@ const styles = ScaledSheet.create({
|
|
|
841
779
|
},
|
|
842
780
|
iconContainer: {
|
|
843
781
|
paddingHorizontal: '20@s',
|
|
844
|
-
paddingVertical: '
|
|
782
|
+
paddingVertical: '10@vs',
|
|
845
783
|
position: 'absolute',
|
|
846
784
|
zIndex: 9999,
|
|
847
785
|
},
|
|
@@ -868,17 +806,6 @@ const styles = ScaledSheet.create({
|
|
|
868
806
|
alignSelf: 'center',
|
|
869
807
|
marginVertical: '8@vs',
|
|
870
808
|
},
|
|
871
|
-
dateText: {
|
|
872
|
-
fontSize: '14@vs',
|
|
873
|
-
fontWeight: '500',
|
|
874
|
-
borderRadius: '12@s',
|
|
875
|
-
paddingHorizontal: '8@s',
|
|
876
|
-
paddingVertical: '2@s',
|
|
877
|
-
position: 'absolute',
|
|
878
|
-
top: '10@vs',
|
|
879
|
-
zIndex: 10,
|
|
880
|
-
alignSelf: 'center',
|
|
881
|
-
},
|
|
882
809
|
listContainer: {
|
|
883
810
|
flex: 1,
|
|
884
811
|
position: 'relative',
|
|
@@ -36,6 +36,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
36
36
|
'chat.empty.description': "The team's message will be displayed here.",
|
|
37
37
|
'chat.live': 'Live Chat',
|
|
38
38
|
'chat.support-team': 'Support Team',
|
|
39
|
+
'chat.date.today': 'Today',
|
|
40
|
+
'chat.date.yesterday': 'Yesterday',
|
|
39
41
|
'customer.form.resend': 'Resend',
|
|
40
42
|
'chat.list-failed-message.title': 'Failed to send',
|
|
41
43
|
'chat.list-failed-message.description':
|
|
@@ -89,6 +91,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
89
91
|
'chat.empty.description': 'Ekibin mesajları burada görüntülenecek.',
|
|
90
92
|
'chat.live': 'Canlı Sohbet',
|
|
91
93
|
'chat.support-team': 'Destek Ekibi',
|
|
94
|
+
'chat.date.today': 'Bugün',
|
|
95
|
+
'chat.date.yesterday': 'Dün',
|
|
92
96
|
'customer.form.resend': 'Yeniden Gönder',
|
|
93
97
|
'chat.list-failed-message.title': 'Gönderilemedi',
|
|
94
98
|
'chat.list-failed-message.description':
|
|
@@ -142,6 +146,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
142
146
|
'chat.empty.description': 'Los mensajes del equipo se mostrarán aquí.',
|
|
143
147
|
'chat.live': 'Chat en Vivo',
|
|
144
148
|
'chat.support-team': 'Equipo de Soporte',
|
|
149
|
+
'chat.date.today': 'Hoy',
|
|
150
|
+
'chat.date.yesterday': 'Ayer',
|
|
145
151
|
'customer.form.resend': 'Reenviar',
|
|
146
152
|
'chat.list-failed-message.title': 'Error al enviar',
|
|
147
153
|
'chat.list-failed-message.description':
|
|
@@ -199,6 +205,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
199
205
|
'chat.empty.description': "Les messages de l'équipe seront affichés ici.",
|
|
200
206
|
'chat.live': 'Chat en Direct',
|
|
201
207
|
'chat.support-team': 'Équipe de Support',
|
|
208
|
+
'chat.date.today': "Aujourd'hui",
|
|
209
|
+
'chat.date.yesterday': 'Hier',
|
|
202
210
|
'customer.form.resend': 'Renvoyer',
|
|
203
211
|
'chat.list-failed-message.title': "Échec de l'envoi",
|
|
204
212
|
'chat.list-failed-message.description':
|
|
@@ -256,6 +264,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
256
264
|
'Die Nachrichten des Teams werden hier angezeigt.',
|
|
257
265
|
'chat.live': 'Live-Chat',
|
|
258
266
|
'chat.support-team': 'Support-Team',
|
|
267
|
+
'chat.date.today': 'Heute',
|
|
268
|
+
'chat.date.yesterday': 'Gestern',
|
|
259
269
|
'customer.form.resend': 'Erneut senden',
|
|
260
270
|
'chat.list-failed-message.title': 'Senden fehlgeschlagen',
|
|
261
271
|
'chat.list-failed-message.description':
|
|
@@ -310,6 +320,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
310
320
|
'chat.empty.description': 'I messaggi del team saranno visualizzati qui.',
|
|
311
321
|
'chat.live': 'Chat dal Vivo',
|
|
312
322
|
'chat.support-team': 'Team di Supporto',
|
|
323
|
+
'chat.date.today': 'Oggi',
|
|
324
|
+
'chat.date.yesterday': 'Ieri',
|
|
313
325
|
'customer.form.resend': 'Rinvia',
|
|
314
326
|
'chat.list-failed-message.title': 'Invio fallito',
|
|
315
327
|
'chat.list-failed-message.description':
|
|
@@ -366,6 +378,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
366
378
|
'chat.empty.description': 'As mensaggi da equipe serão exibidas aqui.',
|
|
367
379
|
'chat.live': 'Chat ao Vivo',
|
|
368
380
|
'chat.support-team': 'Equipe de Suporte',
|
|
381
|
+
'chat.date.today': 'Hoje',
|
|
382
|
+
'chat.date.yesterday': 'Ontem',
|
|
369
383
|
'customer.form.resend': 'Reenviar',
|
|
370
384
|
'chat.list-failed-message.title': 'Falha ao enviar',
|
|
371
385
|
'chat.list-failed-message.description':
|
|
@@ -423,6 +437,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
423
437
|
'chat.empty.description': 'Сообщения команды будут отображаться здесь.',
|
|
424
438
|
'chat.live': 'Живой Чат',
|
|
425
439
|
'chat.support-team': 'Служба Поддержки',
|
|
440
|
+
'chat.date.today': 'Сегодня',
|
|
441
|
+
'chat.date.yesterday': 'Вчера',
|
|
426
442
|
'customer.form.resend': 'Отправить повторно',
|
|
427
443
|
'chat.list-failed-message.title': 'Не удалось отправить',
|
|
428
444
|
'chat.list-failed-message.description':
|
|
@@ -477,6 +493,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
477
493
|
'chat.empty.description': 'チームからのメッセージがここに表示されます。',
|
|
478
494
|
'chat.live': 'ライブチャット',
|
|
479
495
|
'chat.support-team': 'サポートチーム',
|
|
496
|
+
'chat.date.today': '今日',
|
|
497
|
+
'chat.date.yesterday': '昨日',
|
|
480
498
|
'customer.form.resend': '再送信',
|
|
481
499
|
'chat.list-failed-message.title': '送信に失敗しました',
|
|
482
500
|
'chat.list-failed-message.description':
|
|
@@ -526,6 +544,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
526
544
|
'chat.empty.description': '团队的消息将显示在这里。',
|
|
527
545
|
'chat.live': '在线聊天',
|
|
528
546
|
'chat.support-team': '支持团队',
|
|
547
|
+
'chat.date.today': '今天',
|
|
548
|
+
'chat.date.yesterday': '昨天',
|
|
529
549
|
'customer.form.resend': '重新发送',
|
|
530
550
|
'chat.list-failed-message.title': '发送失败',
|
|
531
551
|
'chat.list-failed-message.description': '消息无法发送。请重试。',
|
|
@@ -576,6 +596,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
576
596
|
'chat.empty.description': 'ستظهر رسائل الفريق هنا.',
|
|
577
597
|
'chat.live': 'دردشة مباشرة',
|
|
578
598
|
'chat.support-team': 'فريق الدعم',
|
|
599
|
+
'chat.date.today': 'اليوم',
|
|
600
|
+
'chat.date.yesterday': 'أمس',
|
|
579
601
|
'customer.form.resend': 'إعادة الإرسال',
|
|
580
602
|
'chat.list-failed-message.title': 'فشل الإرسال',
|
|
581
603
|
'chat.list-failed-message.description':
|
|
@@ -628,6 +650,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
628
650
|
'chat.empty.description': 'Mesej pasukan akan dipaparkan di sini.',
|
|
629
651
|
'chat.live': 'Sembang Langsung',
|
|
630
652
|
'chat.support-team': 'Pasukan Sokongan',
|
|
653
|
+
'chat.date.today': 'Hari ini',
|
|
654
|
+
'chat.date.yesterday': 'Kemarin',
|
|
631
655
|
'customer.form.resend': 'Hantar Semula',
|
|
632
656
|
'chat.list-failed-message.title': 'Gagal menghantar',
|
|
633
657
|
'chat.list-failed-message.description':
|
|
@@ -679,6 +703,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
679
703
|
'chat.empty.description': 'Tin nhắn của nhóm sẽ hiển thị ở đây.',
|
|
680
704
|
'chat.live': 'Trò chuyện trực tiếp',
|
|
681
705
|
'chat.support-team': 'Đội hỗ trợ',
|
|
706
|
+
'chat.date.today': 'Hôm nay',
|
|
707
|
+
'chat.date.yesterday': 'Hôm qua',
|
|
682
708
|
'customer.form.resend': 'Gửi lại',
|
|
683
709
|
'chat.list-failed-message.title': 'Gửi thất bại',
|
|
684
710
|
'chat.list-failed-message.description':
|
|
@@ -732,6 +758,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
732
758
|
'chat.empty.description': 'Teamets meddelanden visas här.',
|
|
733
759
|
'chat.live': 'Direktchatt',
|
|
734
760
|
'chat.support-team': 'Supportteam',
|
|
761
|
+
'chat.date.today': 'Idag',
|
|
762
|
+
'chat.date.yesterday': 'Igår',
|
|
735
763
|
'customer.form.resend': 'Skicka igen',
|
|
736
764
|
'chat.list-failed-message.title': 'Misslyckades att skicka',
|
|
737
765
|
'chat.list-failed-message.description':
|
|
@@ -781,6 +809,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
781
809
|
'chat.empty.description': '팀의 메시지가 여기에 표시됩니다.',
|
|
782
810
|
'chat.live': '라이브 채팅',
|
|
783
811
|
'chat.support-team': '지원 팀',
|
|
812
|
+
'chat.date.today': '오늘',
|
|
813
|
+
'chat.date.yesterday': '어제',
|
|
784
814
|
'customer.form.resend': '다시 보내기',
|
|
785
815
|
'chat.list-failed-message.title': '전송 실패',
|
|
786
816
|
'chat.list-failed-message.description':
|
|
@@ -835,6 +865,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
835
865
|
'chat.empty.description': 'टीम के संदेश यहाँ दिखाए जाएंगे।',
|
|
836
866
|
'chat.live': 'जिव चैट',
|
|
837
867
|
'chat.support-team': 'सपोर्ट टीम',
|
|
868
|
+
'chat.date.today': 'आज',
|
|
869
|
+
'chat.date.yesterday': 'कल',
|
|
838
870
|
'customer.form.resend': 'पुनः भेजें',
|
|
839
871
|
'chat.list-failed-message.title': 'भेजने में विफल',
|
|
840
872
|
'chat.list-failed-message.description':
|
|
@@ -888,6 +920,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
888
920
|
'chat.empty.description': 'Berichten van het team worden hier weergegeven.',
|
|
889
921
|
'chat.live': 'Live Chat',
|
|
890
922
|
'chat.support-team': 'Supportteam',
|
|
923
|
+
'chat.date.today': 'Vandaag',
|
|
924
|
+
'chat.date.yesterday': 'Gisteren',
|
|
891
925
|
'customer.form.resend': 'Opnieuw verzenden',
|
|
892
926
|
'chat.list-failed-message.title': 'Verzenden mislukt',
|
|
893
927
|
'chat.list-failed-message.description':
|
|
@@ -938,6 +972,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
938
972
|
'chat.empty.description': 'הודעות הצוות יופיעו כאן.',
|
|
939
973
|
'chat.live': 'צ׳אט חי',
|
|
940
974
|
'chat.support-team': 'צוות תמיכה',
|
|
975
|
+
'chat.date.today': 'היום',
|
|
976
|
+
'chat.date.yesterday': 'אתמול',
|
|
941
977
|
'customer.form.resend': 'שלח שוב',
|
|
942
978
|
'chat.list-failed-message.title': 'שליחה נכשלה',
|
|
943
979
|
'chat.list-failed-message.description': 'הודעה לא נשלחה. אנא נסה שוב.',
|
|
@@ -991,6 +1027,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
991
1027
|
'chat.empty.description': 'Команда повідомлень зʼявиться тут.',
|
|
992
1028
|
'chat.live': 'Онлайн чат',
|
|
993
1029
|
'chat.support-team': 'Команда підтримки',
|
|
1030
|
+
'chat.date.today': 'Сьогодні',
|
|
1031
|
+
'chat.date.yesterday': 'Вчора',
|
|
994
1032
|
'customer.form.resend': 'Надіслати знову',
|
|
995
1033
|
'chat.list-failed-message.title': 'Не вдалося надіслати',
|
|
996
1034
|
'chat.list-failed-message.description':
|
|
@@ -1046,6 +1084,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1046
1084
|
'chat.empty.description': 'Együttes üzenetei itt láthatók.',
|
|
1047
1085
|
'chat.live': 'Élő csevegés',
|
|
1048
1086
|
'chat.support-team': 'Támogató csapat',
|
|
1087
|
+
'chat.date.today': 'Ma',
|
|
1088
|
+
'chat.date.yesterday': 'Tegnap',
|
|
1049
1089
|
'customer.form.resend': 'Újraküldés',
|
|
1050
1090
|
'chat.list-failed-message.title': 'Küldés sikertelen',
|
|
1051
1091
|
'chat.list-failed-message.description':
|
|
@@ -1101,6 +1141,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1101
1141
|
'chat.empty.description': 'Mesajele echipei vor fi afișate aici.',
|
|
1102
1142
|
'chat.live': 'Chat live',
|
|
1103
1143
|
'chat.support-team': 'Echipa de suport',
|
|
1144
|
+
'chat.date.today': 'Astăzi',
|
|
1145
|
+
'chat.date.yesterday': 'Ieri',
|
|
1104
1146
|
'customer.form.resend': 'Trimite din nou',
|
|
1105
1147
|
'chat.list-failed-message.title': 'Trimitere eșuată',
|
|
1106
1148
|
'chat.list-failed-message.description':
|
|
@@ -1154,6 +1196,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1154
1196
|
'chat.empty.description': 'Mesej pasukan akan dipaparkan di sini.',
|
|
1155
1197
|
'chat.live': 'Sembang Langsung',
|
|
1156
1198
|
'chat.support-team': 'Pasukan Sokongan',
|
|
1199
|
+
'chat.date.today': 'Hari ini',
|
|
1200
|
+
'chat.date.yesterday': 'Semalam',
|
|
1157
1201
|
'customer.form.resend': 'Hantar Semula',
|
|
1158
1202
|
'chat.list-failed-message.title': 'Gagal menghantar',
|
|
1159
1203
|
'chat.list-failed-message.description':
|
|
@@ -1206,6 +1250,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1206
1250
|
'chat.empty.description': 'Komanda mesajları burada görünəcək.',
|
|
1207
1251
|
'chat.live': 'Canlı Çat',
|
|
1208
1252
|
'chat.support-team': 'Dəstək Komandası',
|
|
1253
|
+
'chat.date.today': 'Bu gün',
|
|
1254
|
+
'chat.date.yesterday': 'Dünən',
|
|
1209
1255
|
'customer.form.resend': 'Təkrar Göndər',
|
|
1210
1256
|
'chat.list-failed-message.title': 'Göndərmə uğursuz oldu',
|
|
1211
1257
|
'chat.list-failed-message.description':
|
|
@@ -1258,6 +1304,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1258
1304
|
'chat.empty.description': 'Poruke tima će se pojaviti ovdje.',
|
|
1259
1305
|
'chat.live': 'Live Chat',
|
|
1260
1306
|
'chat.support-team': 'Tim za podršku',
|
|
1307
|
+
'chat.date.today': 'Danas',
|
|
1308
|
+
'chat.date.yesterday': 'Jučer',
|
|
1261
1309
|
'customer.form.resend': 'Pošalji ponovo',
|
|
1262
1310
|
'chat.list-failed-message.title': 'Slanje nije uspjelo',
|
|
1263
1311
|
'chat.list-failed-message.description':
|
|
@@ -1311,6 +1359,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1311
1359
|
'chat.empty.description': 'Команданың хабарламалары осында көрсетіледі.',
|
|
1312
1360
|
'chat.live': 'Тікелей чат',
|
|
1313
1361
|
'chat.support-team': 'Қолдау тобы',
|
|
1362
|
+
'chat.date.today': 'Бүгін',
|
|
1363
|
+
'chat.date.yesterday': 'Кеше',
|
|
1314
1364
|
'customer.form.resend': 'Қайта жіберу',
|
|
1315
1365
|
'chat.list-failed-message.title': 'Жіберілмеді',
|
|
1316
1366
|
'chat.list-failed-message.description':
|
|
@@ -1364,6 +1414,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1364
1414
|
'chat.empty.description': 'Spanboodskappe sal hier verskyn.',
|
|
1365
1415
|
'chat.live': 'Regstreekse Klets',
|
|
1366
1416
|
'chat.support-team': 'Ondersteuningspan',
|
|
1417
|
+
'chat.date.today': 'Vandag',
|
|
1418
|
+
'chat.date.yesterday': 'Gister',
|
|
1367
1419
|
'customer.form.resend': 'Stuur Oor',
|
|
1368
1420
|
'chat.list-failed-message.title': 'Stuur het misluk',
|
|
1369
1421
|
'chat.list-failed-message.description':
|
|
@@ -1416,6 +1468,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1416
1468
|
'chat.empty.description': 'Ìrántí ẹgbẹ́ yóò hàn níbí.',
|
|
1417
1469
|
'chat.live': 'Jíròrò Láìpẹ́',
|
|
1418
1470
|
'chat.support-team': 'Ẹgbẹ́ Atilẹ́yin',
|
|
1471
|
+
'chat.date.today': 'Lónìí',
|
|
1472
|
+
'chat.date.yesterday': 'Àná',
|
|
1419
1473
|
'customer.form.resend': 'Ránṣé̀ Padà',
|
|
1420
1474
|
'chat.list-failed-message.title': 'Ránṣé̀ kò rọrùn',
|
|
1421
1475
|
'chat.list-failed-message.description': 'A kòlẹ̀ ránṣé̀. Jọ̀wọ́, tún gbìyànjú.',
|
|
@@ -1467,6 +1521,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1467
1521
|
'chat.empty.description': 'Holdets beskeder vises her.',
|
|
1468
1522
|
'chat.live': 'Live Chat',
|
|
1469
1523
|
'chat.support-team': 'Supportteam',
|
|
1524
|
+
'chat.date.today': 'I dag',
|
|
1525
|
+
'chat.date.yesterday': 'I går',
|
|
1470
1526
|
'customer.form.resend': 'Send igen',
|
|
1471
1527
|
'chat.list-failed-message.title': 'Afsendelse mislykkedes',
|
|
1472
1528
|
'chat.list-failed-message.description':
|
|
@@ -1519,6 +1575,8 @@ export const LocalizationList: Record<LanguageCode, LocalizationKeys> = {
|
|
|
1519
1575
|
'chat.empty.description': 'Wiadomości zespołu pojawią się tutaj.',
|
|
1520
1576
|
'chat.live': 'Czat na żywo',
|
|
1521
1577
|
'chat.support-team': 'Zespół wsparcia',
|
|
1578
|
+
'chat.date.today': 'Dziś',
|
|
1579
|
+
'chat.date.yesterday': 'Wczoraj',
|
|
1522
1580
|
'customer.form.resend': 'Wyślij ponownie',
|
|
1523
1581
|
'chat.list-failed-message.title': 'Nie udało się wysłać',
|
|
1524
1582
|
'chat.list-failed-message.description':
|
package/src/hooks/usePolling.ts
CHANGED
|
@@ -13,7 +13,7 @@ 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
|
-
let interval:
|
|
16
|
+
let interval: ReturnType<typeof setInterval> | null = null;
|
|
17
17
|
if (customer && created_at) {
|
|
18
18
|
interval = setInterval(() => {
|
|
19
19
|
getNewCustomerConversation(customer?.external_id, created_at, {
|
|
@@ -4,7 +4,7 @@ const ACCUMULATOR_DEBOUNCE_TIME_IN_MS = 3000;
|
|
|
4
4
|
|
|
5
5
|
export class Accumulator {
|
|
6
6
|
private registerData: CreateCustomerRequest | null = null;
|
|
7
|
-
private __select_time:
|
|
7
|
+
private __select_time: ReturnType<typeof setTimeout> | undefined = undefined;
|
|
8
8
|
private listener: ((data: CreateCustomerRequest) => Promise<void>) | null =
|
|
9
9
|
null;
|
|
10
10
|
private _isListenerCalledOnce: boolean = false;
|