@constructor-io/constructorio-ui-plp 1.6.5 → 1.7.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 +28 -0
- package/dist/constructorio-ui-plp-bundled.js +11 -11
- package/lib/cjs/hooks/useCioPlpProvider.js +5 -3
- package/lib/cjs/hooks/useProduct.js +13 -9
- package/lib/cjs/utils/index.js +1 -0
- package/lib/cjs/utils/itemFieldGetters.js +5 -1
- package/lib/cjs/utils/shopifyDefaults.js +41 -0
- package/lib/cjs/version.js +1 -1
- package/lib/mjs/hooks/useCioPlpProvider.js +9 -3
- package/lib/mjs/hooks/useProduct.js +7 -2
- package/lib/mjs/utils/index.js +1 -0
- package/lib/mjs/utils/itemFieldGetters.js +3 -0
- package/lib/mjs/utils/shopifyDefaults.js +37 -0
- package/lib/mjs/version.js +1 -1
- package/lib/types/types.d.ts +2 -0
- package/lib/types/utils/index.d.ts +1 -0
- package/lib/types/utils/itemFieldGetters.d.ts +1 -0
- package/lib/types/utils/shopifyDefaults.d.ts +7 -0
- package/lib/types/version.d.ts +1 -1
- package/package.json +11 -11
package/README.md
CHANGED
|
@@ -50,6 +50,34 @@ CioPlp({
|
|
|
50
50
|
});
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
### 🛍️ Shopify-Specific Defaults
|
|
54
|
+
|
|
55
|
+
When integrating with Shopify themes, you can use the `useShopifyDefaults` prop to enable Shopify-specific behavior:
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
<CioPlp apiKey='your-api-key' useShopifyDefaults={true} />
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**What it provides:**
|
|
62
|
+
|
|
63
|
+
- `callbacks.onAddToCart`: Adds products to the Shopify cart via `/cart/add.js` API
|
|
64
|
+
- `callbacks.onProductCardClick`: Navigates to `/products/{itemId}`
|
|
65
|
+
- `urlHelpers.setUrl`: Converts `/group_id/` URLs to `/collections/` for Shopify compatibility
|
|
66
|
+
|
|
67
|
+
**For the JavaScript Bundle:**
|
|
68
|
+
|
|
69
|
+
When using `useShopifyDefaults` with the bundled version, you can omit the `selector` parameter and it will default to `#cio-plp-ui-container`:
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
CioPlp({
|
|
73
|
+
apiKey: 'your-api-key',
|
|
74
|
+
useShopifyDefaults: true,
|
|
75
|
+
// selector defaults to '#cio-plp-ui-container'
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Note:** Any custom `callbacks` or `urlHelpers` you provide will override the Shopify defaults.
|
|
80
|
+
|
|
53
81
|
## Custom Styling
|
|
54
82
|
|
|
55
83
|
### Library Defaults
|