@depict-ai/portal-components 2.7.30 → 2.7.31

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
@@ -4,7 +4,7 @@ import { SearchFilter } from "@depict-ai/types/api/SearchResponse";
4
4
  import { Locale } from "@depict-ai/react-ui/locales/latest";
5
5
  import { ReactNode } from "react";
6
6
  import { FeaturedInDisplay } from "@depict-ai/types/api/FeaturedInResponseV3";
7
- export const version = "2.7.30";
7
+ export const version = "2.7.31";
8
8
  type TextOptions = {
9
9
  /** Enabled */
10
10
  enabled: boolean;
package/dist/main.js CHANGED
@@ -20,7 +20,7 @@ $parcel$export(module.exports, "ExpandingSection", () => $2214dc111b9e2866$expor
20
20
  $parcel$export(module.exports, "ReactLookCard", () => $35bab9ff48bfe404$export$48787da2a5568bc);
21
21
  $parcel$export(module.exports, "version", () => $0a017be3a74fcc94$export$83d89fbfd8236492);
22
22
  /*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
23
- const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.30";
23
+ const $0a017be3a74fcc94$export$83d89fbfd8236492 = "2.7.31";
24
24
 
25
25
 
26
26
 
@@ -95,7 +95,8 @@ const $3375ddd88f77967d$var$sizeOrder = [
95
95
  ];
96
96
  const $3375ddd88f77967d$var$ContainsColorSwatchesContext = /*@__PURE__*/ (0, $7jsgb$solidjs.createContext)();
97
97
  let $3375ddd88f77967d$var$colorCanvasContext;
98
- function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOptions_, overrideAspectRatio) {
98
+ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOptions_, // forceIsVisible_ used in Depict portal where we don't have a provider with an IntersectionObserver
99
+ overrideAspectRatio) {
99
100
  const variantDisplays = (0, $7jsgb$solidjs.createMemo)(()=>display()?.variant_displays);
100
101
  const defaultVariantIndex = (0, $7jsgb$solidjs.createMemo)(()=>display()?.variant_index);
101
102
  const [showVariantIndex, setShowVariantIndex] = (0, $7jsgb$solidjs.createSignal)((0, $7jsgb$solidjs.untrack)(defaultVariantIndex));
@@ -214,7 +215,8 @@ function $3375ddd88f77967d$export$f11681c54c860912(display, info, configuredOpti
214
215
  configuredOptions_: configuredOptions_,
215
216
  cardIsHovered_: ()=>showVariantIndex() === display()?.variant_index && cardIsHovered(),
216
217
  aspectRatio_: aspectRatio_,
217
- noHoverSupport_: noHoverSupport_
218
+ noHoverSupport_: noHoverSupport_,
219
+ forceIsVisible_: ()=>configuredOptions_().forceIsVisible_
218
220
  });
219
221
  }
220
222
  }), null);
@@ -629,14 +631,14 @@ function $3375ddd88f77967d$var$setStyleForTextOptions({ style: style }, options)
629
631
  (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(style, "--color", options().color));
630
632
  (0, $7jsgb$solidjs.createEffect)(()=>$3375ddd88f77967d$var$setPropertyIfExists(style, "--background", options().bg_color));
631
633
  }
632
- function $3375ddd88f77967d$var$ImagesAndVideos({ image_urls_: image_urls_, video_: video_, configuredOptions_: configuredOptions_, cardIsHovered_: cardIsHovered_, aspectRatio_: aspectRatio_, noHoverSupport_: noHoverSupport_ }) {
634
+ function $3375ddd88f77967d$var$ImagesAndVideos({ image_urls_: image_urls_, video_: video_, configuredOptions_: configuredOptions_, cardIsHovered_: cardIsHovered_, aspectRatio_: aspectRatio_, noHoverSupport_: noHoverSupport_, forceIsVisible_: forceIsVisible_ }) {
633
635
  const PLPLayout = (0, $7jsgb$depictaiuilatest.usePLPLayout)();
634
636
  const containerClasses = ()=>[
635
637
  "image-video",
636
638
  "border-radius-" + configuredOptions_().image_radius
637
639
  ];
638
640
  const productCardIsVisible = (0, $7jsgb$depictaiuilatest.useProductCardIsVisible)();
639
- const hasBeenVisible = (0, $7jsgb$solidjs.createMemo)((prev)=>prev || productCardIsVisible());
641
+ const hasBeenVisible = (0, $7jsgb$solidjs.createMemo)((prev)=>prev || productCardIsVisible() || forceIsVisible_());
640
642
  const slidable = (0, $7jsgb$solidjs.createMemo)(()=>// Don't make cards swipable inside of sliders (PLP slider or recs slider)
641
643
  !((0, $7jsgb$depictaiuilatest.useSlidableInformation)() || PLPLayout?.()?.startsWith("slider")) && configuredOptions_().image_carousel && // Delay creation of slider until card has been visible. We can't do it until the user interacts with it because it sometimes glitches the hover effect, but initialising the slider takes some time (need to compute if the buttons should be shown, there's a Mutationobserver, etc) so it's good to not initialise all at once (for example when going back)
642
644
  hasBeenVisible());
@@ -767,6 +769,9 @@ function $3375ddd88f77967d$var$ImagesAndVideos({ image_urls_: image_urls_, video
767
769
  },
768
770
  get poster_ () {
769
771
  return video_()?.preview_image_url || image_urls_()?.[0];
772
+ },
773
+ get forceIsVisible_ () {
774
+ return forceIsVisible_();
770
775
  }
771
776
  });
772
777
  }
