{"version":3,"file":"ShortcutContentFinder.mjs","names":["React","useEffect","useMemo","useState","ListSearch","EntityAttributeEnums","LogicalSearchOperatorEnums","UdpEnums","getBaseMethod","executeQueryAdHoc","useActionState","useShellStore","useUser","getSearchObject","useTenantStore","ShortcutContentFinder","props","$","_c","onSelect","t0","Symbol","for","shortcutContentOptions","setShortCutContentOptions","actionState","catalogPromotedEntities","shellHidden","_temp","user","isProductTenant","_temp2","t1","Udp_Shortcut_Content","shortcutContentSearchApiMethod","t2","getTemplateOptions","options","filterElements","push","searchField","Is_Product_ShortcutContent","searchValue","searchOperator","searchObject","Or","data","shortcutContentResponse","apiMethodId","status","pageList","t3","t4","t5","state","state_0"],"sources":["../../../src/udp/ShortcutContent/ShortcutContentFinder.jsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport { ListSearch } from './ListSearch';\nimport {\n  EntityAttributeEnums,\n  LogicalSearchOperatorEnums,\n  UdpEnums\n} from '../../enums/unitySystemEnums';\nimport { getBaseMethod, executeQueryAdHoc } from '../utilities/methodUtils';\nimport { useActionState } from '../../hooks/useActions';\nimport { useShellStore } from '../../stores/shellStore';\nimport { useUser } from '../../utilities/auth/useUser';\nimport { getSearchObject } from '../../utilities/search/SearchUtilities';\nimport { useTenantStore } from '../../stores/tenantStore';\n\nexport const ShortcutContentFinder = (props) => {\n  const { onSelect } = props;\n  const [shortcutContentOptions, setShortCutContentOptions] = useState([]);\n  const actionState = useActionState();\n  const { catalogPromotedEntities } = actionState;\n  const shellHidden = useShellStore((state) => state.shellHidden);\n  const user = useUser();\n  const isProductTenant = useTenantStore((state) => state.isProductTenant);\n\n  const shortcutContentSearchApiMethod = useMemo(() => {\n    return getBaseMethod(\n      UdpEnums.Udp_Shortcut_Content,\n      'unityBaseSearchMethod',\n      catalogPromotedEntities\n    );\n  }, [catalogPromotedEntities]);\n\n  useEffect(() => {\n    const getTemplateOptions = async () => {\n      let options = [];\n      if (shortcutContentSearchApiMethod) {\n        const filterElements = [];\n        if (isProductTenant) {\n          filterElements.push({\n            searchField: EntityAttributeEnums.Is_Product_ShortcutContent,\n            searchValue: true,\n            searchOperator: '='\n          });\n        }\n        const searchObject = getSearchObject(\n          filterElements,\n          LogicalSearchOperatorEnums.Or,\n          200,\n          true\n        );\n        const data = { data: searchObject };\n        const shortcutContentResponse = await executeQueryAdHoc(\n          data,\n          shortcutContentSearchApiMethod.apiMethodId\n        );\n        if (shortcutContentResponse?.status === 200) {\n          options = shortcutContentResponse.data?.pageList;\n        }\n      }\n\n      setShortCutContentOptions(options);\n    };\n    getTemplateOptions();\n  }, [\n    shortcutContentSearchApiMethod,\n    setShortCutContentOptions,\n    user,\n    isProductTenant\n  ]);\n\n  return (\n    <ListSearch\n      items={shortcutContentOptions}\n      onClick={onSelect}\n      searchLabel='Filter Shortcuts'\n      includeTags={true}\n      maxHeight={`calc(100vh - ${shellHidden ? '614px' : '669px'})`}\n    />\n  );\n};\n"],"mappings":";;;;;;;;;;;AAcA,MAAae,yBAAwBC,UAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CACnC,MAAA,EAAAC,aAAqBH;CAAM,IAAAI;AAAA,KAAAH,EAAA,OAAAI,OAAAC,IAAA,4BAAA,EAAA;AAC0CF,OAAA,EAAE;AAAAH,IAAA,KAAAG;OAAAA,MAAAH,EAAA;CAAvE,MAAA,CAAAM,wBAAAC,6BAA4DrB,SAASiB,GAAG;CAExE,MAAA,EAAAM,4BADoBhB,gBAAgB;CAEpC,MAAAiB,cAAoBhB,cAAciB,MAA6B;CAC/D,MAAAC,OAAajB,SAAS;CACtB,MAAAkB,kBAAwBhB,eAAeiB,OAAiC;CAAC,IAAAC;AAAA,KAAAf,EAAA,OAAAS,yBAAA;AAGhEM,OAAAxB,cACLD,SAAQ0B,sBACR,yBACAP,wBACD;AAAAT,IAAA,KAAAS;AAAAT,IAAA,KAAAe;OAAAA,MAAAf,EAAA;CALH,MAAAiB,iCACEF;CAK4B,IAAAG;AAAA,KAAAlB,EAAA,OAAAa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