@blaze-cms/react-page-builder 0.133.0 → 0.134.0-project-admin-customisations.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/lib/components/Banner/AdSlotRender.js +12 -3
  3. package/lib/components/Banner/AdSlotRender.js.map +1 -1
  4. package/lib/components/Banner/Banner.js +4 -7
  5. package/lib/components/Banner/Banner.js.map +1 -1
  6. package/lib/components/Banner/BannerRender.js +5 -1
  7. package/lib/components/Banner/BannerRender.js.map +1 -1
  8. package/lib/components/ContentGroupSection/ContentGroupSection.js +1 -4
  9. package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  10. package/lib/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  11. package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  12. package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
  13. package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  14. package/lib/components/SearchFilter/components/Checkbox.js +1 -3
  15. package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
  16. package/lib-es/components/Banner/AdSlotRender.js +12 -3
  17. package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
  18. package/lib-es/components/Banner/Banner.js +4 -7
  19. package/lib-es/components/Banner/Banner.js.map +1 -1
  20. package/lib-es/components/Banner/BannerRender.js +6 -2
  21. package/lib-es/components/Banner/BannerRender.js.map +1 -1
  22. package/lib-es/components/ContentGroupSection/ContentGroupSection.js +4 -8
  23. package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  24. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  25. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  26. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
  27. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  28. package/lib-es/components/SearchFilter/components/Checkbox.js +1 -3
  29. package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
  30. package/package.json +10 -10
  31. package/src/components/Banner/AdSlotRender.js +9 -5
  32. package/src/components/Banner/Banner.js +9 -11
  33. package/src/components/Banner/BannerRender.js +4 -0
  34. package/src/components/ContentGroupSection/ContentGroupSection.js +1 -1
  35. package/src/components/DataSummary/helpers/build-loop-props-content.js +3 -2
  36. package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
  37. package/src/components/SearchFilter/components/Checkbox.js +0 -2
  38. package/tests/unit/src/components/Banner/AdSlotRender.test.js +6 -11
  39. package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +45 -25
  40. package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +8 -3
  41. package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +41 -0
  42. package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
  43. package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
  44. package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","names":["React","useContext","MainContext","checkIfLoggedIn","PropTypes","flatten","useQuery","useRouter","buildUserQuery","buildPropsData","getSingleEntitySchema","getUser","Wrapper","BannerRender","buildPropsQuery","getClassModifiers","getEntityRenderProps","Banner","_ref","type","otherProps","_objectWithoutProperties","_excluded","router","isPreview","id","userId","asPath","parent","entity","sizeId","propsToDisplay","userPropsToDisplay","userQuery","itemEntity","data","error","loading","variables","userData","userLoading","skip","length","message","modifiers","queryProps","map","propertiesToDisplay","userPropsData","actionKey","action","bannerKey","createElement","className","_extends","key","propTypes","string","defaultProps"],"sources":["../../../src/components/Banner/Banner.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport PropTypes from 'prop-types';\nimport flatten from 'lodash.flatten';\nimport { useQuery } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { buildUserQuery, buildPropsData } from './helpers';\nimport { getSingleEntitySchema, getUser } from '../../application/query';\nimport Wrapper from '../Wrapper';\nimport BannerRender from './BannerRender';\nimport buildPropsQuery from '../../helpers/build-props-query';\nimport { getClassModifiers } from '../../utils';\nimport getEntityRenderProps from '../../helpers/get-entity-render-props';\n\nconst Banner = ({ type, ...otherProps }) => {\n const router = useRouter();\n const { isPreview } = useContext(MainContext);\n const { id: userId } = checkIfLoggedIn();\n const { asPath } = router;\n const { parent, entity, sizeId, propsToDisplay = [], userPropsToDisplay = [] } = otherProps;\n const userQuery = buildUserQuery(userPropsToDisplay);\n const { itemEntity } = parent;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity || itemEntity }\n });\n const { data: { getUser: userData } = {}, loading: userLoading } = useQuery(getUser(userQuery), {\n variables: { id: userId },\n skip: !userPropsToDisplay.length || !userId\n });\n\n if (loading || userLoading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!sizeId) return null;\n\n const modifiers = getClassModifiers('banner', otherProps);\n const queryProps = buildPropsQuery(\n data,\n propsToDisplay.length\n ? flatten(propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay))\n : []\n );\n\n const userPropsData = buildPropsData(userData, userPropsToDisplay);\n const { actionKey, action } = getEntityRenderProps(queryProps, data, isPreview);\n const bannerKey = `${sizeId}${asPath}`;\n\n return (\n <Wrapper className={type} modifiers={modifiers}>\n <BannerRender\n key={bannerKey}\n {...otherProps}\n action={action}\n actionKey={actionKey}\n asPath={asPath}\n userPropsData={userPropsData}\n />\n </Wrapper>\n );\n};\n\nBanner.propTypes = {\n type: PropTypes.string\n};\n\nBanner.defaultProps = {\n type: 'banner'\n};\n\nexport default Banner;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,WAAW,QAAQ,8BAA8B;A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A,MAAO;IACfqB,aAAa,EAAEA;EAAc,EAC9B,CACM,CAAC;AAEd,CAAC;AAED/B,MAAM,CAACuC,SAAS,GAAG;EACjBrC,IAAI,EAAEf,SAAS,CAACqD;AAClB,CAAC;AAEDxC,MAAM,CAACyC,YAAY,GAAG;EACpBvC,IAAI,EAAE;AACR,CAAC;AAED,eAAeF,MAAM"}
