@final-commerce/common 1.1.4-beta.4 → 1.2.4-beta.2
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/dist/index.d.mts +617 -4
- package/dist/index.d.ts +617 -4
- package/dist/index.js +50 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -17
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +346 -6
- package/dist/pos-types/index.d.ts +346 -6
- package/dist/pos-types/index.js +3 -3
- package/dist/pos-types/index.js.map +1 -1
- package/dist/pos-types/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/interfaces-6GnQyqYd.d.mts +0 -598
- package/dist/interfaces-6GnQyqYd.d.ts +0 -598
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,342 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare enum CurrencyCode {
|
|
2
|
+
USD = "USD",
|
|
3
|
+
EUR = "EUR",
|
|
4
|
+
GBP = "GBP",
|
|
5
|
+
CAD = "CAD",
|
|
6
|
+
AUD = "AUD",
|
|
7
|
+
NZD = "NZD",
|
|
8
|
+
CHF = "CHF",
|
|
9
|
+
CNY = "CNY",
|
|
10
|
+
INR = "INR",
|
|
11
|
+
MXN = "MXN",
|
|
12
|
+
BRL = "BRL",
|
|
13
|
+
ZAR = "ZAR",
|
|
14
|
+
SGD = "SGD",
|
|
15
|
+
HKD = "HKD",
|
|
16
|
+
SEK = "SEK",
|
|
17
|
+
NOK = "NOK",
|
|
18
|
+
DKK = "DKK",
|
|
19
|
+
PLN = "PLN",
|
|
20
|
+
THB = "THB",
|
|
21
|
+
MYR = "MYR",
|
|
22
|
+
PHP = "PHP",
|
|
23
|
+
IDR = "IDR",
|
|
24
|
+
AED = "AED",
|
|
25
|
+
SAR = "SAR",
|
|
26
|
+
ILS = "ILS",
|
|
27
|
+
TRY = "TRY",
|
|
28
|
+
RUB = "RUB",
|
|
29
|
+
HTG = "HTG",
|
|
30
|
+
BND = "BND",
|
|
31
|
+
CRC = "CRC",
|
|
32
|
+
BDT = "BDT",
|
|
33
|
+
UAH = "UAH",
|
|
34
|
+
NGN = "NGN",
|
|
35
|
+
AFN = "AFN",
|
|
36
|
+
ALL = "ALL",
|
|
37
|
+
AMD = "AMD",
|
|
38
|
+
ANG = "ANG",
|
|
39
|
+
AOA = "AOA",
|
|
40
|
+
ARS = "ARS",
|
|
41
|
+
AWG = "AWG",
|
|
42
|
+
AZN = "AZN",
|
|
43
|
+
BAM = "BAM",
|
|
44
|
+
BBD = "BBD",
|
|
45
|
+
BGN = "BGN",
|
|
46
|
+
BMD = "BMD",
|
|
47
|
+
BOB = "BOB",
|
|
48
|
+
BSD = "BSD",
|
|
49
|
+
BTN = "BTN",
|
|
50
|
+
BWP = "BWP",
|
|
51
|
+
BYN = "BYN",
|
|
52
|
+
BZD = "BZD",
|
|
53
|
+
COP = "COP",
|
|
54
|
+
CZK = "CZK",
|
|
55
|
+
DOP = "DOP",
|
|
56
|
+
DZD = "DZD",
|
|
57
|
+
EGP = "EGP",
|
|
58
|
+
ETB = "ETB",
|
|
59
|
+
FJD = "FJD",
|
|
60
|
+
GEL = "GEL",
|
|
61
|
+
GHS = "GHS",
|
|
62
|
+
GTQ = "GTQ",
|
|
63
|
+
GYD = "GYD",
|
|
64
|
+
HNL = "HNL",
|
|
65
|
+
IRR = "IRR",
|
|
66
|
+
JMD = "JMD",
|
|
67
|
+
KES = "KES",
|
|
68
|
+
KGS = "KGS",
|
|
69
|
+
KHR = "KHR",
|
|
70
|
+
KYD = "KYD",
|
|
71
|
+
KZT = "KZT",
|
|
72
|
+
LAK = "LAK",
|
|
73
|
+
LBP = "LBP",
|
|
74
|
+
LKR = "LKR",
|
|
75
|
+
MAD = "MAD",
|
|
76
|
+
MDL = "MDL",
|
|
77
|
+
MKD = "MKD",
|
|
78
|
+
MMK = "MMK",
|
|
79
|
+
MNT = "MNT",
|
|
80
|
+
MOP = "MOP",
|
|
81
|
+
MUR = "MUR",
|
|
82
|
+
MVR = "MVR",
|
|
83
|
+
MZN = "MZN",
|
|
84
|
+
NAD = "NAD",
|
|
85
|
+
NIO = "NIO",
|
|
86
|
+
NPR = "NPR",
|
|
87
|
+
PAB = "PAB",
|
|
88
|
+
PEN = "PEN",
|
|
89
|
+
PGK = "PGK",
|
|
90
|
+
PKR = "PKR",
|
|
91
|
+
QAR = "QAR",
|
|
92
|
+
RON = "RON",
|
|
93
|
+
RSD = "RSD",
|
|
94
|
+
SBD = "SBD",
|
|
95
|
+
SRD = "SRD",
|
|
96
|
+
SYP = "SYP",
|
|
97
|
+
TJS = "TJS",
|
|
98
|
+
TMT = "TMT",
|
|
99
|
+
TOP = "TOP",
|
|
100
|
+
TTD = "TTD",
|
|
101
|
+
TZS = "TZS",
|
|
102
|
+
UYU = "UYU",
|
|
103
|
+
UZS = "UZS",
|
|
104
|
+
VES = "VES",
|
|
105
|
+
WST = "WST",
|
|
106
|
+
XCD = "XCD",
|
|
107
|
+
YER = "YER",
|
|
108
|
+
ZMW = "ZMW",
|
|
109
|
+
CDF = "CDF",
|
|
110
|
+
CUP = "CUP",
|
|
111
|
+
ERN = "ERN",
|
|
112
|
+
FKP = "FKP",
|
|
113
|
+
GIP = "GIP",
|
|
114
|
+
GMD = "GMD",
|
|
115
|
+
KPW = "KPW",
|
|
116
|
+
LRD = "LRD",
|
|
117
|
+
LSL = "LSL",
|
|
118
|
+
MGA = "MGA",
|
|
119
|
+
MWK = "MWK",
|
|
120
|
+
SCR = "SCR",
|
|
121
|
+
SDG = "SDG",
|
|
122
|
+
SHP = "SHP",
|
|
123
|
+
SLE = "SLE",
|
|
124
|
+
SOS = "SOS",
|
|
125
|
+
SSP = "SSP",
|
|
126
|
+
STN = "STN",
|
|
127
|
+
SZL = "SZL",
|
|
128
|
+
VED = "VED",
|
|
129
|
+
XCG = "XCG",
|
|
130
|
+
JPY = "JPY",
|
|
131
|
+
KRW = "KRW",
|
|
132
|
+
VND = "VND",
|
|
133
|
+
CLP = "CLP",
|
|
134
|
+
ISK = "ISK",
|
|
135
|
+
HUF = "HUF",
|
|
136
|
+
TWD = "TWD",
|
|
137
|
+
GNF = "GNF",
|
|
138
|
+
BIF = "BIF",
|
|
139
|
+
DJF = "DJF",
|
|
140
|
+
KMF = "KMF",
|
|
141
|
+
PYG = "PYG",
|
|
142
|
+
RWF = "RWF",
|
|
143
|
+
UGX = "UGX",
|
|
144
|
+
VUV = "VUV",
|
|
145
|
+
XAF = "XAF",
|
|
146
|
+
XOF = "XOF",
|
|
147
|
+
XPF = "XPF",
|
|
148
|
+
KWD = "KWD",
|
|
149
|
+
BHD = "BHD",
|
|
150
|
+
OMR = "OMR",
|
|
151
|
+
JOD = "JOD",
|
|
152
|
+
TND = "TND",
|
|
153
|
+
LYD = "LYD",
|
|
154
|
+
IQD = "IQD"
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
declare enum TimePeriod {
|
|
158
|
+
TODAY = "today",
|
|
159
|
+
THIS_WEEK = "this week",
|
|
160
|
+
THIS_MONTH = "this month",
|
|
161
|
+
THIS_YEAR = "this year",
|
|
162
|
+
All_TIME = "all_time"
|
|
163
|
+
}
|
|
164
|
+
declare enum TopMetericsSort {
|
|
165
|
+
TOTAL_PAYMENT_VOLUME = "totalPaymentVolume",
|
|
166
|
+
TOTAL_TRANSACTION = "totalTransaction"
|
|
167
|
+
}
|
|
168
|
+
declare enum CompanyType {
|
|
169
|
+
COMPANY = "company",
|
|
170
|
+
ROOT = "root",
|
|
171
|
+
ORGANIZATION = "organization"
|
|
172
|
+
}
|
|
173
|
+
declare enum CustomTableAvailability {
|
|
174
|
+
PUBLIC = "public",
|
|
175
|
+
ORGANIZATION = "organization"
|
|
176
|
+
}
|
|
177
|
+
declare enum AttributeType {
|
|
178
|
+
STRING = "string",
|
|
179
|
+
NUMBER = "number",
|
|
180
|
+
BOOLEAN = "boolean",
|
|
181
|
+
DATE = "date",
|
|
182
|
+
JSON_STRING = "json-string"
|
|
183
|
+
}
|
|
184
|
+
declare enum Platform {
|
|
185
|
+
WOO_COMMERCE = "woo-commerce",
|
|
186
|
+
SHOPIFY = "shopify",
|
|
187
|
+
OLIVER = "oliver",
|
|
188
|
+
STANDALONE = "standalone"
|
|
189
|
+
}
|
|
190
|
+
declare enum OrderPlatform {
|
|
191
|
+
POS = "in-store",
|
|
192
|
+
WOO_COMMERCE = "woo-commerce"
|
|
193
|
+
}
|
|
194
|
+
declare enum CustomerPlatform {
|
|
195
|
+
POS = "in-store",
|
|
196
|
+
WOO_COMMERCE = "woo-commerce"
|
|
197
|
+
}
|
|
198
|
+
declare enum StationStatus {
|
|
199
|
+
IN_USE = "IN_USE",
|
|
200
|
+
AVAILABLE = "AVAILABLE"
|
|
201
|
+
}
|
|
202
|
+
declare enum InventoryBaseActionEnum {
|
|
203
|
+
ADD = "ADD",
|
|
204
|
+
REMOVE = "REMOVE",
|
|
205
|
+
RECOUNT = "RECOUNT",
|
|
206
|
+
SKIP = "SKIP"
|
|
207
|
+
}
|
|
208
|
+
type InventoryBaseActionType = `${InventoryBaseActionEnum}`;
|
|
209
|
+
declare enum InventorySpecificActionType {
|
|
210
|
+
STOCK_RECEIVED = "STOCK_RECEIVED",
|
|
211
|
+
INVENTORY_RECOUNT = "INVENTORY_RECOUNT",
|
|
212
|
+
DAMAGE = "DAMAGE",
|
|
213
|
+
THEFT = "THEFT",
|
|
214
|
+
LOSS = "LOSS",
|
|
215
|
+
RESTOCK_RETURN = "RESTOCK_RETURN",
|
|
216
|
+
REFUND_RESTOCK_RETURN = "REFUND_RESTOCK_RETURN",
|
|
217
|
+
REFUND_DAMAGE = "REFUND_DAMAGE",
|
|
218
|
+
SALE = "SALE",
|
|
219
|
+
TRANSFER = "TRANSFER",
|
|
220
|
+
BULK_RECOUNT = "BULK_RECOUNT",
|
|
221
|
+
APPLIED_FROM_WOO = "APPLIED_FROM_WOO",
|
|
222
|
+
PO_RECEIVED = "PO_RECEIVED"
|
|
223
|
+
}
|
|
224
|
+
declare enum ExtensionCategory {
|
|
225
|
+
SYNC = "sync",
|
|
226
|
+
PAYMENT = "payment",
|
|
227
|
+
HUB = "hub",
|
|
228
|
+
BUILDER = "builder"
|
|
229
|
+
}
|
|
230
|
+
declare enum FeesCustomBillingStatus {
|
|
231
|
+
UNPAID = "unpaid",
|
|
232
|
+
PAID = "paid",
|
|
233
|
+
OPEN = "open"
|
|
234
|
+
}
|
|
235
|
+
declare enum PricingPlanEnum {
|
|
236
|
+
DEFAULT = "default",
|
|
237
|
+
MINIMUM = "minimum",
|
|
238
|
+
ORGANIZATION = "organization",
|
|
239
|
+
PLAN = "plan",
|
|
240
|
+
COMPANY = "company"
|
|
241
|
+
}
|
|
242
|
+
declare enum PricingLevel {
|
|
243
|
+
ORG = "org",
|
|
244
|
+
PLAN = "plan",
|
|
245
|
+
DEFAULT = "default",
|
|
246
|
+
MINIMUM = "minimum"
|
|
247
|
+
}
|
|
248
|
+
declare enum PricingRegionEnum {
|
|
249
|
+
EUROPE = "europe",
|
|
250
|
+
OTHER = "others",
|
|
251
|
+
NORTH_AMERICA = "northAmerica"
|
|
252
|
+
}
|
|
253
|
+
declare enum MenuProject {
|
|
254
|
+
MANAGE = "Manage",
|
|
255
|
+
SCALE = "Scale",
|
|
256
|
+
BUILD = "Build",
|
|
257
|
+
PAY = "Pay",
|
|
258
|
+
RUN = "Run"
|
|
259
|
+
}
|
|
260
|
+
declare enum UserTypes {
|
|
261
|
+
COMPANY_OWNER = "owner",
|
|
262
|
+
ORG_USER = "organization_user",
|
|
263
|
+
ORG_OWNER = "organization_owner",
|
|
264
|
+
FINAL_USER = "final_user",
|
|
265
|
+
FINAL_OWNER = "final_owner",
|
|
266
|
+
EMPLOYEE = "employee",
|
|
267
|
+
SUPER_ADMIN = "super_admin",
|
|
268
|
+
MANAGER = "manager",
|
|
269
|
+
ADMIN = "admin",
|
|
270
|
+
ASSISTANT_MANAGER = "assistant",
|
|
271
|
+
CASHIER = "cashier",
|
|
272
|
+
RESELLER = "reseller"
|
|
273
|
+
}
|
|
274
|
+
declare enum OwnerType {
|
|
275
|
+
API_KEY = "api-key",
|
|
276
|
+
ORGANIZATION = "organization",
|
|
277
|
+
COMPANY = "company"
|
|
278
|
+
}
|
|
279
|
+
declare enum PublicationAvailability {
|
|
280
|
+
GLOBAL = "global",
|
|
281
|
+
PRIVATE = "private"
|
|
282
|
+
}
|
|
283
|
+
declare enum PublicationStatus {
|
|
284
|
+
APPROVED = "approved",
|
|
285
|
+
REJECTED = "rejected",
|
|
286
|
+
PENDING = "pending",
|
|
287
|
+
NOT_APPLICABLE = "not_applicable"
|
|
288
|
+
}
|
|
289
|
+
interface PublicationConfig {
|
|
290
|
+
availability: PublicationAvailability;
|
|
291
|
+
status: PublicationStatus;
|
|
292
|
+
}
|
|
293
|
+
declare enum ResidualStatus {
|
|
294
|
+
PAID = "paid",
|
|
295
|
+
DUE = "due",
|
|
296
|
+
ACCRUING = "accruing"
|
|
297
|
+
}
|
|
298
|
+
declare enum PreviewImageMode {
|
|
299
|
+
STATIC = "static",
|
|
300
|
+
DYNAMIC = "dynamic"
|
|
301
|
+
}
|
|
302
|
+
declare enum LibraryItemType {
|
|
303
|
+
FLOW = "flow",
|
|
304
|
+
PAGE = "page",
|
|
305
|
+
COMPOSITION = "composition",
|
|
306
|
+
LAYOUT = "layout"
|
|
307
|
+
}
|
|
308
|
+
declare enum ResidualPaymentMethod {
|
|
309
|
+
CHEQUE = "cheque"
|
|
310
|
+
}
|
|
311
|
+
declare enum PaymentMethod {
|
|
312
|
+
CUSTOM = "Custom",
|
|
313
|
+
CASH = "Cash",
|
|
314
|
+
TERMINAL = "Terminal",
|
|
315
|
+
CLOUD = "Cloud",
|
|
316
|
+
BLUETOOTH = "Bluetooth"
|
|
317
|
+
}
|
|
318
|
+
declare enum NonRevenueItemType {
|
|
319
|
+
GIFT_CARD = "gift-card"
|
|
320
|
+
}
|
|
321
|
+
declare enum ReceiptSendChannel {
|
|
322
|
+
EMAIL = "email",
|
|
323
|
+
TEXT = "text"
|
|
324
|
+
}
|
|
325
|
+
declare enum ReceiptType {
|
|
326
|
+
ORDER = "order",
|
|
327
|
+
REFUND = "refund"
|
|
328
|
+
}
|
|
329
|
+
declare enum StripeStatus {
|
|
330
|
+
ACTIVE = "active",
|
|
331
|
+
INACTIVE = "inactive",
|
|
332
|
+
PAYMENT_METHOD_REQUIRED = "payment_method_required",
|
|
333
|
+
PAYMENT_METHOD_ADDED = "payment_method_added"
|
|
334
|
+
}
|
|
335
|
+
declare enum InvoiceStatus {
|
|
336
|
+
PAID = "paid",
|
|
337
|
+
PENDING = "pending",
|
|
338
|
+
EXPIRED = "expired"
|
|
339
|
+
}
|
|
3
340
|
|
|
4
341
|
declare enum StripeCurrencyCode {
|
|
5
342
|
USD = "USD",
|
|
@@ -45,6 +382,22 @@ declare enum StripeCurrencyCode {
|
|
|
45
382
|
IQD = "IQD"
|
|
46
383
|
}
|
|
47
384
|
|
|
385
|
+
declare enum ProductType {
|
|
386
|
+
SIMPLE = "simple",
|
|
387
|
+
VARIABLE = "variable"
|
|
388
|
+
}
|
|
389
|
+
declare enum ProductStatus {
|
|
390
|
+
ACTIVE = "active",
|
|
391
|
+
INACTIVE = "inactive",
|
|
392
|
+
DRAFT = "draft"
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
declare enum PaymentProcessor {
|
|
396
|
+
STRIPE = "stripe",
|
|
397
|
+
ADYEN = "adyen",
|
|
398
|
+
EXTERNAL = "external"
|
|
399
|
+
}
|
|
400
|
+
|
|
48
401
|
interface CurrencyConfig {
|
|
49
402
|
minorUnits: number;
|
|
50
403
|
symbol: string;
|
|
@@ -273,6 +626,19 @@ declare function getMinorUnits(currency: CurrencyCode): number;
|
|
|
273
626
|
declare function createAmount(value: string | number | null | undefined, currency: CurrencyCode): Amount | undefined;
|
|
274
627
|
declare function amountToString(amount: Amount | undefined | null): string;
|
|
275
628
|
|
|
629
|
+
type MoneyInput = number | string | null | undefined;
|
|
630
|
+
declare function getTotalCollected(amountPaid: MoneyInput, tipTotal: MoneyInput): number;
|
|
631
|
+
declare function getPaymentLegTotal(amount: MoneyInput, tipAmount: MoneyInput): number;
|
|
632
|
+
declare function getCashAmountDue(amount: MoneyInput, cashRounding: MoneyInput): number;
|
|
633
|
+
interface SettlementBuckets {
|
|
634
|
+
cardTotal?: MoneyInput;
|
|
635
|
+
cashTotal?: MoneyInput;
|
|
636
|
+
customTotal?: MoneyInput;
|
|
637
|
+
}
|
|
638
|
+
declare function getSettlementTotal(payments: SettlementBuckets | undefined | null, tipTotal: MoneyInput): number;
|
|
639
|
+
declare function getLineSubtotal(price: MoneyInput, quantity: MoneyInput): number;
|
|
640
|
+
declare function getGoodsPortion(total: MoneyInput, totalTax: MoneyInput): number;
|
|
641
|
+
|
|
276
642
|
declare function getPricingRegionFromCountry(countryCode?: string): PricingRegionEnum;
|
|
277
643
|
declare const NORTH_AMERICA: Set<string>;
|
|
278
644
|
declare const EUROPE: Set<string>;
|
|
@@ -286,6 +652,254 @@ declare function generateMongoID(): string;
|
|
|
286
652
|
declare function getCurrentISODate(): string;
|
|
287
653
|
declare function normalizeMongoIdString(value: unknown): string | null;
|
|
288
654
|
|
|
655
|
+
type PaymentState = 'unpaid' | 'payment_pending' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'voided';
|
|
656
|
+
type FulfillmentState = 'draft' | 'pending' | 'on_hold' | 'in_progress' | 'fulfilled' | 'partially_fulfilled' | 'returned' | 'partially_returned' | 'cancelled';
|
|
657
|
+
declare const PAYMENT_STATES: readonly PaymentState[];
|
|
658
|
+
declare const FULFILLMENT_STATES: readonly FulfillmentState[];
|
|
659
|
+
declare function isPaymentState(value: string): value is PaymentState;
|
|
660
|
+
declare function isFulfillmentState(value: string): value is FulfillmentState;
|
|
661
|
+
interface StatePair {
|
|
662
|
+
payment: PaymentState;
|
|
663
|
+
fulfillment: FulfillmentState;
|
|
664
|
+
}
|
|
665
|
+
type ConditionOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'notIn' | 'isEmpty' | 'isNotEmpty';
|
|
666
|
+
declare const CONDITION_OPERATORS: readonly ConditionOperator[];
|
|
667
|
+
declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
668
|
+
type PathMode = 'strict' | 'permissive';
|
|
669
|
+
declare const PATH_MODES: readonly PathMode[];
|
|
670
|
+
|
|
671
|
+
interface OrderPaymentMethod {
|
|
672
|
+
id?: string;
|
|
673
|
+
amount?: number;
|
|
674
|
+
[key: string]: unknown;
|
|
675
|
+
}
|
|
676
|
+
interface OrderRefund {
|
|
677
|
+
id?: string;
|
|
678
|
+
quantity?: number;
|
|
679
|
+
[key: string]: unknown;
|
|
680
|
+
}
|
|
681
|
+
interface OrderLineItem {
|
|
682
|
+
id?: string;
|
|
683
|
+
quantity?: number;
|
|
684
|
+
fulfilledQuantity?: number;
|
|
685
|
+
returnedQuantity?: number;
|
|
686
|
+
[key: string]: unknown;
|
|
687
|
+
}
|
|
688
|
+
interface SplitPaymentPayment {
|
|
689
|
+
amount?: number;
|
|
690
|
+
[key: string]: unknown;
|
|
691
|
+
}
|
|
692
|
+
interface SplitPayment {
|
|
693
|
+
payments: SplitPaymentPayment[];
|
|
694
|
+
amountRemaining: number;
|
|
695
|
+
}
|
|
696
|
+
interface OrderContext {
|
|
697
|
+
order: {
|
|
698
|
+
total: number;
|
|
699
|
+
balance: number;
|
|
700
|
+
paymentMethods: OrderPaymentMethod[];
|
|
701
|
+
refunds: OrderRefund[];
|
|
702
|
+
lineItems: OrderLineItem[];
|
|
703
|
+
};
|
|
704
|
+
computed: {
|
|
705
|
+
balance: number;
|
|
706
|
+
isFullyPaid: boolean;
|
|
707
|
+
hasPartialPayments: boolean;
|
|
708
|
+
totalPaid: number;
|
|
709
|
+
totalRefunded: number;
|
|
710
|
+
itemCount: number;
|
|
711
|
+
fulfilledItemCount: number;
|
|
712
|
+
returnedItemCount: number;
|
|
713
|
+
isFullyReturned: boolean;
|
|
714
|
+
hasPartialReturns: boolean;
|
|
715
|
+
};
|
|
716
|
+
splitPayment?: SplitPayment;
|
|
717
|
+
}
|
|
718
|
+
interface PaymentStateDefinition {
|
|
719
|
+
id: PaymentState;
|
|
720
|
+
label: string;
|
|
721
|
+
isBase: boolean;
|
|
722
|
+
isTerminal: boolean;
|
|
723
|
+
color?: string;
|
|
724
|
+
icon?: string;
|
|
725
|
+
}
|
|
726
|
+
interface FulfillmentStateDefinition {
|
|
727
|
+
id: FulfillmentState;
|
|
728
|
+
label: string;
|
|
729
|
+
isBase: boolean;
|
|
730
|
+
isTerminal: boolean;
|
|
731
|
+
color?: string;
|
|
732
|
+
icon?: string;
|
|
733
|
+
}
|
|
734
|
+
type StateDefinition = PaymentStateDefinition | FulfillmentStateDefinition;
|
|
735
|
+
interface PaymentTransitionPath {
|
|
736
|
+
from: PaymentState;
|
|
737
|
+
to: PaymentState;
|
|
738
|
+
conditionSetId?: string;
|
|
739
|
+
_sourceExtensionId?: string;
|
|
740
|
+
}
|
|
741
|
+
interface FulfillmentTransitionPath {
|
|
742
|
+
from: FulfillmentState;
|
|
743
|
+
to: FulfillmentState;
|
|
744
|
+
conditionSetId?: string;
|
|
745
|
+
_sourceExtensionId?: string;
|
|
746
|
+
}
|
|
747
|
+
type TransitionPath = PaymentTransitionPath | FulfillmentTransitionPath;
|
|
748
|
+
interface Condition {
|
|
749
|
+
field: string;
|
|
750
|
+
operator: ConditionOperator;
|
|
751
|
+
value: unknown;
|
|
752
|
+
}
|
|
753
|
+
interface ConditionGroup {
|
|
754
|
+
conditions: Condition[];
|
|
755
|
+
}
|
|
756
|
+
interface TransitionConditionSet {
|
|
757
|
+
id: string;
|
|
758
|
+
label: string;
|
|
759
|
+
groups: ConditionGroup[];
|
|
760
|
+
_sourceExtensionId?: string;
|
|
761
|
+
}
|
|
762
|
+
type CrossAxisTrigger = {
|
|
763
|
+
axis: 'payment';
|
|
764
|
+
to: PaymentState | PaymentState[];
|
|
765
|
+
} | {
|
|
766
|
+
axis: 'fulfillment';
|
|
767
|
+
to: FulfillmentState | FulfillmentState[];
|
|
768
|
+
};
|
|
769
|
+
type CrossAxisRequires = {
|
|
770
|
+
axis: 'payment';
|
|
771
|
+
states: PaymentState[];
|
|
772
|
+
} | {
|
|
773
|
+
axis: 'fulfillment';
|
|
774
|
+
states: FulfillmentState[];
|
|
775
|
+
};
|
|
776
|
+
interface CrossAxisRule {
|
|
777
|
+
id: string;
|
|
778
|
+
label: string;
|
|
779
|
+
description?: string;
|
|
780
|
+
enabled: boolean;
|
|
781
|
+
trigger: CrossAxisTrigger;
|
|
782
|
+
requires: CrossAxisRequires;
|
|
783
|
+
_sourceExtensionId?: string;
|
|
784
|
+
}
|
|
785
|
+
interface FinancialInvariant {
|
|
786
|
+
id: string;
|
|
787
|
+
description: string;
|
|
788
|
+
check: (from: StatePair | null, to: StatePair) => boolean;
|
|
789
|
+
}
|
|
790
|
+
interface DisplayStateRule {
|
|
791
|
+
paymentState?: PaymentState | PaymentState[];
|
|
792
|
+
fulfillmentState?: FulfillmentState | FulfillmentState[];
|
|
793
|
+
label: string;
|
|
794
|
+
color?: string;
|
|
795
|
+
icon?: string;
|
|
796
|
+
_sourceExtensionId?: string;
|
|
797
|
+
}
|
|
798
|
+
interface DisplayStateResult {
|
|
799
|
+
label: string;
|
|
800
|
+
color?: string;
|
|
801
|
+
icon?: string;
|
|
802
|
+
}
|
|
803
|
+
interface OrderStateWritable {
|
|
804
|
+
paymentState?: PaymentState;
|
|
805
|
+
fulfillmentState?: FulfillmentState;
|
|
806
|
+
displayState?: string;
|
|
807
|
+
status?: string;
|
|
808
|
+
}
|
|
809
|
+
interface OrderLikeForContext {
|
|
810
|
+
total?: number;
|
|
811
|
+
balance?: number;
|
|
812
|
+
paymentMethods?: OrderPaymentMethod[];
|
|
813
|
+
refunds?: OrderRefund[];
|
|
814
|
+
refund?: OrderRefund[];
|
|
815
|
+
lineItems?: OrderLineItem[];
|
|
816
|
+
}
|
|
817
|
+
interface OrderLikeForLegacyInference extends OrderLikeForContext {
|
|
818
|
+
status?: string;
|
|
819
|
+
}
|
|
820
|
+
interface StoredStateConfig {
|
|
821
|
+
_id: string;
|
|
822
|
+
companyId: string;
|
|
823
|
+
version: number;
|
|
824
|
+
name: string;
|
|
825
|
+
isDefault: boolean;
|
|
826
|
+
paymentPaths: PaymentTransitionPath[];
|
|
827
|
+
fulfillmentPaths: FulfillmentTransitionPath[];
|
|
828
|
+
paymentPathMode: PathMode;
|
|
829
|
+
fulfillmentPathMode: PathMode;
|
|
830
|
+
crossAxisRules: CrossAxisRule[];
|
|
831
|
+
transitionConditions: TransitionConditionSet[];
|
|
832
|
+
validInitialStates: StatePair[];
|
|
833
|
+
displayStateMap: DisplayStateRule[];
|
|
834
|
+
createdAt: Date;
|
|
835
|
+
updatedAt: Date;
|
|
836
|
+
}
|
|
837
|
+
interface StateConfig extends StoredStateConfig {
|
|
838
|
+
readonly paymentStates: readonly PaymentStateDefinition[];
|
|
839
|
+
readonly fulfillmentStates: readonly FulfillmentStateDefinition[];
|
|
840
|
+
}
|
|
841
|
+
interface TransitionRequest {
|
|
842
|
+
from: StatePair | null;
|
|
843
|
+
to: StatePair;
|
|
844
|
+
config: StateConfig;
|
|
845
|
+
context: OrderContext;
|
|
846
|
+
skipConditionEvaluation?: boolean;
|
|
847
|
+
}
|
|
848
|
+
type TransitionBlockedBy = 'financial_invariant' | 'cross_axis_rule' | 'path' | 'condition';
|
|
849
|
+
interface FailedCondition {
|
|
850
|
+
field: string;
|
|
851
|
+
operator: ConditionOperator;
|
|
852
|
+
value: unknown;
|
|
853
|
+
reason?: string;
|
|
854
|
+
}
|
|
855
|
+
interface TransitionResult {
|
|
856
|
+
allowed: boolean;
|
|
857
|
+
blockedBy?: TransitionBlockedBy;
|
|
858
|
+
guard?: string;
|
|
859
|
+
reason?: string;
|
|
860
|
+
failedConditions?: FailedCondition[];
|
|
861
|
+
}
|
|
862
|
+
interface AvailableTransition {
|
|
863
|
+
to: StatePair;
|
|
864
|
+
displayLabel: string;
|
|
865
|
+
conditions: {
|
|
866
|
+
met: boolean;
|
|
867
|
+
description: string;
|
|
868
|
+
}[];
|
|
869
|
+
}
|
|
870
|
+
interface ConfigValidationError {
|
|
871
|
+
code: string;
|
|
872
|
+
message: string;
|
|
873
|
+
path?: string;
|
|
874
|
+
}
|
|
875
|
+
interface ConfigValidationWarning {
|
|
876
|
+
code: string;
|
|
877
|
+
message: string;
|
|
878
|
+
path?: string;
|
|
879
|
+
}
|
|
880
|
+
interface ConfigValidationResult {
|
|
881
|
+
valid: boolean;
|
|
882
|
+
errors: ConfigValidationError[];
|
|
883
|
+
warnings: ConfigValidationWarning[];
|
|
884
|
+
}
|
|
885
|
+
interface StateConfigFragment {
|
|
886
|
+
paymentPaths?: PaymentTransitionPath[];
|
|
887
|
+
fulfillmentPaths?: FulfillmentTransitionPath[];
|
|
888
|
+
crossAxisRules?: CrossAxisRule[];
|
|
889
|
+
transitionConditions?: TransitionConditionSet[];
|
|
890
|
+
validInitialStates?: StatePair[];
|
|
891
|
+
displayStateMap?: DisplayStateRule[];
|
|
892
|
+
}
|
|
893
|
+
interface FragmentParam {
|
|
894
|
+
key: string;
|
|
895
|
+
label: string;
|
|
896
|
+
type: 'string' | 'number' | 'boolean';
|
|
897
|
+
default: unknown;
|
|
898
|
+
min?: number;
|
|
899
|
+
max?: number;
|
|
900
|
+
options?: string[];
|
|
901
|
+
}
|
|
902
|
+
|
|
289
903
|
interface StateSchema {
|
|
290
904
|
readonly paymentStates: readonly PaymentStateDefinition[];
|
|
291
905
|
readonly fulfillmentStates: readonly FulfillmentStateDefinition[];
|
|
@@ -305,7 +919,6 @@ declare const DEFAULT_CONFIG: StoredStateConfig;
|
|
|
305
919
|
declare function buildResolvedConfig(config: StoredStateConfig): StateConfig;
|
|
306
920
|
declare const DEFAULT_RESOLVED_CONFIG: StateConfig;
|
|
307
921
|
|
|
308
|
-
declare const POS_CROSS_AXIS_RULES: readonly CrossAxisRule[];
|
|
309
922
|
declare const POS_VALID_INITIAL_STATES: readonly StatePair[];
|
|
310
923
|
declare function buildPosPresetConfig(companyId?: string): StoredStateConfig;
|
|
311
924
|
|
|
@@ -465,4 +1078,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
465
1078
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
466
1079
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
467
1080
|
|
|
468
|
-
export { type Amount, AvailableTransition, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, Condition, type ConfigUpdatedPayload, ConfigValidationError, ConfigValidationResult, CrossAxisRule, CurrencyCode, type CurrencyConfig, type CurrencyRate, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, DisplayStateResult, DisplayStateRule, EUFixedRates, EUROPE, type EndOfSessionReport, FINANCIAL_INVARIANTS, FailedCondition, type FeesBreakdown, type FeesTuple, FinancialInvariant, FragmentParam, type FragmentValidationResult, FulfillmentState, FulfillmentStateDefinition, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, NAFixedRates, NORTH_AMERICA, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, OrderContext, OrderLikeForContext, OrderLikeForLegacyInference, type OrderStateEventPayload, OrderStateWritable, OtherFixedRates,
|
|
1081
|
+
export { type Amount, AttributeType, type AvailableTransition, CONDITION_OPERATORS, COUNTRY_CURRENCIES, CURRENCY_CONFIG, type CartDiscountBucket, type CartFeeBucket, type CashDrawer, type CashRoundingTuple, CompanyType, type Condition, type ConditionGroup, type ConditionOperator, type ConfigUpdatedPayload, type ConfigValidationError, type ConfigValidationResult, type ConfigValidationWarning, type CrossAxisRequires, type CrossAxisRule, type CrossAxisTrigger, CurrencyCode, type CurrencyConfig, type CurrencyRate, CustomTableAvailability, CustomerPlatform, DEFAULT_CONFIG, DEFAULT_CROSS_AXIS_RULES, DEFAULT_DISPLAY_STATE_MAP, DEFAULT_RESOLVED_CONFIG, type DeleteStateConfigFragmentParams, type DeleteStateConfigFragmentResponse, type DiscountsBreakdown, type DiscountsTuple, type DisplayStateResult, type DisplayStateRule, EUFixedRates, EUROPE, type EndOfSessionReport, ExtensionCategory, FINANCIAL_INVARIANTS, FULFILLMENT_STATES, type FailedCondition, type FeesBreakdown, FeesCustomBillingStatus, type FeesTuple, type FinancialInvariant, type FragmentParam, type FragmentValidationResult, type FulfillmentState, type FulfillmentStateDefinition, type FulfillmentTransitionPath, type GetAvailableTransitionsParams, type GetAvailableTransitionsResponse, type GetOrderDisplayStateParams, type GetOrderDisplayStateResponse, type GetOrderStateConfigParams, type GetOrderStateConfigResponse, type GetStateConfigFragmentParams, type GetStateConfigFragmentResponse, InventoryBaseActionEnum, type InventoryBaseActionType, InventorySpecificActionType, InvoiceStatus, LibraryItemType, MenuProject, NAFixedRates, NORTH_AMERICA, NonRevenueItemType, ORDER_STATE_ACTIONS, ORDER_STATE_EVENTS, ORDER_STATE_TOPIC, type OrderContext, type OrderLikeForContext, type OrderLikeForLegacyInference, type OrderLineItem, type OrderPaymentMethod, OrderPlatform, type OrderRefund, type OrderStateEventPayload, type OrderStateWritable, OtherFixedRates, OwnerType, PATH_MODES, PAYMENT_STATES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, PaymentProcessor, type PaymentState, type PaymentStateDefinition, type PaymentTransitionPath, Platform, PreviewImageMode, PricingLevel, PricingPlanEnum, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, ProductStatus, ProductType, PublicationAvailability, type PublicationConfig, PublicationStatus, REGION_MAPPING, REPORT_NEGATE_PATHS, ReceiptSendChannel, ReceiptType, type RefundsBreakdown, ResidualPaymentMethod, ResidualStatus, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementBuckets, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, type SplitPayment, type SplitPaymentPayment, type StaffSales, type StaffSalesEntry, type StateConfig, type StateConfigFragment, type StateDefinition, type StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StationStatus, type StoredStateConfig, StripeCurrencyCode, StripeStatus, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, TimePeriod, type TipEntry, type TipsBreakdown, type TipsTuple, TopMetericsSort, type TransitionBlockedBy, type TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, type TransitionPath, type TransitionRequest, type TransitionResult, UserTypes, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCashAmountDue, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getGoodsPortion, getLineSubtotal, getMinorUnitMultiplier, getMinorUnits, getPaymentLegTotal, getPricingRegionFromCountry, getSettlementTotal, getTotalCollected, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|