@ancon/wildcat-utils 1.10.2 → 1.12.0
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.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +39 -29
- package/outlet/getListOutletOpeningHoursTable.js +1 -1
- package/outlet/getListOutletOpeningHoursTable.mjs +36 -35
- package/outlet/index.d.ts +2 -1
- package/outlet/index.js +1 -1
- package/outlet/index.mjs +3 -2
- package/outlet/types.d.ts +2 -1
- package/package.json +26 -1
- package/printing/getPrinterType.d.ts +8 -0
- package/printing/getPrinterType.js +1 -0
- package/printing/getPrinterType.mjs +15 -0
- package/printing/index.d.ts +5 -0
- package/printing/index.js +1 -0
- package/printing/index.mjs +12 -0
- package/printing/isValidNetworkPrinter.d.ts +10 -0
- package/printing/isValidNetworkPrinter.js +1 -0
- package/printing/isValidNetworkPrinter.mjs +7 -0
- package/printing/isValidPrinter.d.ts +8 -0
- package/printing/isValidPrinter.js +1 -0
- package/printing/isValidPrinter.mjs +8 -0
- package/printing/isValidStarCloudPrinter.d.ts +10 -0
- package/printing/isValidStarCloudPrinter.js +1 -0
- package/printing/isValidStarCloudPrinter.mjs +7 -0
- package/user/getFullAddressString.d.ts +2 -2
- package/user/getFullAddressString.js +1 -1
- package/user/getFullAddressString.mjs +1 -1
- package/user/getFullName.d.ts +3 -2
- package/user/getFullName.js +1 -1
- package/user/getFullName.mjs +1 -1
- package/user/index.d.ts +3 -2
- package/user/index.js +1 -1
- package/user/index.mjs +4 -4
package/index.d.ts
CHANGED
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"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/enums.js"),r=require("./shared/isWithinFlag.js"),i=require("./shared/generateId.js"),t=require("./outlet/getListOutletOpeningHoursTable.js"),n=require("./versioning/isVersionALessThanB.js"),s=require("./versioning/cleanVersionString.js"),o=require("./api/getUrlAndParams.js"),g=require("./api/getEndpointWithVersion.js"),l=require("./string/slugify.js"),u=require("./color/lighten.js"),a=require("./color/brighten.js"),c=require("./color/darken.js"),d=require("./user/getFullName.js"),q=require("./user/getFullAddressString.js"),_=require("./logger/Logger.js"),p=require("./logger/types.js"),h=require("./printing/isValidPrinter.js"),V=require("./printing/isValidNetworkPrinter.js"),y=require("./printing/isValidStarCloudPrinter.js"),P=require("./printing/getPrinterType.js");require("moment");require("@ancon/wildcat-types");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=i;exports.getListOutletOpeningHoursTable=t;exports.isVersionALessThanB=n;exports.cleanVersionString=s;exports.getUrlAndParams=o;exports.getEndpointWithVersion=g;exports.slugify=l;exports.lighten=u;exports.brighten=a;exports.darken=c;exports.getFullName=d;exports.getFullAddressString=q;exports.Logger=_;exports.LogLevel=p.LogLevel;exports.isValidPrinter=h;exports.isValidNetworkPrinter=V;exports.isValidStarCloudPrinter=y;exports.getPrinterType=P;
|
package/index.mjs
CHANGED
|
@@ -1,40 +1,50 @@
|
|
|
1
|
-
import { DayOfWeek as
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
10
|
-
import { default as
|
|
1
|
+
import { DayOfWeek as s, IntervalState as i, IntervalType as d, OrderFormat as p } from "./shared/enums.mjs";
|
|
2
|
+
import { default as u } from "./shared/isWithinFlag.mjs";
|
|
3
|
+
import { default as x } from "./shared/generateId.mjs";
|
|
4
|
+
import { default as V } from "./outlet/getListOutletOpeningHoursTable.mjs";
|
|
5
|
+
import { default as L } from "./versioning/isVersionALessThanB.mjs";
|
|
6
|
+
import { default as y } from "./versioning/cleanVersionString.mjs";
|
|
7
|
+
import { default as O } from "./api/getUrlAndParams.mjs";
|
|
8
|
+
import { default as T } from "./api/getEndpointWithVersion.mjs";
|
|
9
|
+
import { default as v } from "./string/slugify.mjs";
|
|
10
|
+
import { default as I } from "./color/lighten.mjs";
|
|
11
11
|
import { default as b } from "./color/brighten.mjs";
|
|
12
12
|
import { default as c } from "./color/darken.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { default as
|
|
13
|
+
import { default as B } from "./user/getFullName.mjs";
|
|
14
|
+
import { default as D } from "./user/getFullAddressString.mjs";
|
|
15
|
+
import { default as H } from "./logger/Logger.mjs";
|
|
16
16
|
import { LogLevel as j } from "./logger/types.mjs";
|
|
17
|
+
import { default as z } from "./printing/isValidPrinter.mjs";
|
|
18
|
+
import { default as J } from "./printing/isValidNetworkPrinter.mjs";
|
|
19
|
+
import { default as M } from "./printing/isValidStarCloudPrinter.mjs";
|
|
20
|
+
import { default as R } from "./printing/getPrinterType.mjs";
|
|
17
21
|
import "moment";
|
|
22
|
+
import "@ancon/wildcat-types";
|
|
18
23
|
import "compare-versions";
|
|
19
24
|
import "tinycolor2";
|
|
25
|
+
import "@ancon/wildcat-printing";
|
|
20
26
|
export {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
s as DayOfWeek,
|
|
28
|
+
i as IntervalState,
|
|
29
|
+
d as IntervalType,
|
|
24
30
|
j as LogLevel,
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
H as Logger,
|
|
32
|
+
p as OrderFormat,
|
|
27
33
|
b as brighten,
|
|
28
|
-
|
|
34
|
+
y as cleanVersionString,
|
|
29
35
|
c as darken,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
x as generateId,
|
|
37
|
+
T as getEndpointWithVersion,
|
|
38
|
+
D as getFullAddressString,
|
|
39
|
+
B as getFullName,
|
|
40
|
+
V as getListOutletOpeningHoursTable,
|
|
41
|
+
R as getPrinterType,
|
|
42
|
+
O as getUrlAndParams,
|
|
43
|
+
J as isValidNetworkPrinter,
|
|
44
|
+
z as isValidPrinter,
|
|
45
|
+
M as isValidStarCloudPrinter,
|
|
46
|
+
L as isVersionALessThanB,
|
|
47
|
+
u as isWithinFlag,
|
|
48
|
+
I as lighten,
|
|
49
|
+
v as slugify
|
|
40
50
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const W=require("moment"),p=require("@ancon/wildcat-types"),s=require("../shared/enums.js"),F=require("../shared/isWithinFlag.js"),k=require("../shared/generateId.js"),l=[{id:p.OrderFormat.EatIn,name:"eatIn"},{id:p.OrderFormat.TakeAway,name:"takeaway"},{id:p.OrderFormat.TableOrder,name:"tableOrder"},{id:p.OrderFormat.Delivery,name:"delivery"}];function v(e){const r=W.utc(e).subtract(1,"day").startOf("day"),t=[];for(let i=0,o=r;i<7;i+=1)o=o.clone().add(1,"day").startOf("day"),t.push(o.clone());return t}function S(e){return[...e].sort((r,t)=>r.isoWeekday()-t.isoWeekday())}function g(e){return e.split(":").map(Number)}function T(e,r){const[t,i]=g(e.start),[o,a]=g(e.duration);if(e.type===s.IntervalType.Interval){const n=r.clone().add(t,"hour").add(i,"minute"),u=n.clone().add(o,"hour").add(a,"minute");return{id:e.id,start:n.toISOString(),end:u.toISOString()}}if(e.type===s.IntervalType.Exception){const n=W(e.fromDate),u=W(e.toDate);if(r.isBetween(n,u,void 0,"[]")){const O=r.clone().add(t,"hour").add(i,"minute"),y=O.clone().add(o,"hour").add(a,"minute");return{id:e.id,start:O.toISOString(),end:y.toISOString(),reason:e.reason}}return null}throw new Error("Invalid interval type")}function h(e,r,t){const i={[s.DayOfWeek.Monday]:1,[s.DayOfWeek.Tuesday]:2,[s.DayOfWeek.Wednesday]:3,[s.DayOfWeek.Thursday]:4,[s.DayOfWeek.Friday]:5,[s.DayOfWeek.Saturday]:6,[s.DayOfWeek.Sunday]:7};for(let o=0;o<r.length;o+=1){const a=r[o],n=a.isoWeekday(),u=e.dayOfWeek,y=(i[u]??null)===n||u===s.DayOfWeek.Everyday;if(t[n]||(t[n]={isoWeekday:n,key:"",open:[],adjusted:[],closed:[]}),y){const d=T(e,a);d&&(t[n].key+=d.id,e.type===s.IntervalType.Interval&&e.state===s.IntervalState.Open?t[n].open.push(d):e.type===s.IntervalType.Interval&&e.state===s.IntervalState.Closed?t[n].closed.push(d):e.type===s.IntervalType.Exception&&e.state===s.IntervalState.Open?t[n].adjusted.push(d):e.type===s.IntervalType.Exception&&e.state===s.IntervalState.Closed&&t[n].closed.push(d))}}}function D(e){switch(e.type){case s.IntervalType.Exception:return k("interval-exception");case s.IntervalType.Interval:return k("interval-normal");default:return k("interval-unknown")}}function M(e){const r=e.reduce((t,i)=>(l.forEach(o=>{F(o.id,i.orderFormats)&&(t[o.id]||(t[o.id]={orderFormat:o,intervals:[]}),t[o.id].intervals.push(...i.intervals.sort((a,n)=>a.dayOfWeek-n.dayOfWeek)))}),t),{});return Object.values(r)}function H(e){return e.reduce((r,t,i)=>{const o=r.findIndex(a=>a!==t&&!a.orderFormats.some(n=>t.orderFormats.some(u=>u.id===n.id))&&a.openingHours.every(n=>t.openingHours.some(u=>u.key===n.key))&&t.openingHours.every(n=>a.openingHours.some(u=>u.key===n.key)));if(o>=0){const a=r[o];return r.splice(o,1,{...a,orderFormats:[...t.orderFormats,...a.orderFormats]}),r.splice(i,1),r}return r},[...e])}function E(e){return e.map(r=>({...r,intervals:r.intervals.map(t=>({...t,id:D(t)}))}))}function w(e,r){const t=M(E(e.serviceDateTimes)),i=v(r),o=S(i),a=t.reduce((y,d)=>(y[d.orderFormat.id]||(y[d.orderFormat.id]={}),d.intervals.reduce((I,m)=>(h(m,o,I),I),y[d.orderFormat.id]),y),{}),n={[p.OrderFormat.EatIn]:l[0],[p.OrderFormat.TakeAway]:l[1],[p.OrderFormat.TableOrder]:l[2],[p.OrderFormat.Delivery]:l[3]},u=Object.entries(a).map(([y,d])=>({orderFormats:[n[Number(y)]],openingHours:Object.entries(d).map(([I,m])=>({isoWeekday:Number(I),key:m.key,open:m.open.sort((c,f)=>c.start.localeCompare(f.start)),adjusted:m.adjusted.sort((c,f)=>c.start.localeCompare(f.start)),closed:m.closed.sort((c,f)=>c.start.localeCompare(f.start))}))}));return H(u).sort((y,d)=>y.orderFormats[0].id-d.orderFormats[0].id)}module.exports=w;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import F from "moment";
|
|
2
|
-
import { OrderFormat as p
|
|
2
|
+
import { OrderFormat as p } from "@ancon/wildcat-types";
|
|
3
|
+
import { DayOfWeek as m, IntervalType as y, IntervalState as O } from "../shared/enums.mjs";
|
|
3
4
|
import h from "../shared/isWithinFlag.mjs";
|
|
4
5
|
import W from "../shared/generateId.mjs";
|
|
5
6
|
const k = [
|
|
6
7
|
{ id: p.EatIn, name: "eatIn" },
|
|
7
|
-
{ id: p.
|
|
8
|
+
{ id: p.TakeAway, name: "takeaway" },
|
|
8
9
|
{ id: p.TableOrder, name: "tableOrder" },
|
|
9
10
|
{ id: p.Delivery, name: "delivery" }
|
|
10
11
|
];
|
|
11
12
|
function M(e) {
|
|
12
13
|
const r = F.utc(e).subtract(1, "day").startOf("day"), t = [];
|
|
13
|
-
for (let a = 0,
|
|
14
|
-
|
|
14
|
+
for (let a = 0, n = r; a < 7; a += 1)
|
|
15
|
+
n = n.clone().add(1, "day").startOf("day"), t.push(n.clone());
|
|
15
16
|
return t;
|
|
16
17
|
}
|
|
17
18
|
function v(e) {
|
|
@@ -21,21 +22,21 @@ function S(e) {
|
|
|
21
22
|
return e.split(":").map(Number);
|
|
22
23
|
}
|
|
23
24
|
function H(e, r) {
|
|
24
|
-
const [t, a] = S(e.start), [
|
|
25
|
+
const [t, a] = S(e.start), [n, s] = S(
|
|
25
26
|
e.duration
|
|
26
27
|
);
|
|
27
28
|
if (e.type === y.Interval) {
|
|
28
|
-
const
|
|
29
|
+
const o = r.clone().add(t, "hour").add(a, "minute"), i = o.clone().add(n, "hour").add(s, "minute");
|
|
29
30
|
return {
|
|
30
31
|
id: e.id,
|
|
31
|
-
start:
|
|
32
|
+
start: o.toISOString(),
|
|
32
33
|
end: i.toISOString()
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
if (e.type === y.Exception) {
|
|
36
|
-
const
|
|
37
|
-
if (r.isBetween(
|
|
38
|
-
const I = r.clone().add(t, "hour").add(a, "minute"), u = I.clone().add(
|
|
37
|
+
const o = F(e.fromDate), i = F(e.toDate);
|
|
38
|
+
if (r.isBetween(o, i, void 0, "[]")) {
|
|
39
|
+
const I = r.clone().add(t, "hour").add(a, "minute"), u = I.clone().add(n, "hour").add(s, "minute");
|
|
39
40
|
return {
|
|
40
41
|
id: e.id,
|
|
41
42
|
start: I.toISOString(),
|
|
@@ -57,17 +58,17 @@ function E(e, r, t) {
|
|
|
57
58
|
[m.Saturday]: 6,
|
|
58
59
|
[m.Sunday]: 7
|
|
59
60
|
};
|
|
60
|
-
for (let
|
|
61
|
-
const s = r[
|
|
62
|
-
if (t[
|
|
63
|
-
isoWeekday:
|
|
61
|
+
for (let n = 0; n < r.length; n += 1) {
|
|
62
|
+
const s = r[n], o = s.isoWeekday(), i = e.dayOfWeek, u = (a[i] ?? null) === o || i === m.Everyday;
|
|
63
|
+
if (t[o] || (t[o] = {
|
|
64
|
+
isoWeekday: o,
|
|
64
65
|
key: "",
|
|
65
66
|
open: [],
|
|
66
67
|
adjusted: [],
|
|
67
68
|
closed: []
|
|
68
69
|
}), u) {
|
|
69
70
|
const d = H(e, s);
|
|
70
|
-
d && (t[
|
|
71
|
+
d && (t[o].key += d.id, e.type === y.Interval && e.state === O.Open ? t[o].open.push(d) : e.type === y.Interval && e.state === O.Closed ? t[o].closed.push(d) : e.type === y.Exception && e.state === O.Open ? t[o].adjusted.push(d) : e.type === y.Exception && e.state === O.Closed && t[o].closed.push(d));
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -83,13 +84,13 @@ function T(e) {
|
|
|
83
84
|
}
|
|
84
85
|
function x(e) {
|
|
85
86
|
const r = e.reduce(
|
|
86
|
-
(t, a) => (k.forEach((
|
|
87
|
-
h(
|
|
88
|
-
orderFormat:
|
|
87
|
+
(t, a) => (k.forEach((n) => {
|
|
88
|
+
h(n.id, a.orderFormats) && (t[n.id] || (t[n.id] = {
|
|
89
|
+
orderFormat: n,
|
|
89
90
|
intervals: []
|
|
90
|
-
}), t[
|
|
91
|
+
}), t[n.id].intervals.push(
|
|
91
92
|
...a.intervals.sort(
|
|
92
|
-
(s,
|
|
93
|
+
(s, o) => s.dayOfWeek - o.dayOfWeek
|
|
93
94
|
)
|
|
94
95
|
));
|
|
95
96
|
}), t),
|
|
@@ -100,20 +101,20 @@ function x(e) {
|
|
|
100
101
|
function j(e) {
|
|
101
102
|
return e.reduce(
|
|
102
103
|
(r, t, a) => {
|
|
103
|
-
const
|
|
104
|
+
const n = r.findIndex(
|
|
104
105
|
(s) => s !== t && !s.orderFormats.some(
|
|
105
|
-
(
|
|
106
|
-
(i) => i.id ===
|
|
106
|
+
(o) => t.orderFormats.some(
|
|
107
|
+
(i) => i.id === o.id
|
|
107
108
|
)
|
|
108
109
|
) && s.openingHours.every(
|
|
109
|
-
(
|
|
110
|
+
(o) => t.openingHours.some((i) => i.key === o.key)
|
|
110
111
|
) && t.openingHours.every(
|
|
111
|
-
(
|
|
112
|
+
(o) => s.openingHours.some((i) => i.key === o.key)
|
|
112
113
|
)
|
|
113
114
|
);
|
|
114
|
-
if (
|
|
115
|
-
const s = r[
|
|
116
|
-
return r.splice(
|
|
115
|
+
if (n >= 0) {
|
|
116
|
+
const s = r[n];
|
|
117
|
+
return r.splice(n, 1, {
|
|
117
118
|
...s,
|
|
118
119
|
orderFormats: [...t.orderFormats, ...s.orderFormats]
|
|
119
120
|
}), r.splice(a, 1), r;
|
|
@@ -132,21 +133,21 @@ function w(e) {
|
|
|
132
133
|
}))
|
|
133
134
|
}));
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function B(e, r) {
|
|
136
137
|
const t = x(
|
|
137
138
|
w(e.serviceDateTimes)
|
|
138
|
-
), a = M(r),
|
|
139
|
-
(u, d) => (u[d.orderFormat.id] || (u[d.orderFormat.id] = {}), d.intervals.reduce((g, f) => (E(f,
|
|
139
|
+
), a = M(r), n = v(a), s = t.reduce(
|
|
140
|
+
(u, d) => (u[d.orderFormat.id] || (u[d.orderFormat.id] = {}), d.intervals.reduce((g, f) => (E(f, n, g), g), u[d.orderFormat.id]), u),
|
|
140
141
|
{}
|
|
141
|
-
),
|
|
142
|
+
), o = {
|
|
142
143
|
[p.EatIn]: k[0],
|
|
143
|
-
[p.
|
|
144
|
+
[p.TakeAway]: k[1],
|
|
144
145
|
[p.TableOrder]: k[2],
|
|
145
146
|
[p.Delivery]: k[3]
|
|
146
147
|
}, i = Object.entries(
|
|
147
148
|
s
|
|
148
149
|
).map(([u, d]) => ({
|
|
149
|
-
orderFormats: [
|
|
150
|
+
orderFormats: [o[Number(u)]],
|
|
150
151
|
openingHours: Object.entries(d).map(
|
|
151
152
|
([g, f]) => ({
|
|
152
153
|
isoWeekday: Number(g),
|
|
@@ -168,5 +169,5 @@ function A(e, r) {
|
|
|
168
169
|
);
|
|
169
170
|
}
|
|
170
171
|
export {
|
|
171
|
-
|
|
172
|
+
B as default
|
|
172
173
|
};
|
package/outlet/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import getListOutletOpeningHoursTable from './getListOutletOpeningHoursTable';
|
|
2
|
+
export { getListOutletOpeningHoursTable };
|
package/outlet/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getListOutletOpeningHoursTable.js");require("moment");require("../shared/enums.js");require("../shared/isWithinFlag.js");require("../shared/generateId.js");exports.getListOutletOpeningHoursTable=e;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getListOutletOpeningHoursTable.js");require("moment");require("@ancon/wildcat-types");require("../shared/enums.js");require("../shared/isWithinFlag.js");require("../shared/generateId.js");exports.getListOutletOpeningHoursTable=e;
|
package/outlet/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { default as
|
|
1
|
+
import { default as a } from "./getListOutletOpeningHoursTable.mjs";
|
|
2
2
|
import "moment";
|
|
3
|
+
import "@ancon/wildcat-types";
|
|
3
4
|
import "../shared/enums.mjs";
|
|
4
5
|
import "../shared/isWithinFlag.mjs";
|
|
5
6
|
import "../shared/generateId.mjs";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
+
a as getListOutletOpeningHoursTable
|
|
8
9
|
};
|
package/outlet/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OrderFormat } from '@ancon/wildcat-types';
|
|
2
|
+
import { DayOfWeek, IntervalState, IntervalType } from '../shared';
|
|
2
3
|
/** HH:mm:ss */
|
|
3
4
|
export declare type IntervalTimestamp = string;
|
|
4
5
|
export declare type Interval = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancon/wildcat-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.cjs",
|
|
6
6
|
"module": "index.js",
|
|
@@ -76,6 +76,31 @@
|
|
|
76
76
|
"require": "./outlet/types.cjs",
|
|
77
77
|
"types": "./outlet/types.d.ts"
|
|
78
78
|
},
|
|
79
|
+
"./printing/getPrinterType": {
|
|
80
|
+
"import": "./printing/getPrinterType.js",
|
|
81
|
+
"require": "./printing/getPrinterType.cjs",
|
|
82
|
+
"types": "./printing/getPrinterType.d.ts"
|
|
83
|
+
},
|
|
84
|
+
"./printing": {
|
|
85
|
+
"import": "./printing/index.js",
|
|
86
|
+
"require": "./printing/index.cjs",
|
|
87
|
+
"types": "./printing/index.d.ts"
|
|
88
|
+
},
|
|
89
|
+
"./printing/isValidNetworkPrinter": {
|
|
90
|
+
"import": "./printing/isValidNetworkPrinter.js",
|
|
91
|
+
"require": "./printing/isValidNetworkPrinter.cjs",
|
|
92
|
+
"types": "./printing/isValidNetworkPrinter.d.ts"
|
|
93
|
+
},
|
|
94
|
+
"./printing/isValidPrinter": {
|
|
95
|
+
"import": "./printing/isValidPrinter.js",
|
|
96
|
+
"require": "./printing/isValidPrinter.cjs",
|
|
97
|
+
"types": "./printing/isValidPrinter.d.ts"
|
|
98
|
+
},
|
|
99
|
+
"./printing/isValidStarCloudPrinter": {
|
|
100
|
+
"import": "./printing/isValidStarCloudPrinter.js",
|
|
101
|
+
"require": "./printing/isValidStarCloudPrinter.cjs",
|
|
102
|
+
"types": "./printing/isValidStarCloudPrinter.d.ts"
|
|
103
|
+
},
|
|
79
104
|
"./shared/enums": {
|
|
80
105
|
"import": "./shared/enums.js",
|
|
81
106
|
"require": "./shared/enums.cjs",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PrinterType } from '@ancon/wildcat-printing';
|
|
2
|
+
/**
|
|
3
|
+
* Get a `PrinterType` (EscPos/Star) enum from a printer's `connectionType`
|
|
4
|
+
* @param printer Printer object
|
|
5
|
+
* @returns PrinterType enum
|
|
6
|
+
*/
|
|
7
|
+
declare function getPrinterType(printer: unknown): PrinterType;
|
|
8
|
+
export default getPrinterType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("@ancon/wildcat-printing"),n=require("@ancon/wildcat-types");function i(r){const e=r;switch(e==null?void 0:e.connectionType){case n.PrinterConnectionType.StarCloudPrint:return t.PrinterType.Star;case n.PrinterConnectionType.HostAddress:default:return t.PrinterType.EscPos}}module.exports=i;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PrinterType as r } from "@ancon/wildcat-printing";
|
|
2
|
+
import { PrinterConnectionType as e } from "@ancon/wildcat-types";
|
|
3
|
+
function c(n) {
|
|
4
|
+
const t = n;
|
|
5
|
+
switch (t == null ? void 0 : t.connectionType) {
|
|
6
|
+
case e.StarCloudPrint:
|
|
7
|
+
return r.Star;
|
|
8
|
+
case e.HostAddress:
|
|
9
|
+
default:
|
|
10
|
+
return r.EscPos;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
c as default
|
|
15
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import isValidPrinter from './isValidPrinter';
|
|
2
|
+
import isValidNetworkPrinter from './isValidNetworkPrinter';
|
|
3
|
+
import isValidStarCloudPrinter from './isValidStarCloudPrinter';
|
|
4
|
+
import getPrinterType from './getPrinterType';
|
|
5
|
+
export { getPrinterType, isValidPrinter, isValidNetworkPrinter, isValidStarCloudPrinter, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./isValidPrinter.js"),i=require("./isValidNetworkPrinter.js"),e=require("./isValidStarCloudPrinter.js"),t=require("./getPrinterType.js");require("@ancon/wildcat-printing");require("@ancon/wildcat-types");exports.isValidPrinter=r;exports.isValidNetworkPrinter=i;exports.isValidStarCloudPrinter=e;exports.getPrinterType=t;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as i } from "./isValidPrinter.mjs";
|
|
2
|
+
import { default as d } from "./isValidNetworkPrinter.mjs";
|
|
3
|
+
import { default as l } from "./isValidStarCloudPrinter.mjs";
|
|
4
|
+
import { default as s } from "./getPrinterType.mjs";
|
|
5
|
+
import "@ancon/wildcat-printing";
|
|
6
|
+
import "@ancon/wildcat-types";
|
|
7
|
+
export {
|
|
8
|
+
s as getPrinterType,
|
|
9
|
+
d as isValidNetworkPrinter,
|
|
10
|
+
i as isValidPrinter,
|
|
11
|
+
l as isValidStarCloudPrinter
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Printer, PrinterHostAddress } from '@ancon/wildcat-types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if printer is a valid network printer
|
|
4
|
+
* @param printer Printer object
|
|
5
|
+
* @returns Whether the printer object is considered a valid network printer
|
|
6
|
+
*/
|
|
7
|
+
declare function isValidNetworkPrinter(printer: unknown): printer is Printer & {
|
|
8
|
+
hostAddress: PrinterHostAddress;
|
|
9
|
+
};
|
|
10
|
+
export default isValidNetworkPrinter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function u(t){const o=t==null?void 0:t.hostAddress;return!!(o!=null&&o.host)&&(o==null?void 0:o.port)!=null}module.exports=u;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Printer } from '@ancon/wildcat-types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if printer is a valid printer (valid network printer OR valid Star Cloud printer)
|
|
4
|
+
* @param printer Printer object
|
|
5
|
+
* @returns Whether the printer object is considered a valid printer
|
|
6
|
+
*/
|
|
7
|
+
declare function isValidPrinter(printer: unknown): printer is Printer;
|
|
8
|
+
export default isValidPrinter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("./isValidNetworkPrinter.js"),t=require("./isValidStarCloudPrinter.js");function n(i){return r(i)||t(i)}module.exports=n;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Printer } from '@ancon/wildcat-types';
|
|
2
|
+
/**
|
|
3
|
+
* Check if printer is a valid Star Cloud printer
|
|
4
|
+
* @param printer Printer object
|
|
5
|
+
* @returns Whether the printer object is considered a valid Star Cloud printer
|
|
6
|
+
*/
|
|
7
|
+
declare function isValidStarCloudPrinter(printer: unknown): printer is Printer & {
|
|
8
|
+
macAddress: string;
|
|
9
|
+
};
|
|
10
|
+
export default isValidStarCloudPrinter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function d(s){const t=s==null?void 0:s.macAddress;return typeof t=="string"&&t.trim().length>0}module.exports=d;
|
|
@@ -5,5 +5,5 @@ declare type Address = {
|
|
|
5
5
|
state: string;
|
|
6
6
|
zipCode: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
8
|
+
declare function getFullAddressString<T extends Nullable<Partial<Address>>>(address: T | null | undefined): string;
|
|
9
|
+
export default getFullAddressString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";function e(t){return t&&[t.street,t.city,t.state,t.zipCode].filter(Boolean).join(", ")||""}module.exports=e;
|
package/user/getFullName.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare function getFullName(arr: (string | null | undefined)[], fallback?: string): string;
|
|
2
|
+
declare function getFullName(obj: {
|
|
3
3
|
firstName?: string | null;
|
|
4
4
|
lastName?: string | null;
|
|
5
5
|
} | null | undefined, fallback?: string): string;
|
|
6
|
+
export default getFullName;
|
package/user/getFullName.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";function n(t,r="N/A"){try{if(Array.isArray(t))return t.filter(Boolean).join(" ")||r;const e=t;return e&&[e.firstName,e.lastName].filter(Boolean).join(" ")||r}catch{return r}}module.exports=n;
|
package/user/getFullName.mjs
CHANGED
package/user/index.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import getFullName from './getFullName';
|
|
2
|
+
import getFullAddressString from './getFullAddressString';
|
|
3
|
+
export { getFullName, getFullAddressString };
|
package/user/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getFullName.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getFullName.js"),r=require("./getFullAddressString.js");exports.getFullName=e;exports.getFullAddressString=r;
|
package/user/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { default as l } from "./getFullName.mjs";
|
|
2
|
+
import { default as a } from "./getFullAddressString.mjs";
|
|
3
3
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
a as getFullAddressString,
|
|
5
|
+
l as getFullName
|
|
6
6
|
};
|