@contentful/optimization-node 2.0.1 → 2.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  <p align="center">
2
2
  <a href="https://www.contentful.com/developers/docs/personalization/">
3
- <img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/optimization-node-v2.0.1/contentful-icon.png" width="150">
3
+ <img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/optimization-node-v2.1.0/contentful-icon.png" width="150">
4
4
  </a>
5
5
  </p>
6
6
 
@@ -11,12 +11,12 @@
11
11
  <div align="center">
12
12
 
13
13
  [Guides](https://contentful.github.io/optimization/documents/Documentation.Guides.html) ·
14
- [Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/optimization-node-v2.0.1/CONTRIBUTING.md)
14
+ [Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/optimization-node-v2.1.0/CONTRIBUTING.md)
15
15
 
16
16
  </div>
17
17
 
18
18
  The Optimization Node SDK implements stateless server-side optimization behavior on top of the
19
- [Optimization Core SDK](https://github.com/contentful/optimization/blob/optimization-node-v2.0.1/packages/universal/core-sdk/README.md). Use it for server rendering, server
19
+ [Optimization Core SDK](https://github.com/contentful/optimization/blob/optimization-node-v2.1.0/packages/universal/core-sdk/README.md). Use it for server rendering, server
20
20
  functions, and Node services that need request-scoped profile evaluation or event emission.
21
21
 
22
22
  If you are integrating a Node application, start with [Getting Started](#getting-started), then use
@@ -110,7 +110,7 @@ are part of the same application.
110
110
 
111
111
  The Node SDK is stateless. It does not maintain consent, profile, or browser persistence state
112
112
  between requests. For cross-SDK consent guidance, see
113
- [Consent management in the Optimization SDK Suite](https://github.com/contentful/optimization/blob/optimization-node-v2.0.1/documentation/concepts/consent-management-in-the-optimization-sdk-suite.md).
113
+ [Consent management in the Optimization SDK Suite](https://github.com/contentful/optimization/blob/optimization-node-v2.1.0/documentation/concepts/consent-management-in-the-optimization-sdk-suite.md).
114
114
 
115
115
  | Option | Required? | Default | Description |
116
116
  | ------------------- | --------- | ---------------------- | ------------------------------------------------------------------------------- |
@@ -127,21 +127,45 @@ between requests. For cross-SDK consent guidance, see
127
127
 
128
128
  Common `api` options:
129
129
 
130
- | Option | Required? | Default | Description |
131
- | ------------------- | --------- | ------------------------------------------ | ------------------------------------------------ |
132
- | `experienceBaseUrl` | No | `'https://experience.ninetailed.co/'` | Base URL for the Experience API |
133
- | `insightsBaseUrl` | No | `'https://ingest.insights.ninetailed.co/'` | Base URL for the Insights API |
134
- | `enabledFeatures` | No | `['ip-enrichment', 'location']` | Experience API features to apply to each request |
130
+ | Option | Required? | Default | Description |
131
+ | ------------------- | --------- | ------------------------------------------ | ------------------------------------------------------------ |
132
+ | `experienceBaseUrl` | No | `'https://experience.ninetailed.co/'` | Base URL for the Experience API |
133
+ | `insightsBaseUrl` | No | `'https://ingest.insights.ninetailed.co/'` | Base URL for the Insights API |
134
+ | `enabledFeatures` | No | `['ip-enrichment', 'location']` | Experience API features to apply to each request |
135
+ | `location` | No | API fallback | Default location for single-profile Experience API mutations |
135
136
 
136
137
  Request-scoped Experience options belong in `experienceOptions` when creating the request-bound
137
138
  client:
138
139
 
139
- | Option | Description |
140
- | ----------- | ------------------------------------------------------------- |
141
- | `ip` | IP address override used by the Experience API |
142
- | `locale` | Locale query parameter for localized Experience API responses |
143
- | `plainText` | Sends performance-critical Experience API endpoints as text |
144
- | `preflight` | Aggregates a new profile state without storing it |
140
+ | Option | Description |
141
+ | ----------- | -------------------------------------------------------------- |
142
+ | `ip` | IP address override used by the Experience API |
143
+ | `location` | Request location replacing the complete `api.location` default |
144
+ | `locale` | Locale query parameter for localized Experience API responses |
145
+ | `plainText` | Sends performance-critical Experience API endpoints as text |
146
+ | `preflight` | Aggregates a new profile state without storing it |
147
+
148
+ Configure a shared default with `api.location`, then override it per incoming request with
149
+ `experienceOptions.location`:
150
+
151
+ ```ts
152
+ const optimization = new ContentfulOptimization({
153
+ spaceId: 'your-space-id',
154
+ api: { location: { countryCode: 'DE', city: 'Berlin' } },
155
+ })
156
+ const requestOptimization = optimization.forRequest({
157
+ consent: true,
158
+ experienceOptions: { location: { countryCode: 'FR', city: 'Paris' } },
159
+ })
160
+ await requestOptimization.page()
161
+ ```
162
+
163
+ The request value replaces the whole default object; it does not merge fields. Pass
164
+ `experienceOptions: { location: {} }` to replace the configured default with an explicit empty
165
+ location instead of API geolocation. Event `context.location` takes precedence over matching
166
+ request fields. An empty location does not clear an existing profile location, and request location
167
+ does not lock location across later requests. See
168
+ [Location inputs and profile updates](https://contentful.github.io/optimization/documents/Documentation.Concepts.Profile_synchronization_between_client_and_server.html#location-inputs-and-profile-updates).
145
169
 
146
170
  Request-scoped Insights options belong in `insightsOptions`:
147
171
 
@@ -321,9 +345,9 @@ package directory.
321
345
  step-by-step server-side integration guide
322
346
  - [Node SDK generated reference](https://contentful.github.io/optimization/modules/_contentful_optimization-node.html) -
323
347
  exported API reference
324
- - [Node reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.0.1/implementations/node-sdk/README.md) - server-rendered
348
+ - [Node reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.1.0/implementations/node-sdk/README.md) - server-rendered
325
349
  implementation using request-scoped SDK calls
326
- - [Node + Web reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.0.1/implementations/node-sdk+web-sdk/README.md) -
350
+ - [Node + Web reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.1.0/implementations/node-sdk+web-sdk/README.md) -
327
351
  hybrid SSR and browser implementation
328
- - [Optimization Web SDK](https://github.com/contentful/optimization/blob/optimization-node-v2.0.1/packages/web/web-sdk/README.md) - browser SDK used when the same application
352
+ - [Optimization Web SDK](https://github.com/contentful/optimization/blob/optimization-node-v2.1.0/packages/web/web-sdk/README.md) - browser SDK used when the same application
329
353
  also needs client-side consent, persistence, tracking, or live updates
@@ -34,7 +34,7 @@ __webpack_require__.d(__webpack_exports__, {
34
34
  OPTIMIZATION_NODE_SDK_VERSION: ()=>OPTIMIZATION_NODE_SDK_VERSION
35
35
  });
36
36
  const constants_namespaceObject = require("@contentful/optimization-core/constants");
37
- const OPTIMIZATION_NODE_SDK_VERSION = "2.0.1";
37
+ const OPTIMIZATION_NODE_SDK_VERSION = "2.1.0";
38
38
  const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
39
39
  exports.ANONYMOUS_ID_COOKIE = __webpack_exports__.ANONYMOUS_ID_COOKIE;
40
40
  exports.ANONYMOUS_ID_KEY = __webpack_exports__.ANONYMOUS_ID_KEY;
@@ -1,4 +1,4 @@
1
- const OPTIMIZATION_NODE_SDK_VERSION = "2.0.1";
1
+ const OPTIMIZATION_NODE_SDK_VERSION = "2.1.0";
2
2
  const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
3
3
  export { ANONYMOUS_ID_COOKIE, ANONYMOUS_ID_KEY } from "@contentful/optimization-core/constants";
4
4
  export { OPTIMIZATION_NODE_SDK_NAME, OPTIMIZATION_NODE_SDK_VERSION };
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@ var __webpack_modules__ = {
6
6
  OPTIMIZATION_NODE_SDK_VERSION: ()=>OPTIMIZATION_NODE_SDK_VERSION
7
7
  });
8
8
  require("@contentful/optimization-core/constants");
9
- const OPTIMIZATION_NODE_SDK_VERSION = "2.0.1";
9
+ const OPTIMIZATION_NODE_SDK_VERSION = "2.1.0";
10
10
  const OPTIMIZATION_NODE_SDK_NAME = "@contentful/optimization-node";
11
11
  }
12
12
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contentful/optimization-node",
3
3
  "description": "Node.js SDK for Contentful Optimization",
4
- "version": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -88,7 +88,7 @@
88
88
  }
89
89
  },
90
90
  "dependencies": {
91
- "@contentful/optimization-core": "2.0.1"
91
+ "@contentful/optimization-core": "2.1.0"
92
92
  },
93
93
  "devDependencies": {
94
94
  "@contentful/rich-text-html-renderer": "^17.1.6",