Create hubspot expansions and churns as users are added and deleted
This commit is contained in:
parent
003ac1c380
commit
9647ac5dee
|
@ -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 {
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -1486,15 +1486,15 @@
|
||||||
pouchdb-promise "^6.0.4"
|
pouchdb-promise "^6.0.4"
|
||||||
through2 "^2.0.0"
|
through2 "^2.0.0"
|
||||||
|
|
||||||
"@budibase/pro@2.5.6-alpha.41":
|
"@budibase/pro@2.5.6-alpha.42":
|
||||||
version "2.5.6-alpha.41"
|
version "2.5.6-alpha.42"
|
||||||
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.5.6-alpha.41.tgz#2632b398159211bf64bf6caff9753c877b6fc09d"
|
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.5.6-alpha.42.tgz#15ec86d9918b7d58e3236240afda31309f3162ae"
|
||||||
integrity sha512-8Zfm+RtcXY77gdXXHti8QT+Vt+1ApuVqYL3KCkxBVbpzgQci/F3mipNXUX8bEy/y+QYAdgn6psDTWAqyr9VALg==
|
integrity sha512-aes19IVAEGqf0YPLJMnOKHv99AR6LO8jMpPVCbSZcZODS3byxh9kC2+sWH1mAd781zymyN79HnwGrVJNOdV8jw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@budibase/backend-core" "2.5.6-alpha.41"
|
"@budibase/backend-core" "2.5.6-alpha.42"
|
||||||
"@budibase/shared-core" "2.4.44-alpha.1"
|
"@budibase/shared-core" "2.4.44-alpha.1"
|
||||||
"@budibase/string-templates" "2.4.44-alpha.1"
|
"@budibase/string-templates" "2.4.44-alpha.1"
|
||||||
"@budibase/types" "2.5.6-alpha.41"
|
"@budibase/types" "2.5.6-alpha.42"
|
||||||
"@koa/router" "8.0.8"
|
"@koa/router" "8.0.8"
|
||||||
bull "4.10.1"
|
bull "4.10.1"
|
||||||
joi "17.6.0"
|
joi "17.6.0"
|
||||||
|
|
Loading…
Reference in New Issue