@tokenoftrust/storefront-runner 7.7.3 → 7.8.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/apps/storefront/dev-plugins/dev-auth-outbox.mjs +5 -3
- package/apps/storefront/src/components/catalog/storefront/ProductCard.astro +13 -9
- package/apps/storefront/src/components/catalog/storefront/islands/SearchTypeahead.tsx +2 -2
- package/apps/storefront/src/components/catalog/storefront/islands/VariantSelector.tsx +6 -4
- package/apps/storefront/src/components/catalog/storefront/plp/FacetSidebar.astro +4 -3
- package/apps/storefront/src/components/catalog/storefront/plp/SortSelect.astro +3 -2
- package/apps/storefront/src/components/compliance/storefront/islands/CheckoutComplianceGate.tsx +39 -45
- package/apps/storefront/src/components/publication/storefront/islands/CatalogQueryView.tsx +7 -4
- package/apps/storefront/src/layouts/Layout.astro +11 -7
- package/apps/storefront/src/lib/access/auth/agentSessionGate.ts +1 -0
- package/apps/storefront/src/lib/access/auth/loginGate.ts +14 -0
- package/apps/storefront/src/lib/access/shared/tenantRouting.ts +3 -1
- package/apps/storefront/src/lib/assets/captured-original-serve.ts +61 -1
- package/apps/storefront/src/lib/catalog/search/index.ts +3 -4
- package/apps/storefront/src/lib/catalog/shared/catalogIndex.ts +12 -7
- package/apps/storefront/src/lib/catalog/shared/catalogQueryView.ts +4 -2
- package/apps/storefront/src/lib/catalog/tot/query.ts +2 -1
- package/apps/storefront/src/lib/checkout/commerce/cartSession.ts +10 -11
- package/apps/storefront/src/lib/checkout/commerce/checkoutHandoffRoute.ts +81 -14
- package/apps/storefront/src/lib/compliance/browser/checkoutVerificationFlow.ts +35 -0
- package/apps/storefront/src/lib/content/seo/structuredData.ts +3 -2
- package/apps/storefront/src/lib/content/shared/jsonld.ts +3 -2
- package/apps/storefront/src/lib/customers/accounts/catalogAdmission.ts +75 -0
- package/apps/storefront/src/lib/customers/accounts/checkoutProof.ts +133 -0
- package/apps/storefront/src/lib/customers/accounts/orgKyb.ts +12 -0
- package/apps/storefront/src/lib/customers/accounts/pricing.ts +25 -0
- package/apps/storefront/src/lib/customers/accounts/purchaseAccess.ts +45 -0
- package/apps/storefront/src/lib/customers/accounts/scope.ts +55 -0
- package/apps/storefront/src/lib/customers/accounts/session.ts +173 -0
- package/apps/storefront/src/lib/customers/accounts/shopperPricingClient.ts +69 -0
- package/apps/storefront/src/lib/engagement/contact/submitToken.ts +2 -1
- package/apps/storefront/src/lib/inventory/allocations.ts +8 -5
- package/apps/storefront/src/lib/membership/eligibility.ts +2 -23
- package/apps/storefront/src/lib/publication/shared/cdnForward.ts +10 -3
- package/apps/storefront/src/lib/publication/shared/staticQuery.ts +10 -3
- package/apps/storefront/src/middleware/index.ts +80 -6
- package/apps/storefront/src/middleware/renderChain.ts +43 -26
- package/apps/storefront/src/middleware/routeBranch.ts +1 -0
- package/apps/storefront/src/middleware/staticBundle.ts +43 -13
- package/apps/storefront/src/pages/_sitemap.ts +14 -7
- package/apps/storefront/src/pages/api/cart-proposal/confirm.ts +2 -1
- package/apps/storefront/src/pages/api/cart-proposal/review.ts +5 -2
- package/apps/storefront/src/pages/api/commerce/cart-session.ts +3 -0
- package/apps/storefront/src/pages/api/commerce/checkout-sessions/[id].ts +2 -1
- package/apps/storefront/src/pages/api/commerce/checkout-sessions.ts +3 -1
- package/apps/storefront/src/pages/api/commerce/final-cart-authorization.ts +43 -10
- package/apps/storefront/src/pages/api/compliance/preflight.ts +34 -5
- package/apps/storefront/src/pages/cart.ts +3 -0
- package/apps/storefront/src/pages/catalog-index.json.ts +3 -2
- package/apps/storefront/src/pages/collections/[handle]/page/[n].astro +2 -1
- package/apps/storefront/src/pages/collections/[handle].astro +2 -1
- package/apps/storefront/src/pages/collections/_CollectionView.astro +8 -4
- package/apps/storefront/src/pages/index.astro +5 -3
- package/apps/storefront/src/pages/llms.txt.ts +2 -1
- package/apps/storefront/src/pages/products/[handle].astro +52 -15
- package/apps/storefront/src/pages/saved.astro +2 -1
- package/package.json +1 -1
- package/packages/cli/src/declared-config.mjs +46 -1
- package/packages/public-runtime/src/checkout-orders.ts +9 -1
- package/packages/public-runtime/src/checkout.ts +1 -1
- package/packages/public-runtime/src/declared-tenant-config.d.mts +11 -1
- package/packages/public-runtime/src/declared-tenant-config.mjs +111 -1
- package/packages/public-runtime/src/publication-space.ts +1 -0
- package/packages/public-runtime/src/static-bundle.ts +28 -3
- package/packages/public-runtime/src/tenant.ts +15 -0
|
@@ -28,6 +28,11 @@ import { resolveStoreCurrency } from "@tot/public-runtime/declared-tenant-config
|
|
|
28
28
|
import { createContentProvider } from "@/lib/content/storyblok/provider";
|
|
29
29
|
import { createToTClient } from "@/lib/catalog/tot/ToTClient";
|
|
30
30
|
import { refusalSentence } from "@/lib/commerce/refusalSentence";
|
|
31
|
+
import { requiresShopperPurchase } from "@/lib/customers/accounts/purchaseAccess";
|
|
32
|
+
import { bindCheckoutSnapshot, readShopperCheckoutWire, shopperCheckoutAuthorizationGuard, shopperCheckoutContextDigest, shopperVerificationRefMatches, verifyCheckoutProof, type ShopperCheckoutWire } from "@/lib/customers/accounts/checkoutProof";
|
|
33
|
+
import { shopperOrgKyb } from "@/lib/customers/accounts/orgKyb";
|
|
34
|
+
import { shopperVariantPrice } from "@/lib/customers/accounts/pricing";
|
|
35
|
+
import { resolveShopperAccessPolicy } from "@tot/public-runtime/declared-tenant-config";
|
|
31
36
|
export const prerender = false;
|
|
32
37
|
const HEX = /^[a-f0-9]{64}$/;
|
|
33
38
|
/** The shopper's verification correlation handle, as the signed `verification` cart option carries it. */
|
|
@@ -77,7 +82,7 @@ async function digest(value: string): Promise<string> {
|
|
|
77
82
|
* from a closed vocabulary; no other key. Optional: a snapshot without it is read as before.
|
|
78
83
|
*/
|
|
79
84
|
export { EXCISE_REASONS, type ExciseCarrier, exciseLinesDigest, exciseReconcilesWithTotals, exciseRequiredForTenant, resolveTaxEvidence, checkoutStoreHasExciseProducer };
|
|
80
|
-
type FinalCartWire = CommerceProviderCartSnapshot & { excise?: ExciseCarrier };
|
|
85
|
+
type FinalCartWire = CommerceProviderCartSnapshot & { excise?: ExciseCarrier; shopperCheckout?: ShopperCheckoutWire };
|
|
81
86
|
export function readExcise(value: unknown): ExciseCarrier | null {
|
|
82
87
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
83
88
|
const e = value as Record<string, unknown>;
|
|
@@ -93,10 +98,12 @@ function readSnapshot(value: unknown): FinalCartWire | null {
|
|
|
93
98
|
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
94
99
|
const v = value as Record<string, unknown>;
|
|
95
100
|
const allowed = ["provider", "providerCartId", "providerCartDigest", "tenantId", "stage", "currency", "lines", "totals", "destinationDigest", "destination"];
|
|
96
|
-
const optional = ["expectedAuthorizationId", "verificationRef", "contentVersionId", "excise"];
|
|
101
|
+
const optional = ["expectedAuthorizationId", "verificationRef", "contentVersionId", "excise", "shopperCheckout", "checkoutContextDigest"];
|
|
97
102
|
if (Object.keys(v).some(k => !allowed.includes(k) && !optional.includes(k)) || allowed.some(k => !(k in v))) return null;
|
|
98
103
|
if ("excise" in v && !readExcise(v.excise)) return null;
|
|
99
104
|
if ("contentVersionId" in v && (typeof v.contentVersionId !== "string" || !isContentVersionId(v.contentVersionId))) return null;
|
|
105
|
+
if (("shopperCheckout" in v) !== ("checkoutContextDigest" in v)) return null;
|
|
106
|
+
if ("shopperCheckout" in v && (!readShopperCheckoutWire(v.shopperCheckout) || typeof v.checkoutContextDigest !== "string" || !HEX.test(v.checkoutContextDigest))) return null;
|
|
100
107
|
if ("expectedAuthorizationId" in v && (typeof v.expectedAuthorizationId !== "string" || !/^[a-z0-9][a-z0-9-]{0,80}$/.test(v.expectedAuthorizationId))) return null;
|
|
101
108
|
if ("verificationRef" in v && (typeof v.verificationRef !== "string" || !VERIFICATION_REF.test(v.verificationRef))) return null;
|
|
102
109
|
if (v.provider !== "foxycart" || typeof v.providerCartId !== "string" || !/^[a-zA-Z0-9._:-]{1,128}$/.test(v.providerCartId) ||
|
|
@@ -251,7 +258,8 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
251
258
|
let wire: FinalCartWire | null;
|
|
252
259
|
try { wire = readSnapshot(JSON.parse(raw)); } catch { wire = null; }
|
|
253
260
|
if (!wire || !await exciseBindsSnapshot(wire)) return deny("malformed-request");
|
|
254
|
-
const
|
|
261
|
+
const { shopperCheckout, ...safeWire } = wire;
|
|
262
|
+
const snapshot = keyedLines(safeWire);
|
|
255
263
|
const jwks = publicJwks(await readEnv("COMMERCE_CALLER_JWKS"));
|
|
256
264
|
const issuers = list(await readEnv("COMMERCE_CALLER_ISSUERS"));
|
|
257
265
|
const audience = await readEnv("COMMERCE_CALLER_AUDIENCE");
|
|
@@ -286,6 +294,18 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
286
294
|
if (err instanceof DeclaredTenantConfigUnreadError) return deny("config-unreadable", 503);
|
|
287
295
|
throw err;
|
|
288
296
|
}
|
|
297
|
+
const shopperRequired = requiresShopperPurchase(tenant);
|
|
298
|
+
if (shopperRequired && !shopperCheckout) return deny("shopper-checkout-proof-required");
|
|
299
|
+
if (shopperCheckout && await shopperCheckoutContextDigest(shopperCheckout) !== snapshot.checkoutContextDigest) return deny("shopper-checkout-context-mismatch");
|
|
300
|
+
const database = await readD1("STOREFRONT_APPS_DB");
|
|
301
|
+
if (!database) return deny("store-unconfigured", 503);
|
|
302
|
+
const queryable = fromD1(database);
|
|
303
|
+
const scopedProof = shopperCheckout ? await verifyCheckoutProof(queryable, snapshot, shopperCheckout) : null;
|
|
304
|
+
if (shopperCheckout && !scopedProof) return deny("shopper-checkout-proof-invalid");
|
|
305
|
+
if (scopedProof && snapshot.verificationRef && !await shopperVerificationRefMatches(scopedProof.shopper, snapshot.verificationRef)) {
|
|
306
|
+
return deny("shopper-verification-ref-invalid");
|
|
307
|
+
}
|
|
308
|
+
if (scopedProof?.shopper.checkoutLockMode === "require_step_up") return deny("shopper-step-up-required");
|
|
289
309
|
const content = contentVersionId
|
|
290
310
|
? createContentProvider(tenant, undefined, { get: kvGet, versionId: contentVersionId })
|
|
291
311
|
: createContentProvider(tenant, { get: kvGet, env: contentEnv });
|
|
@@ -321,7 +341,9 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
321
341
|
if (variants.length !== 1 || variants[0]!.id !== match.variant.id) return mismatch("variant-detail", index);
|
|
322
342
|
const variant = variants[0]!;
|
|
323
343
|
const digits = new Intl.NumberFormat("en", { style: "currency", currency: snapshot.currency }).resolvedOptions().maximumFractionDigits ?? 2;
|
|
324
|
-
const
|
|
344
|
+
const shopperPrice = scopedProof ? shopperVariantPrice(tenant, detail, variant, scopedProof.shopper.tierId) : null;
|
|
345
|
+
if (scopedProof && !shopperPrice) return mismatch("shopper-tier", index);
|
|
346
|
+
const scaled = (shopperPrice?.price ?? variant.price) * 10 ** digits;
|
|
325
347
|
if (!variant.inventory.available) return mismatch("unavailable", index);
|
|
326
348
|
if (variant.currency !== snapshot.currency) return mismatch("variant-currency", index);
|
|
327
349
|
if (Math.abs(scaled - Math.round(scaled)) > 0.000001) return mismatch("price-precision", index);
|
|
@@ -337,11 +359,8 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
337
359
|
try { owed = shippingMinorFor(tenant.shipping, snapshot.currency, snapshot.totals.subtotalMinor); } catch { return deny("shipping-unavailable"); }
|
|
338
360
|
if (snapshot.totals.shippingMinor !== owed) return deny("shipping-changed");
|
|
339
361
|
}
|
|
340
|
-
const database = await readD1("STOREFRONT_APPS_DB");
|
|
341
|
-
if (!database) return deny("store-unconfigured", 503);
|
|
342
362
|
if (tenant.inventory?.provider && tenant.inventory.provider !== "mirror") return deny("authority-unavailable");
|
|
343
363
|
const now = new Date().toISOString();
|
|
344
|
-
const queryable = fromD1(database);
|
|
345
364
|
for (const line of snapshot.lines) {
|
|
346
365
|
const reading = await readMirrorBalance(queryable, {
|
|
347
366
|
tenantId: snapshot.tenantId, stage: snapshot.stage, sku: line.sku, locationId: "unspecified",
|
|
@@ -374,7 +393,13 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
374
393
|
}
|
|
375
394
|
const stockExpiry = Math.min(...authorities.flatMap(authority => authority ? [Date.parse(authority.asOf) + 15 * 60_000] : []));
|
|
376
395
|
const evidence: CommerceEvidence = { verification: "absent", tax: "absent", risk: "absent", stock: stockTracked ? "fresh" : "not-required" };
|
|
377
|
-
const
|
|
396
|
+
const orgKybRequired = resolveShopperAccessPolicy(tenant).b2bKybOrgVerification;
|
|
397
|
+
const orgKyb = orgKybRequired && scopedProof ? await shopperOrgKyb(queryable, scopedProof.shopper,
|
|
398
|
+
shopperCheckout?.licensedDestinationDigest, snapshot.totals.totalMinor, new Date(now)) : null;
|
|
399
|
+
if (orgKybRequired && !orgKyb) return deny("shopper-org-kyb-review-required");
|
|
400
|
+
if (existing && orgKyb && Date.parse(existing.expiresAt) > Date.parse(orgKyb.expiresAt)) return deny("admission-expired");
|
|
401
|
+
const expiresAt = existing?.expiresAt ?? new Date(Math.min(Date.now() + 5 * 60_000, stockExpiry,
|
|
402
|
+
scopedProof?.expiresAt ?? Infinity, orgKyb ? Date.parse(orgKyb.expiresAt) : Infinity)).toISOString();
|
|
378
403
|
const provenance = {} as CommerceEvidenceProvenance;
|
|
379
404
|
for (const field of ["verification", "tax", "risk"] as const) {
|
|
380
405
|
if (policy[field] === "not-required") {
|
|
@@ -387,7 +412,7 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
387
412
|
: { requirement: "not-required", state: "not-required", source: "tenant-inventory-undeclared", policyRevision: "untracked-v1", expiresAt };
|
|
388
413
|
const presented: FinalCartBinding = { tenantId: snapshot.tenantId, stage: snapshot.stage, currency: snapshot.currency, lines: snapshot.lines,
|
|
389
414
|
destinationDigest: snapshot.destinationDigest, verificationExpiresAt: expiresAt, taxExpiresAt: expiresAt };
|
|
390
|
-
const seamView = await seam(authorityContext, snapshot, selected, policy);
|
|
415
|
+
const seamView = await seam(authorityContext, snapshot, selected, orgKyb ? { ...policy, verification: "not-required" } : policy);
|
|
391
416
|
let taxReason: ExciseEvidenceReason | undefined;
|
|
392
417
|
if (policy.tax === "required") {
|
|
393
418
|
const hasProducer = checkoutStoreHasExciseProducer(await resolveTenantCommerce(tenant));
|
|
@@ -404,7 +429,10 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
404
429
|
provenance.tax = taxResolution.provenance;
|
|
405
430
|
taxReason = taxResolution.reason;
|
|
406
431
|
}
|
|
407
|
-
if (
|
|
432
|
+
if (orgKyb) {
|
|
433
|
+
evidence.verification = "fresh";
|
|
434
|
+
provenance.verification = { requirement: "required", state: "satisfied", source: "org-kyb", policyRevision: "org-kyb-v1", expiresAt };
|
|
435
|
+
} else if (policy.verification === "required" && seamView.verified) {
|
|
408
436
|
evidence.verification = "fresh";
|
|
409
437
|
provenance.verification = { requirement: "required", state: "satisfied", source: seamView.sandbox ? SHARED_STORE_SANDBOX_VERIFICATION_SOURCE : SHARED_STORE_VERIFICATION_SOURCE, policyRevision: SHARED_STORE_POLICY_REVISION, expiresAt };
|
|
410
438
|
}
|
|
@@ -422,12 +450,17 @@ async function authorize(context: APIContext): Promise<Response> {
|
|
|
422
450
|
return deny(decision.finding, 409, decision.owner, decision.exciseReason);
|
|
423
451
|
}
|
|
424
452
|
const authorizationId = existing?.authorizationId ?? `a${crypto.randomUUID()}`;
|
|
453
|
+
if (scopedProof && !await bindCheckoutSnapshot(queryable, scopedProof, snapshot.providerCartId, snapshot.providerCartDigest)) {
|
|
454
|
+
return deny("shopper-checkout-proof-unavailable");
|
|
455
|
+
}
|
|
425
456
|
// Retries of the same verified provider cart share one reservation, including concurrent callbacks.
|
|
426
457
|
const cartDigest = existing?.cartDigest ?? await digest(`commerce-provider-cart-v1\n${snapshot.providerCartId}\n${snapshot.providerCartDigest}`);
|
|
427
458
|
const reserved = await reserveAllocation(d1CommerceRunner(database), { tenantId: decision.tenantId, stage: decision.stage, orderId: authorizationId,
|
|
428
459
|
cartDigest, expiresAt: decision.expiresAt, now, currency: snapshot.currency, amountMinor: snapshot.totals.totalMinor,
|
|
429
460
|
issuer: decision.issuer, jti: decision.jti, holds: decision.holds, stockUntracked: !stockTracked,
|
|
430
461
|
providerCart: { provider: snapshot.provider, id: snapshot.providerCartId, digest: snapshot.providerCartDigest, expectedAuthorizationId: snapshot.expectedAuthorizationId },
|
|
462
|
+
...(scopedProof ? { authorizationGuard: shopperCheckoutAuthorizationGuard(scopedProof, snapshot.providerCartId,
|
|
463
|
+
snapshot.providerCartDigest, orgKyb?.updatedAt) } : {}),
|
|
431
464
|
admissionStatement: admissionSnapshotStatement({ ...snapshot, authorizationId, cartDigest, evidence, provenance, expiresAt: decision.expiresAt, now }),
|
|
432
465
|
});
|
|
433
466
|
if (!reserved.ok) return deny(reserved.finding);
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
* never falls through to "clear".
|
|
15
15
|
*/
|
|
16
16
|
import type { APIContext } from "astro";
|
|
17
|
+
import { shopperPurchaseAccess } from "@/lib/customers/accounts/purchaseAccess";
|
|
18
|
+
import { newShopperVerificationRef, shopperVerificationRefMatches } from "@/lib/customers/accounts/checkoutProof";
|
|
19
|
+
import { hasShopperOrgKyb } from "@/lib/customers/accounts/orgKyb";
|
|
20
|
+
import { shopperDb, type ScopedShopper } from "@/lib/customers/accounts/session";
|
|
21
|
+
import { resolveShopperAccessPolicy } from "@tot/public-runtime/declared-tenant-config";
|
|
17
22
|
import {
|
|
18
23
|
deriveProductProfile,
|
|
19
24
|
evaluateCartCompliance,
|
|
@@ -195,6 +200,7 @@ interface LiveVerificationResolution {
|
|
|
195
200
|
*/
|
|
196
201
|
async function resolveLiveVerification(
|
|
197
202
|
body: PreflightBody,
|
|
203
|
+
shopper?: ScopedShopper,
|
|
198
204
|
): Promise<LiveVerificationResolution | null> {
|
|
199
205
|
let client: TotVerificationClient | null;
|
|
200
206
|
try {
|
|
@@ -211,6 +217,7 @@ async function resolveLiveVerification(
|
|
|
211
217
|
|
|
212
218
|
try {
|
|
213
219
|
if (ref) {
|
|
220
|
+
if (shopper && !await shopperVerificationRefMatches(shopper, ref)) return null;
|
|
214
221
|
const read = await client.readVerification({ appTransactionId: ref });
|
|
215
222
|
if (!read.ok) return null;
|
|
216
223
|
if (read.status !== "not_started") {
|
|
@@ -230,7 +237,8 @@ async function resolveLiveVerification(
|
|
|
230
237
|
};
|
|
231
238
|
}
|
|
232
239
|
|
|
233
|
-
const appTransactionId = ref ?? crypto.randomUUID();
|
|
240
|
+
const appTransactionId = ref ?? (shopper ? await newShopperVerificationRef(shopper) : crypto.randomUUID());
|
|
241
|
+
if (!appTransactionId) return null;
|
|
234
242
|
const created = await client.createVerification({
|
|
235
243
|
appTransactionId,
|
|
236
244
|
person: {
|
|
@@ -273,11 +281,14 @@ function withProviderCleared(ruleset: ComplianceRuleset): ComplianceRuleset {
|
|
|
273
281
|
}
|
|
274
282
|
|
|
275
283
|
export async function POST(context: APIContext): Promise<Response> {
|
|
284
|
+
const access = await shopperPurchaseAccess(context);
|
|
285
|
+
if (!access.ok) return access.response;
|
|
276
286
|
const regulated = isRegulatedTenant(context.locals.tenant);
|
|
277
287
|
|
|
278
288
|
let body: PreflightBody;
|
|
279
289
|
try {
|
|
280
290
|
body = (await context.request.json()) as PreflightBody;
|
|
291
|
+
if (!body || typeof body !== "object" || Array.isArray(body)) throw new Error("Invalid preflight body");
|
|
281
292
|
} catch {
|
|
282
293
|
// A regulated tenant must never proceed on an unreadable request.
|
|
283
294
|
return regulated
|
|
@@ -290,8 +301,22 @@ export async function POST(context: APIContext): Promise<Response> {
|
|
|
290
301
|
// product page's checkout gate, at click time, whether the store asks for the pre-cart dialog
|
|
291
302
|
// at all, so a static page never carries a decision frozen at build time.
|
|
292
303
|
const policy = await sharedStorePolicy(context.locals.tenant, context.locals.commerce, context.locals.customizationEnv);
|
|
293
|
-
const
|
|
294
|
-
const
|
|
304
|
+
const shopper = access.shopper ?? undefined;
|
|
305
|
+
const orgKyb = shopper && resolveShopperAccessPolicy(context.locals.tenant).b2bKybOrgVerification;
|
|
306
|
+
if (orgKyb) {
|
|
307
|
+
try {
|
|
308
|
+
const db = await shopperDb();
|
|
309
|
+
if (!db || !await hasShopperOrgKyb(db, shopper)) {
|
|
310
|
+
return json({ decision: blockedDecision("Your business verification needs review before checkout."), gate: "required" });
|
|
311
|
+
}
|
|
312
|
+
} catch {
|
|
313
|
+
return json({ decision: blockedDecision("Business verification is unavailable."), gate: "required" }, 503);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
const gate = !orgKyb && complianceGateRequiredFor(policy) ? "required" : "not-required";
|
|
317
|
+
const result = await evaluatePreflight(context, body, {
|
|
318
|
+
verification: orgKyb ? "not-required" : policy?.verification, rules: policy?.rules, shopper,
|
|
319
|
+
});
|
|
295
320
|
logPreflightDecision(result.decision);
|
|
296
321
|
return json({ ...result, gate });
|
|
297
322
|
}
|
|
@@ -319,6 +344,7 @@ function logPreflightDecision(decision: CartComplianceDecision): void {
|
|
|
319
344
|
}
|
|
320
345
|
|
|
321
346
|
export interface PreflightOptions {
|
|
347
|
+
shopper?: ScopedShopper;
|
|
322
348
|
/**
|
|
323
349
|
* Server-owned verification requirement, from the shared test store's policy for this
|
|
324
350
|
* tenant. "required" requires verification even where the ruleset would not; absent keeps
|
|
@@ -361,7 +387,7 @@ export async function evaluatePreflight(
|
|
|
361
387
|
// never in SANDBOX_VERIFICATION_PROVIDERS. Any adapter failure clears the
|
|
362
388
|
// provider so the engine blocks fail-closed, exactly as when none is wired.
|
|
363
389
|
if (ruleset && ruleset.verification.required && isLiveTotVerificationProvider(ruleset.verification.provider)) {
|
|
364
|
-
const resolved = await resolveLiveVerification(body);
|
|
390
|
+
const resolved = await resolveLiveVerification(body, options.shopper);
|
|
365
391
|
if (!resolved) {
|
|
366
392
|
ruleset = withProviderCleared(ruleset);
|
|
367
393
|
verification = { outcome: "unknown" };
|
|
@@ -439,7 +465,10 @@ export async function evaluatePreflight(
|
|
|
439
465
|
isSandboxVerificationProvider(ruleset.verification.provider)
|
|
440
466
|
) {
|
|
441
467
|
const rawRef = typeof body.verificationRef === "string" ? body.verificationRef.trim() : "";
|
|
442
|
-
const ref =
|
|
468
|
+
const ref = options.shopper
|
|
469
|
+
? await newShopperVerificationRef(options.shopper, true)
|
|
470
|
+
: SANDBOX_CLEARED_REF.test(rawRef) ? rawRef : `sandbox-cleared:${crypto.randomUUID()}`;
|
|
471
|
+
if (!ref) return { decision: blockedDecision("Verification is unavailable.") };
|
|
443
472
|
liveVerification = { ref, status: "conditions_met" };
|
|
444
473
|
}
|
|
445
474
|
return liveVerification ? { decision: applied, verification: liveVerification } : { decision: applied };
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
withCartSession,
|
|
9
9
|
} from "@/lib/checkout/commerce/cartSession.js";
|
|
10
10
|
import { managedCartHref } from "@/lib/content/chrome/managedCart.js";
|
|
11
|
+
import { shopperPurchaseAccess } from "@/lib/customers/accounts/purchaseAccess";
|
|
11
12
|
|
|
12
13
|
export const prerender = false;
|
|
13
14
|
|
|
@@ -38,6 +39,8 @@ export const GET: APIRoute = async (context) => {
|
|
|
38
39
|
headers: { location: `${cookiePath}cart`, "cache-control": NO_STORE },
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
const access = await shopperPurchaseAccess(context);
|
|
43
|
+
if (!access.ok) return access.response;
|
|
41
44
|
const tenantId = context.locals.tenant ? commerceTenantId(context.locals.tenant) : "";
|
|
42
45
|
const sessionId = tenantId ? await bindCartSession(context, context.locals.commerce, tenantId) : null;
|
|
43
46
|
if (!sessionId) {
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* serves; commerce-only.
|
|
6
6
|
*/
|
|
7
7
|
import type { APIContext } from "astro";
|
|
8
|
+
import { hidesPublicCatalogPrices } from "@tot/public-runtime/declared-tenant-config";
|
|
8
9
|
import { buildCatalogIndex } from "@/lib/catalog/shared/catalogIndex.js";
|
|
9
10
|
|
|
10
11
|
export async function GET(context: APIContext): Promise<Response> {
|
|
11
|
-
const { tot, features } = context.locals;
|
|
12
|
+
const { tot, features, tenant } = context.locals;
|
|
12
13
|
if (!features.catalog && !features.productSearch) return new Response(null, { status: 404 });
|
|
13
14
|
const [products, collections] = await Promise.all([tot.getAllActiveProducts(), tot.listCollections()]);
|
|
14
|
-
return new Response(JSON.stringify(buildCatalogIndex(products, collections)), {
|
|
15
|
+
return new Response(JSON.stringify(buildCatalogIndex(products, collections, hidesPublicCatalogPrices(tenant))), {
|
|
15
16
|
headers: {
|
|
16
17
|
"content-type": "application/json; charset=utf-8",
|
|
17
18
|
"cache-control": "public, max-age=300, s-maxage=3600",
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import CollectionView from "../../_CollectionView.astro";
|
|
8
8
|
import { collectionPageCount, loadCollectionListing } from "@/lib/catalog/shared/collectionPaging";
|
|
9
9
|
import { effectiveCollectionQuery } from "@/lib/publication/shared/staticQuery";
|
|
10
|
+
import { hidesPublicCatalogPrices } from "@tot/public-runtime/declared-tenant-config";
|
|
10
11
|
import { parsePagedRouteParam } from "@/lib/content/blog/pagination";
|
|
11
12
|
|
|
12
13
|
// Same query contract as page 1: sort/facets/price/search are applied client-side
|
|
@@ -18,7 +19,7 @@ if (!Astro.locals.features.catalog) return new Response(null, { status: 404 });
|
|
|
18
19
|
const pathPage = parsePagedRouteParam(Astro.params.n);
|
|
19
20
|
if (!handle || pathPage === null) return new Response(null, { status: 404 });
|
|
20
21
|
|
|
21
|
-
const query = effectiveCollectionQuery(Astro.url, pathPage);
|
|
22
|
+
const query = effectiveCollectionQuery(Astro.url, pathPage, hidesPublicCatalogPrices(Astro.locals.tenant));
|
|
22
23
|
const listing = await loadCollectionListing(Astro.locals.tot, handle, query);
|
|
23
24
|
if (!listing) return new Response(null, { status: 404 });
|
|
24
25
|
// A page past the collection's end is a real 404, never a clamped copy of the last page.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import CollectionView from "./_CollectionView.astro";
|
|
7
7
|
import { loadCollectionListing } from "@/lib/catalog/shared/collectionPaging";
|
|
8
8
|
import { effectiveCollectionQuery } from "@/lib/publication/shared/staticQuery";
|
|
9
|
+
import { hidesPublicCatalogPrices } from "@tot/public-runtime/declared-tenant-config";
|
|
9
10
|
|
|
10
11
|
// Sort, facets, price and inline search ride the query string, which a static host
|
|
11
12
|
// never passes to a renderer: CatalogQueryView applies them client-side there.
|
|
@@ -16,7 +17,7 @@ const { handle } = Astro.params;
|
|
|
16
17
|
if (!Astro.locals.features.catalog) return new Response(null, { status: 404 });
|
|
17
18
|
if (!handle) return new Response(null, { status: 404 });
|
|
18
19
|
|
|
19
|
-
const query = effectiveCollectionQuery(Astro.url);
|
|
20
|
+
const query = effectiveCollectionQuery(Astro.url, undefined, hidesPublicCatalogPrices(Astro.locals.tenant));
|
|
20
21
|
const listing = await loadCollectionListing(Astro.locals.tot, handle, query);
|
|
21
22
|
if (!listing) return new Response(null, { status: 404 });
|
|
22
23
|
---
|
|
@@ -21,6 +21,7 @@ import FacetSidebar from "@/components/catalog/storefront/plp/FacetSidebar.astro
|
|
|
21
21
|
import ActiveFilters from "@/components/catalog/storefront/plp/ActiveFilters.astro";
|
|
22
22
|
import SortSelect from "@/components/catalog/storefront/plp/SortSelect.astro";
|
|
23
23
|
import Pagination from "@/components/catalog/storefront/plp/Pagination.astro";
|
|
24
|
+
import { hidesPublicCatalogPrices } from "@tot/public-runtime/declared-tenant-config";
|
|
24
25
|
import CatalogQueryView from "@/components/publication/storefront/islands/CatalogQueryView.tsx";
|
|
25
26
|
import Img from "@/components/assets/storefront/Img.astro";
|
|
26
27
|
import { buildQueryString } from "@/lib/publication/shared/url";
|
|
@@ -45,7 +46,9 @@ interface Props {
|
|
|
45
46
|
const { collection, query, result, memberTotal, pathPage } = Astro.props;
|
|
46
47
|
const { tenant, canonicalBase } = Astro.locals;
|
|
47
48
|
const { handle } = collection;
|
|
48
|
-
const { products, page, pageSize, total
|
|
49
|
+
const { products, page, pageSize, total } = result;
|
|
50
|
+
const pricesHidden = hidesPublicCatalogPrices(Astro.locals.tenant);
|
|
51
|
+
const facets = pricesHidden ? result.facets.filter(facet => facet.name !== "price") : result.facets;
|
|
49
52
|
|
|
50
53
|
// A synthesized-EMPTY collection (zero active members overall — not merely
|
|
51
54
|
// zero under the current facet/price/q filters) still resolves 200 for a direct
|
|
@@ -181,11 +184,11 @@ const seoTitle = sourceSeoTitle(tenant.seo, collection.seo.title);
|
|
|
181
184
|
Filters & sort
|
|
182
185
|
</summary>
|
|
183
186
|
<div class="mt-4">
|
|
184
|
-
<FacetSidebar facets={facets} query={query} basePath={linkBase} />
|
|
187
|
+
<FacetSidebar pricesHidden={pricesHidden} facets={facets} query={query} basePath={linkBase} />
|
|
185
188
|
</div>
|
|
186
189
|
</details>
|
|
187
190
|
<div class="hidden lg:block">
|
|
188
|
-
<FacetSidebar facets={facets} query={query} basePath={linkBase} />
|
|
191
|
+
<FacetSidebar pricesHidden={pricesHidden} facets={facets} query={query} basePath={linkBase} />
|
|
189
192
|
</div>
|
|
190
193
|
</div>
|
|
191
194
|
|
|
@@ -194,7 +197,7 @@ const seoTitle = sourceSeoTitle(tenant.seo, collection.seo.title);
|
|
|
194
197
|
<p class="text-sm text-[var(--color-muted)]">
|
|
195
198
|
{total} {total === 1 ? "item" : "items"}
|
|
196
199
|
</p>
|
|
197
|
-
<SortSelect query={query} basePath={linkBase} />
|
|
200
|
+
<SortSelect pricesHidden={pricesHidden} query={query} basePath={linkBase} />
|
|
198
201
|
</div>
|
|
199
202
|
|
|
200
203
|
<ActiveFilters query={query} basePath={linkBase} />
|
|
@@ -237,6 +240,7 @@ const seoTitle = sourceSeoTitle(tenant.seo, collection.seo.title);
|
|
|
237
240
|
mode="collection"
|
|
238
241
|
collection={handle}
|
|
239
242
|
pathPage={pathPage}
|
|
243
|
+
pricesHidden={pricesHidden}
|
|
240
244
|
linkBase={linkBase}
|
|
241
245
|
pageBase={withBase(Astro.locals.basePath, collectionPagePath(handle, 1))}
|
|
242
246
|
trailingSlash={!!tenant.seo?.trailingSlash}
|
|
@@ -50,9 +50,11 @@ import {
|
|
|
50
50
|
} from "@/lib/content/shared/homeVisualParity";
|
|
51
51
|
import { getBlogSettings, listBlogPosts } from "@/lib/content/blog/provider.js";
|
|
52
52
|
import { collectionPathsV1, blogPathOptsV1 } from "@/lib/content/blog/collectionPaths.js";
|
|
53
|
+
import { resolveShopperAccessPolicy } from "@tot/public-runtime/declared-tenant-config";
|
|
53
54
|
|
|
54
55
|
const { tenant, tot, content, basePath, apiBasePath, canonicalBase, features, capabilities, publicationTimestamp } = Astro.locals;
|
|
55
56
|
const marketing = !features.catalog;
|
|
57
|
+
const closed = resolveShopperAccessPolicy(tenant).mode === "closed_store";
|
|
56
58
|
|
|
57
59
|
// Raw-HTML home (vendor-injected): serve the tenant's own self-contained
|
|
58
60
|
// document VERBATIM, bypassing the block Layout entirely. Its inline
|
|
@@ -234,7 +236,7 @@ const homeSectionWidgets = marketing
|
|
|
234
236
|
if (r.kind === "hero") {
|
|
235
237
|
return (
|
|
236
238
|
<div data-block={r.blockId}>
|
|
237
|
-
<Hero block={r.block} featureProduct={r.product} instanceKey={r.instanceKey} />
|
|
239
|
+
<Hero block={r.block} featureProduct={closed ? null : r.product} instanceKey={r.instanceKey} />
|
|
238
240
|
</div>
|
|
239
241
|
);
|
|
240
242
|
}
|
|
@@ -252,7 +254,7 @@ const homeSectionWidgets = marketing
|
|
|
252
254
|
</div>
|
|
253
255
|
);
|
|
254
256
|
}
|
|
255
|
-
if (r.kind === "collections") {
|
|
257
|
+
if (r.kind === "collections" && !closed) {
|
|
256
258
|
return (
|
|
257
259
|
<Section title={r.title} eyebrow="Collections" tone="bg" blockId={r.blockId}>
|
|
258
260
|
<div class="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
|
|
@@ -263,7 +265,7 @@ const homeSectionWidgets = marketing
|
|
|
263
265
|
</Section>
|
|
264
266
|
);
|
|
265
267
|
}
|
|
266
|
-
if (r.kind === "products") {
|
|
268
|
+
if (r.kind === "products" && !closed) {
|
|
267
269
|
if (featuredProductsPresentationView(r.presentation) === "carousel") {
|
|
268
270
|
return <ProductCarousel products={r.products} title={r.title} eyebrow="Shop" tone="surface" blockId={r.blockId} />;
|
|
269
271
|
}
|
|
@@ -13,6 +13,7 @@ import type { APIContext } from "astro";
|
|
|
13
13
|
import { nonEmptyCollections } from "@/lib/catalog/tot/query.js";
|
|
14
14
|
import { getBlogSettings, listBlogPosts } from "@/lib/content/blog/provider.js";
|
|
15
15
|
import { compileRouteTierIndexV1 } from "@tot/public-runtime";
|
|
16
|
+
import { hidesPublicCatalogPrices } from "@tot/public-runtime/declared-tenant-config";
|
|
16
17
|
import { readKv } from "@/lib/publication/shared/runtimeEnv.js";
|
|
17
18
|
import {
|
|
18
19
|
declaresMountedSpacesV1,
|
|
@@ -135,7 +136,7 @@ export async function GET(context: APIContext): Promise<Response> {
|
|
|
135
136
|
// Only the always-present graphs are advertised. AggregateRating/Review are
|
|
136
137
|
// emitted per-product ONLY where real review data exists (many stores have
|
|
137
138
|
// none), so we don't claim them site-wide — no fabricated capability.
|
|
138
|
-
|
|
139
|
+
`- Every page ships Schema.org JSON-LD (Product${hidesPublicCatalogPrices(tenant) ? "" : ", Offer"}, Breadcrumb, Organization, WebSite, ItemList) for structured extraction; product ratings/reviews appear where the merchant has real review data.`,
|
|
139
140
|
);
|
|
140
141
|
lines.push("");
|
|
141
142
|
|
|
@@ -14,8 +14,8 @@ import Section from "@/components/content/storefront/Section.astro";
|
|
|
14
14
|
import ImageGallery, { publicGalleryImages } from "@/components/catalog/storefront/islands/ImageGallery.tsx";
|
|
15
15
|
import VariantSelector, { publicSelectorVariants } from "@/components/catalog/storefront/islands/VariantSelector.tsx";
|
|
16
16
|
import RecentlyViewed from "@/components/catalog/storefront/islands/RecentlyViewed.tsx";
|
|
17
|
-
import NicotineWarning from "@/components/compliance/storefront/compliance/NicotineWarning.astro";
|
|
18
17
|
import Prop65Warning from "@/components/compliance/storefront/compliance/Prop65Warning.astro";
|
|
18
|
+
import CheckoutComplianceGate from "@/components/compliance/storefront/islands/CheckoutComplianceGate.tsx";
|
|
19
19
|
import ReviewSummary from "@/components/catalog/storefront/commerce/ReviewSummary.astro";
|
|
20
20
|
import ReviewList from "@/components/catalog/storefront/commerce/ReviewList.astro";
|
|
21
21
|
import { isOnSale, isNew, isAvailable, fromPrice } from "@/lib/catalog/tot/query";
|
|
@@ -57,12 +57,17 @@ import { shippingPolicyPath } from "@/lib/content/policies/shippingPolicy";
|
|
|
57
57
|
import AppWidgetFrame from "@/components/integrations/storefront/apps/AppWidgetFrame.astro";
|
|
58
58
|
import { getRegistryService } from "@/lib/integrations/apps/registryAccess.js";
|
|
59
59
|
import { renderWidgetSlot } from "@/lib/integrations/apps/widgets/renderSlot.js";
|
|
60
|
+
import { hidesPublicCatalogPrices, resolveShopperAccessPolicy } from "@tot/public-runtime/declared-tenant-config";
|
|
60
61
|
|
|
61
62
|
const { handle } = Astro.params;
|
|
62
63
|
const { tenant, tot, canonicalBase, basePath, apiBasePath, commerce } = Astro.locals;
|
|
64
|
+
const pricesHidden = hidesPublicCatalogPrices(tenant);
|
|
65
|
+
const shopperAccess = resolveShopperAccessPolicy(tenant);
|
|
66
|
+
const publicCart = !pricesHidden && shopperAccess.mode === "open" && !shopperAccess.b2bKybOrgVerification;
|
|
63
67
|
// Commerce-only route: marketing tenants have no product detail pages.
|
|
64
68
|
if (!Astro.locals.features.catalog) return new Response(null, { status: 404 });
|
|
65
69
|
const compliance = tenant.compliance;
|
|
70
|
+
const gatedPreflight = !publicCart && !!commerce && isRegulatedTenant(tenant);
|
|
66
71
|
|
|
67
72
|
if (!handle) return Astro.redirect(withBase(basePath, "/404"));
|
|
68
73
|
const product = await tot.getProductByHandle(handle);
|
|
@@ -193,7 +198,7 @@ const shippingPolicyHref = await shippingPolicyPath(Astro.locals.content);
|
|
|
193
198
|
// (reviewAvg/reviewCount above) comes from metafields; this is the per-review text.
|
|
194
199
|
const reviews = await tot.getReviews(product.handle);
|
|
195
200
|
|
|
196
|
-
const onSale = isOnSale(product);
|
|
201
|
+
const onSale = !pricesHidden && isOnSale(product);
|
|
197
202
|
const available = isAvailable(product);
|
|
198
203
|
|
|
199
204
|
// Managed add-to-cart (Track A). Pre-build each variant's cart payload server-
|
|
@@ -240,7 +245,7 @@ let checkoutCart:
|
|
|
240
245
|
| undefined;
|
|
241
246
|
let checkoutUnavailable = false;
|
|
242
247
|
const sampleHandoff = isLocalSampleCheckout(tenant.tenant_id);
|
|
243
|
-
if (commerce || sampleHandoff) {
|
|
248
|
+
if (publicCart && (commerce || sampleHandoff)) {
|
|
244
249
|
// Fail closed for production signed checkout: a signed tenant with no
|
|
245
250
|
// cart-validation secret builds NO cart (never a tamperable form). See
|
|
246
251
|
// resolveCartSigning — it also logs the misconfiguration loudly.
|
|
@@ -389,12 +394,6 @@ const structuredData = {
|
|
|
389
394
|
</p>
|
|
390
395
|
)}
|
|
391
396
|
|
|
392
|
-
{compliance?.nicotineWarning && (
|
|
393
|
-
<div class="mt-6">
|
|
394
|
-
<NicotineWarning variant="block" declaration={compliance.nicotineWarning} />
|
|
395
|
-
</div>
|
|
396
|
-
)}
|
|
397
|
-
|
|
398
397
|
{/* California Prop 65 (Cal. Code Regs. tit. 27 § 25601+): the safe-harbor
|
|
399
398
|
warning must reach the purchaser before checkout completes, so the PDP
|
|
400
399
|
— the point of sale here (no in-app cart page; checkout is an external
|
|
@@ -419,7 +418,7 @@ const structuredData = {
|
|
|
419
418
|
the server check. A clear browser preflight is not payment authority. */}
|
|
420
419
|
<div class="mt-7" data-payment-authority="none">
|
|
421
420
|
{checkoutUnavailable && <Fragment set:html={shopperCheckoutUnavailableHtml()} />}
|
|
422
|
-
<VariantSelector
|
|
421
|
+
{!pricesHidden && <div data-guest-variant-selector><VariantSelector
|
|
423
422
|
client:load
|
|
424
423
|
variants={publicSelectorVariants(product.variants)}
|
|
425
424
|
options={product.options}
|
|
@@ -428,6 +427,7 @@ const structuredData = {
|
|
|
428
427
|
productHandle={product.handle}
|
|
429
428
|
productTitle={product.title}
|
|
430
429
|
checkoutCart={checkoutCart}
|
|
430
|
+
readOnly={!publicCart}
|
|
431
431
|
pricing={pricing}
|
|
432
432
|
handoffUrl={
|
|
433
433
|
!sampleHandoff &&
|
|
@@ -439,8 +439,39 @@ const structuredData = {
|
|
|
439
439
|
basePath,
|
|
440
440
|
publicAvailabilityPath(Astro.locals.customizationEnv === "live" ? "publication" : "preview"),
|
|
441
441
|
)}
|
|
442
|
-
|
|
443
|
-
|
|
442
|
+
/></div>}
|
|
443
|
+
{!publicCart && (
|
|
444
|
+
<div data-shopper-product={product.handle}
|
|
445
|
+
data-pricing-url={withBase(apiBasePath, "/api/account/pricing")}
|
|
446
|
+
data-purchase-url={cartApiPath}
|
|
447
|
+
data-locale={tenant.locale}
|
|
448
|
+
class="min-h-14"
|
|
449
|
+
>
|
|
450
|
+
<p data-shopper-pricing-cta class="text-sm">
|
|
451
|
+
<a class="link-accent" href={`${withBase(apiBasePath, "/account/sign-in")}?next=${encodeURIComponent(withBase(apiBasePath, `/products/${product.handle}`))}`}>Sign in</a> or
|
|
452
|
+
{" "}<a class="link-accent" href={withBase(apiBasePath, "/account/apply")}>apply</a>
|
|
453
|
+
{" "}for wholesale pricing.
|
|
454
|
+
</p>
|
|
455
|
+
<template data-shopper-pricing-template>
|
|
456
|
+
<form method="post" data-shopper-cart data-shopper-compliance={gatedPreflight ? "required" : undefined}
|
|
457
|
+
data-product-title={product.title} class="grid gap-3">
|
|
458
|
+
<label>Option <select name="variantId" required></select></label>
|
|
459
|
+
<p data-shopper-price aria-live="polite"></p>
|
|
460
|
+
<label>Quantity <input name="quantity" type="number" min="1" max="99" value="1" required /></label>
|
|
461
|
+
<input name="productHandle" type="hidden" />
|
|
462
|
+
<button type="submit" class="rounded-md bg-[var(--color-primary)] px-4 py-3 text-[var(--color-primary-contrast)]">
|
|
463
|
+
Add to cart
|
|
464
|
+
</button>
|
|
465
|
+
{gatedPreflight && <p data-shopper-preflight-status role="status"></p>}
|
|
466
|
+
</form>
|
|
467
|
+
</template>
|
|
468
|
+
</div>
|
|
469
|
+
)}
|
|
470
|
+
{gatedPreflight && <CheckoutComplianceGate client:load
|
|
471
|
+
preflightUrl={withBase(apiBasePath, "/api/compliance/preflight")}
|
|
472
|
+
minAge={compliance?.minAge}
|
|
473
|
+
/>}
|
|
474
|
+
{!pricesHidden && <button
|
|
444
475
|
type="button"
|
|
445
476
|
class="wishlist-toggle group mt-3 inline-flex w-full items-center justify-center gap-2 rounded-[var(--radius-md)] border border-[var(--color-border)] py-2.5 font-display text-sm font-medium transition-colors hover:border-[var(--color-sale)] hover:text-[var(--color-sale)] aria-pressed:border-[var(--color-sale)] aria-pressed:text-[var(--color-sale)]"
|
|
446
477
|
aria-pressed="false"
|
|
@@ -451,7 +482,7 @@ const structuredData = {
|
|
|
451
482
|
<path d="M12 21s-7.5-4.6-10-9.2C.4 8.6 2 5 5.5 5 8 5 9.4 6.6 12 9c2.6-2.4 4-4 6.5-4C22 5 23.6 8.6 22 11.8 19.5 16.4 12 21 12 21z" />
|
|
452
483
|
</svg>
|
|
453
484
|
<span class="wl-label">Save for later</span>
|
|
454
|
-
</button>
|
|
485
|
+
</button>}
|
|
455
486
|
</div>
|
|
456
487
|
|
|
457
488
|
{/* Private-app widgets (product.aside) — sandboxed per install. */}
|
|
@@ -621,7 +652,7 @@ const structuredData = {
|
|
|
621
652
|
)}
|
|
622
653
|
|
|
623
654
|
{/* Recently viewed (client island; records this product, shows the rest). */}
|
|
624
|
-
<RecentlyViewed
|
|
655
|
+
{!pricesHidden && <RecentlyViewed
|
|
625
656
|
client:idle
|
|
626
657
|
tenant={tenant.tenant_id}
|
|
627
658
|
locale={tenant.locale}
|
|
@@ -635,11 +666,17 @@ const structuredData = {
|
|
|
635
666
|
rehosted: product.images[0]?.rehosted,
|
|
636
667
|
seed: product.images[0]?.id ?? product.handle,
|
|
637
668
|
}}
|
|
638
|
-
/>
|
|
669
|
+
/>}
|
|
639
670
|
|
|
640
671
|
{/* PDP-view analytics event. Phase 1: dispatched to a window event that the
|
|
641
672
|
no-op sink (or a Phase 2 real sink) can subscribe to. No-op by default. */}
|
|
642
673
|
<script type="application/json" id="pdp-meta" set:html={JSON.stringify({ type: "pdp_view", handle: product.handle })}></script>
|
|
674
|
+
<script>
|
|
675
|
+
import { mountShopperPricing } from "@/lib/customers/accounts/shopperPricingClient";
|
|
676
|
+
for (const region of document.querySelectorAll<HTMLElement>("[data-shopper-product]")) {
|
|
677
|
+
void mountShopperPricing(region);
|
|
678
|
+
}
|
|
679
|
+
</script>
|
|
643
680
|
<script is:inline nonce={Astro.locals.cspNonce}>
|
|
644
681
|
try {
|
|
645
682
|
const el = document.getElementById("pdp-meta");
|
|
@@ -7,6 +7,7 @@ import Layout from "@/layouts/Layout.astro";
|
|
|
7
7
|
import Breadcrumbs from "@/components/content/storefront/Breadcrumbs.astro";
|
|
8
8
|
import { homeCrumbLabel, siteTrail } from "@/lib/content/shared/breadcrumbs";
|
|
9
9
|
import SavedList from "@/components/customers/storefront/islands/SavedList.tsx";
|
|
10
|
+
import { hidesPublicCatalogPrices } from "@tot/public-runtime/declared-tenant-config";
|
|
10
11
|
|
|
11
12
|
const { tenant } = Astro.locals;
|
|
12
13
|
// Commerce-only route: marketing tenants have no saved-items surface.
|
|
@@ -31,6 +32,6 @@ const crumbs = siteTrail(
|
|
|
31
32
|
<p class="eyebrow eyebrow--tick mb-3">Your list</p>
|
|
32
33
|
<h1 class="display-xl">Saved</h1>
|
|
33
34
|
</header>
|
|
34
|
-
<SavedList client:only="preact" locale={tenant.locale} />
|
|
35
|
+
{!hidesPublicCatalogPrices(tenant) && <SavedList client:only="preact" locale={tenant.locale} />}
|
|
35
36
|
</div>
|
|
36
37
|
</Layout>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.8.0",
|
|
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",
|