@fanfare-io/fanfare-sdk-solid 0.7.2 → 0.8.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 (2) hide show
  1. package/dist/index.js +143 -140
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -135,33 +135,33 @@ function _n(e, t) {
135
135
  l(null), v(null), b(null), _(null);
136
136
  return;
137
137
  }
138
- const h = r.journeys.get(T);
139
- l(h), v(h.snapshot$.get()), b(h.view$.get());
140
- const m = h.snapshot$.listen(v), k = h.view$.listen(b);
138
+ const m = r.journeys.get(T);
139
+ l(m), v(m.snapshot$.get()), b(m.view$.get());
140
+ const h = m.snapshot$.listen(v), k = m.view$.listen(b);
141
141
  Se(() => {
142
- m(), k();
142
+ h(), k();
143
143
  });
144
144
  }), te(() => {
145
145
  if (!f()) {
146
146
  o(null);
147
147
  return;
148
148
  }
149
- let h = !1;
150
- const m = a(), k = c()?.experience?.experience?.i18n;
149
+ let m = !1;
150
+ const h = a(), k = c()?.experience?.experience?.i18n;
151
151
  if (k) {
152
- const z = an(k, m);
152
+ const z = an(k, h);
153
153
  o(z ?? null);
154
- } else h || o(null);
154
+ } else m || o(null);
155
155
  Se(() => {
156
- h = !0, o(null);
156
+ m = !0, o(null);
157
157
  });
158
158
  });
159
159
  const V = async (T) => {
160
- const h = f();
161
- if (!h)
160
+ const m = f();
161
+ if (!m)
162
162
  throw new Error("experienceId is required to start an experience journey");
163
- const m = s(), k = m ?? r.journeys.get(h);
164
- m || (l(k), v(k.snapshot$.get()), b(k.view$.get())), _(null);
163
+ const h = s(), k = h ?? r.journeys.get(m);
164
+ h || (l(k), v(k.snapshot$.get()), b(k.view$.get())), _(null);
165
165
  const z = {
166
166
  accessCode: Ke(T?.accessCode) ?? Ke(t?.accessCode),
167
167
  autoEnterWaitlist: Ke(T?.autoEnterWaitlist) ?? Ke(t?.autoEnterWaitlist)
@@ -368,7 +368,7 @@ function lt(e) {
368
368
  styleVariant: t()
369
369
  }), l() && "ff:border-danger ff:focus:border-danger ff:focus:ring-danger", v() && "ff:pt-5 ff:pb-1", r.class, r.className));
