@ancon/wildcat-utils 1.44.0-r13-2-tz.29 → 1.44.0-r13-2-tz.31

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