@orderingstack/front-hooks 3.13.1 → 3.14.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 (32) hide show
  1. package/dist/{index-2ea67dc4.js → index-6cf9f145.js} +9 -9
  2. package/dist/index-6cf9f145.js.map +1 -0
  3. package/dist/{index-e94bdfe1.mjs → index-e6041ea4.mjs} +61 -54
  4. package/dist/index-e6041ea4.mjs.map +1 -0
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.es.js +1 -1
  7. package/dist/types/auth/AuthProvider.d.ts.map +1 -1
  8. package/dist/types/auth/useHistory.d.ts +5 -0
  9. package/dist/types/auth/useHistory.d.ts.map +1 -0
  10. package/dist/{web-6b6e09a8.js → web-04083477.js} +2 -2
  11. package/dist/{web-6b6e09a8.js.map → web-04083477.js.map} +1 -1
  12. package/dist/{web-b2f1f017.mjs → web-15e58e49.mjs} +2 -2
  13. package/dist/{web-b2f1f017.mjs.map → web-15e58e49.mjs.map} +1 -1
  14. package/dist/{web-53aa55b2.js → web-18862e7f.js} +2 -2
  15. package/dist/{web-53aa55b2.js.map → web-18862e7f.js.map} +1 -1
  16. package/dist/{web-0926b890.mjs → web-339720de.mjs} +2 -2
  17. package/dist/{web-0926b890.mjs.map → web-339720de.mjs.map} +1 -1
  18. package/dist/{web-21666ddf.mjs → web-52c5055f.mjs} +2 -2
  19. package/dist/{web-21666ddf.mjs.map → web-52c5055f.mjs.map} +1 -1
  20. package/dist/{web-94e0a546.js → web-6e6e7db3.js} +2 -2
  21. package/dist/{web-94e0a546.js.map → web-6e6e7db3.js.map} +1 -1
  22. package/dist/{web-5507cb70.mjs → web-8880039f.mjs} +2 -2
  23. package/dist/{web-5507cb70.mjs.map → web-8880039f.mjs.map} +1 -1
  24. package/dist/{web-a526c378.mjs → web-c1757a71.mjs} +2 -2
  25. package/dist/{web-a526c378.mjs.map → web-c1757a71.mjs.map} +1 -1
  26. package/dist/{web-415acf00.js → web-d5b6f527.js} +2 -2
  27. package/dist/{web-415acf00.js.map → web-d5b6f527.js.map} +1 -1
  28. package/dist/{web-b9daace8.js → web-e5281a04.js} +2 -2
  29. package/dist/{web-b9daace8.js.map → web-e5281a04.js.map} +1 -1
  30. package/package.json +3 -3
  31. package/dist/index-2ea67dc4.js.map +0 -1
  32. package/dist/index-e94bdfe1.mjs.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import ba, { useRef as Oo, useState as Pe, useEffect as Ie, useContext as fr } from "react";
2
2
  import { ConfigContext as zt, AuthContext as Gs } from "@orderingstack/ordering-core-react";
3
3
  import { useTranslation as Ks } from "react-i18next";
