@snowcone-app/ui 0.11.4 → 0.11.5
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,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.11.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`7411c1f`](https://github.com/snowcone-app/snowcone-monorepo/commit/7411c1f96b0f59b286851b0ca1fb52eeed101aaa)]:
|
|
8
|
+
- @snowcone-app/sdk@0.31.11
|
|
9
|
+
|
|
3
10
|
## 0.11.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snowcone-app/ui",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "React components for merchandise visualization and customization",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"react-instantsearch": "^7.15.5",
|
|
104
104
|
"react-zoom-pan-pinch": "^3.6.4",
|
|
105
105
|
"tailwind-merge": "^3.0.0",
|
|
106
|
-
"@snowcone-app/sdk": "0.31.
|
|
106
|
+
"@snowcone-app/sdk": "0.31.11"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@chromatic-com/storybook": "^4.1.2",
|
|
@@ -30,21 +30,23 @@ const SHOP = "2e2c853b83";
|
|
|
30
30
|
const PRODUCTS = { AKTGA7, BC43BE, NBYVCX, KVJVVA } as unknown as Record<string, CatalogProduct & { mockups: Array<{ id: string }>; placements: Array<{ label: string }> }>;
|
|
31
31
|
|
|
32
32
|
/** The phone carousel's first slide, as page-client + MobileProductCarousel mount it. */
|
|
33
|
-
function FirstSlide({ product, bg, presigned }: { product: (typeof PRODUCTS)[string]; bg
|
|
33
|
+
function FirstSlide({ product, bg, presigned, art = "default" }: { product: (typeof PRODUCTS)[string]; bg?: string; presigned?: Array<{ url: string; signed: string }>; art?: string }) {
|
|
34
34
|
const first = ordinaryMockups(product.mockups)[0];
|
|
35
|
+
const hero = (
|
|
36
|
+
<HeroProductImage
|
|
37
|
+
productId={product.id}
|
|
38
|
+
artwork={{ type: "regular", src: art } as never}
|
|
39
|
+
placement={product.placements[0].label}
|
|
40
|
+
mockupId={first.id}
|
|
41
|
+
width={MOBILE_HERO_WIDTH}
|
|
42
|
+
viewportPolicy
|
|
43
|
+
presigned={presigned}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
// No bg = the storefront's PDP since 2026-11-24: no MockupBackground, the renderer paints the SHOP's colour.
|
|
35
47
|
return (
|
|
36
|
-
<Product productId={product.id} productData={product} initialPlacements={{ Front: { imageUrl:
|
|
37
|
-
<MockupBackground bg={bg}>
|
|
38
|
-
<HeroProductImage
|
|
39
|
-
productId={product.id}
|
|
40
|
-
artwork={{ type: "regular", src: "default" } as never}
|
|
41
|
-
placement={product.placements[0].label}
|
|
42
|
-
mockupId={first.id}
|
|
43
|
-
width={MOBILE_HERO_WIDTH}
|
|
44
|
-
viewportPolicy
|
|
45
|
-
presigned={presigned}
|
|
46
|
-
/>
|
|
47
|
-
</MockupBackground>
|
|
48
|
+
<Product productId={product.id} productData={product} initialPlacements={{ Front: { imageUrl: art, alignment: "center" as never } }} dataMode="auto">
|
|
49
|
+
{bg ? <MockupBackground bg={bg}>{hero}</MockupBackground> : hero}
|
|
48
50
|
</Product>
|
|
49
51
|
);
|
|
50
52
|
}
|
|
@@ -66,14 +68,15 @@ describe("the server's first phone hero URL is the URL the client requests (no d
|
|
|
66
68
|
});
|
|
67
69
|
|
|
68
70
|
for (const [id, product] of Object.entries(PRODUCTS)) {
|
|
69
|
-
for (const bg of ["f5f5f5", "0a0a0a"]) {
|
|
70
|
-
it(`${id} bg ${bg}: client URL === firstMobileHeroUrl`, async () => {
|
|
71
|
+
for (const bg of [undefined, "f5f5f5", "0a0a0a"]) {
|
|
72
|
+
it(`${id} ${bg ? `bg ${bg}` : "no bg (the shop's colour)"}: client URL === firstMobileHeroUrl`, async () => {
|
|
71
73
|
const server = firstMobileHeroUrl({ product, artworkSrc: "default", shop: SHOP, bg });
|
|
72
74
|
expect(server, "the server builds a URL for every live set product").toBeTruthy();
|
|
73
75
|
const { container } = render(<FirstSlide product={product} bg={bg} />);
|
|
74
76
|
const src = await requested(container);
|
|
75
77
|
expect(src).toBe(`${server}&signature=client`);
|
|
76
78
|
expect(new URL(server!).searchParams.get("width")).toBe(String(MOBILE_HERO_WIDTH));
|
|
79
|
+
expect(new URL(server!).searchParams.get("bg")).toBe(bg ?? null);
|
|
77
80
|
});
|
|
78
81
|
}
|
|
79
82
|
}
|
|
@@ -99,4 +102,20 @@ describe("the server's first phone hero URL is the URL the client requests (no d
|
|
|
99
102
|
expect(firstMobileHeroUrl({ product: PRODUCTS.AKTGA7, artworkSrc: "default", shop: undefined })).toBeNull();
|
|
100
103
|
expect(firstMobileHeroUrl({ product: PRODUCTS.AKTGA7, artworkSrc: "", shop: SHOP })).toBeNull();
|
|
101
104
|
});
|
|
105
|
+
|
|
106
|
+
// A PUBLISHED pairing's page (/product/<slug>) mounts the hero with the pairing RECORD's art (page-client
|
|
107
|
+
// initialPlacements.Front.imageUrl = artwork.src = pairing.mockupThumbnailUrl || design.previewUrl); the server signs
|
|
108
|
+
// that same URL (www lib/first-hero-preload.ts publishedPairingHeroPreloads, lead 2026-11-19).
|
|
109
|
+
const RECORD_ART = "https://2e2c853b83.storage.snowcone.app/persisted/3fa2ae64c674c5fa.png";
|
|
110
|
+
for (const [id, product] of Object.entries(PRODUCTS)) {
|
|
111
|
+
for (const bg of ["f5f5f5", "0a0a0a"]) {
|
|
112
|
+
it(`${id} bg ${bg}, a pairing's record art: client URL === firstMobileHeroUrl`, async () => {
|
|
113
|
+
const server = firstMobileHeroUrl({ product, artworkSrc: RECORD_ART, shop: SHOP, bg });
|
|
114
|
+
expect(server).toBeTruthy();
|
|
115
|
+
expect(server).not.toBe(firstMobileHeroUrl({ product, artworkSrc: "default", shop: SHOP, bg })); // it is the art's URL
|
|
116
|
+
const { container } = render(<FirstSlide product={product} bg={bg} art={RECORD_ART} />);
|
|
117
|
+
expect(await requested(container)).toBe(`${server}&signature=client`);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
102
121
|
});
|