@ancon/wildcat-utils 1.42.7 → 1.42.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const m=require("@ancon/wildcat-types"),O=require("moment"),l=require("./getPickerIntervalsForDay.js"),S=require("./getSettingsForOrderFormat.js"),h=require("./getServiceIntervalStart.js"),D=require("./generatePickerTimesForDay.js"),T=require("./getServiceIntervalEnd.js"),_=require("./getOutletNextReadyToOrderTime.js");require("../shared/constants.js");require("./getServiceIntervalsForOrderFormat.js");require("./getNextTenthMinute.js");require("./hoursAndMinutesToMinutes.js");require("./isOutletAcceptingPreOrders.js");require("./getOutletTagInformation.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./getMomentFromDateAndTimeString.js");require("./searchNextOpeningMoment.js");require("./getOutletNextServiceTimeOffset.js");require("../time/getTimeSpanParts.js");function k(e,f,u,p){const{preparationTime:o="00:00:00"}=S(f,e==null?void 0:e.orderFormatSettings)??{},i=_(e,f);let a=i.clone();const s=O(u).utc(!0);if(s>i)a=i.clone().set({year:s.year(),month:s.month(),date:s.date()});else if(i.diff(s,"day")>0)return[];let r=[];const y=l(a,e==null?void 0:e.serviceDateTimes,f);let q;return y.forEach(t=>{!q&&t.type&&(r=[]);const c=h(a,t,o,e==null?void 0:e.timeZoneOffset),g=T(a,t,o,e==null?void 0:e.timeZoneOffset);c<i&&c.add(i.valueOf()-c.valueOf(),"millisecond");const n=D(c,g,r,void 0,p);n.length>0&&t.state===m.IntervalState.Closed?r=r.filter(d=>d.timestamp<n[0].timestamp||d.timestamp>n[n.length-1].timestamp):n.length>0&&t.state===m.IntervalState.Open&&(r=r.concat(n)),q=t.type}),r}module.exports=k;
|
|
@@ -2,10 +2,10 @@ import { IntervalState as d } from "@ancon/wildcat-types";
|
|
|
2
2
|
import D from "moment";
|
|
3
3
|
import S from "./getPickerIntervalsForDay.mjs";
|
|
4
4
|
import k from "./getSettingsForOrderFormat.mjs";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import T from "./getServiceIntervalStart.mjs";
|
|
6
|
+
import F from "./generatePickerTimesForDay.mjs";
|
|
7
|
+
import x from "./getServiceIntervalEnd.mjs";
|
|
8
|
+
import P from "./getOutletNextReadyToOrderTime.mjs";
|
|
9
9
|
import "../shared/constants.mjs";
|
|
10
10
|
import "./getServiceIntervalsForOrderFormat.mjs";
|
|
11
11
|
import "./getNextTenthMinute.mjs";
|
|
@@ -18,12 +18,12 @@ import "./getMomentFromDateAndTimeString.mjs";
|
|
|
18
18
|
import "./searchNextOpeningMoment.mjs";
|
|
19
19
|
import "./getOutletNextServiceTimeOffset.mjs";
|
|
20
20
|
import "../time/getTimeSpanParts.mjs";
|
|
21
|
-
function L(
|
|
22
|
-
const { preparationTime: f = "00:00:00" } = k(p,
|
|
23
|
-
let
|
|
21
|
+
function L(r, p, y, g) {
|
|
22
|
+
const { preparationTime: f = "00:00:00" } = k(p, r == null ? void 0 : r.orderFormatSettings) ?? {}, i = P(r, p);
|
|
23
|
+
let n = i.clone();
|
|
24
24
|
const o = D(y).utc(!0);
|
|
25
25
|
if (o > i)
|
|
26
|
-
|
|
26
|
+
n = i.clone().set({
|
|
27
27
|
year: o.year(),
|
|
28
28
|
month: o.month(),
|
|
29
29
|
date: o.date()
|
|
@@ -32,37 +32,38 @@ function L(t, p, y, g) {
|
|
|
32
32
|
return [];
|
|
33
33
|
let e = [];
|
|
34
34
|
const O = S(
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
n,
|
|
36
|
+
r == null ? void 0 : r.serviceDateTimes,
|
|
37
37
|
p
|
|
38
38
|
);
|
|
39
39
|
let s;
|
|
40
|
-
return O.forEach((
|
|
41
|
-
!s &&
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
f
|
|
46
|
-
), h = F(
|
|
47
|
-
a,
|
|
48
|
-
r,
|
|
40
|
+
return O.forEach((t) => {
|
|
41
|
+
!s && t.type && (e = []);
|
|
42
|
+
const a = T(
|
|
43
|
+
n,
|
|
44
|
+
t,
|
|
49
45
|
f,
|
|
50
|
-
|
|
46
|
+
r == null ? void 0 : r.timeZoneOffset
|
|
47
|
+
), h = x(
|
|
48
|
+
n,
|
|
49
|
+
t,
|
|
50
|
+
f,
|
|
51
|
+
r == null ? void 0 : r.timeZoneOffset
|
|
51
52
|
);
|
|
52
|
-
|
|
53
|
-
i.valueOf() -
|
|
53
|
+
a < i && a.add(
|
|
54
|
+
i.valueOf() - a.valueOf(),
|
|
54
55
|
"millisecond"
|
|
55
56
|
);
|
|
56
|
-
const m =
|
|
57
|
-
|
|
57
|
+
const m = F(
|
|
58
|
+
a,
|
|
58
59
|
h,
|
|
59
60
|
e,
|
|
60
61
|
void 0,
|
|
61
62
|
g
|
|
62
63
|
);
|
|
63
|
-
m.length > 0 &&
|
|
64
|
+
m.length > 0 && t.state === d.Closed ? e = e.filter(
|
|
64
65
|
(c) => c.timestamp < m[0].timestamp || c.timestamp > m[m.length - 1].timestamp
|
|
65
|
-
) : m.length > 0 &&
|
|
66
|
+
) : m.length > 0 && t.state === d.Open && (e = e.concat(m)), s = t.type;
|
|
66
67
|
}), e;
|
|
67
68
|
}
|
|
68
69
|
export {
|