omni-sync-sdk 0.6.0 → 0.6.1

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/README.md CHANGED
@@ -65,6 +65,7 @@ console.log('Order created:', order.orderId);
65
65
  ### Option 1: Local Cart (Guest Users) - RECOMMENDED
66
66
 
67
67
  For guest users, the cart is stored in **localStorage** - exactly like Amazon, Shopify, and other major platforms do. This means:
68
+
68
69
  - ✅ No API calls when browsing/adding to cart
69
70
  - ✅ Cart persists across page refreshes
70
71
  - ✅ Single API call at checkout
@@ -91,6 +92,7 @@ const order = await omni.submitGuestOrder();
91
92
  ### Option 2: Server Cart (Registered Users)
92
93
 
93
94
  For logged-in customers, use server-side cart:
95
+
94
96
  - ✅ Cart syncs across devices
95
97
  - ✅ Abandoned cart recovery
96
98
  - ✅ Customer history tracking
@@ -259,11 +261,11 @@ The local cart stores everything in **localStorage** until checkout. This is the
259
261
  // Add item with product info (for display)
260
262
  omni.addToLocalCart({
261
263
  productId: 'prod_123',
262
- variantId: 'var_456', // Optional: for products with variants
264
+ variantId: 'var_456', // Optional: for products with variants
263
265
  quantity: 2,
264
- name: 'Cool T-Shirt', // Optional: for cart display
265
- price: '29.99', // Optional: for cart display
266
- image: 'https://...', // Optional: for cart display
266
+ name: 'Cool T-Shirt', // Optional: for cart display
267
+ price: '29.99', // Optional: for cart display
268
+ image: 'https://...', // Optional: for cart display
267
269
  });
268
270
  ```
269
271
 
@@ -272,10 +274,10 @@ omni.addToLocalCart({
272
274
  ```typescript
273
275
  const cart = omni.getLocalCart();
274
276
 
275
- console.log(cart.items); // Array of cart items
276
- console.log(cart.customer); // Customer info (if set)
277
+ console.log(cart.items); // Array of cart items
278
+ console.log(cart.customer); // Customer info (if set)
277
279
  console.log(cart.shippingAddress); // Shipping address (if set)
278
- console.log(cart.couponCode); // Applied coupon (if any)
280
+ console.log(cart.couponCode); // Applied coupon (if any)
279
281
  ```
280
282
 
281
283
  #### Update Item Quantity
@@ -308,10 +310,10 @@ omni.clearLocalCart();
308
310
 
309
311
  ```typescript
310
312
  omni.setLocalCartCustomer({
311
- email: 'customer@example.com', // Required
312
- firstName: 'John', // Optional
313
- lastName: 'Doe', // Optional
314
- phone: '+1234567890', // Optional
313
+ email: 'customer@example.com', // Required
314
+ firstName: 'John', // Optional
315
+ lastName: 'Doe', // Optional
316
+ phone: '+1234567890', // Optional
315
317
  });
316
318
  ```
317
319
 
@@ -322,9 +324,9 @@ omni.setLocalCartShippingAddress({
322
324
  firstName: 'John',
323
325
  lastName: 'Doe',
324
326
  line1: '123 Main St',
325
- line2: 'Apt 4B', // Optional
327
+ line2: 'Apt 4B', // Optional
326
328
  city: 'New York',
327
- region: 'NY', // Optional: State/Province
329
+ region: 'NY', // Optional: State/Province
328
330
  postalCode: '10001',
329
331
  country: 'US',
330
332
  phone: '+1234567890', // Optional
@@ -383,7 +385,9 @@ interface LocalCart {
383
385
  country: string;
384
386
  phone?: string;
385
387
  };
386
- billingAddress?: { /* same as shipping */ };
388
+ billingAddress?: {
389
+ /* same as shipping */
390
+ };
387
391
  notes?: string;
388
392
  updatedAt: string;
389
393
  }
@@ -410,11 +414,11 @@ Submit the local cart as an order with a **single API call**:
410
414
  // Make sure cart has items, customer email, and shipping address
411
415
  const order = await omni.submitGuestOrder();
412
416
 
413
- console.log(order.orderId); // 'order_abc123...'
417
+ console.log(order.orderId); // 'order_abc123...'
414
418
  console.log(order.orderNumber); // 'ORD-12345'
415
- console.log(order.status); // 'pending'
416
- console.log(order.total); // 59.98
417
- console.log(order.message); // 'Order created successfully'
419
+ console.log(order.status); // 'pending'
420
+ console.log(order.total); // 59.98
421
+ console.log(order.message); // 'Order created successfully'
418
422
 
419
423
  // Cart is automatically cleared after successful order
420
424
  ```
