@sdg.la/wishlist-stack-hydrogen 0.15.0 → 0.16.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 +15 -2
- package/dist/middleware.d.cts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/react.d.cts +3 -2
- package/dist/react.d.ts +3 -2
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -10,6 +10,12 @@ It also provides:
|
|
|
10
10
|
- **Context helpers** (`getWishlistStackClient`, `getWishlistStack`) to avoid `context.get(...)` boilerplate
|
|
11
11
|
- **React Provider + hooks** for client-side usage (`@sdg.la/wishlist-stack-hydrogen/react`)
|
|
12
12
|
|
|
13
|
+
Headless integrations use the direct API at `https://app.wishliststack.com`.
|
|
14
|
+
From version 0.16.0 this is the default when `baseUrl` is omitted; explicit values
|
|
15
|
+
are preserved. Shopify Online Store themes should normally use the installed
|
|
16
|
+
same-origin app proxy with the [core SDK](../client/), rather than assuming that
|
|
17
|
+
proxy is available on a headless domain.
|
|
18
|
+
|
|
13
19
|
## Install
|
|
14
20
|
|
|
15
21
|
```bash
|
|
@@ -44,13 +50,18 @@ const {nonce, header, NonceProvider} = createContentSecurityPolicy({
|
|
|
44
50
|
checkoutDomain: context.env.PUBLIC_CHECKOUT_DOMAIN,
|
|
45
51
|
storeDomain: context.env.PUBLIC_STORE_DOMAIN,
|
|
46
52
|
},
|
|
47
|
-
connectSrc: ['https://
|
|
53
|
+
connectSrc: ['https://app.wishliststack.com'],
|
|
48
54
|
});
|
|
49
55
|
```
|
|
50
56
|
|
|
51
57
|
Without this, client-side API calls will be silently blocked by the browser's
|
|
52
58
|
Content Security Policy. If you use a custom `baseUrl`, add that domain instead.
|
|
53
59
|
|
|
60
|
+
When upgrading from a version whose default used the compatibility hostname,
|
|
61
|
+
allow the new origin before releasing browser bundles. Keep the old origin in
|
|
62
|
+
`connectSrc` while older bundles are cached, or retain an explicit `baseUrl`
|
|
63
|
+
during the transition. Server-side calls do not use the browser CSP.
|
|
64
|
+
|
|
54
65
|
## API limits and storefront guidance
|
|
55
66
|
|
|
56
67
|
1. Register the storefront origin for CORS if the browser calls the API directly.
|
|
@@ -63,6 +74,8 @@ Content Security Policy. If you use a custom `baseUrl`, add that domain instead.
|
|
|
63
74
|
may include the full list as additional fields.
|
|
64
75
|
6. Re-exported helpers: `clampPageSize`, `isAddItemsDeltaResponse`
|
|
65
76
|
from `@sdg.la/wishlist-stack-hydrogen`.
|
|
77
|
+
7. Prefer explicit `pageSize: 20` and follow pagination metadata when rendering
|
|
78
|
+
wishlists. Existing 25-item pages and the SDK default remain supported.
|
|
66
79
|
|
|
67
80
|
## 1) Server usage (attach to Hydrogen load context)
|
|
68
81
|
|
|
@@ -99,7 +112,7 @@ return hydrogenContext;
|
|
|
99
112
|
| Option | Type | Required | Description |
|
|
100
113
|
|--------|------|----------|-------------|
|
|
101
114
|
| `apiKey` | `string` | Yes | Your merchant API key |
|
|
102
|
-
| `baseUrl` | `string` | No | API base URL (defaults to
|
|
115
|
+
| `baseUrl` | `string` | No | Direct API base URL (defaults to `https://app.wishliststack.com` from 0.16.0) |
|
|
103
116
|
| `getCustomerAccessToken` | `(context: unknown) => Promise<string \| undefined> \| string \| undefined` | No | Override how the customer access token is resolved. If omitted, the library calls `context.customerAccount.getAccessToken()` automatically. |
|
|
104
117
|
|
|
105
118
|
Example with explicit token resolution:
|
package/dist/middleware.d.cts
CHANGED
package/dist/middleware.d.ts
CHANGED
package/dist/react.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WishlistStackClient } from '@sdg.la/wishlist-stack-sdk';
|
|
3
|
-
import {
|
|
3
|
+
import { BootstrapClientConfig } from './index.cjs';
|
|
4
4
|
|
|
5
5
|
type WishlistStackProviderMode = "proxy" | "direct";
|
|
6
6
|
/**
|
|
@@ -36,4 +36,5 @@ declare function WishlistStackProvider(props: WishlistStackProviderProps): React
|
|
|
36
36
|
declare function useWishlistStack(): WishlistStackProviderValue;
|
|
37
37
|
declare function useWishlistStackClient(): WishlistStackClient;
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { WishlistStackProvider, useWishlistStack, useWishlistStackClient };
|
|
40
|
+
export type { WishlistStackGlobalState, WishlistStackProviderMode, WishlistStackProviderProps };
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WishlistStackClient } from '@sdg.la/wishlist-stack-sdk';
|
|
3
|
-
import {
|
|
3
|
+
import { BootstrapClientConfig } from './index.js';
|
|
4
4
|
|
|
5
5
|
type WishlistStackProviderMode = "proxy" | "direct";
|
|
6
6
|
/**
|
|
@@ -36,4 +36,5 @@ declare function WishlistStackProvider(props: WishlistStackProviderProps): React
|
|
|
36
36
|
declare function useWishlistStack(): WishlistStackProviderValue;
|
|
37
37
|
declare function useWishlistStackClient(): WishlistStackClient;
|
|
38
38
|
|
|
39
|
-
export {
|
|
39
|
+
export { WishlistStackProvider, useWishlistStack, useWishlistStackClient };
|
|
40
|
+
export type { WishlistStackGlobalState, WishlistStackProviderMode, WishlistStackProviderProps };
|
package/dist/server.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WishlistStackClient } from '@sdg.la/wishlist-stack-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { WishlistStackHydrogenOptions, WishlistStackHydrogenServer } from './index.cjs';
|
|
3
3
|
|
|
4
4
|
declare function createWishlistStackServerContext(options: WishlistStackHydrogenOptions): (context: unknown) => {
|
|
5
5
|
wishlistStack: WishlistStackHydrogenServer;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WishlistStackClient } from '@sdg.la/wishlist-stack-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { WishlistStackHydrogenOptions, WishlistStackHydrogenServer } from './index.js';
|
|
3
3
|
|
|
4
4
|
declare function createWishlistStackServerContext(options: WishlistStackHydrogenOptions): (context: unknown) => {
|
|
5
5
|
wishlistStack: WishlistStackHydrogenServer;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdg.la/wishlist-stack-hydrogen",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Hydrogen (react-router) integration for wishlist-stack-sdk",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@sdg.la/wishlist-stack-sdk": "^0.
|
|
41
|
+
"@sdg.la/wishlist-stack-sdk": "^0.16.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"react": ">=18",
|