@@ -11,14 +11,11 @@ import { startsWith } from 'lodash';
11
11
/**
12
12
* Internal dependencies
13
13
*/
14
- import { cartItems } from 'lib/cart-values' ;
15
14
import wpcom from 'lib/wp' ;
16
15
const sites = require ( 'lib/sites-list' ) ( ) ;
17
16
const user = require ( 'lib/user' ) ( ) ;
18
17
import { getSavedVariations } from 'lib/abtest' ;
19
18
import SignupCart from 'lib/signup/cart' ;
20
- import { startFreeTrial } from 'lib/upgrades/actions' ;
21
- import { PLAN_PREMIUM } from 'lib/plans/constants' ;
22
19
import analytics from 'lib/analytics' ;
23
20
24
21
import {
@@ -28,7 +25,7 @@ import {
28
25
import { getSiteTitle } from 'state/signup/steps/site-title/selectors' ;
29
26
import { getSurveyVertical , getSurveySiteType } from 'state/signup/steps/survey/selectors' ;
30
27
31
- function createCart ( callback , dependencies , data ) {
28
+ function createCart ( callback , dependencies , data , reduxStore ) {
32
29
const { designType } = dependencies ;
33
30
const { domainItem, themeItem } = data ;
34
31
@@ -43,7 +40,7 @@ function createCart( callback, dependencies, data ) {
43
40
44
41
SignupCart . addToCart ( cartKey , [ domainItem ] , error => callback ( error , providedDependencies ) ) ;
45
42
} else {
46
- createSiteWithCart ( callback , dependencies , data ) ;
43
+ createSiteWithCart ( callback , dependencies , data , reduxStore ) ;
47
44
}
48
45
}
49
46
@@ -55,9 +52,9 @@ function createSiteWithCart( callback, dependencies, {
55
52
siteUrl,
56
53
themeSlugWithRepo,
57
54
themeItem
58
- } ) {
59
- const siteTitle = getSiteTitle ( this . _reduxStore . getState ( ) ) . trim ( ) ;
60
- const surveyVertical = getSurveyVertical ( this . _reduxStore . getState ( ) ) . trim ( ) ;
55
+ } , reduxStore ) {
56
+ const siteTitle = getSiteTitle ( reduxStore . getState ( ) ) . trim ( ) ;
57
+ const surveyVertical = getSurveyVertical ( reduxStore . getState ( ) ) . trim ( ) ;
61
58
62
59
wpcom . undocumented ( ) . sitesNew ( {
63
60
blog_name : siteUrl ,
@@ -109,7 +106,7 @@ function createSiteWithCart( callback, dependencies, {
109
106
if ( ! user . get ( ) && isFreeThemePreselected ) {
110
107
setThemeOnSite ( addToCartAndProceed , { siteSlug, themeSlugWithRepo } ) ;
111
108
} else if ( user . get ( ) && isFreeThemePreselected ) {
112
- fetchSitesAndUser ( siteSlug , setThemeOnSite . bind ( this , addToCartAndProceed , { siteSlug, themeSlugWithRepo } ) ) ;
109
+ fetchSitesAndUser ( siteSlug , setThemeOnSite . bind ( null , addToCartAndProceed , { siteSlug, themeSlugWithRepo } ) ) ;
113
110
} else if ( user . get ( ) ) {
114
111
fetchSitesAndUser ( siteSlug , addToCartAndProceed ) ;
115
112
} else {
@@ -118,25 +115,6 @@ function createSiteWithCart( callback, dependencies, {
118
115
} ) ;
119
116
}
120
117
121
- /**
122
- * Adds a Premium with free trial to the shopping cart.
123
- *
124
- * @param {function } callback - function to execute when action completes
125
- * @param {object } dependencies - data provided to the current step
126
- * @param {object } data - additional data provided by the current step
127
- */
128
- function startFreePremiumTrial ( callback , dependencies , data ) {
129
- const { siteId } = dependencies ;
130
-
131
- startFreeTrial ( siteId , cartItems . planItem ( PLAN_PREMIUM ) , ( error ) => {
132
- if ( error ) {
133
- callback ( error , dependencies ) ;
134
- } else {
135
- callback ( error , dependencies , data ) ;
136
- }
137
- } ) ;
138
- }
139
-
140
118
function fetchSitesUntilSiteAppears ( siteSlug , callback ) {
141
119
if ( sites . select ( siteSlug ) ) {
142
120
callback ( ) ;
@@ -243,16 +221,6 @@ module.exports = {
243
221
244
222
createSiteWithCart,
245
223
246
- createSiteWithCartAndStartFreeTrial ( callback , dependencies , data ) {
247
- createSiteWithCart ( ( error , providedDependencies ) => {
248
- if ( error ) {
249
- callback ( error , providedDependencies ) ;
250
- } else {
251
- startFreePremiumTrial ( callback , providedDependencies , data ) ;
252
- }
253
- } , dependencies , data ) ;
254
- } ,
255
-
256
224
addPlanToCart ( callback , { siteId } , { cartItem, privacyItem } ) {
257
225
if ( isEmpty ( cartItem ) ) {
258
226
// the user selected the free plan
@@ -266,9 +234,9 @@ module.exports = {
266
234
SignupCart . addToCart ( siteId , newCartItems , callback ) ;
267
235
} ,
268
236
269
- createAccount ( callback , dependencies , { userData, flowName, queryArgs } ) {
270
- const surveyVertical = getSurveyVertical ( this . _reduxStore . getState ( ) ) . trim ( ) ;
271
- const surveySiteType = getSurveySiteType ( this . _reduxStore . getState ( ) ) . trim ( ) ;
237
+ createAccount ( callback , dependencies , { userData, flowName, queryArgs } , reduxStore ) {
238
+ const surveyVertical = getSurveyVertical ( reduxStore . getState ( ) ) . trim ( ) ;
239
+ const surveySiteType = getSurveySiteType ( reduxStore . getState ( ) ) . trim ( ) ;
272
240
273
241
wpcom . undocumented ( ) . usersNew ( assign (
274
242
{ } , userData , {
0 commit comments