@amplitude/analytics-browser 0.3.1 → 0.5.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.
Files changed (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -1
  3. package/lib/cjs/attribution.d.ts +1 -1
  4. package/lib/cjs/attribution.d.ts.map +1 -1
  5. package/lib/cjs/attribution.js +5 -17
  6. package/lib/cjs/attribution.js.map +1 -1
  7. package/lib/cjs/browser-client.d.ts +108 -82
  8. package/lib/cjs/browser-client.d.ts.map +1 -1
  9. package/lib/cjs/browser-client.js +208 -196
  10. package/lib/cjs/browser-client.js.map +1 -1
  11. package/lib/cjs/config.d.ts +16 -8
  12. package/lib/cjs/config.d.ts.map +1 -1
  13. package/lib/cjs/config.js +41 -39
  14. package/lib/cjs/config.js.map +1 -1
  15. package/lib/cjs/cookie-migration/index.d.ts +5 -0
  16. package/lib/cjs/cookie-migration/index.d.ts.map +1 -0
  17. package/lib/cjs/cookie-migration/index.js +55 -0
  18. package/lib/cjs/cookie-migration/index.js.map +1 -0
  19. package/lib/cjs/plugins/context.d.ts.map +1 -1
  20. package/lib/cjs/plugins/context.js +3 -3
  21. package/lib/cjs/plugins/context.js.map +1 -1
  22. package/lib/cjs/session-manager.d.ts +3 -3
  23. package/lib/cjs/session-manager.d.ts.map +1 -1
  24. package/lib/cjs/session-manager.js +10 -16
  25. package/lib/cjs/session-manager.js.map +1 -1
  26. package/lib/cjs/storage/cookie.d.ts +2 -2
  27. package/lib/cjs/storage/cookie.d.ts.map +1 -1
  28. package/lib/cjs/storage/cookie.js +16 -11
  29. package/lib/cjs/storage/cookie.js.map +1 -1
  30. package/lib/cjs/storage/local-storage.d.ts +1 -0
  31. package/lib/cjs/storage/local-storage.d.ts.map +1 -1
  32. package/lib/cjs/storage/local-storage.js +4 -1
  33. package/lib/cjs/storage/local-storage.js.map +1 -1
  34. package/lib/cjs/storage/utm-cookie.js +1 -1
  35. package/lib/cjs/storage/utm-cookie.js.map +1 -1
  36. package/lib/cjs/transports/fetch.d.ts +2 -1
  37. package/lib/cjs/transports/fetch.d.ts.map +1 -1
  38. package/lib/cjs/transports/fetch.js +5 -3
  39. package/lib/cjs/transports/fetch.js.map +1 -1
  40. package/lib/cjs/transports/send-beacon.d.ts +2 -1
  41. package/lib/cjs/transports/send-beacon.d.ts.map +1 -1
  42. package/lib/cjs/transports/send-beacon.js +7 -4
  43. package/lib/cjs/transports/send-beacon.js.map +1 -1
  44. package/lib/cjs/transports/xhr.d.ts +2 -1
  45. package/lib/cjs/transports/xhr.d.ts.map +1 -1
  46. package/lib/cjs/transports/xhr.js +7 -4
  47. package/lib/cjs/transports/xhr.js.map +1 -1
  48. package/lib/cjs/utils/snippet-helper.d.ts +1 -0
  49. package/lib/cjs/utils/snippet-helper.d.ts.map +1 -1
  50. package/lib/cjs/utils/snippet-helper.js +1 -0
  51. package/lib/cjs/utils/snippet-helper.js.map +1 -1
  52. package/lib/cjs/version.d.ts +1 -1
  53. package/lib/cjs/version.js +1 -1
  54. package/lib/cjs/version.js.map +1 -1
  55. package/lib/esm/attribution.d.ts +1 -1
  56. package/lib/esm/attribution.d.ts.map +1 -1
  57. package/lib/esm/attribution.js +4 -16
  58. package/lib/esm/attribution.js.map +1 -1
  59. package/lib/esm/browser-client.d.ts +108 -82
  60. package/lib/esm/browser-client.d.ts.map +1 -1
  61. package/lib/esm/browser-client.js +211 -182
  62. package/lib/esm/browser-client.js.map +1 -1
  63. package/lib/esm/config.d.ts +16 -8
  64. package/lib/esm/config.d.ts.map +1 -1
  65. package/lib/esm/config.js +33 -31
  66. package/lib/esm/config.js.map +1 -1
  67. package/lib/esm/cookie-migration/index.d.ts +5 -0
  68. package/lib/esm/cookie-migration/index.d.ts.map +1 -0
  69. package/lib/esm/cookie-migration/index.js +50 -0
  70. package/lib/esm/cookie-migration/index.js.map +1 -0
  71. package/lib/esm/plugins/context.d.ts.map +1 -1
  72. package/lib/esm/plugins/context.js +4 -4
  73. package/lib/esm/plugins/context.js.map +1 -1
  74. package/lib/esm/session-manager.d.ts +3 -3
  75. package/lib/esm/session-manager.d.ts.map +1 -1
  76. package/lib/esm/session-manager.js +8 -14
  77. package/lib/esm/session-manager.js.map +1 -1
  78. package/lib/esm/storage/cookie.d.ts +2 -2
  79. package/lib/esm/storage/cookie.d.ts.map +1 -1
  80. package/lib/esm/storage/cookie.js +16 -11
  81. package/lib/esm/storage/cookie.js.map +1 -1
  82. package/lib/esm/storage/local-storage.d.ts +1 -0
  83. package/lib/esm/storage/local-storage.d.ts.map +1 -1
  84. package/lib/esm/storage/local-storage.js +4 -1
  85. package/lib/esm/storage/local-storage.js.map +1 -1
  86. package/lib/esm/storage/utm-cookie.js +1 -1
  87. package/lib/esm/storage/utm-cookie.js.map +1 -1
  88. package/lib/esm/transports/fetch.d.ts +2 -1
  89. package/lib/esm/transports/fetch.d.ts.map +1 -1
  90. package/lib/esm/transports/fetch.js +7 -5
  91. package/lib/esm/transports/fetch.js.map +1 -1
  92. package/lib/esm/transports/send-beacon.d.ts +2 -1
  93. package/lib/esm/transports/send-beacon.d.ts.map +1 -1
  94. package/lib/esm/transports/send-beacon.js +9 -6
  95. package/lib/esm/transports/send-beacon.js.map +1 -1
  96. package/lib/esm/transports/xhr.d.ts +2 -1
  97. package/lib/esm/transports/xhr.d.ts.map +1 -1
  98. package/lib/esm/transports/xhr.js +9 -6
  99. package/lib/esm/transports/xhr.js.map +1 -1
  100. package/lib/esm/utils/snippet-helper.d.ts +1 -0
  101. package/lib/esm/utils/snippet-helper.d.ts.map +1 -1
  102. package/lib/esm/utils/snippet-helper.js +1 -0
  103. package/lib/esm/utils/snippet-helper.js.map +1 -1
  104. package/lib/esm/version.d.ts +1 -1
  105. package/lib/esm/version.js +1 -1
  106. package/lib/esm/version.js.map +1 -1
  107. package/lib/scripts/amplitude-min.js +1 -1
  108. package/lib/scripts/amplitude-min.js.gz +0 -0
  109. package/lib/scripts/amplitude-min.umd.js +1 -1
  110. package/lib/scripts/amplitude-min.umd.js.gz +0 -0
  111. package/lib/scripts/amplitude-snippet-instructions.html +1 -1
  112. package/lib/scripts/amplitude-snippet-min.js +1 -1
  113. package/package.json +11 -7
  114. package/lib/cjs/storage/memory.d.ts +0 -10
  115. package/lib/cjs/storage/memory.d.ts.map +0 -1
  116. package/lib/cjs/storage/memory.js +0 -25
  117. package/lib/cjs/storage/memory.js.map +0 -1
  118. package/lib/cjs/utils/uuid.d.ts +0 -10
  119. package/lib/cjs/utils/uuid.d.ts.map +0 -1
  120. package/lib/cjs/utils/uuid.js +0 -31
  121. package/lib/cjs/utils/uuid.js.map +0 -1
  122. package/lib/esm/storage/memory.d.ts +0 -10
  123. package/lib/esm/storage/memory.d.ts.map +0 -1
  124. package/lib/esm/storage/memory.js +0 -23
  125. package/lib/esm/storage/memory.js.map +0 -1
  126. package/lib/esm/utils/uuid.d.ts +0 -10
  127. package/lib/esm/utils/uuid.d.ts.map +0 -1
  128. package/lib/esm/utils/uuid.js +0 -28
  129. package/lib/esm/utils/uuid.js.map +0 -1
@@ -1,6 +1,5 @@
1
- var _this = this;
2
1
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.revenue = exports.setGroup = exports.groupIdentify = exports.identify = exports.logEvent = exports.track = exports.setTransport = exports.setOptOut = exports.setSessionId = exports.getSessionId = exports.setDeviceId = exports.getDeviceId = exports.setUserId = exports.getUserId = exports.remove = exports.add = exports.init = void 0;
2
+ exports.setTransport = exports.setOptOut = exports.setSessionId = exports.getSessionId = exports.regenerateDeviceId = exports.setDeviceId = exports.getDeviceId = exports.setUserId = exports.getUserId = exports.revenue = exports.setGroup = exports.groupIdentify = exports.identify = exports.logEvent = exports.track = exports.remove = exports.add = exports.init = exports.AmplitudeBrowser = void 0;
4
3
  var tslib_1 = require("tslib");
5
4
  var analytics_core_1 = require("@amplitude/analytics-core");
6
5
  var snippet_helper_1 = require("./utils/snippet-helper");
@@ -8,177 +7,142 @@ var context_1 = require("./plugins/context");
8
7
  var config_1 = require("./config");
9
8
  var attribution_1 = require("./attribution");
10
9
  var session_manager_1 = require("./session-manager");
11
- /**
12
- * Initializes the Amplitude SDK with your apiKey, userId and optional configurations.
13
- * This method must be called before any other operations.
14
- *
15
- * ```typescript
16
- * await init(API_KEY, USER_ID, options).promise;
17
- * ```
18
- */
19
- var init = function (apiKey, userId, options) {
20
- return {
21
- promise: (function () { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
22
- var browserOptions, config;
23
- return (0, tslib_1.__generator)(this, function (_a) {
24
- switch (_a.label) {
10
+ var cookie_migration_1 = require("./cookie-migration");
11
+ var AmplitudeBrowser = /** @class */ (function (_super) {
12
+ (0, tslib_1.__extends)(AmplitudeBrowser, _super);
13
+ function AmplitudeBrowser() {
14
+ return _super !== null && _super.apply(this, arguments) || this;
15
+ }
16
+ AmplitudeBrowser.prototype.init = function (apiKey, userId, options) {
17
+ var _a, _b, _c;
18
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function () {
19
+ var oldCookies, browserOptions;
20
+ return (0, tslib_1.__generator)(this, function (_d) {
21
+ switch (_d.label) {
25
22
  case 0:
26
- browserOptions = (0, config_1.createConfig)(apiKey, userId, options);
27
- config = (0, analytics_core_1.init)(browserOptions);
28
- (0, session_manager_1.updateCookies)(config);
29
- return [4 /*yield*/, (0, analytics_core_1.add)(new context_1.Context())];
23
+ oldCookies = (0, cookie_migration_1.parseOldCookies)(apiKey, options);
24
+ browserOptions = (0, config_1.useBrowserConfig)(apiKey, userId || oldCookies.userId, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, options), { deviceId: (_a = oldCookies.deviceId) !== null && _a !== void 0 ? _a : options === null || options === void 0 ? void 0 : options.deviceId, sessionId: (_b = oldCookies.sessionId) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.sessionId, optOut: (_c = options === null || options === void 0 ? void 0 : options.optOut) !== null && _c !== void 0 ? _c : oldCookies.optOut }));
25
+ return [4 /*yield*/, _super.prototype.init.call(this, undefined, undefined, browserOptions)];
30
26
  case 1:
31
- _a.sent();
32
- return [4 /*yield*/, (0, analytics_core_1.add)(new analytics_core_1.Destination())];
27
+ _d.sent();
28
+ // Step 3: Store user session in cookie storage
29
+ (0, session_manager_1.updateCookies)(this.config, oldCookies.lastEventTime);
30
+ // Step 4: Install plugins
31
+ return [4 /*yield*/, this.add(new context_1.Context())];
33
32
  case 2:
34
- _a.sent();
35
- (0, attribution_1.trackAttributions)(config);
33
+ // Step 4: Install plugins
34
+ _d.sent();
35
+ return [4 /*yield*/, this.add(new analytics_core_1.Destination())];
36
+ case 3:
37
+ _d.sent();
38
+ // Step 4: Track attributions
39
+ void this.trackAttributions();
36
40
  return [2 /*return*/];
37
41
  }
38
42
  });
39
- }); })(),
43
+ });
40
44
  };
41
- };
42
- exports.init = init;
43
- /**
44
- * Adds a new plugin.
45
- *
46
- * ```typescript
47
- * const plugin = {...};
48
- * amplitude.add(plugin);
49
- * ```
50
- */
51
- var add = function (plugin) {
52
- return {
53
- promise: (0, analytics_core_1.add)(plugin),
45
+ AmplitudeBrowser.prototype.getUserId = function () {
46
+ return this.config.userId;
54
47
  };
55
- };
56
- exports.add = add;
57
- /**
58
- * Removes a plugin.
59
- *
60
- * ```typescript
61
- * amplitude.remove('myPlugin');
62
- * ```
63
- */
64
- var remove = function (pluginName) {
65
- return {
66
- promise: (0, analytics_core_1.remove)(pluginName),
48
+ AmplitudeBrowser.prototype.setUserId = function (userId) {
49
+ this.config.userId = userId;
50
+ (0, session_manager_1.updateCookies)(this.config);
67
51
  };
68
- };
69
- exports.remove = remove;
70
- /**
71
- * Returns current user ID.
72
- *
73
- * ```typescript
74
- * const userId = getUserId();
75
- * ```
76
- */
77
- var getUserId = function () {
78
- return (0, config_1.getConfig)().userId;
79
- };
80
- exports.getUserId = getUserId;
81
- /**
82
- * Sets a new user ID.
83
- *
84
- * ```typescript
85
- * setUserId('userId');
86
- * ```
87
- */
88
- var setUserId = function (userId) {
89
- var config = (0, config_1.getConfig)();
90
- config.userId = userId;
91
- (0, session_manager_1.updateCookies)(config);
92
- };
93
- exports.setUserId = setUserId;
94
- /**
95
- * Returns current device ID.
96
- *
97
- * ```typescript
98
- * const deviceId = getDeviceId();
99
- * ```
100
- */
101
- var getDeviceId = function () {
102
- return (0, config_1.getConfig)().deviceId;
103
- };
104
- exports.getDeviceId = getDeviceId;
105
- /**
106
- * Sets a new device ID.
107
- * When setting a custom device ID, make sure the value is sufficiently unique.
108
- * A uuid is recommended.
109
- *
110
- * ```typescript
111
- * setDeviceId('deviceId');
112
- * ```
113
- */
114
- var setDeviceId = function (deviceId) {
115
- var config = (0, config_1.getConfig)();
116
- config.deviceId = deviceId;
117
- (0, session_manager_1.updateCookies)(config);
118
- };
119
- exports.setDeviceId = setDeviceId;
52
+ AmplitudeBrowser.prototype.getDeviceId = function () {
53
+ return this.config.deviceId;
54
+ };
55
+ AmplitudeBrowser.prototype.setDeviceId = function (deviceId) {
56
+ this.config.deviceId = deviceId;
57
+ (0, session_manager_1.updateCookies)(this.config);
58
+ };
59
+ AmplitudeBrowser.prototype.regenerateDeviceId = function () {
60
+ var deviceId = (0, config_1.createDeviceId)();
61
+ this.setDeviceId(deviceId);
62
+ };
63
+ AmplitudeBrowser.prototype.getSessionId = function () {
64
+ return this.config.sessionId;
65
+ };
66
+ AmplitudeBrowser.prototype.setSessionId = function (sessionId) {
67
+ this.config.sessionId = sessionId;
68
+ (0, session_manager_1.updateCookies)(this.config);
69
+ };
70
+ AmplitudeBrowser.prototype.setOptOut = function (optOut) {
71
+ _super.prototype.setOptOut.call(this, optOut);
72
+ (0, session_manager_1.updateCookies)(this.config);
73
+ };
74
+ AmplitudeBrowser.prototype.setTransport = function (transport) {
75
+ this.config.transportProvider = (0, config_1.createTransport)(transport);
76
+ };
77
+ AmplitudeBrowser.prototype.identify = function (identify, eventOptions) {
78
+ if ((0, snippet_helper_1.isInstanceProxy)(identify)) {
79
+ var queue = identify._q;
80
+ identify._q = [];
81
+ identify = (0, snippet_helper_1.convertProxyObjectToRealObject)(new analytics_core_1.Identify(), queue);
82
+ }
83
+ return _super.prototype.identify.call(this, identify, eventOptions);
84
+ };
85
+ AmplitudeBrowser.prototype.groupIdentify = function (groupType, groupName, identify, eventOptions) {
86
+ if ((0, snippet_helper_1.isInstanceProxy)(identify)) {
87
+ var queue = identify._q;
88
+ identify._q = [];
89
+ identify = (0, snippet_helper_1.convertProxyObjectToRealObject)(new analytics_core_1.Identify(), queue);
90
+ }
91
+ return _super.prototype.groupIdentify.call(this, groupType, groupName, identify, eventOptions);
92
+ };
93
+ AmplitudeBrowser.prototype.revenue = function (revenue, eventOptions) {
94
+ if ((0, snippet_helper_1.isInstanceProxy)(revenue)) {
95
+ var queue = revenue._q;
96
+ revenue._q = [];
97
+ revenue = (0, snippet_helper_1.convertProxyObjectToRealObject)(new analytics_core_1.Revenue(), queue);
98
+ }
99
+ return _super.prototype.revenue.call(this, revenue, eventOptions);
100
+ };
101
+ AmplitudeBrowser.prototype.trackAttributions = function () {
102
+ var attributions = (0, attribution_1.getAttributions)(this.config);
103
+ if (Object.keys(attributions).length === 0) {
104
+ return;
105
+ }
106
+ var id = new analytics_core_1.Identify();
107
+ Object.entries(attributions).forEach(function (_a) {
108
+ var _b = (0, tslib_1.__read)(_a, 2), key = _b[0], value = _b[1];
109
+ if (value) {
110
+ id.setOnce("initial_".concat(key), value);
111
+ id.set(key, value);
112
+ }
113
+ });
114
+ return this.identify(id);
115
+ };
116
+ return AmplitudeBrowser;
117
+ }(analytics_core_1.AmplitudeCore));
118
+ exports.AmplitudeBrowser = AmplitudeBrowser;
119
+ var client = new AmplitudeBrowser();
120
120
  /**
121
- * Returns current session ID.
121
+ * Initializes the Amplitude SDK with your apiKey, userId and optional configurations.
122
+ * This method must be called before any other operations.
122
123
  *
123
124
  * ```typescript
124
- * const sessionId = getSessionId();
125
+ * await init(API_KEY, USER_ID, options).promise;
125
126
  * ```
126
127
  */
127
- var getSessionId = function () {
128
- return (0, config_1.getConfig)().sessionId;
129
- };
130
- exports.getSessionId = getSessionId;
128
+ exports.init = (0, analytics_core_1.returnWrapper)(client.init.bind(client));
131
129
  /**
132
- * Sets a new session ID.
133
- * When settign a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).
130
+ * Adds a new plugin.
134
131
  *
135
132
  * ```typescript
136
- * setSessionId(Date.now());
137
- * ```
138
- */
139
- var setSessionId = function (sessionId) {
140
- var config = (0, config_1.getConfig)();
141
- config.sessionId = sessionId;
142
- (0, session_manager_1.updateCookies)(config);
143
- };
144
- exports.setSessionId = setSessionId;
145
- /**
146
- * Sets a new optOut config value. This toggles event tracking on/off.
147
- *
148
- *```typescript
149
- * // Stops tracking
150
- * setOptOut(true);
151
- *
152
- * // Starts/resumes tracking
153
- * setOptOut(false);
133
+ * const plugin = {...};
134
+ * amplitude.add(plugin);
154
135
  * ```
155
136
  */
156
- var setOptOut = function (optOut) {
157
- (0, analytics_core_1.setOptOut)(optOut);
158
- var config = (0, config_1.getConfig)();
159
- (0, session_manager_1.updateCookies)(config);
160
- };
161
- exports.setOptOut = setOptOut;
137
+ exports.add = (0, analytics_core_1.returnWrapper)(client.add.bind(client));
162
138
  /**
163
- * Sets the network transport type for events.
139
+ * Removes a plugin.
164
140
  *
165
141
  * ```typescript
166
- * // Use Fetch API
167
- * setTransport('fetch');
168
- *
169
- * // Use XMLHttpRequest API
170
- * setTransport('xhr');
171
- *
172
- * // Use navigator.sendBeacon API
173
- * setTransport('beacon');
142
+ * amplitude.remove('myPlugin');
174
143
  * ```
175
144
  */
176
- var setTransport = function (transport) {
177
- var config = (0, config_1.getConfig)();
178
- var transportProvider = (0, config_1.createTransport)(transport);
179
- config.transportProvider = transportProvider;
180
- };
181
- exports.setTransport = setTransport;
145
+ exports.remove = (0, analytics_core_1.returnWrapper)(client.remove.bind(client));
182
146
  /**
183
147
  * Tracks user-defined event, with specified type, optional event properties and optional overwrites.
184
148
  *
@@ -199,16 +163,11 @@ exports.setTransport = setTransport;
199
163
  * console.log(result.message); // "Event tracked successfully"
200
164
  * ```
201
165
  */
202
- var track = function (eventType, eventProperties, eventOptions) {
203
- return {
204
- promise: (0, analytics_core_1.track)(eventType, eventProperties, eventOptions),
205
- };
206
- };
207
- exports.track = track;
166
+ exports.track = (0, analytics_core_1.returnWrapper)(client.track.bind(client));
208
167
  /**
209
- * Alis for track()
168
+ * Alias for track()
210
169
  */
211
- exports.logEvent = exports.track;
170
+ exports.logEvent = (0, analytics_core_1.returnWrapper)(client.logEvent.bind(client));
212
171
  /**
213
172
  * Sends an identify event containing user property operations
214
173
  *
@@ -224,17 +183,7 @@ exports.logEvent = exports.track;
224
183
  * console.log(result.message); // "Event tracked successfully"
225
184
  * ```
226
185
  */
227
- var identify = function (identify, eventOptions) {
228
- if ((0, snippet_helper_1.isInstanceProxy)(identify)) {
229
- var queue = identify._q;
230
- identify._q = [];
231
- identify = (0, snippet_helper_1.convertProxyObjectToRealObject)(new analytics_core_1.Identify(), queue);
232
- }
233
- return {
234
- promise: (0, analytics_core_1.identify)(undefined, undefined, identify, eventOptions),
235
- };
236
- };
237
- exports.identify = identify;
186
+ exports.identify = (0, analytics_core_1.returnWrapper)(client.identify.bind(client));
238
187
  /**
239
188
  * Sends a group identify event containing group property operations.
240
189
  *
@@ -252,23 +201,8 @@ exports.identify = identify;
252
201
  * console.log(result.message); // "Event tracked successfully"
253
202
  * ```
254
203
  */
255
- var groupIdentify = function (groupType, groupName, identify, eventOptions) {
256
- if ((0, snippet_helper_1.isInstanceProxy)(identify)) {
257
- var queue = identify._q;
258
- identify._q = [];
259
- identify = (0, snippet_helper_1.convertProxyObjectToRealObject)(new analytics_core_1.Identify(), queue);
260
- }
261
- return {
262
- promise: (0, analytics_core_1.groupIdentify)(undefined, undefined, groupType, groupName, identify, eventOptions),
263
- };
264
- };
265
- exports.groupIdentify = groupIdentify;
266
- var setGroup = function (groupType, groupName) {
267
- return {
268
- promise: (0, analytics_core_1.setGroup)(groupType, groupName),
269
- };
270
- };
271
- exports.setGroup = setGroup;
204
+ exports.groupIdentify = (0, analytics_core_1.returnWrapper)(client.groupIdentify.bind(client));
205
+ exports.setGroup = (0, analytics_core_1.returnWrapper)(client.setGroup.bind(client));
272
206
  /**
273
207
  * Sends a revenue event containing revenue property operations.
274
208
  *
@@ -284,15 +218,93 @@ exports.setGroup = setGroup;
284
218
  * console.log(result.message); // "Event tracked successfully"
285
219
  * ```
286
220
  */
287
- var revenue = function (revenue, eventOptions) {
288
- if ((0, snippet_helper_1.isInstanceProxy)(revenue)) {
289
- var queue = revenue._q;
290
- revenue._q = [];
291
- revenue = (0, snippet_helper_1.convertProxyObjectToRealObject)(new analytics_core_1.Revenue(), queue);
292
- }
293
- return {
294
- promise: (0, analytics_core_1.revenue)(revenue, eventOptions),
295
- };
296
- };
297
- exports.revenue = revenue;
221
+ exports.revenue = (0, analytics_core_1.returnWrapper)(client.revenue.bind(client));
222
+ /**
223
+ * Returns current user ID.
224
+ *
225
+ * ```typescript
226
+ * const userId = getUserId();
227
+ * ```
228
+ */
229
+ exports.getUserId = client.getUserId.bind(client);
230
+ /**
231
+ * Sets a new user ID.
232
+ *
233
+ * ```typescript
234
+ * setUserId('userId');
235
+ * ```
236
+ */
237
+ exports.setUserId = client.setUserId.bind(client);
238
+ /**
239
+ * Returns current device ID.
240
+ *
241
+ * ```typescript
242
+ * const deviceId = getDeviceId();
243
+ * ```
244
+ */
245
+ exports.getDeviceId = client.getDeviceId.bind(client);
246
+ /**
247
+ * Sets a new device ID.
248
+ * When setting a custom device ID, make sure the value is sufficiently unique.
249
+ * A uuid is recommended.
250
+ *
251
+ * ```typescript
252
+ * setDeviceId('deviceId');
253
+ * ```
254
+ */
255
+ exports.setDeviceId = client.setDeviceId.bind(client);
256
+ /**
257
+ * Regenerates a new random deviceId for current user. Note: this is not recommended unless you know what you
258
+ * are doing. This can be used in conjunction with `setUserId(undefined)` to anonymize users after they log out.
259
+ * With an `unefined` userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.
260
+ *
261
+ * ```typescript
262
+ * regenerateDeviceId();
263
+ * ```
264
+ */
265
+ exports.regenerateDeviceId = client.regenerateDeviceId.bind(client);
266
+ /**
267
+ * Returns current session ID.
268
+ *
269
+ * ```typescript
270
+ * const sessionId = getSessionId();
271
+ * ```
272
+ */
273
+ exports.getSessionId = client.getSessionId.bind(client);
274
+ /**
275
+ * Sets a new session ID.
276
+ * When settign a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).
277
+ *
278
+ * ```typescript
279
+ * setSessionId(Date.now());
280
+ * ```
281
+ */
282
+ exports.setSessionId = client.setSessionId.bind(client);
283
+ /**
284
+ * Sets a new optOut config value. This toggles event tracking on/off.
285
+ *
286
+ *```typescript
287
+ * // Stops tracking
288
+ * setOptOut(true);
289
+ *
290
+ * // Starts/resumes tracking
291
+ * setOptOut(false);
292
+ * ```
293
+ */
294
+ exports.setOptOut = client.setOptOut.bind(client);
295
+ /**
296
+ * Sets the network transport type for events.
297
+ *
298
+ * ```typescript
299
+ * // Use Fetch API
300
+ * setTransport('fetch');
301
+ *
302
+ * // Use XMLHttpRequest API
303
+ * setTransport('xhr');
304
+ *
305
+ * // Use navigator.sendBeacon API
306
+ * setTransport('beacon');
307
+ * ```
308
+ */
309
+ exports.setTransport = client.setTransport.bind(client);
298
310
  //# sourceMappingURL=browser-client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":"AAAA,iBA2TA;;;;AA3TA,4DAamC;AAUnC,yDAAyF;AACzF,6CAA4C;AAC5C,mCAAoE;AACpE,6CAAkD;AAClD,qDAAkD;AAElD;;;;;;;GAOG;AACI,IAAM,IAAI,GAAG,UAAC,MAAc,EAAE,MAAe,EAAE,OAAwB;IAC5E,OAAO;QACL,OAAO,EAAE,CAAC;;;;;wBACF,cAAc,GAAG,IAAA,qBAAY,EAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;wBACvD,MAAM,GAAG,IAAA,qBAA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AAA,yBAAS,EAAC,SAAS,EAAE,SAAS,CAAC;KACzC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,QAAQ,YAInB;AAEF;;;;;;;;;;;;;;GAcG;AACI,IAAM,OAAO,GAAG,UAAC,OAAgB,EAAE,YAA2B;IACnE,IAAI,IAAA,gCAAe,EAAC,OAAO,CAAC,EAAE;QAC5B,IAAM,KAAK,GAAG,OAAO,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;QAChB,OAAO,GAAG,IAAA,+CAA8B,EAAC,IAAI,wBAAO,EAAE,EAAE,KAAK,CAAC,CAAC;KAChE;IACD,OAAO;QACL,OAAO,EAAE,IAAA,wBAAQ,EAAC,OAAO,EAAE,YAAY,CAAC;KACzC,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,OAAO,WASlB","sourcesContent":["import {\n add as _add,\n groupIdentify as _groupIdentify,\n Destination,\n identify as _identify,\n revenue as _revenue,\n init as _init,\n setOptOut as _setOptOut,\n Identify,\n Revenue,\n track as _track,\n setGroup as _setGroup,\n remove as _remove,\n} from '@amplitude/analytics-core';\nimport {\n AmplitudeReturn,\n BrowserConfig,\n BrowserOptions,\n EventOptions,\n Plugin,\n Result,\n TransportType,\n} from '@amplitude/analytics-types';\nimport { convertProxyObjectToRealObject, isInstanceProxy } from './utils/snippet-helper';\nimport { Context } from './plugins/context';\nimport { createConfig, createTransport, getConfig } from './config';\nimport { trackAttributions } from './attribution';\nimport { updateCookies } from './session-manager';\n\n/**\n * Initializes the Amplitude SDK with your apiKey, userId and optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, USER_ID, options).promise;\n * ```\n */\nexport const init = (apiKey: string, userId?: string, options?: BrowserOptions): AmplitudeReturn<void> => {\n return {\n promise: (async () => {\n const browserOptions = createConfig(apiKey, userId, options);\n const config = _init(browserOptions) as BrowserConfig;\n updateCookies(config);\n\n await _add(new Context());\n await _add(new Destination());\n trackAttributions(config);\n })(),\n };\n};\n\n/**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {...};\n * amplitude.add(plugin);\n * ```\n */\nexport const add = (plugin: Plugin): AmplitudeReturn<void> => {\n return {\n promise: _add(plugin),\n };\n};\n\n/**\n * Removes a plugin.\n *\n * ```typescript\n * amplitude.remove('myPlugin');\n * ```\n */\nexport const remove = (pluginName: string): AmplitudeReturn<void> => {\n return {\n promise: _remove(pluginName),\n };\n};\n\n/**\n * Returns current user ID.\n *\n * ```typescript\n * const userId = getUserId();\n * ```\n */\nexport const getUserId = () => {\n return getConfig().userId;\n};\n\n/**\n * Sets a new user ID.\n *\n * ```typescript\n * setUserId('userId');\n * ```\n */\nexport const setUserId = (userId: string) => {\n const config = getConfig();\n config.userId = userId;\n updateCookies(config);\n};\n\n/**\n * Returns current device ID.\n *\n * ```typescript\n * const deviceId = getDeviceId();\n * ```\n */\nexport const getDeviceId = () => {\n return getConfig().deviceId;\n};\n\n/**\n * Sets a new device ID.\n * When setting a custom device ID, make sure the value is sufficiently unique.\n * A uuid is recommended.\n *\n * ```typescript\n * setDeviceId('deviceId');\n * ```\n */\nexport const setDeviceId = (deviceId: string) => {\n const config = getConfig();\n config.deviceId = deviceId;\n updateCookies(config);\n};\n\n/**\n * Returns current session ID.\n *\n * ```typescript\n * const sessionId = getSessionId();\n * ```\n */\nexport const getSessionId = () => {\n return getConfig().sessionId;\n};\n\n/**\n * Sets a new session ID.\n * When settign a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).\n *\n * ```typescript\n * setSessionId(Date.now());\n * ```\n */\nexport const setSessionId = (sessionId: number) => {\n const config = getConfig();\n config.sessionId = sessionId;\n updateCookies(config);\n};\n\n/**\n * Sets a new optOut config value. This toggles event tracking on/off.\n *\n *```typescript\n * // Stops tracking\n * setOptOut(true);\n *\n * // Starts/resumes tracking\n * setOptOut(false);\n * ```\n */\nexport const setOptOut = (optOut: boolean) => {\n _setOptOut(optOut);\n const config = getConfig();\n updateCookies(config);\n};\n\n/**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\nexport const setTransport = (transport: TransportType) => {\n const config = getConfig();\n const transportProvider = createTransport(transport);\n config.transportProvider = transportProvider;\n};\n\n/**\n * Tracks user-defined event, with specified type, optional event properties and optional overwrites.\n *\n * ```typescript\n * // event tracking with event type only\n * track('Page Load');\n *\n * // event tracking with event type and additional event properties\n * track('Page Load', { loadTime: 1000 });\n *\n * // event tracking with event type, additional event properties, and overwritten event options\n * track('Page Load', { loadTime: 1000 }, { sessionId: -1 });\n *\n * // alternatively, this tracking method is awaitable\n * const result = await track('Page Load').promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const track = (\n eventType: string,\n eventProperties?: Record<string, any>,\n eventOptions?: EventOptions,\n): AmplitudeReturn<Result> => {\n return {\n promise: _track(eventType, eventProperties, eventOptions),\n };\n};\n\n/**\n * Alis for track()\n */\nexport const logEvent = track;\n\n/**\n * Sends an identify event containing user property operations\n *\n * ```typescript\n * const id = new Identify();\n * id.set('colors', ['rose', 'gold']);\n * identify(id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await identify(id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const identify = (identify: Identify, eventOptions?: EventOptions): AmplitudeReturn<Result> => {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return {\n promise: _identify(undefined, undefined, identify, eventOptions),\n };\n};\n\n/**\n * Sends a group identify event containing group property operations.\n *\n * ```typescript\n * const id = new Identify();\n * id.set('skills', ['js', 'ts']);\n * const groupType = 'org';\n * const groupName = 'engineering';\n * groupIdentify(groupType, groupName, id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await groupIdentify(groupType, groupName, id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const groupIdentify = (\n groupType: string,\n groupName: string | string[],\n identify: Identify,\n eventOptions?: EventOptions,\n): AmplitudeReturn<Result> => {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return {\n promise: _groupIdentify(undefined, undefined, groupType, groupName, identify, eventOptions),\n };\n};\n\nexport const setGroup = (groupType: string, groupName: string | string[]): AmplitudeReturn<Result> => {\n return {\n promise: _setGroup(groupType, groupName),\n };\n};\n\n/**\n * Sends a revenue event containing revenue property operations.\n *\n * ```typescript\n * const rev = new Revenue();\n * rev.setRevenue(100);\n * revenue(rev);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await revenue(rev).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const revenue = (revenue: Revenue, eventOptions?: EventOptions): AmplitudeReturn<Result> => {\n if (isInstanceProxy(revenue)) {\n const queue = revenue._q;\n revenue._q = [];\n revenue = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return {\n promise: _revenue(revenue, eventOptions),\n };\n};\n"]}
1
+ {"version":3,"file":"browser-client.js","sourceRoot":"","sources":["../../src/browser-client.ts"],"names":[],"mappings":";;;AAAA,4DAAyG;AAUzG,yDAAyF;AACzF,6CAA4C;AAC5C,mCAA6E;AAC7E,6CAAgD;AAChD,qDAAkD;AAClD,uDAAqD;AAErD;IAAsC,iDAA4B;IAAlE;;IAgHA,CAAC;IA/GO,+BAAI,GAAV,UAAW,MAAc,EAAE,MAAe,EAAE,OAAwB;;;;;;;wBAE5D,UAAU,GAAG,IAAA,kCAAe,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;wBAG9C,cAAc,GAAG,IAAA,y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,MAAM,CAAC,CAAC,CAAC;AAElE;;;;;;GAMG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEvD;;;;;;GAMG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEvD;;;;;;GAMG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;GAQG;AACU,QAAA,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;;;GAQG;AACU,QAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEzE;;;;;;GAMG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAE7D;;;;;;;GAOG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACU,QAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEvD;;;;;;;;;;;;;GAaG;AACU,QAAA,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC","sourcesContent":["import { AmplitudeCore, Destination, Identify, Revenue, returnWrapper } from '@amplitude/analytics-core';\nimport {\n BrowserConfig,\n BrowserOptions,\n EventOptions,\n Identify as IIdentify,\n Result,\n Revenue as IRevenue,\n TransportType,\n} from '@amplitude/analytics-types';\nimport { convertProxyObjectToRealObject, isInstanceProxy } from './utils/snippet-helper';\nimport { Context } from './plugins/context';\nimport { useBrowserConfig, createTransport, createDeviceId } from './config';\nimport { getAttributions } from './attribution';\nimport { updateCookies } from './session-manager';\nimport { parseOldCookies } from './cookie-migration';\n\nexport class AmplitudeBrowser extends AmplitudeCore<BrowserConfig> {\n async init(apiKey: string, userId?: string, options?: BrowserOptions) {\n // Step 1: Read cookies stored by old SDK\n const oldCookies = parseOldCookies(apiKey, options);\n\n // Step 2: Create browser config\n const browserOptions = useBrowserConfig(apiKey, userId || oldCookies.userId, {\n ...options,\n deviceId: oldCookies.deviceId ?? options?.deviceId,\n sessionId: oldCookies.sessionId ?? options?.sessionId,\n optOut: options?.optOut ?? oldCookies.optOut,\n });\n await super.init(undefined, undefined, browserOptions);\n\n // Step 3: Store user session in cookie storage\n updateCookies(this.config, oldCookies.lastEventTime);\n\n // Step 4: Install plugins\n await this.add(new Context());\n await this.add(new Destination());\n\n // Step 4: Track attributions\n void this.trackAttributions();\n }\n\n getUserId() {\n return this.config.userId;\n }\n\n setUserId(userId: string | undefined) {\n this.config.userId = userId;\n updateCookies(this.config);\n }\n\n getDeviceId() {\n return this.config.deviceId;\n }\n\n setDeviceId(deviceId: string) {\n this.config.deviceId = deviceId;\n updateCookies(this.config);\n }\n\n regenerateDeviceId() {\n const deviceId = createDeviceId();\n this.setDeviceId(deviceId);\n }\n\n getSessionId() {\n return this.config.sessionId;\n }\n\n setSessionId(sessionId: number) {\n this.config.sessionId = sessionId;\n updateCookies(this.config);\n }\n\n setOptOut(optOut: boolean) {\n super.setOptOut(optOut);\n updateCookies(this.config);\n }\n\n setTransport(transport: TransportType) {\n this.config.transportProvider = createTransport(transport);\n }\n\n identify(identify: IIdentify, eventOptions?: EventOptions): Promise<Result> {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return super.identify(identify, eventOptions);\n }\n\n groupIdentify(\n groupType: string,\n groupName: string | string[],\n identify: IIdentify,\n eventOptions?: EventOptions,\n ): Promise<Result> {\n if (isInstanceProxy(identify)) {\n const queue = identify._q;\n identify._q = [];\n identify = convertProxyObjectToRealObject(new Identify(), queue);\n }\n return super.groupIdentify(groupType, groupName, identify, eventOptions);\n }\n\n revenue(revenue: IRevenue, eventOptions?: EventOptions) {\n if (isInstanceProxy(revenue)) {\n const queue = revenue._q;\n revenue._q = [];\n revenue = convertProxyObjectToRealObject(new Revenue(), queue);\n }\n return super.revenue(revenue, eventOptions);\n }\n\n trackAttributions() {\n const attributions = getAttributions(this.config);\n if (Object.keys(attributions).length === 0) {\n return;\n }\n const id = new Identify();\n Object.entries(attributions).forEach(([key, value]: [string, string]) => {\n if (value) {\n id.setOnce(`initial_${key}`, value);\n id.set(key, value);\n }\n });\n return this.identify(id);\n }\n}\n\nconst client = new AmplitudeBrowser();\n\n/**\n * Initializes the Amplitude SDK with your apiKey, userId and optional configurations.\n * This method must be called before any other operations.\n *\n * ```typescript\n * await init(API_KEY, USER_ID, options).promise;\n * ```\n */\nexport const init = returnWrapper(client.init.bind(client));\n\n/**\n * Adds a new plugin.\n *\n * ```typescript\n * const plugin = {...};\n * amplitude.add(plugin);\n * ```\n */\nexport const add = returnWrapper(client.add.bind(client));\n\n/**\n * Removes a plugin.\n *\n * ```typescript\n * amplitude.remove('myPlugin');\n * ```\n */\nexport const remove = returnWrapper(client.remove.bind(client));\n\n/**\n * Tracks user-defined event, with specified type, optional event properties and optional overwrites.\n *\n * ```typescript\n * // event tracking with event type only\n * track('Page Load');\n *\n * // event tracking with event type and additional event properties\n * track('Page Load', { loadTime: 1000 });\n *\n * // event tracking with event type, additional event properties, and overwritten event options\n * track('Page Load', { loadTime: 1000 }, { sessionId: -1 });\n *\n * // alternatively, this tracking method is awaitable\n * const result = await track('Page Load').promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const track = returnWrapper(client.track.bind(client));\n\n/**\n * Alias for track()\n */\nexport const logEvent = returnWrapper(client.logEvent.bind(client));\n\n/**\n * Sends an identify event containing user property operations\n *\n * ```typescript\n * const id = new Identify();\n * id.set('colors', ['rose', 'gold']);\n * identify(id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await identify(id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const identify = returnWrapper(client.identify.bind(client));\n\n/**\n * Sends a group identify event containing group property operations.\n *\n * ```typescript\n * const id = new Identify();\n * id.set('skills', ['js', 'ts']);\n * const groupType = 'org';\n * const groupName = 'engineering';\n * groupIdentify(groupType, groupName, id);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await groupIdentify(groupType, groupName, id).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const groupIdentify = returnWrapper(client.groupIdentify.bind(client));\nexport const setGroup = returnWrapper(client.setGroup.bind(client));\n\n/**\n * Sends a revenue event containing revenue property operations.\n *\n * ```typescript\n * const rev = new Revenue();\n * rev.setRevenue(100);\n * revenue(rev);\n *\n * // alternatively, this tracking method is awaitable\n * const result = await revenue(rev).promise;\n * console.log(result.event); // {...}\n * console.log(result.code); // 200\n * console.log(result.message); // \"Event tracked successfully\"\n * ```\n */\nexport const revenue = returnWrapper(client.revenue.bind(client));\n\n/**\n * Returns current user ID.\n *\n * ```typescript\n * const userId = getUserId();\n * ```\n */\nexport const getUserId = client.getUserId.bind(client);\n\n/**\n * Sets a new user ID.\n *\n * ```typescript\n * setUserId('userId');\n * ```\n */\nexport const setUserId = client.setUserId.bind(client);\n\n/**\n * Returns current device ID.\n *\n * ```typescript\n * const deviceId = getDeviceId();\n * ```\n */\nexport const getDeviceId = client.getDeviceId.bind(client);\n\n/**\n * Sets a new device ID.\n * When setting a custom device ID, make sure the value is sufficiently unique.\n * A uuid is recommended.\n *\n * ```typescript\n * setDeviceId('deviceId');\n * ```\n */\nexport const setDeviceId = client.setDeviceId.bind(client);\n\n/**\n * Regenerates a new random deviceId for current user. Note: this is not recommended unless you know what you\n * are doing. This can be used in conjunction with `setUserId(undefined)` to anonymize users after they log out.\n * With an `unefined` userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n *\n * ```typescript\n * regenerateDeviceId();\n * ```\n */\nexport const regenerateDeviceId = client.regenerateDeviceId.bind(client);\n\n/**\n * Returns current session ID.\n *\n * ```typescript\n * const sessionId = getSessionId();\n * ```\n */\nexport const getSessionId = client.getSessionId.bind(client);\n\n/**\n * Sets a new session ID.\n * When settign a custom session ID, make sure the value is in milliseconds since epoch (Unix Timestamp).\n *\n * ```typescript\n * setSessionId(Date.now());\n * ```\n */\nexport const setSessionId = client.setSessionId.bind(client);\n\n/**\n * Sets a new optOut config value. This toggles event tracking on/off.\n *\n *```typescript\n * // Stops tracking\n * setOptOut(true);\n *\n * // Starts/resumes tracking\n * setOptOut(false);\n * ```\n */\nexport const setOptOut = client.setOptOut.bind(client);\n\n/**\n * Sets the network transport type for events.\n *\n * ```typescript\n * // Use Fetch API\n * setTransport('fetch');\n *\n * // Use XMLHttpRequest API\n * setTransport('xhr');\n *\n * // Use navigator.sendBeacon API\n * setTransport('beacon');\n * ```\n */\nexport const setTransport = client.setTransport.bind(client);\n"]}
@@ -1,12 +1,13 @@
1
- import { BrowserOptions, BrowserConfig as IBrowserConfig, Storage, TrackingOptions, TransportType, UserSession } from '@amplitude/analytics-types';
2
- import { Config } from '@amplitude/analytics-core';
1
+ import { Event, BrowserOptions, BrowserConfig as IBrowserConfig, Storage, TrackingOptions, TransportType, UserSession } from '@amplitude/analytics-types';
2
+ import { Config, MemoryStorage } from '@amplitude/analytics-core';
3
3
  import { FetchTransport } from './transports/fetch';
4
4
  import { XHRTransport } from './transports/xhr';
5
5
  import { SendBeaconTransport } from './transports/send-beacon';
6
- export declare const defaultConfig: {
6
+ export declare const getDefaultConfig: () => {
7
7
  cookieExpiration: number;
8
8
  cookieSameSite: string;
9
9
  cookieSecure: boolean;
10
+ cookieStorage: MemoryStorage<UserSession>;
10
11
  disableCookies: boolean;
11
12
  domain: string;
12
13
  includeGclid: boolean;
@@ -14,6 +15,7 @@ export declare const defaultConfig: {
14
15
  includeReferrer: boolean;
15
16
  includeUtm: boolean;
16
17
  sessionTimeout: number;
18
+ storageProvider: MemoryStorage<Event[]>;
17
19
  trackingOptions: {
18
20
  city: boolean;
19
21
  country: boolean;
@@ -32,25 +34,31 @@ export declare const defaultConfig: {
32
34
  transportProvider: FetchTransport;
33
35
  };
34
36
  export declare class BrowserConfig extends Config implements IBrowserConfig {
37
+ appVersion?: string;
35
38
  cookieExpiration: number;
36
39
  cookieSameSite: string;
37
40
  cookieSecure: boolean;
38
41
  cookieStorage: Storage<UserSession>;
42
+ deviceId?: string;
39
43
  disableCookies: boolean;
40
44
  domain: string;
41
- includeUtm: boolean;
42
- includeReferrer: boolean;
43
45
  includeGclid: boolean;
44
46
  includeFbclid: boolean;
47
+ includeReferrer: boolean;
48
+ includeUtm: boolean;
49
+ partnerId?: string;
50
+ sessionId?: number;
45
51
  sessionTimeout: number;
46
52
  trackingOptions: TrackingOptions;
53
+ userId?: string;
47
54
  constructor(apiKey: string, userId?: string, options?: BrowserOptions);
48
55
  }
49
- export declare const createConfig: (apiKey: string, userId?: string | undefined, overrides?: BrowserOptions | undefined) => IBrowserConfig;
56
+ export declare const useBrowserConfig: (apiKey: string, userId?: string | undefined, options?: BrowserOptions | undefined) => IBrowserConfig;
50
57
  export declare const createCookieStorage: (overrides?: BrowserOptions | undefined, baseConfig?: {
51
58
  cookieExpiration: number;
52
59
  cookieSameSite: string;
53
60
  cookieSecure: boolean;
61
+ cookieStorage: MemoryStorage<UserSession>;
54
62
  disableCookies: boolean;
55
63
  domain: string;
56
64
  includeGclid: boolean;
@@ -58,6 +66,7 @@ export declare const createCookieStorage: (overrides?: BrowserOptions | undefine
58
66
  includeReferrer: boolean;
59
67
  includeUtm: boolean;
60
68
  sessionTimeout: number;
69
+ storageProvider: MemoryStorage<Event[]>;
61
70
  trackingOptions: {
62
71
  city: boolean;
63
72
  country: boolean;
@@ -75,9 +84,8 @@ export declare const createCookieStorage: (overrides?: BrowserOptions | undefine
75
84
  };
76
85
  transportProvider: FetchTransport;
77
86
  }) => Storage<UserSession>;
78
- export declare const createEventsStorage: (overrides?: BrowserOptions | undefined) => Storage<import("@amplitude/analytics-types").Event[]>;
87
+ export declare const createEventsStorage: (overrides?: BrowserOptions | undefined) => Storage<Event[]>;
79
88
  export declare const createDeviceId: (idFromCookies?: string | undefined, idFromOptions?: string | undefined, idFromQueryParams?: string | undefined) => string;
80
89
  export declare const createSessionId: (idFromCookies: number | undefined, idFromOptions: number | undefined, lastEventTime: number | undefined, sessionTimeout: number) => number;
81
90
  export declare const createTransport: (transport?: TransportType | undefined) => FetchTransport | XHRTransport | SendBeaconTransport;
82
- export declare const getConfig: () => BrowserConfig;
83
91
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,IAAI,cAAc,EAC/B,OAAO,EACP,eAAe,EACf,aAAa,EACb,WAAW,EACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,MAAM,EAA2B,MAAM,2BAA2B,CAAC;AAG5E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAMpD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BzB,CAAC;AAEF,qBAAa,aAAc,SAAQ,MAAO,YAAW,cAAc;IACjE,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;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