@ancon/wildcat-utils 1.44.0-r13-2-tz.52 → 1.44.0-r13-2-tz.54

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 S=require("@ancon/wildcat-types"),m=require("moment"),y=require("../date/isDSTShiftPresentInRange.js"),D=require("./getPickerIntervalsForDay.js"),P=require("./getSettingsForOrderFormat.js"),x=require("./getServiceIntervalStart.js"),h=require("./types.js"),R=require("./generatePickerTimesForDay.js"),_=require("./getServiceIntervalEnd.js"),I=require("./getOutletNextReadyToOrderTime.js");require("../date/getTimezoneUtcOffsetDifference.js");require("../shared/constants.js");require("../date/createLocalTimezoneMoment.js");require("./getServiceIntervalsForOrderFormat.js");require("../time/getTimeSpanParts.js");require("./getNextTenthMinute.js");require("./getServiceIntervalTimeSpanMoment.js");require("./hoursAndMinutesToMinutes.js");require("./isOutletAcceptingPreOrders.js");require("./getOutletTagInformation.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./getTimezoneAdjustedServiceInterval.js");require("../date/convertToSpecificTimezone.js");require("./searchNextOpeningMoment.js");require("./getOutletNextServiceTimeOffset.js");function M(n,d,O,k){const{preparationTime:T="00:00:00"}=P(d,n==null?void 0:n.orderFormatSettings)??{},s=I(n,d);console.log("nextReadyOrderTime",s.format());let l=s.clone();const o=m(O);if(console.log("specificDateMoment",o.format()),o>s)l=s.clone().set({year:o.year(),month:o.month(),date:o.date()}),console.log("specificDateMoment > nextReadyOrderTime",l.format());else{const t=s.diff(o,"day");if(console.log("ELSE specificDateMoment > nextReadyOrderTime",t),t>0)return[]}let e=[];const v=D(l,n==null?void 0:n.serviceDateTimes,d);let g;if(v.forEach(t=>{!g&&t.type&&(e=[]);const r=x(l,t,T),u=_(l,t,T);console.log("intervalStartTime, intervalEndTime",r.format(),u.format()),r<s&&(console.log("Add the time that has already passed today"),r.add(s.valueOf()-r.valueOf(),"millisecond"));const i=R(r,u,e,void 0,k);if(i.length>0)switch(t.state){case S.IntervalState.Closed:{const a=i[0],f=i[i.length-1];e=e.filter(({timestamp:c})=>c<a.timestamp||c>f.timestamp);break}case S.IntervalState.Opened:default:{let a=i;const f=y(r,u);console.log("isDSTShiftInterval",f),f&&(a=i.filter(c=>{const p=m(c.timestamp).utc(!0),q=m(i[0].timestamp).utc(!0);return console.log("=>",p.format(),q.format()),p.isSameOrAfter(q)})),e=e.concat(a);break}}g=t.type}),e.length){const t=e[0],r=e[e.length-1];if(y(t.timestamp,r.timestamp)){const i=Math.max(m(t.timestamp).utcOffset(),m(r.timestamp).utcOffset());return e.map(a=>{const c=m(a.timestamp).utcOffset()===i?h.PickerTimeTimezoneTag.Summer:h.PickerTimeTimezoneTag.Standard;return{...a,timezoneTag:c}})}}return e}module.exports=M;
1
+ "use strict";const S=require("@ancon/wildcat-types"),l=require("moment"),y=require("../date/isDSTShiftPresentInRange.js"),D=require("./getPickerIntervalsForDay.js"),P=require("./getSettingsForOrderFormat.js"),x=require("./getServiceIntervalStart.js"),h=require("./types.js"),R=require("./generatePickerTimesForDay.js"),_=require("./getServiceIntervalEnd.js"),I=require("./getOutletNextReadyToOrderTime.js");require("../date/getTimezoneUtcOffsetDifference.js");require("../shared/constants.js");require("../date/createLocalTimezoneMoment.js");require("./getServiceIntervalsForOrderFormat.js");require("../time/getTimeSpanParts.js");require("./getNextTenthMinute.js");require("./getServiceIntervalTimeSpanMoment.js");require("./hoursAndMinutesToMinutes.js");require("./isOutletAcceptingPreOrders.js");require("./getOutletTagInformation.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./getTimezoneAdjustedServiceInterval.js");require("../date/convertToSpecificTimezone.js");require("./searchNextOpeningMoment.js");require("./getOutletNextServiceTimeOffset.js");function M(s,p,O,k){const{preparationTime:g="00:00:00"}=P(p,s==null?void 0:s.orderFormatSettings)??{},a=I(s,p);console.log("nextReadyOrderTime",a.format());let f=a.clone();const c=l(O);if(console.log("specificDateMoment",c.format()),c>a)f=a.clone().set({year:c.year(),month:c.month(),date:c.date()}),console.log("specificDateMoment > nextReadyOrderTime",f.format());else{const r=a.diff(c,"day");if(console.log("ELSE specificDateMoment > nextReadyOrderTime",r),r>0)return[]}let e=[];const v=D(f,s==null?void 0:s.serviceDateTimes,p);let q;if(v.forEach(r=>{!q&&r.type&&(e=[]);const i=x(f,r,g),d=_(f,r,g);console.log("intervalStartTime, intervalEndTime",i.format(),d.format()),i<a&&(console.log("Add the time that has already passed today"),i.add(a.valueOf()-i.valueOf(),"millisecond"));const n=R(i,d,e,void 0,k);if(n.length>0)switch(r.state){case S.IntervalState.Closed:{const o=n[0],m=n[n.length-1];e=e.filter(({timestamp:t})=>t<o.timestamp||t>m.timestamp);break}case S.IntervalState.Opened:default:{let o=n;const m=y(i,d);console.log("isDSTShiftInterval",m),m&&(o=n.filter(t=>{const u=l(t.timestamp).utc(!0),T=l(i).utc(!0);return console.log("=>",u.format(),T.format()),u.isSameOrAfter(T)})),e=e.concat(o);break}}q=r.type}),e.length){const r=e[0],i=e[e.length-1];if(y(r.timestamp,i.timestamp)){const n=Math.max(l(r.timestamp).utcOffset(),l(i.timestamp).utcOffset()),o=e.map(t=>t.timeLabel),m=o.filter((t,u)=>o.indexOf(t)!==u);return e.map(t=>{if(m.includes(t.timeLabel)){const T=l(t.timestamp).utcOffset()===n?h.PickerTimeTimezoneTag.Summer:h.PickerTimeTimezoneTag.Standard;return{...t,timezoneTag:T}}return t})}}return e}module.exports=M;
@@ -1,13 +1,13 @@
1
1
  import { IntervalState as h } from "@ancon/wildcat-types";
