@snowcone-app/ui 0.10.13 → 0.10.15

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.cts CHANGED
@@ -5604,7 +5604,8 @@ interface PersonalizationProviderProps {
5604
5604
  } | null;
5605
5605
  /**
5606
5606
  * Lazy import for `@snowcone-app/canvas`. Runs in the consumer's webpack context
5607
- * so module resolution works even though this package doesn't depend on canvas.
5607
+ * so module resolution works even though this package doesn't depend on canvas. Called only when `fields` is
5608
+ * non-empty: a product without personalization never loads the canvas.
5608
5609
  *
5609
5610
  * @example `canvasImport={() => import("@snowcone-app/canvas")}`
5610
5611
  */
package/dist/index.d.ts CHANGED
@@ -5604,7 +5604,8 @@ interface PersonalizationProviderProps {
5604
5604
  } | null;
5605
5605
  /**
5606
5606
  * Lazy import for `@snowcone-app/canvas`. Runs in the consumer's webpack context
5607
- * so module resolution works even though this package doesn't depend on canvas.
5607
+ * so module resolution works even though this package doesn't depend on canvas. Called only when `fields` is
5608
+ * non-empty: a product without personalization never loads the canvas.
5608
5609
  *
5609
5610
  * @example `canvasImport={() => import("@snowcone-app/canvas")}`
5610
5611
  */
package/dist/index.js CHANGED
@@ -12732,6 +12732,16 @@ import {
12732
12732
  useMemo as useMemo15,
12733
12733
  memo as memo4
12734
12734
  } from "react";
12735
+
12736
+ // src/composed/carousels/fit.ts
12737
+ function slideFit(_galleryRole) {
12738
+ return "cover";
12739
+ }
12740
+ function zoomFit(galleryRole) {
12741
+ return galleryRole === "size-picture" ? "whole" : "cover";
12742
+ }
12743
+
12744
+ // src/composed/carousels/MobileProductCarousel.tsx
12735
12745
  import { jsx as jsx74, jsxs as jsxs50 } from "react/jsx-runtime";
12736
12746
  function StaticCarouselImage({
12737
12747
  src,
@@ -13331,7 +13341,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
13331
13341
  unavailableText,
13332
13342
  className: "w-full h-full object-cover cursor-pointer pointer-events-none",
13333
13343
  viewportPolicy: true,
13334
- fit: image.galleryRole === "size-picture" ? "whole" : "cover"
13344
+ fit: slideFit(image.galleryRole)
13335
13345
  }
13336
13346
  ) : image.isRealMockup && !currentArtwork ? /* @__PURE__ */ jsx74(LoadingOverlayPrismCandyInline, { visible: true, variant: "light" }) : /* @__PURE__ */ jsx74(
13337
13347
  StaticCarouselImage,
@@ -13416,7 +13426,7 @@ var MobileProductCarousel = memo4(function MobileProductCarousel2({
13416
13426
  alt: img.label,
13417
13427
  naturalWidth: img.naturalWidth,
13418
13428
  naturalHeight: img.naturalHeight,
13419
- ...img.galleryRole === "size-picture" ? { fit: "whole" } : {}
13429
+ ...zoomFit(img.galleryRole) === "whole" ? { fit: "whole" } : {}
13420
13430
  } : null;
13421
13431
  }).filter((img) => img !== null);
13422
13432
  return /* @__PURE__ */ jsx74(
@@ -15187,9 +15197,10 @@ function PersonalizationProvider({
15187
15197
  const [BridgeComponent, setBridgeComponent] = useState46(
15188
15198
  cachedBridgeComponent
15189
15199
  );
15200
+ const hasFields = fields.length > 0;
15190
15201
  useEffect47(() => {
15191
15202
  if (CanvasComponent && BridgeComponent) return;
15192
- if (!canvasImport) return;
15203
+ if (!canvasImport || !hasFields) return;
15193
15204
  if (!canvasLoadPromise) {
15194
15205
  canvasLoadPromise = canvasImport().then((mod) => {
15195
15206
  cachedCanvasComponent = mod.SnowconeCanvas || mod.default;
@@ -15204,7 +15215,7 @@ function PersonalizationProvider({
15204
15215
  setBridgeComponent(() => cachedBridgeComponent);
15205
15216
  }
15206
15217
  });
15207
- }, [CanvasComponent, BridgeComponent, canvasImport]);
15218
+ }, [CanvasComponent, BridgeComponent, canvasImport, hasFields]);
15208
15219
  const realtimeEnabledRef = useRef30(false);
15209
15220
  useEffect47(() => {
15210
15221
  return () => {