@convocraft/launcher 0.1.12 → 0.1.20

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 CHANGED
@@ -1 +1 @@
1
- const e=`__ccChatbotTriggerIframeContainer`,t=`__ccChatbotTriggerIframe`,n=`__ccChatbotTriggerPositionContainer`,r=`__ccChatbotTriggerContainer`,i=`__ccChatbotTriggerButton`,a=`__ccChatbotTriggerButtonImage`,o=`__ccChatbotTriggerButtonDefaultIcon`,s=`__ccChatbotTriggerTextContainer`,c=`__ccChatbotTriggerText`,l=e=>{let t=document.getElementById(e.id);t&&t.remove();let n=document.createElement(`style`);n.id=e.id,n.textContent=e.css,e.onLoad&&(n.onload=e.onLoad),document.head.appendChild(n)},u=n=>{let r=document.createElement(`iframe`);r.src=`${n.clientBaseUrl}/${n.workflowId}`,r.id=t,r.className=t,r.onload=()=>n.onLoad(r);let i=document.createElement(`div`);return i.id=e,i.className=e,i.append(r),i},d=e=>{let t=document.createElement(`div`);t.id=n,t.className=n,t.style.display=`none`;let l=document.createElement(`div`);if(l.id=r,l.className=r,e.label){let t=document.createElement(`div`);t.id=s,t.className=s;let n=document.createElement(`p`);n.id=c,n.className=c,n.innerText=e.label,t.append(n),l.append(t)}let u=document.createElement(`button`);if(u.type=`button`,u.id=i,u.className=i,u.addEventListener(`click`,e.onTrigger),e.imageUrl){let t=document.createElement(`img`);t.id=a,t.className=a,t.src=e.imageUrl,u.append(t)}else{let e=document.createElement(`span`);e.id=o,e.innerHTML=`<svg class="${o}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>`,e.style.fontSize=`24px`,u.append(e)}return l.append(u),t.append(l),t},f=(e,t)=>{if(t===`hidden`){e.style.display=`none`;return}if(t===`visible`){e.style.display=`block`;return}e.style.display===`block`?e.style.display=`none`:e.style.display=`block`},p=async e=>{let t=await fetch(`${e.apiBaseUrl}/${e.workflowId}/chatbot-settings`);if(!t.ok)return null;let{widgetTriggerCss:n,widgetOpen:r}=await t.json();return{widgetTriggerCss:n,widgetOpen:r}},m=()=>{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 h(){let e=m();if(!e)return;let t=await p(e);if(!t||!t.widgetTriggerCss)return;l({css:t.widgetTriggerCss,id:`___CC_WIDGET_TRIGGER___`});let n=u({...e,onLoad:()=>{setTimeout(()=>{f(r,`visible`),t.widgetOpen&&f(n,`visible`)},1e3)}}),r=d({label:t.label,imageUrl:t.imageUrl,onTrigger:()=>f(n,`toggle`)});document.body.appendChild(r),document.body.appendChild(n)}await h();
1
+ const e=`cc-chatbot-layout`,t=`${e}-iframe-container`,n=`${e}-iframe`,r=`${e}-position-container`,i=`${e}-trigger-container`,a=`${e}-trigger-button`,o=`${e}-trigger-button-image`,s=`${e}-trigger-button-default-icon`,c=`${e}-trigger-text-container`,l=`${e}-trigger-text`,u=async e=>{let t=document.getElementById(e.id);return t&&t.remove(),new Promise(t=>{let n=document.createElement(`style`);n.id=e.id,n.textContent=e.css,n.onload=()=>t(),document.head.appendChild(n)})},d=e=>{let r=document.createElement(`iframe`);r.src=`${e.clientBaseUrl}/${e.workflowId}`,r.id=n,r.className=n,r.onload=()=>e.onLoad(r);let i=document.createElement(`div`);return i.id=t,i.className=t,i.append(r),i},f=e=>{let t=document.createElement(`div`);t.id=r,t.className=r,t.style.display=`none`;let n=document.createElement(`div`);if(n.id=i,n.className=i,e.label){let t=document.createElement(`div`);t.id=c,t.className=c;let r=document.createElement(`p`);r.id=l,r.className=l,r.innerText=e.label,t.append(r),n.append(t)}let u=document.createElement(`button`);if(u.type=`button`,u.id=a,u.className=a,u.addEventListener(`click`,e.onTrigger),e.imageUrl){let t=document.createElement(`img`);t.id=o,t.className=o,t.src=e.imageUrl,u.append(t)}else{let e=document.createElement(`span`);e.id=s,e.innerHTML=`<svg class="${s}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>`,e.style.fontSize=`24px`,u.append(e)}return n.append(u),t.append(n),t},p=(e,t)=>{if(t===`hidden`){e.style.display=`none`;return}if(t===`visible`){e.style.display=`block`;return}e.style.display===`block`?e.style.display=`none`:e.style.display=`block`},m=async e=>{let t=await fetch(`${e.apiBaseUrl}/chat/${e.workflowId}/trigger-css`);return t.ok?await t.text():null},h=async e=>{let t=await fetch(`${e.apiBaseUrl}/chat/${e.workflowId}/settings`);if(!t.ok)return null;let{defaultOpen:n=!1,label:r,imageUrl:i,openAfterMs:a=0}=await t.json();return{defaultOpen:n,label:r,imageUrl:i,openAfterMs:a}},g=()=>{let e=window.ConvoCraft;return e?e.apiBaseUrl?e.clientBaseUrl?e.workflowId?e.type?e:(console.error(`error[0005]`),null):(console.error(`error[0004]`),null):(console.error(`error[0003]`),null):(console.error(`error[0002]`),null):(console.error(`error[0001]`),null)};async function _(){let e=g();if(!e){console.error(`error[0006]`);return}let[t,n]=await Promise.all([h(e),m(e)]);if(!t){console.error(`error[0007]`);return}if(!n){console.error(`error[0008]`);return}await u({css:n,id:`___CC_WIDGET_TRIGGER___`});let r=d({...e,onLoad:()=>{setTimeout(()=>{p(i,`visible`),t.defaultOpen&&p(r,`visible`)},1e3+(t.openAfterMs||0))}}),i=f({label:t.label,imageUrl:t.imageUrl,onTrigger:()=>p(r,`toggle`)});document.body.appendChild(i),document.body.appendChild(r)}await _();
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,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___`})});
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];if(!r)return!1;let 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/package.json CHANGED
@@ -1,38 +1,57 @@
1
1
  {
2
2
  "name": "@convocraft/launcher",
3
- "version": "0.1.12",
4
3
  "type": "module",
4
+ "version": "0.1.20",
5
+ "exports": {
6
+ "./bubble": "./dist/bubble.js",
7
+ "./init": "./dist/init.js",
8
+ "./popup": "./dist/popup.js",
9
+ "./package.json": "./package.json"
10
+ },
11
+ "main": "./dist/index.mjs",
12
+ "module": "./dist/index.mjs",
13
+ "types": "./dist/index.d.mts",
5
14
  "files": [
6
15
  "dist"
7
16
  ],
8
- "main": "./dist/index.js",
9
- "module": "./dist/index.js",
10
- "types": "./dist/index.d.ts",
11
- "exports": {
12
- "./init": {
13
- "types": "./dist/init.d.ts",
14
- "import": "./dist/init.js"
15
- },
16
- "./bubble": {
17
- "types": "./dist/bubble.d.ts",
18
- "import": "./dist/bubble.js"
19
- },
20
- "./popup": {
21
- "types": "./dist/popup.d.ts",
22
- "import": "./dist/popup.js"
23
- }
17
+ "lint-staged": {
18
+ "**/*.{ts,tsx,json,md}": [
19
+ "pnpm run prettier:format",
20
+ "git add ."
21
+ ]
24
22
  },
25
23
  "devDependencies": {
26
- "@types/node": "^24.10.0",
27
- "tsdown": "^0.16.0",
28
- "@convocraft/ui": "0.0.1"
24
+ "@convocraft/nodes": "npm:@convocraftai/nodes@^0.2.142",
25
+ "@tsconfig/strictest": "^2.0.8",
26
+ "bumpp": "^10.4.0",
27
+ "husky": "^9.1.7",
28
+ "lint-staged": "^16.2.7",
29
+ "oxlint": "^1.42.0",
30
+ "oxlint-tsgolint": "^0.11.2",
31
+ "prettier": "^3.8.1",
32
+ "prettier-plugin-organize-imports": "^4.3.0",
33
+ "tsdown": "^0.18.4",
34
+ "typescript": "^5.9.3"
29
35
  },
30
36
  "publishConfig": {
31
37
  "access": "public"
32
38
  },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/ConvoCraftAI/launcher.git"
42
+ },
43
+ "dependencies": {
44
+ "dashjs": "^5.1.1"
45
+ },
33
46
  "scripts": {
34
47
  "build": "tsdown",
35
- "release": "pnpm run build && pnpm publish --no-git-checks",
36
- "_dev": "tsdown --watch"
48
+ "dev": "tsdown --watch",
49
+ "lint": "oxlint --type-aware --type-check",
50
+ "lint:fix": "oxlint --fix",
51
+ "prettier:format": "prettier --write '**/*.{ts,tsx,json,md}'",
52
+ "lint-staged": "lint-staged",
53
+ "bumpp": "bumpp patch -y",
54
+ "release": "pnpm run bumpp",
55
+ "release:quick": "git add . && git commit -m \"build: hotfix\" && git push && pnpm run release"
37
56
  }
38
57
  }