2
- import c from "moment";
2
+ import f from "moment";
3
3
  import O from "../date/isDSTShiftPresentInRange.mjs";
4
4
  import x from "./getPickerIntervalsForDay.mjs";
5
5
  import P from "./getSettingsForOrderFormat.mjs";
6
6
  import R from "./getServiceIntervalStart.mjs";
7
- import { PickerTimeTimezoneTag as k } from "./types.mjs";
7
+ import { PickerTimeTimezoneTag as u } from "./types.mjs";
8
8
  import M from "./generatePickerTimesForDay.mjs";
9
- import E from "./getServiceIntervalEnd.mjs";
10
- import I from "./getOutletNextReadyToOrderTime.mjs";
9
+ import b from "./getServiceIntervalEnd.mjs";
10
+ import E from "./getOutletNextReadyToOrderTime.mjs";
11
11
  import "../date/getTimezoneUtcOffsetDifference.mjs";
12
12
  import "../shared/constants.mjs";
13
13
  import "../date/createLocalTimezoneMoment.mjs";
@@ -24,98 +24,101 @@ import "./getTimezoneAdjustedServiceInterval.mjs";
24
24
  import "../date/convertToSpecificTimezone.mjs";
25
25
  import "./searchNextOpeningMoment.mjs";
26
26
  import "./getOutletNextServiceTimeOffset.mjs";
