forked from onlook-dev/onlook
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathpayments.ts
More file actions
27 lines (24 loc) · 880 Bytes
/
payments.ts
File metadata and controls
27 lines (24 loc) · 880 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { MainChannels } from '@onlook/models/constants';
import { UsagePlanType } from '@onlook/models/usage';
import { ipcMain } from 'electron';
import { checkoutWithStripe, checkSubscription, manageSubscription } from '../payment';
export function listenForPaymentMessages() {
ipcMain.handle(
MainChannels.CREATE_STRIPE_CHECKOUT,
async (e: Electron.IpcMainInvokeEvent, plan: UsagePlanType = UsagePlanType.PRO) => {
return await checkoutWithStripe(plan);
},
);
ipcMain.handle(
MainChannels.MANAGE_SUBSCRIPTION,
async (e: Electron.IpcMainInvokeEvent, args) => {
return await manageSubscription();
},
);
ipcMain.handle(
MainChannels.CHECK_SUBSCRIPTION,
async (e: Electron.IpcMainInvokeEvent, args) => {
return await checkSubscription();
},
);
}