@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.
Files changed (170) hide show
  1. package/bin/himi +16 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +9 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +1 -1
  5. package/dist/browser-plane/assets.json +7 -7
  6. package/dist/browser-plane/preview-deferred/{63821bbb8f637899037252154a5587f0596e4b537173c7f50551f9e44f7c22c0.bin → b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin} +1 -1
  7. package/dist/browser-plane/sw.js +6 -6
  8. package/dist/browser-plane/t5-frame.html +1 -1
  9. package/dist/browser-plane/t5-worker-frame.html +1 -1
  10. package/dist/cli.mjs +118 -67
  11. package/dist/preview-assets.generated.bin +0 -0
  12. package/guides/component-reference.json +1 -1
  13. package/guides/component-reference.md +9 -0
  14. package/package.json +2 -2
  15. package/template-icons/medical-services.png +0 -0
  16. package/templates/beauty-salon/dev/index.ts +1 -0
  17. package/templates/beauty-salon/l10n/en.json +6 -0
  18. package/templates/beauty-salon/l10n/fr.json +11 -0
  19. package/templates/beauty-salon/l10n/he.json +9 -0
  20. package/templates/beauty-salon/tier5-src/_shared/member-bookings.ts +17 -4
  21. package/templates/beauty-salon/tier5-src/_shared/staff-name.ts +18 -0
  22. package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +6 -2
  23. package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +7 -2
  24. package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +6 -4
  25. package/templates/beauty-salon-owner/dev/index.ts +54 -0
  26. package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +30 -4
  27. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  28. package/templates/branded-lite/dev/index.ts +1 -0
  29. package/templates/branded-lite/l10n/fr.json +5 -0
  30. package/templates/branded-lite/l10n/he.json +4 -0
  31. package/templates/branded-lite/tier5-src/_shared/member-bookings.ts +17 -4
  32. package/templates/branded-lite/tier5-src/_shared/staff-name.ts +18 -0
  33. package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +6 -2
  34. package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +7 -2
  35. package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +6 -4
  36. package/templates/community-club/dev/index.ts +1 -0
  37. package/templates/community-club/tier5-src/_shared/member-bookings.ts +17 -4
  38. package/templates/community-club-owner/dev/index.ts +54 -0
  39. package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +30 -4
  40. package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  41. package/templates/conference/dev/index.ts +1 -0
  42. package/templates/events-meetups/dev/index.ts +1 -0
  43. package/templates/events-meetups/tier5-src/_shared/member-bookings.ts +17 -4
  44. package/templates/events-meetups-owner/dev/index.ts +54 -0
  45. package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +30 -4
  46. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  47. package/templates/gym-fitness/dev/index.ts +1 -0
  48. package/templates/gym-fitness/l10n/en.json +6 -0
  49. package/templates/gym-fitness/l10n/fr.json +11 -0
  50. package/templates/gym-fitness/l10n/he.json +9 -0
  51. package/templates/gym-fitness/tier5-src/_shared/member-bookings.ts +17 -4
  52. package/templates/gym-fitness/tier5-src/_shared/staff-name.ts +18 -0
  53. package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +6 -2
  54. package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +7 -2
  55. package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +6 -4
  56. package/templates/gym-fitness-owner/dev/index.ts +54 -0
  57. package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +30 -4
  58. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  59. package/templates/medical-services/README.md +53 -0
  60. package/templates/medical-services/config.ts +320 -0
  61. package/templates/medical-services/dev/index.ts +17783 -0
  62. package/templates/medical-services/himalaya.content.json +46 -0
  63. package/templates/medical-services/himalaya.template.json +14 -0
  64. package/templates/medical-services/icon.png +0 -0
  65. package/templates/medical-services/platforms.json +1 -0
  66. package/templates/medical-services/tier5-src/_shared/app-locale.ts +61 -0
  67. package/templates/medical-services/tier5-src/_shared/booking-location.ts +147 -0
  68. package/templates/medical-services/tier5-src/_shared/booking-session.ts +222 -0
  69. package/templates/medical-services/tier5-src/_shared/branded-lite-hosted.ts +280 -0
  70. package/templates/medical-services/tier5-src/_shared/branded-load-state.ts +109 -0
  71. package/templates/medical-services/tier5-src/_shared/business-chat-copy.ts +40 -0
  72. package/templates/medical-services/tier5-src/_shared/business-chat-history.ts +51 -0
  73. package/templates/medical-services/tier5-src/_shared/business-chat-message-model.ts +177 -0
  74. package/templates/medical-services/tier5-src/_shared/business-chat-model.ts +56 -0
  75. package/templates/medical-services/tier5-src/_shared/business-chat-presenter.ts +576 -0
  76. package/templates/medical-services/tier5-src/_shared/business-chat-transport.ts +148 -0
  77. package/templates/medical-services/tier5-src/_shared/collection-contract.ts +228 -0
  78. package/templates/medical-services/tier5-src/_shared/collection-query.ts +193 -0
  79. package/templates/medical-services/tier5-src/_shared/collection-service.ts +400 -0
  80. package/templates/medical-services/tier5-src/_shared/engine-intl.ts +523 -0
  81. package/templates/medical-services/tier5-src/_shared/faq-list.ts +405 -0
  82. package/templates/medical-services/tier5-src/_shared/himi-account.ts +194 -0
  83. package/templates/medical-services/tier5-src/_shared/himi-booking-saved.ts +88 -0
  84. package/templates/medical-services/tier5-src/_shared/himi-bookings.ts +318 -0
  85. package/templates/medical-services/tier5-src/_shared/himi-copy.ts +116 -0
  86. package/templates/medical-services/tier5-src/_shared/himi-store.ts +7 -0
  87. package/templates/medical-services/tier5-src/_shared/himi-text.ts +24 -0
  88. package/templates/medical-services/tier5-src/_shared/host-events.ts +66 -0
  89. package/templates/medical-services/tier5-src/_shared/hosted-checkout.ts +70 -0
  90. package/templates/medical-services/tier5-src/_shared/iap-attendance-form.ts +106 -0
  91. package/templates/medical-services/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
  92. package/templates/medical-services/tier5-src/_shared/iap-attendance.ts +38 -0
  93. package/templates/medical-services/tier5-src/_shared/iap-worker.ts +127 -0
  94. package/templates/medical-services/tier5-src/_shared/inbox-rooms.ts +68 -0
  95. package/templates/medical-services/tier5-src/_shared/local-preferences.ts +38 -0
  96. package/templates/medical-services/tier5-src/_shared/member-access.ts +52 -0
  97. package/templates/medical-services/tier5-src/_shared/member-account-routes.ts +52 -0
  98. package/templates/medical-services/tier5-src/_shared/member-bookings.ts +107 -0
  99. package/templates/medical-services/tier5-src/_shared/member-screen.ts +99 -0
  100. package/templates/medical-services/tier5-src/_shared/notification-target.ts +141 -0
  101. package/templates/medical-services/tier5-src/_shared/offset-page.ts +10 -0
  102. package/templates/medical-services/tier5-src/_shared/online-actions.ts +76 -0
  103. package/templates/medical-services/tier5-src/_shared/owner-load-error.ts +348 -0
  104. package/templates/medical-services/tier5-src/_shared/payment-setup.ts +6 -0
  105. package/templates/medical-services/tier5-src/_shared/rich-body.ts +78 -0
  106. package/templates/medical-services/tier5-src/_shared/rich-content-link.ts +34 -0
  107. package/templates/medical-services/tier5-src/_shared/sign-in-sheet.ts +18 -0
  108. package/templates/medical-services/tier5-src/_shared/staff-name.ts +18 -0
  109. package/templates/medical-services/tier5-src/_shared/weekly-goal.ts +107 -0
  110. package/templates/medical-services/tier5-src/_shared/wix-bi.ts +85 -0
  111. package/templates/medical-services/tier5-src/_shared/wix-member-links.ts +114 -0
  112. package/templates/medical-services/tier5-src/_shared/wix-service-price.ts +146 -0
  113. package/templates/medical-services/tier5-src/business-chat/index.ts +732 -0
  114. package/templates/medical-services/tier5-src/himi-booking-account/index.ts +252 -0
  115. package/templates/medical-services/tier5-src/himi-booking-bookings/index.ts +468 -0
  116. package/templates/medical-services/tier5-src/himi-booking-service/index.ts +1190 -0
  117. package/templates/medical-services/tier5-src/himi-booking-services/index.ts +791 -0
  118. package/templates/medical-services/tier5-src/himi-booking-time/index.ts +1729 -0
  119. package/templates/medical-services/tier5-src/himi-branded-lite-faq/index.ts +6 -0
  120. package/templates/medical-services/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
  121. package/templates/medical-services/tier5-src/himi-clinic-home/index.ts +389 -0
  122. package/templates/medical-services/tier5-src/himi-store-account/index.ts +998 -0
  123. package/templates/medical-services/tokens.json +418 -0
  124. package/templates/nonprofit-cause/dev/index.ts +1 -0
  125. package/templates/nonprofit-cause/tier5-src/_shared/member-bookings.ts +17 -4
  126. package/templates/nonprofit-cause-owner/dev/index.ts +54 -0
  127. package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +30 -4
  128. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  129. package/templates/owner-lite/dev/index.ts +54 -0
  130. package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +30 -4
  131. package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  132. package/templates/podcast-creator/dev/index.ts +1 -0
  133. package/templates/podcast-creator/tier5-src/_shared/member-bookings.ts +17 -4
  134. package/templates/podcast-creator-owner/dev/index.ts +54 -0
  135. package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +30 -4
  136. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  137. package/templates/portfolio-creative/dev/index.ts +1 -0
  138. package/templates/portfolio-creative/tier5-src/_shared/member-bookings.ts +17 -4
  139. package/templates/portfolio-creative-owner/dev/index.ts +54 -0
  140. package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +30 -4
  141. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  142. package/templates/restaurant/dev/index.ts +1 -0
  143. package/templates/restaurant/tier5-src/_shared/member-bookings.ts +17 -4
  144. package/templates/restaurant-owner/dev/index.ts +54 -0
  145. package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +30 -4
  146. package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  147. package/templates/retail-store/dev/index.ts +1 -0
  148. package/templates/retail-store/tier5-src/_shared/member-bookings.ts +17 -4
  149. package/templates/retail-store-owner/dev/index.ts +54 -0
  150. package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +30 -4
  151. package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
  152. package/templates/salon-spa/dev/index.ts +1 -0
  153. package/templates/salon-spa/tier5-src/_shared/member-bookings.ts +17 -4
  154. package/templates/salon-spa/tier5-src/_shared/staff-name.ts +18 -0
  155. package/templates/salon-spa/tier5-src/himi-booking-bookings/index.ts +6 -2
  156. package/templates/salon-spa/tier5-src/himi-booking-service/index.ts +7 -2
  157. package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +6 -4
  158. package/templates/wholesale-store/dev/index.ts +1 -0
  159. package/templates/yoga-studio/dev/index.ts +1 -0
  160. package/templates/yoga-studio/l10n/en.json +6 -0
  161. package/templates/yoga-studio/l10n/fr.json +11 -0
  162. package/templates/yoga-studio/l10n/he.json +9 -0
  163. package/templates/yoga-studio/tier5-src/_shared/member-bookings.ts +17 -4
  164. package/templates/yoga-studio/tier5-src/_shared/staff-name.ts +18 -0
  165. package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +6 -2
  166. package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +7 -2
  167. package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +6 -4
  168. package/templates/yoga-studio-owner/dev/index.ts +54 -0
  169. package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +30 -4
  170. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
