@wix/himalaya-cli 0.1387.0 → 0.1388.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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/display.d.ts +66 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/index.d.ts +185 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-video.mjs +324 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
- package/dist/cli.mjs +5 -2
- package/guides/importable-sdks.md +1 -0
- package/guides/sdk-reference.json +253 -0
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/beauty-salon/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/branded-lite/dev/index.ts +982 -16
- package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/branded-lite/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +23 -32
- package/templates/branded-lite/tier5-src/himi-branded-lite-videos/index.ts +44 -38
- package/templates/community-club/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/community-club/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/events-meetups/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/gym-fitness/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/nonprofit-cause/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/podcast-creator/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/portfolio-creative/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/restaurant/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/restaurant/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/retail-store/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/retail-store/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/yoga-studio/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +31 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +1 -1
- package/templates/branded-lite/tier5-src/_shared/vod.ts +0 -71
|
@@ -22,12 +22,18 @@ import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
|
22
22
|
import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-saved.js";
|
|
23
23
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
24
24
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
25
|
+
import { isWixVideoWebRefusal, listLatestVideos, videoCard, type WixVideoCard } from "@himalaya/wix-video";
|
|
26
|
+
import { videoCaptionOf, withCaption, type CaptionFlags } from "../_shared/video-caption.js";
|
|
25
27
|
|
|
26
28
|
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
27
29
|
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
28
30
|
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
29
31
|
let feedSurfaceRefused = false;
|
|
30
32
|
|
|
33
|
+
/** The same latch for Wix Video: its gateway is reachable from the native apps only, so a
|
|
34
|
+
* web bridge's refusal is permanent for this boot and the rail stays collapsed. */
|
|
35
|
+
let videoSurfaceRefused = false;
|
|
36
|
+
|
|
31
37
|
/** True for the one refusal that can never change while the app keeps running: the web
|
|
32
38
|
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
33
39
|
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
@@ -292,6 +298,10 @@ interface State {
|
|
|
292
298
|
noNextEvent: boolean;
|
|
293
299
|
homePrograms: ProgramCard[];
|
|
294
300
|
noHomePrograms: boolean;
|
|
301
|
+
/** The videos module's carousel — the newest ready Wix Video videos, the channels
|
|
302
|
+
* taking turns. Guarded on `videos`; same silent-fail contract. */
|
|
303
|
+
homeVideos: (WixVideoCard & CaptionFlags)[];
|
|
304
|
+
noHomeVideos: boolean;
|
|
295
305
|
feedHighlights: FeedHighlight[];
|
|
296
306
|
noFeedHighlights: boolean;
|
|
297
307
|
/** communityPulse member strip — the author directory of the SAME feed read
|
|
@@ -529,6 +539,7 @@ interface ExtrasSignal {
|
|
|
529
539
|
upcomingEvents: EventEntry[];
|
|
530
540
|
nextEventCards: NextEventCard[];
|
|
531
541
|
homePrograms: ProgramCard[];
|
|
542
|
+
homeVideos: (WixVideoCard & CaptionFlags)[];
|
|
532
543
|
feedHighlights: FeedHighlight[];
|
|
533
544
|
memberAvatars: CoachAvatar[];
|
|
534
545
|
groupCards: GroupCard[];
|
|
@@ -539,7 +550,7 @@ interface ExtrasSignal {
|
|
|
539
550
|
}
|
|
540
551
|
|
|
541
552
|
function emptyExtrasSignal(): ExtrasSignal {
|
|
542
|
-
return { upcomingEvents: [], nextEventCards: [], homePrograms: [], feedHighlights: [], memberAvatars: [], groupCards: [], announcementTitle: "", postCards: [], popularDishes: [], menuCategories: [] };
|
|
553
|
+
return { upcomingEvents: [], nextEventCards: [], homePrograms: [], homeVideos: [], feedHighlights: [], memberAvatars: [], groupCards: [], announcementTitle: "", postCards: [], popularDishes: [], menuCategories: [] };
|
|
543
554
|
}
|
|
544
555
|
|
|
545
556
|
/** Cover URL probe for a blog post — the himi-blog-feed imageUrl fallbacks
|
|
@@ -679,6 +690,18 @@ async function fetchHomePrograms(): Promise<ProgramCard[]> {
|
|
|
679
690
|
}
|
|
680
691
|
}
|
|
681
692
|
|
|
693
|
+
/** ONE Wix Video read for the videos module. A failure collapses the module; the web
|
|
694
|
+
* bridges' refusal of the gateway also latches it off for the rest of this boot. */
|
|
695
|
+
async function fetchHomeVideos(): Promise<WixVideoCard[]> {
|
|
696
|
+
try {
|
|
697
|
+
const untitled = copyParam("home.videoFallbackTitle", "Video");
|
|
698
|
+
return (await listLatestVideos({ limit: 8 })).map((entry) => videoCard(entry, untitled));
|
|
699
|
+
} catch (error) {
|
|
700
|
+
if (isWixVideoWebRefusal(error)) videoSurfaceRefused = true;
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
682
705
|
function homeFeedText(item: WixFeedItem): string {
|
|
683
706
|
const blocks = item.content?.blocks;
|
|
684
707
|
if (Array.isArray(blocks)) {
|
|
@@ -731,6 +754,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
731
754
|
if (verticals.includes("programs")) {
|
|
732
755
|
jobs.push(fetchHomePrograms().then((cards) => { extras.homePrograms = cards; }));
|
|
733
756
|
}
|
|
757
|
+
if (verticals.includes("videos") && !videoSurfaceRefused) {
|
|
758
|
+
const caption = videoCaptionOf(paramValue(arg, "videoCaption"));
|
|
759
|
+
jobs.push(fetchHomeVideos().then((cards) => { extras.homeVideos = withCaption(cards, caption); }));
|
|
760
|
+
}
|
|
734
761
|
if (verticals.includes("blog")) {
|
|
735
762
|
// ONE limit-8 posts query feeds BOTH the communityPulse announcement
|
|
736
763
|
// (posts[0].title — the frozen contract) and the showcaseFirst/episodeFirst
|
|
@@ -847,6 +874,7 @@ function derive(state: State): State {
|
|
|
847
874
|
noUpcomingEvents: state.upcomingEvents.length === 0,
|
|
848
875
|
noNextEvent: state.nextEventCards.length === 0,
|
|
849
876
|
noHomePrograms: state.homePrograms.length === 0,
|
|
877
|
+
noHomeVideos: state.homeVideos.length === 0,
|
|
850
878
|
noFeedHighlights: state.feedHighlights.length === 0,
|
|
851
879
|
noMemberAvatars: state.memberAvatars.length === 0,
|
|
852
880
|
noGroupCards: state.groupCards.length === 0,
|
|
@@ -938,6 +966,8 @@ function baseState(): State {
|
|
|
938
966
|
noNextEvent: true,
|
|
939
967
|
homePrograms: [],
|
|
940
968
|
noHomePrograms: true,
|
|
969
|
+
homeVideos: [],
|
|
970
|
+
noHomeVideos: true,
|
|
941
971
|
feedHighlights: [],
|
|
942
972
|
noFeedHighlights: true,
|
|
943
973
|
memberAvatars: [],
|
|
@@ -98,7 +98,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
98
98
|
himiBrandedBadges: { rows: 'badges', title: 'name', subtitle: 'description', view: 'grid' },
|
|
99
99
|
himiBrandedDonations: { rows: 'campaigns', title: 'name', subtitle: 'description', view: 'grid', primaryVerb: { label: 'Donate' } },
|
|
100
100
|
himiBrandedGiftCards: { rows: 'cards', title: 'name', subtitle: 'description', view: 'grid' },
|
|
101
|
-
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: '
|
|
101
|
+
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: 'subtitle', image: 'coverUrl', view: 'grid', searchPlaceholder: 'Search channels', countNoun: ['channel', 'channels'] },
|
|
102
102
|
himiBrandedPodcasts: { rows: 'episodes', title: 'title', subtitle: 'subtitle', image: 'image', metadata: ['progressLabel'], view: 'list' },
|
|
103
103
|
himiBrandedForms: { rows: 'forms', title: 'name', subtitle: 'description', view: 'list' },
|
|
104
104
|
himiBrandedGalleries: { rows: 'galleries', title: 'name', subtitle: 'description', image: 'image', view: 'grid' },
|
|
@@ -98,7 +98,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
98
98
|
himiBrandedBadges: { rows: 'badges', title: 'name', subtitle: 'description', view: 'grid' },
|
|
99
99
|
himiBrandedDonations: { rows: 'campaigns', title: 'name', subtitle: 'description', view: 'grid', primaryVerb: { label: 'Donate' } },
|
|
100
100
|
himiBrandedGiftCards: { rows: 'cards', title: 'name', subtitle: 'description', view: 'grid' },
|
|
101
|
-
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: '
|
|
101
|
+
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: 'subtitle', image: 'coverUrl', view: 'grid', searchPlaceholder: 'Search channels', countNoun: ['channel', 'channels'] },
|
|
102
102
|
himiBrandedPodcasts: { rows: 'episodes', title: 'title', subtitle: 'subtitle', image: 'image', metadata: ['progressLabel'], view: 'list' },
|
|
103
103
|
himiBrandedForms: { rows: 'forms', title: 'name', subtitle: 'description', view: 'list' },
|
|
104
104
|
himiBrandedGalleries: { rows: 'galleries', title: 'name', subtitle: 'description', image: 'image', view: 'grid' },
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The video carousel's two looks: the caption ON the cover (a brand label chip over the
|
|
2
|
+
// image) or UNDER it. Every slide carries both placements; the descriptor's
|
|
3
|
+
// `videoCaption` appear param picks one, and these flags hide the other
|
|
4
|
+
// (`hiddenWhen` hides on TRUE). So a screen switches look by changing ONE param,
|
|
5
|
+
// with no second carousel and no change to the slide tree.
|
|
6
|
+
export type VideoCaption = "overlay" | "below";
|
|
7
|
+
|
|
8
|
+
/** The placement a param asks for. Anything but "below" is the default, "overlay". */
|
|
9
|
+
export function videoCaptionOf(value: unknown): VideoCaption {
|
|
10
|
+
return value === "below" ? "below" : "overlay";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CaptionFlags {
|
|
14
|
+
captionOnImage: boolean;
|
|
15
|
+
captionBelow: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Stamp each card with the gates its slide reads (`$item.captionOnImage` / `$item.captionBelow`). */
|
|
19
|
+
export function withCaption<T extends object>(cards: T[], caption: VideoCaption): (T & CaptionFlags)[] {
|
|
20
|
+
return cards.map((card) => ({ ...card, captionOnImage: caption === "overlay", captionBelow: caption === "below" }));
|
|
21
|
+
}
|
|
@@ -22,12 +22,18 @@ import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
|
22
22
|
import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-saved.js";
|
|
23
23
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
24
24
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
25
|
+
import { isWixVideoWebRefusal, listLatestVideos, videoCard, type WixVideoCard } from "@himalaya/wix-video";
|
|
26
|
+
import { videoCaptionOf, withCaption, type CaptionFlags } from "../_shared/video-caption.js";
|
|
25
27
|
|
|
26
28
|
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
27
29
|
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
28
30
|
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
29
31
|
let feedSurfaceRefused = false;
|
|
30
32
|
|
|
33
|
+
/** The same latch for Wix Video: its gateway is reachable from the native apps only, so a
|
|
34
|
+
* web bridge's refusal is permanent for this boot and the rail stays collapsed. */
|
|
35
|
+
let videoSurfaceRefused = false;
|
|
36
|
+
|
|
31
37
|
/** True for the one refusal that can never change while the app keeps running: the web
|
|
32
38
|
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
33
39
|
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
@@ -292,6 +298,10 @@ interface State {
|
|
|
292
298
|
noNextEvent: boolean;
|
|
293
299
|
homePrograms: ProgramCard[];
|
|
294
300
|
noHomePrograms: boolean;
|
|
301
|
+
/** The videos module's carousel — the newest ready Wix Video videos, the channels
|
|
302
|
+
* taking turns. Guarded on `videos`; same silent-fail contract. */
|
|
303
|
+
homeVideos: (WixVideoCard & CaptionFlags)[];
|
|
304
|
+
noHomeVideos: boolean;
|
|
295
305
|
feedHighlights: FeedHighlight[];
|
|
296
306
|
noFeedHighlights: boolean;
|
|
297
307
|
/** communityPulse member strip — the author directory of the SAME feed read
|
|
@@ -529,6 +539,7 @@ interface ExtrasSignal {
|
|
|
529
539
|
upcomingEvents: EventEntry[];
|
|
530
540
|
nextEventCards: NextEventCard[];
|
|
531
541
|
homePrograms: ProgramCard[];
|
|
542
|
+
homeVideos: (WixVideoCard & CaptionFlags)[];
|
|
532
543
|
feedHighlights: FeedHighlight[];
|
|
533
544
|
memberAvatars: CoachAvatar[];
|
|
534
545
|
groupCards: GroupCard[];
|
|
@@ -539,7 +550,7 @@ interface ExtrasSignal {
|
|
|
539
550
|
}
|
|
540
551
|
|
|
541
552
|
function emptyExtrasSignal(): ExtrasSignal {
|
|
542
|
-
return { upcomingEvents: [], nextEventCards: [], homePrograms: [], feedHighlights: [], memberAvatars: [], groupCards: [], announcementTitle: "", postCards: [], popularDishes: [], menuCategories: [] };
|
|
553
|
+
return { upcomingEvents: [], nextEventCards: [], homePrograms: [], homeVideos: [], feedHighlights: [], memberAvatars: [], groupCards: [], announcementTitle: "", postCards: [], popularDishes: [], menuCategories: [] };
|
|
543
554
|
}
|
|
544
555
|
|
|
545
556
|
/** Cover URL probe for a blog post — the himi-blog-feed imageUrl fallbacks
|
|
@@ -679,6 +690,18 @@ async function fetchHomePrograms(): Promise<ProgramCard[]> {
|
|
|
679
690
|
}
|
|
680
691
|
}
|
|
681
692
|
|
|
693
|
+
/** ONE Wix Video read for the videos module. A failure collapses the module; the web
|
|
694
|
+
* bridges' refusal of the gateway also latches it off for the rest of this boot. */
|
|
695
|
+
async function fetchHomeVideos(): Promise<WixVideoCard[]> {
|
|
696
|
+
try {
|
|
697
|
+
const untitled = copyParam("home.videoFallbackTitle", "Video");
|
|
698
|
+
return (await listLatestVideos({ limit: 8 })).map((entry) => videoCard(entry, untitled));
|
|
699
|
+
} catch (error) {
|
|
700
|
+
if (isWixVideoWebRefusal(error)) videoSurfaceRefused = true;
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
682
705
|
function homeFeedText(item: WixFeedItem): string {
|
|
683
706
|
const blocks = item.content?.blocks;
|
|
684
707
|
if (Array.isArray(blocks)) {
|
|
@@ -731,6 +754,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
731
754
|
if (verticals.includes("programs")) {
|
|
732
755
|
jobs.push(fetchHomePrograms().then((cards) => { extras.homePrograms = cards; }));
|
|
733
756
|
}
|
|
757
|
+
if (verticals.includes("videos") && !videoSurfaceRefused) {
|
|
758
|
+
const caption = videoCaptionOf(paramValue(arg, "videoCaption"));
|
|
759
|
+
jobs.push(fetchHomeVideos().then((cards) => { extras.homeVideos = withCaption(cards, caption); }));
|
|
760
|
+
}
|
|
734
761
|
if (verticals.includes("blog")) {
|
|
735
762
|
// ONE limit-8 posts query feeds BOTH the communityPulse announcement
|
|
736
763
|
// (posts[0].title — the frozen contract) and the showcaseFirst/episodeFirst
|
|
@@ -847,6 +874,7 @@ function derive(state: State): State {
|
|
|
847
874
|
noUpcomingEvents: state.upcomingEvents.length === 0,
|
|
848
875
|
noNextEvent: state.nextEventCards.length === 0,
|
|
849
876
|
noHomePrograms: state.homePrograms.length === 0,
|
|
877
|
+
noHomeVideos: state.homeVideos.length === 0,
|
|
850
878
|
noFeedHighlights: state.feedHighlights.length === 0,
|
|
851
879
|
noMemberAvatars: state.memberAvatars.length === 0,
|
|
852
880
|
noGroupCards: state.groupCards.length === 0,
|
|
@@ -938,6 +966,8 @@ function baseState(): State {
|
|
|
938
966
|
noNextEvent: true,
|
|
939
967
|
homePrograms: [],
|
|
940
968
|
noHomePrograms: true,
|
|
969
|
+
homeVideos: [],
|
|
970
|
+
noHomeVideos: true,
|
|
941
971
|
feedHighlights: [],
|
|
942
972
|
noFeedHighlights: true,
|
|
943
973
|
memberAvatars: [],
|
|
@@ -98,7 +98,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
98
98
|
himiBrandedBadges: { rows: 'badges', title: 'name', subtitle: 'description', view: 'grid' },
|
|
99
99
|
himiBrandedDonations: { rows: 'campaigns', title: 'name', subtitle: 'description', view: 'grid', primaryVerb: { label: 'Donate' } },
|
|
100
100
|
himiBrandedGiftCards: { rows: 'cards', title: 'name', subtitle: 'description', view: 'grid' },
|
|
101
|
-
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: '
|
|
101
|
+
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: 'subtitle', image: 'coverUrl', view: 'grid', searchPlaceholder: 'Search channels', countNoun: ['channel', 'channels'] },
|
|
102
102
|
himiBrandedPodcasts: { rows: 'episodes', title: 'title', subtitle: 'subtitle', image: 'image', metadata: ['progressLabel'], view: 'list' },
|
|
103
103
|
himiBrandedForms: { rows: 'forms', title: 'name', subtitle: 'description', view: 'list' },
|
|
104
104
|
himiBrandedGalleries: { rows: 'galleries', title: 'name', subtitle: 'description', image: 'image', view: 'grid' },
|
|
@@ -98,7 +98,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
98
98
|
himiBrandedBadges: { rows: 'badges', title: 'name', subtitle: 'description', view: 'grid' },
|
|
99
99
|
himiBrandedDonations: { rows: 'campaigns', title: 'name', subtitle: 'description', view: 'grid', primaryVerb: { label: 'Donate' } },
|
|
100
100
|
himiBrandedGiftCards: { rows: 'cards', title: 'name', subtitle: 'description', view: 'grid' },
|
|
101
|
-
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: '
|
|
101
|
+
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: 'subtitle', image: 'coverUrl', view: 'grid', searchPlaceholder: 'Search channels', countNoun: ['channel', 'channels'] },
|
|
102
102
|
himiBrandedPodcasts: { rows: 'episodes', title: 'title', subtitle: 'subtitle', image: 'image', metadata: ['progressLabel'], view: 'list' },
|
|
103
103
|
himiBrandedForms: { rows: 'forms', title: 'name', subtitle: 'description', view: 'list' },
|
|
104
104
|
himiBrandedGalleries: { rows: 'galleries', title: 'name', subtitle: 'description', image: 'image', view: 'grid' },
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The video carousel's two looks: the caption ON the cover (a brand label chip over the
|
|
2
|
+
// image) or UNDER it. Every slide carries both placements; the descriptor's
|
|
3
|
+
// `videoCaption` appear param picks one, and these flags hide the other
|
|
4
|
+
// (`hiddenWhen` hides on TRUE). So a screen switches look by changing ONE param,
|
|
5
|
+
// with no second carousel and no change to the slide tree.
|
|
6
|
+
export type VideoCaption = "overlay" | "below";
|
|
7
|
+
|
|
8
|
+
/** The placement a param asks for. Anything but "below" is the default, "overlay". */
|
|
9
|
+
export function videoCaptionOf(value: unknown): VideoCaption {
|
|
10
|
+
return value === "below" ? "below" : "overlay";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CaptionFlags {
|
|
14
|
+
captionOnImage: boolean;
|
|
15
|
+
captionBelow: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Stamp each card with the gates its slide reads (`$item.captionOnImage` / `$item.captionBelow`). */
|
|
19
|
+
export function withCaption<T extends object>(cards: T[], caption: VideoCaption): (T & CaptionFlags)[] {
|
|
20
|
+
return cards.map((card) => ({ ...card, captionOnImage: caption === "overlay", captionBelow: caption === "below" }));
|
|
21
|
+
}
|
|
@@ -22,12 +22,18 @@ import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
|
22
22
|
import { readSavedProducts, type SavedProduct } from "../_shared/himi-store-saved.js";
|
|
23
23
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
24
24
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
25
|
+
import { isWixVideoWebRefusal, listLatestVideos, videoCard, type WixVideoCard } from "@himalaya/wix-video";
|
|
26
|
+
import { videoCaptionOf, withCaption, type CaptionFlags } from "../_shared/video-caption.js";
|
|
25
27
|
|
|
26
28
|
/** Latched once the member feed is refused because of WHERE the app is running rather
|
|
27
29
|
* than because of the request — see the catch in `loadExtras`. Module scope, so it
|
|
28
30
|
* survives every refresh of this worker and is reset only by a fresh boot. */
|
|
29
31
|
let feedSurfaceRefused = false;
|
|
30
32
|
|
|
33
|
+
/** The same latch for Wix Video: its gateway is reachable from the native apps only, so a
|
|
34
|
+
* web bridge's refusal is permanent for this boot and the rail stays collapsed. */
|
|
35
|
+
let videoSurfaceRefused = false;
|
|
36
|
+
|
|
31
37
|
/** True for the one refusal that can never change while the app keeps running: the web
|
|
32
38
|
* bridge reporting that this host is not reachable from a browser at all. Deliberately
|
|
33
39
|
* narrower than `isBridgeUnavailable` — a 502/503 is an outage worth retrying, and only
|
|
@@ -292,6 +298,10 @@ interface State {
|
|
|
292
298
|
noNextEvent: boolean;
|
|
293
299
|
homePrograms: ProgramCard[];
|
|
294
300
|
noHomePrograms: boolean;
|
|
301
|
+
/** The videos module's carousel — the newest ready Wix Video videos, the channels
|
|
302
|
+
* taking turns. Guarded on `videos`; same silent-fail contract. */
|
|
303
|
+
homeVideos: (WixVideoCard & CaptionFlags)[];
|
|
304
|
+
noHomeVideos: boolean;
|
|
295
305
|
feedHighlights: FeedHighlight[];
|
|
296
306
|
noFeedHighlights: boolean;
|
|
297
307
|
/** communityPulse member strip — the author directory of the SAME feed read
|
|
@@ -529,6 +539,7 @@ interface ExtrasSignal {
|
|
|
529
539
|
upcomingEvents: EventEntry[];
|
|
530
540
|
nextEventCards: NextEventCard[];
|
|
531
541
|
homePrograms: ProgramCard[];
|
|
542
|
+
homeVideos: (WixVideoCard & CaptionFlags)[];
|
|
532
543
|
feedHighlights: FeedHighlight[];
|
|
533
544
|
memberAvatars: CoachAvatar[];
|
|
534
545
|
groupCards: GroupCard[];
|
|
@@ -539,7 +550,7 @@ interface ExtrasSignal {
|
|
|
539
550
|
}
|
|
540
551
|
|
|
541
552
|
function emptyExtrasSignal(): ExtrasSignal {
|
|
542
|
-
return { upcomingEvents: [], nextEventCards: [], homePrograms: [], feedHighlights: [], memberAvatars: [], groupCards: [], announcementTitle: "", postCards: [], popularDishes: [], menuCategories: [] };
|
|
553
|
+
return { upcomingEvents: [], nextEventCards: [], homePrograms: [], homeVideos: [], feedHighlights: [], memberAvatars: [], groupCards: [], announcementTitle: "", postCards: [], popularDishes: [], menuCategories: [] };
|
|
543
554
|
}
|
|
544
555
|
|
|
545
556
|
/** Cover URL probe for a blog post — the himi-blog-feed imageUrl fallbacks
|
|
@@ -679,6 +690,18 @@ async function fetchHomePrograms(): Promise<ProgramCard[]> {
|
|
|
679
690
|
}
|
|
680
691
|
}
|
|
681
692
|
|
|
693
|
+
/** ONE Wix Video read for the videos module. A failure collapses the module; the web
|
|
694
|
+
* bridges' refusal of the gateway also latches it off for the rest of this boot. */
|
|
695
|
+
async function fetchHomeVideos(): Promise<WixVideoCard[]> {
|
|
696
|
+
try {
|
|
697
|
+
const untitled = copyParam("home.videoFallbackTitle", "Video");
|
|
698
|
+
return (await listLatestVideos({ limit: 8 })).map((entry) => videoCard(entry, untitled));
|
|
699
|
+
} catch (error) {
|
|
700
|
+
if (isWixVideoWebRefusal(error)) videoSurfaceRefused = true;
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
682
705
|
function homeFeedText(item: WixFeedItem): string {
|
|
683
706
|
const blocks = item.content?.blocks;
|
|
684
707
|
if (Array.isArray(blocks)) {
|
|
@@ -731,6 +754,10 @@ async function fetchExtrasSignal(arg: unknown): Promise<ExtrasSignal> {
|
|
|
731
754
|
if (verticals.includes("programs")) {
|
|
732
755
|
jobs.push(fetchHomePrograms().then((cards) => { extras.homePrograms = cards; }));
|
|
733
756
|
}
|
|
757
|
+
if (verticals.includes("videos") && !videoSurfaceRefused) {
|
|
758
|
+
const caption = videoCaptionOf(paramValue(arg, "videoCaption"));
|
|
759
|
+
jobs.push(fetchHomeVideos().then((cards) => { extras.homeVideos = withCaption(cards, caption); }));
|
|
760
|
+
}
|
|
734
761
|
if (verticals.includes("blog")) {
|
|
735
762
|
// ONE limit-8 posts query feeds BOTH the communityPulse announcement
|
|
736
763
|
// (posts[0].title — the frozen contract) and the showcaseFirst/episodeFirst
|
|
@@ -847,6 +874,7 @@ function derive(state: State): State {
|
|
|
847
874
|
noUpcomingEvents: state.upcomingEvents.length === 0,
|
|
848
875
|
noNextEvent: state.nextEventCards.length === 0,
|
|
849
876
|
noHomePrograms: state.homePrograms.length === 0,
|
|
877
|
+
noHomeVideos: state.homeVideos.length === 0,
|
|
850
878
|
noFeedHighlights: state.feedHighlights.length === 0,
|
|
851
879
|
noMemberAvatars: state.memberAvatars.length === 0,
|
|
852
880
|
noGroupCards: state.groupCards.length === 0,
|
|
@@ -938,6 +966,8 @@ function baseState(): State {
|
|
|
938
966
|
noNextEvent: true,
|
|
939
967
|
homePrograms: [],
|
|
940
968
|
noHomePrograms: true,
|
|
969
|
+
homeVideos: [],
|
|
970
|
+
noHomeVideos: true,
|
|
941
971
|
feedHighlights: [],
|
|
942
972
|
noFeedHighlights: true,
|
|
943
973
|
memberAvatars: [],
|
|
@@ -98,7 +98,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
98
98
|
himiBrandedBadges: { rows: 'badges', title: 'name', subtitle: 'description', view: 'grid' },
|
|
99
99
|
himiBrandedDonations: { rows: 'campaigns', title: 'name', subtitle: 'description', view: 'grid', primaryVerb: { label: 'Donate' } },
|
|
100
100
|
himiBrandedGiftCards: { rows: 'cards', title: 'name', subtitle: 'description', view: 'grid' },
|
|
101
|
-
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: '
|
|
101
|
+
himiBrandedVideos: { rows: 'channels', title: 'title', subtitle: 'subtitle', image: 'coverUrl', view: 'grid', searchPlaceholder: 'Search channels', countNoun: ['channel', 'channels'] },
|
|
102
102
|
himiBrandedPodcasts: { rows: 'episodes', title: 'title', subtitle: 'subtitle', image: 'image', metadata: ['progressLabel'], view: 'list' },
|
|
103
103
|
himiBrandedForms: { rows: 'forms', title: 'name', subtitle: 'description', view: 'list' },
|
|
104
104
|
himiBrandedGalleries: { rows: 'galleries', title: 'name', subtitle: 'description', image: 'image', view: 'grid' },
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// VOD's public GraphQL contract: wix-one-app-vod/src/api/v3/{Channel,Video}Fetch.ts.
|
|
2
|
-
// Always use the host's visitor/member bridge; never use owner credentials here.
|
|
3
|
-
export const VOD_PUBLIC_GRAPHQL = "https://manage.wix.com/_api/vod/public/graphql";
|
|
4
|
-
export interface VodVideo {
|
|
5
|
-
id: string; title?: string; description?: string; source?: string; status?: string;
|
|
6
|
-
content?: { status?: string; externalUrl?: string; externalId?: string };
|
|
7
|
-
pricing?: { type: string; enabled: boolean }[];
|
|
8
|
-
purchase?: { status?: string }; rent_purchase?: { status?: string };
|
|
9
|
-
}
|
|
10
|
-
export interface VodChannel {
|
|
11
|
-
id: string; title?: string;
|
|
12
|
-
pricing?: { type: string; enabled: boolean; required?: boolean }[];
|
|
13
|
-
purchase?: { status?: string; expiresAt?: string };
|
|
14
|
-
}
|
|
15
|
-
export function vodError(message: string, denied = false, signInRequired = false): Error & { denied: boolean; signInRequired: boolean } {
|
|
16
|
-
return Object.assign(new Error(message), { denied, signInRequired });
|
|
17
|
-
}
|
|
18
|
-
export async function vodQuery<T>(query: string, variables: Record<string, unknown>): Promise<T> {
|
|
19
|
-
const api = (globalThis as { himalaya?: { wixApi?: { call: (m: string, p: string, b: unknown) => Promise<unknown> } } }).himalaya?.wixApi;
|
|
20
|
-
if (!api) throw vodError("Wix bridge unavailable");
|
|
21
|
-
const response = await api.call("POST", VOD_PUBLIC_GRAPHQL, { query, variables }) as
|
|
22
|
-
{ data?: T | null; errors?: { message?: string; extensions?: { code?: string } }[] };
|
|
23
|
-
if (response?.errors?.length) {
|
|
24
|
-
const signInRequired = response.errors.some(e => /^UNAUTHENTICATED$|^UNAUTHORIZED$/i.test(e.extensions?.code ?? ""));
|
|
25
|
-
const denied = response.errors.some(e => /FORBIDDEN|UNAUTH|ACCESS_DENIED|PERMISSION_DENIED/i.test(e.extensions?.code ?? ""));
|
|
26
|
-
throw vodError(signInRequired ? "Video unauthenticated" : denied ? "Video access denied" : "VOD query failed", denied, signInRequired);
|
|
27
|
-
}
|
|
28
|
-
const data = response && Object.prototype.hasOwnProperty.call(response, "data") ? response.data : response as T;
|
|
29
|
-
if (!data || typeof data !== "object") throw vodError("Invalid VOD response");
|
|
30
|
-
return data;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function vodPages<T extends { id: string }>(fetchPage: (cursor: string | null) => Promise<{ entities: T[]; cursor?: string | null }>): Promise<T[]> {
|
|
34
|
-
const rows = new Map<string, T>();
|
|
35
|
-
const cursors = new Set<string>();
|
|
36
|
-
let cursor: string | null = null;
|
|
37
|
-
for (let page = 0; page < 200; page++) {
|
|
38
|
-
const result = await fetchPage(cursor);
|
|
39
|
-
if (!result || !Array.isArray(result.entities)) throw vodError("Invalid VOD page");
|
|
40
|
-
for (const row of result.entities) if (row?.id) rows.set(row.id, row);
|
|
41
|
-
if (!result.cursor) return [...rows.values()];
|
|
42
|
-
if (typeof result.cursor !== "string" || cursors.has(result.cursor)) throw vodError("Invalid VOD cursor");
|
|
43
|
-
cursor = result.cursor;
|
|
44
|
-
cursors.add(cursor);
|
|
45
|
-
}
|
|
46
|
-
throw vodError("VOD pagination limit exceeded");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export const CHANNEL_ACCESS_FIELDS = `id title pricing { type enabled required } purchase(filter: {type: SUBSCRIPTION}) { status expiresAt }`;
|
|
50
|
-
export const VIDEO_FIELDS = `id title description source status content { status externalUrl externalId } pricing { type enabled } purchase(filter: {type: SALE}) { status } rent_purchase: purchase(filter: {type: RENT}) { status }`;
|
|
51
|
-
|
|
52
|
-
/** External embeds expose their URL without a play authorization. Fail closed when
|
|
53
|
-
* metadata is missing or a plan's entitlement cannot be established. Hosted videos
|
|
54
|
-
* must ALSO obtain their media URL through play(type: CONTENT). */
|
|
55
|
-
export function videoAccess(channel: VodChannel, video: VodVideo): boolean {
|
|
56
|
-
if (!Array.isArray(channel.pricing) || !Array.isArray(video.pricing)) return false;
|
|
57
|
-
const subscription = channel.purchase;
|
|
58
|
-
const expires = subscription?.expiresAt ? Date.parse(subscription.expiresAt) : undefined;
|
|
59
|
-
const subscribed = subscription?.status === "ACTIVE" && (expires === undefined || expires > Date.now()) ||
|
|
60
|
-
subscription?.status === "CANCELED" && expires !== undefined && expires > Date.now();
|
|
61
|
-
const channelOptions = channel.pricing.filter(p => p.enabled);
|
|
62
|
-
if (channelOptions.some(p => p.required || p.type === "PRICING_PLAN") && !subscribed) return false;
|
|
63
|
-
const paid = video.pricing.some(p => p.enabled);
|
|
64
|
-
return !paid || subscribed || video.purchase?.status === "ACTIVE" || video.rent_purchase?.status === "ACTIVE";
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function youtubeId(video: VodVideo): string {
|
|
68
|
-
// Treat the embed URL as data, not arbitrary WebView HTML or a navigable URL.
|
|
69
|
-
const match = /^https:\/\/(?:(?:www\.|m\.)?youtube\.com|www\.youtube-nocookie\.com)\/embed\/([A-Za-z0-9_-]{11})(?:[?/#]|$)/.exec(video.content?.externalUrl ?? "");
|
|
70
|
-
return match?.[1] ?? (/^[A-Za-z0-9_-]{11}$/.test(video.content?.externalId ?? "") ? video.content!.externalId! : "");
|
|
71
|
-
}
|