Liferay.Loader.define("@liferay/commerce-term-web@1.0.27/js/commerce_order_types",["module","exports","require","commerce-frontend-js/ServiceProvider/index","commerce-frontend-js/components/item_finder/entry","commerce-frontend-js/utilities/eventsDefinitions","frontend-js-web"],(function(e,r,t){window;{Object.defineProperty(r,"__esModule",{value:!0}),r.default=function _default({datasetId:e,rootPortletId:r,termExternalReferenceCode:t,termId:o}){const s=n.default.AdminOrderAPI("v1");(0,d.default)("itemFinder","item-finder-root-order-types",{apiUrl:"/o/headless-commerce-admin-order/v1.0/order-types/",getSelectedItems:()=>Promise.resolve([]),inputPlaceholder:Liferay.Language.get("find-an-order-type"),itemCreation:!1,itemSelectedMessage:Liferay.Language.get("order-type-selected"),itemsKey:"id",linkedDatasetsId:[e],onItemSelected:function selectItem(r){const n={orderTypeExternalReferenceCode:r.externalReferenceCode,orderTypeId:r.id,termExternalReferenceCode:t,termId:o};return s.addTermOrderType(o,n).then((()=>{Liferay.fire(i.UPDATE_DATASET_DISPLAY,{id:e})})).catch((e=>{const r={"the-qualifier-is-already-linked":Liferay.Language.get("the-qualifier-is-already-linked")};(0,a.openToast)({message:r[e.message]||Liferay.Language.get("an-unexpected-error-occurred"),title:Liferay.Language.get("error"),type:"danger"})}))},pageSize:10,panelHeaderLabel:Liferay.Language.get("add-order-types"),portletId:r,schema:[{fieldName:["name","LANG"]}],titleLabel:Liferay.Language.get("add-existing-order-type")})};var n=_interopRequireDefault(t("commerce-frontend-js/ServiceProvider/index")),d=_interopRequireDefault(t("commerce-frontend-js/components/item_finder/entry")),i=t("commerce-frontend-js/utilities/eventsDefinitions"),a=t("frontend-js-web");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=commerce_order_types.js.map