@bytexbyte/nxtlinq-ai-agent-sdk 1.6.24 → 1.6.25
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/components/context/ChatBotContext.d.ts.map +1 -1
- package/dist/components/context/ChatBotContext.js +24 -30
- package/dist/components/types/ChatBotTypes.d.ts.map +1 -1
- package/dist/components/ui/BerifyMeModal.d.ts +0 -5
- package/dist/components/ui/BerifyMeModal.d.ts.map +1 -1
- package/dist/components/ui/BerifyMeModal.js +5 -7
- package/dist/components/ui/ChatBotUI.d.ts.map +1 -1
- package/dist/components/ui/ChatBotUI.js +4 -3
- package/dist/components/ui/MessageInput.d.ts.map +1 -1
- package/dist/components/ui/MessageInput.js +3 -2
- package/dist/components/ui/MessageList.d.ts.map +1 -1
- package/dist/components/ui/MessageList.js +2 -1
- package/dist/components/ui/ModelSelector.d.ts.map +1 -1
- package/dist/components/ui/ModelSelector.js +4 -5
- package/dist/components/ui/PermissionForm.d.ts.map +1 -1
- package/dist/components/ui/PermissionForm.js +10 -9
- package/dist/core/utils/walletTextUtils.d.ts +14 -0
- package/dist/core/utils/walletTextUtils.d.ts.map +1 -0
- package/dist/core/utils/walletTextUtils.js +23 -0
- package/package.json +1 -1
- package/umd/nxtlinq-ai-agent.umd.js +150 -129
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatBotContext.d.ts","sourceRoot":"","sources":["../../../src/components/context/ChatBotContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,UAAU,0BAMtB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAy9ElD,CAAC"}
|
|
@@ -10,6 +10,7 @@ import { useSpeechToTextFromMic } from '../../core/lib/useSpeechToTextFromMic';
|
|
|
10
10
|
import textToBuffer, { getDefaultSpeechToken } from '../../core/lib/textToSpeech';
|
|
11
11
|
import metakeepClient from '../../core/metakeepClient';
|
|
12
12
|
import { sleep } from '../../core/utils';
|
|
13
|
+
import * as walletTextUtils from '../../core/utils/walletTextUtils';
|
|
13
14
|
const MIC_ENABLED_SESSION_KEY = 'chatbot-mic-enabled';
|
|
14
15
|
const ChatBotContext = React.createContext(undefined);
|
|
15
16
|
export const useChatBot = () => {
|
|
@@ -635,13 +636,6 @@ isStopRecordingOnSend = false, }) => {
|
|
|
635
636
|
const showError = (message) => showNotification('error', message, 5000);
|
|
636
637
|
const showWarning = (message) => showNotification('warning', message, 4000);
|
|
637
638
|
const showInfo = (message) => showNotification('info', message, 3000);
|
|
638
|
-
// Filter out wallet connection messages for API calls
|
|
639
|
-
const getFilteredMessagesForAPI = () => {
|
|
640
|
-
return messages.filter(msg => !msg.content.includes('Please connect your HIT wallet') &&
|
|
641
|
-
!msg.content.includes('Please sign in with your wallet') &&
|
|
642
|
-
!msg.content.includes('connect your wallet') &&
|
|
643
|
-
!msg.content.includes('Wallet verification completed successfully'));
|
|
644
|
-
};
|
|
645
639
|
// Fetch available permissions
|
|
646
640
|
const fetchAvailablePermissions = async () => {
|
|
647
641
|
if (!serviceId)
|
|
@@ -813,14 +807,14 @@ isStopRecordingOnSend = false, }) => {
|
|
|
813
807
|
if (isNeedSignInWithWallet) {
|
|
814
808
|
setMessages(prev => [...prev, {
|
|
815
809
|
id: Date.now().toString(),
|
|
816
|
-
content: 'Please sign in with your wallet to continue.',
|
|
810
|
+
content: walletTextUtils.getWalletText('Please sign in with your wallet to continue.', serviceId),
|
|
817
811
|
role: 'assistant',
|
|
818
812
|
timestamp: new Date().toISOString(),
|
|
819
813
|
button: 'signIn'
|
|
820
814
|
}]);
|
|
821
815
|
}
|
|
822
816
|
else {
|
|
823
|
-
showSuccess('Successfully connected your HIT wallet. You are already signed in and can use the AI agent.');
|
|
817
|
+
showSuccess(walletTextUtils.getWalletText('Successfully connected your HIT wallet. You are already signed in and can use the AI agent.', serviceId));
|
|
824
818
|
}
|
|
825
819
|
}
|
|
826
820
|
return userAddress;
|
|
@@ -865,14 +859,14 @@ isStopRecordingOnSend = false, }) => {
|
|
|
865
859
|
if (!addressToUse) {
|
|
866
860
|
console.log('No address available, returning early');
|
|
867
861
|
if (autoShowSuccessMessage) {
|
|
868
|
-
showError('Please connect your wallet first.');
|
|
862
|
+
showError(walletTextUtils.getWalletText('Please connect your wallet first.', serviceId));
|
|
869
863
|
}
|
|
870
864
|
return;
|
|
871
865
|
}
|
|
872
866
|
if (!signerToUse) {
|
|
873
867
|
console.log('No signer available, returning early');
|
|
874
868
|
if (autoShowSuccessMessage) {
|
|
875
|
-
showError('Please connect your wallet first.');
|
|
869
|
+
showError(walletTextUtils.getWalletText('Please connect your wallet first.', serviceId));
|
|
876
870
|
}
|
|
877
871
|
return;
|
|
878
872
|
}
|
|
@@ -907,7 +901,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
907
901
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
908
902
|
await refreshAIT();
|
|
909
903
|
if (autoShowSuccessMessage) {
|
|
910
|
-
showSuccess('Successfully signed in with your HIT wallet. You can now use the AI agent.');
|
|
904
|
+
showSuccess(walletTextUtils.getWalletText('Successfully signed in with your HIT wallet. You can now use the AI agent.', serviceId));
|
|
911
905
|
}
|
|
912
906
|
}
|
|
913
907
|
catch (error) {
|
|
@@ -929,7 +923,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
929
923
|
setIsLoading(false); // Stop thinking before showing message
|
|
930
924
|
setMessages(prev => [...prev, {
|
|
931
925
|
id: Date.now().toString(),
|
|
932
|
-
content: 'Please connect your HIT wallet to continue.',
|
|
926
|
+
content: walletTextUtils.getWalletText('Please connect your HIT wallet to continue.', serviceId),
|
|
933
927
|
role: 'assistant',
|
|
934
928
|
timestamp: new Date().toISOString(),
|
|
935
929
|
button: 'connectWallet'
|
|
@@ -939,7 +933,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
939
933
|
await connectWallet(false); // Don't show sign-in message yet
|
|
940
934
|
setIsAutoConnecting(false); // Clear auto-connecting state
|
|
941
935
|
// Show brief success message for auto-connect
|
|
942
|
-
showSuccess('Auto wallet connection successful');
|
|
936
|
+
showSuccess(walletTextUtils.getWalletText('Auto wallet connection successful', serviceId));
|
|
943
937
|
onAutoConnect?.(); // Call callback if provided
|
|
944
938
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
945
939
|
// After auto connect, if not signed in, then auto sign-in
|
|
@@ -949,7 +943,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
949
943
|
await signInWallet(false);
|
|
950
944
|
onAutoSignIn?.(); // Call callback if provided
|
|
951
945
|
setIsAutoConnecting(false);
|
|
952
|
-
showSuccess('Auto sign-in successful after wallet connect');
|
|
946
|
+
showSuccess(walletTextUtils.getWalletText('Auto sign-in successful after wallet connect', serviceId));
|
|
953
947
|
await refreshAIT();
|
|
954
948
|
// Wait for AIT to be fully loaded with polling
|
|
955
949
|
let attempts = 0;
|
|
@@ -977,7 +971,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
977
971
|
setIsLoading(false); // Stop thinking before showing message
|
|
978
972
|
setMessages(prev => [...prev, {
|
|
979
973
|
id: Date.now().toString(),
|
|
980
|
-
content: 'Please sign in with your HIT wallet to continue.',
|
|
974
|
+
content: walletTextUtils.getWalletText('Please sign in with your HIT wallet to continue.', serviceId),
|
|
981
975
|
role: 'assistant',
|
|
982
976
|
timestamp: new Date().toISOString(),
|
|
983
977
|
button: 'signIn'
|
|
@@ -1028,7 +1022,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1028
1022
|
setIsLoading(false); // Stop thinking before showing message
|
|
1029
1023
|
setMessages(prev => [...prev, {
|
|
1030
1024
|
id: Date.now().toString(),
|
|
1031
|
-
content: 'Wallet address mismatch. Please sign in with the correct wallet.',
|
|
1025
|
+
content: walletTextUtils.getWalletText('Wallet address mismatch. Please sign in with the correct wallet.', serviceId),
|
|
1032
1026
|
role: 'assistant',
|
|
1033
1027
|
timestamp: new Date().toISOString(),
|
|
1034
1028
|
button: 'signIn'
|
|
@@ -1078,7 +1072,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1078
1072
|
setIsLoading(false); // Stop thinking before showing message
|
|
1079
1073
|
setMessages(prev => [...prev, {
|
|
1080
1074
|
id: Date.now().toString(),
|
|
1081
|
-
content: 'Invalid wallet session. Please sign in again.',
|
|
1075
|
+
content: walletTextUtils.getWalletText('Invalid wallet session. Please sign in again.', serviceId),
|
|
1082
1076
|
role: 'assistant',
|
|
1083
1077
|
timestamp: new Date().toISOString(),
|
|
1084
1078
|
button: 'signIn'
|
|
@@ -1126,7 +1120,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1126
1120
|
setIsLoading(false); // Stop thinking before showing message
|
|
1127
1121
|
setMessages(prev => [...prev, {
|
|
1128
1122
|
id: Date.now().toString(),
|
|
1129
|
-
content: 'Loading your wallet configuration... Please wait a moment.',
|
|
1123
|
+
content: walletTextUtils.getWalletText('Loading your wallet configuration... Please wait a moment.', serviceId),
|
|
1130
1124
|
role: 'assistant',
|
|
1131
1125
|
timestamp: new Date().toISOString()
|
|
1132
1126
|
}]);
|
|
@@ -1148,7 +1142,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1148
1142
|
setIsLoading(false); // Stop thinking before showing message
|
|
1149
1143
|
setMessages(prev => [...prev, {
|
|
1150
1144
|
id: Date.now().toString(),
|
|
1151
|
-
content: 'No AIT found for your wallet. Please click the settings button (⚙️) to configure your AIT permissions.',
|
|
1145
|
+
content: walletTextUtils.getWalletText('No AIT found for your wallet. Please click the settings button (⚙️) to configure your AIT permissions.', serviceId),
|
|
1152
1146
|
role: 'assistant',
|
|
1153
1147
|
timestamp: new Date().toISOString()
|
|
1154
1148
|
}]);
|
|
@@ -1201,7 +1195,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1201
1195
|
setIsLoading(false); // Stop thinking before showing message
|
|
1202
1196
|
setMessages(prev => [...prev, {
|
|
1203
1197
|
id: Date.now().toString(),
|
|
1204
|
-
content: 'Loading your wallet configuration... Please wait a moment.',
|
|
1198
|
+
content: walletTextUtils.getWalletText('Loading your wallet configuration... Please wait a moment.', serviceId),
|
|
1205
1199
|
role: 'assistant',
|
|
1206
1200
|
timestamp: new Date().toISOString()
|
|
1207
1201
|
}]);
|
|
@@ -1865,13 +1859,13 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1865
1859
|
await signInWallet(false); // Don't show success message yet
|
|
1866
1860
|
}
|
|
1867
1861
|
catch (signInError) {
|
|
1868
|
-
showError('Wallet connected but sign-in failed. Please try signing in manually.');
|
|
1862
|
+
showError(walletTextUtils.getWalletText('Wallet connected but sign-in failed. Please try signing in manually.', serviceId));
|
|
1869
1863
|
setIsAITEnabling(false);
|
|
1870
1864
|
return false;
|
|
1871
1865
|
}
|
|
1872
1866
|
}
|
|
1873
1867
|
else {
|
|
1874
|
-
showError('Please connect your wallet first');
|
|
1868
|
+
showError(walletTextUtils.getWalletText('Please connect your wallet first', serviceId));
|
|
1875
1869
|
setIsAITEnabling(false);
|
|
1876
1870
|
return false;
|
|
1877
1871
|
}
|
|
@@ -1883,7 +1877,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
1883
1877
|
console.error('Current hitAddress:', currentHitAddress);
|
|
1884
1878
|
console.error('Signer ref:', !!signerRef.current);
|
|
1885
1879
|
console.error('HitAddress ref:', hitAddressRef.current);
|
|
1886
|
-
showError('Wallet connection failed. Please try connecting your wallet manually.');
|
|
1880
|
+
showError(walletTextUtils.getWalletText('Wallet connection failed. Please try connecting your wallet manually.', serviceId));
|
|
1887
1881
|
setIsAITEnabling(false);
|
|
1888
1882
|
return false;
|
|
1889
1883
|
}
|
|
@@ -2023,7 +2017,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
2023
2017
|
}
|
|
2024
2018
|
}
|
|
2025
2019
|
setIsLoading(false);
|
|
2026
|
-
showSuccess('Wallet verification completed successfully! Your wallet is now verified and ready to use.');
|
|
2020
|
+
showSuccess(walletTextUtils.getWalletText('Wallet verification completed successfully! Your wallet is now verified and ready to use.', serviceId));
|
|
2027
2021
|
refreshAIT();
|
|
2028
2022
|
return;
|
|
2029
2023
|
}
|
|
@@ -2099,12 +2093,12 @@ isStopRecordingOnSend = false, }) => {
|
|
|
2099
2093
|
// Wallet already exists with the same method, just refresh AIT
|
|
2100
2094
|
await refreshAIT();
|
|
2101
2095
|
setIsLoading(false);
|
|
2102
|
-
showSuccess('Wallet verification completed successfully! Your wallet is now verified and ready to use.');
|
|
2096
|
+
showSuccess(walletTextUtils.getWalletText('Wallet verification completed successfully! Your wallet is now verified and ready to use.', serviceId));
|
|
2103
2097
|
return;
|
|
2104
2098
|
}
|
|
2105
2099
|
// Handle specific error messages
|
|
2106
2100
|
if (verifyWalletResponse.error === 'Cannot downgrade from Berify.me verification to custom verification') {
|
|
2107
|
-
showError('This wallet is already verified with Berify.me. Custom verification cannot override Berify.me verification.');
|
|
2101
|
+
showError(walletTextUtils.getWalletText('This wallet is already verified with Berify.me. Custom verification cannot override Berify.me verification.', serviceId));
|
|
2108
2102
|
}
|
|
2109
2103
|
else {
|
|
2110
2104
|
showError(verifyWalletResponse.error);
|
|
@@ -2115,12 +2109,12 @@ isStopRecordingOnSend = false, }) => {
|
|
|
2115
2109
|
// Successfully created wallet with custom method
|
|
2116
2110
|
await refreshAIT();
|
|
2117
2111
|
setIsLoading(false);
|
|
2118
|
-
showSuccess('Wallet verification completed successfully! Your wallet is now verified and ready to use.');
|
|
2112
|
+
showSuccess(walletTextUtils.getWalletText('Wallet verification completed successfully! Your wallet is now verified and ready to use.', serviceId));
|
|
2119
2113
|
return;
|
|
2120
2114
|
}
|
|
2121
2115
|
catch (error) {
|
|
2122
2116
|
console.error('Custom wallet verification failed:', error);
|
|
2123
|
-
showError('Failed to verify wallet with custom method. Please try again.');
|
|
2117
|
+
showError(walletTextUtils.getWalletText('Failed to verify wallet with custom method. Please try again.', serviceId));
|
|
2124
2118
|
setIsLoading(false);
|
|
2125
2119
|
return;
|
|
2126
2120
|
}
|
|
@@ -2132,7 +2126,7 @@ isStopRecordingOnSend = false, }) => {
|
|
|
2132
2126
|
catch (error) {
|
|
2133
2127
|
console.error('Failed to verify wallet:', error);
|
|
2134
2128
|
setIsLoading(false);
|
|
2135
|
-
showError('Failed to verify wallet. Please try again.');
|
|
2129
|
+
showError(walletTextUtils.getWalletText('Failed to verify wallet. Please try again.', serviceId));
|
|
2136
2130
|
throw error;
|
|
2137
2131
|
}
|
|
2138
2132
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotTypes.d.ts","sourceRoot":"","sources":["../../../src/components/types/ChatBotTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,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C,CAAC;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IAGzB,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** @jsxImportSource @emotion/react */
|
|
2
1
|
import React from 'react';
|
|
3
2
|
interface BerifyMeModalProps {
|
|
4
3
|
isOpen: boolean;
|
|
@@ -11,10 +10,6 @@ declare global {
|
|
|
11
10
|
interface Window {
|
|
12
11
|
BerifyMeSDK?: {
|
|
13
12
|
modal: any;
|
|
14
|
-
environment: {
|
|
15
|
-
Staging: any;
|
|
16
|
-
Production: any;
|
|
17
|
-
};
|
|
18
13
|
};
|
|
19
14
|
}
|
|
20
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BerifyMeModal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BerifyMeModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BerifyMeModal.d.ts","sourceRoot":"","sources":["../../../src/components/ui/BerifyMeModal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;CAChC;AASD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoHtD,CAAC;AAGF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,WAAW,CAAC,EAAE;YACZ,KAAK,EAAE,GAAG,CAAC;SACZ,CAAC;KACH;CACF"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
2
|
/** @jsxImportSource @emotion/react */
|
|
3
|
-
import React, { useEffect, useRef } from 'react';
|
|
4
3
|
import { css } from '@emotion/react';
|
|
4
|
+
import React, { useEffect, useRef } from 'react';
|
|
5
5
|
import { modalOverlay } from './styles/isolatedStyles';
|
|
6
6
|
// Built-in BerifyMe configuration
|
|
7
7
|
const BUILT_IN_BERIFYME_CONFIG = {
|
|
8
|
-
apiKeyId: '
|
|
9
|
-
secretKey: '
|
|
10
|
-
environment: '
|
|
8
|
+
apiKeyId: 'idv_XjN7vvuQVfHnaUkVQAEhdTuxAsQeKoa9',
|
|
9
|
+
secretKey: 'aaa444b1-087c-4b17-821a-9a6974286905',
|
|
10
|
+
environment: 'idv'
|
|
11
11
|
};
|
|
12
12
|
export const BerifyMeModal = ({ isOpen, onClose, onVerificationComplete, mode = 'built-in' }) => {
|
|
13
13
|
const modalRef = useRef(null);
|
|
@@ -71,14 +71,12 @@ export const BerifyMeModal = ({ isOpen, onClose, onVerificationComplete, mode =
|
|
|
71
71
|
const redirectUrl = `${window.location.origin}${window.location.pathname}?isAutoConnect=true&method=berifyme&returnUrl=${encodeURIComponent(currentUrl)}`;
|
|
72
72
|
// Create BerifyMe modal using built-in config
|
|
73
73
|
const berifyMeModal = window.BerifyMeSDK.modal;
|
|
74
|
-
// Always use staging environment for now
|
|
75
|
-
const environment = window.BerifyMeSDK.environment.Staging;
|
|
76
74
|
// Use React 18's createRoot
|
|
77
75
|
const { createRoot } = require('react-dom/client');
|
|
78
76
|
const root = createRoot(modalRef.current);
|
|
79
77
|
berifyMeModalRef.current = root;
|
|
80
78
|
root.render(React.createElement(berifyMeModal, {
|
|
81
|
-
environment,
|
|
79
|
+
environment: BUILT_IN_BERIFYME_CONFIG.environment,
|
|
82
80
|
apiKeyId: BUILT_IN_BERIFYME_CONFIG.apiKeyId,
|
|
83
81
|
secretKey: BUILT_IN_BERIFYME_CONFIG.secretKey,
|
|
84
82
|
redirectUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatBotUI.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ChatBotUI.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ChatBotUI.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ChatBotUI.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0F/B,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAoU7B,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { MessageList } from './MessageList';
|
|
|
8
8
|
import { MessageInput } from './MessageInput';
|
|
9
9
|
import { PresetMessages } from './PresetMessages';
|
|
10
10
|
import { ModelSelector } from './ModelSelector';
|
|
11
|
+
import * as walletTextUtils from '../../core/utils/walletTextUtils';
|
|
11
12
|
import { sdkContainer, floatingButton, chatWindow, chatHeader, headerTitle, headerButton, closeButton, modalOverlay, idvBanner, idvBannerTitle, idvBannerText, idvVerifyButton, idvDismissButton, loadingSpinner, successToast, errorToast, warningToast, infoToast, toastCloseButton } from './styles/isolatedStyles';
|
|
12
13
|
// Toast Notification Component
|
|
13
14
|
const ToastNotification = ({ type, message, onClose, isChatOpen = false }) => {
|
|
@@ -48,7 +49,7 @@ const ToastNotification = ({ type, message, onClose, isChatOpen = false }) => {
|
|
|
48
49
|
return (_jsxs("div", { css: getToastStyles(), children: [_jsx("span", { css: css `font-size: 18px !important;`, children: getIcon() }), _jsx("span", { css: css `flex: 1 !important;`, children: message }), _jsx("button", { onClick: onClose, css: toastCloseButton, children: "\u00D7" })] }));
|
|
49
50
|
};
|
|
50
51
|
export const ChatBotUI = () => {
|
|
51
|
-
const { isOpen, setIsOpen, showPermissionForm, setShowPermissionForm, notification, setNotification, isAITLoading, hitAddress, walletInfo, onVerifyWallet, props } = useChatBot();
|
|
52
|
+
const { isOpen, setIsOpen, showPermissionForm, setShowPermissionForm, notification, setNotification, isAITLoading, hitAddress, walletInfo, onVerifyWallet, serviceId, props } = useChatBot();
|
|
52
53
|
// IDV suggestion banner state
|
|
53
54
|
const [showIDVSuggestion, setShowIDVSuggestion] = React.useState(true);
|
|
54
55
|
const [dismissUntil, setDismissUntil] = React.useState(null);
|
|
@@ -144,7 +145,7 @@ export const ChatBotUI = () => {
|
|
|
144
145
|
setNotification({
|
|
145
146
|
show: true,
|
|
146
147
|
type: 'info',
|
|
147
|
-
message: `IDV suggestion hidden for ${timeText}. You can still verify your wallet anytime.`,
|
|
148
|
+
message: walletTextUtils.getWalletText(`IDV suggestion hidden for ${timeText}. You can still verify your wallet anytime.`, serviceId),
|
|
148
149
|
autoHide: true,
|
|
149
150
|
duration: 5000
|
|
150
151
|
});
|
|
@@ -196,7 +197,7 @@ export const ChatBotUI = () => {
|
|
|
196
197
|
`, children: [_jsx("button", { onClick: handleSettingsClick, css: headerButton, title: "AIT Settings", children: "\u2699\uFE0F" }), _jsx("button", { onClick: handleClose, css: closeButton, children: "\u00D7" })] })] }), showIDVSuggestion && hitAddress && !props.requireWalletIDVVerification && !hasBerifymeToken && !isWalletVerifiedWithBerifyme && (_jsxs("div", { "data-idv-banner": true, css: idvBanner, children: [_jsx("div", { css: css `
|
|
197
198
|
font-size: 20px !important;
|
|
198
199
|
color: #f39c12 !important;
|
|
199
|
-
`, children: "\uD83D\uDCA1" }), _jsxs("div", { css: css `flex: 1 !important;`, children: [_jsx("h5", { css: idvBannerTitle, children:
|
|
200
|
+
`, children: "\uD83D\uDCA1" }), _jsxs("div", { css: css `flex: 1 !important;`, children: [_jsx("h5", { css: idvBannerTitle, children: walletTextUtils.getWalletText('Recommended: Verify Your Wallet', serviceId) }), _jsx("p", { css: idvBannerText, children: walletTextUtils.getWalletText('While not required, verifying your wallet with Berify.me provides additional security and trust for your AI agent interactions.', serviceId) }), _jsx("button", { onClick: () => onVerifyWallet('berifyme'), css: idvVerifyButton, children: walletTextUtils.getWalletText('Verify Wallet', serviceId) })] }), _jsx("button", { onClick: handleDismissIDV, css: idvDismissButton, title: `Hide for ${Math.floor((props.idvBannerDismissSeconds || 86400) / 3600)} hours`, children: "\u00D7" })] })), !showIDVSuggestion && dismissUntil && timeRemaining && (_jsxs("div", { css: css `
|
|
200
201
|
background-color: #f8f9fa !important;
|
|
201
202
|
border: 1px solid #e9ecef !important;
|
|
202
203
|
margin: 16px !important;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageInput.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EA2LhC,CAAC"}
|
|
@@ -8,11 +8,12 @@ import VolumeUpIcon from '@mui/icons-material/VolumeUp';
|
|
|
8
8
|
import VolumeOffIcon from '@mui/icons-material/VolumeOff';
|
|
9
9
|
import { IconButton, InputBase, Tooltip } from '@mui/material';
|
|
10
10
|
import { useChatBot } from '../context/ChatBotContext';
|
|
11
|
+
import * as walletTextUtils from '../../core/utils/walletTextUtils';
|
|
11
12
|
import { actionButton } from './styles/isolatedStyles';
|
|
12
13
|
export const MessageInput = () => {
|
|
13
|
-
const { inputValue, setInputValue, isLoading, isAITLoading, handleSubmit, isMicEnabled, isAwaitingMicGesture, startRecording, stopRecording, textInputRef, autoSendEnabled, setAutoSendEnabled, textToSpeechEnabled, setTextToSpeechEnabled, props: { placeholder = 'Type a message...' } } = useChatBot();
|
|
14
|
+
const { inputValue, setInputValue, isLoading, isAITLoading, handleSubmit, isMicEnabled, isAwaitingMicGesture, startRecording, stopRecording, textInputRef, autoSendEnabled, setAutoSendEnabled, textToSpeechEnabled, setTextToSpeechEnabled, serviceId, props: { placeholder = 'Type a message...' } } = useChatBot();
|
|
14
15
|
const isDisabled = isLoading || isAITLoading;
|
|
15
|
-
const inputPlaceholder = isAITLoading ? 'Loading wallet configuration...' : placeholder;
|
|
16
|
+
const inputPlaceholder = isAITLoading ? walletTextUtils.getWalletText('Loading wallet configuration...', serviceId) : placeholder;
|
|
16
17
|
const handleKeyPress = (e) => {
|
|
17
18
|
if (e.key === 'Enter' && !e.shiftKey) {
|
|
18
19
|
e.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../../src/components/ui/MessageList.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqB/B,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EA4K/B,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { convertUrlsToLinks } from '../../core/utils/urlUtils';
|
|
6
|
+
import * as walletTextUtils from '../../core/utils/walletTextUtils';
|
|
6
7
|
import { useChatBot } from '../context/ChatBotContext';
|
|
7
8
|
import { messageListContainer, messageBubble, userMessage, messageContent, userMessageContent, retryMessageContent, chatbotButton, connectedButton, loadingIndicator, modelIndicator, modelBadge, modelDot } from './styles/isolatedStyles';
|
|
8
9
|
export const MessageList = () => {
|
|
@@ -74,7 +75,7 @@ export const MessageList = () => {
|
|
|
74
75
|
(message.button === 'continue') ? connectedButton :
|
|
75
76
|
(message.button === 'enableAIT' && (message.metadata?.requiredPermission && permissions.includes(message.metadata.requiredPermission))) ? connectedButton :
|
|
76
77
|
chatbotButton, children: isAutoConnecting ? 'Connecting...' :
|
|
77
|
-
message.button === 'connectWallet' ? (Boolean(hitAddress) ? 'Connected' : 'Connect Wallet') :
|
|
78
|
+
message.button === 'connectWallet' ? (Boolean(hitAddress) ? 'Connected' : walletTextUtils.getWalletText('Connect Wallet', serviceId)) :
|
|
78
79
|
message.button === 'signIn' ? (!isNeedSignInWithWallet ? 'Signed In' : 'Sign In') :
|
|
79
80
|
message.button === 'continue' ? 'Continue' :
|
|
80
81
|
message.button === 'enableAIT' ?
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ModelSelector.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ModelSelector.d.ts","sourceRoot":"","sources":["../../../src/components/ui/ModelSelector.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EA4LjC,CAAC"}
|
|
@@ -3,15 +3,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { useChatBot } from '../context/ChatBotContext';
|
|
6
|
+
import * as walletTextUtils from '../../core/utils/walletTextUtils';
|
|
6
7
|
import { adilasDogHeadTiltDataUri } from '../../assets/images/adilasDogHeadTiltDataUri';
|
|
7
8
|
export const ModelSelector = () => {
|
|
8
9
|
const { availableModels, selectedModelIndex, handleModelChange, serviceId } = useChatBot();
|
|
9
10
|
// Safety check: ensure selectedModelIndex is within bounds
|
|
10
11
|
const safeSelectedModelIndex = selectedModelIndex >= availableModels.length ? 0 : selectedModelIndex;
|
|
11
|
-
// Adilas service ID
|
|
12
|
-
const adilasServiceId = 'e48fc2b9-a7d1-49e3-85cb-9d621a0bf774';
|
|
13
12
|
// Check if current service is Adilas
|
|
14
|
-
const isAdilasService =
|
|
13
|
+
const isAdilasService = walletTextUtils.isAdilasService(serviceId);
|
|
15
14
|
// Get fallback model label (first available model or 'Unknown')
|
|
16
15
|
// Special case: show "Adi" for specific serviceId
|
|
17
16
|
const getDisplayLabel = (label) => {
|
|
@@ -53,7 +52,7 @@ export const ModelSelector = () => {
|
|
|
53
52
|
background-color: rgba(255, 255, 255, 0.1) !important;
|
|
54
53
|
font-size: 12px !important;
|
|
55
54
|
font-weight: 500 !important;
|
|
56
|
-
`, children: _jsx("span", { children: getDisplayLabel(availableModels[0].label) }) }), isAdilasService && (_jsx("div", { css: css `
|
|
55
|
+
`, children: _jsx("span", { children: getDisplayLabel(availableModels[0].label) }) }), false && isAdilasService && (_jsx("div", { css: css `
|
|
57
56
|
background-color: white !important;
|
|
58
57
|
border-radius: 4px !important;
|
|
59
58
|
padding: 2px !important;
|
|
@@ -87,7 +86,7 @@ export const ModelSelector = () => {
|
|
|
87
86
|
&:hover {
|
|
88
87
|
background-color: rgba(255, 255, 255, 0.2) !important;
|
|
89
88
|
}
|
|
90
|
-
`, onClick: handleClick, title: "Change AI Model", children: [_jsx("span", { children: getDisplayLabel(availableModels[safeSelectedModelIndex]?.label || fallbackModelLabel) }), _jsx("span", { css: css `font-size: 10px !important;`, children: "\u25BC" })] }), isAdilasService && (_jsx("img", { src: adilasDogHeadTiltDataUri, alt: "Adilas Dog", css: css `
|
|
89
|
+
`, onClick: handleClick, title: "Change AI Model", children: [_jsx("span", { children: getDisplayLabel(availableModels[safeSelectedModelIndex]?.label || fallbackModelLabel) }), _jsx("span", { css: css `font-size: 10px !important;`, children: "\u25BC" })] }), false && isAdilasService && (_jsx("img", { src: adilasDogHeadTiltDataUri, alt: "Adilas Dog", css: css `
|
|
91
90
|
width: 20px !important;
|
|
92
91
|
height: 20px !important;
|
|
93
92
|
display: block !important;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PermissionForm.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PermissionForm.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA4jBxD,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@emotion/reac
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { css } from '@emotion/react';
|
|
5
5
|
import { useChatBot } from '../context/ChatBotContext';
|
|
6
|
+
import * as walletTextUtils from '../../core/utils/walletTextUtils';
|
|
6
7
|
import { actionButton } from './styles/isolatedStyles';
|
|
7
8
|
export const PermissionForm = ({ onClose }) => {
|
|
8
9
|
const { hitAddress, permissions, setPermissions, setIsDisabled, onSave, onConnectWallet, onSignIn, isNeedSignInWithWallet, walletInfo, onVerifyWallet, serviceId, nxtlinqApi, permissionGroup, isAITLoading, isWalletLoading = false, refreshAIT, props } = useChatBot();
|
|
@@ -143,7 +144,7 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
143
144
|
margin-bottom: 24px !important;
|
|
144
145
|
font-size: 16px !important;
|
|
145
146
|
color: #666 !important;
|
|
146
|
-
`, children:
|
|
147
|
+
`, children: walletTextUtils.getWalletText('Checking wallet status...', serviceId) })] }), _jsx("style", { children: `
|
|
147
148
|
@keyframes spin {
|
|
148
149
|
0% { transform: rotate(0deg); }
|
|
149
150
|
100% { transform: rotate(360deg); }
|
|
@@ -223,7 +224,7 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
223
224
|
margin-bottom: 24px !important;
|
|
224
225
|
font-size: 16px !important;
|
|
225
226
|
color: #666 !important;
|
|
226
|
-
`, children:
|
|
227
|
+
`, children: walletTextUtils.getWalletText('Please connect your wallet first', serviceId) }), _jsx("button", { onClick: onConnectWallet, disabled: Boolean(hitAddress), css: css `
|
|
227
228
|
${actionButton}
|
|
228
229
|
padding: 12px 24px !important;
|
|
229
230
|
background-color: ${Boolean(hitAddress) ? '#28a745' : '#007bff'} !important;
|
|
@@ -238,14 +239,14 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
238
239
|
&:hover:not(:disabled) {
|
|
239
240
|
background-color: #0056b3 !important;
|
|
240
241
|
}
|
|
241
|
-
`, children: Boolean(hitAddress) ? 'Connected' : 'Connect Wallet' })] })) : isNeedSignInWithWallet ? (_jsxs("div", { css: css `
|
|
242
|
+
`, children: Boolean(hitAddress) ? 'Connected' : walletTextUtils.getWalletText('Connect Wallet', serviceId) })] })) : isNeedSignInWithWallet ? (_jsxs("div", { css: css `
|
|
242
243
|
text-align: center !important;
|
|
243
244
|
padding: 32px 0 !important;
|
|
244
245
|
`, children: [_jsxs("div", { css: css `margin-bottom: 24px !important;`, children: [_jsx("h4", { css: css `
|
|
245
246
|
margin-bottom: 12px !important;
|
|
246
247
|
font-size: 16px !important;
|
|
247
248
|
color: #666 !important;
|
|
248
|
-
`, children:
|
|
249
|
+
`, children: walletTextUtils.getWalletText('Connected Wallet', serviceId) }), _jsx("p", { css: css `
|
|
249
250
|
word-break: break-all !important;
|
|
250
251
|
background-color: #f8f9fa !important;
|
|
251
252
|
padding: 12px !important;
|
|
@@ -279,7 +280,7 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
279
280
|
margin-bottom: 12px !important;
|
|
280
281
|
font-size: 16px !important;
|
|
281
282
|
color: #666 !important;
|
|
282
|
-
`, children:
|
|
283
|
+
`, children: walletTextUtils.getWalletText('Connected Wallet', serviceId) }), _jsx("p", { css: css `
|
|
283
284
|
word-break: break-all !important;
|
|
284
285
|
background-color: #f8f9fa !important;
|
|
285
286
|
padding: 12px !important;
|
|
@@ -292,8 +293,8 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
292
293
|
font-size: 16px !important;
|
|
293
294
|
color: #666 !important;
|
|
294
295
|
`, children: isWalletVerified && !isWalletVerifiedWithBerifyme
|
|
295
|
-
? 'Your wallet is verified with custom method, but Berify.me verification is required to continue.'
|
|
296
|
-
: 'Please verify your wallet with Berify.me to continue' }), _jsx("button", { onClick: () => onVerifyWallet('berifyme'), css: css `
|
|
296
|
+
? walletTextUtils.getWalletText('Your wallet is verified with custom method, but Berify.me verification is required to continue.', serviceId)
|
|
297
|
+
: walletTextUtils.getWalletText('Please verify your wallet with Berify.me to continue', serviceId) }), _jsx("button", { onClick: () => onVerifyWallet('berifyme'), css: css `
|
|
297
298
|
${actionButton}
|
|
298
299
|
padding: 12px 24px !important;
|
|
299
300
|
background-color: #007bff !important;
|
|
@@ -303,11 +304,11 @@ export const PermissionForm = ({ onClose }) => {
|
|
|
303
304
|
&:hover {
|
|
304
305
|
background-color: #0056b3 !important;
|
|
305
306
|
}
|
|
306
|
-
`, children:
|
|
307
|
+
`, children: walletTextUtils.getWalletText('Verify your wallet', serviceId) })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { css: css `margin-bottom: 24px !important;`, children: [_jsx("h4", { css: css `
|
|
307
308
|
margin-bottom: 12px !important;
|
|
308
309
|
font-size: 16px !important;
|
|
309
310
|
color: #666 !important;
|
|
310
|
-
`, children:
|
|
311
|
+
`, children: walletTextUtils.getWalletText('Connected Wallet', serviceId) }), _jsx("p", { css: css `
|
|
311
312
|
word-break: break-all !important;
|
|
312
313
|
background-color: #f8f9fa !important;
|
|
313
314
|
padding: 12px !important;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adilas Service ID constant
|
|
3
|
+
*/
|
|
4
|
+
export declare const ADILAS_SERVICE_ID = "e48fc2b9-a7d1-49e3-85cb-9d621a0bf774";
|
|
5
|
+
/**
|
|
6
|
+
* Check if the given serviceId is the Adilas service
|
|
7
|
+
*/
|
|
8
|
+
export declare const isAdilasService: (serviceId: string | undefined | null) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Replace "wallet" with "account" in text when serviceId is Adilas service
|
|
11
|
+
* Preserves the original case of the word
|
|
12
|
+
*/
|
|
13
|
+
export declare const getWalletText: (defaultText: string, serviceId: string | undefined | null) => string;
|
|
14
|
+
//# sourceMappingURL=walletTextUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletTextUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/walletTextUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,iBAAiB,yCAAyC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,OAEtE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,aAAa,MAAM,EAAE,WAAW,MAAM,GAAG,SAAS,GAAG,IAAI,KAAG,MAQzF,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adilas Service ID constant
|
|
3
|
+
*/
|
|
4
|
+
export const ADILAS_SERVICE_ID = 'e48fc2b9-a7d1-49e3-85cb-9d621a0bf774';
|
|
5
|
+
/**
|
|
6
|
+
* Check if the given serviceId is the Adilas service
|
|
7
|
+
*/
|
|
8
|
+
export const isAdilasService = (serviceId) => {
|
|
9
|
+
return serviceId ? serviceId.trim() === ADILAS_SERVICE_ID : false;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Replace "wallet" with "account" in text when serviceId is Adilas service
|
|
13
|
+
* Preserves the original case of the word
|
|
14
|
+
*/
|
|
15
|
+
export const getWalletText = (defaultText, serviceId) => {
|
|
16
|
+
if (!isAdilasService(serviceId))
|
|
17
|
+
return defaultText;
|
|
18
|
+
// Replace wallet with account, preserving case
|
|
19
|
+
return defaultText.replace(/\bwallet\b/gi, (match) => {
|
|
20
|
+
// Preserve original case: 'Wallet' -> 'Account', 'wallet' -> 'account'
|
|
21
|
+
return match.charAt(0) === 'W' ? 'Account' : 'account';
|
|
22
|
+
});
|
|
23
|
+
};
|
package/package.json
CHANGED