@contentful/optimization-api-client 0.1.0-alpha14 → 0.1.0-alpha16
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 +27 -21
- package/THIRD_PARTY_NOTICES.txt +2038 -0
- package/dist/index.cjs +50 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -31
- package/dist/index.d.mts +25 -31
- package/dist/index.d.ts +25 -31
- package/dist/index.mjs +50 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
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/v0.1.0-
|
|
3
|
+
<img alt="Contentful Logo" title="Contentful" src="https://raw.githubusercontent.com/contentful/optimization/v0.1.0-alpha16/contentful-icon.png" width="150">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@
|
|
|
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/v0.1.0-
|
|
14
|
+
[Reference](https://contentful.github.io/optimization) · [Contributing](https://github.com/contentful/optimization/blob/v0.1.0-alpha16/CONTRIBUTING.md)
|
|
15
15
|
|
|
16
16
|
</div>
|
|
17
17
|
|
|
@@ -84,27 +84,30 @@ Common Experience API options:
|
|
|
84
84
|
| Option | Required? | Default | Description |
|
|
85
85
|
| ----------------- | --------- | ------------------------------------- | ----------------------------------------------- |
|
|
86
86
|
| `baseUrl` | No | `'https://experience.ninetailed.co/'` | Base URL for the Experience API |
|
|
87
|
-
| `enabledFeatures` | No | `['ip-enrichment', 'location']` | Experience API features for
|
|
87
|
+
| `enabledFeatures` | No | `['ip-enrichment', 'location']` | Experience API features for mutation requests |
|
|
88
88
|
| `ip` | No | `undefined` | IP address override for Experience API analysis |
|
|
89
89
|
| `locale` | No | API default | Locale query parameter for localized responses |
|
|
90
|
-
| `plainText` | No |
|
|
90
|
+
| `plainText` | No | Endpoint-specific | Sends single-profile mutation endpoints as text |
|
|
91
91
|
| `preflight` | No | `false` | Aggregates a profile state without storing it |
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
`
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
Experience API
|
|
93
|
+
Experience mutation request options except `baseUrl` can also be provided per mutation request.
|
|
94
|
+
`getProfile` is a read request and only uses `locale` from per-call options; mutation-only options
|
|
95
|
+
such as `enabledFeatures`, `ip`, `plainText`, and `preflight` do not apply. Single-profile mutation
|
|
96
|
+
requests default to `plainText: true` and send `text/plain` unless overridden. Batch profile updates
|
|
97
|
+
with `upsertManyProfiles` are the JSON-default exception and use `plainText: false` by default.
|
|
98
|
+
`locale` is sent as the Experience API `locale` query parameter and can localize profile fields such
|
|
99
|
+
as `location.city` and `location.country`. Higher-level SDK merge-tag helpers resolve against the
|
|
100
|
+
profile values returned by the Experience API, so applications that render localized Contentful
|
|
101
|
+
entries commonly pass the same locale used for the CDA entry fetch. Pass a valid locale tag; invalid
|
|
102
|
+
locale syntax can fail Experience API request validation. See
|
|
99
103
|
[Locale handling in the Optimization SDK Suite](https://contentful.github.io/optimization/documents/Documentation.Concepts.Locale_handling_in_the_Optimization_SDK_Suite.html)
|
|
100
104
|
for how this request locale relates to Contentful and SDK-resolved locales.
|
|
101
105
|
|
|
102
106
|
Common Insights API options:
|
|
103
107
|
|
|
104
|
-
| Option
|
|
105
|
-
|
|
|
106
|
-
| `baseUrl`
|
|
107
|
-
| `beaconHandler` | No | `undefined` | Custom handler for enqueueing event batches if needed |
|
|
108
|
+
| Option | Required? | Default | Description |
|
|
109
|
+
| --------- | --------- | ------------------------------------------ | ----------------------------- |
|
|
110
|
+
| `baseUrl` | No | `'https://ingest.insights.ninetailed.co/'` | Base URL for the Insights API |
|
|
108
111
|
|
|
109
112
|
Common `fetchOptions` are `fetchMethod`, `requestTimeout`, `retries`, `intervalTimeout`,
|
|
110
113
|
`onFailedAttempt`, and `onRequestTimeout`. Default retries intentionally apply only to HTTP `503`
|
|
@@ -137,13 +140,16 @@ Common methods include `getProfile`, `createProfile`, `updateProfile`, `upsertPr
|
|
|
137
140
|
Insights API methods are scoped to `client.insights` and send analytics event batches:
|
|
138
141
|
|
|
139
142
|
```ts
|
|
140
|
-
await client.insights.sendBatchEvents(
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
await client.insights.sendBatchEvents([
|
|
144
|
+
{
|
|
145
|
+
profile,
|
|
146
|
+
events: [viewEvent],
|
|
147
|
+
},
|
|
148
|
+
])
|
|
144
149
|
```
|
|
145
150
|
|
|
146
|
-
Insights endpoints do not return response data.
|
|
151
|
+
Insights endpoints do not return response data. For last-chance browser lifecycle delivery, pass a
|
|
152
|
+
per-call `beacon` sender that receives the request URL and already serialized body.
|
|
147
153
|
|
|
148
154
|
### Fetch helpers
|
|
149
155
|
|
|
@@ -161,8 +167,8 @@ Use generated reference docs for helper signatures and callback payloads.
|
|
|
161
167
|
|
|
162
168
|
- [API Client generated reference](https://contentful.github.io/optimization/modules/_contentful_optimization-api-client.html) -
|
|
163
169
|
exported API reference
|
|
164
|
-
- [API Schemas](https://github.com/contentful/optimization/blob/v0.1.0-
|
|
165
|
-
- [Optimization Core SDK](https://github.com/contentful/optimization/blob/v0.1.0-
|
|
170
|
+
- [API Schemas](https://github.com/contentful/optimization/blob/v0.1.0-alpha16/packages/universal/api-schemas/README.md) - runtime validation schemas and inferred API types
|
|
171
|
+
- [Optimization Core SDK](https://github.com/contentful/optimization/blob/v0.1.0-alpha16/packages/universal/core-sdk/README.md) - platform-agnostic SDK layer that composes this
|
|
166
172
|
client
|
|
167
173
|
- [Choosing the right SDK](https://contentful.github.io/optimization/documents/Documentation.Guides.choosing-the-right-sdk.html) -
|
|
168
174
|
package selection guidance for application integrations
|