@statsig/client-core 1.8.0-beta.3 → 1.8.0-beta.5
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/package.json +1 -1
- package/src/NetworkConfig.d.ts +3 -3
- package/src/NetworkConfig.js +3 -3
- package/src/NetworkCore.d.ts +1 -0
- package/src/NetworkCore.js +17 -0
- package/src/StatsigMetadata.d.ts +1 -1
- package/src/StatsigMetadata.js +1 -1
package/package.json
CHANGED
package/src/NetworkConfig.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const NetworkDefault: {
|
|
2
|
-
eventsApi: "https://
|
|
3
|
-
initializeApi: "https://
|
|
4
|
-
specsApi: "https://
|
|
2
|
+
eventsApi: "https://statsigapi.net/v1";
|
|
3
|
+
initializeApi: "https://statsigapi.net/v1";
|
|
4
|
+
specsApi: "https://statsigapi.net/v1";
|
|
5
5
|
};
|
|
6
6
|
export type NetworkPriority = 'high' | 'low' | 'auto';
|
|
7
7
|
export type NetworkArgs = RequestInit & {
|
package/src/NetworkConfig.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NetworkParam = exports.NetworkDefault = void 0;
|
|
4
4
|
exports.NetworkDefault = {
|
|
5
|
-
eventsApi: 'https://
|
|
6
|
-
initializeApi: 'https://
|
|
7
|
-
specsApi: 'https://
|
|
5
|
+
eventsApi: 'https://statsigapi.net/v1',
|
|
6
|
+
initializeApi: 'https://statsigapi.net/v1',
|
|
7
|
+
specsApi: 'https://statsigapi.net/v1',
|
|
8
8
|
};
|
|
9
9
|
var NetworkParam;
|
|
10
10
|
(function (NetworkParam) {
|
package/src/NetworkCore.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export declare class NetworkCore {
|
|
|
29
29
|
private readonly _netConfig;
|
|
30
30
|
private readonly _options;
|
|
31
31
|
private _proxy;
|
|
32
|
+
private networkEvents;
|
|
32
33
|
constructor(options: AnyStatsigOptions | null, _emitter?: StatsigClientEmitEventFunc | undefined);
|
|
33
34
|
post(args: RequestArgsWithData): Promise<NetworkResponse | null>;
|
|
34
35
|
get(args: RequestArgs): Promise<NetworkResponse | null>;
|
package/src/NetworkCore.js
CHANGED
|
@@ -30,6 +30,7 @@ class NetworkCore {
|
|
|
30
30
|
this._timeout = DEFAULT_TIMEOUT_MS;
|
|
31
31
|
this._netConfig = {};
|
|
32
32
|
this._options = {};
|
|
33
|
+
this.networkEvents = [];
|
|
33
34
|
if (options) {
|
|
34
35
|
this._options = options;
|
|
35
36
|
}
|
|
@@ -44,6 +45,12 @@ class NetworkCore {
|
|
|
44
45
|
post(args) {
|
|
45
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
47
|
const proxyConfigArgs = this._getNetworkProxyArgs(args);
|
|
48
|
+
if (args.url.includes('rgstr')) {
|
|
49
|
+
const events = args.data['events'];
|
|
50
|
+
events.push(...this.networkEvents);
|
|
51
|
+
this.networkEvents = [];
|
|
52
|
+
args.data['events'] = events;
|
|
53
|
+
}
|
|
47
54
|
let body = yield this._getPopulatedBody(Object.assign(Object.assign({}, args), proxyConfigArgs));
|
|
48
55
|
if (args.isStatsigEncodable) {
|
|
49
56
|
body = this._attemptToEncodeString(args, body);
|
|
@@ -86,7 +93,17 @@ class NetworkCore {
|
|
|
86
93
|
controller === null || controller === void 0 ? void 0 : controller.abort(`Timeout of ${this._timeout}ms expired.`);
|
|
87
94
|
}, this._timeout);
|
|
88
95
|
const proxyUrl = (_a = args.proxyUrl) !== null && _a !== void 0 ? _a : this._proxy.getProxyUrl(args.sdkKey, args.url);
|
|
96
|
+
const isProxy = proxyUrl != null;
|
|
89
97
|
const url = yield this._getPopulatedURL(Object.assign({ proxyUrl }, args));
|
|
98
|
+
this.networkEvents.push({
|
|
99
|
+
user: null,
|
|
100
|
+
value: isProxy ? 'proxy' : 'statsig',
|
|
101
|
+
eventName: 'proxy::network_request_tracking',
|
|
102
|
+
metadata: {
|
|
103
|
+
url,
|
|
104
|
+
},
|
|
105
|
+
time: Date.now(),
|
|
106
|
+
});
|
|
90
107
|
let response = null;
|
|
91
108
|
const keepalive = (0, VisibilityObserving_1._isUnloading)();
|
|
92
109
|
try {
|
package/src/StatsigMetadata.d.ts
CHANGED
package/src/StatsigMetadata.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StatsigMetadataProvider = exports.SDK_VERSION = void 0;
|
|
4
|
-
exports.SDK_VERSION = '1.8.0-beta.
|
|
4
|
+
exports.SDK_VERSION = '1.8.0-beta.5';
|
|
5
5
|
let metadata = {
|
|
6
6
|
sdkVersion: exports.SDK_VERSION,
|
|
7
7
|
sdkType: 'js-mono', // js-mono is overwritten by Precomp and OnDevice clients
|