1
+ {"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,S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qB,IAAI,EACJJ,cAAc,CAACW,MAAM,GACjBpC,OAAO,CAACyB,cAAc,CAACe,GAAG,CAAC,CAAC;IAAEC;EAAoB,CAAC,KAAKA,mBAAmB,CAAC,CAAC,GAC7E,EACN,CAAC;EAED,MAAMC,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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Y;IACzBU,kBAAkB,EAAEA;EAAmB,CACxC,CAAC;AAEN,CAAC;AAED3C,YAAY,CAAC8C,SAAS,GAAG;EACvBrC,MAAM,EAAExB,SAAS,CAAC8D,MAAM,CAACC,UAAU;EACnCtC,MAAM,EAAEzB,SAAS,CAACgE,MAAM,CAACD,UAAU;EACnCrC,MAAM,EAAE1B,SAAS,CAAC8D,MAAM,CAACC,UAAU;EACnCpC,SAAS,EAAE3B,SAAS,CAACgE,MAAM,CAACD,UAAU;EACtC7C,MAAM,EAAElB,SAAS,CAACgE,MAAM;EACxB/C,UAAU,EAAEjB,SAAS,CAACgE,MAAM;EAC5B7C,MAAM,EAAEnB,SAAS,CAACgE,MAAM;EACxB3C,cAAc,EAAErB,SAAS,CAACiE,KAAK;EAC/B3C,MAAM,EAAEtB,SAAS,CAACgE,MAAM;EACxBzC,UAAU,EAAEvB,SAAS,CAACgE,MAAM;EAC5B5C,KAAK,EAAEpB,SAAS,CAACgE,MAAM;EACvBpC,aAAa,EAAE5B,SAAS,CAACkE,MAAM;EAC/BrC,aAAa,EAAE7B,SAAS,CAAC8D;AAC3B,CAAC;AAED/C,YAAY,CAACoD,YAAY,GAAG;EAC1BjD,MAAM,EAAE,EAAE;EACVD,UAAU,EAAE,EAAE;EACdE,MAAM,EAAE,EAAE;EACVE,cAAc,EAAE,EAAE;EAClBC,MAAM,EAAE,EAAE;EACVC,UAAU,EAAE,EAAE;EACdH,KAAK,EAAE,EAAE;EACTQ,aAAa,EAAE,IAAI;EACnBC,aAAa,EAAE,CAAC;AAClB,CAAC;AAED,eAAehB,SAAS,CAACE,YAAY,CAAC"}
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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";
2
- const _excluded = ["children", "name"];
3
1
  import React from 'react';
