2021-10-18 16:27:17 +03:00
|
|
|
/**
|
|
|
|
* @typedef {object} SubscriptionCreatedEventData
|
|
|
|
* @prop {string} memberId
|
|
|
|
* @prop {string} subscriptionId
|
|
|
|
* @prop {string} offerId
|
2022-08-18 18:38:42 +03:00
|
|
|
* @prop {import('@tryghost/member-attribution/lib/attribution').Attribution} [attribution]
|
2021-10-18 16:27:17 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
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) {
|
2022-08-18 18:38:42 +03:00
|
|
|
return new SubscriptionCreatedEvent(data, timestamp ?? new Date);
|
2021-10-18 16:27:17 +03:00
|
|
|
}
|
|
|
|
};
|