omni-sync-sdk 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +531 -1
- package/dist/index.d.ts +531 -1
- package/dist/index.js +413 -3
- package/dist/index.mjs +413 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -373,6 +373,14 @@ interface UpdateCustomerDto {
|
|
|
373
373
|
tags?: string[];
|
|
374
374
|
metadata?: Record<string, unknown>;
|
|
375
375
|
}
|
|
376
|
+
interface CustomerQueryParams {
|
|
377
|
+
page?: number;
|
|
378
|
+
limit?: number;
|
|
379
|
+
search?: string;
|
|
380
|
+
hasAccount?: boolean;
|
|
381
|
+
sortBy?: 'createdAt' | 'email' | 'firstName' | 'lastName' | 'lastOrderAt';
|
|
382
|
+
sortOrder?: 'asc' | 'desc';
|
|
383
|
+
}
|
|
376
384
|
interface CreateAddressDto {
|
|
377
385
|
label?: string;
|
|
378
386
|
firstName: string;
|
|
@@ -471,6 +479,9 @@ interface AddToCartDto {
|
|
|
471
479
|
interface UpdateCartItemDto {
|
|
472
480
|
quantity: number;
|
|
473
481
|
}
|
|
482
|
+
interface ApplyCouponDto {
|
|
483
|
+
code: string;
|
|
484
|
+
}
|
|
474
485
|
interface MergeCartsDto {
|
|
475
486
|
sourceSessionToken: string;
|
|
476
487
|
targetCustomerId: string;
|
|
@@ -564,6 +575,9 @@ interface SetShippingAddressDto {
|
|
|
564
575
|
interface SetBillingAddressDto extends SetShippingAddressDto {
|
|
565
576
|
sameAsShipping?: boolean;
|
|
566
577
|
}
|
|
578
|
+
interface SelectShippingMethodDto {
|
|
579
|
+
shippingRateId: string;
|
|
580
|
+
}
|
|
567
581
|
interface SetShippingAddressResponse {
|
|
568
582
|
checkout: Checkout;
|
|
569
583
|
rates: ShippingRate[];
|
|
@@ -580,6 +594,184 @@ interface WebhookEvent {
|
|
|
580
594
|
timestamp: string;
|
|
581
595
|
}
|
|
582
596
|
type WebhookEventType = 'product.created' | 'product.updated' | 'product.deleted' | 'inventory.updated' | 'order.created' | 'order.updated' | 'coupon.created' | 'coupon.updated' | 'coupon.deleted' | 'cart.created' | 'cart.updated' | 'cart.abandoned' | 'checkout.started' | 'checkout.completed' | 'checkout.failed';
|
|
597
|
+
type VariantStatus = 'active' | 'draft';
|
|
598
|
+
interface CreateVariantDto {
|
|
599
|
+
sku?: string;
|
|
600
|
+
name?: string;
|
|
601
|
+
attributes?: Record<string, unknown>;
|
|
602
|
+
price?: number;
|
|
603
|
+
salePrice?: number;
|
|
604
|
+
inventory?: number;
|
|
605
|
+
image?: unknown;
|
|
606
|
+
position?: number;
|
|
607
|
+
status?: VariantStatus;
|
|
608
|
+
}
|
|
609
|
+
interface UpdateVariantDto {
|
|
610
|
+
sku?: string;
|
|
611
|
+
name?: string;
|
|
612
|
+
attributes?: Record<string, unknown>;
|
|
613
|
+
price?: number;
|
|
614
|
+
salePrice?: number;
|
|
615
|
+
image?: string | unknown;
|
|
616
|
+
position?: number;
|
|
617
|
+
status?: VariantStatus;
|
|
618
|
+
}
|
|
619
|
+
interface VariantPlatformOverlay {
|
|
620
|
+
price?: number;
|
|
621
|
+
salePrice?: number;
|
|
622
|
+
sku?: string;
|
|
623
|
+
stock?: number;
|
|
624
|
+
name?: string;
|
|
625
|
+
}
|
|
626
|
+
interface BulkVariantInput {
|
|
627
|
+
id?: string;
|
|
628
|
+
sku: string;
|
|
629
|
+
name?: string;
|
|
630
|
+
attributes: Record<string, string>;
|
|
631
|
+
price?: number | null;
|
|
632
|
+
salePrice?: number | null;
|
|
633
|
+
stock: number;
|
|
634
|
+
image?: unknown | null;
|
|
635
|
+
isEnabled: boolean;
|
|
636
|
+
isDeleted?: boolean;
|
|
637
|
+
overlays?: Record<string, VariantPlatformOverlay>;
|
|
638
|
+
}
|
|
639
|
+
interface ProductAttributeInput {
|
|
640
|
+
attributeId: string;
|
|
641
|
+
selectedOptionIds: string[];
|
|
642
|
+
isForVariations: boolean;
|
|
643
|
+
}
|
|
644
|
+
interface BulkSaveVariantsDto {
|
|
645
|
+
variants: BulkVariantInput[];
|
|
646
|
+
productAttributes?: ProductAttributeInput[];
|
|
647
|
+
}
|
|
648
|
+
interface BulkSaveVariantsResponse {
|
|
649
|
+
created: number;
|
|
650
|
+
updated: number;
|
|
651
|
+
deleted: number;
|
|
652
|
+
variants: ProductVariant[];
|
|
653
|
+
}
|
|
654
|
+
interface UpdateVariantInventoryDto {
|
|
655
|
+
newTotal: number;
|
|
656
|
+
reason?: string;
|
|
657
|
+
}
|
|
658
|
+
interface VariantInventoryResponse {
|
|
659
|
+
total: number;
|
|
660
|
+
reserved: number;
|
|
661
|
+
available: number;
|
|
662
|
+
lastInventorySyncAt?: string | null;
|
|
663
|
+
}
|
|
664
|
+
type RefundType = 'full' | 'partial';
|
|
665
|
+
interface RefundLineItem {
|
|
666
|
+
lineItemId: string;
|
|
667
|
+
quantity: number;
|
|
668
|
+
}
|
|
669
|
+
interface CreateRefundDto {
|
|
670
|
+
type: RefundType;
|
|
671
|
+
items?: RefundLineItem[];
|
|
672
|
+
restockInventory?: boolean;
|
|
673
|
+
notifyCustomer?: boolean;
|
|
674
|
+
reason?: string;
|
|
675
|
+
}
|
|
676
|
+
interface RefundLineItemResponse {
|
|
677
|
+
name: string;
|
|
678
|
+
quantity: number;
|
|
679
|
+
amount: string;
|
|
680
|
+
}
|
|
681
|
+
interface Refund {
|
|
682
|
+
id: string;
|
|
683
|
+
createdAt: string;
|
|
684
|
+
amount: string;
|
|
685
|
+
currency: string;
|
|
686
|
+
reason?: string;
|
|
687
|
+
items?: RefundLineItemResponse[];
|
|
688
|
+
status: string;
|
|
689
|
+
}
|
|
690
|
+
interface UpdateOrderShippingDto {
|
|
691
|
+
firstName?: string;
|
|
692
|
+
lastName?: string;
|
|
693
|
+
name?: string;
|
|
694
|
+
company?: string;
|
|
695
|
+
line1: string;
|
|
696
|
+
line2?: string;
|
|
697
|
+
city: string;
|
|
698
|
+
state?: string;
|
|
699
|
+
country: string;
|
|
700
|
+
postalCode: string;
|
|
701
|
+
phone?: string;
|
|
702
|
+
}
|
|
703
|
+
interface FulfillOrderDto {
|
|
704
|
+
trackingNumber?: string;
|
|
705
|
+
trackingCompany?: string;
|
|
706
|
+
notifyCustomer?: boolean;
|
|
707
|
+
}
|
|
708
|
+
interface CompleteDraftDto {
|
|
709
|
+
paymentPending?: boolean;
|
|
710
|
+
}
|
|
711
|
+
interface SendInvoiceDto {
|
|
712
|
+
to?: string;
|
|
713
|
+
subject?: string;
|
|
714
|
+
customMessage?: string;
|
|
715
|
+
}
|
|
716
|
+
interface AppliedDiscount {
|
|
717
|
+
valueType: 'fixed_amount' | 'percentage';
|
|
718
|
+
value: string;
|
|
719
|
+
description?: string;
|
|
720
|
+
title?: string;
|
|
721
|
+
}
|
|
722
|
+
interface DraftLineItem {
|
|
723
|
+
variantId?: number;
|
|
724
|
+
quantity?: number;
|
|
725
|
+
title?: string;
|
|
726
|
+
price?: string;
|
|
727
|
+
appliedDiscount?: AppliedDiscount;
|
|
728
|
+
}
|
|
729
|
+
interface ShippingLine {
|
|
730
|
+
title: string;
|
|
731
|
+
price: string;
|
|
732
|
+
}
|
|
733
|
+
interface UpdateDraftDto {
|
|
734
|
+
note?: string;
|
|
735
|
+
tags?: string;
|
|
736
|
+
email?: string;
|
|
737
|
+
shippingAddress?: Record<string, unknown>;
|
|
738
|
+
billingAddress?: Record<string, unknown>;
|
|
739
|
+
lineItems?: DraftLineItem[];
|
|
740
|
+
appliedDiscount?: AppliedDiscount;
|
|
741
|
+
shippingLine?: ShippingLine;
|
|
742
|
+
}
|
|
743
|
+
interface EditInventoryDto {
|
|
744
|
+
productId: string;
|
|
745
|
+
newTotal: number;
|
|
746
|
+
reason?: string;
|
|
747
|
+
}
|
|
748
|
+
interface InventorySyncStatus {
|
|
749
|
+
total: number;
|
|
750
|
+
pending: number;
|
|
751
|
+
synced: number;
|
|
752
|
+
neverSynced: number;
|
|
753
|
+
lastSyncAt: string | null;
|
|
754
|
+
}
|
|
755
|
+
interface BulkInventoryResponse {
|
|
756
|
+
productId: string;
|
|
757
|
+
total: number;
|
|
758
|
+
reserved: number;
|
|
759
|
+
available: number;
|
|
760
|
+
}
|
|
761
|
+
interface ReconcileInventoryResponse {
|
|
762
|
+
productId?: string;
|
|
763
|
+
results?: unknown;
|
|
764
|
+
total?: number;
|
|
765
|
+
reconciled?: number;
|
|
766
|
+
discrepancies?: number;
|
|
767
|
+
}
|
|
768
|
+
interface PublishProductResponse {
|
|
769
|
+
productId: string;
|
|
770
|
+
results: Record<string, {
|
|
771
|
+
success: boolean;
|
|
772
|
+
error?: string;
|
|
773
|
+
}>;
|
|
774
|
+
}
|
|
583
775
|
interface OmniSyncApiError {
|
|
584
776
|
statusCode: number;
|
|
585
777
|
message: string;
|
|
@@ -633,6 +825,111 @@ declare class OmniSyncClient {
|
|
|
633
825
|
* Delete a product
|
|
634
826
|
*/
|
|
635
827
|
deleteProduct(productId: string): Promise<void>;
|
|
828
|
+
/**
|
|
829
|
+
* Convert a SIMPLE product to VARIABLE product
|
|
830
|
+
*
|
|
831
|
+
* @example
|
|
832
|
+
* ```typescript
|
|
833
|
+
* const product = await omni.convertToVariable('prod_123');
|
|
834
|
+
* console.log('Product type:', product.type); // 'VARIABLE'
|
|
835
|
+
* ```
|
|
836
|
+
*/
|
|
837
|
+
convertToVariable(productId: string): Promise<Product>;
|
|
838
|
+
/**
|
|
839
|
+
* Convert a VARIABLE product to SIMPLE product
|
|
840
|
+
* Note: This will delete all variants
|
|
841
|
+
*
|
|
842
|
+
* @example
|
|
843
|
+
* ```typescript
|
|
844
|
+
* const product = await omni.convertToSimple('prod_123');
|
|
845
|
+
* console.log('Product type:', product.type); // 'SIMPLE'
|
|
846
|
+
* ```
|
|
847
|
+
*/
|
|
848
|
+
convertToSimple(productId: string): Promise<Product>;
|
|
849
|
+
/**
|
|
850
|
+
* Publish a product to specific platforms
|
|
851
|
+
*
|
|
852
|
+
* @example
|
|
853
|
+
* ```typescript
|
|
854
|
+
* const result = await omni.publishProduct('prod_123', ['SHOPIFY', 'WOOCOMMERCE']);
|
|
855
|
+
* console.log('Publish results:', result.results);
|
|
856
|
+
* ```
|
|
857
|
+
*/
|
|
858
|
+
publishProduct(productId: string, platforms: string[]): Promise<PublishProductResponse>;
|
|
859
|
+
/**
|
|
860
|
+
* Create a new variant for a product
|
|
861
|
+
*
|
|
862
|
+
* @example
|
|
863
|
+
* ```typescript
|
|
864
|
+
* const variant = await omni.createVariant('prod_123', {
|
|
865
|
+
* sku: 'PROD-SM-RED',
|
|
866
|
+
* name: 'Small / Red',
|
|
867
|
+
* attributes: { size: 'S', color: 'Red' },
|
|
868
|
+
* price: 29.99,
|
|
869
|
+
* inventory: 100,
|
|
870
|
+
* });
|
|
871
|
+
* ```
|
|
872
|
+
*/
|
|
873
|
+
createVariant(productId: string, data: CreateVariantDto): Promise<ProductVariant>;
|
|
874
|
+
/**
|
|
875
|
+
* Bulk save variants (create, update, delete in one operation)
|
|
876
|
+
*
|
|
877
|
+
* @example
|
|
878
|
+
* ```typescript
|
|
879
|
+
* const result = await omni.bulkSaveVariants('prod_123', {
|
|
880
|
+
* variants: [
|
|
881
|
+
* { sku: 'SM-RED', attributes: { size: 'S', color: 'Red' }, stock: 10, isEnabled: true },
|
|
882
|
+
* { id: 'var_456', sku: 'MD-BLUE', attributes: { size: 'M', color: 'Blue' }, stock: 5, isEnabled: true },
|
|
883
|
+
* { id: 'var_789', sku: 'LG-GREEN', attributes: {}, stock: 0, isEnabled: false, isDeleted: true },
|
|
884
|
+
* ],
|
|
885
|
+
* });
|
|
886
|
+
* console.log(`Created: ${result.created}, Updated: ${result.updated}, Deleted: ${result.deleted}`);
|
|
887
|
+
* ```
|
|
888
|
+
*/
|
|
889
|
+
bulkSaveVariants(productId: string, data: BulkSaveVariantsDto): Promise<BulkSaveVariantsResponse>;
|
|
890
|
+
/**
|
|
891
|
+
* Update a variant
|
|
892
|
+
*
|
|
893
|
+
* @example
|
|
894
|
+
* ```typescript
|
|
895
|
+
* const variant = await omni.updateVariant('prod_123', 'var_456', {
|
|
896
|
+
* price: 34.99,
|
|
897
|
+
* salePrice: 29.99,
|
|
898
|
+
* });
|
|
899
|
+
* ```
|
|
900
|
+
*/
|
|
901
|
+
updateVariant(productId: string, variantId: string, data: UpdateVariantDto): Promise<ProductVariant>;
|
|
902
|
+
/**
|
|
903
|
+
* Delete a variant
|
|
904
|
+
*
|
|
905
|
+
* @example
|
|
906
|
+
* ```typescript
|
|
907
|
+
* await omni.deleteVariant('prod_123', 'var_456');
|
|
908
|
+
* ```
|
|
909
|
+
*/
|
|
910
|
+
deleteVariant(productId: string, variantId: string): Promise<void>;
|
|
911
|
+
/**
|
|
912
|
+
* Get inventory for a specific variant
|
|
913
|
+
*
|
|
914
|
+
* @example
|
|
915
|
+
* ```typescript
|
|
916
|
+
* const inventory = await omni.getVariantInventory('prod_123', 'var_456');
|
|
917
|
+
* console.log('Available:', inventory.available);
|
|
918
|
+
* ```
|
|
919
|
+
*/
|
|
920
|
+
getVariantInventory(productId: string, variantId: string): Promise<VariantInventoryResponse>;
|
|
921
|
+
/**
|
|
922
|
+
* Update inventory for a specific variant
|
|
923
|
+
*
|
|
924
|
+
* @example
|
|
925
|
+
* ```typescript
|
|
926
|
+
* const inventory = await omni.updateVariantInventory('prod_123', 'var_456', {
|
|
927
|
+
* newTotal: 50,
|
|
928
|
+
* reason: 'Restocked from supplier',
|
|
929
|
+
* });
|
|
930
|
+
* ```
|
|
931
|
+
*/
|
|
932
|
+
updateVariantInventory(productId: string, variantId: string, data: UpdateVariantInventoryDto): Promise<VariantInventoryResponse>;
|
|
636
933
|
/**
|
|
637
934
|
* Get a list of orders with pagination
|
|
638
935
|
*/
|
|
@@ -650,6 +947,181 @@ declare class OmniSyncClient {
|
|
|
650
947
|
* Update an order (e.g., change status)
|
|
651
948
|
*/
|
|
652
949
|
updateOrder(orderId: string, data: UpdateOrderDto): Promise<Order>;
|
|
950
|
+
/**
|
|
951
|
+
* Update order status
|
|
952
|
+
*
|
|
953
|
+
* @example
|
|
954
|
+
* ```typescript
|
|
955
|
+
* const order = await omni.updateOrderStatus('order_123', 'shipped');
|
|
956
|
+
* ```
|
|
957
|
+
*/
|
|
958
|
+
updateOrderStatus(orderId: string, status: string): Promise<Order>;
|
|
959
|
+
/**
|
|
960
|
+
* Update order payment method
|
|
961
|
+
* Note: Only WooCommerce supports syncing payment method changes back to platform
|
|
962
|
+
*
|
|
963
|
+
* @example
|
|
964
|
+
* ```typescript
|
|
965
|
+
* const order = await omni.updatePaymentMethod('order_123', 'credit_card');
|
|
966
|
+
* ```
|
|
967
|
+
*/
|
|
968
|
+
updatePaymentMethod(orderId: string, paymentMethod: string): Promise<Order>;
|
|
969
|
+
/**
|
|
970
|
+
* Update order notes
|
|
971
|
+
*
|
|
972
|
+
* @example
|
|
973
|
+
* ```typescript
|
|
974
|
+
* const order = await omni.updateOrderNotes('order_123', 'Customer requested gift wrapping');
|
|
975
|
+
* ```
|
|
976
|
+
*/
|
|
977
|
+
updateOrderNotes(orderId: string, notes: string): Promise<Order>;
|
|
978
|
+
/**
|
|
979
|
+
* Get refunds for an order
|
|
980
|
+
* Returns refunds from the source platform (Shopify/WooCommerce only)
|
|
981
|
+
*
|
|
982
|
+
* @example
|
|
983
|
+
* ```typescript
|
|
984
|
+
* const refunds = await omni.getOrderRefunds('order_123');
|
|
985
|
+
* console.log('Total refunds:', refunds.length);
|
|
986
|
+
* ```
|
|
987
|
+
*/
|
|
988
|
+
getOrderRefunds(orderId: string): Promise<Refund[]>;
|
|
989
|
+
/**
|
|
990
|
+
* Create a refund for an order
|
|
991
|
+
* Creates refund on the source platform (Shopify/WooCommerce only)
|
|
992
|
+
*
|
|
993
|
+
* @example
|
|
994
|
+
* ```typescript
|
|
995
|
+
* // Full refund
|
|
996
|
+
* const refund = await omni.createRefund('order_123', {
|
|
997
|
+
* type: 'full',
|
|
998
|
+
* restockInventory: true,
|
|
999
|
+
* notifyCustomer: true,
|
|
1000
|
+
* reason: 'Customer request',
|
|
1001
|
+
* });
|
|
1002
|
+
*
|
|
1003
|
+
* // Partial refund
|
|
1004
|
+
* const partialRefund = await omni.createRefund('order_123', {
|
|
1005
|
+
* type: 'partial',
|
|
1006
|
+
* items: [
|
|
1007
|
+
* { lineItemId: 'item_456', quantity: 1 },
|
|
1008
|
+
* ],
|
|
1009
|
+
* restockInventory: true,
|
|
1010
|
+
* });
|
|
1011
|
+
* ```
|
|
1012
|
+
*/
|
|
1013
|
+
createRefund(orderId: string, data: CreateRefundDto): Promise<Refund>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Update order shipping address
|
|
1016
|
+
* Syncs to source platform (Shopify/WooCommerce only)
|
|
1017
|
+
*
|
|
1018
|
+
* @example
|
|
1019
|
+
* ```typescript
|
|
1020
|
+
* const order = await omni.updateOrderShipping('order_123', {
|
|
1021
|
+
* firstName: 'John',
|
|
1022
|
+
* lastName: 'Doe',
|
|
1023
|
+
* line1: '456 New Address',
|
|
1024
|
+
* city: 'Los Angeles',
|
|
1025
|
+
* state: 'CA',
|
|
1026
|
+
* country: 'US',
|
|
1027
|
+
* postalCode: '90001',
|
|
1028
|
+
* });
|
|
1029
|
+
* ```
|
|
1030
|
+
*/
|
|
1031
|
+
updateOrderShipping(orderId: string, data: UpdateOrderShippingDto): Promise<Order>;
|
|
1032
|
+
/**
|
|
1033
|
+
* Cancel an order
|
|
1034
|
+
* Works for Shopify and WooCommerce orders that haven't been fulfilled
|
|
1035
|
+
*
|
|
1036
|
+
* @example
|
|
1037
|
+
* ```typescript
|
|
1038
|
+
* const order = await omni.cancelOrder('order_123');
|
|
1039
|
+
* console.log('Order status:', order.status); // 'cancelled'
|
|
1040
|
+
* ```
|
|
1041
|
+
*/
|
|
1042
|
+
cancelOrder(orderId: string): Promise<Order>;
|
|
1043
|
+
/**
|
|
1044
|
+
* Fulfill an order (mark as shipped)
|
|
1045
|
+
* Works for Shopify and WooCommerce orders
|
|
1046
|
+
*
|
|
1047
|
+
* @example
|
|
1048
|
+
* ```typescript
|
|
1049
|
+
* const order = await omni.fulfillOrder('order_123', {
|
|
1050
|
+
* trackingNumber: '1Z999AA10123456784',
|
|
1051
|
+
* trackingCompany: 'UPS',
|
|
1052
|
+
* notifyCustomer: true,
|
|
1053
|
+
* });
|
|
1054
|
+
* ```
|
|
1055
|
+
*/
|
|
1056
|
+
fulfillOrder(orderId: string, data?: FulfillOrderDto): Promise<Order>;
|
|
1057
|
+
/**
|
|
1058
|
+
* Sync draft orders from connected platforms
|
|
1059
|
+
*
|
|
1060
|
+
* @example
|
|
1061
|
+
* ```typescript
|
|
1062
|
+
* const result = await omni.syncDraftOrders();
|
|
1063
|
+
* console.log('Draft orders synced');
|
|
1064
|
+
* ```
|
|
1065
|
+
*/
|
|
1066
|
+
syncDraftOrders(): Promise<{
|
|
1067
|
+
message: string;
|
|
1068
|
+
}>;
|
|
1069
|
+
/**
|
|
1070
|
+
* Complete a draft order (convert to regular order)
|
|
1071
|
+
*
|
|
1072
|
+
* @example
|
|
1073
|
+
* ```typescript
|
|
1074
|
+
* const order = await omni.completeDraftOrder('draft_123', {
|
|
1075
|
+
* paymentPending: false,
|
|
1076
|
+
* });
|
|
1077
|
+
* ```
|
|
1078
|
+
*/
|
|
1079
|
+
completeDraftOrder(orderId: string, data?: CompleteDraftDto): Promise<Order>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Send invoice for a draft order
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* ```typescript
|
|
1085
|
+
* await omni.sendDraftInvoice('draft_123', {
|
|
1086
|
+
* to: 'customer@example.com',
|
|
1087
|
+
* subject: 'Your Invoice',
|
|
1088
|
+
* customMessage: 'Thank you for your order!',
|
|
1089
|
+
* });
|
|
1090
|
+
* ```
|
|
1091
|
+
*/
|
|
1092
|
+
sendDraftInvoice(orderId: string, data?: SendInvoiceDto): Promise<{
|
|
1093
|
+
message: string;
|
|
1094
|
+
}>;
|
|
1095
|
+
/**
|
|
1096
|
+
* Delete a draft order
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* await omni.deleteDraftOrder('draft_123');
|
|
1101
|
+
* ```
|
|
1102
|
+
*/
|
|
1103
|
+
deleteDraftOrder(orderId: string): Promise<void>;
|
|
1104
|
+
/**
|
|
1105
|
+
* Update a draft order
|
|
1106
|
+
*
|
|
1107
|
+
* @example
|
|
1108
|
+
* ```typescript
|
|
1109
|
+
* const order = await omni.updateDraftOrder('draft_123', {
|
|
1110
|
+
* note: 'Updated customer note',
|
|
1111
|
+
* email: 'newemail@example.com',
|
|
1112
|
+
* shippingAddress: {
|
|
1113
|
+
* firstName: 'John',
|
|
1114
|
+
* lastName: 'Doe',
|
|
1115
|
+
* address1: '123 Main St',
|
|
1116
|
+
* city: 'New York',
|
|
1117
|
+
* province: 'NY',
|
|
1118
|
+
* country: 'US',
|
|
1119
|
+
* zip: '10001',
|
|
1120
|
+
* },
|
|
1121
|
+
* });
|
|
1122
|
+
* ```
|
|
1123
|
+
*/
|
|
1124
|
+
updateDraftOrder(orderId: string, data: UpdateDraftDto): Promise<Order>;
|
|
653
1125
|
/**
|
|
654
1126
|
* Update inventory for a product
|
|
655
1127
|
* This will sync inventory to all connected platforms
|
|
@@ -663,6 +1135,64 @@ declare class OmniSyncClient {
|
|
|
663
1135
|
reserved: number;
|
|
664
1136
|
total: number;
|
|
665
1137
|
}>;
|
|
1138
|
+
/**
|
|
1139
|
+
* Edit inventory manually with reason for audit trail
|
|
1140
|
+
*
|
|
1141
|
+
* @example
|
|
1142
|
+
* ```typescript
|
|
1143
|
+
* const inventory = await omni.editInventory({
|
|
1144
|
+
* productId: 'prod_123',
|
|
1145
|
+
* newTotal: 100,
|
|
1146
|
+
* reason: 'Restocked from warehouse',
|
|
1147
|
+
* });
|
|
1148
|
+
* ```
|
|
1149
|
+
*/
|
|
1150
|
+
editInventory(data: EditInventoryDto): Promise<{
|
|
1151
|
+
total: number;
|
|
1152
|
+
reserved: number;
|
|
1153
|
+
available: number;
|
|
1154
|
+
}>;
|
|
1155
|
+
/**
|
|
1156
|
+
* Get inventory sync status for all products in the store
|
|
1157
|
+
*
|
|
1158
|
+
* @example
|
|
1159
|
+
* ```typescript
|
|
1160
|
+
* const status = await omni.getInventorySyncStatus();
|
|
1161
|
+
* console.log(`${status.pending} products pending sync`);
|
|
1162
|
+
* console.log(`Last sync: ${status.lastSyncAt}`);
|
|
1163
|
+
* ```
|
|
1164
|
+
*/
|
|
1165
|
+
getInventorySyncStatus(): Promise<InventorySyncStatus>;
|
|
1166
|
+
/**
|
|
1167
|
+
* Get inventory for multiple products at once
|
|
1168
|
+
*
|
|
1169
|
+
* @example
|
|
1170
|
+
* ```typescript
|
|
1171
|
+
* const inventories = await omni.getBulkInventory(['prod_123', 'prod_456', 'prod_789']);
|
|
1172
|
+
* inventories.forEach(inv => {
|
|
1173
|
+
* console.log(`${inv.productId}: ${inv.available} available`);
|
|
1174
|
+
* });
|
|
1175
|
+
* ```
|
|
1176
|
+
*/
|
|
1177
|
+
getBulkInventory(productIds: string[]): Promise<BulkInventoryResponse[]>;
|
|
1178
|
+
/**
|
|
1179
|
+
* Reconcile inventory between OmniSync and connected platforms
|
|
1180
|
+
* Detects and optionally fixes discrepancies
|
|
1181
|
+
*
|
|
1182
|
+
* @example
|
|
1183
|
+
* ```typescript
|
|
1184
|
+
* // Reconcile single product (dry run)
|
|
1185
|
+
* const result = await omni.reconcileInventory({ productId: 'prod_123' });
|
|
1186
|
+
*
|
|
1187
|
+
* // Reconcile all products with auto-fix
|
|
1188
|
+
* const summary = await omni.reconcileInventory({ autoFix: true });
|
|
1189
|
+
* console.log(`Reconciled ${summary.reconciled} products`);
|
|
1190
|
+
* ```
|
|
1191
|
+
*/
|
|
1192
|
+
reconcileInventory(options?: {
|
|
1193
|
+
productId?: string;
|
|
1194
|
+
autoFix?: boolean;
|
|
1195
|
+
}): Promise<ReconcileInventoryResponse>;
|
|
666
1196
|
/**
|
|
667
1197
|
* Trigger a sync to a specific platform or all platforms
|
|
668
1198
|
*/
|
|
@@ -1134,4 +1664,4 @@ declare function isWebhookEventType(event: WebhookEvent, type: WebhookEventType)
|
|
|
1134
1664
|
*/
|
|
1135
1665
|
declare function createWebhookHandler(handlers: Partial<Record<WebhookEventType, (event: WebhookEvent) => Promise<void>>>): (payload: unknown) => Promise<void>;
|
|
1136
1666
|
|
|
1137
|
-
export { type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateCouponDto, type CreateOrderDto, type CreateProductDto, type InventoryInfo, type OmniSyncApiError, OmniSyncClient, type OmniSyncClientOptions, OmniSyncError, type Order, type OrderAddress, type OrderCustomer, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PlatformCouponCapabilities, type Product, type ProductImage, type ProductQueryParams, type ProductVariant, type SyncJob, type UpdateCouponDto, type UpdateInventoryDto, type UpdateOrderDto, type UpdateProductDto, type WebhookEvent, type WebhookEventType, createWebhookHandler, isCouponApplicableToProduct, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|
|
1667
|
+
export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartItem, type CartStatus, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomerDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type InventoryInfo, type InventorySyncStatus, type MergeCartsDto, type OmniSyncApiError, OmniSyncClient, type OmniSyncClientOptions, OmniSyncError, type Order, type OrderAddress, type OrderCustomer, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PlatformCouponCapabilities, type Product, type ProductAttributeInput, type ProductImage, type ProductQueryParams, type ProductVariant, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type SelectShippingMethodDto, type SendInvoiceDto, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingLine, type ShippingRate, type SyncJob, type UpdateAddressDto, type UpdateCartItemDto, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateInventoryDto, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateVariantDto, type UpdateVariantInventoryDto, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WebhookEvent, type WebhookEventType, createWebhookHandler, isCouponApplicableToProduct, isWebhookEventType, parseWebhookEvent, verifyWebhook };
|