@@ -880,7 +885,7 @@ function $3375ddd88f77967d$var$Video(props) {
880
885
  (0, $7jsgb$solidjsweb.use)((element)=>{
881
886
  element.disablePictureInPicture = true;
882
887
  (0, $7jsgb$solidjs.createEffect)(()=>{
883
- if (isVisible() && tabIsVisible() && !hiddenInImageCarousel()) element.play().catch((e)=>(0, $7jsgb$depictaiutilisharedlatest.dwarn)("Error playing video", e));
888
+ if ((isVisible() || props.forceIsVisible_) && tabIsVisible() && !hiddenInImageCarousel()) element.play().catch((e)=>(0, $7jsgb$depictaiutilisharedlatest.dwarn)("Error playing video", e));
884
889
  else element.pause();
885
890
  });
886
891
  }, _el$17);
@@ -1098,7 +1103,10 @@ function $70cc6bd7e3f1dd4b$export$d1a48be4967fe67c(react_props) {
1098
1103
  set_on_index_change: ()=>{},
1099
1104
  depictCardsDataset: {},
1100
1105
  formatPrice: (price)=>price && (0, $7jsgb$depictaiutilisharedlatest.standard_price_format)(price)
1101
- }, ()=>props_store?.options || $70cc6bd7e3f1dd4b$export$5c9921af2948d16a);
1106
+ }, ()=>({
1107
+ ...props_store?.options || $70cc6bd7e3f1dd4b$export$5c9921af2948d16a,
1108
+ forceIsVisible_: true
1109
+ }));
1102
1110
  },
1103
1111
  // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1104
1112
  props: structuredClone(react_props),
package/dist/module.js CHANGED
@@ -7,7 +7,7 @@ import {createContext as $2MCgq$createContext, createMemo as $2MCgq$createMemo,
7
7
  import {createPortal as $2MCgq$createPortal} from "react-dom";
8
8
 
9
9
  /*! Depict.ai portal components */ // This is where the actual source of your React stuff should live
10
- const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.30";
10
+ const $91c11b750e80ede3$export$83d89fbfd8236492 = "2.7.31";
11
11
 
12
12
 
13
13
 
@@ -82,7 +82,8 @@ const $29535f590238371c$var$sizeOrder = [
82
82
  ];
83
83
  const $29535f590238371c$var$ContainsColorSwatchesContext = /*@__PURE__*/ (0, $2MCgq$createContext)();
84
84
  let $29535f590238371c$var$colorCanvasContext;
85
- function $29535f590238371c$export$f11681c54c860912(display, info, configuredOptions_, overrideAspectRatio) {
85
+ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOptions_, // forceIsVisible_ used in Depict portal where we don't have a provider with an IntersectionObserver
86
+ overrideAspectRatio) {
86
87
  const variantDisplays = (0, $2MCgq$createMemo)(()=>display()?.variant_displays);
87
88
  const defaultVariantIndex = (0, $2MCgq$createMemo)(()=>display()?.variant_index);
88
89
  const [showVariantIndex, setShowVariantIndex] = (0, $2MCgq$createSignal)((0, $2MCgq$untrack)(defaultVariantIndex));
@@ -201,7 +202,8 @@ function $29535f590238371c$export$f11681c54c860912(display, info, configuredOpti
201
202
  configuredOptions_: configuredOptions_,
202
203
  cardIsHovered_: ()=>showVariantIndex() === display()?.variant_index && cardIsHovered(),
203
204
  aspectRatio_: aspectRatio_,
204
- noHoverSupport_: noHoverSupport_
205
+ noHoverSupport_: noHoverSupport_,
206
+ forceIsVisible_: ()=>configuredOptions_().forceIsVisible_
205
207
  });
206
208
  }
