mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
38 lines
1022 B
JavaScript
38 lines
1022 B
JavaScript
const version = 38
|
|
import clone from 'clone'
|
|
import ABTestController from '../controllers/ab-test'
|
|
import { getRandomArrayItem } from '../lib/util'
|
|
|
|
/**
|
|
* The purpose of this migration is to assign all users to a test group for the fullScreenVsPopup a/b test
|
|
*/
|
|
export default {
|
|
version,
|
|
migrate: async function (originalVersionedData) {
|
|
const versionedData = clone(originalVersionedData)
|
|
versionedData.meta.version = version
|
|
const state = versionedData.data
|
|
versionedData.data = transformState(state)
|
|
return versionedData
|
|
},
|
|
}
|
|
|
|
function transformState (state) {
|
|
const { ABTestController: ABTestControllerState = {} } = state
|
|
const { abTests = {} } = ABTestControllerState
|
|
|
|
if (!abTests.fullScreenVsPopup) {
|
|
state = {
|
|
...state,
|
|
ABTestController: {
|
|
...ABTestControllerState,
|
|
abTests: {
|
|
...abTests,
|
|
fullScreenVsPopup: getRandomArrayItem(ABTestController.abTestGroupNames.fullScreenVsPopup),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
return state
|
|
}
|