rittenhop-dev/versions/5.94.2/node_modules/@tryghost/member-events/lib/SubscriptionCreatedEvent.js

32 lines
915 B
JavaScript
Raw Normal View History

2024-09-23 19:40:12 -04:00
/**
* Fired when a subscription is created. This can also happen when inactive subscriptions are created (incomplete, canceled...).
*
* @typedef {object} SubscriptionCreatedEventData
* @prop {string} source
* @prop {string} memberId
* @prop {string} batchId
* @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);
}
};