@wix/himalaya-cli 0.1854.0 → 0.1855.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
|
@@ -4449,7 +4449,6 @@ var init_himi_package = __esm({
|
|
|
4449
4449
|
var ICON_VIEW_BOX, ICON_STROKE_WIDTH, ICON_FALLBACK, ICON_CATALOG, ICON_NORMALIZED_INDEX, ICON_NAMES;
|
|
4450
4450
|
var init_icon_catalog_generated = __esm({
|
|
4451
4451
|
"../../core/ts/src/icon-catalog.generated.ts"() {
|
|
4452
|
-
"use strict";
|
|
4453
4452
|
init_define_HHP_CATALOG();
|
|
4454
4453
|
ICON_VIEW_BOX = 24;
|
|
4455
4454
|
ICON_STROKE_WIDTH = 2;
|
|
@@ -42996,7 +42995,6 @@ function shouldRevealError(args) {
|
|
|
42996
42995
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
|
|
42997
42996
|
var init_validation = __esm({
|
|
42998
42997
|
"../../core/ts/src/validation.ts"() {
|
|
42999
|
-
"use strict";
|
|
43000
42998
|
init_define_HHP_CATALOG();
|
|
43001
42999
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
43002
43000
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
@@ -279158,7 +279156,8 @@ var init_generate2 = __esm({
|
|
|
279158
279156
|
return plansSection(id, s5, index, ctx, { planIds: selectedPlanIds(st2), showBenefits: true, ...order ? { order } : {} });
|
|
279159
279157
|
},
|
|
279160
279158
|
// 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
|
|
279161
|
-
// the source's `maxGalleries`.
|
|
279159
|
+
// the source's `maxGalleries`. Like the source, which lists a member's non-hidden, non-empty galleries and shows a visitor (or a list it
|
|
279160
|
+
// 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
|
|
279162
279161
|
// keeps the title and a link, as every data section does.
|
|
279163
279162
|
progallery_carousel_section: (id, s5, st2, index, ctx, sectionId) => {
|
|
279164
279163
|
const asked = typeof st2.maxGalleries === "number" && st2.maxGalleries >= 1 ? Math.floor(st2.maxGalleries) : void 0;
|
|
@@ -225,7 +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_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 |
|
|
228
|
+
| `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
229
|
| `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
230
|
|
|
231
231
|
A screen that cannot follow a setting would show more or other content than the source, so `generate` reports one **gap** per
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1855.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": "17c5a9085e9906a6ec0f17805468d73dd5d39288c05be2330f3bce80"
|
|
86
86
|
}
|
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
// limit -> how many galleries (the source section's `maxGalleries`); `noMore` is false when the site has more,
|
|
3
3
|
// which is when the section's See All button (to the galleries screen) shows.
|
|
4
4
|
// showName -> whether a card shows the gallery's name (the source section's `isShowName`); the accessibility label always has it.
|
|
5
|
-
// The
|
|
5
|
+
// The source reads the One App's own galleries service with the MEMBER's signed instance, never hidden galleries (`withHidden=false`), and
|
|
6
|
+
// drops empty ones; a visitor has no member instance, so the source shows them its "no galleries" state, and so does a failed read. This section
|
|
7
|
+
// does the same, and never falls back to the public Pro Gallery list (`/progallery/v2/galleries`), which has no hidden flag:
|
|
8
|
+
// - a signed-out visitor gets the empty state, without a read;
|
|
9
|
+
// - a member reads that service (`photography-one-app-viewer/galleries`), which a native host reaches;
|
|
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.
|
|
6
11
|
// A page worker registers it under a service name; the descriptor binds `$service:<serviceName>.*` (recipes galleries-carousel / galleries-list).
|
|
7
12
|
import { defineService } from "@himalaya/state";
|
|
8
13
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
9
14
|
import { copyParam, stashCopy, copyTemplate } from "./himi-copy.js";
|
|
15
|
+
import { memberAccess } from "./member-access.js";
|
|
10
16
|
|
|
11
17
|
export interface GalleriesSectionOptions {
|
|
12
18
|
/** How many galleries to show. */
|
|
@@ -37,7 +43,8 @@ export interface GalleriesSectionState {
|
|
|
37
43
|
noMore: boolean;
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
/** The One App's own list: what the source section reads (its `API_BASE_URL` + `/galleries`), as a member, without hidden galleries. */
|
|
47
|
+
const ONE_APP_GALLERIES_URL = "https://www.wix.com/_api/photography-one-app-viewer/galleries";
|
|
41
48
|
const DEFAULT_LIMIT = 10;
|
|
42
49
|
/** The API's page maximum, and the most galleries a section shows (the template's galleries screen caps at 30 too). */
|
|
43
50
|
const PAGE_SIZE = 10, MAX_GALLERIES = 30;
|
|
@@ -45,15 +52,15 @@ const PAGE_SIZE = 10, MAX_GALLERIES = 30;
|
|
|
45
52
|
const CARD_IMAGE = { width: 720, height: 540, quality: 85 };
|
|
46
53
|
|
|
47
54
|
type WixApi = { call: (method: string, path: string) => Promise<unknown> };
|
|
48
|
-
interface
|
|
55
|
+
interface RawItem { mediaUrl?: unknown; dataType?: unknown; videoMetadata?: { posters?: Array<{ url?: unknown }> } }
|
|
56
|
+
/** A gallery of the One App's list. */
|
|
57
|
+
interface RawGallery { id?: unknown; name?: unknown; items?: RawItem[]; totalItemsCount?: unknown; isHidden?: unknown }
|
|
49
58
|
|
|
50
|
-
/** A
|
|
59
|
+
/** A gallery's cover: the first item's picture (a video gives its poster). */
|
|
51
60
|
function coverOf(gallery: RawGallery): string {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const media = info as { url?: unknown; id?: unknown };
|
|
56
|
-
return wixMediaUrl(media.url, CARD_IMAGE) || wixMediaUrl(media.id, CARD_IMAGE);
|
|
61
|
+
const item = Array.isArray(gallery.items) ? gallery.items[0] : undefined;
|
|
62
|
+
const poster = item?.dataType === "Video" ? item.videoMetadata?.posters?.find((p) => typeof p?.url === "string" && p.url)?.url : undefined;
|
|
63
|
+
return wixMediaUrl(poster ?? item?.mediaUrl, CARD_IMAGE);
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
function rowOf(gallery: RawGallery, index: number, showName: boolean): GalleryRow {
|
|
@@ -67,21 +74,37 @@ function rowOf(gallery: RawGallery, index: number, showName: boolean): GalleryRo
|
|
|
67
74
|
};
|
|
68
75
|
}
|
|
69
76
|
|
|
70
|
-
/**
|
|
77
|
+
/** A gallery the section may show: the source drops hidden and empty galleries. An unknown count is not "empty". */
|
|
78
|
+
function visible(gallery: RawGallery): boolean {
|
|
79
|
+
const count = gallery.totalItemsCount;
|
|
80
|
+
return typeof gallery.id === "string" && !!gallery.id && gallery.isHidden !== true && !(typeof count === "number" && count <= 0);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The most galleries one read looks through while it fills the section: the source's own cap on a list. */
|
|
84
|
+
const MAX_SCANNED = 200;
|
|
85
|
+
|
|
86
|
+
/** 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
|
+
* `{ 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=1&offset=${offset}&limit=${PAGE_SIZE}&withHidden=false&useNew=true`);
|
|
90
|
+
const body = (res as { data?: unknown } | null)?.data ?? res;
|
|
91
|
+
const { galleries, totalGalleriesCount } = (body ?? {}) as { galleries?: unknown; totalGalleriesCount?: unknown };
|
|
92
|
+
if (!Array.isArray(galleries) || typeof totalGalleriesCount !== "number") throw new Error("Malformed One App galleries response");
|
|
93
|
+
return { galleries, total: totalGalleriesCount };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 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. */
|
|
71
97
|
async function readGalleries(api: WixApi, limit: number): Promise<{ galleries: RawGallery[]; more: boolean }> {
|
|
72
98
|
const galleries: RawGallery[] = [];
|
|
73
|
-
let total
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
total = res?.totalGalleries;
|
|
81
|
-
if (page.length < size) break;
|
|
99
|
+
let offset = 0, total = Infinity;
|
|
100
|
+
// One more than the section shows, so "more" is known without a second read.
|
|
101
|
+
while (galleries.length <= limit && offset < total && offset < MAX_SCANNED) {
|
|
102
|
+
const page = await readPage(api, offset);
|
|
103
|
+
galleries.push(...page.galleries.filter(visible));
|
|
104
|
+
total = page.total;
|
|
105
|
+
offset += PAGE_SIZE;
|
|
82
106
|
}
|
|
83
|
-
|
|
84
|
-
return { galleries, more: typeof total === "number" ? total > galleries.length : galleries.length >= limit };
|
|
107
|
+
return { galleries: galleries.slice(0, limit), more: galleries.length > limit || (offset < total && offset >= MAX_SCANNED) };
|
|
85
108
|
}
|
|
86
109
|
|
|
87
110
|
export function registerGalleriesSection(serviceName: string, options: GalleriesSectionOptions = {}) {
|
|
@@ -100,10 +123,16 @@ export function registerGalleriesSection(serviceName: string, options: Galleries
|
|
|
100
123
|
load: async (_state, arg) => {
|
|
101
124
|
stashCopy(arg);
|
|
102
125
|
try {
|
|
126
|
+
// The source reads as the member: a visitor has no instance for it and sees its "no galleries" state.
|
|
127
|
+
if (!(await memberAccess()).signedIn) return view("ready", [], false);
|
|
103
128
|
const api = (globalThis as { himalaya?: { wixApi?: WixApi } }).himalaya?.wixApi;
|
|
104
129
|
if (!api) throw new Error("Wix bridge unavailable");
|
|
105
|
-
const { galleries, more } = await readGalleries(api, limit)
|
|
106
|
-
|
|
130
|
+
const { galleries, more } = await readGalleries(api, limit).catch((oneAppError) => {
|
|
131
|
+
// 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
|
+
console.warn("galleries_section: the One App galleries service could not be read", oneAppError);
|
|
133
|
+
return { galleries: [] as RawGallery[], more: false };
|
|
134
|
+
});
|
|
135
|
+
const rows = galleries.slice(0, limit).map((gallery, index) => rowOf(gallery, index, showName));
|
|
107
136
|
return view("ready", rows, more);
|
|
108
137
|
} catch (error) {
|
|
109
138
|
console.warn("galleries_section: the galleries could not be read", error);
|