@@ -0,0 +1,252 @@
1
+ // Tier-5 bundle: himi-booking — visitor/member account state.
2
+ import { defineService, navigate } from "@himalaya/state";
3
+ import { dispatch } from "@himalaya/dispatch";
4
+ import { queryBookings, type WixBooking } from "@himalaya/wix-bookings";
5
+ import { loadMemberProfile, strOf, fmtDateTime, titleCase, type AccountActivityRow } from "../_shared/himi-account";
6
+ import { stashCopy, copyParam } from "../_shared/himi-copy.js";
7
+ import { memberScreenOpener } from "../_shared/member-screen.js";
8
+
9
+ const openMemberScreen = memberScreenOpener();
10
+
11
+ interface S {
12
+ status: "loading" | "ready";
13
+ isMember: boolean;
14
+ notMember: boolean;
15
+ identityLine: string;
16
+ detailLine: string;
17
+ memberName: string;
18
+ memberEmail: string;
19
+ memberImage: string;
20
+ memberInitials: string;
21
+ hasMemberImage: boolean;
22
+ noMemberImage: boolean;
23
+ authTitle: string;
24
+ authBody: string;
25
+ email: string;
26
+ password: string;
27
+ firstName: string;
28
+ lastName: string;
29
+ message: string;
30
+ isLoading: boolean;
31
+ notLoading: boolean;
32
+ isRegistering: boolean;
33
+ notRegistering: boolean;
34
+ activityTitle: string;
35
+ activitySummary: string;
36
+ activityRows: AccountActivityRow[];
37
+ activityEmptyText: string;
38
+ hasActivity: boolean;
39
+ noActivity: boolean;
40
+ servicesScreenId: string;
41
+ bookingsScreenId: string;
42
+ }
43
+
44
+ function derive(s: S): S {
45
+ const isRegistering = !!s.isRegistering;
46
+ const hasActivity = s.activityRows.length > 0;
47
+ return {
48
+ ...s,
49
+ isLoading: s.status === "loading",
50
+ notLoading: s.status !== "loading",
51
+ notMember: !s.isMember,
52
+ isRegistering,
53
+ notRegistering: !isRegistering,
54
+ hasActivity,
55
+ noActivity: !hasActivity,
56
+ authTitle: isRegistering
57
+ ? copyParam("bookingAccount.authTitleRegister", "Create account")
58
+ : copyParam("bookingAccount.authTitle", "Welcome"),
59
+ authBody: isRegistering
60
+ ? copyParam("bookingAccount.authBodyRegister", "Create a member account to book services and see your history.")
61
+ : copyParam("bookingAccount.authBody", "Sign in to book services and see your history."),
62
+ };
63
+ }
64
+
65
+ function bookingEmail(booking: WixBooking): string {
66
+ const contact = booking.contactDetails as { email?: string; contactEmail?: string } | undefined;
67
+ return (contact?.email ?? contact?.contactEmail ?? "").toLowerCase();
68
+ }
69
+
70
+ function bookingTitle(booking: WixBooking): string {
71
+ const entity = booking.bookedEntity as { serviceName?: string; title?: string } | undefined;
72
+ return entity?.serviceName || entity?.title || "Booking";
73
+ }
74
+
75
+ function bookingStart(booking: WixBooking): string | undefined {
76
+ const entity = booking.bookedEntity as { slot?: { startDate?: string } } | undefined;
77
+ return entity?.slot?.startDate || booking.startDate || booking.createdDate;
78
+ }
79
+
80
+ function bookingRow(booking: WixBooking): AccountActivityRow {
81
+ const start = bookingStart(booking);
82
+ return {
83
+ id: booking.id || start || bookingTitle(booking),
84
+ title: bookingTitle(booking),
85
+ subtitle: fmtDateTime(start) || "Booked time",
86
+ meta: titleCase(booking.paymentStatus) || "",
87
+ status: titleCase(booking.status) || "Booked",
88
+ };
89
+ }
90
+
91
+ async function bookingRows(memberEmail: string): Promise<AccountActivityRow[]> {
92
+ if (!memberEmail) return [];
93
+ const res = await queryBookings({ query: { paging: { limit: 50 } } });
94
+ return (res.bookings ?? [])
95
+ .filter((booking) => bookingEmail(booking) === memberEmail.toLowerCase())
96
+ .sort((a, b) => (Date.parse(bookingStart(b) || "") || 0) - (Date.parse(bookingStart(a) || "") || 0))
97
+ .slice(0, 3)
98
+ .map(bookingRow);
99
+ }
100
+
101
+ async function probe(s: S): Promise<S> {
102
+ const profile = await loadMemberProfile(copyParam("bookingAccount.guestDetail", "Sign in to book services and see your booking history."));
103
+ let activityRows: AccountActivityRow[] = [];
104
+ if (profile.isMember) {
105
+ try {
106
+ activityRows = await bookingRows(profile.memberEmail);
107
+ } catch {
108
+ activityRows = [];
109
+ }
110
+ }
111
+ return derive({
112
+ ...s,
113
+ status: "ready",
114
+ isMember: profile.isMember,
115
+ identityLine: profile.identityLine,
116
+ detailLine: profile.detailLine,
117
+ memberName: profile.memberName,
118
+ memberEmail: profile.memberEmail,
119
+ memberImage: profile.memberImage,
120
+ memberInitials: profile.memberInitials,
121
+ hasMemberImage: profile.hasMemberImage,
122
+ noMemberImage: profile.noMemberImage,
123
+ email: profile.memberEmail || s.email,
124
+ message: "",
125
+ activityRows,
126
+ activityTitle: copyParam("bookingAccount.activityTitle", "Recent bookings"),
127
+ activitySummary: activityRows.length
128
+ ? `${activityRows.length} recent ${activityRows.length === 1 ? "booking" : "bookings"}`
129
+ : copyParam("bookingAccount.activityHint", "Bookings are loaded from Wix Bookings."),
130
+ activityEmptyText: profile.isMember
131
+ ? copyParam("bookingAccount.activityEmptyMember", "No bookings for this member yet.")
132
+ : copyParam("bookingAccount.activityEmptyGuest", "Sign in to see bookings."),
133
+ });
134
+ }
135
+
136
+ function optimisticMember(s: S, email: string): S {
137
+ return derive({
138
+ ...s,
139
+ status: "ready",
140
+ isMember: true,
141
+ identityLine: copyParam("bookingAccount.signedIn", "Signed in"),
142
+ detailLine: email,
143
+ memberName: email,
144
+ memberEmail: email,
145
+ memberImage: "",
146
+ memberInitials: "M",
147
+ hasMemberImage: false,
148
+ noMemberImage: true,
149
+ email,
150
+ password: "",
151
+ firstName: "",
152
+ lastName: "",
153
+ isRegistering: false,
154
+ message: "",
155
+ });
156
+ }
157
+
158
+ const svc = defineService<S, {
159
+ load: (s: S, arg?: unknown) => Promise<S>;
160
+ refresh: (s: S, arg?: unknown) => Promise<S>;
161
+ setEmail: (s: S, arg?: unknown) => S;
162
+ setPassword: (s: S, arg?: unknown) => S;
163
+ setFirstName: (s: S, arg?: unknown) => S;
164
+ setLastName: (s: S, arg?: unknown) => S;
165
+ showRegister: (s: S) => S;
166
+ showSignIn: (s: S) => S;
167
+ signIn: (s: S) => Promise<S>;
168
+ register: (s: S) => Promise<S>;
169
+ signOut: (s: S) => Promise<S>;
170
+ openForMember: (s: S, arg?: unknown) => Promise<S>;
171
+ }>("himiBookingAccount", {
172
+ state: derive({
173
+ status: "loading",
174
+ isMember: false,
175
+ notMember: true,
176
+ identityLine: "",
177
+ detailLine: "",
178
+ memberName: "",
179
+ memberEmail: "",
180
+ memberImage: "",
181
+ memberInitials: "M",
182
+ hasMemberImage: false,
183
+ noMemberImage: true,
184
+ authTitle: "Welcome",
185
+ authBody: "Sign in to book services and see your history.",
186
+ email: "",
187
+ password: "",
188
+ firstName: "",
189
+ lastName: "",
190
+ message: "",
191
+ isLoading: true,
192
+ notLoading: false,
193
+ isRegistering: false,
194
+ notRegistering: true,
195
+ activityTitle: "Recent bookings",
196
+ activitySummary: "",
197
+ activityRows: [],
198
+ activityEmptyText: "No bookings for this member yet.",
199
+ hasActivity: false,
200
+ noActivity: true,
201
+ servicesScreenId: "himi_services",
202
+ bookingsScreenId: "himi_bookings",
203
+ }),
204
+ actions: {
205
+ load: (s, arg) => { stashCopy(arg); return probe(s); },
206
+ refresh: (s, arg) => { stashCopy(arg); return probe(s); },
207
+ setEmail: (s, arg) => derive({ ...s, email: strOf(arg), message: "" }),
208
+ setPassword: (s, arg) => derive({ ...s, password: strOf(arg), message: "" }),
209
+ setFirstName: (s, arg) => derive({ ...s, firstName: strOf(arg), message: "" }),
210
+ setLastName: (s, arg) => derive({ ...s, lastName: strOf(arg), message: "" }),
211
+ showRegister: (s) => derive({ ...s, isRegistering: true, message: "" }),
212
+ showSignIn: (s) => derive({ ...s, isRegistering: false, message: "" }),
213
+ signIn: async (s) => {
214
+ if (!s.email || !s.password) return derive({ ...s, message: copyParam("bookingAccount.validationEmailPassword", "Enter your email and password.") });
215
+ try {
216
+ await dispatch("himi.wix.signInDirect", { email: s.email, password: s.password });
217
+ const next = await probe(optimisticMember(s, s.email));
218
+ return derive({ ...next, password: "", message: next.isMember ? "" : copyParam("bookingAccount.signInCheckDetails", "Sign in failed. Check your details.") });
219
+ } catch {
220
+ return derive({ ...s, password: "", message: copyParam("bookingAccount.signInFailed", "Sign in failed. Try again.") });
221
+ }
222
+ },
223
+ register: async (s) => {
224
+ if (!s.email || !s.password) return derive({ ...s, message: copyParam("bookingAccount.validationEmailPassword", "Enter your email and password.") });
225
+ try {
226
+ await dispatch("himi.wix.registerDirect", {
227
+ email: s.email,
228
+ password: s.password,
229
+ firstName: s.firstName,
230
+ lastName: s.lastName,
231
+ });
232
+ const next = await probe(optimisticMember(s, s.email));
233
+ return derive({ ...next, password: "", message: next.isMember ? "" : copyParam("bookingAccount.registerTrySignIn", "Account creation failed. Try signing in.") });
234
+ } catch {
235
+ return derive({ ...s, password: "", message: copyParam("bookingAccount.registerFailed", "Account creation failed. Try another email.") });
236
+ }
237
+ },
238
+ // A member-only screen from Profile (Salon & Spa's Messages row): a guest signs in first, and the
239
+ // screen opens on `returnTab` once signed in (_shared/member-screen.ts).
240
+ openForMember: async (s, arg): Promise<S> => {
241
+ const nav = await openMemberScreen(arg);
242
+ const current: S = svc.getState?.() ?? s;
243
+ return nav ? navigate(current, nav) : current;
244
+ },
245
+ signOut: async (s) => {
246
+ try { await dispatch("himi.wix.signOut"); } catch { /* ignore */ }
247
+ return probe({ ...s, isMember: false, isRegistering: false, message: "" });
248
+ },
249
+ },
250
+ });
251
+ svc.load();
252
+ export { svc };