@contentful/optimization-node 2.1.1 → 2.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 +28 -7
- package/THIRD_PARTY_NOTICES.txt +47 -6
- package/dist/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/package.json +2 -2
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.
|
|
3
|
+
<img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/optimization-node-v2.2.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.
|
|
14
|
+
[Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/optimization-node-v2.2.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.
|
|
19
|
+
[Optimization Core SDK](https://github.com/contentful/optimization/blob/optimization-node-v2.2.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.
|
|
113
|
+
[Consent management in the Optimization SDK Suite](https://github.com/contentful/optimization/blob/optimization-node-v2.2.0/documentation/concepts/consent-management-in-the-optimization-sdk-suite.md).
|
|
114
114
|
|
|
115
115
|
| Option | Required? | Default | Description |
|
|
116
116
|
| ------------------- | --------- | ---------------------- | ------------------------------------------------------------------------------- |
|
|
@@ -250,6 +250,27 @@ In stateless runtimes, Insights-backed methods require a request-bound profile f
|
|
|
250
250
|
Non-sticky `trackView`, `trackClick`, `trackHover`, and `trackFlagView` require a profile ID passed
|
|
251
251
|
to `forRequest()`.
|
|
252
252
|
|
|
253
|
+
For custom integrations that need an event payload before submission, use the request client's
|
|
254
|
+
`eventBuilder`. It exposes `buildIdentify`, `buildPageView`, `buildScreenView`, and `buildTrack`
|
|
255
|
+
with request event context and locale defaults. In this example, `appConsent`, `appLocale`,
|
|
256
|
+
`appUserAgent`, and `appUserId` come from your application's request and identity handling:
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
const requestOptimization = optimization.forRequest({
|
|
260
|
+
consent: appConsent,
|
|
261
|
+
locale: appLocale,
|
|
262
|
+
eventContext: { userAgent: appUserAgent },
|
|
263
|
+
})
|
|
264
|
+
const identifyEvent = requestOptimization.eventBuilder.buildIdentify({ userId: appUserId })
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Construction does not send the event, check request consent, invoke interceptors, or update the
|
|
268
|
+
request profile or selections. Built events use the shared builder's `context.gdpr.isConsentGiven`,
|
|
269
|
+
which is `false` in the Node SDK, even when request consent is granted. Sending `identifyEvent` through a
|
|
270
|
+
low-level API does not automatically apply request consent or SDK submission processing. For normal
|
|
271
|
+
submission, use request-bound `identify()`, `page()`, `screen()`, or `track()`. The singleton's
|
|
272
|
+
`optimization.eventBuilder` remains unbound to any request.
|
|
273
|
+
|
|
253
274
|
### Content resolution
|
|
254
275
|
|
|
255
276
|
When a `contentful.js` client is available, prefer SDK-managed fetching by entry ID or content type
|
|
@@ -345,9 +366,9 @@ package directory.
|
|
|
345
366
|
step-by-step server-side integration guide
|
|
346
367
|
- [Node SDK generated reference](https://contentful.github.io/optimization/modules/_contentful_optimization-node.html) -
|
|
347
368
|
exported API reference
|
|
348
|
-
- [Node reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.
|
|
369
|
+
- [Node reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.2.0/implementations/node-sdk/README.md) - server-rendered
|
|
349
370
|
implementation using request-scoped SDK calls
|
|
350
|
-
- [Node + Web reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.
|
|
371
|
+
- [Node + Web reference implementation](https://github.com/contentful/optimization/blob/optimization-node-v2.2.0/implementations/node-sdk+web-sdk/README.md) -
|
|
351
372
|
hybrid SSR and browser implementation
|
|
352
|
-
- [Optimization Web SDK](https://github.com/contentful/optimization/blob/optimization-node-v2.
|
|
373
|
+
- [Optimization Web SDK](https://github.com/contentful/optimization/blob/optimization-node-v2.2.0/packages/web/web-sdk/README.md) - browser SDK used when the same application
|
|
353
374
|
also needs client-side consent, persistence, tracking, or live updates
|
package/THIRD_PARTY_NOTICES.txt
CHANGED
|
@@ -625,16 +625,57 @@ SOFTWARE.
|
|
|
625
625
|
|
|
626
626
|
---
|
|
627
627
|
|
|
628
|
-
The following software may be included in this product: es-toolkit (1.
|
|
628
|
+
The following software may be included in this product: es-toolkit (1.53.0)
|
|
629
629
|
This software contains the following license and notice below:
|
|
630
630
|
|
|
631
|
-
|
|
631
|
+
NOTICE:
|
|
632
|
+
|
|
633
|
+
es-toolkit
|
|
634
|
+
|
|
635
|
+
Parts of the test suite and compatibility layer in es-toolkit/compat are
|
|
636
|
+
derived from Lodash (https://github.com/lodash/lodash).
|
|
637
|
+
|
|
638
|
+
Lodash copyright notice and MIT permission notice:
|
|
639
|
+
|
|
640
|
+
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
641
|
+
|
|
642
|
+
Based on Underscore.js, copyright Jeremy Ashkenas,
|
|
643
|
+
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
|
644
|
+
|
|
645
|
+
This software consists of voluntary contributions made by many
|
|
646
|
+
individuals. For exact contribution history, see the revision history
|
|
647
|
+
available at https://github.com/lodash/lodash
|
|
648
|
+
|
|
649
|
+
The following license applies to all parts of this software except as
|
|
650
|
+
documented below:
|
|
632
651
|
|
|
633
|
-
|
|
652
|
+
====
|
|
634
653
|
|
|
635
|
-
|
|
654
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
655
|
+
a copy of this software and associated documentation files (the
|
|
656
|
+
"Software"), to deal in the Software without restriction, including
|
|
657
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
658
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
659
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
660
|
+
the following conditions:
|
|
661
|
+
|
|
662
|
+
The above copyright notice and this permission notice shall be
|
|
663
|
+
included in all copies or substantial portions of the Software.
|
|
664
|
+
|
|
665
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
666
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
667
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
668
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
669
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
670
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
671
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
672
|
+
|
|
673
|
+
LICENSE:
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
MIT License
|
|
636
677
|
|
|
637
|
-
|
|
678
|
+
Copyright (c) 2024 Viva Republica, Inc.
|
|
638
679
|
|
|
639
680
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
640
681
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1424,7 +1465,7 @@ SOFTWARE.
|
|
|
1424
1465
|
|
|
1425
1466
|
---
|
|
1426
1467
|
|
|
1427
|
-
The following software may be included in this product: zod (4.
|
|
1468
|
+
The following software may be included in this product: zod (4.6.7)
|
|
1428
1469
|
This software contains the following license and notice below:
|
|
1429
1470
|
|
|
1430
1471
|
MIT License
|
package/dist/constants.cjs
CHANGED
|
@@ -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.
|
|
37
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "2.2.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;
|
package/dist/constants.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const OPTIMIZATION_NODE_SDK_VERSION = "2.
|
|
1
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "2.2.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.
|
|
9
|
+
const OPTIMIZATION_NODE_SDK_VERSION = "2.2.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.
|
|
4
|
+
"version": "2.2.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.
|
|
91
|
+
"@contentful/optimization-core": "2.2.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"@contentful/rich-text-html-renderer": "^17.1.6",
|