@ancon/wildcat-utils 1.44.0-r13-2-tz.50 → 1.44.0-r13-2-tz.52
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/outlet/getOutletPickerTimesForDay.js +1 -1
- package/outlet/getOutletPickerTimesForDay.mjs +59 -54
- package/outlet/getOutletPickerTimesForWeek.js +1 -1
- package/outlet/getOutletPickerTimesForWeek.mjs +12 -11
- package/outlet/searchNextOpeningMoment.js +1 -1
- package/outlet/searchNextOpeningMoment.mjs +32 -36
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const S=require("@ancon/wildcat-types"),m=require("moment"),y=require("../date/isDSTShiftPresentInRange.js"),D=require("./getPickerIntervalsForDay.js"),P=require("./getSettingsForOrderFormat.js"),x=require("./getServiceIntervalStart.js"),h=require("./types.js"),R=require("./generatePickerTimesForDay.js"),_=require("./getServiceIntervalEnd.js"),I=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("./getTimezoneAdjustedServiceInterval.js");require("../date/convertToSpecificTimezone.js");require("./searchNextOpeningMoment.js");require("./getOutletNextServiceTimeOffset.js");function M(n,d,O,k){const{preparationTime:T="00:00:00"}=P(d,n==null?void 0:n.orderFormatSettings)??{},s=I(n,d);console.log("nextReadyOrderTime",s.format());let l=s.clone();const o=m(O);if(console.log("specificDateMoment",o.format()),o>s)l=s.clone().set({year:o.year(),month:o.month(),date:o.date()}),console.log("specificDateMoment > nextReadyOrderTime",l.format());else{const t=s.diff(o,"day");if(console.log("ELSE specificDateMoment > nextReadyOrderTime",t),t>0)return[]}let e=[];const v=D(l,n==null?void 0:n.serviceDateTimes,d);let g;if(v.forEach(t=>{!g&&t.type&&(e=[]);const r=x(l,t,T),u=_(l,t,T);console.log("intervalStartTime, intervalEndTime",r.format(),u.format()),r<s&&(console.log("Add the time that has already passed today"),r.add(s.valueOf()-r.valueOf(),"millisecond"));const i=R(r,u,e,void 0,k);if(i.length>0)switch(t.state){case S.IntervalState.Closed:{const a=i[0],f=i[i.length-1];e=e.filter(({timestamp:c})=>c<a.timestamp||c>f.timestamp);break}case S.IntervalState.Opened:default:{let a=i;const f=y(r,u);console.log("isDSTShiftInterval",f),f&&(a=i.filter(c=>{const p=m(c.timestamp).utc(!0),q=m(i[0].timestamp).utc(!0);return console.log("=>",p.format(),q.format()),p.isSameOrAfter(q)})),e=e.concat(a);break}}g=t.type}),e.length){const t=e[0],r=e[e.length-1];if(y(t.timestamp,r.timestamp)){const i=Math.max(m(t.timestamp).utcOffset(),m(r.timestamp).utcOffset());return e.map(a=>{const c=m(a.timestamp).utcOffset()===i?h.PickerTimeTimezoneTag.Summer:h.PickerTimeTimezoneTag.Standard;return{...a,timezoneTag:c}})}}return e}module.exports=M;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { IntervalState as
|
|
2
|
-
import
|
|
1
|
+
import { IntervalState as h } from "@ancon/wildcat-types";
|
|
2
|
+
import c from "moment";
|
|
3
3
|
import O from "../date/isDSTShiftPresentInRange.mjs";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import x from "./getPickerIntervalsForDay.mjs";
|
|
5
|
+
import P from "./getSettingsForOrderFormat.mjs";
|
|
6
|
+
import R from "./getServiceIntervalStart.mjs";
|
|
7
7
|
import { PickerTimeTimezoneTag as k } from "./types.mjs";
|
|
8
|
-
import
|
|
8
|
+
import M from "./generatePickerTimesForDay.mjs";
|
|
9
9
|
import E from "./getServiceIntervalEnd.mjs";
|
|
10
|
-
import
|
|
10
|
+
import I from "./getOutletNextReadyToOrderTime.mjs";
|
|
11
11
|
import "../date/getTimezoneUtcOffsetDifference.mjs";
|
|
12
12
|
import "../shared/constants.mjs";
|
|
13
13
|
import "../date/createLocalTimezoneMoment.mjs";
|
|
@@ -24,35 +24,38 @@ import "./getTimezoneAdjustedServiceInterval.mjs";
|
|
|
24
24
|
import "../date/convertToSpecificTimezone.mjs";
|
|
25
25
|
import "./searchNextOpeningMoment.mjs";
|
|
26
26
|
import "./getOutletNextServiceTimeOffset.mjs";
|
|
27
|
-
function
|
|
28
|
-
const { preparationTime: T = "00:00:00" } =
|
|
27
|
+
function ie(m, d, u, v) {
|
|
28
|
+
const { preparationTime: T = "00:00:00" } = P(d, m == null ? void 0 : m.orderFormatSettings) ?? {}, o = I(m, d);
|
|
29
29
|
console.log("nextReadyOrderTime", o.format());
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
|
|
34
|
-
year:
|
|
35
|
-
month:
|
|
36
|
-
date:
|
|
37
|
-
});
|
|
38
|
-
else
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
30
|
+
let f = o.clone();
|
|
31
|
+
const a = c(u);
|
|
32
|
+
if (console.log("specificDateMoment", a.format()), a > o)
|
|
33
|
+
f = o.clone().set({
|
|
34
|
+
year: a.year(),
|
|
35
|
+
month: a.month(),
|
|
36
|
+
date: a.date()
|
|
37
|
+
}), console.log("specificDateMoment > nextReadyOrderTime", f.format());
|
|
38
|
+
else {
|
|
39
|
+
const t = o.diff(a, "day");
|
|
40
|
+
if (console.log("ELSE specificDateMoment > nextReadyOrderTime", t), t > 0)
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
let e = [];
|
|
44
|
+
const D = x(
|
|
45
|
+
f,
|
|
43
46
|
m == null ? void 0 : m.serviceDateTimes,
|
|
44
47
|
d
|
|
45
48
|
);
|
|
46
49
|
let g;
|
|
47
|
-
if (D.forEach((
|
|
48
|
-
!g &&
|
|
49
|
-
const i =
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
if (D.forEach((t) => {
|
|
51
|
+
!g && t.type && (e = []);
|
|
52
|
+
const i = R(
|
|
53
|
+
f,
|
|
54
|
+
t,
|
|
52
55
|
T
|
|
53
56
|
), l = E(
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
f,
|
|
58
|
+
t,
|
|
56
59
|
T
|
|
57
60
|
);
|
|
58
61
|
console.log(
|
|
@@ -63,59 +66,61 @@ function it(m, d, u, v) {
|
|
|
63
66
|
o.valueOf() - i.valueOf(),
|
|
64
67
|
"millisecond"
|
|
65
68
|
));
|
|
66
|
-
const r =
|
|
69
|
+
const r = M(
|
|
67
70
|
i,
|
|
68
71
|
l,
|
|
69
|
-
|
|
72
|
+
e,
|
|
70
73
|
void 0,
|
|
71
74
|
v
|
|
72
75
|
);
|
|
73
76
|
if (r.length > 0)
|
|
74
|
-
switch (
|
|
75
|
-
case
|
|
76
|
-
const n = r[0],
|
|
77
|
-
|
|
78
|
-
({ timestamp:
|
|
77
|
+
switch (t.state) {
|
|
78
|
+
case h.Closed: {
|
|
79
|
+
const n = r[0], p = r[r.length - 1];
|
|
80
|
+
e = e.filter(
|
|
81
|
+
({ timestamp: s }) => s < n.timestamp || s > p.timestamp
|
|
79
82
|
);
|
|
80
83
|
break;
|
|
81
84
|
}
|
|
82
|
-
case
|
|
85
|
+
case h.Opened:
|
|
83
86
|
default: {
|
|
84
87
|
let n = r;
|
|
85
|
-
const
|
|
88
|
+
const p = O(
|
|
86
89
|
i,
|
|
87
90
|
l
|
|
88
91
|
);
|
|
89
|
-
console.log("isDSTShiftInterval",
|
|
90
|
-
const S =
|
|
92
|
+
console.log("isDSTShiftInterval", p), p && (n = r.filter((s) => {
|
|
93
|
+
const S = c(s.timestamp).utc(!0), y = c(
|
|
94
|
+
r[0].timestamp
|
|
95
|
+
).utc(!0);
|
|
91
96
|
return console.log(
|
|
92
97
|
"=>",
|
|
93
98
|
S.format(),
|
|
94
|
-
|
|
95
|
-
), S.isSameOrAfter(
|
|
96
|
-
})),
|
|
99
|
+
y.format()
|
|
100
|
+
), S.isSameOrAfter(y);
|
|
101
|
+
})), e = e.concat(n);
|
|
97
102
|
break;
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
|
-
g =
|
|
101
|
-
}),
|
|
102
|
-
const
|
|
105
|
+
g = t.type;
|
|
106
|
+
}), e.length) {
|
|
107
|
+
const t = e[0], i = e[e.length - 1];
|
|
103
108
|
if (O(
|
|
104
|
-
|
|
109
|
+
t.timestamp,
|
|
105
110
|
i.timestamp
|
|
106
111
|
)) {
|
|
107
112
|
const r = Math.max(
|
|
108
|
-
|
|
109
|
-
|
|
113
|
+
c(t.timestamp).utcOffset(),
|
|
114
|
+
c(i.timestamp).utcOffset()
|
|
110
115
|
);
|
|
111
|
-
return
|
|
112
|
-
const
|
|
113
|
-
return { ...n, timezoneTag:
|
|
116
|
+
return e.map((n) => {
|
|
117
|
+
const s = c(n.timestamp).utcOffset() === r ? k.Summer : k.Standard;
|
|
118
|
+
return { ...n, timezoneTag: s };
|
|
114
119
|
});
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
|
-
return
|
|
122
|
+
return e;
|
|
118
123
|
}
|
|
119
124
|
export {
|
|
120
|
-
|
|
125
|
+
ie as default
|
|
121
126
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const l=require("./getOutletNextReadyToOrderTime.js"),k=require("./getOutletPickerTimesForDay.js");require("@ancon/wildcat-types");require("moment");require("../date/getTimezoneUtcOffsetDifference.js");require("./getSettingsForOrderFormat.js");require("./isOutletAcceptingPreOrders.js");require("./getOutletTagInformation.js");require("../date/createLocalTimezoneMoment.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./getTimezoneAdjustedServiceInterval.js");require("../time/getTimeSpanParts.js");require("../date/convertToSpecificTimezone.js");require("./getServiceIntervalTimeSpanMoment.js");require("./searchNextOpeningMoment.js");require("./getNextTenthMinute.js");require("./getServiceIntervalsForOrderFormat.js");require("./getOutletNextServiceTimeOffset.js");require("../date/isDSTShiftPresentInRange.js");require("./getPickerIntervalsForDay.js");require("../shared/constants.js");require("./getServiceIntervalStart.js");require("./types.js");require("./generatePickerTimesForDay.js");require("./getServiceIntervalEnd.js");require("./hoursAndMinutesToMinutes.js");function g(r,i,o){const c=l(r,i),u=[],t=c.clone();for(let e=0;e<7;e+=1)u.push(t.clone()),t.add(1,"day");const q=u.reduce((e,s)=>{const n=k(r,i,s,o);return e.push(n),e},[]);return console.log("getOutletPickerTimesForWeek"),console.log(q),q.filter(e=>e.length>0)}module.exports=g;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import l from "./getOutletNextReadyToOrderTime.mjs";
|
|
2
2
|
import u from "./getOutletPickerTimesForDay.mjs";
|
|
3
3
|
import "@ancon/wildcat-types";
|
|
4
4
|
import "moment";
|
|
@@ -25,19 +25,20 @@ import "./types.mjs";
|
|
|
25
25
|
import "./generatePickerTimesForDay.mjs";
|
|
26
26
|
import "./getServiceIntervalEnd.mjs";
|
|
27
27
|
import "./hoursAndMinutesToMinutes.mjs";
|
|
28
|
-
function H(
|
|
29
|
-
const
|
|
28
|
+
function H(o, r, p) {
|
|
29
|
+
const c = l(o, r), i = [], e = c.clone();
|
|
30
30
|
for (let t = 0; t < 7; t += 1)
|
|
31
|
-
i.push(
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
r,
|
|
31
|
+
i.push(e.clone()), e.add(1, "day");
|
|
32
|
+
const m = i.reduce((t, n) => {
|
|
33
|
+
const s = u(
|
|
35
34
|
o,
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
r,
|
|
36
|
+
n,
|
|
37
|
+
p
|
|
38
38
|
);
|
|
39
|
-
return t.push(
|
|
40
|
-
}, [])
|
|
39
|
+
return t.push(s), t;
|
|
40
|
+
}, []);
|
|
41
|
+
return console.log("getOutletPickerTimesForWeek"), console.log(m), m.filter((t) => t.length > 0);
|
|
41
42
|
}
|
|
42
43
|
export {
|
|
43
44
|
H as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const m=require("moment"),
|
|
1
|
+
"use strict";const m=require("moment"),p=require("@ancon/wildcat-types"),d=require("../time/getTimeSpanParts.js"),f=require("./constants.js"),c=require("./getTimezoneAdjustedServiceInterval.js");require("../date/getTimezoneUtcOffsetDifference.js");require("../date/convertToSpecificTimezone.js");require("./getServiceIntervalTimeSpanMoment.js");function O(u){let e=null;const{intervals:t,exception:n}=u;if(n){const{state:s}=n;s||(e=n)}else{const s=t.sort((i,o)=>d(i.from).hours-d(o.from).hours),[r]=s;return r}return e}function g(u,e,t){var s,r;const n=[];if(e.exception){if(e.exception.state===p.IntervalState.Opened){const o=c(u,e.exception,t.utcOffset()).openingTime;t.isBefore(o)&&n.push({interval:e.exception,moment:o})}}else for(let i=0;i<e.intervals.length;i+=1){const o=e.intervals[i],l=c(u,o,t.utcOffset()).openingTime;console.log("relevantMoment",t.format()),console.log("openingMoment",l.format()),t.isBefore(l)&&n.push({interval:o,moment:l})}return n.length<2?((s=n[0])==null?void 0:s.interval)??null:((r=n.sort((i,o)=>i.moment-t-(o.moment-t))[0])==null?void 0:r.interval)??null}function v(u,e){let t=null;const n=m(e).format(f.OutletMapKeyFormatter),s=g(n,u[n],e);if(s&&(t=c(n,s,e.utcOffset()).openingTime),!t)for(let r=1;r<f.OutletTimelineDayCount;r+=1){const i=m(e).add(r,"d"),o=i.format(f.OutletMapKeyFormatter),a=u[o],l=O(a);if(l){t=c(o,l,i.utcOffset()).openingTime;break}}return t}module.exports=v;
|
|
@@ -1,74 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IntervalState as
|
|
3
|
-
import
|
|
4
|
-
import { OutletMapKeyFormatter as
|
|
1
|
+
import c from "moment";
|
|
2
|
+
import { IntervalState as p } from "@ancon/wildcat-types";
|
|
3
|
+
import a from "../time/getTimeSpanParts.mjs";
|
|
4
|
+
import { OutletMapKeyFormatter as d, OutletTimelineDayCount as g } from "./constants.mjs";
|
|
5
5
|
import m from "./getTimezoneAdjustedServiceInterval.mjs";
|
|
6
6
|
import "../date/getTimezoneUtcOffsetDifference.mjs";
|
|
7
7
|
import "../date/convertToSpecificTimezone.mjs";
|
|
8
8
|
import "./getServiceIntervalTimeSpanMoment.mjs";
|
|
9
9
|
function O(l) {
|
|
10
|
-
let
|
|
11
|
-
const { intervals:
|
|
10
|
+
let t = null;
|
|
11
|
+
const { intervals: e, exception: n } = l;
|
|
12
12
|
if (n) {
|
|
13
13
|
const { state: r } = n;
|
|
14
|
-
r || (
|
|
14
|
+
r || (t = n);
|
|
15
15
|
} else {
|
|
16
|
-
const r =
|
|
17
|
-
(i, o) =>
|
|
16
|
+
const r = e.sort(
|
|
17
|
+
(i, o) => a(i.from).hours - a(o.from).hours
|
|
18
18
|
), [s] = r;
|
|
19
19
|
return s;
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return t;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function v(l, t, e) {
|
|
24
24
|
var r, s;
|
|
25
25
|
const n = [];
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
26
|
+
if (t.exception) {
|
|
27
|
+
if (t.exception.state === p.Opened) {
|
|
28
28
|
const o = m(
|
|
29
29
|
l,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
t.exception,
|
|
31
|
+
e.utcOffset()
|
|
32
32
|
).openingTime;
|
|
33
|
-
|
|
34
|
-
interval:
|
|
33
|
+
e.isBefore(o) && n.push({
|
|
34
|
+
interval: t.exception,
|
|
35
35
|
moment: o
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
} else
|
|
39
|
-
for (let i = 0; i <
|
|
40
|
-
const o =
|
|
39
|
+
for (let i = 0; i < t.intervals.length; i += 1) {
|
|
40
|
+
const o = t.intervals[i], f = m(
|
|
41
41
|
l,
|
|
42
42
|
o,
|
|
43
|
-
|
|
43
|
+
e.utcOffset()
|
|
44
44
|
).openingTime;
|
|
45
|
-
console.log("relevantMoment",
|
|
45
|
+
console.log("relevantMoment", e.format()), console.log("openingMoment", f.format()), e.isBefore(f) && n.push({ interval: o, moment: f });
|
|
46
46
|
}
|
|
47
47
|
return n.length < 2 ? ((r = n[0]) == null ? void 0 : r.interval) ?? null : ((s = n.sort(
|
|
48
48
|
// @ts-ignore TODO
|
|
49
|
-
(i, o) => i.moment -
|
|
49
|
+
(i, o) => i.moment - e - (o.moment - e)
|
|
50
50
|
)[0]) == null ? void 0 : s.interval) ?? null;
|
|
51
51
|
}
|
|
52
|
-
function K(l,
|
|
53
|
-
let
|
|
54
|
-
const n =
|
|
52
|
+
function K(l, t) {
|
|
53
|
+
let e = null;
|
|
54
|
+
const n = c(t).format(d), r = v(
|
|
55
55
|
n,
|
|
56
56
|
l[n],
|
|
57
|
-
|
|
57
|
+
t
|
|
58
58
|
);
|
|
59
|
-
if (
|
|
60
|
-
"initialDayOperatingHour",
|
|
61
|
-
r,
|
|
62
|
-
e.format()
|
|
63
|
-
), r && (t = m(
|
|
59
|
+
if (r && (e = m(
|
|
64
60
|
n,
|
|
65
61
|
r,
|
|
66
|
-
|
|
67
|
-
).openingTime),
|
|
62
|
+
t.utcOffset()
|
|
63
|
+
).openingTime), !e)
|
|
68
64
|
for (let s = 1; s < g; s += 1) {
|
|
69
|
-
const i =
|
|
65
|
+
const i = c(t).add(s, "d"), o = i.format(d), u = l[o], f = O(u);
|
|
70
66
|
if (f) {
|
|
71
|
-
|
|
67
|
+
e = m(
|
|
72
68
|
o,
|
|
73
69
|
f,
|
|
74
70
|
i.utcOffset()
|
|
@@ -76,7 +72,7 @@ function K(l, e) {
|
|
|
76
72
|
break;
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
|
-
return
|
|
75
|
+
return e;
|
|
80
76
|
}
|
|
81
77
|
export {
|
|
82
78
|
K as default
|