@folklore/ads 0.0.106 → 0.0.108
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 +9 -2
- package/dist/es.js +10 -3
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -905,6 +905,7 @@ function useAdsTracking() {
|
|
|
905
905
|
|
|
906
906
|
function useAd(path, size) {
|
|
907
907
|
let {
|
|
908
|
+
id,
|
|
908
909
|
sizeMapping = null,
|
|
909
910
|
viewport = null,
|
|
910
911
|
targeting = null,
|
|
@@ -969,6 +970,7 @@ function useAd(path, size) {
|
|
|
969
970
|
return itViewport.join('x') === viewportSize.join('x');
|
|
970
971
|
}) || [] : [];
|
|
971
972
|
const newSlot = path !== null && !disabled ? adsManager.createSlot(path, viewportFixedSize || size, {
|
|
973
|
+
id,
|
|
972
974
|
visible: isVisible,
|
|
973
975
|
sizeMapping: viewportFixedSize === null ? sizeMapping : null,
|
|
974
976
|
targeting,
|
|
@@ -987,7 +989,7 @@ function useAd(path, size) {
|
|
|
987
989
|
// adsManager.destroySlot(newSlot);
|
|
988
990
|
// }
|
|
989
991
|
// };
|
|
990
|
-
}, [adsManager, path, disabled, size, sizeMapping, viewport, categoryExclusions]);
|
|
992
|
+
}, [adsManager, path, disabled, size, sizeMapping, viewport, categoryExclusions, id]);
|
|
991
993
|
React.useEffect(() => {
|
|
992
994
|
if (slot !== null) {
|
|
993
995
|
slot.setTargeting(targeting);
|
|
@@ -1165,6 +1167,7 @@ const propTypes = {
|
|
|
1165
1167
|
shouldKeepSize: PropTypes.bool,
|
|
1166
1168
|
withoutStyle: PropTypes.bool,
|
|
1167
1169
|
withoutMinimumSize: PropTypes.bool,
|
|
1170
|
+
withReactId: PropTypes.bool,
|
|
1168
1171
|
className: PropTypes.string,
|
|
1169
1172
|
emptyClassName: PropTypes.string,
|
|
1170
1173
|
adClassName: PropTypes.string,
|
|
@@ -1190,6 +1193,7 @@ function Ad(_ref) {
|
|
|
1190
1193
|
shouldKeepSize = false,
|
|
1191
1194
|
withoutStyle = false,
|
|
1192
1195
|
withoutMinimumSize = false,
|
|
1196
|
+
withReactId = false,
|
|
1193
1197
|
className = null,
|
|
1194
1198
|
emptyClassName = null,
|
|
1195
1199
|
adClassName = null,
|
|
@@ -1280,6 +1284,8 @@ function Ad(_ref) {
|
|
|
1280
1284
|
// }
|
|
1281
1285
|
// }, [disabled]);
|
|
1282
1286
|
|
|
1287
|
+
const reactId = React.useId();
|
|
1288
|
+
|
|
1283
1289
|
// Create ad
|
|
1284
1290
|
const {
|
|
1285
1291
|
id,
|
|
@@ -1291,6 +1297,7 @@ function Ad(_ref) {
|
|
|
1291
1297
|
refObserver,
|
|
1292
1298
|
slot: slotObject = null
|
|
1293
1299
|
} = useAd(path, size, {
|
|
1300
|
+
id: withReactId ? `ad-${reactId}` : null,
|
|
1294
1301
|
viewport,
|
|
1295
1302
|
sizeMapping,
|
|
1296
1303
|
targeting,
|
|
@@ -1327,7 +1334,7 @@ function Ad(_ref) {
|
|
|
1327
1334
|
adStyle = minimumSize;
|
|
1328
1335
|
}
|
|
1329
1336
|
let containerStyle = null;
|
|
1330
|
-
if (disabled) {
|
|
1337
|
+
if (disabled && !keepSize) {
|
|
1331
1338
|
containerStyle = {
|
|
1332
1339
|
display: 'none',
|
|
1333
1340
|
visibility: 'hidden'
|
package/dist/es.js
CHANGED
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import isFunction from 'lodash/isFunction';
|
|
4
4
|
import isObject from 'lodash/isObject';
|
|
5
|
-
import React, { useContext, useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
5
|
+
import React, { useContext, useState, useRef, useMemo, useEffect, useCallback, useId } from 'react';
|
|
6
6
|
import isArray from 'lodash/isArray';
|
|
7
7
|
import sortBy from 'lodash/sortBy';
|
|
8
8
|
import uniqBy from 'lodash/uniqBy';
|
|
@@ -903,6 +903,7 @@ function useAdsTracking() {
|
|
|
903
903
|
|
|
904
904
|
function useAd(path, size) {
|
|
905
905
|
let {
|
|
906
|
+
id,
|
|
906
907
|
sizeMapping = null,
|
|
907
908
|
viewport = null,
|
|
908
909
|
targeting = null,
|
|
@@ -967,6 +968,7 @@ function useAd(path, size) {
|
|
|
967
968
|
return itViewport.join('x') === viewportSize.join('x');
|
|
968
969
|
}) || [] : [];
|
|
969
970
|
const newSlot = path !== null && !disabled ? adsManager.createSlot(path, viewportFixedSize || size, {
|
|
971
|
+
id,
|
|
970
972
|
visible: isVisible,
|
|
971
973
|
sizeMapping: viewportFixedSize === null ? sizeMapping : null,
|
|
972
974
|
targeting,
|
|
@@ -985,7 +987,7 @@ function useAd(path, size) {
|
|
|
985
987
|
// adsManager.destroySlot(newSlot);
|
|
986
988
|
// }
|
|
987
989
|
// };
|
|
988
|
-
}, [adsManager, path, disabled, size, sizeMapping, viewport, categoryExclusions]);
|
|
990
|
+
}, [adsManager, path, disabled, size, sizeMapping, viewport, categoryExclusions, id]);
|
|
989
991
|
useEffect(() => {
|
|
990
992
|
if (slot !== null) {
|
|
991
993
|
slot.setTargeting(targeting);
|
|
@@ -1163,6 +1165,7 @@ const propTypes = {
|
|
|
1163
1165
|
shouldKeepSize: PropTypes.bool,
|
|
1164
1166
|
withoutStyle: PropTypes.bool,
|
|
1165
1167
|
withoutMinimumSize: PropTypes.bool,
|
|
1168
|
+
withReactId: PropTypes.bool,
|
|
1166
1169
|
className: PropTypes.string,
|
|
1167
1170
|
emptyClassName: PropTypes.string,
|
|
1168
1171
|
adClassName: PropTypes.string,
|
|
@@ -1188,6 +1191,7 @@ function Ad(_ref) {
|
|
|
1188
1191
|
shouldKeepSize = false,
|
|
1189
1192
|
withoutStyle = false,
|
|
1190
1193
|
withoutMinimumSize = false,
|
|
1194
|
+
withReactId = false,
|
|
1191
1195
|
className = null,
|
|
1192
1196
|
emptyClassName = null,
|
|
1193
1197
|
adClassName = null,
|
|
@@ -1278,6 +1282,8 @@ function Ad(_ref) {
|
|
|
1278
1282
|
// }
|
|
1279
1283
|
// }, [disabled]);
|
|
1280
1284
|
|
|
1285
|
+
const reactId = useId();
|
|
1286
|
+
|
|
1281
1287
|
// Create ad
|
|
1282
1288
|
const {
|
|
1283
1289
|
id,
|
|
@@ -1289,6 +1295,7 @@ function Ad(_ref) {
|
|
|
1289
1295
|
refObserver,
|
|
1290
1296
|
slot: slotObject = null
|
|
1291
1297
|
} = useAd(path, size, {
|
|
1298
|
+
id: withReactId ? `ad-${reactId}` : null,
|
|
1292
1299
|
viewport,
|
|
1293
1300
|
sizeMapping,
|
|
1294
1301
|
targeting,
|
|
@@ -1325,7 +1332,7 @@ function Ad(_ref) {
|
|
|
1325
1332
|
adStyle = minimumSize;
|
|
1326
1333
|
}
|
|
1327
1334
|
let containerStyle = null;
|
|
1328
|
-
if (disabled) {
|
|
1335
|
+
if (disabled && !keepSize) {
|
|
1329
1336
|
containerStyle = {
|
|
1330
1337
|
display: 'none',
|
|
1331
1338
|
visibility: 'hidden'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/ads",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.108",
|
|
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": "c3ad873dea501878a1cde879dbf16ab83d270493",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@folklore/hooks": "^0.0.72",
|
|
56
56
|
"@folklore/tracking": "^0.0.29",
|