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