Usage
Add the script tag to head and use the library after the dom is ready
Code Block | ||
---|---|---|
| ||
<html> <head> <script src="https://dev-meglerpakke.ambita.com/package/mflex.umd.js" charset="utf-8"></script> </head> <body> <h1> Welcome to Ambita Infoland components! </h1> <div id="search" style="height: 75px"></div> <div id="product-list"></div> <button id="confirm">Confirm order</button> <script> document.addEventListener('DOMContentLoaded', () => { window.Ambita.mFlex.init({ environment: 'beta', token: {" access_token":"742461ce '74246ace-f71f-423f-951a-8a9816a3319a","', token_type":" 'Bearer","', expires_in": 3600," refresh_token":"80094947 '80194947-73f6-47f6-92ca-66803abb7686","scope":["productcatalog.read","authentication.geodatatoken","authentication.usercatalog.read","authentication.usercatalog.write","shopping.read","shopping.write","realty.access_to_personal_numbers","realty.access_customer","invoice.read","price.calculator.read","realty.access_creation_of_rights","payment.create","realty.housing_value","realty.decision_person","realty.search","realty.document_copy","realty.pdf_land_hist","realty.pdf_technical","realty.basic","realty.internal","realty.pdf_doc_hist","realty.liens_calculation","realty.decision_object","realty.pdf_land","realty.ownership","realty.pdf_doc","realty.pdf_old_cadastre","realty.pdf_map","realty.access_creation_of_rights_person","billing.user.read","personaldata.full_access","realty.person","realty.geometry","shopping.analytics","kode.distributor.messages.read","kode.distributor.messages.write","infoland.flex","realty.value_4cg_auth","productcatalog.write"],"expires_at":"', scope:['infoland.flex'], expires_at: '2022-09-27T07:47:49.774Z"' }, reference: 'test' }); window.Ambita.mFlex.search.onSearchResult = (result) => { console.log(result); }; window.Ambita.mFlex.search.load('#search'); window.Ambita.mFlex.productList.load('#product-list', { share:{}, cadastre:{ knr: '0301', gnr: '224', bnr: '64', snr: '18' } }); const confirmButton = document.getElementById('confirm'); confirmButton.addEventListener('click', async () => { const orderNumber = await window.Ambita.mFlex.productList.confirmOrder(); console.log(orderNumber); }); }); </script> </body> </html> |
See Usage for more information about how to use the init
and load
functions.