{"version":3,"file":"VikingLottoGame.js","names":["defineDs","m","Model","VikingLottoApi","VikingLottoInfo","VikingLottoUtils","DataLayer","VikingLottoGame","content","_this","infoFeed","api","_generatedRows","prop","_generatedJokerRowsSaturday","_generatedJokerRowsWednesday","couponId","numberOfDraws","getDrawRepeatDefault","playType","purchaseTracked","ready","deferred","rebuyCouponId","rows","rowsToGenerate","startUrl","window","location","href","split","status","systemName","withJokerSaturday","withJokerWednesday","isProductDetailsTracked","isAddToCartTracked","isPurchaseCompleteTracked","verticalType","plusSubscriptionJackpot","firstDepositInfo","playTogetherDepositType","rowPriceChanged","originalNumberOfDraws","originalPrice","reducedWeeks","clientContext","trackedInteractionCreationAction","classicMaxRows","numberOfDrawsOptions","getDrawRepeatOptions","getDrawRepeatMax","numbersIntervalMax","stakePerJoker","getJokerPrice","version","getOpenDraw","gameVersionNo","vikingNumbersIntervalMax","vikingNumbersPerRowMax","drawDays","vikingNumbersPerRowMin","bind","numbersPerRowMin","numbersPerRow","numbersPerRowMax","totalNumbersPerRowMax","type","getSystemNumberAmount","rowCount","count","amount","length","i","row","sortRow","numbers","sort","a","b","number","addNumber","autogenerated","getRow","push","save","removeNumber","index","splice","addVikingNumber","vikingNumber","removeVikingNumber","addRow","state","removeRow","removeAllRows","resetRow","rowNumber","setRow","autogenerateNumbers","self","options","requiredNumbers","requiredVikingNumber","system","getRandomNumbers","then","manualSelectedNumbers","filter","generatedNumbers","generatedVikingNumber","generated","indexOf","resolve","reject","promise","areAllRowsValid","every","isRowValid","autofillClassicRows","_asyncToGenerator","promises","emptyRows","_row$vikingNumber","fullyGeneratedRows","emptyRow","j","Promise","all","gameGenerateRows","console","error","generatedRows","selectedNumbers","getSystemKeys","systemKeys","map","join","gameGenerateJokerRows","getRandomJokerNumbers","generatedJokerRows","value","setNumberOfDraws","draws","purchase","params","proceed","drawId","errorMessage","getRowsSummary","totalPrice","parseInt","multidraw","salesChannel","isMobile","isTabletDevice","notifyPrizeEmail","notifyPrizeSms","jokerSaturdayRows","getJokerRowsSummary","jokerWednesdayRows","request","createCoupon","data","prepareConfirm","confirmUrl","sync","createDataLayerJoker","day","subscription","joker","name","price","rowPrice","brand","category","categoryName","variant","variantName","quantity","coupon","createDataLayerProduct","event","dataLayerProducts","product","getRowAmount","trackingAddToCart","addToCart","warn","trackingProductDetails","productDetail","trackingPurchaseComplete","purchaseCompleted","toString","id","fallbackFakeCouponId","Math","random","slice","checkOnlyMaxLimit","arguments","undefined","totalNumbers","getRows","valid","hasNumber","hasVikingNumber","rowVikingNumber","drawDateHtml","delimiter","openDraw","closingTime","date","Date","result","formatISO8601","toISOString","includeTime","setDate","getDate","drawDateHtmlShort","dates","drawDates","firstDate","lastDate","draw","getMonth","getFullYear","futureDate","hasJoker","jokerData","jokerSaturday","firstSaturdayJoker","getTime","rawDrawsDataFromInfoFeed","drawTimes","feedDraw","drawDatesWithoutJokerInfo","drawsFromVikingLottoInfo","firstDraw","firstDrawIndex","feedDrawDates","drawObject","campaigns","campaignNumbers","jokerDrawDates","drawDay","jokerWednesday","saturdayDraws","dayName","wednesdayDraws","combinedDraws","concat","localeCompare","campaignDrawsCount","wantedCampaign","reduce","_draw$campaigns","Array","isArray","_draw$campaignNumbers","some","campaignNumber","includes","_draw$campaignNumbers2","c","checkGeneratedConsistency","useGenerated","summary","getSystemRowAmount","rowIndex","totalRowsPricePerDraw","drawIndex","rowAmount","totalJokerPrice","jokerPrice","getJokerCount","isNumberOfDrawsExceed","isGameValid","hasValidRows","isSubscriptionValid","trackPurchase","DSAPI","receiptUrl","cancelUrl","multiClientPath","copyFromOldCoupon","getCoupon","multiWagers","rebuyDrawRepeatMax","toLowerCase","games","forEach","game","rowNumbers","gameType","extraNumbers","systemNumbers","test","charAt","toUpperCase","sendToSubscription","_this$linkToPlusPurch","link","linkToPlusPurchase","call","linkArr","shift","toJSON","init","getLuckyDefaultRowCount","setupGame","gameInstanceId","get","construct"],"sources":["DanskeSpil/Domain/VikingLotto/Scripts/Models/VikingLottoGame.js"],"sourcesContent":["defineDs('DanskeSpil/Domain/VikingLotto/Scripts/Models/VikingLottoGame',\r\n [\r\n 'Shared/Framework/Mithril/Scripts/Core/Mithril',\r\n 'Shared/Framework/Mithril/Scripts/Core/Model',\r\n 'DanskeSpil/Domain/VikingLotto/Scripts/Helpers/VikingLottoApi',\r\n 'DanskeSpil/Domain/VikingLotto/Scripts/Helpers/VikingLottoInfo',\r\n 'DanskeSpil/Domain/VikingLotto/Scripts/Helpers/VikingLottoUtils',\r\n 'DanskeSpil/Framework/NumberGames/Scripts/Helpers/DataLayer'\r\n ],\r\n function (m, Model, VikingLottoApi, VikingLottoInfo, VikingLottoUtils, DataLayer) {\r\n\r\n // Model:\r\n var VikingLottoGame = Model('VikingLottoGame', function (content) {\r\n this.infoFeed = () => {\r\n return VikingLottoInfo;\r\n };\r\n this.api = () => {\r\n return VikingLottoApi;\r\n };\r\n\r\n // Data:\r\n this._generatedRows = m.prop(content._generatedRows || []);\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.numberOfDraws = m.prop(typeof content.numberOfDraws !== 'undefined' ? content.numberOfDraws : VikingLottoInfo.getDrawRepeatDefault()); // NEED TO USE TYPEOF UNDEFINED CHECK HERE, BECAUSE 0 IS A VALID OPTION\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);\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 7-7' : null));\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.verticalType = m.prop(content.verticalType);\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.reducedWeeks = m.prop(false);\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(VikingLottoInfo.getDrawRepeatOptions());\r\n this.getDrawRepeatMax = m.prop(VikingLottoInfo.getDrawRepeatMax());\r\n this.numbersIntervalMax = m.prop(48);\r\n this.stakePerJoker = m.prop(VikingLottoInfo.getJokerPrice());\r\n this.version = m.prop((VikingLottoInfo.getOpenDraw() && VikingLottoInfo.getOpenDraw().gameVersionNo) || 1);\r\n this.vikingNumbersIntervalMax = m.prop(this.version() === 1 ? 8 : 5);\r\n this.vikingNumbersPerRowMax = m.prop(1);\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, true, false, false, false, false]);\r\n\r\n // Functions:\r\n this.vikingNumbersPerRowMin = function () {\r\n return this.playType() === 'Lucky' ? 0 : 1;\r\n }.bind(this);\r\n\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.totalNumbersPerRowMax = function () {\r\n if (this.playType() === 'Lucky') {\r\n return 6;\r\n }\r\n\r\n return this.numbersPerRowMax() + this.vikingNumbersPerRowMax();\r\n }.bind(this);\r\n\r\n this.numbersPerRow = function (type) {\r\n var playType = this.playType();\r\n\r\n // System:\r\n if (playType === 'System') {\r\n return this.getSystemNumberAmount();\r\n }\r\n\r\n // Lucky:\r\n if (playType === 'Lucky') {\r\n return type === 'min' ? 0 : 6;\r\n }\r\n\r\n // Classic:\r\n return 6;\r\n\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.addVikingNumber = function (row, vikingNumber, autogenerated) {\r\n row = this.getRow(row);\r\n\r\n if (row.vikingNumber) {\r\n return;\r\n }\r\n\r\n row.vikingNumber = { number: vikingNumber, autogenerated: autogenerated || false };\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n this.removeVikingNumber = function (row) {\r\n row = this.getRow(row);\r\n\r\n row.vikingNumber = null;\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', vikingNumber: null });\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 // We need double rows, as we're practically resetting the rows to original state\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.vikingNumber = null;\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\r\n rows[row - 1] = content;\r\n\r\n this.rows(rows);\r\n\r\n this.save();\r\n }.bind(this);\r\n\r\n // Viking Lotto Classic and Viking Lotto System: generate numbers for a specific row:\r\n this.autogenerateNumbers = function (rowNumber) {\r\n var self = this;\r\n var deferred = m.deferred();\r\n var numbers = [];\r\n var row = this.getRow(rowNumber);\r\n var vikingNumber = row.vikingNumber;\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: this.playType(), requiredNumbers: numbers };\r\n\r\n if (vikingNumber && !vikingNumber.autogenerated) {\r\n options.requiredVikingNumber = vikingNumber.number;\r\n }\r\n\r\n if (this.playType() === 'System') {\r\n options.system = this.systemName();\r\n }\r\n\r\n VikingLottoApi.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 if (vikingNumber && vikingNumber.autogenerated) {\r\n row.vikingNumber = null;\r\n }\r\n self.setRow(rowNumber, row);\r\n\r\n var generatedNumbers = rows.numbers;\r\n var generatedVikingNumber = rows.vikingNumber;\r\n\r\n for (var i = 0; i < generatedNumbers.length; i++) {\r\n var generated = generatedNumbers[i];\r\n\r\n if (numbers.indexOf(generated) === -1) {\r\n self.addNumber(rowNumber, generated, true);\r\n }\r\n }\r\n\r\n if (generatedVikingNumber) {\r\n self.addVikingNumber(rowNumber, generatedVikingNumber, true);\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.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 || row.vikingNumber?.number) {\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((rows) => {\r\n for (let i = 0; i < rows.length; i++) {\r\n const row = rows[i];\r\n const emptyRow = emptyRows[i];\r\n this.addVikingNumber(emptyRow.count + 1, row.vikingNumber, true);\r\n for (let j = 0; j < row.numbers.length; j++) {\r\n this.addNumber(emptyRow.count + 1, row.numbers[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 // Viking Lotto Lightning, Viking Lotto Lucky and Viking Lotto 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('VikingLottoGame 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 var generatedRows = [];\r\n var selectedNumbers = this.getRow(1).numbers;\r\n var vikingNumber = this.getRow(1).vikingNumber;\r\n\r\n VikingLottoApi.getSystemKeys(this.systemName()).then(function (systemKeys) {\r\n if (systemKeys) {\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\r\n return { number: selectedNumbers[index - 1].number, autogenerated: true };\r\n });\r\n\r\n return { count: i, numbers: numbers, vikingNumber: vikingNumber ? vikingNumber.number : null, state: 'clean' };\r\n });\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 });\r\n } else {\r\n\r\n // Lightning and Lucky:\r\n var options = { rowsToGenerate: this.rowsToGenerate() };\r\n var requiredNumbers = [];\r\n var requiredVikingNumber = null;\r\n var row = this.getRow(1);\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 if (row && row.vikingNumber) {\r\n requiredVikingNumber = row.vikingNumber.number;\r\n }\r\n\r\n if (this.playType() === 'Lucky') {\r\n options.requiredNumbers = requiredNumbers.join(',');\r\n options.requiredVikingNumber = requiredVikingNumber;\r\n }\r\n\r\n VikingLottoApi.getRandomNumbers(options).then(function (rows) {\r\n var generatedRows = [];\r\n\r\n for (var i = 0; i < rows.length; i++) {\r\n row = rows[i];\r\n\r\n var numbers = row.numbers.map(function (number) {\r\n return { number: number, autogenerated: true };\r\n });\r\n var vikingNumber = { number: row.vikingNumber, autogenerated: true };\r\n\r\n generatedRows.push({ count: i, numbers: numbers, state: 'clean', vikingNumber: vikingNumber });\r\n }\r\n\r\n // Store generated rows to our object\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 }).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 deferred = m.deferred();\r\n var self = this;\r\n\r\n VikingLottoApi.getRandomJokerNumbers(type).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) {\r\n return { number: number, autogenerated: true };\r\n });\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 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 // Functions for number of draws:\r\n this.setNumberOfDraws = function (draws) {\r\n this.numberOfDraws(draws);\r\n\r\n this.save();\r\n }.bind(this);\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\r\n var options = {\r\n drawId: params.drawId,\r\n totalPrice: parseInt(self.totalPrice(), 10),\r\n multidraw: parseInt(self.numberOfDraws(), 10),\r\n playType: this.playType() || null,\r\n rows: rows,\r\n salesChannel: (VikingLottoUtils.isMobile() || VikingLottoUtils.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 = VikingLottoApi.createCoupon(options);\r\n\r\n request.then(function (data) {\r\n self.status('completed');\r\n self.couponId(data.couponId);\r\n\r\n self.save();\r\n\r\n deferred.resolve(data);\r\n }, function (data) {\r\n self.status('open');\r\n\r\n self.save();\r\n\r\n deferred.reject(data);\r\n });\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 status = this.status();\r\n\r\n if (status !== 'processing') {\r\n var promises = this.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\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 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\r\n // Product array for datalayer\r\n var dataLayerProducts = [];\r\n // Main product\r\n var product = {};\r\n var subscription = type === 'plus';\r\n\r\n if (type === 'plus') {\r\n // subscription product (PLUS abodoment)\r\n product.name = 'plus';\r\n product.price = DataLayer.rowPrice(VikingLottoInfo.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_viking', this.numberOfDraws(), this.playType(), this.systemName());\r\n product.quantity = this.getRowAmount();\r\n } else {\r\n product.name = 'vikinglotto';\r\n product.price = DataLayer.rowPrice(VikingLottoInfo.data(), this.numberOfDraws());\r\n product.brand = 'dlo_vik';\r\n product.category = DataLayer.categoryName(this.playType());\r\n product.variant = DataLayer.variantName('viking', 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 dataLayerProducts.push(product);\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()) {\r\n this.isAddToCartTracked(true);\r\n\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-VIK-' + 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.isRowValid = function (rowNumber, { checkOnlyMaxLimit = false } = {}) {\r\n var playType = this.playType();\r\n var row = this.getRow(rowNumber) || {};\r\n\r\n // Lucky:\r\n if (playType === 'Lucky') {\r\n var totalNumbers = (row.numbers.length || 0) + (row.vikingNumber ? 1 : 0);\r\n\r\n if (checkOnlyMaxLimit) {\r\n return totalNumbers === 6;\r\n }\r\n return totalNumbers >= 1 && totalNumbers <= 6;\r\n }\r\n\r\n // System:\r\n if (playType === 'System') {\r\n return row.numbers.length === this.getSystemNumberAmount() && row.vikingNumber;\r\n }\r\n\r\n // All other play types:\r\n return row.numbers.length >= this.numbersPerRowMin() && row.numbers.length <= this.numbersPerRowMax() && row.vikingNumber;\r\n }.bind(this);\r\n\r\n this.getRows = function (valid) {\r\n var self = this;\r\n\r\n return this.rows().filter(function (row, index) {\r\n if (row.state === 'remove') {\r\n return false;\r\n }\r\n\r\n return !valid || self.isRowValid(index + 1);\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.hasVikingNumber = function (row, vikingNumber) {\r\n var rowVikingNumber = this.getRow(row).vikingNumber;\r\n\r\n return rowVikingNumber && rowVikingNumber.number === vikingNumber;\r\n }.bind(this);\r\n\r\n this.drawDateHtml = function (delimiter) {\r\n delimiter = delimiter || ' - ';\r\n\r\n var openDraw = VikingLottoInfo.data().openDraw;\r\n if (!openDraw || !openDraw.closingTime) {\r\n return '';\r\n }\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 = VikingLottoUtils.formatISO8601(date.toISOString(), { includeTime: false });\r\n\r\n if (draws > 1) {\r\n date.setDate(date.getDate() + ((draws - 1) * 7));\r\n\r\n result = '' + result + delimiter + VikingLottoUtils.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 = function () {\r\n var drawDates = [];\r\n var openDraw = VikingLottoInfo.data().openDraw;\r\n var draws = this.numberOfDraws();\r\n\r\n if (!openDraw || !openDraw.closingTime) {\r\n return drawDates;\r\n }\r\n\r\n var closingTime = openDraw.closingTime;\r\n\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.withJokerWednesday()\r\n });\r\n }\r\n\r\n // if joker on saturdays are added, add their dates.\r\n if (this.withJokerSaturday()\r\n && VikingLottoInfo.jokerData()\r\n && VikingLottoInfo.jokerData().jokerSaturday\r\n && VikingLottoInfo.jokerData().jokerSaturday.openDraw\r\n && VikingLottoInfo.jokerData().jokerSaturday.openDraw.closingTime) {\r\n\r\n var firstSaturdayJoker = new Date(VikingLottoInfo.jokerData().jokerSaturday.openDraw.closingTime);\r\n\r\n draws = this.numberOfDraws();\r\n while (draws--) {\r\n drawDates.push({\r\n draw: new Date(firstSaturdayJoker),\r\n hasJoker: true\r\n });\r\n firstSaturdayJoker.setDate(firstSaturdayJoker.getDate() + 7);\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 }.bind(this);\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 return VikingLottoInfo.data().draws.filter((feedDraw) => {\r\n return drawTimes.indexOf(new Date(feedDraw.closingTime).getTime()) !== -1;\r\n });\r\n };\r\n\r\n this.drawDatesWithoutJokerInfo = function (numberOfDraws) {\r\n var drawDates = [];\r\n var openDraw = VikingLottoInfo.data().openDraw;\r\n var draws = numberOfDraws || this.numberOfDraws();\r\n var drawsFromVikingLottoInfo = VikingLottoInfo.data().draws;\r\n var firstDraw = VikingLottoInfo.data().openDraw;\r\n\r\n if (!openDraw || !openDraw.closingTime) {\r\n return drawDates;\r\n }\r\n\r\n var firstDrawIndex = -1;\r\n\r\n for (var i = 0; i < drawsFromVikingLottoInfo.length; i++) {\r\n if (drawsFromVikingLottoInfo[i].id === firstDraw.id) {\r\n firstDrawIndex = i;\r\n break;\r\n }\r\n }\r\n var feedDrawDates = drawsFromVikingLottoInfo.slice(firstDrawIndex, firstDrawIndex + draws);\r\n drawDates = feedDrawDates.map(function (draw) {\r\n const 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 }\r\n\r\n return drawObject;\r\n }.bind(this));\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 }.bind(this);\r\n\r\n this.jokerDrawDates = function (drawDay) {\r\n if (!(VikingLottoInfo.jokerData()\r\n && VikingLottoInfo.jokerData().jokerSaturday\r\n && VikingLottoInfo.jokerData().jokerWednesday\r\n && VikingLottoInfo.jokerData().jokerSaturday.draws\r\n && VikingLottoInfo.jokerData().jokerWednesday.draws)) return;\r\n\r\n if (this.drawDatesWithoutJokerInfo().length === 0) return [];\r\n\r\n var saturdayDraws = VikingLottoInfo.jokerData().jokerSaturday.draws.map(function (draw) {\r\n draw.dayName = 'saturday';\r\n return draw;\r\n });\r\n var wednesdayDraws = VikingLottoInfo.jokerData().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 = (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('VikingLottoGame: 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 (value) {\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.checkGeneratedConsistency = function () {\r\n var playType = this.playType();\r\n\r\n if (playType === 'Classic' || playType === 'Lightning') {\r\n return true;\r\n }\r\n\r\n if (playType === 'Lucky') {\r\n return this.generatedRows().length !== this.rowsToGenerate();\r\n }\r\n\r\n if (playType === 'System') {\r\n // TODO: check that amount of generated rows corresponds to the chosen system.\r\n\r\n return true;\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 = {\r\n numbers: rows[i].numbers.map(function (numbers) {\r\n return numbers.number;\r\n }),\r\n vikingNumber: rows[i].vikingNumber ? rows[i].vikingNumber.number : null\r\n };\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) {\r\n return numbers.number;\r\n });\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 (playType === 'Lucky' || playType === 'Lightning') {\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 = VikingLottoInfo.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.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 return price;\r\n }.bind(this);\r\n\r\n this.totalPrice = function () {\r\n return this.totalJokerPrice() + this.totalRowsPricePerDraw();\r\n }.bind(this);\r\n\r\n this.jokerPrice = function () {\r\n return VikingLottoInfo.getJokerPrice() * 2;\r\n }.bind(this);\r\n\r\n this.totalJokerPrice = function () {\r\n return this.getJokerCount() * this.stakePerJoker() * (this.numberOfDraws() || 1);\r\n }.bind(this);\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() > VikingLottoInfo.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 upcomming draws in the feed\r\n if (this.numberOfDraws() > VikingLottoInfo.data().draws.length) {\r\n return false;\r\n }\r\n\r\n // Lightning:\r\n if (playType === 'Lightning') {\r\n return this.totalPrice() > 0 || this.numberOfDraws() === 0;\r\n }\r\n\r\n // Rows:\r\n var hasValidRows = false;\r\n\r\n for (var i = 0; i < this.rows().length; i++) {\r\n if (this.isRowValid(i + 1)) {\r\n hasValidRows = true;\r\n }\r\n }\r\n\r\n if (!hasValidRows) {\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 // Lucky, Classic:\r\n } else if (playType === 'Lucky' || playType === 'Classic') {\r\n return this.getRows(true).length > 0 && (this.totalPrice() > 0 || this.numberOfDraws() === 0);\r\n }\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 // Helpers for Viking Lotto System:\r\n this.getSystemNumberAmount = function () {\r\n return this.systemName() ? parseInt(this.systemName().split(' ')[1].split('-')[0], 10) : 0;\r\n }.bind(this);\r\n\r\n this.getSystemRowAmount = function () {\r\n return this.systemName() ? parseInt(this.systemName().split(' ')[1].split('-')[1], 10) : 0;\r\n }.bind(this);\r\n\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 data = VikingLottoInfo.data();\r\n\r\n if (data && data.confirmUrl) {\r\n return data.confirmUrl + '?gameInstanceId=' + this.id();\r\n }\r\n\r\n console.error('VikingLottoGame: unable to return confirmUrl, feed is not loaded.');\r\n }.bind(this);\r\n\r\n this.receiptUrl = function () {\r\n var data = VikingLottoInfo.data();\r\n\r\n if (data && data.receiptUrl) {\r\n return data.receiptUrl + '?gameInstanceId=' + this.id();\r\n }\r\n\r\n console.error('VikingLottoGame: 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 VikingLottoApi.getCoupon(this.rebuyCouponId()).then(function (data) {\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.reducedWeeks(data.rebuyDrawRepeatMax && data.rebuyDrawRepeatMax < self.numberOfDraws());\r\n self.rowPriceChanged(data.rowPriceChanged);\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(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 rows = [];\r\n var rowNumbers = [];\r\n\r\n // VikingLotto:\r\n if (game.gameType === 'VikingLotto') {\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', vikingNumber: null };\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 if (row.extraNumbers && row.extraNumbers.length === 1) {\r\n rowNumbers.vikingNumber = { number: row.extraNumbers[0].number, autogenerated: false };\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', vikingNumber: null };\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 if (game.systemNumbers && game.systemNumbers.extraNumbers && game.systemNumbers.extraNumbers.length === 1) {\r\n rowNumbers.vikingNumber = { number: game.systemNumbers.extraNumbers[0].number, autogenerated: false };\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', vikingNumber: null };\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 if (row.extraNumbers && row.extraNumbers.length === 1) {\r\n rowNumbers.vikingNumber = { number: row.extraNumbers[0].number, autogenerated: false };\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 var gameType = /wednesday/.test(game.gameType.toLowerCase()) ? 'wednesday' : 'saturday';\r\n\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\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=vikinglotto');\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=vikinglotto&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 couponId: this.couponId(),\r\n id: this.id(),\r\n playType: this.playType(),\r\n purchaseTracked: this.purchaseTracked(),\r\n numberOfDraws: this.numberOfDraws(),\r\n rows: this.rows(),\r\n rowsToGenerate: this.rowsToGenerate(),\r\n state: this.state(),\r\n startUrl: this.startUrl(),\r\n status: this.status(),\r\n systemName: this.systemName(),\r\n withJokerSaturday: this.withJokerSaturday(),\r\n withJokerWednesday: this.withJokerWednesday(),\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() || VikingLottoInfo.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 VikingLottoGame.setupGame = function (options) {\r\n var game = undefined;\r\n\r\n if (options.gameInstanceId) {\r\n game = VikingLottoGame.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 = VikingLottoGame.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 VikingLottoGame;\r\n\r\n });\r\n"],"mappings":";;AAAAA,QAAQ,CAAC,8DAA8D,EACrE,CACE,+CAA+C,EAC/C,6CAA6C,EAC7C,8DAA8D,EAC9D,+DAA+D,EAC/D,gEAAgE,EAChE,4DAA4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