omni-sync-sdk 0.6.0 → 0.6.2
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 +55 -19
- package/dist/index.d.mts +145 -1
- package/dist/index.d.ts +145 -1
- package/dist/index.js +107 -0
- package/dist/index.mjs +107 -0
- package/package.json +1 -1
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
|
|
@@ -210,6 +212,7 @@ interface Product {
|
|
|
210
212
|
id: string;
|
|
211
213
|
name: string;
|
|
212
214
|
description?: string | null;
|
|
215
|
+
descriptionFormat?: 'text' | 'html' | 'markdown'; // Format of description content
|
|
213
216
|
sku: string;
|
|
214
217
|
basePrice: number;
|
|
215
218
|
salePrice?: number | null;
|
|
@@ -247,6 +250,30 @@ interface InventoryInfo {
|
|
|
247
250
|
}
|
|
248
251
|
```
|
|
249
252
|
|
|
253
|
+
#### Rendering Product Descriptions
|
|
254
|
+
|
|
255
|
+
**IMPORTANT**: Product descriptions may contain HTML (from Shopify/WooCommerce) or plain text. Always check `descriptionFormat` before rendering:
|
|
256
|
+
|
|
257
|
+
```tsx
|
|
258
|
+
// Correct way to render product descriptions
|
|
259
|
+
{product.description && (
|
|
260
|
+
product.descriptionFormat === 'html' ? (
|
|
261
|
+
// HTML content from Shopify/WooCommerce - render as HTML
|
|
262
|
+
<div dangerouslySetInnerHTML={{ __html: product.description }} />
|
|
263
|
+
) : (
|
|
264
|
+
// Plain text - render normally
|
|
265
|
+
<p>{product.description}</p>
|
|
266
|
+
)
|
|
267
|
+
)}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
| Source Platform | descriptionFormat | Rendering |
|
|
271
|
+
|-----------------|-------------------|-----------|
|
|
272
|
+
| Shopify | `'html'` | Use `dangerouslySetInnerHTML` |
|
|
273
|
+
| WooCommerce | `'html'` | Use `dangerouslySetInnerHTML` |
|
|
274
|
+
| TikTok | `'text'` | Render as plain text |
|
|
275
|
+
| Manual entry | `'text'` | Render as plain text |
|
|
276
|
+
|
|
250
277
|
---
|
|
251
278
|
|
|
252
279
|
### Local Cart (Guest Users) - RECOMMENDED
|
|
@@ -259,11 +286,11 @@ The local cart stores everything in **localStorage** until checkout. This is the
|
|
|
259
286
|
// Add item with product info (for display)
|
|
260
287
|
omni.addToLocalCart({
|
|
261
288
|
productId: 'prod_123',
|
|
262
|
-
variantId: 'var_456',
|
|
289
|
+
variantId: 'var_456', // Optional: for products with variants
|
|
263
290
|
quantity: 2,
|
|
264
|
-
name: 'Cool T-Shirt',
|
|
265
|
-
price: '29.99',
|
|
266
|
-
image: 'https://...',
|
|
291
|
+
name: 'Cool T-Shirt', // Optional: for cart display
|
|
292
|
+
price: '29.99', // Optional: for cart display
|
|
293
|
+
image: 'https://...', // Optional: for cart display
|
|
267
294
|
});
|
|
268
295
|
```
|
|
269
296
|
|
|
@@ -272,10 +299,10 @@ omni.addToLocalCart({
|
|
|
272
299
|
```typescript
|
|
273
300
|
const cart = omni.getLocalCart();
|
|
274
301
|
|
|
275
|
-
console.log(cart.items);
|
|
276
|
-
console.log(cart.customer);
|
|
302
|
+
console.log(cart.items); // Array of cart items
|
|
303
|
+
console.log(cart.customer); // Customer info (if set)
|
|
277
304
|
console.log(cart.shippingAddress); // Shipping address (if set)
|
|
278
|
-
console.log(cart.couponCode);
|
|
305
|
+
console.log(cart.couponCode); // Applied coupon (if any)
|
|
279
306
|
```
|
|
280
307
|
|
|
281
308
|
#### Update Item Quantity
|
|
@@ -308,10 +335,10 @@ omni.clearLocalCart();
|
|
|
308
335
|
|
|
309
336
|
```typescript
|
|
310
337
|
omni.setLocalCartCustomer({
|
|
311
|
-
email: 'customer@example.com',
|
|
312
|
-
firstName: 'John',
|
|
313
|
-
lastName: 'Doe',
|
|
314
|
-
phone: '+1234567890',
|
|
338
|
+
email: 'customer@example.com', // Required
|
|
339
|
+
firstName: 'John', // Optional
|
|
340
|
+
lastName: 'Doe', // Optional
|
|
341
|
+
phone: '+1234567890', // Optional
|
|
315
342
|
});
|
|
316
343
|
```
|
|
317
344
|
|
|
@@ -322,9 +349,9 @@ omni.setLocalCartShippingAddress({
|
|
|
322
349
|
firstName: 'John',
|
|
323
350
|
lastName: 'Doe',
|
|
324
351
|
line1: '123 Main St',
|
|
325
|
-
line2: 'Apt 4B',
|
|
352
|
+
line2: 'Apt 4B', // Optional
|
|
326
353
|
city: 'New York',
|
|
327
|
-
region: 'NY',
|
|
354
|
+
region: 'NY', // Optional: State/Province
|
|
328
355
|
postalCode: '10001',
|
|
329
356
|
country: 'US',
|
|
330
357
|
phone: '+1234567890', // Optional
|
|
@@ -383,7 +410,9 @@ interface LocalCart {
|
|
|
383
410
|
country: string;
|
|
384
411
|
phone?: string;
|
|
385
412
|
};
|
|
386
|
-
billingAddress?: {
|
|
413
|
+
billingAddress?: {
|
|
414
|
+
/* same as shipping */
|
|
415
|
+
};
|
|
387
416
|
notes?: string;
|
|
388
417
|
updatedAt: string;
|
|
389
418
|
}
|
|
@@ -410,11 +439,11 @@ Submit the local cart as an order with a **single API call**:
|
|
|
410
439
|
// Make sure cart has items, customer email, and shipping address
|
|
411
440
|
const order = await omni.submitGuestOrder();
|
|
412
441
|
|
|
413
|
-
console.log(order.orderId);
|
|
442
|
+
console.log(order.orderId); // 'order_abc123...'
|
|
414
443
|
console.log(order.orderNumber); // 'ORD-12345'
|
|
415
|
-
console.log(order.status);
|
|
416
|
-
console.log(order.total);
|
|
417
|
-
console.log(order.message);
|
|
444
|
+
console.log(order.status); // 'pending'
|
|
445
|
+
console.log(order.total); // 59.98
|
|
446
|
+
console.log(order.message); // 'Order created successfully'
|
|
418
447
|
|
|
419
448
|
// Cart is automatically cleared after successful order
|
|
420
449
|
```
|
|
@@ -976,8 +1005,13 @@ export default function ProductPage({ params }: { params: { id: string } }) {
|
|
|
976
1005
|
${product.salePrice || product.basePrice}
|
|
977
1006
|
</p>
|
|
978
1007
|
|
|
1008
|
+
{/* Render description based on format (HTML from Shopify/WooCommerce, text otherwise) */}
|
|
979
1009
|
{product.description && (
|
|
980
|
-
|
|
1010
|
+
product.descriptionFormat === 'html' ? (
|
|
1011
|
+
<div className="mt-4 text-gray-600" dangerouslySetInnerHTML={{ __html: product.description }} />
|
|
1012
|
+
) : (
|
|
1013
|
+
<p className="mt-4 text-gray-600">{product.description}</p>
|
|
1014
|
+
)
|
|
981
1015
|
)}
|
|
982
1016
|
|
|
983
1017
|
{/* Variant Selection */}
|
|
@@ -1828,6 +1862,7 @@ When building a store, implement these pages:
|
|
|
1828
1862
|
- Handle loading states and errors
|
|
1829
1863
|
- Persist cart ID in localStorage
|
|
1830
1864
|
- Persist customer token after login
|
|
1865
|
+
- **Check `descriptionFormat` and render HTML with `dangerouslySetInnerHTML` when format is `'html'`**
|
|
1831
1866
|
|
|
1832
1867
|
### DON'T:
|
|
1833
1868
|
|
|
@@ -1836,6 +1871,7 @@ When building a store, implement these pages:
|
|
|
1836
1871
|
- Skip implementing required pages
|
|
1837
1872
|
- Write `const products = [...]` - use the API!
|
|
1838
1873
|
- Use `@apply group` in CSS - Tailwind doesn't allow 'group' in @apply. Use `className="group"` on the element instead
|
|
1874
|
+
- **Render `product.description` as plain text without checking `descriptionFormat` - HTML will show as raw tags!**
|
|
1839
1875
|
|
|
1840
1876
|
---
|
|
1841
1877
|
|
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.
|
|
3
|
+
"version": "0.6.2",
|
|
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",
|