diff options
Diffstat (limited to 'src/features/planSelection/store.js')
-rw-r--r-- | src/features/planSelection/store.js | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/src/features/planSelection/store.js b/src/features/planSelection/store.js index e229c37e5..0d4672722 100644 --- a/src/features/planSelection/store.js +++ b/src/features/planSelection/store.js | |||
@@ -42,7 +42,6 @@ export default class PlanSelectionStore extends FeatureStore { | |||
42 | // ACTIONS | 42 | // ACTIONS |
43 | 43 | ||
44 | this._registerActions(createActionBindings([ | 44 | this._registerActions(createActionBindings([ |
45 | [planSelectionActions.upgradeAccount, this._upgradeAccount], | ||
46 | [planSelectionActions.downgradeAccount, this._downgradeAccount], | 45 | [planSelectionActions.downgradeAccount, this._downgradeAccount], |
47 | [planSelectionActions.hideOverlay, this._hideOverlay], | 46 | [planSelectionActions.hideOverlay, this._hideOverlay], |
48 | ])); | 47 | ])); |
@@ -64,47 +63,12 @@ export default class PlanSelectionStore extends FeatureStore { | |||
64 | @action stop() { | 63 | @action stop() { |
65 | super.stop(); | 64 | super.stop(); |
66 | debug('PlanSelectionStore::stop'); | 65 | debug('PlanSelectionStore::stop'); |
67 | this.reset(); | ||
68 | this.isFeatureActive = false; | 66 | this.isFeatureActive = false; |
69 | } | 67 | } |
70 | 68 | ||
71 | // ========== PRIVATE METHODS ========= // | 69 | // ========== PRIVATE METHODS ========= // |
72 | 70 | ||
73 | // Actions | 71 | // Actions |
74 | |||
75 | @action _upgradeAccount = ({ planId, onCloseWindow = () => null }) => { | ||
76 | let hostedPageURL = this.stores.features.features.subscribeURL; | ||
77 | |||
78 | const parsedUrl = new URL(hostedPageURL); | ||
79 | const params = new URLSearchParams(parsedUrl.search.slice(1)); | ||
80 | |||
81 | params.set('plan', planId); | ||
82 | |||
83 | hostedPageURL = this.stores.user.getAuthURL(`${parsedUrl.origin}${parsedUrl.pathname}?${params.toString()}`); | ||
84 | |||
85 | const win = new BrowserWindow({ | ||
86 | parent: remote.getCurrentWindow(), | ||
87 | modal: true, | ||
88 | title: '🔒 Upgrade Your Franz Account', | ||
89 | width: 800, | ||
90 | height: window.innerHeight - 100, | ||
91 | maxWidth: 800, | ||
92 | minWidth: 600, | ||
93 | webPreferences: { | ||
94 | nodeIntegration: true, | ||
95 | webviewTag: true, | ||
96 | }, | ||
97 | }); | ||
98 | win.loadURL(`file://${__dirname}/../../index.html#/payment/${encodeURIComponent(hostedPageURL)}`); | ||
99 | |||
100 | win.on('closed', () => { | ||
101 | this.stores.user.getUserInfoRequest.invalidate({ immediately: true }); | ||
102 | this.stores.features.featuresRequest.invalidate({ immediately: true }); | ||
103 | |||
104 | onCloseWindow(); | ||
105 | }); | ||
106 | }; | ||
107 | |||
108 | @action _downgradeAccount = () => { | 72 | @action _downgradeAccount = () => { |
109 | downgradeUserRequest.execute(); | 73 | downgradeUserRequest.execute(); |
110 | } | 74 | } |
@@ -112,4 +76,8 @@ export default class PlanSelectionStore extends FeatureStore { | |||
112 | @action _hideOverlay = () => { | 76 | @action _hideOverlay = () => { |
113 | this.hideOverlay = true; | 77 | this.hideOverlay = true; |
114 | } | 78 | } |
79 | |||
80 | @action _showOverlay = () => { | ||
81 | this.hideOverlay = false; | ||
82 | } | ||
115 | } | 83 | } |