@livx.cc/iab-escape 0.3.1 → 0.4.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/README.md +6 -0
- package/dist/IabEscape.d.ts +20 -0
- package/dist/IabEscape.js +56 -4
- package/dist/iab-escape.min.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,6 +108,12 @@ myUi.onContinue(() => esc.dismiss());
|
|
|
108
108
|
|
|
109
109
|
2026-11-16, organic links: iOS 26.7.3 with Facebook 587 and Instagram 455, and Android 16 with Facebook 587. Each combination passed 3/3 for calls on load and for late calls (SPA-style, 0.8 s after load).
|
|
110
110
|
|
|
111
|
+
## Declined the prompt
|
|
112
|
+
|
|
113
|
+
"Continue here" navigates the webview to the destination (`continueUrl` / `data-continue-url`, default: the `url` / `data-url` target; with no url it only removes the overlay). A custom UI calls `esc.continue()`.
|
|
114
|
+
|
|
115
|
+
`fallback: 'auto'` (`data-fallback="auto"`, default `'manual'`) continues by itself when the page is still here `fallbackMs` (default 2500) after the fire. A native confirm may leave the page visible with timers running, so it only continues when `document.visibilityState` is `visible` and `document.hasFocus()` is true, re-checking every 500 ms up to `fallbackMaxMs` (15000). This focus check is device-unverified. No re-fire happens after it navigates.
|
|
116
|
+
|
|
111
117
|
## Limits
|
|
112
118
|
|
|
113
119
|
- The schemes are undocumented by Meta and an app update can break them: keep a fallback link and monitor.
|
package/dist/IabEscape.d.ts
CHANGED
|
@@ -33,6 +33,14 @@ export declare class IabEscapeOptions {
|
|
|
33
33
|
theme: Theme;
|
|
34
34
|
/** Phase callback for a custom UI (also called when the built-in UI is on). */
|
|
35
35
|
onState: ((state: State) => void) | null;
|
|
36
|
+
/** Where "Continue here" (and the auto fallback) navigates the webview. Default: `url`; none -> just dismiss. */
|
|
37
|
+
continueUrl: string | null;
|
|
38
|
+
/** 'auto': if the page did not go away after the fire, continue in the webview by itself. Device-unverified. */
|
|
39
|
+
fallback: 'manual' | 'auto';
|
|
40
|
+
/** 'auto' only: wait this long after the fire before the first check. */
|
|
41
|
+
fallbackMs: number;
|
|
42
|
+
/** 'auto' only: stop re-checking (every 500 ms while the page is unfocused or hidden) this long after the fire. */
|
|
43
|
+
fallbackMaxMs: number;
|
|
36
44
|
/** Max automatic fires per page lifetime (the first fire + re-entry re-fires). */
|
|
37
45
|
maxAutoFires: number;
|
|
38
46
|
/** Injectable for tests. Default: globalThis.window. */
|
|
@@ -52,12 +60,16 @@ export declare class IabEscape {
|
|
|
52
60
|
private wentAway;
|
|
53
61
|
private locked;
|
|
54
62
|
private dismissed;
|
|
63
|
+
private fallbackSeq;
|
|
64
|
+
private base;
|
|
55
65
|
constructor(options?: Partial<IabEscapeOptions> | undefined);
|
|
56
66
|
private get o();
|
|
57
67
|
private get win();
|
|
58
68
|
detect(): Env;
|
|
59
69
|
getRule(): Rule | null;
|
|
60
70
|
buildUrl(): string | null;
|
|
71
|
+
/** The page URL, captured before the first navigation (relative urls must not resolve against a scheme URL). */
|
|
72
|
+
private pageUrl;
|
|
61
73
|
/** Resolves the target (relative `url` against the current location); the query is never re-serialized. */
|
|
62
74
|
private target;
|
|
63
75
|
/** Fire now. Call inside a user gesture when wired to a button. */
|
|
@@ -74,6 +86,14 @@ export declare class IabEscape {
|
|
|
74
86
|
private state;
|
|
75
87
|
/** Stops re-fires and removes the built-in loader. Wire a custom UI's "Continue here" to this. */
|
|
76
88
|
dismiss(): void;
|
|
89
|
+
/** "Continue here": dismiss, then navigate the current webview to the destination (if there is one). */
|
|
90
|
+
continue(): void;
|
|
91
|
+
private continueTarget;
|
|
92
|
+
/**
|
|
93
|
+
* 'auto' fallback: if the page is still here after the fire, continue in the webview. A native confirm may leave
|
|
94
|
+
* the page 'visible' with timers running, so only continue when it is visible AND focused; else re-check.
|
|
95
|
+
*/
|
|
96
|
+
private armAutoFallback;
|
|
77
97
|
private fallback;
|
|
78
98
|
private delay;
|
|
79
99
|
/** One automatic fire: escape(), count it, start watching for re-entry, reveal the button soon after. */
|
package/dist/IabEscape.js
CHANGED
|
@@ -150,6 +150,10 @@ class IabEscapeOptions {
|
|
|
150
150
|
labels = {};
|
|
151
151
|
theme = {};
|
|
152
152
|
onState = null;
|
|
153
|
+
continueUrl = null;
|
|
154
|
+
fallback = "manual";
|
|
155
|
+
fallbackMs = 2500;
|
|
156
|
+
fallbackMaxMs = 15000;
|
|
153
157
|
maxAutoFires = 3;
|
|
154
158
|
window = null;
|
|
155
159
|
}
|
|
@@ -164,6 +168,13 @@ function optionsFromDataset(d) {
|
|
|
164
168
|
o.includeUnproven = true;
|
|
165
169
|
if (d.url)
|
|
166
170
|
o.url = d.url;
|
|
171
|
+
if (d.continueUrl)
|
|
172
|
+
o.continueUrl = d.continueUrl;
|
|
173
|
+
if (d.fallback === "auto" || d.fallback === "manual")
|
|
174
|
+
o.fallback = d.fallback;
|
|
175
|
+
const fm = d.fallbackMs?.trim();
|
|
176
|
+
if (fm && Number.isFinite(Number(fm)) && Number(fm) >= 0)
|
|
177
|
+
o.fallbackMs = Number(fm);
|
|
167
178
|
if (d.ui !== undefined)
|
|
168
179
|
o.ui = d.ui !== "false";
|
|
169
180
|
const theme = {};
|
|
@@ -189,19 +200,22 @@ function optionsFromDataset(d) {
|
|
|
189
200
|
var WATCH_MS = 3000;
|
|
190
201
|
var REVEAL_MS = 800;
|
|
191
202
|
var REENTER_LOCK_MS = 1000;
|
|
203
|
+
var AUTO_RECHECK_MS = 500;
|
|
192
204
|
var FIRED = "__iabEscapeFired";
|
|
193
205
|
var hasParam = (url, key) => new URLSearchParams(url.split("#")[0].split("?")[1] ?? "").has(key);
|
|
194
206
|
|
|
195
207
|
class IabEscape {
|
|
196
208
|
options;
|
|
197
|
-
static version = "0.
|
|
198
|
-
static buildTime = "2026-11-
|
|
209
|
+
static version = "0.4.0";
|
|
210
|
+
static buildTime = "2026-11-17T09:35:22.763Z";
|
|
199
211
|
ldr = null;
|
|
200
212
|
fires = 0;
|
|
201
213
|
watching = false;
|
|
202
214
|
wentAway = false;
|
|
203
215
|
locked = false;
|
|
204
216
|
dismissed = false;
|
|
217
|
+
fallbackSeq = 0;
|
|
218
|
+
base = "";
|
|
205
219
|
constructor(options) {
|
|
206
220
|
this.options = options;
|
|
207
221
|
this.options = { ...new IabEscapeOptions, ...options };
|
|
@@ -225,8 +239,11 @@ class IabEscape {
|
|
|
225
239
|
const target = rule && this.target();
|
|
226
240
|
return rule && target ? rule.build(target) : null;
|
|
227
241
|
}
|
|
242
|
+
pageUrl() {
|
|
243
|
+
return this.base ||= this.win.location.href;
|
|
244
|
+
}
|
|
228
245
|
target() {
|
|
229
|
-
const base = this.
|
|
246
|
+
const base = this.pageUrl();
|
|
230
247
|
const input = this.o.url ?? base;
|
|
231
248
|
let resolved;
|
|
232
249
|
try {
|
|
@@ -297,7 +314,7 @@ class IabEscape {
|
|
|
297
314
|
};
|
|
298
315
|
}
|
|
299
316
|
loader() {
|
|
300
|
-
return this.ldr ??= new Loader(this.win.document, { ...DEFAULT_LABELS, ...this.o.labels }, this.o.theme, () => this.
|
|
317
|
+
return this.ldr ??= new Loader(this.win.document, { ...DEFAULT_LABELS, ...this.o.labels }, this.o.theme, () => this.continue());
|
|
301
318
|
}
|
|
302
319
|
state(phase) {
|
|
303
320
|
this.o.onState?.({ phase, url: this.buildUrl() });
|
|
@@ -307,6 +324,39 @@ class IabEscape {
|
|
|
307
324
|
this.ldr?.hide();
|
|
308
325
|
this.state("dismissed");
|
|
309
326
|
}
|
|
327
|
+
continue() {
|
|
328
|
+
this.dismiss();
|
|
329
|
+
const to = this.continueTarget();
|
|
330
|
+
if (to)
|
|
331
|
+
this.win.location.href = to;
|
|
332
|
+
}
|
|
333
|
+
continueTarget() {
|
|
334
|
+
const input = this.o.continueUrl ?? this.o.url;
|
|
335
|
+
if (!input)
|
|
336
|
+
return null;
|
|
337
|
+
try {
|
|
338
|
+
const u = new URL(input, this.pageUrl());
|
|
339
|
+
return /^https?:$/.test(u.protocol) ? /^https?:\/\//i.test(input) ? input : u.href : null;
|
|
340
|
+
} catch {
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
armAutoFallback() {
|
|
345
|
+
const { win } = this;
|
|
346
|
+
const doc = win.document;
|
|
347
|
+
const seq = ++this.fallbackSeq;
|
|
348
|
+
let waited = this.o.fallbackMs;
|
|
349
|
+
const check = () => {
|
|
350
|
+
if (seq !== this.fallbackSeq || this.dismissed || this.wentAway)
|
|
351
|
+
return;
|
|
352
|
+
if (doc.visibilityState === "visible" && (doc.hasFocus?.() ?? true))
|
|
353
|
+
return this.continue();
|
|
354
|
+
waited += AUTO_RECHECK_MS;
|
|
355
|
+
if (waited <= this.o.fallbackMaxMs)
|
|
356
|
+
win.setTimeout(check, AUTO_RECHECK_MS);
|
|
357
|
+
};
|
|
358
|
+
win.setTimeout(check, this.o.fallbackMs);
|
|
359
|
+
}
|
|
310
360
|
fallback() {
|
|
311
361
|
const url = this.buildUrl();
|
|
312
362
|
if (url && this.o.ui)
|
|
@@ -327,6 +377,8 @@ class IabEscape {
|
|
|
327
377
|
if (!this.dismissed)
|
|
328
378
|
this.fallback();
|
|
329
379
|
}, REVEAL_MS);
|
|
380
|
+
if (this.o.fallback === "auto")
|
|
381
|
+
this.armAutoFallback();
|
|
330
382
|
return true;
|
|
331
383
|
}
|
|
332
384
|
watchReentry() {
|
package/dist/iab-escape.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var{defineProperty:
|
|
1
|
+
(()=>{var{defineProperty:u,getOwnPropertyNames:A,getOwnPropertyDescriptor:L}=Object,O=Object.prototype.hasOwnProperty;function M(e){return this[e]}var S=(e)=>{var t=(d??=new WeakMap).get(e),i;if(t)return t;if(t=u({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function"){for(var n of A(e))if(!O.call(t,n))u(t,n,{get:M.bind(e,n),enumerable:!(i=L(e,n))||i.enumerable})}return d.set(e,t),t},d;var _=(e)=>e;function R(e,t){this[e]=_.bind(null,t)}var I=(e,t)=>{for(var i in t)u(e,i,{get:t[i],enumerable:!0,configurable:!0,set:R.bind(t,i)})};var C={};I(C,{boot:()=>T});var U=[["threads",/Barcelona/],["instagram",/Instagram/],["messenger",/FBAN\/MessengerForiOS|FB_IAB\/MESSENGER|Orca/],["facebook",/FBAN|FBAV|FB_IAB/]];function h(e){let t=U.find(([,n])=>n.test(e))?.[0]??null,i=/iPhone|iPad|iPod/.test(e)?"ios":/Android/.test(e)?"android":null;return{app:t,os:i,inApp:t!==null}}var b={opening:"Opening in your browser…",open:"Open in browser",stay:"Continue here"},f={bg:"--iab-bg",fg:"--iab-fg",accent:"--iab-accent",accentFg:"--iab-accent-fg",radius:"--iab-radius",font:"--iab-font"};class p{doc;labels;theme;onStay;root=null;open;stay;spin;constructor(e,t,i={},n){this.doc=e;this.labels=t;this.theme=i;this.onStay=n}get visible(){return this.root!==null}show(){if(!this.root)this.build();this.spin.hidden=!1,this.open.hidden=!0,this.stay.hidden=!0}reveal(e){if(!this.root)this.build();this.open.href=e,this.open.hidden=!1,this.stay.hidden=!1}hide(){this.root?.remove(),this.root=null}el(e,t,i){let n=this.doc.createElement(e);if(n.className=t,i)n.textContent=i;return n}build(){let e=this.el("div","");e.id="iab-escape",e.setAttribute("role","status");let t=Object.keys(f).filter((s)=>this.theme[s]).map((s)=>`${f[s]}:${this.theme[s]}`).join(";");if(t)e.setAttribute("style",t);let i=this.doc.createElement("style");i.textContent=`
|
|
2
2
|
#iab-escape{position:fixed;inset:0;z-index:2147483647;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;
|
|
3
3
|
padding:max(24px,env(safe-area-inset-top)) max(24px,env(safe-area-inset-right)) max(24px,env(safe-area-inset-bottom)) max(24px,env(safe-area-inset-left));
|
|
4
4
|
background:var(--iab-bg,#fff);color:var(--iab-fg,#111);font:var(--iab-font,18px/1.35 -apple-system,system-ui,sans-serif);text-align:center}
|
|
@@ -8,4 +8,4 @@ background:var(--iab-bg,#fff);color:var(--iab-fg,#111);font:var(--iab-font,18px/
|
|
|
8
8
|
#iab-escape [hidden]{display:none}
|
|
9
9
|
@keyframes ie-r{to{transform:rotate(360deg)}}
|
|
10
10
|
@media (prefers-color-scheme:dark){#iab-escape{background:var(--iab-bg,#111);color:var(--iab-fg,#f2f2f2)}}
|
|
11
|
-
@media (prefers-reduced-motion:reduce){#iab-escape .ie-spin{animation:none}}`,this.spin=this.el("div","ie-spin");let n=this.el("div","ie-msg",this.labels.opening);this.open=this.el("a","ie-open",this.labels.open),this.stay=this.el("a","ie-stay",this.labels.stay),this.stay.href="#",this.stay.addEventListener("click",(s)=>{s.preventDefault(),this.hide(),this.onStay?.()});for(let s of[i,this.spin,n,this.open,this.stay])e.appendChild(s);(this.doc.body??this.doc.documentElement).appendChild(e),this.root=e}}var m=(e)=>e.protocol==="https:"?"x-safari-"+e.href:null,g=(e)=>(t)=>`${e}://extbrowser/?url=${encodeURIComponent(t.href)}`,v=(e)=>`intent://${e.noHash.replace(/^https?:\/\//i,"")}#Intent;scheme=${e.protocol.slice(0,-1)};end`;var y=[{app:"instagram",os:"ios",proven:!0,delayMs:0,build:g("instagram"),testedOn:{date:"2026-11-16",os:"iOS 26.7.3",app:"Instagram 455.0.0.35.67"}},{app:"facebook",os:"ios",proven:!0,delayMs:1500,build:m,testedOn:{date:"2026-11-16",os:"iOS 26.7.3",app:"Facebook 587.0.0.31.71"}},{app:"facebook",os:"android",proven:!0,delayMs:0,build:v,testedOn:{date:"2026-11-16",os:"Android 16",app:"Facebook 587.0.0.39.55"}},{app:"instagram",os:"android",proven:!1,delayMs:0,build:v,testedOn:null},{app:"threads",os:"ios",proven:!1,delayMs:0,build:g("barcelona"),testedOn:null},{app:"messenger",os:"ios",proven:!1,delayMs:1500,build:m,testedOn:null}];class
|
|
11
|
+
@media (prefers-reduced-motion:reduce){#iab-escape .ie-spin{animation:none}}`,this.spin=this.el("div","ie-spin");let n=this.el("div","ie-msg",this.labels.opening);this.open=this.el("a","ie-open",this.labels.open),this.stay=this.el("a","ie-stay",this.labels.stay),this.stay.href="#",this.stay.addEventListener("click",(s)=>{s.preventDefault(),this.hide(),this.onStay?.()});for(let s of[i,this.spin,n,this.open,this.stay])e.appendChild(s);(this.doc.body??this.doc.documentElement).appendChild(e),this.root=e}}var m=(e)=>e.protocol==="https:"?"x-safari-"+e.href:null,g=(e)=>(t)=>`${e}://extbrowser/?url=${encodeURIComponent(t.href)}`,v=(e)=>`intent://${e.noHash.replace(/^https?:\/\//i,"")}#Intent;scheme=${e.protocol.slice(0,-1)};end`;var y=[{app:"instagram",os:"ios",proven:!0,delayMs:0,build:g("instagram"),testedOn:{date:"2026-11-16",os:"iOS 26.7.3",app:"Instagram 455.0.0.35.67"}},{app:"facebook",os:"ios",proven:!0,delayMs:1500,build:m,testedOn:{date:"2026-11-16",os:"iOS 26.7.3",app:"Facebook 587.0.0.31.71"}},{app:"facebook",os:"android",proven:!0,delayMs:0,build:v,testedOn:{date:"2026-11-16",os:"Android 16",app:"Facebook 587.0.0.39.55"}},{app:"instagram",os:"android",proven:!1,delayMs:0,build:v,testedOn:null},{app:"threads",os:"ios",proven:!1,delayMs:0,build:g("barcelona"),testedOn:null},{app:"messenger",os:"ios",proven:!1,delayMs:1500,build:m,testedOn:null}];class k{url=null;userAgent=null;delayMs=null;includeUnproven=!1;markParam="iab_escaped";onAttempt=null;onResult=null;ui=!0;labels={};theme={};onState=null;continueUrl=null;fallback="manual";fallbackMs=2500;fallbackMaxMs=15000;maxAutoFires=3;window=null}function x(e){let t={},i=e.delayMs?.trim();if(i&&Number.isFinite(Number(i))&&Number(i)>=0)t.delayMs=Number(i);if(e.markParam!==void 0)t.markParam=e.markParam===""?null:e.markParam;if(e.includeUnproven!==void 0)t.includeUnproven=!0;if(e.url)t.url=e.url;if(e.continueUrl)t.continueUrl=e.continueUrl;if(e.fallback==="auto"||e.fallback==="manual")t.fallback=e.fallback;let n=e.fallbackMs?.trim();if(n&&Number.isFinite(Number(n))&&Number(n)>=0)t.fallbackMs=Number(n);if(e.ui!==void 0)t.ui=e.ui!=="false";let s={};if(e.accent)s.accent=e.accent;if(e.bg)s.bg=e.bg;if(e.fg)s.fg=e.fg;if(Object.keys(s).length)t.theme=s;let a={};if(e.labelOpening)a.opening=e.labelOpening;if(e.labelOpen)a.open=e.labelOpen;if(e.labelStay)a.stay=e.labelStay;if(Object.keys(a).length)t.labels=a;return t}var F=3000,P=800,N=1000,w=500,l="__iabEscapeFired",E=(e,t)=>new URLSearchParams(e.split("#")[0].split("?")[1]??"").has(t);class c{options;static version="0.4.0";static buildTime="2026-11-17T09:35:22.763Z";ldr=null;fires=0;watching=!1;wentAway=!1;locked=!1;dismissed=!1;fallbackSeq=0;base="";constructor(e){this.options=e;this.options={...new k,...e}}get o(){return this.options}get win(){return this.o.window??globalThis.window}detect(){return h(this.o.userAgent??this.win.navigator.userAgent)}getRule(){let{app:e,os:t}=this.detect(),i=y.find((n)=>n.app===e&&n.os===t);return i&&(i.proven||this.o.includeUnproven)?i:null}buildUrl(){let e=this.getRule(),t=e&&this.target();return e&&t?e.build(t):null}pageUrl(){return this.base||=this.win.location.href}target(){let e=this.pageUrl(),t=this.o.url??e,i;try{i=new URL(t,e)}catch{return null}if(!/^https?:$/.test(i.protocol))return null;let n=/^https?:\/\//i.test(t)?t:i.href,s=n.indexOf("#"),a=s<0?n:n.slice(0,s),o=s<0?"":n.slice(s),r=this.o.markParam;if(r&&!E(a,r))a+=(a.includes("?")?/[?&]$/.test(a)?"":"&":"?")+r+"=1";return{href:a+o,noHash:a,protocol:i.protocol}}escape(){let e=this.getRule(),t=this.buildUrl();if(!e||!t)return!1;return this.o.onAttempt?.({rule:e,url:t}),this.win.location.href=t,this.watch({rule:e,url:t}),!0}auto(){let{win:e}=this,t=this.o.markParam,i=this.getRule();if(!i||e[l]||t&&E(e.location.href,t))return()=>{};e[l]=!0;let{document:n}=e;if(this.dismissed=!1,this.o.ui)this.loader().show();this.state("opening");let s=!1,a,o=()=>{if(s=!0,!this.fireNow())e[l]=!1},r=()=>{if(n.removeEventListener("DOMContentLoaded",r),this.delay(i)<=0)o();else a=e.setTimeout(o,this.delay(i))};if(n.readyState==="loading")n.addEventListener("DOMContentLoaded",r);else r();return()=>{if(s)return;if(n.removeEventListener("DOMContentLoaded",r),a!==void 0)e.clearTimeout(a);e[l]=!1,this.ldr?.hide()}}loader(){return this.ldr??=new p(this.win.document,{...b,...this.o.labels},this.o.theme,()=>this.continue())}state(e){this.o.onState?.({phase:e,url:this.buildUrl()})}dismiss(){this.dismissed=!0,this.ldr?.hide(),this.state("dismissed")}continue(){this.dismiss();let e=this.continueTarget();if(e)this.win.location.href=e}continueTarget(){let e=this.o.continueUrl??this.o.url;if(!e)return null;try{let t=new URL(e,this.pageUrl());return/^https?:$/.test(t.protocol)?/^https?:\/\//i.test(e)?e:t.href:null}catch{return null}}armAutoFallback(){let{win:e}=this,t=e.document,i=++this.fallbackSeq,n=this.o.fallbackMs,s=()=>{if(i!==this.fallbackSeq||this.dismissed||this.wentAway)return;if(t.visibilityState==="visible"&&(t.hasFocus?.()??!0))return this.continue();if(n+=w,n<=this.o.fallbackMaxMs)e.setTimeout(s,w)};e.setTimeout(s,this.o.fallbackMs)}fallback(){let e=this.buildUrl();if(e&&this.o.ui)this.loader().reveal(e);this.state("fallback")}delay(e){return this.o.delayMs??e.delayMs}fireNow(){if(!this.escape())return this.ldr?.hide(),!1;if(this.fires++,this.watchReentry(),this.win.setTimeout(()=>{if(!this.dismissed)this.fallback()},P),this.o.fallback==="auto")this.armAutoFallback();return!0}watchReentry(){if(this.watching)return;this.watching=!0;let{win:e}=this,t=e.document;e.addEventListener("pagehide",()=>{this.wentAway=!0}),t.addEventListener("visibilitychange",()=>{if(t.visibilityState==="hidden")this.wentAway=!0;else this.reenter()}),e.addEventListener("pageshow",(i)=>{if(i.persisted)this.wentAway=!0,this.reenter()})}reenter(){let{win:e}=this,t=this.getRule();if(!this.wentAway||this.locked||this.dismissed||!t)return;if(this.wentAway=!1,this.locked=!0,e.setTimeout(()=>{this.locked=!1},N),this.fires>=this.o.maxAutoFires)return this.fallback();if(this.o.ui)this.loader().show();if(this.state("reentry"),this.delay(t)<=0)this.fireNow();else e.setTimeout(()=>this.fireNow(),this.delay(t))}bindLink(e){let t=this.buildUrl();if(!t)return!1;return e.href=t,!0}watch(e){let{win:t}=this,i=!1,n=()=>{i=!0},s=()=>{if(t.document.visibilityState==="hidden")n()};t.addEventListener("pagehide",n),t.document.addEventListener("visibilitychange",s),t.setTimeout(()=>{t.removeEventListener("pagehide",n),t.document.removeEventListener("visibilitychange",s),this.o.onResult?.({...e,outcome:i?"left":"stayed-or-unknown"})},F)}}function T(e,t,i={}){t.IabEscape=c;let n=e?.currentScript;if(n?.hasAttribute("data-auto"))new c({...x(n.dataset),...i}).auto()}if(typeof document<"u")T(document,globalThis);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livx.cc/iab-escape",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Move users from the Facebook / Instagram in-app browser to the device default browser, using only trigger methods proven on real devices.",
|
|
6
6
|
"license": "MIT",
|