@orderingstack/front-hooks 5.0.0 → 5.0.2
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.cjs.js +2 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +22 -20
- package/dist/index.es.js.map +1 -1
- package/dist/types/useChannelAvailability.d.ts +2 -2
- package/dist/types/useChannelAvailability.d.ts.map +1 -1
- package/dist/types/useDisplayPrice.d.ts +3 -2
- package/dist/types/useDisplayPrice.d.ts.map +1 -1
- package/dist/types/utils/timeAvailabilityFilter.d.ts +1 -1
- package/dist/types/utils/timeAvailabilityFilter.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1434,22 +1434,22 @@ function sp(e, r) {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
return !0;
|
|
1436
1436
|
}
|
|
1437
|
-
const De = (e, r, t =
|
|
1437
|
+
const De = (e, r, t = !1, n = 0) => {
|
|
1438
1438
|
var f, b;
|
|
1439
1439
|
if (!e)
|
|
1440
1440
|
return 0;
|
|
1441
1441
|
const a = e.price ? parseFloat(e.price) : 0, i = (f = e._) != null && f.basePrice ? parseFloat((b = e._) == null ? void 0 : b.basePrice) : a;
|
|
1442
|
-
let s =
|
|
1442
|
+
let s = t ? i : a;
|
|
1443
1443
|
if (!(r != null && r.selected) || jr(r.selected))
|
|
1444
1444
|
return s;
|
|
1445
1445
|
const { items: o } = e, l = ip(r);
|
|
1446
1446
|
return sp(e, l) && Array.isArray(o) && o.forEach(($) => {
|
|
1447
1447
|
let p = 0;
|
|
1448
1448
|
if ($.kind !== "3e/product")
|
|
1449
|
-
p = De($, l, t + 1
|
|
1449
|
+
p = De($, l, t, n + 1);
|
|
1450
1450
|
else {
|
|
1451
1451
|
const { selected: y = {} } = l, { selCtx: E, id: v } = $;
|
|
1452
|
-
E in y && v in y[E] && (p = De($, l, t + 1
|
|
1452
|
+
E in y && v in y[E] && (p = De($, l, t, n + 1) * Number(y[E][v]), delete l.selected[E][v]);
|
|
1453
1453
|
}
|
|
1454
1454
|
s += p;
|
|
1455
1455
|
}), Math.round(100 * s) / 100;
|
|
@@ -1457,14 +1457,16 @@ const De = (e, r, t = 0, n = !1) => {
|
|
|
1457
1457
|
product: e,
|
|
1458
1458
|
state: r,
|
|
1459
1459
|
selected: t,
|
|
1460
|
-
cheapestGroupOptionsProduct: n
|
|
1460
|
+
cheapestGroupOptionsProduct: n,
|
|
1461
|
+
basePrice: a
|
|
1461
1462
|
}) => {
|
|
1462
|
-
const
|
|
1463
|
+
const i = De(e, r, a), s = De(
|
|
1463
1464
|
e,
|
|
1464
|
-
e.state
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1465
|
+
e.state,
|
|
1466
|
+
a
|
|
1467
|
+
), o = e.minPrice && Number(e.price) === i;
|
|
1468
|
+
let l = t || n || Number(e.price) === 0 ? i || s : Number(e.price);
|
|
1469
|
+
return n !== void 0 && (l -= n), o && e.minPrice && (l = Number(e.minPrice)), { displayPrice: l, showAsMinPrice: o, calculatedPriceDefaultProductState: s };
|
|
1468
1470
|
}, Yv = op;
|
|
1469
1471
|
function Bn(e) {
|
|
1470
1472
|
const r = [];
|
|
@@ -2552,19 +2554,19 @@ function zv(e, r) {
|
|
|
2552
2554
|
[e, r]
|
|
2553
2555
|
);
|
|
2554
2556
|
}
|
|
2555
|
-
function Zv(e
|
|
2556
|
-
const [
|
|
2557
|
-
Ae(e == null ? void 0 : e.DINE_IN
|
|
2558
|
-
), [
|
|
2559
|
-
Ae(e == null ? void 0 : e.TAKE_AWAY
|
|
2557
|
+
function Zv(e) {
|
|
2558
|
+
const [r, t] = X(
|
|
2559
|
+
Ae(e == null ? void 0 : e.DINE_IN)
|
|
2560
|
+
), [n, a] = X(
|
|
2561
|
+
Ae(e == null ? void 0 : e.TAKE_AWAY)
|
|
2560
2562
|
);
|
|
2561
|
-
function
|
|
2562
|
-
const
|
|
2563
|
-
|
|
2563
|
+
function i() {
|
|
2564
|
+
const s = Ae(e == null ? void 0 : e.DINE_IN), o = Ae(e == null ? void 0 : e.TAKE_AWAY);
|
|
2565
|
+
s !== r && (console.log("dine in open changed", r, "=>", s), t(s)), o !== n && (console.log("take away open changed", n, "=>", o), a(o));
|
|
2564
2566
|
}
|
|
2565
2567
|
return ie(() => {
|
|
2566
|
-
|
|
2567
|
-
}, [e]), wr(
|
|
2568
|
+
i();
|
|
2569
|
+
}, [e]), wr(i, 6e4), { dineInOpen: r, takeAwayOpen: n, loaded: !!e };
|
|
2568
2570
|
}
|
|
2569
2571
|
var Er = {}, Iv = (e) => encodeURIComponent(e).replace(/[!'()*]/g, (r) => `%${r.charCodeAt(0).toString(16).toUpperCase()}`), ra = "%[a-f0-9]{2}", un = new RegExp("(" + ra + ")|([^%]+?)", "gi"), fn = new RegExp("(" + ra + ")+", "gi");
|
|
2570
2572
|
function Tr(e, r) {
|