@depict-ai/portal-components 2.7.18 → 2.7.20

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/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
+ import { ModernDisplay } from "@depict-ai/utilishared";
2
+ import { BaseProductListingConfig } from "@depict-ai/ui";
1
3
  import { ModernDisplayWithPageUrl } from "@depict-ai/ui/latest";
2
4
  import { SearchFilter } from "@depict-ai/types/api/SearchResponse";
3
5
  import { Locale } from "@depict-ai/react-ui/locales/latest";
4
6
  import { ReactNode } from "react";
5
7
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
6
- export const version = "2.7.18";
8
+ export const version = "2.7.19";
7
9
  type TextOptions = {
8
10
  /** Enabled */
9
11
  enabled: boolean;
@@ -43,6 +45,40 @@ type ProductCardSchema = {
43
45
  image_carousel: boolean;
44
46
  image_aspect_ratio: number;
45
47
  };
48
+ interface PortalRecsConfig<T extends ModernDisplay> extends BaseProductListingConfig {
49
+ /**
50
+ * A promise containing the recommendations to render, see https://docs.depict.ai/api-guide/recommendations/api-client/fetching
51
+ */
52
+ recommendations: Promise<T[]>;
53
+ /**
54
+ * Title to show when recommendations are being shown
55
+ */
56
+ title?: string;
57
+ /**
58
+ * Config to use for the product card
59
+ */
60
+ productCardConfig: ProductCardSchema;
61
+ }
62
+ interface PortalRecommendationGridConfig<T extends ModernDisplay> extends PortalRecsConfig<T> {
63
+ maxRows?: number;
64
+ viewMoreButton?: {
65
+ text: string;
66
+ startRows?: number;
67
+ rowsPerClick?: number;
68
+ };
69
+ }
70
+ /**
71
+ * Copy-pasted RecommendationGrid from react-ui that's hardcoded to render the default product card
72
+ * By not wrapping the default product card in a react component again we get working placeholder (react's rendering delay otherwise makes them not show sometimes) and working <ListingContext> and therefore videos, correctly dosed sizes. etc
73
+ */
74
+ export function PortalRecsGrid<T extends ModernDisplay>(props: Parameters<typeof SolidWrapper<T>>[0]): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
75
+ declare function SolidWrapper<T extends ModernDisplay>(props: PortalRecommendationGridConfig<T>): HTMLDivElement;
76
+ /**
77
+ * Copy-pasted RecommendationGrid from react-ui that's hardcoded to render the default product card
78
+ * By not wrapping the default product card in a react component again we get working placeholder (react's rendering delay otherwise makes them not show sometimes) and working <ListingContext> and therefore videos, correctly dosed sizes. etc
79
+ */
80
+ export function PortalRecsSlider<T extends ModernDisplay>(props: Parameters<typeof _SolidWrapper1<T>>[0]): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
81
+ declare function _SolidWrapper1<T extends ModernDisplay>(props: PortalRecsConfig<T>): HTMLDivElement;
46
82
  export function ReactDefaultProductCard(react_props: {
47
83
  options?: ProductCardSchema;
48
84
  display: null | ModernDisplayWithPageUrl<any>;
package/dist/main.js CHANGED
@@ -1,4 +1,5 @@
1
1
  var $7jsgb$depictaiutilisharedlatest = require("@depict-ai/utilishared/latest");
2
+ var $7jsgb$depictaiui = require("@depict-ai/ui");
2
3
  var $7jsgb$solidjsweb = require("solid-js/web");
3
4
  var $7jsgb$react = require("react");
4
5
  var $7jsgb$solidjsstore = require("solid-js/store");
@@ -11,6 +12,8 @@ function $parcel$export(e, n, v, s) {
11
12
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
12
13
  }
13
14
 
15
+ $parcel$export(module.exports, "PortalRecsGrid", () => $9b4cfecb283dbb57$export$d20a7e68f6a71456);
16
+ $parcel$export(module.exports, "PortalRecsSlider", () => $1113a95ded76fc38$export$a640309a759938e9);
14
17
  $parcel$export(module.exports, "ReactDefaultProductCard", () => $70cc6bd7e3f1dd4b$export$d1a48be4967fe67c);
15
18
  $parcel$export(module.exports, "ReactSelectedFilters", () => $19e9e02e1e300b6d$export$aea1707d7b01c3a2);
16
19
  $parcel$export(module.exports, "ReactFilterBody", () => $240090d16a629bfe$export$d929db7fb6179159);
@@ -18,7 +21,8 @@ $parcel$export(module.exports, "ExpandingSection", () => $2214dc111b9e2866$expor
18
21
  $parcel$export(module.exports, "ReactLookCard", () => $35bab9ff48bfe404$export$48787da2a5568bc);
19
22
  $parcel$export(module.exports, "version", () => $0a017be3a74fcc94$export$83d89fbfd8236492);
20
23
  /*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
21
- const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.18";
24
+ const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.20";
25
+
22
26
 
23
27
 
24
28
 
@@ -1015,6 +1019,9 @@ function $3375ddd88f77967d$var$InComponentOrDiv(props) {
1015
1019
 
1016
1020
 
1017
1021
 
1022
+
1023
+
1024
+
1018
1025
  function $70cc6bd7e3f1dd4b$export$d1a48be4967fe67c(react_props) {
1019
1026
  return (0, $d38f1fd3cc4cd6b2$export$f6e64e17bd69eeef)({
1020
1027
  solid_component: (props_store)=>{
@@ -1022,51 +1029,132 @@ function $70cc6bd7e3f1dd4b$export$d1a48be4967fe67c(react_props) {
1022
1029
  set_on_index_change: ()=>{},
1023
1030
  depictCardsDataset: {},
1024
1031
  formatPrice: (price)=>price && (0, $7jsgb$depictaiutilisharedlatest.standard_price_format)(price)
1025
- }, ()=>props_store?.options || {
1026
- image_radius: "md",
1027
- alignment: "left",
1028
- sizes: true,
1029
- smart_labels: {
1030
- font_size_rem: 1,
1031
- enabled: true,
1032
- bold: false,
1033
- italic: false,
1034
- color: "#0f0f0f"
1035
- },
1036
- title: {
1037
- font_size_rem: 1,
1038
- enabled: true,
1039
- bold: false,
1040
- italic: false,
1041
- color: "#0f0f0f"
1042
- },
1043
- price: {
1044
- font_size_rem: 1,
1045
- enabled: true,
1046
- bold: false,
1047
- italic: false,
1048
- color: "#0f0f0f"
1049
- },
1050
- original_price: {
1051
- font_size_rem: 1,
1052
- enabled: true,
1053
- bold: false,
1054
- italic: false,
1055
- color: "#0f0f0f"
1056
- },
1057
- use_hover_image: true,
1058
- image_carousel: true,
1059
- color_options: true,
1060
- image_aspect_ratio: 1,
1061
- underline_text: false,
1062
- is_ejected: false
1063
- });
1032
+ }, ()=>props_store?.options || $70cc6bd7e3f1dd4b$export$5c9921af2948d16a);
1064
1033
  },
1065
1034
  // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1066
1035
  props: structuredClone(react_props),
1067
1036
  className: "depict"
1068
1037
  });
1069
1038
  }
1039
+ const $70cc6bd7e3f1dd4b$export$5c9921af2948d16a = {
1040
+ image_radius: "md",
1041
+ alignment: "left",
1042
+ sizes: true,
1043
+ smart_labels: {
1044
+ font_size_rem: 1,
1045
+ enabled: true,
1046
+ bold: false,
1047
+ italic: false,
1048
+ color: "#0f0f0f"
1049
+ },
1050
+ title: {
1051
+ font_size_rem: 1,
1052
+ enabled: true,
1053
+ bold: false,
1054
+ italic: false,
1055
+ color: "#0f0f0f"
1056
+ },
1057
+ price: {
1058
+ font_size_rem: 1,
1059
+ enabled: true,
1060
+ bold: false,
1061
+ italic: false,
1062
+ color: "#0f0f0f"
1063
+ },
1064
+ original_price: {
1065
+ font_size_rem: 1,
1066
+ enabled: true,
1067
+ bold: false,
1068
+ italic: false,
1069
+ color: "#0f0f0f"
1070
+ },
1071
+ use_hover_image: true,
1072
+ image_carousel: true,
1073
+ color_options: true,
1074
+ image_aspect_ratio: 1,
1075
+ is_ejected: false
1076
+ };
1077
+
1078
+
1079
+ function $9b4cfecb283dbb57$export$d20a7e68f6a71456(props) {
1080
+ return (0, $d38f1fd3cc4cd6b2$export$f6e64e17bd69eeef)({
1081
+ solid_component: $9b4cfecb283dbb57$export$ef681ece395f74,
1082
+ props: props,
1083
+ wrapper_type: "section"
1084
+ });
1085
+ }
1086
+ function $9b4cfecb283dbb57$export$ef681ece395f74(props) {
1087
+ return (0, $7jsgb$depictaiui.RecommendationGrid)({
1088
+ get recommendations () {
1089
+ return props.recommendations;
1090
+ },
1091
+ product_card_template: (display, info)=>{
1092
+ return (0, $3375ddd88f77967d$export$f11681c54c860912)(()=>display, info && {
1093
+ ...info,
1094
+ depictCardsDataset: {},
1095
+ formatPrice: (price)=>price && (0, $7jsgb$depictaiutilisharedlatest.standard_price_format)(price)
1096
+ }, ()=>props.productCardConfig || (0, $70cc6bd7e3f1dd4b$export$5c9921af2948d16a));
1097
+ },
1098
+ get cols_at_size () {
1099
+ return props.columnsAtSize || (0, $7jsgb$depictaiui.defaultColsAtSize);
1100
+ },
1101
+ get grid_spacing () {
1102
+ return props.gridSpacing ?? (0, $7jsgb$depictaiui.defaultGridSpacing);
1103
+ },
1104
+ get max_rows () {
1105
+ return props.maxRows;
1106
+ },
1107
+ get title () {
1108
+ return props.title;
1109
+ },
1110
+ get view_more_button () {
1111
+ const { viewMoreButton: viewMoreButton } = props;
1112
+ return viewMoreButton ? {
1113
+ text: viewMoreButton.text,
1114
+ start_rows: viewMoreButton.startRows ?? 2,
1115
+ rows_per_click: viewMoreButton.rowsPerClick
1116
+ } : undefined;
1117
+ }
1118
+ });
1119
+ }
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+ function $1113a95ded76fc38$export$a640309a759938e9(props) {
1128
+ return (0, $d38f1fd3cc4cd6b2$export$f6e64e17bd69eeef)({
1129
+ solid_component: $1113a95ded76fc38$var$SolidWrapper,
1130
+ props: props,
1131
+ wrapper_type: "section"
1132
+ });
1133
+ }
1134
+ function $1113a95ded76fc38$var$SolidWrapper(props) {
1135
+ return (0, $7jsgb$depictaiui.RecommendationSlider)({
1136
+ get recommendations () {
1137
+ return props.recommendations;
1138
+ },
1139
+ product_card_template: (display, info)=>{
1140
+ return (0, $3375ddd88f77967d$export$f11681c54c860912)(()=>display, info && {
1141
+ ...info,
1142
+ depictCardsDataset: {},
1143
+ formatPrice: (price)=>price && (0, $7jsgb$depictaiutilisharedlatest.standard_price_format)(price)
1144
+ }, ()=>props.productCardConfig || (0, $70cc6bd7e3f1dd4b$export$5c9921af2948d16a));
1145
+ },
1146
+ get cols_at_size () {
1147
+ return props.columnsAtSize || (0, $7jsgb$depictaiui.defaultColsAtSize);
1148
+ },
1149
+ get grid_spacing () {
1150
+ return props.gridSpacing ?? (0, $7jsgb$depictaiui.defaultGridSpacing);
1151
+ },
1152
+ get title () {
1153
+ return props.title;
1154
+ }
1155
+ });
1156
+ }
1157
+
1070
1158
 
1071
1159
 
1072
1160
 
package/dist/module.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import {add_to_version_info as $2MCgq$add_to_version_info, standard_price_format as $2MCgq$standard_price_format, catchify as $2MCgq$catchify, dlog as $2MCgq$dlog, dwarn as $2MCgq$dwarn} from "@depict-ai/utilishared/latest";
2
+ import {RecommendationGrid as $2MCgq$RecommendationGrid, defaultColsAtSize as $2MCgq$defaultColsAtSize, defaultGridSpacing as $2MCgq$defaultGridSpacing, RecommendationSlider as $2MCgq$RecommendationSlider} from "@depict-ai/ui";
2
3
  import {render as $2MCgq$render, template as $2MCgq$template, createComponent as $2MCgq$createComponent, addEventListener as $2MCgq$addEventListener, use as $2MCgq$use, insert as $2MCgq$insert, effect as $2MCgq$effect, className as $2MCgq$className, setAttribute as $2MCgq$setAttribute, memo as $2MCgq$memo, style as $2MCgq$style, classList as $2MCgq$classList, spread as $2MCgq$spread, mergeProps as $2MCgq$mergeProps, delegateEvents as $2MCgq$delegateEvents} from "solid-js/web";
3
4
  import {useRef as $2MCgq$useRef, useState as $2MCgq$useState, useEffect as $2MCgq$useEffect, createElement as $2MCgq$createElement, Fragment as $2MCgq$Fragment} from "react";
4
5
  import {createStore as $2MCgq$createStore, reconcile as $2MCgq$reconcile} from "solid-js/store";
@@ -7,7 +8,8 @@ import {createContext as $2MCgq$createContext, createMemo as $2MCgq$createMemo,
7
8
  import {createPortal as $2MCgq$createPortal} from "react-dom";
8
9
 
9
10
  /*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
10
- const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.18";
11
+ const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.20";
12
+
11
13
 
12
14
 
13
15
 
@@ -1004,6 +1006,9 @@ function $29535f590238371c$var$InComponentOrDiv(props) {
1004
1006
 
1005
1007
 
1006
1008
 
1009
+
1010
+
1011
+
1007
1012
  function $474e9d712b745d60$export$d1a48be4967fe67c(react_props) {
1008
1013
  return (0, $0fe03f2fcd2418f8$export$f6e64e17bd69eeef)({
1009
1014
  solid_component: (props_store)=>{
@@ -1011,51 +1016,132 @@ function $474e9d712b745d60$export$d1a48be4967fe67c(react_props) {
1011
1016
  set_on_index_change: ()=>{},
1012
1017
  depictCardsDataset: {},
1013
1018
  formatPrice: (price)=>price && (0, $2MCgq$standard_price_format)(price)
1014
- }, ()=>props_store?.options || {
1015
- image_radius: "md",
1016
- alignment: "left",
1017
- sizes: true,
1018
- smart_labels: {
1019
- font_size_rem: 1,
1020
- enabled: true,
1021
- bold: false,
1022
- italic: false,
1023
- color: "#0f0f0f"
1024
- },
1025
- title: {
1026
- font_size_rem: 1,
1027
- enabled: true,
1028
- bold: false,
1029
- italic: false,
1030
- color: "#0f0f0f"
1031
- },
1032
- price: {
1033
- font_size_rem: 1,
1034
- enabled: true,
1035
- bold: false,
1036
- italic: false,
1037
- color: "#0f0f0f"
1038
- },
1039
- original_price: {
1040
- font_size_rem: 1,
1041
- enabled: true,
1042
- bold: false,
1043
- italic: false,
1044
- color: "#0f0f0f"
1045
- },
1046
- use_hover_image: true,
1047
- image_carousel: true,
1048
- color_options: true,
1049
- image_aspect_ratio: 1,
1050
- underline_text: false,
1051
- is_ejected: false
1052
- });
1019
+ }, ()=>props_store?.options || $474e9d712b745d60$export$5c9921af2948d16a);
1053
1020
  },
1054
1021
  // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1055
1022
  props: structuredClone(react_props),
1056
1023
  className: "depict"
1057
1024
  });
1058
1025
  }
1026
+ const $474e9d712b745d60$export$5c9921af2948d16a = {
1027
+ image_radius: "md",
1028
+ alignment: "left",
1029
+ sizes: true,
1030
+ smart_labels: {
1031
+ font_size_rem: 1,
1032
+ enabled: true,
1033
+ bold: false,
1034
+ italic: false,
1035
+ color: "#0f0f0f"
1036
+ },
1037
+ title: {
1038
+ font_size_rem: 1,
1039
+ enabled: true,
1040
+ bold: false,
1041
+ italic: false,
1042
+ color: "#0f0f0f"
1043
+ },
1044
+ price: {
1045
+ font_size_rem: 1,
1046
+ enabled: true,
1047
+ bold: false,
1048
+ italic: false,
1049
+ color: "#0f0f0f"
1050
+ },
1051
+ original_price: {
1052
+ font_size_rem: 1,
1053
+ enabled: true,
1054
+ bold: false,
1055
+ italic: false,
1056
+ color: "#0f0f0f"
1057
+ },
1058
+ use_hover_image: true,
1059
+ image_carousel: true,
1060
+ color_options: true,
1061
+ image_aspect_ratio: 1,
1062
+ is_ejected: false
1063
+ };
1064
+
1065
+
1066
+ function $8ade1943efc108c6$export$d20a7e68f6a71456(props) {
1067
+ return (0, $0fe03f2fcd2418f8$export$f6e64e17bd69eeef)({
1068
+ solid_component: $8ade1943efc108c6$export$ef681ece395f74,
1069
+ props: props,
1070
+ wrapper_type: "section"
1071
+ });
1072
+ }
1073
+ function $8ade1943efc108c6$export$ef681ece395f74(props) {
1074
+ return (0, $2MCgq$RecommendationGrid)({
1075
+ get recommendations () {
1076
+ return props.recommendations;
1077
+ },
1078
+ product_card_template: (display, info)=>{
1079
+ return (0, $29535f590238371c$export$f11681c54c860912)(()=>display, info && {
1080
+ ...info,
1081
+ depictCardsDataset: {},
1082
+ formatPrice: (price)=>price && (0, $2MCgq$standard_price_format)(price)
1083
+ }, ()=>props.productCardConfig || (0, $474e9d712b745d60$export$5c9921af2948d16a));
1084
+ },
1085
+ get cols_at_size () {
1086
+ return props.columnsAtSize || (0, $2MCgq$defaultColsAtSize);
1087
+ },
1088
+ get grid_spacing () {
1089
+ return props.gridSpacing ?? (0, $2MCgq$defaultGridSpacing);
1090
+ },
1091
+ get max_rows () {
1092
+ return props.maxRows;
1093
+ },
1094
+ get title () {
1095
+ return props.title;
1096
+ },
1097
+ get view_more_button () {
1098
+ const { viewMoreButton: viewMoreButton } = props;
1099
+ return viewMoreButton ? {
1100
+ text: viewMoreButton.text,
1101
+ start_rows: viewMoreButton.startRows ?? 2,
1102
+ rows_per_click: viewMoreButton.rowsPerClick
1103
+ } : undefined;
1104
+ }
1105
+ });
1106
+ }
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+ function $e3716493302f533c$export$a640309a759938e9(props) {
1115
+ return (0, $0fe03f2fcd2418f8$export$f6e64e17bd69eeef)({
1116
+ solid_component: $e3716493302f533c$var$SolidWrapper,
1117
+ props: props,
1118
+ wrapper_type: "section"
1119
+ });
1120
+ }
1121
+ function $e3716493302f533c$var$SolidWrapper(props) {
1122
+ return (0, $2MCgq$RecommendationSlider)({
1123
+ get recommendations () {
1124
+ return props.recommendations;
1125
+ },
1126
+ product_card_template: (display, info)=>{
1127
+ return (0, $29535f590238371c$export$f11681c54c860912)(()=>display, info && {
1128
+ ...info,
1129
+ depictCardsDataset: {},
1130
+ formatPrice: (price)=>price && (0, $2MCgq$standard_price_format)(price)
1131
+ }, ()=>props.productCardConfig || (0, $474e9d712b745d60$export$5c9921af2948d16a));
1132
+ },
1133
+ get cols_at_size () {
1134
+ return props.columnsAtSize || (0, $2MCgq$defaultColsAtSize);
1135
+ },
1136
+ get grid_spacing () {
1137
+ return props.gridSpacing ?? (0, $2MCgq$defaultGridSpacing);
1138
+ },
1139
+ get title () {
1140
+ return props.title;
1141
+ }
1142
+ });
1143
+ }
1144
+
1059
1145
 
1060
1146
 
1061
1147
 
@@ -1245,4 +1331,4 @@ function $8a700ff0722c56b3$export$48787da2a5568bc(react_props) {
1245
1331
  (0, $2MCgq$add_to_version_info)("react-ui", (0, $91c11b750e80ede3$export$83d89fbfd8236492));
1246
1332
 
1247
1333
 
1248
- export {$474e9d712b745d60$export$d1a48be4967fe67c as ReactDefaultProductCard, $0cb1638b3c084153$export$aea1707d7b01c3a2 as ReactSelectedFilters, $890b58a81f64b470$export$d929db7fb6179159 as ReactFilterBody, $c79c5cb5e9424dd7$export$4ea53cd12ff17334 as ExpandingSection, $8a700ff0722c56b3$export$48787da2a5568bc as ReactLookCard, $91c11b750e80ede3$export$83d89fbfd8236492 as version};
1334
+ export {$8ade1943efc108c6$export$d20a7e68f6a71456 as PortalRecsGrid, $e3716493302f533c$export$a640309a759938e9 as PortalRecsSlider, $474e9d712b745d60$export$d1a48be4967fe67c as ReactDefaultProductCard, $0cb1638b3c084153$export$aea1707d7b01c3a2 as ReactSelectedFilters, $890b58a81f64b470$export$d929db7fb6179159 as ReactFilterBody, $c79c5cb5e9424dd7$export$4ea53cd12ff17334 as ExpandingSection, $8a700ff0722c56b3$export$48787da2a5568bc as ReactLookCard, $91c11b750e80ede3$export$83d89fbfd8236492 as version};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/portal-components",
3
- "version": "2.7.18",
3
+ "version": "2.7.20",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",
@@ -101,7 +101,7 @@
101
101
  "dependencies": {
102
102
  "@babel/runtime": "latest",
103
103
  "@babel/runtime-corejs3": "^7.22.6",
104
- "@depict-ai/plp-styling": "^4.4.17",
104
+ "@depict-ai/plp-styling": "^4.4.18",
105
105
  "@depict-ai/react-ui": "^4.8.6",
106
106
  "@depict-ai/types": "^5.4.4",
107
107
  "@depict-ai/ui": "^4.8.16",
@@ -79,6 +79,7 @@ export type ProductCardSchema = {
79
79
  /** Image Carousel */
80
80
  image_carousel: boolean;
81
81
  image_aspect_ratio: number;
82
+ is_ejected: boolean;
82
83
  };
83
84
 
84
85
  const sizeOrder = [