@wix/himalaya-cli 0.1386.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.
Files changed (71) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/display.d.ts +66 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/video/src/index.d.ts +185 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-auth.mjs +9 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-video.mjs +324 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/package.json +4 -0
  6. package/dist/cli.mjs +1249 -491
  7. package/guides/branded-lite-site-binding.md +12 -5
  8. package/guides/himi-json-output.md +12 -2
  9. package/guides/iap-products.md +91 -11
  10. package/guides/importable-sdks.md +1 -0
  11. package/guides/sdk-reference.json +253 -0
  12. package/package.json +2 -2
  13. package/templates/beauty-salon/README.md +8 -3
  14. package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +1 -1
  15. package/templates/beauty-salon/tier5-src/_shared/video-caption.ts +21 -0
  16. package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +31 -1
  17. package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +1 -1
  18. package/templates/branded-lite/README.md +8 -3
  19. package/templates/branded-lite/dev/index.ts +982 -16
  20. package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +1 -1
  21. package/templates/branded-lite/tier5-src/_shared/video-caption.ts +21 -0
  22. package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +31 -1
  23. package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +23 -32
  24. package/templates/branded-lite/tier5-src/himi-branded-lite-videos/index.ts +44 -38
  25. package/templates/community-club/README.md +8 -3
  26. package/templates/community-club/tier5-src/_shared/collection-contract.ts +1 -1
  27. package/templates/community-club/tier5-src/_shared/video-caption.ts +21 -0
  28. package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +31 -1
  29. package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +1 -1
  30. package/templates/events-meetups/README.md +8 -3
  31. package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +1 -1
  32. package/templates/events-meetups/tier5-src/_shared/video-caption.ts +21 -0
  33. package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +31 -1
  34. package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +1 -1
  35. package/templates/gym-fitness/README.md +8 -3
  36. package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +1 -1
  37. package/templates/gym-fitness/tier5-src/_shared/video-caption.ts +21 -0
  38. package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +31 -1
  39. package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +1 -1
  40. package/templates/nonprofit-cause/README.md +8 -3
  41. package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +1 -1
  42. package/templates/nonprofit-cause/tier5-src/_shared/video-caption.ts +21 -0
  43. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +31 -1
  44. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +1 -1
  45. package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +1 -1
  46. package/templates/podcast-creator/README.md +8 -3
  47. package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +1 -1
  48. package/templates/podcast-creator/tier5-src/_shared/video-caption.ts +21 -0
  49. package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +31 -1
  50. package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +1 -1
  51. package/templates/portfolio-creative/README.md +8 -3
  52. package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +1 -1
  53. package/templates/portfolio-creative/tier5-src/_shared/video-caption.ts +21 -0
  54. package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +31 -1
  55. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +1 -1
  56. package/templates/restaurant/README.md +8 -3
  57. package/templates/restaurant/tier5-src/_shared/collection-contract.ts +1 -1
  58. package/templates/restaurant/tier5-src/_shared/video-caption.ts +21 -0
  59. package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +31 -1
  60. package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +1 -1
  61. package/templates/retail-store/README.md +8 -3
  62. package/templates/retail-store/tier5-src/_shared/collection-contract.ts +1 -1
  63. package/templates/retail-store/tier5-src/_shared/video-caption.ts +21 -0
  64. package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +31 -1
  65. package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +1 -1
  66. package/templates/yoga-studio/README.md +8 -3
  67. package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +1 -1
  68. package/templates/yoga-studio/tier5-src/_shared/video-caption.ts +21 -0
  69. package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +31 -1
  70. package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +1 -1
  71. package/templates/branded-lite/tier5-src/_shared/vod.ts +0 -71
@@ -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
- }