@inploi/plugin-kin 3.1.1 → 4.0.0

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-fec8f8e3.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-1b157bea.js"></script>
27
+ <script type="module" crossorigin src="./assets/index-fec8f8e3.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",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
+ (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=/`},N=(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}=([^;]+)`),j=e=>{let i=e?e.url:location.href,{searchParams:d}=new URL(i),a=d.get("anonymous_id"),c=N(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=j().anonymous_id;if(e)return e;let i=R();return document.cookie=P(i),i};const W=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"},H={production:"wss://agents.inploi.com",sandbox:"wss://agents.staging.inploi.com"},Z=(()=>{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"})(),Q=({serviceUrl:e,frameUrl:i,appearance:d={},starterPrompts:a=[],container:c})=>O(({logger:m,publishableKey:I,env:G})=>{const T=e??H[G??"production"];if(!I)throw new Error("Kin plugin requires a publishableKey. Pass it to initialiseSdk().");const{accentColor:J=v.accentColor,neutralColor:X=v.neutralColor,mode:Y=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: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||!W(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||Z||"",!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=Q})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inploi/plugin-kin",
3
- "version": "3.1.1",
3
+ "version": "4.0.0",
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": ">=1.18.0"
23
+ "@inploi/sdk": ">=2.0.0"
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": "1.18.0",
38
+ "@inploi/sdk": "2.0.0",
39
39
  "tsconfig": "0.1.0"
40
40
  },
41
41
  "dependencies": {
@@ -1 +0,0 @@
1
- import{N as e}from"./index-1b157bea.js";export{e as Mermaid};