@ancon/wildcat-utils 1.17.6 → 1.18.1
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/index.js +1 -1
- package/index.mjs +60 -58
- package/outlet/getListOutletOpeningHoursTable.d.ts +4 -2
- package/outlet/index.d.ts +2 -1
- package/outlet/index.js +1 -1
- package/outlet/index.mjs +8 -6
- package/outlet/serviceDateTimesFromOpeningHours.d.ts +19 -0
- package/outlet/serviceDateTimesFromOpeningHours.js +1 -0
- package/outlet/serviceDateTimesFromOpeningHours.mjs +33 -0
- package/package.json +6 -1
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/enums.js"),r=require("./shared/isWithinFlag.js"),t=require("./shared/generateId.js"),i=require("./outlet/getListOutletOpeningHoursTable.js"),n=require("./outlet/getOutletTagInformation.js"),o=require("./outlet/getOutletAvailabilityInfo.js"),s=require("./outlet/getOutletOfflineOrderFormats.js"),u=require("./outlet/getOutletAvailableOrderFormats.js"),l=require("./outlet/getOutletFormattedDistance.js"),a=require("./outlet/isOutletAcceptingPreOrders.js"),g=require("./outlet/getOutletDeliveryFee.js"),c=require("./outlet/getOutletTodayOpeningTimes.js"),d=require("./outlet/getOutletOrderFormats.js"),q=require("./versioning/isVersionALessThanB.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/enums.js"),r=require("./shared/isWithinFlag.js"),t=require("./shared/generateId.js"),i=require("./outlet/getListOutletOpeningHoursTable.js"),n=require("./outlet/getOutletTagInformation.js"),o=require("./outlet/getOutletAvailabilityInfo.js"),s=require("./outlet/getOutletOfflineOrderFormats.js"),u=require("./outlet/getOutletAvailableOrderFormats.js"),l=require("./outlet/getOutletFormattedDistance.js"),a=require("./outlet/isOutletAcceptingPreOrders.js"),g=require("./outlet/getOutletDeliveryFee.js"),c=require("./outlet/getOutletTodayOpeningTimes.js"),d=require("./outlet/getOutletOrderFormats.js"),q=require("./outlet/serviceDateTimesFromOpeningHours.js"),O=require("./versioning/isVersionALessThanB.js"),_=require("./versioning/cleanVersionString.js"),m=require("./api/getUrlAndParams.js"),p=require("./api/getEndpointWithVersion.js"),F=require("./api/generateBackoffWithEqualJitter.js"),T=require("./string/slugify.js"),f=require("./string/truncate.js"),v=require("./color/lighten.js"),y=require("./color/brighten.js"),P=require("./color/darken.js"),h=require("./color/isDarkBackground.js"),b=require("./user/getFullName.js"),A=require("./user/getFullAddressString.js"),I=require("./logger/Logger.js"),k=require("./logger/types.js"),D=require("./logger/sanitizeAsStringDict.js"),S=require("./printing/getPrinterType.js"),V=require("./printing/isValidPrinter.js"),L=require("./printing/isValidNetworkPrinter.js"),W=require("./printing/isValidStarCloudPrinter.js"),B=require("./printing/isTerminalPrinter.js"),E=require("./number/randomIntFromInterval.js"),H=require("./tables/decodeTableQRPayload.js");require("moment");require("@ancon/wildcat-types");require("./outlet/types.js");require("./outlet/constants.js");require("./outlet/getOutletCurrentActiveOperatingHour.js");require("./outlet/getMomentFromDateAndTimeString.js");require("./outlet/searchNextOpeningMoment.js");require("lodash");require("compare-versions");require("tinycolor2");require("@ancon/wildcat-printing");exports.DayOfWeek=e.DayOfWeek;exports.IntervalState=e.IntervalState;exports.IntervalType=e.IntervalType;exports.OrderFormat=e.OrderFormat;exports.isWithinFlag=r;exports.generateId=t;exports.getListOutletOpeningHoursTable=i;exports.getOutletTagInformation=n.default;exports.getOutletAvailabilityInfo=o.default;exports.getOutletOfflineOrderFormats=s;exports.getOutletAvailableOrderFormats=u;exports.getOutletFormattedDistance=l;exports.isOutletAcceptingPreOrders=a;exports.getOutletDeliveryFee=g;exports.getOutletTodayOpeningTimes=c;exports.getOutletOrderFormats=d;exports.serviceDateTimesFromOpeningHours=q;exports.isVersionALessThanB=O;exports.cleanVersionString=_;exports.getUrlAndParams=m;exports.getEndpointWithVersion=p;exports.generateBackoffWithEqualJitter=F;exports.slugify=T;exports.truncate=f;exports.lighten=v;exports.brighten=y;exports.darken=P;exports.isDarkBackground=h;exports.getFullName=b;exports.getFullAddressString=A;exports.Logger=I;exports.LogLevel=k.LogLevel;exports.sanitizeAsStringDict=D;exports.getPrinterType=S;exports.isValidPrinter=V;exports.isValidNetworkPrinter=L;exports.isValidStarCloudPrinter=W;exports.isTerminalPrinter=B;exports.randomIntFromInterval=E;exports.decodeTableQRPayload=H;
|
package/index.mjs
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { DayOfWeek as n, IntervalState as x, IntervalType as g, OrderFormat as O } from "./shared/enums.mjs";
|
|
2
2
|
import { default as c } from "./shared/isWithinFlag.mjs";
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
3
|
+
import { default as v } from "./shared/generateId.mjs";
|
|
4
|
+
import { default as P } from "./outlet/getListOutletOpeningHoursTable.mjs";
|
|
5
5
|
import { default as I } from "./outlet/getOutletTagInformation.mjs";
|
|
6
6
|
import { default as k } from "./outlet/getOutletAvailabilityInfo.mjs";
|
|
7
|
-
import { default as
|
|
7
|
+
import { default as V } from "./outlet/getOutletOfflineOrderFormats.mjs";
|
|
8
8
|
import { default as L } from "./outlet/getOutletAvailableOrderFormats.mjs";
|
|
9
9
|
import { default as W } from "./outlet/getOutletFormattedDistance.mjs";
|
|
10
10
|
import { default as E } from "./outlet/isOutletAcceptingPreOrders.mjs";
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as Q } from "./
|
|
15
|
-
import { default as U } from "./versioning/
|
|
16
|
-
import { default as G } from "./
|
|
17
|
-
import { default as M } from "./api/
|
|
18
|
-
import { default as Y } from "./api/
|
|
19
|
-
import { default as _ } from "./
|
|
20
|
-
import { default as
|
|
21
|
-
import { default as
|
|
22
|
-
import { default as
|
|
23
|
-
import { default as
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
26
|
-
import { default as
|
|
27
|
-
import { default as
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import { default as
|
|
31
|
-
import { default as
|
|
32
|
-
import { default as
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
35
|
-
import { default as
|
|
36
|
-
import { default as
|
|
11
|
+
import { default as N } from "./outlet/getOutletDeliveryFee.mjs";
|
|
12
|
+
import { default as w } from "./outlet/getOutletTodayOpeningTimes.mjs";
|
|
13
|
+
import { default as C } from "./outlet/getOutletOrderFormats.mjs";
|
|
14
|
+
import { default as Q } from "./outlet/serviceDateTimesFromOpeningHours.mjs";
|
|
15
|
+
import { default as U } from "./versioning/isVersionALessThanB.mjs";
|
|
16
|
+
import { default as G } from "./versioning/cleanVersionString.mjs";
|
|
17
|
+
import { default as M } from "./api/getUrlAndParams.mjs";
|
|
18
|
+
import { default as Y } from "./api/getEndpointWithVersion.mjs";
|
|
19
|
+
import { default as _ } from "./api/generateBackoffWithEqualJitter.mjs";
|
|
20
|
+
import { default as ee } from "./string/slugify.mjs";
|
|
21
|
+
import { default as re } from "./string/truncate.mjs";
|
|
22
|
+
import { default as oe } from "./color/lighten.mjs";
|
|
23
|
+
import { default as le } from "./color/brighten.mjs";
|
|
24
|
+
import { default as ie } from "./color/darken.mjs";
|
|
25
|
+
import { default as de } from "./color/isDarkBackground.mjs";
|
|
26
|
+
import { default as ue } from "./user/getFullName.mjs";
|
|
27
|
+
import { default as xe } from "./user/getFullAddressString.mjs";
|
|
28
|
+
import { default as Oe } from "./logger/Logger.mjs";
|
|
29
|
+
import { LogLevel as ce } from "./logger/types.mjs";
|
|
30
|
+
import { default as ve } from "./logger/sanitizeAsStringDict.mjs";
|
|
31
|
+
import { default as Pe } from "./printing/getPrinterType.mjs";
|
|
32
|
+
import { default as Ie } from "./printing/isValidPrinter.mjs";
|
|
33
|
+
import { default as ke } from "./printing/isValidNetworkPrinter.mjs";
|
|
34
|
+
import { default as Ve } from "./printing/isValidStarCloudPrinter.mjs";
|
|
35
|
+
import { default as Le } from "./printing/isTerminalPrinter.mjs";
|
|
36
|
+
import { default as We } from "./number/randomIntFromInterval.mjs";
|
|
37
|
+
import { default as Ee } from "./tables/decodeTableQRPayload.mjs";
|
|
37
38
|
import "moment";
|
|
38
39
|
import "@ancon/wildcat-types";
|
|
39
40
|
import "./outlet/types.mjs";
|
|
@@ -49,40 +50,41 @@ export {
|
|
|
49
50
|
n as DayOfWeek,
|
|
50
51
|
x as IntervalState,
|
|
51
52
|
g as IntervalType,
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
ce as LogLevel,
|
|
54
|
+
Oe as Logger,
|
|
54
55
|
O as OrderFormat,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
le as brighten,
|
|
57
|
+
G as cleanVersionString,
|
|
58
|
+
ie as darken,
|
|
59
|
+
Ee as decodeTableQRPayload,
|
|
60
|
+
_ as generateBackoffWithEqualJitter,
|
|
61
|
+
v as generateId,
|
|
62
|
+
Y as getEndpointWithVersion,
|
|
63
|
+
xe as getFullAddressString,
|
|
64
|
+
ue as getFullName,
|
|
65
|
+
P as getListOutletOpeningHoursTable,
|
|
65
66
|
k as getOutletAvailabilityInfo,
|
|
66
67
|
L as getOutletAvailableOrderFormats,
|
|
67
|
-
|
|
68
|
+
N as getOutletDeliveryFee,
|
|
68
69
|
W as getOutletFormattedDistance,
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
V as getOutletOfflineOrderFormats,
|
|
71
|
+
C as getOutletOrderFormats,
|
|
71
72
|
I as getOutletTagInformation,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
w as getOutletTodayOpeningTimes,
|
|
74
|
+
Pe as getPrinterType,
|
|
75
|
+
M as getUrlAndParams,
|
|
76
|
+
de as isDarkBackground,
|
|
76
77
|
E as isOutletAcceptingPreOrders,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
Le as isTerminalPrinter,
|
|
79
|
+
ke as isValidNetworkPrinter,
|
|
80
|
+
Ie as isValidPrinter,
|
|
81
|
+
Ve as isValidStarCloudPrinter,
|
|
82
|
+
U as isVersionALessThanB,
|
|
82
83
|
c as isWithinFlag,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
oe as lighten,
|
|
85
|
+
We as randomIntFromInterval,
|
|
86
|
+
ve as sanitizeAsStringDict,
|
|
87
|
+
Q as serviceDateTimesFromOpeningHours,
|
|
88
|
+
ee as slugify,
|
|
89
|
+
re as truncate
|
|
88
90
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ServiceDateTime } from './types';
|
|
2
2
|
declare type ReadableOrderFormat = {
|
|
3
3
|
id: number;
|
|
4
4
|
name: string;
|
|
@@ -27,5 +27,7 @@ export declare type OpeningHoursTable = {
|
|
|
27
27
|
* @param nowISOString Optional ISO date string of current datetime
|
|
28
28
|
* @returns Opening hours table
|
|
29
29
|
*/
|
|
30
|
-
export default function getListOutletOpeningHoursTable(outlet:
|
|
30
|
+
export default function getListOutletOpeningHoursTable(outlet: {
|
|
31
|
+
serviceDateTimes: ServiceDateTime[];
|
|
32
|
+
}, nowISOString?: string): OpeningHoursTable[];
|
|
31
33
|
export {};
|
package/outlet/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ import isOutletAcceptingPreOrders from './isOutletAcceptingPreOrders';
|
|
|
8
8
|
import getOutletDeliveryFee from './getOutletDeliveryFee';
|
|
9
9
|
import getOutletTodayOpeningTimes from './getOutletTodayOpeningTimes';
|
|
10
10
|
import getOutletOrderFormats from './getOutletOrderFormats';
|
|
11
|
-
|
|
11
|
+
import serviceDateTimesFromOpeningHours from './serviceDateTimesFromOpeningHours';
|
|
12
|
+
export { getListOutletOpeningHoursTable, getOutletTagInformation, getOutletAvailabilityInfo, getOutletOfflineOrderFormats, getOutletAvailableOrderFormats, getOutletFormattedDistance, isOutletAcceptingPreOrders, getOutletDeliveryFee, getOutletTodayOpeningTimes, getOutletOrderFormats, serviceDateTimesFromOpeningHours, };
|
package/outlet/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getListOutletOpeningHoursTable.js"),t=require("./getOutletTagInformation.js"),r=require("./getOutletAvailabilityInfo.js"),u=require("./getOutletOfflineOrderFormats.js"),i=require("./getOutletAvailableOrderFormats.js"),l=require("./getOutletFormattedDistance.js"),o=require("./isOutletAcceptingPreOrders.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getListOutletOpeningHoursTable.js"),t=require("./getOutletTagInformation.js"),r=require("./getOutletAvailabilityInfo.js"),u=require("./getOutletOfflineOrderFormats.js"),i=require("./getOutletAvailableOrderFormats.js"),l=require("./getOutletFormattedDistance.js"),o=require("./isOutletAcceptingPreOrders.js"),n=require("./getOutletDeliveryFee.js"),s=require("./getOutletTodayOpeningTimes.js"),O=require("./getOutletOrderFormats.js"),a=require("./serviceDateTimesFromOpeningHours.js");require("moment");require("@ancon/wildcat-types");require("../shared/enums.js");require("../shared/isWithinFlag.js");require("../shared/generateId.js");require("./types.js");require("./constants.js");require("./getOutletCurrentActiveOperatingHour.js");require("./getMomentFromDateAndTimeString.js");require("./searchNextOpeningMoment.js");require("lodash");exports.getListOutletOpeningHoursTable=e;exports.getOutletTagInformation=t.default;exports.getOutletAvailabilityInfo=r.default;exports.getOutletOfflineOrderFormats=u;exports.getOutletAvailableOrderFormats=i;exports.getOutletFormattedDistance=l;exports.isOutletAcceptingPreOrders=o;exports.getOutletDeliveryFee=n;exports.getOutletTodayOpeningTimes=s;exports.getOutletOrderFormats=O;exports.serviceDateTimesFromOpeningHours=a;
|
package/outlet/index.mjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { default as d } from "./getListOutletOpeningHoursTable.mjs";
|
|
2
2
|
import { default as n } from "./getOutletTagInformation.mjs";
|
|
3
3
|
import { default as F } from "./getOutletAvailabilityInfo.mjs";
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
4
|
+
import { default as c } from "./getOutletOfflineOrderFormats.mjs";
|
|
5
|
+
import { default as b } from "./getOutletAvailableOrderFormats.mjs";
|
|
6
6
|
import { default as A } from "./getOutletFormattedDistance.mjs";
|
|
7
|
-
import { default as
|
|
7
|
+
import { default as H } from "./isOutletAcceptingPreOrders.mjs";
|
|
8
8
|
import { default as L } from "./getOutletDeliveryFee.mjs";
|
|
9
9
|
import { default as h } from "./getOutletTodayOpeningTimes.mjs";
|
|
10
10
|
import { default as k } from "./getOutletOrderFormats.mjs";
|
|
11
|
+
import { default as w } from "./serviceDateTimesFromOpeningHours.mjs";
|
|
11
12
|
import "moment";
|
|
12
13
|
import "@ancon/wildcat-types";
|
|
13
14
|
import "../shared/enums.mjs";
|
|
@@ -22,12 +23,13 @@ import "lodash";
|
|
|
22
23
|
export {
|
|
23
24
|
d as getListOutletOpeningHoursTable,
|
|
24
25
|
F as getOutletAvailabilityInfo,
|
|
25
|
-
|
|
26
|
+
b as getOutletAvailableOrderFormats,
|
|
26
27
|
L as getOutletDeliveryFee,
|
|
27
28
|
A as getOutletFormattedDistance,
|
|
28
|
-
|
|
29
|
+
c as getOutletOfflineOrderFormats,
|
|
29
30
|
k as getOutletOrderFormats,
|
|
30
31
|
n as getOutletTagInformation,
|
|
31
32
|
h as getOutletTodayOpeningTimes,
|
|
32
|
-
|
|
33
|
+
H as isOutletAcceptingPreOrders,
|
|
34
|
+
w as serviceDateTimesFromOpeningHours
|
|
33
35
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ServiceDateTime } from '@ancon/wildcat-types';
|
|
2
|
+
export declare type OutletDetailsOpeningHour = {
|
|
3
|
+
type: 0;
|
|
4
|
+
state: 0;
|
|
5
|
+
orderFormat: 8;
|
|
6
|
+
dayOfWeek: 8;
|
|
7
|
+
unformattedPeriodFrom: '1900-01-01T00:00:00Z';
|
|
8
|
+
periodFrom: '1900-01-01T00:00:00';
|
|
9
|
+
unformattedPeriodTo: '2200-01-01T00:00:00Z';
|
|
10
|
+
periodTo: '2200-01-01T00:00:00';
|
|
11
|
+
from: '23:00:00';
|
|
12
|
+
duration: '06:00:00';
|
|
13
|
+
reason: '';
|
|
14
|
+
isDefault: false;
|
|
15
|
+
position: 0;
|
|
16
|
+
};
|
|
17
|
+
export default function serviceDateTimesFromOpeningHours({ openingHours, }: {
|
|
18
|
+
openingHours: OutletDetailsOpeningHour[];
|
|
19
|
+
}): ServiceDateTime[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("moment");function u({openingHours:s}){const e=s.reduce((o,r)=>{o[r.orderFormat]||(o[r.orderFormat]={orderFormats:r.orderFormat,intervals:[],isDefault:r.isDefault});const[t,a]=r.duration.split(":");return o[r.orderFormat].intervals.push({start:r.from,duration:r.duration,end:n(r.from,"HH:mm:ss").add(t,"hours").add(a,"minutes").format("HH:mm:ss"),fromDate:r.unformattedPeriodFrom,toDate:r.unformattedPeriodTo,type:r.type,position:r.position,state:r.state,dayOfWeek:r.dayOfWeek,isDefault:r.isDefault,reason:r.reason}),o},{});return Object.values(e)}module.exports=u;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import n from "moment";
|
|
2
|
+
function u({
|
|
3
|
+
openingHours: s
|
|
4
|
+
}) {
|
|
5
|
+
const t = s.reduce(
|
|
6
|
+
(o, r) => {
|
|
7
|
+
o[r.orderFormat] || (o[r.orderFormat] = {
|
|
8
|
+
orderFormats: r.orderFormat,
|
|
9
|
+
intervals: [],
|
|
10
|
+
isDefault: r.isDefault
|
|
11
|
+
});
|
|
12
|
+
const [a, e] = r.duration.split(":");
|
|
13
|
+
return o[r.orderFormat].intervals.push({
|
|
14
|
+
start: r.from,
|
|
15
|
+
duration: r.duration,
|
|
16
|
+
end: n(r.from, "HH:mm:ss").add(a, "hours").add(e, "minutes").format("HH:mm:ss"),
|
|
17
|
+
fromDate: r.unformattedPeriodFrom,
|
|
18
|
+
toDate: r.unformattedPeriodTo,
|
|
19
|
+
type: r.type,
|
|
20
|
+
position: r.position,
|
|
21
|
+
state: r.state,
|
|
22
|
+
dayOfWeek: r.dayOfWeek,
|
|
23
|
+
isDefault: r.isDefault,
|
|
24
|
+
reason: r.reason
|
|
25
|
+
}), o;
|
|
26
|
+
},
|
|
27
|
+
{}
|
|
28
|
+
);
|
|
29
|
+
return Object.values(t);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
u as default
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancon/wildcat-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -161,6 +161,11 @@
|
|
|
161
161
|
"require": "./outlet/searchNextOpeningMoment.js",
|
|
162
162
|
"types": "./outlet/searchNextOpeningMoment.d.ts"
|
|
163
163
|
},
|
|
164
|
+
"./outlet/serviceDateTimesFromOpeningHours": {
|
|
165
|
+
"import": "./outlet/serviceDateTimesFromOpeningHours.mjs",
|
|
166
|
+
"require": "./outlet/serviceDateTimesFromOpeningHours.js",
|
|
167
|
+
"types": "./outlet/serviceDateTimesFromOpeningHours.d.ts"
|
|
168
|
+
},
|
|
164
169
|
"./outlet/types": {
|
|
165
170
|
"import": "./outlet/types.mjs",
|
|
166
171
|
"require": "./outlet/types.js",
|