package/dist/index.d.mts CHANGED
@@ -69,6 +69,7 @@ interface Product {
69
69
  id: string;
70
70
  name: string;
71
71
  description?: string | null;
72
+ descriptionFormat?: 'text' | 'html' | 'markdown';
72
73
  sku: string;
73
74
  basePrice: number;
74
75
  salePrice?: number | null;
@@ -925,6 +926,63 @@ interface PublishProductResponse {
925
926
  error?: string;
926
927
  }>;
927
928
  }
929
+ type CustomApiAuthType = 'api_key' | 'bearer' | 'basic' | 'oauth2';
930
+ type CustomApiSyncDirection = 'inbound' | 'outbound' | 'bidirectional';
931
+ type CustomApiConnectionStatus = 'CONNECTED' | 'DISCONNECTED' | 'PAUSED' | 'ERROR';
932
+ interface CustomApiCredentials {
933
+ apiKey?: string;
934
+ bearerToken?: string;
935
+ username?: string;
936
+ password?: string;
937
+ headerName?: string;
938
+ }
939
+ interface CustomApiSyncConfig {
940
+ products?: boolean;
941
+ orders?: boolean;
942
+ inventory?: boolean;
943
+ }
944
+ interface CustomApiIntegration {
945
+ id: string;
946
+ storeId: string;
947
+ name: string;
948
+ description?: string | null;
949
+ baseUrl: string;
950
+ authType: CustomApiAuthType;
951
+ credentials?: CustomApiCredentials;
952
+ status: CustomApiConnectionStatus;
953
+ enabled: boolean;
954
+ syncDirection: CustomApiSyncDirection;
955
+ syncConfig?: CustomApiSyncConfig | null;
956
+ lastSyncAt?: string | null;
957
+ lastError?: string | null;
958
+ lastErrorAt?: string | null;
959
+ createdAt: string;
960
+ updatedAt: string;
961
+ }
962
+ interface CreateCustomApiDto {
963
+ name: string;
964
+ description?: string;
965
+ baseUrl: string;
966
+ authType: CustomApiAuthType;
967
+ credentials?: CustomApiCredentials;
968
+ syncDirection?: CustomApiSyncDirection;
969
+ syncConfig?: CustomApiSyncConfig;
970
+ }
971
+ interface UpdateCustomApiDto {
972
+ name?: string;
973
+ description?: string;
974
+ baseUrl?: string;
975
+ authType?: CustomApiAuthType;
976
+ credentials?: CustomApiCredentials;
977
+ enabled?: boolean;
978
+ syncDirection?: CustomApiSyncDirection;
979
+ syncConfig?: CustomApiSyncConfig;
980
+ }
981
+ interface CustomApiTestResult {
982
+ success: boolean;
983
+ latency?: number;
984
+ error?: string;
985
+ }
928
986
  interface OmniSyncApiError {
929
987
  statusCode: number;
930
988
  message: string;
@@ -2001,6 +2059,92 @@ declare class OmniSyncClient {
2001
2059
  * Only available in storefront mode
2002
2060
  */
2003
2061
  getMyCart(): Promise<Cart>;
2062
+ /**
2063
+ * Get all Custom API integrations for a store
2064
+ * Requires Admin mode (apiKey)
2065
+ *
2066
+ * @example
2067
+ * ```typescript
2068
+ * const integrations = await omni.getCustomApiIntegrations();
2069
+ * integrations.forEach(api => {
2070
+ * console.log(`${api.name}: ${api.status}`);
2071
+ * });
2072
+ * ```
2073
+ */
2074
+ getCustomApiIntegrations(): Promise<CustomApiIntegration[]>;
2075
+ /**
2076
+ * Get a single Custom API integration by ID
2077
+ * Requires Admin mode (apiKey)
2078
+ *
2079
+ * @example
2080
+ * ```typescript
2081
+ * const api = await omni.getCustomApiIntegration('api_123');
2082
+ * console.log(`API: ${api.name}, URL: ${api.baseUrl}`);
2083
+ * ```
2084
+ */
2085
+ getCustomApiIntegration(integrationId: string): Promise<CustomApiIntegration>;
2086
+ /**
2087
+ * Create a new Custom API integration
2088
+ * Requires Admin mode (apiKey)
2089
+ *
2090
+ * @example
2091
+ * ```typescript
2092
+ * const api = await omni.createCustomApiIntegration({
2093
+ * name: 'My External API',
2094
+ * baseUrl: 'https://api.example.com',
2095
+ * authType: 'api_key',
2096
+ * credentials: {
2097
+ * apiKey: 'sk_123...',
2098
+ * headerName: 'X-API-Key',
2099
+ * },
2100
+ * syncDirection: 'bidirectional',
2101
+ * syncConfig: {
2102
+ * products: true,
2103
+ * orders: true,
2104
+ * inventory: true,
2105
+ * },
2106
+ * });
2107
+ * ```
2108
+ */
2109
+ createCustomApiIntegration(data: CreateCustomApiDto): Promise<CustomApiIntegration>;
2110
+ /**
2111
+ * Update a Custom API integration
2112
+ * Requires Admin mode (apiKey)
2113
+ *
2114
+ * @example
2115
+ * ```typescript
2116
+ * const api = await omni.updateCustomApiIntegration('api_123', {
2117
+ * enabled: false,
2118
+ * syncConfig: { products: true, orders: false, inventory: true },
2119
+ * });
2120
+ * ```
2121
+ */
2122
+ updateCustomApiIntegration(integrationId: string, data: UpdateCustomApiDto): Promise<CustomApiIntegration>;
2123
+ /**
2124
+ * Delete a Custom API integration
2125
+ * Requires Admin mode (apiKey)
2126
+ *
2127
+ * @example
2128
+ * ```typescript
2129
+ * await omni.deleteCustomApiIntegration('api_123');
2130
+ * ```
2131
+ */
2132
+ deleteCustomApiIntegration(integrationId: string): Promise<void>;
2133
+ /**
2134
+ * Test connection to a Custom API
2135
+ * Requires Admin mode (apiKey)
2136
+ *
2137
+ * @example
2138
+ * ```typescript
2139
+ * const result = await omni.testCustomApiConnection('api_123');
2140
+ * if (result.success) {
2141
+ * console.log(`Connection OK, latency: ${result.latency}ms`);
2142
+ * } else {
2143
+ * console.error(`Connection failed: ${result.error}`);
2144
+ * }
2145
+ * ```
2146
+ */
2147
+ testCustomApiConnection(integrationId: string): Promise<CustomApiTestResult>;
2004
2148
  }
2005
2149
  /**
2006
2150
  * Custom error class for Omni-Sync API errors
@@ -2068,4 +2212,4 @@ declare function isWebhookEventType(event: WebhookEvent, type: WebhookEventType)
2068
2212
  */
2069
2213
  declare function createWebhookHandler(handlers: Partial<Record<WebhookEventType, (event: WebhookEvent) => Promise<void>>>): (payload: unknown) => Promise<void>;
2070
2214
 
2071
- 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 CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, 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 StoreInfo, 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 };
2215
+ 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 CreateCustomApiDto, type CreateCustomerDto, type CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, 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 StoreInfo, type SyncJob, type UpdateAddressDto, type UpdateCartItemDto, type UpdateCouponDto, type UpdateCustomApiDto, 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 };
package/dist/index.d.ts CHANGED
@@ -69,6 +69,7 @@ interface Product {
69
69
  id: string;
70
70
  name: string;
71
71
  description?: string | null;
72
+ descriptionFormat?: 'text' | 'html' | 'markdown';
72
73
  sku: string;
73
74
  basePrice: number;
74
75
  salePrice?: number | null;
@@ -925,6 +926,63 @@ interface PublishProductResponse {
925
926
  error?: string;
926
927
  }>;
927
928
  }
