@contentful/optimization-api-client 2.0.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 +71 -13
- package/dist/api-schemas.cjs +6 -2
- package/dist/api-schemas.cjs.map +1 -1
- package/dist/api-schemas.d.cts +60 -4
- package/dist/api-schemas.d.mts +60 -4
- package/dist/api-schemas.d.ts +60 -4
- package/dist/api-schemas.mjs +6 -2
- package/dist/api-schemas.mjs.map +1 -1
- package/dist/index.cjs +7 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -2
- package/dist/index.d.mts +92 -2
- package/dist/index.d.ts +92 -2
- package/dist/index.mjs +7 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -352,6 +352,7 @@ declare const BatchExperienceEventArray: z.ZodMiniArray<z.ZodMiniDiscriminatedUn
|
|
|
352
352
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
353
353
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
354
354
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
355
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
355
356
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
356
357
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
357
358
|
type: z.ZodMiniLiteral<"exo_node_view">;
|
|
@@ -921,6 +922,7 @@ declare const BatchInsightsEventArray: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
921
922
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
922
923
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
923
924
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
925
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
924
926
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
925
927
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
926
928
|
type: z.ZodMiniLiteral<"exo_node_view">;
|
|
@@ -992,6 +994,7 @@ declare const BatchInsightsEventArray: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
992
994
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
993
995
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
994
996
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
997
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
995
998
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
996
999
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
997
1000
|
type: z.ZodMiniLiteral<"exo_node_click">;
|
|
@@ -1061,6 +1064,7 @@ declare const BatchInsightsEventArray: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
1061
1064
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1062
1065
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
1063
1066
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1067
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1064
1068
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1065
1069
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
1066
1070
|
type: z.ZodMiniLiteral<"exo_node_hover">;
|
|
@@ -1289,6 +1293,7 @@ export declare class ExperienceApiClient extends ApiClientBase {
|
|
|
1289
1293
|
private readonly enabledFeatures?;
|
|
1290
1294
|
private readonly ip?;
|
|
1291
1295
|
private locale?;
|
|
1296
|
+
private readonly location?;
|
|
1292
1297
|
private readonly plainText?;
|
|
1293
1298
|
private readonly preflight?;
|
|
1294
1299
|
/**
|
|
@@ -1309,7 +1314,8 @@ export declare class ExperienceApiClient extends ApiClientBase {
|
|
|
1309
1314
|
* Retrieves a profile by ID.
|
|
1310
1315
|
*
|
|
1311
1316
|
* @param id - The profile ID to retrieve.
|
|
1312
|
-
* @param options - Optional request options. `preflight
|
|
1317
|
+
* @param options - Optional request options. `location`, `preflight`, and `plainText`
|
|
1318
|
+
* are not allowed here.
|
|
1313
1319
|
* @returns The current optimization data for the profile.
|
|
1314
1320
|
*
|
|
1315
1321
|
* @throws Error
|
|
@@ -1322,7 +1328,7 @@ export declare class ExperienceApiClient extends ApiClientBase {
|
|
|
1322
1328
|
* })
|
|
1323
1329
|
* ```
|
|
1324
1330
|
*/
|
|
1325
|
-
getProfile(id: string, options?: Omit<ExperienceApiClientRequestOptions, 'preflight' | 'plainText'>): Promise<OptimizationData>;
|
|
1331
|
+
getProfile(id: string, options?: Omit<ExperienceApiClientRequestOptions, 'location' | 'preflight' | 'plainText'>): Promise<OptimizationData>;
|
|
1326
1332
|
/**
|
|
1327
1333
|
* Sends a POST request to mutate a profile or profiles.
|
|
1328
1334
|
*
|
|
@@ -1488,6 +1494,19 @@ export declare interface ExperienceApiClientRequestOptions {
|
|
|
1488
1494
|
* When omitted, the API can use a server-side default.
|
|
1489
1495
|
*/
|
|
1490
1496
|
locale?: string;
|
|
1497
|
+
/**
|
|
1498
|
+
* Request location for `createProfile()`, `updateProfile()`, and `upsertProfile()`.
|
|
1499
|
+
*
|
|
1500
|
+
* @remarks
|
|
1501
|
+
* A per-request value replaces the constructor default as a whole object.
|
|
1502
|
+
* The API merges each event's `context.location` over this request location.
|
|
1503
|
+
* An explicit `{}` overrides the constructor default and supplies an empty
|
|
1504
|
+
* request-location default instead of Cloudflare geolocation. When omitted
|
|
1505
|
+
* from both sources, existing API fallback behavior applies.
|
|
1506
|
+
* This affects evaluation and profile updates; it is not a permanent location lock.
|
|
1507
|
+
* For `upsertManyProfiles()`, use each event's `context.location` instead.
|
|
1508
|
+
*/
|
|
1509
|
+
location?: GeoLocation;
|
|
1491
1510
|
/**
|
|
1492
1511
|
* When `true`, sends performance-critical endpoints in plain text.
|
|
1493
1512
|
*
|
|
@@ -1737,6 +1756,7 @@ declare const ExperienceEventArray: z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[
|
|
|
1737
1756
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1738
1757
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
1739
1758
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1759
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1740
1760
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1741
1761
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
1742
1762
|
type: z.ZodMiniLiteral<"exo_node_view">;
|
|
@@ -2032,6 +2052,76 @@ export declare interface FetchMethodCallbackOptions {
|
|
|
2032
2052
|
retriesLeft?: number;
|
|
2033
2053
|
}
|
|
2034
2054
|
|
|
2055
|
+
/**
|
|
2056
|
+
* Zod schema describing geo-location properties for an event or singular profile request.
|
|
2057
|
+
*
|
|
2058
|
+
* @remarks
|
|
2059
|
+
* All properties are optional and can be derived from IP or device data.
|
|
2060
|
+
*
|
|
2061
|
+
* @public
|
|
2062
|
+
*/
|
|
2063
|
+
declare const GeoLocation: z.ZodMiniObject<{
|
|
2064
|
+
/**
|
|
2065
|
+
* Geographical coordinates for the location.
|
|
2066
|
+
*/
|
|
2067
|
+
coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
2068
|
+
/**
|
|
2069
|
+
* Latitude component of the coordinates.
|
|
2070
|
+
*/
|
|
2071
|
+
latitude: z.ZodMiniNumber<number>;
|
|
2072
|
+
/**
|
|
2073
|
+
* Longitude component of the coordinates.
|
|
2074
|
+
*/
|
|
2075
|
+
longitude: z.ZodMiniNumber<number>;
|
|
2076
|
+
}, z.core.$strip>>;
|
|
2077
|
+
/**
|
|
2078
|
+
* City name associated with the location.
|
|
2079
|
+
*/
|
|
2080
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2081
|
+
/**
|
|
2082
|
+
* Postal or ZIP code associated with the location.
|
|
2083
|
+
*/
|
|
2084
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2085
|
+
/**
|
|
2086
|
+
* Region or state name associated with the location.
|
|
2087
|
+
*/
|
|
2088
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2089
|
+
/**
|
|
2090
|
+
* Region or state code associated with the location.
|
|
2091
|
+
*/
|
|
2092
|
+
regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Country name associated with the location.
|
|
2095
|
+
*/
|
|
2096
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2097
|
+
/**
|
|
2098
|
+
* Country code associated with the location.
|
|
2099
|
+
*
|
|
2100
|
+
* @remarks
|
|
2101
|
+
* Validated to exactly COUNTRY_CODE_LENGTH characters, typically
|
|
2102
|
+
* an ISO 3166-1 alpha-2 code.
|
|
2103
|
+
*/
|
|
2104
|
+
countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2105
|
+
/**
|
|
2106
|
+
* Continent name associated with the location.
|
|
2107
|
+
*/
|
|
2108
|
+
continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2109
|
+
/**
|
|
2110
|
+
* Time zone identifier associated with the location.
|
|
2111
|
+
*
|
|
2112
|
+
* @remarks
|
|
2113
|
+
* Typically an IANA time zone string (e.g., `"Europe/Berlin"`).
|
|
2114
|
+
*/
|
|
2115
|
+
timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2116
|
+
}, z.core.$strip>;
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* TypeScript type inferred from {@link GeoLocation}.
|
|
2120
|
+
*
|
|
2121
|
+
* @public
|
|
2122
|
+
*/
|
|
2123
|
+
declare type GeoLocation = z.infer<typeof GeoLocation>;
|
|
2124
|
+
|
|
2035
2125
|
/**
|
|
2036
2126
|
* Properties that can be shared between global and per-client API configuration.
|
|
2037
2127
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -352,6 +352,7 @@ declare const BatchExperienceEventArray: z.ZodMiniArray<z.ZodMiniDiscriminatedUn
|
|
|
352
352
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
353
353
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
354
354
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
355
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
355
356
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
356
357
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
357
358
|
type: z.ZodMiniLiteral<"exo_node_view">;
|
|
@@ -921,6 +922,7 @@ declare const BatchInsightsEventArray: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
921
922
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
922
923
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
923
924
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
925
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
924
926
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
925
927
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
926
928
|
type: z.ZodMiniLiteral<"exo_node_view">;
|
|
@@ -992,6 +994,7 @@ declare const BatchInsightsEventArray: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
992
994
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
993
995
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
994
996
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
997
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
995
998
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
996
999
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
997
1000
|
type: z.ZodMiniLiteral<"exo_node_click">;
|
|
@@ -1061,6 +1064,7 @@ declare const BatchInsightsEventArray: z.ZodMiniArray<z.ZodMiniObject<{
|
|
|
1061
1064
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1062
1065
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
1063
1066
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1067
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1064
1068
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1065
1069
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
1066
1070
|
type: z.ZodMiniLiteral<"exo_node_hover">;
|
|
@@ -1289,6 +1293,7 @@ export declare class ExperienceApiClient extends ApiClientBase {
|
|
|
1289
1293
|
private readonly enabledFeatures?;
|
|
1290
1294
|
private readonly ip?;
|
|
1291
1295
|
private locale?;
|
|
1296
|
+
private readonly location?;
|
|
1292
1297
|
private readonly plainText?;
|
|
1293
1298
|
private readonly preflight?;
|
|
1294
1299
|
/**
|
|
@@ -1309,7 +1314,8 @@ export declare class ExperienceApiClient extends ApiClientBase {
|
|
|
1309
1314
|
* Retrieves a profile by ID.
|
|
1310
1315
|
*
|
|
1311
1316
|
* @param id - The profile ID to retrieve.
|
|
1312
|
-
* @param options - Optional request options. `preflight
|
|
1317
|
+
* @param options - Optional request options. `location`, `preflight`, and `plainText`
|
|
1318
|
+
* are not allowed here.
|
|
1313
1319
|
* @returns The current optimization data for the profile.
|
|
1314
1320
|
*
|
|
1315
1321
|
* @throws Error
|
|
@@ -1322,7 +1328,7 @@ export declare class ExperienceApiClient extends ApiClientBase {
|
|
|
1322
1328
|
* })
|
|
1323
1329
|
* ```
|
|
1324
1330
|
*/
|
|
1325
|
-
getProfile(id: string, options?: Omit<ExperienceApiClientRequestOptions, 'preflight' | 'plainText'>): Promise<OptimizationData>;
|
|
1331
|
+
getProfile(id: string, options?: Omit<ExperienceApiClientRequestOptions, 'location' | 'preflight' | 'plainText'>): Promise<OptimizationData>;
|
|
1326
1332
|
/**
|
|
1327
1333
|
* Sends a POST request to mutate a profile or profiles.
|
|
1328
1334
|
*
|
|
@@ -1488,6 +1494,19 @@ export declare interface ExperienceApiClientRequestOptions {
|
|
|
1488
1494
|
* When omitted, the API can use a server-side default.
|
|
1489
1495
|
*/
|
|
1490
1496
|
locale?: string;
|
|
1497
|
+
/**
|
|
1498
|
+
* Request location for `createProfile()`, `updateProfile()`, and `upsertProfile()`.
|
|
1499
|
+
*
|
|
1500
|
+
* @remarks
|
|
1501
|
+
* A per-request value replaces the constructor default as a whole object.
|
|
1502
|
+
* The API merges each event's `context.location` over this request location.
|
|
1503
|
+
* An explicit `{}` overrides the constructor default and supplies an empty
|
|
1504
|
+
* request-location default instead of Cloudflare geolocation. When omitted
|
|
1505
|
+
* from both sources, existing API fallback behavior applies.
|
|
1506
|
+
* This affects evaluation and profile updates; it is not a permanent location lock.
|
|
1507
|
+
* For `upsertManyProfiles()`, use each event's `context.location` instead.
|
|
1508
|
+
*/
|
|
1509
|
+
location?: GeoLocation;
|
|
1491
1510
|
/**
|
|
1492
1511
|
* When `true`, sends performance-critical endpoints in plain text.
|
|
1493
1512
|
*
|
|
@@ -1737,6 +1756,7 @@ declare const ExperienceEventArray: z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[
|
|
|
1737
1756
|
optimizationId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1738
1757
|
parameters: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniJSONSchema>>;
|
|
1739
1758
|
parentExperienceId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1759
|
+
parentVariantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1740
1760
|
variantId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
1741
1761
|
variantIndex: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
1742
1762
|
type: z.ZodMiniLiteral<"exo_node_view">;
|
|
@@ -2032,6 +2052,76 @@ export declare interface FetchMethodCallbackOptions {
|
|
|
2032
2052
|
retriesLeft?: number;
|
|
2033
2053
|
}
|
|
2034
2054
|
|
|
2055
|
+
/**
|
|
2056
|
+
* Zod schema describing geo-location properties for an event or singular profile request.
|
|
2057
|
+
*
|
|
2058
|
+
* @remarks
|
|
2059
|
+
* All properties are optional and can be derived from IP or device data.
|
|
2060
|
+
*
|
|
2061
|
+
* @public
|
|
2062
|
+
*/
|
|
2063
|
+
declare const GeoLocation: z.ZodMiniObject<{
|
|
2064
|
+
/**
|
|
2065
|
+
* Geographical coordinates for the location.
|
|
2066
|
+
*/
|
|
2067
|
+
coordinates: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
2068
|
+
/**
|
|
2069
|
+
* Latitude component of the coordinates.
|
|
2070
|
+
*/
|
|
2071
|
+
latitude: z.ZodMiniNumber<number>;
|
|
2072
|
+
/**
|
|
2073
|
+
* Longitude component of the coordinates.
|
|
2074
|
+
*/
|
|
2075
|
+
longitude: z.ZodMiniNumber<number>;
|
|
2076
|
+
}, z.core.$strip>>;
|
|
2077
|
+
/**
|
|
2078
|
+
* City name associated with the location.
|
|
2079
|
+
*/
|
|
2080
|
+
city: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2081
|
+
/**
|
|
2082
|
+
* Postal or ZIP code associated with the location.
|
|
2083
|
+
*/
|
|
2084
|
+
postalCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2085
|
+
/**
|
|
2086
|
+
* Region or state name associated with the location.
|
|
2087
|
+
*/
|
|
2088
|
+
region: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2089
|
+
/**
|
|
2090
|
+
* Region or state code associated with the location.
|
|
2091
|
+
*/
|
|
2092
|
+
regionCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2093
|
+
/**
|
|
2094
|
+
* Country name associated with the location.
|
|
2095
|
+
*/
|
|
2096
|
+
country: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2097
|
+
/**
|
|
2098
|
+
* Country code associated with the location.
|
|
2099
|
+
*
|
|
2100
|
+
* @remarks
|
|
2101
|
+
* Validated to exactly COUNTRY_CODE_LENGTH characters, typically
|
|
2102
|
+
* an ISO 3166-1 alpha-2 code.
|
|
2103
|
+
*/
|
|
2104
|
+
countryCode: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2105
|
+
/**
|
|
2106
|
+
* Continent name associated with the location.
|
|
2107
|
+
*/
|
|
2108
|
+
continent: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2109
|
+
/**
|
|
2110
|
+
* Time zone identifier associated with the location.
|
|
2111
|
+
*
|
|
2112
|
+
* @remarks
|
|
2113
|
+
* Typically an IANA time zone string (e.g., `"Europe/Berlin"`).
|
|
2114
|
+
*/
|
|
2115
|
+
timezone: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
2116
|
+
}, z.core.$strip>;
|
|
2117
|
+
|
|
2118
|
+
/**
|
|
2119
|
+
* TypeScript type inferred from {@link GeoLocation}.
|
|
2120
|
+
*
|
|
2121
|
+
* @public
|
|
2122
|
+
*/
|
|
2123
|
+
declare type GeoLocation = z.infer<typeof GeoLocation>;
|
|
2124
|
+
|
|
2035
2125
|
/**
|
|
2036
2126
|
* Properties that can be shared between global and per-client API configuration.
|
|
2037
2127
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -159,15 +159,17 @@ class ExperienceApiClient extends src_ApiClientBase {
|
|
|
159
159
|
enabledFeatures;
|
|
160
160
|
ip;
|
|
161
161
|
locale;
|
|
162
|
+
location;
|
|
162
163
|
plainText;
|
|
163
164
|
preflight;
|
|
164
165
|
constructor(config){
|
|
165
166
|
super('Experience', config);
|
|
166
|
-
const { baseUrl, enabledFeatures, ip, locale, plainText, preflight } = config;
|
|
167
|
+
const { baseUrl, enabledFeatures, ip, locale, location, plainText, preflight } = config;
|
|
167
168
|
this.baseUrl = baseUrl || EXPERIENCE_BASE_URL;
|
|
168
169
|
this.enabledFeatures = enabledFeatures;
|
|
169
170
|
this.ip = ip;
|
|
170
171
|
this.locale = locale;
|
|
172
|
+
this.location = location;
|
|
171
173
|
this.plainText = plainText;
|
|
172
174
|
this.preflight = preflight;
|
|
173
175
|
}
|
|
@@ -319,9 +321,12 @@ class ExperienceApiClient extends src_ApiClientBase {
|
|
|
319
321
|
return bodyOptions;
|
|
320
322
|
};
|
|
321
323
|
constructExperienceRequestBody(events, options) {
|
|
324
|
+
const bodyOptions = this.constructBodyOptions(options);
|
|
325
|
+
const location = options.location ?? this.location;
|
|
326
|
+
if (void 0 !== location) bodyOptions.location = location;
|
|
322
327
|
return ExperienceRequestData.parse({
|
|
323
328
|
events: parseWithFriendlyError(ExperienceEventArray, events),
|
|
324
|
-
options:
|
|
329
|
+
options: bodyOptions
|
|
325
330
|
});
|
|
326
331
|
}
|
|
327
332
|
}
|