207
209
  }), null);
@@ -616,14 +618,14 @@ function $29535f590238371c$var$setStyleForTextOptions({ style: style }, options)
616
618
  (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(style, "--color", options().color));
617
619
  (0, $2MCgq$createEffect)(()=>$29535f590238371c$var$setPropertyIfExists(style, "--background", options().bg_color));
618
620
  }
619
- function $29535f590238371c$var$ImagesAndVideos({ image_urls_: image_urls_, video_: video_, configuredOptions_: configuredOptions_, cardIsHovered_: cardIsHovered_, aspectRatio_: aspectRatio_, noHoverSupport_: noHoverSupport_ }) {
621
+ function $29535f590238371c$var$ImagesAndVideos({ image_urls_: image_urls_, video_: video_, configuredOptions_: configuredOptions_, cardIsHovered_: cardIsHovered_, aspectRatio_: aspectRatio_, noHoverSupport_: noHoverSupport_, forceIsVisible_: forceIsVisible_ }) {
620
622
  const PLPLayout = (0, $2MCgq$usePLPLayout)();
621
623
  const containerClasses = ()=>[
622
624
  "image-video",
623
625
  "border-radius-" + configuredOptions_().image_radius
624
626
  ];
625
627
  const productCardIsVisible = (0, $2MCgq$useProductCardIsVisible)();
626
- const hasBeenVisible = (0, $2MCgq$createMemo)((prev)=>prev || productCardIsVisible());
628
+ const hasBeenVisible = (0, $2MCgq$createMemo)((prev)=>prev || productCardIsVisible() || forceIsVisible_());
627
629
  const slidable = (0, $2MCgq$createMemo)(()=>// Don't make cards swipable inside of sliders (PLP slider or recs slider)
628
630
  !((0, $2MCgq$useSlidableInformation)() || PLPLayout?.()?.startsWith("slider")) && configuredOptions_().image_carousel && // Delay creation of slider until card has been visible. We can't do it until the user interacts with it because it sometimes glitches the hover effect, but initialising the slider takes some time (need to compute if the buttons should be shown, there's a Mutationobserver, etc) so it's good to not initialise all at once (for example when going back)
629
631
  hasBeenVisible());
@@ -754,6 +756,9 @@ function $29535f590238371c$var$ImagesAndVideos({ image_urls_: image_urls_, video
754
756
  },
755
757
  get poster_ () {
756
758
  return video_()?.preview_image_url || image_urls_()?.[0];
759
+ },
760
+ get forceIsVisible_ () {
761
+ return forceIsVisible_();
757
762
  }
758
763
  });
759
764
  }
@@ -867,7 +872,7 @@ function $29535f590238371c$var$Video(props) {
867
872
  (0, $2MCgq$use)((element)=>{
868
873
  element.disablePictureInPicture = true;
869
874
  (0, $2MCgq$createEffect)(()=>{
870
- if (isVisible() && tabIsVisible() && !hiddenInImageCarousel()) element.play().catch((e)=>(0, $2MCgq$dwarn)("Error playing video", e));
875
+ if ((isVisible() || props.forceIsVisible_) && tabIsVisible() && !hiddenInImageCarousel()) element.play().catch((e)=>(0, $2MCgq$dwarn)("Error playing video", e));
871
876
  else element.pause();
872
877
  });
873
878
  }, _el$17);
@@ -1085,7 +1090,10 @@ function $474e9d712b745d60$export$d1a48be4967fe67c(react_props) {
1085
1090
  set_on_index_change: ()=>{},
1086
1091
  depictCardsDataset: {},
1087
1092
  formatPrice: (price)=>price && (0, $2MCgq$standard_price_format)(price)
1088
- }, ()=>props_store?.options || $474e9d712b745d60$export$5c9921af2948d16a);
1093
+ }, ()=>({
1094
+ ...props_store?.options || $474e9d712b745d60$export$5c9921af2948d16a,
1095
+ forceIsVisible_: true
1096
+ }));
1089
1097
  },
1090
1098
  // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1091
1099
  props: structuredClone(react_props),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depict-ai/portal-components",
3
- "version": "2.7.30",
3
+ "version": "2.7.31",
4
4
  "packageManager": "yarn@3.2.2",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/main.js",
