@final-commerce/common 2.0.2 → 2.0.3
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 +597 -3
- package/dist/index.d.ts +597 -3
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -1
- package/dist/pos-types/index.d.mts +292 -2
- package/dist/pos-types/index.d.ts +292 -2
- package/dist/pos-types/index.js +3 -3
- package/package.json +3 -3
- package/dist/interfaces-DIX_ROSP.d.mts +0 -589
- package/dist/interfaces-DIX_ROSP.d.ts +0 -589
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,341 @@
|
|
|
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
|
+
}
|
|
223
|
+
declare enum ExtensionCategory {
|
|
224
|
+
SYNC = "sync",
|
|
225
|
+
PAYMENT = "payment",
|
|
226
|
+
HUB = "hub",
|
|
227
|
+
BUILDER = "builder"
|
|
228
|
+
}
|
|
229
|
+
declare enum FeesCustomBillingStatus {
|
|
230
|
+
UNPAID = "unpaid",
|
|
231
|
+
PAID = "paid",
|
|
232
|
+
OPEN = "open"
|
|
233
|
+
}
|
|
234
|
+
declare enum PricingPlanEnum {
|
|
235
|
+
DEFAULT = "default",
|
|
236
|
+
MINIMUM = "minimum",
|
|
237
|
+
ORGANIZATION = "organization",
|
|
238
|
+
PLAN = "plan",
|
|
239
|
+
COMPANY = "company"
|
|
240
|
+
}
|
|
241
|
+
declare enum PricingLevel {
|
|
242
|
+
ORG = "org",
|
|
243
|
+
PLAN = "plan",
|
|
244
|
+
DEFAULT = "default",
|
|
245
|
+
MINIMUM = "minimum"
|
|
246
|
+
}
|
|
247
|
+
declare enum PricingRegionEnum {
|
|
248
|
+
EUROPE = "europe",
|
|
249
|
+
OTHER = "others",
|
|
250
|
+
NORTH_AMERICA = "northAmerica"
|
|
251
|
+
}
|
|
252
|
+
declare enum MenuProject {
|
|
253
|
+
MANAGE = "Manage",
|
|
254
|
+
SCALE = "Scale",
|
|
255
|
+
BUILD = "Build",
|
|
256
|
+
PAY = "Pay",
|
|
257
|
+
RUN = "Run"
|
|
258
|
+
}
|
|
259
|
+
declare enum UserTypes {
|
|
260
|
+
COMPANY_OWNER = "owner",
|
|
261
|
+
ORG_USER = "organization_user",
|
|
262
|
+
ORG_OWNER = "organization_owner",
|
|
263
|
+
FINAL_USER = "final_user",
|
|
264
|
+
FINAL_OWNER = "final_owner",
|
|
265
|
+
EMPLOYEE = "employee",
|
|
266
|
+
SUPER_ADMIN = "super_admin",
|
|
267
|
+
MANAGER = "manager",
|
|
268
|
+
ADMIN = "admin",
|
|
269
|
+
ASSISTANT_MANAGER = "assistant",
|
|
270
|
+
CASHIER = "cashier",
|
|
271
|
+
RESELLER = "reseller"
|
|
272
|
+
}
|
|
273
|
+
declare enum OwnerType {
|
|
274
|
+
API_KEY = "api-key",
|
|
275
|
+
ORGANIZATION = "organization",
|
|
276
|
+
COMPANY = "company"
|
|
277
|
+
}
|
|
278
|
+
declare enum PublicationAvailability {
|
|
279
|
+
GLOBAL = "global",
|
|
280
|
+
PRIVATE = "private"
|
|
281
|
+
}
|
|
282
|
+
declare enum PublicationStatus {
|
|
283
|
+
APPROVED = "approved",
|
|
284
|
+
REJECTED = "rejected",
|
|
285
|
+
PENDING = "pending",
|
|
286
|
+
NOT_APPLICABLE = "not_applicable"
|
|
287
|
+
}
|
|
288
|
+
interface PublicationConfig {
|
|
289
|
+
availability: PublicationAvailability;
|
|
290
|
+
status: PublicationStatus;
|
|
291
|
+
}
|
|
292
|
+
declare enum ResidualStatus {
|
|
293
|
+
PAID = "paid",
|
|
294
|
+
DUE = "due",
|
|
295
|
+
ACCRUING = "accruing"
|
|
296
|
+
}
|
|
297
|
+
declare enum PreviewImageMode {
|
|
298
|
+
STATIC = "static",
|
|
299
|
+
DYNAMIC = "dynamic"
|
|
300
|
+
}
|
|
301
|
+
declare enum LibraryItemType {
|
|
302
|
+
FLOW = "flow",
|
|
303
|
+
PAGE = "page",
|
|
304
|
+
COMPOSITION = "composition",
|
|
305
|
+
LAYOUT = "layout"
|
|
306
|
+
}
|
|
307
|
+
declare enum ResidualPaymentMethod {
|
|
308
|
+
CHEQUE = "cheque"
|
|
309
|
+
}
|
|
310
|
+
declare enum PaymentMethod {
|
|
311
|
+
CUSTOM = "Custom",
|
|
312
|
+
CASH = "Cash",
|
|
313
|
+
TERMINAL = "Terminal",
|
|
314
|
+
CLOUD = "Cloud",
|
|
315
|
+
BLUETOOTH = "Bluetooth"
|
|
316
|
+
}
|
|
317
|
+
declare enum NonRevenueItemType {
|
|
318
|
+
GIFT_CARD = "gift-card"
|
|
319
|
+
}
|
|
320
|
+
declare enum ReceiptSendChannel {
|
|
321
|
+
EMAIL = "email",
|
|
322
|
+
TEXT = "text"
|
|
323
|
+
}
|
|
324
|
+
declare enum ReceiptType {
|
|
325
|
+
ORDER = "order",
|
|
326
|
+
REFUND = "refund"
|
|
327
|
+
}
|
|
328
|
+
declare enum StripeStatus {
|
|
329
|
+
ACTIVE = "active",
|
|
330
|
+
INACTIVE = "inactive",
|
|
331
|
+
PAYMENT_METHOD_REQUIRED = "payment_method_required",
|
|
332
|
+
PAYMENT_METHOD_ADDED = "payment_method_added"
|
|
333
|
+
}
|
|
334
|
+
declare enum InvoiceStatus {
|
|
335
|
+
PAID = "paid",
|
|
336
|
+
PENDING = "pending",
|
|
337
|
+
EXPIRED = "expired"
|
|
338
|
+
}
|
|
3
339
|
|
|
4
340
|
declare enum StripeCurrencyCode {
|
|
5
341
|
USD = "USD",
|
|
@@ -45,6 +381,16 @@ declare enum StripeCurrencyCode {
|
|
|
45
381
|
IQD = "IQD"
|
|
46
382
|
}
|
|
47
383
|
|
|
384
|
+
declare enum ProductType {
|
|
385
|
+
SIMPLE = "simple",
|
|
386
|
+
VARIABLE = "variable"
|
|
387
|
+
}
|
|
388
|
+
declare enum ProductStatus {
|
|
389
|
+
ACTIVE = "active",
|
|
390
|
+
INACTIVE = "inactive",
|
|
391
|
+
DRAFT = "draft"
|
|
392
|
+
}
|
|
393
|
+
|
|
48
394
|
interface CurrencyConfig {
|
|
49
395
|
minorUnits: number;
|
|
50
396
|
symbol: string;
|
|
@@ -286,6 +632,254 @@ declare function generateMongoID(): string;
|
|
|
286
632
|
declare function getCurrentISODate(): string;
|
|
287
633
|
declare function normalizeMongoIdString(value: unknown): string | null;
|
|
288
634
|
|
|
635
|
+
type PaymentState = 'unpaid' | 'payment_pending' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'voided';
|
|
636
|
+
type FulfillmentState = 'draft' | 'pending' | 'on_hold' | 'in_progress' | 'fulfilled' | 'partially_fulfilled' | 'returned' | 'partially_returned' | 'cancelled';
|
|
637
|
+
declare const PAYMENT_STATES: readonly PaymentState[];
|
|
638
|
+
declare const FULFILLMENT_STATES: readonly FulfillmentState[];
|
|
639
|
+
declare function isPaymentState(value: string): value is PaymentState;
|
|
640
|
+
declare function isFulfillmentState(value: string): value is FulfillmentState;
|
|
641
|
+
interface StatePair {
|
|
642
|
+
payment: PaymentState;
|
|
643
|
+
fulfillment: FulfillmentState;
|
|
644
|
+
}
|
|
645
|
+
type ConditionOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'notIn' | 'isEmpty' | 'isNotEmpty';
|
|
646
|
+
declare const CONDITION_OPERATORS: readonly ConditionOperator[];
|
|
647
|
+
declare function isConditionOperator(value: string): value is ConditionOperator;
|
|
648
|
+
type PathMode = 'strict' | 'permissive';
|
|
649
|
+
declare const PATH_MODES: readonly PathMode[];
|
|
650
|
+
|
|
651
|
+
interface OrderPaymentMethod {
|
|
652
|
+
id?: string;
|
|
653
|
+
amount?: number;
|
|
654
|
+
[key: string]: unknown;
|
|
655
|
+
}
|
|
656
|
+
interface OrderRefund {
|
|
657
|
+
id?: string;
|
|
658
|
+
quantity?: number;
|
|
659
|
+
[key: string]: unknown;
|
|
660
|
+
}
|
|
661
|
+
interface OrderLineItem {
|
|
662
|
+
id?: string;
|
|
663
|
+
quantity?: number;
|
|
664
|
+
fulfilledQuantity?: number;
|
|
665
|
+
returnedQuantity?: number;
|
|
666
|
+
[key: string]: unknown;
|
|
667
|
+
}
|
|
668
|
+
interface SplitPaymentPayment {
|
|
669
|
+
amount?: number;
|
|
670
|
+
[key: string]: unknown;
|
|
671
|
+
}
|
|
672
|
+
interface SplitPayment {
|
|
673
|
+
payments: SplitPaymentPayment[];
|
|
674
|
+
amountRemaining: number;
|
|
675
|
+
}
|
|
676
|
+
interface OrderContext {
|
|
677
|
+
order: {
|
|
678
|
+
total: number;
|
|
679
|
+
balance: number;
|
|
680
|
+
paymentMethods: OrderPaymentMethod[];
|
|
681
|
+
refunds: OrderRefund[];
|
|
682
|
+
lineItems: OrderLineItem[];
|
|
683
|
+
};
|
|
684
|
+
computed: {
|
|
685
|
+
balance: number;
|
|
686
|
+
isFullyPaid: boolean;
|
|
687
|
+
hasPartialPayments: boolean;
|
|
688
|
+
totalPaid: number;
|
|
689
|
+
totalRefunded: number;
|
|
690
|
+
itemCount: number;
|
|
691
|
+
fulfilledItemCount: number;
|
|
692
|
+
returnedItemCount: number;
|
|
693
|
+
isFullyReturned: boolean;
|
|
694
|
+
hasPartialReturns: boolean;
|
|
695
|
+
};
|
|
696
|
+
splitPayment?: SplitPayment;
|
|
697
|
+
}
|
|
698
|
+
interface PaymentStateDefinition {
|
|
699
|
+
id: PaymentState;
|
|
700
|
+
label: string;
|
|
701
|
+
isBase: boolean;
|
|
702
|
+
isTerminal: boolean;
|
|
703
|
+
color?: string;
|
|
704
|
+
icon?: string;
|
|
705
|
+
}
|
|
706
|
+
interface FulfillmentStateDefinition {
|
|
707
|
+
id: FulfillmentState;
|
|
708
|
+
label: string;
|
|
709
|
+
isBase: boolean;
|
|
710
|
+
isTerminal: boolean;
|
|
711
|
+
color?: string;
|
|
712
|
+
icon?: string;
|
|
713
|
+
}
|
|
714
|
+
type StateDefinition = PaymentStateDefinition | FulfillmentStateDefinition;
|
|
715
|
+
interface PaymentTransitionPath {
|
|
716
|
+
from: PaymentState;
|
|
717
|
+
to: PaymentState;
|
|
718
|
+
conditionSetId?: string;
|
|
719
|
+
_sourceExtensionId?: string;
|
|
720
|
+
}
|
|
721
|
+
interface FulfillmentTransitionPath {
|
|
722
|
+
from: FulfillmentState;
|
|
723
|
+
to: FulfillmentState;
|
|
724
|
+
conditionSetId?: string;
|
|
725
|
+
_sourceExtensionId?: string;
|
|
726
|
+
}
|
|
727
|
+
type TransitionPath = PaymentTransitionPath | FulfillmentTransitionPath;
|
|
728
|
+
interface Condition {
|
|
729
|
+
field: string;
|
|
730
|
+
operator: ConditionOperator;
|
|
731
|
+
value: unknown;
|
|
732
|
+
}
|
|
733
|
+
interface ConditionGroup {
|
|
734
|
+
conditions: Condition[];
|
|
735
|
+
}
|
|
736
|
+
interface TransitionConditionSet {
|
|
737
|
+
id: string;
|
|
738
|
+
label: string;
|
|
739
|
+
groups: ConditionGroup[];
|
|
740
|
+
_sourceExtensionId?: string;
|
|
741
|
+
}
|
|
742
|
+
type CrossAxisTrigger = {
|
|
743
|
+
axis: 'payment';
|
|
744
|
+
to: PaymentState | PaymentState[];
|
|
745
|
+
} | {
|
|
746
|
+
axis: 'fulfillment';
|
|
747
|
+
to: FulfillmentState | FulfillmentState[];
|
|
748
|
+
};
|
|
749
|
+
type CrossAxisRequires = {
|
|
750
|
+
axis: 'payment';
|
|
751
|
+
states: PaymentState[];
|
|
752
|
+
} | {
|
|
753
|
+
axis: 'fulfillment';
|
|
754
|
+
states: FulfillmentState[];
|
|
755
|
+
};
|
|
756
|
+
interface CrossAxisRule {
|
|
757
|
+
id: string;
|
|
758
|
+
label: string;
|
|
759
|
+
description?: string;
|
|
760
|
+
enabled: boolean;
|
|
761
|
+
trigger: CrossAxisTrigger;
|
|
762
|
+
requires: CrossAxisRequires;
|
|
763
|
+
_sourceExtensionId?: string;
|
|
764
|
+
}
|
|
765
|
+
interface FinancialInvariant {
|
|
766
|
+
id: string;
|
|
767
|
+
description: string;
|
|
768
|
+
check: (from: StatePair | null, to: StatePair) => boolean;
|
|
769
|
+
}
|
|
770
|
+
interface DisplayStateRule {
|
|
771
|
+
paymentState?: PaymentState | PaymentState[];
|
|
772
|
+
fulfillmentState?: FulfillmentState | FulfillmentState[];
|
|
773
|
+
label: string;
|
|
774
|
+
color?: string;
|
|
775
|
+
icon?: string;
|
|
776
|
+
_sourceExtensionId?: string;
|
|
777
|
+
}
|
|
778
|
+
interface DisplayStateResult {
|
|
779
|
+
label: string;
|
|
780
|
+
color?: string;
|
|
781
|
+
icon?: string;
|
|
782
|
+
}
|
|
783
|
+
interface OrderStateWritable {
|
|
784
|
+
paymentState?: PaymentState;
|
|
785
|
+
fulfillmentState?: FulfillmentState;
|
|
786
|
+
displayState?: string;
|
|
787
|
+
status?: string;
|
|
788
|
+
}
|
|
789
|
+
interface OrderLikeForContext {
|
|
790
|
+
total?: number;
|
|
791
|
+
balance?: number;
|
|
792
|
+
paymentMethods?: OrderPaymentMethod[];
|
|
793
|
+
refunds?: OrderRefund[];
|
|
794
|
+
refund?: OrderRefund[];
|
|
795
|
+
lineItems?: OrderLineItem[];
|
|
796
|
+
}
|
|
797
|
+
interface OrderLikeForLegacyInference extends OrderLikeForContext {
|
|
798
|
+
status?: string;
|
|
799
|
+
}
|
|
800
|
+
interface StoredStateConfig {
|
|
801
|
+
_id: string;
|
|
802
|
+
companyId: string;
|
|
803
|
+
version: number;
|
|
804
|
+
name: string;
|
|
805
|
+
isDefault: boolean;
|
|
806
|
+
paymentPaths: PaymentTransitionPath[];
|
|
807
|
+
fulfillmentPaths: FulfillmentTransitionPath[];
|
|
808
|
+
paymentPathMode: PathMode;
|
|
809
|
+
fulfillmentPathMode: PathMode;
|
|
810
|
+
crossAxisRules: CrossAxisRule[];
|
|
811
|
+
transitionConditions: TransitionConditionSet[];
|
|
812
|
+
validInitialStates: StatePair[];
|
|
813
|
+
displayStateMap: DisplayStateRule[];
|
|
814
|
+
createdAt: Date;
|
|
815
|
+
updatedAt: Date;
|
|
816
|
+
}
|
|
817
|
+
interface StateConfig extends StoredStateConfig {
|
|
818
|
+
readonly paymentStates: readonly PaymentStateDefinition[];
|
|
819
|
+
readonly fulfillmentStates: readonly FulfillmentStateDefinition[];
|
|
820
|
+
}
|
|
821
|
+
interface TransitionRequest {
|
|
822
|
+
from: StatePair | null;
|
|
823
|
+
to: StatePair;
|
|
824
|
+
config: StateConfig;
|
|
825
|
+
context: OrderContext;
|
|
826
|
+
skipConditionEvaluation?: boolean;
|
|
827
|
+
}
|
|
828
|
+
type TransitionBlockedBy = 'financial_invariant' | 'cross_axis_rule' | 'path' | 'condition';
|
|
829
|
+
interface FailedCondition {
|
|
830
|
+
field: string;
|
|
831
|
+
operator: ConditionOperator;
|
|
832
|
+
value: unknown;
|
|
833
|
+
reason?: string;
|
|
834
|
+
}
|
|
835
|
+
interface TransitionResult {
|
|
836
|
+
allowed: boolean;
|
|
837
|
+
blockedBy?: TransitionBlockedBy;
|
|
838
|
+
guard?: string;
|
|
839
|
+
reason?: string;
|
|
840
|
+
failedConditions?: FailedCondition[];
|
|
841
|
+
}
|
|
842
|
+
interface AvailableTransition {
|
|
843
|
+
to: StatePair;
|
|
844
|
+
displayLabel: string;
|
|
845
|
+
conditions: {
|
|
846
|
+
met: boolean;
|
|
847
|
+
description: string;
|
|
848
|
+
}[];
|
|
849
|
+
}
|
|
850
|
+
interface ConfigValidationError {
|
|
851
|
+
code: string;
|
|
852
|
+
message: string;
|
|
853
|
+
path?: string;
|
|
854
|
+
}
|
|
855
|
+
interface ConfigValidationWarning {
|
|
856
|
+
code: string;
|
|
857
|
+
message: string;
|
|
858
|
+
path?: string;
|
|
859
|
+
}
|
|
860
|
+
interface ConfigValidationResult {
|
|
861
|
+
valid: boolean;
|
|
862
|
+
errors: ConfigValidationError[];
|
|
863
|
+
warnings: ConfigValidationWarning[];
|
|
864
|
+
}
|
|
865
|
+
interface StateConfigFragment {
|
|
866
|
+
paymentPaths?: PaymentTransitionPath[];
|
|
867
|
+
fulfillmentPaths?: FulfillmentTransitionPath[];
|
|
868
|
+
crossAxisRules?: CrossAxisRule[];
|
|
869
|
+
transitionConditions?: TransitionConditionSet[];
|
|
870
|
+
validInitialStates?: StatePair[];
|
|
871
|
+
displayStateMap?: DisplayStateRule[];
|
|
872
|
+
}
|
|
873
|
+
interface FragmentParam {
|
|
874
|
+
key: string;
|
|
875
|
+
label: string;
|
|
876
|
+
type: 'string' | 'number' | 'boolean';
|
|
877
|
+
default: unknown;
|
|
878
|
+
min?: number;
|
|
879
|
+
max?: number;
|
|
880
|
+
options?: string[];
|
|
881
|
+
}
|
|
882
|
+
|
|
289
883
|
interface StateSchema {
|
|
290
884
|
readonly paymentStates: readonly PaymentStateDefinition[];
|
|
291
885
|
readonly fulfillmentStates: readonly FulfillmentStateDefinition[];
|
|
@@ -465,4 +1059,4 @@ declare const EUFixedRates: Record<string, CurrencyRate>;
|
|
|
465
1059
|
declare const OtherFixedRates: Record<string, CurrencyRate>;
|
|
466
1060
|
declare const COUNTRY_CURRENCIES: Record<string, string>;
|
|
467
1061
|
|
|
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, POS_CROSS_AXIS_RULES, POS_VALID_INITIAL_STATES, PaymentState, PaymentStateDefinition, PricingRegionEnum, type ProductDiscountBucket, type ProductFeeBucket, REGION_MAPPING, REPORT_NEGATE_PATHS, type RefundsBreakdown, type ResolveTemplateResult, STATE_SCHEMA, STRIPE_SUPPORTED_COUNTRIES, type SalesSummary, type SaveStateConfigFragmentParams, type SaveStateConfigFragmentResponse, type SettlementBreakdown, type SettlementCardSection, type SettlementCashSection, type SettlementCustomEntry, SplitPayment, type StaffSales, type StaffSalesEntry, StateConfig, StateConfigFragment, StatePair, type StateSchema, type StateTransitionBlockedPayload, type StateTransitionCompletedPayload, StoredStateConfig, StripeCurrencyCode, type TaxBreakdown, type TaxBreakdownRateEntry, type TaxBreakdownSection, type TaxBreakdownSubtotal, type TaxesTuple, type TipEntry, type TipsBreakdown, type TipsTuple, TransitionBlockedBy, TransitionConditionSet, type TransitionOrderStateParams, type TransitionOrderStateResponse, TransitionRequest, TransitionResult, addAmounts, amountToString, baseFulfillmentDefinitions, basePaymentDefinitions, buildOrderContext, buildPosPresetConfig, buildResolvedConfig, calculatePercentage, canTransition, conditionSummary, convertFixedFeeToLocalCurrency, createAmount, crossAxisRuleApplies, deriveDisplayState, displayRuleMatchesPair, divideAmount, evaluateCondition, evaluateConditionSet, formatCurrency, formatMinorUnitsToString, fromMinorUnits, generateMongoID, getAvailableTransitions, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getMinorUnitMultiplier, getMinorUnits, getPricingRegionFromCountry, inferStatesFromLegacyStatus, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|
|
1062
|
+
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_CROSS_AXIS_RULES, POS_VALID_INITIAL_STATES, type PathMode, PaymentMethod, 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 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, getCountriesByRegion, getCurrencyConfig, getCurrentISODate, getFinancialInvariantViolations, getMinorUnitMultiplier, getMinorUnits, getPricingRegionFromCountry, inferStatesFromLegacyStatus, isConditionOperator, isFulfillmentState, isPaymentState, isSupportedCurrency, mapToLegacyStatus, mergeFragment, multiplyAmount, normalizeMongoIdString, parseAmountToMinorUnits, parseCurrencyCode, parseStripeCurrencyCode, removeFragment, resolveTemplate, setOrderState, signReportForDisplay, stringifyMinorUnits, subtractAmounts, toMinorUnits, validateConfig, validateFragmentCompatibility, violatesFinancialInvariant };
|