@tokenoftrust/storefront-runner 2.4.41 → 2.4.43

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.
@@ -14,7 +14,7 @@
14
14
  "preview": "wrangler dev",
15
15
  "typecheck": "astro check && tsc --noEmit",
16
16
  "astro": "astro",
17
- "test": "NODE_OPTIONS=--experimental-sqlite vitest run && pnpm run test:pipeline && pnpm run test:pipeline-faults"
17
+ "test": "NODE_OPTIONS=--experimental-sqlite vitest run --exclude src/lib/apps/v84CleanCloneReplay.test.ts --exclude src/lib/apps/v84NonportableRouteDogfood.test.ts --exclude src/lib/apps/v84CloneLifecycleEvidence.test.ts && NODE_OPTIONS=--experimental-sqlite vitest run src/lib/apps/v84CleanCloneReplay.test.ts src/lib/apps/v84NonportableRouteDogfood.test.ts src/lib/apps/v84CloneLifecycleEvidence.test.ts --fileParallelism=false && pnpm run test:pipeline && pnpm run test:pipeline-faults"
18
18
  },
19
19
  "dependencies": {
20
20
  "@astrojs/cloudflare": "^14.0.1",
@@ -25,7 +25,7 @@ import { getTenantResolver } from "@/config/resolver";
25
25
  import { readEnv, readKv, readR2 } from "@/lib/runtimeEnv";
26
26
  import { resolveCdnForwardRouting, resolveTenantRouting } from "@/lib/tenantRouting";
27
27
  import { crossSiteFormRefusal, verifyCdnForward } from "@/lib/cdnForward";
28
- import { compileRouteTierIndexV1, resolvePublicationRoutePlanV1, type RouteTierIndexV1 } from "@tot/public-runtime";
28
+ import { compileRouteTierIndexV1, resolvePublicationRoutePlanV1, type RouteTierIndexV1 , storefrontModeRequiresSignIn } from "@tot/public-runtime";
29
29
  import type { PublicationArtifactBucketV1, TenantConfig } from "@tot/public-runtime";
30
30
  import { DEV_DRAFT_COOKIE } from "@/lib/dev/devDraft";
31
31
  import { applySecurityHeaders } from "@/lib/securityHeaders";
@@ -165,7 +165,16 @@ async function serveRequest(
165
165
  }
166
166
 
167
167
  // ---- The one route classification -----------------------------------------
168
- const hostLoginGated = gateMode === "login" && hostInGateList(host, demoGateHosts);
168
+ // An EXPLICITLY unpaid store is never fully public: the ONLY way to reach its
169
+ // hosted URL is to sign in, regardless of the demo-gate host list or mode —
170
+ // a billing-state boundary, not a demo feature. storefrontModeRequiresSignIn
171
+ // NEVER fires on a merely-ABSENT storefront.mode (every real tenant today has
172
+ // it absent, same as a fixture/tenant that never engaged the concept) — only
173
+ // on an explicit non-"enabled" value, set deliberately via
174
+ // scripts/tenant/set-storefront-mode.mjs.
175
+ const hostLoginGated =
176
+ (gateMode === "login" && hostInGateList(host, demoGateHosts)) ||
177
+ storefrontModeRequiresSignIn(tenant.storefront?.mode);
169
178
  const { branch, route, publication } = resolveMiddlewareBranchV1({
170
179
  index: routeTierIndexFor(tenant),
171
180
  renderPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "2.4.41",
3
+ "version": "2.4.43",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",
@@ -401,6 +401,19 @@ export function storefrontModeAllowsGoLive(mode: string | undefined | null): boo
401
401
  return mode === STOREFRONT_MODE_ENABLED;
402
402
  }
403
403
 
404
+ /**
405
+ * PURE sign-in-gate predicate: must a visitor sign in before this tenant's hosted URL is
406
+ * reachable, on billing grounds alone? True iff the mode is EXPLICITLY set to something other
407
+ * than "enabled" — never on absence. Absence means the storefront-commerce concept has never
408
+ * been provisioned for this tenant at all (a non-commerce tenant, a test fixture, a tenant
409
+ * pre-dating this field), which must behave exactly as it always has; conflating that with a
410
+ * deliberate "not yet paid" is the bug this predicate exists to make impossible to write by hand.
411
+ * Turn this on for a real tenant with scripts/tenant/set-storefront-mode.mjs --mode=disabled.
412
+ */
413
+ export function storefrontModeRequiresSignIn(mode: string | undefined | null): boolean {
414
+ return mode != null && mode !== STOREFRONT_MODE_ENABLED;
415
+ }
416
+
404
417
  /**
405
418
  * Per-tenant capability switches. These gate whole surfaces so the same
406
419
  * component library renders both a store and a marketing site without any