@fiction/sdk 1.0.30 → 1.0.32
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/SelfWidgetInline-C4beWxmY.js +31 -0
- package/dist/SelfWidgetInline-C4beWxmY.js.map +1 -0
- package/dist/SelfWidgetModal-CgZjd7eG.js +62 -0
- package/dist/SelfWidgetModal-CgZjd7eG.js.map +1 -0
- package/dist/{SelfWidgetPopup-BJ3q8ryL.js → SelfWidgetPopup-C4Z-Xr5K.js} +50 -56
- package/dist/SelfWidgetPopup-C4Z-Xr5K.js.map +1 -0
- package/dist/widget/FictionWidget.d.ts +1 -0
- package/dist/widget/ui/SelfWidgetInline.vue.d.ts +7 -7
- package/dist/{self → widget}/ui/SelfWidgetModal.vue.d.ts +8 -7
- package/dist/widget/ui/SelfWidgetPopup.vue.d.ts +8 -8
- package/dist/widget.js +7 -4
- package/dist/widget.js.map +1 -1
- package/package.json +2 -2
- package/dist/SelfWidgetInline-4qXty8nA.js +0 -39
- package/dist/SelfWidgetInline-4qXty8nA.js.map +0 -1
- package/dist/SelfWidgetModal-DWA5AU4S.js +0 -62
- package/dist/SelfWidgetModal-DWA5AU4S.js.map +0 -1
- package/dist/SelfWidgetPopup-BJ3q8ryL.js.map +0 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var i = Object.defineProperty;
|
|
2
|
+
var c = (s, t) => i(s, "name", { value: t, configurable: !0 });
|
|
3
|
+
import { defineComponent as u, ref as o, createBlock as d, openBlock as m } from "vue";
|
|
4
|
+
import { _ as x } from "./SelfProvider.vue_vue_type_script_setup_true_lang-hdOg9n4q.js";
|
|
5
|
+
const M = /* @__PURE__ */ u({
|
|
6
|
+
__name: "SelfWidgetInline",
|
|
7
|
+
props: {
|
|
8
|
+
sdk: {},
|
|
9
|
+
handle: {},
|
|
10
|
+
self: {},
|
|
11
|
+
context: {},
|
|
12
|
+
firstMessage: {}
|
|
13
|
+
},
|
|
14
|
+
setup(s, { expose: t }) {
|
|
15
|
+
const n = s, f = o(n.self), l = o(n.context), r = o(n.firstMessage);
|
|
16
|
+
function a(e) {
|
|
17
|
+
e.self !== void 0 && (f.value = e.self), e.context !== void 0 && (l.value = e.context), e.firstMessage !== void 0 && (r.value = e.firstMessage);
|
|
18
|
+
}
|
|
19
|
+
return c(a, "update"), t({ update: a }), (e, v) => (m(), d(x, {
|
|
20
|
+
sdk: s.sdk,
|
|
21
|
+
handle: s.handle,
|
|
22
|
+
self: f.value,
|
|
23
|
+
context: l.value,
|
|
24
|
+
"first-message": r.value
|
|
25
|
+
}, null, 8, ["sdk", "handle", "self", "context", "first-message"]));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
export {
|
|
29
|
+
M as default
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=SelfWidgetInline-C4beWxmY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfWidgetInline-C4beWxmY.js","sources":["../widget/ui/SelfWidgetInline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport { ref } from 'vue'\nimport SelfProvider from '../../self/ui/SelfProvider.vue'\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n}>()\n\n// Local state for updateable props\nconst currentSelf = ref<Self | undefined>(props.self)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\n\nfunction update(updates: WidgetUpdate) {\n if (updates.self !== undefined)\n currentSelf.value = updates.self\n if (updates.context !== undefined)\n currentContext.value = updates.context\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n}\n\ndefineExpose({ update })\n</script>\n\n<template>\n <SelfProvider\n :sdk=\"sdk\"\n :handle=\"handle\"\n :self=\"currentSelf\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n />\n</template>\n"],"names":["props","__props","currentSelf","ref","currentContext","currentFirstMessage","update","updates","__name","__expose","_createBlock","SelfProvider"],"mappings":";;;;;;;;;;;;;;AAYA,UAAMA,IAAQC,GASRC,IAAcC,EAAsBH,EAAM,IAAI,GAC9CI,IAAiBD,EAAwBH,EAAM,OAAO,GACtDK,IAAsBF,EAAwBH,EAAM,YAAY;AAEtE,aAASM,EAAOC,GAAuB;AACrC,MAAIA,EAAQ,SAAS,WACnBL,EAAY,QAAQK,EAAQ,OAC1BA,EAAQ,YAAY,WACtBH,EAAe,QAAQG,EAAQ,UAC7BA,EAAQ,iBAAiB,WAC3BF,EAAoB,QAAQE,EAAQ;AAAA,IACxC;AAPS,WAAAC,EAAAF,GAAA,WASTG,EAAa,EAAE,QAAAH,GAAQ,mBAIrBI,EAMEC,GAAA;AAAA,MALC,KAAKV,EAAA;AAAA,MACL,QAAQA,EAAA;AAAA,MACR,MAAMC,EAAA;AAAA,MACN,SAASE,EAAA;AAAA,MACT,iBAAeC,EAAA;AAAA,IAAA;;;"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var n = (s, a) => x(s, "name", { value: a, configurable: !0 });
|
|
3
|
+
import { defineComponent as h, ref as l, onMounted as p, nextTick as g, createBlock as C, openBlock as k, withCtx as M, createVNode as _ } from "vue";
|
|
4
|
+
import { _ as w } from "./FModal.vue_vue_type_script_setup_true_lang-DaI-YWPp.js";
|
|
5
|
+
import { _ as T } from "./SelfProvider.vue_vue_type_script_setup_true_lang-hdOg9n4q.js";
|
|
6
|
+
const S = /* @__PURE__ */ h({
|
|
7
|
+
__name: "SelfWidgetModal",
|
|
8
|
+
props: {
|
|
9
|
+
sdk: {},
|
|
10
|
+
handle: {},
|
|
11
|
+
self: {},
|
|
12
|
+
context: {},
|
|
13
|
+
firstMessage: {},
|
|
14
|
+
onClose: { type: Function }
|
|
15
|
+
},
|
|
16
|
+
setup(s, { expose: a }) {
|
|
17
|
+
const t = s, f = l(t.self), r = l(t.context), c = l(t.firstMessage), o = l(!1);
|
|
18
|
+
p(async () => {
|
|
19
|
+
await g(), setTimeout(() => {
|
|
20
|
+
o.value = !0;
|
|
21
|
+
}, 10);
|
|
22
|
+
});
|
|
23
|
+
function d(e) {
|
|
24
|
+
e.self !== void 0 && (f.value = e.self), e.context !== void 0 && (r.value = e.context), e.firstMessage !== void 0 && (c.value = e.firstMessage);
|
|
25
|
+
}
|
|
26
|
+
n(d, "update");
|
|
27
|
+
function i() {
|
|
28
|
+
o.value = !1, setTimeout(() => {
|
|
29
|
+
t.onClose && t.onClose();
|
|
30
|
+
}, 300);
|
|
31
|
+
}
|
|
32
|
+
n(i, "close");
|
|
33
|
+
function m() {
|
|
34
|
+
o.value = !0;
|
|
35
|
+
}
|
|
36
|
+
return n(m, "open"), a({ update: d, close: i, open: m }), (e, u) => (k(), C(w, {
|
|
37
|
+
vis: o.value,
|
|
38
|
+
"disable-teleport": !0,
|
|
39
|
+
"modal-class": "max-w-4xl h-[80vh] md:h-[600px]",
|
|
40
|
+
"has-close": !1,
|
|
41
|
+
"onUpdate:vis": u[0] || (u[0] = (v) => o.value = v),
|
|
42
|
+
onClose: i
|
|
43
|
+
}, {
|
|
44
|
+
default: M(() => [
|
|
45
|
+
_(T, {
|
|
46
|
+
sdk: s.sdk,
|
|
47
|
+
handle: s.handle,
|
|
48
|
+
self: f.value,
|
|
49
|
+
context: r.value,
|
|
50
|
+
"first-message": c.value,
|
|
51
|
+
"has-close": !0,
|
|
52
|
+
onClose: i
|
|
53
|
+
}, null, 8, ["sdk", "handle", "self", "context", "first-message"])
|
|
54
|
+
]),
|
|
55
|
+
_: 1
|
|
56
|
+
}, 8, ["vis"]));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
export {
|
|
60
|
+
S as default
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=SelfWidgetModal-CgZjd7eG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfWidgetModal-CgZjd7eG.js","sources":["../widget/ui/SelfWidgetModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport { nextTick, onMounted, ref } from 'vue'\nimport FModal from '@/ui/common/FModal.vue'\nimport SelfProvider from '../../self/ui/SelfProvider.vue'\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n onClose?: () => void\n}>()\n\nconst currentSelf = ref<Self | undefined>(props.self)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\nconst isVisible = ref(false)\n\n// Trigger transition after mount\nonMounted(async () => {\n await nextTick()\n // Small delay to ensure DOM is ready and transition fires\n setTimeout(() => {\n isVisible.value = true\n }, 10)\n})\n\nfunction update(updates: WidgetUpdate) {\n if (updates.self !== undefined)\n currentSelf.value = updates.self\n if (updates.context !== undefined)\n currentContext.value = updates.context\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n}\n\nfunction close() {\n isVisible.value = false\n // Wait for transition to complete before calling onClose\n setTimeout(() => {\n if (props.onClose) {\n props.onClose()\n }\n }, 300) // Match FModal transition duration\n}\n\nfunction open() {\n isVisible.value = true\n}\n\ndefineExpose({ update, close, open })\n</script>\n\n<template>\n <FModal\n :vis=\"isVisible\"\n :disable-teleport=\"true\"\n modal-class=\"max-w-4xl h-[80vh] md:h-[600px]\"\n :has-close=\"false\"\n @update:vis=\"isVisible = $event\"\n @close=\"close\"\n >\n <SelfProvider\n :sdk=\"sdk\"\n :handle=\"handle\"\n :self=\"currentSelf\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n :has-close=\"true\"\n @close=\"close\"\n />\n </FModal>\n</template>\n"],"names":["props","__props","currentSelf","ref","currentContext","currentFirstMessage","isVisible","onMounted","nextTick","update","updates","__name","close","open","__expose","_createBlock","FModal","_cache","$event","_createVNode","SelfProvider"],"mappings":";;;;;;;;;;;;;;;;AAaA,UAAMA,IAAQC,GASRC,IAAcC,EAAsBH,EAAM,IAAI,GAC9CI,IAAiBD,EAAwBH,EAAM,OAAO,GACtDK,IAAsBF,EAAwBH,EAAM,YAAY,GAChEM,IAAYH,EAAI,EAAK;AAG3B,IAAAI,EAAU,YAAY;AACpB,YAAMC,EAAA,GAEN,WAAW,MAAM;AACf,QAAAF,EAAU,QAAQ;AAAA,MACpB,GAAG,EAAE;AAAA,IACP,CAAC;AAED,aAASG,EAAOC,GAAuB;AACrC,MAAIA,EAAQ,SAAS,WACnBR,EAAY,QAAQQ,EAAQ,OAC1BA,EAAQ,YAAY,WACtBN,EAAe,QAAQM,EAAQ,UAC7BA,EAAQ,iBAAiB,WAC3BL,EAAoB,QAAQK,EAAQ;AAAA,IACxC;AAPS,IAAAC,EAAAF,GAAA;AAST,aAASG,IAAQ;AACf,MAAAN,EAAU,QAAQ,IAElB,WAAW,MAAM;AACf,QAAIN,EAAM,WACRA,EAAM,QAAA;AAAA,MAEV,GAAG,GAAG;AAAA,IACR;AARS,IAAAW,EAAAC,GAAA;AAUT,aAASC,IAAO;AACd,MAAAP,EAAU,QAAQ;AAAA,IACpB;AAFS,WAAAK,EAAAE,GAAA,SAITC,EAAa,EAAE,QAAAL,GAAQ,OAAAG,GAAO,MAAAC,EAAA,CAAM,mBAIlCE,EAiBSC,GAAA;AAAA,MAhBN,KAAKV,EAAA;AAAA,MACL,oBAAkB;AAAA,MACnB,eAAY;AAAA,MACX,aAAW;AAAA,MACX,gBAAUW,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEZ,EAAA,QAAYY;AAAA,MACxB,SAAON;AAAA,IAAA;iBAER,MAQE;AAAA,QARFO,EAQEC,GAAA;AAAA,UAPC,KAAKnB,EAAA;AAAA,UACL,QAAQA,EAAA;AAAA,UACR,MAAMC,EAAA;AAAA,UACN,SAASE,EAAA;AAAA,UACT,iBAAeC,EAAA;AAAA,UACf,aAAW;AAAA,UACX,SAAOO;AAAA,QAAA;;;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var a = (l,
|
|
3
|
-
import { defineComponent as
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var a = (l, u) => M(l, "name", { value: u, configurable: !0 });
|
|
3
|
+
import { defineComponent as A, ref as r, watch as S, nextTick as $, createBlock as x, openBlock as c, withCtx as B, createElementBlock as b, createCommentVNode as g, normalizeClass as w, createElementVNode as s, normalizeStyle as j, unref as k } from "vue";
|
|
4
4
|
import { a as E, g as F, c as N, b as T } from "./SelfWrap.vue_vue_type_script_setup_true_lang-DN-erii6.js";
|
|
5
5
|
const U = {
|
|
6
6
|
key: 0,
|
|
7
7
|
class: "relative h-full w-full"
|
|
8
|
-
}, V = { 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" }, D = ["src", "alt"], G = /* @__PURE__ */
|
|
8
|
+
}, V = { 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" }, D = ["src", "alt"], G = /* @__PURE__ */ A({
|
|
9
9
|
__name: "SelfWidgetPopup",
|
|
10
10
|
props: {
|
|
11
11
|
sdk: {},
|
|
@@ -15,69 +15,63 @@ const U = {
|
|
|
15
15
|
firstMessage: {},
|
|
16
16
|
position: {}
|
|
17
17
|
},
|
|
18
|
-
setup(l, { expose:
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
|
|
18
|
+
setup(l, { expose: u }) {
|
|
19
|
+
const e = l, t = r(!1), f = r(!1), p = r(e.self), d = r(e.context), v = r(e.firstMessage);
|
|
20
|
+
function m() {
|
|
21
|
+
t.value = !t.value;
|
|
22
22
|
}
|
|
23
|
-
a(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}, 400)) :
|
|
23
|
+
a(m, "toggle"), S(t, async (o) => {
|
|
24
|
+
o ? (await $(), setTimeout(() => {
|
|
25
|
+
f.value = !0;
|
|
26
|
+
}, 400)) : f.value = !1;
|
|
27
27
|
});
|
|
28
|
-
function
|
|
29
|
-
|
|
28
|
+
function y() {
|
|
29
|
+
t.value = !0;
|
|
30
30
|
}
|
|
31
|
-
a(
|
|
32
|
-
function
|
|
33
|
-
|
|
31
|
+
a(y, "open");
|
|
32
|
+
function h() {
|
|
33
|
+
t.value = !1;
|
|
34
34
|
}
|
|
35
|
-
a(
|
|
36
|
-
function
|
|
37
|
-
|
|
35
|
+
a(h, "close");
|
|
36
|
+
function C() {
|
|
37
|
+
h();
|
|
38
38
|
}
|
|
39
|
-
a(
|
|
40
|
-
function
|
|
41
|
-
|
|
39
|
+
a(C, "handleClose");
|
|
40
|
+
function z(o) {
|
|
41
|
+
o.self !== void 0 && (p.value = o.self), o.context !== void 0 && (d.value = o.context), o.firstMessage !== void 0 && (v.value = o.firstMessage);
|
|
42
42
|
}
|
|
43
|
-
return a(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}), v({
|
|
50
|
-
toggle: h,
|
|
51
|
-
open: C,
|
|
52
|
-
close: x,
|
|
53
|
-
update: _
|
|
54
|
-
}), (e, i) => (d(), b(E, {
|
|
43
|
+
return a(z, "update"), u({
|
|
44
|
+
toggle: m,
|
|
45
|
+
open: y,
|
|
46
|
+
close: h,
|
|
47
|
+
update: z
|
|
48
|
+
}), (o, i) => (c(), x(E, {
|
|
55
49
|
sdk: l.sdk,
|
|
56
50
|
handle: l.handle,
|
|
57
51
|
self: p.value,
|
|
58
|
-
context:
|
|
59
|
-
"first-message":
|
|
52
|
+
context: d.value,
|
|
53
|
+
"first-message": v.value
|
|
60
54
|
}, {
|
|
61
|
-
default:
|
|
62
|
-
n ? (
|
|
55
|
+
default: B(({ self: n, sdk: _ }) => [
|
|
56
|
+
n ? (c(), b("div", {
|
|
63
57
|
key: 0,
|
|
64
|
-
class:
|
|
65
|
-
|
|
58
|
+
class: w(["fixed z-[999999] pointer-events-auto", [
|
|
59
|
+
e.position === "bottom-left" ? "bottom-6 left-6" : e.position === "top-right" ? "top-6 right-6" : e.position === "top-left" ? "top-6 left-6" : "bottom-6 right-6"
|
|
66
60
|
]])
|
|
67
61
|
}, [
|
|
68
62
|
s("div", {
|
|
69
|
-
class:
|
|
70
|
-
|
|
63
|
+
class: w(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu", [
|
|
64
|
+
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"
|
|
71
65
|
]]),
|
|
72
66
|
style: j({
|
|
73
|
-
"transform-origin":
|
|
67
|
+
"transform-origin": e.position === "bottom-left" ? "bottom left" : e.position === "top-right" ? "top right" : e.position === "top-left" ? "top left" : "bottom right"
|
|
74
68
|
}),
|
|
75
|
-
onClick: i[0] || (i[0] = (O) =>
|
|
69
|
+
onClick: i[0] || (i[0] = (O) => t.value ? void 0 : m())
|
|
76
70
|
}, [
|
|
77
|
-
|
|
71
|
+
t.value ? g("", !0) : (c(), b("div", U, [
|
|
78
72
|
s("div", V, [
|
|
79
73
|
s("img", {
|
|
80
|
-
src:
|
|
74
|
+
src: k(F)(n) || k(N)(),
|
|
81
75
|
alt: `${n.name} digital self`,
|
|
82
76
|
class: "h-full w-full object-cover pointer-events-none",
|
|
83
77
|
width: "80",
|
|
@@ -93,19 +87,19 @@ const U = {
|
|
|
93
87
|
s("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" })
|
|
94
88
|
], -1))
|
|
95
89
|
])),
|
|
96
|
-
|
|
90
|
+
t.value && n ? (c(), x(T, {
|
|
97
91
|
key: 1,
|
|
98
92
|
class: "rounded-3xl shadow-2xl border border-white/10",
|
|
99
|
-
sdk:
|
|
93
|
+
sdk: _,
|
|
100
94
|
self: n,
|
|
101
|
-
context:
|
|
102
|
-
"first-message":
|
|
95
|
+
context: d.value,
|
|
96
|
+
"first-message": v.value,
|
|
103
97
|
"has-close": !0,
|
|
104
|
-
"is-active":
|
|
105
|
-
onClose:
|
|
106
|
-
}, null, 8, ["sdk", "self", "context", "first-message", "is-active"])) :
|
|
98
|
+
"is-active": f.value,
|
|
99
|
+
onClose: C
|
|
100
|
+
}, null, 8, ["sdk", "self", "context", "first-message", "is-active"])) : g("", !0)
|
|
107
101
|
], 6)
|
|
108
|
-
], 2)) :
|
|
102
|
+
], 2)) : g("", !0)
|
|
109
103
|
]),
|
|
110
104
|
_: 1
|
|
111
105
|
}, 8, ["sdk", "handle", "self", "context", "first-message"]));
|
|
@@ -114,4 +108,4 @@ const U = {
|
|
|
114
108
|
export {
|
|
115
109
|
G as default
|
|
116
110
|
};
|
|
117
|
-
//# sourceMappingURL=SelfWidgetPopup-
|
|
111
|
+
//# sourceMappingURL=SelfWidgetPopup-C4Z-Xr5K.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfWidgetPopup-C4Z-Xr5K.js","sources":["../widget/ui/SelfWidgetPopup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport { nextTick, ref, watch } from 'vue'\nimport { getFallbackAvatarDataUrl, getSelfAvatarUrl } from '../../self/utils'\nimport SelfAgent from '../../self/ui/SelfAgent.vue'\nimport SelfWrap from '../../self/ui/SelfWrap.vue'\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'\n}>()\nconst isOpen = ref(false)\nconst isAgentActive = ref(false)\n\n// Local state for updateable props\nconst currentSelf = ref<Self | undefined>(props.self)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\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 }\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\nfunction update(updates: WidgetUpdate) {\n if (updates.self !== undefined)\n currentSelf.value = updates.self\n if (updates.context !== undefined)\n currentContext.value = updates.context\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n}\n\ndefineExpose({\n toggle,\n open,\n close,\n update,\n})\n</script>\n\n<template>\n <SelfWrap\n v-slot=\"{ self, sdk: resolvedSdk }\"\n :sdk=\"sdk\"\n :handle=\"handle\"\n :self=\"currentSelf\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n >\n <!-- Fixed Widget Wrapper -->\n <div\n v-if=\"self\"\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=\"getSelfAvatarUrl(self) || getFallbackAvatarDataUrl()\"\n :alt=\"`${self.name} digital self`\"\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 <SelfAgent\n v-if=\"isOpen && self\"\n class=\"rounded-3xl shadow-2xl border border-white/10\"\n :sdk=\"resolvedSdk\"\n :self=\"self\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n :has-close=\"true\"\n :is-active=\"isAgentActive\"\n @close=\"handleClose\"\n />\n </div>\n </div>\n </SelfWrap>\n</template>\n"],"names":["props","__props","isOpen","ref","isAgentActive","currentSelf","currentContext","currentFirstMessage","toggle","__name","watch","newValue","nextTick","open","close","handleClose","update","updates","__expose","_createBlock","SelfWrap","self","resolvedSdk","_createElementBlock","_createElementVNode","_normalizeStyle","_cache","$event","_openBlock","_hoisted_1","_hoisted_2","_unref","getSelfAvatarUrl","getFallbackAvatarDataUrl","SelfAgent"],"mappings":";;;;;;;;;;;;;;;;;;AAcA,UAAMA,IAAQC,GAQRC,IAASC,EAAI,EAAK,GAClBC,IAAgBD,EAAI,EAAK,GAGzBE,IAAcF,EAAsBH,EAAM,IAAI,GAC9CM,IAAiBH,EAAwBH,EAAM,OAAO,GACtDO,IAAsBJ,EAAwBH,EAAM,YAAY;AAEtE,aAASQ,IAAS;AAChB,MAAAN,EAAO,QAAQ,CAACA,EAAO;AAAA,IACzB;AAFS,IAAAO,EAAAD,GAAA,WAKTE,EAAMR,GAAQ,OAAOS,MAAa;AAChC,MAAIA,KAEF,MAAMC,EAAA,GACN,WAAW,MAAM;AACf,QAAAR,EAAc,QAAQ;AAAA,MACxB,GAAG,GAAG,KAINA,EAAc,QAAQ;AAAA,IAE1B,CAAC;AAED,aAASS,IAAO;AACd,MAAAX,EAAO,QAAQ;AAAA,IACjB;AAFS,IAAAO,EAAAI,GAAA;AAIT,aAASC,IAAQ;AACf,MAAAZ,EAAO,QAAQ;AAAA,IACjB;AAFS,IAAAO,EAAAK,GAAA;AAIT,aAASC,IAAc;AACrB,MAAAD,EAAA;AAAA,IACF;AAFS,IAAAL,EAAAM,GAAA;AAIT,aAASC,EAAOC,GAAuB;AACrC,MAAIA,EAAQ,SAAS,WACnBZ,EAAY,QAAQY,EAAQ,OAC1BA,EAAQ,YAAY,WACtBX,EAAe,QAAQW,EAAQ,UAC7BA,EAAQ,iBAAiB,WAC3BV,EAAoB,QAAQU,EAAQ;AAAA,IACxC;AAPS,WAAAR,EAAAO,GAAA,WASTE,EAAa;AAAA,MACX,QAAAV;AAAA,MACA,MAAAK;AAAA,MACA,OAAAC;AAAA,MAC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AA;;YAM3DtB,EAAA,SAAUmB,UADlBF,EAUEe,GAAA;AAAA;cARA,OAAM;AAAA,cACL,KAAKZ;AAAA,cACL,MAAAD;AAAA,cACA,SAASf,EAAA;AAAA,cACT,iBAAeC,EAAA;AAAA,cACf,aAAW;AAAA,cACX,aAAWH,EAAA;AAAA,cACX,SAAOW;AAAA,YAAA;;;;;;;;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { FictionSDK } from '../../sdkClient';
|
|
2
2
|
import { Self } from '@fiction/types';
|
|
3
|
-
export interface
|
|
4
|
-
sdk?: FictionSDK;
|
|
5
|
-
handle?: string;
|
|
3
|
+
export interface WidgetUpdate {
|
|
6
4
|
self?: Self;
|
|
7
5
|
context?: string;
|
|
8
6
|
firstMessage?: string;
|
|
9
7
|
}
|
|
10
|
-
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
sdk?: FictionSDK;
|
|
10
|
+
handle?: string;
|
|
11
11
|
self?: Self;
|
|
12
12
|
context?: string;
|
|
13
13
|
firstMessage?: string;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
declare function update(updates: WidgetUpdate): void;
|
|
16
|
-
declare const _default: import('vue').DefineComponent<
|
|
16
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
17
17
|
update: typeof update;
|
|
18
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<
|
|
18
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
19
19
|
export default _default;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { FictionSDK } from '../../sdkClient';
|
|
2
2
|
import { Self } from '@fiction/types';
|
|
3
|
-
export interface
|
|
4
|
-
sdk?: FictionSDK;
|
|
5
|
-
handle?: string;
|
|
3
|
+
export interface WidgetUpdate {
|
|
6
4
|
self?: Self;
|
|
7
5
|
context?: string;
|
|
8
6
|
firstMessage?: string;
|
|
9
7
|
}
|
|
10
|
-
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
sdk?: FictionSDK;
|
|
10
|
+
handle?: string;
|
|
11
11
|
self?: Self;
|
|
12
12
|
context?: string;
|
|
13
13
|
firstMessage?: string;
|
|
14
|
-
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
};
|
|
15
16
|
declare function update(updates: WidgetUpdate): void;
|
|
16
17
|
declare function close(): void;
|
|
17
18
|
declare function open(): void;
|
|
18
|
-
declare const _default: import('vue').DefineComponent<
|
|
19
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
19
20
|
update: typeof update;
|
|
20
21
|
close: typeof close;
|
|
21
22
|
open: typeof open;
|
|
22
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<
|
|
23
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
23
24
|
export default _default;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { FictionSDK } from '../../sdkClient';
|
|
2
2
|
import { Self } from '@fiction/types';
|
|
3
|
-
interface
|
|
4
|
-
sdk?: FictionSDK;
|
|
5
|
-
handle?: string;
|
|
3
|
+
export interface WidgetUpdate {
|
|
6
4
|
self?: Self;
|
|
7
5
|
context?: string;
|
|
8
6
|
firstMessage?: string;
|
|
9
|
-
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
10
7
|
}
|
|
11
|
-
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
sdk?: FictionSDK;
|
|
10
|
+
handle?: string;
|
|
12
11
|
self?: Self;
|
|
13
12
|
context?: string;
|
|
14
13
|
firstMessage?: string;
|
|
15
|
-
|
|
14
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
15
|
+
};
|
|
16
16
|
declare function toggle(): void;
|
|
17
17
|
declare function open(): void;
|
|
18
18
|
declare function close(): void;
|
|
19
19
|
declare function update(updates: WidgetUpdate): void;
|
|
20
|
-
declare const _default: import('vue').DefineComponent<
|
|
20
|
+
declare const _default: import('vue').DefineComponent<__VLS_Props, {
|
|
21
21
|
toggle: typeof toggle;
|
|
22
22
|
open: typeof open;
|
|
23
23
|
close: typeof close;
|
|
24
24
|
update: typeof update;
|
|
25
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<
|
|
25
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
26
26
|
export default _default;
|
package/dist/widget.js
CHANGED
|
@@ -42,7 +42,7 @@ const v = `/*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */@la
|
|
|
42
42
|
async mountMode(r) {
|
|
43
43
|
const { mode: e } = this.config;
|
|
44
44
|
if (e === "inline") {
|
|
45
|
-
const { default: o } = await import("./SelfWidgetInline-
|
|
45
|
+
const { default: o } = await import("./SelfWidgetInline-C4beWxmY.js");
|
|
46
46
|
this.app = s(o, {
|
|
47
47
|
sdk: this.sdk,
|
|
48
48
|
handle: this.config.handle,
|
|
@@ -51,7 +51,7 @@ const v = `/*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */@la
|
|
|
51
51
|
firstMessage: this.config.firstMessage
|
|
52
52
|
}), this.widgetInstance = this.app.mount(r);
|
|
53
53
|
} else if (e === "popup") {
|
|
54
|
-
const { default: o } = await import("./SelfWidgetPopup-
|
|
54
|
+
const { default: o } = await import("./SelfWidgetPopup-C4Z-Xr5K.js");
|
|
55
55
|
this.app = s(o, {
|
|
56
56
|
sdk: this.sdk,
|
|
57
57
|
handle: this.config.handle,
|
|
@@ -62,13 +62,16 @@ const v = `/*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */@la
|
|
|
62
62
|
// Default position for popup
|
|
63
63
|
}), this.widgetInstance = this.app.mount(r);
|
|
64
64
|
} else if (e === "modal") {
|
|
65
|
-
const { default: o } = await import("./SelfWidgetModal-
|
|
65
|
+
const { default: o } = await import("./SelfWidgetModal-CgZjd7eG.js");
|
|
66
66
|
this.app = s(o, {
|
|
67
67
|
sdk: this.sdk,
|
|
68
68
|
handle: this.config.handle,
|
|
69
69
|
self: this.config.self,
|
|
70
70
|
context: this.config.context,
|
|
71
|
-
firstMessage: this.config.firstMessage
|
|
71
|
+
firstMessage: this.config.firstMessage,
|
|
72
|
+
onClose: /* @__PURE__ */ n(() => {
|
|
73
|
+
this.config.onClose && this.config.onClose(), this.destroy();
|
|
74
|
+
}, "onClose")
|
|
72
75
|
}), this.widgetInstance = this.app.mount(r);
|
|
73
76
|
} else
|
|
74
77
|
throw new Error(`FictionWidget: unsupported mode "${e}"`);
|
package/dist/widget.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sources":["../widget/FictionWidget.ts"],"sourcesContent":["import type { App, ComponentPublicInstance } from 'vue'\nimport type { Self } from '@fiction/types'\nimport { FictionSDK } from '../sdkClient'\nimport sdkCSS from '../self/ui/styles.css?inline'\nimport { createApp } from 'vue'\n\ntype WidgetMode = 'inline' | 'popup' | 'modal'\n\nexport interface WidgetConfig {\n el?: HTMLElement // Optional for modal mode (creates and appends to body)\n mode: WidgetMode\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n apiBase?: string\n}\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\ntype WidgetInstance = {\n toggle?: () => void\n open?: () => void\n close?: () => void\n update?: (config: WidgetUpdate) => void\n} & ComponentPublicInstance\n\nconst logger = {\n info: (message: string) => console.log(`[Fiction Widget] ${message}`),\n error: (message: string) => console.error(`[Fiction Widget] ${message}`),\n warn: (message: string) => console.warn(`[Fiction Widget] ${message}`),\n}\n\nexport class FictionWidget {\n private app: App | null = null\n private shadowRoot: ShadowRoot | null = null\n private widgetInstance: WidgetInstance | null = null\n private config: WidgetConfig\n private sdk: FictionSDK\n private container: HTMLElement | null = null\n private static modalInstances = new Map<string, FictionWidget>()\n\n constructor(config: WidgetConfig) {\n this.config = config\n\n // Validate required config\n if (!config.mode)\n throw new Error('FictionWidget: mode is required')\n if (!config.handle && !config.self)\n throw new Error('FictionWidget: either handle or self is required')\n\n // For non-modal modes, el is required\n if (config.mode !== 'modal' && !config.el)\n throw new Error(`FictionWidget: el (HTMLElement) is required for ${config.mode} mode`)\n\n // For modal mode, handle singleton pattern\n if (config.mode === 'modal') {\n const instanceKey = config.handle || config.self?.selfId || 'default'\n const existing = FictionWidget.modalInstances.get(instanceKey)\n if (existing) {\n logger.warn(`Destroying existing modal widget for: ${instanceKey}`)\n existing.destroy()\n }\n FictionWidget.modalInstances.set(instanceKey, this)\n }\n\n // Create SDK instance\n const isDev = typeof window !== 'undefined'\n ? window.location.hostname === 'localhost' || window.location.hostname.includes('127.0.0.1')\n : false\n\n this.sdk = new FictionSDK({\n isDev,\n apiBase: config.apiBase,\n })\n\n logger.info(`Initializing ${config.mode} mode for @${config.handle || config.self?.handle} (isDev: ${isDev})`)\n\n this.init()\n }\n\n private async init() {\n // For modal mode, create container and append to body\n if (this.config.mode === 'modal') {\n this.container = document.createElement('div')\n this.container.id = `fiction-modal-${this.config.handle || this.config.self?.selfId || 'widget'}`\n document.body.appendChild(this.container)\n\n // Create shadow root in modal container\n this.shadowRoot = this.container.attachShadow({ mode: 'open' })\n }\n else {\n // For other modes, use provided element\n this.shadowRoot = this.config.el!.attachShadow({ mode: 'open' })\n }\n\n // Inject SDK CSS into shadow DOM\n const styleElement = document.createElement('style')\n styleElement.textContent = sdkCSS\n this.shadowRoot.appendChild(styleElement)\n\n // Create mount point\n const mountPoint = document.createElement('div')\n mountPoint.id = 'fiction-widget-root'\n mountPoint.style.cssText = 'width: 100%; height: 100%;'\n this.shadowRoot.appendChild(mountPoint)\n\n // Import and mount mode-specific component\n await this.mountMode(mountPoint)\n }\n\n private async mountMode(mountPoint: HTMLElement) {\n const { mode } = this.config\n\n if (mode === 'inline') {\n const { default: SelfWidgetInline } = await import('./ui/SelfWidgetInline.vue')\n\n this.app = createApp(SelfWidgetInline, {\n sdk: this.sdk,\n handle: this.config.handle,\n self: this.config.self,\n context: this.config.context,\n firstMessage: this.config.firstMessage,\n })\n\n this.widgetInstance = this.app.mount(mountPoint) as WidgetInstance\n }\n else if (mode === 'popup') {\n const { default: SelfWidgetPopup } = await import('./ui/SelfWidgetPopup.vue')\n\n this.app = createApp(SelfWidgetPopup, {\n sdk: this.sdk,\n handle: this.config.handle,\n self: this.config.self,\n context: this.config.context,\n firstMessage: this.config.firstMessage,\n position: 'bottom-right', // Default position for popup\n })\n\n this.widgetInstance = this.app.mount(mountPoint) as WidgetInstance\n }\n else if (mode === 'modal') {\n const { default: SelfWidgetModal } = await import('../self/ui/SelfWidgetModal.vue')\n\n this.app = createApp(SelfWidgetModal, {\n sdk: this.sdk,\n handle: this.config.handle,\n self: this.config.self,\n context: this.config.context,\n firstMessage: this.config.firstMessage,\n })\n\n this.widgetInstance = this.app.mount(mountPoint) as WidgetInstance\n }\n else {\n throw new Error(`FictionWidget: unsupported mode \"${mode}\"`)\n }\n }\n\n /**\n * Update widget with new configuration without re-mounting\n */\n update(updates: WidgetUpdate) {\n if (this.widgetInstance?.update) {\n this.widgetInstance.update(updates)\n logger.info(`Widget updated: ${Object.keys(updates).join(', ')}`)\n }\n else {\n logger.warn('Widget instance does not support update()')\n }\n }\n\n /**\n * Toggle widget visibility (popup mode only)\n */\n toggle() {\n if (this.widgetInstance?.toggle) {\n this.widgetInstance.toggle()\n }\n else {\n logger.warn('Widget mode does not support toggle()')\n }\n }\n\n /**\n * Open widget (popup mode only)\n */\n open() {\n if (this.widgetInstance?.open) {\n this.widgetInstance.open()\n }\n else {\n logger.warn('Widget mode does not support open()')\n }\n }\n\n /**\n * Close widget (popup mode only)\n */\n close() {\n if (this.widgetInstance?.close) {\n this.widgetInstance.close()\n }\n else {\n logger.warn('Widget mode does not support close()')\n }\n }\n\n /**\n * Destroy widget and cleanup\n */\n destroy() {\n if (this.app) {\n this.app.unmount()\n this.app = null\n }\n\n if (this.shadowRoot) {\n this.shadowRoot.innerHTML = ''\n this.shadowRoot = null\n }\n\n // For modal mode, remove container from body and remove from singleton map\n if (this.config.mode === 'modal') {\n if (this.container) {\n this.container.remove()\n this.container = null\n }\n\n const instanceKey = this.config.handle || this.config.self?.selfId || 'default'\n FictionWidget.modalInstances.delete(instanceKey)\n }\n\n this.widgetInstance = null\n\n logger.info(`Widget destroyed for handle: ${this.config.handle || this.config.self?.handle}`)\n }\n}\n"],"names":["logger","__name","message","_FictionWidget","config","__publicField","instanceKey","existing","isDev","FictionSDK","styleElement","sdkCSS","mountPoint","mode","SelfWidgetInline","createApp","SelfWidgetPopup","SelfWidgetModal","updates","FictionWidget"],"mappings":";;;;;;+m0NA+BMA,IAAS;AAAA,EACb,MAAM,gBAAAC,EAAA,CAACC,MAAoB,QAAQ,IAAI,oBAAoBA,CAAO,EAAE,GAA9D;AAAA,EACN,OAAO,gBAAAD,EAAA,CAACC,MAAoB,QAAQ,MAAM,oBAAoBA,CAAO,EAAE,GAAhE;AAAA,EACP,MAAM,gBAAAD,EAAA,CAACC,MAAoB,QAAQ,KAAK,oBAAoBA,CAAO,EAAE,GAA/D;AACR,GAEaC,IAAN,MAAMA,EAAc;AAAA,EASzB,YAAYC,GAAsB;AAR1B,IAAAC,EAAA,aAAkB;AAClB,IAAAA,EAAA,oBAAgC;AAChC,IAAAA,EAAA,wBAAwC;AACxC,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GAAA,kBAOzBE,EAPWF,GAOI,kBAAiB,oBAAI,IAAA;AAP/B,IAAMgB,IAANhB;"}
|
|
1
|
+
{"version":3,"file":"widget.js","sources":["../widget/FictionWidget.ts"],"sourcesContent":["import type { App, ComponentPublicInstance } from 'vue'\nimport type { Self } from '@fiction/types'\nimport { FictionSDK } from '../sdkClient'\nimport sdkCSS from '../self/ui/styles.css?inline'\nimport { createApp } from 'vue'\n\ntype WidgetMode = 'inline' | 'popup' | 'modal'\n\nexport interface WidgetConfig {\n el?: HTMLElement // Optional for modal mode (creates and appends to body)\n mode: WidgetMode\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n apiBase?: string\n onClose?: () => void // Callback when widget is closed (modal/popup modes)\n}\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\ntype WidgetInstance = {\n toggle?: () => void\n open?: () => void\n close?: () => void\n update?: (config: WidgetUpdate) => void\n} & ComponentPublicInstance\n\nconst logger = {\n info: (message: string) => console.log(`[Fiction Widget] ${message}`),\n error: (message: string) => console.error(`[Fiction Widget] ${message}`),\n warn: (message: string) => console.warn(`[Fiction Widget] ${message}`),\n}\n\nexport class FictionWidget {\n private app: App | null = null\n private shadowRoot: ShadowRoot | null = null\n private widgetInstance: WidgetInstance | null = null\n private config: WidgetConfig\n private sdk: FictionSDK\n private container: HTMLElement | null = null\n private static modalInstances = new Map<string, FictionWidget>()\n\n constructor(config: WidgetConfig) {\n this.config = config\n\n // Validate required config\n if (!config.mode)\n throw new Error('FictionWidget: mode is required')\n if (!config.handle && !config.self)\n throw new Error('FictionWidget: either handle or self is required')\n\n // For non-modal modes, el is required\n if (config.mode !== 'modal' && !config.el)\n throw new Error(`FictionWidget: el (HTMLElement) is required for ${config.mode} mode`)\n\n // For modal mode, handle singleton pattern\n if (config.mode === 'modal') {\n const instanceKey = config.handle || config.self?.selfId || 'default'\n const existing = FictionWidget.modalInstances.get(instanceKey)\n if (existing) {\n logger.warn(`Destroying existing modal widget for: ${instanceKey}`)\n existing.destroy()\n }\n FictionWidget.modalInstances.set(instanceKey, this)\n }\n\n // Create SDK instance\n const isDev = typeof window !== 'undefined'\n ? window.location.hostname === 'localhost' || window.location.hostname.includes('127.0.0.1')\n : false\n\n this.sdk = new FictionSDK({\n isDev,\n apiBase: config.apiBase,\n })\n\n logger.info(`Initializing ${config.mode} mode for @${config.handle || config.self?.handle} (isDev: ${isDev})`)\n\n this.init()\n }\n\n private async init() {\n // For modal mode, create container and append to body\n if (this.config.mode === 'modal') {\n this.container = document.createElement('div')\n this.container.id = `fiction-modal-${this.config.handle || this.config.self?.selfId || 'widget'}`\n document.body.appendChild(this.container)\n\n // Create shadow root in modal container\n this.shadowRoot = this.container.attachShadow({ mode: 'open' })\n }\n else {\n // For other modes, use provided element\n this.shadowRoot = this.config.el!.attachShadow({ mode: 'open' })\n }\n\n // Inject SDK CSS into shadow DOM\n const styleElement = document.createElement('style')\n styleElement.textContent = sdkCSS\n this.shadowRoot.appendChild(styleElement)\n\n // Create mount point\n const mountPoint = document.createElement('div')\n mountPoint.id = 'fiction-widget-root'\n mountPoint.style.cssText = 'width: 100%; height: 100%;'\n this.shadowRoot.appendChild(mountPoint)\n\n // Import and mount mode-specific component\n await this.mountMode(mountPoint)\n }\n\n private async mountMode(mountPoint: HTMLElement) {\n const { mode } = this.config\n\n if (mode === 'inline') {\n const { default: SelfWidgetInline } = await import('./ui/SelfWidgetInline.vue')\n\n this.app = createApp(SelfWidgetInline, {\n sdk: this.sdk,\n handle: this.config.handle,\n self: this.config.self,\n context: this.config.context,\n firstMessage: this.config.firstMessage,\n })\n\n this.widgetInstance = this.app.mount(mountPoint) as WidgetInstance\n }\n else if (mode === 'popup') {\n const { default: SelfWidgetPopup } = await import('./ui/SelfWidgetPopup.vue')\n\n this.app = createApp(SelfWidgetPopup, {\n sdk: this.sdk,\n handle: this.config.handle,\n self: this.config.self,\n context: this.config.context,\n firstMessage: this.config.firstMessage,\n position: 'bottom-right', // Default position for popup\n })\n\n this.widgetInstance = this.app.mount(mountPoint) as WidgetInstance\n }\n else if (mode === 'modal') {\n const { default: SelfWidgetModal } = await import('./ui/SelfWidgetModal.vue')\n\n this.app = createApp(SelfWidgetModal, {\n sdk: this.sdk,\n handle: this.config.handle,\n self: this.config.self,\n context: this.config.context,\n firstMessage: this.config.firstMessage,\n onClose: () => {\n // Call user's onClose callback if provided\n if (this.config.onClose) {\n this.config.onClose()\n }\n // Auto-destroy modal when closed\n this.destroy()\n },\n })\n\n this.widgetInstance = this.app.mount(mountPoint) as WidgetInstance\n }\n else {\n throw new Error(`FictionWidget: unsupported mode \"${mode}\"`)\n }\n }\n\n /**\n * Update widget with new configuration without re-mounting\n */\n update(updates: WidgetUpdate) {\n if (this.widgetInstance?.update) {\n this.widgetInstance.update(updates)\n logger.info(`Widget updated: ${Object.keys(updates).join(', ')}`)\n }\n else {\n logger.warn('Widget instance does not support update()')\n }\n }\n\n /**\n * Toggle widget visibility (popup mode only)\n */\n toggle() {\n if (this.widgetInstance?.toggle) {\n this.widgetInstance.toggle()\n }\n else {\n logger.warn('Widget mode does not support toggle()')\n }\n }\n\n /**\n * Open widget (popup mode only)\n */\n open() {\n if (this.widgetInstance?.open) {\n this.widgetInstance.open()\n }\n else {\n logger.warn('Widget mode does not support open()')\n }\n }\n\n /**\n * Close widget (popup mode only)\n */\n close() {\n if (this.widgetInstance?.close) {\n this.widgetInstance.close()\n }\n else {\n logger.warn('Widget mode does not support close()')\n }\n }\n\n /**\n * Destroy widget and cleanup\n */\n destroy() {\n if (this.app) {\n this.app.unmount()\n this.app = null\n }\n\n if (this.shadowRoot) {\n this.shadowRoot.innerHTML = ''\n this.shadowRoot = null\n }\n\n // For modal mode, remove container from body and remove from singleton map\n if (this.config.mode === 'modal') {\n if (this.container) {\n this.container.remove()\n this.container = null\n }\n\n const instanceKey = this.config.handle || this.config.self?.selfId || 'default'\n FictionWidget.modalInstances.delete(instanceKey)\n }\n\n this.widgetInstance = null\n\n logger.info(`Widget destroyed for handle: ${this.config.handle || this.config.self?.handle}`)\n }\n}\n"],"names":["logger","__name","message","_FictionWidget","config","__publicField","instanceKey","existing","isDev","FictionSDK","styleElement","sdkCSS","mountPoint","mode","SelfWidgetInline","createApp","SelfWidgetPopup","SelfWidgetModal","updates","FictionWidget"],"mappings":";;;;;;+m0NAgCMA,IAAS;AAAA,EACb,MAAM,gBAAAC,EAAA,CAACC,MAAoB,QAAQ,IAAI,oBAAoBA,CAAO,EAAE,GAA9D;AAAA,EACN,OAAO,gBAAAD,EAAA,CAACC,MAAoB,QAAQ,MAAM,oBAAoBA,CAAO,EAAE,GAAhE;AAAA,EACP,MAAM,gBAAAD,EAAA,CAACC,MAAoB,QAAQ,KAAK,oBAAoBA,CAAO,EAAE,GAA/D;AACR,GAEaC,IAAN,MAAMA,EAAc;AAAA,EASzB,YAAYC,GAAsB;AAR1B,IAAAC,EAAA,aAAkB;AAClB,IAAAA,EAAA,oBAAgC;AAChC,IAAAA,EAAA,wBAAwC;AACxC,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA,mBAAgC;AAOtC,QAHA,KAAK,SAASD,GAGV,CAACA,EAAO;AACV,YAAM,IAAI,MAAM,iCAAiC;AACnD,QAAI,CAACA,EAAO,UAAU,CAACA,EAAO;AAC5B,YAAM,IAAI,MAAM,kDAAkD;AAGpE,QAAIA,EAAO,SAAS,WAAW,CAACA,EAAO;AACrC,YAAM,IAAI,MAAM,mDAAmDA,EAAO,IAAI,OAAO;AAGvF,QAAIA,EAAO,SAAS,SAAS;AAC3B,YAAME,IAAcF,EAAO,UAAUA,EAAO,MAAM,UAAU,WACtDG,IAAWJ,EAAc,eAAe,IAAIG,CAAW;AAC7D,MAAIC,MACFP,EAAO,KAAK,yCAAyCM,CAAW,EAAE,GAClEC,EAAS,QAAA,IAEXJ,EAAc,eAAe,IAAIG,GAAa,IAAI;AAAA,IACpD;AAGA,UAAME,IAAQ,OAAO,SAAW,MAC5B,OAAO,SAAS,aAAa,eAA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D;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO;AACL,IAAI,KAAK,gBAAgB,OACvB,KAAK,eAAe,KAAA,IAGpBA,EAAO,KAAK,qCAAqC;AAAA,EAErD;AAAA;AAAA;AAAA;AAAA,EAKA,QAAQ;AACN,IAAI,KAAK,gBAAgB,QACvB,KAAK,eAAe,MAAA,IAGpBA,EAAO,KAAK,sCAAsC;AAAA,EAEtD;AAAA;AAAA;AAAA;AAAA,EAKA,UAAU;AAYR,QAXI,KAAK,QACP,KAAK,IAAI,QAAA,GACT,KAAK,MAAM,OAGT,KAAK,eACP,KAAK,WAAW,YAAY,IAC5B,KAAK,aAAa,OAIhB,KAAK,OAAO,SAAS,SAAS;AAChC,MAAI,KAAK,cACP,KAAK,UAAU,OAAA,GACf,KAAK,YAAY;AAGnB,YAAMM,IAAc,KAAK,OAAO,UAAU,KAAK,OAAO,MAAM,UAAU;AACtE,MAAAH,EAAc,eAAe,OAAOG,CAAW;AAAA,IACjD;AAEA,SAAK,iBAAiB,MAEtBN,EAAO,KAAK,gCAAgC,KAAK,OAAO,UAAU,KAAK,OAAO,MAAM,MAAM,EAAE;AAAA,EAC9F;AACF;AApN2BC,EAAAE,GAAA,kBAOzBE,EAPWF,GAOI,kBAAiB,oBAAI,IAAA;AAP/B,IAAMgB,IAANhB;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiction/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "SDK for Fiction app authentication and user management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/sdk.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"nanoid": "^5.1.6",
|
|
60
60
|
"nanostores": "^1.0.1",
|
|
61
61
|
"zod": "^4.1.12",
|
|
62
|
-
"@fiction/types": "1.0.
|
|
62
|
+
"@fiction/types": "1.0.13"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@antfu/eslint-config": "^5.4.1",
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var u = Object.defineProperty;
|
|
2
|
-
var r = (t, n) => u(t, "name", { value: n, configurable: !0 });
|
|
3
|
-
import { defineComponent as v, ref as a, watch as c, createBlock as x, openBlock as d } from "vue";
|
|
4
|
-
import { _ as m } from "./SelfProvider.vue_vue_type_script_setup_true_lang-hdOg9n4q.js";
|
|
5
|
-
const _ = /* @__PURE__ */ v({
|
|
6
|
-
__name: "SelfWidgetInline",
|
|
7
|
-
props: {
|
|
8
|
-
sdk: {},
|
|
9
|
-
handle: {},
|
|
10
|
-
self: {},
|
|
11
|
-
context: {},
|
|
12
|
-
firstMessage: {}
|
|
13
|
-
},
|
|
14
|
-
setup(t, { expose: n }) {
|
|
15
|
-
const s = t, o = a(s.self), f = a(s.context), l = a(s.firstMessage);
|
|
16
|
-
function i(e) {
|
|
17
|
-
e.self !== void 0 && (o.value = e.self), e.context !== void 0 && (f.value = e.context), e.firstMessage !== void 0 && (l.value = e.firstMessage);
|
|
18
|
-
}
|
|
19
|
-
return r(i, "update"), c(() => s.self, (e) => {
|
|
20
|
-
e && (o.value = e);
|
|
21
|
-
}), c(() => s.context, (e) => {
|
|
22
|
-
f.value = e;
|
|
23
|
-
}), c(() => s.firstMessage, (e) => {
|
|
24
|
-
l.value = e;
|
|
25
|
-
}), n({
|
|
26
|
-
update: i
|
|
27
|
-
}), (e, g) => (d(), x(m, {
|
|
28
|
-
sdk: t.sdk,
|
|
29
|
-
handle: t.handle,
|
|
30
|
-
self: o.value,
|
|
31
|
-
context: f.value,
|
|
32
|
-
"first-message": l.value
|
|
33
|
-
}, null, 8, ["sdk", "handle", "self", "context", "first-message"]));
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
export {
|
|
37
|
-
_ as default
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=SelfWidgetInline-4qXty8nA.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelfWidgetInline-4qXty8nA.js","sources":["../widget/ui/SelfWidgetInline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport { ref, watch } from 'vue'\nimport SelfProvider from '../../self/ui/SelfProvider.vue'\n\nexport interface Props {\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nconst props = defineProps<Props>()\n\n// Local state for updateable props\nconst currentSelf = ref<Self | undefined>(props.self)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\n\n// Update method exposed to FictionWidget\nfunction update(updates: WidgetUpdate) {\n if (updates.self !== undefined)\n currentSelf.value = updates.self\n\n if (updates.context !== undefined)\n currentContext.value = updates.context\n\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n}\n\n// Watch for prop changes and sync to local state\nwatch(() => props.self, (newSelf) => {\n if (newSelf)\n currentSelf.value = newSelf\n})\n\nwatch(() => props.context, (newContext) => {\n currentContext.value = newContext\n})\n\nwatch(() => props.firstMessage, (newFirstMessage) => {\n currentFirstMessage.value = newFirstMessage\n})\n\ndefineExpose({\n update,\n})\n</script>\n\n<template>\n <SelfProvider\n :sdk=\"sdk\"\n :handle=\"handle\"\n :self=\"currentSelf\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n />\n</template>\n"],"names":["props","__props","currentSelf","ref","currentContext","currentFirstMessage","update","updates","__name","watch","newSelf","newContext","newFirstMessage","__expose","_createBlock","SelfProvider"],"mappings":";;;;;;;;;;;;;;AAoBA,UAAMA,IAAQC,GAGRC,IAAcC,EAAsBH,EAAM,IAAI,GAC9CI,IAAiBD,EAAwBH,EAAM,OAAO,GACtDK,IAAsBF,EAAwBH,EAAM,YAAY;AAGtE,aAASM,EAAOC,GAAuB;AACrC,MAAIA,EAAQ,SAAS,WACnBL,EAAY,QAAQK,EAAQ,OAE1BA,EAAQ,YAAY,WACtBH,EAAe,QAAQG,EAAQ,UAE7BA,EAAQ,iBAAiB,WAC3BF,EAAoB,QAAQE,EAAQ;AAAA,IACxC;AATS,WAAAC,EAAAF,GAAA,WAYTG,EAAM,MAAMT,EAAM,MAAM,CAACU,MAAY;AACnC,MAAIA,MACFR,EAAY,QAAQQ;AAAA,IACxB,CAAC,GAEDD,EAAM,MAAMT,EAAM,SAAS,CAACW,MAAe;AACzC,MAAAP,EAAe,QAAQO;AAAA,IACzB,CAAC,GAEDF,EAAM,MAAMT,EAAM,cAAc,CAACY,MAAoB;AACnD,MAAAP,EAAoB,QAAQO;AAAA,IAC9B,CAAC,GAEDC,EAAa;AAAA,MACX,QAAAP;AAAA,IAAA,CACD,mBAICQ,EAMEC,GAAA;AAAA,MALC,KAAKd,EAAA;AAAA,MACL,QAAQA,EAAA;AAAA,MACR,MAAMC,EAAA;AAAA,MACN,SAASE,EAAA;AAAA,MACT,iBAAeC,EAAA;AAAA,IAAA;;;"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var m = Object.defineProperty;
|
|
2
|
-
var t = (s, a) => m(s, "name", { value: a, configurable: !0 });
|
|
3
|
-
import { defineComponent as x, ref as l, createBlock as h, openBlock as g, withCtx as _, createVNode as p } from "vue";
|
|
4
|
-
import { _ as k } from "./FModal.vue_vue_type_script_setup_true_lang-DaI-YWPp.js";
|
|
5
|
-
import { _ as C } from "./SelfProvider.vue_vue_type_script_setup_true_lang-hdOg9n4q.js";
|
|
6
|
-
const $ = /* @__PURE__ */ x({
|
|
7
|
-
__name: "SelfWidgetModal",
|
|
8
|
-
props: {
|
|
9
|
-
sdk: {},
|
|
10
|
-
handle: {},
|
|
11
|
-
self: {},
|
|
12
|
-
context: {},
|
|
13
|
-
firstMessage: {}
|
|
14
|
-
},
|
|
15
|
-
setup(s, { expose: a }) {
|
|
16
|
-
const f = s, i = l(f.self), c = l(f.context), r = l(f.firstMessage), o = l(!0);
|
|
17
|
-
function u(e) {
|
|
18
|
-
e.self !== void 0 && (i.value = e.self), e.context !== void 0 && (c.value = e.context), e.firstMessage !== void 0 && (r.value = e.firstMessage);
|
|
19
|
-
}
|
|
20
|
-
t(u, "update");
|
|
21
|
-
function n() {
|
|
22
|
-
o.value = !1;
|
|
23
|
-
}
|
|
24
|
-
t(n, "close");
|
|
25
|
-
function d() {
|
|
26
|
-
o.value = !0;
|
|
27
|
-
}
|
|
28
|
-
t(d, "open");
|
|
29
|
-
function v(e) {
|
|
30
|
-
o.value = e, e || n();
|
|
31
|
-
}
|
|
32
|
-
return t(v, "handleVisChange"), a({
|
|
33
|
-
update: u,
|
|
34
|
-
close: n,
|
|
35
|
-
open: d
|
|
36
|
-
}), (e, M) => (g(), h(k, {
|
|
37
|
-
vis: o.value,
|
|
38
|
-
"disable-teleport": !0,
|
|
39
|
-
"modal-class": "max-w-4xl h-[80vh] md:h-[600px]",
|
|
40
|
-
"has-close": !1,
|
|
41
|
-
"onUpdate:vis": v,
|
|
42
|
-
onClose: n
|
|
43
|
-
}, {
|
|
44
|
-
default: _(() => [
|
|
45
|
-
p(C, {
|
|
46
|
-
sdk: s.sdk,
|
|
47
|
-
handle: s.handle,
|
|
48
|
-
self: i.value,
|
|
49
|
-
context: c.value,
|
|
50
|
-
"first-message": r.value,
|
|
51
|
-
"has-close": !0,
|
|
52
|
-
onClose: n
|
|
53
|
-
}, null, 8, ["sdk", "handle", "self", "context", "first-message"])
|
|
54
|
-
]),
|
|
55
|
-
_: 1
|
|
56
|
-
}, 8, ["vis"]));
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
export {
|
|
60
|
-
$ as default
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=SelfWidgetModal-DWA5AU4S.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelfWidgetModal-DWA5AU4S.js","sources":["../self/ui/SelfWidgetModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport { ref } from 'vue'\nimport FModal from '@/ui/common/FModal.vue'\nimport SelfProvider from './SelfProvider.vue'\n\nexport interface Props {\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nconst props = defineProps<Props>()\n\n// Local state for updateable props\nconst currentSelf = ref<Self | undefined>(props.self)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\nconst isVisible = ref(true)\n\n// Update method exposed to FictionWidget\nfunction update(updates: WidgetUpdate) {\n if (updates.self !== undefined)\n currentSelf.value = updates.self\n\n if (updates.context !== undefined)\n currentContext.value = updates.context\n\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n}\n\nfunction close() {\n isVisible.value = false\n}\n\nfunction open() {\n isVisible.value = true\n}\n\nfunction handleVisChange(newVis: boolean) {\n isVisible.value = newVis\n if (!newVis) {\n close()\n }\n}\n\ndefineExpose({\n update,\n close,\n open,\n})\n</script>\n\n<template>\n <!-- FModal with teleport disabled (renders inline in shadow DOM) -->\n <FModal\n :vis=\"isVisible\"\n :disable-teleport=\"true\"\n modal-class=\"max-w-4xl h-[80vh] md:h-[600px]\"\n :has-close=\"false\"\n @update:vis=\"handleVisChange\"\n @close=\"close\"\n >\n <SelfProvider\n :sdk=\"sdk\"\n :handle=\"handle\"\n :self=\"currentSelf\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n :has-close=\"true\"\n @close=\"close\"\n />\n </FModal>\n</template>\n"],"names":["props","__props","currentSelf","ref","currentContext","currentFirstMessage","isVisible","update","updates","__name","close","open","handleVisChange","newVis","__expose","_createBlock","FModal","_createVNode","SelfProvider"],"mappings":";;;;;;;;;;;;;;;AAqBA,UAAMA,I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nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport { nextTick, ref, watch } from 'vue'\nimport { getFallbackAvatarDataUrl, getSelfAvatarUrl } from '../../self/utils'\nimport SelfAgent from '../../self/ui/SelfAgent.vue'\nimport SelfWrap from '../../self/ui/SelfWrap.vue'\n\ninterface Props {\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left'\n}\n\nexport interface WidgetUpdate {\n self?: Self\n context?: string\n firstMessage?: string\n}\n\nconst props = defineProps<Props>()\nconst isOpen = ref(false)\nconst isAgentActive = ref(false)\n\n// Local state for updateable props\nconst currentSelf = ref<Self | undefined>(props.self)\nconst currentContext = ref<string | undefined>(props.context)\nconst currentFirstMessage = ref<string | undefined>(props.firstMessage)\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 }\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\n// Update method exposed to FictionWidget\nfunction update(updates: WidgetUpdate) {\n if (updates.self !== undefined)\n currentSelf.value = updates.self\n\n if (updates.context !== undefined)\n currentContext.value = updates.context\n\n if (updates.firstMessage !== undefined)\n currentFirstMessage.value = updates.firstMessage\n}\n\n// Watch for prop changes and sync to local state\nwatch(() => props.self, (newSelf) => {\n if (newSelf)\n currentSelf.value = newSelf\n})\n\nwatch(() => props.context, (newContext) => {\n currentContext.value = newContext\n})\n\nwatch(() => props.firstMessage, (newFirstMessage) => {\n currentFirstMessage.value = newFirstMessage\n})\n\ndefineExpose({\n toggle,\n open,\n close,\n update,\n})\n</script>\n\n<template>\n <SelfWrap\n v-slot=\"{ self, sdk: resolvedSdk }\"\n :sdk=\"sdk\"\n :handle=\"handle\"\n :self=\"currentSelf\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n >\n <!-- Fixed Widget Wrapper -->\n <div\n v-if=\"self\"\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=\"getSelfAvatarUrl(self) || getFallbackAvatarDataUrl()\"\n :alt=\"`${self.name} digital self`\"\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 <SelfAgent\n v-if=\"isOpen && self\"\n class=\"rounded-3xl shadow-2xl border border-white/10\"\n :sdk=\"resolvedSdk\"\n :self=\"self\"\n :context=\"currentContext\"\n :first-message=\"currentFirstMessage\"\n :has-close=\"true\"\n :is-active=\"isAgentActive\"\n @close=\"handleClose\"\n />\n </div>\n </div>\n </SelfWrap>\n</template>\n"],"names":["props","__props","isOpen","ref","isAgentActive","currentSelf","currentContext","currentFirstMessage","toggle","__name","watch","newValue","nextTick","open","close","handleClose","update","updates","newSelf","newContext","newFirstMessage","__expose","_createBlock","SelfWrap","self","resolvedSdk","_createElementBlock","_createElementVNode","_normalizeStyle","_cache","$event","_openBlock","_hoisted_1","_hoisted_2","_unref","getSelfAvatarUrl","getFallbackAvatarDataUrl","SelfAgent"],"mappings":";;;;;;;;;;;;;;;;;;AAuBA,UAAMA,IAAQC,GACRC,IAASC,EAAI,EAAK,GAClBC,IAAgBD,EAAI,EAAK,GAGzBE,IAAcF,EAAsBH,EAAM,IAAI,GAC9CM,IAAiBH,EAAwBH,EAAM,OAAO,GACtDO,IAAsBJ,EAAwBH,EAAM,YAAY;AAEtE,aAASQ,IAAS;AAChB,MAAAN,EAAO,QAAQ,CAACA,EAAO;AAAA,IACzB;AAFS,IAAAO,EAAAD,GAAA,WAKTE,EAAMR,GAAQ,OAAOS,MAAa;AAChC,MAAIA,KAEF,MAAMC,EAAA,GACN,WAAW,MAAM;AACf,QAAAR,EAAc,QAAQ;AAAA,MACxB,GAAG,GAAG,KAINA,EAAc,QAAQ;AAAA,IAE1B,CAAC;AAED,aAASS,IAAO;AACd,MAAAX,EAAO,QAAQ;AAAA,IACjB;AAFS,IAAAO,EAAAI,GAAA;AA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