@stagepass/modules 2.2.2 → 2.2.3
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/README.md +12 -14
- package/cookies.d.ts +16 -0
- package/dist/all.min.js +9 -9
- package/dist/cookies.min.js +1 -1
- package/dist/inject.min.js +1 -1
- package/dist/maintenance.min.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -16,17 +16,14 @@ Without the loader, `inject` and `cookies` still attach their APIs and warn; `ma
|
|
|
16
16
|
|
|
17
17
|
## CDN Usage
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Default embed is the Stagepass CDN major alias. Stagepass follows strict semver: no breaking changes within v2; breaking changes only in a new major (v3). Exact pin when a specific build must load. See [Version pinning](https://github.com/stagepass-one/os/blob/master/docs/loader.md#version-pinning) in the docs.
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
|
+
<script src="https://cdn.stagepass.one/loader@2"></script>
|
|
23
|
+
<script src="https://cdn.stagepass.one/modules@2/inject.min.js"></script>
|
|
24
|
+
<script src="https://cdn.stagepass.one/modules@2/cookies.min.js"></script>
|
|
22
25
|
<script
|
|
23
|
-
src="https://cdn.
|
|
24
|
-
data-stagepass-version="2.2.0"
|
|
25
|
-
></script>
|
|
26
|
-
<script src="https://cdn.jsdelivr.net/npm/@stagepass/modules@2/dist/inject.min.js"></script>
|
|
27
|
-
<script src="https://cdn.jsdelivr.net/npm/@stagepass/modules@2/dist/cookies.min.js"></script>
|
|
28
|
-
<script
|
|
29
|
-
src="https://cdn.jsdelivr.net/npm/@stagepass/modules@2/dist/maintenance.min.js"
|
|
26
|
+
src="https://cdn.stagepass.one/modules@2/maintenance.min.js"
|
|
30
27
|
data-stagepass-maintenance="true"
|
|
31
28
|
data-stagepass-maintenance-title="We will be back soon"
|
|
32
29
|
data-stagepass-maintenance-text="Please check again shortly."
|
|
@@ -36,11 +33,11 @@ Prefer the major pin `@2` in production on jsDelivr. Stagepass follows strict se
|
|
|
36
33
|
Or load all modules:
|
|
37
34
|
|
|
38
35
|
```html
|
|
39
|
-
<script src="https://cdn.
|
|
40
|
-
<script src="https://cdn.
|
|
36
|
+
<script src="https://cdn.stagepass.one/loader@2"></script>
|
|
37
|
+
<script src="https://cdn.stagepass.one/modules@2/all.min.js"></script>
|
|
41
38
|
```
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
jsDelivr is the documented alternative, with full `/dist/` paths such as `https://cdn.jsdelivr.net/npm/@stagepass/loader@2/dist/loader.min.js` and `https://cdn.jsdelivr.net/npm/@stagepass/modules@2/dist/inject.min.js`.
|
|
44
41
|
|
|
45
42
|
Published files: `dist/inject.min.js`, `dist/cookies.min.js`, `dist/maintenance.min.js`, `dist/all.min.js`.
|
|
46
43
|
|
|
@@ -75,7 +72,7 @@ await sp.inject({
|
|
|
75
72
|
| :--- | :--- |
|
|
76
73
|
| `src` | Required production URL. |
|
|
77
74
|
| `type` | `'script'` \| `'style'` (default: `.css` → style, else script). |
|
|
78
|
-
| `stagepass` | When not `false
|
|
75
|
+
| `stagepass` | When not `false`, use `sp.resolveLocalUrl` only if it returns a non-empty URL (active swap session); otherwise keep the production `src` (plus optional `version` / `?v=`). |
|
|
79
76
|
| `localPath` / `path` | Local path under the linked root (default: filename from `src`). |
|
|
80
77
|
| `id` | Element id; skips inject if already present. |
|
|
81
78
|
| `async` | If `true`, set `script.async = true`; otherwise `async = false` and keep order. |
|
|
@@ -117,6 +114,7 @@ sp.consent.update(); // flushes queue
|
|
|
117
114
|
| Method | Description |
|
|
118
115
|
| :--- | :--- |
|
|
119
116
|
| `bake(name, value, options?)` | Write/update a cookie. Optional `category` remembers the category and may queue when consent rejects. |
|
|
117
|
+
| `on('bake' \| 'throw', fn)` | Subscribe after a successful write/delete (including queued bakes flushed by consent, and each cookie in `throwAll`). Returns unsubscribe. Listener errors do not break the operation. |
|
|
120
118
|
| `eat(name, options?)` | Read a cookie; `null` if missing. |
|
|
121
119
|
| `throw(name, options?)` | Delete via `Max-Age=0` + expired date. |
|
|
122
120
|
| `has(name)` | Existence check. |
|
|
@@ -141,7 +139,7 @@ Off unless `data-stagepass-maintenance="true"` on the module script tag (or enab
|
|
|
141
139
|
|
|
142
140
|
```html
|
|
143
141
|
<script
|
|
144
|
-
src="https://cdn.
|
|
142
|
+
src="https://cdn.stagepass.one/modules@2.2.2/maintenance.min.js"
|
|
145
143
|
data-stagepass-maintenance="true"
|
|
146
144
|
data-stagepass-maintenance-title="We will be back soon"
|
|
147
145
|
data-stagepass-maintenance-text="Please check again shortly."
|
|
@@ -178,5 +176,5 @@ Module members are optional (`sp.cookies?`), because a page may not load the fil
|
|
|
178
176
|
|
|
179
177
|
## Repository
|
|
180
178
|
|
|
181
|
-
- Full docs and examples: [stagepass repository](https://github.com/
|
|
179
|
+
- Full docs and examples: [stagepass repository](https://github.com/stagepass-one/os)
|
|
182
180
|
- Migration: [MIGRATION.md](../../MIGRATION.md)
|
package/cookies.d.ts
CHANGED
|
@@ -19,6 +19,14 @@ export interface StagepassCookieWriteOptions {
|
|
|
19
19
|
category?: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
/** Payload for `sp.cookies.on('bake' | 'throw', fn)`. */
|
|
23
|
+
export interface StagepassCookieEventPayload {
|
|
24
|
+
name: string;
|
|
25
|
+
category?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type StagepassCookieEventName = 'bake' | 'throw';
|
|
29
|
+
|
|
22
30
|
export interface StagepassCookiesAPI {
|
|
23
31
|
/** Write a cookie. */
|
|
24
32
|
bake: (name: string, value: unknown, options?: StagepassCookieWriteOptions) => void;
|
|
@@ -36,6 +44,14 @@ export interface StagepassCookiesAPI {
|
|
|
36
44
|
jar: () => Record<string, unknown>;
|
|
37
45
|
/** Known cookie names starting with `prefix`. */
|
|
38
46
|
crumbs: (prefix: string) => string[];
|
|
47
|
+
/**
|
|
48
|
+
* Subscribe to successful bake/throw (including queued bakes flushed by consent, and each cookie in throwAll).
|
|
49
|
+
* Returns an unsubscribe function. Listener errors do not break the cookie operation.
|
|
50
|
+
*/
|
|
51
|
+
on: (
|
|
52
|
+
event: StagepassCookieEventName,
|
|
53
|
+
fn: (payload: StagepassCookieEventPayload) => void
|
|
54
|
+
) => () => void;
|
|
39
55
|
}
|
|
40
56
|
|
|
41
57
|
/**
|
package/dist/all.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";var StagepassModules=(()=>{(function(){function b(){let e=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;return e||null}function x(){try{console.warn("[Stagepass] Core loader should be loaded before the inject module.")}catch{}}function S(){let e=b();if(!e||!e.vars)throw new Error("Stagepass core loader must be loaded before modules");return e.vars}let j=new Set(["src","href","rel","integrity","crossorigin","nonce"]);function E(e){try{let n=S();(n.env==="local"||n.env==="staging")&&console.log(`[Stagepass] ${e}`)}catch{}}function A(e){try{let n=b();if(n&&typeof n.warn=="function"){n.warn(e);return}}catch{}try{console.warn(`[Stagepass] ${e}`)}catch{}}function L(e){if(!e||typeof e!="string")return"file";try{let r=new URL(e).pathname||"";if(!r||r.length===0){let p=e.match(/\/([^\/\?#]+)(?:\?|#|$)/);return p?p[1]:"file"}let a=r.split("/");return a[a.length-1]||a[a.length-2]||"file"}catch{try{let r=e.match(/\/([^\/\?#]+)(?:\?|#|$)/);return r?r[1]:"file"}catch{return"file"}}}function I(e,n){if(n)return n;if(!e||typeof e!="string")return"script";try{if(e.split(".").pop()?.toLowerCase()==="css")return"style"}catch{}return"script"}function T(e,n,r){let a=encodeURIComponent(r),p=e.indexOf("#"),t=p>=0?e.slice(p):"",s=p>=0?e.slice(0,p):e,o=s.includes("?")?"&":"?";return`${s}${o}${encodeURIComponent(n)}=${a}${t}`}function f(e,n){if(!n||n.length===0)return!0;try{let r=new URL(e,window.location.href).hostname.toLowerCase();return n.map(p=>String(p).toLowerCase()).includes(r)}catch{return!1}}function m(e){let n=S(),{src:r,stagepass:a,localPath:p,path:t,version:s}=e;if(!r||typeof r!="string")throw new Error("Invalid src: must be a non-empty string");if(a!==!1&&n.isLocal){let o=p||t||L(r);if(!o||typeof o!="string")return r;let i=o.startsWith("/")?o.substring(1):o,c=b();if(c&&typeof c.resolveLocalUrl=="function"){let y=c.resolveLocalUrl(i);if(y)return y}}return s?T(r,"v",s):r}function w(e,n){let{id:r,type:a}=e,p=I(e.src,a);if(r&&document.getElementById(r))return E(`Skipping injection: Element with id "${r}" already exists`),!0;if(p==="script"){let t=document.getElementsByTagName("script");for(let s=0;s<t.length;s++)if(t[s].getAttribute("src")===n)return E(`Skipping injection: Resource "${n}" already loaded`),!0}else{let t=document.getElementsByTagName("link");for(let s=0;s<t.length;s++)if(t[s].getAttribute("href")===n)return E(`Skipping injection: Resource "${n}" already loaded`),!0}return!1}function O(e="body-end"){if(typeof e=="string")return e==="head"?document.head:document.body;let{target:n,action:r}=e,a=document.querySelector(n);return a?r==="before"?a:a.nextSibling||a.parentNode:(E(`Warning: Target selector "${n}" not found, falling back to body-end`),document.body)}function k(e,n){n.integrity&&e.setAttribute("integrity",n.integrity),n.crossorigin&&e.setAttribute("crossorigin",n.crossorigin),n.nonce&&e.setAttribute("nonce",n.nonce)}function $(e){return new Promise((n,r)=>{if(!e.src){let i=S(),c=new Error('InjectOptions must have a "src" property');i.env!=="production"&&console.error("[Stagepass]",c),r(c);return}if(!f(e.src,e.allowedHosts)){A(`inject: host not allowed for "${e.src}". Check allowedHosts.`),n();return}let a=S(),p=I(e.src,e.type),t=m(e);if(w(e,t)){n();return}let s=p==="script"?document.createElement("script"):document.createElement("link");if(p==="script"){let i=s;e.async?i.async=!0:(i.async=!1,e.defer!==!1&&(i.defer=!0)),e.id&&(i.id=e.id),e.attributes&&Object.entries(e.attributes).forEach(([c,y])=>{j.has(String(c).toLowerCase())||i.setAttribute(c,y)}),i.src=t,k(i,e),i.onload=()=>{E(`Injected: ${t}`),n()},i.onerror=()=>{let c=new Error(`Failed to load script: ${t}`);a.env!=="production"&&console.error("[Stagepass]",c),r(c)}}else{let i=s;e.id&&(i.id=e.id),e.attributes&&Object.entries(e.attributes).forEach(([y,h])=>{j.has(String(y).toLowerCase())||i.setAttribute(y,h)}),i.rel="stylesheet",i.href=t,k(i,e);let c=setInterval(()=>{(i.sheet||i.styleSheet)&&(clearInterval(c),E(`Injected: ${t}`),n())},10);setTimeout(()=>{if(clearInterval(c),!(i.sheet||i.styleSheet)){let h=new Error(`Failed to load stylesheet: ${t}`);a.env!=="production"&&console.error("[Stagepass]",h),r(h)}},5e3)}let o=O(e.position);if(!o){r(new Error("Could not find insertion point"));return}if(o===document.head||o===document.body)e.position==="body-start"?o.prepend(s):o.appendChild(s);else{let i=o.parentNode;i&&(typeof e.position=="object"&&e.position.action==="before"?i.insertBefore(s,o):i.insertBefore(s,o.nextSibling))}})}async function u(e){let n=[];if(!Array.isArray(e)&&typeof e=="object"&&("scripts"in e||"styles"in e)){let r=e;r.scripts&&n.push(...r.scripts.filter(a=>a&&typeof a=="object"&&"src"in a&&typeof a.src=="string"&&a.src.trim().length>0).map(a=>({...a,type:"script"}))),r.styles&&n.push(...r.styles.filter(a=>a&&typeof a=="object"&&"src"in a&&typeof a.src=="string"&&a.src.trim().length>0).map(a=>({...a,type:"style"})))}else Array.isArray(e)?n=e.filter(r=>r&&typeof r=="object"&&"src"in r&&typeof r.src=="string"&&r.src.trim().length>0):e&&typeof e=="object"&&"src"in e&&typeof e.src=="string"&&e.src.trim().length>0&&(n=[e]);for(let r of n)try{await $(r)}catch(a){try{S().env!=="production"&&console.error("[Stagepass] Injection error:",a)}catch{}}}function d(e){e.inject=u}let l=b()||{};l.vars||x(),l.vars&&typeof l.use=="function"?l.use("inject","2.0.0",d):d(l),window.stagepass=l,globalThis.stagepass=l,window.sp=l,globalThis.sp=l})();(function(){function b(){let f=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;return f||null}function x(){try{console.warn("[Stagepass] Core loader should be loaded before the cookies module.")}catch{}}function S(f,m){if(!(m==null||m==="")&&/[;\r\n]/.test(m))throw new Error(`Invalid cookie ${f}`)}function j(){return window.location.protocol==="https:"}function E(f){try{return decodeURIComponent(f)}catch{return f}}function A(f,m){let O=m.decode!==!1?E(f):f;if(!m.json)return O;try{return JSON.parse(O)}catch{return O}}function L(f){let m=new Map,w=[],O=()=>!0;function k(t,s,o={}){if(!t||typeof t!="string"||t.includes(";")||/[\r\n]/.test(t))throw new Error("Invalid cookie name");let i=o.encode!==!1,c=o.sameSite||"Lax";S("sameSite",c);let y=o.secure!==void 0?o.secure:j(),h=o.path||"/";S("path",h),S("domain",o.domain);let v=o.json?JSON.stringify(s):String(s);i||(S("value",v),S("name",t));let R=i?encodeURIComponent(t):t;v=i?encodeURIComponent(v):v;let C=[`${R}=${v}`];if(typeof o.maxAge=="number"&&C.push(`Max-Age=${Math.floor(o.maxAge)}`),typeof o.days=="number"){let M=new Date(Date.now()+o.days*24*60*60*1e3);C.push(`Expires=${M.toUTCString()}`)}h&&C.push(`Path=${h}`),o.domain&&C.push(`Domain=${o.domain}`),C.push(`SameSite=${c}`);let _=y;c==="None"&&!_&&(_=!0,typeof f.warn=="function"&&f.warn("SameSite=None requires Secure=true. Enforcing Secure for cookie write.")),_&&C.push("Secure"),document.cookie=C.join("; ")}function $(t,s,o={}){let i=o.category,c={name:t,value:s,options:{...o},category:i};if(i&&!O(i)){let h=w.findIndex(v=>v.name===t);h>=0&&w.splice(h,1),w.push(c),m.set(t,c);return}k(t,s,o),m.set(t,c);let y=w.findIndex(h=>h.name===t);y>=0&&w.splice(y,1)}function u(t,s={}){if(!t||typeof t!="string")return null;let o=s.decode===!1?t:E(t),i=document.cookie?document.cookie.split("; "):[];for(let c of i){let y=c.indexOf("=");if(y<0)continue;let h=c.substring(0,y),v=c.substring(y+1),R=E(h);if(h===o||R===o)return A(v,s)}return null}function d(t){return u(t)!==null}function l(t={}){let s=document.cookie?document.cookie.split("; "):[],o={};for(let i of s){let c=i.indexOf("=");if(c<0)continue;let y=i.substring(0,c),h=i.substring(c+1),v=t.decode===!1?y:E(y);o[v]=A(h,t)}return o}function g(t,s={}){k(t,"",{days:-1,maxAge:0,path:s.path||"/",domain:s.domain,secure:s.secure,sameSite:s.sameSite}),m.delete(t);let o=w.findIndex(i=>i.name===t);o>=0&&w.splice(o,1)}function e(t={}){let s=t.category,o=[];m.forEach((i,c)=>{(!s||i.category===s)&&o.push(c)});for(let i of o){let c=m.get(i);g(i,{path:c?.options.path,domain:c?.options.domain,secure:c?.options.secure,sameSite:c?.options.sameSite})}}function n(){let t={};return m.forEach((s,o)=>{t[o]=s.value}),t}function r(t){let s=t==null?"":String(t),o=[];return m.forEach((i,c)=>{c.startsWith(s)&&o.push(c)}),o}let a={bake:$,eat:u,throw:g,has:d,list:l,throwAll:e,jar:n,crumbs:r},p={allows(t){try{return O(t)===!0}catch{return!1}},set(t){typeof t=="function"&&(O=t)},update(){let t=w.splice(0,w.length);for(let s of t)!s.category||O(s.category)?$(s.name,s.value,s.options):w.push(s)}};f.cookies=a,f.cookie=a,f.consent=p}let I=b()||{};I.vars||x(),I.vars&&typeof I.use=="function"?I.use("cookies","2.0.0",L):L(I),window.stagepass=I,globalThis.stagepass=I,window.sp=I,globalThis.sp=I})();(function(){let b="stagepass-maintenance-overlay",x="stagepass-maintenance-badge",S="stagepass-maintenance-style",j="We will be back soon",E="This site is temporarily unavailable while we perform maintenance.";function A(){let u=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;if(!u||!u.vars){try{console.warn("[Stagepass] Core loader must be loaded before the maintenance module. Skipping registration.")}catch{}return null}return u}function L(){try{if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}catch{}try{let u=document.querySelectorAll('script[src*="maintenance"]');for(let l=u.length-1;l>=0;l--){let g=u[l];if(/maintenance(?:\.min)?\.js/i.test(g.src||""))return g}let d=document.querySelectorAll('script[src*="all"]');for(let l=d.length-1;l>=0;l--){let g=d[l];if(/all(?:\.min)?\.js/i.test(g.src||"")&&g.hasAttribute("data-stagepass-maintenance"))return g}}catch{}return null}function I(u){try{if(typeof u.is=="function"&&u.is("local"))return!0}catch{}try{let d=localStorage.getItem("stagepass_domain");if(!d)return!1;if(d.startsWith("{")){let l=JSON.parse(d),g=l&&l.domain;if(g==="debug"||typeof g=="string"&&g.endsWith(".sp")||g==="localhost"||typeof g=="string"&&g.startsWith("localhost:"))return!0}}catch{}return!1}function T(){if(document.getElementById(S))return;let u=document.createElement("style");u.id=S,u.textContent=`
|
|
2
|
-
#${
|
|
3
|
-
#${
|
|
4
|
-
#${
|
|
5
|
-
#${
|
|
6
|
-
#${
|
|
1
|
+
"use strict";var StagepassModules=(()=>{(function(){function S(){let e=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;return e||null}function A(e){return!!(e&&(typeof e.env=="function"||typeof e.use=="function"))}function N(){try{console.warn("[Stagepass] Core loader should be loaded before the inject module.")}catch{}}let C=new Set(["src","href","rel","integrity","crossorigin","nonce"]);function O(e){try{let t=S();t&&typeof t.log=="function"&&t.log(e)}catch{}}function $(e){try{let t=S();if(t&&typeof t.warn=="function"){t.warn(e);return}}catch{}try{console.warn(`[Stagepass] ${e}`)}catch{}}function L(...e){try{let t=S();t&&typeof t.error=="function"&&t.error(...e)}catch{}}function M(e){if(!e||typeof e!="string")return"file";try{let o=new URL(e).pathname||"";if(!o||o.length===0){let d=e.match(/\/([^\/\?#]+)(?:\?|#|$)/);return d?d[1]:"file"}let r=o.split("/");return r[r.length-1]||r[r.length-2]||"file"}catch{try{let o=e.match(/\/([^\/\?#]+)(?:\?|#|$)/);return o?o[1]:"file"}catch{return"file"}}}function E(e,t){if(t)return t;if(!e||typeof e!="string")return"script";try{if(e.split(".").pop()?.toLowerCase()==="css")return"style"}catch{}return"script"}function T(e,t,o){let r=encodeURIComponent(o),d=e.indexOf("#"),h=d>=0?e.slice(d):"",f=d>=0?e.slice(0,d):e,l=f.includes("?")?"&":"?";return`${f}${l}${encodeURIComponent(t)}=${r}${h}`}function y(e,t){if(!t||t.length===0)return!0;try{let o=new URL(e,window.location.href).hostname.toLowerCase();return t.map(d=>String(d).toLowerCase()).includes(o)}catch{return!1}}function b(e){let{src:t,stagepass:o,localPath:r,path:d,version:h}=e;if(!t||typeof t!="string")throw new Error("Invalid src: must be a non-empty string");if(o!==!1){let f=r||d||M(t);if(f&&typeof f=="string"){let l=f.startsWith("/")?f.substring(1):f,n=S();if(n&&typeof n.resolveLocalUrl=="function"){let s=n.resolveLocalUrl(l);if(s)return s}}}return h?T(t,"v",h):t}function k(e,t){let{id:o,type:r}=e,d=E(e.src,r);if(o&&document.getElementById(o))return O(`Skipping injection: Element with id "${o}" already exists`),!0;if(d==="script"){let h=document.getElementsByTagName("script");for(let f=0;f<h.length;f++)if(h[f].getAttribute("src")===t)return O(`Skipping injection: Resource "${t}" already loaded`),!0}else{let h=document.getElementsByTagName("link");for(let f=0;f<h.length;f++)if(h[f].getAttribute("href")===t)return O(`Skipping injection: Resource "${t}" already loaded`),!0}return!1}function w(e="body-end"){if(typeof e=="string")return e==="head"?document.head:document.body;let{target:t,action:o}=e,r=document.querySelector(t);return r?o==="before"?r:r.nextSibling||r.parentNode:(O(`Warning: Target selector "${t}" not found, falling back to body-end`),document.body)}function _(e,t){t.integrity&&e.setAttribute("integrity",t.integrity),t.crossorigin&&e.setAttribute("crossorigin",t.crossorigin),t.nonce&&e.setAttribute("nonce",t.nonce)}function u(e){return new Promise((t,o)=>{if(!e.src){let l=new Error('InjectOptions must have a "src" property');L(l),o(l);return}if(!y(e.src,e.allowedHosts)){$(`inject: host not allowed for "${e.src}". Check allowedHosts.`),t();return}let r=E(e.src,e.type),d=b(e);if(k(e,d)){t();return}let h=r==="script"?document.createElement("script"):document.createElement("link");if(r==="script"){let l=h;e.async?l.async=!0:(l.async=!1,e.defer!==!1&&(l.defer=!0)),e.id&&(l.id=e.id),e.attributes&&Object.entries(e.attributes).forEach(([n,s])=>{C.has(String(n).toLowerCase())||l.setAttribute(n,s)}),l.src=d,_(l,e),l.onload=()=>{O(`Injected: ${d}`),t()},l.onerror=()=>{let n=new Error(`Failed to load script: ${d}`);L(n),o(n)}}else{let l=h;e.id&&(l.id=e.id),e.attributes&&Object.entries(e.attributes).forEach(([s,i])=>{C.has(String(s).toLowerCase())||l.setAttribute(s,i)}),l.rel="stylesheet",l.href=d,_(l,e);let n=setInterval(()=>{(l.sheet||l.styleSheet)&&(clearInterval(n),O(`Injected: ${d}`),t())},10);setTimeout(()=>{if(clearInterval(n),!(l.sheet||l.styleSheet)){let i=new Error(`Failed to load stylesheet: ${d}`);L(i),o(i)}},5e3)}let f=w(e.position);if(!f){o(new Error("Could not find insertion point"));return}if(f===document.head||f===document.body)e.position==="body-start"?f.prepend(h):f.appendChild(h);else{let l=f.parentNode;l&&(typeof e.position=="object"&&e.position.action==="before"?l.insertBefore(h,f):l.insertBefore(h,f.nextSibling))}})}async function g(e){let t=[];if(!Array.isArray(e)&&typeof e=="object"&&("scripts"in e||"styles"in e)){let o=e;o.scripts&&t.push(...o.scripts.filter(r=>r&&typeof r=="object"&&"src"in r&&typeof r.src=="string"&&r.src.trim().length>0).map(r=>({...r,type:"script"}))),o.styles&&t.push(...o.styles.filter(r=>r&&typeof r=="object"&&"src"in r&&typeof r.src=="string"&&r.src.trim().length>0).map(r=>({...r,type:"style"})))}else Array.isArray(e)?t=e.filter(o=>o&&typeof o=="object"&&"src"in o&&typeof o.src=="string"&&o.src.trim().length>0):e&&typeof e=="object"&&"src"in e&&typeof e.src=="string"&&e.src.trim().length>0&&(t=[e]);for(let o of t)try{await u(o)}catch(r){L("Injection error:",r)}}function a(e){e.inject=g}let c=S()||{};A(c)||N(),typeof c.use=="function"?c.use("inject","2.0.0",a):a(c),window.stagepass=c,globalThis.stagepass=c,window.sp=c,globalThis.sp=c})();(function(){function S(){let y=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;return y||null}function A(y){return!!(y&&(typeof y.env=="function"||typeof y.use=="function"))}function N(){try{console.warn("[Stagepass] Core loader should be loaded before the cookies module.")}catch{}}function C(y,b){if(!(b==null||b==="")&&/[;\r\n]/.test(b))throw new Error(`Invalid cookie ${y}`)}function O(){return window.location.protocol==="https:"}function $(y){try{return decodeURIComponent(y)}catch{return y}}function L(y,b){let w=b.decode!==!1?$(y):y;if(!b.json)return w;try{return JSON.parse(w)}catch{return w}}function M(y){let b=new Map,k=[],w=()=>!0,_={bake:new Set,throw:new Set};function u(n,s){_[n].forEach(i=>{try{i(s)}catch{}})}function g(n,s){let i=_[n];return!i||typeof s!="function"?()=>{}:(i.add(s),()=>{i.delete(s)})}function a(n,s,i={}){if(!n||typeof n!="string"||n.includes(";")||/[\r\n]/.test(n))throw new Error("Invalid cookie name");let m=i.encode!==!1,p=i.sameSite||"Lax";C("sameSite",p);let j=i.secure!==void 0?i.secure:O(),I=i.path||"/";C("path",I),C("domain",i.domain);let v=i.json?JSON.stringify(s):String(s);m||(C("value",v),C("name",n));let U=m?encodeURIComponent(n):n;v=m?encodeURIComponent(v):v;let R=[`${U}=${v}`];if(typeof i.maxAge=="number"&&R.push(`Max-Age=${Math.floor(i.maxAge)}`),typeof i.days=="number"){let D=new Date(Date.now()+i.days*24*60*60*1e3);R.push(`Expires=${D.toUTCString()}`)}I&&R.push(`Path=${I}`),i.domain&&R.push(`Domain=${i.domain}`),R.push(`SameSite=${p}`);let P=j;if(p==="None"&&!P){P=!0;let D="SameSite=None requires Secure=true. Enforcing Secure for cookie write.";if(typeof y.warn=="function")y.warn(D);else try{console.warn(D)}catch{}}P&&R.push("Secure"),document.cookie=R.join("; ")}function c(n,s,i={}){let m=i.category,p={name:n,value:s,options:{...i},category:m};if(m&&!w(m)){let I=k.findIndex(v=>v.name===n);I>=0&&k.splice(I,1),k.push(p),b.set(n,p);return}a(n,s,i),b.set(n,p);let j=k.findIndex(I=>I.name===n);j>=0&&k.splice(j,1),u("bake",m?{name:n,category:m}:{name:n})}function x(n,s={}){if(!n||typeof n!="string")return null;let i=s.decode===!1?n:$(n),m=document.cookie?document.cookie.split("; "):[];for(let p of m){let j=p.indexOf("=");if(j<0)continue;let I=p.substring(0,j),v=p.substring(j+1),U=$(I);if(I===i||U===i)return L(v,s)}return null}function e(n){return x(n)!==null}function t(n={}){let s=document.cookie?document.cookie.split("; "):[],i={};for(let m of s){let p=m.indexOf("=");if(p<0)continue;let j=m.substring(0,p),I=m.substring(p+1),v=n.decode===!1?j:$(j);i[v]=L(I,n)}return i}function o(n,s={}){let i=b.get(n);a(n,"",{days:-1,maxAge:0,path:s.path||"/",domain:s.domain,secure:s.secure,sameSite:s.sameSite}),b.delete(n);let m=k.findIndex(p=>p.name===n);m>=0&&k.splice(m,1),u("throw",i?.category?{name:n,category:i.category}:{name:n})}function r(n={}){let s=n.category,i=[];b.forEach((m,p)=>{(!s||m.category===s)&&i.push(p)});for(let m of i){let p=b.get(m);o(m,{path:p?.options.path,domain:p?.options.domain,secure:p?.options.secure,sameSite:p?.options.sameSite})}}function d(){let n={};return b.forEach((s,i)=>{n[i]=s.value}),n}function h(n){let s=n==null?"":String(n),i=[];return b.forEach((m,p)=>{p.startsWith(s)&&i.push(p)}),i}let f={bake:c,eat:x,throw:o,has:e,list:t,throwAll:r,jar:d,crumbs:h,on:g},l={allows(n){try{return w(n)===!0}catch{return!1}},set(n){typeof n=="function"&&(w=n)},update(){let n=k.splice(0,k.length);for(let s of n)!s.category||w(s.category)?c(s.name,s.value,s.options):k.push(s)}};y.cookies=f,y.cookie=f,y.consent=l}let E=S()||{};A(E)||N(),typeof E.use=="function"?E.use("cookies","2.0.0",M):M(E),window.stagepass=E,globalThis.stagepass=E,window.sp=E,globalThis.sp=E})();(function(){let S="stagepass-maintenance-overlay",A="stagepass-maintenance-badge",N="stagepass-maintenance-style",C="We will be back soon",O="This site is temporarily unavailable while we perform maintenance.";function $(){let u=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;if(!u||typeof u.env!="function"&&typeof u.use!="function"){try{console.warn("[Stagepass] Core loader must be loaded before the maintenance module. Skipping registration.")}catch{}return null}return u}function L(){try{if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}catch{}try{let u=document.querySelectorAll('script[src*="maintenance"]');for(let a=u.length-1;a>=0;a--){let c=u[a];if(/maintenance(?:\.min)?\.js/i.test(c.src||""))return c}let g=document.querySelectorAll('script[src*="all"]');for(let a=g.length-1;a>=0;a--){let c=g[a];if(/all(?:\.min)?\.js/i.test(c.src||"")&&c.hasAttribute("data-stagepass-maintenance"))return c}}catch{}return null}function M(u){try{if(typeof u.is=="function"&&u.is("local"))return!0}catch{}try{let g=localStorage.getItem("stagepass_domain");if(!g)return!1;if(g.startsWith("{")){let a=JSON.parse(g),c=a&&a.domain;if(c==="debug"||typeof c=="string"&&c.endsWith(".sp")||c==="localhost"||typeof c=="string"&&c.startsWith("localhost:"))return!0}}catch{}return!1}function E(){if(document.getElementById(N))return;let u=document.createElement("style");u.id=N,u.textContent=`
|
|
2
|
+
#${S}{position:fixed;inset:0;z-index:2147483646;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:#f4f4f5;color:#18181b}
|
|
3
|
+
#${S} .sp-m-card{max-width:32rem;width:100%;text-align:center}
|
|
4
|
+
#${S} .sp-m-title{margin:0 0 12px;font-size:1.75rem;line-height:1.2;font-weight:700}
|
|
5
|
+
#${S} .sp-m-text{margin:0;font-size:1rem;line-height:1.5;opacity:.85}
|
|
6
|
+
#${A}{position:fixed;left:0;bottom:0;z-index:2147483645;font:12px/1.2 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;font-weight:700;color:#fff;background:#b45309;padding:6px 8px;border-radius:0 4px 0 0;cursor:default;user-select:none}
|
|
7
7
|
@media (prefers-color-scheme:dark){
|
|
8
|
-
#${
|
|
9
|
-
#${
|
|
10
|
-
}`,(document.head||document.documentElement).appendChild(u)}function
|
|
8
|
+
#${S}{background:#09090b;color:#fafafa}
|
|
9
|
+
#${A}{background:#d97706;color:#111}
|
|
10
|
+
}`,(document.head||document.documentElement).appendChild(u)}function T(u){let g=document.getElementById(u);g&&g.remove()}function y(u,g){E(),T(S),T(A);let a=document.createElement("div");a.id=S,a.setAttribute("role","alertdialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-labelledby","stagepass-maintenance-title"),a.setAttribute("aria-describedby","stagepass-maintenance-desc"),a.tabIndex=-1;let c=document.createElement("div");c.className="sp-m-card";let x=document.createElement("h1");x.id="stagepass-maintenance-title",x.className="sp-m-title",x.textContent=u;let e=document.createElement("p");e.id="stagepass-maintenance-desc",e.className="sp-m-text",e.textContent=g,c.appendChild(x),c.appendChild(e),a.appendChild(c);let t=()=>{(document.body||document.documentElement).appendChild(a);try{a.focus()}catch{}};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function b(u){E(),T(S),T(A);let g=document.createElement("div");g.id=A,g.setAttribute("role","status"),g.textContent=`Maintenance mode on (visitors see: ${u})`;let a=()=>{(document.body||document.documentElement).appendChild(g)};document.body?a():document.addEventListener("DOMContentLoaded",a,{once:!0})}function k(u){let g=!1,a=C,c=O;function x(d){d?.title&&(a=String(d.title)),d?.text&&(c=String(d.text)),g=!0,M(u)?b(a):y(a,c)}function e(){g=!1,T(S),T(A)}function t(){return g}u.maintenance={enable:x,disable:e,isActive:t};let o=L();if(o?.getAttribute("data-stagepass-maintenance")==="true"){let d=o?.getAttribute("data-stagepass-maintenance-title")||C,h=o?.getAttribute("data-stagepass-maintenance-text")||O;x({title:d,text:h})}}let w=$();if(!w)return;typeof w.use=="function"?w.use("maintenance","2.0.0",k):k(w),globalThis.stagepass=w,window.sp=w,globalThis.sp=w})();})();
|
package/dist/cookies.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var StagepassInject=(()=>{(function(){function
|
|
1
|
+
"use strict";var StagepassInject=(()=>{(function(){function I(){let s=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;return s||null}function N(s){return!!(s&&(typeof s.env=="function"||typeof s.use=="function"))}function A(){try{console.warn("[Stagepass] Core loader should be loaded before the cookies module.")}catch{}}function y(s,r){if(!(r==null||r==="")&&/[;\r\n]/.test(r))throw new Error(`Invalid cookie ${s}`)}function _(){return window.location.protocol==="https:"}function p(s){try{return decodeURIComponent(s)}catch{return s}}function S(s,r){let l=r.decode!==!1?p(s):s;if(!r.json)return l;try{return JSON.parse(l)}catch{return l}}function C(s){let r=new Map,c=[],l=()=>!0,h={bake:new Set,throw:new Set};function b(e,n){h[e].forEach(o=>{try{o(n)}catch{}})}function D(e,n){let o=h[e];return!o||typeof n!="function"?()=>{}:(o.add(n),()=>{o.delete(n)})}function v(e,n,o={}){if(!e||typeof e!="string"||e.includes(";")||/[\r\n]/.test(e))throw new Error("Invalid cookie name");let i=o.encode!==!1,t=o.sameSite||"Lax";y("sameSite",t);let u=o.secure!==void 0?o.secure:_(),a=o.path||"/";y("path",a),y("domain",o.domain);let d=o.json?JSON.stringify(n):String(n);i||(y("value",d),y("name",e));let w=i?encodeURIComponent(e):e;d=i?encodeURIComponent(d):d;let g=[`${w}=${d}`];if(typeof o.maxAge=="number"&&g.push(`Max-Age=${Math.floor(o.maxAge)}`),typeof o.days=="number"){let k=new Date(Date.now()+o.days*24*60*60*1e3);g.push(`Expires=${k.toUTCString()}`)}a&&g.push(`Path=${a}`),o.domain&&g.push(`Domain=${o.domain}`),g.push(`SameSite=${t}`);let m=u;if(t==="None"&&!m){m=!0;let k="SameSite=None requires Secure=true. Enforcing Secure for cookie write.";if(typeof s.warn=="function")s.warn(k);else try{console.warn(k)}catch{}}m&&g.push("Secure"),document.cookie=g.join("; ")}function E(e,n,o={}){let i=o.category,t={name:e,value:n,options:{...o},category:i};if(i&&!l(i)){let a=c.findIndex(d=>d.name===e);a>=0&&c.splice(a,1),c.push(t),r.set(e,t);return}v(e,n,o),r.set(e,t);let u=c.findIndex(a=>a.name===e);u>=0&&c.splice(u,1),b("bake",i?{name:e,category:i}:{name:e})}function O(e,n={}){if(!e||typeof e!="string")return null;let o=n.decode===!1?e:p(e),i=document.cookie?document.cookie.split("; "):[];for(let t of i){let u=t.indexOf("=");if(u<0)continue;let a=t.substring(0,u),d=t.substring(u+1),w=p(a);if(a===o||w===o)return S(d,n)}return null}function $(e){return O(e)!==null}function j(e={}){let n=document.cookie?document.cookie.split("; "):[],o={};for(let i of n){let t=i.indexOf("=");if(t<0)continue;let u=i.substring(0,t),a=i.substring(t+1),d=e.decode===!1?u:p(u);o[d]=S(a,e)}return o}function x(e,n={}){let o=r.get(e);v(e,"",{days:-1,maxAge:0,path:n.path||"/",domain:n.domain,secure:n.secure,sameSite:n.sameSite}),r.delete(e);let i=c.findIndex(t=>t.name===e);i>=0&&c.splice(i,1),b("throw",o?.category?{name:e,category:o.category}:{name:e})}function L(e={}){let n=e.category,o=[];r.forEach((i,t)=>{(!n||i.category===n)&&o.push(t)});for(let i of o){let t=r.get(i);x(i,{path:t?.options.path,domain:t?.options.domain,secure:t?.options.secure,sameSite:t?.options.sameSite})}}function K(){let e={};return r.forEach((n,o)=>{e[o]=n.value}),e}function M(e){let n=e==null?"":String(e),o=[];return r.forEach((i,t)=>{t.startsWith(n)&&o.push(t)}),o}let R={bake:E,eat:O,throw:x,has:$,list:j,throwAll:L,jar:K,crumbs:M,on:D},U={allows(e){try{return l(e)===!0}catch{return!1}},set(e){typeof e=="function"&&(l=e)},update(){let e=c.splice(0,c.length);for(let n of e)!n.category||l(n.category)?E(n.name,n.value,n.options):c.push(n)}};s.cookies=R,s.cookie=R,s.consent=U}let f=I()||{};N(f)||A(),typeof f.use=="function"?f.use("cookies","2.0.0",C):C(f),window.stagepass=f,globalThis.stagepass=f,window.sp=f,globalThis.sp=f})();})();
|
package/dist/inject.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var StagepassInject=(()=>{(function(){function
|
|
1
|
+
"use strict";var StagepassInject=(()=>{(function(){function d(){let t=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;return t||null}function m(t){return!!(t&&(typeof t.env=="function"||typeof t.use=="function"))}function w(){try{console.warn("[Stagepass] Core loader should be loaded before the inject module.")}catch{}}let h=new Set(["src","href","rel","integrity","crossorigin","nonce"]);function u(t){try{let e=d();e&&typeof e.log=="function"&&e.log(t)}catch{}}function I(t){try{let e=d();if(e&&typeof e.warn=="function"){e.warn(t);return}}catch{}try{console.warn(`[Stagepass] ${t}`)}catch{}}function g(...t){try{let e=d();e&&typeof e.error=="function"&&e.error(...t)}catch{}}function O(t){if(!t||typeof t!="string")return"file";try{let n=new URL(t).pathname||"";if(!n||n.length===0){let c=t.match(/\/([^\/\?#]+)(?:\?|#|$)/);return c?c[1]:"file"}let r=n.split("/");return r[r.length-1]||r[r.length-2]||"file"}catch{try{let n=t.match(/\/([^\/\?#]+)(?:\?|#|$)/);return n?n[1]:"file"}catch{return"file"}}}function p(t,e){if(e)return e;if(!t||typeof t!="string")return"script";try{if(t.split(".").pop()?.toLowerCase()==="css")return"style"}catch{}return"script"}function E(t,e,n){let r=encodeURIComponent(n),c=t.indexOf("#"),o=c>=0?t.slice(c):"",i=c>=0?t.slice(0,c):t,s=i.includes("?")?"&":"?";return`${i}${s}${encodeURIComponent(e)}=${r}${o}`}function S(t,e){if(!e||e.length===0)return!0;try{let n=new URL(t,window.location.href).hostname.toLowerCase();return e.map(c=>String(c).toLowerCase()).includes(n)}catch{return!1}}function L(t){let{src:e,stagepass:n,localPath:r,path:c,version:o}=t;if(!e||typeof e!="string")throw new Error("Invalid src: must be a non-empty string");if(n!==!1){let i=r||c||O(e);if(i&&typeof i=="string"){let s=i.startsWith("/")?i.substring(1):i,a=d();if(a&&typeof a.resolveLocalUrl=="function"){let f=a.resolveLocalUrl(s);if(f)return f}}}return o?E(e,"v",o):e}function T(t,e){let{id:n,type:r}=t,c=p(t.src,r);if(n&&document.getElementById(n))return u(`Skipping injection: Element with id "${n}" already exists`),!0;if(c==="script"){let o=document.getElementsByTagName("script");for(let i=0;i<o.length;i++)if(o[i].getAttribute("src")===e)return u(`Skipping injection: Resource "${e}" already loaded`),!0}else{let o=document.getElementsByTagName("link");for(let i=0;i<o.length;i++)if(o[i].getAttribute("href")===e)return u(`Skipping injection: Resource "${e}" already loaded`),!0}return!1}function $(t="body-end"){if(typeof t=="string")return t==="head"?document.head:document.body;let{target:e,action:n}=t,r=document.querySelector(e);return r?n==="before"?r:r.nextSibling||r.parentNode:(u(`Warning: Target selector "${e}" not found, falling back to body-end`),document.body)}function b(t,e){e.integrity&&t.setAttribute("integrity",e.integrity),e.crossorigin&&t.setAttribute("crossorigin",e.crossorigin),e.nonce&&t.setAttribute("nonce",e.nonce)}function A(t){return new Promise((e,n)=>{if(!t.src){let s=new Error('InjectOptions must have a "src" property');g(s),n(s);return}if(!S(t.src,t.allowedHosts)){I(`inject: host not allowed for "${t.src}". Check allowedHosts.`),e();return}let r=p(t.src,t.type),c=L(t);if(T(t,c)){e();return}let o=r==="script"?document.createElement("script"):document.createElement("link");if(r==="script"){let s=o;t.async?s.async=!0:(s.async=!1,t.defer!==!1&&(s.defer=!0)),t.id&&(s.id=t.id),t.attributes&&Object.entries(t.attributes).forEach(([a,f])=>{h.has(String(a).toLowerCase())||s.setAttribute(a,f)}),s.src=c,b(s,t),s.onload=()=>{u(`Injected: ${c}`),e()},s.onerror=()=>{let a=new Error(`Failed to load script: ${c}`);g(a),n(a)}}else{let s=o;t.id&&(s.id=t.id),t.attributes&&Object.entries(t.attributes).forEach(([f,y])=>{h.has(String(f).toLowerCase())||s.setAttribute(f,y)}),s.rel="stylesheet",s.href=c,b(s,t);let a=setInterval(()=>{(s.sheet||s.styleSheet)&&(clearInterval(a),u(`Injected: ${c}`),e())},10);setTimeout(()=>{if(clearInterval(a),!(s.sheet||s.styleSheet)){let y=new Error(`Failed to load stylesheet: ${c}`);g(y),n(y)}},5e3)}let i=$(t.position);if(!i){n(new Error("Could not find insertion point"));return}if(i===document.head||i===document.body)t.position==="body-start"?i.prepend(o):i.appendChild(o);else{let s=i.parentNode;s&&(typeof t.position=="object"&&t.position.action==="before"?s.insertBefore(o,i):s.insertBefore(o,i.nextSibling))}})}async function P(t){let e=[];if(!Array.isArray(t)&&typeof t=="object"&&("scripts"in t||"styles"in t)){let n=t;n.scripts&&e.push(...n.scripts.filter(r=>r&&typeof r=="object"&&"src"in r&&typeof r.src=="string"&&r.src.trim().length>0).map(r=>({...r,type:"script"}))),n.styles&&e.push(...n.styles.filter(r=>r&&typeof r=="object"&&"src"in r&&typeof r.src=="string"&&r.src.trim().length>0).map(r=>({...r,type:"style"})))}else Array.isArray(t)?e=t.filter(n=>n&&typeof n=="object"&&"src"in n&&typeof n.src=="string"&&n.src.trim().length>0):t&&typeof t=="object"&&"src"in t&&typeof t.src=="string"&&t.src.trim().length>0&&(e=[t]);for(let n of e)try{await A(n)}catch(r){g("Injection error:",r)}}function j(t){t.inject=P}let l=d()||{};m(l)||w(),typeof l.use=="function"?l.use("inject","2.0.0",j):j(l),window.stagepass=l,globalThis.stagepass=l,window.sp=l,globalThis.sp=l})();})();
|
package/dist/maintenance.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var StagepassInject=(()=>{(function(){let s="stagepass-maintenance-overlay",c="stagepass-maintenance-badge",p="stagepass-maintenance-style",f="We will be back soon",g="This site is temporarily unavailable while we perform maintenance.";function h(){let t=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;if(!t
|
|
1
|
+
"use strict";var StagepassInject=(()=>{(function(){let s="stagepass-maintenance-overlay",c="stagepass-maintenance-badge",p="stagepass-maintenance-style",f="We will be back soon",g="This site is temporarily unavailable while we perform maintenance.";function h(){let t=window.stagepass||globalThis.stagepass||window.sp||globalThis.sp;if(!t||typeof t.env!="function"&&typeof t.use!="function"){try{console.warn("[Stagepass] Core loader must be loaded before the maintenance module. Skipping registration.")}catch{}return null}return t}function E(){try{if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}catch{}try{let t=document.querySelectorAll('script[src*="maintenance"]');for(let e=t.length-1;e>=0;e--){let a=t[e];if(/maintenance(?:\.min)?\.js/i.test(a.src||""))return a}let n=document.querySelectorAll('script[src*="all"]');for(let e=n.length-1;e>=0;e--){let a=n[e];if(/all(?:\.min)?\.js/i.test(a.src||"")&&a.hasAttribute("data-stagepass-maintenance"))return a}}catch{}return null}function x(t){try{if(typeof t.is=="function"&&t.is("local"))return!0}catch{}try{let n=localStorage.getItem("stagepass_domain");if(!n)return!1;if(n.startsWith("{")){let e=JSON.parse(n),a=e&&e.domain;if(a==="debug"||typeof a=="string"&&a.endsWith(".sp")||a==="localhost"||typeof a=="string"&&a.startsWith("localhost:"))return!0}}catch{}return!1}function b(){if(document.getElementById(p))return;let t=document.createElement("style");t.id=p,t.textContent=`
|
|
2
2
|
#${s}{position:fixed;inset:0;z-index:2147483646;display:flex;align-items:center;justify-content:center;padding:24px;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:#f4f4f5;color:#18181b}
|
|
3
3
|
#${s} .sp-m-card{max-width:32rem;width:100%;text-align:center}
|
|
4
4
|
#${s} .sp-m-title{margin:0 0 12px;font-size:1.75rem;line-height:1.2;font-weight:700}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stagepass/modules",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Modular feature extensions for Stagepass",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/all.min.js",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
],
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "git+https://github.com/
|
|
32
|
+
"url": "git+https://github.com/stagepass-one/os.git",
|
|
33
33
|
"directory": "packages/modules"
|
|
34
34
|
},
|
|
35
35
|
"license": "MIT",
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@stagepass/loader": ">=2.0.0"
|
|
37
|
+
"@stagepass/loader": ">=2.0.0 || >=2.3.0-beta.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"tsup": "^8.0.1",
|