PageSourceSearch

https://www.smallbizagent.ai/assets/capacitor-push-B1p_sRjn.js

js smallbizagent.ai collected 2026-10-05 15:05:17 UTC 2,415 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Bnq-59w3.js","assets/index-BLICdczl.js"])))=>i.map(i=>d[i]);
2import{as as l,H as c}from"./index-CLUtDhnY.js";import{C as n}from"./index-BLICdczl.js";import"./vendor-query-CnAhr2B8.js";import"./vendor-ui-CYA7SV0W.js";import"./vendor-charts-CPMWc2oJ.js";import"./vendor-forms-UY-il7MQ.js";const s="sba-push-token";async function m(r){if(n.isNativePlatform())try{const{PushNotifications:o}=await l(async()=>{const{PushNotifications:e}=await import("./index-Bnq-59w3.js");return{PushNotifications:e}},__vite__mapDeps([0,1]));if((await o.requestPermissions()).receive!=="granted"){console.log("[Push] Permission denied");return}await o.register(),o.addListener("registration",async e=>{console.log("[Push] Registered with token:",e.value.substring(0,20)+"...");try{const i=n.getPlatform();if(i!=="ios"&&i!=="android")return;await c("POST","/api/push/register",{token:e.value,platform:i,businessId:r});try{window.localStorage.setItem(s,e.value)}catch{}}catch(i){console.error("[Push] Failed to register token with server:",i)}}),o.addListener("registrationError",e=>{console.error("[Push] Registration error:",e)}),o.addListener("pushNotificationReceived",e=>{console.log("[Push] Foreground notification:",e.title)}),o.addListener("pushNotificationActionPerformed",e=>{const i=e.notification.data;if((i==null?void 0:i.type)==="appointment"&&(i!=null&&i.id))window.location.href=`/appointments/${i.id}`;else if((i==null?void 0:i.type)==="job"&&(i!=null&&i.id))window.location.href=`/jobs/${i.id}`;else if((i==null?void 0:i.type)==="call")window.location.href="/receptionist";else if((i==null?void 0:i.type)==="invoice"&&(i!=null&&i.id))window.location.href=`/invoices/${i.id}`;else if((i==null?void 0:i.type)==="quote"&&(i!=null&&i.id))window.location.href=`/quotes/${i.id}`;else if(i!=null&&i.url&&typeof i.url=="string")try{const t=new URL(i.url,window.location.origin);t.origin===window.location.origin&&(window.location.href=t.pathname+t.search)}catch{}})}catch(o){console.error("[Push] Init failed:",o)}}async function d(){if(!n.isNativePlatform())return;let r=null;try{r=window.localStorage.getItem(s)}catch{}if(r)try{await c("POST","/api/push/unregister",{token:r})}catch(o){console.error("[Push] Unregister failed:",o)}finally{try{window.localStorage.removeItem(s)}catch{}}}export{m as initPushNotifications,d as unregisterPushNotifications};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.