@usethrottle/checkout-react 2.1.0 → 2.1.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 +7 -4
- package/dist/index.cjs +986 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +1010 -13
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -132,9 +132,12 @@ export function MyEmbed({ sessionId }: { sessionId: string }) {
|
|
|
132
132
|
Own a Throttle cart directly from the browser — no backend, no secret key. The
|
|
133
133
|
hook wraps `@usethrottle/cart`'s `CartSessionClient`: it creates the cart lazily
|
|
134
134
|
on the first `addItem`, persists the session id to `localStorage`, resumes it on
|
|
135
|
-
the next visit, and exposes reactive `cart` state. Authorize with a
|
|
136
|
-
`
|
|
137
|
-
`
|
|
135
|
+
the next visit, and exposes reactive `cart` state. Authorize with a storefront quote
|
|
136
|
+
token (`qt_…`, from the dashboard Shipping & Tax page or
|
|
137
|
+
`POST /api/v1/shipping-tax/quote-tokens`) + your application's origin allowlist
|
|
138
|
+
(set origins via `PUT /api/v1/embed-config`). Quote tokens minted before `qt_`
|
|
139
|
+
start with `pk_` and keep working. A `pk_` publishable API key is a different
|
|
140
|
+
credential and is refused with `401 invalid_quote_token`.
|
|
138
141
|
|
|
139
142
|
```tsx
|
|
140
143
|
import { useCartSession } from '@usethrottle/checkout-react';
|
|
@@ -143,7 +146,7 @@ function Cart() {
|
|
|
143
146
|
const cart = useCartSession({
|
|
144
147
|
applicationId: '7f9d4c8a-5b2e-4f16-9a73-2d1e5c8b6f40',
|
|
145
148
|
environmentId: 'a1b2c3d4-...',
|
|
146
|
-
quoteToken: '
|
|
149
|
+
quoteToken: 'qt_...',
|
|
147
150
|
});
|
|
148
151
|
|
|
149
152
|
return (
|