@wix/himalaya-cli 0.1864.0 → 0.1866.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/dist/cli.mjs
CHANGED
|
@@ -43124,6 +43124,7 @@ function shouldRevealError(args) {
|
|
|
43124
43124
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
|
|
43125
43125
|
var init_validation = __esm({
|
|
43126
43126
|
"../../core/ts/src/validation.ts"() {
|
|
43127
|
+
"use strict";
|
|
43127
43128
|
init_define_HHP_CATALOG();
|
|
43128
43129
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
43129
43130
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
@@ -278627,6 +278628,104 @@ var init_header_badges_cli = __esm({
|
|
|
278627
278628
|
}
|
|
278628
278629
|
});
|
|
278629
278630
|
|
|
278631
|
+
// src/one-app/media-size.ts
|
|
278632
|
+
function wixRenditionUrl(url, opaquePngs = /* @__PURE__ */ new Set()) {
|
|
278633
|
+
const media = BARE_WIX_MEDIA.exec(url);
|
|
278634
|
+
if (!media) return url;
|
|
278635
|
+
if (media[1].toLowerCase() === "png" && !opaquePngs.has(url)) return url;
|
|
278636
|
+
return `${url}/v1/fit/w_${IMAGE_CEILING_PX},h_${IMAGE_CEILING_PX},q_${QUALITY}/image.jpg`;
|
|
278637
|
+
}
|
|
278638
|
+
function pngIsOpaque(head2) {
|
|
278639
|
+
if (head2.length < COLOR_TYPE_BYTES) return false;
|
|
278640
|
+
if (!PNG_SIGNATURE2.every((byte2, i2) => head2[i2] === byte2)) return false;
|
|
278641
|
+
if (String.fromCharCode(...head2.subarray(12, 16)) !== "IHDR") return false;
|
|
278642
|
+
return OPAQUE_COLOR_TYPES.has(head2[25]);
|
|
278643
|
+
}
|
|
278644
|
+
function barePngUrls(raw) {
|
|
278645
|
+
const found = /* @__PURE__ */ new Set();
|
|
278646
|
+
const add = (value2) => {
|
|
278647
|
+
if (typeof value2 === "string" && /\.png$/i.test(value2) && BARE_WIX_MEDIA.test(value2)) found.add(value2);
|
|
278648
|
+
};
|
|
278649
|
+
const record5 = (value2) => value2 && typeof value2 === "object" && !Array.isArray(value2) ? value2 : {};
|
|
278650
|
+
const sections2 = record5(record5(raw).sections);
|
|
278651
|
+
for (const section3 of Object.values(sections2)) {
|
|
278652
|
+
const settings = record5(record5(section3).settings);
|
|
278653
|
+
add(record5(settings.data).url);
|
|
278654
|
+
add(settings.imageUri);
|
|
278655
|
+
if (Array.isArray(settings.items)) for (const item2 of settings.items) add(record5(item2).imageUrl);
|
|
278656
|
+
}
|
|
278657
|
+
return [...found];
|
|
278658
|
+
}
|
|
278659
|
+
async function readRange(fetchAsset, url, start2, length2, signal) {
|
|
278660
|
+
const response = await fetchAsset(url, { headers: { range: `bytes=${start2}-${start2 + length2 - 1}` }, signal, redirect: "error" });
|
|
278661
|
+
const reader = response.body?.getReader();
|
|
278662
|
+
try {
|
|
278663
|
+
if (!reader || !response.ok || start2 > 0 && response.status !== 206) return null;
|
|
278664
|
+
const bytes2 = new Uint8Array(length2);
|
|
278665
|
+
let filled2 = 0;
|
|
278666
|
+
while (filled2 < length2) {
|
|
278667
|
+
const { done, value: value2 } = await reader.read();
|
|
278668
|
+
if (done || !value2) break;
|
|
278669
|
+
const take = Math.min(value2.length, length2 - filled2);
|
|
278670
|
+
bytes2.set(value2.subarray(0, take), filled2);
|
|
278671
|
+
filled2 += take;
|
|
278672
|
+
}
|
|
278673
|
+
return bytes2.subarray(0, filled2);
|
|
278674
|
+
} finally {
|
|
278675
|
+
await (reader ? reader.cancel() : response.body?.cancel())?.catch(() => void 0);
|
|
278676
|
+
}
|
|
278677
|
+
}
|
|
278678
|
+
async function isOpaquePng(fetchAsset, url, signal) {
|
|
278679
|
+
const head2 = await readRange(fetchAsset, url, 0, FIRST_CHUNK_AT, signal);
|
|
278680
|
+
if (!head2 || head2.length < FIRST_CHUNK_AT || !pngIsOpaque(head2)) return false;
|
|
278681
|
+
let offset = FIRST_CHUNK_AT;
|
|
278682
|
+
for (let chunk2 = 0; chunk2 < MAX_CHUNKS; chunk2++) {
|
|
278683
|
+
const header2 = await readRange(fetchAsset, url, offset, 8, signal);
|
|
278684
|
+
if (!header2 || header2.length < 8) return false;
|
|
278685
|
+
const type2 = String.fromCharCode(...header2.subarray(4, 8));
|
|
278686
|
+
if (type2 === "tRNS" || type2 === "acTL") return false;
|
|
278687
|
+
if (type2 === "IDAT") return true;
|
|
278688
|
+
offset += 12 + new DataView(header2.buffer, header2.byteOffset, 4).getUint32(0);
|
|
278689
|
+
}
|
|
278690
|
+
return false;
|
|
278691
|
+
}
|
|
278692
|
+
async function opaquePngUrls(urls, fetchAsset, limits = PROBE_LIMITS) {
|
|
278693
|
+
const opaque2 = /* @__PURE__ */ new Set();
|
|
278694
|
+
const queue = urls.slice(0, limits.maxPngs);
|
|
278695
|
+
const started = Date.now();
|
|
278696
|
+
const probe2 = async (url) => {
|
|
278697
|
+
const deadline = AbortSignal.timeout(limits.perPngMs);
|
|
278698
|
+
const expired = new Promise((resolve135) => deadline.addEventListener("abort", () => resolve135(false), { once: true }));
|
|
278699
|
+
try {
|
|
278700
|
+
if (await Promise.race([isOpaquePng(fetchAsset, url, deadline), expired])) opaque2.add(url);
|
|
278701
|
+
} catch {
|
|
278702
|
+
}
|
|
278703
|
+
};
|
|
278704
|
+
const worker = async () => {
|
|
278705
|
+
for (let url = queue.shift(); url !== void 0; url = queue.shift()) {
|
|
278706
|
+
if (Date.now() - started >= limits.totalMs) return;
|
|
278707
|
+
await probe2(url);
|
|
278708
|
+
}
|
|
278709
|
+
};
|
|
278710
|
+
await Promise.all(Array.from({ length: Math.min(limits.concurrency, queue.length) }, worker));
|
|
278711
|
+
return opaque2;
|
|
278712
|
+
}
|
|
278713
|
+
var IMAGE_CEILING_PX, QUALITY, BARE_WIX_MEDIA, OPAQUE_COLOR_TYPES, PNG_SIGNATURE2, FIRST_CHUNK_AT, COLOR_TYPE_BYTES, MAX_CHUNKS, PROBE_LIMITS;
|
|
278714
|
+
var init_media_size = __esm({
|
|
278715
|
+
"src/one-app/media-size.ts"() {
|
|
278716
|
+
init_define_HHP_CATALOG();
|
|
278717
|
+
IMAGE_CEILING_PX = 2048;
|
|
278718
|
+
QUALITY = 85;
|
|
278719
|
+
BARE_WIX_MEDIA = /^https:\/\/static\.wixstatic\.com\/media\/[^/?#]+\.(png|jpe?g)$/i;
|
|
278720
|
+
OPAQUE_COLOR_TYPES = /* @__PURE__ */ new Set([0, 2]);
|
|
278721
|
+
PNG_SIGNATURE2 = [137, 80, 78, 71, 13, 10, 26, 10];
|
|
278722
|
+
FIRST_CHUNK_AT = 33;
|
|
278723
|
+
COLOR_TYPE_BYTES = 26;
|
|
278724
|
+
MAX_CHUNKS = 16;
|
|
278725
|
+
PROBE_LIMITS = { concurrency: 6, perPngMs: 15e3, totalMs: 3e4, maxPngs: 200 };
|
|
278726
|
+
}
|
|
278727
|
+
});
|
|
278728
|
+
|
|
278630
278729
|
// src/one-app/recipes.ts
|
|
278631
278730
|
import { existsSync as existsSync156, readFileSync as readFileSync185 } from "node:fs";
|
|
278632
278731
|
import { join as join199 } from "node:path";
|
|
@@ -278873,6 +278972,11 @@ function galleryCards(id, s5, index, ctx, options2) {
|
|
|
278873
278972
|
children2.push(ctx.recipe(options2.layout, { svc, id }), ...viewAll ? [viewAll] : [], ...ctx.optionalRecipe("section-error", { svc, id, action: "load" }));
|
|
278874
278973
|
return vstack(`${id}.box`, children2, 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
|
|
278875
278974
|
}
|
|
278975
|
+
function galleryCollage(id, index, ctx, options2) {
|
|
278976
|
+
if (!ctx.hasScreen("himi_gallery")) throw new RecipeError("this scaffold has no himi_gallery screen for a gallery tile to open, so the section keeps its title and a See All link.");
|
|
278977
|
+
const svc = ctx.uses("galleries", `galleries${index}`, { limit: 1, showName: options2.showName, collage: true });
|
|
278978
|
+
return vstack(`${id}.box`, [ctx.recipe("galleries-collage", { svc, id }), ...ctx.optionalRecipe("section-error", { svc, id, action: "load" })], 12, { ...inset(16, 16), onAppear: { actionId: `tier5.${svc}.load`, params: {} } });
|
|
278979
|
+
}
|
|
278876
278980
|
function groupsSection(recipe, type2) {
|
|
278877
278981
|
return (id, s5, st2, index, ctx, sectionId) => {
|
|
278878
278982
|
if (!ctx.hasScreen("himi_group")) return ctx.unsupported(sectionId, type2, "this scaffold has no himi_group screen for a row to open");
|
|
@@ -279251,6 +279355,7 @@ function generateScreens(input) {
|
|
|
279251
279355
|
page: { label: label4, screenId, layoutItemId },
|
|
279252
279356
|
taken: taken2,
|
|
279253
279357
|
hasScreen: (id) => !input.takenScreenIds || input.takenScreenIds.has(id),
|
|
279358
|
+
imageUrl: (url) => wixRenditionUrl(url, input.opaquePngs),
|
|
279254
279359
|
uses: (module, key4, opts) => {
|
|
279255
279360
|
if (input.hasModule && !input.hasModule(MODULES[module].file)) throw new RecipeError(`tier5-src/_shared/${MODULES[module].file}.ts is missing: this scaffold does not ship that module, so the section keeps its title and a See All link.`);
|
|
279256
279361
|
const svc = `himiPage_${screenId}_${key4}`;
|
|
@@ -279615,6 +279720,7 @@ var init_generate2 = __esm({
|
|
|
279615
279720
|
init_podcast();
|
|
279616
279721
|
init_tab_ids();
|
|
279617
279722
|
init_events_section();
|
|
279723
|
+
init_media_size();
|
|
279618
279724
|
TEMPLATE_HOME_SCREEN = "himi_branded_home";
|
|
279619
279725
|
TEMPLATE_SCREEN_PARAM_KEYS = {
|
|
279620
279726
|
himi_shop: ["categoryId"],
|
|
@@ -279932,7 +280038,7 @@ var init_generate2 = __esm({
|
|
|
279932
280038
|
if (tap) modifiers.onTap = tap;
|
|
279933
280039
|
}
|
|
279934
280040
|
return vstack(`${id}.box`, [node2(id, "Image", {
|
|
279935
|
-
url,
|
|
280041
|
+
url: ctx.imageUrl(url),
|
|
279936
280042
|
fillWidth: true,
|
|
279937
280043
|
...typeof data.aspectRatio === "number" ? { aspectRatio: data.aspectRatio } : {},
|
|
279938
280044
|
contentMode: st2.displayMode === "fit" ? "fit" : "fill",
|
|
@@ -280000,7 +280106,7 @@ var init_generate2 = __esm({
|
|
|
280000
280106
|
if (!title && !url) return [];
|
|
280001
280107
|
const parts = [];
|
|
280002
280108
|
if (url) parts.push(node2(`${id}.i${i2}.img`, "Image", {
|
|
280003
|
-
url,
|
|
280109
|
+
url: ctx.imageUrl(url),
|
|
280004
280110
|
fillWidth: true,
|
|
280005
280111
|
...typeof options2.aspectRatio === "number" ? { aspectRatio: options2.aspectRatio } : {},
|
|
280006
280112
|
contentMode: options2.imageScale === "fit" ? "fit" : "fill",
|
|
@@ -280020,7 +280126,7 @@ var init_generate2 = __esm({
|
|
|
280020
280126
|
const tap = sourceTap(obj16(st2.action), ctx.hasScreen);
|
|
280021
280127
|
const align = st2.horizontalAlign === "center" ? "center" : st2.horizontalAlign === "right" ? "trailing" : "leading";
|
|
280022
280128
|
const picture = url ? node2(`${id}.img`, "Image", {
|
|
280023
|
-
url,
|
|
280129
|
+
url: ctx.imageUrl(url),
|
|
280024
280130
|
fillWidth: true,
|
|
280025
280131
|
...typeof st2.aspectRatio === "number" ? { aspectRatio: st2.aspectRatio } : {},
|
|
280026
280132
|
contentMode: "fill",
|
|
@@ -280136,13 +280242,17 @@ var init_generate2 = __esm({
|
|
|
280136
280242
|
return plansSection(id, s5, index, ctx, { planIds: selectedPlanIds(st2), showBenefits: true, ...order ? { order } : {} });
|
|
280137
280243
|
},
|
|
280138
280244
|
// The site's first Pro Gallery galleries as cover cards (a rail, or full-width cards when the source turns its carousel off), as many as
|
|
280139
|
-
// the source's `maxGalleries
|
|
280245
|
+
// the source's `maxGalleries`; with exactly one (and the carousel on) the source shows that gallery as a collage, and so does the section. Like the source, which lists a member's non-hidden, non-empty galleries and shows a visitor (or a list it
|
|
280140
280246
|
// cannot read) its empty state, the module reads for a signed-in member only. A card opens the template's gallery screen and View All its galleries screen: a scaffold without either
|
|
280141
280247
|
// keeps the title and a link, as every data section does.
|
|
280142
280248
|
progallery_carousel_section: (id, s5, st2, index, ctx, sectionId) => {
|
|
280143
280249
|
const asked = typeof st2.maxGalleries === "number" && st2.maxGalleries >= 1 ? Math.floor(st2.maxGalleries) : void 0;
|
|
280144
280250
|
const limit = asked !== void 0 ? Math.min(asked, GALLERIES_INLINE_MAX) : void 0;
|
|
280145
280251
|
if (asked !== void 0 && limit !== asked) ctx.gap(sectionId, "progallery_carousel_section", `the source shows ${asked} galleries; the section shows the first ${limit}`);
|
|
280252
|
+
if (limit === 1 && st2.isCarousel !== false) {
|
|
280253
|
+
ctx.gap(sectionId, "progallery_carousel_section", "the source's single-gallery section is a collage of the gallery's first five pictures; a picture's caption over its tile is not shown");
|
|
280254
|
+
return galleryCollage(id, index, ctx, { showName: st2.isShowName !== false });
|
|
280255
|
+
}
|
|
280146
280256
|
return galleryCards(id, s5, index, ctx, { layout: st2.isCarousel === false ? "galleries-list" : "galleries-carousel", showName: st2.isShowName !== false, ...limit !== void 0 ? { limit } : {} });
|
|
280147
280257
|
},
|
|
280148
280258
|
// The Pro Gallery list section is the source's whole galleries screen and has no settings of its own (no count, layout or names switch),
|
|
@@ -281244,9 +281354,10 @@ async function runOneAppGenerate(args, io2) {
|
|
|
281244
281354
|
} catch {
|
|
281245
281355
|
return report8(io2, false, { code: "content_invalid", error: "himalaya.content.json not found or unreadable: --content must be a Himi content package." });
|
|
281246
281356
|
}
|
|
281357
|
+
const opaquePngs = await opaquePngUrls(barePngUrls(raw), pinnedFetch);
|
|
281247
281358
|
let result;
|
|
281248
281359
|
try {
|
|
281249
|
-
result = generateScreens({ raw, pages: pages2, business, navigation, takenScreenIds: taken2, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync159(join202(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
|
|
281360
|
+
result = generateScreens({ raw, pages: pages2, business, opaquePngs, navigation, takenScreenIds: taken2, ...homeScreenId ? { homeScreenId } : {}, recipe: (name, values) => readRecipe(options2.contentDir, name, values), recipeNodes: (name, values) => readRecipeNodes(options2.contentDir, name, values), hasModule: (file2) => existsSync159(join202(options2.contentDir, "tier5-src", "_shared", `${file2}.ts`)) });
|
|
281250
281361
|
} catch (error) {
|
|
281251
281362
|
if (error instanceof RecipeError) return report8(io2, false, { code: "recipe_unavailable", error: error.message });
|
|
281252
281363
|
throw error;
|
|
@@ -281351,6 +281462,8 @@ var init_generate_cli = __esm({
|
|
|
281351
281462
|
"src/one-app/generate-cli.ts"() {
|
|
281352
281463
|
init_define_HHP_CATALOG();
|
|
281353
281464
|
init_validate_topbar();
|
|
281465
|
+
init_media_size();
|
|
281466
|
+
init_net_guard();
|
|
281354
281467
|
init_generate2();
|
|
281355
281468
|
init_recipes();
|
|
281356
281469
|
init_provision();
|
|
@@ -225,6 +225,7 @@ source's title (only when the source shows it) and a **See All** button to the s
|
|
|
225
225
|
| `platform_general_upcoming_section` | `himi_agenda` | nothing: the source strip is the Bookings member widget (the business's next 3 bookable sessions with the member's booked status; the Events module does not feed it), whatever its `interval` says |
|
|
226
226
|
| `vod_list_section` | `himi_videos` | nothing: the screen is the channel list |
|
|
227
227
|
| `bookings_agenda_section` | `himi_agenda` | nothing: the screen is the calendar of the site's class and course sessions |
|
|
228
|
+
| `progallery_carousel_section` | `himi_galleries` | `maxGalleries`, `isCarousel`, `isShowName`: a rail of the first `maxGalleries` gallery covers (full-width cards when the carousel is off). With exactly ONE gallery and the carousel on, the source shows that gallery as a collage, and so does the section: the gallery's name (when names are on) with View All, then its first five pictures as one big tile and four small, the last small tile with "+N" for the pictures past the five; a tile and View All open the gallery (`himi_gallery`). The section's own title is not shown there (the header is the gallery's name), and a picture's caption over its tile is reported as a gap. Like the list section it reads the One App's galleries service as a member: a visitor sees the "no galleries" state |
|
|
228
229
|
| `proGallery_gallery_list_section` | `himi_galleries` | nothing: the section has no settings. Beside other sections it shows the site's first 10 galleries as full-width cards (a card opens `himi_gallery`), with View All to this screen, and reports that gap. Like the source, which reads the One App's own galleries service as a member and never shows hidden or empty galleries, the section lists them for a signed-in member only: a visitor sees the "no galleries" state, and so does a member where that service cannot be read (the web bridge refuses its host: the public Pro Gallery list has no hidden flag, so it is never used as a stand-in) |
|
|
229
230
|
| `shared_gallery_list_section` | `himi_galleries` | nothing. Never shown inline: it is the members' Shared Gallery, a different data source from the site's Pro Gallery. It keeps its title and a See All link that opens the site's galleries, not the members' shared ones, and reports that gap |
|
|
230
231
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1866.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"artifactId": "himalaya-cli"
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
"falconPackageHash": "
|
|
85
|
+
"falconPackageHash": "54120d07b557f53abd06d3c143d44ebd49482b6665d4084e4123cd75"
|
|
86
86
|
}
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_recipe": "A Pro Gallery section's single-gallery collage, as the source shows it with one gallery: the gallery's name and View All, then its first pictures as one big tile and a 2x2 block of small ones, the last small tile carrying a +N pill for the pictures past the five. A tap on a tile or View All opens the gallery. ONE node, always mounted. Service: registerGalleriesSection(svc, { collage: true, showName }); the section has no title of its own and no separate View All button (the header has it).",
|
|
3
|
+
"_placeholders": {
|
|
4
|
+
"svc": "service name the page worker registered with registerGalleriesSection",
|
|
5
|
+
"id": "unique node id prefix for this section"
|
|
6
|
+
},
|
|
7
|
+
"node": {
|
|
8
|
+
"id": "{{id}}.galleries",
|
|
9
|
+
"body": {
|
|
10
|
+
"package": "himalaya",
|
|
11
|
+
"type": "VStack",
|
|
12
|
+
"props": {
|
|
13
|
+
"spacing": 12,
|
|
14
|
+
"alignment": "leading",
|
|
15
|
+
"children": [
|
|
16
|
+
{
|
|
17
|
+
"id": "{{id}}.loading",
|
|
18
|
+
"body": {
|
|
19
|
+
"package": "himalaya",
|
|
20
|
+
"type": "Skeleton",
|
|
21
|
+
"props": {
|
|
22
|
+
"height": 180,
|
|
23
|
+
"count": 1,
|
|
24
|
+
"cornerRadius": 8
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"modifiers": {
|
|
28
|
+
"padding": {
|
|
29
|
+
"leading": 0,
|
|
30
|
+
"trailing": 0,
|
|
31
|
+
"top": 0,
|
|
32
|
+
"bottom": 0
|
|
33
|
+
},
|
|
34
|
+
"hiddenPath": "$service:{{svc}}.notLoading"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "{{id}}.header",
|
|
39
|
+
"body": {
|
|
40
|
+
"package": "himalaya",
|
|
41
|
+
"type": "Grid",
|
|
42
|
+
"props": {
|
|
43
|
+
"columns": 1,
|
|
44
|
+
"spacing": 0,
|
|
45
|
+
"itemsPath": "$service:{{svc}}.rows",
|
|
46
|
+
"items": [
|
|
47
|
+
{
|
|
48
|
+
"id": "{{id}}.headerRow",
|
|
49
|
+
"body": {
|
|
50
|
+
"package": "himalaya",
|
|
51
|
+
"type": "HStack",
|
|
52
|
+
"props": {
|
|
53
|
+
"spacing": 12,
|
|
54
|
+
"alignment": "center",
|
|
55
|
+
"children": [
|
|
56
|
+
{
|
|
57
|
+
"id": "",
|
|
58
|
+
"body": {
|
|
59
|
+
"package": "himalaya",
|
|
60
|
+
"type": "Text",
|
|
61
|
+
"props": {
|
|
62
|
+
"text": "$item.name",
|
|
63
|
+
"style": "title3",
|
|
64
|
+
"maxLines": 2,
|
|
65
|
+
"collapseWhenEmpty": true
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"modifiers": {
|
|
69
|
+
"weight": 1
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "",
|
|
74
|
+
"body": {
|
|
75
|
+
"package": "himalaya",
|
|
76
|
+
"type": "Button",
|
|
77
|
+
"props": {
|
|
78
|
+
"title": "View All",
|
|
79
|
+
"style": "link",
|
|
80
|
+
"size": "sm",
|
|
81
|
+
"action": {
|
|
82
|
+
"actionId": "himi.open",
|
|
83
|
+
"params": {
|
|
84
|
+
"screenId": "$item.detailScreenId",
|
|
85
|
+
"id": "$item.id",
|
|
86
|
+
"name": "$item.label",
|
|
87
|
+
"source": "$item.source"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"modifiers": {
|
|
97
|
+
"fillMaxWidth": true
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"modifiers": {
|
|
104
|
+
"hiddenPath": "$service:{{svc}}.noRows"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": "{{id}}.mosaic",
|
|
109
|
+
"body": {
|
|
110
|
+
"package": "himalaya",
|
|
111
|
+
"type": "HStack",
|
|
112
|
+
"props": {
|
|
113
|
+
"spacing": 8,
|
|
114
|
+
"alignment": "leading",
|
|
115
|
+
"children": [
|
|
116
|
+
{
|
|
117
|
+
"id": "{{id}}.big",
|
|
118
|
+
"body": {
|
|
119
|
+
"package": "himalaya",
|
|
120
|
+
"type": "Grid",
|
|
121
|
+
"props": {
|
|
122
|
+
"columns": 1,
|
|
123
|
+
"spacing": 8,
|
|
124
|
+
"itemsPath": "$service:{{svc}}.bigTile",
|
|
125
|
+
"items": [
|
|
126
|
+
{
|
|
127
|
+
"id": "{{id}}.bigTile",
|
|
128
|
+
"body": {
|
|
129
|
+
"package": "himalaya",
|
|
130
|
+
"type": "VStack",
|
|
131
|
+
"props": {
|
|
132
|
+
"spacing": 0,
|
|
133
|
+
"alignment": "leading",
|
|
134
|
+
"children": [
|
|
135
|
+
{
|
|
136
|
+
"id": "",
|
|
137
|
+
"body": {
|
|
138
|
+
"package": "himalaya",
|
|
139
|
+
"type": "ZStack",
|
|
140
|
+
"props": {
|
|
141
|
+
"alignment": "center",
|
|
142
|
+
"children": [
|
|
143
|
+
{
|
|
144
|
+
"id": "",
|
|
145
|
+
"body": {
|
|
146
|
+
"package": "himalaya",
|
|
147
|
+
"type": "Image",
|
|
148
|
+
"props": {
|
|
149
|
+
"url": "$item.image",
|
|
150
|
+
"fillWidth": true,
|
|
151
|
+
"contentMode": "fill",
|
|
152
|
+
"aspectRatio": 1,
|
|
153
|
+
"contentDescription": "$item.label",
|
|
154
|
+
"shape": "rounded"
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"modifiers": {
|
|
158
|
+
"cornerRadius": 8,
|
|
159
|
+
"fillMaxWidth": true
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"id": "",
|
|
164
|
+
"body": {
|
|
165
|
+
"package": "himalaya",
|
|
166
|
+
"type": "VStack",
|
|
167
|
+
"props": {
|
|
168
|
+
"spacing": 0,
|
|
169
|
+
"alignment": "center",
|
|
170
|
+
"children": [
|
|
171
|
+
{
|
|
172
|
+
"id": "",
|
|
173
|
+
"body": {
|
|
174
|
+
"package": "himalaya",
|
|
175
|
+
"type": "Text",
|
|
176
|
+
"props": {
|
|
177
|
+
"text": "$item.more",
|
|
178
|
+
"style": "bodyEmphasis",
|
|
179
|
+
"maxLines": 1,
|
|
180
|
+
"color": "textOnAccent"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
"modifiers": {
|
|
188
|
+
"background": {
|
|
189
|
+
"token": "accentPrimary"
|
|
190
|
+
},
|
|
191
|
+
"cornerRadius": 10,
|
|
192
|
+
"padding": {
|
|
193
|
+
"leading": 12,
|
|
194
|
+
"trailing": 12,
|
|
195
|
+
"top": 6,
|
|
196
|
+
"bottom": 6
|
|
197
|
+
},
|
|
198
|
+
"hiddenPath": "$item.noMore"
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
"modifiers": {
|
|
205
|
+
"fillMaxWidth": true
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"modifiers": {
|
|
212
|
+
"fillMaxWidth": true,
|
|
213
|
+
"onTap": {
|
|
214
|
+
"actionId": "himi.open",
|
|
215
|
+
"params": {
|
|
216
|
+
"screenId": "$item.detailScreenId",
|
|
217
|
+
"id": "$item.id",
|
|
218
|
+
"name": "$item.label",
|
|
219
|
+
"source": "$item.source"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
"pressFeedback": "scale",
|
|
223
|
+
"haptic": "light",
|
|
224
|
+
"accessibilityLabel": "$item.label"
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"modifiers": {
|
|
231
|
+
"weight": 1
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"id": "{{id}}.small",
|
|
236
|
+
"body": {
|
|
237
|
+
"package": "himalaya",
|
|
238
|
+
"type": "Grid",
|
|
239
|
+
"props": {
|
|
240
|
+
"columns": 2,
|
|
241
|
+
"spacing": 8,
|
|
242
|
+
"itemsPath": "$service:{{svc}}.smallTiles",
|
|
243
|
+
"items": [
|
|
244
|
+
{
|
|
245
|
+
"id": "{{id}}.smallTile",
|
|
246
|
+
"body": {
|
|
247
|
+
"package": "himalaya",
|
|
248
|
+
"type": "VStack",
|
|
249
|
+
"props": {
|
|
250
|
+
"spacing": 0,
|
|
251
|
+
"alignment": "leading",
|
|
252
|
+
"children": [
|
|
253
|
+
{
|
|
254
|
+
"id": "",
|
|
255
|
+
"body": {
|
|
256
|
+
"package": "himalaya",
|
|
257
|
+
"type": "ZStack",
|
|
258
|
+
"props": {
|
|
259
|
+
"alignment": "center",
|
|
260
|
+
"children": [
|
|
261
|
+
{
|
|
262
|
+
"id": "",
|
|
263
|
+
"body": {
|
|
264
|
+
"package": "himalaya",
|
|
265
|
+
"type": "Image",
|
|
266
|
+
"props": {
|
|
267
|
+
"url": "$item.image",
|
|
268
|
+
"fillWidth": true,
|
|
269
|
+
"contentMode": "fill",
|
|
270
|
+
"aspectRatio": 1,
|
|
271
|
+
"contentDescription": "$item.label",
|
|
272
|
+
"shape": "rounded"
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"modifiers": {
|
|
276
|
+
"cornerRadius": 8,
|
|
277
|
+
"fillMaxWidth": true
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"id": "",
|
|
282
|
+
"body": {
|
|
283
|
+
"package": "himalaya",
|
|
284
|
+
"type": "VStack",
|
|
285
|
+
"props": {
|
|
286
|
+
"spacing": 0,
|
|
287
|
+
"alignment": "center",
|
|
288
|
+
"children": [
|
|
289
|
+
{
|
|
290
|
+
"id": "",
|
|
291
|
+
"body": {
|
|
292
|
+
"package": "himalaya",
|
|
293
|
+
"type": "Text",
|
|
294
|
+
"props": {
|
|
295
|
+
"text": "$item.more",
|
|
296
|
+
"style": "bodyEmphasis",
|
|
297
|
+
"maxLines": 1,
|
|
298
|
+
"color": "textOnAccent"
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
"modifiers": {
|
|
306
|
+
"background": {
|
|
307
|
+
"token": "accentPrimary"
|
|
308
|
+
},
|
|
309
|
+
"cornerRadius": 10,
|
|
310
|
+
"padding": {
|
|
311
|
+
"leading": 12,
|
|
312
|
+
"trailing": 12,
|
|
313
|
+
"top": 6,
|
|
314
|
+
"bottom": 6
|
|
315
|
+
},
|
|
316
|
+
"hiddenPath": "$item.noMore"
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
]
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"modifiers": {
|
|
323
|
+
"fillMaxWidth": true
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"modifiers": {
|
|
330
|
+
"fillMaxWidth": true,
|
|
331
|
+
"onTap": {
|
|
332
|
+
"actionId": "himi.open",
|
|
333
|
+
"params": {
|
|
334
|
+
"screenId": "$item.detailScreenId",
|
|
335
|
+
"id": "$item.id",
|
|
336
|
+
"name": "$item.label",
|
|
337
|
+
"source": "$item.source"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"pressFeedback": "scale",
|
|
341
|
+
"haptic": "light",
|
|
342
|
+
"accessibilityLabel": "$item.label"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"modifiers": {
|
|
349
|
+
"weight": 1
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
]
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"modifiers": {
|
|
356
|
+
"fillMaxWidth": true,
|
|
357
|
+
"hiddenPath": "$service:{{svc}}.noCollage"
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"id": "{{id}}.empty",
|
|
362
|
+
"body": {
|
|
363
|
+
"package": "himalaya",
|
|
364
|
+
"type": "Text",
|
|
365
|
+
"props": {
|
|
366
|
+
"text": "$service:{{svc}}.emptyText",
|
|
367
|
+
"style": "body",
|
|
368
|
+
"color": "textSecondary"
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"modifiers": {
|
|
372
|
+
"hiddenPath": "$service:{{svc}}.noEmpty"
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
]
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
// - a member reads that service (`photography-one-app-viewer/galleries`), which a native host reaches;
|
|
10
10
|
// - where it cannot be read (the published web bridge refuses that host) the member gets the empty state too: a hidden gallery must never show.
|
|
11
11
|
// A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipes galleries-carousel / galleries-list).
|
|
12
|
+
// `collage: true` is the source's single-gallery mode (`maxGalleries: 1`): the first gallery's name, View All, and its first five pictures as one
|
|
13
|
+
// big tile and four small ones, the last small tile carrying "+N" for the pictures past the five (recipe galleries-collage).
|
|
12
14
|
import { defineService } from "@himalaya/state";
|
|
13
15
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
14
16
|
import { copyParam, stashCopy, copyTemplate } from "./himi-copy.js";
|
|
@@ -19,6 +21,17 @@ export interface GalleriesSectionOptions {
|
|
|
19
21
|
limit?: number;
|
|
20
22
|
/** Whether a card shows the gallery's name. */
|
|
21
23
|
showName?: boolean;
|
|
24
|
+
/** The single-gallery collage: the first visible gallery's first pictures as tiles (and `limit` is 1). */
|
|
25
|
+
collage?: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A tile of the collage: a picture of the gallery, opening it. The last small tile carries the count of pictures past the tiles. */
|
|
29
|
+
export interface CollageTile {
|
|
30
|
+
image: string; hasImage: boolean; noImage: boolean;
|
|
31
|
+
/** "+16" on the last small tile when the gallery has pictures past the five shown; "" on every other tile. */
|
|
32
|
+
more: string; hasMore: boolean; noMore: boolean;
|
|
33
|
+
/** The gallery the tile opens (a tile opens its gallery, not the picture): the same params as a card. */
|
|
34
|
+
id: string; label: string; detailScreenId: string; source: string;
|
|
22
35
|
}
|
|
23
36
|
|
|
24
37
|
export interface GalleryRow {
|
|
@@ -41,6 +54,11 @@ export interface GalleriesSectionState {
|
|
|
41
54
|
notLoading: boolean; notErrored: boolean; noRows: boolean; noEmpty: boolean;
|
|
42
55
|
/** false when the site has more galleries than the section shows. */
|
|
43
56
|
noMore: boolean;
|
|
57
|
+
/** The collage's tiles: the first one, and up to four after it (both empty outside `collage`). */
|
|
58
|
+
bigTile: CollageTile[];
|
|
59
|
+
smallTiles: CollageTile[];
|
|
60
|
+
/** true when there is no collage to show (not in `collage` mode, or the gallery has no pictures). */
|
|
61
|
+
noCollage: boolean;
|
|
44
62
|
}
|
|
45
63
|
|
|
46
64
|
/** The One App's own list: what the source section reads (its `API_BASE_URL` + `/galleries`), as a member, without hidden galleries. */
|
|
@@ -50,17 +68,26 @@ const DEFAULT_LIMIT = 10;
|
|
|
50
68
|
const PAGE_SIZE = 10, MAX_GALLERIES = 30;
|
|
51
69
|
/** A 240pt card at 3x: the shared list size (1000px) would ship far more pixels than a rail shows. */
|
|
52
70
|
const CARD_IMAGE = { width: 720, height: 540, quality: 85 };
|
|
71
|
+
/** The collage shows the first five pictures: one big tile and four small ones. */
|
|
72
|
+
const COLLAGE_TILES = 5;
|
|
73
|
+
/** A big tile is about half the screen wide at 3x, a small one a quarter. */
|
|
74
|
+
const BIG_TILE_IMAGE = { width: 720, height: 720, quality: 85 };
|
|
75
|
+
const SMALL_TILE_IMAGE = { width: 360, height: 360, quality: 85 };
|
|
53
76
|
|
|
54
77
|
type WixApi = { call: (method: string, path: string) => Promise<unknown> };
|
|
55
78
|
interface RawItem { mediaUrl?: unknown; dataType?: unknown; videoMetadata?: { posters?: Array<{ url?: unknown }> } }
|
|
56
79
|
/** A gallery of the One App's list. */
|
|
57
80
|
interface RawGallery { id?: unknown; name?: unknown; items?: RawItem[]; totalItemsCount?: unknown; isHidden?: unknown }
|
|
58
81
|
|
|
59
|
-
/**
|
|
60
|
-
function
|
|
61
|
-
const item = Array.isArray(gallery.items) ? gallery.items[0] : undefined;
|
|
82
|
+
/** An item's picture (a video gives its poster), sized for its tile. */
|
|
83
|
+
function pictureOf(item: RawItem | undefined, size: { width: number; height: number; quality: number }): string {
|
|
62
84
|
const poster = item?.dataType === "Video" ? item.videoMetadata?.posters?.find((p) => typeof p?.url === "string" && p.url)?.url : undefined;
|
|
63
|
-
return wixMediaUrl(poster ?? item?.mediaUrl,
|
|
85
|
+
return wixMediaUrl(poster ?? item?.mediaUrl, size);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** A gallery's cover: the first item's picture. */
|
|
89
|
+
function coverOf(gallery: RawGallery): string {
|
|
90
|
+
return pictureOf(Array.isArray(gallery.items) ? gallery.items[0] : undefined, CARD_IMAGE);
|
|
64
91
|
}
|
|
65
92
|
|
|
66
93
|
function rowOf(gallery: RawGallery, index: number, showName: boolean): GalleryRow {
|
|
@@ -74,6 +101,26 @@ function rowOf(gallery: RawGallery, index: number, showName: boolean): GalleryRo
|
|
|
74
101
|
};
|
|
75
102
|
}
|
|
76
103
|
|
|
104
|
+
/**
|
|
105
|
+
* The collage's tiles of one gallery: its first five pictures that have a url (a picture with none is skipped), the first as the big tile and
|
|
106
|
+
* the rest as the small ones, the last small tile carrying "+N" for the pictures past the ones looked at. Size and "+N" go by a tile's place
|
|
107
|
+
* among the SHOWN ones, never by the picture's original index: a skipped first picture must not leave the big tile at a small size, and a
|
|
108
|
+
* skipped fifth one must not take the "+N" away.
|
|
109
|
+
*/
|
|
110
|
+
function collageOf(gallery: RawGallery, row: GalleryRow): { big: CollageTile[]; small: CollageTile[] } {
|
|
111
|
+
const looked = (Array.isArray(gallery.items) ? gallery.items : []).slice(0, COLLAGE_TILES);
|
|
112
|
+
const total = typeof gallery.totalItemsCount === "number" ? gallery.totalItemsCount : looked.length;
|
|
113
|
+
const past = Math.max(0, total - looked.length);
|
|
114
|
+
const shown = looked.filter((item) => pictureOf(item, SMALL_TILE_IMAGE));
|
|
115
|
+
const tiles = shown.map((item, place): CollageTile => {
|
|
116
|
+
const image = pictureOf(item, place === 0 ? BIG_TILE_IMAGE : SMALL_TILE_IMAGE);
|
|
117
|
+
const last = place >= 1 && place === shown.length - 1 && past > 0;
|
|
118
|
+
return { image, hasImage: true, noImage: false, more: last ? `+${past}` : "", hasMore: last, noMore: !last,
|
|
119
|
+
id: row.id, label: row.label, detailScreenId: row.detailScreenId, source: row.source };
|
|
120
|
+
});
|
|
121
|
+
return { big: tiles.slice(0, 1), small: tiles.slice(1) };
|
|
122
|
+
}
|
|
123
|
+
|
|
77
124
|
/** A gallery the section may show: the source drops hidden and empty galleries. An unknown count is not "empty". */
|
|
78
125
|
function visible(gallery: RawGallery): boolean {
|
|
79
126
|
const count = gallery.totalItemsCount;
|
|
@@ -85,8 +132,8 @@ const MAX_SCANNED = 200;
|
|
|
85
132
|
|
|
86
133
|
/** One page of the One App's list, as the source section reads it (`withHidden=false`). A native transport may hand the body over bare or wrapped as
|
|
87
134
|
* `{ data }`. The service drops hidden galleries after it pages, so only its `totalGalleriesCount` says where the list ends: a body without one is not read. */
|
|
88
|
-
async function readPage(api: WixApi, offset: number): Promise<{ galleries: RawGallery[]; total: number }> {
|
|
89
|
-
const res = await api.call("GET", `${ONE_APP_GALLERIES_URL}?itemsPerGallery
|
|
135
|
+
async function readPage(api: WixApi, offset: number, itemsPerGallery: number): Promise<{ galleries: RawGallery[]; total: number }> {
|
|
136
|
+
const res = await api.call("GET", `${ONE_APP_GALLERIES_URL}?itemsPerGallery=${itemsPerGallery}&offset=${offset}&limit=${PAGE_SIZE}&withHidden=false&useNew=true`);
|
|
90
137
|
const body = (res as { data?: unknown } | null)?.data ?? res;
|
|
91
138
|
const { galleries, totalGalleriesCount } = (body ?? {}) as { galleries?: unknown; totalGalleriesCount?: unknown };
|
|
92
139
|
if (!Array.isArray(galleries) || typeof totalGalleriesCount !== "number") throw new Error("Malformed One App galleries response");
|
|
@@ -94,12 +141,12 @@ async function readPage(api: WixApi, offset: number): Promise<{ galleries: RawGa
|
|
|
94
141
|
}
|
|
95
142
|
|
|
96
143
|
/** The first `limit` visible galleries, page by page, and whether there are more. A page can hold fewer than `PAGE_SIZE` visible galleries, so paging goes by the offset and the total. */
|
|
97
|
-
async function readGalleries(api: WixApi, limit: number): Promise<{ galleries: RawGallery[]; more: boolean }> {
|
|
144
|
+
async function readGalleries(api: WixApi, limit: number, itemsPerGallery: number): Promise<{ galleries: RawGallery[]; more: boolean }> {
|
|
98
145
|
const galleries: RawGallery[] = [];
|
|
99
146
|
let offset = 0, total = Infinity;
|
|
100
147
|
// One more than the section shows, so "more" is known without a second read.
|
|
101
148
|
while (galleries.length <= limit && offset < total && offset < MAX_SCANNED) {
|
|
102
|
-
const page = await readPage(api, offset);
|
|
149
|
+
const page = await readPage(api, offset, itemsPerGallery);
|
|
103
150
|
galleries.push(...page.galleries.filter(visible));
|
|
104
151
|
total = page.total;
|
|
105
152
|
offset += PAGE_SIZE;
|
|
@@ -108,10 +155,11 @@ async function readGalleries(api: WixApi, limit: number): Promise<{ galleries: R
|
|
|
108
155
|
}
|
|
109
156
|
|
|
110
157
|
export function registerGalleriesSection(serviceName: string, options: GalleriesSectionOptions = {}) {
|
|
111
|
-
const
|
|
158
|
+
const collage = options.collage === true;
|
|
159
|
+
const limit = collage ? 1 : Math.min(Math.max(Math.floor(options.limit ?? DEFAULT_LIMIT), 1), MAX_GALLERIES);
|
|
112
160
|
const showName = options.showName !== false;
|
|
113
|
-
const view = (status: GalleriesSectionState["status"], rows: GalleryRow[], more: boolean): GalleriesSectionState => ({
|
|
114
|
-
status, rows,
|
|
161
|
+
const view = (status: GalleriesSectionState["status"], rows: GalleryRow[], more: boolean, tiles: { big: CollageTile[]; small: CollageTile[] } = { big: [], small: [] }): GalleriesSectionState => ({
|
|
162
|
+
status, rows, bigTile: tiles.big, smallTiles: tiles.small, noCollage: !tiles.big.length,
|
|
115
163
|
emptyText: status === "ready" && !rows.length ? copyParam("galleries.sectionEmptyText", "No galleries yet.") : "",
|
|
116
164
|
notLoading: status !== "loading", notErrored: status !== "error",
|
|
117
165
|
noRows: !rows.length, noEmpty: !(status === "ready" && !rows.length),
|
|
@@ -127,13 +175,13 @@ export function registerGalleriesSection(serviceName: string, options: Galleries
|
|
|
127
175
|
if (!(await memberAccess()).signedIn) return view("ready", [], false);
|
|
128
176
|
const api = (globalThis as { himalaya?: { wixApi?: WixApi } }).himalaya?.wixApi;
|
|
129
177
|
if (!api) throw new Error("Wix bridge unavailable");
|
|
130
|
-
const { galleries, more } = await readGalleries(api, limit).catch((oneAppError) => {
|
|
178
|
+
const { galleries, more } = await readGalleries(api, limit, collage ? COLLAGE_TILES : 1).catch((oneAppError) => {
|
|
131
179
|
// As in the source, a list that cannot be read is its "no galleries" state (and it is never replaced by the public list: that one cannot tell a hidden gallery).
|
|
132
180
|
console.warn("galleries_section: the One App galleries service could not be read", oneAppError);
|
|
133
181
|
return { galleries: [] as RawGallery[], more: false };
|
|
134
182
|
});
|
|
135
183
|
const rows = galleries.slice(0, limit).map((gallery, index) => rowOf(gallery, index, showName));
|
|
136
|
-
return view("ready", rows, more);
|
|
184
|
+
return view("ready", rows, more, collage && rows[0] && galleries[0] ? collageOf(galleries[0], rows[0]) : undefined);
|
|
137
185
|
} catch (error) {
|
|
138
186
|
console.warn("galleries_section: the galleries could not be read", error);
|
|
139
187
|
return view("error", [], false);
|