@pagelines/sdk 1.0.391 → 1.0.393

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/dist/sdkClient.js CHANGED
@@ -1,22 +1,22 @@
1
1
  var W = Object.defineProperty;
2
2
  var Q = (a, e, t) => e in a ? W(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
- var h = (a, e) => W(a, "name", { value: e, configurable: !0 });
3
+ var u = (a, e) => W(a, "name", { value: e, configurable: !0 });
4
4
  var i = (a, e, t) => Q(a, typeof e != "symbol" ? e + "" : e, t);
5
- import { APP_PORT as V, APP_PROD_URL as X, cookieUtil as x, createLogger as Y, objectId as D, SettingsObject as Z } from "@pagelines/core";
5
+ import { APP_PORT as V, APP_PROD_URL as X, cookieUtil as x, createLogger as Y, objectId as $, SettingsObject as Z } from "@pagelines/core";
6
6
  import { watch as q, ref as k, computed as z } from "vue";
7
7
  import { hc as ee } from "hono/client";
8
- function v(a, e) {
8
+ function p(a, e) {
9
9
  return a || (e ? `http://localhost:${V}` : X);
10
10
  }
11
- h(v, "resolveApiBase");
11
+ u(p, "resolveApiBase");
12
12
  function te(a, e) {
13
- const t = v(a.apiBase, a.isDev);
13
+ const t = p(a.apiBase, a.isDev);
14
14
  return ee(t, {
15
- fetch: /* @__PURE__ */ h(async (o, s) => {
16
- const n = x.getAuthToken(), l = await fetch(o, {
17
- ...s,
15
+ fetch: /* @__PURE__ */ u(async (s, o) => {
16
+ const n = x.getAuthToken(), l = await fetch(s, {
17
+ ...o,
18
18
  headers: {
19
- ...s?.headers,
19
+ ...o?.headers,
20
20
  "Content-Type": "application/json",
21
21
  // Only include Authorization header if token exists
22
22
  ...n && { Authorization: `Bearer ${n}` }
@@ -35,9 +35,9 @@ function te(a, e) {
35
35
  }, "fetch")
36
36
  });
37
37
  }
38
- h(te, "createApiClient");
38
+ u(te, "createApiClient");
39
39
  let re = /* @__PURE__ */ Symbol("clean"), d = [], f = 0;
40
- const A = 4, K = /* @__PURE__ */ h(/* @__NO_SIDE_EFFECTS__ */ (a) => {
40
+ const b = 4, K = /* @__PURE__ */ u(/* @__NO_SIDE_EFFECTS__ */ (a) => {
41
41
  let e = [], t = {
42
42
  get() {
43
43
  return t.lc || t.listen(() => {
@@ -46,18 +46,18 @@ const A = 4, K = /* @__PURE__ */ h(/* @__NO_SIDE_EFFECTS__ */ (a) => {
46
46
  lc: 0,
47
47
  listen(r) {
48
48
  return t.lc = e.push(r), () => {
49
- for (let s = f + A; s < d.length; )
50
- d[s] === r ? d.splice(s, A) : s += A;
51
- let o = e.indexOf(r);
52
- ~o && (e.splice(o, 1), --t.lc || t.off());
49
+ for (let o = f + b; o < d.length; )
50
+ d[o] === r ? d.splice(o, b) : o += b;
51
+ let s = e.indexOf(r);
52
+ ~s && (e.splice(s, 1), --t.lc || t.off());
53
53
  };
54
54
  },
55
- notify(r, o) {
56
- let s = !d.length;
55
+ notify(r, s) {
56
+ let o = !d.length;
57
57
  for (let n of e)
58
- d.push(n, t.value, r, o);
59
- if (s) {
60
- for (f = 0; f < d.length; f += A)
58
+ d.push(n, t.value, r, s);
59
+ if (o) {
60
+ for (f = 0; f < d.length; f += b)
61
61
  d[f](
62
62
  d[f + 1],
63
63
  d[f + 2],
@@ -71,19 +71,19 @@ const A = 4, K = /* @__PURE__ */ h(/* @__NO_SIDE_EFFECTS__ */ (a) => {
71
71
  off() {
72
72
  },
73
73
  set(r) {
74
- let o = t.value;
75
- o !== r && (t.value = r, t.notify(o));
74
+ let s = t.value;
75
+ s !== r && (t.value = r, t.notify(s));
76
76
  },
77
77
  subscribe(r) {
78
- let o = t.listen(r);
79
- return r(t.value), o;
78
+ let s = t.listen(r);
79
+ return r(t.value), s;
80
80
  },
81
81
  value: a
82
82
  };
83
83
  return process.env.NODE_ENV !== "production" && (t[re] = () => {
84
84
  e = [], t.lc = 0, t.off();
85
85
  }), t;
86
- }, "atom"), y = globalThis, U = y.__PL_AUTH_USER__ ?? (y.__PL_AUTH_USER__ = /* @__PURE__ */ K(void 0)), b = y.__PL_AUTH_TOKEN__ ?? (y.__PL_AUTH_TOKEN__ = /* @__PURE__ */ K(null)), F = class F {
86
+ }, "atom"), y = globalThis, A = y.__PL_AUTH_USER__ ?? (y.__PL_AUTH_USER__ = /* @__PURE__ */ K(void 0)), U = y.__PL_AUTH_TOKEN__ ?? (y.__PL_AUTH_TOKEN__ = /* @__PURE__ */ K(null)), F = class F {
87
87
  constructor() {
88
88
  i(this, "logger", Y("SDKStorage"));
89
89
  }
@@ -97,15 +97,15 @@ const A = 4, K = /* @__PURE__ */ h(/* @__NO_SIDE_EFFECTS__ */ (a) => {
97
97
  * Sync Vue reactive refs with global nanostores for cross-page persistence
98
98
  */
99
99
  syncWithGlobalStores(e, t) {
100
- const r = U.get(), o = b.get();
101
- r && (e.value = r), o && (t.value = o), q(e, (s) => {
102
- U.set(s);
103
- }, { immediate: !0 }), q(t, (s) => {
104
- b.set(s);
105
- }, { immediate: !0 }), U.subscribe((s) => {
106
- s !== e.value && (e.value = s);
107
- }), b.subscribe((s) => {
108
- s !== t.value && (t.value = s);
100
+ const r = A.get(), s = U.get();
101
+ r && (e.value = r), s && (t.value = s), q(e, (o) => {
102
+ A.set(o);
103
+ }, { immediate: !0 }), q(t, (o) => {
104
+ U.set(o);
105
+ }, { immediate: !0 }), A.subscribe((o) => {
106
+ o !== e.value && (e.value = o);
107
+ }), U.subscribe((o) => {
108
+ o !== t.value && (t.value = o);
109
109
  });
110
110
  }
111
111
  /**
@@ -117,10 +117,10 @@ const A = 4, K = /* @__PURE__ */ h(/* @__NO_SIDE_EFFECTS__ */ (a) => {
117
117
  const r = x.getAuthToken();
118
118
  if (r && (t.value = r), this.isLocalStorageFunctional())
119
119
  try {
120
- const o = localStorage.getItem("pagelines-user");
121
- o && (e.value = JSON.parse(o));
122
- } catch (o) {
123
- this.logger.error("Failed to load user from localStorage", { data: o });
120
+ const s = localStorage.getItem("pagelines-user");
121
+ s && (e.value = JSON.parse(s));
122
+ } catch (s) {
123
+ this.logger.error("Failed to load user from localStorage", { data: s });
124
124
  }
125
125
  }
126
126
  /**
@@ -145,7 +145,7 @@ const A = 4, K = /* @__PURE__ */ h(/* @__NO_SIDE_EFFECTS__ */ (a) => {
145
145
  } catch (e) {
146
146
  this.logger.error("Failed to clear user from localStorage", { data: e });
147
147
  }
148
- U.set(void 0), b.set(null);
148
+ A.set(void 0), U.set(null);
149
149
  }
150
150
  }
151
151
  /**
@@ -172,19 +172,19 @@ const A = 4, K = /* @__PURE__ */ h(/* @__NO_SIDE_EFFECTS__ */ (a) => {
172
172
  }
173
173
  }
174
174
  };
175
- h(F, "SDKStorage");
176
- let $ = F;
175
+ u(F, "SDKStorage");
176
+ let B = F;
177
177
  const J = [
178
178
  "Deploying your server...",
179
179
  "Setting up your workspace...",
180
180
  "Installing tools...",
181
181
  "Almost ready..."
182
- ], R = class R {
182
+ ], O = class O {
183
183
  constructor(e) {
184
184
  this.ctx = e;
185
185
  }
186
186
  async create(e) {
187
- const t = e.orgId || this.resolveOrgId(), r = v(this.ctx.apiBase, this.ctx.isDev), s = await (await fetch(`${r}/api/agent`, {
187
+ const t = e.orgId || this.resolveOrgId(), r = p(this.ctx.apiBase, this.ctx.isDev), o = await (await fetch(`${r}/api/agent`, {
188
188
  method: "POST",
189
189
  headers: {
190
190
  "Content-Type": "application/json",
@@ -192,24 +192,24 @@ const J = [
192
192
  },
193
193
  body: JSON.stringify({ name: e.name, orgId: t })
194
194
  })).json();
195
- if (!s.ok || !s.data?.[0]) {
196
- const n = s.error || "Failed to create agent";
195
+ if (!o.ok || !o.data?.[0]) {
196
+ const n = o.error || "Failed to create agent";
197
197
  throw this.ctx.error.value = n, new Error(n);
198
198
  }
199
- return this.ctx.processApiResponse(s), s.data[0];
199
+ return this.ctx.processApiResponse(o), o.data[0];
200
200
  }
201
201
  async getStatus(e) {
202
- const t = v(this.ctx.apiBase, this.ctx.isDev), o = await (await fetch(`${t}/api/agent/${e.agentId}/status`, {
202
+ const t = p(this.ctx.apiBase, this.ctx.isDev), s = await (await fetch(`${t}/api/agent/${e.agentId}/status`, {
203
203
  headers: {
204
204
  ...this.ctx.token.value && { Authorization: `Bearer ${this.ctx.token.value}` }
205
205
  }
206
206
  })).json();
207
- return !o.ok || !o.data ? { status: "unknown", ready: !1, error: "Failed to check status" } : o.data;
207
+ return !s.ok || !s.data ? { status: "unknown", ready: !1, error: "Failed to check status" } : s.data;
208
208
  }
209
209
  async waitUntilReady(e) {
210
- const { agentId: t, onStatus: r, timeoutMs: o = 3e5, pollIntervalMs: s = 3e3 } = e, n = Date.now();
210
+ const { agentId: t, onStatus: r, timeoutMs: s = 3e5, pollIntervalMs: o = 3e3 } = e, n = Date.now();
211
211
  let l = 0;
212
- for (; Date.now() - n < o; ) {
212
+ for (; Date.now() - n < s; ) {
213
213
  const g = await this.getStatus({ agentId: t });
214
214
  if (g.ready) {
215
215
  r?.("Ready!");
@@ -217,10 +217,25 @@ const J = [
217
217
  }
218
218
  if (g.status === "error")
219
219
  throw new Error(g.error || "Provisioning failed");
220
- r && l < J.length && (r(J[l]), l++), await new Promise((c) => setTimeout(c, s));
220
+ r && l < J.length && (r(J[l]), l++), await new Promise((c) => setTimeout(c, o));
221
221
  }
222
222
  throw new Error("Agent provisioning timed out — please try again");
223
223
  }
224
+ /** Send a typed webhook event to a bot agent. No auth required — the proxy is public. */
225
+ async webhook(e) {
226
+ const r = `${p(this.ctx.apiBase, this.ctx.isDev)}/api/bot-api/agents/${e.agentId}/webhook`, s = { type: e.type, data: e.data };
227
+ e.meta && (s.meta = e.meta);
228
+ const o = await fetch(r, {
229
+ method: "POST",
230
+ headers: { "Content-Type": "application/json" },
231
+ body: JSON.stringify(s)
232
+ });
233
+ if (!o.ok) {
234
+ const n = await o.text().catch(() => "Unknown error");
235
+ throw new Error(`Webhook delivery failed (${o.status}): ${n.slice(0, 200)}`);
236
+ }
237
+ return o.json();
238
+ }
224
239
  resolveOrgId() {
225
240
  const t = this.ctx.activeUser.value?.orgs?.[0]?.orgId;
226
241
  if (!t)
@@ -228,8 +243,8 @@ const J = [
228
243
  return t;
229
244
  }
230
245
  };
231
- h(R, "AgentClient");
232
- let B = R;
246
+ u(O, "AgentClient");
247
+ let D = O;
233
248
  async function m(a, e) {
234
249
  a.loading.value = !0, a.error.value = null;
235
250
  try {
@@ -238,8 +253,8 @@ async function m(a, e) {
238
253
  a.loading.value = !1;
239
254
  }
240
255
  }
241
- h(m, "withLoadingState");
242
- const _ = class _ {
256
+ u(m, "withLoadingState");
257
+ const R = class R {
243
258
  constructor(e) {
244
259
  this.ctx = e;
245
260
  }
@@ -261,15 +276,15 @@ const _ = class _ {
261
276
  async verifyCode(e, t) {
262
277
  return m(this.ctx, async () => {
263
278
  try {
264
- const o = await (await this.ctx.api.auth["verify-code"].$post({
279
+ const s = await (await this.ctx.api.auth["verify-code"].$post({
265
280
  json: { email: e, code: t }
266
281
  })).json();
267
- if (!o.ok)
268
- throw this.ctx.error.value = o.error, new Error(o.error);
282
+ if (!s.ok)
283
+ throw this.ctx.error.value = s.error, new Error(s.error);
269
284
  } catch (r) {
270
285
  this.ctx.logger.error("Verify code error", { data: r });
271
- const o = r instanceof Error ? r.message : "Failed to verify code";
272
- throw this.ctx.error.value = o, r;
286
+ const s = r instanceof Error ? r.message : "Failed to verify code";
287
+ throw this.ctx.error.value = s, r;
273
288
  }
274
289
  });
275
290
  }
@@ -328,44 +343,44 @@ const _ = class _ {
328
343
  this.ctx.logger.error("loginWithGoogle: Only available in browser");
329
344
  return;
330
345
  }
331
- const t = v(this.ctx.apiBase, this.ctx.isDev), r = window.location.origin, o = `${t}/auth/google-popup?origin=${encodeURIComponent(r)}`, s = 500, n = 600, l = window.screenX + (window.outerWidth - s) / 2, g = window.screenY + (window.outerHeight - n) / 2, c = window.open(
332
- o,
346
+ const t = p(this.ctx.apiBase, this.ctx.isDev), r = window.location.origin, s = `${t}/auth/google-popup?origin=${encodeURIComponent(r)}`, o = 500, n = 600, l = window.screenX + (window.outerWidth - o) / 2, g = window.screenY + (window.outerHeight - n) / 2, c = window.open(
347
+ s,
333
348
  "google-auth",
334
- `width=${s},height=${n},left=${l},top=${g},popup=yes`
349
+ `width=${o},height=${n},left=${l},top=${g},popup=yes`
335
350
  );
336
351
  if (!c) {
337
- const u = "Popup was blocked. Please allow popups for this site.";
338
- this.ctx.error.value = u, e?.onError?.(u);
352
+ const h = "Popup was blocked. Please allow popups for this site.";
353
+ this.ctx.error.value = h, e?.onError?.(h);
339
354
  return;
340
355
  }
341
- const p = /* @__PURE__ */ h((u) => {
356
+ const v = /* @__PURE__ */ u((h) => {
342
357
  const S = new URL(t).origin;
343
- if (u.origin === S) {
344
- if (u.data?.type === "auth-success") {
345
- window.removeEventListener("message", p);
346
- const { token: w, user: M } = u.data;
358
+ if (h.origin === S) {
359
+ if (h.data?.type === "auth-success") {
360
+ window.removeEventListener("message", v);
361
+ const { token: w, user: M } = h.data;
347
362
  this.ctx.processApiResponse({ ok: !0, data: {}, token: w, user: M }), this.ctx.logger.info("Google login successful"), e?.onSuccess?.(M);
348
- } else if (u.data?.type === "auth-error") {
349
- window.removeEventListener("message", p);
350
- const w = u.data.error || "Google authentication failed";
363
+ } else if (h.data?.type === "auth-error") {
364
+ window.removeEventListener("message", v);
365
+ const w = h.data.error || "Google authentication failed";
351
366
  this.ctx.error.value = w, this.ctx.logger.error("Google login failed", { error: w }), e?.onError?.(w);
352
367
  }
353
368
  }
354
369
  }, "handler");
355
- window.addEventListener("message", p);
370
+ window.addEventListener("message", v);
356
371
  const I = setInterval(() => {
357
- c.closed && (clearInterval(I), window.removeEventListener("message", p));
372
+ c.closed && (clearInterval(I), window.removeEventListener("message", v));
358
373
  }, 500);
359
374
  }
360
375
  };
361
- h(_, "AuthClient");
362
- let C = _;
363
- const O = class O {
376
+ u(R, "AuthClient");
377
+ let C = R;
378
+ const _ = class _ {
364
379
  constructor(e) {
365
380
  this.ctx = e;
366
381
  }
367
382
  async chatStream(e) {
368
- const r = `${v(this.ctx.apiBase, this.ctx.isDev)}/api/agent/public/${encodeURIComponent(e.handle)}/chat/stream`;
383
+ const r = `${p(this.ctx.apiBase, this.ctx.isDev)}/api/agent/public/${encodeURIComponent(e.handle)}/chat/stream`;
369
384
  return this._streamChat({
370
385
  url: r,
371
386
  headers: { "Content-Type": "application/json" },
@@ -385,7 +400,7 @@ const O = class O {
385
400
  });
386
401
  }
387
402
  async chatStreamAuthenticated(e) {
388
- const r = `${v(this.ctx.apiBase, this.ctx.isDev)}/api/agent/${encodeURIComponent(e.agentId)}/chat/stream`;
403
+ const r = `${p(this.ctx.apiBase, this.ctx.isDev)}/api/agent/${encodeURIComponent(e.agentId)}/chat/stream`;
389
404
  return this._streamChat({
390
405
  url: r,
391
406
  headers: {
@@ -423,32 +438,32 @@ const O = class O {
423
438
  e.onError("No response stream");
424
439
  return;
425
440
  }
426
- const o = new TextDecoder();
427
- let s = "", n = e.conversationId || "";
441
+ const s = new TextDecoder();
442
+ let o = "", n = e.conversationId || "";
428
443
  for (; ; ) {
429
444
  const { done: l, value: g } = await r.read();
430
445
  if (l)
431
446
  break;
432
- s += o.decode(g, { stream: !0 });
433
- const c = s.split(`
447
+ o += s.decode(g, { stream: !0 });
448
+ const c = o.split(`
434
449
  `);
435
- s = c.pop() || "";
436
- for (const p of c) {
437
- if (!p.startsWith("data: "))
450
+ o = c.pop() || "";
451
+ for (const v of c) {
452
+ if (!v.startsWith("data: "))
438
453
  continue;
439
- const I = p.slice(6).trim();
454
+ const I = v.slice(6).trim();
440
455
  if (I === "[DONE]") {
441
456
  e.onDone(n);
442
457
  return;
443
458
  }
444
459
  try {
445
- const u = JSON.parse(I);
446
- if (u.pl_status) {
447
- e.onStatus?.(u.pl_status);
460
+ const h = JSON.parse(I);
461
+ if (h.pl_status) {
462
+ e.onStatus?.(h.pl_status);
448
463
  continue;
449
464
  }
450
- u.pl_metadata?.conversationId && (n = u.pl_metadata.conversationId);
451
- const S = u.choices?.[0]?.delta;
465
+ h.pl_metadata?.conversationId && (n = h.pl_metadata.conversationId);
466
+ const S = h.choices?.[0]?.delta;
452
467
  S?.content && e.onDelta(S.content);
453
468
  } catch {
454
469
  }
@@ -460,9 +475,9 @@ const O = class O {
460
475
  }
461
476
  }
462
477
  async chatMessage(e) {
463
- const r = `${v(this.ctx.apiBase, this.ctx.isDev)}/api/agent/public/${encodeURIComponent(e.handle)}/chat`;
478
+ const r = `${p(this.ctx.apiBase, this.ctx.isDev)}/api/agent/public/${encodeURIComponent(e.handle)}/chat`;
464
479
  try {
465
- const s = await (await fetch(r, {
480
+ const o = await (await fetch(r, {
466
481
  method: "POST",
467
482
  headers: { "Content-Type": "application/json" },
468
483
  body: JSON.stringify({
@@ -472,22 +487,22 @@ const O = class O {
472
487
  context: e.context
473
488
  })
474
489
  })).json();
475
- if (!s.ok || !s.data) {
476
- this.ctx.logger.error("chatMessage failed", { error: !s.ok && "error" in s ? s.error : "Unknown" });
490
+ if (!o.ok || !o.data) {
491
+ this.ctx.logger.error("chatMessage failed", { error: !o.ok && "error" in o ? o.error : "Unknown" });
477
492
  return;
478
493
  }
479
494
  return {
480
- conversationId: s.data.conversationId,
481
- content: s.data.message.content
495
+ conversationId: o.data.conversationId,
496
+ content: o.data.message.content
482
497
  };
483
- } catch (o) {
484
- this.ctx.logger.error("chatMessage error", { error: o });
498
+ } catch (s) {
499
+ this.ctx.logger.error("chatMessage error", { error: s });
485
500
  return;
486
501
  }
487
502
  }
488
503
  };
489
- h(O, "ChatClient");
490
- let P = O;
504
+ u(_, "ChatClient");
505
+ let P = _;
491
506
  const N = class N {
492
507
  constructor(e) {
493
508
  this.ctx = e;
@@ -531,7 +546,7 @@ const N = class N {
531
546
  generateAnonId() {
532
547
  const e = "pagelinesAnonId";
533
548
  let t = this.ctx.storage.getItem(e);
534
- return t || (t = D({ prefix: "anon" }), this.ctx.storage.setItem(e, t)), t;
549
+ return t || (t = $({ prefix: "anon" }), this.ctx.storage.setItem(e, t)), t;
535
550
  }
536
551
  track(e) {
537
552
  try {
@@ -546,7 +561,7 @@ const N = class N {
546
561
  }
547
562
  }
548
563
  };
549
- h(N, "UserClient");
564
+ u(N, "UserClient");
550
565
  let j = N;
551
566
  const G = class G {
552
567
  constructor() {
@@ -563,7 +578,7 @@ const G = class G {
563
578
  typeof window < "u" && delete globalThis[this.key];
564
579
  }
565
580
  };
566
- h(G, "SDKGlobal");
581
+ u(G, "SDKGlobal");
567
582
  let L = G;
568
583
  const E = new L(), T = class T extends Z {
569
584
  constructor(t = {}) {
@@ -578,9 +593,9 @@ const E = new L(), T = class T extends Z {
578
593
  i(this, "error", k(null));
579
594
  i(this, "apiBase", this.settings.apiBase || void 0);
580
595
  // Storage handler for persistence
581
- i(this, "storage", new $());
596
+ i(this, "storage", new B());
582
597
  // Auto-managed session ID for usage tracking
583
- i(this, "sessionId", D({ prefix: "ses" }));
598
+ i(this, "sessionId", $({ prefix: "ses" }));
584
599
  // Typed Hono RPC client - uses SDKAppType (auth/self/usage routes only)
585
600
  // Initialized in constructor (definite assignment via singleton pattern)
586
601
  i(this, "apiClient");
@@ -591,7 +606,7 @@ const E = new L(), T = class T extends Z {
591
606
  return;
592
607
  const r = t.primaryAgentId || t.agents[0]?.agentId;
593
608
  if (r)
594
- return t.agents.find((o) => o.agentId === r);
609
+ return t.agents.find((s) => s.agentId === r);
595
610
  }));
596
611
  i(this, "currentOrg", z(() => {
597
612
  const t = this.currentAgent.value;
@@ -599,7 +614,7 @@ const E = new L(), T = class T extends Z {
599
614
  return;
600
615
  const r = this.activeUser.value;
601
616
  if (r?.orgs)
602
- return r.orgs.find((o) => o.orgId === t.orgId);
617
+ return r.orgs.find((s) => s.orgId === t.orgId);
603
618
  }));
604
619
  // Initialization state
605
620
  i(this, "initialized");
@@ -613,7 +628,7 @@ const E = new L(), T = class T extends Z {
613
628
  { isDev: this.isDev, apiBase: this.apiBase },
614
629
  this.processApiResponse.bind(this)
615
630
  );
616
- const o = {
631
+ const s = {
617
632
  api: this.api,
618
633
  apiBase: this.apiBase,
619
634
  isDev: this.isDev,
@@ -627,12 +642,12 @@ const E = new L(), T = class T extends Z {
627
642
  logger: this.logger,
628
643
  processApiResponse: this.processApiResponse.bind(this)
629
644
  };
630
- this.agent = new B(o), this.auth = new C(o), this.chat = new P(o), this.user = new j(o), this.logger.info("PageLinesSDK initialized"), this.storage.loadFromStorage(this.activeUser, this.token), this.storage.syncWithGlobalStores(this.activeUser, this.token), this.initialized = new Promise((s) => {
631
- this.resolveUser = s;
632
- }), this.token.value && !this.activeUser.value ? this.getCurrentUser().then((s) => {
633
- this.resolveUser && (this.resolveUser(s), this.resolveUser = void 0);
634
- }).catch((s) => {
635
- this.logger.error("Auto user fetch failed", { data: s }), this.resolveUser && (this.resolveUser(void 0), this.resolveUser = void 0);
645
+ this.agent = new D(s), this.auth = new C(s), this.chat = new P(s), this.user = new j(s), this.logger.info("PageLinesSDK initialized"), this.storage.loadFromStorage(this.activeUser, this.token), this.storage.syncWithGlobalStores(this.activeUser, this.token), this.initialized = new Promise((o) => {
646
+ this.resolveUser = o;
647
+ }), this.token.value && !this.activeUser.value ? this.getCurrentUser().then((o) => {
648
+ this.resolveUser && (this.resolveUser(o), this.resolveUser = void 0);
649
+ }).catch((o) => {
650
+ this.logger.error("Auto user fetch failed", { data: o }), this.resolveUser && (this.resolveUser(void 0), this.resolveUser = void 0);
636
651
  }) : this.activeUser.value ? this.resolveUser?.(this.activeUser.value) : this.resolveUser?.(void 0);
637
652
  }
638
653
  /**
@@ -661,7 +676,7 @@ const E = new L(), T = class T extends Z {
661
676
  }
662
677
  // Full reset - clears session + state + destroys singleton
663
678
  clear() {
664
- this.logger.info("Clearing SDK completely"), this.clearSession(), this.loading.value = !1, this.sessionId = D({ prefix: "ses" }), E.delete();
679
+ this.logger.info("Clearing SDK completely"), this.clearSession(), this.loading.value = !1, this.sessionId = $({ prefix: "ses" }), E.delete();
665
680
  }
666
681
  // Backward-compatible delegates — these forward to sub-clients
667
682
  // Can be removed in a future breaking change
@@ -708,14 +723,14 @@ const E = new L(), T = class T extends Z {
708
723
  return this.user.track(t);
709
724
  }
710
725
  };
711
- h(T, "PageLinesSDK");
726
+ u(T, "PageLinesSDK");
712
727
  let H = T;
713
728
  export {
714
- B as A,
729
+ D as A,
715
730
  P as C,
716
731
  H as P,
717
732
  j as U,
718
733
  C as a,
719
- v as r
734
+ p as r
720
735
  };
721
736
  //# sourceMappingURL=sdkClient.js.map