@ancon/wildcat-utils 1.44.0-r13-2-tz.11 → 1.44.0-r13-2-tz.13
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 q=require("@ancon/wildcat-types"),r=require("moment"),u=require("./getSettingsForOrderFormat.js"),T=require("./isOutletAcceptingPreOrders.js"),v=require("./getOutletTagInformation.js"),x=require("./getNextTenthMinute.js"),_=require("./getServiceIntervalsForOrderFormat.js"),I=require("./getOutletNextServiceTimeOffset.js");require("../date/createLocalTimezoneMoment.js");require("../time/getTimeSpanParts.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./getServiceIntervalTimeSpanMoment.js");require("./searchNextOpeningMoment.js");function S(e,i){const s=(e==null?void 0:e.state)===q.OutletState.Opened,t=u(i,e==null?void 0:e.orderFormatSettings),
|
|
1
|
+
"use strict";const q=require("@ancon/wildcat-types"),r=require("moment"),u=require("./getSettingsForOrderFormat.js"),T=require("./isOutletAcceptingPreOrders.js"),v=require("./getOutletTagInformation.js"),x=require("./getNextTenthMinute.js"),_=require("./getServiceIntervalsForOrderFormat.js"),I=require("./getOutletNextServiceTimeOffset.js");require("../date/createLocalTimezoneMoment.js");require("../time/getTimeSpanParts.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./getServiceIntervalTimeSpanMoment.js");require("./searchNextOpeningMoment.js");function S(e,i){const s=(e==null?void 0:e.state)===q.OutletState.Opened,t=u(i,e==null?void 0:e.orderFormatSettings),m=(t==null?void 0:t.preparationTime)??"00:00:00",O=T((e==null?void 0:e.orderFormatSettings)||[]),f=_(i,(e==null?void 0:e.serviceDateTimes)||[]),c=v.default(f,s,r(),r()),p=!s&&O&&c.openingTime?c.openingTime:void 0,o=r(),a=r(p),n=(o>a?o:a).second(0).millisecond(0),d=I(i,m,e==null?void 0:e.deliveryIntegrationEnabled);d>0&&n.add(d,"minute");const g=x(n)-n.minutes();return g&&n.add(g,"minutes"),n}module.exports=S;
|
|
@@ -12,28 +12,28 @@ import "./constants.mjs";
|
|
|
12
12
|
import "./getOutletCurrentActiveOperatingHour.mjs";
|
|
13
13
|
import "./getServiceIntervalTimeSpanMoment.mjs";
|
|
14
14
|
import "./searchNextOpeningMoment.mjs";
|
|
15
|
-
function z(
|
|
16
|
-
const
|
|
15
|
+
function z(n, r) {
|
|
16
|
+
const m = (n == null ? void 0 : n.state) === T.Opened, t = v(
|
|
17
17
|
r,
|
|
18
|
-
|
|
19
|
-
),
|
|
20
|
-
(
|
|
21
|
-
),
|
|
18
|
+
n == null ? void 0 : n.orderFormatSettings
|
|
19
|
+
), f = (t == null ? void 0 : t.preparationTime) ?? "00:00:00", d = x(
|
|
20
|
+
(n == null ? void 0 : n.orderFormatSettings) || []
|
|
21
|
+
), g = y(
|
|
22
22
|
r,
|
|
23
|
-
(
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
(n == null ? void 0 : n.serviceDateTimes) || []
|
|
24
|
+
), s = I(
|
|
25
|
+
g,
|
|
26
|
+
m,
|
|
27
27
|
i(),
|
|
28
28
|
i()
|
|
29
|
-
), O = !
|
|
29
|
+
), O = !m && d && s.openingTime ? s.openingTime : void 0, o = i(), p = i(O), e = (o > p ? o : p).second(0).millisecond(0), a = F(
|
|
30
30
|
r,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
f,
|
|
32
|
+
n == null ? void 0 : n.deliveryIntegrationEnabled
|
|
33
33
|
);
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
return
|
|
34
|
+
a > 0 && e.add(a, "minute");
|
|
35
|
+
const c = S(e) - e.minutes();
|
|
36
|
+
return c && e.add(c, "minutes"), e;
|
|
37
37
|
}
|
|
38
38
|
export {
|
|
39
39
|
z as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const p=require("@ancon/wildcat-types"),u=require("moment"),y=require("../date/isDSTShiftPresent.js"),h=require("./getPickerIntervalsForDay.js"),D=require("./getSettingsForOrderFormat.js"),P=require("./getServiceIntervalStart.js"),S=require("./types.js"),_=require("./generatePickerTimesForDay.js"),v=require("./getServiceIntervalEnd.js"),x=require("./getOutletNextReadyToOrderTime.js");require("../date/getTimezoneUtcOffsetDifference.js");require("../shared/constants.js");require("../date/createLocalTimezoneMoment.js");require("./getServiceIntervalsForOrderFormat.js");require("../time/getTimeSpanParts.js");require("./getNextTenthMinute.js");require("./getServiceIntervalTimeSpanMoment.js");require("./hoursAndMinutesToMinutes.js");require("./isOutletAcceptingPreOrders.js");require("./getOutletTagInformation.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./searchNextOpeningMoment.js");require("./getOutletNextServiceTimeOffset.js");function z(i,f,g,k){const{preparationTime:d="00:00:00"}=D(f,i==null?void 0:i.orderFormatSettings)??{},s=x(i,f);console.log("nextReadyOrderTime",s.format());let o=s.clone();const c=u(g);if(c>s)o=s.clone().set({year:c.year(),month:c.month(),date:c.date()});else if(s.diff(c,"day")>0)return[];let e=[];const O=h(o,i==null?void 0:i.serviceDateTimes,f);let l;if(O.forEach(t=>{!l&&t.type&&(e=[]);const r=P(o,t,d),T=v(o,t,d);r<s&&r.add(s.valueOf()-r.valueOf(),"millisecond");const n=_(r,T,e,void 0,k);if(n.length>0)switch(t.state){case p.IntervalState.Closed:{const a=n[0],q=n[n.length-1];e=e.filter(({timestamp:m})=>m<a.timestamp||m>q.timestamp);break}case p.IntervalState.Opened:default:{const a=n;y(r,T),e=e.concat(a);break}}l=t.type}),e.length){const t=e[0],r=e[e.length-1];if(y(t.timestamp,r.timestamp)){const n=Math.max(u(t.timestamp).utcOffset(),u(r.timestamp).utcOffset());return e.map(a=>{const m=u(a.timestamp).utcOffset()===n?S.PickerTimeTimezoneTag.Summer:S.PickerTimeTimezoneTag.Standard;return{...a,timezoneTag:m}})}}return e}module.exports=z;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IntervalState as g } from "@ancon/wildcat-types";
|
|
2
|
-
import
|
|
2
|
+
import c from "moment";
|
|
3
3
|
import y from "../date/isDSTShiftPresent.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import P from "./getPickerIntervalsForDay.mjs";
|
|
5
|
+
import u from "./getSettingsForOrderFormat.mjs";
|
|
6
|
+
import v from "./getServiceIntervalStart.mjs";
|
|
7
7
|
import { PickerTimeTimezoneTag as O } from "./types.mjs";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
8
|
+
import x from "./generatePickerTimesForDay.mjs";
|
|
9
|
+
import F from "./getServiceIntervalEnd.mjs";
|
|
10
|
+
import z from "./getOutletNextReadyToOrderTime.mjs";
|
|
11
11
|
import "../date/getTimezoneUtcOffsetDifference.mjs";
|
|
12
12
|
import "../shared/constants.mjs";
|
|
13
13
|
import "../date/createLocalTimezoneMoment.mjs";
|
|
@@ -22,89 +22,86 @@ import "./constants.mjs";
|
|
|
22
22
|
import "./getOutletCurrentActiveOperatingHour.mjs";
|
|
23
23
|
import "./searchNextOpeningMoment.mjs";
|
|
24
24
|
import "./getOutletNextServiceTimeOffset.mjs";
|
|
25
|
-
function
|
|
26
|
-
const { preparationTime:
|
|
27
|
-
console.log("nextReadyOrderTime",
|
|
28
|
-
let
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
year:
|
|
33
|
-
month:
|
|
34
|
-
date:
|
|
25
|
+
function _(r, p, h, k) {
|
|
26
|
+
const { preparationTime: T = "00:00:00" } = u(p, r == null ? void 0 : r.orderFormatSettings) ?? {}, m = z(r, p);
|
|
27
|
+
console.log("nextReadyOrderTime", m.format());
|
|
28
|
+
let s = m.clone();
|
|
29
|
+
const n = c(h);
|
|
30
|
+
if (n > m)
|
|
31
|
+
s = m.clone().set({
|
|
32
|
+
year: n.year(),
|
|
33
|
+
month: n.month(),
|
|
34
|
+
date: n.date()
|
|
35
35
|
});
|
|
36
|
-
else if (
|
|
36
|
+
else if (m.diff(n, "day") > 0)
|
|
37
37
|
return [];
|
|
38
38
|
let t = [];
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const D = P(
|
|
40
|
+
s,
|
|
41
|
+
r == null ? void 0 : r.serviceDateTimes,
|
|
42
42
|
p
|
|
43
43
|
);
|
|
44
|
-
let
|
|
45
|
-
if (
|
|
46
|
-
!
|
|
47
|
-
const
|
|
48
|
-
|
|
44
|
+
let l;
|
|
45
|
+
if (D.forEach((e) => {
|
|
46
|
+
!l && e.type && (t = []);
|
|
47
|
+
const i = v(
|
|
48
|
+
s,
|
|
49
49
|
e,
|
|
50
|
-
|
|
51
|
-
),
|
|
52
|
-
|
|
50
|
+
T
|
|
51
|
+
), d = F(
|
|
52
|
+
s,
|
|
53
53
|
e,
|
|
54
|
-
|
|
54
|
+
T
|
|
55
55
|
);
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
i < m && i.add(
|
|
57
|
+
m.valueOf() - i.valueOf(),
|
|
58
58
|
"millisecond"
|
|
59
59
|
);
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const o = x(
|
|
61
|
+
i,
|
|
62
|
+
d,
|
|
63
63
|
t,
|
|
64
64
|
void 0,
|
|
65
65
|
k
|
|
66
66
|
);
|
|
67
|
-
if (
|
|
67
|
+
if (o.length > 0)
|
|
68
68
|
switch (e.state) {
|
|
69
69
|
case g.Closed: {
|
|
70
|
-
const
|
|
70
|
+
const a = o[0], S = o[o.length - 1];
|
|
71
71
|
t = t.filter(
|
|
72
|
-
({ timestamp:
|
|
72
|
+
({ timestamp: f }) => f < a.timestamp || f > S.timestamp
|
|
73
73
|
);
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
case g.Opened:
|
|
77
77
|
default: {
|
|
78
|
-
|
|
78
|
+
const a = o;
|
|
79
79
|
y(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
)
|
|
83
|
-
const D = f(s.timestamp).utc(!0), P = i.clone().utc(!0);
|
|
84
|
-
return D.isSameOrAfter(P);
|
|
85
|
-
})), t = t.concat(n);
|
|
80
|
+
i,
|
|
81
|
+
d
|
|
82
|
+
), t = t.concat(a);
|
|
86
83
|
break;
|
|
87
84
|
}
|
|
88
85
|
}
|
|
89
|
-
|
|
86
|
+
l = e.type;
|
|
90
87
|
}), t.length) {
|
|
91
|
-
const e = t[0],
|
|
88
|
+
const e = t[0], i = t[t.length - 1];
|
|
92
89
|
if (y(
|
|
93
90
|
e.timestamp,
|
|
94
|
-
|
|
91
|
+
i.timestamp
|
|
95
92
|
)) {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
const o = Math.max(
|
|
94
|
+
c(e.timestamp).utcOffset(),
|
|
95
|
+
c(i.timestamp).utcOffset()
|
|
99
96
|
);
|
|
100
|
-
return t.map((
|
|
101
|
-
const
|
|
102
|
-
return { ...
|
|
97
|
+
return t.map((a) => {
|
|
98
|
+
const f = c(a.timestamp).utcOffset() === o ? O.Summer : O.Standard;
|
|
99
|
+
return { ...a, timezoneTag: f };
|
|
103
100
|
});
|
|
104
101
|
}
|
|
105
102
|
}
|
|
106
103
|
return t;
|
|
107
104
|
}
|
|
108
105
|
export {
|
|
109
|
-
|
|
106
|
+
_ as default
|
|
110
107
|
};
|