mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
8d07d6e93b
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
29 lines
757 B
JavaScript
29 lines
757 B
JavaScript
/**
|
|
* @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]
|
|
*/
|
|
|
|
module.exports = class SubscriptionCreatedEvent {
|
|
/**
|
|
* @param {SubscriptionCreatedEventData} data
|
|
* @param {Date} timestamp
|
|
*/
|
|
constructor(data, timestamp) {
|
|
this.data = data;
|
|
this.timestamp = timestamp;
|
|
}
|
|
|
|
/**
|
|
* @param {SubscriptionCreatedEventData} data
|
|
* @param {Date} [timestamp]
|
|
*/
|
|
static create(data, timestamp) {
|
|
return new SubscriptionCreatedEvent(data, timestamp ?? new Date);
|
|
}
|
|
};
|