@folklore/ads 0.0.4 → 0.0.6
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 +7 -14
- package/dist/es.js +7 -14
- package/package.json +2 -2
package/dist/cjs.js
CHANGED
|
@@ -330,7 +330,9 @@ class AdsManager extends EventEmitter__default["default"] {
|
|
|
330
330
|
this.personnalizedAdsDisabled = this.options.disablePersonnalizedAds;
|
|
331
331
|
this.ready = false;
|
|
332
332
|
this.enabled = false;
|
|
333
|
-
this.googletag = window.googletag
|
|
333
|
+
this.googletag = typeof window !== 'undefined' ? window.googletag : {
|
|
334
|
+
cmd: []
|
|
335
|
+
};
|
|
334
336
|
this.slots = [];
|
|
335
337
|
if (this.options.autoInit) {
|
|
336
338
|
this.init();
|
|
@@ -391,7 +393,7 @@ class AdsManager extends EventEmitter__default["default"] {
|
|
|
391
393
|
if (renderSlot !== null) {
|
|
392
394
|
renderSlot.setRenderEvent(event);
|
|
393
395
|
}
|
|
394
|
-
const lineItems = window.refreshDisabledLineItems || [];
|
|
396
|
+
const lineItems = typeof window !== 'undefined' ? window.refreshDisabledLineItems || [] : [];
|
|
395
397
|
if (isArray__default["default"](lineItems) && lineItems.indexOf(lineItemId) > -1) {
|
|
396
398
|
renderSlot.setRefreshDisabled();
|
|
397
399
|
}
|
|
@@ -744,9 +746,9 @@ AdsTargetingProvider.propTypes = propTypes$1;
|
|
|
744
746
|
AdsTargetingProvider.defaultProps = defaultProps$1;
|
|
745
747
|
|
|
746
748
|
function useTrackAd() {
|
|
747
|
-
const tracking$1 = tracking.useTracking();
|
|
749
|
+
const tracking$1 = tracking.useTracking() || null;
|
|
748
750
|
const trackEvent = React.useCallback((action, slot, renderEvent) => {
|
|
749
|
-
if (typeof tracking$1.trackAd !== 'undefined') {
|
|
751
|
+
if (tracking$1 !== null && typeof tracking$1.trackAd !== 'undefined') {
|
|
750
752
|
tracking$1.trackAd(action, slot, renderEvent);
|
|
751
753
|
}
|
|
752
754
|
}, [tracking$1]);
|
|
@@ -1026,18 +1028,9 @@ function Ad(_ref) {
|
|
|
1026
1028
|
[emptyClassName]: emptyClassName !== null && isEmpty && !keepSize
|
|
1027
1029
|
}]),
|
|
1028
1030
|
ref: refObserver,
|
|
1029
|
-
style: isEmpty && !keepSize ? {
|
|
1030
|
-
height: 0,
|
|
1031
|
-
paddingBottom: 0,
|
|
1032
|
-
overflow: 'hidden',
|
|
1033
|
-
opacity: 0
|
|
1034
|
-
} : null,
|
|
1035
1031
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1036
1032
|
className: adClassName,
|
|
1037
|
-
style:
|
|
1038
|
-
...sizeStyle,
|
|
1039
|
-
margin: 'auto'
|
|
1040
|
-
},
|
|
1033
|
+
style: sizeStyle,
|
|
1041
1034
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1042
1035
|
id: id
|
|
1043
1036
|
})
|
package/dist/es.js
CHANGED
|
@@ -313,7 +313,9 @@ class AdsManager extends EventEmitter {
|
|
|
313
313
|
this.personnalizedAdsDisabled = this.options.disablePersonnalizedAds;
|
|
314
314
|
this.ready = false;
|
|
315
315
|
this.enabled = false;
|
|
316
|
-
this.googletag = window.googletag
|
|
316
|
+
this.googletag = typeof window !== 'undefined' ? window.googletag : {
|
|
317
|
+
cmd: []
|
|
318
|
+
};
|
|
317
319
|
this.slots = [];
|
|
318
320
|
if (this.options.autoInit) {
|
|
319
321
|
this.init();
|
|
@@ -374,7 +376,7 @@ class AdsManager extends EventEmitter {
|
|
|
374
376
|
if (renderSlot !== null) {
|
|
375
377
|
renderSlot.setRenderEvent(event);
|
|
376
378
|
}
|
|
377
|
-
const lineItems = window.refreshDisabledLineItems || [];
|
|
379
|
+
const lineItems = typeof window !== 'undefined' ? window.refreshDisabledLineItems || [] : [];
|
|
378
380
|
if (isArray(lineItems) && lineItems.indexOf(lineItemId) > -1) {
|
|
379
381
|
renderSlot.setRefreshDisabled();
|
|
380
382
|
}
|
|
@@ -727,9 +729,9 @@ AdsTargetingProvider.propTypes = propTypes$1;
|
|
|
727
729
|
AdsTargetingProvider.defaultProps = defaultProps$1;
|
|
728
730
|
|
|
729
731
|
function useTrackAd() {
|
|
730
|
-
const tracking = useTracking();
|
|
732
|
+
const tracking = useTracking() || null;
|
|
731
733
|
const trackEvent = useCallback((action, slot, renderEvent) => {
|
|
732
|
-
if (typeof tracking.trackAd !== 'undefined') {
|
|
734
|
+
if (tracking !== null && typeof tracking.trackAd !== 'undefined') {
|
|
733
735
|
tracking.trackAd(action, slot, renderEvent);
|
|
734
736
|
}
|
|
735
737
|
}, [tracking]);
|
|
@@ -1009,18 +1011,9 @@ function Ad(_ref) {
|
|
|
1009
1011
|
[emptyClassName]: emptyClassName !== null && isEmpty && !keepSize
|
|
1010
1012
|
}]),
|
|
1011
1013
|
ref: refObserver,
|
|
1012
|
-
style: isEmpty && !keepSize ? {
|
|
1013
|
-
height: 0,
|
|
1014
|
-
paddingBottom: 0,
|
|
1015
|
-
overflow: 'hidden',
|
|
1016
|
-
opacity: 0
|
|
1017
|
-
} : null,
|
|
1018
1014
|
children: /*#__PURE__*/jsx("div", {
|
|
1019
1015
|
className: adClassName,
|
|
1020
|
-
style:
|
|
1021
|
-
...sizeStyle,
|
|
1022
|
-
margin: 'auto'
|
|
1023
|
-
},
|
|
1016
|
+
style: sizeStyle,
|
|
1024
1017
|
children: /*#__PURE__*/jsx("div", {
|
|
1025
1018
|
id: id
|
|
1026
1019
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/ads",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
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": "ee872d3b53d682519131cb2b1c570f4da8b2c991",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@folklore/hooks": "^0.0.41",
|
|
56
56
|
"@folklore/tracking": "^0.0.16",
|