Fixed payment success modal
This commit is contained in:
parent
cf18184e26
commit
da0ccf8d82
@ -32,7 +32,7 @@ export default {
|
|||||||
'Yes, add suffix',
|
'Yes, add suffix',
|
||||||
),
|
),
|
||||||
paymentSuccess: simpleModal(
|
paymentSuccess: simpleModal(
|
||||||
'<p>Thank you for your payment! Your sponsorship will be active in a minute.</p>',
|
'<h3>Thank you for your payment!</h3><p>Your sponsorship will be active in a minute.</p>',
|
||||||
'Ok',
|
'Ok',
|
||||||
),
|
),
|
||||||
providerRedirection: simpleModal(
|
providerRedirection: simpleModal(
|
||||||
|
@ -11,7 +11,6 @@ const { exportWorkspace } = utils.queryParams;
|
|||||||
const { silent } = utils.queryParams;
|
const { silent } = utils.queryParams;
|
||||||
const resetApp = utils.queryParams.reset;
|
const resetApp = utils.queryParams.reset;
|
||||||
const deleteMarkerMaxAge = 1000;
|
const deleteMarkerMaxAge = 1000;
|
||||||
const checkSponsorshipAfter = (5 * 60 * 1000) + (30 * 1000); // tokenExpirationMargin + 30 sec
|
|
||||||
|
|
||||||
class Connection {
|
class Connection {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -384,22 +383,6 @@ const localDbSvc = {
|
|||||||
.forEach(file => workspaceSvc.deleteFile(file.id));
|
.forEach(file => workspaceSvc.deleteFile(file.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable sponsorship
|
|
||||||
if (utils.queryParams.paymentSuccess) {
|
|
||||||
window.location.hash = ''; // PaymentSuccess param is always on its own
|
|
||||||
store.dispatch('modal/open', 'paymentSuccess')
|
|
||||||
.catch(() => { /* Cancel */ });
|
|
||||||
const sponsorToken = store.getters['workspace/sponsorToken'];
|
|
||||||
// Force check sponsorship after a few seconds
|
|
||||||
const currentDate = Date.now();
|
|
||||||
if (sponsorToken && sponsorToken.expiresOn > currentDate - checkSponsorshipAfter) {
|
|
||||||
store.dispatch('data/addGoogleToken', {
|
|
||||||
...sponsorToken,
|
|
||||||
expiresOn: currentDate - checkSponsorshipAfter,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sync local DB periodically
|
// Sync local DB periodically
|
||||||
utils.setInterval(() => localDbSvc.sync(), 1000);
|
utils.setInterval(() => localDbSvc.sync(), 1000);
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ const minAutoSyncEvery = 60 * 1000; // 60 sec
|
|||||||
const inactivityThreshold = 3 * 1000; // 3 sec
|
const inactivityThreshold = 3 * 1000; // 3 sec
|
||||||
const restartSyncAfter = 30 * 1000; // 30 sec
|
const restartSyncAfter = 30 * 1000; // 30 sec
|
||||||
const restartContentSyncAfter = 1000; // Enough to detect an authorize pop up
|
const restartContentSyncAfter = 1000; // Enough to detect an authorize pop up
|
||||||
|
const checkSponsorshipAfter = (5 * 60 * 1000) + (30 * 1000); // tokenExpirationMargin + 30 sec
|
||||||
const maxContentHistory = 20;
|
const maxContentHistory = 20;
|
||||||
|
|
||||||
const LAST_SEEN = 0;
|
const LAST_SEEN = 0;
|
||||||
@ -879,11 +880,27 @@ export default {
|
|||||||
}
|
}
|
||||||
const workspace = await workspaceProvider.initWorkspace();
|
const workspace = await workspaceProvider.initWorkspace();
|
||||||
// Fix the URL hash
|
// Fix the URL hash
|
||||||
|
const { paymentSuccess } = utils.queryParams;
|
||||||
utils.setQueryParams(workspaceProvider.getWorkspaceParams(workspace));
|
utils.setQueryParams(workspaceProvider.getWorkspaceParams(workspace));
|
||||||
|
|
||||||
store.dispatch('workspace/setCurrentWorkspaceId', workspace.id);
|
store.dispatch('workspace/setCurrentWorkspaceId', workspace.id);
|
||||||
await localDbSvc.init();
|
await localDbSvc.init();
|
||||||
|
|
||||||
|
// Enable sponsorship
|
||||||
|
if (paymentSuccess) {
|
||||||
|
store.dispatch('modal/open', 'paymentSuccess')
|
||||||
|
.catch(() => { /* Cancel */ });
|
||||||
|
const sponsorToken = store.getters['workspace/sponsorToken'];
|
||||||
|
// Force check sponsorship after a few seconds
|
||||||
|
const currentDate = Date.now();
|
||||||
|
if (sponsorToken && sponsorToken.expiresOn > currentDate - checkSponsorshipAfter) {
|
||||||
|
store.dispatch('data/addGoogleToken', {
|
||||||
|
...sponsorToken,
|
||||||
|
expiresOn: currentDate - checkSponsorshipAfter,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Try to find a suitable action provider
|
// Try to find a suitable action provider
|
||||||
actionProvider = providerRegistry.providersById[utils.queryParams.providerId] || actionProvider;
|
actionProvider = providerRegistry.providersById[utils.queryParams.providerId] || actionProvider;
|
||||||
if (actionProvider && actionProvider.performAction) {
|
if (actionProvider && actionProvider.performAction) {
|
||||||
|
Loading…
Reference in New Issue
Block a user