@folklore/ads 0.0.78 → 0.0.79

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/dist/cjs.js CHANGED
@@ -1080,13 +1080,16 @@ function useRichAd(containerRef, id, opts) {
1080
1080
  onRichAd = null
1081
1081
  } = opts || {};
1082
1082
  React.useEffect(() => {
1083
+ if (id === null) {
1084
+ return () => {};
1085
+ }
1083
1086
  setRichAd(null);
1084
1087
  function onMessage(event) {
1085
1088
  if (event.origin.match(/safeframe\.googlesyndication\.com/) === null) {
1086
1089
  return;
1087
1090
  }
1088
- const container = containerRef.current || document;
1089
- const iframe = container.querySelector('iframe') || null;
1091
+ const container = containerRef.current || null;
1092
+ const iframe = container !== null ? container.querySelector('iframe') || null : null;
1090
1093
  if (iframe === null || iframe.contentWindow !== event.source) {
1091
1094
  return;
1092
1095
  }
package/dist/es.js CHANGED
@@ -1062,13 +1062,16 @@ function useRichAd(containerRef, id, opts) {
1062
1062
  onRichAd = null
1063
1063
  } = opts || {};
1064
1064
  useEffect(() => {
1065
+ if (id === null) {
1066
+ return () => {};
1067
+ }
1065
1068
  setRichAd(null);
1066
1069
  function onMessage(event) {
1067
1070
  if (event.origin.match(/safeframe\.googlesyndication\.com/) === null) {
1068
1071
  return;
1069
1072
  }
1070
- const container = containerRef.current || document;
1071
- const iframe = container.querySelector('iframe') || null;
1073
+ const container = containerRef.current || null;
1074
+ const iframe = container !== null ? container.querySelector('iframe') || null : null;
1072
1075
  if (iframe === null || iframe.contentWindow !== event.source) {
1073
1076
  return;
1074
1077
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/ads",
3
- "version": "0.0.78",
3
+ "version": "0.0.79",
4
4
  "description": "Ads library",
5
5
  "keywords": [
6
6
  "javascript",
@@ -50,7 +50,7 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "gitHead": "305e55290b425a9b60853ce4b1a9688956f77f68",
53
+ "gitHead": "d4912741fa4d4942651be59b0276fcbe8dd25e19",
54
54
  "dependencies": {
55
55
  "@folklore/hooks": "^0.0.65",
56
56
  "@folklore/tracking": "^0.0.25",