@msm-platform/customer-react 0.3.1 → 0.4.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/dist/index.js CHANGED
@@ -18,6 +18,7 @@ var S = {
18
18
  "app.retry": "Try again",
19
19
  "app.signedOut": "You were signed out because your session ended. Sign in again.",
20
20
  "app.signedOutEverywhere": "You were signed out on every device.",
21
+ "image.logo": "{name} logo",
21
22
  "nav.label": "Booking and my account",
22
23
  "nav.book": "Book",
23
24
  "nav.signIn": "Sign in",
@@ -27,11 +28,8 @@ var S = {
27
28
  "nav.signOut": "Sign out",
28
29
  "signIn.heading": "Sign in",
29
30
  "signIn.intro": "We'll text a one-time code to your phone.",
30
- "signIn.toRegister": "New here? Create an account",
31
- "register.heading": "Create an account",
32
- "register.intro": "Enter your name and phone. We'll text you a code.",
31
+ "register.intro": "One more step: what's your name?",
33
32
  "register.name": "Your name",
34
- "register.toSignIn": "Already have an account? Sign in",
35
33
  "signIn.phone": "Phone number",
36
34
  "signIn.codeSent": "Enter the code we sent to {phone}.",
37
35
  "signIn.code": "Verification code",
@@ -46,8 +44,9 @@ var S = {
46
44
  "signIn.error.paused": "Sign-in codes are paused for now. Try again in about {wait}.",
47
45
  "signIn.error.pausedLater": "Sign-in codes are paused for now. Try again later.",
48
46
  "signIn.error.destination": "This number can't receive sign-in codes.",
49
- "signIn.error.badCode": "That code is incorrect or has expired, or this number has no account yet.",
50
- "register.error.badCode": "That code is incorrect or has expired, or this number already has an account.",
47
+ "signIn.error.badCode": "That code is incorrect or has expired.",
48
+ "register.error.expired": "That took too long. Request a new code.",
49
+ "register.error.name": "Check your name and try again.",
51
50
  "signIn.error.invalid": "Check the phone number and try again.",
52
51
  "signIn.error.refused": "This number can't sign in here.",
53
52
  "signIn.error.unreachable": "The sign-in service is unreachable. Try again shortly.",
@@ -110,7 +109,7 @@ var S = {
110
109
  "business.with": "With {resource}",
111
110
  "business.book": "Book",
112
111
  "book.heading": "Your booking",
113
- "book.signInFirst": "Sign in or create an account to book this time.",
112
+ "book.signInFirst": "Sign in with your phone to book this time.",
114
113
  "book.back": "Choose another time",
115
114
  "book.reserving": "Holding this time for you…",
116
115
  "book.heldUntil": "We're holding this time for you until {time}.",
@@ -221,8 +220,8 @@ function F(e, t) {
221
220
  return !e.cancellableUntil || n >= Date.parse(e.cancellableUntil) ? "closed" : e.lateCancellationFrom && n >= Date.parse(e.lateCancellationFrom) ? "late" : "open";
222
221
  }
223
222
  // src/screens/bookings.tsx
224
- var I = "/web/businesses/{businessId}/bookings/{bookingId}/cancel";
225
- function ee() {
223
+ var ee = "/web/businesses/{businessId}/bookings/{bookingId}/cancel";
224
+ function te() {
226
225
  let { client: e } = x(), [n, i] = s("upcoming"), [a, o] = s(), [c, l] = s(null), [u, d] = s(!1), [m, h] = s(), g = t(async (t) => {
227
226
  d(!1);
228
227
  try {
@@ -257,12 +256,12 @@ function ee() {
257
256
  className: "cp-notice",
258
257
  children: T(m)
259
258
  }),
260
- u ? /* @__PURE__ */ f(L, { onRetry: () => g() }) : a ? a.length === 0 ? /* @__PURE__ */ f("p", {
259
+ u ? /* @__PURE__ */ f(I, { onRetry: () => g() }) : a ? a.length === 0 ? /* @__PURE__ */ f("p", {
261
260
  className: "cp-empty",
262
261
  children: T(n === "upcoming" ? "bookings.emptyUpcoming" : "bookings.emptyPast")
263
262
  }) : /* @__PURE__ */ f("ul", {
264
263
  className: "cp-list",
265
- children: a.map((e) => /* @__PURE__ */ f(te, {
264
+ children: a.map((e) => /* @__PURE__ */ f(ne, {
266
265
  booking: e,
267
266
  onCancelled: (e, t) => {
268
267
  o((t) => t?.map((t) => t.id === e.id ? e : t)), h(t ? "bookings.doneLate" : "bookings.doneOnTime");
@@ -281,7 +280,7 @@ function ee() {
281
280
  ]
282
281
  });
283
282
  }
284
- function L({ onRetry: e }) {
283
+ function I({ onRetry: e }) {
285
284
  return /* @__PURE__ */ p("div", {
286
285
  role: "alert",
287
286
  className: "cp-error",
@@ -293,12 +292,12 @@ function L({ onRetry: e }) {
293
292
  })]
294
293
  });
295
294
  }
296
- function te(e) {
295
+ function ne(e) {
297
296
  let { client: t, businesses: n } = x(), { booking: r } = e, i = n.get(r.businessId)?.timezone, [a, o] = s(!1), [c, l] = s(!1), [d, m] = s(), [h, g] = s(!1), _ = h ? "closed" : F(r, /* @__PURE__ */ new Date()), v = r.creditMembershipId !== null && r.creditRestoredAt === null;
298
297
  async function y() {
299
298
  l(!0), m(void 0);
300
299
  try {
301
- let { data: n } = await t.POST(I, { params: { path: {
300
+ let { data: n } = await t.POST(ee, { params: { path: {
302
301
  businessId: r.businessId,
303
302
  bookingId: r.id
304
303
  } } });
@@ -309,7 +308,7 @@ function te(e) {
309
308
  lateCancellationFrom: null
310
309
  }, n.cancelledLate === !0));
311
310
  } catch (e) {
312
- if (u(e, "post", I)) {
311
+ if (u(e, "post", ee)) {
313
312
  if (e.code === "EventStarted") {
314
313
  g(!0), o(!1);
315
314
  return;
@@ -390,8 +389,8 @@ function te(e) {
390
389
  });
391
390
  }
392
391
  // src/booking.tsx
393
- var ne = "/web/businesses/{businessId}/reservations", re = "/web/businesses/{businessId}/reservations/{reservationId}/confirm";
394
- function R({ choice: e }) {
392
+ var re = "/web/businesses/{businessId}/reservations", ie = "/web/businesses/{businessId}/reservations/{reservationId}/confirm";
393
+ function L({ choice: e }) {
395
394
  let { business: t, candidate: n } = e;
396
395
  return /* @__PURE__ */ p("div", {
397
396
  className: "cp-summary",
@@ -406,11 +405,11 @@ function R({ choice: e }) {
406
405
  ]
407
406
  });
408
407
  }
409
- function ie(e) {
408
+ function ae(e) {
410
409
  let { client: n, navigate: i, accountNavigation: a } = x(), { business: c, candidate: l } = e.choice, [m, h] = s({ step: "reserving" }), [g, _] = s(), v = t(async () => {
411
410
  h({ step: "reserving" });
412
411
  try {
413
- let { data: e } = await n.POST(ne, {
412
+ let { data: e } = await n.POST(re, {
414
413
  params: { path: { businessId: c.id } },
415
414
  body: l.eventId ? { eventId: l.eventId } : {
416
415
  eventTypeId: l.eventTypeId,
@@ -424,10 +423,10 @@ function ie(e) {
424
423
  expiresAt: e.expiresAt
425
424
  });
426
425
  } catch (e) {
427
- let t = u(e, "post", ne) ? e.code : void 0;
426
+ let t = u(e, "post", re) ? e.code : void 0;
428
427
  h({
429
428
  step: "refused",
430
- message: ae(t),
429
+ message: oe(t),
431
430
  again: !1
432
431
  });
433
432
  }
@@ -446,7 +445,7 @@ function ie(e) {
446
445
  expiresAt: r
447
446
  });
448
447
  try {
449
- let { data: r } = await n.POST(re, { params: { path: {
448
+ let { data: r } = await n.POST(ie, { params: { path: {
450
449
  businessId: c.id,
451
450
  reservationId: t
452
451
  } } });
@@ -461,14 +460,14 @@ function ie(e) {
461
460
  booking: i
462
461
  });
463
462
  } catch (e) {
464
- let t = u(e, "post", re) ? e.code : void 0;
463
+ let t = u(e, "post", ie) ? e.code : void 0;
465
464
  h(t === "ReservationExpired" || t === "ReservationNotFound" ? {
466
465
  step: "refused",
467
466
  message: "book.expired",
468
467
  again: !0
469
468
  } : {
470
469
  step: "refused",
471
- message: oe(t),
470
+ message: se(t),
472
471
  again: !1
473
472
  });
474
473
  }
@@ -489,7 +488,7 @@ function ie(e) {
489
488
  }),
490
489
  m.booking ? /* @__PURE__ */ f("ul", {
491
490
  className: "cp-list",
492
- children: /* @__PURE__ */ f(te, {
491
+ children: /* @__PURE__ */ f(ne, {
493
492
  booking: m.booking,
494
493
  onCancelled: (e, t) => {
495
494
  h({
@@ -498,7 +497,7 @@ function ie(e) {
498
497
  }), _(t ? "bookings.doneLate" : "bookings.doneOnTime");
499
498
  }
500
499
  })
501
- }) : /* @__PURE__ */ f(R, { choice: e.choice }),
500
+ }) : /* @__PURE__ */ f(L, { choice: e.choice }),
502
501
  a ? /* @__PURE__ */ f("button", {
503
502
  type: "button",
504
503
  className: "cp-secondary",
@@ -511,7 +510,7 @@ function ie(e) {
511
510
  children: T("book.done")
512
511
  })
513
512
  ] }) : /* @__PURE__ */ p(d, { children: [
514
- /* @__PURE__ */ f(R, { choice: e.choice }),
513
+ /* @__PURE__ */ f(L, { choice: e.choice }),
515
514
  m.step === "reserving" && /* @__PURE__ */ f("p", {
516
515
  role: "status",
517
516
  children: T("book.reserving")
@@ -542,7 +541,7 @@ function ie(e) {
542
541
  ] })]
543
542
  });
544
543
  }
545
- function ae(e) {
544
+ function oe(e) {
546
545
  switch (e) {
547
546
  case "EventFull": return "book.full";
548
547
  case "SlotTaken": return "book.slotTaken";
@@ -557,7 +556,7 @@ function ae(e) {
557
556
  default: return "book.failed";
558
557
  }
559
558
  }
560
- function oe(e) {
559
+ function se(e) {
561
560
  switch (e) {
562
561
  case "NotAuthorized": return "book.notAllowed";
563
562
  case "EventStarted":
@@ -568,7 +567,7 @@ function oe(e) {
568
567
  }
569
568
  }
570
569
  // src/layout.tsx
571
- function se({ brand: e }) {
570
+ function R({ brand: e }) {
572
571
  return e ? /* @__PURE__ */ p("div", {
573
572
  className: "cp-brand",
574
573
  children: [e.logo && /* @__PURE__ */ f("img", {
@@ -582,14 +581,14 @@ var ce = [["businesses", "nav.book"]], le = [
582
581
  ["passes", "nav.passes"],
583
582
  ["details", "nav.details"]
584
583
  ], ue = [...ce, ...le];
585
- function z(e) {
584
+ function de(e) {
586
585
  let t = typeof e.screen == "string" ? e.screen : "businesses";
587
586
  return /* @__PURE__ */ p("div", {
588
587
  className: "cp-shell",
589
588
  children: [
590
589
  /* @__PURE__ */ p("header", {
591
590
  className: "cp-header",
592
- children: [/* @__PURE__ */ f(se, { brand: e.brand }), e.signedIn ? /* @__PURE__ */ f("button", {
591
+ children: [/* @__PURE__ */ f(R, { brand: e.brand }), e.signedIn ? /* @__PURE__ */ f("button", {
593
592
  type: "button",
594
593
  className: "cp-link",
595
594
  onClick: e.onSignOut,
@@ -619,18 +618,18 @@ function z(e) {
619
618
  });
620
619
  }
621
620
  // src/client.ts
622
- var B = (e, t) => {
621
+ var z = (e, t) => {
623
622
  let n = new Request(e, t);
624
623
  return n.headers.set("X-MSM-BFF", "1"), fetch(n);
625
624
  };
626
- function V(e, t, n) {
627
- return B(`${e}${t}`, {
625
+ function B(e, t, n) {
626
+ return z(`${e}${t}`, {
628
627
  method: "POST",
629
628
  headers: { "content-type": "application/json" },
630
629
  body: JSON.stringify(n ?? {})
631
630
  });
632
631
  }
633
- function de(e, t) {
632
+ function fe(e, t) {
634
633
  let n = l({ baseUrl: `${e}/engine` });
635
634
  return n.use({
636
635
  onRequest({ request: e }) {
@@ -642,38 +641,38 @@ function de(e, t) {
642
641
  }), n;
643
642
  }
644
643
  // src/session.ts
645
- var H = /* @__PURE__ */ new Map();
646
- function U(e) {
647
- let t = H.get(e);
644
+ var V = /* @__PURE__ */ new Map();
645
+ function H(e) {
646
+ let t = V.get(e);
648
647
  return t || (t = {
649
648
  value: void 0,
650
649
  listeners: /* @__PURE__ */ new Set(),
651
650
  generation: 0
652
- }, H.set(e, t)), t;
651
+ }, V.set(e, t)), t;
653
652
  }
654
- function W(e, t) {
655
- let n = U(e);
653
+ function U(e, t) {
654
+ let n = H(e);
656
655
  if (n.value !== t) {
657
656
  n.value = t;
658
657
  for (let e of n.listeners) e();
659
658
  }
660
659
  }
661
- function fe(e, t) {
660
+ function pe(e, t) {
662
661
  let { generation: n } = t, r = (r) => {
663
- t.generation === n && t.value === void 0 && W(e, r);
662
+ t.generation === n && t.value === void 0 && U(e, r);
664
663
  };
665
- B(`${e}/auth/session`).then(async (e) => r(e.ok ? (await e.json()).sessionKey : null)).catch(() => r(null));
664
+ z(`${e}/auth/session`).then(async (e) => r(e.ok ? (await e.json()).sessionKey : null)).catch(() => r(null));
666
665
  }
667
- function pe(e, t) {
668
- let n = U(e);
669
- return n.listeners.size === 0 && n.value === void 0 && fe(e, n), n.listeners.add(t), () => {
666
+ function me(e, t) {
667
+ let n = H(e);
668
+ return n.listeners.size === 0 && n.value === void 0 && pe(e, n), n.listeners.add(t), () => {
670
669
  n.listeners.delete(t), n.listeners.size === 0 && queueMicrotask(() => {
671
670
  n.listeners.size > 0 || (n.value = void 0, n.generation++);
672
671
  });
673
672
  };
674
673
  }
675
- function me(e, t) {
676
- let n = c((t) => pe(e, t), () => U(e).value, () => void 0), i = o(void 0), a = o(t);
674
+ function he(e, t) {
675
+ let n = c((t) => me(e, t), () => H(e).value, () => void 0), i = o(void 0), a = o(t);
677
676
  return a.current = t, r(() => {
678
677
  if (n === void 0) return;
679
678
  let e = n !== null;
@@ -681,11 +680,11 @@ function me(e, t) {
681
680
  }, [n]), n;
682
681
  }
683
682
  // src/portal.tsx
684
- function G(e) {
685
- let { navigate: n, accountNavigation: i } = e, c = e.basePath.replace(/\/$/, ""), l = me(c, e.onSessionChange), u = o(!1);
683
+ function W(e) {
684
+ let { navigate: n, accountNavigation: i } = e, c = e.basePath.replace(/\/$/, ""), l = he(c, e.onSessionChange), u = o(!1);
686
685
  u.current = !!l;
687
- let [d, f] = s(), [p, m] = s(/* @__PURE__ */ new Map()), [h, g] = s("loading"), _ = a(() => de(c, () => {
688
- u.current && f("app.signedOut"), W(c, null);
686
+ let [d, f] = s(), [p, m] = s(/* @__PURE__ */ new Map()), [h, g] = s("loading"), _ = a(() => fe(c, () => {
687
+ u.current && f("app.signedOut"), U(c, null);
689
688
  }), [c]), v = t(async () => {
690
689
  g("loading");
691
690
  try {
@@ -717,7 +716,7 @@ function G(e) {
717
716
  navigate: n,
718
717
  accountNavigation: i,
719
718
  signOut: async (e) => {
720
- await V(c, "/auth/logout").catch(() => {}), f(e), W(c, null);
719
+ await B(c, "/auth/logout").catch(() => {}), f(e), U(c, null);
721
720
  }
722
721
  }), [
723
722
  _,
@@ -729,11 +728,11 @@ function G(e) {
729
728
  c
730
729
  ]),
731
730
  signedInAs: t((e) => {
732
- f(void 0), W(c, e);
731
+ f(void 0), U(c, e);
733
732
  }, [c])
734
733
  };
735
734
  }
736
- function K(e) {
735
+ function G(e) {
737
736
  return /* @__PURE__ */ f("div", {
738
737
  className: "msm-customer",
739
738
  children: e.loading ? /* @__PURE__ */ f("p", {
@@ -746,13 +745,46 @@ function K(e) {
746
745
  })
747
746
  });
748
747
  }
748
+ // src/image.tsx
749
+ function K(e) {
750
+ let { image: t, alt: n, className: r } = e;
751
+ if (!t) return null;
752
+ let { small: i } = t;
753
+ return e.size === "small" ? /* @__PURE__ */ f("img", {
754
+ className: r,
755
+ src: i.url,
756
+ width: i.width,
757
+ height: i.height,
758
+ alt: n,
759
+ loading: "lazy",
760
+ decoding: "async"
761
+ }) : i.url === t.url ? /* @__PURE__ */ f("img", {
762
+ className: r,
763
+ src: t.url,
764
+ width: t.width,
765
+ height: t.height,
766
+ alt: n,
767
+ loading: "lazy",
768
+ decoding: "async"
769
+ }) : /* @__PURE__ */ f("img", {
770
+ className: r,
771
+ src: t.url,
772
+ srcSet: `${i.url} ${i.width}w, ${t.url} ${t.width}w`,
773
+ sizes: "(min-width: 640px) 608px, calc(100vw - 32px)",
774
+ width: t.width,
775
+ height: t.height,
776
+ alt: n,
777
+ loading: "lazy",
778
+ decoding: "async"
779
+ });
780
+ }
749
781
  // src/screens/business.tsx
750
- var he = "/web/businesses/{businessId}", ge = /* @__PURE__ */ new Set([
782
+ var ge = "/web/businesses/{businessId}", _e = /* @__PURE__ */ new Set([
751
783
  "BusinessNotFound",
752
784
  "OutsideClientScope",
753
785
  "ValidationFailed"
754
- ]), _e = 7;
755
- function ve(e, t = /* @__PURE__ */ new Date()) {
786
+ ]), ve = 7;
787
+ function ye(e, t = /* @__PURE__ */ new Date()) {
756
788
  return new Intl.DateTimeFormat("en-CA", {
757
789
  timeZone: e,
758
790
  year: "numeric",
@@ -764,14 +796,14 @@ function q(e, t) {
764
796
  let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
765
797
  return n.setUTCDate(n.getUTCDate() + t), n.toISOString().slice(0, 10);
766
798
  }
767
- function ye(e) {
799
+ function be(e) {
768
800
  let { client: n } = x(), [i, a] = s(), [o, c] = s(), [l, d] = s(!1), f = t(async () => {
769
801
  d(!1), a(void 0);
770
802
  try {
771
- let [t, r] = await Promise.all([n.GET(he, { params: { path: { businessId: e } } }), n.GET("/web/businesses/{businessId}/event-types", { params: { path: { businessId: e } } })]);
803
+ let [t, r] = await Promise.all([n.GET(ge, { params: { path: { businessId: e } } }), n.GET("/web/businesses/{businessId}/event-types", { params: { path: { businessId: e } } })]);
772
804
  a(t.data ?? null), c(r.data?.items ?? []);
773
805
  } catch (e) {
774
- u(e) && ge.has(e.code ?? "") ? a(null) : d(!0);
806
+ u(e) && _e.has(e.code ?? "") ? a(null) : d(!0);
775
807
  }
776
808
  }, [n, e]);
777
809
  return r(() => {
@@ -783,10 +815,10 @@ function ye(e) {
783
815
  reload: f
784
816
  };
785
817
  }
786
- function be(e, t) {
818
+ function xe(e, t) {
787
819
  if (e.failed) return /* @__PURE__ */ p("section", {
788
820
  className: "cp-screen",
789
- children: [t, /* @__PURE__ */ f(L, { onRetry: e.reload })]
821
+ children: [t, /* @__PURE__ */ f(I, { onRetry: e.reload })]
790
822
  });
791
823
  if (e.business === null) return /* @__PURE__ */ p("section", {
792
824
  className: "cp-screen",
@@ -803,25 +835,25 @@ function be(e, t) {
803
835
  })]
804
836
  });
805
837
  }
806
- function xe(e) {
838
+ function Se(e) {
807
839
  let t = /* @__PURE__ */ new Map();
808
840
  for (let n of e) for (let e of n.resources) t.has(e.id) || t.set(e.id, e);
809
841
  return [...t.values()];
810
842
  }
811
- function Se(e) {
812
- let { navigate: t, accountNavigation: n } = x(), { businessId: r, eventTypeId: i, onFilter: a } = e, o = ye(r), s = n && /* @__PURE__ */ f("button", {
843
+ function Ce(e) {
844
+ let { navigate: t, accountNavigation: n } = x(), { businessId: r, eventTypeId: i, onFilter: a } = e, o = be(r), s = n && /* @__PURE__ */ f("button", {
813
845
  type: "button",
814
846
  className: "cp-link cp-back",
815
847
  onClick: () => t("businesses"),
816
848
  children: T("business.all")
817
- }), c = be(o, s), { business: l, types: u } = o;
849
+ }), c = xe(o, s), { business: l, types: u } = o;
818
850
  if (c || !l || !u) return c;
819
- let m = u.find((e) => e.id === i), h = a ? xe(m ? [m] : u) : [], g = h.some((t) => t.id === e.resourceId) ? e.resourceId : void 0, _ = (e) => {
851
+ let m = u.find((e) => e.id === i), h = a ? Se(m ? [m] : u) : [], g = h.some((t) => t.id === e.resourceId) ? e.resourceId : void 0, _ = (e) => {
820
852
  if (!a) return t(e ? {
821
853
  businessId: r,
822
854
  eventTypeId: e
823
855
  } : { businessId: r });
824
- let n = u.find((t) => t.id === e), i = g && xe(n ? [n] : u).some((e) => e.id === g);
856
+ let n = u.find((t) => t.id === e), i = g && Se(n ? [n] : u).some((e) => e.id === g);
825
857
  a({
826
858
  ...e && { eventTypeId: e },
827
859
  ...i && { resourceId: g }
@@ -831,13 +863,7 @@ function Se(e) {
831
863
  className: "cp-screen",
832
864
  children: [
833
865
  s,
834
- /* @__PURE__ */ p("header", {
835
- className: "cp-business-head",
836
- children: [/* @__PURE__ */ f("h1", { children: l.displayName }), l.address && /* @__PURE__ */ f("p", {
837
- className: "cp-hint",
838
- children: l.address
839
- })]
840
- }),
866
+ /* @__PURE__ */ f(we, { business: l }),
841
867
  u.length > 0 && /* @__PURE__ */ p("fieldset", {
842
868
  className: "cp-chips",
843
869
  "aria-label": T("business.types"),
@@ -877,7 +903,7 @@ function Se(e) {
877
903
  i && !m ? /* @__PURE__ */ f("p", {
878
904
  className: "cp-empty",
879
905
  children: T("business.typeMissing")
880
- }) : /* @__PURE__ */ p(d, { children: [m && /* @__PURE__ */ f(J, { type: m }), /* @__PURE__ */ f(Ce, {
906
+ }) : /* @__PURE__ */ p(d, { children: [m && /* @__PURE__ */ f(J, { type: m }), /* @__PURE__ */ f(Te, {
881
907
  business: l,
882
908
  eventTypeId: i,
883
909
  resourceId: g,
@@ -886,10 +912,30 @@ function Se(e) {
886
912
  ]
887
913
  });
888
914
  }
915
+ function we({ business: e }) {
916
+ return /* @__PURE__ */ p("header", {
917
+ className: "cp-business-head",
918
+ children: [/* @__PURE__ */ f(K, {
919
+ image: e.logo,
920
+ alt: T("image.logo", { name: e.displayName }),
921
+ size: "small",
922
+ className: "cp-logo"
923
+ }), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", { children: e.displayName }), e.address && /* @__PURE__ */ f("p", {
924
+ className: "cp-hint",
925
+ children: e.address
926
+ })] })]
927
+ });
928
+ }
889
929
  function J({ type: e }) {
890
930
  return /* @__PURE__ */ p("div", {
891
931
  className: "cp-type",
892
932
  children: [
933
+ /* @__PURE__ */ f(K, {
934
+ image: e.image,
935
+ alt: e.displayName,
936
+ size: "full",
937
+ className: "cp-detail-image"
938
+ }),
893
939
  /* @__PURE__ */ f("h2", { children: e.displayName }),
894
940
  e.description && /* @__PURE__ */ f("p", { children: e.description }),
895
941
  /* @__PURE__ */ f("p", {
@@ -899,8 +945,8 @@ function J({ type: e }) {
899
945
  ]
900
946
  });
901
947
  }
902
- function Ce(e) {
903
- let { client: n } = x(), { business: i, eventTypeId: a, resourceId: o } = e, c = i.timezone, [l, u] = s(0), [m, h] = s(), [g, _] = s(!1), v = q(ve(c), l * _e), y = q(v, _e), b = t(async () => {
948
+ function Te(e) {
949
+ let { client: n } = x(), { business: i, eventTypeId: a, resourceId: o } = e, c = i.timezone, [l, u] = s(0), [m, h] = s(), [g, _] = s(!1), v = q(ye(c), l * ve), y = q(v, ve), b = t(async () => {
904
950
  _(!1), h(void 0);
905
951
  try {
906
952
  let { data: e } = await n.GET("/web/businesses/{businessId}/availability", { params: {
@@ -958,14 +1004,14 @@ function Ce(e) {
958
1004
  children: "›"
959
1005
  })
960
1006
  ]
961
- }), g ? /* @__PURE__ */ f(L, { onRetry: b }) : m ? C.size === 0 ? /* @__PURE__ */ f("p", {
1007
+ }), g ? /* @__PURE__ */ f(I, { onRetry: b }) : m ? C.size === 0 ? /* @__PURE__ */ f("p", {
962
1008
  className: "cp-empty",
963
1009
  children: T("business.empty")
964
1010
  }) : [...C].map(([t, n]) => /* @__PURE__ */ p("div", {
965
1011
  className: "cp-day",
966
1012
  children: [/* @__PURE__ */ f("h2", { children: t }), /* @__PURE__ */ f("ul", {
967
1013
  className: "cp-list",
968
- children: n.map((t) => /* @__PURE__ */ f(we, {
1014
+ children: n.map((t) => /* @__PURE__ */ f(Ee, {
969
1015
  candidate: t,
970
1016
  onChoose: () => e.onChoose(t)
971
1017
  }, `${t.eventId ?? t.eventTypeId}-${t.resource?.id ?? ""}-${t.startsAt}`))
@@ -975,7 +1021,7 @@ function Ce(e) {
975
1021
  children: T("app.loading")
976
1022
  })] });
977
1023
  }
978
- function we(e) {
1024
+ function Ee(e) {
979
1025
  let { candidate: t } = e, n = t.kind === "slot";
980
1026
  return /* @__PURE__ */ p("li", {
981
1027
  className: "cp-card cp-candidate",
@@ -1012,11 +1058,11 @@ function we(e) {
1012
1058
  });
1013
1059
  }
1014
1060
  // src/screens/businesses.tsx
1015
- function Te() {
1061
+ function De() {
1016
1062
  let { businesses: e, businessesStatus: t, reloadBusinesses: n, navigate: r } = x(), i = [...e.values()];
1017
1063
  return /* @__PURE__ */ p("section", {
1018
1064
  className: "cp-screen",
1019
- children: [/* @__PURE__ */ f("h1", { children: T("businesses.heading") }), t === "failed" ? /* @__PURE__ */ f(L, { onRetry: n }) : t === "loading" ? /* @__PURE__ */ f("p", {
1065
+ children: [/* @__PURE__ */ f("h1", { children: T("businesses.heading") }), t === "failed" ? /* @__PURE__ */ f(I, { onRetry: n }) : t === "loading" ? /* @__PURE__ */ f("p", {
1020
1066
  role: "status",
1021
1067
  children: T("app.loading")
1022
1068
  }) : i.length === 0 ? /* @__PURE__ */ f("p", {
@@ -1030,6 +1076,12 @@ function Te() {
1030
1076
  children: i.map((e) => /* @__PURE__ */ p("li", {
1031
1077
  className: "cp-card cp-business",
1032
1078
  children: [
1079
+ /* @__PURE__ */ f(K, {
1080
+ image: e.logo,
1081
+ alt: "",
1082
+ size: "small",
1083
+ className: "cp-logo"
1084
+ }),
1033
1085
  /* @__PURE__ */ f("h2", { children: e.displayName }),
1034
1086
  e.address && /* @__PURE__ */ f("p", { children: e.address }),
1035
1087
  /* @__PURE__ */ f("button", {
@@ -1043,7 +1095,7 @@ function Te() {
1043
1095
  });
1044
1096
  }
1045
1097
  // src/screens/details.tsx
1046
- function Ee() {
1098
+ function Oe() {
1047
1099
  let { client: e, signOut: n } = x(), [i, a] = s(), [o, c] = s(""), [l, u] = s(!1), [m, h] = s(!1), [g, _] = s(), v = t(async () => {
1048
1100
  u(!1);
1049
1101
  try {
@@ -1088,7 +1140,7 @@ function Ee() {
1088
1140
  }
1089
1141
  return /* @__PURE__ */ p("section", {
1090
1142
  className: "cp-screen",
1091
- children: [/* @__PURE__ */ f("h1", { children: T("details.heading") }), l ? /* @__PURE__ */ f(L, { onRetry: v }) : i ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("form", {
1143
+ children: [/* @__PURE__ */ f("h1", { children: T("details.heading") }), l ? /* @__PURE__ */ f(I, { onRetry: v }) : i ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("form", {
1092
1144
  className: "cp-card cp-form",
1093
1145
  onSubmit: y,
1094
1146
  "aria-busy": m,
@@ -1139,7 +1191,7 @@ function Ee() {
1139
1191
  });
1140
1192
  }
1141
1193
  // src/screens/passes.tsx
1142
- function De() {
1194
+ function ke() {
1143
1195
  let { client: e, businesses: n } = x(), [i, a] = s(), [o, c] = s(!1), l = t(async () => {
1144
1196
  c(!1);
1145
1197
  try {
@@ -1153,7 +1205,7 @@ function De() {
1153
1205
  l();
1154
1206
  }, [l]), /* @__PURE__ */ p("section", {
1155
1207
  className: "cp-screen",
1156
- children: [/* @__PURE__ */ f("h1", { children: T("passes.heading") }), o ? /* @__PURE__ */ f(L, { onRetry: l }) : i ? i.length === 0 ? /* @__PURE__ */ f("p", {
1208
+ children: [/* @__PURE__ */ f("h1", { children: T("passes.heading") }), o ? /* @__PURE__ */ f(I, { onRetry: l }) : i ? i.length === 0 ? /* @__PURE__ */ f("p", {
1157
1209
  className: "cp-empty",
1158
1210
  children: T("passes.empty")
1159
1211
  }) : /* @__PURE__ */ f("ul", {
@@ -1195,13 +1247,13 @@ function De() {
1195
1247
  });
1196
1248
  }
1197
1249
  // ../ui/dist/index.js
1198
- var Oe = new Intl.DisplayNames(["en"], { type: "region" }), ke = (e) => e.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().trim(), Y = h().map((e) => ({
1250
+ var Ae = new Intl.DisplayNames(["en"], { type: "region" }), je = (e) => e.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().trim(), Y = h().map((e) => ({
1199
1251
  code: e,
1200
- name: Oe.of(e) ?? e,
1252
+ name: Ae.of(e) ?? e,
1201
1253
  callingCode: g(e),
1202
1254
  flag: String.fromCodePoint(...[...e].map((e) => 127397 + e.charCodeAt(0)))
1203
- })).sort((e, t) => e.name.localeCompare(t.name)), Ae = new Map(Y.map((e) => [e.code, e])), je = (e) => Ae.get(e);
1204
- function Me(e) {
1255
+ })).sort((e, t) => e.name.localeCompare(t.name)), Me = new Map(Y.map((e) => [e.code, e])), Ne = (e) => Me.get(e);
1256
+ function Pe(e) {
1205
1257
  let t = i(), n = o(null), a = o(null), c = o(null), [l, u] = s(""), d = e.search(l), m = () => n.current?.close(), h = (t) => {
1206
1258
  m(), e.onPick(t);
1207
1259
  };
@@ -1275,10 +1327,10 @@ function Me(e) {
1275
1327
  ]
1276
1328
  });
1277
1329
  }
1278
- var Ne = new m(), X = (e) => je(e);
1279
- function Pe(e) {
1330
+ var Fe = new m(), X = (e) => Ne(e);
1331
+ function Ie(e) {
1280
1332
  for (let t = 1; t <= 3 && t <= e.length; t++) {
1281
- let n = e.slice(0, t), r = (y.country_calling_codes[n] ?? []).filter((e) => je(e) !== void 0), [i] = r;
1333
+ let n = e.slice(0, t), r = (y.country_calling_codes[n] ?? []).filter((e) => Ne(e) !== void 0), [i] = r;
1282
1334
  if (i) return {
1283
1335
  code: n,
1284
1336
  first: i,
@@ -1287,10 +1339,10 @@ function Pe(e) {
1287
1339
  }
1288
1340
  return null;
1289
1341
  }
1290
- function Fe(e, t) {
1342
+ function Le(e, t) {
1291
1343
  let n = /^\s*(\+|00)/.exec(e);
1292
1344
  if (!n) return null;
1293
- let r = e.slice(n[0].length), i = r.replace(/\D/g, ""), a = Pe(i);
1345
+ let r = e.slice(n[0].length), i = r.replace(/\D/g, ""), a = Ie(i);
1294
1346
  if (!a) return null;
1295
1347
  let o = _(`+${i}`), s = a.countries.includes(t) ? t : o?.country ?? a.first, c = 0;
1296
1348
  for (let e = 0; e < a.code.length; c++) /\d/.test(r.charAt(c)) && e++;
@@ -1299,45 +1351,45 @@ function Fe(e, t) {
1299
1351
  text: o?.isValid() ? o.formatNational() : r.slice(c).replace(/^[\s\-().]+/, "")
1300
1352
  };
1301
1353
  }
1302
- function Ie(e, t) {
1354
+ function Re(e, t) {
1303
1355
  let n = t.replace(/\D/g, "");
1304
1356
  return n === "" ? "" : t.trim().startsWith("+") ? `+${n}` : _(t, e)?.number ?? `+${X(e).callingCode}${n}`;
1305
1357
  }
1306
- function Le(e) {
1307
- return Ne.selectNumberingPlan(e), Ne.numberingPlan?.possibleLengths() ?? [];
1358
+ function ze(e) {
1359
+ return Fe.selectNumberingPlan(e), Fe.numberingPlan?.possibleLengths() ?? [];
1308
1360
  }
1309
- function Re(e, t, n) {
1361
+ function Be(e, t, n) {
1310
1362
  if (e === "") return t ? "Enter a phone number." : "";
1311
1363
  let r = _(e);
1312
1364
  if (r?.isValid()) return "";
1313
- let i = e.replace(/\D/g, ""), a = Pe(i);
1365
+ let i = e.replace(/\D/g, ""), a = Ie(i);
1314
1366
  if (!a) return "Unknown country code. Choose the country from the list.";
1315
1367
  let o = n && a.countries.includes(n) ? n : r?.country ?? a.first, s = X(o).name, c = v(i.slice(a.code.length), o);
1316
1368
  if (c && c !== "NOT_A_NUMBER") {
1317
- let e = Le(o), t = e[0] ?? 0, n = e[e.length - 1] ?? 0;
1369
+ let e = ze(o), t = e[0] ?? 0, n = e[e.length - 1] ?? 0;
1318
1370
  return e.length === 1 ? `Enter a ${t}-digit number for ${s}.` : e.length > 2 && n - t === e.length - 1 ? `Enter ${t} to ${n} digits for ${s}.` : `Enter ${e.slice(0, -1).join(", ")} or ${n} digits for ${s}.`;
1319
1371
  }
1320
1372
  return `This is not a valid number for ${s}.`;
1321
1373
  }
1322
- function ze(e, t = !1) {
1323
- return Re(e, t);
1374
+ function Ve(e, t = !1) {
1375
+ return Be(e, t);
1324
1376
  }
1325
- function Be(e, t) {
1326
- return Fe(e, t) ?? {
1377
+ function He(e, t) {
1378
+ return Le(e, t) ?? {
1327
1379
  country: t,
1328
1380
  text: e
1329
1381
  };
1330
1382
  }
1331
- function Ve(e) {
1383
+ function Ue(e) {
1332
1384
  let t = i(), n = o(null), [a, c] = s(() => ({
1333
1385
  value: e.value,
1334
- ...Be(e.value, "IS")
1386
+ ...He(e.value, "IS")
1335
1387
  })), l = a;
1336
1388
  e.value !== a.value && (l = {
1337
1389
  value: e.value,
1338
- ...Be(e.value, a.country)
1390
+ ...He(e.value, a.country)
1339
1391
  }, c(l));
1340
- let [u, d] = s(!1), [m, h] = s(!1), g = X(l.country), _ = Re(l.value, e.required ?? !1, l.country), v = u && _ !== "" ? _ : e.error ?? "", y = v !== "";
1392
+ let [u, d] = s(!1), [m, h] = s(!1), g = X(l.country), _ = Be(l.value, e.required ?? !1, l.country), v = u && _ !== "" ? _ : e.error ?? "", y = v !== "";
1341
1393
  r(() => {
1342
1394
  let e = n.current?.form;
1343
1395
  if (!e) return;
@@ -1347,7 +1399,7 @@ function Ve(e) {
1347
1399
  return e.addEventListener("submit", t), () => e.removeEventListener("submit", t);
1348
1400
  }, []);
1349
1401
  let b = (t, n) => {
1350
- let r = Ie(t, n);
1402
+ let r = Re(t, n);
1351
1403
  c({
1352
1404
  value: r,
1353
1405
  country: t,
@@ -1390,7 +1442,7 @@ function Ve(e) {
1390
1442
  "aria-invalid": y || void 0,
1391
1443
  "aria-describedby": y ? `${t}-problem` : void 0,
1392
1444
  onChange: (e) => {
1393
- let t = e.target.value.replace(/[^\d\s\-().+]/g, ""), n = Fe(t, l.country);
1445
+ let t = e.target.value.replace(/[^\d\s\-().+]/g, ""), n = Le(t, l.country);
1394
1446
  b(n?.country ?? l.country, n?.text ?? t);
1395
1447
  },
1396
1448
  onBlur: () => {
@@ -1404,12 +1456,12 @@ function Ve(e) {
1404
1456
  role: "alert",
1405
1457
  children: v
1406
1458
  }),
1407
- m && /* @__PURE__ */ f(Me, {
1459
+ m && /* @__PURE__ */ f(Pe, {
1408
1460
  title: "Country code",
1409
1461
  searchLabel: "Search by country or code",
1410
1462
  listLabel: "Countries",
1411
1463
  empty: (e) => `No country matches “${e}”.`,
1412
- search: He,
1464
+ search: We,
1413
1465
  selected: l.country,
1414
1466
  onClose: () => h(!1),
1415
1467
  onPick: (e) => {
@@ -1419,9 +1471,9 @@ function Ve(e) {
1419
1471
  ]
1420
1472
  });
1421
1473
  }
1422
- function He(e) {
1423
- let t = ke(e).replace(/^(\+|00)/, "");
1424
- return (t === "" ? Y : /^\d+$/.test(t) ? Y.filter((e) => e.callingCode.startsWith(t)) : Y.filter((e) => ke(e.name).includes(t) || e.code.toLowerCase() === t)).map((e) => ({
1474
+ function We(e) {
1475
+ let t = je(e).replace(/^(\+|00)/, "");
1476
+ return (t === "" ? Y : /^\d+$/.test(t) ? Y.filter((e) => e.callingCode.startsWith(t)) : Y.filter((e) => je(e.name).includes(t) || e.code.toLowerCase() === t)).map((e) => ({
1425
1477
  value: e.code,
1426
1478
  label: e.name,
1427
1479
  hint: `+${e.callingCode}`,
@@ -1429,31 +1481,31 @@ function He(e) {
1429
1481
  }));
1430
1482
  }
1431
1483
  // src/bot-check.tsx
1432
- var Ue = () => window.turnstile, We = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit", Z;
1433
- function Ge() {
1434
- let e = Ue();
1484
+ var Ge = () => window.turnstile, Ke = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit", Z;
1485
+ function qe() {
1486
+ let e = Ge();
1435
1487
  return e ? Promise.resolve(e) : (Z ??= new Promise((e, t) => {
1436
1488
  let n = document.createElement("script");
1437
- n.src = We, n.async = !0;
1489
+ n.src = Ke, n.async = !0;
1438
1490
  let r = () => {
1439
1491
  Z = void 0, n.remove(), t(/* @__PURE__ */ Error("Turnstile did not load."));
1440
1492
  };
1441
1493
  n.onload = () => {
1442
- let t = Ue();
1494
+ let t = Ge();
1443
1495
  t ? e(t) : r();
1444
1496
  }, n.onerror = r, document.head.append(n);
1445
1497
  }), Z);
1446
1498
  }
1447
- function Ke(e) {
1499
+ function Je(e) {
1448
1500
  return e?.provider === "turnstile" && typeof e.siteKey == "string" && e.siteKey.trim() !== "";
1449
1501
  }
1450
- function qe(e) {
1502
+ function Ye(e) {
1451
1503
  let t = o(null), n = o(void 0), i = o(e);
1452
1504
  i.current = e;
1453
1505
  let { siteKey: a } = e.botCheck;
1454
1506
  r(() => {
1455
1507
  let e = !0;
1456
- return Ge().then((r) => {
1508
+ return qe().then((r) => {
1457
1509
  let o = t.current;
1458
1510
  if (!e || !o) return;
1459
1511
  let s = r.render(o, {
@@ -1490,7 +1542,7 @@ function Q(e) {
1490
1542
  r(() => {
1491
1543
  n && t.current?.querySelector("input")?.focus();
1492
1544
  }, [n]);
1493
- let [i, a] = s("sign-in"), [c, l] = s(""), [u, m] = s(""), [h, g] = s(""), [_, v] = s(), [y, b] = s(), [x, S] = s(!1), [C, w] = s(), [E, D] = s(0), O = Ke(e.botCheck) ? e.botCheck : void 0, [k, A] = s();
1545
+ let [i, a] = s("phone"), [c, l] = s(""), [u, m] = s(""), [h, g] = s(""), [_, v] = s(), [y, b] = s(), [x, S] = s(!1), [C, w] = s(), [E, D] = s(0), O = Je(e.botCheck) ? e.botCheck : void 0, [k, A] = s();
1494
1546
  r(() => {
1495
1547
  if (!k) return;
1496
1548
  let e = setTimeout(() => {
@@ -1498,43 +1550,43 @@ function Q(e) {
1498
1550
  }, k.seconds * 1e3);
1499
1551
  return () => clearTimeout(e);
1500
1552
  }, [k]);
1501
- let j = i === "register";
1553
+ function j(e) {
1554
+ a("phone"), v(void 0), g(""), l(""), b(e);
1555
+ }
1502
1556
  async function M(t) {
1503
- if (t.preventDefault(), _ || !ze(u, !0) && O && C) {
1557
+ if (t.preventDefault(), (i !== "phone" || !Ve(u, !0) && O && C) && (i !== "name" || c.trim())) {
1504
1558
  S(!0), b(void 0);
1505
1559
  try {
1506
- let t = _ ? await V(e.basePath, j ? "/auth/register" : "/auth/login", {
1507
- challenge: _,
1508
- code: h
1509
- }) : j ? await V(e.basePath, "/auth/register/initiate", {
1510
- phone: u,
1511
- name: c.trim(),
1512
- botCheckToken: C
1513
- }) : await V(e.basePath, "/auth/initiate", {
1560
+ let t = i === "phone" ? await B(e.basePath, "/auth/initiate", {
1514
1561
  phone: u,
1515
1562
  botCheckToken: C
1516
- });
1563
+ }) : i === "code" ? await B(e.basePath, "/auth/login", {
1564
+ challenge: _,
1565
+ code: h
1566
+ }) : await B(e.basePath, "/auth/register", { name: c.trim() });
1517
1567
  if (t.ok) {
1518
1568
  let n = await t.json();
1519
- _ ? e.onSignedIn(n.sessionKey) : v(n.challenge);
1569
+ i === "phone" ? (v(n.challenge), a("code")) : n.result === "nameRequired" ? a("name") : e.onSignedIn(n.sessionKey);
1520
1570
  return;
1521
1571
  }
1522
- let n = await t.json().catch(() => void 0), r = Number(t.headers.get("retry-after")), i = Number.isInteger(r) && r > 0 ? r : void 0, a = Je(t.status, n?.code, i, !!_, j);
1523
- t.status === 429 && i && !_ && A({
1572
+ let n = await t.json().catch(() => void 0);
1573
+ if (i === "name" && t.status === 401) {
1574
+ j(T("register.error.expired"));
1575
+ return;
1576
+ }
1577
+ let r = Number(t.headers.get("retry-after")), o = Number.isInteger(r) && r > 0 ? r : void 0, s = Xe(t.status, n?.code, o, i);
1578
+ t.status === 429 && o && i === "phone" && A({
1524
1579
  phone: u,
1525
- seconds: i,
1526
- message: a
1527
- }), b(a);
1580
+ seconds: o,
1581
+ message: s
1582
+ }), b(s);
1528
1583
  } catch {
1529
1584
  b(T("signIn.error.unreachable"));
1530
1585
  } finally {
1531
- S(!1), _ || D((e) => e + 1);
1586
+ S(!1), i === "phone" && D((e) => e + 1);
1532
1587
  }
1533
1588
  }
1534
1589
  }
1535
- function N(e) {
1536
- a(e), v(void 0), g(""), b(void 0);
1537
- }
1538
1590
  return /* @__PURE__ */ f("div", {
1539
1591
  className: "cp-sign-in",
1540
1592
  children: /* @__PURE__ */ p("form", {
@@ -1542,15 +1594,22 @@ function Q(e) {
1542
1594
  onSubmit: M,
1543
1595
  "aria-busy": x,
1544
1596
  children: [
1545
- /* @__PURE__ */ f(se, { brand: e.brand }),
1546
- /* @__PURE__ */ f("h1", { children: T(j ? "register.heading" : "signIn.heading") }),
1597
+ /* @__PURE__ */ f(R, { brand: e.brand }),
1598
+ /* @__PURE__ */ f("h1", { children: T("signIn.heading") }),
1547
1599
  e.children,
1548
- e.notice && !_ && /* @__PURE__ */ f("p", {
1600
+ e.notice && i === "phone" && /* @__PURE__ */ f("p", {
1549
1601
  role: "status",
1550
1602
  className: "cp-notice",
1551
1603
  children: T(e.notice)
1552
1604
  }),
1553
- _ ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", { children: T("signIn.codeSent", { phone: u }) }), /* @__PURE__ */ p("label", { children: [T("signIn.code"), /* @__PURE__ */ f("input", {
1605
+ i === "name" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", { children: T("register.intro") }), /* @__PURE__ */ p("label", { children: [T("register.name"), /* @__PURE__ */ f("input", {
1606
+ value: c,
1607
+ onChange: (e) => l(e.target.value),
1608
+ autoComplete: "name",
1609
+ maxLength: 200,
1610
+ required: !0,
1611
+ autoFocus: !0
1612
+ })] })] }) : i === "code" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", { children: T("signIn.codeSent", { phone: u }) }), /* @__PURE__ */ p("label", { children: [T("signIn.code"), /* @__PURE__ */ f("input", {
1554
1613
  value: h,
1555
1614
  onChange: (e) => g(e.target.value),
1556
1615
  inputMode: "numeric",
@@ -1558,28 +1617,21 @@ function Q(e) {
1558
1617
  required: !0,
1559
1618
  autoFocus: !0
1560
1619
  })] })] }) : /* @__PURE__ */ p(d, { children: [
1561
- /* @__PURE__ */ f("p", { children: T(j ? "register.intro" : "signIn.intro") }),
1562
- j && /* @__PURE__ */ p("label", { children: [T("register.name"), /* @__PURE__ */ f("input", {
1563
- value: c,
1564
- onChange: (e) => l(e.target.value),
1565
- autoComplete: "name",
1566
- maxLength: 200,
1567
- required: !0
1568
- })] }),
1569
- /* @__PURE__ */ f(Ve, {
1620
+ /* @__PURE__ */ f("p", { children: T("signIn.intro") }),
1621
+ /* @__PURE__ */ f(Ue, {
1570
1622
  label: T("signIn.phone"),
1571
1623
  value: u,
1572
1624
  onChange: m,
1573
1625
  required: !0
1574
1626
  }),
1575
- O && /* @__PURE__ */ f(qe, {
1627
+ O && /* @__PURE__ */ f(Ye, {
1576
1628
  botCheck: O,
1577
1629
  attempt: E,
1578
1630
  onToken: w,
1579
1631
  onUnavailable: () => b(T("signIn.error.botCheckUnavailable"))
1580
1632
  })
1581
1633
  ] }),
1582
- !_ && !O && /* @__PURE__ */ f("p", {
1634
+ i === "phone" && !O && /* @__PURE__ */ f("p", {
1583
1635
  role: "alert",
1584
1636
  children: T("signIn.error.notConfigured")
1585
1637
  }),
@@ -1589,19 +1641,14 @@ function Q(e) {
1589
1641
  }),
1590
1642
  /* @__PURE__ */ f("button", {
1591
1643
  type: "submit",
1592
- disabled: x || !_ && (!O || !C || k?.phone === u),
1593
- children: T(x ? "signIn.wait" : _ ? j ? "register.submit" : "signIn.submit" : "signIn.sendCode")
1644
+ disabled: x || i === "phone" && (!O || !C || k?.phone === u),
1645
+ children: T(x ? "signIn.wait" : i === "phone" ? "signIn.sendCode" : i === "code" ? "signIn.submit" : "register.submit")
1594
1646
  }),
1595
- _ ? /* @__PURE__ */ f("button", {
1647
+ i !== "phone" && /* @__PURE__ */ f("button", {
1596
1648
  type: "button",
1597
1649
  className: "cp-secondary",
1598
- onClick: () => N(i),
1650
+ onClick: () => j(),
1599
1651
  children: T("signIn.differentNumber")
1600
- }) : /* @__PURE__ */ f("button", {
1601
- type: "button",
1602
- className: "cp-link",
1603
- onClick: () => N(j ? "sign-in" : "register"),
1604
- children: T(j ? "register.toSignIn" : "signIn.toRegister")
1605
1652
  }),
1606
1653
  e.onCancel && /* @__PURE__ */ f("button", {
1607
1654
  type: "button",
@@ -1613,29 +1660,32 @@ function Q(e) {
1613
1660
  })
1614
1661
  });
1615
1662
  }
1616
- function Je(e, t, n, r, i) {
1617
- return e === 429 ? n ? T("signIn.error.tooMany", { wait: P(n) }) : T("signIn.error.tooManyLater") : !r && e === 403 && t === "BotCheckFailed" ? T("signIn.error.botCheck") : !r && e === 503 && t === "BotCheckUnavailable" ? T("signIn.error.botCheckUnavailable") : !r && e === 503 && (t === "LimiterUnavailable" || t === "ClientIpUnavailable") ? T("signIn.error.failed") : !r && e === 503 ? n ? T("signIn.error.paused", { wait: P(n) }) : T("signIn.error.pausedLater") : !r && e === 422 && t === "PhoneDestinationNotAllowed" ? T("signIn.error.destination") : r && [
1663
+ function Xe(e, t, n, r) {
1664
+ if (e === 429) return n ? T("signIn.error.tooMany", { wait: P(n) }) : T("signIn.error.tooManyLater");
1665
+ if (r === "name" && (e === 400 || e === 422)) return T("register.error.name");
1666
+ let i = r === "phone";
1667
+ return i && e === 403 && t === "BotCheckFailed" ? T("signIn.error.botCheck") : i && e === 503 && t === "BotCheckUnavailable" ? T("signIn.error.botCheckUnavailable") : i && e === 503 && (t === "LimiterUnavailable" || t === "ClientIpUnavailable") ? T("signIn.error.failed") : i && e === 503 ? n ? T("signIn.error.paused", { wait: P(n) }) : T("signIn.error.pausedLater") : i && e === 422 && t === "PhoneDestinationNotAllowed" ? T("signIn.error.destination") : r === "code" && [
1618
1668
  400,
1619
1669
  401,
1620
1670
  403,
1621
1671
  404,
1622
1672
  409
1623
- ].includes(e) ? T(i ? "register.error.badCode" : "signIn.error.badCode") : T(e === 400 ? "signIn.error.invalid" : e === 403 ? "signIn.error.refused" : "signIn.error.failed");
1673
+ ].includes(e) ? T("signIn.error.badCode") : T(e === 400 ? "signIn.error.invalid" : e === 403 ? "signIn.error.refused" : "signIn.error.failed");
1624
1674
  }
1625
1675
  // src/account.tsx
1626
- function Ye(e) {
1676
+ function Ze(e) {
1627
1677
  let [n, r] = s("bookings"), i = e.screen ?? n, a = e.onNavigate ?? r, o = t((e) => {
1628
1678
  (e === "bookings" || e === "passes" || e === "details") && a(e);
1629
- }, [a]), { basePath: c, sessionKey: l, notice: u, portal: d, signedInAs: p } = G({
1679
+ }, [a]), { basePath: c, sessionKey: l, notice: u, portal: d, signedInAs: p } = W({
1630
1680
  basePath: e.basePath,
1631
1681
  navigate: o,
1632
1682
  accountNavigation: !0,
1633
1683
  onSessionChange: e.onSessionChange
1634
1684
  });
1635
- return /* @__PURE__ */ f(K, {
1685
+ return /* @__PURE__ */ f(G, {
1636
1686
  portal: d,
1637
1687
  loading: l === void 0,
1638
- children: /* @__PURE__ */ f(z, {
1688
+ children: /* @__PURE__ */ f(de, {
1639
1689
  brand: e.brand,
1640
1690
  tabs: le,
1641
1691
  screen: i,
@@ -1643,7 +1693,7 @@ function Ye(e) {
1643
1693
  signingIn: !l,
1644
1694
  onNavigate: o,
1645
1695
  onSignOut: () => d.signOut(),
1646
- children: l ? f(i === "passes" ? De : i === "details" ? Ee : ee, {}) : /* @__PURE__ */ f(Q, {
1696
+ children: l ? f(i === "passes" ? ke : i === "details" ? Oe : te, {}) : /* @__PURE__ */ f(Q, {
1647
1697
  basePath: c,
1648
1698
  brand: void 0,
1649
1699
  botCheck: e.botCheck,
@@ -1655,7 +1705,7 @@ function Ye(e) {
1655
1705
  });
1656
1706
  }
1657
1707
  // src/booking-flow.tsx
1658
- function Xe(e) {
1708
+ function Qe(e) {
1659
1709
  return {
1660
1710
  startsAt: e.startsAt,
1661
1711
  eventTypeId: e.eventTypeId,
@@ -1671,10 +1721,10 @@ function $(e) {
1671
1721
  e.resourceId ?? ""
1672
1722
  ].join("|") : "";
1673
1723
  }
1674
- function Ze(e, t) {
1724
+ function $e(e, t) {
1675
1725
  return t.eventId ? e.eventId === t.eventId : e.eventTypeId === t.eventTypeId && Date.parse(e.startsAt) === Date.parse(t.startsAt) && (!t.resourceId || e.resource?.id === t.resourceId);
1676
1726
  }
1677
- function Qe(e) {
1727
+ function et(e) {
1678
1728
  let n = e.onChange !== void 0, r = {
1679
1729
  businessId: e.businessId,
1680
1730
  ...e.eventTypeId && { eventTypeId: e.eventTypeId },
@@ -1694,12 +1744,12 @@ function Qe(e) {
1694
1744
  businessId: e.businessId,
1695
1745
  ...e.eventTypeId && { eventTypeId: e.eventTypeId }
1696
1746
  });
1697
- }, [h]), { basePath: _, sessionKey: v, notice: y, portal: b, signedInAs: x } = G({
1747
+ }, [h]), { basePath: _, sessionKey: v, notice: y, portal: b, signedInAs: x } = W({
1698
1748
  basePath: e.basePath,
1699
1749
  navigate: g,
1700
1750
  accountNavigation: !1,
1701
1751
  onSessionChange: e.onSessionChange
1702
- }), [S, C] = s(), [w, E] = s(), D = u.time, O = $(D), k = S && D && S.business.id === u.businessId && $(Xe(S.candidate)) === O ? S : void 0, A = () => {
1752
+ }), [S, C] = s(), [w, E] = s(), D = u.time, O = $(D), k = S && D && S.business.id === u.businessId && $(Qe(S.candidate)) === O ? S : void 0, A = () => {
1703
1753
  C(void 0);
1704
1754
  let { time: e, ...t } = u;
1705
1755
  h(t);
@@ -1709,10 +1759,10 @@ function Qe(e) {
1709
1759
  candidate: t
1710
1760
  }), h({
1711
1761
  ...u,
1712
- time: Xe(t)
1762
+ time: Qe(t)
1713
1763
  });
1714
1764
  }, M;
1715
- M = k ? v ? /* @__PURE__ */ f(ie, {
1765
+ M = k ? v ? /* @__PURE__ */ f(ae, {
1716
1766
  choice: k,
1717
1767
  onBack: A,
1718
1768
  onBooked: e.onBooked,
@@ -1726,7 +1776,7 @@ function Qe(e) {
1726
1776
  autoFocus: !0,
1727
1777
  children: [
1728
1778
  /* @__PURE__ */ f("p", { children: T("book.signInFirst") }),
1729
- /* @__PURE__ */ f(R, { choice: k }),
1779
+ /* @__PURE__ */ f(L, { choice: k }),
1730
1780
  /* @__PURE__ */ f("button", {
1731
1781
  type: "button",
1732
1782
  className: "cp-link",
@@ -1734,7 +1784,7 @@ function Qe(e) {
1734
1784
  children: T("book.back")
1735
1785
  })
1736
1786
  ]
1737
- }) : D && w !== O ? /* @__PURE__ */ f(et, {
1787
+ }) : D && w !== O ? /* @__PURE__ */ f(nt, {
1738
1788
  businessId: u.businessId,
1739
1789
  time: D,
1740
1790
  onFound: C,
@@ -1744,7 +1794,7 @@ function Qe(e) {
1744
1794
  className: "cp-link cp-back",
1745
1795
  onClick: () => h({ businessId: u.businessId }),
1746
1796
  children: T("book.toTypes")
1747
- }), /* @__PURE__ */ f(Se, {
1797
+ }), /* @__PURE__ */ f(Ce, {
1748
1798
  businessId: u.businessId,
1749
1799
  eventTypeId: u.eventTypeId,
1750
1800
  resourceId: u.resourceId,
@@ -1754,7 +1804,7 @@ function Qe(e) {
1754
1804
  ...e
1755
1805
  }),
1756
1806
  onChoose: j
1757
- })] }) : /* @__PURE__ */ f($e, {
1807
+ })] }) : /* @__PURE__ */ f(tt, {
1758
1808
  selection: u,
1759
1809
  change: h,
1760
1810
  onChoose: j
@@ -1765,10 +1815,10 @@ function Qe(e) {
1765
1815
  u.resourceId ?? "",
1766
1816
  D && w !== O ? "time" : ""
1767
1817
  ].join("/");
1768
- return /* @__PURE__ */ f(K, {
1818
+ return /* @__PURE__ */ f(G, {
1769
1819
  portal: b,
1770
1820
  loading: v === void 0,
1771
- children: /* @__PURE__ */ p(nt, {
1821
+ children: /* @__PURE__ */ p(it, {
1772
1822
  step: N,
1773
1823
  children: [
1774
1824
  e.onClose && /* @__PURE__ */ f("div", {
@@ -1790,16 +1840,10 @@ function Qe(e) {
1790
1840
  })
1791
1841
  });
1792
1842
  }
1793
- function $e(e) {
1794
- let { selection: t, change: n } = e, { businessId: r, eventTypeId: i } = t, a = ye(r), o = be(a, null), { business: s, types: c } = a;
1843
+ function tt(e) {
1844
+ let { selection: t, change: n } = e, { businessId: r, eventTypeId: i } = t, a = be(r), o = xe(a, null), { business: s, types: c } = a;
1795
1845
  if (o || !s || !c) return o;
1796
- let l = /* @__PURE__ */ p("header", {
1797
- className: "cp-business-head",
1798
- children: [/* @__PURE__ */ f("h1", { children: s.displayName }), s.address && /* @__PURE__ */ f("p", {
1799
- className: "cp-hint",
1800
- children: s.address
1801
- })]
1802
- }), u = /* @__PURE__ */ f("button", {
1846
+ let l = /* @__PURE__ */ f(we, { business: s }), u = /* @__PURE__ */ f("button", {
1803
1847
  type: "button",
1804
1848
  className: "cp-link cp-back",
1805
1849
  onClick: () => n({ businessId: r }),
@@ -1827,6 +1871,12 @@ function $e(e) {
1827
1871
  eventTypeId: e.id
1828
1872
  }),
1829
1873
  children: [
1874
+ /* @__PURE__ */ f(K, {
1875
+ image: e.image,
1876
+ alt: "",
1877
+ size: "small",
1878
+ className: "cp-thumb"
1879
+ }),
1830
1880
  /* @__PURE__ */ f("strong", { children: e.displayName }),
1831
1881
  e.description && /* @__PURE__ */ f("span", { children: e.description }),
1832
1882
  /* @__PURE__ */ f("span", { children: T("business.minutes", { minutes: e.durationMinutes }) })
@@ -1857,7 +1907,8 @@ function $e(e) {
1857
1907
  children: [{
1858
1908
  id: "any",
1859
1909
  displayName: T("book.anyResource"),
1860
- description: T("book.anyResourceHint")
1910
+ description: T("book.anyResourceHint"),
1911
+ image: null
1861
1912
  }, ...d.resources].map((e) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ p("button", {
1862
1913
  type: "button",
1863
1914
  className: "cp-option",
@@ -1866,7 +1917,16 @@ function $e(e) {
1866
1917
  eventTypeId: d.id,
1867
1918
  resourceId: e.id
1868
1919
  }),
1869
- children: [/* @__PURE__ */ f("strong", { children: e.displayName }), e.description && /* @__PURE__ */ f("span", { children: e.description })]
1920
+ children: [
1921
+ /* @__PURE__ */ f(K, {
1922
+ image: e.image,
1923
+ alt: "",
1924
+ size: "small",
1925
+ className: "cp-thumb"
1926
+ }),
1927
+ /* @__PURE__ */ f("strong", { children: e.displayName }),
1928
+ e.description && /* @__PURE__ */ f("span", { children: e.description })
1929
+ ]
1870
1930
  }) }, e.id))
1871
1931
  })
1872
1932
  ]
@@ -1888,7 +1948,7 @@ function $e(e) {
1888
1948
  className: "cp-hint",
1889
1949
  children: T("business.with", { resource: h.displayName })
1890
1950
  }),
1891
- /* @__PURE__ */ f(Ce, {
1951
+ /* @__PURE__ */ f(Te, {
1892
1952
  business: s,
1893
1953
  eventTypeId: d.id,
1894
1954
  resourceId: m ? h?.id : void 0,
@@ -1897,7 +1957,7 @@ function $e(e) {
1897
1957
  ]
1898
1958
  });
1899
1959
  }
1900
- function et(e) {
1960
+ function nt(e) {
1901
1961
  let { client: t } = x(), { businessId: n, time: i } = e, a = o(e);
1902
1962
  a.current = e;
1903
1963
  let s = $(i);
@@ -1906,7 +1966,7 @@ function et(e) {
1906
1966
  return (async () => {
1907
1967
  let { data: r } = await t.GET("/web/businesses/{businessId}", { params: { path: { businessId: n } } });
1908
1968
  if (!r) throw Error("no business");
1909
- let o = ve(r.timezone, new Date(i.startsAt)), { data: s } = await t.GET("/web/businesses/{businessId}/availability", { params: {
1969
+ let o = ye(r.timezone, new Date(i.startsAt)), { data: s } = await t.GET("/web/businesses/{businessId}/availability", { params: {
1910
1970
  path: { businessId: n },
1911
1971
  query: {
1912
1972
  from: `${o}T00:00`,
@@ -1914,7 +1974,7 @@ function et(e) {
1914
1974
  eventTypeId: i.eventTypeId,
1915
1975
  ...!i.eventId && i.resourceId && { resourceId: i.resourceId }
1916
1976
  }
1917
- } }), c = s?.items.find((e) => Ze(e, i));
1977
+ } }), c = s?.items.find((e) => $e(e, i));
1918
1978
  e && (c ? a.current.onFound({
1919
1979
  business: r,
1920
1980
  candidate: c
@@ -1936,8 +1996,8 @@ function et(e) {
1936
1996
  })
1937
1997
  });
1938
1998
  }
1939
- var tt = "input, .cp-option, .cp-chips button, .cp-candidate button, .cp-actions button:not(:disabled)";
1940
- function nt(e) {
1999
+ var rt = "input, .cp-option, .cp-chips button, .cp-candidate button, .cp-actions button:not(:disabled)";
2000
+ function it(e) {
1941
2001
  let t = o(null), n = o(!1), { step: i } = e;
1942
2002
  return r(() => {
1943
2003
  let e = t.current;
@@ -1945,7 +2005,7 @@ function nt(e) {
1945
2005
  let r = n.current;
1946
2006
  if (n.current = !0, r && e.contains(document.activeElement)) return;
1947
2007
  let i = () => {
1948
- let t = e.querySelector(tt);
2008
+ let t = e.querySelector(rt);
1949
2009
  return t?.focus(), !!t;
1950
2010
  };
1951
2011
  if (i()) return;
@@ -1967,8 +2027,8 @@ function nt(e) {
1967
2027
  });
1968
2028
  }
1969
2029
  // src/sign-in-standalone.tsx
1970
- function rt(e) {
1971
- let t = e.basePath.replace(/\/$/, ""), n = me(t, e.onSessionChange), i = o(e.onSignedIn);
2030
+ function at(e) {
2031
+ let t = e.basePath.replace(/\/$/, ""), n = he(t, e.onSessionChange), i = o(e.onSignedIn);
1972
2032
  i.current = e.onSignedIn;
1973
2033
  let a = o(!1);
1974
2034
  return r(() => {
@@ -1984,15 +2044,15 @@ function rt(e) {
1984
2044
  brand: e.brand,
1985
2045
  botCheck: e.botCheck,
1986
2046
  notice: void 0,
1987
- onSignedIn: (e) => W(t, e),
2047
+ onSignedIn: (e) => U(t, e),
1988
2048
  onCancel: e.onCancel,
1989
2049
  autoFocus: !0
1990
2050
  })
1991
2051
  });
1992
2052
  }
1993
2053
  // src/index.tsx
1994
- function it(e) {
1995
- let [t, n] = s("businesses"), r = e.screen ?? t, i = e.onNavigate ?? n, { basePath: a, sessionKey: o, notice: c, portal: l, signedInAs: u } = G({
2054
+ function ot(e) {
2055
+ let [t, n] = s("businesses"), r = e.screen ?? t, i = e.onNavigate ?? n, { basePath: a, sessionKey: o, notice: c, portal: l, signedInAs: u } = W({
1996
2056
  basePath: e.basePath,
1997
2057
  navigate: i,
1998
2058
  accountNavigation: !0,
@@ -2007,10 +2067,10 @@ function it(e) {
2007
2067
  onSignedIn: u,
2008
2068
  children: t
2009
2069
  });
2010
- return /* @__PURE__ */ f(K, {
2070
+ return /* @__PURE__ */ f(G, {
2011
2071
  portal: l,
2012
2072
  loading: o === void 0,
2013
- children: /* @__PURE__ */ f(z, {
2073
+ children: /* @__PURE__ */ f(de, {
2014
2074
  brand: e.brand,
2015
2075
  tabs: ue,
2016
2076
  screen: r,
@@ -2018,27 +2078,27 @@ function it(e) {
2018
2078
  signingIn: !o && (!!m || typeof r == "string" && r !== "businesses"),
2019
2079
  onNavigate: i,
2020
2080
  onSignOut: () => l.signOut(),
2021
- children: m ? o ? /* @__PURE__ */ f(ie, {
2081
+ children: m ? o ? /* @__PURE__ */ f(ae, {
2022
2082
  choice: m,
2023
2083
  onBack: () => h(void 0)
2024
2084
  }, `${m.candidate.startsAt}-${m.candidate.eventId ?? m.candidate.eventTypeId}`) : y(/* @__PURE__ */ p(d, { children: [
2025
2085
  /* @__PURE__ */ f("p", { children: T("book.signInFirst") }),
2026
- /* @__PURE__ */ f(R, { choice: m }),
2086
+ /* @__PURE__ */ f(L, { choice: m }),
2027
2087
  /* @__PURE__ */ f("button", {
2028
2088
  type: "button",
2029
2089
  className: "cp-link",
2030
2090
  onClick: () => h(void 0),
2031
2091
  children: T("book.back")
2032
2092
  })
2033
- ] })) : typeof r == "object" ? /* @__PURE__ */ f(Se, {
2093
+ ] })) : typeof r == "object" ? /* @__PURE__ */ f(Ce, {
2034
2094
  businessId: r.businessId,
2035
2095
  eventTypeId: r.eventTypeId,
2036
2096
  onChoose: (e, t) => h({
2037
2097
  business: e,
2038
2098
  candidate: t
2039
2099
  })
2040
- }) : r === "businesses" ? /* @__PURE__ */ f(Te, {}) : o ? f(r === "passes" ? De : r === "details" ? Ee : ee, {}) : y()
2100
+ }) : r === "businesses" ? /* @__PURE__ */ f(De, {}) : o ? f(r === "passes" ? ke : r === "details" ? Oe : te, {}) : y()
2041
2101
  })
2042
2102
  });
2043
2103
  }
2044
- export { Ye as MsmAccount, Qe as MsmBooking, it as MsmCustomer, rt as MsmSignIn, F as cancellationState, j as formatDate, k as formatDateTime, O as formatNumber, C as locale, T as t };
2104
+ export { Ze as MsmAccount, et as MsmBooking, ot as MsmCustomer, at as MsmSignIn, F as cancellationState, j as formatDate, k as formatDateTime, O as formatNumber, C as locale, T as t };