@ancon/wildcat-utils 1.18.8 → 1.20.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/checkout/getCheckoutItemsMappedByTicketItemStatus.d.ts +15 -0
- package/checkout/getCheckoutItemsMappedByTicketItemStatus.js +1 -0
- package/checkout/getCheckoutItemsMappedByTicketItemStatus.mjs +14 -0
- package/checkout/getCheckoutOrderStatusTexts.d.ts +60 -0
- package/checkout/getCheckoutOrderStatusTexts.js +1 -0
- package/checkout/getCheckoutOrderStatusTexts.mjs +157 -0
- package/checkout/index.d.ts +3 -1
- package/checkout/index.js +1 -1
- package/checkout/index.mjs +9 -4
- package/checkout/isCheckoutOrderSummary.d.ts +17 -0
- package/checkout/isCheckoutOrderSummary.js +1 -0
- package/checkout/isCheckoutOrderSummary.mjs +6 -0
- package/index.js +1 -1
- package/index.mjs +82 -77
- package/package.json +16 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TicketItemStatus } from '@ancon/wildcat-types';
|
|
2
|
+
declare type CheckoutOrderSummaryItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
ticketItem: {
|
|
5
|
+
status: TicketItemStatus;
|
|
6
|
+
ticketItemId: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare type MappedItems = {
|
|
10
|
+
all: CheckoutOrderSummaryItem[];
|
|
11
|
+
ready: CheckoutOrderSummaryItem[];
|
|
12
|
+
done: CheckoutOrderSummaryItem[];
|
|
13
|
+
};
|
|
14
|
+
declare function getCheckoutItemsMappedByTicketItemStatus(items: CheckoutOrderSummaryItem[]): MappedItems;
|
|
15
|
+
export default getCheckoutItemsMappedByTicketItemStatus;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("@ancon/wildcat-types");function r(s){return s.reduce((t,e)=>e.ticketItem.status===u.TicketItemStatus.Ready?(t.ready.push(e),t):(e.ticketItem.status===u.TicketItemStatus.Closed&&t.done.push(e),t),{all:s,ready:[],done:[]})}module.exports=r;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TicketItemStatus as r } from "@ancon/wildcat-types";
|
|
2
|
+
function a(s) {
|
|
3
|
+
return s.reduce(
|
|
4
|
+
(e, t) => t.ticketItem.status === r.Ready ? (e.ready.push(t), e) : (t.ticketItem.status === r.Closed && e.done.push(t), e),
|
|
5
|
+
{
|
|
6
|
+
all: s,
|
|
7
|
+
ready: [],
|
|
8
|
+
done: []
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
a as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CheckoutStatus, OrderFormat, TicketItemStatus, TicketStatus } from '@ancon/wildcat-types';
|
|
2
|
+
declare type CheckoutOrderSummaryItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
ticketItem: {
|
|
5
|
+
status: TicketItemStatus;
|
|
6
|
+
ticketItemId: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare type CheckoutSummary = {
|
|
10
|
+
orderFormat: OrderFormat;
|
|
11
|
+
items: CheckoutOrderSummaryItem[];
|
|
12
|
+
};
|
|
13
|
+
declare type Options = {
|
|
14
|
+
useMarkAsPickedUp: boolean;
|
|
15
|
+
pickupTimeUpdated: boolean;
|
|
16
|
+
} & ({
|
|
17
|
+
checkoutStatus: CheckoutStatus;
|
|
18
|
+
ticketStatus?: never;
|
|
19
|
+
} | {
|
|
20
|
+
checkoutStatus?: never;
|
|
21
|
+
ticketStatus: TicketStatus;
|
|
22
|
+
});
|
|
23
|
+
declare type Translation = {
|
|
24
|
+
title: string;
|
|
25
|
+
message?: string;
|
|
26
|
+
};
|
|
27
|
+
declare enum TranslationKey {
|
|
28
|
+
YourOrderIsBeingProcessed = "yourOrderIsBeingProcessed",
|
|
29
|
+
YourOrderWasCancelled = "yourOrderWasCancelled",
|
|
30
|
+
ProcessingPayment = "processingPayment",
|
|
31
|
+
YourOrderIsBeingPrepared = "yourOrderIsBeingPrepared",
|
|
32
|
+
YourOrderIsReadyToCollect = "yourOrderIsReadyToCollect",
|
|
33
|
+
YourOrderHasBeenCompleted = "yourOrderHasBeenCompleted",
|
|
34
|
+
YourOrderWillArriveAtYourTable = "yourOrderWillArriveAtYourTable",
|
|
35
|
+
ModifiedDeliveryStartTime = "modifiedDeliveryStartTime",
|
|
36
|
+
ModifiedPickUpTime = "modifiedPickUpTime",
|
|
37
|
+
YourOrderHasBeenAcceptedEstimatedTime = "yourOrderHasBeenAcceptedEstimatedTime",
|
|
38
|
+
YourOrderHasBeenAcceptedPickupTime = "yourOrderHasBeenAcceptedPickupTime",
|
|
39
|
+
YourOrderIsBeingDelivered = "yourOrderIsBeingDelivered",
|
|
40
|
+
YourOrderIsReady = "yourOrderIsReady",
|
|
41
|
+
DeliveryWasCompleted = "deliveryWasCompleted",
|
|
42
|
+
OneItemIsReadyToCollect = "oneItemIsReadyToCollect",
|
|
43
|
+
MultipleItemsAreReadyToCollect = "multipleItemsAreReadyToCollect",
|
|
44
|
+
EnjoyMealWhileOtherItemsBeingPrepared = "enjoyMealWhileOtherItemsBeingPrepared"
|
|
45
|
+
}
|
|
46
|
+
declare type TranslationsWithMeta = {
|
|
47
|
+
[TranslationKey.MultipleItemsAreReadyToCollect]: ({ meta, }: {
|
|
48
|
+
meta: {
|
|
49
|
+
count: number;
|
|
50
|
+
};
|
|
51
|
+
}) => Translation;
|
|
52
|
+
[TranslationKey.EnjoyMealWhileOtherItemsBeingPrepared]: ({ meta, }: {
|
|
53
|
+
meta: {
|
|
54
|
+
count: number;
|
|
55
|
+
};
|
|
56
|
+
}) => Translation;
|
|
57
|
+
};
|
|
58
|
+
declare type TranslatedTexts = Record<Exclude<TranslationKey, keyof TranslationsWithMeta>, () => Translation> & TranslationsWithMeta;
|
|
59
|
+
declare function getOrderStatusTexts(checkout: CheckoutSummary, options: Options, texts?: TranslatedTexts): [Translation, TranslationKey];
|
|
60
|
+
export default getOrderStatusTexts;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("@ancon/wildcat-types"),p=require("./getCheckoutItemsMappedByTicketItemStatus.js");function h(r){switch(r){case e.CheckoutStatus.Created:case e.CheckoutStatus.Ready:case e.CheckoutStatus.Processing:case e.CheckoutStatus.Authorized:return"yourOrderIsBeingProcessed";case e.CheckoutStatus.Canceled:return"yourOrderWasCancelled";case e.CheckoutStatus.Received:return"processingPayment";case e.CheckoutStatus.ReadyToCollect:return"yourOrderIsReadyToCollect";default:throw new Error(`Unhandled checkout status "${r}" in getTranslationKeyByCheckoutStatus()`)}}function T(r){switch(r){case e.TicketStatus.Pending:case e.TicketStatus.PendingAccept:return"processingPayment";case e.TicketStatus.Preparing:return"yourOrderIsBeingPrepared";case e.TicketStatus.Ready:return"yourOrderIsReadyToCollect";case e.TicketStatus.Closed:return"yourOrderHasBeenCompleted";case e.TicketStatus.Canceled:return"yourOrderWasCancelled";default:throw new Error(`Unhandled ticket status "${r}" in getTranslationKeyByTicketStatus()`)}}function C({orderFormat:r},{checkoutStatus:i,ticketStatus:n,useMarkAsPickedUp:o,pickupTimeUpdated:a},t){if(o&&t.ready>0)return t.ready<2?["oneItemIsReadyToCollect"]:["multipleItemsAreReadyToCollect",{count:t.ready}];if(o&&t.done>0&&t.done<t.all)return["enjoyMealWhileOtherItemsBeingPrepared",{count:Math.max(0,t.all-t.done-t.ready)}];if(n!=null)return[T(n)];const s=h(i);if(s)return[s];const u=i===e.CheckoutStatus.Captured,c=i===e.CheckoutStatus.InProgress,y=i===e.CheckoutStatus.Canceled,l=r===e.OrderFormat.TableOrder,d=r===e.OrderFormat.Delivery;if(u)return l?["yourOrderWillArriveAtYourTable"]:a&&d?["modifiedDeliveryStartTime"]:a?["modifiedPickUpTime"]:o?["yourOrderHasBeenAcceptedPickupTime"]:["yourOrderHasBeenAcceptedEstimatedTime"];if(c)return a&&d?["modifiedDeliveryStartTime"]:d?["yourOrderIsBeingDelivered"]:a?["modifiedPickUpTime"]:o?["yourOrderHasBeenAcceptedPickupTime"]:["yourOrderHasBeenAcceptedEstimatedTime"];if(y){const m=r===e.OrderFormat.EatIn,g=r===e.OrderFormat.TakeAway;if(m||g)return o?["yourOrderHasBeenCompleted"]:["yourOrderIsReady"];if(d)return["deliveryWasCompleted"];if(l)return o?["yourOrderIsReadyToCollect"]:["yourOrderWillArriveAtYourTable"]}throw new Error("Could not resolve translation key in getTranslationKey()")}const f={yourOrderIsBeingProcessed:()=>({title:"Your order is being processed."}),yourOrderWasCancelled:()=>({title:"Your order was canceled",message:"Sorry. Your order could not go through."}),processingPayment:()=>({title:"Processing payment",message:"Please wait while your payment is being processed"}),yourOrderIsBeingPrepared:()=>({title:"Your order is now being prepared!",message:"We will let you know when it is ready for pickup."}),yourOrderIsReadyToCollect:()=>({title:"Your order is ready to be collected!",message:"Please go ahead and show this screen at the collection point"}),yourOrderHasBeenCompleted:()=>({title:"Enjoy your meal!",message:"Your order has been completed!"}),yourOrderWillArriveAtYourTable:()=>({title:"Your order has been accepted!",message:"It will arrive at your table shortly"}),modifiedDeliveryStartTime:()=>({title:"Your delivery time was modified",message:"Delivery will start at approximately 00:00."}),modifiedPickUpTime:()=>({title:"Your pickup time was modified",message:"Pickup time: 00:00"}),yourOrderHasBeenAcceptedEstimatedTime:()=>({title:"Your order has been accepted",message:"Estimated time: 00:00"}),yourOrderHasBeenAcceptedPickupTime:()=>({title:"Your order has been accepted",message:"Pickup time: 00:00"}),yourOrderIsBeingDelivered:()=>({title:"Your order is being delivered",message:"It will arrive at your door shortly. Enjoy your meal!"}),yourOrderIsReady:()=>({title:"Your order is ready",message:"Enjoy your meal!"}),deliveryWasCompleted:()=>({title:"Your order was completed",message:"Enjoy your meal!"}),oneItemIsReadyToCollect:()=>({title:"One item is ready to pick up!"}),multipleItemsAreReadyToCollect:()=>({title:"Multiple items are ready to pick up!"}),enjoyMealWhileOtherItemsBeingPrepared:({meta:r})=>({title:"Enjoy your meal while the rest of the items are being prepared!",message:`${r.count} more items are being prepared`})};function O(r,i,n=f){const o=p(r.items),[a,t]=C(r,i,{all:o.all.length,ready:o.ready.length,done:o.done.length}),s=n[a]({meta:t});if(!s)throw new Error("Could not resolve translation in getOrderStatusTexts()");return[s,a]}module.exports=O;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { CheckoutStatus as o, OrderFormat as u, TicketStatus as n } from "@ancon/wildcat-types";
|
|
2
|
+
import T from "./getCheckoutItemsMappedByTicketItemStatus.mjs";
|
|
3
|
+
function h(e) {
|
|
4
|
+
switch (e) {
|
|
5
|
+
case o.Created:
|
|
6
|
+
case o.Ready:
|
|
7
|
+
case o.Processing:
|
|
8
|
+
case o.Authorized:
|
|
9
|
+
return "yourOrderIsBeingProcessed";
|
|
10
|
+
case o.Canceled:
|
|
11
|
+
return "yourOrderWasCancelled";
|
|
12
|
+
case o.Received:
|
|
13
|
+
return "processingPayment";
|
|
14
|
+
case o.ReadyToCollect:
|
|
15
|
+
return "yourOrderIsReadyToCollect";
|
|
16
|
+
default:
|
|
17
|
+
throw new Error(
|
|
18
|
+
`Unhandled checkout status "${e}" in getTranslationKeyByCheckoutStatus()`
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function O(e) {
|
|
23
|
+
switch (e) {
|
|
24
|
+
case n.Pending:
|
|
25
|
+
case n.PendingAccept:
|
|
26
|
+
return "processingPayment";
|
|
27
|
+
case n.Preparing:
|
|
28
|
+
return "yourOrderIsBeingPrepared";
|
|
29
|
+
case n.Ready:
|
|
30
|
+
return "yourOrderIsReadyToCollect";
|
|
31
|
+
case n.Closed:
|
|
32
|
+
return "yourOrderHasBeenCompleted";
|
|
33
|
+
case n.Canceled:
|
|
34
|
+
return "yourOrderWasCancelled";
|
|
35
|
+
default:
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Unhandled ticket status "${e}" in getTranslationKeyByTicketStatus()`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function C({ orderFormat: e }, {
|
|
42
|
+
checkoutStatus: a,
|
|
43
|
+
ticketStatus: l,
|
|
44
|
+
useMarkAsPickedUp: t,
|
|
45
|
+
pickupTimeUpdated: i
|
|
46
|
+
}, r) {
|
|
47
|
+
if (t && r.ready > 0)
|
|
48
|
+
return r.ready < 2 ? ["oneItemIsReadyToCollect"] : [
|
|
49
|
+
"multipleItemsAreReadyToCollect",
|
|
50
|
+
{ count: r.ready }
|
|
51
|
+
];
|
|
52
|
+
if (t && r.done > 0 && r.done < r.all)
|
|
53
|
+
return [
|
|
54
|
+
"enjoyMealWhileOtherItemsBeingPrepared",
|
|
55
|
+
{ count: Math.max(0, r.all - r.done - r.ready) }
|
|
56
|
+
];
|
|
57
|
+
if (l != null)
|
|
58
|
+
return [O(l)];
|
|
59
|
+
const s = h(a);
|
|
60
|
+
if (s)
|
|
61
|
+
return [s];
|
|
62
|
+
const c = a === o.Captured, m = a === o.InProgress, g = a === o.Canceled, y = e === u.TableOrder, d = e === u.Delivery;
|
|
63
|
+
if (c)
|
|
64
|
+
return y ? ["yourOrderWillArriveAtYourTable"] : i && d ? ["modifiedDeliveryStartTime"] : i ? ["modifiedPickUpTime"] : t ? ["yourOrderHasBeenAcceptedPickupTime"] : ["yourOrderHasBeenAcceptedEstimatedTime"];
|
|
65
|
+
if (m)
|
|
66
|
+
return i && d ? ["modifiedDeliveryStartTime"] : d ? ["yourOrderIsBeingDelivered"] : i ? ["modifiedPickUpTime"] : t ? ["yourOrderHasBeenAcceptedPickupTime"] : ["yourOrderHasBeenAcceptedEstimatedTime"];
|
|
67
|
+
if (g) {
|
|
68
|
+
const p = e === u.EatIn, f = e === u.TakeAway;
|
|
69
|
+
if (p || f)
|
|
70
|
+
return t ? ["yourOrderHasBeenCompleted"] : ["yourOrderIsReady"];
|
|
71
|
+
if (d)
|
|
72
|
+
return ["deliveryWasCompleted"];
|
|
73
|
+
if (y)
|
|
74
|
+
return t ? ["yourOrderIsReadyToCollect"] : ["yourOrderWillArriveAtYourTable"];
|
|
75
|
+
}
|
|
76
|
+
throw new Error("Could not resolve translation key in getTranslationKey()");
|
|
77
|
+
}
|
|
78
|
+
const I = {
|
|
79
|
+
yourOrderIsBeingProcessed: () => ({
|
|
80
|
+
title: "Your order is being processed."
|
|
81
|
+
}),
|
|
82
|
+
yourOrderWasCancelled: () => ({
|
|
83
|
+
title: "Your order was canceled",
|
|
84
|
+
message: "Sorry. Your order could not go through."
|
|
85
|
+
}),
|
|
86
|
+
processingPayment: () => ({
|
|
87
|
+
title: "Processing payment",
|
|
88
|
+
message: "Please wait while your payment is being processed"
|
|
89
|
+
}),
|
|
90
|
+
yourOrderIsBeingPrepared: () => ({
|
|
91
|
+
title: "Your order is now being prepared!",
|
|
92
|
+
message: "We will let you know when it is ready for pickup."
|
|
93
|
+
}),
|
|
94
|
+
yourOrderIsReadyToCollect: () => ({
|
|
95
|
+
title: "Your order is ready to be collected!",
|
|
96
|
+
message: "Please go ahead and show this screen at the collection point"
|
|
97
|
+
}),
|
|
98
|
+
yourOrderHasBeenCompleted: () => ({
|
|
99
|
+
title: "Enjoy your meal!",
|
|
100
|
+
message: "Your order has been completed!"
|
|
101
|
+
}),
|
|
102
|
+
yourOrderWillArriveAtYourTable: () => ({
|
|
103
|
+
title: "Your order has been accepted!",
|
|
104
|
+
message: "It will arrive at your table shortly"
|
|
105
|
+
}),
|
|
106
|
+
modifiedDeliveryStartTime: () => ({
|
|
107
|
+
title: "Your delivery time was modified",
|
|
108
|
+
message: "Delivery will start at approximately 00:00."
|
|
109
|
+
}),
|
|
110
|
+
modifiedPickUpTime: () => ({
|
|
111
|
+
title: "Your pickup time was modified",
|
|
112
|
+
message: "Pickup time: 00:00"
|
|
113
|
+
}),
|
|
114
|
+
yourOrderHasBeenAcceptedEstimatedTime: () => ({
|
|
115
|
+
title: "Your order has been accepted",
|
|
116
|
+
message: "Estimated time: 00:00"
|
|
117
|
+
}),
|
|
118
|
+
yourOrderHasBeenAcceptedPickupTime: () => ({
|
|
119
|
+
title: "Your order has been accepted",
|
|
120
|
+
message: "Pickup time: 00:00"
|
|
121
|
+
}),
|
|
122
|
+
yourOrderIsBeingDelivered: () => ({
|
|
123
|
+
title: "Your order is being delivered",
|
|
124
|
+
message: "It will arrive at your door shortly. Enjoy your meal!"
|
|
125
|
+
}),
|
|
126
|
+
yourOrderIsReady: () => ({
|
|
127
|
+
title: "Your order is ready",
|
|
128
|
+
message: "Enjoy your meal!"
|
|
129
|
+
}),
|
|
130
|
+
deliveryWasCompleted: () => ({
|
|
131
|
+
title: "Your order was completed",
|
|
132
|
+
message: "Enjoy your meal!"
|
|
133
|
+
}),
|
|
134
|
+
oneItemIsReadyToCollect: () => ({
|
|
135
|
+
title: "One item is ready to pick up!"
|
|
136
|
+
}),
|
|
137
|
+
multipleItemsAreReadyToCollect: () => ({
|
|
138
|
+
title: "Multiple items are ready to pick up!"
|
|
139
|
+
}),
|
|
140
|
+
enjoyMealWhileOtherItemsBeingPrepared: ({ meta: e }) => ({
|
|
141
|
+
title: "Enjoy your meal while the rest of the items are being prepared!",
|
|
142
|
+
message: `${e.count} more items are being prepared`
|
|
143
|
+
})
|
|
144
|
+
};
|
|
145
|
+
function P(e, a, l = I) {
|
|
146
|
+
const t = T(e.items), [i, r] = C(e, a, {
|
|
147
|
+
all: t.all.length,
|
|
148
|
+
ready: t.ready.length,
|
|
149
|
+
done: t.done.length
|
|
150
|
+
}), s = l[i]({ meta: r });
|
|
151
|
+
if (!s)
|
|
152
|
+
throw new Error("Could not resolve translation in getOrderStatusTexts()");
|
|
153
|
+
return [s, i];
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
P as default
|
|
157
|
+
};
|
package/checkout/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import getCheckoutGroupedModifications from './getCheckoutItemModifications';
|
|
2
2
|
import getCheckoutProductName from './getCheckoutProductName';
|
|
3
|
-
|
|
3
|
+
import getCheckoutOrderStatusTexts from './getCheckoutOrderStatusTexts';
|
|
4
|
+
import isCheckoutOrderSummary from './isCheckoutOrderSummary';
|
|
5
|
+
export { getCheckoutGroupedModifications, getCheckoutProductName, getCheckoutOrderStatusTexts, isCheckoutOrderSummary, };
|
package/checkout/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getCheckoutItemModifications.js"),t=require("./getCheckoutProductName.js");require("@ancon/wildcat-types");require("../currency/getFormattedCurrency.js");require("../currency/getFormattedCurrencyPostfix.js");exports.getCheckoutGroupedModifications=e;exports.getCheckoutProductName=t;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./getCheckoutItemModifications.js"),t=require("./getCheckoutProductName.js"),r=require("./getCheckoutOrderStatusTexts.js"),u=require("./isCheckoutOrderSummary.js");require("@ancon/wildcat-types");require("../currency/getFormattedCurrency.js");require("../currency/getFormattedCurrencyPostfix.js");require("./getCheckoutItemsMappedByTicketItemStatus.js");exports.getCheckoutGroupedModifications=e;exports.getCheckoutProductName=t;exports.getCheckoutOrderStatusTexts=r;exports.isCheckoutOrderSummary=u;
|
package/checkout/index.mjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { default as
|
|
1
|
+
import { default as m } from "./getCheckoutItemModifications.mjs";
|
|
2
|
+
import { default as f } from "./getCheckoutProductName.mjs";
|
|
3
|
+
import { default as i } from "./getCheckoutOrderStatusTexts.mjs";
|
|
4
|
+
import { default as c } from "./isCheckoutOrderSummary.mjs";
|
|
3
5
|
import "@ancon/wildcat-types";
|
|
4
6
|
import "../currency/getFormattedCurrency.mjs";
|
|
5
7
|
import "../currency/getFormattedCurrencyPostfix.mjs";
|
|
8
|
+
import "./getCheckoutItemsMappedByTicketItemStatus.mjs";
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
m as getCheckoutGroupedModifications,
|
|
11
|
+
i as getCheckoutOrderStatusTexts,
|
|
12
|
+
f as getCheckoutProductName,
|
|
13
|
+
c as isCheckoutOrderSummary
|
|
9
14
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OrderFormat, TicketItemStatus, TicketStatus } from '@ancon/wildcat-types';
|
|
2
|
+
declare type CheckoutOrderSummaryItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
ticketItem: {
|
|
5
|
+
status: TicketItemStatus;
|
|
6
|
+
ticketItemId: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
declare type CheckoutOrderSummary = {
|
|
10
|
+
id: string;
|
|
11
|
+
summary: string;
|
|
12
|
+
orderFormat: OrderFormat;
|
|
13
|
+
status: TicketStatus;
|
|
14
|
+
items: CheckoutOrderSummaryItem[];
|
|
15
|
+
};
|
|
16
|
+
declare function isCheckoutOrderSummary(checkout: unknown): checkout is CheckoutOrderSummary;
|
|
17
|
+
export default isCheckoutOrderSummary;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function s(r){return(r==null?void 0:r.summary)!=null}module.exports=s;
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/enums.js"),t=require("./shared/isWithinFlag.js"),r=require("./shared/generateId.js"),i=require("./outlet/getListOutletOpeningHoursTable.js"),n=require("./outlet/getOutletTagInformation.js"),o=require("./outlet/getOutletAvailabilityInfo.js"),u=require("./outlet/getOutletOfflineOrderFormats.js"),s=require("./outlet/getOutletAvailableOrderFormats.js"),a=require("./outlet/getOutletFormattedDistance.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./shared/enums.js"),t=require("./shared/isWithinFlag.js"),r=require("./shared/generateId.js"),i=require("./outlet/getListOutletOpeningHoursTable.js"),n=require("./outlet/getOutletTagInformation.js"),o=require("./outlet/getOutletAvailabilityInfo.js"),u=require("./outlet/getOutletOfflineOrderFormats.js"),s=require("./outlet/getOutletAvailableOrderFormats.js"),a=require("./outlet/getOutletFormattedDistance.js"),c=require("./outlet/isOutletAcceptingPreOrders.js"),l=require("./outlet/getOutletDeliveryFee.js"),g=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"),k=require("./api/getEndpointWithVersion.js"),f=require("./api/generateBackoffWithEqualJitter.js"),h=require("./string/slugify.js"),y=require("./string/truncate.js"),p=require("./color/lighten.js"),P=require("./color/brighten.js"),T=require("./color/darken.js"),F=require("./color/isDarkBackground.js"),v=require("./user/getFullName.js"),S=require("./user/getFullAddressString.js"),D=require("./logger/Logger.js"),I=require("./logger/types.js"),b=require("./logger/sanitizeAsStringDict.js"),A=require("./printing/getPrinterType.js"),V=require("./printing/isValidPrinter.js"),C=require("./printing/isValidNetworkPrinter.js"),L=require("./printing/isValidStarCloudPrinter.js"),W=require("./printing/isTerminalPrinter.js"),B=require("./number/randomIntFromInterval.js"),N=require("./tables/decodeTableQRPayload.js"),M=require("./checkout/getCheckoutItemModifications.js"),E=require("./checkout/getCheckoutProductName.js"),H=require("./checkout/getCheckoutOrderStatusTexts.js"),w=require("./checkout/isCheckoutOrderSummary.js"),x=require("./currency/getFormattedCurrency.js"),z=require("./inventory/isDetailedProductOutOfStock.js"),J=require("./inventory/isDetailedProductVariantOutOfStocks.js"),Q=require("./inventory/isMenuTreeProductOutOfStock.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");require("./currency/getFormattedCurrencyPostfix.js");require("./checkout/getCheckoutItemsMappedByTicketItemStatus.js");exports.DayOfWeek=e.DayOfWeek;exports.IntervalState=e.IntervalState;exports.IntervalType=e.IntervalType;exports.OrderFormat=e.OrderFormat;exports.isWithinFlag=t;exports.generateId=r;exports.getListOutletOpeningHoursTable=i;exports.getOutletTagInformation=n.default;exports.getOutletAvailabilityInfo=o.default;exports.getOutletOfflineOrderFormats=u;exports.getOutletAvailableOrderFormats=s;exports.getOutletFormattedDistance=a;exports.isOutletAcceptingPreOrders=c;exports.getOutletDeliveryFee=l;exports.getOutletTodayOpeningTimes=g;exports.getOutletOrderFormats=d;exports.serviceDateTimesFromOpeningHours=q;exports.isVersionALessThanB=O;exports.cleanVersionString=_;exports.getUrlAndParams=m;exports.getEndpointWithVersion=k;exports.generateBackoffWithEqualJitter=f;exports.slugify=h;exports.truncate=y;exports.lighten=p;exports.brighten=P;exports.darken=T;exports.isDarkBackground=F;exports.getFullName=v;exports.getFullAddressString=S;exports.Logger=D;exports.LogLevel=I.LogLevel;exports.sanitizeAsStringDict=b;exports.getPrinterType=A;exports.isValidPrinter=V;exports.isValidNetworkPrinter=C;exports.isValidStarCloudPrinter=L;exports.isTerminalPrinter=W;exports.randomIntFromInterval=B;exports.decodeTableQRPayload=N;exports.getCheckoutGroupedModifications=M;exports.getCheckoutProductName=E;exports.getCheckoutOrderStatusTexts=H;exports.isCheckoutOrderSummary=w;exports.getFormattedCurrency=x;exports.isDetailedProductOutOfStock=z;exports.isDetailedProductVariantOutOfStocks=J;exports.isMenuTreeProductOutOfStock=Q;
|
package/index.mjs
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import { DayOfWeek as
|
|
1
|
+
import { DayOfWeek as g, IntervalState as O, IntervalType as c, OrderFormat as k } from "./shared/enums.mjs";
|
|
2
2
|
import { default as P } from "./shared/isWithinFlag.mjs";
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
3
|
+
import { default as h } from "./shared/generateId.mjs";
|
|
4
|
+
import { default as S } from "./outlet/getListOutletOpeningHoursTable.mjs";
|
|
5
5
|
import { default as D } from "./outlet/getOutletTagInformation.mjs";
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
6
|
+
import { default as I } from "./outlet/getOutletAvailabilityInfo.mjs";
|
|
7
|
+
import { default as C } from "./outlet/getOutletOfflineOrderFormats.mjs";
|
|
8
8
|
import { default as L } from "./outlet/getOutletAvailableOrderFormats.mjs";
|
|
9
|
-
import { default as
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as
|
|
16
|
-
import { default as
|
|
17
|
-
import { default as
|
|
18
|
-
import { default as
|
|
19
|
-
import { default as
|
|
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 { default as
|
|
9
|
+
import { default as B } from "./outlet/getOutletFormattedDistance.mjs";
|
|
10
|
+
import { default as E } from "./outlet/isOutletAcceptingPreOrders.mjs";
|
|
11
|
+
import { default as M } from "./outlet/getOutletDeliveryFee.mjs";
|
|
12
|
+
import { default as w } from "./outlet/getOutletTodayOpeningTimes.mjs";
|
|
13
|
+
import { default as G } 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 K } from "./versioning/cleanVersionString.mjs";
|
|
17
|
+
import { default as Y } from "./api/getUrlAndParams.mjs";
|
|
18
|
+
import { default as _ } from "./api/getEndpointWithVersion.mjs";
|
|
19
|
+
import { default as tt } from "./api/generateBackoffWithEqualJitter.mjs";
|
|
20
|
+
import { default as rt } from "./string/slugify.mjs";
|
|
21
|
+
import { default as at } from "./string/truncate.mjs";
|
|
22
|
+
import { default as lt } from "./color/lighten.mjs";
|
|
23
|
+
import { default as ut } from "./color/brighten.mjs";
|
|
24
|
+
import { default as mt } from "./color/darken.mjs";
|
|
25
|
+
import { default as pt } from "./color/isDarkBackground.mjs";
|
|
26
|
+
import { default as xt } from "./user/getFullName.mjs";
|
|
27
|
+
import { default as Ot } from "./user/getFullAddressString.mjs";
|
|
28
|
+
import { default as kt } from "./logger/Logger.mjs";
|
|
29
29
|
import { LogLevel as Pt } from "./logger/types.mjs";
|
|
30
|
-
import { default as
|
|
31
|
-
import { default as
|
|
30
|
+
import { default as ht } from "./logger/sanitizeAsStringDict.mjs";
|
|
31
|
+
import { default as St } from "./printing/getPrinterType.mjs";
|
|
32
32
|
import { default as Dt } from "./printing/isValidPrinter.mjs";
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
33
|
+
import { default as It } from "./printing/isValidNetworkPrinter.mjs";
|
|
34
|
+
import { default as Ct } from "./printing/isValidStarCloudPrinter.mjs";
|
|
35
35
|
import { default as Lt } from "./printing/isTerminalPrinter.mjs";
|
|
36
|
-
import { default as
|
|
37
|
-
import { default as
|
|
38
|
-
import { default as
|
|
39
|
-
import { default as
|
|
40
|
-
import { default as
|
|
41
|
-
import { default as
|
|
42
|
-
import { default as
|
|
43
|
-
import { default as
|
|
36
|
+
import { default as Bt } from "./number/randomIntFromInterval.mjs";
|
|
37
|
+
import { default as Et } from "./tables/decodeTableQRPayload.mjs";
|
|
38
|
+
import { default as Mt } from "./checkout/getCheckoutItemModifications.mjs";
|
|
39
|
+
import { default as wt } from "./checkout/getCheckoutProductName.mjs";
|
|
40
|
+
import { default as Gt } from "./checkout/getCheckoutOrderStatusTexts.mjs";
|
|
41
|
+
import { default as Qt } from "./checkout/isCheckoutOrderSummary.mjs";
|
|
42
|
+
import { default as Ut } from "./currency/getFormattedCurrency.mjs";
|
|
43
|
+
import { default as Kt } from "./inventory/isDetailedProductOutOfStock.mjs";
|
|
44
|
+
import { default as Yt } from "./inventory/isDetailedProductVariantOutOfStocks.mjs";
|
|
45
|
+
import { default as _t } from "./inventory/isMenuTreeProductOutOfStock.mjs";
|
|
44
46
|
import "moment";
|
|
45
47
|
import "@ancon/wildcat-types";
|
|
46
48
|
import "./outlet/types.mjs";
|
|
@@ -53,51 +55,54 @@ import "compare-versions";
|
|
|
53
55
|
import "tinycolor2";
|
|
54
56
|
import "@ancon/wildcat-printing";
|
|
55
57
|
import "./currency/getFormattedCurrencyPostfix.mjs";
|
|
58
|
+
import "./checkout/getCheckoutItemsMappedByTicketItemStatus.mjs";
|
|
56
59
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
g as DayOfWeek,
|
|
61
|
+
O as IntervalState,
|
|
62
|
+
c as IntervalType,
|
|
60
63
|
Pt as LogLevel,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
kt as Logger,
|
|
65
|
+
k as OrderFormat,
|
|
66
|
+
ut as brighten,
|
|
67
|
+
K as cleanVersionString,
|
|
68
|
+
mt as darken,
|
|
69
|
+
Et as decodeTableQRPayload,
|
|
70
|
+
tt as generateBackoffWithEqualJitter,
|
|
71
|
+
h as generateId,
|
|
72
|
+
Mt as getCheckoutGroupedModifications,
|
|
73
|
+
Gt as getCheckoutOrderStatusTexts,
|
|
74
|
+
wt as getCheckoutProductName,
|
|
75
|
+
_ as getEndpointWithVersion,
|
|
76
|
+
Ut as getFormattedCurrency,
|
|
77
|
+
Ot as getFullAddressString,
|
|
78
|
+
xt as getFullName,
|
|
79
|
+
S as getListOutletOpeningHoursTable,
|
|
80
|
+
I as getOutletAvailabilityInfo,
|
|
77
81
|
L as getOutletAvailableOrderFormats,
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
M as getOutletDeliveryFee,
|
|
83
|
+
B as getOutletFormattedDistance,
|
|
84
|
+
C as getOutletOfflineOrderFormats,
|
|
85
|
+
G as getOutletOrderFormats,
|
|
82
86
|
D as getOutletTagInformation,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
w as getOutletTodayOpeningTimes,
|
|
88
|
+
St as getPrinterType,
|
|
89
|
+
Y as getUrlAndParams,
|
|
90
|
+
Qt as isCheckoutOrderSummary,
|
|
91
|
+
pt as isDarkBackground,
|
|
92
|
+
Kt as isDetailedProductOutOfStock,
|
|
93
|
+
Yt as isDetailedProductVariantOutOfStocks,
|
|
94
|
+
_t as isMenuTreeProductOutOfStock,
|
|
95
|
+
E as isOutletAcceptingPreOrders,
|
|
91
96
|
Lt as isTerminalPrinter,
|
|
92
|
-
|
|
97
|
+
It as isValidNetworkPrinter,
|
|
93
98
|
Dt as isValidPrinter,
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
Ct as isValidStarCloudPrinter,
|
|
100
|
+
U as isVersionALessThanB,
|
|
96
101
|
P as isWithinFlag,
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
lt as lighten,
|
|
103
|
+
Bt as randomIntFromInterval,
|
|
104
|
+
ht as sanitizeAsStringDict,
|
|
105
|
+
Q as serviceDateTimesFromOpeningHours,
|
|
106
|
+
rt as slugify,
|
|
107
|
+
at as truncate
|
|
103
108
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ancon/wildcat-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -31,6 +31,16 @@
|
|
|
31
31
|
"require": "./checkout/getCheckoutItemModifications.js",
|
|
32
32
|
"types": "./checkout/getCheckoutItemModifications.d.ts"
|
|
33
33
|
},
|
|
34
|
+
"./checkout/getCheckoutItemsMappedByTicketItemStatus": {
|
|
35
|
+
"import": "./checkout/getCheckoutItemsMappedByTicketItemStatus.mjs",
|
|
36
|
+
"require": "./checkout/getCheckoutItemsMappedByTicketItemStatus.js",
|
|
37
|
+
"types": "./checkout/getCheckoutItemsMappedByTicketItemStatus.d.ts"
|
|
38
|
+
},
|
|
39
|
+
"./checkout/getCheckoutOrderStatusTexts": {
|
|
40
|
+
"import": "./checkout/getCheckoutOrderStatusTexts.mjs",
|
|
41
|
+
"require": "./checkout/getCheckoutOrderStatusTexts.js",
|
|
42
|
+
"types": "./checkout/getCheckoutOrderStatusTexts.d.ts"
|
|
43
|
+
},
|
|
34
44
|
"./checkout/getCheckoutProductName": {
|
|
35
45
|
"import": "./checkout/getCheckoutProductName.mjs",
|
|
36
46
|
"require": "./checkout/getCheckoutProductName.js",
|
|
@@ -41,6 +51,11 @@
|
|
|
41
51
|
"require": "./checkout/index.js",
|
|
42
52
|
"types": "./checkout/index.d.ts"
|
|
43
53
|
},
|
|
54
|
+
"./checkout/isCheckoutOrderSummary": {
|
|
55
|
+
"import": "./checkout/isCheckoutOrderSummary.mjs",
|
|
56
|
+
"require": "./checkout/isCheckoutOrderSummary.js",
|
|
57
|
+
"types": "./checkout/isCheckoutOrderSummary.d.ts"
|
|
58
|
+
},
|
|
44
59
|
"./color/brighten": {
|
|
45
60
|
"import": "./color/brighten.mjs",
|
|
46
61
|
"require": "./color/brighten.js",
|