@tokenoftrust/storefront-runner 7.9.11 → 7.9.12
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.
|
@@ -467,7 +467,7 @@ export async function evaluatePreflight(
|
|
|
467
467
|
!destination &&
|
|
468
468
|
!!ruleset &&
|
|
469
469
|
isSandboxVerificationProvider(ruleset.verification.provider);
|
|
470
|
-
const base = preAddress ? withoutDestinationRequired(decision) : decision;
|
|
470
|
+
const base = preAddress ? withoutDestinationRequired(decision, lines) : decision;
|
|
471
471
|
const applied = rulesOff ? verificationOnly(base) : base;
|
|
472
472
|
if (
|
|
473
473
|
!liveVerification &&
|
|
@@ -487,12 +487,26 @@ export async function evaluatePreflight(
|
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
/** The decision without its `destination_required` block, status recomputed; every other block stays. */
|
|
490
|
-
function withoutDestinationRequired(decision: CartComplianceDecision): CartComplianceDecision {
|
|
491
|
-
const
|
|
492
|
-
if (
|
|
490
|
+
function withoutDestinationRequired(decision: CartComplianceDecision, lines: CartComplianceLine[]): CartComplianceDecision {
|
|
491
|
+
const kept = decision.blocks.filter((block) => block.code !== "destination_required");
|
|
492
|
+
if (kept.length === decision.blocks.length) return decision;
|
|
493
|
+
// A line whose declared allowed-states list is empty ships nowhere: that refusal does not
|
|
494
|
+
// depend on a destination, so deferring the state rules keeps it.
|
|
495
|
+
const nationwide = lines
|
|
496
|
+
.filter((line) => line.profile.allowedRegions != null && line.profile.allowedRegions.length === 0)
|
|
497
|
+
.map((line): CartComplianceDecision["blocks"][number] => ({
|
|
498
|
+
code: "region_prohibited",
|
|
499
|
+
sku: line.sku,
|
|
500
|
+
rule: "compliance.allowed_states",
|
|
501
|
+
allowedRegions: [],
|
|
502
|
+
failedClosed: true,
|
|
503
|
+
message: `${line.title ?? line.sku} can't be shipped anywhere: its allowed-states list names no valid state (safe default = BLOCK).`,
|
|
504
|
+
}));
|
|
505
|
+
const blocks = [...kept, ...nationwide];
|
|
493
506
|
return {
|
|
494
507
|
...decision,
|
|
495
508
|
blocks,
|
|
509
|
+
requirements: { ...decision.requirements, destination: "not_required" },
|
|
496
510
|
failedClosed: blocks.some((block) => block.failedClosed === true),
|
|
497
511
|
status: blocks.some((block) => block.code !== "verification_required") ? "blocked" : blocks.length ? "action_required" : "clear",
|
|
498
512
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "7.9.
|
|
3
|
+
"version": "7.9.12",
|
|
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",
|