Class: MovingCostCalculator

MovingCostCalculator(target, parametersopt)

MovingCostCalculator Class used to handle the MovingCostCalculator module

Constructor

new MovingCostCalculator(target, parametersopt)

Creates an instance of MovingCostCalculator and checks for invalid parameters
Parameters:
Name Type Attributes Description
target Element | String The wrapper for the MovingCostCalculator module
parameters Object <optional>
Additional optional parameters
Properties
Name Type Attributes Default Description
lang String <optional>
en The lang to use
debug Boolean <optional>
false Show debugging logs ?
remoteCalculator String <optional>
URL to use for a remote calculation
googleAPIKey String <optional>
Your Google API key (Only needed if the Google API script isn't imported before)
askForContact Boolean <optional>
Should the calculator ask for a mail before giving the results ?
dictionary MovingCostCalculator.Dictionary <optional>
Adds custom translations to the dictionary
options Object <optional>
Options to enable/disable
Properties
Name Type Attributes Default Description
floor Boolean <optional>
true Ask for floor ?
lift Boolean <optional>
true Ask for lift ?
porterageDistance Boolean <optional>
true Ask for porterage distance ?
rooms MovingVolumeCalculator.Rooms <optional>
Custom rooms
Source:

Members

data

The calculator's available data
Properties:
Name Type Description
addresses Object Addresses data
Properties
Name Type Description
departure Object Departure address data
Properties
Name Type Description
value external:PlaceResult Address value
components Object Address components
Properties
Name Type Description
streetNumber String Address' street number
route String Address' route
zipCode String Address' zip code
locality String Address' locality
country String Address' country
countryCode String Address' country code
department String Address' department
region String Address' region
location.lat Number Address' latitude
location.lng Number Address' longitude
location.placeId String Address' place ID
options Object Arrival address options
Properties
Name Type Description
floor Number Address' floor
lift Boolean Does the address have a lift ?
porterageDistance Number The porterage distance approximate
arrival Object Arrival address data
Properties
Name Type Description
value external:PlaceResult Address value
components Object Address components
Properties
Name Type Description
streetNumber String Address' street number
route String Address' route
zipCode String Address' zip code
locality String Address' locality
country String Address' country
countryCode String Address' country code
department String Address' department
region String Address' region
location.lat Number Address' latitude
location.lng Number Address' longitude
location.placeId String Address' place ID
options Object Departure address options
Properties
Name Type Description
floor Number Address' floor
lift Boolean Does the address have a lift ?
porterageDistance Number The porterage distance approximate
volume Number The volume
volumeData Number The additional volume data
contact String The user's mail
Source:
Example
{
  addresses: {
    departure: {
      value: '',
      components: {
        streetNumber: '',
        route: '',
        zipCode: '',
        locality: '',
        country: '',
        countryCode: '',
        department: '',
        region: ''
      },
      location:{
        lat: 0,
        lng: 0,
        placeId: ''
      },
      options: {
        floor: 0,
        lift: false,
        porterageDistance: 0
      }
    },
    arrival: {
      value: '',
      components: {
        streetNumber: '',
        route: '',
        zipCode: '',
        locality: '',
        country: '',
        countryCode: '',
        department: '',
        region: ''
      },
      location:{
        lat: 0,
        lng: 0
        placeId: ''
      },
      options: {
        floor: 0,
        lift: false,
        porterageDistance: 0
      }
    }
  },
  volume: 0,
  volumeData: {},
  contact: ''
};

Methods

(static) destroy(selector)

Removes any MovingCostCalculator mutation from the DOM
Parameters:
Name Type Description
selector String The MovingCostCalculator wrapper selector
Source:

_toggleLoader(forcenullable)

Toggles the estimations loader
Parameters:
Name Type Attributes Description
force Boolean <nullable>
Force the display ?
Source:

destroy()

Removes any MovingCostCalculator mutation from the DOM
Source:

setLang(lang) → {MovingCostCalculator}

Sets the lang
Parameters:
Name Type Description
lang String The lang to set
Source:
Returns:
The current MovingCostCalculator
Type
MovingCostCalculator

validate() → {MovingCostCalculator}

Validates the calculator data & calculates the estimations
Source:
Returns:
The current MovingCostCalculator
Type
MovingCostCalculator

Type Definitions

Dictionary

Translations object list
Type:
Source:
Example
{
  en: {
    title: 'Estimate your moving cost',
    addressesTitle: 'Your addresses'
  },
  fr: {
    title: 'Estimez le coût de votre déménagement',
    addressesTitle: 'Vos adresses'
  }
}

Lang

Translations object
Type:
  • Object.<String, String>
Source:
Example
{
  title: 'Estimate your moving cost',
  addressesTitle: 'Your addresses'
}