mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-22 19:32:54 +03:00
Added the new MemberPageViewEvent event
refs https://github.com/TryGhost/Team/issues/1306 - This event will be triggered by logged-in members visiting any page of the publication (page, post, tag, author...)
This commit is contained in:
parent
9cc2cb8b87
commit
c6e98e67c0
@ -5,5 +5,6 @@ module.exports = {
|
||||
MemberSignupEvent: require('./lib/MemberSignupEvent'),
|
||||
MemberPaidConverstionEvent: require('./lib/MemberPaidConversionEvent'),
|
||||
MemberPaidCancellationEvent: require('./lib/MemberPaidCancellationEvent'),
|
||||
MemberPageViewEvent: require('./lib/MemberPageViewEvent'),
|
||||
SubscriptionCreatedEvent: require('./lib/SubscriptionCreatedEvent')
|
||||
};
|
||||
|
28
ghost/member-events/lib/MemberPageViewEvent.js
Normal file
28
ghost/member-events/lib/MemberPageViewEvent.js
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @typedef {object} MemberPageViewEventData
|
||||
* @prop {string} memberId
|
||||
* @prop {string} memberLastSeenAt
|
||||
* @prop {string} url
|
||||
*/
|
||||
|
||||
/**
|
||||
* Server-side event firing on page views (page, post, tags...)
|
||||
*/
|
||||
module.exports = class MemberPageViewEvent {
|
||||
/**
|
||||
* @param {MemberPageViewEventData} data
|
||||
* @param {Date} timestamp
|
||||
*/
|
||||
constructor(data, timestamp) {
|
||||
this.data = data;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MemberPageViewEventData} data
|
||||
* @param {Date} [timestamp]
|
||||
*/
|
||||
static create(data, timestamp) {
|
||||
return new MemberPageViewEvent(data, timestamp || new Date);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user