@blaze-cms/react-page-builder 0.124.0-alpha.9 → 0.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +303 -0
- package/README.md +8 -0
- package/lib/application/query/index.js +8 -2
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/Button.js +18 -5
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/CardContainer.js +3 -7
- package/lib/components/Card/CardContainer.js.map +1 -1
- package/lib/components/Card/CardFactory.js +6 -3
- package/lib/components/Card/CardFactory.js.map +1 -1
- package/lib/components/CarouselWrapper.js +2 -2
- package/lib/components/CarouselWrapper.js.map +1 -1
- package/lib/components/Image/ImageRender.js +5 -1
- package/lib/components/Image/ImageRender.js.map +1 -1
- package/lib/components/ItemList/ItemListButton/ItemListButton.js +161 -0
- package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
- package/lib/components/ItemList/ItemListButton/index.js +16 -0
- package/lib/components/ItemList/ItemListButton/index.js.map +1 -0
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js +83 -0
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
- package/lib/components/ItemList/ItemListCounter/index.js +16 -0
- package/lib/components/ItemList/ItemListCounter/index.js.map +1 -0
- package/lib/components/ItemList/ItemListNew/ItemListNew.js +87 -0
- package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
- package/lib/components/ItemList/ItemListNew/index.js +16 -0
- package/lib/components/ItemList/ItemListNew/index.js.map +1 -0
- package/lib/components/ItemList/constants.js +19 -0
- package/lib/components/ItemList/constants.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-data.js +17 -0
- package/lib/components/ItemList/helpers/get-item-list-data.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-id.js +23 -0
- package/lib/components/ItemList/helpers/get-item-list-id.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js +28 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
- package/lib/components/ItemList/helpers/index.js +50 -0
- package/lib/components/ItemList/helpers/index.js.map +1 -0
- package/lib/components/ItemList/helpers/set-item-list-id.js +22 -0
- package/lib/components/ItemList/helpers/set-item-list-id.js.map +1 -0
- package/lib/components/ItemList/helpers/set-param-and-redirect.js +51 -0
- package/lib/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
- package/lib/components/ItemList/hooks/index.js +18 -0
- package/lib/components/ItemList/hooks/index.js.map +1 -0
- package/lib/components/ItemList/hooks/use-item-list-id.js +45 -0
- package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -0
- package/lib/components/LazyImage/LazyImage.js +5 -1
- package/lib/components/LazyImage/LazyImage.js.map +1 -1
- package/lib/components/List/ListBuilder.js +12 -6
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +34 -7
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/helpers/has-required-item-list-details.js +29 -0
- package/lib/components/List/helpers/has-required-item-list-details.js.map +1 -0
- package/lib/components/List/helpers/index.js +8 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/Menu/Menu.js +41 -28
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuContext.js +20 -0
- package/lib/components/Menu/MenuContext.js.map +1 -0
- package/lib/components/MenuItem/MenuItem.js +26 -7
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +183 -0
- package/lib/components/SearchContent/SearchContent.js.map +1 -0
- package/lib/components/SearchContent/SearchContentItems.js +51 -0
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -0
- package/lib/components/SearchContent/SearchContentResults.js +45 -0
- package/lib/components/SearchContent/SearchContentResults.js.map +1 -0
- package/lib/components/SearchContent/SearchContentToggleIcon.js +42 -0
- package/lib/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
- package/lib/components/SearchContent/index.js +2 -301
- package/lib/components/SearchContent/index.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +16 -66
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +87 -23
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +19 -9
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js +27 -11
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/components/TextSearch.js +1 -5
- package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +87 -0
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-query.js +1 -1
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
- package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +18 -3
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
- package/lib/components/SearchFilter/helpers/index.js +8 -0
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilter/helpers/parse-filter-value.js +3 -7
- package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/lib/components/index.js +16 -1
- package/lib/components/index.js.map +1 -1
- package/lib/constants/index.js +3 -1
- package/lib/constants/index.js.map +1 -1
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/hooks/helpers/append-gtm-classname.js +1 -0
- package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/lib-es/application/query/index.js +45 -1
- package/lib-es/application/query/index.js.map +1 -1
- package/lib-es/components/Button.js +18 -6
- package/lib-es/components/Button.js.map +1 -1
- package/lib-es/components/Card/CardContainer.js +3 -7
- package/lib-es/components/Card/CardContainer.js.map +1 -1
- package/lib-es/components/Card/CardFactory.js +7 -4
- package/lib-es/components/Card/CardFactory.js.map +1 -1
- package/lib-es/components/CarouselWrapper.js +2 -2
- package/lib-es/components/CarouselWrapper.js.map +1 -1
- package/lib-es/components/Image/ImageRender.js +4 -1
- package/lib-es/components/Image/ImageRender.js.map +1 -1
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js +111 -0
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
- package/lib-es/components/ItemList/ItemListButton/index.js +3 -0
- package/lib-es/components/ItemList/ItemListButton/index.js.map +1 -0
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js +60 -0
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
- package/lib-es/components/ItemList/ItemListCounter/index.js +3 -0
- package/lib-es/components/ItemList/ItemListCounter/index.js.map +1 -0
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js +64 -0
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
- package/lib-es/components/ItemList/ItemListNew/index.js +3 -0
- package/lib-es/components/ItemList/ItemListNew/index.js.map +1 -0
- package/lib-es/components/ItemList/constants.js +6 -0
- package/lib-es/components/ItemList/constants.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-data.js +7 -0
- package/lib-es/components/ItemList/helpers/get-item-list-data.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-id.js +11 -0
- package/lib-es/components/ItemList/helpers/get-item-list-id.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-ids.js +13 -0
- package/lib-es/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
- package/lib-es/components/ItemList/helpers/index.js +6 -0
- package/lib-es/components/ItemList/helpers/index.js.map +1 -0
- package/lib-es/components/ItemList/helpers/set-item-list-id.js +10 -0
- package/lib-es/components/ItemList/helpers/set-item-list-id.js.map +1 -0
- package/lib-es/components/ItemList/helpers/set-param-and-redirect.js +20 -0
- package/lib-es/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
- package/lib-es/components/ItemList/hooks/index.js +2 -0
- package/lib-es/components/ItemList/hooks/index.js.map +1 -0
- package/lib-es/components/ItemList/hooks/use-item-list-id.js +26 -0
- package/lib-es/components/ItemList/hooks/use-item-list-id.js.map +1 -0
- package/lib-es/components/LazyImage/LazyImage.js +4 -1
- package/lib-es/components/LazyImage/LazyImage.js.map +1 -1
- package/lib-es/components/List/ListBuilder.js +12 -6
- package/lib-es/components/List/ListBuilder.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +33 -9
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/has-required-item-list-details.js +20 -0
- package/lib-es/components/List/helpers/has-required-item-list-details.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +1 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +54 -46
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/Menu/MenuContext.js +6 -0
- package/lib-es/components/Menu/MenuContext.js.map +1 -0
- package/lib-es/components/MenuItem/MenuItem.js +24 -9
- package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +129 -0
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentItems.js +33 -0
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentResults.js +31 -0
- package/lib-es/components/SearchContent/SearchContentResults.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentToggleIcon.js +30 -0
- package/lib-es/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
- package/lib-es/components/SearchContent/index.js +1 -205
- package/lib-es/components/SearchContent/index.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +10 -43
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +70 -15
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js +18 -9
- package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js +23 -8
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilter/components/TextSearch.js +1 -5
- package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +54 -0
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-query.js +1 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
- package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +13 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/index.js +2 -1
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/parse-filter-value.js +3 -3
- package/lib-es/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
- package/lib-es/components/index.js +10 -1
- package/lib-es/components/index.js.map +1 -1
- package/lib-es/constants/index.js +2 -1
- package/lib-es/constants/index.js.map +1 -1
- package/lib-es/helpers/build-raw-query.js.map +1 -1
- package/lib-es/hooks/helpers/append-gtm-classname.js +1 -0
- package/lib-es/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/package.json +5 -4
- package/src/application/query/index.js +51 -1
- package/src/components/Button.js +27 -5
- package/src/components/Card/CardContainer.js +2 -6
- package/src/components/Card/CardFactory.js +5 -3
- package/src/components/CarouselWrapper.js +2 -2
- package/src/components/Image/ImageRender.js +3 -0
- package/src/components/ItemList/ItemListButton/ItemListButton.js +94 -0
- package/src/components/ItemList/ItemListButton/index.js +3 -0
- package/src/components/ItemList/ItemListCounter/ItemListCounter.js +52 -0
- package/src/components/ItemList/ItemListCounter/index.js +3 -0
- package/src/components/ItemList/ItemListNew/ItemListNew.js +51 -0
- package/src/components/ItemList/ItemListNew/index.js +3 -0
- package/src/components/ItemList/constants.js +5 -0
- package/src/components/ItemList/helpers/get-item-list-data.js +6 -0
- package/src/components/ItemList/helpers/get-item-list-id.js +11 -0
- package/src/components/ItemList/helpers/get-item-list-ids.js +10 -0
- package/src/components/ItemList/helpers/index.js +5 -0
- package/src/components/ItemList/helpers/set-item-list-id.js +9 -0
- package/src/components/ItemList/helpers/set-param-and-redirect.js +20 -0
- package/src/components/ItemList/hooks/index.js +1 -0
- package/src/components/ItemList/hooks/use-item-list-id.js +27 -0
- package/src/components/LazyImage/LazyImage.js +11 -1
- package/src/components/List/ListBuilder.js +10 -5
- package/src/components/List/ListFactory.js +48 -12
- package/src/components/List/helpers/has-required-item-list-details.js +14 -0
- package/src/components/List/helpers/index.js +1 -0
- package/src/components/Menu/Menu.js +61 -54
- package/src/components/Menu/MenuContext.js +5 -0
- package/src/components/MenuItem/MenuItem.js +39 -14
- package/src/components/SearchContent/SearchContent.js +136 -0
- package/src/components/SearchContent/SearchContentItems.js +28 -0
- package/src/components/SearchContent/SearchContentResults.js +27 -0
- package/src/components/SearchContent/SearchContentToggleIcon.js +27 -0
- package/src/components/SearchContent/index.js +1 -217
- package/src/components/SearchFilter/SearchFilter/FiltersList.js +30 -37
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +10 -25
- package/src/components/SearchFilter/SearchFilterContainer.js +61 -16
- package/src/components/SearchFilter/components/Checkbox.js +23 -8
- package/src/components/SearchFilter/components/Select.js +18 -11
- package/src/components/SearchFilter/components/TextSearch.js +1 -3
- package/src/components/SearchFilter/helpers/build-filters-query.js +40 -0
- package/src/components/SearchFilter/helpers/build-query.js +3 -1
- package/src/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +12 -1
- package/src/components/SearchFilter/helpers/index.js +3 -1
- package/src/components/SearchFilter/helpers/parse-filter-value.js +3 -3
- package/src/components/index.js +10 -1
- package/src/constants/index.js +2 -0
- package/src/helpers/build-raw-query.js +1 -0
- package/src/hooks/helpers/append-gtm-classname.js +3 -0
- package/tests/unit/src/components/Button.test.js +55 -1
- package/tests/unit/src/components/ItemList/ItemListButton.test.js +175 -0
- package/tests/unit/src/components/ItemList/ItemListCounter.test.js +65 -0
- package/tests/unit/src/components/ItemList/ItemListNew.test.js +164 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListButton.test.js.snap +107 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListCounter.test.js.snap +31 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListNew.test.js.snap +27 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-data.test.js +28 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-id.test.js +20 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-ids.test.js +19 -0
- package/tests/unit/src/components/ItemList/helpers/set-item-list-id.test.js +13 -0
- package/tests/unit/src/components/ItemList/helpers/set-param-and-redirect.test.js +30 -0
- package/tests/unit/src/components/ItemList/hooks/use-item-list-id.test.js +32 -0
- package/tests/unit/src/components/List/helpers/has-required-item-list-details.test.js +30 -0
- package/tests/unit/src/components/Menu/Menu.test.js +9 -3
- package/tests/unit/src/components/Menu/__snapshots__/Menu.test.js.snap +12 -11
- package/tests/unit/src/components/MenuItem/MenuItem.test.js +1 -1
- package/tests/unit/src/components/MenuItem/SubMenu.test.js +5 -1
- package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +54 -10
- package/tests/unit/src/components/SearchContent/SearchContent.test.js +29 -0
- package/tests/unit/src/components/SearchContent/__snapshots__/SearchContent.test.js.snap +9 -0
- package/tests/unit/src/components/SearchFilter/SearchFilter/SearchFilter.test.js +3 -6
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Checkbox.test.js.snap +2 -0
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Select.test.js.snap +4 -0
- package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +2 -2
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +25 -11
- package/tests/unit/src/components/SearchFilter/helpers/parse-filter-value.test.js +1 -1
- package/tests/unit/src/components/__snapshots__/index.test.js.snap +12 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-raw-query.js","names":["buildRawQuery","docType","operator","searchValues","filterData","id","itemsToDisplay","shouldApplySort","azOptions","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","filterValues","filterOperator","relations","stringProps","azFilter","shouldReturnAggs","isAZ","searchValuesTextCheckboxSelectJoined","AND_OPERATOR","searchValuesTextCheckboxOr","length","finalValue","finalValueWithCheckboxOrValues","must","bool","should","finalValueIfNoCheckboxOrValues","mustValues","query","azQueryBits","itemsToDisplayIds","push","ids","values","sort","_script","type","script","lang","source","params","sortOrder","order"],"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 } 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\n const { filterValues, filterOperator, relations, stringProps, azFilter } = filterData;\n const { shouldReturnAggs, isAZ } = azOptions || {};\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);\n\n const query = {\n bool: {\n must: mustValues,\n ...buildRawQueryBase({ docType, id, filterValues, filterOperator, relations, stringProps })\n }\n };\n const azQueryBits = getExtraAzBits(shouldReturnAggs, isAZ, azFilter);\n\n if (itemsToDisplay && itemsToDisplay.length) {\n const itemsToDisplayIds = getItemsToDisplayIds(itemsToDisplay);\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;;AACA;;AACA;;AACA;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W,MAAvB,GACTE,8BADS,GAETI,8BAFJ;EAGD,CARD,MAQO;IACLL,UAAU,GAAG;MACXE,IAAI,gDAAMf,+BAAN,IAAuC;QAAEgB,IAAI,EAAE;UAAEC,MAAM,EAAEN;QAAV;MAAR,CAAvC;IADO,CAAb;EAGD;;EACD,IAAMQ,UAAU,GAAG,CACjB;IACEH,IAAI,EAAEH;EADR,CADiB,CAAnB;EAMA,+BAAcP,QAAd,EAAwBa,UAAxB;EAEA,IAAMC,KAAK,GAAG;IACZJ,IAAI;MACFD,IAAI,EAAEI;IADJ,GAEC,mCAAkB;MAAE5B,OAAO,EAAPA,OAAF;MAAWI,EAAE,EAAFA,EAAX;MAAeO,YAAY,EAAZA,YAAf;MAA6BC,cAAc,EAAdA,cAA7B;MAA6CC,SAAS,EAATA,SAA7C;MAAwDC,WAAW,EAAXA;IAAxD,CAAlB,CAFD;EADQ,CAAd;EAMA,IAAMgB,WAAW,GAAG,gCAAed,gBAAf,EAAiCC,IAAjC,EAAuCF,QAAvC,CAApB;;EAEA,IAAIV,cAAc,IAAIA,cAAc,CAACgB,MAArC,EAA6C;IAC3C,IAAMU,iBAAiB,GAAG,sCAAqB1B,cAArB,CAA1B;
|
|
1
|
+
{"version":3,"file":"build-raw-query.js","names":["buildRawQuery","docType","operator","searchValues","filterData","id","itemsToDisplay","shouldApplySort","azOptions","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","filterValues","filterOperator","relations","stringProps","azFilter","shouldReturnAggs","isAZ","searchValuesTextCheckboxSelectJoined","AND_OPERATOR","searchValuesTextCheckboxOr","length","finalValue","finalValueWithCheckboxOrValues","must","bool","should","finalValueIfNoCheckboxOrValues","mustValues","query","azQueryBits","itemsToDisplayIds","push","ids","values","sort","_script","type","script","lang","source","params","sortOrder","order"],"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 } 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\n const { filterValues, filterOperator, relations, stringProps, azFilter } = filterData;\n const { shouldReturnAggs, isAZ } = azOptions || {};\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);\n\n const query = {\n bool: {\n must: mustValues,\n ...buildRawQueryBase({ docType, id, filterValues, filterOperator, relations, stringProps })\n }\n };\n const azQueryBits = getExtraAzBits(shouldReturnAggs, isAZ, 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;;AACA;;AACA;;AACA;;AACA;;;;;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CACpBC,OADoB,EAEpBC,QAFoB,EAGpBC,YAHoB,EAIpBC,UAJoB,EAKpBC,EALoB,EAMpBC,cANoB,EAOpBC,eAPoB,EAQpBC,SARoB,EASjB;EACH,IACEC,gBADF,GAIIN,YAJJ,CACEM,gBADF;EAAA,IAEEC,+BAFF,GAIIP,YAJJ,CAEEO,+BAFF;EAAA,IAGEC,sBAHF,GAIIR,YAJJ,CAGEQ,sBAHF;EAMA,IAAQC,YAAR,GAA2ER,UAA3E,CAAQQ,YAAR;EAAA,IAAsBC,cAAtB,GAA2ET,UAA3E,CAAsBS,cAAtB;EAAA,IAAsCC,SAAtC,GAA2EV,UAA3E,CAAsCU,SAAtC;EAAA,IAAiDC,WAAjD,GAA2EX,UAA3E,CAAiDW,WAAjD;EAAA,IAA8DC,QAA9D,GAA2EZ,UAA3E,CAA8DY,QAA9D;;EACA,WAAmCR,SAAS,IAAI,EAAhD;EAAA,IAAQS,gBAAR,QAAQA,gBAAR;EAAA,IAA0BC,IAA1B,QAA0BA,IAA1B;;EACA,IAAMC,oCAAoC,GACxCjB,QAAQ,KAAKkB,uBAAb,iDAAgCX,gBAAhC,uCAAqDC,+BAArD,KAAwF,EAD1F;EAEA,IAAIW,0BAA0B,GAAGZ,gBAAjC;;EACA,IAAIE,sBAAsB,CAACW,MAA3B,EAAmC;IACjCD,0BAA0B,iDAAOZ,gBAAP,uCAA4BE,sBAA5B,EAA1B;EACD;;EAED,IAAIY,UAAJ;;EAEA,IAAIJ,oCAAoC,CAACG,MAAzC,EAAiD;IAC/C,I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C,IAAI,EAAE,UADA;cAENC,MAAM,EACJ,kFAHI;cAINC,MAAM,EAAE;gBACNC,SAAS,EAAEX;cADL;YAJF,CAFD;YAUPY,KAAK,EAAE;UAVA;QADL;MAFR,GAgBKb,WAhBL;IAkBD;EACF;;EAED,OAAOb,IAAI;IAELY,KAAK,EAALA;EAFK,GAGFC,WAHE,IAKPD,KALJ;AAMD,CAxFD;;eA0Fe9B,a"}
|
|
@@ -53,6 +53,7 @@ var appendGtmClassName = function appendGtmClassName(settings, childComponents)
|
|
|
53
53
|
var _childComponents$prop = (0, _slicedToArray2["default"])(childComponents.props.children, 2),
|
|
54
54
|
compChildren = _childComponents$prop[1];
|
|
55
55
|
|
|
56
|
+
if (!compChildren || !Array.isArray(compChildren)) return settings;
|
|
56
57
|
var gtmClassNames = compChildren.filter(function (_ref) {
|
|
57
58
|
var type = _ref.props.component.type;
|
|
58
59
|
return type === _constants.GTM;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"append-gtm-classname.js","names":["appendGtmClassName","settings","childComponents","Array","isArray","props","children","compChildren","gtmClassNames","filter","type","component","GTM","map","gtmClassName","Boolean","join","length","modifier","updatedModifier","trim"],"sources":["../../../src/hooks/helpers/append-gtm-classname.js"],"sourcesContent":["import { GTM } from '../../constants';\n\nconst appendGtmClassName = (settings, childComponents) => {\n if (!childComponents || Array.isArray(childComponents)) return settings;\n const {\n props: {\n children: [, compChildren]\n }\n } = childComponents;\n const gtmClassNames = compChildren\n .filter(\n ({\n props: {\n component: { type }\n }\n }) => type === GTM\n )\n .map(\n ({\n props: {\n component: {\n settings: { gtmClassName }\n }\n }\n }) => gtmClassName\n )\n .filter(Boolean)\n .join(' ');\n if (!gtmClassNames.length) return settings;\n const { modifier } = settings;\n const updatedModifier = `${modifier || ''} ${gtmClassNames}`.trim();\n\n return { ...settings, modifier: updatedModifier };\n};\n\nexport default appendGtmClassName;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAEA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,QAAD,EAAWC,eAAX,EAA+B;EACxD,IAAI,CAACA,eAAD,IAAoBC,KAAK,CAACC,OAAN,CAAcF,eAAd,CAAxB,EAAwD,OAAOD,QAAP;;EACxD,4DAIIC,eAJJ,CACEG,KADF,CAEIC,QAFJ;EAAA,IAEiBC,YAFjB;;
|
|
1
|
+
{"version":3,"file":"append-gtm-classname.js","names":["appendGtmClassName","settings","childComponents","Array","isArray","props","children","compChildren","gtmClassNames","filter","type","component","GTM","map","gtmClassName","Boolean","join","length","modifier","updatedModifier","trim"],"sources":["../../../src/hooks/helpers/append-gtm-classname.js"],"sourcesContent":["import { GTM } from '../../constants';\n\nconst appendGtmClassName = (settings, childComponents) => {\n if (!childComponents || Array.isArray(childComponents)) return settings;\n const {\n props: {\n children: [, compChildren]\n }\n } = childComponents;\n\n if (!compChildren || !Array.isArray(compChildren)) return settings;\n\n const gtmClassNames = compChildren\n .filter(\n ({\n props: {\n component: { type }\n }\n }) => type === GTM\n )\n .map(\n ({\n props: {\n component: {\n settings: { gtmClassName }\n }\n }\n }) => gtmClassName\n )\n .filter(Boolean)\n .join(' ');\n if (!gtmClassNames.length) return settings;\n const { modifier } = settings;\n const updatedModifier = `${modifier || ''} ${gtmClassNames}`.trim();\n\n return { ...settings, modifier: updatedModifier };\n};\n\nexport default appendGtmClassName;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;AAEA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAACC,QAAD,EAAWC,eAAX,EAA+B;EACxD,IAAI,CAACA,eAAD,IAAoBC,KAAK,CAACC,OAAN,CAAcF,eAAd,CAAxB,EAAwD,OAAOD,QAAP;;EACxD,4DAIIC,eAJJ,CACEG,KADF,CAEIC,QAFJ;EAAA,IAEiBC,YAFjB;;EAMA,IAAI,CAACA,YAAD,IAAiB,CAACJ,KAAK,CAACC,OAAN,CAAcG,YAAd,CAAtB,EAAmD,OAAON,QAAP;EAEnD,IAAMO,aAAa,GAAGD,YAAY,CAC/BE,MADmB,CAElB;IAAA,IAEiBC,IAFjB,QACEL,KADF,CAEIM,SAFJ,CAEiBD,IAFjB;IAAA,OAIMA,IAAI,KAAKE,cAJf;EAAA,CAFkB,EAQnBC,GARmB,CASlB;IAAA,IAGkBC,YAHlB,SACET,KADF,CAEIM,SAFJ,CAGMV,QAHN,CAGkBa,YAHlB;IAAA,OAMMA,YANN;EAAA,CATkB,EAiBnBL,MAjBmB,CAiBZM,OAjBY,EAkBnBC,IAlBmB,CAkBd,GAlBc,CAAtB;EAmBA,IAAI,CAACR,aAAa,CAACS,MAAnB,EAA2B,OAAOhB,QAAP;EAC3B,IAAQiB,QAAR,GAAqBjB,QAArB,CAAQiB,QAAR;EACA,IAAMC,eAAe,GAAG,UAAGD,QAAQ,IAAI,EAAf,cAAqBV,aAArB,EAAqCY,IAArC,EAAxB;EAEA,uCAAYnB,QAAZ;IAAsBiB,QAAQ,EAAEC;EAAhC;AACD,CAlCD;;eAoCenB,kB"}
|
|
@@ -165,5 +165,49 @@ const getPublishedContent = entity => `
|
|
|
165
165
|
}
|
|
166
166
|
`;
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
const getItemList = gql`
|
|
169
|
+
query getItemList($id: String!) {
|
|
170
|
+
getItemList(id: $id) {
|
|
171
|
+
id
|
|
172
|
+
listItems {
|
|
173
|
+
itemId
|
|
174
|
+
itemEntity
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
const addItemsToList = gql`
|
|
180
|
+
mutation addItemsToList(
|
|
181
|
+
$name: String!
|
|
182
|
+
$id: String
|
|
183
|
+
$listItems: [AddItemsToListInputListItemsItem]!
|
|
184
|
+
) {
|
|
185
|
+
addItemsToList(input: { name: $name, id: $id, listItems: $listItems }) {
|
|
186
|
+
result {
|
|
187
|
+
id
|
|
188
|
+
listItems {
|
|
189
|
+
itemId
|
|
190
|
+
itemEntity
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
`;
|
|
196
|
+
const removeItemsFromList = gql`
|
|
197
|
+
mutation removeItemsFromList(
|
|
198
|
+
$listId: String!
|
|
199
|
+
$listItems: [RemoveItemsFromListInputListItemsItem]!
|
|
200
|
+
) {
|
|
201
|
+
removeItemsFromList(input: { id: $listId, listItems: $listItems }) {
|
|
202
|
+
result {
|
|
203
|
+
id
|
|
204
|
+
listItems {
|
|
205
|
+
itemId
|
|
206
|
+
itemEntity
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
`;
|
|
212
|
+
export { getEntitySchema, getSingleEntitySchema, getAction, getFiles, getFileById, generateMultiItemQuery, generateSingleItemQuery, getPublishedContent, getSearchPublishedContent, getCount, getMultipleSchema, getUser, getRecordParents, getItemList, addItemsToList, removeItemsFromList };
|
|
169
213
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["gql","upperFirst","defaultSchemaProps","getSearchPublishedContent","fields","getUser","userProps","getEntitySchema","getSingleEntitySchema","getRecordParents","queryName","getMultipleSchema","identifiers","queryString","map","id","join","getFiles","getFileById","getCount","action","generateQuery","props","generateMultiItemQuery","generateSingleItemQuery","getAction","query","getPublishedContent","entity"],"sources":["../../../src/application/query/index.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport upperFirst from 'lodash.upperfirst';\n\nconst defaultSchemaProps = `\n id\n identifier\n properties\n dynamicProperties\n actions\n interfaces\n relations\n __typename\n`;\n\nconst getSearchPublishedContent = fields => gql`\n query searchPublishedContent($rawQueryStringified: String!, $offset: Int, $limit: Int, $sort: String) {\n searchPublishedContent(rawQueryStringified: $rawQueryStringified, offset: $offset, limit: $limit, sort: $sort) {\n ${fields}\n }\n }\n `;\n\nconst getUser = userProps => gql`\n query getUser($id: String!) {\n getUser(id: $id) {\n id\n ${userProps}\n }\n }\n`;\n\nconst getEntitySchema = gql`\n query getEntitySchemas($identifier: String!) {\n getEntitySchemas(identifier: $identifier) {\n ${defaultSchemaProps}\n }\n }\n`;\n\nconst getSingleEntitySchema = gql`\n query getEntitySchema($id: String!) {\n getEntitySchema: getEntitySchema(id: $id) {\n ${defaultSchemaProps}\n }\n }\n`;\n\nconst getRecordParents = queryName => gql`\nquery getRecordParents($id: String!){\n recordParents: ${queryName}(id: $id){\n id,\n name,\n url,\n parents {\n id,\n name\n url\n }\n }\n}`;\n\nconst getMultipleSchema = identifiers => {\n const queryString = identifiers\n .map(\n id => `${id}: getEntitySchema(id: \"${id}\") {\n ${defaultSchemaProps}\n }`\n )\n .join(`\\n`);\n return gql`\n query {\n ${queryString}\n }`;\n};\n\nconst getFiles = gql`\n query getFiles($where: JSON!) {\n getFiles(where: $where) {\n id\n url\n data\n }\n }\n`;\n\nconst getFileById = gql`\n query getFile($id: String!) {\n getFile(id: $id) {\n id\n url\n data\n }\n }\n`;\n\nconst getCount = action => gql`query countData($where: JSON!) {\n ${action} (where: $where)\n }\n`;\n\nconst generateQuery = (action, props) => `\n query getEntityData(\n $where: JSON\n $limit: Int\n $offset: Int\n $sort: [${upperFirst(action)}SortItem]){\n ${action} (where: $where, limit: $limit, offset: $offset, sort: $sort){\n ${props}\n id\n __typename\n }\n }\n `;\nconst generateMultiItemQuery = (action, props) => gql`\n query getEntityData($where: JSON){\n ${action} (where: $where){\n ${props}\n id\n __typename\n }\n }\n `;\n\nconst generateSingleItemQuery = (action, props) => gql`\n query getEntityData($id: String!){\n entityData: ${action}(id: $id){\n ${props},\n id,\n __typename\n }\n }\n `;\n\n// TODO: extend function to handle properties and make them dynamic with a config schema for each entity.\nconst getAction = (action, props) => {\n const query = generateQuery(action, props);\n return gql`\n ${query}\n `;\n};\n\nconst getPublishedContent = entity => `\n query searchPublishedContent(\n $rawQueryStringified: String!\n $offset: Int\n $limit: Int\n $sort: String\n ) {\n searchPublishedContent(\n rawQueryStringified: $rawQueryStringified\n offset: $offset\n limit: $limit\n sort: $sort\n ) {\n results {\n ... on ${entity} {\n id\n name\n image {\n url\n __typename\n }\n url\n __typename\n }\n __typename\n }\n total\n __typename\n }\n }\n`;\n\nexport {\n getEntitySchema,\n getSingleEntitySchema,\n getAction,\n getFiles,\n getFileById,\n generateMultiItemQuery,\n generateSingleItemQuery,\n getPublishedContent,\n getSearchPublishedContent,\n getCount,\n getMultipleSchema,\n getUser,\n getRecordParents\n};\n"],"mappings":"AAAA,SAASA,GAAT,QAAoB,gBAApB;AACA,OAAOC,UAAP,MAAuB,mBAAvB;AAEA,MAAMC,kBAAkB,GAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CATA;;AAWA,MAAMC,yBAAyB,GAAGC,MAAM,IAAIJ,GAAI;AAChD;AACA;AACA,UAAUI,MAAO;AACjB;AACA;AACA,GANA;;AAQA,MAAMC,OAAO,GAAGC,SAAS,IAAIN,GAAI;AACjC;AACA;AACA;AACA,QAAQM,SAAU;AAClB;AACA;AACA,CAPA;;AASA,MAAMC,eAAe,GAAGP,GAAI;AAC5B;AACA;AACA,QAAQE,kBAAmB;AAC3B;AACA;AACA,CANA;AAQA,MAAMM,qBAAqB,GAAGR,GAAI;AAClC;AACA;AACA,QAAQE,kBAAmB;AAC3B;AACA;AACA,CANA;;AAQA,MAAMO,gBAAgB,GAAGC,SAAS,IAAIV,GAAI;AAC1C;AACA,mBAAmBU,SAAU;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAZA;;AAcA,MAAMC,iBAAiB,GAAGC,WAAW,IAAI;EACvC,MAAMC,WAAW,GAAGD,WAAW,CAC5BE,GADiB,CAEhBC,EAAE,IAAK,GAAEA,EAAG,0BAAyBA,EAAG;AAC9C,cAAcb,kBAAmB;AACjC,QAJsB,EAMjBc,IANiB,CAMX,IANW,CAApB;EAOA,OAAOhB,GAAI;AACb;AACA,QAAQa,WAAY;AACpB,MAHE;AAID,CAZD;;AAcA,MAAMI,QAAQ,GAAGjB,GAAI;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CARA;AAUA,MAAMkB,WAAW,GAAGlB,GAAI;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CARA;;AAUA,MAAMmB,QAAQ,GAAGC,MAAM,IAAIpB,GAAI;AAC/B,MAAMoB,MAAO;AACb;AACA,CAHA;;AAKA,MAAMC,aAAa,GAAG,CAACD,MAAD,EAASE,KAAT,KAAoB;AAC1C;AACA;AACA;AACA;AACA,cAAcrB,UAAU,CAACmB,MAAD,CAAS;AACjC,MAAMA,MAAO;AACb,QAAQE,KAAM;AACd;AACA;AACA;AACA;AACA,GAZA;;AAaA,MAAMC,sBAAsB,GAAG,CAACH,MAAD,EAASE,KAAT,KAAmBtB,GAAI;AACtD;AACA,MAAMoB,MAAO;AACb,QAAQE,KAAM;AACd;AACA;AACA;AACA;AACA,GARA;;AAUA,MAAME,uBAAuB,GAAG,CAACJ,MAAD,EAASE,KAAT,KAAmBtB,GAAI;AACvD;AACA,kBAAkBoB,MAAO;AACzB,MAAME,KAAM;AACZ;AACA;AACA;AACA;AACA,GARA,C,CAUA;;;AACA,MAAMG,SAAS,GAAG,CAACL,MAAD,EAASE,KAAT,KAAmB;EACnC,MAAMI,KAAK,GAAGL,aAAa,CAACD,MAAD,EAASE,KAAT,CAA3B;EACA,OAAOtB,GAAI;AACb,MAAM0B,KAAM;AACZ,GAFE;AAGD,CALD;;AAOA,MAAMC,mBAAmB,GAAGC,MAAM,IAAK;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,MAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CA9BA;;AAgCA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["gql","upperFirst","defaultSchemaProps","getSearchPublishedContent","fields","getUser","userProps","getEntitySchema","getSingleEntitySchema","getRecordParents","queryName","getMultipleSchema","identifiers","queryString","map","id","join","getFiles","getFileById","getCount","action","generateQuery","props","generateMultiItemQuery","generateSingleItemQuery","getAction","query","getPublishedContent","entity","getItemList","addItemsToList","removeItemsFromList"],"sources":["../../../src/application/query/index.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport upperFirst from 'lodash.upperfirst';\n\nconst defaultSchemaProps = `\n id\n identifier\n properties\n dynamicProperties\n actions\n interfaces\n relations\n __typename\n`;\n\nconst getSearchPublishedContent = fields => gql`\n query searchPublishedContent($rawQueryStringified: String!, $offset: Int, $limit: Int, $sort: String) {\n searchPublishedContent(rawQueryStringified: $rawQueryStringified, offset: $offset, limit: $limit, sort: $sort) {\n ${fields}\n }\n }\n `;\n\nconst getUser = userProps => gql`\n query getUser($id: String!) {\n getUser(id: $id) {\n id\n ${userProps}\n }\n }\n`;\n\nconst getEntitySchema = gql`\n query getEntitySchemas($identifier: String!) {\n getEntitySchemas(identifier: $identifier) {\n ${defaultSchemaProps}\n }\n }\n`;\n\nconst getSingleEntitySchema = gql`\n query getEntitySchema($id: String!) {\n getEntitySchema: getEntitySchema(id: $id) {\n ${defaultSchemaProps}\n }\n }\n`;\n\nconst getRecordParents = queryName => gql`\nquery getRecordParents($id: String!){\n recordParents: ${queryName}(id: $id){\n id,\n name,\n url,\n parents {\n id,\n name\n url\n }\n }\n}`;\n\nconst getMultipleSchema = identifiers => {\n const queryString = identifiers\n .map(\n id => `${id}: getEntitySchema(id: \"${id}\") {\n ${defaultSchemaProps}\n }`\n )\n .join(`\\n`);\n return gql`\n query {\n ${queryString}\n }`;\n};\n\nconst getFiles = gql`\n query getFiles($where: JSON!) {\n getFiles(where: $where) {\n id\n url\n data\n }\n }\n`;\n\nconst getFileById = gql`\n query getFile($id: String!) {\n getFile(id: $id) {\n id\n url\n data\n }\n }\n`;\n\nconst getCount = action => gql`query countData($where: JSON!) {\n ${action} (where: $where)\n }\n`;\n\nconst generateQuery = (action, props) => `\n query getEntityData(\n $where: JSON\n $limit: Int\n $offset: Int\n $sort: [${upperFirst(action)}SortItem]){\n ${action} (where: $where, limit: $limit, offset: $offset, sort: $sort){\n ${props}\n id\n __typename\n }\n }\n `;\nconst generateMultiItemQuery = (action, props) => gql`\n query getEntityData($where: JSON){\n ${action} (where: $where){\n ${props}\n id\n __typename\n }\n }\n `;\n\nconst generateSingleItemQuery = (action, props) => gql`\n query getEntityData($id: String!){\n entityData: ${action}(id: $id){\n ${props},\n id,\n __typename\n }\n }\n `;\n\n// TODO: extend function to handle properties and make them dynamic with a config schema for each entity.\nconst getAction = (action, props) => {\n const query = generateQuery(action, props);\n return gql`\n ${query}\n `;\n};\n\nconst getPublishedContent = entity => `\n query searchPublishedContent(\n $rawQueryStringified: String!\n $offset: Int\n $limit: Int\n $sort: String\n ) {\n searchPublishedContent(\n rawQueryStringified: $rawQueryStringified\n offset: $offset\n limit: $limit\n sort: $sort\n ) {\n results {\n ... on ${entity} {\n id\n name\n image {\n url\n __typename\n }\n url\n __typename\n }\n __typename\n }\n total\n __typename\n }\n }\n`;\n\nconst getItemList = gql`\n query getItemList($id: String!) {\n getItemList(id: $id) {\n id\n listItems {\n itemId\n itemEntity\n }\n }\n }\n`;\n\nconst addItemsToList = gql`\n mutation addItemsToList(\n $name: String!\n $id: String\n $listItems: [AddItemsToListInputListItemsItem]!\n ) {\n addItemsToList(input: { name: $name, id: $id, listItems: $listItems }) {\n result {\n id\n listItems {\n itemId\n itemEntity\n }\n }\n }\n }\n`;\n\nconst removeItemsFromList = gql`\n mutation removeItemsFromList(\n $listId: String!\n $listItems: [RemoveItemsFromListInputListItemsItem]!\n ) {\n removeItemsFromList(input: { id: $listId, listItems: $listItems }) {\n result {\n id\n listItems {\n itemId\n itemEntity\n }\n }\n }\n }\n`;\n\nexport {\n getEntitySchema,\n getSingleEntitySchema,\n getAction,\n getFiles,\n getFileById,\n generateMultiItemQuery,\n generateSingleItemQuery,\n getPublishedContent,\n getSearchPublishedContent,\n getCount,\n getMultipleSchema,\n getUser,\n getRecordParents,\n getItemList,\n addItemsToList,\n removeItemsFromList\n};\n"],"mappings":"AAAA,SAASA,GAAT,QAAoB,gBAApB;AACA,OAAOC,UAAP,MAAuB,mBAAvB;AAEA,MAAMC,kBAAkB,GAAI;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CATA;;AAWA,MAAMC,yBAAyB,GAAGC,MAAM,IAAIJ,GAAI;AAChD;AACA;AACA,UAAUI,MAAO;AACjB;AACA;AACA,GANA;;AAQA,MAAMC,OAAO,GAAGC,SAAS,IAAIN,GAAI;AACjC;AACA;AACA;AACA,QAAQM,SAAU;AAClB;AACA;AACA,CAPA;;AASA,MAAMC,eAAe,GAAGP,GAAI;AAC5B;AACA;AACA,QAAQE,kBAAmB;AAC3B;AACA;AACA,CANA;AAQA,MAAMM,qBAAqB,GAAGR,GAAI;AAClC;AACA;AACA,QAAQE,kBAAmB;AAC3B;AACA;AACA,CANA;;AAQA,MAAMO,gBAAgB,GAAGC,SAAS,IAAIV,GAAI;AAC1C;AACA,mBAAmBU,SAAU;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAZA;;AAcA,MAAMC,iBAAiB,GAAGC,WAAW,IAAI;EACvC,MAAMC,WAAW,GAAGD,WAAW,CAC5BE,GADiB,CAEhBC,EAAE,IAAK,GAAEA,EAAG,0BAAyBA,EAAG;AAC9C,cAAcb,kBAAmB;AACjC,QAJsB,EAMjBc,IANiB,CAMX,IANW,CAApB;EAOA,OAAOhB,GAAI;AACb;AACA,QAAQa,WAAY;AACpB,MAHE;AAID,CAZD;;AAcA,MAAMI,QAAQ,GAAGjB,GAAI;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CARA;AAUA,MAAMkB,WAAW,GAAGlB,GAAI;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CARA;;AAUA,MAAMmB,QAAQ,GAAGC,MAAM,IAAIpB,GAAI;AAC/B,MAAMoB,MAAO;AACb;AACA,CAHA;;AAKA,MAAMC,aAAa,GAAG,CAACD,MAAD,EAASE,KAAT,KAAoB;AAC1C;AACA;AACA;AACA;AACA,cAAcrB,UAAU,CAACmB,MAAD,CAAS;AACjC,MAAMA,MAAO;AACb,QAAQE,KAAM;AACd;AACA;AACA;AACA;AACA,GAZA;;AAaA,MAAMC,sBAAsB,GAAG,CAACH,MAAD,EAASE,KAAT,KAAmBtB,GAAI;AACtD;AACA,MAAMoB,MAAO;AACb,QAAQE,KAAM;AACd;AACA;AACA;AACA;AACA,GARA;;AAUA,MAAME,uBAAuB,GAAG,CAACJ,MAAD,EAASE,KAAT,KAAmBtB,GAAI;AACvD;AACA,kBAAkBoB,MAAO;AACzB,MAAME,KAAM;AACZ;AACA;AACA;AACA;AACA,GARA,C,CAUA;;;AACA,MAAMG,SAAS,GAAG,CAACL,MAAD,EAASE,KAAT,KAAmB;EACnC,MAAMI,KAAK,GAAGL,aAAa,CAACD,MAAD,EAASE,KAAT,CAA3B;EACA,OAAOtB,GAAI;AACb,MAAM0B,KAAM;AACZ,GAFE;AAGD,CALD;;AAOA,MAAMC,mBAAmB,GAAGC,MAAM,IAAK;AACvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,MAAO;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CA9BA;;AAgCA,MAAMC,WAAW,GAAG7B,GAAI;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAVA;AAYA,MAAM8B,cAAc,GAAG9B,GAAI;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAhBA;AAkBA,MAAM+B,mBAAmB,GAAG/B,GAAI;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAfA;AAiBA,SACEO,eADF,EAEEC,qBAFF,EAGEiB,SAHF,EAIER,QAJF,EAKEC,WALF,EAMEK,sBANF,EAOEC,uBAPF,EAQEG,mBARF,EASExB,yBATF,EAUEgB,QAVF,EAWER,iBAXF,EAYEN,OAZF,EAaEI,gBAbF,EAcEoB,WAdF,EAeEC,cAfF,EAgBEC,mBAhBF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
const _excluded = ["type", "text", "url", "icon", "name", "style", "children", "clickAction"];
|
|
4
|
+
const _excluded = ["type", "text", "url", "icon", "name", "style", "children", "clickAction", "childSeoVisibility", "afterClickText"];
|
|
5
5
|
|
|
6
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
7
|
|
|
@@ -10,10 +10,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
10
10
|
import React, { useState, Fragment } from 'react';
|
|
11
11
|
import { useCookies } from 'react-cookie';
|
|
12
12
|
import { useRouter } from 'next/router';
|
|
13
|
+
import classnames from 'classnames';
|
|
13
14
|
import BlazeButton from '@blaze-react/button';
|
|
14
15
|
import { handleLogout } from '@blaze-cms/core-auth-ui';
|
|
15
16
|
import { useApolloClient } from '@apollo/client';
|
|
16
|
-
import PropTypes from 'prop-types';
|
|
17
|
+
import PropTypes, { bool, string } from 'prop-types';
|
|
17
18
|
import ClickWrapper from './ClickWrapper';
|
|
18
19
|
import BlazeLink from './BlazeLink';
|
|
19
20
|
import { withTitle } from '../HOC';
|
|
@@ -30,7 +31,9 @@ const Button = props => {
|
|
|
30
31
|
name,
|
|
31
32
|
style,
|
|
32
33
|
children,
|
|
33
|
-
clickAction
|
|
34
|
+
clickAction,
|
|
35
|
+
childSeoVisibility,
|
|
36
|
+
afterClickText
|
|
34
37
|
} = props,
|
|
35
38
|
otherProps = _objectWithoutProperties(props, _excluded);
|
|
36
39
|
|
|
@@ -81,35 +84,44 @@ const Button = props => {
|
|
|
81
84
|
wrapperProps
|
|
82
85
|
} = getClickWrapperOptions(children, props);
|
|
83
86
|
const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;
|
|
84
|
-
|
|
87
|
+
const contentClassName = classnames('button__content', {
|
|
88
|
+
'button__content--show': showChildren
|
|
89
|
+
});
|
|
90
|
+
return /*#__PURE__*/React.createElement(Wrapper, wrapperProps, childSeoVisibility && /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: contentClassName
|
|
92
|
+
}, renderedChildren), !childSeoVisibility && showChildren && renderedChildren, /*#__PURE__*/React.createElement(DynamicButton, _extends({
|
|
85
93
|
className: modifiers,
|
|
86
94
|
onClick: handleClick
|
|
87
95
|
}, currentProps), icon && /*#__PURE__*/React.createElement("i", {
|
|
88
96
|
className: icon
|
|
89
|
-
}),
|
|
97
|
+
}), showChildren ? afterClickText : text));
|
|
90
98
|
};
|
|
91
99
|
|
|
92
100
|
Button.propTypes = {
|
|
93
101
|
clickAction: PropTypes.string,
|
|
94
102
|
text: PropTypes.string,
|
|
103
|
+
afterClickText: string,
|
|
95
104
|
name: PropTypes.string,
|
|
96
105
|
type: PropTypes.string,
|
|
97
106
|
url: PropTypes.string,
|
|
98
107
|
size: PropTypes.string,
|
|
99
108
|
icon: PropTypes.string,
|
|
100
109
|
style: PropTypes.string,
|
|
110
|
+
childSeoVisibility: bool,
|
|
101
111
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
|
|
102
112
|
};
|
|
103
113
|
Button.defaultProps = {
|
|
104
114
|
clickAction: '',
|
|
105
115
|
text: '',
|
|
116
|
+
afterClickText: '',
|
|
106
117
|
name: '',
|
|
107
118
|
type: '',
|
|
108
119
|
url: null,
|
|
109
120
|
size: '',
|
|
110
121
|
icon: '',
|
|
111
122
|
style: '',
|
|
112
|
-
children: []
|
|
123
|
+
children: [],
|
|
124
|
+
childSeoVisibility: false
|
|
113
125
|
};
|
|
114
126
|
export default withTitle(Button);
|
|
115
127
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["React","useState","Fragment","useCookies","useRouter","BlazeButton","handleLogout","useApolloClient","PropTypes","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","otherProps","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","currentProps","href","title","DynamicButton","parent","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["React","useState","Fragment","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","otherProps","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","currentProps","href","title","DynamicButton","parent","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","propTypes","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment } 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 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 ...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\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 url ? router.reload(url) : 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: url, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, otherProps.parent.itemId, otherProps.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 ? afterClickText : text}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\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 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,KAAP,IAAgBC,QAAhB,EAA0BC,QAA1B,QAA0C,OAA1C;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,WAAP,MAAwB,qBAAxB;AACA,SAASC,YAAT,QAA6B,yBAA7B;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,OAAOC,SAAP,IAAoBC,IAApB,EAA0BC,MAA1B,QAAwC,YAAxC;AACA,OAAOC,YAAP,MAAyB,gBAAzB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,SAASC,SAAT,QAA0B,QAA1B;AACA,SAASC,iBAAT,QAAkC,UAAlC;AACA,SAASC,MAAT,QAAuB,cAAvB;AACA,SACEC,cADF,EAEEC,qBAFF,EAGEC,WAHF,EAIEC,sBAJF,QAKO,YALP;;AAOA,MAAMC,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;IACJC,IADI;IAEJC,IAFI;IAGJC,GAHI;IAIJC,IAJI;IAKJC,IALI;IAMJC,KANI;IAOJC,QAPI;IAQJC,WARI;IASJC,kBATI;IAUJC;E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AOjBmD,IAAI,EAAErD,SAAS,CAACE,MAPC;EAQjBe,IAAI,EAAEjB,SAAS,CAACE,MARC;EASjBiB,KAAK,EAAEnB,SAAS,CAACE,MATA;EAUjBoB,kBAAkB,EAAErB,IAVH;EAWjBmB,QAAQ,EAAEpB,SAAS,CAACsD,SAAV,CAAoB,CAACtD,SAAS,CAACuD,OAAV,CAAkBvD,SAAS,CAACwD,IAA5B,CAAD,EAAoCxD,SAAS,CAACwD,IAA9C,CAApB;AAXO,CAAnB;AAcA5C,MAAM,CAAC6C,YAAP,GAAsB;EACpBpC,WAAW,EAAE,EADO;EAEpBN,IAAI,EAAE,EAFc;EAGpBQ,cAAc,EAAE,EAHI;EAIpBL,IAAI,EAAE,EAJc;EAKpBJ,IAAI,EAAE,EALc;EAMpBE,GAAG,EAAE,IANe;EAOpBqC,IAAI,EAAE,EAPc;EAQpBpC,IAAI,EAAE,EARc;EASpBE,KAAK,EAAE,EATa;EAUpBC,QAAQ,EAAE,EAVU;EAWpBE,kBAAkB,EAAE;AAXA,CAAtB;AAcA,eAAejB,SAAS,CAACO,MAAD,CAAxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["cardData", "gridModifier", "style", "displayCategory", "displayThumbnail", "displayTitle", "modifier", "entity", "propsToDisplay", "gtmChildren", "cardChildren", "name", "designConfig", "itemsPerRow", "enableCarousel", "bannerModifier", "priorityLimit", "enableAutoScroll", "enableOverlay", "autoScrollTimer", "
|
|
3
|
+
const _excluded = ["cardData", "gridModifier", "style", "displayCategory", "displayThumbnail", "displayTitle", "modifier", "entity", "propsToDisplay", "gtmChildren", "cardChildren", "name", "designConfig", "itemsPerRow", "enableCarousel", "bannerModifier", "priorityLimit", "enableAutoScroll", "enableOverlay", "autoScrollTimer", "overlayModifier", "titleOverlayModifier"],
|
|
4
4
|
_excluded2 = ["baseAdunit", "id"];
|
|
5
5
|
import React, { useContext } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -36,7 +36,6 @@ const CardContainer = _ref => {
|
|
|
36
36
|
enableAutoScroll,
|
|
37
37
|
enableOverlay,
|
|
38
38
|
autoScrollTimer,
|
|
39
|
-
arrowSize,
|
|
40
39
|
overlayModifier,
|
|
41
40
|
titleOverlayModifier
|
|
42
41
|
} = _ref,
|
|
@@ -93,7 +92,6 @@ const CardContainer = _ref => {
|
|
|
93
92
|
displayThumbnail: displayThumbnail,
|
|
94
93
|
displayTitle: displayTitle,
|
|
95
94
|
priority: priority,
|
|
96
|
-
arrowSize: arrowSize,
|
|
97
95
|
enableOverlay: enableOverlay,
|
|
98
96
|
overlayModifier: overlayModifier,
|
|
99
97
|
titleOverlayModifier: titleOverlayModifier
|
|
@@ -123,8 +121,7 @@ CardContainer.propTypes = {
|
|
|
123
121
|
enableOverlay: PropTypes.bool,
|
|
124
122
|
overlayModifier: PropTypes.string,
|
|
125
123
|
titleOverlayModifier: PropTypes.string,
|
|
126
|
-
autoScrollTimer: PropTypes.number
|
|
127
|
-
arrowSize: PropTypes.string
|
|
124
|
+
autoScrollTimer: PropTypes.number
|
|
128
125
|
};
|
|
129
126
|
CardContainer.defaultProps = {
|
|
130
127
|
gtmChildren: [],
|
|
@@ -146,8 +143,7 @@ CardContainer.defaultProps = {
|
|
|
146
143
|
enableOverlay: false,
|
|
147
144
|
autoScrollTimer: 0,
|
|
148
145
|
overlayModifier: '',
|
|
149
|
-
titleOverlayModifier: ''
|
|
150
|
-
arrowSize: ''
|
|
146
|
+
titleOverlayModifier: ''
|
|
151
147
|
};
|
|
152
148
|
export default withTitle(CardContainer);
|
|
153
149
|
//# sourceMappingURL=CardContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardContainer.js","names":["React","useContext","PropTypes","MainContext","withTitle","Banner","Wrapper","CarouselWrapper","Card","getDynamicGridClasses","getEntitiesWithBanner","parsePropsToDisplay","getPropsToDisplayModifiers","CardContainer","cardData","gridModifier","style","displayCategory","displayThumbnail","displayTitle","modifier","entity","propsToDisplay","gtmChildren","cardChildren","name","designConfig","itemsPerRow","enableCarousel","bannerModifier","priorityLimit","enableAutoScroll","enableOverlay","autoScrollTimer","
|
|
1
|
+
{"version":3,"file":"CardContainer.js","names":["React","useContext","PropTypes","MainContext","withTitle","Banner","Wrapper","CarouselWrapper","Card","getDynamicGridClasses","getEntitiesWithBanner","parsePropsToDisplay","getPropsToDisplayModifiers","CardContainer","cardData","gridModifier","style","displayCategory","displayThumbnail","displayTitle","modifier","entity","propsToDisplay","gtmChildren","cardChildren","name","designConfig","itemsPerRow","enableCarousel","bannerModifier","priorityLimit","enableAutoScroll","enableOverlay","autoScrollTimer","overlayModifier","titleOverlayModifier","cardProps","entities","itemId","propsToDisplayModifiers","dynamicWrapperSizes","cardBannerIndex","CardWrapper","map","index","baseAdunit","id","entityProps","extraProps","dynamicKey","join","priority","propTypes","array","isRequired","string","oneOfType","arrayOf","node","bool","object","number","defaultProps"],"sources":["../../../src/components/Card/CardContainer.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { withTitle } from '../../HOC';\nimport Banner from '../Banner';\nimport Wrapper from '../Wrapper';\nimport CarouselWrapper from '../CarouselWrapper';\nimport Card from './Card';\nimport { getDynamicGridClasses } from './helpers';\nimport { getEntitiesWithBanner, parsePropsToDisplay } from '../../helpers';\nimport { getPropsToDisplayModifiers } from '../../utils';\n\nconst CardContainer = ({\n cardData,\n gridModifier,\n style,\n displayCategory,\n displayThumbnail,\n displayTitle,\n modifier,\n entity,\n propsToDisplay,\n gtmChildren,\n cardChildren,\n name,\n designConfig,\n itemsPerRow,\n enableCarousel,\n bannerModifier,\n priorityLimit,\n enableAutoScroll,\n enableOverlay,\n autoScrollTimer,\n overlayModifier,\n titleOverlayModifier,\n ...cardProps\n}) => {\n const entities = getEntitiesWithBanner(cardData, cardProps);\n const { itemId } = useContext(MainContext);\n const propsToDisplayModifiers = getPropsToDisplayModifiers(propsToDisplay);\n const dynamicWrapperSizes = enableCarousel\n ? ''\n : getDynamicGridClasses('grid', itemsPerRow, designConfig);\n let cardBannerIndex = 0;\n const CardWrapper = enableCarousel ? CarouselWrapper : Wrapper;\n\n return (\n <CardWrapper\n className={dynamicWrapperSizes}\n modifiers={gridModifier}\n itemsPerRow={itemsPerRow}\n bannerModifier={bannerModifier}\n enableAutoScroll={enableAutoScroll}\n autoScrollTimer={autoScrollTimer}>\n {entities.map(({ baseAdunit, id, ...entityProps }, index) => {\n const extraProps = parsePropsToDisplay(entityProps, propsToDisplay);\n const dynamicKey = [itemId, index].join('-');\n if (baseAdunit) cardBannerIndex += 1;\n\n const priority = priorityLimit > 0 && index + 1 <= priorityLimit;\n\n return baseAdunit ? (\n <Banner\n key={dynamicKey}\n entity={entity}\n baseAdunit={baseAdunit}\n {...entityProps}\n modifier={modifier}\n cardBannerIndex={cardBannerIndex}\n />\n ) : (\n <Card\n key={id}\n id={id}\n enableCarousel={enableCarousel}\n entity={entity}\n propsToDisplay={extraProps}\n propsToDisplayModifiers={propsToDisplayModifiers}\n modifier={modifier}\n style={style}\n cardChildren={cardChildren}\n gtmChildren={gtmChildren}\n gtmId={name}\n gridModifier={gridModifier}\n entityProps={entityProps}\n displayCategory={displayCategory}\n displayThumbnail={displayThumbnail}\n displayTitle={displayTitle}\n priority={priority}\n enableOverlay={enableOverlay}\n overlayModifier={overlayModifier}\n titleOverlayModifier={titleOverlayModifier}\n {...entityProps}\n />\n );\n })}\n </CardWrapper>\n );\n};\n\nCardContainer.propTypes = {\n cardData: PropTypes.array.isRequired,\n name: PropTypes.string,\n entity: PropTypes.string.isRequired,\n gridModifier: PropTypes.string,\n gtmChildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n cardChildren: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n propsToDisplay: PropTypes.array,\n displayCategory: PropTypes.bool,\n displayThumbnail: PropTypes.bool,\n displayTitle: PropTypes.bool,\n modifier: PropTypes.string,\n style: PropTypes.string,\n designConfig: PropTypes.object,\n itemsPerRow: PropTypes.number,\n enableCarousel: PropTypes.bool,\n bannerModifier: PropTypes.string,\n priorityLimit: PropTypes.number,\n enableAutoScroll: PropTypes.bool,\n enableOverlay: PropTypes.bool,\n overlayModifier: PropTypes.string,\n titleOverlayModifier: PropTypes.string,\n autoScrollTimer: PropTypes.number\n};\n\nCardContainer.defaultProps = {\n gtmChildren: [],\n cardChildren: [],\n name: '',\n gridModifier: '',\n propsToDisplay: [],\n displayCategory: true,\n displayThumbnail: true,\n displayTitle: true,\n modifier: '',\n style: 'portrait',\n designConfig: {},\n itemsPerRow: 1,\n enableCarousel: false,\n bannerModifier: '',\n priorityLimit: 0,\n enableAutoScroll: false,\n enableOverlay: false,\n autoScrollTimer: 0,\n overlayModifier: '',\n titleOverlayModifier: ''\n};\n\nexport default withTitle(CardContainer);\n"],"mappings":";;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,WAAT,QAA4B,8BAA5B;AACA,SAASC,SAAT,QAA0B,WAA1B;AACA,OAAOC,MAAP,MAAmB,WAAnB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,OAAOC,eAAP,MAA4B,oBAA5B;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,SAASC,qBAAT,QAAsC,WAAtC;AACA,SAASC,qBAAT,EAAgCC,mBAAhC,QAA2D,eAA3D;AACA,SAASC,0BAAT,QAA2C,aAA3C;;AAEA,MAAMC,aAAa,GAAG,QAwBhB;EAAA,IAxBiB;IACrBC,QADqB;IAErBC,YAFqB;IAGrBC,KAHqB;IAIrBC,eAJqB;IAKrBC,gBALqB;IAMrBC,YANqB;IAOrBC,QAPqB;IAQrBC,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c,EAAE,KAbW;EAc3BC,cAAc,EAAE,EAdW;EAe3BC,aAAa,EAAE,CAfY;EAgB3BC,gBAAgB,EAAE,KAhBS;EAiB3BC,aAAa,EAAE,KAjBY;EAkB3BC,eAAe,EAAE,CAlBU;EAmB3BC,eAAe,EAAE,EAnBU;EAoB3BC,oBAAoB,EAAE;AApBK,CAA7B;AAuBA,eAAe/B,SAAS,CAACS,aAAD,CAAxB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["entity", "propsToDisplay", "itemsToDisplay"],
|
|
3
|
+
const _excluded = ["entity", "propsToDisplay", "itemsToDisplay", "itemListName"],
|
|
4
4
|
_excluded2 = ["gridModifier"];
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useQuery } from '@apollo/client';
|
|
@@ -14,7 +14,8 @@ const CardFactory = _ref => {
|
|
|
14
14
|
let {
|
|
15
15
|
entity,
|
|
16
16
|
propsToDisplay,
|
|
17
|
-
itemsToDisplay
|
|
17
|
+
itemsToDisplay,
|
|
18
|
+
itemListName
|
|
18
19
|
} = _ref,
|
|
19
20
|
cardProps = _objectWithoutProperties(_ref, _excluded);
|
|
20
21
|
|
|
@@ -53,11 +54,13 @@ const CardFactory = _ref => {
|
|
|
53
54
|
CardFactory.propTypes = {
|
|
54
55
|
entity: PropTypes.string.isRequired,
|
|
55
56
|
propsToDisplay: PropTypes.array,
|
|
56
|
-
itemsToDisplay: PropTypes.array
|
|
57
|
+
itemsToDisplay: PropTypes.array,
|
|
58
|
+
itemListName: PropTypes.string
|
|
57
59
|
};
|
|
58
60
|
CardFactory.defaultProps = {
|
|
59
61
|
propsToDisplay: [],
|
|
60
|
-
itemsToDisplay: []
|
|
62
|
+
itemsToDisplay: [],
|
|
63
|
+
itemListName: ''
|
|
61
64
|
};
|
|
62
65
|
export default CardFactory;
|
|
63
66
|
//# sourceMappingURL=CardFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardFactory.js","names":["React","useQuery","PropTypes","getSingleEntitySchema","CardRender","buildPropsQuery","getGenericProps","checkPropsToUse","WITH_BANNER","CardFactory","entity","propsToDisplay","itemsToDisplay","cardProps","data","error","loading","variables","id","message","propsToDisplayValues","extraProps","gridModifier","cardRenderProps","extraModifierForBanner","banner","propTypes","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardFactory.js"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { getSingleEntitySchema } from '../../application/query';\nimport CardRender from './CardRender';\nimport { buildPropsQuery, getGenericProps, checkPropsToUse } from '../../helpers';\nimport { WITH_BANNER } from '../../constants';\n\nconst CardFactory = ({ entity, propsToDisplay, itemsToDisplay, ...cardProps }) => {\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity }\n });\n\n if (loading) return '';\n if (error) return error.message;\n if (!data) return null;\n\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const extraProps = buildPropsQuery(data, propsToDisplayValues, cardProps) || '';\n const { gridModifier, ...cardRenderProps } = getGenericProps(cardProps);\n const extraModifierForBanner = cardRenderProps.banner ? WITH_BANNER : '';\n\n return (\n <CardRender\n gridModifier={`${gridModifier}${extraModifierForBanner}`}\n bannerModifier={extraModifierForBanner}\n entity={entity}\n itemsToDisplay={itemsToDisplay}\n propsToDisplay={propsToDisplay}\n entityFields={extraProps}\n {...cardRenderProps}\n />\n );\n};\n\nCardFactory.propTypes = {\n entity: PropTypes.string.isRequired,\n propsToDisplay: PropTypes.array,\n itemsToDisplay: PropTypes.array\n};\n\nCardFactory.defaultProps = {\n propsToDisplay: [],\n itemsToDisplay: []\n};\n\nexport default CardFactory;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,qBAAT,QAAsC,yBAAtC;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SAASC,eAAT,EAA0BC,eAA1B,EAA2CC,eAA3C,QAAkE,eAAlE;AACA,SAASC,WAAT,QAA4B,iBAA5B;;AAEA,MAAMC,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"CardFactory.js","names":["React","useQuery","PropTypes","getSingleEntitySchema","CardRender","buildPropsQuery","getGenericProps","checkPropsToUse","WITH_BANNER","CardFactory","entity","propsToDisplay","itemsToDisplay","itemListName","cardProps","data","error","loading","variables","id","message","propsToDisplayValues","extraProps","gridModifier","cardRenderProps","extraModifierForBanner","banner","propTypes","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardFactory.js"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport PropTypes from 'prop-types';\nimport { getSingleEntitySchema } from '../../application/query';\nimport CardRender from './CardRender';\nimport { buildPropsQuery, getGenericProps, checkPropsToUse } from '../../helpers';\nimport { WITH_BANNER } from '../../constants';\n\nconst CardFactory = ({ entity, propsToDisplay, itemsToDisplay, itemListName, ...cardProps }) => {\n const { data, error, loading } = useQuery(getSingleEntitySchema, {\n variables: { id: entity }\n });\n\n if (loading) return '';\n if (error) return error.message;\n if (!data) return null;\n\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const extraProps = buildPropsQuery(data, propsToDisplayValues, cardProps) || '';\n const { gridModifier, ...cardRenderProps } = getGenericProps(cardProps);\n const extraModifierForBanner = cardRenderProps.banner ? WITH_BANNER : '';\n\n return (\n <CardRender\n gridModifier={`${gridModifier}${extraModifierForBanner}`}\n bannerModifier={extraModifierForBanner}\n entity={entity}\n itemsToDisplay={itemsToDisplay}\n propsToDisplay={propsToDisplay}\n entityFields={extraProps}\n {...cardRenderProps}\n />\n );\n};\n\nCardFactory.propTypes = {\n entity: PropTypes.string.isRequired,\n propsToDisplay: PropTypes.array,\n itemsToDisplay: PropTypes.array,\n itemListName: PropTypes.string\n};\n\nCardFactory.defaultProps = {\n propsToDisplay: [],\n itemsToDisplay: [],\n itemListName: ''\n};\n\nexport default CardFactory;\n"],"mappings":";;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,qBAAT,QAAsC,yBAAtC;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SAASC,eAAT,EAA0BC,eAA1B,EAA2CC,eAA3C,QAAkE,eAAlE;AACA,SAASC,WAAT,QAA4B,iBAA5B;;AAEA,MAAMC,WAAW,GAAG,QAA4E;EAAA,IAA3E;IAAEC,MAAF;IAAUC,cAAV;IAA0BC,cAA1B;IAA0CC;EAA1C,CAA2E;EAAA,IAAhBC,SAAgB;;EAC9F,MAAM;IAAEC,IAAF;IAAQC,KAAR;IAAeC;EAAf,IAA2BhB,QAAQ,CAACE,qBAAD,EAAwB;IAC/De,SAAS,EAAE;MAAEC,EAAE,EAAET;IAAN;EADoD,CAAxB,CAAzC;EAIA,IAAIO,OAAJ,EAAa,OAAO,EAAP;EACb,IAAID,KAAJ,EAAW,OAAOA,KAAK,CAACI,OAAb;EACX,IAAI,CAACL,IAAL,EAAW,OAAO,IAAP;EAEX,MAAMM,oBAAoB,GAAGd,eAAe,CAACI,cAAD,CAA5C;EACA,MAAMW,UAAU,GAAGjB,eAAe,CAACU,IAAD,EAAOM,oBAAP,EAA6BP,SAA7B,CAAf,IAA0D,EAA7E;;EACA,yBAA6CR,eAAe,CAACQ,SAAD,CAA5D;EAAA,MAAM;IAAES;EAAF,CAAN;EAAA,MAAyBC,eAAzB;;EACA,MAAMC,sBAAsB,GAAGD,eAAe,CAACE,MAAhB,GAAyBlB,WAAzB,GAAuC,EAAtE;EAEA,oBACE,oBAAC,UAAD;IACE,YAAY,EAAG,GAAEe,YAAa,GAAEE,sBAAuB,EADzD;IAEE,cAAc,EAAEA,sBAFlB;IAGE,MAAM,EAAEf,MAHV;IAIE,cAAc,EAAEE,cAJlB;IAKE,cAAc,EAAED,cALlB;IAME,YAAY,EAAEW;EANhB,GAOME,eAPN,EADF;AAWD,CAzBD;;AA2BAf,WAAW,CAACkB,SAAZ,GAAwB;EACtBjB,MAAM,EAAER,SAAS,CAAC0B,MAAV,CAAiBC,UADH;EAEtBlB,cAAc,EAAET,SAAS,CAAC4B,KAFJ;EAGtBlB,cAAc,EAAEV,SAAS,CAAC4B,KAHJ;EAItBjB,YAAY,EAAEX,SAAS,CAAC0B;AAJF,CAAxB;AAOAnB,WAAW,CAACsB,YAAZ,GAA2B;EACzBpB,cAAc,EAAE,EADS;EAEzBC,cAAc,EAAE,EAFS;EAGzBC,YAAY,EAAE;AAHW,CAA3B;AAMA,eAAeJ,WAAf"}
|
|
@@ -95,7 +95,7 @@ const CarouselWrapper = ({
|
|
|
95
95
|
handleButtonNavigation();
|
|
96
96
|
}
|
|
97
97
|
}, /*#__PURE__*/React.createElement("i", {
|
|
98
|
-
className: "carousel--arrow-
|
|
98
|
+
className: "cards-carousel--arrow cards-carousel--arrow__left"
|
|
99
99
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
100
100
|
className: "cards-carousel--right-button-wrapper"
|
|
101
101
|
}, displayRight && /*#__PURE__*/React.createElement("button", {
|
|
@@ -106,7 +106,7 @@ const CarouselWrapper = ({
|
|
|
106
106
|
handleButtonNavigation(true);
|
|
107
107
|
}
|
|
108
108
|
}, /*#__PURE__*/React.createElement("i", {
|
|
109
|
-
className: "carousel--arrow-
|
|
109
|
+
className: "cards-carousel--arrow cards-carousel--arrow__right"
|
|
110
110
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
111
111
|
className: contentClassName,
|
|
112
112
|
ref: ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarouselWrapper.js","names":["React","useRef","useState","useEffect","PropTypes","CarouselWrapper","children","bannerModifier","itemsPerRow","enableAutoScroll","autoScrollTimer","arrowSize","ref","buttonDisplay","setButtonDisplays","displayLeft","displayRight","shouldAutoScroll","setShouldAutoScroll","autoScrollRef","current","id","setInterval","scrollCheck","clearInterval","handleButtonNavigation","offsetWidth","scrollWidth","handleScroll","scrollLeft","updatedDisplayLeft","updatedDisplayRight","direction","wrapperClassName","contentClassName","propTypes","string","number","oneOfType","arrayOf","node","bool","defaultProps"],"sources":["../../src/components/CarouselWrapper.js"],"sourcesContent":["import React, { useRef, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\n\nconst CarouselWrapper = ({\n children,\n bannerModifier,\n itemsPerRow,\n enableAutoScroll,\n autoScrollTimer,\n arrowSize\n}) => {\n const ref = useRef();\n const [buttonDisplay, setButtonDisplays] = useState({ displayLeft: false, displayRight: true });\n const [shouldAutoScroll, setShouldAutoScroll] = useState(false);\n const autoScrollRef = useRef();\n\n useEffect(\n () => {\n autoScrollRef.current = shouldAutoScroll;\n const id = setInterval(scrollCheck, autoScrollTimer);\n function scrollCheck() {\n if (!autoScrollRef.current) {\n clearInterval(id);\n } else {\n handleButtonNavigation(true);\n }\n }\n\n return () => clearInterval(id);\n },\n [autoScrollTimer, shouldAutoScroll]\n );\n\n useEffect(\n () => {\n const {\n current: { offsetWidth, scrollWidth }\n } = ref;\n if (scrollWidth <= offsetWidth)\n setButtonDisplays({ displayLeft: false, displayRight: false });\n setShouldAutoScroll(enableAutoScroll);\n },\n [enableAutoScroll]\n );\n\n const handleScroll = () => {\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n const updatedDisplayLeft = !!scrollLeft;\n const updatedDisplayRight = scrollLeft + offsetWidth + 1 < scrollWidth;\n setButtonDisplays({ displayLeft: updatedDisplayLeft, displayRight: updatedDisplayRight });\n };\n\n const handleButtonNavigation = direction => {\n if (!ref || !ref.current) return;\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n\n if (autoScrollRef.current && scrollLeft + offsetWidth >= scrollWidth) {\n ref.current.scrollLeft = 0;\n } else {\n ref.current.scrollLeft = direction ? scrollLeft + offsetWidth : scrollLeft - offsetWidth;\n }\n };\n\n const { displayLeft, displayRight } = buttonDisplay;\n const wrapperClassName = `cards-carousel${bannerModifier}`;\n const contentClassName = `cards-carousel--content items-per-row-${itemsPerRow}`;\n\n return (\n <div className={wrapperClassName}>\n <div className=\"cards-carousel--left-button-wrapper\">\n {displayLeft && (\n <button\n type=\"button\"\n className=\"cards-carousel--button-back icon-button icon\"\n onClick={() => {\n setShouldAutoScroll(false);\n handleButtonNavigation();\n }}>\n <i className=\"carousel--arrow-
|
|
1
|
+
{"version":3,"file":"CarouselWrapper.js","names":["React","useRef","useState","useEffect","PropTypes","CarouselWrapper","children","bannerModifier","itemsPerRow","enableAutoScroll","autoScrollTimer","arrowSize","ref","buttonDisplay","setButtonDisplays","displayLeft","displayRight","shouldAutoScroll","setShouldAutoScroll","autoScrollRef","current","id","setInterval","scrollCheck","clearInterval","handleButtonNavigation","offsetWidth","scrollWidth","handleScroll","scrollLeft","updatedDisplayLeft","updatedDisplayRight","direction","wrapperClassName","contentClassName","propTypes","string","number","oneOfType","arrayOf","node","bool","defaultProps"],"sources":["../../src/components/CarouselWrapper.js"],"sourcesContent":["import React, { useRef, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\n\nconst CarouselWrapper = ({\n children,\n bannerModifier,\n itemsPerRow,\n enableAutoScroll,\n autoScrollTimer,\n arrowSize\n}) => {\n const ref = useRef();\n const [buttonDisplay, setButtonDisplays] = useState({ displayLeft: false, displayRight: true });\n const [shouldAutoScroll, setShouldAutoScroll] = useState(false);\n const autoScrollRef = useRef();\n\n useEffect(\n () => {\n autoScrollRef.current = shouldAutoScroll;\n const id = setInterval(scrollCheck, autoScrollTimer);\n function scrollCheck() {\n if (!autoScrollRef.current) {\n clearInterval(id);\n } else {\n handleButtonNavigation(true);\n }\n }\n\n return () => clearInterval(id);\n },\n [autoScrollTimer, shouldAutoScroll]\n );\n\n useEffect(\n () => {\n const {\n current: { offsetWidth, scrollWidth }\n } = ref;\n if (scrollWidth <= offsetWidth)\n setButtonDisplays({ displayLeft: false, displayRight: false });\n setShouldAutoScroll(enableAutoScroll);\n },\n [enableAutoScroll]\n );\n\n const handleScroll = () => {\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n const updatedDisplayLeft = !!scrollLeft;\n const updatedDisplayRight = scrollLeft + offsetWidth + 1 < scrollWidth;\n setButtonDisplays({ displayLeft: updatedDisplayLeft, displayRight: updatedDisplayRight });\n };\n\n const handleButtonNavigation = direction => {\n if (!ref || !ref.current) return;\n const {\n current: { offsetWidth, scrollLeft, scrollWidth }\n } = ref;\n\n if (autoScrollRef.current && scrollLeft + offsetWidth >= scrollWidth) {\n ref.current.scrollLeft = 0;\n } else {\n ref.current.scrollLeft = direction ? scrollLeft + offsetWidth : scrollLeft - offsetWidth;\n }\n };\n\n const { displayLeft, displayRight } = buttonDisplay;\n const wrapperClassName = `cards-carousel${bannerModifier}`;\n const contentClassName = `cards-carousel--content items-per-row-${itemsPerRow}`;\n\n return (\n <div className={wrapperClassName}>\n <div className=\"cards-carousel--left-button-wrapper\">\n {displayLeft && (\n <button\n type=\"button\"\n className=\"cards-carousel--button-back icon-button icon\"\n onClick={() => {\n setShouldAutoScroll(false);\n handleButtonNavigation();\n }}>\n <i className=\"cards-carousel--arrow cards-carousel--arrow__left\" />\n </button>\n )}\n </div>\n <div className=\"cards-carousel--right-button-wrapper\">\n {displayRight && (\n <button\n type=\"button\"\n className=\"cards-carousel--button-forward icon-button icon\"\n onClick={() => {\n setShouldAutoScroll(false);\n handleButtonNavigation(true);\n }}>\n <i className=\"cards-carousel--arrow cards-carousel--arrow__right\" />\n </button>\n )}\n </div>\n <div className={contentClassName} ref={ref} onScroll={handleScroll}>\n {children}\n </div>\n </div>\n );\n};\n\nCarouselWrapper.propTypes = {\n bannerModifier: PropTypes.string,\n itemsPerRow: PropTypes.number,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n enableAutoScroll: PropTypes.bool,\n autoScrollTimer: PropTypes.number,\n arrowSize: PropTypes.number\n};\n\nCarouselWrapper.defaultProps = {\n itemsPerRow: 0,\n bannerModifier: '',\n children: [],\n enableAutoScroll: false,\n autoScrollTimer: 0,\n arrowSize: 14\n};\n\nexport default CarouselWrapper;\n"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,MAAhB,EAAwBC,QAAxB,EAAkCC,SAAlC,QAAmD,OAAnD;AACA,OAAOC,SAAP,MAAsB,YAAtB;;AAEA,MAAMC,eAAe,GAAG,CAAC;EACvBC,QADuB;EAEvBC,cAFuB;EAGvBC,WAHuB;EAIvBC,gBAJuB;EAKvBC,eALuB;EAMvBC;AANuB,CAAD,KAOlB;EACJ,MAAMC,GAAG,GAAGX,MAAM,EAAlB;EACA,MAAM,CAACY,aAAD,EAAgBC,iBAAhB,IAAqCZ,QAAQ,CAAC;IAAEa,WAAW,EAAE,KAAf;IAAsBC,YAAY,EAAE;EAApC,CAAD,CAAnD;EACA,MAAM,CAACC,gBAAD,EAAmBC,mBAAnB,IAA0ChB,QAAQ,CAAC,KAAD,CAAxD;EACA,MAAMiB,aAAa,GAAGlB,MAAM,EAA5B;EAEAE,SAAS,CACP,MAAM;IACJgB,aAAa,CAACC,OAAd,GAAwBH,gBAAxB;IACA,MAAMI,EAAE,GAAGC,WAAW,CAACC,WAAD,EAAcb,eAAd,CAAtB;;IACA,SAASa,WAAT,GAAuB;MACrB,IAAI,CAACJ,aAAa,CAACC,OAAnB,EAA4B;QAC1BI,aAAa,CAACH,EAAD,CAAb;MACD,CAFD,MAEO;QACLI,sBAAsB,CAAC,IAAD,CAAtB;MACD;IACF;;IAED,OAAO,MAAMD,aAAa,CAACH,EAAD,CAA1B;EACD,CAbM,EAcP,CAACX,eAAD,EAAkBO,gBAAlB,CAdO,CAAT;EAiBAd,SAAS,CACP,MAAM;IACJ,MAAM;MACJiB,OAAO,EAAE;QAAEM,WAAF;QAAeC;MAAf;IAD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AA/B;AASA,eAAeN,eAAf"}
|
|
@@ -3,6 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
|
|
|
3
3
|
const _excluded = ["alt", "imageUrl", "handleEnableLightbox", "toggleLightbox", "displayLightbox", "enableLightbox", "caption", "lightboxImgProps", "name", "metaTitle", "heroModifier", "style", "isHero", "priority", "sizeKey"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import Head from 'next/head';
|
|
6
7
|
import { ResponsiveImage } from '@blaze-cms/image-cdn-react';
|
|
7
8
|
import Lightbox from './Lightbox';
|
|
8
9
|
|
|
@@ -29,12 +30,14 @@ const ImageRender = _ref => {
|
|
|
29
30
|
const imageStyle = enableLightbox ? {
|
|
30
31
|
cursor: 'pointer'
|
|
31
32
|
} : style;
|
|
33
|
+
const HeadComponent = priority ? Head : null;
|
|
32
34
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ResponsiveImage, {
|
|
33
35
|
sizeKey: sizeKey,
|
|
34
36
|
alt: alt,
|
|
35
37
|
src: imageUrl,
|
|
36
38
|
onClick: handleEnableLightbox,
|
|
37
|
-
style: imageStyle
|
|
39
|
+
style: imageStyle,
|
|
40
|
+
HeadComponent: HeadComponent
|
|
38
41
|
}), displayLightbox && /*#__PURE__*/React.createElement(Lightbox, _extends({
|
|
39
42
|
imageUrl: imageUrl,
|
|
40
43
|
alt: alt,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageRender.js","names":["React","PropTypes","ResponsiveImage","Lightbox","ImageRender","alt","imageUrl","handleEnableLightbox","toggleLightbox","displayLightbox","enableLightbox","caption","lightboxImgProps","name","metaTitle","heroModifier","style","isHero","priority","sizeKey","otherProps","imageStyle","cursor","propTypes","bool","isRequired","string","func","object","defaultProps"],"sources":["../../../src/components/Image/ImageRender.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { ResponsiveImage } from '@blaze-cms/image-cdn-react';\nimport Lightbox from './Lightbox';\n\nconst ImageRender = ({\n alt,\n imageUrl,\n handleEnableLightbox,\n toggleLightbox,\n displayLightbox,\n enableLightbox,\n caption,\n lightboxImgProps,\n name,\n metaTitle,\n heroModifier,\n style,\n isHero,\n priority,\n sizeKey,\n ...otherProps\n}) => {\n const imageStyle = enableLightbox ? { cursor: 'pointer' } : style;\n\n return (\n <>\n <ResponsiveImage\n sizeKey={sizeKey}\n alt={alt}\n src={imageUrl}\n onClick={handleEnableLightbox}\n style={imageStyle}\n />\n {displayLightbox && (\n <Lightbox\n imageUrl={imageUrl}\n alt={alt}\n priority={priority}\n closeModal={toggleLightbox}\n caption={caption}\n imgWrapperProps={lightboxImgProps}\n name={metaTitle || name}\n {...otherProps}\n />\n )}\n </>\n );\n};\n\nImageRender.propTypes = {\n displayLightbox: PropTypes.bool.isRequired,\n enableLightbox: PropTypes.bool.isRequired,\n alt: PropTypes.string,\n caption: PropTypes.string,\n imageUrl: PropTypes.string.isRequired,\n name: PropTypes.string,\n heroModifier: PropTypes.string,\n metaTitle: PropTypes.string,\n handleEnableLightbox: PropTypes.func.isRequired,\n toggleLightbox: PropTypes.func.isRequired,\n lightboxImgProps: PropTypes.object.isRequired,\n style: PropTypes.object,\n isHero: PropTypes.bool,\n priority: PropTypes.bool,\n sizeKey: PropTypes.string\n};\n\nImageRender.defaultProps = {\n name: '',\n metaTitle: '',\n heroModifier: '',\n alt: '',\n caption: '',\n isHero: false,\n priority: false,\n style: {},\n sizeKey: ''\n};\n\nexport default ImageRender;\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,eAAT,QAAgC,4BAAhC;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,MAAMC,WAAW,GAAG,QAiBd;EAAA,IAjBe;IACnBC,GADmB;IAEnBC,QAFmB;IAGnBC,oBAHmB;IAInBC,cAJmB;IAKnBC,eALmB;IAMnBC,cANmB;IAOnBC,OAPmB;IAQnBC,gBARmB;IASnBC,IATmB;IAUnBC,SAVmB;IAWnBC,YAXmB;IAYnBC,KAZmB;IAanBC,MAbmB;IAcnBC,QAdmB;IAenBC;EAfmB,CAiBf;EAAA,IADDC,UACC;;EACJ,MAAMC,UAAU,GAAGX,cAAc,GAAG;IAAEY,MAAM,EAAE;EAAV,CAAH,GAA2BN,KAA5D;EAEA,oBACE,uDACE,oBAAC,eAAD;IACE,OAAO,
|
|
1
|
+
{"version":3,"file":"ImageRender.js","names":["React","PropTypes","Head","ResponsiveImage","Lightbox","ImageRender","alt","imageUrl","handleEnableLightbox","toggleLightbox","displayLightbox","enableLightbox","caption","lightboxImgProps","name","metaTitle","heroModifier","style","isHero","priority","sizeKey","otherProps","imageStyle","cursor","HeadComponent","propTypes","bool","isRequired","string","func","object","defaultProps"],"sources":["../../../src/components/Image/ImageRender.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Head from 'next/head';\nimport { ResponsiveImage } from '@blaze-cms/image-cdn-react';\nimport Lightbox from './Lightbox';\n\nconst ImageRender = ({\n alt,\n imageUrl,\n handleEnableLightbox,\n toggleLightbox,\n displayLightbox,\n enableLightbox,\n caption,\n lightboxImgProps,\n name,\n metaTitle,\n heroModifier,\n style,\n isHero,\n priority,\n sizeKey,\n ...otherProps\n}) => {\n const imageStyle = enableLightbox ? { cursor: 'pointer' } : style;\n const HeadComponent = priority ? Head : null;\n\n return (\n <>\n <ResponsiveImage\n sizeKey={sizeKey}\n alt={alt}\n src={imageUrl}\n onClick={handleEnableLightbox}\n style={imageStyle}\n HeadComponent={HeadComponent}\n />\n {displayLightbox && (\n <Lightbox\n imageUrl={imageUrl}\n alt={alt}\n priority={priority}\n closeModal={toggleLightbox}\n caption={caption}\n imgWrapperProps={lightboxImgProps}\n name={metaTitle || name}\n {...otherProps}\n />\n )}\n </>\n );\n};\n\nImageRender.propTypes = {\n displayLightbox: PropTypes.bool.isRequired,\n enableLightbox: PropTypes.bool.isRequired,\n alt: PropTypes.string,\n caption: PropTypes.string,\n imageUrl: PropTypes.string.isRequired,\n name: PropTypes.string,\n heroModifier: PropTypes.string,\n metaTitle: PropTypes.string,\n handleEnableLightbox: PropTypes.func.isRequired,\n toggleLightbox: PropTypes.func.isRequired,\n lightboxImgProps: PropTypes.object.isRequired,\n style: PropTypes.object,\n isHero: PropTypes.bool,\n priority: PropTypes.bool,\n sizeKey: PropTypes.string\n};\n\nImageRender.defaultProps = {\n name: '',\n metaTitle: '',\n heroModifier: '',\n alt: '',\n caption: '',\n isHero: false,\n priority: false,\n style: {},\n sizeKey: ''\n};\n\nexport default ImageRender;\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,OAAOC,IAAP,MAAiB,WAAjB;AACA,SAASC,eAAT,QAAgC,4BAAhC;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,MAAMC,WAAW,GAAG,QAiBd;EAAA,IAjBe;IACnBC,GADmB;IAEnBC,QAFmB;IAGnBC,oBAHmB;IAInBC,cAJmB;IAKnBC,eALmB;IAMnBC,cANmB;IAOnBC,OAPmB;IAQnBC,gBARmB;IASnBC,IATmB;IAUnBC,SAVmB;IAWnBC,YAXmB;IAYnBC,KAZmB;IAanBC,MAbmB;IAcnBC,QAdmB;IAenBC;EAfmB,CAiBf;EAAA,IADDC,UACC;;EACJ,MAAMC,UAAU,GAAGX,cAAc,GAAG;IAAEY,MAAM,EAAE;EAAV,CAAH,GAA2BN,KAA5D;EACA,MAAMO,aAAa,GAAGL,QAAQ,GAAGjB,IAAH,GAAU,IAAxC;EAEA,oBACE,uDACE,oBAAC,eAAD;IACE,OAAO,EAAEkB,OADX;IAEE,GAAG,EAAEd,GAFP;IAGE,GAAG,EAAEC,QAHP;IAIE,OAAO,EAAEC,oBAJX;IAKE,KAAK,EAAEc,UALT;IAME,aAAa,EAAEE;EANjB,EADF,EASGd,e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