@depict-ai/portal-components 2.7.29 → 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.29";
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.29";
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,15 +631,17 @@ 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
- const isAlreadyInSlider = (0, $7jsgb$solidjs.createMemo)(()=>!!((0, $7jsgb$depictaiuilatest.useSlidableInformation)() || PLPLayout?.()?.startsWith("slider")));
635
636
  const containerClasses = ()=>[
636
637
  "image-video",
637
638
  "border-radius-" + configuredOptions_().image_radius
638
639
  ];
639
- // Don't make cards swipable inside of sliders (PLP slider or recs slider)
640
- const slidable = (0, $7jsgb$solidjs.createMemo)(()=>!isAlreadyInSlider() && configuredOptions_().image_carousel);
640
+ const productCardIsVisible = (0, $7jsgb$depictaiuilatest.useProductCardIsVisible)();
641
+ const hasBeenVisible = (0, $7jsgb$solidjs.createMemo)((prev)=>prev || productCardIsVisible() || forceIsVisible_());
642
+ const slidable = (0, $7jsgb$solidjs.createMemo)(()=>// Don't make cards swipable inside of sliders (PLP slider or recs slider)
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)
644
+ hasBeenVisible());
641
645
  const hoverImageDisabled = (0, $7jsgb$solidjs.createMemo)(()=>!configuredOptions_().use_hover_image || noHoverSupport_());
642
646
  const video_urls = ()=>video_()?.video_urls;
643
647
  const [userTriedSliding, setUserTriedSliding] = (0, $7jsgb$solidjs.createSignal)(false);
@@ -658,7 +662,6 @@ function $3375ddd88f77967d$var$ImagesAndVideos({ image_urls_: image_urls_, video
658
662
  get children () {
659
663
  return (()=>{
660
664
  const [userHoveredImage, setUserHoveredImage] = (0, $7jsgb$solidjs.createSignal)(false);
661
- const productCardIsVisible = (0, $7jsgb$depictaiuilatest.useProductCardIsVisible)();
662
665
  const allowPromotingToLayer = (0, $7jsgb$solidjs.createMemo)(()=>{
663
666
  if (noHoverSupport_()) // It's not possible to swipe a container that gets an overflow due to the same touch in iOS safari, but to still not have shit performance (especially when going back) we set overflow: hidden on all images that on product cards that are not within the viewport
664
667
  return productCardIsVisible();
@@ -766,6 +769,9 @@ function $3375ddd88f77967d$var$ImagesAndVideos({ image_urls_: image_urls_, video
766
769
  },
767
770
  get poster_ () {
768
771
  return video_()?.preview_image_url || image_urls_()?.[0];
772
+ },
773
+ get forceIsVisible_ () {
774
+ return forceIsVisible_();
769
775
  }
770
776
  });
771
777
  }
@@ -879,7 +885,7 @@ function $3375ddd88f77967d$var$Video(props) {
879
885
  (0, $7jsgb$solidjsweb.use)((element)=>{
880
886
  element.disablePictureInPicture = true;
881
887
  (0, $7jsgb$solidjs.createEffect)(()=>{
882
- 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));
883
889
  else element.pause();
884
890
  });
885
891
  }, _el$17);
@@ -1097,7 +1103,10 @@ function $70cc6bd7e3f1dd4b$export$d1a48be4967fe67c(react_props) {
1097
1103
  set_on_index_change: ()=>{},
1098
1104
  depictCardsDataset: {},
1099
1105
  formatPrice: (price)=>price && (0, $7jsgb$depictaiutilisharedlatest.standard_price_format)(price)
1100
- }, ()=>props_store?.options || $70cc6bd7e3f1dd4b$export$5c9921af2948d16a);
1106
+ }, ()=>({
1107
+ ...props_store?.options || $70cc6bd7e3f1dd4b$export$5c9921af2948d16a,
1108
+ forceIsVisible_: true
1109
+ }));
1101
1110
  },
1102
1111
  // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1103
1112
  props: structuredClone(react_props),
