UNPKG

@stratusjs/idx

Version:

AngularJS idx/property Service and Components bundle to be used as an add on to StratusJS

923 lines 100 kB
System.register(["lodash", "@stratusjs/runtime/stratus", "angular", "@stratusjs/angularjs/services/model", "@stratusjs/angularjs/services/collection", "@stratusjs/core/misc", "@stratusjs/core/environment", "@stratusjs/idx/listTrac"], function (exports_1, context_1) { "use strict"; var apiVersion, lodash_1, stratus_1, angular_1, model_1, collection_1, misc_1, environment_1, angularJsService; var __moduleName = context_1 && context_1.id; return { setters: [ function (lodash_1_1) { lodash_1 = lodash_1_1; }, function (stratus_1_1) { stratus_1 = stratus_1_1; }, function (angular_1_1) { angular_1 = angular_1_1; }, function (model_1_1) { model_1 = model_1_1; }, function (collection_1_1) { collection_1 = collection_1_1; }, function (misc_1_1) { misc_1 = misc_1_1; }, function (environment_1_1) { environment_1 = environment_1_1; }, function (_1) { } ], execute: function () { apiVersion = '3.13.0'; angularJsService = ($http, $mdToast, $q, $rootScope, $window, ListTrac, orderByFilter) => { const sharedValues = { contactUrl: null, contactCommentVariable: null, contact: null, integrations: { analytics: {}, maps: {} } }; const defaultWhereOptions = { City: [], eCity: [], UnparsedAddress: [], StreetAddress: [], eStreetAddress: [], Location: '', eLocation: '', Status: [], ListingId: [], ListingType: [], CountyOrParish: [], eCountyOrParish: [], MLSAreaMajor: [], eMLSAreaMajor: [], MLSAreaMinor: [], eMLSAreaMinor: [], SubdivisionName: [], eSubdivisionName: [], Neighborhood: [], eNeighborhood: [], PostalCode: [], CityRegion: [], eCityRegion: [], AgentLicense: [], OfficeNumber: [], OfficeName: [] }; let idxServicesEnabled = []; let tokenRefreshURL = '/ajax/request?class=property.token_auth&method=getToken'; let sessionInitialized = false; let refreshLoginTimer; let defaultPageTitle; const instance = { disclaimer: {}, map: {}, member: { details: {}, list: {}, search: {} }, office: { details: {}, list: {}, search: {} }, property: { details: {}, list: {}, search: {} } }; const instanceLink = { Disclaimer: {}, List: {}, Map: {}, Search: {} }; const instanceOnEmitters = {}; const session = { services: [], lastCreated: new Date(), lastTtl: 0, contacts: [] }; const urlOptions = { Listing: {}, Search: {} }; const lastQueries = { whereFilter: {}, pages: [], perPage: 0, time: null }; function emit(emitterName, $scope, var1, var2, var3) { emitManual(emitterName, $scope.elementId, $scope, var1, var2, var3); } function emitManual(emitterName, uid, $scope, var1, var2, var3) { if (Object.prototype.hasOwnProperty.call(instanceOnEmitters, uid) && Object.prototype.hasOwnProperty.call(instanceOnEmitters[uid], emitterName)) { Object.values(instanceOnEmitters[uid][emitterName]).forEach((emitter) => { try { emitter($scope, var1, var2, var3); } catch (e) { console.error(e, 'issue sending back emitter on', uid, emitterName, emitter); } }); } if (emitterName === 'init') { instanceOnEmitters[uid] ??= {}; instanceOnEmitters[uid][emitterName] ??= {}; } } function removeOnManual(emitterName, emitterId, onId) { if (Object.prototype.hasOwnProperty.call(instanceOnEmitters, emitterId) && Object.prototype.hasOwnProperty.call(instanceOnEmitters[emitterId], emitterName) && Object.prototype.hasOwnProperty.call(instanceOnEmitters[emitterId][emitterName], onId)) { delete instanceOnEmitters[emitterId][emitterName][onId]; } } function on(uid, emitterName, callback) { if (emitterName === 'init' && Object.prototype.hasOwnProperty.call(instanceOnEmitters, uid) && Object.prototype.hasOwnProperty.call(instanceOnEmitters[uid], emitterName) && Object.prototype.hasOwnProperty.call(stratus_1.Stratus.Instances, uid)) { callback(stratus_1.Stratus.Instances[uid]); return; } if (uid === 'Idx' && emitterName === 'sessionInit' && sessionInitialized) { callback(null); return; } if (!Object.prototype.hasOwnProperty.call(instanceOnEmitters, uid)) { instanceOnEmitters[uid] = {}; } if (!Object.prototype.hasOwnProperty.call(instanceOnEmitters[uid], emitterName)) { instanceOnEmitters[uid][emitterName] = {}; } const onId = lodash_1.uniqueId(); instanceOnEmitters[uid][emitterName][onId] = callback; return () => { removeOnManual(uid, emitterName, onId); }; } function registerDetailsInstance(uid, moduleName, $scope) { instance[moduleName].details[uid] = $scope; } function registerListInstance(uid, moduleName, $scope) { if (!Object.prototype.hasOwnProperty.call(instance, moduleName)) { instance[moduleName].list = {}; } instance[moduleName].list[uid] = $scope; if (!Object.prototype.hasOwnProperty.call(instanceLink.List, uid)) { instanceLink.List[uid] = []; } } function registerSearchInstance(uid, moduleName, $scope, listUid) { instance[moduleName].search[uid] = $scope; if (!Object.prototype.hasOwnProperty.call(instanceLink.Search, uid)) { instanceLink.Search[uid] = []; } if (listUid) { instanceLink.Search[uid].push(listUid); if (!Object.prototype.hasOwnProperty.call(instanceLink.List, listUid)) { instanceLink.List[listUid] = []; } instanceLink.List[listUid].push(uid); } } function unregisterDetailsInstance(uid, moduleName) { if (Object.prototype.hasOwnProperty.call(instance[moduleName].details, uid)) { const detailUid = instance[moduleName].details[uid].elementId; delete instance[moduleName].details[uid]; stratus_1.Stratus.Instances.Clean(detailUid); } } function registerMapInstance(uid, $scope) { if (!Object.prototype.hasOwnProperty.call(instance, 'map')) { instance.map = {}; } instance.map[uid] = $scope; if (!Object.prototype.hasOwnProperty.call(instanceLink.Map, uid)) { instanceLink.Map[uid] = []; } } function registerDisclaimerInstance(uid, $scope) { if (!Object.prototype.hasOwnProperty.call(instance, 'disclaimer')) { instance.disclaimer = {}; } instance.disclaimer[uid] = $scope; if (!Object.prototype.hasOwnProperty.call(instanceLink.Disclaimer, uid)) { instanceLink.Disclaimer[uid] = []; } } function getDefaultWhereOptions() { return lodash_1.clone(defaultWhereOptions); } function getSearchInstanceLinks(searchUid, moduleName = 'property') { const linkedLists = []; if (Object.prototype.hasOwnProperty.call(instanceLink.Search, searchUid)) { instanceLink.Search[searchUid].forEach((listUid) => { if (Object.prototype.hasOwnProperty.call(instance[moduleName].list, listUid)) { linkedLists.push(instance[moduleName].list[listUid]); } }); } return linkedLists; } function getListInstance(listUid, moduleName = 'property') { return Object.prototype.hasOwnProperty.call(instanceLink.List, listUid) ? instance[moduleName].list[listUid] : null; } function getListInstanceLinks(listUid, moduleName = 'property') { const linkedSearches = []; if (Object.prototype.hasOwnProperty.call(instanceLink.List, listUid)) { instanceLink.List[listUid].forEach((searchUid) => { if (Object.prototype.hasOwnProperty.call(instance[moduleName].list, searchUid)) { linkedSearches.push(instance[moduleName].list[searchUid]); } }); } return linkedSearches; } function getDisclaimerInstance(disclaimerUid) { return disclaimerUid ? (Object.prototype.hasOwnProperty.call(instance.disclaimer, disclaimerUid) ? { [instance.disclaimer[disclaimerUid].elementId]: instance.disclaimer[disclaimerUid] } : null) : instance.disclaimer; } function setPageTitle(title) { if (!defaultPageTitle) { defaultPageTitle = JSON.parse(JSON.stringify($window.document.title)); } if (!title) { $window.document.title = defaultPageTitle; } else { $window.document.title = title; } } function getIdxServices() { return idxServicesEnabled; } function setIdxServices(services) { idxServicesEnabled = services; } function setTokenURL(url) { tokenRefreshURL = url; } function tokenKeepAuth(keepAlive = false) { return $q(async (resolve, reject) => { try { if (Object.keys(session.services).length < 1 || session.expires < new Date(Date.now() + (5 * 1000))) { await tokenRefresh(keepAlive, true); resolve(); } else { resolve(); } } catch (err) { console.error('tokenKeepAuth Error:', err); reject(err); } }); } function tokenRefresh(keepAlive = false, cacheReset = false) { return $q((resolve, reject) => { let additionalQueries = `&apiVersion=${apiVersion}`; if (idxServicesEnabled.length !== 0) { idxServicesEnabled.forEach((service) => { additionalQueries += `&service[]=${service}`; }); } if (cacheReset) { additionalQueries += '&cacheReset=true'; } $http({ method: 'GET', url: tokenRefreshURL + additionalQueries }).then((response) => { if (typeof response === 'object' && Object.prototype.hasOwnProperty.call(response, 'data') && Object.prototype.hasOwnProperty.call(response.data, 'services') && Object.prototype.hasOwnProperty.call(response.data.services, 'length')) { tokenHandleGoodResponse(response, keepAlive); resolve(); } else { reject(tokenHandleBadResponse(response)); } }, (response) => { reject(tokenHandleBadResponse(response)); }); }); } function tokenHandleGoodResponse(response, keepAlive = false) { session.services = {}; response.data.services.forEach((service) => { if (Object.prototype.hasOwnProperty.call(service, 'id')) { if (!Object.prototype.hasOwnProperty.call(service, 'fetchTime')) { service.fetchTime = { Property: null, Media: null, Member: null, Office: null, OpenHouse: null }; } if (!Object.prototype.hasOwnProperty.call(service, 'analyticsEnabled') || service.analyticsEnabled === null) { service.analyticsEnabled = []; } if (!Object.prototype.hasOwnProperty.call(service, 'logo') || service.logo === null) { service.logo = { default: null }; } if (!Object.prototype.hasOwnProperty.call(service, 'mandatoryLogo') || service.mandatoryLogo === null) { service.mandatoryLogo = []; } session.services[service.id] = service; session.lastCreated = new Date(service.created); session.lastTtl = service.ttl; session.expires = new Date(session.lastCreated.getTime() + (session.lastTtl - 15) * 1000); } }); if (Object.prototype.hasOwnProperty.call(response.data, 'contactUrl') && response.data.contactUrl !== '') { sharedValues.contactUrl = response.data.contactUrl; } if (Object.prototype.hasOwnProperty.call(response.data, 'contactCommentVariable') && response.data.contactCommentVariable !== '') { sharedValues.contactCommentVariable = response.data.contactCommentVariable; } if (Object.prototype.hasOwnProperty.call(response.data, 'contact')) { sharedValues.contact = { name: '', emails: {}, locations: {}, phones: {}, socialUrls: {}, urls: {}, }; if (Object.prototype.hasOwnProperty.call(response.data, 'site') && lodash_1.isString(response.data.site) && response.data.site !== '') { sharedValues.contact.name = response.data.site; } if (Object.prototype.hasOwnProperty.call(response.data, 'contactName') && lodash_1.isString(response.data.contactName) && response.data.site !== '') { sharedValues.contact.name = response.data.contactName; } if (Object.prototype.hasOwnProperty.call(response.data, 'contact') && lodash_1.isPlainObject(response.data.contact)) { if (Object.prototype.hasOwnProperty.call(response.data.contact, 'emails') && lodash_1.isPlainObject(response.data.contact.emails)) { sharedValues.contact.emails = response.data.contact.emails; } if (Object.prototype.hasOwnProperty.call(response.data.contact, 'locations') && lodash_1.isPlainObject(response.data.contact.locations)) { sharedValues.contact.locations = response.data.contact.locations; } if (Object.prototype.hasOwnProperty.call(response.data.contact, 'phones') && lodash_1.isPlainObject(response.data.contact.phones)) { sharedValues.contact.phones = response.data.contact.phones; } if (Object.prototype.hasOwnProperty.call(response.data.contact, 'socialUrls') && lodash_1.isPlainObject(response.data.contact.socialUrls)) { sharedValues.contact.socialUrls = response.data.contact.socialUrls; } if (Object.prototype.hasOwnProperty.call(response.data.contact, 'urls') && lodash_1.isPlainObject(response.data.contact.urls)) { sharedValues.contact.urls = response.data.contact.urls; } } } if (Object.prototype.hasOwnProperty.call(response.data, 'integrations')) { if (Object.prototype.hasOwnProperty.call(response.data.integrations, 'analytics')) { if (Object.prototype.hasOwnProperty.call(response.data.integrations.analytics, 'googleAnalytics')) { if (Object.prototype.hasOwnProperty.call(response.data.integrations.analytics.googleAnalytics, 'accountId') && lodash_1.isString(response.data.integrations.analytics.googleAnalytics.accountId) && response.data.integrations.analytics.googleAnalytics.accountId !== '') { sharedValues.integrations.analytics.googleAnalytics = { accountId: response.data.integrations.analytics.googleAnalytics.accountId }; } } if (Object.prototype.hasOwnProperty.call(response.data.integrations.analytics, 'listTrac')) { if (Object.prototype.hasOwnProperty.call(response.data.integrations.analytics.listTrac, 'accountId') && lodash_1.isString(response.data.integrations.analytics.listTrac.accountId) && response.data.integrations.analytics.listTrac.accountId !== '') { sharedValues.integrations.analytics.listTrac = { accountId: response.data.integrations.analytics.listTrac.accountId }; ListTrac.setAccountId(sharedValues.integrations.analytics.listTrac.accountId); } } } if (Object.prototype.hasOwnProperty.call(response.data.integrations, 'maps')) { if (Object.prototype.hasOwnProperty.call(response.data.integrations.maps, 'googleMaps')) { if (Object.prototype.hasOwnProperty.call(response.data.integrations.maps.googleMaps, 'publicKey') && lodash_1.isString(response.data.integrations.maps.googleMaps.publicKey) && response.data.integrations.maps.googleMaps.publicKey !== '') { sharedValues.integrations.maps.googleMaps = { publicKey: response.data.integrations.maps.googleMaps.publicKey }; } } } } if (!sessionInitialized) { emitManual('sessionInit', 'Idx', null); } emitManual('sessionRefresh', 'Idx', null); sessionInitialized = true; if (keepAlive) { tokenEnableRefreshTimer(); } } function tokenHandleBadResponse(response) { let errorMessage = 'Token supplied is invalid or blank'; if (typeof response === 'object' && Object.prototype.hasOwnProperty.call(response, 'data') && Object.prototype.hasOwnProperty.call(response.data, 'errors') && Object.prototype.hasOwnProperty.call(response.data.errors, 'length')) { errorMessage = response.data.errors; } else { } $mdToast.show($mdToast.simple() .textContent('Unable to authorize Idx feed!') .toastClass('errorMessage') .position('top right') .hideDelay(5000)); return errorMessage; } function tokenEnableRefreshTimer() { clearTimeout(refreshLoginTimer); refreshLoginTimer = setTimeout(async () => { await tokenRefresh(); }, (session.lastTtl - 15) * 1000); } function updateFetchTime(apiFetch, modelName, serviceId) { const fetchTime = apiFetch.header.get('x-fetch-time'); if (fetchTime) { const oldTime = session.services[serviceId].fetchTime[modelName]; session.services[serviceId].fetchTime[modelName] = new Date(fetchTime); if (!(lodash_1.isDate(oldTime) && lodash_1.isDate(session.services[serviceId].fetchTime[modelName])) || oldTime.getTime() !== session.services[serviceId].fetchTime[modelName].getTime()) { emitManual('fetchTimeUpdate', 'Idx', null, serviceId, modelName, session.services[serviceId].fetchTime[modelName]); } } } function createModel(request) { if (request.api && !lodash_1.isString(request.api)) { request.api.apiVersion = apiVersion; } const model = new model_1.Model(request); if (Object.prototype.hasOwnProperty.call(request, 'api') && request.api) { model.meta.set('api', misc_1.isJSON(request.api) ? JSON.parse(request.api) : request.api); } if (Object.prototype.hasOwnProperty.call(request, 'serviceId')) { model.serviceId = request.serviceId; } return model; } function createCollection(request) { request.direct = true; if (request.api) { request.api.apiVersion = apiVersion; } const collection = new collection_1.Collection(request); if (request.api) { collection.meta.set('api', misc_1.isJSON(request.api) ? JSON.parse(request.api) : request.api); } return collection; } async function fetchMergeCollections(originalCollection, collections, modelName, append = false) { originalCollection.pending = true; originalCollection.completed = false; let maxCount = 0; let totalCount = 0; const fetchPromises = []; collections.forEach(collection => { const options = {}; if (session.services[collection.serviceId].token !== null) { options.headers = { Authorization: session.services[collection.serviceId].token }; } fetchPromises.push($q(async (resolve) => { await collection.fetch('POST', null, options); await modelInjectProperty(collection.models, { _ServiceId: collection.serviceId }); updateFetchTime(collection, modelName, collection.serviceId); const maxRecords = collection.header.get('x-max-count'); const countRecords = collection.header.get('x-total-count'); if (maxRecords) { maxCount += parseInt(maxRecords, 10); } if (countRecords) { totalCount += parseInt(countRecords, 10); if (!maxRecords) { maxCount += parseInt(countRecords, 10); } } resolve(collection.models); })); }); if (!append) { originalCollection.models.splice(0, originalCollection.models.length); } return $q.all(fetchPromises) .then(async (fetchedData) => { await $q.all(fetchedData.map((models) => { if (lodash_1.isArray(models)) { originalCollection.models.push(...models); } })); return originalCollection; }) .then(() => { originalCollection.header.set('x-max-count', maxCount); originalCollection.header.set('x-total-count', totalCount); originalCollection.meta.set('fetchDate', new Date()); originalCollection.pending = false; originalCollection.completed = true; originalCollection.filtering = false; originalCollection.paginate = false; return originalCollection; }); } async function fetchReplaceModel(originalModel, newModel, modelName) { originalModel.pending = true; originalModel.completed = false; const fetchPromises = []; const options = {}; if (session.services[newModel.serviceId].token !== null) { options.headers = { Authorization: session.services[newModel.serviceId].token }; } fetchPromises.push($q(async (resolve) => { await newModel.fetch('POST', null, options); await modelInjectProperty([newModel.data], { _ServiceId: newModel.serviceId }); updateFetchTime(newModel, modelName, newModel.serviceId); resolve(newModel.data); })); const fetchedData = await $q.all(fetchPromises); await $q.all(fetchedData.map((data) => { originalModel.data = data; })); originalModel.meta.set('fetchDate', new Date()); originalModel.pending = false; originalModel.completed = true; return originalModel; } function modelInjectProperty(modelDatas, properties) { return $q.all(modelDatas.map((modelData) => { lodash_1.extend(modelData, properties); })); } function createOrSyncCollectionVariable(uid, moduleName, scopedCollectionVarName) { let collection; Object.keys(instance[moduleName].list).forEach(listName => { if (!collection && listName === uid && Object.prototype.hasOwnProperty.call(instance[moduleName].list, listName) && Object.prototype.hasOwnProperty.call(instance[moduleName].list[listName], scopedCollectionVarName) && instance[moduleName].list[listName][scopedCollectionVarName] instanceof collection_1.Collection) { collection = instance[moduleName].list[listName][scopedCollectionVarName]; } }); if (!collection) { collection = new collection_1.Collection(); } Object.keys(instance[moduleName].list).forEach(listName => { if (listName === uid && (!Object.prototype.hasOwnProperty.call(instance[moduleName].list[listName], scopedCollectionVarName) || instance[moduleName].list[listName][scopedCollectionVarName] !== collection)) { instance[moduleName].list[listName][scopedCollectionVarName] = collection; } }, this); return collection; } function compileGenericWhereFilter(where, searchPossibilities) { const whereQuery = {}; const andStatement = []; const searchFunctions = { valueEquals: (searchObject, value) => { whereQuery[searchObject.apiField] = value; }, stringLike: (searchObject, value) => { if (!lodash_1.isEmpty(value)) { whereQuery[searchObject.apiField] = { like: value, options: 'i' }; } }, stringLikeArray: (searchObject, value) => { value = typeof value === 'string' ? [value] : value; if (value.length > 1) { const stringLikeArrayOrStatement = []; value.forEach((requestedValue) => { if (!lodash_1.isEmpty(requestedValue)) { stringLikeArrayOrStatement.push({ [searchObject.apiField]: { like: requestedValue, options: 'i' } }); } }); if (!lodash_1.isEmpty(stringLikeArrayOrStatement)) { andStatement.push({ or: stringLikeArrayOrStatement }); } } else if (value.length === 1) { if (!lodash_1.isEmpty(value[0])) { whereQuery[searchObject.apiField] = { like: value[0], options: 'i' }; } } }, stringIncludesArray: (searchObject, value) => { value = typeof value === 'string' ? [value] : value; if (value.length > 1) { whereQuery[searchObject.apiField] = { inq: value }; } else if (value.length === 1) { whereQuery[searchObject.apiField] = value[0]; } }, stringIncludesArrayAlternative: (searchObject, value) => { value = typeof value === 'string' ? [value] : value; if (value.length > 1) { whereQuery[searchObject.apiField] = { in: value }; } else if (value.length === 1) { whereQuery[searchObject.apiField] = value[0]; } }, numberEqualGreater: (searchObject, value) => { if (value && value !== 0) { if (Object.prototype.hasOwnProperty.call(whereQuery, searchObject.apiField) && Object.prototype.hasOwnProperty.call(whereQuery[searchObject.apiField], 'lte')) { whereQuery[searchObject.apiField] = { between: [ parseInt(value, 10), parseInt(lodash_1.get(whereQuery[searchObject.apiField], 'lte'), 10) ] }; } else { whereQuery[searchObject.apiField] = { gte: parseInt(value, 10) }; } } }, numberEqualLess: (searchObject, value) => { if (value && value !== 0) { if (Object.prototype.hasOwnProperty.call(whereQuery, searchObject.apiField) && Object.prototype.hasOwnProperty.call(whereQuery[searchObject.apiField], 'gte')) { whereQuery[searchObject.apiField] = { between: [ parseInt(lodash_1.get(whereQuery[searchObject.apiField], 'gte'), 10), parseInt(value, 10) ] }; } else { whereQuery[searchObject.apiField] = { lte: parseInt(value, 10) }; } } }, andOr: (searchObject, value) => { if (Object.prototype.hasOwnProperty.call(searchObject, 'andOr')) { const andOrOrStatement = []; searchObject.andOr.forEach((orObject) => { if (orObject.type === 'valueEquals') { andOrOrStatement.push({ [orObject.apiField]: value }); } else if (orObject.type === 'stringLike') { if (!lodash_1.isEmpty(value)) { andOrOrStatement.push({ [orObject.apiField]: { like: value, options: 'i' } }); } } else if (orObject.type === 'stringLikeArray') { value = typeof value === 'string' ? [value] : value; if (value.length > 1) { value.forEach((requestedValue) => { if (!lodash_1.isEmpty(requestedValue)) { andOrOrStatement.push({ [orObject.apiField]: { like: requestedValue, options: 'i' } }); } }); } else if (value.length === 1) { if (!lodash_1.isEmpty(value[0])) { andOrOrStatement.push({ [orObject.apiField]: { like: value[0], options: 'i' } }); } } } else if (orObject.type === 'stringIncludesArray') { value = typeof value === 'string' ? [value] : value; if (value.length > 1) { andOrOrStatement.push({ [orObject.apiField]: { inq: value } }); } else if (value.length === 1) { andOrOrStatement.push({ [orObject.apiField]: value[0] }); } } }); if (!lodash_1.isEmpty(andOrOrStatement)) { if (andOrOrStatement.length > 1) { andStatement.push({ or: andOrOrStatement }); } else if (andOrOrStatement.length === 1) { andStatement.push(andOrOrStatement[0]); } } } } }; for (const [widgetField, searchObject] of Object.entries(searchPossibilities)) { if (!Object.prototype.hasOwnProperty.call(searchObject, 'apiField')) { searchObject.apiField = widgetField; } if (Object.prototype.hasOwnProperty.call(searchFunctions, searchObject.type) && Object.prototype.hasOwnProperty.call(where, widgetField) && where[widgetField] !== '') { searchFunctions[searchObject.type](searchObject, where[widgetField]); } } if (!lodash_1.isEmpty(andStatement)) { whereQuery.and = andStatement; } return whereQuery; } function compilePropertyWhereFilter(where) { return compileGenericWhereFilter(where, { ListingKey: { type: 'valueEquals' }, ListingId: { type: 'stringIncludesArray' }, ListingType: { type: 'stringIncludesArray' }, Status: { type: 'stringIncludesArray' }, ListPriceMin: { type: 'numberEqualGreater', apiField: '_BestPrice' }, ListPriceMax: { type: 'numberEqualLess', apiField: '_BestPrice' }, Bathrooms: { type: 'numberEqualGreater' }, Bedrooms: { type: 'numberEqualGreater', apiField: 'BedroomsTotal' }, AgentLicense: { type: 'stringIncludesArray' }, OfficeNumber: { type: 'stringIncludesArray' }, OfficeName: { type: 'stringIncludesArray' }, OpenHouseOnly: { type: 'valueEquals' }, UnparsedAddress: { type: 'stringLikeArray' }, StreetAddress: { apiField: '_StreetAddress', type: 'stringLikeArray' }, eStreetAddress: { apiField: '_StreetAddress', type: 'stringIncludesArray' }, City: { type: 'stringLikeArray' }, eCity: { apiField: 'City', type: 'stringIncludesArray' }, PostalCode: { type: 'stringIncludesArray' }, CountyOrParish: { type: 'stringLikeArray' }, eCountyOrParish: { apiField: 'CountyOrParish', type: 'stringIncludesArray' }, SubdivisionName: { type: 'stringLikeArray' }, eSubdivisionName: { apiField: 'SubdivisionName', type: 'stringIncludesArray' }, MLSAreaMajor: { type: 'stringLikeArray' }, eMLSAreaMajor: { apiField: 'MLSAreaMajor', type: 'stringIncludesArray' }, MLSAreaMinor: { type: 'stringLikeArray' }, eMLSAreaMinor: { apiField: 'MLSAreaMinor', type: 'stringIncludesArray' }, CityRegion: { type: 'stringLikeArray' }, eCityRegion: { apiField: 'CityRegion', type: 'stringIncludesArray' }, Location: { type: 'andOr', andOr: [ { apiField: 'City', type: 'stringLikeArray' }, { apiField: 'CityRegion', type: 'stringLikeArray' }, { apiField: 'CountyOrParish', type: 'stringLikeArray' }, { apiField: 'SubdivisionName', type: 'stringLikeArray' }, { apiField: 'MLSAreaMajor', type: 'stringLikeArray' }, { apiField: 'MLSAreaMinor', type: 'stringLikeArray' }, { apiField: 'PostalCode', type: 'stringLikeArray' }, { apiField: 'UnparsedAddress', type: 'stringLikeArray' }, { apiField: 'ListingId', type: 'stringIncludesArray' }, ] }, eLocation: { type: 'andOr', andOr: [ { apiField: 'City', type: 'stringIncludesArray' }, { apiField: 'CityRegion', type: 'stringIncludesArray' }, { apiField: 'CountyOrParish', type: 'stringIncludesArray' }, { apiField: 'SubdivisionName', type: 'stringIncludesArray' }, { apiField: 'MLSAreaMajor', type: 'stringIncludesArray' }, { apiField: 'MLSAreaMinor', type: 'stringIncludesArray' }, { apiField: 'PostalCode', type: 'stringIncludesArray' }, { ap