@@ -104,7 +104,7 @@
104
104
  "@depict-ai/plp-styling": "^4.4.20",
105
105
  "@depict-ai/react-ui": "^4.8.7",
106
106
  "@depict-ai/types": "^5.4.5",
107
- "@depict-ai/ui": "^4.8.21",
107
+ "@depict-ai/ui": "^4.8.22",
108
108
  "@depict-ai/utilishared": "^2.4.7",
109
109
  "parcel": "^2.10.3",
110
110
  "solid-js": "^1.8.16"
@@ -134,7 +134,7 @@ export function DefaultSolidProductCard(
134
134
  // In development (product card editor), a fallback formatting will be used.
135
135
  formatPrice: <T extends number | undefined>(price: T) => T extends undefined ? undefined : string;
136
136
  }),
137
- configuredOptions_: Accessor<ProductCardSchema>,
137
+ configuredOptions_: Accessor<ProductCardSchema & { forceIsVisible_?: boolean }>, // forceIsVisible_ used in Depict portal where we don't have a provider with an IntersectionObserver
138
138
  overrideAspectRatio?: Accessor<number>
139
139
  ) {
140
140
  const variantDisplays = createMemo(() => display()?.variant_displays);
@@ -268,6 +268,7 @@ export function DefaultSolidProductCard(
268
268
  cardIsHovered_={() => showVariantIndex() === display()?.variant_index && cardIsHovered()}
269
269
  aspectRatio_={aspectRatio_}
270
270
  noHoverSupport_={noHoverSupport_}
271
+ forceIsVisible_={() => configuredOptions_().forceIsVisible_}
271
272
  />
272
273
  </LinkWrapped>
273
274
 
@@ -679,6 +680,7 @@ function ImagesAndVideos({
679
680
  cardIsHovered_,
680
681
  aspectRatio_,
681
682
  noHoverSupport_,
683
+ forceIsVisible_,
682
684
  }: {
683
685
  image_urls_: Accessor<undefined | string[]>;
684
686
  video_: Accessor<undefined | { preview_image_url: string; video_urls: string[] }>;
@@ -686,11 +688,12 @@ function ImagesAndVideos({
686
688
  cardIsHovered_: Accessor<boolean>;
687
689
  aspectRatio_: Accessor<number>;
688
690
  noHoverSupport_: Accessor<boolean>;
691
+ forceIsVisible_: Accessor<boolean | undefined>;
689
692
  }) {
690
693
  const PLPLayout = usePLPLayout();
691
694
  const containerClasses = () => ["image-video", "border-radius-" + configuredOptions_().image_radius] as const;
692
695
  const productCardIsVisible = useProductCardIsVisible();
693
- const hasBeenVisible = createMemo<boolean | undefined>(prev => prev || productCardIsVisible());
696
+ const hasBeenVisible = createMemo<boolean | undefined>(prev => prev || productCardIsVisible() || forceIsVisible_());
694
697
  const slidable = createMemo(
695
698
  () =>
696
699
  // Don't make cards swipable inside of sliders (PLP slider or recs slider)
@@ -793,6 +796,7 @@ function ImagesAndVideos({
793
796
  <Video
794
797
  video_sources_={video_urls() as [string, ...string[]]}
795
798
  poster_={video_()?.preview_image_url || image_urls_()?.[0]}
799
+ forceIsVisible_={forceIsVisible_()}
796
800
  />
797
801
  </ImageContainer>
798
802
  </div>
@@ -834,7 +838,7 @@ function ImagesAndVideos({
834
838
  );
835
839
  }
836
840
 
837
- function Video(props: { video_sources_: [string, ...string[]]; poster_?: string }) {
841
+ function Video(props: { video_sources_: [string, ...string[]]; poster_?: string; forceIsVisible_?: boolean }) {
838
842
  // Making some assumptions for shopify here rn, change those if wanting to support other browsers too
839
843
 
840
844
  const tabIsVisible = useVisibilityState();
@@ -875,7 +879,7 @@ function Video(props: { video_sources_: [string, ...string[]]; poster_?: string
875
879
  ref={element => {
876
880
  element.disablePictureInPicture = true;
877
881
  createEffect(() => {
878
- if (isVisible() && tabIsVisible() && !hiddenInImageCarousel()) {
882
+ if ((isVisible() || props.forceIsVisible_) && tabIsVisible() && !hiddenInImageCarousel()) {
879
883
  element.play().catch(e => dwarn("Error playing video", e));
880
884
  } else {
881
885
  element.pause();