@folklore/ads 0.0.100 → 0.0.101

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.
Files changed (3) hide show
  1. package/dist/cjs.js +150 -154
  2. package/dist/es.js +150 -155
  3. package/package.json +2 -2
package/dist/cjs.js CHANGED
@@ -40,13 +40,10 @@ var propTypes$4 = /*#__PURE__*/Object.freeze({
40
40
  adViewports: adViewports
41
41
  });
42
42
 
43
- const getAdSizes = sizes => {
44
- if (isArray(sizes)) {
45
- return uniqBy(isArray(sizes[0]) || sizes[0] === 'fluid' ? sizes.filter(size => size !== 'fluid').reduce((allSizes, size) => [...allSizes, ...getAdSizes(size)], []) : [sizes].filter(size => size !== 'fluid'), size => size.join('x'));
46
- }
47
- return sizes.split('x').map(it => parseInt(it, 10));
48
- };
49
- const getMinimumAdSize = sizes => getAdSizes(sizes).reduce((minimumSize, size) => ({
43
+ function getAdSizes(sizes) {
44
+ return uniqBy(sizes, size => isArray(size) ? size.join('x') : size);
45
+ }
46
+ const getMinimumAdSize = sizes => getAdSizes(sizes).filter(size => size !== 'fluid').reduce((minimumSize, size) => ({
50
47
  width: Math.min(minimumSize.width, size[0]),
51
48
  height: Math.min(minimumSize.height, size[1])
52
49
  }), {
@@ -82,6 +79,23 @@ const getSizeMappingFromSlot = (_ref3, viewports) => {
82
79
  }
83
80
  return sizeMapping !== null ? buildSizeMappingFromViewports(sizeMapping, viewports) : null;
84
81
  };
82
+ function getSizeFromSizeMapping(sizeMapping) {
83
+ if (sizeMapping === null) {
84
+ return null;
85
+ }
86
+ return getAdSizes(sizeMapping.reduce((allSizes, sizeMap) => [...allSizes, ...sizeMap[1]], [])).sort((a, b) => {
87
+ if (a === 'fluid') {
88
+ return 1;
89
+ }
90
+ if (b === 'fluid') {
91
+ return -1;
92
+ }
93
+ if (a[0] === b[0]) {
94
+ return a[1] > b[1] ? 1 : -1;
95
+ }
96
+ return a[0] > b[0] ? 1 : -1;
97
+ });
98
+ }
85
99
 
86
100
  class AdSlot extends EventEmitter {
87
101
  constructor(id, path, size) {
@@ -615,19 +629,6 @@ const viewports = {
615
629
  };
616
630
  const slots = {
617
631
  top: {
618
- size: [[300, 100], [300, 150], [320, 50], [320, 100], [320, 180]
619
- // [300, 100],
620
- // [300, 150],
621
- // [320, 50],
622
- // [320, 100],
623
- // [640, 350],
624
- // [728, 90],
625
- // [970, 90],
626
- // [970, 250],
627
- // [1024, 300],
628
- // [1382, 300],
629
- // [1382, 600],
630
- ],
631
632
  sizeMapping: {
632
633
  default: [[300, 100], [300, 150], [320, 50], [320, 100], [320, 180]],
633
634
  tablet: [[300, 100], [300, 150], [320, 50], [320, 100], [320, 180], [728, 90]],
@@ -639,14 +640,12 @@ const slots = {
639
640
  size: [[250, 250], [300, 250]]
640
641
  },
641
642
  sidebar: {
642
- size: [[120, 600], [160, 600], [300, 600], [300, 250]],
643
643
  sizeMapping: {
644
644
  default: [[300, 250]],
645
645
  laptop: [[120, 600], [160, 600], [300, 250], [300, 600]]
646
646
  }
647
647
  },
648
648
  fullwidth: {
649
- size: [[250, 250], [300, 100], [300, 150], [300, 250], [320, 50], [320, 100], [320, 180], [336, 280], [634, 634], [640, 360], [640, 350], [728, 90], [960, 540], [970, 90], [970, 250], [970, 415], [1024, 300], [1382, 300], [1382, 600]],
650
649
  sizeMapping: {
651
650
  default: [[250, 250], [300, 100], [300, 150], [300, 250], [320, 50], [320, 100], [320, 180], [336, 280]],
652
651
  tablet: [[250, 250], [300, 100], [300, 150], [300, 250], [320, 50], [320, 100], [320, 180], [336, 280], [634, 634], [640, 350], [640, 360], [728, 90]],
@@ -655,27 +654,6 @@ const slots = {
655
654
  }
656
655
  },
657
656
  content: {
658
- size: [[120, 600], [160, 600], [250, 250], [300, 100], [300, 150], [300, 250], [300, 600], [320, 50], [320, 100], [320, 180], [336, 280], [634, 634], [640, 350], [640, 360], [728, 90], [960, 540], [970, 90], [970, 250], [970, 415], [1024, 300], [1382, 300], [1382, 600]
659
- // [120, 600],
660
- // [160, 600],
661
- // [250, 250],
662
- // [300, 100],
663
- // [300, 150],
664
- // [300, 250],
665
- // [300, 600],
666
- // [320, 50],
667
- // [320, 100],
668
- // [336, 280],
669
- // [634, 634],
670
- // [640, 350],
671
- // [728, 90],
672
- // [970, 90],
673
- // [970, 250],
674
- // [970, 415],
675
- // [1024, 300],
676
- // [1382, 300],
677
- // [1382, 600],
678
- ],
679
657
  sizeMapping: {
680
658
  default: [[120, 600], [160, 600], [250, 250], [300, 100], [300, 150], [300, 250], [300, 600], [320, 50], [320, 100], [320, 180], [336, 280]],
681
659
  tablet: [[120, 600], [160, 600], [250, 250], [300, 100], [300, 150], [300, 250],
@@ -709,13 +687,14 @@ const propTypes$3 = {
709
687
  mobileScaling: PropTypes.number,
710
688
  renderMarginPercent: PropTypes.number,
711
689
  fetchMarginPercent: PropTypes.number,
690
+ viewport: PropTypes.string,
712
691
  slots: adSlots,
713
692
  viewports: adViewports,
714
693
  richAdComponents: PropTypes.objectOf(PropTypes.elementType),
715
694
  disabled: PropTypes.bool,
716
695
  disableTracking: PropTypes.bool
717
696
  };
718
- const defaultProps$3 = {
697
+ const defaultProps$2 = {
719
698
  defaultSlotPath: null,
720
699
  slotsPath: null,
721
700
  disableSingleRequest: false,
@@ -727,6 +706,7 @@ const defaultProps$3 = {
727
706
  mobileScaling: 1.0,
728
707
  renderMarginPercent: 100,
729
708
  fetchMarginPercent: 300,
709
+ viewport: null,
730
710
  slots: slots,
731
711
  viewports: viewports,
732
712
  richAdComponents: null,
@@ -747,6 +727,7 @@ function AdsProvider(_ref) {
747
727
  mobileScaling,
748
728
  renderMarginPercent,
749
729
  fetchMarginPercent,
730
+ viewport,
750
731
  viewports,
751
732
  slots,
752
733
  richAdComponents,
@@ -803,13 +784,21 @@ function AdsProvider(_ref) {
803
784
  onResize.cancel();
804
785
  };
805
786
  }, [ads, resizeDebounceDelay, refreshOnResize]);
806
- const slotsWithSizeMapping = React.useMemo(() => Object.keys(slots || {}).reduce((map, key) => ({
807
- ...map,
808
- [key]: {
809
- ...slots[key],
810
- sizeMapping: getSizeMappingFromSlot(slots[key], viewports)
811
- }
812
- }), {}), []);
787
+ const slotsWithSizeMapping = React.useMemo(() => Object.keys(slots || {}).reduce((map, key) => {
788
+ const slot = slots[key];
789
+ const {
790
+ size
791
+ } = slot;
792
+ const sizeMapping = getSizeMappingFromSlot(slot, viewports);
793
+ return {
794
+ ...map,
795
+ [key]: {
796
+ ...slot,
797
+ size: size || getSizeFromSizeMapping(sizeMapping || null),
798
+ sizeMapping
799
+ }
800
+ };
801
+ }, {}), []);
813
802
  const finalSlotsPath = React.useMemo(() => defaultSlotPath !== null ? {
814
803
  default: defaultSlotPath,
815
804
  ...slotsPath
@@ -820,18 +809,19 @@ function AdsProvider(_ref) {
820
809
  ready,
821
810
  ads,
822
811
  viewports,
812
+ viewport,
823
813
  slots: slotsWithSizeMapping,
824
814
  slotsPath: finalSlotsPath,
825
815
  trackingDisabled: disableTracking,
826
816
  richAdComponents
827
- }), [ready, ads, viewports, slotsWithSizeMapping, finalSlotsPath, disableTracking, richAdComponents]);
817
+ }), [ready, ads, viewports, viewport, slotsWithSizeMapping, finalSlotsPath, disableTracking, richAdComponents]);
828
818
  return /*#__PURE__*/jsxRuntime.jsx(AdsContext.Provider, {
829
819
  value: value,
830
820
  children: children
831
821
  });
832
822
  }
833
823
  AdsProvider.propTypes = propTypes$3;
834
- AdsProvider.defaultProps = defaultProps$3;
824
+ AdsProvider.defaultProps = defaultProps$2;
835
825
 
836
826
  const AdsTargetingContext = /*#__PURE__*/React.createContext(null);
837
827
  const useAdsTargeting = () => React.useContext(AdsTargetingContext);
@@ -841,7 +831,7 @@ const propTypes$2 = {
841
831
  targeting: PropTypes.object,
842
832
  replace: PropTypes.bool
843
833
  };
844
- const defaultProps$2 = {
834
+ const defaultProps$1 = {
845
835
  targeting: {
846
836
  domain: typeof window !== 'undefined' ? `${window.location.protocol}//${window.location.host}` : null
847
837
  },
@@ -864,7 +854,7 @@ function AdsTargetingProvider(_ref) {
864
854
  });
865
855
  }
866
856
  AdsTargetingProvider.propTypes = propTypes$2;
867
- AdsTargetingProvider.defaultProps = defaultProps$2;
857
+ AdsTargetingProvider.defaultProps = defaultProps$1;
868
858
 
869
859
  /* eslint-disable react/jsx-props-no-spreading */
870
860
  const propTypes$1 = {
@@ -872,7 +862,7 @@ const propTypes$1 = {
872
862
  type: PropTypes.string.isRequired
873
863
  }).isRequired
874
864
  };
875
- const defaultProps$1 = {};
865
+ const defaultProps = {};
876
866
  function RichAd(_ref) {
877
867
  let {
878
868
  richAd,
@@ -892,7 +882,7 @@ function RichAd(_ref) {
892
882
  }) : null;
893
883
  }
894
884
  RichAd.propTypes = propTypes$1;
895
- RichAd.defaultProps = defaultProps$1;
885
+ RichAd.defaultProps = defaultProps;
896
886
 
897
887
  function useAdsTracking() {
898
888
  const tracking$1 = tracking.useTracking() || null;
@@ -907,6 +897,7 @@ function useAdsTracking() {
907
897
  function useAd(path, size) {
908
898
  let {
909
899
  sizeMapping = null,
900
+ viewport = null,
910
901
  targeting = null,
911
902
  categoryExclusions = null,
912
903
  refreshInterval = null,
@@ -919,6 +910,7 @@ function useAd(path, size) {
919
910
  } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
920
911
  const {
921
912
  ads: adsManager,
913
+ viewports,
922
914
  ready: adsReady,
923
915
  trackingDisabled: globalTrackingDisabled = false
924
916
  } = useAdsContext();
@@ -952,30 +944,41 @@ function useAd(path, size) {
952
944
  const [renderEvent, setRenderEvent] = React.useState(null);
953
945
 
954
946
  // Create slot
955
- // const currentSlot = useRef(null);
956
- const [slot, setSlot] = React.useState(null);
957
- React.useEffect(() => {
958
- // if (currentSlot.current !== null) {
959
- // adsManager.destroySlot(currentSlot.current);
960
- // currentSlot.current = null;
961
- // }
962
- const newSlot = path !== null && !disabled ? adsManager.createSlot(path, size, {
947
+ const slotRef = React.useRef(null);
948
+ // const { current: slot } = slotRef;
949
+ // const [slot, setSlot] = useState(null);
950
+ const slot = React.useMemo(() => {
951
+ const {
952
+ current: currentSlot = null
953
+ } = slotRef;
954
+ if (currentSlot !== null) {
955
+ adsManager.destroySlot(currentSlot);
956
+ }
957
+ const viewportSize = viewport !== null ? viewports[viewport] || null : null;
958
+ const [, viewportFixedSize = null] = sizeMapping !== null && viewportSize !== null ? sizeMapping.find(_ref => {
959
+ let [itViewport] = _ref;
960
+ return itViewport.join('x') === viewportSize.join('x');
961
+ }) || [] : [];
962
+ const newSlot = path !== null && !disabled ? adsManager.createSlot(path, viewportFixedSize || size, {
963
963
  visible: isVisible,
964
- sizeMapping,
964
+ sizeMapping: viewportFixedSize === null ? sizeMapping : null,
965
965
  targeting,
966
966
  categoryExclusions
967
967
  }) : null;
968
- setSlot(newSlot);
969
- // if (currentSlot.current !== null && adsReady) {
970
- // adsManager.defineSlot(currentSlot.current);
971
- // }
972
- // return currentSlot.current;
973
- return () => {
974
- if (newSlot !== null) {
975
- adsManager.destroySlot(newSlot);
976
- }
977
- };
978
- }, [adsManager, path, disabled, size, sizeMapping, categoryExclusions]);
968
+ slotRef.current = newSlot;
969
+ return newSlot;
970
+ // // setSlot(newSlot);
971
+ // // if (currentSlot.current !== null && adsReady) {
972
+ // // adsManager.defineSlot(currentSlot.current);
973
+ // // }
974
+ // // return currentSlot.current;
975
+ // return () => {
976
+ // slotRef.current = null;
977
+ // if (newSlot !== null) {
978
+ // adsManager.destroySlot(newSlot);
979
+ // }
980
+ // };
981
+ }, [adsManager, path, disabled, size, sizeMapping, viewport, categoryExclusions]);
979
982
  React.useEffect(() => {
980
983
  if (slot !== null) {
981
984
  slot.setTargeting(targeting);
@@ -1138,11 +1141,13 @@ function useRichAd(containerRef, id, opts) {
1138
1141
  return richAd;
1139
1142
  }
1140
1143
 
1144
+ /* eslint-disable react/require-default-props */
1141
1145
  const propTypes = {
1142
1146
  slot: PropTypes.string.isRequired,
1143
1147
  path: adPath,
1144
1148
  size: adSize,
1145
1149
  sizeMapping: adSizeMapping,
1150
+ viewport: PropTypes.string,
1146
1151
  targeting: adTargeting,
1147
1152
  refreshInterval: PropTypes.number,
1148
1153
  alwaysRender: PropTypes.bool,
@@ -1161,102 +1166,92 @@ const propTypes = {
1161
1166
  onRichAd: PropTypes.func,
1162
1167
  slotRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
1163
1168
  };
1164
- const defaultProps = {
1165
- path: null,
1166
- size: null,
1167
- sizeMapping: null,
1168
- targeting: null,
1169
- refreshInterval: null,
1170
- alwaysRender: true,
1171
- disabled: false,
1172
- disableTracking: false,
1173
- shouldKeepSize: false,
1174
- withoutStyle: false,
1175
- withoutMinimumSize: false,
1176
- className: null,
1177
- emptyClassName: null,
1178
- adClassName: null,
1179
- richAdClassName: null,
1180
- richAdIframeClassName: null,
1181
- onRender: null,
1182
- onDestroy: null,
1183
- onRichAd: null,
1184
- slotRef: null
1185
- };
1186
1169
  function Ad(_ref) {
1187
1170
  let {
1188
- slot: slotName,
1189
- path,
1190
- size,
1191
- sizeMapping,
1192
- targeting,
1193
- refreshInterval,
1194
- alwaysRender,
1195
- disabled,
1196
- disableTracking,
1197
- shouldKeepSize,
1198
- withoutStyle,
1199
- withoutMinimumSize,
1200
- className,
1201
- emptyClassName,
1202
- adClassName,
1203
- richAdClassName,
1204
- richAdIframeClassName,
1205
- onRender,
1206
- onDestroy,
1207
- onRichAd,
1208
- slotRef
1171
+ slot: slotName = null,
1172
+ path: providedPath = null,
1173
+ size: providedSize = null,
1174
+ sizeMapping: providedSizeMapping = null,
1175
+ viewport: providedViewport = null,
1176
+ targeting: providedTargeting = null,
1177
+ refreshInterval: providedRefreshInterval = null,
1178
+ alwaysRender = true,
1179
+ disabled: providedDisabled = false,
1180
+ disableTracking = false,
1181
+ shouldKeepSize = false,
1182
+ withoutStyle = false,
1183
+ withoutMinimumSize = false,
1184
+ className = null,
1185
+ emptyClassName = null,
1186
+ adClassName = null,
1187
+ richAdClassName = null,
1188
+ richAdIframeClassName = null,
1189
+ onRender = null,
1190
+ onDestroy = null,
1191
+ onRichAd = null,
1192
+ slotRef = null
1209
1193
  } = _ref;
1210
1194
  const {
1211
1195
  slots = null,
1212
- slotsPath = {}
1196
+ slotsPath = null,
1197
+ viewport: contextViewport = null
1213
1198
  } = useAdsContext();
1199
+ const {
1200
+ default: defaultSlotPath = null
1201
+ } = slotsPath || {};
1214
1202
  const slot = slotName !== null && slots !== null ? slots[slotName] || null : null;
1215
- const finalPath = path || (slot !== null ? slot.path || null : null) || (slotName !== null ? slotsPath[slotName] : null) || slotsPath.default || null;
1216
- const finalSize = size || (slot !== null ? slot.size || null : null);
1217
- const finalSizeMapping = sizeMapping || (slot !== null ? slot.sizeMapping || null : null);
1218
- const minimumSize = React.useMemo(() => getMinimumAdSize(finalSizeMapping !== null ? finalSizeMapping.reduce((allSizes, sizeMap) => [...allSizes, sizeMap[1]], [finalSize]) : finalSize), [finalSizeMapping, finalSize]);
1203
+ const {
1204
+ sizeMapping: slotSizeMapping = null,
1205
+ size: slotSize = null,
1206
+ path: slotPath = null
1207
+ } = slot || {};
1208
+ const path = providedPath || slotPath || (slotName !== null && slotsPath !== null ? slotsPath[slotName] : null) || defaultSlotPath || null;
1209
+
1210
+ // Size
1211
+ const size = providedSize || slotSize;
1212
+ const sizeMapping = providedSizeMapping || slotSizeMapping;
1213
+ const minimumSize = React.useMemo(() => getMinimumAdSize(sizeMapping !== null ? sizeMapping.reduce((allSizes, sizeMap) => [...allSizes, sizeMap[1]], [size]) : [size]), [sizeMapping, size]);
1219
1214
 
1220
1215
  // Targeting
1221
1216
  const contextTargeting = useAdsTargeting();
1222
1217
  const {
1223
- disabled: targetingDisabled = false
1224
- } = contextTargeting || {};
1225
- const finalDisabled = disabled || targetingDisabled;
1226
- const allTargeting = React.useMemo(() => {
1227
- const {
1228
- disabled: removedDisabled,
1229
- ...otherTargeting
1230
- } = contextTargeting || {};
1231
- return {
1218
+ targeting,
1219
+ refreshInterval,
1220
+ disabled,
1221
+ viewport
1222
+ } = React.useMemo(() => {
1223
+ const allTargeting = {
1232
1224
  ...(slotName !== null ? {
1233
1225
  slot: slotName
1234
1226
  } : null),
1235
- ...otherTargeting,
1236
- ...targeting
1227
+ ...contextTargeting,
1228
+ ...providedTargeting
1237
1229
  };
1238
- }, [contextTargeting, targeting, slotName]);
1239
- const finalAdTargeting = React.useMemo(() => {
1240
1230
  const {
1241
1231
  refreshAds = null,
1232
+ disabled: targetingDisabled = false,
1233
+ viewport: targetingViewport = null,
1242
1234
  ...otherProps
1243
1235
  } = allTargeting || {};
1244
1236
  return {
1245
- refreshInterval: refreshAds !== null && refreshAds === 'inactive' ? null : refreshInterval,
1237
+ refreshInterval: refreshAds !== null && refreshAds === 'inactive' ? null : providedRefreshInterval,
1238
+ disabled: providedDisabled || targetingDisabled,
1239
+ viewport: providedViewport || contextViewport || targetingViewport,
1246
1240
  targeting: otherProps || {}
1247
1241
  };
1248
- }, [allTargeting, refreshInterval]);
1242
+ }, [contextTargeting, providedTargeting, slotName, providedRefreshInterval]);
1249
1243
  const lastRenderedSize = React.useRef(null);
1250
- const wasDisabled = React.useRef(finalDisabled);
1244
+ const wasDisabled = React.useRef(disabled);
1245
+ React.useEffect(() => {}, []);
1251
1246
  const onAdRender = React.useCallback(event => {
1252
1247
  const {
1253
1248
  isEmpty: newIsEmpty = true,
1254
1249
  width: newWidth,
1255
1250
  height: newHeight
1256
1251
  } = event || {};
1257
- if (finalDisabled) {
1252
+ if (disabled) {
1258
1253
  wasDisabled.current = true;
1259
- } else if (!finalDisabled && !newIsEmpty) {
1254
+ } else if (!disabled && !newIsEmpty) {
1260
1255
  wasDisabled.current = false;
1261
1256
  }
1262
1257
  lastRenderedSize.current = !newIsEmpty ? {
@@ -1266,7 +1261,7 @@ function Ad(_ref) {
1266
1261
  if (onRender !== null) {
1267
1262
  onRender(event);
1268
1263
  }
1269
- }, [onRender, shouldKeepSize, finalDisabled]);
1264
+ }, [onRender, shouldKeepSize, disabled]);
1270
1265
 
1271
1266
  // useEffect(() => {
1272
1267
  // if (!disabled) {
@@ -1292,14 +1287,15 @@ function Ad(_ref) {
1292
1287
  isRendered,
1293
1288
  refObserver,
1294
1289
  slot: slotObject = null
1295
- } = useAd(finalPath, finalSize, {
1296
- sizeMapping: finalSizeMapping,
1297
- targeting: finalAdTargeting.targeting,
1298
- refreshInterval: finalAdTargeting.refreshInterval,
1290
+ } = useAd(path, size, {
1291
+ viewport,
1292
+ sizeMapping,
1293
+ targeting,
1294
+ refreshInterval,
1299
1295
  alwaysRender,
1300
1296
  onRender: onAdRender,
1301
1297
  onDestroy,
1302
- disabled: finalDisabled,
1298
+ disabled,
1303
1299
  disableTracking
1304
1300
  });
1305
1301
  const adContainerRef = React.useRef(null);
@@ -1312,13 +1308,13 @@ function Ad(_ref) {
1312
1308
  // eslint-disable-next-line no-param-reassign
1313
1309
  slotRef.current = slotObject;
1314
1310
  }
1315
- if (finalDisabled) {
1311
+ if (disabled) {
1316
1312
  wasDisabled.current = true;
1317
- } else if (!finalDisabled && isRendered) {
1313
+ } else if (!disabled && isRendered) {
1318
1314
  wasDisabled.current = false;
1319
1315
  }
1320
1316
  const waitingNextRender = wasDisabled.current && !isRendered;
1321
- const keepSize = shouldKeepSize && (finalDisabled || waitingNextRender) && lastRenderedSize.current !== null;
1317
+ const keepSize = shouldKeepSize && (disabled || waitingNextRender) && lastRenderedSize.current !== null;
1322
1318
  if (id === null && !keepSize) {
1323
1319
  return null;
1324
1320
  }
@@ -1328,7 +1324,7 @@ function Ad(_ref) {
1328
1324
  width,
1329
1325
  height
1330
1326
  } : null;
1331
- } else if (shouldKeepSize && (finalDisabled || waitingNextRender)) {
1327
+ } else if (shouldKeepSize && (disabled || waitingNextRender)) {
1332
1328
  adStyle = lastRenderedSize.current;
1333
1329
  } else if (!withoutMinimumSize) {
1334
1330
  adStyle = minimumSize;
@@ -1377,7 +1373,6 @@ function Ad(_ref) {
1377
1373
  });
1378
1374
  }
1379
1375
  Ad.propTypes = propTypes;
1380
- Ad.defaultProps = defaultProps;
1381
1376
 
1382
1377
  exports.Ad = Ad;
1383
1378
  exports.AdSlot = AdSlot;
@@ -1390,6 +1385,7 @@ exports.buildSizeMappingFromSizes = buildSizeMappingFromSizes;
1390
1385
  exports.buildSizeMappingFromViewports = buildSizeMappingFromViewports;
1391
1386
  exports.getAdSizes = getAdSizes;
1392
1387
  exports.getMinimumAdSize = getMinimumAdSize;
1388
+ exports.getSizeFromSizeMapping = getSizeFromSizeMapping;
1393
1389
  exports.getSizeMappingFromSlot = getSizeMappingFromSlot;
1394
1390
  exports.getSortedViewports = getSortedViewports;
1395
1391
  exports.sizeFitsInViewport = sizeFitsInViewport;
package/dist/es.js CHANGED
@@ -38,13 +38,10 @@ var propTypes$4 = /*#__PURE__*/Object.freeze({
38
38
  adViewports: adViewports
39
39
  });
40
40
 
41
- const getAdSizes = sizes => {
42
- if (isArray(sizes)) {
43
- return uniqBy(isArray(sizes[0]) || sizes[0] === 'fluid' ? sizes.filter(size => size !== 'fluid').reduce((allSizes, size) => [...allSizes, ...getAdSizes(size)], []) : [sizes].filter(size => size !== 'fluid'), size => size.join('x'));
44
- }
45
- return sizes.split('x').map(it => parseInt(it, 10));
46
- };
47
- const getMinimumAdSize = sizes => getAdSizes(sizes).reduce((minimumSize, size) => ({
41
+ function getAdSizes(sizes) {
42
+ return uniqBy(sizes, size => isArray(size) ? size.join('x') : size);
43
+ }
44
+ const getMinimumAdSize = sizes => getAdSizes(sizes).filter(size => size !== 'fluid').reduce((minimumSize, size) => ({
48
45
  width: Math.min(minimumSize.width, size[0]),
49
46
  height: Math.min(minimumSize.height, size[1])
50
47
  }), {
@@ -80,6 +77,23 @@ const getSizeMappingFromSlot = (_ref3, viewports) => {
80
77
  }
81
78
  return sizeMapping !== null ? buildSizeMappingFromViewports(sizeMapping, viewports) : null;
82
79
  };
80
+ function getSizeFromSizeMapping(sizeMapping) {
81
+ if (sizeMapping === null) {
82
+ return null;
83
+ }
84
+ return getAdSizes(sizeMapping.reduce((allSizes, sizeMap) => [...allSizes, ...sizeMap[1]], [])).sort((a, b) => {
85
+ if (a === 'fluid') {
86
+ return 1;
87
+ }
88
+ if (b === 'fluid') {
89
+ return -1;
90
+ }
91
+ if (a[0] === b[0]) {
92
+ return a[1] > b[1] ? 1 : -1;
93
+ }
94
+ return a[0] > b[0] ? 1 : -1;
95
+ });
96
+ }
83
97
 
84
98
  class AdSlot extends EventEmitter {
85
99
  constructor(id, path, size) {
@@ -613,19 +627,6 @@ const viewports = {
613
627
  };
614
628
  const slots = {
615
629
  top: {
616
- size: [[300, 100], [300, 150], [320, 50], [320, 100], [320, 180]
617
- // [300, 100],
618
- // [300, 150],
619
- // [320, 50],
620
- // [320, 100],
621
- // [640, 350],
622
- // [728, 90],
623
- // [970, 90],
624
- // [970, 250],
625
- // [1024, 300],
626
- // [1382, 300],
627
- // [1382, 600],
628
- ],
629
630
  sizeMapping: {
630
631
  default: [[300, 100], [300, 150], [320, 50], [320, 100], [320, 180]],
631
632
  tablet: [[300, 100], [300, 150], [320, 50], [320, 100], [320, 180], [728, 90]],
@@ -637,14 +638,12 @@ const slots = {
637
638
  size: [[250, 250], [300, 250]]
638
639
  },
639
640
  sidebar: {
640
- size: [[120, 600], [160, 600], [300, 600], [300, 250]],
641
641
  sizeMapping: {
642
642
  default: [[300, 250]],
643
643
  laptop: [[120, 600], [160, 600], [300, 250], [300, 600]]
644
644
  }
645
645
  },
646
646
  fullwidth: {
647
- size: [[250, 250], [300, 100], [300, 150], [300, 250], [320, 50], [320, 100], [320, 180], [336, 280], [634, 634], [640, 360], [640, 350], [728, 90], [960, 540], [970, 90], [970, 250], [970, 415], [1024, 300], [1382, 300], [1382, 600]],
648
647
  sizeMapping: {
649
648
  default: [[250, 250], [300, 100], [300, 150], [300, 250], [320, 50], [320, 100], [320, 180], [336, 280]],
650
649
  tablet: [[250, 250], [300, 100], [300, 150], [300, 250], [320, 50], [320, 100], [320, 180], [336, 280], [634, 634], [640, 350], [640, 360], [728, 90]],
@@ -653,27 +652,6 @@ const slots = {
653
652
  }
654
653
  },
655
654
  content: {
656
- size: [[120, 600], [160, 600], [250, 250], [300, 100], [300, 150], [300, 250], [300, 600], [320, 50], [320, 100], [320, 180], [336, 280], [634, 634], [640, 350], [640, 360], [728, 90], [960, 540], [970, 90], [970, 250], [970, 415], [1024, 300], [1382, 300], [1382, 600]
657
- // [120, 600],
658
- // [160, 600],
659
- // [250, 250],
660
- // [300, 100],
661
- // [300, 150],
662
- // [300, 250],
663
- // [300, 600],
664
- // [320, 50],
665
- // [320, 100],
666
- // [336, 280],
667
- // [634, 634],
668
- // [640, 350],
669
- // [728, 90],
670
- // [970, 90],
671
- // [970, 250],
672
- // [970, 415],
673
- // [1024, 300],
674
- // [1382, 300],
675
- // [1382, 600],
676
- ],
677
655
  sizeMapping: {
678
656
  default: [[120, 600], [160, 600], [250, 250], [300, 100], [300, 150], [300, 250], [300, 600], [320, 50], [320, 100], [320, 180], [336, 280]],
679
657
  tablet: [[120, 600], [160, 600], [250, 250], [300, 100], [300, 150], [300, 250],
@@ -707,13 +685,14 @@ const propTypes$3 = {
707
685
  mobileScaling: PropTypes.number,
708
686
  renderMarginPercent: PropTypes.number,
709
687
  fetchMarginPercent: PropTypes.number,
688
+ viewport: PropTypes.string,
710
689
  slots: adSlots,
711
690
  viewports: adViewports,
712
691
  richAdComponents: PropTypes.objectOf(PropTypes.elementType),
713
692
  disabled: PropTypes.bool,
714
693
  disableTracking: PropTypes.bool
715
694
  };
716
- const defaultProps$3 = {
695
+ const defaultProps$2 = {
717
696
  defaultSlotPath: null,
718
697
  slotsPath: null,
719
698
  disableSingleRequest: false,
@@ -725,6 +704,7 @@ const defaultProps$3 = {
725
704
  mobileScaling: 1.0,
726
705
  renderMarginPercent: 100,
727
706
  fetchMarginPercent: 300,
707
+ viewport: null,
728
708
  slots: slots,
729
709
  viewports: viewports,
730
710
  richAdComponents: null,
@@ -745,6 +725,7 @@ function AdsProvider(_ref) {
745
725
  mobileScaling,
746
726
  renderMarginPercent,
747
727
  fetchMarginPercent,
728
+ viewport,
748
729
  viewports,
749
730
  slots,
750
731
  richAdComponents,
@@ -801,13 +782,21 @@ function AdsProvider(_ref) {
801
782
  onResize.cancel();
802
783
  };
803
784
  }, [ads, resizeDebounceDelay, refreshOnResize]);
804
- const slotsWithSizeMapping = useMemo(() => Object.keys(slots || {}).reduce((map, key) => ({
805
- ...map,
806
- [key]: {
807
- ...slots[key],
808
- sizeMapping: getSizeMappingFromSlot(slots[key], viewports)
809
- }
810
- }), {}), []);
785
+ const slotsWithSizeMapping = useMemo(() => Object.keys(slots || {}).reduce((map, key) => {
786
+ const slot = slots[key];
787
+ const {
788
+ size
789
+ } = slot;
790
+ const sizeMapping = getSizeMappingFromSlot(slot, viewports);
791
+ return {
792
+ ...map,
793
+ [key]: {
794
+ ...slot,
795
+ size: size || getSizeFromSizeMapping(sizeMapping || null),
796
+ sizeMapping
797
+ }
798
+ };
799
+ }, {}), []);
811
800
  const finalSlotsPath = useMemo(() => defaultSlotPath !== null ? {
812
801
  default: defaultSlotPath,
813
802
  ...slotsPath
@@ -818,18 +807,19 @@ function AdsProvider(_ref) {
818
807
  ready,
819
808
  ads,
820
809
  viewports,
810
+ viewport,
821
811
  slots: slotsWithSizeMapping,
822
812
  slotsPath: finalSlotsPath,
823
813
  trackingDisabled: disableTracking,
824
814
  richAdComponents
825
- }), [ready, ads, viewports, slotsWithSizeMapping, finalSlotsPath, disableTracking, richAdComponents]);
815
+ }), [ready, ads, viewports, viewport, slotsWithSizeMapping, finalSlotsPath, disableTracking, richAdComponents]);
826
816
  return /*#__PURE__*/jsx(AdsContext.Provider, {
827
817
  value: value,
828
818
  children: children
829
819
  });
830
820
  }
831
821
  AdsProvider.propTypes = propTypes$3;
832
- AdsProvider.defaultProps = defaultProps$3;
822
+ AdsProvider.defaultProps = defaultProps$2;
833
823
 
834
824
  const AdsTargetingContext = /*#__PURE__*/React.createContext(null);
835
825
  const useAdsTargeting = () => useContext(AdsTargetingContext);
@@ -839,7 +829,7 @@ const propTypes$2 = {
839
829
  targeting: PropTypes.object,
840
830
  replace: PropTypes.bool
841
831
  };
842
- const defaultProps$2 = {
832
+ const defaultProps$1 = {
843
833
  targeting: {
844
834
  domain: typeof window !== 'undefined' ? `${window.location.protocol}//${window.location.host}` : null
845
835
  },
@@ -862,7 +852,7 @@ function AdsTargetingProvider(_ref) {
862
852
  });
863
853
  }
864
854
  AdsTargetingProvider.propTypes = propTypes$2;
865
- AdsTargetingProvider.defaultProps = defaultProps$2;
855
+ AdsTargetingProvider.defaultProps = defaultProps$1;
866
856
 
867
857
  /* eslint-disable react/jsx-props-no-spreading */
868
858
  const propTypes$1 = {
@@ -870,7 +860,7 @@ const propTypes$1 = {
870
860
  type: PropTypes.string.isRequired
871
861
  }).isRequired
872
862
  };
873
- const defaultProps$1 = {};
863
+ const defaultProps = {};
874
864
  function RichAd(_ref) {
875
865
  let {
876
866
  richAd,
@@ -890,7 +880,7 @@ function RichAd(_ref) {
890
880
  }) : null;
891
881
  }
892
882
  RichAd.propTypes = propTypes$1;
893
- RichAd.defaultProps = defaultProps$1;
883
+ RichAd.defaultProps = defaultProps;
894
884
 
895
885
  function useAdsTracking() {
896
886
  const tracking = useTracking() || null;
@@ -905,6 +895,7 @@ function useAdsTracking() {
905
895
  function useAd(path, size) {
906
896
  let {
907
897
  sizeMapping = null,
898
+ viewport = null,
908
899
  targeting = null,
909
900
  categoryExclusions = null,
910
901
  refreshInterval = null,
@@ -917,6 +908,7 @@ function useAd(path, size) {
917
908
  } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
918
909
  const {
919
910
  ads: adsManager,
911
+ viewports,
920
912
  ready: adsReady,
921
913
  trackingDisabled: globalTrackingDisabled = false
922
914
  } = useAdsContext();
@@ -950,30 +942,41 @@ function useAd(path, size) {
950
942
  const [renderEvent, setRenderEvent] = useState(null);
951
943
 
952
944
  // Create slot
953
- // const currentSlot = useRef(null);
954
- const [slot, setSlot] = useState(null);
955
- useEffect(() => {
956
- // if (currentSlot.current !== null) {
957
- // adsManager.destroySlot(currentSlot.current);
958
- // currentSlot.current = null;
959
- // }
960
- const newSlot = path !== null && !disabled ? adsManager.createSlot(path, size, {
945
+ const slotRef = useRef(null);
946
+ // const { current: slot } = slotRef;
947
+ // const [slot, setSlot] = useState(null);
948
+ const slot = useMemo(() => {
949
+ const {
950
+ current: currentSlot = null
951
+ } = slotRef;
952
+ if (currentSlot !== null) {
953
+ adsManager.destroySlot(currentSlot);
954
+ }
955
+ const viewportSize = viewport !== null ? viewports[viewport] || null : null;
956
+ const [, viewportFixedSize = null] = sizeMapping !== null && viewportSize !== null ? sizeMapping.find(_ref => {
957
+ let [itViewport] = _ref;
958
+ return itViewport.join('x') === viewportSize.join('x');
959
+ }) || [] : [];
960
+ const newSlot = path !== null && !disabled ? adsManager.createSlot(path, viewportFixedSize || size, {
961
961
  visible: isVisible,
962
- sizeMapping,
962
+ sizeMapping: viewportFixedSize === null ? sizeMapping : null,
963
963
  targeting,
964
964
  categoryExclusions
965
965
  }) : null;
966
- setSlot(newSlot);
967
- // if (currentSlot.current !== null && adsReady) {
968
- // adsManager.defineSlot(currentSlot.current);
969
- // }
970
- // return currentSlot.current;
971
- return () => {
972
- if (newSlot !== null) {
973
- adsManager.destroySlot(newSlot);
974
- }
975
- };
976
- }, [adsManager, path, disabled, size, sizeMapping, categoryExclusions]);
966
+ slotRef.current = newSlot;
967
+ return newSlot;
968
+ // // setSlot(newSlot);
969
+ // // if (currentSlot.current !== null && adsReady) {
970
+ // // adsManager.defineSlot(currentSlot.current);
971
+ // // }
972
+ // // return currentSlot.current;
973
+ // return () => {
974
+ // slotRef.current = null;
975
+ // if (newSlot !== null) {
976
+ // adsManager.destroySlot(newSlot);
977
+ // }
978
+ // };
979
+ }, [adsManager, path, disabled, size, sizeMapping, viewport, categoryExclusions]);
977
980
  useEffect(() => {
978
981
  if (slot !== null) {
979
982
  slot.setTargeting(targeting);
@@ -1136,11 +1139,13 @@ function useRichAd(containerRef, id, opts) {
1136
1139
  return richAd;
1137
1140
  }
1138
1141
 
1142
+ /* eslint-disable react/require-default-props */
1139
1143
  const propTypes = {
1140
1144
  slot: PropTypes.string.isRequired,
1141
1145
  path: adPath,
1142
1146
  size: adSize,
1143
1147
  sizeMapping: adSizeMapping,
1148
+ viewport: PropTypes.string,
1144
1149
  targeting: adTargeting,
1145
1150
  refreshInterval: PropTypes.number,
1146
1151
  alwaysRender: PropTypes.bool,
@@ -1159,102 +1164,92 @@ const propTypes = {
1159
1164
  onRichAd: PropTypes.func,
1160
1165
  slotRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
1161
1166
  };
1162
- const defaultProps = {
1163
- path: null,
1164
- size: null,
1165
- sizeMapping: null,
1166
- targeting: null,
1167
- refreshInterval: null,
1168
- alwaysRender: true,
1169
- disabled: false,
1170
- disableTracking: false,
1171
- shouldKeepSize: false,
1172
- withoutStyle: false,
1173
- withoutMinimumSize: false,
1174
- className: null,
1175
- emptyClassName: null,
1176
- adClassName: null,
1177
- richAdClassName: null,
1178
- richAdIframeClassName: null,
1179
- onRender: null,
1180
- onDestroy: null,
1181
- onRichAd: null,
1182
- slotRef: null
1183
- };
1184
1167
  function Ad(_ref) {
1185
1168
  let {
1186
- slot: slotName,
1187
- path,
1188
- size,
1189
- sizeMapping,
1190
- targeting,
1191
- refreshInterval,
1192
- alwaysRender,
1193
- disabled,
1194
- disableTracking,
1195
- shouldKeepSize,
1196
- withoutStyle,
1197
- withoutMinimumSize,
1198
- className,
1199
- emptyClassName,
1200
- adClassName,
1201
- richAdClassName,
1202
- richAdIframeClassName,
1203
- onRender,
1204
- onDestroy,
1205
- onRichAd,
1206
- slotRef
1169
+ slot: slotName = null,
1170
+ path: providedPath = null,
1171
+ size: providedSize = null,
1172
+ sizeMapping: providedSizeMapping = null,
1173
+ viewport: providedViewport = null,
1174
+ targeting: providedTargeting = null,
1175
+ refreshInterval: providedRefreshInterval = null,
1176
+ alwaysRender = true,
1177
+ disabled: providedDisabled = false,
1178
+ disableTracking = false,
1179
+ shouldKeepSize = false,
1180
+ withoutStyle = false,
1181
+ withoutMinimumSize = false,
1182
+ className = null,
1183
+ emptyClassName = null,
1184
+ adClassName = null,
1185
+ richAdClassName = null,
1186
+ richAdIframeClassName = null,
1187
+ onRender = null,
1188
+ onDestroy = null,
1189
+ onRichAd = null,
1190
+ slotRef = null
1207
1191
  } = _ref;
1208
1192
  const {
1209
1193
  slots = null,
1210
- slotsPath = {}
1194
+ slotsPath = null,
1195
+ viewport: contextViewport = null
1211
1196
  } = useAdsContext();
1197
+ const {
1198
+ default: defaultSlotPath = null
1199
+ } = slotsPath || {};
1212
1200
  const slot = slotName !== null && slots !== null ? slots[slotName] || null : null;
1213
- const finalPath = path || (slot !== null ? slot.path || null : null) || (slotName !== null ? slotsPath[slotName] : null) || slotsPath.default || null;
1214
- const finalSize = size || (slot !== null ? slot.size || null : null);
1215
- const finalSizeMapping = sizeMapping || (slot !== null ? slot.sizeMapping || null : null);
1216
- const minimumSize = useMemo(() => getMinimumAdSize(finalSizeMapping !== null ? finalSizeMapping.reduce((allSizes, sizeMap) => [...allSizes, sizeMap[1]], [finalSize]) : finalSize), [finalSizeMapping, finalSize]);
1201
+ const {
1202
+ sizeMapping: slotSizeMapping = null,
1203
+ size: slotSize = null,
1204
+ path: slotPath = null
1205
+ } = slot || {};
1206
+ const path = providedPath || slotPath || (slotName !== null && slotsPath !== null ? slotsPath[slotName] : null) || defaultSlotPath || null;
1207
+
1208
+ // Size
1209
+ const size = providedSize || slotSize;
1210
+ const sizeMapping = providedSizeMapping || slotSizeMapping;
1211
+ const minimumSize = useMemo(() => getMinimumAdSize(sizeMapping !== null ? sizeMapping.reduce((allSizes, sizeMap) => [...allSizes, sizeMap[1]], [size]) : [size]), [sizeMapping, size]);
1217
1212
 
1218
1213
  // Targeting
1219
1214
  const contextTargeting = useAdsTargeting();
1220
1215
  const {
1221
- disabled: targetingDisabled = false
1222
- } = contextTargeting || {};
1223
- const finalDisabled = disabled || targetingDisabled;
1224
- const allTargeting = useMemo(() => {
1225
- const {
1226
- disabled: removedDisabled,
1227
- ...otherTargeting
1228
- } = contextTargeting || {};
1229
- return {
1216
+ targeting,
1217
+ refreshInterval,
1218
+ disabled,
1219
+ viewport
1220
+ } = useMemo(() => {
1221
+ const allTargeting = {
1230
1222
  ...(slotName !== null ? {
1231
1223
  slot: slotName
1232
1224
  } : null),
1233
- ...otherTargeting,
1234
- ...targeting
1225
+ ...contextTargeting,
1226
+ ...providedTargeting
1235
1227
  };
1236
- }, [contextTargeting, targeting, slotName]);
1237
- const finalAdTargeting = useMemo(() => {
1238
1228
  const {
1239
1229
  refreshAds = null,
1230
+ disabled: targetingDisabled = false,
1231
+ viewport: targetingViewport = null,
1240
1232
  ...otherProps
1241
1233
  } = allTargeting || {};
1242
1234
  return {
1243
- refreshInterval: refreshAds !== null && refreshAds === 'inactive' ? null : refreshInterval,
1235
+ refreshInterval: refreshAds !== null && refreshAds === 'inactive' ? null : providedRefreshInterval,
1236
+ disabled: providedDisabled || targetingDisabled,
1237
+ viewport: providedViewport || contextViewport || targetingViewport,
1244
1238
  targeting: otherProps || {}
1245
1239
  };
1246
- }, [allTargeting, refreshInterval]);
1240
+ }, [contextTargeting, providedTargeting, slotName, providedRefreshInterval]);
1247
1241
  const lastRenderedSize = useRef(null);
1248
- const wasDisabled = useRef(finalDisabled);
1242
+ const wasDisabled = useRef(disabled);
1243
+ useEffect(() => {}, []);
1249
1244
  const onAdRender = useCallback(event => {
1250
1245
  const {
1251
1246
  isEmpty: newIsEmpty = true,
1252
1247
  width: newWidth,
1253
1248
  height: newHeight
1254
1249
  } = event || {};
1255
- if (finalDisabled) {
1250
+ if (disabled) {
1256
1251
  wasDisabled.current = true;
1257
- } else if (!finalDisabled && !newIsEmpty) {
1252
+ } else if (!disabled && !newIsEmpty) {
1258
1253
  wasDisabled.current = false;
1259
1254
  }
1260
1255
  lastRenderedSize.current = !newIsEmpty ? {
@@ -1264,7 +1259,7 @@ function Ad(_ref) {
1264
1259
  if (onRender !== null) {
1265
1260
  onRender(event);
1266
1261
  }
1267
- }, [onRender, shouldKeepSize, finalDisabled]);
1262
+ }, [onRender, shouldKeepSize, disabled]);
1268
1263
 
1269
1264
  // useEffect(() => {
1270
1265
  // if (!disabled) {
@@ -1290,14 +1285,15 @@ function Ad(_ref) {
1290
1285
  isRendered,
1291
1286
  refObserver,
1292
1287
  slot: slotObject = null
1293
- } = useAd(finalPath, finalSize, {
1294
- sizeMapping: finalSizeMapping,
1295
- targeting: finalAdTargeting.targeting,
1296
- refreshInterval: finalAdTargeting.refreshInterval,
1288
+ } = useAd(path, size, {
1289
+ viewport,
1290
+ sizeMapping,
1291
+ targeting,
1292
+ refreshInterval,
1297
1293
  alwaysRender,
1298
1294
  onRender: onAdRender,
1299
1295
  onDestroy,
1300
- disabled: finalDisabled,
1296
+ disabled,
1301
1297
  disableTracking
1302
1298
  });
1303
1299
  const adContainerRef = useRef(null);
@@ -1310,13 +1306,13 @@ function Ad(_ref) {
1310
1306
  // eslint-disable-next-line no-param-reassign
1311
1307
  slotRef.current = slotObject;
1312
1308
  }
1313
- if (finalDisabled) {
1309
+ if (disabled) {
1314
1310
  wasDisabled.current = true;
1315
- } else if (!finalDisabled && isRendered) {
1311
+ } else if (!disabled && isRendered) {
1316
1312
  wasDisabled.current = false;
1317
1313
  }
1318
1314
  const waitingNextRender = wasDisabled.current && !isRendered;
1319
- const keepSize = shouldKeepSize && (finalDisabled || waitingNextRender) && lastRenderedSize.current !== null;
1315
+ const keepSize = shouldKeepSize && (disabled || waitingNextRender) && lastRenderedSize.current !== null;
1320
1316
  if (id === null && !keepSize) {
1321
1317
  return null;
1322
1318
  }
@@ -1326,7 +1322,7 @@ function Ad(_ref) {
1326
1322
  width,
1327
1323
  height
1328
1324
  } : null;
1329
- } else if (shouldKeepSize && (finalDisabled || waitingNextRender)) {
1325
+ } else if (shouldKeepSize && (disabled || waitingNextRender)) {
1330
1326
  adStyle = lastRenderedSize.current;
1331
1327
  } else if (!withoutMinimumSize) {
1332
1328
  adStyle = minimumSize;
@@ -1375,6 +1371,5 @@ function Ad(_ref) {
1375
1371
  });
1376
1372
  }
1377
1373
  Ad.propTypes = propTypes;
1378
- Ad.defaultProps = defaultProps;
1379
1374
 
1380
- export { Ad, AdSlot, AdsManager, AdsProvider, AdsTargetingProvider, propTypes$4 as PropTypes, RichAd, buildSizeMappingFromSizes, buildSizeMappingFromViewports, getAdSizes, getMinimumAdSize, getSizeMappingFromSlot, getSortedViewports, sizeFitsInViewport, slots, useAd, useAdsContext, useAdsTargeting, useAdsTracking, useRichAd, viewports };
1375
+ export { Ad, AdSlot, AdsManager, AdsProvider, AdsTargetingProvider, propTypes$4 as PropTypes, RichAd, buildSizeMappingFromSizes, buildSizeMappingFromViewports, getAdSizes, getMinimumAdSize, getSizeFromSizeMapping, getSizeMappingFromSlot, getSortedViewports, sizeFitsInViewport, slots, useAd, useAdsContext, useAdsTargeting, useAdsTracking, useRichAd, viewports };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@folklore/ads",
3
- "version": "0.0.100",
3
+ "version": "0.0.101",
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": "5c8b1b42f8910f43372d7676fdbfcef1e85b39c3",
53
+ "gitHead": "4d23bd8673f61fcb67526866cf0366455f4f674a",
54
54
  "dependencies": {
55
55
  "@folklore/hooks": "^0.0.72",
56
56
  "@folklore/tracking": "^0.0.29",