@fiction/sdk 1.0.87 → 1.0.89
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/SelfProvider.vue_vue_type_script_setup_true_lang-C0Bri7Md.js +42 -0
- package/dist/SelfProvider.vue_vue_type_script_setup_true_lang-C0Bri7Md.js.map +1 -0
- package/dist/SelfWidgetInline-BEXm2Zjz.js +35 -0
- package/dist/SelfWidgetInline-BEXm2Zjz.js.map +1 -0
- package/dist/SelfWidgetModal-DgX1OdRX.js +66 -0
- package/dist/SelfWidgetModal-DgX1OdRX.js.map +1 -0
- package/dist/SelfWidgetPopup-BVKJE-BW.js +117 -0
- package/dist/SelfWidgetPopup-BVKJE-BW.js.map +1 -0
- package/dist/{SelfWrap.vue_vue_type_script_setup_true_lang-DcjZRnSG.js → SelfWrap.vue_vue_type_script_setup_true_lang-Dy16trSb.js} +862 -841
- package/dist/SelfWrap.vue_vue_type_script_setup_true_lang-Dy16trSb.js.map +1 -0
- package/dist/sdk.css +1 -1
- package/dist/self/ui/SelfAgent.vue.d.ts +3 -0
- package/dist/self/ui/SelfProvider.vue.d.ts +3 -0
- package/dist/self/ui/SelfWrap.vue.d.ts +5 -0
- package/dist/self/utils.d.ts +16 -0
- package/dist/self.js +25 -24
- package/dist/widget/FictionWidget.d.ts +5 -0
- package/dist/widget/index.d.ts +1 -1
- package/dist/widget/ui/SelfWidgetInline.vue.d.ts +3 -5
- package/dist/widget/ui/SelfWidgetModal.vue.d.ts +3 -5
- package/dist/widget/ui/SelfWidgetPopup.vue.d.ts +3 -5
- package/dist/widget.js +45 -37
- package/dist/widget.js.map +1 -1
- package/package.json +2 -2
- package/dist/SelfProvider.vue_vue_type_script_setup_true_lang-BbEo445n.js +0 -38
- package/dist/SelfProvider.vue_vue_type_script_setup_true_lang-BbEo445n.js.map +0 -1
- package/dist/SelfWidgetInline-DcJoMxUE.js +0 -31
- package/dist/SelfWidgetInline-DcJoMxUE.js.map +0 -1
- package/dist/SelfWidgetModal-DczbQKQ7.js +0 -62
- package/dist/SelfWidgetModal-DczbQKQ7.js.map +0 -1
- package/dist/SelfWidgetPopup-BbrEUvSC.js +0 -111
- package/dist/SelfWidgetPopup-BbrEUvSC.js.map +0 -1
- package/dist/SelfWrap.vue_vue_type_script_setup_true_lang-DcjZRnSG.js.map +0 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineComponent as i, createBlock as l, openBlock as c, mergeProps as f, withCtx as u, createVNode as m } from "vue";
|
|
2
|
+
import { _ as p, a as x } from "./SelfWrap.vue_vue_type_script_setup_true_lang-Dy16trSb.js";
|
|
3
|
+
const k = /* @__PURE__ */ i({
|
|
4
|
+
__name: "SelfProvider",
|
|
5
|
+
props: {
|
|
6
|
+
sdk: {},
|
|
7
|
+
self: {},
|
|
8
|
+
handle: {},
|
|
9
|
+
context: {},
|
|
10
|
+
firstMessage: {},
|
|
11
|
+
buttonText: {},
|
|
12
|
+
buttonIcon: {},
|
|
13
|
+
hasClose: { type: Boolean },
|
|
14
|
+
apiBase: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["close", "error"],
|
|
17
|
+
setup(r, { emit: a }) {
|
|
18
|
+
const e = r, n = a;
|
|
19
|
+
return (d, t) => (c(), l(p, f(e, { class: "self-provider size-full relative" }), {
|
|
20
|
+
default: u((s) => [
|
|
21
|
+
m(x, {
|
|
22
|
+
sdk: s.sdk,
|
|
23
|
+
self: s.self,
|
|
24
|
+
context: s.context,
|
|
25
|
+
"first-message": s.firstMessage,
|
|
26
|
+
"button-text": e.buttonText,
|
|
27
|
+
"button-icon": e.buttonIcon,
|
|
28
|
+
"has-close": e.hasClose,
|
|
29
|
+
"is-active": !0,
|
|
30
|
+
class: "size-full",
|
|
31
|
+
onClose: t[0] || (t[0] = (o) => n("close", o)),
|
|
32
|
+
onError: t[1] || (t[1] = (o) => n("error", o))
|
|
33
|
+
}, null, 8, ["sdk", "self", "context", "first-message", "button-text", "button-icon", "has-close"])
|
|
34
|
+
]),
|
|
35
|
+
_: 1
|
|
36
|
+
}, 16));
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
export {
|
|
40
|
+
k as _
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=SelfProvider.vue_vue_type_script_setup_true_lang-C0Bri7Md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfProvider.vue_vue_type_script_setup_true_lang-C0Bri7Md.js","sources":["../self/ui/SelfProvider.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { ButtonIconPreset } from '../../widget/FictionWidget'\nimport type { Self } from '../schema'\nimport SelfAgent from './SelfAgent.vue'\nimport SelfWrap from './SelfWrap.vue'\n\nconst props = defineProps<{\n sdk?: FictionSDK\n self?: Self\n handle?: string\n context?: string\n firstMessage?: string\n buttonText?: string\n buttonIcon?: ButtonIconPreset\n hasClose?: boolean\n apiBase?: string\n}>()\n\nconst emit = defineEmits<{\n close: [value: string]\n error: [message: string]\n}>()\n\n</script>\n\n<template>\n <SelfWrap\n v-slot=\"slotProps\"\n v-bind=\"props\"\n class=\"self-provider size-full relative\"\n >\n <SelfAgent\n :sdk=\"slotProps.sdk\"\n :self=\"slotProps.self\"\n :context=\"slotProps.context\"\n :first-message=\"slotProps.firstMessage\"\n :button-text=\"props.buttonText\"\n :button-icon=\"props.buttonIcon\"\n :has-close=\"props.hasClose\"\n :is-active=\"true\"\n class=\"size-full\"\n @close=\"emit('close', $event)\"\n @error=\"emit('error', $event)\"\n />\n </SelfWrap>\n</template>\n"],"names":["props","__props","emit","__emit","_openBlock","_createBlock","SelfWrap","_mergeProps","_withCtx","slotProps","_createVNode","SelfAgent","_cache","$event"],"mappings":";;;;;;;;;;;;;;;;;AAOA,UAAMA,IAAQC,GAYRC,IAAOC;sBAQXC,EAAA,GAAAC,EAkBWC,GAlBXC,EAkBWP,GAhBI,EACb,OAAM,mCAAA,CAAkC,GAAA;AAAA,MAExC,SAAAQ,EAAA,CAJQC,MAAS;AAAA,QAIjBC,EAYEC,GAAA;AAAA,UAXC,KAAKF,EAAU;AAAA,UACf,MAAMA,EAAU;AAAA,UAChB,SAASA,EAAU;AAAA,UACnB,iBAAeA,EAAU;AAAA,UACzB,eAAaT,EAAM;AAAA,UACnB,eAAaA,EAAM;AAAA,UACnB,aAAWA,EAAM;AAAA,UACjB,aAAW;AAAA,UACZ,OAAM;AAAA,UACL,SAAKY,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEX,EAAI,SAAUW,CAAM;AAAA,UAC3B,SAAKD,EAAA,CAAA,MAAAA,EAAA,CAAA,IAAA,CAAAC,MAAEX,EAAI,SAAUW,CAAM;AAAA,QAAA;;;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var u = (e, s) => x(e, "name", { value: s, configurable: !0 });
|
|
3
|
+
import { defineComponent as v, ref as o, createBlock as b, openBlock as m } from "vue";
|
|
4
|
+
import { _ as d } from "./SelfProvider.vue_vue_type_script_setup_true_lang-C0Bri7Md.js";
|
|
5
|
+
const M = /* @__PURE__ */ v({
|
|
6
|
+
__name: "SelfWidgetInline",
|
|
7
|
+
props: {
|
|
8
|
+
sdk: {},
|
|
9
|
+
handle: {},
|
|
10
|
+
self: {},
|
|
11
|
+
context: {},
|
|
12
|
+
firstMessage: {},
|
|
13
|
+
buttonText: {},
|
|
14
|
+
buttonIcon: {}
|
|
15
|
+
},
|
|
16
|
+
setup(e, { expose: s }) {
|
|
17
|
+
const n = e, c = o(n.self), l = o(n.context), r = o(n.firstMessage), f = o(n.buttonText), i = o(n.buttonIcon);
|
|
18
|
+
function a(t) {
|
|
19
|
+
t.self !== void 0 && (c.value = t.self), t.context !== void 0 && (l.value = t.context), t.firstMessage !== void 0 && (r.value = t.firstMessage), t.buttonText !== void 0 && (f.value = t.buttonText), t.buttonIcon !== void 0 && (i.value = t.buttonIcon);
|
|
20
|
+
}
|
|
21
|
+
return u(a, "update"), s({ update: a }), (t, g) => (m(), b(d, {
|
|
22
|
+
sdk: e.sdk,
|
|
23
|
+
handle: e.handle,
|
|
24
|
+
self: c.value,
|
|
25
|
+
context: l.value,
|
|
26
|
+
"first-message": r.value,
|
|
27
|
+
"button-text": f.value,
|
|
28
|
+
"button-icon": i.value
|
|
29
|
+
}, null, 8, ["sdk", "handle", "self", "context", "first-message", "button-text", "button-icon"]));
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
M as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=SelfWidgetInline-BEXm2Zjz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfWidgetInline-BEXm2Zjz.js","sources":["../widget/ui/SelfWidgetInline.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport type { ButtonIconPreset, WidgetUpdate } from '../FictionWidget'\nimport { ref } from 'vue'\nimport SelfProvider from '../../self/ui/SelfProvider.vue'\n\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n buttonText?: string\n buttonIcon?: ButtonIconPreset\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)\nconst currentButtonText = ref<string | undefined>(props.buttonText)\nconst currentButtonIcon = ref<ButtonIconPreset | undefined>(props.buttonIcon)\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 if (updates.buttonText !== undefined)\n currentButtonText.value = updates.buttonText\n if (updates.buttonIcon !== undefined)\n currentButtonIcon.value = updates.buttonIcon\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 :button-text=\"currentButtonText\"\n :button-icon=\"currentButtonIcon\"\n />\n</template>\n"],"names":["props","__props","currentSelf","ref","currentContext","currentFirstMessage","currentButtonText","currentButtonIcon","update","updates","__name","__expose","_createBlock","SelfProvider"],"mappings":";;;;;;;;;;;;;;;;AAOA,UAAMA,IAAQC,GAWRC,IAAcC,EAAsBH,EAAM,IAAI,GAC9CI,IAAiBD,EAAwBH,EAAM,OAAO,GACtDK,IAAsBF,EAAwBH,EAAM,YAAY,GAChEM,IAAoBH,EAAwBH,EAAM,UAAU,GAC5DO,IAAoBJ,EAAkCH,EAAM,UAAU;AAE5E,aAASQ,EAAOC,GAAuB;AACrC,MAAIA,EAAQ,SAAS,WACnBP,EAAY,QAAQO,EAAQ,OAC1BA,EAAQ,YAAY,WACtBL,EAAe,QAAQK,EAAQ,UAC7BA,EAAQ,iBAAiB,WAC3BJ,EAAoB,QAAQI,EAAQ,eAClCA,EAAQ,eAAe,WACzBH,EAAkB,QAAQG,EAAQ,aAChCA,EAAQ,eAAe,WACzBF,EAAkB,QAAQE,EAAQ;AAAA,IACtC;AAXS,WAAAC,EAAAF,GAAA,WAaTG,EAAa,EAAE,QAAAH,GAAQ,mBAIrBI,EAQEC,GAAA;AAAA,MAPC,KAAKZ,EAAA;AAAA,MACL,QAAQA,EAAA;AAAA,MACR,MAAMC,EAAA;AAAA,MACN,SAASE,EAAA;AAAA,MACT,iBAAeC,EAAA;AAAA,MACf,eAAaC,EAAA;AAAA,MACb,eAAaC,EAAA;AAAA,IAAA;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var l = (n, i) => h(n, "name", { value: i, configurable: !0 });
|
|
3
|
+
import { defineComponent as g, ref as o, onMounted as C, nextTick as T, createBlock as k, openBlock as M, withCtx as _, createVNode as p } from "vue";
|
|
4
|
+
import { _ as I } from "./FModal.vue_vue_type_script_setup_true_lang-cL0BFEkZ.js";
|
|
5
|
+
import { _ as B } from "./SelfProvider.vue_vue_type_script_setup_true_lang-C0Bri7Md.js";
|
|
6
|
+
const V = /* @__PURE__ */ g({
|
|
7
|
+
__name: "SelfWidgetModal",
|
|
8
|
+
props: {
|
|
9
|
+
sdk: {},
|
|
10
|
+
handle: {},
|
|
11
|
+
self: {},
|
|
12
|
+
context: {},
|
|
13
|
+
firstMessage: {},
|
|
14
|
+
buttonText: {},
|
|
15
|
+
buttonIcon: {},
|
|
16
|
+
onClose: { type: Function }
|
|
17
|
+
},
|
|
18
|
+
setup(n, { expose: i }) {
|
|
19
|
+
const t = n, a = o(t.self), c = o(t.context), f = o(t.firstMessage), r = o(t.buttonText), v = o(t.buttonIcon), s = o(!1);
|
|
20
|
+
C(async () => {
|
|
21
|
+
await T(), setTimeout(() => {
|
|
22
|
+
s.value = !0;
|
|
23
|
+
}, 10);
|
|
24
|
+
});
|
|
25
|
+
function m(e) {
|
|
26
|
+
e.self !== void 0 && (a.value = e.self), e.context !== void 0 && (c.value = e.context), e.firstMessage !== void 0 && (f.value = e.firstMessage), e.buttonText !== void 0 && (r.value = e.buttonText), e.buttonIcon !== void 0 && (v.value = e.buttonIcon);
|
|
27
|
+
}
|
|
28
|
+
l(m, "update");
|
|
29
|
+
function u() {
|
|
30
|
+
s.value = !1, setTimeout(() => {
|
|
31
|
+
t.onClose && t.onClose();
|
|
32
|
+
}, 300);
|
|
33
|
+
}
|
|
34
|
+
l(u, "close");
|
|
35
|
+
function d() {
|
|
36
|
+
s.value = !0;
|
|
37
|
+
}
|
|
38
|
+
return l(d, "open"), i({ update: m, close: u, open: d }), (e, x) => (M(), k(I, {
|
|
39
|
+
vis: s.value,
|
|
40
|
+
"disable-teleport": !0,
|
|
41
|
+
"modal-class": "max-w-4xl h-[80vh] md:h-[600px]",
|
|
42
|
+
"has-close": !1,
|
|
43
|
+
"onUpdate:vis": x[0] || (x[0] = (b) => s.value = b),
|
|
44
|
+
onClose: u
|
|
45
|
+
}, {
|
|
46
|
+
default: _(() => [
|
|
47
|
+
p(B, {
|
|
48
|
+
sdk: n.sdk,
|
|
49
|
+
handle: n.handle,
|
|
50
|
+
self: a.value,
|
|
51
|
+
context: c.value,
|
|
52
|
+
"first-message": f.value,
|
|
53
|
+
"button-text": r.value,
|
|
54
|
+
"button-icon": v.value,
|
|
55
|
+
"has-close": !0,
|
|
56
|
+
onClose: u
|
|
57
|
+
}, null, 8, ["sdk", "handle", "self", "context", "first-message", "button-text", "button-icon"])
|
|
58
|
+
]),
|
|
59
|
+
_: 1
|
|
60
|
+
}, 8, ["vis"]));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
export {
|
|
64
|
+
V as default
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=SelfWidgetModal-DgX1OdRX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfWidgetModal-DgX1OdRX.js","sources":["../widget/ui/SelfWidgetModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport type { ButtonIconPreset, WidgetUpdate } from '../FictionWidget'\nimport { nextTick, onMounted, ref } from 'vue'\nimport FModal from '@/ui/common/FModal.vue'\nimport SelfProvider from '../../self/ui/SelfProvider.vue'\n\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n buttonText?: string\n buttonIcon?: ButtonIconPreset\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 currentButtonText = ref<string | undefined>(props.buttonText)\nconst currentButtonIcon = ref<ButtonIconPreset | undefined>(props.buttonIcon)\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 if (updates.buttonText !== undefined)\n currentButtonText.value = updates.buttonText\n if (updates.buttonIcon !== undefined)\n currentButtonIcon.value = updates.buttonIcon\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 :button-text=\"currentButtonText\"\n :button-icon=\"currentButtonIcon\"\n :has-close=\"true\"\n @close=\"close\"\n />\n </FModal>\n</template>\n"],"names":["props","__props","currentSelf","ref","currentContext","currentFirstMessage","currentButtonText","currentButtonIcon","isVisible","onMounted","nextTick","update","updates","__name","close","open","__expose","_createBlock","FModal","_cache","$event","_createVNode","SelfProvider"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,UAAMA,IAAQC,GAWRC,IAAcC,EAAsBH,EAAM,IAAI,GAC9CI,IAAiBD,EAAwBH,EAAM,OAAO,GACtDK,IAAsBF,EAAwBH,EAAM,YAAY,GAChEM,IAAoBH,EAAwBH,EAAM,UAAU,GAC5DO,IAAoBJ,EAAkCH,EAAM,UAAU,GACtEQ,IAAYL,EAAI,EAAK;AAG3B,IAAAM,EAAU,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,0 +1,117 @@
|
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var s = (a, c) => I(a, "name", { value: c, configurable: !0 });
|
|
3
|
+
import { defineComponent as M, ref as n, watch as A, nextTick as S, createBlock as w, openBlock as u, withCtx as $, createElementBlock as k, createCommentVNode as p, normalizeClass as y, createElementVNode as i, normalizeStyle as j, unref as C } from "vue";
|
|
4
|
+
import { _ as E, g as F, b as N, a as U } from "./SelfWrap.vue_vue_type_script_setup_true_lang-Dy16trSb.js";
|
|
5
|
+
const V = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "relative h-full w-full"
|
|
8
|
+
}, 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" }, O = ["src", "alt"], H = /* @__PURE__ */ M({
|
|
9
|
+
__name: "SelfWidgetPopup",
|
|
10
|
+
props: {
|
|
11
|
+
sdk: {},
|
|
12
|
+
handle: {},
|
|
13
|
+
self: {},
|
|
14
|
+
context: {},
|
|
15
|
+
firstMessage: {},
|
|
16
|
+
buttonText: {},
|
|
17
|
+
buttonIcon: {},
|
|
18
|
+
position: {}
|
|
19
|
+
},
|
|
20
|
+
setup(a, { expose: c }) {
|
|
21
|
+
const e = a, o = n(!1), f = n(!1), x = n(e.self), v = n(e.context), d = n(e.firstMessage), g = n(e.buttonText), b = n(e.buttonIcon);
|
|
22
|
+
function m() {
|
|
23
|
+
o.value = !o.value;
|
|
24
|
+
}
|
|
25
|
+
s(m, "toggle"), A(o, async (t) => {
|
|
26
|
+
t ? (await S(), setTimeout(() => {
|
|
27
|
+
f.value = !0;
|
|
28
|
+
}, 400)) : f.value = !1;
|
|
29
|
+
});
|
|
30
|
+
function _() {
|
|
31
|
+
o.value = !0;
|
|
32
|
+
}
|
|
33
|
+
s(_, "open");
|
|
34
|
+
function h() {
|
|
35
|
+
o.value = !1;
|
|
36
|
+
}
|
|
37
|
+
s(h, "close");
|
|
38
|
+
function z() {
|
|
39
|
+
h();
|
|
40
|
+
}
|
|
41
|
+
s(z, "handleClose");
|
|
42
|
+
function T(t) {
|
|
43
|
+
t.self !== void 0 && (x.value = t.self), t.context !== void 0 && (v.value = t.context), t.firstMessage !== void 0 && (d.value = t.firstMessage), t.buttonText !== void 0 && (g.value = t.buttonText), t.buttonIcon !== void 0 && (b.value = t.buttonIcon);
|
|
44
|
+
}
|
|
45
|
+
return s(T, "update"), c({
|
|
46
|
+
toggle: m,
|
|
47
|
+
open: _,
|
|
48
|
+
close: h,
|
|
49
|
+
update: T
|
|
50
|
+
}), (t, l) => (u(), w(E, {
|
|
51
|
+
sdk: a.sdk,
|
|
52
|
+
handle: a.handle,
|
|
53
|
+
self: x.value,
|
|
54
|
+
context: v.value,
|
|
55
|
+
"first-message": d.value,
|
|
56
|
+
"button-text": g.value,
|
|
57
|
+
"button-icon": b.value
|
|
58
|
+
}, {
|
|
59
|
+
default: $(({ self: r, sdk: B }) => [
|
|
60
|
+
r ? (u(), k("div", {
|
|
61
|
+
key: 0,
|
|
62
|
+
class: y(["fixed z-[999999] pointer-events-auto", [
|
|
63
|
+
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"
|
|
64
|
+
]])
|
|
65
|
+
}, [
|
|
66
|
+
i("div", {
|
|
67
|
+
class: y(["transition-all duration-500 ease-[cubic-bezier(0.25,1,0.33,1)] transform-gpu", [
|
|
68
|
+
o.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"
|
|
69
|
+
]]),
|
|
70
|
+
style: j({
|
|
71
|
+
"transform-origin": e.position === "bottom-left" ? "bottom left" : e.position === "top-right" ? "top right" : e.position === "top-left" ? "top left" : "bottom right"
|
|
72
|
+
}),
|
|
73
|
+
onClick: l[0] || (l[0] = (P) => o.value ? void 0 : m())
|
|
74
|
+
}, [
|
|
75
|
+
o.value ? p("", !0) : (u(), k("div", V, [
|
|
76
|
+
i("div", D, [
|
|
77
|
+
i("img", {
|
|
78
|
+
src: C(F)(r) || C(N)(),
|
|
79
|
+
alt: `${r.name} digital self`,
|
|
80
|
+
class: "h-full w-full object-cover pointer-events-none",
|
|
81
|
+
width: "80",
|
|
82
|
+
height: "80"
|
|
83
|
+
}, null, 8, O),
|
|
84
|
+
l[1] || (l[1] = i("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))
|
|
85
|
+
]),
|
|
86
|
+
l[2] || (l[2] = i("div", { class: "absolute top-0.5 right-0.5" }, [
|
|
87
|
+
i("div", {
|
|
88
|
+
class: "size-3 bg-green-500 rounded-full ring-2 ring-white absolute animate-ping",
|
|
89
|
+
style: { "animation-duration": "3s" }
|
|
90
|
+
}),
|
|
91
|
+
i("div", { class: "size-3 bg-green-500 rounded-full ring-2 ring-white" })
|
|
92
|
+
], -1))
|
|
93
|
+
])),
|
|
94
|
+
o.value && r ? (u(), w(U, {
|
|
95
|
+
key: 1,
|
|
96
|
+
class: "rounded-3xl shadow-2xl border border-white/10",
|
|
97
|
+
sdk: B,
|
|
98
|
+
self: r,
|
|
99
|
+
context: v.value,
|
|
100
|
+
"first-message": d.value,
|
|
101
|
+
"button-text": g.value,
|
|
102
|
+
"button-icon": b.value,
|
|
103
|
+
"has-close": !0,
|
|
104
|
+
"is-active": f.value,
|
|
105
|
+
onClose: z
|
|
106
|
+
}, null, 8, ["sdk", "self", "context", "first-message", "button-text", "button-icon", "is-active"])) : p("", !0)
|
|
107
|
+
], 6)
|
|
108
|
+
], 2)) : p("", !0)
|
|
109
|
+
]),
|
|
110
|
+
_: 1
|
|
111
|
+
}, 8, ["sdk", "handle", "self", "context", "first-message", "button-text", "button-icon"]));
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
export {
|
|
115
|
+
H as default
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=SelfWidgetPopup-BVKJE-BW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelfWidgetPopup-BVKJE-BW.js","sources":["../widget/ui/SelfWidgetPopup.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { FictionSDK } from '../../sdkClient'\nimport type { Self } from '@fiction/types'\nimport type { ButtonIconPreset, WidgetUpdate } from '../FictionWidget'\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\nconst props = defineProps<{\n sdk?: FictionSDK\n handle?: string\n self?: Self\n context?: string\n firstMessage?: string\n buttonText?: string\n buttonIcon?: ButtonIconPreset\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)\nconst currentButtonText = ref<string | undefined>(props.buttonText)\nconst currentButtonIcon = ref<ButtonIconPreset | undefined>(props.buttonIcon)\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 if (updates.buttonText !== undefined)\n currentButtonText.value = updates.buttonText\n if (updates.buttonIcon !== undefined)\n currentButtonIcon.value = updates.buttonIcon\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 :button-text=\"currentButtonText\"\n :button-icon=\"currentButtonIcon\"\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 :button-text=\"currentButtonText\"\n :button-icon=\"currentButtonIcon\"\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","currentButtonText","currentButtonIcon","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":";;;;;;;;;;;;;;;;;;;;AASA,UAAMA,IAAQC,GAURC,IAASC,EAAI,EAAK,GAClBC,IAAgBD,EAAI,EAAK,GAGzBE,IAAcF,EAAsBH,EAAM,IAAI,GAC9CM,IAAiBH,EAAwBH,EAAM,OAAO,GACtDO,IAAsBJ,E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