quickblox-react-ui-kit 0.1.7 → 0.2.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/dist/Presentation/Views/Base/BaseViewModel.d.ts +8 -0
- package/dist/Presentation/Views/Dialogs/Dialogs.d.ts +3 -1
- package/dist/Presentation/components/UI/Dialogs/DialogInformation/DialogInformation.d.ts +3 -1
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidget.d.ts +8 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/ErrorMessageIcon.d.ts +11 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy.d.ts +9 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultTextInputWidget.d.ts +2 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/useDefaultVoiceInputWidget.d.ts +2 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/ContextMenu.d.ts +10 -0
- package/dist/Presentation/components/UI/Dialogs/MessagesView/MessagesView.d.ts +7 -1
- package/dist/Presentation/components/UI/svgs/Icons/Media/AIWidget/index.d.ts +4 -0
- package/dist/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.d.ts +9 -0
- package/dist/Presentation/components/layouts/TestStage/CompanyLogo/CompanyLogo.d.ts +3 -0
- package/dist/Presentation/components/providers/QuickBloxUIKitProvider/useQbInitializedDataContext.d.ts +3 -0
- package/dist/Presentation/components/providers/QuickBloxUIKitProvider/useQbUIKitDataContext.d.ts +3 -0
- package/dist/QBconfig.d.ts +12 -0
- package/dist/index-ui.d.ts +3 -2
- package/dist/index-ui.js +72 -17
- package/dist/utils/utils.d.ts +3 -0
- package/package.json +1 -1
- package/src/App.tsx +21 -19
- package/src/Presentation/Views/Base/BaseViewModel.ts +17 -1
- package/src/Presentation/Views/Dialogs/Dialogs.tsx +14 -9
- package/src/Presentation/Views/Dialogs/useDialogsViewModel.ts +1 -1
- package/src/Presentation/components/UI/Dialogs/DialogInformation/DialogInformation.tsx +17 -8
- package/src/Presentation/components/UI/Dialogs/DialogInformation/UsersList/useUsersListViewModel.ts +2 -2
- package/src/Presentation/components/UI/Dialogs/EditDialog/EditDialog.tsx +2 -2
- package/src/Presentation/components/UI/Dialogs/InviteMembers/useInviteMembersViewModel.ts +2 -2
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/AIWidget.ts +13 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/ErrorMessageIcon.tsx +98 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy.tsx +136 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/UseDefaultTextInputWidget.tsx +60 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/AIWidgets/useDefaultVoiceInputWidget.tsx +86 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/ContextMenu.tsx +96 -0
- package/src/Presentation/components/UI/Dialogs/MessagesView/MessagesView.tsx +275 -51
- package/src/Presentation/components/UI/Dialogs/MessagesView/useMessagesViewModel.ts +2 -2
- package/src/Presentation/components/UI/svgs/Icons/Media/AIWidget/Send.svg +3 -0
- package/src/Presentation/components/UI/svgs/Icons/Media/AIWidget/index.tsx +39 -0
- package/src/Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout.tsx +83 -8
- package/src/Presentation/components/layouts/TestStage/CompanyLogo/CompanyLogo.tsx +27 -0
- package/src/Presentation/components/layouts/TestStage/LoginView/Login.tsx +2 -2
- package/src/Presentation/components/providers/QuickBloxUIKitProvider/useEventMessagesRepository.ts +2 -2
- package/src/Presentation/components/providers/QuickBloxUIKitProvider/{useQbDataContext.ts → useQbInitializedDataContext.ts} +2 -2
- package/src/Presentation/components/providers/QuickBloxUIKitProvider/useQbUIKitDataContext.ts +11 -0
- package/src/QBconfig.ts +12 -0
- package/src/index-ui.ts +4 -2
- package/src/utils/utils.ts +39 -0
- package/dist/Presentation/components/providers/QuickBloxUIKitProvider/useQbDataContext.d.ts +0 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import useQbInitializedDataContext from '../../providers/QuickBloxUIKitProvider/useQbInitializedDataContext';
|
|
3
3
|
import { DialogEntity } from '../../../../Domain/entity/DialogEntity';
|
|
4
4
|
import { DialogsViewModel } from '../../../Views/Dialogs/DialogViewModel';
|
|
5
5
|
import DialogsComponent from '../../../Views/Dialogs/Dialogs';
|
|
@@ -16,20 +16,39 @@ import { Pagination } from '../../../../Domain/repository/Pagination';
|
|
|
16
16
|
// import { DialogEventInfo } from '../../../../Domain/entity/DialogEventInfo';
|
|
17
17
|
import UiKitTheme from '../../../assets/UiKitTheme';
|
|
18
18
|
import BaseViewModel from '../../../Views/Base/BaseViewModel';
|
|
19
|
+
import { AIWidget } from '../../UI/Dialogs/MessagesView/AIWidgets/AIWidget';
|
|
20
|
+
import { QBConfig } from '../../../../QBconfig';
|
|
21
|
+
import UseDefaultAIAssistAnswerWidgetWithProxy from '../../UI/Dialogs/MessagesView/AIWidgets/UseDefaultAIAssistAnswerWidgetWithProxy';
|
|
22
|
+
|
|
23
|
+
type AIWidgetPlaceHolder = {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
default: boolean;
|
|
26
|
+
AIWidget?: AIWidget;
|
|
27
|
+
};
|
|
19
28
|
|
|
20
29
|
type QuickBloxUIKitDesktopLayoutProps = {
|
|
21
30
|
theme?: UiKitTheme;
|
|
31
|
+
AIEditMessage?: AIWidgetPlaceHolder;
|
|
32
|
+
AITranslation?: AIWidgetPlaceHolder;
|
|
33
|
+
AIAnswerToMessage?: AIWidgetPlaceHolder;
|
|
22
34
|
};
|
|
23
35
|
|
|
24
36
|
const QuickBloxUIKitDesktopLayout: React.FC<
|
|
25
37
|
QuickBloxUIKitDesktopLayoutProps
|
|
26
38
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,react/function-component-definition
|
|
27
|
-
> = ({
|
|
39
|
+
> = ({
|
|
40
|
+
theme = undefined,
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
42
|
+
AITranslation = undefined,
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
44
|
+
AIEditMessage = undefined,
|
|
45
|
+
AIAnswerToMessage = undefined,
|
|
46
|
+
}: QuickBloxUIKitDesktopLayoutProps) => {
|
|
28
47
|
console.log('create QuickBloxUIKitDesktopLayout');
|
|
29
48
|
const [selectedDialog, setSelectedDialog] =
|
|
30
49
|
React.useState<BaseViewModel<DialogEntity>>();
|
|
31
50
|
|
|
32
|
-
const currentContext =
|
|
51
|
+
const currentContext = useQbInitializedDataContext();
|
|
33
52
|
// const eventMessaging = useEventMessagesRepository();
|
|
34
53
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
35
54
|
// @ts-ignore
|
|
@@ -37,16 +56,62 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
37
56
|
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userName;
|
|
38
57
|
const userId =
|
|
39
58
|
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.userId;
|
|
59
|
+
const sessionToken =
|
|
60
|
+
currentContext.storage.REMOTE_DATA_SOURCE.authInformation?.sessionToken;
|
|
40
61
|
|
|
41
62
|
const dialogsViewModel: DialogsViewModel =
|
|
42
63
|
useDialogsViewModel(currentContext);
|
|
43
64
|
|
|
65
|
+
const defaultAIEditMessageWidget = AIEditMessage?.AIWidget; // useDefaultTextInputWidget();
|
|
66
|
+
const defaultAITranslateWidget = AITranslation?.AIWidget;
|
|
67
|
+
// if (!defaultAIEditMessageWidget) {
|
|
68
|
+
// defaultAIEditMessageWidget = useDefaultTextInputWidget();
|
|
69
|
+
// }
|
|
70
|
+
// const defaultAITranslateWidget =
|
|
71
|
+
// AITranslation?.AIWidget || useDefaultVoiceInputWidget();
|
|
72
|
+
let defaultAIAnswerToMessageWidget;
|
|
73
|
+
|
|
74
|
+
const getAIAssistAnswer = (): void => {
|
|
75
|
+
if (AIAnswerToMessage?.enabled && !AIAnswerToMessage?.default) {
|
|
76
|
+
defaultAIAnswerToMessageWidget = AIAnswerToMessage.AIWidget;
|
|
77
|
+
} else if (
|
|
78
|
+
AIAnswerToMessage?.enabled ||
|
|
79
|
+
QBConfig.configAIApi.AIAnswerAssistWidgetConfig.useDefault
|
|
80
|
+
) {
|
|
81
|
+
if (
|
|
82
|
+
!QBConfig.configAIApi.AIAnswerAssistWidgetConfig.useDefault ||
|
|
83
|
+
(AIAnswerToMessage && !AIAnswerToMessage?.default)
|
|
84
|
+
) {
|
|
85
|
+
defaultAIAnswerToMessageWidget = undefined;
|
|
86
|
+
} else {
|
|
87
|
+
const { apiKey } = QBConfig.configAIApi.AIAnswerAssistWidgetConfig;
|
|
88
|
+
let token = '';
|
|
89
|
+
|
|
90
|
+
if (apiKey) {
|
|
91
|
+
token = apiKey;
|
|
92
|
+
} else {
|
|
93
|
+
token =
|
|
94
|
+
QBConfig.configAIApi.AIAnswerAssistWidgetConfig.proxyConfig
|
|
95
|
+
.sessionToken ||
|
|
96
|
+
sessionToken ||
|
|
97
|
+
'';
|
|
98
|
+
}
|
|
99
|
+
defaultAIAnswerToMessageWidget =
|
|
100
|
+
UseDefaultAIAssistAnswerWidgetWithProxy({
|
|
101
|
+
...QBConfig.configAIApi.AIAnswerAssistWidgetConfig.proxyConfig,
|
|
102
|
+
sessionToken: token,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
getAIAssistAnswer();
|
|
109
|
+
|
|
44
110
|
const selectDialogActions = (item: BaseViewModel<DialogEntity>): void => {
|
|
45
111
|
if (!dialogsViewModel.loading) {
|
|
46
112
|
setSelectedDialog(item);
|
|
47
113
|
}
|
|
48
114
|
};
|
|
49
|
-
|
|
50
115
|
// const subscribeToDialogEventsUseCase: SubscribeToDialogEventsUseCase =
|
|
51
116
|
// new SubscribeToDialogEventsUseCase(eventMessaging, 'TestStage');
|
|
52
117
|
|
|
@@ -181,23 +246,32 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
181
246
|
theme={theme}
|
|
182
247
|
dialogsView={
|
|
183
248
|
<DialogsComponent
|
|
249
|
+
// subHeaderContent={<CompanyLogo />}
|
|
250
|
+
// upHeaderContent={<CompanyLogo />}
|
|
184
251
|
dialogsViewModel={dialogsViewModel} // 1 Get 2 Update UseCase
|
|
185
|
-
|
|
252
|
+
onDialogSelectHandler={selectDialogActions}
|
|
186
253
|
additionalSettings={{
|
|
187
254
|
withoutHeader: false,
|
|
188
255
|
themeHeader: theme,
|
|
189
256
|
themePreview: theme,
|
|
257
|
+
useSubHeader: false,
|
|
258
|
+
useUpHeader: false,
|
|
190
259
|
}}
|
|
191
260
|
/>
|
|
192
261
|
}
|
|
193
262
|
dialogMessagesView={
|
|
194
263
|
selectedDialog && selectedDialog.entity && dialogsViewModel.entity ? (
|
|
195
264
|
<MessagesView
|
|
265
|
+
// subHeaderContent={<CompanyLogo />}
|
|
266
|
+
// upHeaderContent={<CompanyLogo />}
|
|
196
267
|
dialogsViewModel={dialogsViewModel}
|
|
197
|
-
|
|
268
|
+
onDialogInformationHandler={informationOpenHandler}
|
|
198
269
|
maxWidthToResize={
|
|
199
270
|
selectedDialog && needDialogInformation ? undefined : '1040px'
|
|
200
271
|
}
|
|
272
|
+
AIEditMessage={defaultAIEditMessageWidget}
|
|
273
|
+
AITranslation={defaultAITranslateWidget}
|
|
274
|
+
AIAnswerToMessage={defaultAIAnswerToMessageWidget}
|
|
201
275
|
theme={theme}
|
|
202
276
|
/> // 1 Get Messages + 1 Get User by Id
|
|
203
277
|
) : (
|
|
@@ -219,10 +293,11 @@ const QuickBloxUIKitDesktopLayout: React.FC<
|
|
|
219
293
|
<div>
|
|
220
294
|
{selectedDialog && needDialogInformation && (
|
|
221
295
|
<DialogInformation
|
|
296
|
+
// subHeaderContent={<CompanyLogo />}
|
|
297
|
+
// upHeaderContent={<CompanyLogo />}
|
|
222
298
|
dialog={selectedDialog.entity}
|
|
223
299
|
dialogViewModel={dialogsViewModel}
|
|
224
|
-
|
|
225
|
-
theme={theme}
|
|
300
|
+
onCloseDialogInformationHandler={informationCloseHandler}
|
|
226
301
|
/>
|
|
227
302
|
)}
|
|
228
303
|
</div>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line react/function-component-definition
|
|
4
|
+
const CompanyLogo: React.FC = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div
|
|
7
|
+
style={{
|
|
8
|
+
display: 'flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
width: '322px',
|
|
11
|
+
height: '42px',
|
|
12
|
+
border: '1px solid #333',
|
|
13
|
+
}}
|
|
14
|
+
>
|
|
15
|
+
<img
|
|
16
|
+
src="../../../../../../src/Presentation/assets/img/bee-img.png"
|
|
17
|
+
alt="Company Logo"
|
|
18
|
+
style={{ width: '100px', height: 'auto', marginRight: '10px' }}
|
|
19
|
+
/>
|
|
20
|
+
<span style={{ fontSize: '24px', fontWeight: 'bold', color: '#333' }}>
|
|
21
|
+
Your Company Name
|
|
22
|
+
</span>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default CompanyLogo;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import './Login.scss';
|
|
3
3
|
import { InitParams } from '../../../providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider';
|
|
4
|
-
import
|
|
4
|
+
import useQbInitializedDataContext from '../../../providers/QuickBloxUIKitProvider/useQbInitializedDataContext';
|
|
5
5
|
import { LoginData } from '../../../../../Data/source/remote/RemoteDataSource';
|
|
6
6
|
|
|
7
7
|
export type FunctionTypeLoginDataToVoid = (data: LoginData) => void;
|
|
@@ -11,7 +11,7 @@ type LoginProps = {
|
|
|
11
11
|
};
|
|
12
12
|
// eslint-disable-next-line react/function-component-definition
|
|
13
13
|
const Login: React.FC<LoginProps> = ({ loginHandler }: LoginProps) => {
|
|
14
|
-
const currentContext =
|
|
14
|
+
const currentContext = useQbInitializedDataContext();
|
|
15
15
|
const [UserName, setUsername] = useState(
|
|
16
16
|
currentContext.InitParams.loginData?.login || 'tester',
|
|
17
17
|
);
|
package/src/Presentation/components/providers/QuickBloxUIKitProvider/useEventMessagesRepository.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import EventMessagesRepository from '../../../../Data/repository/EventMessagesRepository';
|
|
2
|
-
import
|
|
2
|
+
import useQbInitializedDataContext from './useQbInitializedDataContext';
|
|
3
3
|
|
|
4
4
|
const useEventMessagesRepository = (): EventMessagesRepository => {
|
|
5
|
-
const currentQbDataContext =
|
|
5
|
+
const currentQbDataContext = useQbInitializedDataContext();
|
|
6
6
|
|
|
7
7
|
return currentQbDataContext.storage.EVENT_MESSAGE_REPOSITORY;
|
|
8
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { qbDataContext, QBDataContextType } from './QuickBloxUIKitProvider';
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const useQbInitializedDataContext = (): QBDataContextType => {
|
|
5
5
|
const currentQbDataContext = React.useContext(qbDataContext);
|
|
6
6
|
|
|
7
7
|
console.log(
|
|
@@ -79,4 +79,4 @@ const useQbDataContext = (): QBDataContextType => {
|
|
|
79
79
|
return currentQbDataContext;
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
export default
|
|
82
|
+
export default useQbInitializedDataContext;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { qbDataContext, QBDataContextType } from './QuickBloxUIKitProvider';
|
|
3
|
+
|
|
4
|
+
const useQbUIKitDataContext = (): QBDataContextType => {
|
|
5
|
+
const currentQbDataContext: QBDataContextType =
|
|
6
|
+
React.useContext(qbDataContext);
|
|
7
|
+
|
|
8
|
+
return currentQbDataContext;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default useQbUIKitDataContext;
|
package/src/QBconfig.ts
CHANGED
|
@@ -6,6 +6,18 @@ export const QBConfig = {
|
|
|
6
6
|
authSecret: '',
|
|
7
7
|
sessionToken: '',
|
|
8
8
|
},
|
|
9
|
+
configAIApi: {
|
|
10
|
+
AIAnswerAssistWidgetConfig: {
|
|
11
|
+
apiKey: '', // Replace with your real API key
|
|
12
|
+
useDefault: true,
|
|
13
|
+
proxyConfig: {
|
|
14
|
+
api: 'v1/chat/completions',
|
|
15
|
+
servername: 'https://api.openai.com/',
|
|
16
|
+
port: '',
|
|
17
|
+
sessionToken: '',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
9
21
|
appConfig: {
|
|
10
22
|
maxFileSize: 10 * 1024 * 1024,
|
|
11
23
|
sessionTimeOut: 122,
|
package/src/index-ui.ts
CHANGED
|
@@ -8,7 +8,7 @@ import QuickBloxUIKitProvider, {
|
|
|
8
8
|
} from './Presentation/components/providers/QuickBloxUIKitProvider/QuickBloxUIKitProvider';
|
|
9
9
|
import { LocalDataSource } from './Data/source/local/LocalDataSource';
|
|
10
10
|
import useQBConnection from './Presentation/components/providers/QuickBloxUIKitProvider/useQBConnection';
|
|
11
|
-
import
|
|
11
|
+
import useQbInitializedDataContext from './Presentation/components/providers/QuickBloxUIKitProvider/useQbInitializedDataContext';
|
|
12
12
|
import useEventMessagesRepository from './Presentation/components/providers/QuickBloxUIKitProvider/useEventMessagesRepository';
|
|
13
13
|
import { DialogsViewModel } from './Presentation/Views/Dialogs/DialogViewModel';
|
|
14
14
|
import useDialogsViewModel from './Presentation/Views/Dialogs/useDialogsViewModel';
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
import QuickBloxUIKitDesktopLayout from './Presentation/components/layouts/Desktop/QuickBloxUIKitDesktopLayout';
|
|
33
33
|
import DefaultTheme from './Presentation/assets/DefaultThemes/DefaultTheme';
|
|
34
34
|
import UiKitTheme from './Presentation/assets/UiKitTheme';
|
|
35
|
+
import useQbUIKitDataContext from './Presentation/components/providers/QuickBloxUIKitProvider/useQbUIKitDataContext';
|
|
35
36
|
|
|
36
37
|
export {
|
|
37
38
|
MainButton,
|
|
@@ -44,7 +45,8 @@ export {
|
|
|
44
45
|
RemoteDataSource,
|
|
45
46
|
LocalDataSource,
|
|
46
47
|
useQBConnection,
|
|
47
|
-
|
|
48
|
+
useQbInitializedDataContext,
|
|
49
|
+
useQbUIKitDataContext,
|
|
48
50
|
useEventMessagesRepository,
|
|
49
51
|
type DialogsViewModel,
|
|
50
52
|
useDialogsViewModel,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// import { encode } from 'gpt-3-encoder';
|
|
2
|
+
|
|
3
|
+
export const completeSentence = (text?: string) =>
|
|
4
|
+
text?.replace(/([^.!?;]+)[^.!?;]*$/, ' ...') || '';
|
|
5
|
+
|
|
6
|
+
// export const tokenCounter = (text?: string) => (text ? encode(text).length : 0);
|
|
7
|
+
|
|
8
|
+
export const tokenCounter = (text?: string) => (text ? text.length / 4 : 0);
|
|
9
|
+
|
|
10
|
+
export const loopToLimitTokens = <T>(
|
|
11
|
+
limit: number,
|
|
12
|
+
data: T[],
|
|
13
|
+
getValue: (item: T) => string = (item) =>
|
|
14
|
+
typeof item === 'string' ? item : String(item),
|
|
15
|
+
tokens = 0,
|
|
16
|
+
): T[] => {
|
|
17
|
+
if (!data.length) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const [firstItem, ...lastItems] = data;
|
|
22
|
+
|
|
23
|
+
const itemValue = getValue(firstItem);
|
|
24
|
+
const itemTokens = tokenCounter(itemValue);
|
|
25
|
+
const amountTokens = tokens + itemTokens;
|
|
26
|
+
|
|
27
|
+
if (amountTokens <= limit) {
|
|
28
|
+
const nextData = loopToLimitTokens(
|
|
29
|
+
limit,
|
|
30
|
+
lastItems,
|
|
31
|
+
getValue,
|
|
32
|
+
amountTokens,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return itemTokens === 0 ? nextData : [firstItem, ...nextData];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return [];
|
|
39
|
+
};
|