@wix/himalaya-cli 0.834.0 → 0.836.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.
@@ -112,18 +112,9 @@ export declare function createService(service: WixServiceWrite): Promise<WixCrea
112
112
  export declare function updateService(serviceId: string, service: WixServiceWrite & {
113
113
  revision?: string;
114
114
  }): Promise<WixUpdateServiceResponse>;
115
- /** Delete a service — DELETE /bookings/v1/services/{id}. */
116
- export declare function deleteService(serviceId: string): Promise<WixDeleteServiceResponse>;
117
- export interface WixListBookingsResponse {
118
- bookings: WixBooking[];
119
- }
120
- /** List bookings — GET /bookings/v1/bookings. */
121
- export declare function listBookings(): Promise<WixListBookingsResponse>;
122
115
  export interface WixGetBookingResponse {
123
116
  booking: WixBooking;
124
117
  }
125
- /** Fetch a single booking by id — GET /bookings/v1/bookings/{id}. */
126
- export declare function getBooking(bookingId: string): Promise<WixGetBookingResponse>;
127
118
  /** Writable fields for creating a booking on behalf of a client. */
128
119
  export interface WixBookingWrite {
129
120
  serviceId?: string;
@@ -136,8 +127,6 @@ export interface WixBookingWrite {
136
127
  export interface WixCreateBookingResponse {
137
128
  booking: WixBooking;
138
129
  }
139
- /** Create a booking on behalf of a client — POST /bookings/v1/bookings. */
140
- export declare function createBooking(booking: WixBookingWrite): Promise<WixCreateBookingResponse>;
141
130
  export interface WixUpdateBookingResponse {
142
131
  booking: WixBooking;
143
132
  }
@@ -187,9 +176,42 @@ export interface WixAvailabilityEntry {
187
176
  export interface WixQueryAvailabilityResponse {
188
177
  availabilityEntries?: WixAvailabilityEntry[];
189
178
  }
190
- /** Query bookable slots for a service in a date window —
191
- * POST /bookings/v1/availability/query. Verified live (571 entries). */
192
- export declare function queryServiceAvailability(serviceId: string, startDate: string, endDate: string): Promise<WixQueryAvailabilityResponse>;
179
+ /** How to bound an availability query. `bookable` is a `query.filter` member — the
180
+ * request's `query` has only `filter` and `sort`, so there is NO paging member and
181
+ * a `paging: { limit }` you add is silently dropped rather than honoured. */
182
+ export interface WixServiceAvailabilityOptions {
183
+ /** Bookable slots only. Defaults to `true`; pass `false` to get the unbookable
184
+ * ones too (a greyed-out calendar), which is what the endpoint returns unfiltered. */
185
+ bookable?: boolean;
186
+ }
187
+ /**
188
+ * Query bookable slots for a service in a date window —
189
+ * POST /bookings/v1/availability/query. Verified live (571 entries).
190
+ *
191
+ * BOUND IT. Unfiltered, this returns every slot in the window, bookable AND
192
+ * unbookable — a two-week window on a busy calendar is hundreds of entries and a
193
+ * response big enough to stall a worker. Two things bound it, and only one of them
194
+ * is a parameter here:
195
+ *
196
+ * - `bookable`, which this now defaults to `true`. Slots you cannot book are not
197
+ * what a booking screen is paging through.
198
+ * - THE WINDOW ITSELF. Ask for the days you are about to paint, not the month.
199
+ *
200
+ * What is NOT available is paging: the request's `query` carries only `filter` and
201
+ * `sort`, so a `paging: { limit }` is an unknown field the server drops on the
202
+ * floor — which is why "it ignores its own paging.limit" is a misreading. There was
203
+ * never a paging member to ignore.
204
+ *
205
+ * A per-day cap (`slotsPerDay`) is deliberately NOT offered. This v1 Availability
206
+ * Calendar endpoint is absent from the current published Wix reference (superseded
207
+ * by Time Slots V2), and the two plausible spellings put it in different places — a
208
+ * `query.filter` member, or a top-level sibling of `query`. An unknown field in
209
+ * either position is dropped silently rather than rejected, so shipping the wrong
210
+ * guess would hand callers a knob that does nothing while this comment promised it
211
+ * worked. Narrow the window instead, until the level can be confirmed against a
212
+ * schema or a live call.
213
+ */
214
+ export declare function queryServiceAvailability(serviceId: string, startDate: string, endDate: string, options?: WixServiceAvailabilityOptions): Promise<WixQueryAvailabilityResponse>;
193
215
  export interface WixResource {
194
216
  id?: string;
195
217
  name?: string;
@@ -275,7 +297,9 @@ export interface WixGetBookingFullResponse {
275
297
  booking: WixBookingFull;
276
298
  }
277
299
  /** Rich single-booking read — GET /bookings/v1/bookings/{id}. Returns the full
278
- * booking (payment/intake/location/staff/attendance). The booking-detail data source. */
300
+ * booking (payment/intake/location/staff/attendance). The booking-detail data source.
301
+ * Owner-scoped: needs an owner/BO session; a visitor or member token gets 403. A
302
+ * member-facing screen reads its own bookings via `queryBookings` instead. */
279
303
  export declare function getBookingFull(bookingId: string): Promise<WixGetBookingFullResponse>;
280
304
  /** Set attendance for a booking (class/course check-in / no-show) —
281
305
  * POST /bookings/v1/bookings/{id}/setAttendance. Body repeats bookingId +
@@ -30,10 +30,14 @@ export interface StoreProduct {
30
30
  slug?: string;
31
31
  description?: string;
32
32
  plainDescription?: string;
33
+ /** Both gallery layouts: V1 `mainMedia`/`items`, V3 `main`/`itemsInfo.items`. */
33
34
  media?: {
34
35
  mainMedia?: WixMediaSlot;
35
36
  main?: WixMediaSlot;
36
37
  items?: WixMediaSlot[];
38
+ itemsInfo?: {
39
+ items?: WixMediaSlot[];
40
+ };
37
41
  };
38
42
  price?: {
39
43
  formatted?: {
@@ -81,7 +85,9 @@ export interface StoreProductsResponse {
81
85
  export interface StoreGetProductResponse {
82
86
  product?: StoreProduct;
83
87
  }
84
- export declare function queryStoreProducts(limit?: number, cursor?: string): Promise<StoreProductsResponse>;
88
+ /** List products from whichever catalog this site runs. `fields` is additive — it
89
+ * WIDENS the default v3 display fieldset rather than replacing it. */
90
+ export declare function queryStoreProducts(limit?: number, cursor?: string, fields?: readonly string[]): Promise<StoreProductsResponse>;
85
91
  /** User-facing product discovery. V3 name search/sorting belong to Search
86
92
  * Products; Query Products deliberately does not support the name field.
87
93
  * V1 uses its documented JSON-string filter/sort dialect. */
@@ -91,9 +97,13 @@ export interface StoreProductSearch {
91
97
  ids?: string[];
92
98
  limit?: number;
93
99
  cursor?: string;
100
+ /** Extra v3 fieldsets. Additive — widens the default, never replaces it. */
101
+ fields?: readonly string[];
94
102
  }
95
103
  export declare function searchStoreProducts(options?: StoreProductSearch): Promise<StoreProductsResponse>;
96
- export declare function getStoreProduct(productId: string): Promise<StoreGetProductResponse>;
104
+ /** Read one product from whichever catalog this site runs. `fields` is additive —
105
+ * it WIDENS the default v3 display fieldset rather than replacing it. */
106
+ export declare function getStoreProduct(productId: string, fields?: readonly string[]): Promise<StoreGetProductResponse>;
97
107
  export { wixMediaUrl, isUnsizedWixMedia, WIX_LIST_IMAGE, WIX_DETAIL_IMAGE, type WixImageSize, } from "@wix/himalaya/wix-media";
98
108
  import { type WixImageSize } from "@wix/himalaya/wix-media";
99
109
  /**
@@ -108,5 +118,20 @@ import { type WixImageSize } from "@wix/himalaya/wix-media";
108
118
  * never what a caller wants — but `null` keeps the original reachable.
109
119
  */
110
120
  export declare function productImage(p: StoreProduct, size?: WixImageSize | null): string;
121
+ /**
122
+ * EVERY image on the product, sized, in wire order — the gallery a detail screen
123
+ * pages through, not just the one tile `productImage` returns.
124
+ *
125
+ * It reads both catalog layouts (V1 `media.items`, V3 `media.itemsInfo.items`) and
126
+ * falls back to the primary image when the product carries no gallery, so a caller
127
+ * always gets a non-empty list for a product that has any image at all. Empty slots
128
+ * and duplicates are dropped.
129
+ *
130
+ * Exported because the gallery union was being re-derived by hand in ~10 template
131
+ * workers, each free to miss a layout — which is exactly how a V3 store silently
132
+ * lost its thumbnails. Defaults to the LIST budget like `productImage`; pass
133
+ * `WIX_DETAIL_IMAGE` for a full-bleed pager, or `null` for the stored originals.
134
+ */
135
+ export declare function productGallery(p: StoreProduct, size?: WixImageSize | null): string[];
111
136
  export declare function productPrice(p: StoreProduct): string;
112
137
  export declare function plainText(value?: string): string;
@@ -29,9 +29,20 @@ export interface V3Product {
29
29
  /** Response fieldsets worth asking for so a V3 write answers with the same
30
30
  * information a V1 write did (formatted money + the description). */
31
31
  export declare const V3_WRITE_FIELDS: readonly ["CURRENCY", "PLAIN_DESCRIPTION"];
32
- /** Fieldsets a V3 READ needs to carry everything the V1 layout exposes: formatted
33
- * money, the storefront link, and the description. V3 omits all three unless asked. */
34
- export declare const V3_READ_FIELDS: readonly ["CURRENCY", "URL", "PLAIN_DESCRIPTION"];
32
+ /**
33
+ * Fieldsets a V3 READ needs to carry everything the V1 layout exposes: formatted
34
+ * money, the storefront link, the description, and the gallery. V3 omits all four
35
+ * unless asked.
36
+ *
37
+ * `MEDIA_ITEMS_INFO` is the one that populates `media.itemsInfo.items` — V3's home
38
+ * for the gallery, where V1 kept it at `media.items`. Without it a V3 read carries
39
+ * only `media.main`, so every caller that walked the item list got an empty array
40
+ * and silently rendered one image where the product has ten. Confirmed against the
41
+ * published Catalog V3 `RequestedFields` enum (both the single- and multiple-entity
42
+ * variants), whose `Media.itemsInfo` says verbatim: returned only when you pass
43
+ * `"MEDIA_ITEMS_INFO"` to the `fields` array.
44
+ */
45
+ export declare const V3_READ_FIELDS: readonly ["CURRENCY", "URL", "PLAIN_DESCRIPTION", "MEDIA_ITEMS_INFO"];
35
46
  /** Most a single V3 products query will return. Bounds the offset emulation in
36
47
  * `queryProducts` (V3 pages by cursor; the SDK's callers page by offset). */
37
48
  export declare const V3_MAX_QUERY_LIMIT = 100;
@@ -63,12 +74,22 @@ export interface V3ReadProduct extends V3Product {
63
74
  formattedAmount?: string;
64
75
  };
65
76
  };
77
+ /** V3 puts the primary image at `media.main` and the GALLERY at
78
+ * `media.itemsInfo.items` (V1 used `media.mainMedia` / `media.items`). */
66
79
  media?: {
67
80
  main?: {
68
81
  image?: {
69
82
  url?: string;
70
83
  };
71
84
  };
85
+ itemsInfo?: {
86
+ items?: Array<{
87
+ url?: string;
88
+ image?: {
89
+ url?: string;
90
+ };
91
+ }>;
92
+ };
72
93
  };
73
94
  url?: {
74
95
  url?: string;
@@ -63,10 +63,11 @@ function rescheduleBooking(bookingId, slot, revision, notify = false) {
63
63
  flowControlSettings: { ignoreReschedulePolicy: true, ignoreBookingWindow: true, skipAvailabilityValidation: true }
64
64
  });
65
65
  }
66
- function queryServiceAvailability(serviceId, startDate, endDate) {
66
+ function queryServiceAvailability(serviceId, startDate, endDate, options = {}) {
67
67
  if (!serviceId) throw new Error("queryServiceAvailability: serviceId is required");
68
+ const { bookable = true } = options;
68
69
  return wixCall("POST", "/bookings/v1/availability/query", {
69
- query: { filter: { serviceId: [serviceId], startDate, endDate } }
70
+ query: { filter: { serviceId: [serviceId], startDate, endDate, bookable } }
70
71
  });
71
72
  }
72
73
  function queryResources(limit = 100) {
@@ -133,7 +133,7 @@ async function resolveCatalogVersion() {
133
133
 
134
134
  // ../../stdlib/wix-sdk/stores-v1/src/products-v3.ts
135
135
  var V3_WRITE_FIELDS = ["CURRENCY", "PLAIN_DESCRIPTION"];
136
- var V3_READ_FIELDS = ["CURRENCY", "URL", "PLAIN_DESCRIPTION"];
136
+ var V3_READ_FIELDS = ["CURRENCY", "URL", "PLAIN_DESCRIPTION", "MEDIA_ITEMS_INFO"];
137
137
  var V3_MAX_QUERY_LIMIT = 100;
138
138
  var V3_VARIANT_READ_FIELDS = ["VARIANT_OPTION_CHOICE_NAMES", "CURRENCY"];
139
139
  function toV3ProductType(productType) {
@@ -321,7 +321,12 @@ function rawMediaSlot(value) {
321
321
  function mediaSlotUrl(value, size = WIX_LIST_IMAGE) {
322
322
  return wixMediaUrl(rawMediaSlot(value), size);
323
323
  }
324
- var CURRENCY_FIELDS = ["CURRENCY"];
324
+ function readFields(extra) {
325
+ if (!extra || extra.length === 0) return V3_READ_FIELDS;
326
+ const out = [...V3_READ_FIELDS];
327
+ for (const f of extra) if (typeof f === "string" && f !== "" && !out.includes(f)) out.push(f);
328
+ return out;
329
+ }
325
330
  function v1Offset(cursor) {
326
331
  const n = Number(cursor);
327
332
  return Number.isFinite(n) && n > 0 ? n : 0;
@@ -347,12 +352,12 @@ function queryV1(limit, cursor) {
347
352
  query: { paging: { limit, offset } }
348
353
  }).then((res) => fromV1(res, offset));
349
354
  }
350
- async function queryStoreProducts(limit = 50, cursor) {
355
+ async function queryStoreProducts(limit = 50, cursor, fields) {
351
356
  return readWithCatalogFallback((version) => {
352
357
  if (version === "v1") return queryV1(limit, cursor);
353
358
  return wixCall("POST", "/stores/v3/products/query", {
354
359
  query: { cursorPaging: cursor ? { limit, cursor } : { limit } },
355
- fields: CURRENCY_FIELDS
360
+ fields: readFields(fields)
356
361
  });
357
362
  });
358
363
  }
@@ -381,27 +386,42 @@ async function searchStoreProducts(options = {}) {
381
386
  };
382
387
  return wixCall("POST", `/stores/v3/products/${search ? "search" : "query"}`, {
383
388
  [search ? "search" : "query"]: criteria,
384
- fields: CURRENCY_FIELDS
389
+ fields: readFields(options.fields)
385
390
  });
386
391
  });
387
392
  }
388
393
  function getProductV1(productId) {
389
394
  return wixCall("GET", `/stores/v1/products/${encodeURIComponent(productId)}`);
390
395
  }
391
- async function getStoreProduct(productId) {
396
+ async function getStoreProduct(productId, fields) {
392
397
  if (!productId) throw new Error("getStoreProduct: productId is required");
393
398
  return readWithCatalogFallback((version) => {
394
399
  if (version === "v1") return getProductV1(productId);
400
+ const query = readFields(fields).map((f) => `fields=${encodeURIComponent(f)}`).join("&");
395
401
  return wixCall(
396
402
  "GET",
397
- `/stores/v3/products/${encodeURIComponent(productId)}?fields=${CURRENCY_FIELDS.join("&fields=")}`
403
+ `/stores/v3/products/${encodeURIComponent(productId)}?${query}`
398
404
  );
399
405
  });
400
406
  }
401
407
  function productImage(p, size = WIX_LIST_IMAGE) {
402
- const raw = rawMediaSlot(p.media?.mainMedia) || rawMediaSlot(p.media?.main) || rawMediaSlot(p.media?.items?.[0]) || "";
408
+ const raw = rawMediaSlot(p.media?.mainMedia) || rawMediaSlot(p.media?.main) || rawMediaSlot(p.media?.items?.[0]) || rawMediaSlot(p.media?.itemsInfo?.items?.[0]) || "";
403
409
  return wixMediaUrl(raw, size);
404
410
  }
411
+ function productGallery(p, size = WIX_LIST_IMAGE) {
412
+ const out = [];
413
+ const add = (slot) => {
414
+ const url = wixMediaUrl(rawMediaSlot(slot), size);
415
+ if (url && !out.includes(url)) out.push(url);
416
+ };
417
+ for (const slot of p.media?.items ?? []) add(slot);
418
+ for (const slot of p.media?.itemsInfo?.items ?? []) add(slot);
419
+ if (out.length === 0) {
420
+ add(p.media?.mainMedia);
421
+ add(p.media?.main);
422
+ }
423
+ return out;
424
+ }
405
425
  var CURRENCY_SYMBOL = {
406
426
  USD: "$",
407
427
  EUR: "\u20AC",
@@ -553,6 +573,7 @@ export {
553
573
  isUnsizedWixMedia,
554
574
  mediaSlotUrl,
555
575
  plainText,
576
+ productGallery,
556
577
  productImage,
557
578
  productPrice,
558
579
  queryInventory,