Merge pull request #10474 from Budibase/pricing/hubspot-updates
Plan changed event updates
This commit is contained in:
commit
ef6e3f26a7
|
@ -15,17 +15,18 @@ import {
|
||||||
|
|
||||||
async function planChanged(
|
async function planChanged(
|
||||||
account: Account,
|
account: Account,
|
||||||
from: PlanType,
|
opts: {
|
||||||
to: PlanType,
|
from: PlanType
|
||||||
quantity: number | undefined,
|
to: PlanType
|
||||||
duration: PriceDuration | undefined
|
fromQuantity: number | undefined
|
||||||
|
toQuantity: number | undefined
|
||||||
|
fromDuration: PriceDuration | undefined
|
||||||
|
toDuration: PriceDuration | undefined
|
||||||
|
}
|
||||||
) {
|
) {
|
||||||
const properties: LicensePlanChangedEvent = {
|
const properties: LicensePlanChangedEvent = {
|
||||||
accountId: account.accountId,
|
accountId: account.accountId,
|
||||||
to,
|
...opts,
|
||||||
from,
|
|
||||||
quantity,
|
|
||||||
duration,
|
|
||||||
}
|
}
|
||||||
await publishEvent(Event.LICENSE_PLAN_CHANGED, properties)
|
await publishEvent(Event.LICENSE_PLAN_CHANGED, properties)
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ export const plan = (type: PlanType = PlanType.FREE): PurchasedPlan => {
|
||||||
type,
|
type,
|
||||||
usesInvoicing: false,
|
usesInvoicing: false,
|
||||||
model: PlanModel.PER_USER,
|
model: PlanModel.PER_USER,
|
||||||
price: price(),
|
price: type !== PlanType.FREE ? price() : undefined,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,10 @@ export interface LicensePlanChangedEvent {
|
||||||
from: PlanType
|
from: PlanType
|
||||||
to: PlanType
|
to: PlanType
|
||||||
// may not be on historical events
|
// may not be on historical events
|
||||||
// free plans won't have a duration
|
fromDuration: PriceDuration | undefined
|
||||||
duration: PriceDuration | undefined
|
toDuration: PriceDuration | undefined
|
||||||
// may not be on historical events
|
fromQuantity: number | undefined
|
||||||
// free plans won't have a quantity
|
toQuantity: number | undefined
|
||||||
quantity: number | undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LicenseActivatedEvent {
|
export interface LicenseActivatedEvent {
|
||||||
|
|
Loading…
Reference in New Issue