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