@esri/telemetry-amazon 6.0.0-beta.1 → 6.0.0-beta.10
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 +7 -7
- package/dist/esm/auth.js +22 -31
- package/dist/esm/auth.js.map +1 -1
- package/dist/esm/create-event-log.js +15 -15
- package/dist/esm/create-event-log.js.map +1 -1
- package/dist/esm/create-event-log.test.js +50 -8
- package/dist/esm/create-event-log.test.js.map +1 -1
- package/dist/esm/create-page-view-log.js +0 -5
- package/dist/esm/create-page-view-log.js.map +1 -1
- package/dist/esm/format-telemetry-attributes.js +8 -4
- package/dist/esm/format-telemetry-attributes.js.map +1 -1
- package/dist/esm/index.js +41 -25
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.test.js +90 -16
- package/dist/esm/index.test.js.map +1 -1
- package/dist/esm/plugins/esri.js +346 -65
- package/dist/esm/plugins/esri.js.map +1 -1
- package/dist/esm/plugins/esri.test.js +498 -36
- package/dist/esm/plugins/esri.test.js.map +1 -1
- package/dist/esm/plugins/utils/browser.js +97 -0
- package/dist/esm/plugins/utils/browser.js.map +1 -0
- package/dist/esm/plugins/utils/browser.test.js +130 -0
- package/dist/esm/plugins/utils/browser.test.js.map +1 -0
- package/dist/esm/plugins/utils/os.js +140 -0
- package/dist/esm/plugins/utils/os.js.map +1 -0
- package/dist/esm/plugins/utils/os.test.js +54 -0
- package/dist/esm/plugins/utils/os.test.js.map +1 -0
- package/dist/esm/plugins/{shared.js → utils/shared.js} +1 -1
- package/dist/esm/plugins/utils/shared.js.map +1 -0
- package/dist/esm/types.js +97 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/node/auth.js +22 -31
- package/dist/node/auth.js.map +1 -1
- package/dist/node/create-event-log.js +15 -15
- package/dist/node/create-event-log.js.map +1 -1
- package/dist/node/create-event-log.test.js +50 -8
- package/dist/node/create-event-log.test.js.map +1 -1
- package/dist/node/create-page-view-log.js +0 -5
- package/dist/node/create-page-view-log.js.map +1 -1
- package/dist/node/format-telemetry-attributes.js +8 -4
- package/dist/node/format-telemetry-attributes.js.map +1 -1
- package/dist/node/index.js +42 -25
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.test.js +91 -16
- package/dist/node/index.test.js.map +1 -1
- package/dist/node/plugins/esri.js +346 -65
- package/dist/node/plugins/esri.js.map +1 -1
- package/dist/node/plugins/esri.test.js +499 -36
- package/dist/node/plugins/esri.test.js.map +1 -1
- package/dist/node/plugins/utils/browser.js +101 -0
- package/dist/node/plugins/utils/browser.js.map +1 -0
- package/dist/node/plugins/utils/browser.test.js +132 -0
- package/dist/node/plugins/utils/browser.test.js.map +1 -0
- package/dist/node/plugins/utils/os.js +144 -0
- package/dist/node/plugins/utils/os.js.map +1 -0
- package/dist/node/plugins/utils/os.test.js +56 -0
- package/dist/node/plugins/utils/os.test.js.map +1 -0
- package/dist/node/plugins/{shared.js → utils/shared.js} +3 -2
- package/dist/node/plugins/utils/shared.js.map +1 -0
- package/dist/node/types.js +98 -0
- package/dist/node/types.js.map +1 -1
- package/dist/types/create-event-log.d.ts +2 -2
- package/dist/types/format-telemetry-attributes.d.ts +3 -3
- package/dist/types/index.d.ts +7 -3
- package/dist/types/plugins/esri.d.ts +5 -9
- package/dist/types/plugins/utils/browser.d.ts +12 -0
- package/dist/types/plugins/utils/browser.test.d.ts +1 -0
- package/dist/types/plugins/utils/os.d.ts +5 -0
- package/dist/types/plugins/utils/os.test.d.ts +1 -0
- package/dist/types/plugins/{shared.d.ts → utils/shared.d.ts} +1 -0
- package/dist/types/types.d.ts +108 -18
- package/dist/umd/telemetry-amazon.js +915 -368
- package/dist/umd/telemetry-amazon.js.map +1 -1
- package/dist/umd/telemetry-amazon.min.js +915 -368
- package/dist/umd/telemetry-amazon.min.js.map +1 -1
- package/package.json +4 -2
- package/dist/esm/plugins/pinpoint.js +0 -163
- package/dist/esm/plugins/pinpoint.js.map +0 -1
- package/dist/esm/plugins/shared.js.map +0 -1
- package/dist/node/plugins/pinpoint.js +0 -167
- package/dist/node/plugins/pinpoint.js.map +0 -1
- package/dist/node/plugins/shared.js.map +0 -1
- package/dist/types/plugins/pinpoint.d.ts +0 -11
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BrowserOSInfo } from './os';
|
|
2
|
+
export declare type BrowserClientInfo = {
|
|
3
|
+
language?: string;
|
|
4
|
+
make?: string;
|
|
5
|
+
model?: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
timezone?: string;
|
|
9
|
+
platform?: string;
|
|
10
|
+
os?: BrowserOSInfo;
|
|
11
|
+
};
|
|
12
|
+
export declare function getBrowserClientInfo(): BrowserClientInfo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ArcGISIdentityManager } from '@esri/arcgis-rest-request';
|
|
2
|
+
import type { AnalyticsInstance } from 'analytics';
|
|
3
|
+
import { getBrowserClientInfo } from './plugins/utils/shared';
|
|
2
4
|
export declare type GenericObject = {
|
|
3
5
|
[key: string]: any;
|
|
4
6
|
};
|
|
@@ -17,10 +19,14 @@ export interface IAccessChangeset {
|
|
|
17
19
|
ids?: string[];
|
|
18
20
|
}
|
|
19
21
|
export interface AmazonTracker {
|
|
20
|
-
track(eventName: string, payload: Record<string, any
|
|
22
|
+
track(eventName: string, payload: Record<string, any>, options?: {
|
|
23
|
+
immediate?: boolean;
|
|
24
|
+
}): boolean | void | Promise<any>;
|
|
21
25
|
}
|
|
26
|
+
export declare type AmazonAnalytics = AmazonTracker | AnalyticsInstance;
|
|
22
27
|
export interface IAmazon<D, M> {
|
|
23
|
-
analytics:
|
|
28
|
+
analytics: AmazonAnalytics;
|
|
29
|
+
/** `name` is the core telemetry property mapped to `EventType` in telemetry-amazon */
|
|
24
30
|
name: string;
|
|
25
31
|
previousPage: {
|
|
26
32
|
pageUrl?: string;
|
|
@@ -31,18 +37,10 @@ export interface IAmazon<D, M> {
|
|
|
31
37
|
metrics: M;
|
|
32
38
|
init(): Promise<void>;
|
|
33
39
|
logPageView: (page: string, options?: PageViewOptions) => boolean;
|
|
34
|
-
logEvent: (event?: EventOptions) => boolean;
|
|
40
|
+
logEvent: (event?: EventOptions, trackOptions?: EventTrackOptions) => boolean;
|
|
35
41
|
}
|
|
36
|
-
export declare type
|
|
37
|
-
|
|
38
|
-
export declare type PageViewOptions = GenericObject;
|
|
39
|
-
export declare type EventOptions = GenericObject;
|
|
40
|
-
export declare type EventData = {
|
|
41
|
-
category?: string;
|
|
42
|
-
action?: string;
|
|
43
|
-
label?: string;
|
|
44
|
-
pathname?: string;
|
|
45
|
-
eventType?: string;
|
|
42
|
+
export declare type EventTrackOptions = {
|
|
43
|
+
immediate?: boolean;
|
|
46
44
|
};
|
|
47
45
|
export declare type AmazonApp = {
|
|
48
46
|
name?: string;
|
|
@@ -53,14 +51,16 @@ export declare type AmazonTelemetryOptions = {
|
|
|
53
51
|
userPoolID: string;
|
|
54
52
|
app?: AmazonApp;
|
|
55
53
|
fips?: boolean;
|
|
54
|
+
dimensions?: Dimensions;
|
|
55
|
+
metrics?: Metrics;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated Pinpoint is retiring on October 31, 2026. After this date all traffic will be routed to the `esri` mode.
|
|
58
|
+
* This property should not be used except for regression testing events being logged via pinpoint vs. the updated endpoint
|
|
59
|
+
* during integration.
|
|
60
|
+
*/
|
|
56
61
|
mode?: AmazonTelemetryEndpointMode;
|
|
57
|
-
endpoint?: AmazonTelemetryEndpointOptions;
|
|
58
62
|
};
|
|
59
63
|
export declare type AmazonTelemetryEndpointMode = 'pinpoint' | 'esri';
|
|
60
|
-
export declare type AmazonTelemetryEndpointOptions = {
|
|
61
|
-
url?: string;
|
|
62
|
-
headers?: Record<string, string>;
|
|
63
|
-
};
|
|
64
64
|
export declare type LogPageViewPayload = {
|
|
65
65
|
name: string;
|
|
66
66
|
referrer: string;
|
|
@@ -79,4 +79,94 @@ export declare type LogEventPayload = {
|
|
|
79
79
|
hostname?: string;
|
|
80
80
|
path?: string;
|
|
81
81
|
};
|
|
82
|
+
/** Dimensions, Metrics are defined with 20 fields each in the DB schema */
|
|
83
|
+
declare type AmazonFieldIndex = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20;
|
|
84
|
+
declare type AmazonDimensionKey = `dimension${AmazonFieldIndex}`;
|
|
85
|
+
declare type AmazonMetricKey = `metric${AmazonFieldIndex}`;
|
|
86
|
+
export declare const AMAZON_EVENT_METRIC_KEYS: readonly ["count", "duration", "number", "position", "size", "metric1", "metric2", "metric3", "metric4", "metric5", "metric6", "metric7", "metric8", "metric9", "metric10", "metric11", "metric12", "metric13", "metric14", "metric15", "metric16", "metric17", "metric18", "metric19", "metric20"];
|
|
87
|
+
declare type AmazonEventMetrics = typeof AMAZON_EVENT_METRIC_KEYS[number];
|
|
88
|
+
export declare type EventMetrics = Partial<Record<AmazonEventMetrics, number>>;
|
|
89
|
+
export declare const AMAZON_EVENT_ATTRIBUTE_KEYS: readonly ["action", "attribute", "category", "datasetId", "details", "error", "facetValue", "hostname", "json", "label", "lastLogin", "objectId", "org", "pageUrl", "path", "pageName", "previousPageName", "previousPageUrl", "referrer", "searchQuery", "serviceQuery", "statusCode", "user", "userSince", "urlRequested", "internalUser", "accountType", "workflowId", "browserWebCapabilities", "dimension1", "dimension2", "dimension3", "dimension4", "dimension5", "dimension6", "dimension7", "dimension8", "dimension9", "dimension10", "dimension11", "dimension12", "dimension13", "dimension14", "dimension15", "dimension16", "dimension17", "dimension18", "dimension19", "dimension20", "eventType", "pathname"];
|
|
90
|
+
export declare type AmazonEventAttribute = typeof AMAZON_EVENT_ATTRIBUTE_KEYS[number];
|
|
91
|
+
export declare type EventAttributes = Partial<Record<AmazonEventAttribute, string>>;
|
|
92
|
+
export declare type Dimensions = Partial<Record<AmazonDimensionKey, string>>;
|
|
93
|
+
export declare type Metrics = Partial<Record<AmazonMetricKey, number>>;
|
|
94
|
+
export declare type PageViewOptions = GenericObject;
|
|
95
|
+
export declare type EventOptions = GenericObject;
|
|
96
|
+
export declare type EsriBatchEventPayload = {
|
|
97
|
+
name?: string;
|
|
98
|
+
appTitle?: string;
|
|
99
|
+
appVersion?: string;
|
|
100
|
+
clientSdkVersion?: string;
|
|
101
|
+
deviceMake?: string;
|
|
102
|
+
deviceModel?: string;
|
|
103
|
+
city?: string;
|
|
104
|
+
country?: string;
|
|
105
|
+
lat?: string | number;
|
|
106
|
+
lon?: string | number;
|
|
107
|
+
[key: string]: any;
|
|
108
|
+
};
|
|
109
|
+
export declare type EsriBatchEvent = {
|
|
110
|
+
BatchEvent: {
|
|
111
|
+
Endpoint: {
|
|
112
|
+
Id: string;
|
|
113
|
+
Device: {
|
|
114
|
+
Locale: string;
|
|
115
|
+
Make: string;
|
|
116
|
+
Model: string;
|
|
117
|
+
ModelVersion: string;
|
|
118
|
+
Platform: string;
|
|
119
|
+
PlatformVersion?: string;
|
|
120
|
+
};
|
|
121
|
+
Location: Partial<{
|
|
122
|
+
City: string;
|
|
123
|
+
Country: string;
|
|
124
|
+
Lat: number;
|
|
125
|
+
Lon: number;
|
|
126
|
+
}>;
|
|
127
|
+
Application: {
|
|
128
|
+
AppTitle: string;
|
|
129
|
+
AppVersion: string | undefined;
|
|
130
|
+
ClientSdkVersion: string;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
Events: Array<{
|
|
134
|
+
EventType: string;
|
|
135
|
+
Timestamp: string;
|
|
136
|
+
Session: {
|
|
137
|
+
Id: string;
|
|
138
|
+
StartTimestamp: string;
|
|
139
|
+
EndTimestamp: string;
|
|
140
|
+
Duration: number;
|
|
141
|
+
};
|
|
142
|
+
Attributes: EventAttributes;
|
|
143
|
+
Metrics: EventMetrics;
|
|
144
|
+
}>;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export declare type SessionContext = {
|
|
148
|
+
id: string;
|
|
149
|
+
startTimestamp: string;
|
|
150
|
+
startUnixMs: number;
|
|
151
|
+
};
|
|
152
|
+
export declare type TrackOptions = {
|
|
153
|
+
immediate?: boolean;
|
|
154
|
+
};
|
|
155
|
+
export declare type QueuedEvent = {
|
|
156
|
+
eventName: string;
|
|
157
|
+
payload: EsriBatchEventPayload;
|
|
158
|
+
session?: SessionContext;
|
|
159
|
+
browserInfo?: ReturnType<typeof getBrowserClientInfo>;
|
|
160
|
+
timestamp: string;
|
|
161
|
+
unixMs: number;
|
|
162
|
+
};
|
|
163
|
+
export declare type EsriPluginOptions = {
|
|
164
|
+
trackerName: string;
|
|
165
|
+
appId: string;
|
|
166
|
+
appName?: string;
|
|
167
|
+
appVersion?: string;
|
|
168
|
+
userPoolID?: string;
|
|
169
|
+
fips?: boolean;
|
|
170
|
+
debounceMs?: number;
|
|
171
|
+
};
|
|
82
172
|
export {};
|