@final-commerce/common 1.1.4-beta.4 → 1.1.4-beta.5

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.
@@ -1,598 +0,0 @@
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
- }
339
-
340
- declare enum ProductType {
341
- SIMPLE = "simple",
342
- VARIABLE = "variable"
343
- }
344
- declare enum ProductStatus {
345
- ACTIVE = "active",
346
- INACTIVE = "inactive",
347
- DRAFT = "draft"
348
- }
349
-
350
- type PaymentState = 'unpaid' | 'payment_pending' | 'partially_paid' | 'paid' | 'partially_refunded' | 'refunded' | 'voided';
351
- type FulfillmentState = 'draft' | 'pending' | 'on_hold' | 'in_progress' | 'fulfilled' | 'partially_fulfilled' | 'returned' | 'partially_returned' | 'cancelled';
352
- declare const PAYMENT_STATES: readonly PaymentState[];
353
- declare const FULFILLMENT_STATES: readonly FulfillmentState[];
354
- declare function isPaymentState(value: string): value is PaymentState;
355
- declare function isFulfillmentState(value: string): value is FulfillmentState;
356
- interface StatePair {
357
- payment: PaymentState;
358
- fulfillment: FulfillmentState;
359
- }
360
- type ConditionOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'notIn' | 'isEmpty' | 'isNotEmpty';
361
- declare const CONDITION_OPERATORS: readonly ConditionOperator[];
362
- declare function isConditionOperator(value: string): value is ConditionOperator;
363
- type PathMode = 'strict' | 'permissive';
364
- declare const PATH_MODES: readonly PathMode[];
365
-
366
- interface OrderPaymentMethod {
367
- id?: string;
368
- amount?: number;
369
- [key: string]: unknown;
370
- }
371
- interface OrderRefund {
372
- id?: string;
373
- quantity?: number;
374
- [key: string]: unknown;
375
- }
376
- interface OrderLineItem {
377
- id?: string;
378
- quantity?: number;
379
- fulfilledQuantity?: number;
380
- returnedQuantity?: number;
381
- [key: string]: unknown;
382
- }
383
- interface SplitPaymentPayment {
384
- amount?: number;
385
- [key: string]: unknown;
386
- }
387
- interface SplitPayment {
388
- payments: SplitPaymentPayment[];
389
- amountRemaining: number;
390
- }
391
- interface OrderContext {
392
- order: {
393
- total: number;
394
- balance: number;
395
- paymentMethods: OrderPaymentMethod[];
396
- refunds: OrderRefund[];
397
- lineItems: OrderLineItem[];
398
- };
399
- computed: {
400
- balance: number;
401
- isFullyPaid: boolean;
402
- hasPartialPayments: boolean;
403
- totalPaid: number;
404
- totalRefunded: number;
405
- itemCount: number;
406
- fulfilledItemCount: number;
407
- returnedItemCount: number;
408
- isFullyReturned: boolean;
409
- hasPartialReturns: boolean;
410
- };
411
- splitPayment?: SplitPayment;
412
- }
413
- interface PaymentStateDefinition {
414
- id: PaymentState;
415
- label: string;
416
- isBase: boolean;
417
- isTerminal: boolean;
418
- color?: string;
419
- icon?: string;
420
- }
421
- interface FulfillmentStateDefinition {
422
- id: FulfillmentState;
423
- label: string;
424
- isBase: boolean;
425
- isTerminal: boolean;
426
- color?: string;
427
- icon?: string;
428
- }
429
- type StateDefinition = PaymentStateDefinition | FulfillmentStateDefinition;
430
- interface PaymentTransitionPath {
431
- from: PaymentState;
432
- to: PaymentState;
433
- conditionSetId?: string;
434
- _sourceExtensionId?: string;
435
- }
436
- interface FulfillmentTransitionPath {
437
- from: FulfillmentState;
438
- to: FulfillmentState;
439
- conditionSetId?: string;
440
- _sourceExtensionId?: string;
441
- }
442
- type TransitionPath = PaymentTransitionPath | FulfillmentTransitionPath;
443
- interface Condition {
444
- field: string;
445
- operator: ConditionOperator;
446
- value: unknown;
447
- }
448
- interface ConditionGroup {
449
- conditions: Condition[];
450
- }
451
- interface TransitionConditionSet {
452
- id: string;
453
- label: string;
454
- groups: ConditionGroup[];
455
- _sourceExtensionId?: string;
456
- }
457
- type CrossAxisTrigger = {
458
- axis: 'payment';
459
- to: PaymentState | PaymentState[];
460
- } | {
461
- axis: 'fulfillment';
462
- to: FulfillmentState | FulfillmentState[];
463
- };
464
- type CrossAxisRequires = {
465
- axis: 'payment';
466
- states: PaymentState[];
467
- } | {
468
- axis: 'fulfillment';
469
- states: FulfillmentState[];
470
- };
471
- interface CrossAxisRule {
472
- id: string;
473
- label: string;
474
- description?: string;
475
- enabled: boolean;
476
- trigger: CrossAxisTrigger;
477
- requires: CrossAxisRequires;
478
- _sourceExtensionId?: string;
479
- }
480
- interface FinancialInvariant {
481
- id: string;
482
- description: string;
483
- check: (from: StatePair | null, to: StatePair) => boolean;
484
- }
485
- interface DisplayStateRule {
486
- paymentState?: PaymentState | PaymentState[];
487
- fulfillmentState?: FulfillmentState | FulfillmentState[];
488
- label: string;
489
- color?: string;
490
- icon?: string;
491
- _sourceExtensionId?: string;
492
- }
493
- interface DisplayStateResult {
494
- label: string;
495
- color?: string;
496
- icon?: string;
497
- }
498
- interface OrderStateWritable {
499
- paymentState?: PaymentState;
500
- fulfillmentState?: FulfillmentState;
501
- displayState?: string;
502
- status?: string;
503
- }
504
- interface OrderLikeForContext {
505
- total?: number;
506
- balance?: number;
507
- paymentMethods?: OrderPaymentMethod[];
508
- refunds?: OrderRefund[];
509
- refund?: OrderRefund[];
510
- lineItems?: OrderLineItem[];
511
- }
512
- interface OrderLikeForLegacyInference extends OrderLikeForContext {
513
- status?: string;
514
- }
515
- interface StoredStateConfig {
516
- _id: string;
517
- companyId: string;
518
- version: number;
519
- name: string;
520
- isDefault: boolean;
521
- paymentPaths: PaymentTransitionPath[];
522
- fulfillmentPaths: FulfillmentTransitionPath[];
523
- paymentPathMode: PathMode;
524
- fulfillmentPathMode: PathMode;
525
- crossAxisRules: CrossAxisRule[];
526
- transitionConditions: TransitionConditionSet[];
527
- validInitialStates: StatePair[];
528
- displayStateMap: DisplayStateRule[];
529
- createdAt: Date;
530
- updatedAt: Date;
531
- }
532
- interface StateConfig extends StoredStateConfig {
533
- readonly paymentStates: readonly PaymentStateDefinition[];
534
- readonly fulfillmentStates: readonly FulfillmentStateDefinition[];
535
- }
536
- interface TransitionRequest {
537
- from: StatePair | null;
538
- to: StatePair;
539
- config: StateConfig;
540
- context: OrderContext;
541
- skipConditionEvaluation?: boolean;
542
- }
543
- type TransitionBlockedBy = 'financial_invariant' | 'cross_axis_rule' | 'path' | 'condition';
544
- interface FailedCondition {
545
- field: string;
546
- operator: ConditionOperator;
547
- value: unknown;
548
- reason?: string;
549
- }
550
- interface TransitionResult {
551
- allowed: boolean;
552
- blockedBy?: TransitionBlockedBy;
553
- guard?: string;
554
- reason?: string;
555
- failedConditions?: FailedCondition[];
556
- }
557
- interface AvailableTransition {
558
- to: StatePair;
559
- displayLabel: string;
560
- conditions: {
561
- met: boolean;
562
- description: string;
563
- }[];
564
- }
565
- interface ConfigValidationError {
566
- code: string;
567
- message: string;
568
- path?: string;
569
- }
570
- interface ConfigValidationWarning {
571
- code: string;
572
- message: string;
573
- path?: string;
574
- }
575
- interface ConfigValidationResult {
576
- valid: boolean;
577
- errors: ConfigValidationError[];
578
- warnings: ConfigValidationWarning[];
579
- }
580
- interface StateConfigFragment {
581
- paymentPaths?: PaymentTransitionPath[];
582
- fulfillmentPaths?: FulfillmentTransitionPath[];
583
- crossAxisRules?: CrossAxisRule[];
584
- transitionConditions?: TransitionConditionSet[];
585
- validInitialStates?: StatePair[];
586
- displayStateMap?: DisplayStateRule[];
587
- }
588
- interface FragmentParam {
589
- key: string;
590
- label: string;
591
- type: 'string' | 'number' | 'boolean';
592
- default: unknown;
593
- min?: number;
594
- max?: number;
595
- options?: string[];
596
- }
597
-
598
- export { type OrderRefund as $, type AvailableTransition as A, type ConfigValidationWarning as B, CurrencyCode as C, type DisplayStateRule as D, type CrossAxisRequires as E, type FulfillmentStateDefinition as F, type CrossAxisTrigger as G, CustomTableAvailability as H, CustomerPlatform as I, ExtensionCategory as J, FULFILLMENT_STATES as K, FeesCustomBillingStatus as L, type FulfillmentTransitionPath as M, InventoryBaseActionEnum as N, type OrderContext as O, PricingRegionEnum as P, type InventoryBaseActionType as Q, InventorySpecificActionType as R, type StatePair as S, type TransitionConditionSet as T, InvoiceStatus as U, LibraryItemType as V, MenuProject as W, NonRevenueItemType as X, type OrderLineItem as Y, type OrderPaymentMethod as Z, OrderPlatform as _, type PaymentStateDefinition as a, OwnerType as a0, PATH_MODES as a1, PAYMENT_STATES as a2, type PathMode as a3, PaymentMethod as a4, type PaymentTransitionPath as a5, Platform as a6, PreviewImageMode as a7, PricingLevel as a8, PricingPlanEnum as a9, ProductStatus as aa, ProductType as ab, PublicationAvailability as ac, type PublicationConfig as ad, PublicationStatus as ae, ReceiptSendChannel as af, ReceiptType as ag, ResidualPaymentMethod as ah, ResidualStatus as ai, type SplitPaymentPayment as aj, type StateDefinition as ak, StationStatus as al, StripeStatus as am, TimePeriod as an, TopMetericsSort as ao, type TransitionPath as ap, UserTypes as aq, isConditionOperator as ar, isFulfillmentState as as, isPaymentState as at, type FinancialInvariant as b, type CrossAxisRule as c, type StoredStateConfig as d, type StateConfig as e, type ConfigValidationResult as f, type DisplayStateResult as g, type Condition as h, type FailedCondition as i, type OrderLikeForContext as j, type SplitPayment as k, type TransitionRequest as l, type TransitionResult as m, type OrderStateWritable as n, type PaymentState as o, type FulfillmentState as p, type OrderLikeForLegacyInference as q, type StateConfigFragment as r, type FragmentParam as s, type ConfigValidationError as t, type TransitionBlockedBy as u, AttributeType as v, CONDITION_OPERATORS as w, CompanyType as x, type ConditionGroup as y, type ConditionOperator as z };