929
+ type CustomApiAuthType = 'api_key' | 'bearer' | 'basic' | 'oauth2';
930
+ type CustomApiSyncDirection = 'inbound' | 'outbound' | 'bidirectional';
931
+ type CustomApiConnectionStatus = 'CONNECTED' | 'DISCONNECTED' | 'PAUSED' | 'ERROR';
932
+ interface CustomApiCredentials {
933
+ apiKey?: string;
934
+ bearerToken?: string;
935
+ username?: string;
936
+ password?: string;
937
+ headerName?: string;
938
+ }
939
+ interface CustomApiSyncConfig {
940
+ products?: boolean;
941
+ orders?: boolean;
942
+ inventory?: boolean;
943
+ }
944
+ interface CustomApiIntegration {
945
+ id: string;
946
+ storeId: string;
947
+ name: string;
948
+ description?: string | null;
949
+ baseUrl: string;
950
+ authType: CustomApiAuthType;
951
+ credentials?: CustomApiCredentials;
952
+ status: CustomApiConnectionStatus;
953
+ enabled: boolean;
954
+ syncDirection: CustomApiSyncDirection;
955
+ syncConfig?: CustomApiSyncConfig | null;
956
+ lastSyncAt?: string | null;
957
+ lastError?: string | null;
958
+ lastErrorAt?: string | null;
959
+ createdAt: string;
960
+ updatedAt: string;
961
+ }
962
+ interface CreateCustomApiDto {
963
+ name: string;
964
+ description?: string;
965
+ baseUrl: string;
966
+ authType: CustomApiAuthType;
967
+ credentials?: CustomApiCredentials;
968
+ syncDirection?: CustomApiSyncDirection;
969
+ syncConfig?: CustomApiSyncConfig;
970
+ }
971
+ interface UpdateCustomApiDto {
972
+ name?: string;
973
+ description?: string;
974
+ baseUrl?: string;
975
+ authType?: CustomApiAuthType;
976
+ credentials?: CustomApiCredentials;
977
+ enabled?: boolean;
978
+ syncDirection?: CustomApiSyncDirection;
979
+ syncConfig?: CustomApiSyncConfig;
980
+ }
981
+ interface CustomApiTestResult {
982
+ success: boolean;
983
+ latency?: number;
984
+ error?: string;
985
+ }
928
986
  interface OmniSyncApiError {
929
987
  statusCode: number;
930
988
  message: string;
@@ -2001,6 +2059,92 @@ declare class OmniSyncClient {
2001
2059
  * Only available in storefront mode
2002
2060
  */
2003
2061
  getMyCart(): Promise<Cart>;
2062
+ /**
2063
+ * Get all Custom API integrations for a store
2064
+ * Requires Admin mode (apiKey)
2065
+ *
2066
+ * @example
2067
+ * ```typescript
2068
+ * const integrations = await omni.getCustomApiIntegrations();
2069
+ * integrations.forEach(api => {
2070
+ * console.log(`${api.name}: ${api.status}`);
2071
+ * });
2072
+ * ```
2073
+ */
2074
+ getCustomApiIntegrations(): Promise<CustomApiIntegration[]>;
2075
+ /**
2076
+ * Get a single Custom API integration by ID
2077
+ * Requires Admin mode (apiKey)
2078
+ *
2079
+ * @example
2080
+ * ```typescript
2081
+ * const api = await omni.getCustomApiIntegration('api_123');
2082
+ * console.log(`API: ${api.name}, URL: ${api.baseUrl}`);
2083
+ * ```
2084
+ */
2085
+ getCustomApiIntegration(integrationId: string): Promise<CustomApiIntegration>;
2086
+ /**
2087
+ * Create a new Custom API integration
2088
+ * Requires Admin mode (apiKey)
2089
+ *
2090
+ * @example
2091
+ * ```typescript
2092
+ * const api = await omni.createCustomApiIntegration({
2093
+ * name: 'My External API',
2094
+ * baseUrl: 'https://api.example.com',
2095
+ * authType: 'api_key',
2096
+ * credentials: {
2097
+ * apiKey: 'sk_123...',
2098
+ * headerName: 'X-API-Key',
2099
+ * },
2100
+ * syncDirection: 'bidirectional',
2101
+ * syncConfig: {
2102
+ * products: true,
2103
+ * orders: true,
2104
+ * inventory: true,
2105
+ * },
2106
+ * });
2107
+ * ```
2108
+ */
2109
+ createCustomApiIntegration(data: CreateCustomApiDto): Promise<CustomApiIntegration>;
2110
+ /**
2111
+ * Update a Custom API integration
2112
+ * Requires Admin mode (apiKey)
2113
+ *
2114
+ * @example
2115
+ * ```typescript
2116
+ * const api = await omni.updateCustomApiIntegration('api_123', {
2117
+ * enabled: false,
2118
+ * syncConfig: { products: true, orders: false, inventory: true },
2119
+ * });
2120
+ * ```
2121
+ */
2122
+ updateCustomApiIntegration(integrationId: string, data: UpdateCustomApiDto): Promise<CustomApiIntegration>;
2123
+ /**
2124
+ * Delete a Custom API integration
2125
+ * Requires Admin mode (apiKey)
2126
+ *
2127
+ * @example
2128
+ * ```typescript
2129
+ * await omni.deleteCustomApiIntegration('api_123');
2130
+ * ```
2131
+ */
2132
+ deleteCustomApiIntegration(integrationId: string): Promise<void>;
2133
+ /**
2134
+ * Test connection to a Custom API
2135
+ * Requires Admin mode (apiKey)
2136
+ *
2137
+ * @example
2138
+ * ```typescript
2139
+ * const result = await omni.testCustomApiConnection('api_123');
2140
+ * if (result.success) {
2141
+ * console.log(`Connection OK, latency: ${result.latency}ms`);
2142
+ * } else {
2143
+ * console.error(`Connection failed: ${result.error}`);
2144
+ * }
2145
+ * ```
2146
+ */
2147
+ testCustomApiConnection(integrationId: string): Promise<CustomApiTestResult>;
2004
2148
  }
2005
2149
  /**
2006
2150
  * Custom error class for Omni-Sync API errors
@@ -2068,4 +2212,4 @@ declare function isWebhookEventType(event: WebhookEvent, type: WebhookEventType)
2068
2212
  */
2069
2213
  declare function createWebhookHandler(handlers: Partial<Record<WebhookEventType, (event: WebhookEvent) => Promise<void>>>): (payload: unknown) => Promise<void>;
2070
2214
 
2071
- 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 CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, 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 StoreInfo, 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 };
2215
+ 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 CreateCustomApiDto, type CreateCustomerDto, type CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, 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 StoreInfo, type SyncJob, type UpdateAddressDto, type UpdateCartItemDto, type UpdateCouponDto, type UpdateCustomApiDto, 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 };
package/dist/index.js CHANGED
@@ -1893,6 +1893,113 @@ var OmniSyncClient = class {
1893
1893
  }
