@enjoys/pinglet 1.0.3 → 1.0.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/package.json CHANGED
@@ -1,16 +1,18 @@
1
1
  {
2
2
  "name": "@enjoys/pinglet",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Lightweight Customizable Web & CustomPush Notification SDK for modern web apps. Supports customizable layouts, secure delivery, and real-time updates via SSE.",
5
- "main": "./v0.0.2/pinglet-sse.js",
6
- "types": "./v0.0.2/pinglet-sse.d.ts",
5
+ "main": "./pinglet-sse.js",
6
+ "types": "./pinglet-sse.d.ts",
7
7
  "exports": {
8
8
  ".": {
9
- "import": "./v0.0.2/pinglet-sse.js",
10
- "require": "./v0.0.2/pinglet-sse.js"
9
+ "import": "./pinglet-sse.js",
10
+ "require": "./pinglet-sse.js"
11
11
  }
12
12
  },
13
- "files": ["*" ],
13
+ "files": [
14
+ "*"
15
+ ],
14
16
  "keywords": [
15
17
  "push",
16
18
  "notifications",
package/pinglet-sse.js ADDED
@@ -0,0 +1 @@
1
+ !function(){"use strict";function e(e,t){switch(e.action){case"redirect":return()=>window.open(e.src,"_blank");case"link":return()=>window.open(e.src);case"alert":return()=>alert(e.src);case"reload":return()=>window.location.reload();case"event":return()=>self.addEventListener(e.src,(()=>{}));case"close":return()=>{window.dispatchEvent(new CustomEvent("pinglet:notificationClosed",{detail:{contentEl:t,reason:"user-dismiss"}}))}}return()=>window.open("https://pinglet.enjoys.in/docs","_blank")}function t(t,n,i=[{text:"See Docs",onClick:()=>window.open("https://pinglet.enjoys.in/docs","_blank")}],o="⚠️",s={duration:5e3,auto_dismiss:!0}){const a="toastContainer";let l=document.getElementById(a);l||(l=document.createElement("div"),l.id=a,Object.assign(l.style,{position:"fixed",bottom:"24px",right:"24px",zIndex:"9999",display:"flex",flexDirection:"column",gap:"4px",alignItems:"flex-end",fontFamily:"Manrope, sans-serif"}),document.body.appendChild(l));const r=document.createElement("div");Object.assign(r.style,{background:"#1f1f1f",color:"#fff",padding:"16px 20px",borderRadius:"12px",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.25)",fontFamily:"'Inter', sans-serif",minWidth:"260px",maxWidth:"340px",opacity:"0",transform:"translateX(100%)",transition:"opacity 0.3s ease, transform 0.3s ease",display:"flex",flexDirection:"column",gap:"10px",fontFamily:"Manrope, sans-serif"});const c=document.createElement("div");Object.assign(c.style,{display:"flex",alignItems:"center",gap:"10px",fontSize:"16px",fontWeight:"600",fontFamily:"Manrope, sans-serif"});const d=document.createElement("div");d.textContent=o;const p=document.createElement("div");if(p.textContent=t,c.appendChild(d),c.appendChild(p),r.appendChild(c),n){const e=document.createElement("div");e.textContent=n,Object.assign(e.style,{fontSize:"13.5px",fontWeight:"400",color:"#ddd",lineHeight:"1.5"}),r.appendChild(e)}if(Array.isArray(i)&&i.length){const t=document.createElement("div");Object.assign(t.style,{marginTop:"8px",display:"flex",gap:"10px",justifyContent:"flex-start"});for(const n of i){const i=document.createElement("button");if(i.textContent=n.text||"Click Here",Object.assign(i.style,{padding:"8px 14px",background:"#333",color:"#fff",border:"1px solid #444",borderRadius:"6px",fontSize:"13px",cursor:"pointer",transition:"background 0.3s",fontFamily:"Manrope, sans-serif"}),i.onmouseover=()=>i.style.background="#444",i.onmouseout=()=>i.style.background="#333",n?.onClick){const e=new Function(`return ${n.onClick}`)();"function"==typeof e&&i.addEventListener("click",e)}else i.addEventListener("click",e(n,i));t.appendChild(i)}r.appendChild(t)}const m=document.createElement("div");return m.innerHTML='Notifications by <a href="https://pinglet.enjoys.in" target="_blank" style="color:#4da6ff;text-decoration:none;">Pinglet</a> - Enjoys',Object.assign(m.style,{fontSize:"11px",color:"#999",marginTop:"4px",textAlign:"right",fontFamily:"Manrope, sans-serif"}),l.appendChild(r),l.appendChild(m),requestAnimationFrame((()=>{r.style.opacity="1",r.style.transform="translateX(0)"})),s.auto_dismiss||setTimeout((()=>{r.style.opacity="0",r.style.transform="translateX(100%)",setTimeout((()=>{r.remove(),m.remove()}),500)}),s.duration||5e3),l}const n={duration:3e3,btn1:{color:"#ffffff",backgroundColor:"#007bff",padding:"6px 10px",borderRadius:"6px",fontSize:"14px",fontWeight:"600",border:"none",boxShadow:"0 2px 6px rgba(0,0,0,0.15)"},btn2:{color:"#333333",backgroundColor:"#f0f0f0",padding:"6px 10px",borderRadius:"6px",fontSize:"14px",fontWeight:"600",border:"1px solid #ccc"},title:{color:"#111111",fontSize:"14px",fontWeight:"500",lineHeight:"1.4",margin:"0 0 0 0",textAlign:"left"},description:{color:"#444444",fontSize:"13px",fontWeight:"400",lineHeight:"1.5",margin:"0 0 10px 0",textAlign:"left"},controls:{video:{autoplay:!1,muted:!1,loop:!1,controls:!1},audio:{autoplay:!1,muted:!1,loop:!1,controls:!1}},media:{image:{width:"100%",height:"200px",borderRadius:"6px",objectFit:"cover",margin:"0 0 8px 0"},icon:{width:"24px",height:"24px",margin:"0 8px 0 0",objectFit:"contain"},logo:{width:"50px",height:"50px",margin:"0 8px 0 0",objectFit:"contain"},video:{width:"100%",height:"140px",borderRadius:"6px",objectFit:"cover",margin:"0 0 10px 0"},iframe:{width:"100%",height:"140px",borderRadius:"6px",objectFit:"cover",margin:"0 0 10px 0"},audio:{width:"100%",margin:"8px 0"}}},i={position:"bottom-left",transition:"fade",branding:{show:!0,once:!0,html:'Notifications by <a href="https://pinglet.enjoys.in" style="color:#4da6ff;text-decoration:none;" target="_blank">Pinglet</a> - Enjoys'},sound:{play:!1,src:"https://pinglet.enjoys.in/api/v1/pinglet-sound.mp3?v=1&ext=mp3",volume:.6},duration:2e3,maxVisible:3,stacking:!0,auto_dismiss:!0,dismissible:!0,website:"https://pinglet.enjoys.in",time:!0,favicon:!0,pauseOnHover:!0,theme:{mode:"light",customClass:"",rounded:!0,shadow:!0,border:!1},iconDefaults:{show:!0,size:20,position:"left"},progressBar:{show:!0,color:"#4da6ff",height:3}};let o,s,a=null,l=null,r=null;function c(e){return l||(l=document.createElement("div"),l.className="pinglet-branding",l.innerHTML=e?.html||'Notifications by <a href="https://pinglet.enjoys.in" class="pinglet-link" target="_blank" style="color:#4da6ff;text-decoration:none;">Pinglet</a>',l.style="\n font-size: 11px;\n color: #808080;\n text-align: right;\n width: 100%;\n pointer-events: auto;\n ",l)}function d(e){if(s&&a)return{toastContainer:s,toastStack:a};const t=document.getElementById("pinglet-widget-container");return t?(s=t,a=s.querySelector(".pinglet-widget-stack"),{toastContainer:s,toastStack:a}):(s=document.createElement("div"),s.id="pinglet-widget-container",s.style.position="fixed",s.style.bottom="20px",s.style.left="20px",s.style.zIndex="9999",s.style.display="flex",s.style.flexDirection="column",s.style.alignItems="flex-start",s.style.gap="8px",s.style.maxWidth="360px",s.style.width="calc(100vw - 40px)",s.style.boxSizing="border-box",s.style.pointerEvents="none",s.style.padding="4px",s.style.borderRadius="8px",a=document.createElement("div"),a.className="pinglet-widget-stack",a.style.display="flex",a.style.flexDirection="column",a.style.gap="12px",a.style.pointerEvents="none",a.style.overflow="visible",a.style.flexShrink="0",s.appendChild(a),e?.show&&e?.once&&s.appendChild(c(e)),document.body.appendChild(s),{toastContainer:s,toastStack:a})}function p(e,t){const n=t.config,{toastContainer:i,toastStack:o}=d(n.branding);var s,a;n?.branding?.show&&n?.branding?.once&&i.appendChild(l),s=e,a=n.transition,s.style.opacity="0",s.style.transition="all 0.4s ease","fade"===a?(s.style.transform="translateX(20px)",requestAnimationFrame((()=>{s.style.opacity="1",s.style.transform="translateX(0)"}))):"slide"===a?(s.style.transform="translateX(100%)",requestAnimationFrame((()=>{s.style.opacity="1",s.style.transform="translateX(0)"}))):"zoom"===a?(s.style.transform="scale(0.8)",requestAnimationFrame((()=>{s.style.opacity="1",s.style.transform="scale(1)"}))):s.style.opacity="1",e.style.pointerEvents="auto",o.appendChild(e),n?.auto_dismiss&&setTimeout((()=>{m(e,n?.transition||"fade")}),n.duration||5e3)}function m(e,t){e&&(e.style.transition="all 0.4s ease","fade"===t?(e.style.opacity="0",e.style.transform="translateX(-40px)"):"slide"===t?(e.style.transform="translateX(-100%)",e.style.opacity="0"):"zoom"===t?(e.style.transform="scale(0.8)",e.style.opacity="0"):e.style.opacity="0",e.addEventListener("transitionend",(()=>{e.remove(),a&&0===a.children.length&&l?.remove()}),{once:!0}))}function g(t,s){const r=s.style,c=s.config,d=document.createElement("div");d.id="pinglet-variant",d.setAttribute("data-key",`${Date.now()}-${Math.random().toString(36).slice(2,8)}`),d.className=`pinglet-variant pinglet-${t.variant||"default"}`,d.style.display="flex",d.style.flexDirection="column",d.style.alignItems="stretch",d.style.width="100%",d.style.maxHeight="calc(100vh - 40px)",d.style.borderRadius="8px",d.style.overflowY="auto",d.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.1)",d.style.padding="4px",d.style.backgroundColor="rgba(255, 255, 255, 0.9)",d.style.gap="4px",d.style.pointerEvents="none",d.style.overflow="visible",d.style.flexShrink="0",d.appendChild(function(e=i,t=window.location.hostname,n="just now"){const o=document.createElement("div");o.className="pinglet-row",Object.assign(o.style,{display:"flex",justifyContent:"space-between",alignItems:"center",background:"transparent",fontFamily:"system-ui, sans-serif",fontSize:"10px",padding:"6px 10px",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",color:"#fff"});const s=document.createElement("div");s.className="pinglet-left",Object.assign(s.style,{display:"flex",alignItems:"center",gap:"6px",flexGrow:"1"});const r=document.createElement("span");r.className="pinglet-icon",r.textContent="- Pinglet",r.onclick=()=>{window.open("https://pinglet.enjoys.in","_blank")},Object.assign(r.style,{alignItems:"center",color:"dodgerblue",flexShrink:"0",fontWeight:"bold",cursor:"pointer"});const c=document.createElement("span");c.className="pinglet-domain",c.textContent=t,c.style.color="#808080";const d=document.createElement("span");d.className="pinglet-time",d.textContent=`- ${n}`,d.style.color="#aaa";const p=document.createElement("button");return p.className="pinglet-close",p.textContent="✕",Object.assign(p.style,{background:"none",border:"none",fontSize:"12px",cursor:"pointer",color:"#aaa",padding:"0 4px"}),p.addEventListener("mouseenter",(()=>{p.style.color="#f44"})),p.addEventListener("mouseleave",(()=>{p.style.color="#aaa"})),e?.website&&s.appendChild(c),e?.time&&s.appendChild(d),e?.favicon&&s.appendChild(r),o.appendChild(s),e?.dismissible&&o.appendChild(p),p.onclick=()=>{p.parentElement?.parentElement?.remove(),a&&0===a.children.length&&l?.remove()},o}(c));let p=null;const m=["icon","logo"].includes(t.media?.type);if(t.media?.type&&(p=function(e,t,i){switch(e.type){case"logo":{const i=document.createElement("img");return i.src=e.src,Object.assign(i.style,t?.logo||n.media.logo),i}case"image":{const i=document.createElement("img");return i.src=e.src,Object.assign(i.style,t?.image||n.media.image),i}case"video":{const o=document.createElement("video");return o.src=e.src,o.autoplay=i?.video?.autoplay||n.controls.video.autoplay||!1,o.muted=i?.video?.muted||n.controls.video.muted||!1,o.loop=i?.video?.loop||n.controls.video.loop||!1,o.controls=i?.video?.controls||n.controls.video.controls||!1,o.style=t?.video||n.media.video,Object.assign(o.style,t?.video||n.media.video),o}case"audio":{const t=document.createElement("audio");return t.src=e.src,t.autoplay=i?.audio?.controls||n.controls?.audio.autoplay||!1,t.muted=i?.audio?.muted||n.controls?.audio.muted||!1,t.loop=i?.audio?.loop||n.controls?.audio?.loop||!1,t.controls=i?.audio?.controls||n.controls?.audio?.controls||!1,Object.assign(t.style,t?.video||n.media.audio),t}case"icon":{const t=document.createElement("span");if("string"==typeof e.src){const n=/^data:image\/(png|jpeg|gif|webp);base64,/.test(e.src),i=/^<svg[\s\S]*<\/svg>$/.test(e.src.trim());n?(t.style.backgroundImage=`url('${e.src}')`,t.style.backgroundSize="cover",t.textContent=""):i?t.innerHTML=e.src:t.textContent=e.src}return t.className="pinglet-icon",Object.assign(t.style,{width:"40px",height:"40px",display:"inline-flex",alignItems:"center",justifyContent:"center",backgroundPosition:"center",borderRadius:"8px",fontSize:"24px",overflow:"hidden"}),t}default:return null}}(t.media,r.media,r.controls),m?Object.assign(p.style,{width:"48px",height:"48px",objectFit:"contain",flexShrink:"0",marginRight:"6px"}):p.style.marginBottom="12px"),m){const e=document.createElement("div");Object.assign(e.style,{display:"flex",flexDirection:"row",alignItems:"flex-start",gap:"6px"});const i=document.createElement("div");Object.assign(i.style,{flex:"0 0 auto"}),i.appendChild(p),e.appendChild(i);const o=document.createElement("div");if(Object.assign(o.style,{display:"flex",flexDirection:"column",flex:"1"}),t.title){const e=document.createElement("div");e.className="pinglet-title",e.innerText=t.title,Object.assign(e.style,r.title||n.title),o.appendChild(e)}if(t.description){const e=document.createElement("p");e.className="pinglet-desc",e.innerText=t.description,Object.assign(e.style,r.description||n.description),o.appendChild(e)}e.appendChild(o),d.appendChild(e)}else{if(p&&d.appendChild(p),t.title){const e=document.createElement("div");e.className="pinglet-title",e.innerText=t.title,Object.assign(e.style,r.title||n.title),d.appendChild(e)}if(t.description){const e=document.createElement("p");e.className="pinglet-desc",e.innerText=t.description,Object.assign(e.style,r.description||n.description),d.appendChild(e)}}if(t.buttons){const n=document.createElement("div");n.className="pinglet-buttons",n.style.fontFamily="Manrope",t.buttons.forEach(((t,i)=>{const o=document.createElement("button");if(o.innerText=t.text,o.className="pinglet-btn",o.style.cursor="pointer",o.style.padding="6px 10px",o.style.fontFamily="Manrope, sans-serif",o.style.margin="1px 4px",Object.assign(o.style,0===i?r.btn1:r.btn2),t?.onClick){const e=new Function(`return ${t.onClick}`)();"function"==typeof e&&o.addEventListener("click",e)}else o.addEventListener("click",e(t,d));n.appendChild(o)})),d.appendChild(n)}return c.sound?.play&&o&&(o.currentTime=0,o.play()),!l||d.contains(l)||c.branding?.once||d.appendChild(l),d}window.addEventListener("pinglet:notificationClosed",(e=>{m(e.detail.contentEl,"fade")}));function y(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(t);return Uint8Array.from([...n].map((e=>e.charCodeAt(0))))}function u(e,n){"Notification"in window?"granted"===Notification.permission||function(e={}){const{title:t="Stay updated with notifications",description:n="Get notified about important updates, new features, and exclusive content. We'll only send you valuable notifications.",site:i=window.location.hostname,onAllow:o=()=>{},onDeny:s=()=>{}}=e,a=document.createElement("div");a.className="notification-dialog",Object.assign(a.style,{position:"fixed",bottom:"24px",right:"24px",width:"380px",background:"#fff",borderRadius:"16px",boxShadow:"0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255,255,255,0.1)",zIndex:"1000",overflow:"hidden",transform:"translateX(420px)",animation:"slideIn 0.6s ease-out 1s forwards",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"});const l=document.createElement("style");l.textContent="\n @keyframes slideIn { to { transform: translateX(0); } }\n @keyframes pulse {\n 0%, 100% { box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); }\n 50% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5); }\n }\n @media (max-width: 480px) {\n .notification-dialog {\n width: calc(100vw - 32px) !important;\n right: 16px !important;\n bottom: 16px !important;\n transform: translateY(420px) !important;\n }\n @keyframes slideIn { to { transform: translateY(0); } }\n }\n ",document.head.appendChild(l);const r=document.createElement("div");r.style.display="flex",r.style.justifyContent="space-between",r.style.padding="20px 20px 0 20px";const c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.gap="8px",c.style.color="#6b7280",c.style.fontSize="14px",c.style.fontWeight="500";const d=document.createElement("div");d.style.width="16px",d.style.height="16px",d.style.borderRadius="4px",d.style.background="linear-gradient(135deg, #667eea 0%, #764ba2 100%)",d.style.display="flex",d.style.alignItems="center",d.style.justifyContent="center",d.innerHTML='<svg viewBox="0 0 16 16" fill="white" width="10" height="10"><path d="M8 0C3.58 0 0 3.58 0 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8z"/></svg>';const p=document.createElement("span");p.textContent=i,c.append(d,p);const m=document.createElement("button");m.innerHTML='<svg viewBox="0 0 16 16" fill="currentColor" width="12" height="12">\n <path d="M12.854 4.854a.5.5 0 0 0-.708-.708L8 8.293 3.854 4.146a.5.5 0 1 0-.708.708L7.293 9l-4.147 4.146a.5.5 0 0 0 .708.708L8 9.707l4.146 4.147a.5.5 0 0 0 .708-.708L8.707 9l4.147-4.146z"/>\n </svg>',Object.assign(m.style,{width:"24px",height:"24px",background:"#f3f4f6",border:"none",borderRadius:"6px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280"}),m.onclick=()=>a.remove(),r.append(c,m);const g=document.createElement("div");g.style.padding="16px 24px 24px 24px";const y=document.createElement("div");y.style.width="48px",y.style.height="48px",y.style.borderRadius="12px",y.style.marginBottom="16px",y.style.animation="pulse 2s infinite",y.style.background="linear-gradient(135deg, #667eea 0%, #764ba2 100%)",y.style.display="flex",y.style.alignItems="center",y.style.justifyContent="center",y.innerHTML='<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" width="24" height="24">\n <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/>\n </svg>';const u=document.createElement("h3");u.textContent=t,Object.assign(u.style,{fontSize:"18px",fontWeight:"600",color:"#111827",marginBottom:"8px"});const f=document.createElement("p");f.textContent=n,Object.assign(f.style,{fontSize:"14px",color:"#6b7280",lineHeight:"1.5",marginBottom:"20px"});const x=document.createElement("div");x.style.display="flex",x.style.gap="8px";const h=document.createElement("button");h.textContent="Not now",Object.assign(h.style,{flex:1,padding:"10px 16px",borderRadius:"8px",fontSize:"14px",fontWeight:"500",border:"1px solid #e5e7eb",background:"#f9fafb",color:"#6b7280",cursor:"pointer"}),h.onclick=()=>{s(),a.remove()};const b=document.createElement("button");b.textContent="Allow notifications",Object.assign(b.style,{flex:1,padding:"10px 16px",borderRadius:"8px",fontSize:"14px",fontWeight:"500",border:"none",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"#fff",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)",cursor:"pointer"}),b.onclick=()=>{o(),a.remove()},x.append(h,b);const w=document.createElement("div");w.style.marginTop="12px",w.style.display="flex",w.style.alignItems="center",w.style.justifyContent="center",w.style.gap="6px",w.style.color="#9ca3af",w.style.fontSize="12px",w.innerHTML='<svg viewBox="0 0 16 16" fill="currentColor" width="12" height="12"><path d="M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0z"/></svg><span>Secure & private • Unsubscribe anytime</span>',g.append(y,u,f,x,w),a.append(r,g),document.body.appendChild(a)}({site:window.location.hostname,onAllow:()=>{Notification.requestPermission().then((async i=>"granted"===i?async function(e,n){try{const i=await navigator.serviceWorker.register(e+"/sw.js");if(await i.pushManager.getSubscription())return;const o=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:y("BJ9GvEJAs47DOgqw-rN80ZGIVvIvcp-xE4ZNweCT4eJ0B-rIzMtfhLWh8ySUCeKgiW_Fym69h0Fx3vhAcAy6C2k")}),s=await fetch(`${e}/subscribe?projectId=${n}`,{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json"},credentials:"omit"}),a=await s.json();if(a.success)return localStorage.getItem("subscription")?void 0:(localStorage.setItem("subscription","true"),t("Notifications Enabled","You can now receive notifications from this site.",[{text:"See Demo",onClick:'()=>{\n new Notification("Pinglet", {\n body: "This is a demo notification",\n icon: "https://pinglet.enjoys.in/favicon.ico"\n }).onclick = () => {\n window.open("https://pinglet.enjoys.in", "_blank");\n }) \n }'}],"🎉"));t("Something Went Wrong",a.message,[],"❌")}catch(e){}}(e,n):t("Permission Denied","You blocked notifications!",[],"😭"))).catch((e=>t("Permission Error","Error requesting notification permission:",[],"😭")))},onDeny:()=>t("Permission Denied","You blocked notifications!",[],"❌")}):t("Unsupported Browser","Notifications not supported.",[],"🚫")}const f=Array.from(document.scripts).find((e=>e.src.includes("pinglet-sse")&&e.dataset.endpoint))||document.currentScript,x=f?.dataset.endpoint,h=f?.dataset.configuredDomain,b=f?.dataset.projectId,w=f?.dataset.pingletId,v=f?.dataset.loadTemplates,C=f?.dataset.checksum,E=f?.dataset.testimonials;(async e=>{if(e.PingletWidget)return void console.warn("PingletWidget is already initialized.");!function(){const e=document.createElement("link");e.rel="stylesheet",e.href="https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap",document.head.appendChild(e);const t=document.createElement("style");t.innerHTML='\n [class^="pinglet-"],\n [class*=" pinglet-"] {\n font-family: \'Manrope\', sans-serif !important;\n font-weight: 400 !important;\n }\n ',document.head.appendChild(t)}(),u(x,b),E&&function(){const e=document.getElementById("pinglet-testimonials");if(e)return e;const n=document.createElement("div");n.className="pinglet-floating-btn",n.style.position="fixed",n.style.bottom="30px",n.style.right="30px",n.style.display="flex",n.style.alignItems="center",n.style.background="#667EEA",n.style.borderRadius="50px",n.style.padding="0",n.style.cursor="pointer",n.style.boxShadow="0 4px 14px 0 rgba(102, 126, 234, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05)",n.style.transition="all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",n.style.overflow="hidden",n.style.width="24px",n.style.height="24px",n.style.zIndex="1000",n.style.backdropFilter="blur(10px)",n.style.border="1px solid rgba(255, 255, 255, 0.1)";const i=document.createElement("div");i.textContent="❔",i.className="icon",i.style.fontSize="20px",i.style.display="flex",i.style.alignItems="center",i.style.justifyContent="center",i.style.transition="all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",i.style.width="24px",i.style.height="24px",i.style.flexShrink="0",i.style.color="white";const o=document.createElement("span");o.textContent="View",o.className="label",o.style.color="white",o.style.fontWeight="500",o.style.fontSize="14px",o.style.marginLeft="8px",o.style.marginRight="16px",o.style.opacity="0",o.style.transform="translateX(-8px)",o.style.transition="all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",o.style.whiteSpace="nowrap",o.style.letterSpacing="0.025em",n.appendChild(i),n.appendChild(o),document.body.appendChild(n),n.addEventListener("mouseenter",(()=>{n.style.width="100px",n.style.borderRadius="28px",n.style.boxShadow="0 8px 25px 0 rgba(102, 126, 234, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1)",n.style.transform="translateY(-2px)",o.style.opacity="1",o.style.transform="translateX(0)",i.style.transform="scale(1.05)"})),n.addEventListener("mouseleave",(()=>{n.style.width="40px",n.style.height="40px",n.style.borderRadius="50px",n.style.boxShadow="0 4px 14px 0 rgba(102, 126, 234, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05)",n.style.transform="translateY(0)",o.style.opacity="0",o.style.transform="translateX(-8px)",i.style.transform="scale(1)"})),n.addEventListener("mousedown",(()=>{n.style.transform="translateY(0) scale(0.98)",n.style.boxShadow="0 2px 8px 0 rgba(102, 126, 234, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05)"})),n.addEventListener("mouseup",(()=>{n.style.transform="translateY(-2px)",n.style.boxShadow="0 8px 25px 0 rgba(102, 126, 234, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1)"})),o.addEventListener("click",(()=>{t("Testimonials Error","There was an error loading testimonials. Please try again later. If the issue persists, please contact support.",[],"❌")}));const s=()=>{window.innerWidth<=768?(n.style.bottom="16px",n.style.right="16px",n.style.width="48px",n.style.height="48px",i.style.width="48px",i.style.height="48px",i.style.fontSize="18px",o.style.fontSize="13px",o.style.marginLeft="6px",o.style.marginRight="12px"):(n.style.bottom="30px",n.style.right="30px",n.style.width="40px",n.style.height="40px",i.style.width="40px",i.style.height="40px",i.style.fontSize="20px",o.style.fontSize="14px",o.style.marginLeft="8px",o.style.marginRight="16px")};s(),window.addEventListener("resize",s)}();let s={};const a={version:"1.0.3",checksum:C.replace("sha384-",""),async init({endpoint:e,configuredDomain:a,projectId:l,pingletId:d}){if(console.log("%cPingletWidget initialized successfully.","color: #1e90ff; font-weight: bold;"),"1.0.3"!==this.version)return t("Pinglet Unsupported Version",`PingletWidget version ${this.version} is not supported. Please update to the latest version.`,[{text:"See Docs",actions:"redirect",src:"https://pinglet.enjoys.in/docs"}],"⚠️"),void console.warn("Unsupported version detected.");if(!this.checksum||!C)return t("Configuration Error","Missing checksum.");const m=await fetch(`${e}/load/projects?projectId=${l}&domain=${a}`,{headers:{"X-Project-ID":l,"X-Timestamp":Date.now(),"X-Pinglet-Signature":d,"X-Pinglet-Checksum":this.checksum,"X-Pinglet-Version":this.version,"X-Configured-Domain":a,"X-Pinglet-Id":d},credentials:"omit"}),y=await m.json();if(!y||!y.success)return t("Configuration Error",`Failed to load configuration for PingletWidget. ${y.message||"Unknown error"}`,[{text:"Retry",action:"reload"},{text:"See Docs",action:"redirect",src:"https://pinglet.enjoys.in/docs"}],"❌"),console.error("Failed to load configuration for PingletWidget.");if(c(y.result.config.branding),"true"===v){const n=await async function(e,t,n,i,o){const s=await fetch(`${e}/load/templates?projectId=${t}`,{headers:{"X-Project-ID":t,"X-Timestamp":Date.now(),"X-Pinglet-Signature":n,"X-Pinglet-Checksum":i,"X-Pinglet-Version":o},credentials:"omit"}),a=await s.json();return a&&a.success?a.result:null}(e,l,d,this.checksum,this.version);n||t("Configuration Error","Failed to load templates for PingletWidget."),s=n}const u={is_tff:y.result?.is_premium??!1,templates:Object.assign({},{default:{compiled_text:t.toString(),config:i,is_active:!0,is_default:!0}},"true"===v?s:{[String(y.result.template?.id.toString())]:y.result.template}),style:Object.assign({},n,y.result.template?.config),config:Object.assign({},i,y.result.config)};!function(e){if(o)return o;e.config.sound?.play&&e.config.sound.src&&(r=e.config.sound.src,o=new Audio(r||e.config.sound.src),o.volume=e.config.sound.volume??.5)}(u);new EventSource(`${e}/sse?projectId=${l}&pingletId=${d}`,{withCredentials:!1}).onmessage=e=>{const t=JSON.parse(e.data),n=t.data;if(u?.is_tdd&&Object.assign(u.config,u.config,n?.overrides??{}),"1"===t?.type&&t?.template_id&&t?.data){return p(interPolateTemplateWithData("",t?.data),u)}if("0"===t?.type&&t?.body){p(g(t.body,u),u)}else!function(e,t,n){new Notification(e,{badge:"🎉",body:t,actions:[{action:"pinglet",title:"Pinglet"}],icon:n,dir:"rtl",lang:"en",silent:!1,tag:"pinglet",vibrate:[100,50,100],requireInteraction:!0}).onclick=()=>{}}(body.title,body.description,body.type?.icon?.src||"")}}};e.PingletWidget=a,a.init({endpoint:x,configuredDomain:h,projectId:b,pingletId:w})})(window)}();
@@ -1,6 +0,0 @@
1
- export function changeToObject({ e, k, i, t }: {
2
- e: any;
3
- k: any;
4
- i: any;
5
- t: any;
6
- }): Promise<string | undefined>;
@@ -1,30 +0,0 @@
1
- /** @typedef import('./types/project.config.js).ProjectConfig */
2
- /**
3
- * @typedef {Object} ShowPopup
4
- * @param {string} title
5
- * @param {string} [description]
6
- * @param {Array<{ text: string, onClick: string }>} [buttons]
7
- * @param {string} [icon="⚠️"] -
8
- * @returns {HTMLElement}
9
- */
10
- export function _showPopup(title: string, description?: string, buttons?: Array<{
11
- text: string;
12
- onClick: string;
13
- }>, icon?: string): HTMLElement;
14
- /**
15
- * Injects Manrope font via Google Fonts and applies it to all elements with
16
- * classes starting with "pinglet-".
17
- *
18
- * @returns {void}
19
- */
20
- export function injectFont(): void;
21
- /** @type {TemplateStyleConfig} */
22
- export const defaultStyles: TemplateStyleConfig;
23
- /** @type {ProjectConfig} */
24
- export const defaultConfig: ProjectConfig;
25
- /**
26
- * ('./types/project.config.js).ProjectConfig
27
- */
28
- type _import = any;
29
- export { _import as import };
30
- export type ShowPopup = Object;
@@ -1,103 +0,0 @@
1
- declare function re(n: any): string;
2
- declare namespace ue {
3
- export { ce as load };
4
- export { oe as hashComponents };
5
- export { re as componentsToDebugString };
6
- }
7
- declare function M(): any;
8
- declare function z(): () => any;
9
- declare function oe(e: any): string;
10
- declare function G(): boolean;
11
- declare function S(): boolean;
12
- declare function F(): boolean;
13
- declare function C(): boolean;
14
- declare function Y(): boolean;
15
- declare function W(): boolean;
16
- declare function x(): boolean;
17
- declare function ce(e: any): any;
18
- declare function V(e: any, r: any, o: any): () => any;
19
- declare function le(e: any, n: any): string;
20
- declare function ae(e: any): Promise<any>;
21
- declare namespace ne {
22
- function fonts(): any;
23
- function domBlockers(e: any): any;
24
- function fontPreferences(): any;
25
- function audio(): -2 | -1 | (() => any);
26
- function screenFrame(): () => any;
27
- function osCpu(): any;
28
- function languages(): any[];
29
- function colorDepth(): number;
30
- function deviceMemory(): any;
31
- function screenResolution(): any[];
32
- function hardwareConcurrency(): any;
33
- function timezone(): string;
34
- function sessionStorage(): boolean;
35
- function localStorage(): boolean;
36
- function indexedDB(): true | undefined;
37
- function openDatabase(): boolean;
38
- function cpuClass(): any;
39
- function platform(): string;
40
- function plugins(): {
41
- name: string;
42
- description: string;
43
- mimeTypes: {
44
- type: string;
45
- suffixes: string;
46
- }[];
47
- }[] | undefined;
48
- function canvas(): {
49
- winding: boolean;
50
- geometry: any;
51
- text: any;
52
- };
53
- function touchSupport(): {
54
- maxTouchPoints: number;
55
- touchEvent: boolean;
56
- touchStart: boolean;
57
- };
58
- function vendor(): string;
59
- function vendorFlavors(): string[];
60
- function cookiesEnabled(): boolean;
61
- function colorGamut(): string | undefined;
62
- function invertedColors(): boolean | undefined;
63
- function forcedColors(): boolean | undefined;
64
- function monochrome(): number | undefined;
65
- function contrast(): 0 | 1 | 10 | -1 | undefined;
66
- function reducedMotion(): boolean | undefined;
67
- function hdr(): boolean | undefined;
68
- function math(): {
69
- acos: number;
70
- acosh: number;
71
- acoshPf: number;
72
- asin: number;
73
- asinh: number;
74
- asinhPf: number;
75
- atanh: number;
76
- atanhPf: number;
77
- atan: number;
78
- sin: number;
79
- sinh: number;
80
- sinhPf: number;
81
- cos: number;
82
- cosh: number;
83
- coshPf: number;
84
- tan: number;
85
- tanh: number;
86
- tanhPf: number;
87
- exp: number;
88
- expm1: number;
89
- expm1Pf: number;
90
- log1p: number;
91
- log1pPf: number;
92
- powPI: number;
93
- };
94
- function videoCard(): {
95
- vendor: any;
96
- renderer: any;
97
- } | undefined;
98
- function pdfViewerEnabled(): boolean;
99
- function architecture(): number;
100
- }
101
- declare function Z(e: any, n: any): (n: any) => any;
102
- declare function X(e: any, r: any, a: any): any;
103
- export { re as componentsToDebugString, ue as default, M as getFullscreenElement, z as getScreenFrame, oe as hashComponents, G as isAndroid, S as isChromium, F as isDesktopSafari, C as isEdgeHTML, Y as isGecko, W as isTrident, x as isWebKit, ce as load, V as loadSources, le as murmurX64Hash128, ae as prepareForSources, ne as sources, Z as transformSource, X as withIframe };
@@ -1,11 +0,0 @@
1
- /**
2
- * Fetches all templates for a given project from the specified endpoint.
3
- *
4
- * @param {string} endpoint - The API endpoint URL.
5
- * @param {string} projectId - The unique identifier for the project.
6
- * @param {string} pingletId - The signature associated with the Pinglet instance.
7
- * @param {string} checksum - The checksum for request validation.
8
- * @param {string} version - The version of the Pinglet API being used.
9
- * @returns {Promise<Object|null>} - A promise that resolves to the templates result if successful, or null if unsuccessful.
10
- */
11
- export function loadAllTemplates(endpoint: string, projectId: string, pingletId: string, checksum: string, version: string): Promise<Object | null>;
@@ -1,5 +0,0 @@
1
- /**
2
- * ('./types/index.js').NotificationData
3
- */
4
- type _import = any;
5
- export { _import as import };
@@ -1 +0,0 @@
1
- (function(){"use strict";function _showPopup(title,description,buttons=[{text:"See Docs",onClick:()=>window.open("https://pinglet.enjoys.in/docs","_blank")}],icon="⚠️"){const containerId="toastContainer";let container=document.getElementById(containerId);container||(container=document.createElement("div"),container.id=containerId,Object.assign(container.style,{position:"fixed",bottom:"24px",right:"24px",zIndex:"9999",display:"flex",flexDirection:"column",gap:"4px",alignItems:"flex-end",fontFamily:"Manrope, sans-serif"}),document.body.appendChild(container));const toast=document.createElement("div");Object.assign(toast.style,{background:"#1f1f1f",color:"#fff",padding:"16px 20px",borderRadius:"12px",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.25)",fontFamily:"'Inter', sans-serif",minWidth:"260px",maxWidth:"340px",opacity:"0",transform:"translateX(100%)",transition:"opacity 0.3s ease, transform 0.3s ease",display:"flex",flexDirection:"column",gap:"10px",fontFamily:"Manrope, sans-serif"});const iconTitleRow=document.createElement("div");Object.assign(iconTitleRow.style,{display:"flex",alignItems:"center",gap:"10px",fontSize:"16px",fontWeight:"600",fontFamily:"Manrope, sans-serif"});const iconEl=document.createElement("div");iconEl.textContent=icon;const titleEl=document.createElement("div");if(titleEl.textContent=title,iconTitleRow.appendChild(iconEl),iconTitleRow.appendChild(titleEl),toast.appendChild(iconTitleRow),description){const t=document.createElement("div");t.textContent=description,Object.assign(t.style,{fontSize:"13.5px",fontWeight:"400",color:"#ddd",lineHeight:"1.5"}),toast.appendChild(t)}if(Array.isArray(buttons)&&buttons.length){const btnRow=document.createElement("div");Object.assign(btnRow.style,{marginTop:"8px",display:"flex",gap:"10px",justifyContent:"flex-start"});for(const btn of buttons){const btnEl=document.createElement("button");if(btnEl.textContent=btn.text||"Click Here",Object.assign(btnEl.style,{padding:"8px 14px",background:"#333",color:"#fff",border:"1px solid #444",borderRadius:"6px",fontSize:"13px",cursor:"pointer",transition:"background 0.3s",fontFamily:"Manrope, sans-serif"}),btnEl.onmouseover=()=>btnEl.style.background="#444",btnEl.onmouseout=()=>btnEl.style.background="#333","function"==typeof btn.onClick)btnEl.addEventListener("click",btn.onClick);else if("string"==typeof btn.onClick&&btn.onClick.trim())try{if(btn.onClick.trim().startsWith("() =>")){const fn=eval(btn.onClick);"function"==typeof fn&&btnEl.addEventListener("click",fn)}else{const t=new Function(btn.onClick);btnEl.addEventListener("click",t)}}catch(t){}btnRow.appendChild(btnEl)}toast.appendChild(btnRow)}container.appendChild(toast);const footer=document.createElement("div");return footer.innerHTML='Notifications by <a href="https://pinglet.enjoys.in" target="_blank" style="color:#4da6ff;text-decoration:none;">Pinglet</a> - Enjoys',Object.assign(footer.style,{fontSize:"11px",color:"#999",marginTop:"4px",textAlign:"right",fontFamily:"Manrope, sans-serif"}),container.appendChild(footer),requestAnimationFrame((()=>{toast.style.opacity="1",toast.style.transform="translateX(0)"})),setTimeout((()=>{toast.style.opacity="0",toast.style.transform="translateX(100%)",setTimeout((()=>{toast.remove(),footer.remove()}),500)}),5e3),container}function injectFont(){const t=document.createElement("link");t.rel="stylesheet",t.href="https://fonts.googleapis.com/css2?family=Manrope:wght@200..800&display=swap",document.head.appendChild(t);const e=document.createElement("style");e.innerHTML='\n [class^="pinglet-"],\n [class*=" pinglet-"] {\n font-family: \'Manrope\', sans-serif !important;\n font-weight: 400 !important;\n }\n ',document.head.appendChild(e)}const defaultStyles={duration:3e3,btn1:{color:"#ffffff",backgroundColor:"#007bff",padding:"6px 10px",borderRadius:"6px",fontSize:"14px",fontWeight:"600",border:"none",boxShadow:"0 2px 6px rgba(0,0,0,0.15)"},btn2:{color:"#333333",backgroundColor:"#f0f0f0",padding:"6px 10px",borderRadius:"6px",fontSize:"14px",fontWeight:"600",border:"1px solid #ccc"},title:{color:"#111111",fontSize:"14px",fontWeight:"500",lineHeight:"1.4",margin:"0 0 0 0",textAlign:"left"},description:{color:"#444444",fontSize:"13px",fontWeight:"400",lineHeight:"1.5",margin:"0 0 10px 0",textAlign:"left"},controls:{video:{autoplay:!1,muted:!1,loop:!1,controls:!1},audio:{autoplay:!1,muted:!1,loop:!1,controls:!1}},media:{image:{width:"100%",height:"200px",borderRadius:"6px",objectFit:"cover",margin:"0 0 8px 0"},icon:{width:"24px",height:"24px",margin:"0 8px 0 0",objectFit:"contain"},logo:{width:"50px",height:"50px",margin:"0 8px 0 0",objectFit:"contain"},video:{width:"100%",height:"140px",borderRadius:"6px",objectFit:"cover",margin:"0 0 10px 0"},iframe:{width:"100%",height:"140px",borderRadius:"6px",objectFit:"cover",margin:"0 0 10px 0"},audio:{width:"100%",margin:"8px 0"}}},defaultConfig={position:"bottom-left",transition:"fade",branding:{show:!0,html:'Notifications by <a href="https://pinglet.enjoys.in" style="color:#4da6ff;text-decoration:none;" target="_blank">Pinglet</a> - Enjoys'},sound:{play:!1,src:"https://pinglet.enjoys.in/api/v1/pinglet-sound.mp3?v=1&ext=mp3",volume:.6},duration:2e3,maxVisible:3,stacking:!0,auto_dismiss:!0,dismissible:!0,website:"https://pinglet.enjoys.in",time:!0,favicon:!0,pauseOnHover:!0,theme:{mode:"light",customClass:"",rounded:!0,shadow:!0,border:!1},iconDefaults:{show:!0,size:20,position:"left"},progressBar:{show:!0,color:"#4da6ff",height:3}};let soundPlayer,toastContainer,toastStack=null,brandingElement=null;function initWidget(t){if(soundPlayer)return soundPlayer;t.sound?.play&&t.sound.src&&(soundPlayer=new Audio(t.sound.src),soundPlayer.volume=t.sound.volume??.5)}function createBrandingElement(t){return brandingElement||(brandingElement=document.createElement("div"),brandingElement.className="pinglet-branding",brandingElement.innerHTML=t?.html||'Notifications by <a href="https://pinglet.enjoys.in" class="pinglet-link" target="_blank" style="color:#4da6ff;text-decoration:none;">Pinglet</a>',brandingElement.style="\n font-size: 11px;\n color: #999;\n text-align: center;\n width: 100%;\n pointer-events: auto;\n ",brandingElement)}function createPingletToastContainer(t){if(toastContainer&&toastStack)return{toastContainer:toastContainer,toastStack:toastStack};const e=document.getElementById("pinglet-widget-container");return e?(toastContainer=e,toastStack=toastContainer.querySelector(".pinglet-widget-stack"),{toastContainer:toastContainer,toastStack:toastStack}):(toastContainer=document.createElement("div"),toastContainer.id="pinglet-widget-container",toastContainer.style.position="fixed",toastContainer.style.bottom="20px",toastContainer.style.left="20px",toastContainer.style.zIndex="9999",toastContainer.style.display="flex",toastContainer.style.flexDirection="column",toastContainer.style.alignItems="flex-start",toastContainer.style.gap="8px",toastContainer.style.maxWidth="360px",toastContainer.style.width="calc(100vw - 40px)",toastContainer.style.boxSizing="border-box",toastContainer.style.pointerEvents="none",toastContainer.style.padding="4px",toastContainer.style.borderRadius="8px",toastStack=document.createElement("div"),toastStack.className="pinglet-widget-stack",toastStack.style.display="flex",toastStack.style.flexDirection="column",toastStack.style.gap="12px",toastStack.style.pointerEvents="none",toastStack.style.overflow="visible",toastStack.style.flexShrink="0",toastContainer.appendChild(toastStack),t?.show&&toastContainer.appendChild(createBrandingElement(t)),document.body.appendChild(toastContainer),{toastContainer:toastContainer,toastStack:toastStack})}function renderToast(t,e){const n=e.config,{toastContainer:o,toastStack:i}=createPingletToastContainer(n.branding);o.appendChild(brandingElement),applyTransition(t,n.transition),t.style.pointerEvents="auto",i.appendChild(t),n.sound?.play&&soundPlayer&&soundPlayer.play(),n?.auto_dismiss&&setTimeout((()=>{removeToast(t,n?.transition||"fade")}),n.duration||3e3)}function applyTransition(t,e){t.style.opacity="0",t.style.transition="all 0.4s ease","fade"===e?(t.style.transform="translateX(20px)",requestAnimationFrame((()=>{t.style.opacity="1",t.style.transform="translateX(0)"}))):"slide"===e?(t.style.transform="translateX(100%)",requestAnimationFrame((()=>{t.style.opacity="1",t.style.transform="translateX(0)"}))):"zoom"===e?(t.style.transform="scale(0.8)",requestAnimationFrame((()=>{t.style.opacity="1",t.style.transform="scale(1)"}))):t.style.opacity="1"}function removeToast(t,e){t&&(t.style.transition="all 0.4s ease",brandingElement.style.transition="all 0.4s ease",brandingElement.style.transform="translateX(-40px)","fade"===e?(t.style.opacity="0",t.style.transform="translateX(-40px)"):"slide"===e?(t.style.transform="translateX(-100%)",t.style.opacity="0"):"zoom"===e?(t.style.transform="scale(0.8)",t.style.opacity="0"):t.style.opacity="0",t.addEventListener("transitionend",(()=>{t.remove(),toastStack&&0===toastStack.children.length&&brandingElement?.remove()}),{once:!0}))}function createNotificationHeader(t=defaultConfig,e=window.location.hostname,n="just now"){const o=document.createElement("div");o.className="pinglet-row",Object.assign(o.style,{display:"flex",justifyContent:"space-between",alignItems:"center",background:"#fff",fontFamily:"system-ui, sans-serif",fontSize:"10px"});const i=document.createElement("div");i.className="pinglet-left",Object.assign(i.style,{display:"flex",alignItems:"center",gap:"6px",flexGrow:"1"});const s=document.createElement("div");s.className="pinglet-icon",Object.assign(s.style,{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:"#007bff",flexShrink:"0"});const a=document.createElement("span");a.className="pinglet-domain",a.textContent=e,a.style.color="#333";const l=document.createElement("span");l.className="pinglet-time",l.textContent=`- ${n}`,l.style.color="#666";const r=document.createElement("button");return r.className="pinglet-close",r.textContent="✕",Object.assign(r.style,{background:"none",border:"none",fontSize:"12px",cursor:"pointer",color:"#888"}),r.addEventListener("mouseenter",(()=>{r.style.color="#e00"})),r.addEventListener("mouseleave",(()=>{r.style.color="#888"})),t?.website&&i.appendChild(a),t?.time&&i.appendChild(l),t?.favicon&&i.appendChild(s),o.appendChild(i),t?.dismissible&&o.appendChild(r),r.onclick=()=>{r.parentElement.parentElement.remove(),toastStack&&0===toastStack.children.length&&brandingElement?.remove()},o}function createVariant(t,e){const n=e.style,o=e.config,i=document.createElement("div");if(i.className=`pinglet-variant pinglet-${t.variant||"default"}`,i.style.display="flex",i.style.flexDirection="column",i.style.alignItems="stretch",i.style.width="100%",i.style.maxHeight="calc(100vh - 40px)",i.style.borderRadius="8px",i.style.overflowY="auto",i.style.boxShadow="0 2px 8px rgba(0, 0, 0, 0.1)",i.style.padding="4px",i.style.backgroundColor="rgba(255, 255, 255, 0.9)",i.style.gap="4px",i.style.pointerEvents="none",i.style.overflow="visible",i.style.flexShrink="0",i.appendChild(createNotificationHeader(o)),t.media?.type){const e=createMediaElement(t.media,n.media,n.controls);e&&i.appendChild(e)}if(t.title){const e=document.createElement("div");e.className="pinglet-title",e.innerText=t.title,Object.assign(e.style,n.title||defaultStyles.title),i.appendChild(e)}if(t.description){const e=document.createElement("p");e.className="pinglet-desc",e.innerText=t.description,Object.assign(e.style,n.description||defaultStyles.description),i.appendChild(e)}if(t.buttons){const e=document.createElement("div");e.className="pinglet-buttons",e.style.fontFamily="Manrope",t.buttons.forEach(((t,o)=>{const i=document.createElement("button");i.innerText=t.text,i.className="pinglet-btn",i.style.cursor="pointer",i.style.padding="6px 10px",i.style.fontFamily="Manrope, sans-serif",i.style.margin="1px 4px",Object.assign(i.style,0===o?n.btn1:n.btn2),i.onclick=new Function(t.onClick),e.appendChild(i)})),i.appendChild(e)}return i}function createMediaElement(t,e,n){switch(t.type){case"logo":{const n=document.createElement("img");return n.src=t.src,Object.assign(n.style,e?.logo||defaultStyles.media.logo),n}case"image":{const n=document.createElement("img");return n.src=t.src,Object.assign(n.style,e?.image||defaultStyles.media.image),n}case"video":{const o=document.createElement("video");return o.src=t.src,o.autoplay=n?.video?.autoplay||defaultStyles.controls.video.autoplay||!1,o.muted=n?.video?.muted||defaultStyles.controls.video.muted||!1,o.loop=n?.video?.loop||defaultStyles.controls.video.loop||!1,o.controls=n?.video?.controls||defaultStyles.controls.video.controls||!1,o.style=e?.video||defaultStyles.media.video,Object.assign(o.style,e?.video||defaultStyles.media.video),o}case"audio":{const e=document.createElement("audio");return e.src=t.src,e.autoplay=n?.audio?.controls||defaultStyles.controls?.audio.autoplay||!1,e.muted=n?.audio?.muted||defaultStyles.controls?.audio.muted||!1,e.loop=n?.audio?.loop||defaultStyles.controls?.audio?.loop||!1,e.controls=n?.audio?.controls||defaultStyles.controls?.audio?.controls||!1,Object.assign(e.style,e?.video||defaultStyles.media.audio),e}case"icon":{const t=document.createElement("span");return t.className="pinglet-icon",t.style={width:"40px",height:"40px",backgroundPosition:"center",borderRadius:"8px"},t}default:return null}}async function loadAllTemplates(t,e,n,o,i){const s=await fetch(`${t}/load/templates?projectId=${e}`,{headers:{"X-Project-ID":e,"X-Timestamp":Date.now(),"X-Pinglet-Signature":n,"X-Pinglet-Checksum":o,"X-Pinglet-Version":i},credentials:"omit"}),a=await s.json();return a&&a.success?a.result:null}const publicVapidKey="BJ9GvEJAs47DOgqw-rN80ZGIVvIvcp-xE4ZNweCT4eJ0B-rIzMtfhLWh8ySUCeKgiW_Fym69h0Fx3vhAcAy6C2k";async function subscribeUser(t,e){try{const n=await navigator.serviceWorker.register(t+"/sw.js");if(await n.pushManager.getSubscription())return;const o=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:urlBase64ToUint8Array(publicVapidKey)}),i=await fetch(`${t}/subscribe?projectId=${e}`,{method:"POST",body:JSON.stringify(o),headers:{"Content-Type":"application/json"},credentials:"omit"}),s=await i.json();if(s.success)return localStorage.getItem("subscription")?void 0:(localStorage.setItem("subscription","true"),_showPopup("Notifications Enabled","You can now receive notifications from this site.",[{text:"See Demo",onClick:"() => DemoNotification()"}],"🎉"));_showPopup("Something Went Wrong",s.message,[],"❌")}catch(t){}}function urlBase64ToUint8Array(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(e);return Uint8Array.from([...n].map((t=>t.charCodeAt(0))))}function createNotificationPermissionDialog(t={}){const{title:e="Stay updated with notifications",description:n="Get notified about important updates, new features, and exclusive content. We'll only send you valuable notifications.",site:o=window.location.hostname,onAllow:i=()=>{},onDeny:s=()=>{}}=t,a=document.createElement("div");a.className="notification-dialog",Object.assign(a.style,{position:"fixed",bottom:"24px",right:"24px",width:"380px",background:"#fff",borderRadius:"16px",boxShadow:"0 20px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255,255,255,0.1)",zIndex:"1000",overflow:"hidden",transform:"translateX(420px)",animation:"slideIn 0.6s ease-out 1s forwards",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"});const l=document.createElement("style");l.textContent="\n @keyframes slideIn { to { transform: translateX(0); } }\n @keyframes pulse {\n 0%, 100% { box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); }\n 50% { box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5); }\n }\n @media (max-width: 480px) {\n .notification-dialog {\n width: calc(100vw - 32px) !important;\n right: 16px !important;\n bottom: 16px !important;\n transform: translateY(420px) !important;\n }\n @keyframes slideIn { to { transform: translateY(0); } }\n }\n ",document.head.appendChild(l);const r=document.createElement("div");r.style.display="flex",r.style.justifyContent="space-between",r.style.padding="20px 20px 0 20px";const c=document.createElement("div");c.style.display="flex",c.style.alignItems="center",c.style.gap="8px",c.style.color="#6b7280",c.style.fontSize="14px",c.style.fontWeight="500";const d=document.createElement("div");d.style.width="16px",d.style.height="16px",d.style.borderRadius="4px",d.style.background="linear-gradient(135deg, #667eea 0%, #764ba2 100%)",d.style.display="flex",d.style.alignItems="center",d.style.justifyContent="center",d.innerHTML='<svg viewBox="0 0 16 16" fill="white" width="10" height="10"><path d="M8 0C3.58 0 0 3.58 0 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8z"/></svg>';const p=document.createElement("span");p.textContent=o,c.append(d,p);const m=document.createElement("button");m.innerHTML='<svg viewBox="0 0 16 16" fill="currentColor" width="12" height="12">\n <path d="M12.854 4.854a.5.5 0 0 0-.708-.708L8 8.293 3.854 4.146a.5.5 0 1 0-.708.708L7.293 9l-4.147 4.146a.5.5 0 0 0 .708.708L8 9.707l4.146 4.147a.5.5 0 0 0 .708-.708L8.707 9l4.147-4.146z"/>\n </svg>',Object.assign(m.style,{width:"24px",height:"24px",background:"#f3f4f6",border:"none",borderRadius:"6px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280"}),m.onclick=()=>a.remove(),r.append(c,m);const u=document.createElement("div");u.style.padding="16px 24px 24px 24px";const y=document.createElement("div");y.style.width="48px",y.style.height="48px",y.style.borderRadius="12px",y.style.marginBottom="16px",y.style.animation="pulse 2s infinite",y.style.background="linear-gradient(135deg, #667eea 0%, #764ba2 100%)",y.style.display="flex",y.style.alignItems="center",y.style.justifyContent="center",y.innerHTML='<svg viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" width="24" height="24">\n <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/>\n </svg>';const g=document.createElement("h3");g.textContent=e,Object.assign(g.style,{fontSize:"18px",fontWeight:"600",color:"#111827",marginBottom:"8px"});const f=document.createElement("p");f.textContent=n,Object.assign(f.style,{fontSize:"14px",color:"#6b7280",lineHeight:"1.5",marginBottom:"20px"});const x=document.createElement("div");x.style.display="flex",x.style.gap="8px";const h=document.createElement("button");h.textContent="Not now",Object.assign(h.style,{flex:1,padding:"10px 16px",borderRadius:"8px",fontSize:"14px",fontWeight:"500",border:"1px solid #e5e7eb",background:"#f9fafb",color:"#6b7280",cursor:"pointer"}),h.onclick=()=>{s(),a.remove()};const b=document.createElement("button");b.textContent="Allow notifications",Object.assign(b.style,{flex:1,padding:"10px 16px",borderRadius:"8px",fontSize:"14px",fontWeight:"500",border:"none",background:"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",color:"#fff",boxShadow:"0 2px 8px rgba(102, 126, 234, 0.3)",cursor:"pointer"}),b.onclick=()=>{i(),a.remove()},x.append(h,b);const w=document.createElement("div");w.style.marginTop="12px",w.style.display="flex",w.style.alignItems="center",w.style.justifyContent="center",w.style.gap="6px",w.style.color="#9ca3af",w.style.fontSize="12px",w.innerHTML='<svg viewBox="0 0 16 16" fill="currentColor" width="12" height="12"><path d="M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0z"/></svg><span>Secure & private • Unsubscribe anytime</span>',u.append(y,g,f,x,w),a.append(r,u),document.body.appendChild(a)}function askNotificationPermissionFunction(t,e){"Notification"in window?"granted"===Notification.permission||createNotificationPermissionDialog({site:window.location.hostname,onAllow:()=>{Notification.requestPermission().then((async n=>"granted"===n?subscribeUser(t,e):_showPopup("Permission Denied","You blocked notifications!",[],"😭"))).catch((t=>_showPopup("Permission Error","Error requesting notification permission:",[],"😭")))},onDeny:()=>_showPopup("Permission Denied","You blocked notifications!",[],"❌")}):_showPopup("Unsupported Browser","Notifications not supported.",[],"🚫")}function TriggerBrowserNotificationApi(t,e,n){return new Notification(t,{badge:"🎉",body:e,actions:[{action:"pinglet",title:"Pinglet"}],icon:n,dir:"rtl",lang:"en",silent:!1,tag:"pinglet",vibrate:[100,50,100],requireInteraction:!0}).onclick=()=>{}}function ShowTestimonials(){const t=document.getElementById("pinglet-testimonials");if(t)return t;const e=document.createElement("div");e.className="pinglet-floating-btn",e.style.position="fixed",e.style.bottom="30px",e.style.right="30px",e.style.display="flex",e.style.alignItems="center",e.style.background="#667EEA",e.style.borderRadius="50px",e.style.padding="0",e.style.cursor="pointer",e.style.boxShadow="0 4px 14px 0 rgba(102, 126, 234, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05)",e.style.transition="all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",e.style.overflow="hidden",e.style.width="24px",e.style.height="24px",e.style.zIndex="1000",e.style.backdropFilter="blur(10px)",e.style.border="1px solid rgba(255, 255, 255, 0.1)";const n=document.createElement("div");n.textContent="❔",n.className="icon",n.style.fontSize="20px",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center",n.style.transition="all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",n.style.width="24px",n.style.height="24px",n.style.flexShrink="0",n.style.color="white";const o=document.createElement("span");o.textContent="View",o.className="label",o.style.color="white",o.style.fontWeight="500",o.style.fontSize="14px",o.style.marginLeft="8px",o.style.marginRight="16px",o.style.opacity="0",o.style.transform="translateX(-8px)",o.style.transition="all 0.3s cubic-bezier(0.4, 0, 0.2, 1)",o.style.whiteSpace="nowrap",o.style.letterSpacing="0.025em",e.appendChild(n),e.appendChild(o),document.body.appendChild(e),e.addEventListener("mouseenter",(()=>{e.style.width="100px",e.style.borderRadius="28px",e.style.boxShadow="0 8px 25px 0 rgba(102, 126, 234, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1)",e.style.transform="translateY(-2px)",o.style.opacity="1",o.style.transform="translateX(0)",n.style.transform="scale(1.05)"})),e.addEventListener("mouseleave",(()=>{e.style.width="40px",e.style.height="40px",e.style.borderRadius="50px",e.style.boxShadow="0 4px 14px 0 rgba(102, 126, 234, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05)",e.style.transform="translateY(0)",o.style.opacity="0",o.style.transform="translateX(-8px)",n.style.transform="scale(1)"})),e.addEventListener("mousedown",(()=>{e.style.transform="translateY(0) scale(0.98)",e.style.boxShadow="0 2px 8px 0 rgba(102, 126, 234, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.05)"})),e.addEventListener("mouseup",(()=>{e.style.transform="translateY(-2px)",e.style.boxShadow="0 8px 25px 0 rgba(102, 126, 234, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1)"})),o.addEventListener("click",(()=>{_showPopup("Testimonials Error","There was an error loading testimonials. Please try again later. If the issue persists, please contact support.",[],"❌")}));const i=()=>{window.innerWidth<=768?(e.style.bottom="16px",e.style.right="16px",e.style.width="48px",e.style.height="48px",n.style.width="48px",n.style.height="48px",n.style.fontSize="18px",o.style.fontSize="13px",o.style.marginLeft="6px",o.style.marginRight="12px"):(e.style.bottom="30px",e.style.right="30px",e.style.width="40px",e.style.height="40px",n.style.width="40px",n.style.height="40px",n.style.fontSize="20px",o.style.fontSize="14px",o.style.marginLeft="8px",o.style.marginRight="16px")};i(),window.addEventListener("resize",i)}const scriptEl=Array.from(document.scripts).find((t=>t.src.includes("pinglet-sse")&&t.dataset.endpoint)),currentScript=scriptEl||document.currentScript,endpoint=currentScript?.dataset.endpoint,configuredDomain=currentScript?.dataset.configuredDomain,projectId=currentScript?.dataset.projectId,pingletId=currentScript?.dataset.pingletId,loadTemplates=currentScript?.dataset.loadTemplates,checksum=currentScript?.dataset.checksum,testimonials=currentScript?.dataset.testimonials;(async t=>{if(t.PingletWidget)return void console.warn("PingletWidget is already initialized.");injectFont(),askNotificationPermissionFunction(endpoint,projectId),testimonials&&ShowTestimonials();let e={};const n={version:"0.0.2",checksum:checksum.replace("sha384-",""),async init({endpoint:t,configuredDomain:n,projectId:o,pingletId:i}){if("0.0.2"!==this.version)return _showPopup("Unsupported Version",`PingletWidget version ${this.version} is not supported. Please update to the latest version.`,[{text:"See Docs",onClick:'window.open("https://pinglet.enjoys.in/docs", "_blank")'}],"⚠️"),void console.warn("Unsupported version detected.");if(!this.checksum||!checksum)return _showPopup("Configuration Error","Missing checksum.");const s=await fetch(`${t}/load/projects?projectId=${o}&domain=${n}`,{headers:{"X-Project-ID":o,"X-Timestamp":Date.now(),"X-Pinglet-Signature":i,"X-Pinglet-Checksum":this.checksum,"X-Pinglet-Version":this.version,"X-Configured-Domain":n,"X-Pinglet-Id":i},credentials:"omit"}),a=await s.json();if(!a||!a.success)return _showPopup("Configuration Error",`Failed to load configuration for PingletWidget. ${a.message||"Unknown error"}`,[{text:"Retry",onClick:"window.location.reload()"},{text:"See Docs",onClick:'window.open("https://pinglet.enjoys.in/docs", "_blank")'}],"❌"),console.error("Failed to load configuration for PingletWidget.");if("true"===loadTemplates){const n=await loadAllTemplates(t,o,i,this.checksum,this.version);n||_showPopup("Configuration Error","Failed to load templates for PingletWidget."),e=n}const l={is_tff:a.result?.is_premium??!1,templates:Object.assign({},{default:{compiled_text:_showPopup.toString(),config:defaultConfig,is_active:!0,is_default:!0}},"true"===loadTemplates?e:{[String(a.result.template?.id.toString())]:a.result.template}),style:Object.assign({},defaultStyles,a.result.template?.config),config:Object.assign({},defaultConfig,a.result.config)};initWidget(l);new EventSource(`${t}/sse?projectId=${o}&pingletId=${i}`,{withCredentials:!1}).onmessage=t=>{const e=JSON.parse(t.data),n=e.data;if(l?.is_tdd&&Object.assign(l.config,l.config,n?.overrides??{}),"1"===e?.type&&e?.template_id&&e?.data){return renderToast(interPolateTemplateWithData("",e?.data),l)}if("0"===e?.type&&e?.body){renderToast(createVariant(e.body,l),l)}else TriggerBrowserNotificationApi(body.title,body.description,body.type?.icon?.src||"")}}};t.PingletWidget=n,document.addEventListener("DOMContentLoaded",(()=>{n.init({endpoint:endpoint,configuredDomain:configuredDomain,projectId:projectId,pingletId:pingletId})})),console.log("%cPingletWidget initialized successfully.","color: #1e90ff; font-weight: bold;")})(window)})();
@@ -1,14 +0,0 @@
1
- /**
2
- * Create a notification permission dialog to ask users to allow notifications.
3
- * @param {{title: string, description: string, site: string, onAllow: () => void, onDeny: () => void}} options
4
- * @returns {HTMLDivElement} The dialog element.
5
- */
6
- export function createNotificationPermissionDialog(options?: {
7
- title: string;
8
- description: string;
9
- site: string;
10
- onAllow: () => void;
11
- onDeny: () => void;
12
- }): HTMLDivElement;
13
- export function askNotificationPermissionFunction(endpoint: any, projectId: any): void;
14
- export function TriggerBrowserNotificationApi(title: any, body: any, icon: any): () => void;
@@ -1,2 +0,0 @@
1
- export function revokePushSubscription(url: any, projectId: any): Promise<void>;
2
- export function subscribeUser(endpoint: any, projectId: any): Promise<HTMLElement | undefined>;
package/v0.0.2/sw.d.ts DELETED
File without changes
@@ -1,12 +0,0 @@
1
- /**
2
- * Renders a template with the given data.
3
- *
4
- * @param {string} template - The template with title, description, and media keys.
5
- * @param {object} [data={}] - The data to replace the placeholders in the template.
6
- * @returns {{title: string, description: string, media: object}} The rendered template.
7
- */
8
- export function renderTemplate(template: string, data?: object): {
9
- title: string;
10
- description: string;
11
- media: object;
12
- };
@@ -1 +0,0 @@
1
- export function ShowTestimonials(): HTMLElement | undefined;
@@ -1,55 +0,0 @@
1
- type MediaData = {
2
- type: MediaType;
3
- src: string;
4
- };
5
- type NotificationDataBody = {
6
- variant?: string | undefined;
7
- title: string;
8
- description?: string | undefined;
9
- media?: MediaData | undefined;
10
- buttons?: {
11
- text: string;
12
- action: string;
13
- }[] | undefined;
14
- actions?: {
15
- action: string;
16
- title: string;
17
- }[] | undefined;
18
- };
19
- type NotificationData = {
20
- project_id: string;
21
- template_id?: string | undefined;
22
- tag: string;
23
- /**
24
- * // -1, 0, 1 default is 0
25
- */
26
- type: 1 | 0 | -1;
27
- body?: NotificationDataBody | undefined;
28
- overrides?: Object | undefined;
29
- data?: Object | undefined;
30
- };
31
- type PingletWidget = {
32
- version: string;
33
- checksum: string;
34
- };
35
- type TemplateData = {
36
- compiled_text: string;
37
- config: TemplateStyleConfig;
38
- is_active: boolean;
39
- /**
40
- * /
41
- * /**
42
- */
43
- is_default: boolean;
44
- };
45
- type Templates = {
46
- "": {
47
- [x: string]: TemplateData;
48
- };
49
- };
50
- type GlobalConfig = {
51
- is_tff?: string | undefined;
52
- templates: Templates;
53
- style: TemplateStyleConfig;
54
- config: ProjectConfig;
55
- };
@@ -1,45 +0,0 @@
1
- type BrandingStyle = CommonStyle;
2
- type Branding = {
3
- show: boolean;
4
- html?: string | undefined;
5
- style?: CommonStyle | undefined;
6
- };
7
- type ProjectConfig = {
8
- position?: "bottom-left" | "top-right" | "top-left" | "bottom-right" | undefined;
9
- transition?: "fade" | "slide" | "zoom" | undefined;
10
- branding?: {
11
- show: boolean;
12
- html: string;
13
- } | undefined;
14
- sound?: {
15
- play: boolean;
16
- src: string;
17
- volume: number;
18
- } | undefined;
19
- duration?: number | undefined;
20
- auto_dismiss?: boolean | undefined;
21
- maxVisible?: number | undefined;
22
- stacking?: boolean | undefined;
23
- dismissible?: boolean | undefined;
24
- pauseOnHover?: boolean | undefined;
25
- website?: string | undefined;
26
- time?: boolean | undefined;
27
- favicon?: boolean | undefined;
28
- theme?: {
29
- mode?: "light" | "dark" | "auto";
30
- customClass?: string;
31
- rounded?: boolean;
32
- shadow?: boolean;
33
- border?: boolean;
34
- } | undefined;
35
- iconDefaults?: {
36
- show?: boolean;
37
- size?: number;
38
- position?: "left" | "right" | "top";
39
- } | undefined;
40
- progressBar?: {
41
- show?: boolean;
42
- color?: string;
43
- height?: number;
44
- } | undefined;
45
- };
@@ -1,63 +0,0 @@
1
- type MediaType = "image" | "video" | "audio" | "icon" | "logo" | "iframe";
2
- type CommonStyle = {
3
- color?: string | undefined;
4
- backgroundColor?: string | undefined;
5
- fontSize?: string | undefined;
6
- fontWeight?: string | undefined;
7
- borderRadius?: string | undefined;
8
- padding?: string | undefined;
9
- margin?: string | undefined;
10
- border?: string | undefined;
11
- boxShadow?: string | undefined;
12
- textAlign?: "center" | "right" | "left" | undefined;
13
- fontFamily?: string | undefined;
14
- lineHeight?: string | undefined;
15
- width?: string | number | undefined;
16
- height?: string | number | undefined;
17
- };
18
- type ButtonStyle = CommonStyle;
19
- type TextStyle = CommonStyle;
20
- type MediaStyle = {
21
- objectFit?: "cover" | "contain" | undefined;
22
- color?: string | undefined;
23
- backgroundColor?: string | undefined;
24
- fontSize?: string | undefined;
25
- fontWeight?: string | undefined;
26
- borderRadius?: string | undefined;
27
- padding?: string | undefined;
28
- margin?: string | undefined;
29
- border?: string | undefined;
30
- boxShadow?: string | undefined;
31
- textAlign?: "center" | "right" | "left" | undefined;
32
- fontFamily?: string | undefined;
33
- lineHeight?: string | undefined;
34
- width?: string | number | undefined;
35
- height?: string | number | undefined;
36
- };
37
- type MediaStyleMapStrict = {
38
- image?: MediaStyle | undefined;
39
- video?: MediaStyle | undefined;
40
- audio?: MediaStyle | undefined;
41
- icon?: MediaStyle | undefined;
42
- logo?: MediaStyle | undefined;
43
- iframe?: MediaStyle | undefined;
44
- };
45
- type MediaStyleMap = any;
46
- type MediaControls = {
47
- autoplay: boolean;
48
- muted: boolean;
49
- loop: boolean;
50
- controls: boolean;
51
- };
52
- type TemplateStyleConfig = {
53
- btn1?: CommonStyle | undefined;
54
- btn2?: CommonStyle | undefined;
55
- title?: CommonStyle | undefined;
56
- description?: CommonStyle | undefined;
57
- media?: any;
58
- duration?: number | undefined;
59
- controls?: {
60
- audio?: MediaControls;
61
- video?: MediaControls;
62
- } | undefined;
63
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * Create a notification variant.
3
- * @param {NotificationData} data - Notification data
4
- * @param {GlobalConfig} config - Global configuration
5
- * @returns {HTMLElement} - A notification wrapper element
6
- */
7
- export function createVariant(data: NotificationData, config: GlobalConfig): HTMLElement;
8
- /**
9
- * ('./types/project.config.js).ProjectConfig
10
- */
11
- type _import = any;
12
- export { _import as import };
@@ -1,22 +0,0 @@
1
- /**
2
- * Initialize the widget by creating a sound player if the sound config is
3
- * enabled and has a valid src.
4
- *
5
- * @param {GlobalConfig} globalConfig - Global config object passed to the widget.
6
- * @returns {Audio|undefined} The created sound player or undefined if the
7
- * sound config is disabled.
8
- */
9
- export function initWidget(globalConfig: GlobalConfig): (new (src?: string) => HTMLAudioElement) | undefined;
10
- /**
11
- * Renders a new toast notification with a given content element.
12
- * @param {HTMLElement} contentEl the content element of the toast notification
13
- * @param {GlobalConfig} globalConfig the global config object
14
- */
15
- export function renderToast(contentEl: HTMLElement, globalConfig: GlobalConfig): void;
16
- export let toastStack: null;
17
- export let brandingElement: null;
18
- /**
19
- * ('./types/index.js').GlobalConfig
20
- */
21
- type _import = any;
22
- export { _import as import };