@pagelines/sdk 1.0.148

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 (70) hide show
  1. package/README.md +542 -0
  2. package/dist/AgentProvider.vue_vue_type_script_setup_true_lang-BGCgpGEW.js +42 -0
  3. package/dist/AgentProvider.vue_vue_type_script_setup_true_lang-BGCgpGEW.js.map +1 -0
  4. package/dist/AgentWidgetInline-pTCUPNqY.js +35 -0
  5. package/dist/AgentWidgetInline-pTCUPNqY.js.map +1 -0
  6. package/dist/AgentWidgetModal-BA74AH8E.js +66 -0
  7. package/dist/AgentWidgetModal-BA74AH8E.js.map +1 -0
  8. package/dist/AgentWidgetPopup-pe5CmJfa.js +117 -0
  9. package/dist/AgentWidgetPopup-pe5CmJfa.js.map +1 -0
  10. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-Bvik7Wdb.js +5139 -0
  11. package/dist/AgentWrap.vue_vue_type_script_setup_true_lang-Bvik7Wdb.js.map +1 -0
  12. package/dist/FModal.vue_vue_type_script_setup_true_lang-cL0BFEkZ.js +172 -0
  13. package/dist/FModal.vue_vue_type_script_setup_true_lang-cL0BFEkZ.js.map +1 -0
  14. package/dist/agent/AgentController.d.ts +81 -0
  15. package/dist/agent/ClientAudio.d.ts +102 -0
  16. package/dist/agent/constants.d.ts +16 -0
  17. package/dist/agent/index.d.ts +10 -0
  18. package/dist/agent/schema.d.ts +46 -0
  19. package/dist/agent/test/AgentController.test.d.ts +1 -0
  20. package/dist/agent/test/utils.test.d.ts +1 -0
  21. package/dist/agent/ui/AgentChat.vue.d.ts +27 -0
  22. package/dist/agent/ui/AgentInputEmail.vue.d.ts +9 -0
  23. package/dist/agent/ui/AgentInputOneTimeCode.vue.d.ts +13 -0
  24. package/dist/agent/ui/AgentModal.vue.d.ts +16 -0
  25. package/dist/agent/ui/AgentProvider.vue.d.ts +22 -0
  26. package/dist/agent/ui/AgentSidebarClose.vue.d.ts +6 -0
  27. package/dist/agent/ui/AgentWidget.vue.d.ts +17 -0
  28. package/dist/agent/ui/AgentWrap.vue.d.ts +128 -0
  29. package/dist/agent/ui/ElAgentAbout.vue.d.ts +6 -0
  30. package/dist/agent/ui/ElAgentButton.vue.d.ts +26 -0
  31. package/dist/agent/ui/ElAgentChat.vue.d.ts +11 -0
  32. package/dist/agent/ui/ElAgentHeader.vue.d.ts +6 -0
  33. package/dist/agent/ui/ElAgentModeSidebar.vue.d.ts +11 -0
  34. package/dist/agent/ui/ElAgentSidebar.vue.d.ts +14 -0
  35. package/dist/agent/ui/ElAuthGate.vue.d.ts +6 -0
  36. package/dist/agent/ui/ElModeHeader.vue.d.ts +9 -0
  37. package/dist/agent/ui/ElSidebar.vue.d.ts +30 -0
  38. package/dist/agent/utils.d.ts +34 -0
  39. package/dist/agent.js +162 -0
  40. package/dist/agent.js.map +1 -0
  41. package/dist/api.d.ts +23 -0
  42. package/dist/constants/socialPlatforms.d.ts +10 -0
  43. package/dist/demo/index.d.ts +105 -0
  44. package/dist/demo.js +264 -0
  45. package/dist/demo.js.map +1 -0
  46. package/dist/index.d.ts +7 -0
  47. package/dist/sdk.css +1 -0
  48. package/dist/sdk.js +9 -0
  49. package/dist/sdk.js.map +1 -0
  50. package/dist/sdkClient-BmWhfelO.js +939 -0
  51. package/dist/sdkClient-BmWhfelO.js.map +1 -0
  52. package/dist/sdkClient.d.ts +762 -0
  53. package/dist/sdkStorage.d.ts +39 -0
  54. package/dist/socialPlatforms-Ck-b3SnQ.js +82 -0
  55. package/dist/socialPlatforms-Ck-b3SnQ.js.map +1 -0
  56. package/dist/test/api.test.d.ts +1 -0
  57. package/dist/test/build.test.d.ts +1 -0
  58. package/dist/types/SDKAppType.stub.d.ts +6 -0
  59. package/dist/vite-env.d.ts +13 -0
  60. package/dist/vite.config.sdk.d.ts +2 -0
  61. package/dist/vitest.config.d.ts +2 -0
  62. package/dist/widget/PLWidget.d.ts +55 -0
  63. package/dist/widget/composables/usePLWidget.d.ts +57 -0
  64. package/dist/widget/index.d.ts +4 -0
  65. package/dist/widget/ui/AgentWidgetInline.vue.d.ts +17 -0
  66. package/dist/widget/ui/AgentWidgetModal.vue.d.ts +22 -0
  67. package/dist/widget/ui/AgentWidgetPopup.vue.d.ts +24 -0
  68. package/dist/widget.js +188 -0
  69. package/dist/widget.js.map +1 -0
  70. package/package.json +94 -0
