vdb-ai-chat 1.0.21 → 1.0.23
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 +20 -1
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/BetaNotice.js +0 -1
- package/lib/commonjs/components/BetaNotice.js.map +1 -1
- package/lib/commonjs/components/Button.js +95 -0
- package/lib/commonjs/components/Button.js.map +1 -0
- package/lib/commonjs/components/ChatWidget.js +82 -4
- package/lib/commonjs/components/ChatWidget.js.map +1 -1
- package/lib/commonjs/components/LabelContainer.js +50 -0
- package/lib/commonjs/components/LabelContainer.js.map +1 -0
- package/lib/commonjs/components/MessageBubble.js +50 -11
- package/lib/commonjs/components/MessageBubble.js.map +1 -1
- package/lib/commonjs/components/MessageMetaRow.js +22 -6
- package/lib/commonjs/components/MessageMetaRow.js.map +1 -1
- package/lib/commonjs/components/ProductsList.js +12 -2
- package/lib/commonjs/components/ProductsList.js.map +1 -1
- package/lib/commonjs/components/ProductsListView.js +123 -317
- package/lib/commonjs/components/ProductsListView.js.map +1 -1
- package/lib/commonjs/components/utils.js +189 -6
- package/lib/commonjs/components/utils.js.map +1 -1
- package/lib/commonjs/types.js +4 -0
- package/lib/module/api.js +20 -2
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/BetaNotice.js +0 -1
- package/lib/module/components/BetaNotice.js.map +1 -1
- package/lib/module/components/Button.js +88 -0
- package/lib/module/components/Button.js.map +1 -0
- package/lib/module/components/ChatWidget.js +84 -6
- package/lib/module/components/ChatWidget.js.map +1 -1
- package/lib/module/components/LabelContainer.js +43 -0
- package/lib/module/components/LabelContainer.js.map +1 -0
- package/lib/module/components/MessageBubble.js +51 -12
- package/lib/module/components/MessageBubble.js.map +1 -1
- package/lib/module/components/MessageMetaRow.js +22 -6
- package/lib/module/components/MessageMetaRow.js.map +1 -1
- package/lib/module/components/ProductsList.js +12 -2
- package/lib/module/components/ProductsList.js.map +1 -1
- package/lib/module/components/ProductsListView.js +123 -318
- package/lib/module/components/ProductsListView.js.map +1 -1
- package/lib/module/components/utils.js +182 -4
- package/lib/module/components/utils.js.map +1 -1
- package/lib/module/types.js +1 -1
- package/lib/typescript/api.d.ts +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/Button.d.ts +5 -0
- package/lib/typescript/components/Button.d.ts.map +1 -0
- package/lib/typescript/components/ChatWidget.d.ts.map +1 -1
- package/lib/typescript/components/LabelContainer.d.ts +10 -0
- package/lib/typescript/components/LabelContainer.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble.d.ts.map +1 -1
- package/lib/typescript/components/MessageMetaRow.d.ts.map +1 -1
- package/lib/typescript/components/ProductsList.d.ts +5 -0
- package/lib/typescript/components/ProductsList.d.ts.map +1 -1
- package/lib/typescript/components/ProductsListView.d.ts +5 -0
- package/lib/typescript/components/ProductsListView.d.ts.map +1 -1
- package/lib/typescript/components/utils.d.ts +37 -4
- package/lib/typescript/components/utils.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +28 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +30 -2
- package/src/components/BetaNotice.tsx +0 -1
- package/src/components/Button.tsx +85 -0
- package/src/components/ChatWidget.tsx +90 -2
- package/src/components/LabelContainer.tsx +50 -0
- package/src/components/MessageBubble.tsx +50 -36
- package/src/components/MessageMetaRow.tsx +26 -9
- package/src/components/ProductsList.tsx +15 -0
- package/src/components/ProductsListView.tsx +238 -307
- package/src/components/utils.ts +242 -5
- package/src/types.ts +31 -0
|
@@ -2,8 +2,6 @@ import React, { memo, useEffect, useState } from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
StyleSheet,
|
|
5
|
-
Text,
|
|
6
|
-
TouchableOpacity,
|
|
7
5
|
ScrollView,
|
|
8
6
|
Platform,
|
|
9
7
|
Image,
|
|
@@ -13,12 +11,17 @@ import {
|
|
|
13
11
|
getUserCurrencySymbol,
|
|
14
12
|
formatPriceValue,
|
|
15
13
|
roundUpPrices,
|
|
16
|
-
|
|
14
|
+
ProductCategory,
|
|
15
|
+
ButtonCategory,
|
|
16
|
+
ButtonType,
|
|
17
|
+
AIEventNames,
|
|
18
|
+
AIEventTypes,
|
|
19
|
+
colorStringForShort,
|
|
17
20
|
} from "./utils";
|
|
18
21
|
import { useTheme } from "styled-components/native";
|
|
19
22
|
import { DefaultTheme } from "styled-components/native";
|
|
20
23
|
import styled from "styled-components/native";
|
|
21
|
-
import
|
|
24
|
+
import Button from "./Button";
|
|
22
25
|
|
|
23
26
|
let ImageComponent: typeof Image = Image;
|
|
24
27
|
if (Platform.OS !== "web") {
|
|
@@ -29,275 +32,43 @@ if (Platform.OS !== "web") {
|
|
|
29
32
|
// expo-image not installed, use React Native Image
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
|
-
|
|
33
|
-
// Token configuration for diamond details display
|
|
34
|
-
type TokenStyle = "primary" | "secondary";
|
|
35
|
-
type TokenType =
|
|
36
|
-
| "field"
|
|
37
|
-
| "separator"
|
|
38
|
-
| "lineBreak"
|
|
39
|
-
| "group"
|
|
40
|
-
| "fieldWithSuffix"
|
|
41
|
-
| "priceField";
|
|
42
|
-
|
|
43
|
-
interface TokenConfig {
|
|
44
|
-
type: TokenType;
|
|
45
|
-
field?: string;
|
|
46
|
-
style?: TokenStyle;
|
|
47
|
-
suffix?: string;
|
|
48
|
-
prefix?: string;
|
|
49
|
-
suffixStyle?: TokenStyle;
|
|
50
|
-
prefixStyle?: TokenStyle;
|
|
51
|
-
format?: "percent";
|
|
52
|
-
showCurrencyIf?: string;
|
|
53
|
-
items?: TokenConfig[];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const DIAMOND_TOKENS_MOBILE_WEB: TokenConfig[] = [
|
|
57
|
-
// Row 1: Basic specs
|
|
58
|
-
{ type: "field", field: "shape_long", style: "primary" },
|
|
59
|
-
{
|
|
60
|
-
type: "fieldWithSuffix",
|
|
61
|
-
field: "size",
|
|
62
|
-
style: "secondary",
|
|
63
|
-
suffix: "ct",
|
|
64
|
-
showCurrencyIf: "price_per_carat",
|
|
65
|
-
},
|
|
66
|
-
{ type: "field", field: "color", style: "primary" },
|
|
67
|
-
{ type: "field", field: "clarity_short", style: "primary" },
|
|
68
|
-
{ type: "separator" },
|
|
69
|
-
{
|
|
70
|
-
type: "group",
|
|
71
|
-
items: [
|
|
72
|
-
{ type: "field", field: "cut_short", style: "primary" },
|
|
73
|
-
{ type: "field", field: "polish_short", style: "primary", prefix: "/" },
|
|
74
|
-
{ type: "field", field: "symmetry_short", style: "primary", prefix: "/" },
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
{ type: "separator" },
|
|
78
|
-
{ type: "field", field: "fluorescence_intensity_short", style: "primary" },
|
|
79
|
-
{ type: "separator" },
|
|
80
|
-
{ type: "field", field: "lab_short", style: "primary" },
|
|
81
|
-
{ type: "separator" },
|
|
82
|
-
{
|
|
83
|
-
type: "field",
|
|
84
|
-
field: "discount_percent",
|
|
85
|
-
style: "secondary",
|
|
86
|
-
format: "percent",
|
|
87
|
-
},
|
|
88
|
-
// Row 2: Measurements & Pricing
|
|
89
|
-
{ type: "lineBreak" },
|
|
90
|
-
{
|
|
91
|
-
type: "field",
|
|
92
|
-
field: "depth_percent",
|
|
93
|
-
style: "secondary",
|
|
94
|
-
prefixStyle: "primary",
|
|
95
|
-
prefix: "D",
|
|
96
|
-
format: "percent",
|
|
97
|
-
},
|
|
98
|
-
{ type: "separator" },
|
|
99
|
-
{
|
|
100
|
-
type: "field",
|
|
101
|
-
field: "table_percent",
|
|
102
|
-
style: "secondary",
|
|
103
|
-
prefixStyle: "primary",
|
|
104
|
-
prefix: "T",
|
|
105
|
-
format: "percent",
|
|
106
|
-
},
|
|
107
|
-
{ type: "separator" },
|
|
108
|
-
{ type: "field", field: "measurement", style: "secondary" },
|
|
109
|
-
{ type: "separator" },
|
|
110
|
-
{
|
|
111
|
-
type: "priceField",
|
|
112
|
-
field: "price_per_carat",
|
|
113
|
-
style: "secondary",
|
|
114
|
-
suffixStyle: "primary",
|
|
115
|
-
suffix: "PC",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
type: "priceField",
|
|
119
|
-
field: "total_sales_price",
|
|
120
|
-
style: "secondary",
|
|
121
|
-
prefix: " =",
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
|
|
125
|
-
const DIAMOND_TOKENS_TABLET: TokenConfig[] = [
|
|
126
|
-
// Row 1: Basic specs
|
|
127
|
-
{ type: "field", field: "shape_long", style: "primary" },
|
|
128
|
-
{
|
|
129
|
-
type: "fieldWithSuffix",
|
|
130
|
-
field: "size",
|
|
131
|
-
style: "secondary",
|
|
132
|
-
suffix: "ct",
|
|
133
|
-
showCurrencyIf: "price_per_carat",
|
|
134
|
-
},
|
|
135
|
-
{ type: "field", field: "color", style: "primary" },
|
|
136
|
-
{ type: "field", field: "clarity_short", style: "primary" },
|
|
137
|
-
{ type: "separator" },
|
|
138
|
-
{
|
|
139
|
-
type: "group",
|
|
140
|
-
items: [
|
|
141
|
-
{ type: "field", field: "cut_short", style: "primary" },
|
|
142
|
-
{ type: "field", field: "polish_short", style: "primary", prefix: "/" },
|
|
143
|
-
{ type: "field", field: "symmetry_short", style: "primary", prefix: "/" },
|
|
144
|
-
],
|
|
145
|
-
},
|
|
146
|
-
{ type: "separator" },
|
|
147
|
-
{ type: "field", field: "fluorescence_intensity_short", style: "primary" },
|
|
148
|
-
{ type: "separator" },
|
|
149
|
-
{ type: "field", field: "lab_short", style: "primary" },
|
|
150
|
-
{ type: "separator" },
|
|
151
|
-
{
|
|
152
|
-
type: "field",
|
|
153
|
-
field: "depth_percent",
|
|
154
|
-
style: "secondary",
|
|
155
|
-
prefixStyle: "primary",
|
|
156
|
-
prefix: "D",
|
|
157
|
-
format: "percent",
|
|
158
|
-
},
|
|
159
|
-
{ type: "separator" },
|
|
160
|
-
{
|
|
161
|
-
type: "field",
|
|
162
|
-
field: "table_percent",
|
|
163
|
-
style: "secondary",
|
|
164
|
-
prefixStyle: "primary",
|
|
165
|
-
prefix: "T",
|
|
166
|
-
format: "percent",
|
|
167
|
-
},
|
|
168
|
-
{ type: "separator" },
|
|
169
|
-
{ type: "field", field: "measurement", style: "secondary" },
|
|
170
|
-
{ type: "separator" }, {
|
|
171
|
-
type: "field",
|
|
172
|
-
field: "discount_percent",
|
|
173
|
-
style: "secondary",
|
|
174
|
-
format: "percent",
|
|
175
|
-
},
|
|
176
|
-
// Row 2: Measurements & Pricing
|
|
177
|
-
{ type: "lineBreak" },
|
|
178
|
-
{
|
|
179
|
-
type: "priceField",
|
|
180
|
-
field: "price_per_carat",
|
|
181
|
-
style: "secondary",
|
|
182
|
-
suffixStyle: "primary",
|
|
183
|
-
suffix: "PC",
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
type: "priceField",
|
|
187
|
-
field: "total_sales_price",
|
|
188
|
-
style: "secondary",
|
|
189
|
-
prefix: " =",
|
|
190
|
-
},
|
|
191
|
-
];
|
|
192
35
|
interface ProductsListViewProps {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
36
|
+
data: any[];
|
|
37
|
+
totalResults?: number;
|
|
38
|
+
onViewAll: (item: any) => void;
|
|
39
|
+
onItemPress?: (item: any) => void;
|
|
40
|
+
showMoreResults?: () => void;
|
|
41
|
+
showLessResults?: () => void;
|
|
42
|
+
trackAnalyticsEvent?: (eventName: string, eventData: Record<string, any>) => void;
|
|
43
|
+
currentPage?: number;
|
|
44
|
+
isLoadingMore?: boolean;
|
|
45
|
+
item: any;
|
|
198
46
|
}
|
|
199
47
|
|
|
200
|
-
const renderToken = (
|
|
201
|
-
token: TokenConfig,
|
|
202
|
-
item: any,
|
|
203
|
-
userCurrency: string | null,
|
|
204
|
-
index: number,
|
|
205
|
-
shouldRound: boolean = false
|
|
206
|
-
): React.ReactNode => {
|
|
207
|
-
const TextView = token.style === "secondary" ? TextStyleTwo : TextStyleOne;
|
|
208
|
-
const PrefixTextView =
|
|
209
|
-
token.prefixStyle === "secondary" ? TextStyleTwo : TextStyleOne;
|
|
210
|
-
const SuffixTextView =
|
|
211
|
-
token.suffixStyle === "secondary" ? TextStyleTwo : TextStyleOne;
|
|
212
|
-
const currency = userCurrency || "$";
|
|
213
|
-
const theme = useTheme();
|
|
214
|
-
switch (token.type) {
|
|
215
|
-
case "separator":
|
|
216
|
-
return (
|
|
217
|
-
<TextView key={index} theme={theme}>
|
|
218
|
-
{"·"}
|
|
219
|
-
</TextView>
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
case "lineBreak":
|
|
223
|
-
return <View key={index} style={styles.lineBreak} />;
|
|
224
|
-
|
|
225
|
-
case "field": {
|
|
226
|
-
let value = item[token.field!] ?? "-";
|
|
227
|
-
if (token.format === "percent" && value !== "-") {
|
|
228
|
-
value = `${value}%`;
|
|
229
|
-
}
|
|
230
|
-
return (
|
|
231
|
-
<React.Fragment key={index}>
|
|
232
|
-
{token.prefix && (
|
|
233
|
-
<PrefixTextView theme={theme}>{token.prefix}</PrefixTextView>
|
|
234
|
-
)}
|
|
235
|
-
<TextView theme={theme}>{value}</TextView>
|
|
236
|
-
</React.Fragment>
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
case "fieldWithSuffix": {
|
|
241
|
-
const value = item[token.field!] ?? "-";
|
|
242
|
-
const showSuffix = token.showCurrencyIf
|
|
243
|
-
? item[token.showCurrencyIf]
|
|
244
|
-
: true;
|
|
245
|
-
return (
|
|
246
|
-
<View key={index} style={styles.rowCenter}>
|
|
247
|
-
<TextView theme={theme}>{value}</TextView>
|
|
248
|
-
{showSuffix && token.suffix && (
|
|
249
|
-
<TextView theme={theme}>{token.suffix}</TextView>
|
|
250
|
-
)}
|
|
251
|
-
</View>
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
case "priceField": {
|
|
256
|
-
const value = item[token.field!];
|
|
257
|
-
const formattedPrice = formatPriceValue(token.field!, value, shouldRound);
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<View key={index} style={styles.rowCenter}>
|
|
261
|
-
{token.prefix && <TextView theme={theme}>{token.prefix}</TextView>}
|
|
262
|
-
{value && <TextView theme={theme}>{currency}</TextView>}
|
|
263
|
-
<TextView theme={theme}>{formattedPrice ?? "-"}</TextView>
|
|
264
|
-
{token.suffix && (
|
|
265
|
-
<SuffixTextView theme={theme}>{token.suffix}</SuffixTextView>
|
|
266
|
-
)}
|
|
267
|
-
</View>
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
case "group":
|
|
272
|
-
return (
|
|
273
|
-
<View key={index} style={styles.rowCenter}>
|
|
274
|
-
{token.items?.map((subToken, subIndex) =>
|
|
275
|
-
renderToken(subToken, item, userCurrency, subIndex, shouldRound)
|
|
276
|
-
)}
|
|
277
|
-
</View>
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
default:
|
|
281
|
-
return null;
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
48
|
const ProductsListViewComponent: React.FC<ProductsListViewProps> = ({
|
|
286
49
|
data,
|
|
287
50
|
totalResults,
|
|
288
51
|
onViewAll,
|
|
289
52
|
onItemPress,
|
|
53
|
+
showMoreResults,
|
|
54
|
+
showLessResults,
|
|
55
|
+
trackAnalyticsEvent,
|
|
56
|
+
currentPage = 1,
|
|
57
|
+
isLoadingMore = false,
|
|
290
58
|
item,
|
|
291
59
|
}) => {
|
|
292
60
|
if (!data || !data.length) return null;
|
|
293
61
|
const theme = useTheme();
|
|
294
62
|
const [userCurrency, setUserCurrency] = useState<string | null>(null);
|
|
295
63
|
const [shouldRound, setShouldRound] = useState<boolean>(false);
|
|
296
|
-
const
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
64
|
+
const payload = item?.search_payload;
|
|
65
|
+
const isLabgrown =
|
|
66
|
+
typeof payload.lab_grown === "string"
|
|
67
|
+
? payload.lab_grown === "true"
|
|
68
|
+
: typeof payload.lab_grown === "boolean"
|
|
69
|
+
? payload.lab_grown
|
|
70
|
+
: false;
|
|
71
|
+
const productType = isLabgrown ? ProductCategory.LAB_GROWN_DIAMOND : ProductCategory.DIAMOND;
|
|
301
72
|
useEffect(() => {
|
|
302
73
|
const fetchCurrency = async () => {
|
|
303
74
|
const currency = await getUserCurrencySymbol();
|
|
@@ -314,50 +85,137 @@ const ProductsListViewComponent: React.FC<ProductsListViewProps> = ({
|
|
|
314
85
|
|
|
315
86
|
const handleItemPress = (dataItem: any) => {
|
|
316
87
|
onItemPress?.(dataItem);
|
|
317
|
-
|
|
88
|
+
// trackAnalyticsEvent?.(AIEventNames.AI_CHAT_WIDGET, {
|
|
89
|
+
// action: AIEventTypes.PRODUCT_PREVIEW_CLICKED,
|
|
90
|
+
// });
|
|
318
91
|
};
|
|
319
92
|
|
|
320
93
|
const handleViewAllPress = (item: any) => {
|
|
321
94
|
onViewAll?.(item);
|
|
322
|
-
|
|
95
|
+
// trackAnalyticsEvent?.(AIEventNames.AI_CHAT_WIDGET, {
|
|
96
|
+
// action: AIEventTypes.SHOW_ALL_RESULTS_CLICKED,
|
|
97
|
+
// });
|
|
323
98
|
};
|
|
324
99
|
|
|
325
100
|
return (
|
|
326
101
|
<Wrapper theme={theme}>
|
|
327
102
|
<ScrollView
|
|
328
103
|
showsVerticalScrollIndicator={false}
|
|
329
|
-
contentContainerStyle={styles.listContent}
|
|
330
104
|
>
|
|
331
105
|
{data.map((dataItem: any, index: number) => (
|
|
332
106
|
<Pressable key={dataItem.id} onPress={() => handleItemPress(dataItem)}>
|
|
333
107
|
{(state) => (
|
|
334
108
|
// @ts-ignore
|
|
335
109
|
<ListItemParent theme={theme} hovered={state.hovered}>
|
|
336
|
-
<View
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
110
|
+
<View>
|
|
111
|
+
<View style={styles.left}>
|
|
112
|
+
{/* <View style={styles.serialContainer}>
|
|
113
|
+
<Serial>{index + 1}.</Serial>
|
|
114
|
+
</View> */}
|
|
115
|
+
<View style={styles.tokens}>
|
|
116
|
+
<TopContainer>
|
|
117
|
+
<TopLeftContainer>
|
|
118
|
+
<ExtraSmallGapContainer>
|
|
119
|
+
{/* Shape */}
|
|
120
|
+
<TextStyleBold>{`${dataItem.shape_short ?? "-"}`}</TextStyleBold>
|
|
121
|
+
{/* Carat */}
|
|
122
|
+
<TextStyleBold>{`${dataItem.size ?? "-"}ct`}</TextStyleBold>
|
|
123
|
+
{/* Color */}
|
|
124
|
+
<TextStyleBold>{`${colorStringForShort(true, dataItem) ?? "-"}`}</TextStyleBold>
|
|
125
|
+
{/* Clarity */}
|
|
126
|
+
<TextStyleBold>{`${dataItem.clarity_short ?? "-"}`}</TextStyleBold>
|
|
127
|
+
{/* LAB */}
|
|
128
|
+
<TextStyleBold>{`${dataItem.lab_short ?? "-"}`}</TextStyleBold>
|
|
129
|
+
</ExtraSmallGapContainer>
|
|
130
|
+
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
131
|
+
{/* Cut */}
|
|
132
|
+
<TextStyleRegular>{dataItem.cut_short ?? "-"}</TextStyleRegular>
|
|
133
|
+
<TextStyleRegular>{"/"}</TextStyleRegular>
|
|
134
|
+
{/* Polish */}
|
|
135
|
+
<TextStyleRegular>{dataItem.polish_short ?? "-"}</TextStyleRegular>
|
|
136
|
+
<TextStyleRegular>{"/"}</TextStyleRegular>
|
|
137
|
+
{/* Symmetry */}
|
|
138
|
+
<TextStyleRegular>{dataItem.symmetry_short ?? "-"}</TextStyleRegular>
|
|
139
|
+
</View>
|
|
140
|
+
<TextStyleRegular>{dataItem.fluorescence_intensity_short ?? "-"}</TextStyleRegular>
|
|
141
|
+
</TopLeftContainer>
|
|
142
|
+
<TopRightContainer>
|
|
143
|
+
<PricePerCaratContainer>
|
|
144
|
+
{dataItem.price_per_carat ? <TextStyleBold>{userCurrency ? userCurrency : "$"}</TextStyleBold> : <></>}
|
|
145
|
+
<TextStyleBold>{formatPriceValue("price_per_carat", dataItem.price_per_carat, shouldRound) ?? "-"}</TextStyleBold>
|
|
146
|
+
</PricePerCaratContainer>
|
|
147
|
+
<TextStyleRegular>{"p/ct"}</TextStyleRegular>
|
|
148
|
+
</TopRightContainer>
|
|
149
|
+
</TopContainer>
|
|
150
|
+
<BottomContainer>
|
|
151
|
+
<BottomLeftContainer>
|
|
152
|
+
{/* Depth */}
|
|
153
|
+
<DepthContainer>
|
|
154
|
+
<TextStyleRegular>{"D"}</TextStyleRegular>
|
|
155
|
+
<TextStyleBold>{dataItem.depth_percent ? dataItem.depth_percent + "%" : "-"}</TextStyleBold>
|
|
156
|
+
</DepthContainer>
|
|
157
|
+
|
|
158
|
+
{/* Table */}
|
|
159
|
+
<TableContainer>
|
|
160
|
+
<TextStyleRegular>{"T"}</TextStyleRegular>
|
|
161
|
+
<TextStyleBold>{dataItem.table_percent ? dataItem.table_percent + "%" : "-"}</TextStyleBold>
|
|
162
|
+
</TableContainer>
|
|
163
|
+
|
|
164
|
+
<MeasurementsContainer>
|
|
165
|
+
{/* Meas */}
|
|
166
|
+
<TextStyleRegular>{dataItem.measurement ?? "-"}</TextStyleRegular>
|
|
167
|
+
</MeasurementsContainer>
|
|
168
|
+
</BottomLeftContainer>
|
|
169
|
+
<BottomRightContainer>
|
|
170
|
+
{/* Discount */}
|
|
171
|
+
{isLabgrown ? <></> : <TextStyleBold>{dataItem.discount_percent ? dataItem.discount_percent + "%" : "-"}</TextStyleBold>}
|
|
172
|
+
<TotalPriceContainer>
|
|
173
|
+
<TotalPriceChildContainer>
|
|
174
|
+
{dataItem.total_sales_price ? <TextStyleBold>{userCurrency ? userCurrency : "$"}</TextStyleBold> : <></>}
|
|
175
|
+
<TextStyleBold>{formatPriceValue("total_sales_price", dataItem.total_sales_price, shouldRound) ?? "-"}</TextStyleBold>
|
|
176
|
+
</TotalPriceChildContainer>
|
|
177
|
+
<TextStyleRegular>{"total"}</TextStyleRegular>
|
|
178
|
+
</TotalPriceContainer>
|
|
179
|
+
</BottomRightContainer>
|
|
180
|
+
</BottomContainer>
|
|
181
|
+
</View>
|
|
182
|
+
</View>
|
|
183
|
+
</View>
|
|
352
184
|
</ListItemParent>
|
|
353
185
|
)}
|
|
354
186
|
</Pressable>
|
|
355
187
|
))}
|
|
356
188
|
</ScrollView>
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
189
|
+
{showMoreResults && currentPage < 3 && (
|
|
190
|
+
<ShowMoreContainer>
|
|
191
|
+
<Pressable onPress={showMoreResults} disabled={isLoadingMore}>
|
|
192
|
+
<ShowMoreText theme={theme}>
|
|
193
|
+
{isLoadingMore ? 'Loading...' : `Show more`}
|
|
194
|
+
</ShowMoreText>
|
|
195
|
+
</Pressable>
|
|
196
|
+
</ShowMoreContainer>
|
|
197
|
+
)}
|
|
198
|
+
{showLessResults && (currentPage === 3 || data.length >= 15) && (
|
|
199
|
+
<ShowMoreContainer>
|
|
200
|
+
<Pressable onPress={showLessResults}>
|
|
201
|
+
<ShowMoreText theme={theme}>
|
|
202
|
+
Show less
|
|
203
|
+
</ShowMoreText>
|
|
204
|
+
</Pressable>
|
|
205
|
+
</ShowMoreContainer>
|
|
206
|
+
)}
|
|
207
|
+
<Button
|
|
208
|
+
category={isLabgrown ? ButtonCategory.lab : ButtonCategory.diam}
|
|
209
|
+
height={32}
|
|
210
|
+
type={ButtonType.primary}
|
|
211
|
+
borderRadius={8}
|
|
212
|
+
style={{
|
|
213
|
+
marginTop: 12,
|
|
214
|
+
}}
|
|
215
|
+
onPress={() => handleViewAllPress(item)}
|
|
216
|
+
>
|
|
217
|
+
<ButtonText>{`View All ${Number(totalResults).toLocaleString()} diamonds`}</ButtonText>
|
|
218
|
+
{/* <ImageComponent
|
|
361
219
|
source={{
|
|
362
220
|
uri: "https://cdn.vdbapp.com/ai/chat-widget/assets/img/right.svg",
|
|
363
221
|
}}
|
|
@@ -367,8 +225,8 @@ const ProductsListViewComponent: React.FC<ProductsListViewProps> = ({
|
|
|
367
225
|
height: 20,
|
|
368
226
|
tintColor: theme["primary-cont"] || "#ffffff",
|
|
369
227
|
}}
|
|
370
|
-
/>
|
|
371
|
-
</
|
|
228
|
+
/> */}
|
|
229
|
+
</Button>
|
|
372
230
|
</Wrapper>
|
|
373
231
|
);
|
|
374
232
|
};
|
|
@@ -377,15 +235,21 @@ const Wrapper = styled.View<{ theme: DefaultTheme }>`
|
|
|
377
235
|
padding-horizontal: 8px;
|
|
378
236
|
`;
|
|
379
237
|
|
|
380
|
-
const
|
|
381
|
-
|
|
238
|
+
const ShowMoreContainer = styled.View`
|
|
239
|
+
margin-top: 8px;
|
|
240
|
+
align-items: flex-start;
|
|
241
|
+
justify-content: center;
|
|
242
|
+
`;
|
|
243
|
+
|
|
244
|
+
const ShowMoreText = styled.Text<{ theme: DefaultTheme }>`
|
|
382
245
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
383
|
-
theme["
|
|
246
|
+
theme["link-static"] || "#3378F6"};
|
|
247
|
+
font-size: 14px;
|
|
384
248
|
font-weight: 500;
|
|
385
249
|
font-family: 'Roboto-Medium';
|
|
386
250
|
`;
|
|
387
251
|
|
|
388
|
-
const
|
|
252
|
+
const TextStyleRegular = styled.Text<{ theme: DefaultTheme }>`
|
|
389
253
|
font-size: 13px;
|
|
390
254
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
391
255
|
theme["core-06"] || "#4F4E57"};
|
|
@@ -394,7 +258,7 @@ const TextStyleOne = styled.Text<{ theme: DefaultTheme }>`
|
|
|
394
258
|
font-style: normal;
|
|
395
259
|
`;
|
|
396
260
|
|
|
397
|
-
const
|
|
261
|
+
const TextStyleBold = styled.Text<{ theme: DefaultTheme }>`
|
|
398
262
|
font-size: 13px;
|
|
399
263
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
400
264
|
theme["core-05"] || "#020001"};
|
|
@@ -403,23 +267,6 @@ const TextStyleTwo = styled.Text<{ theme: DefaultTheme }>`
|
|
|
403
267
|
font-style: normal;
|
|
404
268
|
`;
|
|
405
269
|
|
|
406
|
-
const ButtonView = styled.TouchableOpacity<{ theme: DefaultTheme }>`
|
|
407
|
-
margin-top: 12px;
|
|
408
|
-
margin-horizontal: 12px;
|
|
409
|
-
align-self: center;
|
|
410
|
-
padding-horizontal: 16px;
|
|
411
|
-
padding-vertical: 6px;
|
|
412
|
-
background-color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
413
|
-
theme["primary-bg-static"] || "#292735"};
|
|
414
|
-
border-radius: 8px;
|
|
415
|
-
align-items: center;
|
|
416
|
-
gap: 16px;
|
|
417
|
-
width: 100%;
|
|
418
|
-
flex-direction: row;
|
|
419
|
-
justify-content: center;
|
|
420
|
-
align-content: center;
|
|
421
|
-
`;
|
|
422
|
-
|
|
423
270
|
const ButtonText = styled.Text<{ theme: DefaultTheme }>`
|
|
424
271
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
425
272
|
theme["primary-cont"] || "#ffffff"};
|
|
@@ -429,7 +276,10 @@ const ButtonText = styled.Text<{ theme: DefaultTheme }>`
|
|
|
429
276
|
`;
|
|
430
277
|
|
|
431
278
|
const ListItemParent = styled.View<{ theme: DefaultTheme; hovered?: boolean }>`
|
|
432
|
-
padding-vertical:
|
|
279
|
+
padding-vertical: 12px;
|
|
280
|
+
border-bottom-width: 1px;
|
|
281
|
+
border-bottom-color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
282
|
+
theme["core-03"] || "#D5D5DC"};
|
|
433
283
|
background-color: ${({
|
|
434
284
|
theme,
|
|
435
285
|
hovered,
|
|
@@ -439,6 +289,87 @@ const ListItemParent = styled.View<{ theme: DefaultTheme; hovered?: boolean }>`
|
|
|
439
289
|
}) => (hovered ? theme["secondary-bg-hover"] || "#EDEDF2" : "transparent")};
|
|
440
290
|
`;
|
|
441
291
|
|
|
292
|
+
const TopContainer = styled.View`
|
|
293
|
+
flex-direction: row;
|
|
294
|
+
justify-content: space-between;
|
|
295
|
+
align-items: center;
|
|
296
|
+
width: 100%;
|
|
297
|
+
`;
|
|
298
|
+
|
|
299
|
+
const TopLeftContainer = styled.View`
|
|
300
|
+
flex-direction: row;
|
|
301
|
+
justify-content: space-between;
|
|
302
|
+
align-items: center;
|
|
303
|
+
gap: 8px;
|
|
304
|
+
`;
|
|
305
|
+
|
|
306
|
+
const TopRightContainer = styled.View`
|
|
307
|
+
flex-direction: row;
|
|
308
|
+
justify-content: space-between;
|
|
309
|
+
align-items: center;
|
|
310
|
+
gap: 4px;
|
|
311
|
+
`;
|
|
312
|
+
|
|
313
|
+
const BottomContainer = styled.View`
|
|
314
|
+
flex-direction: row;
|
|
315
|
+
justify-content: space-between;
|
|
316
|
+
align-items: center;
|
|
317
|
+
width: 100%;
|
|
318
|
+
`;
|
|
319
|
+
|
|
320
|
+
const BottomLeftContainer = styled.View`
|
|
321
|
+
flex-direction: row;
|
|
322
|
+
justify-content: space-between;
|
|
323
|
+
align-items: center;
|
|
324
|
+
gap: 8px;
|
|
325
|
+
`;
|
|
326
|
+
|
|
327
|
+
const BottomRightContainer = styled.View`
|
|
328
|
+
flex-direction: row;
|
|
329
|
+
justify-content: space-between;
|
|
330
|
+
align-items: center;
|
|
331
|
+
gap: 4px;
|
|
332
|
+
`;
|
|
333
|
+
|
|
334
|
+
const PricePerCaratContainer = styled.View`
|
|
335
|
+
flex-direction: row;
|
|
336
|
+
align-items: center;
|
|
337
|
+
`;
|
|
338
|
+
|
|
339
|
+
const TotalPriceContainer = styled.View`
|
|
340
|
+
flex-direction: row;
|
|
341
|
+
justify-content: space-between;
|
|
342
|
+
align-items: center;
|
|
343
|
+
gap: 4px;
|
|
344
|
+
`;
|
|
345
|
+
|
|
346
|
+
const TotalPriceChildContainer = styled.View`
|
|
347
|
+
flex-direction: row;
|
|
348
|
+
align-items: center;
|
|
349
|
+
width: 65px;
|
|
350
|
+
justify-content: flex-end;
|
|
351
|
+
`;
|
|
352
|
+
|
|
353
|
+
const DepthContainer = styled.View`
|
|
354
|
+
flex-direction: row;
|
|
355
|
+
align-items: center;
|
|
356
|
+
gap: 2px;
|
|
357
|
+
`;
|
|
358
|
+
|
|
359
|
+
const TableContainer = styled.View`
|
|
360
|
+
flex-direction: row;
|
|
361
|
+
align-items: center;
|
|
362
|
+
gap: 2px;
|
|
363
|
+
`;
|
|
364
|
+
|
|
365
|
+
const ExtraSmallGapContainer = styled.View`
|
|
366
|
+
flex-direction: row;
|
|
367
|
+
align-items: center;
|
|
368
|
+
gap: 2px;
|
|
369
|
+
`;
|
|
370
|
+
|
|
371
|
+
const MeasurementsContainer = styled.View``;
|
|
372
|
+
|
|
442
373
|
const styles = StyleSheet.create({
|
|
443
374
|
listContent: {
|
|
444
375
|
gap: 8,
|