27
- function ie(m, d, u, v) {
28
- const { preparationTime: T = "00:00:00" } = P(d, m == null ? void 0 : m.orderFormatSettings) ?? {}, o = I(m, d);
29
- console.log("nextReadyOrderTime", o.format());
30
- let f = o.clone();
31
- const a = c(u);
32
- if (console.log("specificDateMoment", a.format()), a > o)
33
- f = o.clone().set({
34
- year: a.year(),
35
- month: a.month(),
36
- date: a.date()
37
- }), console.log("specificDateMoment > nextReadyOrderTime", f.format());
27
+ function ie(o, g, k, D) {
28
+ const { preparationTime: S = "00:00:00" } = P(g, o == null ? void 0 : o.orderFormatSettings) ?? {}, a = E(o, g);
29
+ console.log("nextReadyOrderTime", a.format());
30
+ let p = a.clone();
31
+ const s = f(k);
32
+ if (console.log("specificDateMoment", s.format()), s > a)
33
+ p = a.clone().set({
34
+ year: s.year(),
35
+ month: s.month(),
36
+ date: s.date()
37
+ }), console.log("specificDateMoment > nextReadyOrderTime", p.format());
38
38
  else {
39
- const t = o.diff(a, "day");
40
- if (console.log("ELSE specificDateMoment > nextReadyOrderTime", t), t > 0)
39
+ const i = a.diff(s, "day");
40
+ if (console.log("ELSE specificDateMoment > nextReadyOrderTime", i), i > 0)
41
41
  return [];
42
42
  }
43
43
  let e = [];
44
- const D = x(
45
- f,
46
- m == null ? void 0 : m.serviceDateTimes,
47
- d
44
+ const v = x(
45
+ p,
46
+ o == null ? void 0 : o.serviceDateTimes,
47
+ g
48
48
  );
49
- let g;
50
- if (D.forEach((t) => {
51
- !g && t.type && (e = []);
52
- const i = R(
53
- f,
54
- t,
55
- T
56
- ), l = E(
57
- f,
58
- t,
59
- T
49
+ let y;
50
+ if (v.forEach((i) => {
51
+ !y && i.type && (e = []);
52
+ const r = R(
53
+ p,
54
+ i,
55
+ S
56
+ ), d = b(
57
+ p,
58
+ i,
59
+ S
60
60
  );
61
61
  console.log(
62
62
  "intervalStartTime, intervalEndTime",
63
- i.format(),
64
- l.format()
65
- ), i < o && (console.log("Add the time that has already passed today"), i.add(
66
- o.valueOf() - i.valueOf(),
63
+ r.format(),
64
+ d.format()
65
+ ), r < a && (console.log("Add the time that has already passed today"), r.add(
66
+ a.valueOf() - r.valueOf(),
67
67
  "millisecond"
68
68
  ));
69
- const r = M(
70
- i,
71
- l,
69
+ const m = M(
70
+ r,
71
+ d,
72
72
  e,
73
73
  void 0,
74
- v
74
+ D
75
75
  );
76
- if (r.length > 0)
77
- switch (t.state) {
76
+ if (m.length > 0)
77
+ switch (i.state) {
78
78
  case h.Closed: {
79
- const n = r[0], p = r[r.length - 1];
79
+ const n = m[0], c = m[m.length - 1];
80
80
  e = e.filter(
81
- ({ timestamp: s }) => s < n.timestamp || s > p.timestamp
81
+ ({ timestamp: t }) => t < n.timestamp || t > c.timestamp
82
82
  );
83
83
  break;
84
84
  }
85
85
  case h.Opened:
86
86
  default: {
87
- let n = r;
88
- const p = O(
89
- i,
90
- l
87
+ let n = m;
88
+ const c = O(
89
+ r,
90
+ d
91
91
  );
92
- console.log("isDSTShiftInterval", p), p && (n = r.filter((s) => {
93
- const S = c(s.timestamp).utc(!0), y = c(
94
- r[0].timestamp
95
- ).utc(!0);
92
+ console.log("isDSTShiftInterval", c), c && (n = m.filter((t) => {
93
+ const l = f(t.timestamp).utc(!0), T = f(r).utc(!0);
96
94
  return console.log(
97
95
  "=>",
98
- S.format(),
99
- y.format()
100
- ), S.isSameOrAfter(y);
96
+ l.format(),
97
+ T.format()
98
+ ), l.isSameOrAfter(T);
101
99
  })), e = e.concat(n);
102
100
  break;
103
101
  }
104
102
  }
105
- g = t.type;
103
+ y = i.type;
106
104
  }), e.length) {
107
- const t = e[0], i = e[e.length - 1];
105
+ const i = e[0], r = e[e.length - 1];
108
106
  if (O(
109
- t.timestamp,
110
- i.timestamp
107
+ i.timestamp,
108
+ r.timestamp
111
109
  )) {
112
- const r = Math.max(
113
- c(t.timestamp).utcOffset(),
114
- c(i.timestamp).utcOffset()
110
+ const m = Math.max(
111
+ f(i.timestamp).utcOffset(),
112
+ f(r.timestamp).utcOffset()
113
+ ), n = e.map((t) => t.timeLabel), c = n.filter(
114
+ (t, l) => n.indexOf(t) !== l
115
115
  );
116
- return e.map((n) => {
117
- const s = c(n.timestamp).utcOffset() === r ? k.Summer : k.Standard;
118
- return { ...n, timezoneTag: s };
116
+ return e.map((t) => {
117
+ if (c.includes(t.timeLabel)) {
118
+ const T = f(t.timestamp).utcOffset() === m ? u.Summer : u.Standard;
119
+ return { ...t, timezoneTag: T };
120
+ }
121
+ return t;
119
122
  });
120
123
  }
121
124
  }
package/outlet/types.d.ts CHANGED
@@ -32,7 +32,7 @@ export declare type PickerTime = {
32
32
  timestamp: number;
33
33
  timeLabel: string;
34
34
  dayLabel: string;
35
- /** This is available if the picker time is in an interval that has a DST shift */
35
+ /** This is available for time label duplicated picker times in an interval that has a DST shift */
36
36
  timezoneTag?: PickerTimeTimezoneTag;
37
37
  };
38
38
  export declare type PickerDay = PickerTime[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ancon/wildcat-utils",
3
- "version": "1.44.0-r13-2-tz.52",
3
+ "version": "1.44.0-r13-2-tz.54",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",