@wix/himalaya-cli 0.995.0 → 0.996.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.
@@ -612,6 +612,10 @@ export interface ButtonProps {
612
612
  title: string;
613
613
  action: Action;
614
614
  style?: string;
615
+ /** Literal only, NOT bindable: a `"$service:…"` string here fails `validate`, and there is no
616
+ * `disabledPath`. To disable from worker state, author two buttons — the live one and a
617
+ * `disabled: true` copy — and swap them with complementary `modifiers.hiddenPath` flags
618
+ * (e.g. `canSubmit` / `cannotSubmit`); also guard the action so a stray tap is a no-op. */
615
619
  disabled?: boolean;
616
620
  /** RFC 0034 — capability enrichments. */
617
621
  leadingIcon?: IconRef;
@@ -981,7 +985,9 @@ export interface FilterChip {
981
985
  }
982
986
  export interface FilterChipsProps {
983
987
  chips: FilterChip[];
984
- /** Literal ids, or a binding-aware `$service:`/`$item.` live selection. */
988
+ /** Literal ids, or binding-aware: put the `$service:` sentinel INSIDE the array as its ONE
989
+ * element — `selectedIds: ["$service:<svc>.<field>"]`, where the field holds the selected
990
+ * ids. A bare `"$service:…"` string is rejected by `validate` — the prop is an array. */
985
991
  selectedIds?: string[];
986
992
  multiSelect?: boolean;
987
993
  onChange?: Action;
@@ -244,9 +244,16 @@ export interface TypographyToken {
244
244
  size: number;
245
245
  weight: number;
246
246
  line: number;
247
+ /** A font family name, or {@link SYSTEM_FONT_FAMILY} for the platform's own system font.
248
+ * Absent → the renderer's default face. */
247
249
  family?: string;
248
250
  letterSpacing?: number;
249
251
  }
252
+ /** The `family` sentinel for "this platform's system font" — SF Pro on iOS / macOS, Roboto on
253
+ * Android, the browser's system UI stack on the web. Absent `family` cannot say this from an
254
+ * idiom overlay, because overlays deep-merge and an absent key keeps the base family. It is
255
+ * never a real family, so nothing bakes, packs or declares a face for it. */
256
+ export declare const SYSTEM_FONT_FAMILY = "$system";
250
257
  /** RFC 0020 — a drop shadow. `color` is a hex string; `opacity` multiplies its
251
258
  * alpha; `radius` is the blur radius; `x`/`y` the offset. All in points. */
252
259
  export interface ShadowToken {
@@ -181,7 +181,12 @@ export interface WixQueryAvailabilityResponse {
181
181
  * a `paging: { limit }` you add is silently dropped rather than honoured. */
182
182
  export interface WixServiceAvailabilityOptions {
183
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. */
184
+ * ones too (a greyed-out calendar), which is what the endpoint returns unfiltered.
185
+ * `false` OMITS the filter key rather than sending `bookable: false` — the latter
186
+ * is a filter for unbookable slots ONLY, i.e. an empty calendar on a live site.
187
+ * Unfiltered is the large response described below, so keep the window to the
188
+ * days on screen. For unbookable slots alone, filter the entries on
189
+ * `entry.bookable === false`. */
185
190
  bookable?: boolean;
186
191
  }
187
192
  /**
@@ -227,11 +232,41 @@ export interface WixQueryResourcesResponse {
227
232
  export declare function queryResources(limit?: number): Promise<WixQueryResourcesResponse>;
228
233
  /** Convenience: staff members = resources tagged "staff" (filtered client-side). */
229
234
  export declare function queryStaff(limit?: number): Promise<WixResource[]>;
235
+ /** How the customer intends to pay — the Create Booking `SelectedPaymentOption` enum.
236
+ * `OFFLINE` = pay in person at the venue; `ONLINE` = pay through checkout;
237
+ * `MEMBERSHIP` = a Wix Pricing Plan; `MEMBERSHIP_OFFLINE` = a pricing plan the
238
+ * business redeems by hand. It must be one the service offers. */
239
+ export type WixSelectedPaymentOption = "OFFLINE" | "ONLINE" | "MEMBERSHIP" | "MEMBERSHIP_OFFLINE";
240
+ export interface WixBookSlotOptions {
241
+ /** Sent as `booking.selectedPaymentOption`. Omitted from the request when unset,
242
+ * so a call without it sends exactly the body it always did. */
243
+ selectedPaymentOption?: WixSelectedPaymentOption;
244
+ }
230
245
  /** Book a specific availability slot — POST /bookings/v2/bookings. Pass the FULL
231
246
  * slot from queryServiceAvailability + the booker's contact. The v1 createBooking
232
247
  * above rejects a bare slot; the v2 route with bookedEntity.slot is the one that
233
- * works. Verified live (status CREATED). */
234
- export declare function bookSlot(slot: WixBookingSlotFull, firstName: string, lastName: string, email: string): Promise<WixCreateBookingResponse>;
248
+ * works. Verified live (status CREATED).
249
+ *
250
+ * A visitor booking a PAID service to pay in person (no on-device payment) is a
251
+ * three-call chain:
252
+ *
253
+ * 1. `bookSlot(slot, first, last, email, { selectedPaymentOption: "OFFLINE" })`
254
+ * → the booking, status CREATED.
255
+ * 2. `createCheckout([{ quantity: 1, catalogReference: { appId: <Wix Bookings
256
+ * appDefId 13d21c63-b5ec-5912-8397-c3a5ddb27a97>, catalogItemId: booking.id } }])`
257
+ * from `@himalaya/wix-ecom` → the checkout id.
258
+ * 3. `createOrder(checkoutId)` from `@himalaya/wix-ecom` → the order, with the
259
+ * balance left for the venue to collect.
260
+ *
261
+ * This chain was verified with raw Wix calls, not through these wrappers.
262
+ * It is not verified whether `createOrder` still returns a `paymentGatewayOrderId`
263
+ * for an OFFLINE booking, so do not read one as "charge now" and send a
264
+ * pay-in-person customer into the cashier.
265
+ *
266
+ * Wix documents `selectedPaymentOption` as REQUIRED whenever the booking is paid
267
+ * through an eCommerce checkout, and it must be an option the service offers.
268
+ * Leave `options` out and the request is the one this function always sent. */
269
+ export declare function bookSlot(slot: WixBookingSlotFull, firstName: string, lastName: string, email: string, options?: WixBookSlotOptions): Promise<WixCreateBookingResponse>;
235
270
  export interface WixBookingAdditionalField {
236
271
  id?: string;
237
272
  label?: string;
@@ -7774,6 +7774,7 @@ function resolveResponsiveSize(rs, width) {
7774
7774
  if (width >= 600) return rs.medium ?? rs.base;
7775
7775
  return rs.base;
7776
7776
  }
7777
+ var SYSTEM_FONT_FAMILY = "$system";
7777
7778
  function buildTokenRegistry(tokens) {
7778
7779
  return {
7779
7780
  colors: new Set(Object.keys(tokens.colors ?? {})),
@@ -12906,6 +12907,7 @@ export {
12906
12907
  SUPPORTED_LOCALES,
12907
12908
  SURFACE_GROUPS,
12908
12909
  SURFACE_VIEW_LADDER,
12910
+ SYSTEM_FONT_FAMILY,
12909
12911
  UNIVERSAL_LAUNCH_NAMESPACES,
12910
12912
  WIDGET_COMPONENTS,
12911
12913
  WIDGET_FAMILIES,
@@ -65,9 +65,9 @@ function rescheduleBooking(bookingId, slot, revision, notify = false) {
65
65
  }
66
66
  function queryServiceAvailability(serviceId, startDate, endDate, options = {}) {
67
67
  if (!serviceId) throw new Error("queryServiceAvailability: serviceId is required");
68
- const { bookable = true } = options;
68
+ const { bookable = true } = options ?? {};
69
69
  return wixCall("POST", "/bookings/v1/availability/query", {
70
- query: { filter: { serviceId: [serviceId], startDate, endDate, bookable } }
70
+ query: { filter: { serviceId: [serviceId], startDate, endDate, ...bookable ? { bookable: true } : {} } }
71
71
  });
72
72
  }
73
73
  function queryResources(limit = 100) {
@@ -79,9 +79,15 @@ async function queryStaff(limit = 100) {
79
79
  const res = await queryResources(limit);
80
80
  return (res.resources ?? []).filter((r) => (r.tags ?? []).includes("staff"));
81
81
  }
82
- function bookSlot(slot, firstName, lastName, email) {
82
+ function bookSlot(slot, firstName, lastName, email, options) {
83
+ const selectedPaymentOption = options?.selectedPaymentOption;
83
84
  return wixCall("POST", "/bookings/v2/bookings", {
84
- booking: { bookedEntity: { slot }, contactDetails: { firstName, lastName, email }, totalParticipants: 1 }
85
+ booking: {
86
+ bookedEntity: { slot },
87
+ contactDetails: { firstName, lastName, email },
88
+ totalParticipants: 1,
89
+ ...selectedPaymentOption ? { selectedPaymentOption } : {}
90
+ }
85
91
  });
86
92
  }
87
93
  function getBookingFull(bookingId) {