@growth-loop/sdk 0.1.1 → 0.1.3
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 +9 -4
- 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/README.md
CHANGED
|
@@ -190,12 +190,17 @@ The SDK is the ingest layer. The agent layer (Claude Code + MCP) is what
|
|
|
190
190
|
makes growth-loop different — install the MCP server too:
|
|
191
191
|
|
|
192
192
|
```sh
|
|
193
|
-
claude mcp add growth-loop
|
|
194
|
-
-e GROWTH_API_KEY=pk_live_<your-key>
|
|
193
|
+
claude mcp add growth-loop \
|
|
194
|
+
-e GROWTH_API_KEY=pk_live_<your-key> \
|
|
195
|
+
-e GROWTH_HOST=https://api.growth-loop.dev \
|
|
196
|
+
-- npx -y @growth-loop/mcp-server
|
|
195
197
|
```
|
|
196
198
|
|
|
197
|
-
Then in Claude Code: `/init` (auto-instrument), `/diagnose <metric>`,
|
|
198
|
-
`/weekly`, `/pmf`, `/icp`, `/strategy`, `/pivot`.
|
|
199
|
+
Then in Claude Code: `/growth-init` (auto-instrument), `/growth-diagnose <metric>`,
|
|
200
|
+
`/growth-weekly`, `/growth-pmf`, `/growth-icp`, `/growth-strategy`, `/growth-pivot`.
|
|
201
|
+
|
|
202
|
+
(The `growth-` prefix is intentional — it keeps our prompts out of the way
|
|
203
|
+
of Claude Code's built-in `/init` and any other editor's defaults.)
|
|
199
204
|
|
|
200
205
|
## License
|
|
201
206
|
|
package/dist/browser.d.ts
CHANGED
package/dist/browser.js
CHANGED
|
@@ -4216,7 +4216,7 @@ var Queue = class {
|
|
|
4216
4216
|
|
|
4217
4217
|
// src/version.ts
|
|
4218
4218
|
var SDK_NAME = "growth-js";
|
|
4219
|
-
var SDK_VERSION = "0.
|
|
4219
|
+
var SDK_VERSION = "0.1.3";
|
|
4220
4220
|
|
|
4221
4221
|
// src/client.ts
|
|
4222
4222
|
var DEFAULT_HOST = "https://api.growth-loop.dev";
|
|
@@ -4229,8 +4229,10 @@ var Growth = class {
|
|
|
4229
4229
|
queue;
|
|
4230
4230
|
onError;
|
|
4231
4231
|
debug;
|
|
4232
|
+
source;
|
|
4232
4233
|
context;
|
|
4233
4234
|
distinctId;
|
|
4235
|
+
sessionId;
|
|
4234
4236
|
flushTimer = null;
|
|
4235
4237
|
closed = false;
|
|
4236
4238
|
constructor(options) {
|
|
@@ -4242,6 +4244,8 @@ var Growth = class {
|
|
|
4242
4244
|
this.transport = options.transport ?? fetchTransport;
|
|
4243
4245
|
this.context = options.defaultContext ?? {};
|
|
4244
4246
|
this.distinctId = generateId();
|
|
4247
|
+
this.sessionId = options.sessionId;
|
|
4248
|
+
this.source = options.source ?? "web";
|
|
4245
4249
|
this.onError = options.onError ?? (() => {
|
|
4246
4250
|
});
|
|
4247
4251
|
this.debug = options.debug ?? false;
|
|
@@ -4262,6 +4266,9 @@ var Growth = class {
|
|
|
4262
4266
|
setDistinctId(id) {
|
|
4263
4267
|
this.distinctId = id;
|
|
4264
4268
|
}
|
|
4269
|
+
setSessionId(id) {
|
|
4270
|
+
this.sessionId = id;
|
|
4271
|
+
}
|
|
4265
4272
|
setContext(context) {
|
|
4266
4273
|
this.context = { ...this.context, ...context };
|
|
4267
4274
|
}
|
|
@@ -4270,8 +4277,9 @@ var Growth = class {
|
|
|
4270
4277
|
const event = {
|
|
4271
4278
|
name,
|
|
4272
4279
|
distinct_id: options?.distinctId ?? this.distinctId,
|
|
4280
|
+
...this.sessionId ? { session_id: this.sessionId } : {},
|
|
4273
4281
|
timestamp: (options?.timestamp ?? /* @__PURE__ */ new Date()).toISOString(),
|
|
4274
|
-
source:
|
|
4282
|
+
source: this.source,
|
|
4275
4283
|
properties,
|
|
4276
4284
|
context: { ...this.context, ...options?.context }
|
|
4277
4285
|
};
|
|
@@ -4342,6 +4350,7 @@ function createBrowserClient(options) {
|
|
|
4342
4350
|
writeSession(SESSION_KEY, sessionId);
|
|
4343
4351
|
const client = new Growth({
|
|
4344
4352
|
...options,
|
|
4353
|
+
sessionId,
|
|
4345
4354
|
defaultContext: {
|
|
4346
4355
|
...options.defaultContext,
|
|
4347
4356
|
page_url: window.location.href,
|