1894
1894
  return this.storefrontRequest("GET", "/customers/me/cart");
1895
1895
  }
1896
+ // -------------------- Custom API Integrations --------------------
1897
+ // These methods require Admin mode (apiKey)
1898
+ /**
1899
+ * Get all Custom API integrations for a store
1900
+ * Requires Admin mode (apiKey)
1901
+ *
1902
+ * @example
1903
+ * ```typescript
1904
+ * const integrations = await omni.getCustomApiIntegrations();
1905
+ * integrations.forEach(api => {
1906
+ * console.log(`${api.name}: ${api.status}`);
1907
+ * });
1908
+ * ```
1909
+ */
1910
+ async getCustomApiIntegrations() {
1911
+ return this.adminRequest("GET", "/api/v1/custom-api");
1912
+ }
1913
+ /**
1914
+ * Get a single Custom API integration by ID
1915
+ * Requires Admin mode (apiKey)
1916
+ *
1917
+ * @example
1918
+ * ```typescript
1919
+ * const api = await omni.getCustomApiIntegration('api_123');
1920
+ * console.log(`API: ${api.name}, URL: ${api.baseUrl}`);
1921
+ * ```
1922
+ */
1923
+ async getCustomApiIntegration(integrationId) {
1924
+ return this.adminRequest("GET", `/api/v1/custom-api/${integrationId}`);
1925
+ }
1926
+ /**
1927
+ * Create a new Custom API integration
1928
+ * Requires Admin mode (apiKey)
1929
+ *
1930
+ * @example
1931
+ * ```typescript
1932
+ * const api = await omni.createCustomApiIntegration({
1933
+ * name: 'My External API',
1934
+ * baseUrl: 'https://api.example.com',
1935
+ * authType: 'api_key',
1936
+ * credentials: {
1937
+ * apiKey: 'sk_123...',
1938
+ * headerName: 'X-API-Key',
1939
+ * },
1940
+ * syncDirection: 'bidirectional',
1941
+ * syncConfig: {
1942
+ * products: true,
1943
+ * orders: true,
1944
+ * inventory: true,
1945
+ * },
1946
+ * });
1947
+ * ```
1948
+ */
1949
+ async createCustomApiIntegration(data) {
1950
+ return this.adminRequest("POST", "/api/v1/custom-api", data);
1951
+ }
1952
+ /**
1953
+ * Update a Custom API integration
1954
+ * Requires Admin mode (apiKey)
1955
+ *
1956
+ * @example
1957
+ * ```typescript
1958
+ * const api = await omni.updateCustomApiIntegration('api_123', {
1959
+ * enabled: false,
1960
+ * syncConfig: { products: true, orders: false, inventory: true },
1961
+ * });
1962
+ * ```
1963
+ */
1964
+ async updateCustomApiIntegration(integrationId, data) {
1965
+ return this.adminRequest(
1966
+ "PATCH",
1967
+ `/api/v1/custom-api/${integrationId}`,
1968
+ data
1969
+ );
1970
+ }
1971
+ /**
1972
+ * Delete a Custom API integration
1973
+ * Requires Admin mode (apiKey)
1974
+ *
1975
+ * @example
1976
+ * ```typescript
1977
+ * await omni.deleteCustomApiIntegration('api_123');
1978
+ * ```
1979
+ */
1980
+ async deleteCustomApiIntegration(integrationId) {
1981
+ await this.adminRequest("DELETE", `/api/v1/custom-api/${integrationId}`);
1982
+ }
1983
+ /**
1984
+ * Test connection to a Custom API
1985
+ * Requires Admin mode (apiKey)
1986
+ *
1987
+ * @example
1988
+ * ```typescript
1989
+ * const result = await omni.testCustomApiConnection('api_123');
1990
+ * if (result.success) {
1991
+ * console.log(`Connection OK, latency: ${result.latency}ms`);
1992
+ * } else {
1993
+ * console.error(`Connection failed: ${result.error}`);
1994
+ * }
1995
+ * ```
1996
+ */
1997
+ async testCustomApiConnection(integrationId) {
1998
+ return this.adminRequest(
1999
+ "POST",
2000
+ `/api/v1/custom-api/${integrationId}/test`
2001
+ );
2002
+ }
1896
2003
  };
