talkgeniejs-staging 1.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.
- package/index.d.ts +1 -0
- package/lib.d.ts +2 -0
- package/package.json +40 -0
- package/talkgeniejs.js +1 -0
- package/talkgeniejs.m.js +1 -0
- package/talkgeniejs.modern.mjs +1 -0
- package/talkgeniejs.umd.js +1 -0
- package/types.d.ts +24 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "talkgeniejs-staging",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "talkgeniejs.js",
|
|
5
|
+
"module": "talkgeniejs.m.js",
|
|
6
|
+
"unpkg": "talkgeniejs.umd.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "npx rimraf dist && mkdir dist && microbundle --tsconfig tsconfig.json --no-sourcemap --output dist && mv *.d.ts dist/ && cp package.json dist/package.json",
|
|
10
|
+
"build:windows": "npx rimraf dist && mkdir dist && microbundle --tsconfig tsconfig.json --no-sourcemap --output dist && powershell \"move *.d.ts dist/\" && powershell copy package.json dist/package.json",
|
|
11
|
+
"build:linux": "npx rimraf dist && mkdir dist && microbundle --tsconfig tsconfig.json --no-sourcemap --output dist && mv *.d.ts dist/ && cp package.json dist/package.json",
|
|
12
|
+
"test": "echo \"No tests specified\" && exit 0"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"talk",
|
|
16
|
+
"speech",
|
|
17
|
+
"text-to-speech",
|
|
18
|
+
"tts",
|
|
19
|
+
"widget",
|
|
20
|
+
"talkgenie",
|
|
21
|
+
"voice-widget"
|
|
22
|
+
],
|
|
23
|
+
"author": "aliabbas101",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"description": "A JavaScript library for text-to-speech functionality",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/yourusername/talkgeniejs.git"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/yourusername/talkgeniejs#readme",
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/yourusername/talkgeniejs/issues"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"microbundle": "^0.15.1"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"rimraf": "^6.0.1"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/talkgeniejs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},t.apply(null,arguments)}function e(t,e){try{var n=t()}catch(t){return e(t)}return n&&n.then?n.then(void 0,e):n}var n="https://staging-api.talkgenie.ai",r="https://staging-widget.talkgenie.ai";(function(){try{var i=window.protoSettings.widgetUid;if(!i)throw new Error("Widget UID is required");return Promise.resolve(function(t){try{return Promise.resolve(e(function(){return Promise.resolve(fetch(n+"/public/initiate-widget?agentUuid="+t)).then(function(t){if(!t.ok)throw new Error("Response status: "+t.status);return Promise.resolve(t.json())})},function(t){throw console.error(t.message),t}))}catch(t){return Promise.reject(t)}}(i)).then(function(o){var s,a=o.data,l=null==o||null==(s=o.data)?void 0:s.metaData,c="talkgenie_email_"+i,u="100px",d="100px",h=(null==l?void 0:l.widgetPosition)||"bottom-right",f=document.createElement("iframe");switch(f.src=r+"?widgetUid="+i,f.allow="microphone",f.setAttribute("allowtransparency","true"),f.style.border="none",f.style.width=u,f.style.height=d,f.style.position="fixed",f.style.zIndex="9999",f.style.pointerEvents="all",f.style.bottom="18px",f.style.right="15px",f.style.transition="width 0.3s, height 0.3s",h){case"top-left":f.style.top="10px",f.style.left="10px";break;case"top-right":f.style.top="10px",f.style.right="10px";break;case"bottom-left":f.style.bottom="10px",f.style.left="10px";break;default:f.style.bottom="10px",f.style.right="10px"}document.body.appendChild(f),window.addEventListener("message",function(o){try{var s=function(){if(o.origin===r){var s=o.data,l=function(){if("widget:toggleSize"===o.data)!function(t,e,n){t.style.width===e?(t.style.width="468px",t.style.height="780px"):(t.style.width=e,t.style.height=n)}(f,u,d);else{var r=function(){if("widget:componentLoaded"===o.data){var r=localStorage.getItem(c);f.contentWindow.postMessage({type:"widgetConfig",data:t({},a,{storedEmail:r||null})},"*")}else{var l=function(){if("widget:startChatSession"===s.type){var t=s.data;return t.email&&localStorage.setItem(c,t.email),Promise.resolve(function(t,r,i){try{return Promise.resolve(e(function(){var e=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){return"UTC"}}(),o=(new Date).toISOString(),s=i?"&email="+encodeURIComponent(i):"",a="&timezone="+encodeURIComponent(e),l="¤tTime="+encodeURIComponent(o);return Promise.resolve(fetch(n+"/public/initiate-chatwidget-connection/"+t+"?widgetCallType="+r+s+a+l)).then(function(t){if(!t.ok)throw new Error("Response status: "+t.status);return Promise.resolve(t.json()).then(function(t){return t.data})})},function(t){throw console.error(t.message),t}))}catch(t){return Promise.reject(t)}}(i,t.type,t.email)).then(function(t){f.contentWindow.postMessage({type:"callStarted",data:t},"*")})}}();if(l&&l.then)return l.then(function(){})}}();if(r&&r.then)return r.then(function(){})}}();if(l&&l.then)return l.then(function(){})}}();return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},!1)})}catch(t){return Promise.reject(t)}})().catch(function(t){return console.error("Failed to initialize widget:",t)});
|
package/talkgeniejs.m.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},t.apply(null,arguments)}function e(t,e){try{var n=t()}catch(t){return e(t)}return n&&n.then?n.then(void 0,e):n}var n="https://staging-api.talkgenie.ai",r="https://staging-widget.talkgenie.ai";(function(){try{var i=window.protoSettings.widgetUid;if(!i)throw new Error("Widget UID is required");return Promise.resolve(function(t){try{return Promise.resolve(e(function(){return Promise.resolve(fetch(n+"/public/initiate-widget?agentUuid="+t)).then(function(t){if(!t.ok)throw new Error("Response status: "+t.status);return Promise.resolve(t.json())})},function(t){throw console.error(t.message),t}))}catch(t){return Promise.reject(t)}}(i)).then(function(o){var s,a=o.data,l=null==o||null==(s=o.data)?void 0:s.metaData,c="talkgenie_email_"+i,u="100px",d="100px",h=(null==l?void 0:l.widgetPosition)||"bottom-right",f=document.createElement("iframe");switch(f.src=r+"?widgetUid="+i,f.allow="microphone",f.setAttribute("allowtransparency","true"),f.style.border="none",f.style.width=u,f.style.height=d,f.style.position="fixed",f.style.zIndex="9999",f.style.pointerEvents="all",f.style.bottom="18px",f.style.right="15px",f.style.transition="width 0.3s, height 0.3s",h){case"top-left":f.style.top="10px",f.style.left="10px";break;case"top-right":f.style.top="10px",f.style.right="10px";break;case"bottom-left":f.style.bottom="10px",f.style.left="10px";break;default:f.style.bottom="10px",f.style.right="10px"}document.body.appendChild(f),window.addEventListener("message",function(o){try{var s=function(){if(o.origin===r){var s=o.data,l=function(){if("widget:toggleSize"===o.data)!function(t,e,n){t.style.width===e?(t.style.width="468px",t.style.height="780px"):(t.style.width=e,t.style.height=n)}(f,u,d);else{var r=function(){if("widget:componentLoaded"===o.data){var r=localStorage.getItem(c);f.contentWindow.postMessage({type:"widgetConfig",data:t({},a,{storedEmail:r||null})},"*")}else{var l=function(){if("widget:startChatSession"===s.type){var t=s.data;return t.email&&localStorage.setItem(c,t.email),Promise.resolve(function(t,r,i){try{return Promise.resolve(e(function(){var e=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){return"UTC"}}(),o=(new Date).toISOString(),s=i?"&email="+encodeURIComponent(i):"",a="&timezone="+encodeURIComponent(e),l="¤tTime="+encodeURIComponent(o);return Promise.resolve(fetch(n+"/public/initiate-chatwidget-connection/"+t+"?widgetCallType="+r+s+a+l)).then(function(t){if(!t.ok)throw new Error("Response status: "+t.status);return Promise.resolve(t.json()).then(function(t){return t.data})})},function(t){throw console.error(t.message),t}))}catch(t){return Promise.reject(t)}}(i,t.type,t.email)).then(function(t){f.contentWindow.postMessage({type:"callStarted",data:t},"*")})}}();if(l&&l.then)return l.then(function(){})}}();if(r&&r.then)return r.then(function(){})}}();if(l&&l.then)return l.then(function(){})}}();return Promise.resolve(s&&s.then?s.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},!1)})}catch(t){return Promise.reject(t)}})().catch(function(t){return console.error("Failed to initialize widget:",t)});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var a in i)({}).hasOwnProperty.call(i,a)&&(t[a]=i[a])}return t},t.apply(null,arguments)}const e="https://staging-api.talkgenie.ai",i="https://staging-widget.talkgenie.ai";(async()=>{var a;const{widgetUid:o}=window.protoSettings;if(!o)throw new Error("Widget UID is required");const n=await(async t=>{try{const i=await fetch(`${e}/public/initiate-widget?agentUuid=${t}`);if(!i.ok)throw new Error(`Response status: ${i.status}`);return await i.json()}catch(t){throw console.error(t.message),t}})(o),s=n.data,l=null==n||null==(a=n.data)?void 0:a.metaData,r=`talkgenie_email_${o}`,d="100px",c="100px",g=(null==l?void 0:l.widgetPosition)||"bottom-right",p=document.createElement("iframe");switch(p.src=`${i}?widgetUid=${o}`,p.allow="microphone",p.setAttribute("allowtransparency","true"),p.style.border="none",p.style.width=d,p.style.height=c,p.style.position="fixed",p.style.zIndex="9999",p.style.pointerEvents="all",p.style.bottom="18px",p.style.right="15px",p.style.transition="width 0.3s, height 0.3s",g){case"top-left":p.style.top="10px",p.style.left="10px";break;case"top-right":p.style.top="10px",p.style.right="10px";break;case"bottom-left":p.style.bottom="10px",p.style.left="10px";break;default:p.style.bottom="10px",p.style.right="10px"}document.body.appendChild(p),window.addEventListener("message",async a=>{if(a.origin===i){let i=a.data;if("widget:toggleSize"===a.data)((t,e,i)=>{t.style.width===e?(t.style.width="468px",t.style.height="780px"):(t.style.width=e,t.style.height=i)})(p,d,c);else if("widget:componentLoaded"===a.data){const e=localStorage.getItem(r);p.contentWindow.postMessage({type:"widgetConfig",data:t({},s,{storedEmail:e||null})},"*")}else if("widget:startChatSession"===i.type){let t=i.data;t.email&&localStorage.setItem(r,t.email);let a=await(async(t,i,a)=>{try{const o=(()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){return"UTC"}})(),n=(new Date).toISOString(),s=a?`&email=${encodeURIComponent(a)}`:"",l=`&timezone=${encodeURIComponent(o)}`,r=`¤tTime=${encodeURIComponent(n)}`,d=await fetch(`${e}/public/initiate-chatwidget-connection/${t}?widgetCallType=${i}${s}${l}${r}`);if(!d.ok)throw new Error(`Response status: ${d.status}`);return(await d.json()).data}catch(t){throw console.error(t.message),t}})(o,t.type,t.email);p.contentWindow.postMessage({type:"callStarted",data:a},"*")}}},!1)})().catch(t=>console.error("Failed to initialize widget:",t));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},t.apply(null,arguments)}function e(t,e){try{var n=t()}catch(t){return e(t)}return n&&n.then?n.then(void 0,e):n}var n="https://staging-api.talkgenie.ai",r="https://staging-widget.talkgenie.ai";(function(){try{var i=window.protoSettings.widgetUid;if(!i)throw new Error("Widget UID is required");return Promise.resolve(function(t){try{return Promise.resolve(e(function(){return Promise.resolve(fetch(n+"/public/initiate-widget?agentUuid="+t)).then(function(t){if(!t.ok)throw new Error("Response status: "+t.status);return Promise.resolve(t.json())})},function(t){throw console.error(t.message),t}))}catch(t){return Promise.reject(t)}}(i)).then(function(o){var a,s=o.data,l=null==o||null==(a=o.data)?void 0:a.metaData,c="talkgenie_email_"+i,u="100px",d="100px",f=(null==l?void 0:l.widgetPosition)||"bottom-right",h=document.createElement("iframe");switch(h.src=r+"?widgetUid="+i,h.allow="microphone",h.setAttribute("allowtransparency","true"),h.style.border="none",h.style.width=u,h.style.height=d,h.style.position="fixed",h.style.zIndex="9999",h.style.pointerEvents="all",h.style.bottom="18px",h.style.right="15px",h.style.transition="width 0.3s, height 0.3s",f){case"top-left":h.style.top="10px",h.style.left="10px";break;case"top-right":h.style.top="10px",h.style.right="10px";break;case"bottom-left":h.style.bottom="10px",h.style.left="10px";break;default:h.style.bottom="10px",h.style.right="10px"}document.body.appendChild(h),window.addEventListener("message",function(o){try{var a=function(){if(o.origin===r){var a=o.data,l=function(){if("widget:toggleSize"===o.data)!function(t,e,n){t.style.width===e?(t.style.width="468px",t.style.height="780px"):(t.style.width=e,t.style.height=n)}(h,u,d);else{var r=function(){if("widget:componentLoaded"===o.data){var r=localStorage.getItem(c);h.contentWindow.postMessage({type:"widgetConfig",data:t({},s,{storedEmail:r||null})},"*")}else{var l=function(){if("widget:startChatSession"===a.type){var t=a.data;return t.email&&localStorage.setItem(c,t.email),Promise.resolve(function(t,r,i){try{return Promise.resolve(e(function(){var e=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch(t){return"UTC"}}(),o=(new Date).toISOString(),a=i?"&email="+encodeURIComponent(i):"",s="&timezone="+encodeURIComponent(e),l="¤tTime="+encodeURIComponent(o);return Promise.resolve(fetch(n+"/public/initiate-chatwidget-connection/"+t+"?widgetCallType="+r+a+s+l)).then(function(t){if(!t.ok)throw new Error("Response status: "+t.status);return Promise.resolve(t.json()).then(function(t){return t.data})})},function(t){throw console.error(t.message),t}))}catch(t){return Promise.reject(t)}}(i,t.type,t.email)).then(function(t){h.contentWindow.postMessage({type:"callStarted",data:t},"*")})}}();if(l&&l.then)return l.then(function(){})}}();if(r&&r.then)return r.then(function(){})}}();if(l&&l.then)return l.then(function(){})}}();return Promise.resolve(a&&a.then?a.then(function(){}):void 0)}catch(t){return Promise.reject(t)}},!1)})}catch(t){return Promise.reject(t)}})().catch(function(t){return console.error("Failed to initialize widget:",t)})});
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface WidgetConfig {
|
|
2
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
+
}
|
|
4
|
+
export interface WidgetConfigResponse {
|
|
5
|
+
data: {
|
|
6
|
+
wsUrl: string;
|
|
7
|
+
token: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
declare global {
|
|
11
|
+
interface Window {
|
|
12
|
+
protoSettings: {
|
|
13
|
+
widgetUid: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare class IframeEvent {
|
|
18
|
+
type: string;
|
|
19
|
+
data: any;
|
|
20
|
+
}
|
|
21
|
+
export declare enum chatWidgetType {
|
|
22
|
+
ChatWidgetAudio = "ChatWidgetAudio",
|
|
23
|
+
ChatWidgetText = "ChatWidgetText"
|
|
24
|
+
}
|