@aglyn/aglyn 1.23.1 → 1.25.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/package.json +11 -11
- package/src/lib/app-utils/activity-labels.js +4 -1
- package/src/lib/app-utils/activity-labels.js.map +1 -1
- package/src/lib/app-utils/activity-presenter.d.ts +11 -0
- package/src/lib/app-utils/activity-presenter.js +9 -0
- package/src/lib/app-utils/activity-presenter.js.map +1 -1
- package/src/lib/app-utils/activity-search.d.ts +1 -0
- package/src/lib/app-utils/activity-search.js +1 -0
- package/src/lib/app-utils/activity-search.js.map +1 -1
- package/src/lib/app-utils/agent-api-catalog.d.ts +18 -0
- package/src/lib/app-utils/agent-api-catalog.js +8 -1
- package/src/lib/app-utils/agent-api-catalog.js.map +1 -1
- package/src/lib/app-utils/binding-token-catalog.d.ts +15 -0
- package/src/lib/app-utils/binding-token-catalog.js +16 -0
- package/src/lib/app-utils/binding-token-catalog.js.map +1 -1
- package/src/lib/app-utils/business-details.d.ts +5 -0
- package/src/lib/app-utils/business-details.js +4 -0
- package/src/lib/app-utils/business-details.js.map +1 -1
- package/src/lib/app-utils/connector-discovery.d.ts +80 -0
- package/src/lib/app-utils/connector-discovery.js +107 -0
- package/src/lib/app-utils/connector-discovery.js.map +1 -0
- package/src/lib/app-utils/crm.d.ts +17 -30
- package/src/lib/app-utils/crm.js +139 -3
- package/src/lib/app-utils/crm.js.map +1 -1
- package/src/lib/app-utils/docs-help-sections.generated.js +5 -1
- package/src/lib/app-utils/docs-help-sections.generated.js.map +1 -1
- package/src/lib/app-utils/docs-help.generated.d.ts +5 -5
- package/src/lib/app-utils/docs-help.generated.js +12 -3
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +149 -9
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/entity-picker-context.d.ts +6 -0
- package/src/lib/app-utils/entity-picker-context.js.map +1 -1
- package/src/lib/app-utils/expand-repeatables.js +25 -2
- package/src/lib/app-utils/expand-repeatables.js.map +1 -1
- package/src/lib/app-utils/host-tokens.d.ts +17 -0
- package/src/lib/app-utils/host-tokens.js +18 -0
- package/src/lib/app-utils/host-tokens.js.map +1 -1
- package/src/lib/app-utils/native-app-association.d.ts +9 -5
- package/src/lib/app-utils/native-app-association.js +10 -5
- package/src/lib/app-utils/native-app-association.js.map +1 -1
- package/src/lib/app-utils/native-nav.js +1 -1
- package/src/lib/app-utils/native-nav.js.map +1 -1
- package/src/lib/app-utils/organizations.js +4 -2
- package/src/lib/app-utils/organizations.js.map +1 -1
- package/src/lib/app-utils/plan-entitlements.d.ts +227 -36
- package/src/lib/app-utils/plan-entitlements.js +335 -43
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/plugin-release-flags.generated.js +2 -2
- package/src/lib/app-utils/plugin-release-flags.generated.js.map +1 -1
- package/src/lib/app-utils/reusable-component-keys.d.ts +9 -0
- package/src/lib/app-utils/reusable-component-keys.js +9 -0
- package/src/lib/app-utils/reusable-component-keys.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +1 -0
- package/src/lib/app-utils/server.js +1 -0
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/app-utils/sign-in-visibility.d.ts +78 -0
- package/src/lib/app-utils/sign-in-visibility.js +79 -0
- package/src/lib/app-utils/sign-in-visibility.js.map +1 -0
- package/src/lib/app-utils/site-live-url.d.ts +4 -1
- package/src/lib/app-utils/site-live-url.js +17 -3
- package/src/lib/app-utils/site-live-url.js.map +1 -1
- package/src/lib/app-utils/usage-level.d.ts +50 -0
- package/src/lib/app-utils/usage-level.js +94 -0
- package/src/lib/app-utils/usage-level.js.map +1 -0
- package/src/lib/foundation/definitions/org-billing.types.d.ts +24 -2
- package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
- package/src/lib/plugin-manager/plugin-contact-capture.d.ts +2 -0
- package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
|
@@ -52,8 +52,10 @@
|
|
|
52
52
|
* auth session opens them for the app, and a universal link there would loop
|
|
53
53
|
* back into the app), the native hand-off and other `/auth` pages, the
|
|
54
54
|
* sign-out page, the site admin bar's connect page, a plugin's public
|
|
55
|
-
* device pages
|
|
56
|
-
* by someone with no account)
|
|
55
|
+
* device pages, a site's photo link (`/p/<linkId>`, opened on a phone
|
|
56
|
+
* by someone with no account) and the connector consent page
|
|
57
|
+
* (`/oauth/authorize`, AGL-4225), which an app such as Claude opens in the
|
|
58
|
+
* browser and expects to finish there. The sections the apps finish natively are
|
|
57
59
|
* {@link NATIVE_AUTH_LINK_SEGMENTS}.
|
|
58
60
|
*
|
|
59
61
|
* The rest of the console's top-level sections (`admin`, `billing`,
|
|
@@ -66,6 +68,7 @@
|
|
|
66
68
|
'auth',
|
|
67
69
|
'edit-access',
|
|
68
70
|
'kiosk',
|
|
71
|
+
'oauth',
|
|
69
72
|
'p',
|
|
70
73
|
'signin',
|
|
71
74
|
'signout',
|
|
@@ -74,9 +77,11 @@
|
|
|
74
77
|
/**
|
|
75
78
|
* The pre-sign-in sections whose exact page the apps finish natively: sign-up
|
|
76
79
|
* (with its `?plan=`), an emailed verification link, an emailed password
|
|
77
|
-
* reset and account recovery (`AuthFlow.swift
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
+
* reset and account recovery (`AuthFlow.swift`, `AuthFlow.kt`). Only the page
|
|
81
|
+
* itself opens the app; anything under it stays in the browser, where the
|
|
82
|
+
* console handles it. Android's App Link filter claims the same console paths
|
|
83
|
+
* as {@link consoleAppLinksComponents}, refusing each exclusion in its manifest
|
|
84
|
+
* (`native-app-association.spec.ts` holds the two together, AGL-4059).
|
|
80
85
|
*/ export const NATIVE_AUTH_LINK_SEGMENTS = [
|
|
81
86
|
'account-recovery',
|
|
82
87
|
'reset-password',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/native-app-association.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * THE DOCUMENTS THAT TIE THE NATIVE APPS TO A DOMAIN (AGL-3817).\n *\n * Apple's `apple-app-site-association` and Google's `assetlinks.json` are how\n * a domain says which apps may use its passkeys (`webcredentials`,\n * `get_login_creds`) and open its links (`applinks`, `handle_all_urls`). Both\n * are fetched by the platform's verifier, not by a person, so each has to be\n * exactly `application/json`, a 200, no redirect and no cookie.\n *\n * Everything that names an app comes from the environment, never from here:\n *\n * - `NATIVE_APPLE_APP_IDS`: comma-separated `<team id>.<bundle id>` values,\n * in the order the system should prefer them;\n * - `NATIVE_ANDROID_APPS`: `;`-separated `<package>=<sha256>,<sha256>`\n * entries, each fingerprint the colon-separated hex Play Console prints.\n *\n * Unset (or nothing valid in it), the document answers 404: a deployment\n * with no apps of its own vouches for none.\n *\n * A leaf with no imports, because both middlewares read the paths below.\n *=========================================*/\n\n/** Where Apple's verifier reads the association file: no `.json` suffix. */\nexport const APPLE_APP_SITE_ASSOCIATION_PATH = '/.well-known/apple-app-site-association'\n\n/** Where Google's verifier reads the statement list. */\nexport const ASSET_LINKS_PATH = '/.well-known/assetlinks.json'\n\n/**\n * The route handlers each middleware rewrites the two public paths to. They\n * live under `/api` because both apps keep their route handlers there, and\n * neither middleware runs again on `/api`.\n */\nexport const NATIVE_APP_ASSOCIATION_ROUTES: Readonly<Record<string, string>> = {\n [APPLE_APP_SITE_ASSOCIATION_PATH]: '/api/native-app-association/apple-app-site-association',\n [ASSET_LINKS_PATH]: '/api/native-app-association/assetlinks',\n}\n\n/** The route handler a public association path is served by, or null. */\nexport function nativeAppAssociationRoute(pathname: string): string | null {\n return Object.prototype.hasOwnProperty.call(NATIVE_APP_ASSOCIATION_ROUTES, pathname)\n ? NATIVE_APP_ASSOCIATION_ROUTES[pathname]\n : null\n}\n\n/**\n * The console's top-level sections the native apps have no screen for, so a\n * link to one stays in the browser: the sign-in page and SSO (the system\n * auth session opens them for the app, and a universal link there would loop\n * back into the app), the native hand-off and other `/auth` pages, the\n * sign-out page, the site admin bar's connect page, a plugin's public\n * device pages and a site's photo link (`/p/<linkId>`, opened on a phone\n * by someone with no account). The sections the apps finish natively are\n * {@link NATIVE_AUTH_LINK_SEGMENTS}.\n *\n * The rest of the console's top-level sections (`admin`, `billing`,\n * `manage`, `support`) and every workspace path are what the native\n * deep-link grammar resolves (`DeepLinks.swift`, `DeepLinks.kt`): a\n * registered screen, the Besigner in the app's own web view, or the nearest\n * native screen. `apps/console/specs/native-app-association.spec.ts` holds\n * this list to the console's route set and the native link specs.\n */\nexport const NATIVE_WEB_ONLY_TOP_LEVEL_SEGMENTS: readonly string[] = [\n 'auth',\n 'edit-access',\n 'kiosk',\n 'p',\n 'signin',\n 'signout',\n 'sso',\n]\n\n/**\n * The pre-sign-in sections whose exact page the apps finish natively: sign-up\n * (with its `?plan=`), an emailed verification link, an emailed password\n * reset and account recovery (`AuthFlow.swift`; Android's console intent\n * filter lists the same four paths). Only the page itself opens the app;\n * anything under it stays in the browser, where the console handles it.\n */\nexport const NATIVE_AUTH_LINK_SEGMENTS: readonly string[] = [\n 'account-recovery',\n 'reset-password',\n 'signup',\n 'verify-email',\n]\n\n/** One `applinks` component: a URL path pattern, optionally excluded. */\nexport interface AppLinksComponent {\n '/': string\n exclude?: true\n comment?: string\n}\n\n/**\n * The console paths the apps open, as `applinks` components. Apple reads\n * them in order and the first match wins, so every exclusion comes ahead of\n * the closing catch-all.\n */\nexport function consoleAppLinksComponents(): AppLinksComponent[] {\n const excluded: AppLinksComponent[] = [\n { '/': '/_*', exclude: true, comment: 'framework and internal paths' },\n { '/': '/api', exclude: true },\n { '/': '/api/*', exclude: true, comment: 'route handlers' },\n { '/': '/.well-known/*', exclude: true },\n ]\n for (const segment of NATIVE_WEB_ONLY_TOP_LEVEL_SEGMENTS) {\n excluded.push({ '/': `/${segment}`, exclude: true }, { '/': `/${segment}/*`, exclude: true })\n }\n for (const segment of NATIVE_AUTH_LINK_SEGMENTS) {\n excluded.push({ '/': `/${segment}/*`, exclude: true })\n }\n return [\n ...excluded,\n { '/': '/*', comment: 'workspace, site, account, billing, support and staff pages' },\n ]\n}\n\n/** `TEAMID1234.com.example.app`: a 10-character team id, then a bundle id. */\nconst APPLE_APP_ID = /^[A-Z0-9]{10}\\.[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$/\n\n/** A Java package name: dot-separated identifiers, at least two. */\nconst ANDROID_PACKAGE = /^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)+$/\n\n/** A SHA-256 certificate fingerprint as 32 colon-separated hex pairs. */\nconst SHA256_FINGERPRINT = /^([0-9A-F]{2}:){31}[0-9A-F]{2}$/\n\n/** The Apple app ids in `NATIVE_APPLE_APP_IDS`, in order; invalid ones dropped. */\nexport function parseAppleAppIds(raw: string | undefined): string[] {\n const ids = (raw ?? '')\n .split(',')\n .map((value) => value.trim())\n .filter((value) => APPLE_APP_ID.test(value))\n return [...new Set(ids)]\n}\n\n/** One Android app and the signing certificates it may be verified by. */\nexport interface AndroidAppAssociation {\n packageName: string\n sha256Fingerprints: string[]\n}\n\n/**\n * The Android apps in `NATIVE_ANDROID_APPS`. An entry without a valid package\n * or without one valid fingerprint is dropped whole: a statement with no\n * certificate verifies nothing.\n */\nexport function parseAndroidApps(raw: string | undefined): AndroidAppAssociation[] {\n const apps: AndroidAppAssociation[] = []\n for (const entry of (raw ?? '').split(';')) {\n const at = entry.indexOf('=')\n if (at < 0) continue\n const packageName = entry.slice(0, at).trim()\n if (!ANDROID_PACKAGE.test(packageName)) continue\n if (apps.some((app) => app.packageName === packageName)) continue\n const fingerprints = entry\n .slice(at + 1)\n .split(',')\n .map((value) => value.trim().toUpperCase())\n .filter((value) => SHA256_FINGERPRINT.test(value))\n if (fingerprints.length === 0) continue\n apps.push({ packageName, sha256Fingerprints: [...new Set(fingerprints)] })\n }\n return apps\n}\n\n/** The `apple-app-site-association` document Apple's CDN reads. */\nexport interface AppleAppSiteAssociation {\n applinks?: {\n apps: []\n details: Array<{ appIDs: string[]; components: AppLinksComponent[] }>\n }\n webcredentials: { apps: string[] }\n}\n\n/**\n * The association file for these app ids. `applinks` is only for a host\n * whose paths the native deep-link grammar resolves: the console. A host\n * that serves the passkey relying party alone gets `webcredentials` only.\n *\n * One `details` entry per app, in the configured order, because when two\n * installed apps claim the same path the system takes the first.\n */\nexport function appleAppSiteAssociation(\n appIds: string[],\n options: { applinks: boolean },\n): AppleAppSiteAssociation {\n const document: AppleAppSiteAssociation = { webcredentials: { apps: [...appIds] } }\n if (options.applinks) {\n const components = consoleAppLinksComponents()\n document.applinks = {\n apps: [],\n details: appIds.map((appId) => ({ appIDs: [appId], components })),\n }\n }\n return document\n}\n\n/** One Digital Asset Links statement. */\nexport interface AssetLinkStatement {\n relation: string[]\n target: { namespace: 'android_app'; package_name: string; sha256_cert_fingerprints: string[] }\n}\n\n/** Passkeys and app links, for every configured app. */\nexport const ASSET_LINK_RELATIONS = [\n 'delegate_permission/common.handle_all_urls',\n 'delegate_permission/common.get_login_creds',\n] as const\n\n/** The `assetlinks.json` statement list Google's verifier reads. */\nexport function assetLinks(apps: AndroidAppAssociation[]): AssetLinkStatement[] {\n return apps.map((app) => ({\n relation: [...ASSET_LINK_RELATIONS],\n target: {\n namespace: 'android_app',\n package_name: app.packageName,\n sha256_cert_fingerprints: [...app.sha256Fingerprints],\n },\n }))\n}\n\n/** The request's hostname: lowercase, no port. */\nexport function requestHostname(host: string | null | undefined): string {\n return (host ?? '').trim().toLowerCase().replace(/:\\d+$/, '')\n}\n\n/** A URL's hostname, or null when it is not one. */\nexport function hostnameOfUrl(url: string | null | undefined): string | null {\n if (!url) return null\n try {\n return new URL(url).hostname.toLowerCase() || null\n } catch {\n return null\n }\n}\n\n/** What a route handler needs to answer one of the two documents. */\nexport interface NativeAppAssociationRequest {\n /** The request's `Host` header. */\n host: string | null\n /**\n * The hostnames this deployment vouches for. Every other host an app\n * serves (a customer's custom domain, a workspace subdomain, a white-label\n * console) answers 404, because the apps are this deployment's and not\n * theirs.\n */\n servedHosts: ReadonlyArray<string | null | undefined>\n /** Whether this host's paths are console links the apps resolve. */\n applinks: boolean\n /** The environment; `process.env` in the routes, a fixture in specs. */\n env: Readonly<Record<string, string | undefined>>\n}\n\n/** Short on purpose: Apple's CDN caches on top, and a fix must land within minutes. */\nconst CACHE_CONTROL = 'public, max-age=300, s-maxage=300'\n\n/**\n * Whether this host may answer. A Vercel preview deployment is reachable only\n * at the platform's own generated hostnames, so it answers on any host, which\n * is what lets a preview be checked before it is promoted.\n */\nfunction servesHost(request: NativeAppAssociationRequest): boolean {\n if (request.env['VERCEL_ENV'] === 'preview') return true\n const hostname = requestHostname(request.host)\n if (!hostname) return false\n return request.servedHosts.some((served) => requestHostname(served) === hostname)\n}\n\nfunction notFound(): Response {\n return new Response('Not Found', {\n status: 404,\n headers: { 'content-type': 'text/plain; charset=utf-8', 'cache-control': CACHE_CONTROL },\n })\n}\n\nfunction json(body: unknown): Response {\n return new Response(JSON.stringify(body), {\n status: 200,\n headers: { 'content-type': 'application/json', 'cache-control': CACHE_CONTROL },\n })\n}\n\n/** `GET /.well-known/apple-app-site-association`. */\nexport function appleAppSiteAssociationResponse(request: NativeAppAssociationRequest): Response {\n const appIds = parseAppleAppIds(request.env['NATIVE_APPLE_APP_IDS'])\n if (appIds.length === 0 || !servesHost(request)) return notFound()\n return json(appleAppSiteAssociation(appIds, { applinks: request.applinks }))\n}\n\n/** `GET /.well-known/assetlinks.json`. */\nexport function assetLinksResponse(request: NativeAppAssociationRequest): Response {\n const apps = parseAndroidApps(request.env['NATIVE_ANDROID_APPS'])\n if (apps.length === 0 || !servesHost(request)) return notFound()\n return json(assetLinks(apps))\n}\n"],"names":["APPLE_APP_SITE_ASSOCIATION_PATH","ASSET_LINKS_PATH","NATIVE_APP_ASSOCIATION_ROUTES","nativeAppAssociationRoute","pathname","Object","prototype","hasOwnProperty","call","NATIVE_WEB_ONLY_TOP_LEVEL_SEGMENTS","NATIVE_AUTH_LINK_SEGMENTS","consoleAppLinksComponents","excluded","exclude","comment","segment","push","APPLE_APP_ID","ANDROID_PACKAGE","SHA256_FINGERPRINT","parseAppleAppIds","raw","ids","split","map","value","trim","filter","test","Set","parseAndroidApps","apps","entry","at","indexOf","packageName","slice","some","app","fingerprints","toUpperCase","length","sha256Fingerprints","appleAppSiteAssociation","appIds","options","document","webcredentials","applinks","components","details","appId","appIDs","ASSET_LINK_RELATIONS","assetLinks","relation","target","namespace","package_name","sha256_cert_fingerprints","requestHostname","host","toLowerCase","replace","hostnameOfUrl","url","URL","hostname","CACHE_CONTROL","servesHost","request","env","servedHosts","served","notFound","Response","status","headers","json","body","JSON","stringify","appleAppSiteAssociationResponse","assetLinksResponse"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;2CAoB2C,GAE3C,0EAA0E,GAC1E,OAAO,MAAMA,kCAAkC,0CAAyC;AAExF,sDAAsD,GACtD,OAAO,MAAMC,mBAAmB,+BAA8B;AAE9D;;;;CAIC,GACD,OAAO,MAAMC,gCAAkE;IAC7E,CAACF,gCAAgC,EAAE;IACnC,CAACC,iBAAiB,EAAE;AACtB,EAAC;AAED,uEAAuE,GACvE,OAAO,SAASE,0BAA0BC,QAAgB;IACxD,OAAOC,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACN,+BAA+BE,YACvEF,6BAA6B,CAACE,SAAS,GACvC;AACN;AAEA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMK,qCAAwD;IACnE;IACA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O,SAASmC,mBAAmBb,OAAoC;IACrE,MAAMvC,OAAOD,iBAAiBwC,QAAQC,GAAG,CAAC,sBAAsB;IAChE,IAAIxC,KAAKU,MAAM,KAAK,KAAK,CAAC4B,WAAWC,UAAU,OAAOI;IACtD,OAAOI,KAAKxB,WAAWvB;AACzB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/native-app-association.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * THE DOCUMENTS THAT TIE THE NATIVE APPS TO A DOMAIN (AGL-3817).\n *\n * Apple's `apple-app-site-association` and Google's `assetlinks.json` are how\n * a domain says which apps may use its passkeys (`webcredentials`,\n * `get_login_creds`) and open its links (`applinks`, `handle_all_urls`). Both\n * are fetched by the platform's verifier, not by a person, so each has to be\n * exactly `application/json`, a 200, no redirect and no cookie.\n *\n * Everything that names an app comes from the environment, never from here:\n *\n * - `NATIVE_APPLE_APP_IDS`: comma-separated `<team id>.<bundle id>` values,\n * in the order the system should prefer them;\n * - `NATIVE_ANDROID_APPS`: `;`-separated `<package>=<sha256>,<sha256>`\n * entries, each fingerprint the colon-separated hex Play Console prints.\n *\n * Unset (or nothing valid in it), the document answers 404: a deployment\n * with no apps of its own vouches for none.\n *\n * A leaf with no imports, because both middlewares read the paths below.\n *=========================================*/\n\n/** Where Apple's verifier reads the association file: no `.json` suffix. */\nexport const APPLE_APP_SITE_ASSOCIATION_PATH = '/.well-known/apple-app-site-association'\n\n/** Where Google's verifier reads the statement list. */\nexport const ASSET_LINKS_PATH = '/.well-known/assetlinks.json'\n\n/**\n * The route handlers each middleware rewrites the two public paths to. They\n * live under `/api` because both apps keep their route handlers there, and\n * neither middleware runs again on `/api`.\n */\nexport const NATIVE_APP_ASSOCIATION_ROUTES: Readonly<Record<string, string>> = {\n [APPLE_APP_SITE_ASSOCIATION_PATH]: '/api/native-app-association/apple-app-site-association',\n [ASSET_LINKS_PATH]: '/api/native-app-association/assetlinks',\n}\n\n/** The route handler a public association path is served by, or null. */\nexport function nativeAppAssociationRoute(pathname: string): string | null {\n return Object.prototype.hasOwnProperty.call(NATIVE_APP_ASSOCIATION_ROUTES, pathname)\n ? NATIVE_APP_ASSOCIATION_ROUTES[pathname]\n : null\n}\n\n/**\n * The console's top-level sections the native apps have no screen for, so a\n * link to one stays in the browser: the sign-in page and SSO (the system\n * auth session opens them for the app, and a universal link there would loop\n * back into the app), the native hand-off and other `/auth` pages, the\n * sign-out page, the site admin bar's connect page, a plugin's public\n * device pages, a site's photo link (`/p/<linkId>`, opened on a phone\n * by someone with no account) and the connector consent page\n * (`/oauth/authorize`, AGL-4225), which an app such as Claude opens in the\n * browser and expects to finish there. The sections the apps finish natively are\n * {@link NATIVE_AUTH_LINK_SEGMENTS}.\n *\n * The rest of the console's top-level sections (`admin`, `billing`,\n * `manage`, `support`) and every workspace path are what the native\n * deep-link grammar resolves (`DeepLinks.swift`, `DeepLinks.kt`): a\n * registered screen, the Besigner in the app's own web view, or the nearest\n * native screen. `apps/console/specs/native-app-association.spec.ts` holds\n * this list to the console's route set and the native link specs.\n */\nexport const NATIVE_WEB_ONLY_TOP_LEVEL_SEGMENTS: readonly string[] = [\n 'auth',\n 'edit-access',\n 'kiosk',\n 'oauth',\n 'p',\n 'signin',\n 'signout',\n 'sso',\n]\n\n/**\n * The pre-sign-in sections whose exact page the apps finish natively: sign-up\n * (with its `?plan=`), an emailed verification link, an emailed password\n * reset and account recovery (`AuthFlow.swift`, `AuthFlow.kt`). Only the page\n * itself opens the app; anything under it stays in the browser, where the\n * console handles it. Android's App Link filter claims the same console paths\n * as {@link consoleAppLinksComponents}, refusing each exclusion in its manifest\n * (`native-app-association.spec.ts` holds the two together, AGL-4059).\n */\nexport const NATIVE_AUTH_LINK_SEGMENTS: readonly string[] = [\n 'account-recovery',\n 'reset-password',\n 'signup',\n 'verify-email',\n]\n\n/** One `applinks` component: a URL path pattern, optionally excluded. */\nexport interface AppLinksComponent {\n '/': string\n exclude?: true\n comment?: string\n}\n\n/**\n * The console paths the apps open, as `applinks` components. Apple reads\n * them in order and the first match wins, so every exclusion comes ahead of\n * the closing catch-all.\n */\nexport function consoleAppLinksComponents(): AppLinksComponent[] {\n const excluded: AppLinksComponent[] = [\n { '/': '/_*', exclude: true, comment: 'framework and internal paths' },\n { '/': '/api', exclude: true },\n { '/': '/api/*', exclude: true, comment: 'route handlers' },\n { '/': '/.well-known/*', exclude: true },\n ]\n for (const segment of NATIVE_WEB_ONLY_TOP_LEVEL_SEGMENTS) {\n excluded.push({ '/': `/${segment}`, exclude: true }, { '/': `/${segment}/*`, exclude: true })\n }\n for (const segment of NATIVE_AUTH_LINK_SEGMENTS) {\n excluded.push({ '/': `/${segment}/*`, exclude: true })\n }\n return [\n ...excluded,\n { '/': '/*', comment: 'workspace, site, account, billing, support and staff pages' },\n ]\n}\n\n/** `TEAMID1234.com.example.app`: a 10-character team id, then a bundle id. */\nconst APPLE_APP_ID = /^[A-Z0-9]{10}\\.[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)+$/\n\n/** A Java package name: dot-separated identifiers, at least two. */\nconst ANDROID_PACKAGE = /^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)+$/\n\n/** A SHA-256 certificate fingerprint as 32 colon-separated hex pairs. */\nconst SHA256_FINGERPRINT = /^([0-9A-F]{2}:){31}[0-9A-F]{2}$/\n\n/** The Apple app ids in `NATIVE_APPLE_APP_IDS`, in order; invalid ones dropped. */\nexport function parseAppleAppIds(raw: string | undefined): string[] {\n const ids = (raw ?? '')\n .split(',')\n .map((value) => value.trim())\n .filter((value) => APPLE_APP_ID.test(value))\n return [...new Set(ids)]\n}\n\n/** One Android app and the signing certificates it may be verified by. */\nexport interface AndroidAppAssociation {\n packageName: string\n sha256Fingerprints: string[]\n}\n\n/**\n * The Android apps in `NATIVE_ANDROID_APPS`. An entry without a valid package\n * or without one valid fingerprint is dropped whole: a statement with no\n * certificate verifies nothing.\n */\nexport function parseAndroidApps(raw: string | undefined): AndroidAppAssociation[] {\n const apps: AndroidAppAssociation[] = []\n for (const entry of (raw ?? '').split(';')) {\n const at = entry.indexOf('=')\n if (at < 0) continue\n const packageName = entry.slice(0, at).trim()\n if (!ANDROID_PACKAGE.test(packageName)) continue\n if (apps.some((app) => app.packageName === packageName)) continue\n const fingerprints = entry\n .slice(at + 1)\n .split(',')\n .map((value) => value.trim().toUpperCase())\n .filter((value) => SHA256_FINGERPRINT.test(value))\n if (fingerprints.length === 0) continue\n apps.push({ packageName, sha256Fingerprints: [...new Set(fingerprints)] })\n }\n return apps\n}\n\n/** The `apple-app-site-association` document Apple's CDN reads. */\nexport interface AppleAppSiteAssociation {\n applinks?: {\n apps: []\n details: Array<{ appIDs: string[]; components: AppLinksComponent[] }>\n }\n webcredentials: { apps: string[] }\n}\n\n/**\n * The association file for these app ids. `applinks` is only for a host\n * whose paths the native deep-link grammar resolves: the console. A host\n * that serves the passkey relying party alone gets `webcredentials` only.\n *\n * One `details` entry per app, in the configured order, because when two\n * installed apps claim the same path the system takes the first.\n */\nexport function appleAppSiteAssociation(\n appIds: string[],\n options: { applinks: boolean },\n): AppleAppSiteAssociation {\n const document: AppleAppSiteAssociation = { webcredentials: { apps: [...appIds] } }\n if (options.applinks) {\n const components = consoleAppLinksComponents()\n document.applinks = {\n apps: [],\n details: appIds.map((appId) => ({ appIDs: [appId], components })),\n }\n }\n return document\n}\n\n/** One Digital Asset Links statement. */\nexport interface AssetLinkStatement {\n relation: string[]\n target: { namespace: 'android_app'; package_name: string; sha256_cert_fingerprints: string[] }\n}\n\n/** Passkeys and app links, for every configured app. */\nexport const ASSET_LINK_RELATIONS = [\n 'delegate_permission/common.handle_all_urls',\n 'delegate_permission/common.get_login_creds',\n] as const\n\n/** The `assetlinks.json` statement list Google's verifier reads. */\nexport function assetLinks(apps: AndroidAppAssociation[]): AssetLinkStatement[] {\n return apps.map((app) => ({\n relation: [...ASSET_LINK_RELATIONS],\n target: {\n namespace: 'android_app',\n package_name: app.packageName,\n sha256_cert_fingerprints: [...app.sha256Fingerprints],\n },\n }))\n}\n\n/** The request's hostname: lowercase, no port. */\nexport function requestHostname(host: string | null | undefined): string {\n return (host ?? '').trim().toLowerCase().replace(/:\\d+$/, '')\n}\n\n/** A URL's hostname, or null when it is not one. */\nexport function hostnameOfUrl(url: string | null | undefined): string | null {\n if (!url) return null\n try {\n return new URL(url).hostname.toLowerCase() || null\n } catch {\n return null\n }\n}\n\n/** What a route handler needs to answer one of the two documents. */\nexport interface NativeAppAssociationRequest {\n /** The request's `Host` header. */\n host: string | null\n /**\n * The hostnames this deployment vouches for. Every other host an app\n * serves (a customer's custom domain, a workspace subdomain, a white-label\n * console) answers 404, because the apps are this deployment's and not\n * theirs.\n */\n servedHosts: ReadonlyArray<string | null | undefined>\n /** Whether this host's paths are console links the apps resolve. */\n applinks: boolean\n /** The environment; `process.env` in the routes, a fixture in specs. */\n env: Readonly<Record<string, string | undefined>>\n}\n\n/** Short on purpose: Apple's CDN caches on top, and a fix must land within minutes. */\nconst CACHE_CONTROL = 'public, max-age=300, s-maxage=300'\n\n/**\n * Whether this host may answer. A Vercel preview deployment is reachable only\n * at the platform's own generated hostnames, so it answers on any host, which\n * is what lets a preview be checked before it is promoted.\n */\nfunction servesHost(request: NativeAppAssociationRequest): boolean {\n if (request.env['VERCEL_ENV'] === 'preview') return true\n const hostname = requestHostname(request.host)\n if (!hostname) return false\n return request.servedHosts.some((served) => requestHostname(served) === hostname)\n}\n\nfunction notFound(): Response {\n return new Response('Not Found', {\n status: 404,\n headers: { 'content-type': 'text/plain; charset=utf-8', 'cache-control': CACHE_CONTROL },\n })\n}\n\nfunction json(body: unknown): Response {\n return new Response(JSON.stringify(body), {\n status: 200,\n headers: { 'content-type': 'application/json', 'cache-control': CACHE_CONTROL },\n })\n}\n\n/** `GET /.well-known/apple-app-site-association`. */\nexport function appleAppSiteAssociationResponse(request: NativeAppAssociationRequest): Response {\n const appIds = parseAppleAppIds(request.env['NATIVE_APPLE_APP_IDS'])\n if (appIds.length === 0 || !servesHost(request)) return notFound()\n return json(appleAppSiteAssociation(appIds, { applinks: request.applinks }))\n}\n\n/** `GET /.well-known/assetlinks.json`. */\nexport function assetLinksResponse(request: NativeAppAssociationRequest): Response {\n const apps = parseAndroidApps(request.env['NATIVE_ANDROID_APPS'])\n if (apps.length === 0 || !servesHost(request)) return notFound()\n return json(assetLinks(apps))\n}\n"],"names":["APPLE_APP_SITE_ASSOCIATION_PATH","ASSET_LINKS_PATH","NATIVE_APP_ASSOCIATION_ROUTES","nativeAppAssociationRoute","pathname","Object","prototype","hasOwnProperty","call","NATIVE_WEB_ONLY_TOP_LEVEL_SEGMENTS","NATIVE_AUTH_LINK_SEGMENTS","consoleAppLinksComponents","excluded","exclude","comment","segment","push","APPLE_APP_ID","ANDROID_PACKAGE","SHA256_FINGERPRINT","parseAppleAppIds","raw","ids","split","map","value","trim","filter","test","Set","parseAndroidApps","apps","entry","at","indexOf","packageName","slice","some","app","fingerprints","toUpperCase","length","sha256Fingerprints","appleAppSiteAssociation","appIds","options","document","webcredentials","applinks","components","details","appId","appIDs","ASSET_LINK_RELATIONS","assetLinks","relation","target","namespace","package_name","sha256_cert_fingerprints","requestHostname","host","toLowerCase","replace","hostnameOfUrl","url","URL","hostname","CACHE_CONTROL","servesHost","request","env","servedHosts","served","notFound","Response","status","headers","json","body","JSON","stringify","appleAppSiteAssociationResponse","assetLinksResponse"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;2CAoB2C,GAE3C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AEA,SAASU,KAAKC,IAAa;IACzB,OAAO,IAAIJ,SAASK,KAAKC,SAAS,CAACF,OAAO;QACxCH,QAAQ;QACRC,SAAS;YAAE,gBAAgB;YAAoB,iBAAiBT;QAAc;IAChF;AACF;AAEA,mDAAmD,GACnD,OAAO,SAASc,gCAAgCZ,OAAoC;IAClF,MAAM1B,SAASxB,iBAAiBkD,QAAQC,GAAG,CAAC,uBAAuB;IACnE,IAAI3B,OAAOH,MAAM,KAAK,KAAK,CAAC4B,WAAWC,UAAU,OAAOI;IACxD,OAAOI,KAAKnC,wBAAwBC,QAAQ;QAAEI,UAAUsB,QAAQtB,QAAQ;IAAC;AAC3E;AAEA,wCAAwC,GACxC,OAAO,SAASmC,mBAAmBb,OAAoC;IACrE,MAAMvC,OAAOD,iBAAiBwC,QAAQC,GAAG,CAAC,sBAAsB;IAChE,IAAIxC,KAAKU,MAAM,KAAK,KAAK,CAAC4B,WAAWC,UAAU,OAAOI;IACtD,OAAOI,KAAKxB,WAAWvB;AACzB"}
|
|
@@ -478,7 +478,7 @@ const SITE_SETTINGS = {
|
|
|
478
478
|
label: 'Setup',
|
|
479
479
|
foldable: false,
|
|
480
480
|
rows: ordered([
|
|
481
|
-
setupRow('details', 'Basic details', ICONS.details, 'Logo,
|
|
481
|
+
setupRow('details', 'Basic details', ICONS.details, 'Logo, layout and languages'),
|
|
482
482
|
setupRow('business', 'Business profile', ICONS.business, 'What the business is, for everything that writes about it'),
|
|
483
483
|
setupRow('seo', 'SEO', ICONS.seo, 'Search title, social image, business profile and verification', [
|
|
484
484
|
'search'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/native-nav.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * THE NATIVE APPS' NAVIGATION, AS DATA (AGL-3943).\n *\n * One manifest both shells draw (docs/mobile/native-navigation.md): the\n * sidebar for the whole workspace, the sidebar inside one site, and the two\n * settings modes (the workspace's, and the site's, which merges the\n * console's Setup and Admin). Zach chose the site's groups on 2026-10-18:\n * an Analytics row, Starred, Website, Sell, Customers, More, Site settings.\n *\n * Every row names:\n * - the console's word for it (`label`), held to the console by\n * `apps/console/specs/native-nav-manifest.spec.ts`, which reads the\n * console's own tabs, sections and plugin declarations;\n * - one icon per idea, an SF Symbol and a Material Symbol;\n * - the native screen it opens (a plugin's declared screen, a core screen\n * spec, a site platform screen or a `shell.*` destination);\n * - the plugin it belongs to, so it hides when that plugin is off for the\n * workspace or the site.\n *\n * The core's own rows (Home, Analytics, Sites, Pages, Media, the settings\n * modes) are here; a plugin's rows are its own, in\n * `libs/plugins/<plugin>/src/lib/native-nav.ts` (`NATIVE_NAV_ROWS`), placed\n * into a list's group by `order` (docs/PACKAGES.md rule 3: the core never\n * names a plugin). `generate:native-contracts` assembles the two\n * (`assembleNativeNav`) into the manifest the apps read,\n * `ContractValues.nativeNavManifest`.\n *\n * NO IMPORTS, on purpose: the native apps read this through the generated\n * contracts, so it must stay a plain module.\n */\n\n/** A list the shells draw. */\nexport type NativeNavListId = 'workspace' | 'site' | 'workspaceSettings' | 'siteSettings'\n\n/** One icon per idea: the same row draws the same picture in both scopes. */\nexport interface NativeNavIcon {\n /** An SF Symbol name. */\n apple: string\n /** A Material Symbol name, as `AglynIcons.named` takes it. */\n android: string\n}\n\n/**\n * Where a row's console twin lives:\n * - `orgTab` / `hostTab`: a console tab, by its id (`org-nav-tabs.ts`,\n * `host-nav-tabs.ts`);\n * - `orgPluginTab` / `hostPluginTab`: a plugin's `orgNavItems` / `navItems`\n * entry, by its href;\n * - `orgPluginSection` / `hostPluginSection`: a section of a plugin's hub, as\n * `{href}/{sectionId}`;\n * - `setupSection`: a site's Setup section, by its id (`setup-sections.ts`);\n * - `hostAdminSection`, `orgSettingsSection`, `teamSection`,\n * `billingSection`: a section of those hubs, by its `Route` name;\n * - `consoleWidget`: a plugin's card, as `{slot}/{widgetId}`;\n * - `shell`: a place the app's shell owns (Home, Analytics' page, the\n * settings modes), whose console twin is the page named in `id`;\n * - `nativeOnly`: a native screen the console has no page for.\n */\nexport type NativeNavConsoleSurface =\n | 'orgTab'\n | 'hostTab'\n | 'orgPluginTab'\n | 'hostPluginTab'\n | 'orgPluginSection'\n | 'hostPluginSection'\n | 'setupSection'\n | 'hostAdminSection'\n | 'orgSettingsSection'\n | 'teamSection'\n | 'billingSection'\n | 'consoleWidget'\n | 'shell'\n | 'nativeOnly'\n\nexport interface NativeNavConsoleRef {\n surface: NativeNavConsoleSurface\n id: string\n}\n\n/** A section inside a row's area, as the console's section rail lists it. */\nexport interface NativeNavSection {\n id: string\n label: string\n screen: string\n params?: Record<string, string>\n /** Set only when the section belongs to another plugin than its row's. */\n pluginId?: string\n /** The help docs page for it; its row's, unless the console names its own. */\n docs?: string\n console: NativeNavConsoleRef\n}\n\n/** An action the area offers from its title bar (Scan stock, New product). */\nexport interface NativeNavAction {\n id: string\n label: string\n icon: NativeNavIcon\n screen: string\n params?: Record<string, string>\n}\n\nexport interface NativeNavRow {\n /** The idea's id: the same in every list that shows it (`media`). */\n id: string\n /** The console's word. */\n label: string\n /**\n * The console's word when the native label is a decision of its own\n * (a row the apps name differently from the console).\n */\n consoleLabel?: string\n icon: NativeNavIcon\n /** The native screen the row opens. */\n screen: string\n params?: Record<string, string>\n /** The plugin the row belongs to: off for the workspace or site, the row hides. */\n pluginId?: string\n /** Only a site admin sees the row, as only they see the console's Admin tab. */\n requiresHostAdmin?: boolean\n /** A settings row's one line, in the words the screens already use. */\n description?: string\n /** Search words besides the label, so typing \"billing\" finds Plan. */\n keywords?: string[]\n /** Where the row sits in its group, ascending; a plugin's row is placed by it. */\n order?: number\n /**\n * The help docs page for the place, as the console's own help names it\n * (its `docsTopic` and `docsAnchor`, or the page's `help` prop): a docs-site\n * path with its anchor, e.g. `/content-and-data/crm/overview#at-the-organization-level`.\n * The apps open it in the in-app browser, on the docs origin.\n */\n docs?: string\n sections?: NativeNavSection[]\n actions?: NativeNavAction[]\n console: NativeNavConsoleRef\n}\n\nexport interface NativeNavGroup {\n id: string\n /** The heading; absent for a group drawn without one. */\n label?: string\n /** Folded at rest unless it holds the screen in use, remembered per device. */\n foldable: boolean\n /** `starred`: the person's starred items for this scope, drawn by the shell. */\n dynamic?: 'starred'\n rows: NativeNavRow[]\n}\n\nexport interface NativeNavList {\n id: NativeNavListId\n /** The settings mode's title, after its owner's name (\"Juniper Street Co. settings\"). */\n title?: string\n groups: NativeNavGroup[]\n}\n\n/** A console place no row holds, and where the apps put it instead. */\nexport interface NativeNavElsewhere {\n console: NativeNavConsoleRef\n where: string\n}\n\n/** A plugin's row, and the list and group it goes in. */\nexport interface NativeNavContribution {\n list: NativeNavListId\n /** A group of that list, by id. */\n group: string\n row: NativeNavRow\n}\n\n/** Where the Create new menu is offered: the whole workspace, or one site. */\nexport type NativeNavCreateScope = 'workspace' | 'site'\n\n/**\n * One item of the Create new menu (\"+\" on the rail, the center tab on\n * phones): what the console offers to create from that scope, opening the\n * area's own create form.\n */\nexport interface NativeNavCreateItem {\n id: string\n /** The thing made, in the console's words (\"Draft order\", \"Service\"). */\n label: string\n icon: NativeNavIcon\n /** The native screen the item opens, with `params` that open its create form. */\n screen: string\n params?: Record<string, string>\n /** The plugin it belongs to: off for the workspace or site, the item is not offered. */\n pluginId?: string\n /** Only a site admin is offered it. */\n requiresHostAdmin?: boolean\n /** The workspace permission the console's create action asks for (`hosts.create`, `data.manage`). */\n permission?: string\n /** The site roles that may make it, as the rules hold them (`canWriteHostContent`). */\n hostRoles?: string[]\n /** The plan feature it needs; without it the item is shown blocked, with `blockedReason`. */\n planFeature?: string\n /** Why it is blocked when the plan lacks `planFeature`; the default reason otherwise. */\n blockedReason?: string\n /** Where it sits in the menu, ascending. */\n order?: number\n /** Where the console offers the same create action. */\n console: NativeNavConsoleRef\n}\n\n/** One scope's Create new menu. */\nexport interface NativeNavCreateList {\n scope: NativeNavCreateScope\n items: NativeNavCreateItem[]\n}\n\n/** A plugin's Create new item, and the scope that offers it. */\nexport interface NativeNavCreateContribution {\n scope: NativeNavCreateScope\n item: NativeNavCreateItem\n}\n\nexport interface NativeNavManifest {\n lists: NativeNavList[]\n /** The Create new menu per scope (AGL-3943). */\n create?: NativeNavCreateList[]\n /** Destinations the shells own, which no plugin registers. */\n shellScreens: string[]\n elsewhere: NativeNavElsewhere[]\n}\n\n/** The shells' own destinations. */\nexport const NATIVE_NAV_SHELL_SCREENS: readonly string[] = [\n 'shell.home',\n 'shell.analytics',\n 'shell.workspaceSettings',\n 'shell.siteSettings',\n]\n\n/** An icon pair, for the rows here and in the plugins. */\nexport const nativeNavIcon = (apple: string, android: string): NativeNavIcon => ({ apple, android })\n\n/** A console reference, for the rows here and in the plugins. */\nexport const nativeNavRef = (surface: NativeNavConsoleSurface, id: string): NativeNavConsoleRef => ({\n surface,\n id,\n})\n\n/** A section of a plugin hub, at the scope its row stands in. */\nexport function nativeNavHubSection(\n scope: 'org' | 'host',\n href: string,\n id: string,\n label: string,\n screen: string,\n extra: Partial<Pick<NativeNavSection, 'params' | 'pluginId'>> = {},\n): NativeNavSection {\n return {\n id,\n label,\n screen,\n ...extra,\n console: nativeNavRef(scope === 'org' ? 'orgPluginSection' : 'hostPluginSection', `${href}/${id}`),\n }\n}\n\nconst icon = nativeNavIcon\nconst ref = nativeNavRef\n\nconst ICONS = {\n home: icon('house', 'home'),\n overview: icon('chart.bar', 'bar_chart'),\n sites: icon('globe', 'public'),\n pages: icon('doc.text', 'description'),\n media: icon('photo.on.rectangle', 'photo_library'),\n settings: icon('gearshape', 'settings'),\n emails: icon('envelope', 'mail'),\n members: icon('person.2', 'group'),\n roles: icon('person.badge.key', 'admin_panel_settings'),\n activity: icon('clock.arrow.circlepath', 'history'),\n plan: icon('creditcard', 'credit_card'),\n usage: icon('gauge.with.dots.needle.33percent', 'data_usage'),\n invoices: icon('doc.plaintext', 'receipt_long'),\n billingSettings: icon('slider.horizontal.3', 'tune'),\n plugins: icon('puzzlepiece.extension', 'extension'),\n branding: icon('paintbrush', 'brush'),\n sso: icon('key.viewfinder', 'vpn_key'),\n profile: icon('building.2', 'apartment'),\n apiKeys: icon('key', 'key'),\n integrations: icon('point.3.connected.trianglepath.dotted', 'hub'),\n privacy: icon('hand.raised', 'privacy_tip'),\n holds: icon('exclamationmark.triangle', 'warning'),\n importExport: icon('arrow.up.arrow.down', 'sync'),\n ownership: icon('person.crop.circle.badge.checkmark', 'manage_accounts'),\n delete: icon('trash', 'delete_forever'),\n details: icon('info.circle', 'info'),\n business: icon('briefcase', 'business'),\n seo: icon('magnifyingglass', 'travel_explore'),\n tracking: icon('chart.line.uptrend.xyaxis', 'query_stats'),\n theme: icon('paintpalette', 'palette'),\n domain: icon('link', 'domain'),\n security: icon('lock', 'security'),\n errorPages: icon('exclamationmark.circle', 'error_outline'),\n backup: icon('square.and.arrow.down', 'backup'),\n} as const\n\nconst HOME_ROW: NativeNavRow = {\n id: 'home',\n label: 'Home',\n icon: ICONS.home,\n screen: 'shell.home',\n order: 10,\n console: ref('shell', 'home'),\n}\n\nconst WORKSPACE: NativeNavList = {\n id: 'workspace',\n groups: [\n { id: 'top', foldable: false, rows: [HOME_ROW] },\n { id: 'starred', label: 'Starred', foldable: true, dynamic: 'starred', rows: [] },\n {\n id: 'workspace',\n foldable: false,\n rows: [\n {\n id: 'sites',\n label: 'Sites',\n icon: ICONS.sites,\n screen: 'site.sites',\n order: 10,\n docs: '/getting-started/console-tour#the-sites-list',\n console: ref('orgTab', 'nav-tab-org-sites'),\n },\n {\n id: 'media',\n label: 'Media',\n icon: ICONS.media,\n screen: 'site.media',\n order: 90,\n console: ref('orgTab', 'nav-tab-org-media'),\n },\n ],\n },\n ],\n}\n\nconst SITE: NativeNavList = {\n id: 'site',\n groups: [\n {\n id: 'top',\n foldable: false,\n rows: [\n HOME_ROW,\n {\n id: 'overview',\n // \"Analytics\", the console's own word: \"Overview\" read as a second Home (AGL-4011).\n label: 'Analytics',\n consoleLabel: 'Analytics',\n icon: ICONS.overview,\n screen: 'shell.analytics',\n order: 20,\n keywords: ['analytics', 'traffic', 'visitors'],\n console: ref('hostTab', 'nav-tab-analytics'),\n },\n ],\n },\n { id: 'starred', label: 'Starred', foldable: true, dynamic: 'starred', rows: [] },\n {\n id: 'website',\n label: 'Website',\n foldable: true,\n rows: [\n {\n id: 'pages',\n label: 'Pages',\n icon: ICONS.pages,\n screen: 'site.pages',\n order: 10,\n sections: [\n { id: 'pages', label: 'Pages', screen: 'site.pages', console: ref('hostTab', 'nav-tab-screens') },\n { id: 'components', label: 'Components', screen: 'site.components', console: ref('hostTab', 'nav-tab-components') },\n { id: 'layouts', label: 'Layouts', screen: 'site.layouts', console: ref('hostTab', 'nav-tab-layouts') },\n { id: 'templates', label: 'Templates', screen: 'site.templates', console: ref('hostTab', 'nav-tab-templates') },\n { id: 'content', label: 'Content', screen: 'site.content', console: ref('hostTab', 'nav-tab-content') },\n ],\n console: ref('hostTab', 'nav-tab-screens'),\n },\n {\n id: 'media',\n label: 'Media',\n icon: ICONS.media,\n screen: 'site.media',\n order: 20,\n console: ref('hostTab', 'nav-tab-media'),\n },\n ],\n },\n { id: 'sell', label: 'Sell', foldable: true, rows: [] },\n { id: 'customers', label: 'Customers', foldable: true, rows: [] },\n { id: 'more', label: 'More', foldable: true, rows: [] },\n {\n id: 'settings',\n foldable: false,\n rows: [\n {\n id: 'siteSettings',\n label: 'Site settings',\n icon: ICONS.settings,\n screen: 'shell.siteSettings',\n order: 10,\n console: ref('shell', 'siteSettings'),\n },\n ],\n },\n ],\n}\n\n/** Each row's place, in the order written. */\nconst ordered = (rows: NativeNavRow[]): NativeNavRow[] =>\n rows.map((row, index) => ({ ...row, order: row.order ?? (index + 1) * 10 }))\n\n/** The help page each settings hub's `help` prop names, the rows' docs. */\nconst HUB_DOCS: Partial<Record<NativeNavConsoleSurface, string>> = {\n teamSection: '/workspace-and-billing/teams-and-roles/overview#team-page',\n billingSection: '/workspace-and-billing/billing-and-plans/overview#billing-page',\n orgSettingsSection: '/getting-started/console-tour#organization-settings',\n hostAdminSection: '/getting-started/create-a-site#site-admin',\n}\n\nconst setupRow = (\n id: string,\n label: string,\n rowIcon: NativeNavIcon,\n description: string,\n keywords?: string[],\n): NativeNavRow => ({\n id,\n label,\n icon: rowIcon,\n screen: id === 'theme' ? 'site.theme' : 'site.setup',\n ...(id === 'theme' ? {} : { params: { section: id } }),\n description,\n ...(keywords ? { keywords } : {}),\n console: ref('setupSection', id),\n})\n\nconst adminRow = (\n id: string,\n label: string,\n rowIcon: NativeNavIcon,\n screen: string,\n route: string,\n): NativeNavRow => ({\n id,\n label,\n icon: rowIcon,\n screen,\n requiresHostAdmin: true,\n docs: HUB_DOCS.hostAdminSection,\n console: ref('hostAdminSection', route),\n})\n\nconst settingsRow = (\n surface: NativeNavConsoleSurface,\n id: string,\n label: string,\n rowIcon: NativeNavIcon,\n screen: string,\n route: string,\n extra: Partial<Pick<NativeNavRow, 'keywords' | 'order'>> = {},\n): NativeNavRow => ({\n id,\n label,\n icon: rowIcon,\n screen,\n ...extra,\n ...(HUB_DOCS[surface] ? { docs: HUB_DOCS[surface] } : {}),\n console: ref(surface, route),\n})\n\nconst WORKSPACE_SETTINGS: NativeNavList = {\n id: 'workspaceSettings',\n title: 'settings',\n groups: [\n {\n id: 'team',\n label: 'Team',\n foldable: false,\n rows: ordered([\n settingsRow('teamSection', 'members', 'Members', ICONS.members, 'core.team', 'MANAGE_TEAM_MEMBERS', { keywords: ['team', 'invite', 'people'] }),\n settingsRow('teamSection', 'roles', 'Custom roles', ICONS.roles, 'core.team.roles', 'MANAGE_TEAM_ROLES', { keywords: ['permissions'] }),\n settingsRow('teamSection', 'activity', 'Recent activity', ICONS.activity, 'core.team.activity', 'MANAGE_TEAM_ACTIVITY', { keywords: ['audit log'] }),\n ]),\n },\n {\n id: 'billing',\n label: 'Billing',\n foldable: false,\n rows: [\n settingsRow('billingSection', 'plan', 'Plan', ICONS.plan, 'core.billing', 'MANAGE_BILLING', { order: 10, keywords: ['billing', 'upgrade', 'subscription'] }),\n settingsRow('billingSection', 'usage', 'Usage', ICONS.usage, 'core.billing.usage', 'MANAGE_BILLING_USAGE', { order: 20, keywords: ['billing', 'limits'] }),\n settingsRow('billingSection', 'invoices', 'Invoices', ICONS.invoices, 'core.billing.invoices', 'MANAGE_BILLING_INVOICES', { order: 40, keywords: ['billing', 'receipts'] }),\n settingsRow('billingSection', 'billingSettings', 'Settings', ICONS.billingSettings, 'core.billing.settings', 'MANAGE_BILLING_SETTINGS', { order: 50, keywords: ['billing', 'payment method', 'tax'] }),\n ],\n },\n {\n id: 'workspace',\n label: 'Workspace',\n foldable: false,\n rows: ordered([\n settingsRow('orgTab', 'plugins', 'Plugins', ICONS.plugins, 'core.plugins', 'nav-tab-org-plugins'),\n settingsRow('orgSettingsSection', 'branding', 'Branding', ICONS.branding, 'core.settings.branding', 'ORG_SETTINGS_BRANDING', { keywords: ['white label', 'logo', 'colors'] }),\n settingsRow('orgSettingsSection', 'sso', 'Single sign-on', ICONS.sso, 'core.settings.sso', 'ORG_SETTINGS_SSO', { keywords: ['sso', 'saml'] }),\n settingsRow('orgSettingsSection', 'profile', 'Profile', ICONS.profile, 'core.settings.profile', 'ORG_SETTINGS_PROFILE'),\n settingsRow('orgSettingsSection', 'apiKeys', 'API keys', ICONS.apiKeys, 'core.settings.apiKeys', 'ORG_SETTINGS_API_KEYS'),\n settingsRow('orgSettingsSection', 'integrations', 'Integrations', ICONS.integrations, 'core.settings.integrations', 'ORG_SETTINGS_INTEGRATIONS'),\n settingsRow('orgSettingsSection', 'general', 'General', ICONS.settings, 'core.settings.general', 'ORG_SETTINGS_GENERAL', { keywords: ['name', 'address'] }),\n ]),\n },\n {\n id: 'data',\n label: 'Data & compliance',\n foldable: false,\n rows: ordered([\n settingsRow('orgSettingsSection', 'privacy', 'Privacy', ICONS.privacy, 'core.settings.privacy', 'ORG_SETTINGS_PRIVACY', { keywords: ['gdpr', 'erase'] }),\n settingsRow('orgSettingsSection', 'holds', 'Holds & reviews', ICONS.holds, 'core.settings.holds', 'ORG_SETTINGS_HOLDS'),\n settingsRow('orgSettingsSection', 'importExport', 'Import & export', ICONS.importExport, 'core.settings.data', 'ORG_SETTINGS_DATA', { keywords: ['csv', 'export'] }),\n ]),\n },\n {\n id: 'danger',\n label: 'Danger zone',\n foldable: false,\n rows: ordered([\n settingsRow('orgSettingsSection', 'ownership', 'Ownership', ICONS.ownership, 'core.settings.ownership', 'ORG_SETTINGS_OWNERSHIP', { keywords: ['transfer'] }),\n settingsRow('orgSettingsSection', 'delete', 'Delete', ICONS.delete, 'core.settings.delete', 'ORG_SETTINGS_DELETE'),\n ]),\n },\n ],\n}\n\nconst SITE_SETTINGS: NativeNavList = {\n id: 'siteSettings',\n title: 'settings',\n groups: [\n {\n id: 'people',\n foldable: false,\n rows: ordered([\n {\n id: 'users',\n label: 'Users',\n icon: ICONS.members,\n screen: 'core.site.users',\n keywords: ['team', 'collaborators'],\n console: ref('hostTab', 'nav-tab-users'),\n },\n ]),\n },\n {\n id: 'setup',\n label: 'Setup',\n foldable: false,\n rows: ordered([\n setupRow('details', 'Basic details', ICONS.details, 'Logo, business details, layout and languages'),\n setupRow('business', 'Business profile', ICONS.business, 'What the business is, for everything that writes about it'),\n setupRow('seo', 'SEO', ICONS.seo, 'Search title, social image, business profile and verification', ['search']),\n setupRow('tracking', 'Tracking', ICONS.tracking, 'Analytics, ad tags and the consent banner', ['cookies', 'pixels']),\n setupRow('theme', 'Theme', ICONS.theme, 'Colors, font, shape and your saved themes', ['colors', 'fonts']),\n setupRow('emails', 'Emails', ICONS.emails, 'The emails your site sends to customers'),\n setupRow('integrations', 'Integrations', ICONS.integrations, 'Email platforms, Zapier, live chat and the other tools your site connects to'),\n ]),\n },\n {\n id: 'admin',\n label: 'Admin',\n foldable: false,\n rows: ordered([\n adminRow('general', 'General', ICONS.settings, 'core.site.general', 'HOST_ADMIN_GENERAL'),\n adminRow('plugins', 'Plugins', ICONS.plugins, 'core.site.plugins', 'HOST_ADMIN_PLUGINS'),\n adminRow('domain', 'Custom Domain', ICONS.domain, 'core.site.domain', 'HOST_ADMIN_DOMAIN'),\n adminRow('security', 'Security', ICONS.security, 'core.site.security', 'HOST_ADMIN_SECURITY'),\n adminRow('errorPages', 'Error pages', ICONS.errorPages, 'core.site.errorPages', 'HOST_ADMIN_ERROR_PAGES'),\n adminRow('activity', 'Activity', ICONS.activity, 'core.site.activity', 'HOST_ADMIN_ACTIVITY'),\n adminRow('backup', 'Backup & template', ICONS.backup, 'core.site.backup', 'HOST_ADMIN_BACKUP'),\n adminRow('danger', 'Danger zone', ICONS.delete, 'core.site.delete', 'HOST_ADMIN_DANGER'),\n ]),\n },\n ],\n}\n\nconst CREATE: NativeNavCreateList[] = [\n {\n scope: 'workspace',\n items: [\n {\n id: 'site',\n label: 'Site',\n icon: ICONS.sites,\n screen: 'site.sites',\n params: { new: '1' },\n permission: 'hosts.create',\n order: 10,\n console: ref('orgTab', 'nav-tab-org-sites'),\n },\n ],\n },\n {\n scope: 'site',\n items: [\n {\n id: 'page',\n label: 'Page',\n icon: ICONS.pages,\n screen: 'site.pages',\n params: { new: '1' },\n hostRoles: ['admin', 'editor', 'author'],\n order: 10,\n console: ref('hostTab', 'nav-tab-screens'),\n },\n ],\n },\n]\n\n/**\n * The core's half of the manifest: every list and group, and the core's own\n * rows. The manifest the apps read (`ContractValues.nativeNavManifest`) is\n * this with each plugin's `NATIVE_NAV_ROWS` placed by `assembleNativeNav`.\n */\nexport const NATIVE_NAV_MANIFEST: NativeNavManifest = {\n lists: [WORKSPACE, SITE, WORKSPACE_SETTINGS, SITE_SETTINGS],\n create: CREATE,\n shellScreens: [...NATIVE_NAV_SHELL_SCREENS],\n elsewhere: [\n { console: ref('hostTab', 'nav-tab-dashboard'), where: 'Home, inside the site (shell.home)' },\n { console: ref('hostTab', 'nav-tab-setup'), where: 'Site settings → Setup' },\n { console: ref('hostTab', 'nav-tab-admin'), where: 'Site settings → Admin' },\n { console: ref('orgTab', 'nav-tab-org-team'), where: 'Workspace settings → Team' },\n { console: ref('orgTab', 'nav-tab-org-billing'), where: 'Workspace settings → Billing' },\n { console: ref('orgTab', 'nav-tab-org-settings'), where: 'Workspace settings' },\n { console: ref('orgTab', 'nav-tab-org-support'), where: 'Help menu → Contact support (core.support)' },\n ],\n}\n\n/**\n * The manifest with the plugins' rows placed: each into its list's group by\n * `order` (a tie keeps the core's row first, then registration order). A row\n * naming a list or group the core does not have is refused by name, so a\n * plugin cannot quietly invent a group.\n */\nexport function assembleNativeNav(\n core: NativeNavManifest,\n contributions: readonly NativeNavContribution[],\n elsewhere: readonly NativeNavElsewhere[] = [],\n creates: readonly NativeNavCreateContribution[] = [],\n): NativeNavManifest {\n const byOrder = <T extends { order?: number }>(entries: T[]): T[] =>\n entries\n .map((entry, index) => ({ entry, index }))\n .sort((a, b) => (a.entry.order ?? 0) - (b.entry.order ?? 0) || a.index - b.index)\n .map(({ entry }) => entry)\n const lists = core.lists.map((list) => ({\n ...list,\n groups: list.groups.map((group) => ({ ...group, rows: [...group.rows] })),\n }))\n for (const { list: listId, group: groupId, row } of contributions) {\n const group = lists.find((list) => list.id === listId)?.groups.find((entry) => entry.id === groupId)\n if (!group || group.dynamic) {\n throw new Error(`native nav: ${row.id} names ${listId}/${groupId}, which is not a group of rows`)\n }\n if (group.rows.some((entry) => entry.id === row.id)) {\n throw new Error(`native nav: ${listId}/${groupId} holds ${row.id} twice`)\n }\n group.rows.push(row)\n }\n for (const list of lists) {\n for (const group of list.groups) {\n // A section is helped by its row's page unless the console names its own.\n group.rows = byOrder(group.rows).map((row) =>\n row.docs && row.sections\n ? { ...row, sections: row.sections.map((section) => (section.docs ? section : { ...section, docs: row.docs })) }\n : row,\n )\n }\n }\n const create = (core.create ?? []).map((entry) => ({ ...entry, items: [...entry.items] }))\n for (const { scope, item } of creates) {\n const target = create.find((entry) => entry.scope === scope)\n if (!target) throw new Error(`native nav: create item ${item.id} names ${scope}, which has no menu`)\n if (target.items.some((entry) => entry.id === item.id)) {\n throw new Error(`native nav: the ${scope} create menu holds ${item.id} twice`)\n }\n target.items.push(item)\n }\n return {\n ...core,\n lists,\n create: create.map((entry) => ({ ...entry, items: byOrder(entry.items) })),\n elsewhere: [...core.elsewhere, ...elsewhere],\n }\n}\n\n/** What a Create new item that cannot be used says, when its own reason does not apply. */\nexport const NATIVE_CREATE_PERMISSION_REASON =\n 'Your role does not include this permission — ask an organization admin.'\nexport const NATIVE_CREATE_SITE_ROLE_REASON = 'Your access to this site does not include this — ask an organization admin.'\nexport const NATIVE_CREATE_PLAN_REASON = \"Your plan doesn't include this. See the plans in Billing.\"\n\n/** A Create new item as one scope offers it. */\nexport interface ResolvedCreateItem extends NativeNavCreateItem {\n /** Shown, but disabled with `reason`: a prerequisite stands between the person and it. */\n blocked: boolean\n reason?: string\n}\n\n/**\n * The Create new menu for the workspace or site in hand. An item of a plugin\n * that is off is not offered, nor an admin-only item to a non-admin. One the\n * person may not use is SHOWN, disabled with its reason (prerequisites are\n * shown, never hidden): a permission or site role they lack, then a plan\n * feature the workspace lacks. `permissions` and `features` are the\n * workspace's resolved answers (an absent key is not held); `hostRole` is\n * the person's role on the site, null at the workspace.\n */\nexport function resolveCreateList(\n manifest: NativeNavManifest,\n scope: NativeNavCreateScope,\n enabledPluginIds: readonly string[],\n permissions: Readonly<Record<string, boolean>>,\n features: Readonly<Record<string, boolean>>,\n hostRole: string | null,\n): ResolvedCreateItem[] {\n const on = new Set(enabledPluginIds)\n const items = manifest.create?.find((entry) => entry.scope === scope)?.items ?? []\n return items\n .filter((item) => (!item.pluginId || on.has(item.pluginId)) && (!item.requiresHostAdmin || hostRole === 'admin'))\n .map((item): ResolvedCreateItem => {\n if (item.permission && permissions[item.permission] !== true) {\n return { ...item, blocked: true, reason: NATIVE_CREATE_PERMISSION_REASON }\n }\n if (item.hostRoles && !item.hostRoles.includes(hostRole ?? '')) {\n return { ...item, blocked: true, reason: NATIVE_CREATE_SITE_ROLE_REASON }\n }\n if (item.planFeature && features[item.planFeature] !== true) {\n return { ...item, blocked: true, reason: item.blockedReason ?? NATIVE_CREATE_PLAN_REASON }\n }\n return { ...item, blocked: false }\n })\n}\n\n/** A list as one scope shows it: rows for plugins that are off, or admin rows for a non-admin, left out. */\nexport interface ResolvedNavList {\n id: NativeNavListId\n title?: string\n groups: NativeNavGroup[]\n}\n\n/**\n * One list for the workspace or site in hand, from the assembled manifest\n * (`ContractValues.nativeNavManifest`). `enabledPluginIds` is the site's\n * effective set (`resolveHostEnabledPlugins`) in site scope and the\n * workspace's (`resolveEnabledPlugins`) otherwise. A section of another\n * plugin than its row's hides with that plugin. A group left with no rows is\n * dropped, except the starred group, which the shell fills.\n */\nexport function resolveNavList(\n manifest: NativeNavManifest,\n listId: NativeNavListId,\n enabledPluginIds: readonly string[],\n hostAdmin: boolean,\n): ResolvedNavList {\n const list = manifest.lists.find((entry) => entry.id === listId)\n if (!list) return { id: listId, groups: [] }\n const on = new Set(enabledPluginIds)\n const shows = (pluginId?: string) => !pluginId || on.has(pluginId)\n const groups: NativeNavGroup[] = []\n for (const group of list.groups) {\n const rows = group.rows\n .filter((row) => shows(row.pluginId) && (hostAdmin || !row.requiresHostAdmin))\n .map((row) =>\n row.sections\n ? { ...row, sections: row.sections.filter((section) => shows(section.pluginId)) }\n : row,\n )\n if (!rows.length && !group.dynamic) continue\n groups.push({ ...group, rows })\n }\n return { id: list.id, ...(list.title ? { title: list.title } : {}), groups }\n}\n\n// ── The phone's Home (AGL-4006) ─────────────────────────────────────────────\n\n/**\n * A group's heading on the phone's Home where it differs from the sidebar's.\n * Nothing on the phone reads \"More\", so the sidebar's More\n * group is headed Tools there.\n */\nexport const PHONE_HOME_GROUP_LABELS: Record<string, string> = { more: 'Tools' }\n\n/** The heading of the phone Home's last group: inside a site, and for the whole workspace. */\nexport const PHONE_HOME_SITE_GROUP_LABEL = 'Site & workspace'\nexport const PHONE_HOME_WORKSPACE_GROUP_LABEL = 'Settings'\n\n/** The Team tile's word: the console's tab for Members, Custom roles and Recent activity. */\nexport const PHONE_HOME_TEAM_LABEL = 'Team'\n\n/** The tile that opens Workspace settings on the phone's Home. */\nexport const WORKSPACE_SETTINGS_ROW: NativeNavRow = {\n id: 'workspaceSettings',\n label: 'Workspace settings',\n icon: ICONS.profile,\n screen: 'shell.workspaceSettings',\n console: ref('shell', 'workspaceSettings'),\n}\n\n/** One group of tiles on the phone's Home. */\nexport interface PhoneHomeGroup {\n id: string\n /** Absent for a group drawn without a heading. */\n label?: string\n rows: NativeNavRow[]\n}\n\n/**\n * The phone's Home: every area of the scope as the same\n * tile, in the sidebar's own groups, then the scope's own places last\n * (Overview and Site settings in a site; Team and Workspace settings\n * everywhere). Nothing is ranked above anything else and nothing sits behind\n * a More.\n *\n * `list` is the scope's everyday list as the app shows it (`resolveNavList`\n * trimmed to the build's screens), `team` the workspace settings' Members row\n * when the person may open it, and `ownerName` heads the whole workspace's\n * areas, whose group has no heading of its own.\n */\nexport function phoneHomeGroups(\n list: ResolvedNavList,\n team: NativeNavRow | null,\n ownerName: string,\n): PhoneHomeGroup[] {\n const inSite = list.id === 'site'\n const own: NativeNavRow[] = []\n const groups: PhoneHomeGroup[] = []\n for (const group of list.groups) {\n if (group.dynamic) continue\n const rows = group.rows.filter((row) => row.screen !== 'shell.home')\n if (group.id === 'top' || group.id === 'settings') {\n own.push(...rows)\n continue\n }\n if (!rows.length) continue\n const label = PHONE_HOME_GROUP_LABELS[group.id] ?? group.label ?? (ownerName || undefined)\n groups.push({ id: group.id, ...(label ? { label } : {}), rows })\n }\n if (team) own.push({ ...team, label: PHONE_HOME_TEAM_LABEL })\n own.push(WORKSPACE_SETTINGS_ROW)\n groups.push({\n id: 'scope',\n label: inSite ? PHONE_HOME_SITE_GROUP_LABEL : PHONE_HOME_WORKSPACE_GROUP_LABEL,\n rows: own,\n })\n return groups\n}\n\n/** Whether a Home tile may go in the tab bar: an area, never Home itself or a settings mode. */\nexport function isTabPinnable(row: Pick<NativeNavRow, 'screen'>): boolean {\n return (\n row.screen !== 'shell.home' &&\n row.screen !== 'shell.workspaceSettings' &&\n row.screen !== 'shell.siteSettings'\n )\n}\n"],"names":["NATIVE_NAV_SHELL_SCREENS","nativeNavIcon","apple","android","nativeNavRef","surface","id","nativeNavHubSection","scope","href","label","screen","extra","console","icon","ref","ICONS","home","overview","sites","pages","media","settings","emails","members","roles","activity","plan","usage","invoices","billingSettings","plugins","branding","sso","profile","apiKeys","integrations","privacy","holds","importExport","ownership","delete","details","business","seo","tracking","theme","domain","security","errorPages","backup","HOME_ROW","order","WORKSPACE","groups","foldable","rows","dynamic","docs","SITE","consoleLabel","keywords","sections","ordered","map","row","index","HUB_DOCS","teamSection","billingSection","orgSettingsSection","hostAdminSection","setupRow","rowIcon","description","params","section","adminRow","route","requiresHostAdmin","settingsRow","WORKSPACE_SETTINGS","title","SITE_SETTINGS","CREATE","items","new","permission","hostRoles","NATIVE_NAV_MANIFEST","lists","create","shellScreens","elsewhere","where","assembleNativeNav","core","contributions","creates","byOrder","entries","entry","sort","a","b","list","group","listId","groupId","find","Error","some","push","item","target","NATIVE_CREATE_PERMISSION_REASON","NATIVE_CREATE_SITE_ROLE_REASON","NATIVE_CREATE_PLAN_REASON","resolveCreateList","manifest","enabledPluginIds","permissions","features","hostRole","on","Set","filter","pluginId","has","blocked","reason","includes","planFeature","blockedReason","resolveNavList","hostAdmin","shows","length","PHONE_HOME_GROUP_LABELS","more","PHONE_HOME_SITE_GROUP_LABEL","PHONE_HOME_WORKSPACE_GROUP_LABEL","PHONE_HOME_TEAM_LABEL","WORKSPACE_SETTINGS_ROW","phoneH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QACV1G,IAAI;QACJI,OAAOyI,SAASP,8BAA8BC;QAC9CrF,MAAM4F;IACR;IACA,OAAO9F;AACT;AAEA,8FAA8F,GAC9F,OAAO,SAASgG,cAAcrF,GAAiC;IAC7D,OACEA,IAAItD,MAAM,KAAK,gBACfsD,IAAItD,MAAM,KAAK,6BACfsD,IAAItD,MAAM,KAAK;AAEnB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/native-nav.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * THE NATIVE APPS' NAVIGATION, AS DATA (AGL-3943).\n *\n * One manifest both shells draw (docs/mobile/native-navigation.md): the\n * sidebar for the whole workspace, the sidebar inside one site, and the two\n * settings modes (the workspace's, and the site's, which merges the\n * console's Setup and Admin). Zach chose the site's groups on 2026-10-18:\n * an Analytics row, Starred, Website, Sell, Customers, More, Site settings.\n *\n * Every row names:\n * - the console's word for it (`label`), held to the console by\n * `apps/console/specs/native-nav-manifest.spec.ts`, which reads the\n * console's own tabs, sections and plugin declarations;\n * - one icon per idea, an SF Symbol and a Material Symbol;\n * - the native screen it opens (a plugin's declared screen, a core screen\n * spec, a site platform screen or a `shell.*` destination);\n * - the plugin it belongs to, so it hides when that plugin is off for the\n * workspace or the site.\n *\n * The core's own rows (Home, Analytics, Sites, Pages, Media, the settings\n * modes) are here; a plugin's rows are its own, in\n * `libs/plugins/<plugin>/src/lib/native-nav.ts` (`NATIVE_NAV_ROWS`), placed\n * into a list's group by `order` (docs/PACKAGES.md rule 3: the core never\n * names a plugin). `generate:native-contracts` assembles the two\n * (`assembleNativeNav`) into the manifest the apps read,\n * `ContractValues.nativeNavManifest`.\n *\n * NO IMPORTS, on purpose: the native apps read this through the generated\n * contracts, so it must stay a plain module.\n */\n\n/** A list the shells draw. */\nexport type NativeNavListId = 'workspace' | 'site' | 'workspaceSettings' | 'siteSettings'\n\n/** One icon per idea: the same row draws the same picture in both scopes. */\nexport interface NativeNavIcon {\n /** An SF Symbol name. */\n apple: string\n /** A Material Symbol name, as `AglynIcons.named` takes it. */\n android: string\n}\n\n/**\n * Where a row's console twin lives:\n * - `orgTab` / `hostTab`: a console tab, by its id (`org-nav-tabs.ts`,\n * `host-nav-tabs.ts`);\n * - `orgPluginTab` / `hostPluginTab`: a plugin's `orgNavItems` / `navItems`\n * entry, by its href;\n * - `orgPluginSection` / `hostPluginSection`: a section of a plugin's hub, as\n * `{href}/{sectionId}`;\n * - `setupSection`: a site's Setup section, by its id (`setup-sections.ts`);\n * - `hostAdminSection`, `orgSettingsSection`, `teamSection`,\n * `billingSection`: a section of those hubs, by its `Route` name;\n * - `consoleWidget`: a plugin's card, as `{slot}/{widgetId}`;\n * - `shell`: a place the app's shell owns (Home, Analytics' page, the\n * settings modes), whose console twin is the page named in `id`;\n * - `nativeOnly`: a native screen the console has no page for.\n */\nexport type NativeNavConsoleSurface =\n | 'orgTab'\n | 'hostTab'\n | 'orgPluginTab'\n | 'hostPluginTab'\n | 'orgPluginSection'\n | 'hostPluginSection'\n | 'setupSection'\n | 'hostAdminSection'\n | 'orgSettingsSection'\n | 'teamSection'\n | 'billingSection'\n | 'consoleWidget'\n | 'shell'\n | 'nativeOnly'\n\nexport interface NativeNavConsoleRef {\n surface: NativeNavConsoleSurface\n id: string\n}\n\n/** A section inside a row's area, as the console's section rail lists it. */\nexport interface NativeNavSection {\n id: string\n label: string\n screen: string\n params?: Record<string, string>\n /** Set only when the section belongs to another plugin than its row's. */\n pluginId?: string\n /** The help docs page for it; its row's, unless the console names its own. */\n docs?: string\n console: NativeNavConsoleRef\n}\n\n/** An action the area offers from its title bar (Scan stock, New product). */\nexport interface NativeNavAction {\n id: string\n label: string\n icon: NativeNavIcon\n screen: string\n params?: Record<string, string>\n}\n\nexport interface NativeNavRow {\n /** The idea's id: the same in every list that shows it (`media`). */\n id: string\n /** The console's word. */\n label: string\n /**\n * The console's word when the native label is a decision of its own\n * (a row the apps name differently from the console).\n */\n consoleLabel?: string\n icon: NativeNavIcon\n /** The native screen the row opens. */\n screen: string\n params?: Record<string, string>\n /** The plugin the row belongs to: off for the workspace or site, the row hides. */\n pluginId?: string\n /** Only a site admin sees the row, as only they see the console's Admin tab. */\n requiresHostAdmin?: boolean\n /** A settings row's one line, in the words the screens already use. */\n description?: string\n /** Search words besides the label, so typing \"billing\" finds Plan. */\n keywords?: string[]\n /** Where the row sits in its group, ascending; a plugin's row is placed by it. */\n order?: number\n /**\n * The help docs page for the place, as the console's own help names it\n * (its `docsTopic` and `docsAnchor`, or the page's `help` prop): a docs-site\n * path with its anchor, e.g. `/content-and-data/crm/overview#at-the-organization-level`.\n * The apps open it in the in-app browser, on the docs origin.\n */\n docs?: string\n sections?: NativeNavSection[]\n actions?: NativeNavAction[]\n console: NativeNavConsoleRef\n}\n\nexport interface NativeNavGroup {\n id: string\n /** The heading; absent for a group drawn without one. */\n label?: string\n /** Folded at rest unless it holds the screen in use, remembered per device. */\n foldable: boolean\n /** `starred`: the person's starred items for this scope, drawn by the shell. */\n dynamic?: 'starred'\n rows: NativeNavRow[]\n}\n\nexport interface NativeNavList {\n id: NativeNavListId\n /** The settings mode's title, after its owner's name (\"Juniper Street Co. settings\"). */\n title?: string\n groups: NativeNavGroup[]\n}\n\n/** A console place no row holds, and where the apps put it instead. */\nexport interface NativeNavElsewhere {\n console: NativeNavConsoleRef\n where: string\n}\n\n/** A plugin's row, and the list and group it goes in. */\nexport interface NativeNavContribution {\n list: NativeNavListId\n /** A group of that list, by id. */\n group: string\n row: NativeNavRow\n}\n\n/** Where the Create new menu is offered: the whole workspace, or one site. */\nexport type NativeNavCreateScope = 'workspace' | 'site'\n\n/**\n * One item of the Create new menu (\"+\" on the rail, the center tab on\n * phones): what the console offers to create from that scope, opening the\n * area's own create form.\n */\nexport interface NativeNavCreateItem {\n id: string\n /** The thing made, in the console's words (\"Draft order\", \"Service\"). */\n label: string\n icon: NativeNavIcon\n /** The native screen the item opens, with `params` that open its create form. */\n screen: string\n params?: Record<string, string>\n /** The plugin it belongs to: off for the workspace or site, the item is not offered. */\n pluginId?: string\n /** Only a site admin is offered it. */\n requiresHostAdmin?: boolean\n /** The workspace permission the console's create action asks for (`hosts.create`, `data.manage`). */\n permission?: string\n /** The site roles that may make it, as the rules hold them (`canWriteHostContent`). */\n hostRoles?: string[]\n /** The plan feature it needs; without it the item is shown blocked, with `blockedReason`. */\n planFeature?: string\n /** Why it is blocked when the plan lacks `planFeature`; the default reason otherwise. */\n blockedReason?: string\n /** Where it sits in the menu, ascending. */\n order?: number\n /** Where the console offers the same create action. */\n console: NativeNavConsoleRef\n}\n\n/** One scope's Create new menu. */\nexport interface NativeNavCreateList {\n scope: NativeNavCreateScope\n items: NativeNavCreateItem[]\n}\n\n/** A plugin's Create new item, and the scope that offers it. */\nexport interface NativeNavCreateContribution {\n scope: NativeNavCreateScope\n item: NativeNavCreateItem\n}\n\nexport interface NativeNavManifest {\n lists: NativeNavList[]\n /** The Create new menu per scope (AGL-3943). */\n create?: NativeNavCreateList[]\n /** Destinations the shells own, which no plugin registers. */\n shellScreens: string[]\n elsewhere: NativeNavElsewhere[]\n}\n\n/** The shells' own destinations. */\nexport const NATIVE_NAV_SHELL_SCREENS: readonly string[] = [\n 'shell.home',\n 'shell.analytics',\n 'shell.workspaceSettings',\n 'shell.siteSettings',\n]\n\n/** An icon pair, for the rows here and in the plugins. */\nexport const nativeNavIcon = (apple: string, android: string): NativeNavIcon => ({ apple, android })\n\n/** A console reference, for the rows here and in the plugins. */\nexport const nativeNavRef = (surface: NativeNavConsoleSurface, id: string): NativeNavConsoleRef => ({\n surface,\n id,\n})\n\n/** A section of a plugin hub, at the scope its row stands in. */\nexport function nativeNavHubSection(\n scope: 'org' | 'host',\n href: string,\n id: string,\n label: string,\n screen: string,\n extra: Partial<Pick<NativeNavSection, 'params' | 'pluginId'>> = {},\n): NativeNavSection {\n return {\n id,\n label,\n screen,\n ...extra,\n console: nativeNavRef(scope === 'org' ? 'orgPluginSection' : 'hostPluginSection', `${href}/${id}`),\n }\n}\n\nconst icon = nativeNavIcon\nconst ref = nativeNavRef\n\nconst ICONS = {\n home: icon('house', 'home'),\n overview: icon('chart.bar', 'bar_chart'),\n sites: icon('globe', 'public'),\n pages: icon('doc.text', 'description'),\n media: icon('photo.on.rectangle', 'photo_library'),\n settings: icon('gearshape', 'settings'),\n emails: icon('envelope', 'mail'),\n members: icon('person.2', 'group'),\n roles: icon('person.badge.key', 'admin_panel_settings'),\n activity: icon('clock.arrow.circlepath', 'history'),\n plan: icon('creditcard', 'credit_card'),\n usage: icon('gauge.with.dots.needle.33percent', 'data_usage'),\n invoices: icon('doc.plaintext', 'receipt_long'),\n billingSettings: icon('slider.horizontal.3', 'tune'),\n plugins: icon('puzzlepiece.extension', 'extension'),\n branding: icon('paintbrush', 'brush'),\n sso: icon('key.viewfinder', 'vpn_key'),\n profile: icon('building.2', 'apartment'),\n apiKeys: icon('key', 'key'),\n integrations: icon('point.3.connected.trianglepath.dotted', 'hub'),\n privacy: icon('hand.raised', 'privacy_tip'),\n holds: icon('exclamationmark.triangle', 'warning'),\n importExport: icon('arrow.up.arrow.down', 'sync'),\n ownership: icon('person.crop.circle.badge.checkmark', 'manage_accounts'),\n delete: icon('trash', 'delete_forever'),\n details: icon('info.circle', 'info'),\n business: icon('briefcase', 'business'),\n seo: icon('magnifyingglass', 'travel_explore'),\n tracking: icon('chart.line.uptrend.xyaxis', 'query_stats'),\n theme: icon('paintpalette', 'palette'),\n domain: icon('link', 'domain'),\n security: icon('lock', 'security'),\n errorPages: icon('exclamationmark.circle', 'error_outline'),\n backup: icon('square.and.arrow.down', 'backup'),\n} as const\n\nconst HOME_ROW: NativeNavRow = {\n id: 'home',\n label: 'Home',\n icon: ICONS.home,\n screen: 'shell.home',\n order: 10,\n console: ref('shell', 'home'),\n}\n\nconst WORKSPACE: NativeNavList = {\n id: 'workspace',\n groups: [\n { id: 'top', foldable: false, rows: [HOME_ROW] },\n { id: 'starred', label: 'Starred', foldable: true, dynamic: 'starred', rows: [] },\n {\n id: 'workspace',\n foldable: false,\n rows: [\n {\n id: 'sites',\n label: 'Sites',\n icon: ICONS.sites,\n screen: 'site.sites',\n order: 10,\n docs: '/getting-started/console-tour#the-sites-list',\n console: ref('orgTab', 'nav-tab-org-sites'),\n },\n {\n id: 'media',\n label: 'Media',\n icon: ICONS.media,\n screen: 'site.media',\n order: 90,\n console: ref('orgTab', 'nav-tab-org-media'),\n },\n ],\n },\n ],\n}\n\nconst SITE: NativeNavList = {\n id: 'site',\n groups: [\n {\n id: 'top',\n foldable: false,\n rows: [\n HOME_ROW,\n {\n id: 'overview',\n // \"Analytics\", the console's own word: \"Overview\" read as a second Home (AGL-4011).\n label: 'Analytics',\n consoleLabel: 'Analytics',\n icon: ICONS.overview,\n screen: 'shell.analytics',\n order: 20,\n keywords: ['analytics', 'traffic', 'visitors'],\n console: ref('hostTab', 'nav-tab-analytics'),\n },\n ],\n },\n { id: 'starred', label: 'Starred', foldable: true, dynamic: 'starred', rows: [] },\n {\n id: 'website',\n label: 'Website',\n foldable: true,\n rows: [\n {\n id: 'pages',\n label: 'Pages',\n icon: ICONS.pages,\n screen: 'site.pages',\n order: 10,\n sections: [\n { id: 'pages', label: 'Pages', screen: 'site.pages', console: ref('hostTab', 'nav-tab-screens') },\n { id: 'components', label: 'Components', screen: 'site.components', console: ref('hostTab', 'nav-tab-components') },\n { id: 'layouts', label: 'Layouts', screen: 'site.layouts', console: ref('hostTab', 'nav-tab-layouts') },\n { id: 'templates', label: 'Templates', screen: 'site.templates', console: ref('hostTab', 'nav-tab-templates') },\n { id: 'content', label: 'Content', screen: 'site.content', console: ref('hostTab', 'nav-tab-content') },\n ],\n console: ref('hostTab', 'nav-tab-screens'),\n },\n {\n id: 'media',\n label: 'Media',\n icon: ICONS.media,\n screen: 'site.media',\n order: 20,\n console: ref('hostTab', 'nav-tab-media'),\n },\n ],\n },\n { id: 'sell', label: 'Sell', foldable: true, rows: [] },\n { id: 'customers', label: 'Customers', foldable: true, rows: [] },\n { id: 'more', label: 'More', foldable: true, rows: [] },\n {\n id: 'settings',\n foldable: false,\n rows: [\n {\n id: 'siteSettings',\n label: 'Site settings',\n icon: ICONS.settings,\n screen: 'shell.siteSettings',\n order: 10,\n console: ref('shell', 'siteSettings'),\n },\n ],\n },\n ],\n}\n\n/** Each row's place, in the order written. */\nconst ordered = (rows: NativeNavRow[]): NativeNavRow[] =>\n rows.map((row, index) => ({ ...row, order: row.order ?? (index + 1) * 10 }))\n\n/** The help page each settings hub's `help` prop names, the rows' docs. */\nconst HUB_DOCS: Partial<Record<NativeNavConsoleSurface, string>> = {\n teamSection: '/workspace-and-billing/teams-and-roles/overview#team-page',\n billingSection: '/workspace-and-billing/billing-and-plans/overview#billing-page',\n orgSettingsSection: '/getting-started/console-tour#organization-settings',\n hostAdminSection: '/getting-started/create-a-site#site-admin',\n}\n\nconst setupRow = (\n id: string,\n label: string,\n rowIcon: NativeNavIcon,\n description: string,\n keywords?: string[],\n): NativeNavRow => ({\n id,\n label,\n icon: rowIcon,\n screen: id === 'theme' ? 'site.theme' : 'site.setup',\n ...(id === 'theme' ? {} : { params: { section: id } }),\n description,\n ...(keywords ? { keywords } : {}),\n console: ref('setupSection', id),\n})\n\nconst adminRow = (\n id: string,\n label: string,\n rowIcon: NativeNavIcon,\n screen: string,\n route: string,\n): NativeNavRow => ({\n id,\n label,\n icon: rowIcon,\n screen,\n requiresHostAdmin: true,\n docs: HUB_DOCS.hostAdminSection,\n console: ref('hostAdminSection', route),\n})\n\nconst settingsRow = (\n surface: NativeNavConsoleSurface,\n id: string,\n label: string,\n rowIcon: NativeNavIcon,\n screen: string,\n route: string,\n extra: Partial<Pick<NativeNavRow, 'keywords' | 'order'>> = {},\n): NativeNavRow => ({\n id,\n label,\n icon: rowIcon,\n screen,\n ...extra,\n ...(HUB_DOCS[surface] ? { docs: HUB_DOCS[surface] } : {}),\n console: ref(surface, route),\n})\n\nconst WORKSPACE_SETTINGS: NativeNavList = {\n id: 'workspaceSettings',\n title: 'settings',\n groups: [\n {\n id: 'team',\n label: 'Team',\n foldable: false,\n rows: ordered([\n settingsRow('teamSection', 'members', 'Members', ICONS.members, 'core.team', 'MANAGE_TEAM_MEMBERS', { keywords: ['team', 'invite', 'people'] }),\n settingsRow('teamSection', 'roles', 'Custom roles', ICONS.roles, 'core.team.roles', 'MANAGE_TEAM_ROLES', { keywords: ['permissions'] }),\n settingsRow('teamSection', 'activity', 'Recent activity', ICONS.activity, 'core.team.activity', 'MANAGE_TEAM_ACTIVITY', { keywords: ['audit log'] }),\n ]),\n },\n {\n id: 'billing',\n label: 'Billing',\n foldable: false,\n rows: [\n settingsRow('billingSection', 'plan', 'Plan', ICONS.plan, 'core.billing', 'MANAGE_BILLING', { order: 10, keywords: ['billing', 'upgrade', 'subscription'] }),\n settingsRow('billingSection', 'usage', 'Usage', ICONS.usage, 'core.billing.usage', 'MANAGE_BILLING_USAGE', { order: 20, keywords: ['billing', 'limits'] }),\n settingsRow('billingSection', 'invoices', 'Invoices', ICONS.invoices, 'core.billing.invoices', 'MANAGE_BILLING_INVOICES', { order: 40, keywords: ['billing', 'receipts'] }),\n settingsRow('billingSection', 'billingSettings', 'Settings', ICONS.billingSettings, 'core.billing.settings', 'MANAGE_BILLING_SETTINGS', { order: 50, keywords: ['billing', 'payment method', 'tax'] }),\n ],\n },\n {\n id: 'workspace',\n label: 'Workspace',\n foldable: false,\n rows: ordered([\n settingsRow('orgTab', 'plugins', 'Plugins', ICONS.plugins, 'core.plugins', 'nav-tab-org-plugins'),\n settingsRow('orgSettingsSection', 'branding', 'Branding', ICONS.branding, 'core.settings.branding', 'ORG_SETTINGS_BRANDING', { keywords: ['white label', 'logo', 'colors'] }),\n settingsRow('orgSettingsSection', 'sso', 'Single sign-on', ICONS.sso, 'core.settings.sso', 'ORG_SETTINGS_SSO', { keywords: ['sso', 'saml'] }),\n settingsRow('orgSettingsSection', 'profile', 'Profile', ICONS.profile, 'core.settings.profile', 'ORG_SETTINGS_PROFILE'),\n settingsRow('orgSettingsSection', 'apiKeys', 'API keys', ICONS.apiKeys, 'core.settings.apiKeys', 'ORG_SETTINGS_API_KEYS'),\n settingsRow('orgSettingsSection', 'integrations', 'Integrations', ICONS.integrations, 'core.settings.integrations', 'ORG_SETTINGS_INTEGRATIONS'),\n settingsRow('orgSettingsSection', 'general', 'General', ICONS.settings, 'core.settings.general', 'ORG_SETTINGS_GENERAL', { keywords: ['name', 'address'] }),\n ]),\n },\n {\n id: 'data',\n label: 'Data & compliance',\n foldable: false,\n rows: ordered([\n settingsRow('orgSettingsSection', 'privacy', 'Privacy', ICONS.privacy, 'core.settings.privacy', 'ORG_SETTINGS_PRIVACY', { keywords: ['gdpr', 'erase'] }),\n settingsRow('orgSettingsSection', 'holds', 'Holds & reviews', ICONS.holds, 'core.settings.holds', 'ORG_SETTINGS_HOLDS'),\n settingsRow('orgSettingsSection', 'importExport', 'Import & export', ICONS.importExport, 'core.settings.data', 'ORG_SETTINGS_DATA', { keywords: ['csv', 'export'] }),\n ]),\n },\n {\n id: 'danger',\n label: 'Danger zone',\n foldable: false,\n rows: ordered([\n settingsRow('orgSettingsSection', 'ownership', 'Ownership', ICONS.ownership, 'core.settings.ownership', 'ORG_SETTINGS_OWNERSHIP', { keywords: ['transfer'] }),\n settingsRow('orgSettingsSection', 'delete', 'Delete', ICONS.delete, 'core.settings.delete', 'ORG_SETTINGS_DELETE'),\n ]),\n },\n ],\n}\n\nconst SITE_SETTINGS: NativeNavList = {\n id: 'siteSettings',\n title: 'settings',\n groups: [\n {\n id: 'people',\n foldable: false,\n rows: ordered([\n {\n id: 'users',\n label: 'Users',\n icon: ICONS.members,\n screen: 'core.site.users',\n keywords: ['team', 'collaborators'],\n console: ref('hostTab', 'nav-tab-users'),\n },\n ]),\n },\n {\n id: 'setup',\n label: 'Setup',\n foldable: false,\n rows: ordered([\n setupRow('details', 'Basic details', ICONS.details, 'Logo, layout and languages'),\n setupRow('business', 'Business profile', ICONS.business, 'What the business is, for everything that writes about it'),\n setupRow('seo', 'SEO', ICONS.seo, 'Search title, social image, business profile and verification', ['search']),\n setupRow('tracking', 'Tracking', ICONS.tracking, 'Analytics, ad tags and the consent banner', ['cookies', 'pixels']),\n setupRow('theme', 'Theme', ICONS.theme, 'Colors, font, shape and your saved themes', ['colors', 'fonts']),\n setupRow('emails', 'Emails', ICONS.emails, 'The emails your site sends to customers'),\n setupRow('integrations', 'Integrations', ICONS.integrations, 'Email platforms, Zapier, live chat and the other tools your site connects to'),\n ]),\n },\n {\n id: 'admin',\n label: 'Admin',\n foldable: false,\n rows: ordered([\n adminRow('general', 'General', ICONS.settings, 'core.site.general', 'HOST_ADMIN_GENERAL'),\n adminRow('plugins', 'Plugins', ICONS.plugins, 'core.site.plugins', 'HOST_ADMIN_PLUGINS'),\n adminRow('domain', 'Custom Domain', ICONS.domain, 'core.site.domain', 'HOST_ADMIN_DOMAIN'),\n adminRow('security', 'Security', ICONS.security, 'core.site.security', 'HOST_ADMIN_SECURITY'),\n adminRow('errorPages', 'Error pages', ICONS.errorPages, 'core.site.errorPages', 'HOST_ADMIN_ERROR_PAGES'),\n adminRow('activity', 'Activity', ICONS.activity, 'core.site.activity', 'HOST_ADMIN_ACTIVITY'),\n adminRow('backup', 'Backup & template', ICONS.backup, 'core.site.backup', 'HOST_ADMIN_BACKUP'),\n adminRow('danger', 'Danger zone', ICONS.delete, 'core.site.delete', 'HOST_ADMIN_DANGER'),\n ]),\n },\n ],\n}\n\nconst CREATE: NativeNavCreateList[] = [\n {\n scope: 'workspace',\n items: [\n {\n id: 'site',\n label: 'Site',\n icon: ICONS.sites,\n screen: 'site.sites',\n params: { new: '1' },\n permission: 'hosts.create',\n order: 10,\n console: ref('orgTab', 'nav-tab-org-sites'),\n },\n ],\n },\n {\n scope: 'site',\n items: [\n {\n id: 'page',\n label: 'Page',\n icon: ICONS.pages,\n screen: 'site.pages',\n params: { new: '1' },\n hostRoles: ['admin', 'editor', 'author'],\n order: 10,\n console: ref('hostTab', 'nav-tab-screens'),\n },\n ],\n },\n]\n\n/**\n * The core's half of the manifest: every list and group, and the core's own\n * rows. The manifest the apps read (`ContractValues.nativeNavManifest`) is\n * this with each plugin's `NATIVE_NAV_ROWS` placed by `assembleNativeNav`.\n */\nexport const NATIVE_NAV_MANIFEST: NativeNavManifest = {\n lists: [WORKSPACE, SITE, WORKSPACE_SETTINGS, SITE_SETTINGS],\n create: CREATE,\n shellScreens: [...NATIVE_NAV_SHELL_SCREENS],\n elsewhere: [\n { console: ref('hostTab', 'nav-tab-dashboard'), where: 'Home, inside the site (shell.home)' },\n { console: ref('hostTab', 'nav-tab-setup'), where: 'Site settings → Setup' },\n { console: ref('hostTab', 'nav-tab-admin'), where: 'Site settings → Admin' },\n { console: ref('orgTab', 'nav-tab-org-team'), where: 'Workspace settings → Team' },\n { console: ref('orgTab', 'nav-tab-org-billing'), where: 'Workspace settings → Billing' },\n { console: ref('orgTab', 'nav-tab-org-settings'), where: 'Workspace settings' },\n { console: ref('orgTab', 'nav-tab-org-support'), where: 'Help menu → Contact support (core.support)' },\n ],\n}\n\n/**\n * The manifest with the plugins' rows placed: each into its list's group by\n * `order` (a tie keeps the core's row first, then registration order). A row\n * naming a list or group the core does not have is refused by name, so a\n * plugin cannot quietly invent a group.\n */\nexport function assembleNativeNav(\n core: NativeNavManifest,\n contributions: readonly NativeNavContribution[],\n elsewhere: readonly NativeNavElsewhere[] = [],\n creates: readonly NativeNavCreateContribution[] = [],\n): NativeNavManifest {\n const byOrder = <T extends { order?: number }>(entries: T[]): T[] =>\n entries\n .map((entry, index) => ({ entry, index }))\n .sort((a, b) => (a.entry.order ?? 0) - (b.entry.order ?? 0) || a.index - b.index)\n .map(({ entry }) => entry)\n const lists = core.lists.map((list) => ({\n ...list,\n groups: list.groups.map((group) => ({ ...group, rows: [...group.rows] })),\n }))\n for (const { list: listId, group: groupId, row } of contributions) {\n const group = lists.find((list) => list.id === listId)?.groups.find((entry) => entry.id === groupId)\n if (!group || group.dynamic) {\n throw new Error(`native nav: ${row.id} names ${listId}/${groupId}, which is not a group of rows`)\n }\n if (group.rows.some((entry) => entry.id === row.id)) {\n throw new Error(`native nav: ${listId}/${groupId} holds ${row.id} twice`)\n }\n group.rows.push(row)\n }\n for (const list of lists) {\n for (const group of list.groups) {\n // A section is helped by its row's page unless the console names its own.\n group.rows = byOrder(group.rows).map((row) =>\n row.docs && row.sections\n ? { ...row, sections: row.sections.map((section) => (section.docs ? section : { ...section, docs: row.docs })) }\n : row,\n )\n }\n }\n const create = (core.create ?? []).map((entry) => ({ ...entry, items: [...entry.items] }))\n for (const { scope, item } of creates) {\n const target = create.find((entry) => entry.scope === scope)\n if (!target) throw new Error(`native nav: create item ${item.id} names ${scope}, which has no menu`)\n if (target.items.some((entry) => entry.id === item.id)) {\n throw new Error(`native nav: the ${scope} create menu holds ${item.id} twice`)\n }\n target.items.push(item)\n }\n return {\n ...core,\n lists,\n create: create.map((entry) => ({ ...entry, items: byOrder(entry.items) })),\n elsewhere: [...core.elsewhere, ...elsewhere],\n }\n}\n\n/** What a Create new item that cannot be used says, when its own reason does not apply. */\nexport const NATIVE_CREATE_PERMISSION_REASON =\n 'Your role does not include this permission — ask an organization admin.'\nexport const NATIVE_CREATE_SITE_ROLE_REASON = 'Your access to this site does not include this — ask an organization admin.'\nexport const NATIVE_CREATE_PLAN_REASON = \"Your plan doesn't include this. See the plans in Billing.\"\n\n/** A Create new item as one scope offers it. */\nexport interface ResolvedCreateItem extends NativeNavCreateItem {\n /** Shown, but disabled with `reason`: a prerequisite stands between the person and it. */\n blocked: boolean\n reason?: string\n}\n\n/**\n * The Create new menu for the workspace or site in hand. An item of a plugin\n * that is off is not offered, nor an admin-only item to a non-admin. One the\n * person may not use is SHOWN, disabled with its reason (prerequisites are\n * shown, never hidden): a permission or site role they lack, then a plan\n * feature the workspace lacks. `permissions` and `features` are the\n * workspace's resolved answers (an absent key is not held); `hostRole` is\n * the person's role on the site, null at the workspace.\n */\nexport function resolveCreateList(\n manifest: NativeNavManifest,\n scope: NativeNavCreateScope,\n enabledPluginIds: readonly string[],\n permissions: Readonly<Record<string, boolean>>,\n features: Readonly<Record<string, boolean>>,\n hostRole: string | null,\n): ResolvedCreateItem[] {\n const on = new Set(enabledPluginIds)\n const items = manifest.create?.find((entry) => entry.scope === scope)?.items ?? []\n return items\n .filter((item) => (!item.pluginId || on.has(item.pluginId)) && (!item.requiresHostAdmin || hostRole === 'admin'))\n .map((item): ResolvedCreateItem => {\n if (item.permission && permissions[item.permission] !== true) {\n return { ...item, blocked: true, reason: NATIVE_CREATE_PERMISSION_REASON }\n }\n if (item.hostRoles && !item.hostRoles.includes(hostRole ?? '')) {\n return { ...item, blocked: true, reason: NATIVE_CREATE_SITE_ROLE_REASON }\n }\n if (item.planFeature && features[item.planFeature] !== true) {\n return { ...item, blocked: true, reason: item.blockedReason ?? NATIVE_CREATE_PLAN_REASON }\n }\n return { ...item, blocked: false }\n })\n}\n\n/** A list as one scope shows it: rows for plugins that are off, or admin rows for a non-admin, left out. */\nexport interface ResolvedNavList {\n id: NativeNavListId\n title?: string\n groups: NativeNavGroup[]\n}\n\n/**\n * One list for the workspace or site in hand, from the assembled manifest\n * (`ContractValues.nativeNavManifest`). `enabledPluginIds` is the site's\n * effective set (`resolveHostEnabledPlugins`) in site scope and the\n * workspace's (`resolveEnabledPlugins`) otherwise. A section of another\n * plugin than its row's hides with that plugin. A group left with no rows is\n * dropped, except the starred group, which the shell fills.\n */\nexport function resolveNavList(\n manifest: NativeNavManifest,\n listId: NativeNavListId,\n enabledPluginIds: readonly string[],\n hostAdmin: boolean,\n): ResolvedNavList {\n const list = manifest.lists.find((entry) => entry.id === listId)\n if (!list) return { id: listId, groups: [] }\n const on = new Set(enabledPluginIds)\n const shows = (pluginId?: string) => !pluginId || on.has(pluginId)\n const groups: NativeNavGroup[] = []\n for (const group of list.groups) {\n const rows = group.rows\n .filter((row) => shows(row.pluginId) && (hostAdmin || !row.requiresHostAdmin))\n .map((row) =>\n row.sections\n ? { ...row, sections: row.sections.filter((section) => shows(section.pluginId)) }\n : row,\n )\n if (!rows.length && !group.dynamic) continue\n groups.push({ ...group, rows })\n }\n return { id: list.id, ...(list.title ? { title: list.title } : {}), groups }\n}\n\n// ── The phone's Home (AGL-4006) ─────────────────────────────────────────────\n\n/**\n * A group's heading on the phone's Home where it differs from the sidebar's.\n * Nothing on the phone reads \"More\", so the sidebar's More\n * group is headed Tools there.\n */\nexport const PHONE_HOME_GROUP_LABELS: Record<string, string> = { more: 'Tools' }\n\n/** The heading of the phone Home's last group: inside a site, and for the whole workspace. */\nexport const PHONE_HOME_SITE_GROUP_LABEL = 'Site & workspace'\nexport const PHONE_HOME_WORKSPACE_GROUP_LABEL = 'Settings'\n\n/** The Team tile's word: the console's tab for Members, Custom roles and Recent activity. */\nexport const PHONE_HOME_TEAM_LABEL = 'Team'\n\n/** The tile that opens Workspace settings on the phone's Home. */\nexport const WORKSPACE_SETTINGS_ROW: NativeNavRow = {\n id: 'workspaceSettings',\n label: 'Workspace settings',\n icon: ICONS.profile,\n screen: 'shell.workspaceSettings',\n console: ref('shell', 'workspaceSettings'),\n}\n\n/** One group of tiles on the phone's Home. */\nexport interface PhoneHomeGroup {\n id: string\n /** Absent for a group drawn without a heading. */\n label?: string\n rows: NativeNavRow[]\n}\n\n/**\n * The phone's Home: every area of the scope as the same\n * tile, in the sidebar's own groups, then the scope's own places last\n * (Overview and Site settings in a site; Team and Workspace settings\n * everywhere). Nothing is ranked above anything else and nothing sits behind\n * a More.\n *\n * `list` is the scope's everyday list as the app shows it (`resolveNavList`\n * trimmed to the build's screens), `team` the workspace settings' Members row\n * when the person may open it, and `ownerName` heads the whole workspace's\n * areas, whose group has no heading of its own.\n */\nexport function phoneHomeGroups(\n list: ResolvedNavList,\n team: NativeNavRow | null,\n ownerName: string,\n): PhoneHomeGroup[] {\n const inSite = list.id === 'site'\n const own: NativeNavRow[] = []\n const groups: PhoneHomeGroup[] = []\n for (const group of list.groups) {\n if (group.dynamic) continue\n const rows = group.rows.filter((row) => row.screen !== 'shell.home')\n if (group.id === 'top' || group.id === 'settings') {\n own.push(...rows)\n continue\n }\n if (!rows.length) continue\n const label = PHONE_HOME_GROUP_LABELS[group.id] ?? group.label ?? (ownerName || undefined)\n groups.push({ id: group.id, ...(label ? { label } : {}), rows })\n }\n if (team) own.push({ ...team, label: PHONE_HOME_TEAM_LABEL })\n own.push(WORKSPACE_SETTINGS_ROW)\n groups.push({\n id: 'scope',\n label: inSite ? PHONE_HOME_SITE_GROUP_LABEL : PHONE_HOME_WORKSPACE_GROUP_LABEL,\n rows: own,\n })\n return groups\n}\n\n/** Whether a Home tile may go in the tab bar: an area, never Home itself or a settings mode. */\nexport function isTabPinnable(row: Pick<NativeNavRow, 'screen'>): boolean {\n return (\n row.screen !== 'shell.home' &&\n row.screen !== 'shell.workspaceSettings' &&\n row.screen !== 'shell.siteSettings'\n )\n}\n"],"names":["NATIVE_NAV_SHELL_SCREENS","nativeNavIcon","apple","android","nativeNavRef","surface","id","nativeNavHubSection","scope","href","label","screen","extra","console","icon","ref","ICONS","home","overview","sites","pages","media","settings","emails","members","roles","activity","plan","usage","invoices","billingSettings","plugins","branding","sso","profile","apiKeys","integrations","privacy","holds","importExport","ownership","delete","details","business","seo","tracking","theme","domain","security","errorPages","backup","HOME_ROW","order","WORKSPACE","groups","foldable","rows","dynamic","docs","SITE","consoleLabel","keywords","sections","ordered","map","row","index","HUB_DOCS","teamSection","billingSection","orgSettingsSection","hostAdminSection","setupRow","rowIcon","description","params","section","adminRow","route","requiresHostAdmin","settingsRow","WORKSPACE_SETTINGS","title","SITE_SETTINGS","CREATE","items","new","permission","hostRoles","NATIVE_NAV_MANIFEST","lists","create","shellScreens","elsewhere","where","assembleNativeNav","core","contributions","creates","byOrder","entries","entry","sort","a","b","list","group","listId","groupId","find","Error","some","push","item","target","NATIVE_CREATE_PERMISSION_REASON","NATIVE_CREATE_SITE_ROLE_REASON","NATIVE_CREATE_PLAN_REASON","resolveCreateList","manifest","enabledPluginIds","permissions","features","hostRole","on","Set","filter","pluginId","has","blocked","reason","includes","planFeature","blockedReason","resolveNavList","hostAdmin","shows","length","PHONE_HOME_GROUP_LABELS","more","PHONE_HOME_SITE_GROUP_LABEL","PHONE_HOME_WORKSPACE_GROUP_LABEL","PHONE_HOME_TEAM_LABEL","WORKSPACE_SETTINGS_ROW","phoneHomeGroups","team","ownerName","inSite","own","undefined","isTabPinnable"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GAED,4BAA4B;AAiM5B,kCAAkC,GAClC,OAAO,MAAMA,2BAA8C;IACzD;IACA;IACA;IACA;CACD,CAAA;AAED,wDAAwD,GACxD,OAAO,MAAMC,gBAAgB,CAACC,OAAeC,UAAoC,CAAA;QAAED;QAAOC;IAAQ,CAAA,EAAE;AAEpG,+DAA+D,GAC/D,OAAO,MAAMC,eAAe,CAACC,SAAkCC,KAAqC,CAAA;QAClGD;QACAC;IACF,CAAA,EAAE;AAEF,+DAA+D,GAC/D,OAAO,SAASC,oBACdC,KAAqB,EACrBC,IAAY,EACZH,EAAU,EACVI,KAAa,EACbC,MAAc,EACdC,QAAgE,CAAC,CAAC;IAElE,OAAO;QACLN;QACAI;QACAC;OACGC;QACHC,SAAST,aAAaI,UAAU,QAAQ,qBAAqB,qBAAqB,GAAGC,KAAK,CAAC,EAAEH,IAAI;;AAErG;AAEA,MAAMQ,OAAOb;AACb,MAAMc,MAAMX;AAEZ,MAAMY,QAAQ;IACZC,MAAMH,KAAK,SAAS;IACpBI,UAAUJ,KAAK,a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K,YAAY;YACjD8I,IAAIpC,IAAI,IAAIxD;YACZ;QACF;QACA,IAAI,CAACA,KAAKiF,MAAM,EAAE;QAClB,MAAM/H,SAAQgI,QAAAA,oCAAAA,uBAAuB,CAAChC,MAAMpG,EAAE,CAAC,YAAjCoI,oCAAqChC,MAAMhG,KAAK,YAAhDgI,OAAqDQ,aAAaG;QAChF/F,OAAO0D,IAAI,CAAC;YAAE1G,IAAIoG,MAAMpG,EAAE;WAAMI,QAAQ;YAAEA;QAAM,IAAI,CAAC;YAAI8C;;IAC3D;IACA,IAAIyF,MAAMG,IAAIpC,IAAI,CAAC,aAAKiC;QAAMvI,OAAOoI;;IACrCM,IAAIpC,IAAI,CAAC+B;IACTzF,OAAO0D,IAAI,CAAC;QACV1G,IAAI;QACJI,OAAOyI,SAASP,8BAA8BC;QAC9CrF,MAAM4F;IACR;IACA,OAAO9F;AACT;AAEA,8FAA8F,GAC9F,OAAO,SAASgG,cAAcrF,GAAiC;IAC7D,OACEA,IAAItD,MAAM,KAAK,gBACfsD,IAAItD,MAAM,KAAK,6BACfsD,IAAItD,MAAM,KAAK;AAEnB"}
|
|
@@ -25,13 +25,15 @@ import { hostScopeToken, ORG_SCOPE_TOKEN, visibleToTokens } from "./scope-tokens
|
|
|
25
25
|
* Org workspace slugs ride the host reserved/profanity blocklist plus
|
|
26
26
|
* console-specific labels the workspace router must own. `kiosk` is the
|
|
27
27
|
* console's public device route (AGL-3608), which a static segment serves
|
|
28
|
-
* ahead of any workspace of that name
|
|
28
|
+
* ahead of any workspace of that name; `oauth` is the connector consent page
|
|
29
|
+
* (AGL-4225), the same way.
|
|
29
30
|
*/ const RESERVED_ORG_ONLY = new Set([
|
|
30
31
|
'staff',
|
|
31
32
|
'org',
|
|
32
33
|
'orgs',
|
|
33
34
|
'workspace',
|
|
34
|
-
'kiosk'
|
|
35
|
+
'kiosk',
|
|
36
|
+
'oauth'
|
|
35
37
|
]);
|
|
36
38
|
/**
|
|
37
39
|
* The label this deployment serves its own console on, when it has one
|