Table of content:
Ambita.mFlex.init
This is used for configuration and injection of the components
Example
window.Ambita.mFlex.init({ environment: 'test', token: tokenObject, reference: '123456789', technicalReference: '123456789', externalDepartmentId: 1234, });
Name | Required | Type | Options | Description |
---|---|---|---|---|
| True | string |
| The environment you want connect to |
| True | object / string | This is where you pass in the token object for the logged in user, returned from the authentication service, see Authentication for more information. | |
| True | string | The reference property is added to the order when placed. This must be something that connects the order to the entity in your application that the user can relate to and have an understanding of. Could be an ID or key unique to an assignment or a project. The reference will show up on the invoices from Ambita | |
| False | string | The technical reference is added to the order and can be used by your application, in case you want to track the orders. We recommend using this when handling file deliveries, see File deliveries . | |
| False | number | Used in spesial cases only |
Ambita.mFlex.productList.load
This function will load product list and takes in a json object as a search query.
Example
window.Ambita.mFlex.productList.load('query-selector', { cadastre: { knr: '0301', gnr: '1', bnr: '1', fnr: '0', snr: '0' }, share: { organizationNumber: '123456789', shareNumber: '123' }, address: { key: '123-123456-12-A' } });
Cadastre
Name | Description |
---|---|
| Municipality number (Kommunenummer) |
| Cadastre Unit number (Gårdsnummer) |
| Unit number (Bruksnummer) |
| Leasehold Unit number (Festenummer) |
| Section number (Seksjonsnummer) |
Share
Name | Description |
---|---|
| Organization number of the cooperative |
| The number of the “right of occupation” (andelsnummer) |
Address
Name | Description |
---|---|
| If you have used the search to find the property, the object from the result will contain a address key, add it here, some properties has multiple addresses. |
Ambita.mFlex.productList.confirmOrder
This function will confirm the order with selected products
(async () => { try { const orderNumber = await window.Ambita.mFlex.productList.confirmOrder(); // do something with orderNumber } catch(error) { notifyCustomer(error.message); } })();
Ambita.mFlex.search.load
This function will load the search inside a element
window.Ambita.mFlex.search.load('query-selector');
Ambita.mFlex.search.onSearchResult
Set this property to a function, this will be triggered whenever the user finish the search
window.Ambita.mFlex.search.onSearchResult = (result) => { console.log(result); };
Output:
{ "itemKeys": { "cadastre": "123-1-1-0-0", "address": "123-12345-12-A" }, "productsQuery": "cadastre=123-1-1-0-0&address=123-12345-12-A", "cadastre": { "title": "0123/1/1/0/0", "id": "123-1-1-0-0", "ident": { "municipalityNumber": 123, "cadastralUnitNumber": 1, "unitNumber": 1, "leaseholdUnitNumber": 0, "sectionNumber": 0, "leasehold": false, "section": true }, "cadastre": { "knr": 123, "gnr": 1, "bnr": 1, "fnr": 0, "snr": 0 }, "subtitle": "Gateadresse 1A", "geojson": { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 263267.79, 6651901.69 ] }, "properties": { "id": "123-1-1-0-0", "title": "123/1/1/0/0", "icon": "cube", "type": "group" }, "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::25833" } } }, "addressesLink": "https://beta-api.ambita.com/realty/v1/cadastres/123-1-1-0-0/addresses/", "ownersLink": "https://beta-api.ambita.com/realty/v1/cadastres/123-1-1-0-0/owners/", "links": { "self": { "rel": "Cadastre", "href": "https://beta-api.ambita.com/realty/v1/cadastres/123-1-1-0-0" }, "cadastre": { "rel": "Cadastre", "href": "https://beta-api.ambita.com/realty/v1/cadastres/123-1-1-0-0" }, "owners": { "rel": "Person", "href": "https://beta-api.ambita.com/realty/v1/cadastres/123-1-1-0-0/owners/" }, "addresses": { "rel": "Address", "href": "https://beta-api.ambita.com/realty/v1/cadastres/123-1-1-0-0/addresses/" } }, "isRegisteredLand": true, "isHistoricalRegisteredLand": false, "isTechnicalRegisteredLand": true, "isHistoricalTechnicalRegisteredLand": false } }
Ambita.mFlex.receipt
This function will load the receipt component. Which shows current status about the products, the propertydata the documents were ordered on. As well as the possibility to download the files on the product.
You get the order number from this function: Ambita.mFlex.productList.confirmOrder
window.Ambita.mFlex.receipt.load('query-selector', <order number>);