@growth-loop/sdk 0.1.1 → 0.1.2
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 +4 -2
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +11 -2
- package/dist/browser.js.map +1 -1
- package/dist/{client-CC-8sBba.d.ts → client-CUopXrmX.d.ts} +9 -1
- package/dist/index.d.ts +26 -3
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +11 -2
- package/dist/node.js.map +1 -1
- package/package.json +1 -1
package/dist/node.d.ts
CHANGED
package/dist/node.js
CHANGED
|
@@ -4206,7 +4206,7 @@ var Queue = class {
|
|
|
4206
4206
|
|
|
4207
4207
|
// src/version.ts
|
|
4208
4208
|
var SDK_NAME = "growth-js";
|
|
4209
|
-
var SDK_VERSION = "0.
|
|
4209
|
+
var SDK_VERSION = "0.1.2";
|
|
4210
4210
|
|
|
4211
4211
|
// src/client.ts
|
|
4212
4212
|
var DEFAULT_HOST = "https://api.growth-loop.dev";
|
|
@@ -4219,8 +4219,10 @@ var Growth = class {
|
|
|
4219
4219
|
queue;
|
|
4220
4220
|
onError;
|
|
4221
4221
|
debug;
|
|
4222
|
+
source;
|
|
4222
4223
|
context;
|
|
4223
4224
|
distinctId;
|
|
4225
|
+
sessionId;
|
|
4224
4226
|
flushTimer = null;
|
|
4225
4227
|
closed = false;
|
|
4226
4228
|
constructor(options) {
|
|
@@ -4232,6 +4234,8 @@ var Growth = class {
|
|
|
4232
4234
|
this.transport = options.transport ?? fetchTransport;
|
|
4233
4235
|
this.context = options.defaultContext ?? {};
|
|
4234
4236
|
this.distinctId = generateId();
|
|
4237
|
+
this.sessionId = options.sessionId;
|
|
4238
|
+
this.source = options.source ?? "web";
|
|
4235
4239
|
this.onError = options.onError ?? (() => {
|
|
4236
4240
|
});
|
|
4237
4241
|
this.debug = options.debug ?? false;
|
|
@@ -4252,6 +4256,9 @@ var Growth = class {
|
|
|
4252
4256
|
setDistinctId(id) {
|
|
4253
4257
|
this.distinctId = id;
|
|
4254
4258
|
}
|
|
4259
|
+
setSessionId(id) {
|
|
4260
|
+
this.sessionId = id;
|
|
4261
|
+
}
|
|
4255
4262
|
setContext(context) {
|
|
4256
4263
|
this.context = { ...this.context, ...context };
|
|
4257
4264
|
}
|
|
@@ -4260,8 +4267,9 @@ var Growth = class {
|
|
|
4260
4267
|
const event = {
|
|
4261
4268
|
name,
|
|
4262
4269
|
distinct_id: options?.distinctId ?? this.distinctId,
|
|
4270
|
+
...this.sessionId ? { session_id: this.sessionId } : {},
|
|
4263
4271
|
timestamp: (options?.timestamp ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
4264
|
-
source:
|
|
4272
|
+
source: this.source,
|
|
4265
4273
|
properties,
|
|
4266
4274
|
context: { ...this.context, ...options?.context }
|
|
4267
4275
|
};
|
|
@@ -4323,6 +4331,7 @@ var Growth = class {
|
|
|
4323
4331
|
function createServerClient(options) {
|
|
4324
4332
|
const client = new Growth({
|
|
4325
4333
|
...options,
|
|
4334
|
+
source: options.source ?? "server",
|
|
4326
4335
|
defaultContext: {
|
|
4327
4336
|
...options.defaultContext,
|
|
4328
4337
|
release: options.release,
|