@pagelines/sdk 1.0.172 → 1.0.174

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.
Files changed (38) hide show
  1. package/dist/{AgentProvider.vue_vue_type_script_setup_true_lang-DCanEQe2.js → AgentProvider.vue_vue_type_script_setup_true_lang-DfdOD9DB.js} +2 -2
  2. package/dist/{AgentProvider.vue_vue_type_script_setup_true_lang-DCanEQe2.js.map → AgentProvider.vue_vue_type_script_setup_true_lang-DfdOD9DB.js.map} +1 -1
  3. package/dist/{AgentWidgetInline-BW7Kg22N.js → AgentWidgetInline-DzMuLq-e.js} +2 -2
  4. package/dist/{AgentWidgetInline-BW7Kg22N.js.map → AgentWidgetInline-DzMuLq-e.js.map} +1 -1
  5. package/dist/{AgentWidgetModal-dH9xiLtO.js → AgentWidgetModal-Bo3I1Kvp.js} +2 -2
  6. package/dist/{AgentWidgetModal-dH9xiLtO.js.map → AgentWidgetModal-Bo3I1Kvp.js.map} +1 -1
  7. package/dist/{AgentWidgetPopup--EAvcTDh.js → AgentWidgetPopup-Vhq23tUI.js} +2 -2
  8. package/dist/{AgentWidgetPopup--EAvcTDh.js.map → AgentWidgetPopup-Vhq23tUI.js.map} +1 -1
  9. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-By0ndeW_.js +6972 -0
  10. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-By0ndeW_.js.map +1 -0
  11. package/dist/agent/AgentController.d.ts +14 -4
  12. package/dist/agent/ClientAudio.d.ts +1 -1
  13. package/dist/agent/index.d.ts +4 -1
  14. package/dist/agent/ui/AgentChat.vue.d.ts +1 -1
  15. package/dist/agent/ui/AgentWrap.vue.d.ts +0 -2
  16. package/dist/agent/ui/ElAgentChat.vue.d.ts +1 -0
  17. package/dist/agent.js +34 -32
  18. package/dist/clients/AuthClient.d.ts +0 -1
  19. package/dist/clients/ChatClient.d.ts +0 -6
  20. package/dist/clients/UserClient.d.ts +0 -20
  21. package/dist/clients/types.d.ts +2 -2
  22. package/dist/demo/index.d.ts +3 -5
  23. package/dist/sdk.css +1 -1
  24. package/dist/sdk.js +1 -1
  25. package/dist/{sdkClient-DlvpHeVt.js → sdkClient--jt-zUDx.js} +148 -251
  26. package/dist/sdkClient--jt-zUDx.js.map +1 -0
  27. package/dist/sdkClient.d.ts +1 -18
  28. package/dist/utils/base.d.ts +14 -0
  29. package/dist/utils/color.d.ts +12 -0
  30. package/dist/utils/cookies.d.ts +47 -0
  31. package/dist/utils/id.d.ts +27 -0
  32. package/dist/utils/logger.d.ts +49 -0
  33. package/dist/widget.js +5 -5
  34. package/dist/widget.js.map +1 -1
  35. package/package.json +2 -2
  36. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-DWBaKmcq.js +0 -5184
  37. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-DWBaKmcq.js.map +0 -1
  38. package/dist/sdkClient-DlvpHeVt.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { Ref } from 'vue';
2
2
  import { PageLinesSDK } from '../sdkClient';
3
3
  import { AgentMode, ChatMessage, Agent, TextConnectionState, VoiceConnectionState } from './schema';
4
- import { SettingsObject } from '../../../src/utils/base';
4
+ import { SettingsObject } from '../utils/base';
5
5
  import { ClientAudio } from './ClientAudio';
6
6
  interface AgentCallbacks {
7
7
  onConnect?: () => void;
@@ -14,11 +14,23 @@ interface AgentCallbacks {
14
14
  outputLevel: number;
15
15
  }) => void;
16
16
  }
