react-native-nitro-amplitude 0.1.0 → 0.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 +166 -53
- package/cpp/bindings/HybridAmplitudeWorker.cpp +22 -6
- package/lib/commonjs/analytics/react-native-client.js +13 -8
- package/lib/commonjs/analytics/react-native-client.js.map +1 -1
- package/lib/commonjs/experiment/transport/http.js +8 -2
- package/lib/commonjs/experiment/transport/http.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.web.js +289 -13
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/native/context.web.js +26 -0
- package/lib/commonjs/native/context.web.js.map +1 -0
- package/lib/commonjs/native/http.web.js +15 -0
- package/lib/commonjs/native/http.web.js.map +1 -0
- package/lib/commonjs/native/storage.web.js +135 -0
- package/lib/commonjs/native/storage.web.js.map +1 -0
- package/lib/module/analytics/react-native-client.js +13 -8
- package/lib/module/analytics/react-native-client.js.map +1 -1
- package/lib/module/experiment/transport/http.js +8 -2
- package/lib/module/experiment/transport/http.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.web.js +47 -11
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/native/context.web.js +18 -0
- package/lib/module/native/context.web.js.map +1 -0
- package/lib/module/native/http.web.js +10 -0
- package/lib/module/native/http.web.js.map +1 -0
- package/lib/module/native/storage.web.js +128 -0
- package/lib/module/native/storage.web.js.map +1 -0
- package/lib/typescript/analytics/react-native-client.d.ts +3 -6
- package/lib/typescript/analytics/react-native-client.d.ts.map +1 -1
- package/lib/typescript/experiment/transport/http.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.web.d.ts +27 -8
- package/lib/typescript/index.web.d.ts.map +1 -1
- package/lib/typescript/native/context.web.d.ts +8 -0
- package/lib/typescript/native/context.web.d.ts.map +1 -0
- package/lib/typescript/native/http.web.d.ts +6 -0
- package/lib/typescript/native/http.web.d.ts.map +1 -0
- package/lib/typescript/native/storage.web.d.ts +30 -0
- package/lib/typescript/native/storage.web.d.ts.map +1 -0
- package/package.json +4 -2
- package/src/analytics/react-native-client.ts +21 -9
- package/src/experiment/transport/http.ts +10 -2
- package/src/index.ts +1 -1
- package/src/index.web.ts +61 -14
- package/src/native/context.web.ts +38 -0
- package/src/native/http.web.ts +22 -0
- package/src/native/storage.web.ts +152 -0
|
@@ -3,20 +3,296 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
add: true,
|
|
8
|
+
flush: true,
|
|
9
|
+
getDeviceId: true,
|
|
10
|
+
getSessionId: true,
|
|
11
|
+
getUserId: true,
|
|
12
|
+
groupIdentify: true,
|
|
13
|
+
identify: true,
|
|
14
|
+
init: true,
|
|
15
|
+
logEvent: true,
|
|
16
|
+
remove: true,
|
|
17
|
+
reset: true,
|
|
18
|
+
revenue: true,
|
|
19
|
+
setDeviceId: true,
|
|
20
|
+
setGroup: true,
|
|
21
|
+
setOptOut: true,
|
|
22
|
+
setSessionId: true,
|
|
23
|
+
setUserId: true,
|
|
24
|
+
shutdown: true,
|
|
25
|
+
track: true,
|
|
26
|
+
extendSession: true,
|
|
27
|
+
VERSION: true,
|
|
28
|
+
createInstance: true,
|
|
29
|
+
prefetchNativeContext: true,
|
|
30
|
+
Types: true,
|
|
31
|
+
Revenue: true,
|
|
32
|
+
Identify: true,
|
|
33
|
+
InMemoryStorage: true,
|
|
34
|
+
LocalStorage: true,
|
|
35
|
+
MemoryStorage: true,
|
|
36
|
+
NitroAnalyticsStorage: true,
|
|
37
|
+
NitroMemoryStorage: true,
|
|
38
|
+
nitroHttpClient: true,
|
|
39
|
+
nitroTransport: true,
|
|
40
|
+
Experiment: true,
|
|
41
|
+
StubExperimentClient: true,
|
|
42
|
+
ExperimentClient: true,
|
|
43
|
+
Source: true,
|
|
44
|
+
LogLevel: true,
|
|
45
|
+
ConsoleLogger: true,
|
|
46
|
+
ExperimentLocalStorage: true,
|
|
47
|
+
ExperimentMemoryStorage: true
|
|
9
48
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
49
|
+
Object.defineProperty(exports, "ConsoleLogger", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return _consoleLogger.ConsoleLogger;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, "Experiment", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return _factory.Experiment;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, "ExperimentClient", {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return _experimentClient.ExperimentClient;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "ExperimentLocalStorage", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return _localStorage2.LocalStorage;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, "ExperimentMemoryStorage", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _localStorage2.MemoryStorage;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "Identify", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return _analyticsCore.Identify;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "InMemoryStorage", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return _localStorage.InMemoryStorage;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "LocalStorage", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return _localStorage.LocalStorage;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(exports, "LogLevel", {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return _logger.LogLevel;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "MemoryStorage", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return _localStorage.MemoryStorage;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, "NitroAnalyticsStorage", {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return _storage.NitroAnalyticsStorage;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
Object.defineProperty(exports, "NitroMemoryStorage", {
|
|
116
|
+
enumerable: true,
|
|
117
|
+
get: function () {
|
|
118
|
+
return _storage.NitroMemoryStorage;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
Object.defineProperty(exports, "Revenue", {
|
|
122
|
+
enumerable: true,
|
|
123
|
+
get: function () {
|
|
124
|
+
return _analyticsCore.Revenue;
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
Object.defineProperty(exports, "Source", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
get: function () {
|
|
130
|
+
return _source.Source;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
Object.defineProperty(exports, "StubExperimentClient", {
|
|
134
|
+
enumerable: true,
|
|
135
|
+
get: function () {
|
|
136
|
+
return _stubClient.StubExperimentClient;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
exports.add = exports.VERSION = exports.Types = void 0;
|
|
140
|
+
Object.defineProperty(exports, "createInstance", {
|
|
141
|
+
enumerable: true,
|
|
142
|
+
get: function () {
|
|
143
|
+
return _reactNativeClient.createInstance;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
exports.logEvent = exports.init = exports.identify = exports.groupIdentify = exports.getUserId = exports.getSessionId = exports.getDeviceId = exports.flush = exports.extendSession = void 0;
|
|
147
|
+
Object.defineProperty(exports, "nitroHttpClient", {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () {
|
|
150
|
+
return _http.nitroHttpClient;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
Object.defineProperty(exports, "nitroTransport", {
|
|
154
|
+
enumerable: true,
|
|
155
|
+
get: function () {
|
|
156
|
+
return _nitroTransport.nitroTransport;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
Object.defineProperty(exports, "prefetchNativeContext", {
|
|
160
|
+
enumerable: true,
|
|
161
|
+
get: function () {
|
|
162
|
+
return _context.prefetchNativeContext;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
exports.track = exports.shutdown = exports.setUserId = exports.setSessionId = exports.setOptOut = exports.setGroup = exports.setDeviceId = exports.revenue = exports.reset = exports.remove = void 0;
|
|
166
|
+
var _reactNativeClient = _interopRequireWildcard(require("./analytics/react-native-client"));
|
|
167
|
+
var _context = require("./native/context");
|
|
168
|
+
var AnalyticsTypes = _interopRequireWildcard(require("./analytics/types"));
|
|
169
|
+
exports.Types = AnalyticsTypes;
|
|
170
|
+
var _analyticsCore = require("@amplitude/analytics-core");
|
|
171
|
+
var _localStorage = require("./analytics/storage/local-storage");
|
|
172
|
+
var _storage = require("./native/storage");
|
|
173
|
+
var _http = require("./native/http");
|
|
174
|
+
var _nitroTransport = require("./analytics/nitro-transport");
|
|
175
|
+
var _config = require("./experiment/types/config");
|
|
176
|
+
Object.keys(_config).forEach(function (key) {
|
|
177
|
+
if (key === "default" || key === "__esModule") return;
|
|
178
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
179
|
+
if (key in exports && exports[key] === _config[key]) return;
|
|
180
|
+
Object.defineProperty(exports, key, {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () {
|
|
183
|
+
return _config[key];
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
var _factory = require("./experiment/factory");
|
|
188
|
+
var _stubClient = require("./experiment/stubClient");
|
|
189
|
+
var _experimentClient = require("./experiment/experimentClient");
|
|
190
|
+
var _client = require("./experiment/types/client");
|
|
191
|
+
Object.keys(_client).forEach(function (key) {
|
|
192
|
+
if (key === "default" || key === "__esModule") return;
|
|
193
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
194
|
+
if (key in exports && exports[key] === _client[key]) return;
|
|
195
|
+
Object.defineProperty(exports, key, {
|
|
196
|
+
enumerable: true,
|
|
197
|
+
get: function () {
|
|
198
|
+
return _client[key];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
var _source = require("./experiment/types/source");
|
|
203
|
+
var _user = require("./experiment/types/user");
|
|
204
|
+
Object.keys(_user).forEach(function (key) {
|
|
205
|
+
if (key === "default" || key === "__esModule") return;
|
|
206
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
207
|
+
if (key in exports && exports[key] === _user[key]) return;
|
|
208
|
+
Object.defineProperty(exports, key, {
|
|
209
|
+
enumerable: true,
|
|
210
|
+
get: function () {
|
|
211
|
+
return _user[key];
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
var _variant = require("./experiment/types/variant");
|
|
216
|
+
Object.keys(_variant).forEach(function (key) {
|
|
217
|
+
if (key === "default" || key === "__esModule") return;
|
|
218
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
219
|
+
if (key in exports && exports[key] === _variant[key]) return;
|
|
220
|
+
Object.defineProperty(exports, key, {
|
|
221
|
+
enumerable: true,
|
|
222
|
+
get: function () {
|
|
223
|
+
return _variant[key];
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
var _exposure = require("./experiment/types/exposure");
|
|
228
|
+
Object.keys(_exposure).forEach(function (key) {
|
|
229
|
+
if (key === "default" || key === "__esModule") return;
|
|
230
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
231
|
+
if (key in exports && exports[key] === _exposure[key]) return;
|
|
232
|
+
Object.defineProperty(exports, key, {
|
|
233
|
+
enumerable: true,
|
|
234
|
+
get: function () {
|
|
235
|
+
return _exposure[key];
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
var _storage2 = require("./experiment/types/storage");
|
|
240
|
+
Object.keys(_storage2).forEach(function (key) {
|
|
241
|
+
if (key === "default" || key === "__esModule") return;
|
|
242
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
243
|
+
if (key in exports && exports[key] === _storage2[key]) return;
|
|
244
|
+
Object.defineProperty(exports, key, {
|
|
245
|
+
enumerable: true,
|
|
246
|
+
get: function () {
|
|
247
|
+
return _storage2[key];
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
var _logger = require("./experiment/types/logger");
|
|
252
|
+
var _consoleLogger = require("./experiment/logger/consoleLogger");
|
|
253
|
+
var _localStorage2 = require("./experiment/storage/local-storage");
|
|
254
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
255
|
+
const {
|
|
256
|
+
add,
|
|
257
|
+
flush,
|
|
258
|
+
getDeviceId,
|
|
259
|
+
getSessionId,
|
|
260
|
+
getUserId,
|
|
261
|
+
groupIdentify,
|
|
262
|
+
identify,
|
|
263
|
+
init,
|
|
264
|
+
logEvent,
|
|
265
|
+
remove,
|
|
266
|
+
reset,
|
|
267
|
+
revenue,
|
|
268
|
+
setDeviceId,
|
|
269
|
+
setGroup,
|
|
270
|
+
setOptOut,
|
|
271
|
+
setSessionId,
|
|
272
|
+
setUserId,
|
|
273
|
+
shutdown,
|
|
274
|
+
track,
|
|
275
|
+
extendSession
|
|
276
|
+
} = _reactNativeClient.default;
|
|
277
|
+
exports.extendSession = extendSession;
|
|
13
278
|
exports.track = track;
|
|
14
|
-
|
|
279
|
+
exports.shutdown = shutdown;
|
|
280
|
+
exports.setUserId = setUserId;
|
|
281
|
+
exports.setSessionId = setSessionId;
|
|
282
|
+
exports.setOptOut = setOptOut;
|
|
283
|
+
exports.setGroup = setGroup;
|
|
284
|
+
exports.setDeviceId = setDeviceId;
|
|
285
|
+
exports.revenue = revenue;
|
|
286
|
+
exports.reset = reset;
|
|
287
|
+
exports.remove = remove;
|
|
288
|
+
exports.logEvent = logEvent;
|
|
289
|
+
exports.init = init;
|
|
15
290
|
exports.identify = identify;
|
|
16
|
-
|
|
17
|
-
exports.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
291
|
+
exports.groupIdentify = groupIdentify;
|
|
292
|
+
exports.getUserId = getUserId;
|
|
293
|
+
exports.getSessionId = getSessionId;
|
|
294
|
+
exports.getDeviceId = getDeviceId;
|
|
295
|
+
exports.flush = flush;
|
|
296
|
+
exports.add = add;
|
|
297
|
+
const VERSION = exports.VERSION = "0.2.0";
|
|
22
298
|
//# sourceMappingURL=index.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_reactNativeClient","_interopRequireWildcard","require","_context","AnalyticsTypes","exports","Types","_analyticsCore","_localStorage","_storage","_http","_nitroTransport","_config","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","defineProperty","enumerable","get","_factory","_stubClient","_experimentClient","_client","_source","_user","_variant","_exposure","_storage2","_logger","_consoleLogger","_localStorage2","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","set","getOwnPropertyDescriptor","add","flush","getDeviceId","getSessionId","getUserId","groupIdentify","identify","init","logEvent","remove","reset","revenue","setDeviceId","setGroup","setOptOut","setSessionId","setUserId","shutdown","track","extendSession","analyticsClient","VERSION"],"sourceRoot":"../../src","sources":["index.web.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAH,uBAAA,CAAAC,OAAA;AAAoDG,OAAA,CAAAC,KAAA,GAAAF,cAAA;AA0BpD,IAAAG,cAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAT,OAAA;AAIA,IAAAU,OAAA,GAAAV,OAAA;AAAAW,MAAA,CAAAC,IAAA,CAAAF,OAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAX,OAAA,IAAAA,OAAA,CAAAW,GAAA,MAAAJ,OAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAQ,cAAA,CAAAhB,OAAA,EAAAW,GAAA;IAAAM,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAX,OAAA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TC,YAAY;EACZC,SAAS;EACTC,QAAQ;EACRC,KAAK;EACLC;AACF,CAAC,GAAGC,0BAAe;AAACjE,OAAA,CAAAgE,aAAA,GAAAA,aAAA;AAAAhE,OAAA,CAAA+D,KAAA,GAAAA,KAAA;AAAA/D,OAAA,CAAA8D,QAAA,GAAAA,QAAA;AAAA9D,OAAA,CAAA6D,SAAA,GAAAA,SAAA;AAAA7D,OAAA,CAAA4D,YAAA,GAAAA,YAAA;AAAA5D,OAAA,CAAA2D,SAAA,GAAAA,SAAA;AAAA3D,OAAA,CAAA0D,QAAA,GAAAA,QAAA;AAAA1D,OAAA,CAAAyD,WAAA,GAAAA,WAAA;AAAAzD,OAAA,CAAAwD,OAAA,GAAAA,OAAA;AAAAxD,OAAA,CAAAuD,KAAA,GAAAA,KAAA;AAAAvD,OAAA,CAAAsD,MAAA,GAAAA,MAAA;AAAAtD,OAAA,CAAAqD,QAAA,GAAAA,QAAA;AAAArD,OAAA,CAAAoD,IAAA,GAAAA,IAAA;AAAApD,OAAA,CAAAmD,QAAA,GAAAA,QAAA;AAAAnD,OAAA,CAAAkD,aAAA,GAAAA,aAAA;AAAAlD,OAAA,CAAAiD,SAAA,GAAAA,SAAA;AAAAjD,OAAA,CAAAgD,YAAA,GAAAA,YAAA;AAAAhD,OAAA,CAAA+C,WAAA,GAAAA,WAAA;AAAA/C,OAAA,CAAA8C,KAAA,GAAAA,KAAA;AAAA9C,OAAA,CAAA6C,GAAA,GAAAA,GAAA;AAoCb,MAAMqB,OAAO,GAAAlE,OAAA,CAAAkE,OAAA,GAAG,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getLegacyEvents = getLegacyEvents;
|
|
7
|
+
exports.getLegacySessionData = getLegacySessionData;
|
|
8
|
+
exports.getNativeApplicationContext = getNativeApplicationContext;
|
|
9
|
+
exports.prefetchNativeContext = prefetchNativeContext;
|
|
10
|
+
exports.removeLegacyEvent = removeLegacyEvent;
|
|
11
|
+
function prefetchNativeContext() {}
|
|
12
|
+
function getNativeApplicationContext(_options) {
|
|
13
|
+
const browserNavigator = typeof navigator === "undefined" ? undefined : navigator;
|
|
14
|
+
return {
|
|
15
|
+
platform: "Web",
|
|
16
|
+
language: browserNavigator?.language ?? browserNavigator?.userLanguage
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function getLegacySessionData(_instanceName) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
function getLegacyEvents(_instanceName, _eventKind) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
function removeLegacyEvent(_instanceName, _eventKind, _eventId) {}
|
|
26
|
+
//# sourceMappingURL=context.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["prefetchNativeContext","getNativeApplicationContext","_options","browserNavigator","navigator","undefined","platform","language","userLanguage","getLegacySessionData","_instanceName","getLegacyEvents","_eventKind","removeLegacyEvent","_eventId"],"sourceRoot":"../../../src","sources":["native/context.web.ts"],"mappings":";;;;;;;;;;AAOO,SAASA,qBAAqBA,CAAA,EAAS,CAAC;AAExC,SAASC,2BAA2BA,CACzCC,QAAoC,EACV;EAC1B,MAAMC,gBAAgB,GACpB,OAAOC,SAAS,KAAK,WAAW,GAC5BC,SAAS,GACRD,SAAmC;EAC1C,OAAO;IACLE,QAAQ,EAAE,KAAK;IACfC,QAAQ,EAAEJ,gBAAgB,EAAEI,QAAQ,IAAIJ,gBAAgB,EAAEK;EAC5D,CAAC;AACH;AAEO,SAASC,oBAAoBA,CAACC,aAAqB,EAAqB;EAC7E,OAAO,CAAC,CAAC;AACX;AAEO,SAASC,eAAeA,CAC7BD,aAAqB,EACrBE,UAAkB,EACR;EACV,OAAO,EAAE;AACX;AAEO,SAASC,iBAAiBA,CAC/BH,aAAqB,EACrBE,UAAkB,EAClBE,QAAgB,EACV,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.nitroHttpClient = exports.NitroHttpClient = void 0;
|
|
7
|
+
var _http = require("../experiment/transport/http");
|
|
8
|
+
class NitroHttpClient {
|
|
9
|
+
request(requestUrl, method, headers, data, timeoutMillis = 10000) {
|
|
10
|
+
return _http.FetchHttpClient.request(requestUrl, method, headers, data ?? "", timeoutMillis);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.NitroHttpClient = NitroHttpClient;
|
|
14
|
+
const nitroHttpClient = exports.nitroHttpClient = new NitroHttpClient();
|
|
15
|
+
//# sourceMappingURL=http.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_http","require","NitroHttpClient","request","requestUrl","method","headers","data","timeoutMillis","FetchHttpClient","exports","nitroHttpClient"],"sourceRoot":"../../../src","sources":["native/http.web.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGO,MAAMC,eAAe,CAAuB;EACjDC,OAAOA,CACLC,UAAkB,EAClBC,MAAc,EACdC,OAA+B,EAC/BC,IAAmB,EACnBC,aAAa,GAAG,KAAK,EACI;IACzB,OAAOC,qBAAe,CAACN,OAAO,CAC5BC,UAAU,EACVC,MAAM,EACNC,OAAO,EACPC,IAAI,IAAI,EAAE,EACVC,aACF,CAAC;EACH;AACF;AAACE,OAAA,CAAAR,eAAA,GAAAA,eAAA;AAEM,MAAMS,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,IAAIT,eAAe,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NitroMemoryStorage = exports.NitroExperimentStorage = exports.NitroAnalyticsStorage = void 0;
|
|
7
|
+
function namespaceKey(namespace, key) {
|
|
8
|
+
return `${namespace}::${key}`;
|
|
9
|
+
}
|
|
10
|
+
class WebStringStorage {
|
|
11
|
+
static memory = new Map();
|
|
12
|
+
constructor(namespace) {
|
|
13
|
+
this.namespace = namespace;
|
|
14
|
+
}
|
|
15
|
+
get(key) {
|
|
16
|
+
const storageKey = namespaceKey(this.namespace, key);
|
|
17
|
+
try {
|
|
18
|
+
if (typeof localStorage !== "undefined") {
|
|
19
|
+
return localStorage.getItem(storageKey) ?? undefined;
|
|
20
|
+
}
|
|
21
|
+
} catch {}
|
|
22
|
+
return WebStringStorage.memory.get(storageKey);
|
|
23
|
+
}
|
|
24
|
+
set(key, value) {
|
|
25
|
+
const storageKey = namespaceKey(this.namespace, key);
|
|
26
|
+
WebStringStorage.memory.set(storageKey, value);
|
|
27
|
+
try {
|
|
28
|
+
if (typeof localStorage !== "undefined") {
|
|
29
|
+
localStorage.setItem(storageKey, value);
|
|
30
|
+
}
|
|
31
|
+
} catch {}
|
|
32
|
+
}
|
|
33
|
+
remove(key) {
|
|
34
|
+
const storageKey = namespaceKey(this.namespace, key);
|
|
35
|
+
WebStringStorage.memory.delete(storageKey);
|
|
36
|
+
try {
|
|
37
|
+
if (typeof localStorage !== "undefined") {
|
|
38
|
+
localStorage.removeItem(storageKey);
|
|
39
|
+
}
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
reset() {
|
|
43
|
+
const prefix = `${this.namespace}::`;
|
|
44
|
+
for (const key of WebStringStorage.memory.keys()) {
|
|
45
|
+
if (key.startsWith(prefix)) {
|
|
46
|
+
WebStringStorage.memory.delete(key);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
if (typeof localStorage !== "undefined") {
|
|
51
|
+
for (let index = localStorage.length - 1; index >= 0; index--) {
|
|
52
|
+
const key = localStorage.key(index);
|
|
53
|
+
if (key?.startsWith(prefix)) {
|
|
54
|
+
localStorage.removeItem(key);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} catch {}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
class NitroAnalyticsStorage {
|
|
62
|
+
constructor(namespace) {
|
|
63
|
+
this.storage = new WebStringStorage(namespace);
|
|
64
|
+
}
|
|
65
|
+
async isEnabled() {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
async get(key) {
|
|
69
|
+
const raw = await this.getRaw(key);
|
|
70
|
+
if (!raw) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(raw);
|
|
75
|
+
} catch {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async getRaw(key) {
|
|
80
|
+
return this.storage.get(key);
|
|
81
|
+
}
|
|
82
|
+
async set(key, value) {
|
|
83
|
+
this.storage.set(key, JSON.stringify(value));
|
|
84
|
+
}
|
|
85
|
+
async remove(key) {
|
|
86
|
+
this.storage.remove(key);
|
|
87
|
+
}
|
|
88
|
+
async reset() {
|
|
89
|
+
this.storage.reset();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.NitroAnalyticsStorage = NitroAnalyticsStorage;
|
|
93
|
+
class NitroExperimentStorage {
|
|
94
|
+
constructor(namespace) {
|
|
95
|
+
this.storage = new WebStringStorage(namespace);
|
|
96
|
+
}
|
|
97
|
+
async get(key) {
|
|
98
|
+
return this.storage.get(key) ?? null;
|
|
99
|
+
}
|
|
100
|
+
async put(key, value) {
|
|
101
|
+
this.storage.set(key, value);
|
|
102
|
+
}
|
|
103
|
+
async delete(key) {
|
|
104
|
+
this.storage.remove(key);
|
|
105
|
+
}
|
|
106
|
+
async reset() {
|
|
107
|
+
this.storage.reset();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
exports.NitroExperimentStorage = NitroExperimentStorage;
|
|
111
|
+
class NitroMemoryStorage {
|
|
112
|
+
values = new Map();
|
|
113
|
+
constructor(namespace) {
|
|
114
|
+
this.namespace = namespace;
|
|
115
|
+
}
|
|
116
|
+
async get(key) {
|
|
117
|
+
return this.values.get(namespaceKey(this.namespace, key)) ?? null;
|
|
118
|
+
}
|
|
119
|
+
async put(key, value) {
|
|
120
|
+
this.values.set(namespaceKey(this.namespace, key), value);
|
|
121
|
+
}
|
|
122
|
+
async delete(key) {
|
|
123
|
+
this.values.delete(namespaceKey(this.namespace, key));
|
|
124
|
+
}
|
|
125
|
+
async reset() {
|
|
126
|
+
const prefix = `${this.namespace}::`;
|
|
127
|
+
for (const key of this.values.keys()) {
|
|
128
|
+
if (key.startsWith(prefix)) {
|
|
129
|
+
this.values.delete(key);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
exports.NitroMemoryStorage = NitroMemoryStorage;
|
|
135
|
+
//# sourceMappingURL=storage.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["namespaceKey","namespace","key","WebStringStorage","memory","Map","constructor","get","storageKey","localStorage","getItem","undefined","set","value","setItem","remove","delete","removeItem","reset","prefix","keys","startsWith","index","length","NitroAnalyticsStorage","storage","isEnabled","raw","getRaw","JSON","parse","stringify","exports","NitroExperimentStorage","put","NitroMemoryStorage","values"],"sourceRoot":"../../../src","sources":["native/storage.web.ts"],"mappings":";;;;;;AAGA,SAASA,YAAYA,CAACC,SAAiB,EAAEC,GAAW,EAAU;EAC5D,OAAO,GAAGD,SAAS,KAAKC,GAAG,EAAE;AAC/B;AAEA,MAAMC,gBAAgB,CAAC;EACrB,OAAwBC,MAAM,GAAG,IAAIC,GAAG,CAAiB,CAAC;EAE1DC,WAAWA,CAAkBL,SAAiB,EAAE;IAAA,KAAnBA,SAAiB,GAAjBA,SAAiB;EAAG;EAEjDM,GAAGA,CAACL,GAAW,EAAsB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I,CAACC,SAAS,EAAEC,GAAG,CAAC,EAAEW,KAAK,CAAC;EAC3D;EAEA,MAAMG,MAAMA,CAACd,GAAW,EAAiB;IACvC,IAAI,CAACkC,MAAM,CAACpB,MAAM,CAAChB,YAAY,CAAC,IAAI,CAACC,SAAS,EAAEC,GAAG,CAAC,CAAC;EACvD;EAEA,MAAMgB,KAAKA,CAAA,EAAkB;IAC3B,MAAMC,MAAM,GAAG,GAAG,IAAI,CAAClB,SAAS,IAAI;IACpC,KAAK,MAAMC,GAAG,IAAI,IAAI,CAACkC,MAAM,CAAChB,IAAI,CAAC,CAAC,EAAE;MACpC,IAAIlB,GAAG,CAACmB,UAAU,CAACF,MAAM,CAAC,EAAE;QAC1B,IAAI,CAACiB,MAAM,CAACpB,MAAM,CAACd,GAAG,CAAC;MACzB;IACF;EACF;AACF;AAAC8B,OAAA,CAAAG,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -10,7 +10,7 @@ import { isNative } from "./utils/platform";
|
|
|
10
10
|
const START_SESSION_EVENT = "session_start";
|
|
11
11
|
const END_SESSION_EVENT = "session_end";
|
|
12
12
|
let nextConnectorOwnerId = 0;
|
|
13
|
-
|
|
13
|
+
const activeConnectorOwnerIds = new Map();
|
|
14
14
|
export class AmplitudeReactNative extends AmplitudeCore {
|
|
15
15
|
appState = "background";
|
|
16
16
|
connectorOwnerId = ++nextConnectorOwnerId;
|
|
@@ -53,7 +53,8 @@ export class AmplitudeReactNative extends AmplitudeCore {
|
|
|
53
53
|
// Set up the analytics connector to integrate with the experiment SDK.
|
|
54
54
|
// Send events from the experiment SDK and forward identifies to the
|
|
55
55
|
// identity store.
|
|
56
|
-
const
|
|
56
|
+
const connectorInstanceName = this.getConnectorInstanceName();
|
|
57
|
+
const connector = getAnalyticsConnector(connectorInstanceName);
|
|
57
58
|
connector.identityStore.setIdentity({
|
|
58
59
|
userId: this.config.userId,
|
|
59
60
|
deviceId: this.config.deviceId
|
|
@@ -83,7 +84,7 @@ export class AmplitudeReactNative extends AmplitudeCore {
|
|
|
83
84
|
connector.eventBridge.setEventReceiver(event => {
|
|
84
85
|
this.handleInternalTrackPromise(this.track(event.eventType, event.eventProperties).promise);
|
|
85
86
|
});
|
|
86
|
-
|
|
87
|
+
activeConnectorOwnerIds.set(connectorInstanceName, this.connectorOwnerId);
|
|
87
88
|
} catch (error) {
|
|
88
89
|
if (appStateHandlerInstalled) {
|
|
89
90
|
this.appStateChangeHandler?.remove();
|
|
@@ -102,11 +103,12 @@ export class AmplitudeReactNative extends AmplitudeCore {
|
|
|
102
103
|
this.q = [];
|
|
103
104
|
this.dispatchQ = [];
|
|
104
105
|
this.isReady = false;
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
const connectorInstanceName = this.config ? this.getConnectorInstanceName() : undefined;
|
|
107
|
+
if (connectorInstanceName && activeConnectorOwnerIds.get(connectorInstanceName) === this.connectorOwnerId) {
|
|
108
|
+
const connector = getAnalyticsConnector(connectorInstanceName);
|
|
107
109
|
connector.eventBridge.setEventReceiver(() => undefined);
|
|
108
110
|
connector.identityStore.setIdentity({});
|
|
109
|
-
|
|
111
|
+
activeConnectorOwnerIds.delete(connectorInstanceName);
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
handleInternalTrackPromise(promise) {
|
|
@@ -114,6 +116,9 @@ export class AmplitudeReactNative extends AmplitudeCore {
|
|
|
114
116
|
this.config?.loggerProvider?.error(`Internal track call failed: ${String(error)}`);
|
|
115
117
|
});
|
|
116
118
|
}
|
|
119
|
+
getConnectorInstanceName() {
|
|
120
|
+
return this.config.instanceName ?? "$default_instance";
|
|
121
|
+
}
|
|
117
122
|
cancelDestinationFlushes() {
|
|
118
123
|
this.timeline.plugins.forEach(plugin => {
|
|
119
124
|
if (plugin.type !== "destination") {
|
|
@@ -155,7 +160,7 @@ export class AmplitudeReactNative extends AmplitudeCore {
|
|
|
155
160
|
return;
|
|
156
161
|
}
|
|
157
162
|
this.config.userId = userId;
|
|
158
|
-
setConnectorUserId(userId);
|
|
163
|
+
setConnectorUserId(userId, this.getConnectorInstanceName());
|
|
159
164
|
}
|
|
160
165
|
getDeviceId() {
|
|
161
166
|
return this.config?.deviceId;
|
|
@@ -166,7 +171,7 @@ export class AmplitudeReactNative extends AmplitudeCore {
|
|
|
166
171
|
return;
|
|
167
172
|
}
|
|
168
173
|
this.config.deviceId = deviceId;
|
|
169
|
-
setConnectorDeviceId(deviceId);
|
|
174
|
+
setConnectorDeviceId(deviceId, this.getConnectorInstanceName());
|
|
170
175
|
}
|
|
171
176
|
identify(identify, eventOptions) {
|
|
172
177
|
if (eventOptions?.user_id) {
|