@streamlayer/react-ui 1.31.7 → 1.32.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.
@@ -1,4 +1,5 @@
1
1
  type GAMStaticCore = Record<string, {
2
+ id: string;
2
3
  url: string;
3
4
  imageSrc?: string;
4
5
  adUrl?: string;
@@ -1,44 +1,69 @@
1
1
  import { _ as C } from "../../../../../vast-client.min-B0NUra1B.js";
2
- import { useRef as k, useCallback as I } from "react";
3
- import { createLogger as K } from "@streamlayer/sdk-web-logger";
4
- import { m as V } from "../../../../../index-DSi8Qgfs.js";
5
- const x = {}, D = new C(), a = V(x), u = K("ui:gam-static"), A = (n) => new Promise((m, e) => {
6
- const s = new Image();
7
- s.onload = () => m(n), s.onerror = () => e(), s.src = n;
8
- }), _ = () => {
9
- const n = k(0);
10
- return [I(async (e) => {
11
- var g, d, f, p, v, T, R, S, w, y, h;
12
- if ((g = a.get()[e]) != null && g.imageSrc)
2
+ import { useRef as P, useCallback as k } from "react";
3
+ import { eventBus as l } from "@streamlayer/sdk-web-interfaces";
4
+ import { createLogger as I } from "@streamlayer/sdk-web-logger";
5
+ import { m as K } from "../../../../../index-DSi8Qgfs.js";
6
+ const V = {}, B = new C(), i = K(V), d = I("ui:gam-static"), b = (n) => new Promise((m, e) => {
7
+ const r = new Image();
8
+ r.onload = () => m(n), r.onerror = () => e(), r.src = n;
9
+ }), $ = () => {
10
+ const n = P(0);
11
+ return [k(async (e) => {
12
+ var p, g, f, v, y, A, T, R, S, w, h;
13
+ if ((p = i.get()[e]) != null && p.imageSrc)
13
14
  return { success: !0 };
14
- const s = Date.now();
15
- n.current = s, a.setKey(e, { url: e });
15
+ const r = Date.now();
16
+ n.current = r, i.setKey(e, { id: "", url: e });
16
17
  try {
17
- const c = await D.get(e);
18
- if (u.debug(c, "parsedVAST"), n.current === s && a.get()[e].url) {
19
- const i = c.ads.find((o) => o.creatives.length > 0);
20
- if (i) {
21
- u.debug(i, "validAd");
22
- const o = i.creatives.find((r) => r.type === "nonlinear");
23
- if (o) {
24
- u.debug(o, "nonlinear");
25
- const r = (f = (d = o.variations) == null ? void 0 : d[0]) == null ? void 0 : f.staticResource, L = (v = (p = o.variations) == null ? void 0 : p[0]) == null ? void 0 : v.nonlinearClickThroughURLTemplate;
26
- if (r)
27
- return await A(r), a.setKey(e, { url: e, imageSrc: r, adUrl: L }), { success: !0 };
18
+ l.emit("exposedPauseAd", {
19
+ action: "load",
20
+ payload: {}
21
+ });
22
+ const c = await B.get(e);
23
+ if (d.debug(c, "parsedVAST"), n.current === r && i.get()[e].url) {
24
+ const t = c.ads.find((s) => s.creatives.length > 0);
25
+ if (t) {
26
+ d.debug(t, "validAd");
27
+ const s = t.creatives.find((o) => o.type === "nonlinear");
28
+ if (s) {
29
+ d.debug(s, "nonlinear");
30
+ const o = (f = (g = s.variations) == null ? void 0 : g[0]) == null ? void 0 : f.staticResource, x = (y = (v = s.variations) == null ? void 0 : v[0]) == null ? void 0 : y.nonlinearClickThroughURLTemplate;
31
+ if (o)
32
+ return await b(o), i.setKey(e, {
33
+ id: t.id || "",
34
+ url: e,
35
+ imageSrc: o,
36
+ adUrl: x
37
+ }), l.emit("exposedPauseAd", {
38
+ action: "loaded",
39
+ payload: {
40
+ id: t.id || ""
41
+ }
42
+ }), { success: !0 };
28
43
  }
29
- const t = i.creatives.find((r) => r.type === "companion");
30
- u.debug(t, "companion");
31
- const l = (w = (S = (R = (T = t == null ? void 0 : t.variations) == null ? void 0 : T[0]) == null ? void 0 : R.staticResources) == null ? void 0 : S[0]) == null ? void 0 : w.url, b = (h = (y = t == null ? void 0 : t.variations) == null ? void 0 : y[0]) == null ? void 0 : h.companionClickThroughURLTemplate;
32
- if (l)
33
- return await A(l), a.setKey(e, { url: e, imageSrc: l, adUrl: b }), { success: !0 };
44
+ const a = t.creatives.find((o) => o.type === "companion");
45
+ d.debug(a, "companion");
46
+ const u = (S = (R = (T = (A = a == null ? void 0 : a.variations) == null ? void 0 : A[0]) == null ? void 0 : T.staticResources) == null ? void 0 : R[0]) == null ? void 0 : S.url, L = (h = (w = a == null ? void 0 : a.variations) == null ? void 0 : w[0]) == null ? void 0 : h.companionClickThroughURLTemplate;
47
+ if (u)
48
+ return await b(u), i.setKey(e, {
49
+ id: t.id || "",
50
+ url: e,
51
+ imageSrc: u,
52
+ adUrl: L
53
+ }), l.emit("exposedPauseAd", {
54
+ action: "loaded",
55
+ payload: {
56
+ id: t.id || ""
57
+ }
58
+ }), { success: !0 };
34
59
  }
35
60
  }
36
61
  } catch (c) {
37
62
  console.error("Error parsing VAST", c);
38
63
  }
39
64
  return { success: !1 };
40
- }, []), a];
65
+ }, []), i];
41
66
  };
42
67
  export {
43
- _ as useLoadGAMStatic
68
+ $ as useLoadGAMStatic
44
69
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamlayer/react-ui",
3
- "version": "1.31.7",
3
+ "version": "1.32.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -76,7 +76,7 @@
76
76
  ],
77
77
  "peerDependencies": {
78
78
  "@lottiefiles/react-lottie-player": "^3.5.4",
79
- "@streamlayer/sl-eslib": "^5.221.0",
79
+ "@streamlayer/sl-eslib": "^5.225.0",
80
80
  "@types/lodash.throttle": "^4.1.9",
81
81
  "lodash.throttle": "^4.1.1",
82
82
  "react-infinite-scroller": "^1.2.6",
@@ -85,19 +85,19 @@
85
85
  "@noriginmedia/norigin-spatial-navigation": "^2.3.0",
86
86
  "react-window-infinite-loader": "^1.0.9",
87
87
  "uuid": "^11.1.0",
88
- "@streamlayer/feature-gamification": "^1.22.9",
89
- "@streamlayer/react-polyfills": "^0.1.44",
90
- "@streamlayer/sdk-web": "^1.15.9",
91
- "@streamlayer/sdk-web-analytics": "^1.12.9",
92
- "@streamlayer/sdk-web-anonymous-auth": "^1.2.9",
93
- "@streamlayer/sdk-web-api": "^1.13.9",
94
- "@streamlayer/sdk-web-core": "^1.16.9",
95
- "@streamlayer/sdk-web-features": "^1.0.84",
96
- "@streamlayer/sdk-web-interfaces": "^1.7.17",
97
- "@streamlayer/sdk-web-logger": "^1.0.84",
98
- "@streamlayer/sdk-web-notifications": "^1.3.46",
99
- "@streamlayer/sdk-web-storage": "^1.0.84",
100
- "@streamlayer/sdk-web-types": "^1.15.9"
88
+ "@streamlayer/feature-gamification": "^1.23.0",
89
+ "@streamlayer/react-polyfills": "^0.1.45",
90
+ "@streamlayer/sdk-web-analytics": "^1.13.0",
91
+ "@streamlayer/sdk-web": "^1.16.0",
92
+ "@streamlayer/sdk-web-anonymous-auth": "^1.3.0",
93
+ "@streamlayer/sdk-web-core": "^1.17.0",
94
+ "@streamlayer/sdk-web-api": "^1.14.0",
95
+ "@streamlayer/sdk-web-features": "^1.0.85",
96
+ "@streamlayer/sdk-web-interfaces": "^1.8.0",
97
+ "@streamlayer/sdk-web-logger": "^1.0.85",
98
+ "@streamlayer/sdk-web-notifications": "^1.3.47",
99
+ "@streamlayer/sdk-web-storage": "^1.0.85",
100
+ "@streamlayer/sdk-web-types": "^1.16.0"
101
101
  },
102
102
  "nx": {
103
103
  "implicitDependencies": [
@@ -139,7 +139,7 @@
139
139
  "vite-plugin-svgr": "^4.2.0",
140
140
  "vite-svg-loader": "^5.1.0",
141
141
  "vite-tsconfig-paths": "^5.0.1",
142
- "@streamlayer/react": "^1.20.7"
142
+ "@streamlayer/react": "^1.21.0"
143
143
  },
144
144
  "dependencies": {
145
145
  "@dailymotion/vast-client": "^6.4.2",