Merge branch 'develop' into menu-tabs

This commit is contained in:
ntr
2019-09-03 17:02:18 +10:00
18 changed files with 70 additions and 40 deletions
+6 -1
View File
@@ -13,6 +13,11 @@ const registerEvents = require('./events');
const Mnml = require('./components/mnml');
function stripeKey() {
if (window.location.host === 'mnml.gg') return 'pk_live_fQGrL1uWww2ot8W1G7vTySAv004ygmnMXq';
return 'pk_test_Cb49tTqTXpzk7nEmlGzRrNJg00AU0aNZDj';
}
// Redux Store
const store = createStore(
combineReducers(reducers),
@@ -30,7 +35,7 @@ document.fonts.load('16pt "Jura"').then(() => {
const App = () => (
<Provider store={store}>
<StripeProvider apiKey="pk_test_Cb49tTqTXpzk7nEmlGzRrNJg00AU0aNZDj">
<StripeProvider apiKey={stripeKey()}>
<Mnml />
</StripeProvider>
</Provider>
+16 -6
View File
@@ -1,6 +1,16 @@
const preact = require('preact');
const { injectStripe } = require('react-stripe-elements');
function subPlan() {
if (window.location.host === 'mnml.gg') return 'plan_Fjdtsd4i7aVLe1';
return 'prod_FWSA8RoyMMV3st';
}
function bitsSku() {
if (window.location.host === 'mnml.gg') return 'sku_Fjdu7zOy3sLGc5';
return 'sku_FjuNxONdWewjH2';
}
function BitsBtn(args) {
const {
stripe,
@@ -8,18 +18,18 @@ function BitsBtn(args) {
} = args;
function subscribeClick() {
stripe.redirectToCheckout({
items: [{ plan: 'plan_Fhl9r7UdMadjGi', quantity: 1 }],
successUrl: 'http://localhost',
cancelUrl: 'http://localhost',
items: [{ plan: subPlan(), quantity: 1 }],
successUrl: window.location.origin,
cancelUrl: window.location.origin,
clientReferenceId: account.id,
});
}
function bitsClick() {
stripe.redirectToCheckout({
items: [{ sku: 'sku_FHUfNEhWQaVDaT', quantity: 1 }],
successUrl: 'http://localhost',
cancelUrl: 'http://localhost',
items: [{ sku: bitsSku(), quantity: 1 }],
successUrl: window.location.origin,
cancelUrl: window.location.origin,
clientReferenceId: account.id,
});
}
+5 -8
View File
@@ -1,11 +1,8 @@
const toast = require('izitoast');
const cbor = require('borc');
const socketUrl = () => {
if (process.env.NODE_ENV === 'production') return 'wss://mnml.gg/api/ws';
if (process.env.NODE_ENV === 'staging') return 'wss://sixtysix.pro/api/ws';
return 'ws://localhost/api/ws';
};
const SOCKET_URL =
`${window.location.protocol === 'https:' ? 'wss://' : 'ws://'}${window.location.host}/api/ws`;
function errorToast(err) {
console.error(err);
@@ -226,8 +223,8 @@ function createSocket(events) {
ItemInfo: onItemInfo,
Pong: onPong,
QueueRequested: () => console.log('pvp queue request received'),
QueueJoined: () => console.log('you have joined the pvp queue'),
QueueRequested: () => events.notify('pvp queue request received'),
QueueJoined: () => events.notify('you have joined the pvp queue'),
Error: errHandler,
};
@@ -299,7 +296,7 @@ function createSocket(events) {
ws = null;
}
ws = new WebSocket(socketUrl());
ws = new WebSocket(SOCKET_URL);
ws.binaryType = 'arraybuffer';
// Listen for messages