tia-gpc-widget 2.0.9 → 2.1.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/dist/Images/logo.png +0 -0
- package/dist/loader.js +2 -2
- package/dist/loader.min.js +2 -2
- package/dist/tia-gpc-widget.standalone.js +22 -22
- package/dist/tia-gpc-widget.standalone.js.map +1 -1
- package/dist/tia-gpc.cjs.js +19 -19
- package/dist/tia-gpc.cjs.js.map +1 -1
- package/dist/tia-gpc.es.js +2830 -2829
- package/dist/tia-gpc.es.js.map +1 -1
- package/dist/version.json +14 -14
- package/package.json +1 -1
|
Binary file
|
package/dist/loader.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
timeout: 15000,
|
|
12
12
|
maxRetries: 3,
|
|
13
13
|
retryDelay: 2000,
|
|
14
|
-
fallbackVersion: '2.0
|
|
14
|
+
fallbackVersion: '2.1.0',
|
|
15
15
|
fallbackCdn: 'https://cdn.jsdelivr.net/npm/tia-gpc-widget'
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -263,7 +263,7 @@
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
window.TiaGPCLoader = {
|
|
266
|
-
version: '2.0
|
|
266
|
+
version: '2.1.0',
|
|
267
267
|
reload: init,
|
|
268
268
|
config: CONFIG
|
|
269
269
|
};
|
package/dist/loader.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! TIA GPC Widget Loader v2.0
|
|
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:"2.0
|
|
1
|
+
/*! TIA GPC Widget Loader v2.1.0 | (c) 2026 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:"2.1.0",fallbackCdn:"https://cdn.jsdelivr.net/npm/tia-gpc-widget"};let t=0,n=Date.now();const o=function(e,t){console.warn("[TIA GPC Loader]",e,t||"")},i=function(e,t){console.error("[TIA GPC Loader]",e,t||"")};function a(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function r(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 s(r,d){t++;try{if(r.version,(c=r.css,new Promise((e,t)=>{if(document.querySelector(`link[href*="${c}"]`))return void e();const n=document.createElement("link");n.rel="stylesheet",n.href=c,n.crossOrigin="anonymous",n.onload=e,n.onerror=()=>t(new Error(`Failed to load CSS: ${c}`)),document.head.appendChild(n)})).catch(e=>{o("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)})}(r.js,e.timeout),!window.TiaGPC)throw new Error("Widget loaded but TiaGPC global not found");const i=Date.now()-n;return r.version,window.TiaGPCWidgetLoaded=!0,window.TiaGPCWidgetVersion=r.version,a("tia-gpc-loader-ready",{version:r.version,loadTime:i,attempts:t,channel:d.channel}),d.apiUrl&&function(e,t){try{fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}).catch(()=>{})}catch(e){}}(d.apiUrl,{event:"widget_loaded",version:r.version,loadTime:i,url:window.location.href}),!0}catch(n){if(i(`Failed to load widget (attempt ${t})`,n.message),t<e.maxRetries)return await new Promise(t=>setTimeout(t,e.retryDelay)),s(r,d);throw a("tia-gpc-loader-error",{error:n.message,attempts:t,version:r.version}),new Error(`Failed to load widget after ${t} attempts: ${n.message}`)}var c}async function d(){try{if(!0===window.TiaGPCWidgetLoaded||void 0!==window.TiaGPC)return void o("Widget already loaded, skipping");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;const n=await async function(t){try{if(t.version)return r(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(),s=a[t.channel]||a.stable;return{version:a.version,js:s.js,css:s.css,timestamp:a.timestamp}}catch(t){return o("Failed to fetch version info, using fallback",t.message),r(e.fallbackVersion)}}(t);t.debug,await s(n,t)}catch(e){i("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",d):d(),window.TiaGPCLoader={version:"2.1.0",reload:d,config:e}}();
|
|
3
3
|
//# sourceMappingURL=loader.min.js.map
|