@blaze-cms/react-page-builder 0.133.0-project-admin-customisations.0 → 0.134.0-admin-updates.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 (93) hide show
  1. package/CHANGELOG.md +90 -5
  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/Button.js +3 -1
  9. package/lib/components/Button.js.map +1 -1
  10. package/lib/components/ContentGroupSection/ContentGroupSection.js +4 -1
  11. package/lib/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  12. package/lib/components/List/helpers/get-sort-props.js +9 -6
  13. package/lib/components/List/helpers/get-sort-props.js.map +1 -1
  14. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +2 -2
  15. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  16. package/lib/components/SearchFilter/SearchFilterContainer.js +58 -22
  17. package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  18. package/lib/components/SearchFilter/helpers/build-filters-query.js +18 -16
  19. package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  20. package/lib/components/SearchFilter/helpers/build-url-query.js +3 -2
  21. package/lib/components/SearchFilter/helpers/build-url-query.js.map +1 -1
  22. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +33 -0
  23. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
  24. package/lib/components/SearchFilter/helpers/get-updated-filter-by.js +38 -0
  25. package/lib/components/SearchFilter/helpers/get-updated-filter-by.js.map +1 -0
  26. package/lib/components/SearchFilter/helpers/index.js +8 -1
  27. package/lib/components/SearchFilter/helpers/index.js.map +1 -1
  28. package/lib/components/SocialFollow/sf.config.js +2 -1
  29. package/lib/components/SocialFollow/sf.config.js.map +1 -1
  30. package/lib/helpers/build-raw-query.js +7 -6
  31. package/lib/helpers/build-raw-query.js.map +1 -1
  32. package/lib/helpers/build-sort-values.js +4 -1
  33. package/lib/helpers/build-sort-values.js.map +1 -1
  34. package/lib-es/components/Banner/AdSlotRender.js +12 -3
  35. package/lib-es/components/Banner/AdSlotRender.js.map +1 -1
  36. package/lib-es/components/Banner/Banner.js +4 -7
  37. package/lib-es/components/Banner/Banner.js.map +1 -1
  38. package/lib-es/components/Banner/BannerRender.js +6 -2
  39. package/lib-es/components/Banner/BannerRender.js.map +1 -1
  40. package/lib-es/components/Button.js +2 -1
  41. package/lib-es/components/Button.js.map +1 -1
  42. package/lib-es/components/ContentGroupSection/ContentGroupSection.js +8 -4
  43. package/lib-es/components/ContentGroupSection/ContentGroupSection.js.map +1 -1
  44. package/lib-es/components/List/helpers/get-sort-props.js +9 -6
  45. package/lib-es/components/List/helpers/get-sort-props.js.map +1 -1
  46. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +3 -3
  47. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  48. package/lib-es/components/SearchFilter/SearchFilterContainer.js +54 -13
  49. package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  50. package/lib-es/components/SearchFilter/helpers/build-filters-query.js +18 -16
  51. package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  52. package/lib-es/components/SearchFilter/helpers/build-url-query.js +1 -2
  53. package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +1 -1
  54. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +21 -0
  55. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -0
  56. package/lib-es/components/SearchFilter/helpers/get-updated-filter-by.js +19 -0
  57. package/lib-es/components/SearchFilter/helpers/get-updated-filter-by.js.map +1 -0
  58. package/lib-es/components/SearchFilter/helpers/index.js +3 -2
  59. package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
  60. package/lib-es/components/SocialFollow/sf.config.js +3 -2
  61. package/lib-es/components/SocialFollow/sf.config.js.map +1 -1
  62. package/lib-es/helpers/build-raw-query.js +5 -4
  63. package/lib-es/helpers/build-raw-query.js.map +1 -1
  64. package/lib-es/helpers/build-sort-values.js +1 -1
  65. package/lib-es/helpers/build-sort-values.js.map +1 -1
  66. package/package.json +12 -12
  67. package/src/components/Banner/AdSlotRender.js +9 -5
  68. package/src/components/Banner/Banner.js +9 -11
  69. package/src/components/Banner/BannerRender.js +4 -0
  70. package/src/components/Button.js +6 -1
  71. package/src/components/ContentGroupSection/ContentGroupSection.js +1 -1
  72. package/src/components/List/helpers/get-sort-props.js +4 -6
  73. package/src/components/SearchFilter/SearchFilter/SearchFilter.js +6 -3
  74. package/src/components/SearchFilter/SearchFilterContainer.js +42 -14
  75. package/src/components/SearchFilter/helpers/build-filters-query.js +23 -20
  76. package/src/components/SearchFilter/helpers/build-url-query.js +1 -3
  77. package/src/components/SearchFilter/helpers/get-initial-filter-values.js +24 -0
  78. package/src/components/SearchFilter/helpers/get-updated-filter-by.js +18 -0
  79. package/src/components/SearchFilter/helpers/index.js +5 -3
  80. package/src/components/SocialFollow/sf.config.js +2 -2
  81. package/src/helpers/build-raw-query.js +5 -1
  82. package/src/helpers/build-sort-values.js +1 -1
  83. package/tests/unit/src/components/Banner/AdSlotRender.test.js +6 -11
  84. package/tests/unit/src/components/Banner/__snapshots__/AdSlotRender.test.js.snap +45 -25
  85. package/tests/unit/src/components/Banner/__snapshots__/BannerRender.test.js.snap +8 -3
  86. package/tests/unit/src/components/List/helpers/get-sort-props.test.js +23 -0
  87. package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +6 -0
  88. package/tests/unit/src/components/SearchFilter/helpers/get-updated-filter-by.test.js +28 -0
  89. package/tests/unit/src/components/SocialFollow/__snapshots__/SocialFollow.test.js.snap +1 -1
  90. package/tests/unit/src/helpers/build-raw-query.test.js +70 -1
  91. package/tests/unit/src/helpers/build-sort-values.test.js +20 -0
  92. package/tests/unit/src/helpers/get-generic-render-variables.test.js +25 -0
  93. /package/tests/unit/src/components/SearchFilter/helpers/{build-new-query.test.js → build-new-url.test.js} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sf.config.js","names":["_fa","require","BASE_CLASS_NAME_FOLLOW","exports","PORTRAIT","LANDSCAPE","SOCIAL_NETWORKS","facebook","name","className","Icon","FaFacebookF","spanClassName","twitter","FaTwitter","pinterest","FaPinterestP","instagram","FaInstagram","linkedin","FaLinkedinIn","youtube","FaYoutube","tiktok","FaTiktok"],"sources":["../../../src/components/SocialFollow/sf.config.js"],"sourcesContent":["import {\n FaFacebookF,\n FaTwitter,\n FaPinterestP,\n FaInstagram,\n FaLinkedinIn,\n FaYoutube,\n FaTiktok\n} from 'react-icons/fa';\n\nexport const BASE_CLASS_NAME_FOLLOW = 'social__list-item social__list-item--follow';\nexport const PORTRAIT = 'portrait';\nexport const LANDSCAPE = 'landscape';\n\nexport const SOCIAL_NETWORKS = {\n facebook: {\n name: 'Facebook',\n className: 'facebook',\n Icon: FaFacebookF,\n spanClassName: 'hidden'\n },\n twitter: {\n name: 'Twitter',\n className: 'twitter',\n Icon: FaTwitter,\n spanClassName: 'hidden'\n },\n pinterest: {\n name: 'Pinterest',\n className: 'pinterest',\n Icon: FaPinterestP,\n spanClassName: 'hidden'\n },\n instagram: {\n name: 'Instagram',\n className: 'instagram',\n Icon: FaInstagram,\n spanClassName: 'hidden'\n },\n linkedin: {\n name: 'Linkedin',\n className: 'linkedin',\n Icon: FaLinkedinIn,\n spanClassName: 'hidden'\n },\n youtube: {\n name: 'YouTube',\n className: 'youtube',\n Icon: FaYoutube,\n spanClassName: 'hidden'\n },\n tiktok: {\n name: 'TikTok',\n className: 'tiktok',\n Icon: FaTiktok,\n spanClassName: 'hidden'\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAUO,IAAMC,sBAAsB,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LANDSCAPE","SOCIAL_NETWORKS","facebook","name","className","Icon","FaFacebookF","spanClassName","twitter","FaXTwitter","pinterest","FaPinterestP","instagram","FaInstagram","linkedin","FaLinkedinIn","youtube","FaYoutube","tiktok","FaTiktok"],"sources":["../../../src/components/SocialFollow/sf.config.js"],"sourcesContent":["import {\n FaFacebookF,\n FaPinterestP,\n FaInstagram,\n FaLinkedinIn,\n FaYoutube,\n FaTiktok\n} from 'react-icons/fa';\nimport { FaXTwitter } from 'react-icons/fa6';\n\nexport const BASE_CLASS_NAME_FOLLOW = 'social__list-item social__list-item--follow';\nexport const PORTRAIT = 'portrait';\nexport const LANDSCAPE = 'landscape';\n\nexport const SOCIAL_NETWORKS = {\n facebook: {\n name: 'Facebook',\n className: 'facebook',\n Icon: FaFacebookF,\n spanClassName: 'hidden'\n },\n twitter: {\n name: 'Twitter',\n className: 'twitter',\n Icon: FaXTwitter,\n spanClassName: 'hidden'\n },\n pinterest: {\n name: 'Pinterest',\n className: 'pinterest',\n Icon: FaPinterestP,\n spanClassName: 'hidden'\n },\n instagram: {\n name: 'Instagram',\n className: 'instagram',\n Icon: FaInstagram,\n spanClassName: 'hidden'\n },\n linkedin: {\n name: 'Linkedin',\n className: 'linkedin',\n Icon: FaLinkedinIn,\n spanClassName: 'hidden'\n },\n youtube: {\n name: 'YouTube',\n className: 'youtube',\n Icon: FaYoutube,\n spanClassName: 'hidden'\n },\n tiktok: {\n name: 'TikTok',\n className: 'tiktok',\n Icon: FaTiktok,\n spanClassName: 'hidden'\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAQA,IAAAC,IAAA,GAAAD,OAAA;AAEO,IAAME,sBAAsB,GAAG,6CAA6C;AAACC,OAAA,CAAAD,sBAAA,GAAAA,sBAAA;AAC7E,IAAME,QAAQ,GAAG,UAAU;AAACD,OAAA,CAAAC,QAAA,GAAAA,QAAA;AAC5B,IAAMC,SAAS,GAAG,WAAW;AAACF,OAAA,CAAAE,SAAA,GAAAA,SAAA;AAE9B,IAAMC,eAAe,GAAG;EAC7BC,QAAQ,EAAE;IACRC,IAAI,EAAE,UAAU;IAChBC,SAAS,EAAE,UAAU;IACrBC,IAAI,EAAEC,eAAW;IACjBC,aAAa,EAAE;EACjB,CAAC;EACDC,OAAO,EAAE;IACPL,IAAI,EAAE,SAAS;IACfC,SAAS,EAAE,SAAS;IACpBC,IAAI,EAAEI,eAAU;IAChBF,aAAa,EAAE;EACjB,CAAC;EACDG,SAAS,EAAE;IACTP,IAAI,EAAE,WAAW;IACjBC,SAAS,EAAE,WAAW;IACtBC,IAAI,EAAEM,gBAAY;IAClBJ,aAAa,EAAE;EACjB,CAAC;EACDK,SAAS,EAAE;IACTT,IAAI,EAAE,WAAW;IACjBC,SAAS,EAAE,WAAW;IACtBC,IAAI,EAAEQ,eAAW;IACjBN,aAAa,EAAE;EACjB,CAAC;EACDO,QAAQ,EAAE;IACRX,IAAI,EAAE,UAAU;IAChBC,SAAS,EAAE,UAAU;IACrBC,IAAI,EAAEU,gBAAY;IAClBR,aAAa,EAAE;EACjB,CAAC;EACDS,OAAO,EAAE;IACPb,IAAI,EAAE,SAAS;IACfC,SAAS,EAAE,SAAS;IACpBC,IAAI,EAAEY,aAAS;IACfV,aAAa,EAAE;EACjB,CAAC;EACDW,MAAM,EAAE;IACNf,IAAI,EAAE,QAAQ;IACdC,SAAS,EAAE,QAAQ;IACnBC,IAAI,EAAEc,YAAQ;IACdZ,aAAa,EAAE;EACjB;AACF,CAAC;AAACT,OAAA,CAAAG,eAAA,GAAAA,eAAA"}
@@ -47,13 +47,14 @@ var buildRawQuery = function buildRawQuery(_ref) {
47
47
  isAZ = _ref2.isAZ,
48
48
  _ref2$sortProperties = _ref2.sortProperties,
49
49
  sortProperties = _ref2$sortProperties === void 0 ? [] : _ref2$sortProperties;
50
- var _sortProperties = (0, _slicedToArray2["default"])(sortProperties, 1),
51
- _sortProperties$ = _sortProperties[0],
52
- _sortProperties$2 = _sortProperties$ === void 0 ? {
50
+ var sortPropertyToUse = isAZ && sortProperties[0] && sortProperties[0].isScore ? 1 : 0;
51
+ var _ref3 = sortProperties[sortPropertyToUse] || {
53
52
  propsToDisplay: []
54
- } : _sortProperties$,
55
- _sortProperties$2$pro = (0, _slicedToArray2["default"])(_sortProperties$2.propsToDisplay, 1),
56
- azSortProp = _sortProperties$2$pro[0];
53
+ },
54
+ _ref3$propsToDisplay = _ref3.propsToDisplay,
55
+ _ref3$propsToDisplay2 = _ref3$propsToDisplay === void 0 ? [] : _ref3$propsToDisplay,
56
+ _ref3$propsToDisplay3 = (0, _slicedToArray2["default"])(_ref3$propsToDisplay2, 1),
57
+ azSortProp = _ref3$propsToDisplay3[0];
57
58
  var azSortProperty = azSortProp || _constants.AZ_DEFAULT_PROP;
58
59
  var searchValuesTextCheckboxSelectJoined = operator === _constants.AND_OPERATOR ? [].concat((0, _toConsumableArray2["default"])(searchValuesText), (0, _toConsumableArray2["default"])(searchValuesCheckboxSelectRange)) : [];
59
60
  var searchValuesTextCheckboxOr = searchValuesText;
@@ -1 +1 @@
1
- {"version":3,"file":"build-raw-query.js","names":["_buildRawQueryBase","_interopRequireDefault","require","_getItemsToDisplayIds","_getExtraAzBits","_buildAzFilter","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","buildRawQuery","_ref","docType","operator","searchValues","filterData","id","itemsToDisplay","shouldApplySort","azOptions","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","filterValues","filterOperator","relations","stringProps","azFilter","_ref2","isAZ","_ref2$sortProperties","sortProperties","_sortProperties","_slicedToArray2","_sortProperties$","_sortProperties$2","propsToDisplay","_sortProperties$2$pro","azSortProp","azSortProperty","AZ_DEFAULT_PROP","searchValuesTextCheckboxSelectJoined","AND_OPERATOR","concat","_toConsumableArray2","searchValuesTextCheckboxOr","finalValue","finalValueWithCheckboxOrValues","must","bool","should","finalValueIfNoCheckboxOrValues","mustValues","buildAzFilter","query","buildRawQueryBase","azQueryBits","getExtraAzBits","itemsToDisplayIds","getItemsToDisplayIds","ids","values","sort","_script","type","script","lang","source","params","sortOrder","order","_default","exports"],"sources":["../../src/helpers/build-raw-query.js"],"sourcesContent":["import buildRawQueryBase from './build-raw-query-base';\nimport getItemsToDisplayIds from './get-items-to-display-ids';\nimport getExtraAzBits from './get-extra-az-bits';\nimport buildAzFilter from './build-az-filter';\nimport { AND_OPERATOR, AZ_DEFAULT_PROP } from '../constants';\n\nconst buildRawQuery = ({\n docType,\n operator,\n searchValues,\n filterData,\n id,\n itemsToDisplay,\n shouldApplySort,\n azOptions\n}) => {\n const {\n searchValuesText,\n searchValuesCheckboxSelectRange,\n searchValuesCheckboxOr\n } = searchValues;\n const { filterValues, filterOperator, relations, stringProps, azFilter } = filterData;\n const { isAZ, sortProperties = [] } = azOptions || {};\n const [{ propsToDisplay: [azSortProp] } = { propsToDisplay: [] }] = sortProperties;\n const azSortProperty = azSortProp || AZ_DEFAULT_PROP;\n\n const searchValuesTextCheckboxSelectJoined =\n operator === AND_OPERATOR ? [...searchValuesText, ...searchValuesCheckboxSelectRange] : [];\n let searchValuesTextCheckboxOr = searchValuesText;\n if (searchValuesCheckboxOr.length) {\n searchValuesTextCheckboxOr = [...searchValuesText, ...searchValuesCheckboxOr];\n }\n\n let finalValue;\n\n if (searchValuesTextCheckboxSelectJoined.length) {\n const finalValueWithCheckboxOrValues = {\n must: [...searchValuesTextCheckboxSelectJoined, { bool: { should: searchValuesCheckboxOr } }]\n };\n const finalValueIfNoCheckboxOrValues = { must: searchValuesTextCheckboxSelectJoined };\n finalValue = searchValuesCheckboxOr.length\n ? finalValueWithCheckboxOrValues\n : finalValueIfNoCheckboxOrValues;\n } else {\n finalValue = {\n must: [...searchValuesCheckboxSelectRange, { bool: { should: searchValuesTextCheckboxOr } }]\n };\n }\n const mustValues = [\n {\n bool: finalValue\n }\n ];\n\n buildAzFilter(azFilter, mustValues, azSortProperty);\n\n const query = {\n bool: {\n must: mustValues,\n ...buildRawQueryBase({ docType, id, filterValues, filterOperator, relations, stringProps })\n }\n };\n const azQueryBits = getExtraAzBits({ ...azOptions, azSortProperty, azFilter });\n\n if (itemsToDisplay && itemsToDisplay.length) {\n const itemsToDisplayIds = getItemsToDisplayIds(itemsToDisplay);\n\n query.bool.must.push({ ids: { values: itemsToDisplayIds } });\n if (shouldApplySort) {\n return {\n query,\n sort: {\n _script: {\n type: 'number',\n script: {\n lang: 'painless',\n source:\n \"!doc['id.keyword'].empty ? params.sortOrder.indexOf(doc['id.keyword'].value) : 0\",\n params: {\n sortOrder: itemsToDisplayIds\n }\n },\n order: 'asc'\n }\n },\n ...azQueryBits\n };\n }\n }\n\n return isAZ\n ? {\n query,\n ...azQueryBits\n }\n : query;\n};\n\nexport default buildRawQuery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAA6D,SAAAK,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,CA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cACpFC,MAAM,EAAE;gBACNC,SAAS,EAAEX;cACb;YACF,CAAC;YACDY,KAAK,EAAE;UACT;QACF;MAAC,GACEd,WAAW;IAElB;EACF;EAEA,OAAO3B,IAAI,GAAA3B,aAAA;IAELoD,KAAK,EAALA;EAAK,GACFE,WAAW,IAEhBF,KAAK;AACX,CAAC;AAAC,IAAAiB,QAAA,GAEa7D,aAAa;AAAA8D,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"build-raw-query.js","names":["_buildRawQueryBase","_interopRequireDefault","require","_getItemsToDisplayIds","_getExtraAzBits","_buildAzFilter","_constants","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","buildRawQuery","_ref","docType","operator","searchValues","filterData","id","itemsToDisplay","shouldApplySort","azOptions","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","filterValues","filterOperator","relations","stringProps","azFilter","_ref2","isAZ","_ref2$sortProperties","sortProperties","sortPropertyToUse","isScore","_ref3","propsToDisplay","_ref3$propsToDisplay","_ref3$propsToDisplay2","_ref3$propsToDisplay3","_slicedToArray2","azSortProp","azSortProperty","AZ_DEFAULT_PROP","searchValuesTextCheckboxSelectJoined","AND_OPERATOR","concat","_toConsumableArray2","searchValuesTextCheckboxOr","finalValue","finalValueWithCheckboxOrValues","must","bool","should","finalValueIfNoCheckboxOrValues","mustValues","buildAzFilter","query","buildRawQueryBase","azQueryBits","getExtraAzBits","itemsToDisplayIds","getItemsToDisplayIds","ids","values","sort","_script","type","script","lang","source","params","sortOrder","order","_default","exports"],"sources":["../../src/helpers/build-raw-query.js"],"sourcesContent":["import buildRawQueryBase from './build-raw-query-base';\nimport getItemsToDisplayIds from './get-items-to-display-ids';\nimport getExtraAzBits from './get-extra-az-bits';\nimport buildAzFilter from './build-az-filter';\nimport { AND_OPERATOR, AZ_DEFAULT_PROP } from '../constants';\n\nconst buildRawQuery = ({\n docType,\n operator,\n searchValues,\n filterData,\n id,\n itemsToDisplay,\n shouldApplySort,\n azOptions\n}) => {\n const {\n searchValuesText,\n searchValuesCheckboxSelectRange,\n searchValuesCheckboxOr\n } = searchValues;\n const { filterValues, filterOperator, relations, stringProps, azFilter } = filterData;\n\n const { isAZ, sortProperties = [] } = azOptions || {};\n const sortPropertyToUse = isAZ && sortProperties[0] && sortProperties[0].isScore ? 1 : 0;\n const { propsToDisplay: [azSortProp] = [] } = sortProperties[sortPropertyToUse] || {\n propsToDisplay: []\n };\n const azSortProperty = azSortProp || AZ_DEFAULT_PROP;\n\n const searchValuesTextCheckboxSelectJoined =\n operator === AND_OPERATOR ? [...searchValuesText, ...searchValuesCheckboxSelectRange] : [];\n let searchValuesTextCheckboxOr = searchValuesText;\n if (searchValuesCheckboxOr.length) {\n searchValuesTextCheckboxOr = [...searchValuesText, ...searchValuesCheckboxOr];\n }\n\n let finalValue;\n\n if (searchValuesTextCheckboxSelectJoined.length) {\n const finalValueWithCheckboxOrValues = {\n must: [...searchValuesTextCheckboxSelectJoined, { bool: { should: searchValuesCheckboxOr } }]\n };\n const finalValueIfNoCheckboxOrValues = { must: searchValuesTextCheckboxSelectJoined };\n finalValue = searchValuesCheckboxOr.length\n ? finalValueWithCheckboxOrValues\n : finalValueIfNoCheckboxOrValues;\n } else {\n finalValue = {\n must: [...searchValuesCheckboxSelectRange, { bool: { should: searchValuesTextCheckboxOr } }]\n };\n }\n const mustValues = [\n {\n bool: finalValue\n }\n ];\n\n buildAzFilter(azFilter, mustValues, azSortProperty);\n\n const query = {\n bool: {\n must: mustValues,\n ...buildRawQueryBase({ docType, id, filterValues, filterOperator, relations, stringProps })\n }\n };\n const azQueryBits = getExtraAzBits({ ...azOptions, azSortProperty, azFilter });\n\n if (itemsToDisplay && itemsToDisplay.length) {\n const itemsToDisplayIds = getItemsToDisplayIds(itemsToDisplay);\n\n query.bool.must.push({ ids: { values: itemsToDisplayIds } });\n if (shouldApplySort) {\n return {\n query,\n sort: {\n _script: {\n type: 'number',\n script: {\n lang: 'painless',\n source:\n \"!doc['id.keyword'].empty ? params.sortOrder.indexOf(doc['id.keyword'].value) : 0\",\n params: {\n sortOrder: itemsToDisplayIds\n }\n },\n order: 'asc'\n }\n },\n ...azQueryBits\n };\n }\n }\n\n return isAZ\n ? {\n query,\n ...azQueryBits\n }\n : query;\n};\n\nexport default buildRawQuery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAA6D,SAAAK,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,CAA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,GAAA3B,aAAA;IAELsD,KAAK,EAALA;EAAK,GACFE,WAAW,IAEhBF,KAAK;AACX,CAAC;AAAC,IAAAiB,QAAA,GAEa/D,aAAa;AAAAgE,OAAA,cAAAD,QAAA"}
@@ -14,6 +14,7 @@ require("core-js/modules/es.array.join.js");
14
14
  require("core-js/modules/es.array.filter.js");
15
15
  require("core-js/modules/es.array.map.js");
16
16
  require("core-js/modules/es.array.concat.js");
17
+ require("core-js/modules/es.array.index-of.js");
17
18
  var _getSortByFieldName = _interopRequireDefault(require("./get-sort-by-field-name"));
18
19
  var buildAzSort = function buildAzSort(sortFilters, relations, stringProps) {
19
20
  var sortValues = {};
@@ -39,7 +40,9 @@ var buildSortValues = function buildSortValues(sortFilters, relations, stringPro
39
40
  if (!sort) return null;
40
41
  var sortFieldName = (0, _getSortByFieldName["default"])(relations, propsToDisplay, stringProps);
41
42
  return sortFieldName ? "".concat(sortFieldName, ":").concat(sort.toLowerCase()) : null;
42
- }).filter(Boolean).join(',');
43
+ }).filter(function (item, index, arr) {
44
+ return !item ? false : arr.indexOf(item) === index;
45
+ }).join(',');
43
46
  return {
44
47
  sort: sortValues
45
48
  };
@@ -1 +1 @@
1
- {"version":3,"file":"build-sort-values.js","names":["_getSortByFieldName","_interopRequireDefault","require","buildAzSort","sortFilters","relations","stringProps","sortValues","forEach","_ref","sort","propsToDisplay","sortFieldName","getSortbyFieldName","toLowerCase","buildSortValues","useSortObject","length","map","_ref2","isScore","concat","filter","Boolean","join","_default","exports"],"sources":["../../src/helpers/build-sort-values.js"],"sourcesContent":["import getSortbyFieldName from './get-sort-by-field-name';\n\nconst buildAzSort = (sortFilters, relations, stringProps) => {\n const sortValues = {};\n sortFilters.forEach(({ sort, propsToDisplay }) => {\n if (!sort) return;\n const sortFieldName = getSortbyFieldName(relations, propsToDisplay, stringProps);\n if (sortFieldName) sortValues[sortFieldName] = sort.toLowerCase();\n });\n\n return sortValues;\n};\n\nconst buildSortValues = (sortFilters, relations, stringProps, useSortObject) => {\n if (!sortFilters || !sortFilters.length) return useSortObject ? null : { sort: [] };\n if (useSortObject) return buildAzSort(sortFilters, relations, stringProps);\n\n const sortValues = sortFilters\n .map(({ sort, propsToDisplay, isScore }) => {\n if (isScore) return '_score';\n if (!sort) return null;\n\n const sortFieldName = getSortbyFieldName(relations, propsToDisplay, stringProps);\n return sortFieldName ? `${sortFieldName}:${sort.toLowerCase()}` : null;\n })\n .filter(Boolean)\n .join(',');\n\n return { sort: sortValues };\n};\n\nexport default buildSortValues;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAK;EAC3D,IAAMC,UAAU,GAAG,CAAC,CAAC;EACrBH,WAAW,CAACI,OAAO,CAAC,UAAAC,IAAA,EAA8B;IAAA,IAA3BC,IAAI,GAAAD,IAAA,CAAJC,IAAI;MAAEC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACzC,IAAI,CAACD,IAAI,EAAE;IACX,IAAME,aAAa,GAAG,IAAAC,8BAAkB,EAACR,SAAS,EAAEM,cAAc,EAAEL,WAAW,CAAC;IAChF,IAAIM,aAAa,EAAEL,UAAU,CAACK,aAAa,CAAC,GAAGF,IAAI,CAACI,WAAW,CAAC,CAAC;EACnE,CAAC,CAAC;EAEF,OAAOP,UAAU;AACnB,CAAC;AAED,IAAMQ,eAAe,GAAG,SAAlBA,eAAeA,CAAIX,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAEU,aAAa,EAAK;EAC9E,IAAI,CAACZ,WAAW,IAAI,CAACA,WAAW,CAACa,MAAM,EAAE,OAAOD,aAAa,GAAG,IAAI,GAAG;IAAEN,IAAI,EAAE;EAAG,CAAC;EACnF,IAAIM,aAAa,EAAE,OAAOb,WAAW,CAACC,WAAW,EAAEC,SAAS,EAAEC,WAAW,CAAC;EAE1E,IAAMC,UAAU,GAAGH,WAAW,CAC3Bc,GAAG,CAAC,UAAAC,KAAA,EAAuC;IAAA,IAApCT,IAAI,GAAAS,KAAA,CAAJT,IAAI;MAAEC,cAAc,GAAAQ,KAAA,CAAdR,cAAc;MAAES,OAAO,GAAAD,KAAA,CAAPC,OAAO;IACnC,IAAIA,OAAO,EAAE,OAAO,QAAQ;IAC5B,IAAI,CAACV,IAAI,EAAE,OAAO,IAAI;IAEtB,IAAME,aAAa,GAAG,IAAAC,8BAAkB,EAACR,SAAS,EAAEM,cAAc,EAAEL,WAAW,CAAC;IAChF,OAAOM,aAAa,MAAAS,MAAA,CAAMT,aAAa,OAAAS,MAAA,CAAIX,IAAI,CAACI,WAAW,CAAC,CAAC,IAAK,IAAI;EACxE,CAAC,CAAC,CACDQ,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,GAAG,CAAC;EAEZ,OAAO;IAAEd,IAAI,EAAEH;EAAW,CAAC;AAC7B,CAAC;AAAC,IAAAkB,QAAA,GAEaV,eAAe;AAAAW,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"build-sort-values.js","names":["_getSortByFieldName","_interopRequireDefault","require","buildAzSort","sortFilters","relations","stringProps","sortValues","forEach","_ref","sort","propsToDisplay","sortFieldName","getSortbyFieldName","toLowerCase","buildSortValues","useSortObject","length","map","_ref2","isScore","concat","filter","item","index","arr","indexOf","join","_default","exports"],"sources":["../../src/helpers/build-sort-values.js"],"sourcesContent":["import getSortbyFieldName from './get-sort-by-field-name';\n\nconst buildAzSort = (sortFilters, relations, stringProps) => {\n const sortValues = {};\n sortFilters.forEach(({ sort, propsToDisplay }) => {\n if (!sort) return;\n const sortFieldName = getSortbyFieldName(relations, propsToDisplay, stringProps);\n if (sortFieldName) sortValues[sortFieldName] = sort.toLowerCase();\n });\n\n return sortValues;\n};\n\nconst buildSortValues = (sortFilters, relations, stringProps, useSortObject) => {\n if (!sortFilters || !sortFilters.length) return useSortObject ? null : { sort: [] };\n if (useSortObject) return buildAzSort(sortFilters, relations, stringProps);\n\n const sortValues = sortFilters\n .map(({ sort, propsToDisplay, isScore }) => {\n if (isScore) return '_score';\n if (!sort) return null;\n\n const sortFieldName = getSortbyFieldName(relations, propsToDisplay, stringProps);\n return sortFieldName ? `${sortFieldName}:${sort.toLowerCase()}` : null;\n })\n .filter((item, index, arr) => (!item ? false : arr.indexOf(item) === index))\n .join(',');\n\n return { sort: sortValues };\n};\n\nexport default buildSortValues;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAK;EAC3D,IAAMC,UAAU,GAAG,CAAC,CAAC;EACrBH,WAAW,CAACI,OAAO,CAAC,UAAAC,IAAA,EAA8B;IAAA,IAA3BC,IAAI,GAAAD,IAAA,CAAJC,IAAI;MAAEC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACzC,IAAI,CAACD,IAAI,EAAE;IACX,IAAME,aAAa,GAAG,IAAAC,8BAAkB,EAACR,SAAS,EAAEM,cAAc,EAAEL,WAAW,CAAC;IAChF,IAAIM,aAAa,EAAEL,UAAU,CAACK,aAAa,CAAC,GAAGF,IAAI,CAACI,WAAW,CAAC,CAAC;EACnE,CAAC,CAAC;EAEF,OAAOP,UAAU;AACnB,CAAC;AAED,IAAMQ,eAAe,GAAG,SAAlBA,eAAeA,CAAIX,WAAW,EAAEC,SAAS,EAAEC,WAAW,EAAEU,aAAa,EAAK;EAC9E,IAAI,CAACZ,WAAW,IAAI,CAACA,WAAW,CAACa,MAAM,EAAE,OAAOD,aAAa,GAAG,IAAI,GAAG;IAAEN,IAAI,EAAE;EAAG,CAAC;EACnF,IAAIM,aAAa,EAAE,OAAOb,WAAW,CAACC,WAAW,EAAEC,SAAS,EAAEC,WAAW,CAAC;EAE1E,IAAMC,UAAU,GAAGH,WAAW,CAC3Bc,GAAG,CAAC,UAAAC,KAAA,EAAuC;IAAA,IAApCT,IAAI,GAAAS,KAAA,CAAJT,IAAI;MAAEC,cAAc,GAAAQ,KAAA,CAAdR,cAAc;MAAES,OAAO,GAAAD,KAAA,CAAPC,OAAO;IACnC,IAAIA,OAAO,EAAE,OAAO,QAAQ;IAC5B,IAAI,CAACV,IAAI,EAAE,OAAO,IAAI;IAEtB,IAAME,aAAa,GAAG,IAAAC,8BAAkB,EAACR,SAAS,EAAEM,cAAc,EAAEL,WAAW,CAAC;IAChF,OAAOM,aAAa,MAAAS,MAAA,CAAMT,aAAa,OAAAS,MAAA,CAAIX,IAAI,CAACI,WAAW,CAAC,CAAC,IAAK,IAAI;EACxE,CAAC,CAAC,CACDQ,MAAM,CAAC,UAACC,IAAI,EAAEC,KAAK,EAAEC,GAAG;IAAA,OAAM,CAACF,IAAI,GAAG,KAAK,GAAGE,GAAG,CAACC,OAAO,CAACH,IAAI,CAAC,KAAKC,KAAK;EAAA,CAAC,CAAC,CAC3EG,IAAI,CAAC,GAAG,CAAC;EAEZ,OAAO;IAAEjB,IAAI,EAAEH;EAAW,CAAC;AAC7B,CAAC;AAAC,IAAAqB,QAAA,GAEab,eAAe;AAAAc,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
- return /*#__PURE__*/React.createElement(React.Fragment, null, styles && /*#__PURE__*/React.createElement("style", null, styles.join('\n')), /*#__PURE__*/React.createElement("div", {
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","createElement","Fragment","join","style","adUnit","onSlotRender","slotData","event","isEmpty","size","slotHeight","length","undefined","newLoadingStatus","propTypes","bool","isRequired","array","string","object","defaultProps"],"sources":["../../../src/components/Banner/AdSlotRender.js"],"sourcesContent":["import React, { useState } from 'react';\nimport { AdSlot } from 'react-dfp';\nimport PropTypes from 'prop-types';\nimport { BANNER_LOADING, BANNER_EMPTY, BANNER_LOADED } from '../../constants';\n\nconst AdSlotRender = ({\n shouldShowBanner,\n sizeMapping,\n sizeId,\n parsedAdunit,\n parsedSizes,\n targetingArguments\n}) => {\n const [{ loadingStatus = BANNER_LOADING, minHeight }, setLoadingStatus] = useState({});\n\n const bannerClass = `banner-${sizeId}`;\n\n const styles =\n loadingStatus === BANNER_LOADING &&\n sizeMapping\n .map(({ sizes: styleSizes, viewport: [minWidth] }) => {\n const minimumHeight = Math.min(...styleSizes.map(([, height]) => height));\n return `@media(min-width:${minWidth}px){.${bannerClass}{min-height:${minimumHeight}px;}`;\n })\n .sort();\n const className = `ad-slot ad-slot-${loadingStatus} ${bannerClass}`;\n\n return (\n <>\n {styles && <style>{styles.join('\\n')}</style>}\n <div className={className} style={{ minHeight }}>\n {shouldShowBanner && (\n <AdSlot\n adUnit={parsedAdunit}\n sizes={parsedSizes}\n targetingArguments={targetingArguments}\n sizeMapping={sizeMapping}\n onSlotRender={slotData => {\n const {\n event: { isEmpty, size }\n } = slotData;\n const slotHeight = size && size.length ? size[1] : undefined;\n const newLoadingStatus = isEmpty ? BANNER_EMPTY : BANNER_LOADED;\n setLoadingStatus({ loadingStatus: newLoadingStatus, minHeight: slotHeight });\n }}\n />\n )}\n </div>\n </>\n );\n};\n\nAdSlotRender.propTypes = {\n shouldShowBanner: PropTypes.bool.isRequired,\n sizeMapping: PropTypes.array.isRequired,\n sizeId: PropTypes.string.isRequired,\n parsedAdunit: PropTypes.string.isRequired,\n parsedSizes: PropTypes.array,\n targetingArguments: PropTypes.object.isRequired\n};\n\nAdSlotRender.defaultProps = {\n parsedSizes: null\n};\n\nexport default AdSlotRender;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,MAAM,QAAQ,WAAW;AAClC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,cAAc,EAAEC,YAAY,EAAEC,aAAa,QAAQ,iBAAiB;AAE7E,MAAMC,YAAY,GAAGA,CA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AAK;MACzB,CAAC,GAAGH,QAAQ;MACZ,MAAMI,UAAU,GAAGD,IAAI,IAAIA,IAAI,CAACE,MAAM,GAAGF,IAAI,CAAC,CAAC,CAAC,GAAGG,SAAS;MAC5D,MAAMC,gBAAgB,GAAGL,OAAO,GAAGjC,YAAY,GAAGC,aAAa;MAC/DU,gBAAgB,CAAC;QAAEF,aAAa,EAAE6B,gBAAgB;QAAE5B,SAAS,EAAEyB;MAAW,CAAC,CAAC;IAC9E;EAAE,CACH,CAEA,CACL,CAAC;AAEP,CAAC;AAEDjC,YAAY,CAACqC,SAAS,GAAG;EACvBpC,gBAAgB,EAAEL,SAAS,CAAC0C,IAAI,CAACC,UAAU;EAC3CrC,WAAW,EAAEN,SAAS,CAAC4C,KAAK,CAACD,UAAU;EACvCpC,MAAM,EAAEP,SAAS,CAAC6C,MAAM,CAACF,UAAU;EACnCnC,YAAY,EAAER,SAAS,CAAC6C,MAAM,CAACF,UAAU;EACzClC,WAAW,EAAET,SAAS,CAAC4C,KAAK;EAC5BlC,kBAAkB,EAAEV,SAAS,CAAC8C,MAAM,CAACH;AACvC,CAAC;AAEDvC,YAAY,CAAC2C,YAAY,GAAG;EAC1BtC,WAAW,EAAE;AACf,CAAC;AAED,eAAeL,YAAY"}
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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{ 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(Wrapper, {
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","Wrapper","BannerRender","buildPropsQuery","getClassModifiers","getEntityRenderProps","Banner","_ref","type","otherProps","_objectWithoutProperties","_excluded","router","isPreview","id","userId","asPath","parent","entity","sizeId","propsToDisplay","userPropsToDisplay","userQuery","itemEntity","data","error","loading","variables","userData","userLoading","skip","length","message","modifiers","queryProps","map","propertiesToDisplay","userPropsData","actionKey","action","bannerKey","createElement","className","_extends","key","propTypes","string","defaultProps"],"sources":["../../../src/components/Banner/Banner.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { checkIfLoggedIn } from '@blaze-cms/core-auth-ui';\nimport PropTypes from 'prop-types';\nimport flatten from 'lodash.flatten';\nimport { useQuery } from '@apollo/client';\nimport { useRouter } from 'next/router';\nimport { buildUserQuery, buildPropsData } from './helpers';\nimport { getSingleEntitySchema, getUser } from '../../application/query';\nimport Wrapper from '../Wrapper';\nimport BannerRender from './BannerRender';\nimport buildPropsQuery from '../../helpers/build-props-query';\nimport { getClassModifiers } from '../../utils';\nimport getEntityRenderProps from '../../helpers/get-entity-render-props';\n\nconst Banner = ({ type, ...otherProps }) => {\n const router = useRouter();\n const { isPreview } = useContext(MainContext);\n const { id: userId } = checkIfLoggedIn();\n const { asPath } = router;\n const { parent, entity, sizeId, propsToDisplay = [], userPropsToDisplay = [] } = otherProps;\n const userQuery = buildUserQuery(userPropsToDisplay);\n const { itemEntity } = parent;\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity || itemEntity }\n });\n const { data: { getUser: userData } = {}, loading: userLoading } = useQuery(getUser(userQuery), {\n variables: { id: userId },\n skip: !userPropsToDisplay.length || !userId\n });\n\n if (loading || userLoading) return '';\n if (error) return error.message;\n if (!data) return null;\n if (!sizeId) return null;\n\n const modifiers = getClassModifiers('banner', otherProps);\n const queryProps = buildPropsQuery(\n data,\n propsToDisplay.length\n ? flatten(propsToDisplay.map(({ propertiesToDisplay }) => propertiesToDisplay))\n : []\n );\n\n const userPropsData = buildPropsData(userData, userPropsToDisplay);\n const { actionKey, action } = getEntityRenderProps(queryProps, data, isPreview);\n const bannerKey = `${sizeId}${asPath}`;\n\n return (\n <Wrapper className={type} modifiers={modifiers}>\n <BannerRender\n key={bannerKey}\n {...otherProps}\n action={action}\n actionKey={actionKey}\n asPath={asPath}\n userPropsData={userPropsData}\n />\n </Wrapper>\n );\n};\n\nBanner.propTypes = {\n type: PropTypes.string\n};\n\nBanner.defaultProps = {\n type: 'banner'\n};\n\nexport default Banner;\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,eAAe,QAAQ,yBAAyB;AACzD,OAAOC,SAAS,MA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Ed,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,SAAA;EACnC,MAAMC,MAAM,GAAGf,SAAS,CAAC,CAAC;EAC1B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,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;AAClB,SACEC,kBAAkB,EAClBC,yBAAyB,EACzBC,UAAU,EACVC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;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,iBAAiB,EACjBC,gBAAgB,EAChBC,mBAAmB,QACd,WAAW;AACl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EAAEA,WAAY;IACzBnB,SAAS,EAAEA,SAAU;IACrB6B,kBAAkB,EAAEA;EAAmB,CACxC,CAAC;AAEN,CAAC;AAED5C,YAAY,CAAC+C,SAAS,GAAG;EACvBtC,MAAM,EAAExB,SAAS,CAAC+D,MAAM,CAACC,UAAU;EACnCvC,MAAM,EAAEzB,SAAS,CAACiE,MAAM,CAACD,UAAU;EACnCtC,MAAM,EAAE1B,SAAS,CAAC+D,MAAM,CAACC,UAAU;EACnCrC,SAAS,EAAE3B,SAAS,CAACiE,MAAM,CAACD,UAAU;EACtC9C,MAAM,EAAElB,SAAS,CAACiE,MAAM;EACxBhD,UAAU,EAAEjB,SAAS,CAACiE,MAAM;EAC5B9C,MAAM,EAAEnB,SAAS,CAACiE,MAAM;EACxB5C,cAAc,EAAErB,SAAS,CAACkE,KAAK;EAC/B5C,MAAM,EAAEtB,SAAS,CAACiE,MAAM;EACxB1C,UAAU,EAAEvB,SAAS,CAACiE,MAAM;EAC5B7C,KAAK,EAAEpB,SAAS,CAACiE,MAAM;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"}
@@ -56,7 +56,8 @@ const Button = props => {
56
56
  const logout = () => {
57
57
  handleLogout(client);
58
58
  if (hasChildren(children)) return setShowChildren(true);
59
- return url ? router.reload(urlToUse) : router.reload();
59
+ if (!urlToUse) return router.reload();
60
+ return urlToUse.startsWith('/') ? router.push('/Resolver', urlToUse) : window.location.href = urlToUse;
60
61
  };
61
62
  const handleClick = () => {
62
63
  if (isLogoutButton) logout();
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["React","useState","Fragment","useEffect","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","useStringTemplate","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties","_excluded","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","data","textToUse","afterClickTextToUse","urlToUse","asPath","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","_objectSpread","currentProps","href","title","DynamicButton","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","createElement","className","_extends","onClick","propTypes","object","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n if (hasChildren(children)) return setShowChildren(true);\n return url ? router.reload(urlToUse) : router.reload();\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: urlToUse, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, parent.itemId, parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickTextToUse : textToUse}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n parent: PropTypes.object,\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n parent: {},\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n icon: '',\n style: '',\n children: [],\n childSeoVisibility: false\n};\n\nexport default withTitle(Button);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC5D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,SAAS,IAAIC,IAAI,EAAEC,MAAM,QAAQ,YAAY;AACpD,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,SAASC,MAAM,QAAQ,cAAc;AACrC,SACEC,cAAc,EACdC,qBAAqB,EACrBC,WAAW,EACXC,sBAAsB,QACjB,YAAY;AAEnB,MAAMC,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;MACJC,IAAI;MACJC,IAAI;MACJC,GAAG;MACHC,IAAI;MACJC,IAAI;MACJC,KAAK;MACLC,QAAQ;MACRC,WAAW;MACXC,kBAAkB;MAClBC,cAAc;MACdC;IAEF,CAAC,GAAGX,KAAK;IADJY,UAAU,GAAAC,wBAAA,CACXb,KAAK,EAAAc,SAAA;EACT,MAAMC,MAAM,GAAG9B,eAAe,CAAC,CAAC;EAChC,MAAM+B,MAAM,GAAGnC,SAAS,CAAC,CAAC;EAC1B,MAAMo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,CAAAuE,aAAA;IAAGC,SAAS,EAAE5C;EAAK,CAAE,CAAC,EAC9BiB,YAAY,GAAGI,mBAAmB,GAAGD,SACzB,CACR,CAAC;AAEd,CAAC;AAEDzB,MAAM,CAACoD,SAAS,GAAG;EACjBxC,MAAM,EAAEzB,SAAS,CAACkE,MAAM;EACxB5C,WAAW,EAAEtB,SAAS,CAACE,MAAM;EAC7Bc,IAAI,EAAEhB,SAAS,CAACE,MAAM;EACtBsB,cAAc,EAAEtB,MAAM;EACtBiB,IAAI,EAAEnB,SAAS,CAACE,MAAM;EACtBa,IAAI,EAAEf,SAAS,CAACE,MAAM;EACtBe,GAAG,EAAEjB,SAAS,CAACE,MAAM;EACrBiE,IAAI,EAAEnE,SAAS,CAACE,MAAM;EACtBgB,IAAI,EAAElB,SAAS,CAACE,MAAM;EACtBkB,KAAK,EAAEpB,SAAS,CAACE,MAAM;EACvBqB,kBAAkB,EAAEtB,IAAI;EACxBoB,QAAQ,EAAErB,SAAS,CAACoE,SAAS,CAAC,CAACpE,SAAS,CAACqE,OAAO,CAACrE,SAAS,CAACsE,IAAI,CAAC,EAAEtE,SAAS,CAACsE,IAAI,CAAC;AACnF,CAAC;AAEDzD,MAAM,CAAC0D,YAAY,GAAG;EACpB9C,MAAM,EAAE,CAAC,CAAC;EACVH,WAAW,EAAE,EAAE;EACfN,IAAI,EAAE,EAAE;EACRQ,cAAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRJ,IAAI,EAAE,EAAE;EACRE,GAAG,EAAE,IAAI;EACTkD,IAAI,EAAE,EAAE;EACRjD,IAAI,EAAE,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAejB,SAAS,CAACO,MAAM,CAAC"}
1
+ {"version":3,"file":"Button.js","names":["React","useState","Fragment","useEffect","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","useStringTemplate","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties","_excluded","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","data","textToUse","afterClickTextToUse","urlToUse","asPath","checkIfButtonShouldRender","logout","reload","startsWith","push","window","location","href","handleClick","buttonType","modifiers","_objectSpread","currentProps","title","DynamicButton","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","createElement","className","_extends","onClick","propTypes","object","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n if (hasChildren(children)) return setShowChildren(true);\n\n if (!urlToUse) return router.reload();\n\n return urlToUse.startsWith('/')\n ? router.push('/Resolver', urlToUse)\n : (window.location.href = urlToUse);\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: urlToUse, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, parent.itemId, parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickTextToUse : textToUse}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n parent: PropTypes.object,\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n parent: {},\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n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B,YAAY,GAAGI,mBAAmB,GAAGD,SACzB,CACR,CAAC;AAEd,CAAC;AAEDzB,MAAM,CAACwD,SAAS,GAAG;EACjB5C,MAAM,EAAEzB,SAAS,CAACsE,MAAM;EACxBhD,WAAW,EAAEtB,SAAS,CAACE,MAAM;EAC7Bc,IAAI,EAAEhB,SAAS,CAACE,MAAM;EACtBsB,cAAc,EAAEtB,MAAM;EACtBiB,IAAI,EAAEnB,SAAS,CAACE,MAAM;EACtBa,IAAI,EAAEf,SAAS,CAACE,MAAM;EACtBe,GAAG,EAAEjB,SAAS,CAACE,MAAM;EACrBqE,IAAI,EAAEvE,SAAS,CAACE,MAAM;EACtBgB,IAAI,EAAElB,SAAS,CAACE,MAAM;EACtBkB,KAAK,EAAEpB,SAAS,CAACE,MAAM;EACvBqB,kBAAkB,EAAEtB,IAAI;EACxBoB,QAAQ,EAAErB,SAAS,CAACwE,SAAS,CAAC,CAACxE,SAAS,CAACyE,OAAO,CAACzE,SAAS,CAAC0E,IAAI,CAAC,EAAE1E,SAAS,CAAC0E,IAAI,CAAC;AACnF,CAAC;AAED7D,MAAM,CAAC8D,YAAY,GAAG;EACpBlD,MAAM,EAAE,CAAC,CAAC;EACVH,WAAW,EAAE,EAAE;EACfN,IAAI,EAAE,EAAE;EACRQ,cAAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRJ,IAAI,EAAE,EAAE;EACRE,GAAG,EAAE,IAAI;EACTsD,IAAI,EAAE,EAAE;EACRrD,IAAI,EAAE,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAejB,SAAS,CAACO,MAAM,CAAC"}
@@ -1,10 +1,14 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
+ const _excluded = ["children", "name"];
1
3
  import React from 'react';
2
4
  import PropTypes from 'prop-types';
3
5
  import { hasChildren } from '../../helpers';
4
- const ContentGroupSection = ({
5
- children,
6
- name
7
- }) => {
6
+ const ContentGroupSection = _ref => {
7
+ let {
8
+ children,
9
+ name
10
+ } = _ref,
11
+ props = _objectWithoutProperties(_ref, _excluded);
8
12
  if (!hasChildren(children)) return null;
9
13
  return /*#__PURE__*/React.createElement("div", {
10
14
  key: name,
@@ -1 +1 @@
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"}
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"}
@@ -6,16 +6,19 @@ const getSortProps = ({
6
6
  defaultSortBy,
7
7
  isTextSearchFilterApplied
8
8
  }) => {
9
- const sort = querySort || (sortProperties.length ? null : defaultSort);
10
- let sortby = null;
11
- if (querySortBy) sortby = [querySortBy];else if (!sortProperties.length) sortby = defaultSortBy;
12
9
  const updatedSortProperties = [...sortProperties];
10
+ if (!querySort && !sortProperties.length) {
11
+ updatedSortProperties.unshift({
12
+ sort: defaultSort,
13
+ propsToDisplay: defaultSortBy
14
+ });
15
+ }
13
16
  if (isTextSearchFilterApplied) updatedSortProperties.unshift({
14
17
  isScore: true
15
18
  });
16
- if (sort) updatedSortProperties.unshift({
17
- sort,
18
- propsToDisplay: sortby
19
+ if (querySort) updatedSortProperties.unshift({
20
+ sort: querySort,
21
+ propsToDisplay: [querySortBy]
19
22
  });
20
23
  const sortbyFilters = updatedSortProperties.map(({
21
24
  propsToDisplay: filterProps
@@ -1 +1 @@
1
- {"version":3,"file":"get-sort-props.js","names":["getSortProps","querySort","sortProperties","defaultSort","querySortBy","defaultSortBy","isTextSearchFilterApplied","sort","length","sortby","updatedSortProperties","unshift","isScore","propsToDisplay","sortbyFilters","map","filterProps","filter","Boolean","flat"],"sources":["../../../../src/components/List/helpers/get-sort-props.js"],"sourcesContent":["const getSortProps = ({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy,\n isTextSearchFilterApplied\n}) => {\n const sort = querySort || (sortProperties.length ? null : defaultSort);\n let sortby = null;\n if (querySortBy) sortby = [querySortBy];\n else if (!sortProperties.length) sortby = defaultSortBy;\n\n const updatedSortProperties = [...sortProperties];\n if (isTextSearchFilterApplied) updatedSortProperties.unshift({ isScore: true });\n if (sort) updatedSortProperties.unshift({ sort, propsToDisplay: sortby });\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay: filterProps }) => filterProps)\n .filter(Boolean)\n .flat();\n return { sortbyFilters, updatedSortProperties };\n};\n\nexport default getSortProps;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGA,CAAC;EACpBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC,WAAW;EACXC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAMC,IAAI,GAAGN,SAAS,KAAKC,cAAc,CAACM,MAAM,GAAG,IAAI,GAAGL,WAAW,CAAC;EACtE,IAAIM,MAAM,GAAG,IAAI;EACjB,IAAIL,WAAW,EAAEK,MAAM,GAAG,CAACL,WAAW,CAAC,CAAC,KACnC,IAAI,CAACF,cAAc,CAACM,MAAM,EAAEC,MAAM,GAAGJ,aAAa;EAEvD,MAAMK,qBAAqB,GAAG,CAAC,GAAGR,cAAc,CAAC;EACjD,IAAII,yBAAyB,EAAEI,qBAAqB,CAACC,OAAO,CAAC;IAAEC,OAAO,EAAE;EAAK,CAAC,CAAC;EAC/E,IAAIL,IAAI,EAAEG,qBAAqB,CAACC,OAAO,CAAC;IAAEJ,IAAI;IAAEM,cAAc,EAAEJ;EAAO,CAAC,CAAC;EAEzE,MAAMK,aAAa,GAAGJ,qBAAqB,CACxCK,GAAG,CAAC,CAAC;IAAEF,cAAc,EAAEG;EAAY,CAAC,KAAKA,WAAW,CAAC,CACrDC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,CAAC;EACT,OAAO;IAAEL,aAAa;IAAEJ;EAAsB,CAAC;AACjD,CAAC;AAED,eAAeV,YAAY"}
1
+ {"version":3,"file":"get-sort-props.js","names":["getSortProps","querySort","sortProperties","defaultSort","querySortBy","defaultSortBy","isTextSearchFilterApplied","updatedSortProperties","length","unshift","sort","propsToDisplay","isScore","sortbyFilters","map","filterProps","filter","Boolean","flat"],"sources":["../../../../src/components/List/helpers/get-sort-props.js"],"sourcesContent":["const getSortProps = ({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy,\n isTextSearchFilterApplied\n}) => {\n const updatedSortProperties = [...sortProperties];\n if (!querySort && !sortProperties.length) {\n updatedSortProperties.unshift({ sort: defaultSort, propsToDisplay: defaultSortBy });\n }\n if (isTextSearchFilterApplied) updatedSortProperties.unshift({ isScore: true });\n if (querySort) updatedSortProperties.unshift({ sort: querySort, propsToDisplay: [querySortBy] });\n\n const sortbyFilters = updatedSortProperties\n .map(({ propsToDisplay: filterProps }) => filterProps)\n .filter(Boolean)\n .flat();\n return { sortbyFilters, updatedSortProperties };\n};\n\nexport default getSortProps;\n"],"mappings":"AAAA,MAAMA,YAAY,GAAGA,CAAC;EACpBC,SAAS;EACTC,cAAc;EACdC,WAAW;EACXC,WAAW;EACXC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAMC,qBAAqB,GAAG,CAAC,GAAGL,cAAc,CAAC;EACjD,IAAI,CAACD,SAAS,IAAI,CAACC,cAAc,CAACM,MAAM,EAAE;IACxCD,qBAAqB,CAACE,OAAO,CAAC;MAAEC,IAAI,EAAEP,WAAW;MAAEQ,cAAc,EAAEN;IAAc,CAAC,CAAC;EACrF;EACA,IAAIC,yBAAyB,EAAEC,qBAAqB,CAACE,OAAO,CAAC;IAAEG,OAAO,EAAE;EAAK,CAAC,CAAC;EAC/E,IAAIX,SAAS,EAAEM,qBAAqB,CAACE,OAAO,CAAC;IAAEC,IAAI,EAAET,SAAS;IAAEU,cAAc,EAAE,CAACP,WAAW;EAAE,CAAC,CAAC;EAEhG,MAAMS,aAAa,GAAGN,qBAAqB,CACxCO,GAAG,CAAC,CAAC;IAAEH,cAAc,EAAEI;EAAY,CAAC,KAAKA,WAAW,CAAC,CACrDC,MAAM,CAACC,OAAO,CAAC,CACfC,IAAI,CAAC,CAAC;EACT,OAAO;IAAEL,aAAa;IAAEN;EAAsB,CAAC;AACjD,CAAC;AAED,eAAeP,YAAY"}
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import classnames from 'classnames';
4
4
  import debounce from 'lodash.debounce';
5
5
  import FiltersList from './FiltersList';
6
- import { isDeviceDesktop, buildUrlQuery, getResponsiveFilterClassnames } from '../helpers';
6
+ import { isDeviceDesktop, getResponsiveFilterClassnames, buildUrlQuery } from '../helpers';
7
7
  import CloseMobileForm from './CloseMobileForm';
8
8
  import ResetDesktopForm from './ResetDesktopForm';
9
9
  import MobileFormToolbar from './MobileFormToolbar';
@@ -29,7 +29,7 @@ const SearchFilter = ({
29
29
  const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);
30
30
  const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);
31
31
  const doSubmit = newValues => {
32
- const newQuery = buildUrlQuery(newValues, filters, listComponentName, query);
32
+ const newQuery = filterValues ? buildUrlQuery(newValues, filters, listComponentName, query) : '';
33
33
  handleSearch(newQuery);
34
34
  setMoreFiltersDesktopCollapsed(true);
35
35
  setMoreFiltersMobileCollapsed(true);
@@ -125,7 +125,7 @@ const SearchFilter = ({
125
125
  className: moreFiltersDesktopTogglerClass,
126
126
  type: "button",
127
127
  onClick: () => setMoreFiltersDesktopCollapsed(!moreFiltersDesktopCollapsed)
128
- }, "More filters"), /*#__PURE__*/React.createElement("div", {
128
+ }, moreFiltersDesktopCollapsed ? 'More filters' : 'Less filters'), /*#__PURE__*/React.createElement("div", {
129
129
  className: moreFiltersDesktopWrapperClass
130
130
  }, /*#__PURE__*/React.createElement("div", {
131
131
  className: MORE_FILTERS_CLASSES.DESKTOP_CONTENT