package/dist/module.js CHANGED
@@ -1,5 +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, media_query_to_accessor as $2MCgq$media_query_to_accessor, TextPlaceholder as $2MCgq$TextPlaceholder, useListing as $2MCgq$useListing, shopifyContainedImageContextSymbol as $2MCgq$shopifyContainedImageContextSymbol, usePLPLayout as $2MCgq$usePLPLayout, useSlidableInformation as $2MCgq$useSlidableInformation, useProductCardIsVisible as $2MCgq$useProductCardIsVisible, SlidableItems as $2MCgq$SlidableItems, ImagePlaceholder as $2MCgq$ImagePlaceholder, ImageContainer as $2MCgq$ImageContainer, ShopifyContainedImage as $2MCgq$ShopifyContainedImage, useVisibilityState as $2MCgq$useVisibilityState, useProductCardIndex as $2MCgq$useProductCardIndex, RecommendationSlider as $2MCgq$RecommendationSlider, accessor_of_object_to_object_with_accessor_values as $2MCgq$accessor_of_object_to_object_with_accessor_values, create_modified_filters as $2MCgq$create_modified_filters, SelectedFilters as $2MCgq$SelectedFilters, FilterBody as $2MCgq$FilterBody, ExpandingDetails as $2MCgq$ExpandingDetails, ListingProvider as $2MCgq$ListingProvider, PseudoRouter as $2MCgq$PseudoRouter, LookCard as $2MCgq$LookCard} from "@depict-ai/ui/latest";
2
+ import {RecommendationGrid as $2MCgq$RecommendationGrid, defaultColsAtSize as $2MCgq$defaultColsAtSize, defaultGridSpacing as $2MCgq$defaultGridSpacing, media_query_to_accessor as $2MCgq$media_query_to_accessor, TextPlaceholder as $2MCgq$TextPlaceholder, useListing as $2MCgq$useListing, shopifyContainedImageContextSymbol as $2MCgq$shopifyContainedImageContextSymbol, usePLPLayout as $2MCgq$usePLPLayout, useProductCardIsVisible as $2MCgq$useProductCardIsVisible, useSlidableInformation as $2MCgq$useSlidableInformation, SlidableItems as $2MCgq$SlidableItems, ImagePlaceholder as $2MCgq$ImagePlaceholder, ImageContainer as $2MCgq$ImageContainer, ShopifyContainedImage as $2MCgq$ShopifyContainedImage, useVisibilityState as $2MCgq$useVisibilityState, useProductCardIndex as $2MCgq$useProductCardIndex, RecommendationSlider as $2MCgq$RecommendationSlider, accessor_of_object_to_object_with_accessor_values as $2MCgq$accessor_of_object_to_object_with_accessor_values, create_modified_filters as $2MCgq$create_modified_filters, SelectedFilters as $2MCgq$SelectedFilters, FilterBody as $2MCgq$FilterBody, ExpandingDetails as $2MCgq$ExpandingDetails, ListingProvider as $2MCgq$ListingProvider, PseudoRouter as $2MCgq$PseudoRouter, LookCard as $2MCgq$LookCard} from "@depict-ai/ui/latest";
3
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";
4
4
  import {useRef as $2MCgq$useRef, useState as $2MCgq$useState, useEffect as $2MCgq$useEffect, createElement as $2MCgq$createElement, Fragment as $2MCgq$Fragment} from "react";
5
5
  import {createStore as $2MCgq$createStore, reconcile as $2MCgq$reconcile} from "solid-js/store";
@@ -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.29";
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,15 +618,17 @@ 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
- const isAlreadyInSlider = (0, $2MCgq$createMemo)(()=>!!((0, $2MCgq$useSlidableInformation)() || PLPLayout?.()?.startsWith("slider")));
622
623
  const containerClasses = ()=>[
623
624
  "image-video",
624
625
  "border-radius-" + configuredOptions_().image_radius
625
626
  ];
626
- // Don't make cards swipable inside of sliders (PLP slider or recs slider)
627
- const slidable = (0, $2MCgq$createMemo)(()=>!isAlreadyInSlider() && configuredOptions_().image_carousel);
627
+ const productCardIsVisible = (0, $2MCgq$useProductCardIsVisible)();
628
+ const hasBeenVisible = (0, $2MCgq$createMemo)((prev)=>prev || productCardIsVisible() || forceIsVisible_());
629
+ const slidable = (0, $2MCgq$createMemo)(()=>// Don't make cards swipable inside of sliders (PLP slider or recs slider)
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)
631
+ hasBeenVisible());
628
632
  const hoverImageDisabled = (0, $2MCgq$createMemo)(()=>!configuredOptions_().use_hover_image || noHoverSupport_());
629
633
  const video_urls = ()=>video_()?.video_urls;
630
634
  const [userTriedSliding, setUserTriedSliding] = (0, $2MCgq$createSignal)(false);
