62 lines
1.8 KiB
CoffeeScript
62 lines
1.8 KiB
CoffeeScript
context = window
|
|
rest = context.JK.Rest()
|
|
|
|
@BetaDownloadLandingPage = React.createClass({
|
|
|
|
render: () ->
|
|
|
|
if this.state.done
|
|
ctaButtonText10 = 'sending you in...'
|
|
ctaButtonText20 = 'sending you in...'
|
|
else if this.state.processing
|
|
ctaButtonText10 = 'hold on...'
|
|
ctaButtonText20 = 'hold on...'
|
|
else
|
|
ctaButtonText10 = `<span>ADD $10 CARD<br/>TO CART</span>`
|
|
ctaButtonText20 = `<span>ADD $20 CARD<br/>TO CART</span>`
|
|
|
|
|
|
|
|
`<div className="top-container">
|
|
<div className="full-row name-and-artist">
|
|
|
|
</div>
|
|
<div className="row summary-text">
|
|
<p className="top-summary">
|
|
The JamKazam BETA app is now ready for download!<br/><br/>We've updated the client to support Windows 10, Windows 11, Mac M1/M2, and Mac Intel.<br/>All JamKazam internals are completely upgraded, resulting in better video, clearer backing tracks & JamTracks, and countless other improvements.
|
|
</p>
|
|
</div>
|
|
</div>`
|
|
|
|
getInitialState: () ->
|
|
{processing:false}
|
|
|
|
componentDidMount:() ->
|
|
$root = $(this.getDOMNode())
|
|
|
|
# add item to cart, create the user if necessary, and then place the order to get the free JamTrack.
|
|
ctaClick: (card_type, e) ->
|
|
e.preventDefault()
|
|
|
|
return if @state.processing
|
|
|
|
loggedIn = context.JK.currentUserId?
|
|
|
|
rest.addGiftCardToShoppingCart({id: card_type}).done((response) =>
|
|
|
|
if loggedIn
|
|
@setState({done: true})
|
|
context.location = '/client#/shoppingCart'
|
|
else
|
|
@setState({done: true})
|
|
context.location = '/client#/shoppingCart'
|
|
|
|
).fail((jqXHR, textStatus, errorMessage) =>
|
|
if jqXHR.status == 422
|
|
errors = JSON.parse(jqXHR.responseText)
|
|
cart_errors = errors?.errors?.cart_id
|
|
context.JK.app.ajaxError(jqXHR, textStatus, errorMessage)
|
|
@setState({processing:false})
|
|
)
|
|
})
|