{"version":3,"file":"LottoGame.js","names":["defineDs","m","Model","SaturdayLottoApi","WednesdayLottoApi","LottoInfo","LottoUtils","DataLayer","LottoGame","content","_this","infoFeed","saturday","bind","api","_generatedRows","prop","_generatedJokerRowsSaturday","_generatedJokerRowsWednesday","couponId","extraCouponId","gameType","numberOfDraws","getDrawRepeatDefault","firstDrawNo","firstWagerPrice","upsellExtra","getDrawRepeatMax","numbersIntervalMax","playType","purchaseTracked","ready","deferred","rebuyCouponId","rows","rowsToGenerate","startUrl","window","location","href","split","status","systemName","withJokerSaturday","withJokerWednesday","isProductDetailsTracked","isAddToCartTracked","isPurchaseCompleteTracked","plusSubscriptionJackpot","firstDepositInfo","playTogetherDepositType","rowPriceChanged","originalNumberOfDraws","originalPrice","originalExtraDraw","reducedWeeks","verticalType","clientContext","trackedInteractionCreationAction","classicMaxRows","numberOfDrawsOptions","getDrawRepeatOptions","stakePerJoker","getJokerPrice","drawDays","numbersPerRowMin","numbersPerRow","numbersPerRowMax","type","minimum","playSystems","getPlaySystems","name","i","length","playSystem","parseInt","selectedNumbersCount","rowCount","count","amount","row","sortRow","numbers","sort","a","b","number","addNumber","autogenerated","getRow","push","save","removeNumber","index","splice","addRow","state","removeRow","removeAllRows","resetRow","rowNumber","setRow","autogenerateNumbers","indexOf","console","error","self","options","requiredNumbers","system","getRandomNumbers","then","manualSelectedNumbers","filter","generatedNumber","resolve","reject","promise","generateSystemRows","getSystemKeys","systemKeys","generatedRows","isGameValid","selectedNumbers","map","areAllRowsValid","every","isRowValid","autofillClassicRows","_asyncToGenerator","promises","emptyRows","fullyGeneratedRows","rowsNumbers","rowNumbers","emptyRow","j","Promise","all","gameGenerateRows","join","gameGenerateJokerRows","getRandomJokerNumbers","generatedJokerRows","setNumberOfDraws","draws","setFirstDrawNo","setUpsellExtra","purchase","params","proceed","drawId","errorMessage","getRowsSummary","totalPrice","multidraw","salesChannel","isMobile","isTabletDevice","notifyPrizeEmail","notifyPrizeSms","jokerSaturdayRows","getJokerRowsSummary","jokerWednesdayRows","request","createCoupon","data","prepareConfirm","confirmUrl","sync","createDataLayerJoker","day","subscription","joker","price","rowPrice","brand","category","categoryName","variant","variantName","quantity","coupon","createDataLayerProduct","event","dataLayerProducts","product","hasExtraDraws","gameExtraDraws","hasUpsellExtra","isAdvanceBuy","getRowAmount","productCopy","_objectSpread","trackingAddToCart","addToCart","warn","trackingProductDetails","productDetail","trackingPurchaseComplete","purchaseCompleted","toString","id","fallbackFakeCouponId","Math","random","slice","getRows","valid","maximum","hasNumber","drawDateHtml","delimiter","openDraw","closingTime","date","Date","result","formatISO8601","toISOString","includeTime","setDate","getDate","drawDateHtmlShort","dates","drawDates","firstDate","lastDate","draw","getMonth","getFullYear","_this$extraDraw","drawsFromLottoInfo","firstDraw","lottoSaturday","advanceBuy","firstDrawIndex","feedDrawDates","_draw$drawType","hasJoker","drawType","toLowerCase","futureDate","jokerWednesday","forEach","_draw$drawType2","firstWednesdayJoker","extraDraw","extraDrawDate","getTime","rawDrawsDataFromInfoFeed","drawTimes","feedDraws","feedDraw","feedDrawTime","includes","drawDatesWithoutJokerInfo","_this$extraDraw2","drawObject","campaigns","campaignNumbers","campaignData","jokerDrawDates","drawDay","jokerSaturday","saturdayDraws","dayName","wednesdayDraws","combinedDraws","concat","localeCompare","campaignDrawsCount","wantedCampaign","reduce","_draw$campaigns","Array","isArray","_draw$campaignNumbers","some","campaignNumber","_draw$campaignNumbers2","c","value","checkGeneratedConsistency","getSystemRowAmount","useGenerated","summary","rowIndex","undefined","_this$infoFeed$data","find","_draw$drawType3","_draw$drawType4","extraDrawPrice","_this$extraDraw3","totalRowsPricePerDraw","drawIndex","rowAmount","totalJokerPrice","jokerPrice","getJokerCount","isNumberOfDrawsExceed","getSystemNumberAmount","isSubscriptionValid","trackPurchase","DSAPI","feed","receiptUrl","cancelUrl","multiClientPath","copyFromOldCoupon","getCoupon","_data$multiWagers","_data$multiWagers2","multiWagers","wager","_wager$drawType","rebuyDrawRepeatMax","games","game","test","substring","systemNumbers","charAt","toUpperCase","sendToSubscription","_this$linkToPlusPurch","link","linkToPlusPurchase","call","linkArr","shift","toJSON","timestamp","init","getLuckyDefaultRowCount","setupGame","savedCoupon","construct","JSON","parse","gameInstanceId","get"],"sources":["DanskeSpil/Domain/Lotto/Scripts/Models/LottoGame.js"],"sourcesContent":["defineDs('DanskeSpil/Domain/Lotto/Scripts/Models/LottoGame',\r\n [\r\n 'Shared/Framework/Mithril/Scripts/Core/Mithril',\r\n 'Shared/Framework/Mithril/Scripts/Core/Model',\r\n 'DanskeSpil/Domain/Lotto/Scripts/Helpers/SaturdayLottoApi',\r\n 'DanskeSpil/Domain/Lotto/Scripts/Helpers/WednesdayLottoApi',\r\n 'DanskeSpil/Domain/Lotto/Scripts/Helpers/LottoInfo',\r\n 'DanskeSpil/Domain/Lotto/Scripts/Helpers/LottoUtils',\r\n 'DanskeSpil/Framework/NumberGames/Scripts/Helpers/DataLayer'\r\n ],\r\n function (m, Model, SaturdayLottoApi, WednesdayLottoApi, LottoInfo, LottoUtils, DataLayer) {\r\n\r\n // Model:\r\n var LottoGame = Model('LottoGame', function (content) {\r\n\r\n // Dispatch functions for feed and api:\r\n this.infoFeed = function () {\r\n return LottoInfo.saturday();\r\n }.bind(this);\r\n\r\n this.api = function () {\r\n return SaturdayLottoApi;\r\n }.bind(this);\r\n\r\n // Variables:\r\n this._generatedRows = m.prop(content._generatedRows || []); // Use function generatedRows for reaching this\r\n this._generatedJokerRowsSaturday = m.prop(content._generatedJokerRowsSaturday || []);\r\n this._generatedJokerRowsWednesday = m.prop(content._generatedJokerRowsWednesday || []);\r\n this.couponId = m.prop(content.couponId || null);\r\n this.extraCouponId = m.prop(content.extraCouponId || null);\r\n this.gameType = m.prop('saturday'); // For legacy wednesday/saturday stuff\r\n this.numberOfDraws = m.prop(typeof content.numberOfDraws !== 'undefined' ? content.numberOfDraws : this.infoFeed().getDrawRepeatDefault()); // NEED TO USE TYPEOF UNDEFINED CHECK HERE, BECAUSE 0 IS A VALID OPTION\r\n this.firstDrawNo = m.prop(content.firstDrawNo);\r\n this.firstWagerPrice = m.prop(content.firstWagerPrice || null);\r\n this.upsellExtra = m.prop(content.upsellExtra);\r\n this.getDrawRepeatMax = m.prop(this.infoFeed().getDrawRepeatMax());\r\n this.numbersIntervalMax = m.prop(36);\r\n this.playType = m.prop(content.playType || null);\r\n this.purchaseTracked = m.prop(content.purchaseTracked || false);\r\n this.ready = m.prop(m.deferred());\r\n this.rebuyCouponId = m.prop(content.rebuyCouponId || null);\r\n this.rows = m.prop(content.rows || []);\r\n this.rowsToGenerate = m.prop(content.rowsToGenerate || 0); // For playtypes Lightning and Lucky\r\n this.startUrl = m.prop(content.startUrl || window.location.href.split('?')[0]);\r\n this.status = m.prop(content.status || 'open');\r\n this.systemName = m.prop(content.systemName || (this.playType() === 'System' ? 'M 8-8' : null)); // Required by LottoSystem\r\n // we want to check the typeof `withJoker...` as it would be set to `false` when the user selects `no joker`\r\n // if the game instance is new or the user has not interacted with the joker selector than we want to set it to `null`\r\n this.withJokerSaturday = m.prop(typeof content.withJokerSaturday === 'boolean' ? content.withJokerSaturday : null);\r\n this.withJokerWednesday = m.prop(typeof content.withJokerWednesday === 'boolean' ? content.withJokerWednesday : null);\r\n this.isProductDetailsTracked = m.prop(content.isProductDetailsTracked || false);\r\n this.isAddToCartTracked = m.prop(content.isAddToCartTracked || false);\r\n this.isPurchaseCompleteTracked = m.prop(content.isPurchaseCompleteTracked || false);\r\n this.plusSubscriptionJackpot = m.prop(content.plusSubscriptionJackpot || null);\r\n this.firstDepositInfo = m.prop(content.firstDepositInfo || null);\r\n this.playTogetherDepositType = m.prop(content.playTogetherDepositType || null);\r\n this.rowPriceChanged = m.prop(false);\r\n this.originalNumberOfDraws = m.prop(null);\r\n this.originalPrice = m.prop(null);\r\n this.originalExtraDraw = m.prop(null);\r\n this.reducedWeeks = m.prop(false);\r\n this.verticalType = m.prop(content.verticalType);\r\n this.clientContext = m.prop(content.clientContext || null);\r\n this.trackedInteractionCreationAction = m.prop(content.trackedInteractionCreationAction || null);\r\n\r\n // Constants:\r\n this.classicMaxRows = m.prop(50);\r\n this.numberOfDrawsOptions = m.prop(this.infoFeed().getDrawRepeatOptions());\r\n this.stakePerJoker = m.prop(this.infoFeed().getJokerPrice());\r\n // drawDays is an array of booleans, where each index represents a day of the week, starting with Monday\r\n this.drawDays = m.prop([false, false, false, false, false, true, false]);\r\n\r\n // Functions:\r\n this.numbersPerRowMin = function () {\r\n return this.numbersPerRow('min');\r\n }.bind(this);\r\n\r\n this.numbersPerRowMax = function () {\r\n return this.numbersPerRow('max');\r\n }.bind(this);\r\n\r\n this.numbersPerRow = function (type) {\r\n var playType = this.playType();\r\n\r\n // Classic:\r\n if (playType === 'Classic') {\r\n return 7;\r\n\r\n // Lucky:\r\n } else if (playType === 'Lucky') {\r\n return type === 'min' ? 1 : 6;\r\n }\r\n\r\n // System:\r\n var minimum = 0;\r\n var playSystems = this.infoFeed().getPlaySystems();\r\n var systemName = this.systemName() || playSystems[0].name;\r\n\r\n for (var i = 0; i < playSystems.length; i++) {\r\n var playSystem = playSystems[i];\r\n\r\n if (playSystem.name === systemName) {\r\n minimum = parseInt(playSystem.selectedNumbersCount, 10);\r\n\r\n break;\r\n }\r\n }\r\n\r\n return minimum;\r\n }.bind(this);\r\n\r\n // Functions - For manipulating rows:\r\n this.rowCount = function () {\r\n var count = 0;\r\n var rows = this.rows();\r\n var amount = rows.length;\r\n\r\n for (var i = 0; i < amount; i++) {\r\n var row = rows[i];\r\n\r\n if (row.count > count) {\r\n count = row.count + 1;\r\n } else {\r\n count++;\r\n }\r\n }\r\n\r\n return count;\r\n }.bind(this);\r\n\r\n this.sortRow = function (numbers) {\r\n numbers.sort(function (a, b) {\r\n return a.number < b.number ? -1 : 1;\r\n });\r\n\r\n return numbers;\r\n };\r\n\r\n this.addNumber = function (row, number, autogenerated) {\r\n row = this.getRow(row);\r\n\r\n if (row.numbers.length >= this.numbersPerRowMax()) {\r\n return;\r\n }\r\n\r\n row.numbers.push({ number: number, autogenerated: autogenerated || false });\r\n row.numbers = this.sortRow(row.numbers);\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n this.removeNumber = function (row, number) {\r\n row = this.getRow(row);\r\n\r\n var index = -1;\r\n var numbers = row.numbers;\r\n\r\n for (var i = 0; i < numbers.length; i++) {\r\n if (numbers[i].number === number) {\r\n index = i;\r\n\r\n break;\r\n }\r\n }\r\n\r\n if (index > -1) {\r\n row.numbers.splice(index, 1);\r\n }\r\n\r\n row.numbers = this.sortRow(row.numbers);\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n this.addRow = function (numbers) {\r\n numbers = numbers || [];\r\n\r\n var count = this.rowCount();\r\n\r\n this.rows().push({ count: count, numbers: numbers, state: 'clean' });\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n this.removeRow = function (row) {\r\n var rows = this.rows();\r\n\r\n rows.splice(row - 1, 1);\r\n\r\n this.rows(rows);\r\n\r\n if (rows.length === 0) {\r\n this.addRow();\r\n }\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n this.removeAllRows = function () {\r\n this.rows([]);\r\n\r\n this.addRow();\r\n this.addRow();\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n this.resetRow = function (rowNumber) {\r\n var row = this.getRow(rowNumber);\r\n\r\n row.numbers = [];\r\n row.state = 'clean';\r\n\r\n this.setRow(rowNumber, row);\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n this.setRow = function (row, content) {\r\n var rows = this.rows();\r\n rows[row - 1] = content;\r\n this.rows(rows);\r\n this.save();\r\n }.bind(this);\r\n\r\n // Classic and System: generate numbers for a specific row:\r\n this.autogenerateNumbers = function (rowNumber) {\r\n var playType = this.playType();\r\n\r\n if (['Classic', 'System'].indexOf(playType) === -1) {\r\n console.error('LottoGame autogenerateNumbers: This method cannot be used for playType', playType);\r\n\r\n return;\r\n }\r\n\r\n var self = this;\r\n var deferred = m.deferred();\r\n var row = this.getRow(rowNumber);\r\n var numbers = [];\r\n\r\n // Prepare list of existing user selected numbers:\r\n for (var i = 0; i < row.numbers.length; i++) {\r\n var number = row.numbers[i];\r\n\r\n if (!number.autogenerated) {\r\n numbers.push(number.number);\r\n }\r\n }\r\n\r\n // Setup options for random service:\r\n var options = { playType: playType, rowsToGenerate: 1, requiredNumbers: numbers };\r\n\r\n if (playType === 'System') {\r\n options.system = this.systemName();\r\n }\r\n\r\n // Call service:\r\n this.api().getRandomNumbers(options).then(function (rows) {\r\n rows = rows[0];\r\n\r\n const manualSelectedNumbers = row.numbers.filter((number) => !number.autogenerated);\r\n row.numbers = manualSelectedNumbers;\r\n self.setRow(rowNumber, row);\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n var generatedNumber = rows[i];\r\n\r\n if (generatedNumber && numbers.indexOf(generatedNumber) === -1) {\r\n self.addNumber(rowNumber, generatedNumber, true);\r\n }\r\n }\r\n\r\n deferred.resolve();\r\n }, function () {\r\n deferred.reject();\r\n });\r\n\r\n return deferred.promise;\r\n }.bind(this);\r\n\r\n this.generateSystemRows = function () {\r\n var self = this;\r\n var deferred = m.deferred();\r\n\r\n this.api().getSystemKeys(this.systemName()).then(function (systemKeys) {\r\n if (systemKeys) {\r\n var generatedRows = [];\r\n\r\n if (self.isGameValid()) {\r\n var selectedNumbers = self.getRow(1).numbers;\r\n\r\n // Merge users selected numbers into the system key\r\n generatedRows = systemKeys.map(function (row, i) {\r\n var numbers = row.map(function (index) {\r\n // replace each index with the numbers chosen by the user\r\n return { number: selectedNumbers[index - 1].number, autogenerated: true };\r\n });\r\n\r\n return { count: i, numbers: numbers, state: 'clean' };\r\n });\r\n\r\n } else {\r\n\r\n // Just use the pure system key\r\n generatedRows = systemKeys.map(function (row, i) {\r\n var numbers = row.map(function (index) {\r\n return { number: index, autogenerated: true };\r\n });\r\n return { count: i, numbers: numbers, state: 'clean' };\r\n });\r\n\r\n }\r\n\r\n deferred.resolve(generatedRows);\r\n }\r\n }, function () {\r\n deferred.reject();\r\n });\r\n\r\n return deferred.promise;\r\n }.bind(this);\r\n\r\n this.areAllRowsValid = () => {\r\n return this.rows().every((row) => this.isRowValid(row.count + 1));\r\n };\r\n\r\n this.autofillClassicRows = async () => {\r\n const promises = [];\r\n const emptyRows = [];\r\n for (let i = 0; i < this.rows().length; i++) {\r\n const row = this.rows()[i];\r\n const rowNumber = row.count + 1;\r\n if (!this.isRowValid(rowNumber)) {\r\n if (row.numbers.length > 0) {\r\n promises.push(this.autogenerateNumbers(rowNumber));\r\n } else {\r\n emptyRows.push(row);\r\n }\r\n }\r\n }\r\n if (emptyRows.length > 0) {\r\n const fullyGeneratedRows = this.api().getRandomNumbers({ rowsToGenerate: emptyRows.length }).then((rowsNumbers) => {\r\n for (let i = 0; i < rowsNumbers.length; i++) {\r\n const rowNumbers = rowsNumbers[i];\r\n const emptyRow = emptyRows[i];\r\n for (let j = 0; j < rowNumbers.length; j++) {\r\n this.addNumber(emptyRow.count + 1, rowNumbers[j], true);\r\n }\r\n }\r\n });\r\n promises.push(fullyGeneratedRows);\r\n }\r\n await Promise.all(promises);\r\n\r\n this.save();\r\n };\r\n\r\n // Lightning, Lucky and System: generate output rows:\r\n this.gameGenerateRows = function () {\r\n var self = this;\r\n var deferred = m.deferred();\r\n\r\n if (['Lightning', 'Lucky', 'System'].indexOf(this.playType()) === -1) {\r\n console.error('LottoGame gameGenerateRows: This method cannot be used for playType', this.playType());\r\n\r\n deferred.reject();\r\n\r\n return;\r\n }\r\n\r\n if (this.playType() === 'System') {\r\n\r\n // System:\r\n this.generateSystemRows().then(function (generatedRows) {\r\n self.generatedRows(generatedRows);\r\n\r\n self.save();\r\n\r\n deferred.resolve();\r\n }, function () {\r\n deferred.reject();\r\n });\r\n\r\n } else {\r\n\r\n // Lightning and Lucky:\r\n var row = this.getRow(1);\r\n var requiredNumbers = [];\r\n\r\n if (row && row.numbers.length > 0) {\r\n requiredNumbers = row.numbers.map(function (number) {\r\n return number.number;\r\n });\r\n }\r\n\r\n var options = { rowsToGenerate: this.rowsToGenerate() };\r\n\r\n if (this.playType() === 'Lucky') {\r\n options.requiredNumbers = requiredNumbers.join(',');\r\n }\r\n\r\n this.api().getRandomNumbers(options).then(function (rows) {\r\n var generatedRows = [];\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n var row = rows[i];\r\n var numbers = row.map(function (number) { return { number: number, autogenerated: true }; });\r\n\r\n generatedRows.push({ count: i, numbers: numbers, state: 'clean' });\r\n }\r\n\r\n self.generatedRows(generatedRows);\r\n self.save();\r\n\r\n deferred.resolve();\r\n }, function () {\r\n deferred.reject();\r\n }).bind(this);\r\n }\r\n\r\n return deferred.promise;\r\n }.bind(this);\r\n\r\n this.gameGenerateJokerRows = function (type) {\r\n var api = type === 'Wednesday' ? WednesdayLottoApi : SaturdayLottoApi;\r\n var deferred = m.deferred();\r\n var self = this;\r\n\r\n api.getRandomJokerNumbers().then(function (rows) {\r\n var generatedJokerRows = [];\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n var row = rows[i];\r\n var numbers = row.map(function (number) { return { number: number, autogenerated: true }; });\r\n\r\n generatedJokerRows.push({ count: i, numbers: numbers, state: 'clean' });\r\n }\r\n\r\n self.generatedJokerRows(type, generatedJokerRows);\r\n self.save();\r\n\r\n deferred.resolve();\r\n }, function () {\r\n deferred.reject();\r\n });\r\n\r\n return deferred.promise;\r\n }.bind(this);\r\n\r\n // Functions for number of draws:\r\n this.setNumberOfDraws = function (draws) {\r\n this.numberOfDraws(draws);\r\n this.save();\r\n }.bind(this);\r\n\r\n this.setFirstDrawNo = function (firstDrawNo) {\r\n this.firstDrawNo(firstDrawNo);\r\n this.save();\r\n }.bind(this);\r\n\r\n this.setUpsellExtra = (state) => {\r\n this.upsellExtra(state);\r\n this.save();\r\n };\r\n\r\n // Functions for purchase:\r\n this.purchase = function (params) {\r\n params = params || {};\r\n\r\n var deferred = m.deferred();\r\n var proceed = true;\r\n var self = this;\r\n\r\n if (this.status() != 'open') {\r\n deferred.reject();\r\n } else if (!params.drawId) {\r\n console.error('No drawId given.');\r\n\r\n deferred.reject({ errorMessage: 'NUMBERGAMES.NO_OPEN_DRAW' });\r\n } else {\r\n this.status('pending-confirmation');\r\n\r\n this.save();\r\n\r\n var rows = this.playType() === 'System' ? this.getRowsSummary(false) : this.getRowsSummary();\r\n var rowNumbers = rows.map(function (row) { return { numbers: row }; });\r\n\r\n var options = {\r\n upsellExtra: this.upsellExtra() || false,\r\n drawId: params.drawId,\r\n firstDrawNo: this.firstDrawNo() || null,\r\n totalPrice: parseInt(self.totalPrice(), 10),\r\n multidraw: parseInt(self.numberOfDraws(), 10),\r\n playType: this.playType() || null,\r\n rows: rowNumbers,\r\n salesChannel: (LottoUtils.isMobile() || LottoUtils.isTabletDevice()) ? 'mobile' : 'web'\r\n };\r\n\r\n // Prize notification - register only enabling:\r\n if (params.notifyPrizeEmail) {\r\n options.notifyPrizeEmail = true;\r\n }\r\n\r\n if (params.notifyPrizeSms) {\r\n options.notifyPrizeSms = true;\r\n }\r\n\r\n // Jokers:\r\n if (this.withJokerSaturday()) {\r\n options.jokerSaturdayRows = this.getJokerRowsSummary('Saturday');\r\n\r\n if (options.jokerSaturdayRows.length === 0) {\r\n proceed = false;\r\n\r\n deferred.reject('joker-saturday-error');\r\n }\r\n }\r\n\r\n if (this.withJokerWednesday()) {\r\n options.jokerWednesdayRows = this.getJokerRowsSummary('Wednesday');\r\n\r\n if (options.jokerWednesdayRows.length === 0) {\r\n proceed = false;\r\n\r\n deferred.reject('joker-wednesday-error');\r\n }\r\n }\r\n\r\n // Proceed:\r\n if (proceed) {\r\n\r\n // System:\r\n if (this.playType() === 'System') {\r\n options.system = this.systemName();\r\n }\r\n\r\n // Create request:\r\n var request = this.api().createCoupon(options);\r\n\r\n request.then(function (data) {\r\n self.status('completed');\r\n\r\n self.couponId(data.couponId);\r\n if (data.extraCouponId) {\r\n self.extraCouponId(data.extraCouponId);\r\n }\r\n\r\n self.save();\r\n\r\n deferred.resolve(data);\r\n }, function (data) {\r\n self.status('open');\r\n self.save();\r\n\r\n deferred.reject(data);\r\n });\r\n\r\n }\r\n }\r\n\r\n return deferred.promise;\r\n }.bind(this);\r\n\r\n this.prepareConfirm = function () {\r\n var confirmUrl = this.confirmUrl();\r\n var deferred = m.deferred();\r\n var playType = this.playType();\r\n var status = this.status();\r\n\r\n if (status !== 'processing') {\r\n var promises = playType !== 'Classic' ? [this.gameGenerateRows()] : [];\r\n var self = this;\r\n\r\n if (status === 'prepare-confirm-error') {\r\n status = 'open';\r\n }\r\n\r\n this.status(this.numberOfDraws() > 0 ? 'processing' : status);\r\n\r\n if (this.withJokerSaturday()) {\r\n promises.push(this.gameGenerateJokerRows('Saturday'));\r\n }\r\n\r\n if (this.withJokerWednesday()) {\r\n promises.push(this.gameGenerateJokerRows('Wednesday'));\r\n }\r\n\r\n m.sync(promises).then(function () {\r\n self.status(status);\r\n self.save();\r\n\r\n deferred.resolve(confirmUrl);\r\n }, function () {\r\n self.status('prepare-confirm-error');\r\n\r\n self.save();\r\n\r\n deferred.reject();\r\n });\r\n }\r\n\r\n return deferred.promise;\r\n }.bind(this);\r\n\r\n // Functions - For tracking (DataLayer eCommerce buzzword)\r\n\r\n this.createDataLayerJoker = function (day, subscription) {\r\n var joker;\r\n\r\n if (!subscription) {\r\n joker = {\r\n name: 'joker',\r\n price: DataLayer.rowPrice(this.stakePerJoker(), this.numberOfDraws(), 'joker'),\r\n brand: 'dlo_jok',\r\n category: DataLayer.categoryName(this.playType()),\r\n variant: DataLayer.variantName('joker', this.numberOfDraws(), day),\r\n quantity: 1\r\n };\r\n }\r\n\r\n if (subscription) {\r\n joker = {\r\n name: 'plus',\r\n price: DataLayer.rowPrice(this.stakePerJoker(), this.numberOfDraws(), 'plus_joker'),\r\n brand: 'dlo_plu',\r\n category: DataLayer.categoryName(this.playType()),\r\n variant: DataLayer.variantName('plus_joker', this.numberOfDraws(), day),\r\n quantity: 1\r\n };\r\n }\r\n\r\n if (this.trackedInteractionCreationAction()) {\r\n joker.coupon = this.trackedInteractionCreationAction();\r\n }\r\n\r\n return joker;\r\n };\r\n\r\n this.createDataLayerProduct = function (type, event) {\r\n // Product array for datalayer\r\n var dataLayerProducts = [];\r\n var product = {};\r\n var subscription = type === 'plus';\r\n const hasExtraDraws = this.gameExtraDraws().length > 0;\r\n const hasUpsellExtra = this.upsellExtra();\r\n const isAdvanceBuy = this.firstDrawNo();\r\n\r\n // Main product\r\n if (type === 'plus') {\r\n // subscription product (PLUS abodoment)\r\n product.name = 'plus';\r\n product.price = DataLayer.rowPrice(this.infoFeed().data(), this.numberOfDraws(), 'plus');\r\n product.brand = 'dlo_plu';\r\n product.category = DataLayer.categoryName(this.playType());\r\n product.variant = DataLayer.variantName('plus_lotto', this.numberOfDraws(), this.playType(), this.systemName());\r\n product.quantity = this.getRowAmount();\r\n } else {\r\n product.name = 'lotto';\r\n product.price = DataLayer.rowPrice(this.infoFeed().data(), this.numberOfDraws());\r\n product.brand = 'dlo_lot';\r\n product.category = DataLayer.categoryName(this.playType());\r\n product.variant = DataLayer.variantName('lotto', this.numberOfDraws(), this.playType(), this.systemName());\r\n\r\n if (type === 'playtogether') {\r\n product.category = 'spil_sammen';\r\n }\r\n\r\n if (event != 'productDetails') {\r\n product.quantity = this.getRowAmount();\r\n }\r\n\r\n if (this.trackedInteractionCreationAction()) {\r\n product.coupon = this.trackedInteractionCreationAction();\r\n }\r\n }\r\n\r\n if (type !== 'plus' && hasExtraDraws && !hasUpsellExtra) {\r\n product.price = DataLayer.rowPrice(this.infoFeed().data(), (this.numberOfDraws() - this.gameExtraDraws().length));\r\n }\r\n\r\n if (!isAdvanceBuy) {\r\n dataLayerProducts.push(product);\r\n }\r\n\r\n if (type !== 'plus') {\r\n if (hasExtraDraws || hasUpsellExtra || isAdvanceBuy) {\r\n const productCopy = { ...product };\r\n productCopy.name = 'julelotto';\r\n if (hasExtraDraws || hasUpsellExtra) {\r\n productCopy.price = DataLayer.rowPrice(this.infoFeed().data(), this.gameExtraDraws().length);\r\n }\r\n if (hasExtraDraws) {\r\n productCopy.coupon = 'purchase_with_extra_draw';\r\n }\r\n if (hasUpsellExtra) {\r\n productCopy.coupon = 'purchase_with_upsell';\r\n }\r\n if (isAdvanceBuy) {\r\n productCopy.coupon = 'purchase_advance_draw';\r\n }\r\n\r\n dataLayerProducts.push(productCopy);\r\n }\r\n }\r\n\r\n // Check for joker saturday\r\n if (this.withJokerSaturday()) {\r\n !subscription ? dataLayerProducts.push(this.createDataLayerJoker('saturday')) : dataLayerProducts.push(this.createDataLayerJoker('saturday', 'plus'));\r\n }\r\n\r\n // Check for joker wednesday\r\n if (this.withJokerWednesday()) {\r\n !subscription ? dataLayerProducts.push(this.createDataLayerJoker('wednesday')) : dataLayerProducts.push(this.createDataLayerJoker('wednesday', 'plus'));\r\n }\r\n\r\n return dataLayerProducts;\r\n };\r\n\r\n this.trackingAddToCart = function (type) {\r\n if (this.isAddToCartTracked() == false) {\r\n this.isAddToCartTracked(true);\r\n this.save();\r\n\r\n // Push DataLayer addToCart Event\r\n if (type == 'plus' || type === 'playtogether') {\r\n DataLayer.addToCart(this.createDataLayerProduct(type));\r\n } else {\r\n DataLayer.addToCart(this.createDataLayerProduct());\r\n }\r\n } else {\r\n console.warn('addToCart has been pushed already!');\r\n }\r\n }.bind(this);\r\n\r\n this.trackingProductDetails = function () {\r\n // Check if the event has already been pushed\r\n if (this.isProductDetailsTracked() == false) {\r\n this.isProductDetailsTracked(true);\r\n this.save();\r\n\r\n // Push DataLayer addToCart Event\r\n DataLayer.productDetail(this.createDataLayerProduct(false, 'productDetails'));\r\n } else {\r\n console.warn('productDetails has been pushed already!');\r\n }\r\n }.bind(this);\r\n\r\n this.trackingPurchaseComplete = function (type) {\r\n if (this.isPurchaseCompleteTracked() == false) {\r\n this.isPurchaseCompleteTracked(true);\r\n this.save();\r\n\r\n // Push DataLayer purchaseComplete Event\r\n DataLayer.purchaseCompleted({\r\n totalPrice: this.totalPrice().toString(),\r\n id: this.couponId() || this.fallbackFakeCouponId()\r\n }, this.createDataLayerProduct(type));\r\n } else {\r\n console.warn('purchaseCompleted has been pushed already!');\r\n }\r\n }.bind(this);\r\n\r\n // Ensighten will group all events together if the ID is not unique.\r\n // In Playtogether we don't have a couponId upon purchase, so we create a fake one\r\n this.fallbackFakeCouponId = function () {\r\n var couponId = 'NA-LOT-' + Math.random().toString(36).slice(2);\r\n\r\n return couponId;\r\n };\r\n\r\n // Functions - For extracting data:\r\n this.getRow = function (row) {\r\n // Note: the row index starts with 1:\r\n\r\n return this.rows()[row - 1];\r\n }.bind(this);\r\n\r\n this.getRows = function (valid) {\r\n var maximum = this.numbersIntervalMax();\r\n var minimum = 0;\r\n\r\n if (valid === true) {\r\n maximum = this.numbersPerRowMax();\r\n minimum = this.numbersPerRowMin();\r\n }\r\n\r\n return this.rows().filter(function (row) {\r\n return (row.state !== 'remove' && row.numbers.length >= minimum && row.numbers.length <= maximum);\r\n });\r\n }.bind(this);\r\n\r\n this.hasNumber = function (row, number) {\r\n row = this.getRow(row);\r\n\r\n var numbers = row.numbers;\r\n\r\n for (var i = 0; i < numbers.length; i++) {\r\n if (numbers[i].number === number) {\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n }.bind(this);\r\n\r\n this.drawDateHtml = function (delimiter) {\r\n var openDraw = this.infoFeed().data().openDraw;\r\n if (!openDraw || !openDraw.closingTime) {\r\n return '';\r\n }\r\n\r\n delimiter = delimiter || ' - ';\r\n\r\n var closingTime = openDraw.closingTime;\r\n var draws = this.numberOfDraws();\r\n\r\n var date = new Date(closingTime);\r\n\r\n var result = LottoUtils.formatISO8601(date.toISOString(), { includeTime: false });\r\n\r\n if (draws > 1) {\r\n date.setDate(date.getDate() + ((draws - 1) * 7));\r\n result = '' + result + delimiter + LottoUtils.formatISO8601(date.toISOString(), { includeTime: false }) + '';\r\n }\r\n\r\n return result;\r\n }.bind(this);\r\n\r\n this.drawDateHtmlShort = function () {\r\n var dates = this.drawDates();\r\n var firstDate = dates[0];\r\n var lastDate = dates[dates.length - 1];\r\n\r\n // if there's more than one date, output the range. otherwise output the first date.\r\n if (dates.length > 1) {\r\n return firstDate.draw.getDate() + '/' + (firstDate.draw.getMonth() + 1) + ' - ' + lastDate.draw.getDate() + '/' + (lastDate.draw.getMonth() + 1) + ' ' + lastDate.draw.getFullYear();\r\n } else {\r\n return firstDate.draw.getDate() + '/' + (firstDate.draw.getMonth() + 1) + ' ' + firstDate.draw.getFullYear();\r\n }\r\n }.bind(this);\r\n\r\n this.drawDates = () => {\r\n var drawDates = [];\r\n var draws = this.numberOfDraws();\r\n var drawsFromLottoInfo = this.infoFeed().data().draws;\r\n var firstDraw = null;\r\n if (this.firstDrawNo()) {\r\n firstDraw = LottoInfo.data().lottoSaturday.draws.filter(function (draw) {\r\n return draw.id === this.firstDrawNo();\r\n }.bind(this))[0];\r\n }\r\n var advanceBuy = !!firstDraw;\r\n firstDraw = firstDraw || LottoInfo.data().lottoSaturday.openDraw;\r\n\r\n\r\n if (!firstDraw || !firstDraw.closingTime) {\r\n return drawDates;\r\n }\r\n\r\n if (drawsFromLottoInfo.length > 0) {\r\n var firstDrawIndex = -1;\r\n for (var i = 0; i < drawsFromLottoInfo.length; i++) {\r\n if (drawsFromLottoInfo[i].id === firstDraw.id) {\r\n firstDrawIndex = i;\r\n break;\r\n }\r\n }\r\n var feedDrawDates = drawsFromLottoInfo.slice(firstDrawIndex, firstDrawIndex + draws);\r\n drawDates = feedDrawDates.map(function (draw) {\r\n let hasJoker = this.withJokerSaturday();\r\n if (draw.drawType?.toLowerCase() !== 'regular') {\r\n hasJoker = false;\r\n }\r\n return {\r\n draw: new Date(draw.closingTime),\r\n hasJoker: hasJoker\r\n };\r\n }.bind(this));\r\n } else {\r\n // TODO: check if this way of getting the drawDates is relevant anymore as we can get them directly from the feed\r\n var closingTime = firstDraw.closingTime;\r\n while (draws--) {\r\n var futureDate = new Date(closingTime);\r\n futureDate.setDate(futureDate.getDate() + (draws * 7));\r\n drawDates.push({\r\n draw: futureDate,\r\n hasJoker: this.withJokerSaturday()\r\n });\r\n }\r\n }\r\n\r\n // if joker on wednesdays are added, add their dates.\r\n if (this.withJokerWednesday()\r\n && LottoInfo.data()\r\n && LottoInfo.data().jokerWednesday) {\r\n\r\n if (LottoInfo.data().jokerWednesday.draws && LottoInfo.data().jokerWednesday.draws.length) {\r\n draws = this.numberOfDraws();\r\n LottoInfo.data().jokerWednesday.draws.forEach((draw) => {\r\n if (!!draws && (!advanceBuy || draw.closingTime >= firstDraw.closingTime)) {\r\n let hasJoker = this.withJokerWednesday();\r\n if (draw.drawType?.toLowerCase() !== 'regular') {\r\n hasJoker = false;\r\n }\r\n drawDates.push({\r\n draw: new Date(draw.closingTime),\r\n hasJoker: hasJoker\r\n });\r\n draws--;\r\n }\r\n });\r\n } else if (LottoInfo.data().jokerWednesday.openDraw && LottoInfo.data().jokerWednesday.openDraw) {\r\n // TODO: check if this way of getting the drawDates is relevant anymore as we can get them directly from the feed\r\n var firstWednesdayJoker = new Date(LottoInfo.data().jokerWednesday.openDraw.closingTime);\r\n\r\n draws = this.numberOfDraws();\r\n while (draws--) {\r\n drawDates.push({\r\n draw: new Date(firstWednesdayJoker),\r\n hasJoker: true\r\n });\r\n firstWednesdayJoker.setDate(firstWednesdayJoker.getDate() + 7);\r\n }\r\n }\r\n }\r\n\r\n if (this.upsellExtra() && this.extraDraw()?.closingTime) {\r\n const extraDrawDate = new Date(this.extraDraw().closingTime);\r\n drawDates.push({\r\n draw: extraDrawDate,\r\n hasJoker: false\r\n });\r\n }\r\n\r\n drawDates.sort(function (a, b) {\r\n return a.draw.getTime() - b.draw.getTime();\r\n });\r\n\r\n return drawDates;\r\n };\r\n\r\n this.rawDrawsDataFromInfoFeed = () => {\r\n const drawTimes = this.drawDates().map((draw) => {\r\n return new Date(draw.draw).getTime();\r\n });\r\n\r\n const feedDraws = this.infoFeed().data().draws.filter((feedDraw) => {\r\n const feedDrawTime = new Date(feedDraw.closingTime).getTime();\r\n return drawTimes.includes(feedDrawTime);\r\n });\r\n\r\n return feedDraws;\r\n };\r\n\r\n this.drawDatesWithoutJokerInfo = (numberOfDraws) => {\r\n var drawDates = [];\r\n var openDraw = this.infoFeed().data().openDraw;\r\n var draws = numberOfDraws || this.numberOfDraws();\r\n var drawsFromLottoInfo = this.infoFeed().data().draws;\r\n var firstDraw = this.infoFeed().data().openDraw;\r\n\r\n if (!openDraw || !openDraw.closingTime) {\r\n return drawDates;\r\n }\r\n\r\n if (this.firstDrawNo()) {\r\n firstDraw = LottoInfo.data().lottoSaturday.draws.filter(function (draw) {\r\n return draw.id === this.firstDrawNo();\r\n }.bind(this))[0];\r\n }\r\n\r\n var firstDrawIndex = -1;\r\n\r\n for (var i = 0; i < drawsFromLottoInfo.length; i++) {\r\n if (drawsFromLottoInfo[i].id === firstDraw.id) {\r\n firstDrawIndex = i;\r\n break;\r\n }\r\n }\r\n var feedDrawDates = drawsFromLottoInfo.slice(firstDrawIndex, firstDrawIndex + draws);\r\n drawDates = feedDrawDates.map(function (draw) {\r\n var drawObject = {\r\n draw: new Date(draw.closingTime)\r\n };\r\n\r\n if (draw.campaigns) {\r\n drawObject.campaigns = draw.campaigns;\r\n drawObject.campaignNumbers = draw.campaignNumbers;\r\n drawObject.campaignData = draw.campaignData;\r\n }\r\n if (draw.drawType) drawObject.drawType = draw.drawType;\r\n\r\n return drawObject;\r\n }.bind(this));\r\n\r\n if (this.upsellExtra() && !numberOfDraws && this.extraDraw()?.closingTime) {\r\n const extraDraw = this.extraDraw();\r\n drawDates.push({\r\n draw: new Date(extraDraw.closingTime),\r\n campaigns: extraDraw.campaigns,\r\n campaignNumbers: extraDraw.campaignNumbers,\r\n campaignData: extraDraw.campaignData,\r\n drawType: extraDraw.drawType\r\n });\r\n }\r\n\r\n drawDates.sort(function (a, b) {\r\n return a.draw.getTime() - b.draw.getTime();\r\n });\r\n\r\n return drawDates;\r\n };\r\n\r\n this.jokerDrawDates = function (drawDay) {\r\n if (!(LottoInfo.data()\r\n && LottoInfo.data().jokerSaturday\r\n && LottoInfo.data().jokerWednesday\r\n && LottoInfo.data().jokerSaturday.draws\r\n && LottoInfo.data().jokerWednesday.draws)) return;\r\n\r\n if (this.drawDatesWithoutJokerInfo().length === 0) return [];\r\n\r\n var saturdayDraws = LottoInfo.data().jokerSaturday.draws.map(function (draw) {\r\n draw.dayName = 'saturday';\r\n return draw;\r\n });\r\n var wednesdayDraws = LottoInfo.data().jokerWednesday.draws.map(function (draw) {\r\n draw.dayName = 'wednesday';\r\n return draw;\r\n });\r\n var combinedDraws = saturdayDraws.concat(wednesdayDraws);\r\n combinedDraws.sort(function (a, b) {\r\n return (a.closingTime).localeCompare((b.closingTime));\r\n });\r\n\r\n switch (drawDay) {\r\n case 'saturday':\r\n return saturdayDraws.slice(0, this.numberOfDraws());\r\n case 'wednesday':\r\n return wednesdayDraws.slice(0, this.numberOfDraws());\r\n case 'both':\r\n return combinedDraws.slice(0, (this.numberOfDraws() * 2));\r\n }\r\n }.bind(this);\r\n\r\n this.campaignDrawsCount = function (wantedCampaign) {\r\n return this.rawDrawsDataFromInfoFeed().reduce(function (count, draw) {\r\n if (Array.isArray(wantedCampaign)) {\r\n return draw?.campaignNumbers?.some((campaignNumber) => {\r\n return wantedCampaign.includes(campaignNumber);\r\n }) ? ++count : count;\r\n }\r\n if (typeof wantedCampaign === 'number') {\r\n return draw?.campaignNumbers?.includes(wantedCampaign) ? ++count : count;\r\n }\r\n return draw?.campaigns?.some(function (c) {\r\n return c.indexOf(wantedCampaign) === 0;\r\n }) ? ++count : count;\r\n }, 0);\r\n };\r\n\r\n this.generatedRows = function (value) {\r\n var playType = this.playType();\r\n\r\n // Classic and Lightning:\r\n if (playType === 'Classic') {\r\n if (value) {\r\n console.error('LottoGame: play type Classic does not support setting generatedRows.');\r\n }\r\n\r\n return this.getRows(true);\r\n }\r\n\r\n // Lightning, Lucky and System:\r\n if (playType === 'Lightning' || playType === 'Lucky' || playType === 'System') {\r\n if (typeof value !== 'undefined') {\r\n this._generatedRows(value);\r\n }\r\n\r\n return this._generatedRows();\r\n }\r\n }.bind(this);\r\n\r\n this.generatedJokerRows = function (type, value) {\r\n if (value) {\r\n this['_generatedJokerRows' + type](value);\r\n }\r\n\r\n return this['_generatedJokerRows' + type]();\r\n }.bind(this);\r\n\r\n this.checkGeneratedConsistency = function () {\r\n var playType = this.playType();\r\n\r\n // Classic and Lightning:\r\n if (playType === 'Classic' || playType === 'Lightning') {\r\n return true;\r\n }\r\n\r\n // Lucky:\r\n if (playType === 'Lucky') {\r\n return this.generatedRows().length == this.rowsToGenerate();\r\n }\r\n\r\n // System: TODO: check that amount of generated rows corresponds to the chosen system:\r\n if (playType === 'System') {\r\n return this.generatedRows().length == this.getSystemRowAmount();\r\n }\r\n }.bind(this);\r\n\r\n this.getRowsSummary = function (useGenerated) {\r\n useGenerated = typeof useGenerated === 'undefined' ? true : useGenerated;\r\n\r\n var summary = [];\r\n var rows = useGenerated ? this.generatedRows() : this.getRows(true);\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n var row = rows[i].numbers.map(function (numbers) { return numbers.number; });\r\n\r\n summary.push(row);\r\n }\r\n\r\n return summary;\r\n }.bind(this);\r\n\r\n this.getJokerRowsSummary = function (type) {\r\n var summary = [];\r\n var rows = this['_generatedJokerRows' + type]();\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n var row = rows[i].numbers.map(function (numbers) { return numbers.number; });\r\n\r\n summary.push({ numbers: row });\r\n }\r\n\r\n return summary;\r\n }.bind(this);\r\n\r\n this.getRowAmount = function () {\r\n var playType = this.playType();\r\n\r\n if (['Lucky', 'Lightning'].includes(playType)) {\r\n return this.rowsToGenerate();\r\n }\r\n\r\n if (playType === 'System') {\r\n return this.getSystemRowAmount();\r\n }\r\n\r\n // Classic:\r\n return this.getRows(true).length;\r\n }.bind(this);\r\n\r\n this.rowPrice = function (rowIndex) {\r\n var data = this.infoFeed().data();\r\n var rowPrice = rowIndex !== undefined && data.draws && data.draws[rowIndex] && data.draws[rowIndex].rowPrice ? data.draws[rowIndex].rowPrice : 0;\r\n\r\n return rowPrice;\r\n };\r\n\r\n this.extraDraw = () => {\r\n return this.infoFeed().data()?.draws?.find((draw) => draw.drawType?.toLowerCase() === 'extra');\r\n };\r\n this.gameExtraDraws = () => {\r\n return this.drawDatesWithoutJokerInfo().filter((draw) => draw.drawType?.toLowerCase() === 'extra');\r\n };\r\n\r\n this.extraDrawPrice = () => {\r\n return this.extraDraw()?.rowPrice || 0;\r\n };\r\n\r\n this.totalRowsPricePerDraw = function (drawIndex) {\r\n var rowAmount = this.getRowAmount();\r\n var price = 0;\r\n\r\n if (drawIndex !== undefined) {\r\n return this.rowPrice(drawIndex) * rowAmount;\r\n }\r\n\r\n for (var i = 0; i < this.numberOfDraws() ; i++) {\r\n price += rowAmount * this.rowPrice(i);\r\n }\r\n\r\n if (this.upsellExtra()) {\r\n price += rowAmount * this.extraDrawPrice();\r\n }\r\n\r\n return price;\r\n }.bind(this);\r\n\r\n this.totalPrice = function () { // Required by Purchase bar\r\n\r\n // Calculate total price:\r\n return this.totalJokerPrice() + this.totalRowsPricePerDraw();\r\n }.bind(this);\r\n\r\n this.jokerPrice = function () {\r\n return this.infoFeed().getJokerPrice() * 2;\r\n }.bind(this);\r\n\r\n this.totalJokerPrice = () => {\r\n let numberOfDraws = this.numberOfDraws();\r\n if (this.gameExtraDraws().length > 0 && !this.upsellExtra()) {\r\n numberOfDraws = numberOfDraws - this.gameExtraDraws().length;\r\n }\r\n return this.getJokerCount() * this.stakePerJoker() * (numberOfDraws || 1);\r\n };\r\n\r\n this.getJokerCount = function () {\r\n return (this.withJokerSaturday() ? 2 : 0) + (this.withJokerWednesday() ? 2 : 0);\r\n }.bind(this);\r\n\r\n this.isNumberOfDrawsExceed = function () {\r\n return this.numberOfDraws() > this.infoFeed().data().draws.length;\r\n }.bind(this);\r\n\r\n this.isGameValid = function () { // Required by PurchaseBar\r\n var playType = this.playType();\r\n\r\n // Not valid, if numberOfDraws is higher than known upcoming draws in the feed:\r\n if (this.isNumberOfDrawsExceed()) {\r\n return false;\r\n }\r\n\r\n // System:\r\n if (playType === 'System') {\r\n return (this.systemName() && this.getSystemNumberAmount() == this.getRow(1).numbers.length);\r\n }\r\n\r\n // Lucky, Classic:\r\n if (playType === 'Lucky' || playType === 'Classic') {\r\n return this.getRows(true).length > 0 && (this.totalPrice() > 0 || this.numberOfDraws() === 0);\r\n }\r\n\r\n // Lightning:\r\n return this.totalPrice() > 0 || this.numberOfDraws() === 0;\r\n }.bind(this);\r\n\r\n this.isRowValid = function (rowNumber) {\r\n return this.getRow(rowNumber).numbers.length === this.numbersPerRowMax();\r\n }.bind(this);\r\n\r\n this.isSubscriptionValid = function () {\r\n if (this.playType() === 'System') {\r\n // TODO - CR: System - ingen systemer, der overstiger 2.000 kr. (Kasper har listen, hvis det er)\r\n return true;\r\n }\r\n\r\n // Classic, Lykke, Lyn - mindst 10 rækker\r\n return this.getRowAmount() >= 10;\r\n }.bind(this);\r\n\r\n\r\n // System helpers:\r\n this.getSystemNumberAmount = function () {\r\n return this.systemName() ? this.systemName().split(' ')[1].split('-')[0] : 0;\r\n }.bind(this);\r\n\r\n this.getSystemRowAmount = function () {\r\n return this.systemName() ? this.systemName().split(' ')[1].split('-')[1] : 0;\r\n }.bind(this);\r\n\r\n this.trackPurchase = function () {\r\n var self = this;\r\n\r\n if (!self.purchaseTracked() && self.status() === 'completed') {\r\n window.DSAPI && DSAPI.ready(function () {\r\n self.purchaseTracked(true);\r\n });\r\n\r\n this.trackingPurchaseComplete();\r\n }\r\n }.bind(this);\r\n\r\n this.confirmUrl = function () {\r\n var feed = this.infoFeed();\r\n var data = feed ? feed.data() : null;\r\n\r\n if (data && data.confirmUrl) {\r\n return data.confirmUrl + '?gameInstanceId=' + this.id();\r\n }\r\n\r\n console.error('LottoGame: unable to return confirmUrl, feed is not loaded.');\r\n }.bind(this);\r\n\r\n this.receiptUrl = function () {\r\n var feed = this.infoFeed();\r\n var data = feed ? feed.data() : null;\r\n\r\n if (data && data.receiptUrl) {\r\n return data.receiptUrl + '?gameInstanceId=' + this.id();\r\n }\r\n\r\n console.error('LottoGame: unable to return receiptUrl, feed is not loaded.');\r\n }.bind(this);\r\n\r\n this.cancelUrl = function () {\r\n if (this.rebuyCouponId()) {\r\n // This is called when going from confirm page, back to completed games overview page.\r\n return this.startUrl();\r\n }\r\n\r\n if (this.clientContext() === 'multiClient') {\r\n var multiClientPath = window.location.href.split('#/');\r\n return this.startUrl() + '?gameInstanceId=' + this.id() + '#/' + multiClientPath;\r\n }\r\n\r\n // This is called when going from confirm page, back to game.\r\n return this.startUrl() + '?gameInstanceId=' + this.id();\r\n }.bind(this);\r\n\r\n this.copyFromOldCoupon = function () {\r\n var self = this;\r\n\r\n this.api().getCoupon(this.rebuyCouponId()).then(function (data) {\r\n const extraDraw = data.multiWagers?.find((wager) => wager.drawType?.toLowerCase() === 'extra');\r\n self.numberOfDraws(!data.multiWagers ? 1 : data.multiWagers.length);\r\n self.playType(data.playType);\r\n self.systemName(data.systemName);\r\n self.rowPriceChanged(data.rowPriceChanged);\r\n if (extraDraw) {\r\n self.originalExtraDraw(extraDraw);\r\n }\r\n self.reducedWeeks(data.rebuyDrawRepeatMax && data.rebuyDrawRepeatMax < self.numberOfDraws());\r\n if (!data.rebuyDrawRepeatMax && extraDraw) {\r\n self.reducedWeeks(true);\r\n }\r\n\r\n if (data.multiWagers?.length > 1) {\r\n self.firstWagerPrice(data.multiWagers[0].price);\r\n }\r\n\r\n if (self.rowPriceChanged()) {\r\n self.originalPrice((data.price * self.numberOfDraws()) + self.totalJokerPrice());\r\n }\r\n\r\n if (self.reducedWeeks()) {\r\n self.originalPrice((data.price * self.numberOfDraws()) + self.totalJokerPrice());\r\n self.originalNumberOfDraws(self.numberOfDraws());\r\n self.numberOfDraws(extraDraw ? self.numberOfDraws() - 1 : data.rebuyDrawRepeatMax);\r\n }\r\n\r\n var promises = [];\r\n\r\n // If systemName is defined, set playType to System, otherwise Classic:\r\n if (!self.playType() || self.playType().toLowerCase() === 'unknown') {\r\n self.playType(self.systemName() ? 'System' : 'Classic');\r\n }\r\n\r\n data.games.forEach(function (game) {\r\n var gameType = /wednesday/.test(game.gameType.toLowerCase()) ? 'wednesday' : 'saturday';\r\n var rows = [];\r\n var rowNumbers = [];\r\n\r\n // Lotto:\r\n if (game.gameType.substring(0, 5) === 'Lotto') {\r\n\r\n // Classic:\r\n if (self.playType() === 'Classic') {\r\n game.rows.forEach(function (row, index) {\r\n rowNumbers = { count: index, numbers: [], state: 'clean' };\r\n\r\n row.numbers.forEach(function (number) {\r\n rowNumbers.numbers.push({ autogenerated: false, number: number.number });\r\n });\r\n\r\n self.rows().push(rowNumbers);\r\n });\r\n\r\n // System:\r\n } else if (self.playType() === 'System') {\r\n rowNumbers = { count: 0, numbers: [], state: 'clean' };\r\n\r\n game.systemNumbers.numbers.forEach(function (number) {\r\n rowNumbers.numbers.push({ autogenerated: false, number: number.number });\r\n });\r\n\r\n self.rows().push(rowNumbers);\r\n\r\n promises.push(self.gameGenerateRows());\r\n\r\n // Lightning and Lucky:\r\n } else if (self.playType() === 'Lucky' || self.playType() === 'Lightning') {\r\n game.rows.forEach(function (row, index) {\r\n rowNumbers = { count: index, numbers: [], state: 'clean' };\r\n\r\n row.numbers.forEach(function (number) {\r\n rowNumbers.numbers.push({ autogenerated: false, number: number.number });\r\n });\r\n\r\n rows.push(rowNumbers);\r\n });\r\n\r\n self.generatedRows(rows);\r\n self.rowsToGenerate(rows.length);\r\n }\r\n\r\n // Joker:\r\n } else {\r\n rows = [];\r\n\r\n if (gameType === 'wednesday') {\r\n self.withJokerWednesday(true);\r\n } else {\r\n self.withJokerSaturday(true);\r\n }\r\n\r\n game.rows.forEach(function (row, index) {\r\n var rowNumbers = { count: index, numbers: [], state: 'clean' };\r\n\r\n row.numbers.forEach(function (number) {\r\n rowNumbers.numbers.push({ autogenerated: false, number: number.number });\r\n });\r\n\r\n rows.push(rowNumbers);\r\n });\r\n\r\n self.generatedJokerRows(gameType.charAt(0).toUpperCase() + gameType.slice(1), rows);\r\n }\r\n });\r\n\r\n m.sync(promises).then(function () {\r\n self.save();\r\n\r\n self.ready().resolve();\r\n });\r\n }, function () {\r\n\r\n self.ready().reject('coupon-not-found');\r\n });\r\n }.bind(this);\r\n\r\n this.sendToSubscription = function () {\r\n // Tracking for DataLayer\r\n this.trackingAddToCart('plus');\r\n\r\n const link = this.linkToPlusPurchase?.();\r\n\r\n if (link) {\r\n const linkArr = link.split('?');\r\n if (!(linkArr.includes('plus') || linkArr.includes('jackpot'))) linkArr.push('plus');\r\n linkArr.push('mcGameType=lotto');\r\n linkArr.push('mcGameId=' + this.id());\r\n location.href = linkArr.shift() + '?' + linkArr.join('&');\r\n } else {\r\n location.href = '/plus-abonnement/se-kurv?plus&mcGameType=lotto&mcGameId=' + this.id();\r\n }\r\n }.bind(this);\r\n\r\n this.toJSON = function () {\r\n return {\r\n _generatedRows: this._generatedRows(),\r\n _generatedJokerRowsSaturday: this._generatedJokerRowsSaturday(),\r\n _generatedJokerRowsWednesday: this._generatedJokerRowsWednesday(),\r\n gameType: this.gameType(),\r\n id: this.id(),\r\n numberOfDraws: this.numberOfDraws(),\r\n firstDrawNo: this.firstDrawNo(),\r\n firstWagerPrice: this.firstWagerPrice(),\r\n upsellExtra: this.upsellExtra(),\r\n playType: this.playType(),\r\n purchaseTracked: this.purchaseTracked(),\r\n rows: this.rows(),\r\n rowsToGenerate: this.rowsToGenerate(),\r\n startUrl: this.startUrl(),\r\n state: this.state(),\r\n status: this.status(),\r\n systemName: this.systemName(),\r\n timestamp: this.timestamp(),\r\n withJokerSaturday: this.withJokerSaturday(),\r\n withJokerWednesday: this.withJokerWednesday(),\r\n couponId: this.couponId(),\r\n rebuyCouponId: this.rebuyCouponId(),\r\n extraCouponId: this.extraCouponId(),\r\n isProductDetailsTracked: this.isProductDetailsTracked(),\r\n isAddToCartTracked: this.isAddToCartTracked(),\r\n isPurchaseCompleteTracked: this.isPurchaseCompleteTracked(),\r\n firstDepositInfo: this.firstDepositInfo(),\r\n plusSubscriptionJackpot: this.plusSubscriptionJackpot(),\r\n playTogetherDepositType: this.playTogetherDepositType(),\r\n trackedInteractionCreationAction: this.trackedInteractionCreationAction(),\r\n drawDays: this.drawDays(),\r\n };\r\n }.bind(this);\r\n\r\n // Init:\r\n this.init = function () {\r\n\r\n // Rebuy coupon:\r\n if (this.rebuyCouponId() && this.state() === 'new') {\r\n this.copyFromOldCoupon();\r\n\r\n // Regular coupon:\r\n } else {\r\n if (this.state() === 'new') {\r\n this.addRow();\r\n this.addRow();\r\n\r\n if (this.playType() === 'Lucky') {\r\n this.rowsToGenerate(this.rowsToGenerate() || this.infoFeed().getLuckyDefaultRowCount());\r\n }\r\n }\r\n\r\n this.ready().resolve();\r\n }\r\n\r\n }.bind(this);\r\n\r\n });\r\n\r\n LottoGame.setupGame = function (options) {\r\n var game = undefined;\r\n\r\n if (options.savedCoupon) {\r\n return LottoGame.construct(JSON.parse(options.savedCoupon), 'new');\r\n }\r\n\r\n if (options.gameInstanceId) {\r\n game = LottoGame.get(options.gameInstanceId);\r\n\r\n if (!game || game.status() === 'completed' || (options.playType && game.playType() !== options.playType)) {\r\n game = undefined;\r\n }\r\n }\r\n\r\n if (!game) {\r\n game = LottoGame.construct(options, options.state || 'new');\r\n }\r\n\r\n if (options.linkToPlusPurchase && !game.linkToPlusPurchase) {\r\n game.linkToPlusPurchase = m.prop(options.linkToPlusPurchase);\r\n }\r\n\r\n return game;\r\n };\r\n\r\n // Public functions:\r\n return LottoGame;\r\n\r\n });\r\n"],"mappings":";;;;;;;AAAAA,QAAQ,CAAC,kDAAkD,EACzD,CACE,+CAA+C,EAC/C,6CAA6C,EAC7C,0DAA0D,EAC1D,2DAA2D,EAC3D,mDAAmD,EACnD,oDAAoD,EACpD,4DAA4D,CAC7D,EACD,UAAUC,CAAC,EAAEC,KAAK,EAAEC,gBAAgB,EAAEC,iBAAiB,EAAEC,SAAS,EAAEC,UAAU,EAAEC,SAAS,EAAE;EAEzF;EACA,IAAIC,SA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