vdb-ai-chat 1.0.77 → 1.0.78
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 +461 -1
- package/lib/commonjs/api.js +27 -55
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/ChatHeader.js +0 -2
- package/lib/commonjs/components/ChatHeader.js.map +1 -1
- package/lib/commonjs/components/ChatWidget.js +21 -55
- package/lib/commonjs/components/ChatWidget.js.map +1 -1
- package/lib/commonjs/components/LazyProductsFetcher.js +3 -5
- package/lib/commonjs/components/LazyProductsFetcher.js.map +1 -1
- package/lib/commonjs/components/utils.js +34 -42
- package/lib/commonjs/components/utils.js.map +1 -1
- package/lib/commonjs/contexts/ThemeProvider.js +21 -44
- package/lib/commonjs/contexts/ThemeProvider.js.map +1 -1
- package/lib/commonjs/index.web.js +6 -17
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/storage.js +4 -14
- package/lib/commonjs/storage.js.map +1 -1
- package/lib/commonjs/theme.js +1 -229
- package/lib/commonjs/theme.js.map +1 -1
- package/lib/module/api.js +27 -53
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/ChatHeader.js +0 -2
- package/lib/module/components/ChatHeader.js.map +1 -1
- package/lib/module/components/ChatWidget.js +22 -56
- package/lib/module/components/ChatWidget.js.map +1 -1
- package/lib/module/components/LazyProductsFetcher.js +3 -5
- package/lib/module/components/LazyProductsFetcher.js.map +1 -1
- package/lib/module/components/utils.js +34 -42
- package/lib/module/components/utils.js.map +1 -1
- package/lib/module/contexts/ThemeProvider.js +16 -39
- package/lib/module/contexts/ThemeProvider.js.map +1 -1
- package/lib/module/index.web.js +6 -17
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/storage.js +4 -14
- package/lib/module/storage.js.map +1 -1
- package/lib/module/theme.js +0 -228
- package/lib/module/theme.js.map +1 -1
- package/lib/typescript/api.d.ts +2 -12
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/components/ChatHeader.d.ts.map +1 -1
- package/lib/typescript/components/ChatWidget.d.ts.map +1 -1
- package/lib/typescript/components/LazyProductsFetcher.d.ts +0 -3
- package/lib/typescript/components/LazyProductsFetcher.d.ts.map +1 -1
- package/lib/typescript/components/utils.d.ts +1 -0
- package/lib/typescript/components/utils.d.ts.map +1 -1
- package/lib/typescript/contexts/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/index.web.d.ts +1 -23
- package/lib/typescript/index.web.d.ts.map +1 -1
- package/lib/typescript/storage.d.ts.map +1 -1
- package/lib/typescript/theme.d.ts +0 -228
- package/lib/typescript/theme.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +0 -4
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +1 -2
- package/src/api.ts +24 -60
- package/src/components/ChatHeader.tsx +0 -2
- package/src/components/ChatWidget.tsx +86 -137
- package/src/components/LazyProductsFetcher.tsx +2 -7
- package/src/components/utils.ts +34 -42
- package/src/contexts/ThemeProvider.tsx +10 -32
- package/src/index.web.tsx +13 -59
- package/src/storage.ts +4 -14
- package/src/theme.ts +0 -230
- package/src/types.ts +0 -4
- package/lib/commonjs/components/ButtonContent.js +0 -54
- package/lib/commonjs/components/ButtonContent.js.map +0 -1
- package/lib/commonjs/components/FloatingChatButton.js +0 -197
- package/lib/commonjs/components/FloatingChatButton.js.map +0 -1
- package/lib/commonjs/config/storeConfigLoader.js +0 -161
- package/lib/commonjs/config/storeConfigLoader.js.map +0 -1
- package/lib/commonjs/config/types.js +0 -2
- package/lib/commonjs/config/types.js.map +0 -1
- package/lib/commonjs/utils/pluginUrlBuilder.js +0 -288
- package/lib/commonjs/utils/pluginUrlBuilder.js.map +0 -1
- package/lib/module/components/ButtonContent.js +0 -48
- package/lib/module/components/ButtonContent.js.map +0 -1
- package/lib/module/components/FloatingChatButton.js +0 -190
- package/lib/module/components/FloatingChatButton.js.map +0 -1
- package/lib/module/config/storeConfigLoader.js +0 -153
- package/lib/module/config/storeConfigLoader.js.map +0 -1
- package/lib/module/config/types.js +0 -2
- package/lib/module/config/types.js.map +0 -1
- package/lib/module/utils/pluginUrlBuilder.js +0 -279
- package/lib/module/utils/pluginUrlBuilder.js.map +0 -1
- package/lib/typescript/components/ButtonContent.d.ts +0 -5
- package/lib/typescript/components/ButtonContent.d.ts.map +0 -1
- package/lib/typescript/components/FloatingChatButton.d.ts +0 -8
- package/lib/typescript/components/FloatingChatButton.d.ts.map +0 -1
- package/lib/typescript/config/storeConfigLoader.d.ts +0 -25
- package/lib/typescript/config/storeConfigLoader.d.ts.map +0 -1
- package/lib/typescript/config/types.d.ts +0 -49
- package/lib/typescript/config/types.d.ts.map +0 -1
- package/lib/typescript/utils/pluginUrlBuilder.d.ts +0 -43
- package/lib/typescript/utils/pluginUrlBuilder.d.ts.map +0 -1
- package/src/components/ButtonContent.tsx +0 -54
- package/src/components/FloatingChatButton.tsx +0 -204
- package/src/config/storeConfigLoader.ts +0 -175
- package/src/config/types.ts +0 -51
- package/src/utils/pluginUrlBuilder.ts +0 -528
package/src/components/utils.ts
CHANGED
|
@@ -184,6 +184,7 @@ export enum AIEventTypes {
|
|
|
184
184
|
SHOW_ALL_RESULTS_CLICKED = "show_all_results_clicked",
|
|
185
185
|
SEARCH_INITIATED = "search_initiated",
|
|
186
186
|
NO_RESULTS_FOUND = "no_results_found",
|
|
187
|
+
CLASSIC_SEARCH_FILTERS = "classic_search_filters",
|
|
187
188
|
RECOMMENDATION_REQUESTED = "recommendation_requested",
|
|
188
189
|
RECOMMENDATION_RECEIVED = "recommendation_received",
|
|
189
190
|
}
|
|
@@ -273,52 +274,43 @@ export const renderSearchParams = ({
|
|
|
273
274
|
searchPayload.symmetries.push(searchPayload?.symmetry_to);
|
|
274
275
|
}
|
|
275
276
|
if (searchPayload?.three_x) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
searchPayload.symmetries = ["Excellent", "Excellent"];
|
|
291
|
-
searchPayload.cut_from = "Excellent";
|
|
292
|
-
searchPayload.cut_to = "Excellent";
|
|
293
|
-
searchPayload.polish_from = "Excellent";
|
|
294
|
-
searchPayload.polish_to = "Excellent";
|
|
295
|
-
searchPayload.symmetry_from = "Excellent";
|
|
296
|
-
searchPayload.symmetry_to = "Excellent";
|
|
297
|
-
}
|
|
298
|
-
delete searchPayload.three_x;
|
|
299
|
-
}
|
|
300
|
-
if (searchPayload?.three_vg_plus && searchPayload.lab_grown) {
|
|
301
|
-
searchPayload.cutGrades = ["Very Good", "8X"];
|
|
302
|
-
searchPayload.polishes = ["Very Good", "8X"];
|
|
303
|
-
searchPayload.symmetries = ["Very Good", "8X"];
|
|
277
|
+
// 3X: Triple Excellent - Cut/Polish/Symmetry all from Excellent to Ideal
|
|
278
|
+
searchPayload.cut_from = "Excellent";
|
|
279
|
+
searchPayload.cut_to = "Ideal";
|
|
280
|
+
searchPayload.polish_from = "Excellent";
|
|
281
|
+
searchPayload.polish_to = "Ideal";
|
|
282
|
+
searchPayload.symmetry_from = "Excellent";
|
|
283
|
+
searchPayload.symmetry_to = "Ideal";
|
|
284
|
+
searchPayload.cps_three_x_options = ["Ideal", "Excellent"]; // [max, min] range
|
|
285
|
+
delete searchPayload.cutGrades;
|
|
286
|
+
delete searchPayload.polishes;
|
|
287
|
+
delete searchPayload.symmetries;
|
|
288
|
+
}
|
|
289
|
+
if (searchPayload?.three_vg_plus) {
|
|
290
|
+
// 3VG+: Three Very Good Plus - Cut/Polish/Symmetry all from Very Good to Ideal
|
|
304
291
|
searchPayload.cut_from = "Very Good";
|
|
305
|
-
searchPayload.cut_to = "
|
|
292
|
+
searchPayload.cut_to = "Ideal";
|
|
306
293
|
searchPayload.polish_from = "Very Good";
|
|
307
|
-
searchPayload.polish_to = "
|
|
294
|
+
searchPayload.polish_to = "Ideal";
|
|
308
295
|
searchPayload.symmetry_from = "Very Good";
|
|
309
|
-
searchPayload.symmetry_to = "
|
|
310
|
-
searchPayload.cps_three_vg_plus_options = ["
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
searchPayload.
|
|
314
|
-
|
|
315
|
-
|
|
296
|
+
searchPayload.symmetry_to = "Ideal";
|
|
297
|
+
searchPayload.cps_three_vg_plus_options = ["Ideal", "Very Good"]; // [max, min] range
|
|
298
|
+
delete searchPayload.cutGrades;
|
|
299
|
+
delete searchPayload.polishes;
|
|
300
|
+
delete searchPayload.symmetries;
|
|
301
|
+
}
|
|
302
|
+
if (searchPayload?.eight_x) {
|
|
303
|
+
// 8X: Cut/Polish/Symmetry all from 8X to Ideal
|
|
316
304
|
searchPayload.cut_from = "8X";
|
|
317
|
-
searchPayload.cut_to = "
|
|
305
|
+
searchPayload.cut_to = "Ideal";
|
|
318
306
|
searchPayload.polish_from = "8X";
|
|
319
|
-
searchPayload.polish_to = "
|
|
307
|
+
searchPayload.polish_to = "Ideal";
|
|
320
308
|
searchPayload.symmetry_from = "8X";
|
|
321
|
-
searchPayload.symmetry_to = "
|
|
309
|
+
searchPayload.symmetry_to = "Ideal";
|
|
310
|
+
searchPayload.cps_eight_x_options = ["Ideal", "8X"]; // [max, min] range
|
|
311
|
+
delete searchPayload.cutGrades;
|
|
312
|
+
delete searchPayload.polishes;
|
|
313
|
+
delete searchPayload.symmetries;
|
|
322
314
|
}
|
|
323
315
|
if (searchPayload?.page_size) {
|
|
324
316
|
delete searchPayload.page_size;
|
|
@@ -500,10 +492,10 @@ export const generateSavedSearchName = (
|
|
|
500
492
|
|
|
501
493
|
// Symmetry
|
|
502
494
|
options.symmetries = [];
|
|
503
|
-
if (search_params?.
|
|
495
|
+
if (search_params?.symmetry_from) {
|
|
504
496
|
options.symmetries.push(search_params?.symmetry_from);
|
|
505
497
|
}
|
|
506
|
-
if (search_params?.
|
|
498
|
+
if (search_params?.symmetry_to) {
|
|
507
499
|
options.symmetries.push(search_params?.symmetry_to);
|
|
508
500
|
}
|
|
509
501
|
if (search_params.symmetries?.length)
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ThemeProvider as OriginalThemeProvider,
|
|
6
6
|
} from "styled-components/native";
|
|
7
7
|
import { useMediaQuery } from "react-responsive";
|
|
8
|
-
import {
|
|
8
|
+
import { DEFAULT_THEME } from "./utils";
|
|
9
9
|
import { DEVICE_SIZE, isIpad } from "../components/utils";
|
|
10
10
|
import { useMemo, useState, useEffect } from "react";
|
|
11
11
|
import { Storage } from "../storage";
|
|
@@ -20,24 +20,12 @@ if (Platform.OS !== "web") {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
// Combine defaultThemeObject and defaultTypography as the base default theme
|
|
24
|
-
const DEFAULT_THEME = {
|
|
25
|
-
...defaultThemeObject,
|
|
26
|
-
typography: defaultTypography,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
23
|
interface Props {
|
|
30
24
|
children?: React.ReactElement;
|
|
31
25
|
}
|
|
32
26
|
|
|
33
27
|
const ThemeProvider = ({ children }: Props) => {
|
|
34
28
|
const [theme, setTheme] = useState<Record<string, any>>(DEFAULT_THEME);
|
|
35
|
-
const [isPrintMedia, setIsPrintMedia] = useState(false);
|
|
36
|
-
|
|
37
|
-
// All hooks must be called before any conditional returns
|
|
38
|
-
const mobileQuery = useMediaQuery({ maxWidth: 767 });
|
|
39
|
-
const tabletQuery = useMediaQuery({ minWidth: 767, maxWidth: 1279 });
|
|
40
|
-
const desktopQuery = useMediaQuery({ minWidth: 1279 });
|
|
41
29
|
|
|
42
30
|
useEffect(() => {
|
|
43
31
|
const loadTheme = async () => {
|
|
@@ -47,10 +35,8 @@ const ThemeProvider = ({ children }: Props) => {
|
|
|
47
35
|
);
|
|
48
36
|
const userTheme = rootState.theme ? JSON.parse(rootState.theme) : null;
|
|
49
37
|
if (userTheme) {
|
|
50
|
-
// Use localStorage theme if available
|
|
51
38
|
setTheme(userTheme);
|
|
52
39
|
}
|
|
53
|
-
// If no userTheme in localStorage, keep DEFAULT_THEME (already set in useState)
|
|
54
40
|
} catch {
|
|
55
41
|
// Keep default theme on error
|
|
56
42
|
}
|
|
@@ -58,19 +44,16 @@ const ThemeProvider = ({ children }: Props) => {
|
|
|
58
44
|
loadTheme();
|
|
59
45
|
}, []);
|
|
60
46
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
setIsPrintMedia(mediaQuery.matches);
|
|
66
|
-
const handler = (e: MediaQueryListEvent) => setIsPrintMedia(e.matches);
|
|
67
|
-
mediaQuery.addEventListener("change", handler);
|
|
68
|
-
return () => mediaQuery.removeEventListener("change", handler);
|
|
69
|
-
} catch {
|
|
70
|
-
// matchMedia not supported
|
|
71
|
-
}
|
|
47
|
+
if (Platform.OS === "web") {
|
|
48
|
+
const mediaQuery = window.matchMedia("print");
|
|
49
|
+
if (mediaQuery.matches) {
|
|
50
|
+
return null;
|
|
72
51
|
}
|
|
73
|
-
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const mobileQuery = useMediaQuery({ maxWidth: 767 });
|
|
55
|
+
const tabletQuery = useMediaQuery({ minWidth: 767, maxWidth: 1279 });
|
|
56
|
+
const desktopQuery = useMediaQuery({ minWidth: 1279 });
|
|
74
57
|
|
|
75
58
|
const { width } = DEVICE_SIZE;
|
|
76
59
|
const isMobile = mobileQuery || width <= 767;
|
|
@@ -96,11 +79,6 @@ const ThemeProvider = ({ children }: Props) => {
|
|
|
96
79
|
[theme, isMobile, isTablet, isDesktop, isLargeScreen]
|
|
97
80
|
);
|
|
98
81
|
|
|
99
|
-
// Handle print media - still provide theme context but hide content
|
|
100
|
-
if (isPrintMedia) {
|
|
101
|
-
return null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
82
|
return (
|
|
105
83
|
<OriginalThemeProvider theme={mediaTheme}>{children}</OriginalThemeProvider>
|
|
106
84
|
);
|
package/src/index.web.tsx
CHANGED
|
@@ -6,30 +6,7 @@ import { AnalyticsClientProvider } from "./contexts/AnalyticsClientContext";
|
|
|
6
6
|
import { ChatWidget } from "./components/ChatWidget";
|
|
7
7
|
import type { ChatTheme } from "./types";
|
|
8
8
|
import { getUserDetails } from "./components/utils";
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
export interface RenderChatAppOptions {
|
|
12
|
-
domElement: HTMLElement;
|
|
13
|
-
apiUrl: string;
|
|
14
|
-
theme?: Partial<ChatTheme>;
|
|
15
|
-
onClose?: () => void;
|
|
16
|
-
onClearChat?: () => void;
|
|
17
|
-
segmentWriteKey?: string;
|
|
18
|
-
onViewAllPress?: (url: string, payload: any) => void;
|
|
19
|
-
onItemPress?: (url: string, item: any) => void;
|
|
20
|
-
isBetaMode?: boolean;
|
|
21
|
-
useAsPlugin?: boolean;
|
|
22
|
-
s3ConfigUrl?: string;
|
|
23
|
-
classic_search_filters?: any;
|
|
24
|
-
userToken?: string;
|
|
25
|
-
priceMode?: string;
|
|
26
|
-
userName?: string;
|
|
27
|
-
activeProductType?: string;
|
|
28
|
-
trackAnalyticsEvent?: (eventName: string, eventData?: any) => void;
|
|
29
|
-
modalHeight?: number;
|
|
30
|
-
locale?: string;
|
|
31
|
-
translations?: Record<string, string>;
|
|
32
|
-
}
|
|
9
|
+
import Routes from "./routes";
|
|
33
10
|
|
|
34
11
|
export function renderChatApp(
|
|
35
12
|
domElement: HTMLElement,
|
|
@@ -42,16 +19,6 @@ export function renderChatApp(
|
|
|
42
19
|
onItemPress?: (url: string, item: any) => void,
|
|
43
20
|
isBetaMode?: boolean,
|
|
44
21
|
classic_search_filters?: any,
|
|
45
|
-
userToken?: string,
|
|
46
|
-
priceMode?: string,
|
|
47
|
-
userName?: string,
|
|
48
|
-
activeProductType?: string,
|
|
49
|
-
trackAnalyticsEvent?: (eventName: string, eventData?: any) => void,
|
|
50
|
-
modalHeight?: number,
|
|
51
|
-
locale?: string,
|
|
52
|
-
translations?: Record<string, string>,
|
|
53
|
-
useAsPlugin?: boolean,
|
|
54
|
-
s3ConfigUrl?: string,
|
|
55
22
|
) {
|
|
56
23
|
const root = createRoot(domElement);
|
|
57
24
|
|
|
@@ -88,32 +55,19 @@ export function renderChatApp(
|
|
|
88
55
|
};
|
|
89
56
|
|
|
90
57
|
// Build base content and render immediately
|
|
91
|
-
// ThemeProvider must wrap ChatWidget since ChatWidget uses useTheme()
|
|
92
58
|
const content = (
|
|
93
|
-
<
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
classic_search_filters={classic_search_filters}
|
|
106
|
-
userToken={userToken}
|
|
107
|
-
priceMode={priceMode}
|
|
108
|
-
userName={userName}
|
|
109
|
-
activeProductType={activeProductType}
|
|
110
|
-
trackAnalyticsEvent={trackAnalyticsEvent}
|
|
111
|
-
modalHeight={modalHeight}
|
|
112
|
-
locale={locale}
|
|
113
|
-
translations={translations}
|
|
114
|
-
/>
|
|
115
|
-
</View>
|
|
116
|
-
</ThemeProvider>
|
|
59
|
+
<View style={styles.root}>
|
|
60
|
+
<ChatWidget
|
|
61
|
+
apiUrl={Routes.AGENCT_CONVERSATIONS(apiUrl)}
|
|
62
|
+
theme={theme}
|
|
63
|
+
onClose={onClose}
|
|
64
|
+
onClearChat={onClearChat}
|
|
65
|
+
onViewAllPress={handleViewAll}
|
|
66
|
+
onItemPress={handleItemPress}
|
|
67
|
+
isBetaMode={isBetaMode}
|
|
68
|
+
classic_search_filters={classic_search_filters}
|
|
69
|
+
/>
|
|
70
|
+
</View>
|
|
117
71
|
);
|
|
118
72
|
root.render(content);
|
|
119
73
|
|
package/src/storage.ts
CHANGED
|
@@ -8,27 +8,17 @@ interface StorageInterface {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
// Helper to safely get localStorage (only available on web)
|
|
11
|
-
// Wrapped in try-catch to handle SecurityError in sandboxed iframes
|
|
12
11
|
function getLocalStorage(): Storage | null {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return window.localStorage;
|
|
16
|
-
}
|
|
17
|
-
} catch {
|
|
18
|
-
// SecurityError can be thrown in sandboxed iframes or cross-origin contexts
|
|
12
|
+
if (typeof window !== "undefined" && window.localStorage) {
|
|
13
|
+
return window.localStorage;
|
|
19
14
|
}
|
|
20
15
|
return null;
|
|
21
16
|
}
|
|
22
17
|
|
|
23
18
|
// Helper to safely get sessionStorage (only available on web)
|
|
24
|
-
// Wrapped in try-catch to handle SecurityError in sandboxed iframes
|
|
25
19
|
function getSessionStorage(): Storage | null {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return window.sessionStorage;
|
|
29
|
-
}
|
|
30
|
-
} catch {
|
|
31
|
-
// SecurityError can be thrown in sandboxed iframes or cross-origin contexts
|
|
20
|
+
if (typeof window !== "undefined" && window.sessionStorage) {
|
|
21
|
+
return window.sessionStorage;
|
|
32
22
|
}
|
|
33
23
|
return null;
|
|
34
24
|
}
|
package/src/theme.ts
CHANGED
|
@@ -19,233 +19,3 @@ export const defaultTheme: ChatTheme = {
|
|
|
19
19
|
export function mergeTheme(overrides?: Partial<ChatTheme>): ChatTheme {
|
|
20
20
|
return { ...defaultTheme, ...(overrides || {}) };
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
export const defaultThemeObject = {
|
|
24
|
-
transparent: "transparent",
|
|
25
|
-
"link-hover": "#292735",
|
|
26
|
-
"link-static": "#3378F6",
|
|
27
|
-
"primary-cont": "#ffffff",
|
|
28
|
-
"tertiary-cont": "#292735",
|
|
29
|
-
"secondary-cont": "#292735",
|
|
30
|
-
"primary-bg-hover": "#37363F",
|
|
31
|
-
"primary-bg-static": "#292735",
|
|
32
|
-
"secondary-bg-hover": "#E3E3E9",
|
|
33
|
-
"tertiary-bg-static": "#E3E3E9",
|
|
34
|
-
"primary-bg-disabled": "#D5D5DC",
|
|
35
|
-
"secondary-bor-hover": "#37363F",
|
|
36
|
-
"secondary-bor-static": "#292735",
|
|
37
|
-
"tertiary-bg-disabled": "#D5D5DC",
|
|
38
|
-
"primary-cont-disabled": "#ACACB3",
|
|
39
|
-
"secondary-bor-disabled": "#D5D5DC",
|
|
40
|
-
"tertiary-cont-disabled": "#ACACB3",
|
|
41
|
-
"secondary-cont-disabled": "#ACACB3",
|
|
42
|
-
"header-cont": "#ffffff",
|
|
43
|
-
"header-btn-cont": "#ffffff",
|
|
44
|
-
"header-bg-static": "#37363F",
|
|
45
|
-
"header-btn-bg-hover": "#37363F",
|
|
46
|
-
"header-btn-bg-active": "#E3E3E9",
|
|
47
|
-
"header-btn-bg-static": "#292735",
|
|
48
|
-
"header-btn-bor-hover": "#292735",
|
|
49
|
-
"header-btn-cont-active": "#292735",
|
|
50
|
-
"knob-bor": "#292735",
|
|
51
|
-
"knob-cont": "#ffffff",
|
|
52
|
-
"option-cont": "#4F4E57",
|
|
53
|
-
"toggle-cont": "#ffffff",
|
|
54
|
-
"toggle-bg-on": "#292735",
|
|
55
|
-
"knob-bg-hover": "#E4E4EC",
|
|
56
|
-
"knob-bg-active": "#292735",
|
|
57
|
-
"knob-bg-static": "#ffffff",
|
|
58
|
-
"option-bg-hover": "#DADAE0",
|
|
59
|
-
"option-bg-active": "#A1A0AB",
|
|
60
|
-
"option-bg-static": "#E4E4EC",
|
|
61
|
-
"toggle-bg-static": "#DADAE0",
|
|
62
|
-
"option-bg-disabled": "#D5D5DC",
|
|
63
|
-
"option-cont-active": "#ffffff",
|
|
64
|
-
"toggle-bg-disabled": "#D5D5DC",
|
|
65
|
-
"knob-bg-disabled-on": "#D5D5DC",
|
|
66
|
-
"knob-bg-disabled-off": "#EDEDF2",
|
|
67
|
-
"option-cont-disabled": "#ACACB3",
|
|
68
|
-
"toggle-cont-disabled": "#EDEDF2",
|
|
69
|
-
"knob-cont-disabled-on": "#ffffff",
|
|
70
|
-
"core-01": "#ffffff",
|
|
71
|
-
"core-02": "#EDEDF2",
|
|
72
|
-
"core-03": "#D5D5DC",
|
|
73
|
-
"core-04": "#ACACB3",
|
|
74
|
-
"core-05": "#020001",
|
|
75
|
-
"core-06": "#4F4E57",
|
|
76
|
-
"main-01": "#292735",
|
|
77
|
-
"main-02": "#37363F",
|
|
78
|
-
"main-03": "#E3E3E9",
|
|
79
|
-
"main-04": "#3378F6",
|
|
80
|
-
"main-05": "#ffffff",
|
|
81
|
-
"main-06": "#292735",
|
|
82
|
-
"extra-01": "#A1A0AB",
|
|
83
|
-
"extra-02": "#292735",
|
|
84
|
-
"extra-03": "#E4E4EC",
|
|
85
|
-
"extra-04": "#DADAE0",
|
|
86
|
-
"extra-05": "#ffffff",
|
|
87
|
-
"extra-06": "#4F4E57",
|
|
88
|
-
"cont-00": "#ffffff",
|
|
89
|
-
"warn-01": "#FFA500",
|
|
90
|
-
"warn-02": "#FFF8DB",
|
|
91
|
-
"error-01": "#D0021B",
|
|
92
|
-
"error-02": "#FFE2E0",
|
|
93
|
-
"success-01": "#00B140",
|
|
94
|
-
"success-02": "#DBFFE4",
|
|
95
|
-
"jewelry-01": "#58B8A5",
|
|
96
|
-
"jewelry-02": "#4CA191",
|
|
97
|
-
"jewelry-03": "#D6F1ED",
|
|
98
|
-
"jewelry-04": "#27AC92",
|
|
99
|
-
"jewelry-05": "#ffffff",
|
|
100
|
-
"jewelry-06": "#27AC92",
|
|
101
|
-
"over-01": "#000000b3",
|
|
102
|
-
"over-02": "rgba(55,54,64,0.3)",
|
|
103
|
-
"over-03": "rgba(255,255,255,0.7)",
|
|
104
|
-
"over-04": "#ffffff",
|
|
105
|
-
"diam-01": "#804195",
|
|
106
|
-
"diam-02": "#713782",
|
|
107
|
-
"diam-03": "#EEE1F3",
|
|
108
|
-
"diam-04": "#9138AE",
|
|
109
|
-
"diam-05": "#ffffff",
|
|
110
|
-
"diam-06": "#9138AE",
|
|
111
|
-
"gem-01": "#3B72CC",
|
|
112
|
-
"gem-02": "#3C62A0",
|
|
113
|
-
"gem-03": "#DCE6F6",
|
|
114
|
-
"gem-04": "#3E76D2",
|
|
115
|
-
"gem-05": "#ffffff",
|
|
116
|
-
"gem-06": "#3E76D2",
|
|
117
|
-
"lab-01": "#E97F5B",
|
|
118
|
-
"lab-02": "#DA704B",
|
|
119
|
-
"lab-03": "#F9E2D9",
|
|
120
|
-
"lab-04": "#E87B56",
|
|
121
|
-
"lab-05": "#ffffff",
|
|
122
|
-
"lab-06": "#E87B56",
|
|
123
|
-
Shadows: {
|
|
124
|
-
Huge: {
|
|
125
|
-
x: "2",
|
|
126
|
-
y: "16",
|
|
127
|
-
blur: "32",
|
|
128
|
-
type: "dropShadow",
|
|
129
|
-
color: "#37364066",
|
|
130
|
-
spread: "-8",
|
|
131
|
-
},
|
|
132
|
-
Gentle: {
|
|
133
|
-
x: "1",
|
|
134
|
-
y: "2",
|
|
135
|
-
blur: "4",
|
|
136
|
-
type: "dropShadow",
|
|
137
|
-
color: "#37364014",
|
|
138
|
-
spread: "-2",
|
|
139
|
-
},
|
|
140
|
-
Normal: {
|
|
141
|
-
x: "2",
|
|
142
|
-
y: "8",
|
|
143
|
-
blur: "24",
|
|
144
|
-
type: "dropShadow",
|
|
145
|
-
color: "#37364042",
|
|
146
|
-
spread: "-6",
|
|
147
|
-
},
|
|
148
|
-
"Bottom-scroll": {
|
|
149
|
-
x: "0",
|
|
150
|
-
y: "-8",
|
|
151
|
-
blur: "24",
|
|
152
|
-
type: "dropShadow",
|
|
153
|
-
color: "#37364029",
|
|
154
|
-
spread: "-8",
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const defaultTypography = {
|
|
160
|
-
"NAV-M": {
|
|
161
|
-
fontSize: 14,
|
|
162
|
-
fontFamily: "Roboto-Medium",
|
|
163
|
-
fontWeight: "500",
|
|
164
|
-
letterSpacing: 1,
|
|
165
|
-
textDecorationLine: "none",
|
|
166
|
-
},
|
|
167
|
-
"NAV-R": {
|
|
168
|
-
fontSize: 14,
|
|
169
|
-
fontFamily: "Roboto-Regular",
|
|
170
|
-
fontWeight: "400",
|
|
171
|
-
letterSpacing: 1,
|
|
172
|
-
textDecorationLine: "none",
|
|
173
|
-
},
|
|
174
|
-
"H1-B": {
|
|
175
|
-
fontSize: 18,
|
|
176
|
-
fontFamily: "Roboto-Bold",
|
|
177
|
-
fontWeight: "700",
|
|
178
|
-
letterSpacing: 0,
|
|
179
|
-
textDecorationLine: "none",
|
|
180
|
-
},
|
|
181
|
-
"H2-M": {
|
|
182
|
-
fontSize: 17,
|
|
183
|
-
fontFamily: "Roboto-Medium",
|
|
184
|
-
fontWeight: "500",
|
|
185
|
-
letterSpacing: 0,
|
|
186
|
-
textDecorationLine: "none",
|
|
187
|
-
},
|
|
188
|
-
"H2-R": {
|
|
189
|
-
fontSize: 17,
|
|
190
|
-
fontFamily: "Roboto-Regular",
|
|
191
|
-
fontWeight: "400",
|
|
192
|
-
letterSpacing: 0,
|
|
193
|
-
textDecorationLine: "none",
|
|
194
|
-
},
|
|
195
|
-
"H3-M": {
|
|
196
|
-
fontSize: 16,
|
|
197
|
-
fontFamily: "Roboto-Medium",
|
|
198
|
-
fontWeight: "500",
|
|
199
|
-
letterSpacing: 0,
|
|
200
|
-
textDecorationLine: "none",
|
|
201
|
-
},
|
|
202
|
-
"H3-R": {
|
|
203
|
-
fontSize: 16,
|
|
204
|
-
fontFamily: "Roboto-Regular",
|
|
205
|
-
fontWeight: "400",
|
|
206
|
-
letterSpacing: 0,
|
|
207
|
-
textDecorationLine: "none",
|
|
208
|
-
},
|
|
209
|
-
"Body-M": {
|
|
210
|
-
fontSize: 14,
|
|
211
|
-
fontFamily: "Roboto-Medium",
|
|
212
|
-
fontWeight: "500",
|
|
213
|
-
letterSpacing: 0,
|
|
214
|
-
textDecorationLine: "none",
|
|
215
|
-
},
|
|
216
|
-
"Body-R": {
|
|
217
|
-
fontSize: 14,
|
|
218
|
-
fontFamily: "Roboto-Regular",
|
|
219
|
-
fontWeight: "400",
|
|
220
|
-
letterSpacing: 0,
|
|
221
|
-
textDecorationLine: "none",
|
|
222
|
-
},
|
|
223
|
-
"Lead-M": {
|
|
224
|
-
fontSize: 21,
|
|
225
|
-
fontFamily: "Roboto-Medium",
|
|
226
|
-
fontWeight: "500",
|
|
227
|
-
letterSpacing: 0,
|
|
228
|
-
textDecorationLine: "none",
|
|
229
|
-
},
|
|
230
|
-
"Large-B": {
|
|
231
|
-
fontSize: 24,
|
|
232
|
-
fontFamily: "Roboto-Medium",
|
|
233
|
-
fontWeight: "500",
|
|
234
|
-
letterSpacing: 0,
|
|
235
|
-
textDecorationLine: "none",
|
|
236
|
-
},
|
|
237
|
-
"Minor-M": {
|
|
238
|
-
fontSize: 13,
|
|
239
|
-
fontFamily: "Roboto-Medium",
|
|
240
|
-
fontWeight: "500",
|
|
241
|
-
letterSpacing: 0,
|
|
242
|
-
textDecorationLine: "none",
|
|
243
|
-
},
|
|
244
|
-
"Minor-R": {
|
|
245
|
-
fontSize: 13,
|
|
246
|
-
fontFamily: "Roboto-Regular",
|
|
247
|
-
fontWeight: "400",
|
|
248
|
-
letterSpacing: 0,
|
|
249
|
-
textDecorationLine: "none",
|
|
250
|
-
},
|
|
251
|
-
};
|
package/src/types.ts
CHANGED
|
@@ -58,10 +58,6 @@ export interface ChatWidgetProps {
|
|
|
58
58
|
onItemPress?: (deepLinkUrl: string, item: any) => void;
|
|
59
59
|
/** When true, shows beta labels and disclaimer. */
|
|
60
60
|
isBetaMode?: boolean;
|
|
61
|
-
/** When true, generates Shopify plugin-compatible URLs for onViewAll and onItemPress. */
|
|
62
|
-
useAsPlugin?: boolean;
|
|
63
|
-
/** Base URL for store configuration files in S3 (used when useAsPlugin is true). */
|
|
64
|
-
s3ConfigUrl?: string;
|
|
65
61
|
activeProductType?: string;
|
|
66
62
|
trackAnalyticsEvent?: (
|
|
67
63
|
eventName: string,
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ButtonContent = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _native = _interopRequireWildcard(require("styled-components/native"));
|
|
10
|
-
var _reactNativeSvg = require("react-native-svg");
|
|
11
|
-
var _reactI18next = require("react-i18next");
|
|
12
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
-
const isWeb = _reactNative.Platform.OS === "web";
|
|
14
|
-
const BUTTON_HEIGHT = 48;
|
|
15
|
-
const BUTTON_WIDTH = isWeb ? 181 : 167;
|
|
16
|
-
const BORDER_WIDTH = 3;
|
|
17
|
-
const ButtonContent = exports.ButtonContent = /*#__PURE__*/(0, _react.memo)(({
|
|
18
|
-
typography
|
|
19
|
-
}) => {
|
|
20
|
-
const theme = (0, _native.useTheme)();
|
|
21
|
-
const {
|
|
22
|
-
t
|
|
23
|
-
} = (0, _reactI18next.useTranslation)();
|
|
24
|
-
return /*#__PURE__*/_react.default.createElement(ButtonContainer, {
|
|
25
|
-
id: "widget"
|
|
26
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.SvgUri, {
|
|
27
|
-
uri: "https://cdn.vdbapp.com/ai/chat-widget/assets/img/VDB_LOGO_WHITE.svg",
|
|
28
|
-
width: 84,
|
|
29
|
-
height: 24
|
|
30
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
31
|
-
style: [styles.text, {
|
|
32
|
-
color: theme["diam-05"]
|
|
33
|
-
}]
|
|
34
|
-
}, t("AI Search")));
|
|
35
|
-
});
|
|
36
|
-
const ButtonContainer = _native.default.View`
|
|
37
|
-
width: ${BUTTON_WIDTH - BORDER_WIDTH * 2}px;
|
|
38
|
-
height: ${BUTTON_HEIGHT - BORDER_WIDTH * 2}px;
|
|
39
|
-
border-radius: ${(BUTTON_HEIGHT - BORDER_WIDTH * 2) / 2}px;
|
|
40
|
-
background-color: ${({
|
|
41
|
-
theme
|
|
42
|
-
}) => theme["main-01"]};
|
|
43
|
-
align-items: center;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
flex-direction: row;
|
|
46
|
-
gap: 2px;
|
|
47
|
-
`;
|
|
48
|
-
const styles = _reactNative.StyleSheet.create({
|
|
49
|
-
text: {
|
|
50
|
-
fontWeight: "500",
|
|
51
|
-
letterSpacing: 0.3
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=ButtonContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_native","_reactNativeSvg","_reactI18next","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","isWeb","Platform","OS","BUTTON_HEIGHT","BUTTON_WIDTH","BORDER_WIDTH","ButtonContent","exports","memo","typography","theme","useTheme","useTranslation","createElement","ButtonContainer","id","SvgUri","uri","width","height","Text","style","styles","text","color","styled","View","StyleSheet","create","fontWeight","letterSpacing"],"sourceRoot":"../../../src","sources":["components/ButtonContent.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,eAAA,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