@wix/himalaya-cli 0.1036.0 → 0.1037.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 (46) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/portfolio/src/index.d.ts +46 -9
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-portfolio.mjs +14 -2
  3. package/dist/cli.mjs +476 -109
  4. package/dist/preview-assets.generated.bin +0 -0
  5. package/fixtures/wix-canned.json +51 -2
  6. package/guides/sdk-reference.json +16 -10
  7. package/guides/wix-business-context.md +13 -1
  8. package/guides/wix-site-to-himi-app.md +10 -1
  9. package/package.json +2 -2
  10. package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +14 -8
  11. package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +12 -1
  12. package/templates/beauty-salon-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  13. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  14. package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +14 -8
  15. package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +12 -1
  16. package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio/index.ts +2 -2
  17. package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio-project/index.ts +3 -3
  18. package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +12 -1
  19. package/templates/community-club-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  20. package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +12 -1
  21. package/templates/events-meetups-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  22. package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +14 -8
  23. package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +12 -1
  24. package/templates/gym-fitness-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  25. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  26. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +12 -1
  27. package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  28. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  29. package/templates/owner-lite/tier5-src/_shared/owner-module-data.ts +2 -2
  30. package/templates/owner-lite/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  31. package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +12 -1
  32. package/templates/podcast-creator-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  33. package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +12 -1
  34. package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio/index.ts +2 -2
  35. package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio-project/index.ts +3 -3
  36. package/templates/portfolio-creative-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  37. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  38. package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +12 -1
  39. package/templates/restaurant-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  40. package/templates/restaurant-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
  41. package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +12 -1
  42. package/templates/retail-store-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  43. package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +14 -8
  44. package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +12 -1
  45. package/templates/yoga-studio-owner/tier5-src/_shared/owner-module-data.ts +2 -2
  46. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-appointments/index.ts +4 -1
@@ -5,12 +5,36 @@ declare global {
5
5
  };
6
6
  };
7
7
  }
8
+ /** A Wix Portfolio media image — a project / collection cover or a project item's image. */
9
+ export interface WixMediaImage {
10
+ type?: string;
11
+ imageInfo?: {
12
+ id?: string;
13
+ url?: string;
14
+ width?: number;
15
+ height?: number;
16
+ };
17
+ }
18
+ /**
19
+ * The Wix media reference of a Portfolio cover or item image — its `imageInfo.url`, else
20
+ * its `imageInfo.id` — for `wixMediaUrl` to resolve and size. `""` when there is none.
21
+ * A bare string is still accepted, so a cover stored as a url string keeps rendering.
22
+ *
23
+ * @example
24
+ * const image = wixMediaUrl(portfolioCoverRef(project.coverImage));
25
+ */
26
+ export declare function portfolioCoverRef(cover: WixMediaImage | string | null | undefined): string;
8
27
  export interface WixPortfolioProject {
9
28
  id: string;
10
29
  title?: string;
11
30
  description?: string;
12
- /** Project cover. coverImage is a Wix media url/id. */
13
- coverImage?: string;
31
+ /**
32
+ * Project cover. The live wire shape is a media OBJECT
33
+ * (`{type:"WIX_MEDIA", imageInfo:{id,url,width,height}}`), not a url string —
34
+ * read it with {@link portfolioCoverRef}; `wixMediaUrl` returns `""` for the object.
35
+ * A url string is still accepted, for projects constructed by hand.
36
+ */
37
+ coverImage?: WixMediaImage | string;
14
38
  slug?: string;
15
39
  hidden?: boolean;
16
40
  createdDate?: string;
@@ -28,12 +52,6 @@ export interface WixListProjectsResponse {
28
52
  }
29
53
  /** GET /portfolio/v1/projects — list projects (paged). */
30
54
  export declare function listProjects(limit?: number, cursor?: string): Promise<WixListProjectsResponse>;
31
- export interface WixMediaImage {
32
- imageInfo?: {
33
- id?: string;
34
- url?: string;
35
- };
36
- }
37
55
  export interface WixPortfolioCollection {
38
56
  id: string;
39
57
  title?: string;
@@ -72,6 +90,10 @@ export interface WixPortfolioProjectItem {
72
90
  }
73
91
  export interface WixListProjectItemsResponse {
74
92
  items?: WixPortfolioProjectItem[];
93
+ /**
94
+ * Paging, under the name this function always documented. A Wix query reports it as
95
+ * `metadata`; {@link listProjectItems} copies that here when `pagingMetadata` is absent.
96
+ */
75
97
  pagingMetadata?: {
76
98
  count?: number;
77
99
  cursors?: {
@@ -79,6 +101,21 @@ export interface WixListProjectItemsResponse {
79
101
  };
80
102
  hasNext?: boolean;
81
103
  };
104
+ /** The query endpoint's own name for the paging block. */
105
+ metadata?: {
106
+ count?: number;
107
+ cursors?: {
108
+ next?: string;
109
+ };
110
+ hasNext?: boolean;
111
+ };
82
112
  }
83
- /** GET /portfolio/v1/projects/{projectId}/items — list a project's items. */
113
+ /**
114
+ * POST /portfolio/v1/items/query — list a project's items.
115
+ *
116
+ * A first page filters on `projectId` with `paging.limit`. Passing a `cursor` (a previous
117
+ * page's `pagingMetadata.cursors.next`) switches to `cursorPaging` and drops the filter,
118
+ * because a Wix query cursor already carries it. Items come back in the order Wix returns
119
+ * them — sort on `sortOrder` for the author's order.
120
+ */
84
121
  export declare function listProjectItems(projectId: string, limit?: number, cursor?: string): Promise<WixListProjectItemsResponse>;
@@ -10,6 +10,14 @@ function wixCall(method, path, body) {
10
10
  }
11
11
  return globalThis.himalaya.wixApi.call(method, path, body);
12
12
  }
13
+ function portfolioCoverRef(cover) {
14
+ if (typeof cover === "string") return cover.trim();
15
+ if (!cover || typeof cover !== "object") return "";
16
+ const info = cover.imageInfo;
17
+ const url = typeof info?.url === "string" ? info.url.trim() : "";
18
+ if (url) return url;
19
+ return typeof info?.id === "string" ? info.id.trim() : "";
20
+ }
13
21
  function listProjects(limit = 100, cursor) {
14
22
  return wixCall("GET", `/portfolio/v1/projects?${pagingQuery(limit, cursor)}`);
15
23
  }
@@ -17,11 +25,15 @@ function listCollections(limit = 100, cursor) {
17
25
  return wixCall("GET", `/portfolio/v1/collections?${pagingQuery(limit, cursor)}`);
18
26
  }
19
27
  function listProjectItems(projectId, limit = 100, cursor) {
20
- return wixCall("GET", `/portfolio/v1/projects/${encodeURIComponent(projectId)}/items?${pagingQuery(limit, cursor)}`);
28
+ const query = cursor ? { cursorPaging: { limit, cursor } } : { filter: { projectId }, paging: { limit } };
29
+ return wixCall("POST", "/portfolio/v1/items/query", { query }).then(
30
+ (response) => response && !response.pagingMetadata && response.metadata ? { ...response, pagingMetadata: response.metadata } : response
31
+ );
21
32
  }
22
33
  export {
23
34
  listCollections,
24
35
  listProjectItems,
25
- listProjects
36
+ listProjects,
37
+ portfolioCoverRef
26
38
  };
27
39
  //# sourceMappingURL=wix-portfolio.mjs.map