@folklore/ads 0.0.17 → 0.0.19
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 +22 -27
- package/dist/es.js +22 -27
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -999,35 +999,36 @@ function Ad(_ref) {
|
|
|
999
999
|
const wasDisabled = React.useRef(disabled);
|
|
1000
1000
|
const onAdRender = React.useCallback(event => {
|
|
1001
1001
|
const {
|
|
1002
|
-
isEmpty: newIsEmpty = true
|
|
1002
|
+
isEmpty: newIsEmpty = true,
|
|
1003
|
+
width: newWidth,
|
|
1004
|
+
height: newHeight
|
|
1003
1005
|
} = event || {};
|
|
1004
|
-
const newIsRendered = !newIsEmpty;
|
|
1005
1006
|
if (disabled) {
|
|
1006
1007
|
wasDisabled.current = true;
|
|
1007
|
-
} else if (!disabled &&
|
|
1008
|
+
} else if (!disabled && !newIsEmpty) {
|
|
1008
1009
|
wasDisabled.current = false;
|
|
1009
1010
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1011
|
+
lastRenderedSize.current = !newIsEmpty ? {
|
|
1012
|
+
width: newWidth,
|
|
1013
|
+
height: newHeight
|
|
1014
|
+
} : null;
|
|
1012
1015
|
if (onRender !== null) {
|
|
1013
|
-
onRender(
|
|
1014
|
-
...event,
|
|
1015
|
-
keepSize
|
|
1016
|
-
});
|
|
1016
|
+
onRender(event);
|
|
1017
1017
|
}
|
|
1018
1018
|
}, [onRender, shouldKeepSize, disabled]);
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
}
|
|
1019
|
+
|
|
1020
|
+
// useEffect(() => {
|
|
1021
|
+
// if (!disabled) {
|
|
1022
|
+
// return;
|
|
1023
|
+
// }
|
|
1024
|
+
// const keepSize = shouldKeepSize && lastRenderedSize.current !== null;
|
|
1025
|
+
// if (onRender !== null) {
|
|
1026
|
+
// onRender({
|
|
1027
|
+
// isEmpty: true,
|
|
1028
|
+
// keepSize,
|
|
1029
|
+
// });
|
|
1030
|
+
// }
|
|
1031
|
+
// }, [disabled]);
|
|
1031
1032
|
|
|
1032
1033
|
// Create ad
|
|
1033
1034
|
const {
|
|
@@ -1053,12 +1054,6 @@ function Ad(_ref) {
|
|
|
1053
1054
|
// eslint-disable-next-line no-param-reassign
|
|
1054
1055
|
slotRef.current = slotObject;
|
|
1055
1056
|
}
|
|
1056
|
-
if (isRendered && !isEmpty) {
|
|
1057
|
-
lastRenderedSize.current = {
|
|
1058
|
-
width,
|
|
1059
|
-
height
|
|
1060
|
-
};
|
|
1061
|
-
}
|
|
1062
1057
|
if (disabled) {
|
|
1063
1058
|
wasDisabled.current = true;
|
|
1064
1059
|
} else if (!disabled && isRendered) {
|
package/dist/es.js
CHANGED
|
@@ -981,35 +981,36 @@ function Ad(_ref) {
|
|
|
981
981
|
const wasDisabled = useRef(disabled);
|
|
982
982
|
const onAdRender = useCallback(event => {
|
|
983
983
|
const {
|
|
984
|
-
isEmpty: newIsEmpty = true
|
|
984
|
+
isEmpty: newIsEmpty = true,
|
|
985
|
+
width: newWidth,
|
|
986
|
+
height: newHeight
|
|
985
987
|
} = event || {};
|
|
986
|
-
const newIsRendered = !newIsEmpty;
|
|
987
988
|
if (disabled) {
|
|
988
989
|
wasDisabled.current = true;
|
|
989
|
-
} else if (!disabled &&
|
|
990
|
+
} else if (!disabled && !newIsEmpty) {
|
|
990
991
|
wasDisabled.current = false;
|
|
991
992
|
}
|
|
992
|
-
|
|
993
|
-
|
|
993
|
+
lastRenderedSize.current = !newIsEmpty ? {
|
|
994
|
+
width: newWidth,
|
|
995
|
+
height: newHeight
|
|
996
|
+
} : null;
|
|
994
997
|
if (onRender !== null) {
|
|
995
|
-
onRender(
|
|
996
|
-
...event,
|
|
997
|
-
keepSize
|
|
998
|
-
});
|
|
998
|
+
onRender(event);
|
|
999
999
|
}
|
|
1000
1000
|
}, [onRender, shouldKeepSize, disabled]);
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
}
|
|
1001
|
+
|
|
1002
|
+
// useEffect(() => {
|
|
1003
|
+
// if (!disabled) {
|
|
1004
|
+
// return;
|
|
1005
|
+
// }
|
|
1006
|
+
// const keepSize = shouldKeepSize && lastRenderedSize.current !== null;
|
|
1007
|
+
// if (onRender !== null) {
|
|
1008
|
+
// onRender({
|
|
1009
|
+
// isEmpty: true,
|
|
1010
|
+
// keepSize,
|
|
1011
|
+
// });
|
|
1012
|
+
// }
|
|
1013
|
+
// }, [disabled]);
|
|
1013
1014
|
|
|
1014
1015
|
// Create ad
|
|
1015
1016
|
const {
|
|
@@ -1035,12 +1036,6 @@ function Ad(_ref) {
|
|
|
1035
1036
|
// eslint-disable-next-line no-param-reassign
|
|
1036
1037
|
slotRef.current = slotObject;
|
|
1037
1038
|
}
|
|
1038
|
-
if (isRendered && !isEmpty) {
|
|
1039
|
-
lastRenderedSize.current = {
|
|
1040
|
-
width,
|
|
1041
|
-
height
|
|
1042
|
-
};
|
|
1043
|
-
}
|
|
1044
1039
|
if (disabled) {
|
|
1045
1040
|
wasDisabled.current = true;
|
|
1046
1041
|
} else if (!disabled && isRendered) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/ads",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
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": "
|
|
53
|
+
"gitHead": "77891149bf3bd69ece83773a107cca68a50c5043",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@folklore/hooks": "^0.0.41",
|
|
56
56
|
"@folklore/tracking": "^0.0.16",
|