@ancon/wildcat-utils 1.44.0-r13-2-tz.8 → 1.44.0-r13-2-tz.10
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),d=(t==null?void 0:t.preparationTime)??"00:00:00",f=T((e==null?void 0:e.orderFormatSettings)||[]),O=_(i,(e==null?void 0:e.serviceDateTimes)||[]),o=v.default(O,s,r(),r()),p=!s&&f&&o.openingTime?o.openingTime:void 0,c=r(),a=r(p),n=(c>a?c:a).second(0).millisecond(0),g=I(i,d,e==null?void 0:e.deliveryIntegrationEnabled);g>0&&n.add(g,"minute"),console.log("=> before",n.format());const m=x(n)-n.minutes();return console.log("=> after",n.format()),m&&n.add(m,"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(e, r) {
|
|
16
|
+
const o = (e == null ? void 0 : e.state) === T.Opened, t = v(
|
|
17
17
|
r,
|
|
18
|
-
|
|
19
|
-
),
|
|
20
|
-
(
|
|
21
|
-
),
|
|
18
|
+
e == null ? void 0 : e.orderFormatSettings
|
|
19
|
+
), c = (t == null ? void 0 : t.preparationTime) ?? "00:00:00", g = x(
|
|
20
|
+
(e == null ? void 0 : e.orderFormatSettings) || []
|
|
21
|
+
), d = y(
|
|
22
22
|
r,
|
|
23
|
-
(
|
|
24
|
-
),
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
(e == null ? void 0 : e.serviceDateTimes) || []
|
|
24
|
+
), m = I(
|
|
25
|
+
d,
|
|
26
|
+
o,
|
|
27
27
|
i(),
|
|
28
28
|
i()
|
|
29
|
-
), O = !
|
|
29
|
+
), O = !o && g && m.openingTime ? m.openingTime : void 0, s = i(), p = i(O), n = (s > p ? s : p).second(0).millisecond(0), f = F(
|
|
30
30
|
r,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
c,
|
|
32
|
+
e == null ? void 0 : e.deliveryIntegrationEnabled
|
|
33
33
|
);
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
return
|
|
34
|
+
f > 0 && n.add(f, "minute"), console.log("=> before", n.format());
|
|
35
|
+
const a = S(n) - n.minutes();
|
|
36
|
+
return console.log("=> after", n.format()), a && n.add(a, "minutes"), n;
|
|
37
37
|
}
|
|
38
38
|
export {
|
|
39
39
|
z as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const m=require("moment"),y=require("@ancon/wildcat-types"),O=require("../time/getTimeSpanParts.js"),
|
|
1
|
+
"use strict";const m=require("moment"),y=require("@ancon/wildcat-types"),O=require("../time/getTimeSpanParts.js"),a=require("./constants.js"),u=require("./getServiceIntervalTimeSpanMoment.js");function g(r,e){const t=r.clone().date()-e.date();return t!==0?r.subtract(t,"day"):r}function p(r){let e=null;const{intervals:n,exception:t}=r;if(t){const{state:i}=t;i||(e=t)}else{const i=n.sort((o,s)=>O(o.from).hours-O(s.from).hours),[l]=i;return l}return e}function d(r,e,n){var i,l;const t=[];if(e.exception){if(e.exception.state===y.IntervalState.Opened){const o=u(r,e.exception.from);console.log("relevantMoment",n.format()),console.log("openingMoment",o.format()),n.clone().utc(!0).isBefore(o.clone().utc(!0))&&t.push({interval:e.exception,moment:o})}}else for(let o=0;o<e.intervals.length;o+=1){const s=e.intervals[o],c=u(r,s.from);n.isBefore(c)&&t.push({interval:s,moment:c})}return t.length<2?((i=t[0])==null?void 0:i.interval)??null:((l=t.sort((o,s)=>o.moment-n-(s.moment-n))[0])==null?void 0:l.interval)??null}function h(r,e){let n=null;const t=m(e).format(a.OutletMapKeyFormatter),i=d(t,r[t],e);if(i&&(n=u(t,i.from)),!n)for(let l=1;l<a.OutletTimelineDayCount;l+=1){const o=m(e).add(l,"d"),s=o.format(a.OutletMapKeyFormatter),c=r[s],f=p(c);if(f){n=u(s,f.from),n=g(n,o);break}}return n}module.exports=h;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import
|
|
1
|
+
import m from "moment";
|
|
2
2
|
import { IntervalState as p } from "@ancon/wildcat-types";
|
|
3
|
-
import
|
|
4
|
-
import { OutletMapKeyFormatter as O, OutletTimelineDayCount as
|
|
3
|
+
import u from "../time/getTimeSpanParts.mjs";
|
|
4
|
+
import { OutletMapKeyFormatter as O, OutletTimelineDayCount as g } from "./constants.mjs";
|
|
5
5
|
import a from "./getServiceIntervalTimeSpanMoment.mjs";
|
|
6
|
-
function
|
|
7
|
-
const t =
|
|
8
|
-
return t !== 0 ?
|
|
6
|
+
function y(r, e) {
|
|
7
|
+
const t = r.clone().date() - e.date();
|
|
8
|
+
return t !== 0 ? r.subtract(t, "day") : r;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function d(r) {
|
|
11
11
|
let e = null;
|
|
12
|
-
const { intervals: n, exception: t } =
|
|
12
|
+
const { intervals: n, exception: t } = r;
|
|
13
13
|
if (t) {
|
|
14
|
-
const { state:
|
|
15
|
-
|
|
14
|
+
const { state: i } = t;
|
|
15
|
+
i || (e = t);
|
|
16
16
|
} else {
|
|
17
|
-
const
|
|
18
|
-
(o, l) =>
|
|
19
|
-
), [s] =
|
|
17
|
+
const i = n.sort(
|
|
18
|
+
(o, l) => u(o.from).hours - u(l.from).hours
|
|
19
|
+
), [s] = i;
|
|
20
20
|
return s;
|
|
21
21
|
}
|
|
22
22
|
return e;
|
|
23
23
|
}
|
|
24
|
-
function h(
|
|
25
|
-
var
|
|
24
|
+
function h(r, e, n) {
|
|
25
|
+
var i, s;
|
|
26
26
|
const t = [];
|
|
27
27
|
if (e.exception) {
|
|
28
28
|
if (e.exception.state === p.Opened) {
|
|
29
29
|
const o = a(
|
|
30
|
-
|
|
30
|
+
r,
|
|
31
31
|
e.exception.from
|
|
32
32
|
);
|
|
33
|
-
n.isBefore(o) && t.push({
|
|
33
|
+
console.log("relevantMoment", n.format()), console.log("openingMoment", o.format()), n.clone().utc(!0).isBefore(o.clone().utc(!0)) && t.push({
|
|
34
34
|
interval: e.exception,
|
|
35
35
|
moment: o
|
|
36
36
|
});
|
|
@@ -38,34 +38,34 @@ function h(i, e, n) {
|
|
|
38
38
|
} else
|
|
39
39
|
for (let o = 0; o < e.intervals.length; o += 1) {
|
|
40
40
|
const l = e.intervals[o], f = a(
|
|
41
|
-
|
|
41
|
+
r,
|
|
42
42
|
l.from
|
|
43
43
|
);
|
|
44
44
|
n.isBefore(f) && t.push({ interval: l, moment: f });
|
|
45
45
|
}
|
|
46
|
-
return t.length < 2 ? ((
|
|
46
|
+
return t.length < 2 ? ((i = t[0]) == null ? void 0 : i.interval) ?? null : ((s = t.sort(
|
|
47
47
|
// @ts-ignore TODO
|
|
48
48
|
(o, l) => o.moment - n - (l.moment - n)
|
|
49
49
|
)[0]) == null ? void 0 : s.interval) ?? null;
|
|
50
50
|
}
|
|
51
|
-
function S(
|
|
51
|
+
function S(r, e) {
|
|
52
52
|
let n = null;
|
|
53
|
-
const t =
|
|
53
|
+
const t = m(e).format(O), i = h(
|
|
54
54
|
t,
|
|
55
|
-
|
|
55
|
+
r[t],
|
|
56
56
|
e
|
|
57
57
|
);
|
|
58
|
-
if (
|
|
58
|
+
if (i && (n = a(
|
|
59
59
|
t,
|
|
60
|
-
|
|
60
|
+
i.from
|
|
61
61
|
)), !n)
|
|
62
|
-
for (let s = 1; s <
|
|
63
|
-
const o =
|
|
64
|
-
if (
|
|
62
|
+
for (let s = 1; s < g; s += 1) {
|
|
63
|
+
const o = m(e).add(s, "d"), l = o.format(O), f = r[l], c = d(f);
|
|
64
|
+
if (c) {
|
|
65
65
|
n = a(
|
|
66
66
|
l,
|
|
67
|
-
|
|
68
|
-
), n =
|
|
67
|
+
c.from
|
|
68
|
+
), n = y(n, o);
|
|
69
69
|
break;
|
|
70
70
|
}
|
|
71
71
|
}
|