@lime-bundles/react 6.1.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/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`:
@@ -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
- The React SDK does **not** automatically apply the widget styles the merchant set in the admin editor. That's deliberate. If you chose `@lime-bundles/react` on Hydrogen you likely want full control over the look so bundles match your storefront's design system.
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
- Every `ParsedBundle` that `fetchBundleData` resolves to exposes the merchant's full config as `bundle.widgetConfig`. Read any field you want from it:
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 instead? Swap to the [web component](./web-component.md): it honours `widgetConfig` end-to-end without any wiring on your side.
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
 
@@ -160,9 +160,18 @@ export function App() {
160
160
 
161
161
  ## Styling and merchant widget config
162
162
 
163
- The React SDK does **not** automatically apply the widget styles the merchant set in the admin editor. That's deliberate. If you chose `@lime-bundles/react`, you almost certainly want full control over the look so bundles match your storefront's design system.
163
+ Styling has two layers, and the built-in components handle only one of them automatically:
164
164
 
165
- 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:
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
- return <MixMatchBundle key={bundle.id} bundleGid={bundle.id} {...cartProps} />;
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.1.0",
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.2.0"
55
+ "@lime-bundles/core": "^6.3.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@shopify/hydrogen-react": "^2026.4.1",