@lime-bundles/react 6.0.0 → 6.2.0
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 +7 -1
- package/dist/index.cjs +688 -518
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +633 -461
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1901 -0
- package/docs/css-variables.md +7 -1
- package/docs/hydrogen.md +29 -4
- package/docs/react-nextjs.md +24 -4
- package/package.json +2 -2
package/docs/css-variables.md
CHANGED
|
@@ -67,9 +67,15 @@ The variant dropdown is an accessible custom combobox (not a native `<select>`).
|
|
|
67
67
|
|
|
68
68
|
| `--lb-product-price-display` | `block` (shown) / `none` (hidden) | Toggle. |
|
|
69
69
|
| `--lb-product-compare-display` | `inline` (shown) / `none` (hidden) | Toggle. |
|
|
70
|
+
| `--lb-product-unit-price-display` | `block` (shown) / `none` (hidden) | Toggle for the per-unit line (`$4.99/kg`) under a product's price. Separate from the bundle summary's per-item figure. |
|
|
71
|
+
| `--lb-product-qty-chip-display` | `inline-flex` (shown) / `none` (hidden) | Toggle for the fixed bundle's right-slot quantity chip. |
|
|
72
|
+
| `--lb-product-qty-inline-display` | `inline` (shown) / `none` (hidden) | Toggle for the inline `×N` count used by every other bundle type. |
|
|
70
73
|
|
|
71
74
|
Per-product quantity renders as inline `×N` text beside the price (no floating
|
|
72
|
-
count badge), using the widget's own `--lb-text`.
|
|
75
|
+
count badge), using the widget's own `--lb-text`. The fixed bundle instead puts
|
|
76
|
+
its count in a chip in the row's right slot, which is why one merchant setting
|
|
77
|
+
drives two variables: the chip is a flex box and the inline count is text, so a
|
|
78
|
+
single "shown" value cannot serve both.
|
|
73
79
|
|
|
74
80
|
## CTA button
|
|
75
81
|
|
package/docs/hydrogen.md
CHANGED
|
@@ -12,6 +12,22 @@ npm install @lime-bundles/react @lime-bundles/core
|
|
|
12
12
|
|
|
13
13
|
`@lime-bundles/core` is a transitive dependency. Installing it explicitly lets you call `fetchBundleData` from a loader without pulling React.
|
|
14
14
|
|
|
15
|
+
Then add both packages to Vite's SSR dependency optimizer in `vite.config.ts`. On a stock Hydrogen skeleton this step is **required** — without it, the first route that imports `@lime-bundles/react` crashes MiniOxygen's SSR with `Cannot read properties of null (reading 'useState')` (the CJS/ESM interop issue the skeleton's own config documents for `set-cookie-parser` and friends):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
ssr: {
|
|
19
|
+
optimizeDeps: {
|
|
20
|
+
include: [
|
|
21
|
+
"set-cookie-parser",
|
|
22
|
+
"cookie",
|
|
23
|
+
"react-router",
|
|
24
|
+
"@lime-bundles/react",
|
|
25
|
+
"@lime-bundles/core",
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
```
|
|
30
|
+
|
|
15
31
|
## Environment
|
|
16
32
|
|
|
17
33
|
Open `/app/settings/headless` in your Lime Bundles admin, click **Generate token**, then append the value to your Hydrogen project's `.env`:
|
|
@@ -27,7 +43,7 @@ PUBLIC_LIME_BUNDLES_TOKEN=<paste the generated token>
|
|
|
27
43
|
|
|
28
44
|
The variable is intentionally namespaced so it doesn't collide with the `PUBLIC_STOREFRONT_API_TOKEN` that Shopify's Headless app issues for your primary storefront. Lime Bundles uses its own Storefront Access Token, scoped to bundle metaobjects and product listings only.
|
|
29
45
|
|
|
30
|
-
Lime Bundles creates the token for you via Shopify's Admin API. No custom-app configuration needed (Shopify deprecated that flow on 2026-01-01). The token carries the read-only scopes `unauthenticated_read_metaobjects` and `
|
|
46
|
+
Lime Bundles creates the token for you via Shopify's Admin API. No custom-app configuration needed (Shopify deprecated that flow on 2026-01-01). The token carries the read-only scopes `unauthenticated_read_metaobjects`, `unauthenticated_read_product_listings` and `unauthenticated_read_product_inventory` and nothing else. To rotate, click **Regenerate** on the same page. It revokes the current token and issues a new one atomically.
|
|
31
47
|
|
|
32
48
|
## Getting a bundle GID
|
|
33
49
|
|
|
@@ -160,9 +176,18 @@ The component renders tier cards, auto-selects the configured default tier, and
|
|
|
160
176
|
|
|
161
177
|
## Styling and merchant widget config
|
|
162
178
|
|
|
163
|
-
|
|
179
|
+
Styling has two layers, and the built-in components handle only one of them automatically:
|
|
180
|
+
|
|
181
|
+
1. **The merchant's widget config** (colours, borders, thumbnail ratios, show/hide toggles from the admin editor) — applied automatically. Each component emits the config as `--lb-*` CSS custom properties on its root, so the merchant's choices come through with no wiring.
|
|
182
|
+
2. **The structural stylesheet** — imported by you, once:
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
import "@lime-bundles/react/styles.css";
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Without the import the components render as unstyled markup; with it they match the storefront widget's look, tinted by the merchant's config.
|
|
164
189
|
|
|
165
|
-
|
|
190
|
+
Prefer a fully custom design instead? Skip the stylesheet and read the merchant's config off any `ParsedBundle` yourself:
|
|
166
191
|
|
|
167
192
|
```tsx
|
|
168
193
|
<button style={{ background: bundle.widgetConfig.cta.primaryColor }}>
|
|
@@ -170,7 +195,7 @@ Every `ParsedBundle` that `fetchBundleData` resolves to exposes the merchant's f
|
|
|
170
195
|
</button>
|
|
171
196
|
```
|
|
172
197
|
|
|
173
|
-
Want drop-in parity with the admin preview
|
|
198
|
+
Want drop-in parity with the admin preview with zero wiring? Swap to the [web component](./web-component.md): it carries its styles in its shadow root.
|
|
174
199
|
|
|
175
200
|
Full field list in [`packages/core/src/bundle/types.ts`](../../packages/core/src/bundle/types.ts). Helpers `WIDGET_CONFIG_DEFAULTS`, `mergeWidgetConfig`, `flattenWidgetConfig`, and `applyWidgetConfigVars` are exported from `@lime-bundles/core` if you want to apply the CSS custom properties to your own DOM.
|
|
176
201
|
|
package/docs/react-nextjs.md
CHANGED
|
@@ -27,7 +27,7 @@ NEXT_PUBLIC_LIME_BUNDLES_TOKEN=<paste the generated token>
|
|
|
27
27
|
|
|
28
28
|
The variable is intentionally namespaced to `LIME_BUNDLES_` so it doesn't collide with the Storefront API token Shopify's own Headless app issues for your primary storefront. Lime Bundles uses its own Storefront Access Token, scoped to bundle metaobjects and product listings only.
|
|
29
29
|
|
|
30
|
-
The `NEXT_PUBLIC_` prefix (or `VITE_` for Vite) exposes the value to client bundles. Lime Bundles creates the token for you via Shopify's Admin API. No custom-app setup needed (Shopify deprecated that flow on 2026-01-01). The token is a read-only public Storefront Access Token with `unauthenticated_read_metaobjects` and `
|
|
30
|
+
The `NEXT_PUBLIC_` prefix (or `VITE_` for Vite) exposes the value to client bundles. Lime Bundles creates the token for you via Shopify's Admin API. No custom-app setup needed (Shopify deprecated that flow on 2026-01-01). The token is a read-only public Storefront Access Token with `unauthenticated_read_metaobjects`, `unauthenticated_read_product_listings` and `unauthenticated_read_product_inventory` scopes, safe to ship in client code. To rotate, click **Regenerate** in the admin. It atomically revokes the old token and issues a new one.
|
|
31
31
|
|
|
32
32
|
## Pick a rendering mode
|
|
33
33
|
|
|
@@ -160,9 +160,18 @@ export function App() {
|
|
|
160
160
|
|
|
161
161
|
## Styling and merchant widget config
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
Styling has two layers, and the built-in components handle only one of them automatically:
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
1. **The merchant's widget config** (colours, borders, thumbnail ratios, show/hide toggles from the admin editor) — applied automatically. Each component emits the config as `--lb-*` CSS custom properties on its root, so the merchant's choices come through with no wiring.
|
|
166
|
+
2. **The structural stylesheet** — imported by you, once:
|
|
167
|
+
|
|
168
|
+
```tsx
|
|
169
|
+
import "@lime-bundles/react/styles.css";
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Without the import the components render as unstyled markup; with it they match the storefront widget's look, tinted by the merchant's config.
|
|
173
|
+
|
|
174
|
+
Prefer a fully custom design instead? Skip the stylesheet. Every `ParsedBundle` (the object `fetchBundleData` resolves to and `useBundleData` hands you) exposes the merchant's full config as `bundle.widgetConfig`. Read any field you want:
|
|
166
175
|
|
|
167
176
|
```tsx
|
|
168
177
|
function BundleCTA({ bundle }: { bundle: ParsedBundle }) {
|
|
@@ -226,7 +235,18 @@ function ProductBundles({ handle }: { handle: string }) {
|
|
|
226
235
|
case "volume":
|
|
227
236
|
return <VolumeBundle key={bundle.id} bundleGid={bundle.id} {...cartProps} />;
|
|
228
237
|
case "mix_match":
|
|
229
|
-
|
|
238
|
+
// `productHandle` opts into the theme widget's courtesy seed:
|
|
239
|
+
// with no required products, the bundle starts with the viewed
|
|
240
|
+
// product pre-added at its rule minimum. Omit it on pages that
|
|
241
|
+
// aren't product pages to start empty.
|
|
242
|
+
return (
|
|
243
|
+
<MixMatchBundle
|
|
244
|
+
key={bundle.id}
|
|
245
|
+
bundleGid={bundle.id}
|
|
246
|
+
productHandle={handle}
|
|
247
|
+
{...cartProps}
|
|
248
|
+
/>
|
|
249
|
+
);
|
|
230
250
|
}
|
|
231
251
|
})}
|
|
232
252
|
</>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lime-bundles/react",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "React components and hooks for the Lime Bundles Shopify app. Use on Hydrogen, Next.js, Vite, or any React-based headless storefront.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"react-dom": ">=18.0.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@lime-bundles/core": "^6.
|
|
55
|
+
"@lime-bundles/core": "^6.3.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@shopify/hydrogen-react": "^2026.4.1",
|