-
Notifications
You must be signed in to change notification settings - Fork 66
/
types.d.ts
43 lines (35 loc) · 1.47 KB
/
types.d.ts
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
declare module "extpay" {
interface User {
/** user.paid is meant to be a simple way to tell if the user should have paid features activated.
* For subscription payments, paid is only true if subscriptionStatus is active. */
paid: boolean
/** date that the user first paid or null. */
paidAt: Date | null
/** The user's email if there is one or `null`. */
email: string | null
/** date the user installed the extension. */
installedAt: Date
/** date the user confirmed their free trial. */
trialStartedAt: Date | null
/** active means the user's subscription is paid-for.
* past_due means the user's most recent subscription payment has failed (expired card, insufficient funds, etc).
* canceled means that the user has canceled their subscription and the end of their last paid period has passed. */
subscriptionStatus?: "active" | "past_due" | "canceled"
/** date that the user's subscription is set to cancel or did cancel at. */
subscriptionCancelAt?: Date | null
}
interface ExtPay {
getUser: () => Promise<User>
onPaid: {
addListener: (cb: (user: User) => void) => void
}
openPaymentPage: () => Promise<void>
openLoginPage: () => Promise<void>
openTrialPage: (displayText?: string) => Promise<void>
onTrialStarted: {
addListener: (cb: (user: User) => void) => void
}
startBackground: () => void
}
export default function ExtPay(extensionId: string): ExtPay
}