@@ -52,57 +52,6 @@ export type Telemetry = string | (string | object)[];
52
52
53
53
export type PageIdFormat = 'PATH' | 'HASH' | 'PATH_AND_HASH' ;
54
54
55
- export type PartialCookieAttributes = {
56
- unique ?: boolean ;
57
- domain ?: string ;
58
- path ?: string ;
59
- sameSite ?: string ;
60
- secure ?: boolean ;
61
- } ;
62
-
63
- export type PartialConfig = {
64
- allowCookies ?: boolean ;
65
- batchLimit ?: number ;
66
- client ?: string ;
67
- clientBuilder ?: ClientBuilder ;
68
- cookieAttributes ?: PartialCookieAttributes ;
69
- disableAutoPageView ?: boolean ;
70
- dispatchInterval ?: number ;
71
- enableRumClient ?: boolean ;
72
- enableXRay ?: boolean ;
73
- endpoint ?: string ;
74
- eventCacheSize ?: number ;
75
- eventPluginsToLoad ?: Plugin [ ] ;
76
- guestRoleArn ?: string ;
77
- identityPoolId ?: string ;
78
- pageIdFormat ?: PageIdFormat ;
79
- pagesToExclude ?: RegExp [ ] ;
80
- pagesToInclude ?: RegExp [ ] ;
81
- signing ?: boolean ;
82
- recordResourceUrl ?: boolean ;
83
- routeChangeComplete ?: number ;
84
- routeChangeTimeout ?: number ;
85
- sessionAttributes ?: { [ k : string ] : string | number | boolean } ;
86
- sessionEventLimit ?: number ;
87
- sessionLengthSeconds ?: number ;
88
- sessionSampleRate ?: number ;
89
- /**
90
- * Application owners think about data collection in terms of the categories
91
- * of data being collected. For example, JavaScript errors, page load
92
- * performance, user journeys and user interactions are data collection
93
- * categories. However, there is not a 1-1 mapping between data collection
94
- * categories and plugins.
95
- *
96
- * This configuration option allows application owners to define the data
97
- * categories they want to collect without needing to understand and
98
- * instantiate each plugin themselves. The toolkit will instantiate the
99
- * plugins which map to the selected categories.
100
- */
101
- telemetries ?: Telemetry [ ] ;
102
- useBeacon ?: boolean ;
103
- userIdRetentionDays ?: number ;
104
- } ;
105
-
106
55
export const defaultCookieAttributes = ( ) : CookieAttributes => {
107
56
return {
108
57
unique : false ,
@@ -153,7 +102,9 @@ export type CookieAttributes = {
153
102
secure : boolean ;
154
103
} ;
155
104
156
- export type Config = {
105
+ export type PartialCookieAttributes = Partial < CookieAttributes > ;
106
+
107
+ export interface Config {
157
108
allowCookies : boolean ;
158
109
batchLimit : number ;
159
110
client : string ;
@@ -190,10 +141,27 @@ export type Config = {
190
141
sessionEventLimit : number ;
191
142
sessionLengthSeconds : number ;
192
143
sessionSampleRate : number ;
144
+ /**
145
+ * Application owners think about data collection in terms of the categories
146
+ * of data being collected. For example, JavaScript errors, page load
147
+ * performance, user journeys and user interactions are data collection
148
+ * categories. However, there is not a 1-1 mapping between data collection
149
+ * categories and plugins.
150
+ *
151
+ * This configuration option allows application owners to define the data
152
+ * categories they want to collect without needing to understand and
153
+ * instantiate each plugin themselves. The toolkit will instantiate the
154
+ * plugins which map to the selected categories.
155
+ */
193
156
telemetries : Telemetry [ ] ;
194
157
useBeacon : boolean ;
195
158
userIdRetentionDays : number ;
196
- } ;
159
+ }
160
+
161
+ export interface PartialConfig
162
+ extends Omit < Partial < Config > , 'cookieAttributes' > {
163
+ cookieAttributes ?: PartialCookieAttributes ;
164
+ }
197
165
198
166
/**
199
167
* An orchestrator which (1) initializes cwr components and (2) provides the API for the application to interact
0 commit comments