Updated subscription created/canceled events data
refs https://github.com/TryGhost/Team/issues/1865 - adds new subscription canceled event - updates existing subscription created event to include tier id and source data
This commit is contained in:
parent
4187f0da54
commit
8d07d6e93b
@ -8,5 +8,6 @@ module.exports = {
|
||||
MemberPaidCancellationEvent: require('./lib/MemberPaidCancellationEvent'),
|
||||
MemberPageViewEvent: require('./lib/MemberPageViewEvent'),
|
||||
SubscriptionCreatedEvent: require('./lib/SubscriptionCreatedEvent'),
|
||||
MemberCommentEvent: require('./lib/MemberCommentEvent')
|
||||
MemberCommentEvent: require('./lib/MemberCommentEvent'),
|
||||
SubscriptionCancelledEvent: require('./lib/SubscriptionCancelledEvent')
|
||||
};
|
||||
|
26
ghost/member-events/lib/SubscriptionCancelledEvent.js
Normal file
26
ghost/member-events/lib/SubscriptionCancelledEvent.js
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @typedef {object} SubscriptionCancelledEventData
|
||||
* @prop {string} source
|
||||
* @prop {string} memberId
|
||||
* @prop {string} tierId
|
||||
* @prop {string} subscriptionId
|
||||
*/
|
||||
|
||||
module.exports = class SubscriptionCancelledEvent {
|
||||
/**
|
||||
* @param {SubscriptionCancelledEventData} data
|
||||
* @param {Date} timestamp
|
||||
*/
|
||||
constructor(data, timestamp) {
|
||||
this.data = data;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {SubscriptionCancelledEventData} data
|
||||
* @param {Date} [timestamp]
|
||||
*/
|
||||
static create(data, timestamp) {
|
||||
return new SubscriptionCancelledEvent(data, timestamp || new Date);
|
||||
}
|
||||
};
|
@ -1,6 +1,8 @@
|
||||
/**
|
||||
* @typedef {object} SubscriptionCreatedEventData
|
||||
* @prop {string} source
|
||||
* @prop {string} memberId
|
||||
* @prop {string} tierId
|
||||
* @prop {string} subscriptionId
|
||||
* @prop {string} offerId
|
||||
* @prop {import('@tryghost/member-attribution/lib/attribution').Attribution} [attribution]
|
||||
|
Loading…
Reference in New Issue
Block a user