1897
2004
  var OmniSyncError = class extends Error {
1898
2005
  constructor(message, statusCode, details) {
package/dist/index.mjs CHANGED
@@ -1868,6 +1868,113 @@ var OmniSyncClient = class {
1868
1868
  }
1869
1869
  return this.storefrontRequest("GET", "/customers/me/cart");
1870
1870
  }
1871
+ // -------------------- Custom API Integrations --------------------
1872
+ // These methods require Admin mode (apiKey)
1873
+ /**
1874
+ * Get all Custom API integrations for a store
1875
+ * Requires Admin mode (apiKey)
1876
+ *
1877
+ * @example
1878
+ * ```typescript
1879
+ * const integrations = await omni.getCustomApiIntegrations();
1880
+ * integrations.forEach(api => {
1881
+ * console.log(`${api.name}: ${api.status}`);
1882
+ * });
1883
+ * ```
1884
+ */
1885
+ async getCustomApiIntegrations() {
1886
+ return this.adminRequest("GET", "/api/v1/custom-api");
1887
+ }
1888
+ /**
1889
+ * Get a single Custom API integration by ID
1890
+ * Requires Admin mode (apiKey)
1891
+ *
1892
+ * @example
1893
+ * ```typescript
1894
+ * const api = await omni.getCustomApiIntegration('api_123');
1895
+ * console.log(`API: ${api.name}, URL: ${api.baseUrl}`);
1896
+ * ```
1897
+ */
1898
+ async getCustomApiIntegration(integrationId) {
1899
+ return this.adminRequest("GET", `/api/v1/custom-api/${integrationId}`);
1900
+ }
1901
+ /**
1902
+ * Create a new Custom API integration
1903
+ * Requires Admin mode (apiKey)
1904
+ *
1905
+ * @example
1906
+ * ```typescript
1907
+ * const api = await omni.createCustomApiIntegration({
1908
+ * name: 'My External API',
1909
+ * baseUrl: 'https://api.example.com',
1910
+ * authType: 'api_key',
1911
+ * credentials: {
1912
+ * apiKey: 'sk_123...',
1913
+ * headerName: 'X-API-Key',
1914
+ * },
1915
+ * syncDirection: 'bidirectional',
1916
+ * syncConfig: {
1917
+ * products: true,
1918
+ * orders: true,
1919
+ * inventory: true,
1920
+ * },
1921
+ * });
1922
+ * ```
1923
+ */
1924
+ async createCustomApiIntegration(data) {
1925
+ return this.adminRequest("POST", "/api/v1/custom-api", data);
1926
+ }
1927
+ /**
1928
+ * Update a Custom API integration
1929
+ * Requires Admin mode (apiKey)
1930
+ *
1931
+ * @example
1932
+ * ```typescript
1933
+ * const api = await omni.updateCustomApiIntegration('api_123', {
1934
+ * enabled: false,
1935
+ * syncConfig: { products: true, orders: false, inventory: true },
1936
+ * });
1937
+ * ```
1938
+ */
1939
+ async updateCustomApiIntegration(integrationId, data) {
1940
+ return this.adminRequest(
1941
+ "PATCH",
1942
+ `/api/v1/custom-api/${integrationId}`,
1943
+ data
1944
+ );
1945
+ }
1946
+ /**
1947
+ * Delete a Custom API integration
1948
+ * Requires Admin mode (apiKey)
1949
+ *
1950
+ * @example
1951
+ * ```typescript
1952
+ * await omni.deleteCustomApiIntegration('api_123');
1953
+ * ```
1954
+ */
1955
+ async deleteCustomApiIntegration(integrationId) {
1956
+ await this.adminRequest("DELETE", `/api/v1/custom-api/${integrationId}`);
1957
+ }
1958
+ /**
1959
+ * Test connection to a Custom API
1960
+ * Requires Admin mode (apiKey)
1961
+ *
1962
+ * @example
1963
+ * ```typescript
1964
+ * const result = await omni.testCustomApiConnection('api_123');
1965
+ * if (result.success) {
1966
+ * console.log(`Connection OK, latency: ${result.latency}ms`);
1967
+ * } else {
1968
+ * console.error(`Connection failed: ${result.error}`);
1969
+ * }
1970
+ * ```
1971
+ */
1972
+ async testCustomApiConnection(integrationId) {
1973
+ return this.adminRequest(
1974
+ "POST",
1975
+ `/api/v1/custom-api/${integrationId}/test`
1976
+ );
1977
+ }
1871
1978
  };
1872
1979
  var OmniSyncError = class extends Error {
1873
1980
  constructor(message, statusCode, details) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-sync-sdk",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Official SDK for building e-commerce storefronts with OmniSync Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",