@jolibox/ads 1.4.12 → 1.4.14

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.
@@ -16,8 +16,6 @@ export interface IRewardAdContext {
16
16
  */
17
17
  export declare class RewardAdManager {
18
18
  private adsContext;
19
- private _isReady;
20
- private _isAvailable;
21
19
  constructor();
22
20
  /**
23
21
  * Initializes the reward ad by checking availability and preloading.
package/dist/index.js CHANGED
@@ -1,26 +1,26 @@
1
1
  var ln = Object.defineProperty, un = Object.defineProperties;
2
2
  var cn = Object.getOwnPropertyDescriptors;
3
- var We = Object.getOwnPropertySymbols;
3
+ var Je = Object.getOwnPropertySymbols;
4
4
  var qt = Object.prototype.hasOwnProperty, zt = Object.prototype.propertyIsEnumerable;
5
5
  var Kt = (t, e, i) => e in t ? ln(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i, yt = (t, e) => {
6
6
  for (var i in e || (e = {}))
7
7
  qt.call(e, i) && Kt(t, i, e[i]);
8
- if (We)
9
- for (var i of We(e))
8
+ if (Je)
9
+ for (var i of Je(e))
10
10
  zt.call(e, i) && Kt(t, i, e[i]);
11
11
  return t;
12
- }, Wt = (t, e) => un(t, cn(e));
13
- var Jt = (t, e) => {
12
+ }, Jt = (t, e) => un(t, cn(e));
13
+ var Wt = (t, e) => {
14
14
  var i = {};
15
15
  for (var n in t)
16
16
  qt.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]);
17
- if (t != null && We)
18
- for (var n of We(t))
17
+ if (t != null && Je)
18
+ for (var n of Je(t))
19
19
  e.indexOf(n) < 0 && zt.call(t, n) && (i[n] = t[n]);
20
20
  return i;
21
21
  };
22
22
  import { options as Te, Component as hn, isValidElement as fn } from "preact";
23
- import { useRef as mi, useLayoutEffect as vn, useEffect as Ce, useMemo as yn, useState as _e, useCallback as kt, render as ye, createRef as Ht } from "preact/compat";
23
+ import { useRef as mi, useLayoutEffect as vn, useEffect as Ce, useMemo as yn, useState as pe, useCallback as kt, render as ye, createRef as Ht } from "preact/compat";
24
24
  import { registerCanIUseContext as gn, invokeNative as gt, offNative as wn, onNative as An } from "@jolibox/native-bridge";
25
25
  var Si = Object.defineProperty, bn = Object.defineProperties, pn = Object.getOwnPropertyDescriptors, Yt = Object.getOwnPropertySymbols, _n = Object.prototype.hasOwnProperty, mn = Object.prototype.propertyIsEnumerable, Xt = (t, e, i) => e in t ? Si(t, e, {
26
26
  enumerable: !0,
@@ -398,7 +398,7 @@ function zn(t, e) {
398
398
  return t((r) => e(r) && i.call(n, r), null);
399
399
  });
400
400
  }
401
- var wt = Symbol.for("Jolibox.hostEmitter"), Wn = () => {
401
+ var wt = Symbol.for("Jolibox.hostEmitter"), Jn = () => {
402
402
  let t = new Gn();
403
403
  return globalThis[wt] || (globalThis[wt] = {
404
404
  on: t.on.bind(t),
@@ -407,8 +407,8 @@ var wt = Symbol.for("Jolibox.hostEmitter"), Wn = () => {
407
407
  once: t.once.bind(t)
408
408
  }), globalThis[wt];
409
409
  };
410
- Wn();
411
- function Jn(t, e) {
410
+ Jn();
411
+ function Wn(t, e) {
412
412
  let i = Math.min(t.length, e.length);
413
413
  for (let n = 0; n < i; n++)
414
414
  Hn(t[n], e[n]);
@@ -443,7 +443,7 @@ var Tt = class {
443
443
  t.handler = function() {
444
444
  for (var r = arguments.length, o = new Array(r), s = 0; s < r; s++)
445
445
  o[s] = arguments[s];
446
- return Jn(o, i), n(...o);
446
+ return Wn(o, i), n(...o);
447
447
  };
448
448
  }
449
449
  let {
@@ -522,7 +522,7 @@ var ti = class {
522
522
  }
523
523
  };
524
524
  ti = Ei([ki], ti);
525
- function J(t, e, i) {
525
+ function W(t, e, i) {
526
526
  return (e = Yn(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
527
527
  }
528
528
  function Yn(t) {
@@ -541,7 +541,7 @@ function Xn(t, e) {
541
541
  }
542
542
  return (e === "string" ? String : Number)(t);
543
543
  }
544
- const Se = (t) => t ? function() {
544
+ const me = (t) => t ? function() {
545
545
  try {
546
546
  for (var e = arguments.length, i = new Array(e), n = 0; n < e; n++)
547
547
  i[n] = arguments[n];
@@ -554,7 +554,7 @@ const Se = (t) => t ? function() {
554
554
  };
555
555
  class Qn {
556
556
  constructor(e) {
557
- J(this, "context", void 0), J(this, "continueCallback", void 0), J(this, "adIsShowingCallback", void 0), J(this, "isBeforeAdCalled", !1), J(this, "isBeforeRewardCalled", !1), J(this, "isAdDismissedCalled", !1), J(this, "isAdViewedCalled", !1), J(this, "isAfterAdCalled", !1), J(this, "currentProvider", void 0), J(this, "currentClientParams", void 0), J(this, "adsHasResponse", !1), J(this, "videoChecker", window.document.createElement("video")), J(this, "contextInfo", void 0), J(this, "wrapShowAdFn", (i) => () => {
557
+ W(this, "context", void 0), W(this, "continueCallback", void 0), W(this, "adIsShowingCallback", void 0), W(this, "isBeforeAdCalled", !1), W(this, "isBeforeRewardCalled", !1), W(this, "isAdDismissedCalled", !1), W(this, "isAdViewedCalled", !1), W(this, "isAfterAdCalled", !1), W(this, "currentProvider", void 0), W(this, "currentClientParams", void 0), W(this, "adsHasResponse", !1), W(this, "videoChecker", window.document.createElement("video")), W(this, "contextInfo", void 0), W(this, "wrapShowAdFn", (i) => () => {
558
558
  var o, s, a;
559
559
  this.adsHasResponse = !0;
560
560
  let n = !1;
@@ -570,7 +570,7 @@ class Qn {
570
570
  module: "game",
571
571
  game_id: this.contextInfo.objectId
572
572
  }), (a = this.adIsShowingCallback) == null || a.call(this, !0);
573
- const r = Se(i);
573
+ const r = me(i);
574
574
  r == null || r();
575
575
  }), this.context = e, this.contextInfo = e.getContextInfo();
576
576
  }
@@ -595,7 +595,7 @@ class Qn {
595
595
  var i, n, r, o;
596
596
  if (this.adsHasResponse = !0, this.context.track("CallBeforeAd", this.paramsToTrack), this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_AD", this.paramsToTrack), !this.isBeforeAdCalled) {
597
597
  this.isBeforeAdCalled = !0;
598
- const s = Se(e);
598
+ const s = me(e);
599
599
  s == null || s(), ((i = this.currentClientParams) == null ? void 0 : i.type) !== "reward" && ((n = this.adIsShowingCallback) == null || n.call(this, !0), st() && this.context.track("mmp_ad_impression", {
600
600
  ad_network: (o = (r = this.currentProvider) == null ? void 0 : r.name) != null ? o : "",
601
601
  ad_format: "interstitial",
@@ -614,7 +614,7 @@ class Qn {
614
614
  return () => {
615
615
  if (this.adsHasResponse = !0, !this.isAdDismissedCalled) {
616
616
  this.isAdDismissedCalled = !0;
617
- const i = Se(e);
617
+ const i = me(e);
618
618
  i == null || i();
619
619
  }
620
620
  };
@@ -623,7 +623,7 @@ class Qn {
623
623
  return () => {
624
624
  if (this.adsHasResponse = !0, !this.isAdViewedCalled) {
625
625
  this.isAdViewedCalled = !0;
626
- const i = Se(e);
626
+ const i = me(e);
627
627
  i == null || i();
628
628
  }
629
629
  };
@@ -632,7 +632,7 @@ class Qn {
632
632
  return () => {
633
633
  if (this.adsHasResponse = !0, this.context.track("CallAfterAd", this.paramsToTrack), this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AFTER_AD", this.paramsToTrack), !this.isAfterAdCalled) {
634
634
  this.isAfterAdCalled = !0;
635
- const i = Se(e);
635
+ const i = me(e);
636
636
  i == null || i();
637
637
  }
638
638
  };
@@ -657,7 +657,7 @@ class Qn {
657
657
  case "ignored":
658
658
  case "dismissed":
659
659
  case "error": {
660
- const h = Se(e);
660
+ const h = me(e);
661
661
  h == null || h(i), (l = this.adIsShowingCallback) == null || l.call(this, !1), (u = this.continueCallback) == null || u.call(this, [!1, i]);
662
662
  break;
663
663
  }
@@ -728,7 +728,7 @@ class Qn {
728
728
  });
729
729
  }
730
730
  }
731
- function Je(t, e, i) {
731
+ function We(t, e, i) {
732
732
  return (e = Zn(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
733
733
  }
734
734
  function Zn(t) {
@@ -749,11 +749,11 @@ function er(t, e) {
749
749
  }
750
750
  class tr {
751
751
  constructor(e) {
752
- Je(this, "context", void 0), Je(this, "adBreakIsShowing", !1), Je(this, "reportPageJumpOut", () => {
752
+ We(this, "context", void 0), We(this, "adBreakIsShowing", !1), We(this, "reportPageJumpOut", () => {
753
753
  this.context.track("AdBreakJumpOut", {
754
754
  context: "AdsActionDetection"
755
755
  });
756
- }), Je(this, "reportPageHide", () => {
756
+ }), We(this, "reportPageHide", () => {
757
757
  this.context.track("AdBreakHide", {
758
758
  context: "AdsActionDetection"
759
759
  });
@@ -839,7 +839,7 @@ class ar {
839
839
  }), de(this, "adConfig", (n) => {
840
840
  const s = n, {
841
841
  onReady: r
842
- } = s, o = Jt(s, [
842
+ } = s, o = Wt(s, [
843
843
  "onReady"
844
844
  ]);
845
845
  this.context.track("CallAdConfig", o), this.configured ? console.warn("Ad config already set, skipping") : (this.configured = !0, this.push(n));
@@ -1551,10 +1551,10 @@ var Fr = {
1551
1551
  case "animationName":
1552
1552
  if (typeof i == "string")
1553
1553
  return i.replace(jr, function(n, r, o) {
1554
- return Ae = {
1554
+ return we = {
1555
1555
  name: r,
1556
1556
  styles: o,
1557
- next: Ae
1557
+ next: we
1558
1558
  }, r;
1559
1559
  });
1560
1560
  }
@@ -1572,20 +1572,20 @@ function dt(t, e, i) {
1572
1572
  case "object": {
1573
1573
  var r = i;
1574
1574
  if (r.anim === 1)
1575
- return Ae = {
1575
+ return we = {
1576
1576
  name: r.name,
1577
1577
  styles: r.styles,
1578
- next: Ae
1578
+ next: we
1579
1579
  }, r.name;
1580
1580
  var o = i;
1581
1581
  if (o.styles !== void 0) {
1582
1582
  var s = o.next;
1583
1583
  if (s !== void 0)
1584
1584
  for (; s !== void 0; )
1585
- Ae = {
1585
+ we = {
1586
1586
  name: s.name,
1587
1587
  styles: s.styles,
1588
- next: Ae
1588
+ next: we
1589
1589
  }, s = s.next;
1590
1590
  var a = o.styles + ";";
1591
1591
  return a;
@@ -1628,12 +1628,12 @@ function Vr(t, e, i) {
1628
1628
  }
1629
1629
  return n;
1630
1630
  }
1631
- var ai = /label:\s*([^\s;{]+)\s*(;|$)/g, Ae;
1631
+ var ai = /label:\s*([^\s;{]+)\s*(;|$)/g, we;
1632
1632
  function bt(t, e, i) {
1633
1633
  if (t.length === 1 && typeof t[0] == "object" && t[0] !== null && t[0].styles !== void 0)
1634
1634
  return t[0];
1635
1635
  var n = !0, r = "";
1636
- Ae = void 0;
1636
+ we = void 0;
1637
1637
  var o = t[0];
1638
1638
  if (o == null || o.raw === void 0)
1639
1639
  n = !1, r += dt(i, e, o);
@@ -1653,7 +1653,7 @@ function bt(t, e, i) {
1653
1653
  return {
1654
1654
  name: c,
1655
1655
  styles: r,
1656
- next: Ae
1656
+ next: we
1657
1657
  };
1658
1658
  }
1659
1659
  function $i(t, e, i) {
@@ -1759,16 +1759,16 @@ var qr = function(e) {
1759
1759
  }
1760
1760
  }
1761
1761
  return i;
1762
- }, Wr = qr({
1762
+ }, Jr = qr({
1763
1763
  key: "css"
1764
- }), G = Wr.css, Dt, Q, pt, ui, ci = 0, Fi = [], B = Te, hi = B.__b, fi = B.__r, vi = B.diffed, yi = B.__c, gi = B.unmount, wi = B.__;
1765
- function Jr(t, e) {
1764
+ }), G = Jr.css, Dt, Q, pt, ui, ci = 0, Fi = [], B = Te, hi = B.__b, fi = B.__r, vi = B.diffed, yi = B.__c, gi = B.unmount, wi = B.__;
1765
+ function Wr(t, e) {
1766
1766
  B.__h && B.__h(Q, t, ci || e), ci = 0;
1767
1767
  var i = Q.__H || (Q.__H = { __: [], __h: [] });
1768
1768
  return t >= i.__.length && i.__.push({}), i.__[t];
1769
1769
  }
1770
1770
  function Ui(t, e) {
1771
- var i = Jr(Dt++, 7);
1771
+ var i = Wr(Dt++, 7);
1772
1772
  return Xr(i.__H, e) && (i.__ = t(), i.__H = e, i.__h = t), i.__;
1773
1773
  }
1774
1774
  function Hr() {
@@ -1841,8 +1841,8 @@ function Xr(t, e) {
1841
1841
  }
1842
1842
  var Qr = Symbol.for("preact-signals");
1843
1843
  function vt() {
1844
- if (be > 1)
1845
- be--;
1844
+ if (Ae > 1)
1845
+ Ae--;
1846
1846
  else {
1847
1847
  for (var t, e = !1; Fe !== void 0; ) {
1848
1848
  var i = Fe;
@@ -1857,21 +1857,21 @@ function vt() {
1857
1857
  i = n;
1858
1858
  }
1859
1859
  }
1860
- if (Nt = 0, be--, e)
1860
+ if (Nt = 0, Ae--, e)
1861
1861
  throw t;
1862
1862
  }
1863
1863
  }
1864
1864
  function P(t) {
1865
- if (be > 0)
1865
+ if (Ae > 0)
1866
1866
  return t();
1867
- be++;
1867
+ Ae++;
1868
1868
  try {
1869
1869
  return t();
1870
1870
  } finally {
1871
1871
  vt();
1872
1872
  }
1873
1873
  }
1874
- var T = void 0, Fe = void 0, be = 0, Nt = 0, lt = 0;
1874
+ var T = void 0, Fe = void 0, Ae = 0, Nt = 0, lt = 0;
1875
1875
  function ji(t) {
1876
1876
  if (T !== void 0) {
1877
1877
  var e = t.n;
@@ -1934,7 +1934,7 @@ Object.defineProperty(U.prototype, "value", { get: function() {
1934
1934
  if (t !== this.v) {
1935
1935
  if (Nt > 100)
1936
1936
  throw new Error("Cycle detected");
1937
- this.v = t, this.i++, lt++, be++;
1937
+ this.v = t, this.i++, lt++, Ae++;
1938
1938
  try {
1939
1939
  for (var e = this.t; e !== void 0; e = e.x)
1940
1940
  e.t.N();
@@ -2024,7 +2024,7 @@ function Ue(t) {
2024
2024
  function qi(t) {
2025
2025
  var e = t.u;
2026
2026
  if (t.u = void 0, typeof e == "function") {
2027
- be++;
2027
+ Ae++;
2028
2028
  var i = T;
2029
2029
  T = void 0;
2030
2030
  try {
@@ -2063,7 +2063,7 @@ qe.prototype.c = function() {
2063
2063
  qe.prototype.S = function() {
2064
2064
  if (1 & this.f)
2065
2065
  throw new Error("Cycle detected");
2066
- this.f |= 1, this.f &= -9, qi(this), Gi(this), be++;
2066
+ this.f |= 1, this.f &= -9, qi(this), Gi(this), Ae++;
2067
2067
  var t = T;
2068
2068
  return T = this, Zr.bind(this, t);
2069
2069
  };
@@ -2082,7 +2082,7 @@ function ze(t) {
2082
2082
  }
2083
2083
  return e.d.bind(e);
2084
2084
  }
2085
- var zi, _t, Wi = [];
2085
+ var zi, _t, Ji = [];
2086
2086
  ze(function() {
2087
2087
  zi = this.N;
2088
2088
  })();
@@ -2093,7 +2093,7 @@ function Ne(t, e) {
2093
2093
  function ut(t) {
2094
2094
  _t && _t(), _t = t && t.S();
2095
2095
  }
2096
- function Ji(t) {
2096
+ function Wi(t) {
2097
2097
  var e = this, i = t.data, n = Hi(i);
2098
2098
  n.value = i;
2099
2099
  var r = Ui(function() {
@@ -2119,8 +2119,8 @@ function Ji(t) {
2119
2119
  }, []), o = r[0], s = r[1];
2120
2120
  return o.value ? s.peek() : s.value;
2121
2121
  }
2122
- Ji.displayName = "_st";
2123
- Object.defineProperties(U.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Ji }, props: { configurable: !0, get: function() {
2122
+ Wi.displayName = "_st";
2123
+ Object.defineProperties(U.prototype, { constructor: { configurable: !0, value: void 0 }, type: { configurable: !0, value: Wi }, props: { configurable: !0, get: function() {
2124
2124
  return { data: this };
2125
2125
  } }, __b: { configurable: !0, value: 1 } });
2126
2126
  Ne("__b", function(t, e) {
@@ -2236,12 +2236,12 @@ var to = function(t) {
2236
2236
  };
2237
2237
  function io() {
2238
2238
  P(function() {
2239
- for (var t; t = Wi.shift(); )
2239
+ for (var t; t = Ji.shift(); )
2240
2240
  zi.call(t);
2241
2241
  });
2242
2242
  }
2243
2243
  function Yi() {
2244
- Wi.push(this) === 1 && (Te.requestAnimationFrame || to)(io);
2244
+ Ji.push(this) === 1 && (Te.requestAnimationFrame || to)(io);
2245
2245
  }
2246
2246
  const M = G`
2247
2247
  inset: 0;
@@ -2568,7 +2568,7 @@ const oo = G`
2568
2568
  countdown: d,
2569
2569
  src: l,
2570
2570
  mode: u
2571
- } = e, c = yn(() => ho(), []), [h, f] = _e(!1), v = (w) => {
2571
+ } = e, c = yn(() => ho(), []), [h, f] = pe(!1), v = (w) => {
2572
2572
  var g, A, S, p;
2573
2573
  a.value = !1, w === "dismiss" ? (g = n.value) == null || g.call(n) : w === "viewed" && ((A = r.value) == null || A.call(r)), (S = i.value) == null || S.call(i), (p = o.value) == null || p.call(o), f(!1);
2574
2574
  }, y = kt(() => {
@@ -2843,9 +2843,9 @@ const Ao = () => {
2843
2843
  adError: a,
2844
2844
  visible: d,
2845
2845
  payload: l
2846
- } = e, [u, c] = _e(!1), [h, f] = _e(0), [v, y] = _e(!1), [w, g] = _e(!1), [A, S] = _e("Loading next content..."), p = mi(null), _ = l.value, E = kt((L) => {
2847
- var C, W, K, I;
2848
- c(!1), d.value = !1, L === "dismiss" ? (C = n.value) == null || C.call(n) : (W = r.value) == null || W.call(r), (K = i.value) == null || K.call(i), (I = o.value) == null || I.call(o);
2846
+ } = e, [u, c] = pe(!1), [h, f] = pe(0), [v, y] = pe(!1), [w, g] = pe(!1), [A, S] = pe("Loading next content..."), p = mi(null), _ = l.value, E = kt((L) => {
2847
+ var C, J, K, I;
2848
+ c(!1), d.value = !1, L === "dismiss" ? (C = n.value) == null || C.call(n) : (J = r.value) == null || J.call(r), (K = i.value) == null || K.call(i), (I = o.value) == null || I.call(o);
2849
2849
  }, [d, n, r, i, o]), b = kt(() => {
2850
2850
  var L;
2851
2851
  c(!1), d.value = !1, (L = a.value) == null || L.call(a);
@@ -2859,9 +2859,9 @@ const Ao = () => {
2859
2859
  const L = _.mode === "reward" ? 15 : 0, C = Math.max(Math.floor((I = _.countdown) != null ? I : L), 0);
2860
2860
  if (f(C), g(_.mode === "reward" ? C === 0 : !0), y(_.mode === "interstitial" ? C === 0 : !1), C === 0)
2861
2861
  return;
2862
- let W = C;
2862
+ let J = C;
2863
2863
  const K = window.setInterval(() => {
2864
- W -= 1, f(Math.max(W, 0)), W <= 0 && (window.clearInterval(K), _.mode === "reward" ? g(!0) : y(!0));
2864
+ J -= 1, f(Math.max(J, 0)), J <= 0 && (window.clearInterval(K), _.mode === "reward" ? g(!0) : y(!0));
2865
2865
  }, 1e3);
2866
2866
  return () => {
2867
2867
  window.clearInterval(K);
@@ -2884,12 +2884,12 @@ const Ao = () => {
2884
2884
  }
2885
2885
  const C = document.createElement("ins");
2886
2886
  C.className = "adsbygoogle", C.style.display = "block", C.style.width = "100%", C.style.height = "100%", C.setAttribute("data-ad-client", _.clientId), C.setAttribute("data-ad-slot", _.unitId), C.setAttribute("data-ad-format", "auto"), C.setAttribute("data-full-width-responsive", "true"), _.channelId && C.setAttribute("data-ad-channel", _.channelId), L.appendChild(C);
2887
- const W = new MutationObserver(() => {
2887
+ const J = new MutationObserver(() => {
2888
2888
  var X;
2889
2889
  const I = C.getAttribute("data-ad-status");
2890
- I === "filled" ? (c(!0), S(""), (X = s.value) == null || X.call(s), W.disconnect()) : I === "unfilled" && (S("Slot currently unavailable."), c(!1), W.disconnect());
2890
+ I === "filled" ? (c(!0), S(""), (X = s.value) == null || X.call(s), J.disconnect()) : I === "unfilled" && (S("Slot currently unavailable."), c(!1), J.disconnect());
2891
2891
  });
2892
- W.observe(C, {
2892
+ J.observe(C, {
2893
2893
  attributes: !0,
2894
2894
  attributeFilter: ["data-ad-status"]
2895
2895
  });
@@ -2897,14 +2897,14 @@ const Ao = () => {
2897
2897
  const I = window;
2898
2898
  I.adsbygoogle = I.adsbygoogle || [], I.adsbygoogle.push({});
2899
2899
  } catch (I) {
2900
- W.disconnect(), b();
2900
+ J.disconnect(), b();
2901
2901
  }
2902
2902
  return () => {
2903
- W.disconnect(), L.innerHTML = "";
2903
+ J.disconnect(), L.innerHTML = "";
2904
2904
  };
2905
2905
  }, [d.value, _, s, b]), !d.value || !_)
2906
2906
  return null;
2907
- const ee = _.mode === "reward" ? "Next content unlocking" : "Content paused", me = h > 0 ? `Content resumes in ${h}s` : "Content ready";
2907
+ const ee = _.mode === "reward" ? "Next content unlocking" : "Content paused", _e = h > 0 ? `Content resumes in ${h}s` : "Content ready";
2908
2908
  return m("div", {
2909
2909
  className: bo,
2910
2910
  children: m("div", {
@@ -2916,7 +2916,7 @@ const Ao = () => {
2916
2916
  children: ee
2917
2917
  }), m("div", {
2918
2918
  className: So,
2919
- children: me
2919
+ children: _e
2920
2920
  })]
2921
2921
  }), m("div", {
2922
2922
  className: Eo,
@@ -3164,7 +3164,7 @@ window.addEventListener("message", (t) => {
3164
3164
  e(t.data.data);
3165
3165
  });
3166
3166
  });
3167
- const Ee = (t, e) => {
3167
+ const Se = (t, e) => {
3168
3168
  Ce(() => (xe[t] || (xe[t] = /* @__PURE__ */ new Set()), xe[t].add(e), () => {
3169
3169
  xe[t].delete(e);
3170
3170
  }), [t, e]);
