@inploi/plugin-kin 4.0.0 → 4.0.2
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/cdn/frame/assets/{highlighted-body-B3W2YXNL-658ad560.js → highlighted-body-B3W2YXNL-de1bec96.js} +1 -1
- package/cdn/frame/assets/{index-fec8f8e3.js → index-50632c76.js} +65 -65
- package/cdn/frame/assets/mermaid-3ZIDBTTL-d0519783.js +1 -0
- package/cdn/frame/index.html +1 -1
- package/cdn/index.js +1 -1
- package/dist/kin.state.d.ts +12 -0
- package/package.json +3 -3
- package/cdn/frame/assets/mermaid-3ZIDBTTL-a634ad0a.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{N as e}from"./index-50632c76.js";export{e as Mermaid};
|
package/cdn/frame/index.html
CHANGED
package/cdn/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var O=e=>e,U="isdk_session",R=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),P=e=>{let i=new Date;return i.setTime(i.getTime()+6048e5),`${U}=${e};expires=${i.toUTCString()};path=/`},
|
|
1
|
+
(function(){"use strict";var O=e=>e,U="isdk_session",R=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4).toString(16)),P=e=>{let i=new Date;return i.setTime(i.getTime()+6048e5),`${U}=${e};expires=${i.toUTCString()};path=/`},q=(e,i)=>{let d=e.get("session_id");if(i||d)return d;let a=sessionStorage.getItem(`${U}-session_id`);return typeof a=="string"?a:null},N=new RegExp(`${U}=([^;]+)`),V=e=>{let i=e?e.url:location.href,{searchParams:d}=new URL(i),a=d.get("anonymous_id"),c=q(d,typeof window>"u");if(a)return{anonymous_id:a,session_id:c};let m=e?e.headers.get("cookie"):document.cookie;return m?{anonymous_id:N.exec(m)?.[1]??null,session_id:c}:{anonymous_id:a,session_id:c}},j=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=V().anonymous_id;if(e)return e;let i=R();return document.cookie=P(i),i};const B=e=>typeof e=="object"&&e!==null&&typeof e.type=="string"&&e.type.startsWith("kin:"),W="inploi-kin-root",z=2147483647,v={accentColor:"#FF4D00",neutralColor:"#555555",mode:"light",rounded:"lg"},Z={production:"wss://agents.inploi.com",sandbox:"wss://agents.staging.inploi.com"},G=(()=>{if({}.VITE_KIN_FRAME_URL)return{}.VITE_KIN_FRAME_URL;const e=typeof document<"u"?document.currentScript?.src:void 0;return e?new URL("./frame/index.html",e).href:"https://sdk.inploi.com/@inploi/plugin-kin/cdn/frame/index.html"})(),H=({serviceUrl:e,frameUrl:i,appearance:d={},starterPrompts:a=[],container:c})=>O(({logger:m,publishableKey:I,env:J})=>{const T=e??Z[J??"production"];if(!I)throw new Error("Kin plugin requires a publishableKey. Pass it to initialiseSdk().");const{accentColor:Q=v.accentColor,neutralColor:X=v.neutralColor,mode:Y=v.mode,rounded:ee=v.rounded,placement:y="center",launcher:$={},zIndex:te=z,logo:ne=null}=d,S=R(),n=y==="embedded",oe=typeof y=="object"?{desktop:y.desktop??"center",mobile:y.mobile??"center"}:{desktop:n?"center":y,mobile:n?"center":y},ie={desktop:$.desktop??"input",mobile:$.mobile??"icon"},re=String(te);let u={accentColor:Q,neutralColor:X,mode:Y,rounded:ee},g="",C="",E="",x="",r=null,o=null,h=null,s=!1,L=n,k=n,b=null,w={top:"calc(100% - 64px)",right:"0",bottom:"0",left:"0"};const p=t=>{C&&o?.contentWindow?.postMessage(t,C)},A=t=>{n||(t&&b===null?(b=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden"):!t&&b!==null&&(document.documentElement.style.overflow=b,b=null))},D=()=>`inset(${w.top} ${w.right} ${w.bottom} ${w.left})`,f=t=>{k=t,!(t&&!s)&&(A(t),r&&(r.style.clipPath=t?"inset(0)":D(),r.style.pointerEvents=t||s&&L?"all":"none"))},K=t=>{if(t.source!==o?.contentWindow||t.origin!==C||!B(t.data))return;const l=t.data;switch(l.type){case"kin:ready":s=!0,o&&(o.style.visibility="visible"),k&&!n?(f(!0),p({type:"kin:open"})):n||f(!1);break;case"kin:request-close":f(!1);break;case"kin:opened":n||f(!0);break;case"kin:clip-inset":if(L=!0,!k){const{top:ae,right:de,bottom:ce,left:ue}=l.payload;w={top:`${ae}px`,right:`${de}px`,bottom:`${ce}px`,left:`${ue}px`},f(!1)}break;case"kin:state-snapshot":h?.postMessage(l.payload);break;case"kin:error":m.error(l.payload.message);break}},se=t=>{const l=t.data;!x||!l||l.syncKey!==x||l.sourceInstanceId===S||!s||p({type:"kin:sync-snapshot",payload:l})},_=()=>{if(!o){if(!g){if(g=i||G||"",!g)throw new Error("Kin frame URL could not be resolved automatically. Pass `frameUrl` when using the npm build, or load the CDN bundle via a <script> tag.");C=new URL(g,window.location.href).origin}E||(E=j(),x=[I,T,E].join("|")),r=document.createElement("div"),r.id=W,n?(((typeof c=="string"?document.querySelector(c):c)??document.body).appendChild(r),r.style.cssText="position:relative;width:100%;height:100%"):(document.body.appendChild(r),r.style.cssText=`position:fixed;inset:0;z-index:${re};width:100vw;height:100dvh;pointer-events:none;clip-path:${D()}`),o=document.createElement("iframe"),o.src=g,o.title="Kin AI Chat",o.allow="clipboard-write",o.style.cssText="border:0;background:transparent;visibility:hidden;width:100%;height:100%",n&&(o.style.cssText+=";position:absolute;inset:0"),o.addEventListener("load",()=>p({type:"kin:init",payload:{instanceId:S,publishableKey:I,anonymousId:E,serviceUrl:T,theme:u,logo:ne,starterPrompts:a,placement:oe,embedded:n,launcher:ie}}),{once:!0}),window.addEventListener("message",K),r.appendChild(o),typeof BroadcastChannel<"u"&&(h=new BroadcastChannel("kin-sync"),h.addEventListener("message",se))}},le=()=>{window.removeEventListener("message",K),h?.close(),h=null,o?.remove(),o=null,r?.remove(),r=null,s=!1,L=n,k=n,w={top:"calc(100% - 64px)",right:"0",bottom:"0",left:"0"},A(!1)},F=()=>{_(),f(!0),s&&p({type:"kin:open"})},M=()=>{f(!1),s&&p({type:"kin:close"})};return{prepare:()=>{typeof window>"u"||(_(),m.info("Kin plugin prepared"))},open:()=>{if(!(typeof window>"u")){if(n){_();return}F()}},close:()=>{typeof window>"u"||n||M()},toggle:()=>{if(!(typeof window>"u")){if(n){_();return}k?M():F()}},setAppearance:(t={})=>{u={accentColor:t.accentColor??u.accentColor,neutralColor:t.neutralColor??u.neutralColor,mode:t.mode??u.mode,rounded:t.rounded??u.rounded},s&&p({type:"kin:set-appearance",payload:u})},destroy:()=>{typeof window>"u"||(s&&p({type:"kin:destroy"}),le(),m.info("Kin plugin destroyed"))}}});if(!window.inploi)throw new Error("Please insert the SDK script tag above the plugins.");window.inploi.kinPlugin=H})();
|
package/dist/kin.state.d.ts
CHANGED
|
@@ -11,6 +11,18 @@ export type Message = {
|
|
|
11
11
|
name: string;
|
|
12
12
|
};
|
|
13
13
|
blocks?: MessageBlock[];
|
|
14
|
+
/**
|
|
15
|
+
* True when this message was just committed from the live streaming
|
|
16
|
+
* response. The MessageBubble component uses this to skip its
|
|
17
|
+
* `animate-kin-message-in` entry animation — without this flag the
|
|
18
|
+
* user sees the streamed message disappear (LiveAssistantMessage
|
|
19
|
+
* unmounts) and then re-appear with a 240ms slide-up animation
|
|
20
|
+
* (MessageBubble mounts), which reads as a visible flash.
|
|
21
|
+
*
|
|
22
|
+
* Always undefined for messages added via `addMessage`, history
|
|
23
|
+
* load, or cross-tab sync — those should animate in normally.
|
|
24
|
+
*/
|
|
25
|
+
fromStream?: boolean;
|
|
14
26
|
};
|
|
15
27
|
type ConnectionState = 'idle' | 'connecting' | 'connected' | 'disconnected' | 'error';
|
|
16
28
|
type UploadState = 'idle' | 'uploading' | 'processing' | 'success' | 'error';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inploi/plugin-kin",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Kin - A unified Talent Agent interface for hiring. One system, many roles.",
|
|
6
6
|
"main": "dist/plugin-kin.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@inploi/sdk": ">=2.0.
|
|
23
|
+
"@inploi/sdk": ">=2.0.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@preact/preset-vite": "2.5.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"vite": "^4.4.5",
|
|
36
36
|
"vite-plugin-dts": "^3.7.0",
|
|
37
37
|
"vite-tsconfig-paths": "^4.2.1",
|
|
38
|
-
"@inploi/sdk": "2.0.
|
|
38
|
+
"@inploi/sdk": "2.0.2",
|
|
39
39
|
"tsconfig": "0.1.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{N as e}from"./index-fec8f8e3.js";export{e as Mermaid};
|