@seatlayer/core 0.104.0 → 0.104.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.
@@ -0,0 +1 @@
1
+ var f=(()=>{if(typeof document<"u"&&document.currentScript instanceof HTMLScriptElement&&document.currentScript.src)return document.currentScript.src;try{let n=import.meta.url;if(typeof n=="string"&&n)return n}catch{}})(),s=/\/seatlayer-js@[^/]+\//;function o(n,t,r){let e=new URL(`./${n}`,t);if(!r||!s.test(e.pathname))return[e.href];let i=new URL(e.href);return i.pathname=e.pathname.replace(s,`/seatlayer-js@${r}/`),i.href===e.href?[e.href]:[i.href,e.href]}function c(n){let t=f??(typeof location<"u"?location.href:void 0);if(!t)throw new Error(`seatlayer: cannot resolve the ${n} asset URL`);return t}function u(){return typeof __SEATLAYER_SDK_VERSION__<"u"?__SEATLAYER_SDK_VERSION__:void 0}function a(n){return o(n,c(n),u())[0]}async function _(n,t=r=>import(r)){let r=o(n,c(n),u()),e;for(let i of r)try{return await t(i)}catch(d){e=d}throw e}export{f as a,o as b,a as c,_ as d};
@@ -1 +1 @@
1
- "use strict";var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(e,t)=>{for(var r in t)c(e,r,{get:t[r],enumerable:!0})},a=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of s(t))!d.call(e,n)&&n!==r&&c(e,n,{get:()=>t[n],enumerable:!(o=u(t,n))||o.enumerable});return e};var p=e=>a(c({},"__esModule",{value:!0}),e);var m={};f(m,{SEATLAYER_MODULE_URL:()=>i,cdnAssetUrl:()=>l});module.exports=p(m);var L={},i=(()=>{if(typeof document<"u"&&document.currentScript instanceof HTMLScriptElement&&document.currentScript.src)return document.currentScript.src;try{let e=L.url;if(typeof e=="string"&&e)return e}catch{}})();function l(e){let t=i??(typeof location<"u"?location.href:void 0);if(!t)throw new Error(`seatlayer: cannot resolve the ${e} asset URL`);return new URL(`./${e}`,t).href}0&&(module.exports={SEATLAYER_MODULE_URL,cdnAssetUrl});
1
+ "use strict";var s=Object.defineProperty;var _=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var E=(n,e)=>{for(var r in e)s(n,r,{get:e[r],enumerable:!0})},m=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of l(e))!p.call(n,i)&&i!==r&&s(n,i,{get:()=>e[i],enumerable:!(t=_(e,i))||t.enumerable});return n};var S=n=>m(s({},"__esModule",{value:!0}),n);var R={};E(R,{SEATLAYER_MODULE_URL:()=>u,cdnAssetCandidates:()=>o,cdnAssetUrl:()=>g,importCdnAsset:()=>h});module.exports=S(R);var A={},u=(()=>{if(typeof document<"u"&&document.currentScript instanceof HTMLScriptElement&&document.currentScript.src)return document.currentScript.src;try{let n=A.url;if(typeof n=="string"&&n)return n}catch{}})(),c=/\/seatlayer-js@[^/]+\//;function o(n,e,r){let t=new URL(`./${n}`,e);if(!r||!c.test(t.pathname))return[t.href];let i=new URL(t.href);return i.pathname=t.pathname.replace(c,`/seatlayer-js@${r}/`),i.href===t.href?[t.href]:[i.href,t.href]}function d(n){let e=u??(typeof location<"u"?location.href:void 0);if(!e)throw new Error(`seatlayer: cannot resolve the ${n} asset URL`);return e}function f(){return typeof __SEATLAYER_SDK_VERSION__<"u"?__SEATLAYER_SDK_VERSION__:void 0}function g(n){return o(n,d(n),f())[0]}async function h(n,e=r=>import(r)){let r=o(n,d(n),f()),t;for(let i of r)try{return await e(i)}catch(a){t=a}throw t}0&&(module.exports={SEATLAYER_MODULE_URL,cdnAssetCandidates,cdnAssetUrl,importCdnAsset});
@@ -25,11 +25,38 @@
25
25
  * import time.
26
26
  */
27
27
  declare const SEATLAYER_MODULE_URL: string | undefined;