@@ -0,0 +1,128 @@
1
+ import { PageLinesSDK } from '../../sdkClient';
2
+ import { ButtonIconPreset } from '../../widget/PLWidget';
3
+ import { Agent } from '../schema';
4
+ type __VLS_Props = {
5
+ sdk?: PageLinesSDK;
6
+ agent?: Agent;
7
+ handle?: string;
8
+ context?: string;
9
+ firstMessage?: string;
10
+ buttonText?: string;
11
+ buttonIcon?: ButtonIconPreset;
12
+ hasClose?: boolean;
13
+ apiBase?: string;
14
+ };
15
+ declare function __VLS_template(): {
16
+ attrs: Partial<{}>;
17
+ slots: {
18
+ default?(_: {
19
+ sdk: PageLinesSDK;
20
+ agent: {
21
+ agentId?: string | undefined;
22
+ handle?: string | undefined;
23
+ ownerId?: string | undefined;
24
+ orgId?: string | undefined;
25
+ name?: string | undefined;
26
+ title?: string | null | undefined;
27
+ summary?: string | null | undefined;
28
+ entityType?: string | undefined;
29
+ avatarId?: string | null | undefined;
30
+ coverId?: string | null | undefined;
31
+ email?: string | null | undefined;
32
+ website?: string | null | undefined;
33
+ accounts?: {
34
+ platform: "x" | "email" | "website" | "linkedin" | "facebook" | "tiktok" | "youtube" | "github" | "instagram" | "threads" | "phone";
35
+ handle: string;
36
+ }[] | null | undefined;
37
+ model?: string | null | undefined;
38
+ channel?: string | null | undefined;
39
+ lastActivityAt?: string | null | undefined;
40
+ instanceId?: string | null | undefined;
41
+ instanceProvider?: string | null | undefined;
42
+ imageVersion?: string | null | undefined;
43
+ botStatus?: string | null | undefined;
44
+ botServerUrl?: string | null | undefined;
45
+ botError?: string | null | undefined;
46
+ botLastSeen?: string | null | undefined;
47
+ botHeartbeatAt?: string | null | undefined;
48
+ desiredStatus?: "active" | "stopped" | null | undefined;
49
+ onboardedAt?: string | null | undefined;
50
+ enrichment?: Record<string, any> | null | undefined;
51
+ onboarding?: Record<string, any> | null | undefined;
52
+ org?: {
53
+ orgId: string;
54
+ handle: string;
55
+ name: string;
56
+ status: string;
57
+ headline?: string | undefined;
58
+ summary?: string | undefined;
59
+ } | undefined;
60
+ visibility?: "org" | "private" | "public" | undefined;
61
+ status?: string | undefined;
62
+ createdAt?: string | undefined;
63
+ updatedAt?: string | undefined;
64
+ avatar?: {
65
+ mediaId?: string | undefined;
66
+ userId?: string | undefined;
67
+ orgId?: string | undefined;
68
+ agentId?: string | null | undefined;
69
+ filename?: string | undefined;
70
+ mimeType?: string | undefined;
71
+ size?: number | undefined;
72
+ src?: string | undefined;
73
+ alt?: string | undefined;
74
+ context?: "avatar" | "cover" | "general" | undefined;
75
+ status?: "processing" | "active" | "failed" | "deleted" | undefined;
76
+ quality?: "high" | "low" | "standard" | undefined;
77
+ createdAt?: string | undefined;
78
+ updatedAt?: string | undefined;
79
+ mediaType?: "image" | "video" | "audio" | undefined;
80
+ className?: string | undefined;
81
+ width?: number | undefined;
82
+ height?: number | undefined;
83
+ duration?: number | undefined;
84
+ blurhash?: string | undefined;
85
+ } | undefined;
86
+ cover?: {
87
+ mediaId?: string | undefined;
88
+ userId?: string | undefined;
89
+ orgId?: string | undefined;
90
+ agentId?: string | null | undefined;
91
+ filename?: string | undefined;
92
+ mimeType?: string | undefined;
93
+ size?: number | undefined;
94
+ src?: string | undefined;
95
+ alt?: string | undefined;
96
+ context?: "avatar" | "cover" | "general" | undefined;
97
+ status?: "processing" | "active" | "failed" | "deleted" | undefined;
98
+ quality?: "high" | "low" | "standard" | undefined;
99
+ createdAt?: string | undefined;
100
+ updatedAt?: string | undefined;
101
+ mediaType?: "image" | "video" | "audio" | undefined;
102
+ className?: string | undefined;
103
+ width?: number | undefined;
104
+ height?: number | undefined;
105
+ duration?: number | undefined;
106
+ blurhash?: string | undefined;
107
+ } | undefined;
108
+ isPrimary?: boolean | undefined;
109
+ };
110
+ context: string | undefined;
111
+ firstMessage: string | undefined;
112
+ buttonText: string | undefined;
113
+ buttonIcon: ButtonIconPreset | undefined;
114
+ loading: false;
115
+ }): any;
116
+ };
117
+ refs: {};
118
+ rootEl: HTMLDivElement;
119
+ };
120
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
121
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
122
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
123
+ export default _default;
124
+ type __VLS_WithTemplateSlots<T, S> = T & {
125
+ new (): {
126
+ $slots: S;
127
+ };
128
+ };
@@ -0,0 +1,6 @@
1
+ import { Agent } from '@pagelines/types';
2
+ type __VLS_Props = {
3
+ agent: Agent;
4
+ };
5
+ 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, {}, HTMLDivElement>;
6
+ export default _default;
@@ -0,0 +1,26 @@
1
+ type ButtonTheme = 'primary' | 'green' | 'red' | 'default';
2
+ type ButtonSize = 'sm' | 'md' | 'lg';
3
+ type __VLS_Props = {
4
+ theme?: ButtonTheme;
5
+ size?: ButtonSize;
6
+ loading?: boolean;
7
+ icon?: string;
8
+ iconAfter?: string;
9
+ };
10
+ declare function __VLS_template(): {
11
+ attrs: Partial<{}>;
12
+ slots: {
13
+ default?(_: {}): any;
14
+ };
15
+ refs: {};
16
+ rootEl: HTMLButtonElement;
17
+ };
18
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
19
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>;
20
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
21
+ export default _default;
22
+ type __VLS_WithTemplateSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,11 @@
1
+ import { Agent } from '@pagelines/types';
2
+ import { AgentController } from '../AgentController';
3
+ type __VLS_Props = {
4
+ agentController?: AgentController;
5
+ agent: Agent;
6
+ };
7
+ 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
+ messagesContainer: HTMLDivElement;
9
+ textarea: HTMLTextAreaElement;
10
+ }, HTMLDivElement>;
11
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { Agent } from '@pagelines/types';
2
+ interface Props {
3
+ agent: Agent;
4
+ }
5
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
@@ -0,0 +1,11 @@
1
+ import { AgentController } from '../AgentController';
2
+ type __VLS_Props = {
3
+ modelValue: boolean;
4
+ agentController?: AgentController;
5
+ };
6
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
7
+ "update:modelValue": (value: boolean) => any;
8
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
11
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { PageLinesSDK } from '../../sdkClient';
2
+ import { Agent } from '../schema';
3
+ type __VLS_Props = {
4
+ modelValue: boolean;
5
+ agent: Agent;
6
+ sdk: PageLinesSDK;
7
+ title?: string;
8
+ };
9
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
+ "update:modelValue": (value: boolean) => any;
11
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
12
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { PageLinesSDK } from '../../sdkClient';
2
+ type __VLS_Props = {
3
+ sdk: PageLinesSDK;
4
+ };
5
+ 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, {}, HTMLDivElement>;
6
+ export default _default;
@@ -0,0 +1,9 @@
1
+ import { Agent } from '@pagelines/types';
2
+ interface Props {
3
+ agent: Agent;
4
+ size?: 'md' | 'lg';
5
+ showOnlineIndicator?: boolean;
6
+ layout?: 'centered' | 'horizontal';
7
+ }
8
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
9
+ export default _default;
@@ -0,0 +1,30 @@
1
+ import { NavItem } from '@pagelines/types';
2
+ type __VLS_Props = {
3
+ modelValue: boolean;
4
+ items: NavItem[];
5
+ position?: 'left' | 'right';
6
+ title?: string;
7
+ widthClasses?: string;
8
+ };
9
+ declare function __VLS_template(): {
10
+ attrs: Partial<{}>;
11
+ slots: {
12
+ header?(_: {}): any;
13
+ footer?(_: {}): any;
14
+ };
15
+ refs: {};
16
+ rootEl: any;
17
+ };
18
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
19
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
+ "update:modelValue": (value: boolean) => any;
21
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
25
+ export default _default;
26
+ type __VLS_WithTemplateSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
@@ -0,0 +1,34 @@
1
+ import { Agent } from '@pagelines/types';
2
+ export declare function getImageSrc(image: string | {
3
+ src?: string;
4
+ } | undefined): string;
5
+ export declare function getAgentAvatarUrl(agent: Agent): string;
6
+ export declare function getFallbackAvatarDataUrl(): string;
7
+ export declare function handleImageError(event: Event): void;
8
+ export declare function parseVoiceMessage(args: {
9
+ message: string;
10
+ source: string;
11
+ }): {
12
+ text: string;
13
+ sender: 'user' | 'agent';
14
+ } | null;
15
+ export declare function generateFirstMessage(args: {
16
+ name: string;
17
+ context?: string;
18
+ }): string;
19
+ /**
20
+ * Parse button template string with self data variables
21
+ * Supports: {name}, {title}, {handle}, {orgName}
22
+ * Uses single braces to avoid conflicts with Vue {{}} or React JSX
23
+ *
24
+ * @example
25
+ * parseButtonTemplate({ template: 'Talk to {name}', self })
26
+ * // => 'Talk to Andrew'
27
+ *
28
+ * parseButtonTemplate({ template: 'Book a meeting with {title}', self })
29
+ * // => 'Book a meeting with CEO & Co-Founder'
30
+ */
31
+ export declare function parseButtonTemplate(args: {
32
+ template: string;
33
+ agent: Agent;
34
+ }): string;
package/dist/agent.js ADDED
@@ -0,0 +1,162 @@
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-Bvik7Wdb.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-Bvik7Wdb.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";
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-BGCgpGEW.js";
8
+ const z = { class: "relative w-full h-[80vh] md:h-[600px]" }, P = /* @__PURE__ */ b({
9
+ name: "AgentModal",
10
+ __name: "AgentModal",
11
+ props: {
12
+ vis: { type: Boolean, default: !1 },
13
+ sdk: {},
14
+ agent: {},
15
+ handle: {},
16
+ context: {},
17
+ firstMessage: {}
18
+ },
19
+ emits: ["update:vis"],
20
+ setup(e, { emit: n }) {
21
+ const s = n;
22
+ return (t, a) => (c(), g(N, {
23
+ vis: e.vis,
24
+ "modal-class": "max-w-4xl p-0",
25
+ "style-class": "bg-transparent shadow-2xl rounded-2xl",
26
+ "has-close": !1,
27
+ "onUpdate:vis": a[1] || (a[1] = (l) => s("update:vis", l))
28
+ }, {
29
+ default: k(() => [
30
+ o("div", z, [
31
+ O(T, {
32
+ sdk: e.sdk,
33
+ agent: e.agent,
34
+ handle: e.handle,
35
+ context: e.context,
36
+ "first-message": e.firstMessage,
37
+ "has-close": !0,
38
+ onClose: a[0] || (a[0] = (l) => s("update:vis", !1))
39
+ }, null, 8, ["sdk", "agent", "handle", "context", "first-message"])
40
+ ])
41
+ ]),
42
+ _: 1
43
+ }, 8, ["vis"]));
44
+ }
45
+ }), S = {
46
+ key: 0,
47
+ class: "relative h-full w-full"
48
+ }, D = { class: "group relative h-full w-full rounded-3xl overflow-hidden shadow-lg transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:shadow-2xl hover:translate-y-[-1px] hover:brightness-110 active:scale-[1.06] active:-translate-y-0.5 active:duration-100" }, F = ["src", "alt"], Z = /* @__PURE__ */ b({
49
+ __name: "AgentWidget",
50
+ props: {
51
+ sdk: {},
52
+ handle: {},
53
+ context: {},
54
+ firstMessage: {},
55
+ position: {}
56
+ },
57
+ setup(e, { expose: n }) {
58
+ const s = e, t = v(!1), a = v(!1);
59
+ function l() {
60
+ t.value = !t.value;
61
+ }
62
+ d(l, "toggle"), U(t, async (m) => {
63
+ m ? (await V(), setTimeout(() => {
64
+ a.value = !0;
65
+ }, 400)) : a.value = !1;
66
+ });
67
+ function w() {
68
+ t.value = !0;
69
+ }
70
+ d(w, "open");
71
+ function f() {
72
+ t.value = !1;
73
+ }
74
+ d(f, "close");
75
+ function A() {
76
+ f();
77
+ }
78
+ return d(A, "handleClose"), n({
79
+ toggle: l,
80
+ open: w,
81
+ close: f
82
+ }), (m, i) => (c(), g(C, {
83
+ sdk: e.sdk,
84
+ handle: e.handle,
85
+ context: e.context,
86
+ "first-message": e.firstMessage
87
+ }, {
88
+ default: k(({ agent: r, sdk: y }) => [
89
+ r ? (c(), p("div", {
90
+ key: 0,
91
+ class: h(["fixed z-[999999] pointer-events-auto", [
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
+ ]])
94
+ }, [
95
+ o("div", {
96
+ class: h(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu", [
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
+ ]]),
99
+ style: $({
100
+ "transform-origin": s.position === "bottom-left" ? "bottom left" : s.position === "top-right" ? "top right" : s.position === "top-left" ? "top left" : "bottom right"
101
+ }),
102
+ onClick: i[0] || (i[0] = (B) => t.value ? void 0 : l())
103
+ }, [
104
+ t.value ? u("", !0) : (c(), p("div", S, [
105
+ o("div", D, [
106
+ o("img", {
107
+ src: x(I)(r) || x(M)(),
108
+ alt: `${r.name} digital agent`,
109
+ class: "h-full w-full object-cover pointer-events-none",
110
+ width: "80",
111
+ height: "80"
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))
114
+ ]),
115
+ i[2] || (i[2] = o("div", { class: "absolute top-0.5 right-0.5" }, [
116
+ o("div", {
117
+ class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
118
+ style: { "animation-duration": "3s" }
119
+ }),
120
+ o("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" })
121
+ ], -1))
122
+ ])),
123
+ t.value && r ? (c(), g(_, {
124
+ key: 1,
125
+ class: "rounded-3xl shadow-2xl border border-white/10",
126
+ sdk: y,
127
+ agent: r,
128
+ context: e.context,
129
+ "first-message": e.firstMessage,
130
+ "has-close": !0,
131
+ "is-active": a.value,
132
+ onClose: A
133
+ }, null, 8, ["sdk", "agent", "context", "first-message", "is-active"])) : u("", !0)
134
+ ], 6)
135
+ ], 2)) : u("", !0)
136
+ ]),
137
+ _: 1
138
+ }, 8, ["sdk", "handle", "context", "first-message"]));
139
+ }
140
+ });
141
+ export {
142
+ q as AGENT_MODES,
143
+ J as AUDIO_FFT_SIZE,
144
+ K as AUDIO_LEVEL_UPDATE_INTERVAL,
145
+ X as AUDIO_SMOOTHING,
146
+ _ as AgentChat,
147
+ P as AgentModal,
148
+ T as AgentProvider,
149
+ Z as AgentWidget,
150
+ C as AgentWrap,
151
+ Y as ClientAudio,
152
+ ee as VISUALIZER_CONFIG,
153
+ te as VOICE_FREQUENCIES,
154
+ se as generateFirstMessage,
155
+ I as getAgentAvatarUrl,
156
+ M as getFallbackAvatarDataUrl,
157
+ ae as getImageSrc,
158
+ oe as handleImageError,
159
+ ie as parseButtonTemplate,
160
+ ne as parseVoiceMessage
161
+ };
162
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","sources":["../agent/ui/AgentModal.vue","../agent/ui/AgentWidget.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { PageLinesSDK } from '../../sdkClient'\nimport type { Agent } from '../schema'\nimport FModal from '@/ui/common/FModal.vue'\nimport AgentProvider from './AgentProvider.vue'\n\ndefineOptions({ name: 'AgentModal' })\n\nconst {\n vis = false,\n sdk,\n agent,\n handle,\n context,\n firstMessage,\n} = defineProps<{\n vis?: boolean\n sdk?: PageLinesSDK\n agent?: Agent\n handle?: string\n context?: string\n firstMessage?: string\n}>()\n\nconst emit = defineEmits<{\n 'update:vis': [value: boolean]\n}>()\n</script>\n\n<template>\n <FModal\n :vis=\"vis\"\n modal-class=\"max-w-4xl p-0\"\n style-class=\"bg-transparent shadow-2xl rounded-2xl\"\n :has-close=\"false\"\n @update:vis=\"(val) => emit('update:vis', val)\"\n >\n <div class=\"relative w-full h-[80vh] md:h-[600px]\">\n <AgentProvider\n :sdk=\"sdk\"\n :agent=\"agent\"\n :handle=\"handle\"\n :context=\"context\"\n :first-message=\"firstMessage\"\n :has-close=\"true\"\n @close=\"emit('update:vis', false)\"\n />\n </div>\n </FModal>\n</template>\n","<script setup lang=\"ts\">\nimport type { PageLinesSDK } from '../../sdkClient'\nimport { nextTick, ref, watch } from 'vue'\nimport { getFallbackAvatarDataUrl, getAgentAvatarUrl } from '../utils'\nimport AgentChat from './AgentChat.vue'\nimport AgentWrap from './AgentWrap.vue'\n\ninterface Props {\n sdk?: PageLinesSDK\n handle: string\n context?: string\n firstMessage?: string\n position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'\n}\n\nconst props = defineProps<Props>()\nconst isOpen = ref(false)\nconst isAgentActive = ref(false)\n\nfunction toggle() {\n isOpen.value = !isOpen.value\n}\n\n// Watch isOpen to delay agent activation for smooth transition\nwatch(isOpen, async (newValue) => {\n if (newValue) {\n // When opening, delay agent activation until transition starts\n await nextTick()\n setTimeout(() => {\n isAgentActive.value = true\n }, 400) // Delay to let container expand first\n } else {\n // When closing, immediately deactivate agent\n isAgentActive.value = false\n }\n})\n\nfunction open() {\n isOpen.value = true\n}\n\nfunction close() {\n isOpen.value = false\n}\n\nfunction handleClose() {\n close()\n}\n\ndefineExpose({\n toggle,\n open,\n close,\n})\n</script>\n\n<template>\n <AgentWrap\n v-slot=\"{ agent, sdk: resolvedSdk }\"\n :sdk=\"sdk\"\n :handle=\"handle\"\n :context=\"context\"\n :first-message=\"firstMessage\"\n >\n <!-- Fixed Widget Wrapper -->\n <div\n v-if=\"agent\"\n class=\"fixed z-[999999] pointer-events-auto\"\n :class=\"[\n props.position === 'bottom-left' ? 'bottom-6 left-6'\n : props.position === 'top-right' ? 'top-6 right-6'\n : props.position === 'top-left' ? 'top-6 left-6'\n : 'bottom-6 right-6',\n ]\"\n >\n <!-- Widget Content with Transition -->\n <div\n class=\"transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu\"\n :class=\"[\n isOpen\n ? 'widget-expanded w-96 h-[600px] max-w-[calc(100vw-48px)] max-h-[calc(100vh-48px)] rounded-3xl opacity-100 scale-100'\n : 'widget-button w-[80px] h-[80px] opacity-100 scale-100 flex items-center justify-center cursor-pointer',\n ]\"\n :style=\"{\n 'transform-origin':\n props.position === 'bottom-left' ? 'bottom left'\n : props.position === 'top-right' ? 'top right'\n : props.position === 'top-left' ? 'top left'\n : 'bottom right',\n }\"\n @click=\"!isOpen ? toggle() : undefined\"\n >\n <!-- Button Content (visible when closed) -->\n <div v-if=\"!isOpen\" class=\"relative h-full w-full\">\n <div class=\"group relative h-full w-full rounded-3xl overflow-hidden shadow-lg transition-all duration-300 ease-[cubic-bezier(0.25,1,0.33,1)] hover:shadow-2xl hover:translate-y-[-1px] hover:brightness-110 active:scale-[1.06] active:-translate-y-0.5 active:duration-100\">\n <img\n :src=\"getAgentAvatarUrl(agent) || getFallbackAvatarDataUrl()\"\n :alt=\"`${agent.name} digital agent`\"\n class=\"h-full w-full object-cover pointer-events-none\"\n width=\"80\"\n height=\"80\"\n />\n <!-- Gradient overlay for contrast -->\n <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\" />\n </div>\n <!-- Online indicator -->\n <div class=\"absolute top-0.5 right-0.5\">\n <div class=\"size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping\" style=\"animation-duration: 3s;\" />\n <div class=\"size-3 bg-green-500 rounded-full ring-2 ring-white\" />\n </div>\n </div>\n\n <!-- Chat Content (visible when open) -->\n <AgentChat\n v-if=\"isOpen && agent\"\n class=\"rounded-3xl shadow-2xl border border-white/10\"\n :sdk=\"resolvedSdk\"\n :agent=\"agent\"\n :context=\"context\"\n :first-message=\"firstMessage\"\n :has-close=\"true\"\n :is-active=\"isAgentActive\"\n @close=\"handleClose\"\n />\n </div>\n </div>\n </AgentWrap>\n</template>\n"],"names":["emit","__emit","_createBlock","FModal","__props","_cache","val","_createElementVNode","_hoisted_1","_createVNode","AgentProvider","props","isOpen","ref","isAgentActive","toggle","__name","watch","newValue","nextTick","open","close","handleClose","__expose","AgentWrap","agent","resolvedSdk","_createElementBlock","_normalizeStyle","$event","_openBlock","_hoisted_2","_unref","getAgentAvatarUrl","getFallbackAvatarDataUrl","AgentChat"],"mappings":"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"}
package/dist/api.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { Hono } from 'hono';
2
+ import { hc } from 'hono/client';
3
+ export interface ApiClientSettings {
4
+ isDev: boolean;
5
+ apiBase?: string;
6
+ [key: string]: unknown;
7
+ }
8
+ /**
9
+ * Create fully typed Hono RPC client for PageLines SDK
10
+ *
11
+ * @template TAppType - The Hono app type from the server (enables full type safety)
12
+ * @param settings - Configuration for API base URL and environment
13
+ * @param responseHandler - Optional handler to process ApiResponse for auto user/token updates
14
+ * @returns Typed Hono client with response interceptor
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * import type { SDKAppType } from '@/modules/main/server'
19
+ * const client = createApiClient<SDKAppType>({ isDev: true })
20
+ * const response = await client.api.auth['check-email'].$post({ json: { email } })
21
+ * ```
22
+ */
23
+ export declare function createApiClient<TAppType extends Hono = any>(settings: ApiClientSettings, responseHandler?: (response: any) => void): ReturnType<typeof hc<TAppType>>;
@@ -0,0 +1,10 @@
1
+ import { SocialAccount } from '@pagelines/types';
2
+ type Platform = SocialAccount['platform'];
3
+ export declare const SOCIAL_PLATFORMS: Record<Platform, {
4
+ label: string;
5
+ icon: string;
6
+ placeholder: string;
7
+ getUrl: (handle: string) => string;
8
+ }>;
9
+ export type SocialPlatform = keyof typeof SOCIAL_PLATFORMS;
10
+ export {};
@@ -0,0 +1,105 @@
1
+ import { PageLinesSDK } from '../sdkClient';
2
+ import { Agent } from '@pagelines/types';
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';
6
+ /**
7
+ * Get demo agents - mix of static data and DB-fetched entries
8
+ * @param sdk - PageLinesSDK instance for fetching handle-only entries
9
+ * @returns Promise<Partial<Agent>[]> - Array of demo agents (static + fetched)
10
+ *
11
+ * Handle-only entries (e.g., { handle: 'dan' }) are fetched in parallel via sdk.getPublicAgent()
12
+ * Failed fetches are skipped silently with optional logging
13
+ */
14
+ export declare function getDemoAgents(sdk: PageLinesSDK): Promise<Partial<Agent>[]>;
15
+ export declare function getDemoAgentByHandle(handle: string): Partial<{
16
+ agentId?: string | undefined;
17
+ handle?: string | undefined;
18
+ ownerId?: string | undefined;
19
+ orgId?: string | undefined;
20
+ name?: string | undefined;
21
+ title?: string | null | undefined;
22
+ summary?: string | null | undefined;
23
+ entityType?: string | undefined;
24
+ avatarId?: string | null | undefined;
25
+ coverId?: string | null | undefined;
26
+ email?: string | null | undefined;
27
+ website?: string | null | undefined;
28
+ accounts?: {
29
+ platform: "x" | "email" | "website" | "linkedin" | "facebook" | "tiktok" | "youtube" | "github" | "instagram" | "threads" | "phone";
30
+ handle: string;
31
+ }[] | null | undefined;
32
+ model?: string | null | undefined;
33
+ channel?: string | null | undefined;
34
+ lastActivityAt?: string | null | undefined;
35
+ instanceId?: string | null | undefined;
36
+ instanceProvider?: string | null | undefined;
37
+ imageVersion?: string | null | undefined;
38
+ botStatus?: string | null | undefined;
39
+ botServerUrl?: string | null | undefined;
40
+ botError?: string | null | undefined;
41
+ botLastSeen?: string | null | undefined;
42
+ botHeartbeatAt?: string | null | undefined;
43
+ desiredStatus?: "active" | "stopped" | null | undefined;
44
+ onboardedAt?: string | null | undefined;
45
+ enrichment?: Record<string, any> | null | undefined;
46
+ onboarding?: Record<string, any> | null | undefined;
47
+ org?: {
48
+ orgId: string;
49
+ handle: string;
50
+ name: string;
51
+ status: string;
52
+ headline?: string | undefined;
53
+ summary?: string | undefined;
54
+ } | undefined;
55
+ visibility?: "org" | "private" | "public" | undefined;
56
+ status?: string | undefined;
57
+ createdAt?: string | undefined;
58
+ updatedAt?: string | undefined;
59
+ avatar?: {
60
+ mediaId?: string | undefined;
61
+ userId?: string | undefined;
62
+ orgId?: string | undefined;
63
+ agentId?: string | null | undefined;
64
+ filename?: string | undefined;
65
+ mimeType?: string | undefined;
66
+ size?: number | undefined;
67
+ src?: string | undefined;
68
+ alt?: string | undefined;
69
+ context?: "avatar" | "cover" | "general" | undefined;
70
+ status?: "processing" | "active" | "failed" | "deleted" | undefined;
71
+ quality?: "high" | "low" | "standard" | undefined;
72
+ createdAt?: string | undefined;
73
+ updatedAt?: string | undefined;
74
+ mediaType?: "image" | "video" | "audio" | undefined;
75
+ className?: string | undefined;
76
+ width?: number | undefined;
77
+ height?: number | undefined;
78
+ duration?: number | undefined;
79
+ blurhash?: string | undefined;
80
+ } | undefined;
81
+ cover?: {
82
+ mediaId?: string | undefined;
83
+ userId?: string | undefined;
84
+ orgId?: string | undefined;
85
+ agentId?: string | null | undefined;
86
+ filename?: string | undefined;
87
+ mimeType?: string | undefined;
88
+ size?: number | undefined;
89
+ src?: string | undefined;
90
+ alt?: string | undefined;
91
+ context?: "avatar" | "cover" | "general" | undefined;
92
+ status?: "processing" | "active" | "failed" | "deleted" | undefined;
93
+ quality?: "high" | "low" | "standard" | undefined;
94
+ createdAt?: string | undefined;
95
+ updatedAt?: string | undefined;
96
+ mediaType?: "image" | "video" | "audio" | undefined;
97
+ className?: string | undefined;
98
+ width?: number | undefined;
99
+ height?: number | undefined;
100
+ duration?: number | undefined;
101
+ blurhash?: string | undefined;
102
+ } | undefined;
103
+ isPrimary?: boolean | undefined;
104
+ }> | undefined;
105
+ export { staticAgents } from '../../../src/modules/agent/static/data';