@tokenoftrust/storefront-runner 6.8.0 → 6.8.1

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.
@@ -96,9 +96,9 @@ const PACT_REPORTING_CAPTURE_WIRED = true;
96
96
  * regulated tenant (the caller must then fail closed). Wires the live verification
97
97
  * provider from env. An unregulated tenant returns `null` too — callers key on
98
98
  * {@link isRegulatedTenant} to distinguish "no ruleset needed" from "fail closed".
99
- * A store that declared `compliance.ageVerificationRequired: false` gets the profile's
100
- * rules without checkout verification — unless it sells nicotine, where
101
- * `ageVerificationRequired` keeps the profile's verification requirement.
99
+ * A declared rule profile always keeps its checkout verification requirement:
100
+ * `ageVerificationRequired` holds for every store that declares a `ruleProfile`, so
101
+ * `compliance.ageVerificationRequired: false` cannot weaken it.
102
102
  */
103
103
  export async function resolveTenantRuleset(
104
104
  tenant: Pick<TenantConfig, "tenant_id" | "compliance">,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "6.8.0",
3
+ "version": "6.8.1",
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",
@@ -399,11 +399,12 @@ export const COMPLIANCE_OBLIGATIONS = Object.freeze([
399
399
  /**
400
400
  * Does the declared block require age/identity verification? Mirrors
401
401
  * `ageVerificationRequired` in compliance-obligations.ts: required unless
402
- * `ageVerificationRequired: false`, and always for a store that sells nicotine.
402
+ * `ageVerificationRequired: false`, and always for a store that sells nicotine
403
+ * (`nicotineWarning`) or declares a `ruleProfile`.
403
404
  * @param {Record<string, any> | null | undefined} compliance
404
405
  */
405
406
  export function declaresAgeVerificationRequired(compliance) {
406
- return compliance?.ageVerificationRequired !== false || !!compliance?.nicotineWarning;
407
+ return compliance?.ageVerificationRequired !== false || !!compliance?.nicotineWarning || !!compliance?.ruleProfile;
407
408
  }
408
409
 
409
410
  /**
@@ -584,10 +585,11 @@ export function complianceFindings(config, file = ".tot/config.json") {
584
585
  "`capabilities.exciseTax` cannot be disabled for a store with `compliance.nicotineWarning` or `compliance.exciseTax` — the hosted preview refuses this revision.",
585
586
  "Remove `capabilities.exciseTax.enabled: false` from .tot/config.json."));
586
587
  }
587
- if (compliance?.ageVerificationRequired === false && compliance?.nicotineWarning) {
588
+ if (compliance?.ageVerificationRequired === false && (compliance?.nicotineWarning || compliance?.ruleProfile)) {
588
589
  out.push(mk(WARN, "compliance-age-verification-policy", `${file} compliance`,
589
590
  "`compliance.ageVerificationRequired: false` has no effect on a store that sells nicotine " +
590
- "(`compliance.nicotineWarning`): platform policy keeps age/ID verification required at checkout.",
591
+ "(`compliance.nicotineWarning` or `compliance.ruleProfile`): platform policy keeps age/ID " +
592
+ "verification required at checkout.",
591
593
  "Remove `compliance.ageVerificationRequired` from .tot/config.json, or turn only the arrival popup off " +
592
594
  "with `features.ageGate: false`."));
593
595
  }
@@ -40,12 +40,14 @@ export type ObligationTenant = Pick<TenantConfig, "compliance" | "siteType"> &
40
40
  /**
41
41
  * Does this store require age/identity verification? Required unless the store
42
42
  * declares `compliance.ageVerificationRequired: false`, and always required for a
43
- * store that sells nicotine (`compliance.nicotineWarning`): that is platform policy,
44
- * not a store setting. Governs the `age_gate` duty and checkout verification.
43
+ * store that sells nicotine (`compliance.nicotineWarning`) or declares a
44
+ * `compliance.ruleProfile` (every profile is a nicotine/ENDS ruleset): that is
45
+ * platform policy, not a store setting. Governs the `age_gate` duty and checkout
46
+ * verification.
45
47
  */
46
48
  export function ageVerificationRequired(tenant: Pick<TenantConfig, "compliance">): boolean {
47
49
  const c = tenant.compliance;
48
- return c?.ageVerificationRequired !== false || !!c?.nicotineWarning;
50
+ return c?.ageVerificationRequired !== false || !!c?.nicotineWarning || !!c?.ruleProfile;
49
51
  }
50
52
 
51
53
  /**
@@ -318,8 +318,9 @@ export interface ComplianceConfig {
318
318
  /**
319
319
  * Whether this store requires age/identity verification at all. Undeclared means
320
320
  * required. `false` waives the verification duty and checkout verification, except
321
- * for a store that sells nicotine (`nicotineWarning`), where platform policy keeps
322
- * it required (`ageVerificationRequired` in compliance-obligations.ts). The arrival
321
+ * for a store that sells nicotine (`nicotineWarning`) or declares a `ruleProfile`,
322
+ * where platform policy keeps it required (`ageVerificationRequired` in
323
+ * compliance-obligations.ts). The arrival
323
324
  * popup is a separate declaration, `features.ageGate`.
324
325
  */
325
326
  ageVerificationRequired?: boolean;