omni-sync-sdk 0.6.1 → 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 +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -212,6 +212,7 @@ interface Product {
|
|
|
212
212
|
id: string;
|
|
213
213
|
name: string;
|
|
214
214
|
description?: string | null;
|
|
215
|
+
descriptionFormat?: 'text' | 'html' | 'markdown'; // Format of description content
|
|
215
216
|
sku: string;
|
|
216
217
|
basePrice: number;
|
|
217
218
|
salePrice?: number | null;
|
|
@@ -249,6 +250,30 @@ interface InventoryInfo {
|
|
|
249
250
|
}
|
|
250
251
|
```
|
|
251
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
|
+
|
|
252
277
|
---
|
|
253
278
|
|
|
254
279
|
### Local Cart (Guest Users) - RECOMMENDED
|
|
@@ -980,8 +1005,13 @@ export default function ProductPage({ params }: { params: { id: string } }) {
|
|
|
980
1005
|
${product.salePrice || product.basePrice}
|
|
981
1006
|
</p>
|
|
982
1007
|
|
|
1008
|
+
{/* Render description based on format (HTML from Shopify/WooCommerce, text otherwise) */}
|
|
983
1009
|
{product.description && (
|
|
984
|
-
|
|
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
|
+
)
|
|
985
1015
|
)}
|
|
986
1016
|
|
|
987
1017
|
{/* Variant Selection */}
|
|
@@ -1832,6 +1862,7 @@ When building a store, implement these pages:
|
|
|
1832
1862
|
- Handle loading states and errors
|
|
1833
1863
|
- Persist cart ID in localStorage
|
|
1834
1864
|
- Persist customer token after login
|
|
1865
|
+
- **Check `descriptionFormat` and render HTML with `dangerouslySetInnerHTML` when format is `'html'`**
|
|
1835
1866
|
|
|
1836
1867
|
### DON'T:
|
|
1837
1868
|
|
|
@@ -1840,6 +1871,7 @@ When building a store, implement these pages:
|
|
|
1840
1871
|
- Skip implementing required pages
|
|
1841
1872
|
- Write `const products = [...]` - use the API!
|
|
1842
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!**
|
|
1843
1875
|
|
|
1844
1876
|
---
|
|
1845
1877
|
|
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",
|