@snowcone-app/ui 0.3.0 → 0.4.0
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 +20 -0
- package/dist/index.cjs +14 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +14 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/composed/HeroProductImage.tsx +14 -0
- package/src/patterns/RealtimeProvider.tsx +17 -2
package/dist/index.d.cts
CHANGED
|
@@ -5,7 +5,7 @@ import * as React$1 from 'react';
|
|
|
5
5
|
import React__default, { ReactNode, CSSProperties, RefObject } from 'react';
|
|
6
6
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
7
|
import { VariantProps } from 'class-variance-authority';
|
|
8
|
-
import { ProductPriceOptions, CatalogProduct, ImageAlignment, OptionSelection, ProductContext as ProductContext$1, WebSocketConfig, DesignElement, ProductArtAlignmentOptions, ProductArtAlignmentContext, ArtworkData } from '@snowcone-app/sdk';
|
|
8
|
+
import { ProductPriceOptions, CatalogProduct, ImageAlignment, OptionSelection, ProductContext as ProductContext$1, WebSocketConfig, DesignElement, RealtimeRenderError, ProductArtAlignmentOptions, ProductArtAlignmentContext, ArtworkData } from '@snowcone-app/sdk';
|
|
9
9
|
export { ArtworkData, AspectRatio, ImageAlignment, ProductArtAlignmentContext, ProductArtAlignmentOptions, ProductData, ProductMockupData, ProductPlacement, ProductVariant, WebSocketConfig, describeProductArtAlignment, getMockupUrl, getProduct, getSnapPoints, listProducts } from '@snowcone-app/sdk';
|
|
10
10
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
11
11
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
@@ -2886,6 +2886,14 @@ interface RealtimeContextValue {
|
|
|
2886
2886
|
isConnected: boolean;
|
|
2887
2887
|
isConfigured: boolean;
|
|
2888
2888
|
mockupResults: MockupResult[];
|
|
2889
|
+
/**
|
|
2890
|
+
* Most recent server render error (stable machine-readable `code` +
|
|
2891
|
+
* human message, e.g. `{code: 'asset_not_allowed', ...}`). Cleared when a
|
|
2892
|
+
* later render succeeds. While set, `mockupResults` still holds the LAST
|
|
2893
|
+
* GOOD renders — surface the error visibly (badge the stale mockup) rather
|
|
2894
|
+
* than blanking it or logging console-only.
|
|
2895
|
+
*/
|
|
2896
|
+
renderError: RealtimeRenderError | null;
|
|
2889
2897
|
isPendingMockups: boolean;
|
|
2890
2898
|
canvasBlobsSent: number;
|
|
2891
2899
|
colorBlobsSent: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import * as React$1 from 'react';
|
|
|
5
5
|
import React__default, { ReactNode, CSSProperties, RefObject } from 'react';
|
|
6
6
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
7
7
|
import { VariantProps } from 'class-variance-authority';
|
|
8
|
-
import { ProductPriceOptions, CatalogProduct, ImageAlignment, OptionSelection, ProductContext as ProductContext$1, WebSocketConfig, DesignElement, ProductArtAlignmentOptions, ProductArtAlignmentContext, ArtworkData } from '@snowcone-app/sdk';
|
|
8
|
+
import { ProductPriceOptions, CatalogProduct, ImageAlignment, OptionSelection, ProductContext as ProductContext$1, WebSocketConfig, DesignElement, RealtimeRenderError, ProductArtAlignmentOptions, ProductArtAlignmentContext, ArtworkData } from '@snowcone-app/sdk';
|
|
9
9
|
export { ArtworkData, AspectRatio, ImageAlignment, ProductArtAlignmentContext, ProductArtAlignmentOptions, ProductData, ProductMockupData, ProductPlacement, ProductVariant, WebSocketConfig, describeProductArtAlignment, getMockupUrl, getProduct, getSnapPoints, listProducts } from '@snowcone-app/sdk';
|
|
10
10
|
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
11
11
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
@@ -2886,6 +2886,14 @@ interface RealtimeContextValue {
|
|
|
2886
2886
|
isConnected: boolean;
|
|
2887
2887
|
isConfigured: boolean;
|
|
2888
2888
|
mockupResults: MockupResult[];
|
|
2889
|
+
/**
|
|
2890
|
+
* Most recent server render error (stable machine-readable `code` +
|
|
2891
|
+
* human message, e.g. `{code: 'asset_not_allowed', ...}`). Cleared when a
|
|
2892
|
+
* later render succeeds. While set, `mockupResults` still holds the LAST
|
|
2893
|
+
* GOOD renders — surface the error visibly (badge the stale mockup) rather
|
|
2894
|
+
* than blanking it or logging console-only.
|
|
2895
|
+
*/
|
|
2896
|
+
renderError: RealtimeRenderError | null;
|
|
2889
2897
|
isPendingMockups: boolean;
|
|
2890
2898
|
canvasBlobsSent: number;
|
|
2891
2899
|
colorBlobsSent: number;
|
package/dist/index.js
CHANGED
|
@@ -5624,8 +5624,8 @@ function RealtimeProvider({
|
|
|
5624
5624
|
},
|
|
5625
5625
|
onAllMockupsRendered: (results) => {
|
|
5626
5626
|
},
|
|
5627
|
-
onError: (error) => {
|
|
5628
|
-
console.error(
|
|
5627
|
+
onError: (error, detail) => {
|
|
5628
|
+
console.error(`[RealtimeProvider] Render error [${detail.code}]:`, error);
|
|
5629
5629
|
}
|
|
5630
5630
|
});
|
|
5631
5631
|
const subscribeRTCTiming = useCallback10((_callback) => {
|
|
@@ -5635,6 +5635,7 @@ function RealtimeProvider({
|
|
|
5635
5635
|
const {
|
|
5636
5636
|
isConnected,
|
|
5637
5637
|
isConfigured,
|
|
5638
|
+
renderError,
|
|
5638
5639
|
mockupResults: rawMockupResults,
|
|
5639
5640
|
sendCanvasBlob: sendCanvasBlobRaw,
|
|
5640
5641
|
sendCanvasState: sendCanvasStateRaw,
|
|
@@ -6154,6 +6155,7 @@ function RealtimeProvider({
|
|
|
6154
6155
|
isEnabled,
|
|
6155
6156
|
isConnected,
|
|
6156
6157
|
isConfigured,
|
|
6158
|
+
renderError,
|
|
6157
6159
|
// Read from ref - this is a snapshot at render time, NOT reactive
|
|
6158
6160
|
// For reactive updates, use getMockupResultsImmediate() or subscribe functions
|
|
6159
6161
|
get mockupResults() {
|
|
@@ -6197,6 +6199,7 @@ function RealtimeProvider({
|
|
|
6197
6199
|
isEnabled,
|
|
6198
6200
|
isConnected,
|
|
6199
6201
|
isConfigured,
|
|
6202
|
+
renderError,
|
|
6200
6203
|
// mockupResults removed from deps - it's a getter that reads from ref
|
|
6201
6204
|
canvasExportSize,
|
|
6202
6205
|
mockupWidth,
|
|
@@ -10209,6 +10212,15 @@ var HeroProductImage = memo3(function HeroProductImage2({
|
|
|
10209
10212
|
}
|
|
10210
10213
|
}
|
|
10211
10214
|
),
|
|
10215
|
+
realtimeContext?.renderError && /* @__PURE__ */ jsx60(
|
|
10216
|
+
"div",
|
|
10217
|
+
{
|
|
10218
|
+
role: "alert",
|
|
10219
|
+
"data-render-error": realtimeContext.renderError.code,
|
|
10220
|
+
className: "absolute inset-x-0 bottom-0 z-20 bg-red-600/90 text-white text-xs font-medium px-3 py-2 pointer-events-none",
|
|
10221
|
+
children: `Render blocked: ${realtimeContext.renderError.code} \u2014 ${realtimeContext.renderError.message}`
|
|
10222
|
+
}
|
|
10223
|
+
),
|
|
10212
10224
|
prevUrl && /* @__PURE__ */ jsx60(
|
|
10213
10225
|
"img",
|
|
10214
10226
|
{
|