@blaze-cms/react-page-builder 0.134.0-core-styles.2 → 0.134.0
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/CHANGELOG.md +3 -10
- package/lib/components/Banner/AdSlotRender.js +3 -12
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js +7 -4
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js +1 -5
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +2 -3
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +0 -2
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/Banner/AdSlotRender.js +3 -12
- package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
- package/lib-es/components/Banner/Banner.js +7 -4
- package/lib-es/components/Banner/Banner.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js +2 -6
- package/lib-es/components/Banner/BannerRender.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +2 -3
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +1 -2
- package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/package.json +10 -10
- package/src/components/Banner/AdSlotRender.js +5 -9
- package/src/components/Banner/Banner.js +11 -9
- package/src/components/Banner/BannerRender.js +0 -4
- package/src/components/DataSummary/helpers/build-loop-props-content.js +2 -3
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +1 -4
- package/tests/unit/src/components/Banner/AdSlotRender.test.js +11 -6
- package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +25 -45
- package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +3 -8
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +0 -41
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +0 -21
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +0 -72
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +0 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [0.134.0
|
|
6
|
+
# [0.134.0](https://github.com/thebyte9/blaze/compare/v0.134.0-alpha.0...v0.134.0) (2023-10-31)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
9
9
|
|
|
@@ -11,16 +11,9 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
# [0.134.0-
|
|
14
|
+
# [0.134.0-alpha.0](https://github.com/thebyte9/blaze/compare/v0.133.0...v0.134.0-alpha.0) (2023-10-23)
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
### Bug Fixes
|
|
18
|
-
|
|
19
|
-
* fix typo ([3c87c7f](https://github.com/thebyte9/blaze/commit/3c87c7f50b0c184fc369a3efbac0584fb0af6c09))
|
|
20
|
-
* handle data summary urls in loops correctly ([#3993](https://github.com/thebyte9/blaze/issues/3993)) ([008e1a1](https://github.com/thebyte9/blaze/commit/008e1a1f24f065b4060302c2c32d1aa32dd8a007))
|
|
21
|
-
* unwanted space when banner not served ([fb35848](https://github.com/thebyte9/blaze/commit/fb35848b7f91c9c063833d30b37e44996b2a4a56))
|
|
22
|
-
* update ad slot render test ([dc9655f](https://github.com/thebyte9/blaze/commit/dc9655f2a2f9b9b5f5e98c77382561d3c4c4088d))
|
|
23
|
-
* update ad slot render test ([2d12523](https://github.com/thebyte9/blaze/commit/2d12523f79245208e8919b7d90fa6d4294f396da))
|
|
16
|
+
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
24
17
|
|
|
25
18
|
|
|
26
19
|
|
|
@@ -23,7 +23,6 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
23
23
|
var _reactDfp = require("react-dfp");
|
|
24
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
25
|
var _constants = require("../../constants");
|
|
26
|
-
var _Wrapper = _interopRequireDefault(require("../Wrapper"));
|
|
27
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
28
|
var AdSlotRender = function AdSlotRender(_ref) {
|
|
@@ -32,7 +31,6 @@ var AdSlotRender = function AdSlotRender(_ref) {
|
|
|
32
31
|
sizeId = _ref.sizeId,
|
|
33
32
|
parsedAdunit = _ref.parsedAdunit,
|
|
34
33
|
parsedSizes = _ref.parsedSizes,
|
|
35
|
-
modifiers = _ref.modifiers,
|
|
36
34
|
targetingArguments = _ref.targetingArguments;
|
|
37
35
|
var _useState = (0, _react.useState)({}),
|
|
38
36
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
@@ -54,16 +52,11 @@ var AdSlotRender = function AdSlotRender(_ref) {
|
|
|
54
52
|
return "@media(min-width:".concat(minWidth, "px){.").concat(bannerClass, "{min-height:").concat(minimumHeight, "px;}");
|
|
55
53
|
}).sort();
|
|
56
54
|
var className = "ad-slot ad-slot-".concat(loadingStatus, " ").concat(bannerClass);
|
|
57
|
-
|
|
58
|
-
return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], {
|
|
59
|
-
className: "banner",
|
|
60
|
-
modifiers: newModifers
|
|
61
|
-
}, styles && /*#__PURE__*/_react["default"].createElement("style", null, styles.join('\n')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
55
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, styles && /*#__PURE__*/_react["default"].createElement("style", null, styles.join('\n')), /*#__PURE__*/_react["default"].createElement("div", {
|
|
62
56
|
className: className,
|
|
63
57
|
style: {
|
|
64
58
|
minHeight: minHeight
|
|
65
|
-
}
|
|
66
|
-
"data-testid": "ad-slot"
|
|
59
|
+
}
|
|
67
60
|
}, shouldShowBanner && /*#__PURE__*/_react["default"].createElement(_reactDfp.AdSlot, {
|
|
68
61
|
adUnit: parsedAdunit,
|
|
69
62
|
sizes: parsedSizes,
|
|
@@ -88,12 +81,10 @@ AdSlotRender.propTypes = {
|
|
|
88
81
|
sizeId: _propTypes["default"].string.isRequired,
|
|
89
82
|
parsedAdunit: _propTypes["default"].string.isRequired,
|
|
90
83
|
parsedSizes: _propTypes["default"].array,
|
|
91
|
-
modifiers: _propTypes["default"].string,
|
|
92
84
|
targetingArguments: _propTypes["default"].object.isRequired
|
|
93
85
|
};
|
|
94
86
|
AdSlotRender.defaultProps = {
|
|
95
|
-
parsedSizes: null
|
|
96
|
-
modifiers: ''
|
|
87
|
+
parsedSizes: null
|
|
97
88
|
};
|
|
98
89
|
var _default = AdSlotRender;
|
|
99
90
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdSlotRender.js","names":["_react","_interopRequireWildcard","require","_reactDfp","_propTypes","_interopRequireDefault","_constants","
|
|
1
|
+
{"version":3,"file":"AdSlotRender.js","names":["_react","_interopRequireWildcard","require","_reactDfp","_propTypes","_interopRequireDefault","_constants","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AdSlotRender","_ref","shouldShowBanner","sizeMapping","sizeId","parsedAdunit","parsedSizes","targetingArguments","_useState","useState","_useState2","_slicedToArray2","_useState2$","_useState2$$loadingSt","loadingStatus","BANNER_LOADING","minHeight","setLoadingStatus","bannerClass","concat","styles","map","_ref2","styleSizes","sizes","_ref2$viewport","viewport","minWidth","minimumHeight","Math","min","apply","_toConsumableArray2","_ref3","_ref4","height","sort","className","createElement","Fragment","join","style","AdSlot","adUnit","onSlotRender","slotData","_slotData$event","event","isEmpty","size","slotHeight","length","undefined","newLoadingStatus","BANNER_EMPTY","BANNER_LOADED","propTypes","PropTypes","bool","isRequired","array","string","object","defaultProps","_default","exports"],"sources":["../../../src/components/Banner/AdSlotRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport { AdSlot } from 'react-dfp';\nimport PropTypes from 'prop-types';\nimport { BANNER_LOADING, BANNER_EMPTY, BANNER_LOADED } from '../../constants';\n\nconst AdSlotRender = ({\n shouldShowBanner,\n sizeMapping,\n sizeId,\n parsedAdunit,\n parsedSizes,\n targetingArguments\n}) => {\n const [{ loadingStatus = BANNER_LOADING, minHeight }, setLoadingStatus] = useState({});\n\n const bannerClass = `banner-${sizeId}`;\n\n const styles =\n loadingStatus === BANNER_LOADING &&\n sizeMapping\n .map(({ sizes: styleSizes, viewport: [minWidth] }) => {\n const minimumHeight = Math.min(...styleSizes.map(([, height]) => height));\n return `@media(min-width:${minWidth}px){.${bannerClass}{min-height:${minimumHeight}px;}`;\n })\n .sort();\n const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;\n\n return (\n <>\n {styles && <style>{styles.join('\\n')}</style>}\n <div className={className} style={{ minHeight }}>\n {shouldShowBanner && (\n <AdSlot\n adUnit={parsedAdunit}\n sizes={parsedSizes}\n targetingArguments={targetingArguments}\n sizeMapping={sizeMapping}\n onSlotRender={slotData => {\n const {\n event: { isEmpty, size }\n } = slotData;\n const slotHeight = size && size.length ? size[1] : undefined;\n const newLoadingStatus = isEmpty ? BANNER_EMPTY : BANNER_LOADED;\n setLoadingStatus({ loadingStatus: newLoadingStatus, minHeight: slotHeight });\n }}\n />\n )}\n </div>\n </>\n );\n};\n\nAdSlotRender.propTypes = {\n shouldShowBanner: PropTypes.bool.isRequired,\n sizeMapping: PropTypes.array.isRequired,\n sizeId: PropTypes.string.isRequired,\n parsedAdunit: PropTypes.string.isRequired,\n parsedSizes: PropTypes.array,\n targetingArguments: PropTypes.object.isRequired\n};\n\nAdSlotRender.defaultProps = {\n parsedSizes: null\n};\n\nexport default AdSlotRender;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAA8E,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAP,wBAAAW,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,G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AK,EAAElB,WAAY;IACnBC,kBAAkB,EAAEA,kBAAmB;IACvCJ,WAAW,EAAEA,WAAY;IACzByC,YAAY,EAAE,SAAAA,aAAAC,QAAQ,EAAI;MACxB,IAAAC,eAAA,GAEID,QAAQ,CADVE,KAAK;QAAIC,OAAO,GAAAF,eAAA,CAAPE,OAAO;QAAEC,IAAI,GAAAH,eAAA,CAAJG,IAAI;MAExB,IAAMC,UAAU,GAAGD,IAAI,IAAIA,IAAI,CAACE,MAAM,GAAGF,IAAI,CAAC,CAAC,CAAC,GAAGG,SAAS;MAC5D,IAAMC,gBAAgB,GAAGL,OAAO,GAAGM,uBAAY,GAAGC,wBAAa;MAC/DtC,gBAAgB,CAAC;QAAEH,aAAa,EAAEuC,gBAAgB;QAAErC,SAAS,EAAEkC;MAAW,CAAC,CAAC;IAC9E;EAAE,CACH,CAEA,CACL,CAAC;AAEP,CAAC;AAEDlD,YAAY,CAACwD,SAAS,GAAG;EACvBtD,gBAAgB,EAAEuD,qBAAS,CAACC,IAAI,CAACC,UAAU;EAC3CxD,WAAW,EAAEsD,qBAAS,CAACG,KAAK,CAACD,UAAU;EACvCvD,MAAM,EAAEqD,qBAAS,CAACI,MAAM,CAACF,UAAU;EACnCtD,YAAY,EAAEoD,qBAAS,CAACI,MAAM,CAACF,UAAU;EACzCrD,WAAW,EAAEmD,qBAAS,CAACG,KAAK;EAC5BrD,kBAAkB,EAAEkD,qBAAS,CAACK,MAAM,CAACH;AACvC,CAAC;AAED3D,YAAY,CAAC+D,YAAY,GAAG;EAC1BzD,WAAW,EAAE;AACf,CAAC;AAAC,IAAA0D,QAAA,GAEahE,YAAY;AAAAiE,OAAA,cAAAD,QAAA"}
|
|
@@ -26,6 +26,7 @@ var _client = require("@apollo/client");
|
|
|
26
26
|
var _router = require("next/router");
|
|
27
27
|
var _helpers = require("./helpers");
|
|
28
28
|
var _query = require("../../application/query");
|
|
29
|
+
var _Wrapper = _interopRequireDefault(require("../Wrapper"));
|
|
29
30
|
var _BannerRender = _interopRequireDefault(require("./BannerRender"));
|
|
30
31
|
var _buildPropsQuery = _interopRequireDefault(require("../../helpers/build-props-query"));
|
|
31
32
|
var _utils = require("../../utils");
|
|
@@ -83,15 +84,17 @@ var Banner = function Banner(_ref) {
|
|
|
83
84
|
actionKey = _getEntityRenderProps.actionKey,
|
|
84
85
|
action = _getEntityRenderProps.action;
|
|
85
86
|
var bannerKey = "".concat(sizeId).concat(asPath);
|
|
86
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
87
|
+
return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], {
|
|
88
|
+
className: type,
|
|
89
|
+
modifiers: modifiers
|
|
90
|
+
}, /*#__PURE__*/_react["default"].createElement(_BannerRender["default"], (0, _extends2["default"])({
|
|
87
91
|
key: bannerKey
|
|
88
92
|
}, otherProps, {
|
|
89
93
|
action: action,
|
|
90
94
|
actionKey: actionKey,
|
|
91
95
|
asPath: asPath,
|
|
92
|
-
userPropsData: userPropsData
|
|
93
|
-
|
|
94
|
-
}));
|
|
96
|
+
userPropsData: userPropsData
|
|
97
|
+
})));
|
|
95
98
|
};
|
|
96
99
|
Banner.propTypes = {
|
|
97
100
|
type: _propTypes["default"].string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","names":["_react","_interopRequireWildcard","require","_nextjsComponents","_coreAuthUi","_propTypes","_interopRequireDefault","_lodash","_client","_router","_helpers","_query","_BannerRender","_buildPropsQuery","_utils","_getEntityRenderProps2","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Banner","_ref","type","otherProps","_objectWithoutProperties2","router","useRouter","_useContext","useContext","MainContext","isPreview","_checkIfLoggedIn","checkIfLoggedIn","userId","id","asPath","parent","entity","sizeId","_otherProps$propsToDi","propsToDisplay","_otherProps$userProps","userPropsToDisplay","userQuery","buildUserQuery","itemEntity","_useQuery","useQuery","getSingleEntitySchema","variables","data","error","loading","_useQuery2","getUser","skip","length","_useQuery2$data","_useQuery2$data2","userData","userLoading","message","modifiers","getClassModifiers","queryProps","buildPropsQuery","flatten","map","_ref2","propertiesToDisplay","userPropsData","buildPropsData","_getEntityRenderProps","getEntityRenderProps","actionKey","action","bannerKey","concat","createElement","_extends2","propTypes","PropTypes","string","defaultProps","_default","exports"],"sources":["../../../src/components/Banner/Banner.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport PropTypes from 'prop-types';\nimport flatten from 'lodash.flatten';\nimport { useQuery } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { buildUserQuery, buildPropsData } from './helpers';\nimport { getSingleEntitySchema, getUser } from '../../application/query';\nimport BannerRender from './BannerRender';\nimport buildPropsQuery from '../../helpers/build-props-query';\nimport { getClassModifiers } from '../../utils';\nimport getEntityRenderProps from '../../helpers/get-entity-render-props';\n\nconst Banner = ({ type, ...otherProps }) => {\n const router = useRouter();\n const { isPreview } = useContext(MainContext);\n const { id: userId } = checkIfLoggedIn();\n const { asPath } = router;\n const { parent, entity, sizeId, propsToDisplay = [], userPropsToDisplay = [] } = otherProps;\n const userQuery = buildUserQuery(userPropsToDisplay);\n const { itemEntity } = parent;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity || itemEntity }\n });\n const { data: { getUser: userData } = {}, loading: userLoading } = useQuery(getUser(userQuery), {\n variables: { id: userId },\n skip: !userPropsToDisplay.length || !userId\n });\n\n if (loading || userLoading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!sizeId) return null;\n\n const modifiers = getClassModifiers('banner', otherProps);\n const queryProps = buildPropsQuery(\n data,\n propsToDisplay.length\n ? flatten(propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay))\n : []\n );\n\n const userPropsData = buildPropsData(userData, userPropsToDisplay);\n const { actionKey, action } = getEntityRenderProps(queryProps, data, isPreview);\n const bannerKey = `${sizeId}${asPath}`;\n\n return (\n <BannerRender\n
|
|
1
|
+
{"version":3,"file":"Banner.js","names":["_react","_interopRequireWildcard","require","_nextjsComponents","_coreAuthUi","_propTypes","_interopRequireDefault","_lodash","_client","_router","_helpers","_query","_Wrapper","_BannerRender","_buildPropsQuery","_utils","_getEntityRenderProps2","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","Banner","_ref","type","otherProps","_objectWithoutProperties2","router","useRouter","_useContext","useContext","MainContext","isPreview","_checkIfLoggedIn","checkIfLoggedIn","userId","id","asPath","parent","entity","sizeId","_otherProps$propsToDi","propsToDisplay","_otherProps$userProps","userPropsToDisplay","userQuery","buildUserQuery","itemEntity","_useQuery","useQuery","getSingleEntitySchema","variables","data","error","loading","_useQuery2","getUser","skip","length","_useQuery2$data","_useQuery2$data2","userData","userLoading","message","modifiers","getClassModifiers","queryProps","buildPropsQuery","flatten","map","_ref2","propertiesToDisplay","userPropsData","buildPropsData","_getEntityRenderProps","getEntityRenderProps","actionKey","action","bannerKey","concat","createElement","className","_extends2","propTypes","PropTypes","string","defaultProps","_default","exports"],"sources":["../../../src/components/Banner/Banner.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport PropTypes from 'prop-types';\nimport flatten from 'lodash.flatten';\nimport { useQuery } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { buildUserQuery, buildPropsData } from './helpers';\nimport { getSingleEntitySchema, getUser } from '../../application/query';\nimport Wrapper from '../Wrapper';\nimport BannerRender from './BannerRender';\nimport buildPropsQuery from '../../helpers/build-props-query';\nimport { getClassModifiers } from '../../utils';\nimport getEntityRenderProps from '../../helpers/get-entity-render-props';\n\nconst Banner = ({ type, ...otherProps }) => {\n const router = useRouter();\n const { isPreview } = useContext(MainContext);\n const { id: userId } = checkIfLoggedIn();\n const { asPath } = router;\n const { parent, entity, sizeId, propsToDisplay = [], userPropsToDisplay = [] } = otherProps;\n const userQuery = buildUserQuery(userPropsToDisplay);\n const { itemEntity } = parent;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity || itemEntity }\n });\n const { data: { getUser: userData } = {}, loading: userLoading } = useQuery(getUser(userQuery), {\n variables: { id: userId },\n skip: !userPropsToDisplay.length || !userId\n });\n\n if (loading || userLoading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!sizeId) return null;\n\n const modifiers = getClassModifiers('banner', otherProps);\n const queryProps = buildPropsQuery(\n data,\n propsToDisplay.length\n ? flatten(propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay))\n : []\n );\n\n const userPropsData = buildPropsData(userData, userPropsToDisplay);\n const { actionKey, action } = getEntityRenderProps(queryProps, data, isPreview);\n const bannerKey = `${sizeId}${asPath}`;\n\n return (\n <Wrapper className={type} modifiers={modifiers}>\n <BannerRender\n key={bannerKey}\n {...otherProps}\n action={action}\n actionKey={actionKey}\n asPath={asPath}\n userPropsData={userPropsData}\n />\n </Wrapper>\n );\n};\n\nBanner.propTypes = {\n type: PropTypes.string\n};\n\nBanner.defaultProps = {\n type: 'banner'\n};\n\nexport default Banner;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,O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MAAM,GAAAH,qBAAA,CAANG,MAAM;EACzB,IAAMC,SAAS,MAAAC,MAAA,CAAMvC,MAAM,EAAAuC,MAAA,CAAG1C,MAAM,CAAE;EAEtC,oBACEvD,MAAA,YAAAkG,aAAA,CAACtF,QAAA,WAAO;IAACuF,SAAS,EAAEzD,IAAK;IAACwC,SAAS,EAAEA;EAAU,gBAC7ClF,MAAA,YAAAkG,aAAA,CAACrF,aAAA,WAAY,MAAAuF,SAAA;IACXlE,GAAG,EAAE8D;EAAU,GACXrD,UAAU;IACdoD,MAAM,EAAEA,MAAO;IACfD,SAAS,EAAEA,SAAU;IACrBvC,MAAM,EAAEA,MAAO;IACfmC,aAAa,EAAEA;EAAc,EAC9B,CACM,CAAC;AAEd,CAAC;AAEDlD,MAAM,CAAC6D,SAAS,GAAG;EACjB3D,IAAI,EAAE4D,qBAAS,CAACC;AAClB,CAAC;AAED/D,MAAM,CAACgE,YAAY,GAAG;EACpB9D,IAAI,EAAE;AACR,CAAC;AAAC,IAAA+D,QAAA,GAEajE,MAAM;AAAAkE,OAAA,cAAAD,QAAA"}
|
|
@@ -25,7 +25,7 @@ var _helpers = require("./helpers");
|
|
|
25
25
|
var _constants = require("../../constants");
|
|
26
26
|
var _HOC = require("../../HOC");
|
|
27
27
|
var _AdSlotRender = _interopRequireDefault(require("./AdSlotRender"));
|
|
28
|
-
var _excluded = ["baseAdunit", "adunit", "sizeId", "sizes", "propsToDisplay", "entity", "targetings", "parent", "asPath", "action", "actionKey", "renderCounter", "userPropsData"
|
|
28
|
+
var _excluded = ["baseAdunit", "adunit", "sizeId", "sizes", "propsToDisplay", "entity", "targetings", "parent", "asPath", "action", "actionKey", "renderCounter", "userPropsData"];
|
|
29
29
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
30
30
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
31
31
|
var BannerRender = function BannerRender(_ref) {
|
|
@@ -42,7 +42,6 @@ var BannerRender = function BannerRender(_ref) {
|
|
|
42
42
|
actionKey = _ref.actionKey,
|
|
43
43
|
renderCounter = _ref.renderCounter,
|
|
44
44
|
userPropsData = _ref.userPropsData,
|
|
45
|
-
modifiers = _ref.modifiers,
|
|
46
45
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
47
46
|
var id = otherProps.id;
|
|
48
47
|
var itemId = parent.itemId;
|
|
@@ -95,7 +94,6 @@ var BannerRender = function BannerRender(_ref) {
|
|
|
95
94
|
sizeId: sizeId,
|
|
96
95
|
parsedAdunit: parsedAdunit,
|
|
97
96
|
parsedSizes: parsedSizes,
|
|
98
|
-
modifiers: modifiers,
|
|
99
97
|
targetingArguments: targetingArguments
|
|
100
98
|
});
|
|
101
99
|
};
|
|
@@ -112,7 +110,6 @@ BannerRender.propTypes = {
|
|
|
112
110
|
targetings: _propTypes["default"].string,
|
|
113
111
|
sizes: _propTypes["default"].string,
|
|
114
112
|
renderCounter: _propTypes["default"].number,
|
|
115
|
-
modifiers: _propTypes["default"].string,
|
|
116
113
|
userPropsData: _propTypes["default"].object
|
|
117
114
|
};
|
|
118
115
|
BannerRender.defaultProps = {
|
|
@@ -124,7 +121,6 @@ BannerRender.defaultProps = {
|
|
|
124
121
|
targetings: '',
|
|
125
122
|
sizes: '',
|
|
126
123
|
renderCounter: null,
|
|
127
|
-
modifiers: '',
|
|
128
124
|
userPropsData: {}
|
|
129
125
|
};
|
|
130
126
|
var _default = (0, _HOC.withTitle)(BannerRender);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerRender.js","names":["_react","_interopRequireDefault","require","_propTypes","_client","_query","_helpers","_constants","_HOC","_AdSlotRender","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","BannerRender","_ref","baseAdunit","adunit","sizeId","sizes","propsToDisplay","entity","targetings","parent","asPath","action","actionKey","renderCounter","userPropsData","
|
|
1
|
+
{"version":3,"file":"BannerRender.js","names":["_react","_interopRequireDefault","require","_propTypes","_client","_query","_helpers","_constants","_HOC","_AdSlotRender","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","BannerRender","_ref","baseAdunit","adunit","sizeId","sizes","propsToDisplay","entity","targetings","parent","asPath","action","actionKey","renderCounter","userPropsData","otherProps","_objectWithoutProperties2","id","itemId","_useQuery","useQuery","variables","where","skip","_useQuery$data","data","entityRecordData","_useQuery2","generateSingleItemQuery","GET_BANNER","BANNER_QUERY_PROPS","_useQuery2$data","bannerData","_useQuery3","getCount","COUNT_CONTENT_HIERARCHIES","parentId","childEntity","_ilike","concat","PUBLISHED","_useQuery3$data","parsedTargetings","buildContextualTargeting","entityData","_ref2","bannerSizes","sizeMapping","buildSizeMapping","parsedSizes","buildBannerSizes","countContentHierarchies","parsedAdunit","buildParsedAdunit","isContextualTargetingSet","isContextualTargetingReady","shouldShowBanner","customTargetings","setCustomTargetings","targetingArguments","createElement","propTypes","PropTypes","object","isRequired","string","array","number","defaultProps","_default","withTitle","exports"],"sources":["../../../src/components/Banner/BannerRender.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { useQuery } from '@apollo/client';\n\nimport { generateSingleItemQuery, getCount } from '../../application/query';\nimport {\n buildBannerSizes,\n buildContextualTargeting,\n buildParsedAdunit,\n buildSizeMapping,\n setCustomTargetings\n} from './helpers';\nimport {\n BANNER_QUERY_PROPS,\n COUNT_CONTENT_HIERARCHIES,\n GET_BANNER,\n PUBLISHED\n} from '../../constants';\nimport { withTitle } from '../../HOC';\nimport AdSlotRender from './AdSlotRender';\n\nconst BannerRender = ({\n baseAdunit,\n adunit,\n sizeId,\n sizes,\n propsToDisplay,\n entity,\n targetings,\n parent,\n asPath,\n action,\n actionKey,\n renderCounter,\n userPropsData,\n ...otherProps\n}) => {\n const { id } = otherProps;\n const { itemId } = parent;\n\n const { data: entityRecordData = {} } = useQuery(action, {\n variables: { where: { id: id || itemId } },\n skip: id && id !== itemId\n });\n\n const { data: bannerData = {} } = useQuery(\n generateSingleItemQuery(GET_BANNER, BANNER_QUERY_PROPS),\n {\n variables: { id: sizeId },\n skip: !sizeId\n }\n );\n\n const { data = {} } = useQuery(getCount(COUNT_CONTENT_HIERARCHIES), {\n variables: {\n where: {\n parentId: id || itemId,\n childEntity: {\n _ilike: `${PUBLISHED}_%`\n }\n }\n }\n });\n\n const parsedTargetings = buildContextualTargeting(actionKey, entityRecordData, propsToDisplay);\n const { entityData } = bannerData;\n const { sizes: bannerSizes } = entityData || {};\n\n const sizeMapping = buildSizeMapping(sizeId, bannerSizes);\n const parsedSizes = buildBannerSizes(sizeId, bannerSizes, sizes);\n\n const { countContentHierarchies } = data;\n\n const parsedAdunit = buildParsedAdunit(asPath, countContentHierarchies, baseAdunit, adunit);\n const isContextualTargetingSet =\n propsToDisplay.length && parsedTargetings && Object.keys(parsedTargetings).length;\n const isContextualTargetingReady = isContextualTargetingSet || !propsToDisplay.length;\n const shouldShowBanner =\n parsedAdunit && parsedSizes && !!parsedSizes.length && isContextualTargetingReady;\n\n const customTargetings = setCustomTargetings(targetings, renderCounter);\n\n const targetingArguments = { ...parsedTargetings, ...customTargetings, ...userPropsData };\n\n return (\n <AdSlotRender\n shouldShowBanner={!!shouldShowBanner}\n sizeMapping={sizeMapping}\n sizeId={sizeId}\n parsedAdunit={parsedAdunit}\n parsedSizes={parsedSizes}\n targetingArguments={targetingArguments}\n />\n );\n};\n\nBannerRender.propTypes = {\n parent: PropTypes.object.isRequired,\n asPath: PropTypes.string.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n adunit: PropTypes.string,\n baseAdunit: PropTypes.string,\n sizeId: PropTypes.string,\n propsToDisplay: PropTypes.array,\n entity: PropTypes.string,\n targetings: PropTypes.string,\n sizes: PropTypes.string,\n renderCounter: PropTypes.number,\n userPropsData: PropTypes.object\n};\n\nBannerRender.defaultProps = {\n adunit: '',\n baseAdunit: '',\n sizeId: '',\n propsToDisplay: [],\n entity: '',\n targetings: '',\n sizes: '',\n renderCounter: null,\n userPropsData: {}\n};\n\nexport default withTitle(BannerRender);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAOA,IAAAK,UAAA,GAAAL,OAAA;AAMA,IAAAM,IAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAR,sBAAA,CAAAC,OAAA;AAA0C,IAAAQ,SAAA;AAAA,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,U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ACxC,CAAC;AAEN,CAAC;AAED3D,YAAY,CAAC6D,SAAS,GAAG;EACvBpD,MAAM,EAAEqD,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCtD,MAAM,EAAEoD,qBAAS,CAACG,MAAM,CAACD,UAAU;EACnCrD,MAAM,EAAEmD,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCpD,SAAS,EAAEkD,qBAAS,CAACG,MAAM,CAACD,UAAU;EACtC7D,MAAM,EAAE2D,qBAAS,CAACG,MAAM;EACxB/D,UAAU,EAAE4D,qBAAS,CAACG,MAAM;EAC5B7D,MAAM,EAAE0D,qBAAS,CAACG,MAAM;EACxB3D,cAAc,EAAEwD,qBAAS,CAACI,KAAK;EAC/B3D,MAAM,EAAEuD,qBAAS,CAACG,MAAM;EACxBzD,UAAU,EAAEsD,qBAAS,CAACG,MAAM;EAC5B5D,KAAK,EAAEyD,qBAAS,CAACG,MAAM;EACvBpD,aAAa,EAAEiD,qBAAS,CAACK,MAAM;EAC/BrD,aAAa,EAAEgD,qBAAS,CAACC;AAC3B,CAAC;AAED/D,YAAY,CAACoE,YAAY,GAAG;EAC1BjE,MAAM,EAAE,EAAE;EACVD,UAAU,EAAE,EAAE;EACdE,MAAM,EAAE,EAAE;EACVE,cAAc,EAAE,EAAE;EAClBC,MAAM,EAAE,EAAE;EACVC,UAAU,EAAE,EAAE;EACdH,KAAK,EAAE,EAAE;EACTQ,aAAa,EAAE,IAAI;EACnBC,aAAa,EAAE,CAAC;AAClB,CAAC;AAAC,IAAAuD,QAAA,GAEa,IAAAC,cAAS,EAACtE,YAAY,CAAC;AAAAuE,OAAA,cAAAF,QAAA"}
|
|
@@ -63,11 +63,10 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
|
|
|
63
63
|
modifier = _options$modifier === void 0 ? '' : _options$modifier;
|
|
64
64
|
return propertiesToDisplay.map(function (key) {
|
|
65
65
|
var loopValue = loopValues[key];
|
|
66
|
-
var
|
|
67
|
-
var propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
66
|
+
var propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
68
67
|
if (!propValue) return null;
|
|
69
68
|
var processedValue = (0, _helpers.processDataSummaryValue)(propValue, options);
|
|
70
|
-
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data
|
|
69
|
+
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data);
|
|
71
70
|
return [(0, _lodash["default"])(label), processedValue, linkToPublishedContent, modifier];
|
|
72
71
|
});
|
|
73
72
|
})).filter(Boolean);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","propValue","processedValue","processDataSummaryValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,I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MC,cAAc,GAAG,IAAAC,gCAAuB,EAACF,SAAS,EAAE9B,OAAO,CAAC;QAClE,IAAMiC,sBAAsB,GAAG,IAAAC,qCAAyB,EAACN,GAAG,EAAEhC,IAAI,CAAC;QACnE,OAAO,CAAC,IAAAuC,kBAAU,EAACV,KAAK,CAAC,EAAEM,cAAc,EAAEE,sBAAsB,EAAEN,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACS,MAAM,CAACC,OAAO,CAAC;IACjBvB,oBAAoB,CAACwB,IAAI,CAAChB,UAAU,CAAC;EACvC,CAAC;EAjBD,KAAK,IAAID,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAS,EAAEG,CAAC,IAAI,CAAC;IAAAD,KAAA,CAAAC,CAAA;EAAA;EAmBrC,OAAO,IAAAE,mBAAO,EAACT,oBAAoB,CAAC;AACtC,CAAC;AAAC,IAAAyB,QAAA,GAEa9B,qBAAqB;AAAA+B,OAAA,cAAAD,QAAA"}
|
|
@@ -11,12 +11,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var getLinkToPublishedContent = function getLinkToPublishedContent() {
|
|
12
12
|
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
13
13
|
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
|
-
var currentValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
15
14
|
var _key$split = key.split('.'),
|
|
16
15
|
_key$split2 = (0, _slicedToArray2["default"])(_key$split, 1),
|
|
17
16
|
baseKey = _key$split2[0];
|
|
18
17
|
if (!props[baseKey]) return '';
|
|
19
|
-
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
20
18
|
var content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
21
19
|
return content && content.url ? content.url : '';
|
|
22
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","arguments","length","undefined","props","
|
|
1
|
+
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","arguments","length","undefined","props","_key$split","split","_key$split2","_slicedToArray2","baseKey","content","Array","isArray","url","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];\n return content && content.url ? content.url : '';\n};\n\nexport default getLinkToPublishedContent;\n"],"mappings":";;;;;;;;;;AAAA,IAAMA,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAA,EAA6B;EAAA,IAAzBC,GAAG,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,IAAEG,KAAK,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACrD,IAAAI,UAAA,GAAkBL,GAAG,CAACM,KAAK,CAAC,GAAG,CAAC;IAAAC,WAAA,OAAAC,eAAA,aAAAH,UAAA;IAAzBI,OAAO,GAAAF,WAAA;EACd,IAAI,CAACH,KAAK,CAACK,OAAO,CAAC,EAAE,OAAO,EAAE;EAC9B,IAAMC,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACR,KAAK,CAACK,OAAO,CAAC,CAAC,GAAGL,KAAK,CAACK,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGL,KAAK,CAACK,OAAO,CAAC;EAClF,OAAOC,OAAO,IAAIA,OAAO,CAACG,GAAG,GAAGH,OAAO,CAACG,GAAG,GAAG,EAAE;AAClD,CAAC;AAAC,IAAAC,QAAA,GAEaf,yBAAyB;AAAAgB,OAAA,cAAAD,QAAA"}
|
|
@@ -2,14 +2,12 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { AdSlot } from 'react-dfp';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { BANNER_LOADING, BANNER_EMPTY, BANNER_LOADED } from '../../constants';
|
|
5
|
-
import Wrapper from '../Wrapper';
|
|
6
5
|
const AdSlotRender = ({
|
|
7
6
|
shouldShowBanner,
|
|
8
7
|
sizeMapping,
|
|
9
8
|
sizeId,
|
|
10
9
|
parsedAdunit,
|
|
11
10
|
parsedSizes,
|
|
12
|
-
modifiers,
|
|
13
11
|
targetingArguments
|
|
14
12
|
}) => {
|
|
15
13
|
const [{
|
|
@@ -25,16 +23,11 @@ const AdSlotRender = ({
|
|
|
25
23
|
return `@media(min-width:${minWidth}px){.${bannerClass}{min-height:${minimumHeight}px;}`;
|
|
26
24
|
}).sort();
|
|
27
25
|
const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;
|
|
28
|
-
|
|
29
|
-
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
30
|
-
className: "banner",
|
|
31
|
-
modifiers: newModifers
|
|
32
|
-
}, styles && /*#__PURE__*/React.createElement("style", null, styles.join('\n')), /*#__PURE__*/React.createElement("div", {
|
|
26
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, styles && /*#__PURE__*/React.createElement("style", null, styles.join('\n')), /*#__PURE__*/React.createElement("div", {
|
|
33
27
|
className: className,
|
|
34
28
|
style: {
|
|
35
29
|
minHeight
|
|
36
|
-
}
|
|
37
|
-
"data-testid": "ad-slot"
|
|
30
|
+
}
|
|
38
31
|
}, shouldShowBanner && /*#__PURE__*/React.createElement(AdSlot, {
|
|
39
32
|
adUnit: parsedAdunit,
|
|
40
33
|
sizes: parsedSizes,
|
|
@@ -62,12 +55,10 @@ AdSlotRender.propTypes = {
|
|
|
62
55
|
sizeId: PropTypes.string.isRequired,
|
|
63
56
|
parsedAdunit: PropTypes.string.isRequired,
|
|
64
57
|
parsedSizes: PropTypes.array,
|
|
65
|
-
modifiers: PropTypes.string,
|
|
66
58
|
targetingArguments: PropTypes.object.isRequired
|
|
67
59
|
};
|
|
68
60
|
AdSlotRender.defaultProps = {
|
|
69
|
-
parsedSizes: null
|
|
70
|
-
modifiers: ''
|
|
61
|
+
parsedSizes: null
|
|
71
62
|
};
|
|
72
63
|
export default AdSlotRender;
|
|
73
64
|
//# sourceMappingURL=AdSlotRender.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AdSlotRender.js","names":["React","useState","AdSlot","PropTypes","BANNER_LOADING","BANNER_EMPTY","BANNER_LOADED","
|
|
1
|
+
{"version":3,"file":"AdSlotRender.js","names":["React","useState","AdSlot","PropTypes","BANNER_LOADING","BANNER_EMPTY","BANNER_LOADED","AdSlotRender","shouldShowBanner","sizeMapping","sizeId","parsedAdunit","parsedSizes","targetingArguments","loadingStatus","minHeight","setLoadingStatus","bannerClass","styles","map","sizes","styleSizes","viewport","minWidth","minimumHeight","Math","min","height","sort","className","createElement","Fragment","join","style","adUnit","onSlotRender","slotData","event","isEmpty","size","slotHeight","length","undefined","newLoadingStatus","propTypes","bool","isRequired","array","string","object","defaultProps"],"sources":["../../../src/components/Banner/AdSlotRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport { AdSlot } from 'react-dfp';\nimport PropTypes from 'prop-types';\nimport { BANNER_LOADING, BANNER_EMPTY, BANNER_LOADED } from '../../constants';\n\nconst AdSlotRender = ({\n shouldShowBanner,\n sizeMapping,\n sizeId,\n parsedAdunit,\n parsedSizes,\n targetingArguments\n}) => {\n const [{ loadingStatus = BANNER_LOADING, minHeight }, setLoadingStatus] = useState({});\n\n const bannerClass = `banner-${sizeId}`;\n\n const styles =\n loadingStatus === BANNER_LOADING &&\n sizeMapping\n .map(({ sizes: styleSizes, viewport: [minWidth] }) => {\n const minimumHeight = Math.min(...styleSizes.map(([, height]) => height));\n return `@media(min-width:${minWidth}px){.${bannerClass}{min-height:${minimumHeight}px;}`;\n })\n .sort();\n const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;\n\n return (\n <>\n {styles && <style>{styles.join('\\n')}</style>}\n <div className={className} style={{ minHeight }}>\n {shouldShowBanner && (\n <AdSlot\n adUnit={parsedAdunit}\n sizes={parsedSizes}\n targetingArguments={targetingArguments}\n sizeMapping={sizeMapping}\n onSlotRender={slotData => {\n const {\n event: { isEmpty, size }\n } = slotData;\n const slotHeight = size && size.length ? size[1] : undefined;\n const newLoadingStatus = isEmpty ? BANNER_EMPTY : BANNER_LOADED;\n setLoadingStatus({ loadingStatus: newLoadingStatus, minHeight: slotHeight });\n }}\n />\n )}\n </div>\n </>\n );\n};\n\nAdSlotRender.propTypes = {\n shouldShowBanner: PropTypes.bool.isRequired,\n sizeMapping: PropTypes.array.isRequired,\n sizeId: PropTypes.string.isRequired,\n parsedAdunit: PropTypes.string.isRequired,\n parsedSizes: PropTypes.array,\n targetingArguments: PropTypes.object.isRequired\n};\n\nAdSlotRender.defaultProps = {\n parsedSizes: null\n};\n\nexport default AdSlotRender;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,cAAc,EAAEC,YAAY,EAAEC,aAAa,QAAQ,iBAAiB;AAE7E,MAAMC,YAAY,GAAGA,CAAC;EACpBC,gBAAgB;EAChBC,WAAW;EACXC,MAAM;EACNC,YAAY;EACZC,WAAW;EACXC;AACF,CAAC,KAAK;EACJ,MAAM,CAAC;IAAEC,aAAa,GAAGV,cAAc;IAAEW;EAAU,CAAC,EAAEC,gBAAgB,CAAC,GAAGf,QAAQ,CAAC,CAAC,CAAC,CAAC;EAEtF,MAAMgB,WAAW,GAAI,UAASP,MAAO,EAAC;EAEtC,MAAMQ,MAAM,GACVJ,aAAa,KAAKV,cAAc,IAChCK,WAAW,CACRU,GAAG,CAAC,CAAC;IAAEC,KAAK,EAAEC,UAAU;IAAEC,QAAQ,EAAE,C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,SAAS,CAAC0C,IAAI,CAACC,UAAU;EAC3CrC,WAAW,EAAEN,SAAS,CAAC4C,KAAK,CAACD,UAAU;EACvCpC,MAAM,EAAEP,SAAS,CAAC6C,MAAM,CAACF,UAAU;EACnCnC,YAAY,EAAER,SAAS,CAAC6C,MAAM,CAACF,UAAU;EACzClC,WAAW,EAAET,SAAS,CAAC4C,KAAK;EAC5BlC,kBAAkB,EAAEV,SAAS,CAAC8C,MAAM,CAACH;AACvC,CAAC;AAEDvC,YAAY,CAAC2C,YAAY,GAAG;EAC1BtC,WAAW,EAAE;AACf,CAAC;AAED,eAAeL,YAAY"}
|
|
@@ -10,6 +10,7 @@ import { useQuery } from '@apollo/client';
|
|
|
10
10
|
import { useRouter } from 'next/router';
|
|
11
11
|
import { buildUserQuery, buildPropsData } from './helpers';
|
|
12
12
|
import { getSingleEntitySchema, getUser } from '../../application/query';
|
|
13
|
+
import Wrapper from '../Wrapper';
|
|
13
14
|
import BannerRender from './BannerRender';
|
|
14
15
|
import buildPropsQuery from '../../helpers/build-props-query';
|
|
15
16
|
import { getClassModifiers } from '../../utils';
|
|
@@ -74,15 +75,17 @@ const Banner = _ref => {
|
|
|
74
75
|
action
|
|
75
76
|
} = getEntityRenderProps(queryProps, data, isPreview);
|
|
76
77
|
const bannerKey = `${sizeId}${asPath}`;
|
|
77
|
-
return /*#__PURE__*/React.createElement(
|
|
78
|
+
return /*#__PURE__*/React.createElement(Wrapper, {
|
|
79
|
+
className: type,
|
|
80
|
+
modifiers: modifiers
|
|
81
|
+
}, /*#__PURE__*/React.createElement(BannerRender, _extends({
|
|
78
82
|
key: bannerKey
|
|
79
83
|
}, otherProps, {
|
|
80
84
|
action: action,
|
|
81
85
|
actionKey: actionKey,
|
|
82
86
|
asPath: asPath,
|
|
83
|
-
userPropsData: userPropsData
|
|
84
|
-
|
|
85
|
-
}));
|
|
87
|
+
userPropsData: userPropsData
|
|
88
|
+
})));
|
|
86
89
|
};
|
|
87
90
|
Banner.propTypes = {
|
|
88
91
|
type: PropTypes.string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","names":["React","useContext","MainContext","checkIfLoggedIn","PropTypes","flatten","useQuery","useRouter","buildUserQuery","buildPropsData","getSingleEntitySchema","getUser","BannerRender","buildPropsQuery","getClassModifiers","getEntityRenderProps","Banner","_ref","type","otherProps","_objectWithoutProperties","_excluded","router","isPreview","id","userId","asPath","parent","entity","sizeId","propsToDisplay","userPropsToDisplay","userQuery","itemEntity","data","error","loading","variables","userData","userLoading","skip","length","message","modifiers","queryProps","map","propertiesToDisplay","userPropsData","actionKey","action","bannerKey","createElement","_extends","key","propTypes","string","defaultProps"],"sources":["../../../src/components/Banner/Banner.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport PropTypes from 'prop-types';\nimport flatten from 'lodash.flatten';\nimport { useQuery } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { buildUserQuery, buildPropsData } from './helpers';\nimport { getSingleEntitySchema, getUser } from '../../application/query';\nimport BannerRender from './BannerRender';\nimport buildPropsQuery from '../../helpers/build-props-query';\nimport { getClassModifiers } from '../../utils';\nimport getEntityRenderProps from '../../helpers/get-entity-render-props';\n\nconst Banner = ({ type, ...otherProps }) => {\n const router = useRouter();\n const { isPreview } = useContext(MainContext);\n const { id: userId } = checkIfLoggedIn();\n const { asPath } = router;\n const { parent, entity, sizeId, propsToDisplay = [], userPropsToDisplay = [] } = otherProps;\n const userQuery = buildUserQuery(userPropsToDisplay);\n const { itemEntity } = parent;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity || itemEntity }\n });\n const { data: { getUser: userData } = {}, loading: userLoading } = useQuery(getUser(userQuery), {\n variables: { id: userId },\n skip: !userPropsToDisplay.length || !userId\n });\n\n if (loading || userLoading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!sizeId) return null;\n\n const modifiers = getClassModifiers('banner', otherProps);\n const queryProps = buildPropsQuery(\n data,\n propsToDisplay.length\n ? flatten(propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay))\n : []\n );\n\n const userPropsData = buildPropsData(userData, userPropsToDisplay);\n const { actionKey, action } = getEntityRenderProps(queryProps, data, isPreview);\n const bannerKey = `${sizeId}${asPath}`;\n\n return (\n <BannerRender\n
|
|
1
|
+
{"version":3,"file":"Banner.js","names":["React","useContext","MainContext","checkIfLoggedIn","PropTypes","flatten","useQuery","useRouter","buildUserQuery","buildPropsData","getSingleEntitySchema","getUser","Wrapper","BannerRender","buildPropsQuery","getClassModifiers","getEntityRenderProps","Banner","_ref","type","otherProps","_objectWithoutProperties","_excluded","router","isPreview","id","userId","asPath","parent","entity","sizeId","propsToDisplay","userPropsToDisplay","userQuery","itemEntity","data","error","loading","variables","userData","userLoading","skip","length","message","modifiers","queryProps","map","propertiesToDisplay","userPropsData","actionKey","action","bannerKey","createElement","className","_extends","key","propTypes","string","defaultProps"],"sources":["../../../src/components/Banner/Banner.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport PropTypes from 'prop-types';\nimport flatten from 'lodash.flatten';\nimport { useQuery } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { buildUserQuery, buildPropsData } from './helpers';\nimport { getSingleEntitySchema, getUser } from '../../application/query';\nimport Wrapper from '../Wrapper';\nimport BannerRender from './BannerRender';\nimport buildPropsQuery from '../../helpers/build-props-query';\nimport { getClassModifiers } from '../../utils';\nimport getEntityRenderProps from '../../helpers/get-entity-render-props';\n\nconst Banner = ({ type, ...otherProps }) => {\n const router = useRouter();\n const { isPreview } = useContext(MainContext);\n const { id: userId } = checkIfLoggedIn();\n const { asPath } = router;\n const { parent, entity, sizeId, propsToDisplay = [], userPropsToDisplay = [] } = otherProps;\n const userQuery = buildUserQuery(userPropsToDisplay);\n const { itemEntity } = parent;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity || itemEntity }\n });\n const { data: { getUser: userData } = {}, loading: userLoading } = useQuery(getUser(userQuery), {\n variables: { id: userId },\n skip: !userPropsToDisplay.length || !userId\n });\n\n if (loading || userLoading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!sizeId) return null;\n\n const modifiers = getClassModifiers('banner', otherProps);\n const queryProps = buildPropsQuery(\n data,\n propsToDisplay.length\n ? flatten(propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay))\n : []\n );\n\n const userPropsData = buildPropsData(userData, userPropsToDisplay);\n const { actionKey, action } = getEntityRenderProps(queryProps, data, isPreview);\n const bannerKey = `${sizeId}${asPath}`;\n\n return (\n <Wrapper className={type} modifiers={modifiers}>\n <BannerRender\n key={bannerKey}\n {...otherProps}\n action={action}\n actionKey={actionKey}\n asPath={asPath}\n userPropsData={userPropsData}\n />\n </Wrapper>\n );\n};\n\nBanner.propTypes = {\n type: PropTypes.string\n};\n\nBanner.defaultProps = {\n type: 'banner'\n};\n\nexport default Banner;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,eAAe,QAAQ,yBAAyB;AACzD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,cAAc,EAAEC,cAAc,QAAQ,WAAW;AAC1D,SAASC,qBAAqB,EAAEC,OAAO,QAAQ,yBAAyB;AACxE,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,eAAe,MAAM,iCAAiC;AAC7D,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,OAAOC,oBAAoB,MAAM,uCAAuC;AAExE,MAAMC,MAAM,GAA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AAI;EAExB,MAAMc,SAAS,GAAG7B,iBAAiB,CAAC,QAAQ,EAAEK,UAAU,CAAC;EACzD,MAAMyB,UAAU,GAAG/B,eAAe,CAChCqB,IAAI,EACJJ,cAAc,CAACW,MAAM,GACjBrC,OAAO,CAAC0B,cAAc,CAACe,GAAG,CAAC,CAAC;IAAEC;EAAoB,CAAC,KAAKA,mBAAmB,CAAC,CAAC,GAC7E,EACN,CAAC;EAED,MAAMC,aAAa,GAAGvC,cAAc,CAAC8B,QAAQ,EAAEP,kBAAkB,CAAC;EAClE,MAAM;IAAEiB,SAAS;IAAEC;EAAO,CAAC,GAAGlC,oBAAoB,CAAC6B,UAAU,EAAEV,IAAI,EAAEX,SAAS,CAAC;EAC/E,MAAM2B,SAAS,GAAI,GAAErB,MAAO,GAAEH,MAAO,EAAC;EAEtC,oBACE3B,KAAA,CAAAoD,aAAA,CAACxC,OAAO;IAACyC,SAAS,EAAElC,IAAK;IAACyB,SAAS,EAAEA;EAAU,gBAC7C5C,KAAA,CAAAoD,aAAA,CAACvC,YAAY,EAAAyC,QAAA;IACXC,GAAG,EAAEJ;EAAU,GACX/B,UAAU;IACd8B,MAAM,EAAEA,MAAO;IACfD,SAAS,EAAEA,SAAU;IACrBtB,MAAM,EAAEA,MAAO;IACfqB,aAAa,EAAEA;EAAc,EAC9B,CACM,CAAC;AAEd,CAAC;AAED/B,MAAM,CAACuC,SAAS,GAAG;EACjBrC,IAAI,EAAEf,SAAS,CAACqD;AAClB,CAAC;AAEDxC,MAAM,CAACyC,YAAY,GAAG;EACpBvC,IAAI,EAAE;AACR,CAAC;AAED,eAAeF,MAAM"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["baseAdunit", "adunit", "sizeId", "sizes", "propsToDisplay", "entity", "targetings", "parent", "asPath", "action", "actionKey", "renderCounter", "userPropsData"
|
|
3
|
+
const _excluded = ["baseAdunit", "adunit", "sizeId", "sizes", "propsToDisplay", "entity", "targetings", "parent", "asPath", "action", "actionKey", "renderCounter", "userPropsData"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import React from 'react';
|
|
@@ -25,8 +25,7 @@ const BannerRender = _ref => {
|
|
|
25
25
|
action,
|
|
26
26
|
actionKey,
|
|
27
27
|
renderCounter,
|
|
28
|
-
userPropsData
|
|
29
|
-
modifiers
|
|
28
|
+
userPropsData
|
|
30
29
|
} = _ref,
|
|
31
30
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
32
31
|
const {
|
|
@@ -89,7 +88,6 @@ const BannerRender = _ref => {
|
|
|
89
88
|
sizeId: sizeId,
|
|
90
89
|
parsedAdunit: parsedAdunit,
|
|
91
90
|
parsedSizes: parsedSizes,
|
|
92
|
-
modifiers: modifiers,
|
|
93
91
|
targetingArguments: targetingArguments
|
|
94
92
|
});
|
|
95
93
|
};
|
|
@@ -106,7 +104,6 @@ BannerRender.propTypes = {
|
|
|
106
104
|
targetings: PropTypes.string,
|
|
107
105
|
sizes: PropTypes.string,
|
|
108
106
|
renderCounter: PropTypes.number,
|
|
109
|
-
modifiers: PropTypes.string,
|
|
110
107
|
userPropsData: PropTypes.object
|
|
111
108
|
};
|
|
112
109
|
BannerRender.defaultProps = {
|
|
@@ -118,7 +115,6 @@ BannerRender.defaultProps = {
|
|
|
118
115
|
targetings: '',
|
|
119
116
|
sizes: '',
|
|
120
117
|
renderCounter: null,
|
|
121
|
-
modifiers: '',
|
|
122
118
|
userPropsData: {}
|
|
123
119
|
};
|
|
124
120
|
export default withTitle(BannerRender);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerRender.js","names":["React","PropTypes","useQuery","generateSingleItemQuery","getCount","buildBannerSizes","buildContextualTargeting","buildParsedAdunit","buildSizeMapping","setCustomTargetings","BANNER_QUERY_PROPS","COUNT_CONTENT_HIERARCHIES","GET_BANNER","PUBLISHED","withTitle","AdSlotRender","BannerRender","_ref","baseAdunit","adunit","sizeId","sizes","propsToDisplay","entity","targetings","parent","asPath","action","actionKey","renderCounter","userPropsData","
|
|
1
|
+
{"version":3,"file":"BannerRender.js","names":["React","PropTypes","useQuery","generateSingleItemQuery","getCount","buildBannerSizes","buildContextualTargeting","buildParsedAdunit","buildSizeMapping","setCustomTargetings","BANNER_QUERY_PROPS","COUNT_CONTENT_HIERARCHIES","GET_BANNER","PUBLISHED","withTitle","AdSlotRender","BannerRender","_ref","baseAdunit","adunit","sizeId","sizes","propsToDisplay","entity","targetings","parent","asPath","action","actionKey","renderCounter","userPropsData","otherProps","_objectWithoutProperties","_excluded","id","itemId","data","entityRecordData","variables","where","skip","bannerData","parentId","childEntity","_ilike","parsedTargetings","entityData","bannerSizes","sizeMapping","parsedSizes","countContentHierarchies","parsedAdunit","isContextualTargetingSet","length","Object","keys","isContextualTargetingReady","shouldShowBanner","customTargetings","targetingArguments","_objectSpread","createElement","propTypes","object","isRequired","string","array","number","defaultProps"],"sources":["../../../src/components/Banner/BannerRender.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { useQuery } from '@apollo/client';\n\nimport { generateSingleItemQuery, getCount } from '../../application/query';\nimport {\n buildBannerSizes,\n buildContextualTargeting,\n buildParsedAdunit,\n buildSizeMapping,\n setCustomTargetings\n} from './helpers';\nimport {\n BANNER_QUERY_PROPS,\n COUNT_CONTENT_HIERARCHIES,\n GET_BANNER,\n PUBLISHED\n} from '../../constants';\nimport { withTitle } from '../../HOC';\nimport AdSlotRender from './AdSlotRender';\n\nconst BannerRender = ({\n baseAdunit,\n adunit,\n sizeId,\n sizes,\n propsToDisplay,\n entity,\n targetings,\n parent,\n asPath,\n action,\n actionKey,\n renderCounter,\n userPropsData,\n ...otherProps\n}) => {\n const { id } = otherProps;\n const { itemId } = parent;\n\n const { data: entityRecordData = {} } = useQuery(action, {\n variables: { where: { id: id || itemId } },\n skip: id && id !== itemId\n });\n\n const { data: bannerData = {} } = useQuery(\n generateSingleItemQuery(GET_BANNER, BANNER_QUERY_PROPS),\n {\n variables: { id: sizeId },\n skip: !sizeId\n }\n );\n\n const { data = {} } = useQuery(getCount(COUNT_CONTENT_HIERARCHIES), {\n variables: {\n where: {\n parentId: id || itemId,\n childEntity: {\n _ilike: `${PUBLISHED}_%`\n }\n }\n }\n });\n\n const parsedTargetings = buildContextualTargeting(actionKey, entityRecordData, propsToDisplay);\n const { entityData } = bannerData;\n const { sizes: bannerSizes } = entityData || {};\n\n const sizeMapping = buildSizeMapping(sizeId, bannerSizes);\n const parsedSizes = buildBannerSizes(sizeId, bannerSizes, sizes);\n\n const { countContentHierarchies } = data;\n\n const parsedAdunit = buildParsedAdunit(asPath, countContentHierarchies, baseAdunit, adunit);\n const isContextualTargetingSet =\n propsToDisplay.length && parsedTargetings && Object.keys(parsedTargetings).length;\n const isContextualTargetingReady = isContextualTargetingSet || !propsToDisplay.length;\n const shouldShowBanner =\n parsedAdunit && parsedSizes && !!parsedSizes.length && isContextualTargetingReady;\n\n const customTargetings = setCustomTargetings(targetings, renderCounter);\n\n const targetingArguments = { ...parsedTargetings, ...customTargetings, ...userPropsData };\n\n return (\n <AdSlotRender\n shouldShowBanner={!!shouldShowBanner}\n sizeMapping={sizeMapping}\n sizeId={sizeId}\n parsedAdunit={parsedAdunit}\n parsedSizes={parsedSizes}\n targetingArguments={targetingArguments}\n />\n );\n};\n\nBannerRender.propTypes = {\n parent: PropTypes.object.isRequired,\n asPath: PropTypes.string.isRequired,\n action: PropTypes.object.isRequired,\n actionKey: PropTypes.string.isRequired,\n adunit: PropTypes.string,\n baseAdunit: PropTypes.string,\n sizeId: PropTypes.string,\n propsToDisplay: PropTypes.array,\n entity: PropTypes.string,\n targetings: PropTypes.string,\n sizes: PropTypes.string,\n renderCounter: PropTypes.number,\n userPropsData: PropTypes.object\n};\n\nBannerRender.defaultProps = {\n adunit: '',\n baseAdunit: '',\n sizeId: '',\n propsToDisplay: [],\n entity: '',\n targetings: '',\n sizes: '',\n renderCounter: null,\n userPropsData: {}\n};\n\nexport default withTitle(BannerRender);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,QAAQ,QAAQ,gBAAgB;AAEzC,SAASC,uBAAuB,EAAEC,QAAQ,QAAQ,yBAAyB;AAC3E,SACEC,gBAAgB,EAChBC,wBAAwB,EACxBC,iBAAiB,EACjBC,gBAAgB,EAChBC,mBAAmB,QACd,WAAW;AAClB,SACEC,kBAAkB,EAClBC,yBAAyB,EACzBC,UAAU,EACVC,SAAS,QACJ,iBAAiB;AACxB,SAASC,SAAS,QAAQ,WAAW;AACrC,OAAOC,YAAY,MAAM,gBAAgB;AAEzC,MAAMC,YAAY,GAAGC,IAAA,IAef;EAAA,IAfgB;MACpBC,UAAU;MACVC,MAAM;MACNC,MAAM;MACNC,KAAK;MACLC,cAAc;MACdC,MAAM;MACNC,UAAU;MACVC,MAAM;MACNC,MAAM;MACNC,MAAM;MACNC,SAAS;MACTC,aAAa;MACbC;IAEF,CAAC,GAAAb,IAAA;IADIc,UAAU,GAAAC,wBAAA,CAAAf,IAAA,EAAAgB,SAAA;EAEb,MAAM;IAAEC;EAAG,CAAC,GAAGH,UAAU;EACzB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;EAC/B3C,MAAM,EAAEtB,SAAS,CAACgE,MAAM;EACxBzC,UAAU,EAAEvB,SAAS,CAACgE,MAAM;EAC5B5C,KAAK,EAAEpB,SAAS,CAACgE,MAAM;EACvBpC,aAAa,EAAE5B,SAAS,CAACkE,MAAM;EAC/BrC,aAAa,EAAE7B,SAAS,CAAC8D;AAC3B,CAAC;AAED/C,YAAY,CAACoD,YAAY,GAAG;EAC1BjD,MAAM,EAAE,EAAE;EACVD,UAAU,EAAE,EAAE;EACdE,MAAM,EAAE,EAAE;EACVE,cAAc,EAAE,EAAE;EAClBC,MAAM,EAAE,EAAE;EACVC,UAAU,EAAE,EAAE;EACdH,KAAK,EAAE,EAAE;EACTQ,aAAa,EAAE,IAAI;EACnBC,aAAa,EAAE,CAAC;AAClB,CAAC;AAED,eAAehB,SAAS,CAACE,YAAY,CAAC"}
|
|
@@ -44,11 +44,10 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
44
44
|
} = options;
|
|
45
45
|
return propertiesToDisplay.map(key => {
|
|
46
46
|
const loopValue = loopValues[key];
|
|
47
|
-
const
|
|
48
|
-
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
47
|
+
const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
49
48
|
if (!propValue) return null;
|
|
50
49
|
const processedValue = processDataSummaryValue(propValue, options);
|
|
51
|
-
const linkToPublishedContent = getLinkToPublishedContent(key, data
|
|
50
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
52
51
|
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
53
52
|
});
|
|
54
53
|
})).filter(Boolean);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","
|
|
1
|
+
{"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","propValue","processedValue","linkToPublishedContent","filter","Boolean","push"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,uBAAuB,QAAQ,kBAAkB;AAE1D,MAAMC,YAAY,GAAGC,KAAK,IAAI;EAC5B,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,OAAOA,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED,MAAMC,cAAc,GAAGA,CAACC,cAAc,EAAEC,SAAS,EAAEC,IAAI,KAAK;EAC1D,MAAMC,aAAa,GAAG,CAAC,CAAC;EACxB,MAAMC,UAAU,GAAG,CAAC,CAAC;EAErBJ,cAAc,CAACK,OAAO,CAACC,OAAO,IAAI;IAChC,MAAM;MAAEC;IAAoB,CAAC,GAAGD,OAAO;IACvCC,mBAAmB,CAACF,OAAO,CAACG,IAAI,IAAI;MAClC,MAAMX,KAAK,GAAGH,YAAY,CAACc,IAAI,EAAEN,IAAI,EAAEI,OAAO,CAAC;MAC/C,MAAMG,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACd,KAAK,CAAC;MACzC,IAAI,CAACA,KAAK,EAAE;MACZ,MAAMe,cAAc,GAAGX,SAAS,CAACY,QAAQ,CAACL,IAAI,CAAC,IAAIC,YAAY;MAE/D,IAAIG,cAAc,EAAE;QAClBR,UAAU,CAACI,IAAI,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AAK,CAAC,EAAEK,cAAc,EAAEC,sBAAsB,EAAEL,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACM,MAAM,CAACC,OAAO,CAAC;IACjBb,oBAAoB,CAACc,IAAI,CAACX,UAAU,CAAC;EACvC;EAEA,OAAO5B,OAAO,CAACyB,oBAAoB,CAAC;AACtC,CAAC;AAED,eAAeF,qBAAqB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
const getLinkToPublishedContent = (key = '', props = {}
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
-
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
5
4
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
6
5
|
return content && content.url ? content.url : '';
|
|
7
6
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","
|
|
1
|
+
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","baseKey","split","content","Array","isArray","url"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];\n return content && content.url ? content.url : '';\n};\n\nexport default getLinkToPublishedContent;\n"],"mappings":"AAAA,MAAMA,yBAAyB,GAAGA,CAACC,GAAG,GAAG,EAAE,EAAEC,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1D,MAAM,CAACC,OAAO,CAAC,GAAGF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC;EAChC,IAAI,CAACF,KAAK,CAACC,OAAO,CAAC,EAAE,OAAO,EAAE;EAC9B,MAAME,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACC,OAAO,CAAC,CAAC,GAAGD,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGD,KAAK,CAACC,OAAO,CAAC;EAClF,OAAOE,OAAO,IAAIA,OAAO,CAACG,GAAG,GAAGH,OAAO,CAACG,GAAG,GAAG,EAAE;AAClD,CAAC;AAED,eAAeR,yBAAyB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/react-page-builder",
|
|
3
|
-
"version": "0.134.0
|
|
3
|
+
"version": "0.134.0",
|
|
4
4
|
"description": "Blaze react page builder",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/core-auth-ui": "0.
|
|
31
|
-
"@blaze-cms/core-errors": "0.
|
|
32
|
-
"@blaze-cms/core-errors-ui": "0.
|
|
30
|
+
"@blaze-cms/core-auth-ui": "^0.131.0",
|
|
31
|
+
"@blaze-cms/core-errors": "^0.131.0",
|
|
32
|
+
"@blaze-cms/core-errors-ui": "^0.131.0",
|
|
33
33
|
"@blaze-cms/image-cdn-react": "0.3.0-alpha.6",
|
|
34
|
-
"@blaze-cms/nextjs-components": "0.134.0
|
|
35
|
-
"@blaze-cms/plugin-search-ui": "0.134.0
|
|
36
|
-
"@blaze-cms/setup-ui": "0.
|
|
37
|
-
"@blaze-cms/utils": "0.
|
|
38
|
-
"@blaze-cms/utils-handlebars": "0.134.0
|
|
34
|
+
"@blaze-cms/nextjs-components": "^0.134.0",
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "^0.134.0",
|
|
36
|
+
"@blaze-cms/setup-ui": "^0.131.0",
|
|
37
|
+
"@blaze-cms/utils": "^0.131.0",
|
|
38
|
+
"@blaze-cms/utils-handlebars": "^0.134.0",
|
|
39
39
|
"@blaze-react/breadcrumb": "0.8.0-alpha.60",
|
|
40
40
|
"@blaze-react/button": "0.5.19",
|
|
41
41
|
"@blaze-react/checkboxes": "0.5.31",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"lib/*",
|
|
90
90
|
"lib-es/*"
|
|
91
91
|
],
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "0ee132aebf4417d5259a42bef9f790df2a2bb453"
|
|
93
93
|
}
|
|
@@ -2,7 +2,6 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import { AdSlot } from 'react-dfp';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { BANNER_LOADING, BANNER_EMPTY, BANNER_LOADED } from '../../constants';
|
|
5
|
-
import Wrapper from '../Wrapper';
|
|
6
5
|
|
|
7
6
|
const AdSlotRender = ({
|
|
8
7
|
shouldShowBanner,
|
|
@@ -10,7 +9,6 @@ const AdSlotRender = ({
|
|
|
10
9
|
sizeId,
|
|
11
10
|
parsedAdunit,
|
|
12
11
|
parsedSizes,
|
|
13
|
-
modifiers,
|
|
14
12
|
targetingArguments
|
|
15
13
|
}) => {
|
|
16
14
|
const [{ loadingStatus = BANNER_LOADING, minHeight }, setLoadingStatus] = useState({});
|
|
@@ -26,11 +24,11 @@ const AdSlotRender = ({
|
|
|
26
24
|
})
|
|
27
25
|
.sort();
|
|
28
26
|
const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;
|
|
29
|
-
|
|
27
|
+
|
|
30
28
|
return (
|
|
31
|
-
|
|
29
|
+
<>
|
|
32
30
|
{styles && <style>{styles.join('\n')}</style>}
|
|
33
|
-
<div className={className} style={{ minHeight }}
|
|
31
|
+
<div className={className} style={{ minHeight }}>
|
|
34
32
|
{shouldShowBanner && (
|
|
35
33
|
<AdSlot
|
|
36
34
|
adUnit={parsedAdunit}
|
|
@@ -48,7 +46,7 @@ const AdSlotRender = ({
|
|
|
48
46
|
/>
|
|
49
47
|
)}
|
|
50
48
|
</div>
|
|
51
|
-
|
|
49
|
+
</>
|
|
52
50
|
);
|
|
53
51
|
};
|
|
54
52
|
|
|
@@ -58,13 +56,11 @@ AdSlotRender.propTypes = {
|
|
|
58
56
|
sizeId: PropTypes.string.isRequired,
|
|
59
57
|
parsedAdunit: PropTypes.string.isRequired,
|
|
60
58
|
parsedSizes: PropTypes.array,
|
|
61
|
-
modifiers: PropTypes.string,
|
|
62
59
|
targetingArguments: PropTypes.object.isRequired
|
|
63
60
|
};
|
|
64
61
|
|
|
65
62
|
AdSlotRender.defaultProps = {
|
|
66
|
-
parsedSizes: null
|
|
67
|
-
modifiers: ''
|
|
63
|
+
parsedSizes: null
|
|
68
64
|
};
|
|
69
65
|
|
|
70
66
|
export default AdSlotRender;
|
|
@@ -7,6 +7,7 @@ import { useQuery } from '@apollo/client';
|
|
|
7
7
|
import { useRouter } from 'next/router';
|
|
8
8
|
import { buildUserQuery, buildPropsData } from './helpers';
|
|
9
9
|
import { getSingleEntitySchema, getUser } from '../../application/query';
|
|
10
|
+
import Wrapper from '../Wrapper';
|
|
10
11
|
import BannerRender from './BannerRender';
|
|
11
12
|
import buildPropsQuery from '../../helpers/build-props-query';
|
|
12
13
|
import { getClassModifiers } from '../../utils';
|
|
@@ -46,15 +47,16 @@ const Banner = ({ type, ...otherProps }) => {
|
|
|
46
47
|
const bannerKey = `${sizeId}${asPath}`;
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
<Wrapper className={type} modifiers={modifiers}>
|
|
51
|
+
<BannerRender
|
|
52
|
+
key={bannerKey}
|
|
53
|
+
{...otherProps}
|
|
54
|
+
action={action}
|
|
55
|
+
actionKey={actionKey}
|
|
56
|
+
asPath={asPath}
|
|
57
|
+
userPropsData={userPropsData}
|
|
58
|
+
/>
|
|
59
|
+
</Wrapper>
|
|
58
60
|
);
|
|
59
61
|
};
|
|
60
62
|
|
|
@@ -34,7 +34,6 @@ const BannerRender = ({
|
|
|
34
34
|
actionKey,
|
|
35
35
|
renderCounter,
|
|
36
36
|
userPropsData,
|
|
37
|
-
modifiers,
|
|
38
37
|
...otherProps
|
|
39
38
|
}) => {
|
|
40
39
|
const { id } = otherProps;
|
|
@@ -91,7 +90,6 @@ const BannerRender = ({
|
|
|
91
90
|
sizeId={sizeId}
|
|
92
91
|
parsedAdunit={parsedAdunit}
|
|
93
92
|
parsedSizes={parsedSizes}
|
|
94
|
-
modifiers={modifiers}
|
|
95
93
|
targetingArguments={targetingArguments}
|
|
96
94
|
/>
|
|
97
95
|
);
|
|
@@ -110,7 +108,6 @@ BannerRender.propTypes = {
|
|
|
110
108
|
targetings: PropTypes.string,
|
|
111
109
|
sizes: PropTypes.string,
|
|
112
110
|
renderCounter: PropTypes.number,
|
|
113
|
-
modifiers: PropTypes.string,
|
|
114
111
|
userPropsData: PropTypes.object
|
|
115
112
|
};
|
|
116
113
|
|
|
@@ -123,7 +120,6 @@ BannerRender.defaultProps = {
|
|
|
123
120
|
targetings: '',
|
|
124
121
|
sizes: '',
|
|
125
122
|
renderCounter: null,
|
|
126
|
-
modifiers: '',
|
|
127
123
|
userPropsData: {}
|
|
128
124
|
};
|
|
129
125
|
|
|
@@ -45,12 +45,11 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
45
45
|
|
|
46
46
|
return propertiesToDisplay.map(key => {
|
|
47
47
|
const loopValue = loopValues[key];
|
|
48
|
-
const
|
|
49
|
-
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
48
|
+
const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
|
|
50
49
|
if (!propValue) return null;
|
|
51
50
|
|
|
52
51
|
const processedValue = processDataSummaryValue(propValue, options);
|
|
53
|
-
const linkToPublishedContent = getLinkToPublishedContent(key, data
|
|
52
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
54
53
|
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
55
54
|
});
|
|
56
55
|
})
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
const getLinkToPublishedContent = (key = '', props = {}
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
-
|
|
5
|
-
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
6
|
-
|
|
7
4
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
8
5
|
return content && content.url ? content.url : '';
|
|
9
6
|
};
|
|
@@ -50,17 +50,17 @@ describe('Banner render component', () => {
|
|
|
50
50
|
<AdSlotRender {...defaultProps} shouldShowBanner={false} />
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
expect(container.childNodes[0].nodeName).toEqual('
|
|
54
|
-
expect(
|
|
53
|
+
expect(container.childNodes[0].nodeName).toEqual('STYLE');
|
|
54
|
+
expect(container.childNodes[1]).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
55
55
|
expect(() => getByTestId(slotTestId)).toThrow();
|
|
56
56
|
expect(asFragment()).toMatchSnapshot();
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
describe('AdSlot loading', () => {
|
|
60
60
|
it('should render AdSlot', () => {
|
|
61
|
-
const { asFragment, getByTestId } = render(<AdSlotRender {...defaultProps} />);
|
|
61
|
+
const { asFragment, container, getByTestId } = render(<AdSlotRender {...defaultProps} />);
|
|
62
62
|
expect(getByTestId('adslot-test')).toBeDefined();
|
|
63
|
-
expect(
|
|
63
|
+
expect(container.childNodes[1]).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
64
64
|
expect(asFragment()).toMatchSnapshot();
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -69,11 +69,16 @@ describe('Banner render component', () => {
|
|
|
69
69
|
const adSlot = getByTestId(slotTestId);
|
|
70
70
|
|
|
71
71
|
fireEvent.mouseOver(adSlot);
|
|
72
|
-
await waitFor(() =>
|
|
72
|
+
await waitFor(() =>
|
|
73
|
+
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-loaded banner-sizeId')
|
|
74
|
+
);
|
|
75
|
+
expect(container.childNodes[0]).toHaveStyle('min-height: 250px');
|
|
73
76
|
expect(asFragment()).toMatchSnapshot();
|
|
74
77
|
|
|
75
78
|
fireEvent.mouseLeave(adSlot);
|
|
76
|
-
await waitFor(() =>
|
|
79
|
+
await waitFor(() =>
|
|
80
|
+
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-empty banner-sizeId')
|
|
81
|
+
);
|
|
77
82
|
expect(asFragment()).toMatchSnapshot();
|
|
78
83
|
});
|
|
79
84
|
});
|
|
@@ -3,18 +3,13 @@
|
|
|
3
3
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
|
-
class="banner
|
|
6
|
+
class="ad-slot ad-slot-loaded banner-sizeId"
|
|
7
|
+
style="min-height: 250px;"
|
|
7
8
|
>
|
|
8
9
|
<div
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
>
|
|
13
|
-
<div
|
|
14
|
-
data-testid="adslot-test"
|
|
15
|
-
role="button"
|
|
16
|
-
/>
|
|
17
|
-
</div>
|
|
10
|
+
data-testid="adslot-test"
|
|
11
|
+
role="button"
|
|
12
|
+
/>
|
|
18
13
|
</div>
|
|
19
14
|
</DocumentFragment>
|
|
20
15
|
`;
|
|
@@ -22,59 +17,44 @@ exports[`Banner render component AdSlot loading should change class and remove r
|
|
|
22
17
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 2`] = `
|
|
23
18
|
<DocumentFragment>
|
|
24
19
|
<div
|
|
25
|
-
class="banner
|
|
20
|
+
class="ad-slot ad-slot-empty banner-sizeId"
|
|
21
|
+
style=""
|
|
26
22
|
>
|
|
27
23
|
<div
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
>
|
|
32
|
-
<div
|
|
33
|
-
data-testid="adslot-test"
|
|
34
|
-
role="button"
|
|
35
|
-
/>
|
|
36
|
-
</div>
|
|
24
|
+
data-testid="adslot-test"
|
|
25
|
+
role="button"
|
|
26
|
+
/>
|
|
37
27
|
</div>
|
|
38
28
|
</DocumentFragment>
|
|
39
29
|
`;
|
|
40
30
|
|
|
41
31
|
exports[`Banner render component AdSlot loading should render AdSlot 1`] = `
|
|
42
32
|
<DocumentFragment>
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
<style>
|
|
47
|
-
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
33
|
+
<style>
|
|
34
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
48
35
|
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
49
36
|
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
50
|
-
|
|
37
|
+
</style>
|
|
38
|
+
<div
|
|
39
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
40
|
+
>
|
|
51
41
|
<div
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<div
|
|
56
|
-
data-testid="adslot-test"
|
|
57
|
-
role="button"
|
|
58
|
-
/>
|
|
59
|
-
</div>
|
|
42
|
+
data-testid="adslot-test"
|
|
43
|
+
role="button"
|
|
44
|
+
/>
|
|
60
45
|
</div>
|
|
61
46
|
</DocumentFragment>
|
|
62
47
|
`;
|
|
63
48
|
|
|
64
49
|
exports[`Banner render component should not render AdSlot if shouldShowBanner=false but should render styles and wrapper 1`] = `
|
|
65
50
|
<DocumentFragment>
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
>
|
|
69
|
-
<style>
|
|
70
|
-
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
51
|
+
<style>
|
|
52
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
71
53
|
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
72
54
|
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
55
|
+
</style>
|
|
56
|
+
<div
|
|
57
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
58
|
+
/>
|
|
79
59
|
</DocumentFragment>
|
|
80
60
|
`;
|
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Banner render component should render 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
+
<style />
|
|
5
6
|
<div
|
|
6
|
-
class="banner
|
|
7
|
-
|
|
8
|
-
<style />
|
|
9
|
-
<div
|
|
10
|
-
class="ad-slot ad-slot-loading banner-sizeId"
|
|
11
|
-
data-testid="ad-slot"
|
|
12
|
-
/>
|
|
13
|
-
</div>
|
|
7
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
8
|
+
/>
|
|
14
9
|
</DocumentFragment>
|
|
15
10
|
`;
|
|
@@ -90,45 +90,4 @@ describe('buildLoopPropsContent helper function', () => {
|
|
|
90
90
|
});
|
|
91
91
|
expect.hasAssertions();
|
|
92
92
|
});
|
|
93
|
-
|
|
94
|
-
it('should nested items with urls', () => {
|
|
95
|
-
const data = {
|
|
96
|
-
nestedLoopProp: [
|
|
97
|
-
{
|
|
98
|
-
nestedValue: 'abc',
|
|
99
|
-
url: 'http://blazecms.app/abc'
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
nestedValue: '123',
|
|
103
|
-
url: 'http://blazecms.app/123'
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
nestedValue: 'no url',
|
|
107
|
-
url: null
|
|
108
|
-
}
|
|
109
|
-
]
|
|
110
|
-
};
|
|
111
|
-
const withUrl = buildLoopPropsContent(
|
|
112
|
-
mockedLoopProps,
|
|
113
|
-
[
|
|
114
|
-
{
|
|
115
|
-
bold: false,
|
|
116
|
-
enableLink: true,
|
|
117
|
-
label: '',
|
|
118
|
-
modifier: '',
|
|
119
|
-
prefix: '',
|
|
120
|
-
propertiesToDisplay: ['nestedLoopProp.nestedValue'],
|
|
121
|
-
shouldStrip: true
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
0,
|
|
125
|
-
data
|
|
126
|
-
);
|
|
127
|
-
|
|
128
|
-
withUrl.forEach(([, value, url], index) => {
|
|
129
|
-
expect(value).toEqual(data.nestedLoopProp[index].nestedValue);
|
|
130
|
-
expect(url).toEqual(data.nestedLoopProp[index].url || '');
|
|
131
|
-
});
|
|
132
|
-
expect.hasAssertions();
|
|
133
|
-
});
|
|
134
93
|
});
|
|
@@ -38,25 +38,4 @@ describe('get link to published content', () => {
|
|
|
38
38
|
const result = getLinkToPublishedContent(publishedKey, props);
|
|
39
39
|
expect(result).toEqual('');
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
it('should return url from the currentValue', () => {
|
|
43
|
-
const currentValue = { url: 'currentValueUrl' };
|
|
44
|
-
const props = { content: [content] };
|
|
45
|
-
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
46
|
-
expect(result).toEqual(currentValue.url);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('should return url from the currentValue even if falsey', () => {
|
|
50
|
-
const currentValue = { url: null };
|
|
51
|
-
const props = { content: [content] };
|
|
52
|
-
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
53
|
-
expect(result).toEqual(currentValue.url);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should not return url from the currentValue if not set', () => {
|
|
57
|
-
const currentValue = {};
|
|
58
|
-
const props = { content: [content] };
|
|
59
|
-
const result = getLinkToPublishedContent(publishedKey, props, currentValue);
|
|
60
|
-
expect(result).toEqual(content.url);
|
|
61
|
-
});
|
|
62
41
|
});
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Placeholder component should render PlaceholderIcon 1`] = `
|
|
4
|
-
<DocumentFragment>
|
|
5
|
-
<div
|
|
6
|
-
class="editor-view__placeholder"
|
|
7
|
-
data-testid="placeholder-icon"
|
|
8
|
-
>
|
|
9
|
-
<svg
|
|
10
|
-
height="25px"
|
|
11
|
-
version="1.1"
|
|
12
|
-
viewBox="0 0 16 16"
|
|
13
|
-
width="25px"
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
>
|
|
16
|
-
<title>
|
|
17
|
-
card
|
|
18
|
-
</title>
|
|
19
|
-
<g
|
|
20
|
-
fill="none"
|
|
21
|
-
fill-rule="evenodd"
|
|
22
|
-
id="Icons"
|
|
23
|
-
stroke="none"
|
|
24
|
-
stroke-width="1"
|
|
25
|
-
>
|
|
26
|
-
<g
|
|
27
|
-
id="card"
|
|
28
|
-
transform="translate(-261.000000, -216.000000)"
|
|
29
|
-
>
|
|
30
|
-
<g
|
|
31
|
-
transform="translate(261.000000, 216.000000)"
|
|
32
|
-
>
|
|
33
|
-
<path
|
|
34
|
-
d="M15,1 L15,9.53124644 L14.998,9.531 L14.9986024,7.67959976 L11.4210663,4.62547112 L7.4590683,8.08893259 C7.08560181,8.77082265 6.07591438,8.77082265 5.51715851,8.27688661 L3.50145721,6.5 L1,8.77 L1,7.323 L2.58011188,5.9054667 C3.10161735,5.44445974 3.91799869,5.41372594 4.47882094,5.81326531 L4.59488493,5.9054667 L6.4402744,7.56106172 L10.4252459,3.98593625 C10.9840017,3.49200022 11.8812631,3.49200022 12.4400189,3.98593625 L14.9986024,6.28137475 L14.998,1 Z M6.14778213,2.60821539 C6.69719001,2.60821539 7.14257312,3.0379169 7.14257312,3.56798059 C7.14257312,4.09804429 6.69719002,4.52774581 6.14778213,4.52774581 C5.88422964,4.52580316 5.6316942,4.42547921 5.44313851,4.24781429 C5.25594548,4.06784498 5.15142164,3.82293899 5.15297371,3.56798059 C5.15297371,3.0379169 5.59837425,2.60821539 6.14778213,2.60821539 Z"
|
|
35
|
-
fill="#63779C"
|
|
36
|
-
fill-rule="nonzero"
|
|
37
|
-
id="Combined-Shape"
|
|
38
|
-
/>
|
|
39
|
-
<path
|
|
40
|
-
d="M3,13 C3,12.7238576 3.22385763,12.5 3.5,12.5 L12.5,12.5 C12.7761424,12.5 13,12.7238576 13,13 C13,13.2761424 12.7761424,13.5 12.5,13.5 L3.5,13.5 C3.22385763,13.5 3,13.2761424 3,13 Z"
|
|
41
|
-
fill="#899BBC"
|
|
42
|
-
fill-rule="nonzero"
|
|
43
|
-
id="Shape"
|
|
44
|
-
/>
|
|
45
|
-
<rect
|
|
46
|
-
height="15"
|
|
47
|
-
id="Rectangle"
|
|
48
|
-
rx="2"
|
|
49
|
-
stroke="#899BBC"
|
|
50
|
-
width="15"
|
|
51
|
-
x="0.5"
|
|
52
|
-
y="0.5"
|
|
53
|
-
/>
|
|
54
|
-
<line
|
|
55
|
-
id="Line-2"
|
|
56
|
-
stroke="#63779C"
|
|
57
|
-
stroke-linecap="square"
|
|
58
|
-
x1="0.5"
|
|
59
|
-
x2="15.5"
|
|
60
|
-
y1="10.5"
|
|
61
|
-
y2="10.5"
|
|
62
|
-
/>
|
|
63
|
-
</g>
|
|
64
|
-
</g>
|
|
65
|
-
</g>
|
|
66
|
-
</svg>
|
|
67
|
-
<span>
|
|
68
|
-
card
|
|
69
|
-
</span>
|
|
70
|
-
</div>
|
|
71
|
-
</DocumentFragment>
|
|
72
|
-
`;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@blaze-cms/tools/test-helpers/test-functions';
|
|
5
|
-
|
|
6
|
-
import PlaceholderIcon from '../../../../../../blaze-plugin-page-builder-ui/src/components/EditorView/PlaceholderIcon';
|
|
7
|
-
import { CardIcon } from '../../../../../../blaze-plugin-page-builder-ui/src/components/EditorView/Icons';
|
|
8
|
-
|
|
9
|
-
const mockedProps = {
|
|
10
|
-
type: 'card',
|
|
11
|
-
icon: CardIcon
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
describe('Placeholder component', () => {
|
|
15
|
-
it('should render PlaceholderIcon', () => {
|
|
16
|
-
const { asFragment, getByTestId } = render(PlaceholderIcon, mockedProps);
|
|
17
|
-
expect(getByTestId('placeholder-icon')).toBeDefined();
|
|
18
|
-
expect(asFragment()).toMatchSnapshot();
|
|
19
|
-
});
|
|
20
|
-
});
|