4
2
  import PropTypes from 'prop-types';
5
3
  import { hasChildren } from '../../helpers';
6
- const ContentGroupSection = _ref => {
7
- let {
8
- children,
9
- name
10
- } = _ref,
11
- props = _objectWithoutProperties(_ref, _excluded);
4
+ const ContentGroupSection = ({
5
+ children,
6
+ name
7
+ }) => {
12
8
  if (!hasChildren(children)) return null;
13
9
  return /*#__PURE__*/React.createElement("div", {
14
10
  key: name,
@@ -1 +1 @@
1
- {"version":3,"file":"ContentGroupSection.js","names":["React","PropTypes","hasChildren","ContentGroupSection","_ref","children","name","props","_objectWithoutProperties","_excluded","createElement","key","className","propTypes","oneOfType","arrayOf","node","string","defaultProps"],"sources":["../../../src/components/ContentGroupSection/ContentGroupSection.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { hasChildren } from '../../helpers';\n\nconst ContentGroupSection = ({ children, name, ...props }) => {\n if (!hasChildren(children)) return null;\n\n return (\n <div key={name} className=\"content-group-section\">\n {children}\n </div>\n );\n};\n\nContentGroupSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n name: PropTypes.string\n};\n\nContentGroupSection.defaultProps = { children: null, name: '' };\n\nexport default ContentGroupSection;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,mBAAmB,GAAGC,IAAA,IAAkC;EAAA,IAAjC;MAAEC,QAAQ;MAAEC;IAAe,CAAC,GAAAF,IAAA;IAAPG,KAAK,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EACrD,IAAI,CAACP,WAAW,CAACG,QAAQ,CAAC,EAAE,OAAO,IAAI;EAEvC,oBACEL,KAAA,CAAAU,aAAA;IAAKC,GAAG,EAAEL,IAAK;IAACM,SAAS,EAAC;EAAuB,GAC9CP,QACE,CAAC;AAEV,CAAC;AAEDF,mBAAmB,CAACU,SAAS,GAAG;EAC9BR,QAAQ,EAAEJ,SAAS,CAACa,SAAS,CAAC,CAACb,SAAS,CAACc,OAAO,CAACd,SAAS,CAACe,IAAI,CAAC,EAAEf,SAAS,CAACe,IAAI,CAAC,CAAC;EAClFV,IAAI,EAAEL,SAAS,CAACgB;AAClB,CAAC;AAEDd,mBAAmB,CAACe,YAAY,GAAG;EAAEb,QAAQ,EAAE,IAAI;EAAEC,IAAI,EAAE;AAAG,CAAC;AAE/D,eAAeH,mBAAmB"}
1
+ {"version":3,"file":"ContentGroupSection.js","names":["React","PropTypes","hasChildren","ContentGroupSection","children","name","createElement","key","className","propTypes","oneOfType","arrayOf","node","string","defaultProps"],"sources":["../../../src/components/ContentGroupSection/ContentGroupSection.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { hasChildren } from '../../helpers';\n\nconst ContentGroupSection = ({ children, name }) => {\n if (!hasChildren(children)) return null;\n\n return (\n <div key={name} className=\"content-group-section\">\n {children}\n </div>\n );\n};\n\nContentGroupSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n name: PropTypes.string\n};\n\nContentGroupSection.defaultProps = { children: null, name: '' };\n\nexport default ContentGroupSection;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,eAAe;AAE3C,MAAMC,mBAAmB,GAAGA,CAAC;EAAEC,QAAQ;EAAEC;AAAK,CAAC,KAAK;EAClD,IAAI,CAACH,WAAW,CAACE,QAAQ,CAAC,EAAE,OAAO,IAAI;EAEvC,oBACEJ,KAAA,CAAAM,aAAA;IAAKC,GAAG,EAAEF,IAAK;IAACG,SAAS,EAAC;EAAuB,GAC9CJ,QACE,CAAC;AAEV,CAAC;AAEDD,mBAAmB,CAACM,SAAS,GAAG;EAC9BL,QAAQ,EAAEH,SAAS,CAACS,SAAS,CAAC,CAACT,SAAS,CAACU,OAAO,CAACV,SAAS,CAACW,IAAI,CAAC,EAAEX,SAAS,CAACW,IAAI,CAAC,CAAC;EAClFP,IAAI,EAAEJ,SAAS,CAACY;AAClB,CAAC;AAEDV,mBAAmB,CAACW,YAAY,GAAG;EAAEV,QAAQ,EAAE,IAAI;EAAEC,IAAI,EAAE;AAAG,CAAC;AAE/D,eAAeF,mBAAmB"}
@@ -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 propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
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 propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,uBAAuB,QAAQ,kBAAkB;AAE1D,MAAMC,YAAY,GAAGC,KAAK,IAAI;EAC5B,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,OAAOA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EAAE;IACrC,MAAMC,UAAU,GAAG5B,OAAO,CACxBS,cAAc,CAACoB,GAAG,CAACd,OAAO,IAAI;MAC5B,MAAM;QAAEC,mBAAmB;QAAEc,KAAK;QAAEC,QAAQ,GAAG;MAAG,CAAC,GAAGhB,OAAO;MAE7D,OAAOC,mBAAmB,CAACa,GAAG,CAACG,GAAG,IAAI;QACpC,MAAMC,SAAS,GAAGpB,UAAU,CAACmB,GAAG,CAAC;QACjC,MAAME,SAAS,GAAGD,SAAS,GAAG5B,YAAY,CAAC4B,SAAS,CAACN,CAAC,CAAC,CAAC,GAAGf,aAAa,CAACoB,GAAG,CAAC;QAC7E,IAAI,CAACE,SAAS,EAAE,OAAO,IAAI;QAE3B,MAAMC,cAAc,GAAG/B,uBAAuB,CAAC8B,SAAS,EAAEnB,OAAO,CAAC;QAClE,MAAMqB,sBAAsB,GAAGnC,yBAAyB,CAAC+B,GAAG,EAAErB,IAAI,CAAC;QACnE,OAAO,CAACZ,UAAU,CAAC+B,KAAK,CAAC,EAAEK,cAAc,EAAEC,sBAAsB,EAAEL,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACM,MAAM,CAACC,OAAO,CAAC;IACjBb,oBAAoB,CAACc,IAAI,CAACX,UAAU,CAAC;EACvC;EAEA,OAAO5B,OAAO,CAACyB,oBAAoB,CAAC;AACtC,CAAC;AAED,eAAeF,qBAAqB"}
1
+ {"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,gBAAgB;AACpC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,i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EAAEC,SAAS,EAAEC,IAAI,CAAC;EAEnF,MAAMe,SAAS,GAAGxB,iBAAiB,CAACW,UAAU,EAAEW,KAAK,CAAC;EAEtD,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,SAAS,EAAEC,CAAC,IAAI,CAAC,EAAE;IACrC,MAAMC,UAAU,GAAG5B,OAAO,CACxBS,cAAc,CAACoB,GAAG,CAACd,OAAO,IAAI;MAC5B,MAAM;QAAEC,mBAAmB;QAAEc,KAAK;QAAEC,QAAQ,GAAG;MAAG,CAAC,GAAGhB,OAAO;MAE7D,OAAOC,mBAAmB,CAACa,GAAG,CAACG,GAAG,IAAI;QACpC,MAAMC,SAAS,GAAGpB,UAAU,CAACmB,GAAG,CAAC;QACjC,MAAME,aAAa,GAAGD,SAAS,IAAIA,SAAS,CAACN,CAAC,CAAC;QAC/C,MAAMQ,SAAS,GAAGD,aAAa,GAAG7B,YAAY,CAAC6B,aAAa,CAAC,GAAGtB,aAAa,CAACoB,GAAG,CAAC;QAClF,IAAI,CAACG,SAAS,EAAE,OAAO,IAAI;QAE3B,MAAMC,cAAc,GAAGhC,uBAAuB,CAAC+B,SAAS,EAAEpB,OAAO,CAAC;QAClE,MAAMsB,sBAAsB,GAAGpC,yBAAyB,CAAC+B,GAAG,EAAErB,IAAI,EAAEuB,aAAa,CAAC;QAClF,OAAO,CAACnC,UAAU,CAAC+B,KAAK,CAAC,EAAEM,cAAc,EAAEC,sBAAsB,EAAEN,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACO,MAAM,CAACC,OAAO,CAAC;IACjBd,oBAAoB,CAACe,IAAI,CAACZ,UAAU,CAAC;EACvC;EAEA,OAAO5B,OAAO,CAACyB,oBAAoB,CAAC;AACtC,CAAC;AAED,eAAeF,qBAAqB"}
@@ -1,6 +1,7 @@
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
+ 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","url"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];\n return content && content.url ? content.url : '';\n};\n\nexport default getLinkToPublishedContent;\n"],"mappings":"AAAA,MAAMA,yBAAyB,GAAGA,CAACC,GAAG,GAAG,EAAE,EAAEC,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1D,MAAM,CAACC,OAAO,CAAC,GAAGF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC;EAChC,IAAI,CAACF,KAAK,CAACC,OAAO,CAAC,EAAE,OAAO,EAAE;EAC9B,MAAME,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACC,OAAO,CAAC,CAAC,GAAGD,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGD,KAAK,CAACC,OAAO,CAAC;EAClF,OAAOE,OAAO,IAAIA,OAAO,CAACG,GAAG,GAAGH,OAAO,CAACG,GAAG,GAAG,EAAE;AAClD,CAAC;AAED,eAAeR,yBAAyB"}
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"}
@@ -56,9 +56,7 @@ const Checkbox = ({
56
56
  disabled: value[2]
57
57
  }));
58
58
  const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;
59
- return /*#__PURE__*/React.createElement(React.Fragment, null, elementTitle && /*#__PURE__*/React.createElement("div", {
60
- className: "heading heading--section"
61
- }, elementTitle), label ? /*#__PURE__*/React.createElement("p", null, label) : '', /*#__PURE__*/React.createElement(Checkboxes, {
59
+ return /*#__PURE__*/React.createElement(React.Fragment, null, label ? /*#__PURE__*/React.createElement("p", null, label) : '', /*#__PURE__*/React.createElement(Checkboxes, {
62
60
  className: "form-checkbox",
63
61
  options: multiple,
64
62
  onChange: ({
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","names":["React","useState","PropTypes","upperFirst","Checkboxes","FaChevronDown","FaChevronUp","withTitle","decodeValue","LIMIT_MIN","LIMIT_MAX","MORE","LESS","Checkbox","data","prop","updateFilterValues","filterValues","label","elementTitle","shouldSearch","displayFilterCount","checkboxLimit","setCheckboxLimit","handleCheckboxOptions","checkboxQueryParams","map","val","multiple","sortedValues","buckets","key","doc_count","count","optionLabel","filter","Boolean","sort","forEach","value","i","push","name","checked","includes","id","disabled","shouldDisplayMore","createElement","Fragment","className","options","onChange","eData","newCheckboxValues","length","role","onClick","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Checkbox.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport upperFirst from 'lodash.upperfirst';\nimport { Checkboxes } from '@blaze-react/checkboxes';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { withTitle } from '../../../HOC';\nimport { decodeValue } from '../helpers';\nimport { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';\n\nconst Checkbox = ({\n data,\n prop,\n updateFilterValues,\n filterValues,\n label,\n elementTitle,\n shouldSearch,\n displayFilterCount\n}) => {\n const [checkboxLimit, setCheckboxLimit] = useState(null);\n if (!data[prop]) return null;\n\n const handleCheckboxOptions = () => {\n if (checkboxLimit[prop] === LIMIT_MIN) {\n setCheckboxLimit({ [prop]: LIMIT_MAX });\n } else {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n };\n\n if (!checkboxLimit) {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n\n if (!checkboxLimit) return null;\n\n let checkboxQueryParams = [];\n\n if (filterValues && filterValues[prop]) {\n checkboxQueryParams =\n typeof filterValues[prop] === 'string'\n ? [decodeValue(filterValues[prop])]\n : filterValues[prop].map(val => decodeValue(val));\n }\n const multiple = [];\n\n const sortedValues = data[prop].buckets\n .map(({ key, doc_count: count }) => {\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel, !count];\n })\n .filter(Boolean)\n .sort();\n\n sortedValues.forEach(\n (value, i) =>\n i < checkboxLimit[prop] &&\n multiple.push({\n label: upperFirst(value[1]),\n value: value[0],\n name: prop,\n checked: checkboxQueryParams.includes(value[0]),\n id: value[0],\n disabled: value[2]\n })\n );\n\n const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;\n\n return (\n <>\n {elementTitle && <div className=\"heading heading--section\">{elementTitle}</div>}\n {label ? <p>{label}</p> : ''}\n <Checkboxes\n className=\"form-checkbox\"\n options={multiple}\n onChange={({ data: eData }) => {\n const newCheckboxValues = eData\n .filter(({ checked }) => checked)\n .map(({ value }) => value);\n updateFilterValues({ [prop]: newCheckboxValues }, shouldSearch);\n }}\n />\n {data[prop].buckets.length > LIMIT_MIN && (\n <div role=\"button\" className=\"see-more\" onClick={handleCheckboxOptions}>\n {shouldDisplayMore ? (\n <>\n <i>\n <FaChevronDown className=\"inline-icon\" />\n </i>\n {` See ${MORE}`}\n </>\n ) : (\n <>\n <i>\n <FaChevronUp className=\"inline-icon\" />\n </i>\n {` See ${LESS}`}\n </>\n )}\n </div>\n )}\n </>\n );\n};\n\nCheckbox.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n displayFilterCount: PropTypes.bool\n};\n\nCheckbox.defaultProps = {\n shouldSearch: false,\n label: '',\n elementTitle: '',\n displayFilterCount: false\n};\n\nexport default withTitle(Checkbox);\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,aAAa,EAAEC,WAAW,QAAQ,gBAAgB;AAC3D,SAASC,SAAS,QAA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EACvB1C,YAAY,EAAEjB,SAAS,CAAC2D,MAAM;EAC9BxC,kBAAkB,EAAEnB,SAAS,CAAC6D;AAChC,CAAC;AAEDlD,QAAQ,CAACmD,YAAY,GAAG;EACtB5C,YAAY,EAAE,KAAK;EACnBF,KAAK,EAAE,EAAE;EACTC,YAAY,EAAE,EAAE;EAChBE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAed,SAAS,CAACM,QAAQ,CAAC"}
1
+ {"version":3,"file":"Checkbox.js","names":["React","useState","PropTypes","upperFirst","Checkboxes","FaChevronDown","FaChevronUp","withTitle","decodeValue","LIMIT_MIN","LIMIT_MAX","MORE","LESS","Checkbox","data","prop","updateFilterValues","filterValues","label","elementTitle","shouldSearch","displayFilterCount","checkboxLimit","setCheckboxLimit","handleCheckboxOptions","checkboxQueryParams","map","val","multiple","sortedValues","buckets","key","doc_count","count","optionLabel","filter","Boolean","sort","forEach","value","i","push","name","checked","includes","id","disabled","shouldDisplayMore","createElement","Fragment","className","options","onChange","eData","newCheckboxValues","length","role","onClick","propTypes","object","isRequired","string","func","bool","defaultProps"],"sources":["../../../../src/components/SearchFilter/components/Checkbox.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport upperFirst from 'lodash.upperfirst';\nimport { Checkboxes } from '@blaze-react/checkboxes';\nimport { FaChevronDown, FaChevronUp } from 'react-icons/fa';\nimport { withTitle } from '../../../HOC';\nimport { decodeValue } from '../helpers';\nimport { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';\n\nconst Checkbox = ({\n data,\n prop,\n updateFilterValues,\n filterValues,\n label,\n elementTitle,\n shouldSearch,\n displayFilterCount\n}) => {\n const [checkboxLimit, setCheckboxLimit] = useState(null);\n if (!data[prop]) return null;\n\n const handleCheckboxOptions = () => {\n if (checkboxLimit[prop] === LIMIT_MIN) {\n setCheckboxLimit({ [prop]: LIMIT_MAX });\n } else {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n };\n\n if (!checkboxLimit) {\n setCheckboxLimit({ [prop]: LIMIT_MIN });\n }\n\n if (!checkboxLimit) return null;\n\n let checkboxQueryParams = [];\n\n if (filterValues && filterValues[prop]) {\n checkboxQueryParams =\n typeof filterValues[prop] === 'string'\n ? [decodeValue(filterValues[prop])]\n : filterValues[prop].map(val => decodeValue(val));\n }\n const multiple = [];\n\n const sortedValues = data[prop].buckets\n .map(({ key, doc_count: count }) => {\n const optionLabel = displayFilterCount ? `${key} (${count})` : key;\n return [key, optionLabel, !count];\n })\n .filter(Boolean)\n .sort();\n\n sortedValues.forEach(\n (value, i) =>\n i < checkboxLimit[prop] &&\n multiple.push({\n label: upperFirst(value[1]),\n value: value[0],\n name: prop,\n checked: checkboxQueryParams.includes(value[0]),\n id: value[0],\n disabled: value[2]\n })\n );\n\n const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;\n return (\n <>\n {label ? <p>{label}</p> : ''}\n <Checkboxes\n className=\"form-checkbox\"\n options={multiple}\n onChange={({ data: eData }) => {\n const newCheckboxValues = eData\n .filter(({ checked }) => checked)\n .map(({ value }) => value);\n updateFilterValues({ [prop]: newCheckboxValues }, shouldSearch);\n }}\n />\n {data[prop].buckets.length > LIMIT_MIN && (\n <div role=\"button\" className=\"see-more\" onClick={handleCheckboxOptions}>\n {shouldDisplayMore ? (\n <>\n <i>\n <FaChevronDown className=\"inline-icon\" />\n </i>\n {` See ${MORE}`}\n </>\n ) : (\n <>\n <i>\n <FaChevronUp className=\"inline-icon\" />\n </i>\n {` See ${LESS}`}\n </>\n )}\n </div>\n )}\n </>\n );\n};\n\nCheckbox.propTypes = {\n data: PropTypes.object.isRequired,\n prop: PropTypes.string.isRequired,\n filterValues: PropTypes.object.isRequired,\n updateFilterValues: PropTypes.func.isRequired,\n shouldSearch: PropTypes.bool,\n label: PropTypes.string,\n elementTitle: PropTypes.string,\n displayFilterCount: PropTypes.bool\n};\n\nCheckbox.defaultProps = {\n shouldSearch: false,\n label: '',\n el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,EAAEf,SAAS,CAACyD,MAAM,CAACC,UAAU;EACzC5C,kBAAkB,EAAEd,SAAS,CAAC4D,IAAI,CAACF,UAAU;EAC7CxC,YAAY,EAAElB,SAAS,CAAC6D,IAAI;EAC5B7C,KAAK,EAAEhB,SAAS,CAAC2D,MAAM;EACvB1C,YAAY,EAAEjB,SAAS,CAAC2D,MAAM;EAC9BxC,kBAAkB,EAAEnB,SAAS,CAAC6D;AAChC,CAAC;AAEDlD,QAAQ,CAACmD,YAAY,GAAG;EACtB5C,YAAY,EAAE,KAAK;EACnBF,KAAK,EAAE,EAAE;EACTC,YAAY,EAAE,EAAE;EAChBE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAed,SAAS,CAACM,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blaze-cms/react-page-builder",
3
- "version": "0.133.0",
3
+ "version": "0.134.0-project-admin-customisations.0",
4
4
  "description": "Blaze react page builder",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-es/index.js",
@@ -27,15 +27,15 @@
27
27
  },
28
28
  "license": "GPL-3.0",
29
29
  "dependencies": {
30
- "@blaze-cms/core-auth-ui": "^0.131.0",
31
- "@blaze-cms/core-errors": "^0.131.0",
32
- "@blaze-cms/core-errors-ui": "^0.131.0",
30
+ "@blaze-cms/core-auth-ui": "0.134.0-project-admin-customisations.0",
31
+ "@blaze-cms/core-errors": "0.134.0-project-admin-customisations.0",
32
+ "@blaze-cms/core-errors-ui": "0.134.0-project-admin-customisations.0",
33
33
  "@blaze-cms/image-cdn-react": "0.3.0-alpha.5",
34
- "@blaze-cms/nextjs-components": "^0.133.0",
35
- "@blaze-cms/plugin-search-ui": "^0.133.0",
36
- "@blaze-cms/setup-ui": "^0.131.0",
37
- "@blaze-cms/utils": "^0.131.0",
38
- "@blaze-cms/utils-handlebars": "^0.133.0",
34
+ "@blaze-cms/nextjs-components": "0.134.0-project-admin-customisations.0",
35
+ "@blaze-cms/plugin-search-ui": "0.134.0-project-admin-customisations.0",
36
+ "@blaze-cms/setup-ui": "0.134.0-project-admin-customisations.0",
37
+ "@blaze-cms/utils": "0.134.0-project-admin-customisations.0",
38
+ "@blaze-cms/utils-handlebars": "0.134.0-project-admin-customisations.0",
39
39
  "@blaze-react/breadcrumb": "0.8.0-alpha.60",
40
40
  "@blaze-react/button": "0.5.19",
41
41
  "@blaze-react/checkboxes": "0.5.31",
@@ -89,5 +89,5 @@
89
89
  "lib/*",
90
90
  "lib-es/*"
91
91
  ],
92
- "gitHead": "d1265256eafcf99954599ab9b12d1cc165929cb9"
92
+ "gitHead": "ed7ba9d56aee2c4913b8204b0181fdc8c5975d94"
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
- <Wrapper className={type} modifiers={modifiers}>
51
- <BannerRender
52
- key={bannerKey}
53
- {...otherProps}
54
- action={action}
55
- actionKey={actionKey}
56
- asPath={asPath}
57
- userPropsData={userPropsData}
58
- />
59
- </Wrapper>
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
 
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { hasChildren } from '../../helpers';
4
4
 
5
- const ContentGroupSection = ({ children, name, ...props }) => {
5
+ const ContentGroupSection = ({ children, name }) => {
6
6
  if (!hasChildren(children)) return null;
7
7
 
8
8
  return (
@@ -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 propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
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
  };
@@ -66,10 +66,8 @@ const Checkbox = ({
66
66
  );
67
67
 
68
68
  const shouldDisplayMore = !checkboxLimit || checkboxLimit[prop] === LIMIT_MIN;
69
-
70
69
  return (
71
70
  <>
72
- {elementTitle && <div className="heading heading--section">{elementTitle}</div>}
73
71
  {label ? <p>{label}</p> : ''}
74
72
  <Checkboxes
75
73
  className="form-checkbox"
@@ -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('STYLE');
54
- expect(container.childNodes[1]).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
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, container, getByTestId } = render(<AdSlotRender {...defaultProps} />);
61
+ const { asFragment, getByTestId } = render(<AdSlotRender {...defaultProps} />);
62
62
  expect(getByTestId('adslot-test')).toBeDefined();
63
- expect(container.childNodes[1]).toHaveClass('ad-slot ad-slot-loading banner-sizeId');
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
  });