{"version":3,"sources":["inovestor.ms.web.ajaxProxy.js"],"names":["inovestor","$","ms","web","ajaxProxy","originalMsAjaxMethod","core","ajaxApi","relativeUrl","options","apiBaseUrl","key","apiBaseUrlCopy","url","isNullOrUndefined","config","concatUrl","dataCache","toLowerCase","defer","Deferred","value","resolve","promise","jQuery"],"mappings":"AAIA,CAAA,SAAAA,EAAAC,GAEAD,EAAAE,GAAAC,IAAAC,UAAA,IAAA,WACA,IAAAC,EAAAL,EAAAE,GAAAI,KAAAC,QAKAP,EAAAE,GAAAI,KAAAC,QAAA,SAAAC,EAAAC,EAAAC,GACA,IAUAC,EAVAC,EAAAF,EAMAG,GAHAb,EAAAE,GAAAI,KAAAQ,kBAAAF,CAAA,IACAA,EAAAZ,EAAAE,GAAAI,KAAAS,OAAAL,YAEAV,EAAAE,GAAAI,KAAAU,UAAAJ,EAAAJ,CAAA,GAIA,IAAAG,KAAAX,EAAAE,GAAAC,IAAAc,UACA,GAAAN,EAAAO,YAAA,IAAAL,EAAAK,YAAA,EAAA,CACA,IAAAC,EAAAlB,EAAAmB,SAAA,EACAC,EAAArB,EAAAE,GAAAC,IAAAc,UAAAN,GACA,GAAAU,EAGA,OAFAF,EAAAG,QAAAD,CAAA,EACA,OAAArB,EAAAE,GAAAC,IAAAc,UAAAN,GACAQ,EAAAI,QAAA,CAEA,CAIA,OAAAlB,EAAAG,EAAAC,EAAAC,CAAA,CACA,CACA,CAEA,EAAAV,UAAAwB,MAAA","file":"../inoMsCoreOverwrite.min.js","sourcesContent":["// This is dependant on\r\n//\t\tinovestor.ms.web\r\n//\t\tinovestor.ms.core\r\n\r\n; (function (inovestor, $, undefined) {\r\n\r\n inovestor.ms.web.ajaxProxy = new (function () {\r\n var originalMsAjaxMethod = inovestor.ms.core.ajaxApi;\r\n\r\n // Overwrite inovestor.ms.core.ajaxApi method so we can handle cases where cached data is already present.\r\n // If there's in data in the cache object for the current API call, just resolve a promise with the data.\r\n // Otherwise, call the original method as we don't have to temper with the call.\r\n inovestor.ms.core.ajaxApi = function (relativeUrl, options, apiBaseUrl) {\r\n var apiBaseUrlCopy = apiBaseUrl;\r\n\r\n // inovestor.ms.core.ajaxApi does some treatment on apiBaseUrl so we need to do the same...\r\n if (inovestor.ms.core.isNullOrUndefined(apiBaseUrlCopy))\r\n apiBaseUrlCopy = inovestor.ms.core.config.apiBaseUrl;\r\n\r\n var url = inovestor.ms.core.concatUrl(apiBaseUrlCopy, relativeUrl);\r\n\r\n // Because our URLs are case-insensitive, loop through all keys and compare in lowercase.\r\n // In our system, \"Domain.com/Path\" is the same as \"domain.com/path\".\r\n for (var key in inovestor.ms.web.dataCache) {\r\n if (key.toLowerCase() === url.toLowerCase()) {\r\n var defer = $.Deferred();\r\n var value = inovestor.ms.web.dataCache[key];\r\n if (value) {\r\n defer.resolve(value);\r\n delete inovestor.ms.web.dataCache[key];\r\n return defer.promise();\r\n }\r\n }\r\n }\r\n\r\n // Could not find the key, execute the original ajax method\r\n return originalMsAjaxMethod(relativeUrl, options, apiBaseUrl);\r\n };\r\n })();\r\n\r\n})(inovestor, jQuery);"]}