@pagelines/sdk 1.0.758 → 1.0.760
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/AgentProvider.js +251 -235
- package/dist/AgentProvider.js.map +1 -1
- package/dist/AgentWidgetModal.js +184 -29
- package/dist/AgentWidgetModal.js.map +1 -1
- package/dist/AgentWrap.js +821 -613
- package/dist/AgentWrap.js.map +1 -1
- package/dist/agent/AgentController.d.ts +82 -22
- package/dist/agent/index.d.ts +4 -2
- package/dist/agent/schema.d.ts +2 -17
- package/dist/agent/ui/AgentAvatar.vue.d.ts +2 -0
- package/dist/agent/ui/AgentChat.vue.d.ts +7 -0
- package/dist/agent/ui/AgentProvider.vue.d.ts +4 -0
- package/dist/agent/ui/ElCreateAgent.vue.d.ts +8 -0
- package/dist/agent/ui/{AgentModal.vue.d.ts → VoiceMode.vue.d.ts} +7 -10
- package/dist/agent/utils.d.ts +0 -4
- package/dist/agent/voice/provider.d.ts +28 -0
- package/dist/agent/voice/providers/elevenlabs/provider.d.ts +30 -0
- package/dist/agent/voice/providers/livekit/provider.d.ts +55 -0
- package/dist/agent/voice/voice-session-client.d.ts +49 -0
- package/dist/agent.js +168 -74
- package/dist/agent.js.map +1 -1
- package/dist/clients/ChatClient.d.ts +1 -9
- package/dist/contract.js +1756 -1664
- package/dist/contract.js.map +1 -1
- package/dist/demo/index.d.ts +4 -0
- package/dist/provider.js +40 -0
- package/dist/provider.js.map +1 -0
- package/dist/provider2.js +16451 -0
- package/dist/provider2.js.map +1 -0
- package/dist/provider3.js +18439 -0
- package/dist/provider3.js.map +1 -0
- package/dist/sdk.css +1 -1
- package/dist/sdkClient.d.ts +17 -0
- package/dist/sdkClient.js +37 -47
- package/dist/sdkClient.js.map +1 -1
- package/dist/widget/composables/useWidgetState.d.ts +12 -0
- package/dist/widget.js +23 -23
- package/package.json +3 -1
- package/dist/FModal.js +0 -165
- package/dist/FModal.js.map +0 -1
package/dist/sdk.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.ring-circular{animation:1s linear infinite rotate}.ring-path{will-change:stroke-dasharray;will-change:stroke-dashoffset;stroke-dasharray:1 200;stroke-dashoffset:0;stroke-linecap:round;animation:2s ease-in-out infinite dash}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 200;stroke-dashoffset:0}50%{stroke-dasharray:89 200;stroke-dashoffset:-35px}to{stroke-dasharray:89 200;stroke-dashoffset:-124px}}.nlist-enter-active,.nlist-leave-active,.nlist-move{transition:all .6s cubic-bezier(.68,-.55,.27,1.55)}.nlist-enter-from{opacity:0;transform:translate(-30px)scale(.9)}.nlist-enter-to{opacity:1;transform:translate(0)scale(1)}.nlist-leave-active{position:absolute}.nlist-leave-to{opacity:0;transform:scale(.9)}.widget-container[data-v-96deba7b]{transition:width .4s cubic-bezier(.32,.72,0,1),height .4s cubic-bezier(.32,.72,0,1),border-radius .4s cubic-bezier(.32,.72,0,1),box-shadow .4s cubic-bezier(.32,.72,0,1)}
|
|
1
|
+
.ring-circular{animation:1s linear infinite rotate}.ring-path{will-change:stroke-dasharray;will-change:stroke-dashoffset;stroke-dasharray:1 200;stroke-dashoffset:0;stroke-linecap:round;animation:2s ease-in-out infinite dash}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1 200;stroke-dashoffset:0}50%{stroke-dasharray:89 200;stroke-dashoffset:-35px}to{stroke-dasharray:89 200;stroke-dashoffset:-124px}}@keyframes pl-voice-bar-wave{0%,to{opacity:.25}50%{opacity:.9}}.pl-voice-bar-wave{animation:1.4s ease-in-out infinite pl-voice-bar-wave}@media (prefers-reduced-motion:reduce){.pl-voice-bar-wave{opacity:.5;animation:none}}.nlist-enter-active,.nlist-leave-active,.nlist-move{transition:all .6s cubic-bezier(.68,-.55,.27,1.55)}.nlist-enter-from{opacity:0;transform:translate(-30px)scale(.9)}.nlist-enter-to{opacity:1;transform:translate(0)scale(1)}.nlist-leave-active{position:absolute}.nlist-leave-to{opacity:0;transform:scale(.9)}.widget-container[data-v-96deba7b]{transition:width .4s cubic-bezier(.32,.72,0,1),height .4s cubic-bezier(.32,.72,0,1),border-radius .4s cubic-bezier(.32,.72,0,1),box-shadow .4s cubic-bezier(.32,.72,0,1)}
|
|
2
2
|
/*$vite$:1*/
|
package/dist/sdkClient.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
21
21
|
email?: string | undefined;
|
|
22
22
|
handle?: string | undefined;
|
|
23
23
|
fullName?: string | undefined;
|
|
24
|
+
linkedinUsername?: string | undefined;
|
|
24
25
|
avatarId?: string | undefined;
|
|
25
26
|
avatar?: {
|
|
26
27
|
mediaId?: string | undefined;
|
|
@@ -116,6 +117,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
116
117
|
} | undefined;
|
|
117
118
|
memberCount?: number | undefined;
|
|
118
119
|
agentCount?: number | undefined;
|
|
120
|
+
trialEligibility?: "noCard" | "cardRequired" | undefined;
|
|
119
121
|
onboarding?: {
|
|
120
122
|
completedAt?: string | undefined;
|
|
121
123
|
setupBy?: string | undefined;
|
|
@@ -190,6 +192,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
190
192
|
handle: string;
|
|
191
193
|
}[] | null | undefined;
|
|
192
194
|
model?: string | null | undefined;
|
|
195
|
+
voice?: "woman" | "man" | null | undefined;
|
|
193
196
|
billingTier?: "essential" | "professional" | "business" | undefined;
|
|
194
197
|
lastActiveAt?: string | null | undefined;
|
|
195
198
|
lastMessageAt?: string | null | undefined;
|
|
@@ -198,6 +201,9 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
198
201
|
desiredStatus?: "active" | "stopped" | null | undefined;
|
|
199
202
|
automationPrimaryChannel?: string | undefined;
|
|
200
203
|
heartbeatEnabled?: boolean | undefined;
|
|
204
|
+
heartbeatBriefingTime?: string | undefined;
|
|
205
|
+
heartbeatCheckinTime?: string | undefined;
|
|
206
|
+
heartbeatCloseoutTime?: string | undefined;
|
|
201
207
|
onboardedAt?: string | null | undefined;
|
|
202
208
|
org?: {
|
|
203
209
|
orgId: string;
|
|
@@ -244,6 +250,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
244
250
|
email?: string | undefined;
|
|
245
251
|
handle?: string | undefined;
|
|
246
252
|
fullName?: string | undefined;
|
|
253
|
+
linkedinUsername?: string | undefined;
|
|
247
254
|
avatarId?: string | undefined;
|
|
248
255
|
avatar?: {
|
|
249
256
|
mediaId?: string | undefined;
|
|
@@ -339,6 +346,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
339
346
|
} | undefined;
|
|
340
347
|
memberCount?: number | undefined;
|
|
341
348
|
agentCount?: number | undefined;
|
|
349
|
+
trialEligibility?: "noCard" | "cardRequired" | undefined;
|
|
342
350
|
onboarding?: {
|
|
343
351
|
completedAt?: string | undefined;
|
|
344
352
|
setupBy?: string | undefined;
|
|
@@ -413,6 +421,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
413
421
|
handle: string;
|
|
414
422
|
}[] | null | undefined;
|
|
415
423
|
model?: string | null | undefined;
|
|
424
|
+
voice?: "woman" | "man" | null | undefined;
|
|
416
425
|
billingTier?: "essential" | "professional" | "business" | undefined;
|
|
417
426
|
lastActiveAt?: string | null | undefined;
|
|
418
427
|
lastMessageAt?: string | null | undefined;
|
|
@@ -421,6 +430,9 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
421
430
|
desiredStatus?: "active" | "stopped" | null | undefined;
|
|
422
431
|
automationPrimaryChannel?: string | undefined;
|
|
423
432
|
heartbeatEnabled?: boolean | undefined;
|
|
433
|
+
heartbeatBriefingTime?: string | undefined;
|
|
434
|
+
heartbeatCheckinTime?: string | undefined;
|
|
435
|
+
heartbeatCloseoutTime?: string | undefined;
|
|
424
436
|
onboardedAt?: string | null | undefined;
|
|
425
437
|
org?: {
|
|
426
438
|
orgId: string;
|
|
@@ -536,6 +548,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
536
548
|
handle: string;
|
|
537
549
|
}[] | null | undefined;
|
|
538
550
|
model?: string | null | undefined;
|
|
551
|
+
voice?: "woman" | "man" | null | undefined;
|
|
539
552
|
billingTier?: "essential" | "professional" | "business" | undefined;
|
|
540
553
|
lastActiveAt?: string | null | undefined;
|
|
541
554
|
lastMessageAt?: string | null | undefined;
|
|
@@ -544,6 +557,9 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
544
557
|
desiredStatus?: "active" | "stopped" | null | undefined;
|
|
545
558
|
automationPrimaryChannel?: string | undefined;
|
|
546
559
|
heartbeatEnabled?: boolean | undefined;
|
|
560
|
+
heartbeatBriefingTime?: string | undefined;
|
|
561
|
+
heartbeatCheckinTime?: string | undefined;
|
|
562
|
+
heartbeatCloseoutTime?: string | undefined;
|
|
547
563
|
onboardedAt?: string | null | undefined;
|
|
548
564
|
org?: {
|
|
549
565
|
orgId: string;
|
|
@@ -642,6 +658,7 @@ export declare class PageLinesSDK extends SettingsObject<PageLinesSDKSettings> {
|
|
|
642
658
|
} | undefined;
|
|
643
659
|
memberCount?: number | undefined;
|
|
644
660
|
agentCount?: number | undefined;
|
|
661
|
+
trialEligibility?: "noCard" | "cardRequired" | undefined;
|
|
645
662
|
onboarding?: {
|
|
646
663
|
completedAt?: string | undefined;
|
|
647
664
|
setupBy?: string | undefined;
|
package/dist/sdkClient.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime.js";
|
|
2
|
-
import { PAGELINES_APP_CONFIG as e, SettingsObject as t, cookieUtil as n, createLogger as r, objectId as i, runAuthenticatedChatTurnStream as a, shortId as o,
|
|
3
|
-
import { computed as
|
|
2
|
+
import { PAGELINES_APP_CONFIG as e, SettingsObject as t, cookieUtil as n, createLogger as r, objectId as i, runAuthenticatedChatTurnStream as a, shortId as o, toChatStreamError as s, zChatEvent as c } from "@pagelines/core";
|
|
3
|
+
import { computed as l, ref as u, watch as d } from "vue";
|
|
4
4
|
//#region api.ts
|
|
5
5
|
function resolveApiBase(t, n) {
|
|
6
6
|
let r = Number(globalThis.process?.env?.PORT) || e.port;
|
|
@@ -28,9 +28,9 @@ function createApiFetch(e, t, r) {
|
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region ../../node_modules/.pnpm/nanostores@1.4.1/node_modules/nanostores/clean-stores/index.js
|
|
31
|
-
var
|
|
32
|
-
for (
|
|
33
|
-
|
|
31
|
+
var f = Symbol("clean"), p, m = [], h = 0, g = null, _ = 4, v = (p = globalThis).nanostoresGlobal || (p.nanostoresGlobal = { epoch: 0 }), drainQueue = () => {
|
|
32
|
+
for (h = 0; h < m.length; h += _) m[h](m[h + 1].value, m[h + 2], m[h + 3]);
|
|
33
|
+
m.length = 0;
|
|
34
34
|
}, atom = /* @__NO_SIDE_EFFECTS__ */ (e) => {
|
|
35
35
|
let t = [], n = {
|
|
36
36
|
get() {
|
|
@@ -40,15 +40,15 @@ var d = Symbol("clean"), f, p = [], m = 0, h = null, g = 4, _ = (f = globalThis)
|
|
|
40
40
|
lc: 0,
|
|
41
41
|
listen(e) {
|
|
42
42
|
return n.lc = t.push(e), () => {
|
|
43
|
-
for (let t =
|
|
43
|
+
for (let t = h + _; t < m.length;) m[t] === e ? m.splice(t, _) : t += _;
|
|
44
44
|
let r = t.indexOf(e);
|
|
45
45
|
~r && (t.splice(r, 1), --n.lc || n.off());
|
|
46
46
|
};
|
|
47
47
|
},
|
|
48
48
|
notify(e, r) {
|
|
49
|
-
|
|
50
|
-
let i = !
|
|
51
|
-
for (let i of t)
|
|
49
|
+
v.epoch++;
|
|
50
|
+
let i = !m.length && !0;
|
|
51
|
+
for (let i of t) g?.has(i) || (g?.add(i), m.push(i, n, e, r));
|
|
52
52
|
i && drainQueue();
|
|
53
53
|
},
|
|
54
54
|
off() {},
|
|
@@ -62,7 +62,7 @@ var d = Symbol("clean"), f, p = [], m = 0, h = null, g = 4, _ = (f = globalThis)
|
|
|
62
62
|
},
|
|
63
63
|
value: e
|
|
64
64
|
};
|
|
65
|
-
return process.env.NODE_ENV !== "production" && (n[
|
|
65
|
+
return process.env.NODE_ENV !== "production" && (n[f] = () => {
|
|
66
66
|
t = [], n.lc = 0, n.off();
|
|
67
67
|
}), n;
|
|
68
68
|
};
|
|
@@ -106,7 +106,7 @@ function _defineProperty(e, t, n) {
|
|
|
106
106
|
}
|
|
107
107
|
//#endregion
|
|
108
108
|
//#region sdkStorage.ts
|
|
109
|
-
var
|
|
109
|
+
var y = globalThis, b = y.__PL_AUTH_USER__ ?? (y.__PL_AUTH_USER__ = /* @__PURE__ */ atom(void 0)), x = y.__PL_AUTH_TOKEN__ ?? (y.__PL_AUTH_TOKEN__ = /* @__PURE__ */ atom(null)), S = y.__PL_AUTH_DEVICE_ID__ ?? (y.__PL_AUTH_DEVICE_ID__ = /* @__PURE__ */ atom(null)), SDKStorage = class {
|
|
110
110
|
constructor() {
|
|
111
111
|
_defineProperty(this, "logger", r("SDKStorage"));
|
|
112
112
|
}
|
|
@@ -114,12 +114,12 @@ var v = globalThis, y = v.__PL_AUTH_USER__ ?? (v.__PL_AUTH_USER__ = /* @__PURE__
|
|
|
114
114
|
return typeof window < "u" && typeof localStorage?.getItem == "function" && typeof localStorage?.setItem == "function" && typeof localStorage?.removeItem == "function";
|
|
115
115
|
}
|
|
116
116
|
syncWithGlobalStores(e) {
|
|
117
|
-
let { activeUser: t, token: n, deviceId: r } = e, i =
|
|
118
|
-
i && (t.value = i), a && (n.value = a), o && (r.value = o),
|
|
117
|
+
let { activeUser: t, token: n, deviceId: r } = e, i = b.get(), a = x.get(), o = S.get();
|
|
118
|
+
i && (t.value = i), a && (n.value = a), o && (r.value = o), d(t, (e) => b.set(e), { immediate: !0 }), d(n, (e) => x.set(e), { immediate: !0 }), d(r, (e) => S.set(e), { immediate: !0 }), b.subscribe((e) => {
|
|
119
119
|
e !== t.value && (t.value = e);
|
|
120
|
-
}), b.subscribe((e) => {
|
|
121
|
-
e !== n.value && (n.value = e);
|
|
122
120
|
}), x.subscribe((e) => {
|
|
121
|
+
e !== n.value && (n.value = e);
|
|
122
|
+
}), S.subscribe((e) => {
|
|
123
123
|
e !== r.value && (r.value = e);
|
|
124
124
|
});
|
|
125
125
|
}
|
|
@@ -149,7 +149,7 @@ var v = globalThis, y = v.__PL_AUTH_USER__ ?? (v.__PL_AUTH_USER__ = /* @__PURE__
|
|
|
149
149
|
} catch (e) {
|
|
150
150
|
this.logger.error("Failed to clear user from localStorage", { data: e });
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
b.set(void 0), x.set(null), S.set(null);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
getItem(e) {
|
|
@@ -466,7 +466,7 @@ function parseChatEvent(e) {
|
|
|
466
466
|
for (let e of t) e.startsWith("event:") ? n = e.slice(6).trim() : e.startsWith("data:") && (r = e.slice(5).trim());
|
|
467
467
|
if (!n || r === void 0) return null;
|
|
468
468
|
try {
|
|
469
|
-
let e =
|
|
469
|
+
let e = c.safeParse({
|
|
470
470
|
event: n,
|
|
471
471
|
data: JSON.parse(r)
|
|
472
472
|
});
|
|
@@ -475,16 +475,6 @@ function parseChatEvent(e) {
|
|
|
475
475
|
return null;
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
function toChatStreamError(e) {
|
|
479
|
-
return {
|
|
480
|
-
code: e.code,
|
|
481
|
-
error: e.message,
|
|
482
|
-
...e.bucket ? { bucket: e.bucket } : {},
|
|
483
|
-
...e.actionLabel ? { actionLabel: e.actionLabel } : {},
|
|
484
|
-
...e.actionUrl ? { actionUrl: e.actionUrl } : {},
|
|
485
|
-
...e.help ? { help: e.help } : {}
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
478
|
function toAuthenticatedTransportError(e) {
|
|
489
479
|
return e.stage === "stream-open" && e.message.startsWith("HTTP ") ? `Stream failed: ${e.message}` : e.message;
|
|
490
480
|
}
|
|
@@ -548,15 +538,15 @@ var ChatClient = class {
|
|
|
548
538
|
e.onError("No response stream");
|
|
549
539
|
return;
|
|
550
540
|
}
|
|
551
|
-
let
|
|
541
|
+
let c = new TextDecoder(), l = "";
|
|
552
542
|
outer: for (;;) {
|
|
553
543
|
let { done: t, value: n } = await a.read();
|
|
554
544
|
if (t) break;
|
|
555
|
-
|
|
556
|
-
let o =
|
|
545
|
+
l += c.decode(n, { stream: !0 });
|
|
546
|
+
let o = l.indexOf("\n\n");
|
|
557
547
|
for (; o !== -1;) {
|
|
558
|
-
let t =
|
|
559
|
-
|
|
548
|
+
let t = l.slice(0, o);
|
|
549
|
+
l = l.slice(o + 2);
|
|
560
550
|
let n = parseChatEvent(t);
|
|
561
551
|
if (n) {
|
|
562
552
|
if (n.event === "working_state") e.onStatus?.(n.data.description);
|
|
@@ -564,7 +554,7 @@ var ChatClient = class {
|
|
|
564
554
|
else if (n.event === "working_end") e.onWorkingEnd?.();
|
|
565
555
|
else if (n.event === "message_delta") e.onDelta(n.data.delta, n.data.role);
|
|
566
556
|
else if (n.event === "error") {
|
|
567
|
-
r = !0, e.onError(
|
|
557
|
+
r = !0, e.onError(s(n.data));
|
|
568
558
|
break outer;
|
|
569
559
|
} else if (n.event === "message" && (n.data.message.role === "assistant" || n.data.message.role === "system")) {
|
|
570
560
|
i = !0;
|
|
@@ -572,7 +562,7 @@ var ChatClient = class {
|
|
|
572
562
|
t && e.onMessage?.(t);
|
|
573
563
|
} else if (n.event === "stream_end") break outer;
|
|
574
564
|
}
|
|
575
|
-
o =
|
|
565
|
+
o = l.indexOf("\n\n");
|
|
576
566
|
}
|
|
577
567
|
}
|
|
578
568
|
!r && i ? e.onDone(n) : r || e.onError("[no-reply] Stream ended before reply arrived");
|
|
@@ -604,16 +594,16 @@ var ChatClient = class {
|
|
|
604
594
|
e.onError(t instanceof Error ? t.message : "Conversation failed");
|
|
605
595
|
return;
|
|
606
596
|
}
|
|
607
|
-
let
|
|
597
|
+
let c = i ? `${t}/api/conversations/${encodeURIComponent(r)}/stream?since=${encodeURIComponent(i)}` : `${t}/api/conversations/${encodeURIComponent(r)}/stream`, l = `nonce_${o(16)}`, u = detectBrowserTimezone();
|
|
608
598
|
await a({
|
|
609
|
-
streamUrl:
|
|
599
|
+
streamUrl: c,
|
|
610
600
|
sendUrl: `${t}/api/messages`,
|
|
611
601
|
headers: n,
|
|
612
602
|
sendBody: {
|
|
613
603
|
conversationId: r,
|
|
614
604
|
content: e.message,
|
|
615
|
-
clientNonce:
|
|
616
|
-
...
|
|
605
|
+
clientNonce: l,
|
|
606
|
+
...u ? { viewerTimezone: u } : {},
|
|
617
607
|
...e.attachments && e.attachments.length > 0 ? { attachments: e.attachments } : {}
|
|
618
608
|
},
|
|
619
609
|
onStatus: e.onStatus,
|
|
@@ -625,7 +615,7 @@ var ChatClient = class {
|
|
|
625
615
|
n && e.onMessage?.(n);
|
|
626
616
|
},
|
|
627
617
|
onDone: () => e.onDone(r),
|
|
628
|
-
onChatError: (t) => e.onError(
|
|
618
|
+
onChatError: (t) => e.onError(s(t)),
|
|
629
619
|
onTransportError: (t) => e.onError(t.code ? {
|
|
630
620
|
code: t.code,
|
|
631
621
|
error: t.message
|
|
@@ -715,27 +705,27 @@ var ChatClient = class {
|
|
|
715
705
|
delete() {
|
|
716
706
|
typeof window < "u" && delete globalThis[this.key];
|
|
717
707
|
}
|
|
718
|
-
},
|
|
708
|
+
}, C = new SDKGlobal(), w = class PageLinesSDK extends t {
|
|
719
709
|
static getInstance(e = {}) {
|
|
720
|
-
return
|
|
710
|
+
return C.get() || new PageLinesSDK(e);
|
|
721
711
|
}
|
|
722
712
|
get isDev() {
|
|
723
713
|
return this.settings.isDev ?? (typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname.includes("127.0.0.1") : !1);
|
|
724
714
|
}
|
|
725
715
|
constructor(e = {}) {
|
|
726
|
-
let t =
|
|
716
|
+
let t = C.get();
|
|
727
717
|
if (t) return console.debug("[PageLinesSDK] Returning existing singleton instance"), t;
|
|
728
|
-
super("PageLinesSDK", e), _defineProperty(this, "activeUser",
|
|
718
|
+
super("PageLinesSDK", e), _defineProperty(this, "activeUser", u()), _defineProperty(this, "token", u(null)), _defineProperty(this, "deviceId", u(null)), _defineProperty(this, "loading", u(!1)), _defineProperty(this, "error", u(null)), _defineProperty(this, "apiBase", this.settings.apiBase || void 0), _defineProperty(this, "storage", new SDKStorage()), _defineProperty(this, "sessionId", i({ prefix: "ses" })), _defineProperty(this, "currentAgent", l(() => {
|
|
729
719
|
let e = this.activeUser.value;
|
|
730
720
|
if (!e?.agents) return;
|
|
731
721
|
let t = e.primaryAgentId || e.agents[0]?.agentId;
|
|
732
722
|
if (t) return e.agents.find((e) => e.agentId === t);
|
|
733
|
-
})), _defineProperty(this, "currentOrg",
|
|
723
|
+
})), _defineProperty(this, "currentOrg", l(() => {
|
|
734
724
|
let e = this.currentAgent.value;
|
|
735
725
|
if (!e?.orgId) return;
|
|
736
726
|
let t = this.activeUser.value;
|
|
737
727
|
if (t?.orgs) return t.orgs.find((t) => t.orgId === e.orgId);
|
|
738
|
-
})), _defineProperty(this, "initialized", void 0), _defineProperty(this, "resolveUser", void 0), _defineProperty(this, "agent", void 0), _defineProperty(this, "auth", void 0), _defineProperty(this, "billing", void 0), _defineProperty(this, "chat", void 0), _defineProperty(this, "user", void 0),
|
|
728
|
+
})), _defineProperty(this, "initialized", void 0), _defineProperty(this, "resolveUser", void 0), _defineProperty(this, "agent", void 0), _defineProperty(this, "auth", void 0), _defineProperty(this, "billing", void 0), _defineProperty(this, "chat", void 0), _defineProperty(this, "user", void 0), C.set(this);
|
|
739
729
|
let n = {
|
|
740
730
|
apiFetch: createApiFetch({
|
|
741
731
|
isDev: this.isDev,
|
|
@@ -782,10 +772,10 @@ var ChatClient = class {
|
|
|
782
772
|
this.logger.info("Clearing session"), this.activeUser.value = void 0, this.token.value = null, this.deviceId.value = null, this.error.value = null, this.storage.clearStorage();
|
|
783
773
|
}
|
|
784
774
|
clear() {
|
|
785
|
-
this.logger.info("Clearing SDK completely"), this.clearSession(), this.loading.value = !1, this.sessionId = i({ prefix: "ses" }),
|
|
775
|
+
this.logger.info("Clearing SDK completely"), this.clearSession(), this.loading.value = !1, this.sessionId = i({ prefix: "ses" }), C.delete();
|
|
786
776
|
}
|
|
787
777
|
};
|
|
788
778
|
//#endregion
|
|
789
|
-
export { AuthClient as a, resolveApiBase as c, BillingClient as i, UserClient as n, AgentClient as o, ChatClient as r, _defineProperty as s,
|
|
779
|
+
export { AuthClient as a, resolveApiBase as c, BillingClient as i, UserClient as n, AgentClient as o, ChatClient as r, _defineProperty as s, w as t };
|
|
790
780
|
|
|
791
781
|
//# sourceMappingURL=sdkClient.js.map
|