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