omni-sync-sdk 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/README.md +33 -35
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -109,15 +109,15 @@ import type { Product, PaginatedResponse } from 'omni-sync-sdk';
109
109
  const response: PaginatedResponse<Product> = await omni.getProducts({
110
110
  page: 1,
111
111
  limit: 12,
112
- search: 'shirt', // Optional: search by name
113
- status: 'active', // Optional: 'active' | 'draft' | 'archived'
114
- type: 'SIMPLE', // Optional: 'SIMPLE' | 'VARIABLE'
115
- sortBy: 'createdAt', // Optional: 'name' | 'createdAt' | 'updatedAt' | 'basePrice'
116
- sortOrder: 'desc', // Optional: 'asc' | 'desc'
112
+ search: 'shirt', // Optional: search by name
113
+ status: 'active', // Optional: 'active' | 'draft' | 'archived'
114
+ type: 'SIMPLE', // Optional: 'SIMPLE' | 'VARIABLE'
115
+ sortBy: 'createdAt', // Optional: 'name' | 'createdAt' | 'updatedAt' | 'basePrice'
116
+ sortOrder: 'desc', // Optional: 'asc' | 'desc'
117
117
  });
118
118
 
119
- console.log(response.data); // Product[]
120
- console.log(response.meta.total); // Total number of products
119
+ console.log(response.data); // Product[]
120
+ console.log(response.meta.total); // Total number of products
121
121
  console.log(response.meta.totalPages); // Total pages
122
122
  ```
123
123
 
@@ -128,10 +128,10 @@ const product: Product = await omni.getProduct('product_id');
128
128
 
129
129
  console.log(product.name);
130
130
  console.log(product.basePrice);
131
- console.log(product.salePrice); // null if no sale
132
- console.log(product.images); // ProductImage[]
133
- console.log(product.variants); // ProductVariant[] (for VARIABLE products)
134
- console.log(product.inventory); // { total, reserved, available }
131
+ console.log(product.salePrice); // null if no sale
132
+ console.log(product.images); // ProductImage[]
133
+ console.log(product.variants); // ProductVariant[] (for VARIABLE products)
134
+ console.log(product.inventory); // { total, reserved, available }
135
135
  ```
136
136
 
137
137
  #### Product Type Definition
@@ -195,9 +195,9 @@ setCartId(cart.id); // Save to localStorage
195
195
  const cartId = getCartId();
196
196
  if (cartId) {
197
197
  const cart = await omni.getCart(cartId);
198
- console.log(cart.items); // CartItem[]
199
- console.log(cart.itemCount); // Total items
200
- console.log(cart.subtotal); // Subtotal amount
198
+ console.log(cart.items); // CartItem[]
199
+ console.log(cart.itemCount); // Total items
200
+ console.log(cart.subtotal); // Subtotal amount
201
201
  }
202
202
  ```
203
203
 
@@ -206,7 +206,7 @@ if (cartId) {
206
206
  ```typescript
207
207
  const cart = await omni.addToCart(cartId, {
208
208
  productId: 'product_id',
209
- variantId: 'variant_id', // Optional: for VARIABLE products
209
+ variantId: 'variant_id', // Optional: for VARIABLE products
210
210
  quantity: 2,
211
211
  notes: 'Gift wrap please', // Optional
212
212
  });
@@ -231,7 +231,7 @@ const cart = await omni.removeCartItem(cartId, itemId);
231
231
  ```typescript
232
232
  const cart = await omni.applyCoupon(cartId, 'SAVE20');
233
233
  console.log(cart.discountAmount); // Discount applied
234
- console.log(cart.couponCode); // 'SAVE20'
234
+ console.log(cart.couponCode); // 'SAVE20'
235
235
  ```
236
236
 
237
237
  #### Remove Coupon
@@ -310,12 +310,12 @@ const { checkout, rates } = await omni.setShippingAddress(checkoutId, {
310
310
  firstName: 'John',
311
311
  lastName: 'Doe',
312
312
  line1: '123 Main St',
313
- line2: 'Apt 4B', // Optional
313
+ line2: 'Apt 4B', // Optional
314
314
  city: 'New York',
315
- region: 'NY', // State/Province
315
+ region: 'NY', // State/Province
316
316
  postalCode: '10001',
317
317
  country: 'US',
318
- phone: '+1234567890', // Optional
318
+ phone: '+1234567890', // Optional
319
319
  });
320
320
 
321
321
  // rates contains available shipping options
@@ -368,12 +368,7 @@ interface Checkout {
368
368
  availableShippingRates?: ShippingRate[];
369
369
  }
370
370
 
371
- type CheckoutStatus =
372
- | 'PENDING'
373
- | 'SHIPPING_SET'
374
- | 'PAYMENT_PENDING'
375
- | 'COMPLETED'
376
- | 'FAILED';
371
+ type CheckoutStatus = 'PENDING' | 'SHIPPING_SET' | 'PAYMENT_PENDING' | 'COMPLETED' | 'FAILED';
377
372
 
378
373
  interface ShippingRate {
379
374
  id: string;
@@ -498,7 +493,7 @@ await omni.deleteMyAddress(addressId);
498
493
  ```typescript
499
494
  const store = await omni.getStoreInfo();
500
495
 
501
- console.log(store.name); // Store name
496
+ console.log(store.name); // Store name
502
497
  console.log(store.currency); // 'USD', 'ILS', etc.
503
498
  console.log(store.language); // 'en', 'he', etc.
504
499
  ```
@@ -1318,15 +1313,15 @@ export async function POST(req: Request) {
1318
1313
 
1319
1314
  ### Webhook Events
1320
1315
 
1321
- | Event | Description |
1322
- |-------|-------------|
1323
- | `product.created` | New product created |
1324
- | `product.updated` | Product details changed |
1325
- | `product.deleted` | Product removed |
1326
- | `inventory.updated` | Stock levels changed |
1327
- | `order.created` | New order received |
1328
- | `order.updated` | Order status changed |
1329
- | `cart.abandoned` | Cart abandoned (no activity) |
1316
+ | Event | Description |
1317
+ | -------------------- | ------------------------------- |
1318
+ | `product.created` | New product created |
1319
+ | `product.updated` | Product details changed |
1320
+ | `product.deleted` | Product removed |
1321
+ | `inventory.updated` | Stock levels changed |
1322
+ | `order.created` | New order received |
1323
+ | `order.updated` | Order status changed |
1324
+ | `cart.abandoned` | Cart abandoned (no activity) |
1330
1325
  | `checkout.completed` | Checkout completed successfully |
1331
1326
 
1332
1327
  ---
@@ -1411,6 +1406,7 @@ When building a store, implement these pages:
1411
1406
  ## Important Rules
1412
1407
 
1413
1408
  ### DO:
1409
+
1414
1410
  - Install `omni-sync-sdk` and use it for ALL data
1415
1411
  - Import types from the SDK
1416
1412
  - Handle loading states and errors
@@ -1418,10 +1414,12 @@ When building a store, implement these pages:
1418
1414
  - Persist customer token after login
1419
1415
 
1420
1416
  ### DON'T:
1417
+
1421
1418
  - Create mock/hardcoded product data
1422
1419
  - Use localStorage for products
1423
1420
  - Skip implementing required pages
1424
1421
  - Write `const products = [...]` - use the API!
1422
+ - Use `@apply group` in CSS - Tailwind doesn't allow 'group' in @apply. Use `className="group"` on the element instead
1425
1423
 
1426
1424
  ---
1427
1425
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-sync-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.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",