@snowcone-app/ui 0.9.0 → 0.9.1

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
@@ -1510,7 +1510,7 @@ interface UseProductGalleryReturn {
1510
1510
  * ```tsx
1511
1511
  * // Fetch specific products
1512
1512
  * const { products, loading, error, refetch } = useProductGallery(
1513
- * ['BEEB77', 'AR2P3G'],
1513
+ * ['BEEB77', 'CAXHQC'],
1514
1514
  * { endpoint: 'http://localhost:3000', mode: 'mock' }
1515
1515
  * );
1516
1516
  *
@@ -1599,7 +1599,7 @@ interface ProductGalleryProps extends UseProductGalleryOptions {
1599
1599
  * 2. List all products: Pass empty array or omit productIds
1600
1600
  *
1601
1601
  * @example Specific products
1602
- * <ProductGallery productIds={["BEEB77", "AR2P3G", "KMYKUK"]}>
1602
+ * <ProductGallery productIds={["BEEB77", "CAXHQC", "KMYKUK"]}>
1603
1603
  * {(products, loading, error) => (
1604
1604
  * <div className="grid grid-cols-3 gap-4">
1605
1605
  * {products.map(product => (
@@ -2227,7 +2227,7 @@ interface ColorPickerProps {
2227
2227
  * ```tsx
2228
2228
  * import { Product, ColorPicker } from '@snowcone-app/ui';
2229
2229
  *
2230
- * <Product productId="AR2P3G">
2230
+ * <Product productId="CAXHQC">
2231
2231
  * <ColorPicker placement="Crown" defaultColor="#ff0000" />
2232
2232
  * </Product>
2233
2233
  * ```
package/dist/index.d.ts CHANGED
@@ -1510,7 +1510,7 @@ interface UseProductGalleryReturn {
1510
1510
  * ```tsx
1511
1511
  * // Fetch specific products
1512
1512
  * const { products, loading, error, refetch } = useProductGallery(
1513
- * ['BEEB77', 'AR2P3G'],
1513
+ * ['BEEB77', 'CAXHQC'],
1514
1514
  * { endpoint: 'http://localhost:3000', mode: 'mock' }
1515
1515
  * );
1516
1516
  *
@@ -1599,7 +1599,7 @@ interface ProductGalleryProps extends UseProductGalleryOptions {
1599
1599
  * 2. List all products: Pass empty array or omit productIds
1600
1600
  *
1601
1601
  * @example Specific products
1602
- * <ProductGallery productIds={["BEEB77", "AR2P3G", "KMYKUK"]}>
1602
+ * <ProductGallery productIds={["BEEB77", "CAXHQC", "KMYKUK"]}>
1603
1603
  * {(products, loading, error) => (
1604
1604
  * <div className="grid grid-cols-3 gap-4">
1605
1605
  * {products.map(product => (
@@ -2227,7 +2227,7 @@ interface ColorPickerProps {
2227
2227
  * ```tsx
2228
2228
  * import { Product, ColorPicker } from '@snowcone-app/ui';
2229
2229
  *
2230
- * <Product productId="AR2P3G">
2230
+ * <Product productId="CAXHQC">
2231
2231
  * <ColorPicker placement="Crown" defaultColor="#ff0000" />
2232
2232
  * </Product>
2233
2233
  * ```
package/dist/index.js CHANGED
@@ -5625,7 +5625,7 @@ import {
5625
5625
  useMemo as useMemo7
5626
5626
  } from "react";
5627
5627
  import { useRealtimeMockup as useRealtimeMockup2 } from "@snowcone-app/sdk/react";
5628
- import { resolveVariantId as resolveVariantIdUtil } from "@snowcone-app/sdk";
5628
+ import { resolvePreviewVariantId, resolveVariantId as resolveVariantIdUtil } from "@snowcone-app/sdk";
5629
5629
 
5630
5630
  // src/patterns/MockupBackground.tsx
5631
5631
  import { createContext as createContext7, useContext as useContext5 } from "react";
@@ -6150,10 +6150,9 @@ function RealtimeProvider({
6150
6150
  const product = productContext.product;
6151
6151
  const productId = product.id;
6152
6152
  const placements = product.placements || [];
6153
- const variantId = resolveVariantIdUtil(
6153
+ const variantId = resolvePreviewVariantId(
6154
6154
  productContext,
6155
- void 0,
6156
- void 0
6155
+ resolveVariantIdUtil(productContext, void 0, void 0)
6157
6156
  );
6158
6157
  const isFirstSend = !configSentRef.current;
6159
6158
  const variantChanged = lastSentVariantIdRef.current !== null && lastSentVariantIdRef.current !== variantId;
@@ -10054,6 +10053,7 @@ import {
10054
10053
  createDesignForPlacements,
10055
10054
  getMockupUrl,
10056
10055
  resolveVariantId,
10056
+ resolvePreviewVariantId as resolvePreviewVariantId2,
10057
10057
  resolveMockupId
10058
10058
  } from "@snowcone-app/sdk";
10059
10059
 
@@ -10174,12 +10174,15 @@ var HeroProductImage = memo3(function HeroProductImage2({
10174
10174
  const contextRef = useRef23(context);
10175
10175
  contextRef.current = context;
10176
10176
  const actualProductId = product?.id || productId || context?.product?.id;
10177
- const actualGvid = useMemo14(() => {
10177
+ const selectedGvid = useMemo14(() => {
10178
10178
  return resolveVariantId(context, gvid, variantId);
10179
10179
  }, [gvid, variantId, context?.selection, context?.combinations]);
10180
10180
  const actualMockupId = useMemo14(() => {
10181
- return resolveMockupId(context, actualGvid, mockupId);
10182
- }, [mockupId, actualGvid, context]);
10181
+ return resolveMockupId(context, selectedGvid, mockupId);
10182
+ }, [mockupId, selectedGvid, context]);
10183
+ const actualGvid = useMemo14(() => {
10184
+ return gvid || variantId ? selectedGvid : resolvePreviewVariantId2(context, selectedGvid, actualMockupId);
10185
+ }, [gvid, variantId, selectedGvid, actualMockupId, context]);
10183
10186
  const unavailable = actualMockupId ? realtimeContext?.unavailableMockups?.get(actualMockupId) ?? null : null;
10184
10187
  const artworkSrc = artwork?.src;
10185
10188
  const selectedArtworkSrc = designContext?.selectedArtwork?.src;