{"version":3,"file":"Reepay.js","names":["defineDs","Utils","load","promise","Promise","resolve","window","Reepay","undefined","include","checkout","token","retries","console","error","WindowCheckout","then","isApplePayAvailable","_window$Reepay","isTopFrame","isApp","isGooglePayAvailable"],"sources":["DanskeSpil/Framework/PlayerAccountManagement/Scripts/Helpers/Reepay.js"],"sourcesContent":["defineDs('DanskeSpil/Framework/PlayerAccountManagement/Scripts/Helpers/Reepay', [\r\n 'DanskeSpil/Framework/PlayerAccountManagement/Scripts/Helpers/Utils'\r\n], function (Utils) {\r\n\r\n\r\n var load = function () {\r\n var promise = new Promise(function (resolve) {\r\n // Initialize Reepay if we haven't done this already.\r\n // It's a design choice that we do not keep a copy of the javascript in our vendor folder.\r\n if (window.Reepay === undefined) {\r\n window.include('https://checkout.reepay.com/checkout.js', function () {\r\n resolve();\r\n });\r\n } else {\r\n resolve();\r\n }\r\n\r\n });\r\n\r\n return promise;\r\n };\r\n\r\n var checkout = function (token, retries) {\r\n if (retries) {\r\n if (retries === 1) {\r\n console.error('Stopping checkout, after 3 failed attempts.');\r\n return;\r\n }\r\n retries--;\r\n } else {\r\n retries = 3;\r\n }\r\n if (window.Reepay) {\r\n new window.Reepay.WindowCheckout(token);\r\n } else {\r\n // Reepay not loaded, lets try again.\r\n load().then(function () {\r\n checkout(token, retries);\r\n });\r\n\r\n\r\n }\r\n };\r\n\r\n var isApplePayAvailable = function () {\r\n if (!Utils.isTopFrame() && !Utils.isApp()) {\r\n return false;\r\n }\r\n\r\n if (typeof window.Reepay?.isApplePayAvailable === 'function') {\r\n return window.Reepay.isApplePayAvailable();\r\n }\r\n\r\n return false;\r\n };\r\n\r\n var isGooglePayAvailable = function () {\r\n if (typeof window.Reepay.isGooglePayAvailable === 'function') {\r\n return window.Reepay.isGooglePayAvailable();\r\n }\r\n return false;\r\n };\r\n\r\n return {\r\n load: load,\r\n checkout: checkout,\r\n isApplePayAvailable: isApplePayAvailable,\r\n isGooglePayAvailable: isGooglePayAvailable\r\n };\r\n});\r\n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