@inploi/plugin-kin 3.1.0 → 3.1.1

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.
@@ -0,0 +1 @@
1
+ import{N as e}from"./index-1b157bea.js";export{e as Mermaid};
@@ -24,7 +24,7 @@
24
24
  height: 100%;
25
25
  }
26
26
  </style>
27
- <script type="module" crossorigin src="./assets/index-94d05bc4.js"></script>
27
+ <script type="module" crossorigin src="./assets/index-1b157bea.js"></script>
28
28
  </head>
29
29
  <body>
30
30
  <div id="kin-root"></div>
package/cdn/index.js CHANGED
@@ -1 +1 @@
1
- (function(){"use strict";var O=e=>e,U="isdk_session",x=()=>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=/`},j=(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},V=new RegExp(`${U}=([^;]+)`),W=e=>{let i=e?e.url:location.href,{searchParams:d}=new URL(i),a=d.get("anonymous_id"),c=j(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:V.exec(m)?.[1]??null,session_id:c}:{anonymous_id:a,session_id:c}},q=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=W().anonymous_id;if(e)return e;let i=x();return document.cookie=P(i),i};const N=e=>typeof e=="object"&&e!==null&&typeof e.type=="string"&&e.type.startsWith("kin:"),z="inploi-kin-root",B=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:null})(),H=({serviceUrl:e,frameUrl:i,appearance:d={},starterPrompts:a=[],container:c})=>O(({logger:m,publishableKey:I,env:Y})=>{const T=e??Z[Y??"production"];if(!I)throw new Error("Kin plugin requires a publishableKey. Pass it to initialiseSdk().");const{accentColor:J=v.accentColor,neutralColor:Q=v.neutralColor,mode:X=v.mode,rounded:ee=v.rounded,placement:y="center",launcher:$={},zIndex:te=B,logo:ne=null}=d,S=x(),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:J,neutralColor:Q,mode:X,rounded:ee},g="",C="",E="",L="",r=null,o=null,h=null,s=!1,R=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&&R?"all":"none"))},K=t=>{if(t.source!==o?.contentWindow||t.origin!==C||!N(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(R=!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;!L||!l||l.syncKey!==L||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=q(),L=[I,T,E].join("|")),r=document.createElement("div"),r.id=z,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,R=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})();
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=/`},j=(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},V=new RegExp(`${U}=([^;]+)`),W=e=>{let i=e?e.url:location.href,{searchParams:d}=new URL(i),a=d.get("anonymous_id"),c=j(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:V.exec(m)?.[1]??null,session_id:c}:{anonymous_id:a,session_id:c}},q=()=>{if(typeof window>"u")throw new Error("getOrCreateAnonymousId() can only be called in browser environment");let e=W().anonymous_id;if(e)return e;let i=R();return document.cookie=P(i),i};const N=e=>typeof e=="object"&&e!==null&&typeof e.type=="string"&&e.type.startsWith("kin:"),z="inploi-kin-root",B=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:Y})=>{const T=e??Z[Y??"production"];if(!I)throw new Error("Kin plugin requires a publishableKey. Pass it to initialiseSdk().");const{accentColor:J=v.accentColor,neutralColor:Q=v.neutralColor,mode:X=v.mode,rounded:ee=v.rounded,placement:y="center",launcher:$={},zIndex:te=B,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:J,neutralColor:Q,mode:X,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||!N(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=q(),x=[I,T,E].join("|")),r=document.createElement("div"),r.id=z,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})();
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("@inploi/sdk"),Y=r=>typeof r=="object"&&r!==null&&typeof r.type=="string"&&r.type.startsWith("kin:"),ee="inploi-kin-root",te=2147483647,k={accentColor:"#FF4D00",neutralColor:"#555555",mode:"light",rounded:"lg"},ne={production:"wss://agents.inploi.com",sandbox:"wss://agents.staging.inploi.com"},oe=(()=>{var g;if({}.VITE_KIN_FRAME_URL)return{}.VITE_KIN_FRAME_URL;const r=typeof document<"u"?(g=document.currentScript)==null?void 0:g.src:void 0;return r?new URL("./frame/index.html",r).href:null})(),ie=({serviceUrl:r,frameUrl:g,appearance:F={},starterPrompts:K=[],container:v})=>L.createPlugin(({logger:C,publishableKey:E,env:O})=>{const T=r??ne[O??"production"];if(!E)throw new Error("Kin plugin requires a publishableKey. Pass it to initialiseSdk().");const{accentColor:P=k.accentColor,neutralColor:D=k.neutralColor,mode:j=k.mode,rounded:q=k.rounded,placement:u="center",launcher:x={},zIndex:N=te,logo:V=null}=F,R=L.generateUUID(),n=u==="embedded",W=typeof u=="object"?{desktop:u.desktop??"center",mobile:u.mobile??"center"}:{desktop:n?"center":u,mobile:n?"center":u},z={desktop:x.desktop??"input",mobile:x.mobile??"icon"},B=String(N);let d={accentColor:P,neutralColor:D,mode:j,rounded:q},f="",w="",h="",U="",o=null,t=null,s=null,l=!1,I=n,m=n,y=null,p={top:"calc(100% - 64px)",right:"0",bottom:"0",left:"0"};const a=e=>{var i;w&&((i=t==null?void 0:t.contentWindow)==null||i.postMessage(e,w))},S=e=>{n||(e&&y===null?(y=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden"):!e&&y!==null&&(document.documentElement.style.overflow=y,y=null))},_=()=>`inset(${p.top} ${p.right} ${p.bottom} ${p.left})`,c=e=>{m=e,!(e&&!l)&&(S(e),o&&(o.style.clipPath=e?"inset(0)":_(),o.style.pointerEvents=e||l&&I?"all":"none"))},M=e=>{if(e.source!==(t==null?void 0:t.contentWindow)||e.origin!==w||!Y(e.data))return;const i=e.data;switch(i.type){case"kin:ready":l=!0,t&&(t.style.visibility="visible"),m&&!n?(c(!0),a({type:"kin:open"})):n||c(!1);break;case"kin:request-close":c(!1);break;case"kin:opened":n||c(!0);break;case"kin:clip-inset":if(I=!0,!m){const{top:G,right:J,bottom:Q,left:X}=i.payload;p={top:`${G}px`,right:`${J}px`,bottom:`${Q}px`,left:`${X}px`},c(!1)}break;case"kin:state-snapshot":s==null||s.postMessage(i.payload);break;case"kin:error":C.error(i.payload.message);break}},Z=e=>{const i=e.data;!U||!i||i.syncKey!==U||i.sourceInstanceId===R||!l||a({type:"kin:sync-snapshot",payload:i})},b=()=>{if(!t){if(!f){if(f=g||oe||"",!f)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.");w=new URL(f,window.location.href).origin}h||(h=L.getOrCreateAnonymousId(),U=[E,T,h].join("|")),o=document.createElement("div"),o.id=ee,n?(((typeof v=="string"?document.querySelector(v):v)??document.body).appendChild(o),o.style.cssText="position:relative;width:100%;height:100%"):(document.body.appendChild(o),o.style.cssText=`position:fixed;inset:0;z-index:${B};width:100vw;height:100dvh;pointer-events:none;clip-path:${_()}`),t=document.createElement("iframe"),t.src=f,t.title="Kin AI Chat",t.allow="clipboard-write",t.style.cssText="border:0;background:transparent;visibility:hidden;width:100%;height:100%",n&&(t.style.cssText+=";position:absolute;inset:0"),t.addEventListener("load",()=>a({type:"kin:init",payload:{instanceId:R,publishableKey:E,anonymousId:h,serviceUrl:T,theme:d,logo:V,starterPrompts:K,placement:W,embedded:n,launcher:z}}),{once:!0}),window.addEventListener("message",M),o.appendChild(t),typeof BroadcastChannel<"u"&&(s=new BroadcastChannel("kin-sync"),s.addEventListener("message",Z))}},H=()=>{window.removeEventListener("message",M),s==null||s.close(),s=null,t==null||t.remove(),t=null,o==null||o.remove(),o=null,l=!1,I=n,m=n,p={top:"calc(100% - 64px)",right:"0",bottom:"0",left:"0"},S(!1)},$=()=>{b(),c(!0),l&&a({type:"kin:open"})},A=()=>{c(!1),l&&a({type:"kin:close"})};return{prepare:()=>{typeof window>"u"||(b(),C.info("Kin plugin prepared"))},open:()=>{if(!(typeof window>"u")){if(n){b();return}$()}},close:()=>{typeof window>"u"||n||A()},toggle:()=>{if(!(typeof window>"u")){if(n){b();return}m?A():$()}},setAppearance:(e={})=>{d={accentColor:e.accentColor??d.accentColor,neutralColor:e.neutralColor??d.neutralColor,mode:e.mode??d.mode,rounded:e.rounded??d.rounded},l&&a({type:"kin:set-appearance",payload:d})},destroy:()=>{typeof window>"u"||(l&&a({type:"kin:destroy"}),H(),C.info("Kin plugin destroyed"))}}});exports.kinPlugin=ie;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("@inploi/sdk"),Y=r=>typeof r=="object"&&r!==null&&typeof r.type=="string"&&r.type.startsWith("kin:"),ee="inploi-kin-root",te=2147483647,b={accentColor:"#FF4D00",neutralColor:"#555555",mode:"light",rounded:"lg"},ne={production:"wss://agents.inploi.com",sandbox:"wss://agents.staging.inploi.com"},oe=(()=>{var g;if({}.VITE_KIN_FRAME_URL)return{}.VITE_KIN_FRAME_URL;const r=typeof document<"u"?(g=document.currentScript)==null?void 0:g.src:void 0;return r?new URL("./frame/index.html",r).href:"https://sdk.inploi.com/@inploi/plugin-kin/cdn/frame/index.html"})(),ie=({serviceUrl:r,frameUrl:g,appearance:F={},starterPrompts:K=[],container:v})=>L.createPlugin(({logger:C,publishableKey:E,env:O})=>{const x=r??ne[O??"production"];if(!E)throw new Error("Kin plugin requires a publishableKey. Pass it to initialiseSdk().");const{accentColor:P=b.accentColor,neutralColor:D=b.neutralColor,mode:j=b.mode,rounded:q=b.rounded,placement:u="center",launcher:T={},zIndex:N=te,logo:V=null}=F,R=L.generateUUID(),n=u==="embedded",W=typeof u=="object"?{desktop:u.desktop??"center",mobile:u.mobile??"center"}:{desktop:n?"center":u,mobile:n?"center":u},z={desktop:T.desktop??"input",mobile:T.mobile??"icon"},B=String(N);let d={accentColor:P,neutralColor:D,mode:j,rounded:q},f="",h="",w="",U="",o=null,t=null,s=null,l=!1,I=n,m=n,y=null,p={top:"calc(100% - 64px)",right:"0",bottom:"0",left:"0"};const a=e=>{var i;h&&((i=t==null?void 0:t.contentWindow)==null||i.postMessage(e,h))},S=e=>{n||(e&&y===null?(y=document.documentElement.style.overflow,document.documentElement.style.overflow="hidden"):!e&&y!==null&&(document.documentElement.style.overflow=y,y=null))},_=()=>`inset(${p.top} ${p.right} ${p.bottom} ${p.left})`,c=e=>{m=e,!(e&&!l)&&(S(e),o&&(o.style.clipPath=e?"inset(0)":_(),o.style.pointerEvents=e||l&&I?"all":"none"))},M=e=>{if(e.source!==(t==null?void 0:t.contentWindow)||e.origin!==h||!Y(e.data))return;const i=e.data;switch(i.type){case"kin:ready":l=!0,t&&(t.style.visibility="visible"),m&&!n?(c(!0),a({type:"kin:open"})):n||c(!1);break;case"kin:request-close":c(!1);break;case"kin:opened":n||c(!0);break;case"kin:clip-inset":if(I=!0,!m){const{top:G,right:J,bottom:Q,left:X}=i.payload;p={top:`${G}px`,right:`${J}px`,bottom:`${Q}px`,left:`${X}px`},c(!1)}break;case"kin:state-snapshot":s==null||s.postMessage(i.payload);break;case"kin:error":C.error(i.payload.message);break}},Z=e=>{const i=e.data;!U||!i||i.syncKey!==U||i.sourceInstanceId===R||!l||a({type:"kin:sync-snapshot",payload:i})},k=()=>{if(!t){if(!f){if(f=g||oe||"",!f)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.");h=new URL(f,window.location.href).origin}w||(w=L.getOrCreateAnonymousId(),U=[E,x,w].join("|")),o=document.createElement("div"),o.id=ee,n?(((typeof v=="string"?document.querySelector(v):v)??document.body).appendChild(o),o.style.cssText="position:relative;width:100%;height:100%"):(document.body.appendChild(o),o.style.cssText=`position:fixed;inset:0;z-index:${B};width:100vw;height:100dvh;pointer-events:none;clip-path:${_()}`),t=document.createElement("iframe"),t.src=f,t.title="Kin AI Chat",t.allow="clipboard-write",t.style.cssText="border:0;background:transparent;visibility:hidden;width:100%;height:100%",n&&(t.style.cssText+=";position:absolute;inset:0"),t.addEventListener("load",()=>a({type:"kin:init",payload:{instanceId:R,publishableKey:E,anonymousId:w,serviceUrl:x,theme:d,logo:V,starterPrompts:K,placement:W,embedded:n,launcher:z}}),{once:!0}),window.addEventListener("message",M),o.appendChild(t),typeof BroadcastChannel<"u"&&(s=new BroadcastChannel("kin-sync"),s.addEventListener("message",Z))}},H=()=>{window.removeEventListener("message",M),s==null||s.close(),s=null,t==null||t.remove(),t=null,o==null||o.remove(),o=null,l=!1,I=n,m=n,p={top:"calc(100% - 64px)",right:"0",bottom:"0",left:"0"},S(!1)},$=()=>{k(),c(!0),l&&a({type:"kin:open"})},A=()=>{c(!1),l&&a({type:"kin:close"})};return{prepare:()=>{typeof window>"u"||(k(),C.info("Kin plugin prepared"))},open:()=>{if(!(typeof window>"u")){if(n){k();return}$()}},close:()=>{typeof window>"u"||n||A()},toggle:()=>{if(!(typeof window>"u")){if(n){k();return}m?A():$()}},setAppearance:(e={})=>{d={accentColor:e.accentColor??d.accentColor,neutralColor:e.neutralColor??d.neutralColor,mode:e.mode??d.mode,rounded:e.rounded??d.rounded},l&&a({type:"kin:set-appearance",payload:d})},destroy:()=>{typeof window>"u"||(l&&a({type:"kin:destroy"}),H(),C.info("Kin plugin destroyed"))}}});exports.kinPlugin=ie;
@@ -1,5 +1,5 @@
1
1
  import { createPlugin as X, generateUUID as Y, getOrCreateAnonymousId as ee } from "@inploi/sdk";
2
- const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string" && r.type.startsWith("kin:"), ne = "inploi-kin-root", oe = 2147483647, k = {
2
+ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string" && r.type.startsWith("kin:"), ne = "inploi-kin-root", oe = 2147483647, b = {
3
3
  accentColor: "#FF4D00",
4
4
  neutralColor: "#555555",
5
5
  mode: "light",
@@ -12,7 +12,7 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
12
12
  if ({}.VITE_KIN_FRAME_URL)
13
13
  return {}.VITE_KIN_FRAME_URL;
14
14
  const r = typeof document < "u" ? (g = document.currentScript) == null ? void 0 : g.src : void 0;
15
- return r ? new URL("./frame/index.html", r).href : null;
15
+ return r ? new URL("./frame/index.html", r).href : "https://sdk.inploi.com/@inploi/plugin-kin/cdn/frame/index.html";
16
16
  })(), le = ({
17
17
  serviceUrl: r,
18
18
  frameUrl: g,
@@ -28,10 +28,10 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
28
28
  if (!E)
29
29
  throw new Error("Kin plugin requires a publishableKey. Pass it to initialiseSdk().");
30
30
  const {
31
- accentColor: O = k.accentColor,
32
- neutralColor: D = k.neutralColor,
33
- mode: P = k.mode,
34
- rounded: j = k.rounded,
31
+ accentColor: O = b.accentColor,
32
+ neutralColor: D = b.neutralColor,
33
+ mode: P = b.mode,
34
+ rounded: j = b.rounded,
35
35
  placement: p = "center",
36
36
  launcher: x = {},
37
37
  zIndex: q = oe,
@@ -51,7 +51,7 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
51
51
  neutralColor: D,
52
52
  mode: P,
53
53
  rounded: j
54
- }, f = "", w = "", h = "", U = "", o = null, t = null, s = null, l = !1, I = n, m = n, y = null, u = {
54
+ }, f = "", h = "", w = "", U = "", o = null, t = null, s = null, l = !1, I = n, m = n, y = null, u = {
55
55
  top: "calc(100% - 64px)",
56
56
  right: "0",
57
57
  bottom: "0",
@@ -59,13 +59,13 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
59
59
  };
60
60
  const a = (e) => {
61
61
  var i;
62
- w && ((i = t == null ? void 0 : t.contentWindow) == null || i.postMessage(e, w));
62
+ h && ((i = t == null ? void 0 : t.contentWindow) == null || i.postMessage(e, h));
63
63
  }, T = (e) => {
64
64
  n || (e && y === null ? (y = document.documentElement.style.overflow, document.documentElement.style.overflow = "hidden") : !e && y !== null && (document.documentElement.style.overflow = y, y = null));
65
65
  }, _ = () => `inset(${u.top} ${u.right} ${u.bottom} ${u.left})`, c = (e) => {
66
66
  m = e, !(e && !l) && (T(e), o && (o.style.clipPath = e ? "inset(0)" : _(), o.style.pointerEvents = e || l && I ? "all" : "none"));
67
67
  }, S = (e) => {
68
- if (e.source !== (t == null ? void 0 : t.contentWindow) || e.origin !== w || !te(e.data))
68
+ if (e.source !== (t == null ? void 0 : t.contentWindow) || e.origin !== h || !te(e.data))
69
69
  return;
70
70
  const i = e.data;
71
71
  switch (i.type) {
@@ -109,19 +109,19 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
109
109
  type: "kin:sync-snapshot",
110
110
  payload: i
111
111
  });
112
- }, b = () => {
112
+ }, k = () => {
113
113
  if (!t) {
114
114
  if (!f) {
115
115
  if (f = g || re || "", !f)
116
116
  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.");
117
- w = new URL(f, window.location.href).origin;
117
+ h = new URL(f, window.location.href).origin;
118
118
  }
119
- h || (h = ee(), U = [E, L, h].join("|")), o = document.createElement("div"), o.id = ne, n ? (((typeof v == "string" ? document.querySelector(v) : v) ?? document.body).appendChild(o), o.style.cssText = "position:relative;width:100%;height:100%") : (document.body.appendChild(o), o.style.cssText = `position:fixed;inset:0;z-index:${z};width:100vw;height:100dvh;pointer-events:none;clip-path:${_()}`), t = document.createElement("iframe"), t.src = f, t.title = "Kin AI Chat", t.allow = "clipboard-write", t.style.cssText = "border:0;background:transparent;visibility:hidden;width:100%;height:100%", n && (t.style.cssText += ";position:absolute;inset:0"), t.addEventListener("load", () => a({
119
+ w || (w = ee(), U = [E, L, w].join("|")), o = document.createElement("div"), o.id = ne, n ? (((typeof v == "string" ? document.querySelector(v) : v) ?? document.body).appendChild(o), o.style.cssText = "position:relative;width:100%;height:100%") : (document.body.appendChild(o), o.style.cssText = `position:fixed;inset:0;z-index:${z};width:100vw;height:100dvh;pointer-events:none;clip-path:${_()}`), t = document.createElement("iframe"), t.src = f, t.title = "Kin AI Chat", t.allow = "clipboard-write", t.style.cssText = "border:0;background:transparent;visibility:hidden;width:100%;height:100%", n && (t.style.cssText += ";position:absolute;inset:0"), t.addEventListener("load", () => a({
120
120
  type: "kin:init",
121
121
  payload: {
122
122
  instanceId: R,
123
123
  publishableKey: E,
124
- anonymousId: h,
124
+ anonymousId: w,
125
125
  serviceUrl: L,
126
126
  theme: d,
127
127
  logo: N,
@@ -142,7 +142,7 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
142
142
  left: "0"
143
143
  }, T(!1);
144
144
  }, $ = () => {
145
- b(), c(!0), l && a({
145
+ k(), c(!0), l && a({
146
146
  type: "kin:open"
147
147
  });
148
148
  }, A = () => {
@@ -152,12 +152,12 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
152
152
  };
153
153
  return {
154
154
  prepare: () => {
155
- typeof window > "u" || (b(), C.info("Kin plugin prepared"));
155
+ typeof window > "u" || (k(), C.info("Kin plugin prepared"));
156
156
  },
157
157
  open: () => {
158
158
  if (!(typeof window > "u")) {
159
159
  if (n) {
160
- b();
160
+ k();
161
161
  return;
162
162
  }
163
163
  $();
@@ -169,7 +169,7 @@ const te = (r) => typeof r == "object" && r !== null && typeof r.type == "string
169
169
  toggle: () => {
170
170
  if (!(typeof window > "u")) {
171
171
  if (n) {
172
- b();
172
+ k();
173
173
  return;
174
174
  }
175
175
  m ? A() : $();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-kin",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
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",
@@ -35,8 +35,8 @@
35
35
  "vite": "^4.4.5",
36
36
  "vite-plugin-dts": "^3.7.0",
37
37
  "vite-tsconfig-paths": "^4.2.1",
38
- "tsconfig": "0.1.0",
39
- "@inploi/sdk": "1.18.0"
38
+ "@inploi/sdk": "1.18.0",
39
+ "tsconfig": "0.1.0"
40
40
  },
41
41
  "dependencies": {
42
42
  "streamdown": "^2.3.0",
@@ -1 +0,0 @@
1
- import{N as e}from"./index-94d05bc4.js";export{e as Mermaid};