Table of content:
Table of Contents | ||
---|---|---|
|
Ambita.
...
mFlex.init
This is used for configuration and injection of the components, available props are:
Example
Code Block | ||
---|---|---|
| ||
window.Ambita.mFlex.init({
environment: 'beta',
token: tokenObject,
reference: '123456789',
technicalReference: '123456789',
externalDepartmentId: 1234,
}); |
Name | Required | Type | Options | Description |
---|
element
| True | string |
This property is used for setting the id of the html element you want the components to load.
category
True
string
realtestate
| 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 |
| False | number | Used in spesial cases only |
onOrderConfirmed
False
function
This function must be used to save the order id in your application, you need this to handle file deliveries later, see Infoland Flex - File Handling .
...
Ambita.mFlex.productList.load
This function will load product list and takes in a json object as a search query.
Example
Code Block | ||
---|---|---|
| ||
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. |
Anchor | ||||
---|---|---|---|---|
|
This function will confirm the order with selected products
Code Block |
---|
(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 do the actual loading of the components and takes inn a json object as a search query.
You should try to fill out as much as possible of these fields, depending on what type of property you want to buy. You should always try to fill out as much as possible and the components will calculate what property you are looking for based on the query.
...
Name
...
Description
...
cadastre
...
share
...
owner
...
load the search inside a element
Code Block |
---|
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
Code Block |
---|
window.Ambita.mFlex.search.onSearchResult = (result) => {
console.log(result);
}; |
Output:
Code Block |
---|
{
"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
Code Block |
---|
window.Ambita.mFlex.receipt.load('query-selector', <order number>); |