28
+ /**
29
+ * Where to load `path` from, best first, for a bundle loaded from `moduleUrl`.
30
+ *
31
+ * A script tag on the major alias (`/seatlayer-js@0/seatlayer-buyer.js`) is
32
+ * 302'd to the pinned release, but `document.currentScript.src` is the tag's
33
+ * attribute, so the bundle saw itself at `@0` and every lazy asset resolved
34
+ * under the alias: locale bundles 404 there (the buyer fell back to English),
35
+ * and the 3D, view-from-seat and checkout chunks each paid a second 302 and
36
+ * could resolve to a NEWER release than the running bundle across a release
37
+ * (2026-09-29). The bundle knows its own version, so it asks for THAT release
38
+ * directory first.
39
+ *
40
+ * The relative URL stays as the fallback, exactly as it was, so the worst case
41
+ * is today's behaviour: a page whose CSP allows only the `@0/` path (CSP
42
+ * ignores the path after a redirect, so the old URL passed where a direct
43
+ * pinned URL may not), or any failure of the pinned request. A bundle NOT
44
+ * served from a release directory (a self-hosted or proxied copy) gets only
45
+ * its relative URL, as before.
46
+ */
47
+ declare function cdnAssetCandidates(path: string, moduleUrl: string, version: string | undefined): string[];
28
48
  /**
29
49
  * Absolute URL of a sibling lazy asset in this bundle's pinned CDN directory.
30
50
  * `path` is relative to the bundle, so both `'seatlayer-view3d.mjs'` and
31
51
  * `'i18n/de.mjs'` resolve correctly.
32
52
  */
33
53
  declare function cdnAssetUrl(path: string): string;
54
+ /**
55
+ * Import a sibling lazy asset: the pinned release directory first, then, only
56
+ * if that import fails, the bundle-relative URL every earlier release used.
57
+ * The last failure is the one thrown, so a caller's own fallback (English, a
58
+ * retryable 3D load) behaves as before.
59
+ */
60
+ declare function importCdnAsset<T>(path: string, load?: (url: string) => Promise<unknown>): Promise<T>;
34
61
 
35
- export { SEATLAYER_MODULE_URL, cdnAssetUrl };
62
+ export { SEATLAYER_MODULE_URL, cdnAssetCandidates, cdnAssetUrl, importCdnAsset };
@@ -25,11 +25,38 @@
25
25
  * import time.
26
26
  */
27
27
  declare const SEATLAYER_MODULE_URL: string | undefined;
28
+ /**
29
+ * Where to load `path` from, best first, for a bundle loaded from `moduleUrl`.
30
+ *
31
+ * A script tag on the major alias (`/seatlayer-js@0/seatlayer-buyer.js`) is
32
+ * 302'd to the pinned release, but `document.currentScript.src` is the tag's
33
+ * attribute, so the bundle saw itself at `@0` and every lazy asset resolved
34
+ * under the alias: locale bundles 404 there (the buyer fell back to English),
35
+ * and the 3D, view-from-seat and checkout chunks each paid a second 302 and
36
+ * could resolve to a NEWER release than the running bundle across a release
37
+ * (2026-09-29). The bundle knows its own version, so it asks for THAT release
38
+ * directory first.
39
+ *
40
+ * The relative URL stays as the fallback, exactly as it was, so the worst case
41
+ * is today's behaviour: a page whose CSP allows only the `@0/` path (CSP
42
+ * ignores the path after a redirect, so the old URL passed where a direct
43
+ * pinned URL may not), or any failure of the pinned request. A bundle NOT
44
+ * served from a release directory (a self-hosted or proxied copy) gets only
45
+ * its relative URL, as before.
46
+ */
47
+ declare function cdnAssetCandidates(path: string, moduleUrl: string, version: string | undefined): string[];
28
48
  /**
29
49
  * Absolute URL of a sibling lazy asset in this bundle's pinned CDN directory.
30
50
  * `path` is relative to the bundle, so both `'seatlayer-view3d.mjs'` and
31
51
  * `'i18n/de.mjs'` resolve correctly.
32
52
  */
33
53
  declare function cdnAssetUrl(path: string): string;
54
+ /**
55
+ * Import a sibling lazy asset: the pinned release directory first, then, only
56
+ * if that import fails, the bundle-relative URL every earlier release used.
57
+ * The last failure is the one thrown, so a caller's own fallback (English, a
58
+ * retryable 3D load) behaves as before.
59
+ */
60
+ declare function importCdnAsset<T>(path: string, load?: (url: string) => Promise<unknown>): Promise<T>;
34
61
 
35
- export { SEATLAYER_MODULE_URL, cdnAssetUrl };
62
+ export { SEATLAYER_MODULE_URL, cdnAssetCandidates, cdnAssetUrl, importCdnAsset };
@@ -1 +1 @@
1
- import{a,b}from"../chunk-FOYQOIWG.js";export{a as SEATLAYER_MODULE_URL,b as cdnAssetUrl};
1
+ import{a,b,c,d}from"../chunk-TGHNVDWA.js";export{a as SEATLAYER_MODULE_URL,b as cdnAssetCandidates,c as cdnAssetUrl,d as importCdnAsset};