@folklore/ads 0.0.21 → 0.0.23
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 +12 -4
- package/dist/es.js +12 -4
- package/package.json +3 -3
package/dist/cjs.js
CHANGED
|
@@ -733,20 +733,28 @@ const useAdsTargeting = () => React.useContext(AdsTargetingContext);
|
|
|
733
733
|
const propTypes$1 = {
|
|
734
734
|
children: PropTypes__default["default"].node.isRequired,
|
|
735
735
|
// eslint-disable-next-line react/forbid-prop-types
|
|
736
|
-
targeting: PropTypes__default["default"].object
|
|
736
|
+
targeting: PropTypes__default["default"].object,
|
|
737
|
+
replace: PropTypes__default["default"].bool
|
|
737
738
|
};
|
|
738
739
|
const defaultProps$1 = {
|
|
739
740
|
targeting: {
|
|
740
741
|
domain: typeof window !== 'undefined' ? `${window.location.protocol}//${window.location.host}` : null
|
|
741
|
-
}
|
|
742
|
+
},
|
|
743
|
+
replace: false
|
|
742
744
|
};
|
|
743
745
|
function AdsTargetingProvider(_ref) {
|
|
744
746
|
let {
|
|
745
747
|
children,
|
|
746
|
-
targeting
|
|
748
|
+
targeting,
|
|
749
|
+
replace
|
|
747
750
|
} = _ref;
|
|
751
|
+
const previousTargeting = useAdsTargeting();
|
|
752
|
+
const mergedTargeting = React.useMemo(() => replace ? targeting : {
|
|
753
|
+
...previousTargeting,
|
|
754
|
+
...targeting
|
|
755
|
+
}, [replace, previousTargeting, targeting]);
|
|
748
756
|
return /*#__PURE__*/jsxRuntime.jsx(AdsTargetingContext.Provider, {
|
|
749
|
-
value:
|
|
757
|
+
value: mergedTargeting,
|
|
750
758
|
children: children
|
|
751
759
|
});
|
|
752
760
|
}
|
package/dist/es.js
CHANGED
|
@@ -715,20 +715,28 @@ const useAdsTargeting = () => useContext(AdsTargetingContext);
|
|
|
715
715
|
const propTypes$1 = {
|
|
716
716
|
children: PropTypes.node.isRequired,
|
|
717
717
|
// eslint-disable-next-line react/forbid-prop-types
|
|
718
|
-
targeting: PropTypes.object
|
|
718
|
+
targeting: PropTypes.object,
|
|
719
|
+
replace: PropTypes.bool
|
|
719
720
|
};
|
|
720
721
|
const defaultProps$1 = {
|
|
721
722
|
targeting: {
|
|
722
723
|
domain: typeof window !== 'undefined' ? `${window.location.protocol}//${window.location.host}` : null
|
|
723
|
-
}
|
|
724
|
+
},
|
|
725
|
+
replace: false
|
|
724
726
|
};
|
|
725
727
|
function AdsTargetingProvider(_ref) {
|
|
726
728
|
let {
|
|
727
729
|
children,
|
|
728
|
-
targeting
|
|
730
|
+
targeting,
|
|
731
|
+
replace
|
|
729
732
|
} = _ref;
|
|
733
|
+
const previousTargeting = useAdsTargeting();
|
|
734
|
+
const mergedTargeting = useMemo(() => replace ? targeting : {
|
|
735
|
+
...previousTargeting,
|
|
736
|
+
...targeting
|
|
737
|
+
}, [replace, previousTargeting, targeting]);
|
|
730
738
|
return /*#__PURE__*/jsx(AdsTargetingContext.Provider, {
|
|
731
|
-
value:
|
|
739
|
+
value: mergedTargeting,
|
|
732
740
|
children: children
|
|
733
741
|
});
|
|
734
742
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@folklore/ads",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "Ads library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "72c8c36208e3f4adb397321866cf9a8e606cf130",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@folklore/hooks": "^0.0.
|
|
55
|
+
"@folklore/hooks": "^0.0.43",
|
|
56
56
|
"@folklore/tracking": "^0.0.16",
|
|
57
57
|
"classnames": "^2.5.1",
|
|
58
58
|
"debug": "^4.3.4",
|