@convocraft/launcher 0.1.7 → 0.1.9
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/bubble.js +1 -1
- package/dist/init.js +1 -1
- package/dist/popup.js +1 -1
- package/package.json +7 -6
- package/dist/utils-nsEt2YOh.js +0 -1
package/dist/bubble.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{chatbotTriggerStyle as e,injectCss as t}from"@convocraft/ui/styles";const n=t=>{let n=document.createElement(`iframe`);n.src=`${t.clientBaseUrl}/${t.workflowId}`,n.id=e.iframe.className,n.className=e.iframe.className,n.onload=()=>t.onLoad(n);let r=document.createElement(`div`);return r.id=e.iframeContainer.className,r.className=e.iframeContainer.className,r.append(n),r},r=t=>{let n=document.createElement(`div`);n.id=e.positionContainer.className,n.className=e.positionContainer.className,n.style.display=`none`;let r=document.createElement(`div`);if(r.id=e.container.className,r.className=e.container.className,t.label){let n=document.createElement(`div`);n.id=e.textContainer.className,n.className=e.textContainer.className;let i=document.createElement(`p`);i.id=e.text.className,i.className=e.text.className,i.innerText=t.label,n.append(i),r.append(n)}let i=document.createElement(`button`);if(i.type=`button`,i.id=e.button.className,i.className=e.button.className,i.addEventListener(`click`,t.onTrigger),t.imageUrl){let n=document.createElement(`img`);n.id=e.buttonImage.className,n.className=e.buttonImage.className,n.src=t.imageUrl,i.append(n)}else{let t=document.createElement(`span`);t.id=e.buttonImage.className,t.innerText=`🤖`,i.append(t)}return r.append(i),n.append(r),n},i=e=>{e.style.display===`none`?e.style.display=`block`:e.style.display=`none`},a=async e=>{let t=await fetch(`${e.apiBaseUrl}/${e.workflowId}/chatbot-settings`);if(!t.ok)return null;let{settings:n}=await t.json();return{triggerCss:n.widgetTriggerCss}},o=()=>{let e=window.ConvoCraft;return e?e.apiBaseUrl?e.clientBaseUrl?e.workflowId?e.type?e:(console.error(`ConvoCraft: type is required`),null):(console.error(`ConvoCraft: workflowId is required`),null):(console.error(`ConvoCraft: clientBaseUrl is required`),null):(console.error(`ConvoCraft: apiBaseUrl is required`),null):(console.error(`ConvoCraft: Invalid params`),null)};async function s(){let e=o();if(!e)return;let s=await a(e);if(!s||!s.triggerCss)return;t({css:s.triggerCss,id:`___CC_WIDGET_TRIGGER___`});let c=n({...e,onLoad:()=>{setTimeout(()=>{i(l),i(c)},1e3)}}),l=r({label:s.label,imageUrl:s.imageUrl,onTrigger:()=>i(c)});document.body.appendChild(l),document.body.appendChild(c)}await s();
|
package/dist/init.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=e=>{let t=`https://cdn.jsdelivr.net/npm/@convocraft/launcher@0/dist/${e.type}.js`;window.ConvoCraft={type:e.type,id:e.
|
|
1
|
+
const e=e=>{let t=`https://cdn.jsdelivr.net/npm/@convocraft/launcher@0/dist/${e.type}.js`;window.ConvoCraft={type:e.type,workflowId:e.id,apiBaseUrl:e.apiBaseUrl,clientBaseUrl:e.clientBaseUrl};let n=document.querySelector(`script[src="${t}"]`);n&&n.remove();let r=document.getElementsByTagName(`body`)[0],i=document.createElement(`script`);return i.type=`module`,i.async=!0,i.src=t,r.appendChild(i),!0};window.addEventListener(`DOMContentLoaded`,()=>{e({type:`___TYPE___`,id:`___ID___`,apiBaseUrl:`___API_BASE_URL___`,clientBaseUrl:`___CLIENT_BASE_URL___`})});
|
package/dist/popup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const e=e=>new Promise(t=>setTimeout(t,e));async function t(){console.log(`Popup init running`),await e(1e3),console.log(`ConvoCraft: `,window.ConvoCraft)}await t();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@convocraft/launcher",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": "./dist/index.js",
|
|
13
|
+
"./package.json": "./package.json",
|
|
13
14
|
"./popup": "./dist/popup.js",
|
|
14
|
-
"./bubble": "./dist/bubble.js"
|
|
15
|
-
"./package.json": "./package.json"
|
|
15
|
+
"./bubble": "./dist/bubble.js"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@types/node": "^24.10.0",
|
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@convocraft/ui": "0.0.1"
|
|
26
|
+
},
|
|
24
27
|
"scripts": {
|
|
25
28
|
"build": "tsdown",
|
|
26
29
|
"release": "pnpm publish",
|
|
27
|
-
"_dev": "tsdown --watch"
|
|
28
|
-
"popup": "node ./dist/popup.js",
|
|
29
|
-
"bubble": "node ./dist/bubble.js"
|
|
30
|
+
"_dev": "tsdown --watch"
|
|
30
31
|
}
|
|
31
32
|
}
|
package/dist/utils-nsEt2YOh.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=e=>new Promise(t=>setTimeout(t,e));export{e as t};
|