diff --git a/internal_packages/send-later/lib/send-later-popover.jsx b/internal_packages/send-later/lib/send-later-popover.jsx index ec6f68aad..d62ebd6eb 100644 --- a/internal_packages/send-later/lib/send-later-popover.jsx +++ b/internal_packages/send-later/lib/send-later-popover.jsx @@ -56,21 +56,21 @@ class SendLaterPopover extends Component { onSelectMenuOption = (optionKey)=> { const date = SendLaterOptions[optionKey](); - this.onSelectDate(date); + this.onSelectDate(date, optionKey); }; onSelectCustomOption = (value)=> { const date = DateUtils.futureDateFromString(value); if (date) { - this.onSelectDate(date); + this.onSelectDate(date, "Custom"); } else { NylasEnv.showErrorDialog(`Sorry, we can't parse ${value} as a valid date.`); } }; - onSelectDate = (date)=> { + onSelectDate = (date, label)=> { const formatted = DateUtils.format(date.utc()); - SendLaterActions.sendLater(this.props.draftClientId, formatted); + SendLaterActions.sendLater(this.props.draftClientId, formatted, label); this.setState({scheduledDate: 'saving', inputDate: null}); this.refs.popover.close(); }; diff --git a/internal_packages/send-later/lib/send-later-store.js b/internal_packages/send-later/lib/send-later-store.js index 13aefc3d9..07ea9bd1c 100644 --- a/internal_packages/send-later/lib/send-later-store.js +++ b/internal_packages/send-later/lib/send-later-store.js @@ -42,12 +42,13 @@ class SendLaterStore extends NylasStore { }); }; - recordAction(sendLaterDate) { + recordAction(sendLaterDate, label) { try { if (sendLaterDate) { - const sec = Math.round(((new Date(sendLaterDate)).valueOf() - Date.now()) / 1000); + const min = Math.round(((new Date(sendLaterDate)).valueOf() - Date.now()) / 1000 / 60); Actions.recordUserEvent("Send Later", { - snoozeTime: sec, + sendLaterTime: min, + optionLabel: label, }); } else { Actions.recordUserEvent("Send Later Cancel"); @@ -57,8 +58,8 @@ class SendLaterStore extends NylasStore { } } - onSendLater = (draftClientId, sendLaterDate)=> { - this.recordAction(sendLaterDate) + onSendLater = (draftClientId, sendLaterDate, label)=> { + this.recordAction(sendLaterDate, label) this.setMetadata(draftClientId, {sendLaterDate}); }; diff --git a/internal_packages/thread-snooze/lib/snooze-popover-body.jsx b/internal_packages/thread-snooze/lib/snooze-popover-body.jsx index 387dead4b..31952ed62 100644 --- a/internal_packages/thread-snooze/lib/snooze-popover-body.jsx +++ b/internal_packages/thread-snooze/lib/snooze-popover-body.jsx @@ -65,10 +65,10 @@ class SnoozePopoverBody extends Component { this.props.swipeCallback(this.didSnooze); } - onSnooze(dateGenerator) { + onSnooze(dateGenerator, label) { const utcDate = dateGenerator().utc(); const formatted = DateUtils.format(utcDate); - SnoozeActions.snoozeThreads(this.props.threads, formatted); + SnoozeActions.snoozeThreads(this.props.threads, formatted, label); this.didSnooze = true; this.props.closePopover(); @@ -87,7 +87,7 @@ class SnoozePopoverBody extends Component { if (value.length > 0 && ["Enter", "Return"].includes(event.key)) { const inputDate = DateUtils.futureDateFromString(value); if (inputDate) { - this.onSnooze(()=> inputDate); + this.onSnooze(() => {return inputDate}, "Custom"); // Prevent onInputChange from firing event.stopPropagation() } @@ -103,7 +103,7 @@ class SnoozePopoverBody extends Component {