17
+ export type ChatStreamFn = (args: {
18
+ message: string;
19
+ conversationId?: string;
20
+ history: Array<{
21
+ role: 'user' | 'assistant';
22
+ content: string;
23
+ }>;
24
+ onDelta: (text: string) => void;
25
+ onDone: (conversationId: string) => void;
26
+ onError: (error: string) => void;
27
+ }) => Promise<void>;
17
28
  type AgentControllerSettings = {
18
- sdk: PageLinesSDK;
29
+ sdk?: PageLinesSDK;
19
30
  agent: Agent;
20
31
  context?: string;
21
32
  firstMessage?: string;
33
+ chatStreamFn?: ChatStreamFn;
22
34
  };
23
35
  export declare class AgentController extends SettingsObject<AgentControllerSettings> {
24
36
  private conversation?;
@@ -30,8 +42,6 @@ export declare class AgentController extends SettingsObject<AgentControllerSetti
30
42
  private conversationId?;
31
43
  private sessionId?;
32
44
  private conversationStartTime?;
33
- private hostParticipantId?;
34
- private visitorParticipantId?;
35
45
  voiceState: Ref<VoiceConnectionState>;
36
46
  textState: Ref<TextConnectionState>;
37
47
  agentMode: Ref<AgentMode>;
@@ -1,5 +1,5 @@
1
1
  import { AudioLevel } from './schema';
2
- import { SettingsObject } from '../../../src/utils/base';
2
+ import { SettingsObject } from '../utils/base';
3
3
  export type AudioPermissionOptions = {
4
4
  noiseSuppression?: boolean;
5
5
  echoCancellation?: boolean;
@@ -3,8 +3,11 @@ import { default as AgentModal } from './ui/AgentModal.vue';
3
3
  import { default as AgentProvider } from './ui/AgentProvider.vue';
4
4
  import { default as AgentWidget } from './ui/AgentWidget.vue';
5
5
  import { default as AgentWrap } from './ui/AgentWrap.vue';
6
+ import { default as ElAgentChat } from './ui/ElAgentChat.vue';
7
+ export { AgentController } from './AgentController';
8
+ export type { ChatStreamFn } from './AgentController';
6
9
  export { ClientAudio } from './ClientAudio';
7
10
  export * from './constants';
8
11
  export * from './schema';
9
- export { AgentChat, AgentModal, AgentProvider, AgentWidget, AgentWrap };
12
+ export { AgentChat, AgentModal, AgentProvider, AgentWidget, AgentWrap, ElAgentChat };
10
13
  export * from './utils';
@@ -1,7 +1,7 @@
1
1
  import { Agent } from '@pagelines/types';
2
2
  import { PageLinesSDK } from '../../sdkClient';
3
3
  import { ButtonIconPreset } from '../../widget/PLWidget';
4
- import { ColorName } from '../../../../src/utils/color';
4
+ import { ColorName } from '../../utils/color';
5
5
  type __VLS_Props = {
6
6
  sdk: PageLinesSDK;
7
7
  agent: Agent;
@@ -40,9 +40,7 @@ declare function __VLS_template(): {
40
40
  instanceId?: string | null | undefined;
41
41
  instanceProvider?: string | null | undefined;
42
42
  imageVersion?: string | null | undefined;
43
- botStatus?: string | null | undefined;
44
43
  botServerUrl?: string | null | undefined;
45
- botError?: string | null | undefined;
46
44
  botHeartbeatAt?: string | null | undefined;
47
45
  desiredStatus?: "active" | "stopped" | null | undefined;
48
46
  onboardedAt?: string | null | undefined;
@@ -3,6 +3,7 @@ import { AgentController } from '../AgentController';
3
3
  type __VLS_Props = {
4
4
  agentController?: AgentController;
5
5
  agent: Agent;
6
+ variant?: 'dark' | 'light';
6
7
  };
7
8
  declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
8
9
  messagesContainer: HTMLDivElement;
package/dist/agent.js CHANGED
@@ -1,10 +1,10 @@
1
1
  var E = Object.defineProperty;
2
- var d = (e, n) => E(e, "name", { value: n, configurable: !0 });
3
- import { _ as C, g as I, b as M, a as _ } from "./AgentWrap.vue_vue_type_script_setup_true_lang-DWBaKmcq.js";
4
- import { f as q, A as J, d as K, c as X, C as Y, V as ee, e as te, j as se, h as ae, i as oe, k as ie, p as ne } from "./AgentWrap.vue_vue_type_script_setup_true_lang-DWBaKmcq.js";
5
- import { defineComponent as b, createBlock as g, openBlock as c, withCtx as k, createElementVNode as o, createVNode as O, ref as v, watch as U, nextTick as V, createElementBlock as p, createCommentVNode as u, normalizeClass as h, normalizeStyle as $, unref as x } from "vue";
2
+ var d = (e, i) => E(e, "name", { value: i, configurable: !0 });
3
+ import { _ as C, g as I, b as M, a as _ } from "./AgentWrap.vue_vue_type_script_setup_true_lang-By0ndeW_.js";
4
+ import { h as q, c as J, e as K, d as X, A as Y, C as ee, E as te, V as se, f as ae, k as oe, i as ne, j as ie, l as le, p as re } from "./AgentWrap.vue_vue_type_script_setup_true_lang-By0ndeW_.js";
5
+ import { defineComponent as b, createBlock as g, openBlock as c, withCtx as A, createElementVNode as o, createVNode as O, ref as v, watch as U, nextTick as V, createElementBlock as h, createCommentVNode as u, normalizeClass as p, normalizeStyle as $, unref as x } from "vue";
6
6
  import { _ as N } from "./FModal.vue_vue_type_script_setup_true_lang-cL0BFEkZ.js";
7
- import { _ as T } from "./AgentProvider.vue_vue_type_script_setup_true_lang-DCanEQe2.js";
7
+ import { _ as T } from "./AgentProvider.vue_vue_type_script_setup_true_lang-DfdOD9DB.js";
8
8
  const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ */ b({
9
9
  name: "AgentModal",
10
10
  __name: "AgentModal",
@@ -17,8 +17,8 @@ const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
17
17
  firstMessage: {}
18
18
  },
19
19
  emits: ["update:vis"],
20
- setup(e, { emit: n }) {
21
- const s = n;
20
+ setup(e, { emit: i }) {
21
+ const s = i;
22
22
  return (t, a) => (c(), g(N, {
23
23
  vis: e.vis,
24
24
  "modal-class": "max-w-4xl p-0",
@@ -26,7 +26,7 @@ const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
26
26
  "has-close": !1,
27
27
  "onUpdate:vis": a[1] || (a[1] = (l) => s("update:vis", l))
28
28
  }, {
29
- default: k(() => [
29
+ default: A(() => [
30
30
  o("div", z, [
31
31
  O(T, {
32
32
  sdk: e.sdk,
@@ -54,7 +54,7 @@ const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
54
54
  firstMessage: {},
55
55
  position: {}
56
56
  },
57
- setup(e, { expose: n }) {
57
+ setup(e, { expose: i }) {
58
58
  const s = e, t = v(!1), a = v(!1);
59
59
  function l() {
60
60
  t.value = !t.value;
@@ -64,44 +64,44 @@ const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
64
64
  a.value = !0;
65
65
  }, 400)) : a.value = !1;
66
66
  });
67
- function w() {
67
+ function k() {
68
68
  t.value = !0;
69
69
  }
70
- d(w, "open");
70
+ d(k, "open");
71
71
  function f() {
72
72
  t.value = !1;
73
73
  }
74
74
  d(f, "close");
75
- function A() {
75
+ function w() {
76
76
  f();
77
77
  }
78
- return d(A, "handleClose"), n({
78
+ return d(w, "handleClose"), i({
79
79
  toggle: l,
80
- open: w,
80
+ open: k,
81
81
  close: f
82
- }), (m, i) => (c(), g(C, {
82
+ }), (m, n) => (c(), g(C, {
83
83
  sdk: e.sdk,
84
84
  handle: e.handle,
85
85
  context: e.context,
86
86
  "first-message": e.firstMessage
87
87
  }, {
88
- default: k(({ agent: r, sdk: y }) => [
89
- r ? (c(), p("div", {
88
+ default: A(({ agent: r, sdk: y }) => [
89
+ r ? (c(), h("div", {
90
90
  key: 0,
91
- class: h(["fixed z-[999999] pointer-events-auto", [
91
+ class: p(["fixed z-[999999] pointer-events-auto", [
92
92
  s.position === "bottom-left" ? "bottom-6 left-6" : s.position === "top-right" ? "top-6 right-6" : s.position === "top-left" ? "top-6 left-6" : "bottom-6 right-6"
93
93
  ]])
94
94
  }, [
95
95
  o("div", {
96
- class: h(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu", [
96
+ class: p(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu", [
97
97
  t.value ? "widget-expanded w-96 h-[600px] max-w-[calc(100vw-48px)] max-h-[calc(100vh-48px)] rounded-3xl opacity-100 scale-100" : "widget-button w-[80px] h-[80px] opacity-100 scale-100 flex items-center justify-center cursor-pointer"
98
98
  ]]),
99
99
  style: $({
100
100
  "transform-origin": s.position === "bottom-left" ? "bottom left" : s.position === "top-right" ? "top right" : s.position === "top-left" ? "top left" : "bottom right"
101
101
  }),
102
- onClick: i[0] || (i[0] = (B) => t.value ? void 0 : l())
102
+ onClick: n[0] || (n[0] = (B) => t.value ? void 0 : l())
103
103
  }, [
104
- t.value ? u("", !0) : (c(), p("div", S, [
104
+ t.value ? u("", !0) : (c(), h("div", S, [
105
105
  o("div", D, [
106
106
  o("img", {
107
107
  src: x(I)(r) || x(M)(),
@@ -110,9 +110,9 @@ const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
110
110
  width: "80",
111
111
  height: "80"
112
112
  }, null, 8, F),
113
- i[1] || (i[1] = o("div", { class: "absolute inset-0 pointer-events-none bg-gradient-to-br from-transparent via-black/10 to-black/40 opacity-60 transition-opacity duration-300 group-hover:opacity-40" }, null, -1))
113
+ n[1] || (n[1] = o("div", { class: "absolute inset-0 pointer-events-none bg-gradient-to-br from-transparent via-black/10 to-black/40 opacity-60 transition-opacity duration-300 group-hover:opacity-40" }, null, -1))
114
114
  ]),
115
- i[2] || (i[2] = o("div", { class: "absolute top-0.5 right-0.5" }, [
115
+ n[2] || (n[2] = o("div", { class: "absolute top-0.5 right-0.5" }, [
116
116
  o("div", {
117
117
  class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
118
118
  style: { "animation-duration": "3s" }
@@ -129,7 +129,7 @@ const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ *
129
129
  "first-message": e.firstMessage,
130
130
  "has-close": !0,
131
131
  "is-active": a.value,
132
- onClose: A
132
+ onClose: w
133
133
  }, null, 8, ["sdk", "agent", "context", "first-message", "is-active"])) : u("", !0)
134
134
  ], 6)
135
135
  ], 2)) : u("", !0)
@@ -144,19 +144,21 @@ export {
144
144
  K as AUDIO_LEVEL_UPDATE_INTERVAL,
145
145
  X as AUDIO_SMOOTHING,
146
146
  _ as AgentChat,
147
+ Y as AgentController,
147
148
  P as AgentModal,
148
149
  T as AgentProvider,
149
150
  Z as AgentWidget,
150
151
  C as AgentWrap,
151
- Y as ClientAudio,
152
- ee as VISUALIZER_CONFIG,
153
- te as VOICE_FREQUENCIES,
154
- se as generateFirstMessage,
152
+ ee as ClientAudio,
153
+ te as ElAgentChat,
154
+ se as VISUALIZER_CONFIG,
155
+ ae as VOICE_FREQUENCIES,
156
+ oe as generateFirstMessage,
155
157
  I as getAgentAvatarUrl,
156
158
  M as getFallbackAvatarDataUrl,
157
- ae as getImageSrc,
158
- oe as handleImageError,
159
- ie as parseButtonTemplate,
160
- ne as parseVoiceMessage
159
+ ne as getImageSrc,
160
+ ie as handleImageError,
161
+ le as parseButtonTemplate,
162
+ re as parseVoiceMessage
161
163
  };
162
164
  //# sourceMappingURL=agent.js.map
@@ -17,7 +17,6 @@ export declare class AuthClient {
17
17
  orgId?: string;
18
18
  autoCreateContact?: boolean;
19
19
  }): Promise<boolean>;
20
- private autoCreateContact;
21
20
  loginWithGoogle(args?: {
22
21
  onSuccess?: (user: EnrichedUser) => void;
23
22
  onError?: (error: string) => void;
@@ -26,10 +26,4 @@ export declare class ChatClient {
26
26
  conversationId: string;
27
27
  content: string;
28
28
  } | undefined>;
29
- saveMessage(args: {
30
- conversationId: string;
31
- participantId: string;
32
- content: string;
33
- role: 'user' | 'agent' | 'system';
34
- }): Promise<boolean>;
35
29
  }
@@ -9,26 +9,6 @@ export declare class UserClient {
9
9
  getAgentByEmail(args: {
10
10
  email: string;
11
11
  }): Promise<Agent | undefined>;
12
- trackUsage(args: {
13
- agentId: string;
14
- type: 'voice' | 'chat';
15
- quantity: number;
16
- participantId?: string;
17
- }): Promise<boolean>;
18
- startConversation(args: {
19
- agentId: string;
20
- userId?: string;
21
- anonId?: string;
22
- channel: 'voice' | 'chat';
23
- }): Promise<{
24
- conversationId: string;
25
- hostParticipantId?: string;
26
- visitorParticipantId?: string;
27
- } | undefined>;
28
- autoCreateContact(args: {
29
- userId: string;
30
- orgId: string;
31
- }): Promise<boolean>;
32
12
  generateAnonId(): string;
33
13
  track(args: {
34
14
  event: 'view_profile' | 'profile_interaction';
@@ -1,9 +1,9 @@
1
1
  import { hc } from 'hono/client';
2
- import { SDKAppType } from '../../../src/modules/main/server';
2
+ import { SDKAppType } from '@/modules/main/server';
3
3
  import { Agent, ApiResponse, EnrichedUser } from '@pagelines/types';
4
4
  import { ComputedRef, Ref } from 'vue';
5
5
  import { SDKStorage } from '../sdkStorage';
6
- import { createLogger } from '../../../src/utils/logger';
6
+ import { createLogger } from '../utils/logger';
7
7
  export interface SDKContext {
8
8
  api: ReturnType<typeof hc<SDKAppType>> extends {
9
9
  api: infer A;
@@ -1,8 +1,8 @@
1
1
  import { PageLinesSDK } from '../sdkClient';
2
2
  import { Agent } from '@pagelines/types';
3
3
  export type { Agent } from '@pagelines/types';
4
- export type { DemoAgentEntry } from '../../../src/modules/agent/static/data';
5
- export { getStaticAgentByHandle } from '../../../src/modules/agent/static';
4
+ export type { DemoAgentEntry } from '@/modules/agent/static/data';
5
+ export { getStaticAgentByHandle } from '@/modules/agent/static';
6
6
  /**
7
7
  * Get demo agents - mix of static data and DB-fetched entries
8
8
  * @param sdk - PageLinesSDK instance for fetching handle-only entries
@@ -35,9 +35,7 @@ export declare function getDemoAgentByHandle(handle: string): Partial<{
35
35
  instanceId?: string | null | undefined;
36
36
  instanceProvider?: string | null | undefined;
37
37
  imageVersion?: string | null | undefined;
38
- botStatus?: string | null | undefined;
39
38
  botServerUrl?: string | null | undefined;
40
- botError?: string | null | undefined;
41
39
  botHeartbeatAt?: string | null | undefined;
42
40
  desiredStatus?: "active" | "stopped" | null | undefined;
43
41
  onboardedAt?: string | null | undefined;
@@ -101,4 +99,4 @@ export declare function getDemoAgentByHandle(handle: string): Partial<{
101
99
  } | undefined;
102
100
  isPrimary?: boolean | undefined;
103
101
  }> | undefined;
104
- export { staticAgents } from '../../../src/modules/agent/static/data';
102
+ export { staticAgents } from '@/modules/agent/static/data';