vdb-ai-chat 1.0.22 → 1.0.24

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.
Files changed (37) hide show
  1. package/dist/chat-widget.js +1 -1
  2. package/lib/commonjs/components/ChatWidget.js +4 -20
  3. package/lib/commonjs/components/ChatWidget.js.map +1 -1
  4. package/lib/commonjs/components/MessageBubble.js +1 -1
  5. package/lib/commonjs/components/MessageBubble.js.map +1 -1
  6. package/lib/commonjs/components/ProductsList.js +2 -0
  7. package/lib/commonjs/components/ProductsList.js.map +1 -1
  8. package/lib/commonjs/components/ProductsListView.js +23 -9
  9. package/lib/commonjs/components/ProductsListView.js.map +1 -1
  10. package/lib/commonjs/components/utils.js +39 -4
  11. package/lib/commonjs/components/utils.js.map +1 -1
  12. package/lib/module/components/ChatWidget.js +4 -20
  13. package/lib/module/components/ChatWidget.js.map +1 -1
  14. package/lib/module/components/MessageBubble.js +1 -1
  15. package/lib/module/components/MessageBubble.js.map +1 -1
  16. package/lib/module/components/ProductsList.js +2 -0
  17. package/lib/module/components/ProductsList.js.map +1 -1
  18. package/lib/module/components/ProductsListView.js +24 -10
  19. package/lib/module/components/ProductsListView.js.map +1 -1
  20. package/lib/module/components/utils.js +35 -2
  21. package/lib/module/components/utils.js.map +1 -1
  22. package/lib/typescript/components/ChatWidget.d.ts.map +1 -1
  23. package/lib/typescript/components/ProductsList.d.ts +1 -0
  24. package/lib/typescript/components/ProductsList.d.ts.map +1 -1
  25. package/lib/typescript/components/ProductsListView.d.ts +1 -0
  26. package/lib/typescript/components/ProductsListView.d.ts.map +1 -1
  27. package/lib/typescript/components/utils.d.ts +13 -3
  28. package/lib/typescript/components/utils.d.ts.map +1 -1
  29. package/lib/typescript/types.d.ts +1 -0
  30. package/lib/typescript/types.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/components/ChatWidget.tsx +3 -12
  33. package/src/components/MessageBubble.tsx +1 -1
  34. package/src/components/ProductsList.tsx +3 -0
  35. package/src/components/ProductsListView.tsx +29 -8
  36. package/src/components/utils.ts +78 -3
  37. package/src/types.ts +1 -0
@@ -166,9 +166,19 @@ export const getDeviceType = (platform?: string) => {
166
166
  export enum AnalyticsEventNames {
167
167
  WIDGET_OPENED = "ai_chat_widget_opened",
168
168
  WIDGET_CLOSED = "ai_chat_widget_closed",
169
- CHAT_CLEARED = "ai_chat_cleared",
170
- PRODUCT_PREVIEW_CLICKED = "ai_product_preview_clicked",
171
- SHOW_ALL_RESULTS_CLICKED = "ai_show_all_results_clicked",
169
+ CHAT_CLEARED = "ai_chat_cleared"
170
+ }
171
+
172
+ export enum AIEventNames {
173
+ AI_CHAT_WIDGET = "ai_chat_widget",
174
+ }
175
+
176
+ export enum AIEventTypes {
177
+ WIDGET_OPENED = "widget_opened",
178
+ WIDGET_CLOSED = "widget_closed",
179
+ CHAT_CLEARED = "chat_cleared",
180
+ PRODUCT_PREVIEW_CLICKED = "product_preview_clicked",
181
+ SHOW_ALL_RESULTS_CLICKED = "show_all_results_clicked",
172
182
  }
173
183
 
174
184
  export const isIpad = () => {
@@ -1006,3 +1016,68 @@ export const getStyleForCategory = (
1006
1016
  hover: "primary-bg-hover",
1007
1017
  };
1008
1018
  };
1019
+
1020
+ export const isInvalidFancyColorOvertone = (
1021
+ fancyColorOvertoneLong?: string
1022
+ ) => {
1023
+ const invalidFancyColorOvertoneArray = ["Champagne", "Cognac", "Chameleon"];
1024
+ if (fancyColorOvertoneLong) {
1025
+ return invalidFancyColorOvertoneArray.includes(fancyColorOvertoneLong);
1026
+ }
1027
+ };
1028
+
1029
+
1030
+ export const colorStringForShort = (isShort: boolean, itemDetail?: any) => {
1031
+ let colorString = null;
1032
+
1033
+ if (isShort) {
1034
+ if (isInvalidFancyColorOvertone(itemDetail?.fancy_color_overtone_long)) {
1035
+ colorString = itemDetail?.is_fancy
1036
+ ? `${
1037
+ itemDetail?.fancy_color_intensity_short || itemDetail?.color || ""
1038
+ } ${itemDetail?.fancy_color_short || ""}(${
1039
+ itemDetail?.fancy_color_overtone_long || ""
1040
+ })`
1041
+ : `${itemDetail?.fancy_color_long || itemDetail?.color || ""}`;
1042
+ } else {
1043
+ colorString = itemDetail?.is_fancy
1044
+ ? `${
1045
+ itemDetail?.fancy_color_intensity_short ||
1046
+ itemDetail?.fancy_color_intensity ||
1047
+ ""
1048
+ } ${itemDetail?.fancy_color_overtone_short || ""}${
1049
+ itemDetail?.fancy_color_short || ""
1050
+ }`
1051
+ : `${itemDetail?.fancy_color_long || itemDetail?.color || ""}`;
1052
+ }
1053
+ } else {
1054
+ if (isInvalidFancyColorOvertone(itemDetail?.fancy_color_overtone_long)) {
1055
+ colorString = itemDetail?.is_fancy
1056
+ ? [
1057
+ itemDetail?.fancy_color_intensity_long ||
1058
+ itemDetail?.fancy_color_intensity,
1059
+ itemDetail?.fancy_color_long,
1060
+ itemDetail?.fancy_color_overtone_long
1061
+ ? `(${itemDetail.fancy_color_overtone_long})`
1062
+ : null,
1063
+ ]
1064
+ .filter(Boolean)
1065
+ .join(" ")
1066
+ : itemDetail?.fancy_color_long || itemDetail?.color || "";
1067
+ } else {
1068
+ colorString = itemDetail?.is_fancy
1069
+ ? [
1070
+ itemDetail?.fancy_color_intensity_long ||
1071
+ itemDetail?.fancy_color_intensity,
1072
+ itemDetail?.fancy_color_overtone_long,
1073
+ itemDetail?.fancy_color_long,
1074
+ ]
1075
+ .filter(Boolean)
1076
+ .join(" ")
1077
+ : itemDetail?.fancy_color_long || itemDetail?.color || "";
1078
+ }
1079
+ }
1080
+
1081
+ return colorString === "" ? "-" : colorString;
1082
+ };
1083
+
package/src/types.ts CHANGED
@@ -50,6 +50,7 @@ export interface ChatWidgetProps {
50
50
  /** When true, shows beta labels and disclaimer. */
51
51
  isBetaMode?: boolean;
52
52
  activeProductType?: string;
53
+ trackAnalyticsEvent?: (eventName: string, eventData: Record<string, any>) => void;
53
54
  }
54
55
 
55
56
  export interface ChatWidgetRef {