@ancon/wildcat-utils 1.40.28 → 1.40.29
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/generatePickerTimesForDay.js +1 -1
- package/outlet/generatePickerTimesForDay.mjs +8 -8
- package/outlet/getOutletPickerTimesForDay.js +1 -1
- package/outlet/getOutletPickerTimesForDay.mjs +30 -30
- package/outlet/getPickerIntervalsForDay.d.ts +2 -1
- package/outlet/getPickerIntervalsForDay.js +1 -1
- package/outlet/getPickerIntervalsForDay.mjs +15 -15
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const r=require("moment");function f(i,n,c,s=6e5,m){const l=i.valueOf(),d=n.valueOf()-s,o=[];for(let e=l;e<=d;e+=s){const t=m?r(e).locale(m):r(e),a=t.valueOf();c.some(u=>u.timestamp===a)||o.push({timestamp:a,timeLabel:t.format("HH:mm"),dayLabel:t.format("dddd")})}return o}module.exports=f;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
function u(
|
|
3
|
-
const
|
|
4
|
-
for (let e =
|
|
5
|
-
const t =
|
|
6
|
-
|
|
7
|
-
timestamp:
|
|
1
|
+
import r from "moment";
|
|
2
|
+
function u(i, n, l, m = 6e5, s) {
|
|
3
|
+
const c = i.valueOf(), d = n.valueOf() - m, o = [];
|
|
4
|
+
for (let e = c; e <= d; e += m) {
|
|
5
|
+
const t = s ? r(e).locale(s) : r(e), a = t.valueOf();
|
|
6
|
+
l.some((f) => f.timestamp === a) || o.push({
|
|
7
|
+
timestamp: a,
|
|
8
8
|
timeLabel: t.format("HH:mm"),
|
|
9
9
|
dayLabel: t.format("dddd")
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return o;
|
|
13
13
|
}
|
|
14
14
|
export {
|
|
15
15
|
u as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const f=require("@ancon/wildcat-types"),O=require("moment"),S=require("./getPickerIntervalsForDay.js"),h=require("./getSettingsForOrderFormat.js"),
|
|
1
|
+
"use strict";const f=require("@ancon/wildcat-types"),O=require("moment"),S=require("./getPickerIntervalsForDay.js"),h=require("./getSettingsForOrderFormat.js"),l=require("./getServiceIntervalStart.js"),T=require("./generatePickerTimesForDay.js"),_=require("./getServiceIntervalEnd.js"),k=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");function D(e,o,p,y){const{preparationTime:m="00:00:00"}=h(o,e==null?void 0:e.orderFormatSettings)??{},n=k(e,o);let s=n.clone();const a=O(p);a>n&&(s=n.clone().set({year:a.year(),month:a.month(),date:a.date()}));let r=[];const g=S(s,e==null?void 0:e.serviceDateTimes,o);let q;return g.forEach(t=>{!q&&t.type&&(r=[]);const c=l(s,t,m,e==null?void 0:e.timeZoneOffset),u=_(s,t,m,e==null?void 0:e.timeZoneOffset);c<n&&c.add(n.valueOf()-c.valueOf(),"millisecond");const i=T(c,u,r,void 0,y);i.length>0&&t.state===f.IntervalState.Closed?r=r.filter(d=>d.timestamp<i[0].timestamp||d.timestamp>i[i.length-1].timestamp):i.length>0&&t.state===f.IntervalState.Open&&(r=r.concat(i)),q=t.type}),r}module.exports=D;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IntervalState as d } from "@ancon/wildcat-types";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import S from "moment";
|
|
3
|
+
import k from "./getPickerIntervalsForDay.mjs";
|
|
4
4
|
import T from "./getSettingsForOrderFormat.mjs";
|
|
5
5
|
import D from "./getServiceIntervalStart.mjs";
|
|
6
6
|
import F from "./generatePickerTimesForDay.mjs";
|
|
@@ -16,51 +16,51 @@ import "./constants.mjs";
|
|
|
16
16
|
import "./getOutletCurrentActiveOperatingHour.mjs";
|
|
17
17
|
import "./getMomentFromDateAndTimeString.mjs";
|
|
18
18
|
import "./searchNextOpeningMoment.mjs";
|
|
19
|
-
function
|
|
20
|
-
const { preparationTime: s = "00:00:00" } = T(
|
|
21
|
-
let
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
year:
|
|
25
|
-
month:
|
|
26
|
-
date:
|
|
19
|
+
function K(r, a, g, y) {
|
|
20
|
+
const { preparationTime: s = "00:00:00" } = T(a, r == null ? void 0 : r.orderFormatSettings) ?? {}, m = P(r, a);
|
|
21
|
+
let n = m.clone();
|
|
22
|
+
const o = S(g);
|
|
23
|
+
o > m && (n = m.clone().set({
|
|
24
|
+
year: o.year(),
|
|
25
|
+
month: o.month(),
|
|
26
|
+
date: o.date()
|
|
27
27
|
}));
|
|
28
|
-
let
|
|
29
|
-
const O =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
let e = [];
|
|
29
|
+
const O = k(
|
|
30
|
+
n,
|
|
31
|
+
r == null ? void 0 : r.serviceDateTimes,
|
|
32
|
+
a
|
|
33
33
|
);
|
|
34
34
|
let f;
|
|
35
35
|
return O.forEach((i) => {
|
|
36
|
-
!f && i.type && (
|
|
37
|
-
const
|
|
38
|
-
|
|
36
|
+
!f && i.type && (e = []);
|
|
37
|
+
const p = D(
|
|
38
|
+
n,
|
|
39
39
|
i,
|
|
40
40
|
s,
|
|
41
|
-
|
|
41
|
+
r == null ? void 0 : r.timeZoneOffset
|
|
42
42
|
), h = x(
|
|
43
|
-
|
|
43
|
+
n,
|
|
44
44
|
i,
|
|
45
45
|
s,
|
|
46
|
-
|
|
46
|
+
r == null ? void 0 : r.timeZoneOffset
|
|
47
47
|
);
|
|
48
|
-
|
|
49
|
-
m.valueOf() -
|
|
48
|
+
p < m && p.add(
|
|
49
|
+
m.valueOf() - p.valueOf(),
|
|
50
50
|
"millisecond"
|
|
51
51
|
);
|
|
52
52
|
const t = F(
|
|
53
|
-
|
|
53
|
+
p,
|
|
54
54
|
h,
|
|
55
|
-
|
|
55
|
+
e,
|
|
56
56
|
void 0,
|
|
57
|
-
|
|
57
|
+
y
|
|
58
58
|
);
|
|
59
|
-
t.length > 0 && i.state === d.Closed ?
|
|
59
|
+
t.length > 0 && i.state === d.Closed ? e = e.filter(
|
|
60
60
|
(c) => c.timestamp < t[0].timestamp || c.timestamp > t[t.length - 1].timestamp
|
|
61
|
-
) : t.length > 0 && i.state === d.Open && (
|
|
62
|
-
}),
|
|
61
|
+
) : t.length > 0 && i.state === d.Open && (e = e.concat(t)), f = i.type;
|
|
62
|
+
}), e;
|
|
63
63
|
}
|
|
64
64
|
export {
|
|
65
|
-
|
|
65
|
+
K as default
|
|
66
66
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OrderFormat, ServiceDateTime, ServiceDateTimeInterval } from '@ancon/wildcat-types';
|
|
2
|
+
import { Moment } from 'moment';
|
|
2
3
|
/**
|
|
3
4
|
* Returns the intervals for the specified weekday index (0-6) and order format (optional)
|
|
4
5
|
*
|
|
@@ -7,4 +8,4 @@ import { OrderFormat, ServiceDateTime, ServiceDateTimeInterval } from '@ancon/wi
|
|
|
7
8
|
* @param orderFormat
|
|
8
9
|
* @returns
|
|
9
10
|
*/
|
|
10
|
-
export default function getPickerIntervalsForDay(
|
|
11
|
+
export default function getPickerIntervalsForDay(date: Moment, serviceDateTimes: ServiceDateTime[], orderFormat?: OrderFormat): ServiceDateTimeInterval[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const f=require("@ancon/wildcat-types"),
|
|
1
|
+
"use strict";const f=require("@ancon/wildcat-types"),s=require("moment"),D=require("../shared/constants.js"),c=require("./getServiceIntervalsForOrderFormat.js");function p(r,o,n){return c(n,o).reduce((t,e)=>{const a=e.dayOfWeek===f.DayOfWeek.Everyday,i=!!e.type,u=r.isoWeekday();if(a){if(i){const y=s(e.fromDate),d=s(e.toDate);return r.isBetween(y,d,"day","[]")&&t.push(e),t}return t.push(e),t}return e.dayOfWeek===D.DaysOfWeekMap[u]&&t.push(e),t},[])}module.exports=p;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { DayOfWeek as
|
|
2
|
-
import
|
|
3
|
-
import { DaysOfWeekMap as
|
|
4
|
-
import
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { DayOfWeek as d } from "@ancon/wildcat-types";
|
|
2
|
+
import o from "moment";
|
|
3
|
+
import { DaysOfWeekMap as p } from "../shared/constants.mjs";
|
|
4
|
+
import u from "./getServiceIntervalsForOrderFormat.mjs";
|
|
5
|
+
function w(t, s, n) {
|
|
6
|
+
return u(
|
|
7
|
+
n,
|
|
8
|
+
s
|
|
9
9
|
).reduce(
|
|
10
10
|
(r, e) => {
|
|
11
|
-
const
|
|
12
|
-
if (
|
|
13
|
-
if (
|
|
14
|
-
const
|
|
15
|
-
return t.
|
|
11
|
+
const a = e.dayOfWeek === d.Everyday, f = !!e.type, m = t.isoWeekday();
|
|
12
|
+
if (a) {
|
|
13
|
+
if (f) {
|
|
14
|
+
const i = o(e.fromDate), y = o(e.toDate);
|
|
15
|
+
return t.isBetween(i, y, "day", "[]") && r.push(e), r;
|
|
16
16
|
}
|
|
17
17
|
return r.push(e), r;
|
|
18
18
|
}
|
|
19
|
-
return e.dayOfWeek ===
|
|
19
|
+
return e.dayOfWeek === p[m] && r.push(e), r;
|
|
20
20
|
},
|
|
21
21
|
[]
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
w as default
|
|
26
26
|
};
|