370
370
  return v() ? (() => {
371
- var V = Vn(), T = V.firstChild, h = T.nextSibling;
371
+ var V = Vn(), T = V.firstChild, m = T.nextSibling;
372
372
  return he(T, ie({
373
373
  get type() {
374
374
  return r.type ?? "text";
@@ -391,51 +391,51 @@ function lt(e) {
391
391
  get class() {
392
392
  return $(_(), "ff:peer ff:placeholder:opacity-0 ff:placeholder:transition-opacity ff:placeholder:duration-200", "ff:focus:placeholder:opacity-100");
393
393
  }
394
- }, a), !1, !1), i(h, () => r.label), i(V, n(x, {
394
+ }, a), !1, !1), i(m, () => r.label), i(V, n(x, {
395
395
  get when() {
396
396
  return b();
397
397
  },
398
398
  get children() {
399
- var m = Ht();
400
- return i(m, () => r.error), A(() => H(m, "id", `${o()}-error`)), m;
399
+ var h = Ht();
400
+ return i(h, () => r.error), A(() => H(h, "id", `${o()}-error`)), h;
401
401
  }
402
402
  }), null), i(V, n(x, {
403
403
  get when() {
404
404
  return y();
405
405
  },
406
406
  get children() {
407
- var m = Gt();
408
- return i(m, () => r.error), A(() => H(m, "id", `${o()}-error`)), m;
407
+ var h = Gt();
408
+ return i(h, () => r.error), A(() => H(h, "id", `${o()}-error`)), h;
409
409
  }
410
- }), null), A((m) => {
410
+ }), null), A((h) => {
411
411
  var k = l() || void 0, z = o(), C = $("ff:absolute ff:left-3 ff:top-3 ff:z-10 ff:origin-top-left ff:select-none", "ff:text-sm ff:font-medium ff:transition-all ff:duration-150 ff:ease-out", "ff:pointer-events-none", "ff:text-muted ff:-translate-y-2 ff:scale-75", "ff:peer-placeholder-shown:text-muted ff:peer-placeholder-shown:translate-y-0 ff:peer-placeholder-shown:scale-100 ff:peer-placeholder-shown:font-normal", "ff:peer-focus:text-primary ff:peer-focus:-translate-y-2 ff:peer-focus:scale-75 ff:peer-focus:font-medium", "ff:peer-disabled:text-muted ff:peer-disabled:opacity-50", l() && "ff:text-danger ff:peer-focus:text-danger", Zt({
412
412
  styleVariant: t()
413
413
  }));
414
- return k !== m.e && H(V, "data-error", m.e = k), z !== m.t && H(h, "for", m.t = z), C !== m.a && M(h, m.a = C), m;
414
+ return k !== h.e && H(V, "data-error", h.e = k), z !== h.t && H(m, "for", h.t = z), C !== h.a && M(m, h.a = C), h;
415
415
  }, {
416
416
  e: void 0,
417
417
  t: void 0,
418
418
  a: void 0
419
419
  }), V;
420
420
  })() : (() => {
421
- var V = An(), T = V.firstChild, h = T.firstChild;
421
+ var V = An(), T = V.firstChild, m = T.firstChild;
422
422
  return i(V, n(x, {
423
423
  get when() {
424
424
  return w();
425
425
  },
426
426
  get children() {
427
- var m = Dn();
428
- return i(m, () => r.label), A((k) => {
427
+ var h = Dn();
428
+ return i(h, () => r.label), A((k) => {
429
429
  var z = o(), C = $("ff:text-foreground ff:mb-1.5 ff:block ff:text-sm ff:font-medium", Zt({
430
430
  styleVariant: t()
431
431
  }));
432
- return z !== k.e && H(m, "for", k.e = z), C !== k.t && M(m, k.t = C), k;
432
+ return z !== k.e && H(h, "for", k.e = z), C !== k.t && M(h, k.t = C), k;
433
433
  }, {
434
434
  e: void 0,
435
435
  t: void 0
436
- }), m;
436
+ }), h;
437
437
  }
438
- }), T), he(h, ie({
438
+ }), T), he(m, ie({
439
439
  get type() {
440
440
  return r.type ?? "text";
441
441
  },
@@ -462,16 +462,16 @@ function lt(e) {
462
462
  return b();
463
463
  },
464
464
  get children() {
465
- var m = Ht();
466
- return i(m, () => r.error), A(() => H(m, "id", `${o()}-error`)), m;
465
+ var h = Ht();
466
+ return i(h, () => r.error), A(() => H(h, "id", `${o()}-error`)), h;
467
467
  }
468
468
  }), null), i(T, n(x, {
469
469
  get when() {
470
470
  return y();
471
471
  },
472
472
  get children() {
473
- var m = Gt();
474
- return i(m, () => r.error), A(() => H(m, "id", `${o()}-error`)), m;
473
+ var h = Gt();
474
+ return i(h, () => r.error), A(() => H(h, "id", `${o()}-error`)), h;
475
475
  }
476
476
  }), null), A(() => H(V, "data-error", !!r.error || void 0)), V;
477
477
  })();
@@ -1418,29 +1418,29 @@ function ye(e) {
1418
1418
  isClient: f,
1419
1419
  isPast: s
1420
1420
  } = za(() => a.targetDate, () => a.onComplete), l = () => a.layout ?? "swiss", c = () => a.showDays ?? !0, v = () => a.showHours ?? !0, w = () => a.showMinutes ?? !0, b = () => a.showSeconds ?? !0, y = d(() => {
1421
- const h = o();
1421
+ const m = o();
1422
1422
  return [{
1423
- value: h.days,
1423
+ value: m.days,
1424
1424
  label: t("countdown.days"),
1425
1425
  shortLabel: t("countdown.daysShort"),
1426
- show: c() && h.days > 0
1426
+ show: c() && m.days > 0
1427
1427
  }, {
1428
- value: h.hours,
1428
+ value: m.hours,
1429
1429
  label: t("countdown.hours"),
1430
1430
  shortLabel: t("countdown.hoursShort"),
1431
1431
  show: v()
1432
1432
  }, {
1433
- value: h.minutes,
1433
+ value: m.minutes,
1434
1434
  label: t("countdown.minutes"),
1435
1435
  shortLabel: t("countdown.minutesShort"),
1436
1436
  show: w()
1437
1437
  }, {
1438
- value: h.seconds,
1438
+ value: m.seconds,
1439
1439
  label: t("countdown.seconds"),
1440
1440
  shortLabel: t("countdown.secondsShort"),
1441
1441
  show: b()
1442
- }].filter((m) => m.show);
1443
- }), _ = d(() => l() === "swiss" ? y().slice(0, 3) : y()), V = d(() => s() ? "ff:opacity-50" : void 0), T = (h) => h.toString().padStart(2, "0");
1442
+ }].filter((h) => h.show);
1443
+ }), _ = d(() => l() === "swiss" ? y().slice(0, 3) : y()), V = d(() => s() ? "ff:opacity-50" : void 0), T = (m) => m.toString().padStart(2, "0");
1444
1444
  return n(x, {
1445
1445
  get when() {
1446
1446
  return f();
@@ -1454,50 +1454,50 @@ function ye(e) {
1454
1454
  return Q(() => !!s())() && a.expiredLabel !== void 0;
1455
1455
  },
1456
1456
  get children() {
1457
- var h = $a();
1458
- return i(h, () => a.expiredLabel), A(() => M(h, $("ff:text-muted ff:font-heading", a.class, a.className))), h;
1457
+ var m = $a();
1458
+ return i(m, () => a.expiredLabel), A(() => M(m, $("ff:text-muted ff:font-heading", a.class, a.className))), m;
1459
1459
  }
1460
1460
  }), n(J, {
1461
1461
  get when() {
1462
1462
  return l() === "compact";
1463
1463
  },
1464
1464
  get children() {
1465
- var h = Ca();
1466
- return i(h, n(st, {
1465
+ var m = Ca();
1466
+ return i(m, n(st, {
1467
1467
  get each() {
1468
1468
  return _();
1469
1469
  },
1470
- children: (m, k) => [Q(() => T(m().value)), Q(() => m().shortLabel), n(x, {
1470
+ children: (h, k) => [Q(() => T(h().value)), Q(() => h().shortLabel), n(x, {
1471
1471
  get when() {
1472
1472
  return k < _().length - 1;
1473
1473
  },
1474
1474
  children: " "
1475
1475
  })]
1476
- })), A((m) => {
1476
+ })), A((h) => {
1477
1477
  var k = $("ff:tabular-nums ff:font-heading", V(), a.class, a.className), z = s() || void 0, C = s() ? "off" : "polite";
1478
- return k !== m.e && M(h, m.e = k), z !== m.t && H(h, "data-past", m.t = z), C !== m.a && H(h, "aria-live", m.a = C), m;
1478
+ return k !== h.e && M(m, h.e = k), z !== h.t && H(m, "data-past", h.t = z), C !== h.a && H(m, "aria-live", h.a = C), h;
1479
1479
  }, {
1480
1480
  e: void 0,
1481
1481
  t: void 0,
1482
1482
  a: void 0
1483
- }), h;
1483
+ }), m;
1484
1484
  }
1485
1485
  }), n(J, {
1486
1486
  get when() {
1487
1487
  return l() === "swiss";
1488
1488
  },
1489
1489
  get children() {
1490
- var h = Sa();
1491
- return i(h, n(st, {
1490
+ var m = Sa();
1491
+ return i(m, n(st, {
1492
1492
  get each() {
1493
1493
  return _();
1494
1494
  },
1495
- children: (m, k) => [n(Ma, {
1495
+ children: (h, k) => [n(Ma, {
1496
1496
  get value() {
1497
- return m().value;
1497
+ return h().value;
1498
1498
  },
1499
1499
  get label() {
1500
- return m().label;
1500
+ return h().label;
1501
1501
  },
1502
1502
  styleVariant: r
1503
1503
  }), n(x, {
@@ -1510,16 +1510,16 @@ function ye(e) {
1510
1510
  });
1511
1511
  }
1512
1512
  })]
1513
- })), A((m) => {
1513
+ })), A((h) => {
1514
1514
  var k = $(Ta({
1515
1515
  styleVariant: r()
1516
1516
  }), V(), a.class, a.className), z = s() || void 0, C = s() ? "off" : "polite";
1517
- return k !== m.e && M(h, m.e = k), z !== m.t && H(h, "data-past", m.t = z), C !== m.a && H(h, "aria-live", m.a = C), m;
1517
+ return k !== h.e && M(m, h.e = k), z !== h.t && H(m, "data-past", h.t = z), C !== h.a && H(m, "aria-live", h.a = C), h;
1518
1518
  }, {
1519
1519
  e: void 0,
1520
1520
  t: void 0,
1521
1521
  a: void 0
1522
- }), h;
1522
+ }), m;
1523
1523
  }
1524
1524
  })];
1525
1525
  }
@@ -1712,7 +1712,7 @@ function Ar(e) {
1712
1712
  te(() => {
1713
1713
  T(r.value, f());
1714
1714
  });
1715
- const h = (R) => {
1715
+ const m = (R) => {
1716
1716
  const X = R.currentTarget.value;
1717
1717
  if (f() === "phone") {
1718
1718
  const W = ht(X);
@@ -1722,7 +1722,7 @@ function Ar(e) {
1722
1722
  } else
1723
1723
  V(X), r.onValueChange(X, f());
1724
1724
  typeof a.onInput == "function" && a.onInput(R);
1725
- }, m = (R) => {
1725
+ }, h = (R) => {
1726
1726
  c(!0), typeof a.onBlur == "function" && a.onBlur(R);
1727
1727
  }, k = (R) => {
1728
1728
  R.key === "Enter" && r.onSubmit && (R.preventDefault(), r.onSubmit()), typeof a.onKeyDown == "function" && a.onKeyDown(R);
@@ -1763,8 +1763,8 @@ function Ar(e) {
1763
1763
  get value() {
1764
1764
  return _();
1765
1765
  },
1766
- onInput: h,
1767
- onBlur: m,
1766
+ onInput: m,
1767
+ onBlur: h,
1768
1768
  onKeyDown: k,
1769
1769
  get placeholder() {
1770
1770
  return I();
@@ -1802,8 +1802,8 @@ function Ar(e) {
1802
1802
  get value() {
1803
1803
  return _();
1804
1804
  },
1805
- onInput: h,
1806
- onBlur: m,
1805
+ onInput: m,
1806
+ onBlur: h,
1807
1807
  onKeyDown: k,
1808
1808
  get placeholder() {
1809
1809
  return I();
@@ -1872,58 +1872,58 @@ const Qa = de(["ff:h-12 ff:w-full ff:min-w-0 ff:text-center ff:text-lg ff:font-s
1872
1872
  function Nr(e) {
1873
1873
  const t = $e(), r = () => e.length ?? 6, a = () => !!e.hasError || !!e.error, o = () => !!e.error && !e.hasError, f = (e.value ?? "").split("").slice(0, r()), [s, l] = D([...f, ...Array(Math.max(0, r() - f.length)).fill("")]);
1874
1874
  let c = [];
1875
- const v = (h) => {
1876
- h >= 0 && h < r() && c[h]?.focus();
1877
- }, w = (h) => {
1878
- const m = h.split("").slice(0, r());
1879
- l([...m, ...Array(Math.max(0, r() - m.length)).fill("")]);
1875
+ const v = (m) => {
1876
+ m >= 0 && m < r() && c[m]?.focus();
1877
+ }, w = (m) => {
1878
+ const h = m.split("").slice(0, r());
1879
+ l([...h, ...Array(Math.max(0, r() - h.length)).fill("")]);
1880
1880
  };
1881
1881
  te(() => {
1882
1882
  w(e.value ?? "");
1883
1883
  }), en(() => {
1884
1884
  e.autoFocus && queueMicrotask(() => v(0));
1885
1885
  });
1886
- const b = (h) => {
1887
- const m = h.join("");
1888
- e.onChange?.(m), m.length === r() && !m.includes("") && e.onComplete?.(m);
1889
- }, y = (h, m) => {
1890
- const k = m.replace(/\D/g, "");
1886
+ const b = (m) => {
1887
+ const h = m.join("");
1888
+ e.onChange?.(h), h.length === r() && !h.includes("") && e.onComplete?.(h);
1889
+ }, y = (m, h) => {
1890
+ const k = h.replace(/\D/g, "");
1891
1891
  if (k.length > 1) {
1892
1892
  const I = k.slice(0, r()).split(""), U = [...I, ...Array(Math.max(0, r() - I.length)).fill("")];
1893
1893
  l(U), b(U), U.length === r() && !U.includes("") ? v(r() - 1) : v(I.length);
1894
1894
  return;
1895
1895
  }
1896
1896
  const z = k.slice(-1), C = [...s()];
1897
- C[h] = z, l(C), b(C), z && h < r() - 1 && v(h + 1);
1898
- }, _ = (h, m) => {
1899
- switch (m.key) {
1897
+ C[m] = z, l(C), b(C), z && m < r() - 1 && v(m + 1);
1898
+ }, _ = (m, h) => {
1899
+ switch (h.key) {
1900
1900
  case "Backspace":
1901
- m.preventDefault(), s()[h] ? y(h, "") : h > 0 && (v(h - 1), y(h - 1, ""));
1901
+ h.preventDefault(), s()[m] ? y(m, "") : m > 0 && (v(m - 1), y(m - 1, ""));
1902
1902
  break;
1903
1903
  case "ArrowLeft":
1904
- m.preventDefault(), v(h - 1);
1904
+ h.preventDefault(), v(m - 1);
1905
1905
  break;
1906
1906
  case "ArrowRight":
1907
- m.preventDefault(), v(h + 1);
1907
+ h.preventDefault(), v(m + 1);
1908
1908
  break;
1909
1909
  case "Delete":
1910
- m.preventDefault(), y(h, "");
1910
+ h.preventDefault(), y(m, "");
1911
1911
  break;
1912
1912
  }
1913
- }, V = (h) => {
1914
- h.preventDefault();
1915
- const m = h.clipboardData;
1916
- if (!m) return;
1917
- const k = m.getData("text").replace(/\D/g, "").slice(0, r());
1913
+ }, V = (m) => {
1914
+ m.preventDefault();
1915
+ const h = m.clipboardData;
1916
+ if (!h) return;
1917
+ const k = h.getData("text").replace(/\D/g, "").slice(0, r());
1918
1918
  if (!k) return;
1919
1919
  const z = k.split(""), C = [...z, ...Array(Math.max(0, r() - z.length)).fill("")];
1920
1920
  l(C), b(C), C.length === r() && !C.includes("") ? v(r() - 1) : v(z.length);
1921
- }, T = (h) => {
1922
- h.currentTarget.select();
1921
+ }, T = (m) => {
1922
+ m.currentTarget.select();
1923
1923
  };
1924
1924
  return (() => {
1925
- var h = Za(), m = h.firstChild;
1926
- return m.addEventListener("paste", V), i(m, n(At, {
1925
+ var m = Za(), h = m.firstChild;
1926
+ return h.addEventListener("paste", V), i(h, n(At, {
1927
1927
  get each() {
1928
1928
  return Array.from({
1929
1929
  length: r()
@@ -1947,7 +1947,7 @@ function Nr(e) {
1947
1947
  i: void 0
1948
1948
  }), A(() => C.value = s()[z()]), C;
1949
1949
  })()
1950
- })), i(h, n(x, {
1950
+ })), i(m, n(x, {
1951
1951
  get when() {
1952
1952
  return o();
1953
1953
  },
@@ -1957,12 +1957,12 @@ function Nr(e) {
1957
1957
  }
1958
1958
  }), null), A((k) => {
1959
1959
  var z = $("fanfare-otp-input", "ff:space-y-1.5", e.class, e.className), C = a() || void 0, I = `repeat(${r()}, minmax(0, 1fr))`;
1960
- return z !== k.e && M(h, k.e = z), C !== k.t && H(h, "data-error", k.t = C), I !== k.a && bt(m, "grid-template-columns", k.a = I), k;
1960
+ return z !== k.e && M(m, k.e = z), C !== k.t && H(m, "data-error", k.t = C), I !== k.a && bt(h, "grid-template-columns", k.a = I), k;
1961
1961
  }, {
1962
1962
  e: void 0,
1963
1963
  t: void 0,
1964
1964
  a: void 0
1965
- }), h;
1965
+ }), m;
1966
1966
  })();
1967
1967
  }
1968
1968
  Nr.displayName = "OTPInput";
@@ -1976,7 +1976,7 @@ function fo(e) {
1976
1976
  function Tr(e) {
1977
1977
  const {
1978
1978
  t
1979
- } = fe(), r = () => e.label ?? t("auth.badgeLabel"), a = () => e.variant ?? "default", o = () => e.title ?? t("auth.title"), f = () => e.description ?? t("auth.description"), s = () => e.submitLabel ?? t("auth.submit"), l = () => e.verifyLabel ?? t("auth.verify"), c = e.defaultStep ?? "credential", v = e.defaultCredential ?? "", [w, b] = D(c), [y, _] = D(v), [V, T] = D(e.defaultCredentialType ?? Dr(v)), [h, m] = D(!1), [k, z] = D(""), [C, I] = D(!1), [U, R] = D(e.defaultError ?? null), [X, W] = D(c === "verify" && v.length > 0 ? Date.now() + mt : null), [le, _e] = D(Date.now()), [L, P] = D(!1), [q, K] = D(!1), Ee = d(() => V() === "email" ? t("auth.email") : t("auth.phone"));
1979
+ } = fe(), r = () => e.label ?? t("auth.badgeLabel"), a = () => e.variant ?? "default", o = () => e.title ?? t("auth.title"), f = () => e.description ?? t("auth.description"), s = () => e.submitLabel ?? t("auth.submit"), l = () => e.verifyLabel ?? t("auth.verify"), c = e.defaultStep ?? "credential", v = e.defaultCredential ?? "", [w, b] = D(c), [y, _] = D(v), [V, T] = D(e.defaultCredentialType ?? Dr(v)), [m, h] = D(!1), [k, z] = D(""), [C, I] = D(!1), [U, R] = D(e.defaultError ?? null), [X, W] = D(c === "verify" && v.length > 0 ? Date.now() + mt : null), [le, _e] = D(Date.now()), [L, P] = D(!1), [q, K] = D(!1), Ee = d(() => V() === "email" ? t("auth.email") : t("auth.phone"));
1980
1980
  te(xt(w, (F) => {
1981
1981
  if (F !== "verify") return;
1982
1982
  const B = setInterval(() => _e(Date.now()), 1e3);
@@ -1992,7 +1992,7 @@ function Tr(e) {
1992
1992
  }), ke = d(() => Ve() > 0), qe = (F, B) => {
1993
1993
  _(F), T(B), R(null);
1994
1994
  }, N = async (F) => {
1995
- if (F?.preventDefault(), !(!h() || !y())) {
1995
+ if (F?.preventDefault(), !(!m() || !y())) {
1996
1996
  I(!0), R(null);
1997
1997
  try {
1998
1998
  await e.onSubmit?.(y(), V()), b("verify"), W(Date.now() + mt);
@@ -2182,7 +2182,7 @@ function Tr(e) {
2182
2182
  return y();
2183
2183
  },
2184
2184
  onValueChange: qe,
2185
- onValidChange: m,
2185
+ onValidChange: h,
2186
2186
  onSubmit: () => {
2187
2187
  N();
2188
2188
  },
@@ -2271,7 +2271,7 @@ function Tr(e) {
2271
2271
  type: "submit",
2272
2272
  class: "ff:w-full",
2273
2273
  get disabled() {
2274
- return C() || q() || (w() === "credential" ? !h() : k().length < 6);
2274
+ return C() || q() || (w() === "credential" ? !m() : k().length < 6);
2275
2275
  },
2276
2276
  get children() {
2277
2277
  return n(x, {
@@ -2355,13 +2355,13 @@ var co = /* @__PURE__ */ u('<div data-slot=access-code-form-heading><h2 class="f
2355
2355
  function Lr(e) {
2356
2356
  const {
2357
2357
  t
2358
- } = fe(), [r] = Z(e, ["onSubmit", "onSkip", "variant", "label", "title", "description", "countdownTo", "submitLabel", "allowSkip", "autoUppercase", "defaultError", "class", "className"]), a = d(() => r.label ?? t("accessCode.badgeLabel")), o = d(() => r.variant ?? "secondary"), f = d(() => r.title ?? t("accessCode.title")), s = d(() => r.description ?? t("accessCode.description")), l = d(() => r.submitLabel ?? t("accessCode.submit")), [c, v] = D(""), [w, b] = D(!1), [y, _] = D(r.defaultError ?? null), V = d(() => !!c().trim() && !w()), T = async (h) => {
2359
- if (h?.preventDefault(), !!c().trim()) {
2358
+ } = fe(), [r] = Z(e, ["onSubmit", "onSkip", "variant", "label", "title", "description", "countdownTo", "submitLabel", "allowSkip", "autoUppercase", "defaultError", "class", "className"]), a = d(() => r.label ?? t("accessCode.badgeLabel")), o = d(() => r.variant ?? "secondary"), f = d(() => r.title ?? t("accessCode.title")), s = d(() => r.description ?? t("accessCode.description")), l = d(() => r.submitLabel ?? t("accessCode.submit")), [c, v] = D(""), [w, b] = D(!1), [y, _] = D(r.defaultError ?? null), V = d(() => !!c().trim() && !w()), T = async (m) => {
2359
+ if (m?.preventDefault(), !!c().trim()) {
2360
2360
  b(!0), _(null);
2361
2361
  try {
2362
2362
  await r.onSubmit?.(c().trim());
2363
- } catch (m) {
2364
- _(m instanceof Error ? m.message : t("accessCode.invalid"));
2363
+ } catch (h) {
2364
+ _(h instanceof Error ? h.message : t("accessCode.invalid"));
2365
2365
  } finally {
2366
2366
  b(!1);
2367
2367
  }
@@ -2386,23 +2386,23 @@ function Lr(e) {
2386
2386
  get when() {
2387
2387
  return r.countdownTo;
2388
2388
  },
2389
- children: (h) => (() => {
2390
- var m = go(), k = m.firstChild;
2391
- return i(k, () => t("time.opensIn")), i(m, n(ye, {
2389
+ children: (m) => (() => {
2390
+ var h = go(), k = h.firstChild;
2391
+ return i(k, () => t("time.opensIn")), i(h, n(ye, {
2392
2392
  get targetDate() {
2393
- return h();
2393
+ return m();
2394
2394
  },
2395
2395
  showDays: !1
2396
- }), null), m;
2396
+ }), null), h;
2397
2397
  })()
2398
2398
  }), (() => {
2399
- var h = co(), m = h.firstChild, k = m.nextSibling;
2400
- return i(m, f), i(k, s), h;
2399
+ var m = co(), h = m.firstChild, k = h.nextSibling;
2400
+ return i(h, f), i(k, s), m;
2401
2401
  })(), (() => {
2402
- var h = uo(), m = h.firstChild;
2403
- return h.addEventListener("submit", (k) => {
2402
+ var m = uo(), h = m.firstChild;
2403
+ return m.addEventListener("submit", (k) => {
2404
2404
  T(k);
2405
- }), i(h, n($r, {
2405
+ }), i(m, n($r, {
2406
2406
  get value() {
2407
2407
  return c();
2408
2408
  },
@@ -2422,7 +2422,7 @@ function Lr(e) {
2422
2422
  get disabled() {
2423
2423
  return w();
2424
2424
  }
2425
- }), m), i(h, n(x, {
2425
+ }), h), i(m, n(x, {
2426
2426
  get when() {
2427
2427
  return y();
2428
2428
  },
@@ -2432,7 +2432,7 @@ function Lr(e) {
2432
2432
  return k();
2433
2433
  }
2434
2434
  })
2435
- }), m), i(m, n(O, {
2435
+ }), h), i(h, n(O, {
2436
2436
  type: "submit",
2437
2437
  class: "ff:w-full",
2438
2438
  get disabled() {
@@ -2443,7 +2443,7 @@ function Lr(e) {
2443
2443
  size: "sm"
2444
2444
  }) : l();
2445
2445
  }
2446
- }), null), i(m, (() => {
2446
+ }), null), i(h, (() => {
2447
2447
  var k = Q(() => !!r.allowSkip);
2448
2448
  return () => k() && n(O, {
2449
2449
  type: "button",
@@ -2459,7 +2459,7 @@ function Lr(e) {
2459
2459
  return t("common.skip");
2460
2460
  }
2461
2461
  });
2462
- })(), null), h;
2462
+ })(), null), m;
2463
2463
  })()];
2464
2464
  }
2465
2465
  }), n(ee, {})];
@@ -2498,7 +2498,7 @@ function Mr(e) {
2498
2498
  const {
2499
2499
  t,
2500
2500
  locale: r
2501
- } = fe(), [a] = Z(e, ["challenge", "botMitigation", "onVerifyToken", "onRetry", "variant", "label", "title", "description", "countdownTo", "retryLabel", "class", "className"]), [o, f] = D(0), [s, l] = D(!1), [c, v] = D(!1), [w, b] = D(null), [y, _] = D(!1), [V, T] = D("reload"), [h, m] = D(Date.now()), k = d(() => {
2501
+ } = fe(), [a] = Z(e, ["challenge", "botMitigation", "onVerifyToken", "onRetry", "variant", "label", "title", "description", "countdownTo", "retryLabel", "class", "className"]), [o, f] = D(0), [s, l] = D(!1), [c, v] = D(!1), [w, b] = D(null), [y, _] = D(!1), [V, T] = D("reload"), [m, h] = D(Date.now()), k = d(() => {
2502
2502
  const L = a.challenge?.iframeUrl;
2503
2503
  if (!L) return null;
2504
2504
  try {
@@ -2518,13 +2518,13 @@ function Mr(e) {
2518
2518
  });
2519
2519
  te(() => {
2520
2520
  const L = a.botMitigation?.blockedUntil, P = Date.now();
2521
- if (m(P), !L) return;
2521
+ if (h(P), !L) return;
2522
2522
  const q = Date.parse(L);
2523
2523
  if (!Number.isFinite(q) || q <= P) return;
2524
- const K = window.setTimeout(() => m(Date.now()), Math.min(q - P + 1, 2147483647));
2524
+ const K = window.setTimeout(() => h(Date.now()), Math.min(q - P + 1, 2147483647));
2525
2525
  Se(() => window.clearTimeout(K));
2526
2526
  });
2527
- const C = d(() => xo(a.botMitigation, h())), I = d(() => typeof a.botMitigation?.attemptsRemaining == "number" ? a.botMitigation.attemptsRemaining : void 0);
2527
+ const C = d(() => xo(a.botMitigation, m())), I = d(() => typeof a.botMitigation?.attemptsRemaining == "number" ? a.botMitigation.attemptsRemaining : void 0);
2528
2528
  te(xt(() => a.challenge?.id, () => {
2529
2529
  f(0), l(!1), v(!1), b(null), _(!1), T("reload");
2530
2530
  })), te(() => {
@@ -3567,14 +3567,14 @@ function wi(e, t) {
3567
3567
  function $t(e) {
3568
3568
  const t = ct(), {
3569
3569
  t: r
3570
- } = fe(), a = ze(() => e.display$ ?? hi), [o, f] = D([]), [s, l] = D(!1), [c, v] = D(null), [w, b] = D(null), [y, _] = D(!1), V = d(() => o().filter((N) => N.available > 0)), T = d(() => V().find((N) => N.id === w()) ?? null), h = d(() => {
3570
+ } = fe(), a = ze(() => e.display$ ?? hi), [o, f] = D([]), [s, l] = D(!1), [c, v] = D(null), [w, b] = D(null), [y, _] = D(!1), V = d(() => o().filter((N) => N.available > 0)), T = d(() => V().find((N) => N.id === w()) ?? null), m = d(() => {
3571
3571
  const N = T();
3572
3572
  return N ? r("appointment.continueWithTime", {
3573
3573
  values: {
3574
3574
  time: Fr(N)
3575
3575
  }
3576
3576
  }) : r("appointment.selectATime");
3577
- }), m = d(() => {
3577
+ }), h = d(() => {
3578
3578
  const N = /* @__PURE__ */ new Map();
3579
3579
  for (const G of o()) {
3580
3580
  const me = G.startTime ? vt(new Date(G.startTime), G.timezone ?? e.timezone) : G.id.slice(0, 10), ue = N.get(me);
@@ -3585,7 +3585,7 @@ function $t(e) {
3585
3585
  const N = Date.now(), G = e.bookingWindowOpenAt ? new Date(e.bookingWindowOpenAt).getTime() : N;
3586
3586
  return vt(new Date(Math.max(N, G)), e.timezone);
3587
3587
  }), z = d(() => e.bookingWindowCloseAt ? vt(new Date(e.bookingWindowCloseAt), e.timezone) : void 0), C = d(() => {
3588
- const N = k(), G = z(), me = m(), ue = s(), ve = [];
3588
+ const N = k(), G = z(), me = h(), ue = s(), ve = [];
3589
3589
  for (let Y = 0; Y < mi; Y += 1) {
3590
3590
  const be = Go(N, Y);
3591
3591
  if (G && be > G) break;
@@ -3608,7 +3608,7 @@ function $t(e) {
3608
3608
  });
3609
3609
  const R = d(() => {
3610
3610
  const N = I();
3611
- return N ? m().get(N) ?? [] : [];
3611
+ return N ? h().get(N) ?? [] : [];
3612
3612
  }), X = (N) => {
3613
3613
  U(N), b(null);
3614
3614
  }, W = (N) => {
@@ -3821,7 +3821,7 @@ function $t(e) {
3821
3821
  },
3822
3822
  onClick: _e,
3823
3823
  get children() {
3824
- return h();
3824
+ return m();
3825
3825
  }
3826
3826
  })];
3827
3827
  }
@@ -3855,8 +3855,8 @@ function bi(e) {
3855
3855
  return o();
3856
3856
  },
3857
3857
  children: (V) => (() => {
3858
- var T = di(), h = T.firstChild, m = h.nextSibling;
3859
- return i(h, () => t("appointment.duration")), i(m, () => t("appointment.minutes", {
3858
+ var T = di(), m = T.firstChild, h = m.nextSibling;
3859
+ return i(m, () => t("appointment.duration")), i(h, () => t("appointment.minutes", {
3860
3860
  values: {
3861
3861
  count: V()
3862
3862
  }
@@ -3867,16 +3867,16 @@ function bi(e) {
3867
3867
  return Q(() => !r())() && e.booking.locationName;
3868
3868
  },
3869
3869
  children: (V) => (() => {
3870
- var T = ui(), h = T.firstChild, m = h.nextSibling;
3871
- return i(h, () => t("appointment.location")), i(m, V), T;
3870
+ var T = ui(), m = T.firstChild, h = m.nextSibling;
3871
+ return i(m, () => t("appointment.location")), i(h, V), T;
3872
3872
  })()
3873
3873
  }), null), i(w, n(x, {
3874
3874
  get when() {
3875
3875
  return e.booking.confirmationCode;
3876
3876
  },
3877
3877
  children: (V) => (() => {
3878
- var T = gi(), h = T.firstChild, m = h.nextSibling;
3879
- return i(h, () => t("appointment.confirmationCode")), i(m, V), T;
3878
+ var T = gi(), m = T.firstChild, h = m.nextSibling;
3879
+ return i(m, () => t("appointment.confirmationCode")), i(h, V), T;
3880
3880
  })()
3881
3881
  }), null), i(l, n(x, {
3882
3882
  get when() {
@@ -4117,8 +4117,8 @@ function Je(e) {
4117
4117
  children: (y) => (() => {
4118
4118
  var _ = lr(), V = _.firstChild, T = V.nextSibling;
4119
4119
  return i(V, (() => {
4120
- var h = Q(() => a().status === "winning");
4121
- return () => h() ? t("auction.yourWinningBid") : t("auction.yourBidLabel");
4120
+ var m = Q(() => a().status === "winning");
4121
+ return () => m() ? t("auction.yourWinningBid") : t("auction.yourBidLabel");
4122
4122
  })()), i(T, y), _;
4123
4123
  })()
4124
4124
  })];
@@ -5077,7 +5077,7 @@ function jr(e) {
5077
5077
  autoStart: () => a.autoStart ?? !1,
5078
5078
  accessCode: () => a.accessCode,
5079
5079
  autoEnterWaitlist: () => a.autoEnterWaitlist ?? !1
5080
- }), [f, s] = D(!1), [l, c] = D(!1), [v, w] = D(!1), [b, y] = D(!1), [_, V] = D(!1), [T, h] = D(!1), [m, k] = D(!1), [z, C] = D(!1), [I, U] = D(null), R = d(() => o.snapshot()), X = d(() => o.view()), W = d(() => X()?.journeyStage ?? null), le = d(() => {
5080
+ }), [f, s] = D(!1), [l, c] = D(!1), [v, w] = D(!1), [b, y] = D(!1), [_, V] = D(!1), [T, m] = D(!1), [h, k] = D(!1), [z, C] = D(!1), [I, U] = D(null), R = d(() => o.snapshot()), X = d(() => o.view()), W = d(() => X()?.journeyStage ?? null), le = d(() => {
5081
5081
  const g = X();
5082
5082
  return g?.journeyStage === "routed" ? g : void 0;
5083
5083
  }), _e = d(() => dt(R())), L = d(() => _e()?.phase ?? le()?.sequence.phase ?? null), P = d(() => I() ?? o.error());
@@ -5226,14 +5226,14 @@ function jr(e) {
5226
5226
  }, F = async (g, p) => {
5227
5227
  const S = o.journey();
5228
5228
  if (S) {
5229
- U(null), h(!0);
5229
+ U(null), m(!0);
5230
5230
  try {
5231
5231
  const E = S.view$.get();
5232
5232
  E.journeyStage === "routed" && E.sequence.phase === "enterable" && "book" in E.sequence && await E.sequence.book(g, p);
5233
5233
  } catch (E) {
5234
5234
  q(E);
5235
5235
  } finally {
5236
- h(!1);
5236
+ m(!1);
5237
5237
  }
5238
5238
  }
5239
5239
  }, B = async (g) => {
@@ -5666,7 +5666,7 @@ function jr(e) {
5666
5666
  return T();
5667
5667
  },
5668
5668
  get isCancelling() {
5669
- return m();
5669
+ return h();
5670
5670
  },
5671
5671
  get isRescheduling() {
5672
5672
  return z();
@@ -5898,15 +5898,18 @@ function Or(e) {
5898
5898
  o(!0), s(null), r(null);
5899
5899
  async function T() {
5900
5900
  try {
5901
- const h = await sn(y);
5902
- if (V = h, _) {
5903
- h.destroy();
5901
+ const m = await sn({
5902
+ ...y,
5903
+ autoResume: w && b
5904
+ });
5905
+ if (V = m, _) {
5906
+ m.destroy();
5904
5907
  return;
5905
5908
  }
5906
- w && h.auth.getSession() && b && await h.journeys.resumeAll(), _ || (r(h), o(!1));
5907
- } catch (h) {
5908
- const m = h instanceof Error ? h.message : "Failed to initialize Fanfare SDK";
5909
- _ || (s(m), o(!1));
5909
+ _ || (r(m), o(!1));
5910
+ } catch (m) {
5911
+ const h = m instanceof Error ? m.message : "Failed to initialize Fanfare SDK";
5912
+ _ || (s(h), o(!1));
5910
5913
  }
5911
5914
  }
5912
5915
  T(), Se(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fanfare-io/fanfare-sdk-solid",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "SolidJS web components for Fanfare experiences",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -42,8 +42,8 @@
42
42
  "solid-element": "^1.8.0",
43
43
  "tailwind-merge": "^2.6.0",
44
44
  "valibot": "^1.1.0",
45
- "@fanfare-io/fanfare-sdk-core": "0.7.2",
46
- "@fanfare-io/fanfare-sdk-i18n": "0.7.2"
45
+ "@fanfare-io/fanfare-sdk-core": "0.8.0",
46
+ "@fanfare-io/fanfare-sdk-i18n": "0.8.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@size-limit/preset-small-lib": "^11.1.8",
@@ -75,8 +75,8 @@
75
75
  "vite-plugin-solid": "^2.11.6",
76
76
  "vite-tsconfig-paths": "^5.1.4",
77
77
  "vitest": "^3.2.4",
78
- "@fanfare-io/fanfare-sdk-core": "0.7.2",
79
- "@fanfare-io/fanfare-sdk-react": "0.7.2"
78
+ "@fanfare-io/fanfare-sdk-core": "0.8.0",
79
+ "@fanfare-io/fanfare-sdk-react": "0.8.0"
80
80
  },
81
81
  "sideEffects": [
82
82
  "**/*.css"