@wix/himalaya-cli 0.1748.0 → 0.1749.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/bin/himi +16 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +9 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +1 -1
- package/dist/browser-plane/assets.json +7 -7
- package/dist/browser-plane/preview-deferred/{63821bbb8f637899037252154a5587f0596e4b537173c7f50551f9e44f7c22c0.bin → b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin} +1 -1
- package/dist/browser-plane/sw.js +6 -6
- package/dist/browser-plane/t5-frame.html +1 -1
- package/dist/browser-plane/t5-worker-frame.html +1 -1
- package/dist/cli.mjs +118 -67
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +9 -0
- package/package.json +2 -2
- package/template-icons/medical-services.png +0 -0
- package/templates/beauty-salon/dev/index.ts +1 -0
- package/templates/beauty-salon/l10n/en.json +6 -0
- package/templates/beauty-salon/l10n/fr.json +11 -0
- package/templates/beauty-salon/l10n/he.json +9 -0
- package/templates/beauty-salon/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/beauty-salon/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/beauty-salon-owner/dev/index.ts +54 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/branded-lite/dev/index.ts +1 -0
- package/templates/branded-lite/l10n/fr.json +5 -0
- package/templates/branded-lite/l10n/he.json +4 -0
- package/templates/branded-lite/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/branded-lite/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/community-club/dev/index.ts +1 -0
- package/templates/community-club/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/community-club-owner/dev/index.ts +54 -0
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/conference/dev/index.ts +1 -0
- package/templates/events-meetups/dev/index.ts +1 -0
- package/templates/events-meetups/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/events-meetups-owner/dev/index.ts +54 -0
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/gym-fitness/dev/index.ts +1 -0
- package/templates/gym-fitness/l10n/en.json +6 -0
- package/templates/gym-fitness/l10n/fr.json +11 -0
- package/templates/gym-fitness/l10n/he.json +9 -0
- package/templates/gym-fitness/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/gym-fitness/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/gym-fitness-owner/dev/index.ts +54 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/medical-services/README.md +53 -0
- package/templates/medical-services/config.ts +320 -0
- package/templates/medical-services/dev/index.ts +17783 -0
- package/templates/medical-services/himalaya.content.json +46 -0
- package/templates/medical-services/himalaya.template.json +14 -0
- package/templates/medical-services/icon.png +0 -0
- package/templates/medical-services/platforms.json +1 -0
- package/templates/medical-services/tier5-src/_shared/app-locale.ts +61 -0
- package/templates/medical-services/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/medical-services/tier5-src/_shared/booking-session.ts +222 -0
- package/templates/medical-services/tier5-src/_shared/branded-lite-hosted.ts +280 -0
- package/templates/medical-services/tier5-src/_shared/branded-load-state.ts +109 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-history.ts +51 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-model.ts +56 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-presenter.ts +576 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/medical-services/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/medical-services/tier5-src/_shared/collection-query.ts +193 -0
- package/templates/medical-services/tier5-src/_shared/collection-service.ts +400 -0
- package/templates/medical-services/tier5-src/_shared/engine-intl.ts +523 -0
- package/templates/medical-services/tier5-src/_shared/faq-list.ts +405 -0
- package/templates/medical-services/tier5-src/_shared/himi-account.ts +194 -0
- package/templates/medical-services/tier5-src/_shared/himi-booking-saved.ts +88 -0
- package/templates/medical-services/tier5-src/_shared/himi-bookings.ts +318 -0
- package/templates/medical-services/tier5-src/_shared/himi-copy.ts +116 -0
- package/templates/medical-services/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/medical-services/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/medical-services/tier5-src/_shared/host-events.ts +66 -0
- package/templates/medical-services/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/medical-services/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/medical-services/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
- package/templates/medical-services/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/medical-services/tier5-src/_shared/iap-worker.ts +127 -0
- package/templates/medical-services/tier5-src/_shared/inbox-rooms.ts +68 -0
- package/templates/medical-services/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/medical-services/tier5-src/_shared/member-access.ts +52 -0
- package/templates/medical-services/tier5-src/_shared/member-account-routes.ts +52 -0
- package/templates/medical-services/tier5-src/_shared/member-bookings.ts +107 -0
- package/templates/medical-services/tier5-src/_shared/member-screen.ts +99 -0
- package/templates/medical-services/tier5-src/_shared/notification-target.ts +141 -0
- package/templates/medical-services/tier5-src/_shared/offset-page.ts +10 -0
- package/templates/medical-services/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/medical-services/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/medical-services/tier5-src/_shared/payment-setup.ts +6 -0
- package/templates/medical-services/tier5-src/_shared/rich-body.ts +78 -0
- package/templates/medical-services/tier5-src/_shared/rich-content-link.ts +34 -0
- package/templates/medical-services/tier5-src/_shared/sign-in-sheet.ts +18 -0
- package/templates/medical-services/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/medical-services/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/medical-services/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/medical-services/tier5-src/_shared/wix-member-links.ts +114 -0
- package/templates/medical-services/tier5-src/_shared/wix-service-price.ts +146 -0
- package/templates/medical-services/tier5-src/business-chat/index.ts +732 -0
- package/templates/medical-services/tier5-src/himi-booking-account/index.ts +252 -0
- package/templates/medical-services/tier5-src/himi-booking-bookings/index.ts +468 -0
- package/templates/medical-services/tier5-src/himi-booking-service/index.ts +1190 -0
- package/templates/medical-services/tier5-src/himi-booking-services/index.ts +791 -0
- package/templates/medical-services/tier5-src/himi-booking-time/index.ts +1729 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-faq/index.ts +6 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
- package/templates/medical-services/tier5-src/himi-clinic-home/index.ts +389 -0
- package/templates/medical-services/tier5-src/himi-store-account/index.ts +998 -0
- package/templates/medical-services/tokens.json +418 -0
- package/templates/nonprofit-cause/dev/index.ts +1 -0
- package/templates/nonprofit-cause/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/nonprofit-cause-owner/dev/index.ts +54 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/owner-lite/dev/index.ts +54 -0
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/podcast-creator/dev/index.ts +1 -0
- package/templates/podcast-creator/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/podcast-creator-owner/dev/index.ts +54 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/portfolio-creative/dev/index.ts +1 -0
- package/templates/portfolio-creative/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/portfolio-creative-owner/dev/index.ts +54 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/restaurant/dev/index.ts +1 -0
- package/templates/restaurant/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/restaurant-owner/dev/index.ts +54 -0
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/retail-store/dev/index.ts +1 -0
- package/templates/retail-store/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/retail-store-owner/dev/index.ts +54 -0
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/salon-spa/dev/index.ts +1 -0
- package/templates/salon-spa/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/salon-spa/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/salon-spa/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/salon-spa/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/wholesale-store/dev/index.ts +1 -0
- package/templates/yoga-studio/dev/index.ts +1 -0
- package/templates/yoga-studio/l10n/en.json +6 -0
- package/templates/yoga-studio/l10n/fr.json +11 -0
- package/templates/yoga-studio/l10n/he.json +9 -0
- package/templates/yoga-studio/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/yoga-studio/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/yoga-studio-owner/dev/index.ts +54 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
|
@@ -6,7 +6,7 @@ import { wixMediaUrl, WIX_LIST_IMAGE } from "@himalaya/wix-media";
|
|
|
6
6
|
import { navigate } from "@himalaya/state";
|
|
7
7
|
import { copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
8
8
|
import { memberAccess, assertMemberAccess, memberAccessChanged, memberAccessDenied, type MemberAccess } from "../_shared/member-access.js";
|
|
9
|
-
import { fetchMemberBookings, CANCELLED_STATUSES, type MemberBookingRow } from "../_shared/member-bookings.js";
|
|
9
|
+
import { fetchMemberBookings, CANCELLED_STATUSES, UNCONFIRMED_STATUSES, type MemberBookingRow } from "../_shared/member-bookings.js";
|
|
10
10
|
import { emitHostEvent } from "../_shared/host-events.js";
|
|
11
11
|
import { formatClock, formatClockRange, formatDateMedium, formatMonthDay, formatWeekdayMonthDay, formatWeekdayMonthDayLong } from "../_shared/engine-intl.js";
|
|
12
12
|
import { parseWeeklyGoal, weeklyGoalProgress, weeklySessionsFromPages } from "../_shared/weekly-goal.js";
|
|
@@ -133,6 +133,7 @@ function tagOf(row: MemberBookingRow): string {
|
|
|
133
133
|
case "CANCELED": case "CANCELLED": return copyParam("bookings.statusCancelled", "Canceled");
|
|
134
134
|
case "DECLINED": return copyParam("bookings.statusDeclined", "Declined");
|
|
135
135
|
}
|
|
136
|
+
if (UNCONFIRMED_STATUSES.includes(row.statusKey)) return copyParam("bookings.statusUnconfirmed", "Not confirmed");
|
|
136
137
|
return row.isCourse ? copyParam("bookings.coursePrefix", "Course") : "";
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -194,6 +195,7 @@ function paymentOf(row: MemberBookingRow): string {
|
|
|
194
195
|
function noticeOf(row: MemberBookingRow): string {
|
|
195
196
|
if (row.statusKey === "PENDING" || row.statusKey === "PENDING_APPROVAL") return copyParam("bookings.pendingNotice", "The business must approve this booking. You get an email when they reply.");
|
|
196
197
|
if (row.statusKey === "WAITING_LIST") return copyParam("bookings.waitlistNotice", "You are on the waitlist. You get an email if a spot opens.");
|
|
198
|
+
if (UNCONFIRMED_STATUSES.includes(row.statusKey)) return copyParam("bookings.unconfirmedNotice", "This booking is not confirmed. If you did not finish checkout, the business did not get it.");
|
|
197
199
|
return "";
|
|
198
200
|
}
|
|
199
201
|
|
|
@@ -314,7 +316,9 @@ const svc = defineBackendCollection<S, MemberBookingRow>("himiBookingBookings",
|
|
|
314
316
|
const member = await memberAccess();
|
|
315
317
|
if (cursor && (!pageMember || pageMember.email !== member.email || pageMember.scope !== member.scope)) throw memberAccessChanged();
|
|
316
318
|
if (!cursor || !queryNow) queryNow = new Date().toISOString();
|
|
317
|
-
|
|
319
|
+
// The list keeps an unconfirmed booking, marked "Not confirmed", so the member can see it
|
|
320
|
+
// and cancel it; Home and the weekly goal leave it out.
|
|
321
|
+
const page = await fetchMemberBookings(criteria, cursor, queryNow, member, { includeUnconfirmed: true });
|
|
318
322
|
if (cursor) return page;
|
|
319
323
|
const weekly = weeklyGoal > 0 && member.email ? await fetchWeeklySessionsDone(member, Date.now()) : null;
|
|
320
324
|
return { ...page, metadata: { ...page.metadata, weeklyDone: weekly } };
|
|
@@ -25,6 +25,7 @@ import { formatClock, formatDateMedium, formatMonthDay } from "../_shared/engine
|
|
|
25
25
|
import { descriptionBody } from "../_shared/rich-body.js";
|
|
26
26
|
import { openRichLink } from "../_shared/rich-content-link.js";
|
|
27
27
|
import { isServiceSaved, toggleSavedService } from "../_shared/himi-booking-saved.js";
|
|
28
|
+
import { nameWords } from "../_shared/staff-name.js";
|
|
28
29
|
|
|
29
30
|
// Offline-first (data-offline): the service detail is a public read-through. On a
|
|
30
31
|
// fetch failure we fall back to the last-synced row for this service written by
|
|
@@ -334,11 +335,15 @@ function locationRows(service: WixService): LocationRow[] {
|
|
|
334
335
|
// ---- Staff -----------------------------------------------------------------------
|
|
335
336
|
|
|
336
337
|
function initials(name: string): string {
|
|
337
|
-
return name
|
|
338
|
+
return nameWords(name).words.slice(0, 2).map((part) => part[0]!.toUpperCase()).join("");
|
|
338
339
|
}
|
|
339
340
|
|
|
341
|
+
/** How a name reads in a short list: the first name ("Noa"), or for a titled name the title and
|
|
342
|
+
* the surname ("Dr. Wang") — the first word alone made a clinic's line "With Dr., Dr. and 2 more". */
|
|
340
343
|
function firstName(name: string): string {
|
|
341
|
-
|
|
344
|
+
const { title, words } = nameWords(name);
|
|
345
|
+
if (title) return `${title} ${words[words.length - 1]}`;
|
|
346
|
+
return words[0] ?? name;
|
|
342
347
|
}
|
|
343
348
|
|
|
344
349
|
/** "With Noa Levi", "With Noa or Dana", "With Noa, Dana and 2 more". Empty when the
|
|
@@ -9,7 +9,7 @@ import { addDays as addLocalDays, dayKey, dayLabel, timeLabel, toDate } from "@h
|
|
|
9
9
|
import { dispatch } from "@himalaya/dispatch";
|
|
10
10
|
import { bookSchedule, bookSlot, getService, queryServiceAvailability, registerToWaitlist, type WixBookingSlotFull, type WixSelectedPaymentOption, type WixService } from "@himalaya/wix-bookings";
|
|
11
11
|
import { createCheckout, createOrder } from "@himalaya/wix-ecom";
|
|
12
|
-
import { createRedirectSession
|
|
12
|
+
import { createRedirectSession } from "@himalaya/wix-redirects";
|
|
13
13
|
import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
|
|
14
14
|
import { hostedCheckoutOpener, isHostedWorker } from "../_shared/hosted-checkout.js";
|
|
15
15
|
import { session as wixPlatformSession } from "@himalaya/wix-platform";
|
|
@@ -1633,10 +1633,12 @@ async function bookSelectedIn(s: S): Promise<S> {
|
|
|
1633
1633
|
msid: await resolveMsid(),
|
|
1634
1634
|
// Hosted (Spaces): the host opens this booking's checkout as the lent member.
|
|
1635
1635
|
...(hosted ? { openCashier: hostedCheckoutOpener(checkoutId) } : {}),
|
|
1636
|
+
// The site's checkout page for THIS checkout, which already holds the booking made above.
|
|
1637
|
+
// Never `bookingsCheckout`: that opens the site's booking form, which books the slot
|
|
1638
|
+
// again — the form refused it ("There was an issue with booking this service") and the
|
|
1639
|
+
// member could not pay, while the first booking stayed behind unpaid.
|
|
1636
1640
|
cashierUrl: async () => {
|
|
1637
|
-
const redirect = await createRedirectSession(
|
|
1638
|
-
? { ecomCheckout: { checkoutId } }
|
|
1639
|
-
: { bookingsCheckout: { slotAvailability: { slot: slot as WixSlot } } });
|
|
1641
|
+
const redirect = await createRedirectSession({ ecomCheckout: { checkoutId } });
|
|
1640
1642
|
return redirect.redirectSession?.fullUrl;
|
|
1641
1643
|
},
|
|
1642
1644
|
});
|
|
@@ -8,6 +8,7 @@ const runtimeSetting = (value: unknown): unknown => {
|
|
|
8
8
|
if (value === "__HIMI_PODCAST_FEED_URL__") return process.env.PODCAST_FEED_URL?.trim() || "";
|
|
9
9
|
if (value === "__HIMI_MEMBER_PHOTO_UPLOAD_FUNCTION__") return process.env.HIMI_BRANDED_LITE_MEMBER_PHOTO_UPLOAD_FUNCTION?.trim() || "";
|
|
10
10
|
if (value === "__HIMI_MEMBER_SITE_URL__") return String((config as { auth?: { config?: { siteUrl?: unknown } } }).auth?.config?.siteUrl ?? "").trim();
|
|
11
|
+
if (typeof value === "string" && value.startsWith("__HIMI_MEMBER_SITE_URL__/")) return String((config as { auth?: { config?: { siteUrl?: unknown } } }).auth?.config?.siteUrl ?? "").trim().replace(/\/+$/, "") + value.slice(24);
|
|
11
12
|
if (Array.isArray(value)) return value.map(runtimeSetting);
|
|
12
13
|
if (!value || typeof value !== "object") return value;
|
|
13
14
|
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, runtimeSetting(child)]));
|
|
@@ -10,6 +10,17 @@ import { dayKey } from "@himalaya/time";
|
|
|
10
10
|
* booking is in exactly one tab. */
|
|
11
11
|
export const CANCELLED_STATUSES = ["CANCELED", "CANCELLED", "DECLINED"];
|
|
12
12
|
|
|
13
|
+
/** Wix made the booking, but no checkout confirmed it: a paid booking the member did not pay
|
|
14
|
+
* for, or left in the payment page, stays here. It holds no place and the business does not
|
|
15
|
+
* see it in its booking calendar, so it is not an appointment. */
|
|
16
|
+
export const UNCONFIRMED_STATUSES = ["CREATED"];
|
|
17
|
+
|
|
18
|
+
export interface FetchMemberBookingsOptions {
|
|
19
|
+
/** Keep the unconfirmed bookings (`UNCONFIRMED_STATUSES`). Only a list that marks them as
|
|
20
|
+
* not confirmed may ask for them; Home and every count leave them out. */
|
|
21
|
+
includeUnconfirmed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
export interface MemberBookingRow {
|
|
14
25
|
id: string; title: string; subtitle: string; status: string; revision: string;
|
|
15
26
|
start: string; end: string; day: string; serviceId: string;
|
|
@@ -70,7 +81,7 @@ export function memberBookingRow(booking: WixBooking): MemberBookingRow {
|
|
|
70
81
|
courseStart: instant(schedule?.firstSessionStart),
|
|
71
82
|
courseEnd: instant(schedule?.lastSessionEnd) };
|
|
72
83
|
}
|
|
73
|
-
export async function fetchMemberBookings(criteria: CollectionQuery, cursor: string, now: string, expected?: MemberAccess) {
|
|
84
|
+
export async function fetchMemberBookings(criteria: CollectionQuery, cursor: string, now: string, expected?: MemberAccess, options: FetchMemberBookingsOptions = {}) {
|
|
74
85
|
const member = expected ?? await memberAccess();
|
|
75
86
|
const metadata = { email: member.email, scope: member.scope, needsSignIn: !member.email };
|
|
76
87
|
if (!member.email) return { items: [] as MemberBookingRow[], nextCursor: "", metadata };
|
|
@@ -79,9 +90,10 @@ export async function fetchMemberBookings(criteria: CollectionQuery, cursor: str
|
|
|
79
90
|
const filter: Record<string, unknown> = { "contactDetails.email": { $eq: member.email } };
|
|
80
91
|
if (criteria.query) filter.id = { $eq: criteria.query };
|
|
81
92
|
if (criteria.filter === "saved") filter.id = criteria.query ? { $in: criteria.savedIds.filter(id => id === criteria.query) } : { $in: criteria.savedIds };
|
|
82
|
-
|
|
93
|
+
const notListed = options.includeUnconfirmed ? CANCELLED_STATUSES : [...CANCELLED_STATUSES, ...UNCONFIRMED_STATUSES];
|
|
94
|
+
if (criteria.filter === "value:Upcoming") { filter.startDate = { $gte: now }; filter.status = { $nin: notListed }; }
|
|
83
95
|
// Past is what took place: a canceled or declined booking is in the Canceled tab only.
|
|
84
|
-
if (criteria.filter === "value:Past") { filter.startDate = { $lt: now }; filter.status = { $nin:
|
|
96
|
+
if (criteria.filter === "value:Past") { filter.startDate = { $lt: now }; filter.status = { $nin: notListed }; }
|
|
85
97
|
if (criteria.filter === "value:Cancelled") filter.status = { $in: CANCELLED_STATUSES };
|
|
86
98
|
const response = await queryBookings({ query: { filter, paging: { limit: 50, offset: Number(cursor || 0) },
|
|
87
99
|
sort: [{ fieldName: "startDate", order: criteria.sort === "za" ? "DESC" : "ASC" }, { fieldName: "id", order: "ASC" }] } });
|
|
@@ -89,6 +101,7 @@ export async function fetchMemberBookings(criteria: CollectionQuery, cursor: str
|
|
|
89
101
|
const raw = response.bookings ?? [];
|
|
90
102
|
// Server authorization remains authoritative. This guard also rejects a
|
|
91
103
|
// malformed/cross-member row before any UI projection. No private disk cache.
|
|
92
|
-
const items = raw.filter(booking => booking.id && booking.contactDetails?.email?.trim().toLowerCase() === member.email).map(memberBookingRow)
|
|
104
|
+
const items = raw.filter(booking => booking.id && booking.contactDetails?.email?.trim().toLowerCase() === member.email).map(memberBookingRow)
|
|
105
|
+
.filter(row => options.includeUnconfirmed || !UNCONFIRMED_STATUSES.includes(row.statusKey));
|
|
93
106
|
return { items, ...offsetPage(cursor, raw.length, 50, response.pagingMetadata), metadata };
|
|
94
107
|
}
|
|
@@ -62656,6 +62656,60 @@ const SCREENS = runtimeSetting({
|
|
|
62656
62656
|
"spacing": 0,
|
|
62657
62657
|
"alignment": "leading",
|
|
62658
62658
|
"children": [
|
|
62659
|
+
{
|
|
62660
|
+
"id": "himi_owner_lite_aria.quickReplies.bound",
|
|
62661
|
+
"body": {
|
|
62662
|
+
"package": "himalaya",
|
|
62663
|
+
"type": "LazyList",
|
|
62664
|
+
"props": {
|
|
62665
|
+
"itemsPath": "$service:himiOwnerLiteAria.quickReplies",
|
|
62666
|
+
"horizontal": true,
|
|
62667
|
+
"spacing": 8,
|
|
62668
|
+
"items": [
|
|
62669
|
+
{
|
|
62670
|
+
"id": "himi_owner_lite_aria.quickReply_$item.id",
|
|
62671
|
+
"body": {
|
|
62672
|
+
"package": "himalaya",
|
|
62673
|
+
"type": "Text",
|
|
62674
|
+
"props": {
|
|
62675
|
+
"text": "$item.label",
|
|
62676
|
+
"style": "footnote",
|
|
62677
|
+
"maxLines": 1
|
|
62678
|
+
}
|
|
62679
|
+
},
|
|
62680
|
+
"modifiers": {
|
|
62681
|
+
"padding": {
|
|
62682
|
+
"leading": 12,
|
|
62683
|
+
"trailing": 12,
|
|
62684
|
+
"top": 16,
|
|
62685
|
+
"bottom": 16
|
|
62686
|
+
},
|
|
62687
|
+
"background": {
|
|
62688
|
+
"token": "surfaceSecondary"
|
|
62689
|
+
},
|
|
62690
|
+
"cornerRadius": 16,
|
|
62691
|
+
"accessibilityLabel": "$item.reply",
|
|
62692
|
+
"onTap": {
|
|
62693
|
+
"actionId": "tier5.himiOwnerLiteAria.submitQuickReply",
|
|
62694
|
+
"params": {
|
|
62695
|
+
"id": "$item.id"
|
|
62696
|
+
}
|
|
62697
|
+
}
|
|
62698
|
+
}
|
|
62699
|
+
}
|
|
62700
|
+
]
|
|
62701
|
+
}
|
|
62702
|
+
},
|
|
62703
|
+
"modifiers": {
|
|
62704
|
+
"hiddenPath": "$service:himiOwnerLiteAria.quickRepliesHidden",
|
|
62705
|
+
"padding": {
|
|
62706
|
+
"leading": 0,
|
|
62707
|
+
"trailing": 0,
|
|
62708
|
+
"top": 8,
|
|
62709
|
+
"bottom": 0
|
|
62710
|
+
}
|
|
62711
|
+
}
|
|
62712
|
+
},
|
|
62659
62713
|
{
|
|
62660
62714
|
"id": "",
|
|
62661
62715
|
"body": {
|
|
@@ -1491,6 +1491,7 @@ export interface AriaChatCore {
|
|
|
1491
1491
|
load(s: AriaChatState): Promise<AriaChatState>;
|
|
1492
1492
|
submit(s: AriaChatState, arg?: AriaActionArg): Promise<AriaChatState>;
|
|
1493
1493
|
submitPrompt(s: AriaChatState, arg?: AriaActionArg): Promise<AriaChatState>;
|
|
1494
|
+
submitQuickReply(s: AriaChatState, arg?: AriaActionArg): Promise<AriaChatState>;
|
|
1494
1495
|
newChat(s: AriaChatState): Promise<AriaChatState>;
|
|
1495
1496
|
/** Mirror the composer's text into state. Not cosmetic: the renderers only
|
|
1496
1497
|
* clear a text field when its BOUND value transitions, so a composer whose
|
|
@@ -2799,6 +2800,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2799
2800
|
/** The quick replies last painted, so an unchanged list keeps its identity and
|
|
2800
2801
|
* a reducer that changed nothing still returns the SAME state object. */
|
|
2801
2802
|
let paintedReplies: AriaQuickReply[] = [];
|
|
2803
|
+
let quickReplyOffer = 0;
|
|
2802
2804
|
|
|
2803
2805
|
/** Ask the host to open the stream for a turn that was just sent, and reset
|
|
2804
2806
|
* the live model to it. `turnId` may be empty (a service that named no id);
|
|
@@ -2867,13 +2869,21 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2867
2869
|
return out;
|
|
2868
2870
|
};
|
|
2869
2871
|
|
|
2872
|
+
const quickReplyLabel = (label: string): string => {
|
|
2873
|
+
const characters = Array.from(label);
|
|
2874
|
+
return characters.length > 30 ? characters.slice(0, 29).join("") + "…" : label;
|
|
2875
|
+
};
|
|
2876
|
+
|
|
2870
2877
|
/** The current turn's quick replies, as rows. */
|
|
2871
2878
|
const repliesFor = (s: AriaChatState): AriaQuickReply[] => {
|
|
2872
2879
|
const offered = !!s._turnId && live.turnId === s._turnId && live.conversationId === s._convId
|
|
2873
2880
|
? live.quickReplies() : [];
|
|
2874
2881
|
const same = offered.length === paintedReplies.length
|
|
2875
|
-
&& offered.every((r, i) => paintedReplies[i].label === r.label && paintedReplies[i].reply === r.reply);
|
|
2876
|
-
if (!same)
|
|
2882
|
+
&& offered.every((r, i) => paintedReplies[i].label === quickReplyLabel(r.label) && paintedReplies[i].reply === r.reply);
|
|
2883
|
+
if (!same) {
|
|
2884
|
+
quickReplyOffer += 1;
|
|
2885
|
+
paintedReplies = offered.map((r, i) => ({ id: `${s._convId}:${s._turnId}:${quickReplyOffer}:qr${i + 1}`, label: quickReplyLabel(r.label), reply: r.reply }));
|
|
2886
|
+
}
|
|
2877
2887
|
return paintedReplies;
|
|
2878
2888
|
};
|
|
2879
2889
|
|
|
@@ -3361,8 +3371,9 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
3361
3371
|
: { ...actioned, attachments: chips, attachmentsHidden };
|
|
3362
3372
|
if (out.mention !== mentionViewNow) out = { ...out, mention: mentionViewNow };
|
|
3363
3373
|
const quickReplies = repliesFor(out);
|
|
3364
|
-
|
|
3365
|
-
|
|
3374
|
+
const quickRepliesHidden = out.status !== "ready" || quickReplies.length === 0;
|
|
3375
|
+
if (out.quickReplies !== quickReplies || out.quickRepliesHidden !== quickRepliesHidden) {
|
|
3376
|
+
out = { ...out, quickReplies, quickRepliesHidden };
|
|
3366
3377
|
}
|
|
3367
3378
|
if (out._realtime !== realtime) out = { ...out, _realtime: realtime };
|
|
3368
3379
|
// Every state the runtime commits passes through here (an `undefined`
|
|
@@ -3651,6 +3662,14 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
3651
3662
|
return send(s, content, chips);
|
|
3652
3663
|
},
|
|
3653
3664
|
|
|
3665
|
+
submitQuickReply: async (s, arg) => {
|
|
3666
|
+
if (s.status !== "ready" || s._siteId !== siteOf()) return s;
|
|
3667
|
+
const id = typeof arg === "string" ? arg : firstString(arg?.id);
|
|
3668
|
+
const offered = repliesFor(s).find((reply) => reply.id === id);
|
|
3669
|
+
if (!offered) return s;
|
|
3670
|
+
return impl.submitPrompt(s, { text: offered.reply });
|
|
3671
|
+
},
|
|
3672
|
+
|
|
3654
3673
|
// A suggested-prompt chip submits its own text through the SAME path a typed
|
|
3655
3674
|
// message takes — never by dispatching `submit` through the service handle,
|
|
3656
3675
|
// which exposes actions as direct methods and has no `.actions` member on
|
|
@@ -4440,6 +4459,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
4440
4459
|
// turn running, and a tick resolving around it must go on reporting that
|
|
4441
4460
|
// turn normally.
|
|
4442
4461
|
turnSeq += 1;
|
|
4462
|
+
live.reset("", "");
|
|
4443
4463
|
return slow(withDraft(
|
|
4444
4464
|
{ ...s, status: "ready", statusText: stoppedText(), error: "", _pending: "", _abortId: "" }, typedAt));
|
|
4445
4465
|
},
|
|
@@ -4599,6 +4619,12 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
4599
4619
|
return gated(revision !== draftSeq && next.input === s.input && committed
|
|
4600
4620
|
? { ...next, input: committed.input } : next);
|
|
4601
4621
|
},
|
|
4622
|
+
submitQuickReply: async (s, arg) => {
|
|
4623
|
+
const revision = draftSeq;
|
|
4624
|
+
const next = await impl.submitQuickReply(s, arg);
|
|
4625
|
+
return gated(revision !== draftSeq && next.input === s.input && committed
|
|
4626
|
+
? { ...next, input: committed.input } : next);
|
|
4627
|
+
},
|
|
4602
4628
|
newChat: (s) => impl.newChat(s).then(gated),
|
|
4603
4629
|
typing: (s, arg) => gated(impl.typing(s, arg)),
|
|
4604
4630
|
tick: (s) => impl.tick(s).then((r) => (r ? gated(r) : r)),
|
|
@@ -55,6 +55,8 @@ import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
|
55
55
|
import { OWNER_MODULES, ownerModuleIds, ownerModuleScreen } from "../_shared/owner-modules.js";
|
|
56
56
|
|
|
57
57
|
const SERVICE = "himiOwnerLiteAria";
|
|
58
|
+
/** The current turn's quick-reply row — this run's state only, never restored. */
|
|
59
|
+
const QUICK_REPLY_KEYS: Array<"quickReplies" | "quickRepliesHidden"> = ["quickReplies", "quickRepliesHidden"];
|
|
58
60
|
|
|
59
61
|
// Cadence for the reply ladder. `fast` while a reply is outstanding; `idle`
|
|
60
62
|
// afterwards, because a worker cannot CANCEL a poll — PollDirective has no stop
|
|
@@ -477,6 +479,7 @@ const svc = defineService<AriaChatState, {
|
|
|
477
479
|
load: (s: AriaChatState, arg?: AriaActionArg) => Promise<AriaChatState>;
|
|
478
480
|
submit: (s: AriaChatState, arg?: AriaActionArg) => Promise<AriaChatState>;
|
|
479
481
|
submitPrompt: (s: AriaChatState, arg?: AriaActionArg) => Promise<AriaChatState>;
|
|
482
|
+
submitQuickReply: (s: AriaChatState, arg?: AriaActionArg) => Promise<AriaChatState>;
|
|
480
483
|
newChat: (s: AriaChatState) => Promise<AriaChatState>;
|
|
481
484
|
typing: (s: AriaChatState, arg?: AriaActionArg) => AriaChatState;
|
|
482
485
|
// `undefined` is part of the contract, not sloppiness: a tick whose read was
|
|
@@ -527,6 +530,10 @@ const svc = defineService<AriaChatState, {
|
|
|
527
530
|
suggestionsSettled: (s: AriaChatState, arg?: AriaActionArg) => AriaChatState | undefined;
|
|
528
531
|
}>(SERVICE, {
|
|
529
532
|
state: core.initialState,
|
|
533
|
+
// Quick replies belong to the turn that is live in THIS run's realtime model. A
|
|
534
|
+
// persisted row would paint (and announce) last session's offers before `load`,
|
|
535
|
+
// and every tap on them would be refused, because the live model starts empty.
|
|
536
|
+
notHydrated: QUICK_REPLY_KEYS,
|
|
530
537
|
actions: {
|
|
531
538
|
// `load` is the onAppear dispatch, so it is where the copy pack arrives.
|
|
532
539
|
load: (s, arg) => { mentionDraftRevision += 1; mentionTriggerPrefixes = []; pendingMentionTrigger = null; previousMentionRaw = ""; adoptedMentionDraft = null; stashCopy(arg); stashTargets(arg); stashRealtimeUrl(arg); return core.load(s); },
|
|
@@ -552,6 +559,18 @@ const svc = defineService<AriaChatState, {
|
|
|
552
559
|
}
|
|
553
560
|
return next;
|
|
554
561
|
},
|
|
562
|
+
// A server-offered quick reply sends through submitPrompt in the core, so it
|
|
563
|
+
// settles the mention draft exactly as a suggested-prompt tap does.
|
|
564
|
+
submitQuickReply: async (s, arg) => {
|
|
565
|
+
const previousPrefixes = mentionTriggerPrefixes; const previousTrigger = pendingMentionTrigger;
|
|
566
|
+
const revision = mentionDraftRevision;
|
|
567
|
+
const next = await core.submitQuickReply(s, arg);
|
|
568
|
+
if (revision === mentionDraftRevision) {
|
|
569
|
+
if (next.input && next.input === s.input) { mentionTriggerPrefixes = previousPrefixes; pendingMentionTrigger = previousTrigger; }
|
|
570
|
+
else { mentionTriggerPrefixes = []; pendingMentionTrigger = null; previousMentionRaw = ""; adoptedMentionDraft = null; }
|
|
571
|
+
}
|
|
572
|
+
return next;
|
|
573
|
+
},
|
|
555
574
|
newChat: (s) => { mentionDraftRevision += 1; mentionTriggerPrefixes = []; pendingMentionTrigger = null; previousMentionRaw = ""; adoptedMentionDraft = null; return core.newChat(s); },
|
|
556
575
|
// The composer's onChange. Mirrors the draft into state so `submit` can
|
|
557
576
|
// empty it and the field actually clears.
|
|
@@ -648,6 +667,16 @@ const svc = defineService<AriaChatState, {
|
|
|
648
667
|
},
|
|
649
668
|
});
|
|
650
669
|
|
|
670
|
+
// A binary older than `notHydrated` restores the persisted row anyway; put those keys
|
|
671
|
+
// back to their declared values before any action runs (as iap-worker's
|
|
672
|
+
// resetUnhydratedKeysOnOlderRuntime does), so no host paints a previous run's offers.
|
|
673
|
+
if ((globalThis as { himalaya?: { hydrationOptOut?: unknown } }).himalaya?.hydrationOptOut !== true) {
|
|
674
|
+
const booted = svc.getState() as unknown as Record<string, unknown> | undefined;
|
|
675
|
+
if (booted && typeof booted === "object") {
|
|
676
|
+
for (const key of QUICK_REPLY_KEYS) booted[key] = (core.initialState as unknown as Record<string, unknown>)[key];
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
651
680
|
// NO module-scope `svc.load()`, deliberately — the descriptor's `onAppear` is the
|
|
652
681
|
// only entry point, and on Android the self-kick did not merely duplicate it, it
|
|
653
682
|
// DISABLED the screen.
|
|
@@ -7,6 +7,7 @@ import config from "../config.js";
|
|
|
7
7
|
const runtimeSetting = (value: unknown): unknown => {
|
|
8
8
|
if (value === "__HIMI_PODCAST_FEED_URL__") return process.env.PODCAST_FEED_URL?.trim() || "";
|
|
9
9
|
if (value === "__HIMI_MEMBER_SITE_URL__") return String((config as { auth?: { config?: { siteUrl?: unknown } } }).auth?.config?.siteUrl ?? "").trim();
|
|
10
|
+
if (typeof value === "string" && value.startsWith("__HIMI_MEMBER_SITE_URL__/")) return String((config as { auth?: { config?: { siteUrl?: unknown } } }).auth?.config?.siteUrl ?? "").trim().replace(/\/+$/, "") + value.slice(24);
|
|
10
11
|
if (Array.isArray(value)) return value.map(runtimeSetting);
|
|
11
12
|
if (!value || typeof value !== "object") return value;
|
|
12
13
|
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, runtimeSetting(child)]));
|
|
@@ -8,6 +8,7 @@ const runtimeSetting = (value: unknown): unknown => {
|
|
|
8
8
|
if (value === "__HIMI_PODCAST_FEED_URL__") return process.env.PODCAST_FEED_URL?.trim() || "";
|
|
9
9
|
if (value === "__HIMI_MEMBER_PHOTO_UPLOAD_FUNCTION__") return process.env.HIMI_BRANDED_LITE_MEMBER_PHOTO_UPLOAD_FUNCTION?.trim() || "";
|
|
10
10
|
if (value === "__HIMI_MEMBER_SITE_URL__") return String((config as { auth?: { config?: { siteUrl?: unknown } } }).auth?.config?.siteUrl ?? "").trim();
|
|
11
|
+
if (typeof value === "string" && value.startsWith("__HIMI_MEMBER_SITE_URL__/")) return String((config as { auth?: { config?: { siteUrl?: unknown } } }).auth?.config?.siteUrl ?? "").trim().replace(/\/+$/, "") + value.slice(24);
|
|
11
12
|
if (Array.isArray(value)) return value.map(runtimeSetting);
|
|
12
13
|
if (!value || typeof value !== "object") return value;
|
|
13
14
|
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, runtimeSetting(child)]));
|
|
@@ -10,6 +10,17 @@ import { dayKey } from "@himalaya/time";
|
|
|
10
10
|
* booking is in exactly one tab. */
|
|
11
11
|
export const CANCELLED_STATUSES = ["CANCELED", "CANCELLED", "DECLINED"];
|
|
12
12
|
|
|
13
|
+
/** Wix made the booking, but no checkout confirmed it: a paid booking the member did not pay
|
|
14
|
+
* for, or left in the payment page, stays here. It holds no place and the business does not
|
|
15
|
+
* see it in its booking calendar, so it is not an appointment. */
|
|
16
|
+
export const UNCONFIRMED_STATUSES = ["CREATED"];
|
|
17
|
+
|
|
18
|
+
export interface FetchMemberBookingsOptions {
|
|
19
|
+
/** Keep the unconfirmed bookings (`UNCONFIRMED_STATUSES`). Only a list that marks them as
|
|
20
|
+
* not confirmed may ask for them; Home and every count leave them out. */
|
|
21
|
+
includeUnconfirmed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
export interface MemberBookingRow {
|
|
14
25
|
id: string; title: string; subtitle: string; status: string; revision: string;
|
|
15
26
|
start: string; end: string; day: string; serviceId: string;
|
|
@@ -70,7 +81,7 @@ export function memberBookingRow(booking: WixBooking): MemberBookingRow {
|
|
|
70
81
|
courseStart: instant(schedule?.firstSessionStart),
|
|
71
82
|
courseEnd: instant(schedule?.lastSessionEnd) };
|
|
72
83
|
}
|
|
73
|
-
export async function fetchMemberBookings(criteria: CollectionQuery, cursor: string, now: string, expected?: MemberAccess) {
|
|
84
|
+
export async function fetchMemberBookings(criteria: CollectionQuery, cursor: string, now: string, expected?: MemberAccess, options: FetchMemberBookingsOptions = {}) {
|
|
74
85
|
const member = expected ?? await memberAccess();
|
|
75
86
|
const metadata = { email: member.email, scope: member.scope, needsSignIn: !member.email };
|
|
76
87
|
if (!member.email) return { items: [] as MemberBookingRow[], nextCursor: "", metadata };
|
|
@@ -79,9 +90,10 @@ export async function fetchMemberBookings(criteria: CollectionQuery, cursor: str
|
|
|
79
90
|
const filter: Record<string, unknown> = { "contactDetails.email": { $eq: member.email } };
|
|
80
91
|
if (criteria.query) filter.id = { $eq: criteria.query };
|
|
81
92
|
if (criteria.filter === "saved") filter.id = criteria.query ? { $in: criteria.savedIds.filter(id => id === criteria.query) } : { $in: criteria.savedIds };
|
|
82
|
-
|
|
93
|
+
const notListed = options.includeUnconfirmed ? CANCELLED_STATUSES : [...CANCELLED_STATUSES, ...UNCONFIRMED_STATUSES];
|
|
94
|
+
if (criteria.filter === "value:Upcoming") { filter.startDate = { $gte: now }; filter.status = { $nin: notListed }; }
|
|
83
95
|
// Past is what took place: a canceled or declined booking is in the Canceled tab only.
|
|
84
|
-
if (criteria.filter === "value:Past") { filter.startDate = { $lt: now }; filter.status = { $nin:
|
|
96
|
+
if (criteria.filter === "value:Past") { filter.startDate = { $lt: now }; filter.status = { $nin: notListed }; }
|
|
85
97
|
if (criteria.filter === "value:Cancelled") filter.status = { $in: CANCELLED_STATUSES };
|
|
86
98
|
const response = await queryBookings({ query: { filter, paging: { limit: 50, offset: Number(cursor || 0) },
|
|
87
99
|
sort: [{ fieldName: "startDate", order: criteria.sort === "za" ? "DESC" : "ASC" }, { fieldName: "id", order: "ASC" }] } });
|
|
@@ -89,6 +101,7 @@ export async function fetchMemberBookings(criteria: CollectionQuery, cursor: str
|
|
|
89
101
|
const raw = response.bookings ?? [];
|
|
90
102
|
// Server authorization remains authoritative. This guard also rejects a
|
|
91
103
|
// malformed/cross-member row before any UI projection. No private disk cache.
|
|
92
|
-
const items = raw.filter(booking => booking.id && booking.contactDetails?.email?.trim().toLowerCase() === member.email).map(memberBookingRow)
|
|
104
|
+
const items = raw.filter(booking => booking.id && booking.contactDetails?.email?.trim().toLowerCase() === member.email).map(memberBookingRow)
|
|
105
|
+
.filter(row => options.includeUnconfirmed || !UNCONFIRMED_STATUSES.includes(row.statusKey));
|
|
93
106
|
return { items, ...offsetPage(cursor, raw.length, 50, response.pagingMetadata), metadata };
|
|
94
107
|
}
|
|
@@ -62273,6 +62273,60 @@ const SCREENS = runtimeSetting({
|
|
|
62273
62273
|
"spacing": 0,
|
|
62274
62274
|
"alignment": "leading",
|
|
62275
62275
|
"children": [
|
|
62276
|
+
{
|
|
62277
|
+
"id": "himi_owner_lite_aria.quickReplies.bound",
|
|
62278
|
+
"body": {
|
|
62279
|
+
"package": "himalaya",
|
|
62280
|
+
"type": "LazyList",
|
|
62281
|
+
"props": {
|
|
62282
|
+
"itemsPath": "$service:himiOwnerLiteAria.quickReplies",
|
|
62283
|
+
"horizontal": true,
|
|
62284
|
+
"spacing": 8,
|
|
62285
|
+
"items": [
|
|
62286
|
+
{
|
|
62287
|
+
"id": "himi_owner_lite_aria.quickReply_$item.id",
|
|
62288
|
+
"body": {
|
|
62289
|
+
"package": "himalaya",
|
|
62290
|
+
"type": "Text",
|
|
62291
|
+
"props": {
|
|
62292
|
+
"text": "$item.label",
|
|
62293
|
+
"style": "footnote",
|
|
62294
|
+
"maxLines": 1
|
|
62295
|
+
}
|
|
62296
|
+
},
|
|
62297
|
+
"modifiers": {
|
|
62298
|
+
"padding": {
|
|
62299
|
+
"leading": 12,
|
|
62300
|
+
"trailing": 12,
|
|
62301
|
+
"top": 16,
|
|
62302
|
+
"bottom": 16
|
|
62303
|
+
},
|
|
62304
|
+
"background": {
|
|
62305
|
+
"token": "surfaceSecondary"
|
|
62306
|
+
},
|
|
62307
|
+
"cornerRadius": 16,
|
|
62308
|
+
"accessibilityLabel": "$item.reply",
|
|
62309
|
+
"onTap": {
|
|
62310
|
+
"actionId": "tier5.himiOwnerLiteAria.submitQuickReply",
|
|
62311
|
+
"params": {
|
|
62312
|
+
"id": "$item.id"
|
|
62313
|
+
}
|
|
62314
|
+
}
|
|
62315
|
+
}
|
|
62316
|
+
}
|
|
62317
|
+
]
|
|
62318
|
+
}
|
|
62319
|
+
},
|
|
62320
|
+
"modifiers": {
|
|
62321
|
+
"hiddenPath": "$service:himiOwnerLiteAria.quickRepliesHidden",
|
|
62322
|
+
"padding": {
|
|
62323
|
+
"leading": 0,
|
|
62324
|
+
"trailing": 0,
|
|
62325
|
+
"top": 8,
|
|
62326
|
+
"bottom": 0
|
|
62327
|
+
}
|
|
62328
|
+
}
|
|
62329
|
+
},
|
|
62276
62330
|
{
|
|
62277
62331
|
"id": "",
|
|
62278
62332
|
"body": {
|
|
@@ -1491,6 +1491,7 @@ export interface AriaChatCore {
|
|
|
1491
1491
|
load(s: AriaChatState): Promise<AriaChatState>;
|
|
1492
1492
|
submit(s: AriaChatState, arg?: AriaActionArg): Promise<AriaChatState>;
|
|
1493
1493
|
submitPrompt(s: AriaChatState, arg?: AriaActionArg): Promise<AriaChatState>;
|
|
1494
|
+
submitQuickReply(s: AriaChatState, arg?: AriaActionArg): Promise<AriaChatState>;
|
|
1494
1495
|
newChat(s: AriaChatState): Promise<AriaChatState>;
|
|
1495
1496
|
/** Mirror the composer's text into state. Not cosmetic: the renderers only
|
|
1496
1497
|
* clear a text field when its BOUND value transitions, so a composer whose
|
|
@@ -2799,6 +2800,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2799
2800
|
/** The quick replies last painted, so an unchanged list keeps its identity and
|
|
2800
2801
|
* a reducer that changed nothing still returns the SAME state object. */
|
|
2801
2802
|
let paintedReplies: AriaQuickReply[] = [];
|
|
2803
|
+
let quickReplyOffer = 0;
|
|
2802
2804
|
|
|
2803
2805
|
/** Ask the host to open the stream for a turn that was just sent, and reset
|
|
2804
2806
|
* the live model to it. `turnId` may be empty (a service that named no id);
|
|
@@ -2867,13 +2869,21 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2867
2869
|
return out;
|
|
2868
2870
|
};
|
|
2869
2871
|
|
|
2872
|
+
const quickReplyLabel = (label: string): string => {
|
|
2873
|
+
const characters = Array.from(label);
|
|
2874
|
+
return characters.length > 30 ? characters.slice(0, 29).join("") + "…" : label;
|
|
2875
|
+
};
|
|
2876
|
+
|
|
2870
2877
|
/** The current turn's quick replies, as rows. */
|
|
2871
2878
|
const repliesFor = (s: AriaChatState): AriaQuickReply[] => {
|
|
2872
2879
|
const offered = !!s._turnId && live.turnId === s._turnId && live.conversationId === s._convId
|
|
2873
2880
|
? live.quickReplies() : [];
|
|
2874
2881
|
const same = offered.length === paintedReplies.length
|
|
2875
|
-
&& offered.every((r, i) => paintedReplies[i].label === r.label && paintedReplies[i].reply === r.reply);
|
|
2876
|
-
if (!same)
|
|
2882
|
+
&& offered.every((r, i) => paintedReplies[i].label === quickReplyLabel(r.label) && paintedReplies[i].reply === r.reply);
|
|
2883
|
+
if (!same) {
|
|
2884
|
+
quickReplyOffer += 1;
|
|
2885
|
+
paintedReplies = offered.map((r, i) => ({ id: `${s._convId}:${s._turnId}:${quickReplyOffer}:qr${i + 1}`, label: quickReplyLabel(r.label), reply: r.reply }));
|
|
2886
|
+
}
|
|
2877
2887
|
return paintedReplies;
|
|
2878
2888
|
};
|
|
2879
2889
|
|
|
@@ -3361,8 +3371,9 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
3361
3371
|
: { ...actioned, attachments: chips, attachmentsHidden };
|
|
3362
3372
|
if (out.mention !== mentionViewNow) out = { ...out, mention: mentionViewNow };
|
|
3363
3373
|
const quickReplies = repliesFor(out);
|
|
3364
|
-
|
|
3365
|
-
|
|
3374
|
+
const quickRepliesHidden = out.status !== "ready" || quickReplies.length === 0;
|
|
3375
|
+
if (out.quickReplies !== quickReplies || out.quickRepliesHidden !== quickRepliesHidden) {
|
|
3376
|
+
out = { ...out, quickReplies, quickRepliesHidden };
|
|
3366
3377
|
}
|
|
3367
3378
|
if (out._realtime !== realtime) out = { ...out, _realtime: realtime };
|
|
3368
3379
|
// Every state the runtime commits passes through here (an `undefined`
|
|
@@ -3651,6 +3662,14 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
3651
3662
|
return send(s, content, chips);
|
|
3652
3663
|
},
|
|
3653
3664
|
|
|
3665
|
+
submitQuickReply: async (s, arg) => {
|
|
3666
|
+
if (s.status !== "ready" || s._siteId !== siteOf()) return s;
|
|
3667
|
+
const id = typeof arg === "string" ? arg : firstString(arg?.id);
|
|
3668
|
+
const offered = repliesFor(s).find((reply) => reply.id === id);
|
|
3669
|
+
if (!offered) return s;
|
|
3670
|
+
return impl.submitPrompt(s, { text: offered.reply });
|
|
3671
|
+
},
|
|
3672
|
+
|
|
3654
3673
|
// A suggested-prompt chip submits its own text through the SAME path a typed
|
|
3655
3674
|
// message takes — never by dispatching `submit` through the service handle,
|
|
3656
3675
|
// which exposes actions as direct methods and has no `.actions` member on
|
|
@@ -4440,6 +4459,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
4440
4459
|
// turn running, and a tick resolving around it must go on reporting that
|
|
4441
4460
|
// turn normally.
|
|
4442
4461
|
turnSeq += 1;
|
|
4462
|
+
live.reset("", "");
|
|
4443
4463
|
return slow(withDraft(
|
|
4444
4464
|
{ ...s, status: "ready", statusText: stoppedText(), error: "", _pending: "", _abortId: "" }, typedAt));
|
|
4445
4465
|
},
|
|
@@ -4599,6 +4619,12 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
4599
4619
|
return gated(revision !== draftSeq && next.input === s.input && committed
|
|
4600
4620
|
? { ...next, input: committed.input } : next);
|
|
4601
4621
|
},
|
|
4622
|
+
submitQuickReply: async (s, arg) => {
|
|
4623
|
+
const revision = draftSeq;
|
|
4624
|
+
const next = await impl.submitQuickReply(s, arg);
|
|
4625
|
+
return gated(revision !== draftSeq && next.input === s.input && committed
|
|
4626
|
+
? { ...next, input: committed.input } : next);
|
|
4627
|
+
},
|
|
4602
4628
|
newChat: (s) => impl.newChat(s).then(gated),
|
|
4603
4629
|
typing: (s, arg) => gated(impl.typing(s, arg)),
|
|
4604
4630
|
tick: (s) => impl.tick(s).then((r) => (r ? gated(r) : r)),
|