@@ -3213,17 +3213,17 @@ const Ee = (t, e) => {
3213
3213
  adLinkClicked: a,
3214
3214
  visible: d,
3215
3215
  src: l
3216
- } = e, [u, c] = _e(!1), h = (v) => {
3216
+ } = e, [u, c] = pe(!1), h = (v) => {
3217
3217
  var y, w, g, A;
3218
3218
  c(!1), d.value = !1, v === "dismiss" ? (y = n.value) == null || y.call(n) : v === "viewed" && ((w = r.value) == null || w.call(r)), (g = i.value) == null || g.call(i), (A = o.value) == null || A.call(o);
3219
3219
  }, f = () => {
3220
3220
  var v;
3221
3221
  (v = s.value) == null || v.call(s);
3222
3222
  };
3223
- return Ee("appsrockets_ad_dismissed", () => h("dismiss")), Ee("appsrockets_ad_rewarded", () => h("viewed")), Ee("appsrockets_ad_completed", () => h("viewed")), Ee("appsrockets_ad_skipped", () => h("viewed")), Ee("appsrockets_ad_clicked", (v) => {
3223
+ return Se("appsrockets_ad_dismissed", () => h("dismiss")), Se("appsrockets_ad_rewarded", () => h("viewed")), Se("appsrockets_ad_completed", () => h("viewed")), Se("appsrockets_ad_skipped", () => h("viewed")), Se("appsrockets_ad_clicked", (v) => {
3224
3224
  var y;
3225
3225
  return (y = a.value) == null ? void 0 : y.call(a, v);
3226
- }), Ee("appsrockets_ad_loaded", () => c(!0)), d.value ? m("div", {
3226
+ }), Se("appsrockets_ad_loaded", () => c(!0)), d.value ? m("div", {
3227
3227
  className: Do,
3228
3228
  style: {
3229
3229
  display: u ? "flex" : "none"
@@ -3550,7 +3550,7 @@ class Uo {
3550
3550
  });
3551
3551
  }
3552
3552
  }
3553
- function pe(t, e, i) {
3553
+ function be(t, e, i) {
3554
3554
  return (e = jo(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3555
3555
  }
3556
3556
  function jo(t) {
@@ -3571,7 +3571,7 @@ function Vo(t, e) {
3571
3571
  }
3572
3572
  class Go {
3573
3573
  constructor(e, i) {
3574
- pe(this, "name", "GOOGLE_GPT"), pe(this, "context", void 0), pe(this, "contextInfo", void 0), pe(this, "initParams", void 0), pe(this, "rewardAdManager", void 0), pe(this, "interstitialManager", void 0), pe(this, "insertScript", () => {
3574
+ be(this, "name", "GOOGLE_GPT"), be(this, "context", void 0), be(this, "contextInfo", void 0), be(this, "initParams", void 0), be(this, "rewardAdManager", void 0), be(this, "interstitialManager", void 0), be(this, "insertScript", () => {
3575
3575
  const n = "jolibox-google-gpt";
3576
3576
  let r = document.getElementById(n);
3577
3577
  r || (r = window.document.createElement("script"), r.id = n, r.async = !0, r.src = "https://securepubads.g.doubleclick.net/tag/js/gpt.js", r.crossOrigin = "anonymous", document.head.appendChild(r));
@@ -3719,13 +3719,13 @@ class zo {
3719
3719
  }
3720
3720
  }
3721
3721
  function z(t, e, i) {
3722
- return (e = Wo(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3722
+ return (e = Jo(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
3723
3723
  }
3724
- function Wo(t) {
3725
- var e = Jo(t, "string");
3724
+ function Jo(t) {
3725
+ var e = Wo(t, "string");
3726
3726
  return typeof e == "symbol" ? e : e + "";
3727
3727
  }
3728
- function Jo(t, e) {
3728
+ function Wo(t, e) {
3729
3729
  if (typeof t != "object" || !t)
3730
3730
  return t;
3731
3731
  var i = t[Symbol.toPrimitive];
@@ -4297,7 +4297,7 @@ const rt = () => {
4297
4297
  } catch (t) {
4298
4298
  }
4299
4299
  };
4300
- function ge(t, e, i) {
4300
+ function Ee(t, e, i) {
4301
4301
  return (e = cs(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
4302
4302
  }
4303
4303
  function cs(t) {
@@ -4318,26 +4318,24 @@ function hs(t, e) {
4318
4318
  }
4319
4319
  class fs {
4320
4320
  constructor() {
4321
- ge(this, "adsContext", null), ge(this, "_isReady", !1), ge(this, "_isAvailable", !1), ge(this, "init", async () => {
4322
- this._isReady = !1;
4321
+ Ee(this, "adsContext", null), Ee(this, "init", async () => {
4322
+ console.log("[JoliboxSDK] NewsBreak init");
4323
4323
  const e = rt();
4324
4324
  if (e)
4325
4325
  try {
4326
- if (this._isAvailable = await e.isAvailable("rewarded"), console.log("[JoliboxSDK] NewsBreak init isAvailable", this._isAvailable), !this._isAvailable)
4327
- return;
4328
4326
  const i = await e.createRewardAd({
4329
4327
  platform: "jolibox"
4330
4328
  });
4331
- console.log("[JoliboxSDK] NewsBreak init createRewardAd result:", i), this._isReady = i.success && i.ready;
4329
+ console.log("[JoliboxSDK] NewsBreak init createRewardAd result:", i);
4332
4330
  } catch (i) {
4333
- this._isReady = !1;
4331
+ console.log("[JoliboxSDK] NewsBreak init createRewardAd error:", i);
4334
4332
  }
4335
- }), ge(this, "destroy", (e) => {
4333
+ }), Ee(this, "destroy", (e) => {
4336
4334
  var i, n;
4337
- this._isReady = !1, (n = (i = this.adsContext) == null ? void 0 : i.adBreakDone) == null || n.call(i, e), e !== "ignored" && (this.adsContext = null);
4338
- }), ge(this, "reinit", async (e) => {
4335
+ (n = (i = this.adsContext) == null ? void 0 : i.adBreakDone) == null || n.call(i, e), e !== "ignored" && (this.adsContext = null);
4336
+ }), Ee(this, "reinit", async (e) => {
4339
4337
  console.log("[JoliboxSDK] NewsBreak reinit breakStatus:", e), this.destroy(e), await this.init();
4340
- }), ge(this, "requestAds", async (e) => {
4338
+ }), Ee(this, "requestAds", async (e) => {
4341
4339
  if (console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext", this.adsContext), this.adsContext) {
4342
4340
  this.destroy("ignored");
4343
4341
  return;
@@ -4348,15 +4346,8 @@ class fs {
4348
4346
  this.destroy("notReady");
4349
4347
  return;
4350
4348
  }
4351
- if (this._isReady) {
4352
- console.log("[JoliboxSDK] NewsBreak requestAds isReady from cache"), this.showAd();
4353
- return;
4354
- }
4355
- const n = await i.isRewardReady();
4356
- console.log("[JoliboxSDK] NewsBreak requestAds sdk.isRewardReady", n), n ? (this._isReady = !0, this.showAd()) : (await i.createRewardAd({
4357
- platform: "jolibox"
4358
- }), this.showAd());
4359
- }), ge(this, "showAd", () => {
4349
+ this.showAd();
4350
+ }), Ee(this, "showAd", () => {
4360
4351
  if (console.log("[JoliboxSDK] NewsBreak showAd"), !this.adsContext) {
4361
4352
  this.destroy("error");
4362
4353
  return;
@@ -4549,7 +4540,7 @@ class ea {
4549
4540
  var r, o, s, a, d, l, u, c, h, f, v, y, w, g, A, S;
4550
4541
  const i = Date.now();
4551
4542
  if (i - this.initializedTimeStamp < 3e3) {
4552
- (r = e.adBreakDone) == null || r.call(e, {
4543
+ console.log("[Jolibox SDK Ads] too soon"), (r = e.adBreakDone) == null || r.call(e, {
4553
4544
  breakType: e.type,
4554
4545
  breakName: e.type === "preroll" ? void 0 : e.name,
4555
4546
  breakFormat: e.type === "reward" ? "reward" : "interstitial",
@@ -4585,7 +4576,7 @@ class ea {
4585
4576
  return;
4586
4577
  }
4587
4578
  if (!this.context.checkNetwork() && !this.providers.NEWSBREAK) {
4588
- (d = e.adBreakDone) == null || d.call(e, {
4579
+ console.log("[Jolibox SDK Ads] net not ready"), (d = e.adBreakDone) == null || d.call(e, {
4589
4580
  breakType: e.type,
4590
4581
  breakName: e.type === "preroll" ? void 0 : e.name,
4591
4582
  breakFormat: e.type === "reward" ? "reward" : "interstitial",
@@ -4607,8 +4598,8 @@ class ea {
4607
4598
  }
4608
4599
  case "reward": {
4609
4600
  e.beforeReward(() => {
4610
- var b, ee, me, L;
4611
- (b = e.beforeAd) == null || b.call(e), (ee = e.adViewed) == null || ee.call(e), (me = e.afterAd) == null || me.call(e), (L = e.adBreakDone) == null || L.call(e, {
4601
+ var b, ee, _e, L;
4602
+ (b = e.beforeAd) == null || b.call(e), (ee = e.adViewed) == null || ee.call(e), (_e = e.afterAd) == null || _e.call(e), (L = e.adBreakDone) == null || L.call(e, {
4612
4603
  breakType: e.type,
4613
4604
  breakName: e.name,
4614
4605
  breakFormat: "reward",
@@ -4630,7 +4621,7 @@ class ea {
4630
4621
  return;
4631
4622
  }
4632
4623
  if (!_ || E !== "SUCCESS") {
4633
- (f = e.adBreakDone) == null || f.call(e, {
4624
+ console.log("[Jolibox SDK Ads] not SUCCESS"), (f = e.adBreakDone) == null || f.call(e, {
4634
4625
  breakType: e.type,
4635
4626
  breakName: e.type === "preroll" ? void 0 : e.name,
4636
4627
  breakFormat: e.type === "reward" ? "reward" : "interstitial",
@@ -4639,7 +4630,7 @@ class ea {
4639
4630
  return;
4640
4631
  } else {
4641
4632
  if (_.length === 0) {
4642
- (v = e.adBreakDone) == null || v.call(e, {
4633
+ console.log("[Jolibox SDK Ads] ads info empty"), (v = e.adBreakDone) == null || v.call(e, {
4643
4634
  breakType: e.type,
4644
4635
  breakName: e.type === "preroll" ? void 0 : e.name,
4645
4636
  breakFormat: e.type === "reward" ? "reward" : "interstitial",
@@ -4648,21 +4639,21 @@ class ea {
4648
4639
  return;
4649
4640
  }
4650
4641
  let b = !0, ee = null;
4651
- const me = new Qn(this.context);
4642
+ const _e = new Qn(this.context);
4652
4643
  this.adsActionDetection.adBreakIsShowing = !0;
4653
- const L = _.filter((I) => I.isNative).sort((I, X) => I.seq - X.seq), C = _.filter((I) => !I.isNative).sort((I, X) => I.seq - X.seq), W = {
4644
+ const L = _.filter((I) => I.isNative).sort((I, X) => I.seq - X.seq), C = _.filter((I) => !I.isNative).sort((I, X) => I.seq - X.seq), J = {
4654
4645
  seq: (w = (y = L[0]) == null ? void 0 : y.seq) != null ? w : 0,
4655
4646
  provider: "INTERNAL_NATIVE",
4656
4647
  params: L
4657
4648
  };
4658
4649
  let K;
4659
- for (L.length > 0 ? K = [W].concat(C) : K = C, K = K.sort((I, X) => I.seq - X.seq).map((I, X) => Wt(yt({}, I), {
4650
+ for (L.length > 0 ? K = [J].concat(C) : K = C, K = K.sort((I, X) => I.seq - X.seq).map((I, X) => Jt(yt({}, I), {
4660
4651
  seq: X
4661
4652
  // re-assign seq
4662
4653
  })); K.length > 0; ) {
4663
4654
  const I = K.shift(), X = this.providers[I.provider];
4664
4655
  if (X) {
4665
- const [an, dn] = await me.callAdBreakAndContinue(X, e, I, (Vt) => {
4656
+ const [an, dn] = await _e.callAdBreakAndContinue(X, e, I, (Vt) => {
4666
4657
  var Gt;
4667
4658
  this.adsIsShowing = Vt, (Gt = this.context.eventEmitter) == null || Gt.emit("isAdShowing", Vt);
4668
4659
  });
@@ -4680,7 +4671,7 @@ class ea {
4680
4671
  b && ee && ((g = e.adBreakDone) == null || g.call(e, ee));
4681
4672
  }
4682
4673
  } catch (p) {
4683
- (A = e.adBreakDone) == null || A.call(e, {
4674
+ console.log("[Jolibox SDK Ads] error:", p), (A = e.adBreakDone) == null || A.call(e, {
4684
4675
  breakType: e.type,
4685
4676
  breakFormat: e.type === "reward" ? "reward" : "interstitial",
4686
4677
  breakStatus: "noAdPreloaded"
@@ -5211,7 +5202,7 @@ class $s {
5211
5202
  }), this.context = e;
5212
5203
  }
5213
5204
  }
5214
- function we(t, e, i) {
5205
+ function ge(t, e, i) {
5215
5206
  return (e = Fs(e)) in t ? Object.defineProperty(t, e, { value: i, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = i, t;
5216
5207
  }
5217
5208
  function Fs(t) {
@@ -5232,22 +5223,22 @@ function Us(t, e) {
5232
5223
  }
5233
5224
  class js {
5234
5225
  constructor(e) {
5235
- we(this, "name", "GOOGLE_GPT"), we(this, "context", void 0), we(this, "contextInfo", void 0), we(this, "rewardAdManager", void 0), we(this, "init", async (i) => {
5226
+ ge(this, "name", "GOOGLE_GPT"), ge(this, "context", void 0), ge(this, "contextInfo", void 0), ge(this, "rewardAdManager", void 0), ge(this, "init", async (i) => {
5236
5227
  if (!this.rewardAdManager) {
5237
5228
  const n = this.contextInfo.testAdsMode ? "/22639388115/rewarded_web_example" : i.params.rewardedSlot, o = `minidrama-${this.contextInfo.runtimeType === "APP" ? "app" : "h5"}`;
5238
5229
  this.rewardAdManager = new nn(n, o, i.params.keyValue);
5239
5230
  }
5240
- }), we(this, "insertScript", () => {
5231
+ }), ge(this, "insertScript", () => {
5241
5232
  const i = "jolibox-google-gpt";
5242
5233
  let n = document.getElementById(i);
5243
5234
  n || (n = window.document.createElement("script"), n.id = i, n.async = !0, n.src = "https://securepubads.g.doubleclick.net/tag/js/gpt.js", n.crossOrigin = "anonymous", document.head.appendChild(n));
5244
- }), we(this, "destroy", () => {
5235
+ }), ge(this, "destroy", () => {
5245
5236
  var i;
5246
5237
  (i = this.rewardAdManager) == null || i.withCommand(() => {
5247
5238
  var n;
5248
5239
  (n = this.rewardAdManager) == null || n.destroy("ignored");
5249
5240
  });
5250
- }), we(this, "requestAd", (i, n) => {
5241
+ }), ge(this, "requestAd", (i, n) => {
5251
5242
  var r;
5252
5243
  if (!this.rewardAdManager) {
5253
5244
  (r = i.onAdError) == null || r.call(i, F.from(new Error("rewardAdManager not initialized"), "JOLIBOX_IMA_ERROR"));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jolibox/ads",
3
3
  "description": "This project is for integrating Jolibox ads providers",
4
- "version": "1.4.12",
4
+ "version": "1.4.14",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "type": "module",
@@ -12,12 +12,12 @@
12
12
  ],
13
13
  "types": "./dist/index.d.ts",
14
14
  "dependencies": {
15
- "@jolibox/common": "1.4.12",
15
+ "@jolibox/common": "1.4.14",
16
16
  "@emotion/css": "11.13.5",
17
- "@jolibox/types": "1.4.12",
17
+ "@jolibox/types": "1.4.14",
18
18
  "preact": "10.26.4",
19
19
  "@preact/signals": "2.0.4",
20
- "@jolibox/native-bridge": "1.4.12"
20
+ "@jolibox/native-bridge": "1.4.14"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@babel/core": "7.23.3",