4
- import { useLocation as Ys, useHistory as Vs } from "react-router-dom";
4
+ import { useNavigate as Ys, useLocation as Vs } from "react-router-dom";
5
5
  function _a(e, r) {
6
6
  const t = Oo(), [n, a] = Pe(null);
7
7
  return Ie(() => {
@@ -1105,10 +1105,10 @@ function Tv(e) {
1105
1105
  let r = 0;
1106
1106
  return e == null || e.forEach((t) => r += Number(t.discountPrice)), r;
1107
1107
  }
1108
- function F2(e) {
1108
+ function H2(e) {
1109
1109
  return Tv(e.discounts);
1110
1110
  }
1111
- function H2(e, r, t = ",", n = 2) {
1111
+ function q2(e, r, t = ",", n = 2) {
1112
1112
  return `${Number(e).toFixed(n).replace(".", t)}${r ? " " + r : ""}`;
1113
1113
  }
1114
1114
  function Rv(e, r) {
@@ -1116,7 +1116,7 @@ function Rv(e, r) {
1116
1116
  const t = (a = e._) == null ? void 0 : a.enableKey;
1117
1117
  return t ? !r || !Array.isArray(r) || r.length === 0 ? !1 : t.replace(/\s/g, "").split(",").some((i) => r.includes(i)) : !0;
1118
1118
  }
1119
- function q2(e) {
1119
+ function M2(e) {
1120
1120
  var t, n, a, i, s, c;
1121
1121
  const r = (n = (t = e.details) == null ? void 0 : t.literals) == null ? void 0 : n.name.split(" ").filter((d) => d !== "");
1122
1122
  return r ? r.length === 1 ? ((c = (s = (i = (a = e.details) == null ? void 0 : a.literals) == null ? void 0 : i.name) == null ? void 0 : s.slice) == null ? void 0 : c.call(s, 0, 2)) || "" : r.length > 1 ? `${r[0][0]}${r[1][0]}` : "" : "";
@@ -1151,7 +1151,7 @@ function Iv(e, r) {
1151
1151
  if (e)
1152
1152
  return e.map((t) => es(t, r));
1153
1153
  }
1154
- function M2({
1154
+ function W2({
1155
1155
  originalMenu: e,
1156
1156
  markOnly: r = !1,
1157
1157
  timeZone: t,
@@ -1477,7 +1477,7 @@ const it = (e, r, t = 0) => {
1477
1477
  }
1478
1478
  n += c;
1479
1479
  }), Math.round(100 * n) / 100;
1480
- }, W2 = ({
1480
+ }, z2 = ({
1481
1481
  product: e,
1482
1482
  state: r,
1483
1483
  selected: t,
@@ -1510,10 +1510,10 @@ function cs(e) {
1510
1510
  return t;
1511
1511
  }, {}), r;
1512
1512
  }
1513
- function z2(e) {
1513
+ function G2(e) {
1514
1514
  return cs(e);
1515
1515
  }
1516
- function G2(e) {
1516
+ function K2(e) {
1517
1517
  return !e || e.length === 0 ? null : cs(e.flatMap((r) => r.lines));
1518
1518
  }
1519
1519
  var fa = {}, Zp = {
@@ -2425,7 +2425,7 @@ function La(e, r = 600, t = !0, n, a) {
2425
2425
  }
2426
2426
  }, [e]), _a(y, r * 1e3), { value: l, isError: f, isLoading: !f && !l };
2427
2427
  }
2428
- function K2({
2428
+ function Y2({
2429
2429
  id: e,
2430
2430
  intervalSeconds: r,
2431
2431
  withLocalStorage: t
@@ -2457,7 +2457,7 @@ function xm(e, r = 600, t = !0, n, a, i) {
2457
2457
  isError: s.isError
2458
2458
  };
2459
2459
  }
2460
- function Y2(e, r, t, n = 300, a = !0) {
2460
+ function V2(e, r, t, n = 300, a = !0) {
2461
2461
  var l, g, f, v;
2462
2462
  const i = fr(zt);
2463
2463
  if (!i)
@@ -2510,7 +2510,7 @@ function pm({
2510
2510
  isLoading: l
2511
2511
  };
2512
2512
  }
2513
- function V2({
2513
+ function X2({
2514
2514
  kioskMediaId: e,
2515
2515
  kioskMediaType: r,
2516
2516
  venue: t,
@@ -2534,7 +2534,7 @@ function V2({
2534
2534
  locale: s
2535
2535
  });
2536
2536
  }
2537
- function X2(e, r) {
2537
+ function J2(e, r) {
2538
2538
  Ie(
2539
2539
  () => {
2540
2540
  const t = (n) => {
@@ -2553,7 +2553,7 @@ function X2(e, r) {
2553
2553
  [e, r]
2554
2554
  );
2555
2555
  }
2556
- function J2(e) {
2556
+ function Z2(e) {
2557
2557
  const [r, t] = Pe(
2558
2558
  Kr(e == null ? void 0 : e.DINE_IN)
2559
2559
  ), [n, a] = Pe(
@@ -2861,7 +2861,7 @@ function wm(e, r = 500) {
2861
2861
  query: { ...t.query, w: r }
2862
2862
  }) : e;
2863
2863
  }
2864
- function Z2(e, r = 500) {
2864
+ function Q2(e, r = 500) {
2865
2865
  return wm(e, r);
2866
2866
  }
2867
2867
  var Ke = {}, Am = {
@@ -6995,7 +6995,7 @@ function zi(e = 0, r = 128) {
6995
6995
  const t = Qr(r), n = Cs(t, e);
6996
6996
  return { code_verifier: t, code_challenge: n };
6997
6997
  }
6998
- function Q2(e, r, t) {
6998
+ function e_(e, r, t) {
6999
6999
  return Cs(e, t) === r;
7000
7000
  }
7001
7001
  /*! Capacitor: https://capacitorjs.com/ - MIT License */
@@ -7327,7 +7327,7 @@ Ze("CapacitorHttp", {
7327
7327
  web: () => new Gy()
7328
7328
  });
7329
7329
  const sr = Ze("SecureStoragePlugin", {
7330
- web: () => import("./web-b2f1f017.mjs").then((e) => new e.SecureStoragePluginWeb())
7330
+ web: () => import("./web-15e58e49.mjs").then((e) => new e.SecureStoragePluginWeb())
7331
7331
  }), Ky = async (e) => sr.get({ key: `refresh_token_${e}` }).then((r) => r.value).catch(() => ""), Yy = async (e, r) => sr.set({
7332
7332
  key: `refresh_token_${e}`,
7333
7333
  value: r
@@ -7343,11 +7343,11 @@ const sr = Ze("SecureStoragePlugin", {
7343
7343
  setRefreshToken: Yy,
7344
7344
  clearRefreshToken: Vy
7345
7345
  }, Jy = Ze("SignInWithApple", {
7346
- web: () => import("./web-21666ddf.mjs").then((e) => new e.SignInWithAppleWeb())
7346
+ web: () => import("./web-52c5055f.mjs").then((e) => new e.SignInWithAppleWeb())
7347
7347
  }), Zy = Ze("FacebookLogin", {
7348
- web: () => import("./web-0926b890.mjs").then((e) => new e.FacebookLoginWeb())
7348
+ web: () => import("./web-339720de.mjs").then((e) => new e.FacebookLoginWeb())
7349
7349
  }), Qy = Ze("GoogleAuth", {
7350
- web: () => import("./web-5507cb70.mjs").then((e) => new e.GoogleAuthWeb())
7350
+ web: () => import("./web-8880039f.mjs").then((e) => new e.GoogleAuthWeb())
7351
7351
  });
7352
7352
  var Yi;
7353
7353
  (function(e) {
@@ -8436,10 +8436,17 @@ const A2 = {
8436
8436
  loggedIn: !1,
8437
8437
  UUID: "",
8438
8438
  resolved: !1
8439
- }, Ms = Gs, e_ = () => fr(Ms), C2 = zt, S2 = () => fr(C2), T2 = Ze("Device", {
8440
- web: () => import("./web-a526c378.mjs").then((e) => new e.DeviceWeb())
8439
+ }, Ms = Gs, r_ = () => fr(Ms), C2 = zt, S2 = () => fr(C2), T2 = Ze("Device", {
8440
+ web: () => import("./web-c1757a71.mjs").then((e) => new e.DeviceWeb())
8441
8441
  });
8442
- var Wt = {}, R2 = {
8442
+ function R2() {
8443
+ const e = Ys();
8444
+ return {
8445
+ push: (t) => e(t),
8446
+ replace: (t) => e(t, { replace: !0 })
8447
+ };
8448
+ }
8449
+ var Wt = {}, O2 = {
8443
8450
  get exports() {
8444
8451
  return Wt;
8445
8452
  },
@@ -8457,7 +8464,7 @@ var Wt = {}, R2 = {
8457
8464
  * LICENSE file in the root directory of this source tree.
8458
8465
  */
8459
8466
  var Co;
8460
- function O2() {
8467
+ function I2() {
8461
8468
  if (Co)
8462
8469
  return Or;
8463
8470
  Co = 1;
@@ -8485,7 +8492,7 @@ var Ir = {};
8485
8492
  * LICENSE file in the root directory of this source tree.
8486
8493
  */
8487
8494
  var So;
8488
- function I2() {
8495
+ function P2() {
8489
8496
  return So || (So = 1, process.env.NODE_ENV !== "production" && function() {
8490
8497
  var e = ba, r = Symbol.for("react.element"), t = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), a = Symbol.for("react.strict_mode"), i = Symbol.for("react.profiler"), s = Symbol.for("react.provider"), c = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), o = Symbol.for("react.suspense"), l = Symbol.for("react.suspense_list"), g = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), v = Symbol.for("react.offscreen"), y = Symbol.iterator, m = "@@iterator";
8491
8498
  function x(w) {
@@ -9072,33 +9079,33 @@ Check the top-level render call using <` + M + ">.");
9072
9079
  }()), Ir;
9073
9080
  }
9074
9081
  (function(e) {
9075
- process.env.NODE_ENV === "production" ? e.exports = O2() : e.exports = I2();
9076
- })(R2);
9082
+ process.env.NODE_ENV === "production" ? e.exports = I2() : e.exports = P2();
9083
+ })(O2);
9077
9084
  const Vr = Wt.jsx, To = Wt.Fragment;
9078
9085
  let Ee;
9079
9086
  T2.getInfo().then((e) => Ee = e.platform);
9080
9087
  let Ro;
9081
- var P2 = /* @__PURE__ */ ((e) => (e.UNINITIALIZED = "uninitialized", e.INITIALIZED = "index", e.EMAIL_REGISTER_VERIFY = "email-register-verify", e.EMAIL_REGISTER_FINAL = "email-register-final", e.EMAIL_SIGN_IN = "email-sign-in", e.EMAIL_REGISTER_INIT = "email-register-init", e.EMAIL_PASSWORD_RESET = "email-password-reset", e.EMAIL_PASSWORD_RESET_VERIFY = "email-password-reset-verify", e.EMAIL_PASSWORD_RESET_FINAL = "email-password-reset-final", e.MERGE_ACCOUNTS = "merge-accounts", e.MERGE_ACCOUNT = "merge-account", e.EMAIL_CONNECT_VERIFY = "email-connect-verify", e.EMAIL_CONNECT_FINAL = "email-connect-final", e.EXT_AUTH_REGISTER = "ext-auth-register", e.PKCE_SUCCESS = "success-pkce", e.SUCCESS = "success", e.ERROR = "error", e))(P2 || {});
9082
- const D2 = {
9088
+ var D2 = /* @__PURE__ */ ((e) => (e.UNINITIALIZED = "uninitialized", e.INITIALIZED = "index", e.EMAIL_REGISTER_VERIFY = "email-register-verify", e.EMAIL_REGISTER_FINAL = "email-register-final", e.EMAIL_SIGN_IN = "email-sign-in", e.EMAIL_REGISTER_INIT = "email-register-init", e.EMAIL_PASSWORD_RESET = "email-password-reset", e.EMAIL_PASSWORD_RESET_VERIFY = "email-password-reset-verify", e.EMAIL_PASSWORD_RESET_FINAL = "email-password-reset-final", e.MERGE_ACCOUNTS = "merge-accounts", e.MERGE_ACCOUNT = "merge-account", e.EMAIL_CONNECT_VERIFY = "email-connect-verify", e.EMAIL_CONNECT_FINAL = "email-connect-final", e.EXT_AUTH_REGISTER = "ext-auth-register", e.PKCE_SUCCESS = "success-pkce", e.SUCCESS = "success", e.ERROR = "error", e))(D2 || {});
9089
+ const B2 = {
9083
9090
  stage: "uninitialized"
9084
9091
  /* UNINITIALIZED */
9085
- }, Ws = ba.createContext(D2), r_ = () => fr(Ws);
9086
- function B2(e, r) {
9092
+ }, Ws = ba.createContext(B2), t_ = () => fr(Ws);
9093
+ function k2(e, r) {
9087
9094
  if (!e || e.length === 0)
9088
9095
  return !0;
9089
9096
  const t = r.map((a) => a.role);
9090
9097
  return e.filter((a) => t.includes(a)).length > 0;
9091
9098
  }
9092
- function k2(e) {
9099
+ function L2(e) {
9093
9100
  const r = Math.min(window.innerWidth, 500), t = Math.min(window.innerHeight, 700), n = Math.round((window.innerWidth - r) / 2), a = Math.round((window.innerHeight - t) / 2);
9094
9101
  window.open(e, "_blank", `popup=true,width=${r},height=${t},top=${a},left=${n}`);
9095
9102
  }
9096
- function t_({
9103
+ function n_({
9097
9104
  setShowWelcomeScreen: e,
9098
9105
  language: r,
9099
9106
  ...t
9100
9107
  }) {
9101
- const n = Xy, a = S2(), i = Ys(), s = Vs(), [c, d] = Pe(!1);
9108
+ const n = Xy, a = S2(), i = Vs(), s = R2(), [c, d] = Pe(!1);
9102
9109
  if (!a)
9103
9110
  return /* @__PURE__ */ Vr(To, {
9104
9111
  children: "Configuration context should be provided"
@@ -9191,7 +9198,7 @@ function t_({
9191
9198
  ...R
9192
9199
  }
9193
9200
  });
9194
- k2(fe);
9201
+ L2(fe);
9195
9202
  return;
9196
9203
  }
9197
9204
  break;
@@ -9392,7 +9399,7 @@ function t_({
9392
9399
  return u(), !1;
9393
9400
  ($ = t.onProcessing) == null || $.call(t, void 0, N);
9394
9401
  const U = await ma(a == null ? void 0 : a.baseUrl, I);
9395
- return t.roles && !B2(t.roles, U.roles) ? (console.log("--- USER HAS NO REQUIRED ROLES ----- "), u(), !1) : ((S = t.onSuccess) == null || S.call(t, N), y.current && (console.log("successPathRef.current", y.current), s.replace(y.current)), g({
9402
+ return t.roles && !k2(t.roles, U.roles) ? (console.log("--- USER HAS NO REQUIRED ROLES ----- "), u(), !1) : ((S = t.onSuccess) == null || S.call(t, N), y.current && (console.log("successPathRef.current", y.current), s.replace(y.current)), g({
9396
9403
  loggedIn: !0,
9397
9404
  isAnonymousUser: N,
9398
9405
  email: U.login,
@@ -9542,47 +9549,47 @@ function t_({
9542
9549
  }
9543
9550
  export {
9544
9551
  zi as A,
9545
- Q2 as B,
9552
+ e_ as B,
9546
9553
  va as C,
9547
9554
  Xy as D,
9548
9555
  Rr as E,
9549
9556
  Ro as F,
9550
- P2 as G,
9551
- r_ as H,
9552
- t_ as I,
9557
+ D2 as G,
9558
+ t_ as H,
9559
+ n_ as I,
9553
9560
  Ge as J,
9554
9561
  A2 as K,
9555
9562
  Ws as L,
9556
9563
  Ms as M,
9557
- e_ as N,
9564
+ r_ as N,
9558
9565
  C2 as O,
9559
9566
  S2 as P,
9560
9567
  Ts as W,
9561
- M2 as a,
9568
+ W2 as a,
9562
9569
  _a as b,
9563
- W2 as c,
9564
- z2 as d,
9565
- G2 as e,
9570
+ z2 as c,
9571
+ G2 as d,
9572
+ K2 as e,
9566
9573
  La as f,
9567
9574
  cs as g,
9568
- K2 as h,
9575
+ Y2 as h,
9569
9576
  Kr as i,
9570
9577
  xm as j,
9571
- Y2 as k,
9578
+ V2 as k,
9572
9579
  pm as l,
9573
- V2 as m,
9574
- X2 as n,
9575
- J2 as o,
9580
+ X2 as m,
9581
+ J2 as n,
9582
+ Z2 as o,
9576
9583
  wm as p,
9577
- Z2 as q,
9584
+ Q2 as q,
9578
9585
  Tv as r,
9579
- F2 as s,
9580
- H2 as t,
9586
+ H2 as s,
9587
+ q2 as t,
9581
9588
  Ov as u,
9582
9589
  Rv as v,
9583
- q2 as w,
9590
+ M2 as w,
9584
9591
  ky as x,
9585
9592
  Qr as y,
9586
9593
  Cs as z
9587
9594
  };
9588
- //# sourceMappingURL=index-e94bdfe1.mjs.map
9595
+ //# sourceMappingURL=index-e6041ea4.mjs.map