import { WebPush } from '@teleporthq/teleport-shared' import { ACTIVATE_UPDATE_MESSAGE, INSTALL_BANNER_SNOOZE_DAYS, SERVICE_WORKER_COMPONENT_NAME, SERVICE_WORKER_PATH, VERSION_MESSAGE, } from './constants' import { PwaMessages } from './messages' import { toJsLiteral } from './source-literals' /** What the page-side runtime is told about the project. */ export interface ClientRuntimeConfig { mode: 'app' | 'notify' /** The version of the app this page was built for — the worker built with it reports the same. */ version: string appName: string shortName: string defaultLocale: string prefixedLocales: string[] /** The code Next.js also serves the default language under (`/en/checkout`). */ defaultLocalePrefix: string /** Manifest URL per locale (app mode). */ manifests: Record themeColor: string appleTouchIcon: string | null /** The icon beside the install banner's text. */ bannerIcon: string | null /** * What the iPhone and iPad launch screen shows (app mode): the background * colour, and the icon in its middle when the app has one. */ launchScreen: { backgroundColor: string; icon: string | null } | null installBanner: boolean /** Pages where no banner or update prompt may cover the content (see the worker). */ networkOnly: string[] push: { vapidPublicKey: string; subscriptionsPath: string } | null } /** * `components/teleport-service-worker.js`, rendered once from `_app`. * * - Registers `/sw.js` — in production only, never inside a frame (the editor * canvas and preview sandboxes), never on an insecure origin. * - App mode: the manifest link and home-screen tags on every page, the * "new version" prompt, the install banner, and the iPhone and iPad launch * screens. * - Publishes `window.__teleportServiceWorker` at module evaluation — before * any page renders — which is the only channel the serialized push and * notification workflow nodes have to the registration. * * Authored as source text (no backslash, no template literal) because this * module embeds it in one; the styles are one CSS string in a plain