@contentful/optimization-api-client 1.1.0 → 2.0.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 +37 -15
- package/THIRD_PARTY_NOTICES.txt +0 -2017
- package/dist/api-schemas.cjs +504 -28
- package/dist/api-schemas.cjs.map +1 -1
- package/dist/api-schemas.d.cts +6558 -1
- package/dist/api-schemas.d.mts +6558 -1
- package/dist/api-schemas.d.ts +6558 -1
- package/dist/api-schemas.mjs +309 -2
- package/dist/api-schemas.mjs.map +1 -0
- package/dist/guards.cjs +44 -0
- package/dist/guards.cjs.map +1 -0
- package/dist/guards.d.cts +103 -0
- package/dist/guards.d.mts +103 -0
- package/dist/guards.d.ts +103 -0
- package/dist/guards.mjs +1 -0
- package/dist/index.cjs +48 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1512 -24
- package/dist/index.d.mts +1512 -24
- package/dist/index.d.ts +1512 -24
- package/dist/index.mjs +23 -22
- package/dist/index.mjs.map +1 -1
- package/dist/logger.cjs +17 -13
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.mjs +131 -1
- package/dist/logger.mjs.map +1 -0
- package/dist/u~0.mjs +6 -0
- package/dist/u~0.mjs.map +1 -0
- package/package.json +39 -2
- package/dist/199.mjs +0 -2
- package/dist/649.mjs +0 -131
- package/dist/649.mjs.map +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Union of supported change types.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
declare const Change: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
9
|
+
key: z.ZodMiniString<string>;
|
|
10
|
+
meta: z.ZodMiniObject<{
|
|
11
|
+
/**
|
|
12
|
+
* Identifier of the personalization or experiment experience.
|
|
13
|
+
*/
|
|
14
|
+
experienceId: z.ZodMiniString<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Index of the variant within the experience configuration.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
20
|
+
*/
|
|
21
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
type: z.ZodMiniLiteral<"Variable">;
|
|
24
|
+
value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
25
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
26
|
+
id: z.ZodMiniString<string>;
|
|
27
|
+
variantId: z.ZodMiniString<string>;
|
|
28
|
+
meta: z.ZodMiniObject<{
|
|
29
|
+
/**
|
|
30
|
+
* Identifier of the optimization that produced this change.
|
|
31
|
+
*/
|
|
32
|
+
optimizationId: z.ZodMiniString<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Index of the variant within the optimization's distribution.
|
|
35
|
+
*/
|
|
36
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
type: z.ZodMiniLiteral<"Experience">;
|
|
39
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
40
|
+
id: z.ZodMiniString<string>;
|
|
41
|
+
variantId: z.ZodMiniString<string>;
|
|
42
|
+
meta: z.ZodMiniObject<{
|
|
43
|
+
/**
|
|
44
|
+
* Identifier of the optimization that produced this change.
|
|
45
|
+
*/
|
|
46
|
+
optimizationId: z.ZodMiniString<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Index of the variant within the optimization's distribution.
|
|
49
|
+
*/
|
|
50
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
type: z.ZodMiniLiteral<"Fragment">;
|
|
53
|
+
}, z.core.$strip>], "type">;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* TypeScript type inferred from {@link Change}.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
declare type Change = z.infer<typeof Change>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Determines whether a change represents a variable-backed optimization.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export declare function isVariableChange(change: Change): change is VariableChange;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Zod schema representing a change whose type is `'Variable'`.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* The `value` must conform to {@link VariableChangeValue}.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
declare const VariableChange: z.ZodMiniObject<{
|
|
78
|
+
key: z.ZodMiniString<string>;
|
|
79
|
+
meta: z.ZodMiniObject<{
|
|
80
|
+
/**
|
|
81
|
+
* Identifier of the personalization or experiment experience.
|
|
82
|
+
*/
|
|
83
|
+
experienceId: z.ZodMiniString<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Index of the variant within the experience configuration.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
89
|
+
*/
|
|
90
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
type: z.ZodMiniLiteral<"Variable">;
|
|
93
|
+
value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* TypeScript type inferred from {@link VariableChange}.
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
declare type VariableChange = z.infer<typeof VariableChange>;
|
|
102
|
+
|
|
103
|
+
export { }
|
package/dist/guards.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as z from 'zod/mini';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Union of supported change types.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
declare const Change: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
9
|
+
key: z.ZodMiniString<string>;
|
|
10
|
+
meta: z.ZodMiniObject<{
|
|
11
|
+
/**
|
|
12
|
+
* Identifier of the personalization or experiment experience.
|
|
13
|
+
*/
|
|
14
|
+
experienceId: z.ZodMiniString<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Index of the variant within the experience configuration.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
20
|
+
*/
|
|
21
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
type: z.ZodMiniLiteral<"Variable">;
|
|
24
|
+
value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
25
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
26
|
+
id: z.ZodMiniString<string>;
|
|
27
|
+
variantId: z.ZodMiniString<string>;
|
|
28
|
+
meta: z.ZodMiniObject<{
|
|
29
|
+
/**
|
|
30
|
+
* Identifier of the optimization that produced this change.
|
|
31
|
+
*/
|
|
32
|
+
optimizationId: z.ZodMiniString<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Index of the variant within the optimization's distribution.
|
|
35
|
+
*/
|
|
36
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
type: z.ZodMiniLiteral<"Experience">;
|
|
39
|
+
}, z.core.$strip>, z.ZodMiniObject<{
|
|
40
|
+
id: z.ZodMiniString<string>;
|
|
41
|
+
variantId: z.ZodMiniString<string>;
|
|
42
|
+
meta: z.ZodMiniObject<{
|
|
43
|
+
/**
|
|
44
|
+
* Identifier of the optimization that produced this change.
|
|
45
|
+
*/
|
|
46
|
+
optimizationId: z.ZodMiniString<string>;
|
|
47
|
+
/**
|
|
48
|
+
* Index of the variant within the optimization's distribution.
|
|
49
|
+
*/
|
|
50
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
type: z.ZodMiniLiteral<"Fragment">;
|
|
53
|
+
}, z.core.$strip>], "type">;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* TypeScript type inferred from {@link Change}.
|
|
57
|
+
*
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
declare type Change = z.infer<typeof Change>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Determines whether a change represents a variable-backed optimization.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export declare function isVariableChange(change: Change): change is VariableChange;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Zod schema representing a change whose type is `'Variable'`.
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* The `value` must conform to {@link VariableChangeValue}.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
*/
|
|
77
|
+
declare const VariableChange: z.ZodMiniObject<{
|
|
78
|
+
key: z.ZodMiniString<string>;
|
|
79
|
+
meta: z.ZodMiniObject<{
|
|
80
|
+
/**
|
|
81
|
+
* Identifier of the personalization or experiment experience.
|
|
82
|
+
*/
|
|
83
|
+
experienceId: z.ZodMiniString<string>;
|
|
84
|
+
/**
|
|
85
|
+
* Index of the variant within the experience configuration.
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* Typically corresponds to the array index in the experience's distribution.
|
|
89
|
+
*/
|
|
90
|
+
variantIndex: z.ZodMiniNumber<number>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
type: z.ZodMiniLiteral<"Variable">;
|
|
93
|
+
value: z.ZodMiniUnion<readonly [z.ZodMiniString<string>, z.ZodMiniBoolean<boolean>, z.ZodMiniNull, z.ZodMiniNumber<number>, z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>]>;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* TypeScript type inferred from {@link VariableChange}.
|
|
98
|
+
*
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
declare type VariableChange = z.infer<typeof VariableChange>;
|
|
102
|
+
|
|
103
|
+
export { }
|
package/dist/guards.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isVariableChange } from "./u~0.mjs";
|
package/dist/index.cjs
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
3
|
"./src/lib/logger/LogSink.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
4
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
5
|
-
A: ()=>__rspack_default_export
|
|
6
|
-
});
|
|
7
4
|
class LogSink {
|
|
8
5
|
}
|
|
9
6
|
const __rspack_default_export = LogSink;
|
|
7
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
8
|
+
A: __rspack_default_export
|
|
9
|
+
});
|
|
10
10
|
},
|
|
11
11
|
"./src/lib/logger/logging.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
12
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
13
|
-
A: ()=>logLevelSeverity
|
|
14
|
-
});
|
|
15
12
|
const logLevelSeverity = {
|
|
16
13
|
fatal: 60,
|
|
17
14
|
error: 50,
|
|
@@ -20,6 +17,9 @@ var __webpack_modules__ = {
|
|
|
20
17
|
debug: 20,
|
|
21
18
|
log: 10
|
|
22
19
|
};
|
|
20
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
21
|
+
A: logLevelSeverity
|
|
22
|
+
});
|
|
23
23
|
},
|
|
24
24
|
"./src/logger.ts" (__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -124,11 +124,15 @@ function __webpack_require__(moduleId) {
|
|
|
124
124
|
return module.exports;
|
|
125
125
|
}
|
|
126
126
|
(()=>{
|
|
127
|
-
__webpack_require__.d = (exports1,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
128
|
+
var define = (defs, kind)=>{
|
|
129
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
[kind]: defs[key]
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
define(getters, "get");
|
|
135
|
+
define(values, "value");
|
|
132
136
|
};
|
|
133
137
|
})();
|
|
134
138
|
(()=>{
|
|
@@ -148,16 +152,17 @@ var __webpack_exports__ = {};
|
|
|
148
152
|
(()=>{
|
|
149
153
|
__webpack_require__.r(__webpack_exports__);
|
|
150
154
|
__webpack_require__.d(__webpack_exports__, {
|
|
151
|
-
createTimeoutFetchMethod: ()=>createTimeoutFetchMethod,
|
|
152
|
-
ExperienceApiClient: ()=>ExperienceApiClient,
|
|
153
|
-
createProtectedFetchMethod: ()=>createProtectedFetchMethod,
|
|
154
|
-
EXPERIENCE_BASE_URL: ()=>EXPERIENCE_BASE_URL,
|
|
155
155
|
ApiClient: ()=>ApiClient,
|
|
156
|
+
EXPERIENCE_BASE_URL: ()=>EXPERIENCE_BASE_URL,
|
|
157
|
+
ExperienceApiClient: ()=>ExperienceApiClient,
|
|
156
158
|
INSIGHTS_BASE_URL: ()=>INSIGHTS_BASE_URL,
|
|
159
|
+
InsightsApiClient: ()=>InsightsApiClient,
|
|
160
|
+
createProtectedFetchMethod: ()=>createProtectedFetchMethod,
|
|
157
161
|
createRetryFetchMethod: ()=>createRetryFetchMethod,
|
|
158
|
-
|
|
162
|
+
createTimeoutFetchMethod: ()=>createTimeoutFetchMethod,
|
|
163
|
+
isVariableChange: ()=>isVariableChange
|
|
159
164
|
});
|
|
160
|
-
const
|
|
165
|
+
const api_schemas_namespaceObject = require("@contentful/optimization-api-client/api-schemas");
|
|
161
166
|
var logger = __webpack_require__("./src/logger.ts");
|
|
162
167
|
const fetchInputToString = (input)=>{
|
|
163
168
|
if ('string' == typeof input) return input;
|
|
@@ -290,14 +295,14 @@ var __webpack_exports__ = {};
|
|
|
290
295
|
const fetch_Fetch = Fetch;
|
|
291
296
|
const fetch = fetch_Fetch;
|
|
292
297
|
const ApiClientBase_logger = (0, logger.createScopedLogger)('ApiClient');
|
|
293
|
-
const DEFAULT_ENVIRONMENT = '
|
|
298
|
+
const DEFAULT_ENVIRONMENT = 'master';
|
|
294
299
|
class ApiClientBase {
|
|
295
300
|
name;
|
|
296
|
-
|
|
301
|
+
spaceId;
|
|
297
302
|
environment;
|
|
298
303
|
fetch;
|
|
299
|
-
constructor(name, { fetchOptions,
|
|
300
|
-
this.
|
|
304
|
+
constructor(name, { fetchOptions, spaceId, environment }){
|
|
305
|
+
this.spaceId = spaceId;
|
|
301
306
|
this.environment = environment ?? DEFAULT_ENVIRONMENT;
|
|
302
307
|
this.name = name;
|
|
303
308
|
this.fetch = fetch.create({
|
|
@@ -338,10 +343,10 @@ var __webpack_exports__ = {};
|
|
|
338
343
|
const requestName = 'Get Profile';
|
|
339
344
|
ExperienceApiClient_logger.info(`Sending "${requestName}" request`);
|
|
340
345
|
try {
|
|
341
|
-
const response = await this.fetch(this.constructUrl(`
|
|
346
|
+
const response = await this.fetch(this.constructUrl(`v3/spaces/${this.spaceId}/environments/${this.environment}/profiles/${id}`, options), {
|
|
342
347
|
method: 'GET'
|
|
343
348
|
});
|
|
344
|
-
const { data: { changes, experiences, profile } } = (0,
|
|
349
|
+
const { data: { changes, experiences, profile } } = (0, api_schemas_namespaceObject.parseWithFriendlyError)(api_schemas_namespaceObject.ExperienceResponse, await response.json());
|
|
345
350
|
const data = {
|
|
346
351
|
changes,
|
|
347
352
|
selectedOptimizations: experiences,
|
|
@@ -371,11 +376,11 @@ var __webpack_exports__ = {};
|
|
|
371
376
|
ExperienceApiClient_logger.debug(`"${requestName}" request body:`, body);
|
|
372
377
|
try {
|
|
373
378
|
const response = await this.makeProfileMutationRequest({
|
|
374
|
-
url: `
|
|
379
|
+
url: `v3/spaces/${this.spaceId}/environments/${this.environment}/profiles`,
|
|
375
380
|
body,
|
|
376
381
|
options
|
|
377
382
|
});
|
|
378
|
-
const { data: { changes, experiences, profile } } = (0,
|
|
383
|
+
const { data: { changes, experiences, profile } } = (0, api_schemas_namespaceObject.parseWithFriendlyError)(api_schemas_namespaceObject.ExperienceResponse, await response.json());
|
|
379
384
|
const data = {
|
|
380
385
|
changes,
|
|
381
386
|
selectedOptimizations: experiences,
|
|
@@ -398,11 +403,11 @@ var __webpack_exports__ = {};
|
|
|
398
403
|
ExperienceApiClient_logger.debug(`"${requestName}" request body:`, body);
|
|
399
404
|
try {
|
|
400
405
|
const response = await this.makeProfileMutationRequest({
|
|
401
|
-
url: `
|
|
406
|
+
url: `v3/spaces/${this.spaceId}/environments/${this.environment}/profiles/${profileId}`,
|
|
402
407
|
body,
|
|
403
408
|
options
|
|
404
409
|
});
|
|
405
|
-
const { data: { changes, experiences, profile } } = (0,
|
|
410
|
+
const { data: { changes, experiences, profile } } = (0, api_schemas_namespaceObject.parseWithFriendlyError)(api_schemas_namespaceObject.ExperienceResponse, await response.json());
|
|
406
411
|
const data = {
|
|
407
412
|
changes,
|
|
408
413
|
selectedOptimizations: experiences,
|
|
@@ -421,7 +426,7 @@ var __webpack_exports__ = {};
|
|
|
421
426
|
if (!profileId) return await this.createProfile({
|
|
422
427
|
events
|
|
423
428
|
}, options);
|
|
424
|
-
return await this.updateProfile({
|
|
429
|
+
else return await this.updateProfile({
|
|
425
430
|
profileId,
|
|
426
431
|
events
|
|
427
432
|
}, options);
|
|
@@ -429,21 +434,21 @@ var __webpack_exports__ = {};
|
|
|
429
434
|
async upsertManyProfiles({ events }, options = {}) {
|
|
430
435
|
const requestName = 'Upsert Many Profiles';
|
|
431
436
|
ExperienceApiClient_logger.info(`Sending "${requestName}" request`);
|
|
432
|
-
const body = (0,
|
|
437
|
+
const body = (0, api_schemas_namespaceObject.parseWithFriendlyError)(api_schemas_namespaceObject.BatchExperienceRequestData, {
|
|
433
438
|
events,
|
|
434
439
|
options: this.constructBodyOptions(options)
|
|
435
440
|
});
|
|
436
441
|
ExperienceApiClient_logger.debug(`"${requestName}" request body:`, body);
|
|
437
442
|
try {
|
|
438
443
|
const response = await this.makeProfileMutationRequest({
|
|
439
|
-
url: `
|
|
444
|
+
url: `v3/spaces/${this.spaceId}/environments/${this.environment}/events`,
|
|
440
445
|
body,
|
|
441
446
|
options: {
|
|
442
447
|
plainText: false,
|
|
443
448
|
...options
|
|
444
449
|
}
|
|
445
450
|
});
|
|
446
|
-
const { data: { profiles } } = (0,
|
|
451
|
+
const { data: { profiles } } = (0, api_schemas_namespaceObject.parseWithFriendlyError)(api_schemas_namespaceObject.BatchExperienceResponse, await response.json());
|
|
447
452
|
ExperienceApiClient_logger.debug(`"${requestName}" request successfully completed`);
|
|
448
453
|
return profiles;
|
|
449
454
|
} catch (error) {
|
|
@@ -478,8 +483,8 @@ var __webpack_exports__ = {};
|
|
|
478
483
|
return bodyOptions;
|
|
479
484
|
};
|
|
480
485
|
constructExperienceRequestBody(events, options) {
|
|
481
|
-
return
|
|
482
|
-
events: (0,
|
|
486
|
+
return api_schemas_namespaceObject.ExperienceRequestData.parse({
|
|
487
|
+
events: (0, api_schemas_namespaceObject.parseWithFriendlyError)(api_schemas_namespaceObject.ExperienceEventArray, events),
|
|
483
488
|
options: this.constructBodyOptions(options)
|
|
484
489
|
});
|
|
485
490
|
}
|
|
@@ -496,9 +501,9 @@ var __webpack_exports__ = {};
|
|
|
496
501
|
}
|
|
497
502
|
async sendBatchEvents(batches, options = {}) {
|
|
498
503
|
const { beacon } = options;
|
|
499
|
-
const url = new URL(`
|
|
504
|
+
const url = new URL(`v2/spaces/${this.spaceId}/environments/${this.environment}/events`, this.baseUrl);
|
|
500
505
|
const urlString = url.toString();
|
|
501
|
-
const body = (0,
|
|
506
|
+
const body = (0, api_schemas_namespaceObject.parseWithFriendlyError)(api_schemas_namespaceObject.BatchInsightsEventArray, batches);
|
|
502
507
|
const serializedBody = JSON.stringify(body);
|
|
503
508
|
if (beacon) {
|
|
504
509
|
InsightsApiClient_logger.debug('Queueing events via beacon');
|
|
@@ -537,9 +542,9 @@ var __webpack_exports__ = {};
|
|
|
537
542
|
experience;
|
|
538
543
|
insights;
|
|
539
544
|
constructor(config){
|
|
540
|
-
const { experience, insights,
|
|
545
|
+
const { experience, insights, spaceId, environment, fetchOptions } = config;
|
|
541
546
|
const apiConfig = {
|
|
542
|
-
|
|
547
|
+
spaceId,
|
|
543
548
|
environment,
|
|
544
549
|
fetchOptions
|
|
545
550
|
};
|
|
@@ -554,6 +559,9 @@ var __webpack_exports__ = {};
|
|
|
554
559
|
});
|
|
555
560
|
}
|
|
556
561
|
}
|
|
562
|
+
function isVariableChange(change) {
|
|
563
|
+
return 'Variable' === change.type;
|
|
564
|
+
}
|
|
557
565
|
})();
|
|
558
566
|
exports.ApiClient = __webpack_exports__.ApiClient;
|
|
559
567
|
exports.EXPERIENCE_BASE_URL = __webpack_exports__.EXPERIENCE_BASE_URL;
|
|
@@ -563,6 +571,7 @@ exports.InsightsApiClient = __webpack_exports__.InsightsApiClient;
|
|
|
563
571
|
exports.createProtectedFetchMethod = __webpack_exports__.createProtectedFetchMethod;
|
|
564
572
|
exports.createRetryFetchMethod = __webpack_exports__.createRetryFetchMethod;
|
|
565
573
|
exports.createTimeoutFetchMethod = __webpack_exports__.createTimeoutFetchMethod;
|
|
574
|
+
exports.isVariableChange = __webpack_exports__.isVariableChange;
|
|
566
575
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
567
576
|
"ApiClient",
|
|
568
577
|
"EXPERIENCE_BASE_URL",
|
|
@@ -571,7 +580,8 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
571
580
|
"InsightsApiClient",
|
|
572
581
|
"createProtectedFetchMethod",
|
|
573
582
|
"createRetryFetchMethod",
|
|
574
|
-
"createTimeoutFetchMethod"
|
|
583
|
+
"createTimeoutFetchMethod",
|
|
584
|
+
"isVariableChange"
|
|
575
585
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
576
586
|
Object.defineProperty(exports, '__esModule', {
|
|
577
587
|
value: true
|