tia-gpc-widget 1.1.4 → 1.1.5
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/loader.js +3 -3
- package/dist/loader.min.js +1 -1
- package/dist/tia-gpc-widget.standalone.js +1 -1
- package/dist/tia-gpc-widget.standalone.js.map +1 -1
- package/dist/tia-gpc.cjs.js +1 -1
- package/dist/tia-gpc.cjs.js.map +1 -1
- package/dist/tia-gpc.es.js +3 -1
- package/dist/tia-gpc.es.js.map +1 -1
- package/dist/version.json +14 -14
- package/package.json +1 -1
package/dist/loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TIA GPC Widget Loader
|
|
3
|
-
* @version 1.1.
|
|
3
|
+
* @version 1.1.5
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
(function() {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
timeout: 15000,
|
|
13
13
|
maxRetries: 3,
|
|
14
14
|
retryDelay: 2000,
|
|
15
|
-
fallbackVersion: '1.1.
|
|
15
|
+
fallbackVersion: '1.1.5',
|
|
16
16
|
fallbackCdn: 'https://cdn.jsdelivr.net/npm/tia-gpc-widget'
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
window.TiaGPCLoader = {
|
|
269
|
-
version: '1.1.
|
|
269
|
+
version: '1.1.5',
|
|
270
270
|
reload: init,
|
|
271
271
|
config: CONFIG
|
|
272
272
|
};
|
package/dist/loader.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! TIA GPC Widget Loader v1.0.0 | (c) 2025 TIA | UNLICENSED */
|
|
2
|
-
!function(){"use strict";const e={versionUrl:"https://cdn.jsdelivr.net/npm/tia-gpc-widget@latest/dist/version.json",defaultChannel:"stable",timeout:15e3,maxRetries:3,retryDelay:2e3,fallbackVersion:"1.1.
|
|
2
|
+
!function(){"use strict";const e={versionUrl:"https://cdn.jsdelivr.net/npm/tia-gpc-widget@latest/dist/version.json",defaultChannel:"stable",timeout:15e3,maxRetries:3,retryDelay:2e3,fallbackVersion:"1.1.5",fallbackCdn:"https://cdn.jsdelivr.net/npm/tia-gpc-widget"};let t=0,n=Date.now();const o=function(e,t){console.log("[TIA GPC Loader]",e,t||"")},i=function(e,t){console.warn("[TIA GPC Loader]",e,t||"")},a=function(e,t){console.error("[TIA GPC Loader]",e,t||"")};function r(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function s(t){const n=e.fallbackCdn;return{version:t,js:`${n}@${t}/dist/tia-gpc-widget.standalone.js`,css:`${n}@${t}/dist/tia-gpc-widget.standalone.css`,timestamp:null}}async function d(s,c){t++;try{if(o(`Loading widget v${s.version} (attempt ${t}/${e.maxRetries})...`),(l=s.css,new Promise((e,t)=>{if(document.querySelector(`link[href*="${l}"]`))return void e();const n=document.createElement("link");n.rel="stylesheet",n.href=l,n.crossOrigin="anonymous",n.onload=e,n.onerror=()=>t(new Error(`Failed to load CSS: ${l}`)),document.head.appendChild(n)})).catch(e=>{i("CSS loading failed, continuing anyway",e)}),await function(t,n){return new Promise((o,i)=>{const a=document.createElement("script");let r;a.src=t,a.async=!0,a.crossOrigin="anonymous",a.onload=function(){clearTimeout(r),o()},a.onerror=function(){clearTimeout(r),i(new Error(`Failed to load script: ${t}`))},r=setTimeout(()=>{i(new Error(`Timeout loading script: ${t}`))},n||e.timeout),document.head.appendChild(a)})}(s.js,e.timeout),!window.TiaGPC)throw new Error("Widget loaded but TiaGPC global not found");const a=Date.now()-n;return o(`Widget v${s.version} loaded successfully in ${a}ms`),window.TiaGPCWidgetLoaded=!0,window.TiaGPCWidgetVersion=s.version,r("tia-gpc-loader-ready",{version:s.version,loadTime:a,attempts:t,channel:c.channel}),c.apiUrl&&function(e,t){try{fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).catch(()=>{})}catch(e){}}(c.apiUrl,{event:"widget_loaded",version:s.version,loadTime:a,url:window.location.href}),!0}catch(n){if(a(`Failed to load widget (attempt ${t})`,n.message),t<e.maxRetries)return o(`Retrying in ${e.retryDelay}ms...`),await new Promise(t=>setTimeout(t,e.retryDelay)),d(s,c);throw r("tia-gpc-loader-error",{error:n.message,attempts:t,version:s.version}),new Error(`Failed to load widget after ${t} attempts: ${n.message}`)}var l}async function c(){try{if(!0===window.TiaGPCWidgetLoaded||void 0!==window.TiaGPC)return void i("Widget already loaded, skipping");o("Initializing TIA GPC Widget Loader...");const t=function(){const t=document.currentScript||document.querySelector('script[src*="loader"]');return t?{channel:t.getAttribute("data-channel")||e.defaultChannel,version:t.getAttribute("data-version")||null,debug:"true"===t.getAttribute("data-debug"),apiUrl:t.getAttribute("data-api-url")||null}:{}}();t.debug&&o("Loader config:",t);const n=await async function(t){try{if(t.version)return s(t.version);const n=Date.now(),o=`${e.versionUrl}?_=${n}`,i=await fetch(o,{cache:"no-cache",headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache"}});if(!i.ok)throw new Error(`HTTP ${i.status}: ${i.statusText}`);const a=await i.json(),r=a[t.channel]||a.stable;return{version:a.version,js:r.js,css:r.css,timestamp:a.timestamp}}catch(t){return i("Failed to fetch version info, using fallback",t.message),s(e.fallbackVersion)}}(t);t.debug&&o("Version info:",n),await d(n,t)}catch(e){a("Fatal error initializing widget",e);const t=document.querySelectorAll("tia-gpc-widget");t.length>0&&t.forEach(t=>{t.innerHTML=`\n <div style="padding: 20px; background: #fee; border: 2px solid #c00; border-radius: 8px; font-family: sans-serif;">\n <strong>Error loading TIA GPC Widget</strong>\n <p style="margin: 10px 0 0 0; font-size: 14px;">${e.message}</p>\n </div>\n `})}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",c):c(),window.TiaGPCLoader={version:"1.1.5",reload:c,config:e}}();
|
|
3
3
|
//# sourceMappingURL=loader.min.js.map
|
|
@@ -26,7 +26,7 @@ var Q={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24"
|
|
|
26
26
|
*
|
|
27
27
|
* This source code is licensed under the ISC license.
|
|
28
28
|
* See the LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/const J=l.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...s},u)=>l.createElement("svg",{ref:u,...Q,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:W("lucide",o),...!i&&!K(s)&&{"aria-hidden":"true"},...s},[...a.map(([e,t])=>l.createElement(e,t)),...Array.isArray(i)?i:[i]])),Y=(e,t)=>{const n=l.forwardRef(({className:n,...r},o)=>{return l.createElement(J,{ref:o,iconNode:t,className:W(`lucide-${i=q(e),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...r});var i});return n.displayName=q(e),n},G=Y("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),X=Y("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),Z=Y("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),ee=Y("message-circle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),te=Y("message-square",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),ne=Y("mic-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]),re=Y("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),oe=Y("moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),ie=Y("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),ae=Y("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),se=({onClick:e,unreadCount:t=0,widgetConfig:n})=>{const{t:r}=V(),o=n?.company_name||r("widget.title");return O.jsxs("button",{onClick:e,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in","aria-label":r("chat.title"),title:r("chat.title"),children:[O.jsxs("div",{className:"gpc-floating-content",children:[O.jsx(ee,{className:"gpc-floating-icon"}),O.jsxs("span",{className:"gpc-floating-text",children:[r("widget.questionsTo")," ",o]})]}),t>0&&O.jsx("span",{className:"gpc-notification-badge",children:t>9?"9+":t})]})};
|
|
29
|
+
*/const J=l.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:a,...s},u)=>l.createElement("svg",{ref:u,...Q,width:t,height:t,stroke:e,strokeWidth:r?24*Number(n)/Number(t):n,className:W("lucide",o),...!i&&!K(s)&&{"aria-hidden":"true"},...s},[...a.map(([e,t])=>l.createElement(e,t)),...Array.isArray(i)?i:[i]])),Y=(e,t)=>{const n=l.forwardRef(({className:n,...r},o)=>{return l.createElement(J,{ref:o,iconNode:t,className:W(`lucide-${i=q(e),i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,n),...r});var i});return n.displayName=q(e),n},G=Y("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),X=Y("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),Z=Y("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),ee=Y("message-circle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]),te=Y("message-square",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]),ne=Y("mic-off",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]),re=Y("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),oe=Y("moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]),ie=Y("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]),ae=Y("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),se=({onClick:e,unreadCount:t=0,widgetConfig:n})=>{const{t:r}=V(),o=n?.company_name||r("widget.title");return O.jsxs("button",{onClick:e,className:"gpc-floating-button gpc-floating-button-with-text gpc-animate-fade-in gpc-pulse-animation","aria-label":r("chat.title"),title:r("chat.title"),style:{boxShadow:"0 4px 20px rgba(59, 130, 246, 0.5)"},children:[O.jsxs("div",{className:"gpc-floating-content",children:[O.jsx(ee,{className:"gpc-floating-icon"}),O.jsxs("span",{className:"gpc-floating-text",children:["💬 ",r("widget.questionsTo")," ",o]})]}),t>0&&O.jsx("span",{className:"gpc-notification-badge",children:t>9?"9+":t})]})};
|
|
30
30
|
/**
|
|
31
31
|
* @license lucide-react v0.525.0 - ISC
|
|
32
32
|
*
|