@tokenoftrust/storefront-runner 4.1.0 → 4.1.2

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.
@@ -89,11 +89,13 @@ export function lazyCheckoutLoaderJs(options: LazyCheckoutLoaderOptions): string
89
89
  if (!url) return false;
90
90
  try { return new URL(url, document.baseURI).origin === cartOrigin; } catch (e) { return false; }
91
91
  }
92
- // Foxy copies the Referer onto cart_cancel_and_continue_link and a later
93
- // origin-only Referer overwrites it. The document policy stays strict-origin.
94
- // Checkout requests opt into the full store-home URL, then the address is put back
95
- // when the request snapshots it synchronously (a cart script). A navigation
96
- // snapshots after this turn, so that path leaves the store-home URL in place.
92
+ // Foxy copies the Referer onto cart_cancel_and_continue_link and ignores a
93
+ // continue parameter. The document policy stays strict-origin. A cart script
94
+ // snapshots the Referer while its src is assigned, so that assignment uses the
95
+ // store-home URL and restores the page before the turn ends. A cart navigation
96
+ // sends the full document URL through the element's referrerPolicy. That URL
97
+ // already includes the store origin and tenant path, and the history entry
98
+ // stays the page that opened the cart.
97
99
  function storeHome() {
98
100
  return location.origin + cookiePath;
99
101
  }
@@ -252,7 +254,6 @@ export function lazyCheckoutLoaderJs(options: LazyCheckoutLoaderOptions): string
252
254
  anchor.referrerPolicy = referrerPolicy;
253
255
  if (state === 'ready') {
254
256
  stampAnchor(anchor);
255
- if (!event.defaultPrevented) revealStoreHome();
256
257
  return;
257
258
  }
258
259
  if (event.defaultPrevented) return;
@@ -313,7 +314,6 @@ export function lazyCheckoutLoaderJs(options: LazyCheckoutLoaderOptions): string
313
314
  if (!cartForm || state === 'ready') {
314
315
  if (!event.defaultPrevented && state === 'ready') {
315
316
  form.referrerPolicy = referrerPolicy;
316
- revealStoreHome();
317
317
  }
318
318
  return;
319
319
  }
@@ -90,6 +90,18 @@ export const REPO = "shop.example";
90
90
 
91
91
  const AGGREGATE = { kind: "aggregate", expectedAggregateSha: null, expectedArtifactDigest: null };
92
92
 
93
+ /** One go-live pins a draft so `apply-settings` starts. The version need not exist: a missing draft is refused and the step still runs. */
94
+ function aggregateWithSettings(tenantId: string) {
95
+ return {
96
+ ...AGGREGATE,
97
+ settings: [{
98
+ path: `tenants/${tenantId}/checkout-requirements.json`,
99
+ versionId: "settings-v1",
100
+ expectedLiveVersionId: null,
101
+ }],
102
+ };
103
+ }
104
+
93
105
  export function publishInput(provider: Provider, target: unknown) {
94
106
  return {
95
107
  aggregateId: "preview",
@@ -205,7 +217,10 @@ function liveScenarios(provider: Provider): Scenario[] {
205
217
  await cloudFrontServesEarlier(t, provider);
206
218
  await seedRelease(t, provider, "sha-1", "run-1");
207
219
  },
208
- intent: () => ({ kind: "publish", input: publishInput(provider, AGGREGATE) }),
220
+ intent: (t) => ({
221
+ kind: "publish",
222
+ input: publishInput(provider, provider === "worker-r2-pointer" ? aggregateWithSettings(t.id) : AGGREGATE),
223
+ }),
209
224
  },
210
225
  {
211
226
  id: `rollback × ${name}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "4.1.0",
3
+ "version": "4.1.2",
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",