@bitpalm/ai-agents 0.1.1 → 0.1.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.
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var BitPalmAgents=(()=>{var S=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var R=(o,i)=>{for(var c in i)S(o,c,{get:i[c],enumerable:!0})},U=(o,i,c,u)=>{if(i&&typeof i=="object"||typeof i=="function")for(let l of z(i))!O.call(o,l)&&l!==c&&S(o,l,{get:()=>i[l],enumerable:!(u=P(i,l))||u.enumerable});return o};var D=o=>U(S({},"__esModule",{value:!0}),o);var J={};R(J,{createWidget:()=>b});var N="https://agents.bitpalm.ae",r="_bp_";function j(){if(typeof document<"u"){let o=document.documentElement.lang;if(o)return o.slice(0,2).toLowerCase()}return"en"}function b(o){let{slug:i,locale:c=j(),baseUrl:u=N,zIndex:l=9999}=o,n=document,s=n.createElement("iframe"),E=`${u}/t/${i}/widget`;s.src=`${E}${E.includes("?")?"&":"?"}locale=${c}`,s.allow="clipboard-write",s.setAttribute("allowtransparency","true"),s.style.cssText=`position:fixed;bottom:0;right:0;width:0;height:0;border:none;z-index:${l};background:transparent;color-scheme:normal;transition:width .3s,height .3s;`,n.body.appendChild(s);let B=new URL(s.src).origin,e=n.createElement("div");if(e.setAttribute("role","button"),e.setAttribute("aria-label","Chat"),e.style.cssText=`position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;display:none;align-items:center;justify-content:center;cursor:pointer;z-index:${l-1};background:#00ff41;box-shadow:0 0 15px rgba(0,255,65,0.31);transition:transform .2s;`,e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7.9 20A9 9 0 1 0 4 16.1L2 22Z"/></svg>',e.onmouseenter=()=>{e.style.transform="scale(1.1)"},e.onmouseleave=()=>{e.style.transform="scale(1)"},e.onclick=()=>W(),n.body.appendChild(e),!n.getElementById("_bp_fade")){let t=n.createElement("style");t.id="_bp_fade",t.textContent="@keyframes _bp_fade{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}",n.head.appendChild(t)}let d=null,g=()=>{d&&(d.remove(),d=null)},I=t=>{if(t.origin===B){if(t.data?.type==="bitpalm-widget-config"){t.data.primaryColor&&(e.style.background=t.data.primaryColor,e.style.boxShadow=t.data.chatShadow==="none"?"none":`0 0 15px ${t.data.primaryColor}50`);let p=t.data.chatButtonIconColor||"black";if(t.data.chatButtonIconSvg){e.innerHTML="";let a=n.createElement("span");a.style.cssText=`display:flex;align-items:center;justify-content:center;width:24px;height:24px;color:${p}`,a.innerHTML=t.data.chatButtonIconSvg,e.appendChild(a)}else{let a=e.querySelector("svg");a&&(a.style.stroke=p)}e.style.display="flex"}if(t.data?.type==="bitpalm-widget-resize"&&(s.style.width=`${t.data.width}px`,s.style.height=`${t.data.height}px`,e.style.display=t.data.width>0?"none":"flex"),t.data?.type==="bitpalm-trigger-show"){g(),d=n.createElement("div"),d.style.cssText=`position:fixed;bottom:90px;right:24px;max-width:240px;background:#fff;border-radius:16px;padding:12px 32px 12px 12px;box-shadow:0 2px 20px rgba(0,0,0,0.08);cursor:pointer;z-index:${l-1};font-family:system-ui,sans-serif;animation:_bp_fade .3s;`;let p=(t.data.message||"").replace(/</g,"<");d.innerHTML=`<p style="font-size:14px;color:#1f2937;margin:0;">${p}</p><div style="position:absolute;bottom:-8px;right:20px;width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #fff;"></div>`;let a=n.createElement("button");a.style.cssText="position:absolute;top:-8px;right:-8px;width:28px;height:28px;border-radius:50%;background:#fff;border:none;box-shadow:0 1px 4px rgba(0,0,0,0.1);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:14px;color:#9ca3af;",a.innerHTML="✕",a.onclick=H=>{H.stopPropagation(),g(),s.contentWindow?.postMessage({type:"bitpalm-trigger-dismiss"},"*")},d.onclick=()=>{g(),e.style.display="none",s.contentWindow?.postMessage({type:"bitpalm-trigger-engaged"},"*")},d.appendChild(a),n.body.appendChild(d)}t.data?.type==="bitpalm-trigger-hide"&&g()}};window.addEventListener("message",I);let h=parseInt(sessionStorage.getItem(`${r}pages`)||"0")+1;sessionStorage.setItem(`${r}pages`,String(h));let m=JSON.parse(sessionStorage.getItem(`${r}hist`)||"[]");m.push(location.href),m.length>20&&(m=m.slice(-20)),sessionStorage.setItem(`${r}hist`,JSON.stringify(m));let L=Date.now(),f=parseInt(sessionStorage.getItem(`${r}site_start`)||"0");f||(f=L,sessionStorage.setItem(`${r}site_start`,String(f))),s.addEventListener("load",()=>{let t=!!localStorage.getItem(`${r}visited`);s.contentWindow?.postMessage({type:"bitpalm-parent-context",url:location.href,title:n.title,returning:t,pageCount:h,pageHistory:m,loadedAt:L,siteStart:f,locale:c},"*"),t||localStorage.setItem(`${r}visited`,"1")});let T=history.pushState.bind(history),M=history.replaceState.bind(history),y=()=>{h++,sessionStorage.setItem(`${r}pages`,String(h));let t=JSON.parse(sessionStorage.getItem(`${r}hist`)||"[]");t.push(location.href),t.length>20&&t.splice(0,t.length-20),sessionStorage.setItem(`${r}hist`,JSON.stringify(t)),s.contentWindow?.postMessage({type:"bitpalm-page-change",url:location.href,title:n.title,pageCount:h,pageHistory:t,loadedAt:Date.now()},"*")};history.pushState=function(...t){T(...t),y()},history.replaceState=function(...t){M(...t),y()},window.addEventListener("popstate",y);let $=-1,x,k=()=>{clearTimeout(x),x=setTimeout(()=>{let t=Math.max(n.documentElement.scrollHeight,n.body.scrollHeight)-window.innerHeight,p=t>0?Math.round(window.scrollY/t*100):100;p!==$&&($=p,s.contentWindow?.postMessage({type:"bitpalm-scroll-depth",percent:p},"*"))},500)};window.addEventListener("scroll",k,{passive:!0});let _=t=>{t.clientY<=0&&s.contentWindow?.postMessage({type:"bitpalm-exit-intent"},"*")};n.addEventListener("mouseout",_);let w,A=!1,v=()=>{clearTimeout(w),!A&&(w=setTimeout(()=>{A=!0,s.contentWindow?.postMessage({type:"bitpalm-inactivity"},"*")},15e3))},C=["mousemove","keydown","scroll","touchstart"];C.forEach(t=>n.addEventListener(t,v,{passive:!0})),v();let W=()=>{e.style.display="none",g(),s.contentWindow?.postMessage({type:"bitpalm-open"},"*")};return{open:W,close:()=>{s.contentWindow?.postMessage({type:"bitpalm-close"},"*")},destroy:()=>{window.removeEventListener("message",I),window.removeEventListener("scroll",k),window.removeEventListener("popstate",y),n.removeEventListener("mouseout",_),C.forEach(t=>n.removeEventListener(t,v)),clearTimeout(x),clearTimeout(w),history.pushState=T,history.replaceState=M,g(),e.remove(),s.remove()}}}if(typeof document<"u"){let o=document.currentScript;if(o?.dataset.slug){let i=()=>{b({slug:o.dataset.slug,locale:o.dataset.locale,baseUrl:o.dataset.baseUrl,zIndex:o.dataset.zIndex?Number(o.dataset.zIndex):void 0})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",i):i()}}return D(J);})();
|
|
2
|
+
//# sourceMappingURL=widget.global.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/widget.ts"],"sourcesContent":["export { createWidget } from \"./widget\";\nexport type { BitPalmAgentOptions, BitPalmAgentInstance } from \"./types\";\n\nimport { createWidget } from \"./widget\";\n\n/**\n * Auto-init from script tag:\n * <script src=\"https://cdn.bitpalm.ae/widget.js\" data-slug=\"my-agent\"></script>\n */\nif (typeof document !== \"undefined\") {\n const script = document.currentScript as HTMLScriptElement | null;\n if (script?.dataset.slug) {\n const init = () => {\n createWidget({\n slug: script!.dataset.slug!,\n locale: script!.dataset.locale,\n baseUrl: script!.dataset.baseUrl,\n zIndex: script!.dataset.zIndex ? Number(script!.dataset.zIndex) : undefined,\n });\n };\n\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", init);\n } else {\n init();\n }\n }\n}\n","import type { BitPalmAgentOptions, BitPalmAgentInstance } from \"./types\";\n\nconst DEFAULT_BASE_URL = \"https://agents.bitpalm.ae\";\nconst STORAGE_PREFIX = \"_bp_\";\n\nfunction detectLocale(): string {\n if (typeof document !== \"undefined\") {\n const lang = document.documentElement.lang;\n if (lang) return lang.slice(0, 2).toLowerCase();\n }\n return \"en\";\n}\n\nexport function createWidget(options: BitPalmAgentOptions): BitPalmAgentInstance {\n const {\n slug,\n locale = detectLocale(),\n baseUrl = DEFAULT_BASE_URL,\n zIndex = 9999,\n } = options;\n\n const d = document;\n\n // --- Iframe ---\n const iframe = d.createElement(\"iframe\");\n const widgetUrl = `${baseUrl}/t/${slug}/widget`;\n iframe.src = `${widgetUrl}${widgetUrl.includes(\"?\") ? \"&\" : \"?\"}locale=${locale}`;\n iframe.allow = \"clipboard-write\";\n iframe.setAttribute(\"allowtransparency\", \"true\");\n iframe.style.cssText = `position:fixed;bottom:0;right:0;width:0;height:0;border:none;z-index:${zIndex};background:transparent;color-scheme:normal;transition:width .3s,height .3s;`;\n d.body.appendChild(iframe);\n\n const origin = new URL(iframe.src).origin;\n\n // --- Native launcher button ---\n const btn = d.createElement(\"div\");\n btn.setAttribute(\"role\", \"button\");\n btn.setAttribute(\"aria-label\", \"Chat\");\n btn.style.cssText = `position:fixed;bottom:24px;right:24px;width:56px;height:56px;border-radius:50%;display:none;align-items:center;justify-content:center;cursor:pointer;z-index:${zIndex - 1};background:#00ff41;box-shadow:0 0 15px rgba(0,255,65,0.31);transition:transform .2s;`;\n btn.innerHTML = '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"black\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M7.9 20A9 9 0 1 0 4 16.1L2 22Z\"/></svg>';\n btn.onmouseenter = () => { btn.style.transform = \"scale(1.1)\"; };\n btn.onmouseleave = () => { btn.style.transform = \"scale(1)\"; };\n btn.onclick = () => openWidget();\n d.body.appendChild(btn);\n\n // --- Fade animation for trigger bubbles ---\n if (!d.getElementById(\"_bp_fade\")) {\n const s = d.createElement(\"style\");\n s.id = \"_bp_fade\";\n s.textContent = \"@keyframes _bp_fade{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}\";\n d.head.appendChild(s);\n }\n\n // --- Trigger bubble ---\n let bubble: HTMLDivElement | null = null;\n const removeBubble = () => {\n if (bubble) { bubble.remove(); bubble = null; }\n };\n\n // --- postMessage handler ---\n const handleMessage = (e: MessageEvent) => {\n if (e.origin !== origin) return;\n\n // Widget config (colors, icon)\n if (e.data?.type === \"bitpalm-widget-config\") {\n if (e.data.primaryColor) {\n btn.style.background = e.data.primaryColor;\n btn.style.boxShadow = e.data.chatShadow === \"none\" ? \"none\" : `0 0 15px ${e.data.primaryColor}50`;\n }\n const ic = e.data.chatButtonIconColor || \"black\";\n if (e.data.chatButtonIconSvg) {\n btn.innerHTML = \"\";\n const sp = d.createElement(\"span\");\n sp.style.cssText = `display:flex;align-items:center;justify-content:center;width:24px;height:24px;color:${ic}`;\n sp.innerHTML = e.data.chatButtonIconSvg;\n btn.appendChild(sp);\n } else {\n const sv = btn.querySelector(\"svg\");\n if (sv) (sv as SVGElement).style.stroke = ic;\n }\n btn.style.display = \"flex\";\n }\n\n // Resize\n if (e.data?.type === \"bitpalm-widget-resize\") {\n iframe.style.width = `${e.data.width}px`;\n iframe.style.height = `${e.data.height}px`;\n btn.style.display = e.data.width > 0 ? \"none\" : \"flex\";\n }\n\n // Trigger bubble show\n if (e.data?.type === \"bitpalm-trigger-show\") {\n removeBubble();\n bubble = d.createElement(\"div\");\n bubble.style.cssText = `position:fixed;bottom:90px;right:24px;max-width:240px;background:#fff;border-radius:16px;padding:12px 32px 12px 12px;box-shadow:0 2px 20px rgba(0,0,0,0.08);cursor:pointer;z-index:${zIndex - 1};font-family:system-ui,sans-serif;animation:_bp_fade .3s;`;\n const msg = (e.data.message || \"\").replace(/</g, \"<\");\n bubble.innerHTML = `<p style=\"font-size:14px;color:#1f2937;margin:0;\">${msg}</p><div style=\"position:absolute;bottom:-8px;right:20px;width:0;height:0;border-left:8px solid transparent;border-right:8px solid transparent;border-top:8px solid #fff;\"></div>`;\n const close = d.createElement(\"button\");\n close.style.cssText = \"position:absolute;top:-8px;right:-8px;width:28px;height:28px;border-radius:50%;background:#fff;border:none;box-shadow:0 1px 4px rgba(0,0,0,0.1);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:14px;color:#9ca3af;\";\n close.innerHTML = \"✕\";\n close.onclick = (ev) => { ev.stopPropagation(); removeBubble(); iframe.contentWindow?.postMessage({ type: \"bitpalm-trigger-dismiss\" }, \"*\"); };\n bubble.onclick = () => { removeBubble(); btn.style.display = \"none\"; iframe.contentWindow?.postMessage({ type: \"bitpalm-trigger-engaged\" }, \"*\"); };\n bubble.appendChild(close);\n d.body.appendChild(bubble);\n }\n\n // Trigger bubble hide\n if (e.data?.type === \"bitpalm-trigger-hide\") { removeBubble(); }\n };\n window.addEventListener(\"message\", handleMessage);\n\n // --- Visitor Intelligence: page counter + history ---\n let pageCount = parseInt(sessionStorage.getItem(`${STORAGE_PREFIX}pages`) || \"0\") + 1;\n sessionStorage.setItem(`${STORAGE_PREFIX}pages`, String(pageCount));\n\n let hist: string[] = JSON.parse(sessionStorage.getItem(`${STORAGE_PREFIX}hist`) || \"[]\");\n hist.push(location.href);\n if (hist.length > 20) hist = hist.slice(-20);\n sessionStorage.setItem(`${STORAGE_PREFIX}hist`, JSON.stringify(hist));\n\n const loadedAt = Date.now();\n let siteStart = parseInt(sessionStorage.getItem(`${STORAGE_PREFIX}site_start`) || \"0\");\n if (!siteStart) {\n siteStart = loadedAt;\n sessionStorage.setItem(`${STORAGE_PREFIX}site_start`, String(siteStart));\n }\n\n // --- Send parent context on iframe load ---\n iframe.addEventListener(\"load\", () => {\n const returning = !!localStorage.getItem(`${STORAGE_PREFIX}visited`);\n iframe.contentWindow?.postMessage({\n type: \"bitpalm-parent-context\",\n url: location.href,\n title: d.title,\n returning,\n pageCount,\n pageHistory: hist,\n loadedAt,\n siteStart,\n locale,\n }, \"*\");\n if (!returning) localStorage.setItem(`${STORAGE_PREFIX}visited`, \"1\");\n });\n\n // --- SPA navigation detection ---\n const origPush = history.pushState.bind(history);\n const origReplace = history.replaceState.bind(history);\n\n const onNav = () => {\n pageCount++;\n sessionStorage.setItem(`${STORAGE_PREFIX}pages`, String(pageCount));\n const h: string[] = JSON.parse(sessionStorage.getItem(`${STORAGE_PREFIX}hist`) || \"[]\");\n h.push(location.href);\n if (h.length > 20) h.splice(0, h.length - 20);\n sessionStorage.setItem(`${STORAGE_PREFIX}hist`, JSON.stringify(h));\n iframe.contentWindow?.postMessage({\n type: \"bitpalm-page-change\",\n url: location.href,\n title: d.title,\n pageCount,\n pageHistory: h,\n loadedAt: Date.now(),\n }, \"*\");\n };\n\n history.pushState = function (...args: Parameters<typeof history.pushState>) {\n origPush(...args);\n onNav();\n };\n history.replaceState = function (...args: Parameters<typeof history.replaceState>) {\n origReplace(...args);\n onNav();\n };\n window.addEventListener(\"popstate\", onNav);\n\n // --- Scroll depth tracking ---\n let lastScrollDepth = -1;\n let scrollTimeout: ReturnType<typeof setTimeout>;\n const handleScroll = () => {\n clearTimeout(scrollTimeout);\n scrollTimeout = setTimeout(() => {\n const total = Math.max(d.documentElement.scrollHeight, d.body.scrollHeight) - window.innerHeight;\n const pct = total > 0 ? Math.round(window.scrollY / total * 100) : 100;\n if (pct !== lastScrollDepth) {\n lastScrollDepth = pct;\n iframe.contentWindow?.postMessage({ type: \"bitpalm-scroll-depth\", percent: pct }, \"*\");\n }\n }, 500);\n };\n window.addEventListener(\"scroll\", handleScroll, { passive: true });\n\n // --- Exit intent ---\n const handleMouseOut = (e: MouseEvent) => {\n if (e.clientY <= 0) {\n iframe.contentWindow?.postMessage({ type: \"bitpalm-exit-intent\" }, \"*\");\n }\n };\n d.addEventListener(\"mouseout\", handleMouseOut);\n\n // --- Inactivity detection (15s) ---\n let idleTimer: ReturnType<typeof setTimeout>;\n let idleFired = false;\n const resetIdle = () => {\n clearTimeout(idleTimer);\n if (idleFired) return;\n idleTimer = setTimeout(() => {\n idleFired = true;\n iframe.contentWindow?.postMessage({ type: \"bitpalm-inactivity\" }, \"*\");\n }, 15_000);\n };\n const idleEvents = [\"mousemove\", \"keydown\", \"scroll\", \"touchstart\"] as const;\n idleEvents.forEach((ev) => d.addEventListener(ev, resetIdle, { passive: true }));\n resetIdle();\n\n // --- Public API ---\n const openWidget = () => {\n btn.style.display = \"none\";\n removeBubble();\n iframe.contentWindow?.postMessage({ type: \"bitpalm-open\" }, \"*\");\n };\n\n const closeWidget = () => {\n iframe.contentWindow?.postMessage({ type: \"bitpalm-close\" }, \"*\");\n };\n\n const destroy = () => {\n window.removeEventListener(\"message\", handleMessage);\n window.removeEventListener(\"scroll\", handleScroll);\n window.removeEventListener(\"popstate\", onNav);\n d.removeEventListener(\"mouseout\", handleMouseOut);\n idleEvents.forEach((ev) => d.removeEventListener(ev, resetIdle));\n clearTimeout(scrollTimeout);\n clearTimeout(idleTimer);\n history.pushState = origPush;\n history.replaceState = origReplace;\n removeBubble();\n btn.remove();\n iframe.remove();\n };\n\n return { open: openWidget, close: closeWidget, destroy };\n}\n"],"mappings":"icAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,ICEA,IAAMC,EAAmB,4BACnBC,EAAiB,OAEvB,SAASC,GAAuB,CAC9B,GAAI,OAAO,SAAa,IAAa,CACnC,IAAMC,EAAO,SAAS,gBAAgB,KACtC,GAAIA,EAAM,OAAOA,EAAK,MAAM,EAAG,CAAC,EAAE,YAAY,CAChD,CACA,MAAO,IACT,CAEO,SAASC,EAAaC,EAAoD,CAC/E,GAAM,CACJ,KAAAC,EACA,OAAAC,EAASL,EAAa,EACtB,QAAAM,EAAUR,EACV,OAAAS,EAAS,IACX,EAAIJ,EAEEK,EAAI,SAGJC,EAASD,EAAE,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AAiBgB,EAAImB,EAAW,CAAE,QAAS,EAAK,CAAC,CAAC,EAC/EA,EAAU,EAGV,IAAM9B,EAAa,IAAM,CACvBD,EAAI,MAAM,QAAU,OACpBI,EAAa,EACbP,EAAO,eAAe,YAAY,CAAE,KAAM,cAAe,EAAG,GAAG,CACjE,EAqBA,MAAO,CAAE,KAAMI,EAAY,MAnBP,IAAM,CACxBJ,EAAO,eAAe,YAAY,CAAE,KAAM,eAAgB,EAAG,GAAG,CAClE,EAiB+C,QAf/B,IAAM,CACpB,OAAO,oBAAoB,UAAWQ,CAAa,EACnD,OAAO,oBAAoB,SAAUoB,CAAY,EACjD,OAAO,oBAAoB,WAAYL,CAAK,EAC5CxB,EAAE,oBAAoB,WAAYgC,CAAc,EAChDI,EAAW,QAASpB,GAAOhB,EAAE,oBAAoBgB,EAAImB,CAAS,CAAC,EAC/D,aAAaP,CAAa,EAC1B,aAAaK,CAAS,EACtB,QAAQ,UAAYX,EACpB,QAAQ,aAAeC,EACvBf,EAAa,EACbJ,EAAI,OAAO,EACXH,EAAO,OAAO,CAChB,CAEuD,CACzD,CDxOA,GAAI,OAAO,SAAa,IAAa,CACnC,IAAMoC,EAAS,SAAS,cACxB,GAAIA,GAAQ,QAAQ,KAAM,CACxB,IAAMC,EAAO,IAAM,CACjBC,EAAa,CACX,KAAMF,EAAQ,QAAQ,KACtB,OAAQA,EAAQ,QAAQ,OACxB,QAASA,EAAQ,QAAQ,QACzB,OAAQA,EAAQ,QAAQ,OAAS,OAAOA,EAAQ,QAAQ,MAAM,EAAI,MACpE,CAAC,CACH,EAEI,SAAS,aAAe,UAC1B,SAAS,iBAAiB,mBAAoBC,CAAI,EAElDA,EAAK,CAET,CACF","names":["src_exports","__export","createWidget","DEFAULT_BASE_URL","STORAGE_PREFIX","detectLocale","lang","createWidget","options","slug","locale","baseUrl","zIndex","d","iframe","widgetUrl","origin","btn","openWidget","s","bubble","removeBubble","handleMessage","e","ic","sp","sv","msg","close","ev","pageCount","hist","loadedAt","siteStart","returning","origPush","origReplace","onNav","h","args","lastScrollDepth","scrollTimeout","handleScroll","total","pct","handleMouseOut","idleTimer","idleFired","resetIdle","idleEvents","script","init","createWidget"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitpalm/ai-agents",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Drop-in AI chat agent widget for any website. Includes visitor intelligence, SPA navigation tracking, trigger bubbles, and more.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "BitPalm <agents@bitpalm.ae>",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"main": "./dist/index.cjs",
|
|
11
11
|
"module": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
+
"unpkg": "./dist/widget.global.js",
|
|
13
14
|
"exports": {
|
|
14
15
|
".": {
|
|
15
16
|
"types": "./dist/index.d.ts",
|