@snowcone-app/ui 0.10.17 → 0.10.18

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.18
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5680](https://github.com/snowcone-app/snowcone-monorepo/pull/5680) [`792b4f5`](https://github.com/snowcone-app/snowcone-monorepo/commit/792b4f55b2b662906d3aeacf5d246524f2444dd0) Thanks [@kevinsproles](https://github.com/kevinsproles)! - The desktop product-page hero of a plate asks for only the part of its 8:3 strip the window shows. SDK: `getMockupUrl` takes `stripView` (`view=<r>@<f>`, with `aspect: "8:3"` and no width; a crop written as the scene alias `view` throws `E_VIEW_IS_STRIP_VIEW`), re-exports the view grid (`mockupViewFor`, `canonicalMockupView`, `MOCKUP_VIEW_SHAPES`, `MOCKUP_VIEW_PLACES`, `MockupView`), and the catalog product type carries `mockups[].strip` (`{ shape: "8:3", productX }`). UI: `HeroProductImage` takes `stripView` (a crop, or `"whole-strip"`) and `onShown`; `CarouselImage` carries `strip`.
8
+
9
+ - Updated dependencies [[`792b4f5`](https://github.com/snowcone-app/snowcone-monorepo/commit/792b4f55b2b662906d3aeacf5d246524f2444dd0)]:
10
+ - @snowcone-app/sdk@0.31.2
11
+
3
12
  ## 0.10.17
4
13
 
5
14
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -10873,13 +10873,20 @@ function buildHeroMockupUrl(args) {
10873
10873
  return (0, import_sdk11.getMockupUrl)(args.productCode, {
10874
10874
  shop: snow.shop,
10875
10875
  design: publicDesign,
10876
- width: args.width,
10876
+ ..."stripView" in args.size ? { aspect: "8:3", stripView: args.size.stripView } : { width: args.size.width, ...args.size.aspect ? { aspect: args.size.aspect } : {} },
10877
10877
  view: args.mockupId,
10878
10878
  variant: args.variantId,
10879
10879
  ...args.bg ? { bg: args.bg } : {},
10880
10880
  ...snow.resolver ? { base: snow.resolver } : {}
10881
10881
  });
10882
10882
  }
10883
+ function isCrop(stripView) {
10884
+ return stripView !== void 0 && stripView !== "whole-strip";
10885
+ }
10886
+ function heroSize(stripView, width) {
10887
+ if (isCrop(stripView)) return { stripView };
10888
+ return stripView === "whole-strip" ? { width, aspect: "8:3" } : { width };
10889
+ }
10883
10890
  var EMPTY_IMAGES = [];
10884
10891
  var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
10885
10892
  productId,
@@ -10912,7 +10919,9 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
10912
10919
  errorText = "Error loading",
10913
10920
  unavailableText = "Preview unavailable",
10914
10921
  viewportPolicy = false,
10915
- fit = "cover"
10922
+ fit = "cover",
10923
+ stripView,
10924
+ onShown
10916
10925
  }) {
10917
10926
  const context = useProductOptional();
10918
10927
  const designContext = useDesignOptional();
@@ -10949,7 +10958,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
10949
10958
  }
10950
10959
  if (context?.loading) return null;
10951
10960
  if (!effectiveArtworkSrc || effectiveArtworkSrc.trim() === "") return null;
10952
- if (!actualProductId || !actualMockupId || !actualGvid || actualGvid === "default" || !width) return null;
10961
+ if (!actualProductId || !actualMockupId || !actualGvid || actualGvid === "default" || !(isCrop(stripView) || width)) return null;
10953
10962
  const allPlacements = product?.placements || context?.product?.placements || [];
10954
10963
  if (allPlacements.length === 0) return null;
10955
10964
  const placementDesigns = {};
@@ -10974,10 +10983,11 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
10974
10983
  placements: allPlacements,
10975
10984
  mockupId: actualMockupId,
10976
10985
  variantId: actualGvid,
10977
- width,
10986
+ size: heroSize(stripView, width),
10978
10987
  bg: mockupBg
10979
10988
  });
10980
10989
  }, [
10990
+ stripView,
10981
10991
  realtimeUrl,
10982
10992
  mode,
10983
10993
  context?.loading,
@@ -11028,6 +11038,8 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
11028
11038
  const isPendingExportRef = (0, import_react46.useRef)(false);
11029
11039
  const onUrlGeneratedRef = (0, import_react46.useRef)(onUrlGenerated);
11030
11040
  onUrlGeneratedRef.current = onUrlGenerated;
11041
+ const onShownRef = (0, import_react46.useRef)(onShown);
11042
+ onShownRef.current = onShown;
11031
11043
  const layersLengthRef = (0, import_react46.useRef)(layers.length);
11032
11044
  layersLengthRef.current = layers.length;
11033
11045
  (0, import_react46.useEffect)(() => {
@@ -11336,7 +11348,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
11336
11348
  setTargetUrl(null);
11337
11349
  return;
11338
11350
  }
11339
- if (!actualProductId || !actualMockupId || !actualGvid || actualGvid === "default" || !width) {
11351
+ if (!actualProductId || !actualMockupId || !actualGvid || actualGvid === "default" || !(isCrop(stripView) || width)) {
11340
11352
  return;
11341
11353
  }
11342
11354
  const allPlacements = product?.placements || context?.product?.placements || [];
@@ -11350,7 +11362,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
11350
11362
  placements: allPlacements,
11351
11363
  mockupId: actualMockupId,
11352
11364
  variantId: actualGvid,
11353
- width,
11365
+ size: heroSize(stripView, width),
11354
11366
  bg: mockupBg
11355
11367
  });
11356
11368
  if (!url) return;
@@ -11395,6 +11407,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
11395
11407
  mockupBg,
11396
11408
  images,
11397
11409
  width,
11410
+ stripView,
11398
11411
  effects,
11399
11412
  // Use primitive values extracted at the top of the component
11400
11413
  artworkSrc,
@@ -11529,6 +11542,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
11529
11542
  "data-hero-image": "true",
11530
11543
  "data-mockup-id": actualMockupId || void 0,
11531
11544
  "data-fit": fit,
11545
+ "data-strip-view": stripView,
11532
11546
  "data-picture-failed": imgFailed ? "E_PICTURE_UNDISPLAYED" : void 0,
11533
11547
  "data-picture-failed-src": failedSrc,
11534
11548
  "data-mockup-unavailable": unavailable ? unavailable.code : void 0,
@@ -11567,6 +11581,7 @@ var HeroProductImage = (0, import_react46.memo)(function HeroProductImage2({
11567
11581
  onLoad();
11568
11582
  }
11569
11583
  onUrlGeneratedRef.current?.(renderedUrl);
11584
+ if (renderedUrl) onShownRef.current?.(renderedUrl);
11570
11585
  },
11571
11586
  onError: () => {
11572
11587
  if (renderedUrl && retriedUrlRef.current !== renderedUrl) {