@aaravpos/appointment-booking-plugin 2.0.1 → 2.0.3

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.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { BookingPlugin } from './components/BookingPlugin';
2
- export type { BookingPluginProps } from './types';
1
+ export { AppointmentBookingPlugin } from './components/AppointmentBookingPlugin';
2
+ export type { AppointmentBookingPluginProps } from './types';
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as yi from "react";
2
- import H, { Children as Em, Component as su, Fragment as lu, PureComponent as Tm, createContext as Ft, createElement as Rn, forwardRef as Do, isValidElement as xm, useCallback as Ye, useContext as Te, useEffect as me, useId as Ro, useInsertionEffect as ko, useLayoutEffect as Om, useMemo as se, useRef as ve, useState as X } from "react";
2
+ import H, { Children as Em, Component as su, Fragment as lu, PureComponent as Tm, createContext as Ft, createElement as Rn, forwardRef as Do, isValidElement as xm, useCallback as Ye, useContext as Te, useEffect as me, useId as Ro, useInsertionEffect as ko, useLayoutEffect as Om, useMemo as se, useRef as ve, useState as Y } from "react";
3
3
  import { Provider as _m, useDispatch as tt, useSelector as re } from "react-redux";
4
4
  import { applyMiddleware as Am, combineReducers as cu, compose as kn, createStore as Im, isAction as gi, isPlainObject as du } from "redux";
5
5
  import { FLUSH as Mm, PAUSE as Dm, PERSIST as Rm, PURGE as km, REGISTER as Lm, REHYDRATE as Fm, persistReducer as jm, persistStore as Vm } from "redux-persist";
@@ -6318,7 +6318,7 @@ function Ic(e) {
6318
6318
  }), t;
6319
6319
  }
6320
6320
  var bt = ({ children: e, custom: t, initial: r = !0, onExitComplete: n, presenceAffectsLayout: i = !0, mode: a = "sync", propagate: o = !1, anchorX: s = "left", anchorY: l = "top", root: c }) => {
6321
- const [d, u] = Kh(o), f = se(() => Ic(e), [e]), p = o && !d ? [] : f.map(un), m = ve(!0), y = ve(f), v = Qo(() => /* @__PURE__ */ new Map()), g = ve(/* @__PURE__ */ new Set()), [b, S] = X(f), [C, T] = X(f);
6321
+ const [d, u] = Kh(o), f = se(() => Ic(e), [e]), p = o && !d ? [] : f.map(un), m = ve(!0), y = ve(f), v = Qo(() => /* @__PURE__ */ new Map()), g = ve(/* @__PURE__ */ new Set()), [b, S] = Y(f), [C, T] = Y(f);
6322
6322
  $f(() => {
6323
6323
  m.current = !1, y.current = f;
6324
6324
  for (let x = 0; x < C.length; x++) {
@@ -7914,7 +7914,7 @@ var o$ = {
7914
7914
  })]
7915
7915
  });
