vdb-ai-chat 1.0.6 → 1.0.8
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/chat-widget.js +1 -1
- package/lib/commonjs/api.js +51 -12
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/BetaNotice.js +13 -12
- package/lib/commonjs/components/BetaNotice.js.map +1 -1
- package/lib/commonjs/components/ChatInput.js +59 -49
- package/lib/commonjs/components/ChatInput.js.map +1 -1
- package/lib/commonjs/components/ChatWidget.js +74 -61
- package/lib/commonjs/components/ChatWidget.js.map +1 -1
- package/lib/commonjs/components/MessageBubble.js +67 -52
- package/lib/commonjs/components/MessageBubble.js.map +1 -1
- package/lib/commonjs/components/MessageMetaRow.js +50 -31
- package/lib/commonjs/components/MessageMetaRow.js.map +1 -1
- package/lib/commonjs/components/ProductsListView.js +232 -153
- package/lib/commonjs/components/ProductsListView.js.map +1 -1
- package/lib/commonjs/components/SuggestionsRow.js +27 -24
- package/lib/commonjs/components/SuggestionsRow.js.map +1 -1
- package/lib/commonjs/components/utils.js +15 -4
- package/lib/commonjs/components/utils.js.map +1 -1
- package/lib/commonjs/contexts/ThemeProvider.js +80 -0
- package/lib/commonjs/contexts/ThemeProvider.js.map +1 -0
- package/lib/commonjs/contexts/utils.js +142 -0
- package/lib/commonjs/contexts/utils.js.map +1 -0
- package/lib/module/api.js +51 -12
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/BetaNotice.js +14 -13
- package/lib/module/components/BetaNotice.js.map +1 -1
- package/lib/module/components/ChatInput.js +61 -50
- package/lib/module/components/ChatInput.js.map +1 -1
- package/lib/module/components/ChatWidget.js +78 -63
- package/lib/module/components/ChatWidget.js.map +1 -1
- package/lib/module/components/MessageBubble.js +69 -52
- package/lib/module/components/MessageBubble.js.map +1 -1
- package/lib/module/components/MessageMetaRow.js +52 -32
- package/lib/module/components/MessageMetaRow.js.map +1 -1
- package/lib/module/components/ProductsListView.js +234 -154
- package/lib/module/components/ProductsListView.js.map +1 -1
- package/lib/module/components/SuggestionsRow.js +29 -25
- package/lib/module/components/SuggestionsRow.js.map +1 -1
- package/lib/module/components/utils.js +17 -3
- package/lib/module/components/utils.js.map +1 -1
- package/lib/module/contexts/ThemeProvider.js +75 -0
- package/lib/module/contexts/ThemeProvider.js.map +1 -0
- package/lib/module/contexts/utils.js +136 -0
- package/lib/module/contexts/utils.js.map +1 -0
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/components/BetaNotice.d.ts.map +1 -1
- package/lib/typescript/components/ChatInput.d.ts.map +1 -1
- package/lib/typescript/components/ChatWidget.d.ts.map +1 -1
- package/lib/typescript/components/MessageBubble.d.ts +1 -1
- package/lib/typescript/components/MessageBubble.d.ts.map +1 -1
- package/lib/typescript/components/MessageMetaRow.d.ts.map +1 -1
- package/lib/typescript/components/ProductsListView.d.ts.map +1 -1
- package/lib/typescript/components/SuggestionsRow.d.ts.map +1 -1
- package/lib/typescript/components/utils.d.ts.map +1 -1
- package/lib/typescript/contexts/ThemeProvider.d.ts +7 -0
- package/lib/typescript/contexts/ThemeProvider.d.ts.map +1 -0
- package/lib/typescript/contexts/utils.d.ts +136 -0
- package/lib/typescript/contexts/utils.d.ts.map +1 -0
- package/package.json +6 -2
- package/src/api.ts +58 -21
- package/src/components/BetaNotice.tsx +15 -13
- package/src/components/ChatInput.tsx +63 -62
- package/src/components/ChatWidget.tsx +238 -206
- package/src/components/MessageBubble.tsx +113 -74
- package/src/components/MessageMetaRow.tsx +80 -50
- package/src/components/ProductsListView.tsx +243 -184
- package/src/components/SuggestionsRow.tsx +40 -25
- package/src/components/utils.ts +24 -8
- package/src/contexts/ThemeProvider.tsx +87 -0
- package/src/contexts/utils.ts +135 -0
package/lib/module/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Storage","
|
|
1
|
+
{"version":3,"names":["Storage","getUserToken","userInfo","getJSON","userData","JSON","parse","user","token","buildHeaders","iid","getItem","installationId","parsed","installationIdentifier","session","Accept","Authorization","Cookie","getValidConversations","currentToken","stored","removeItem","conversations","saveConversations","data","setJSON","normaliseMessages","raw","messages","Array","isArray","map","m","index","id","String","role","created_at","Date","now","text","content","createdAt","search_payload","reaction","suggestions","undefined","fetchInitialMessages","apiUrl","_params","priceMode","storedId","conversation_id","body","Number","isNaN","res","fetch","method","headers","Object","keys","length","stringify","ok","Error","status","json","updatedConversations","sendUserMessage","userMessage","_history","query","clearChatHistory","url","URL","searchParams","set","toString","getProducts","params","activeProduct","searchResultViewTypeMap","searchResultViewType","rawState","sectionName","rootState","selectedGroups","mGroupIds","vdbSetting","includes","filter","groupId","queryParamList","assign","group_ids","vdb","page_size","price_mode","vdb_setting","results_view_type","featured","pair","with_available_items","page_number","handleFeedbackActionApi","action","message_id","feedbackUrl","payload","response"],"sourceRoot":"../../src","sources":["api.ts"],"mappings":"AACA,SAASA,OAAO,QAAQ,WAAW;;AAGnC;;AAGA,eAAeC,YAAYA,CAAA,EAAoB;EAC7C,MAAMC,QAAQ,GAAG,MAAMF,OAAO,CAACG,OAAO,CAAc,kBAAkB,EAAE,CAAC,CAAC,CAAC;EAC3E,MAAMC,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACJ,QAAQ,EAAEK,IAAI,IAAI,IAAI,CAAC;EACnD,OAAOH,QAAQ,EAAEI,KAAK,IAAI,EAAE;AAC9B;AAEA,eAAeC,YAAYA,CAAA,EAAG;EAC5B,MAAMD,KAAK,GAAG,MAAMP,YAAY,CAAC,CAAC;EAClC,MAAMS,GAAG,GAAG,CAAC,MAAMV,OAAO,CAACW,OAAO,CAAC,kBAAkB,CAAC,KAAK,IAAI;EAC/D,IAAIC,cAAc,GAAG,EAAE;EACvB,IAAI;IACF,MAAMC,MAAM,GAAGR,IAAI,CAACC,KAAK,CAACI,GAAG,CAAC;IAC9BE,cAAc,GAAGC,MAAM,EAAEC,sBAAsB,GAC3CT,IAAI,CAACC,KAAK,CAACO,MAAM,CA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B,IAAI,MAAM;QACjDkB,QAAQ,EAAE,OAAO;QACjBC,IAAI,EAAEjB,WAAW,KAAK,eAAe,GAAG,OAAO,GAAG,MAAM;QACxDkB,oBAAoB,EAAE,KAAK;QAC3BC,WAAW,EAAE;MACf;IACF,CAAC;EACH,CACF,CAAC;EAED,IAAI,CAAChD,GAAG,CAACQ,EAAE,EAAE;IACX,MAAM,IAAIC,KAAK,CAAC,oBAAoBT,GAAG,CAACU,MAAM,EAAE,CAAC;EACnD;EAEA,MAAM1C,IAAI,GAAG,MAAMgC,GAAG,CAACW,IAAI,CAAC,CAAC;EAC7B,OAAO3C,IAAI;AACb;AAEA,OAAO,MAAMiF,uBAAuB,GAAG,MAAAA,CACrCC,MAAsB,EACtBtD,eAAuB,EACvBuD,UAAkB,KACf;EACH,MAAMC,WAAW,GAAG,kEAAkExD,eAAe,0BAA0BuD,UAAU,WAAW;EACpJ,MAAME,OAAO,GAAG;IACdjE,QAAQ,EAAE8D;EACZ,CAAC;EAED,MAAMI,QAAQ,GAAG,MAAMrD,KAAK,CAACmD,WAAW,EAAE;IACxClD,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE,MAAMnD,YAAY,CAAC,CAAC;IAC7B6C,IAAI,EAAEjD,IAAI,CAAC2D,SAAS,CAAC8C,OAAO;EAC9B,CAAC,CAAC;EACF,OAAOC,QAAQ;AACjB,CAAC","ignoreList":[]}
|
|
@@ -1,15 +1,25 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View,
|
|
2
|
+
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import styled from "styled-components/native";
|
|
3
4
|
export const BetaNotice = ({
|
|
4
5
|
active
|
|
5
6
|
}) => {
|
|
6
7
|
if (!active) return null;
|
|
7
8
|
return /*#__PURE__*/React.createElement(View, {
|
|
8
9
|
style: styles.container
|
|
9
|
-
}, /*#__PURE__*/React.createElement(
|
|
10
|
-
style: styles.text
|
|
11
|
-
}, "This AI feature is in beta and may make mistakes."));
|
|
10
|
+
}, /*#__PURE__*/React.createElement(TextView, null, "This AI feature is in beta and may make mistakes."));
|
|
12
11
|
};
|
|
12
|
+
const TextView = styled.Text`
|
|
13
|
+
color: ${({
|
|
14
|
+
theme
|
|
15
|
+
}) => theme["core-06"] || "#4F4E57"};
|
|
16
|
+
font-family: "Roboto";
|
|
17
|
+
font-size: 13px;
|
|
18
|
+
font-style: normal;
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
line-height: 18px;
|
|
21
|
+
text-align: center;
|
|
22
|
+
`;
|
|
13
23
|
const styles = StyleSheet.create({
|
|
14
24
|
container: {
|
|
15
25
|
alignSelf: "stretch",
|
|
@@ -18,15 +28,6 @@ const styles = StyleSheet.create({
|
|
|
18
28
|
backgroundColor: "transparent",
|
|
19
29
|
alignItems: "center",
|
|
20
30
|
justifyContent: "center"
|
|
21
|
-
},
|
|
22
|
-
text: {
|
|
23
|
-
color: "#4F4E57",
|
|
24
|
-
fontFamily: "Roboto",
|
|
25
|
-
fontSize: 13,
|
|
26
|
-
fontStyle: "normal",
|
|
27
|
-
fontWeight: "400",
|
|
28
|
-
lineHeight: 18,
|
|
29
|
-
textAlign: "center"
|
|
30
31
|
}
|
|
31
32
|
});
|
|
32
33
|
export default BetaNotice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","View","
|
|
1
|
+
{"version":3,"names":["React","View","StyleSheet","styled","BetaNotice","active","createElement","style","styles","container","TextView","Text","theme","create","alignSelf","paddingVertical","paddingHorizontal","backgroundColor","alignItems","justifyContent"],"sourceRoot":"../../../src","sources":["components/BetaNotice.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAC/C,OAAOC,MAAM,MAAM,0BAA0B;AAG7C,OAAO,MAAMC,UAAU,GAAGA,CAAC;EAAEC;AAA6B,CAAC,KAAK;EAC9D,IAAI,CAACA,MAAM,EAAE,OAAO,IAAI;EACxB,oBACEL,KAAA,CAAAM,aAAA,CAACL,IAAI;IAACM,KAAK,EAAEC,MAAM,CAACC;EAAU,gBAC5BT,KAAA,CAAAM,aAAA,CAACI,QAAQ,QAAC,mDAA2D,CACjE,CAAC;AAEX,CAAC;AAED,MAAMA,QAAQ,GAAGP,MAAM,CAACQ,IAA6B;AACrD,WAAW,CAAC;EAAEC;AAA+B,CAAC,KAC1CA,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,MAAMJ,MAAM,GAAGN,UAAU,CAACW,MAAM,CAAC;EAC/BJ,SAAS,EAAE;IACTK,SAAS,EAAE,SAAS;IACpBC,eAAe,EAAE,CAAC;IAClBC,iBAAiB,EAAE,EAAE;IACrBC,eAAe,EAAE,aAAa;IAC9BC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC;AAEF,eAAef,UAAU","ignoreList":[]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, Platform, Image } from "react-native";
|
|
3
|
+
import { useTheme } from "styled-components/native";
|
|
4
|
+
import styled from "styled-components/native";
|
|
5
|
+
|
|
3
6
|
// Use expo-image on native if available, fallback to RN Image
|
|
4
7
|
let ImageComponent = Image;
|
|
5
8
|
if (Platform.OS !== "web") {
|
|
@@ -7,7 +10,7 @@ if (Platform.OS !== "web") {
|
|
|
7
10
|
const ExpoImage = require("expo-image").Image;
|
|
8
11
|
if (ExpoImage) ImageComponent = ExpoImage;
|
|
9
12
|
} catch {
|
|
10
|
-
|
|
13
|
+
ImageComponent = Image;
|
|
11
14
|
}
|
|
12
15
|
}
|
|
13
16
|
const SendIcon = ({
|
|
@@ -15,6 +18,7 @@ const SendIcon = ({
|
|
|
15
18
|
isEmpty
|
|
16
19
|
}) => {
|
|
17
20
|
const isInactive = disabled || isEmpty;
|
|
21
|
+
const theme = useTheme();
|
|
18
22
|
return /*#__PURE__*/React.createElement(ImageComponent, {
|
|
19
23
|
source: {
|
|
20
24
|
uri: "https://cdn.vdbapp.com/ai/chat-widget/assets/img/send.svg"
|
|
@@ -22,7 +26,7 @@ const SendIcon = ({
|
|
|
22
26
|
resizeMode: "contain",
|
|
23
27
|
style: {
|
|
24
28
|
...styles.buttonIcon,
|
|
25
|
-
tintColor: isInactive ? "#ACACB3" : "#020001",
|
|
29
|
+
tintColor: isInactive ? theme["core-04"] || "#ACACB3" : theme["core-05"] || "#020001",
|
|
26
30
|
cursor: isInactive ? "auto" : "pointer"
|
|
27
31
|
}
|
|
28
32
|
});
|
|
@@ -33,27 +37,26 @@ export const ChatInput = ({
|
|
|
33
37
|
onSend,
|
|
34
38
|
disabled,
|
|
35
39
|
placeholder,
|
|
36
|
-
theme,
|
|
37
40
|
inputRef
|
|
38
41
|
}) => {
|
|
39
|
-
const
|
|
40
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const theme = useTheme();
|
|
43
|
+
return /*#__PURE__*/React.createElement(InputContainer, {
|
|
44
|
+
theme: theme,
|
|
45
|
+
style: [Platform.OS === "web" ? styles.webShadow : styles.nativeShadow]
|
|
46
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
43
47
|
ref: inputRef
|
|
44
48
|
// @ts-ignore - supported on web via react-native-web
|
|
45
49
|
,
|
|
46
50
|
id: "chat-input",
|
|
47
|
-
style: [styles.
|
|
51
|
+
style: [styles.inputWeb],
|
|
48
52
|
placeholder: placeholder || "What are you looking for?",
|
|
49
|
-
placeholderTextColor: "#999",
|
|
53
|
+
placeholderTextColor: theme["core-06"] || "#999",
|
|
50
54
|
value: value,
|
|
51
55
|
onChangeText: onChangeText,
|
|
52
56
|
onSubmitEditing: onSend,
|
|
53
57
|
editable: !disabled,
|
|
54
58
|
autoFocus: true
|
|
55
|
-
}), /*#__PURE__*/React.createElement(
|
|
56
|
-
style: styles.button,
|
|
59
|
+
}), /*#__PURE__*/React.createElement(SendButton, {
|
|
57
60
|
onPress: onSend,
|
|
58
61
|
disabled: disabled
|
|
59
62
|
}, /*#__PURE__*/React.createElement(SendIcon, {
|
|
@@ -61,20 +64,53 @@ export const ChatInput = ({
|
|
|
61
64
|
isEmpty: value.trim() === ""
|
|
62
65
|
})));
|
|
63
66
|
};
|
|
67
|
+
const InputContainer = styled.View`
|
|
68
|
+
flex-direction: row;
|
|
69
|
+
padding-horizontal: 12px;
|
|
70
|
+
padding-vertical: 16px;
|
|
71
|
+
justify-content: space-between;
|
|
72
|
+
align-items: center;
|
|
73
|
+
align-self: stretch;
|
|
74
|
+
border-radius: 8px;
|
|
75
|
+
background-color: ${({
|
|
76
|
+
theme
|
|
77
|
+
}) => theme["core-01"] || "#FFFFFF"};
|
|
78
|
+
border-color: ${({
|
|
79
|
+
theme
|
|
80
|
+
}) => theme["core-04"] || "#ACACB3"};
|
|
81
|
+
border-width: 1;
|
|
82
|
+
height: 56px;
|
|
83
|
+
`;
|
|
84
|
+
const Input = styled.TextInput`
|
|
85
|
+
flex: 1;
|
|
86
|
+
color: ${({
|
|
87
|
+
theme
|
|
88
|
+
}) => theme["core-06"] || "#4F4E57"};
|
|
89
|
+
font-family: "Roboto";
|
|
90
|
+
font-size: 14px;
|
|
91
|
+
font-style: normal;
|
|
92
|
+
font-weight: 400;
|
|
93
|
+
line-height: 20px;
|
|
94
|
+
min-height: 20px;
|
|
95
|
+
max-height: 120px;
|
|
96
|
+
padding-horizontal: 0;
|
|
97
|
+
padding-vertical: 0;
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
border-width: 0;
|
|
100
|
+
`;
|
|
101
|
+
const SendButton = styled.TouchableOpacity`
|
|
102
|
+
margin-left: 0;
|
|
103
|
+
padding: 0;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
align-items: center;
|
|
106
|
+
height: 24;
|
|
107
|
+
aspect-ratio: 1;
|
|
108
|
+
border-radius: 0px;
|
|
109
|
+
background-color: ${({
|
|
110
|
+
theme
|
|
111
|
+
}) => theme["core-01"] || "#FFFFFF"};
|
|
112
|
+
`;
|
|
64
113
|
const styles = StyleSheet.create({
|
|
65
|
-
inputContainer: {
|
|
66
|
-
flexDirection: "row",
|
|
67
|
-
paddingHorizontal: 12,
|
|
68
|
-
paddingVertical: 16,
|
|
69
|
-
justifyContent: "space-between",
|
|
70
|
-
alignItems: "center",
|
|
71
|
-
alignSelf: "stretch",
|
|
72
|
-
borderRadius: 8,
|
|
73
|
-
backgroundColor: "#FFF",
|
|
74
|
-
borderColor: "#ACACB3",
|
|
75
|
-
borderWidth: 1,
|
|
76
|
-
height: 56
|
|
77
|
-
},
|
|
78
114
|
webShadow: {
|
|
79
115
|
...(Platform.OS === "web" ? {
|
|
80
116
|
boxShadow: "2px 8px 24px -6px rgba(55, 54, 64, 0.26)"
|
|
@@ -90,21 +126,6 @@ const styles = StyleSheet.create({
|
|
|
90
126
|
shadowRadius: 12,
|
|
91
127
|
elevation: 3
|
|
92
128
|
},
|
|
93
|
-
input: {
|
|
94
|
-
flex: 1,
|
|
95
|
-
color: "#4F4E57",
|
|
96
|
-
fontFamily: "Roboto",
|
|
97
|
-
fontSize: 14,
|
|
98
|
-
fontStyle: "normal",
|
|
99
|
-
fontWeight: "400",
|
|
100
|
-
lineHeight: 20,
|
|
101
|
-
minHeight: 20,
|
|
102
|
-
maxHeight: 120,
|
|
103
|
-
paddingHorizontal: 0,
|
|
104
|
-
paddingVertical: 0,
|
|
105
|
-
backgroundColor: "transparent",
|
|
106
|
-
borderWidth: 0
|
|
107
|
-
},
|
|
108
129
|
inputWeb: {
|
|
109
130
|
...(Platform.OS === "web" ? {
|
|
110
131
|
outlineStyle: "none",
|
|
@@ -112,16 +133,6 @@ const styles = StyleSheet.create({
|
|
|
112
133
|
boxShadow: "none"
|
|
113
134
|
} : {})
|
|
114
135
|
},
|
|
115
|
-
button: {
|
|
116
|
-
marginLeft: 0,
|
|
117
|
-
padding: 0,
|
|
118
|
-
justifyContent: "center",
|
|
119
|
-
alignItems: "center",
|
|
120
|
-
height: 24,
|
|
121
|
-
aspectRatio: 1,
|
|
122
|
-
borderRadius: 0,
|
|
123
|
-
backgroundColor: "#FFFFFF"
|
|
124
|
-
},
|
|
125
136
|
buttonIcon: {
|
|
126
137
|
height: 24,
|
|
127
138
|
width: 24
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","StyleSheet","Platform","Image","useTheme","styled","ImageComponent","OS","ExpoImage","require","SendIcon","disabled","isEmpty","isInactive","theme","createElement","source","uri","resizeMode","style","styles","buttonIcon","tintColor","cursor","ChatInput","value","onChangeText","onSend","placeholder","inputRef","InputContainer","webShadow","nativeShadow","Input","ref","id","inputWeb","placeholderTextColor","onSubmitEditing","editable","autoFocus","SendButton","onPress","trim","View","TextInput","TouchableOpacity","create","boxShadow","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","outlineStyle","outlineWidth","sendIconText","fontSize","fontWeight","textAlign"],"sourceRoot":"../../../src","sources":["components/ChatInput.tsx"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAEEC,UAAU,EACVC,QAAQ,EACRC,KAAK,QACA,cAAc;AAErB,SAASC,QAAQ,QAAQ,0BAA0B;AAEnD,OAAOC,MAAM,MAAM,0BAA0B;;AAE7C;AACA,IAAIC,cAA4B,GAAGH,KAAK;AACxC,IAAID,QAAQ,CAACK,EAAE,KAAK,KAAK,EAAE;EACzB,IAAI;IACF,MAAMC,SAAS,GAAGC,OAAO,CAAC,YAAY,CAAC,CAACN,KAAK;IAC7C,IAAIK,SAAS,EAAEF,cAAc,GAAGE,SAAS;EAC3C,CAAC,CAAC,MAAM;IACNF,cAAc,GAAGH,KAAK;EACxB;AACF;AAYA,MAAMO,QAAQ,GAAGA,CAAC;EAChBC,QAAQ;EACRC;AAIF,CAAC,KAAK;EACJ,MAAMC,UAAU,GAAGF,QAAQ,IAAIC,OAAO;EACtC,MAAME,K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AE;IACR,IAAIlC,QAAQ,CAACK,EAAE,KAAK,KAAK,GACpB;MAAEiD,YAAY,EAAE,MAAM;MAAEC,YAAY,EAAE,CAAC;MAAET,SAAS,EAAE;IAAO,CAAC,GAC7D,CAAC,CAAC;EACR,CAAC;EACD3B,UAAU,EAAE;IACV+B,MAAM,EAAE,EAAE;IACVD,KAAK,EAAE;EACT,CAAC;EACDO,YAAY,EAAE;IACZC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
2
|
-
import { View, StyleSheet, ScrollView,
|
|
2
|
+
import { View, StyleSheet, ScrollView, KeyboardAvoidingView, DeviceEventEmitter, Platform } from "react-native";
|
|
3
3
|
import { ChatInput } from "./ChatInput";
|
|
4
4
|
import { MessageBubble } from "./MessageBubble";
|
|
5
5
|
import MessageMetaRow from "./MessageMetaRow";
|
|
@@ -8,9 +8,13 @@ import { fetchInitialMessages, getProducts, handleFeedbackActionApi, normaliseMe
|
|
|
8
8
|
import BetaNotice from "./BetaNotice";
|
|
9
9
|
import ProductsList from "./ProductsList";
|
|
10
10
|
import LazyProductsFetcher from "./LazyProductsFetcher";
|
|
11
|
-
import { FeedbackAction, formatToTime, getUserDetails
|
|
11
|
+
import { FeedbackAction, formatToTime, getUserDetails } from "./utils";
|
|
12
12
|
import { useUserAnalytics } from "../hooks/useAnalytics";
|
|
13
13
|
import { Storage } from "../storage";
|
|
14
|
+
import ThemeProvider from "../contexts/ThemeProvider";
|
|
15
|
+
import { useTheme } from "styled-components/native";
|
|
16
|
+
import styled from "styled-components/native";
|
|
17
|
+
import { css } from "styled-components/native";
|
|
14
18
|
export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
15
19
|
apiUrl,
|
|
16
20
|
userToken: userTokenProp,
|
|
@@ -39,14 +43,13 @@ export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
|
39
43
|
const [userToken, setUserToken] = useState(userTokenProp || "");
|
|
40
44
|
const scrollRef = useRef(null);
|
|
41
45
|
const inputRef = useRef(null);
|
|
42
|
-
const
|
|
46
|
+
const themeProps = useMemo(() => mergeTheme(themeOverrides), [themeOverrides]);
|
|
43
47
|
const {
|
|
44
48
|
_identify
|
|
45
49
|
} = useUserAnalytics();
|
|
46
50
|
const betaActive = Boolean(isBetaModeProp);
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
} = useDeviceType();
|
|
51
|
+
const theme = useTheme();
|
|
52
|
+
const isTablet = theme.isTablet;
|
|
50
53
|
const noResultsText = "No results found for your search. Try adjusting your filters or query.";
|
|
51
54
|
useEffect(() => {
|
|
52
55
|
const loadAuthData = async () => {
|
|
@@ -315,12 +318,16 @@ export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
|
315
318
|
};
|
|
316
319
|
const handleClearChat = useCallback(async () => {
|
|
317
320
|
try {
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
321
|
+
const stored = await Storage.getJSON("vdbchat_conversations", null);
|
|
322
|
+
if (stored && priceMode && stored.conversations?.[priceMode]) {
|
|
323
|
+
const updatedConversations = {
|
|
324
|
+
...stored.conversations
|
|
325
|
+
};
|
|
322
326
|
delete updatedConversations[priceMode];
|
|
323
|
-
await Storage.setJSON("vdbchat_conversations",
|
|
327
|
+
await Storage.setJSON("vdbchat_conversations", {
|
|
328
|
+
token: stored.token,
|
|
329
|
+
conversations: updatedConversations
|
|
330
|
+
});
|
|
324
331
|
}
|
|
325
332
|
setMessages([]);
|
|
326
333
|
setProductsByMsg({});
|
|
@@ -407,16 +414,14 @@ export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
|
407
414
|
clearInterval(interval);
|
|
408
415
|
};
|
|
409
416
|
}, [typingMessageId, typingFullText]);
|
|
410
|
-
return /*#__PURE__*/React.createElement(
|
|
411
|
-
|
|
412
|
-
backgroundColor: theme.backgroundColor
|
|
413
|
-
}]
|
|
417
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Container, {
|
|
418
|
+
theme: theme
|
|
414
419
|
}, /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
415
420
|
style: {
|
|
416
421
|
flex: 1
|
|
417
422
|
},
|
|
418
423
|
behavior: Platform.OS === "ios" ? "padding" : "height",
|
|
419
|
-
keyboardVerticalOffset:
|
|
424
|
+
keyboardVerticalOffset: 100
|
|
420
425
|
}, /*#__PURE__*/React.createElement(ScrollView, {
|
|
421
426
|
ref: scrollRef,
|
|
422
427
|
keyboardShouldPersistTaps: "handled",
|
|
@@ -434,12 +439,12 @@ export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
|
434
439
|
scrollEventThrottle: 16,
|
|
435
440
|
style: modalHeight ? {
|
|
436
441
|
height: modalHeight,
|
|
437
|
-
backgroundColor: "#FFFFFF"
|
|
442
|
+
backgroundColor: theme["core-01"] || "#FFFFFF"
|
|
438
443
|
} : {
|
|
439
|
-
backgroundColor: "#FFFFFF"
|
|
444
|
+
backgroundColor: theme["core-01"] || "#FFFFFF"
|
|
440
445
|
},
|
|
441
446
|
contentContainerStyle: {
|
|
442
|
-
backgroundColor: theme?.listContentBackgroundColor || "#FFFFFF",
|
|
447
|
+
backgroundColor: theme["core-01"] || themeProps?.listContentBackgroundColor || "#FFFFFF",
|
|
443
448
|
...styles.listContent,
|
|
444
449
|
justifyContent: messages.length === 0 ? "center" : "flex-end",
|
|
445
450
|
minHeight: modalHeight ? modalHeight : undefined,
|
|
@@ -456,11 +461,11 @@ export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
|
456
461
|
});
|
|
457
462
|
}
|
|
458
463
|
}
|
|
459
|
-
}, /*#__PURE__*/React.createElement(
|
|
460
|
-
|
|
461
|
-
}, /*#__PURE__*/React.createElement(
|
|
462
|
-
|
|
463
|
-
},
|
|
464
|
+
}, messages?.[0]?.createdAt && /*#__PURE__*/React.createElement(EmptyContainer, {
|
|
465
|
+
theme: theme
|
|
466
|
+
}, /*#__PURE__*/React.createElement(EmptyText, {
|
|
467
|
+
theme: theme
|
|
468
|
+
}, `Chat Started at ${formatToTime(messages[0].createdAt)}`)), (() => {
|
|
464
469
|
const ordered = [...messages];
|
|
465
470
|
return ordered.map((item, index) => {
|
|
466
471
|
const isLatest = index === ordered.length - 1;
|
|
@@ -472,7 +477,7 @@ export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
|
472
477
|
}
|
|
473
478
|
}, /*#__PURE__*/React.createElement(MessageBubble, {
|
|
474
479
|
message: item,
|
|
475
|
-
|
|
480
|
+
userTheme: themeProps,
|
|
476
481
|
priceMode: priceMode,
|
|
477
482
|
handleFeedbackAction: handleFeedbackAction,
|
|
478
483
|
onReloadResults: handleReloadResults,
|
|
@@ -526,32 +531,66 @@ export const ChatWidget = /*#__PURE__*/forwardRef(({
|
|
|
526
531
|
hasResults: hasDiamonds
|
|
527
532
|
}));
|
|
528
533
|
});
|
|
529
|
-
})()), /*#__PURE__*/React.createElement(
|
|
530
|
-
|
|
531
|
-
}), /*#__PURE__*/React.createElement(View, {
|
|
532
|
-
style: [styles.bottomContainer, isTablet ? {
|
|
533
|
-
maxWidth: 608,
|
|
534
|
-
alignSelf: "center",
|
|
535
|
-
width: "100%"
|
|
536
|
-
} : {}]
|
|
534
|
+
})()), /*#__PURE__*/React.createElement(LineView, null), /*#__PURE__*/React.createElement(BottomContainer, {
|
|
535
|
+
theme: theme
|
|
537
536
|
}, /*#__PURE__*/React.createElement(ChatInput, {
|
|
538
537
|
value: input,
|
|
539
538
|
onChangeText: setInput,
|
|
540
539
|
onSend: handleSend,
|
|
541
540
|
disabled: loading,
|
|
542
541
|
placeholder: placeholder,
|
|
543
|
-
theme:
|
|
542
|
+
theme: themeProps,
|
|
544
543
|
inputRef: inputRef
|
|
545
544
|
}), /*#__PURE__*/React.createElement(BetaNotice, {
|
|
546
545
|
active: betaActive
|
|
547
|
-
}))));
|
|
546
|
+
})))));
|
|
548
547
|
});
|
|
549
548
|
ChatWidget.displayName = "ChatWidget";
|
|
549
|
+
const Container = styled.View`
|
|
550
|
+
background-color: ${({
|
|
551
|
+
theme
|
|
552
|
+
}) => theme["core-01"] || "#FFFFFF"};
|
|
553
|
+
flex: 1;
|
|
554
|
+
width: 100%;
|
|
555
|
+
`;
|
|
556
|
+
const EmptyContainer = styled.View`
|
|
557
|
+
padding: 16px;
|
|
558
|
+
align-items: center;
|
|
559
|
+
justify-content: center;
|
|
560
|
+
background-color: ${({
|
|
561
|
+
theme
|
|
562
|
+
}) => theme["core-01"] || "#FFFFFF"};
|
|
563
|
+
`;
|
|
564
|
+
const EmptyText = styled.Text`
|
|
565
|
+
font-size: 13px;
|
|
566
|
+
font-weight: 400;
|
|
567
|
+
color: ${({
|
|
568
|
+
theme
|
|
569
|
+
}) => theme["core-06"] || "#4F4E57"};
|
|
570
|
+
`;
|
|
571
|
+
const BottomContainer = styled.View`
|
|
572
|
+
padding-vertical: 12px;
|
|
573
|
+
padding-horizontal: 16px;
|
|
574
|
+
flex-direction: column;
|
|
575
|
+
justify-content: space-between;
|
|
576
|
+
align-items: center;
|
|
577
|
+
align-self: stretch;
|
|
578
|
+
gap: 12px;
|
|
579
|
+
${({
|
|
580
|
+
theme
|
|
581
|
+
}) => theme.isTablet && css`
|
|
582
|
+
maxWidth: 608,
|
|
583
|
+
align-self: center;
|
|
584
|
+
width: 100%;
|
|
585
|
+
`}
|
|
586
|
+
`;
|
|
587
|
+
const LineView = styled.View`
|
|
588
|
+
border-top-color: ${({
|
|
589
|
+
theme
|
|
590
|
+
}) => theme["core-03"] || "#E0E0E0"};
|
|
591
|
+
border-top-width: 1;
|
|
592
|
+
`;
|
|
550
593
|
const styles = StyleSheet.create({
|
|
551
|
-
container: {
|
|
552
|
-
flex: 1,
|
|
553
|
-
width: "100%"
|
|
554
|
-
},
|
|
555
594
|
listContent: {
|
|
556
595
|
paddingVertical: 8,
|
|
557
596
|
flexGrow: 1,
|
|
@@ -560,30 +599,6 @@ const styles = StyleSheet.create({
|
|
|
560
599
|
loading: {
|
|
561
600
|
paddingVertical: 8,
|
|
562
601
|
alignItems: "center"
|
|
563
|
-
},
|
|
564
|
-
emptyContainer: {
|
|
565
|
-
padding: 16,
|
|
566
|
-
alignItems: "center",
|
|
567
|
-
justifyContent: "center",
|
|
568
|
-
backgroundColor: "#FFFFFF"
|
|
569
|
-
},
|
|
570
|
-
emptyText: {
|
|
571
|
-
fontSize: 13,
|
|
572
|
-
fontWeight: "400",
|
|
573
|
-
color: "#4F4E57"
|
|
574
|
-
},
|
|
575
|
-
bottomContainer: {
|
|
576
|
-
paddingVertical: 12,
|
|
577
|
-
paddingHorizontal: 16,
|
|
578
|
-
flexDirection: "column",
|
|
579
|
-
justifyContent: "space-between",
|
|
580
|
-
alignItems: "center",
|
|
581
|
-
alignSelf: "stretch",
|
|
582
|
-
gap: 12
|
|
583
|
-
},
|
|
584
|
-
borderTop: {
|
|
585
|
-
borderTopColor: "#E0E0E0",
|
|
586
|
-
borderTopWidth: 1
|
|
587
602
|
}
|
|
588
603
|
});
|
|
589
604
|
//# sourceMappingURL=ChatWidget.js.map
|