omni-sync-sdk 0.22.0 → 0.22.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.
@@ -519,8 +519,27 @@ providers.forEach (OAuth) response.providers.forEach
519
519
  status === 'completed' status === 'succeeded'
520
520
  product.metafields.name product.metafields[0].definitionName
521
521
  product.metafields.key product.metafields[0].definitionKey
522
+ orderItem.unitPrice orderItem.price (OrderItem is FLAT, not nested!)
523
+ cartItem.price cartItem.unitPrice (Cart/Checkout items use unitPrice)
524
+ waitResult.orderNumber waitResult.status.orderNumber (nested in PaymentStatus)
525
+ variant.attributes.map(...) Object.entries(variant.attributes || {}) (it's an object!)
526
+ categorySuggestion.slug // ❌ doesn't exist! Only: id, name, productCount
527
+ order.status === 'COMPLETED' order.status === 'delivered' (OrderStatus is lowercase!)
528
+ getCartTotals(localCart) // ❌ LocalCart has no subtotal! Calculate manually
529
+ result.checkoutId (guest checkout) // ⚠️ Check result.tracked first! It's a union type
522
530
  ```
523
531
 
532
+ **Key distinctions:**
533
+
534
+ - **OrderItem** (from orders): Flat structure — `item.price`, `item.name`, `item.image`
535
+ - **CartItem / CheckoutLineItem**: Nested structure — `item.unitPrice`, `item.product.name`, `item.product.images`
536
+ - **`getCartTotals()`** only works with **server Cart** (has `subtotal`/`discountAmount`). For **LocalCart**, calculate manually:
537
+ ```typescript
538
+ const subtotal = cart.items.reduce((sum, item) => sum + parseFloat(item.price || '0') * item.quantity, 0);
539
+ ```
540
+ - **`GuestCheckoutStartResponse`** is a union type — always check `result.tracked` before accessing `result.checkoutId`
541
+ - **`WaitForOrderResult`** has `result.status.orderNumber`, NOT `result.orderNumber`. But `completeGuestCheckout()` returns `GuestOrderResponse` which DOES have `result.orderNumber` directly.
542
+
524
543
  ---
525
544
 
526
545
  ## Full SDK Documentation