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