Commit 573260a8 by Jason Zhou

chore: sync with bobcat

parent ece3f800
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
"fe/js/EcommerceManager.es6", "fe/js/EcommerceManager.es6",
"fe/js/editor.es6", "fe/js/editor.es6",
"fe/js/Landing.es6", "fe/js/Landing.es6",
"fe/js/MainDashboard.es6",
"fe/js/page.client.es6", "fe/js/page.client.es6",
"fe/js/PortfolioManager.es6", "fe/js/PortfolioManager.es6",
"fe/js/stores/font_store.es6", "fe/js/stores/font_store.es6",
......
...@@ -57,6 +57,7 @@ Promise.all([p1]) ...@@ -57,6 +57,7 @@ Promise.all([p1])
const ReactDOM = require('react-dom') const ReactDOM = require('react-dom')
const SupportWidget = require('js/components/support_widget/SupportWidget') const SupportWidget = require('js/components/support_widget/SupportWidget')
const PurchaseBridge = require('../../nextgen/domain/PurchaseBridge') const PurchaseBridge = require('../../nextgen/domain/PurchaseBridge')
.default
const SupportWidgetWithComponentKit = ComponentKitContext(SupportWidget) const SupportWidgetWithComponentKit = ComponentKitContext(SupportWidget)
const PublishManager = require('nextgen/subApps/publishManager') const PublishManager = require('nextgen/subApps/publishManager')
......
...@@ -287,7 +287,7 @@ export default { ...@@ -287,7 +287,7 @@ export default {
const { coupon } = _getCart() const { coupon } = _getCart()
const amount = coupon.option.amount const amount = coupon.option.amount
return (discountItem.orderItem.price * amount) / 100 return discountItem.orderItem.price * amount / 100
} else { } else {
return 0 return 0
} }
...@@ -311,7 +311,7 @@ export default { ...@@ -311,7 +311,7 @@ export default {
case 'percentage': case 'percentage':
number = this.isInCondition('productId') number = this.isInCondition('productId')
? this.getDiscountForProductCondition() ? this.getDiscountForProductCondition()
: (this.getTotalItemPriceNum() * coupon.option.amount) / 100 : this.getTotalItemPriceNum() * coupon.option.amount / 100
if (this.getDecimalNum() === 0) { if (this.getDecimalNum() === 0) {
number = Math.round(number) number = Math.round(number)
...@@ -432,7 +432,7 @@ export default { ...@@ -432,7 +432,7 @@ export default {
return taxesNum return taxesNum
} }
taxesNum = ((itemPrice - discountForTax) * taxesRate) / (1 + taxesRate) taxesNum = (itemPrice - discountForTax) * taxesRate / (1 + taxesRate)
if (this.getDecimalNum() === 0) { if (this.getDecimalNum() === 0) {
taxesNum = Math.round(taxesNum) taxesNum = Math.round(taxesNum)
} }
...@@ -447,14 +447,16 @@ export default { ...@@ -447,14 +447,16 @@ export default {
} else if (this.userHasCouponWithType('percentage', coupon)) { } else if (this.userHasCouponWithType('percentage', coupon)) {
if (this.isInCondition('productId')) { if (this.isInCondition('productId')) {
const item = this.getDiscountItem() const item = this.getDiscountItem()
description = __( if (item) {
'EcommerceCoupon|%{amount} off for %{productCount} %{productName} ', description = __(
{ 'EcommerceCoupon|%{amount} off for %{productCount} %{productName} ',
productCount: options ? options.productCount : 1, {
productName: options ? options.productName : item.product.name, productCount: options ? options.productCount : 1,
amount: `${coupon.option.amount}%`, productName: options ? options.productName : item.product.name,
}, amount: `${coupon.option.amount}%`,
) },
)
}
} else { } else {
description = __('EcommerceCoupon|%{amount} Off', { description = __('EcommerceCoupon|%{amount} Off', {
amount: `${coupon.option.amount}%`, amount: `${coupon.option.amount}%`,
...@@ -860,10 +862,11 @@ export default { ...@@ -860,10 +862,11 @@ export default {
if (!item) { if (!item) {
return false return false
} }
return ( return category.parent_id > -1 && category.level === 2
path(['payload', 'item', 'parent_id'])(category) && // return (
pathEq(['payload', 'item', 'level'], 2)(category) // path(['payload', 'item', 'parent_id'])(category) &&
) // pathEq(['payload', 'item', 'level'], 2)(category)
// )
}, },
sortedCategory(categories, orderList) { sortedCategory(categories, orderList) {
orderList = orderList || {} orderList = orderList || {}
......
...@@ -15,6 +15,11 @@ import * as editorStoreCreator from 'js/reducers/editorStoreCreator' ...@@ -15,6 +15,11 @@ import * as editorStoreCreator from 'js/reducers/editorStoreCreator'
import ComponentKitContext from 'js/utils/ComponentKitContext' import ComponentKitContext from 'js/utils/ComponentKitContext'
import wrapErrorBoundary from 'js/components/ErrorBoundary' import wrapErrorBoundary from 'js/components/ErrorBoundary'
import 'js/reactInit.es6' import 'js/reactInit.es6'
import { initTrackEditor } from 'js/utils/track'
initTrackEditor() // analytics track init
// These two are direct reads so promises can be fired quicker // These two are direct reads so promises can be fired quicker
const supportedVerticals = ['personal'] const supportedVerticals = ['personal']
const themeName = $S.stores.pageMeta.theme.name const themeName = $S.stores.pageMeta.theme.name
......
...@@ -190,6 +190,7 @@ ...@@ -190,6 +190,7 @@
"console-polyfill": "^0.2.1", "console-polyfill": "^0.2.1",
"core-decorators": "^0.20.0", "core-decorators": "^0.20.0",
"create-react-class": "^15.6.0", "create-react-class": "^15.6.0",
"croppie": "^2.6.2",
"deasync": "^0.1.4", "deasync": "^0.1.4",
"deepmerge": "^2.0.1", "deepmerge": "^2.0.1",
"emotion": "^7.3.2", "emotion": "^7.3.2",
...@@ -214,7 +215,7 @@ ...@@ -214,7 +215,7 @@
"hypernova-morearty": "git://github.com/strikingly/hypernova-morearty", "hypernova-morearty": "git://github.com/strikingly/hypernova-morearty",
"hypernova-react": "^2.0.0", "hypernova-react": "^2.0.0",
"ie-version": "^0.1.0", "ie-version": "^0.1.0",
"immer": "^1.7.1", "immer": "^1.5.0",
"immutable": "github:strikingly/immutable-js#6fecef1e909bfe8eba4908c3f5aa4f8e126ce163", "immutable": "github:strikingly/immutable-js#6fecef1e909bfe8eba4908c3f5aa4f8e126ce163",
"in-viewport": "^3.4.1", "in-viewport": "^3.4.1",
"invariant": "^2.2.1", "invariant": "^2.2.1",
......
...@@ -287,7 +287,7 @@ export default { ...@@ -287,7 +287,7 @@ export default {
const { coupon } = _getCart() const { coupon } = _getCart()
const amount = coupon.option.amount const amount = coupon.option.amount
return (discountItem.orderItem.price * amount) / 100 return discountItem.orderItem.price * amount / 100
} else { } else {
return 0 return 0
} }
...@@ -311,7 +311,7 @@ export default { ...@@ -311,7 +311,7 @@ export default {
case 'percentage': case 'percentage':
number = this.isInCondition('productId') number = this.isInCondition('productId')
? this.getDiscountForProductCondition() ? this.getDiscountForProductCondition()
: (this.getTotalItemPriceNum() * coupon.option.amount) / 100 : this.getTotalItemPriceNum() * coupon.option.amount / 100
if (this.getDecimalNum() === 0) { if (this.getDecimalNum() === 0) {
number = Math.round(number) number = Math.round(number)
...@@ -432,7 +432,7 @@ export default { ...@@ -432,7 +432,7 @@ export default {
return taxesNum return taxesNum
} }
taxesNum = ((itemPrice - discountForTax) * taxesRate) / (1 + taxesRate) taxesNum = (itemPrice - discountForTax) * taxesRate / (1 + taxesRate)
if (this.getDecimalNum() === 0) { if (this.getDecimalNum() === 0) {
taxesNum = Math.round(taxesNum) taxesNum = Math.round(taxesNum)
} }
...@@ -447,14 +447,16 @@ export default { ...@@ -447,14 +447,16 @@ export default {
} else if (this.userHasCouponWithType('percentage', coupon)) { } else if (this.userHasCouponWithType('percentage', coupon)) {
if (this.isInCondition('productId')) { if (this.isInCondition('productId')) {
const item = this.getDiscountItem() const item = this.getDiscountItem()
description = __( if (item) {
'EcommerceCoupon|%{amount} off for %{productCount} %{productName} ', description = __(
{ 'EcommerceCoupon|%{amount} off for %{productCount} %{productName} ',
productCount: options ? options.productCount : 1, {
productName: options ? options.productName : item.product.name, productCount: options ? options.productCount : 1,
amount: `${coupon.option.amount}%`, productName: options ? options.productName : item.product.name,
}, amount: `${coupon.option.amount}%`,
) },
)
}
} else { } else {
description = __('EcommerceCoupon|%{amount} Off', { description = __('EcommerceCoupon|%{amount} Off', {
amount: `${coupon.option.amount}%`, amount: `${coupon.option.amount}%`,
...@@ -860,10 +862,11 @@ export default { ...@@ -860,10 +862,11 @@ export default {
if (!item) { if (!item) {
return false return false
} }
return ( return category.parent_id > -1 && category.level === 2
path(['payload', 'item', 'parent_id'])(category) && // return (
pathEq(['payload', 'item', 'level'], 2)(category) // path(['payload', 'item', 'parent_id'])(category) &&
) // pathEq(['payload', 'item', 'level'], 2)(category)
// )
}, },
sortedCategory(categories, orderList) { sortedCategory(categories, orderList) {
orderList = orderList || {} orderList = orderList || {}
......
require('./init')
import React from 'react'
import $ from 'jquery'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import { ErrorBoundary } from 'js/components/ErrorBoundary'
import * as i18nHelper from 'js/utils/helpers/i18nHelper'
import { Provider } from 'react-redux'
import ComponentKitContext from 'js/utils/ComponentKitContext'
import { createStore, applyMiddleware, compose } from 'redux'
import thunkMiddleware from 'redux-thunk'
import PaypalPopupDialog from 'js/components/dialogs/PaypalPopupDialog'
import {
Router,
Route,
IndexRedirect,
IndexRoute,
hashHistory,
} from 'react-router'
import { syncHistoryWithStore } from 'react-router-redux'
import reducers from 'nextgen/app/reducers'
import MiniprogramDashboard from 'nextgen/dashboard/miniprogram/components/dashboard'
import Domains from 'nextgen/app/scenes/Domains'
import Domain from 'nextgen/app/scenes/Domain'
import DomainPurchase from 'nextgen/app/scenes/DomainPurchase'
import { initTrack } from 'js/utils/track'
initTrack() // analytics track init
const middleware = [thunkMiddleware]
const composeEnhancers =
(localStorage &&
localStorage.getItem('__strk_developer__') &&
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) ||
compose
const store = createStore(
reducers,
composeEnhancers(applyMiddleware(...middleware)),
)
// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(hashHistory, store, {
selectLocationState: state => state.get('router').toJS(),
})
function EmptyComponent() {
return <div />
}
function recordLatestViewedHash(nextState, replace) {
const highlightClass = {
miniprogram: '.my-miniprogram',
v2_domains: '.my-domains',
}[location.hash && location.hash.split('/')[1]]
$('.subnav-container .s-link')
.removeClass('current')
.filter(highlightClass)
.addClass('current')
if (localStorage && ['#/miniprogram'].indexOf(location.hash) !== -1) {
localStorage.setItem('dashboard_latest_viewed_hash', location.hash)
}
}
class DashboardRouter extends React.Component {
static childContextTypes() {
PropTypes.object
}
static getChildContext() {
return { location: this.props.location }
}
componentWillMount() {
$('.nav-menu .s-link')
.removeClass('current')
.filter('.my-sites')
.addClass('current')
}
render() {
return (
<Provider store={store}>
<Router history={history}>
<Route path="/" component={EmptyComponent} />
<Route
path="/miniprogram"
component={MiniprogramDashboard}
onEnter={recordLatestViewedHash}
/>
<Route
path="/v2_domains"
component={Domains}
onEnter={recordLatestViewedHash}
/>
<Route
path="/v2_domains/purchase"
component={DomainPurchase}
onEnter={recordLatestViewedHash}
/>
<Route
path="/v2_domains/:domainId"
component={Domain}
onEnter={recordLatestViewedHash}
/>
</Router>
</Provider>
)
}
}
const p1 = require(`promise-loader?global!locales/${i18nHelper.getTranslationFile()}`)
Promise.all([p1()])
.then(([poFile]) => {
const I18n = require('js/utils/i18n')
I18n.init(poFile)
const DashboardRouterWithContext = ComponentKitContext(DashboardRouter)
$(() => {
ReactDOM.render(
<ErrorBoundary>
<AppContainer>
<Provider store={store}>
<DashboardRouterWithContext />
</Provider>
</AppContainer>
<PaypalPopupDialog />
</ErrorBoundary>,
document.getElementById('mainDashboard'),
)
})
})
.catch(e => {
console.error(e, e.stack)
})
if (module.hot) {
module.hot.accept(err => {
if (err) {
console.error(err)
}
})
}
...@@ -620,7 +620,7 @@ class DomainsTab extends React.Component { ...@@ -620,7 +620,7 @@ class DomainsTab extends React.Component {
const v2DomainConnection = PageMetaStore.getV2DomainConnection() const v2DomainConnection = PageMetaStore.getV2DomainConnection()
const showConnectedMessage = const showConnectedMessage =
v2DomainConnection && v2DomainConnection.get('domain_id') v2DomainConnection && v2DomainConnection.get('domain_id')
const forceShowKB = const hasNoDomainId =
v2DomainConnection && !v2DomainConnection.get('domain_id') v2DomainConnection && !v2DomainConnection.get('domain_id')
const isSiteOfResellerClient = PageMetaStore.isSiteOfResellerClient() const isSiteOfResellerClient = PageMetaStore.isSiteOfResellerClient()
const canBuyAllDomains = ConfStore.getCanBuyAllDomains() const canBuyAllDomains = ConfStore.getCanBuyAllDomains()
...@@ -763,7 +763,7 @@ class DomainsTab extends React.Component { ...@@ -763,7 +763,7 @@ class DomainsTab extends React.Component {
) )
} }
const domainSettingsRs = this._renderDomainSettingsBox(forceShowKB) const domainSettingsRs = this._renderDomainSettingsBox(hasNoDomainId)
const MoreartyInput = Morearty.DOM.input const MoreartyInput = Morearty.DOM.input
return ( return (
...@@ -793,7 +793,7 @@ class DomainsTab extends React.Component { ...@@ -793,7 +793,7 @@ class DomainsTab extends React.Component {
)} )}
&nbsp; &nbsp;
<a <a
href={v2DomainSetting ? '/s/v2_domains/' : '/s#/domains'} href={v2DomainSetting ? '/s#/v2_domains/' : '/s#/domains'}
target="_blank"> target="_blank">
{__('Domain|View your new domain in domain dashboard.')} {__('Domain|View your new domain in domain dashboard.')}
</a> </a>
...@@ -872,6 +872,17 @@ class DomainsTab extends React.Component { ...@@ -872,6 +872,17 @@ class DomainsTab extends React.Component {
) : null} ) : null}
{customDomainSaved ? <i className="fa fa-check" /> : null} {customDomainSaved ? <i className="fa fa-check" /> : null}
</div> </div>
{ConfStore.getCanSeeDomainTransferTab() &&
!isSxl &&
hasNoDomainId &&
customDomainStatus !== 'updating' && (
<a
target="_blank"
href="/s#/v2_domains/transfer"
data-track-id="Click Transfer Domain Button">
{__('Transfer your domain to us!')}
</a>
)}
{isSxl && {isSxl &&
currentDomain && ( currentDomain && (
<i <i
......
...@@ -16,9 +16,9 @@ import ComponentKitContext from 'js/utils/ComponentKitContext' ...@@ -16,9 +16,9 @@ import ComponentKitContext from 'js/utils/ComponentKitContext'
import wrapErrorBoundary from 'js/components/ErrorBoundary' import wrapErrorBoundary from 'js/components/ErrorBoundary'
import 'js/reactInit.es6' import 'js/reactInit.es6'
import { initTrack } from 'js/utils/track' import { initTrackEditor } from 'js/utils/track'
initTrack() // analytics track init initTrackEditor() // analytics track init
// These two are direct reads so promises can be fired quicker // These two are direct reads so promises can be fired quicker
const supportedVerticals = ['personal'] const supportedVerticals = ['personal']
......
...@@ -62,8 +62,10 @@ ...@@ -62,8 +62,10 @@
"@types/immutable": "^3.8.7", "@types/immutable": "^3.8.7",
"@types/isomorphic-fetch": "^0.0.33", "@types/isomorphic-fetch": "^0.0.33",
"@types/jest": "^21.1.2", "@types/jest": "^21.1.2",
"@types/jquery": "^3.3.9",
"@types/lodash": "^4.14.61", "@types/lodash": "^4.14.61",
"@types/normalizr": "^2.0.18", "@types/normalizr": "^2.0.18",
"@types/prop-types": "^15.5.5",
"@types/ramda": "^0.25.36", "@types/ramda": "^0.25.36",
"@types/react": "16.0.40", "@types/react": "16.0.40",
"@types/react-dom": "^16.0.4", "@types/react-dom": "^16.0.4",
...@@ -191,6 +193,7 @@ ...@@ -191,6 +193,7 @@
"console-polyfill": "^0.2.1", "console-polyfill": "^0.2.1",
"core-decorators": "^0.20.0", "core-decorators": "^0.20.0",
"create-react-class": "^15.6.0", "create-react-class": "^15.6.0",
"croppie": "^2.6.2",
"deasync": "^0.1.4", "deasync": "^0.1.4",
"deepmerge": "^2.0.1", "deepmerge": "^2.0.1",
"emotion": "^7.3.2", "emotion": "^7.3.2",
......
...@@ -398,6 +398,10 @@ ...@@ -398,6 +398,10 @@
version "21.1.10" version "21.1.10"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-21.1.10.tgz#dcacb5217ddf997a090cc822bba219b4b2fd7984" resolved "https://registry.yarnpkg.com/@types/jest/-/jest-21.1.10.tgz#dcacb5217ddf997a090cc822bba219b4b2fd7984"
"@types/jquery@^3.3.9":
version "3.3.9"
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.3.9.tgz#91f2aaf5c1e91fd79598fc00ecb4504d78b51fd7"
"@types/lodash@^4.14.61": "@types/lodash@^4.14.61":
version "4.14.106" version "4.14.106"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.106.tgz#6093e9a02aa567ddecfe9afadca89e53e5dce4dd" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.106.tgz#6093e9a02aa567ddecfe9afadca89e53e5dce4dd"
...@@ -416,6 +420,12 @@ ...@@ -416,6 +420,12 @@
dependencies: dependencies:
normalizr "*" normalizr "*"
"@types/prop-types@^15.5.5":
version "15.5.5"
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.5.5.tgz#17038dd322c2325f5da650a94d5f9974943625e3"
dependencies:
"@types/react" "*"
"@types/ramda@^0.25.36": "@types/ramda@^0.25.36":
version "0.25.36" version "0.25.36"
resolved "https://registry.yarnpkg.com/@types/ramda/-/ramda-0.25.36.tgz#1ddaf3211c7cd7046fcaefe68c713469ccfc9504" resolved "https://registry.yarnpkg.com/@types/ramda/-/ramda-0.25.36.tgz#1ddaf3211c7cd7046fcaefe68c713469ccfc9504"
...@@ -458,8 +468,8 @@ ...@@ -458,8 +468,8 @@
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.0.40.tgz#caabc2296886f40b67f6fc80f0f3464476461df9" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.0.40.tgz#caabc2296886f40b67f6fc80f0f3464476461df9"
"@types/redux-form@^6.3.6": "@types/redux-form@^6.3.6":
version "6.6.17" version "6.6.21"
resolved "https://registry.yarnpkg.com/@types/redux-form/-/redux-form-6.6.17.tgz#e929df69844734c77d41950affcfa5d1ac1485d9" resolved "https://registry.yarnpkg.com/@types/redux-form/-/redux-form-6.6.21.tgz#e1bcb156ae78987d74feec196da99d3c45703c0c"
dependencies: dependencies:
"@types/react" "*" "@types/react" "*"
redux "^3.6.0" redux "^3.6.0"
...@@ -4269,6 +4279,10 @@ create-react-class@15.x, create-react-class@^15.5.1, create-react-class@^15.5.2, ...@@ -4269,6 +4279,10 @@ create-react-class@15.x, create-react-class@^15.5.1, create-react-class@^15.5.2,
loose-envify "^1.3.1" loose-envify "^1.3.1"
object-assign "^4.1.1" object-assign "^4.1.1"
croppie@^2.6.2:
version "2.6.2"
resolved "http://registry.npm.taobao.org/croppie/download/croppie-2.6.2.tgz#d605ceeffb4aea281f72a63c9a0a305db0a46e50"
cross-spawn@5.0.1: cross-spawn@5.0.1:
version "5.0.1" version "5.0.1"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.0.1.tgz#a3bbb302db2297cbea3c04edf36941f4613aa399" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.0.1.tgz#a3bbb302db2297cbea3c04edf36941f4613aa399"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment