Files
maternal-app/maternal-web/public/sw.js
Andrei 846710d80c
Some checks failed
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
fix: Make network detection more lenient for reverse proxy environments
Changed network detection to only mark as offline on actual network errors,
not on HTTP errors like 404. This fixes the issue where the app shows
'You are offline' even when connected, which happens when accessing through
a reverse proxy where the /api/health endpoint might not be properly routed.

Now the app will show as online as long as it can reach the server
(any HTTP response), and only show offline on true connection failures.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-01 19:51:56 +00:00

2 lines
11 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
if(!self.define){let e,s={};const n=(n,a)=>(n=new URL(n+".js",a).href,s[n]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=s,document.head.appendChild(e)}else e=n,importScripts(n),s()}).then(()=>{let e=s[n];if(!e)throw new Error(`Module ${n} didnt register its module`);return e}));self.define=(a,i)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let c={};const o=e=>n(e,t),r={module:{uri:t},exports:c,require:o};s[t]=Promise.all(a.map(e=>r[e]||o(e))).then(e=>(i(...e),c))}}define(["./workbox-4d767a27"],function(e){"use strict";importScripts(),self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"/_next/app-build-manifest.json",revision:"d52d90009d4c805dc10641bc3a3bbfc7"},{url:"/_next/static/chunks/1444-260dc19907f6901d.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/1513-0b6bb7a8d88f55bf.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/1820-b94ad37655f7c90b.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/1960-c6df7e7041b0d04e.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/2168-be07f6965049cbaa.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/2204-230dd574464877e3.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/2215-ed57a7e4fab6c06f.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/2228-962b16dd28fbab2c.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/2351-9425d3d78ba615f9.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/3531-673f06878990b417.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/374-8cbaf99b80a57d75.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/3742-b099bdb6d87c5bf7.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/3978.18354d3d53eb75b8.js",revision:"18354d3d53eb75b8"},{url:"/_next/static/chunks/3983-92c7f914bcc5c824.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/4076-01437855a99bdebf.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/4335-a1e43d50cfab0521.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/4686-2c37bd67f95c5cf4.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/487-b335414bb4e15c4d.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/4919-f07fda8666d18e65.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/5010-608bd3998fba5c45.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/5011-4253696c14555a56.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/5527-f4c2418658bcc979.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/6062-9ec09f62d2f65481.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/7017-cc18fc1b6d50b019.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/7023-9cec68d276f434f3.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/7593-2f4683c559f10682.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/7595-f97cc7515473fb71.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/8046.e02453398fe6656f.js",revision:"e02453398fe6656f"},{url:"/_next/static/chunks/8334-af22988373f1dd97.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/8433-963eac3c158954c6.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/8485-a4408d198005887e.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/8533-ac1593b1d100b551.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/8884-1a93df8344101faf.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/9080-9b4b481b972d9c34.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/965-d97e42dd06741839.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/(auth)/forgot-password/page-8c309959586f4f12.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/(auth)/login/page-3e3a0a4b350bafbb.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/(auth)/onboarding/page-c10eba8dbec7b3ae.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/(auth)/register/page-75527dc8ab981e51.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/(auth)/reset-password/page-2dd47ec4982072e9.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/_not-found/page-05852e2a851b96a9.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/ai-assistant/page-2709415eabb1432e.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/analytics/page-a8ba946e42472719.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/children/page-182e6a15409e3f19.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/family/page-a42ddebdcdcf51b3.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/history/page-7bd00ae6f677e8fd.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/insights/page-98ac1ce18daa8c3a.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/layout-02f5d38e89de3e9d.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/logout/page-41d42e8a1118a3bb.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/page-c7d72f719106fd9f.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/settings/page-624fb59c876d2761.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/track/diaper/page-424ccbf9f26df0ea.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/track/feeding/page-1c8b75b6c519756f.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/track/page-ffc8a69b1970d83c.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/app/track/sleep/page-ce8d64acd7aba61d.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/fd9d1056-85b44074bf2aaf91.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/framework-8e0e0f4a6b83a956.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/main-aa97ecafabe03df4.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/main-app-c81eb15105e352f0.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/pages/_app-f870474a17b7f2fd.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/pages/_error-c66a4e8afc46f17b.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js",revision:"79330112775102f91e1010318bae2bd3"},{url:"/_next/static/chunks/webpack-f9cc98c0512e2cfe.js",revision:"pwl8G7n4Xax2oxKKRXQeH"},{url:"/_next/static/css/3c73bbe3401b74b1.css",revision:"3c73bbe3401b74b1"},{url:"/_next/static/media/19cfc7226ec3afaa-s.woff2",revision:"9dda5cfc9a46f256d0e131bb535e46f8"},{url:"/_next/static/media/21350d82a1f187e9-s.woff2",revision:"4e2553027f1d60eff32898367dd4d541"},{url:"/_next/static/media/8e9860b6e62d6359-s.woff2",revision:"01ba6c2a184b8cba08b0d57167664d75"},{url:"/_next/static/media/ba9851c3c22cd980-s.woff2",revision:"9e494903d6b0ffec1a1e14d34427d44d"},{url:"/_next/static/media/c5fe6dc8356a8c31-s.woff2",revision:"027a89e9ab733a145db70f09b8a18b42"},{url:"/_next/static/media/df0a9ae256c0569c-s.woff2",revision:"d54db44de5ccb18886ece2fda72bdfe0"},{url:"/_next/static/media/e4af272ccee01ff0-s.p.woff2",revision:"65850a373e258f1c897a2b3d75eb74de"},{url:"/_next/static/pwl8G7n4Xax2oxKKRXQeH/_buildManifest.js",revision:"3e2d62a10f4d6bf0b92e14aecf7836f4"},{url:"/_next/static/pwl8G7n4Xax2oxKKRXQeH/_ssgManifest.js",revision:"b6652df95db52feb4daf4eca35380933"},{url:"/icons/icon-128x128.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/icons/icon-144x144.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/icons/icon-152x152.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/icons/icon-192x192.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/icons/icon-384x384.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/icons/icon-512x512.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/icons/icon-72x72.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/icons/icon-96x96.png",revision:"d41d8cd98f00b204e9800998ecf8427e"},{url:"/manifest.json",revision:"5be5ec81beca107e804b38758d51abd5"},{url:"/next.svg",revision:"8e061864f388b47f33a1c3780831193e"},{url:"/vercel.svg",revision:"61c6b19abff40ea7acd577be818f3976"}],{ignoreURLParametersMatching:[]}),e.cleanupOutdatedCaches(),e.registerRoute("/",new e.NetworkFirst({cacheName:"start-url",plugins:[{cacheWillUpdate:async({request:e,response:s,event:n,state:a})=>s&&"opaqueredirect"===s.type?new Response(s.body,{status:200,statusText:"OK",headers:s.headers}):s}]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,new e.CacheFirst({cacheName:"google-fonts-webfonts",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:31536e3})]}),"GET"),e.registerRoute(/^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,new e.StaleWhileRevalidate({cacheName:"google-fonts-stylesheets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,new e.StaleWhileRevalidate({cacheName:"static-font-assets",plugins:[new e.ExpirationPlugin({maxEntries:4,maxAgeSeconds:604800})]}),"GET"),e.registerRoute(/\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,new e.StaleWhileRevalidate({cacheName:"static-image-assets",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/image\?url=.+$/i,new e.StaleWhileRevalidate({cacheName:"next-image",plugins:[new e.ExpirationPlugin({maxEntries:64,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp3|wav|ogg)$/i,new e.CacheFirst({cacheName:"static-audio-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:mp4)$/i,new e.CacheFirst({cacheName:"static-video-assets",plugins:[new e.RangeRequestsPlugin,new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:js)$/i,new e.StaleWhileRevalidate({cacheName:"static-js-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\.(?:css|less)$/i,new e.StaleWhileRevalidate({cacheName:"static-style-assets",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/_next\/data\/.+\/.+\.json$/i,new e.StaleWhileRevalidate({cacheName:"next-data",plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/\/api\/.*$/i,new e.NetworkFirst({cacheName:"apis",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:16,maxAgeSeconds:86400})]}),"GET"),e.registerRoute(/.*/i,new e.NetworkFirst({cacheName:"others",networkTimeoutSeconds:10,plugins:[new e.ExpirationPlugin({maxEntries:32,maxAgeSeconds:86400})]}),"GET")});