7916
7916
  function ib({ outlets: e, onSelectOutlet: t }) {
7917
- const [r, n] = X(null), [i, a] = X(""), o = (l) => {
7917
+ const [r, n] = Y(null), [i, a] = Y(""), o = (l) => {
7918
7918
  n(l);
7919
7919
  const c = e.find((d) => d.id == l);
7920
7920
  c && setTimeout(() => {
@@ -8009,7 +8009,7 @@ var ab = {
8009
8009
  return !e.taxRows || !e.taxRows.length ? 0 : e.taxRows.reduce((i, a) => a.isActive ? a.taxType === "FIXED" ? i + (a.taxRate || 0) * n : a.taxType === "PERCENTAGE" ? i + r * n * (a.taxRate || 0) / 100 : i : i, 0);
8010
8010
  };
8011
8011
  function As() {
8012
- const [e, t] = X({
8012
+ const [e, t] = Y({
8013
8013
  width: 0,
8014
8014
  height: 0
8015
8015
  });
@@ -8415,7 +8415,7 @@ var ub = (e) => Number(e.price || e.min_price || 0), po = (e, { perUnit: t = !1
8415
8415
  }
8416
8416
  };
8417
8417
  function hb() {
8418
- const e = tt(), { width: t } = As(), { staff: r, selectedServices: n, selectedProfessional: i } = re((y) => y.service), [a, o] = X(!1), s = n.map((y) => y.id), l = se(() => {
8418
+ const e = tt(), { width: t } = As(), { staff: r, selectedServices: n, selectedProfessional: i } = re((y) => y.service), [a, o] = Y(!1), s = n.map((y) => y.id), l = se(() => {
8419
8419
  if (!i?.id) return [];
8420
8420
  const y = r.find((v) => v.id === i.id);
8421
8421
  return y ? n.map((v) => {
@@ -8681,7 +8681,7 @@ var pb = {
8681
8681
  }
8682
8682
  };
8683
8683
  function mb() {
8684
- const e = tt(), t = ve(null), { superCategories: r, standaloneCategories: n, selectedCategory: i, selectedServices: a, selectedProfessional: o, loading: s } = re((P) => P.service), [l, c] = X("supercategory"), [d, u] = X(null), [f, p] = X(null), [m, y] = X(""), v = new Set(o ? o?.assignments?.map((P) => P.id) : []), g = new Set(o ? o?.assignments?.map((P) => P.categoryId) : []), b = n.map((P) => ({
8684
+ const e = tt(), t = ve(null), { superCategories: r, standaloneCategories: n, selectedCategory: i, selectedServices: a, selectedProfessional: o, loading: s } = re((P) => P.service), [l, c] = Y("supercategory"), [d, u] = Y(null), [f, p] = Y(null), [m, y] = Y(""), v = new Set(o ? o?.assignments?.map((P) => P.id) : []), g = new Set(o ? o?.assignments?.map((P) => P.categoryId) : []), b = n.map((P) => ({
8685
8685
  ...P,
8686
8686
  services: P.services?.filter((j) => v.has(j.id)) || []
8687
8687
  })).filter((P) => g.has(P.id) && P.services.length > 0), S = r.map((P) => ({
@@ -9002,7 +9002,7 @@ var vb = {
9002
9002
  }
9003
9003
  };
9004
9004
  function yb() {
9005
- const e = tt(), t = ve(null), { superCategories: r, standaloneCategories: n, selectedCategory: i, selectedServices: a, loading: o } = re((w) => w.service), { outletName: s } = re((w) => w?.outletDetails), [l, c] = X("supercategory"), [d, u] = X(null), [f, p] = X(null), [m, y] = X(""), v = n?.flatMap((w) => w.services), g = i ? i.services : v, b = se(() => d ? f ? f.services || [] : d?.categories?.flatMap((w) => w.services || []) : [], [d, f]), S = l === "standalone" ? g : b, C = se(() => {
9005
+ const e = tt(), t = ve(null), { superCategories: r, standaloneCategories: n, selectedCategory: i, selectedServices: a, loading: o } = re((w) => w.service), { outletName: s } = re((w) => w?.outletDetails), [l, c] = Y("supercategory"), [d, u] = Y(null), [f, p] = Y(null), [m, y] = Y(""), v = n?.flatMap((w) => w.services), g = i ? i.services : v, b = se(() => d ? f ? f.services || [] : d?.categories?.flatMap((w) => w.services || []) : [], [d, f]), S = l === "standalone" ? g : b, C = se(() => {
9006
9006
  const w = n?.flatMap((G) => G.services || []), F = r?.flatMap((G) => G?.categories?.flatMap((k) => k.services || []));
9007
9007
  return [...w, ...F];
9008
9008
  }, [n, r]), T = se(() => {
@@ -9295,7 +9295,7 @@ var gb = [
9295
9295
  "Dec"
9296
9296
  ];
9297
9297
  function Is({ buttonText: e, onButtonClick: t, showTaxesOnlyIfTime: r = !1, showTip: n = !1, tipPct: i = 0, onTipChange: a, consentRequired: o = !1, consentCompleted: s = 0, totalConsents: l = 0, checkingConsent: c = !1, loading: d = !1, isBookingDisabled: u = !1, handleSidebarOpen: f }) {
9298
- const { selectedSlotIndexes: p, slots: m, selectedDate: y } = re((L) => L.slots), { staff: v, selectedServices: g, selectedProfessional: b } = re((L) => L.service), { timeZone: S } = re((L) => L.outletDetails), C = _e.now().setZone(S ?? "UTC"), [T, N] = X(""), [_, x] = X(!1), D = ve(null), w = ve(null), [F, G] = X(0), k = [
9298
+ const { selectedSlotIndexes: p, slots: m, selectedDate: y } = re((L) => L.slots), { staff: v, selectedServices: g, selectedProfessional: b } = re((L) => L.service), { timeZone: S } = re((L) => L.outletDetails), C = _e.now().setZone(S ?? "UTC"), [T, N] = Y(""), [_, x] = Y(!1), D = ve(null), w = ve(null), [F, G] = Y(0), k = [
9299
9299
  0,
9300
9300
  5,
9301
9301
  10,
@@ -9332,7 +9332,7 @@ function Is({ buttonText: e, onButtonClick: t, showTaxesOnlyIfTime: r = !1, show
9332
9332
  day: C.day,
9333
9333
  month: C.month,
9334
9334
  year: C.year
9335
- }, E = p?.[0], I = E !== void 0 ? we(E) : null, U = R.month ?? 0, z = I ? `${gb[U]} ${R.day} at ${I}` : null, K = W.reduce((L, A) => L + A.tax, 0), Y = Number(i) || 0, Z = n ? q * Y / 100 : 0, Q = q + K + Z;
9335
+ }, E = p?.[0], I = E !== void 0 ? we(E) : null, U = R.month ?? 0, z = I ? `${gb[U]} ${R.day} at ${I}` : null, K = W.reduce((L, A) => L + A.tax, 0), X = Number(i) || 0, Z = n ? q * X / 100 : 0, Q = q + K + Z;
9336
9336
  me(() => {
9337
9337
  n && i == null && a?.(0);
9338
9338
  }, [
@@ -9431,7 +9431,7 @@ function Is({ buttonText: e, onButtonClick: t, showTaxesOnlyIfTime: r = !1, show
9431
9431
  /* @__PURE__ */ h("div", {
9432
9432
  className: "aaravpos-tip-options",
9433
9433
  children: [...k, "custom"].map((L, A) => {
9434
- const oe = L === "custom", Ce = oe ? _ : Y === L, rt = A === 0, rn = A === [...k, "custom"].length - 1;
9434
+ const oe = L === "custom", Ce = oe ? _ : X === L, rt = A === 0, rn = A === [...k, "custom"].length - 1;
9435
9435
  return /* @__PURE__ */ h("button", {
9436
9436
  onClick: () => {
9437
9437
  oe ? (x(!0), a?.(Number(T) || 0)) : (x(!1), N(""), a?.(Number(L)));
@@ -9505,7 +9505,7 @@ function Is({ buttonText: e, onButtonClick: t, showTaxesOnlyIfTime: r = !1, show
9505
9505
  value: /* @__PURE__ */ $(xe, { children: [/* @__PURE__ */ h(ge, { size: 14 }), q.toFixed(2)] })
9506
9506
  }),
9507
9507
  n && /* @__PURE__ */ h(Sa, {
9508
- label: `Tip (${Y}%)`,
9508
+ label: `Tip (${X}%)`,
9509
9509
  value: /* @__PURE__ */ $(xe, { children: [/* @__PURE__ */ h(ge, { size: 14 }), Z.toFixed(2)] })
9510
9510
  }),
9511
9511
  (!r || I) && /* @__PURE__ */ h(Sa, {
@@ -9601,7 +9601,7 @@ var Nr = ({ dateObj: e, selectedProfessional: t, outletTimeZone: r }) => {
9601
9601
  "S"
9602
9602
  ];
9603
9603
  function Sb({ isOpen: e, onClose: t }) {
9604
- const r = tt(), { selectedDate: n } = re((f) => f.slots), { selectedProfessional: i } = re((f) => f.service), { timeZone: a } = re((f) => f.outletDetails), [o] = X($b(a || "")), [s, l] = X(0), c = o[s];
9604
+ const r = tt(), { selectedDate: n } = re((f) => f.slots), { selectedProfessional: i } = re((f) => f.service), { timeZone: a } = re((f) => f.outletDetails), [o] = Y($b(a || "")), [s, l] = Y(0), c = o[s];
9605
9605
  if (!e) return null;
9606
9606
  const d = _e.now().setZone(a ?? "UTC"), u = (f, p) => {
9607
9607
  const m = _e.fromObject({
@@ -9731,7 +9731,7 @@ var Yc = [
9731
9731
  "Sat"
9732
9732
  ];
9733
9733
  function Nb() {
9734
- const e = tt(), [t, r] = X(11), { staff: n, selectedServices: i, selectedProfessional: a } = re((R) => R.service), { tenantId: o, timeZone: s } = re((R) => R?.outletDetails), { selectedSlotIndexes: l, selectedDate: c, selectedTime: d, slots: u, loading: f } = re((R) => R.slots), [p, m] = X(!1), [y, v] = X(0), g = 15, b = se(() => [
9734
+ const e = tt(), [t, r] = Y(11), { staff: n, selectedServices: i, selectedProfessional: a } = re((R) => R.service), { tenantId: o, timeZone: s } = re((R) => R?.outletDetails), { selectedSlotIndexes: l, selectedDate: c, selectedTime: d, slots: u, loading: f } = re((R) => R.slots), [p, m] = Y(!1), [y, v] = Y(0), g = 15, b = se(() => [
9735
9735
  u.morning,
9736
9736
  u.afternoon,
9737
9737
  u.evening
@@ -9861,7 +9861,7 @@ function Nb() {
9861
9861
  };
9862
9862
  return R(), window.addEventListener("resize", R), () => window.removeEventListener("resize", R);
9863
9863
  }, []);
9864
- const k = u?.morning || [], P = u?.afternoon || [], j = u?.evening || [], W = (R) => R.some((E) => !E.isBooked && E.status === "AVAILABLE"), q = () => W(k) ? "morning" : W(P) ? "afternoon" : W(j) ? "evening" : null, [J, ae] = X(q()), we = () => {
9864
+ const k = u?.morning || [], P = u?.afternoon || [], j = u?.evening || [], W = (R) => R.some((E) => !E.isBooked && E.status === "AVAILABLE"), q = () => W(k) ? "morning" : W(P) ? "afternoon" : W(j) ? "evening" : null, [J, ae] = Y(q()), we = () => {
9865
9865
  let R = null;
9866
9866
  for (let E = 1; E < T.length; E++) {
9867
9867
  const I = S.plus({ days: E });
@@ -9951,18 +9951,18 @@ function Nb() {
9951
9951
  children: /* @__PURE__ */ h(si, { size: 20 })
9952
9952
  }),
9953
9953
  T.slice(y, y + t).map((R) => {
9954
- const E = _e.fromISO(R.fullDate || ""), I = E.weekday % 7, U = _e.now().setZone(s).startOf("day"), z = E.hasSame(U, "day"), K = c?.day === R.day && c?.month === R.month && c?.year === R.year, Y = Nr({
9954
+ const E = _e.fromISO(R.fullDate || ""), I = E.weekday % 7, U = _e.now().setZone(s).startOf("day"), z = E.hasSame(U, "day"), K = c?.day === R.day && c?.month === R.month && c?.year === R.year, X = Nr({
9955
9955
  dateObj: R,
9956
9956
  selectedProfessional: a,
9957
9957
  outletTimeZone: s || "UTC"
9958
9958
  });
9959
9959
  return /* @__PURE__ */ $("div", {
9960
9960
  onClick: () => {
9961
- Y || F(R);
9961
+ X || F(R);
9962
9962
  },
9963
- className: ["arravpos-date-card", Y ? "arravpos-date-card-disabled" : K ? "arravpos-date-card-active" : "arravpos-date-card-default"].filter(Boolean).join(" "),
9963
+ className: ["arravpos-date-card", X ? "arravpos-date-card-disabled" : K ? "arravpos-date-card-active" : "arravpos-date-card-default"].filter(Boolean).join(" "),
9964
9964
  children: [
9965
- Y && /* @__PURE__ */ h("div", { className: "arravpos-date-disabled-slash" }),
9965
+ X && /* @__PURE__ */ h("div", { className: "arravpos-date-disabled-slash" }),
9966
9966
  /* @__PURE__ */ h("span", {
9967
9967
  className: "arravpos-date-week",
9968
9968
  children: Cb[I]
@@ -9971,11 +9971,11 @@ function Nb() {
9971
9971
  className: "arravpos-date-day",
9972
9972
  children: R.day
9973
9973
  }),
9974
- z && !K && !Y && /* @__PURE__ */ h("span", {
9974
+ z && !K && !X && /* @__PURE__ */ h("span", {
9975
9975
  className: "arravpos-date-today",
9976
9976
  children: "TODAY"
9977
9977
  }),
9978
- Y && /* @__PURE__ */ h("span", {
9978
+ X && /* @__PURE__ */ h("span", {
9979
9979
  className: "arravpos-date-unavailable",
9980
9980
  children: "UNAVAILABLE"
9981
9981
  })
@@ -10563,7 +10563,7 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10563
10563
  function K(A) {
10564
10564
  return T(A) === i;
10565
10565
  }
10566
- function Y(A) {
10566
+ function X(A) {
10567
10567
  return T(A) === y;
10568
10568
  }
10569
10569
  function Z(A) {
@@ -10581,7 +10581,7 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10581
10581
  function L(A) {
10582
10582
  return T(A) === f;
10583
10583
  }
10584
- e.AsyncMode = N, e.ConcurrentMode = _, e.ContextConsumer = x, e.ContextProvider = D, e.Element = w, e.ForwardRef = F, e.Fragment = G, e.Lazy = k, e.Memo = P, e.Portal = j, e.Profiler = W, e.StrictMode = q, e.Suspense = J, e.isAsyncMode = we, e.isConcurrentMode = R, e.isContextConsumer = E, e.isContextProvider = I, e.isElement = U, e.isForwardRef = z, e.isFragment = K, e.isLazy = Y, e.isMemo = Z, e.isPortal = Q, e.isProfiler = te, e.isStrictMode = ee, e.isSuspense = L, e.isValidElementType = C, e.typeOf = T;
10584
+ e.AsyncMode = N, e.ConcurrentMode = _, e.ContextConsumer = x, e.ContextProvider = D, e.Element = w, e.ForwardRef = F, e.Fragment = G, e.Lazy = k, e.Memo = P, e.Portal = j, e.Profiler = W, e.StrictMode = q, e.Suspense = J, e.isAsyncMode = we, e.isConcurrentMode = R, e.isContextConsumer = E, e.isContextProvider = I, e.isElement = U, e.isForwardRef = z, e.isFragment = K, e.isLazy = X, e.isMemo = Z, e.isPortal = Q, e.isProfiler = te, e.isStrictMode = ee, e.isSuspense = L, e.isValidElementType = C, e.typeOf = T;
10585
10585
  })();
10586
10586
  })), gp = /* @__PURE__ */ ze(((e, t) => {
10587
10587
  process.env.NODE_ENV === "production" ? t.exports = Fb() : t.exports = jb();
@@ -10713,7 +10713,7 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10713
10713
  function b(E) {
10714
10714
  if (process.env.NODE_ENV !== "production")
10715
10715
  var I = {}, U = 0;
10716
- function z(Y, Z, Q, te, ee, L, A) {
10716
+ function z(X, Z, Q, te, ee, L, A) {
10717
10717
  if (te = te || m, L = L || Q, A !== i) {
10718
10718
  if (d) {
10719
10719
  var oe = /* @__PURE__ */ new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");
@@ -10723,17 +10723,17 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10723
10723
  !I[Ce] && U < 3 && (s("You are manually calling a React.PropTypes validation function for the `" + L + "` prop on `" + te + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."), I[Ce] = !0, U++);
10724
10724
  }
10725
10725
  }
10726
- return Z[Q] == null ? Y ? Z[Q] === null ? new g("The " + ee + " `" + L + "` is marked as required " + ("in `" + te + "`, but its value is `null`.")) : new g("The " + ee + " `" + L + "` is marked as required in " + ("`" + te + "`, but its value is `undefined`.")) : null : E(Z, Q, te, ee, L);
10726
+ return Z[Q] == null ? X ? Z[Q] === null ? new g("The " + ee + " `" + L + "` is marked as required " + ("in `" + te + "`, but its value is `null`.")) : new g("The " + ee + " `" + L + "` is marked as required in " + ("`" + te + "`, but its value is `undefined`.")) : null : E(Z, Q, te, ee, L);
10727
10727
  }
10728
10728
  var K = z.bind(null, !1);
10729
10729
  return K.isRequired = z.bind(null, !0), K;
10730
10730
  }
10731
10731
  function S(E) {
10732
- function I(U, z, K, Y, Z, Q) {
10732
+ function I(U, z, K, X, Z, Q) {
10733
10733
  var te = U[z];
10734
10734
  if (J(te) !== E) {
10735
10735
  var ee = ae(te);
10736
- return new g("Invalid " + Y + " `" + Z + "` of type " + ("`" + ee + "` supplied to `" + K + "`, expected ") + ("`" + E + "`."), { expectedType: E });
10736
+ return new g("Invalid " + X + " `" + Z + "` of type " + ("`" + ee + "` supplied to `" + K + "`, expected ") + ("`" + E + "`."), { expectedType: E });
10737
10737
  }
10738
10738
  return null;
10739
10739
  }
@@ -10743,15 +10743,15 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10743
10743
  return b(l);
10744
10744
  }
10745
10745
  function T(E) {
10746
- function I(U, z, K, Y, Z) {
10746
+ function I(U, z, K, X, Z) {
10747
10747
  if (typeof E != "function") return new g("Property `" + Z + "` of component `" + K + "` has invalid PropType notation inside arrayOf.");
10748
10748
  var Q = U[z];
10749
10749
  if (!Array.isArray(Q)) {
10750
10750
  var te = J(Q);
10751
- return new g("Invalid " + Y + " `" + Z + "` of type " + ("`" + te + "` supplied to `" + K + "`, expected an array."));
10751
+ return new g("Invalid " + X + " `" + Z + "` of type " + ("`" + te + "` supplied to `" + K + "`, expected an array."));
10752
10752
  }
10753
10753
  for (var ee = 0; ee < Q.length; ee++) {
10754
- var L = E(Q, ee, K, Y, Z + "[" + ee + "]", i);
10754
+ var L = E(Q, ee, K, X, Z + "[" + ee + "]", i);
10755
10755
  if (L instanceof Error) return L;
10756
10756
  }
10757
10757
  return null;
@@ -10759,32 +10759,32 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10759
10759
  return b(I);
10760
10760
  }
10761
10761
  function N() {
10762
- function E(I, U, z, K, Y) {
10762
+ function E(I, U, z, K, X) {
10763
10763
  var Z = I[U];
10764
10764
  if (!c(Z)) {
10765
10765
  var Q = J(Z);
10766
- return new g("Invalid " + K + " `" + Y + "` of type " + ("`" + Q + "` supplied to `" + z + "`, expected a single ReactElement."));
10766
+ return new g("Invalid " + K + " `" + X + "` of type " + ("`" + Q + "` supplied to `" + z + "`, expected a single ReactElement."));
10767
10767
  }
10768
10768
  return null;
10769
10769
  }
10770
10770
  return b(E);
10771
10771
  }
10772
10772
  function _() {
10773
- function E(I, U, z, K, Y) {
10773
+ function E(I, U, z, K, X) {
10774
10774
  var Z = I[U];
10775
10775
  if (!r.isValidElementType(Z)) {
10776
10776
  var Q = J(Z);
10777
- return new g("Invalid " + K + " `" + Y + "` of type " + ("`" + Q + "` supplied to `" + z + "`, expected a single ReactElement type."));
10777
+ return new g("Invalid " + K + " `" + X + "` of type " + ("`" + Q + "` supplied to `" + z + "`, expected a single ReactElement type."));
10778
10778
  }
10779
10779
  return null;
10780
10780
  }
10781
10781
  return b(E);
10782
10782
  }
10783
10783
  function x(E) {
10784
- function I(U, z, K, Y, Z) {
10784
+ function I(U, z, K, X, Z) {
10785
10785
  if (!(U[z] instanceof E)) {
10786
10786
  var Q = E.name || m, te = R(U[z]);
10787
- return new g("Invalid " + Y + " `" + Z + "` of type " + ("`" + te + "` supplied to `" + K + "`, expected ") + ("instance of `" + Q + "`."));
10787
+ return new g("Invalid " + X + " `" + Z + "` of type " + ("`" + te + "` supplied to `" + K + "`, expected ") + ("instance of `" + Q + "`."));
10788
10788
  }
10789
10789
  return null;
10790
10790
  }
@@ -10793,22 +10793,22 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10793
10793
  function D(E) {
10794
10794
  if (!Array.isArray(E))
10795
10795
  return process.env.NODE_ENV !== "production" && (arguments.length > 1 ? s("Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).") : s("Invalid argument supplied to oneOf, expected an array.")), l;
10796
- function I(U, z, K, Y, Z) {
10796
+ function I(U, z, K, X, Z) {
10797
10797
  for (var Q = U[z], te = 0; te < E.length; te++) if (v(Q, E[te])) return null;
10798
10798
  var ee = JSON.stringify(E, function(A, oe) {
10799
10799
  return ae(oe) === "symbol" ? String(oe) : oe;
10800
10800
  });
10801
- return new g("Invalid " + Y + " `" + Z + "` of value `" + String(Q) + "` " + ("supplied to `" + K + "`, expected one of " + ee + "."));
10801
+ return new g("Invalid " + X + " `" + Z + "` of value `" + String(Q) + "` " + ("supplied to `" + K + "`, expected one of " + ee + "."));
10802
10802
  }
10803
10803
  return b(I);
10804
10804
  }
10805
10805
  function w(E) {
10806
- function I(U, z, K, Y, Z) {
10806
+ function I(U, z, K, X, Z) {
10807
10807
  if (typeof E != "function") return new g("Property `" + Z + "` of component `" + K + "` has invalid PropType notation inside objectOf.");
10808
10808
  var Q = U[z], te = J(Q);
10809
- if (te !== "object") return new g("Invalid " + Y + " `" + Z + "` of type " + ("`" + te + "` supplied to `" + K + "`, expected an object."));
10809
+ if (te !== "object") return new g("Invalid " + X + " `" + Z + "` of type " + ("`" + te + "` supplied to `" + K + "`, expected an object."));
10810
10810
  for (var ee in Q) if (a(Q, ee)) {
10811
- var L = E(Q, ee, K, Y, Z + "." + ee, i);
10811
+ var L = E(Q, ee, K, X, Z + "." + ee, i);
10812
10812
  if (L instanceof Error) return L;
10813
10813
  }
10814
10814
  return null;
@@ -10823,9 +10823,9 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10823
10823
  if (typeof U != "function")
10824
10824
  return s("Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + we(U) + " at index " + I + "."), l;
10825
10825
  }
10826
- function z(K, Y, Z, Q, te) {
10826
+ function z(K, X, Z, Q, te) {
10827
10827
  for (var ee = [], L = 0; L < E.length; L++) {
10828
- var A = E[L], oe = A(K, Y, Z, Q, te, i);
10828
+ var A = E[L], oe = A(K, X, Z, Q, te, i);
10829
10829
  if (oe == null) return null;
10830
10830
  oe.data && a(oe.data, "expectedType") && ee.push(oe.data.expectedType);
10831
10831
  }
@@ -10835,8 +10835,8 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10835
10835
  return b(z);
10836
10836
  }
10837
10837
  function G() {
10838
- function E(I, U, z, K, Y) {
10839
- return W(I[U]) ? null : new g("Invalid " + K + " `" + Y + "` supplied to " + ("`" + z + "`, expected a ReactNode."));
10838
+ function E(I, U, z, K, X) {
10839
+ return W(I[U]) ? null : new g("Invalid " + K + " `" + X + "` supplied to " + ("`" + z + "`, expected a ReactNode."));
10840
10840
  }
10841
10841
  return b(E);
10842
10842
  }
@@ -10844,13 +10844,13 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10844
10844
  return new g((E || "React class") + ": " + I + " type `" + U + "." + z + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + K + "`.");
10845
10845
  }
10846
10846
  function P(E) {
10847
- function I(U, z, K, Y, Z) {
10847
+ function I(U, z, K, X, Z) {
10848
10848
  var Q = U[z], te = J(Q);
10849
- if (te !== "object") return new g("Invalid " + Y + " `" + Z + "` of type `" + te + "` " + ("supplied to `" + K + "`, expected `object`."));
10849
+ if (te !== "object") return new g("Invalid " + X + " `" + Z + "` of type `" + te + "` " + ("supplied to `" + K + "`, expected `object`."));
10850
10850
  for (var ee in E) {
10851
10851
  var L = E[ee];
10852
- if (typeof L != "function") return k(K, Y, Z, ee, ae(L));
10853
- var A = L(Q, ee, K, Y, Z + "." + ee, i);
10852
+ if (typeof L != "function") return k(K, X, Z, ee, ae(L));
10853
+ var A = L(Q, ee, K, X, Z + "." + ee, i);
10854
10854
  if (A) return A;
10855
10855
  }
10856
10856
  return null;
@@ -10858,15 +10858,15 @@ var Fb = /* @__PURE__ */ ze(((e) => {
10858
10858
  return b(I);
10859
10859
  }
10860
10860
  function j(E) {
10861
- function I(U, z, K, Y, Z) {
10861
+ function I(U, z, K, X, Z) {
10862
10862
  var Q = U[z], te = J(Q);
10863
- if (te !== "object") return new g("Invalid " + Y + " `" + Z + "` of type `" + te + "` " + ("supplied to `" + K + "`, expected `object`."));
10863
+ if (te !== "object") return new g("Invalid " + X + " `" + Z + "` of type `" + te + "` " + ("supplied to `" + K + "`, expected `object`."));
10864
10864
  for (var ee in n({}, U[z], E)) {
10865
10865
  var L = E[ee];
10866
- if (a(E, ee) && typeof L != "function") return k(K, Y, Z, ee, ae(L));
10867
- if (!L) return new g("Invalid " + Y + " `" + Z + "` key `" + ee + "` supplied to `" + K + "`.\nBad object: " + JSON.stringify(U[z], null, " ") + `
10866
+ if (a(E, ee) && typeof L != "function") return k(K, X, Z, ee, ae(L));
10867
+ if (!L) return new g("Invalid " + X + " `" + Z + "` key `" + ee + "` supplied to `" + K + "`.\nBad object: " + JSON.stringify(U[z], null, " ") + `
10868
10868
  Valid keys: ` + JSON.stringify(Object.keys(E), null, " "));
10869
- var A = L(Q, ee, K, Y, Z + "." + ee, i);
10869
+ var A = L(Q, ee, K, X, Z + "." + ee, i);
10870
10870
  if (A) return A;
10871
10871
  }
10872
10872
  return null;
@@ -11532,7 +11532,7 @@ var Yb = ({ onClose: e, onConfirm: t, enforcement: r, heading: n, consent: i })
11532
11532
  return +`${t}${r}`;
11533
11533
  };
11534
11534
  function Qb() {
11535
- const e = tt(), { tenantId: t, id: r } = re((M) => M.outletDetails), { timeZone: n, image: i, outletName: a, address: o } = re((M) => M.outletDetails), { staff: s, selectedServices: l, selectedProfessional: c } = re((M) => M.service), { selectedSlotIds: d, selectedDate: u, selectedTime: f } = re((M) => M.slots), { userDetails: p, bookingMode: m, tipPct: y } = re((M) => M.appointment), v = Array.isArray(l) ? l : [l], { selectedSlotIndexes: g, slots: b } = re((M) => M.slots), [S, C] = X(!1), [T, N] = X(!1), [_, x] = X(null), [D, w] = X("person"), [F, G] = X(!1), [k, P] = X(""), [j, W] = X(""), [q, J] = X(null), [ae, we] = X(null), [R, E] = X({}), [I, U] = X({}), [z, K] = X(!1), [Y, Z] = X(!1), Q = ve(!1), te = ve(""), ee = _e.now().setZone(n ?? "UTC"), L = v.map((M) => {
11535
+ const e = tt(), { tenantId: t, id: r } = re((M) => M.outletDetails), { timeZone: n, image: i, outletName: a, address: o } = re((M) => M.outletDetails), { staff: s, selectedServices: l, selectedProfessional: c } = re((M) => M.service), { selectedSlotIds: d, selectedDate: u, selectedTime: f } = re((M) => M.slots), { userDetails: p, bookingMode: m, tipPct: y } = re((M) => M.appointment), v = Array.isArray(l) ? l : [l], { selectedSlotIndexes: g, slots: b } = re((M) => M.slots), [S, C] = Y(!1), [T, N] = Y(!1), [_, x] = Y(null), [D, w] = Y("person"), [F, G] = Y(!1), [k, P] = Y(""), [j, W] = Y(""), [q, J] = Y(null), [ae, we] = Y(null), [R, E] = Y({}), [I, U] = Y({}), [z, K] = Y(!1), [X, Z] = Y(!1), Q = ve(!1), te = ve(""), ee = _e.now().setZone(n ?? "UTC"), L = v.map((M) => {
11536
11536
  const V = s?.find((ue) => ue.id === c?.id)?.assignments?.find((ue) => ue.id === M.id), ne = {
11537
11537
  ...M,
11538
11538
  price: V?.price ?? M.price ?? M.min_price ?? 0,
@@ -11826,7 +11826,7 @@ function Qb() {
11826
11826
  }
11827
11827
  }, wm = () => N(!1), Pm = () => !f || !p?.firstName || !p?.email && !p?.phone;
11828
11828
  return /* @__PURE__ */ $(Ut, {
11829
- isSidebarOpen: Y,
11829
+ isSidebarOpen: X,
11830
11830
  handleSidebarOpen: () => Z((M) => !M),
11831
11831
  sidebar: /* @__PURE__ */ h("div", {
11832
11832
  className: "aaravpos-aside",
@@ -24534,7 +24534,7 @@ var p7 = [
24534
24534
  "CN"
24535
24535
  ];
24536
24536
  function m7() {
24537
- const e = tt(), { tenantId: t } = re((k) => k?.outletDetails), { userDetails: r } = re((k) => k.appointment), [n, i] = X(!1), [a, o] = X(null), [s, l] = X(!1), c = ve(""), d = ve(null), { register: u, handleSubmit: f, control: p, watch: m, reset: y, trigger: v, setValue: g, formState: { errors: b, isSubmitted: S, isSubmitting: C } } = Lo({
24537
+ const e = tt(), { tenantId: t } = re((k) => k?.outletDetails), { userDetails: r } = re((k) => k.appointment), [n, i] = Y(!1), [a, o] = Y(null), [s, l] = Y(!1), c = ve(""), d = ve(null), { register: u, handleSubmit: f, control: p, watch: m, reset: y, trigger: v, setValue: g, formState: { errors: b, isSubmitted: S, isSubmitting: C } } = Lo({
24538
24538
  defaultValues: {
24539
24539
  firstName: "",
24540
24540
  lastName: "",
@@ -24793,7 +24793,7 @@ var v7 = {
24793
24793
  }
24794
24794
  };
24795
24795
  function y7() {
24796
- const e = tt(), t = re((N) => N.appointment.appointmentId), { tenantId: r } = re((N) => N.outletDetails), [n, i] = X(null), [a, o] = X(!0), [s, l] = X(null), [c, d] = X(!1);
24796
+ const e = tt(), t = re((N) => N.appointment.appointmentId), { tenantId: r } = re((N) => N.outletDetails), [n, i] = Y(null), [a, o] = Y(!0), [s, l] = Y(null), [c, d] = Y(!1);
24797
24797
  me(() => {
24798
24798
  if (!t) {
24799
24799
  l("No appointment ID provided"), o(!1);
@@ -25002,49 +25002,54 @@ function $7() {
25002
25002
  })] });
25003
25003
  }
25004
25004
  var b7 = ({ bookingCode: e }) => {
25005
- const t = tt(), r = re((c) => c.outletList.outlets), [n, i] = X(null), { id: a } = re((c) => c.outletDetails), o = Ye(async () => {
25005
+ const t = tt(), r = re((u) => u.outletList.outlets), [n, i] = Y(!1), [a, o] = Y(null), { id: s } = re((u) => u.outletDetails), l = Ye(async () => {
25006
25006
  try {
25007
- i(null);
25008
- const c = await bl(e);
25009
- if (c?.success) {
25010
- const d = c?.data?.data?.outlets || [];
25011
- t(J1(d)), lv(c?.data?.result), d.length === 1 && l(d[0]);
25012
- } else i(c?.message || "Failed to fetch data");
25013
- } catch (c) {
25014
- console.error(c), i(c?.message || "Something went wrong");
25007
+ i(!0), o(null);
25008
+ const u = await bl(e);
25009
+ if (u?.success) {
25010
+ const f = u?.data?.data?.outlets || [];
25011
+ t(J1(f)), lv(u?.data?.result), f.length === 1 && d(f[0]);
25012
+ } else o(u?.message || "Failed to fetch data");
25013
+ } catch (u) {
25014
+ console.error(u), o(u?.message || "Something went wrong");
25015
+ } finally {
25016
+ i(!1);
25015
25017
  }
25016
- }, [e, t]), s = async (c, d) => {
25018
+ }, [e, t]), c = async (u, f) => {
25017
25019
  try {
25018
- const u = await bl(e, c, d);
25019
- u?.success || i(u?.message || "Failed to fetch outlet data"), t(L1(u?.data?.token)), t(M1(u?.data?.data?.outlets[0]?.isService)), t(j1({
25020
- standaloneCategories: u?.data?.data?.standaloneCategories,
25021
- superCategories: u?.data?.data?.superCategories,
25022
- staff: u?.data?.data?.staff
25020
+ const p = await bl(e, u, f);
25021
+ p?.success || o(p?.message || "Failed to fetch outlet data"), t(L1(p?.data?.token)), t(M1(p?.data?.data?.outlets[0]?.isService)), t(j1({
25022
+ standaloneCategories: p?.data?.data?.standaloneCategories,
25023
+ superCategories: p?.data?.data?.superCategories,
25024
+ staff: p?.data?.data?.staff
25023
25025
  }));
25024
- } catch (u) {
25025
- console.error(u), i(u?.message || "Something went wrong");
25026
- }
25027
- }, l = async (c) => {
25028
- c && (await s(String(c?.tenantId), String(c?.id)), t(k1({
25029
- ...c,
25030
- tenantId: c.tenantId ?? "",
25031
- currency: c.currency ?? "",
25032
- outletTimeZoneDate: _e.now().setZone(c?.timeZone).toFormat("yyyy-MM-dd"),
25033
- outletTimeZoneYear: _e.fromISO(c?.createdAt, { zone: "utc" }).setZone(c?.timeZone).year
25034
- })), t(Va(c?.isService ? "services" : "professionals")));
25026
+ } catch (p) {
25027
+ console.error(p), o(p?.message || "Something went wrong");
25028
+ }
25029
+ }, d = async (u) => {
25030
+ u && (await c(String(u?.tenantId), String(u?.id)), t(k1({
25031
+ ...u,
25032
+ tenantId: u.tenantId ?? "",
25033
+ currency: u.currency ?? "",
25034
+ outletTimeZoneDate: _e.now().setZone(u?.timeZone).toFormat("yyyy-MM-dd"),
25035
+ outletTimeZoneYear: _e.fromISO(u?.createdAt, { zone: "utc" }).setZone(u?.timeZone).year
25036
+ })), t(Va(u?.isService ? "services" : "professionals")));
25035
25037
  };
25036
25038
  return me(() => {
25037
- Array.isArray(r) && r.length === 0 && o();
25038
- }, [r?.length, o]), n ? /* @__PURE__ */ h("div", {
25039
+ Array.isArray(r) && r.length === 0 && l();
25040
+ }, [r?.length, l]), a ? /* @__PURE__ */ h("div", {
25039
25041
  className: "arravpos-error-box",
25040
- children: n
25041
- }) : /* @__PURE__ */ h("div", { children: r.length > 1 && !a ? /* @__PURE__ */ h(ib, {
25042
+ children: a
25043
+ }) : n ? /* @__PURE__ */ h("div", {
25044
+ className: "aaravpos-loader-wrapper",
25045
+ children: /* @__PURE__ */ h("div", { className: "aaravpos-loader" })
25046
+ }) : /* @__PURE__ */ h("div", { children: r.length > 1 && !s ? /* @__PURE__ */ h(ib, {
25042
25047
  outlets: r,
25043
- onSelectOutlet: (c) => {
25044
- c?.id && l(c);
25048
+ onSelectOutlet: (u) => {
25049
+ u?.id && d(u);
25045
25050
  }
25046
25051
  }) : /* @__PURE__ */ h($7, {}) });
25047
25052
  }, W7 = ({ ...e }) => /* @__PURE__ */ h(sv, { children: /* @__PURE__ */ h(b7, { ...e }) });
25048
25053
  export {
25049
- W7 as BookingPlugin
25054
+ W7 as AppointmentBookingPlugin
25050
25055
  };
package/dist/styles.css CHANGED
@@ -3298,6 +3298,20 @@
3298
3298
  display: flex;
3299
3299
  flex-direction: column;
3300
3300
  }
3301
+ .aaravpos-loader-wrapper {
3302
+ display: flex;
3303
+ align-items: center;
3304
+ justify-content: center;
3305
+ height: 580px;
3306
+ }
3307
+ .aaravpos-loader {
3308
+ width: 36px;
3309
+ height: 36px;
3310
+ border: 4px solid #e5e5e5;
3311
+ border-top-color: var(--btn-bg);
3312
+ border-radius: 50%;
3313
+ animation: aaravpos-spin 0.8s linear infinite;
3314
+ }
3301
3315
  @media (min-width: 640px) {
3302
3316
  .custom-container {
3303
3317
  padding-left: 32px;
@@ -3682,3 +3696,8 @@
3682
3696
  transform: rotate(360deg);
3683
3697
  }
3684
3698
  }
3699
+ @keyframes aaravpos-spin {
3700
+ to {
3701
+ transform: rotate(360deg);
3702
+ }
3703
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aaravpos/appointment-booking-plugin",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "A React component library built with Tailwind CSS v4 and TypeScript",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@10.33.0",
@@ -30,13 +30,17 @@
30
30
  },
31
31
  "keywords": [
32
32
  "react",
33
- "components",
33
+ "appointment",
34
34
  "tailwindcss",
35
35
  "typescript",
36
- "ui-kit"
36
+ "plugin",
37
+ "booking"
37
38
  ],
38
39
  "author": "Aaravpos",
39
- "license": "ISC",
40
+ "license": "MIT",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
40
44
  "devDependencies": {
41
45
  "@tailwindcss/vite": "^4.2.4",
42
46
  "@types/lodash": "4.17.24",
@@ -1,3 +0,0 @@
1
- import { default as React } from 'react';
2
- import { BookingPluginProps } from '../types';
3
- export declare const BookingPlugin: React.FC<BookingPluginProps>;