@@ -645,7 +649,6 @@ function $29535f590238371c$var$ImagesAndVideos({ image_urls_: image_urls_, video
645
649
  get children () {
646
650
  return (()=>{
647
651
  const [userHoveredImage, setUserHoveredImage] = (0, $2MCgq$createSignal)(false);
648
- const productCardIsVisible = (0, $2MCgq$useProductCardIsVisible)();
649
652
  const allowPromotingToLayer = (0, $2MCgq$createMemo)(()=>{
650
653
  if (noHoverSupport_()) // It's not possible to swipe a container that gets an overflow due to the same touch in iOS safari, but to still not have shit performance (especially when going back) we set overflow: hidden on all images that on product cards that are not within the viewport
651
654
  return productCardIsVisible();
@@ -753,6 +756,9 @@ function $29535f590238371c$var$ImagesAndVideos({ image_urls_: image_urls_, video
753
756
  },
754
757
  get poster_ () {
755
758
  return video_()?.preview_image_url || image_urls_()?.[0];
759
+ },
760
+ get forceIsVisible_ () {
761
+ return forceIsVisible_();
756
762
  }
757
763
  });
758
764
  }
@@ -866,7 +872,7 @@ function $29535f590238371c$var$Video(props) {
866
872
  (0, $2MCgq$use)((element)=>{
867
873
  element.disablePictureInPicture = true;
868
874
  (0, $2MCgq$createEffect)(()=>{
869
- 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));
870
876
  else element.pause();
871
877
  });
872
878
  }, _el$17);
@@ -1084,7 +1090,10 @@ function $474e9d712b745d60$export$d1a48be4967fe67c(react_props) {
1084
1090
  set_on_index_change: ()=>{},
1085
1091
  depictCardsDataset: {},
1086
1092
  formatPrice: (price)=>price && (0, $2MCgq$standard_price_format)(price)
1087
- }, ()=>props_store?.options || $474e9d712b745d60$export$5c9921af2948d16a);
1093
+ }, ()=>({
1094
+ ...props_store?.options || $474e9d712b745d60$export$5c9921af2948d16a,
1095
+ forceIsVisible_: true
1096
+ }));
1088
1097
  },
1089
1098
  // Work around in case https://github.com/solidjs/solid/issues/2139 potentially arises
1090
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.29",
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,12 +688,20 @@ 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
- const isAlreadyInSlider = createMemo(() => !!(useSlidableInformation() || PLPLayout?.()?.startsWith("slider")));
692
694
  const containerClasses = () => ["image-video", "border-radius-" + configuredOptions_().image_radius] as const;
693
- // Don't make cards swipable inside of sliders (PLP slider or recs slider)
694
- const slidable = createMemo(() => !isAlreadyInSlider() && configuredOptions_().image_carousel);
695
+ const productCardIsVisible = useProductCardIsVisible();
696
+ const hasBeenVisible = createMemo<boolean | undefined>(prev => prev || productCardIsVisible() || forceIsVisible_());
697
+ const slidable = createMemo(
698
+ () =>
699
+ // Don't make cards swipable inside of sliders (PLP slider or recs slider)
700
+ !(useSlidableInformation() || PLPLayout?.()?.startsWith("slider")) &&
701
+ configuredOptions_().image_carousel &&
702
+ // 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)
703
+ hasBeenVisible()
704
+ );
695
705
  const hoverImageDisabled = createMemo(() => !configuredOptions_().use_hover_image || noHoverSupport_());
696
706
  const video_urls = () => video_()?.video_urls;
697
707
  const [userTriedSliding, setUserTriedSliding] = createSignal(false);
@@ -702,7 +712,6 @@ function ImagesAndVideos({
702
712
  <Show when={slidable()} fallback={<div class={containerClasses().join(" ")}>{resolved()}</div>}>
703
713
  {(() => {
704
714
  const [userHoveredImage, setUserHoveredImage] = createSignal(false);
705
- const productCardIsVisible = useProductCardIsVisible();
706
715
  const allowPromotingToLayer = createMemo(() => {
707
716
  if (noHoverSupport_()) {
708
717
  // It's not possible to swipe a container that gets an overflow due to the same touch in iOS safari, but to still not have shit performance (especially when going back) we set overflow: hidden on all images that on product cards that are not within the viewport
@@ -787,6 +796,7 @@ function ImagesAndVideos({
787
796
  <Video
788
797
  video_sources_={video_urls() as [string, ...string[]]}
789
798
  poster_={video_()?.preview_image_url || image_urls_()?.[0]}
799
+ forceIsVisible_={forceIsVisible_()}
790
800
  />
791
801
  </ImageContainer>
792
802
  </div>
@@ -828,7 +838,7 @@ function ImagesAndVideos({
828
838
  );
829
839
  }
830
840
 
831
- function Video(props: { video_sources_: [string, ...string[]]; poster_?: string }) {
841
+ function Video(props: { video_sources_: [string, ...string[]]; poster_?: string; forceIsVisible_?: boolean }) {
832
842
  // Making some assumptions for shopify here rn, change those if wanting to support other browsers too
833
843
 
834
844
  const tabIsVisible = useVisibilityState();
@@ -869,7 +879,7 @@ function Video(props: { video_sources_: [string, ...string[]]; poster_?: string
869
879
  ref={element => {
870
880
  element.disablePictureInPicture = true;
871
881
  createEffect(() => {
872
- if (isVisible() && tabIsVisible() && !hiddenInImageCarousel()) {
882
+ if ((isVisible() || props.forceIsVisible_) && tabIsVisible() && !hiddenInImageCarousel()) {
873
883
  element.play().catch(e => dwarn("Error playing video", e));
874
884
  } else {
875
885
  element.pause();