-
staticTTB._utilAddSessionToken(info){Object|undefined}
-
This static method extends provided object (if any) with the session-token (if any) stored by last login attempt by loginRemote() or login().
Name |
Type |
Description |
info |
Object
|
optional
any object to extend. E.g. query params converted object by _.ajax() |
Returns:
Type |
Description |
Object
|
undefined
|
info - extended object with session token (if any) |
Example
var queryParams = { ... }; // your stuff
var infoContainsSessionToken = TTB._utilAddSessionToken(queryParams);
-
-
[new widget .connectWidget() is recommended.] This static method provides the list of all available sponsors based on given info.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info against the logged-in user, so that we could suggest the sponsor(s) for it.
Name |
Type |
Description |
email |
String
|
optional
The email address of the logged-in user, if they have signed-up previously for any sponsor(s), we include them. |
zipCode |
String
|
optional
The Zip Code of the logged-in user, if user is newly signed-up in TTB system, we list the available sponsors in that region. |
|
partnerKey |
String
|
The partner key provided by support team for the consumer site. |
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var payload = {
email: 'agent47@domain.com',
zipCode: '12345'
};
TTB.getSponsors(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
This static method renders a logo link on vendors's sites, clicking which can take user to the landing page for TTB powered widgets.
(Check it out in action over https://jsfiddle.net/benutech/w0ya3qr5/)
Name |
Type |
Description |
elementSelector |
String
|
DOM element selector where the widget needs to be rendered.
#lorem or .ipsum etc. |
vendorInfo |
Object
|
The information regarding vendor, and it's user session details. for details, Check out utilGenerateLandingPageURL() documentation. |
Returns:
Type |
Description |
Object
|
wrapperEL - DOM Node reference to the rendered widget's wrapper. |
Example
var elementSelector = '#ttb--render-logo-wrapper';
var vendorInfo = {
stk: "xxxxxxxxxxxxxxx",
getuser_url: 'https://www.yoursite.com/webservices/getuser.json',
partnerKey: 'xxxxxxxxxxxxxxxxx'
};
TTB.renderLogoWidget(elementSelector, vendorInfo);
-
-
[new widget .connectWidget() is recommended.] This static method provides the list of all available sponsors based on given info.
Name |
Type |
Description |
data |
Object
|
Information to be required through the sponsor selection flow.
Name |
Type |
Default |
Description |
performLogin |
Object
|
"true"
|
optional
To auto-perform login against the selected sponsor. |
partnerKey |
Object
|
|
The partner key provided by support team for the consumer site. |
getSponsorsPayload |
Object
|
|
To be used for getSponsors() . Please see payload information over TTB.getSponsors(). |
loginRemotePayload |
Object
|
|
To be used for loginRemote() . Please see payload information over TTB.loginRemote(). |
selectedSponsor |
Object
|
|
optional
if user has any existing sponsor, provide this to show that sponsor as selected, in the list. |
userProfile |
Object
|
|
optional
Alternate way to pass user profile, [Not recommended] (TTB Internal use only). |
|
actions |
Object
|
The callbacks options to retrieve success and failure info.
Name |
Type |
Description |
onConnect |
function
|
optional
The callback to be invoked with
when user is completely connected .ie. done with selecting sponsor *and then accepting their TOS. |
onSelect |
function
|
optional
The callback to be invoked with selectedSponsor when user selects the sponsor. |
onError |
function
|
optional
The callback to be invoked with error {String} message, against whatever step it fails. |
|
Returns:
Type |
Description |
Object
|
$modal - JQuery reference to the rendered modal DOMNode. |
Example
var data = {
partnerKey: 'xxxxxxxxxxxxxxx',
getSponsorsPayload: {...}
loginRemotePayload: {...}
};
actions = {
onConnect: function(selectedSponsor, loginRemotePayload) {
// your success code here to wrap things up considering it as a complete callback.
},
onSelect: function(selectedSponsor, loginRemotePayload) {
// your success code here to consume "selectedSponsor"
// you can instantiate the TTB sdk against the selected sponsor.
// var ttb = new TTB({
// ...
// sponsor: selectedSponsor
// ...
// });
// OR you can update the sponsor of already instantiated TTB sdk
// ttb.setSponsor(selectedSponsor);
},
onError: function(error, $sponsorModal) {
// your failure code here consume error / reason {String}
}
};
TTB.showSelectSponsor(data, actions);
-
-
[new widget .connectWidget() is recommended.] This static method is used as a helper component inside showSelectSponsor()
method.
This method shows a "Thank you" modal for handling TOS against the selected sponsor, after user selected it
via TTB.showSelectSponsor()
.
Name |
Type |
Description |
selectedSponsor |
Object
|
The sponsor information retrieved after selecting a sponsor from the list via TTB.showSelectSponsor() . |
actions |
Object
|
The callbacks options to retrieve success and failure info.
Name |
Type |
Description |
onConnect |
function
|
optional
The callback to be invoked with
when user is completely connected .ie. done with selecting sponsor (via TTB.showSelectSponsor()) *and then accepting their TOS. |
onSelect |
function
|
optional
The callback to be invoked with selectedSponsor when user selects the sponsor. |
onError |
function
|
optional
The callback to be invoked with error {String} message, against whatever step it fails. |
|
options |
Object
|
The options to perform additional tasks, e.g. login only for now.
Name |
Type |
Default |
Description |
performLogin |
Object
|
"false"
|
optional
To auto-perform login against the selected sponsor. |
partnerKey |
Object
|
|
The partner key provided by support team for the consumer site. |
loginRemotePayload |
Object
|
|
"stk" and "getuser_url" information to be used for login. please check .loginRemote() documentation for more. |
userProfile |
Object
|
|
optional
Alternate way to pass user profile, [Not recommended] (TTB Internal use only). |
|
Returns:
Type |
Description |
Object
|
$modal - JQuery reference to the rendered modal DOMNode. |
Example
var selectedSponsor = { ... }; // received from options.onSelect of TTB.showSelectSponsor()
var actions = {
onConnect: function(selectedSponsor, loginRemotePayload) {
// your success code here to wrap things up considering it as a complete callback.
},
onSelect: function(selectedSponsor, loginRemotePayload) {
// your success code here to consume "selectedSponsor"
// you can instantiate the TTB sdk against the selected sponsor.
// var ttb = new TTB({
// ...
// sponsor: selectedSponsor
// ...
// });
// OR you can update the sponsor of already instantiated TTB sdk
// ttb.setSponsor(selectedSponsor);
},
onError: function(error, $sponsorModal) {
// your failure code here
}
};
var options = {
partnerKey: 'xxxxxxxxxxxxxxx',
performLogin: true,
loginRemotePayload: {...}
};
TTB.showSponsorTOSModal(selectedSponsor, actions, options);
-
staticTTB.utilBuildFullAddress(property){String}
-
Builds up the full address using various address fields, usually helpful to build full address for
target property to open it's net sheet.
It uses this pattern: [h#] [streetName] [suf], [city], [state] [zip] to build address as
e.g. "1234 Collins Ave, Miami Beach, FL 33140"
Name |
Type |
Description |
property |
Object
|
result record retrieved via either from global search, search by address/owner/APN, nearby search, etc. |
Returns:
Type |
Description |
String
|
propertyFullAddress - complete address string built using each available field. |
-
-
Build up the sponsor object for setting new sponsor on TTB instance via setSponsor().
Name |
Type |
Description |
sponsorMeta |
Object
|
sponsor meta object retrieved from response of getSponsors(). |
Returns:
Type |
Description |
Object
|
sponsorInfo - object contains name, title, site, etc. |
-
staticTTB.utilCopy(info){Object|String|any}
-
This static method returns a one-level-only deep copy / clone of provided info object.
Name |
Type |
Description |
info |
Object
|
object to copy / clone. |
Returns:
Type |
Description |
Object
|
String
|
any
|
copy - copy / clone of provided info object. |
Example
var detail = {foo: 'xoxo'};
var cloneOfDetail = TTB.utilCopy(detail);
-
staticTTB.utilGenerateLandingPageURL(vendorInfo){string}
-
This static method generates a link / URL to use on vendors's site, clicking which can take user to the landing page for TTB powered widgets.
it is used inside renderLogoWidget(), To learn more about it, check out its documentation.
Name |
Type |
Description |
vendorInfo |
Object
|
The information regarding vendor, and it's user.
Name |
Type |
Description |
stk |
String
|
The session token from existing login at 3rd-party app. |
getuser_url |
String
|
The URL to hit to get the user information against the given stk. |
partnerKey |
Object
|
The partner key provided by support team for the consumer site. |
|
Returns:
Type |
Description |
string
|
TTBLandingPageUrl - A string URL contains provided info in an encoded format, as part of URL. |
Example
var vendorInfo = {
stk: "xxxxxxxxxxxxxxx",
getuser_url: 'https://www.yoursite.com/webservices/getuser.json',
partnerKey: 'xxxxxxxxxxxxxxxxx'
};
var TTBLandingPageUrl = TTB.utilGenerateLandingPageURL(vendorInfo);
// you can use this variable as HREF to any anchor (a) tag.
console.log(TTBLandingPageUrl);
-
staticTTB.utilPromiseReject(reason){Promise}
-
This static method returns a promise with rejection, holding the passed reason.
Name |
Type |
Description |
reason |
Object
|
String
|
any
|
reason of rejection. It can be an object, a string, or anything. |
Returns:
Type |
Description |
Promise
|
promise - promise with rejection state, holding the passed reason. |
Example
var rejectedPromise = TTB.utilPromiseReject('Something went wrong');
// or
var rejectedPromise = TTB.utilPromiseReject({foo: 'Something useful as a detailed reason.'});
-
staticTTB.utilPromiseResolve(info){Promise}
-
This static method returns a promise with resolution, holding the passed information.
Name |
Type |
Description |
info |
Object
|
String
|
any
|
info for resolution. It can be an object, a string, or anything. |
Returns:
Type |
Description |
Promise
|
promise - promise with resolved state, holding the passed info. |
Example
var resolvedPromise = TTB.utilPromiseResolve('Successful operation !');
// or
var resolvedPromise = TTB.utilPromiseResolve({foo: 'Something useful as a detailed info.'});
-
checkPEFarmStatus(farmId){Object}
-
This method is used to check for the status on phone and/or email fields order for the properties of the given farm.
on successful call, check for data.phone_status
and data.email_status
flags.
value "completed" means that the requested contact field is ready, and so .getFarm() should be called again to fetch the farm.
"ordered" means the order is made, but it is in progress on the backend. orders usually takes up to ~2 minutes.
Note: The farm is supposed to be ordered/made via .globalSearch() method.
Name |
Type |
Description |
farmId |
String
|
The farm_id of the target farm to be checked. |
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var farmId = 123;
ttb.checkPEFarmStatus(farmId)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
This method deactivate the sponsor selection previously performed by the user with given credentials.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info.
Name |
Type |
Description |
email |
String
|
The email address of the user. |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
email: "awesomeuser99@domain.com"
};
ttb.clearSponsorSelection(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
This method renders a widget includes a connect button to open up the TTB integration modal which contains an iframe
controlled by TTB.
It uses localStorage of the host origin, to store the selected sponsor info as ttb-sdk--connect--selected-sponsor
,
It is a good gate for host sites to persist the user's sponsor selection over their servers, by reading/writing from/to it.
Widget will pick it up whenever gets rendered.
(Make sure ttbSdk.min.css file is injected for proper style and look for the widgets.
You can even check out working example over https://jsfiddle.net/benutech/qr7ykw9L/)
Name |
Type |
Description |
options |
Object
|
configuration for the connect widget.
Name |
Type |
Description |
elementSelector |
String
|
DOM element selector where the widget needs to be rendered.
#lorem or .ipsum etc. |
loginRemotePayload |
Object
|
"stk" and "getuser_url" information to be used for login. please check .loginRemote() documentation for more. |
|
actions |
Object
|
optional
The actions object contains mapping callbacks to be consumed on success or failure.
Name |
Type |
Description |
onConnectSuccess |
function
|
optional
To be invoked with info object,
which on successful "Connect", contains selectedSponsor object, and loginPerformed flag (to be "true" when user gets auto logged in from widget modal) |
onConnectFailure |
function
|
optional
To be invoked with reason {String} message on failing connecting. |
|
Returns:
Type |
Description |
Object
|
null
|
$element - JQuery reference to the rendered widget container element.
OR null in case of any error in rendering widget. E.g. elementSelector did not found. |
Examples
// with basic and minimum requirement.
var ttb = new TTB({ ... }); // skip if already instantiated.
var options = {
elementSelector: '#ttb-connect-wrapper',
loginRemotePayload: {
stk: 'xxxxxxxxxxxxxxx'
}
};
var $ttbConnect = ttb.connectWidget(options);
// with advanced configuration for handling success, and failure of the connection process.
var ttb = new TTB({ ... }); // skip if already instantiated.
var options = {
elementSelector: '#ttb-connect-wrapper'
loginRemotePayload: {
stk: 'xxxxxxxxxxxxxxx',
getuser_url: 'https://www.yoursite.com/webservices/getuser.json'
}
};
var actions = {
onConnectSuccess: function(info) {
// optional callback - to be called when done.
// passed argument will be an "info" object which contains "selectedSponsor" which can be used to set instance sponsor.
// note: required details from sponsorInfo already being written to localStorage as "ttb-sdk--connect--selected-sponsor" by SDK.
},
onConnectFailure: function(reason) {
// optional callback - to be called when failed connecting.
// passed argument will be:
// reason {String} - Reason of the failure, e.g. "failed" if API did not connect.
}
};
var $ttbConnect = ttb.connectWidget(options, actions);
-
getFarmProperties(farmId){Object}
-
This method is used to fetch the given farm. i.e. to fetch all the properties/records of the given farm.
Note: The farm is supposed to be ordered/made via .globalSearch() method.
Name |
Type |
Description |
farmId |
String
|
The farm_id of the target farm to be fetched. |
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var farmId = 123;
ttb.getFarmProperties(farmId)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
This method is used to fetch the list of all the farms that were bought by the user.
Note: The farm is supposed to be ordered/made via .globalSearch() method.
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
ttb.getFarmsList()
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
getSearchFields(){Object}
-
This method provides the complete list of all fields that can be used to construct search terms for
global_search and
global_search_count APIs.
To view the complete list of all available search fields and their possible values.
Please follow this
JSON presentation -
The key info you should look for is the
field_name
,
search_type
and
choices
.
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
ttb.getSearchFields()
.then(function(res) {
if (res instanceof Array) {
// your success code here to consume res as fields list. see example < JSON here >
console.log(res);
} else {
// your failure code here to consume res
console.log(res);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
This method will allow you to verify what reports are available to your user profile.
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
ttb.getTypesReport()
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
globalSearch(payload, queryParams){Object}
-
This method is used to search all properties matching a set of criteria.
There is a vast number of criteria available, see the Available Search Fields and Search Criteria section.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info.
Name |
Type |
Description |
mm_fips_state_code |
String
|
State FIPS of the property |
FIELD_NAME |
Object
|
String
|
optional
Other search fields to be sent. |
customFilters |
Object
|
optional
Filters fields are to be sent via this wrapper - See the available search fields for more.
Name |
Type |
Description |
is_site_number_even_search |
Object
|
optional
A custom filter |
FIELD_NAME |
Object
|
optional
Other filter type search fields to be sent. |
|
searchOptions |
Object
|
optional
Additional options to take control on records.
Name |
Type |
Default |
Description |
max_limit |
String
|
|
optional
Limit the matched records. |
omit_saved_records |
String
|
false
|
optional
Suppress/Omit records already saved. |
|
|
queryParams |
Object
|
optional
The query string params limit and page on URL are used to control pagination of the result.
Name |
Type |
Description |
limit |
String
|
optional
Determines how many recs to include in one page. |
page |
String
|
optional
Specifies the page number in the full result set. |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var queryParams = { limit: 1000, page: 2 };
var payload = {
"mm_fips_state_code": "06", // State FIPS
"mm_fips_muni_code": "059", // County FIPS
"sa_site_city": [ // Cities
"ANAHEIM"
],
"sa_site_zip": [ // Zip Codes
"92801",
"92805"
],
"sa_site_mail_same": "Y",
"sa_owner_1_type": "0",
"sa_nbr_bedrms": { // Beds
"match": "<=",
"value": 3
},
"sa_nbr_bath": { // Baths
"match": "<=",
"value": 2
},
"use_code_std": [
"RSFR",
"RCON"
],
"sa_yr_blt": { // Year built
"match": "From-To",
"value": {
"from": 1950,
"to": 2002
}
},
"sa_assr_year": {
"match": ">",
"value": 2000
},
"searchOptions": { // Additional Search Options
"omit_saved_records": false
},
"customFilters": { // Filters
"is_site_number_even_search": "Y"
}
};
ttb.globalSearch(payload, queryParams)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
globalSearchCount(payload){Object}
-
This method is to only get the count (as opposed to full set of records) against a certain set of search criteria.
Note - It accepts the same search criteria input as for
global_search API.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info. |
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
"mm_fips_state_code": "06", // State FIPS
"mm_fips_muni_code": "059", // County FIPS
"sa_site_city": [ // Cities
"ANAHEIM"
],
"sa_site_zip": [ // Zip Codes
"92801",
"92805"
],
"sa_nbr_bedrms": { // Beds
"match": "<=",
"value": 3
},
"searchOptions": { // Additional Search Options
"omit_saved_records": false
},
"customFilters": { // Filters
"is_site_number_even_search": "Y"
}
};
ttb.globalSearchCount(payload, params)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
googleBuildAddress(autocomplete, options){Object}
-
This method builds the address payload using the google autocomplete
instance once it's
"place_changed"
event fires.
The returned payload can be utilized to consume searchBySiteAddress()
API or you can fill form fields using SDK's autoFill API.
Name |
Type |
Description |
autocomplete |
object
|
The google autocomplete instance used on your site, consuming it's "place_changed" event. |
options |
Object
|
optional
The options object
Name |
Type |
Default |
Description |
autoFillContext |
String
|
|
optional
A query selector of an element(s) inside which to look for inputs elements
having data-ttb-field attribute.
- For example: <input type="text" data-ttb-field="site_address" /> |
autoFillClearExisting |
Boolean
|
"false"
|
optional
Clear the existing / previously added values to all of the fields that are to be auto-filled. |
autoFillDelay |
Number
|
"0"
|
optional
A delay in milliseconds, useful when wished to visualize auto filling. (50 is a good value to test) |
|
Returns:
Name |
Type |
Description |
address |
Object
|
built address payload object using google place components, having following fields against mentioned mapping.
Name |
Type |
Description |
site_street_number |
Object
|
Component Type: "street_number" | Name Type: "short_name" . |
site_route |
Object
|
Component Type: "route" | Name Type: "short_name" . |
site_address |
Object
|
*Built using site_street_number + ' ' + site_route . |
site_city |
Object
|
Component Type: "locality" | Name Type: "long_name" . |
site_neighborhood |
Object
|
Component Type: "neighborhood" | Name Type: "long_name" . |
site_state |
Object
|
Component Type: "administrative_area_level_1" | Name Type: "short_name" . |
site_zip |
Object
|
Component Type: "postal_code" | Name Type: "short_name" . |
county |
Object
|
Component Type: "administrative_area_level_2" | Name Type: "short_name" . |
country |
Object
|
Component Type: "country" | Name Type: "long_name" . |
|
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
// render your autocomplete component instance on your desired location
var autocompleteElement = document.getElementById('googleBuildAddress__autocomplete');
var autocomplete = new google.maps.places.Autocomplete(autocompleteElement, {types: ['geocode']});
// when the user selects an address from the drop-down, populate the address fields in the form.
autocomplete.addListener('place_changed', function () {
// approach # 01 - auto-fill only - build up the address by auto-filling the form fields and leaves the submission logic.
// (Note: before submission, make sure you build site_address
using site_street_number
+ ' ' + site_route
)>
var options = {
autoFillContext: '#searchBySiteAddress__form'
};
ttb.googleBuildAddress(autocomplete, options);
//--- approach # 01 - auto-fill only - ends ---
// -- OR --
// approach # 02 - direct submission - build up the address by getting the payload and proceed with searchBySiteAddress()
to retrieve the result.
var payload = ttb.googleBuildAddress(autocomplete);
ttb.searchBySiteAddress(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data for any extra effort other than the auto-fill
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
// --- approach # 02 - direct submission - ends ---
});
-
-
This method is used after selecting a sponsor via the static function TTB.showSelectSponsor(...)
to open up a Thank you modal,
via which user can agree to TOS (Terms of Service) of the selected sponsor.
Returns:
Type |
Description |
Object
|
$modal - JQuery reference to the rendered modal DOMNode. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
ttb.handleSponsorTOS(selectedSponsor);
-
-
This method renders a widget includes google autocomplete and supported actions drop-down.
Make sure Google Maps script file is injected and ttb.instantLookupWidget()
should be called inside global googleInit()
function.
And also ttbSdk.min.css file is injected for proper style and look for the widgets.
Name |
Type |
Description |
elementSelector |
String
|
DOM element selector where the widget needs to be rendered.
#lorem or .ipsum etc. |
actions |
Object
|
optional
An object contains mapping callbacks to be consumed when any action is clicked.
Name |
Type |
Description |
fullProfileReport |
function
|
optional
To be invoked with an info object (info.success, info.data) as argument, when user selects an address
from the autocomplete and then clicks the action "Full Profile Report". This info can be used for handling success and failure. |
|
visibility |
Object
|
optional
An object contains mapping of actions mentioning their visibility.
Name |
Type |
Default |
Description |
fullProfileReport |
function
|
true
|
optional
A flag to show/visible the "Full Report Profile" action.
(By Default, its shown. To hide it, just pass it with value as false) |
netSheet |
function
|
true
|
optional
A flag to show/visible the "Net Sheet" action. |
|
Returns:
Type |
Description |
Object
|
$element - JQuery reference to the rendered widget container element. |
Examples
// with basic and minimum requirement.
var ttb = new TTB({ ... }); // skip if already instantiated.
// define googleInit() if it is not already created.
window.googleInit = function () {
var elementSelector = '#ttb-instant-lookup-wrapper';
var $instantLookup = ttb.instantLookupWidget(elementSelector);
};
// Sample to suppress/hide a certain action, by using optional visibility param.
var ttb = new TTB({ ... }); // skip if already instantiated.
// define googleInit() if it is not already created.
window.googleInit = function () {
var visibility = {
fullProfileReport: false, // to suppress this action
netSheet: true, // if value is same as its default visibility. then it is equivalent to just not passing it.
};
var elementSelector = '#ttb-instant-lookup-wrapper';
var $instantLookup = ttb.instantLookupWidget(elementSelector, undefined, visibility);
};
// with advanced configuration for handling success, and failure of the actions results.
// this sample can be joined to above "visibility" param example.
var ttb = new TTB({ ... }); // skip if already instantiated.
// define googleInit() if it is not already created.
window.googleInit = function () {
var actions = {
fullProfileReport: function(info) {
if (info.success === 'OK') {
// your success code here to consume info.data
console.log(info.data);
} else {
// your failure code here to consume info.data
console.log(info.data);
}
}
};
var elementSelector = '#ttb-instant-lookup-wrapper';
var $instantLookup = ttb.instantLookupWidget(elementSelector, actions);
};
-
-
This method is used to log the user in and maintain a session for the user throughout the App.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info
Name |
Type |
Description |
username |
String
|
the email/username used while signing up |
password |
String
|
the secret password of the account |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
TbUser: {
username: "awesomeuser99@domain.com",
password: "secret_Password0"
}
};
ttb.login(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// user is successfully logged-in !!
// your success code here to consume res.response.data for logged-in user info
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data for validation errors info
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
loginRemote(payload){Object}
-
This method is used to log the user in from a 3rd-party site, and maintain a session for the user throughout the App.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info
Name |
Type |
Description |
stk |
String
|
The session token from existing login at 3rd-party app. |
getuser_url |
String
|
The URL to hit to get the user information against the given stk. |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
stk: "xxxxxxxxxxxxxxx"
};
ttb.loginRemote(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// user is successfully logged-in !!
// your success code here to consume res.response.data for logged-in user info
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data for validation errors info
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
loginUUID(payload){Object}
-
This method is used to authenticate the vendor site using one uuid (that was provided for their specified sites only),
and to maintain a session for their users.
It is similar to loginRemote(), but this one is generic i.e. not user specific authentication. rather authenticating their sites.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info
Name |
Type |
Description |
uuid |
String
|
The uuid string provided to vendor to use from their specified sites. |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
uuid: "xxxxxxxxxxxxxxx"
};
ttb.loginUUID(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// user is successfully logged-in !!
// your success code here to consume res.response.data for logged-in user info
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data for validation errors info
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
Logs out from the TTB webservices server
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
ttb.logout()
.then(function(res) {
if (res.response.status === 'OK') {
// user is successfully logged-out!!
// your success code here to clear any cached info etc from the web page
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
nearbySearch(payload, payloadExtension){Object}
-
This method is to get all the properties nearby the given geolocation against the given radius.
Note - for payloadExtension, It accepts the same search criteria format input as for
global_search API.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info. |
payloadExtension |
Object
|
optional
An optional payload to be merge into the auto-generated one. It can be utilized to
add custom filters like "Empty Nester" and/or other useful fields. |
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
mm_fips_state_code: "06", // State FIPS
center_lat: "33.97652", // sa_y_coord // to be used in a geometry of type "circle" for radius.
center_lng: "-117.726299", // sa_x_coord // required for same above reason.
radius: "1", // required for same above reason.
limit: "20" // Optional.
};
ttb.nearbySearch(payload, params)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
openNetSheet(propertyId, propertyFullAddress){String}
-
This method opens up a Net Sheet modal against target property. The modal contains an iframe to TTB's official Net Sheet version.
This same method is being used inside from instantLookupWidget() for the "Net Sheet" Action.
Name |
Type |
Description |
propertyId |
string
|
The "sa_property_id" field value from the target property object. This exists in each
property object retrieved either from global search, search by address/owner/APN, nearbySearch, etc. |
propertyFullAddress |
string
|
The full address to be shown inside Net Sheet.
This can be build using static util method TTB.utilBuildFullAddress(), for more check method's documentation. |
Returns:
Type |
Description |
String
|
$modal - A JQuery reference to the modal DOMNode Element, of opened Net Sheet. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var selectedProperty = { ... }; // can come from whatever your feature logic is.
// build parameters.
var propertyId = selectedProperty.sa_property_id;
var propertyFullAddress = TTB.utilBuildFullAddress(selectedProperty);
// open net sheet against the target property.
ttb.openNetSheet(propertyId, propertyFullAddress);
-
orderReport(payload){Object}
-
This will allow you to order a report from the service. The available reports will depend on your account set up.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info.
Name |
Type |
Default |
Description |
sa_property_id |
String
|
|
Unique ID of the property |
state_county_fips |
String
|
|
State FIPS of the property |
output |
String
|
"link"
|
optional
Format of output, supported types are "link", and "html". |
report_type |
String
|
"property_profile"
|
optional
The report type, supported types are "single_page_profile", "avm"(*), "prep"(*), "tax_bill" and "property_profile". |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
sa_property_id: "0039025849",
state_county_fips: "06059",
report_type: "property_profile",
output: "link",
};
ttb.orderReport(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
propertyComps(payload){Object}
-
This method is used to return a list of sales around a subject property PLUS offer a series of statistics based on the response results.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info.
Name |
Type |
Description |
sa_property_id |
String
|
Unique ID of the property |
mm_fips_state_code |
String
|
State FIPS of the property |
date_transfer(+/-) |
Number
|
optional
Sold |
distance_in_km |
Number
|
optional
Distance (in kilometers) |
nbr_bath(+/-) |
Number
|
optional
Baths |
nbr_bedrms(+/-) |
Number
|
optional
Beds |
sqft(+/-) |
Number
|
optional
SQFT |
yr_blt(+/-) |
Number
|
optional
Year built |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
"sa_property_id": "0039025849",
"mm_fips_state_code": "06",
"date_transfer(+/-)": 12,
"distance_in_km": 1.6,
"nbr_bath(+/-)": 1,
"nbr_bedrms(+/-)": 1,
"sqft(+/-)": 0.2,
"yr_blt(+/-)": 20
};
ttb.propertyComps(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
propertyDetails(payload, options){Object}
-
This method is used to pull details of a property specified by property_id
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info.
Name |
Type |
Description |
property_id |
Number
|
Unique ID of the property |
state_fips |
Number
|
State FIPS of the property |
|
options |
Object
|
optional
The options object
Name |
Type |
Default |
Description |
autoFillContext |
String
|
|
optional
A query selector of an element(s) inside which to look for inputs elements
having data-ttb-field attribute. |
autoFillClearExisting |
Boolean
|
"false"
|
optional
Clear the existing / previously added values to all of the fields that are to be auto-filled. |
autoFillDelay |
Number
|
"0"
|
optional
A delay in milliseconds, useful when wished to visualize auto filling. (50 is a good value to test) |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
property_id: 0091683346
state_fips: 25,
};
var options = {
autoFillContext: '#propertyDetails__form'
};
ttb.propertyDetails(payload, options)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data for any extra effort other than the auto-fill
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
This method saves the sponsor selection performed by the user with given credentials.
Performs an optional login identical to existing method loginRemote()
Name |
Type |
Default |
Description |
payload |
Object
|
|
The payload object containing required info.
Name |
Type |
Description |
stk |
String
|
pls check loginRemote() for more. |
getuser_url |
String
|
optional
pls check loginRemote() for more. |
|
performLogin |
Boolean
|
false
|
optional
To perform a login - identical to loginRemote(), |
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
stk: "xxxxxxxxxxxxxxx",
getuser_url: 'https://www.yoursite.com/webservices/getuser.json' // absolute URL to the API
};
var performLogin = true;
ttb.saveSponsorSelection(payload, performLogin)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
searchByOwnerName(payload){Object}
-
Search a property by owners name.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info - (At least any of the following is required)
Name |
Type |
Description |
first_name |
String
|
optional
Owner's First Name |
last_name |
String
|
optional
Owner's Last Name |
state_county_fips |
String
|
optional
State County FIPS of the property |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
first_name: "Fariba",
last_name: "Siddiqi",
state_county_fips: "06059"
};
ttb.searchByOwnerName(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
searchByParcelNumber(payload){Object}
-
Search a property by APN.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info
Name |
Type |
Description |
parcel_number |
String
|
The Parcel Number against the property |
state_county_fips |
String
|
The State County FIPS against the property |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
parcel_number: "46327216",
state_county_fips: "06059"
};
ttb.searchByParcelNumber(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
searchBySiteAddress(payload){Object}
-
Search a property by site address.
Name |
Type |
Description |
payload |
Object
|
The payload object containing required info - (At least any of the following is required)
Name |
Type |
Description |
site_address |
string
|
optional
Property House# or Street# with the route e.g. "317 2nd St". |
site_unit |
string
|
optional
Unit# of the property (If has any). |
site_city |
string
|
optional
Property City e.g. "Huntington Beach" |
site_state |
string
|
optional
Property State e.g. "CA" |
site_street_number |
string
|
optional
Property Street# e.g. "317" |
site_route |
string
|
optional
Property Route - "2nd St". |
|
Returns:
Type |
Description |
Object
|
promise - Jquery AJAX deferred promise is returned which on-success returns the required info. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
var payload = {
site_address: "317 2nd St",
site_unit: "",
site_city: "Huntington Beach",
site_state: "CA",
site_zip: "92648",
site_street_number: "317",
site_route: "2nd St"
};
ttb.searchBySiteAddress(payload)
.then(function(res) {
if (res.response.status === 'OK') {
// your success code here to consume res.response.data
console.log(res.response.data);
} else {
// your failure code here to consume res.response.data
console.log(res.response.data);
}
}, function(err) {
// your failure code here
})
.always(function() {
// your on-complete code here as common for both success and failure
});
-
-
This method is used to switch to a different sponsor (Title Company) and it generates a new baseURL
based on passed
sponsor.name with existing baseURLPattern
.
Name |
Type |
Description |
sponsor |
Object
|
Information to be retrieved via options.onSelect() of TTB.getSponsors()
Name |
Type |
Description |
name |
String
|
The vertical_name field value of sponsor object retrieved. (to be used in generating baseURL) |
title |
String
|
The company_info.company_name field value of sponsor object retrieved. |
site |
String
|
The site_url field value of sponsor object retrieved. |
logoURL |
String
|
The company_info.logo_url field value of sponsor object retrieved. |
TOSURL |
String
|
The TOS_content field value of sponsor object retrieved. |
|
Returns:
Type |
Description |
String
|
baseURL - The newly generated baseURL . |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
ttb.setSponsor({
name: 'direct',
title: 'Benutech',
site: 'http://direct.titletoolbox.com',
logoURL: 'https://s3-us-west-1.amazonaws.com/titletoolbox/company+logos/Benutech/Benute+Logo.png',
TOSURL: 'https://direct.api.titletoolbox.com/pages/tos/direct_tos'
});
-
-
This method is used to open up a TOS (Terms of Service) Modal. which lists TOS info of the selected sponsor.
Returns:
Type |
Description |
Object
|
$modal - JQuery reference to the rendered modal DOMNode. |
Example
var ttb = new TTB({ ... }); // skip if already instantiated.
ttb.showTOS();