@blaze-cms/react-page-builder 0.134.0-alpha.0 → 0.134.0-core-styles.2
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 +16 -1
- package/lib/components/Banner/AdSlotRender.js +12 -3
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js +4 -7
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js +5 -1
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
- package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
- package/lib-es/components/Banner/AdSlotRender.js +12 -3
- package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
- package/lib-es/components/Banner/Banner.js +4 -7
- package/lib-es/components/Banner/Banner.js.map +1 -1
- package/lib-es/components/Banner/BannerRender.js +6 -2
- package/lib-es/components/Banner/BannerRender.js.map +1 -1
- package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- 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 +2 -1
- 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 +9 -5
- package/src/components/Banner/Banner.js +9 -11
- package/src/components/Banner/BannerRender.js +4 -0
- package/src/components/DataSummary/helpers/build-loop-props-content.js +3 -2
- package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
- package/tests/unit/src/components/Banner/AdSlotRender.test.js +6 -11
- package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +45 -25
- package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +8 -3
- package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +41 -0
- package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
- package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
- package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
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-core-styles.2](https://github.com/thebyte9/blaze/compare/v0.134.0-core-styles.1...v0.134.0-core-styles.2) (2023-10-25)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
9
9
|
|
|
@@ -11,6 +11,21 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
+
# [0.134.0-core-styles.0](https://github.com/thebyte9/blaze/compare/v0.133.0...v0.134.0-core-styles.0) (2023-10-17)
|
|
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))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
14
29
|
# [0.133.0](https://github.com/thebyte9/blaze/compare/v0.133.0-alpha.6...v0.133.0) (2023-10-04)
|
|
15
30
|
|
|
16
31
|
**Note:** Version bump only for package @blaze-cms/react-page-builder
|
|
@@ -23,6 +23,7 @@ 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"));
|
|
26
27
|
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); }
|
|
27
28
|
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; }
|
|
28
29
|
var AdSlotRender = function AdSlotRender(_ref) {
|
|
@@ -31,6 +32,7 @@ var AdSlotRender = function AdSlotRender(_ref) {
|
|
|
31
32
|
sizeId = _ref.sizeId,
|
|
32
33
|
parsedAdunit = _ref.parsedAdunit,
|
|
33
34
|
parsedSizes = _ref.parsedSizes,
|
|
35
|
+
modifiers = _ref.modifiers,
|
|
34
36
|
targetingArguments = _ref.targetingArguments;
|
|
35
37
|
var _useState = (0, _react.useState)({}),
|
|
36
38
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
@@ -52,11 +54,16 @@ var AdSlotRender = function AdSlotRender(_ref) {
|
|
|
52
54
|
return "@media(min-width:".concat(minWidth, "px){.").concat(bannerClass, "{min-height:").concat(minimumHeight, "px;}");
|
|
53
55
|
}).sort();
|
|
54
56
|
var className = "ad-slot ad-slot-".concat(loadingStatus, " ").concat(bannerClass);
|
|
55
|
-
|
|
57
|
+
var newModifers = "".concat(modifiers, " banner-").concat(loadingStatus);
|
|
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", {
|
|
56
62
|
className: className,
|
|
57
63
|
style: {
|
|
58
64
|
minHeight: minHeight
|
|
59
|
-
}
|
|
65
|
+
},
|
|
66
|
+
"data-testid": "ad-slot"
|
|
60
67
|
}, shouldShowBanner && /*#__PURE__*/_react["default"].createElement(_reactDfp.AdSlot, {
|
|
61
68
|
adUnit: parsedAdunit,
|
|
62
69
|
sizes: parsedSizes,
|
|
@@ -81,10 +88,12 @@ AdSlotRender.propTypes = {
|
|
|
81
88
|
sizeId: _propTypes["default"].string.isRequired,
|
|
82
89
|
parsedAdunit: _propTypes["default"].string.isRequired,
|
|
83
90
|
parsedSizes: _propTypes["default"].array,
|
|
91
|
+
modifiers: _propTypes["default"].string,
|
|
84
92
|
targetingArguments: _propTypes["default"].object.isRequired
|
|
85
93
|
};
|
|
86
94
|
AdSlotRender.defaultProps = {
|
|
87
|
-
parsedSizes: null
|
|
95
|
+
parsedSizes: null,
|
|
96
|
+
modifiers: ''
|
|
88
97
|
};
|
|
89
98
|
var _default = AdSlotRender;
|
|
90
99
|
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
1
|
+
{"version":3,"file":"AdSlotRender.js","names":["_react","_interopRequireWildcard","require","_reactDfp","_propTypes","_interopRequireDefault","_constants","_Wrapper","_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","modifiers","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","newModifers","createElement","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';\nimport Wrapper from '../Wrapper';\n\nconst AdSlotRender = ({\n shouldShowBanner,\n sizeMapping,\n sizeId,\n parsedAdunit,\n parsedSizes,\n modifiers,\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 const newModifers = `${modifiers} banner-${loadingStatus}`;\n return (\n <Wrapper className=\"banner\" modifiers={newModifers}>\n {styles && <style>{styles.join('\\n')}</style>}\n <div className={className} style={{ minHeight }} data-testid=\"ad-slot\">\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 </Wrapper>\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 modifiers: PropTypes.string,\n targetingArguments: PropTypes.object.isRequired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,uBAAY,GAAGC,wBAAa;MAC/DtC,gBAAgB,CAAC;QAAEH,aAAa,EAAEuC,gBAAgB;QAAErC,SAAS,EAAEkC;MAAW,CAAC,CAAC;IAC9E;EAAE,CACH,CAEA,CACE,CAAC;AAEd,CAAC;AAEDnD,YAAY,CAACyD,SAAS,GAAG;EACvBvD,gBAAgB,EAAEwD,qBAAS,CAACC,IAAI,CAACC,UAAU;EAC3CzD,WAAW,EAAEuD,qBAAS,CAACG,KAAK,CAACD,UAAU;EACvCxD,MAAM,EAAEsD,qBAAS,CAACI,MAAM,CAACF,UAAU;EACnCvD,YAAY,EAAEqD,qBAAS,CAACI,MAAM,CAACF,UAAU;EACzCtD,WAAW,EAAEoD,qBAAS,CAACG,KAAK;EAC5BtD,SAAS,EAAEmD,qBAAS,CAACI,MAAM;EAC3BtD,kBAAkB,EAAEkD,qBAAS,CAACK,MAAM,CAACH;AACvC,CAAC;AAED5D,YAAY,CAACgE,YAAY,GAAG;EAC1B1D,WAAW,EAAE,IAAI;EACjBC,SAAS,EAAE;AACb,CAAC;AAAC,IAAA0D,QAAA,GAEajE,YAAY;AAAAkE,OAAA,cAAAD,QAAA"}
|
|
@@ -26,7 +26,6 @@ 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"));
|
|
30
29
|
var _BannerRender = _interopRequireDefault(require("./BannerRender"));
|
|
31
30
|
var _buildPropsQuery = _interopRequireDefault(require("../../helpers/build-props-query"));
|
|
32
31
|
var _utils = require("../../utils");
|
|
@@ -84,17 +83,15 @@ var Banner = function Banner(_ref) {
|
|
|
84
83
|
actionKey = _getEntityRenderProps.actionKey,
|
|
85
84
|
action = _getEntityRenderProps.action;
|
|
86
85
|
var bannerKey = "".concat(sizeId).concat(asPath);
|
|
87
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
88
|
-
className: type,
|
|
89
|
-
modifiers: modifiers
|
|
90
|
-
}, /*#__PURE__*/_react["default"].createElement(_BannerRender["default"], (0, _extends2["default"])({
|
|
86
|
+
return /*#__PURE__*/_react["default"].createElement(_BannerRender["default"], (0, _extends2["default"])({
|
|
91
87
|
key: bannerKey
|
|
92
88
|
}, otherProps, {
|
|
93
89
|
action: action,
|
|
94
90
|
actionKey: actionKey,
|
|
95
91
|
asPath: asPath,
|
|
96
|
-
userPropsData: userPropsData
|
|
97
|
-
|
|
92
|
+
userPropsData: userPropsData,
|
|
93
|
+
modifiers: modifiers
|
|
94
|
+
}));
|
|
98
95
|
};
|
|
99
96
|
Banner.propTypes = {
|
|
100
97
|
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","
|
|
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 key={bannerKey}\n {...otherProps}\n action={action}\n actionKey={actionKey}\n asPath={asPath}\n userPropsData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AAc,CAAC2B,GAAG,CAAC,UAAAC,KAAA;IAAA,IAAGC,mBAAmB,GAAAD,KAAA,CAAnBC,mBAAmB;IAAA,OAAOA,mBAAmB;EAAA,EAAC,CAAC,GAC7E,EACN,CAAC;EAED,IAAMC,aAAa,GAAG,IAAAC,uBAAc,EAACZ,QAAQ,EAAEjB,kBAAkB,CAAC;EAClE,IAAA8B,qBAAA,GAA8B,IAAAC,iCAAoB,EAACT,UAAU,EAAEd,IAAI,EAAEpB,SAAS,CAAC;IAAvE4C,SAAS,GAAAF,qBAAA,CAATE,SAAS;IAAEC,MAAM,GAAAH,qBAAA,CAANG,MAAM;EACzB,IAAMC,SAAS,MAAAC,MAAA,CAAMvC,MAAM,EAAAuC,MAAA,CAAG1C,MAAM,CAAE;EAEtC,oBACEtD,MAAA,YAAAiG,aAAA,CAACrF,aAAA,WAAY,MAAAsF,SAAA;IACXjE,GAAG,EAAE8D;EAAU,GACXrD,UAAU;IACdoD,MAAM,EAAEA,MAAO;IACfD,SAAS,EAAEA,SAAU;IACrBvC,MAAM,EAAEA,MAAO;IACfmC,aAAa,EAAEA,aAAc;IAC7BR,SAAS,EAAEA;EAAU,EACtB,CAAC;AAEN,CAAC;AAED1C,MAAM,CAAC4D,SAAS,GAAG;EACjB1D,IAAI,EAAE2D,qBAAS,CAACC;AAClB,CAAC;AAED9D,MAAM,CAAC+D,YAAY,GAAG;EACpB7D,IAAI,EAAE;AACR,CAAC;AAAC,IAAA8D,QAAA,GAEahE,MAAM;AAAAiE,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", "modifiers"];
|
|
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,6 +42,7 @@ var BannerRender = function BannerRender(_ref) {
|
|
|
42
42
|
actionKey = _ref.actionKey,
|
|
43
43
|
renderCounter = _ref.renderCounter,
|
|
44
44
|
userPropsData = _ref.userPropsData,
|
|
45
|
+
modifiers = _ref.modifiers,
|
|
45
46
|
otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
46
47
|
var id = otherProps.id;
|
|
47
48
|
var itemId = parent.itemId;
|
|
@@ -94,6 +95,7 @@ var BannerRender = function BannerRender(_ref) {
|
|
|
94
95
|
sizeId: sizeId,
|
|
95
96
|
parsedAdunit: parsedAdunit,
|
|
96
97
|
parsedSizes: parsedSizes,
|
|
98
|
+
modifiers: modifiers,
|
|
97
99
|
targetingArguments: targetingArguments
|
|
98
100
|
});
|
|
99
101
|
};
|
|
@@ -110,6 +112,7 @@ BannerRender.propTypes = {
|
|
|
110
112
|
targetings: _propTypes["default"].string,
|
|
111
113
|
sizes: _propTypes["default"].string,
|
|
112
114
|
renderCounter: _propTypes["default"].number,
|
|
115
|
+
modifiers: _propTypes["default"].string,
|
|
113
116
|
userPropsData: _propTypes["default"].object
|
|
114
117
|
};
|
|
115
118
|
BannerRender.defaultProps = {
|
|
@@ -121,6 +124,7 @@ BannerRender.defaultProps = {
|
|
|
121
124
|
targetings: '',
|
|
122
125
|
sizes: '',
|
|
123
126
|
renderCounter: null,
|
|
127
|
+
modifiers: '',
|
|
124
128
|
userPropsData: {}
|
|
125
129
|
};
|
|
126
130
|
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","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,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OAAA,CAAAI,MAAA,CAAAD,CAAA,OAAAa,OAAA,WAAAd,CAAA,QAAAe,gBAAA,aAAAhB,CAAA,EAAAC,CAAA,EAAAC,CAAA,CAAAD,CAAA,SAAAE,MAAA,CAAAc,yBAAA,GAAAd,MAAA,CAAAe,gBAAA,CAAAlB,CAAA,EAAAG,MAAA,CAAAc,yBAAA,CAAAf,CAAA,KAAAH,OAAA,CAAAI,MAAA,CAAAD,CAAA,GAAAa,OAAA,WAAAd,CAAA,IAAAE,MAAA,CAAAgB,cAAA,CAAAnB,CAAA,EAAAC,CAAA,EAAAE,MAAA,CAAAK,wBAAA,CAAAN,CAAA,EAAAD,CAAA,iBAAAD,CAAA;AAE1C,IAAMoB,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,
|
|
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","modifiers","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 modifiers,\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 modifiers={modifiers}\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 modifiers: PropTypes.string,\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 modifiers: '',\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,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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;EACnBE,SAAS,EAAE,EAAE;EACbD,aAAa,EAAE,CAAC;AAClB,CAAC;AAAC,IAAAwD,QAAA,GAEa,IAAAC,cAAS,EAACvE,YAAY,CAAC;AAAAwE,OAAA,cAAAF,QAAA"}
|
|
@@ -63,10 +63,11 @@ 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
|
|
66
|
+
var loopValueItem = loopValue && loopValue[i];
|
|
67
|
+
var propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
67
68
|
if (!propValue) return null;
|
|
68
69
|
var processedValue = (0, _helpers.processDataSummaryValue)(propValue, options);
|
|
69
|
-
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data);
|
|
70
|
+
var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data, loopValueItem);
|
|
70
71
|
return [(0, _lodash["default"])(label), processedValue, linkToPublishedContent, modifier];
|
|
71
72
|
});
|
|
72
73
|
})).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","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
|
|
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","loopValueItem","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 loopValueItem = loopValue && loopValue[i];\n const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);\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,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAMM,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK,EAAI;EAC5B,IAAQC,QAAQ,GAAKD,KAAK,CAAlBC,QAAQ;EAChB,OAAOD,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,cAAc,EAAEC,SAAS,EAAEC,IAAI,EAAK;EAC1D,IAAMC,aAAa,GAAG,CAAC,CAAC;EACxB,IAAMC,UAAU,GAAG,CAAC,CAAC;EAErBJ,cAAc,CAACK,OAAO,CAAC,UAAAC,OAAO,EAAI;IAChC,IAAQC,mBAAmB,GAAKD,OAAO,CAA/BC,mBAAmB;IAC3BA,mBAAmB,CAACF,OAAO,CAAC,UAAAG,IAAI,EAAI;MAClC,IAAMX,KAAK,GAAG,IAAAY,wBAAY,EAACD,IAAI,EAAEN,IAAI,EAAEI,OAAO,CAAC;MAC/C,IAAMI,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACf,KAAK,CAAC;MACzC,IAAI,CAACA,KAAK,EAAE;MACZ,IAAMgB,cAAc,GAAGZ,SAAS,CAACa,QAAQ,CAACN,IAAI,CAAC,IAAIE,YAAY;MAE/D,IAAIG,cAAc,EAAE;QAClBT,UAAU,CAACI,IAAI,CAAC,GAAGX,KAAK;MAC1B,CAAC,MAAM;QAC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D,OAAOzB,mBAAmB,CAACuB,GAAG,CAAC,UAAAI,GAAG,EAAI;QACpC,IAAMC,SAAS,GAAG/B,UAAU,CAAC8B,GAAG,CAAC;QACjC,IAAME,aAAa,GAAGD,SAAS,IAAIA,SAAS,CAACR,CAAC,CAAC;QAC/C,IAAMU,SAAS,GAAGD,aAAa,GAAGxC,YAAY,CAACwC,aAAa,CAAC,GAAGjC,aAAa,CAAC+B,GAAG,CAAC;QAClF,IAAI,CAACG,SAAS,EAAE,OAAO,IAAI;QAE3B,IAAMC,cAAc,GAAG,IAAAC,gCAAuB,EAACF,SAAS,EAAE/B,OAAO,CAAC;QAClE,IAAMkC,sBAAsB,GAAG,IAAAC,qCAAyB,EAACP,GAAG,EAAEhC,IAAI,EAAEkC,aAAa,CAAC;QAClF,OAAO,CAAC,IAAAM,kBAAU,EAACX,KAAK,CAAC,EAAEO,cAAc,EAAEE,sBAAsB,EAAEP,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACU,MAAM,CAACC,OAAO,CAAC;IACjBxB,oBAAoB,CAACyB,IAAI,CAACjB,UAAU,CAAC;EACvC,CAAC;EAlBD,KAAK,IAAID,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAS,EAAEG,CAAC,IAAI,CAAC;IAAAD,KAAA,CAAAC,CAAA;EAAA;EAoBrC,OAAO,IAAAE,mBAAO,EAACT,oBAAoB,CAAC;AACtC,CAAC;AAAC,IAAA0B,QAAA,GAEa/B,qBAAqB;AAAAgC,OAAA,cAAAD,QAAA"}
|
|
@@ -11,10 +11,12 @@ 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;
|
|
14
15
|
var _key$split = key.split('.'),
|
|
15
16
|
_key$split2 = (0, _slicedToArray2["default"])(_key$split, 1),
|
|
16
17
|
baseKey = _key$split2[0];
|
|
17
18
|
if (!props[baseKey]) return '';
|
|
19
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
18
20
|
var content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
19
21
|
return content && content.url ? content.url : '';
|
|
20
22
|
};
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
1
|
+
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","arguments","length","undefined","props","currentValue","_key$split","split","_key$split2","_slicedToArray2","baseKey","url","content","Array","isArray","_default","exports"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n\n if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;\n\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,EAAkD;EAAA,IAA9CC,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;EAAA,IAAEI,YAAY,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAC1E,IAAAK,UAAA,GAAkBN,GAAG,CAACO,KAAK,CAAC,GAAG,CAAC;IAAAC,WAAA,OAAAC,eAAA,aAAAH,UAAA;IAAzBI,OAAO,GAAAF,WAAA;EACd,IAAI,CAACJ,KAAK,CAACM,OAAO,CAAC,EAAE,OAAO,EAAE;EAE9B,IAAIL,YAAY,IAAI,OAAOA,YAAY,CAACM,GAAG,KAAK,WAAW,EAAE,OAAON,YAAY,CAACM,GAAG;EAEpF,IAAMC,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACV,KAAK,CAACM,OAAO,CAAC,CAAC,GAAGN,KAAK,CAACM,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGN,KAAK,CAACM,OAAO,CAAC;EAClF,OAAOE,OAAO,IAAIA,OAAO,CAACD,GAAG,GAAGC,OAAO,CAACD,GAAG,GAAG,EAAE;AAClD,CAAC;AAAC,IAAAI,QAAA,GAEahB,yBAAyB;AAAAiB,OAAA,cAAAD,QAAA"}
|
|
@@ -2,12 +2,14 @@ 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';
|
|
5
6
|
const AdSlotRender = ({
|
|
6
7
|
shouldShowBanner,
|
|
7
8
|
sizeMapping,
|
|
8
9
|
sizeId,
|
|
9
10
|
parsedAdunit,
|
|
10
11
|
parsedSizes,
|
|
12
|
+
modifiers,
|
|
11
13
|
targetingArguments
|
|
12
14
|
}) => {
|
|
13
15
|
const [{
|
|
@@ -23,11 +25,16 @@ const AdSlotRender = ({
|
|
|
23
25
|
return `@media(min-width:${minWidth}px){.${bannerClass}{min-height:${minimumHeight}px;}`;
|
|
24
26
|
}).sort();
|
|
25
27
|
const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;
|
|
26
|
-
|
|
28
|
+
const newModifers = `${modifiers} banner-${loadingStatus}`;
|
|
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", {
|
|
27
33
|
className: className,
|
|
28
34
|
style: {
|
|
29
35
|
minHeight
|
|
30
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"data-testid": "ad-slot"
|
|
31
38
|
}, shouldShowBanner && /*#__PURE__*/React.createElement(AdSlot, {
|
|
32
39
|
adUnit: parsedAdunit,
|
|
33
40
|
sizes: parsedSizes,
|
|
@@ -55,10 +62,12 @@ AdSlotRender.propTypes = {
|
|
|
55
62
|
sizeId: PropTypes.string.isRequired,
|
|
56
63
|
parsedAdunit: PropTypes.string.isRequired,
|
|
57
64
|
parsedSizes: PropTypes.array,
|
|
65
|
+
modifiers: PropTypes.string,
|
|
58
66
|
targetingArguments: PropTypes.object.isRequired
|
|
59
67
|
};
|
|
60
68
|
AdSlotRender.defaultProps = {
|
|
61
|
-
parsedSizes: null
|
|
69
|
+
parsedSizes: null,
|
|
70
|
+
modifiers: ''
|
|
62
71
|
};
|
|
63
72
|
export default AdSlotRender;
|
|
64
73
|
//# sourceMappingURL=AdSlotRender.js.map
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
1
|
+
{"version":3,"file":"AdSlotRender.js","names":["React","useState","AdSlot","PropTypes","BANNER_LOADING","BANNER_EMPTY","BANNER_LOADED","Wrapper","AdSlotRender","shouldShowBanner","sizeMapping","sizeId","parsedAdunit","parsedSizes","modifiers","targetingArguments","loadingStatus","minHeight","setLoadingStatus","bannerClass","styles","map","sizes","styleSizes","viewport","minWidth","minimumHeight","Math","min","height","sort","className","newModifers","createElement","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';\nimport Wrapper from '../Wrapper';\n\nconst AdSlotRender = ({\n shouldShowBanner,\n sizeMapping,\n sizeId,\n parsedAdunit,\n parsedSizes,\n modifiers,\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 const newModifers = `${modifiers} banner-${loadingStatus}`;\n return (\n <Wrapper className=\"banner\" modifiers={newModifers}>\n {styles && <style>{styles.join('\\n')}</style>}\n <div className={className} style={{ minHeight }} data-testid=\"ad-slot\">\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 </Wrapper>\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 modifiers: PropTypes.string,\n targetingArguments: PropTypes.object.isRequired\n};\n\nAdSlotRender.defaultProps = {\n parsedSizes: null,\n modifiers: ''\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;AAC7E,OAAOC,OAAO,MAAM,YAAY;AAEhC,MAAMC,YAAY,GAAGA,CAAC;EACpBC,gBAAgB;EAChBC,WAAW;EACXC,MAAM;EACNC,YAAY;EACZC,WAAW;EACXC,SAAS;EACTC;AACF,CAAC,KAAK;EACJ,MAAM,CAAC;IAAEC,aAAa,GAAGZ,cAAc;IAAEa;EAAU,CAAC,EAAEC,gBAAgB,CAAC,GAAGjB,QAAQ,CAAC,CAAC,CAAC,CAAC;EAEtF,MAAMkB,WAAW,GAAI,UAASR,MAAO,EAAC;EAEtC,MAAMS,MAAM,GACVJ,aAAa,KAAKZ,cAAc,IAChCM,WAAW,CACRW,GAAG,CAAC,CAAC;IAAEC,KAAK,EAAEC,UAAU;IAAEC,QAAQ,EAAE,CAACC,QAAQ;EAAE,CAAC,KAAK;IACpD,MAAMC,aAAa,GAAGC,IAAI,CAACC,GAAG,CAAC,GAAGL,UAAU,CAACF,GAAG,CAAC,CAAC,GAAGQ,MAAM,CAAC,KAAKA,MAAM,CAAC,CAAC;IACzE,OAAQ,oBAAmBJ,QAAS,QAAON,WAAY,eAAcO,aAAc,MAAK;EAC1F,CAAC,CAAC,CACDI,IAAI,CAAC,CAAC;EACX,MAAMC,SAAS,GAAI,mBAAkBf,aA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U;EACzCnC,WAAW,EAAEV,SAAS,CAAC8C,KAAK;EAC5BnC,SAAS,EAAEX,SAAS,CAAC+C,MAAM;EAC3BnC,kBAAkB,EAAEZ,SAAS,CAACgD,MAAM,CAACH;AACvC,CAAC;AAEDxC,YAAY,CAAC4C,YAAY,GAAG;EAC1BvC,WAAW,EAAE,IAAI;EACjBC,SAAS,EAAE;AACb,CAAC;AAED,eAAeN,YAAY"}
|
|
@@ -10,7 +10,6 @@ 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';
|
|
14
13
|
import BannerRender from './BannerRender';
|
|
15
14
|
import buildPropsQuery from '../../helpers/build-props-query';
|
|
16
15
|
import { getClassModifiers } from '../../utils';
|
|
@@ -75,17 +74,15 @@ const Banner = _ref => {
|
|
|
75
74
|
action
|
|
76
75
|
} = getEntityRenderProps(queryProps, data, isPreview);
|
|
77
76
|
const bannerKey = `${sizeId}${asPath}`;
|
|
78
|
-
return /*#__PURE__*/React.createElement(
|
|
79
|
-
className: type,
|
|
80
|
-
modifiers: modifiers
|
|
81
|
-
}, /*#__PURE__*/React.createElement(BannerRender, _extends({
|
|
77
|
+
return /*#__PURE__*/React.createElement(BannerRender, _extends({
|
|
82
78
|
key: bannerKey
|
|
83
79
|
}, otherProps, {
|
|
84
80
|
action: action,
|
|
85
81
|
actionKey: actionKey,
|
|
86
82
|
asPath: asPath,
|
|
87
|
-
userPropsData: userPropsData
|
|
88
|
-
|
|
83
|
+
userPropsData: userPropsData,
|
|
84
|
+
modifiers: modifiers
|
|
85
|
+
}));
|
|
89
86
|
};
|
|
90
87
|
Banner.propTypes = {
|
|
91
88
|
type: PropTypes.string
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","names":["React","useContext","MainContext","checkIfLoggedIn","PropTypes","flatten","useQuery","useRouter","buildUserQuery","buildPropsData","getSingleEntitySchema","getUser","
|
|
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 key={bannerKey}\n {...otherProps}\n action={action}\n actionKey={actionKey}\n asPath={asPath}\n userPropsData={userPropsData}\n modifiers={modifiers}\n />\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,YAAY,MAAM,gBAAgB;AACzC,OAAOC,eAAe,MAAM,iCAAiC;AAC7D,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,OAAOC,oBAAoB,MAAM,uCAAuC;AAExE,MAAMC,MAAM,GAAGC,IAAA,IAA6B;EAAA,IAA5B;MAAEC;IAAoB,CAAC,GAAAD,IAAA;IAAZE,UAAU,GAAAC,wBAAA,CAAAH,IAAA,EAAAI,SAAA;EACnC,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1B,MAAM;IAAEgB;EAAU,CAAC,GAAGtB,UAAU,CAACC,WAAW,CAAC;EAC7C,MAAM;IAAEsB,EAAE,EAAEC;EAAO,CAAC,GA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aAAa,GAAGtC,cAAc,CAAC6B,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,oBACE1B,KAAA,CAAAmD,aAAA,CAACvC,YAAY,EAAAwC,QAAA;IACXC,GAAG,EAAEH;EAAU,GACX/B,UAAU;IACd8B,MAAM,EAAEA,MAAO;IACfD,SAAS,EAAEA,SAAU;IACrBtB,MAAM,EAAEA,MAAO;IACfqB,aAAa,EAAEA,aAAc;IAC7BJ,SAAS,EAAEA;EAAU,EACtB,CAAC;AAEN,CAAC;AAED3B,MAAM,CAACsC,SAAS,GAAG;EACjBpC,IAAI,EAAEd,SAAS,CAACmD;AAClB,CAAC;AAEDvC,MAAM,CAACwC,YAAY,GAAG;EACpBtC,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", "modifiers"];
|
|
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,7 +25,8 @@ const BannerRender = _ref => {
|
|
|
25
25
|
action,
|
|
26
26
|
actionKey,
|
|
27
27
|
renderCounter,
|
|
28
|
-
userPropsData
|
|
28
|
+
userPropsData,
|
|
29
|
+
modifiers
|
|
29
30
|
} = _ref,
|
|
30
31
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
31
32
|
const {
|
|
@@ -88,6 +89,7 @@ const BannerRender = _ref => {
|
|
|
88
89
|
sizeId: sizeId,
|
|
89
90
|
parsedAdunit: parsedAdunit,
|
|
90
91
|
parsedSizes: parsedSizes,
|
|
92
|
+
modifiers: modifiers,
|
|
91
93
|
targetingArguments: targetingArguments
|
|
92
94
|
});
|
|
93
95
|
};
|
|
@@ -104,6 +106,7 @@ BannerRender.propTypes = {
|
|
|
104
106
|
targetings: PropTypes.string,
|
|
105
107
|
sizes: PropTypes.string,
|
|
106
108
|
renderCounter: PropTypes.number,
|
|
109
|
+
modifiers: PropTypes.string,
|
|
107
110
|
userPropsData: PropTypes.object
|
|
108
111
|
};
|
|
109
112
|
BannerRender.defaultProps = {
|
|
@@ -115,6 +118,7 @@ BannerRender.defaultProps = {
|
|
|
115
118
|
targetings: '',
|
|
116
119
|
sizes: '',
|
|
117
120
|
renderCounter: null,
|
|
121
|
+
modifiers: '',
|
|
118
122
|
userPropsData: {}
|
|
119
123
|
};
|
|
120
124
|
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","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,
|
|
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","modifiers","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 modifiers,\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 modifiers={modifiers}\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 modifiers: PropTypes.string,\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 modifiers: '',\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,IAgBf;EAAA,IAhBgB;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,aAAa;MACbC;IAEF,CAAC,GAAAd,IAAA;IADIe,UAAU,GAAAC,wBAAA,CAAAhB,IAAA,EAAAiB,SAAA;EAEb,MAAM;IAAEC;EAAG,CAAC,GAAGH,UAAU;EACzB,MAAM;IAAEI;EAAO,CAAC,GAAGX,MAAM;EAEzB,MAAM;IAAEY,IAAI,EAAEC,gBAAgB,GAAG,CAAC;EAAE,CAAC,GAAGpC,QAAQ,CAACyB,MAAM,EAAE;IACvDY,SAAS,EAA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EACvBrC,aAAa,EAAE5B,SAAS,CAACmE,MAAM;EAC/BrC,SAAS,EAAE9B,SAAS,CAACiE,MAAM;EAC3BpC,aAAa,EAAE7B,SAAS,CAAC+D;AAC3B,CAAC;AAEDhD,YAAY,CAACqD,YAAY,GAAG;EAC1BlD,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;EACnBE,SAAS,EAAE,EAAE;EACbD,aAAa,EAAE,CAAC;AAClB,CAAC;AAED,eAAehB,SAAS,CAACE,YAAY,CAAC"}
|
|
@@ -44,10 +44,11 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
44
44
|
} = options;
|
|
45
45
|
return propertiesToDisplay.map(key => {
|
|
46
46
|
const loopValue = loopValues[key];
|
|
47
|
-
const
|
|
47
|
+
const loopValueItem = loopValue && loopValue[i];
|
|
48
|
+
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
48
49
|
if (!propValue) return null;
|
|
49
50
|
const processedValue = processDataSummaryValue(propValue, options);
|
|
50
|
-
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
51
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);
|
|
51
52
|
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
52
53
|
});
|
|
53
54
|
})).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","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
|
|
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","loopValueItem","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 loopValueItem = loopValue && loopValue[i];\n const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);\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,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
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
4
5
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
5
6
|
return content && content.url ? content.url : '';
|
|
6
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","baseKey","split","content","Array","isArray"
|
|
1
|
+
{"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","currentValue","baseKey","split","url","content","Array","isArray"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n\n if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;\n\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,EAAEC,YAAY,GAAG,IAAI,KAAK;EAC/E,MAAM,CAACC,OAAO,CAAC,GAAGH,GAAG,CAACI,KAAK,CAAC,GAAG,CAAC;EAChC,IAAI,CAACH,KAAK,CAACE,OAAO,CAAC,EAAE,OAAO,EAAE;EAE9B,IAAID,YAAY,IAAI,OAAOA,YAAY,CAACG,GAAG,KAAK,WAAW,EAAE,OAAOH,YAAY,CAACG,GAAG;EAEpF,MAAMC,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACP,KAAK,CAACE,OAAO,CAAC,CAAC,GAAGF,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGF,KAAK,CAACE,OAAO,CAAC;EAClF,OAAOG,OAAO,IAAIA,OAAO,CAACD,GAAG,GAAGC,OAAO,CAACD,GAAG,GAAG,EAAE;AAClD,CAAC;AAED,eAAeN,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-core-styles.2",
|
|
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": "
|
|
31
|
-
"@blaze-cms/core-errors": "
|
|
32
|
-
"@blaze-cms/core-errors-ui": "
|
|
30
|
+
"@blaze-cms/core-auth-ui": "0.134.0-core-styles.0",
|
|
31
|
+
"@blaze-cms/core-errors": "0.134.0-core-styles.0",
|
|
32
|
+
"@blaze-cms/core-errors-ui": "0.134.0-core-styles.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": "
|
|
37
|
-
"@blaze-cms/utils": "
|
|
38
|
-
"@blaze-cms/utils-handlebars": "0.134.0-
|
|
34
|
+
"@blaze-cms/nextjs-components": "0.134.0-core-styles.0",
|
|
35
|
+
"@blaze-cms/plugin-search-ui": "0.134.0-core-styles.0",
|
|
36
|
+
"@blaze-cms/setup-ui": "0.134.0-core-styles.0",
|
|
37
|
+
"@blaze-cms/utils": "0.134.0-core-styles.0",
|
|
38
|
+
"@blaze-cms/utils-handlebars": "0.134.0-core-styles.2",
|
|
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": "0e53025db17bc36ed0850258975722875bdd43cd"
|
|
93
93
|
}
|
|
@@ -2,6 +2,7 @@ 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';
|
|
5
6
|
|
|
6
7
|
const AdSlotRender = ({
|
|
7
8
|
shouldShowBanner,
|
|
@@ -9,6 +10,7 @@ const AdSlotRender = ({
|
|
|
9
10
|
sizeId,
|
|
10
11
|
parsedAdunit,
|
|
11
12
|
parsedSizes,
|
|
13
|
+
modifiers,
|
|
12
14
|
targetingArguments
|
|
13
15
|
}) => {
|
|
14
16
|
const [{ loadingStatus = BANNER_LOADING, minHeight }, setLoadingStatus] = useState({});
|
|
@@ -24,11 +26,11 @@ const AdSlotRender = ({
|
|
|
24
26
|
})
|
|
25
27
|
.sort();
|
|
26
28
|
const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;
|
|
27
|
-
|
|
29
|
+
const newModifers = `${modifiers} banner-${loadingStatus}`;
|
|
28
30
|
return (
|
|
29
|
-
|
|
31
|
+
<Wrapper className="banner" modifiers={newModifers}>
|
|
30
32
|
{styles && <style>{styles.join('\n')}</style>}
|
|
31
|
-
<div className={className} style={{ minHeight }}>
|
|
33
|
+
<div className={className} style={{ minHeight }} data-testid="ad-slot">
|
|
32
34
|
{shouldShowBanner && (
|
|
33
35
|
<AdSlot
|
|
34
36
|
adUnit={parsedAdunit}
|
|
@@ -46,7 +48,7 @@ const AdSlotRender = ({
|
|
|
46
48
|
/>
|
|
47
49
|
)}
|
|
48
50
|
</div>
|
|
49
|
-
|
|
51
|
+
</Wrapper>
|
|
50
52
|
);
|
|
51
53
|
};
|
|
52
54
|
|
|
@@ -56,11 +58,13 @@ AdSlotRender.propTypes = {
|
|
|
56
58
|
sizeId: PropTypes.string.isRequired,
|
|
57
59
|
parsedAdunit: PropTypes.string.isRequired,
|
|
58
60
|
parsedSizes: PropTypes.array,
|
|
61
|
+
modifiers: PropTypes.string,
|
|
59
62
|
targetingArguments: PropTypes.object.isRequired
|
|
60
63
|
};
|
|
61
64
|
|
|
62
65
|
AdSlotRender.defaultProps = {
|
|
63
|
-
parsedSizes: null
|
|
66
|
+
parsedSizes: null,
|
|
67
|
+
modifiers: ''
|
|
64
68
|
};
|
|
65
69
|
|
|
66
70
|
export default AdSlotRender;
|
|
@@ -7,7 +7,6 @@ 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';
|
|
11
10
|
import BannerRender from './BannerRender';
|
|
12
11
|
import buildPropsQuery from '../../helpers/build-props-query';
|
|
13
12
|
import { getClassModifiers } from '../../utils';
|
|
@@ -47,16 +46,15 @@ const Banner = ({ type, ...otherProps }) => {
|
|
|
47
46
|
const bannerKey = `${sizeId}${asPath}`;
|
|
48
47
|
|
|
49
48
|
return (
|
|
50
|
-
<
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
</Wrapper>
|
|
49
|
+
<BannerRender
|
|
50
|
+
key={bannerKey}
|
|
51
|
+
{...otherProps}
|
|
52
|
+
action={action}
|
|
53
|
+
actionKey={actionKey}
|
|
54
|
+
asPath={asPath}
|
|
55
|
+
userPropsData={userPropsData}
|
|
56
|
+
modifiers={modifiers}
|
|
57
|
+
/>
|
|
60
58
|
);
|
|
61
59
|
};
|
|
62
60
|
|
|
@@ -34,6 +34,7 @@ const BannerRender = ({
|
|
|
34
34
|
actionKey,
|
|
35
35
|
renderCounter,
|
|
36
36
|
userPropsData,
|
|
37
|
+
modifiers,
|
|
37
38
|
...otherProps
|
|
38
39
|
}) => {
|
|
39
40
|
const { id } = otherProps;
|
|
@@ -90,6 +91,7 @@ const BannerRender = ({
|
|
|
90
91
|
sizeId={sizeId}
|
|
91
92
|
parsedAdunit={parsedAdunit}
|
|
92
93
|
parsedSizes={parsedSizes}
|
|
94
|
+
modifiers={modifiers}
|
|
93
95
|
targetingArguments={targetingArguments}
|
|
94
96
|
/>
|
|
95
97
|
);
|
|
@@ -108,6 +110,7 @@ BannerRender.propTypes = {
|
|
|
108
110
|
targetings: PropTypes.string,
|
|
109
111
|
sizes: PropTypes.string,
|
|
110
112
|
renderCounter: PropTypes.number,
|
|
113
|
+
modifiers: PropTypes.string,
|
|
111
114
|
userPropsData: PropTypes.object
|
|
112
115
|
};
|
|
113
116
|
|
|
@@ -120,6 +123,7 @@ BannerRender.defaultProps = {
|
|
|
120
123
|
targetings: '',
|
|
121
124
|
sizes: '',
|
|
122
125
|
renderCounter: null,
|
|
126
|
+
modifiers: '',
|
|
123
127
|
userPropsData: {}
|
|
124
128
|
};
|
|
125
129
|
|
|
@@ -45,11 +45,12 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
|
|
|
45
45
|
|
|
46
46
|
return propertiesToDisplay.map(key => {
|
|
47
47
|
const loopValue = loopValues[key];
|
|
48
|
-
const
|
|
48
|
+
const loopValueItem = loopValue && loopValue[i];
|
|
49
|
+
const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
|
|
49
50
|
if (!propValue) return null;
|
|
50
51
|
|
|
51
52
|
const processedValue = processDataSummaryValue(propValue, options);
|
|
52
|
-
const linkToPublishedContent = getLinkToPublishedContent(key, data);
|
|
53
|
+
const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);
|
|
53
54
|
return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
|
|
54
55
|
});
|
|
55
56
|
})
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
const getLinkToPublishedContent = (key = '', props = {}) => {
|
|
1
|
+
const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {
|
|
2
2
|
const [baseKey] = key.split('.');
|
|
3
3
|
if (!props[baseKey]) return '';
|
|
4
|
+
|
|
5
|
+
if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
|
|
6
|
+
|
|
4
7
|
const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
|
|
5
8
|
return content && content.url ? content.url : '';
|
|
6
9
|
};
|
|
@@ -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('DIV');
|
|
54
|
+
expect(getByTestId('ad-slot')).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,
|
|
61
|
+
const { asFragment, getByTestId } = render(<AdSlotRender {...defaultProps} />);
|
|
62
62
|
expect(getByTestId('adslot-test')).toBeDefined();
|
|
63
|
-
expect(
|
|
63
|
+
expect(getByTestId('ad-slot')).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
|
|
64
64
|
expect(asFragment()).toMatchSnapshot();
|
|
65
65
|
});
|
|
66
66
|
|
|
@@ -69,16 +69,11 @@ describe('Banner render component', () => {
|
|
|
69
69
|
const adSlot = getByTestId(slotTestId);
|
|
70
70
|
|
|
71
71
|
fireEvent.mouseOver(adSlot);
|
|
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');
|
|
72
|
+
await waitFor(() => expect(container.childNodes[0]).toHaveClass('banner banner-loaded'));
|
|
76
73
|
expect(asFragment()).toMatchSnapshot();
|
|
77
74
|
|
|
78
75
|
fireEvent.mouseLeave(adSlot);
|
|
79
|
-
await waitFor(() =>
|
|
80
|
-
expect(container.childNodes[0]).toHaveClass('ad-slot ad-slot-empty banner-sizeId')
|
|
81
|
-
);
|
|
76
|
+
await waitFor(() => expect(container.childNodes[0]).toHaveClass('banner banner-empty'));
|
|
82
77
|
expect(asFragment()).toMatchSnapshot();
|
|
83
78
|
});
|
|
84
79
|
});
|
|
@@ -3,13 +3,18 @@
|
|
|
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="
|
|
7
|
-
style="min-height: 250px;"
|
|
6
|
+
class="banner banner-loaded"
|
|
8
7
|
>
|
|
9
8
|
<div
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
class="ad-slot ad-slot-loaded banner-sizeId"
|
|
10
|
+
data-testid="ad-slot"
|
|
11
|
+
style="min-height: 250px;"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
data-testid="adslot-test"
|
|
15
|
+
role="button"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
13
18
|
</div>
|
|
14
19
|
</DocumentFragment>
|
|
15
20
|
`;
|
|
@@ -17,44 +22,59 @@ exports[`Banner render component AdSlot loading should change class and remove r
|
|
|
17
22
|
exports[`Banner render component AdSlot loading should change class and remove responsive styles after loaded events 2`] = `
|
|
18
23
|
<DocumentFragment>
|
|
19
24
|
<div
|
|
20
|
-
class="
|
|
21
|
-
style=""
|
|
25
|
+
class="banner banner-empty"
|
|
22
26
|
>
|
|
23
27
|
<div
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
class="ad-slot ad-slot-empty banner-sizeId"
|
|
29
|
+
data-testid="ad-slot"
|
|
30
|
+
style=""
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
data-testid="adslot-test"
|
|
34
|
+
role="button"
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
27
37
|
</div>
|
|
28
38
|
</DocumentFragment>
|
|
29
39
|
`;
|
|
30
40
|
|
|
31
41
|
exports[`Banner render component AdSlot loading should render AdSlot 1`] = `
|
|
32
42
|
<DocumentFragment>
|
|
33
|
-
<style>
|
|
34
|
-
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
35
|
-
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
36
|
-
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
37
|
-
</style>
|
|
38
43
|
<div
|
|
39
|
-
class="
|
|
44
|
+
class="banner banner-loading"
|
|
40
45
|
>
|
|
46
|
+
<style>
|
|
47
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
48
|
+
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
49
|
+
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
50
|
+
</style>
|
|
41
51
|
<div
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
53
|
+
data-testid="ad-slot"
|
|
54
|
+
>
|
|
55
|
+
<div
|
|
56
|
+
data-testid="adslot-test"
|
|
57
|
+
role="button"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
45
60
|
</div>
|
|
46
61
|
</DocumentFragment>
|
|
47
62
|
`;
|
|
48
63
|
|
|
49
64
|
exports[`Banner render component should not render AdSlot if shouldShowBanner=false but should render styles and wrapper 1`] = `
|
|
50
65
|
<DocumentFragment>
|
|
51
|
-
<
|
|
52
|
-
|
|
66
|
+
<div
|
|
67
|
+
class="banner banner-loading"
|
|
68
|
+
>
|
|
69
|
+
<style>
|
|
70
|
+
@media(min-width:320px){.banner-sizeId{min-height:100px;}
|
|
53
71
|
@media(min-width:728px){.banner-sizeId{min-height:100px;}
|
|
54
72
|
@media(min-width:970px){.banner-sizeId{min-height:250px;}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
</style>
|
|
74
|
+
<div
|
|
75
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
76
|
+
data-testid="ad-slot"
|
|
77
|
+
/>
|
|
78
|
+
</div>
|
|
59
79
|
</DocumentFragment>
|
|
60
80
|
`;
|
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`Banner render component should render 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<style />
|
|
6
5
|
<div
|
|
7
|
-
class="
|
|
8
|
-
|
|
6
|
+
class="banner banner-loading"
|
|
7
|
+
>
|
|
8
|
+
<style />
|
|
9
|
+
<div
|
|
10
|
+
class="ad-slot ad-slot-loading banner-sizeId"
|
|
11
|
+
data-testid="ad-slot"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
9
14
|
</DocumentFragment>
|
|
10
15
|
`;
|
|
@@ -90,4 +90,45 @@ 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
|
+
});
|
|
93
134
|
});
|
|
@@ -38,4 +38,25 @@ 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
|
+
});
|
|
41
62
|
});
|
|
@@ -0,0 +1,72 @@
|
|
|
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
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
});
|